@atscript/db 0.1.60 → 0.1.61

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.
@@ -1358,9 +1358,16 @@ declare class AtscriptDbReadable<T extends TAtscriptAnnotatedType = TAtscriptAnn
1358
1358
  controls?: UniqueryControls<OwnProps, NavType>;
1359
1359
  } = Record<string, never>>(id: IdType, query?: Q): Promise<DbResponse<DataType, NavType, Q> | null>;
1360
1360
  /**
1361
- * Resolves an id value into a filter expression.
1361
+ * Resolve an id value into a filter expression.
1362
+ *
1363
+ * When `preferredId` differs from the PK, scalar ids resolve only against
1364
+ * the preferred field (deterministic addressing). Otherwise scalars try PK
1365
+ * + every single-field unique index; objects try PK + compound unique
1366
+ * indexes.
1362
1367
  */
1363
1368
  protected _resolveIdFilter(id: unknown): FilterExpr | null;
1369
+ /** Build a single-key filter from `idObj` over `fields`, or null if any field is missing/incompatible. */
1370
+ private _tryCompoundFilter;
1364
1371
  /**
1365
1372
  * Attempts to build a single-field filter `{ field: preparedId }`.
1366
1373
  */
@@ -1358,9 +1358,16 @@ declare class AtscriptDbReadable<T extends TAtscriptAnnotatedType = TAtscriptAnn
1358
1358
  controls?: UniqueryControls<OwnProps, NavType>;
1359
1359
  } = Record<string, never>>(id: IdType, query?: Q): Promise<DbResponse<DataType, NavType, Q> | null>;
1360
1360
  /**
1361
- * Resolves an id value into a filter expression.
1361
+ * Resolve an id value into a filter expression.
1362
+ *
1363
+ * When `preferredId` differs from the PK, scalar ids resolve only against
1364
+ * the preferred field (deterministic addressing). Otherwise scalars try PK
1365
+ * + every single-field unique index; objects try PK + compound unique
1366
+ * indexes.
1362
1367
  */
1363
1368
  protected _resolveIdFilter(id: unknown): FilterExpr | null;
1369
+ /** Build a single-key filter from `idObj` over `fields`, or null if any field is missing/incompatible. */
1370
+ private _tryCompoundFilter;
1364
1371
  /**
1365
1372
  * Attempts to build a single-field filter `{ field: preparedId }`.
1366
1373
  */
@@ -1,6 +1,6 @@
1
- import { B as TDbInsertResult, J as TFkLookupResolver, N as TDbDeleteResult, W as TDbUpdateResult, dt as TableMetadata, it as TTableResolver, o as BaseDbAdapter, ot as TWriteTableResolver, pt as TGenericLogger, t as AtscriptDbReadable, x as TCascadeResolver, z as TDbInsertManyResult } from "./db-readable-CkeVx10t.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 { B as TDbInsertResult, J as TFkLookupResolver, N as TDbDeleteResult, W as TDbUpdateResult, dt as TableMetadata, it as TTableResolver, o as BaseDbAdapter, ot as TWriteTableResolver, pt as TGenericLogger, t as AtscriptDbReadable, x as TCascadeResolver, z as TDbInsertManyResult } from "./db-readable-DlETDVM1.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
  /**
@@ -1,6 +1,6 @@
1
- import { B as TDbInsertResult, J as TFkLookupResolver, N as TDbDeleteResult, W as TDbUpdateResult, dt as TableMetadata, it as TTableResolver, o as BaseDbAdapter, ot as TWriteTableResolver, pt as TGenericLogger, t as AtscriptDbReadable, x as TCascadeResolver, z as TDbInsertManyResult } from "./db-readable-CKQHMqVH.cjs";
2
- import { FilterExpr } from "@uniqu/core";
1
+ import { B as TDbInsertResult, J as TFkLookupResolver, N as TDbDeleteResult, W as TDbUpdateResult, dt as TableMetadata, it as TTableResolver, o as BaseDbAdapter, ot as TWriteTableResolver, pt as TGenericLogger, t as AtscriptDbReadable, x as TCascadeResolver, z as TDbInsertManyResult } from "./db-readable-u_a4USn9.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
  /**
@@ -1508,68 +1508,56 @@ var AtscriptDbReadable = class {
1508
1508
  });
1509
1509
  }
1510
1510
  /**
1511
- * Resolves an id value into a filter expression.
1511
+ * Resolve an id value into a filter expression.
1512
+ *
1513
+ * When `preferredId` differs from the PK, scalar ids resolve only against
1514
+ * the preferred field (deterministic addressing). Otherwise scalars try PK
1515
+ * + every single-field unique index; objects try PK + compound unique
1516
+ * indexes.
1512
1517
  */
