0.9.2 • Published 8 years ago

cher-source-interface v0.9.2

Weekly downloads
3
License
MIT
Repository
github
Last release
8 years ago

Cher Source Stream Interface

This is an adapter for any source of data to be interoperable with the cher stream manager. A cher source stream must utilize this adapter as well as implement a set of functions which will allow it to emit data properly.

module.exports = (deps) => {
  // deps is any set of dependencies you need to pass off to the implementation
  deps = deps || {};
  // dataSchema is a joi object which defines how the data should look when
  // it arrives from the source. Read more about joi at the link below
  // https://github.com/hapijs/joi
  const dataSchema  = require('./schema')();
  const implementation = require('./implementation');
  const adapter = require('cher-source-interface').adapter;

  const options = {
    schema: dataSchema,
    // deprecated in favor of name`
    type: 'myDataSource',
    name: 'myDataSource',
    impl: implementation
  };
  return adapter(deps, options);
};