|
| 1 | +--- |
| 2 | +title: Builtin Node Config |
| 3 | +description: Builtin 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/builtin-node-config |
| 9 | + |
| 10 | +Config contracts for the remaining flat builtins — the CRUD quartet |
| 11 | + |
| 12 | +(`get_record` / `create_record` / `update_record` / `delete_record`), |
| 13 | + |
| 14 | +`screen`, and `map` (#4045). Sibling of `io-node-config.zod.ts` |
| 15 | + |
| 16 | +(notify / http) and `control-flow.zod.ts` (loop / parallel / try_catch). |
| 17 | + |
| 18 | +## Provenance — written from the executors, not from the forms |
| 19 | + |
| 20 | +Each schema was derived by reading what the executor actually does with |
| 21 | + |
| 22 | +`node.config` (`service-automation/builtin/crud-nodes.ts`, |
| 23 | + |
| 24 | +`screen-nodes.ts`, `map-node.ts`), **not** by transcribing the hand-written |
| 25 | + |
| 26 | +`configSchema` literal on the node's descriptor. The two artifacts are |
| 27 | + |
| 28 | +reconciled bidirectionally by `builtin-node-form-zod-ledger.test.ts` in |
| 29 | + |
| 30 | +`service-automation`; a Zod copied from the form would make that |
| 31 | + |
| 32 | +reconciliation a tautology (#4045). |
| 33 | + |
| 34 | +Writing these against the executors is what surfaced the drift the |
| 35 | + |
| 36 | +reconciliation exists to catch — keys the executors read that no form |
| 37 | + |
| 38 | +offered anywhere (`get_record.fields`, `screen.recordId`, the screen |
| 39 | + |
| 40 | +field-item keys `options`/`defaultValue`/`placeholder`, `map.indexVariable`, |
| 41 | + |
| 42 | +`map.input`), and the undeclared `map.flow` alias, which graduated into the |
| 43 | + |
| 44 | +ADR-0087 D2 conversion layer like `notify.source` before it. |
| 45 | + |
| 46 | +## What these schemas are (and are not) wired to |
| 47 | + |
| 48 | +Contract exports only — no engine path `parse()`s a node config with them |
| 49 | + |
| 50 | +today, so registering a flow behaves exactly as before. Wiring the executors |
| 51 | + |
| 52 | +to parse is deliberately deferred until the #4059 undeclared-key warning has |
| 53 | + |
| 54 | +measured a release's worth of real metadata (#4045 step 3b). |
| 55 | + |
| 56 | +Deliberately absent: |
| 57 | + |
| 58 | +- `assignment` — its config cannot be described by a fixed key set: with no |
| 59 | + |
| 60 | +`assignments` wrapper the TOP-LEVEL config keys ARE the author's variable |
| 61 | + |
| 62 | +names (logic-nodes.ts). The ledger test pins that exemption with its |
| 63 | + |
| 64 | +reason instead of pretending a shape. |
| 65 | + |
| 66 | +- `decision` / `script` / `subflow` / `wait` / `connector_action` — the |
| 67 | + |
| 68 | +deliberately-schemaless class (config-schemas.test.ts); their contracts |
| 69 | + |
| 70 | +live elsewhere (edges, sibling blocks, conditional forms). |
| 71 | + |
| 72 | +<Callout type="info"> |
| 73 | +**Source:** `packages/spec/src/automation/builtin-node-config.zod.ts` |
| 74 | +</Callout> |
| 75 | + |
| 76 | +## TypeScript Usage |
| 77 | + |
| 78 | +```typescript |
| 79 | +import { CreateRecordConfig, DeleteRecordConfig, GetRecordConfig, MapConfig, ScreenConfig, ScreenFieldConfig, UpdateRecordConfig } from '@objectstack/spec/automation'; |
| 80 | +import type { CreateRecordConfig, DeleteRecordConfig, GetRecordConfig, MapConfig, ScreenConfig, ScreenFieldConfig, UpdateRecordConfig } from '@objectstack/spec/automation'; |
| 81 | + |
| 82 | +// Validate data |
| 83 | +const result = CreateRecordConfig.parse(data); |
| 84 | +``` |
| 85 | + |
| 86 | +--- |
| 87 | + |
| 88 | +## CreateRecordConfig |
| 89 | + |
| 90 | +### Properties |
| 91 | + |
| 92 | +| Property | Type | Required | Description | |
| 93 | +| :--- | :--- | :--- | :--- | |
| 94 | +| **objectName** | `string` | ✅ | Object to insert into | |
| 95 | +| **fields** | `Record<string, any>` | optional | Field values to write on the new record | |
| 96 | +| **outputVariable** | `string` | optional | Flow variable bound to the created record | |
| 97 | + |
| 98 | + |
| 99 | +--- |
| 100 | + |
| 101 | +## DeleteRecordConfig |
| 102 | + |
| 103 | +### Properties |
| 104 | + |
| 105 | +| Property | Type | Required | Description | |
| 106 | +| :--- | :--- | :--- | :--- | |
| 107 | +| **objectName** | `string` | ✅ | Object to delete from | |
| 108 | +| **filter** | `Record<string, any>` | optional | Field/value pairs identifying the record(s) to delete | |
| 109 | + |
| 110 | + |
| 111 | +--- |
| 112 | + |
| 113 | +## GetRecordConfig |
| 114 | + |
| 115 | +### Properties |
| 116 | + |
| 117 | +| Property | Type | Required | Description | |
| 118 | +| :--- | :--- | :--- | :--- | |
| 119 | +| **objectName** | `string` | ✅ | Object to query | |
| 120 | +| **filter** | `Record<string, any>` | optional | Field/value pairs to match (operator values like `{"$ne": null}` are preserved) | |
| 121 | +| **fields** | `string[]` | optional | Field projection — only these fields are read (default: all) | |
| 122 | +| **limit** | `number` | optional | Max records to return; >1 switches to a multi-record query | |
| 123 | +| **outputVariable** | `string` | optional | Flow variable the result is bound to | |
| 124 | + |
| 125 | + |
| 126 | +--- |
| 127 | + |
| 128 | +## MapConfig |
| 129 | + |
| 130 | +### Properties |
| 131 | + |
| 132 | +| Property | Type | Required | Description | |
| 133 | +| :--- | :--- | :--- | :--- | |
| 134 | +| **collection** | `string \| any[]` | ✅ | Template/variable resolving to the array to process (an inline array is accepted) | |
| 135 | +| **flowName** | `string` | ✅ | Subflow run for each item — it may pause (e.g. an approval) | |
| 136 | +| **iteratorVariable** | `string` | ✅ | Variable holding the current item | |
| 137 | +| **indexVariable** | `string` | optional | Optional variable holding the current index | |
| 138 | +| **itemObject** | `string` | optional | When items are records, the object they belong to (exposes each item as the child's record) | |
| 139 | +| **input** | `Record<string, any>` | optional | Params passed to each item's subflow (interpolated per item) | |
| 140 | +| **outputVariable** | `string` | optional | Each item's subflow output, collected in order | |
| 141 | + |
| 142 | + |
| 143 | +--- |
| 144 | + |
| 145 | +## ScreenConfig |
| 146 | + |
| 147 | +### Properties |
| 148 | + |
| 149 | +| Property | Type | Required | Description | |
| 150 | +| :--- | :--- | :--- | :--- | |
| 151 | +| **title** | `string` | optional | Heading shown above the screen | |
| 152 | +| **description** | `string` | optional | Body text shown under the heading | |
| 153 | +| **fields** | `{ name: string; label?: string; type?: string; required?: boolean; … }[]` | optional | Input fields collected on this screen | |
| 154 | +| **waitForInput** | `boolean` | optional | Pause to show the screen even with no fields; false forces a server pass-through | |
| 155 | +| **objectName** | `string` | optional | Render this object's full create/edit form instead of a flat field list | |
| 156 | +| **idVariable** | `string` | optional | Object form only: variable bound to the saved record's id | |
| 157 | +| **mode** | `Enum<'create' \| 'edit'>` | optional | Object form only: create or edit | |
| 158 | +| **recordId** | `string` | optional | Object form only: id of the record to edit (required for mode: 'edit' to be useful) | |
| 159 | +| **defaults** | `Record<string, any>` | optional | Object form only: prefilled values | |
| 160 | + |
| 161 | + |
| 162 | +--- |
| 163 | + |
| 164 | +## ScreenFieldConfig |
| 165 | + |
| 166 | +### Properties |
| 167 | + |
| 168 | +| Property | Type | Required | Description | |
| 169 | +| :--- | :--- | :--- | :--- | |
| 170 | +| **name** | `string` | ✅ | Field name (the flow variable the value binds to) | |
| 171 | +| **label** | `string` | optional | Display label | |
| 172 | +| **type** | `string` | optional | Input type | |
| 173 | +| **required** | `boolean` | optional | Whether a value is required to submit | |
| 174 | +| **options** | `{ value: any; label: string }[]` | optional | Choices for a select-style field | |
| 175 | +| **defaultValue** | `any` | optional | Prefilled value (interpolates `{token}` templates) | |
| 176 | +| **placeholder** | `string` | optional | Input placeholder text | |
| 177 | +| **visibleWhen** | `string` | optional | CEL predicate controlling visibility, evaluated client-side | |
| 178 | + |
| 179 | + |
| 180 | +--- |
| 181 | + |
| 182 | +## UpdateRecordConfig |
| 183 | + |
| 184 | +### Properties |
| 185 | + |
| 186 | +| Property | Type | Required | Description | |
| 187 | +| :--- | :--- | :--- | :--- | |
| 188 | +| **objectName** | `string` | ✅ | Object to update | |
| 189 | +| **filter** | `Record<string, any>` | optional | Field/value pairs identifying the record(s) to update | |
| 190 | +| **fields** | `Record<string, any>` | optional | Field values to write | |
| 191 | + |
| 192 | + |
| 193 | +--- |
| 194 | + |
0 commit comments