Repository: ViacomInc/data-point
Pull request #61 (2017-12-19 15:55:28)

Remove support for filters
Filters were an undocumented legacy feature. This also moves function validation to the factory
instead of the reducer.


Patch:
diff --git a/packages/data-point/lib/core/factory.js b/packages/data-point/lib/core/factory.js
index 216af31..6a3d7dd 100644
--- a/packages/data-point/lib/core/factory.js
+++ b/packages/data-point/lib/core/factory.js
@@ -6,7 +6,6 @@ const normalizeEntities = require('./normalize-entities')
 const transform = require('./transform')
 
 const storeValues = require('../stores/values')
-const storeFilters = require('../stores/filters')
 const storeEntities = require('../stores/entities')
 const storeEntityTypes = require('../stores/entity-types')
 const storeMiddleware = require('../stores/middleware')
@@ -52,7 +51,6 @@ function create (spec) {
   const manager = {
     middleware: storeMiddleware.create(),
     values: storeValues.create(),
-    filters: storeFilters.create(),
     entities: storeEntities.create(entityTypes),
     entityTypes
   }
@@ -60,7 +58,6 @@ function create (spec) {
   manager.transform = _.partial(transform, manager)
 
   // add single item (singlular)
-  manager.addReducer = manager.filters.add
   manager.addValue = manager.values.add
   manager.addEntityTypes = manager.entityTypes.add
   manager.use = manager.middleware.use
@@ -84,7 +81,6 @@ function create (spec) {
   manager.addEntityTypes('schema', EntitySchema)
 
   addToStore(manager.values, options.values)
-  addToStore(manager.filters, options.reducers)
   addToStore(manager.entityTypes, options.entityTypes)
   manager.addEntities(options.entities)
 
diff --git a/packages/data-point/lib/entity-types/resolve-entity/resolve-entity.js b/packages/data-point/lib/entity-types/resolve-entity/resolve-entity.js
index cc28024..101d384 100644
--- a/packages/data-point/lib/entity-types/resolve-entity/resolve-entity.js
+++ b/packages/data-point/lib/entity-types/resolve-entity/resolve-entity.js
@@ -40,7 +40,7 @@ function createCurrentAccumulator (store, accumulator, reducer) {
     context: entity,
     reducer: currentReducer,
     initialValue: accumulator.value,
-    // shortcut to reducer.spec.params, mostly used by filters
+    // shortcut to reducer.spec.params
     params: entity.params
   })
 
diff --git a/packages/data-point/lib/parameter/parameter-expression.js b/packages/data-point/lib/parameter/parameter-expression.js
deleted file mode 100644
index 3c39095..0000000
--- a/packages/data-point/lib/parameter/parameter-expression.js
+++ /dev/null
@@ -1,71 +0,0 @@
-'use strict'
-
-const ParameterType = require('./parameter-type')
-
-const numberTest = /^-?\d*[.]?\d+$/
-const stringTest = /^"(.*)"$/
-const reducerTest = /^\w+(\.\w+)*$/
-
-/**
- * Defines a parameter
- * @typedef {Object} Parameter
- * @property {string} type - parameter type, value from ParameterType
- * @property {string} value - parsed value of the parameter
- */
-
-/**
- * create a Parameter object
- * @param  {string} type  type of parameter
- * @param  {*} value parsed value of the parameter
- * @return {Parameter}
- */
-function create (type, value) {
-  return Object.freeze({
-    type,
-    value
-  })
-}
-
-module.exports.create = create
-
-/**
- * parse parameter value into a Parameter type.
- * @param  {string} value raw value of the parameter
- * @return {Parameter}       parsed Parameter
- */
-function parse (value) {
-  if (value === 'undefined') {
-    return create(ParameterType.UNDEFINED, undefined)
-  }
-
-  if (value === 'null') {
-    return create(ParameterType.NULL, null)
-  }
-
-  if (value === 'true') {
-    return create(ParameterType.BOOLEAN, true)
-  }
-
-  if (value === 'false') {
-    return create(ParameterType.BOOLEAN, false)
-  }
-
-  if (stringTest.test(value)) {
-    return create(ParameterType.STRING, value.slice(1, -1))
-  }
-
-  if (numberTest.test(value)) {
-    return create(ParameterType.NUMBER, parseFloat(value))
-  }
-
-  if (reducerTest.test(value)) {
-    return create(ParameterType.REDUCER, value)
-  }
-
-  return create(
-    ParameterType.ERROR,
-    new Error(`unrecognized parameter:${value}`)
-  )
-}
-
-module.exports.parse = parse
diff --git a/packages/data-point/lib/parameter/parameter-type.js b/packages/data-point/lib/parameter/parameter-type.js
deleted file mode 100644
index e6cea94..0000000
--- a/packages/data-point/lib/parameter/parameter-type.js
+++ /dev/null
@@ -1,18 +0,0 @@
-'use strict'
-
-/**
- * Enum for Parameter Types
- * @readonly
- * @enum {string}
- */
-const ParameterType = {
-  UNDEFINED: 'undefined',
-  NULL: 'null',
-  BOOLEAN: 'boolean',
-  STRING: 'string',
-  NUMBER: 'number',
-  REDUCER: 'reducer',
-  ERROR: 'error'
-}
-
-module.exports = Object.freeze(ParameterType)
diff --git a/packages/data-point/lib/reducer-function/factory.js b/packages/data-point/lib/reducer-function/factory.js
index 8d771fd..71c099b 100644
--- a/packages/data-point/lib/reducer-function/factory.js
+++ b/packages/data-point/lib/reducer-function/factory.js
@@ -1,7 +1,6 @@
 'use strict'
 
 const _ = require('lodash')
-const parameterParser = require('../parameter/parameter-expression')
 
 const REDUCER_FUNCTION = (module.exports.type = 'ReducerFunction')
 
@@ -15,62 +14,37 @@ const REDUCER_FUNCTION = (module.exports.type = 'ReducerFunction')
  */
 function ReducerFunction () {
   this.type = REDUCER_FUNCTION
-  this.name = ''
-  this.parameters = []
-  this.isFunction = false
   this.body = undefined
 }
 
 module.exports.ReducerFunction = ReducerFunction
 
-function isValidFunction (source) {
-  return _.isFunction(source) || source.length === 2
-}
-
-module.exports.isValidFunction = isValidFunction
-
+/**
+ * @param {*} source
+ * @returns {boolean}
+ */
 function isFunction (source) {
-  return (
-    isValidFunction(source) ||
-    (_.isString(source) && source.match(/^(\w[\w.]*)\((.*)\)/) !== null)
-  )
+  return _.isFunction(source)
 }
 
 module.exports.isFunction = isFunction
 
-function getFunctionName (source) {
-  return source.match(/.+?(?=\()/)[0]
-}
-
-module.exports.getFunctionName = getFunctionName
-
-function getParameters (source) {
-  return source.match(/.*?\(([^)]*)\)/)[1]
-}
-
-module.exports.getParameters = getParameters
-
-function splitParameters (source) {
-  return source.split(',').map(_.trim)
-}
-
-module.exports.splitParameters = splitParameters
-
 /**
- * Parse parameters from function source
- * @param {string} source function source
- * @returns
+ * @param {Function} fn
+ * @throws if fn has an arity greater than 2
+ * @returns {boolean}
  */
-function parseParameters (source) {
-  const args = getParameters(source)
-  let argsList = args.split(',').map(_.trim)
-
-  argsList = _.compact(argsList)
+function validateFunction (fn) {
+  if (fn.length > 2) {
+    const e = new Error(`Reducer functions must have an arity of 2 at most`)
+    e.name = 'InvalidArity'
+    throw e
+  }
 
-  return argsList.map(parameterParser.parse)
+  return true
 }
 
-module.exports.parseParameters = parseParameters
+module.exports.validateFunction = validateFunction
 
 /**
  * parse reducer
@@ -78,16 +52,9 @@ module.exports.parseParameters = parseParameters
  * @return {reducer}
  */
 function create (source) {
+  validateFunction(source)
   const reducer = new ReducerFunction()
-
-  if (_.isFunction(source)) {
-    reducer.isFunction = true
-    reducer.body = source
-  } else {
-    reducer.name = getFunctionName(source)
-    reducer.parameters = parseParameters(source)
-  }
-
+  reducer.body = source
   return Object.freeze(reducer)
 }
 
diff --git a/packages/data-point/lib/resolve/reducer-function.js b/packages/data-point/lib/resolve/reducer-function.js
index e3d10c8..adf787f 100644
--- a/packages/data-point/lib/resolve/reducer-function.js
+++ b/packages/data-point/lib/resolve/reducer-function.js
@@ -1,95 +1,34 @@
 'use strict'
 
-const _ = require('lodash')
 const Promise = require('bluebird')
 const utils = require('../utils')
 
-/**
- * applies reducer parameters and passes them to reducer function,
- * it is expected that the filterFunction will return a function
- * in return with the form of (acc, done) - node style callback
- *
- * @param {any} filterFunction
- * @param {any} reducerParameters
- * @returns
- */
-function getReducerCallback (filterFunction, reducerParameters) {
-  const parameterValues = _.map(reducerParameters, 'value')
-  return filterFunction.apply(null, parameterValues)
-}
-
-module.exports.getReducerCallback = getReducerCallback
-
-/**
- * get callback function from its ObjectStoreManager
- *
- * @param {any} filterStore
- * @param {any} reducerFunction
- * @returns
- */
-function getCallbackFunction (filterStore, reducerFunction) {
-  const filterFunction = filterStore.get(reducerFunction.name)
-  const reducerParameters = reducerFunction.parameters
-
-  return getReducerCallback(filterFunction, reducerParameters)
-}
-
-module.exports.getCallbackFunction = getCallbackFunction
-
 /**
  * Resolve a ReducerFunction
- *
- * @param {ObjectStoreManager} filterStore
  * @param {Accumulator} accumulator
- * @param {ReducerFunction} reducerFunction
+ * @param {ReducerFunction} reducer
  * @returns {Promise<Accumulator>}
  */
-function resolve (filterStore, accumulator, reducerFunction) {
-  const callbackFunction = reducerFunction.isFunction
-    ? reducerFunction.body
-    : getCallbackFunction(filterStore, reducerFunction)
-
-  if (typeof callbackFunction !== 'function') {
-    const e = new Error(
-      `ReducerFunction '${reducerFunction.name}' should return a function`
-    )
-    e.name = 'InvalidType'
-    return Promise.reject(e)
-  }
-
-  if (callbackFunction.length > 2) {
-    const e = new Error(
-      `ReducerFunction '${
-        reducerFunction.name
-      }' must have at most an arity of 2`
-    )
-    e.name = 'InvalidArity'
-    return Promise.reject(e)
-  }
-
-  const currentAccumulator = utils.set(
-    accumulator,
-    'currentFilter',
-    reducerFunction
-  )
+function resolve (accumulator, reducer) {
+  const callbackFunction = reducer.body
 
   if (callbackFunction.length === 2) {
-    // callbackFunction is expected to be a Node Style
+    // if the arity is 2, we expect a Node Style
     // callback function with the form of (acc, done)
     return new Promise((resolve, reject) => {
       callbackFunction(accumulator, (err, value) => {
         if (err) {
           return reject(err)
         }
-        resolve(utils.set(currentAccumulator, 'value', value))
+        resolve(utils.set(accumulator, 'value', value))
       })
     })
   }
 
   // callbackFunction is assumed to be either sync
   // or Promise returned value
-  return Promise.try(callbackFunction.bind(null, accumulator)).then(result => {
-    return utils.set(currentAccumulator, 'value', result)
+  return Promise.try(() => callbackFunction(accumulator)).then(value => {
+    return utils.set(accumulator, 'value', value)
   })
 }
 
diff --git a/packages/data-point/lib/resolve/reducer.js b/packages/data-point/lib/resolve/reducer.js
index 63857da..f9c4a13 100644
--- a/packages/data-point/lib/resolve/reducer.js
+++ b/packages/data-point/lib/resolve/reducer.js
@@ -26,7 +26,7 @@ function getReducerFunction (store, reducerType) {
       )
       break
     case 'ReducerFunction':
-      reducerResolver = _.partial(resolveReducerFunction.resolve, store.filters)
+      reducerResolver = resolveReducerFunction.resolve
       break
     case 'ReducerEntity':
       /* eslint no-use-before-define: "off" */
diff --git a/packages/data-point/lib/stores/filters.js b/packages/data-point/lib/stores/filters.js
deleted file mode 100644
index feeac12..0000000
--- a/packages/data-point/lib/stores/filters.js
+++ /dev/null
@@ -1,38 +0,0 @@
-'use strict'
-
-const ObjectStoreManager = require('./object-store-manager')
-
-/**
- * @param  {string} id
- * @return {Object} Error Object properties
- */
-function errorInfoCbGet (path) {
-  return {
-    message: `Filter function or namespace '${path}' is not defined`,
-    name: 'InvalidId'
-  }
-}
-
-/**
- * @param  {string} id
- * @return {Object} Error Object properties
- */
-function errorInfoCbAdd (id) {
-  return {
-    message: `Filter '${id}' already exists`,
-    name: 'InvalidId'
-  }
-}
-
-/**
- * create instance
- * @return {Object}
- */
-function create () {
-  return ObjectStoreManager.create({
-    errorInfoCbGet,
-    errorInfoCbAdd
-  })
-}
-
-module.exports.create = create
diff --git a/packages/data-point/lib/stores/object-store-manager.js b/packages/data-point/lib/stores/object-store-manager.js
index 4c1caae..552c125 100644
--- a/packages/data-point/lib/stores/object-store-manager.js
+++ b/packages/data-point/lib/stores/object-store-manager.js
@@ -3,7 +3,7 @@
 const _ = require('lodash')
 
 /**
- * get all added filters
+ * get the store
  * @return {Object}
  */
 function getStore (manager) {
@@ -13,7 +13,7 @@ function getStore (manager) {
 module.exports.getStore = getStore
 
 /**
- * clears all the filters
+ * clears the store
  * @return {Object}
  */
 function clear (manager) {


Test patch:
diff --git a/packages/data-point/lib/core/core.test.js b/packages/data-point/lib/core/core.test.js
index f3295e0..725f0e0 100644
--- a/packages/data-point/lib/core/core.test.js
+++ b/packages/data-point/lib/core/core.test.js
@@ -26,11 +26,9 @@ test('setup', () => {
   expect(instance.middleware.use).toBeTruthy()
   expect(_.isFunction(instance.use)).toBeTruthy()
   expect(instance.values.add).toBeTruthy()
-  expect(instance.filters.add).toBeTruthy()
   expect(instance.entities.add).toBeTruthy()
 
   expect(instance.values.store.v1).toEqual('v1')
-  expect(_.isFunction(instance.filters.store.test.passThrough)).toBeTruthy()
   expect(instance.entities.store.has('request:a0.1')).toBeTruthy()
   expect(instance.entities.store.has('entry:a0')).toBeTruthy()
 })
diff --git a/packages/data-point/lib/entity-types/entity-control/factory.test.js b/packages/data-point/lib/entity-types/entity-control/factory.test.js
index c6c23a4..dbc4165 100644
--- a/packages/data-point/lib/entity-types/entity-control/factory.test.js
+++ b/packages/data-point/lib/entity-types/entity-control/factory.test.js
@@ -6,9 +6,9 @@ const Factory = require('./factory')
 test('Factory#create', () => {
   const control = Factory.create({
     select: [
-      { case: 'a()', do: 'b()' },
-      { case: 'c()', do: 'd()' },
-      { default: 'e()' }
+      { case: '$a', do: '$b' },
+      { case: '$c', do: '$d' },
+      { default: '$e' }
     ]
   })
 
diff --git a/packages/data-point/lib/entity-types/entity-entry/factory.test.js b/packages/data-point/lib/entity-types/entity-entry/factory.test.js
index da5c786..45efe67 100644
--- a/packages/data-point/lib/entity-types/entity-entry/factory.test.js
+++ b/packages/data-point/lib/entity-types/entity-entry/factory.test.js
@@ -5,7 +5,7 @@ const Factory = require('./factory')
 
 test('Factory#create', () => {
   const obj = Factory.create({
-    value: ['a() | b()', (acc, done) => {}]
+    value: ['$foo', (acc, done) => {}]
   })
 
   expect(obj).toHaveProperty('before')
diff --git a/packages/data-point/lib/parameter/parameter-expression.test.js b/packages/data-point/lib/parameter/parameter-expression.test.js
deleted file mode 100644
index be24fba..0000000
--- a/packages/data-point/lib/parameter/parameter-expression.test.js
+++ /dev/null
@@ -1,66 +0,0 @@
-/* eslint-env jest */
-'use strict'
-
-const expression = require('./parameter-expression')
-
-test('parameter#create', () => {
-  const result = expression.create('foo', 'bar')
-  expect(result.type).toBe('foo')
-  expect(result.value).toBe('bar')
-})
-
-test('parameter#parseParameter undefined', () => {
-  const result = expression.parse('undefined')
-  expect(result.value).toBeUndefined()
-  expect(result.type).toBe('undefined')
-})
-
-test('parameter#parseParameter null', () => {
-  const result = expression.parse('null')
-  expect(result.value).toBe(null)
-  expect(result.type).toBe('null')
-})
-
-describe('parameter#parseParameter boolean', () => {
-  test('parse string as true', () => {
-    const resultTrue = expression.parse('true')
-    expect(resultTrue.value).toBe(true)
-    expect(resultTrue.type).toBe('boolean')
-  })
-
-  test('parse string as false', () => {
-    const resultFalse = expression.parse('false')
-    expect(resultFalse.value).toBe(false)
-    expect(resultFalse.type).toBe('boolean')
-  })
-})
-
-test('parameter#parseParameter number', () => {
-  const result = expression.parse('-12.02')
-  expect(result.value).toBe(-12.02)
-  expect(result.type).toBe('number')
-  expect(expression.parse('12.02').value).toBe(12.02)
-  expect(expression.parse('12').value).toBe(12)
-  expect(expression.parse('0').value).toBe(0)
-})
-
-test('parameter#parseParameter string', () => {
-  const result = expression.parse('"str"ing"')
-  expect(result.value).toBe('str"ing')
-  expect(result.type).toBe('string')
-})
-
-test('parameter#parseParameter reducer', () => {
-  const result = expression.parse('some.foo')
-  expect(result.value).toBe('some.foo')
-  expect(result.type).toBe('reducer')
-  expect(expression.parse('_.some.foo').type).toBe('reducer')
-})
-
-test('parameter#parseParameter error', () => {
-  const result = expression.parse("'some.foo")
-  expect(result.value).toBeInstanceOf(Error)
-  expect(result.type).toBe('error')
-  expect(expression.parse('.some.foo').type).toBe('error')
-  expect(expression.parse("some.foo'").type).toBe('error')
-})
diff --git a/packages/data-point/lib/reducer-function/__snapshots__/factory.test.js.snap b/packages/data-point/lib/reducer-function/__snapshots__/factory.test.js.snap
new file mode 100644
index 0000000..dfe472f
--- /dev/null
+++ b/packages/data-point/lib/reducer-function/__snapshots__/factory.test.js.snap
@@ -0,0 +1,3 @@
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[` 1`] = `"Reducer functions must have an arity of 2 at most"`;
diff --git a/packages/data-point/lib/reducer-function/factory.test.js b/packages/data-point/lib/reducer-function/factory.test.js
index 296d5d9..959bc5e 100644
--- a/packages/data-point/lib/reducer-function/factory.test.js
+++ b/packages/data-point/lib/reducer-function/factory.test.js
@@ -4,57 +4,24 @@
 const rf = require('./factory')
 
 test('reducer/reducer-function#isFunction', () => {
-  expect(rf.isFunction('a[]')).toBe(false)
-  expect(rf.isFunction('a.b.c')).toBe(false)
-  expect(rf.isFunction('a.b.c(')).toBe(false)
-  expect(rf.isFunction('a.b.c()')).toBe(true)
+  expect(rf.isFunction('$foo')).toBe(false)
+  expect(rf.isFunction('foo()')).toBe(false)
   expect(rf.isFunction(() => true)).toBe(true)
 })
 
-test('reducer/reducer-function#getFunctionName', () => {
-  expect(rf.getFunctionName('abc()')).toBe('abc')
-  expect(rf.getFunctionName('abc(a)')).toBe('abc')
-  expect(rf.getFunctionName('a.b.c(a)')).toBe('a.b.c')
-})
-
-test('reducer/reducer-function#getParameters', () => {
-  expect(rf.getParameters('a()')).toBe('')
-  expect(rf.getParameters('a(a)')).toBe('a')
-  expect(rf.getParameters('a(a,b,"b")')).toBe('a,b,"b"')
-})
-
-test('reducer/reducer-function#splitParameters', () => {
-  expect(rf.splitParameters('a')).toEqual(['a'])
-  expect(rf.splitParameters('a,b,"b"')).toEqual(['a', 'b', '"b"'])
-})
-
-test('reducer/reducer-function#parseParameters', () => {
-  expect(rf.parseParameters('a()')).toHaveLength(0)
-  expect(rf.parseParameters('a(,,,)')).toHaveLength(0)
-  expect(rf.parseParameters('a(1)')).toHaveLength(1)
-  expect(rf.parseParameters('a(1,,,)')).toHaveLength(1)
-  expect(rf.parseParameters('a(1,2)')).toHaveLength(2)
+describe('reducer/reducer-function#validateFunction', () => {
+  expect(rf.validateFunction(() => true)).toBe(true)
+  expect(rf.validateFunction(a => true)).toBe(true)
+  expect(rf.validateFunction((a, b) => true)).toBe(true)
+  expect(() =>
+    rf.validateFunction((a, b, c) => true)
+  ).toThrowErrorMatchingSnapshot()
 })
 
 describe('reducer/reducer-function#create', () => {
-  test('basic function call', () => {
-    const reducer = rf.create('a()')
-    expect(reducer.type).toBe('ReducerFunction')
-    expect(reducer.parameters).toHaveLength(0)
-  })
-
-  test('function call with arguments', () => {
-    const reducer = rf.create('a(true,1, "s", some.foo)')
-    expect(reducer.parameters).toHaveLength(4)
-    expect(reducer.parameters[0].type).toBe('boolean')
-    expect(reducer.parameters[0].value).toBe(true)
-  })
-
   test('function body', () => {
     const reducerFunction = () => (acc, done) => done(null, acc.value * 2)
     const reducer = rf.create(reducerFunction)
-    expect(reducer.parameters).toHaveLength(0)
-    expect(reducer.isFunction).toBe(true)
     expect(reducer.body).toEqual(reducerFunction)
   })
 })
diff --git a/packages/data-point/lib/reducer/factory.test.js b/packages/data-point/lib/reducer/factory.test.js
index 9dcf890..2f2a8a7 100644
--- a/packages/data-point/lib/reducer/factory.test.js
+++ b/packages/data-point/lib/reducer/factory.test.js
@@ -15,10 +15,9 @@ describe('reducer#create', () => {
   })
 
   test('create function', () => {
-    const reducer = Factory.create('foo.bar(1,true)')
+    const reducer = Factory.create(() => true)
     expect(reducer.type).toBe(ReducerFunction.type)
-    expect(reducer.name).toBe('foo.bar')
-    expect(reducer.parameters).toHaveLength(2)
+    expect(reducer.body.length).toBe(0)
   })
 
   test('create entity', () => {
diff --git a/packages/data-point/lib/resolve/reducer-function.test.js b/packages/data-point/lib/resolve/reducer-function.test.js
index d0b27a7..e294eb8 100644
--- a/packages/data-point/lib/resolve/reducer-function.test.js
+++ b/packages/data-point/lib/resolve/reducer-function.test.js
@@ -5,65 +5,7 @@ const AccumulatorFactory = require('../accumulator/factory')
 const reducerFactory = require('../reducer/factory')
 const resolveFunction = require('./reducer-function')
 
-const fixtureStore = require('../../test/utils/fixture-store')
-
-const testData = require('../../test/data.json')
-
-let store
-
-beforeAll(() => {
-  store = fixtureStore.create()
-})
-
 describe('resolve#filter.resolve', () => {
-  test('error if reducer does not return a function', () => {
-    const accumulator = AccumulatorFactory.create({
-      value: testData.a.b.c
-    })
-
-    const reducer = reducerFactory.create('test.invalidReducer()')
-
-    return resolveFunction
-      .resolve(store.filters, accumulator, reducer)
-      .catch(reson => {
-        expect(reson).toBeInstanceOf(Error)
-        expect(reson.name).toBe('InvalidType')
-        expect(reson.message.includes('function')).toBe(true)
-      })
-  })
-
-  test('error if reducer has wrong arity', () => {
-    const accumulator = AccumulatorFactory.create({
-      value: testData.a.b.c
-    })
-
-    const reducer = reducerFactory.create((a, b, c) => {
-      return false
-    })
-
-    return resolveFunction
-      .resolve(store.filters, accumulator, reducer)
-      .catch(reson => {
-        expect(reson).toBeInstanceOf(Error)
-        expect(reson.name).toBe('InvalidArity')
-        expect(reson.message.includes('arity')).toBe(true)
-      })
-  })
-
-  test('resolves a registered function', () => {
-    const accumulator = AccumulatorFactory.create({
-      value: testData.a.b.c
-    })
-
-    const reducer = reducerFactory.create('test.addCollectionValues()')
-
-    return resolveFunction
-      .resolve(store.filters, accumulator, reducer)
-      .then(result => {
-        expect(result.value).toBe(6)
-      })
-  })
-
   test('resolves node style callback', () => {
     const accumulator = AccumulatorFactory.create({
       value: 'test'
@@ -73,28 +15,24 @@ describe('resolve#filter.resolve', () => {
       done(null, `${acc.value}node`)
     )
 
-    return resolveFunction
-      .resolve(store.filters, accumulator, reducer)
-      .then(result => {
-        expect(result.value).toBe('testnode')
-      })
+    return resolveFunction.resolve(accumulator, reducer).then(result => {
+      expect(result.value).toBe('testnode')
+    })
   })
 
-  test('resolves an sync function', () => {
+  test('resolves a sync function', () => {
     const accumulator = AccumulatorFactory.create({
       value: 'test'
     })
 
     const reducer = reducerFactory.create(acc => `${acc.value}sync`)
 
-    return resolveFunction
-      .resolve(store.filters, accumulator, reducer)
-      .then(result => {
-        expect(result.value).toBe('testsync')
-      })
+    return resolveFunction.resolve(accumulator, reducer).then(result => {
+      expect(result.value).toBe('testsync')
+    })
   })
 
-  test('resolves an promise function', () => {
+  test('resolves a promise function', () => {
     const accumulator = AccumulatorFactory.create({
       value: 'test'
     })
@@ -103,11 +41,9 @@ describe('resolve#filter.resolve', () => {
       Promise.resolve(`${acc.value}promise`)
     )
 
-    return resolveFunction
-      .resolve(store.filters, accumulator, reducer)
-      .then(result => {
-        expect(result.value).toBe('testpromise')
-      })
+    return resolveFunction.resolve(accumulator, reducer).then(result => {
+      expect(result.value).toBe('testpromise')
+    })
   })
 
   test('rejects if callback passes error as first param', () => {
@@ -120,7 +56,7 @@ describe('resolve#filter.resolve', () => {
     })
 
     return resolveFunction
-      .resolve(store.filters, accumulator, reducer)
+      .resolve(accumulator, reducer)
       .catch(err => err)
       .then(err => {
         expect(err).toHaveProperty('message', 'Test')
diff --git a/packages/data-point/lib/resolve/reducer.test.js b/packages/data-point/lib/resolve/reducer.test.js
index 3fd411d..ac91d97 100644
--- a/packages/data-point/lib/resolve/reducer.test.js
+++ b/packages/data-point/lib/resolve/reducer.test.js
@@ -4,6 +4,7 @@
 const nock = require('nock')
 
 const fixtureStore = require('../../test/utils/fixture-store')
+const reducers = require('../../test/utils/reducers')
 const testData = require('../../test/data.json')
 
 const AccumulatorFactory = require('../accumulator/factory')
@@ -43,7 +44,7 @@ test('resolve#reducer.resolveReducer', () => {
     value: testData.a.b.c
   })
 
-  const reducer = reducerFactory.create('test.addCollectionValues()')
+  const reducer = reducerFactory.create(reducers.addCollectionValues())
   return resolveReducer
     .resolveReducer(store, accumulator, reducer)
     .then(result => {
@@ -88,38 +89,6 @@ describe('resolve#reducer.resolve - reducer transform', () => {
   })
 })
 
-describe('resolve#reducer.resolve - reducer filter', () => {
-  test('only transform', () => {
-    const accumulator = AccumulatorFactory.create({
-      value: 'hello '
-    })
-
-    const transform = TransformExpression.create('test.addString(world)')
-    return resolveReducer
-      .resolve(store, accumulator, transform)
-      .then(result => expect(result.value).toBe('hello world'))
-  })
-
-  test('multiple filters', () => {
-    const expectedResult = {
-      g1: 1,
-      g2: 2
-    }
-
-    const accumulator = AccumulatorFactory.create({
-      value: testData.a.g
-    })
-
-    const transform = TransformExpression.create(
-      'test.passThrough() | test.addKeyValue(g2,2)'
-    )
-
-    return resolveReducer
-      .resolve(store, accumulator, transform)
-      .then(result => expect(result.value).toEqual(expectedResult))
-  })
-})
-
 describe('resolve#reducer.resolve - reducer model', () => {
   test('simplest model', () => {
     const accumulator = AccumulatorFactory.create({
diff --git a/packages/data-point/lib/stores/filters.test.js b/packages/data-point/lib/stores/filters.test.js
deleted file mode 100644
index cc6f819..0000000
--- a/packages/data-point/lib/stores/filters.test.js
+++ /dev/null
@@ -1,49 +0,0 @@
-/* eslint-env jest */
-'use strict'
-
-const _ = require('lodash')
-
-const Filters = require('./filters')
-
-let filters
-
-it('setup', () => {
-  filters = Filters.create()
-})
-
-it('filters#getStore', () => {
-  const result = filters.getStore()
-  expect.assertions(1)
-  expect(_.isObject(result)).toBeTruthy()
-})
-
-it('filters#add', () => {
-  const result = filters.add('foo', () => 'foo')
-  expect.assertions(3)
-  expect(_.isFunction(result.foo)).toBeTruthy()
-
-  const doNotAllowOverride = _.attempt(filters.add, 'foo', () => 'foo')
-  expect(_.isError(doNotAllowOverride)).toBeTruthy()
-
-  const allowOverrideWithFlag = _.attempt(filters.add, 'foo', () => 'foo', true)
-  expect(!_.isError(allowOverrideWithFlag)).toBeTruthy()
-})
-
-it('filters#get', () => {
-  filters.add('_', _)
-  const result = filters.get('_.isArray')
-  expect.assertions(1)
-  expect(_.isFunction(result)).toBeTruthy()
-})
-
-it('filters#get invalid filter', () => {
-  const result = _.attempt(filters.get, 'DOES_NOT_EXISTS')
-  expect.assertions(1)
-  expect(result instanceof Error).toBeTruthy()
-})
-
-it('filters#clear', () => {
-  filters.clear()
-  expect.assertions(1)
-  expect(Object.keys(filters.getStore()).length).toBe(0)
-})
diff --git a/packages/data-point/lib/transform-expression/factory.test.js b/packages/data-point/lib/transform-expression/factory.test.js
index 7d7ff2c..a0ecb2d 100644
--- a/packages/data-point/lib/transform-expression/factory.test.js
+++ b/packages/data-point/lib/transform-expression/factory.test.js
@@ -60,16 +60,28 @@ describe('TransformFactory#create', () => {
   })
 
   test('TransformFactory#create context with reducers', () => {
-    const result = TransformFactory.create(
-      '$foo.bar | reducer:add | reducer.add(true,foo.bar)'
-    )
+    const result = TransformFactory.create([
+      '$foo.bar | reducer:add',
+      () => true
+    ])
+
+    expect(result.reducers).toHaveLength(3)
+    expect(result.reducers[0].type).toBe('ReducerPath')
+    expect(result.reducers[1].type).toBe('ReducerEntity')
+    expect(result.reducers[2].type).toBe('ReducerFunction')
+  })
+
+  test('TransformFactory#create context with reducers', () => {
+    const result = TransformFactory.create([
+      '$foo.bar',
+      'reducer:add',
+      () => true
+    ])
 
     expect(result.reducers).toHaveLength(3)
     expect(result.reducers[0].type).toBe('ReducerPath')
     expect(result.reducers[1].type).toBe('ReducerEntity')
     expect(result.reducers[2].type).toBe('ReducerFunction')
-    expect(result.reducers[2].parameters[0].type).toBe('boolean')
-    expect(result.reducers[2].parameters[1].type).toBe('reducer')
   })
 })
 
@@ -109,15 +121,14 @@ describe('TransformFactory#create', () => {
   test('TransformFactory#create transfrom from array', () => {
     const result = TransformFactory.create([
       '$foo.bar',
-      'reducer:add | reducer.add(true,foo.bar)',
+      'reducer:add | $foo.bar.zeta',
       (acc, done) => done(null, acc.value)
     ])
 
     expect(result.reducers).toHaveLength(4)
     expect(result.reducers[0].type).toBe('ReducerPath')
     expect(result.reducers[1].type).toBe('ReducerEntity')
-    expect(result.reducers[2].type).toBe('ReducerFunction')
-    expect(result.reducers[2].parameters[0].type).toBe('boolean')
-    expect(result.reducers[2].parameters[1].type).toBe('reducer')
+    expect(result.reducers[2].type).toBe('ReducerPath')
+    expect(result.reducers[3].type).toBe('ReducerFunction')
   })
 })
diff --git a/packages/data-point/test/utils/fixture-store.js b/packages/data-point/test/utils/fixture-store.js
index 5f965e5..6e0c247 100644
--- a/packages/data-point/test/utils/fixture-store.js
+++ b/packages/data-point/test/utils/fixture-store.js
@@ -2,7 +2,6 @@
 
 const coreFactory = require('../../lib/core')
 
-const reducers = require('./reducers')
 const entitiesDefinitions = require('../definitions/entities')
 
 /**
@@ -13,7 +12,6 @@ function create (options) {
   const instance = coreFactory.create(options)
   instance.addValue('server', 'http://remote.test')
   instance.addValue('val2', 2)
-  instance.addReducer('test', reducers)
   instance.addEntities(entitiesDefinitions)
   return instance
 }