@atscript/db 0.1.145 → 0.1.147

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 (45) hide show
  1. package/dist/agg.cjs +1 -1
  2. package/dist/agg.d.cts +1 -1
  3. package/dist/agg.d.mts +1 -1
  4. package/dist/agg.mjs +1 -1
  5. package/dist/{aggregate-fns-CfsveE1w.mjs → aggregate-fns-C0BymEqa.mjs} +3 -1
  6. package/dist/{aggregate-fns-CGBv3E8S.cjs → aggregate-fns-CtsRbZn9.cjs} +8 -0
  7. package/dist/{buckets-DYFu0eZ8.d.cts → buckets-CjdPipCC.d.cts} +522 -17
  8. package/dist/{buckets-DRycmhOW.d.mts → buckets-DYopfd2Y.d.mts} +522 -17
  9. package/dist/{column-diff-e2oHc71_.mjs → column-diff-CO06iQvI.mjs} +862 -115
  10. package/dist/{column-diff-D_Kyuh0S.cjs → column-diff-Dt7EDJsA.cjs} +872 -113
  11. package/dist/{column-diff-Q9UmWn5x.d.mts → fk-diff-BtOmL4OW.d.mts} +48 -2
  12. package/dist/{column-diff-w-Mym_3w.d.cts → fk-diff-DLqwVkKG.d.cts} +48 -2
  13. package/dist/index.cjs +28 -33
  14. package/dist/index.d.cts +40 -15
  15. package/dist/index.d.mts +40 -15
  16. package/dist/index.mjs +5 -33
  17. package/dist/{nested-writer-CnOOAehr.mjs → nested-writer-D35UsDBT.mjs} +542 -2
  18. package/dist/{nested-writer-xfQwxplL.cjs → nested-writer-SqtYJHF0.cjs} +666 -0
  19. package/dist/plugin.cjs +266 -5
  20. package/dist/plugin.mjs +267 -6
  21. package/dist/rel.cjs +2 -2
  22. package/dist/rel.d.cts +2 -2
  23. package/dist/rel.d.mts +2 -2
  24. package/dist/rel.mjs +2 -2
  25. package/dist/{relation-helpers-B-0NRKat.d.mts → relation-helpers-C2bLtE-t.d.mts} +1 -1
  26. package/dist/{relation-helpers-BOMm_HUI.d.cts → relation-helpers-DH3LvwLV.d.cts} +1 -1
  27. package/dist/relation-loader-BFhVuJ-B.cjs +369 -0
  28. package/dist/relation-loader-C0qE8xgR.mjs +370 -0
  29. package/dist/shared.cjs +1 -1
  30. package/dist/shared.d.cts +4 -3
  31. package/dist/shared.d.mts +4 -3
  32. package/dist/shared.mjs +1 -1
  33. package/dist/sync.cjs +10 -6
  34. package/dist/sync.d.cts +2 -25
  35. package/dist/sync.d.mts +2 -25
  36. package/dist/sync.mjs +10 -6
  37. package/dist/{validation-utils-DOsB4e6G.cjs → validation-utils-Da2GjobR.cjs} +35 -24
  38. package/dist/{validation-utils-CMR4fe2M.mjs → validation-utils-Dq0uZ7ef.mjs} +35 -24
  39. package/dist/{validator-Bw6ks9Hy.d.mts → validator-CMnTI6r7.d.cts} +9 -6
  40. package/dist/{validator-Bw6ks9Hy.d.cts → validator-CMnTI6r7.d.mts} +9 -6
  41. package/dist/validator.d.cts +1 -1
  42. package/dist/validator.d.mts +1 -1
  43. package/package.json +8 -8
  44. package/dist/relation-loader-CBPY6kM7.cjs +0 -461
  45. package/dist/relation-loader-D9XuXaMv.mjs +0 -462
@@ -1,4 +1,4 @@
1
- import { B as TDbFieldMeta, Gt as AtscriptDbView, O as TColumnDiff, Q as TDbStorageType, Qt as AtscriptQueryNode, R as TDbDefaultValue, Zt as AtscriptQueryFieldRef, dt as TExistingTableOption, lt as TExistingColumn, sn as AtscriptDbReadable, st as TDerivedColumn } from "./buckets-DRycmhOW.mjs";
1
+ import { $ as TDbStorageType, H as TDbForeignKey, Jt as AtscriptDbView, O as TColumnDiff, V as TDbFieldMeta, ct as TDerivedColumn, ft as TExistingTableOption, nn as AtscriptQueryFieldRef, pn as AtscriptDbReadable, rn as AtscriptQueryNode, ut as TExistingColumn, z as TDbDefaultValue } from "./buckets-DYopfd2Y.mjs";
2
2
 
3
3
  //#region src/schema/schema-hash.d.ts
4
4
  interface TFieldSnapshot {
@@ -66,6 +66,11 @@ interface TViewJoinSnapshot {
66
66
  condition: string;
67
67
  /** Emitted only for `"left"` — an inner join (the default) carries no key. @since 0.1.136 */
68
68
  kind?: "inner" | "left";
69
+ /**
70
+ * First-row joins only: canonical JSON `[["<scope>.<column>", 1 | -1], …]`
71
+ * of the ordering, the appended primary key included. @since 0.1.147
72
+ */
73
+ order?: string;
69
74
  }
70
75
  /**
71
76
  * One column of a managed view as stored in its snapshot — the PHYSICAL
@@ -84,6 +89,12 @@ interface TViewColumnSnapshot {
84
89
  aggField?: string;
85
90
  /** Canonical JSON of a conditional aggregate's predicate. */
86
91
  aggFilter?: string;
92
+ /**
93
+ * Computed columns only: canonical JSON of the `@db.compute` expression —
94
+ * leaves `{c: "<viewColumn>"}`, literals `{n: x}`, nodes `{op, a: [...]}`.
95
+ * @since 0.1.147
96
+ */
97
+ expr?: string;
87
98
  }
88
99
  interface TViewSnapshot {
89
100
  tableName: string;
@@ -208,4 +219,39 @@ declare function computeColumnDiff(desired: readonly TDbFieldMeta[], existing: T
208
219
  snapshot?: TTableSnapshot | null;
209
220
  }): TColumnDiff;
210
221
  //#endregion
211
- export { TTableSnapshot as a, TViewSnapshot as c, computeTableHash as d, computeTableSnapshot as f, snapshotToExistingTableOptions as h, TForeignKeySnapshot as i, canonicalizeQueryNode as l, snapshotToExistingColumns as m, isColumnTypeChanged as n, TViewColumnSnapshot as o, computeViewSnapshot as p, TFieldSnapshot as r, TViewJoinSnapshot as s, computeColumnDiff as t, computeSchemaHash as u };
222
+ //#region src/schema/fk-diff.d.ts
223
+ /**
224
+ * Desired FKs are keyed and compared by their PHYSICAL columns
225
+ * ({@link fkColumns}) — the snapshot side is physical too.
226
+ */
227
+ interface TForeignKeyDiff {
228
+ /** FKs present in desired but not in stored snapshot (new). */
229
+ added: TDbForeignKey[];
230
+ /** FKs present in stored snapshot but not in desired (removed). */
231
+ removed: TForeignKeySnapshot[];
232
+ /** FKs where fields match but target, onDelete, or onUpdate differ. */
233
+ changed: Array<{
234
+ desired: TDbForeignKey;
235
+ existing: TForeignKeySnapshot;
236
+ }>;
237
+ }
238
+ /** Canonical key for an FK: sorted local field names, comma-joined. */
239
+ declare function fkKey(fields: readonly string[]): string;
240
+ /**
241
+ * Physical local / target column names of a desired FK (`@db.column` renames
242
+ * applied) — what DDL, constraint sync, the FK diff and the snapshot compare.
243
+ */
244
+ declare function fkColumns(fk: TDbForeignKey): {
245
+ fields: string[];
246
+ targetFields: string[];
247
+ };
248
+ /**
249
+ * Compares desired FK constraints against stored snapshot to detect
250
+ * additions, removals, and property changes (target table, target fields,
251
+ * onDelete, onUpdate).
252
+ */
253
+ declare function computeForeignKeyDiff(desired: ReadonlyMap<string, TDbForeignKey>, existingSnapshot: readonly TForeignKeySnapshot[]): TForeignKeyDiff;
254
+ /** Whether the FK diff contains any changes. */
255
+ declare function hasForeignKeyChanges(diff: TForeignKeyDiff): boolean;
256
+ //#endregion
257
+ export { computeTableSnapshot as _, hasForeignKeyChanges as a, snapshotToExistingTableOptions as b, TFieldSnapshot as c, TViewColumnSnapshot as d, TViewJoinSnapshot as f, computeTableHash as g, computeSchemaHash as h, fkKey as i, TForeignKeySnapshot as l, canonicalizeQueryNode as m, computeForeignKeyDiff as n, computeColumnDiff as o, TViewSnapshot as p, fkColumns as r, isColumnTypeChanged as s, TForeignKeyDiff as t, TTableSnapshot as u, computeViewSnapshot as v, snapshotToExistingColumns as y };
@@ -1,4 +1,4 @@
1
- import { B as TDbFieldMeta, Gt as AtscriptDbView, O as TColumnDiff, Q as TDbStorageType, Qt as AtscriptQueryNode, R as TDbDefaultValue, Zt as AtscriptQueryFieldRef, dt as TExistingTableOption, lt as TExistingColumn, sn as AtscriptDbReadable, st as TDerivedColumn } from "./buckets-DYFu0eZ8.cjs";
1
+ import { $ as TDbStorageType, H as TDbForeignKey, Jt as AtscriptDbView, O as TColumnDiff, V as TDbFieldMeta, ct as TDerivedColumn, ft as TExistingTableOption, nn as AtscriptQueryFieldRef, pn as AtscriptDbReadable, rn as AtscriptQueryNode, ut as TExistingColumn, z as TDbDefaultValue } from "./buckets-CjdPipCC.cjs";
2
2
 
3
3
  //#region src/schema/schema-hash.d.ts
