primitive-admin 1.1.0-alpha.71 → 1.1.0-alpha.72

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (61) hide show
  1. package/dist/src/commands/apps.js +5 -2
  2. package/dist/src/commands/apps.js.map +1 -1
  3. package/dist/src/commands/database-types.js +13 -313
  4. package/dist/src/commands/database-types.js.map +1 -1
  5. package/dist/src/commands/email-templates.js +3 -3
  6. package/dist/src/commands/email-templates.js.map +1 -1
  7. package/dist/src/commands/env.js +17 -1
  8. package/dist/src/commands/env.js.map +1 -1
  9. package/dist/src/commands/init.d.ts +15 -0
  10. package/dist/src/commands/init.js +158 -22
  11. package/dist/src/commands/init.js.map +1 -1
  12. package/dist/src/commands/integrations.js +30 -14
  13. package/dist/src/commands/integrations.js.map +1 -1
  14. package/dist/src/commands/llm.js +9 -6
  15. package/dist/src/commands/llm.js.map +1 -1
  16. package/dist/src/commands/scripts.d.ts +10 -0
  17. package/dist/src/commands/scripts.js +137 -8
  18. package/dist/src/commands/scripts.js.map +1 -1
  19. package/dist/src/commands/settings.d.ts +18 -0
  20. package/dist/src/commands/settings.js +54 -0
  21. package/dist/src/commands/settings.js.map +1 -0
  22. package/dist/src/commands/sync.d.ts +1 -31
  23. package/dist/src/commands/sync.js +5 -79
  24. package/dist/src/commands/sync.js.map +1 -1
  25. package/dist/src/lib/env-resolver-core.d.ts +40 -0
  26. package/dist/src/lib/env-resolver-core.js +60 -0
  27. package/dist/src/lib/env-resolver-core.js.map +1 -1
  28. package/dist/src/lib/generated-workflow-model-fields.d.ts +20 -0
  29. package/dist/src/lib/generated-workflow-model-fields.js +53 -0
  30. package/dist/src/lib/generated-workflow-model-fields.js.map +1 -0
  31. package/dist/src/lib/google-client-secret-status.d.ts +35 -0
  32. package/dist/src/lib/google-client-secret-status.js +56 -0
  33. package/dist/src/lib/google-client-secret-status.js.map +1 -0
  34. package/dist/src/lib/init-client-platforms.d.ts +14 -0
  35. package/dist/src/lib/init-client-platforms.js +71 -0
  36. package/dist/src/lib/init-client-platforms.js.map +1 -0
  37. package/dist/src/lib/init-email-redirect-uris.d.ts +37 -0
  38. package/dist/src/lib/init-email-redirect-uris.js +46 -0
  39. package/dist/src/lib/init-email-redirect-uris.js.map +1 -0
  40. package/dist/src/lib/init-ios-links.d.ts +40 -0
  41. package/dist/src/lib/init-ios-links.js +66 -1
  42. package/dist/src/lib/init-ios-links.js.map +1 -1
  43. package/dist/src/lib/integration-selector.d.ts +42 -0
  44. package/dist/src/lib/integration-selector.js +46 -0
  45. package/dist/src/lib/integration-selector.js.map +1 -0
  46. package/dist/src/lib/local-test-cases.d.ts +63 -0
  47. package/dist/src/lib/local-test-cases.js +135 -0
  48. package/dist/src/lib/local-test-cases.js.map +1 -0
  49. package/dist/src/lib/project-config.d.ts +8 -0
  50. package/dist/src/lib/project-config.js +17 -0
  51. package/dist/src/lib/project-config.js.map +1 -1
  52. package/dist/src/lib/test-case-file-names.d.ts +40 -0
  53. package/dist/src/lib/test-case-file-names.js +91 -0
  54. package/dist/src/lib/test-case-file-names.js.map +1 -0
  55. package/dist/src/lib/web-url.d.ts +40 -0
  56. package/dist/src/lib/web-url.js +76 -0
  57. package/dist/src/lib/web-url.js.map +1 -0
  58. package/dist/src/lib/workflow-field-descriptor.d.ts +91 -0
  59. package/dist/src/lib/workflow-field-descriptor.js +153 -0
  60. package/dist/src/lib/workflow-field-descriptor.js.map +1 -0
  61. package/package.json +1 -1
