@atscript/db 0.1.129 → 0.1.131

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/agg.cjs CHANGED
@@ -4,5 +4,36 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
4
4
  function resolveAlias(expr) {
5
5
  return expr.$as ?? `${expr.$fn}_${expr.$field}`;
6
6
  }
7
+ /**
8
+ * Reads the `$search` / `$index` controls of an aggregate query.
9
+ *
10
+ * Search and grouping are orthogonal: `$search` narrows the ROWS, `$groupBy`
11
+ * shapes what is left. Every adapter must therefore apply the search predicate
12
+ * BEFORE grouping, so the groups — and `$count`, which counts them — only ever
13
+ * describe rows that matched. An adapter that silently ignored the term would
14
+ * report totals for rows the same search excludes from the leaf list.
15
+ *
16
+ * Two rules the leaf search path applies and the grouped path must NOT:
17
+ * - **No implicit relevance ordering.** Relevance is a property of a row, not
18
+ * of a group; after `$group` there is no per-row score left to sort on.
19
+ * Grouped results order by `$sort` or not at all.
20
+ * - **No implicit row cap.** The leaf runners cap an unbounded search at 1000
21
+ * rows; applying that before `$group` would silently truncate group counts.
22
+ *
23
+ * Returns `undefined` when there is nothing to search for, so callers fall
24
+ * straight through to the plain grouped path.
25
+ */
26
+ function resolveAggregateSearch(controls) {
27
+ const raw = controls?.$search;
28
+ if (typeof raw !== "string") return;
29
+ const text = raw.trim();
30
+ if (!text) return;
31
+ const index = controls?.$index;
32
+ return {
33
+ text,
34
+ indexName: typeof index === "string" && index ? index : void 0
35
+ };
36
+ }
7
37
  //#endregion
38
+ exports.resolveAggregateSearch = resolveAggregateSearch;
8
39
  exports.resolveAlias = resolveAlias;