4
4
  interface TFieldSnapshot {
@@ -66,6 +66,11 @@ interface TViewJoinSnapshot {
66
66
  condition: string;
67
67
  /** Emitted only for `"left"` — an inner join (the default) carries no key. @since 0.1.136 */
68
68
  kind?: "inner" | "left";
69
+ /**
70
+ * First-row joins only: canonical JSON `[["<scope>.<column>", 1 | -1], …]`
71
+ * of the ordering, the appended primary key included. @since 0.1.147
72
+ */
73
+ order?: string;
69
74
  }
70
75
  /**
71
76
  * One column of a managed view as stored in its snapshot — the PHYSICAL
@@ -84,6 +89,12 @@ interface TViewColumnSnapshot {
84
89
  aggField?: string;
85
90
  /** Canonical JSON of a conditional aggregate's predicate. */
86
91
  aggFilter?: string;
92
+ /**
93
+ * Computed columns only: canonical JSON of the `@db.compute` expression —
94
+ * leaves `{c: "<viewColumn>"}`, literals `{n: x}`, nodes `{op, a: [...]}`.
95
+ * @since 0.1.147
96
+ */
97
+ expr?: string;
87
98
  }
88
99
  interface TViewSnapshot {
89
100
  tableName: string;
@@ -208,4 +219,39 @@ declare function computeColumnDiff(desired: readonly TDbFieldMeta[], existing: T
208
219
  snapshot?: TTableSnapshot | null;
209
220
  }): TColumnDiff;
210
221
  //#endregion
211
- export { TTableSnapshot as a, TViewSnapshot as c, computeTableHash as d, computeTableSnapshot as f, snapshotToExistingTableOptions as h, TForeignKeySnapshot as i, canonicalizeQueryNode as l, snapshotToExistingColumns as m, isColumnTypeChanged as n, TViewColumnSnapshot as o, computeViewSnapshot as p, TFieldSnapshot as r, TViewJoinSnapshot as s, computeColumnDiff as t, computeSchemaHash as u };
222
+ //#region src/schema/fk-diff.d.ts
223
+ /**
224
+ * Desired FKs are keyed and compared by their PHYSICAL columns
225
+ * ({@link fkColumns}) — the snapshot side is physical too.
226
+ */
227
+ interface TForeignKeyDiff {
228
+ /** FKs present in desired but not in stored snapshot (new). */
229
+ added: TDbForeignKey[];
230
+ /** FKs present in stored snapshot but not in desired (removed). */
231
+ removed: TForeignKeySnapshot[];
232
+ /** FKs where fields match but target, onDelete, or onUpdate differ. */
233
+ changed: Array<{
234
+ desired: TDbForeignKey;
235
+ existing: TForeignKeySnapshot;
236
+ }>;
237
+ }
238
+ /** Canonical key for an FK: sorted local field names, comma-joined. */
239
+ declare function fkKey(fields: readonly string[]): string;
240
+ /**
241
+ * Physical local / target column names of a desired FK (`@db.column` renames
242
+ * applied) — what DDL, constraint sync, the FK diff and the snapshot compare.
243
+ */
244
+ declare function fkColumns(fk: TDbForeignKey): {
245
+ fields: string[];
246
+ targetFields: string[];
247
+ };
248
+ /**
249
+ * Compares desired FK constraints against stored snapshot to detect
250
+ * additions, removals, and property changes (target table, target fields,
251
+ * onDelete, onUpdate).
252
+ */
253
+ declare function computeForeignKeyDiff(desired: ReadonlyMap<string, TDbForeignKey>, existingSnapshot: readonly TForeignKeySnapshot[]): TForeignKeyDiff;
254
+ /** Whether the FK diff contains any changes. */
255
+ declare function hasForeignKeyChanges(diff: TForeignKeyDiff): boolean;
256
+ //#endregion
257
+ export { computeTableSnapshot as _, hasForeignKeyChanges as a, snapshotToExistingTableOptions as b, TFieldSnapshot as c, TViewColumnSnapshot as d, TViewJoinSnapshot as f, computeTableHash as g, computeSchemaHash as h, fkKey as i, TForeignKeySnapshot as l, canonicalizeQueryNode as m, computeForeignKeyDiff as n, computeColumnDiff as o, TViewSnapshot as p, fkColumns as r, isColumnTypeChanged as s, TForeignKeyDiff as t, TTableSnapshot as u, computeViewSnapshot as v, snapshotToExistingColumns as y };
package/dist/index.cjs CHANGED
@@ -1,8 +1,8 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  const require_db_error = require("./db-error-DTkkeu5b.cjs");
3
- const require_column_diff = require("./column-diff-D_Kyuh0S.cjs");
4
- const require_aggregate_fns = require("./aggregate-fns-CGBv3E8S.cjs");
5
- const require_nested_writer = require("./nested-writer-xfQwxplL.cjs");
3
+ const require_column_diff = require("./column-diff-Dt7EDJsA.cjs");
4
+ const require_aggregate_fns = require("./aggregate-fns-CtsRbZn9.cjs");
5
+ const require_nested_writer = require("./nested-writer-SqtYJHF0.cjs");
6
6
  const require_derived_rules = require("./derived-rules-YstgIxG-.cjs");
7
7
  const require_object = require("./object-Djg28csK.cjs");
8
8
  const require_consts = require("./consts-BzRfCcH2.cjs");
@@ -377,34 +377,6 @@ var DbSpace = class {
377
377
  }
378
378
  };
379
379
  //#endregion
380
- //#region src/query/query-tree.ts
381
- /**
382
- * `true` when a query-tree operand is a field reference (`{ field, type? }`)
383
- * rather than a literal — e.g. the right side of a field-to-field comparison.
384
- * @since 0.1.136
385
- */
386
- function isFieldRef(value) {
387
- return value !== null && typeof value === "object" && "field" in value;
388
- }
389
- /**
390
- * Translates a JS-emitted query tree into a FilterExpr.
391
- * Resolves field references (type + field path) to physical column names
392
- * via the provided resolver function.
393
- */
394
- function translateQueryTree(node, resolveField) {
395
- if ("$and" in node) return { $and: node.$and.map((n) => translateQueryTree(n, resolveField)) };
396
- if ("$or" in node) return { $or: node.$or.map((n) => translateQueryTree(n, resolveField)) };
397
- if ("$not" in node) return { $not: translateQueryTree(node.$not, resolveField) };
398
- const comp = node;
399
- const leftField = resolveField(comp.left);
400
- if (isFieldRef(comp.right)) {
401
- const rightField = resolveField(comp.right);
402
- return { [leftField]: { [comp.op]: { $field: rightField } } };
403
- }
404
- if (comp.op === "$exists") return { [leftField]: { $exists: comp.right !== false } };
405
- return { [leftField]: { [comp.op]: comp.right } };
406
- }
407
- //#endregion
408
380
  //#region src/table/db-entity.ts
