@sequenceholdings/orm 0.1.1 → 0.1.3

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 (81) hide show
  1. package/README.md +12 -2
  2. package/dist/authoring.cjs +1801 -0
  3. package/dist/authoring.cjs.map +1 -0
  4. package/dist/authoring.d.cts +539 -0
  5. package/dist/authoring.d.ts +539 -0
  6. package/dist/authoring.js +1759 -0
  7. package/dist/authoring.js.map +1 -0
  8. package/dist/canonical.cjs +552 -0
  9. package/dist/canonical.cjs.map +1 -0
  10. package/dist/canonical.d.cts +603 -0
  11. package/dist/canonical.d.ts +603 -0
  12. package/dist/canonical.js +532 -0
  13. package/dist/canonical.js.map +1 -0
  14. package/dist/cli.cjs +7843 -1815
  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 +7854 -1828
  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 +3453 -0
  27. package/dist/compiler.cjs.map +1 -0
  28. package/dist/compiler.d.cts +389 -0
  29. package/dist/compiler.d.ts +389 -0
  30. package/dist/compiler.js +3396 -0
  31. package/dist/compiler.js.map +1 -0
  32. package/dist/drizzle.cjs +14 -0
  33. package/dist/drizzle.cjs.map +1 -0
  34. package/dist/drizzle.d.cts +1 -0
  35. package/dist/drizzle.d.ts +1 -0
  36. package/dist/drizzle.js +3 -0
  37. package/dist/drizzle.js.map +1 -0
  38. package/dist/dynamic-input.cjs +391 -0
  39. package/dist/dynamic-input.cjs.map +1 -0
  40. package/dist/dynamic-input.d.cts +111 -0
  41. package/dist/dynamic-input.d.ts +111 -0
  42. package/dist/dynamic-input.js +380 -0
  43. package/dist/dynamic-input.js.map +1 -0
  44. package/dist/index.cjs +3727 -344
  45. package/dist/index.cjs.map +1 -1
  46. package/dist/index.d.cts +236 -59
  47. package/dist/index.d.ts +236 -59
  48. package/dist/index.js +3757 -482
  49. package/dist/index.js.map +1 -1
  50. package/dist/ir.cjs +642 -0
  51. package/dist/ir.cjs.map +1 -0
  52. package/dist/ir.d.cts +1119 -0
  53. package/dist/ir.d.ts +1119 -0
  54. package/dist/ir.js +623 -0
  55. package/dist/ir.js.map +1 -0
  56. package/dist/naming-CTvWSRTf.d.ts +79 -0
  57. package/dist/naming-DRyinU4u.d.cts +79 -0
  58. package/dist/predicate-v2.cjs +1093 -0
  59. package/dist/predicate-v2.cjs.map +1 -0
  60. package/dist/predicate-v2.d.cts +139 -0
  61. package/dist/predicate-v2.d.ts +139 -0
  62. package/dist/predicate-v2.js +1083 -0
  63. package/dist/predicate-v2.js.map +1 -0
  64. package/dist/sdl.cjs +1122 -0
  65. package/dist/sdl.cjs.map +1 -0
  66. package/dist/sdl.d.cts +94 -0
  67. package/dist/sdl.d.ts +94 -0
  68. package/dist/sdl.js +1098 -0
  69. package/dist/sdl.js.map +1 -0
  70. package/package.json +51 -3
  71. package/src/codegen-gql/apollo-hooks.cjs +98 -0
  72. package/src/codegen-gql/server-fns.cjs +101 -0
  73. package/templates/README.md +13 -0
  74. package/templates/orm-namespace/CLAUDE.md +82 -0
  75. package/templates/orm-namespace/codegen.ts +22 -0
  76. package/templates/orm-namespace/gitignore +5 -0
  77. package/templates/orm-namespace/graphql/example/queries.ts +56 -0
  78. package/templates/orm-namespace/package.json +24 -0
  79. package/templates/orm-namespace/schema/tables.ts +71 -0
  80. package/templates/orm-namespace/sequence.config.ts +32 -0
  81. package/templates/orm-namespace/tsconfig.json +15 -0