package/dist/agg.d.cts CHANGED
@@ -3,5 +3,34 @@ import { AggregateControls, AggregateExpr, AggregateExpr as AggregateExpr$1, Agg
3
3
  //#region src/agg.d.ts
4
4
  /** Resolves output alias: $as if provided, otherwise `{fn}_{field}`. */
5
5
  declare function resolveAlias(expr: AggregateExpr$1): string;
6
+ /** The text-search request a grouped query carries, once normalised. */
7
+ interface TAggregateSearch {
8
+ /** Non-empty, trimmed search term. */
9
+ text: string;
10
+ /** Named search index to target, when the caller picked one. */
11
+ indexName?: string;
12
+ }
13
+ /**
14
+ * Reads the `$search` / `$index` controls of an aggregate query.
15
+ *
16
+ * Search and grouping are orthogonal: `$search` narrows the ROWS, `$groupBy`
17
+ * shapes what is left. Every adapter must therefore apply the search predicate
18
+ * BEFORE grouping, so the groups — and `$count`, which counts them — only ever
19
+ * describe rows that matched. An adapter that silently ignored the term would
20
+ * report totals for rows the same search excludes from the leaf list.
21
+ *
22
+ * Two rules the leaf search path applies and the grouped path must NOT:
23
+ * - **No implicit relevance ordering.** Relevance is a property of a row, not
24
+ * of a group; after `$group` there is no per-row score left to sort on.
25
+ * Grouped results order by `$sort` or not at all.
26
+ * - **No implicit row cap.** The leaf runners cap an unbounded search at 1000
27
+ * rows; applying that before `$group` would silently truncate group counts.
28
+ *
29
+ * Returns `undefined` when there is nothing to search for, so callers fall
30
+ * straight through to the plain grouped path.
31
+ */
32
+ declare function resolveAggregateSearch(controls: {
33
+ [key: `$${string}`]: unknown;
34
+ } | undefined): TAggregateSearch | undefined;
6
35
  //#endregion
7
- export { type AggregateControls, type AggregateExpr, type AggregateFn, type AggregateQuery, type AggregateResult, resolveAlias };
36
+ export { type AggregateControls, type AggregateExpr, type AggregateFn, type AggregateQuery, type AggregateResult, resolveAggregateSearch, resolveAlias };
package/dist/agg.d.mts CHANGED
@@ -3,5 +3,34 @@ import { AggregateControls, AggregateExpr, AggregateExpr as AggregateExpr$1, Agg
3
3
  //#region src/agg.d.ts
4
4
  /** Resolves output alias: $as if provided, otherwise `{fn}_{field}`. */
5
5
  declare function resolveAlias(expr: AggregateExpr$1): string;
6
+ /** The text-search request a grouped query carries, once normalised. */
7
+ interface TAggregateSearch {
8
+ /** Non-empty, trimmed search term. */
9
+ text: string;
10
+ /** Named search index to target, when the caller picked one. */
11
+ indexName?: string;
12
+ }
13
+ /**
14
+ * Reads the `$search` / `$index` controls of an aggregate query.
15
+ *
16
+ * Search and grouping are orthogonal: `$search` narrows the ROWS, `$groupBy`
17
+ * shapes what is left. Every adapter must therefore apply the search predicate
18
+ * BEFORE grouping, so the groups — and `$count`, which counts them — only ever
19
+ * describe rows that matched. An adapter that silently ignored the term would
20
+ * report totals for rows the same search excludes from the leaf list.
21
+ *
22
+ * Two rules the leaf search path applies and the grouped path must NOT:
23
+ * - **No implicit relevance ordering.** Relevance is a property of a row, not
24
+ * of a group; after `$group` there is no per-row score left to sort on.
25
+ * Grouped results order by `$sort` or not at all.
26
+ * - **No implicit row cap.** The leaf runners cap an unbounded search at 1000
27
+ * rows; applying that before `$group` would silently truncate group counts.
28
+ *
29
+ * Returns `undefined` when there is nothing to search for, so callers fall
30
+ * straight through to the plain grouped path.
31
+ */
32
+ declare function resolveAggregateSearch(controls: {
33
+ [key: `$${string}`]: unknown;
34
+ } | undefined): TAggregateSearch | undefined;
6
35
  //#endregion
7
- export { type AggregateControls, type AggregateExpr, type AggregateFn, type AggregateQuery, type AggregateResult, resolveAlias };
36
+ export { type AggregateControls, type AggregateExpr, type AggregateFn, type AggregateQuery, type AggregateResult, resolveAggregateSearch, resolveAlias };
package/dist/agg.mjs CHANGED
@@ -3,5 +3,35 @@
3
3
  function resolveAlias(expr) {
4
4
  return expr.$as ?? `${expr.$fn}_${expr.$field}`;
5
5
  }
6
+ /**
7
+ * Reads the `$search` / `$index` controls of an aggregate query.
8
+ *
9
+ * Search and grouping are orthogonal: `$search` narrows the ROWS, `$groupBy`
10
+ * shapes what is left. Every adapter must therefore apply the search predicate
11
+ * BEFORE grouping, so the groups — and `$count`, which counts them — only ever
12
+ * describe rows that matched. An adapter that silently ignored the term would
13
+ * report totals for rows the same search excludes from the leaf list.
14
+ *
15
+ * Two rules the leaf search path applies and the grouped path must NOT:
16
+ * - **No implicit relevance ordering.** Relevance is a property of a row, not
17
+ * of a group; after `$group` there is no per-row score left to sort on.
18
+ * Grouped results order by `$sort` or not at all.
19
+ * - **No implicit row cap.** The leaf runners cap an unbounded search at 1000
20
+ * rows; applying that before `$group` would silently truncate group counts.
21
+ *
22
+ * Returns `undefined` when there is nothing to search for, so callers fall
23
+ * straight through to the plain grouped path.
24
+ */
25
+ function resolveAggregateSearch(controls) {
26
+ const raw = controls?.$search;
27
+ if (typeof raw !== "string") return;
28
+ const text = raw.trim();
29
+ if (!text) return;
30
+ const index = controls?.$index;
31
+ return {
32
+ text,
33
+ indexName: typeof index === "string" && index ? index : void 0
34
+ };
35
+ }
6
36
  //#endregion
7
- export { resolveAlias };
37
+ export { resolveAggregateSearch, resolveAlias };
@@ -1195,8 +1195,15 @@ declare abstract class BaseDbAdapter {
1195
1195
  */
1196
1196
  getSearchIndexes(): TSearchIndexInfo[];
1197
1197
  /**
1198
- * Whether this adapter supports text search.
1199
- * Default: `true` when {@link getSearchIndexes} returns any entries.
1198
+ * Whether this adapter can run TEXT search — `search()`, `searchWithCount()`
1199
+ * and the grouped `$search` path all gate on it. Vector capability is a
1200
+ * separate predicate, {@link isVectorSearchable}.
1201
+ *
1202
+ * Default: `true` when {@link getSearchIndexes} lists at least one non-vector
1203
+ * index. Vector entries are published there for the index picker, but a
1204
+ * vector index answers {@link vectorSearch} and nothing else, so counting one
1205
+ * here would claim a capability the adapter does not have. An entry without
1206
+ * `type` counts as text — adapters predating the field only listed text.
1200
1207
  */
1201
1208
  isSearchable(): boolean;
1202
1209
  /**
@@ -1195,8 +1195,15 @@ declare abstract class BaseDbAdapter {
1195
1195
  */
1196
1196
  getSearchIndexes(): TSearchIndexInfo[];
1197
1197
  /**
1198
- * Whether this adapter supports text search.
1199
- * Default: `true` when {@link getSearchIndexes} returns any entries.
1198
+ * Whether this adapter can run TEXT search — `search()`, `searchWithCount()`
1199
+ * and the grouped `$search` path all gate on it. Vector capability is a
1200
+ * separate predicate, {@link isVectorSearchable}.
1201
+ *
1202
+ * Default: `true` when {@link getSearchIndexes} lists at least one non-vector
1203
+ * index. Vector entries are published there for the index picker, but a
1204
+ * vector index answers {@link vectorSearch} and nothing else, so counting one
1205
+ * here would claim a capability the adapter does not have. An entry without
1206
+ * `type` counts as text — adapters predating the field only listed text.
1200
1207
  */
1201
1208
  isSearchable(): boolean;
1202
1209
  /**
@@ -1,6 +1,6 @@
1
- import { C as NullableOptional, Ct as TWriteOptions, E as TCascadeResolver, G as TDbInsertResult, Pt as TGenericLogger, Q as TDbUpdateResult, R as TDbDeleteResult, W as TDbInsertManyResult, a as TDbEncryptionOptions, bt as TTableResolver, c as BaseDbAdapter, ct as TFkLookupResolver, g as DbPatch, ht as TReferencingForeignKey, i as DbEncryption, kt as TableMetadata, nt as TDeleteOptions, t as AtscriptDbReadable, v as DbRow, wt as TWriteTableResolver, xt as TTouchManyOptions } from "./db-readable-B7eYWS5q.cjs";
2
- import { FilterExpr } from "@uniqu/core";
1
+ import { C as NullableOptional, Ct as TWriteOptions, E as TCascadeResolver, G as TDbInsertResult, Pt as TGenericLogger, Q as TDbUpdateResult, R as TDbDeleteResult, W as TDbInsertManyResult, a as TDbEncryptionOptions, bt as TTableResolver, c as BaseDbAdapter, ct as TFkLookupResolver, g as DbPatch, ht as TReferencingForeignKey, i as DbEncryption, kt as TableMetadata, nt as TDeleteOptions, t as AtscriptDbReadable, v as DbRow, wt as TWriteTableResolver, xt as TTouchManyOptions } from "./db-readable-D8aa-wfP.mjs";
3
2
  import { AtscriptQueryComparison, AtscriptQueryFieldRef, AtscriptQueryFieldRef as AtscriptQueryFieldRef$1, AtscriptQueryNode, AtscriptQueryNode as AtscriptQueryNode$1, AtscriptRef, FlatOf, NavPropsOf, OwnPropsOf, PrimaryKeyOf, TAtscriptAnnotatedType, TAtscriptDataType, Validator } from "@atscript/typescript/utils";
3
+ import { FilterExpr } from "@uniqu/core";
4
4
 
5
5
  //#region src/strategies/integrity.d.ts
6
6
  /**
@@ -1,6 +1,6 @@
1
- import { C as NullableOptional, Ct as TWriteOptions, E as TCascadeResolver, G as TDbInsertResult, Pt as TGenericLogger, Q as TDbUpdateResult, R as TDbDeleteResult, W as TDbInsertManyResult, a as TDbEncryptionOptions, bt as TTableResolver, c as BaseDbAdapter, ct as TFkLookupResolver, g as DbPatch, ht as TReferencingForeignKey, i as DbEncryption, kt as TableMetadata, nt as TDeleteOptions, t as AtscriptDbReadable, v as DbRow, wt as TWriteTableResolver, xt as TTouchManyOptions } from "./db-readable-Bn1bV_eC.mjs";
2
- import { AtscriptQueryComparison, AtscriptQueryFieldRef, AtscriptQueryFieldRef as AtscriptQueryFieldRef$1, AtscriptQueryNode, AtscriptQueryNode as AtscriptQueryNode$1, AtscriptRef, FlatOf, NavPropsOf, OwnPropsOf, PrimaryKeyOf, TAtscriptAnnotatedType, TAtscriptDataType, Validator } from "@atscript/typescript/utils";
1
+ import { C as NullableOptional, Ct as TWriteOptions, E as TCascadeResolver, G as TDbInsertResult, Pt as TGenericLogger, Q as TDbUpdateResult, R as TDbDeleteResult, W as TDbInsertManyResult, a as TDbEncryptionOptions, bt as TTableResolver, c as BaseDbAdapter, ct as TFkLookupResolver, g as DbPatch, ht as TReferencingForeignKey, i as DbEncryption, kt as TableMetadata, nt as TDeleteOptions, t as AtscriptDbReadable, v as DbRow, wt as TWriteTableResolver, xt as TTouchManyOptions } from "./db-readable-Cmrg9aLU.cjs";
3
2
  import { FilterExpr } from "@uniqu/core";
3
+ import { AtscriptQueryComparison, AtscriptQueryFieldRef, AtscriptQueryFieldRef as AtscriptQueryFieldRef$1, AtscriptQueryNode, AtscriptQueryNode as AtscriptQueryNode$1, AtscriptRef, FlatOf, NavPropsOf, OwnPropsOf, PrimaryKeyOf, TAtscriptAnnotatedType, TAtscriptDataType, Validator } from "@atscript/typescript/utils";
4
4
 
5
5
  //#region src/strategies/integrity.d.ts
6
6
  /**
@@ -1027,13 +1027,11 @@ var RelationalFieldMapper = class extends FieldMappingStrategy {
1027
1027
  return {
1028
1028
  filter,
1029
1029
  controls: {
1030
+ ...controls,
1030
1031
  $groupBy: groupBy,
1031
1032
  $select: select ? new UniquSelect(select, meta.allPhysicalFields) : void 0,
1032
1033
  $sort: sort,
1033
- $having: having,
1034
- $skip: controls.$skip,
1035
- $limit: controls.$limit,
1036
- $count: controls.$count
1034
+ $having: having
1037
1035
  },
1038
1036
  insights: query.insights
1039
1037
  };
@@ -1682,9 +1680,11 @@ var AtscriptDbReadable = class {
1682
1680
  return this._meta;
1683
1681
  }
1684
1682
  _ensureSearchable() {
1685
- if (!this.adapter.isSearchable()) throw new DbError("INVALID_QUERY", [{
1683
+ if (this.adapter.isSearchable()) return;
1684
+ const hasVectorIndex = this.adapter.getSearchIndexes().some((i) => i.type === "vector");
1685
+ throw new DbError("INVALID_QUERY", [{
1686
1686
  path: "$search",
1687
- message: `Table "${this.tableName}" has no search indexes defined`
1687
+ message: `Table "${this.tableName}" has no text search index` + (hasVectorIndex ? " — a @db.search.vector index only answers vectorSearch()" : "")
1688
1688
  }]);
1689
1689
  }
1690
1690
  /** Engine-agnostic query-time guards (encrypted-field refs, $geoWithin shape). */
@@ -2047,6 +2047,11 @@ var AtscriptDbReadable = class {
2047
2047
  }]);
2048
2048
  }
