Neuron Powered Motorization
Learn about our RFC process, Open RFC meetings & more.Join in the discussion! »

@ebay/oja-tools

2.0.2 • Public • Published

oja-tools

Downloads

This module is a subset of eBay Oja framework.

The module defines generic actions that can be used to organize actions into more complex strictures.

Installation

$ npm install @ebay/oja-tools --save

Usage

Pipe action

THe pipe action allows to assemble other actions into a pipelines.

  • actions.json
{
    "PIPE-EXAMPLE/route": {
        "function": "@ebay/oja-tools/create-and-call",
        "action": "oja/pipe",
        "arguments": {
            "pipe": [
                "FOONS/foo",
                "BARNS/bar",
                "QAZNS/qaz"
            ]
        }
    }
}
  • other actions action.json:
{
    "FOONS/foo": "foo",
    "BARNS/bar": "bar",
    "QAZNS/qaz": "qaz"
}
  • bar/qaz/foo.js:
module.exports = context => async next => {
    const result = await next();
    return [...result, 'foov'];
}
  • calling action:
const { createContext } = require('@ebay/oja-action');
const context = await createContext();
const result = await context.action('PIPE-EXAMPLE/route');

Install

npm i @ebay/oja-tools

DownloadsWeekly Downloads

7

Version

2.0.2

License

MIT

Unpacked Size

5.1 kB

Total Files

8

Last publish

Collaborators

  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar