primitive-admin 1.0.53 → 1.0.55

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.
Files changed (173) hide show
  1. package/README.md +38 -10
  2. package/dist/bin/primitive.js +8 -0
  3. package/dist/bin/primitive.js.map +1 -1
  4. package/dist/src/commands/apps.js +54 -2
  5. package/dist/src/commands/apps.js.map +1 -1
  6. package/dist/src/commands/auth.js +16 -6
  7. package/dist/src/commands/auth.js.map +1 -1
  8. package/dist/src/commands/blob-buckets.js +84 -7
  9. package/dist/src/commands/blob-buckets.js.map +1 -1
  10. package/dist/src/commands/catalog.js +3 -3
  11. package/dist/src/commands/catalog.js.map +1 -1
  12. package/dist/src/commands/collections.js +12 -9
  13. package/dist/src/commands/collections.js.map +1 -1
  14. package/dist/src/commands/databases.js +220 -82
  15. package/dist/src/commands/databases.js.map +1 -1
  16. package/dist/src/commands/documents.js +77 -0
  17. package/dist/src/commands/documents.js.map +1 -1
  18. package/dist/src/commands/group-type-configs.js +1 -9
  19. package/dist/src/commands/group-type-configs.js.map +1 -1
  20. package/dist/src/commands/groups.js +12 -6
  21. package/dist/src/commands/groups.js.map +1 -1
  22. package/dist/src/commands/guides.d.ts +161 -0
  23. package/dist/src/commands/guides.js +502 -84
  24. package/dist/src/commands/guides.js.map +1 -1
  25. package/dist/src/commands/integrations.js +2 -2
  26. package/dist/src/commands/integrations.js.map +1 -1
  27. package/dist/src/commands/metadata.d.ts +2 -0
  28. package/dist/src/commands/metadata.js +344 -0
  29. package/dist/src/commands/metadata.js.map +1 -0
  30. package/dist/src/commands/prompts.js +2 -2
  31. package/dist/src/commands/prompts.js.map +1 -1
  32. package/dist/src/commands/rule-sets.d.ts +1 -0
  33. package/dist/src/commands/rule-sets.js +25 -3
  34. package/dist/src/commands/rule-sets.js.map +1 -1
  35. package/dist/src/commands/scripts.d.ts +2 -0
  36. package/dist/src/commands/scripts.js +667 -0
  37. package/dist/src/commands/scripts.js.map +1 -0
  38. package/dist/src/commands/settings.d.ts +15 -0
  39. package/dist/src/commands/settings.js +102 -0
  40. package/dist/src/commands/settings.js.map +1 -0
  41. package/dist/src/commands/sync-app-settings.d.ts +105 -0
  42. package/dist/src/commands/sync-app-settings.js +339 -0
  43. package/dist/src/commands/sync-app-settings.js.map +1 -0
  44. package/dist/src/commands/sync.d.ts +204 -9
  45. package/dist/src/commands/sync.js +1706 -371
  46. package/dist/src/commands/sync.js.map +1 -1
  47. package/dist/src/commands/vars.d.ts +8 -0
  48. package/dist/src/commands/vars.js +110 -0
  49. package/dist/src/commands/vars.js.map +1 -0
  50. package/dist/src/commands/webhooks.js +17 -3
  51. package/dist/src/commands/webhooks.js.map +1 -1
  52. package/dist/src/commands/workflows.d.ts +30 -0
  53. package/dist/src/commands/workflows.js +667 -59
  54. package/dist/src/commands/workflows.js.map +1 -1
  55. package/dist/src/lib/api-client.d.ts +122 -18
  56. package/dist/src/lib/api-client.js +131 -2
  57. package/dist/src/lib/api-client.js.map +1 -1
  58. package/dist/src/lib/app-settings-descriptor.d.ts +108 -0
  59. package/dist/src/lib/app-settings-descriptor.js +250 -0
  60. package/dist/src/lib/app-settings-descriptor.js.map +1 -0
  61. package/dist/src/lib/batch.d.ts +26 -0
  62. package/dist/src/lib/batch.js +32 -0
  63. package/dist/src/lib/batch.js.map +1 -0
  64. package/dist/src/lib/block-layout.d.ts +160 -0
  65. package/dist/src/lib/block-layout.js +451 -0
  66. package/dist/src/lib/block-layout.js.map +1 -0
  67. package/dist/src/lib/codegen-shared/generatedFiles.d.ts +76 -0
  68. package/dist/src/lib/codegen-shared/generatedFiles.js +144 -0
  69. package/dist/src/lib/codegen-shared/generatedFiles.js.map +1 -0
  70. package/dist/src/lib/codegen-shared/resolveCodegenSourceDir.d.ts +68 -0
  71. package/dist/src/lib/codegen-shared/resolveCodegenSourceDir.js +168 -0
  72. package/dist/src/lib/codegen-shared/resolveCodegenSourceDir.js.map +1 -0
  73. package/dist/src/lib/config-toml.d.ts +10 -0
  74. package/dist/src/lib/config-toml.js +42 -0
  75. package/dist/src/lib/config-toml.js.map +1 -0
  76. package/dist/src/lib/config.d.ts +16 -0
  77. package/dist/src/lib/config.js +41 -0
  78. package/dist/src/lib/config.js.map +1 -1
  79. package/dist/src/lib/constants.d.ts +9 -0
  80. package/dist/src/lib/constants.js +9 -0
  81. package/dist/src/lib/constants.js.map +1 -1
  82. package/dist/src/lib/csv.d.ts +1 -2
  83. package/dist/src/lib/csv.js +3 -8
  84. package/dist/src/lib/csv.js.map +1 -1
  85. package/dist/src/lib/db-codegen/dbGenerator.d.ts +21 -65
  86. package/dist/src/lib/db-codegen/dbGenerator.js +117 -321
  87. package/dist/src/lib/db-codegen/dbGenerator.js.map +1 -1
  88. package/dist/src/lib/db-codegen/dbNaming.d.ts +37 -0
  89. package/dist/src/lib/db-codegen/dbNaming.js +70 -0
  90. package/dist/src/lib/db-codegen/dbNaming.js.map +1 -1
  91. package/dist/src/lib/db-codegen/dbTemplates.d.ts +165 -5
  92. package/dist/src/lib/db-codegen/dbTemplates.js +292 -16
  93. package/dist/src/lib/db-codegen/dbTemplates.js.map +1 -1
  94. package/dist/src/lib/db-codegen/dbTsTypes.d.ts +7 -3
  95. package/dist/src/lib/db-codegen/dbTsTypes.js +23 -1
  96. package/dist/src/lib/db-codegen/dbTsTypes.js.map +1 -1
  97. package/dist/src/lib/db-codegen/dbTypeIR.d.ts +146 -0
  98. package/dist/src/lib/db-codegen/dbTypeIR.js +517 -0
  99. package/dist/src/lib/db-codegen/dbTypeIR.js.map +1 -0
  100. package/dist/src/lib/db-codegen/generated-operation-def-descriptor.d.ts +101 -0
  101. package/dist/src/lib/db-codegen/generated-operation-def-descriptor.js +200 -0
  102. package/dist/src/lib/db-codegen/generated-operation-def-descriptor.js.map +1 -0
  103. package/dist/src/lib/generated-allowlist.js +43 -0
  104. package/dist/src/lib/generated-allowlist.js.map +1 -1
  105. package/dist/src/lib/init-config.js +2 -2
  106. package/dist/src/lib/init-config.js.map +1 -1
  107. package/dist/src/lib/output.d.ts +25 -5
  108. package/dist/src/lib/output.js +32 -4
  109. package/dist/src/lib/output.js.map +1 -1
  110. package/dist/src/lib/query-operators.d.ts +43 -0
  111. package/dist/src/lib/query-operators.js +80 -0
  112. package/dist/src/lib/query-operators.js.map +1 -0
  113. package/dist/src/lib/swift-codegen/dbGenerator.d.ts +68 -0
  114. package/dist/src/lib/swift-codegen/dbGenerator.js +380 -0
  115. package/dist/src/lib/swift-codegen/dbGenerator.js.map +1 -0
  116. package/dist/src/lib/swift-codegen/dbSwiftTypes.d.ts +42 -0
  117. package/dist/src/lib/swift-codegen/dbSwiftTypes.js +100 -0
  118. package/dist/src/lib/swift-codegen/dbSwiftTypes.js.map +1 -0
  119. package/dist/src/lib/swift-codegen/generator.d.ts +84 -0
  120. package/dist/src/lib/swift-codegen/generator.js +178 -0
  121. package/dist/src/lib/swift-codegen/generator.js.map +1 -0
  122. package/dist/src/lib/swift-codegen/schemaToSwift.d.ts +72 -0
  123. package/dist/src/lib/swift-codegen/schemaToSwift.js +644 -0
  124. package/dist/src/lib/swift-codegen/schemaToSwift.js.map +1 -0
  125. package/dist/src/lib/swift-codegen/swiftNaming.d.ts +85 -0
  126. package/dist/src/lib/swift-codegen/swiftNaming.js +198 -0
  127. package/dist/src/lib/swift-codegen/swiftNaming.js.map +1 -0
  128. package/dist/src/lib/sync-resource-types.d.ts +225 -0
  129. package/dist/src/lib/sync-resource-types.js +394 -0
  130. package/dist/src/lib/sync-resource-types.js.map +1 -0
  131. package/dist/src/lib/toml-database-config.d.ts +10 -19
  132. package/dist/src/lib/toml-database-config.js +28 -59
  133. package/dist/src/lib/toml-database-config.js.map +1 -1
  134. package/dist/src/lib/toml-metadata-config.d.ts +147 -0
  135. package/dist/src/lib/toml-metadata-config.js +463 -0
  136. package/dist/src/lib/toml-metadata-config.js.map +1 -0
  137. package/dist/src/lib/toml-native-form.d.ts +46 -0
  138. package/dist/src/lib/toml-native-form.js +78 -0
  139. package/dist/src/lib/toml-native-form.js.map +1 -0
  140. package/dist/src/lib/toml-params-validator.d.ts +34 -0
  141. package/dist/src/lib/toml-params-validator.js +118 -3
  142. package/dist/src/lib/toml-params-validator.js.map +1 -1
  143. package/dist/src/lib/workflow-apply.d.ts +86 -0
  144. package/dist/src/lib/workflow-apply.js +127 -0
  145. package/dist/src/lib/workflow-apply.js.map +1 -0
  146. package/dist/src/lib/workflow-codegen/generated-schema-descriptor.d.ts +129 -0
  147. package/dist/src/lib/workflow-codegen/generated-schema-descriptor.js +269 -0
  148. package/dist/src/lib/workflow-codegen/generated-schema-descriptor.js.map +1 -0
  149. package/dist/src/lib/workflow-codegen/generator.d.ts +87 -0
  150. package/dist/src/lib/workflow-codegen/generator.js +290 -0
  151. package/dist/src/lib/workflow-codegen/generator.js.map +1 -0
  152. package/dist/src/lib/workflow-codegen/invokerIR.d.ts +85 -0
  153. package/dist/src/lib/workflow-codegen/invokerIR.js +71 -0
  154. package/dist/src/lib/workflow-codegen/invokerIR.js.map +1 -0
  155. package/dist/src/lib/workflow-codegen/naming.d.ts +33 -0
  156. package/dist/src/lib/workflow-codegen/naming.js +81 -0
  157. package/dist/src/lib/workflow-codegen/naming.js.map +1 -0
  158. package/dist/src/lib/workflow-codegen/schemaToTs.d.ts +64 -0
  159. package/dist/src/lib/workflow-codegen/schemaToTs.js +282 -0
  160. package/dist/src/lib/workflow-codegen/schemaToTs.js.map +1 -0
  161. package/dist/src/lib/workflow-fragments.js +3 -3
  162. package/dist/src/lib/workflow-fragments.js.map +1 -1
  163. package/dist/src/lib/workflow-payload.d.ts +68 -0
  164. package/dist/src/lib/workflow-payload.js +150 -0
  165. package/dist/src/lib/workflow-payload.js.map +1 -0
  166. package/dist/src/lib/workflow-toml-validator.d.ts +1 -1
  167. package/dist/src/lib/workflow-toml-validator.js +37 -1
  168. package/dist/src/lib/workflow-toml-validator.js.map +1 -1
  169. package/dist/src/types/index.d.ts +11 -0
  170. package/dist/src/validators.d.ts +4 -3
  171. package/dist/src/validators.js +6 -5
  172. package/dist/src/validators.js.map +1 -1
  173. package/package.json +7 -3
