@sequenceholdings/orm 0.1.0 → 0.1.2

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 (63) hide show
  1. package/README.md +1 -1
  2. package/dist/authoring.cjs +794 -0
  3. package/dist/authoring.cjs.map +1 -0
  4. package/dist/authoring.d.cts +274 -0
  5. package/dist/authoring.d.ts +274 -0
  6. package/dist/authoring.js +763 -0
  7. package/dist/authoring.js.map +1 -0
  8. package/dist/canonical.cjs +146 -0
  9. package/dist/canonical.cjs.map +1 -0
  10. package/dist/canonical.d.cts +369 -0
  11. package/dist/canonical.d.ts +369 -0
  12. package/dist/canonical.js +131 -0
  13. package/dist/canonical.js.map +1 -0
  14. package/dist/cli.cjs +6208 -1693
  15. package/dist/cli.cjs.map +1 -1
  16. package/dist/cli.d.cts +8 -1
  17. package/dist/cli.d.ts +8 -1
  18. package/dist/cli.js +6262 -1749
  19. package/dist/cli.js.map +1 -1
  20. package/dist/client.cjs +120 -0
  21. package/dist/client.cjs.map +1 -1
  22. package/dist/client.d.cts +74 -2
  23. package/dist/client.d.ts +74 -2
  24. package/dist/client.js +116 -1
  25. package/dist/client.js.map +1 -1
  26. package/dist/compiler.cjs +3001 -0
  27. package/dist/compiler.cjs.map +1 -0
  28. package/dist/compiler.d.cts +581 -0
  29. package/dist/compiler.d.ts +581 -0
  30. package/dist/compiler.js +2947 -0
  31. package/dist/compiler.js.map +1 -0
  32. package/dist/index.cjs +1730 -327
  33. package/dist/index.cjs.map +1 -1
  34. package/dist/index.d.cts +126 -56
  35. package/dist/index.d.ts +126 -56
  36. package/dist/index.js +1643 -324
  37. package/dist/index.js.map +1 -1
  38. package/dist/ir.cjs +407 -0
  39. package/dist/ir.cjs.map +1 -0
  40. package/dist/ir.d.cts +1179 -0
  41. package/dist/ir.d.ts +1179 -0
  42. package/dist/ir.js +388 -0
  43. package/dist/ir.js.map +1 -0
  44. package/dist/naming-CTvWSRTf.d.ts +79 -0
  45. package/dist/naming-DRyinU4u.d.cts +79 -0
  46. package/dist/sdl.cjs +833 -0
  47. package/dist/sdl.cjs.map +1 -0
  48. package/dist/sdl.d.cts +96 -0
  49. package/dist/sdl.d.ts +96 -0
  50. package/dist/sdl.js +809 -0
  51. package/dist/sdl.js.map +1 -0
  52. package/package.json +36 -3
  53. package/src/codegen-gql/apollo-hooks.cjs +98 -0
  54. package/src/codegen-gql/server-fns.cjs +101 -0
  55. package/templates/README.md +13 -0
  56. package/templates/orm-namespace/CLAUDE.md +81 -0
  57. package/templates/orm-namespace/codegen.ts +22 -0
  58. package/templates/orm-namespace/gitignore +5 -0
  59. package/templates/orm-namespace/graphql/example/queries.ts +56 -0
  60. package/templates/orm-namespace/package.json +24 -0
  61. package/templates/orm-namespace/schema/tables.ts +71 -0
  62. package/templates/orm-namespace/sequence.config.ts +32 -0
  63. package/templates/orm-namespace/tsconfig.json +15 -0
