@sequenceholdings/orm 2.8.4 → 2.8.5
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/dist/authoring.cjs +142 -56
- package/dist/authoring.cjs.map +1 -1
- package/dist/authoring.d.cts +5 -1
- package/dist/authoring.d.ts +5 -1
- package/dist/authoring.js +142 -56
- package/dist/authoring.js.map +1 -1
- package/dist/canonical.cjs +63 -13
- package/dist/canonical.cjs.map +1 -1
- package/dist/canonical.d.cts +11 -6
- package/dist/canonical.d.ts +11 -6
- package/dist/canonical.js +63 -13
- package/dist/canonical.js.map +1 -1
- package/dist/cli.cjs +77 -19
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.js +77 -19
- package/dist/cli.js.map +1 -1
- package/dist/compiler.cjs +76 -19
- package/dist/compiler.cjs.map +1 -1
- package/dist/compiler.js +76 -19
- package/dist/compiler.js.map +1 -1
- package/dist/index.cjs +149 -58
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +4 -2
- package/dist/index.d.ts +4 -2
- package/dist/index.js +149 -58
- package/dist/index.js.map +1 -1
- package/dist/ir.cjs +70 -15
- package/dist/ir.cjs.map +1 -1
- package/dist/ir.d.cts +7 -7
- package/dist/ir.d.ts +7 -7
- package/dist/ir.js +70 -15
- package/dist/ir.js.map +1 -1
- package/dist/predicate-v2.cjs +70 -15
- package/dist/predicate-v2.cjs.map +1 -1
- package/dist/predicate-v2.js +70 -15
- package/dist/predicate-v2.js.map +1 -1
- package/dist/sdl.cjs +70 -15
- package/dist/sdl.cjs.map +1 -1
- package/dist/sdl.js +70 -15
- package/dist/sdl.js.map +1 -1
- package/package.json +1 -1
package/dist/canonical.d.cts
CHANGED
|
@@ -103,8 +103,8 @@ declare const canonicalResolvedSourceSchema: z.ZodObject<{
|
|
|
103
103
|
name: z.ZodString;
|
|
104
104
|
kind: z.ZodEnum<{
|
|
105
105
|
manual: "manual";
|
|
106
|
-
prefetch: "prefetch";
|
|
107
106
|
etl: "etl";
|
|
107
|
+
prefetch: "prefetch";
|
|
108
108
|
}>;
|
|
109
109
|
table: z.ZodString;
|
|
110
110
|
columns: z.ZodArray<z.ZodString>;
|
|
@@ -161,8 +161,8 @@ declare const canonicalResolvedSchema: z.ZodObject<{
|
|
|
161
161
|
name: z.ZodString;
|
|
162
162
|
kind: z.ZodEnum<{
|
|
163
163
|
manual: "manual";
|
|
164
|
-
prefetch: "prefetch";
|
|
165
164
|
etl: "etl";
|
|
165
|
+
prefetch: "prefetch";
|
|
166
166
|
}>;
|
|
167
167
|
table: z.ZodString;
|
|
168
168
|
columns: z.ZodArray<z.ZodString>;
|
|
@@ -213,6 +213,7 @@ declare const canonicalResolvedSchema: z.ZodObject<{
|
|
|
213
213
|
orderBy: z.ZodOptional<z.ZodString>;
|
|
214
214
|
}, z.core.$strict>>;
|
|
215
215
|
deletedBy: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
216
|
+
existsIn: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
216
217
|
materialized: z.ZodOptional<z.ZodObject<{
|
|
217
218
|
table: z.ZodString;
|
|
218
219
|
compute: z.ZodString;
|
|
@@ -807,8 +808,8 @@ declare const canonicalViewSchema: z.ZodObject<{
|
|
|
807
808
|
name: z.ZodString;
|
|
808
809
|
kind: z.ZodEnum<{
|
|
809
810
|
manual: "manual";
|
|
810
|
-
prefetch: "prefetch";
|
|
811
811
|
etl: "etl";
|
|
812
|
+
prefetch: "prefetch";
|
|
812
813
|
}>;
|
|
813
814
|
table: z.ZodString;
|
|
814
815
|
columns: z.ZodArray<z.ZodString>;
|
|
@@ -859,6 +860,7 @@ declare const canonicalViewSchema: z.ZodObject<{
|
|
|
859
860
|
orderBy: z.ZodOptional<z.ZodString>;
|
|
860
861
|
}, z.core.$strict>>;
|
|
861
862
|
deletedBy: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
863
|
+
existsIn: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
862
864
|
materialized: z.ZodOptional<z.ZodObject<{
|
|
863
865
|
table: z.ZodString;
|
|
864
866
|
compute: z.ZodString;
|
|
@@ -1213,8 +1215,8 @@ declare const localDefinitionSchema: z.ZodObject<{
|
|
|
1213
1215
|
name: z.ZodString;
|
|
1214
1216
|
kind: z.ZodEnum<{
|
|
1215
1217
|
manual: "manual";
|
|
1216
|
-
prefetch: "prefetch";
|
|
1217
1218
|
etl: "etl";
|
|
1219
|
+
prefetch: "prefetch";
|
|
1218
1220
|
}>;
|
|
1219
1221
|
table: z.ZodString;
|
|
1220
1222
|
columns: z.ZodArray<z.ZodString>;
|
|
@@ -1265,6 +1267,7 @@ declare const localDefinitionSchema: z.ZodObject<{
|
|
|
1265
1267
|
orderBy: z.ZodOptional<z.ZodString>;
|
|
1266
1268
|
}, z.core.$strict>>;
|
|
1267
1269
|
deletedBy: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
1270
|
+
existsIn: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
1268
1271
|
materialized: z.ZodOptional<z.ZodObject<{
|
|
1269
1272
|
table: z.ZodString;
|
|
1270
1273
|
compute: z.ZodString;
|
|
@@ -1602,8 +1605,8 @@ declare const canonicalDefinitionSchema: z.ZodObject<{
|
|
|
1602
1605
|
name: z.ZodString;
|
|
1603
1606
|
kind: z.ZodEnum<{
|
|
1604
1607
|
manual: "manual";
|
|
1605
|
-
prefetch: "prefetch";
|
|
1606
1608
|
etl: "etl";
|
|
1609
|
+
prefetch: "prefetch";
|
|
1607
1610
|
}>;
|
|
1608
1611
|
table: z.ZodString;
|
|
1609
1612
|
columns: z.ZodArray<z.ZodString>;
|
|
@@ -1654,6 +1657,7 @@ declare const canonicalDefinitionSchema: z.ZodObject<{
|
|
|
1654
1657
|
orderBy: z.ZodOptional<z.ZodString>;
|
|
1655
1658
|
}, z.core.$strict>>;
|
|
1656
1659
|
deletedBy: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
1660
|
+
existsIn: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
1657
1661
|
materialized: z.ZodOptional<z.ZodObject<{
|
|
1658
1662
|
table: z.ZodString;
|
|
1659
1663
|
compute: z.ZodString;
|
|
@@ -1990,8 +1994,8 @@ declare const canonicalDefinitionSchema: z.ZodObject<{
|
|
|
1990
1994
|
name: z.ZodString;
|
|
1991
1995
|
kind: z.ZodEnum<{
|
|
1992
1996
|
manual: "manual";
|
|
1993
|
-
prefetch: "prefetch";
|
|
1994
1997
|
etl: "etl";
|
|
1998
|
+
prefetch: "prefetch";
|
|
1995
1999
|
}>;
|
|
1996
2000
|
table: z.ZodString;
|
|
1997
2001
|
columns: z.ZodArray<z.ZodString>;
|
|
@@ -2042,6 +2046,7 @@ declare const canonicalDefinitionSchema: z.ZodObject<{
|
|
|
2042
2046
|
orderBy: z.ZodOptional<z.ZodString>;
|
|
2043
2047
|
}, z.core.$strict>>;
|
|
2044
2048
|
deletedBy: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
2049
|
+
existsIn: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
2045
2050
|
materialized: z.ZodOptional<z.ZodObject<{
|
|
2046
2051
|
table: z.ZodString;
|
|
2047
2052
|
compute: z.ZodString;
|
package/dist/canonical.d.ts
CHANGED
|
@@ -103,8 +103,8 @@ declare const canonicalResolvedSourceSchema: z.ZodObject<{
|
|
|
103
103
|
name: z.ZodString;
|
|
104
104
|
kind: z.ZodEnum<{
|
|
105
105
|
manual: "manual";
|
|
106
|
-
prefetch: "prefetch";
|
|
107
106
|
etl: "etl";
|
|
107
|
+
prefetch: "prefetch";
|
|
108
108
|
}>;
|
|
109
109
|
table: z.ZodString;
|
|
110
110
|
columns: z.ZodArray<z.ZodString>;
|
|
@@ -161,8 +161,8 @@ declare const canonicalResolvedSchema: z.ZodObject<{
|
|
|
161
161
|
name: z.ZodString;
|
|
162
162
|
kind: z.ZodEnum<{
|
|
163
163
|
manual: "manual";
|
|
164
|
-
prefetch: "prefetch";
|
|
165
164
|
etl: "etl";
|
|
165
|
+
prefetch: "prefetch";
|
|
166
166
|
}>;
|
|
167
167
|
table: z.ZodString;
|
|
168
168
|
columns: z.ZodArray<z.ZodString>;
|
|
@@ -213,6 +213,7 @@ declare const canonicalResolvedSchema: z.ZodObject<{
|
|
|
213
213
|
orderBy: z.ZodOptional<z.ZodString>;
|
|
214
214
|
}, z.core.$strict>>;
|
|
215
215
|
deletedBy: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
216
|
+
existsIn: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
216
217
|
materialized: z.ZodOptional<z.ZodObject<{
|
|
217
218
|
table: z.ZodString;
|
|
218
219
|
compute: z.ZodString;
|
|
@@ -807,8 +808,8 @@ declare const canonicalViewSchema: z.ZodObject<{
|
|
|
807
808
|
name: z.ZodString;
|
|
808
809
|
kind: z.ZodEnum<{
|
|
809
810
|
manual: "manual";
|
|
810
|
-
prefetch: "prefetch";
|
|
811
811
|
etl: "etl";
|
|
812
|
+
prefetch: "prefetch";
|
|
812
813
|
}>;
|
|
813
814
|
table: z.ZodString;
|
|
814
815
|
columns: z.ZodArray<z.ZodString>;
|
|
@@ -859,6 +860,7 @@ declare const canonicalViewSchema: z.ZodObject<{
|
|
|
859
860
|
orderBy: z.ZodOptional<z.ZodString>;
|
|
860
861
|
}, z.core.$strict>>;
|
|
861
862
|
deletedBy: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
863
|
+
existsIn: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
862
864
|
materialized: z.ZodOptional<z.ZodObject<{
|
|
863
865
|
table: z.ZodString;
|
|
864
866
|
compute: z.ZodString;
|
|
@@ -1213,8 +1215,8 @@ declare const localDefinitionSchema: z.ZodObject<{
|
|
|
1213
1215
|
name: z.ZodString;
|
|
1214
1216
|
kind: z.ZodEnum<{
|
|
1215
1217
|
manual: "manual";
|
|
1216
|
-
prefetch: "prefetch";
|
|
1217
1218
|
etl: "etl";
|
|
1219
|
+
prefetch: "prefetch";
|
|
1218
1220
|
}>;
|
|
1219
1221
|
table: z.ZodString;
|
|
1220
1222
|
columns: z.ZodArray<z.ZodString>;
|
|
@@ -1265,6 +1267,7 @@ declare const localDefinitionSchema: z.ZodObject<{
|
|
|
1265
1267
|
orderBy: z.ZodOptional<z.ZodString>;
|
|
1266
1268
|
}, z.core.$strict>>;
|
|
1267
1269
|
deletedBy: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
1270
|
+
existsIn: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
1268
1271
|
materialized: z.ZodOptional<z.ZodObject<{
|
|
1269
1272
|
table: z.ZodString;
|
|
1270
1273
|
compute: z.ZodString;
|
|
@@ -1602,8 +1605,8 @@ declare const canonicalDefinitionSchema: z.ZodObject<{
|
|
|
1602
1605
|
name: z.ZodString;
|
|
1603
1606
|
kind: z.ZodEnum<{
|
|
1604
1607
|
manual: "manual";
|
|
1605
|
-
prefetch: "prefetch";
|
|
1606
1608
|
etl: "etl";
|
|
1609
|
+
prefetch: "prefetch";
|
|
1607
1610
|
}>;
|
|
1608
1611
|
table: z.ZodString;
|
|
1609
1612
|
columns: z.ZodArray<z.ZodString>;
|
|
@@ -1654,6 +1657,7 @@ declare const canonicalDefinitionSchema: z.ZodObject<{
|
|
|
1654
1657
|
orderBy: z.ZodOptional<z.ZodString>;
|
|
1655
1658
|
}, z.core.$strict>>;
|
|
1656
1659
|
deletedBy: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
1660
|
+
existsIn: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
1657
1661
|
materialized: z.ZodOptional<z.ZodObject<{
|
|
1658
1662
|
table: z.ZodString;
|
|
1659
1663
|
compute: z.ZodString;
|
|
@@ -1990,8 +1994,8 @@ declare const canonicalDefinitionSchema: z.ZodObject<{
|
|
|
1990
1994
|
name: z.ZodString;
|
|
1991
1995
|
kind: z.ZodEnum<{
|
|
1992
1996
|
manual: "manual";
|
|
1993
|
-
prefetch: "prefetch";
|
|
1994
1997
|
etl: "etl";
|
|
1998
|
+
prefetch: "prefetch";
|
|
1995
1999
|
}>;
|
|
1996
2000
|
table: z.ZodString;
|
|
1997
2001
|
columns: z.ZodArray<z.ZodString>;
|
|
@@ -2042,6 +2046,7 @@ declare const canonicalDefinitionSchema: z.ZodObject<{
|
|
|
2042
2046
|
orderBy: z.ZodOptional<z.ZodString>;
|
|
2043
2047
|
}, z.core.$strict>>;
|
|
2044
2048
|
deletedBy: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
2049
|
+
existsIn: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
2045
2050
|
materialized: z.ZodOptional<z.ZodObject<{
|
|
2046
2051
|
table: z.ZodString;
|
|
2047
2052
|
compute: z.ZodString;
|
package/dist/canonical.js
CHANGED
|
@@ -252,6 +252,48 @@ var policyExpressionSchema = z.union([
|
|
|
252
252
|
variants: z.array(policyVariantSchema).max(10).default([])
|
|
253
253
|
})
|
|
254
254
|
]);
|
|
255
|
+
|
|
256
|
+
// src/canonical/resolved-rows.ts
|
|
257
|
+
function logicalKey(table) {
|
|
258
|
+
return (table.primaryKey ?? []).map((columnName) => table.columns.find((c) => c.columnName === columnName)?.name ?? columnName);
|
|
259
|
+
}
|
|
260
|
+
function sameKey(key, expected) {
|
|
261
|
+
return key.length === expected.length && key.every((name) => expected.includes(name));
|
|
262
|
+
}
|
|
263
|
+
function validateRowIdentity(input) {
|
|
264
|
+
validateExistsIn(input);
|
|
265
|
+
if (input.keys.length > 1) validateCompositeKey(input);
|
|
266
|
+
}
|
|
267
|
+
function validateExistsIn({ resolved, sourceByName, fail }) {
|
|
268
|
+
const name = resolved.existsIn?.[0];
|
|
269
|
+
if (name === void 0) return;
|
|
270
|
+
if (sourceByName.get(name)?.kind !== "etl") fail(`existsIn '${name}' must be an etl source`);
|
|
271
|
+
if (resolved.policies.insert !== void 0 || resolved.policies.write !== void 0) {
|
|
272
|
+
fail("existsIn allows only an update policy: rows come from the etl source");
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
function validateCompositeKey({ resolved, keys, tableByName, fail }) {
|
|
276
|
+
const keyList = `(${keys.join(", ")})`;
|
|
277
|
+
if (resolved.existsIn === void 0) {
|
|
278
|
+
fail(`requires exactly one primary-key column: composite key ${keyList} requires existsIn`);
|
|
279
|
+
return;
|
|
280
|
+
}
|
|
281
|
+
const writes = ["insert", "update", "write"].filter((kind) => resolved.policies[kind] !== void 0);
|
|
282
|
+
if (writes.length > 0) fail(`composite key ${keyList} requires a read-only table: remove the ${writes.join("/")} policy`);
|
|
283
|
+
if (resolved.materialized) fail(`composite key ${keyList} cannot be materialized`);
|
|
284
|
+
for (const source of resolved.sources) {
|
|
285
|
+
if (source.kind === "prefetch") {
|
|
286
|
+
fail(`composite key ${keyList} cannot have prefetch source '${source.name}'`);
|
|
287
|
+
continue;
|
|
288
|
+
}
|
|
289
|
+
const table = tableByName.get(source.table);
|
|
290
|
+
if (table && !sameKey(logicalKey(table), keys)) {
|
|
291
|
+
fail(`composite key ${keyList} requires ${source.kind} source '${source.name}' to be keyed by it; table '${source.table}' is keyed by (${logicalKey(table).join(", ")})`);
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
// src/canonical/resolved.ts
|
|
255
297
|
function parseDurationMs(input) {
|
|
256
298
|
if (typeof input === "number") return Number.isInteger(input) && input > 0 ? input : void 0;
|
|
257
299
|
const match = /^(\d+(?:\.\d+)?)(ms|s|m)$/.exec(input);
|
|
@@ -329,6 +371,13 @@ var canonicalResolvedSchema = z.object({
|
|
|
329
371
|
resolve: z.array(canonicalResolveRuleSchema).max(500),
|
|
330
372
|
/** Sources whose tombstone hides the resolved row (v1: the manual source only). */
|
|
331
373
|
deletedBy: z.array(identifier).max(1).default([]),
|
|
374
|
+
/**
|
|
375
|
+
* `rows.existsIn`: the one etl source whose rows are the table's rows (read
|
|
376
|
+
* directly as the row source). Only an update policy may write. It is also
|
|
377
|
+
* what admits a composite primary key: a read-only table keyed exactly like
|
|
378
|
+
* that source.
|
|
379
|
+
*/
|
|
380
|
+
existsIn: z.array(identifier).length(1).optional(),
|
|
332
381
|
/**
|
|
333
382
|
* Materialized: the view reads an indexed internal table (`table`) that the
|
|
334
383
|
* data plane keeps in step with `compute`, the internal view holding the
|
|
@@ -347,8 +396,8 @@ function validateResolvedView({ view, tables, views = [] }) {
|
|
|
347
396
|
if (!resolved) return [];
|
|
348
397
|
const errors = [];
|
|
349
398
|
const fail = (message) => errors.push(`resolved table '${view.view}': ${message}`);
|
|
350
|
-
const
|
|
351
|
-
if (
|
|
399
|
+
const keyColumns = (view.primaryKey ?? []).map((columnName) => view.columns.find((c) => c.columnName === columnName)).filter((column) => column !== void 0);
|
|
400
|
+
if (keyColumns.length === 0 || keyColumns.length !== view.primaryKey?.length) {
|
|
352
401
|
fail("requires exactly one primary-key column");
|
|
353
402
|
return errors;
|
|
354
403
|
}
|
|
@@ -356,7 +405,7 @@ function validateResolvedView({ view, tables, views = [] }) {
|
|
|
356
405
|
const scope = {
|
|
357
406
|
view,
|
|
358
407
|
resolved,
|
|
359
|
-
|
|
408
|
+
keys: new Map(keyColumns.map((column) => [column.name, column])),
|
|
360
409
|
dataColumns: new Map(view.columns.filter((c) => !systemNames.has(c.name) && c.cell === void 0).map((c) => [c.name, c])),
|
|
361
410
|
sourceByName: /* @__PURE__ */ new Map(),
|
|
362
411
|
fail
|
|
@@ -370,6 +419,7 @@ function validateResolvedView({ view, tables, views = [] }) {
|
|
|
370
419
|
if (!table) fail(`source '${source.name}' references unknown table '${source.table}'`);
|
|
371
420
|
else validateSource({ scope, source, table });
|
|
372
421
|
}
|
|
422
|
+
validateRowIdentity({ resolved, keys: [...scope.keys.keys()], sourceByName: scope.sourceByName, tableByName, fail });
|
|
373
423
|
validateRules(scope);
|
|
374
424
|
validateViewCells(scope);
|
|
375
425
|
if (resolved.materialized) validateMaterialized({ scope, tableByName, views });
|
|
@@ -399,7 +449,7 @@ function validateSource({ scope, source, table }) {
|
|
|
399
449
|
validatePrefetchFields({ scope, source });
|
|
400
450
|
}
|
|
401
451
|
function validatePrefetchFields({ scope, source }) {
|
|
402
|
-
const { fail,
|
|
452
|
+
const { fail, keys } = scope;
|
|
403
453
|
if (source.kind !== "prefetch") {
|
|
404
454
|
if (source.key || source.fetch || source.function || source.prefetchDefaults || source.writeback) {
|
|
405
455
|
fail(`only prefetch sources may declare key/fetch/function/prefetchDefaults/writeback ('${source.name}')`);
|
|
@@ -408,7 +458,7 @@ function validatePrefetchFields({ scope, source }) {
|
|
|
408
458
|
}
|
|
409
459
|
if (!source.key || !source.fetch || !source.function || !source.prefetchDefaults) {
|
|
410
460
|
fail(`prefetch source '${source.name}' requires key, fetch, function and prefetchDefaults`);
|
|
411
|
-
} else if (source.key
|
|
461
|
+
} else if (!keys.has(source.key) && !source.columns.includes(source.key)) {
|
|
412
462
|
fail(`prefetch source '${source.name}' key '${source.key}' must be the primary key or one of its columns`);
|
|
413
463
|
}
|
|
414
464
|
for (const column of source.writeback?.columns ?? []) {
|
|
@@ -416,19 +466,19 @@ function validatePrefetchFields({ scope, source }) {
|
|
|
416
466
|
}
|
|
417
467
|
}
|
|
418
468
|
function validateSourceColumns({ scope, source, byName }) {
|
|
419
|
-
const { fail,
|
|
420
|
-
for (const column of [
|
|
421
|
-
const own = column
|
|
469
|
+
const { fail, keys, dataColumns } = scope;
|
|
470
|
+
for (const column of [...keys.keys(), ...source.columns]) {
|
|
471
|
+
const own = keys.get(column) ?? dataColumns.get(column);
|
|
422
472
|
const theirs = byName.get(column);
|
|
423
473
|
if (!own) fail(`source '${source.name}' supplies unknown column '${column}'`);
|
|
424
474
|
else if (!theirs) fail(`source '${source.name}' table '${source.table}' has no column '${column}'`);
|
|
425
475
|
else if (JSON.stringify(theirs.type) !== JSON.stringify(own.type)) fail(`column '${column}' has a different type on source '${source.name}'`);
|
|
426
476
|
}
|
|
427
477
|
}
|
|
428
|
-
function validateRules({ resolved,
|
|
478
|
+
function validateRules({ resolved, keys, dataColumns, sourceByName, fail }) {
|
|
429
479
|
const ruled = /* @__PURE__ */ new Set();
|
|
430
480
|
for (const rule of resolved.resolve) {
|
|
431
|
-
if (!dataColumns.has(rule.column) || rule.column
|
|
481
|
+
if (!dataColumns.has(rule.column) || keys.has(rule.column)) {
|
|
432
482
|
fail(`resolve rule targets unknown column '${rule.column}'`);
|
|
433
483
|
continue;
|
|
434
484
|
}
|
|
@@ -445,7 +495,7 @@ function validateRules({ resolved, pkColumn, dataColumns, sourceByName, fail })
|
|
|
445
495
|
}
|
|
446
496
|
}
|
|
447
497
|
for (const column of dataColumns.keys()) {
|
|
448
|
-
if (column
|
|
498
|
+
if (!keys.has(column) && !ruled.has(column)) fail(`column '${column}' has no resolve rule`);
|
|
449
499
|
}
|
|
450
500
|
}
|
|
451
501
|
var VIEW_CELL_TYPES = {
|
|
@@ -454,10 +504,10 @@ var VIEW_CELL_TYPES = {
|
|
|
454
504
|
by: "text",
|
|
455
505
|
conflicts: "jsonb"
|
|
456
506
|
};
|
|
457
|
-
function validateViewCells({ view, dataColumns,
|
|
507
|
+
function validateViewCells({ view, dataColumns, keys, fail }) {
|
|
458
508
|
const expected = /* @__PURE__ */ new Map();
|
|
459
509
|
for (const column of dataColumns.values()) {
|
|
460
|
-
if (column.name
|
|
510
|
+
if (keys.has(column.name)) continue;
|
|
461
511
|
for (const part of RESOLVED_VIEW_CELL_PARTS) {
|
|
462
512
|
expected.set(cellColumnName(column.name, part), { part, columnName: cellColumnName(column.columnName, part) });
|
|
463
513
|
}
|