rules-machine
rules-machine copied to clipboard
Design async data injection mechanism
Sometimes business rules need access to external data (from a Database, HTTP API, AI/ML Service, etc.)
Goals
- [ ] Support JSON config-style declaration.
- [ ] Securely reference API keys.
- [ ] Pluggable / layered design. (Similar to
inputMap
&outputMap
designs.) - [ ] Rely on existing 'client' APIs. (fetch, pg, etc)
Are you thinking something like this?
{
map: '$IO::fetchItems()',
run: { return: '$item.id' },
}
// fetchItems.config.json
{
"url": "items.com/api?key=$ApiKey",
"ApiKey": "SECURE_ENV_VAR",
"method": "GET",
"headers": [...],
"dataPath": "body.data.items",
"validator": "./validator.js"
}