2049
2049
  }
2050
+ const searchTerm = query.controls.$search;
2051
+ if (typeof searchTerm === "string" && searchTerm) {
2052
+ this._ensureSearchable();
2053
+ if (!searchTerm.trim()) return query.controls.$count ? [{ count: 0 }] : [];
2054
+ }
2050
2055
  guardAggregate(this._meta, this.adapter, query);
2051
2056
  const dbQuery = this._fieldMapper.translateAggregateQuery(query, this._meta);
2052
2057
  return (await this.adapter.aggregate(dbQuery)).map((row) => this._fieldMapper.reconstructFromRead(row, this._meta));
@@ -2771,11 +2776,18 @@ var BaseDbAdapter = class {
2771
2776
  return [];
2772
2777
  }
2773
2778
  /**
2774
- * Whether this adapter supports text search.
2775
- * Default: `true` when {@link getSearchIndexes} returns any entries.
2779
+ * Whether this adapter can run TEXT search — `search()`, `searchWithCount()`
2780
+ * and the grouped `$search` path all gate on it. Vector capability is a
2781
+ * separate predicate, {@link isVectorSearchable}.
2782
+ *
2783
+ * Default: `true` when {@link getSearchIndexes} lists at least one non-vector
2784
+ * index. Vector entries are published there for the index picker, but a
2785
+ * vector index answers {@link vectorSearch} and nothing else, so counting one
2786
+ * here would claim a capability the adapter does not have. An entry without
2787
+ * `type` counts as text — adapters predating the field only listed text.
2776
2788
  */
