@unstable-dev/unmeshed-mcp 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +64 -0
- package/dist/auth.d.ts +6 -0
- package/dist/auth.js +11 -0
- package/dist/client.d.ts +46 -0
- package/dist/client.js +97 -0
- package/dist/config.d.ts +10 -0
- package/dist/config.js +31 -0
- package/dist/get-docs.d.ts +8 -0
- package/dist/get-docs.js +64 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +35 -0
- package/dist/server.d.ts +4 -0
- package/dist/server.js +203 -0
- package/knowledge/README.md +16 -0
- package/knowledge/SKILL.md +359 -0
- package/knowledge/assets/patterns.md +637 -0
- package/knowledge/execution/debugging-guide.md +18 -0
- package/knowledge/execution/process-run.schema.md +24 -0
- package/knowledge/execution/step-run.schema.md +21 -0
- package/knowledge/process-definition.schema.md +36 -0
- package/knowledge/references/integrations.md +914 -0
- package/knowledge/references/steps-knowledge.md +834 -0
- package/knowledge/step-definition.schema.md +140 -0
- package/knowledge/step-output-paths.md +45 -0
- package/knowledge/steps/DECISION_ENGINE.md +248 -0
- package/knowledge/steps/DEPENDSON.md +296 -0
- package/knowledge/steps/EXIT.md +220 -0
- package/knowledge/steps/FAIL.md +198 -0
- package/knowledge/steps/FLOW_GATEWAY.md +405 -0
- package/knowledge/steps/FOREACH.md +250 -0
- package/knowledge/steps/HTTP.md +183 -0
- package/knowledge/steps/JAVASCRIPT.md +192 -0
- package/knowledge/steps/JQ.md +189 -0
- package/knowledge/steps/LIST.md +279 -0
- package/knowledge/steps/NOOP.md +165 -0
- package/knowledge/steps/PARALLEL.md +366 -0
- package/knowledge/steps/PYTHON.md +206 -0
- package/knowledge/steps/SEND_RESPONSE.md +301 -0
- package/knowledge/steps/SQLITE.md +301 -0
- package/knowledge/steps/SUB_PROCESS.md +296 -0
- package/knowledge/steps/SWITCH.md +369 -0
- package/knowledge/steps/UPDATE_STEP.md +257 -0
- package/knowledge/steps/WAIT.md +218 -0
- package/knowledge/steps/WHILE.md +328 -0
- package/knowledge/steps/WORKER.md +233 -0
- package/knowledge/system-prompt.md +274 -0
- package/package.json +39 -0
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
# Step Definition Schema
|
|
2
|
+
|
|
3
|
+
Every Unmeshed step must follow this shared structure.
|
|
4
|
+
|
|
5
|
+
```json
|
|
6
|
+
{
|
|
7
|
+
"orgId": 1,
|
|
8
|
+
"namespace": "default",
|
|
9
|
+
"name": "step_name",
|
|
10
|
+
"type": "HTTP",
|
|
11
|
+
"ref": "unique_step_ref",
|
|
12
|
+
"optional": false,
|
|
13
|
+
"createdBy": "system",
|
|
14
|
+
"updatedBy": "system",
|
|
15
|
+
"description": null,
|
|
16
|
+
"label": null,
|
|
17
|
+
"created": 1700000000000,
|
|
18
|
+
"updated": 1700000000000,
|
|
19
|
+
"configuration": {
|
|
20
|
+
"errorPolicyName": null,
|
|
21
|
+
"useCache": false,
|
|
22
|
+
"cacheKey": null,
|
|
23
|
+
"cacheTimeoutSeconds": 0,
|
|
24
|
+
"stream": false,
|
|
25
|
+
"streamAllStatuses": false,
|
|
26
|
+
"preExecutionScript": null,
|
|
27
|
+
"constructInputFromScript": false,
|
|
28
|
+
"scriptLanguage": null,
|
|
29
|
+
"jqTransformer": null,
|
|
30
|
+
"rateLimitMaxRequests": 0,
|
|
31
|
+
"rateLimitWindowSeconds": 0
|
|
32
|
+
},
|
|
33
|
+
"children": [],
|
|
34
|
+
"input": {},
|
|
35
|
+
"output": null
|
|
36
|
+
}
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
Rules:
|
|
40
|
+
- `type` must be a valid Unmeshed step type.
|
|
41
|
+
- `ref` must be unique and should be stable because later steps reference it.
|
|
42
|
+
- `children` is `[]` for non-container steps.
|
|
43
|
+
- Container steps such as `LIST`, `PARALLEL`, `FOREACH`, `WHILE`, and `SWITCH` may contain child steps.
|
|
44
|
+
- `input` must match the selected step type's schema.
|
|
45
|
+
- `configuration` must include the full standard block unless a backend-specific exception is documented.
|
|
46
|
+
- Do not put runtime outputs in the definition-time `output` field; keep it `null`.
|
|
47
|
+
- `preExecutionScript` - use this for run a Script before actual task executes ,The output of the script would be overridden as steps input keys during runtime. We call this as Scripted input too
|
|
48
|
+
- `scriptLanguage` - Available script languages are JAVASCRIPT/PYTHON. By default it is Javascript
|
|
49
|
+
- `constructInputFromScript` - always enable this Flag while running preExecutionScript, otherwise it won't work.
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
## Pre-Execution Script
|
|
53
|
+
|
|
54
|
+
A **preExecutionScript** lets you run custom logic *before* a step's main task executes.
|
|
55
|
+
The script's return value is merged into the step's `input`, so downstream logic (and the step itself) sees those keys as if they were part of the original input. We also call this **Scripted Input**.
|
|
56
|
+
|
|
57
|
+
### How to enable
|
|
58
|
+
|
|
59
|
+
| Field | Required value | Purpose |
|
|
60
|
+
|---|---|---|
|
|
61
|
+
| `preExecutionScript` | The script source code (string) | The code to run |
|
|
62
|
+
| `constructInputFromScript` | `true` | **Must** be `true`, otherwise the script is ignored |
|
|
63
|
+
| `scriptLanguage` | `"JAVASCRIPT"` or `"PYTHON"` | Defaults to `JAVASCRIPT` if omitted |
|
|
64
|
+
|
|
65
|
+
### Implicit parameters
|
|
66
|
+
|
|
67
|
+
Every pre-execution script receives two implicit arguments:
|
|
68
|
+
|
|
69
|
+
| Parameter | Type | Description |
|
|
70
|
+
|---|---|---|
|
|
71
|
+
| `steps` | object / dict | A map keyed by step `ref`. `steps.__self` (JS) or `steps["__self"]` (Python) is the current step's metadata, including its `id`, `processId`, and `ref`. Other completed steps are accessible by their ref. |
|
|
72
|
+
| `context` | object / dict | The current process execution context. `context.id` (JS) / `context.get("id")` (Python) gives the `processId`. Also contains `input`, `state`, etc. |
|
|
73
|
+
|
|
74
|
+
### Return value
|
|
75
|
+
|
|
76
|
+
The script **must return a JSON-serialisable object (dict/map)**.
|
|
77
|
+
Each key in the returned object is merged into the step's `input` before the step runs.
|
|
78
|
+
Any `console.log` (JS) or `print` (Python) calls are captured in the `preExecutionScriptLogs` array that is also added to the step input/output automatically.
|
|
79
|
+
|
|
80
|
+
### JavaScript example
|
|
81
|
+
|
|
82
|
+
```javascript
|
|
83
|
+
// (steps, context) will be provided as default inputs
|
|
84
|
+
(steps, context) => {
|
|
85
|
+
console.log("Hello World !!")
|
|
86
|
+
console.log("Hello World 2 !!")
|
|
87
|
+
return {
|
|
88
|
+
"processId" : context.id,
|
|
89
|
+
"currentStepId" : steps.__self.id,
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
### Python example
|
|
95
|
+
|
|
96
|
+
```python
|
|
97
|
+
# Do not change the parameters count, order, or types.
|
|
98
|
+
# `steps` and `context` are Python dictionaries provided by default.
|
|
99
|
+
def main(steps, context):
|
|
100
|
+
print("Hello World !!")
|
|
101
|
+
print("Hello World 2 !!")
|
|
102
|
+
return {
|
|
103
|
+
"processId": context.get("id"),
|
|
104
|
+
"currentStepId": steps["__self"]["id"],
|
|
105
|
+
"statusMessage": "Process completed",
|
|
106
|
+
"isSuccessful": True
|
|
107
|
+
}
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
### What the step input looks like at runtime
|
|
111
|
+
|
|
112
|
+
After the script runs, the step's `input` will contain:
|
|
113
|
+
|
|
114
|
+
1. All keys returned by the script (e.g. `processId`, `currentStepId`, `statusMessage`, `isSuccessful`).
|
|
115
|
+
2. `preExecutionScriptLogs` — an array of `{ "log": "...", "time": 0 }` objects capturing every `console.log` / `print` call.
|
|
116
|
+
3. `__currentExecutionStartTime` — epoch-millis timestamp injected automatically by the engine.
|
|
117
|
+
|
|
118
|
+
Example runtime step input (Python step):
|
|
119
|
+
|
|
120
|
+
```json
|
|
121
|
+
{
|
|
122
|
+
"processId": 593065015,
|
|
123
|
+
"currentStepId": { "ref": "noop_1_copy", "processId": 593065015, "id": 593065018 },
|
|
124
|
+
"statusMessage": "Process completed",
|
|
125
|
+
"isSuccessful": true,
|
|
126
|
+
"preExecutionScriptLogs": [
|
|
127
|
+
{ "log": "Hello World !!", "time": 0 },
|
|
128
|
+
{ "log": "Hello World 2 !!", "time": 0 }
|
|
129
|
+
],
|
|
130
|
+
"__currentExecutionStartTime": 1778220339534
|
|
131
|
+
}
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
### Rules
|
|
135
|
+
|
|
136
|
+
- Always set `constructInputFromScript: true` when providing a `preExecutionScript`.
|
|
137
|
+
- The script must be self-contained — no external imports or network calls.
|
|
138
|
+
- Python scripts must define a `main(steps, context)` function; the engine calls `main`.
|
|
139
|
+
- JavaScript scripts must be an arrow/anonymous function that accepts `(steps, context)`.
|
|
140
|
+
- Return only JSON-serialisable types (strings, numbers, booleans, lists, maps). Do not return classes or functions.
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
# Step Output Path Contract
|
|
2
|
+
|
|
3
|
+
Always reference a previous step according to the producer step type.
|
|
4
|
+
|
|
5
|
+
| Producer step type | Runtime output path |
|
|
6
|
+
|--------------------|---------------------|
|
|
7
|
+
| `HTTP` | `steps.<ref>.output.response` for parsed response body; `steps.<ref>.output.statusCode` for HTTP status |
|
|
8
|
+
| `JQ` | `steps.<ref>.output.result` for the jq result |
|
|
9
|
+
| `JAVASCRIPT` | `steps.<ref>.output.result` for the returned value; `steps.<ref>.output.logs` for captured logs |
|
|
10
|
+
| `PYTHON` | `steps.<ref>.output.result` for the returned value; `steps.<ref>.output.logs` for captured logs |
|
|
11
|
+
| `FLOW_GATEWAY` | `steps.<ref>.output.result` for the selected control-flow case string; `steps.<ref>.output.logs` for script logs |
|
|
12
|
+
| `NOOP` | `steps.<ref>.output.<field>` |
|
|
13
|
+
| `SEND_RESPONSE` | Usually `steps.<ref>.output` is `{}` on success; inspect process-level output for the returned payload; inspect `steps.<ref>.output.error` only for step failure |
|
|
14
|
+
| `LIST` | Usually `steps.<ref>.output` is `{}`; reference child step outputs directly by child `ref` |
|
|
15
|
+
| `PARALLEL` | Usually `steps.<ref>.output` is `{}`; reference child step outputs directly by child `ref` |
|
|
16
|
+
| `FOREACH` | Usually `steps.<ref>.output` is `{}`; iteration child outputs use `steps["<child_ref>[<index>]"].output` |
|
|
17
|
+
| `WHILE` | `steps.<ref>.output.result` for final condition result; `steps.<ref>.output.iteration` for final iteration count |
|
|
18
|
+
| `WAIT` | `steps.<ref>.output.result.waitUntil` for the resume timestamp; `steps.<ref>.output.__waitStartedAt` for wait start |
|
|
19
|
+
| `SWITCH` | `steps.<ref>.output.result` for the selected case string; selected child output is under the child `ref` |
|
|
20
|
+
| `SUB_PROCESS` | `steps.<ref>.output.subProcessOutput` for child output; `steps.<ref>.output.subProcessId` for child process id |
|
|
21
|
+
| `EXIT` | `steps.<ref>.output.__exitStatus`, `steps.<ref>.output.__exitReason`, and `steps.<ref>.output.message` |
|
|
22
|
+
| `WORKER` | `steps.<ref>.output.<field>` directly from the external worker result |
|
|
23
|
+
| `PERSISTED_STATE` | `steps.<ref>.output.result` |
|
|
24
|
+
| `INTEGRATION` | Integration-specific; commonly `steps.<ref>.output.result` or `steps.<ref>.output.results` |
|
|
25
|
+
|
|
26
|
+
Validation rules:
|
|
27
|
+
- Never use `steps.<http_ref>.output.result` for a native `HTTP` step.
|
|
28
|
+
- Never use `steps.<http_ref>.output.results` for a native `HTTP` step.
|
|
29
|
+
- Never use `steps.<jq_ref>.output.response` for a `JQ` step.
|
|
30
|
+
- Never use `steps.<javascript_ref>.output.response` for a `JAVASCRIPT` step.
|
|
31
|
+
- Never use `steps.<python_ref>.output.response` for a `PYTHON` step.
|
|
32
|
+
- Never expect `FLOW_GATEWAY` output to contain the chosen branch payload; it only stores the selected case string and logs.
|
|
33
|
+
- Never expect `SEND_RESPONSE` to expose the successful response payload under `steps.<send_response_ref>.output.result`; it mutates process-level output instead.
|
|
34
|
+
- Never expect a `LIST` step to wrap child outputs under `steps.<list_ref>.output.result`.
|
|
35
|
+
- Never expect a `PARALLEL` step to wrap child outputs under `steps.<parallel_ref>.output.result`.
|
|
36
|
+
- Never create a `WAIT` script that omits `waitUntil`.
|
|
37
|
+
- Never expect a `SWITCH` step to return the selected child output; it returns the selected case string.
|
|
38
|
+
- Never use `steps.<sub_process_ref>.output.result` for subprocess output; use `subProcessOutput`.
|
|
39
|
+
- Never expect an `EXIT` step to continue later sibling steps after it exits the process.
|
|
40
|
+
- Never assume `WORKER` output is wrapped in `output.result`; worker result object fields are exposed directly.
|
|
41
|
+
- Never read FOREACH child output as plain `steps.<child_ref>.output` after the loop; use indexed refs like `steps["<child_ref>[0]"].output`.
|
|
42
|
+
- Never create a `WHILE` script without a clear false condition; avoid endless loops.
|
|
43
|
+
- Never wrap NOOP output in `output.result`; NOOP input fields are copied directly to output.
|
|
44
|
+
- When an `HTTP` response is an array, use `steps.<http_ref>.output.response.length`.
|
|
45
|
+
- Before saving a generated workflow, check every `steps.<ref>.output...` reference against the referenced step's type.
|
|
@@ -0,0 +1,248 @@
|
|
|
1
|
+
# DECISION_ENGINE Step Schema
|
|
2
|
+
|
|
3
|
+
`DECISION_ENGINE` evaluates a row of input values against a named decision table
|
|
4
|
+
(rule engine) and returns the matching output columns. Use it for rule-based
|
|
5
|
+
routing, classification, or lookup where the rules live in a managed table.
|
|
6
|
+
|
|
7
|
+
## Definition Input Schema
|
|
8
|
+
|
|
9
|
+
```json
|
|
10
|
+
{
|
|
11
|
+
"decisionRuleStrategy": "FIRST_MATCH",
|
|
12
|
+
"decisionTable": "clothes-decision-table",
|
|
13
|
+
"decisionContext": {
|
|
14
|
+
"clothes": "tshirt"
|
|
15
|
+
},
|
|
16
|
+
"decisionTableVersion": "",
|
|
17
|
+
"decisionOutputColumns": [
|
|
18
|
+
"fabric"
|
|
19
|
+
]
|
|
20
|
+
}
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
| Field | Type | Required | Description |
|
|
24
|
+
|---|---|---|---|
|
|
25
|
+
| `decisionRuleStrategy` | string | Yes | `"FIRST_MATCH"` — return the first matching rule. `"ALL_MATCH"` — return every matching rule. |
|
|
26
|
+
| `decisionTable` | string | Yes | Name of the decision table configured in Unmeshed. |
|
|
27
|
+
| `decisionContext` | object | Yes | Key-value pairs whose keys must match input column names in the decision table. Values can be literals or `{{...}}` template expressions. |
|
|
28
|
+
| `decisionTableVersion` | string | No | Specific version of the table. Leave as `""` to use the latest version. |
|
|
29
|
+
| `decisionOutputColumns` | string[] | Yes | List of output column names to return from the matched rule(s). |
|
|
30
|
+
|
|
31
|
+
## Runtime Output Schema
|
|
32
|
+
|
|
33
|
+
### FIRST_MATCH output
|
|
34
|
+
|
|
35
|
+
`result` is a **single object** containing the output columns from the first matched rule.
|
|
36
|
+
|
|
37
|
+
```json
|
|
38
|
+
{
|
|
39
|
+
"result": {
|
|
40
|
+
"fabric": "Cotton"
|
|
41
|
+
},
|
|
42
|
+
"__evaluatedConditions": [
|
|
43
|
+
{
|
|
44
|
+
"input": "clothes",
|
|
45
|
+
"value": "tshirt",
|
|
46
|
+
"conditionsMatched": ["tshirt"]
|
|
47
|
+
}
|
|
48
|
+
],
|
|
49
|
+
"decisionTableVersion": 1,
|
|
50
|
+
"decisionTable": "clothes-decision-table",
|
|
51
|
+
"decisionRuleStrategy": "FIRST_MATCH"
|
|
52
|
+
}
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
### ALL_MATCH output
|
|
56
|
+
|
|
57
|
+
`result` is an **array of objects** — one per matched rule.
|
|
58
|
+
|
|
59
|
+
```json
|
|
60
|
+
{
|
|
61
|
+
"result": [
|
|
62
|
+
{
|
|
63
|
+
"fabric": "Cotton"
|
|
64
|
+
}
|
|
65
|
+
],
|
|
66
|
+
"__evaluatedConditions": [
|
|
67
|
+
{
|
|
68
|
+
"input": "clothes",
|
|
69
|
+
"value": "tshirt",
|
|
70
|
+
"conditionsMatched": ["tshirt"]
|
|
71
|
+
}
|
|
72
|
+
],
|
|
73
|
+
"decisionTableVersion": 1,
|
|
74
|
+
"decisionTable": "clothes-decision-table",
|
|
75
|
+
"decisionRuleStrategy": "ALL_MATCH"
|
|
76
|
+
}
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
## Output Access Paths
|
|
80
|
+
|
|
81
|
+
Use:
|
|
82
|
+
- `steps.<ref>.output.result.<column>` — output column value (FIRST_MATCH).
|
|
83
|
+
- `steps.<ref>.output.result[0].<column>` — first matched row (ALL_MATCH).
|
|
84
|
+
- `steps.<ref>.output.result` — full result object/array.
|
|
85
|
+
- `steps.<ref>.output.__evaluatedConditions` — which conditions matched (debugging).
|
|
86
|
+
- `steps.<ref>.output.decisionTableVersion` — resolved version of the table that was evaluated.
|
|
87
|
+
- `steps.<ref>.output.decisionRuleStrategy` — the strategy that was used.
|
|
88
|
+
|
|
89
|
+
Do not use:
|
|
90
|
+
- `steps.<ref>.output.response` — DECISION_ENGINE does not wrap in `response`.
|
|
91
|
+
- `steps.<ref>.output.results` — the key is `result`, not `results`.
|
|
92
|
+
|
|
93
|
+
## Generation Rules
|
|
94
|
+
|
|
95
|
+
- Use uppercase step type: `"DECISION_ENGINE"`.
|
|
96
|
+
- Use `children: []`; DECISION_ENGINE is not a container.
|
|
97
|
+
- `decisionContext` keys **must match** input column names in the decision table exactly.
|
|
98
|
+
- Use `FIRST_MATCH` for single-result lookups and routing decisions.
|
|
99
|
+
- Use `ALL_MATCH` when multiple rules may apply and all results are needed.
|
|
100
|
+
- Always provide at least one entry in `decisionOutputColumns`.
|
|
101
|
+
- `decisionTableVersion` can be `""` (latest) or a specific version number as a string.
|
|
102
|
+
- Context values support `{{...}}` template expressions (e.g. `"{{ steps.classify.output.result.category }}"`).
|
|
103
|
+
- Do not invent `script`, `url`, or HTTP-style fields for DECISION_ENGINE.
|
|
104
|
+
- The decision table itself must already exist in Unmeshed; the assistant cannot create tables.
|
|
105
|
+
|
|
106
|
+
## Debugging Rules
|
|
107
|
+
|
|
108
|
+
When debugging a DECISION_ENGINE step:
|
|
109
|
+
- Check `__evaluatedConditions` to see which input columns matched and what they matched against.
|
|
110
|
+
- If `result` is `null` or empty, no rules matched — verify `decisionContext` values against the table rows.
|
|
111
|
+
- Confirm `decisionContext` keys match table column names exactly (case-sensitive).
|
|
112
|
+
- Confirm `decisionOutputColumns` lists valid output column names from the table.
|
|
113
|
+
- If the wrong rule matched, inspect `conditionsMatched` in `__evaluatedConditions` to understand why.
|
|
114
|
+
|
|
115
|
+
Common failures:
|
|
116
|
+
- Mismatched column name in `decisionContext` vs the decision table definition.
|
|
117
|
+
- Using `ALL_MATCH` and accessing `result.<column>` instead of `result[0].<column>`.
|
|
118
|
+
- Using `FIRST_MATCH` and treating `result` as an array.
|
|
119
|
+
- Leaving `decisionOutputColumns` empty, which returns no output columns.
|
|
120
|
+
- Expecting the output under `response` or `results` instead of `result`.
|
|
121
|
+
|
|
122
|
+
## Minimal Process Definition Example
|
|
123
|
+
|
|
124
|
+
```json
|
|
125
|
+
{
|
|
126
|
+
"orgId": 1,
|
|
127
|
+
"namespace": "default",
|
|
128
|
+
"name": "decision-table-test",
|
|
129
|
+
"version": 1,
|
|
130
|
+
"type": "API_ORCHESTRATION",
|
|
131
|
+
"description": "Route based on a decision table lookup.",
|
|
132
|
+
"configuration": null,
|
|
133
|
+
"steps": [
|
|
134
|
+
{
|
|
135
|
+
"orgId": 1,
|
|
136
|
+
"namespace": "default",
|
|
137
|
+
"name": "decision_engine",
|
|
138
|
+
"type": "DECISION_ENGINE",
|
|
139
|
+
"ref": "decision_engine_1",
|
|
140
|
+
"optional": false,
|
|
141
|
+
"createdBy": "system",
|
|
142
|
+
"updatedBy": "system",
|
|
143
|
+
"description": null,
|
|
144
|
+
"label": null,
|
|
145
|
+
"created": 1700000000000,
|
|
146
|
+
"updated": 1700000000000,
|
|
147
|
+
"configuration": {
|
|
148
|
+
"errorPolicyName": null,
|
|
149
|
+
"useCache": false,
|
|
150
|
+
"cacheKey": null,
|
|
151
|
+
"cacheTimeoutSeconds": 0,
|
|
152
|
+
"stream": false,
|
|
153
|
+
"streamAllStatuses": false,
|
|
154
|
+
"preExecutionScript": null,
|
|
155
|
+
"constructInputFromScript": false,
|
|
156
|
+
"scriptLanguage": null,
|
|
157
|
+
"jqTransformer": null,
|
|
158
|
+
"rateLimitMaxRequests": 0,
|
|
159
|
+
"rateLimitWindowSeconds": 0
|
|
160
|
+
},
|
|
161
|
+
"children": [],
|
|
162
|
+
"input": {
|
|
163
|
+
"decisionRuleStrategy": "FIRST_MATCH",
|
|
164
|
+
"decisionTable": "clothes-decision-table",
|
|
165
|
+
"decisionContext": {
|
|
166
|
+
"clothes": "tshirt"
|
|
167
|
+
},
|
|
168
|
+
"decisionTableVersion": "",
|
|
169
|
+
"decisionOutputColumns": [
|
|
170
|
+
"fabric"
|
|
171
|
+
]
|
|
172
|
+
},
|
|
173
|
+
"output": null
|
|
174
|
+
}
|
|
175
|
+
],
|
|
176
|
+
"defaultInput": null,
|
|
177
|
+
"defaultOutput": null,
|
|
178
|
+
"outputMapping": null,
|
|
179
|
+
"signature": null,
|
|
180
|
+
"metadata": null,
|
|
181
|
+
"tags": null,
|
|
182
|
+
"dependencies": null,
|
|
183
|
+
"dependents": null
|
|
184
|
+
}
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
## Minimal Executed Step Example
|
|
188
|
+
|
|
189
|
+
```json
|
|
190
|
+
{
|
|
191
|
+
"id": 593076335,
|
|
192
|
+
"processId": 593076333,
|
|
193
|
+
"ref": "decision_engine_1",
|
|
194
|
+
"namespace": "default",
|
|
195
|
+
"name": "decision_engine",
|
|
196
|
+
"type": "DECISION_ENGINE",
|
|
197
|
+
"status": "COMPLETED",
|
|
198
|
+
"input": {
|
|
199
|
+
"decisionOutputColumns": ["fabric"],
|
|
200
|
+
"decisionTableVersion": "",
|
|
201
|
+
"__currentExecutionStartTime": 1778221367327,
|
|
202
|
+
"decisionContext": {
|
|
203
|
+
"clothes": "tshirt"
|
|
204
|
+
},
|
|
205
|
+
"decisionTable": "clothes-decision-table",
|
|
206
|
+
"decisionRuleStrategy": "FIRST_MATCH"
|
|
207
|
+
},
|
|
208
|
+
"output": {
|
|
209
|
+
"result": {
|
|
210
|
+
"fabric": "Cotton"
|
|
211
|
+
},
|
|
212
|
+
"__evaluatedConditions": [
|
|
213
|
+
{
|
|
214
|
+
"input": "clothes",
|
|
215
|
+
"value": "tshirt",
|
|
216
|
+
"conditionsMatched": ["tshirt"]
|
|
217
|
+
}
|
|
218
|
+
],
|
|
219
|
+
"decisionTableVersion": 1,
|
|
220
|
+
"decisionTable": "clothes-decision-table",
|
|
221
|
+
"decisionRuleStrategy": "FIRST_MATCH"
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
## Example: Reading DECISION_ENGINE Output
|
|
227
|
+
|
|
228
|
+
### FIRST_MATCH — single result
|
|
229
|
+
|
|
230
|
+
```javascript
|
|
231
|
+
(steps, context) => {
|
|
232
|
+
return {
|
|
233
|
+
fabric: steps.decision_engine_1.output.result.fabric
|
|
234
|
+
};
|
|
235
|
+
}
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
### ALL_MATCH — iterate over matches
|
|
239
|
+
|
|
240
|
+
```javascript
|
|
241
|
+
(steps, context) => {
|
|
242
|
+
const matches = steps.decision_engine_1.output.result;
|
|
243
|
+
return {
|
|
244
|
+
allFabrics: matches.map(m => m.fabric),
|
|
245
|
+
matchCount: matches.length
|
|
246
|
+
};
|
|
247
|
+
}
|
|
248
|
+
```
|