409
381
  /**
410
382
  * Whether `value` is a compiled type a `DbSpace` accepts: an annotated type
@@ -435,6 +407,7 @@ exports.$upsert = require_ops.$upsert;
435
407
  exports.ADAPTER_FILTER_REASON = require_column_diff.ADAPTER_FILTER_REASON;
436
408
  exports.ALL_AGGREGATE_FNS = require_aggregate_fns.ALL_AGGREGATE_FNS;
437
409
  exports.ALL_BUCKET_UNITS = require_column_diff.ALL_BUCKET_UNITS;
410
+ exports.ALL_VIEW_CAPABILITIES = require_column_diff.ALL_VIEW_CAPABILITIES;
438
411
  exports.ApplicationIntegrity = require_column_diff.ApplicationIntegrity;
439
412
  exports.AtscriptDbReadable = require_column_diff.AtscriptDbReadable;
440
413
  exports.AtscriptDbTable = require_column_diff.AtscriptDbTable;
@@ -452,11 +425,21 @@ exports.FieldMappingStrategy = require_column_diff.FieldMappingStrategy;
452
425
  exports.IntegrityStrategy = require_column_diff.IntegrityStrategy;
453
426
  exports.NativeIntegrity = require_column_diff.NativeIntegrity;
454
427
  exports.NoopLogger = require_column_diff.NoopLogger;
428
+ Object.defineProperty(exports, "RELATION_OPS", {
429
+ enumerable: true,
430
+ get: function() {
431
+ return _uniqu_core.RELATION_OPS;
432
+ }
433
+ });
434
+ exports.REL_FILTER_MAX_DEPTH = require_nested_writer.REL_FILTER_MAX_DEPTH;
435
+ exports.REL_FILTER_MAX_NODES = require_nested_writer.REL_FILTER_MAX_NODES;
455
436
  exports.RelationalFieldMapper = require_column_diff.RelationalFieldMapper;
437
+ exports.ResolvedRelationFilter = require_nested_writer.ResolvedRelationFilter;
456
438
  exports.TableMetadata = require_column_diff.TableMetadata;
457
439
  exports.UniquSelect = require_column_diff.UniquSelect;
458
440
  exports.acceptedOperatorsHint = require_column_diff.acceptedOperatorsHint;
459
441
  exports.aliasTargetOf = require_column_diff.aliasTargetOf;
442
+ exports.andFilters = require_nested_writer.andFilters;
460
443
  exports.assertGeoPoint = require_column_diff.assertGeoPoint;
461
444
  exports.assertNoVersionWrites = require_column_diff.assertNoVersionWrites;
462
445
  exports.bucketSourceVerdict = require_column_diff.bucketSourceVerdict;
@@ -473,11 +456,14 @@ Object.defineProperty(exports, "computeInsights", {
473
456
  return _uniqu_core.computeInsights;
474
457
  }
475
458
  });
459
+ exports.containsRelationFilter = require_nested_writer.containsRelationFilter;
476
460
  exports.createDbValidatorPlugin = require_validator.createDbValidatorPlugin;
477
461
  exports.createFailureCollector = require_column_diff.createFailureCollector;
478
462
  exports.decomposePatch = require_column_diff.decomposePatch;
479
463
  exports.deletePath = require_object.deletePath;
480
464
  exports.findAncestorInSet = require_object.findAncestorInSet;
465
+ exports.fkColumns = require_column_diff.fkColumns;
466
+ exports.forEachResolvedRelation = require_nested_writer.forEachResolvedRelation;
481
467
  exports.forceNavNonOptional = require_validator.forceNavNonOptional;
482
468
  exports.geoIndexNotFoundMessage = require_column_diff.geoIndexNotFoundMessage;
483
469
  exports.getDbFieldOp = require_ops.getDbFieldOp;
@@ -488,13 +474,14 @@ exports.guardFilter = require_column_diff.guardFilter;
488
474
  exports.guardPath = require_column_diff.guardPath;
489
475
  exports.guardPaths = require_column_diff.guardPaths;
490
476
  exports.guardQuery = require_column_diff.guardQuery;
477
+ exports.hasRelationOp = require_nested_writer.hasRelationOp;
491
478
  exports.isAtscriptDbView = require_column_diff.isAtscriptDbView;
492
479
  exports.isBucketableField = require_column_diff.isBucketableField;
493
480
  exports.isColumnTypeChanged = require_column_diff.isColumnTypeChanged;
494
481
  exports.isDbEntityType = isDbEntityType;
495
482
  exports.isDbFieldOp = require_ops.isDbFieldOp;
496
483
  exports.isEmptyObject = require_object.isEmptyObject;
497
- exports.isFieldRef = isFieldRef;
484
+ exports.isFieldRef = require_nested_writer.isFieldRef;
498
485
  exports.isGeoIndexableType = require_column_diff.isGeoIndexableType;
499
486
  exports.isGeoPointType = require_column_diff.isGeoPointType;
500
487
  exports.isJsonValueField = require_column_diff.isJsonValueField;
@@ -506,11 +493,19 @@ Object.defineProperty(exports, "isPrimitive", {
506
493
  return _uniqu_core.isPrimitive;
507
494
  }
508
495
  });
496
+ Object.defineProperty(exports, "isRelationOp", {
497
+ enumerable: true,
498
+ get: function() {
499
+ return _uniqu_core.isRelationOp;
500
+ }
501
+ });
502
+ exports.isResolvedRelationFilter = require_nested_writer.isResolvedRelationFilter;
509
503
  exports.isViewType = require_column_diff.isViewType;
510
504
  exports.jsonValueAncestor = require_column_diff.jsonValueAncestor;
511
505
  exports.narrowerFilterOps = require_column_diff.narrowerFilterOps;
512
506
  exports.normalizeComputedSelect = require_column_diff.normalizeComputedSelect;
513
507
  exports.reconcileCas = require_ops.reconcileCas;
508
+ exports.relationStaticFilter = require_nested_writer.relationStaticFilter;
514
509
  exports.resolveCalendarBuckets = require_column_diff.resolveCalendarBuckets;
515
510
  exports.resolveDesignType = require_column_diff.resolveDesignType;
516
511
  exports.searchIndexNotFoundMessage = require_column_diff.searchIndexNotFoundMessage;
@@ -519,7 +514,7 @@ exports.separateCas = require_ops.separateCas;
519
514
  exports.separateFieldOps = require_ops.separateFieldOps;
520
515
  exports.sortFieldNames = require_column_diff.sortFieldNames;
521
516
  exports.tableNameOf = require_nested_writer.tableNameOf;
522
- exports.translateQueryTree = translateQueryTree;
517
+ exports.translateQueryTree = require_nested_writer.translateQueryTree;
523
518
  exports.unsupportedOperatorMessage = require_column_diff.unsupportedOperatorMessage;
524
519
  exports.vectorIndexNotFoundMessage = require_column_diff.vectorIndexNotFoundMessage;
525
520
  Object.defineProperty(exports, "walkFilter", {
package/dist/index.d.cts CHANGED
@@ -1,12 +1,12 @@
1
- import { $ as TDbUpdateResult, $t as AtscriptRef, A as TCrudPermissions, At as TViewJsonType, B as TDbFieldMeta, Bt as ALL_BUCKET_UNITS, C as NullableOptional, Ct as TRowResolveOptions, D as TCascadeTarget, Dt as TTableResolver, E as TCascadeResolver, Et as TTableOptionDiff, F as TDbAvailableActions, Ft as UniqueryControls, G as TDbInsertManyResult, Gt as AtscriptDbView, H as TDbIndex, Ht as DbSpace, I as TDbCollation, It as WithRelation, J as TDbReferentialAction, Jt as isViewType, K as TDbInsertResult, Kt as TViewColumnMapping, L as TDbDefaultFn, Lt as TableMetadata, M as TDbActionIntent, Mt as TWriteTableResolver, N as TDbActionLevel, Nt as TypedWithRelation, O as TColumnDiff, Ot as TTouchManyOptions, P as TDbActionProcessor, Pt as Uniquery, Q as TDbStorageType, Qt as AtscriptQueryNode, R as TDbDefaultValue, Rt as isGeoIndexableType, S as NavPropsOf, St as TRelationInfo, T as PrimaryKeyOf, Tt as TSyncColumnResult, U as TDbIndexField, Ut as TAdapterFactory, V as TDbForeignKey, Vt as BaseDbAdapter, W as TDbIndexType, Wt as TDbSpaceOptions, X as TDbRemoveGuard, Xt as AtscriptQueryComparison, Y as TDbRelation, Yt as aliasTargetOf, Z as TDbRemoveGuardContext, Zt as AtscriptQueryFieldRef, _ as DbQuery, _n as UniquSelect, _t as TIdentification, a as jsonValueAncestor, an as IntegrityStrategy, at as TDeleteOptions, b as FilterExpr, bt as TPrimaryKeyChange, c as AggregateControls, cn as DbResponse, ct as TEnsureTableOptions, d as AggregateQuery, dn as TDbEncryptionOptions, dt as TExistingTableOption, en as TViewJoin, et as TDbWriteAction, f as AggregateResult, fn as DocumentFieldMapper, ft as TFieldMeta, g as DbPatch, gn as TGenericLogger, gt as TIdResolveOptions, h as DbControls, hn as NoopLogger, ht as TIdDescriptor, i as isJsonValueField, in as AtscriptDbTable, it as TDbWriteGuardContext, j as TDbActionInfo, jt as TWriteOptions, k as TCrudOp, kt as TValueFormatterPair, l as AggregateExpr, ln as resolveDesignType, lt as TExistingColumn, m as AtscriptDbWritable, mn as TReadControls, mt as TFkLookupTarget, n as TResolvedBucket, nn as isFieldRef, nt as TDbWriteCheckContext, o as normalizeComputedSelect, on as NativeIntegrity, ot as TDerivedChangeReason, pn as FieldMappingStrategy, pt as TFkLookupResolver, q as TDbObjectKind, qt as isAtscriptDbView, r as isBucketableField, rn as translateQueryTree, rt as TDbWriteGuard, s as resolveCalendarBuckets, sn as AtscriptDbReadable, st as TDerivedColumn, t as TBucketFieldSource, tn as TViewPlan, tt as TDbWriteCheck, u as AggregateFn, un as DbEncryption, ut as TExistingForeignKey, v as DbRow, vt as TMetaResponse, w as OwnPropsOf, wt as TSearchIndexInfo, x as FlatOf, xt as TReferencingForeignKey, y as FieldOpsFor, yt as TMetadataOverrides, z as TDbDeleteResult, zt as isGeoPointType } from "./buckets-DYFu0eZ8.cjs";
1
+ import { $ as TDbStorageType, $t as AtscriptExprNode, A as TCrudPermissions, An as TDbEncryptionOptions, At as TValueFormatterPair, B as TDbDeleteResult, Bt as isGeoPointType, C as NullableOptional, Cn as andFilters, Ct as TRelationInfo, D as TCascadeTarget, Dn as isResolvedRelationFilter, Dt as TTableOptionDiff, E as TCascadeResolver, En as hasRelationOp, Et as TSyncColumnResult, F as TDbActionTargetSummary, Fn as TGenericLogger, Ft as Uniquery, G as TDbIndexType, Gt as DbSpace, H as TDbForeignKey, Ht as ALL_VIEW_CAPABILITIES, I as TDbAvailableActions, In as UniquSelect, It as UniqueryControls, J as TDbObjectKind, Jt as AtscriptDbView, K as TDbInsertManyResult, Kt as TAdapterFactory, L as TDbCollation, Lt as WithRelation, M as TDbActionIntent, Mn as FieldMappingStrategy, Mt as TWriteOptions, N as TDbActionLevel, Nn as TReadControls, Nt as TWriteTableResolver, O as TColumnDiff, On as relationStaticFilter, Ot as TTableResolver, P as TDbActionProcessor, Pn as NoopLogger, Pt as TypedWithRelation, Q as TDbRemoveGuardContext, Qt as aliasTargetOf, R as TDbDefaultFn, Rt as TableMetadata, S as NavPropsOf, Sn as TRelationStaticFilter, St as TReferencingForeignKey, T as PrimaryKeyOf, Tn as forEachResolvedRelation, Tt as TSearchIndexInfo, U as TDbIndex, Ut as BaseDbAdapter, V as TDbFieldMeta, Vt as ALL_BUCKET_UNITS, W as TDbIndexField, Wt as TViewCapability, X as TDbRelation, Xt as isAtscriptDbView, Y as TDbReferentialAction, Yt as TViewColumnMapping, Z as TDbRemoveGuard, Zt as isViewType, _ as DbQuery, _n as REL_FILTER_MAX_NODES, _t as TIdResolveOptions, a as jsonValueAncestor, an as TViewJoin, at as TDbWriteGuardContext, b as FilterExpr, bn as TRelationFilterJunction, bt as TMetadataOverrides, c as AggregateControls, cn as translateQueryTree, ct as TDerivedColumn, d as AggregateQuery, dn as NativeIntegrity, dt as TExistingForeignKey, en as AtscriptOrderItem, et as TDbUpdateResult, f as AggregateResult, fn as TCascadePin, ft as TExistingTableOption, g as DbPatch, gn as REL_FILTER_MAX_DEPTH, gt as TIdDescriptor, h as DbControls, hn as resolveDesignType, ht as TFkLookupTarget, i as isJsonValueField, in as AtscriptRef, it as TDbWriteGuard, j as TDbActionInfo, jn as DocumentFieldMapper, jt as TViewJsonType, k as TCrudOp, kn as DbEncryption, kt as TTouchManyOptions, l as AggregateExpr, ln as AtscriptDbTable, lt as TEnsureTableOptions, m as AtscriptDbWritable, mn as DbResponse, mt as TFkLookupResolver, n as TResolvedBucket, nn as AtscriptQueryFieldRef, nt as TDbWriteCheck, o as normalizeComputedSelect, on as TViewPlan, ot as TDeleteOptions, pn as AtscriptDbReadable, pt as TFieldMeta, q as TDbInsertResult, qt as TDbSpaceOptions, r as isBucketableField, rn as AtscriptQueryNode, rt as TDbWriteCheckContext, s as resolveCalendarBuckets, sn as isFieldRef, st as TDerivedChangeReason, t as TBucketFieldSource, tn as AtscriptQueryComparison, tt as TDbWriteAction, u as AggregateFn, un as IntegrityStrategy, ut as TExistingColumn, v as DbRow, vn as ResolvedRelationFilter, vt as TIdentification, w as OwnPropsOf, wn as containsRelationFilter, wt as TRowResolveOptions, x as FlatOf, xn as TRelationFilterTable, xt as TPrimaryKeyChange, y as FieldOpsFor, yn as TRelGuardState, yt as TMetaResponse, z as TDbDefaultValue, zt as isGeoIndexableType } from "./buckets-CjdPipCC.cjs";
2
2
  import { _ as separateFieldOps, a as $mul, c as $update, d as TDbFieldOp, f as TFieldOps, g as separateCas, h as reconcileCas, i as $insert, l as $upsert, m as isDbFieldOp, n as $dec, o as $remove, p as getDbFieldOp, r as $inc, s as $replace, t as $cas, u as TDbCas } from "./ops-AqhV7s9o.cjs";
3
3
  import { a as isPlainObject, i as isEmptyObject, n as findAncestorInSet, o as selfOrAncestor, r as getPath, t as deletePath } from "./object-CtPYTIvy.cjs";
4
4
  import { c as CalendarBucketLabel, d as WeekStart, g as ALL_AGGREGATE_FNS, l as ComputedExpr, o as BucketExpr, s as BucketUnit, u as ResolvedBucket } from "./agg-CV7y8nC6.cjs";
5
- import { a as buildValidationContext, c as isNavRelation, d as getKeyProps, f as CasExhaustedError, g as bucketTimeZoneUnavailable, h as DbErrorCode, l as TArrayPatch, m as DbError, n as ValidatorMode, p as CasMismatchError, r as buildDbValidator, s as forceNavNonOptional, t as ValidationContext, u as TDbPatch } from "./validator-Bw6ks9Hy.cjs";
5
+ import { a as buildValidationContext, c as isNavRelation, d as getKeyProps, f as CasExhaustedError, g as bucketTimeZoneUnavailable, h as DbErrorCode, l as TArrayPatch, m as DbError, n as ValidatorMode, p as CasMismatchError, r as buildDbValidator, s as forceNavNonOptional, t as ValidationContext, u as TDbPatch } from "./validator-CMnTI6r7.cjs";
6
6
  import { n as createDbValidatorPlugin, t as DbValidationContext } from "./db-validator-plugin-BWy60OvG.cjs";
7
- import { n as isColumnTypeChanged } from "./column-diff-w-Mym_3w.cjs";
8
- import { i as tableNameOf } from "./relation-helpers-BOMm_HUI.cjs";
9
- import { AggregateQuery as AggregateQuery$1, FilterExpr as FilterExpr$1, FilterVisitor, ResolvedBucket as ResolvedBucket$1, Uniquery as Uniquery$1, computeInsights, isPrimitive, walkFilter } from "@uniqu/core";
7
+ import { r as fkColumns, s as isColumnTypeChanged } from "./fk-diff-DLqwVkKG.cjs";
8
+ import { i as tableNameOf } from "./relation-helpers-DH3LvwLV.cjs";
9
+ import { AggregateQuery as AggregateQuery$1, FilterExpr as FilterExpr$1, FilterVisitor, RELATION_OPS, RelationOp, RelationOp as RelationOp$1, ResolvedBucket as ResolvedBucket$1, Uniquery as Uniquery$1, computeInsights, isPrimitive, isRelationOp, walkFilter } from "@uniqu/core";
10
10
  import { TAtscriptAnnotatedType } from "@atscript/typescript/utils";
11
11
 
12
12
  //#region src/shared/consts.d.ts
@@ -30,14 +30,16 @@ declare class RelationalFieldMapper extends FieldMappingStrategy {
30
30
  /** The flattened column of a logical path (`contact.email` → `contact__email`). */