2777
2789
  isSearchable() {
2778
- return this.getSearchIndexes().length > 0;
2790
+ return this.getSearchIndexes().some((index) => index.type !== "vector");
2779
2791
  }
2780
2792
  /**
2781
2793
  * Whether this adapter supports vector similarity search.
@@ -1027,13 +1027,11 @@ var RelationalFieldMapper = class extends FieldMappingStrategy {
1027
1027
  return {
1028
1028
  filter,
1029
1029
  controls: {
1030
+ ...controls,
1030
1031
  $groupBy: groupBy,
1031
1032
  $select: select ? new UniquSelect(select, meta.allPhysicalFields) : void 0,
1032
1033
  $sort: sort,
1033
- $having: having,
1034
- $skip: controls.$skip,
1035
- $limit: controls.$limit,
1036
- $count: controls.$count
1034
+ $having: having
1037
1035
  },
1038
1036
  insights: query.insights
1039
1037
  };
@@ -1682,9 +1680,11 @@ var AtscriptDbReadable = class {
1682
1680
  return this._meta;
1683
1681
  }
1684
1682
  _ensureSearchable() {
1685
- if (!this.adapter.isSearchable()) throw new require_db_error.DbError("INVALID_QUERY", [{
1683
+ if (this.adapter.isSearchable()) return;
1684
+ const hasVectorIndex = this.adapter.getSearchIndexes().some((i) => i.type === "vector");
1685
+ throw new require_db_error.DbError("INVALID_QUERY", [{
1686
1686
  path: "$search",
1687
- message: `Table "${this.tableName}" has no search indexes defined`
1687
+ message: `Table "${this.tableName}" has no text search index` + (hasVectorIndex ? " — a @db.search.vector index only answers vectorSearch()" : "")
1688
1688
  }]);
1689
1689
  }
1690
1690
  /** Engine-agnostic query-time guards (encrypted-field refs, $geoWithin shape). */
@@ -2047,6 +2047,11 @@ var AtscriptDbReadable = class {
2047
2047
  }]);
2048
2048
  }
2049
2049
  }
2050
+ const searchTerm = query.controls.$search;
2051
+ if (typeof searchTerm === "string" && searchTerm) {
2052
+ this._ensureSearchable();
2053
+ if (!searchTerm.trim()) return query.controls.$count ? [{ count: 0 }] : [];
2054
+ }
2050
2055
  guardAggregate(this._meta, this.adapter, query);
2051
2056
  const dbQuery = this._fieldMapper.translateAggregateQuery(query, this._meta);
2052
2057
  return (await this.adapter.aggregate(dbQuery)).map((row) => this._fieldMapper.reconstructFromRead(row, this._meta));
@@ -2771,11 +2776,18 @@ var BaseDbAdapter = class {
2771
2776
  return [];
2772
2777
  }
2773
2778
  /**
2774
- * Whether this adapter supports text search.
2775
- * Default: `true` when {@link getSearchIndexes} returns any entries.
2779
+ * Whether this adapter can run TEXT search — `search()`, `searchWithCount()`
2780
+ * and the grouped `$search` path all gate on it. Vector capability is a
2781
+ * separate predicate, {@link isVectorSearchable}.
2782
+ *
2783
+ * Default: `true` when {@link getSearchIndexes} lists at least one non-vector
2784
+ * index. Vector entries are published there for the index picker, but a
2785
+ * vector index answers {@link vectorSearch} and nothing else, so counting one
2786
+ * here would claim a capability the adapter does not have. An entry without
2787
+ * `type` counts as text — adapters predating the field only listed text.
2776
2788
  */
2777
2789
  isSearchable() {
2778
- return this.getSearchIndexes().length > 0;
2790
+ return this.getSearchIndexes().some((index) => index.type !== "vector");
2779
2791
  }
