@ebay/oja-tools
v2.0.2
Published
Instrumentation of actions via hooks
Downloads
11
Readme
oja-tools
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');