@atscript/db 0.1.136 → 0.1.137

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.
@@ -0,0 +1,24 @@
1
+ import { D as TColumnDiff, R as TDbFieldMeta, rt as TExistingColumn } from "./buckets-BFG2RYRW.mjs";
2
+
3
+ //#region src/schema/column-diff.d.ts
4
+ /**
5
+ * Whether a live column's type differs from the type the adapter's
6
+ * `typeMapper` gives the field — the one rule schema sync diffs column types
7
+ * by (case-insensitive). Exported for adapters that must agree with it (the
8
+ * PostgreSQL recreate converts exactly the columns this reports changed).
9
+ * @since 0.1.137
10
+ */
11
+ declare function isColumnTypeChanged(existingType: string, expectedType: string): boolean;
12
+ /**
13
+ * Computes the difference between desired schema fields and existing database columns.
14
+ *
15
+ * @param desired - Field descriptors from the Atscript type (after flattening).
16
+ * @param existing - Columns currently in the database (from introspection).
17
+ * @param typeMapper - Optional function to map field metadata to DB-native type strings.
18
+ * Receives the full field meta (design type, annotations, PK status, etc.)
19
+ * so adapters can produce context-aware types (e.g., `VARCHAR(255)` from maxLength).
20
+ * Required for type change detection.
21
+ */
22
+ declare function computeColumnDiff(desired: readonly TDbFieldMeta[], existing: TExistingColumn[], typeMapper?: (field: TDbFieldMeta) => string): TColumnDiff;
23
+ //#endregion
24
+ export { isColumnTypeChanged as n, computeColumnDiff as t };
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-DTkkeu5b.cjs");
3
- const require_db_view = require("./db-view-BAzhEUxB.cjs");
3
+ const require_column_diff = require("./column-diff-CgxgFKzx.cjs");
4
4
  const require_aggregate_fns = require("./aggregate-fns-CGBv3E8S.cjs");
5
5
  const require_nested_writer = require("./nested-writer-BZNCuqI6.cjs");
6
6
  const require_validator = require("./validator-BtZbcLN2.cjs");
@@ -240,7 +240,7 @@ var DbSpace = class {
240
240
  if (loggerOrOptions && typeof loggerOrOptions.error === "function") this.logger = loggerOrOptions;
241
241
  else {
242
242
  const options = loggerOrOptions ?? {};
243
- this.logger = options.logger ?? require_db_view.NoopLogger;
243
+ this.logger = options.logger ?? require_column_diff.NoopLogger;
244
244
  if (options.encryption) this._encryption = new DbEncryption(options.encryption);
245
245
  }
246
246
  }