31
31
  protected physicalPath(logical: string, meta: TableMetadata): string;
32
32
  /**
33
- * Overrides the base `translateFilter` to use `leafByLogical` for key resolution
33
+ * Overrides the base `translateResolvedFilter` to use `leafByLogical` for key resolution
34
34
  * (handles flattened nested paths like `contact.email` → `contact__email`).
35
35
  */
36
- translateFilter(filter: FilterExpr$1, meta: TableMetadata): FilterExpr$1;
36
+ protected translateResolvedFilter(filter: FilterExpr$1, meta: TableMetadata): FilterExpr$1;
37
37
  /**
38
38
  * Translates filter with key renaming from logical to physical names.
39
39
  * Used by the relational query path where field paths must be mapped
40
- * to `__`-separated column names.
40
+ * to `__`-separated column names. Relational predicates must already be
41
+ * resolved (`translateFilter` / `translateQuery` do it); a resolved
42
+ * predicate passes through under its navigation-field key.
41
43
  */
42
44
  translateFilterWithRename(filter: FilterExpr$1, meta: TableMetadata): FilterExpr$1;
43
45
  prepareForWrite(payload: Record<string, unknown>, meta: TableMetadata, adapter: BaseDbAdapter): Record<string, unknown>;
@@ -83,8 +85,14 @@ declare class ApplicationIntegrity extends IntegrityStrategy {
83
85
  * - `restrict`: throws if any children exist
84
86
  * - `cascade`: recursively deletes child records
85
87
  * - `setNull`: sets FK fields to null
88
+ *
89
+ * When `filter` holds a relational predicate, returns the matched rows
90
+ * PINNED by primary key (see {@link TCascadePin}): the caller deletes those
91
+ * rows, never re-evaluating `filter` on data the cascade just changed (a
92
+ * `$some` over a cascaded child relation would otherwise stop matching and
93
+ * leave the parent behind). Any other filter → `undefined`.
86
94
  */
87
- cascadeBeforeDelete(filter: FilterExpr$1, tableName: string, meta: TableMetadata, cascadeResolver: TCascadeResolver, translateFilter: (f: FilterExpr$1) => FilterExpr$1, adapter: BaseDbAdapter): Promise<void>;
95
+ cascadeBeforeDelete(filter: FilterExpr$1, tableName: string, meta: TableMetadata, cascadeResolver: TCascadeResolver, translateFilter: (f: FilterExpr$1) => FilterExpr$1, adapter: BaseDbAdapter): Promise<TCascadePin>;
88
96
  needsCascade(cascadeResolver: TCascadeResolver | undefined): boolean;
89
97
  private recordKey;
90
98
  /**
@@ -119,6 +127,9 @@ declare class ApplicationIntegrity extends IntegrityStrategy {
119
127
  * {@link canFilterLeaf}) needs → `INVALID_QUERY` (see {@link guardPaths}).
120
128
  * Runs after the checks above so `ENC_*` codes keep firing first for
121
129
  * encrypted subtrees.
130
+ * - every filter / `$having` comparison value must be able to denote its
131
+ * field's declared type (`?n='x'` on a number) → `INVALID_QUERY`, after
132
+ * the path guard (see `guardFilterValues`, since 0.1.147).
122
133
  */
123
134
  /** Validates a `[lng, lat]` tuple (GeoJSON coordinate order). */
124
135
  declare function assertGeoPoint(point: unknown, path: string): asserts point is [number, number];
@@ -156,13 +167,23 @@ declare function sortFieldNames(sort: unknown): string[];
156
167
  * The operator class a filter entry needs from its field (since 0.1.132):
157
168
  * - `compare` — value comparison (bare values, `$eq`, `$gt`, `$in`, `$regex`, any mix);
158
169
  * - `geo` — a `$geoWithin` entry;
159
- * - `exists` — an entry whose sole operator is `$exists`.
170
+ * - `exists` — an entry whose sole operator is `$exists`;
171
+ * - `relation` — a relational predicate (`$some` / `$none` only) on a
172
+ * navigation field (since 0.1.147).
160
173
  */
161
- type TFilterPredicate = "compare" | "geo" | "exists";
174
+ type TFilterPredicate = "compare" | "geo" | "exists" | "relation";
162
175
  /** One filter entry, collected per occurrence: its key and the predicate class its operators need. */
163
176
  interface TFilterRef {
164
177
  path: string;
165
178
  predicate: TFilterPredicate;
179
+ /**
180
+ * `relation` entries: each operator with its operand (a filter on the
181
+ * related table, not walked here). @since 0.1.147
182
+ */
183
+ relation?: Array<{
184
+ op: RelationOp$1;
185
+ filter: FilterExpr$1;
186
+ }>;
166
187
  }
167
188
  /**
168
189
  * The reason clause for a leaf the adapter cannot filter (value comparison).
@@ -357,16 +378,20 @@ declare function guardPath(meta: TableMetadata, adapter: BaseDbAdapter, path: st
357
378
  * `bucket`), `$groupBy` fields are checked, and computed aliases (`$as` or
358
379
  * the default) are exempt in `$sort` / `$having`.
359
380
  *
381
+ * Then every filter comparison value must be able to denote its field's
382
+ * declared type (`guardFilterValues`, since 0.1.147) — after the paths, so
383
+ * an unknown or unfilterable field keeps its own rejection.
384
+ *
360
385
  * Returns the collected refs so callers can run further structural rules
361
386
  * (see {@link checkHavingKeys}) without walking the query again.
362
387
  */
363
- declare function guardPaths(meta: TableMetadata, adapter: BaseDbAdapter, query: TGuardedQuery | undefined, aggregate?: boolean): TQueryPathRefs | undefined;
388
+ declare function guardPaths(meta: TableMetadata, adapter: BaseDbAdapter, query: TGuardedQuery | undefined, aggregate?: boolean, state?: TRelGuardState): TQueryPathRefs | undefined;
364
389
  /**
365
390
  * Shared read-path guard: filter + $sort encryption checks, the `$select`
366
391
  * normalizer (a calendar bucket is invalid outside a grouped query), then
367
392
  * the path guard.
368
393
  */
369
- declare function guardQuery(meta: TableMetadata, adapter: BaseDbAdapter, query: TGuardedQuery | undefined): void;
394
+ declare function guardQuery(meta: TableMetadata, adapter: BaseDbAdapter, query: TGuardedQuery | undefined, state?: TRelGuardState): void;
370
395
  /**
371
396
  * `$having` is a post-aggregation filter, so a key is either a computed
372
397
  * alias (aggregate or calendar bucket — already exempt in
@@ -387,7 +412,7 @@ declare function checkHavingKeys(refs: TQueryPathRefs): {
387
412
  * (`AGG_FN_NOT_SUPPORTED`) and calendar-bucket units
388
413
  * (`BUCKET_NOT_SUPPORTED`), then the `$having` key rule
389
414
  * ({@link checkHavingKeys} — after the path guard so an unknown key still
390
- * reads `Unknown field`).
415
+ * reads `Unknown field`), then the `$having` values (`guardHavingValues`).
391
416
  *
392
417
  * `buckets` are the query's resolved calendar buckets when the caller already
393
418
  * ran `normalizeComputedSelect` (resolved here otherwise).
@@ -531,4 +556,4 @@ declare function createFailureCollector(what: string): {
531
556
  throwIfAny: () => void;
532
557
  };
533
558
  //#endregion
534
- export { $cas, $dec, $inc, $insert, $mul, $remove, $replace, $update, $upsert, ADAPTER_FILTER_REASON, ALL_AGGREGATE_FNS, ALL_BUCKET_UNITS, type AggregateControls, type AggregateExpr, type AggregateFn, type AggregateQuery, type AggregateResult, ApplicationIntegrity, AtscriptDbReadable, AtscriptDbTable, AtscriptDbView, type AtscriptDbWritable, type AtscriptQueryComparison, type AtscriptQueryFieldRef, type AtscriptQueryNode, type AtscriptRef, BaseDbAdapter, type BucketExpr, type BucketUnit, type CalendarBucketLabel, CasExhaustedError, CasMismatchError, type ComputedExpr, DEFAULT_DB_SPACE, type DbControls, DbEncryption, DbError, type DbErrorCode, type DbPatch, type DbQuery, type DbResponse, type DbRow, DbSpace, type DbValidationContext, DocumentFieldMapper, ENCRYPTED_REASON, FieldMappingStrategy, type FieldOpsFor, type FilterExpr, type FilterVisitor, type FlatOf, IntegrityStrategy, NativeIntegrity, type NavPropsOf, NoopLogger, type NullableOptional, type OwnPropsOf, type PrimaryKeyOf, RelationalFieldMapper, type ResolvedBucket, type TAdapterFactory, type TArrayPatch, type TBucketFieldSource, type TBucketSourceTable, type TBucketSourceVerdict, type TCascadeResolver, type TCascadeTarget, type TColumnDiff, type TCrudOp, type TCrudPermissions, type TDbActionInfo, type TDbActionIntent, type TDbActionLevel, type TDbActionProcessor, type TDbAvailableActions, type TDbCas, type TDbCollation, type TDbDefaultFn, type TDbDefaultValue, type TDbDeleteResult, type TDbEncryptionOptions, type TDbFieldMeta, type TDbFieldOp, type TDbForeignKey, type TDbIndex, type TDbIndexField, type TDbIndexType, type TDbInsertManyResult, type TDbInsertResult, type TDbObjectKind, type TDbPatch, type TDbReferentialAction, type TDbRelation, type TDbRemoveGuard, type TDbRemoveGuardContext, type TDbSpaceOptions, type TDbStorageType, type TDbUpdateResult, type TDbWriteAction, type TDbWriteCheck, type TDbWriteCheckContext, type TDbWriteGuard, type TDbWriteGuardContext, type TDeleteOptions, type TDerivedChangeReason, type TDerivedColumn, type TEnsureTableOptions, type TExistingColumn, type TExistingForeignKey, type TExistingTableOption, type TFieldMeta, type TFieldOps, type TFilterPredicate, type TFilterRef, type TFkLookupResolver, type TFkLookupTarget, type TGenericLogger, type TGuardedQuery, type TIdDescriptor, type TIdResolveOptions, type TIdentification, type TMetaResponse, type TMetadataOverrides, type TPrimaryKeyChange, type TQueryPathKind, type TQueryPathOp, type TQueryPathRefs, type TQueryPathSource, type TReadControls, type TReferencingForeignKey, type TRelationInfo, type TResolvedBucket, type TRowResolveOptions, type TSearchIndexInfo, type TSyncColumnResult, type TTableOptionDiff, type TTableResolver, type TTouchManyOptions, type TValueFormatterPair, type TViewColumnMapping, type TViewJoin, type TViewJsonType, type TViewPlan, type TWriteOptions, type TWriteTableResolver, TableMetadata, type TypedWithRelation, UniquSelect, type Uniquery, type UniqueryControls, type ValidationContext, type ValidatorMode, type WeekStart, type WithOptimisticRetryOptions, type WithRelation, acceptedOperatorsHint, aliasTargetOf, assertGeoPoint, assertNoVersionWrites, bucketSourceVerdict, bucketTimeZoneUnavailable, buildDbValidator, buildValidationContext, canFilterLeaf, checkHavingKeys, classifyQueryPath, collectQueryPaths, computeInsights, createDbValidatorPlugin, createFailureCollector, decomposePatch, deletePath, findAncestorInSet, forceNavNonOptional, geoIndexNotFoundMessage, getDbFieldOp, getKeyProps, getPath, guardAggregate, guardFilter, guardPath, guardPaths, guardQuery, isAtscriptDbView, isBucketableField, isColumnTypeChanged, isDbEntityType, isDbFieldOp, isEmptyObject, isFieldRef, isGeoIndexableType, isGeoPointType, isJsonValueField, isNavRelation, isPlainObject, isPrimitive, isViewType, jsonValueAncestor, narrowerFilterOps, normalizeComputedSelect, reconcileCas, resolveCalendarBuckets, resolveDesignType, searchIndexNotFoundMessage, selfOrAncestor, separateCas, separateFieldOps, sortFieldNames, tableNameOf, translateQueryTree, unsupportedOperatorMessage, vectorIndexNotFoundMessage, walkFilter, withOptimisticRetry };
559
+ export { $cas, $dec, $inc, $insert, $mul, $remove, $replace, $update, $upsert, ADAPTER_FILTER_REASON, ALL_AGGREGATE_FNS, ALL_BUCKET_UNITS, ALL_VIEW_CAPABILITIES, type AggregateControls, type AggregateExpr, type AggregateFn, type AggregateQuery, type AggregateResult, ApplicationIntegrity, AtscriptDbReadable, AtscriptDbTable, AtscriptDbView, type AtscriptDbWritable, type AtscriptExprNode, type AtscriptOrderItem, type AtscriptQueryComparison, type AtscriptQueryFieldRef, type AtscriptQueryNode, type AtscriptRef, BaseDbAdapter, type BucketExpr, type BucketUnit, type CalendarBucketLabel, CasExhaustedError, CasMismatchError, type ComputedExpr, DEFAULT_DB_SPACE, type DbControls, DbEncryption, DbError, type DbErrorCode, type DbPatch, type DbQuery, type DbResponse, type DbRow, DbSpace, type DbValidationContext, DocumentFieldMapper, ENCRYPTED_REASON, FieldMappingStrategy, type FieldOpsFor, type FilterExpr, type FilterVisitor, type FlatOf, IntegrityStrategy, NativeIntegrity, type NavPropsOf, NoopLogger, type NullableOptional, type OwnPropsOf, type PrimaryKeyOf, RELATION_OPS, REL_FILTER_MAX_DEPTH, REL_FILTER_MAX_NODES, type RelationOp, RelationalFieldMapper, type ResolvedBucket, ResolvedRelationFilter, type TAdapterFactory, type TArrayPatch, type TBucketFieldSource, type TBucketSourceTable, type TBucketSourceVerdict, type TCascadeResolver, type TCascadeTarget, type TColumnDiff, type TCrudOp, type TCrudPermissions, type TDbActionInfo, type TDbActionIntent, type TDbActionLevel, type TDbActionProcessor, type TDbActionTargetSummary, type TDbAvailableActions, type TDbCas, type TDbCollation, type TDbDefaultFn, type TDbDefaultValue, type TDbDeleteResult, type TDbEncryptionOptions, type TDbFieldMeta, type TDbFieldOp, type TDbForeignKey, type TDbIndex, type TDbIndexField, type TDbIndexType, type TDbInsertManyResult, type TDbInsertResult, type TDbObjectKind, type TDbPatch, type TDbReferentialAction, type TDbRelation, type TDbRemoveGuard, type TDbRemoveGuardContext, type TDbSpaceOptions, type TDbStorageType, type TDbUpdateResult, type TDbWriteAction, type TDbWriteCheck, type TDbWriteCheckContext, type TDbWriteGuard, type TDbWriteGuardContext, type TDeleteOptions, type TDerivedChangeReason, type TDerivedColumn, type TEnsureTableOptions, type TExistingColumn, type TExistingForeignKey, type TExistingTableOption, type TFieldMeta, type TFieldOps, type TFilterPredicate, type TFilterRef, type TFkLookupResolver, type TFkLookupTarget, type TGenericLogger, type TGuardedQuery, type TIdDescriptor, type TIdResolveOptions, type TIdentification, type TMetaResponse, type TMetadataOverrides, type TPrimaryKeyChange, type TQueryPathKind, type TQueryPathOp, type TQueryPathRefs, type TQueryPathSource, type TReadControls, type TReferencingForeignKey, type TRelationFilterJunction, type TRelationFilterTable, type TRelationInfo, type TRelationStaticFilter, type TResolvedBucket, type TRowResolveOptions, type TSearchIndexInfo, type TSyncColumnResult, type TTableOptionDiff, type TTableResolver, type TTouchManyOptions, type TValueFormatterPair, type TViewCapability, type TViewColumnMapping, type TViewJoin, type TViewJsonType, type TViewPlan, type TWriteOptions, type TWriteTableResolver, TableMetadata, type TypedWithRelation, UniquSelect, type Uniquery, type UniqueryControls, type ValidationContext, type ValidatorMode, type WeekStart, type WithOptimisticRetryOptions, type WithRelation, acceptedOperatorsHint, aliasTargetOf, andFilters, assertGeoPoint, assertNoVersionWrites, bucketSourceVerdict, bucketTimeZoneUnavailable, buildDbValidator, buildValidationContext, canFilterLeaf, checkHavingKeys, classifyQueryPath, collectQueryPaths, computeInsights, containsRelationFilter, createDbValidatorPlugin, createFailureCollector, decomposePatch, deletePath, findAncestorInSet, fkColumns, forEachResolvedRelation, forceNavNonOptional, geoIndexNotFoundMessage, getDbFieldOp, getKeyProps, getPath, guardAggregate, guardFilter, guardPath, guardPaths, guardQuery, hasRelationOp, isAtscriptDbView, isBucketableField, isColumnTypeChanged, isDbEntityType, isDbFieldOp, isEmptyObject, isFieldRef, isGeoIndexableType, isGeoPointType, isJsonValueField, isNavRelation, isPlainObject, isPrimitive, isRelationOp, isResolvedRelationFilter, isViewType, jsonValueAncestor, narrowerFilterOps, normalizeComputedSelect, reconcileCas, relationStaticFilter, resolveCalendarBuckets, resolveDesignType, searchIndexNotFoundMessage, selfOrAncestor, separateCas, separateFieldOps, sortFieldNames, tableNameOf, translateQueryTree, unsupportedOperatorMessage, vectorIndexNotFoundMessage, walkFilter, withOptimisticRetry };
package/dist/index.d.mts CHANGED
@@ -1,13 +1,13 @@
1
- import { $ as TDbUpdateResult, $t as AtscriptRef, A as TCrudPermissions, At as TViewJsonType, B as TDbFieldMeta, Bt as ALL_BUCKET_UNITS, C as NullableOptional, Ct as TRowResolveOptions, D as TCascadeTarget, Dt as TTableResolver, E as TCascadeResolver, Et as TTableOptionDiff, F as TDbAvailableActions, Ft as UniqueryControls, G as TDbInsertManyResult, Gt as AtscriptDbView, H as TDbIndex, Ht as DbSpace, I as TDbCollation, It as WithRelation, J as TDbReferentialAction, Jt as isViewType, K as TDbInsertResult, Kt as TViewColumnMapping, L as TDbDefaultFn, Lt as TableMetadata, M as TDbActionIntent, Mt as TWriteTableResolver, N as TDbActionLevel, Nt as TypedWithRelation, O as TColumnDiff, Ot as TTouchManyOptions, P as TDbActionProcessor, Pt as Uniquery, Q as TDbStorageType, Qt as AtscriptQueryNode, R as TDbDefaultValue, Rt as isGeoIndexableType, S as NavPropsOf, St as TRelationInfo, T as PrimaryKeyOf, Tt as TSyncColumnResult, U as TDbIndexField, Ut as TAdapterFactory, V as TDbForeignKey, Vt as BaseDbAdapter, W as TDbIndexType, Wt as TDbSpaceOptions, X as TDbRemoveGuard, Xt as AtscriptQueryComparison, Y as TDbRelation, Yt as aliasTargetOf, Z as TDbRemoveGuardContext, Zt as AtscriptQueryFieldRef, _ as DbQuery, _n as UniquSelect, _t as TIdentification, a as jsonValueAncestor, an as IntegrityStrategy, at as TDeleteOptions, b as FilterExpr, bt as TPrimaryKeyChange, c as AggregateControls, cn as DbResponse, ct as TEnsureTableOptions, d as AggregateQuery, dn as TDbEncryptionOptions, dt as TExistingTableOption, en as TViewJoin, et as TDbWriteAction, f as AggregateResult, fn as DocumentFieldMapper, ft as TFieldMeta, g as DbPatch, gn as TGenericLogger, gt as TIdResolveOptions, h as DbControls, hn as NoopLogger, ht as TIdDescriptor, i as isJsonValueField, in as AtscriptDbTable, it as TDbWriteGuardContext, j as TDbActionInfo, jt as TWriteOptions, k as TCrudOp, kt as TValueFormatterPair, l as AggregateExpr, ln as resolveDesignType, lt as TExistingColumn, m as AtscriptDbWritable, mn as TReadControls, mt as TFkLookupTarget, n as TResolvedBucket, nn as isFieldRef, nt as TDbWriteCheckContext, o as normalizeComputedSelect, on as NativeIntegrity, ot as TDerivedChangeReason, pn as FieldMappingStrategy, pt as TFkLookupResolver, q as TDbObjectKind, qt as isAtscriptDbView, r as isBucketableField, rn as translateQueryTree, rt as TDbWriteGuard, s as resolveCalendarBuckets, sn as AtscriptDbReadable, st as TDerivedColumn, t as TBucketFieldSource, tn as TViewPlan, tt as TDbWriteCheck, u as AggregateFn, un as DbEncryption, ut as TExistingForeignKey, v as DbRow, vt as TMetaResponse, w as OwnPropsOf, wt as TSearchIndexInfo, x as FlatOf, xt as TReferencingForeignKey, y as FieldOpsFor, yt as TMetadataOverrides, z as TDbDeleteResult, zt as isGeoPointType } from "./buckets-DRycmhOW.mjs";
1
+ import { $ as TDbStorageType, $t as AtscriptExprNode, A as TCrudPermissions, An as TDbEncryptionOptions, At as TValueFormatterPair, B as TDbDeleteResult, Bt as isGeoPointType, C as NullableOptional, Cn as andFilters, Ct as TRelationInfo, D as TCascadeTarget, Dn as isResolvedRelationFilter, Dt as TTableOptionDiff, E as TCascadeResolver, En as hasRelationOp, Et as TSyncColumnResult, F as TDbActionTargetSummary, Fn as TGenericLogger, Ft as Uniquery, G as TDbIndexType, Gt as DbSpace, H as TDbForeignKey, Ht as ALL_VIEW_CAPABILITIES, I as TDbAvailableActions, In as UniquSelect, It as UniqueryControls, J as TDbObjectKind, Jt as AtscriptDbView, K as TDbInsertManyResult, Kt as TAdapterFactory, L as TDbCollation, Lt as WithRelation, M as TDbActionIntent, Mn as FieldMappingStrategy, Mt as TWriteOptions, N as TDbActionLevel, Nn as TReadControls, Nt as TWriteTableResolver, O as TColumnDiff, On as relationStaticFilter, Ot as TTableResolver, P as TDbActionProcessor, Pn as NoopLogger, Pt as TypedWithRelation, Q as TDbRemoveGuardContext, Qt as aliasTargetOf, R as TDbDefaultFn, Rt as TableMetadata, S as NavPropsOf, Sn as TRelationStaticFilter, St as TReferencingForeignKey, T as PrimaryKeyOf, Tn as forEachResolvedRelation, Tt as TSearchIndexInfo, U as TDbIndex, Ut as BaseDbAdapter, V as TDbFieldMeta, Vt as ALL_BUCKET_UNITS, W as TDbIndexField, Wt as TViewCapability, X as TDbRelation, Xt as isAtscriptDbView, Y as TDbReferentialAction, Yt as TViewColumnMapping, Z as TDbRemoveGuard, Zt as isViewType, _ as DbQuery, _n as REL_FILTER_MAX_NODES, _t as TIdResolveOptions, a as jsonValueAncestor, an as TViewJoin, at as TDbWriteGuardContext, b as FilterExpr, bn as TRelationFilterJunction, bt as TMetadataOverrides, c as AggregateControls, cn as translateQueryTree, ct as TDerivedColumn, d as AggregateQuery, dn as NativeIntegrity, dt as TExistingForeignKey, en as AtscriptOrderItem, et as TDbUpdateResult, f as AggregateResult, fn as TCascadePin, ft as TExistingTableOption, g as DbPatch, gn as REL_FILTER_MAX_DEPTH, gt as TIdDescriptor, h as DbControls, hn as resolveDesignType, ht as TFkLookupTarget, i as isJsonValueField, in as AtscriptRef, it as TDbWriteGuard, j as TDbActionInfo, jn as DocumentFieldMapper, jt as TViewJsonType, k as TCrudOp, kn as DbEncryption, kt as TTouchManyOptions, l as AggregateExpr, ln as AtscriptDbTable, lt as TEnsureTableOptions, m as AtscriptDbWritable, mn as DbResponse, mt as TFkLookupResolver, n as TResolvedBucket, nn as AtscriptQueryFieldRef, nt as TDbWriteCheck, o as normalizeComputedSelect, on as TViewPlan, ot as TDeleteOptions, pn as AtscriptDbReadable, pt as TFieldMeta, q as TDbInsertResult, qt as TDbSpaceOptions, r as isBucketableField, rn as AtscriptQueryNode, rt as TDbWriteCheckContext, s as resolveCalendarBuckets, sn as isFieldRef, st as TDerivedChangeReason, t as TBucketFieldSource, tn as AtscriptQueryComparison, tt as TDbWriteAction, u as AggregateFn, un as IntegrityStrategy, ut as TExistingColumn, v as DbRow, vn as ResolvedRelationFilter, vt as TIdentification, w as OwnPropsOf, wn as containsRelationFilter, wt as TRowResolveOptions, x as FlatOf, xn as TRelationFilterTable, xt as TPrimaryKeyChange, y as FieldOpsFor, yn as TRelGuardState, yt as TMetaResponse, z as TDbDefaultValue, zt as isGeoIndexableType } from "./buckets-DYopfd2Y.mjs";
2
2
  import { _ as separateFieldOps, a as $mul, c as $update, d as TDbFieldOp, f as TFieldOps, g as separateCas, h as reconcileCas, i as $insert, l as $upsert, m as isDbFieldOp, n as $dec, o as $remove, p as getDbFieldOp, r as $inc, s as $replace, t as $cas, u as TDbCas } from "./ops-AqhV7s9o.mjs";
3
3
  import { a as isPlainObject, i as isEmptyObject, n as findAncestorInSet, o as selfOrAncestor, r as getPath, t as deletePath } from "./object-CtPYTIvy.mjs";
4
4
  import { c as CalendarBucketLabel, d as WeekStart, g as ALL_AGGREGATE_FNS, l as ComputedExpr, o as BucketExpr, s as BucketUnit, u as ResolvedBucket } from "./agg-D5DHsAby.mjs";
5
- import { a as buildValidationContext, c as isNavRelation, d as getKeyProps, f as CasExhaustedError, g as bucketTimeZoneUnavailable, h as DbErrorCode, l as TArrayPatch, m as DbError, n as ValidatorMode, p as CasMismatchError, r as buildDbValidator, s as forceNavNonOptional, t as ValidationContext, u as TDbPatch } from "./validator-Bw6ks9Hy.mjs";
5
+ import { a as buildValidationContext, c as isNavRelation, d as getKeyProps, f as CasExhaustedError, g as bucketTimeZoneUnavailable, h as DbErrorCode, l as TArrayPatch, m as DbError, n as ValidatorMode, p as CasMismatchError, r as buildDbValidator, s as forceNavNonOptional, t as ValidationContext, u as TDbPatch } from "./validator-CMnTI6r7.mjs";
6
6
  import { n as createDbValidatorPlugin, t as DbValidationContext } from "./db-validator-plugin-BWy60OvG.mjs";
7
- import { n as isColumnTypeChanged } from "./column-diff-Q9UmWn5x.mjs";
8
- import { i as tableNameOf } from "./relation-helpers-B-0NRKat.mjs";
7
+ import { r as fkColumns, s as isColumnTypeChanged } from "./fk-diff-BtOmL4OW.mjs";
8
+ import { i as tableNameOf } from "./relation-helpers-C2bLtE-t.mjs";
9
9
  import { TAtscriptAnnotatedType } from "@atscript/typescript/utils";
10
- import { AggregateQuery as AggregateQuery$1, FilterExpr as FilterExpr$1, FilterVisitor, ResolvedBucket as ResolvedBucket$1, Uniquery as Uniquery$1, computeInsights, isPrimitive, walkFilter } from "@uniqu/core";
10
+ import { AggregateQuery as AggregateQuery$1, FilterExpr as FilterExpr$1, FilterVisitor, RELATION_OPS, RelationOp, RelationOp as RelationOp$1, ResolvedBucket as ResolvedBucket$1, Uniquery as Uniquery$1, computeInsights, isPrimitive, isRelationOp, walkFilter } from "@uniqu/core";
11
11
 
12
12
  //#region src/shared/consts.d.ts
13
13
  /**
@@ -30,14 +30,16 @@ declare class RelationalFieldMapper extends FieldMappingStrategy {
30
30
  /** The flattened column of a logical path (`contact.email` → `contact__email`). */
31
31
  protected physicalPath(logical: string, meta: TableMetadata): string;
32
32
  /**
33
- * Overrides the base `translateFilter` to use `leafByLogical` for key resolution
33
+ * Overrides the base `translateResolvedFilter` to use `leafByLogical` for key resolution
34
34
  * (handles flattened nested paths like `contact.email` → `contact__email`).
35
35
  */
36
- translateFilter(filter: FilterExpr$1, meta: TableMetadata): FilterExpr$1;
36
+ protected translateResolvedFilter(filter: FilterExpr$1, meta: TableMetadata): FilterExpr$1;
37
37
  /**
38
38
  * Translates filter with key renaming from logical to physical names.
39
39
  * Used by the relational query path where field paths must be mapped
40
- * to `__`-separated column names.
40
+ * to `__`-separated column names. Relational predicates must already be
41
+ * resolved (`translateFilter` / `translateQuery` do it); a resolved
42
+ * predicate passes through under its navigation-field key.
41
43
  */
42
44
  translateFilterWithRename(filter: FilterExpr$1, meta: TableMetadata): FilterExpr$1;
43
45
  prepareForWrite(payload: Record<string, unknown>, meta: TableMetadata, adapter: BaseDbAdapter): Record<string, unknown>;
@@ -83,8 +85,14 @@ declare class ApplicationIntegrity extends IntegrityStrategy {
83
85
  * - `restrict`: throws if any children exist
84
86
  * - `cascade`: recursively deletes child records
85
87
  * - `setNull`: sets FK fields to null
88
+ *
89
+ * When `filter` holds a relational predicate, returns the matched rows
90
+ * PINNED by primary key (see {@link TCascadePin}): the caller deletes those
91
+ * rows, never re-evaluating `filter` on data the cascade just changed (a
92
+ * `$some` over a cascaded child relation would otherwise stop matching and
93
+ * leave the parent behind). Any other filter → `undefined`.
86
94
  */
87
- cascadeBeforeDelete(filter: FilterExpr$1, tableName: string, meta: TableMetadata, cascadeResolver: TCascadeResolver, translateFilter: (f: FilterExpr$1) => FilterExpr$1, adapter: BaseDbAdapter): Promise<void>;
95
+ cascadeBeforeDelete(filter: FilterExpr$1, tableName: string, meta: TableMetadata, cascadeResolver: TCascadeResolver, translateFilter: (f: FilterExpr$1) => FilterExpr$1, adapter: BaseDbAdapter): Promise<TCascadePin>;
88
96
  needsCascade(cascadeResolver: TCascadeResolver | undefined): boolean;
89
97
  private recordKey;
90
98
  /**
@@ -119,6 +127,9 @@ declare class ApplicationIntegrity extends IntegrityStrategy {
119
127
  * {@link canFilterLeaf}) needs → `INVALID_QUERY` (see {@link guardPaths}).
120
128
  * Runs after the checks above so `ENC_*` codes keep firing first for
121
129
  * encrypted subtrees.
130
+ * - every filter / `$having` comparison value must be able to denote its
131
+ * field's declared type (`?n='x'` on a number) → `INVALID_QUERY`, after
132
+ * the path guard (see `guardFilterValues`, since 0.1.147).
122
133
  */
123
134
  /** Validates a `[lng, lat]` tuple (GeoJSON coordinate order). */
124
135
  declare function assertGeoPoint(point: unknown, path: string): asserts point is [number, number];
@@ -156,13 +167,23 @@ declare function sortFieldNames(sort: unknown): string[];
156
167
  * The operator class a filter entry needs from its field (since 0.1.132):
157
168
  * - `compare` — value comparison (bare values, `$eq`, `$gt`, `$in`, `$regex`, any mix);
158
169
  * - `geo` — a `$geoWithin` entry;
159
- * - `exists` — an entry whose sole operator is `$exists`.
170
+ * - `exists` — an entry whose sole operator is `$exists`;
171
+ * - `relation` — a relational predicate (`$some` / `$none` only) on a
172
+ * navigation field (since 0.1.147).
160
173
  */
161
- type TFilterPredicate = "compare" | "geo" | "exists";
174
+ type TFilterPredicate = "compare" | "geo" | "exists" | "relation";
162
175
  /** One filter entry, collected per occurrence: its key and the predicate class its operators need. */
163
176
  interface TFilterRef {
164
177
  path: string;
165
178
  predicate: TFilterPredicate;
179
+ /**
180
+ * `relation` entries: each operator with its operand (a filter on the
181
+ * related table, not walked here). @since 0.1.147
182
+ */
183
+ relation?: Array<{
184
+ op: RelationOp$1;
185
+ filter: FilterExpr$1;
186
+ }>;
166
187
  }
167
188
  /**
168
189
  * The reason clause for a leaf the adapter cannot filter (value comparison).
@@ -357,16 +378,20 @@ declare function guardPath(meta: TableMetadata, adapter: BaseDbAdapter, path: st
357
378
  * `bucket`), `$groupBy` fields are checked, and computed aliases (`$as` or
358
379
  * the default) are exempt in `$sort` / `$having`.
359
380
  *
381
+ * Then every filter comparison value must be able to denote its field's
382
+ * declared type (`guardFilterValues`, since 0.1.147) — after the paths, so
383
+ * an unknown or unfilterable field keeps its own rejection.
384
+ *
360
385
  * Returns the collected refs so callers can run further structural rules
361
386
  * (see {@link checkHavingKeys}) without walking the query again.
362
387
  */
363
- declare function guardPaths(meta: TableMetadata, adapter: BaseDbAdapter, query: TGuardedQuery | undefined, aggregate?: boolean): TQueryPathRefs | undefined;
388
+ declare function guardPaths(meta: TableMetadata, adapter: BaseDbAdapter, query: TGuardedQuery | undefined, aggregate?: boolean, state?: TRelGuardState): TQueryPathRefs | undefined;
364
389
  /**
365
390
  * Shared read-path guard: filter + $sort encryption checks, the `$select`
366
391
  * normalizer (a calendar bucket is invalid outside a grouped query), then
367
392
  * the path guard.
368
393
  */
369
- declare function guardQuery(meta: TableMetadata, adapter: BaseDbAdapter, query: TGuardedQuery | undefined): void;
394
+ declare function guardQuery(meta: TableMetadata, adapter: BaseDbAdapter, query: TGuardedQuery | undefined, state?: TRelGuardState): void;
370
395
  /**
371
396
  * `$having` is a post-aggregation filter, so a key is either a computed
372
397
  * alias (aggregate or calendar bucket — already exempt in
@@ -387,7 +412,7 @@ declare function checkHavingKeys(refs: TQueryPathRefs): {
387
412
  * (`AGG_FN_NOT_SUPPORTED`) and calendar-bucket units
388
413
  * (`BUCKET_NOT_SUPPORTED`), then the `$having` key rule
389
414
  * ({@link checkHavingKeys} — after the path guard so an unknown key still
390
- * reads `Unknown field`).
415
+ * reads `Unknown field`), then the `$having` values (`guardHavingValues`).
391
416
  *
392
417
  * `buckets` are the query's resolved calendar buckets when the caller already
393
418
  * ran `normalizeComputedSelect` (resolved here otherwise).
@@ -531,4 +556,4 @@ declare function createFailureCollector(what: string): {
531
556
  throwIfAny: () => void;
532
557
  };
533
558
  //#endregion
534
- export { $cas, $dec, $inc, $insert, $mul, $remove, $replace, $update, $upsert, ADAPTER_FILTER_REASON, ALL_AGGREGATE_FNS, ALL_BUCKET_UNITS, type AggregateControls, type AggregateExpr, type AggregateFn, type AggregateQuery, type AggregateResult, ApplicationIntegrity, AtscriptDbReadable, AtscriptDbTable, AtscriptDbView, type AtscriptDbWritable, type AtscriptQueryComparison, type AtscriptQueryFieldRef, type AtscriptQueryNode, type AtscriptRef, BaseDbAdapter, type BucketExpr, type BucketUnit, type CalendarBucketLabel, CasExhaustedError, CasMismatchError, type ComputedExpr, DEFAULT_DB_SPACE, type DbControls, DbEncryption, DbError, type DbErrorCode, type DbPatch, type DbQuery, type DbResponse, type DbRow, DbSpace, type DbValidationContext, DocumentFieldMapper, ENCRYPTED_REASON, FieldMappingStrategy, type FieldOpsFor, type FilterExpr, type FilterVisitor, type FlatOf, IntegrityStrategy, NativeIntegrity, type NavPropsOf, NoopLogger, type NullableOptional, type OwnPropsOf, type PrimaryKeyOf, RelationalFieldMapper, type ResolvedBucket, type TAdapterFactory, type TArrayPatch, type TBucketFieldSource, type TBucketSourceTable, type TBucketSourceVerdict, type TCascadeResolver, type TCascadeTarget, type TColumnDiff, type TCrudOp, type TCrudPermissions, type TDbActionInfo, type TDbActionIntent, type TDbActionLevel, type TDbActionProcessor, type TDbAvailableActions, type TDbCas, type TDbCollation, type TDbDefaultFn, type TDbDefaultValue, type TDbDeleteResult, type TDbEncryptionOptions, type TDbFieldMeta, type TDbFieldOp, type TDbForeignKey, type TDbIndex, type TDbIndexField, type TDbIndexType, type TDbInsertManyResult, type TDbInsertResult, type TDbObjectKind, type TDbPatch, type TDbReferentialAction, type TDbRelation, type TDbRemoveGuard, type TDbRemoveGuardContext, type TDbSpaceOptions, type TDbStorageType, type TDbUpdateResult, type TDbWriteAction, type TDbWriteCheck, type TDbWriteCheckContext, type TDbWriteGuard, type TDbWriteGuardContext, type TDeleteOptions, type TDerivedChangeReason, type TDerivedColumn, type TEnsureTableOptions, type TExistingColumn, type TExistingForeignKey, type TExistingTableOption, type TFieldMeta, type TFieldOps, type TFilterPredicate, type TFilterRef, type TFkLookupResolver, type TFkLookupTarget, type TGenericLogger, type TGuardedQuery, type TIdDescriptor, type TIdResolveOptions, type TIdentification, type TMetaResponse, type TMetadataOverrides, type TPrimaryKeyChange, type TQueryPathKind, type TQueryPathOp, type TQueryPathRefs, type TQueryPathSource, type TReadControls, type TReferencingForeignKey, type TRelationInfo, type TResolvedBucket, type TRowResolveOptions, type TSearchIndexInfo, type TSyncColumnResult, type TTableOptionDiff, type TTableResolver, type TTouchManyOptions, type TValueFormatterPair, type TViewColumnMapping, type TViewJoin, type TViewJsonType, type TViewPlan, type TWriteOptions, type TWriteTableResolver, TableMetadata, type TypedWithRelation, UniquSelect, type Uniquery, type UniqueryControls, type ValidationContext, type ValidatorMode, type WeekStart, type WithOptimisticRetryOptions, type WithRelation, acceptedOperatorsHint, aliasTargetOf, assertGeoPoint, assertNoVersionWrites, bucketSourceVerdict, bucketTimeZoneUnavailable, buildDbValidator, buildValidationContext, canFilterLeaf, checkHavingKeys, classifyQueryPath, collectQueryPaths, computeInsights, createDbValidatorPlugin, createFailureCollector, decomposePatch, deletePath, findAncestorInSet, forceNavNonOptional, geoIndexNotFoundMessage, getDbFieldOp, getKeyProps, getPath, guardAggregate, guardFilter, guardPath, guardPaths, guardQuery, isAtscriptDbView, isBucketableField, isColumnTypeChanged, isDbEntityType, isDbFieldOp, isEmptyObject, isFieldRef, isGeoIndexableType, isGeoPointType, isJsonValueField, isNavRelation, isPlainObject, isPrimitive, isViewType, jsonValueAncestor, narrowerFilterOps, normalizeComputedSelect, reconcileCas, resolveCalendarBuckets, resolveDesignType, searchIndexNotFoundMessage, selfOrAncestor, separateCas, separateFieldOps, sortFieldNames, tableNameOf, translateQueryTree, unsupportedOperatorMessage, vectorIndexNotFoundMessage, walkFilter, withOptimisticRetry };
559
+ export { $cas, $dec, $inc, $insert, $mul, $remove, $replace, $update, $upsert, ADAPTER_FILTER_REASON, ALL_AGGREGATE_FNS, ALL_BUCKET_UNITS, ALL_VIEW_CAPABILITIES, type AggregateControls, type AggregateExpr, type AggregateFn, type AggregateQuery, type AggregateResult, ApplicationIntegrity, AtscriptDbReadable, AtscriptDbTable, AtscriptDbView, type AtscriptDbWritable, type AtscriptExprNode, type AtscriptOrderItem, type AtscriptQueryComparison, type AtscriptQueryFieldRef, type AtscriptQueryNode, type AtscriptRef, BaseDbAdapter, type BucketExpr, type BucketUnit, type CalendarBucketLabel, CasExhaustedError, CasMismatchError, type ComputedExpr, DEFAULT_DB_SPACE, type DbControls, DbEncryption, DbError, type DbErrorCode, type DbPatch, type DbQuery, type DbResponse, type DbRow, DbSpace, type DbValidationContext, DocumentFieldMapper, ENCRYPTED_REASON, FieldMappingStrategy, type FieldOpsFor, type FilterExpr, type FilterVisitor, type FlatOf, IntegrityStrategy, NativeIntegrity, type NavPropsOf, NoopLogger, type NullableOptional, type OwnPropsOf, type PrimaryKeyOf, RELATION_OPS, REL_FILTER_MAX_DEPTH, REL_FILTER_MAX_NODES, type RelationOp, RelationalFieldMapper, type ResolvedBucket, ResolvedRelationFilter, type TAdapterFactory, type TArrayPatch, type TBucketFieldSource, type TBucketSourceTable, type TBucketSourceVerdict, type TCascadeResolver, type TCascadeTarget, type TColumnDiff, type TCrudOp, type TCrudPermissions, type TDbActionInfo, type TDbActionIntent, type TDbActionLevel, type TDbActionProcessor, type TDbActionTargetSummary, type TDbAvailableActions, type TDbCas, type TDbCollation, type TDbDefaultFn, type TDbDefaultValue, type TDbDeleteResult, type TDbEncryptionOptions, type TDbFieldMeta, type TDbFieldOp, type TDbForeignKey, type TDbIndex, type TDbIndexField, type TDbIndexType, type TDbInsertManyResult, type TDbInsertResult, type TDbObjectKind, type TDbPatch, type TDbReferentialAction, type TDbRelation, type TDbRemoveGuard, type TDbRemoveGuardContext, type TDbSpaceOptions, type TDbStorageType, type TDbUpdateResult, type TDbWriteAction, type TDbWriteCheck, type TDbWriteCheckContext, type TDbWriteGuard, type TDbWriteGuardContext, type TDeleteOptions, type TDerivedChangeReason, type TDerivedColumn, type TEnsureTableOptions, type TExistingColumn, type TExistingForeignKey, type TExistingTableOption, type TFieldMeta, type TFieldOps, type TFilterPredicate, type TFilterRef, type TFkLookupResolver, type TFkLookupTarget, type TGenericLogger, type TGuardedQuery, type TIdDescriptor, type TIdResolveOptions, type TIdentification, type TMetaResponse, type TMetadataOverrides, type TPrimaryKeyChange, type TQueryPathKind, type TQueryPathOp, type TQueryPathRefs, type TQueryPathSource, type TReadControls, type TReferencingForeignKey, type TRelationFilterJunction, type TRelationFilterTable, type TRelationInfo, type TRelationStaticFilter, type TResolvedBucket, type TRowResolveOptions, type TSearchIndexInfo, type TSyncColumnResult, type TTableOptionDiff, type TTableResolver, type TTouchManyOptions, type TValueFormatterPair, type TViewCapability, type TViewColumnMapping, type TViewJoin, type TViewJsonType, type TViewPlan, type TWriteOptions, type TWriteTableResolver, TableMetadata, type TypedWithRelation, UniquSelect, type Uniquery, type UniqueryControls, type ValidationContext, type ValidatorMode, type WeekStart, type WithOptimisticRetryOptions, type WithRelation, acceptedOperatorsHint, aliasTargetOf, andFilters, assertGeoPoint, assertNoVersionWrites, bucketSourceVerdict, bucketTimeZoneUnavailable, buildDbValidator, buildValidationContext, canFilterLeaf, checkHavingKeys, classifyQueryPath, collectQueryPaths, computeInsights, containsRelationFilter, createDbValidatorPlugin, createFailureCollector, decomposePatch, deletePath, findAncestorInSet, fkColumns, forEachResolvedRelation, forceNavNonOptional, geoIndexNotFoundMessage, getDbFieldOp, getKeyProps, getPath, guardAggregate, guardFilter, guardPath, guardPaths, guardQuery, hasRelationOp, isAtscriptDbView, isBucketableField, isColumnTypeChanged, isDbEntityType, isDbFieldOp, isEmptyObject, isFieldRef, isGeoIndexableType, isGeoPointType, isJsonValueField, isNavRelation, isPlainObject, isPrimitive, isRelationOp, isResolvedRelationFilter, isViewType, jsonValueAncestor, narrowerFilterOps, normalizeComputedSelect, reconcileCas, relationStaticFilter, resolveCalendarBuckets, resolveDesignType, searchIndexNotFoundMessage, selfOrAncestor, separateCas, separateFieldOps, sortFieldNames, tableNameOf, translateQueryTree, unsupportedOperatorMessage, vectorIndexNotFoundMessage, walkFilter, withOptimisticRetry };