1513
1518
  _resolveIdFilter(id) {
1514
- const orFilters = [];
1515
1519
  const pkFields = this.primaryKeys;
1516
- if (pkFields.length === 1) {
1517
- const filter = this._tryFieldFilter(pkFields[0], id);
1520
+ const preferredFields = this.preferredId;
1521
+ const isExplicitPreferred = preferredFields.length !== pkFields.length || preferredFields.some((f, i) => f !== pkFields[i]);
1522
+ const isScalar = id === null || typeof id !== "object";
1523
+ if (isScalar && isExplicitPreferred && preferredFields.length === 1) return this._tryFieldFilter(preferredFields[0], id);
1524
+ const tryScalarOrField = (field) => {
1525
+ const value = isScalar ? id : id[field];
1526
+ return value === void 0 ? null : this._tryFieldFilter(field, value);
1527
+ };
1528
+ const orFilters = [];
1529
+ const idObj = isScalar ? null : id;
1530
+ for (const ident of this.identifications) {
1531
+ if (ident.fields.length !== 1) continue;
1532
+ const filter = tryScalarOrField(ident.fields[0]);
1518
1533
  if (filter) orFilters.push(filter);
1519
- } else if (pkFields.length > 1 && typeof id === "object" && id !== null) {
1520
- const idObj = id;
1521
- const compositeFilter = {};
1522
- let valid = true;
1523
- for (const field of pkFields) {
1524
- const fieldType = this.flatMap.get(field);
1525
- if (fieldType && !isIdCompatible(idObj[field], fieldType)) {
1526
- valid = false;
1527
- break;
1528
- }
1529
- try {
1530
- compositeFilter[field] = fieldType ? this.adapter.prepareId(idObj[field], fieldType) : idObj[field];
1531
- } catch {
1532
- valid = false;
1533
- break;
1534
- }
1535
- }
1536
- if (valid) orFilters.push(compositeFilter);
1537
1534
  }
1538
- for (const prop of this.uniqueProps) {
1539
- const filter = this._tryFieldFilter(prop, id);
1535
+ if (idObj) for (const ident of this.identifications) {
1536
+ if (ident.fields.length < 2) continue;
1537
+ if (ident.source !== "primaryKey" && orFilters.length > 0) break;
1538
+ const filter = this._tryCompoundFilter(ident.fields, idObj);
1540
1539
  if (filter) orFilters.push(filter);
1541
1540
  }
1542
- if (typeof id === "object" && id !== null && orFilters.length === 0) {
1543
- const idObj = id;
1544
- for (const index of this._meta.indexes.values()) {
1545
- if (index.type !== "unique" || index.fields.length < 2) continue;
1546
- const compoundFilter = {};
1547
- let valid = true;
1548
- for (const indexField of index.fields) {
1549
- const fieldName = indexField.name;
1550
- if (idObj[fieldName] === void 0) {
1551
- valid = false;
1552
- break;
1553
- }
1554
- const fieldType = this.flatMap.get(fieldName);
1555
- if (fieldType && !isIdCompatible(idObj[fieldName], fieldType)) {
1556
- valid = false;
1557
- break;
1558
- }
1559
- try {
1560
- compoundFilter[fieldName] = fieldType ? this.adapter.prepareId(idObj[fieldName], fieldType) : idObj[fieldName];
1561
- } catch {
1562
- valid = false;
1563
- break;
1564
- }
1565
- }
1566
- if (valid) orFilters.push(compoundFilter);
1567
- }
1568
- }
1569
1541
  if (orFilters.length === 0) return null;
1570
1542
  if (orFilters.length === 1) return orFilters[0];
1571
1543
  return { $or: orFilters };
1572
1544
  }
1545
+ /** Build a single-key filter from `idObj` over `fields`, or null if any field is missing/incompatible. */
1546
+ _tryCompoundFilter(fields, idObj) {
1547
+ const filter = {};
1548
+ for (const field of fields) {
1549
+ const value = idObj[field];
1550
+ if (value === void 0) return null;
1551
+ const fieldType = this.flatMap.get(field);
1552
+ if (fieldType && !isIdCompatible(value, fieldType)) return null;
1553
+ try {
1554
+ filter[field] = fieldType ? this.adapter.prepareId(value, fieldType) : value;
1555
+ } catch {
1556
+ return null;
1557
+ }
1558
+ }
1559
+ return filter;
1560
+ }
1573
1561
  /**
1574
1562
  * Attempts to build a single-field filter `{ field: preparedId }`.
1575
1563
  */
@@ -1508,68 +1508,56 @@ var AtscriptDbReadable = class {
1508
1508
  });
1509
1509
  }
