primitive-admin 1.0.52 → 1.0.54
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 +38 -10
- package/dist/bin/primitive.js +6 -0
- package/dist/bin/primitive.js.map +1 -1
- package/dist/src/commands/auth.js +16 -6
- package/dist/src/commands/auth.js.map +1 -1
- package/dist/src/commands/blob-buckets.js +84 -7
- package/dist/src/commands/blob-buckets.js.map +1 -1
- package/dist/src/commands/catalog.js +3 -3
- package/dist/src/commands/catalog.js.map +1 -1
- package/dist/src/commands/collections.js +12 -9
- package/dist/src/commands/collections.js.map +1 -1
- package/dist/src/commands/database-types.js +11 -1
- package/dist/src/commands/database-types.js.map +1 -1
- package/dist/src/commands/databases.js +197 -74
- package/dist/src/commands/databases.js.map +1 -1
- package/dist/src/commands/group-type-configs.js +1 -9
- package/dist/src/commands/group-type-configs.js.map +1 -1
- package/dist/src/commands/groups.js +12 -6
- package/dist/src/commands/groups.js.map +1 -1
- package/dist/src/commands/guides.d.ts +161 -0
- package/dist/src/commands/guides.js +502 -84
- package/dist/src/commands/guides.js.map +1 -1
- package/dist/src/commands/init.js +77 -45
- package/dist/src/commands/init.js.map +1 -1
- package/dist/src/commands/integrations.js +2 -2
- package/dist/src/commands/integrations.js.map +1 -1
- package/dist/src/commands/metadata.d.ts +2 -0
- package/dist/src/commands/metadata.js +344 -0
- package/dist/src/commands/metadata.js.map +1 -0
- package/dist/src/commands/prompts.js +2 -2
- package/dist/src/commands/prompts.js.map +1 -1
- package/dist/src/commands/rule-sets.d.ts +1 -0
- package/dist/src/commands/rule-sets.js +25 -3
- package/dist/src/commands/rule-sets.js.map +1 -1
- package/dist/src/commands/scripts.d.ts +2 -0
- package/dist/src/commands/scripts.js +667 -0
- package/dist/src/commands/scripts.js.map +1 -0
- package/dist/src/commands/sync.d.ts +212 -16
- package/dist/src/commands/sync.js +1688 -287
- package/dist/src/commands/sync.js.map +1 -1
- package/dist/src/commands/vars.d.ts +8 -0
- package/dist/src/commands/vars.js +110 -0
- package/dist/src/commands/vars.js.map +1 -0
- package/dist/src/commands/webhooks.js +17 -3
- package/dist/src/commands/webhooks.js.map +1 -1
- package/dist/src/commands/workflows.d.ts +30 -0
- package/dist/src/commands/workflows.js +651 -52
- package/dist/src/commands/workflows.js.map +1 -1
- package/dist/src/lib/api-client.d.ts +123 -19
- package/dist/src/lib/api-client.js +128 -4
- package/dist/src/lib/api-client.js.map +1 -1
- package/dist/src/lib/batch.d.ts +26 -0
- package/dist/src/lib/batch.js +32 -0
- package/dist/src/lib/batch.js.map +1 -0
- package/dist/src/lib/block-layout.d.ts +160 -0
- package/dist/src/lib/block-layout.js +451 -0
- package/dist/src/lib/block-layout.js.map +1 -0
- package/dist/src/lib/codegen-shared/generatedFiles.d.ts +61 -0
- package/dist/src/lib/codegen-shared/generatedFiles.js +127 -0
- package/dist/src/lib/codegen-shared/generatedFiles.js.map +1 -0
- package/dist/src/lib/codegen-shared/resolveCodegenSourceDir.d.ts +68 -0
- package/dist/src/lib/codegen-shared/resolveCodegenSourceDir.js +168 -0
- package/dist/src/lib/codegen-shared/resolveCodegenSourceDir.js.map +1 -0
- package/dist/src/lib/config-toml.d.ts +10 -0
- package/dist/src/lib/config-toml.js +42 -0
- package/dist/src/lib/config-toml.js.map +1 -0
- package/dist/src/lib/config.d.ts +16 -0
- package/dist/src/lib/config.js +41 -0
- package/dist/src/lib/config.js.map +1 -1
- package/dist/src/lib/constants.d.ts +9 -0
- package/dist/src/lib/constants.js +9 -0
- package/dist/src/lib/constants.js.map +1 -1
- package/dist/src/lib/csv.d.ts +1 -2
- package/dist/src/lib/csv.js +3 -8
- package/dist/src/lib/csv.js.map +1 -1
- package/dist/src/lib/db-codegen/dbGenerator.d.ts +35 -7
- package/dist/src/lib/db-codegen/dbGenerator.js +384 -125
- package/dist/src/lib/db-codegen/dbGenerator.js.map +1 -1
- package/dist/src/lib/db-codegen/dbNaming.d.ts +29 -0
- package/dist/src/lib/db-codegen/dbNaming.js +58 -0
- package/dist/src/lib/db-codegen/dbNaming.js.map +1 -1
- package/dist/src/lib/db-codegen/dbTemplates.d.ts +114 -5
- package/dist/src/lib/db-codegen/dbTemplates.js +163 -16
- package/dist/src/lib/db-codegen/dbTemplates.js.map +1 -1
- package/dist/src/lib/db-codegen/dbTsTypes.d.ts +7 -3
- package/dist/src/lib/db-codegen/dbTsTypes.js +23 -1
- package/dist/src/lib/db-codegen/dbTsTypes.js.map +1 -1
- package/dist/src/lib/generated-allowlist.js +52 -0
- package/dist/src/lib/generated-allowlist.js.map +1 -1
- package/dist/src/lib/init-config.d.ts +13 -0
- package/dist/src/lib/init-config.js +21 -2
- package/dist/src/lib/init-config.js.map +1 -1
- package/dist/src/lib/output.d.ts +42 -5
- package/dist/src/lib/output.js +70 -4
- package/dist/src/lib/output.js.map +1 -1
- package/dist/src/lib/query-operators.d.ts +43 -0
- package/dist/src/lib/query-operators.js +80 -0
- package/dist/src/lib/query-operators.js.map +1 -0
- package/dist/src/lib/template.d.ts +9 -5
- package/dist/src/lib/template.js +58 -45
- package/dist/src/lib/template.js.map +1 -1
- package/dist/src/lib/toml-database-config.d.ts +10 -19
- package/dist/src/lib/toml-database-config.js +28 -59
- package/dist/src/lib/toml-database-config.js.map +1 -1
- package/dist/src/lib/toml-metadata-config.d.ts +147 -0
- package/dist/src/lib/toml-metadata-config.js +463 -0
- package/dist/src/lib/toml-metadata-config.js.map +1 -0
- package/dist/src/lib/toml-native-form.d.ts +46 -0
- package/dist/src/lib/toml-native-form.js +78 -0
- package/dist/src/lib/toml-native-form.js.map +1 -0
- package/dist/src/lib/toml-params-validator.d.ts +34 -0
- package/dist/src/lib/toml-params-validator.js +118 -3
- package/dist/src/lib/toml-params-validator.js.map +1 -1
- package/dist/src/lib/workflow-apply.d.ts +86 -0
- package/dist/src/lib/workflow-apply.js +127 -0
- package/dist/src/lib/workflow-apply.js.map +1 -0
- package/dist/src/lib/workflow-codegen/generated-schema-descriptor.d.ts +129 -0
- package/dist/src/lib/workflow-codegen/generated-schema-descriptor.js +269 -0
- package/dist/src/lib/workflow-codegen/generated-schema-descriptor.js.map +1 -0
- package/dist/src/lib/workflow-codegen/generator.d.ts +74 -0
- package/dist/src/lib/workflow-codegen/generator.js +215 -0
- package/dist/src/lib/workflow-codegen/generator.js.map +1 -0
- package/dist/src/lib/workflow-codegen/naming.d.ts +33 -0
- package/dist/src/lib/workflow-codegen/naming.js +81 -0
- package/dist/src/lib/workflow-codegen/naming.js.map +1 -0
- package/dist/src/lib/workflow-codegen/schemaToTs.d.ts +64 -0
- package/dist/src/lib/workflow-codegen/schemaToTs.js +282 -0
- package/dist/src/lib/workflow-codegen/schemaToTs.js.map +1 -0
- package/dist/src/lib/workflow-fragments.js +3 -3
- package/dist/src/lib/workflow-fragments.js.map +1 -1
- package/dist/src/lib/workflow-payload.d.ts +68 -0
- package/dist/src/lib/workflow-payload.js +150 -0
- package/dist/src/lib/workflow-payload.js.map +1 -0
- package/dist/src/lib/workflow-toml-validator.d.ts +1 -1
- package/dist/src/lib/workflow-toml-validator.js +37 -1
- package/dist/src/lib/workflow-toml-validator.js.map +1 -1
- package/dist/src/types/index.d.ts +11 -0
- package/dist/src/validators.d.ts +4 -3
- package/dist/src/validators.js +6 -5
- package/dist/src/validators.js.map +1 -1
- package/package.json +5 -3
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Identifier-naming helpers for `workflows codegen` (issue #1442).
|
|
3
|
+
*
|
|
4
|
+
* Workflow keys resolve case-insensitively server-side and may contain
|
|
5
|
+
* characters that aren't valid TS identifiers (`.`, `-`). Only the emitted
|
|
6
|
+
* identifiers are sanitized — the runtime call always passes the ORIGINAL key
|
|
7
|
+
* string.
|
|
8
|
+
*
|
|
9
|
+
* Type names: `pascalCase(key) + "Input" | "Output"` (reuses `pascalCase` from
|
|
10
|
+
* the database codegen so the two commands share one PascalCase rule).
|
|
11
|
+
* Factory property: a camelCase form of the key.
|
|
12
|
+
*/
|
|
13
|
+
import { pascalCase } from "../db-codegen/dbNaming.js";
|
|
14
|
+
/**
|
|
15
|
+
* Ensure an identifier is a valid TS identifier start. The server accepts
|
|
16
|
+
* workflow keys matching `^[a-z0-9][a-z0-9-_]{2,}$`, so a digit-leading key
|
|
17
|
+
* like `123-job` PascalCases to `123Job` — not a legal TS type name or
|
|
18
|
+
* unquoted object property, since identifiers can't start with a digit.
|
|
19
|
+
* Prefix an underscore in that case (`123Job` → `_123Job`). Only the emitted
|
|
20
|
+
* identifier changes; the runtime call still passes the ORIGINAL key string.
|
|
21
|
+
*/
|
|
22
|
+
function ensureValidIdentifierStart(name) {
|
|
23
|
+
const first = name.charAt(0);
|
|
24
|
+
if (first >= "0" && first <= "9") {
|
|
25
|
+
return `_${name}`;
|
|
26
|
+
}
|
|
27
|
+
return name;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* `create-checkout-session` / `createCheckoutSession` → `CreateCheckoutSession`.
|
|
31
|
+
* A digit-leading key (`123-job` → `_123Job`) is prefixed with `_` so the
|
|
32
|
+
* emitted type name is a valid TS identifier.
|
|
33
|
+
*/
|
|
34
|
+
export function workflowTypeBaseName(key) {
|
|
35
|
+
return ensureValidIdentifierStart(pascalCase(key));
|
|
36
|
+
}
|
|
37
|
+
/** PascalCase base + `Input` (e.g. `CreateCheckoutSessionInput`). */
|
|
38
|
+
export function workflowInputTypeName(key) {
|
|
39
|
+
return `${workflowTypeBaseName(key)}Input`;
|
|
40
|
+
}
|
|
41
|
+
/** PascalCase base + `Output` (e.g. `CreateCheckoutSessionOutput`). */
|
|
42
|
+
export function workflowOutputTypeName(key) {
|
|
43
|
+
return `${workflowTypeBaseName(key)}Output`;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Reserved words that cannot be used as a bare `function <name>` declaration.
|
|
47
|
+
* The per-workflow factory is now a top-level exported function (not an
|
|
48
|
+
* object-literal property), so a key that camelCases to one of these must be
|
|
49
|
+
* escaped or `export function delete(client) {}` is a syntax error. Covers ES
|
|
50
|
+
* reserved words plus the strict-mode/future set — a workflow key resolves case
|
|
51
|
+
* -insensitively and matches `^[a-z0-9][a-z0-9-_]{2,}$`, so only the lowercase
|
|
52
|
+
* single-word forms can actually collide.
|
|
53
|
+
*/
|
|
54
|
+
const RESERVED_WORDS = new Set([
|
|
55
|
+
"break", "case", "catch", "class", "const", "continue", "debugger",
|
|
56
|
+
"default", "delete", "do", "else", "enum", "export", "extends", "false",
|
|
57
|
+
"finally", "for", "function", "if", "import", "in", "instanceof", "new",
|
|
58
|
+
"null", "return", "super", "switch", "this", "throw", "true", "try",
|
|
59
|
+
"typeof", "var", "void", "while", "with", "yield", "let", "static",
|
|
60
|
+
"implements", "interface", "package", "private", "protected", "public",
|
|
61
|
+
"await",
|
|
62
|
+
]);
|
|
63
|
+
/**
|
|
64
|
+
* camelCase factory function name for a workflow key: PascalCase, then lowercase
|
|
65
|
+
* the first character (`create-checkout-session` → `createCheckoutSession`,
|
|
66
|
+
* `refresh-sheet` → `refreshSheet`). Used as the top-level exported factory
|
|
67
|
+
* function name in the per-workflow generated file, so it must be a legal
|
|
68
|
+
* function identifier: a digit-leading key (`123-job` → `_123Job`) is
|
|
69
|
+
* underscore-prefixed, and a key that lands on a JS reserved word (`delete`,
|
|
70
|
+
* `new`, `import`) is underscore-suffixed (`delete_`). Only the emitted
|
|
71
|
+
* identifier changes; the runtime call still passes the ORIGINAL key string.
|
|
72
|
+
*/
|
|
73
|
+
export function workflowFactoryName(key) {
|
|
74
|
+
const pascal = pascalCase(key);
|
|
75
|
+
if (pascal.length === 0)
|
|
76
|
+
return pascal;
|
|
77
|
+
const camel = pascal.charAt(0).toLowerCase() + pascal.slice(1);
|
|
78
|
+
const safeStart = ensureValidIdentifierStart(camel);
|
|
79
|
+
return RESERVED_WORDS.has(safeStart) ? `${safeStart}_` : safeStart;
|
|
80
|
+
}
|
|
81
|
+
//# sourceMappingURL=naming.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+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;IACnE,QAAQ,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,QAAQ;IAClE,YAAY,EAAE,WAAW,EAAE,SAAS,EAAE,SAAS,EAAE,WAAW,EAAE,QAAQ;IACtE,OAAO;CACR,CAAC,CAAC;AAEH;;;;;;;;;GASG;AACH,MAAM,UAAU,mBAAmB,CAAC,GAAW;IAC7C,MAAM,MAAM,GAAG,UAAU,CAAC,GAAG,CAAC,CAAC;IAC/B,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,MAAM,CAAC;IACvC,MAAM,KAAK,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IAC/D,MAAM,SAAS,GAAG,0BAA0B,CAAC,KAAK,CAAC,CAAC;IACpD,OAAO,cAAc,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,GAAG,SAAS,GAAG,CAAC,CAAC,CAAC,SAAS,CAAC;AACrE,CAAC"}
|
|
@@ -0,0 +1,64 @@
|
|
|
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
|
+
/**
|
|
43
|
+
* Convert a parsed JSON Schema node to a TypeScript type expression. Object
|
|
44
|
+
* types render multi-line (2-space indent per level); everything else renders
|
|
45
|
+
* on a single line. `indent` is the current indentation depth.
|
|
46
|
+
*/
|
|
47
|
+
export declare function schemaToTsType(schema: any, indent?: number): string;
|
|
48
|
+
/**
|
|
49
|
+
* True when the schema REJECTS an empty object `{}` — i.e. the client's
|
|
50
|
+
* `rootInput: options.input ?? {}` fallback would fail validation, so `input`
|
|
51
|
+
* must be a compile-time-required option (issue #1442, P4). Derived from the
|
|
52
|
+
* shared descriptor so it matches the server validator exactly:
|
|
53
|
+
*
|
|
54
|
+
* - a valid top-level discriminated-union (`oneOf`): the runtime always
|
|
55
|
+
* requires the discriminator present, so `{}` matches no case;
|
|
56
|
+
* - a declared top-level `type` that `{}` does not satisfy (anything but
|
|
57
|
+
* `object`, e.g. `string`/`array`, or a union with no `object` arm);
|
|
58
|
+
* - a top-level `enum` (a fresh `{}` is never an enum member);
|
|
59
|
+
* - `type: "object"` with a non-empty `required[]` (a missing required key).
|
|
60
|
+
*
|
|
61
|
+
* An all-optional object schema, or a schema with no top-level constraints,
|
|
62
|
+
* accepts `{}` → `input` is optional.
|
|
63
|
+
*/
|
|
64
|
+
export declare function schemaRejectsEmptyObject(schema: any): boolean;
|
|
@@ -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
|
+
//# sourceMapp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E,0EAA0E;IAC1E,2EAA2E;IAC3E,yEAAyE;IACzE,IAAI,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,KAAK,CAAC,IAAI,KAAK,OAAO,EAAE,CAAC;QACxC,OAAO,IAAI,CAAC;IACd,CAAC;IAED,8DAA8D;IAC9D,IAAI,CAAC,CAAC,KAAK,CAAC,MAAM,IAAI,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
|
|
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 =
|
|
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 =
|
|
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,
|
|
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,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AASnD;;;;GAIG;AACH,MAAM,UAAU,cAAc,CAAC,YAAoB;IACjD,MAAM,OAAO,GAAG,YAAY,CAAC,YAAY,EAAE,OAAO,CAAC,CAAC;IACpD,MAAM,MAAM,GAAG,eAAe,CAAC,OAAO,CAAwB,CAAC;IAC/D,OAAO,sBAAsB,CAAC,MAAM,EAAE,YAAY,CAAC,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AAa,YAAY,SAAS,YAAY,8HAA8H,CAC7K,CAAC;IACJ,CAAC;IACD,IAAI,UAAU,IAAI,MAAM,EAAE,CAAC;QACzB,MAAM,IAAI,KAAK,CACb,aAAa,YAAY,SAAS,YAAY,6EAA6E,CAC5H,CAAC;IACJ,CAAC;IAED,MAAM,KAAK,GAAG,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC;QACvC,CAAC,CAAE,MAAM,CAAC,KAAoC;QAC9C,CAAC,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>;
|