package/dist/ir.d.ts ADDED
@@ -0,0 +1,1179 @@
1
+ import { z } from 'zod';
2
+
3
+ /**
4
+ * Compiled-operation IR — THE frozen contract between the GraphQL compiler
5
+ * (push time, CLI preview + canonical server compile) and the data-plane
6
+ * executor (runtime). The artifact is inert, validated JSON: no generated
7
+ * code ever crosses the registry (plan §4).
8
+ *
9
+ * Design invariants:
10
+ * - Policies are BAKED IN at compile time: every table-touching node carries
11
+ * its read policy AND-ed into `where` (or `writePolicy`/`insertCheck` for
12
+ * mutation targets). Execution needs only (IR, claims, variables).
13
+ * - §4f dynamic slots: a variable typed with a generated input type
14
+ * (BoolExp/OrderBy/SelectColumn/InsertInput/SetInput/AppendInput/OnConflict)
15
+ * marks a dynamic slot. The executor validates the runtime value against
16
+ * the artifact's per-table whitelist metadata, lowers it to Drizzle, and
17
+ * ANDs it with the baked policy — the policy is non-negotiable regardless
18
+ * of what the client sends.
19
+ * - `capability`/`role` predicate leaves resolve to booleans against the
20
+ * caller's claims BEFORE execution, pruning dead branches per caller.
21
+ * - Versioned via `irVersion` + `normalizeIr` (the normalizeSnapshot
22
+ * pattern): executor upgrades decouple from artifact re-pushes.
23
+ */
24
+
25
+ declare const IR_VERSION: 1;
26
+ /** The exact claim keys the platform stamps — mirrors claims.ts. */
27
+ declare const CLAIMS_CONTRACT: {
28
+ readonly sub: "string";
29
+ readonly org: "string?";
30
+ readonly roles: "string[]";
31
+ readonly capabilities: "string[]";
32
+ };
33
+ type ClaimKey = 'sub' | 'org';
34
+ declare const valueIrSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
35
+ kind: z.ZodLiteral<"literal">;
36
+ value: z.ZodUnion<readonly [z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>, z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>>]>;
37
+ }, z.core.$strip>, z.ZodObject<{
38
+ kind: z.ZodLiteral<"variable">;
39
+ name: z.ZodString;
40
+ }, z.core.$strip>, z.ZodObject<{
41
+ kind: z.ZodLiteral<"claim">;
42
+ key: z.ZodEnum<{
43
+ sub: "sub";
44
+ org: "org";
45
+ }>;
46
+ }, z.core.$strip>], "kind">;
47
+ type ValueIr = z.infer<typeof valueIrSchema>;
48
+ declare const CMP_OPS: readonly ["eq", "neq", "gt", "gte", "lt", "lte", "in", "nin", "like", "ilike", "isNull", "contains", "hasKey"];
49
+ type CmpOp = (typeof CMP_OPS)[number];
50
+ type PredIr = {
51
+ kind: 'and';
52
+ operands: PredIr[];
53
+ } | {
54
+ kind: 'or';
55
+ operands: PredIr[];
56
+ } | {
57
+ kind: 'not';
58
+ operand: PredIr;
59
+ } | {
60
+ kind: 'cmp';
61
+ op: CmpOp;
62
+ column: string;
63
+ value: ValueIr;
64
+ }
65
+ /** EXISTS through a declared link; `where` runs against the target table. */
66
+ | {
67
+ kind: 'exists';
68
+ link: string;
69
+ where: PredIr;
70
+ }
71
+ /** Aggregation predicate (Hasura `rel_aggregate: { count: { predicate } }`). */
72
+ | {
73
+ kind: 'aggPredicate';
74
+ link: string;
75
+ fn: 'count';
76
+ op: Exclude<CmpOp, 'in' | 'nin' | 'like' | 'ilike' | 'isNull' | 'contains' | 'hasKey'>;
77
+ value: number;
78
+ where?: PredIr;
79
+ }
80
+ /** Boolean claims leaves — pre-resolved against claims before execution. */
81
+ | {
82
+ kind: 'capability';
83
+ key: string;
84
+ } | {
85
+ kind: 'role';
86
+ key: string;
87
+ }
88
+ /** §4f: a client-supplied BoolExp variable lands here, validated + lowered at runtime. */
89
+ | {
90
+ kind: 'dynamicFilter';
91
+ slot: string;
92
+ } | {
93
+ kind: 'const';
94
+ value: boolean;
95
+ };
96
+ declare const predIrSchema: z.ZodType<PredIr>;
97
+ declare const orderIrSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
98
+ kind: z.ZodLiteral<"column">;
99
+ column: z.ZodString;
100
+ link: z.ZodOptional<z.ZodString>;
101
+ direction: z.ZodEnum<{
102
+ asc: "asc";
103
+ desc: "desc";
104
+ }>;
105
+ nulls: z.ZodOptional<z.ZodEnum<{
106
+ first: "first";
107
+ last: "last";
108
+ }>>;
109
+ }, z.core.$strip>, z.ZodObject<{
110
+ kind: z.ZodLiteral<"dynamic">;
111
+ slot: z.ZodString;
112
+ }, z.core.$strip>], "kind">;
113
+ type OrderIr = z.infer<typeof orderIrSchema>;
114
+ declare const limitIrSchema: z.ZodObject<{
115
+ variable: z.ZodOptional<z.ZodString>;
116
+ value: z.ZodOptional<z.ZodNumber>;
117
+ default: z.ZodNumber;
118
+ max: z.ZodNumber;
119
+ }, z.core.$strip>;
120
+ type LimitIr = z.infer<typeof limitIrSchema>;
121
+ interface SelectionIr {
122
+ /** GraphQL type name for __typename synthesis + Apollo normalization. */
123
+ typename: string;
124
+ columns: Array<{
125
+ alias: string;
126
+ column: string;
127
+ }>;
128
+ relations: Array<{
129
+ alias: string;
130
+ link: string;
131
+ selection: SelectionIr;
132
+ /** Fixed shape from the document; policy for the target table is ALSO
133
+ * injected by the compiler into this `where` — never trust it absent. */
134
+ where?: PredIr;
135
+ orderBy?: OrderIr[];
136
+ limit?: LimitIr;
137
+ offset?: {
138
+ variable?: string;
139
+ value?: number;
140
+ };
141
+ }>;
142
+ aggregates: Array<{
143
+ alias: string;
144
+ /** Absent link = same-table aggregate (used by aggregate roots). */
145
+ link?: string;
146
+ where?: PredIr;
147
+ count?: {
148
+ columns?: string[];
149
+ distinct?: boolean;
150
+ };
151
+ sum?: string[];
152
+ avg?: string[];
153
+ /** `nodes { }` selection inside an aggregate block. */
154
+ nodes?: SelectionIr;
155
+ }>;
156
+ }
157
+ declare const selectionIrSchema: z.ZodType<SelectionIr>;
158
+
159
+ declare const rootIrSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
160
+ kind: z.ZodLiteral<"select">;
161
+ alias: z.ZodString;
162
+ table: z.ZodString;
163
+ selection: z.ZodType<SelectionIr, unknown, z.core.$ZodTypeInternals<SelectionIr, unknown>>;
164
+ where: z.ZodType<PredIr, unknown, z.core.$ZodTypeInternals<PredIr, unknown>>;
165
+ orderBy: z.ZodDefault<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
166
+ kind: z.ZodLiteral<"column">;
167
+ column: z.ZodString;
168
+ link: z.ZodOptional<z.ZodString>;
169
+ direction: z.ZodEnum<{
170
+ asc: "asc";
171
+ desc: "desc";
172
+ }>;
173
+ nulls: z.ZodOptional<z.ZodEnum<{
174
+ first: "first";
175
+ last: "last";
176
+ }>>;
177
+ }, z.core.$strip>, z.ZodObject<{
178
+ kind: z.ZodLiteral<"dynamic">;
179
+ slot: z.ZodString;
180
+ }, z.core.$strip>], "kind">>>;
181
+ distinctOn: z.ZodOptional<z.ZodUnion<readonly [z.ZodArray<z.ZodString>, z.ZodObject<{
182
+ slot: z.ZodString;
183
+ }, z.core.$strip>]>>;
184
+ limit: z.ZodObject<{
185
+ variable: z.ZodOptional<z.ZodString>;
186
+ value: z.ZodOptional<z.ZodNumber>;
187
+ default: z.ZodNumber;
188
+ max: z.ZodNumber;
189
+ }, z.core.$strip>;
190
+ offset: z.ZodOptional<z.ZodObject<{
191
+ variable: z.ZodOptional<z.ZodString>;
192
+ value: z.ZodOptional<z.ZodNumber>;
193
+ }, z.core.$strip>>;
194
+ includeIf: z.ZodOptional<z.ZodObject<{
195
+ variable: z.ZodString;
196
+ negated: z.ZodBoolean;
197
+ }, z.core.$strip>>;
198
+ }, z.core.$strip>, z.ZodObject<{
199
+ kind: z.ZodLiteral<"byPk">;
200
+ alias: z.ZodString;
201
+ table: z.ZodString;
202
+ selection: z.ZodType<SelectionIr, unknown, z.core.$ZodTypeInternals<SelectionIr, unknown>>;
203
+ pk: z.ZodArray<z.ZodObject<{
204
+ column: z.ZodString;
205
+ value: z.ZodDiscriminatedUnion<[z.ZodObject<{
206
+ kind: z.ZodLiteral<"literal">;
207
+ value: z.ZodUnion<readonly [z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>, z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>>]>;
208
+ }, z.core.$strip>, z.ZodObject<{
209
+ kind: z.ZodLiteral<"variable">;
210
+ name: z.ZodString;
211
+ }, z.core.$strip>, z.ZodObject<{
212
+ kind: z.ZodLiteral<"claim">;
213
+ key: z.ZodEnum<{
214
+ sub: "sub";
215
+ org: "org";
216
+ }>;
217
+ }, z.core.$strip>], "kind">;
218
+ }, z.core.$strip>>;
219
+ where: z.ZodType<PredIr, unknown, z.core.$ZodTypeInternals<PredIr, unknown>>;
220
+ includeIf: z.ZodOptional<z.ZodObject<{
221
+ variable: z.ZodString;
222
+ negated: z.ZodBoolean;
223
+ }, z.core.$strip>>;
224
+ }, z.core.$strip>, z.ZodObject<{
225
+ kind: z.ZodLiteral<"aggregate">;
226
+ alias: z.ZodString;
227
+ table: z.ZodString;
228
+ where: z.ZodType<PredIr, unknown, z.core.$ZodTypeInternals<PredIr, unknown>>;
229
+ count: z.ZodOptional<z.ZodObject<{
230
+ columns: z.ZodOptional<z.ZodArray<z.ZodString>>;
231
+ distinct: z.ZodOptional<z.ZodBoolean>;
232
+ }, z.core.$strip>>;
233
+ sum: z.ZodOptional<z.ZodArray<z.ZodString>>;
234
+ avg: z.ZodOptional<z.ZodArray<z.ZodString>>;
235
+ nodes: z.ZodOptional<z.ZodType<SelectionIr, unknown, z.core.$ZodTypeInternals<SelectionIr, unknown>>>;
236
+ includeIf: z.ZodOptional<z.ZodObject<{
237
+ variable: z.ZodString;
238
+ negated: z.ZodBoolean;
239
+ }, z.core.$strip>>;
240
+ }, z.core.$strip>, z.ZodObject<{
241
+ kind: z.ZodLiteral<"mutation">;
242
+ op: z.ZodEnum<{
243
+ update: "update";
244
+ delete: "delete";
245
+ insert: "insert";
246
+ insertOne: "insertOne";
247
+ updateByPk: "updateByPk";
248
+ deleteByPk: "deleteByPk";
249
+ }>;
250
+ alias: z.ZodString;
251
+ table: z.ZodString;
252
+ objects: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
253
+ slot: z.ZodString;
254
+ }, z.core.$strip>, z.ZodObject<{
255
+ rows: z.ZodArray<z.ZodArray<z.ZodObject<{
256
+ column: z.ZodString;
257
+ value: z.ZodDiscriminatedUnion<[z.ZodObject<{
258
+ kind: z.ZodLiteral<"literal">;
259
+ value: z.ZodUnion<readonly [z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>, z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>>]>;
260
+ }, z.core.$strip>, z.ZodObject<{
261
+ kind: z.ZodLiteral<"variable">;
262
+ name: z.ZodString;
263
+ }, z.core.$strip>, z.ZodObject<{
264
+ kind: z.ZodLiteral<"claim">;
265
+ key: z.ZodEnum<{
266
+ sub: "sub";
267
+ org: "org";
268
+ }>;
269
+ }, z.core.$strip>], "kind">;
270
+ }, z.core.$strip>>>;
271
+ }, z.core.$strip>]>>;
272
+ pinnedColumns: z.ZodDefault<z.ZodArray<z.ZodObject<{
273
+ column: z.ZodString;
274
+ value: z.ZodDiscriminatedUnion<[z.ZodObject<{
275
+ kind: z.ZodLiteral<"literal">;
276
+ value: z.ZodUnion<readonly [z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>, z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>>]>;
277
+ }, z.core.$strip>, z.ZodObject<{
278
+ kind: z.ZodLiteral<"variable">;
279
+ name: z.ZodString;
280
+ }, z.core.$strip>, z.ZodObject<{
281
+ kind: z.ZodLiteral<"claim">;
282
+ key: z.ZodEnum<{
283
+ sub: "sub";
284
+ org: "org";
285
+ }>;
286
+ }, z.core.$strip>], "kind">;
287
+ }, z.core.$strip>>>;
288
+ onConflict: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
289
+ slot: z.ZodString;
290
+ }, z.core.$strip>, z.ZodObject<{
291
+ constraint: z.ZodString;
292
+ updateColumns: z.ZodArray<z.ZodString>;
293
+ }, z.core.$strip>]>>;
294
+ set: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
295
+ slot: z.ZodString;
296
+ }, z.core.$strip>, z.ZodObject<{
297
+ entries: z.ZodArray<z.ZodObject<{
298
+ column: z.ZodString;
299
+ value: z.ZodDiscriminatedUnion<[z.ZodObject<{
300
+ kind: z.ZodLiteral<"literal">;
301
+ value: z.ZodUnion<readonly [z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>, z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>>]>;
302
+ }, z.core.$strip>, z.ZodObject<{
303
+ kind: z.ZodLiteral<"variable">;
304
+ name: z.ZodString;
305
+ }, z.core.$strip>, z.ZodObject<{
306
+ kind: z.ZodLiteral<"claim">;
307
+ key: z.ZodEnum<{
308
+ sub: "sub";
309
+ org: "org";
310
+ }>;
311
+ }, z.core.$strip>], "kind">;
312
+ }, z.core.$strip>>;
313
+ }, z.core.$strip>]>>;
314
+ append: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
315
+ slot: z.ZodString;
316
+ }, z.core.$strip>, z.ZodObject<{
317
+ entries: z.ZodArray<z.ZodObject<{
318
+ column: z.ZodString;
319
+ value: z.ZodDiscriminatedUnion<[z.ZodObject<{
320
+ kind: z.ZodLiteral<"literal">;
321
+ value: z.ZodUnion<readonly [z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>, z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>>]>;
322
+ }, z.core.$strip>, z.ZodObject<{
323
+ kind: z.ZodLiteral<"variable">;
324
+ name: z.ZodString;
325
+ }, z.core.$strip>, z.ZodObject<{
326
+ kind: z.ZodLiteral<"claim">;
327
+ key: z.ZodEnum<{
328
+ sub: "sub";
329
+ org: "org";
330
+ }>;
331
+ }, z.core.$strip>], "kind">;
332
+ }, z.core.$strip>>;
333
+ }, z.core.$strip>]>>;
334
+ inc: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
335
+ slot: z.ZodString;
336
+ }, z.core.$strip>, z.ZodObject<{
337
+ entries: z.ZodArray<z.ZodObject<{
338
+ column: z.ZodString;
339
+ value: z.ZodDiscriminatedUnion<[z.ZodObject<{
340
+ kind: z.ZodLiteral<"literal">;
341
+ value: z.ZodUnion<readonly [z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>, z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>>]>;
342
+ }, z.core.$strip>, z.ZodObject<{
343
+ kind: z.ZodLiteral<"variable">;
344
+ name: z.ZodString;
345
+ }, z.core.$strip>, z.ZodObject<{
346
+ kind: z.ZodLiteral<"claim">;
347
+ key: z.ZodEnum<{
348
+ sub: "sub";
349
+ org: "org";
350
+ }>;
351
+ }, z.core.$strip>], "kind">;
352
+ }, z.core.$strip>>;
353
+ }, z.core.$strip>]>>;
354
+ where: z.ZodOptional<z.ZodType<PredIr, unknown, z.core.$ZodTypeInternals<PredIr, unknown>>>;
355
+ pk: z.ZodOptional<z.ZodArray<z.ZodObject<{
356
+ column: z.ZodString;
357
+ value: z.ZodDiscriminatedUnion<[z.ZodObject<{
358
+ kind: z.ZodLiteral<"literal">;
359
+ value: z.ZodUnion<readonly [z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>, z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>>]>;
360
+ }, z.core.$strip>, z.ZodObject<{
361
+ kind: z.ZodLiteral<"variable">;
362
+ name: z.ZodString;
363
+ }, z.core.$strip>, z.ZodObject<{
364
+ kind: z.ZodLiteral<"claim">;
365
+ key: z.ZodEnum<{
366
+ sub: "sub";
367
+ org: "org";
368
+ }>;
369
+ }, z.core.$strip>], "kind">;
370
+ }, z.core.$strip>>>;
371
+ insertCheck: z.ZodOptional<z.ZodType<PredIr, unknown, z.core.$ZodTypeInternals<PredIr, unknown>>>;
372
+ returning: z.ZodNullable<z.ZodType<SelectionIr, unknown, z.core.$ZodTypeInternals<SelectionIr, unknown>>>;
373
+ affectedRows: z.ZodDefault<z.ZodBoolean>;
374
+ includeIf: z.ZodOptional<z.ZodObject<{
375
+ variable: z.ZodString;
376
+ negated: z.ZodBoolean;
377
+ }, z.core.$strip>>;
378
+ }, z.core.$strip>, z.ZodObject<{
379
+ kind: z.ZodLiteral<"action">;
380
+ alias: z.ZodString;
381
+ name: z.ZodString;
382
+ params: z.ZodArray<z.ZodObject<{
383
+ name: z.ZodString;
384
+ value: z.ZodDiscriminatedUnion<[z.ZodObject<{
385
+ kind: z.ZodLiteral<"literal">;
386
+ value: z.ZodUnion<readonly [z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>, z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>>]>;
387
+ }, z.core.$strip>, z.ZodObject<{
388
+ kind: z.ZodLiteral<"variable">;
389
+ name: z.ZodString;
390
+ }, z.core.$strip>, z.ZodObject<{
391
+ kind: z.ZodLiteral<"claim">;
392
+ key: z.ZodEnum<{
393
+ sub: "sub";
394
+ org: "org";
395
+ }>;
396
+ }, z.core.$strip>], "kind">;
397
+ }, z.core.$strip>>;
398
+ returns: z.ZodEnum<{
399
+ rows: "rows";
400
+ rowsAffected: "rowsAffected";
401
+ scalar: "scalar";
402
+ }>;
403
+ }, z.core.$strip>], "kind">;
404
+ type RootIr = z.infer<typeof rootIrSchema>;
405
+ declare const INPUT_REF_KINDS: readonly ["boolExp", "orderBy", "selectColumn", "insertInput", "setInput", "appendInput", "onConflict"];
406
+ type InputRefKind = (typeof INPUT_REF_KINDS)[number];
407
+ /**
408
+ * A declared GraphQL variable default, persisted verbatim so an omitted
409
+ * variable resolves to it instead of silently becoming NULL. Wrapped in an
410
+ * object so an explicit `= null` stays distinguishable from "no default".
411
+ * Only shapes `ValueIr` can carry are representable — the restrict pass
412
+ * rejects anything else (including §4f slot defaults) at compile time.
413
+ */
414
+ declare const variableDefaultIrSchema: z.ZodObject<{
415
+ value: z.ZodUnion<readonly [z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>, z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>>]>;
416
+ }, z.core.$strip>;
417
+ type VariableDefaultIr = z.infer<typeof variableDefaultIrSchema>;
418
+ declare const variableIrSchema: z.ZodObject<{
419
+ name: z.ZodString;
420
+ type: z.ZodUnion<readonly [z.ZodObject<{
421
+ kind: z.ZodLiteral<"scalar">;
422
+ scalar: z.ZodEnum<{
423
+ bigint: "bigint";
424
+ boolean: "boolean";
425
+ uuid: "uuid";
426
+ text: "text";
427
+ integer: "integer";
428
+ numeric: "numeric";
429
+ double: "double";
430
+ timestamptz: "timestamptz";
431
+ date: "date";
432
+ jsonb: "jsonb";
433
+ }>;
434
+ }, z.core.$strip>, z.ZodObject<{
435
+ kind: z.ZodLiteral<"enum">;
436
+ name: z.ZodString;
437
+ values: z.ZodArray<z.ZodString>;
438
+ }, z.core.$strip>, z.ZodObject<{
439
+ kind: z.ZodLiteral<"inputRef">;
440
+ input: z.ZodEnum<{
441
+ orderBy: "orderBy";
442
+ onConflict: "onConflict";
443
+ boolExp: "boolExp";
444
+ selectColumn: "selectColumn";
445
+ insertInput: "insertInput";
446
+ setInput: "setInput";
447
+ appendInput: "appendInput";
448
+ }>;
449
+ table: z.ZodString;
450
+ }, z.core.$strip>]>;
451
+ nullable: z.ZodBoolean;
452
+ list: z.ZodBoolean;
453
+ defaultValue: z.ZodOptional<z.ZodObject<{
454
+ value: z.ZodUnion<readonly [z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>, z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>>]>;
455
+ }, z.core.$strip>>;
456
+ }, z.core.$strip>;
457
+ type VariableIr = z.infer<typeof variableIrSchema>;
458
+ declare const compiledOperationSchema: z.ZodObject<{
459
+ irVersion: z.ZodLiteral<1>;
460
+ name: z.ZodString;
461
+ opHash: z.ZodString;
462
+ kind: z.ZodEnum<{
463
+ action: "action";
464
+ query: "query";
465
+ mutation: "mutation";
466
+ }>;
467
+ requires: z.ZodNullable<z.ZodObject<{
468
+ capability: z.ZodOptional<z.ZodString>;
469
+ role: z.ZodOptional<z.ZodString>;
470
+ }, z.core.$strip>>;
471
+ variables: z.ZodArray<z.ZodObject<{
472
+ name: z.ZodString;
473
+ type: z.ZodUnion<readonly [z.ZodObject<{
474
+ kind: z.ZodLiteral<"scalar">;
475
+ scalar: z.ZodEnum<{
476
+ bigint: "bigint";
477
+ boolean: "boolean";
478
+ uuid: "uuid";
479
+ text: "text";
480
+ integer: "integer";
481
+ numeric: "numeric";
482
+ double: "double";
483
+ timestamptz: "timestamptz";
484
+ date: "date";
485
+ jsonb: "jsonb";
486
+ }>;
487
+ }, z.core.$strip>, z.ZodObject<{
488
+ kind: z.ZodLiteral<"enum">;
489
+ name: z.ZodString;
490
+ values: z.ZodArray<z.ZodString>;
491
+ }, z.core.$strip>, z.ZodObject<{
492
+ kind: z.ZodLiteral<"inputRef">;
493
+ input: z.ZodEnum<{
494
+ orderBy: "orderBy";
495
+ onConflict: "onConflict";
496
+ boolExp: "boolExp";
497
+ selectColumn: "selectColumn";
498
+ insertInput: "insertInput";
499
+ setInput: "setInput";
500
+ appendInput: "appendInput";
501
+ }>;
502
+ table: z.ZodString;
503
+ }, z.core.$strip>]>;
504
+ nullable: z.ZodBoolean;
505
+ list: z.ZodBoolean;
506
+ defaultValue: z.ZodOptional<z.ZodObject<{
507
+ value: z.ZodUnion<readonly [z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>, z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>>]>;
508
+ }, z.core.$strip>>;
509
+ }, z.core.$strip>>;
510
+ tableSet: z.ZodArray<z.ZodString>;
511
+ roots: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
512
+ kind: z.ZodLiteral<"select">;
513
+ alias: z.ZodString;
514
+ table: z.ZodString;
515
+ selection: z.ZodType<SelectionIr, unknown, z.core.$ZodTypeInternals<SelectionIr, unknown>>;
516
+ where: z.ZodType<PredIr, unknown, z.core.$ZodTypeInternals<PredIr, unknown>>;
517
+ orderBy: z.ZodDefault<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
518
+ kind: z.ZodLiteral<"column">;
519
+ column: z.ZodString;
520
+ link: z.ZodOptional<z.ZodString>;
521
+ direction: z.ZodEnum<{
522
+ asc: "asc";
523
+ desc: "desc";
524
+ }>;
525
+ nulls: z.ZodOptional<z.ZodEnum<{
526
+ first: "first";
527
+ last: "last";
528
+ }>>;
529
+ }, z.core.$strip>, z.ZodObject<{
530
+ kind: z.ZodLiteral<"dynamic">;
531
+ slot: z.ZodString;
532
+ }, z.core.$strip>], "kind">>>;
533
+ distinctOn: z.ZodOptional<z.ZodUnion<readonly [z.ZodArray<z.ZodString>, z.ZodObject<{
534
+ slot: z.ZodString;
535
+ }, z.core.$strip>]>>;
536
+ limit: z.ZodObject<{
537
+ variable: z.ZodOptional<z.ZodString>;
538
+ value: z.ZodOptional<z.ZodNumber>;
539
+ default: z.ZodNumber;
540
+ max: z.ZodNumber;
541
+ }, z.core.$strip>;
542
+ offset: z.ZodOptional<z.ZodObject<{
543
+ variable: z.ZodOptional<z.ZodString>;
544
+ value: z.ZodOptional<z.ZodNumber>;
545
+ }, z.core.$strip>>;
546
+ includeIf: z.ZodOptional<z.ZodObject<{
547
+ variable: z.ZodString;
548
+ negated: z.ZodBoolean;
549
+ }, z.core.$strip>>;
550
+ }, z.core.$strip>, z.ZodObject<{
551
+ kind: z.ZodLiteral<"byPk">;
552
+ alias: z.ZodString;
553
+ table: z.ZodString;
554
+ selection: z.ZodType<SelectionIr, unknown, z.core.$ZodTypeInternals<SelectionIr, unknown>>;
555
+ pk: z.ZodArray<z.ZodObject<{
556
+ column: z.ZodString;
557
+ value: z.ZodDiscriminatedUnion<[z.ZodObject<{
558
+ kind: z.ZodLiteral<"literal">;
559
+ value: z.ZodUnion<readonly [z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>, z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>>]>;
560
+ }, z.core.$strip>, z.ZodObject<{
561
+ kind: z.ZodLiteral<"variable">;
562
+ name: z.ZodString;
563
+ }, z.core.$strip>, z.ZodObject<{
564
+ kind: z.ZodLiteral<"claim">;
565
+ key: z.ZodEnum<{
566
+ sub: "sub";
567
+ org: "org";
568
+ }>;
569
+ }, z.core.$strip>], "kind">;
570
+ }, z.core.$strip>>;
571
+ where: z.ZodType<PredIr, unknown, z.core.$ZodTypeInternals<PredIr, unknown>>;
572
+ includeIf: z.ZodOptional<z.ZodObject<{
573
+ variable: z.ZodString;
574
+ negated: z.ZodBoolean;
575
+ }, z.core.$strip>>;
576
+ }, z.core.$strip>, z.ZodObject<{
577
+ kind: z.ZodLiteral<"aggregate">;
578
+ alias: z.ZodString;
579
+ table: z.ZodString;
580
+ where: z.ZodType<PredIr, unknown, z.core.$ZodTypeInternals<PredIr, unknown>>;
581
+ count: z.ZodOptional<z.ZodObject<{
582
+ columns: z.ZodOptional<z.ZodArray<z.ZodString>>;
583
+ distinct: z.ZodOptional<z.ZodBoolean>;
584
+ }, z.core.$strip>>;
585
+ sum: z.ZodOptional<z.ZodArray<z.ZodString>>;
586
+ avg: z.ZodOptional<z.ZodArray<z.ZodString>>;
587
+ nodes: z.ZodOptional<z.ZodType<SelectionIr, unknown, z.core.$ZodTypeInternals<SelectionIr, unknown>>>;
588
+ includeIf: z.ZodOptional<z.ZodObject<{
589
+ variable: z.ZodString;
590
+ negated: z.ZodBoolean;
591
+ }, z.core.$strip>>;
592
+ }, z.core.$strip>, z.ZodObject<{
593
+ kind: z.ZodLiteral<"mutation">;
594
+ op: z.ZodEnum<{
595
+ update: "update";
596
+ delete: "delete";
597
+ insert: "insert";
598
+ insertOne: "insertOne";
599
+ updateByPk: "updateByPk";
600
+ deleteByPk: "deleteByPk";
601
+ }>;
602
+ alias: z.ZodString;
603
+ table: z.ZodString;
604
+ objects: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
605
+ slot: z.ZodString;
606
+ }, z.core.$strip>, z.ZodObject<{
607
+ rows: z.ZodArray<z.ZodArray<z.ZodObject<{
608
+ column: z.ZodString;
609
+ value: z.ZodDiscriminatedUnion<[z.ZodObject<{
610
+ kind: z.ZodLiteral<"literal">;
611
+ value: z.ZodUnion<readonly [z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>, z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>>]>;
612
+ }, z.core.$strip>, z.ZodObject<{
613
+ kind: z.ZodLiteral<"variable">;
614
+ name: z.ZodString;
615
+ }, z.core.$strip>, z.ZodObject<{
616
+ kind: z.ZodLiteral<"claim">;
617
+ key: z.ZodEnum<{
618
+ sub: "sub";
619
+ org: "org";
620
+ }>;
621
+ }, z.core.$strip>], "kind">;
622
+ }, z.core.$strip>>>;
623
+ }, z.core.$strip>]>>;
624
+ pinnedColumns: z.ZodDefault<z.ZodArray<z.ZodObject<{
625
+ column: z.ZodString;
626
+ value: z.ZodDiscriminatedUnion<[z.ZodObject<{
627
+ kind: z.ZodLiteral<"literal">;
628
+ value: z.ZodUnion<readonly [z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>, z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>>]>;
629
+ }, z.core.$strip>, z.ZodObject<{
630
+ kind: z.ZodLiteral<"variable">;
631
+ name: z.ZodString;
632
+ }, z.core.$strip>, z.ZodObject<{
633
+ kind: z.ZodLiteral<"claim">;
634
+ key: z.ZodEnum<{
635
+ sub: "sub";
636
+ org: "org";
637
+ }>;
638
+ }, z.core.$strip>], "kind">;
639
+ }, z.core.$strip>>>;
640
+ onConflict: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
641
+ slot: z.ZodString;
642
+ }, z.core.$strip>, z.ZodObject<{
643
+ constraint: z.ZodString;
644
+ updateColumns: z.ZodArray<z.ZodString>;
645
+ }, z.core.$strip>]>>;
646
+ set: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
647
+ slot: z.ZodString;
648
+ }, z.core.$strip>, z.ZodObject<{
649
+ entries: z.ZodArray<z.ZodObject<{
650
+ column: z.ZodString;
651
+ value: z.ZodDiscriminatedUnion<[z.ZodObject<{
652
+ kind: z.ZodLiteral<"literal">;
653
+ value: z.ZodUnion<readonly [z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>, z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>>]>;
654
+ }, z.core.$strip>, z.ZodObject<{
655
+ kind: z.ZodLiteral<"variable">;
656
+ name: z.ZodString;
657
+ }, z.core.$strip>, z.ZodObject<{
658
+ kind: z.ZodLiteral<"claim">;
659
+ key: z.ZodEnum<{
660
+ sub: "sub";
661
+ org: "org";
662
+ }>;
663
+ }, z.core.$strip>], "kind">;
664
+ }, z.core.$strip>>;
665
+ }, z.core.$strip>]>>;
666
+ append: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
667
+ slot: z.ZodString;
668
+ }, z.core.$strip>, z.ZodObject<{
669
+ entries: z.ZodArray<z.ZodObject<{
670
+ column: z.ZodString;
671
+ value: z.ZodDiscriminatedUnion<[z.ZodObject<{
672
+ kind: z.ZodLiteral<"literal">;
673
+ value: z.ZodUnion<readonly [z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>, z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>>]>;
674
+ }, z.core.$strip>, z.ZodObject<{
675
+ kind: z.ZodLiteral<"variable">;
676
+ name: z.ZodString;
677
+ }, z.core.$strip>, z.ZodObject<{
678
+ kind: z.ZodLiteral<"claim">;
679
+ key: z.ZodEnum<{
680
+ sub: "sub";
681
+ org: "org";
682
+ }>;
683
+ }, z.core.$strip>], "kind">;
684
+ }, z.core.$strip>>;
685
+ }, z.core.$strip>]>>;
686
+ inc: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
687
+ slot: z.ZodString;
688
+ }, z.core.$strip>, z.ZodObject<{
689
+ entries: z.ZodArray<z.ZodObject<{
690
+ column: z.ZodString;
691
+ value: z.ZodDiscriminatedUnion<[z.ZodObject<{
692
+ kind: z.ZodLiteral<"literal">;
693
+ value: z.ZodUnion<readonly [z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>, z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>>]>;
694
+ }, z.core.$strip>, z.ZodObject<{
695
+ kind: z.ZodLiteral<"variable">;
696
+ name: z.ZodString;
697
+ }, z.core.$strip>, z.ZodObject<{
698
+ kind: z.ZodLiteral<"claim">;
699
+ key: z.ZodEnum<{
700
+ sub: "sub";
701
+ org: "org";
702
+ }>;
703
+ }, z.core.$strip>], "kind">;
704
+ }, z.core.$strip>>;
705
+ }, z.core.$strip>]>>;
706
+ where: z.ZodOptional<z.ZodType<PredIr, unknown, z.core.$ZodTypeInternals<PredIr, unknown>>>;
707
+ pk: z.ZodOptional<z.ZodArray<z.ZodObject<{
708
+ column: z.ZodString;
709
+ value: z.ZodDiscriminatedUnion<[z.ZodObject<{
710
+ kind: z.ZodLiteral<"literal">;
711
+ value: z.ZodUnion<readonly [z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>, z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>>]>;
712
+ }, z.core.$strip>, z.ZodObject<{
713
+ kind: z.ZodLiteral<"variable">;
714
+ name: z.ZodString;
715
+ }, z.core.$strip>, z.ZodObject<{
716
+ kind: z.ZodLiteral<"claim">;
717
+ key: z.ZodEnum<{
718
+ sub: "sub";
719
+ org: "org";
720
+ }>;
721
+ }, z.core.$strip>], "kind">;
722
+ }, z.core.$strip>>>;
723
+ insertCheck: z.ZodOptional<z.ZodType<PredIr, unknown, z.core.$ZodTypeInternals<PredIr, unknown>>>;
724
+ returning: z.ZodNullable<z.ZodType<SelectionIr, unknown, z.core.$ZodTypeInternals<SelectionIr, unknown>>>;
725
+ affectedRows: z.ZodDefault<z.ZodBoolean>;
726
+ includeIf: z.ZodOptional<z.ZodObject<{
727
+ variable: z.ZodString;
728
+ negated: z.ZodBoolean;
729
+ }, z.core.$strip>>;
730
+ }, z.core.$strip>, z.ZodObject<{
731
+ kind: z.ZodLiteral<"action">;
732
+ alias: z.ZodString;
733
+ name: z.ZodString;
734
+ params: z.ZodArray<z.ZodObject<{
735
+ name: z.ZodString;
736
+ value: z.ZodDiscriminatedUnion<[z.ZodObject<{
737
+ kind: z.ZodLiteral<"literal">;
738
+ value: z.ZodUnion<readonly [z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>, z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>>]>;
739
+ }, z.core.$strip>, z.ZodObject<{
740
+ kind: z.ZodLiteral<"variable">;
741
+ name: z.ZodString;
742
+ }, z.core.$strip>, z.ZodObject<{
743
+ kind: z.ZodLiteral<"claim">;
744
+ key: z.ZodEnum<{
745
+ sub: "sub";
746
+ org: "org";
747
+ }>;
748
+ }, z.core.$strip>], "kind">;
749
+ }, z.core.$strip>>;
750
+ returns: z.ZodEnum<{
751
+ rows: "rows";
752
+ rowsAffected: "rowsAffected";
753
+ scalar: "scalar";
754
+ }>;
755
+ }, z.core.$strip>], "kind">>;
756
+ }, z.core.$strip>;
757
+ type CompiledOperation = z.infer<typeof compiledOperationSchema>;
758
+ /**
759
+ * Runtime whitelist metadata per table — everything the executor needs to
760
+ * build Drizzle table objects, validate §4f dynamic inputs, and lower them.
761
+ * Derived from the canonical definition at compile time.
762
+ */
763
+ declare const tableMetaIrSchema: z.ZodObject<{
764
+ table: z.ZodString;
765
+ schema: z.ZodString;
766
+ typename: z.ZodString;
767
+ columns: z.ZodArray<z.ZodObject<{
768
+ name: z.ZodString;
769
+ columnName: z.ZodString;
770
+ type: z.ZodUnion<readonly [z.ZodEnum<{
771
+ bigint: "bigint";
772
+ boolean: "boolean";
773
+ uuid: "uuid";
774
+ text: "text";
775
+ integer: "integer";
776
+ numeric: "numeric";
777
+ double: "double";
778
+ timestamptz: "timestamptz";
779
+ date: "date";
780
+ jsonb: "jsonb";
781
+ }>, z.ZodObject<{
782
+ enum: z.ZodString;
783
+ values: z.ZodArray<z.ZodString>;
784
+ }, z.core.$strip>]>;
785
+ nullable: z.ZodBoolean;
786
+ }, z.core.$strip>>;
787
+ primaryKey: z.ZodArray<z.ZodString>;
788
+ links: z.ZodArray<z.ZodObject<{
789
+ name: z.ZodString;
790
+ kind: z.ZodEnum<{
791
+ toOne: "toOne";
792
+ toMany: "toMany";
793
+ toPlatformUser: "toPlatformUser";
794
+ }>;
795
+ target: z.ZodString;
796
+ on: z.ZodString;
797
+ references: z.ZodString;
798
+ }, z.core.$strip>>;
799
+ filterable: z.ZodArray<z.ZodString>;
800
+ orderable: z.ZodArray<z.ZodString>;
801
+ insertable: z.ZodArray<z.ZodString>;
802
+ settable: z.ZodArray<z.ZodString>;
803
+ appendable: z.ZodArray<z.ZodString>;
804
+ constraints: z.ZodArray<z.ZodObject<{
805
+ name: z.ZodString;
806
+ columns: z.ZodArray<z.ZodString>;
807
+ }, z.core.$strip>>;
808
+ dynamicFilterMaxDepth: z.ZodDefault<z.ZodNumber>;
809
+ dynamicFilterMaxNodes: z.ZodDefault<z.ZodNumber>;
810
+ }, z.core.$strip>;
811
+ type TableMetaIr = z.infer<typeof tableMetaIrSchema>;
812
+ declare const compiledArtifactSchema: z.ZodObject<{
813
+ irVersion: z.ZodLiteral<1>;
814
+ namespace: z.ZodString;
815
+ schemaHash: z.ZodString;
816
+ opsHash: z.ZodString;
817
+ tables: z.ZodRecord<z.ZodString, z.ZodObject<{
818
+ table: z.ZodString;
819
+ schema: z.ZodString;
820
+ typename: z.ZodString;
821
+ columns: z.ZodArray<z.ZodObject<{
822
+ name: z.ZodString;
823
+ columnName: z.ZodString;
824
+ type: z.ZodUnion<readonly [z.ZodEnum<{
825
+ bigint: "bigint";
826
+ boolean: "boolean";
827
+ uuid: "uuid";
828
+ text: "text";
829
+ integer: "integer";
830
+ numeric: "numeric";
831
+ double: "double";
832
+ timestamptz: "timestamptz";
833
+ date: "date";
834
+ jsonb: "jsonb";
835
+ }>, z.ZodObject<{
836
+ enum: z.ZodString;
837
+ values: z.ZodArray<z.ZodString>;
838
+ }, z.core.$strip>]>;
839
+ nullable: z.ZodBoolean;
840
+ }, z.core.$strip>>;
841
+ primaryKey: z.ZodArray<z.ZodString>;
842
+ links: z.ZodArray<z.ZodObject<{
843
+ name: z.ZodString;
844
+ kind: z.ZodEnum<{
845
+ toOne: "toOne";
846
+ toMany: "toMany";
847
+ toPlatformUser: "toPlatformUser";
848
+ }>;
849
+ target: z.ZodString;
850
+ on: z.ZodString;
851
+ references: z.ZodString;
852
+ }, z.core.$strip>>;
853
+ filterable: z.ZodArray<z.ZodString>;
854
+ orderable: z.ZodArray<z.ZodString>;
855
+ insertable: z.ZodArray<z.ZodString>;
856
+ settable: z.ZodArray<z.ZodString>;
857
+ appendable: z.ZodArray<z.ZodString>;
858
+ constraints: z.ZodArray<z.ZodObject<{
859
+ name: z.ZodString;
860
+ columns: z.ZodArray<z.ZodString>;
861
+ }, z.core.$strip>>;
862
+ dynamicFilterMaxDepth: z.ZodDefault<z.ZodNumber>;
863
+ dynamicFilterMaxNodes: z.ZodDefault<z.ZodNumber>;
864
+ }, z.core.$strip>>;
865
+ operations: z.ZodRecord<z.ZodString, z.ZodObject<{
866
+ irVersion: z.ZodLiteral<1>;
867
+ name: z.ZodString;
868
+ opHash: z.ZodString;
869
+ kind: z.ZodEnum<{
870
+ action: "action";
871
+ query: "query";
872
+ mutation: "mutation";
873
+ }>;
874
+ requires: z.ZodNullable<z.ZodObject<{
875
+ capability: z.ZodOptional<z.ZodString>;
876
+ role: z.ZodOptional<z.ZodString>;
877
+ }, z.core.$strip>>;
878
+ variables: z.ZodArray<z.ZodObject<{
879
+ name: z.ZodString;
880
+ type: z.ZodUnion<readonly [z.ZodObject<{
881
+ kind: z.ZodLiteral<"scalar">;
882
+ scalar: z.ZodEnum<{
883
+ bigint: "bigint";
884
+ boolean: "boolean";
885
+ uuid: "uuid";
886
+ text: "text";
887
+ integer: "integer";
888
+ numeric: "numeric";
889
+ double: "double";
890
+ timestamptz: "timestamptz";
891
+ date: "date";
892
+ jsonb: "jsonb";
893
+ }>;
894
+ }, z.core.$strip>, z.ZodObject<{
895
+ kind: z.ZodLiteral<"enum">;
896
+ name: z.ZodString;
897
+ values: z.ZodArray<z.ZodString>;
898
+ }, z.core.$strip>, z.ZodObject<{
899
+ kind: z.ZodLiteral<"inputRef">;
900
+ input: z.ZodEnum<{
901
+ orderBy: "orderBy";
902
+ onConflict: "onConflict";
903
+ boolExp: "boolExp";
904
+ selectColumn: "selectColumn";
905
+ insertInput: "insertInput";
906
+ setInput: "setInput";
907
+ appendInput: "appendInput";
908
+ }>;
909
+ table: z.ZodString;
910
+ }, z.core.$strip>]>;
911
+ nullable: z.ZodBoolean;
912
+ list: z.ZodBoolean;
913
+ defaultValue: z.ZodOptional<z.ZodObject<{
914
+ value: z.ZodUnion<readonly [z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>, z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>>]>;
915
+ }, z.core.$strip>>;
916
+ }, z.core.$strip>>;
917
+ tableSet: z.ZodArray<z.ZodString>;
918
+ roots: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
919
+ kind: z.ZodLiteral<"select">;
920
+ alias: z.ZodString;
921
+ table: z.ZodString;
922
+ selection: z.ZodType<SelectionIr, unknown, z.core.$ZodTypeInternals<SelectionIr, unknown>>;
923
+ where: z.ZodType<PredIr, unknown, z.core.$ZodTypeInternals<PredIr, unknown>>;
924
+ orderBy: z.ZodDefault<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
925
+ kind: z.ZodLiteral<"column">;
926
+ column: z.ZodString;
927
+ link: z.ZodOptional<z.ZodString>;
928
+ direction: z.ZodEnum<{
929
+ asc: "asc";
930
+ desc: "desc";
931
+ }>;
932
+ nulls: z.ZodOptional<z.ZodEnum<{
933
+ first: "first";
934
+ last: "last";
935
+ }>>;
936
+ }, z.core.$strip>, z.ZodObject<{
937
+ kind: z.ZodLiteral<"dynamic">;
938
+ slot: z.ZodString;
939
+ }, z.core.$strip>], "kind">>>;
940
+ distinctOn: z.ZodOptional<z.ZodUnion<readonly [z.ZodArray<z.ZodString>, z.ZodObject<{
941
+ slot: z.ZodString;
942
+ }, z.core.$strip>]>>;
943
+ limit: z.ZodObject<{
944
+ variable: z.ZodOptional<z.ZodString>;
945
+ value: z.ZodOptional<z.ZodNumber>;
946
+ default: z.ZodNumber;
947
+ max: z.ZodNumber;
948
+ }, z.core.$strip>;
949
+ offset: z.ZodOptional<z.ZodObject<{
950
+ variable: z.ZodOptional<z.ZodString>;
951
+ value: z.ZodOptional<z.ZodNumber>;
952
+ }, z.core.$strip>>;
953
+ includeIf: z.ZodOptional<z.ZodObject<{
954
+ variable: z.ZodString;
955
+ negated: z.ZodBoolean;
956
+ }, z.core.$strip>>;
957
+ }, z.core.$strip>, z.ZodObject<{
958
+ kind: z.ZodLiteral<"byPk">;
959
+ alias: z.ZodString;
960
+ table: z.ZodString;
961
+ selection: z.ZodType<SelectionIr, unknown, z.core.$ZodTypeInternals<SelectionIr, unknown>>;
962
+ pk: z.ZodArray<z.ZodObject<{
963
+ column: z.ZodString;
964
+ value: z.ZodDiscriminatedUnion<[z.ZodObject<{
965
+ kind: z.ZodLiteral<"literal">;
966
+ value: z.ZodUnion<readonly [z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>, z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>>]>;
967
+ }, z.core.$strip>, z.ZodObject<{
968
+ kind: z.ZodLiteral<"variable">;
969
+ name: z.ZodString;
970
+ }, z.core.$strip>, z.ZodObject<{
971
+ kind: z.ZodLiteral<"claim">;
972
+ key: z.ZodEnum<{
973
+ sub: "sub";
974
+ org: "org";
975
+ }>;
976
+ }, z.core.$strip>], "kind">;
977
+ }, z.core.$strip>>;
978
+ where: z.ZodType<PredIr, unknown, z.core.$ZodTypeInternals<PredIr, unknown>>;
979
+ includeIf: z.ZodOptional<z.ZodObject<{
980
+ variable: z.ZodString;
981
+ negated: z.ZodBoolean;
982
+ }, z.core.$strip>>;
983
+ }, z.core.$strip>, z.ZodObject<{
984
+ kind: z.ZodLiteral<"aggregate">;
985
+ alias: z.ZodString;
986
+ table: z.ZodString;
987
+ where: z.ZodType<PredIr, unknown, z.core.$ZodTypeInternals<PredIr, unknown>>;
988
+ count: z.ZodOptional<z.ZodObject<{
989
+ columns: z.ZodOptional<z.ZodArray<z.ZodString>>;
990
+ distinct: z.ZodOptional<z.ZodBoolean>;
991
+ }, z.core.$strip>>;
992
+ sum: z.ZodOptional<z.ZodArray<z.ZodString>>;
993
+ avg: z.ZodOptional<z.ZodArray<z.ZodString>>;
994
+ nodes: z.ZodOptional<z.ZodType<SelectionIr, unknown, z.core.$ZodTypeInternals<SelectionIr, unknown>>>;
995
+ includeIf: z.ZodOptional<z.ZodObject<{
996
+ variable: z.ZodString;
997
+ negated: z.ZodBoolean;
998
+ }, z.core.$strip>>;
999
+ }, z.core.$strip>, z.ZodObject<{
1000
+ kind: z.ZodLiteral<"mutation">;
1001
+ op: z.ZodEnum<{
1002
+ update: "update";
1003
+ delete: "delete";
1004
+ insert: "insert";
1005
+ insertOne: "insertOne";
1006
+ updateByPk: "updateByPk";
1007
+ deleteByPk: "deleteByPk";
1008
+ }>;
1009
+ alias: z.ZodString;
1010
+ table: z.ZodString;
1011
+ objects: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
1012
+ slot: z.ZodString;
1013
+ }, z.core.$strip>, z.ZodObject<{
1014
+ rows: z.ZodArray<z.ZodArray<z.ZodObject<{
1015
+ column: z.ZodString;
1016
+ value: z.ZodDiscriminatedUnion<[z.ZodObject<{
1017
+ kind: z.ZodLiteral<"literal">;
1018
+ value: z.ZodUnion<readonly [z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>, z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>>]>;
1019
+ }, z.core.$strip>, z.ZodObject<{
1020
+ kind: z.ZodLiteral<"variable">;
1021
+ name: z.ZodString;
1022
+ }, z.core.$strip>, z.ZodObject<{
1023
+ kind: z.ZodLiteral<"claim">;
1024
+ key: z.ZodEnum<{
1025
+ sub: "sub";
1026
+ org: "org";
1027
+ }>;
1028
+ }, z.core.$strip>], "kind">;
1029
+ }, z.core.$strip>>>;
1030
+ }, z.core.$strip>]>>;
1031
+ pinnedColumns: z.ZodDefault<z.ZodArray<z.ZodObject<{
1032
+ column: z.ZodString;
1033
+ value: z.ZodDiscriminatedUnion<[z.ZodObject<{
1034
+ kind: z.ZodLiteral<"literal">;
1035
+ value: z.ZodUnion<readonly [z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>, z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>>]>;
1036
+ }, z.core.$strip>, z.ZodObject<{
1037
+ kind: z.ZodLiteral<"variable">;
1038
+ name: z.ZodString;
1039
+ }, z.core.$strip>, z.ZodObject<{
1040
+ kind: z.ZodLiteral<"claim">;
1041
+ key: z.ZodEnum<{
1042
+ sub: "sub";
1043
+ org: "org";
1044
+ }>;
1045
+ }, z.core.$strip>], "kind">;
1046
+ }, z.core.$strip>>>;
1047
+ onConflict: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
1048
+ slot: z.ZodString;
1049
+ }, z.core.$strip>, z.ZodObject<{
1050
+ constraint: z.ZodString;
1051
+ updateColumns: z.ZodArray<z.ZodString>;
1052
+ }, z.core.$strip>]>>;
1053
+ set: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
1054
+ slot: z.ZodString;
1055
+ }, z.core.$strip>, z.ZodObject<{
1056
+ entries: z.ZodArray<z.ZodObject<{
1057
+ column: z.ZodString;
1058
+ value: z.ZodDiscriminatedUnion<[z.ZodObject<{
1059
+ kind: z.ZodLiteral<"literal">;
1060
+ value: z.ZodUnion<readonly [z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>, z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>>]>;
1061
+ }, z.core.$strip>, z.ZodObject<{
1062
+ kind: z.ZodLiteral<"variable">;
1063
+ name: z.ZodString;
1064
+ }, z.core.$strip>, z.ZodObject<{
1065
+ kind: z.ZodLiteral<"claim">;
1066
+ key: z.ZodEnum<{
1067
+ sub: "sub";
1068
+ org: "org";
1069
+ }>;
1070
+ }, z.core.$strip>], "kind">;
1071
+ }, z.core.$strip>>;
1072
+ }, z.core.$strip>]>>;
1073
+ append: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
1074
+ slot: z.ZodString;
1075
+ }, z.core.$strip>, z.ZodObject<{
1076
+ entries: z.ZodArray<z.ZodObject<{
1077
+ column: z.ZodString;
1078
+ value: z.ZodDiscriminatedUnion<[z.ZodObject<{
1079
+ kind: z.ZodLiteral<"literal">;
1080
+ value: z.ZodUnion<readonly [z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>, z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>>]>;
1081
+ }, z.core.$strip>, z.ZodObject<{
1082
+ kind: z.ZodLiteral<"variable">;
1083
+ name: z.ZodString;
1084
+ }, z.core.$strip>, z.ZodObject<{
1085
+ kind: z.ZodLiteral<"claim">;
1086
+ key: z.ZodEnum<{
1087
+ sub: "sub";
1088
+ org: "org";
1089
+ }>;
1090
+ }, z.core.$strip>], "kind">;
1091
+ }, z.core.$strip>>;
1092
+ }, z.core.$strip>]>>;
1093
+ inc: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
1094
+ slot: z.ZodString;
1095
+ }, z.core.$strip>, z.ZodObject<{
1096
+ entries: z.ZodArray<z.ZodObject<{
1097
+ column: z.ZodString;
1098
+ value: z.ZodDiscriminatedUnion<[z.ZodObject<{
1099
+ kind: z.ZodLiteral<"literal">;
1100
+ value: z.ZodUnion<readonly [z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>, z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>>]>;
1101
+ }, z.core.$strip>, z.ZodObject<{
1102
+ kind: z.ZodLiteral<"variable">;
1103
+ name: z.ZodString;
1104
+ }, z.core.$strip>, z.ZodObject<{
1105
+ kind: z.ZodLiteral<"claim">;
1106
+ key: z.ZodEnum<{
1107
+ sub: "sub";
1108
+ org: "org";
1109
+ }>;
1110
+ }, z.core.$strip>], "kind">;
1111
+ }, z.core.$strip>>;
1112
+ }, z.core.$strip>]>>;
1113
+ where: z.ZodOptional<z.ZodType<PredIr, unknown, z.core.$ZodTypeInternals<PredIr, unknown>>>;
1114
+ pk: z.ZodOptional<z.ZodArray<z.ZodObject<{
1115
+ column: z.ZodString;
1116
+ value: z.ZodDiscriminatedUnion<[z.ZodObject<{
1117
+ kind: z.ZodLiteral<"literal">;
1118
+ value: z.ZodUnion<readonly [z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>, z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>>]>;
1119
+ }, z.core.$strip>, z.ZodObject<{
1120
+ kind: z.ZodLiteral<"variable">;
1121
+ name: z.ZodString;
1122
+ }, z.core.$strip>, z.ZodObject<{
1123
+ kind: z.ZodLiteral<"claim">;
1124
+ key: z.ZodEnum<{
1125
+ sub: "sub";
1126
+ org: "org";
1127
+ }>;
1128
+ }, z.core.$strip>], "kind">;
1129
+ }, z.core.$strip>>>;
1130
+ insertCheck: z.ZodOptional<z.ZodType<PredIr, unknown, z.core.$ZodTypeInternals<PredIr, unknown>>>;
1131
+ returning: z.ZodNullable<z.ZodType<SelectionIr, unknown, z.core.$ZodTypeInternals<SelectionIr, unknown>>>;
1132
+ affectedRows: z.ZodDefault<z.ZodBoolean>;
1133
+ includeIf: z.ZodOptional<z.ZodObject<{
1134
+ variable: z.ZodString;
1135
+ negated: z.ZodBoolean;
1136
+ }, z.core.$strip>>;
1137
+ }, z.core.$strip>, z.ZodObject<{
1138
+ kind: z.ZodLiteral<"action">;
1139
+ alias: z.ZodString;
1140
+ name: z.ZodString;
1141
+ params: z.ZodArray<z.ZodObject<{
1142
+ name: z.ZodString;
1143
+ value: z.ZodDiscriminatedUnion<[z.ZodObject<{
1144
+ kind: z.ZodLiteral<"literal">;
1145
+ value: z.ZodUnion<readonly [z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>, z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>>]>;
1146
+ }, z.core.$strip>, z.ZodObject<{
1147
+ kind: z.ZodLiteral<"variable">;
1148
+ name: z.ZodString;
1149
+ }, z.core.$strip>, z.ZodObject<{
1150
+ kind: z.ZodLiteral<"claim">;
1151
+ key: z.ZodEnum<{
1152
+ sub: "sub";
1153
+ org: "org";
1154
+ }>;
1155
+ }, z.core.$strip>], "kind">;
1156
+ }, z.core.$strip>>;
1157
+ returns: z.ZodEnum<{
1158
+ rows: "rows";
1159
+ rowsAffected: "rowsAffected";
1160
+ scalar: "scalar";
1161
+ }>;
1162
+ }, z.core.$strip>], "kind">>;
1163
+ }, z.core.$strip>>;
1164
+ }, z.core.$strip>;
1165
+ type CompiledArtifact = z.infer<typeof compiledArtifactSchema>;
1166
+ declare class IrVersionError extends Error {
1167
+ constructor(found: unknown);
1168
+ }
1169
+ /**
1170
+ * Validate + normalize a raw registry artifact (the normalizeSnapshot
1171
+ * pattern): future IR versions add upgrade branches here so executor
1172
+ * upgrades decouple from artifact re-pushes. Never trust registry jsonb —
1173
+ * the data plane calls this on every artifact load.
1174
+ */
1175
+ declare function normalizeIr(raw: unknown): CompiledArtifact;
1176
+ /** Index an artifact's operations by opHash (the wire selector). */
1177
+ declare function indexByHash(artifact: CompiledArtifact): Map<string, CompiledOperation>;
1178
+
1179
+ export { CLAIMS_CONTRACT, CMP_OPS, type ClaimKey, type CmpOp, type CompiledArtifact, type CompiledOperation, INPUT_REF_KINDS, IR_VERSION, type InputRefKind, IrVersionError, type LimitIr, type OrderIr, type PredIr, type RootIr, type SelectionIr, type TableMetaIr, type ValueIr, type VariableDefaultIr, type VariableIr, compiledArtifactSchema, compiledOperationSchema, indexByHash, limitIrSchema, normalizeIr, orderIrSchema, predIrSchema, rootIrSchema, selectionIrSchema, tableMetaIrSchema, valueIrSchema, variableDefaultIrSchema, variableIrSchema };