primitive-admin 1.1.0-alpha.43 → 1.1.0-alpha.44

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (55) hide show
  1. package/README.md +2 -2
  2. package/dist/src/commands/catalog.js +3 -3
  3. package/dist/src/commands/catalog.js.map +1 -1
  4. package/dist/src/commands/databases.js +3 -3
  5. package/dist/src/commands/databases.js.map +1 -1
  6. package/dist/src/commands/guides.d.ts +86 -0
  7. package/dist/src/commands/guides.js +222 -41
  8. package/dist/src/commands/guides.js.map +1 -1
  9. package/dist/src/commands/integrations.js +2 -2
  10. package/dist/src/commands/integrations.js.map +1 -1
  11. package/dist/src/commands/prompts.js +2 -2
  12. package/dist/src/commands/prompts.js.map +1 -1
  13. package/dist/src/commands/sync.d.ts +23 -3
  14. package/dist/src/commands/sync.js +257 -93
  15. package/dist/src/commands/sync.js.map +1 -1
  16. package/dist/src/commands/workflows.js +6 -6
  17. package/dist/src/commands/workflows.js.map +1 -1
  18. package/dist/src/lib/block-layout.js +5 -5
  19. package/dist/src/lib/block-layout.js.map +1 -1
  20. package/dist/src/lib/config-toml.d.ts +10 -0
  21. package/dist/src/lib/config-toml.js +42 -0
  22. package/dist/src/lib/config-toml.js.map +1 -0
  23. package/dist/src/lib/constants.d.ts +9 -0
  24. package/dist/src/lib/constants.js +9 -0
  25. package/dist/src/lib/constants.js.map +1 -1
  26. package/dist/src/lib/db-codegen/dbGenerator.d.ts +5 -2
  27. package/dist/src/lib/db-codegen/dbGenerator.js +204 -7
  28. package/dist/src/lib/db-codegen/dbGenerator.js.map +1 -1
  29. package/dist/src/lib/db-codegen/dbNaming.d.ts +29 -0
  30. package/dist/src/lib/db-codegen/dbNaming.js +58 -0
  31. package/dist/src/lib/db-codegen/dbNaming.js.map +1 -1
  32. package/dist/src/lib/db-codegen/dbTemplates.d.ts +125 -4
  33. package/dist/src/lib/db-codegen/dbTemplates.js +183 -16
  34. package/dist/src/lib/db-codegen/dbTemplates.js.map +1 -1
  35. package/dist/src/lib/generated-allowlist.js +1 -0
  36. package/dist/src/lib/generated-allowlist.js.map +1 -1
  37. package/dist/src/lib/init-config.js +2 -2
  38. package/dist/src/lib/init-config.js.map +1 -1
  39. package/dist/src/lib/toml-database-config.d.ts +10 -39
  40. package/dist/src/lib/toml-database-config.js +16 -82
  41. package/dist/src/lib/toml-database-config.js.map +1 -1
  42. package/dist/src/lib/toml-metadata-config.d.ts +1 -1
  43. package/dist/src/lib/toml-metadata-config.js +3 -3
  44. package/dist/src/lib/toml-metadata-config.js.map +1 -1
  45. package/dist/src/lib/toml-native-form.d.ts +46 -0
  46. package/dist/src/lib/toml-native-form.js +78 -0
  47. package/dist/src/lib/toml-native-form.js.map +1 -0
  48. package/dist/src/lib/workflow-fragments.js +3 -3
  49. package/dist/src/lib/workflow-fragments.js.map +1 -1
  50. package/dist/src/lib/workflow-toml-validator.d.ts +1 -1
  51. package/dist/src/lib/workflow-toml-validator.js +1 -1
  52. package/dist/src/validators.d.ts +4 -3
  53. package/dist/src/validators.js +6 -5
  54. package/dist/src/validators.js.map +1 -1
  55. package/package.json +2 -2
@@ -11,7 +11,12 @@
11
11
  * classes — so we emit plain `export interface` types with no class
12
12
  * shell, no barrel registration, and `import type` only.
13
13
  * 2. We add an OPERATIONS half codegen-v2 has no analog for: per-op
