primitive-admin 1.0.53 → 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/README.md +38 -10
- package/dist/bin/primitive.js +8 -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/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/databases.js +220 -82
- 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/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/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/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 +204 -9
- package/dist/src/commands/sync.js +1706 -371
- 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 +667 -59
- package/dist/src/commands/workflows.js.map +1 -1
- package/dist/src/lib/api-client.d.ts +122 -18
- package/dist/src/lib/api-client.js +131 -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 +250 -0
- package/dist/src/lib/app-settings-descriptor.js.map +1 -0
- 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 +76 -0
- package/dist/src/lib/codegen-shared/generatedFiles.js +144 -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 +21 -65
- package/dist/src/lib/db-codegen/dbGenerator.js +117 -321
- package/dist/src/lib/db-codegen/dbGenerator.js.map +1 -1
- package/dist/src/lib/db-codegen/dbNaming.d.ts +37 -0
- package/dist/src/lib/db-codegen/dbNaming.js +70 -0
- package/dist/src/lib/db-codegen/dbNaming.js.map +1 -1
- package/dist/src/lib/db-codegen/dbTemplates.d.ts +165 -5
- package/dist/src/lib/db-codegen/dbTemplates.js +292 -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/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/generated-allowlist.js +43 -0
- package/dist/src/lib/generated-allowlist.js.map +1 -1
- package/dist/src/lib/init-config.js +2 -2
- package/dist/src/lib/init-config.js.map +1 -1
- package/dist/src/lib/output.d.ts +25 -5
- package/dist/src/lib/output.js +32 -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/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/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 +87 -0
- package/dist/src/lib/workflow-codegen/generator.js +290 -0
- package/dist/src/lib/workflow-codegen/generator.js.map +1 -0
- 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/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 +7 -3
|
@@ -0,0 +1,200 @@
|
|
|
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
|
+
* `applyToQuery` action ops. Only mutation ops that operate on existing matched
|
|
110
|
+
* records — `save` is excluded because it makes no sense in a find-and-mutate
|
|
111
|
+
* flow.
|
|
112
|
+
*/
|
|
113
|
+
export const APPLY_TO_QUERY_ACTIONS = [
|
|
114
|
+
"delete",
|
|
115
|
+
"patch",
|
|
116
|
+
"increment",
|
|
117
|
+
"addToSet",
|
|
118
|
+
"removeFromSet",
|
|
119
|
+
];
|
|
120
|
+
/** Allowed keys in an `applyToQuery` `source` block. */
|
|
121
|
+
export const APPLY_TO_QUERY_SOURCE_KEYS = [
|
|
122
|
+
"filter",
|
|
123
|
+
"sort",
|
|
124
|
+
"limit",
|
|
125
|
+
];
|
|
126
|
+
/** Allowed keys in an `applyToQuery` `action` block. */
|
|
127
|
+
export const APPLY_TO_QUERY_ACTION_KEYS = [
|
|
128
|
+
"op",
|
|
129
|
+
"data",
|
|
130
|
+
"fields",
|
|
131
|
+
"stringSets",
|
|
132
|
+
];
|
|
133
|
+
// ── Pipeline step allow-lists ──
|
|
134
|
+
/** Step `type` values allowed inside a `pipeline` definition's `steps[]`. */
|
|
135
|
+
export const PIPELINE_STEP_TYPES = [
|
|
136
|
+
"query",
|
|
137
|
+
"count",
|
|
138
|
+
"aggregate",
|
|
139
|
+
];
|
|
140
|
+
/** Allowed keys on a pipeline `query` step. */
|
|
141
|
+
export const PIPELINE_QUERY_STEP_KEYS = [
|
|
142
|
+
"name",
|
|
143
|
+
"type",
|
|
144
|
+
"modelName",
|
|
145
|
+
"filter",
|
|
146
|
+
"sort",
|
|
147
|
+
"limit",
|
|
148
|
+
"projection",
|
|
149
|
+
"include",
|
|
150
|
+
];
|
|
151
|
+
/** Allowed keys on a pipeline `count` step. */
|
|
152
|
+
export const PIPELINE_COUNT_STEP_KEYS = [
|
|
153
|
+
"name",
|
|
154
|
+
"type",
|
|
155
|
+
"modelName",
|
|
156
|
+
"filter",
|
|
157
|
+
];
|
|
158
|
+
/** Allowed keys on a pipeline `aggregate` step. */
|
|
159
|
+
export const PIPELINE_AGGREGATE_STEP_KEYS = [
|
|
160
|
+
"name",
|
|
161
|
+
"type",
|
|
162
|
+
"modelName",
|
|
163
|
+
"groupBy",
|
|
164
|
+
"operations",
|
|
165
|
+
"filter",
|
|
166
|
+
"limit",
|
|
167
|
+
"sort",
|
|
168
|
+
];
|
|
169
|
+
// ── Param-schema enums ──
|
|
170
|
+
/**
|
|
171
|
+
* Built-in param types. `integer` (#1488) is accepted here and by the runtime
|
|
172
|
+
* coercion path. `array` (#1488) declares a list param with a scalar `items`
|
|
173
|
+
* element type. Keep in step with the runtime coercion list
|
|
174
|
+
* (`MODEL_PARAM_SCALAR_TYPES` in `database-operations-controller.ts`).
|
|
175
|
+
*/
|
|
176
|
+
export const PARAM_TYPES = [
|
|
177
|
+
"string",
|
|
178
|
+
"number",
|
|
179
|
+
"boolean",
|
|
180
|
+
"integer",
|
|
181
|
+
"object",
|
|
182
|
+
"array",
|
|
183
|
+
];
|
|
184
|
+
/** Scalar element types allowed for an `array` param's `items` (#1488). */
|
|
185
|
+
export const ARRAY_ELEMENT_TYPES = [
|
|
186
|
+
"string",
|
|
187
|
+
"number",
|
|
188
|
+
"boolean",
|
|
189
|
+
"integer",
|
|
190
|
+
];
|
|
191
|
+
/** Allowed keys in a single param definition. */
|
|
192
|
+
export const PARAM_DEF_KEYS = [
|
|
193
|
+
"type",
|
|
194
|
+
"required",
|
|
195
|
+
"access",
|
|
196
|
+
"coerce",
|
|
197
|
+
"enum",
|
|
198
|
+
"items",
|
|
199
|
+
];
|
|
200
|
+
//# 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,gD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IACR,SAAS;IACT,SAAS;IACT,QAAQ;IACR,OAAO;CACR,CAAC;AAEF,2EAA2E;AAC3E,MAAM,CAAC,MAAM,mBAAmB,GAAsB;IACpD,QAAQ;IACR,QAAQ;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"}
|
|
@@ -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,24 +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",
|
|
40
48
|
"collectionId",
|
|
49
|
+
"collectionType",
|
|
41
50
|
"concurrency",
|
|
42
51
|
"configId",
|
|
43
52
|
"content",
|
|
44
53
|
"contentBase64",
|
|
45
54
|
"contentType",
|
|
46
55
|
"context",
|
|
56
|
+
"contextId",
|
|
47
57
|
"continueOnError",
|
|
48
58
|
"create",
|
|
49
59
|
"cursor",
|
|
50
60
|
"cursorField",
|
|
51
61
|
"data",
|
|
52
62
|
"databaseId",
|
|
63
|
+
"databaseType",
|
|
64
|
+
"deepLink",
|
|
53
65
|
"default",
|
|
54
66
|
"description",
|
|
55
67
|
"direction",
|
|
@@ -59,6 +71,7 @@ export const GENERATED_ALLOWLISTED_FIELDS = [
|
|
|
59
71
|
"durationMs",
|
|
60
72
|
"email",
|
|
61
73
|
"events",
|
|
74
|
+
"expiresAt",
|
|
62
75
|
"expiresInSeconds",
|
|
63
76
|
"feature",
|
|
64
77
|
"filename",
|
|
@@ -70,7 +83,9 @@ export const GENERATED_ALLOWLISTED_FIELDS = [
|
|
|
70
83
|
"groupId",
|
|
71
84
|
"groupType",
|
|
72
85
|
"htmlBody",
|
|
86
|
+
"iconUrl",
|
|
73
87
|
"id",
|
|
88
|
+
"idempotencyKey",
|
|
74
89
|
"includeRoot",
|
|
75
90
|
"includeUserDetails",
|
|
76
91
|
"input",
|
|
@@ -84,6 +99,7 @@ export const GENERATED_ALLOWLISTED_FIELDS = [
|
|
|
84
99
|
"maxPages",
|
|
85
100
|
"message",
|
|
86
101
|
"messages",
|
|
102
|
+
"metadata",
|
|
87
103
|
"metrics",
|
|
88
104
|
"model",
|
|
89
105
|
"modelName",
|
|
@@ -94,6 +110,7 @@ export const GENERATED_ALLOWLISTED_FIELDS = [
|
|
|
94
110
|
"onConflict",
|
|
95
111
|
"onPartialFailure",
|
|
96
112
|
"operationName",
|
|
113
|
+
"operations",
|
|
97
114
|
"options",
|
|
98
115
|
"output",
|
|
99
116
|
"ownerOnly",
|
|
@@ -109,11 +126,16 @@ export const GENERATED_ALLOWLISTED_FIELDS = [
|
|
|
109
126
|
"query",
|
|
110
127
|
"queryType",
|
|
111
128
|
"recordId",
|
|
129
|
+
"recordIds",
|
|
130
|
+
"records",
|
|
112
131
|
"ref",
|
|
113
132
|
"request",
|
|
133
|
+
"resourceId",
|
|
134
|
+
"resourceType",
|
|
114
135
|
"route",
|
|
115
136
|
"runIf",
|
|
116
137
|
"saveAs",
|
|
138
|
+
"schema",
|
|
117
139
|
"scope",
|
|
118
140
|
"selector",
|
|
119
141
|
"skipWhenSkipped",
|
|
@@ -121,6 +143,7 @@ export const GENERATED_ALLOWLISTED_FIELDS = [
|
|
|
121
143
|
"source",
|
|
122
144
|
"step",
|
|
123
145
|
"strict",
|
|
146
|
+
"strictParams",
|
|
124
147
|
"subject",
|
|
125
148
|
"successWhen",
|
|
126
149
|
"systemBypass",
|
|
@@ -130,6 +153,7 @@ export const GENERATED_ALLOWLISTED_FIELDS = [
|
|
|
130
153
|
"templateType",
|
|
131
154
|
"textBody",
|
|
132
155
|
"thinkingLevel",
|
|
156
|
+
"threadId",
|
|
133
157
|
"timeout",
|
|
134
158
|
"title",
|
|
135
159
|
"to",
|
|
@@ -140,8 +164,10 @@ export const GENERATED_ALLOWLISTED_FIELDS = [
|
|
|
140
164
|
"type",
|
|
141
165
|
"user",
|
|
142
166
|
"userId",
|
|
167
|
+
"userInfo",
|
|
143
168
|
"userUlid",
|
|
144
169
|
"variables",
|
|
170
|
+
"version",
|
|
145
171
|
"windowDays",
|
|
146
172
|
"with",
|
|
147
173
|
"workflowKey",
|
|
@@ -151,18 +177,29 @@ export const GENERATED_KNOWN_KINDS = [
|
|
|
151
177
|
"analytics.query",
|
|
152
178
|
"analytics.write",
|
|
153
179
|
"analytics.writeForUser",
|
|
180
|
+
"blob.delete",
|
|
154
181
|
"blob.download",
|
|
155
182
|
"blob.signedUrl",
|
|
156
183
|
"blob.upload",
|
|
184
|
+
"block.call",
|
|
157
185
|
"collect",
|
|
186
|
+
"collection.addDocument",
|
|
187
|
+
"collection.create",
|
|
188
|
+
"collection.delete",
|
|
189
|
+
"collection.grantGroupPermission",
|
|
190
|
+
"collection.removeDocument",
|
|
158
191
|
"create",
|
|
159
192
|
"database.aggregate",
|
|
160
193
|
"database.applyToQuery",
|
|
161
194
|
"database.count",
|
|
195
|
+
"database.create",
|
|
196
|
+
"database.delete",
|
|
162
197
|
"database.mutate",
|
|
163
198
|
"database.pipeline",
|
|
164
199
|
"database.query",
|
|
200
|
+
"database.syncIndexes",
|
|
165
201
|
"delay",
|
|
202
|
+
"document.bulkUpdate",
|
|
166
203
|
"document.count",
|
|
167
204
|
"document.delete",
|
|
168
205
|
"document.getForUser",
|
|
@@ -184,14 +221,20 @@ export const GENERATED_KNOWN_KINDS = [
|
|
|
184
221
|
"gemini.generateRaw",
|
|
185
222
|
"group.addMember",
|
|
186
223
|
"group.checkMembership",
|
|
224
|
+
"group.create",
|
|
225
|
+
"group.delete",
|
|
187
226
|
"group.listMembers",
|
|
188
227
|
"group.listUserMemberships",
|
|
228
|
+
"group.removeAll",
|
|
189
229
|
"group.removeMember",
|
|
190
230
|
"hash",
|
|
191
231
|
"integration.call",
|
|
192
232
|
"iterate-users",
|
|
193
233
|
"llm.chat",
|
|
234
|
+
"metadata.read",
|
|
235
|
+
"metadata.write",
|
|
194
236
|
"noop",
|
|
237
|
+
"notification.send",
|
|
195
238
|
"prompt.execute",
|
|
196
239
|
"render",
|
|
197
240
|
"script",
|
|
@@ -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,cAAc;IACd,aAAa;IACb,UAAU;IACV,SAAS;IACT,eAAe;IACf,aAAa;IACb,SAAS;IACT,iBAAiB;IACjB,QAAQ;IACR,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,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BAA4B;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,mBAAmB;IACnB,2BAA2B;IAC3B,oBAAoB;IACpB,MAAM;IACN,kBAAkB;IAClB,eAAe;IACf,UAAU;IACV,MAAM;IACN,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;IACP,QAAQ;IACR,WAAW;IACX,kBAAkB;IAClB,SAAS;IACT,UAAU;IACV,QAAQ;IACR,SAAS;IACT,SAA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;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,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,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,6 +1,6 @@
|
|
|
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
5
|
/**
|
|
6
6
|
* Resolves the "use an existing app" app id from the two places it can be
|
|
@@ -26,7 +26,7 @@ export function resolveUseExistingAppId(flag, initConfig) {
|
|
|
26
26
|
* Throws if the string contains invalid TOML.
|
|
27
27
|
*/
|
|
28
28
|
export function parseInitConfigToml(content) {
|
|
29
|
-
const parsed =
|
|
29
|
+
const parsed = parseConfigToml(content);
|
|
30
30
|
// The cast is safe because validateInitConfig() is always called after parsing
|
|
31
31
|
return parsed;
|
|
32
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,EAAE,MAAM,KAAK,cAAc;QAAE,OAAO,UAAU,CAAC,MAAM,CAAC;IACpE,OAAO,SAAS,CAAC;AACnB,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,mBAAmB,CAAC,OAAe;IACjD,MAAM,MAAM,GAAG,eAAe,CAAC,OAAO,CAAC,CAAC;IACxC,+EAA+E;IAC/E,OAAO,MAA+B,CAAC;AACzC,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,cAAc,CAAC,GAAW;IACxC,MAAM,UAAU,GAAG,IAAI,CAAC,GAAG,EAAE,oBAAoB,CAAC,CAAC;IACnD,IAAI,CAAC,UAAU,CAAC,UAAU,CAAC,EAAE,CAAC;QAC5B,OAAO,IAAI,CAAC;IACd,CAAC;IAED,MAAM,OAAO,G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,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,17 +2,37 @@ 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;
|
|
18
38
|
/**
|
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");
|
|
@@ -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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;GAKG;AACH,MAAM,UAAU,QAAQ,CAAC,OAAe;IACtC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,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[];
|