Comcast / Comcast/rulio

Want a Rule API action interpreter

Open
#17 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
337
Forks
58
PR merge metrics
No merged PRs in 30d

Description

Say an action mostly just wants to call a Rules API (like `Env.AddRule`). Writing a bunch of Javascript that mostly just offers an ugly, embedded JSON object and associated API call is distasteful. Instead, provide an action interpreter that can call the core APIs with an explicit JSON object representation that uses the (silly) notation `"??..."` to request a logic variable interpolation for bindings given to the action. Also support an optional `code` property with a Javascript value that can expand the action's bindings.

For example

``` Javascript
{
"when": {"at":"?there"},
"action": {
"language":"rulesapi",
"code": {
"code": "{'?id':'bart' + '_' + 'simpson'}",
"addRule": {
"pattern": {"wants":"?wanted","at":"??there"},
"condition": {"has":"?wanted"},
"action": "Env.http('GET', 'https://localhost:1234/' id + '/' + wanted)"
}
}
}
}

```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.