14
- * input-params interfaces + per-op result aliases keyed off `op.type`.
14
+ * input-params interfaces + per-op result aliases. The alias for an op
15
+ * is derived from `op.type` AND, where it matters, the op's parsed
16
+ * `definition`: a query op's `projection` (#1439), a mutation op's step
17
+ * kinds (#1438), and a pipeline op's `return` step (#1437). The generator
18
+ * resolves those into the small descriptors below; the templates stay pure
19
+ * string-emitters.
15
20
  */
16
21
  /** A field on a record interface (read shape). */
17
22
  export interface RecordField {
@@ -59,6 +64,55 @@ export interface RenderOpParamsInterfaceInput {
59
64
  opName: string;
60
65
  params: ParamField[];
61
66
  }
67
+ /**
68
+ * How a query op's static `projection` narrows its record type (#1439). The
69
+ * generator resolves the projection against the model's record fields (guarding
70
+ * unknown / nested keys) and hands the template one of these; the template only
71
+ * assembles the `Pick`/`Partial` string.
72
+ * - `full` → `QueryResult<M>` (no projection, empty `{}`, or no schema).
73
+ * - `pick` → `QueryResult<Pick<M, ...fields>>` (inclusion; `id` folded in).
74
+ * - `partial` → `QueryResult<Partial<M>>` (dynamic / mixed / unknown-key, and
75
+ * exclusion — the DO runtime does not strip excluded fields yet,
76
+ * so an `Omit` would hide fields still returned; #1439/Codex-P2).
77
+ */
78
+ export type ProjectionClassification = {
79
+ kind: "full";
80
+ } | {
81
+ kind: "pick";
82
+ fields: string[];
83
+ } | {
84
+ kind: "partial";
85
+ };
86
+ /**
87
+ * Which flat-vs-batch result shape a `mutation` op produces (#1438), resolved
88
+ * from the op definition's step kinds by the generator:
89
+ * - `batch` → `MutationResult` (any save/patch/delete step; the `/batch`
90
+ * response the runtime returns as `results[0]`).
91
+ * - `increment` → `IncrementMutationResult` (increment-only).
92
+ * - `stringset` → `StringSetMutationResult` (addToSet/removeFromSet-only).
93
+ * - `mixed` → `IncrementMutationResult | StringSetMutationResult` (a mix
94
+ * of only individual increment + stringset steps; no `/batch`
95
+ * is sent, so the runtime returns the first op's flat shape).
96
+ * - `opaque` → `MutationResult` fallback (empty / malformed / unresolvable).
97
+ */
98
+ export type MutationResultCategory = "batch" | "increment" | "stringset" | "mixed" | "opaque";
99
+ /**
100
+ * A `pipeline` op's resolved `return` step (#1437). The runtime flattens a
101
+ * returning pipeline to the returned step's shape, so codegen types it as that
102
+ * step's result. `return: "all"`, no `return`, or any step the generator can't
103
+ * resolve fall back to `opaque` → the generic `PipelineResult`.
104
+ */
105
+ export type PipelineReturnDescriptor = {
106
+ kind: "query";
107
+ recordInterfaceName: string | null;
108
+ projection?: ProjectionClassification;
109
+ } | {
110
+ kind: "count";
111
+ } | {
112
+ kind: "aggregate";
113
+ } | {
114
+ kind: "opaque";
115
+ };
62
116
  export interface RenderOpResultAliasInput {
63
117
  /** Per-op result alias name (e.g. `SaveAccountResult`). */
64
118
  aliasName: string;
@@ -72,9 +126,29 @@ export interface RenderOpResultAliasInput {
72
126
  * interface (e.g. pipeline) — falls back to `QueryResult<Record<string, unknown>>`.
73
127
  */
74
128
  recordInterfaceName: string | null;
129
+ /**
130
+ * For `query` ops (#1439), how the op's `projection` narrows the record type.
131
+ * Absent → treated as `full`.
132
+ */
133
+ projection?: ProjectionClassification;
134
+ /**
135
+ * For `mutation` ops (#1438), which flat-vs-batch result shape the op
136
+ * produces. Absent → the generic `MutationResult`.
137
+ */
138
+ mutationCategory?: MutationResultCategory;
139
+ /**
140
+ * For `pipeline` ops (#1437), the resolved `return`-step descriptor. Absent
141
+ * or `opaque` → the generic `PipelineResult`.
142
+ */
143
+ pipelineReturn?: PipelineReturnDescriptor;
75
144
  }
76
- /** The shared generic result aliases, keyed off `op.type`. */
77
- export declare const RESULT_ALIASES_BLOCK = "// Generic per-op result shapes, keyed off the operation type. The op\n// return contract is NOT stored in the TOML \u2014 these mirror the runtime\n// result shapes produced by the database-operations controller.\n\n/** `query` ops return a page of records. */\nexport interface QueryResult<T = Record<string, unknown>> {\n data: T[];\n hasMore?: boolean;\n nextCursor?: string;\n}\n\n/** `mutation` ops return per-step results. */\nexport interface MutationResult {\n results: unknown[];\n}\n\n/** `count` ops return a single count. */\nexport interface CountResult {\n count: number;\n}\n\n/** `aggregate` ops return a single result object. */\nexport interface AggregateResult {\n result: Record<string, unknown>;\n}\n\n/** `applyToQuery` ops return match/affect/fail counts. */\nexport interface ApplyToQueryResult {\n matched: number;\n affected: number;\n failed: number;\n sample?: unknown[];\n}\n\n/** `pipeline` ops return per-step results keyed by step name. */\nexport interface PipelineResult {\n steps: Record<string, unknown>;\n}\n";
145
+ /**
146
+ * The shared generic result shapes referenced by the per-op aliases. These
147
+ * mirror the runtime result shapes produced by the database-operations
148
+ * controller; per-op aliases point at them (and, where the definition makes the
149
+ * shape derivable, at a narrowed form — see `renderOpResultAlias`).
150
+ */
151
+ export declare const RESULT_ALIASES_BLOCK = "// Generic per-op result shapes. These mirror the runtime result shapes\n// produced by the database-operations controller; per-op aliases reference\n// them (or a narrowed form when the op definition makes the shape derivable).\n\n/** `query` ops return a page of records. */\nexport interface QueryResult<T = Record<string, unknown>> {\n data: T[];\n hasMore?: boolean;\n nextCursor?: string;\n}\n\n/** One write-step result inside a `mutation` op's batch response. */\nexport interface MutationStepResult {\n success: boolean;\n id: string;\n}\n\n/**\n * `mutation` ops composed of save/patch/delete steps return the batch\n * write-step results, in the batch (save/patch/delete) step order. Individual\n * increment/stringset steps in the same op are not reflected here \u2014 the runtime\n * returns only the batch call's body.\n */\nexport interface MutationResult {\n results: MutationStepResult[];\n}\n\n/** `mutation` ops composed only of `increment` steps return a flat result. */\nexport interface IncrementMutationResult {\n success: boolean;\n id: string;\n values: Record<string, number>;\n}\n\n/** `mutation` ops composed only of addToSet/removeFromSet steps return a flat result. */\nexport interface StringSetMutationResult {\n success: boolean;\n}\n\n/** `count` ops return a single count. */\nexport interface CountResult {\n count: number;\n}\n\n/** `aggregate` ops return a single result object. */\nexport interface AggregateResult {\n result: Record<string, unknown>;\n}\n\n/** `applyToQuery` ops return match/affect/fail counts. */\nexport interface ApplyToQueryResult {\n matched: number;\n affected: number;\n failed: number;\n sample?: unknown[];\n}\n\n/** `pipeline` ops return per-step results keyed by step name. */\nexport interface PipelineResult {\n steps: Record<string, unknown>;\n}\n";
78
152
  /**
79
153
  * Render the header (banner + regen hint + fingerprint).
80
154
  */
@@ -92,6 +166,53 @@ export declare function renderRecordInterface(input: RenderRecordInterfaceInput)
92
166
  */
93
167
  export declare function renderOpParamsInterface(input: RenderOpParamsInterfaceInput): string;
94
168
  /**
95
- * Render a per-op result alias keyed off `op.type`.
169
+ * Render a per-op result alias. The alias is derived from `op.type` and, where
170
+ * the shape is derivable from the parsed op definition, a narrowed form:
171
+ * - `query` → `QueryResult<M>`, narrowed by the op `projection` (#1439).
172
+ * - `mutation` → `MutationResult` / `IncrementMutationResult` /
173
+ * `StringSetMutationResult` (or the union of the last two for
174
+ * a mixed individual-only op) per the op's step kinds (#1438).
175
+ * - `pipeline` → the returned step's result type (#1437); `return: "all"` /
176
+ * no-return / unresolvable keep the generic `PipelineResult`.
96
177
  */
97
178
  export declare function renderOpResultAlias(input: RenderOpResultAliasInput): string;
179
+ /** One operation the typed-ops factory exposes as a method (#1441). */
180
+ export interface OpsFactoryOp {
181
+ /**
182
+ * Object-literal property key for the method — bare (`getX`) for a plain JS
183
+ * identifier, or a quoted string (`"get-x"`, `"delete"`) for a hyphenated /
184
+ * reserved-word / leading-digit op name. Produced by `opPropertyKey`.
185
+ */
186
+ propertyKey: string;
187
+ /** Exact operation name passed as the `executeOperation` string argument. */
188
+ opName: string;
189
+ /** The op's `<Op>Params` interface name (write shape). */
190
+ paramsInterfaceName: string;
191
+ /** The op's `<Op>Result` alias name (read shape). */
192
+ resultAliasName: string;
193
+ /**
194
+ * Whether the op declares any params. A param-less op yields a method callable
195
+ * with no arguments (`ops.foo()`); its only arg is the optional `options`.
196
+ */
197
+ hasParams: boolean;
198
+ }
199
+ export interface RenderOpsFactoryInput {
200
+ /** Factory function name (e.g. `securitiesRefOps`). */
201
+ factoryName: string;
202
+ /** Database type name, for the doc comment. */
203
+ databaseType: string;
204
+ /** Operations to expose, in deterministic (name-sorted) order. */
205
+ ops: OpsFactoryOp[];
206
+ }
207
+ /**
208
+ * Render the typed-operations factory (#1441): an inlined structural client
209
+ * interface + a shared call-options type + the `export function <type>Ops`
210
+ * factory. Each method pairs an op's `<Op>Params` input with its `<Op>Result`
211
+ * output and calls `client.databases.executeOperation<<Op>Result>(...)`, so the
212
+ * generated code carries no `as` cast and no import — the real `JsBaoClient`
213
+ * satisfies the structural `OpsClient` param.
214
+ *
215
+ * Returns "" for a database type with no operations, so the caller can omit the
216
+ * factory entirely rather than emit an empty function.
217
+ */
218
+ export declare function renderOpsFactory(input: RenderOpsFactoryInput): string;
@@ -11,15 +11,25 @@
11
11
  * classes — so we emit plain `export interface` types with no class
12
12
  * shell, no barrel registration, and `import type` only.
13
13
  * 2. We add an OPERATIONS half codegen-v2 has no analog for: per-op
14
- * input-params interfaces + per-op result aliases keyed off `op.type`.
14
+ * input-params interfaces + per-op result aliases. The alias for an op
15
+ * is derived from `op.type` AND, where it matters, the op's parsed
16
+ * `definition`: a query op's `projection` (#1439), a mutation op's step
17
+ * kinds (#1438), and a pipeline op's `return` step (#1437). The generator
18
+ * resolves those into the small descriptors below; the templates stay pure
19
+ * string-emitters.
15
20
  */
16
21
  import { tsTypeForDbField, tsTypeForDbParamType } from "./dbTsTypes.js";
17
22
  const HEADER_BANNER = "// AUTO-GENERATED FROM database-types TOML — DO NOT EDIT.";
18
23
  const REGEN_INSTRUCTION = "// Run `primitive databases codegen <database-type>` to regenerate.";
19
- /** The shared generic result aliases, keyed off `op.type`. */
20
- export const RESULT_ALIASES_BLOCK = `// Generic per-op result shapes, keyed off the operation type. The op
21
- // return contract is NOT stored in the TOML — these mirror the runtime
22
- // result shapes produced by the database-operations controller.
24
+ /**
25
+ * The shared generic result shapes referenced by the per-op aliases. These
26
+ * mirror the runtime result shapes produced by the database-operations
27
+ * controller; per-op aliases point at them (and, where the definition makes the
28
+ * shape derivable, at a narrowed form — see `renderOpResultAlias`).
29
+ */
30
+ export const RESULT_ALIASES_BLOCK = `// Generic per-op result shapes. These mirror the runtime result shapes
31
+ // produced by the database-operations controller; per-op aliases reference
32
+ // them (or a narrowed form when the op definition makes the shape derivable).
23
33
 
24
34
  /** \`query\` ops return a page of records. */
25
35
  export interface QueryResult<T = Record<string, unknown>> {
@@ -28,9 +38,32 @@ export interface QueryResult<T = Record<string, unknown>> {
28
38
  nextCursor?: string;
29
39
  }
30
40
 
31
- /** \`mutation\` ops return per-step results. */
41
+ /** One write-step result inside a \`mutation\` op's batch response. */
42
+ export interface MutationStepResult {
43
+ success: boolean;
44
+ id: string;
45
+ }
46
+
47
+ /**
48
+ * \`mutation\` ops composed of save/patch/delete steps return the batch
49
+ * write-step results, in the batch (save/patch/delete) step order. Individual
50
+ * increment/stringset steps in the same op are not reflected here — the runtime
51
+ * returns only the batch call's body.
52
+ */
32
53
  export interface MutationResult {
33
- results: unknown[];
54
+ results: MutationStepResult[];
55
+ }
56
+
57
+ /** \`mutation\` ops composed only of \`increment\` steps return a flat result. */
58
+ export interface IncrementMutationResult {
59
+ success: boolean;
60
+ id: string;
61
+ values: Record<string, number>;
62
+ }
63
+
64
+ /** \`mutation\` ops composed only of addToSet/removeFromSet steps return a flat result. */
65
+ export interface StringSetMutationResult {
66
+ success: boolean;
34
67
  }
35
68
 
36
69
  /** \`count\` ops return a single count. */
@@ -131,29 +164,163 @@ export function renderOpParamsInterface(input) {
131
164
  return lines.join("\n");
132
165
  }
133
166
  /**
134
- * Render a per-op result alias keyed off `op.type`.
167
+ * Compute the generic argument for a `QueryResult<...>` from the op's record
168
+ * interface + projection classification (#1439). Reused for a pipeline op's
169
+ * returning `query` step (#1437), so both type identically to a plain query.
170
+ *
171
+ * A null record interface (the op's model has no `[models.*]` schema) has
172
+ * nothing to `Pick` from, so it always falls back to
173
+ * `Record<string, unknown>` regardless of any projection.
174
+ */
175
+ function queryResultGeneric(recordInterfaceName, projection) {
176
+ if (recordInterfaceName === null)
177
+ return "Record<string, unknown>";
178
+ const p = projection ?? { kind: "full" };
179
+ switch (p.kind) {
180
+ case "full":
181
+ return recordInterfaceName;
182
+ case "partial":
183
+ return `Partial<${recordInterfaceName}>`;
184
+ case "pick": {
185
+ // The generator guarantees a non-empty, field-guarded, sorted list; a
186
+ // defensive empty check keeps this total. Field names are emitted as TS
187
+ // string literals via JSON.stringify.
188
+ if (p.fields.length === 0)
189
+ return recordInterfaceName;
190
+ const members = p.fields.map((f) => JSON.stringify(f)).join(" | ");
191
+ return `Pick<${recordInterfaceName}, ${members}>`;
192
+ }
193
+ }
194
+ }
195
+ /**
196
+ * Render a per-op result alias. The alias is derived from `op.type` and, where
197
+ * the shape is derivable from the parsed op definition, a narrowed form:
198
+ * - `query` → `QueryResult<M>`, narrowed by the op `projection` (#1439).
199
+ * - `mutation` → `MutationResult` / `IncrementMutationResult` /
200
+ * `StringSetMutationResult` (or the union of the last two for
201
+ * a mixed individual-only op) per the op's step kinds (#1438).
202
+ * - `pipeline` → the returned step's result type (#1437); `return: "all"` /
203
+ * no-return / unresolvable keep the generic `PipelineResult`.
135
204
  */
136
205
  export function renderOpResultAlias(input) {
137
- const { aliasName, opType, recordInterfaceName } = input;
206
+ const { aliasName, opType, recordInterfaceName, projection } = input;
138
207
  switch (opType) {
139
- case "query": {
140
- const generic = recordInterfaceName ?? "Record<string, unknown>";
141
- return `export type ${aliasName} = QueryResult<${generic}>;`;
208
+ case "query":
209
+ return `export type ${aliasName} = QueryResult<${queryResultGeneric(recordInterfaceName, projection)}>;`;
210
+ case "mutation": {
211
+ switch (input.mutationCategory) {
212
+ case "increment":
213
+ return `export type ${aliasName} = IncrementMutationResult;`;
214
+ case "stringset":
215
+ return `export type ${aliasName} = StringSetMutationResult;`;
216
+ // A mix of only individual increment + stringset steps sends no
217
+ // `/batch`, so the runtime returns the first op's flat response — one
218
+ // of these two shapes, never a `{ results: [...] }` body.
219
+ case "mixed":
220
+ return `export type ${aliasName} = IncrementMutationResult | StringSetMutationResult;`;
221
+ // `batch` and `opaque` (empty/malformed/unresolvable) both fall back to
222
+ // the batch `MutationResult` — the most common shape and the safe
223
+ // default when the step kinds can't be resolved.
224
+ case "batch":
225
+ case "opaque":
226
+ default:
227
+ return `export type ${aliasName} = MutationResult;`;
228
+ }
142
229
  }
143
- case "mutation":
144
- return `export type ${aliasName} = MutationResult;`;
145
230
  case "count":
146
231
  return `export type ${aliasName} = CountResult;`;
147
232
  case "aggregate":
148
233
  return `export type ${aliasName} = AggregateResult;`;
149
234
  case "applyToQuery":
150
235
  return `export type ${aliasName} = ApplyToQueryResult;`;
151
- case "pipeline":
152
- return `export type ${aliasName} = PipelineResult;`;
236
+ case "pipeline": {
237
+ const d = input.pipelineReturn ?? { kind: "opaque" };
238
+ switch (d.kind) {
239
+ case "query":
240
+ return `export type ${aliasName} = QueryResult<${queryResultGeneric(d.recordInterfaceName, d.projection)}>;`;
241
+ case "count":
242
+ return `export type ${aliasName} = CountResult;`;
243
+ case "aggregate":
244
+ return `export type ${aliasName} = AggregateResult;`;
245
+ // `opaque` — `return: "all"`, no `return`, or a step the generator
246
+ // couldn't resolve — keeps the generic `PipelineResult` (unchanged).
247
+ case "opaque":
248
+ default:
249
+ return `export type ${aliasName} = PipelineResult;`;
250
+ }
251
+ }
153
252
  default:
154
253
  // Unknown op type — emit a permissive alias rather than throwing,
155
254
  // so one stray op doesn't block codegen for the whole file.
156
255
  return `export type ${aliasName} = unknown;`;
157
256
  }
158
257
  }
258
+ /**
259
+ * Render the typed-operations factory (#1441): an inlined structural client
260
+ * interface + a shared call-options type + the `export function <type>Ops`
261
+ * factory. Each method pairs an op's `<Op>Params` input with its `<Op>Result`
262
+ * output and calls `client.databases.executeOperation<<Op>Result>(...)`, so the
263
+ * generated code carries no `as` cast and no import — the real `JsBaoClient`
264
+ * satisfies the structural `OpsClient` param.
265
+ *
266
+ * Returns "" for a database type with no operations, so the caller can omit the
267
+ * factory entirely rather than emit an empty function.
268
+ */
269
+ export function renderOpsFactory(input) {
270
+ const { factoryName, databaseType, ops } = input;
271
+ if (ops.length === 0)
272
+ return "";
273
+ const clientInterface = [
274
+ "// Minimal structural client shape — inlined so this file stays import-free",
275
+ "// and carries no runtime dependency on the client package. The real",
276
+ "// `JsBaoClient` satisfies it structurally.",
277
+ "interface OpsClient {",
278
+ " databases: {",
279
+ " executeOperation<R>(",
280
+ " databaseId: string,",
281
+ " name: string,",
282
+ " options?: {",
283
+ // `object` (not `Record<string, unknown>`) so a strict generated `<Op>Params`
284
+ // interface — which has no index signature — is still assignable here.
285
+ " params?: object;",
286
+ " limit?: number;",
287
+ " cursor?: string;",
288
+ " direction?: 1 | -1;",
289
+ " timing?: boolean;",
290
+ " },",
291
+ " ): Promise<R>;",
292
+ " };",
293
+ "}",
294
+ ].join("\n");
295
+ const optionsType = [
296
+ "// Non-param options (pagination + diagnostics) each factory method accepts",
297
+ "// alongside its params, passed straight through to `executeOperation`.",
298
+ "interface OpsCallOptions {",
299
+ " limit?: number;",
300
+ " cursor?: string;",
301
+ " direction?: 1 | -1;",
302
+ " timing?: boolean;",
303
+ "}",
304
+ ].join("\n");
305
+ const methodLines = ops.map((op) => {
306
+ const nameLiteral = JSON.stringify(op.opName);
307
+ if (op.hasParams) {
308
+ return (` ${op.propertyKey}: (params: ${op.paramsInterfaceName}, options?: OpsCallOptions): Promise<${op.resultAliasName}> =>\n` +
309
+ ` client.databases.executeOperation<${op.resultAliasName}>(databaseId, ${nameLiteral}, { params, ...options }),`);
310
+ }
311
+ // No declared params: the method takes only the optional options object, so
312
+ // it stays callable with no arguments (`ops.foo()`).
313
+ return (` ${op.propertyKey}: (options?: OpsCallOptions): Promise<${op.resultAliasName}> =>\n` +
314
+ ` client.databases.executeOperation<${op.resultAliasName}>(databaseId, ${nameLiteral}, { ...options }),`);
315
+ });
316
+ const factory = [
317
+ `/** Typed accessor for \`${databaseType}\` operations. */`,
318
+ `export function ${factoryName}(client: OpsClient, databaseId: string) {`,
319
+ " return {",
320
+ ...methodLines,
321
+ " };",
322
+ "}",
323
+ ].join("\n");
324
+ return [clientInterface, optionsType, factory].join("\n\n");
325
+ }
159
326
  //# sourceMappingURL=dbTemplates.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"dbTemplates.js","sourceRoot":"","sources":["../../../../src/lib/db-codegen/dbTemplates.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAExE,MAAM,aAAa,GACjB,2DAA2D,CAAC;AAC9D,MAAM,iBAAiB,GACrB,qEAAqE,CAAC;AAmExE,8DAA8D;AAC9D,MAAM,CAAC,MAAM,oBAAoB,GAAG;;;;;;;;;;;;;;;;;;;;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 -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,UAAU;IACV,WAAW;IACX,UAAU;IACV,UAAU;IACV,WAAW;IACX,iBAAiB;IACjB,OAAO;IACP,UAAU;IACV,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,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,WAAW;IACX,SAAS;IAC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AQ;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,UAAU;IACV,UAAU;IACV,WAAW;IACX,iBAAiB;IACjB,OAAO;IACP,UAAU;IACV,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,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,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AAU;IACV,eAAe;IACf,gBAAgB;IAChB,MAAM;IACN,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 * as TOML from "@iarna/toml";
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 = TOML.parse(content);
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,KAAK,IAAI,MAAM,aAAa,CAAC;AAEpC,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,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;IACnC,+EAA+E;IAC/E,O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AC;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"}
@@ -14,35 +14,18 @@
14
14
  * form ("legacy") or nested-table form ("native") for each of
15
15
  * `definition` and `params`. This drives form preservation on
16
16
  * `sync pull`.
17
- * 2. `canEmitNative()` — recursively check whether a JS value is
18
- * representable as a TOML value. Returns a reason string if not.
19
- * Mainly catches `null` and mixed-type arrays, which `@iarna/toml`
20
- * either rejects or silently mangles.
17
+ * 2. `canEmitNative()` — recursively check whether a JS value can be
18
+ * represented in TOML **without data loss**. Returns a reason string
19
+ * if not. Catches `null`/`undefined` (and arrays containing `null`),
20
+ * which every TOML serializer silently drops on write. Heterogeneous
21
+ * arrays are fine — the config round-trip uses `smol-toml` (TOML 1.0),
22
+ * which emits and re-parses them faithfully (issue #1450).
21
23
  * 3. `buildDatabaseTypeTomlData()` — builds the JS object that we
22
- * hand to `TOML.stringify`. Per operation, decides JSON-string vs
24
+ * hand to `stringifyConfigToml`. Per operation, decides JSON-string vs
23
25
  * native based on (existing form, can-emit, override mode).
24
26
  */
25
- export type FieldForm = "native" | "legacy";
26
- /**
27
- * Classify a single-line TOML field value (the text after `key = `) as
28
- * native or legacy form.
29
- *
30
- * An inline table (`{ ... }`) or inline array (`[ ... ]`) is native TOML —
31
- * the operator/param structure is written directly, so `sync pull` should
32
- * re-emit it through the native-emission path rather than collapse it back
33
- * to an opaque JSON string. A quoted string (`'...'` / `"..."`) is the
34
- * legacy JSON-string form.
35
- *
36
- * This is the fix for issue #1255: previously ANY `definition = <value>`
37
- * one-liner was classified `legacy`, so an author who wrote the compact
38
- * inline form `definition = { filter = { "$in" = [1, 2] } }` got an opaque
39
- * JSON string back on the next pull (churn). Distinguishing the two makes
40
- * the inline form round-trip stably through the existing native-emission
41
- * path.
42
- *
43
- * Exported for reuse by `[[subscriptions]]` form detection (issue #803).
44
- */
45
- export declare function classifyInlineFieldForm(rawValue: string): FieldForm;
27
+ import { type FieldForm } from "./toml-native-form.js";
28
+ export { type FieldForm, classifyInlineFieldForm, canEmitNative, } from "./toml-native-form.js";
46
29
  export interface OperationFormHints {
47
30
  /** Map of op name → existing form for `definition`. Missing op = "default". */
48
31
  definition: Map<string, FieldForm>;
@@ -59,18 +42,6 @@ export interface OperationFormHints {
59
42
  * sub-header (native).
60
43
  */
61
44
  export declare function detectExistingOperationForms(rawToml: string): OperationFormHints;
62
- /**
63
- * Recursively check whether a JS value can be safely serialized to TOML
64
- * using `@iarna/toml`. Returns null if OK, a reason string otherwise.
65
- *
66
- * Things TOML can't represent (in `@iarna/toml`):
67
- * - `null` (TOML has no null).
68
- * - Arrays containing values of different "TOML types" (e.g. mixed
69
- * string and number). Spec-wise TOML 1.0 actually allows this, but
70
- * `@iarna/toml` is strict and throws.
71
- * - `undefined` (different from null but equally not representable).
72
- */
73
- export declare function canEmitNative(value: any): string | null;
74
45
  /**
75
46
  * Normalize a `params` value into a sorted array of
76
47
  * `{ name, type, required, ... }` rows, suitable for emitting as
@@ -99,7 +70,7 @@ export interface BuildOptions {
99
70
  subscriptions?: any[];
100
71
  }
101
72
  /**
102
- * Build the JS object to pass to `TOML.stringify` for a database-type
73
+ * Build the JS object to pass to `stringifyConfigToml` for a database-type
103
74
  * config file. Per operation:
104
75
  * - If the chosen form is "native" AND `definition` is TOML-emittable,
105
76
  * emit `[operations.definition]` (nested table).