1510
1510
  /**
1511
- * Resolves an id value into a filter expression.
1511
+ * Resolve an id value into a filter expression.
1512
+ *
1513
+ * When `preferredId` differs from the PK, scalar ids resolve only against
1514
+ * the preferred field (deterministic addressing). Otherwise scalars try PK
1515
+ * + every single-field unique index; objects try PK + compound unique
1516
+ * indexes.
1512
1517
  */
1513
1518
  _resolveIdFilter(id) {
1514
- const orFilters = [];
1515
1519
  const pkFields = this.primaryKeys;
1516
- if (pkFields.length === 1) {
1517
- const filter = this._tryFieldFilter(pkFields[0], id);
1520
+ const preferredFields = this.preferredId;
1521
+ const isExplicitPreferred = preferredFields.length !== pkFields.length || preferredFields.some((f, i) => f !== pkFields[i]);
1522
+ const isScalar = id === null || typeof id !== "object";
1523
+ if (isScalar && isExplicitPreferred && preferredFields.length === 1) return this._tryFieldFilter(preferredFields[0], id);
1524
+ const tryScalarOrField = (field) => {
1525
+ const value = isScalar ? id : id[field];
1526
+ return value === void 0 ? null : this._tryFieldFilter(field, value);
1527
+ };
1528
+ const orFilters = [];
1529
+ const idObj = isScalar ? null : id;
1530
+ for (const ident of this.identifications) {
1531
+ if (ident.fields.length !== 1) continue;
1532
+ const filter = tryScalarOrField(ident.fields[0]);
1518
1533
  if (filter) orFilters.push(filter);
1519
- } else if (pkFields.length > 1 && typeof id === "object" && id !== null) {
1520
- const idObj = id;
1521
- const compositeFilter = {};
1522
- let valid = true;
1523
- for (const field of pkFields) {
1524
- const fieldType = this.flatMap.get(field);
1525
- if (fieldType && !isIdCompatible(idObj[field], fieldType)) {
1526
- valid = false;
1527
- break;
1528
- }
1529
- try {
1530
- compositeFilter[field] = fieldType ? this.adapter.prepareId(idObj[field], fieldType) : idObj[field];
1531
- } catch {
1532
- valid = false;
1533
- break;
1534
- }
1535
- }
1536
- if (valid) orFilters.push(compositeFilter);
1537
1534
  }
1538
- for (const prop of this.uniqueProps) {
1539
- const filter = this._tryFieldFilter(prop, id);
1535
+ if (idObj) for (const ident of this.identifications) {
1536
+ if (ident.fields.length < 2) continue;
1537
+ if (ident.source !== "primaryKey" && orFilters.length > 0) break;
1538
+ const filter = this._tryCompoundFilter(ident.fields, idObj);
1540
1539
  if (filter) orFilters.push(filter);
1541
1540
  }
1542
- if (typeof id === "object" && id !== null && orFilters.length === 0) {
1543
- const idObj = id;
1544
- for (const index of this._meta.indexes.values()) {
1545
- if (index.type !== "unique" || index.fields.length < 2) continue;
1546
- const compoundFilter = {};
1547
- let valid = true;
1548
- for (const indexField of index.fields) {
1549
- const fieldName = indexField.name;
1550
- if (idObj[fieldName] === void 0) {
1551
- valid = false;
1552
- break;
1553
- }
1554
- const fieldType = this.flatMap.get(fieldName);
1555
- if (fieldType && !isIdCompatible(idObj[fieldName], fieldType)) {
1556
- valid = false;
1557
- break;
1558
- }
1559
- try {
1560
- compoundFilter[fieldName] = fieldType ? this.adapter.prepareId(idObj[fieldName], fieldType) : idObj[fieldName];
1561
- } catch {
1562
- valid = false;
1563
- break;
1564
- }
1565
- }
1566
- if (valid) orFilters.push(compoundFilter);
1567
- }
1568
- }
1569
1541
  if (orFilters.length === 0) return null;
1570
1542
  if (orFilters.length === 1) return orFilters[0];
1571
1543
  return { $or: orFilters };
1572
1544
  }
1545
+ /** Build a single-key filter from `idObj` over `fields`, or null if any field is missing/incompatible. */
1546
+ _tryCompoundFilter(fields, idObj) {
1547
+ const filter = {};
1548
+ for (const field of fields) {
1549
+ const value = idObj[field];
1550
+ if (value === void 0) return null;
1551
+ const fieldType = this.flatMap.get(field);
1552
+ if (fieldType && !isIdCompatible(value, fieldType)) return null;
1553
+ try {
1554
+ filter[field] = fieldType ? this.adapter.prepareId(value, fieldType) : value;
1555
+ } catch {
1556
+ return null;
1557
+ }
1558
+ }
1559
+ return filter;
1560
+ }
1573
1561
  /**
1574
1562
  * Attempts to build a single-field filter `{ field: preparedId }`.
1575
1563
  */
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-D8tQhNgM.cjs");
3
- const require_db_view = require("./db-view-CuPkKCnU.cjs");
3
+ const require_db_view = require("./db-view-CUgkcEfd.cjs");
4
4
  const require_ops = require("./ops.cjs");
5
5
  const require_validator = require("./validator-BIuw_T0k.cjs");
6
6
  require("./nested-writer-v_LPR1yJ.cjs");
package/dist/index.d.cts CHANGED
@@ -1,6 +1,6 @@
1
- import { $ as TMetadataOverrides, A as TDbCollation, B as TDbInsertResult, C as TColumnDiff, D as TDbActionIntent, E as TDbActionInfo, F as TDbForeignKey, G as TExistingColumn, H as TDbRelation, I as TDbIndex, J as TFkLookupResolver, K as TExistingTableOption, L as TDbIndexField, M as TDbDefaultValue, N as TDbDeleteResult, O as TDbActionLevel, P as TDbFieldMeta, Q as TMetaResponse, R as TDbIndexType, S as TCascadeTarget, T as TCrudPermissions, U as TDbStorageType, V as TDbReferentialAction, W as TDbUpdateResult, X as TIdDescriptor, Y as TFkLookupTarget, Z as TIdentification, _ as FlatOf, a as FieldMappingStrategy, at as TValueFormatterPair, b as PrimaryKeyOf, c as AggregateExpr, ct as Uniquery, d as AggregateResult, dt as TableMetadata, et as TRelationInfo, f as AtscriptDbWritable, ft as NoopLogger, g as FilterExpr, h as FieldOpsFor, i as DocumentFieldMapper, it as TTableResolver, j as TDbDefaultFn, k as TDbActionProcessor, l as AggregateFn, lt as UniqueryControls, m as DbQuery, mt as UniquSelect, n as DbResponse, nt as TSyncColumnResult, o as BaseDbAdapter, ot as TWriteTableResolver, p as DbControls, pt as TGenericLogger, q as TFieldMeta, r as resolveDesignType, rt as TTableOptionDiff, s as AggregateControls, st as TypedWithRelation, t as AtscriptDbReadable, tt as TSearchIndexInfo, u as AggregateQuery, ut as WithRelation, v as NavPropsOf, w as TCrudOp, x as TCascadeResolver, y as OwnPropsOf, z as TDbInsertManyResult } from "./db-readable-CKQHMqVH.cjs";
1
+ import { $ as TMetadataOverrides, A as TDbCollation, B as TDbInsertResult, C as TColumnDiff, D as TDbActionIntent, E as TDbActionInfo, F as TDbForeignKey, G as TExistingColumn, H as TDbRelation, I as TDbIndex, J as TFkLookupResolver, K as TExistingTableOption, L as TDbIndexField, M as TDbDefaultValue, N as TDbDeleteResult, O as TDbActionLevel, P as TDbFieldMeta, Q as TMetaResponse, R as TDbIndexType, S as TCascadeTarget, T as TCrudPermissions, U as TDbStorageType, V as TDbReferentialAction, W as TDbUpdateResult, X as TIdDescriptor, Y as TFkLookupTarget, Z as TIdentification, _ as FlatOf, a as FieldMappingStrategy, at as TValueFormatterPair, b as PrimaryKeyOf, c as AggregateExpr, ct as Uniquery, d as AggregateResult, dt as TableMetadata, et as TRelationInfo, f as AtscriptDbWritable, ft as NoopLogger, g as FilterExpr, h as FieldOpsFor, i as DocumentFieldMapper, it as TTableResolver, j as TDbDefaultFn, k as TDbActionProcessor, l as AggregateFn, lt as UniqueryControls, m as DbQuery, mt as UniquSelect, n as DbResponse, nt as TSyncColumnResult, o as BaseDbAdapter, ot as TWriteTableResolver, p as DbControls, pt as TGenericLogger, q as TFieldMeta, r as resolveDesignType, rt as TTableOptionDiff, s as AggregateControls, st as TypedWithRelation, t as AtscriptDbReadable, tt as TSearchIndexInfo, u as AggregateQuery, ut as WithRelation, v as NavPropsOf, w as TCrudOp, x as TCascadeResolver, y as OwnPropsOf, z as TDbInsertManyResult } from "./db-readable-DlETDVM1.cjs";
2
2
  import { a as $remove, c as $upsert, d as getDbFieldOp, f as isDbFieldOp, i as $mul, l as TDbFieldOp, n as $inc, o as $replace, p as separateFieldOps, r as $insert, s as $update, t as $dec, u as TFieldOps } from "./ops-DXJ4Zw0P.cjs";
3
- import { a as AtscriptQueryComparison, c as AtscriptRef, d as translateQueryTree, f as AtscriptDbTable, i as TViewColumnMapping, l as TViewJoin, m as NativeIntegrity, n as TAdapterFactory, o as AtscriptQueryFieldRef, p as IntegrityStrategy, r as AtscriptDbView, s as AtscriptQueryNode, t as DbSpace, u as TViewPlan } from "./db-space-Dycn4usM.cjs";
3
+ import { a as AtscriptQueryComparison, c as AtscriptRef, d as translateQueryTree, f as AtscriptDbTable, i as TViewColumnMapping, l as TViewJoin, m as NativeIntegrity, n as TAdapterFactory, o as AtscriptQueryFieldRef, p as IntegrityStrategy, r as AtscriptDbView, s as AtscriptQueryNode, t as DbSpace, u as TViewPlan } from "./db-space-D91_jy6o.cjs";
4
4
  import { n as createDbValidatorPlugin, t as DbValidationContext } from "./db-validator-plugin-DRGMCEn3.cjs";
5
5
  import { c as TArrayPatch, i as buildValidationContext, l as TDbPatch, n as ValidatorMode, o as forceNavNonOptional, r as buildDbValidator, s as isNavRelation, t as ValidationContext, u as getKeyProps } from "./validator-_z_A3cKa.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 TMetadataOverrides, A as TDbCollation, B as TDbInsertResult, C as TColumnDiff, D as TDbActionIntent, E as TDbActionInfo, F as TDbForeignKey, G as TExistingColumn, H as TDbRelation, I as TDbIndex, J as TFkLookupResolver, K as TExistingTableOption, L as TDbIndexField, M as TDbDefaultValue, N as TDbDeleteResult, O as TDbActionLevel, P as TDbFieldMeta, Q as TMetaResponse, R as TDbIndexType, S as TCascadeTarget, T as TCrudPermissions, U as TDbStorageType, V as TDbReferentialAction, W as TDbUpdateResult, X as TIdDescriptor, Y as TFkLookupTarget, Z as TIdentification, _ as FlatOf, a as FieldMappingStrategy, at as TValueFormatterPair, b as PrimaryKeyOf, c as AggregateExpr, ct as Uniquery, d as AggregateResult, dt as TableMetadata, et as TRelationInfo, f as AtscriptDbWritable, ft as NoopLogger, g as FilterExpr, h as FieldOpsFor, i as DocumentFieldMapper, it as TTableResolver, j as TDbDefaultFn, k as TDbActionProcessor, l as AggregateFn, lt as UniqueryControls, m as DbQuery, mt as UniquSelect, n as DbResponse, nt as TSyncColumnResult, o as BaseDbAdapter, ot as TWriteTableResolver, p as DbControls, pt as TGenericLogger, q as TFieldMeta, r as resolveDesignType, rt as TTableOptionDiff, s as AggregateControls, st as TypedWithRelation, t as AtscriptDbReadable, tt as TSearchIndexInfo, u as AggregateQuery, ut as WithRelation, v as NavPropsOf, w as TCrudOp, x as TCascadeResolver, y as OwnPropsOf, z as TDbInsertManyResult } from "./db-readable-CkeVx10t.mjs";
1
+ import { $ as TMetadataOverrides, A as TDbCollation, B as TDbInsertResult, C as TColumnDiff, D as TDbActionIntent, E as TDbActionInfo, F as TDbForeignKey, G as TExistingColumn, H as TDbRelation, I as TDbIndex, J as TFkLookupResolver, K as TExistingTableOption, L as TDbIndexField, M as TDbDefaultValue, N as TDbDeleteResult, O as TDbActionLevel, P as TDbFieldMeta, Q as TMetaResponse, R as TDbIndexType, S as TCascadeTarget, T as TCrudPermissions, U as TDbStorageType, V as TDbReferentialAction, W as TDbUpdateResult, X as TIdDescriptor, Y as TFkLookupTarget, Z as TIdentification, _ as FlatOf, a as FieldMappingStrategy, at as TValueFormatterPair, b as PrimaryKeyOf, c as AggregateExpr, ct as Uniquery, d as AggregateResult, dt as TableMetadata, et as TRelationInfo, f as AtscriptDbWritable, ft as NoopLogger, g as FilterExpr, h as FieldOpsFor, i as DocumentFieldMapper, it as TTableResolver, j as TDbDefaultFn, k as TDbActionProcessor, l as AggregateFn, lt as UniqueryControls, m as DbQuery, mt as UniquSelect, n as DbResponse, nt as TSyncColumnResult, o as BaseDbAdapter, ot as TWriteTableResolver, p as DbControls, pt as TGenericLogger, q as TFieldMeta, r as resolveDesignType, rt as TTableOptionDiff, s as AggregateControls, st as TypedWithRelation, t as AtscriptDbReadable, tt as TSearchIndexInfo, u as AggregateQuery, ut as WithRelation, v as NavPropsOf, w as TCrudOp, x as TCascadeResolver, y as OwnPropsOf, z as TDbInsertManyResult } from "./db-readable-u_a4USn9.mjs";
2
2
  import { a as $remove, c as $upsert, d as getDbFieldOp, f as isDbFieldOp, i as $mul, l as TDbFieldOp, n as $inc, o as $replace, p as separateFieldOps, r as $insert, s as $update, t as $dec, u as TFieldOps } from "./ops-C61kelof.mjs";
3
- import { a as AtscriptQueryComparison, c as AtscriptRef, d as translateQueryTree, f as AtscriptDbTable, i as TViewColumnMapping, l as TViewJoin, m as NativeIntegrity, n as TAdapterFactory, o as AtscriptQueryFieldRef, p as IntegrityStrategy, r as AtscriptDbView, s as AtscriptQueryNode, t as DbSpace, u as TViewPlan } from "./db-space-BAfXlRiV.mjs";
3
+ import { a as AtscriptQueryComparison, c as AtscriptRef, d as translateQueryTree, f as AtscriptDbTable, i as TViewColumnMapping, l as TViewJoin, m as NativeIntegrity, n as TAdapterFactory, o as AtscriptQueryFieldRef, p as IntegrityStrategy, r as AtscriptDbView, s as AtscriptQueryNode, t as DbSpace, u as TViewPlan } from "./db-space-DrqS4wYe.mjs";
4
4
  import { n as createDbValidatorPlugin, t as DbValidationContext } from "./db-validator-plugin-DDvYyv5t.mjs";
5
5
  import { c as TArrayPatch, i as buildValidationContext, l as TDbPatch, n as ValidatorMode, o as forceNavNonOptional, r as buildDbValidator, s as isNavRelation, t as ValidationContext, u as getKeyProps } from "./validator-DttN2e5_.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 { t as DbError } from "./db-error-Cepx-RsQ.mjs";
2
- import { a as BaseDbAdapter, c as AtscriptDbReadable, d as DocumentFieldMapper, f as FieldMappingStrategy, h as NoopLogger, i as ApplicationIntegrity, l as resolveDesignType, m as TableMetadata, n as AtscriptDbTable, o as IntegrityStrategy, p as UniquSelect, r as decomposePatch, s as NativeIntegrity, t as AtscriptDbView, u as RelationalFieldMapper } from "./db-view-cBN0YqrV.mjs";
2
+ import { a as BaseDbAdapter, c as AtscriptDbReadable, d as DocumentFieldMapper, f as FieldMappingStrategy, h as NoopLogger, i as ApplicationIntegrity, l as resolveDesignType, m as TableMetadata, n as AtscriptDbTable, o as IntegrityStrategy, p as UniquSelect, r as decomposePatch, s as NativeIntegrity, t as AtscriptDbView, u as RelationalFieldMapper } from "./db-view-iGzjzK86.mjs";
3
3
  import { $dec, $inc, $insert, $mul, $remove, $replace, $update, $upsert, getDbFieldOp, isDbFieldOp, separateFieldOps } from "./ops.mjs";
4
4
  import { a as isNavRelation, i as forceNavNonOptional, n as buildValidationContext, o as createDbValidatorPlugin, s as getKeyProps, t as buildDbValidator } from "./validator-BB5h1Le3.mjs";
5
5
  import "./nested-writer-CT2rLURx.mjs";
package/dist/rel.d.cts CHANGED
@@ -1,4 +1,4 @@
1
- import { F as TDbForeignKey, H as TDbRelation, dt as TableMetadata, it as TTableResolver, o as BaseDbAdapter, ot as TWriteTableResolver, pt as TGenericLogger } from "./db-readable-CKQHMqVH.cjs";
1
+ import { F as TDbForeignKey, H as TDbRelation, dt as TableMetadata, it as TTableResolver, o as BaseDbAdapter, ot as TWriteTableResolver, pt as TGenericLogger } from "./db-readable-DlETDVM1.cjs";
2
2
  import { t as DbValidationContext } from "./db-validator-plugin-DRGMCEn3.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 { F as TDbForeignKey, H as TDbRelation, dt as TableMetadata, it as TTableResolver, o as BaseDbAdapter, ot as TWriteTableResolver, pt as TGenericLogger } from "./db-readable-CkeVx10t.mjs";
1
+ import { F as TDbForeignKey, H as TDbRelation, dt as TableMetadata, it as TTableResolver, o as BaseDbAdapter, ot as TWriteTableResolver, pt as TGenericLogger } from "./db-readable-u_a4USn9.mjs";
2
2
  import { t as DbValidationContext } from "./db-validator-plugin-DDvYyv5t.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-CuPkKCnU.cjs");
2
+ const require_db_view = require("./db-view-CUgkcEfd.cjs");
3
3
  require("./validator-BIuw_T0k.cjs");
4
4
  require("./nested-writer-v_LPR1yJ.cjs");
5
5
  //#region src/schema/schema-hash.ts
package/dist/sync.d.cts CHANGED
@@ -1,5 +1,5 @@
1
- import { C as TColumnDiff, F as TDbForeignKey, G as TExistingColumn, K as TExistingTableOption, M as TDbDefaultValue, P as TDbFieldMeta, U as TDbStorageType, pt as TGenericLogger, rt as TTableOptionDiff, t as AtscriptDbReadable } from "./db-readable-CKQHMqVH.cjs";
2
- import { r as AtscriptDbView, t as DbSpace } from "./db-space-Dycn4usM.cjs";
1
+ import { C as TColumnDiff, F as TDbForeignKey, G as TExistingColumn, K as TExistingTableOption, M as TDbDefaultValue, P as TDbFieldMeta, U as TDbStorageType, pt as TGenericLogger, rt as TTableOptionDiff, t as AtscriptDbReadable } from "./db-readable-DlETDVM1.cjs";
2
+ import { r as AtscriptDbView, t as DbSpace } from "./db-space-D91_jy6o.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 { C as TColumnDiff, F as TDbForeignKey, G as TExistingColumn, K as TExistingTableOption, M as TDbDefaultValue, P as TDbFieldMeta, U as TDbStorageType, pt as TGenericLogger, rt as TTableOptionDiff, t as AtscriptDbReadable } from "./db-readable-CkeVx10t.mjs";
2
- import { r as AtscriptDbView, t as DbSpace } from "./db-space-BAfXlRiV.mjs";
1
+ import { C as TColumnDiff, F as TDbForeignKey, G as TExistingColumn, K as TExistingTableOption, M as TDbDefaultValue, P as TDbFieldMeta, U as TDbStorageType, pt as TGenericLogger, rt as TTableOptionDiff, t as AtscriptDbReadable } from "./db-readable-u_a4USn9.mjs";
2
+ import { r as AtscriptDbView, t as DbSpace } from "./db-space-DrqS4wYe.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 { h as NoopLogger } from "./db-view-cBN0YqrV.mjs";
1
+ import { h as NoopLogger } from "./db-view-iGzjzK86.mjs";
2
2
  import "./validator-BB5h1Le3.mjs";
3
3
  import "./nested-writer-CT2rLURx.mjs";
4
4
  //#region src/schema/schema-hash.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atscript/db",
3
- "version": "0.1.60",
3
+ "version": "0.1.61",
4
4
  "description": "Database adapter utilities for atscript.",
5
5
  "keywords": [
6
6
  "atscript",