typescript-pipeline
TypeScript icon, indicating that this package has built-in type declarations

1.0.4 • Public • Published

README

What is this package for?

Quick summary

This is a data pipeline framework that runs in NodeJS. The pipeline is composed of processing blocks which have a deifined input contract and a defined output contract. All the block needs to do is handle when an input contract is passed in, and needs to emit the output contract. The routing, queuing, error capture, and pushing to the next processing block are handled for you.

How do I get set up?

  • Installation
    npm install --save typescript-pipeline
  • Configuration
    1. Create the contracts. Each contract should extend "Contract".
      • A contract is just a series of properties.
      • There is a validateStructure() method which needs to be implemented. It should return true or false. This should only check the structure and not be used to validate the values.
    2. Create the processing blocks. Each block needs to extend 'Block'.
      • In the constructor, you should call setInputContract(Class) and setOutputContract(Class) which will tell the pipeline what input and output to expect.
      • Implement the "handle" method which will get a single instance of the defined contract passed in. Outputs are sent by calling this.emit('data',outputContract). This is where the logic for the block resides.
    3. Create a new Pipeline. let pipeline = new Pipeline();
    4. Register the blocks. pipeline.registerBlock(block1);
      • You can only register a block one time. You can have multiple blocks of the same type, but each block can only be assigned once.
    5. Bind the blocks. pipeline.bindBlocks(block1, block2, options, plugin)
      • Binding two blocks creates "mortar" to bind the blocks.
      • The options argument is optional.
        • logContractsToConsole is a boolean and will cause the mortar to dump out all contracts to the console when they first enter the mortar.
      • Specifying a plugin is optional See the plugins section below. If a plugin is not specified, then the mortar acts as a pass-thru the enforces contract types only.

Logic Flow

TBD

Plugins

TBD

Contribution guidelines

  • Writing tests
  • Code review
  • Other guidelines

Who do I talk to?

Please post any bugs or issues to the issues site at [https://bitbucket.org/pythagorasio/typescript-pipeline/issues]

Readme

Keywords

Package Sidebar

Install

npm i typescript-pipeline

Weekly Downloads

0

Version

1.0.4

License

ISC

Last publish

Collaborators

  • westinpigott