@@ -259,9 +259,9 @@ var DbSpace = class {
259
259
  getTable(type, logger) {
260
260
  let readable = this._readables.get(type);
261
261
  if (!readable) {
262
- readable = new require_db_view.AtscriptDbTable(type, this.adapterFactory(), logger || this.logger, (t) => this.get(t), (t) => {
262
+ readable = new require_column_diff.AtscriptDbTable(type, this._createAdapter(), logger || this.logger, (t) => this.get(t), (t) => {
263
263
  const resolved = this.get(t);
264
- return resolved instanceof require_db_view.AtscriptDbTable ? resolved : void 0;
264
+ return resolved instanceof require_column_diff.AtscriptDbTable ? resolved : void 0;
265
265
  });
266
266
  this._allTables.add(readable);
267
267
  readable.setCascadeResolver((tableName) => this._getCascadeTargets(tableName));
@@ -278,7 +278,7 @@ var DbSpace = class {
278
278
  getView(type, logger) {
279
279
  let readable = this._readables.get(type);
280
280
  if (!readable) {
281
- readable = new require_db_view.AtscriptDbView(type, this.adapterFactory(), logger || this.logger, (t) => this.get(t));
281
+ readable = new require_column_diff.AtscriptDbView(type, this._createAdapter(), logger || this.logger, (t) => this.get(t));
282
282
  readable.setEncryption(this._encryption);
283
283
  this._readables.set(type, readable);
284
284
  }
@@ -293,17 +293,17 @@ var DbSpace = class {
293
293
  }
294
294
  /**
295
295
  * Drops a table by name. Used by schema sync to remove tables no longer in the schema.
296
+ * See `BaseDbAdapter.dropTableByName` for an adapter that does not support it.
296
297
  */
297
298
  async dropTableByName(tableName) {
298
- const adapter = this._getAdminAdapter();
299
- if (adapter.dropTableByName) await adapter.dropTableByName(tableName);
299
+ await this._getAdminAdapter().dropTableByName(tableName);
300
300
  }
301
301
  /**
302
302
  * Drops a view by name. Used by schema sync to remove views no longer in the schema.
303
+ * See `BaseDbAdapter.dropViewByName` for an adapter that does not support it.
303
304
  */
304
305
  async dropViewByName(viewName) {
305
- const adapter = this._getAdminAdapter();
306
- if (adapter.dropViewByName) await adapter.dropViewByName(viewName);
306
+ await this._getAdminAdapter().dropViewByName(viewName);
307
307
  }
308
308
  /**
309
309
  * Drops a group of mutually referencing tables as one operation.
@@ -329,7 +329,16 @@ var DbSpace = class {
329
329
  * schema for those from the driver/connection, not from a bound table.
330
330
  */
331
331
  _getAdminAdapter() {
332
- return this._adminAdapter ??= this.adapterFactory();
332
+ return this._adminAdapter ??= this._createAdapter();
333
+ }
334
+ /**
335
+ * A factory-fresh adapter that knows its space (see `BaseDbAdapter.registerSpace`).
336
+ * Optional call: an adapter built against an older `@atscript/db` copy lacks it.
337
+ */
338
+ _createAdapter() {
339
+ const adapter = this.adapterFactory();
340
+ adapter.registerSpace?.(this);
341
+ return adapter;
333
342
  }
334
343
  /**
335
344
  * Finds all child tables with FKs pointing to the given parent table name.
@@ -392,40 +401,40 @@ exports.$remove = require_ops.$remove;
392
401
  exports.$replace = require_ops.$replace;
393
402
  exports.$update = require_ops.$update;
394
403
  exports.$upsert = require_ops.$upsert;
395
- exports.ADAPTER_FILTER_REASON = require_db_view.ADAPTER_FILTER_REASON;
404
+ exports.ADAPTER_FILTER_REASON = require_column_diff.ADAPTER_FILTER_REASON;
396
405
  exports.ALL_AGGREGATE_FNS = require_aggregate_fns.ALL_AGGREGATE_FNS;
397
- exports.ALL_BUCKET_UNITS = require_db_view.ALL_BUCKET_UNITS;
398
- exports.ApplicationIntegrity = require_db_view.ApplicationIntegrity;
399
- exports.AtscriptDbReadable = require_db_view.AtscriptDbReadable;
400
- exports.AtscriptDbTable = require_db_view.AtscriptDbTable;
401
- exports.AtscriptDbView = require_db_view.AtscriptDbView;
402
- exports.BaseDbAdapter = require_db_view.BaseDbAdapter;
406
+ exports.ALL_BUCKET_UNITS = require_column_diff.ALL_BUCKET_UNITS;
407
+ exports.ApplicationIntegrity = require_column_diff.ApplicationIntegrity;
408
+ exports.AtscriptDbReadable = require_column_diff.AtscriptDbReadable;
409
+ exports.AtscriptDbTable = require_column_diff.AtscriptDbTable;
410
+ exports.AtscriptDbView = require_column_diff.AtscriptDbView;
411
+ exports.BaseDbAdapter = require_column_diff.BaseDbAdapter;
403
412
  exports.CasExhaustedError = require_db_error.CasExhaustedError;
404
413
  exports.CasMismatchError = require_db_error.CasMismatchError;
405
414
  exports.DEFAULT_DB_SPACE = require_consts.DEFAULT_DB_SPACE;
406
415
  exports.DbEncryption = DbEncryption;
407
416
  exports.DbError = require_db_error.DbError;
408
417
  exports.DbSpace = DbSpace;
409
- exports.DocumentFieldMapper = require_db_view.DocumentFieldMapper;
410
- exports.ENCRYPTED_REASON = require_db_view.ENCRYPTED_REASON;
411
- exports.FieldMappingStrategy = require_db_view.FieldMappingStrategy;
412
- exports.IntegrityStrategy = require_db_view.IntegrityStrategy;
413
- exports.NativeIntegrity = require_db_view.NativeIntegrity;
414
- exports.NoopLogger = require_db_view.NoopLogger;
415
- exports.RelationalFieldMapper = require_db_view.RelationalFieldMapper;
416
- exports.TableMetadata = require_db_view.TableMetadata;
417
- exports.UniquSelect = require_db_view.UniquSelect;
418
- exports.acceptedOperatorsHint = require_db_view.acceptedOperatorsHint;
419
- exports.assertGeoPoint = require_db_view.assertGeoPoint;
420
- exports.assertNoVersionWrites = require_db_view.assertNoVersionWrites;
421
- exports.bucketSourceVerdict = require_db_view.bucketSourceVerdict;
418
+ exports.DocumentFieldMapper = require_column_diff.DocumentFieldMapper;
419
+ exports.ENCRYPTED_REASON = require_column_diff.ENCRYPTED_REASON;
420
+ exports.FieldMappingStrategy = require_column_diff.FieldMappingStrategy;
421
+ exports.IntegrityStrategy = require_column_diff.IntegrityStrategy;
422
+ exports.NativeIntegrity = require_column_diff.NativeIntegrity;
423
+ exports.NoopLogger = require_column_diff.NoopLogger;
424
+ exports.RelationalFieldMapper = require_column_diff.RelationalFieldMapper;
425
+ exports.TableMetadata = require_column_diff.TableMetadata;
426
+ exports.UniquSelect = require_column_diff.UniquSelect;
427
+ exports.acceptedOperatorsHint = require_column_diff.acceptedOperatorsHint;
428
+ exports.assertGeoPoint = require_column_diff.assertGeoPoint;
429
+ exports.assertNoVersionWrites = require_column_diff.assertNoVersionWrites;
430
+ exports.bucketSourceVerdict = require_column_diff.bucketSourceVerdict;
422
431
  exports.bucketTimeZoneUnavailable = require_db_error.bucketTimeZoneUnavailable;
423
432
  exports.buildDbValidator = require_validator.buildDbValidator;
424
433
  exports.buildValidationContext = require_validator.buildValidationContext;
425
- exports.canFilterLeaf = require_db_view.canFilterLeaf;
426
- exports.checkHavingKeys = require_db_view.checkHavingKeys;
427
- exports.classifyQueryPath = require_db_view.classifyQueryPath;
428
- exports.collectQueryPaths = require_db_view.collectQueryPaths;
434
+ exports.canFilterLeaf = require_column_diff.canFilterLeaf;
435
+ exports.checkHavingKeys = require_column_diff.checkHavingKeys;
436
+ exports.classifyQueryPath = require_column_diff.classifyQueryPath;
437
+ exports.collectQueryPaths = require_column_diff.collectQueryPaths;
429
438
  Object.defineProperty(exports, "computeInsights", {
430
439
  enumerable: true,
431
440
  get: function() {
@@ -433,25 +442,26 @@ Object.defineProperty(exports, "computeInsights", {
433
442
  }
434
443
  });
435
444
  exports.createDbValidatorPlugin = require_validator.createDbValidatorPlugin;
436
- exports.createFailureCollector = require_db_view.createFailureCollector;
437
- exports.decomposePatch = require_db_view.decomposePatch;
438
- exports.findAncestorInSet = require_db_view.findAncestorInSet;
445
+ exports.createFailureCollector = require_column_diff.createFailureCollector;
446
+ exports.decomposePatch = require_column_diff.decomposePatch;
447
+ exports.findAncestorInSet = require_column_diff.findAncestorInSet;
439
448
  exports.forceNavNonOptional = require_validator.forceNavNonOptional;
440
449
  exports.getDbFieldOp = require_ops.getDbFieldOp;
441
450
  exports.getKeyProps = require_validator.getKeyProps;
442
- exports.guardAggregate = require_db_view.guardAggregate;
443
- exports.guardFilter = require_db_view.guardFilter;
444
- exports.guardPath = require_db_view.guardPath;
445
- exports.guardPaths = require_db_view.guardPaths;
446
- exports.guardQuery = require_db_view.guardQuery;
447
- exports.isAtscriptDbView = require_db_view.isAtscriptDbView;
448
- exports.isBucketableField = require_db_view.isBucketableField;
451
+ exports.guardAggregate = require_column_diff.guardAggregate;
452
+ exports.guardFilter = require_column_diff.guardFilter;
453
+ exports.guardPath = require_column_diff.guardPath;
454
+ exports.guardPaths = require_column_diff.guardPaths;
455
+ exports.guardQuery = require_column_diff.guardQuery;
456
+ exports.isAtscriptDbView = require_column_diff.isAtscriptDbView;
457
+ exports.isBucketableField = require_column_diff.isBucketableField;
458
+ exports.isColumnTypeChanged = require_column_diff.isColumnTypeChanged;
449
459
  exports.isDbFieldOp = require_ops.isDbFieldOp;
450
460
  exports.isEmptyObject = require_validator.isEmptyObject;
451
461
  exports.isFieldRef = isFieldRef;
452
- exports.isGeoIndexableType = require_db_view.isGeoIndexableType;
453
- exports.isGeoPointType = require_db_view.isGeoPointType;
454
- exports.isJsonValueField = require_db_view.isJsonValueField;
462
+ exports.isGeoIndexableType = require_column_diff.isGeoIndexableType;
463
+ exports.isGeoPointType = require_column_diff.isGeoPointType;
464
+ exports.isJsonValueField = require_column_diff.isJsonValueField;
455
465
  exports.isNavRelation = require_validator.isNavRelation;
456
466
  exports.isPlainObject = require_validator.isPlainObject;
457
467
  Object.defineProperty(exports, "isPrimitive", {
@@ -460,18 +470,18 @@ Object.defineProperty(exports, "isPrimitive", {
460
470
  return _uniqu_core.isPrimitive;
461
471
  }
462
472
  });
463
- exports.jsonValueAncestor = require_db_view.jsonValueAncestor;
464
- exports.narrowerFilterOps = require_db_view.narrowerFilterOps;
465
- exports.normalizeComputedSelect = require_db_view.normalizeComputedSelect;
473
+ exports.jsonValueAncestor = require_column_diff.jsonValueAncestor;
474
+ exports.narrowerFilterOps = require_column_diff.narrowerFilterOps;
475
+ exports.normalizeComputedSelect = require_column_diff.normalizeComputedSelect;
466
476
  exports.reconcileCas = require_ops.reconcileCas;
467
- exports.resolveCalendarBuckets = require_db_view.resolveCalendarBuckets;
468
- exports.resolveDesignType = require_db_view.resolveDesignType;
477
+ exports.resolveCalendarBuckets = require_column_diff.resolveCalendarBuckets;
478
+ exports.resolveDesignType = require_column_diff.resolveDesignType;
469
479
  exports.separateCas = require_ops.separateCas;
470
480
  exports.separateFieldOps = require_ops.separateFieldOps;
471
- exports.sortFieldNames = require_db_view.sortFieldNames;
481
+ exports.sortFieldNames = require_column_diff.sortFieldNames;
472
482
  exports.tableNameOf = require_nested_writer.tableNameOf;
473
483
  exports.translateQueryTree = translateQueryTree;
474
- exports.unsupportedOperatorMessage = require_db_view.unsupportedOperatorMessage;
484
+ exports.unsupportedOperatorMessage = require_column_diff.unsupportedOperatorMessage;
475
485
  Object.defineProperty(exports, "walkFilter", {
476
486
  enumerable: true,
477
487
  get: function() {
package/dist/index.d.cts CHANGED
@@ -1,10 +1,10 @@
1
- import { $ as TDbWriteGuard, A as TDbActionInfo, At as findAncestorInSet, B as TDbIndex, Bt as DocumentFieldMapper, C as OwnPropsOf, Ct as TWriteOptions, D as TColumnDiff, Dt as UniqueryControls, E as TCascadeTarget, Et as Uniquery, F as TDbDefaultFn, Ft as AtscriptDbReadable, G as TDbObjectKind, H as TDbIndexType, Ht as NoopLogger, I as TDbDefaultValue, It as DbResponse, J as TDbRemoveGuard, K as TDbReferentialAction, L as TDbDeleteResult, Lt as resolveDesignType, M as TDbActionLevel, Mt as isGeoPointType, N as TDbActionProcessor, Nt as ALL_BUCKET_UNITS, O as TCrudOp, Ot as WithRelation, P as TDbCollation, Pt as BaseDbAdapter, Q as TDbWriteAction, R as TDbFieldMeta, Rt as DbEncryption, S as NullableOptional, St as TValueFormatterPair, T as TCascadeResolver, Tt as TypedWithRelation, U as TDbInsertManyResult, Ut as TGenericLogger, V as TDbIndexField, Vt as FieldMappingStrategy, W as TDbInsertResult, Wt as UniquSelect, X as TDbStorageType, Y as TDbRemoveGuardContext, Z as TDbUpdateResult, _ as DbRow, _t as TSearchIndexInfo, a as jsonValueAncestor, at as TExistingTableOption, b as FlatOf, bt as TTableResolver, c as AggregateControls, ct as TFkLookupTarget, d as AggregateQuery, dt as TIdentification, et as TDbWriteGuardContext, f as AggregateResult, ft as TMetaResponse, g as DbQuery, gt as TRelationInfo, h as DbPatch, ht as TReferencingForeignKey, i as isJsonValueField, it as TExistingForeignKey, j as TDbActionIntent, jt as isGeoIndexableType, k as TCrudPermissions, kt as TableMetadata, l as AggregateExpr, lt as TIdDescriptor, m as DbControls, mt as TPrimaryKeyChange, n as TResolvedBucket, nt as TEnsureTableOptions, o as normalizeComputedSelect, ot as TFieldMeta, p as AtscriptDbWritable, pt as TMetadataOverrides, q as TDbRelation, r as isBucketableField, rt as TExistingColumn, s as resolveCalendarBuckets, st as TFkLookupResolver, t as TBucketFieldSource, tt as TDeleteOptions, u as AggregateFn, ut as TIdResolveOptions, v as FieldOpsFor, vt as TSyncColumnResult, w as PrimaryKeyOf, wt as TWriteTableResolver, x as NavPropsOf, xt as TTouchManyOptions, y as FilterExpr, yt as TTableOptionDiff, z as TDbForeignKey, zt as TDbEncryptionOptions } from "./buckets-kKY0RKYN.cjs";
1
+ import { $ as TDbWriteGuard, $t as AtscriptDbReadable, A as TDbActionInfo, At as findAncestorInSet, B as TDbIndex, Bt as TViewJsonType, C as OwnPropsOf, Ct as TWriteOptions, D as TColumnDiff, Dt as UniqueryControls, E as TCascadeTarget, Et as Uniquery, F as TDbDefaultFn, Ft as DbSpace, G as TDbObjectKind, Gt as AtscriptRef, H as TDbIndexType, Ht as AtscriptQueryComparison, I as TDbDefaultValue, It as TAdapterFactory, J as TDbRemoveGuard, Jt as isFieldRef, K as TDbReferentialAction, Kt as TViewJoin, L as TDbDeleteResult, Lt as TDbSpaceOptions, M as TDbActionLevel, Mt as isGeoPointType, N as TDbActionProcessor, Nt as ALL_BUCKET_UNITS, O as TCrudOp, Ot as WithRelation, P as TDbCollation, Pt as BaseDbAdapter, Q as TDbWriteAction, Qt as NativeIntegrity, R as TDbFieldMeta, Rt as AtscriptDbView, S as NullableOptional, St as TValueFormatterPair, T as TCascadeResolver, Tt as TypedWithRelation, U as TDbInsertManyResult, Ut as AtscriptQueryFieldRef, V as TDbIndexField, Vt as isAtscriptDbView, W as TDbInsertResult, Wt as AtscriptQueryNode, X as TDbStorageType, Xt as AtscriptDbTable, Y as TDbRemoveGuardContext, Yt as translateQueryTree, Z as TDbUpdateResult, Zt as IntegrityStrategy, _ as DbRow, _t as TSearchIndexInfo, a as jsonValueAncestor, an as FieldMappingStrategy, at as TExistingTableOption, b as FlatOf, bt as TTableResolver, c as AggregateControls, cn as UniquSelect, ct as TFkLookupTarget, d as AggregateQuery, dt as TIdentification, en as DbResponse, et as TDbWriteGuardContext, f as AggregateResult, ft as TMetaResponse, g as DbQuery, gt as TRelationInfo, h as DbPatch, ht as TReferencingForeignKey, i as isJsonValueField, in as DocumentFieldMapper, it as TExistingForeignKey, j as TDbActionIntent, jt as isGeoIndexableType, k as TCrudPermissions, kt as TableMetadata, l as AggregateExpr, lt as TIdDescriptor, m as DbControls, mt as TPrimaryKeyChange, n as TResolvedBucket, nn as DbEncryption, nt as TEnsureTableOptions, o as normalizeComputedSelect, on as NoopLogger, ot as TFieldMeta, p as AtscriptDbWritable, pt as TMetadataOverrides, q as TDbRelation, qt as TViewPlan, r as isBucketableField, rn as TDbEncryptionOptions, rt as TExistingColumn, s as resolveCalendarBuckets, sn as TGenericLogger, st as TFkLookupResolver, t as TBucketFieldSource, tn as resolveDesignType, tt as TDeleteOptions, u as AggregateFn, ut as TIdResolveOptions, v as FieldOpsFor, vt as TSyncColumnResult, w as PrimaryKeyOf, wt as TWriteTableResolver, x as NavPropsOf, xt as TTouchManyOptions, y as FilterExpr, yt as TTableOptionDiff, z as TDbForeignKey, zt as TViewColumnMapping } from "./buckets-C-27xmtq.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 { 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";
4
- import { _ as IntegrityStrategy, a as TViewColumnMapping, c as AtscriptQueryComparison, d as AtscriptRef, f as TViewJoin, g as AtscriptDbTable, h as translateQueryTree, i as AtscriptDbView, l as AtscriptQueryFieldRef, m as isFieldRef, n as TAdapterFactory, o as TViewJsonType, p as TViewPlan, r as TDbSpaceOptions, s as isAtscriptDbView, t as DbSpace, u as AtscriptQueryNode, v as NativeIntegrity } from "./db-space-ClG41vJh.cjs";
5
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, v as bucketTimeZoneUnavailable } from "./validator-Drb2N-YL.cjs";
6
5
  import { n as createDbValidatorPlugin, t as DbValidationContext } from "./db-validator-plugin-BWy60OvG.cjs";
7
- import { i as tableNameOf } from "./relation-helpers-BVjQflL_.cjs";
6
+ import { n as isColumnTypeChanged } from "./column-diff-BmqvgBWw.cjs";
7
+ import { i as tableNameOf } from "./relation-helpers-DxrvS6ar.cjs";
8
8
  import { AggregateQuery as AggregateQuery$1, FilterExpr as FilterExpr$1, FilterVisitor, ResolvedBucket as ResolvedBucket$1, Uniquery as Uniquery$1, computeInsights, isPrimitive, walkFilter } from "@uniqu/core";
9
9
 
10
10
  //#region src/shared/consts.d.ts
@@ -489,4 +489,4 @@ declare function createFailureCollector(what: string): {
489
489
  throwIfAny: () => void;
490
490
  };
491
491
  //#endregion
492
- 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 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 TDbWriteGuard, type TDbWriteGuardContext, type TDeleteOptions, 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 TReferencingForeignKey, type TRelationInfo, type TResolvedBucket, 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, assertGeoPoint, assertNoVersionWrites, bucketSourceVerdict, bucketTimeZoneUnavailable, buildDbValidator, buildValidationContext, canFilterLeaf, checkHavingKeys, classifyQueryPath, collectQueryPaths, computeInsights, createDbValidatorPlugin, createFailureCollector, decomposePatch, findAncestorInSet, forceNavNonOptional, getDbFieldOp, getKeyProps, guardAggregate, guardFilter, guardPath, guardPaths, guardQuery, isAtscriptDbView, isBucketableField, isDbFieldOp, isEmptyObject, isFieldRef, isGeoIndexableType, isGeoPointType, isJsonValueField, isNavRelation, isPlainObject, isPrimitive, jsonValueAncestor, narrowerFilterOps, normalizeComputedSelect, reconcileCas, resolveCalendarBuckets, resolveDesignType, separateCas, separateFieldOps, sortFieldNames, tableNameOf, translateQueryTree, unsupportedOperatorMessage, walkFilter, withOptimisticRetry };
492
+ 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 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 TDbWriteGuard, type TDbWriteGuardContext, type TDeleteOptions, 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 TReferencingForeignKey, type TRelationInfo, type TResolvedBucket, 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, assertGeoPoint, assertNoVersionWrites, bucketSourceVerdict, bucketTimeZoneUnavailable, buildDbValidator, buildValidationContext, canFilterLeaf, checkHavingKeys, classifyQueryPath, collectQueryPaths, computeInsights, createDbValidatorPlugin, createFailureCollector, decomposePatch, findAncestorInSet, forceNavNonOptional, getDbFieldOp, getKeyProps, guardAggregate, guardFilter, guardPath, guardPaths, guardQuery, isAtscriptDbView, isBucketableField, isColumnTypeChanged, isDbFieldOp, isEmptyObject, isFieldRef, isGeoIndexableType, isGeoPointType, isJsonValueField, isNavRelation, isPlainObject, isPrimitive, jsonValueAncestor, narrowerFilterOps, normalizeComputedSelect, reconcileCas, resolveCalendarBuckets, resolveDesignType, separateCas, separateFieldOps, sortFieldNames, tableNameOf, translateQueryTree, unsupportedOperatorMessage, walkFilter, withOptimisticRetry };
package/dist/index.d.mts CHANGED
@@ -1,10 +1,10 @@
1
- import { $ as TDbWriteGuard, A as TDbActionInfo, At as findAncestorInSet, B as TDbIndex, Bt as DocumentFieldMapper, C as OwnPropsOf, Ct as TWriteOptions, D as TColumnDiff, Dt as UniqueryControls, E as TCascadeTarget, Et as Uniquery, F as TDbDefaultFn, Ft as AtscriptDbReadable, G as TDbObjectKind, H as TDbIndexType, Ht as NoopLogger, I as TDbDefaultValue, It as DbResponse, J as TDbRemoveGuard, K as TDbReferentialAction, L as TDbDeleteResult, Lt as resolveDesignType, M as TDbActionLevel, Mt as isGeoPointType, N as TDbActionProcessor, Nt as ALL_BUCKET_UNITS, O as TCrudOp, Ot as WithRelation, P as TDbCollation, Pt as BaseDbAdapter, Q as TDbWriteAction, R as TDbFieldMeta, Rt as DbEncryption, S as NullableOptional, St as TValueFormatterPair, T as TCascadeResolver, Tt as TypedWithRelation, U as TDbInsertManyResult, Ut as TGenericLogger, V as TDbIndexField, Vt as FieldMappingStrategy, W as TDbInsertResult, Wt as UniquSelect, X as TDbStorageType, Y as TDbRemoveGuardContext, Z as TDbUpdateResult, _ as DbRow, _t as TSearchIndexInfo, a as jsonValueAncestor, at as TExistingTableOption, b as FlatOf, bt as TTableResolver, c as AggregateControls, ct as TFkLookupTarget, d as AggregateQuery, dt as TIdentification, et as TDbWriteGuardContext, f as AggregateResult, ft as TMetaResponse, g as DbQuery, gt as TRelationInfo, h as DbPatch, ht as TReferencingForeignKey, i as isJsonValueField, it as TExistingForeignKey, j as TDbActionIntent, jt as isGeoIndexableType, k as TCrudPermissions, kt as TableMetadata, l as AggregateExpr, lt as TIdDescriptor, m as DbControls, mt as TPrimaryKeyChange, n as TResolvedBucket, nt as TEnsureTableOptions, o as normalizeComputedSelect, ot as TFieldMeta, p as AtscriptDbWritable, pt as TMetadataOverrides, q as TDbRelation, r as isBucketableField, rt as TExistingColumn, s as resolveCalendarBuckets, st as TFkLookupResolver, t as TBucketFieldSource, tt as TDeleteOptions, u as AggregateFn, ut as TIdResolveOptions, v as FieldOpsFor, vt as TSyncColumnResult, w as PrimaryKeyOf, wt as TWriteTableResolver, x as NavPropsOf, xt as TTouchManyOptions, y as FilterExpr, yt as TTableOptionDiff, z as TDbForeignKey, zt as TDbEncryptionOptions } from "./buckets-y4EzoX7D.mjs";
1
+ import { $ as TDbWriteGuard, $t as AtscriptDbReadable, A as TDbActionInfo, At as findAncestorInSet, B as TDbIndex, Bt as TViewJsonType, C as OwnPropsOf, Ct as TWriteOptions, D as TColumnDiff, Dt as UniqueryControls, E as TCascadeTarget, Et as Uniquery, F as TDbDefaultFn, Ft as DbSpace, G as TDbObjectKind, Gt as AtscriptRef, H as TDbIndexType, Ht as AtscriptQueryComparison, I as TDbDefaultValue, It as TAdapterFactory, J as TDbRemoveGuard, Jt as isFieldRef, K as TDbReferentialAction, Kt as TViewJoin, L as TDbDeleteResult, Lt as TDbSpaceOptions, M as TDbActionLevel, Mt as isGeoPointType, N as TDbActionProcessor, Nt as ALL_BUCKET_UNITS, O as TCrudOp, Ot as WithRelation, P as TDbCollation, Pt as BaseDbAdapter, Q as TDbWriteAction, Qt as NativeIntegrity, R as TDbFieldMeta, Rt as AtscriptDbView, S as NullableOptional, St as TValueFormatterPair, T as TCascadeResolver, Tt as TypedWithRelation, U as TDbInsertManyResult, Ut as AtscriptQueryFieldRef, V as TDbIndexField, Vt as isAtscriptDbView, W as TDbInsertResult, Wt as AtscriptQueryNode, X as TDbStorageType, Xt as AtscriptDbTable, Y as TDbRemoveGuardContext, Yt as translateQueryTree, Z as TDbUpdateResult, Zt as IntegrityStrategy, _ as DbRow, _t as TSearchIndexInfo, a as jsonValueAncestor, an as FieldMappingStrategy, at as TExistingTableOption, b as FlatOf, bt as TTableResolver, c as AggregateControls, cn as UniquSelect, ct as TFkLookupTarget, d as AggregateQuery, dt as TIdentification, en as DbResponse, et as TDbWriteGuardContext, f as AggregateResult, ft as TMetaResponse, g as DbQuery, gt as TRelationInfo, h as DbPatch, ht as TReferencingForeignKey, i as isJsonValueField, in as DocumentFieldMapper, it as TExistingForeignKey, j as TDbActionIntent, jt as isGeoIndexableType, k as TCrudPermissions, kt as TableMetadata, l as AggregateExpr, lt as TIdDescriptor, m as DbControls, mt as TPrimaryKeyChange, n as TResolvedBucket, nn as DbEncryption, nt as TEnsureTableOptions, o as normalizeComputedSelect, on as NoopLogger, ot as TFieldMeta, p as AtscriptDbWritable, pt as TMetadataOverrides, q as TDbRelation, qt as TViewPlan, r as isBucketableField, rn as TDbEncryptionOptions, rt as TExistingColumn, s as resolveCalendarBuckets, sn as TGenericLogger, st as TFkLookupResolver, t as TBucketFieldSource, tn as resolveDesignType, tt as TDeleteOptions, u as AggregateFn, ut as TIdResolveOptions, v as FieldOpsFor, vt as TSyncColumnResult, w as PrimaryKeyOf, wt as TWriteTableResolver, x as NavPropsOf, xt as TTouchManyOptions, y as FilterExpr, yt as TTableOptionDiff, z as TDbForeignKey, zt as TViewColumnMapping } from "./buckets-BFG2RYRW.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 { 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";
4
- import { _ as IntegrityStrategy, a as TViewColumnMapping, c as AtscriptQueryComparison, d as AtscriptRef, f as TViewJoin, g as AtscriptDbTable, h as translateQueryTree, i as AtscriptDbView, l as AtscriptQueryFieldRef, m as isFieldRef, n as TAdapterFactory, o as TViewJsonType, p as TViewPlan, r as TDbSpaceOptions, s as isAtscriptDbView, t as DbSpace, u as AtscriptQueryNode, v as NativeIntegrity } from "./db-space-BX4K3vb6.mjs";
5
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, v as bucketTimeZoneUnavailable } from "./validator-Drb2N-YL.mjs";
6
5
  import { n as createDbValidatorPlugin, t as DbValidationContext } from "./db-validator-plugin-BWy60OvG.mjs";
7
- import { i as tableNameOf } from "./relation-helpers-D4haLo1n.mjs";
6
+ import { n as isColumnTypeChanged } from "./column-diff-DPkbZIVE.mjs";
7
+ import { i as tableNameOf } from "./relation-helpers-D3Zu0Mta.mjs";
8
8
  import { AggregateQuery as AggregateQuery$1, FilterExpr as FilterExpr$1, FilterVisitor, ResolvedBucket as ResolvedBucket$1, Uniquery as Uniquery$1, computeInsights, isPrimitive, walkFilter } from "@uniqu/core";
9
9
 
10
10
  //#region src/shared/consts.d.ts
@@ -489,4 +489,4 @@ declare function createFailureCollector(what: string): {
489
489
  throwIfAny: () => void;
490
490
  };
491
491
  //#endregion
492
- 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 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 TDbWriteGuard, type TDbWriteGuardContext, type TDeleteOptions, 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 TReferencingForeignKey, type TRelationInfo, type TResolvedBucket, 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, assertGeoPoint, assertNoVersionWrites, bucketSourceVerdict, bucketTimeZoneUnavailable, buildDbValidator, buildValidationContext, canFilterLeaf, checkHavingKeys, classifyQueryPath, collectQueryPaths, computeInsights, createDbValidatorPlugin, createFailureCollector, decomposePatch, findAncestorInSet, forceNavNonOptional, getDbFieldOp, getKeyProps, guardAggregate, guardFilter, guardPath, guardPaths, guardQuery, isAtscriptDbView, isBucketableField, isDbFieldOp, isEmptyObject, isFieldRef, isGeoIndexableType, isGeoPointType, isJsonValueField, isNavRelation, isPlainObject, isPrimitive, jsonValueAncestor, narrowerFilterOps, normalizeComputedSelect, reconcileCas, resolveCalendarBuckets, resolveDesignType, separateCas, separateFieldOps, sortFieldNames, tableNameOf, translateQueryTree, unsupportedOperatorMessage, walkFilter, withOptimisticRetry };
492
+ 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 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 TDbWriteGuard, type TDbWriteGuardContext, type TDeleteOptions, 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 TReferencingForeignKey, type TRelationInfo, type TResolvedBucket, 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, assertGeoPoint, assertNoVersionWrites, bucketSourceVerdict, bucketTimeZoneUnavailable, buildDbValidator, buildValidationContext, canFilterLeaf, checkHavingKeys, classifyQueryPath, collectQueryPaths, computeInsights, createDbValidatorPlugin, createFailureCollector, decomposePatch, findAncestorInSet, forceNavNonOptional, getDbFieldOp, getKeyProps, guardAggregate, guardFilter, guardPath, guardPaths, guardQuery, isAtscriptDbView, isBucketableField, isColumnTypeChanged, isDbFieldOp, isEmptyObject, isFieldRef, isGeoIndexableType, isGeoPointType, isJsonValueField, isNavRelation, isPlainObject, isPrimitive, jsonValueAncestor, narrowerFilterOps, normalizeComputedSelect, reconcileCas, resolveCalendarBuckets, resolveDesignType, separateCas, separateFieldOps, sortFieldNames, tableNameOf, translateQueryTree, unsupportedOperatorMessage, walkFilter, withOptimisticRetry };
package/dist/index.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  import { a as bucketTimeZoneUnavailable, n as CasMismatchError, r as DbError, t as CasExhaustedError } from "./db-error-D5uilS_A.mjs";
2
- import { A as unsupportedOperatorMessage, B as isJsonValueField, C as guardAggregate, D as guardQuery, E as guardPaths, F as TableMetadata, H as normalizeComputedSelect, I as findAncestorInSet, L as isGeoIndexableType, M as DocumentFieldMapper, N as FieldMappingStrategy, O as narrowerFilterOps, P as UniquSelect, R as isGeoPointType, S as collectQueryPaths, T as guardPath, U as resolveCalendarBuckets, V as jsonValueAncestor, W as NoopLogger, _ as assertGeoPoint, a as decomposePatch, b as checkHavingKeys, c as BaseDbAdapter, d as NativeIntegrity, f as AtscriptDbReadable, g as acceptedOperatorsHint, h as ENCRYPTED_REASON, i as assertNoVersionWrites, j as RelationalFieldMapper, k as sortFieldNames, l as createFailureCollector, m as ADAPTER_FILTER_REASON, n as isAtscriptDbView, o as ApplicationIntegrity, p as resolveDesignType, r as AtscriptDbTable, s as ALL_BUCKET_UNITS, t as AtscriptDbView, u as IntegrityStrategy, v as bucketSourceVerdict, w as guardFilter, x as classifyQueryPath, y as canFilterLeaf, z as isBucketableField } from "./db-view-BrAtbaOx.mjs";
2
+ import { $ as jsonValueAncestor, A as bucketSourceVerdict, B as narrowerFilterOps, C as NativeIntegrity, D as ENCRYPTED_REASON, E as ADAPTER_FILTER_REASON, F as guardAggregate, G as FieldMappingStrategy, H as unsupportedOperatorMessage, I as guardFilter, J as findAncestorInSet, K as UniquSelect, L as guardPath, M as checkHavingKeys, N as classifyQueryPath, O as acceptedOperatorsHint, P as collectQueryPaths, Q as isJsonValueField, R as guardPaths, S as IntegrityStrategy, T as resolveDesignType, U as RelationalFieldMapper, V as sortFieldNames, W as DocumentFieldMapper, X as isGeoPointType, Y as isGeoIndexableType, Z as isBucketableField, _ as decomposePatch, b as BaseDbAdapter, et as normalizeComputedSelect, g as assertNoVersionWrites, h as AtscriptDbTable, j as canFilterLeaf, k as assertGeoPoint, m as isAtscriptDbView, n as isColumnTypeChanged, nt as NoopLogger, p as AtscriptDbView, q as TableMetadata, tt as resolveCalendarBuckets, v as ApplicationIntegrity, w as AtscriptDbReadable, x as createFailureCollector, y as ALL_BUCKET_UNITS, z as guardQuery } from "./column-diff-BwOA5101.mjs";
3
3
  import { t as ALL_AGGREGATE_FNS } from "./aggregate-fns-CfsveE1w.mjs";
4
4
  import { v as tableNameOf } from "./nested-writer-FWD5oOYh.mjs";
5
5
  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-Ch7UIQl9.mjs";
@@ -258,7 +258,7 @@ var DbSpace = class {
258
258
  getTable(type, logger) {
259
259
  let readable = this._readables.get(type);
260
260
  if (!readable) {
261
- readable = new AtscriptDbTable(type, this.adapterFactory(), logger || this.logger, (t) => this.get(t), (t) => {
261
+ readable = new AtscriptDbTable(type, this._createAdapter(), logger || this.logger, (t) => this.get(t), (t) => {
262
262
  const resolved = this.get(t);
263
263
  return resolved instanceof AtscriptDbTable ? resolved : void 0;
264
264
  });
@@ -277,7 +277,7 @@ var DbSpace = class {
277
277
  getView(type, logger) {
278
278
  let readable = this._readables.get(type);
279
279
  if (!readable) {
280
- readable = new AtscriptDbView(type, this.adapterFactory(), logger || this.logger, (t) => this.get(t));
280
+ readable = new AtscriptDbView(type, this._createAdapter(), logger || this.logger, (t) => this.get(t));
281
281
  readable.setEncryption(this._encryption);
282
282
  this._readables.set(type, readable);
283
283
  }
@@ -292,17 +292,17 @@ var DbSpace = class {
292
292
  }
293
293
  /**
294
294
  * Drops a table by name. Used by schema sync to remove tables no longer in the schema.
295
+ * See `BaseDbAdapter.dropTableByName` for an adapter that does not support it.
295
296
  */
296
297
  async dropTableByName(tableName) {
297
- const adapter = this._getAdminAdapter();
298
- if (adapter.dropTableByName) await adapter.dropTableByName(tableName);
298
+ await this._getAdminAdapter().dropTableByName(tableName);
299
299
  }
300
300
  /**
301
301
  * Drops a view by name. Used by schema sync to remove views no longer in the schema.
302
+ * See `BaseDbAdapter.dropViewByName` for an adapter that does not support it.
302
303
  */
303
304
  async dropViewByName(viewName) {
304
- const adapter = this._getAdminAdapter();
305
- if (adapter.dropViewByName) await adapter.dropViewByName(viewName);
305
+ await this._getAdminAdapter().dropViewByName(viewName);
306
306
  }
307
307
  /**
308
308
  * Drops a group of mutually referencing tables as one operation.
@@ -328,7 +328,16 @@ var DbSpace = class {
328
328
  * schema for those from the driver/connection, not from a bound table.
329
329
  */
330
330
  _getAdminAdapter() {
331
- return this._adminAdapter ??= this.adapterFactory();
331
+ return this._adminAdapter ??= this._createAdapter();
332
+ }
333
+ /**
334
+ * A factory-fresh adapter that knows its space (see `BaseDbAdapter.registerSpace`).
335
+ * Optional call: an adapter built against an older `@atscript/db` copy lacks it.
336
+ */
337
+ _createAdapter() {
338
+ const adapter = this.adapterFactory();
339
+ adapter.registerSpace?.(this);
340
+ return adapter;
332
341
  }
333
342
  /**
334
343
  * Finds all child tables with FKs pointing to the given parent table name.
@@ -382,4 +391,4 @@ function translateQueryTree(node, resolveField) {
382
391
  return { [leftField]: { [comp.op]: comp.right } };
383
392
  }
384
393
  //#endregion
385
- export { $cas, $dec, $inc, $insert, $mul, $remove, $replace, $update, $upsert, ADAPTER_FILTER_REASON, ALL_AGGREGATE_FNS, ALL_BUCKET_UNITS, ApplicationIntegrity, AtscriptDbReadable, AtscriptDbTable, AtscriptDbView, BaseDbAdapter, CasExhaustedError, CasMismatchError, DEFAULT_DB_SPACE, DbEncryption, DbError, DbSpace, DocumentFieldMapper, ENCRYPTED_REASON, FieldMappingStrategy, IntegrityStrategy, NativeIntegrity, NoopLogger, RelationalFieldMapper, TableMetadata, UniquSelect, acceptedOperatorsHint, assertGeoPoint, assertNoVersionWrites, bucketSourceVerdict, bucketTimeZoneUnavailable, buildDbValidator, buildValidationContext, canFilterLeaf, checkHavingKeys, classifyQueryPath, collectQueryPaths, computeInsights, createDbValidatorPlugin, createFailureCollector, decomposePatch, findAncestorInSet, forceNavNonOptional, getDbFieldOp, getKeyProps, guardAggregate, guardFilter, guardPath, guardPaths, guardQuery, isAtscriptDbView, isBucketableField, isDbFieldOp, isEmptyObject, isFieldRef, isGeoIndexableType, isGeoPointType, isJsonValueField, isNavRelation, isPlainObject, isPrimitive, jsonValueAncestor, narrowerFilterOps, normalizeComputedSelect, reconcileCas, resolveCalendarBuckets, resolveDesignType, separateCas, separateFieldOps, sortFieldNames, tableNameOf, translateQueryTree, unsupportedOperatorMessage, walkFilter, withOptimisticRetry };
394
+ export { $cas, $dec, $inc, $insert, $mul, $remove, $replace, $update, $upsert, ADAPTER_FILTER_REASON, ALL_AGGREGATE_FNS, ALL_BUCKET_UNITS, ApplicationIntegrity, AtscriptDbReadable, AtscriptDbTable, AtscriptDbView, BaseDbAdapter, CasExhaustedError, CasMismatchError, DEFAULT_DB_SPACE, DbEncryption, DbError, DbSpace, DocumentFieldMapper, ENCRYPTED_REASON, FieldMappingStrategy, IntegrityStrategy, NativeIntegrity, NoopLogger, RelationalFieldMapper, TableMetadata, UniquSelect, acceptedOperatorsHint, assertGeoPoint, assertNoVersionWrites, bucketSourceVerdict, bucketTimeZoneUnavailable, buildDbValidator, buildValidationContext, canFilterLeaf, checkHavingKeys, classifyQueryPath, collectQueryPaths, computeInsights, createDbValidatorPlugin, createFailureCollector, decomposePatch, findAncestorInSet, forceNavNonOptional, getDbFieldOp, getKeyProps, guardAggregate, guardFilter, guardPath, guardPaths, guardQuery, isAtscriptDbView, isBucketableField, isColumnTypeChanged, isDbFieldOp, isEmptyObject, isFieldRef, isGeoIndexableType, isGeoPointType, isJsonValueField, isNavRelation, isPlainObject, isPrimitive, jsonValueAncestor, narrowerFilterOps, normalizeComputedSelect, reconcileCas, resolveCalendarBuckets, resolveDesignType, separateCas, separateFieldOps, sortFieldNames, tableNameOf, translateQueryTree, unsupportedOperatorMessage, walkFilter, withOptimisticRetry };
package/dist/plugin.cjs CHANGED
@@ -313,7 +313,7 @@ const dbColumnAnnotations = {
313
313
  }) },
314
314
  column: {
315
315
  $self: new _atscript_core.AnnotationSpec({
316
- description: "Overrides the physical column name in the database. For nested (flattened) fields, the parent prefix is still prepended automatically.\n\n**Example:**\n```atscript\n@db.column \"first_name\"\nfirstName: string\n// → physical column: first_name\n\n// Nested:\naddress: {\n @db.column \"zip_code\"\n zip: string\n}\n// → physical column: address__zip_code\n```\n",
316
+ description: "Overrides the physical column name in the database. For nested (flattened) fields, the parent prefix is still prepended automatically. Document storage (MongoDB) renames top-level fields only — a nested field keeps its name there.\n\n**Example:**\n```atscript\n@db.column \"first_name\"\nfirstName: string\n// → physical column: first_name\n\n// Nested:\naddress: {\n @db.column \"zip_code\"\n zip: string\n}\n// → physical column: address__zip_code\n```\n",
317
317
  nodeType: ["prop"],
318
318
  passedWhenReferred: false,
319
319
  argument: {
@@ -323,7 +323,7 @@ const dbColumnAnnotations = {
323
323
  }
324
324
  }),
325
325
  renamed: new _atscript_core.AnnotationSpec({
326
- description: "Specifies the previous local field name for column rename migration. The sync engine generates ALTER TABLE RENAME COLUMN instead of drop+add.\n\n**Example:**\n```atscript\n@db.column.renamed \"zip\"\npostalCode: string\n// Renames address__zip → address__postalCode\n```\n",
326
+ description: "Specifies the previous local field name for column rename migration. The sync engine generates ALTER TABLE RENAME COLUMN instead of drop+add (on document storage, top-level fields only).\n\n**Example:**\n```atscript\n@db.column.renamed \"zip\"\npostalCode: string\n// Renames address__zip → address__postalCode\n```\n",
327
327
  nodeType: ["prop"],
328
328
  passedWhenReferred: false,
329
329
  argument: {
package/dist/plugin.mjs CHANGED
@@ -277,7 +277,7 @@ const dbColumnAnnotations = {
277
277
  }) },
278
278
  column: {
279
279
  $self: new AnnotationSpec({
280
- description: "Overrides the physical column name in the database. For nested (flattened) fields, the parent prefix is still prepended automatically.\n\n**Example:**\n```atscript\n@db.column \"first_name\"\nfirstName: string\n// → physical column: first_name\n\n// Nested:\naddress: {\n @db.column \"zip_code\"\n zip: string\n}\n// → physical column: address__zip_code\n```\n",
280
+ description: "Overrides the physical column name in the database. For nested (flattened) fields, the parent prefix is still prepended automatically. Document storage (MongoDB) renames top-level fields only — a nested field keeps its name there.\n\n**Example:**\n```atscript\n@db.column \"first_name\"\nfirstName: string\n// → physical column: first_name\n\n// Nested:\naddress: {\n @db.column \"zip_code\"\n zip: string\n}\n// → physical column: address__zip_code\n```\n",
281
281
  nodeType: ["prop"],
282
282
  passedWhenReferred: false,
283
283
  argument: {
@@ -287,7 +287,7 @@ const dbColumnAnnotations = {
287
287
  }
288
288
  }),
289
289
  renamed: new AnnotationSpec({
290
- description: "Specifies the previous local field name for column rename migration. The sync engine generates ALTER TABLE RENAME COLUMN instead of drop+add.\n\n**Example:**\n```atscript\n@db.column.renamed \"zip\"\npostalCode: string\n// Renames address__zip → address__postalCode\n```\n",
290
+ description: "Specifies the previous local field name for column rename migration. The sync engine generates ALTER TABLE RENAME COLUMN instead of drop+add (on document storage, top-level fields only).\n\n**Example:**\n```atscript\n@db.column.renamed \"zip\"\npostalCode: string\n// Renames address__zip → address__postalCode\n```\n",
291
291
  nodeType: ["prop"],
292
292
  passedWhenReferred: false,
293
293
  argument: {
package/dist/rel.d.cts CHANGED
@@ -1,6 +1,6 @@
1
- import { Pt as BaseDbAdapter, Ut as TGenericLogger, bt as TTableResolver, kt as TableMetadata, q as TDbRelation, wt as TWriteTableResolver, z as TDbForeignKey } from "./buckets-kKY0RKYN.cjs";
1
+ import { Pt as BaseDbAdapter, bt as TTableResolver, kt as TableMetadata, q as TDbRelation, sn as TGenericLogger, wt as TWriteTableResolver, z as TDbForeignKey } from "./buckets-C-27xmtq.cjs";
2
2
  import { t as DbValidationContext } from "./db-validator-plugin-BWy60OvG.cjs";
3
- import { n as findRemoteFK, r as resolveRelationTargetTable, t as findFKForRelation } from "./relation-helpers-BVjQflL_.cjs";
3
+ import { n as findRemoteFK, r as resolveRelationTargetTable, t as findFKForRelation } from "./relation-helpers-DxrvS6ar.cjs";
4
4
  import { FilterExpr, WithRelation } from "@uniqu/core";
5
5
  import { Validator } from "@atscript/typescript/utils";
6
6
 
package/dist/rel.d.mts CHANGED
@@ -1,6 +1,6 @@
1
- import { Pt as BaseDbAdapter, Ut as TGenericLogger, bt as TTableResolver, kt as TableMetadata, q as TDbRelation, wt as TWriteTableResolver, z as TDbForeignKey } from "./buckets-y4EzoX7D.mjs";
1
+ import { Pt as BaseDbAdapter, bt as TTableResolver, kt as TableMetadata, q as TDbRelation, sn as TGenericLogger, wt as TWriteTableResolver, z as TDbForeignKey } from "./buckets-BFG2RYRW.mjs";
2
2
  import { t as DbValidationContext } from "./db-validator-plugin-BWy60OvG.mjs";
3
- import { n as findRemoteFK, r as resolveRelationTargetTable, t as findFKForRelation } from "./relation-helpers-D4haLo1n.mjs";
3
+ import { n as findRemoteFK, r as resolveRelationTargetTable, t as findFKForRelation } from "./relation-helpers-D3Zu0Mta.mjs";
4
4
  import { Validator } from "@atscript/typescript/utils";
5
5
  import { FilterExpr, WithRelation } from "@uniqu/core";
6
6
 
@@ -1,4 +1,4 @@
1
- import { q as TDbRelation, z as TDbForeignKey } from "./buckets-kKY0RKYN.cjs";
1
+ import { q as TDbRelation, z as TDbForeignKey } from "./buckets-BFG2RYRW.mjs";
2
2
  import { TAtscriptAnnotatedType } from "@atscript/typescript/utils";
3
3
 
4
4
  //#region src/rel/relation-helpers.d.ts
@@ -1,4 +1,4 @@
1
- import { q as TDbRelation, z as TDbForeignKey } from "./buckets-y4EzoX7D.mjs";
1
+ import { q as TDbRelation, z as TDbForeignKey } from "./buckets-C-27xmtq.cjs";
2
2
  import { TAtscriptAnnotatedType } from "@atscript/typescript/utils";
3
3
 
4
4
  //#region src/rel/relation-helpers.d.ts