@sequenceholdings/orm 2.1.0 → 2.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +38 -1
- package/dist/authoring.cjs +1358 -45
- package/dist/authoring.cjs.map +1 -1
- package/dist/authoring.d.cts +223 -2
- package/dist/authoring.d.ts +223 -2
- package/dist/authoring.js +1349 -47
- package/dist/authoring.js.map +1 -1
- package/dist/canonical.cjs +662 -38
- package/dist/canonical.cjs.map +1 -1
- package/dist/canonical.d.cts +696 -53
- package/dist/canonical.d.ts +696 -53
- package/dist/canonical.js +647 -39
- package/dist/canonical.js.map +1 -1
- package/dist/cli.cjs +1808 -247
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.js +1809 -248
- package/dist/cli.js.map +1 -1
- package/dist/client.cjs +90 -25
- package/dist/client.cjs.map +1 -1
- package/dist/client.d.cts +39 -22
- package/dist/client.d.ts +39 -22
- package/dist/client.js +87 -26
- package/dist/client.js.map +1 -1
- package/dist/compiler.cjs +1325 -285
- package/dist/compiler.cjs.map +1 -1
- package/dist/compiler.d.cts +23 -2
- package/dist/compiler.d.ts +23 -2
- package/dist/compiler.js +1325 -285
- package/dist/compiler.js.map +1 -1
- package/dist/constants-YoFGjIBM.d.cts +99 -0
- package/dist/constants-YoFGjIBM.d.ts +99 -0
- package/dist/dynamic-input.d.cts +1 -0
- package/dist/dynamic-input.d.ts +1 -0
- package/dist/index.cjs +1605 -140
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +230 -113
- package/dist/index.d.ts +230 -113
- package/dist/index.js +1583 -142
- package/dist/index.js.map +1 -1
- package/dist/ir.cjs +727 -38
- package/dist/ir.cjs.map +1 -1
- package/dist/ir.d.cts +539 -21
- package/dist/ir.d.ts +539 -21
- package/dist/ir.js +722 -39
- package/dist/ir.js.map +1 -1
- package/dist/{naming-DCn94LJ4.d.ts → naming-CPfx7EfF.d.ts} +14 -1
- package/dist/{naming-DPglwzkB.d.cts → naming-CU9ThP_E.d.cts} +14 -1
- package/dist/policy-1iZbGnZZ.d.cts +24 -0
- package/dist/policy-1iZbGnZZ.d.ts +24 -0
- package/dist/predicate-v2.cjs +726 -42
- package/dist/predicate-v2.cjs.map +1 -1
- package/dist/predicate-v2.d.cts +2 -1
- package/dist/predicate-v2.d.ts +2 -1
- package/dist/predicate-v2.js +726 -42
- package/dist/predicate-v2.js.map +1 -1
- package/dist/sdl.cjs +858 -54
- package/dist/sdl.cjs.map +1 -1
- package/dist/sdl.d.cts +7 -3
- package/dist/sdl.d.ts +7 -3
- package/dist/sdl.js +856 -55
- package/dist/sdl.js.map +1 -1
- package/package.json +9 -4
- package/templates/orm-namespace/CLAUDE.md +6 -4
- package/templates/orm-namespace/codegen.preset.d.cts +7 -0
- package/templates/orm-namespace/codegen.ts +2 -1
- package/templates/orm-namespace/graphql/example/queries.ts +4 -3
- package/templates/orm-namespace/package.json +2 -1
- package/templates/orm-namespace/schema/tables.ts +3 -2
- package/templates/orm-namespace/sequence.config.ts +7 -11
package/dist/canonical.d.ts
CHANGED
|
@@ -1,4 +1,286 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
+
import { b as CellPart } from './constants-YoFGjIBM.js';
|
|
3
|
+
export { P as PolicyExpression, p as policyExpressionSchema, a as policyVariantSchema } from './policy-1iZbGnZZ.js';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Canonical contract for resolved tables: one logical table (a generated
|
|
7
|
+
* managed view) backed by N source tables of three kinds —
|
|
8
|
+
*
|
|
9
|
+
* - `manual` an internal ORM table holding sparse user edits (the only
|
|
10
|
+
* GraphQL mutation target),
|
|
11
|
+
* - `etl` a synced (`source: gold.*`) table fed by a pipeline,
|
|
12
|
+
* - `prefetch` an internal ORM "live" table filled by a function that reads
|
|
13
|
+
* the source system on demand (and confirms writebacks).
|
|
14
|
+
*
|
|
15
|
+
* Each column picks its value across candidate sources with a SQL comparator
|
|
16
|
+
* compiled into the view, so policies, filters, sorting and nested relations
|
|
17
|
+
* all see resolved values. This module owns the metadata the compiler (write
|
|
18
|
+
* roots, directives) and data plane (prefetch, writeback) need; the view SQL
|
|
19
|
+
* itself is generated at authoring time and validated like any managed view.
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
/** `'1500ms'` / `'30s'` / `'5m'` (or a millisecond number) → milliseconds; undefined when malformed. */
|
|
23
|
+
declare function parseDurationMs(input: number | string): number | undefined;
|
|
24
|
+
/**
|
|
25
|
+
* Row-level system columns the generated view adds after the authored columns
|
|
26
|
+
* (GraphQL fields). Per-cell provenance lives in typed cell parts instead —
|
|
27
|
+
* see RESOLVED_VIEW_CELL_PARTS.
|
|
28
|
+
*/
|
|
29
|
+
declare const RESOLVED_VIEW_SYSTEM_COLUMNS: {
|
|
30
|
+
readonly writebackStatus: {
|
|
31
|
+
readonly name: "writebackStatus";
|
|
32
|
+
readonly columnName: "_writeback_status";
|
|
33
|
+
readonly type: "text";
|
|
34
|
+
};
|
|
35
|
+
readonly writebackError: {
|
|
36
|
+
readonly name: "writebackError";
|
|
37
|
+
readonly columnName: "_writeback_error";
|
|
38
|
+
readonly type: "text";
|
|
39
|
+
};
|
|
40
|
+
};
|
|
41
|
+
/** System columns on the internal manual / live tables (never exposed in GraphQL). */
|
|
42
|
+
declare const RESOLVED_SOURCE_SYSTEM_COLUMNS: {
|
|
43
|
+
readonly tombstoned: {
|
|
44
|
+
readonly name: "sysTombstoned";
|
|
45
|
+
readonly columnName: "_tombstoned";
|
|
46
|
+
};
|
|
47
|
+
readonly fetchedAt: {
|
|
48
|
+
readonly name: "sysFetchedAt";
|
|
49
|
+
readonly columnName: "_fetched_at";
|
|
50
|
+
};
|
|
51
|
+
readonly writebackStatus: {
|
|
52
|
+
readonly name: "sysWritebackStatus";
|
|
53
|
+
readonly columnName: "_writeback_status";
|
|
54
|
+
};
|
|
55
|
+
readonly writebackError: {
|
|
56
|
+
readonly name: "sysWritebackError";
|
|
57
|
+
readonly columnName: "_writeback_error";
|
|
58
|
+
};
|
|
59
|
+
readonly writebackAt: {
|
|
60
|
+
readonly name: "sysWritebackAt";
|
|
61
|
+
readonly columnName: "_writeback_at";
|
|
62
|
+
};
|
|
63
|
+
};
|
|
64
|
+
/** Cell parts the resolved view exposes per resolved column: the winner's source, time, actor, and newer losers. */
|
|
65
|
+
declare const RESOLVED_VIEW_CELL_PARTS: readonly ["source", "at", "by", "conflicts"];
|
|
66
|
+
/** Cell parts on a resolved table's internal sources; only the manual source carries `rev`. */
|
|
67
|
+
declare const RESOLVED_SOURCE_CELL_PARTS: {
|
|
68
|
+
readonly manual: readonly ["at", "by", "rev"];
|
|
69
|
+
readonly prefetch: readonly ["at", "by"];
|
|
70
|
+
};
|
|
71
|
+
declare const RESERVED_RESOLVED_COLUMN_NAMES: ReadonlySet<string>;
|
|
72
|
+
declare const COMPARATORS: readonly ["latest", "highest", "lowest", "priority", "nonNullFirst", "custom"];
|
|
73
|
+
type ComparatorKind = (typeof COMPARATORS)[number];
|
|
74
|
+
declare const canonicalFunctionRefSchema: z.ZodObject<{
|
|
75
|
+
kind: z.ZodEnum<{
|
|
76
|
+
managed: "managed";
|
|
77
|
+
native: "native";
|
|
78
|
+
}>;
|
|
79
|
+
id: z.ZodString;
|
|
80
|
+
}, z.core.$strict>;
|
|
81
|
+
type CanonicalFunctionRef = z.infer<typeof canonicalFunctionRefSchema>;
|
|
82
|
+
/** What the source API can fetch: one key per call, or a batch of up to maxKeys. */
|
|
83
|
+
declare const canonicalFetchShapeSchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
84
|
+
shape: z.ZodLiteral<"single">;
|
|
85
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
86
|
+
shape: z.ZodLiteral<"batch">;
|
|
87
|
+
maxKeys: z.ZodNumber;
|
|
88
|
+
}, z.core.$strict>]>;
|
|
89
|
+
type CanonicalFetchShape = z.infer<typeof canonicalFetchShapeSchema>;
|
|
90
|
+
declare const canonicalResolvedSourceSchema: z.ZodObject<{
|
|
91
|
+
name: z.ZodString;
|
|
92
|
+
kind: z.ZodEnum<{
|
|
93
|
+
manual: "manual";
|
|
94
|
+
prefetch: "prefetch";
|
|
95
|
+
etl: "etl";
|
|
96
|
+
}>;
|
|
97
|
+
table: z.ZodString;
|
|
98
|
+
columns: z.ZodArray<z.ZodString>;
|
|
99
|
+
updatedAt: z.ZodOptional<z.ZodString>;
|
|
100
|
+
key: z.ZodOptional<z.ZodString>;
|
|
101
|
+
fetch: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
|
|
102
|
+
shape: z.ZodLiteral<"single">;
|
|
103
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
104
|
+
shape: z.ZodLiteral<"batch">;
|
|
105
|
+
maxKeys: z.ZodNumber;
|
|
106
|
+
}, z.core.$strict>]>>;
|
|
107
|
+
function: z.ZodOptional<z.ZodObject<{
|
|
108
|
+
kind: z.ZodEnum<{
|
|
109
|
+
managed: "managed";
|
|
110
|
+
native: "native";
|
|
111
|
+
}>;
|
|
112
|
+
id: z.ZodString;
|
|
113
|
+
}, z.core.$strict>>;
|
|
114
|
+
prefetchDefaults: z.ZodOptional<z.ZodObject<{
|
|
115
|
+
maxStalenessMs: z.ZodNumber;
|
|
116
|
+
timeoutMs: z.ZodNumber;
|
|
117
|
+
onError: z.ZodEnum<{
|
|
118
|
+
fallback: "fallback";
|
|
119
|
+
fail: "fail";
|
|
120
|
+
}>;
|
|
121
|
+
}, z.core.$strict>>;
|
|
122
|
+
writeback: z.ZodOptional<z.ZodObject<{
|
|
123
|
+
columns: z.ZodArray<z.ZodString>;
|
|
124
|
+
defaultMode: z.ZodEnum<{
|
|
125
|
+
sync: "sync";
|
|
126
|
+
async: "async";
|
|
127
|
+
}>;
|
|
128
|
+
timeoutMs: z.ZodNumber;
|
|
129
|
+
clearManualOnConfirm: z.ZodBoolean;
|
|
130
|
+
}, z.core.$strict>>;
|
|
131
|
+
}, z.core.$strict>;
|
|
132
|
+
type CanonicalResolvedSource = z.infer<typeof canonicalResolvedSourceSchema>;
|
|
133
|
+
declare const canonicalResolveRuleSchema: z.ZodObject<{
|
|
134
|
+
column: z.ZodString;
|
|
135
|
+
comparator: z.ZodEnum<{
|
|
136
|
+
custom: "custom";
|
|
137
|
+
latest: "latest";
|
|
138
|
+
highest: "highest";
|
|
139
|
+
lowest: "lowest";
|
|
140
|
+
priority: "priority";
|
|
141
|
+
nonNullFirst: "nonNullFirst";
|
|
142
|
+
}>;
|
|
143
|
+
candidates: z.ZodArray<z.ZodString>;
|
|
144
|
+
orderBy: z.ZodOptional<z.ZodString>;
|
|
145
|
+
}, z.core.$strict>;
|
|
146
|
+
type CanonicalResolveRule = z.infer<typeof canonicalResolveRuleSchema>;
|
|
147
|
+
declare const canonicalResolvedSchema: z.ZodObject<{
|
|
148
|
+
sources: z.ZodArray<z.ZodObject<{
|
|
149
|
+
name: z.ZodString;
|
|
150
|
+
kind: z.ZodEnum<{
|
|
151
|
+
manual: "manual";
|
|
152
|
+
prefetch: "prefetch";
|
|
153
|
+
etl: "etl";
|
|
154
|
+
}>;
|
|
155
|
+
table: z.ZodString;
|
|
156
|
+
columns: z.ZodArray<z.ZodString>;
|
|
157
|
+
updatedAt: z.ZodOptional<z.ZodString>;
|
|
158
|
+
key: z.ZodOptional<z.ZodString>;
|
|
159
|
+
fetch: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
|
|
160
|
+
shape: z.ZodLiteral<"single">;
|
|
161
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
162
|
+
shape: z.ZodLiteral<"batch">;
|
|
163
|
+
maxKeys: z.ZodNumber;
|
|
164
|
+
}, z.core.$strict>]>>;
|
|
165
|
+
function: z.ZodOptional<z.ZodObject<{
|
|
166
|
+
kind: z.ZodEnum<{
|
|
167
|
+
managed: "managed";
|
|
168
|
+
native: "native";
|
|
169
|
+
}>;
|
|
170
|
+
id: z.ZodString;
|
|
171
|
+
}, z.core.$strict>>;
|
|
172
|
+
prefetchDefaults: z.ZodOptional<z.ZodObject<{
|
|
173
|
+
maxStalenessMs: z.ZodNumber;
|
|
174
|
+
timeoutMs: z.ZodNumber;
|
|
175
|
+
onError: z.ZodEnum<{
|
|
176
|
+
fallback: "fallback";
|
|
177
|
+
fail: "fail";
|
|
178
|
+
}>;
|
|
179
|
+
}, z.core.$strict>>;
|
|
180
|
+
writeback: z.ZodOptional<z.ZodObject<{
|
|
181
|
+
columns: z.ZodArray<z.ZodString>;
|
|
182
|
+
defaultMode: z.ZodEnum<{
|
|
183
|
+
sync: "sync";
|
|
184
|
+
async: "async";
|
|
185
|
+
}>;
|
|
186
|
+
timeoutMs: z.ZodNumber;
|
|
187
|
+
clearManualOnConfirm: z.ZodBoolean;
|
|
188
|
+
}, z.core.$strict>>;
|
|
189
|
+
}, z.core.$strict>>;
|
|
190
|
+
resolve: z.ZodArray<z.ZodObject<{
|
|
191
|
+
column: z.ZodString;
|
|
192
|
+
comparator: z.ZodEnum<{
|
|
193
|
+
custom: "custom";
|
|
194
|
+
latest: "latest";
|
|
195
|
+
highest: "highest";
|
|
196
|
+
lowest: "lowest";
|
|
197
|
+
priority: "priority";
|
|
198
|
+
nonNullFirst: "nonNullFirst";
|
|
199
|
+
}>;
|
|
200
|
+
candidates: z.ZodArray<z.ZodString>;
|
|
201
|
+
orderBy: z.ZodOptional<z.ZodString>;
|
|
202
|
+
}, z.core.$strict>>;
|
|
203
|
+
deletedBy: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
204
|
+
materialized: z.ZodOptional<z.ZodObject<{
|
|
205
|
+
table: z.ZodString;
|
|
206
|
+
compute: z.ZodString;
|
|
207
|
+
}, z.core.$strict>>;
|
|
208
|
+
policies: z.ZodDefault<z.ZodObject<{
|
|
209
|
+
write: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
210
|
+
default: z.ZodString;
|
|
211
|
+
variants: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
212
|
+
when: z.ZodString;
|
|
213
|
+
allow: z.ZodOptional<z.ZodLiteral<true>>;
|
|
214
|
+
policy: z.ZodOptional<z.ZodString>;
|
|
215
|
+
}, z.core.$strip>>>;
|
|
216
|
+
}, z.core.$strip>]>>;
|
|
217
|
+
insert: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
218
|
+
default: z.ZodString;
|
|
219
|
+
variants: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
220
|
+
when: z.ZodString;
|
|
221
|
+
allow: z.ZodOptional<z.ZodLiteral<true>>;
|
|
222
|
+
policy: z.ZodOptional<z.ZodString>;
|
|
223
|
+
}, z.core.$strip>>>;
|
|
224
|
+
}, z.core.$strip>]>>;
|
|
225
|
+
update: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
226
|
+
default: z.ZodString;
|
|
227
|
+
variants: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
228
|
+
when: z.ZodString;
|
|
229
|
+
allow: z.ZodOptional<z.ZodLiteral<true>>;
|
|
230
|
+
policy: z.ZodOptional<z.ZodString>;
|
|
231
|
+
}, z.core.$strip>>>;
|
|
232
|
+
}, z.core.$strip>]>>;
|
|
233
|
+
}, z.core.$strict>>;
|
|
234
|
+
}, z.core.$strict>;
|
|
235
|
+
type CanonicalResolved = z.infer<typeof canonicalResolvedSchema>;
|
|
236
|
+
interface RelationShape {
|
|
237
|
+
table: string;
|
|
238
|
+
source?: string;
|
|
239
|
+
internal?: true;
|
|
240
|
+
cellMetadata?: true;
|
|
241
|
+
materializes?: string;
|
|
242
|
+
policies?: {
|
|
243
|
+
read?: string | {
|
|
244
|
+
default: string;
|
|
245
|
+
variants: unknown[];
|
|
246
|
+
};
|
|
247
|
+
};
|
|
248
|
+
primaryKey?: string[];
|
|
249
|
+
columns: Array<{
|
|
250
|
+
name: string;
|
|
251
|
+
columnName: string;
|
|
252
|
+
type: unknown;
|
|
253
|
+
cell?: {
|
|
254
|
+
of: string;
|
|
255
|
+
part: CellPart;
|
|
256
|
+
};
|
|
257
|
+
}>;
|
|
258
|
+
}
|
|
259
|
+
interface ViewShape {
|
|
260
|
+
view: string;
|
|
261
|
+
internal?: true;
|
|
262
|
+
primaryKey?: string[];
|
|
263
|
+
columns: Array<{
|
|
264
|
+
name: string;
|
|
265
|
+
columnName: string;
|
|
266
|
+
type: unknown;
|
|
267
|
+
nullable?: boolean;
|
|
268
|
+
cell?: {
|
|
269
|
+
of: string;
|
|
270
|
+
part: CellPart;
|
|
271
|
+
};
|
|
272
|
+
}>;
|
|
273
|
+
resolved?: CanonicalResolved;
|
|
274
|
+
}
|
|
275
|
+
/**
|
|
276
|
+
* Cross-relation validation for one resolved view. Returns messages rather
|
|
277
|
+
* than throwing so the definition-level superRefine can attach paths.
|
|
278
|
+
*/
|
|
279
|
+
declare function validateResolvedView({ view, tables, views }: {
|
|
280
|
+
view: ViewShape;
|
|
281
|
+
tables: readonly RelationShape[];
|
|
282
|
+
views?: readonly ViewShape[];
|
|
283
|
+
}): string[];
|
|
2
284
|
|
|
3
285
|
/**
|
|
4
286
|
* Canonical namespace definition v2 — the data-only JSON a consumer's
|
|
@@ -30,14 +312,14 @@ declare const canonicalColumnSchema: z.ZodObject<{
|
|
|
30
312
|
type: z.ZodUnion<readonly [z.ZodEnum<{
|
|
31
313
|
bigint: "bigint";
|
|
32
314
|
boolean: "boolean";
|
|
33
|
-
uuid: "uuid";
|
|
34
315
|
text: "text";
|
|
316
|
+
date: "date";
|
|
317
|
+
timestamptz: "timestamptz";
|
|
318
|
+
jsonb: "jsonb";
|
|
319
|
+
uuid: "uuid";
|
|
35
320
|
integer: "integer";
|
|
36
321
|
numeric: "numeric";
|
|
37
322
|
double: "double";
|
|
38
|
-
timestamptz: "timestamptz";
|
|
39
|
-
date: "date";
|
|
40
|
-
jsonb: "jsonb";
|
|
41
323
|
}>, z.ZodObject<{
|
|
42
324
|
enum: z.ZodString;
|
|
43
325
|
}, z.core.$strip>]>;
|
|
@@ -55,6 +337,16 @@ declare const canonicalColumnSchema: z.ZodObject<{
|
|
|
55
337
|
renamedFrom: z.ZodOptional<z.ZodString>;
|
|
56
338
|
cast: z.ZodOptional<z.ZodString>;
|
|
57
339
|
deprecated: z.ZodDefault<z.ZodBoolean>;
|
|
340
|
+
cell: z.ZodOptional<z.ZodObject<{
|
|
341
|
+
of: z.ZodString;
|
|
342
|
+
part: z.ZodEnum<{
|
|
343
|
+
at: "at";
|
|
344
|
+
by: "by";
|
|
345
|
+
rev: "rev";
|
|
346
|
+
source: "source";
|
|
347
|
+
conflicts: "conflicts";
|
|
348
|
+
}>;
|
|
349
|
+
}, z.core.$strict>>;
|
|
58
350
|
}, z.core.$strip>;
|
|
59
351
|
type CanonicalColumn = z.infer<typeof canonicalColumnSchema>;
|
|
60
352
|
declare const canonicalLinkSchema: z.ZodObject<{
|
|
@@ -68,6 +360,20 @@ declare const canonicalLinkSchema: z.ZodObject<{
|
|
|
68
360
|
on: z.ZodString;
|
|
69
361
|
references: z.ZodOptional<z.ZodString>;
|
|
70
362
|
enforce: z.ZodDefault<z.ZodBoolean>;
|
|
363
|
+
onDelete: z.ZodOptional<z.ZodEnum<{
|
|
364
|
+
cascade: "cascade";
|
|
365
|
+
restrict: "restrict";
|
|
366
|
+
"no action": "no action";
|
|
367
|
+
"set null": "set null";
|
|
368
|
+
"set default": "set default";
|
|
369
|
+
}>>;
|
|
370
|
+
onUpdate: z.ZodOptional<z.ZodEnum<{
|
|
371
|
+
cascade: "cascade";
|
|
372
|
+
restrict: "restrict";
|
|
373
|
+
"no action": "no action";
|
|
374
|
+
"set null": "set null";
|
|
375
|
+
"set default": "set default";
|
|
376
|
+
}>>;
|
|
71
377
|
description: z.ZodOptional<z.ZodString>;
|
|
72
378
|
}, z.core.$strip>;
|
|
73
379
|
type CanonicalLink = z.infer<typeof canonicalLinkSchema>;
|
|
@@ -76,25 +382,12 @@ declare const canonicalIndexSchema: z.ZodObject<{
|
|
|
76
382
|
unique: z.ZodDefault<z.ZodBoolean>;
|
|
77
383
|
name: z.ZodOptional<z.ZodString>;
|
|
78
384
|
}, z.core.$strip>;
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
when: z.ZodString;
|
|
86
|
-
allow: z.ZodOptional<z.ZodLiteral<true>>;
|
|
87
|
-
policy: z.ZodOptional<z.ZodString>;
|
|
88
|
-
}, z.core.$strip>;
|
|
89
|
-
declare const policyExpressionSchema: z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
90
|
-
default: z.ZodString;
|
|
91
|
-
variants: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
92
|
-
when: z.ZodString;
|
|
93
|
-
allow: z.ZodOptional<z.ZodLiteral<true>>;
|
|
94
|
-
policy: z.ZodOptional<z.ZodString>;
|
|
95
|
-
}, z.core.$strip>>>;
|
|
96
|
-
}, z.core.$strip>]>;
|
|
97
|
-
type PolicyExpression = z.infer<typeof policyExpressionSchema>;
|
|
385
|
+
declare const canonicalCheckSchema: z.ZodObject<{
|
|
386
|
+
name: z.ZodString;
|
|
387
|
+
expression: z.ZodString;
|
|
388
|
+
}, z.core.$strict>;
|
|
389
|
+
type CanonicalCheck = z.infer<typeof canonicalCheckSchema>;
|
|
390
|
+
|
|
98
391
|
declare const canonicalPoliciesSchema: z.ZodObject<{
|
|
99
392
|
read: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
100
393
|
default: z.ZodString;
|
|
@@ -153,14 +446,14 @@ declare const canonicalActionSchema: z.ZodObject<{
|
|
|
153
446
|
type: z.ZodEnum<{
|
|
154
447
|
bigint: "bigint";
|
|
155
448
|
boolean: "boolean";
|
|
156
|
-
uuid: "uuid";
|
|
157
449
|
text: "text";
|
|
450
|
+
date: "date";
|
|
451
|
+
timestamptz: "timestamptz";
|
|
452
|
+
jsonb: "jsonb";
|
|
453
|
+
uuid: "uuid";
|
|
158
454
|
integer: "integer";
|
|
159
455
|
numeric: "numeric";
|
|
160
456
|
double: "double";
|
|
161
|
-
timestamptz: "timestamptz";
|
|
162
|
-
date: "date";
|
|
163
|
-
jsonb: "jsonb";
|
|
164
457
|
}>;
|
|
165
458
|
nullable: z.ZodDefault<z.ZodBoolean>;
|
|
166
459
|
}, z.core.$strip>>>;
|
|
@@ -205,6 +498,20 @@ declare const canonicalForeignKeySchema: z.ZodObject<{
|
|
|
205
498
|
"initially-immediate": "initially-immediate";
|
|
206
499
|
"initially-deferred": "initially-deferred";
|
|
207
500
|
}>>;
|
|
501
|
+
onDelete: z.ZodOptional<z.ZodEnum<{
|
|
502
|
+
cascade: "cascade";
|
|
503
|
+
restrict: "restrict";
|
|
504
|
+
"no action": "no action";
|
|
505
|
+
"set null": "set null";
|
|
506
|
+
"set default": "set default";
|
|
507
|
+
}>>;
|
|
508
|
+
onUpdate: z.ZodOptional<z.ZodEnum<{
|
|
509
|
+
cascade: "cascade";
|
|
510
|
+
restrict: "restrict";
|
|
511
|
+
"no action": "no action";
|
|
512
|
+
"set null": "set null";
|
|
513
|
+
"set default": "set default";
|
|
514
|
+
}>>;
|
|
208
515
|
}, z.core.$strict>;
|
|
209
516
|
type CanonicalForeignKey = z.infer<typeof canonicalForeignKeySchema>;
|
|
210
517
|
declare const canonicalTableSchema: z.ZodObject<{
|
|
@@ -218,14 +525,14 @@ declare const canonicalTableSchema: z.ZodObject<{
|
|
|
218
525
|
type: z.ZodUnion<readonly [z.ZodEnum<{
|
|
219
526
|
bigint: "bigint";
|
|
220
527
|
boolean: "boolean";
|
|
221
|
-
uuid: "uuid";
|
|
222
528
|
text: "text";
|
|
529
|
+
date: "date";
|
|
530
|
+
timestamptz: "timestamptz";
|
|
531
|
+
jsonb: "jsonb";
|
|
532
|
+
uuid: "uuid";
|
|
223
533
|
integer: "integer";
|
|
224
534
|
numeric: "numeric";
|
|
225
535
|
double: "double";
|
|
226
|
-
timestamptz: "timestamptz";
|
|
227
|
-
date: "date";
|
|
228
|
-
jsonb: "jsonb";
|
|
229
536
|
}>, z.ZodObject<{
|
|
230
537
|
enum: z.ZodString;
|
|
231
538
|
}, z.core.$strip>]>;
|
|
@@ -243,6 +550,16 @@ declare const canonicalTableSchema: z.ZodObject<{
|
|
|
243
550
|
renamedFrom: z.ZodOptional<z.ZodString>;
|
|
244
551
|
cast: z.ZodOptional<z.ZodString>;
|
|
245
552
|
deprecated: z.ZodDefault<z.ZodBoolean>;
|
|
553
|
+
cell: z.ZodOptional<z.ZodObject<{
|
|
554
|
+
of: z.ZodString;
|
|
555
|
+
part: z.ZodEnum<{
|
|
556
|
+
at: "at";
|
|
557
|
+
by: "by";
|
|
558
|
+
rev: "rev";
|
|
559
|
+
source: "source";
|
|
560
|
+
conflicts: "conflicts";
|
|
561
|
+
}>;
|
|
562
|
+
}, z.core.$strict>>;
|
|
246
563
|
}, z.core.$strip>>>;
|
|
247
564
|
primaryKey: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
248
565
|
links: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
@@ -256,6 +573,20 @@ declare const canonicalTableSchema: z.ZodObject<{
|
|
|
256
573
|
on: z.ZodString;
|
|
257
574
|
references: z.ZodOptional<z.ZodString>;
|
|
258
575
|
enforce: z.ZodDefault<z.ZodBoolean>;
|
|
576
|
+
onDelete: z.ZodOptional<z.ZodEnum<{
|
|
577
|
+
cascade: "cascade";
|
|
578
|
+
restrict: "restrict";
|
|
579
|
+
"no action": "no action";
|
|
580
|
+
"set null": "set null";
|
|
581
|
+
"set default": "set default";
|
|
582
|
+
}>>;
|
|
583
|
+
onUpdate: z.ZodOptional<z.ZodEnum<{
|
|
584
|
+
cascade: "cascade";
|
|
585
|
+
restrict: "restrict";
|
|
586
|
+
"no action": "no action";
|
|
587
|
+
"set null": "set null";
|
|
588
|
+
"set default": "set default";
|
|
589
|
+
}>>;
|
|
259
590
|
description: z.ZodOptional<z.ZodString>;
|
|
260
591
|
}, z.core.$strip>>>;
|
|
261
592
|
indexes: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
@@ -263,6 +594,10 @@ declare const canonicalTableSchema: z.ZodObject<{
|
|
|
263
594
|
unique: z.ZodDefault<z.ZodBoolean>;
|
|
264
595
|
name: z.ZodOptional<z.ZodString>;
|
|
265
596
|
}, z.core.$strip>>>;
|
|
597
|
+
checks: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
598
|
+
name: z.ZodString;
|
|
599
|
+
expression: z.ZodString;
|
|
600
|
+
}, z.core.$strict>>>;
|
|
266
601
|
policies: z.ZodDefault<z.ZodObject<{
|
|
267
602
|
read: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
268
603
|
default: z.ZodString;
|
|
@@ -304,14 +639,14 @@ declare const canonicalTableSchema: z.ZodObject<{
|
|
|
304
639
|
type: z.ZodEnum<{
|
|
305
640
|
bigint: "bigint";
|
|
306
641
|
boolean: "boolean";
|
|
307
|
-
uuid: "uuid";
|
|
308
642
|
text: "text";
|
|
643
|
+
date: "date";
|
|
644
|
+
timestamptz: "timestamptz";
|
|
645
|
+
jsonb: "jsonb";
|
|
646
|
+
uuid: "uuid";
|
|
309
647
|
integer: "integer";
|
|
310
648
|
numeric: "numeric";
|
|
311
649
|
double: "double";
|
|
312
|
-
timestamptz: "timestamptz";
|
|
313
|
-
date: "date";
|
|
314
|
-
jsonb: "jsonb";
|
|
315
650
|
}>;
|
|
316
651
|
nullable: z.ZodDefault<z.ZodBoolean>;
|
|
317
652
|
}, z.core.$strip>>>;
|
|
@@ -346,7 +681,24 @@ declare const canonicalTableSchema: z.ZodObject<{
|
|
|
346
681
|
"initially-immediate": "initially-immediate";
|
|
347
682
|
"initially-deferred": "initially-deferred";
|
|
348
683
|
}>>;
|
|
684
|
+
onDelete: z.ZodOptional<z.ZodEnum<{
|
|
685
|
+
cascade: "cascade";
|
|
686
|
+
restrict: "restrict";
|
|
687
|
+
"no action": "no action";
|
|
688
|
+
"set null": "set null";
|
|
689
|
+
"set default": "set default";
|
|
690
|
+
}>>;
|
|
691
|
+
onUpdate: z.ZodOptional<z.ZodEnum<{
|
|
692
|
+
cascade: "cascade";
|
|
693
|
+
restrict: "restrict";
|
|
694
|
+
"no action": "no action";
|
|
695
|
+
"set null": "set null";
|
|
696
|
+
"set default": "set default";
|
|
697
|
+
}>>;
|
|
349
698
|
}, z.core.$strict>>>;
|
|
699
|
+
cellMetadata: z.ZodOptional<z.ZodLiteral<true>>;
|
|
700
|
+
internal: z.ZodOptional<z.ZodLiteral<true>>;
|
|
701
|
+
materializes: z.ZodOptional<z.ZodString>;
|
|
350
702
|
}, z.core.$strip>;
|
|
351
703
|
type CanonicalTable = z.infer<typeof canonicalTableSchema>;
|
|
352
704
|
declare const canonicalViewSchema: z.ZodObject<{
|
|
@@ -358,14 +710,14 @@ declare const canonicalViewSchema: z.ZodObject<{
|
|
|
358
710
|
type: z.ZodUnion<readonly [z.ZodEnum<{
|
|
359
711
|
bigint: "bigint";
|
|
360
712
|
boolean: "boolean";
|
|
361
|
-
uuid: "uuid";
|
|
362
713
|
text: "text";
|
|
714
|
+
date: "date";
|
|
715
|
+
timestamptz: "timestamptz";
|
|
716
|
+
jsonb: "jsonb";
|
|
717
|
+
uuid: "uuid";
|
|
363
718
|
integer: "integer";
|
|
364
719
|
numeric: "numeric";
|
|
365
720
|
double: "double";
|
|
366
|
-
timestamptz: "timestamptz";
|
|
367
|
-
date: "date";
|
|
368
|
-
jsonb: "jsonb";
|
|
369
721
|
}>, z.ZodObject<{
|
|
370
722
|
enum: z.ZodString;
|
|
371
723
|
}, z.core.$strip>]>;
|
|
@@ -383,6 +735,16 @@ declare const canonicalViewSchema: z.ZodObject<{
|
|
|
383
735
|
renamedFrom: z.ZodOptional<z.ZodString>;
|
|
384
736
|
cast: z.ZodOptional<z.ZodString>;
|
|
385
737
|
deprecated: z.ZodDefault<z.ZodBoolean>;
|
|
738
|
+
cell: z.ZodOptional<z.ZodObject<{
|
|
739
|
+
of: z.ZodString;
|
|
740
|
+
part: z.ZodEnum<{
|
|
741
|
+
at: "at";
|
|
742
|
+
by: "by";
|
|
743
|
+
rev: "rev";
|
|
744
|
+
source: "source";
|
|
745
|
+
conflicts: "conflicts";
|
|
746
|
+
}>;
|
|
747
|
+
}, z.core.$strict>>;
|
|
386
748
|
}, z.core.$strip>>;
|
|
387
749
|
primaryKey: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
388
750
|
links: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
@@ -396,6 +758,20 @@ declare const canonicalViewSchema: z.ZodObject<{
|
|
|
396
758
|
on: z.ZodString;
|
|
397
759
|
references: z.ZodOptional<z.ZodString>;
|
|
398
760
|
enforce: z.ZodDefault<z.ZodBoolean>;
|
|
761
|
+
onDelete: z.ZodOptional<z.ZodEnum<{
|
|
762
|
+
cascade: "cascade";
|
|
763
|
+
restrict: "restrict";
|
|
764
|
+
"no action": "no action";
|
|
765
|
+
"set null": "set null";
|
|
766
|
+
"set default": "set default";
|
|
767
|
+
}>>;
|
|
768
|
+
onUpdate: z.ZodOptional<z.ZodEnum<{
|
|
769
|
+
cascade: "cascade";
|
|
770
|
+
restrict: "restrict";
|
|
771
|
+
"no action": "no action";
|
|
772
|
+
"set null": "set null";
|
|
773
|
+
"set default": "set default";
|
|
774
|
+
}>>;
|
|
399
775
|
description: z.ZodOptional<z.ZodString>;
|
|
400
776
|
}, z.core.$strip>>>;
|
|
401
777
|
policies: z.ZodObject<{
|
|
@@ -410,8 +786,113 @@ declare const canonicalViewSchema: z.ZodObject<{
|
|
|
410
786
|
}, z.core.$strict>;
|
|
411
787
|
query: z.ZodString;
|
|
412
788
|
dependencies: z.ZodArray<z.ZodString>;
|
|
789
|
+
resolved: z.ZodOptional<z.ZodObject<{
|
|
790
|
+
sources: z.ZodArray<z.ZodObject<{
|
|
791
|
+
name: z.ZodString;
|
|
792
|
+
kind: z.ZodEnum<{
|
|
793
|
+
manual: "manual";
|
|
794
|
+
prefetch: "prefetch";
|
|
795
|
+
etl: "etl";
|
|
796
|
+
}>;
|
|
797
|
+
table: z.ZodString;
|
|
798
|
+
columns: z.ZodArray<z.ZodString>;
|
|
799
|
+
updatedAt: z.ZodOptional<z.ZodString>;
|
|
800
|
+
key: z.ZodOptional<z.ZodString>;
|
|
801
|
+
fetch: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
|
|
802
|
+
shape: z.ZodLiteral<"single">;
|
|
803
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
804
|
+
shape: z.ZodLiteral<"batch">;
|
|
805
|
+
maxKeys: z.ZodNumber;
|
|
806
|
+
}, z.core.$strict>]>>;
|
|
807
|
+
function: z.ZodOptional<z.ZodObject<{
|
|
808
|
+
kind: z.ZodEnum<{
|
|
809
|
+
managed: "managed";
|
|
810
|
+
native: "native";
|
|
811
|
+
}>;
|
|
812
|
+
id: z.ZodString;
|
|
813
|
+
}, z.core.$strict>>;
|
|
814
|
+
prefetchDefaults: z.ZodOptional<z.ZodObject<{
|
|
815
|
+
maxStalenessMs: z.ZodNumber;
|
|
816
|
+
timeoutMs: z.ZodNumber;
|
|
817
|
+
onError: z.ZodEnum<{
|
|
818
|
+
fallback: "fallback";
|
|
819
|
+
fail: "fail";
|
|
820
|
+
}>;
|
|
821
|
+
}, z.core.$strict>>;
|
|
822
|
+
writeback: z.ZodOptional<z.ZodObject<{
|
|
823
|
+
columns: z.ZodArray<z.ZodString>;
|
|
824
|
+
defaultMode: z.ZodEnum<{
|
|
825
|
+
sync: "sync";
|
|
826
|
+
async: "async";
|
|
827
|
+
}>;
|
|
828
|
+
timeoutMs: z.ZodNumber;
|
|
829
|
+
clearManualOnConfirm: z.ZodBoolean;
|
|
830
|
+
}, z.core.$strict>>;
|
|
831
|
+
}, z.core.$strict>>;
|
|
832
|
+
resolve: z.ZodArray<z.ZodObject<{
|
|
833
|
+
column: z.ZodString;
|
|
834
|
+
comparator: z.ZodEnum<{
|
|
835
|
+
custom: "custom";
|
|
836
|
+
latest: "latest";
|
|
837
|
+
highest: "highest";
|
|
838
|
+
lowest: "lowest";
|
|
839
|
+
priority: "priority";
|
|
840
|
+
nonNullFirst: "nonNullFirst";
|
|
841
|
+
}>;
|
|
842
|
+
candidates: z.ZodArray<z.ZodString>;
|
|
843
|
+
orderBy: z.ZodOptional<z.ZodString>;
|
|
844
|
+
}, z.core.$strict>>;
|
|
845
|
+
deletedBy: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
846
|
+
materialized: z.ZodOptional<z.ZodObject<{
|
|
847
|
+
table: z.ZodString;
|
|
848
|
+
compute: z.ZodString;
|
|
849
|
+
}, z.core.$strict>>;
|
|
850
|
+
policies: z.ZodDefault<z.ZodObject<{
|
|
851
|
+
write: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
852
|
+
default: z.ZodString;
|
|
853
|
+
variants: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
854
|
+
when: z.ZodString;
|
|
855
|
+
allow: z.ZodOptional<z.ZodLiteral<true>>;
|
|
856
|
+
policy: z.ZodOptional<z.ZodString>;
|
|
857
|
+
}, z.core.$strip>>>;
|
|
858
|
+
}, z.core.$strip>]>>;
|
|
859
|
+
insert: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
860
|
+
default: z.ZodString;
|
|
861
|
+
variants: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
862
|
+
when: z.ZodString;
|
|
863
|
+
allow: z.ZodOptional<z.ZodLiteral<true>>;
|
|
864
|
+
policy: z.ZodOptional<z.ZodString>;
|
|
865
|
+
}, z.core.$strip>>>;
|
|
866
|
+
}, z.core.$strip>]>>;
|
|
867
|
+
update: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
868
|
+
default: z.ZodString;
|
|
869
|
+
variants: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
870
|
+
when: z.ZodString;
|
|
871
|
+
allow: z.ZodOptional<z.ZodLiteral<true>>;
|
|
872
|
+
policy: z.ZodOptional<z.ZodString>;
|
|
873
|
+
}, z.core.$strip>>>;
|
|
874
|
+
}, z.core.$strip>]>>;
|
|
875
|
+
}, z.core.$strict>>;
|
|
876
|
+
}, z.core.$strict>>;
|
|
877
|
+
internal: z.ZodOptional<z.ZodLiteral<true>>;
|
|
413
878
|
}, z.core.$strip>;
|
|
414
879
|
type CanonicalView = z.infer<typeof canonicalViewSchema>;
|
|
880
|
+
/** The type each cell part is stored as. */
|
|
881
|
+
declare const CELL_PART_TYPES: Readonly<Record<CellPart, ColumnType>>;
|
|
882
|
+
interface TrackedShape {
|
|
883
|
+
columns: ReadonlyArray<{
|
|
884
|
+
name: string;
|
|
885
|
+
columnName: string;
|
|
886
|
+
onUpdateFn?: string;
|
|
887
|
+
cell?: {
|
|
888
|
+
of: string;
|
|
889
|
+
part: CellPart;
|
|
890
|
+
};
|
|
891
|
+
}>;
|
|
892
|
+
primaryKey?: readonly string[];
|
|
893
|
+
}
|
|
894
|
+
/** Columns a cell-tracking table stamps: everything except the primary key, clock columns and cell parts. */
|
|
895
|
+
declare function trackedCellColumns<T extends TrackedShape>(table: T): Array<T['columns'][number]>;
|
|
415
896
|
declare const canonicalDefinitionSchema: z.ZodObject<{
|
|
416
897
|
definition_format: z.ZodLiteral<2>;
|
|
417
898
|
namespace: z.ZodString;
|
|
@@ -431,14 +912,14 @@ declare const canonicalDefinitionSchema: z.ZodObject<{
|
|
|
431
912
|
type: z.ZodUnion<readonly [z.ZodEnum<{
|
|
432
913
|
bigint: "bigint";
|
|
433
914
|
boolean: "boolean";
|
|
434
|
-
uuid: "uuid";
|
|
435
915
|
text: "text";
|
|
916
|
+
date: "date";
|
|
917
|
+
timestamptz: "timestamptz";
|
|
918
|
+
jsonb: "jsonb";
|
|
919
|
+
uuid: "uuid";
|
|
436
920
|
integer: "integer";
|
|
437
921
|
numeric: "numeric";
|
|
438
922
|
double: "double";
|
|
439
|
-
timestamptz: "timestamptz";
|
|
440
|
-
date: "date";
|
|
441
|
-
jsonb: "jsonb";
|
|
442
923
|
}>, z.ZodObject<{
|
|
443
924
|
enum: z.ZodString;
|
|
444
925
|
}, z.core.$strip>]>;
|
|
@@ -456,6 +937,16 @@ declare const canonicalDefinitionSchema: z.ZodObject<{
|
|
|
456
937
|
renamedFrom: z.ZodOptional<z.ZodString>;
|
|
457
938
|
cast: z.ZodOptional<z.ZodString>;
|
|
458
939
|
deprecated: z.ZodDefault<z.ZodBoolean>;
|
|
940
|
+
cell: z.ZodOptional<z.ZodObject<{
|
|
941
|
+
of: z.ZodString;
|
|
942
|
+
part: z.ZodEnum<{
|
|
943
|
+
at: "at";
|
|
944
|
+
by: "by";
|
|
945
|
+
rev: "rev";
|
|
946
|
+
source: "source";
|
|
947
|
+
conflicts: "conflicts";
|
|
948
|
+
}>;
|
|
949
|
+
}, z.core.$strict>>;
|
|
459
950
|
}, z.core.$strip>>>;
|
|
460
951
|
primaryKey: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
461
952
|
links: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
@@ -469,6 +960,20 @@ declare const canonicalDefinitionSchema: z.ZodObject<{
|
|
|
469
960
|
on: z.ZodString;
|
|
470
961
|
references: z.ZodOptional<z.ZodString>;
|
|
471
962
|
enforce: z.ZodDefault<z.ZodBoolean>;
|
|
963
|
+
onDelete: z.ZodOptional<z.ZodEnum<{
|
|
964
|
+
cascade: "cascade";
|
|
965
|
+
restrict: "restrict";
|
|
966
|
+
"no action": "no action";
|
|
967
|
+
"set null": "set null";
|
|
968
|
+
"set default": "set default";
|
|
969
|
+
}>>;
|
|
970
|
+
onUpdate: z.ZodOptional<z.ZodEnum<{
|
|
971
|
+
cascade: "cascade";
|
|
972
|
+
restrict: "restrict";
|
|
973
|
+
"no action": "no action";
|
|
974
|
+
"set null": "set null";
|
|
975
|
+
"set default": "set default";
|
|
976
|
+
}>>;
|
|
472
977
|
description: z.ZodOptional<z.ZodString>;
|
|
473
978
|
}, z.core.$strip>>>;
|
|
474
979
|
indexes: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
@@ -476,6 +981,10 @@ declare const canonicalDefinitionSchema: z.ZodObject<{
|
|
|
476
981
|
unique: z.ZodDefault<z.ZodBoolean>;
|
|
477
982
|
name: z.ZodOptional<z.ZodString>;
|
|
478
983
|
}, z.core.$strip>>>;
|
|
984
|
+
checks: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
985
|
+
name: z.ZodString;
|
|
986
|
+
expression: z.ZodString;
|
|
987
|
+
}, z.core.$strict>>>;
|
|
479
988
|
policies: z.ZodDefault<z.ZodObject<{
|
|
480
989
|
read: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
481
990
|
default: z.ZodString;
|
|
@@ -517,14 +1026,14 @@ declare const canonicalDefinitionSchema: z.ZodObject<{
|
|
|
517
1026
|
type: z.ZodEnum<{
|
|
518
1027
|
bigint: "bigint";
|
|
519
1028
|
boolean: "boolean";
|
|
520
|
-
uuid: "uuid";
|
|
521
1029
|
text: "text";
|
|
1030
|
+
date: "date";
|
|
1031
|
+
timestamptz: "timestamptz";
|
|
1032
|
+
jsonb: "jsonb";
|
|
1033
|
+
uuid: "uuid";
|
|
522
1034
|
integer: "integer";
|
|
523
1035
|
numeric: "numeric";
|
|
524
1036
|
double: "double";
|
|
525
|
-
timestamptz: "timestamptz";
|
|
526
|
-
date: "date";
|
|
527
|
-
jsonb: "jsonb";
|
|
528
1037
|
}>;
|
|
529
1038
|
nullable: z.ZodDefault<z.ZodBoolean>;
|
|
530
1039
|
}, z.core.$strip>>>;
|
|
@@ -559,7 +1068,24 @@ declare const canonicalDefinitionSchema: z.ZodObject<{
|
|
|
559
1068
|
"initially-immediate": "initially-immediate";
|
|
560
1069
|
"initially-deferred": "initially-deferred";
|
|
561
1070
|
}>>;
|
|
1071
|
+
onDelete: z.ZodOptional<z.ZodEnum<{
|
|
1072
|
+
cascade: "cascade";
|
|
1073
|
+
restrict: "restrict";
|
|
1074
|
+
"no action": "no action";
|
|
1075
|
+
"set null": "set null";
|
|
1076
|
+
"set default": "set default";
|
|
1077
|
+
}>>;
|
|
1078
|
+
onUpdate: z.ZodOptional<z.ZodEnum<{
|
|
1079
|
+
cascade: "cascade";
|
|
1080
|
+
restrict: "restrict";
|
|
1081
|
+
"no action": "no action";
|
|
1082
|
+
"set null": "set null";
|
|
1083
|
+
"set default": "set default";
|
|
1084
|
+
}>>;
|
|
562
1085
|
}, z.core.$strict>>>;
|
|
1086
|
+
cellMetadata: z.ZodOptional<z.ZodLiteral<true>>;
|
|
1087
|
+
internal: z.ZodOptional<z.ZodLiteral<true>>;
|
|
1088
|
+
materializes: z.ZodOptional<z.ZodString>;
|
|
563
1089
|
}, z.core.$strip>>;
|
|
564
1090
|
views: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
565
1091
|
view: z.ZodString;
|
|
@@ -570,14 +1096,14 @@ declare const canonicalDefinitionSchema: z.ZodObject<{
|
|
|
570
1096
|
type: z.ZodUnion<readonly [z.ZodEnum<{
|
|
571
1097
|
bigint: "bigint";
|
|
572
1098
|
boolean: "boolean";
|
|
573
|
-
uuid: "uuid";
|
|
574
1099
|
text: "text";
|
|
1100
|
+
date: "date";
|
|
1101
|
+
timestamptz: "timestamptz";
|
|
1102
|
+
jsonb: "jsonb";
|
|
1103
|
+
uuid: "uuid";
|
|
575
1104
|
integer: "integer";
|
|
576
1105
|
numeric: "numeric";
|
|
577
1106
|
double: "double";
|
|
578
|
-
timestamptz: "timestamptz";
|
|
579
|
-
date: "date";
|
|
580
|
-
jsonb: "jsonb";
|
|
581
1107
|
}>, z.ZodObject<{
|
|
582
1108
|
enum: z.ZodString;
|
|
583
1109
|
}, z.core.$strip>]>;
|
|
@@ -595,6 +1121,16 @@ declare const canonicalDefinitionSchema: z.ZodObject<{
|
|
|
595
1121
|
renamedFrom: z.ZodOptional<z.ZodString>;
|
|
596
1122
|
cast: z.ZodOptional<z.ZodString>;
|
|
597
1123
|
deprecated: z.ZodDefault<z.ZodBoolean>;
|
|
1124
|
+
cell: z.ZodOptional<z.ZodObject<{
|
|
1125
|
+
of: z.ZodString;
|
|
1126
|
+
part: z.ZodEnum<{
|
|
1127
|
+
at: "at";
|
|
1128
|
+
by: "by";
|
|
1129
|
+
rev: "rev";
|
|
1130
|
+
source: "source";
|
|
1131
|
+
conflicts: "conflicts";
|
|
1132
|
+
}>;
|
|
1133
|
+
}, z.core.$strict>>;
|
|
598
1134
|
}, z.core.$strip>>;
|
|
599
1135
|
primaryKey: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
600
1136
|
links: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
@@ -608,6 +1144,20 @@ declare const canonicalDefinitionSchema: z.ZodObject<{
|
|
|
608
1144
|
on: z.ZodString;
|
|
609
1145
|
references: z.ZodOptional<z.ZodString>;
|
|
610
1146
|
enforce: z.ZodDefault<z.ZodBoolean>;
|
|
1147
|
+
onDelete: z.ZodOptional<z.ZodEnum<{
|
|
1148
|
+
cascade: "cascade";
|
|
1149
|
+
restrict: "restrict";
|
|
1150
|
+
"no action": "no action";
|
|
1151
|
+
"set null": "set null";
|
|
1152
|
+
"set default": "set default";
|
|
1153
|
+
}>>;
|
|
1154
|
+
onUpdate: z.ZodOptional<z.ZodEnum<{
|
|
1155
|
+
cascade: "cascade";
|
|
1156
|
+
restrict: "restrict";
|
|
1157
|
+
"no action": "no action";
|
|
1158
|
+
"set null": "set null";
|
|
1159
|
+
"set default": "set default";
|
|
1160
|
+
}>>;
|
|
611
1161
|
description: z.ZodOptional<z.ZodString>;
|
|
612
1162
|
}, z.core.$strip>>>;
|
|
613
1163
|
policies: z.ZodObject<{
|
|
@@ -622,6 +1172,95 @@ declare const canonicalDefinitionSchema: z.ZodObject<{
|
|
|
622
1172
|
}, z.core.$strict>;
|
|
623
1173
|
query: z.ZodString;
|
|
624
1174
|
dependencies: z.ZodArray<z.ZodString>;
|
|
1175
|
+
resolved: z.ZodOptional<z.ZodObject<{
|
|
1176
|
+
sources: z.ZodArray<z.ZodObject<{
|
|
1177
|
+
name: z.ZodString;
|
|
1178
|
+
kind: z.ZodEnum<{
|
|
1179
|
+
manual: "manual";
|
|
1180
|
+
prefetch: "prefetch";
|
|
1181
|
+
etl: "etl";
|
|
1182
|
+
}>;
|
|
1183
|
+
table: z.ZodString;
|
|
1184
|
+
columns: z.ZodArray<z.ZodString>;
|
|
1185
|
+
updatedAt: z.ZodOptional<z.ZodString>;
|
|
1186
|
+
key: z.ZodOptional<z.ZodString>;
|
|
1187
|
+
fetch: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
|
|
1188
|
+
shape: z.ZodLiteral<"single">;
|
|
1189
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
1190
|
+
shape: z.ZodLiteral<"batch">;
|
|
1191
|
+
maxKeys: z.ZodNumber;
|
|
1192
|
+
}, z.core.$strict>]>>;
|
|
1193
|
+
function: z.ZodOptional<z.ZodObject<{
|
|
1194
|
+
kind: z.ZodEnum<{
|
|
1195
|
+
managed: "managed";
|
|
1196
|
+
native: "native";
|
|
1197
|
+
}>;
|
|
1198
|
+
id: z.ZodString;
|
|
1199
|
+
}, z.core.$strict>>;
|
|
1200
|
+
prefetchDefaults: z.ZodOptional<z.ZodObject<{
|
|
1201
|
+
maxStalenessMs: z.ZodNumber;
|
|
1202
|
+
timeoutMs: z.ZodNumber;
|
|
1203
|
+
onError: z.ZodEnum<{
|
|
1204
|
+
fallback: "fallback";
|
|
1205
|
+
fail: "fail";
|
|
1206
|
+
}>;
|
|
1207
|
+
}, z.core.$strict>>;
|
|
1208
|
+
writeback: z.ZodOptional<z.ZodObject<{
|
|
1209
|
+
columns: z.ZodArray<z.ZodString>;
|
|
1210
|
+
defaultMode: z.ZodEnum<{
|
|
1211
|
+
sync: "sync";
|
|
1212
|
+
async: "async";
|
|
1213
|
+
}>;
|
|
1214
|
+
timeoutMs: z.ZodNumber;
|
|
1215
|
+
clearManualOnConfirm: z.ZodBoolean;
|
|
1216
|
+
}, z.core.$strict>>;
|
|
1217
|
+
}, z.core.$strict>>;
|
|
1218
|
+
resolve: z.ZodArray<z.ZodObject<{
|
|
1219
|
+
column: z.ZodString;
|
|
1220
|
+
comparator: z.ZodEnum<{
|
|
1221
|
+
custom: "custom";
|
|
1222
|
+
latest: "latest";
|
|
1223
|
+
highest: "highest";
|
|
1224
|
+
lowest: "lowest";
|
|
1225
|
+
priority: "priority";
|
|
1226
|
+
nonNullFirst: "nonNullFirst";
|
|
1227
|
+
}>;
|
|
1228
|
+
candidates: z.ZodArray<z.ZodString>;
|
|
1229
|
+
orderBy: z.ZodOptional<z.ZodString>;
|
|
1230
|
+
}, z.core.$strict>>;
|
|
1231
|
+
deletedBy: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
1232
|
+
materialized: z.ZodOptional<z.ZodObject<{
|
|
1233
|
+
table: z.ZodString;
|
|
1234
|
+
compute: z.ZodString;
|
|
1235
|
+
}, z.core.$strict>>;
|
|
1236
|
+
policies: z.ZodDefault<z.ZodObject<{
|
|
1237
|
+
write: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
1238
|
+
default: z.ZodString;
|
|
1239
|
+
variants: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
1240
|
+
when: z.ZodString;
|
|
1241
|
+
allow: z.ZodOptional<z.ZodLiteral<true>>;
|
|
1242
|
+
policy: z.ZodOptional<z.ZodString>;
|
|
1243
|
+
}, z.core.$strip>>>;
|
|
1244
|
+
}, z.core.$strip>]>>;
|
|
1245
|
+
insert: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
1246
|
+
default: z.ZodString;
|
|
1247
|
+
variants: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
1248
|
+
when: z.ZodString;
|
|
1249
|
+
allow: z.ZodOptional<z.ZodLiteral<true>>;
|
|
1250
|
+
policy: z.ZodOptional<z.ZodString>;
|
|
1251
|
+
}, z.core.$strip>>>;
|
|
1252
|
+
}, z.core.$strip>]>>;
|
|
1253
|
+
update: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
1254
|
+
default: z.ZodString;
|
|
1255
|
+
variants: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
1256
|
+
when: z.ZodString;
|
|
1257
|
+
allow: z.ZodOptional<z.ZodLiteral<true>>;
|
|
1258
|
+
policy: z.ZodOptional<z.ZodString>;
|
|
1259
|
+
}, z.core.$strip>>>;
|
|
1260
|
+
}, z.core.$strip>]>>;
|
|
1261
|
+
}, z.core.$strict>>;
|
|
1262
|
+
}, z.core.$strict>>;
|
|
1263
|
+
internal: z.ZodOptional<z.ZodLiteral<true>>;
|
|
625
1264
|
}, z.core.$strip>>>;
|
|
626
1265
|
capabilities: z.ZodDefault<z.ZodObject<{
|
|
627
1266
|
roles: z.ZodOptional<z.ZodUnknown>;
|
|
@@ -636,7 +1275,11 @@ type CanonicalDefinition = z.infer<typeof canonicalDefinitionSchema>;
|
|
|
636
1275
|
* the canonical boundary makes SDL and compiler behavior identical without
|
|
637
1276
|
* pretending views are writable tables in the wire contract.
|
|
638
1277
|
*/
|
|
639
|
-
|
|
1278
|
+
/** A table or view as the compiler/SDL see it; resolved views also carry their multi-source metadata. */
|
|
1279
|
+
type CanonicalRelation = CanonicalTable & {
|
|
1280
|
+
resolved?: CanonicalResolved;
|
|
1281
|
+
};
|
|
1282
|
+
declare function canonicalRelations(definition: CanonicalDefinition): CanonicalRelation[];
|
|
640
1283
|
/**
|
|
641
1284
|
* Deterministic serialization discipline: tables sorted by name, columns in
|
|
642
1285
|
* declaration order (order is meaningful for DDL), links/indexes/actions
|
|
@@ -646,4 +1289,4 @@ declare function canonicalRelations(definition: CanonicalDefinition): CanonicalT
|
|
|
646
1289
|
*/
|
|
647
1290
|
declare function normalizeCanonical(definition: CanonicalDefinition): CanonicalDefinition;
|
|
648
1291
|
|
|
649
|
-
export { CANONICAL_FORMAT, COLUMN_TYPES, type CanonicalColumn, type CanonicalCowMutation, type CanonicalDefinition, type CanonicalEnum, type CanonicalForeignKey, type CanonicalLink, type CanonicalTable, type CanonicalView, type ColumnType, IDENTIFIER_RE,
|
|
1292
|
+
export { CANONICAL_FORMAT, CELL_PART_TYPES, COLUMN_TYPES, COMPARATORS, type CanonicalCheck, type CanonicalColumn, type CanonicalCowMutation, type CanonicalDefinition, type CanonicalEnum, type CanonicalFetchShape, type CanonicalForeignKey, type CanonicalFunctionRef, type CanonicalLink, type CanonicalRelation, type CanonicalResolveRule, type CanonicalResolved, type CanonicalResolvedSource, type CanonicalTable, type CanonicalView, type ColumnType, type ComparatorKind, IDENTIFIER_RE, RESERVED_RESOLVED_COLUMN_NAMES, RESOLVED_SOURCE_CELL_PARTS, RESOLVED_SOURCE_SYSTEM_COLUMNS, RESOLVED_VIEW_CELL_PARTS, RESOLVED_VIEW_SYSTEM_COLUMNS, VIEW_QUERY_FUNCTION_ALLOWLIST, canonicalActionSchema, canonicalCheckSchema, canonicalColumnSchema, canonicalCowMutationSchema, canonicalDefinitionSchema, canonicalEnumSchema, canonicalFetchShapeSchema, canonicalForeignKeySchema, canonicalFunctionRefSchema, canonicalIndexSchema, canonicalLinkSchema, canonicalPoliciesSchema, canonicalRelations, canonicalResolveRuleSchema, canonicalResolvedSchema, canonicalResolvedSourceSchema, canonicalTableSchema, canonicalViewSchema, isSingleViewQuerySql, normalizeCanonical, parseDurationMs, trackedCellColumns, validateResolvedView };
|