@@ -0,0 +1,282 @@
1
+ /**
2
+ * JSON-Schema → TypeScript converter for `workflows codegen` (issue #1442).
3
+ *
4
+ * Workflow `inputSchema`/`outputSchema` are real JSON Schema. This converter
5
+ * types only the subset the server's validator descends into — and it reads
6
+ * that interpretation from the SAME descriptor the server validator consumes,
7
+ * vendored into the CLI as `generated-schema-descriptor.ts` (a byte copy of
8
+ * `src/workflows/schema-descriptor.ts`, kept fresh by
9
+ * `cli/scripts/gen-workflow-schema-descriptor.mjs` + its drift guard). So the
10
+ * generated type and the runtime validation can never disagree on:
11
+ *
12
+ * - `type` single scalar (`string`/`number`/`integer`/`boolean`/`null`) →
13
+ * the mapped TS scalar.
14
+ * - `type` array-union — only when every member is a scalar/`null` → a TS
15
+ * union. A union that contains `object` or `array` renders `unknown`,
16
+ * because the server only walks `properties`/`items` for the bare string
17
+ * `"object"`/`"array"` — a union is never descended, so a precise-looking
18
+ * type would over-promise.
19
+ * - `enum` → a scalar-literal union, intersected with the declared `type`
20
+ * first (the server gates on `type` before checking `enum`).
21
+ * - `type: "object"` with `properties` → a nested object type; `required[]`
22
+ * drives `name:` vs `name?:`. An OPEN object (no `additionalProperties:
23
+ * false`) also emits `[key: string]: unknown` so extra keys the runtime
24
+ * validator accepts don't hit TS excess-property errors; a CLOSED object
25
+ * (`additionalProperties: false`) omits the index signature.
26
+ * - `type: "array"` with `items` → `T[]`.
27
+ * - `oneOf` whose members are ALL `type: "object"` → a discriminated
28
+ * (tagged) union: the `|`-union of member object types, keyed by an
29
+ * auto-detected single-literal-`enum` discriminator (#1511). A defective
30
+ * all-object tagged union (no/ambiguous discriminator, <2 members) or an
31
+ * all-object `anyOf` (unsupported in v1) is a STRICT codegen error, not a
32
+ * silent `unknown` (Fork 3, resolved by the maintainer).
33
+ *
34
+ * Everything else the server ignores (`$ref`, `allOf`, `format`,
35
+ * `patternProperties`, numeric constraints, tuple `items`, and a `oneOf`/`anyOf`
36
+ * whose members are NOT all objects) renders `unknown`.
37
+ *
38
+ * Errors are NOT swallowed here — a malformed schema fails upstream at parse
39
+ * time, and a defective tagged union throws — this walker otherwise returns
40
+ * `unknown` for anything it does not recognize.
41
+ */
42
+ import { describeSchema, isType, } from "./generated-schema-descriptor.js";
43
+ /** Scalar JSON-schema types this converter maps to a concrete TS scalar. */
44
+ const SCALAR_TS = {
45
+ string: "string",
46
+ number: "number",
47
+ integer: "number",
48
+ boolean: "boolean",
49
+ null: "null",
50
+ };
51
+ /** A shared empty-object reference for the `{}`-rejection probe below. */
52
+ const EMPTY_OBJECT = Object.freeze({});
53
+ /**
54
+ * Render a scalar-literal union from an `enum` array. `JSON.stringify` emits a
55
+ * valid TS literal for a string, number, boolean, or `null`. An object/array
56
+ * member has no TS literal form, so the whole enum falls back to `unknown`
57
+ * (returns `null` here).
58
+ */
59
+ function tsUnionFromScalarEnum(values) {
60
+ if (!Array.isArray(values) || values.length === 0)
61
+ return null;
62
+ const literals = [];
63
+ const seen = new Set();
64
+ for (const v of values) {
65
+ if (v !== null && (typeof v === "object" || Array.isArray(v))) {
66
+ // Objects/arrays are not representable as TS literals.
67
+ return null;
68
+ }
69
+ const literal = JSON.stringify(v);
70
+ if (literal === undefined)
71
+ return null; // e.g. `undefined` in the enum
72
+ if (!seen.has(literal)) {
73
+ seen.add(literal);
74
+ literals.push(literal);
75
+ }
76
+ }
77
+ return literals.length > 0 ? literals.join(" | ") : null;
78
+ }
79
+ /** True when a rendered type is a bare identifier safe to suffix with `[]`. */
80
+ function isSimpleTypeExpr(expr) {
81
+ return /^[A-Za-z0-9_.]+(\[\])*$/.test(expr);
82
+ }
83
+ /**
84
+ * Convert a parsed JSON Schema node to a TypeScript type expression. Object
85
+ * types render multi-line (2-space indent per level); everything else renders
86
+ * on a single line. `indent` is the current indentation depth.
87
+ */
88
+ export function schemaToTsType(schema, indent = 0) {
89
+ const d = describeSchema(schema);
90
+ // `enum` is the most specific constraint — the server checks it AFTER the
91
+ // type gate, so when both are present only the enum members that satisfy the
92
+ // declared type(s) are reachable. Emit just those (intersect with `type`
93
+ // via the shared `isType`). If the type filter leaves nothing representable,
94
+ // fall through to plain `type` rendering rather than over-promising.
95
+ if (d.enumValues) {
96
+ const allowedTypes = d.types;
97
+ const candidates = allowedTypes.length > 0
98
+ ? d.enumValues.filter((v) => allowedTypes.some((t) => isType(v, t)))
99
+ : d.enumValues;
100
+ if (candidates.length === 0) {
101
+ // No enum member satisfies the declared type gate (or the enum is empty),
102
+ // so the runtime rejects EVERY value: the type gate lets some values
103
+ // through, then `enum.includes(value)` fails them all. The reachable set
104
+ // is empty → an uninhabitable `never`. Widening to the declared type here
105
+ // (e.g. `{type:"string", enum:[1]}` → `string`) would let typed callers
106
+ // pass values the server always rejects.
107
+ return "never";
108
+ }
109
+ const union = tsUnionFromScalarEnum(candidates);
110
+ if (union !== null)
111
+ return union;
112
+ // Candidates survive the type gate but aren't representable as TS literals
113
+ // (object/array enum members). With no declared type there is nothing to
114
+ // fall back on → `unknown`; otherwise fall through to plain `type`.
115
+ if (allowedTypes.length === 0)
116
+ return "unknown";
117
+ }
118
+ // Array-union type (e.g. `["string", "null"]`). Only scalar/null members get
119
+ // a precise union — the server never descends `properties`/`items` for a
120
+ // union, so an object/array member forces `unknown`.
121
+ if (d.isUnion) {
122
+ const parts = [];
123
+ const seen = new Set();
124
+ for (const t of d.types) {
125
+ const mapped = SCALAR_TS[t];
126
+ if (mapped === undefined)
127
+ return "unknown"; // object/array/unknown member
128
+ if (!seen.has(mapped)) {
129
+ seen.add(mapped);
130
+ parts.push(mapped);
131
+ }
132
+ }
133
+ return parts.length > 0 ? parts.join(" | ") : "unknown";
134
+ }
135
+ // Discriminated-union (`oneOf`) rendering (#1511). A qualifying tagged union
136
+ // has no top-level `type`, so this runs ahead of the `singularType === null`
137
+ // fallback. Render each member via the existing object rendering and join
138
+ // with `|` — the natural TS discriminated union TS narrows on. A defective
139
+ // all-object tagged union (`kind: "invalid"`) is a strict codegen error
140
+ // (Fork 3, resolved by the maintainer), not a silent `unknown`.
141
+ if (d.oneOf) {
142
+ if (d.oneOf.kind === "invalid") {
143
+ throw new Error(`workflows codegen: ${d.oneOf.reason}`);
144
+ }
145
+ const { discriminant } = d.oneOf;
146
+ const members = d.oneOf.members.map((m) => {
147
+ const md = describeSchema(m.schema);
148
+ // Every member is `type: "object"` with `properties`, so `md.object` is
149
+ // non-null — reuse the shared object rendering rather than reimplement it.
150
+ if (!md.object)
151
+ return schemaToTsType(m.schema, indent);
152
+ // The runtime validator always requires the discriminator present before
153
+ // it can select a branch — regardless of whether the member lists it in
154
+ // its own `required`. Force it required so the generated union can't
155
+ // compile a value that omits the tag (which the runtime rejects as
156
+ // "matches no case") (#1511).
157
+ const required = md.object.required.includes(discriminant)
158
+ ? md.object.required
159
+ : [...md.object.required, discriminant];
160
+ return renderObjectType({ ...md.object, required }, indent);
161
+ });
162
+ return members.join(" | ");
163
+ }
164
+ if (d.singularType === null) {
165
+ // No usable single type and no enum — the server enforces nothing.
166
+ return "unknown";
167
+ }
168
+ // Object: the server walks `properties`/`required` ONLY when the type is
169
+ // exactly `"object"`. `d.object` is non-null only in that case with declared
170
+ // properties; a typed object with no properties is open → Record.
171
+ if (d.singularType === "object") {
172
+ if (d.object)
173
+ return renderObjectType(d.object, indent);
174
+ return "Record<string, unknown>";
175
+ }
176
+ // Array: the server walks `items` ONLY when the type is exactly `"array"`.
177
+ if (d.singularType === "array") {
178
+ const items = d.array ? d.array.items : undefined;
179
+ // Missing or tuple `items` (an array of schemas) is ignored → unknown[].
180
+ if (!items || typeof items !== "object" || Array.isArray(items)) {
181
+ return "unknown[]";
182
+ }
183
+ const elem = schemaToTsType(items, indent);
184
+ return isSimpleTypeExpr(elem) ? `${elem}[]` : `(${elem})[]`;
185
+ }
186
+ // Single scalar type.
187
+ const scalar = SCALAR_TS[d.singularType];
188
+ return scalar ?? "unknown";
189
+ }
190
+ /**
191
+ * Render an object descriptor (`describeSchema(...).object`) as a TS object
192
+ * type. `required[]` drives optionality. An OPEN object (not
193
+ * `additionalProperties: false`) emits `[key: string]: unknown` so extra keys
194
+ * the runtime accepts don't trip TS excess-property checks; a CLOSED object
195
+ * omits it.
196
+ */
197
+ function renderObjectType(objectDesc, indent) {
198
+ const { properties, required, additionalPropertiesClosed } = objectDesc;
199
+ const propNames = Object.keys(properties);
200
+ const requiredSet = new Set(Array.isArray(required)
201
+ ? required.filter((k) => typeof k === "string")
202
+ : []);
203
+ const pad = " ".repeat(indent + 1);
204
+ const closePad = " ".repeat(indent);
205
+ const propNameSet = new Set(propNames);
206
+ const lines = ["{"];
207
+ for (const name of propNames) {
208
+ const childType = schemaToTsType(properties[name], indent + 1);
209
+ const optional = requiredSet.has(name) ? "" : "?";
210
+ lines.push(`${pad}${quotePropIfNeeded(name)}${optional}: ${childType};`);
211
+ }
212
+ // A key listed in `required` but absent from `properties` has no declared
213
+ // child schema, yet the validator still rejects an object missing it. Emit it
214
+ // as a required `unknown` member so the generated type demands the key too —
215
+ // otherwise `{properties:{}, required:["id"]}` would accept `{}`, which the
216
+ // runtime rejects.
217
+ for (const name of requiredSet) {
218
+ if (!propNameSet.has(name)) {
219
+ lines.push(`${pad}${quotePropIfNeeded(name)}: unknown;`);
220
+ }
221
+ }
222
+ // Open objects accept extra keys at runtime; model that with an index
223
+ // signature so a call site passing an unlisted key still compiles.
224
+ if (!additionalPropertiesClosed) {
225
+ lines.push(`${pad}[key: string]: unknown;`);
226
+ }
227
+ lines.push(`${closePad}}`);
228
+ return lines.join("\n");
229
+ }
230
+ /**
231
+ * Quote an object-property name when it is not a plain identifier (so keys with
232
+ * hyphens, dots, or other characters render as valid TS).
233
+ */
234
+ function quotePropIfNeeded(name) {
235
+ if (/^[A-Za-z_$][A-Za-z0-9_$]*$/.test(name))
236
+ return name;
237
+ return JSON.stringify(name);
238
+ }
239
+ /**
240
+ * True when the schema REJECTS an empty object `{}` — i.e. the client's
241
+ * `rootInput: options.input ?? {}` fallback would fail validation, so `input`
242
+ * must be a compile-time-required option (issue #1442, P4). Derived from the
243
+ * shared descriptor so it matches the server validator exactly:
244
+ *
245
+ * - a valid top-level discriminated-union (`oneOf`): the runtime always
246
+ * requires the discriminator present, so `{}` matches no case;
247
+ * - a declared top-level `type` that `{}` does not satisfy (anything but
248
+ * `object`, e.g. `string`/`array`, or a union with no `object` arm);
249
+ * - a top-level `enum` (a fresh `{}` is never an enum member);
250
+ * - `type: "object"` with a non-empty `required[]` (a missing required key).
251
+ *
252
+ * An all-optional object schema, or a schema with no top-level constraints,
253
+ * accepts `{}` → `input` is optional.
254
+ */
255
+ export function schemaRejectsEmptyObject(schema) {
256
+ const d = describeSchema(schema);
257
+ // 0. A valid discriminated-union (`oneOf`) always requires the discriminator
258
+ // present before the runtime can select a branch, so a fresh `{}` (the
259
+ // client's `input ?? {}` fallback) matches no case and is rejected. The
260
+ // generated `input` must therefore be required, not optional (#1511).
261
+ if (d.oneOf && d.oneOf.kind === "valid") {
262
+ return true;
263
+ }
264
+ // 1. Type gate: `{}` must satisfy at least one declared type.
265
+ if (d.types.length && !d.types.some((t) => isType(EMPTY_OBJECT, t))) {
266
+ return true;
267
+ }
268
+ // 2. Enum gate: a JSON enum never contains a value reference-equal to `{}`,
269
+ // so any enum rejects it (mirrors `enum.includes(value)` at runtime).
270
+ if (d.enumValues && !d.enumValues.includes(EMPTY_OBJECT)) {
271
+ return true;
272
+ }
273
+ // 3. Object required: any required key is absent from `{}`.
274
+ if (d.object) {
275
+ for (const key of d.object.required) {
276
+ if (!(key in EMPTY_OBJECT))
277
+ return true;
278
+ }
279
+ }
280
+ return false;
281
+ }
282
+ //# sourceMappingURL=schemaToTs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schemaToTs.js","sourceRoot":"","sources":["../../../../src/lib/workflow-codegen/schemaToTs.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AAEH,OAAO,EACL,cAAc,EACd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AI,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAM,EAAE,EAAE,CAAC,MAAM,CAAC,YAAY,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QACzE,OAAO,IAAI,CAAC;IACd,CAAC;IACD,4EAA4E;IAC5E,yEAAyE;IACzE,IAAI,CAAC,CAAC,UAAU,IAAI,CAAC,CAAC,CAAC,UAAU,CAAC,QAAQ,CAAC,YAAY,CAAC,EAAE,CAAC;QACzD,OAAO,IAAI,CAAC;IACd,CAAC;IACD,4DAA4D;IAC5D,IAAI,CAAC,CAAC,MAAM,EAAE,CAAC;QACb,KAAK,MAAM,GAAG,IAAI,CAAC,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC;YACpC,IAAI,CAAC,CAAC,GAAG,IAAI,YAAY,CAAC;gBAAE,OAAO,IAAI,CAAC;QAC1C,CAAC;IACH,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC"}
@@ -22,7 +22,7 @@
22
22
  */