package/dist/ir.d.cts ADDED
@@ -0,0 +1,1119 @@
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
+ insert: "insert";
244
+ update: "update";
245
+ delete: "delete";
246
+ insertOne: "insertOne";
247
+ updateByPk: "updateByPk";
248
+ deleteByPk: "deleteByPk";
249
+ cowOverride: "cowOverride";
250
+ cowRevert: "cowRevert";
251
+ }>;
252
+ alias: z.ZodString;
253
+ table: z.ZodString;
254
+ cowSynced: z.ZodOptional<z.ZodString>;
255
+ cowCopyColumns: z.ZodOptional<z.ZodArray<z.ZodString>>;
256
+ cowCopyCheck: z.ZodOptional<z.ZodType<PredIr, unknown, z.core.$ZodTypeInternals<PredIr, unknown>>>;
257
+ objects: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
258
+ slot: z.ZodString;
259
+ }, z.core.$strip>, z.ZodObject<{
260
+ rows: z.ZodArray<z.ZodArray<z.ZodObject<{
261
+ column: z.ZodString;
262
+ value: z.ZodDiscriminatedUnion<[z.ZodObject<{
263
+ kind: z.ZodLiteral<"literal">;
264
+ 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]>>]>;
265
+ }, z.core.$strip>, z.ZodObject<{
266
+ kind: z.ZodLiteral<"variable">;
267
+ name: z.ZodString;
268
+ }, z.core.$strip>, z.ZodObject<{
269
+ kind: z.ZodLiteral<"claim">;
270
+ key: z.ZodEnum<{
271
+ sub: "sub";
272
+ org: "org";
273
+ }>;
274
+ }, z.core.$strip>], "kind">;
275
+ }, z.core.$strip>>>;
276
+ }, z.core.$strip>]>>;
277
+ pinnedColumns: z.ZodDefault<z.ZodArray<z.ZodObject<{
278
+ column: z.ZodString;
279
+ value: z.ZodDiscriminatedUnion<[z.ZodObject<{
280
+ kind: z.ZodLiteral<"literal">;
281
+ 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]>>]>;
282
+ }, z.core.$strip>, z.ZodObject<{
283
+ kind: z.ZodLiteral<"variable">;
284
+ name: z.ZodString;
285
+ }, z.core.$strip>, z.ZodObject<{
286
+ kind: z.ZodLiteral<"claim">;
287
+ key: z.ZodEnum<{
288
+ sub: "sub";
289
+ org: "org";
290
+ }>;
291
+ }, z.core.$strip>], "kind">;
292
+ }, z.core.$strip>>>;
293
+ onConflict: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
294
+ slot: z.ZodString;
295
+ }, z.core.$strip>, z.ZodObject<{
296
+ constraint: z.ZodString;
297
+ updateColumns: z.ZodArray<z.ZodString>;
298
+ }, z.core.$strip>]>>;
299
+ set: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
300
+ slot: z.ZodString;
301
+ }, z.core.$strip>, z.ZodObject<{
302
+ entries: z.ZodArray<z.ZodObject<{
303
+ column: z.ZodString;
304
+ value: z.ZodDiscriminatedUnion<[z.ZodObject<{
305
+ kind: z.ZodLiteral<"literal">;
306
+ 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]>>]>;
307
+ }, z.core.$strip>, z.ZodObject<{
308
+ kind: z.ZodLiteral<"variable">;
309
+ name: z.ZodString;
310
+ }, z.core.$strip>, z.ZodObject<{
311
+ kind: z.ZodLiteral<"claim">;
312
+ key: z.ZodEnum<{
313
+ sub: "sub";
314
+ org: "org";
315
+ }>;
316
+ }, z.core.$strip>], "kind">;
317
+ }, z.core.$strip>>;
318
+ }, z.core.$strip>]>>;
319
+ append: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
320
+ slot: z.ZodString;
321
+ }, z.core.$strip>, z.ZodObject<{
322
+ entries: z.ZodArray<z.ZodObject<{
323
+ column: z.ZodString;
324
+ value: z.ZodDiscriminatedUnion<[z.ZodObject<{
325
+ kind: z.ZodLiteral<"literal">;
326
+ 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]>>]>;
327
+ }, z.core.$strip>, z.ZodObject<{
328
+ kind: z.ZodLiteral<"variable">;
329
+ name: z.ZodString;
330
+ }, z.core.$strip>, z.ZodObject<{
331
+ kind: z.ZodLiteral<"claim">;
332
+ key: z.ZodEnum<{
333
+ sub: "sub";
334
+ org: "org";
335
+ }>;
336
+ }, z.core.$strip>], "kind">;
337
+ }, z.core.$strip>>;
338
+ }, z.core.$strip>]>>;
339
+ inc: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
340
+ slot: z.ZodString;
341
+ }, z.core.$strip>, z.ZodObject<{
342
+ entries: z.ZodArray<z.ZodObject<{
343
+ column: z.ZodString;
344
+ value: z.ZodDiscriminatedUnion<[z.ZodObject<{
345
+ kind: z.ZodLiteral<"literal">;
346
+ 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]>>]>;
347
+ }, z.core.$strip>, z.ZodObject<{
348
+ kind: z.ZodLiteral<"variable">;
349
+ name: z.ZodString;
350
+ }, z.core.$strip>, z.ZodObject<{
351
+ kind: z.ZodLiteral<"claim">;
352
+ key: z.ZodEnum<{
353
+ sub: "sub";
354
+ org: "org";
355
+ }>;
356
+ }, z.core.$strip>], "kind">;
357
+ }, z.core.$strip>>;
358
+ }, z.core.$strip>]>>;
359
+ where: z.ZodOptional<z.ZodType<PredIr, unknown, z.core.$ZodTypeInternals<PredIr, unknown>>>;
360
+ pk: z.ZodOptional<z.ZodArray<z.ZodObject<{
361
+ column: z.ZodString;
362
+ value: z.ZodDiscriminatedUnion<[z.ZodObject<{
363
+ kind: z.ZodLiteral<"literal">;
364
+ 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]>>]>;
365
+ }, z.core.$strip>, z.ZodObject<{
366
+ kind: z.ZodLiteral<"variable">;
367
+ name: z.ZodString;
368
+ }, z.core.$strip>, z.ZodObject<{
369
+ kind: z.ZodLiteral<"claim">;
370
+ key: z.ZodEnum<{
371
+ sub: "sub";
372
+ org: "org";
373
+ }>;
374
+ }, z.core.$strip>], "kind">;
375
+ }, z.core.$strip>>>;
376
+ insertCheck: z.ZodOptional<z.ZodType<PredIr, unknown, z.core.$ZodTypeInternals<PredIr, unknown>>>;
377
+ returning: z.ZodNullable<z.ZodType<SelectionIr, unknown, z.core.$ZodTypeInternals<SelectionIr, unknown>>>;
378
+ affectedRows: z.ZodDefault<z.ZodBoolean>;
379
+ includeIf: z.ZodOptional<z.ZodObject<{
380
+ variable: z.ZodString;
381
+ negated: z.ZodBoolean;
382
+ }, z.core.$strip>>;
383
+ }, z.core.$strip>], "kind">;
384
+ type RootIr = z.infer<typeof rootIrSchema>;
385
+ declare const INPUT_REF_KINDS: readonly ["boolExp", "orderBy", "selectColumn", "insertInput", "setInput", "appendInput", "onConflict"];
386
+ type InputRefKind = (typeof INPUT_REF_KINDS)[number];
387
+ /**
388
+ * A declared GraphQL variable default, persisted verbatim so an omitted
389
+ * variable resolves to it instead of silently becoming NULL. Wrapped in an
390
+ * object so an explicit `= null` stays distinguishable from "no default".
391
+ * Only shapes `ValueIr` can carry are representable — the restrict pass
392
+ * rejects anything else (including §4f slot defaults) at compile time.
393
+ */
394
+ declare const variableDefaultIrSchema: z.ZodObject<{
395
+ 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]>>]>;
396
+ }, z.core.$strip>;
397
+ type VariableDefaultIr = z.infer<typeof variableDefaultIrSchema>;
398
+ declare const variableIrSchema: z.ZodObject<{
399
+ name: z.ZodString;
400
+ type: z.ZodUnion<readonly [z.ZodObject<{
401
+ kind: z.ZodLiteral<"scalar">;
402
+ scalar: z.ZodEnum<{
403
+ bigint: "bigint";
404
+ boolean: "boolean";
405
+ uuid: "uuid";
406
+ text: "text";
407
+ integer: "integer";
408
+ numeric: "numeric";
409
+ double: "double";
410
+ timestamptz: "timestamptz";
411
+ date: "date";
412
+ jsonb: "jsonb";
413
+ }>;
414
+ }, z.core.$strip>, z.ZodObject<{
415
+ kind: z.ZodLiteral<"enum">;
416
+ name: z.ZodString;
417
+ values: z.ZodArray<z.ZodString>;
418
+ }, z.core.$strip>, z.ZodObject<{
419
+ kind: z.ZodLiteral<"inputRef">;
420
+ input: z.ZodEnum<{
421
+ orderBy: "orderBy";
422
+ onConflict: "onConflict";
423
+ boolExp: "boolExp";
424
+ selectColumn: "selectColumn";
425
+ insertInput: "insertInput";
426
+ setInput: "setInput";
427
+ appendInput: "appendInput";
428
+ }>;
429
+ table: z.ZodString;
430
+ }, z.core.$strip>]>;
431
+ nullable: z.ZodBoolean;
432
+ list: z.ZodBoolean;
433
+ defaultValue: z.ZodOptional<z.ZodObject<{
434
+ 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]>>]>;
435
+ }, z.core.$strip>>;
436
+ }, z.core.$strip>;
437
+ type VariableIr = z.infer<typeof variableIrSchema>;
438
+ declare const compiledOperationSchema: z.ZodObject<{
439
+ irVersion: z.ZodLiteral<1>;
440
+ name: z.ZodString;
441
+ opHash: z.ZodString;
442
+ kind: z.ZodEnum<{
443
+ query: "query";
444
+ mutation: "mutation";
445
+ }>;
446
+ requires: z.ZodNullable<z.ZodObject<{
447
+ capability: z.ZodOptional<z.ZodString>;
448
+ role: z.ZodOptional<z.ZodString>;
449
+ }, z.core.$strip>>;
450
+ variables: z.ZodArray<z.ZodObject<{
451
+ name: z.ZodString;
452
+ type: z.ZodUnion<readonly [z.ZodObject<{
453
+ kind: z.ZodLiteral<"scalar">;
454
+ scalar: z.ZodEnum<{
455
+ bigint: "bigint";
456
+ boolean: "boolean";
457
+ uuid: "uuid";
458
+ text: "text";
459
+ integer: "integer";
460
+ numeric: "numeric";
461
+ double: "double";
462
+ timestamptz: "timestamptz";
463
+ date: "date";
464
+ jsonb: "jsonb";
465
+ }>;
466
+ }, z.core.$strip>, z.ZodObject<{
467
+ kind: z.ZodLiteral<"enum">;
468
+ name: z.ZodString;
469
+ values: z.ZodArray<z.ZodString>;
470
+ }, z.core.$strip>, z.ZodObject<{
471
+ kind: z.ZodLiteral<"inputRef">;
472
+ input: z.ZodEnum<{
473
+ orderBy: "orderBy";
474
+ onConflict: "onConflict";
475
+ boolExp: "boolExp";
476
+ selectColumn: "selectColumn";
477
+ insertInput: "insertInput";
478
+ setInput: "setInput";
479
+ appendInput: "appendInput";
480
+ }>;
481
+ table: z.ZodString;
482
+ }, z.core.$strip>]>;
483
+ nullable: z.ZodBoolean;
484
+ list: z.ZodBoolean;
485
+ defaultValue: z.ZodOptional<z.ZodObject<{
486
+ 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]>>]>;
487
+ }, z.core.$strip>>;
488
+ }, z.core.$strip>>;
489
+ tableSet: z.ZodArray<z.ZodString>;
490
+ roots: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
491
+ kind: z.ZodLiteral<"select">;
492
+ alias: z.ZodString;
493
+ table: z.ZodString;
494
+ selection: z.ZodType<SelectionIr, unknown, z.core.$ZodTypeInternals<SelectionIr, unknown>>;
495
+ where: z.ZodType<PredIr, unknown, z.core.$ZodTypeInternals<PredIr, unknown>>;
496
+ orderBy: z.ZodDefault<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
497
+ kind: z.ZodLiteral<"column">;
498
+ column: z.ZodString;
499
+ link: z.ZodOptional<z.ZodString>;
500
+ direction: z.ZodEnum<{
501
+ asc: "asc";
502
+ desc: "desc";
503
+ }>;
504
+ nulls: z.ZodOptional<z.ZodEnum<{
505
+ first: "first";
506
+ last: "last";
507
+ }>>;
508
+ }, z.core.$strip>, z.ZodObject<{
509
+ kind: z.ZodLiteral<"dynamic">;
510
+ slot: z.ZodString;
511
+ }, z.core.$strip>], "kind">>>;
512
+ distinctOn: z.ZodOptional<z.ZodUnion<readonly [z.ZodArray<z.ZodString>, z.ZodObject<{
513
+ slot: z.ZodString;
514
+ }, z.core.$strip>]>>;
515
+ limit: z.ZodObject<{
516
+ variable: z.ZodOptional<z.ZodString>;
517
+ value: z.ZodOptional<z.ZodNumber>;
518
+ default: z.ZodNumber;
519
+ max: z.ZodNumber;
520
+ }, z.core.$strip>;
521
+ offset: z.ZodOptional<z.ZodObject<{
522
+ variable: z.ZodOptional<z.ZodString>;
523
+ value: z.ZodOptional<z.ZodNumber>;
524
+ }, z.core.$strip>>;
525
+ includeIf: z.ZodOptional<z.ZodObject<{
526
+ variable: z.ZodString;
527
+ negated: z.ZodBoolean;
528
+ }, z.core.$strip>>;
529
+ }, z.core.$strip>, z.ZodObject<{
530
+ kind: z.ZodLiteral<"byPk">;
531
+ alias: z.ZodString;
532
+ table: z.ZodString;
533
+ selection: z.ZodType<SelectionIr, unknown, z.core.$ZodTypeInternals<SelectionIr, unknown>>;
534
+ pk: z.ZodArray<z.ZodObject<{
535
+ column: z.ZodString;
536
+ value: z.ZodDiscriminatedUnion<[z.ZodObject<{
537
+ kind: z.ZodLiteral<"literal">;
538
+ 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]>>]>;
539
+ }, z.core.$strip>, z.ZodObject<{
540
+ kind: z.ZodLiteral<"variable">;
541
+ name: z.ZodString;
542
+ }, z.core.$strip>, z.ZodObject<{
543
+ kind: z.ZodLiteral<"claim">;
544
+ key: z.ZodEnum<{
545
+ sub: "sub";
546
+ org: "org";
547
+ }>;
548
+ }, z.core.$strip>], "kind">;
549
+ }, z.core.$strip>>;
550
+ where: z.ZodType<PredIr, unknown, z.core.$ZodTypeInternals<PredIr, unknown>>;
551
+ includeIf: z.ZodOptional<z.ZodObject<{
552
+ variable: z.ZodString;
553
+ negated: z.ZodBoolean;
554
+ }, z.core.$strip>>;
555
+ }, z.core.$strip>, z.ZodObject<{
556
+ kind: z.ZodLiteral<"aggregate">;
557
+ alias: z.ZodString;
558
+ table: z.ZodString;
559
+ where: z.ZodType<PredIr, unknown, z.core.$ZodTypeInternals<PredIr, unknown>>;
560
+ count: z.ZodOptional<z.ZodObject<{
561
+ columns: z.ZodOptional<z.ZodArray<z.ZodString>>;
562
+ distinct: z.ZodOptional<z.ZodBoolean>;
563
+ }, z.core.$strip>>;
564
+ sum: z.ZodOptional<z.ZodArray<z.ZodString>>;
565
+ avg: z.ZodOptional<z.ZodArray<z.ZodString>>;
566
+ nodes: z.ZodOptional<z.ZodType<SelectionIr, unknown, z.core.$ZodTypeInternals<SelectionIr, unknown>>>;
567
+ includeIf: z.ZodOptional<z.ZodObject<{
568
+ variable: z.ZodString;
569
+ negated: z.ZodBoolean;
570
+ }, z.core.$strip>>;
571
+ }, z.core.$strip>, z.ZodObject<{
572
+ kind: z.ZodLiteral<"mutation">;
573
+ op: z.ZodEnum<{
574
+ insert: "insert";
575
+ update: "update";
576
+ delete: "delete";
577
+ insertOne: "insertOne";
578
+ updateByPk: "updateByPk";
579
+ deleteByPk: "deleteByPk";
580
+ cowOverride: "cowOverride";
581
+ cowRevert: "cowRevert";
582
+ }>;
583
+ alias: z.ZodString;
584
+ table: z.ZodString;
585
+ cowSynced: z.ZodOptional<z.ZodString>;
586
+ cowCopyColumns: z.ZodOptional<z.ZodArray<z.ZodString>>;
587
+ cowCopyCheck: z.ZodOptional<z.ZodType<PredIr, unknown, z.core.$ZodTypeInternals<PredIr, unknown>>>;
588
+ objects: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
589
+ slot: z.ZodString;
590
+ }, z.core.$strip>, z.ZodObject<{
591
+ rows: z.ZodArray<z.ZodArray<z.ZodObject<{
592
+ column: z.ZodString;
593
+ value: z.ZodDiscriminatedUnion<[z.ZodObject<{
594
+ kind: z.ZodLiteral<"literal">;
595
+ 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]>>]>;
596
+ }, z.core.$strip>, z.ZodObject<{
597
+ kind: z.ZodLiteral<"variable">;
598
+ name: z.ZodString;
599
+ }, z.core.$strip>, z.ZodObject<{
600
+ kind: z.ZodLiteral<"claim">;
601
+ key: z.ZodEnum<{
602
+ sub: "sub";
603
+ org: "org";
604
+ }>;
605
+ }, z.core.$strip>], "kind">;
606
+ }, z.core.$strip>>>;
607
+ }, z.core.$strip>]>>;
608
+ pinnedColumns: z.ZodDefault<z.ZodArray<z.ZodObject<{
609
+ column: z.ZodString;
610
+ value: z.ZodDiscriminatedUnion<[z.ZodObject<{
611
+ kind: z.ZodLiteral<"literal">;
612
+ 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]>>]>;
613
+ }, z.core.$strip>, z.ZodObject<{
614
+ kind: z.ZodLiteral<"variable">;
615
+ name: z.ZodString;
616
+ }, z.core.$strip>, z.ZodObject<{
617
+ kind: z.ZodLiteral<"claim">;
618
+ key: z.ZodEnum<{
619
+ sub: "sub";
620
+ org: "org";
621
+ }>;
622
+ }, z.core.$strip>], "kind">;
623
+ }, z.core.$strip>>>;
624
+ onConflict: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
625
+ slot: z.ZodString;
626
+ }, z.core.$strip>, z.ZodObject<{
627
+ constraint: z.ZodString;
628
+ updateColumns: z.ZodArray<z.ZodString>;
629
+ }, z.core.$strip>]>>;
630
+ set: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
631
+ slot: z.ZodString;
632
+ }, z.core.$strip>, z.ZodObject<{
633
+ entries: z.ZodArray<z.ZodObject<{
634
+ column: z.ZodString;
635
+ value: z.ZodDiscriminatedUnion<[z.ZodObject<{
636
+ kind: z.ZodLiteral<"literal">;
637
+ 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]>>]>;
638
+ }, z.core.$strip>, z.ZodObject<{
639
+ kind: z.ZodLiteral<"variable">;
640
+ name: z.ZodString;
641
+ }, z.core.$strip>, z.ZodObject<{
642
+ kind: z.ZodLiteral<"claim">;
643
+ key: z.ZodEnum<{
644
+ sub: "sub";
645
+ org: "org";
646
+ }>;
647
+ }, z.core.$strip>], "kind">;
648
+ }, z.core.$strip>>;
649
+ }, z.core.$strip>]>>;
650
+ append: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
651
+ slot: z.ZodString;
652
+ }, z.core.$strip>, z.ZodObject<{
653
+ entries: z.ZodArray<z.ZodObject<{
654
+ column: z.ZodString;
655
+ value: z.ZodDiscriminatedUnion<[z.ZodObject<{
656
+ kind: z.ZodLiteral<"literal">;
657
+ 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]>>]>;
658
+ }, z.core.$strip>, z.ZodObject<{
659
+ kind: z.ZodLiteral<"variable">;
660
+ name: z.ZodString;
661
+ }, z.core.$strip>, z.ZodObject<{
662
+ kind: z.ZodLiteral<"claim">;
663
+ key: z.ZodEnum<{
664
+ sub: "sub";
665
+ org: "org";
666
+ }>;
667
+ }, z.core.$strip>], "kind">;
668
+ }, z.core.$strip>>;
669
+ }, z.core.$strip>]>>;
670
+ inc: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
671
+ slot: z.ZodString;
672
+ }, z.core.$strip>, z.ZodObject<{
673
+ entries: z.ZodArray<z.ZodObject<{
674
+ column: z.ZodString;
675
+ value: z.ZodDiscriminatedUnion<[z.ZodObject<{
676
+ kind: z.ZodLiteral<"literal">;
677
+ 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]>>]>;
678
+ }, z.core.$strip>, z.ZodObject<{
679
+ kind: z.ZodLiteral<"variable">;
680
+ name: z.ZodString;
681
+ }, z.core.$strip>, z.ZodObject<{
682
+ kind: z.ZodLiteral<"claim">;
683
+ key: z.ZodEnum<{
684
+ sub: "sub";
685
+ org: "org";
686
+ }>;
687
+ }, z.core.$strip>], "kind">;
688
+ }, z.core.$strip>>;
689
+ }, z.core.$strip>]>>;
690
+ where: z.ZodOptional<z.ZodType<PredIr, unknown, z.core.$ZodTypeInternals<PredIr, unknown>>>;
691
+ pk: z.ZodOptional<z.ZodArray<z.ZodObject<{
692
+ column: z.ZodString;
693
+ value: z.ZodDiscriminatedUnion<[z.ZodObject<{
694
+ kind: z.ZodLiteral<"literal">;
695
+ 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]>>]>;
696
+ }, z.core.$strip>, z.ZodObject<{
697
+ kind: z.ZodLiteral<"variable">;
698
+ name: z.ZodString;
699
+ }, z.core.$strip>, z.ZodObject<{
700
+ kind: z.ZodLiteral<"claim">;
701
+ key: z.ZodEnum<{
702
+ sub: "sub";
703
+ org: "org";
704
+ }>;
705
+ }, z.core.$strip>], "kind">;
706
+ }, z.core.$strip>>>;
707
+ insertCheck: z.ZodOptional<z.ZodType<PredIr, unknown, z.core.$ZodTypeInternals<PredIr, unknown>>>;
708
+ returning: z.ZodNullable<z.ZodType<SelectionIr, unknown, z.core.$ZodTypeInternals<SelectionIr, unknown>>>;
709
+ affectedRows: z.ZodDefault<z.ZodBoolean>;
710
+ includeIf: z.ZodOptional<z.ZodObject<{
711
+ variable: z.ZodString;
712
+ negated: z.ZodBoolean;
713
+ }, z.core.$strip>>;
714
+ }, z.core.$strip>], "kind">>;
715
+ }, z.core.$strip>;
716
+ type CompiledOperation = z.infer<typeof compiledOperationSchema>;
717
+ /**
718
+ * Runtime whitelist metadata per table — everything the executor needs to
719
+ * build Drizzle table objects, validate §4f dynamic inputs, and lower them.
720
+ * Derived from the canonical definition at compile time.
721
+ */
722
+ declare const tableMetaIrSchema: z.ZodObject<{
723
+ table: z.ZodString;
724
+ schema: z.ZodString;
725
+ typename: z.ZodString;
726
+ claimsGated: z.ZodDefault<z.ZodBoolean>;
727
+ columns: z.ZodArray<z.ZodObject<{
728
+ name: z.ZodString;
729
+ columnName: z.ZodString;
730
+ type: z.ZodUnion<readonly [z.ZodEnum<{
731
+ bigint: "bigint";
732
+ boolean: "boolean";
733
+ uuid: "uuid";
734
+ text: "text";
735
+ integer: "integer";
736
+ numeric: "numeric";
737
+ double: "double";
738
+ timestamptz: "timestamptz";
739
+ date: "date";
740
+ jsonb: "jsonb";
741
+ }>, z.ZodObject<{
742
+ enum: z.ZodString;
743
+ values: z.ZodArray<z.ZodString>;
744
+ }, z.core.$strip>]>;
745
+ nullable: z.ZodBoolean;
746
+ }, z.core.$strip>>;
747
+ primaryKey: z.ZodArray<z.ZodString>;
748
+ links: z.ZodArray<z.ZodObject<{
749
+ name: z.ZodString;
750
+ kind: z.ZodEnum<{
751
+ toOne: "toOne";
752
+ toMany: "toMany";
753
+ toPlatformUser: "toPlatformUser";
754
+ }>;
755
+ target: z.ZodString;
756
+ on: z.ZodString;
757
+ references: z.ZodString;
758
+ }, z.core.$strip>>;
759
+ filterable: z.ZodArray<z.ZodString>;
760
+ orderable: z.ZodArray<z.ZodString>;
761
+ insertable: z.ZodArray<z.ZodString>;
762
+ settable: z.ZodArray<z.ZodString>;
763
+ appendable: z.ZodArray<z.ZodString>;
764
+ constraints: z.ZodArray<z.ZodObject<{
765
+ name: z.ZodString;
766
+ columns: z.ZodArray<z.ZodString>;
767
+ }, z.core.$strip>>;
768
+ dynamicFilterMaxDepth: z.ZodDefault<z.ZodNumber>;
769
+ dynamicFilterMaxNodes: z.ZodDefault<z.ZodNumber>;
770
+ }, z.core.$strip>;
771
+ type TableMetaIr = z.infer<typeof tableMetaIrSchema>;
772
+ declare const compiledArtifactSchema: z.ZodObject<{
773
+ irVersion: z.ZodLiteral<1>;
774
+ namespace: z.ZodString;
775
+ schemaHash: z.ZodString;
776
+ opsHash: z.ZodString;
777
+ tables: z.ZodRecord<z.ZodString, z.ZodObject<{
778
+ table: z.ZodString;
779
+ schema: z.ZodString;
780
+ typename: z.ZodString;
781
+ claimsGated: z.ZodDefault<z.ZodBoolean>;
782
+ columns: z.ZodArray<z.ZodObject<{
783
+ name: z.ZodString;
784
+ columnName: z.ZodString;
785
+ type: z.ZodUnion<readonly [z.ZodEnum<{
786
+ bigint: "bigint";
787
+ boolean: "boolean";
788
+ uuid: "uuid";
789
+ text: "text";
790
+ integer: "integer";
791
+ numeric: "numeric";
792
+ double: "double";
793
+ timestamptz: "timestamptz";
794
+ date: "date";
795
+ jsonb: "jsonb";
796
+ }>, z.ZodObject<{
797
+ enum: z.ZodString;
798
+ values: z.ZodArray<z.ZodString>;
799
+ }, z.core.$strip>]>;
800
+ nullable: z.ZodBoolean;
801
+ }, z.core.$strip>>;
802
+ primaryKey: z.ZodArray<z.ZodString>;
803
+ links: z.ZodArray<z.ZodObject<{
804
+ name: z.ZodString;
805
+ kind: z.ZodEnum<{
806
+ toOne: "toOne";
807
+ toMany: "toMany";
808
+ toPlatformUser: "toPlatformUser";
809
+ }>;
810
+ target: z.ZodString;
811
+ on: z.ZodString;
812
+ references: z.ZodString;
813
+ }, z.core.$strip>>;
814
+ filterable: z.ZodArray<z.ZodString>;
815
+ orderable: z.ZodArray<z.ZodString>;
816
+ insertable: z.ZodArray<z.ZodString>;
817
+ settable: z.ZodArray<z.ZodString>;
818
+ appendable: z.ZodArray<z.ZodString>;
819
+ constraints: z.ZodArray<z.ZodObject<{
820
+ name: z.ZodString;
821
+ columns: z.ZodArray<z.ZodString>;
822
+ }, z.core.$strip>>;
823
+ dynamicFilterMaxDepth: z.ZodDefault<z.ZodNumber>;
824
+ dynamicFilterMaxNodes: z.ZodDefault<z.ZodNumber>;
825
+ }, z.core.$strip>>;
826
+ operations: z.ZodRecord<z.ZodString, z.ZodObject<{
827
+ irVersion: z.ZodLiteral<1>;
828
+ name: z.ZodString;
829
+ opHash: z.ZodString;
830
+ kind: z.ZodEnum<{
831
+ query: "query";
832
+ mutation: "mutation";
833
+ }>;
834
+ requires: z.ZodNullable<z.ZodObject<{
835
+ capability: z.ZodOptional<z.ZodString>;
836
+ role: z.ZodOptional<z.ZodString>;
837
+ }, z.core.$strip>>;
838
+ variables: z.ZodArray<z.ZodObject<{
839
+ name: z.ZodString;
840
+ type: z.ZodUnion<readonly [z.ZodObject<{
841
+ kind: z.ZodLiteral<"scalar">;
842
+ scalar: z.ZodEnum<{
843
+ bigint: "bigint";
844
+ boolean: "boolean";
845
+ uuid: "uuid";
846
+ text: "text";
847
+ integer: "integer";
848
+ numeric: "numeric";
849
+ double: "double";
850
+ timestamptz: "timestamptz";
851
+ date: "date";
852
+ jsonb: "jsonb";
853
+ }>;
854
+ }, z.core.$strip>, z.ZodObject<{
855
+ kind: z.ZodLiteral<"enum">;
856
+ name: z.ZodString;
857
+ values: z.ZodArray<z.ZodString>;
858
+ }, z.core.$strip>, z.ZodObject<{
859
+ kind: z.ZodLiteral<"inputRef">;
860
+ input: z.ZodEnum<{
861
+ orderBy: "orderBy";
862
+ onConflict: "onConflict";
863
+ boolExp: "boolExp";
864
+ selectColumn: "selectColumn";
865
+ insertInput: "insertInput";
866
+ setInput: "setInput";
867
+ appendInput: "appendInput";
868
+ }>;
869
+ table: z.ZodString;
870
+ }, z.core.$strip>]>;
871
+ nullable: z.ZodBoolean;
872
+ list: z.ZodBoolean;
873
+ defaultValue: z.ZodOptional<z.ZodObject<{
874
+ 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]>>]>;
875
+ }, z.core.$strip>>;
876
+ }, z.core.$strip>>;
877
+ tableSet: z.ZodArray<z.ZodString>;
878
+ roots: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
879
+ kind: z.ZodLiteral<"select">;
880
+ alias: z.ZodString;
881
+ table: z.ZodString;
882
+ selection: z.ZodType<SelectionIr, unknown, z.core.$ZodTypeInternals<SelectionIr, unknown>>;
883
+ where: z.ZodType<PredIr, unknown, z.core.$ZodTypeInternals<PredIr, unknown>>;
884
+ orderBy: z.ZodDefault<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
885
+ kind: z.ZodLiteral<"column">;
886
+ column: z.ZodString;
887
+ link: z.ZodOptional<z.ZodString>;
888
+ direction: z.ZodEnum<{
889
+ asc: "asc";
890
+ desc: "desc";
891
+ }>;
892
+ nulls: z.ZodOptional<z.ZodEnum<{
893
+ first: "first";
894
+ last: "last";
895
+ }>>;
896
+ }, z.core.$strip>, z.ZodObject<{
897
+ kind: z.ZodLiteral<"dynamic">;
898
+ slot: z.ZodString;
899
+ }, z.core.$strip>], "kind">>>;
900
+ distinctOn: z.ZodOptional<z.ZodUnion<readonly [z.ZodArray<z.ZodString>, z.ZodObject<{
901
+ slot: z.ZodString;
902
+ }, z.core.$strip>]>>;
903
+ limit: z.ZodObject<{
904
+ variable: z.ZodOptional<z.ZodString>;
905
+ value: z.ZodOptional<z.ZodNumber>;
906
+ default: z.ZodNumber;
907
+ max: z.ZodNumber;
908
+ }, z.core.$strip>;
909
+ offset: z.ZodOptional<z.ZodObject<{
910
+ variable: z.ZodOptional<z.ZodString>;
911
+ value: z.ZodOptional<z.ZodNumber>;
912
+ }, z.core.$strip>>;
913
+ includeIf: z.ZodOptional<z.ZodObject<{
914
+ variable: z.ZodString;
915
+ negated: z.ZodBoolean;
916
+ }, z.core.$strip>>;
917
+ }, z.core.$strip>, z.ZodObject<{
918
+ kind: z.ZodLiteral<"byPk">;
919
+ alias: z.ZodString;
920
+ table: z.ZodString;
921
+ selection: z.ZodType<SelectionIr, unknown, z.core.$ZodTypeInternals<SelectionIr, unknown>>;
922
+ pk: z.ZodArray<z.ZodObject<{
923
+ column: z.ZodString;
924
+ value: z.ZodDiscriminatedUnion<[z.ZodObject<{
925
+ kind: z.ZodLiteral<"literal">;
926
+ 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]>>]>;
927
+ }, z.core.$strip>, z.ZodObject<{
928
+ kind: z.ZodLiteral<"variable">;
929
+ name: z.ZodString;
930
+ }, z.core.$strip>, z.ZodObject<{
931
+ kind: z.ZodLiteral<"claim">;
932
+ key: z.ZodEnum<{
933
+ sub: "sub";
934
+ org: "org";
935
+ }>;
936
+ }, z.core.$strip>], "kind">;
937
+ }, z.core.$strip>>;
938
+ where: z.ZodType<PredIr, unknown, z.core.$ZodTypeInternals<PredIr, unknown>>;
939
+ includeIf: z.ZodOptional<z.ZodObject<{
940
+ variable: z.ZodString;
941
+ negated: z.ZodBoolean;
942
+ }, z.core.$strip>>;
943
+ }, z.core.$strip>, z.ZodObject<{
944
+ kind: z.ZodLiteral<"aggregate">;
945
+ alias: z.ZodString;
946
+ table: z.ZodString;
947
+ where: z.ZodType<PredIr, unknown, z.core.$ZodTypeInternals<PredIr, unknown>>;
948
+ count: z.ZodOptional<z.ZodObject<{
949
+ columns: z.ZodOptional<z.ZodArray<z.ZodString>>;
950
+ distinct: z.ZodOptional<z.ZodBoolean>;
951
+ }, z.core.$strip>>;
952
+ sum: z.ZodOptional<z.ZodArray<z.ZodString>>;
953
+ avg: z.ZodOptional<z.ZodArray<z.ZodString>>;
954
+ nodes: z.ZodOptional<z.ZodType<SelectionIr, unknown, z.core.$ZodTypeInternals<SelectionIr, unknown>>>;
955
+ includeIf: z.ZodOptional<z.ZodObject<{
956
+ variable: z.ZodString;
957
+ negated: z.ZodBoolean;
958
+ }, z.core.$strip>>;
959
+ }, z.core.$strip>, z.ZodObject<{
960
+ kind: z.ZodLiteral<"mutation">;
961
+ op: z.ZodEnum<{
962
+ insert: "insert";
963
+ update: "update";
964
+ delete: "delete";
965
+ insertOne: "insertOne";
966
+ updateByPk: "updateByPk";
967
+ deleteByPk: "deleteByPk";
968
+ cowOverride: "cowOverride";
969
+ cowRevert: "cowRevert";
970
+ }>;
971
+ alias: z.ZodString;
972
+ table: z.ZodString;
973
+ cowSynced: z.ZodOptional<z.ZodString>;
974
+ cowCopyColumns: z.ZodOptional<z.ZodArray<z.ZodString>>;
975
+ cowCopyCheck: z.ZodOptional<z.ZodType<PredIr, unknown, z.core.$ZodTypeInternals<PredIr, unknown>>>;
976
+ objects: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
977
+ slot: z.ZodString;
978
+ }, z.core.$strip>, z.ZodObject<{
979
+ rows: z.ZodArray<z.ZodArray<z.ZodObject<{
980
+ column: z.ZodString;
981
+ value: z.ZodDiscriminatedUnion<[z.ZodObject<{
982
+ kind: z.ZodLiteral<"literal">;
983
+ 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]>>]>;
984
+ }, z.core.$strip>, z.ZodObject<{
985
+ kind: z.ZodLiteral<"variable">;
986
+ name: z.ZodString;
987
+ }, z.core.$strip>, z.ZodObject<{
988
+ kind: z.ZodLiteral<"claim">;
989
+ key: z.ZodEnum<{
990
+ sub: "sub";
991
+ org: "org";
992
+ }>;
993
+ }, z.core.$strip>], "kind">;
994
+ }, z.core.$strip>>>;
995
+ }, z.core.$strip>]>>;
996
+ pinnedColumns: z.ZodDefault<z.ZodArray<z.ZodObject<{
997
+ column: z.ZodString;
998
+ value: z.ZodDiscriminatedUnion<[z.ZodObject<{
999
+ kind: z.ZodLiteral<"literal">;
1000
+ 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]>>]>;
1001
+ }, z.core.$strip>, z.ZodObject<{
1002
+ kind: z.ZodLiteral<"variable">;
1003
+ name: z.ZodString;
1004
+ }, z.core.$strip>, z.ZodObject<{
1005
+ kind: z.ZodLiteral<"claim">;
1006
+ key: z.ZodEnum<{
1007
+ sub: "sub";
1008
+ org: "org";
1009
+ }>;
1010
+ }, z.core.$strip>], "kind">;
1011
+ }, z.core.$strip>>>;
1012
+ onConflict: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
1013
+ slot: z.ZodString;
1014
+ }, z.core.$strip>, z.ZodObject<{
1015
+ constraint: z.ZodString;
1016
+ updateColumns: z.ZodArray<z.ZodString>;
1017
+ }, z.core.$strip>]>>;
1018
+ set: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
1019
+ slot: z.ZodString;
1020
+ }, z.core.$strip>, z.ZodObject<{
1021
+ entries: z.ZodArray<z.ZodObject<{
1022
+ column: z.ZodString;
1023
+ value: z.ZodDiscriminatedUnion<[z.ZodObject<{
1024
+ kind: z.ZodLiteral<"literal">;
1025
+ 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]>>]>;
1026
+ }, z.core.$strip>, z.ZodObject<{
1027
+ kind: z.ZodLiteral<"variable">;
1028
+ name: z.ZodString;
1029
+ }, z.core.$strip>, z.ZodObject<{
1030
+ kind: z.ZodLiteral<"claim">;
1031
+ key: z.ZodEnum<{
1032
+ sub: "sub";
1033
+ org: "org";
1034
+ }>;
1035
+ }, z.core.$strip>], "kind">;
1036
+ }, z.core.$strip>>;
1037
+ }, z.core.$strip>]>>;
1038
+ append: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
1039
+ slot: z.ZodString;
1040
+ }, z.core.$strip>, z.ZodObject<{
1041
+ entries: z.ZodArray<z.ZodObject<{
1042
+ column: z.ZodString;
1043
+ value: z.ZodDiscriminatedUnion<[z.ZodObject<{
1044
+ kind: z.ZodLiteral<"literal">;
1045
+ 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]>>]>;
1046
+ }, z.core.$strip>, z.ZodObject<{
1047
+ kind: z.ZodLiteral<"variable">;
1048
+ name: z.ZodString;
1049
+ }, z.core.$strip>, z.ZodObject<{
1050
+ kind: z.ZodLiteral<"claim">;
1051
+ key: z.ZodEnum<{
1052
+ sub: "sub";
1053
+ org: "org";
1054
+ }>;
1055
+ }, z.core.$strip>], "kind">;
1056
+ }, z.core.$strip>>;
1057
+ }, z.core.$strip>]>>;
1058
+ inc: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
1059
+ slot: z.ZodString;
1060
+ }, z.core.$strip>, z.ZodObject<{
1061
+ entries: z.ZodArray<z.ZodObject<{
1062
+ column: z.ZodString;
1063
+ value: z.ZodDiscriminatedUnion<[z.ZodObject<{
1064
+ kind: z.ZodLiteral<"literal">;
1065
+ 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]>>]>;
1066
+ }, z.core.$strip>, z.ZodObject<{
1067
+ kind: z.ZodLiteral<"variable">;
1068
+ name: z.ZodString;
1069
+ }, z.core.$strip>, z.ZodObject<{
1070
+ kind: z.ZodLiteral<"claim">;
1071
+ key: z.ZodEnum<{
1072
+ sub: "sub";
1073
+ org: "org";
1074
+ }>;
1075
+ }, z.core.$strip>], "kind">;
1076
+ }, z.core.$strip>>;
1077
+ }, z.core.$strip>]>>;
1078
+ where: z.ZodOptional<z.ZodType<PredIr, unknown, z.core.$ZodTypeInternals<PredIr, unknown>>>;
1079
+ pk: z.ZodOptional<z.ZodArray<z.ZodObject<{
1080
+ column: z.ZodString;
1081
+ value: z.ZodDiscriminatedUnion<[z.ZodObject<{
1082
+ kind: z.ZodLiteral<"literal">;
1083
+ 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]>>]>;
1084
+ }, z.core.$strip>, z.ZodObject<{
1085
+ kind: z.ZodLiteral<"variable">;
1086
+ name: z.ZodString;
1087
+ }, z.core.$strip>, z.ZodObject<{
1088
+ kind: z.ZodLiteral<"claim">;
1089
+ key: z.ZodEnum<{
1090
+ sub: "sub";
1091
+ org: "org";
1092
+ }>;
1093
+ }, z.core.$strip>], "kind">;
1094
+ }, z.core.$strip>>>;
1095
+ insertCheck: z.ZodOptional<z.ZodType<PredIr, unknown, z.core.$ZodTypeInternals<PredIr, unknown>>>;
1096
+ returning: z.ZodNullable<z.ZodType<SelectionIr, unknown, z.core.$ZodTypeInternals<SelectionIr, unknown>>>;
1097
+ affectedRows: z.ZodDefault<z.ZodBoolean>;
1098
+ includeIf: z.ZodOptional<z.ZodObject<{
1099
+ variable: z.ZodString;
1100
+ negated: z.ZodBoolean;
1101
+ }, z.core.$strip>>;
1102
+ }, z.core.$strip>], "kind">>;
1103
+ }, z.core.$strip>>;
1104
+ }, z.core.$strip>;
1105
+ type CompiledArtifact = z.infer<typeof compiledArtifactSchema>;
1106
+ declare class IrVersionError extends Error {
1107
+ constructor(found: unknown);
1108
+ }
1109
+ /**
1110
+ * Validate + normalize a raw registry artifact (the normalizeSnapshot
1111
+ * pattern): future IR versions add upgrade branches here so executor
1112
+ * upgrades decouple from artifact re-pushes. Never trust registry jsonb —
1113
+ * the data plane calls this on every artifact load.
1114
+ */
1115
+ declare function normalizeIr(raw: unknown): CompiledArtifact;
1116
+ /** Index an artifact's operations by opHash (the wire selector). */
1117
+ declare function indexByHash(artifact: CompiledArtifact): Map<string, CompiledOperation>;
1118
+
1119
+ 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 };