|
| 1 | +--- |
| 2 | +title: Schemaless Node Config |
| 3 | +description: Schemaless Node Config protocol schemas |
| 4 | +--- |
| 5 | + |
| 6 | +{/* ⚠️ AUTO-GENERATED — DO NOT EDIT. Run build-docs.ts to regenerate. Hand-written docs live in the module folders under content/docs/. */} |
| 7 | + |
| 8 | +@module automation/schemaless-node-config |
| 9 | + |
| 10 | +Config contracts for the **descriptor-schemaless** builtins whose designer |
| 11 | + |
| 12 | +form lives ONLY in objectui's hand-written `FLOW_NODE_CONFIG` table — |
| 13 | + |
| 14 | +`script`, `subflow` and `decision` (#4278). |
| 15 | + |
| 16 | +## Why these nodes publish no descriptor `configSchema` — and still need this |
| 17 | + |
| 18 | +`config-schemas.test.ts` in `service-automation` pins the schemaless class |
| 19 | + |
| 20 | +with each member's reason: `decision`'s virtual Target column is derived from |
| 21 | + |
| 22 | +the out-edges, `script`'s form switches on `actionType`, `subflow` carries a |
| 23 | + |
| 24 | +top-level `timeoutMs` — a published partial schema would DROP those editors |
| 25 | + |
| 26 | +(the #4210 `connector_action` incident). So the Studio form for these types |
| 27 | + |
| 28 | +is objectui's hand-written group, and until #4278 **nothing reconciled that |
| 29 | + |
| 30 | +hand-written table against the executors**: `script`'s form offered an |
| 31 | + |
| 32 | +`outputVariables` key nothing reads, two `actionType` options that fail every |
| 33 | + |
| 34 | +run, a no-op default — and could not author the `function`/`inputs`/ |
| 35 | + |
| 36 | +`outputVariable` path that works. |
| 37 | + |
| 38 | +These schemas are the machine-readable half of that reconciliation. They are |
| 39 | + |
| 40 | +**written from the executors** (`service-automation/builtin/screen-nodes.ts` |
| 41 | + |
| 42 | +for `script`, `subflow-node.ts`, `logic-nodes.ts` for `decision`), not from |
| 43 | + |
| 44 | +any form, and objectui's `flow-node-config` reconciliation test compares its |
| 45 | + |
| 46 | +hand-written key sets against them — the same bidirectional ledger the |
| 47 | + |
| 48 | +descriptor-schema'd builtins get from `builtin-node-form-zod-ledger.test.ts`, |
| 49 | + |
| 50 | +carried across the repo seam by the `@objectstack/spec` dependency objectui |
| 51 | + |
| 52 | +already has. |
| 53 | + |
| 54 | +`wait` and `connector_action` — the other two schemaless members — need no |
| 55 | + |
| 56 | +entry here: their contracts are the spec-structured sibling blocks on |
| 57 | + |
| 58 | +`FlowNodeSchema` (`waitEventConfig` / `connectorConfig`), which the |
| 59 | + |
| 60 | +same objectui test reconciles directly. |
| 61 | + |
| 62 | +## What these schemas are (and are not) wired to |
| 63 | + |
| 64 | +Contract exports only — no engine path `parse()`s a node config with them, |
| 65 | + |
| 66 | +so registering a flow behaves exactly as before. This is where they differ |
| 67 | + |
| 68 | +from their `builtin-node-config.zod.ts` siblings, which #4277 wired into |
| 69 | + |
| 70 | +execute-time parsing (`service-automation`'s `parse-config.ts`) and into the |
| 71 | + |
| 72 | +`registerFlow()` unknown-key rejection. |
| 73 | + |
| 74 | +That difference is deliberate, and it is the same reason these three publish |
| 75 | + |
| 76 | +no descriptor `configSchema`: **their key set is not the whole contract.** |
| 77 | + |
| 78 | +`script`'s legal keys depend on `actionType` (a built-in side effect reads |
| 79 | + |
| 80 | +`template`/`recipients`/`variables`; the function path reads |
| 81 | + |
| 82 | +`function`/`inputs`/`outputVariable`), and `decision` may carry no |
| 83 | + |
| 84 | +`conditions` at all when it branches purely on edge predicates. A flat parse |
| 85 | + |
| 86 | +would either reject those shapes or wave everything through — neither is the |
| 87 | + |
| 88 | +contract. Wiring them in needs a discriminated form first; until then the |
| 89 | + |
| 90 | +enforcement they DO get is the objectui reconciliation test, which is what |
| 91 | + |
| 92 | +#4278 was actually about (a form authoring keys nothing reads). |
| 93 | + |
| 94 | +Undeclared aliases are NOT part of these contracts: `subflow`'s historical |
| 95 | + |
| 96 | +`flow` spelling graduated into the ADR-0087 D2 conversion |
| 97 | + |
| 98 | +`flow-node-subflow-flow-alias` (the `map.flow` path), so the executor only |
| 99 | + |
| 100 | +ever sees `flowName`. |
| 101 | + |
| 102 | +<Callout type="info"> |
| 103 | +**Source:** `packages/spec/src/automation/schemaless-node-config.zod.ts` |
| 104 | +</Callout> |
| 105 | + |
| 106 | +## TypeScript Usage |
| 107 | + |
| 108 | +```typescript |
| 109 | +import { DecisionCondition, DecisionConfig, ScriptConfig, SubflowConfig } from '@objectstack/spec/automation'; |
| 110 | +import type { DecisionCondition, DecisionConfig, ScriptConfig, SubflowConfig } from '@objectstack/spec/automation'; |
| 111 | + |
| 112 | +// Validate data |
| 113 | +const result = DecisionCondition.parse(data); |
| 114 | +``` |
| 115 | + |
| 116 | +--- |
| 117 | + |
| 118 | +## DecisionCondition |
| 119 | + |
| 120 | +### Properties |
| 121 | + |
| 122 | +| Property | Type | Required | Description | |
| 123 | +| :--- | :--- | :--- | :--- | |
| 124 | +| **label** | `string` | ✅ | Branch label; the winning branch resumes down the out-edge with this label ('true' expression = default/else path) | |
| 125 | +| **expression** | `string` | ✅ | Bare CEL predicate deciding this branch | |
| 126 | + |
| 127 | + |
| 128 | +--- |
| 129 | + |
| 130 | +## DecisionConfig |
| 131 | + |
| 132 | +### Properties |
| 133 | + |
| 134 | +| Property | Type | Required | Description | |
| 135 | +| :--- | :--- | :--- | :--- | |
| 136 | +| **conditions** | `{ label: string; expression: string }[]` | optional | Ordered decision branches (first true expression wins; omit to branch purely on edge conditions) | |
| 137 | + |
| 138 | + |
| 139 | +--- |
| 140 | + |
| 141 | +## ScriptConfig |
| 142 | + |
| 143 | +### Properties |
| 144 | + |
| 145 | +| Property | Type | Required | Description | |
| 146 | +| :--- | :--- | :--- | :--- | |
| 147 | +| **actionType** | `string` | optional | How this step runs: a built-in side effect ('email' \| 'slack'), the 'invoke_function' marker, or shorthand for a registered-function name | |
| 148 | +| **function** | `string` | optional | Registered function to call (defineStack(`{ functions }`)); takes precedence over actionType | |
| 149 | +| **inputs** | `Record<string, any>` | optional | Inputs passed to the function (values interpolate `{token}` templates) | |
| 150 | +| **outputVariable** | `string` | optional | Flow variable the function's return value is bound to | |
| 151 | +| **template** | `string` | optional | Built-in side effects only: message template id | |
| 152 | +| **recipients** | `string[]` | optional | Built-in side effects only: recipients (user ids, field refs, or addresses) | |
| 153 | +| **variables** | `Record<string, any>` | optional | Built-in side effects only: values injected into the template | |
| 154 | +| **script** | `string` | optional | Inline JS source — recognized but not executed by the built-in runtime; use a registered function via `function` instead | |
| 155 | + |
| 156 | + |
| 157 | +--- |
| 158 | + |
| 159 | +## SubflowConfig |
| 160 | + |
| 161 | +### Properties |
| 162 | + |
| 163 | +| Property | Type | Required | Description | |
| 164 | +| :--- | :--- | :--- | :--- | |
| 165 | +| **flowName** | `string` | ✅ | Flow invoked as this step (it may pause — approval / screen / wait) | |
| 166 | +| **input** | `Record<string, any>` | optional | Values passed to the subflow's input variables (interpolate `{token}` templates) | |
| 167 | +| **outputVariable** | `string` | optional | Parent flow variable the subflow's output is bound to | |
| 168 | + |
| 169 | + |
| 170 | +--- |
| 171 | + |
0 commit comments