primitive-admin 1.1.0-alpha.43 → 1.1.0-alpha.45
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 +2 -2
- package/dist/bin/primitive.js +0 -0
- package/dist/src/commands/blob-buckets.js +20 -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/databases.js +3 -3
- package/dist/src/commands/databases.js.map +1 -1
- package/dist/src/commands/guides.d.ts +86 -0
- package/dist/src/commands/guides.js +222 -41
- package/dist/src/commands/guides.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/prompts.js +2 -2
- package/dist/src/commands/prompts.js.map +1 -1
- package/dist/src/commands/sync.d.ts +23 -3
- package/dist/src/commands/sync.js +370 -121
- package/dist/src/commands/sync.js.map +1 -1
- package/dist/src/commands/workflows.js +191 -26
- package/dist/src/commands/workflows.js.map +1 -1
- package/dist/src/lib/api-client.d.ts +1 -0
- package/dist/src/lib/api-client.js +4 -0
- package/dist/src/lib/api-client.js.map +1 -1
- package/dist/src/lib/block-layout.js +5 -5
- package/dist/src/lib/block-layout.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/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/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/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 +14 -0
- package/dist/src/lib/generated-allowlist.js.map +1 -1
- package/dist/src/lib/init-config.js +2 -2
- package/dist/src/lib/init-config.js.map +1 -1
- package/dist/src/lib/toml-database-config.d.ts +10 -39
- package/dist/src/lib/toml-database-config.js +16 -82
- package/dist/src/lib/toml-database-config.js.map +1 -1
- package/dist/src/lib/toml-metadata-config.d.ts +1 -1
- package/dist/src/lib/toml-metadata-config.js +3 -3
- package/dist/src/lib/toml-metadata-config.js.map +1 -1
- 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/workflow-codegen/generated-schema-descriptor.d.ts +96 -0
- package/dist/src/lib/workflow-codegen/generated-schema-descriptor.js +112 -0
- package/dist/src/lib/workflow-codegen/generated-schema-descriptor.js.map +1 -0
- package/dist/src/lib/workflow-codegen/generator.d.ts +70 -0
- package/dist/src/lib/workflow-codegen/generator.js +186 -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 +55 -0
- package/dist/src/lib/workflow-codegen/schemaToTs.js +237 -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-toml-validator.d.ts +1 -1
- package/dist/src/lib/workflow-toml-validator.js +1 -1
- 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,237 @@
|
|
|
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
|
+
*
|
|
28
|
+
* Everything the server ignores (`$ref`, `oneOf`/`anyOf`/`allOf`, `format`,
|
|
29
|
+
* `patternProperties`, numeric constraints, tuple `items`) renders `unknown`.
|
|
30
|
+
*
|
|
31
|
+
* Errors are NOT swallowed here — a malformed schema fails upstream at parse
|
|
32
|
+
* time; this walker only sees an already-parsed schema and returns `unknown`
|
|
33
|
+
* for anything it does not recognize.
|
|
34
|
+
*/
|
|
35
|
+
import { describeSchema, isType, } from "./generated-schema-descriptor.js";
|
|
36
|
+
/** Scalar JSON-schema types this converter maps to a concrete TS scalar. */
|
|
37
|
+
const SCALAR_TS = {
|
|
38
|
+
string: "string",
|
|
39
|
+
number: "number",
|
|
40
|
+
integer: "number",
|
|
41
|
+
boolean: "boolean",
|
|
42
|
+
null: "null",
|
|
43
|
+
};
|
|
44
|
+
/** A shared empty-object reference for the `{}`-rejection probe below. */
|
|
45
|
+
const EMPTY_OBJECT = Object.freeze({});
|
|
46
|
+
/**
|
|
47
|
+
* Render a scalar-literal union from an `enum` array. `JSON.stringify` emits a
|
|
48
|
+
* valid TS literal for a string, number, boolean, or `null`. An object/array
|
|
49
|
+
* member has no TS literal form, so the whole enum falls back to `unknown`
|
|
50
|
+
* (returns `null` here).
|
|
51
|
+
*/
|
|
52
|
+
function tsUnionFromScalarEnum(values) {
|
|
53
|
+
if (!Array.isArray(values) || values.length === 0)
|
|
54
|
+
return null;
|
|
55
|
+
const literals = [];
|
|
56
|
+
const seen = new Set();
|
|
57
|
+
for (const v of values) {
|
|
58
|
+
if (v !== null && (typeof v === "object" || Array.isArray(v))) {
|
|
59
|
+
// Objects/arrays are not representable as TS literals.
|
|
60
|
+
return null;
|
|
61
|
+
}
|
|
62
|
+
const literal = JSON.stringify(v);
|
|
63
|
+
if (literal === undefined)
|
|
64
|
+
return null; // e.g. `undefined` in the enum
|
|
65
|
+
if (!seen.has(literal)) {
|
|
66
|
+
seen.add(literal);
|
|
67
|
+
literals.push(literal);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
return literals.length > 0 ? literals.join(" | ") : null;
|
|
71
|
+
}
|
|
72
|
+
/** True when a rendered type is a bare identifier safe to suffix with `[]`. */
|
|
73
|
+
function isSimpleTypeExpr(expr) {
|
|
74
|
+
return /^[A-Za-z0-9_.]+(\[\])*$/.test(expr);
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Convert a parsed JSON Schema node to a TypeScript type expression. Object
|
|
78
|
+
* types render multi-line (2-space indent per level); everything else renders
|
|
79
|
+
* on a single line. `indent` is the current indentation depth.
|
|
80
|
+
*/
|
|
81
|
+
export function schemaToTsType(schema, indent = 0) {
|
|
82
|
+
const d = describeSchema(schema);
|
|
83
|
+
// `enum` is the most specific constraint — the server checks it AFTER the
|
|
84
|
+
// type gate, so when both are present only the enum members that satisfy the
|
|
85
|
+
// declared type(s) are reachable. Emit just those (intersect with `type`
|
|
86
|
+
// via the shared `isType`). If the type filter leaves nothing representable,
|
|
87
|
+
// fall through to plain `type` rendering rather than over-promising.
|
|
88
|
+
if (d.enumValues) {
|
|
89
|
+
const allowedTypes = d.types;
|
|
90
|
+
const candidates = allowedTypes.length > 0
|
|
91
|
+
? d.enumValues.filter((v) => allowedTypes.some((t) => isType(v, t)))
|
|
92
|
+
: d.enumValues;
|
|
93
|
+
if (candidates.length === 0) {
|
|
94
|
+
// No enum member satisfies the declared type gate (or the enum is empty),
|
|
95
|
+
// so the runtime rejects EVERY value: the type gate lets some values
|
|
96
|
+
// through, then `enum.includes(value)` fails them all. The reachable set
|
|
97
|
+
// is empty → an uninhabitable `never`. Widening to the declared type here
|
|
98
|
+
// (e.g. `{type:"string", enum:[1]}` → `string`) would let typed callers
|
|
99
|
+
// pass values the server always rejects.
|
|
100
|
+
return "never";
|
|
101
|
+
}
|
|
102
|
+
const union = tsUnionFromScalarEnum(candidates);
|
|
103
|
+
if (union !== null)
|
|
104
|
+
return union;
|
|
105
|
+
// Candidates survive the type gate but aren't representable as TS literals
|
|
106
|
+
// (object/array enum members). With no declared type there is nothing to
|
|
107
|
+
// fall back on → `unknown`; otherwise fall through to plain `type`.
|
|
108
|
+
if (allowedTypes.length === 0)
|
|
109
|
+
return "unknown";
|
|
110
|
+
}
|
|
111
|
+
// Array-union type (e.g. `["string", "null"]`). Only scalar/null members get
|
|
112
|
+
// a precise union — the server never descends `properties`/`items` for a
|
|
113
|
+
// union, so an object/array member forces `unknown`.
|
|
114
|
+
if (d.isUnion) {
|
|
115
|
+
const parts = [];
|
|
116
|
+
const seen = new Set();
|
|
117
|
+
for (const t of d.types) {
|
|
118
|
+
const mapped = SCALAR_TS[t];
|
|
119
|
+
if (mapped === undefined)
|
|
120
|
+
return "unknown"; // object/array/unknown member
|
|
121
|
+
if (!seen.has(mapped)) {
|
|
122
|
+
seen.add(mapped);
|
|
123
|
+
parts.push(mapped);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
return parts.length > 0 ? parts.join(" | ") : "unknown";
|
|
127
|
+
}
|
|
128
|
+
if (d.singularType === null) {
|
|
129
|
+
// No usable single type and no enum — the server enforces nothing.
|
|
130
|
+
return "unknown";
|
|
131
|
+
}
|
|
132
|
+
// Object: the server walks `properties`/`required` ONLY when the type is
|
|
133
|
+
// exactly `"object"`. `d.object` is non-null only in that case with declared
|
|
134
|
+
// properties; a typed object with no properties is open → Record.
|
|
135
|
+
if (d.singularType === "object") {
|
|
136
|
+
if (d.object)
|
|
137
|
+
return renderObjectType(d.object, indent);
|
|
138
|
+
return "Record<string, unknown>";
|
|
139
|
+
}
|
|
140
|
+
// Array: the server walks `items` ONLY when the type is exactly `"array"`.
|
|
141
|
+
if (d.singularType === "array") {
|
|
142
|
+
const items = d.array ? d.array.items : undefined;
|
|
143
|
+
// Missing or tuple `items` (an array of schemas) is ignored → unknown[].
|
|
144
|
+
if (!items || typeof items !== "object" || Array.isArray(items)) {
|
|
145
|
+
return "unknown[]";
|
|
146
|
+
}
|
|
147
|
+
const elem = schemaToTsType(items, indent);
|
|
148
|
+
return isSimpleTypeExpr(elem) ? `${elem}[]` : `(${elem})[]`;
|
|
149
|
+
}
|
|
150
|
+
// Single scalar type.
|
|
151
|
+
const scalar = SCALAR_TS[d.singularType];
|
|
152
|
+
return scalar ?? "unknown";
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
155
|
+
* Render an object descriptor (`describeSchema(...).object`) as a TS object
|
|
156
|
+
* type. `required[]` drives optionality. An OPEN object (not
|
|
157
|
+
* `additionalProperties: false`) emits `[key: string]: unknown` so extra keys
|
|
158
|
+
* the runtime accepts don't trip TS excess-property checks; a CLOSED object
|
|
159
|
+
* omits it.
|
|
160
|
+
*/
|
|
161
|
+
function renderObjectType(objectDesc, indent) {
|
|
162
|
+
const { properties, required, additionalPropertiesClosed } = objectDesc;
|
|
163
|
+
const propNames = Object.keys(properties);
|
|
164
|
+
const requiredSet = new Set(Array.isArray(required)
|
|
165
|
+
? required.filter((k) => typeof k === "string")
|
|
166
|
+
: []);
|
|
167
|
+
const pad = " ".repeat(indent + 1);
|
|
168
|
+
const closePad = " ".repeat(indent);
|
|
169
|
+
const propNameSet = new Set(propNames);
|
|
170
|
+
const lines = ["{"];
|
|
171
|
+
for (const name of propNames) {
|
|
172
|
+
const childType = schemaToTsType(properties[name], indent + 1);
|
|
173
|
+
const optional = requiredSet.has(name) ? "" : "?";
|
|
174
|
+
lines.push(`${pad}${quotePropIfNeeded(name)}${optional}: ${childType};`);
|
|
175
|
+
}
|
|
176
|
+
// A key listed in `required` but absent from `properties` has no declared
|
|
177
|
+
// child schema, yet the validator still rejects an object missing it. Emit it
|
|
178
|
+
// as a required `unknown` member so the generated type demands the key too —
|
|
179
|
+
// otherwise `{properties:{}, required:["id"]}` would accept `{}`, which the
|
|
180
|
+
// runtime rejects.
|
|
181
|
+
for (const name of requiredSet) {
|
|
182
|
+
if (!propNameSet.has(name)) {
|
|
183
|
+
lines.push(`${pad}${quotePropIfNeeded(name)}: unknown;`);
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
// Open objects accept extra keys at runtime; model that with an index
|
|
187
|
+
// signature so a call site passing an unlisted key still compiles.
|
|
188
|
+
if (!additionalPropertiesClosed) {
|
|
189
|
+
lines.push(`${pad}[key: string]: unknown;`);
|
|
190
|
+
}
|
|
191
|
+
lines.push(`${closePad}}`);
|
|
192
|
+
return lines.join("\n");
|
|
193
|
+
}
|
|
194
|
+
/**
|
|
195
|
+
* Quote an object-property name when it is not a plain identifier (so keys with
|
|
196
|
+
* hyphens, dots, or other characters render as valid TS).
|
|
197
|
+
*/
|
|
198
|
+
function quotePropIfNeeded(name) {
|
|
199
|
+
if (/^[A-Za-z_$][A-Za-z0-9_$]*$/.test(name))
|
|
200
|
+
return name;
|
|
201
|
+
return JSON.stringify(name);
|
|
202
|
+
}
|
|
203
|
+
/**
|
|
204
|
+
* True when the schema REJECTS an empty object `{}` — i.e. the client's
|
|
205
|
+
* `rootInput: options.input ?? {}` fallback would fail validation, so `input`
|
|
206
|
+
* must be a compile-time-required option (issue #1442, P4). Derived from the
|
|
207
|
+
* shared descriptor so it matches the server validator exactly:
|
|
208
|
+
*
|
|
209
|
+
* - a declared top-level `type` that `{}` does not satisfy (anything but
|
|
210
|
+
* `object`, e.g. `string`/`array`, or a union with no `object` arm);
|
|
211
|
+
* - a top-level `enum` (a fresh `{}` is never an enum member);
|
|
212
|
+
* - `type: "object"` with a non-empty `required[]` (a missing required key).
|
|
213
|
+
*
|
|
214
|
+
* An all-optional object schema, or a schema with no top-level constraints,
|
|
215
|
+
* accepts `{}` → `input` is optional.
|
|
216
|
+
*/
|
|
217
|
+
export function schemaRejectsEmptyObject(schema) {
|
|
218
|
+
const d = describeSchema(schema);
|
|
219
|
+
// 1. Type gate: `{}` must satisfy at least one declared type.
|
|
220
|
+
if (d.types.length && !d.types.some((t) => isType(EMPTY_OBJECT, t))) {
|
|
221
|
+
return true;
|
|
222
|
+
}
|
|
223
|
+
// 2. Enum gate: a JSON enum never contains a value reference-equal to `{}`,
|
|
224
|
+
// so any enum rejects it (mirrors `enum.includes(value)` at runtime).
|
|
225
|
+
if (d.enumValues && !d.enumValues.includes(EMPTY_OBJECT)) {
|
|
226
|
+
return true;
|
|
227
|
+
}
|
|
228
|
+
// 3. Object required: any required key is absent from `{}`.
|
|
229
|
+
if (d.object) {
|
|
230
|
+
for (const key of d.object.required) {
|
|
231
|
+
if (!(key in EMPTY_OBJECT))
|
|
232
|
+
return true;
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
return false;
|
|
236
|
+
}
|
|
237
|
+
//# sourceMappingURL=schemaToTs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schemaToTs.js","sourceRoot":"","sources":["../../../../src/lib/workflow-codegen/schemaToTs.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AAEH,OAAO,EACL,cAAc,EACd,MAAM,GAEP,MAAM,kCAAkC,CAAC;AAE1C,4EAA4E;AAC5E,MAAM,SAAS,GAA2B;IACxC,MAAM,EAAE,QAAQ;IAChB,MAAM,EAAE,QAAQ;IAChB,OAAO,EAAE,QAAQ;IACjB,OAAO,EAAE,SAAS;IAClB,IAAI,EAAE,MAAM;CACb,CAAC;AAEF,0EAA0E;AAC1E,MAAM,YAAY,GAA0B,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;AAE9D;;;;;GAKG;AACH,SAAS,qBAAqB,CAAC,MAAa;IAC1C,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,IAAI,CAAC;IAC/D,MAAM,QAAQ,GAAa,EAAE,CAAC;IAC9B,MAAM,IAAI,GAAG,IAAI,GAAG,EAAU,CAAC;IAC/B,KAAK,MAAM,CAAC,IAAI,MAAM,EAAE,CAAC;QACvB,IAAI,CAAC,KAAK,IAAI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
+
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,CA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AC;QACD,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,MAAM,CAAC,CAAC;IACvB,CAAC;AACH,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 `
|
|
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 `
|
|
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
|
*/
|
package/dist/src/validators.d.ts
CHANGED
|
@@ -18,8 +18,9 @@
|
|
|
18
18
|
* 2. The raw validators (`validateWorkflowToml`, `validateOperations`) and
|
|
19
19
|
* their formatters (`formatWorkflowTomlErrors`, `formatIssue`). These are
|
|
20
20
|
* **pure functions over already-parsed TOML** — they do not read files or
|
|
21
|
-
* parse TOML themselves. The consumer is responsible for parsing (
|
|
22
|
-
*
|
|
21
|
+
* parse TOML themselves. The consumer is responsible for parsing (config
|
|
22
|
+
* files via `parseConfigToml`) and, for workflows, for any `include`
|
|
23
|
+
* expansion. There is
|
|
23
24
|
* no coupling on a specific TOML parser version; pass whatever parsed
|
|
24
25
|
* object/operations[] you already have.
|
|
25
26
|
*
|
|
@@ -46,7 +47,7 @@ export interface WorkflowTomlSourceResult {
|
|
|
46
47
|
* Validate a workflow TOML **source string** the exact way `sync push` does.
|
|
47
48
|
*
|
|
48
49
|
* Runs the identical pipeline `sync push` runs on every workflow file:
|
|
49
|
-
* `
|
|
50
|
+
* `parseConfigToml(raw)` → `expandWorkflowTomlData(parsed, filePath)`
|
|
50
51
|
* → `validateWorkflowToml(expanded)` → `formatWorkflowTomlErrors(...)`.
|
|
51
52
|
*
|
|
52
53
|
* The `include` fragment expansion resolves fragments relative to
|
package/dist/src/validators.js
CHANGED
|
@@ -18,8 +18,9 @@
|
|
|
18
18
|
* 2. The raw validators (`validateWorkflowToml`, `validateOperations`) and
|
|
19
19
|
* their formatters (`formatWorkflowTomlErrors`, `formatIssue`). These are
|
|
20
20
|
* **pure functions over already-parsed TOML** — they do not read files or
|
|
21
|
-
* parse TOML themselves. The consumer is responsible for parsing (
|
|
22
|
-
*
|
|
21
|
+
* parse TOML themselves. The consumer is responsible for parsing (config
|
|
22
|
+
* files via `parseConfigToml`) and, for workflows, for any `include`
|
|
23
|
+
* expansion. There is
|
|
23
24
|
* no coupling on a specific TOML parser version; pass whatever parsed
|
|
24
25
|
* object/operations[] you already have.
|
|
25
26
|
*
|
|
@@ -27,7 +28,7 @@
|
|
|
27
28
|
* `locateOperationLine`) are intentionally NOT exported — they are
|
|
28
29
|
* implementation details of `validateOperations`.
|
|
29
30
|
*/
|
|
30
|
-
import
|
|
31
|
+
import { parseConfigToml } from "./lib/config-toml.js";
|
|
31
32
|
import { validateWorkflowToml, formatWorkflowTomlErrors, } from "./lib/workflow-toml-validator.js";
|
|
32
33
|
import { expandWorkflowTomlData } from "./lib/workflow-fragments.js";
|
|
33
34
|
export { validateWorkflowToml, formatWorkflowTomlErrors, } from "./lib/workflow-toml-validator.js";
|
|
@@ -36,7 +37,7 @@ export { validateOperations, formatIssue, } from "./lib/toml-params-validator.js
|
|
|
36
37
|
* Validate a workflow TOML **source string** the exact way `sync push` does.
|
|
37
38
|
*
|
|
38
39
|
* Runs the identical pipeline `sync push` runs on every workflow file:
|
|
39
|
-
* `
|
|
40
|
+
* `parseConfigToml(raw)` → `expandWorkflowTomlData(parsed, filePath)`
|
|
40
41
|
* → `validateWorkflowToml(expanded)` → `formatWorkflowTomlErrors(...)`.
|
|
41
42
|
*
|
|
42
43
|
* The `include` fragment expansion resolves fragments relative to
|
|
@@ -52,7 +53,7 @@ export { validateOperations, formatIssue, } from "./lib/toml-params-validator.js
|
|
|
52
53
|
* `null` when the source is valid.
|
|
53
54
|
*/
|
|
54
55
|
export function validateWorkflowTomlSource(raw, filePath) {
|
|
55
|
-
const parsed =
|
|
56
|
+
const parsed = parseConfigToml(raw);
|
|
56
57
|
const expanded = expandWorkflowTomlData(parsed, filePath);
|
|
57
58
|
const errors = validateWorkflowToml(expanded);
|
|
58
59
|
return {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validators.js","sourceRoot":"","sources":["../../src/validators.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"validators.js","sourceRoot":"","sources":["../../src/validators.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAEH,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EACL,oBAAoB,EACpB,wBAAwB,GAEzB,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AAErE,OAAO,EACL,oBAAoB,EACpB,wBAAwB,GAEzB,MAAM,kCAAkC,CAAC;AAE1C,OAAO,EACL,kBAAkB,EAClB,WAAW,GAIZ,MAAM,gCAAgC,CAAC;AAexC;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,UAAU,0BAA0B,CACxC,GAAW,EACX,QAAgB;IAEhB,MAAM,MAAM,GAAG,eAAe,CAAC,GAAG,CAAwB,CAAC;IAC3D,MAAM,QAAQ,GAAG,sBAAsB,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;IAC1D,MAAM,MAAM,GAAG,oBAAoB,CAAC,QAAQ,CAAC,CAAC;IAC9C,OAAO;QACL,MAAM;QACN,SAAS,EAAE,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,wBAAwB,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI;KACjF,CAAC;AACJ,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.45",
|
|
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",
|
|
@@ -46,7 +48,6 @@
|
|
|
46
48
|
"node": ">=18.0.0"
|
|
47
49
|
},
|
|
48
50
|
"dependencies": {
|
|
49
|
-
"@iarna/toml": "^2.2.5",
|
|
50
51
|
"@inquirer/prompts": "^7.5.0",
|
|
51
52
|
"@inquirer/search": "^4.1.0",
|
|
52
53
|
"chalk": "^5.3.0",
|
|
@@ -55,6 +56,7 @@
|
|
|
55
56
|
"js-bao": "^0.5.1",
|
|
56
57
|
"mime-types": "^2.1.35",
|
|
57
58
|
"open": "^10.0.3",
|
|
59
|
+
"smol-toml": "1.7.0",
|
|
58
60
|
"tar": "^7.5.11",
|
|
59
61
|
"ulid": "^2.4.0"
|
|
60
62
|
},
|