1.0.6 • Published 2 years ago

@ruleenginejs/runtime v1.0.6

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

@ruleenginejs/runtime

Installation

npm install @ruleenginejs/runtime

Usage

const {
  Pipeline,
  StartStep,
  EndStep,
  SingleStep,
  CompositeStep
} = require("@ruleenginejs/runtime");

const pipeline = new Pipeline();
const start = new StartStep();
const end = new EndStep();
const step = new SingleStep({
  handler: (context, next) => {
    next();
  }
});

start.connectTo(step);
step.connectTo(end);

pipeline.add(start, end, step);

const context = {};
pipeline.execute(context).catch(e => console.error(e));

Documentation

Step handlers

handler: (context, next) => {
  next();
}
handler: (context, port, next) => {
  next();
}
handler: (context, port, props, next) => {
  next();
}
handler: (err, context, port, props, next) => {
  next();
}

Pipeline events

  • execute_start
  • execute_error
  • execute_end
  • step_begin
  • step_end
  • step_error

License

Licensed under the MIT License.

1.0.6

2 years ago

1.0.5

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago