primitive-admin 1.0.54 → 1.0.55
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bin/primitive.js +2 -0
- package/dist/bin/primitive.js.map +1 -1
- package/dist/src/commands/apps.js +54 -2
- package/dist/src/commands/apps.js.map +1 -1
- package/dist/src/commands/databases.js +31 -10
- package/dist/src/commands/databases.js.map +1 -1
- package/dist/src/commands/documents.js +77 -0
- package/dist/src/commands/documents.js.map +1 -1
- package/dist/src/commands/settings.d.ts +15 -0
- package/dist/src/commands/settings.js +102 -0
- package/dist/src/commands/settings.js.map +1 -0
- package/dist/src/commands/sync-app-settings.d.ts +105 -0
- package/dist/src/commands/sync-app-settings.js +339 -0
- package/dist/src/commands/sync-app-settings.js.map +1 -0
- package/dist/src/commands/sync.d.ts +34 -19
- package/dist/src/commands/sync.js +373 -200
- package/dist/src/commands/sync.js.map +1 -1
- package/dist/src/commands/workflows.js +32 -10
- package/dist/src/commands/workflows.js.map +1 -1
- package/dist/src/lib/api-client.d.ts +2 -0
- package/dist/src/lib/api-client.js +6 -0
- package/dist/src/lib/api-client.js.map +1 -1
- package/dist/src/lib/app-settings-descriptor.d.ts +108 -0
- package/dist/src/lib/app-settings-descriptor.js +250 -0
- package/dist/src/lib/app-settings-descriptor.js.map +1 -0
- package/dist/src/lib/codegen-shared/generatedFiles.d.ts +15 -0
- package/dist/src/lib/codegen-shared/generatedFiles.js +27 -10
- package/dist/src/lib/codegen-shared/generatedFiles.js.map +1 -1
- package/dist/src/lib/db-codegen/dbGenerator.d.ts +11 -83
- package/dist/src/lib/db-codegen/dbGenerator.js +93 -556
- package/dist/src/lib/db-codegen/dbGenerator.js.map +1 -1
- package/dist/src/lib/db-codegen/dbNaming.d.ts +15 -7
- package/dist/src/lib/db-codegen/dbNaming.js +25 -13
- package/dist/src/lib/db-codegen/dbNaming.js.map +1 -1
- package/dist/src/lib/db-codegen/dbTemplates.d.ts +55 -4
- package/dist/src/lib/db-codegen/dbTemplates.js +169 -40
- package/dist/src/lib/db-codegen/dbTemplates.js.map +1 -1
- package/dist/src/lib/db-codegen/dbTypeIR.d.ts +146 -0
- package/dist/src/lib/db-codegen/dbTypeIR.js +517 -0
- package/dist/src/lib/db-codegen/dbTypeIR.js.map +1 -0
- package/dist/src/lib/db-codegen/generated-operation-def-descriptor.d.ts +101 -0
- package/dist/src/lib/db-codegen/generated-operation-def-descriptor.js +200 -0
- package/dist/src/lib/db-codegen/generated-operation-def-descriptor.js.map +1 -0
- package/dist/src/lib/swift-codegen/dbGenerator.d.ts +68 -0
- package/dist/src/lib/swift-codegen/dbGenerator.js +380 -0
- package/dist/src/lib/swift-codegen/dbGenerator.js.map +1 -0
- package/dist/src/lib/swift-codegen/dbSwiftTypes.d.ts +42 -0
- package/dist/src/lib/swift-codegen/dbSwiftTypes.js +100 -0
- package/dist/src/lib/swift-codegen/dbSwiftTypes.js.map +1 -0
- package/dist/src/lib/swift-codegen/generator.d.ts +84 -0
- package/dist/src/lib/swift-codegen/generator.js +178 -0
- package/dist/src/lib/swift-codegen/generator.js.map +1 -0
- package/dist/src/lib/swift-codegen/schemaToSwift.d.ts +72 -0
- package/dist/src/lib/swift-codegen/schemaToSwift.js +644 -0
- package/dist/src/lib/swift-codegen/schemaToSwift.js.map +1 -0
- package/dist/src/lib/swift-codegen/swiftNaming.d.ts +85 -0
- package/dist/src/lib/swift-codegen/swiftNaming.js +198 -0
- package/dist/src/lib/swift-codegen/swiftNaming.js.map +1 -0
- package/dist/src/lib/sync-resource-types.d.ts +225 -0
- package/dist/src/lib/sync-resource-types.js +394 -0
- package/dist/src/lib/sync-resource-types.js.map +1 -0
- package/dist/src/lib/workflow-codegen/generator.d.ts +18 -5
- package/dist/src/lib/workflow-codegen/generator.js +116 -41
- package/dist/src/lib/workflow-codegen/generator.js.map +1 -1
- package/dist/src/lib/workflow-codegen/invokerIR.d.ts +85 -0
- package/dist/src/lib/workflow-codegen/invokerIR.js +71 -0
- package/dist/src/lib/workflow-codegen/invokerIR.js.map +1 -0
- package/package.json +4 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generator.js","sourceRoot":"","sources":["../../../../src/lib/workflow-codegen/generator.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"generator.js","sourceRoot":"","sources":["../../../../src/lib/workflow-codegen/generator.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2CG;AAEH,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,EACL,0BAA0B,GAE3B,MAAM,qCAAqC,CAAC;AAC7C,OAAO,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AACjE,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,EAAE,cAAc,EAAE,MAAM,kCAAkC,CAAC;AAClE,OAAO,EAAE,uBAAuB,EAAE,MAAM,gBAAgB,CAAC;AACzD,OAAO,EACL,qBAAqB,EACrB,sBAAsB,EACtB,mBAAmB,GACpB,MAAM,aAAa,CAAC;AAErB,6EAA6E;AAC7E,MAAM,CAAC,MAAM,qBAAqB,GAAG,eAAe,CAAC;AAErD,oEAAoE;AACpE,MAAM,cAAc,GAAG,mBAAmB,CAAC;AAyD3C;;;;;;;;;GASG;AACH,SAAS,cAAc,CAAC,IAAY,EAAE,MAAW;IAC/C,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;QACzB,OAAO,eAAe,IAAI,aAAa,CAAC;IAC1C,CAAC;IACD,MAAM,IAAI,GAAG,cAAc,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC;IACvC,IAAI,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,CAAC;QAC1D,OAAO,oBAAoB,IAAI,IAAI,IAAI,EAAE,CAAC;IAC5C,CAAC;IACD,OAAO,eAAe,IAAI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,KAAK,UAAU,qBAAqB,CACzC,OAAqC;IAErC,MAAM,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IAE/C,MAAM,YAAY,GAAG,IAAI,GAAG,EAAkB,CAAC;IAC/C,KAAK,MAAM,KAAK,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;QACnC,MAAM,QAAQ,GAAG,kBAAkB,CAAC,KAAK,CAAC,CAAC;QAC3C,IAAI,CAAC,QAAQ;YAAE,SAAS,CAAC,8BAA8B;QACvD,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CACxB,MAAM,EACN,GAAG,QAAQ,CAAC,GAAG,GAAG,qBAAqB,EAAE,CAC1C,CAAC;QACF,YAAY,CAAC,GAAG,CAAC,QAAQ,EAAE,QAAQ,CAAC,OAAO,CAAC,CAAC;IAC/C,CAAC;IAED,OAAO,MAAM,0BAA0B,CAAC;QACtC,SAAS,EAAE,MAAM;QACjB,YAAY;QACZ,KAAK,EAAE,OAAO,CAAC,KAAK;QACpB,0EAA0E;QAC1E,2EAA2E;QAC3E,aAAa,EAAE,OAAO,CAAC,cAAc,KAAK,IAAI;QAC9C,eAAe,EAAE,qBAAqB;KACvC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared workflow-invoker IR (issue #1547, Phase 3).
|
|
3
|
+
*
|
|
4
|
+
* The typed invoker factory is generated on BOTH the TypeScript side
|
|
5
|
+
* (`workflow-codegen/generator.ts`) and the Swift side
|
|
6
|
+
* (`swift-codegen/generator.ts`). The maintainer decision (item 5, binding)
|
|
7
|
+
* requires that invoker generation reuse ONE description of the workflow's
|
|
8
|
+
* operation metadata — the runtime key, whether `runSync` is emitted
|
|
9
|
+
* (`syncCallable`), whether `input` is a required argument, and whether the
|
|
10
|
+
* workflow is apply-mode (`requiresClientApply`) — rather than each language
|
|
11
|
+
* renderer re-deriving it from the TOML. This module is that
|
|
12
|
+
* single source: both renderers call `describeWorkflowInvoker` and read the
|
|
13
|
+
* SAME `WorkflowInvokerIR`, so the two clients can never disagree on which
|
|
14
|
+
* operations a workflow exposes or whether its input is required.
|
|
15
|
+
*
|
|
16
|
+
* What stays language-specific (and is therefore NOT in the IR): the emitted
|
|
17
|
+
* identifiers (the TS and Swift base names come from different naming helpers)
|
|
18
|
+
* and the rendered type declarations. The IR carries only the parsed schemas +
|
|
19
|
+
* the neutral operation flags; each renderer turns the schemas into its own
|
|
20
|
+
* syntax.
|
|
21
|
+
*/
|
|
22
|
+
/**
|
|
23
|
+
* Prefix marking a platform-owned workflow key (mirrors the server's
|
|
24
|
+
* `INTERNAL_WORKFLOW_KEY_PREFIX`; inlined because the CLI cannot import from
|
|
25
|
+
* `src/`). Such workflows are never client-invocable and are skipped. This is
|
|
26
|
+
* the single copy the TS and Swift generators now share.
|
|
27
|
+
*/
|
|
28
|
+
export declare const INTERNAL_WORKFLOW_KEY_PREFIX = "__internal.";
|
|
29
|
+
/** Raw inputs a renderer already has on hand for one workflow TOML. */
|
|
30
|
+
export interface WorkflowInvokerSource {
|
|
31
|
+
/** Source `.toml` filename stem (fallback key when `[workflow].key` is absent). */
|
|
32
|
+
fileStem: string;
|
|
33
|
+
/** Raw TOML content (already read from disk). */
|
|
34
|
+
tomlContent: string;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Language-neutral description of one workflow's invoker surface. Consumed by
|
|
38
|
+
* both the TS and Swift invoker renderers; neither reconstructs these decisions
|
|
39
|
+
* on its own.
|
|
40
|
+
*/
|
|
41
|
+
export interface WorkflowInvokerIR {
|
|
42
|
+
/**
|
|
43
|
+
* The ORIGINAL workflow key. The runtime call always passes this verbatim —
|
|
44
|
+
* only emitted identifiers are sanitized (per language).
|
|
45
|
+
*/
|
|
46
|
+
key: string;
|
|
47
|
+
/**
|
|
48
|
+
* Whether the workflow is sync-callable. `runSync` is emitted ONLY when this
|
|
49
|
+
* is true (the server rejects run-sync for non-sync-callable workflows), on
|
|
50
|
+
* both clients.
|
|
51
|
+
*/
|
|
52
|
+
syncCallable: boolean;
|
|
53
|
+
/**
|
|
54
|
+
* Whether `input` is a REQUIRED argument. True iff the input schema rejects
|
|
55
|
+
* the empty object `{}` (the client's `input ?? {}` fallback would then fail
|
|
56
|
+
* validation). A schema-less workflow accepts anything → optional. Computed
|
|
57
|
+
* ONCE here via `schemaRejectsEmptyObject`, shared with both renderers.
|
|
58
|
+
*/
|
|
59
|
+
inputRequired: boolean;
|
|
60
|
+
/**
|
|
61
|
+
* Whether the workflow is apply-mode — its completed run waits for a client
|
|
62
|
+
* to apply the output. Mirrors the server's default: apply-mode unless the
|
|
63
|
+
* TOML sets `requiresClientApply = false` (`src/workflows/app-workflow.ts`).
|
|
64
|
+
* Only an apply-mode workflow gets a `define` member on the generated
|
|
65
|
+
* invoker (issue #1543). Parsed here, alongside `syncCallable`, so no
|
|
66
|
+
* renderer reparses the TOML for it.
|
|
67
|
+
*/
|
|
68
|
+
requiresClientApply: boolean;
|
|
69
|
+
/** Parsed input schema, or `undefined` when absent. */
|
|
70
|
+
inputSchema: unknown;
|
|
71
|
+
/** Parsed output schema, or `undefined` when absent. */
|
|
72
|
+
outputSchema: unknown;
|
|
73
|
+
}
|
|
74
|
+
/** True for a platform-owned (reserved) workflow key. */
|
|
75
|
+
export declare function isReservedWorkflowKey(key: string): boolean;
|
|
76
|
+
/**
|
|
77
|
+
* Parse one workflow TOML into the shared invoker IR. Returns `null` for a
|
|
78
|
+
* reserved (`__internal.*`) workflow (no invoker is generated). Throws on
|
|
79
|
+
* malformed schema JSON (fail-and-exit) — the honest `undefined`/`unknown`
|
|
80
|
+
* fallback is for valid-but-untypeable schemas only.
|
|
81
|
+
*
|
|
82
|
+
* This is the ONE place that reads `syncCallable` / `requiresClientApply` and
|
|
83
|
+
* computes required-vs-optional `input`; both language generators call it.
|
|
84
|
+
*/
|
|
85
|
+
export declare function describeWorkflowInvoker(source: WorkflowInvokerSource): WorkflowInvokerIR | null;
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared workflow-invoker IR (issue #1547, Phase 3).
|
|
3
|
+
*
|
|
4
|
+
* The typed invoker factory is generated on BOTH the TypeScript side
|
|
5
|
+
* (`workflow-codegen/generator.ts`) and the Swift side
|
|
6
|
+
* (`swift-codegen/generator.ts`). The maintainer decision (item 5, binding)
|
|
7
|
+
* requires that invoker generation reuse ONE description of the workflow's
|
|
8
|
+
* operation metadata — the runtime key, whether `runSync` is emitted
|
|
9
|
+
* (`syncCallable`), whether `input` is a required argument, and whether the
|
|
10
|
+
* workflow is apply-mode (`requiresClientApply`) — rather than each language
|
|
11
|
+
* renderer re-deriving it from the TOML. This module is that
|
|
12
|
+
* single source: both renderers call `describeWorkflowInvoker` and read the
|
|
13
|
+
* SAME `WorkflowInvokerIR`, so the two clients can never disagree on which
|
|
14
|
+
* operations a workflow exposes or whether its input is required.
|
|
15
|
+
*
|
|
16
|
+
* What stays language-specific (and is therefore NOT in the IR): the emitted
|
|
17
|
+
* identifiers (the TS and Swift base names come from different naming helpers)
|
|
18
|
+
* and the rendered type declarations. The IR carries only the parsed schemas +
|
|
19
|
+
* the neutral operation flags; each renderer turns the schemas into its own
|
|
20
|
+
* syntax.
|
|
21
|
+
*/
|
|
22
|
+
import { parseConfigToml } from "../config-toml.js";
|
|
23
|
+
import { safeJsonParse } from "../workflow-payload.js";
|
|
24
|
+
import { schemaRejectsEmptyObject } from "./schemaToTs.js";
|
|
25
|
+
/**
|
|
26
|
+
* Prefix marking a platform-owned workflow key (mirrors the server's
|
|
27
|
+
* `INTERNAL_WORKFLOW_KEY_PREFIX`; inlined because the CLI cannot import from
|
|
28
|
+
* `src/`). Such workflows are never client-invocable and are skipped. This is
|
|
29
|
+
* the single copy the TS and Swift generators now share.
|
|
30
|
+
*/
|
|
31
|
+
export const INTERNAL_WORKFLOW_KEY_PREFIX = "__internal.";
|
|
32
|
+
/** True for a platform-owned (reserved) workflow key. */
|
|
33
|
+
export function isReservedWorkflowKey(key) {
|
|
34
|
+
return (typeof key === "string" &&
|
|
35
|
+
key.trim().toLowerCase().startsWith(INTERNAL_WORKFLOW_KEY_PREFIX));
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Parse one workflow TOML into the shared invoker IR. Returns `null` for a
|
|
39
|
+
* reserved (`__internal.*`) workflow (no invoker is generated). Throws on
|
|
40
|
+
* malformed schema JSON (fail-and-exit) — the honest `undefined`/`unknown`
|
|
41
|
+
* fallback is for valid-but-untypeable schemas only.
|
|
42
|
+
*
|
|
43
|
+
* This is the ONE place that reads `syncCallable` / `requiresClientApply` and
|
|
44
|
+
* computes required-vs-optional `input`; both language generators call it.
|
|
45
|
+
*/
|
|
46
|
+
export function describeWorkflowInvoker(source) {
|
|
47
|
+
const data = parseConfigToml(source.tomlContent);
|
|
48
|
+
const workflow = data?.workflow ?? {};
|
|
49
|
+
const key = typeof workflow.key === "string" && workflow.key.length > 0
|
|
50
|
+
? workflow.key
|
|
51
|
+
: source.fileStem;
|
|
52
|
+
if (isReservedWorkflowKey(key))
|
|
53
|
+
return null;
|
|
54
|
+
// safeJsonParse throws on invalid JSON in a schema string — let it bubble.
|
|
55
|
+
const inputSchema = safeJsonParse(workflow.inputSchema);
|
|
56
|
+
const outputSchema = safeJsonParse(workflow.outputSchema);
|
|
57
|
+
return {
|
|
58
|
+
key,
|
|
59
|
+
syncCallable: workflow.syncCallable === true,
|
|
60
|
+
// `input` is required iff the schema rejects the client's `{}` fallback.
|
|
61
|
+
// A schema-less workflow (`undefined`) accepts anything → optional.
|
|
62
|
+
inputRequired: inputSchema !== undefined && schemaRejectsEmptyObject(inputSchema),
|
|
63
|
+
// Apply-mode unless explicitly disabled — the same `!== false` default the
|
|
64
|
+
// server applies when it decides whether a completed run needs a client
|
|
65
|
+
// apply. An absent key means apply-mode.
|
|
66
|
+
requiresClientApply: workflow.requiresClientApply !== false,
|
|
67
|
+
inputSchema,
|
|
68
|
+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YAAY,CAAC,CAAC;IAE1D,OAAO;QACL,GAAG;QACH,YAAY,EAAE,QAAQ,CAAC,YAAY,KAAK,IAAI;QAC5C,yEAAyE;QACzE,oEAAoE;QACpE,aAAa,EACX,WAAW,KAAK,SAAS,IAAI,wBAAwB,CAAC,WAAW,CAAC;QACpE,2EAA2E;QAC3E,wEAAwE;QACxE,yCAAyC;QACzC,mBAAmB,EAAE,QAAQ,CAAC,mBAAmB,KAAK,KAAK;QAC3D,WAAW;QACX,YAAY;KACb,CAAC;AACJ,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "primitive-admin",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.55",
|
|
4
4
|
"description": "CLI for administering Primitive applications",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -22,7 +22,9 @@
|
|
|
22
22
|
"gen:allowlist:check": "node scripts/gen-allowlist.mjs --check",
|
|
23
23
|
"gen:workflow-descriptor": "node scripts/gen-workflow-schema-descriptor.mjs",
|
|
24
24
|
"gen:workflow-descriptor:check": "node scripts/gen-workflow-schema-descriptor.mjs --check",
|
|
25
|
-
"
|
|
25
|
+
"gen:operation-def-descriptor": "node scripts/gen-operation-def-descriptor.mjs",
|
|
26
|
+
"gen:operation-def-descriptor:check": "node scripts/gen-operation-def-descriptor.mjs --check",
|
|
27
|
+
"prebuild": "node scripts/gen-allowlist.mjs && node scripts/gen-workflow-schema-descriptor.mjs && node scripts/gen-operation-def-descriptor.mjs",
|
|
26
28
|
"build": "tsc",
|
|
27
29
|
"typecheck": "tsc --noEmit",
|
|
28
30
|
"prepublishOnly": "pnpm run build",
|