primitive-admin 1.1.0-alpha.44 → 1.1.0-alpha.46
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/dist/bin/primitive.js +2 -0
- package/dist/bin/primitive.js.map +1 -1
- package/dist/src/commands/blob-buckets.js +20 -7
- package/dist/src/commands/blob-buckets.js.map +1 -1
- package/dist/src/commands/collections.js +11 -0
- package/dist/src/commands/collections.js.map +1 -1
- package/dist/src/commands/databases.js +34 -49
- package/dist/src/commands/databases.js.map +1 -1
- package/dist/src/commands/sync.js +116 -28
- 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/workflows.js +126 -20
- package/dist/src/commands/workflows.js.map +1 -1
- package/dist/src/lib/api-client.d.ts +10 -0
- package/dist/src/lib/api-client.js +19 -0
- package/dist/src/lib/api-client.js.map +1 -1
- 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/db-codegen/dbGenerator.d.ts +30 -5
- package/dist/src/lib/db-codegen/dbGenerator.js +227 -165
- package/dist/src/lib/db-codegen/dbGenerator.js.map +1 -1
- package/dist/src/lib/db-codegen/dbTemplates.d.ts +11 -23
- package/dist/src/lib/db-codegen/dbTemplates.js +21 -41
- 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 +15 -0
- package/dist/src/lib/generated-allowlist.js.map +1 -1
- package/dist/src/lib/toml-metadata-config.d.ts +10 -2
- package/dist/src/lib/toml-metadata-config.js +51 -15
- package/dist/src/lib/toml-metadata-config.js.map +1 -1
- 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/package.json +4 -2
|
@@ -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
|
+
{"version":3,"file":"naming.js","sourceRoot":"","sources":["../../../../src/lib/workflow-codegen/naming.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,2BA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,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
|
+
//# sourceMappingURL=schemaToTs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schemaToTs.js","sourceRoot":"","sources":["../../../../src/lib/workflow-codegen/schemaToTs.ts"],"names":[],"mappings":"A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AO,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"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "primitive-admin",
|
|
3
|
-
"version": "1.1.0-alpha.
|
|
3
|
+
"version": "1.1.0-alpha.46",
|
|
4
4
|
"description": "CLI for administering Primitive applications",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -20,7 +20,9 @@
|
|
|
20
20
|
"scripts": {
|
|
21
21
|
"gen:allowlist": "node scripts/gen-allowlist.mjs",
|
|
22
22
|
"gen:allowlist:check": "node scripts/gen-allowlist.mjs --check",
|
|
23
|
-
"
|
|
23
|
+
"gen:workflow-descriptor": "node scripts/gen-workflow-schema-descriptor.mjs",
|
|
24
|
+
"gen:workflow-descriptor:check": "node scripts/gen-workflow-schema-descriptor.mjs --check",
|
|
25
|
+
"prebuild": "node scripts/gen-allowlist.mjs && node scripts/gen-workflow-schema-descriptor.mjs",
|
|
24
26
|
"build": "tsc",
|
|
25
27
|
"typecheck": "tsc --noEmit",
|
|
26
28
|
"prepublishOnly": "pnpm run build",
|