primitive-admin 1.0.52 → 1.0.54
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 +38 -10
- package/dist/bin/primitive.js +6 -0
- package/dist/bin/primitive.js.map +1 -1
- package/dist/src/commands/auth.js +16 -6
- package/dist/src/commands/auth.js.map +1 -1
- package/dist/src/commands/blob-buckets.js +84 -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/collections.js +12 -9
- package/dist/src/commands/collections.js.map +1 -1
- package/dist/src/commands/database-types.js +11 -1
- package/dist/src/commands/database-types.js.map +1 -1
- package/dist/src/commands/databases.js +197 -74
- package/dist/src/commands/databases.js.map +1 -1
- package/dist/src/commands/group-type-configs.js +1 -9
- package/dist/src/commands/group-type-configs.js.map +1 -1
- package/dist/src/commands/groups.js +12 -6
- package/dist/src/commands/groups.js.map +1 -1
- package/dist/src/commands/guides.d.ts +161 -0
- package/dist/src/commands/guides.js +502 -84
- package/dist/src/commands/guides.js.map +1 -1
- package/dist/src/commands/init.js +77 -45
- package/dist/src/commands/init.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/metadata.d.ts +2 -0
- package/dist/src/commands/metadata.js +344 -0
- package/dist/src/commands/metadata.js.map +1 -0
- package/dist/src/commands/prompts.js +2 -2
- package/dist/src/commands/prompts.js.map +1 -1
- package/dist/src/commands/rule-sets.d.ts +1 -0
- package/dist/src/commands/rule-sets.js +25 -3
- package/dist/src/commands/rule-sets.js.map +1 -1
- package/dist/src/commands/scripts.d.ts +2 -0
- package/dist/src/commands/scripts.js +667 -0
- package/dist/src/commands/scripts.js.map +1 -0
- package/dist/src/commands/sync.d.ts +212 -16
- package/dist/src/commands/sync.js +1688 -287
- package/dist/src/commands/sync.js.map +1 -1
- package/dist/src/commands/vars.d.ts +8 -0
- package/dist/src/commands/vars.js +110 -0
- package/dist/src/commands/vars.js.map +1 -0
- package/dist/src/commands/webhooks.js +17 -3
- package/dist/src/commands/webhooks.js.map +1 -1
- package/dist/src/commands/workflows.d.ts +30 -0
- package/dist/src/commands/workflows.js +651 -52
- package/dist/src/commands/workflows.js.map +1 -1
- package/dist/src/lib/api-client.d.ts +123 -19
- package/dist/src/lib/api-client.js +128 -4
- package/dist/src/lib/api-client.js.map +1 -1
- package/dist/src/lib/batch.d.ts +26 -0
- package/dist/src/lib/batch.js +32 -0
- package/dist/src/lib/batch.js.map +1 -0
- package/dist/src/lib/block-layout.d.ts +160 -0
- package/dist/src/lib/block-layout.js +451 -0
- package/dist/src/lib/block-layout.js.map +1 -0
- package/dist/src/lib/codegen-shared/generatedFiles.d.ts +61 -0
- package/dist/src/lib/codegen-shared/generatedFiles.js +127 -0
- package/dist/src/lib/codegen-shared/generatedFiles.js.map +1 -0
- package/dist/src/lib/codegen-shared/resolveCodegenSourceDir.d.ts +68 -0
- package/dist/src/lib/codegen-shared/resolveCodegenSourceDir.js +168 -0
- package/dist/src/lib/codegen-shared/resolveCodegenSourceDir.js.map +1 -0
- package/dist/src/lib/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/config.d.ts +16 -0
- package/dist/src/lib/config.js +41 -0
- package/dist/src/lib/config.js.map +1 -1
- 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/csv.d.ts +1 -2
- package/dist/src/lib/csv.js +3 -8
- package/dist/src/lib/csv.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 +52 -0
- package/dist/src/lib/generated-allowlist.js.map +1 -1
- package/dist/src/lib/init-config.d.ts +13 -0
- package/dist/src/lib/init-config.js +21 -2
- package/dist/src/lib/init-config.js.map +1 -1
- package/dist/src/lib/output.d.ts +42 -5
- package/dist/src/lib/output.js +70 -4
- package/dist/src/lib/output.js.map +1 -1
- package/dist/src/lib/query-operators.d.ts +43 -0
- package/dist/src/lib/query-operators.js +80 -0
- package/dist/src/lib/query-operators.js.map +1 -0
- package/dist/src/lib/template.d.ts +9 -5
- package/dist/src/lib/template.js +58 -45
- package/dist/src/lib/template.js.map +1 -1
- package/dist/src/lib/toml-database-config.d.ts +10 -19
- package/dist/src/lib/toml-database-config.js +28 -59
- package/dist/src/lib/toml-database-config.js.map +1 -1
- package/dist/src/lib/toml-metadata-config.d.ts +147 -0
- package/dist/src/lib/toml-metadata-config.js +463 -0
- package/dist/src/lib/toml-metadata-config.js.map +1 -0
- 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/toml-params-validator.d.ts +34 -0
- package/dist/src/lib/toml-params-validator.js +118 -3
- package/dist/src/lib/toml-params-validator.js.map +1 -1
- package/dist/src/lib/workflow-apply.d.ts +86 -0
- package/dist/src/lib/workflow-apply.js +127 -0
- package/dist/src/lib/workflow-apply.js.map +1 -0
- package/dist/src/lib/workflow-codegen/generated-schema-descriptor.d.ts +129 -0
- package/dist/src/lib/workflow-codegen/generated-schema-descriptor.js +269 -0
- package/dist/src/lib/workflow-codegen/generated-schema-descriptor.js.map +1 -0
- package/dist/src/lib/workflow-codegen/generator.d.ts +74 -0
- package/dist/src/lib/workflow-codegen/generator.js +215 -0
- package/dist/src/lib/workflow-codegen/generator.js.map +1 -0
- package/dist/src/lib/workflow-codegen/naming.d.ts +33 -0
- package/dist/src/lib/workflow-codegen/naming.js +81 -0
- package/dist/src/lib/workflow-codegen/naming.js.map +1 -0
- package/dist/src/lib/workflow-codegen/schemaToTs.d.ts +64 -0
- package/dist/src/lib/workflow-codegen/schemaToTs.js +282 -0
- package/dist/src/lib/workflow-codegen/schemaToTs.js.map +1 -0
- package/dist/src/lib/workflow-fragments.js +3 -3
- package/dist/src/lib/workflow-fragments.js.map +1 -1
- package/dist/src/lib/workflow-payload.d.ts +68 -0
- package/dist/src/lib/workflow-payload.js +150 -0
- package/dist/src/lib/workflow-payload.js.map +1 -0
- package/dist/src/lib/workflow-toml-validator.d.ts +1 -1
- package/dist/src/lib/workflow-toml-validator.js +37 -1
- package/dist/src/lib/workflow-toml-validator.js.map +1 -1
- package/dist/src/types/index.d.ts +11 -0
- 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
|
@@ -24,6 +24,7 @@
|
|
|
24
24
|
*/
|
|
25
25
|
/** Top-level step fields the validator accepts for a known kind (#998). */
|
|
26
26
|
export const GENERATED_ALLOWLISTED_FIELDS = [
|
|
27
|
+
"_testInputSchema",
|
|
27
28
|
"_testSteps",
|
|
28
29
|
"action",
|
|
29
30
|
"aliasKey",
|
|
@@ -32,22 +33,35 @@ export const GENERATED_ALLOWLISTED_FIELDS = [
|
|
|
32
33
|
"asBase64",
|
|
33
34
|
"attachments",
|
|
34
35
|
"blobId",
|
|
36
|
+
"blobIds",
|
|
37
|
+
"blockKey",
|
|
38
|
+
"blockType",
|
|
39
|
+
"body",
|
|
35
40
|
"bodyMode",
|
|
36
41
|
"bucketId",
|
|
37
42
|
"bucketKey",
|
|
38
43
|
"cacheTtlSeconds",
|
|
39
44
|
"cases",
|
|
45
|
+
"category",
|
|
46
|
+
"channels",
|
|
47
|
+
"collapseId",
|
|
48
|
+
"collectionId",
|
|
49
|
+
"collectionType",
|
|
40
50
|
"concurrency",
|
|
41
51
|
"configId",
|
|
42
52
|
"content",
|
|
43
53
|
"contentBase64",
|
|
44
54
|
"contentType",
|
|
45
55
|
"context",
|
|
56
|
+
"contextId",
|
|
46
57
|
"continueOnError",
|
|
58
|
+
"create",
|
|
47
59
|
"cursor",
|
|
48
60
|
"cursorField",
|
|
49
61
|
"data",
|
|
50
62
|
"databaseId",
|
|
63
|
+
"databaseType",
|
|
64
|
+
"deepLink",
|
|
51
65
|
"default",
|
|
52
66
|
"description",
|
|
53
67
|
"direction",
|
|
@@ -57,6 +71,7 @@ export const GENERATED_ALLOWLISTED_FIELDS = [
|
|
|
57
71
|
"durationMs",
|
|
58
72
|
"email",
|
|
59
73
|
"events",
|
|
74
|
+
"expiresAt",
|
|
60
75
|
"expiresInSeconds",
|
|
61
76
|
"feature",
|
|
62
77
|
"filename",
|
|
@@ -68,7 +83,9 @@ export const GENERATED_ALLOWLISTED_FIELDS = [
|
|
|
68
83
|
"groupId",
|
|
69
84
|
"groupType",
|
|
70
85
|
"htmlBody",
|
|
86
|
+
"iconUrl",
|
|
71
87
|
"id",
|
|
88
|
+
"idempotencyKey",
|
|
72
89
|
"includeRoot",
|
|
73
90
|
"includeUserDetails",
|
|
74
91
|
"input",
|
|
@@ -82,6 +99,7 @@ export const GENERATED_ALLOWLISTED_FIELDS = [
|
|
|
82
99
|
"maxPages",
|
|
83
100
|
"message",
|
|
84
101
|
"messages",
|
|
102
|
+
"metadata",
|
|
85
103
|
"metrics",
|
|
86
104
|
"model",
|
|
87
105
|
"modelName",
|
|
@@ -92,6 +110,7 @@ export const GENERATED_ALLOWLISTED_FIELDS = [
|
|
|
92
110
|
"onConflict",
|
|
93
111
|
"onPartialFailure",
|
|
94
112
|
"operationName",
|
|
113
|
+
"operations",
|
|
95
114
|
"options",
|
|
96
115
|
"output",
|
|
97
116
|
"ownerOnly",
|
|
@@ -107,17 +126,24 @@ export const GENERATED_ALLOWLISTED_FIELDS = [
|
|
|
107
126
|
"query",
|
|
108
127
|
"queryType",
|
|
109
128
|
"recordId",
|
|
129
|
+
"recordIds",
|
|
130
|
+
"records",
|
|
110
131
|
"ref",
|
|
111
132
|
"request",
|
|
133
|
+
"resourceId",
|
|
134
|
+
"resourceType",
|
|
112
135
|
"route",
|
|
113
136
|
"runIf",
|
|
114
137
|
"saveAs",
|
|
138
|
+
"schema",
|
|
115
139
|
"scope",
|
|
116
140
|
"selector",
|
|
141
|
+
"skipWhenSkipped",
|
|
117
142
|
"sort",
|
|
118
143
|
"source",
|
|
119
144
|
"step",
|
|
120
145
|
"strict",
|
|
146
|
+
"strictParams",
|
|
121
147
|
"subject",
|
|
122
148
|
"successWhen",
|
|
123
149
|
"systemBypass",
|
|
@@ -127,6 +153,7 @@ export const GENERATED_ALLOWLISTED_FIELDS = [
|
|
|
127
153
|
"templateType",
|
|
128
154
|
"textBody",
|
|
129
155
|
"thinkingLevel",
|
|
156
|
+
"threadId",
|
|
130
157
|
"timeout",
|
|
131
158
|
"title",
|
|
132
159
|
"to",
|
|
@@ -137,8 +164,10 @@ export const GENERATED_ALLOWLISTED_FIELDS = [
|
|
|
137
164
|
"type",
|
|
138
165
|
"user",
|
|
139
166
|
"userId",
|
|
167
|
+
"userInfo",
|
|
140
168
|
"userUlid",
|
|
141
169
|
"variables",
|
|
170
|
+
"version",
|
|
142
171
|
"windowDays",
|
|
143
172
|
"with",
|
|
144
173
|
"workflowKey",
|
|
@@ -148,21 +177,36 @@ export const GENERATED_KNOWN_KINDS = [
|
|
|
148
177
|
"analytics.query",
|
|
149
178
|
"analytics.write",
|
|
150
179
|
"analytics.writeForUser",
|
|
180
|
+
"blob.delete",
|
|
151
181
|
"blob.download",
|
|
152
182
|
"blob.signedUrl",
|
|
153
183
|
"blob.upload",
|
|
184
|
+
"block.call",
|
|
154
185
|
"collect",
|
|
186
|
+
"collection.addDocument",
|
|
187
|
+
"collection.create",
|
|
188
|
+
"collection.delete",
|
|
189
|
+
"collection.grantGroupPermission",
|
|
190
|
+
"collection.removeDocument",
|
|
191
|
+
"create",
|
|
155
192
|
"database.aggregate",
|
|
156
193
|
"database.applyToQuery",
|
|
157
194
|
"database.count",
|
|
195
|
+
"database.create",
|
|
196
|
+
"database.delete",
|
|
158
197
|
"database.mutate",
|
|
159
198
|
"database.pipeline",
|
|
160
199
|
"database.query",
|
|
200
|
+
"database.syncIndexes",
|
|
161
201
|
"delay",
|
|
202
|
+
"document.bulkUpdate",
|
|
162
203
|
"document.count",
|
|
163
204
|
"document.delete",
|
|
164
205
|
"document.getForUser",
|
|
165
206
|
"document.getOrCreateWithAliasForUser",
|
|
207
|
+
"document.getRootForUser",
|
|
208
|
+
"document.listForCollection",
|
|
209
|
+
"document.listForGroup",
|
|
166
210
|
"document.listForUser",
|
|
167
211
|
"document.patch",
|
|
168
212
|
"document.query",
|
|
@@ -177,14 +221,22 @@ export const GENERATED_KNOWN_KINDS = [
|
|
|
177
221
|
"gemini.generateRaw",
|
|
178
222
|
"group.addMember",
|
|
179
223
|
"group.checkMembership",
|
|
224
|
+
"group.create",
|
|
225
|
+
"group.delete",
|
|
180
226
|
"group.listMembers",
|
|
181
227
|
"group.listUserMemberships",
|
|
228
|
+
"group.removeAll",
|
|
182
229
|
"group.removeMember",
|
|
230
|
+
"hash",
|
|
183
231
|
"integration.call",
|
|
184
232
|
"iterate-users",
|
|
185
233
|
"llm.chat",
|
|
234
|
+
"metadata.read",
|
|
235
|
+
"metadata.write",
|
|
186
236
|
"noop",
|
|
237
|
+
"notification.send",
|
|
187
238
|
"prompt.execute",
|
|
239
|
+
"render",
|
|
188
240
|
"script",
|
|
189
241
|
"switch",
|
|
190
242
|
"transform",
|
|
@@ -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,YAAY;IACZ,QAAQ;IACR,UAAU;IACV,OAAO;IACP,IAAI;IACJ,UAAU;IACV,aAAa;IACb,QAAQ;IACR,UAAU;IACV,UAAU;IACV,WAAW;IACX,iBAAiB;IACjB,OAAO;IACP,aAAa;IACb,UAAU;IACV,SAAS;IACT,eAAe;IACf,aAAa;IACb,SAAS;IACT,iBAAiB;IACjB,QAAQ;IACR,aAAa;IACb,MAAM;IACN,YAAY;IACZ,SAAS;IACT,aAAa;IACb,WAAW;IACX,eAAe;IACf,YAAY;IACZ,QAAQ;IACR,YAAY;IACZ,OAAO;IACP,QAAQ;IACR,kBAAkB;IAClB,SAAS;IACT,UAAU;IACV,QAAQ;IACR,SAAS;IACT,SAAS;IACT,SAAS;IACT,SAAS;IACT,SAAS;IACT,WAAW;IACX,UAAU;IACV,IAAI;IACJ,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,SAAS;IACT,OAAO;IACP,WAAW;IACX,eAAe;IACf,IAAI;IACJ,iBAAiB;IACjB,MAAM;IACN,YAAY;IACZ,kBAAkB;IAClB,eAAe;IACf,SAAS;IACT,QAAQ;IACR,WAAW;IACX,MAAM;IACN,UAAU;IACV,QAAQ;IACR,SAAS;IACT,SAAS;IACT,YAAY;IACZ,SAAS;IACT,QAAQ;IACR,WAAW;IACX,OAAO;IACP,WAAW;IACX,UAAU;IACV,KAAK;IACL,SAAS;IACT,OAAO;IACP,OAAO;IACP,QAAQ;IACR,OAAO;IACP,UAAU;IACV,MAAM;IACN,QAAQ;IACR,MAAM;IACN,QAAQ;IACR,SAAS;IACT,aAAa;IACb,cAAc;IACd,KAAK;IACL,MAAM;IACN,aAAa;IACb,cAAc;IACd,UAAU;IACV,eAAe;IACf,SAAS;IACT,OAAO;IACP,IAAI;IACJ,UAAU;IACV,aAAa;IACb,OAAO;IACP,OAAO;IACP,MAAM;IACN,MAAM;IACN,QAAQ;IACR,UAAU;IACV,WAAW;IACX,YAAY;IACZ,MAAM;IACN,aAAa;CACd,CAAC;AAEF,0GAA0G;AAC1G,MAAM,CAAC,MAAM,qBAAqB,GAAsB;IACtD,iBAAiB;IACjB,iBAAiB;IACjB,wBAAwB;IACxB,eAAe;IACf,gBAAgB;IAChB,aAAa;IACb,SAAS;IACT,oBAAoB;IACpB,uBAAuB;IACvB,gBAAgB;IAChB,iBAAiB;IACjB,mBAAmB;IACnB,gBAAgB;IAChB,OAAO;IACP,gBAAgB;IAChB,iBAAiB;IACjB,qBAAqB;IACrB,sCAAsC;IACtC,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,mBAAmB;IACnB,2BAA2B;IAC3B,oBAAoB;IACpB,kBAAkB;IAClB,eAAe;IACf,UAAU;IACV,MAAM;IACN,gBAAgB;IAChB,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,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,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"}
|
|
@@ -29,6 +29,19 @@ export interface ValidationResult {
|
|
|
29
29
|
valid: boolean;
|
|
30
30
|
errors: string[];
|
|
31
31
|
}
|
|
32
|
+
/**
|
|
33
|
+
* Resolves the "use an existing app" app id from the two places it can be
|
|
34
|
+
* specified: the `--use-existing-app-id` CLI flag (highest precedence) or an
|
|
35
|
+
* init-config TOML with `action = "use-existing"` + `app_id`.
|
|
36
|
+
*
|
|
37
|
+
* Before this existed, `init` only read the flag, so a `use-existing` TOML fell
|
|
38
|
+
* through to the create-app branch and interactively prompted for an app name —
|
|
39
|
+
* hanging non-interactive (`--config`) runs. (See js-bao-wss #1217.)
|
|
40
|
+
*
|
|
41
|
+
* Returns `undefined` when neither source selects an existing app (i.e. the run
|
|
42
|
+
* should create a new app).
|
|
43
|
+
*/
|
|
44
|
+
export declare function resolveUseExistingAppId(flag: string | undefined, initConfig: InitConfig | null): string | undefined;
|
|
32
45
|
/**
|
|
33
46
|
* Parses a TOML string into an InitConfig object.
|
|
34
47
|
* Throws if the string contains invalid TOML.
|
|
@@ -1,13 +1,32 @@
|
|
|
1
1
|
import { existsSync, readFileSync } from "fs";
|
|
2
2
|
import { join } from "path";
|
|
3
|
-
import
|
|
3
|
+
import { parseConfigToml } from "./config-toml.js";
|
|
4
4
|
export const INIT_CONFIG_FILENAME = ".primitive-init.toml";
|
|
5
|
+
/**
|
|
6
|
+
* Resolves the "use an existing app" app id from the two places it can be
|
|
7
|
+
* specified: the `--use-existing-app-id` CLI flag (highest precedence) or an
|
|
8
|
+
* init-config TOML with `action = "use-existing"` + `app_id`.
|
|
9
|
+
*
|
|
10
|
+
* Before this existed, `init` only read the flag, so a `use-existing` TOML fell
|
|
11
|
+
* through to the create-app branch and interactively prompted for an app name —
|
|
12
|
+
* hanging non-interactive (`--config`) runs. (See js-bao-wss #1217.)
|
|
13
|
+
*
|
|
14
|
+
* Returns `undefined` when neither source selects an existing app (i.e. the run
|
|
15
|
+
* should create a new app).
|
|
16
|
+
*/
|
|
17
|
+
export function resolveUseExistingAppId(flag, initConfig) {
|
|
18
|
+
if (flag)
|
|
19
|
+
return flag;
|
|
20
|
+
if (initConfig?.action === "use-existing")
|
|
21
|
+
return initConfig.app_id;
|
|
22
|
+
return undefined;
|
|
23
|
+
}
|
|
5
24
|
/**
|
|
6
25
|
* Parses a TOML string into an InitConfig object.
|
|
7
26
|
* Throws if the string contains invalid TOML.
|
|
8
27
|
*/
|
|
9
28
|
export function parseInitConfigToml(content) {
|
|
10
|
-
const parsed =
|
|
29
|
+
const parsed = parseConfigToml(content);
|
|
11
30
|
// The cast is safe because validateInitConfig() is always called after parsing
|
|
12
31
|
return parsed;
|
|
13
32
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init-config.js","sourceRoot":"","sources":["../../../src/lib/init-config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,IAAI,CAAC;AAC9C,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAC5B,OAAO,
|
|
1
|
+
{"version":3,"file":"init-config.js","sourceRoot":"","sources":["../../../src/lib/init-config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,IAAI,CAAC;AAC9C,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAC5B,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAEnD,MAAM,CAAC,MAAM,oBAAoB,GAAG,sBAAsB,CAAC;AAkC3D;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,uBAAuB,CACrC,IAAwB,EACxB,UAA6B;IAE7B,IAAI,IAAI;QAAE,OAAO,IAAI,CAAC;IACtB,IAAI,UAAU,E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AAC,EAAE,CAAC;QAChE,KAAK,MAAM,KAAK,IAAI,MAAM,CAAC,aAAa,EAAE,CAAC;YACzC,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;gBACzB,MAAM,CAAC,IAAI,CAAC,oCAAoC,KAAK,GAAG,CAAC,CAAC;YAC5D,CAAC;QACH,CAAC;IACH,CAAC;IAED,oDAAoD;IACpD,IAAI,MAAM,CAAC,MAAM,KAAK,cAAc,EAAE,CAAC;QACrC,MAAM,aAAa,GAAa,EAAE,CAAC;QACnC,IAAI,MAAM,CAAC,WAAW;YAAE,aAAa,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;QAC1D,IAAI,MAAM,CAAC,aAAa,IAAI,MAAM,CAAC,aAAa,CAAC,MAAM,GAAG,CAAC;YAAE,aAAa,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;QACjG,IAAI,MAAM,CAAC,eAAe,IAAI,MAAM,CAAC,eAAe,CAAC,MAAM,GAAG,CAAC;YAAE,aAAa,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC;QACvG,IAAI,aAAa,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YAC7B,MAAM,CAAC,IAAI,CAAC,mEAAmE,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,mCAAmC,CAAC,CAAC;QAC9I,CAAC;IACH,CAAC;IAED,OAAO,EAAE,KAAK,EAAE,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;AAChD,CAAC"}
|
package/dist/src/lib/output.d.ts
CHANGED
|
@@ -2,19 +2,56 @@ export interface TableColumn {
|
|
|
2
2
|
header: string;
|
|
3
3
|
key: string;
|
|
4
4
|
width?: number;
|
|
5
|
+
/**
|
|
6
|
+
* Opt-in flexible sizing (#1065). When `true`, the column is sized from the
|
|
7
|
+
* remaining terminal width (`options.maxWidth ?? process.stdout.columns`)
|
|
8
|
+
* minus the sibling columns' widths and the inter-column padding, so the
|
|
9
|
+
* table shows as much of this column as fits **without wrapping**. Clamped to
|
|
10
|
+
* `[max(flexFloor, header length), flexMax]`. On a non-TTY (`maxWidth`
|
|
11
|
+
* undefined — piped/redirected) there is no width to wrap against, so the
|
|
12
|
+
* column is sized to `flexMax` (or its content width when `flexMax` is
|
|
13
|
+
* unset). Reading the terminal width is gated to flex columns: tables with no
|
|
14
|
+
* flex column never consult `process.stdout.columns` and stay byte-for-byte
|
|
15
|
+
* (and TTY-) unchanged.
|
|
16
|
+
*/
|
|
17
|
+
flex?: boolean;
|
|
18
|
+
/** Minimum width for a `flex` column. Default 0 (header length is always honored). */
|
|
19
|
+
flexFloor?: number;
|
|
20
|
+
/** Maximum width for a `flex` column. Default unbounded. */
|
|
21
|
+
flexMax?: number;
|
|
5
22
|
align?: "left" | "right" | "center";
|
|
6
23
|
format?: (value: any) => string;
|
|
7
24
|
/**
|
|
8
|
-
* Opt-in truncation. When `true` (and a
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
25
|
+
* Opt-in truncation. When `true` (and the column has a resolved width — a
|
|
26
|
+
* fixed `width` or a computed `flex` width), cell values longer than that
|
|
27
|
+
* width are ellipsized to fit the column so downstream columns stay aligned.
|
|
28
|
+
* Defaults to `false` so existing tables keep their current non-truncating
|
|
29
|
+
* behavior — only columns that explicitly opt in are clipped.
|
|
12
30
|
*/
|
|
13
31
|
truncate?: boolean;
|
|
14
32
|
}
|
|
15
|
-
export declare function formatTable(data: Record<string, any>[], columns: TableColumn[]
|
|
33
|
+
export declare function formatTable(data: Record<string, any>[], columns: TableColumn[], options?: {
|
|
34
|
+
maxWidth?: number;
|
|
35
|
+
}): string;
|
|
16
36
|
export declare function success(message: string): void;
|
|
17
37
|
export declare function error(message: string): void;
|
|
38
|
+
/**
|
|
39
|
+
* Render an API error (or any Error) with its message plus the server's
|
|
40
|
+
* structured `details` payload, if present. Shared by `sync push`,
|
|
41
|
+
* `workflows create`/`update`, and any command that surfaces server-side
|
|
42
|
+
* validation failures (#1173).
|
|
43
|
+
*
|
|
44
|
+
* The server's error envelope can emit `details` as either:
|
|
45
|
+
* - an **array** of validation-issue strings/objects (e.g. the workflow
|
|
46
|
+
* identity validator's per-step reasons), or
|
|
47
|
+
* - an **object** (#666 schema gate — `{ code, ... }`).
|
|
48
|
+
*
|
|
49
|
+
* Both shapes are rendered without throwing; an absent/empty `details` prints
|
|
50
|
+
* just the message. Duck-typed (reads `.message`/`.details`) so it works on
|
|
51
|
+
* any `ApiError` instance without importing the class — keeping `output.ts`
|
|
52
|
+
* dependency-free.
|
|
53
|
+
*/
|
|
54
|
+
export declare function printApiError(err: unknown): void;
|
|
18
55
|
export declare function warn(message: string): void;
|
|
19
56
|
export declare function info(message: string): void;
|
|
20
57
|
export declare function dim(message: string): void;
|
package/dist/src/lib/output.js
CHANGED
|
@@ -18,7 +18,7 @@ function truncateToWidth(str, width) {
|
|
|
18
18
|
return ".".repeat(width);
|
|
19
19
|
return stripped.slice(0, width - 1) + "…";
|
|
20
20
|
}
|
|
21
|
-
export function formatTable(data, columns) {
|
|
21
|
+
export function formatTable(data, columns, options) {
|
|
22
22
|
if (data.length === 0) {
|
|
23
23
|
return chalk.dim("No results found.");
|
|
24
24
|
}
|
|
@@ -31,6 +31,33 @@ export function formatTable(data, columns) {
|
|
|
31
31
|
}));
|
|
32
32
|
return col.width ?? Math.max(headerWidth, maxDataWidth);
|
|
33
33
|
});
|
|
34
|
+
// Flex pass (#1065): size the first column marked `flex` from the remaining
|
|
35
|
+
// terminal width so the table shows as much as fits without ever wrapping.
|
|
36
|
+
// The sibling widths above are already content-derived, so subtracting their
|
|
37
|
+
// ACTUAL widths plus the exact `2 * (N - 1)` inter-column padding makes the
|
|
38
|
+
// no-wrap guarantee structural rather than maintained by hand. Gated to flex
|
|
39
|
+
// columns so non-flex tables never read `process.stdout.columns`.
|
|
40
|
+
const flexIndex = columns.findIndex((col) => col.flex);
|
|
41
|
+
if (flexIndex !== -1) {
|
|
42
|
+
const col = columns[flexIndex];
|
|
43
|
+
const floor = Math.max(col.flexFloor ?? 0, col.header.length);
|
|
44
|
+
const cap = col.flexMax ?? Infinity;
|
|
45
|
+
const maxWidth = options?.maxWidth ?? process.stdout.columns;
|
|
46
|
+
if (typeof maxWidth === "number") {
|
|
47
|
+
const siblingWidth = widths.reduce((sum, w, i) => (i === flexIndex ? sum : sum + w), 0);
|
|
48
|
+
const padding = 2 * (columns.length - 1);
|
|
49
|
+
const avail = maxWidth - siblingWidth - padding;
|
|
50
|
+
// Clamp to [floor, cap]; never below the floor (so the header/min content
|
|
51
|
+
// stays readable) and never negative.
|
|
52
|
+
widths[flexIndex] = Math.min(cap, Math.max(floor, avail));
|
|
53
|
+
}
|
|
54
|
+
else {
|
|
55
|
+
// Non-TTY (piped/redirected): no terminal width to wrap against. Show as
|
|
56
|
+
// much as the cap allows — full content up to the contract max — falling
|
|
57
|
+
// back to the content-derived width when no cap is set.
|
|
58
|
+
widths[flexIndex] = cap === Infinity ? widths[flexIndex] : cap;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
34
61
|
// Format header
|
|
35
62
|
const header = columns
|
|
36
63
|
.map((col, i) => {
|
|
@@ -44,9 +71,10 @@ export function formatTable(data, columns) {
|
|
|
44
71
|
const rows = data.map((row) => columns
|
|
45
72
|
.map((col, i) => {
|
|
46
73
|
let value = col.format ? col.format(row[col.key]) : String(row[col.key] ?? "");
|
|
47
|
-
// Opt-in: clip over-long cells to
|
|
48
|
-
//
|
|
49
|
-
|
|
74
|
+
// Opt-in: clip over-long cells to the column's resolved width (a fixed
|
|
75
|
+
// `width` or a computed `flex` width) so the columns that follow stay
|
|
76
|
+
// aligned (e.g. guides DESCRIPTION before LANGUAGES).
|
|
77
|
+
if (col.truncate && (col.width !== undefined || col.flex)) {
|
|
50
78
|
value = truncateToWidth(value, widths[i]);
|
|
51
79
|
}
|
|
52
80
|
return padString(value, widths[i], col.align ?? "left");
|
|
@@ -100,6 +128,44 @@ export function success(message) {
|
|
|
100
128
|
export function error(message) {
|
|
101
129
|
console.error(chalk.red("✗") + " " + message);
|
|
102
130
|
}
|
|
131
|
+
/**
|
|
132
|
+
* Render an API error (or any Error) with its message plus the server's
|
|
133
|
+
* structured `details` payload, if present. Shared by `sync push`,
|
|
134
|
+
* `workflows create`/`update`, and any command that surfaces server-side
|
|
135
|
+
* validation failures (#1173).
|
|
136
|
+
*
|
|
137
|
+
* The server's error envelope can emit `details` as either:
|
|
138
|
+
* - an **array** of validation-issue strings/objects (e.g. the workflow
|
|
139
|
+
* identity validator's per-step reasons), or
|
|
140
|
+
* - an **object** (#666 schema gate — `{ code, ... }`).
|
|
141
|
+
*
|
|
142
|
+
* Both shapes are rendered without throwing; an absent/empty `details` prints
|
|
143
|
+
* just the message. Duck-typed (reads `.message`/`.details`) so it works on
|
|
144
|
+
* any `ApiError` instance without importing the class — keeping `output.ts`
|
|
145
|
+
* dependency-free.
|
|
146
|
+
*/
|
|
147
|
+
export function printApiError(err) {
|
|
148
|
+
const e = err;
|
|
149
|
+
const message = typeof e?.message === "string" && e.message.length > 0
|
|
150
|
+
? e.message
|
|
151
|
+
: String(err);
|
|
152
|
+
error(message);
|
|
153
|
+
const details = e?.details;
|
|
154
|
+
if (Array.isArray(details)) {
|
|
155
|
+
for (const detail of details) {
|
|
156
|
+
console.error(` - ${typeof detail === "string" ? detail : JSON.stringify(detail)}`);
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
else if (details && typeof details === "object") {
|
|
160
|
+
// Object form (#666 schema gate): render each key so the reason isn't
|
|
161
|
+
// hidden. Skip the redundant `code` (already implied by the message).
|
|
162
|
+
for (const [key, value] of Object.entries(details)) {
|
|
163
|
+
if (key === "code")
|
|
164
|
+
continue;
|
|
165
|
+
console.error(` ${key}: ${typeof value === "string" ? value : JSON.stringify(value)}`);
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
}
|
|
103
169
|
export function warn(message) {
|
|
104
170
|
console.error(chalk.yellow("!") + " " + message);
|
|
105
171
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"output.js","sourceRoot":"","sources":["../../../src/lib/output.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"output.js","sourceRoot":"","sources":["../../../src/lib/output.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAmC1B;;;;;;;;GAQG;AACH,SAAS,eAAe,CAAC,GAAW,EAAE,KAAa;IACjD,MAAM,QAAQ,GAAG,SAAS,CAAC,GAAG,CAAC,CAAC;IAChC,IAAI,QAAQ,CAAC,MAAM,IAAI,KAAK;QAAE,OAAO,GAAG,CAAC;IACzC,IAAI,KAAK,IAAI,CAAC;QAAE,OAAO,EAAE,CAAC;IAC1B,IAAI,KAAK,IAAI,CAAC;QAAE,OAAO,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IACzC,OAAO,QAAQ,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,GAAG,CAAC,CAAC,GAAG,GAAG,CAAC;AAC5C,CAAC;AAED,MAAM,UAAU,WAAW,CACzB,IAA2B,EAC3B,OAAsB,EACtB,OAA+B;IAE/B,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACtB,OAAO,KAAK,CAAC,GAAG,CAAC,mBAAmB,CAAC,CAAC;IACxC,CAAC;IAED,0BAA0B;IAC1B,MAAM,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE;QACjC,MAAM,WAAW,GAAG,GAAG,CAAC,MAAM,CAAC,MAAM,CAAC;QACtC,MAAM,YAAY,GAAG,IAAI,CAAC,GAAG,CAC3B,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE;YAClB,MAAM,KAAK,GAAG,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,C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AAK,OAAO,EAAE,CAAC,CAAC;AACvC,CAAC;AAED,MAAM,UAAU,WAAW;IACzB,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;AAC7B,CAAC"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared constant for the query operators an operation `filter` may use,
|
|
3
|
+
* plus a helper to find operator keys that aren't in the supported set.
|
|
4
|
+
*
|
|
5
|
+
* Background (issue #1255): a database-operation `filter` uses Mongo-style
|
|
6
|
+
* operators (`$gte`, `$in`, ...). A typo like `$gt` → `$gte` or an invented
|
|
7
|
+
* `$foo` silently passes `sync push` (the server only validates `filter` is
|
|
8
|
+
* an object) and then throws `InvalidOperatorError` at *query execution*.
|
|
9
|
+
* The CLI can warn about unknown operators at push time so the author fixes
|
|
10
|
+
* it before it reaches runtime.
|
|
11
|
+
*
|
|
12
|
+
* The set mirrors the runtime translator
|
|
13
|
+
* (`packages/js-bao/src/query/JsonQueryTranslator.ts`): field operators
|
|
14
|
+
* (`translateFieldCondition` / substring ops) plus the two logical
|
|
15
|
+
* combinators special-cased in `translateFilter` (`$and` / `$or`).
|
|
16
|
+
*
|
|
17
|
+
* `$not` is intentionally NOT included — it is not a runtime operator; the
|
|
18
|
+
* translator only special-cases `$and` / `$or`, so `$not` would throw at
|
|
19
|
+
* execution just like any other unknown operator (codex review, #1255).
|
|
20
|
+
*
|
|
21
|
+
* This is deliberately a single source of truth so the validator and any
|
|
22
|
+
* future emitter/detector agree on what "known" means.
|
|
23
|
+
*/
|
|
24
|
+
/** Field-level comparison / membership / string operators. */
|
|
25
|
+
export declare const FIELD_QUERY_OPERATORS: readonly string[];
|
|
26
|
+
/** Logical combinators (arrays of sub-filters). */
|
|
27
|
+
export declare const LOGICAL_QUERY_OPERATORS: readonly string[];
|
|
28
|
+
/**
|
|
29
|
+
* Every operator the runtime query translator accepts. Any `$`-prefixed
|
|
30
|
+
* *key* inside a filter that is not in this set is unknown.
|
|
31
|
+
*/
|
|
32
|
+
export declare const SUPPORTED_QUERY_OPERATORS: ReadonlySet<string>;
|
|
33
|
+
/**
|
|
34
|
+
* Recursively collect the distinct `$`-prefixed *keys* used in a filter (or
|
|
35
|
+
* any nested value) that are not in {@link SUPPORTED_QUERY_OPERATORS}.
|
|
36
|
+
*
|
|
37
|
+
* Only object *keys* are considered operators — matching the runtime
|
|
38
|
+
* convention (`walk-operation.ts`: `$`-prefixed keys are operators). String
|
|
39
|
+
* *values* like `$params.activeSince` are substitution references, never
|
|
40
|
+
* operators, so they are never flagged. `$and` / `$or` values are arrays of
|
|
41
|
+
* sub-filter objects and are walked recursively.
|
|
42
|
+
*/
|
|
43
|
+
export declare function collectUnknownOperators(value: any): string[];
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared constant for the query operators an operation `filter` may use,
|
|
3
|
+
* plus a helper to find operator keys that aren't in the supported set.
|
|
4
|
+
*
|
|
5
|
+
* Background (issue #1255): a database-operation `filter` uses Mongo-style
|
|
6
|
+
* operators (`$gte`, `$in`, ...). A typo like `$gt` → `$gte` or an invented
|
|
7
|
+
* `$foo` silently passes `sync push` (the server only validates `filter` is
|
|
8
|
+
* an object) and then throws `InvalidOperatorError` at *query execution*.
|
|
9
|
+
* The CLI can warn about unknown operators at push time so the author fixes
|
|
10
|
+
* it before it reaches runtime.
|
|
11
|
+
*
|
|
12
|
+
* The set mirrors the runtime translator
|
|
13
|
+
* (`packages/js-bao/src/query/JsonQueryTranslator.ts`): field operators
|
|
14
|
+
* (`translateFieldCondition` / substring ops) plus the two logical
|
|
15
|
+
* combinators special-cased in `translateFilter` (`$and` / `$or`).
|
|
16
|
+
*
|
|
17
|
+
* `$not` is intentionally NOT included — it is not a runtime operator; the
|
|
18
|
+
* translator only special-cases `$and` / `$or`, so `$not` would throw at
|
|
19
|
+
* execution just like any other unknown operator (codex review, #1255).
|
|
20
|
+
*
|
|
21
|
+
* This is deliberately a single source of truth so the validator and any
|
|
22
|
+
* future emitter/detector agree on what "known" means.
|
|
23
|
+
*/
|
|
24
|
+
/** Field-level comparison / membership / string operators. */
|
|
25
|
+
export const FIELD_QUERY_OPERATORS = [
|
|
26
|
+
"$eq",
|
|
27
|
+
"$ne",
|
|
28
|
+
"$gt",
|
|
29
|
+
"$gte",
|
|
30
|
+
"$lt",
|
|
31
|
+
"$lte",
|
|
32
|
+
"$in",
|
|
33
|
+
"$nin",
|
|
34
|
+
"$exists",
|
|
35
|
+
"$contains",
|
|
36
|
+
"$startsWith",
|
|
37
|
+
"$endsWith",
|
|
38
|
+
"$containsText",
|
|
39
|
+
];
|
|
40
|
+
/** Logical combinators (arrays of sub-filters). */
|
|
41
|
+
export const LOGICAL_QUERY_OPERATORS = ["$and", "$or"];
|
|
42
|
+
/**
|
|
43
|
+
* Every operator the runtime query translator accepts. Any `$`-prefixed
|
|
44
|
+
* *key* inside a filter that is not in this set is unknown.
|
|
45
|
+
*/
|
|
46
|
+
export const SUPPORTED_QUERY_OPERATORS = new Set([
|
|
47
|
+
...FIELD_QUERY_OPERATORS,
|
|
48
|
+
...LOGICAL_QUERY_OPERATORS,
|
|
49
|
+
]);
|
|
50
|
+
/**
|
|
51
|
+
* Recursively collect the distinct `$`-prefixed *keys* used in a filter (or
|
|
52
|
+
* any nested value) that are not in {@link SUPPORTED_QUERY_OPERATORS}.
|
|
53
|
+
*
|
|
54
|
+
* Only object *keys* are considered operators — matching the runtime
|
|
55
|
+
* convention (`walk-operation.ts`: `$`-prefixed keys are operators). String
|
|
56
|
+
* *values* like `$params.activeSince` are substitution references, never
|
|
57
|
+
* operators, so they are never flagged. `$and` / `$or` values are arrays of
|
|
58
|
+
* sub-filter objects and are walked recursively.
|
|
59
|
+
*/
|
|
60
|
+
export function collectUnknownOperators(value) {
|
|
61
|
+
const unknown = new Set();
|
|
62
|
+
walk(value, unknown);
|
|
63
|
+
return [...unknown];
|
|
64
|
+
}
|
|
65
|
+
function walk(value, unknown) {
|
|
66
|
+
if (Array.isArray(value)) {
|
|
67
|
+
for (const item of value)
|
|
68
|
+
walk(item, unknown);
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
if (value !== null && typeof value === "object") {
|
|
72
|
+
for (const [key, child] of Object.entries(value)) {
|
|
73
|
+
if (key.startsWith("$") && !SUPPORTED_QUERY_OPERATORS.has(key)) {
|
|
74
|
+
unknown.add(key);
|
|
75
|
+
}
|
|
76
|
+
walk(child, unknown);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
//# sourceMappingURL=query-operators.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"query-operators.js","sourceRoot":"","sources":["../../../src/lib/query-operators.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,8DAA8D;AAC9D,MAAM,CAAC,MAAM,qBAAqB,GAAsB;IACtD,KAAK;IACL,KAAK;IACL,KAAK;IACL,MAAM;IACN,KAAK;IACL,MAAM;IACN,KAAK;IACL,MAAM;IACN,SAAS;IACT,WAAW;IACX,aAAa;IACb,WAAW;IACX,eAAe;CAChB,CAAC;AAEF,mDAAmD;AACnD,MAAM,CAAC,MAAM,uBAAuB,GAAsB,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;AAE1E;;;GAGG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAwB,IAAI,GAAG,CAAC;IACpE,GAAG,qBAAqB;IACxB,GAAG,uBAAuB;CAC3B,CAAC,CAAC;AAEH;;;;;;;;;GASG;AACH,MAAM,UAAU,uBAAuB,CAAC,KAAU;IAChD,MAAM,OAAO,GAAG,IAAI,GAAG,EAAU,CAAC;IAClC,IAAI,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;IACrB,OAAO,CAAC,GAAG,OAAO,CAAC,CAAC;AACtB,CAAC;AAED,SAAS,IAAI,CAAC,KAAU,EAAE,OAAoB;IAC5C,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;QACzB,KAAK,MAAM,IAAI,IAAI,KAAK;YAAE,IAAI,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QAC9C,OAAO;IACT,CAAC;IACD,IAAI,KAAK,KAAK,IAAI,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAChD,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;YACjD,IAAI,GAAG,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,CAAC,yBAAyB,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC;gBAC/D,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;YACnB,CAAC;YACD,IAAI,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;QACvB,CAAC;IACH,CAAC;AACH,CAAC"}
|
|
@@ -1,18 +1,22 @@
|
|
|
1
1
|
declare const IOS_TEMPLATE_URL = "https://api.github.com/repos/Primitive-Labs/primitive-ios-template/tarball/main";
|
|
2
|
-
export interface
|
|
3
|
-
targetDir: string;
|
|
2
|
+
export interface PrepareTemplateOptions {
|
|
4
3
|
templateUrl?: string;
|
|
5
4
|
onProgress?: (status: string) => void;
|
|
6
5
|
}
|
|
6
|
+
export interface PreparedTemplate {
|
|
7
|
+
install(targetDir: string): void;
|
|
8
|
+
cleanup(): void;
|
|
9
|
+
}
|
|
7
10
|
/**
|
|
8
11
|
* Check if a directory is empty.
|
|
9
12
|
*/
|
|
10
13
|
export declare function isDirectoryEmpty(dir: string): boolean;
|
|
11
14
|
/**
|
|
12
|
-
* Downloads and
|
|
13
|
-
*
|
|
15
|
+
* Downloads and validates the Primitive app template in a temporary staging
|
|
16
|
+
* directory. Nothing is written to the final target directory until install()
|
|
17
|
+
* is called.
|
|
14
18
|
*/
|
|
15
|
-
export declare function
|
|
19
|
+
export declare function prepareTemplate(options?: PrepareTemplateOptions): Promise<PreparedTemplate>;
|
|
16
20
|
export interface UpdateEnvResult {
|
|
17
21
|
envUpdated: boolean;
|
|
18
22
|
envProductionUpdated: boolean;
|