primitive-admin 1.0.54 → 1.0.56
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/assets/skill/skills/primitive-platform/SKILL.md +230 -2
- package/dist/bin/primitive.js +3 -1
- 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/database-types.js +4 -4
- package/dist/src/commands/database-types.js.map +1 -1
- package/dist/src/commands/databases.js +35 -14
- 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/guides.d.ts +15 -12
- package/dist/src/commands/guides.js +22 -15
- package/dist/src/commands/guides.js.map +1 -1
- package/dist/src/commands/metadata.js +48 -3
- package/dist/src/commands/metadata.js.map +1 -1
- package/dist/src/commands/scripts.d.ts +18 -0
- package/dist/src/commands/scripts.js +59 -5
- package/dist/src/commands/scripts.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 +115 -0
- package/dist/src/commands/sync-app-settings.js +379 -0
- package/dist/src/commands/sync-app-settings.js.map +1 -0
- package/dist/src/commands/sync.d.ts +134 -19
- package/dist/src/commands/sync.js +1949 -600
- package/dist/src/commands/sync.js.map +1 -1
- package/dist/src/commands/workflows.js +54 -15
- package/dist/src/commands/workflows.js.map +1 -1
- package/dist/src/lib/api-client.d.ts +29 -1
- package/dist/src/lib/api-client.js +31 -2
- 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 +254 -0
- package/dist/src/lib/app-settings-descriptor.js.map +1 -0
- package/dist/src/lib/codegen-shared/generatedFiles.d.ts +36 -0
- package/dist/src/lib/codegen-shared/generatedFiles.js +67 -10
- package/dist/src/lib/codegen-shared/generatedFiles.js.map +1 -1
- package/dist/src/lib/codegen-shared/prettierStable.d.ts +262 -0
- package/dist/src/lib/codegen-shared/prettierStable.js +610 -0
- package/dist/src/lib/codegen-shared/prettierStable.js.map +1 -0
- package/dist/src/lib/db-codegen/dbGenerator.d.ts +11 -83
- package/dist/src/lib/db-codegen/dbGenerator.js +96 -556
- package/dist/src/lib/db-codegen/dbGenerator.js.map +1 -1
- package/dist/src/lib/db-codegen/dbNaming.d.ts +20 -7
- package/dist/src/lib/db-codegen/dbNaming.js +31 -13
- package/dist/src/lib/db-codegen/dbNaming.js.map +1 -1
- package/dist/src/lib/db-codegen/dbTemplates.d.ts +70 -4
- package/dist/src/lib/db-codegen/dbTemplates.js +244 -70
- package/dist/src/lib/db-codegen/dbTemplates.js.map +1 -1
- package/dist/src/lib/db-codegen/dbTsTypes.d.ts +13 -22
- package/dist/src/lib/db-codegen/dbTsTypes.js +33 -28
- package/dist/src/lib/db-codegen/dbTsTypes.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 +112 -0
- package/dist/src/lib/db-codegen/generated-operation-def-descriptor.js +211 -0
- package/dist/src/lib/db-codegen/generated-operation-def-descriptor.js.map +1 -0
- package/dist/src/lib/generated-allowlist.js +7 -0
- package/dist/src/lib/generated-allowlist.js.map +1 -1
- package/dist/src/lib/platform-owned.d.ts +37 -0
- package/dist/src/lib/platform-owned.js +46 -0
- package/dist/src/lib/platform-owned.js.map +1 -0
- package/dist/src/lib/swift-codegen/dbGenerator.d.ts +100 -0
- package/dist/src/lib/swift-codegen/dbGenerator.js +682 -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 +85 -0
- package/dist/src/lib/swift-codegen/generator.js +266 -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/siblingSymbols.d.ts +90 -0
- package/dist/src/lib/swift-codegen/siblingSymbols.js +152 -0
- package/dist/src/lib/swift-codegen/siblingSymbols.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 +437 -0
- package/dist/src/lib/sync-resource-types.js +781 -0
- package/dist/src/lib/sync-resource-types.js.map +1 -0
- package/dist/src/lib/template.d.ts +1 -1
- package/dist/src/lib/template.js +6 -3
- package/dist/src/lib/template.js.map +1 -1
- package/dist/src/lib/toml-metadata-config.js +18 -0
- package/dist/src/lib/toml-metadata-config.js.map +1 -1
- package/dist/src/lib/workflow-apply.js +12 -2
- package/dist/src/lib/workflow-apply.js.map +1 -1
- package/dist/src/lib/workflow-codegen/generator.d.ts +27 -5
- package/dist/src/lib/workflow-codegen/generator.js +214 -68
- package/dist/src/lib/workflow-codegen/generator.js.map +1 -1
- package/dist/src/lib/workflow-codegen/invokerIR.d.ts +83 -0
- package/dist/src/lib/workflow-codegen/invokerIR.js +71 -0
- package/dist/src/lib/workflow-codegen/invokerIR.js.map +1 -0
- package/dist/src/lib/workflow-codegen/schemaToTs.d.ts +17 -1
- package/dist/src/lib/workflow-codegen/schemaToTs.js +59 -38
- package/dist/src/lib/workflow-codegen/schemaToTs.js.map +1 -1
- package/dist/src/lib/workflow-payload.d.ts +19 -0
- package/dist/src/lib/workflow-payload.js +21 -0
- package/dist/src/lib/workflow-payload.js.map +1 -1
- package/dist/src/lib/workflow-toml-validator.d.ts +30 -0
- package/dist/src/lib/workflow-toml-validator.js +206 -0
- package/dist/src/lib/workflow-toml-validator.js.map +1 -1
- package/dist/src/types/index.d.ts +1 -0
- package/package.json +5 -2
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GENERATED FILE — DO NOT EDIT BY HAND.
|
|
3
|
+
*
|
|
4
|
+
* Vendored byte-for-byte from the canonical server module
|
|
5
|
+
* `src/app-api/controllers/operation-definition-descriptor.ts` — the SAME
|
|
6
|
+
* allow-lists the server validator (`validateDefinition` / `validateParams`)
|
|
7
|
+
* enforces. The client operation-definition types
|
|
8
|
+
* (`src/client/api/operationDefinition.ts`) hand-author the matching union;
|
|
9
|
+
* a key-parity test compares them against this committed copy.
|
|
10
|
+
*
|
|
11
|
+
* Regenerate with:
|
|
12
|
+
* node cli/scripts/gen-operation-def-descriptor.mjs (runs at CLI prebuild)
|
|
13
|
+
*
|
|
14
|
+
* A CI freshness guard
|
|
15
|
+
* (`cli/scripts/gen-operation-def-descriptor.mjs --check`, also asserted by
|
|
16
|
+
* `cli/tests/unit/operation-def-descriptor-drift-guard.test.ts`) fails if
|
|
17
|
+
* this committed copy does not match the source — see issue #1544 / #1442.
|
|
18
|
+
*/
|
|
19
|
+
/**
|
|
20
|
+
* Canonical, dependency-free descriptor of the database operation-definition
|
|
21
|
+
* schema (issue #1544).
|
|
22
|
+
*
|
|
23
|
+
* The server validator (`validateDefinition` / `validateParams` in
|
|
24
|
+
* `database-type-operations-controller.ts`) and the CLIENT operation-definition
|
|
25
|
+
* types (`src/client/api/operationDefinition.ts`, consumed by
|
|
26
|
+
* `createOperation` / `updateOperation` / `DatabaseOperationInfo`) must agree on
|
|
27
|
+
* the set of operation types and the allowed keys for each definition shape —
|
|
28
|
+
* otherwise a hand-authored `OperationDefinition` member promises a key the
|
|
29
|
+
* runtime rejects (or omits one the runtime accepts).
|
|
30
|
+
*
|
|
31
|
+
* This module is the single source of that declarative contract: the op-type
|
|
32
|
+
* list, the per-type allowed definition-key sets, the per-type mutation/action
|
|
33
|
+
* op-name enums, and the param-schema key/type enums. The validator imports
|
|
34
|
+
* these constants directly (so a change here changes what the server enforces),
|
|
35
|
+
* and the CLI vendors a byte-for-byte copy as a committed artifact via
|
|
36
|
+
* `cli/scripts/gen-operation-def-descriptor.mjs` (the #1442 workflow
|
|
37
|
+
* schema-descriptor pattern). A drift-guard test runs that generator in
|
|
38
|
+
* `--check` mode, and a key-parity test asserts the hand-authored client type
|
|
39
|
+
* members' keys equal the corresponding allow-lists here — so the validator and
|
|
40
|
+
* the client types can never silently diverge. The CLI never imports server
|
|
41
|
+
* `src/` at runtime; only the build-time generator reads this file.
|
|
42
|
+
*
|
|
43
|
+
* The value-shape checks that are NOT purely declarative (requiredness, nested
|
|
44
|
+
* object structure, CEL parsing) stay imperative in the validator. This
|
|
45
|
+
* descriptor captures the declarative allow-lists — the part that is genuinely
|
|
46
|
+
* shared between the runtime boundary and the descriptive client types.
|
|
47
|
+
*
|
|
48
|
+
* Ordering is significant: the validator joins these arrays into its 400-level
|
|
49
|
+
* error messages (`Must be one of: ${X.join(", ")}`), so reordering an array
|
|
50
|
+
* changes an error string. Keep entries in their current order.
|
|
51
|
+
*/
|
|
52
|
+
/** The operation `type` values accepted by `createOperation` / `updateOperation`. */
|
|
53
|
+
export const OPERATION_TYPES = [
|
|
54
|
+
"query",
|
|
55
|
+
"mutation",
|
|
56
|
+
"count",
|
|
57
|
+
"aggregate",
|
|
58
|
+
"pipeline",
|
|
59
|
+
"applyToQuery",
|
|
60
|
+
];
|
|
61
|
+
// ── Per-type definition key allow-lists ──
|
|
62
|
+
/** Allowed top-level keys in a `query` definition. `cache` (#1247) is query-only. */
|
|
63
|
+
export const QUERY_DEF_KEYS = [
|
|
64
|
+
"filter",
|
|
65
|
+
"sort",
|
|
66
|
+
"limit",
|
|
67
|
+
"projection",
|
|
68
|
+
"include",
|
|
69
|
+
"cache",
|
|
70
|
+
];
|
|
71
|
+
/** Allowed top-level keys in a `mutation` definition. */
|
|
72
|
+
export const MUTATION_DEF_KEYS = ["operations"];
|
|
73
|
+
/** Allowed top-level keys in a `count` definition. */
|
|
74
|
+
export const COUNT_DEF_KEYS = ["filter"];
|
|
75
|
+
/** Allowed top-level keys in an `aggregate` definition. */
|
|
76
|
+
export const AGGREGATE_DEF_KEYS = [
|
|
77
|
+
"groupBy",
|
|
78
|
+
"operations",
|
|
79
|
+
"filter",
|
|
80
|
+
"limit",
|
|
81
|
+
"sort",
|
|
82
|
+
];
|
|
83
|
+
/** Allowed top-level keys in a `pipeline` definition. */
|
|
84
|
+
export const PIPELINE_DEF_KEYS = ["steps", "return"];
|
|
85
|
+
/** Allowed top-level keys in an `applyToQuery` definition. */
|
|
86
|
+
export const APPLY_TO_QUERY_DEF_KEYS = ["source", "action"];
|
|
87
|
+
// ── Op-name enums nested inside definitions ──
|
|
88
|
+
/** Mutation op names allowed in a `mutation` definition's `operations[]`. */
|
|
89
|
+
export const MUTATION_OPS = [
|
|
90
|
+
"save",
|
|
91
|
+
"patch",
|
|
92
|
+
"delete",
|
|
93
|
+
"increment",
|
|
94
|
+
"addToSet",
|
|
95
|
+
"removeFromSet",
|
|
96
|
+
];
|
|
97
|
+
/**
|
|
98
|
+
* Aggregate op `type` names allowed in an `aggregate` definition's
|
|
99
|
+
* `operations[]`.
|
|
100
|
+
*/
|
|
101
|
+
export const AGGREGATE_OP_TYPES = [
|
|
102
|
+
"count",
|
|
103
|
+
"sum",
|
|
104
|
+
"avg",
|
|
105
|
+
"min",
|
|
106
|
+
"max",
|
|
107
|
+
];
|
|
108
|
+
/**
|
|
109
|
+
* Allowed keys on a single nested aggregate op (an entry in an `aggregate`
|
|
110
|
+
* definition's `operations[]`, and in a pipeline `aggregate` step's
|
|
111
|
+
* `operations[]`). Only `type` and `field` are honored by the runtime — the
|
|
112
|
+
* aggregate SELECT always aliases columns to the fixed output names
|
|
113
|
+
* (`count` / `<type>_<field>`), so there is no supported way to rename an
|
|
114
|
+
* output. `outputField` was historically accepted here but read by no code
|
|
115
|
+
* (issue #1767); any key outside this list is now rejected at registration so
|
|
116
|
+
* dead config can't be silently stored.
|
|
117
|
+
*/
|
|
118
|
+
export const AGGREGATE_OP_KEYS = ["type", "field"];
|
|
119
|
+
/**
|
|
120
|
+
* `applyToQuery` action ops. Only mutation ops that operate on existing matched
|
|
121
|
+
* records — `save` is excluded because it makes no sense in a find-and-mutate
|
|
122
|
+
* flow.
|
|
123
|
+
*/
|
|
124
|
+
export const APPLY_TO_QUERY_ACTIONS = [
|
|
125
|
+
"delete",
|
|
126
|
+
"patch",
|
|
127
|
+
"increment",
|
|
128
|
+
"addToSet",
|
|
129
|
+
"removeFromSet",
|
|
130
|
+
];
|
|
131
|
+
/** Allowed keys in an `applyToQuery` `source` block. */
|
|
132
|
+
export const APPLY_TO_QUERY_SOURCE_KEYS = [
|
|
133
|
+
"filter",
|
|
134
|
+
"sort",
|
|
135
|
+
"limit",
|
|
136
|
+
];
|
|
137
|
+
/** Allowed keys in an `applyToQuery` `action` block. */
|
|
138
|
+
export const APPLY_TO_QUERY_ACTION_KEYS = [
|
|
139
|
+
"op",
|
|
140
|
+
"data",
|
|
141
|
+
"fields",
|
|
142
|
+
"stringSets",
|
|
143
|
+
];
|
|
144
|
+
// ── Pipeline step allow-lists ──
|
|
145
|
+
/** Step `type` values allowed inside a `pipeline` definition's `steps[]`. */
|
|
146
|
+
export const PIPELINE_STEP_TYPES = [
|
|
147
|
+
"query",
|
|
148
|
+
"count",
|
|
149
|
+
"aggregate",
|
|
150
|
+
];
|
|
151
|
+
/** Allowed keys on a pipeline `query` step. */
|
|
152
|
+
export const PIPELINE_QUERY_STEP_KEYS = [
|
|
153
|
+
"name",
|
|
154
|
+
"type",
|
|
155
|
+
"modelName",
|
|
156
|
+
"filter",
|
|
157
|
+
"sort",
|
|
158
|
+
"limit",
|
|
159
|
+
"projection",
|
|
160
|
+
"include",
|
|
161
|
+
];
|
|
162
|
+
/** Allowed keys on a pipeline `count` step. */
|
|
163
|
+
export const PIPELINE_COUNT_STEP_KEYS = [
|
|
164
|
+
"name",
|
|
165
|
+
"type",
|
|
166
|
+
"modelName",
|
|
167
|
+
"filter",
|
|
168
|
+
];
|
|
169
|
+
/** Allowed keys on a pipeline `aggregate` step. */
|
|
170
|
+
export const PIPELINE_AGGREGATE_STEP_KEYS = [
|
|
171
|
+
"name",
|
|
172
|
+
"type",
|
|
173
|
+
"modelName",
|
|
174
|
+
"groupBy",
|
|
175
|
+
"operations",
|
|
176
|
+
"filter",
|
|
177
|
+
"limit",
|
|
178
|
+
"sort",
|
|
179
|
+
];
|
|
180
|
+
// ── Param-schema enums ──
|
|
181
|
+
/**
|
|
182
|
+
* Built-in param types. `integer` (#1488) is accepted here and by the runtime
|
|
183
|
+
* coercion path. `array` (#1488) declares a list param with a scalar `items`
|
|
184
|
+
* element type. Keep in step with the runtime coercion list
|
|
185
|
+
* (`MODEL_PARAM_SCALAR_TYPES` in `database-operations-controller.ts`).
|
|
186
|
+
*/
|
|
187
|
+
export const PARAM_TYPES = [
|
|
188
|
+
"string",
|
|
189
|
+
"number",
|
|
190
|
+
"boolean",
|
|
191
|
+
"integer",
|
|
192
|
+
"object",
|
|
193
|
+
"array",
|
|
194
|
+
];
|
|
195
|
+
/** Scalar element types allowed for an `array` param's `items` (#1488). */
|
|
196
|
+
export const ARRAY_ELEMENT_TYPES = [
|
|
197
|
+
"string",
|
|
198
|
+
"number",
|
|
199
|
+
"boolean",
|
|
200
|
+
"integer",
|
|
201
|
+
];
|
|
202
|
+
/** Allowed keys in a single param definition. */
|
|
203
|
+
export const PARAM_DEF_KEYS = [
|
|
204
|
+
"type",
|
|
205
|
+
"required",
|
|
206
|
+
"access",
|
|
207
|
+
"coerce",
|
|
208
|
+
"enum",
|
|
209
|
+
"items",
|
|
210
|
+
];
|
|
211
|
+
//# sourceMappingURL=generated-operation-def-descriptor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generated-operation-def-descriptor.js","sourceRoot":"","sources":["../../../../src/lib/db-codegen/generated-operation-def-descriptor.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AAEH,qFAAqF;AACrF,MAAM,CAAC,MAAM,eAAe,GAAsB;IAChD,OAAO;IACP,UAAU;IACV,OAAO;IACP,WAAW;IACX,UAAU;IACV,cAAc;CACf,CAAC;AAEF,4CAA4C;AAE5C,qFAAqF;AACrF,MAAM,CAAC,MAAM,cAAc,GAAsB;IAC/C,QAAQ;IACR,MAAM;IACN,OAAO;IACP,YAAY;IACZ,SAAS;IACT,OAAO;CACR,CAAC;AAEF,yDAAyD;AACzD,MAAM,CAAC,MAAM,iBAAiB,GAAsB,CAAC,YAAY,CAAC,CAAC;AAEnE,sDAAsD;AACtD,MAAM,CAAC,MAAM,cAAc,GAAsB,CAAC,QAAQ,CAAC,CAAC;AAE5D,2DAA2D;AAC3D,MAAM,CAAC,MAAM,kBAAkB,GAAsB;IACnD,SAAS;IACT,YAAY;IACZ,QAAQ;IACR,OAAO;IACP,MAAM;CACP,CAAC;AAEF,yDAAyD;AACzD,MAAM,CAAC,MAAM,iBAAiB,GAAsB,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;AAExE,8DAA8D;AAC9D,MAAM,CAAC,MAAM,uBAAuB,GAAsB,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;AAE/E,gDAAgD;AAEhD,6EAA6E;AAC7E,MAAM,CAAC,MAAM,YAAY,GAAsB;IAC7C,MAAM;IACN,OAAO;IACP,QAAQ;IACR,WAAW;IACX,UAAU;IACV,eAAe;CAChB,CAAC;AAEF;;;GAGG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAsB;IACnD,OAAO;IACP,KAAK;IACL,KAAK;I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Q;IACR,SAAS;IACT,SAAS;CACV,CAAC;AAEF,iDAAiD;AACjD,MAAM,CAAC,MAAM,cAAc,GAAsB;IAC/C,MAAM;IACN,UAAU;IACV,QAAQ;IACR,QAAQ;IACR,MAAM;IACN,OAAO;CACR,CAAC"}
|
|
@@ -88,10 +88,12 @@ export const GENERATED_ALLOWLISTED_FIELDS = [
|
|
|
88
88
|
"idempotencyKey",
|
|
89
89
|
"includeRoot",
|
|
90
90
|
"includeUserDetails",
|
|
91
|
+
"initialMetadata",
|
|
91
92
|
"input",
|
|
92
93
|
"integrationKey",
|
|
93
94
|
"itemsField",
|
|
94
95
|
"iterationName",
|
|
96
|
+
"key",
|
|
95
97
|
"kind",
|
|
96
98
|
"limit",
|
|
97
99
|
"limits",
|
|
@@ -166,6 +168,7 @@ export const GENERATED_ALLOWLISTED_FIELDS = [
|
|
|
166
168
|
"userId",
|
|
167
169
|
"userInfo",
|
|
168
170
|
"userUlid",
|
|
171
|
+
"value",
|
|
169
172
|
"variables",
|
|
170
173
|
"version",
|
|
171
174
|
"windowDays",
|
|
@@ -201,6 +204,7 @@ export const GENERATED_KNOWN_KINDS = [
|
|
|
201
204
|
"delay",
|
|
202
205
|
"document.bulkUpdate",
|
|
203
206
|
"document.count",
|
|
207
|
+
"document.create",
|
|
204
208
|
"document.delete",
|
|
205
209
|
"document.getForUser",
|
|
206
210
|
"document.getOrCreateWithAliasForUser",
|
|
@@ -231,7 +235,9 @@ export const GENERATED_KNOWN_KINDS = [
|
|
|
231
235
|
"integration.call",
|
|
232
236
|
"iterate-users",
|
|
233
237
|
"llm.chat",
|
|
238
|
+
"metadata.delete",
|
|
234
239
|
"metadata.read",
|
|
240
|
+
"metadata.resolve",
|
|
235
241
|
"metadata.write",
|
|
236
242
|
"noop",
|
|
237
243
|
"notification.send",
|
|
@@ -242,6 +248,7 @@ export const GENERATED_KNOWN_KINDS = [
|
|
|
242
248
|
"transform",
|
|
243
249
|
"user.get",
|
|
244
250
|
"user.resolve",
|
|
251
|
+
"workflow-lifecycle-step",
|
|
245
252
|
"workflow.call",
|
|
246
253
|
];
|
|
247
254
|
//# sourceMappingURL=generated-allowlist.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generated-allowlist.js","sourceRoot":"","sources":["../../../src/lib/generated-allowlist.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,2EAA2E;AAC3E,MAAM,CAAC,MAAM,4BAA4B,GAAsB;IAC7D,kBAAkB;IAClB,YAAY;IACZ,QAAQ;IACR,UAAU;IACV,OAAO;IACP,IAAI;IACJ,UAAU;IACV,aAAa;IACb,QAAQ;IACR,SAAS;IACT,UAAU;IACV,WAAW;IACX,MAAM;IACN,UAAU;IACV,UAAU;IACV,WAAW;IACX,iBAAiB;IACjB,OAAO;IACP,UAAU;IACV,UAAU;IACV,YAAY;IACZ,cAAc;IACd,gBAAgB;IAChB,aAAa;IACb,UAAU;IACV,SAAS;IACT,eAAe;IACf,aAAa;IACb,SAAS;IACT,WAAW;IACX,iBAAiB;IACjB,QAAQ;IACR,QAAQ;IACR,aAAa;IACb,MAAM;IACN,YAAY;IACZ,cAAc;IACd,UAAU;IACV,SAAS;IACT,aAAa;IACb,WAAW;IACX,eAAe;IACf,YAAY;IACZ,QAAQ;IACR,YAAY;IACZ,OAAO;IACP,QAAQ;IACR,WAAW;IACX,kBAAkB;IAClB,SAAS;IACT,UAAU;IACV,QAAQ;IACR,SAAS;IACT,SAAS;IACT,SAAS;IACT,SAAS;IACT,SAAS;IACT,WAAW;IACX,UAAU;IACV,SAAS;IACT,IAAI;IACJ,gBAAgB;IAChB,aAAa;IACb,oBAAoB;IACpB,OAAO;IACP,gBAAgB;IAChB,YAAY;IACZ,eAAe;IACf,MAAM;IACN,OAAO;IACP,QAAQ;IACR,UAAU;IACV,UAAU;IACV,SAAS;IACT,UAAU;IACV,UAAU;IACV,SAAS;IACT,OAAO;IACP,WAAW;IACX,eAAe;IACf,IAA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AAyB;IACzB,4BAA4B;IAC5B,uBAAuB;IACvB,sBAAsB;IACtB,gBAAgB;IAChB,gBAAgB;IAChB,mBAAmB;IACnB,uBAAuB;IACvB,8BAA8B;IAC9B,eAAe;IACf,YAAY;IACZ,YAAY;IACZ,oBAAoB;IACpB,iBAAiB;IACjB,oBAAoB;IACpB,iBAAiB;IACjB,uBAAuB;IACvB,cAAc;IACd,cAAc;IACd,mBAAmB;IACnB,2BAA2B;IAC3B,iBAAiB;IACjB,oBAAoB;IACpB,MAAM;IACN,kBAAkB;IAClB,eAAe;IACf,UAAU;IACV,eAAe;IACf,gBAAgB;IAChB,MAAM;IACN,mBAAmB;IACnB,gBAAgB;IAChB,QAAQ;IACR,QAAQ;IACR,QAAQ;IACR,WAAW;IACX,UAAU;IACV,cAAc;IACd,eAAe;CAChB,CAAC"}
|
|
1
|
+
{"version":3,"file":"generated-allowlist.js","sourceRoot":"","sources":["../../../src/lib/generated-allowlist.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,2EAA2E;AAC3E,MAAM,CAAC,MAAM,4BAA4B,GAAsB;IAC7D,kBAAkB;IAClB,YAAY;IACZ,QAAQ;IACR,UAAU;IACV,OAAO;IACP,IAAI;IACJ,UAAU;IACV,aAAa;IACb,QAAQ;IACR,SAAS;IACT,UAAU;IACV,WAAW;IACX,MAAM;IACN,UAAU;IACV,UAAU;IACV,WAAW;IACX,iBAAiB;IACjB,OAAO;IACP,UAAU;IACV,UAAU;IACV,YAAY;IACZ,cAAc;IACd,gBAAgB;IAChB,aAAa;IACb,UAAU;IACV,SAAS;IACT,eAAe;IACf,aAAa;IACb,SAAS;IACT,WAAW;IACX,iBAAiB;IACjB,QAAQ;IACR,QAAQ;IACR,aAAa;IACb,MAAM;IACN,YAAY;IACZ,cAAc;IACd,UAAU;IACV,SAAS;IACT,aAAa;IACb,WAAW;IACX,eAAe;IACf,YAAY;IACZ,QAAQ;IACR,YAAY;IACZ,OAAO;I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AqB,GAAsB;IACtD,iBAAiB;IACjB,iBAAiB;IACjB,wBAAwB;IACxB,aAAa;IACb,eAAe;IACf,gBAAgB;IAChB,aAAa;IACb,YAAY;IACZ,SAAS;IACT,wBAAwB;IACxB,mBAAmB;IACnB,mBAAmB;IACnB,iCAAiC;IACjC,2BAA2B;IAC3B,QAAQ;IACR,oBAAoB;IACpB,uBAAuB;IACvB,gBAAgB;IAChB,iBAAiB;IACjB,iBAAiB;IACjB,iBAAiB;IACjB,mBAAmB;IACnB,gBAAgB;IAChB,sBAAsB;IACtB,OAAO;IACP,qBAAqB;IACrB,gBAAgB;IAChB,iBAAiB;IACjB,iBAAiB;IACjB,qBAAqB;IACrB,sCAAsC;IACtC,yBAAyB;IACzB,4BAA4B;IAC5B,uBAAuB;IACvB,sBAAsB;IACtB,gBAAgB;IAChB,gBAAgB;IAChB,mBAAmB;IACnB,uBAAuB;IACvB,8BAA8B;IAC9B,eAAe;IACf,YAAY;IACZ,YAAY;IACZ,oBAAoB;IACpB,iBAAiB;IACjB,oBAAoB;IACpB,iBAAiB;IACjB,uBAAuB;IACvB,cAAc;IACd,cAAc;IACd,mBAAmB;IACnB,2BAA2B;IAC3B,iBAAiB;IACjB,oBAAoB;IACpB,MAAM;IACN,kBAAkB;IAClB,eAAe;IACf,UAAU;IACV,iBAAiB;IACjB,eAAe;IACf,kBAAkB;IAClB,gBAAgB;IAChB,MAAM;IACN,mBAAmB;IACnB,gBAAgB;IAChB,QAAQ;IACR,QAAQ;IACR,QAAQ;IACR,WAAW;IACX,UAAU;IACV,cAAc;IACd,yBAAyB;IACzB,eAAe;CAChB,CAAC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared predicate for platform-owned workflows (#1660).
|
|
3
|
+
*
|
|
4
|
+
* The platform owns workflow keys in the reserved `__internal.` namespace (see
|
|
5
|
+
* the server's `src/workflows/reserved-workflow-keys.ts`). These rows are
|
|
6
|
+
* created and managed by the platform, never authored in an app's config tree:
|
|
7
|
+
*
|
|
8
|
+
* - `sync pull` must not export them (they have no local TOML),
|
|
9
|
+
* - `sync diff` must not report them (they are not app config),
|
|
10
|
+
* - `sync push` must not upload them (the hollow export can't round-trip),
|
|
11
|
+
* - `workflows codegen` must not generate an invoker for them.
|
|
12
|
+
*
|
|
13
|
+
* The CLI cannot import from `src/`, so this module mirrors the server's prefix
|
|
14
|
+
* policy in ONE place. The codegen skip and the sync filters both call it, so
|
|
15
|
+
* they can never drift from each other or from the server.
|
|
16
|
+
*
|
|
17
|
+
* The generic cross-resource `isPlatformOwnedEntity` abstraction is deliberately
|
|
18
|
+
* NOT here — it is deferred until a second resource type has a platform-owned
|
|
19
|
+
* contract (human decision, 2026-07-17).
|
|
20
|
+
*/
|
|
21
|
+
/** Prefix marking a platform-owned workflow key (mirrors the server). */
|
|
22
|
+
export declare const INTERNAL_WORKFLOW_KEY_PREFIX = "__internal.";
|
|
23
|
+
/**
|
|
24
|
+
* True when `key` is in the platform-owned `__internal.` namespace. Trims and
|
|
25
|
+
* lowercases first (mirrors the server's `isReservedWorkflowKey`) so a padded
|
|
26
|
+
* or upper-cased value such as ` __Internal.Foo ` can't slip past the filter.
|
|
27
|
+
*/
|
|
28
|
+
export declare function isPlatformOwnedWorkflowKey(key: unknown): boolean;
|
|
29
|
+
/**
|
|
30
|
+
* True when a workflow list/detail item is platform-owned.
|
|
31
|
+
*
|
|
32
|
+
* Prefers the server's derived `platformOwned` flag (#1660) when present, then
|
|
33
|
+
* falls back to the key prefix so an older server that doesn't emit the flag is
|
|
34
|
+
* still filtered (edge case 1). `workflowKey` is the admin list-item field;
|
|
35
|
+
* `key` covers a locally-parsed `[workflow]` table.
|
|
36
|
+
*/
|
|
37
|
+
export declare function isPlatformOwnedWorkflow(item: any): boolean;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared predicate for platform-owned workflows (#1660).
|
|
3
|
+
*
|
|
4
|
+
* The platform owns workflow keys in the reserved `__internal.` namespace (see
|
|
5
|
+
* the server's `src/workflows/reserved-workflow-keys.ts`). These rows are
|
|
6
|
+
* created and managed by the platform, never authored in an app's config tree:
|
|
7
|
+
*
|
|
8
|
+
* - `sync pull` must not export them (they have no local TOML),
|
|
9
|
+
* - `sync diff` must not report them (they are not app config),
|
|
10
|
+
* - `sync push` must not upload them (the hollow export can't round-trip),
|
|
11
|
+
* - `workflows codegen` must not generate an invoker for them.
|
|
12
|
+
*
|
|
13
|
+
* The CLI cannot import from `src/`, so this module mirrors the server's prefix
|
|
14
|
+
* policy in ONE place. The codegen skip and the sync filters both call it, so
|
|
15
|
+
* they can never drift from each other or from the server.
|
|
16
|
+
*
|
|
17
|
+
* The generic cross-resource `isPlatformOwnedEntity` abstraction is deliberately
|
|
18
|
+
* NOT here — it is deferred until a second resource type has a platform-owned
|
|
19
|
+
* contract (human decision, 2026-07-17).
|
|
20
|
+
*/
|
|
21
|
+
/** Prefix marking a platform-owned workflow key (mirrors the server). */
|
|
22
|
+
export const INTERNAL_WORKFLOW_KEY_PREFIX = "__internal.";
|
|
23
|
+
/**
|
|
24
|
+
* True when `key` is in the platform-owned `__internal.` namespace. Trims and
|
|
25
|
+
* lowercases first (mirrors the server's `isReservedWorkflowKey`) so a padded
|
|
26
|
+
* or upper-cased value such as ` __Internal.Foo ` can't slip past the filter.
|
|
27
|
+
*/
|
|
28
|
+
export function isPlatformOwnedWorkflowKey(key) {
|
|
29
|
+
return (typeof key === "string" &&
|
|
30
|
+
key.trim().toLowerCase().startsWith(INTERNAL_WORKFLOW_KEY_PREFIX));
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* True when a workflow list/detail item is platform-owned.
|
|
34
|
+
*
|
|
35
|
+
* Prefers the server's derived `platformOwned` flag (#1660) when present, then
|
|
36
|
+
* falls back to the key prefix so an older server that doesn't emit the flag is
|
|
37
|
+
* still filtered (edge case 1). `workflowKey` is the admin list-item field;
|
|
38
|
+
* `key` covers a locally-parsed `[workflow]` table.
|
|
39
|
+
*/
|
|
40
|
+
export function isPlatformOwnedWorkflow(item) {
|
|
41
|
+
if (item && item.platformOwned === true)
|
|
42
|
+
return true;
|
|
43
|
+
const key = item?.workflowKey ?? item?.key;
|
|
44
|
+
return isPlatformOwnedWorkflowKey(key);
|
|
45
|
+
}
|
|
46
|
+
//# sourceMappingURL=platform-owned.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"platform-owned.js","sourceRoot":"","sources":["../../../src/lib/platform-owned.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,yEAAyE;AACzE,MAAM,CAAC,MAAM,4BAA4B,GAAG,aAAa,CAAC;AAE1D;;;;GAIG;AACH,MAAM,UAAU,0BAA0B,CAAC,GAAY;IACrD,OAAO,CACL,OAAO,GAAG,KAAK,QAAQ;QACvB,GAAG,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC,UAAU,CAAC,4BAA4B,CAAC,CAClE,CAAC;AACJ,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,uBAAuB,CAAC,IAAS;IAC/C,IAAI,IAAI,IAAI,IAAI,CAAC,aAAa,KAAK,IAAI;QAAE,OAAO,IAAI,CAAC;IACrD,MAAM,GAAG,GAAG,IAAI,EAAE,WAAW,IAAI,IAAI,EAAE,GAAG,CAAC;IAC3C,OAAO,0BAA0B,CAAC,GAAG,CAAC,CAAC;AACzC,CAAC"}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `databases codegen --lang swift` orchestrator (issue #1547, Phase 4).
|
|
3
|
+
*
|
|
4
|
+
* The Swift counterpart of `db-codegen/dbGenerator.ts`. Reads the SAME synced
|
|
5
|
+
* `database-types/*.toml` and emits ONE `<type>.generated.swift` per database
|
|
6
|
+
* type. Each file carries the type's record structs (read shape), per-op params
|
|
7
|
+
* structs (write shape), per-op result typealiases, and a typed `<Type>Ops`
|
|
8
|
+
* factory over the additive generic `executeOperation` overload on
|
|
9
|
+
* `DatabasesAPI` (the only published SDK surface for this generator).
|
|
10
|
+
*
|
|
11
|
+
* Design decisions realized (issue #1547):
|
|
12
|
+
* - Operation + record metadata (which ops exist, their params, their result
|
|
13
|
+
* descriptor, and per-model fields) is read from the SHARED `describeDbType`
|
|
14
|
+
* IR — the SAME source the TS renderer (`db-codegen/dbGenerator.ts`) reads.
|
|
15
|
+
* The Swift renderer reconstructs none of it (binding item 5), so the two
|
|
16
|
+
* clients can never disagree on a type's surface.
|
|
17
|
+
* - The generic result envelopes (`DBQueryResult<T>`, `DBMutationResult`, …)
|
|
18
|
+
* live in the JsBaoClient SDK, NOT emitted per file — a Swift package
|
|
19
|
+
* compiles all generated files into one module, so a per-file copy would
|
|
20
|
+
* collide. Generated files reference the SDK envelopes (mirrors how Phase 3
|
|
21
|
+
* put the workflow result envelopes in the SDK).
|
|
22
|
+
* - Swift has no analog of TS `Pick<M, …>` / `Partial<M>`, so a query op with
|
|
23
|
+
* a `pick`/`partial` projection types its rows as the open `JSONValue`
|
|
24
|
+
* rather than a narrowed record (the same Fork-4 "no clean analog →
|
|
25
|
+
* JSONValue" fallback the emitter uses for un-descended schema nodes). A
|
|
26
|
+
* `full` projection over a known record types as `DBQueryResult<Record>`.
|
|
27
|
+
* - Disk lifecycle (write / `--check` / orphan cleanup) delegates to the
|
|
28
|
+
* shared `writeOrCheckGeneratedFiles`, scoped by an ownership BANNER
|
|
29
|
+
* distinct from both the workflow Swift banner and the model codegen's, so
|
|
30
|
+
* a shared Swift output dir stays safe.
|
|
31
|
+
*/
|
|
32
|
+
import { type WriteOrCheckResult } from "../codegen-shared/generatedFiles.js";
|
|
33
|
+
import { type DbCodegenInput } from "../db-codegen/dbTypeIR.js";
|
|
34
|
+
/**
|
|
35
|
+
* Banner prefix stamped on every CLI-emitted database `.generated.swift` file.
|
|
36
|
+
* Distinct from both the workflow Swift banner (`// AUTO-GENERATED FROM
|
|
37
|
+
* workflows/`) and the model codegen's (`// Generated by swift-bao-codegen`),
|
|
38
|
+
* so none of the three generators' stale-sweeps ever deletes another's files
|
|
39
|
+
* when they share an output dir.
|
|
40
|
+
*/
|
|
41
|
+
export declare const DB_SWIFT_BANNER_PREFIX = "// AUTO-GENERATED FROM database-types/";
|
|
42
|
+
export interface GenerateDbSwiftTypesOptions {
|
|
43
|
+
inputs: DbCodegenInput[];
|
|
44
|
+
/** Directory where the `<type>.generated.swift` files are written. */
|
|
45
|
+
outputDir: string;
|
|
46
|
+
/** `--check`: compare against disk, do not write. */
|
|
47
|
+
check?: boolean;
|
|
48
|
+
/**
|
|
49
|
+
* Set when the run was filtered to a single database type. `inputs` is then a
|
|
50
|
+
* PARTIAL view, so orphan cleanup / stale detection is scoped to the filtered
|
|
51
|
+
* file. Mirrors the TS generator's `singleType`.
|
|
52
|
+
*/
|
|
53
|
+
singleType?: boolean;
|
|
54
|
+
}
|
|
55
|
+
/** Swift record struct type name for a model (shared naming + Swift sanitize). */
|
|
56
|
+
export declare function dbRecordSwiftTypeName(modelName: string, className: string | undefined): string;
|
|
57
|
+
/**
|
|
58
|
+
* Namespace `enum` name for a database type (issue #1687). Every symbol a type
|
|
59
|
+
* emits is nested under `public enum <Type>` (`securities-ref` →
|
|
60
|
+
* `SecuritiesRef`), so two DB types can never collide on a shared op symbol.
|
|
61
|
+
* Reuses the same `structTypeName` sanitizer (keyword suffixing + digit-leading
|
|
62
|
+
* `_` guard) the old `<Type>Ops` derivation used, so the namespace name is a
|
|
63
|
+
* legal Swift type identifier.
|
|
64
|
+
*/
|
|
65
|
+
export declare function dbNamespaceName(databaseType: string): string;
|
|
66
|
+
/**
|
|
67
|
+
* Validate that a database type's derived namespace enum name is safe to emit,
|
|
68
|
+
* and return it. Throws a named `SwiftCodegenError` (with a rename hint) for
|
|
69
|
+
* the whole class of unsafe names a server-accepted database type can produce
|
|
70
|
+
* (#1687):
|
|
71
|
+
*
|
|
72
|
+
* 1. **Degenerate `_`** — a type with no retained identifier characters
|
|
73
|
+
* (empty after sanitize, or separator/emoji/punctuation-only, e.g. `--`,
|
|
74
|
+
* `🎉`) normalizes to `_` via `structTypeName`. Swift reserves `_` as the
|
|
75
|
+
* wildcard and rejects `public enum _` (Codex [P2]).
|
|
76
|
+
* 2. **Stdlib/SDK shadowing** — a name in `RESERVED_NAMESPACE_NAMES` shadows
|
|
77
|
+
* a type the generated body references unqualified (Codex [P1]).
|
|
78
|
+
*
|
|
79
|
+
* Leading-digit residue (`123` → `_123`) and Swift reserved words (`self` →
|
|
80
|
+
* `Self_`, `any` → `Any_`) are already lifted into legal, non-shadowing
|
|
81
|
+
* identifiers by `structTypeName` (digit-leading `_` guard + keyword suffix),
|
|
82
|
+
* so they need no rejection here — only names that survive that sanitizer as
|
|
83
|
+
* `_` or as a real type identifier remain unsafe. The two in-run / retained-
|
|
84
|
+
* sibling namespace-NAME collision guards (two database types whose names
|
|
85
|
+
* normalize to the SAME enum) live in `generateDbSwiftTypes`; this check
|
|
86
|
+
* covers the single-type unsafe-name class.
|
|
87
|
+
*/
|
|
88
|
+
export declare function assertSafeNamespaceName(databaseType: string, sourceFile: string): string;
|
|
89
|
+
/**
|
|
90
|
+
* Render the full `<type>.generated.swift` content for one database-type TOML.
|
|
91
|
+
* Pure — exported so tests can assert on the string directly. Throws on a Swift
|
|
92
|
+
* record type-name collision between two models (mirrors the TS collision guard).
|
|
93
|
+
*/
|
|
94
|
+
export declare function renderDbTypeSwiftFile(input: DbCodegenInput): string;
|
|
95
|
+
/**
|
|
96
|
+
* Run Swift database codegen end-to-end. One `<type>.generated.swift` per
|
|
97
|
+
* database type; delegates the disk lifecycle to the shared writer/checker with
|
|
98
|
+
* banner-scoped ownership so a shared Swift output dir stays safe.
|
|
99
|
+
*/
|
|
100
|
+
export declare function generateDbSwiftTypes(options: GenerateDbSwiftTypesOptions): Promise<WriteOrCheckResult>;
|