@@ -0,0 +1,40 @@
1
+ /**
2
+ * The app's web counterpart, as a normalized web origin (#2982).
3
+ *
4
+ * One environment value with two jobs on the iOS side: the emailed sign-in
5
+ * link points at `<webUrl>/oauth/callback`, and the same origin is what an
6
+ * incoming universal link is trusted from. Both jobs need an ORIGIN, not just
7
+ * a URL that parses:
8
+ *
9
+ * - https except loopback, the same rule the server applies to every
10
+ * redirect URI (`src/auth/redirect-uri.ts`) — an origin that cannot be
11
+ * allow-listed turns every sign-in request into a 400;
12
+ * - no path, query or fragment: the web client derives its callback from its
13
+ * own origin plus `/oauth/callback` and has no base-path mode, and the
14
+ * `apple-app-site-association` component matches that exact path;
15
+ * - no credentials, which have no business in a link that goes out by email.
16
+ *
17
+ * Returns the `string | true` shape `@inquirer/prompts` expects, like
18
+ * `validateServerUrl`, so the same function backs the flag check, the project
19
+ * config's field validation and any future prompt.
20
+ *
21
+ * This is the surface that EXPLAINS a rejection. The same rule is applied
22
+ * silently — value or nothing — by every reader that feeds `primitive.json`
23
+ * without going through the CLI: `normalizeWebOrigin` in `env-resolver-core.ts`
24
+ * (which cannot import this file; it is copied verbatim into a package that
25
+ * must not depend on the CLI), its bash/python3 port in the Swift template's
26
+ * `resolve-primitive-config.sh`, and `PrimitiveAppState.linksBaseURL` as the
27
+ * app's own floor. `web-url-parity` in the project-config tests pins that the
28
+ * two TypeScript halves accept and normalize exactly the same values.
29
+ */
30
+ /**
31
+ * Validates a web origin. Returns `true` when valid, otherwise the message to
32
+ * show the user.
33
+ */
34
+ export declare function validateWebUrl(value: string): string | true;
35
+ /**
36
+ * The origin form of an already-validated web URL: lowercased host, explicit
37
+ * port kept, no trailing slash — so `https://app.example.com/` and
38
+ * `https://app.example.com` are stored, compared and joined identically.
39
+ */
40
+ export declare function normalizeWebUrl(value: string): string;
@@ -0,0 +1,76 @@
1
+ /**
2
+ * The app's web counterpart, as a normalized web origin (#2982).
3
+ *
4
+ * One environment value with two jobs on the iOS side: the emailed sign-in
5
+ * link points at `<webUrl>/oauth/callback`, and the same origin is what an
6
+ * incoming universal link is trusted from. Both jobs need an ORIGIN, not just
7
+ * a URL that parses:
8
+ *
9
+ * - https except loopback, the same rule the server applies to every
10
+ * redirect URI (`src/auth/redirect-uri.ts`) — an origin that cannot be
11
+ * allow-listed turns every sign-in request into a 400;
12
+ * - no path, query or fragment: the web client derives its callback from its
13
+ * own origin plus `/oauth/callback` and has no base-path mode, and the
14
+ * `apple-app-site-association` component matches that exact path;
15
+ * - no credentials, which have no business in a link that goes out by email.
16
+ *
17
+ * Returns the `string | true` shape `@inquirer/prompts` expects, like
18
+ * `validateServerUrl`, so the same function backs the flag check, the project
19
+ * config's field validation and any future prompt.
20
+ *
21
+ * This is the surface that EXPLAINS a rejection. The same rule is applied
22
+ * silently — value or nothing — by every reader that feeds `primitive.json`
23
+ * without going through the CLI: `normalizeWebOrigin` in `env-resolver-core.ts`
24
+ * (which cannot import this file; it is copied verbatim into a package that
25
+ * must not depend on the CLI), its bash/python3 port in the Swift template's
26
+ * `resolve-primitive-config.sh`, and `PrimitiveAppState.linksBaseURL` as the
27
+ * app's own floor. `web-url-parity` in the project-config tests pins that the
28
+ * two TypeScript halves accept and normalize exactly the same values.
29
+ */
30
+ const LOOPBACK_HOSTS = new Set(["localhost", "127.0.0.1"]);
31
+ /** The example every message ends with, so a rejection is actionable. */
32
+ const SHAPE = "e.g. https://app.example.com (or http://localhost:5173 in dev)";
33
+ /**
34
+ * Validates a web origin. Returns `true` when valid, otherwise the message to
35
+ * show the user.
36
+ */
37
+ export function validateWebUrl(value) {
38
+ if (typeof value !== "string" || !value.trim()) {
39
+ return `Web URL cannot be empty — ${SHAPE}`;
40
+ }
41
+ let url;
42
+ try {
43
+ url = new URL(value);
44
+ }
45
+ catch {
46
+ return `Please enter an absolute URL — ${SHAPE}`;
47
+ }
48
+ if (url.protocol !== "https:" && url.protocol !== "http:") {
49
+ return `Web URL must be http(s) — ${SHAPE}`;
50
+ }
51
+ if (url.protocol === "http:" && !LOOPBACK_HOSTS.has(url.hostname)) {
52
+ return `Web URL must use https outside localhost — the server refuses a non-loopback http redirect URI (${SHAPE})`;
53
+ }
54
+ if (url.username || url.password) {
55
+ return `Web URL must not carry credentials — ${SHAPE}`;
56
+ }
57
+ if (url.pathname !== "/" && url.pathname !== "") {
58
+ return `Web URL must be an origin with no path — the web app serves its sign-in callback on its own origin (${SHAPE})`;
59
+ }
60
+ if (url.search) {
61
+ return `Web URL must not carry a query — ${SHAPE}`;
62
+ }
63
+ if (url.hash) {
64
+ return `Web URL must not carry a fragment — ${SHAPE}`;
65
+ }
66
+ return true;
67
+ }
68
+ /**
69
+ * The origin form of an already-validated web URL: lowercased host, explicit
70
+ * port kept, no trailing slash — so `https://app.example.com/` and
71
+ * `https://app.example.com` are stored, compared and joined identically.
72
+ */
73
+ export function normalizeWebUrl(value) {
74
+ return new URL(value).origin;
75
+ }
76
+ //# sourceMappingURL=web-url.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"web-url.js","sourceRoot":"","sources":["../../../src/lib/web-url.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEH,MAAM,cAAc,GAAG,IAAI,GAAG,CAAC,CAAC,WAAW,EAAE,WAAW,CAAC,CAAC,CAAC;AAE3D,yEAAyE;AACzE,MAAM,KAAK,GAAG,gEAAgE,CAAC;AAE/E;;;GAGG;AACH,MAAM,UAAU,cAAc,CAAC,KAAa;IAC1C,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,EAAE,CAAC;QAC/C,OAAO,6BAA6B,KAAK,EAAE,CAAC;IAC9C,CAAC;IACD,IAAI,GAAQ,CAAC;IACb,IAAI,CAAC;QACH,GAAG,GAAG,IAAI,GAAG,CAAC,KAAK,CAAC,CAAC;IACvB,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,kCAAkC,KAAK,EAAE,CAAC;IACnD,CAAC;IACD,IAAI,GAAG,CAAC,QAAQ,KAAK,QAAQ,IAAI,GAAG,CAAC,QAAQ,KAAK,OAAO,EAAE,CAAC;QAC1D,OAAO,6BAA6B,KAAK,EAAE,CAAC;IAC9C,CAAC;IACD,IAAI,GAAG,CAAC,QAAQ,KAAK,OAAO,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE,CAAC;QAClE,OAAO,mGAAmG,KAAK,GAAG,CAAC;IACrH,CAAC;IACD,IAAI,GAAG,CAAC,QAAQ,IAAI,GAAG,CAAC,QAAQ,EAAE,CAAC;QACjC,OAAO,wCAAwC,KAAK,EAAE,CAAC;IACzD,CAAC;IACD,IAAI,GAAG,CAAC,QAAQ,KAAK,GAAG,IAAI,GAAG,CAAC,QAAQ,KAAK,EAAE,EAAE,CAAC;QAChD,OAAO,uGAAuG,KAAK,GAAG,CAAC;IACzH,CAAC;IACD,IAAI,GAAG,CAAC,MAAM,EAAE,CAAC;QACf,OAAO,oCAAoC,KAAK,EAAE,CAAC;IACrD,CAAC;IACD,IAAI,GAAG,CAAC,IAAI,EAAE,CAAC;QACb,OAAO,uCAAuC,KAAK,EAAE,CAAC;IACxD,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,eAAe,CAAC,KAAa;IAC3C,OAAO,IAAI,GAAG,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC;AAC/B,CAAC"}
@@ -0,0 +1,91 @@
1
+ /**
2
+ * Classification of the `WorkflowDefinition` field surface (issue #2326,
3
+ * Phase 1 of #1976).
4
+ *
5
+ * Purpose: give the CLI a mechanical trip-wire for the drift that keeps
6
+ * happening — the server grows a `[workflow]`-level config field (`syncCallable`
7
+ * #807, `accessRule` #571, `runAs` #1081, `capabilities` #1172, `lock` #1518)
8
+ * and the CLI silently drops it on `sync push` / `sync pull`. Every field of the
9
+ * `WorkflowDefinition` model must appear in exactly one of the three groups
10
+ * below. The generated artifact `generated-workflow-model-fields.ts` carries the
11
+ * model's real field list (parsed from `models.yaml` at build time), and
12
+ * `cli/tests/unit/workflow-field-descriptor-drift-guard.test.ts` asserts
13
+ *
14
+ * synced ∪ structural ∪ internal === the model's fields
15
+ *
16
+ * so a new field hard-fails the guard until someone classifies it.
17
+ *
18
+ * ── Scope: declarative classification and coverage ONLY ──────────────────
19
+ * Decision of record (#1976, 2026-07-23): this table records WHICH fields
20
+ * exist, whether each is synced / structural / internal, and its `[workflow]`
21
+ * TOML key. Anything with real BEHAVIOR gets an explicit per-field handler or
22
+ * stays outside the table. In particular this file deliberately does NOT encode
23
+ * as boolean knobs:
24
+ * - the schema fields' native-TOML-table-vs-JSON-string parsing
25
+ * (`buildWorkflowPayloadFromToml` / `safeJsonParse` own that),
26
+ * - `syncCallable`'s deferred second PATCH on update (#807 — `applyWorkflowBody`
27
+ * owns that),
28
+ * - the `metadataManifest` (#1304) and `expr.cel` (#1614) structural side
29
+ * channels, which are attached alongside the steps write and are not
30
+ * `[workflow]`-table keys at all.
31
+ * `cli/src/lib/app-settings-descriptor.ts` is the shape being matched:
32
+ * deliberately narrow.
33
+ *
34
+ * ── What Phase 1 does and does not do ───────────────────────────────────
35
+ * Phase 1 (this file) is the guard only. Making the push builder
36
+ * (`workflow-payload.ts`) and the pull serializer (`serializeWorkflow` in
37
+ * `commands/sync.ts`) *consume* this table is Phase 2 (#2327).
38
+ * `synced` therefore means "belongs in the `[workflow]` TOML table", NOT
39
+ * "already round-trips" — see `SYNCED_NOT_YET_WIRED` below.
40
+ */
41
+ /** Value shape of a synced `[workflow]` key. Descriptive; behavior lives in the handlers. */
42
+ export type WorkflowFieldType = "string" | "number" | "boolean" | "string[]" | "json";
43
+ export interface WorkflowFieldDescriptor {
44
+ /** `WorkflowDefinition` model field name === the server payload key. */
45
+ field: string;
46
+ /** Key under the `[workflow]` table in workflow TOML (usually === `field`). */
47
+ tomlKey: string;
48
+ /** Value shape, for the Phase 2 handlers and for documentation. */
49
+ type: WorkflowFieldType;
50
+ }
51
+ /**
52
+ * The author-facing `[workflow]`-table config fields — the ones a workflow
53
+ * author manages as code and the CLI must round-trip.
54
+ */
55
+ export declare const WORKFLOW_FIELD_DESCRIPTOR: readonly WorkflowFieldDescriptor[];
56
+ /**
57
+ * Fields that ARE author-controlled but do not live in the `[workflow]` table —
58
+ * they travel through their own structural channel. Kept distinct from
59
+ * `WORKFLOW_FIELDS_INTERNAL` so "internal" keeps meaning "not author-facing".
60
+ */
61
+ export declare const WORKFLOW_FIELDS_STRUCTURAL: ReadonlySet<string>;
62
+ /**
63
+ * Fields the server owns: identity, ownership, timestamps, computed pointers,
64
+ * and the deprecated draft/revision slot. None of these are ever sent by the
65
+ * CLI, and none belong in workflow TOML.
66
+ */
67
+ export declare const WORKFLOW_FIELDS_INTERNAL: ReadonlySet<string>;
68
+ /**
69
+ * Synced fields the CLI does NOT round-trip yet — Phase 2 (#2327) wires them.
70
+ * Recorded explicitly so "classified" is never mistaken for "implemented".
71
+ * `lock` was wired by #1972; `templateMissingMarker` was removed from the
72
+ * platform by #2643, so the set is now empty.
73
+ */
74
+ export declare const SYNCED_NOT_YET_WIRED: ReadonlySet<string>;
75
+ /** Descriptor `field` names, for coverage/parity checks. */
76
+ export declare const WORKFLOW_SYNCED_FIELDS: ReadonlySet<string>;
77
+ /** Look up a synced field's descriptor by model field name. */
78
+ export declare function getWorkflowFieldDescriptor(field: string): WorkflowFieldDescriptor | undefined;
79
+ /**
80
+ * Model fields that are classified in NONE of synced / structural / internal —
81
+ * i.e. a field someone added to `models.yaml` without deciding how the CLI
82
+ * treats it. Non-empty is a hard failure in the drift guard.
83
+ */
84
+ export declare function findUnclassifiedWorkflowFields(modelFields: readonly string[]): string[];
85
+ /**
86
+ * Classifications that no longer correspond to a model field — i.e. a field
87
+ * removed from `models.yaml` while the CLI still classifies it. Also a hard
88
+ * failure: a stale classification must not silently pass, or the coverage
89
+ * claim quietly stops meaning anything.
90
+ */
91
+ export declare function findStaleWorkflowClassifications(modelFields: readonly string[]): string[];
@@ -0,0 +1,153 @@
1
+ /**
2
+ * Classification of the `WorkflowDefinition` field surface (issue #2326,
3
+ * Phase 1 of #1976).
4
+ *
5
+ * Purpose: give the CLI a mechanical trip-wire for the drift that keeps
6
+ * happening — the server grows a `[workflow]`-level config field (`syncCallable`
7
+ * #807, `accessRule` #571, `runAs` #1081, `capabilities` #1172, `lock` #1518)
8
+ * and the CLI silently drops it on `sync push` / `sync pull`. Every field of the
9
+ * `WorkflowDefinition` model must appear in exactly one of the three groups
10
+ * below. The generated artifact `generated-workflow-model-fields.ts` carries the
11
+ * model's real field list (parsed from `models.yaml` at build time), and
12
+ * `cli/tests/unit/workflow-field-descriptor-drift-guard.test.ts` asserts
13
+ *
14
+ * synced ∪ structural ∪ internal === the model's fields
15
+ *
16
+ * so a new field hard-fails the guard until someone classifies it.
17
+ *
18
+ * ── Scope: declarative classification and coverage ONLY ──────────────────
19
+ * Decision of record (#1976, 2026-07-23): this table records WHICH fields
20
+ * exist, whether each is synced / structural / internal, and its `[workflow]`
21
+ * TOML key. Anything with real BEHAVIOR gets an explicit per-field handler or
22
+ * stays outside the table. In particular this file deliberately does NOT encode
23
+ * as boolean knobs:
24
+ * - the schema fields' native-TOML-table-vs-JSON-string parsing
25
+ * (`buildWorkflowPayloadFromToml` / `safeJsonParse` own that),
26
+ * - `syncCallable`'s deferred second PATCH on update (#807 — `applyWorkflowBody`
27
+ * owns that),
28
+ * - the `metadataManifest` (#1304) and `expr.cel` (#1614) structural side
29
+ * channels, which are attached alongside the steps write and are not
30
+ * `[workflow]`-table keys at all.
31
+ * `cli/src/lib/app-settings-descriptor.ts` is the shape being matched:
32
+ * deliberately narrow.
33
+ *
34
+ * ── What Phase 1 does and does not do ───────────────────────────────────
35
+ * Phase 1 (this file) is the guard only. Making the push builder
36
+ * (`workflow-payload.ts`) and the pull serializer (`serializeWorkflow` in
37
+ * `commands/sync.ts`) *consume* this table is Phase 2 (#2327).
38
+ * `synced` therefore means "belongs in the `[workflow]` TOML table", NOT
39
+ * "already round-trips" — see `SYNCED_NOT_YET_WIRED` below.
40
+ */
41
+ /**
42
+ * The author-facing `[workflow]`-table config fields — the ones a workflow
43
+ * author manages as code and the CLI must round-trip.
44
+ */
45
+ export const WORKFLOW_FIELD_DESCRIPTOR = [
46
+ { field: "name", tomlKey: "name", type: "string" },
47
+ { field: "status", tomlKey: "status", type: "string" },
48
+ { field: "description", tomlKey: "description", type: "string" },
49
+ // JSON Schema objects. TOML may present them as an inline table OR as a
50
+ // JSON string; the push builder owns that parse (not a knob here).
51
+ { field: "inputSchema", tomlKey: "inputSchema", type: "json" },
52
+ { field: "outputSchema", tomlKey: "outputSchema", type: "json" },
53
+ { field: "perUserMaxRunning", tomlKey: "perUserMaxRunning", type: "number" },
54
+ { field: "perUserMaxQueued", tomlKey: "perUserMaxQueued", type: "number" },
55
+ { field: "perAppMaxRunning", tomlKey: "perAppMaxRunning", type: "number" },
56
+ { field: "perAppMaxQueued", tomlKey: "perAppMaxQueued", type: "number" },
57
+ { field: "queueTtlSeconds", tomlKey: "queueTtlSeconds", type: "number" },
58
+ { field: "dequeueOrder", tomlKey: "dequeueOrder", type: "string" },
59
+ {
60
+ field: "requiresClientApply",
61
+ tomlKey: "requiresClientApply",
62
+ type: "boolean",
63
+ },
64
+ // Create-only on the wire (#807: update sends it as a deferred second PATCH
65
+ // once the new steps are live). That sequencing is the payload builder's job.
66
+ { field: "syncCallable", tomlKey: "syncCallable", type: "boolean" },
67
+ { field: "accessRule", tomlKey: "accessRule", type: "string" },
68
+ { field: "runAs", tomlKey: "runAs", type: "string" },
69
+ // #1518/#1972 — declarative run-scoped lock. `[workflow.lock]` inline table
70
+ // on the TOML side, JSON on the wire; validated server-side by
71
+ // `parseWorkflowLock` (decision of record #6: no client-side mirror validator).
72
+ { field: "lock", tomlKey: "lock", type: "json" },
73
+ // #1078 Tier 1b — StringSetField on the model, string array in TOML/JSON.
74
+ { field: "capabilities", tomlKey: "capabilities", type: "string[]" },
75
+ ];
76
+ /**
77
+ * Fields that ARE author-controlled but do not live in the `[workflow]` table —
78
+ * they travel through their own structural channel. Kept distinct from
79
+ * `WORKFLOW_FIELDS_INTERNAL` so "internal" keeps meaning "not author-facing".
80
+ */
81
+ export const WORKFLOW_FIELDS_STRUCTURAL = new Set([
82
+ // The workflow's identity. Comes from the TOML file name / `--key`, and is
83
+ // attached by the caller rather than spread from the `[workflow]` table.
84
+ "workflowKey",
85
+ // #1304 — JSON declared-access manifest, derived from the workflow's CEL
86
+ // fields and attached alongside the steps write, not typed by the author.
87
+ "metadataManifest",
88
+ ]);
89
+ /**
90
+ * Fields the server owns: identity, ownership, timestamps, computed pointers,
91
+ * and the deprecated draft/revision slot. None of these are ever sent by the
92
+ * CLI, and none belong in workflow TOML.
93
+ */
94
+ export const WORKFLOW_FIELDS_INTERNAL = new Set([
95
+ // Identity / ownership / timestamps — assigned by the server.
96
+ "workflowId",
97
+ "appId",
98
+ "createdBy",
99
+ "createdAt",
100
+ "modifiedAt",
101
+ // Pointer to the active WorkflowConfiguration — server-computed on publish.
102
+ "activeConfigId",
103
+ // DEPRECATED in models.yaml: the legacy revision + draft slot, kept for
104
+ // migration/backward compatibility. Server-managed; never author-authored.
105
+ "latestRevision",
106
+ "stepsR2Key",
107
+ "draftStepsR2Key",
108
+ "draftInputSchema",
109
+ "draftOutputSchema",
110
+ "draftModifiedAt",
111
+ ]);
112
+ /**
113
+ * Synced fields the CLI does NOT round-trip yet — Phase 2 (#2327) wires them.
114
+ * Recorded explicitly so "classified" is never mistaken for "implemented".
115
+ * `lock` was wired by #1972; `templateMissingMarker` was removed from the
116
+ * platform by #2643, so the set is now empty.
117
+ */
118
+ export const SYNCED_NOT_YET_WIRED = new Set([]);
119
+ /** Descriptor `field` names, for coverage/parity checks. */
120
+ export const WORKFLOW_SYNCED_FIELDS = new Set(WORKFLOW_FIELD_DESCRIPTOR.map((d) => d.field));
121
+ /** Look up a synced field's descriptor by model field name. */
122
+ export function getWorkflowFieldDescriptor(field) {
123
+ return WORKFLOW_FIELD_DESCRIPTOR.find((d) => d.field === field);
124
+ }
125
+ /**
126
+ * Model fields that are classified in NONE of synced / structural / internal —
127
+ * i.e. a field someone added to `models.yaml` without deciding how the CLI
128
+ * treats it. Non-empty is a hard failure in the drift guard.
129
+ */
130
+ export function findUnclassifiedWorkflowFields(modelFields) {
131
+ return modelFields
132
+ .filter((f) => !WORKFLOW_SYNCED_FIELDS.has(f) &&
133
+ !WORKFLOW_FIELDS_STRUCTURAL.has(f) &&
134
+ !WORKFLOW_FIELDS_INTERNAL.has(f))
135
+ .sort();
136
+ }
137
+ /**
138
+ * Classifications that no longer correspond to a model field — i.e. a field
139
+ * removed from `models.yaml` while the CLI still classifies it. Also a hard
140
+ * failure: a stale classification must not silently pass, or the coverage
141
+ * claim quietly stops meaning anything.
142
+ */
143
+ export function findStaleWorkflowClassifications(modelFields) {
144
+ const known = new Set(modelFields);
145
+ return [
146
+ ...WORKFLOW_SYNCED_FIELDS,
147
+ ...WORKFLOW_FIELDS_STRUCTURAL,
148
+ ...WORKFLOW_FIELDS_INTERNAL,
149
+ ]
150
+ .filter((f) => !known.has(f))
151
+ .sort();
152
+ }
153
+ //# sourceMappingURL=workflow-field-descriptor.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"workflow-field-descriptor.js","sourceRoot":"","sources":["../../../src/lib/workflow-field-descriptor.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AAmBH;;;GAGG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAuC;IAC3E,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE;IAClD,EAAE,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,QAAQ,EAAE;IACtD,EAAE,KAAK,EAAE,aAAa,EAAE,OAAO,EAAE,aAAa,EAAE,IAAI,EAAE,QAAQ,EAAE;IAChE,wEAAwE;IACxE,mEAAmE;IACnE,EAAE,KAAK,EAAE,aAAa,EAAE,OAAO,EAAE,aAAa,EAAE,IAAI,EAAE,MAAM,EAAE;IAC9D,EAAE,KAAK,EAAE,cAAc,EAAE,OAAO,EAAE,cAAc,EAAE,IAAI,EAAE,MAAM,EAAE;IAChE,EAAE,KAAK,EAAE,mBAAmB,EAAE,OAAO,EAAE,mBAAmB,EAAE,IAAI,EAAE,QAAQ,EAAE;IAC5E,EAAE,KAAK,EAAE,kBAAkB,EA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AM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;SAC5B,IAAI,EAAE,CAAC;AACZ,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "primitive-admin",
3
- "version": "1.1.0-alpha.71",
3
+ "version": "1.1.0-alpha.72",
4
4
  "description": "CLI for administering Primitive applications",
5
5
  "type": "module",
6
6
  "bin": {