23
23
  import { existsSync, readFileSync } from "fs";
24
24
  import { dirname, join, basename } from "path";
25
- import * as TOML from "@iarna/toml";
25
+ import { parseConfigToml } from "./config-toml.js";
26
26
  /**
27
27
  * Read and expand a workflow TOML file from disk. Returns the parsed
28
28
  * TOML with all `include` fragments spliced in. If the file has no
@@ -30,7 +30,7 @@ import * as TOML from "@iarna/toml";
30
30
  */
31
31
  export function expandWorkflow(workflowPath) {
32
32
  const content = readFileSync(workflowPath, "utf-8");
33
- const parsed = TOML.parse(content);
33
+ const parsed = parseConfigToml(content);
34
34
  return expandWorkflowTomlData(parsed, workflowPath);
35
35
  }
36
36
  /**
@@ -87,7 +87,7 @@ function readFragmentSafely(fragmentPath, workflowPath, fragmentName) {
87
87
  let parsed;
88
88
  try {
89
89
  const content = readFileSync(fragmentPath, "utf-8");
90
- parsed = TOML.parse(content);
90
+ parsed = parseConfigToml(content);
91
91
  }
92
92
  catch (err) {
93
93
  throw new Error(`Failed to parse fragment '${fragmentName}' at '${fragmentPath}': ${err?.message ?? err}`);
@@ -1 +1 @@
1
- {"version":3,"file":"workflow-fragments.js","sourceRoot":"","sources":["../../../src/lib/workflow-fragments.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,IAAI,CAAC;AAC9C,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,MAAM,CAAC;AAC/C,OAAO,KAAK,IAAI,MAAM,aAAa,CAAC;AASpC;;;;GAIG;AACH,MAAM,UAAU,cAAc,CAAC,YAAoB;IACjD,MAAM,OAAO,GAAG,YAAY,CAAC,YAAY,EAAE,OAAO,CAAC,CAAC;IACpD,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,CAAwB,CAAC;IAC1D,OAAO,sBAAsB,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC;AACtD,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,sBAAsB,CACpC,MAA2B,EAC3B,YAAoB;IAEpB,sEAAsE;IACtE,sEAAsE;IACtE,0DAA0D;IAC1D,IAAI,CAAC,CAAC,SAAS,IAAI,MAAM,CAAC,EAAE,CAAC;QAC3B,OAAO,MAA0B,CAAC;IACpC,CAAC;IAED,MAAM,WAAW,GAAG,MAAM,CAAC,OAAO,CAAC;IACnC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,WAAW,CAAC,EAAE,CAAC;QAChC,MAAM,IAAI,KAAK,CACb,aAAa,YAAY,qFAAqF,CAC/G,CAAC;IACJ,CAAC;IAED,uEAAuE;IACvE,8CAA8C;IAC9C,0DAA0D;IAC1D,MAAM,YAAY,GAAG,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,EAAE,IAAI,EAAE,oBAAoB,CAAC,CAAC;IAE7E,MAAM,gBAAgB,GAAG,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC;QAClD,CAAC,CAA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,CAAC,EAAE,CAAC;IACP,OAAO,EAAE,KAAK,EAAE,CAAC;AACnB,CAAC;AAED,SAAS,mBAAmB,CAC1B,UAAgE,EAChE,YAAoB;IAEpB,MAAM,IAAI,GAAG,IAAI,GAAG,EAAkB,CAAC;IACvC,KAAK,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,UAAU,EAAE,CAAC;QAC1C,MAAM,EAAE,GAAG,IAAI,EAAE,EAAE,CAAC;QACpB,IAAI,EAAE,KAAK,SAAS,IAAI,EAAE,KAAK,IAAI;YAAE,SAAS,CAAC,iDAAiD;QAChG,IAAI,OAAO,EAAE,KAAK,QAAQ;YAAE,SAAS;QACrC,IAAI,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,CAAC;YACjB,MAAM,WAAW,GAAG,IAAI,CAAC,GAAG,CAAC,EAAE,CAAE,CAAC;YAClC,MAAM,IAAI,KAAK,CACb,YAAY,EAAE,4CAA4C,YAAY,eAAe,WAAW,aAAa,MAAM,GAAG,CACvH,CAAC;QACJ,CAAC;QACD,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,MAAM,CAAC,CAAC;IACvB,CAAC;AACH,CAAC"}
@@ -0,0 +1,68 @@
1
+ /**
2
+ * Shared TOML → workflow-payload builder (#1177).
3
+ *
4
+ * Background: the CLI built the create/update workflow payload in THREE
5
+ * separate hand-enumerated literals — `workflows create --from-file`
6
+ * (`cli/src/commands/workflows.ts`), the `sync push` create branch
7
+ * (`cli/src/commands/sync.ts`), and the `sync push` update branch (the metadata
8
+ * PATCH in `cli/src/lib/workflow-apply.ts`). Because each site listed the
9
+ * `[workflow]` fields by hand, they drifted apart: a field added to one path was
10
+ * silently dropped by the others. `status` was the 4th field lost this way
11
+ * (after `syncCallable` #807, `accessRule` #571, `runAs` #1081); the audit also
12
+ * found `capabilities` (#1172) and `perAppMaxRunning` / `perAppMaxQueued` /
13
+ * `queueTtlSeconds` dropped from at least one path.
14
+ *
15
+ * The fix: one shared builder that owns the `[workflow]`-derived field list.
16
+ * All three call-sites spread its output; only the per-field presence coalescing
17
+ * and the create-only `syncCallable` inclusion differ by `mode`, so the field
18
+ * list itself lives in exactly one place and can't drift again. A unit
19
+ * drift-guard asserts the builder's key set (see
20
+ * `cli/tests/unit/workflow-payload-fields.test.ts`).
21
+ *
22
+ * What the builder does NOT own (structural / call-site-specific wiring the
23
+ * callers still attach): `workflowKey`, `steps`, and the `metadataManifest`
24
+ * declared-access manifest (#1304) — the sync paths always attach it, create
25
+ * --from-file never does.
26
+ *
27
+ * Presence semantics, by mode:
28
+ * - create: optional strings coalesce absent/empty → `undefined` (omit; the
29
+ * server default applies). `capabilities` forwards the raw array (absent →
30
+ * omit). Schemas omit when absent.
31
+ * - update: optional strings distinguish explicit-clear from leave-unset via
32
+ * `x !== undefined ? (x || null) : undefined`. `status` forwards the bare
33
+ * value (matching the server's hasOwnProperty path). Schemas send `null`
34
+ * when absent so a cleared schema round-trips.
35
+ * - booleans (`requiresClientApply`, and `syncCallable` on create) are raw
36
+ * pass-through so an explicit `false` is preserved and only a truly-absent
37
+ * key drops.
38
+ * - `syncCallable` is OMITTED in `mode: "update"`: the server re-validates
39
+ * `syncCallable: true` against the CURRENTLY-active steps, so the update
40
+ * path must send it as a deferred second PATCH after the new steps are live
41
+ * (#807). `applyWorkflowBody` owns that second PATCH.
42
+ */
43
+ export type WorkflowPayloadMode = "create" | "update";
44
+ /**
45
+ * Parse a JSON schema field that TOML may present as a string OR (for an inline
46
+ * table) as an already-parsed object. Kept here in `cli/src/lib` so the builder
47
+ * owns its own parse decision rather than importing back into a command module
48
+ * (#1177 dependency-direction decision).
49
+ */
50
+ export declare function safeJsonParse(value: any): any;
51
+ /**
52
+ * The `[workflow]`-derived keys the builder emits, per mode. Exported so the
53
+ * drift-guard unit test can assert the key set hasn't silently lost a field —
54
+ * the recurring bug class this builder closes. `update` omits `syncCallable`
55
+ * (deferred second PATCH, #807); everything else is shared.
56
+ */
57
+ export declare const WORKFLOW_PAYLOAD_FIELDS_CREATE: readonly ["name", "description", "status", "accessRule", "runAs", "capabilities", "perUserMaxRunning", "perUserMaxQueued", "perAppMaxRunning", "perAppMaxQueued", "queueTtlSeconds", "dequeueOrder", "requiresClientApply", "inputSchema", "outputSchema", "syncCallable"];
58
+ export declare const WORKFLOW_PAYLOAD_FIELDS_UPDATE: ReadonlyArray<string>;
59
+ /**
60
+ * Build the workflow payload's `[workflow]`-derived fields from a parsed TOML
61
+ * `[workflow]` table. `workflow` is `tomlData.workflow` (already merged with any
62
+ * explicit CLI flag overrides by the caller). Callers spread the result into
63
+ * the create/update payload and attach the structural fields themselves
64
+ * (`workflowKey`, `steps`, `metadataManifest`).
65
+ */
66
+ export declare function buildWorkflowPayloadFromToml(workflow: any, { mode }: {
67
+ mode: WorkflowPayloadMode;
68
+ }): Record<string, any>;
@@ -0,0 +1,150 @@
1
+ /**
2
+ * Shared TOML → workflow-payload builder (#1177).
3
+ *
4
+ * Background: the CLI built the create/update workflow payload in THREE
5
+ * separate hand-enumerated literals — `workflows create --from-file`
6
+ * (`cli/src/commands/workflows.ts`), the `sync push` create branch
7
+ * (`cli/src/commands/sync.ts`), and the `sync push` update branch (the metadata
8
+ * PATCH in `cli/src/lib/workflow-apply.ts`). Because each site listed the
9
+ * `[workflow]` fields by hand, they drifted apart: a field added to one path was
10
+ * silently dropped by the others. `status` was the 4th field lost this way
11
+ * (after `syncCallable` #807, `accessRule` #571, `runAs` #1081); the audit also
12
+ * found `capabilities` (#1172) and `perAppMaxRunning` / `perAppMaxQueued` /
13
+ * `queueTtlSeconds` dropped from at least one path.
14
+ *
15
+ * The fix: one shared builder that owns the `[workflow]`-derived field list.
16
+ * All three call-sites spread its output; only the per-field presence coalescing
17
+ * and the create-only `syncCallable` inclusion differ by `mode`, so the field
18
+ * list itself lives in exactly one place and can't drift again. A unit
19
+ * drift-guard asserts the builder's key set (see
20
+ * `cli/tests/unit/workflow-payload-fields.test.ts`).
21
+ *
22
+ * What the builder does NOT own (structural / call-site-specific wiring the
23
+ * callers still attach): `workflowKey`, `steps`, and the `metadataManifest`
24
+ * declared-access manifest (#1304) — the sync paths always attach it, create
25
+ * --from-file never does.
26
+ *
27
+ * Presence semantics, by mode:
28
+ * - create: optional strings coalesce absent/empty → `undefined` (omit; the
29
+ * server default applies). `capabilities` forwards the raw array (absent →
30
+ * omit). Schemas omit when absent.
31
+ * - update: optional strings distinguish explicit-clear from leave-unset via
32
+ * `x !== undefined ? (x || null) : undefined`. `status` forwards the bare
33
+ * value (matching the server's hasOwnProperty path). Schemas send `null`
34
+ * when absent so a cleared schema round-trips.
35
+ * - booleans (`requiresClientApply`, and `syncCallable` on create) are raw
36
+ * pass-through so an explicit `false` is preserved and only a truly-absent
37
+ * key drops.
38
+ * - `syncCallable` is OMITTED in `mode: "update"`: the server re-validates
39
+ * `syncCallable: true` against the CURRENTLY-active steps, so the update
40
+ * path must send it as a deferred second PATCH after the new steps are live
41
+ * (#807). `applyWorkflowBody` owns that second PATCH.
42
+ */
43
+ /**
44
+ * Parse a JSON schema field that TOML may present as a string OR (for an inline
45
+ * table) as an already-parsed object. Kept here in `cli/src/lib` so the builder
46
+ * owns its own parse decision rather than importing back into a command module
47
+ * (#1177 dependency-direction decision).
48
+ */
49
+ export function safeJsonParse(value) {
50
+ if (value === undefined || value === null)
51
+ return undefined;
52
+ if (typeof value === "string")
53
+ return JSON.parse(value);
54
+ return value; // Already an object (TOML parsed it as a table)
55
+ }
56
+ /**
57
+ * The `[workflow]`-derived keys the builder emits, per mode. Exported so the
58
+ * drift-guard unit test can assert the key set hasn't silently lost a field —
59
+ * the recurring bug class this builder closes. `update` omits `syncCallable`
60
+ * (deferred second PATCH, #807); everything else is shared.
61
+ */
62
+ export const WORKFLOW_PAYLOAD_FIELDS_CREATE = [
63
+ "name",
64
+ "description",
65
+ "status",
66
+ "accessRule",
67
+ "runAs",
68
+ "capabilities",
69
+ "perUserMaxRunning",
70
+ "perUserMaxQueued",
71
+ "perAppMaxRunning",
72
+ "perAppMaxQueued",
73
+ "queueTtlSeconds",
74
+ "dequeueOrder",
75
+ "requiresClientApply",
76
+ "inputSchema",
77
+ "outputSchema",
78
+ "syncCallable",
79
+ ];
80
+ export const WORKFLOW_PAYLOAD_FIELDS_UPDATE = WORKFLOW_PAYLOAD_FIELDS_CREATE.filter((f) => f !== "syncCallable");
81
+ /**
82
+ * Build the workflow payload's `[workflow]`-derived fields from a parsed TOML
83
+ * `[workflow]` table. `workflow` is `tomlData.workflow` (already merged with any
84
+ * explicit CLI flag overrides by the caller). Callers spread the result into
85
+ * the create/update payload and attach the structural fields themselves
86
+ * (`workflowKey`, `steps`, `metadataManifest`).
87
+ */
88
+ export function buildWorkflowPayloadFromToml(workflow, { mode }) {
89
+ const create = mode === "create";
90
+ const payload = {
91
+ name: workflow.name,
92
+ description: workflow.description,
93
+ // status — create coalesces absent/empty → omit (server default `draft`
94
+ // applies); update forwards the bare value so it round-trips and an
95
+ // explicit "" surfaces the server's validation error rather than a silent
96
+ // no-op (matches the pre-existing update path).
97
+ status: create ? workflow.status || undefined : workflow.status,
98
+ // accessRule / runAs — create coalesces absent/empty → omit; update
99
+ // distinguishes explicit clear ("" → null) from leave-unset (absent →
100
+ // undefined).
101
+ accessRule: create
102
+ ? workflow.accessRule || undefined
103
+ : workflow.accessRule !== undefined
104
+ ? workflow.accessRule || null
105
+ : undefined,
106
+ runAs: create
107
+ ? workflow.runAs || undefined
108
+ : workflow.runAs !== undefined
109
+ ? workflow.runAs || null
110
+ : undefined,
111
+ // capabilities — create forwards the raw array (absent → omit); update
112
+ // forwards presence-aware so an explicit array round-trips. (The server
113
+ // update PATCH persist for capabilities is tracked separately in #1232; the
114
+ // round-trip guard asserts capabilities on the create leg only.)
115
+ capabilities: create
116
+ ? workflow.capabilities
117
+ : workflow.capabilities !== undefined
118
+ ? workflow.capabilities
119
+ : undefined,
120
+ // Queue limits — raw numeric pass-through both modes (absent → omit).
121
+ perUserMaxRunning: workflow.perUserMaxRunning,
122
+ perUserMaxQueued: workflow.perUserMaxQueued,
123
+ perAppMaxRunning: workflow.perAppMaxRunning,
124
+ perAppMaxQueued: workflow.perAppMaxQueued,
125
+ queueTtlSeconds: workflow.queueTtlSeconds,
126
+ dequeueOrder: workflow.dequeueOrder,
127
+ // requiresClientApply — raw boolean pass-through so an explicit `false` is
128
+ // preserved and only a truly-absent key drops (server default applies).
129
+ requiresClientApply: workflow.requiresClientApply,
130
+ // Schemas — parse a JSON string (or accept an inline table). Create omits
131
+ // when absent; update sends null so a cleared schema round-trips.
132
+ inputSchema: workflow.inputSchema
133
+ ? safeJsonParse(workflow.inputSchema)
134
+ : create
135
+ ? undefined
136
+ : null,
137
+ outputSchema: workflow.outputSchema
138
+ ? safeJsonParse(workflow.outputSchema)
139
+ : create
140
+ ? undefined
141
+ : null,
142
+ };
143
+ // syncCallable — create includes it (raw boolean pass-through); update omits
144
+ // it (deferred second PATCH, #807 — see module doc).
145
+ if (create) {
146
+ payload.syncCallable = workflow.syncCallable;
147
+ }
148
+ return payload;
149
+ }
150
+ //# sourceMappingURL=workflow-payload.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"workflow-payload.js","sourceRoot":"","sources":["../../../src/lib/workflow-payload.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AAIH;;;;;GAKG;AACH,MAAM,UAAU,aAAa,CAAC,KAAU;IACtC,IAAI,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,IAAI;QAAE,OAAO,SAAS,CAAC;IAC5D,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IACxD,OAAO,KAAK,CAAC,CAAC,gDAAgD;AAChE,CAAC;AAED;;;;;GAKG;AACH,MAAM,CAAC,MAAM,8BAA8B,GAAG;IAC5C,MAAM;IACN,aAAa;IACb,QAAQ;IACR,YAAY;IACZ,OAAO;IACP,cAAc;IACd,mBAAmB;I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AQ,CAAC,YAAY,KAAK,SAAS;gBACnC,CAAC,CAAC,QAAQ,CAAC,YAAY;gBACvB,CAAC,CAAC,SAAS;QACf,sEAAsE;QACtE,iBAAiB,EAAE,QAAQ,CAAC,iBAAiB;QAC7C,gBAAgB,EAAE,QAAQ,CAAC,gBAAgB;QAC3C,gBAAgB,EAAE,QAAQ,CAAC,gBAAgB;QAC3C,eAAe,EAAE,QAAQ,CAAC,eAAe;QACzC,eAAe,EAAE,QAAQ,CAAC,eAAe;QACzC,YAAY,EAAE,QAAQ,CAAC,YAAY;QACnC,2EAA2E;QAC3E,wEAAwE;QACxE,mBAAmB,EAAE,QAAQ,CAAC,mBAAmB;QACjD,0EAA0E;QAC1E,kEAAkE;QAClE,WAAW,EAAE,QAAQ,CAAC,WAAW;YAC/B,CAAC,CAAC,aAAa,CAAC,QAAQ,CAAC,WAAW,CAAC;YACrC,CAAC,CAAC,MAAM;gBACN,CAAC,CAAC,SAAS;gBACX,CAAC,CAAC,IAAI;QACV,YAAY,EAAE,QAAQ,CAAC,YAAY;YACjC,CAAC,CAAC,aAAa,CAAC,QAAQ,CAAC,YAAY,CAAC;YACtC,CAAC,CAAC,MAAM;gBACN,CAAC,CAAC,SAAS;gBACX,CAAC,CAAC,IAAI;KACX,CAAC;IAEF,6EAA6E;IAC7E,qDAAqD;IACrD,IAAI,MAAM,EAAE,CAAC;QACX,OAAO,CAAC,YAAY,GAAG,QAAQ,CAAC,YAAY,CAAC;IAC/C,CAAC;IAED,OAAO,OAAO,CAAC;AACjB,CAAC"}
@@ -73,7 +73,7 @@ export type WorkflowTomlError = {
73
73
  /**
74
74
  * Walk a parsed workflow TOML document and return all unknown-field errors.
75
75
  *
76
- * @param tomlData The output of `TOML.parse()` for a workflow TOML file.
76
+ * @param tomlData The output of `parseConfigToml()` for a workflow TOML file.
77
77
  * @returns An array of error objects, one per offending field. Empty if no
78
78
  * errors were found.
79
79
  */
@@ -60,7 +60,7 @@ export const KNOWN_KINDS_FOR_DRIFT_GUARD = KNOWN_KINDS;
60
60
  /**
61
61
  * Walk a parsed workflow TOML document and return all unknown-field errors.
62
62
  *
63
- * @param tomlData The output of `TOML.parse()` for a workflow TOML file.
63
+ * @param tomlData The output of `parseConfigToml()` for a workflow TOML file.
64
64
  * @returns An array of error objects, one per offending field. Empty if no
65
65
  * errors were found.
66
66
  */
@@ -227,6 +227,42 @@ function validateStepObject(step, stepIndex, parentStepId, errors) {
227
227
  parentStepId,
228
228
  });
