@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,296 @@
|
|
|
1
|
+
# Sub Process Step Schema
|
|
2
|
+
|
|
3
|
+
`SUB_PROCESS` calls another process definition as a child process from the
|
|
4
|
+
current workflow. Use it for modular workflow design, code reuse, composition,
|
|
5
|
+
background work, and calling reusable API orchestration workflows.
|
|
6
|
+
|
|
7
|
+
Subprocesses inherit authentication context from the parent process. User
|
|
8
|
+
permissions, roles, and auth claims are preserved across the process boundary.
|
|
9
|
+
|
|
10
|
+
## Definition Input Schema
|
|
11
|
+
|
|
12
|
+
```json
|
|
13
|
+
{
|
|
14
|
+
"processName": "count-posts",
|
|
15
|
+
"processVersion": 1,
|
|
16
|
+
"waitForCompletion": true,
|
|
17
|
+
"requestId": "optional-request-id",
|
|
18
|
+
"correlationId": "optional-correlation-id",
|
|
19
|
+
"input": {
|
|
20
|
+
"field": "value"
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
Required:
|
|
26
|
+
- `processName`: name of the process definition to execute.
|
|
27
|
+
|
|
28
|
+
Optional:
|
|
29
|
+
- `processVersion`: process definition version. If omitted, latest is used.
|
|
30
|
+
- `waitForCompletion`: whether to wait for subprocess completion. Defaults to `true`.
|
|
31
|
+
- `requestId`: custom child request id.
|
|
32
|
+
- `correlationId`: custom child correlation id.
|
|
33
|
+
- `input`: object passed to the subprocess.
|
|
34
|
+
|
|
35
|
+
Minimal:
|
|
36
|
+
|
|
37
|
+
```json
|
|
38
|
+
{
|
|
39
|
+
"waitForCompletion": true,
|
|
40
|
+
"processName": "count-posts"
|
|
41
|
+
}
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## Runtime Output Schema
|
|
45
|
+
|
|
46
|
+
Synchronous output with `waitForCompletion: true`:
|
|
47
|
+
|
|
48
|
+
```json
|
|
49
|
+
{
|
|
50
|
+
"subProcessCorrelationId": "bca83c12-ff4b-4260-832a-ab347cf8a360",
|
|
51
|
+
"subProcessRequestId": "eb21f023-a321-48e4-bcc1-5ff8be726af0",
|
|
52
|
+
"subProcessId": 28800033,
|
|
53
|
+
"subProcessOutput": {
|
|
54
|
+
"result": {
|
|
55
|
+
"count": 100
|
|
56
|
+
},
|
|
57
|
+
"logs": []
|
|
58
|
+
},
|
|
59
|
+
"__subProcessMetadata": {
|
|
60
|
+
"processName": "count-posts",
|
|
61
|
+
"waitForCompletion": true,
|
|
62
|
+
"processVersion": 1
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
Possible failure output:
|
|
68
|
+
|
|
69
|
+
```json
|
|
70
|
+
{
|
|
71
|
+
"subProcessOutput": {
|
|
72
|
+
"error": "Error message from subprocess"
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
Process not found:
|
|
78
|
+
|
|
79
|
+
```json
|
|
80
|
+
{
|
|
81
|
+
"error": "The selected sub process name count-posts does not exist in the namespace : default"
|
|
82
|
+
}
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
## Execution Modes
|
|
86
|
+
|
|
87
|
+
Synchronous execution, `waitForCompletion: true`:
|
|
88
|
+
- The SUB_PROCESS step waits for the child process to complete.
|
|
89
|
+
- Step remains `RUNNING` while the subprocess runs.
|
|
90
|
+
- Step output includes final `subProcessOutput`.
|
|
91
|
+
- Use this when later steps need the subprocess result.
|
|
92
|
+
- This is the safer default for error handling.
|
|
93
|
+
|
|
94
|
+
Asynchronous execution, `waitForCompletion: false`:
|
|
95
|
+
- The SUB_PROCESS step starts the child process and immediately continues.
|
|
96
|
+
- Step becomes `COMPLETED` after starting the subprocess.
|
|
97
|
+
- Output contains subprocess metadata, but not the final result.
|
|
98
|
+
- The subprocess continues running in the background.
|
|
99
|
+
- Critical: the SUB_PROCESS step can be `COMPLETED` even if the child process later fails.
|
|
100
|
+
- Use only for fire-and-forget/background operations where the parent does not need the result.
|
|
101
|
+
|
|
102
|
+
## Status Handling
|
|
103
|
+
|
|
104
|
+
| Subprocess status | SUB_PROCESS step status | Meaning |
|
|
105
|
+
|-------------------|-------------------------|---------|
|
|
106
|
+
| `COMPLETED` | `COMPLETED` | Child completed successfully |
|
|
107
|
+
| `REVIEWED` | `COMPLETED` | Child completed and reviewed |
|
|
108
|
+
| `TERMINATED` | `COMPLETED` | Child was terminated |
|
|
109
|
+
| `RUNNING` | `RUNNING` | Child is still executing |
|
|
110
|
+
| `FAILED` | `FAILED` | Child encountered an error |
|
|
111
|
+
|
|
112
|
+
For `waitForCompletion: false`, the parent step completes after launch and does
|
|
113
|
+
not reliably represent the final child status.
|
|
114
|
+
|
|
115
|
+
## Output Access Paths
|
|
116
|
+
|
|
117
|
+
Use:
|
|
118
|
+
- `steps.<ref>.output.subProcessOutput` for the child process output.
|
|
119
|
+
- `steps.<ref>.output.subProcessOutput.result` for a child script result object.
|
|
120
|
+
- `steps.<ref>.output.subProcessOutput.result.<field>` for child result fields.
|
|
121
|
+
- `steps.<ref>.output.subProcessId` for the child process id.
|
|
122
|
+
- `steps.<ref>.output.subProcessRequestId` for the child request id.
|
|
123
|
+
- `steps.<ref>.output.subProcessCorrelationId` for the child correlation id.
|
|
124
|
+
- `steps.<ref>.output.__subProcessMetadata.processName` for the called process name.
|
|
125
|
+
- `steps.<ref>.output.error` or `steps.<ref>.output.subProcessOutput.error` for errors.
|
|
126
|
+
|
|
127
|
+
Do not use:
|
|
128
|
+
- `steps.<ref>.output.result`
|
|
129
|
+
- `steps.<ref>.output.response`
|
|
130
|
+
- `steps.<ref>.output.processId`
|
|
131
|
+
- `steps.<ref>.output.output`
|
|
132
|
+
|
|
133
|
+
## Generation Rules
|
|
134
|
+
|
|
135
|
+
- Use uppercase step type: `"SUB_PROCESS"`.
|
|
136
|
+
- Put subprocess configuration in `input`.
|
|
137
|
+
- Always include `processName`.
|
|
138
|
+
- Prefer `waitForCompletion: true` unless the user explicitly wants fire-and-forget behavior.
|
|
139
|
+
- Specify `processVersion` for production stability when the exact version matters.
|
|
140
|
+
- Pass child input under `input.input`.
|
|
141
|
+
- Use `{{ context.input.<field> }}` or `{{ steps.<ref>.output... }}` for dynamic child input values.
|
|
142
|
+
- Do not use `children`; SUB_PROCESS is not a container in the parent definition.
|
|
143
|
+
- Do not assume async subprocess success when `waitForCompletion: false`.
|
|
144
|
+
- Avoid deep nested subprocess chains unless the user explicitly needs composition.
|
|
145
|
+
|
|
146
|
+
## Debugging Rules
|
|
147
|
+
|
|
148
|
+
When debugging a SUB_PROCESS:
|
|
149
|
+
- Inspect the SUB_PROCESS step status.
|
|
150
|
+
- Inspect `output.subProcessId` and fetch that child process run if deeper details are needed.
|
|
151
|
+
- Inspect `output.subProcessOutput` for the child result or error.
|
|
152
|
+
- Check `__subProcessMetadata.processName`, `processVersion`, and `waitForCompletion`.
|
|
153
|
+
- If `waitForCompletion: false`, explain that parent completion only means the child was started.
|
|
154
|
+
- If process name is not found, verify namespace and process definition name.
|
|
155
|
+
- If child failed, debug the child process run using its own step records.
|
|
156
|
+
|
|
157
|
+
Common failures:
|
|
158
|
+
- Missing or wrong `processName`.
|
|
159
|
+
- Assuming latest version is stable in production.
|
|
160
|
+
- Using `waitForCompletion: false` when later steps need the child result.
|
|
161
|
+
- Looking for output at `steps.<ref>.output.result` instead of `subProcessOutput`.
|
|
162
|
+
- Not passing required child input under `input`.
|
|
163
|
+
- Confusing parent process id with `subProcessId`.
|
|
164
|
+
|
|
165
|
+
## Minimal Process Definition Example
|
|
166
|
+
|
|
167
|
+
```json
|
|
168
|
+
{
|
|
169
|
+
"orgId": 1,
|
|
170
|
+
"namespace": "default",
|
|
171
|
+
"name": "kebab-case-name",
|
|
172
|
+
"version": 1,
|
|
173
|
+
"type": "API_ORCHESTRATION",
|
|
174
|
+
"description": "Call the count-posts subprocess.",
|
|
175
|
+
"configuration": null,
|
|
176
|
+
"steps": [
|
|
177
|
+
{
|
|
178
|
+
"orgId": 1,
|
|
179
|
+
"namespace": "default",
|
|
180
|
+
"name": "sub_process",
|
|
181
|
+
"type": "SUB_PROCESS",
|
|
182
|
+
"ref": "sub_process_1",
|
|
183
|
+
"optional": false,
|
|
184
|
+
"createdBy": "system",
|
|
185
|
+
"updatedBy": "system",
|
|
186
|
+
"description": null,
|
|
187
|
+
"label": null,
|
|
188
|
+
"created": 1700000000000,
|
|
189
|
+
"updated": 1700000000000,
|
|
190
|
+
"configuration": {
|
|
191
|
+
"errorPolicyName": null,
|
|
192
|
+
"useCache": false,
|
|
193
|
+
"cacheKey": null,
|
|
194
|
+
"cacheTimeoutSeconds": 0,
|
|
195
|
+
"stream": false,
|
|
196
|
+
"streamAllStatuses": false,
|
|
197
|
+
"preExecutionScript": null,
|
|
198
|
+
"constructInputFromScript": false,
|
|
199
|
+
"scriptLanguage": null,
|
|
200
|
+
"jqTransformer": null,
|
|
201
|
+
"rateLimitMaxRequests": 0,
|
|
202
|
+
"rateLimitWindowSeconds": 0
|
|
203
|
+
},
|
|
204
|
+
"children": [],
|
|
205
|
+
"input": {
|
|
206
|
+
"waitForCompletion": true,
|
|
207
|
+
"processName": "count-posts"
|
|
208
|
+
},
|
|
209
|
+
"output": null
|
|
210
|
+
}
|
|
211
|
+
],
|
|
212
|
+
"defaultInput": null,
|
|
213
|
+
"defaultOutput": null,
|
|
214
|
+
"outputMapping": null,
|
|
215
|
+
"signature": null,
|
|
216
|
+
"metadata": null,
|
|
217
|
+
"tags": null,
|
|
218
|
+
"dependencies": null,
|
|
219
|
+
"dependents": null
|
|
220
|
+
}
|
|
221
|
+
```
|
|
222
|
+
|
|
223
|
+
## Minimal Executed Step Example
|
|
224
|
+
|
|
225
|
+
```json
|
|
226
|
+
{
|
|
227
|
+
"id": 28800032,
|
|
228
|
+
"processId": 28800030,
|
|
229
|
+
"ref": "sub_process_1",
|
|
230
|
+
"namespace": "default",
|
|
231
|
+
"name": "sub_process",
|
|
232
|
+
"type": "SUB_PROCESS",
|
|
233
|
+
"status": "COMPLETED",
|
|
234
|
+
"input": {
|
|
235
|
+
"processName": "count-posts",
|
|
236
|
+
"waitForCompletion": true,
|
|
237
|
+
"__currentExecutionStartTime": 1778184434792
|
|
238
|
+
},
|
|
239
|
+
"output": {
|
|
240
|
+
"subProcessCorrelationId": "bca83c12-ff4b-4260-832a-ab347cf8a360",
|
|
241
|
+
"subProcessRequestId": "eb21f023-a321-48e4-bcc1-5ff8be726af0",
|
|
242
|
+
"subProcessId": 28800033,
|
|
243
|
+
"subProcessOutput": {
|
|
244
|
+
"result": {
|
|
245
|
+
"count": 100
|
|
246
|
+
},
|
|
247
|
+
"logs": []
|
|
248
|
+
},
|
|
249
|
+
"__subProcessMetadata": {
|
|
250
|
+
"processName": "count-posts",
|
|
251
|
+
"waitForCompletion": true,
|
|
252
|
+
"processVersion": 1
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
```
|
|
257
|
+
|
|
258
|
+
## Basic Subprocess Call
|
|
259
|
+
|
|
260
|
+
```json
|
|
261
|
+
{
|
|
262
|
+
"processName": "getUserProfile",
|
|
263
|
+
"waitForCompletion": true,
|
|
264
|
+
"input": {
|
|
265
|
+
"userId": "{{ context.input.userId }}",
|
|
266
|
+
"includePreferences": true
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
```
|
|
270
|
+
|
|
271
|
+
## Asynchronous Subprocess
|
|
272
|
+
|
|
273
|
+
```json
|
|
274
|
+
{
|
|
275
|
+
"processName": "emailNotification",
|
|
276
|
+
"waitForCompletion": false,
|
|
277
|
+
"input": {
|
|
278
|
+
"recipient": "{{ context.input.email }}",
|
|
279
|
+
"template": "welcome"
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
```
|
|
283
|
+
|
|
284
|
+
## Dynamic Process Selection
|
|
285
|
+
|
|
286
|
+
```json
|
|
287
|
+
{
|
|
288
|
+
"processName": "{{ steps.decide_service.output.result.serviceName }}",
|
|
289
|
+
"processVersion": 2,
|
|
290
|
+
"waitForCompletion": true,
|
|
291
|
+
"input": {
|
|
292
|
+
"data": "{{ context.input.payload }}"
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
```
|
|
296
|
+
|
|
@@ -0,0 +1,369 @@
|
|
|
1
|
+
# Switch Step Schema
|
|
2
|
+
|
|
3
|
+
`SWITCH` is a container step that chooses one path from a list of alternatives.
|
|
4
|
+
It evaluates JavaScript, expects the script to return a string case identifier,
|
|
5
|
+
and maps that case to one of its child step refs using `responseMapping`.
|
|
6
|
+
|
|
7
|
+
The possible cases are the SWITCH step's children. `responseMapping` maps case
|
|
8
|
+
values to those child refs.
|
|
9
|
+
|
|
10
|
+
## Definition Input Schema
|
|
11
|
+
|
|
12
|
+
```json
|
|
13
|
+
{
|
|
14
|
+
"script": "// (steps, context) will be provided as default inputs \n// return a string that maps to a targetRef in responseMapping\n(steps, context) => {\n const result = context.input.case;\n if (result === 1) return \"case1\";\n return \"case2\";\n}\n",
|
|
15
|
+
"responseMapping": [
|
|
16
|
+
{
|
|
17
|
+
"targetRef": "http_1",
|
|
18
|
+
"value": "case1"
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
"targetRef": "http_2",
|
|
22
|
+
"value": "case2"
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
"targetRef": "fallback_step",
|
|
26
|
+
"defaultBranch": true
|
|
27
|
+
}
|
|
28
|
+
]
|
|
29
|
+
}
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
Required:
|
|
33
|
+
- `script`: JavaScript function receiving `(steps, context)`.
|
|
34
|
+
- `responseMapping`: array of case-to-child mappings.
|
|
35
|
+
- Each non-default mapping needs `targetRef` and `value`.
|
|
36
|
+
|
|
37
|
+
Optional:
|
|
38
|
+
- One mapping can include `defaultBranch: true`.
|
|
39
|
+
- `defaultBranch` is used when no `value` matches the script result.
|
|
40
|
+
|
|
41
|
+
## Runtime Output Schema
|
|
42
|
+
|
|
43
|
+
The SWITCH output stores the selected case string in `output.result`.
|
|
44
|
+
|
|
45
|
+
```json
|
|
46
|
+
{
|
|
47
|
+
"result": "case1",
|
|
48
|
+
"logs": []
|
|
49
|
+
}
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
The selected child runs as a child step with `parentRef` set to the SWITCH ref.
|
|
53
|
+
The selected child's output is stored under the child step's own output shape.
|
|
54
|
+
|
|
55
|
+
```json
|
|
56
|
+
{
|
|
57
|
+
"ref": "http_1",
|
|
58
|
+
"parentRef": "switch_1",
|
|
59
|
+
"type": "HTTP",
|
|
60
|
+
"output": {
|
|
61
|
+
"response": {
|
|
62
|
+
"counter": 5,
|
|
63
|
+
"randomId": "ce1c8c21-8bbb-4c9e-94ca-1193a66d6933"
|
|
64
|
+
},
|
|
65
|
+
"statusCode": 200
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
## Output Access Paths
|
|
71
|
+
|
|
72
|
+
Use:
|
|
73
|
+
- `steps.<switch_ref>.output.result` for the selected case string.
|
|
74
|
+
- `steps.<switch_ref>.output.logs` for captured logs.
|
|
75
|
+
- `steps.<selected_child_ref>.output...` to access the selected child's output.
|
|
76
|
+
- `steps.<http_child_ref>.output.response` for a selected native HTTP child response body.
|
|
77
|
+
- `stepRecords[].parentRef` when debugging executed process data.
|
|
78
|
+
|
|
79
|
+
Do not use:
|
|
80
|
+
- `steps.<switch_ref>.output.response`
|
|
81
|
+
- `steps.<switch_ref>.output.<child_ref>`
|
|
82
|
+
- `steps.<switch_ref>.children.<child_ref>.output`
|
|
83
|
+
- `steps.<switch_ref>.output.result.<field>` unless the case string is intentionally being treated as a string.
|
|
84
|
+
|
|
85
|
+
## Generation Rules
|
|
86
|
+
|
|
87
|
+
- Use uppercase step type: `"SWITCH"`.
|
|
88
|
+
- Put JavaScript code in `input.script`.
|
|
89
|
+
- The script must accept `(steps, context)`.
|
|
90
|
+
- The script must return a string case identifier.
|
|
91
|
+
- `responseMapping[].targetRef` must match a child step `ref`.
|
|
92
|
+
- `responseMapping[].value` must match a possible script return value.
|
|
93
|
+
- Add `defaultBranch: true` when the user needs a fallback path.
|
|
94
|
+
- Child `ref` values must be unique across the whole workflow.
|
|
95
|
+
- If a branch needs multiple sequential steps, use a child `LIST` and map the case to the LIST ref.
|
|
96
|
+
- Do not return objects or booleans from the SWITCH script unless converting them to strings that match `responseMapping`.
|
|
97
|
+
- Do not expect unselected children to run.
|
|
98
|
+
|
|
99
|
+
## Debugging Rules
|
|
100
|
+
|
|
101
|
+
When debugging a SWITCH:
|
|
102
|
+
- Inspect `stepRecords[].output.result` to see which case was selected.
|
|
103
|
+
- Confirm the selected case exists in `responseMapping`.
|
|
104
|
+
- Confirm `targetRef` points to a child step of the SWITCH.
|
|
105
|
+
- Inspect only the selected child step record for the executed path.
|
|
106
|
+
- If no child ran, check whether the script return matched a mapping or default branch.
|
|
107
|
+
- If process-level output mirrors a child output, explain which selected child produced it.
|
|
108
|
+
- Use child step type rules to interpret the selected child output.
|
|
109
|
+
|
|
110
|
+
Common failures:
|
|
111
|
+
- SWITCH script returns a number/boolean/object instead of a string.
|
|
112
|
+
- `responseMapping[].targetRef` does not match a child `ref`.
|
|
113
|
+
- Script returns a value with no mapping and no default branch.
|
|
114
|
+
- Assistant tries to read selected child output from `steps.<switch_ref>.output.response`.
|
|
115
|
+
- A branch needs multiple steps but is modeled as multiple sibling children for one case instead of a child `LIST`.
|
|
116
|
+
- Later steps assume both branches ran.
|
|
117
|
+
|
|
118
|
+
## Minimal Process Definition Example
|
|
119
|
+
|
|
120
|
+
```json
|
|
121
|
+
{
|
|
122
|
+
"orgId": 1,
|
|
123
|
+
"namespace": "default",
|
|
124
|
+
"name": "kebab-case-name",
|
|
125
|
+
"version": 1,
|
|
126
|
+
"type": "API_ORCHESTRATION",
|
|
127
|
+
"description": "Choose one HTTP branch based on input case.",
|
|
128
|
+
"configuration": null,
|
|
129
|
+
"steps": [
|
|
130
|
+
{
|
|
131
|
+
"orgId": 1,
|
|
132
|
+
"namespace": "default",
|
|
133
|
+
"name": "switch",
|
|
134
|
+
"type": "SWITCH",
|
|
135
|
+
"ref": "switch_1",
|
|
136
|
+
"optional": false,
|
|
137
|
+
"createdBy": "system",
|
|
138
|
+
"updatedBy": "system",
|
|
139
|
+
"description": null,
|
|
140
|
+
"label": null,
|
|
141
|
+
"created": 1700000000000,
|
|
142
|
+
"updated": 1700000000000,
|
|
143
|
+
"configuration": {
|
|
144
|
+
"errorPolicyName": null,
|
|
145
|
+
"useCache": false,
|
|
146
|
+
"cacheKey": null,
|
|
147
|
+
"cacheTimeoutSeconds": 0,
|
|
148
|
+
"stream": false,
|
|
149
|
+
"streamAllStatuses": false,
|
|
150
|
+
"preExecutionScript": null,
|
|
151
|
+
"constructInputFromScript": false,
|
|
152
|
+
"scriptLanguage": null,
|
|
153
|
+
"jqTransformer": null,
|
|
154
|
+
"rateLimitMaxRequests": 0,
|
|
155
|
+
"rateLimitWindowSeconds": 0
|
|
156
|
+
},
|
|
157
|
+
"children": [
|
|
158
|
+
{
|
|
159
|
+
"orgId": 1,
|
|
160
|
+
"namespace": "default",
|
|
161
|
+
"name": "http",
|
|
162
|
+
"type": "HTTP",
|
|
163
|
+
"ref": "http_2",
|
|
164
|
+
"optional": false,
|
|
165
|
+
"createdBy": "system",
|
|
166
|
+
"updatedBy": "system",
|
|
167
|
+
"description": null,
|
|
168
|
+
"label": null,
|
|
169
|
+
"created": 1700000000000,
|
|
170
|
+
"updated": 1700000000000,
|
|
171
|
+
"configuration": {
|
|
172
|
+
"errorPolicyName": null,
|
|
173
|
+
"useCache": false,
|
|
174
|
+
"cacheKey": null,
|
|
175
|
+
"cacheTimeoutSeconds": 0,
|
|
176
|
+
"stream": false,
|
|
177
|
+
"streamAllStatuses": false,
|
|
178
|
+
"preExecutionScript": null,
|
|
179
|
+
"constructInputFromScript": false,
|
|
180
|
+
"scriptLanguage": null,
|
|
181
|
+
"jqTransformer": null,
|
|
182
|
+
"rateLimitMaxRequests": 0,
|
|
183
|
+
"rateLimitWindowSeconds": 0
|
|
184
|
+
},
|
|
185
|
+
"children": [],
|
|
186
|
+
"input": {
|
|
187
|
+
"method": "GET",
|
|
188
|
+
"url": "http://localhost:8080/api/test/get",
|
|
189
|
+
"headers": {
|
|
190
|
+
"Content-Type": "application/json",
|
|
191
|
+
"Accept": "application/json",
|
|
192
|
+
"Authorization": "Bearer {{secrets.test_token}}"
|
|
193
|
+
},
|
|
194
|
+
"params": {
|
|
195
|
+
"sampleKey": "sampleValue"
|
|
196
|
+
},
|
|
197
|
+
"repeatUntilEnabled": null,
|
|
198
|
+
"repeatUntilCondition": {
|
|
199
|
+
"script": "(steps, context) => {\n return steps.__self.output.response.counter === 100;\n}"
|
|
200
|
+
},
|
|
201
|
+
"repeatIntervalSeconds": null,
|
|
202
|
+
"maxRepeatCount": null,
|
|
203
|
+
"includeFullResponseString": false,
|
|
204
|
+
"noEncode": false,
|
|
205
|
+
"extraLongTimeouts": false
|
|
206
|
+
},
|
|
207
|
+
"output": null
|
|
208
|
+
},
|
|
209
|
+
{
|
|
210
|
+
"orgId": 1,
|
|
211
|
+
"namespace": "default",
|
|
212
|
+
"name": "http",
|
|
213
|
+
"type": "HTTP",
|
|
214
|
+
"ref": "http_1",
|
|
215
|
+
"optional": false,
|
|
216
|
+
"createdBy": "system",
|
|
217
|
+
"updatedBy": "system",
|
|
218
|
+
"description": null,
|
|
219
|
+
"label": null,
|
|
220
|
+
"created": 1700000000000,
|
|
221
|
+
"updated": 1700000000000,
|
|
222
|
+
"configuration": {
|
|
223
|
+
"errorPolicyName": null,
|
|
224
|
+
"useCache": false,
|
|
225
|
+
"cacheKey": null,
|
|
226
|
+
"cacheTimeoutSeconds": 0,
|
|
227
|
+
"stream": false,
|
|
228
|
+
"streamAllStatuses": false,
|
|
229
|
+
"preExecutionScript": null,
|
|
230
|
+
"constructInputFromScript": false,
|
|
231
|
+
"scriptLanguage": null,
|
|
232
|
+
"jqTransformer": null,
|
|
233
|
+
"rateLimitMaxRequests": 0,
|
|
234
|
+
"rateLimitWindowSeconds": 0
|
|
235
|
+
},
|
|
236
|
+
"children": [],
|
|
237
|
+
"input": {
|
|
238
|
+
"method": "GET",
|
|
239
|
+
"url": "http://localhost:8080/api/test/get",
|
|
240
|
+
"headers": {
|
|
241
|
+
"Content-Type": "application/json",
|
|
242
|
+
"Accept": "application/json",
|
|
243
|
+
"Authorization": "Bearer {{secrets.test_token}}"
|
|
244
|
+
},
|
|
245
|
+
"params": {
|
|
246
|
+
"sampleKey": "sampleValue"
|
|
247
|
+
},
|
|
248
|
+
"repeatUntilEnabled": null,
|
|
249
|
+
"repeatUntilCondition": {
|
|
250
|
+
"script": "(steps, context) => {\n return steps.__self.output.response.counter === 100;\n}"
|
|
251
|
+
},
|
|
252
|
+
"repeatIntervalSeconds": null,
|
|
253
|
+
"maxRepeatCount": null,
|
|
254
|
+
"includeFullResponseString": false,
|
|
255
|
+
"noEncode": false,
|
|
256
|
+
"extraLongTimeouts": false
|
|
257
|
+
},
|
|
258
|
+
"output": null
|
|
259
|
+
}
|
|
260
|
+
],
|
|
261
|
+
"input": {
|
|
262
|
+
"script": "// (steps, context) will be provided as default inputs \n// return a string that maps to a targetRef in responseMapping\n(steps, context) => {\n const result = context.input.case;\n if (result === 1) return \"case1\";\n return \"case2\";\n}\n",
|
|
263
|
+
"responseMapping": [
|
|
264
|
+
{
|
|
265
|
+
"targetRef": "http_1",
|
|
266
|
+
"value": "case1"
|
|
267
|
+
},
|
|
268
|
+
{
|
|
269
|
+
"targetRef": "http_2",
|
|
270
|
+
"value": "case2"
|
|
271
|
+
}
|
|
272
|
+
]
|
|
273
|
+
},
|
|
274
|
+
"output": null
|
|
275
|
+
}
|
|
276
|
+
],
|
|
277
|
+
"defaultInput": null,
|
|
278
|
+
"defaultOutput": null,
|
|
279
|
+
"outputMapping": null,
|
|
280
|
+
"signature": null,
|
|
281
|
+
"metadata": null,
|
|
282
|
+
"tags": null,
|
|
283
|
+
"dependencies": null,
|
|
284
|
+
"dependents": null
|
|
285
|
+
}
|
|
286
|
+
```
|
|
287
|
+
|
|
288
|
+
## Minimal Executed Step Records Example
|
|
289
|
+
|
|
290
|
+
SWITCH container step record:
|
|
291
|
+
|
|
292
|
+
```json
|
|
293
|
+
{
|
|
294
|
+
"id": 28800028,
|
|
295
|
+
"processId": 28800026,
|
|
296
|
+
"ref": "switch_1",
|
|
297
|
+
"parentId": null,
|
|
298
|
+
"parentRef": null,
|
|
299
|
+
"namespace": "default",
|
|
300
|
+
"name": "switch",
|
|
301
|
+
"type": "SWITCH",
|
|
302
|
+
"status": "COMPLETED",
|
|
303
|
+
"input": {
|
|
304
|
+
"responseMapping": [
|
|
305
|
+
{
|
|
306
|
+
"targetRef": "http_1",
|
|
307
|
+
"value": "case1"
|
|
308
|
+
},
|
|
309
|
+
{
|
|
310
|
+
"targetRef": "http_2",
|
|
311
|
+
"value": "case2"
|
|
312
|
+
}
|
|
313
|
+
],
|
|
314
|
+
"script": "// (steps, context) will be provided as default inputs \n(steps, context) => {\n const result = context.input.case;\n if (result === 1) return \"case1\";\n return \"case2\";\n}\n",
|
|
315
|
+
"__currentExecutionStartTime": 1778184170808
|
|
316
|
+
},
|
|
317
|
+
"output": {
|
|
318
|
+
"result": "case1",
|
|
319
|
+
"logs": []
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
```
|
|
323
|
+
|
|
324
|
+
Selected HTTP child step record:
|
|
325
|
+
|
|
326
|
+
```json
|
|
327
|
+
{
|
|
328
|
+
"id": 28800029,
|
|
329
|
+
"processId": 28800026,
|
|
330
|
+
"ref": "http_1",
|
|
331
|
+
"parentId": 28800028,
|
|
332
|
+
"parentRef": "switch_1",
|
|
333
|
+
"namespace": "default",
|
|
334
|
+
"name": "http",
|
|
335
|
+
"type": "HTTP",
|
|
336
|
+
"status": "COMPLETED",
|
|
337
|
+
"output": {
|
|
338
|
+
"response": {
|
|
339
|
+
"counter": 5,
|
|
340
|
+
"randomId": "ce1c8c21-8bbb-4c9e-94ca-1193a66d6933"
|
|
341
|
+
},
|
|
342
|
+
"statusCode": 200
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
```
|
|
346
|
+
|
|
347
|
+
## Example: Branch To LIST Children
|
|
348
|
+
|
|
349
|
+
Use `LIST` children when a case needs multiple sequential steps:
|
|
350
|
+
|
|
351
|
+
```json
|
|
352
|
+
{
|
|
353
|
+
"responseMapping": [
|
|
354
|
+
{
|
|
355
|
+
"targetRef": "approved_path",
|
|
356
|
+
"value": "approved"
|
|
357
|
+
},
|
|
358
|
+
{
|
|
359
|
+
"targetRef": "rejected_path",
|
|
360
|
+
"value": "rejected"
|
|
361
|
+
},
|
|
362
|
+
{
|
|
363
|
+
"targetRef": "fallback_path",
|
|
364
|
+
"defaultBranch": true
|
|
365
|
+
}
|
|
366
|
+
]
|
|
367
|
+
}
|
|
368
|
+
```
|
|
369
|
+
|