2780
2792
  /**
2781
2793
  * Whether this adapter supports vector similarity search.
package/dist/index.cjs CHANGED
@@ -1,6 +1,6 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  const require_db_error = require("./db-error-C4JuLcvb.cjs");
3
- const require_db_view = require("./db-view-CRBgkEp0.cjs");
3
+ const require_db_view = require("./db-view-DUDnyQ3b.cjs");
4
4
  const require_validator = require("./validator-lkCJKuoo.cjs");
5
5
  const require_consts = require("./consts-BzRfCcH2.cjs");
6
6
  const require_ops = require("./ops.cjs");
package/dist/index.d.cts CHANGED
@@ -1,6 +1,6 @@
1
- import { $ as TDbWriteAction, A as TCrudPermissions, At as findAncestorInSet, B as TDbForeignKey, C as NullableOptional, Ct as TWriteOptions, D as TCascadeTarget, Dt as UniqueryControls, E as TCascadeResolver, Et as Uniquery, F as TDbCollation, Ft as UniquSelect, G as TDbInsertResult, H as TDbIndexField, I as TDbDefaultFn, J as TDbRelation, K as TDbObjectKind, L as TDbDefaultValue, M as TDbActionIntent, Mt as isGeoPointType, N as TDbActionLevel, Nt as NoopLogger, O as TColumnDiff, Ot as WithRelation, P as TDbActionProcessor, Pt as TGenericLogger, Q as TDbUpdateResult, R as TDbDeleteResult, S as NavPropsOf, St as TValueFormatterPair, T as PrimaryKeyOf, Tt as TypedWithRelation, U as TDbIndexType, V as TDbIndex, W as TDbInsertManyResult, X as TDbRemoveGuardContext, Y as TDbRemoveGuard, Z as TDbStorageType, _ as DbQuery, _t as TSearchIndexInfo, a as TDbEncryptionOptions, at as TExistingForeignKey, b as FilterExpr, bt as TTableResolver, c as BaseDbAdapter, ct as TFkLookupResolver, d as AggregateFn, dt as TIdentification, et as TDbWriteGuard, f as AggregateQuery, ft as TMetaResponse, g as DbPatch, gt as TRelationInfo, h as DbControls, ht as TReferencingForeignKey, i as DbEncryption, it as TExistingColumn, j as TDbActionInfo, jt as isGeoIndexableType, k as TCrudOp, kt as TableMetadata, l as AggregateControls, lt as TFkLookupTarget, m as AtscriptDbWritable, mt as TPrimaryKeyChange, n as DbResponse, nt as TDeleteOptions, o as DocumentFieldMapper, ot as TExistingTableOption, p as AggregateResult, pt as TMetadataOverrides, q as TDbReferentialAction, r as resolveDesignType, rt as TEnsureTableOptions, s as FieldMappingStrategy, st as TFieldMeta, t as AtscriptDbReadable, tt as TDbWriteGuardContext, u as AggregateExpr, ut as TIdDescriptor, v as DbRow, vt as TSyncColumnResult, w as OwnPropsOf, wt as TWriteTableResolver, x as FlatOf, xt as TTouchManyOptions, y as FieldOpsFor, yt as TTableOptionDiff, z as TDbFieldMeta } from "./db-readable-B7eYWS5q.cjs";
1
+ import { $ as TDbWriteAction, A as TCrudPermissions, At as findAncestorInSet, B as TDbForeignKey, C as NullableOptional, Ct as TWriteOptions, D as TCascadeTarget, Dt as UniqueryControls, E as TCascadeResolver, Et as Uniquery, F as TDbCollation, Ft as UniquSelect, G as TDbInsertResult, H as TDbIndexField, I as TDbDefaultFn, J as TDbRelation, K as TDbObjectKind, L as TDbDefaultValue, M as TDbActionIntent, Mt as isGeoPointType, N as TDbActionLevel, Nt as NoopLogger, O as TColumnDiff, Ot as WithRelation, P as TDbActionProcessor, Pt as TGenericLogger, Q as TDbUpdateResult, R as TDbDeleteResult, S as NavPropsOf, St as TValueFormatterPair, T as PrimaryKeyOf, Tt as TypedWithRelation, U as TDbIndexType, V as TDbIndex, W as TDbInsertManyResult, X as TDbRemoveGuardContext, Y as TDbRemoveGuard, Z as TDbStorageType, _ as DbQuery, _t as TSearchIndexInfo, a as TDbEncryptionOptions, at as TExistingForeignKey, b as FilterExpr, bt as TTableResolver, c as BaseDbAdapter, ct as TFkLookupResolver, d as AggregateFn, dt as TIdentification, et as TDbWriteGuard, f as AggregateQuery, ft as TMetaResponse, g as DbPatch, gt as TRelationInfo, h as DbControls, ht as TReferencingForeignKey, i as DbEncryption, it as TExistingColumn, j as TDbActionInfo, jt as isGeoIndexableType, k as TCrudOp, kt as TableMetadata, l as AggregateControls, lt as TFkLookupTarget, m as AtscriptDbWritable, mt as TPrimaryKeyChange, n as DbResponse, nt as TDeleteOptions, o as DocumentFieldMapper, ot as TExistingTableOption, p as AggregateResult, pt as TMetadataOverrides, q as TDbReferentialAction, r as resolveDesignType, rt as TEnsureTableOptions, s as FieldMappingStrategy, st as TFieldMeta, t as AtscriptDbReadable, tt as TDbWriteGuardContext, u as AggregateExpr, ut as TIdDescriptor, v as DbRow, vt as TSyncColumnResult, w as OwnPropsOf, wt as TWriteTableResolver, x as FlatOf, xt as TTouchManyOptions, y as FieldOpsFor, yt as TTableOptionDiff, z as TDbFieldMeta } from "./db-readable-Cmrg9aLU.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
- import { a as TViewColumnMapping, c as AtscriptQueryFieldRef, d as TViewJoin, f as TViewPlan, g as NativeIntegrity, h as IntegrityStrategy, i as AtscriptDbView, l as AtscriptQueryNode, m as AtscriptDbTable, n as TAdapterFactory, o as isAtscriptDbView, p as translateQueryTree, r as TDbSpaceOptions, s as AtscriptQueryComparison, t as DbSpace, u as AtscriptRef } from "./db-space-C2UCnGHd.cjs";
3
+ import { a as TViewColumnMapping, c as AtscriptQueryFieldRef, d as TViewJoin, f as TViewPlan, g as NativeIntegrity, h as IntegrityStrategy, i as AtscriptDbView, l as AtscriptQueryNode, m as AtscriptDbTable, n as TAdapterFactory, o as isAtscriptDbView, p as translateQueryTree, r as TDbSpaceOptions, s as AtscriptQueryComparison, t as DbSpace, u as AtscriptRef } from "./db-space-rQFgz3-k.cjs";
4
4
  import { _ as DbErrorCode, a as buildValidationContext, c as isNavRelation, d as TArrayPatch, f as TDbPatch, g as DbError, h as CasMismatchError, l as isEmptyObject, m as CasExhaustedError, n as ValidatorMode, p as getKeyProps, r as buildDbValidator, s as forceNavNonOptional, t as ValidationContext, u as isPlainObject } from "./validator-wBARmD68.cjs";
5
5
  import { n as createDbValidatorPlugin, t as DbValidationContext } from "./db-validator-plugin-BWy60OvG.cjs";
6
6
  import { AggregateQuery as AggregateQuery$1, FilterExpr as FilterExpr$1, FilterVisitor, Uniquery as Uniquery$1, computeInsights, isPrimitive, walkFilter } from "@uniqu/core";
package/dist/index.d.mts CHANGED
@@ -1,6 +1,6 @@
1
- import { $ as TDbWriteAction, A as TCrudPermissions, At as findAncestorInSet, B as TDbForeignKey, C as NullableOptional, Ct as TWriteOptions, D as TCascadeTarget, Dt as UniqueryControls, E as TCascadeResolver, Et as Uniquery, F as TDbCollation, Ft as UniquSelect, G as TDbInsertResult, H as TDbIndexField, I as TDbDefaultFn, J as TDbRelation, K as TDbObjectKind, L as TDbDefaultValue, M as TDbActionIntent, Mt as isGeoPointType, N as TDbActionLevel, Nt as NoopLogger, O as TColumnDiff, Ot as WithRelation, P as TDbActionProcessor, Pt as TGenericLogger, Q as TDbUpdateResult, R as TDbDeleteResult, S as NavPropsOf, St as TValueFormatterPair, T as PrimaryKeyOf, Tt as TypedWithRelation, U as TDbIndexType, V as TDbIndex, W as TDbInsertManyResult, X as TDbRemoveGuardContext, Y as TDbRemoveGuard, Z as TDbStorageType, _ as DbQuery, _t as TSearchIndexInfo, a as TDbEncryptionOptions, at as TExistingForeignKey, b as FilterExpr, bt as TTableResolver, c as BaseDbAdapter, ct as TFkLookupResolver, d as AggregateFn, dt as TIdentification, et as TDbWriteGuard, f as AggregateQuery, ft as TMetaResponse, g as DbPatch, gt as TRelationInfo, h as DbControls, ht as TReferencingForeignKey, i as DbEncryption, it as TExistingColumn, j as TDbActionInfo, jt as isGeoIndexableType, k as TCrudOp, kt as TableMetadata, l as AggregateControls, lt as TFkLookupTarget, m as AtscriptDbWritable, mt as TPrimaryKeyChange, n as DbResponse, nt as TDeleteOptions, o as DocumentFieldMapper, ot as TExistingTableOption, p as AggregateResult, pt as TMetadataOverrides, q as TDbReferentialAction, r as resolveDesignType, rt as TEnsureTableOptions, s as FieldMappingStrategy, st as TFieldMeta, t as AtscriptDbReadable, tt as TDbWriteGuardContext, u as AggregateExpr, ut as TIdDescriptor, v as DbRow, vt as TSyncColumnResult, w as OwnPropsOf, wt as TWriteTableResolver, x as FlatOf, xt as TTouchManyOptions, y as FieldOpsFor, yt as TTableOptionDiff, z as TDbFieldMeta } from "./db-readable-Bn1bV_eC.mjs";
1
+ import { $ as TDbWriteAction, A as TCrudPermissions, At as findAncestorInSet, B as TDbForeignKey, C as NullableOptional, Ct as TWriteOptions, D as TCascadeTarget, Dt as UniqueryControls, E as TCascadeResolver, Et as Uniquery, F as TDbCollation, Ft as UniquSelect, G as TDbInsertResult, H as TDbIndexField, I as TDbDefaultFn, J as TDbRelation, K as TDbObjectKind, L as TDbDefaultValue, M as TDbActionIntent, Mt as isGeoPointType, N as TDbActionLevel, Nt as NoopLogger, O as TColumnDiff, Ot as WithRelation, P as TDbActionProcessor, Pt as TGenericLogger, Q as TDbUpdateResult, R as TDbDeleteResult, S as NavPropsOf, St as TValueFormatterPair, T as PrimaryKeyOf, Tt as TypedWithRelation, U as TDbIndexType, V as TDbIndex, W as TDbInsertManyResult, X as TDbRemoveGuardContext, Y as TDbRemoveGuard, Z as TDbStorageType, _ as DbQuery, _t as TSearchIndexInfo, a as TDbEncryptionOptions, at as TExistingForeignKey, b as FilterExpr, bt as TTableResolver, c as BaseDbAdapter, ct as TFkLookupResolver, d as AggregateFn, dt as TIdentification, et as TDbWriteGuard, f as AggregateQuery, ft as TMetaResponse, g as DbPatch, gt as TRelationInfo, h as DbControls, ht as TReferencingForeignKey, i as DbEncryption, it as TExistingColumn, j as TDbActionInfo, jt as isGeoIndexableType, k as TCrudOp, kt as TableMetadata, l as AggregateControls, lt as TFkLookupTarget, m as AtscriptDbWritable, mt as TPrimaryKeyChange, n as DbResponse, nt as TDeleteOptions, o as DocumentFieldMapper, ot as TExistingTableOption, p as AggregateResult, pt as TMetadataOverrides, q as TDbReferentialAction, r as resolveDesignType, rt as TEnsureTableOptions, s as FieldMappingStrategy, st as TFieldMeta, t as AtscriptDbReadable, tt as TDbWriteGuardContext, u as AggregateExpr, ut as TIdDescriptor, v as DbRow, vt as TSyncColumnResult, w as OwnPropsOf, wt as TWriteTableResolver, x as FlatOf, xt as TTouchManyOptions, y as FieldOpsFor, yt as TTableOptionDiff, z as TDbFieldMeta } from "./db-readable-D8aa-wfP.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
- import { a as TViewColumnMapping, c as AtscriptQueryFieldRef, d as TViewJoin, f as TViewPlan, g as NativeIntegrity, h as IntegrityStrategy, i as AtscriptDbView, l as AtscriptQueryNode, m as AtscriptDbTable, n as TAdapterFactory, o as isAtscriptDbView, p as translateQueryTree, r as TDbSpaceOptions, s as AtscriptQueryComparison, t as DbSpace, u as AtscriptRef } from "./db-space-DdIPYD0Q.mjs";
3
+ import { a as TViewColumnMapping, c as AtscriptQueryFieldRef, d as TViewJoin, f as TViewPlan, g as NativeIntegrity, h as IntegrityStrategy, i as AtscriptDbView, l as AtscriptQueryNode, m as AtscriptDbTable, n as TAdapterFactory, o as isAtscriptDbView, p as translateQueryTree, r as TDbSpaceOptions, s as AtscriptQueryComparison, t as DbSpace, u as AtscriptRef } from "./db-space-B4MjNjY4.mjs";
4
4
  import { _ as DbErrorCode, a as buildValidationContext, c as isNavRelation, d as TArrayPatch, f as TDbPatch, g as DbError, h as CasMismatchError, l as isEmptyObject, m as CasExhaustedError, n as ValidatorMode, p as getKeyProps, r as buildDbValidator, s as forceNavNonOptional, t as ValidationContext, u as isPlainObject } from "./validator-wBARmD68.mjs";
5
5
  import { n as createDbValidatorPlugin, t as DbValidationContext } from "./db-validator-plugin-BWy60OvG.mjs";
6
6
  import { AggregateQuery as AggregateQuery$1, FilterExpr as FilterExpr$1, FilterVisitor, Uniquery as Uniquery$1, computeInsights, isPrimitive, walkFilter } from "@uniqu/core";
package/dist/index.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  import { n as CasMismatchError, r as DbError, t as CasExhaustedError } from "./db-error-COrO58t5.mjs";
2
- import { A as isGeoIndexableType, C as unsupportedOperatorMessage, D as UniquSelect, E as FieldMappingStrategy, M as NoopLogger, O as TableMetadata, S as sortFieldNames, T as DocumentFieldMapper, _ as guardAggregate, a as decomposePatch, b as guardPaths, c as createFailureCollector, d as AtscriptDbReadable, f as resolveDesignType, g as collectQueryPaths, h as classifyQueryPath, i as assertNoVersionWrites, j as isGeoPointType, k as findAncestorInSet, l as IntegrityStrategy, m as checkHavingKeys, n as isAtscriptDbView, o as ApplicationIntegrity, p as assertGeoPoint, r as AtscriptDbTable, s as BaseDbAdapter, t as AtscriptDbView, u as NativeIntegrity, v as guardFilter, w as RelationalFieldMapper, x as guardQuery, y as guardPath } from "./db-view-Dl0aDTiT.mjs";
2
+ import { A as isGeoIndexableType, C as unsupportedOperatorMessage, D as UniquSelect, E as FieldMappingStrategy, M as NoopLogger, O as TableMetadata, S as sortFieldNames, T as DocumentFieldMapper, _ as guardAggregate, a as decomposePatch, b as guardPaths, c as createFailureCollector, d as AtscriptDbReadable, f as resolveDesignType, g as collectQueryPaths, h as classifyQueryPath, i as assertNoVersionWrites, j as isGeoPointType, k as findAncestorInSet, l as IntegrityStrategy, m as checkHavingKeys, n as isAtscriptDbView, o as ApplicationIntegrity, p as assertGeoPoint, r as AtscriptDbTable, s as BaseDbAdapter, t as AtscriptDbView, u as NativeIntegrity, v as guardFilter, w as RelationalFieldMapper, x as guardQuery, y as guardPath } from "./db-view-BYH4HJ-U.mjs";
3
3
  import { a as forceNavNonOptional, c as getKeyProps, l as isEmptyObject, o as isNavRelation, r as buildValidationContext, s as createDbValidatorPlugin, t as buildDbValidator, u as isPlainObject } from "./validator-CeD_fqyW.mjs";
4
4
  import { t as DEFAULT_DB_SPACE } from "./consts-C_-5_pFq.mjs";
5
5
  import { $cas, $dec, $inc, $insert, $mul, $remove, $replace, $update, $upsert, getDbFieldOp, isDbFieldOp, reconcileCas, separateCas, separateFieldOps } from "./ops.mjs";
package/dist/rel.d.cts CHANGED
@@ -1,4 +1,4 @@
1
- import { B as TDbForeignKey, J as TDbRelation, Pt as TGenericLogger, bt as TTableResolver, c as BaseDbAdapter, kt as TableMetadata, wt as TWriteTableResolver } from "./db-readable-B7eYWS5q.cjs";
1
+ import { B as TDbForeignKey, J as TDbRelation, Pt as TGenericLogger, bt as TTableResolver, c as BaseDbAdapter, kt as TableMetadata, wt as TWriteTableResolver } from "./db-readable-Cmrg9aLU.cjs";
2
2
  import { t as DbValidationContext } from "./db-validator-plugin-BWy60OvG.cjs";
3
3
  import { FilterExpr, WithRelation } from "@uniqu/core";
4
4
  import { Validator } from "@atscript/typescript/utils";
package/dist/rel.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import { B as TDbForeignKey, J as TDbRelation, Pt as TGenericLogger, bt as TTableResolver, c as BaseDbAdapter, kt as TableMetadata, wt as TWriteTableResolver } from "./db-readable-Bn1bV_eC.mjs";
1
+ import { B as TDbForeignKey, J as TDbRelation, Pt as TGenericLogger, bt as TTableResolver, c as BaseDbAdapter, kt as TableMetadata, wt as TWriteTableResolver } from "./db-readable-D8aa-wfP.mjs";
2
2
  import { t as DbValidationContext } from "./db-validator-plugin-BWy60OvG.mjs";
3
3
  import { Validator } from "@atscript/typescript/utils";
4
4
  import { FilterExpr, WithRelation } from "@uniqu/core";
package/dist/sync.cjs CHANGED
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_db_view = require("./db-view-CRBgkEp0.cjs");
2
+ const require_db_view = require("./db-view-DUDnyQ3b.cjs");
3
3
  //#region src/schema/schema-hash.ts
4
4
  /** Extracts sorted field snapshots from a readable's field descriptors. */