229
229
  }
230
+ // #1252 — form-urlencoded body conflict. `[steps.request.form]` encodes an
231
+ // `application/x-www-form-urlencoded` body; it cannot coexist with a
232
+ // `request.body` or a raw/multipart `bodyMode`. The runtime rejects the same
233
+ // combination, but catching it at push time gives a clearer, earlier
234
+ // diagnostic. (`request.form` itself needs no allowlist entry — the validator
235
+ // only checks top-level step fields, and `request` is already allowlisted.)
236
+ if (step.kind === "integration.call" &&
237
+ step.request !== null &&
238
+ typeof step.request === "object" &&
239
+ !Array.isArray(step.request)) {
240
+ const req = step.request;
241
+ const hasForm = req.form !== undefined && req.form !== null;
242
+ if (hasForm) {
243
+ if (req.body !== undefined && req.body !== null) {
244
+ errors.push({
245
+ stepIndex,
246
+ stepId,
247
+ field: "request.form",
248
+ hint: "`request.form` (application/x-www-form-urlencoded) cannot be combined with `request.body`. " +
249
+ "Use one request body — either the JSON `body` or the `form` table.",
250
+ parentStepId,
251
+ });
252
+ }
253
+ const mode = step.bodyMode;
254
+ if (mode === "raw" || mode === "multipart") {
255
+ errors.push({
256
+ stepIndex,
257
+ stepId,
258
+ field: "request.form",
259
+ hint: `\`request.form\` (application/x-www-form-urlencoded) cannot be combined with bodyMode "${mode}". ` +
260
+ "Remove `form` or the `bodyMode`.",
261
+ parentStepId,
262
+ });
263
+ }
264
+ }
265
+ }
230
266
  }
231
267
  /**
232
268
  * Render a multi-line diagnostic for a list of errors. Designed for the