5
5
  function extractFieldSnapshots(fields, typeMapper) {
package/dist/sync.d.cts CHANGED
@@ -1,5 +1,5 @@
1
- import { B as TDbForeignKey, K as TDbObjectKind, L as TDbDefaultValue, O as TColumnDiff, Pt as TGenericLogger, Z as TDbStorageType, at as TExistingForeignKey, ht as TReferencingForeignKey, it as TExistingColumn, mt as TPrimaryKeyChange, ot as TExistingTableOption, rt as TEnsureTableOptions, t as AtscriptDbReadable, yt as TTableOptionDiff, z as TDbFieldMeta } from "./db-readable-B7eYWS5q.cjs";
2
- import { c as AtscriptQueryFieldRef$1, i as AtscriptDbView, l as AtscriptQueryNode$1, t as DbSpace } from "./db-space-C2UCnGHd.cjs";
1
+ import { B as TDbForeignKey, K as TDbObjectKind, L as TDbDefaultValue, O as TColumnDiff, Pt as TGenericLogger, Z as TDbStorageType, at as TExistingForeignKey, ht as TReferencingForeignKey, it as TExistingColumn, mt as TPrimaryKeyChange, ot as TExistingTableOption, rt as TEnsureTableOptions, t as AtscriptDbReadable, yt as TTableOptionDiff, z as TDbFieldMeta } from "./db-readable-Cmrg9aLU.cjs";
2
+ import { c as AtscriptQueryFieldRef$1, i as AtscriptDbView, l as AtscriptQueryNode$1, t as DbSpace } from "./db-space-rQFgz3-k.cjs";
3
3
  import { TAtscriptAnnotatedType } from "@atscript/typescript/utils";
4
4
 
5
5
  //#region src/schema/sync-entry.d.ts
package/dist/sync.d.mts CHANGED
@@ -1,5 +1,5 @@
1
- import { B as TDbForeignKey, K as TDbObjectKind, L as TDbDefaultValue, O as TColumnDiff, Pt as TGenericLogger, Z as TDbStorageType, at as TExistingForeignKey, ht as TReferencingForeignKey, it as TExistingColumn, mt as TPrimaryKeyChange, ot as TExistingTableOption, rt as TEnsureTableOptions, t as AtscriptDbReadable, yt as TTableOptionDiff, z as TDbFieldMeta } from "./db-readable-Bn1bV_eC.mjs";
2
- import { c as AtscriptQueryFieldRef$1, i as AtscriptDbView, l as AtscriptQueryNode$1, t as DbSpace } from "./db-space-DdIPYD0Q.mjs";
1
+ import { B as TDbForeignKey, K as TDbObjectKind, L as TDbDefaultValue, O as TColumnDiff, Pt as TGenericLogger, Z as TDbStorageType, at as TExistingForeignKey, ht as TReferencingForeignKey, it as TExistingColumn, mt as TPrimaryKeyChange, ot as TExistingTableOption, rt as TEnsureTableOptions, t as AtscriptDbReadable, yt as TTableOptionDiff, z as TDbFieldMeta } from "./db-readable-D8aa-wfP.mjs";
2
+ import { c as AtscriptQueryFieldRef$1, i as AtscriptDbView, l as AtscriptQueryNode$1, t as DbSpace } from "./db-space-B4MjNjY4.mjs";
3
3
  import { TAtscriptAnnotatedType } from "@atscript/typescript/utils";
4
4
 
5
5
  //#region src/schema/sync-entry.d.ts
package/dist/sync.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { M as NoopLogger } from "./db-view-Dl0aDTiT.mjs";
1
+ import { M as NoopLogger } from "./db-view-BYH4HJ-U.mjs";
2
2
  //#region src/schema/schema-hash.ts
3
3
  /** Extracts sorted field snapshots from a readable's field descriptors. */
4
4
  function extractFieldSnapshots(fields, typeMapper) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atscript/db",
3
- "version": "0.1.129",
3
+ "version": "0.1.131",
4
4
  "description": "Database adapter utilities for atscript.",
5
5
  "keywords": [
6
6
  "atscript",