@atscript/db 0.1.154 → 0.1.156

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (35) hide show
  1. package/dist/agg.d.cts +1 -1
  2. package/dist/agg.d.mts +1 -1
  3. package/dist/{buckets-CBKL_ZWE.d.mts → buckets-8mG67Mtw.d.mts} +168 -16
  4. package/dist/{buckets-jy8BfswO.d.cts → buckets-B4T_alUe.d.cts} +168 -16
  5. package/dist/{column-diff-DAIAq6XR.mjs → column-diff-DR1glykD.mjs} +419 -75
  6. package/dist/{column-diff-qnzx1o3c.cjs → column-diff-DpeUbhEI.cjs} +430 -74
  7. package/dist/{fk-diff-BIJ8l_hF.d.mts → fk-diff-5gX42hBt.d.mts} +2 -1
  8. package/dist/{fk-diff-D1mrLMjU.d.cts → fk-diff-BWdQ7kRZ.d.cts} +2 -1
  9. package/dist/index.cjs +3 -3
  10. package/dist/index.d.cts +15 -9
  11. package/dist/index.d.mts +15 -9
  12. package/dist/index.mjs +3 -3
  13. package/dist/plugin.cjs +21 -4
  14. package/dist/plugin.mjs +21 -4
  15. package/dist/rel.d.cts +2 -2
  16. package/dist/rel.d.mts +2 -2
  17. package/dist/{relation-helpers-BUsxNNGU.d.mts → relation-helpers-17_2f5hX.d.mts} +1 -1
  18. package/dist/{relation-helpers-D_8bydc2.d.cts → relation-helpers-BLBrLQYi.d.cts} +1 -1
  19. package/dist/{search-fields-DBIZKwyb.mjs → search-fields-CE8cmj9X.mjs} +1 -0
  20. package/dist/{search-fields-DwrsJUC1.cjs → search-fields-CT_UZ9fg.cjs} +1 -0
  21. package/dist/shared.cjs +2 -1
  22. package/dist/shared.d.cts +10 -3
  23. package/dist/shared.d.mts +10 -3
  24. package/dist/shared.mjs +2 -2
  25. package/dist/sync.cjs +317 -35
  26. package/dist/sync.d.cts +34 -5
  27. package/dist/sync.d.mts +34 -5
  28. package/dist/sync.mjs +317 -35
  29. package/dist/{validation-utils-DqZAH6aT.mjs → validation-utils-BGjqc2jU.mjs} +24 -6
  30. package/dist/{validation-utils-debIYpq0.cjs → validation-utils-CtLNlBtB.cjs} +29 -5
  31. package/dist/{validator-BACewoRj.mjs → validator-B3fPJjS1.mjs} +178 -10
  32. package/dist/{validator-BxWwh3wf.cjs → validator-B4YDLUkj.cjs} +201 -9
  33. package/dist/validator.cjs +1 -1
  34. package/dist/validator.mjs +1 -1
  35. package/package.json +6 -6
package/dist/agg.d.cts CHANGED
@@ -1,3 +1,3 @@
1
- import { r as TResolvedBucket } from "./buckets-jy8BfswO.cjs";
1
+ import { r as TResolvedBucket } from "./buckets-B4T_alUe.cjs";
2
2
  import { _ as TDbAggregateFn, a as AggregateResult, c as CalendarBucketLabel, d as WeekStart, f as isAggregateExpr, h as resolveAlias, i as AggregateQuery, l as ComputedExpr, m as resolveAggregateSearch, n as AggregateExpr, o as BucketExpr, p as isBucketExpr, r as AggregateFn, s as BucketUnit, t as AggregateControls, u as ResolvedBucket, v as assertAggregateFn } from "./agg-42CSpGDR.cjs";
3
3
  export { type AggregateControls, type AggregateExpr, type AggregateFn, type AggregateQuery, type AggregateResult, type BucketExpr, type BucketUnit, type CalendarBucketLabel, type ComputedExpr, type ResolvedBucket, type TDbAggregateFn, type TResolvedBucket, type WeekStart, assertAggregateFn, isAggregateExpr, isBucketExpr, resolveAggregateSearch, resolveAlias };
package/dist/agg.d.mts CHANGED
@@ -1,3 +1,3 @@
1
- import { r as TResolvedBucket } from "./buckets-CBKL_ZWE.mjs";
1
+ import { r as TResolvedBucket } from "./buckets-8mG67Mtw.mjs";
2
2
  import { _ as TDbAggregateFn, a as AggregateResult, c as CalendarBucketLabel, d as WeekStart, f as isAggregateExpr, h as resolveAlias, i as AggregateQuery, l as ComputedExpr, m as resolveAggregateSearch, n as AggregateExpr, o as BucketExpr, p as isBucketExpr, r as AggregateFn, s as BucketUnit, t as AggregateControls, u as ResolvedBucket, v as assertAggregateFn } from "./agg-Wo-smrYV.mjs";
3
3
  export { type AggregateControls, type AggregateExpr, type AggregateFn, type AggregateQuery, type AggregateResult, type BucketExpr, type BucketUnit, type CalendarBucketLabel, type ComputedExpr, type ResolvedBucket, type TDbAggregateFn, type TResolvedBucket, type WeekStart, assertAggregateFn, isAggregateExpr, isBucketExpr, resolveAggregateSearch, resolveAlias };
@@ -594,7 +594,9 @@ type DbResponse<Data, Nav, Q> = [keyof Nav] extends [never] ? Data : string exte
594
594
  * otherwise trips up every adapter author.
595
595
  *
596
596
  * For union types (e.g., from flattened `{...} | {...}` objects):
597
- * - If all members resolve to the same type → returns that type (strong type)
597
+ * - `null` / `undefined` members are left out (since 0.1.155): `T | null`
598
+ * resolves to the design type of `T`
599
+ * - If all other members resolve to the same type → returns that type (strong type)
598
600
  * - If members disagree → returns `'union'` (out of scope for type management)
599
601
  */
600
602
  declare function resolveDesignType(fieldType: TAtscriptAnnotatedType): string;
@@ -1545,8 +1547,36 @@ declare class AtscriptDbTable<T extends TAtscriptAnnotatedType = TAtscriptAnnota
1545
1547
  * full row). Function defaults (`now` / `uuid` / `increment` / custom) the
1546
1548
  * adapter handles natively are NOT filled — the field stays absent so the
1547
1549
  * engine's own default applies. The version column is never touched.
1548
- */
1549
- protected _applyDefaults(data: Record<string, unknown>): Record<string, unknown>;
1550
+ * A nested field (`audit.createdAt`) is filled inside its object, only when
1551
+ * that object is present (an absent or `null` embedded object stays so), and
1552
+ * in every object of an array on the way; a field inside a JSON value or an
1553
+ * array has no column default, so the SDK fills its function default too.
1554
+ * Every `now` default the SDK fills gets the one time `now` (one per write
1555
+ * call, so `createdAt` / `updatedAt` of a new row are equal).
1556
+ */
1557
+ protected _applyDefaults(data: Record<string, unknown>, now?: number): Record<string, unknown>;
1558
+ /**
1559
+ * `@db.onUpdate.now` (since 0.1.156): sets each such field of a replace /
1560
+ * patch payload to `now`, overriding the caller's value. A nested field
1561
+ * (`audit.updatedAt`) is set inside its object only when the payload
1562
+ * carries that object — in every item of an array on the way and of the
1563
+ * items an array patch operator adds or updates — like
1564
+ * {@link _applyDefaults}. `topLevel: false` (a patch) instead drops the
1565
+ * caller's values of the table's own columns: {@link _stampTopLevel} sets
1566
+ * them once the patch is known to write something.
1567
+ */
1568
+ private _stampOnUpdate;
1569
+ /** Sets the top-level `@db.onUpdate.now` columns of a non-empty patch to `now`. */
1570
+ private _stampTopLevel;
1571
+ /** {@link _nestedDefaultFillable} per nested default path. */
1572
+ private _fillableDefaults?;
1573
+ /**
1574
+ * Whether every parent of the nested default `field` is one object type —
1575
+ * an object, `T | null` of one, or an array of one. Below a tuple or a
1576
+ * union of several types the default cannot be placed (the item it belongs
1577
+ * to is unknown), so it is not filled.
1578
+ */
1579
+ private _nestedDefaultFillable;
1550
1580
  /**
1551
1581
  * Parsed `@db.default 'literal'` values that are primitives — reused for
1552
1582
  * every row (an object / array default is parsed per row: each row gets
@@ -2773,9 +2803,12 @@ declare abstract class BaseDbAdapter {
2773
2803
  abstract deleteMany(filter: FilterExpr): Promise<TDbDeleteResult>;
2774
2804
  /**
2775
2805
  * Synchronizes indexes between the Atscript definitions and the database.
2776
- * Uses `this._table.indexes` for the full index definitions.
2806
+ * Uses `this._table.indexes` for the full index definitions. Schema sync
2807
+ * passes `opts` when safe mode skipped work the indexes depend on (see
2808
+ * {@link TSyncIndexesOptions}); an adapter whose indexes do not depend on it
2809
+ * ignores them.
2777
2810
  */
2778
- abstract syncIndexes(): Promise<void>;
2811
+ abstract syncIndexes(opts?: TSyncIndexesOptions): Promise<void>;
2779
2812
  /**
2780
2813
  * Ensures the table exists in the database, creating it if needed.
2781
2814
  * Uses `this._table.tableName`, `this._table.schema`, etc.
@@ -2878,6 +2911,24 @@ declare abstract class BaseDbAdapter {
2878
2911
  * Optional — only relational adapters implement this.
2879
2912
  */
2880
2913
  dropTable?(): Promise<void>;
2914
+ /**
2915
+ * Schema sync (since 0.1.155): copies the values of `source` — a text
2916
+ * column holding a whole value as JSON (the layout atscript-db ≤ 0.1.154
2917
+ * gave a `T | null` object or a union field) — into the columns that
2918
+ * replace it, in rows where `source` is not NULL and every target is NULL.
2919
+ * A malformed JSON value or one that does not convert to a target's type
2920
+ * throws (the table's sync entry errors before anything is dropped).
2921
+ * Optional — relational adapters implement it.
2922
+ */
2923
+ copyFromJsonColumn?(source: string, targets: readonly TJsonCopyTarget[]): Promise<void>;
2924
+ /**
2925
+ * Schema sync (since 0.1.155): rewrites the values of the text column
2926
+ * `column` that are not JSON as JSON strings (`abc` → `"abc"`), before the
2927
+ * column becomes a JSON column — the layout ≤ 0.1.154 stored a mixed
2928
+ * union's string member as plain text. Idempotent.
2929
+ * Optional — relational adapters implement it.
2930
+ */
2931
+ jsonifyTextColumn?(column: string): Promise<void>;
2881
2932
  /**
2882
2933
  * Drops one or more columns from the table.
2883
2934
  * Used by schema sync to remove stale columns no longer in the schema.
@@ -2889,8 +2940,9 @@ declare abstract class BaseDbAdapter {
2889
2940
  * given columns. Called by schema sync BEFORE {@link dropColumns} — engines
2890
2941
  * like SQLite refuse to drop a column while an index still references it,
2891
2942
  * and a composite index that survives by name must be rebuilt without the
2892
- * removed column (recreated later by {@link syncIndexes}).
2893
- * Optional — only relational adapters implement this.
2943
+ * removed column (recreated later by {@link syncIndexes}). MongoDB drops
2944
+ * them because a unique index would reject the `$unset` (`null` twice).
2945
+ * Optional — the SQL adapters and MongoDB implement this.
2894
2946
  */
2895
2947
  dropIndexesForColumns?(columns: string[]): Promise<void>;
2896
2948
  /**
@@ -2921,7 +2973,7 @@ declare abstract class BaseDbAdapter {
2921
2973
  dropTablesByName(tableNames: string[]): Promise<void>;
2922
2974
  /**
2923
2975
  * Whether the table has at least one row. Schema sync uses it in the
2924
- * pre-flight phase to refuse a primary-key change on a populated table.
2976
+ * pre-flight phase to check a primary-key change on a populated table.
2925
2977
  * Override with an EXISTS/LIMIT 1 probe — this default is `count() > 0`,
2926
2978
  * a full scan on some engines, and it can only answer for the adapter's
2927
2979
  * OWN table: for another `tableName` (or on an administrative adapter
@@ -2955,12 +3007,26 @@ declare abstract class BaseDbAdapter {
2955
3007
  getObjectKind?(name: string): Promise<TDbObjectKind | undefined>;
2956
3008
  /**
2957
3009
  * Rewrites the table's primary key from `change.from` to `change.to`.
2958
- * Called only on an EMPTY table (schema sync refuses populated ones) after
2959
- * new columns were added and before stale columns are dropped, so both
2960
- * column sets exist. Adapters without it fall back to {@link recreateTable}.
3010
+ * Called on an empty table, or (since 0.1.155) on a populated one whose
3011
+ * rows already satisfy the new key ({@link countKeyViolations} answered
3012
+ * `0`), after new columns were added and before stale columns are dropped,
3013
+ * so both column sets exist. Adapters without it fall back to
3014
+ * {@link recreateTable}.
2961
3015
  * @since 0.1.128
2962
3016
  */
2963
3017
  rebuildPrimaryKey?(change: TPrimaryKeyChange): Promise<void>;
3018
+ /**
3019
+ * How many rows of the live table `columns` cannot hold as a primary key:
3020
+ * rows with a NULL (or missing value) in one of them, plus every row that
3021
+ * shares its values with another. Schema sync rebuilds the key of a
3022
+ * populated table only when this answers `0`, and refuses the run with the
3023
+ * count otherwise. Optional — without it a populated key change is refused.
3024
+ *
3025
+ * @param tableName - Check this table instead of the adapter's own (the OLD
3026
+ * name of a table that is about to be renamed).
3027
+ * @since 0.1.155
3028
+ */
3029
+ countKeyViolations?(columns: readonly string[], tableName?: string): Promise<number>;
2964
3030
  /**
2965
3031
  * Renames a table/collection from `oldName` to the adapter's current table name.
2966
3032
  * Used by schema sync when `@db.table.renamed` is present.
@@ -3006,6 +3072,16 @@ declare abstract class BaseDbAdapter {
3006
3072
  formatValue?(field: TDbFieldMeta): TValueFormatterPair | ((value: unknown) => unknown) | undefined;
3007
3073
  }
3008
3074
  //#endregion
3075
+ //#region src/shared/union-shape.d.ts
3076
+ /**
3077
+ * Whether a value at a path is always there (`"required"`), may be NULL /
3078
+ * missing (`"nullable"` — the path or an ancestor object is optional or a
3079
+ * `| null` union), or is declared by only some members of a union of objects
3080
+ * on the way (`"partial"` — `card` of `payment: Card | Bank` when only
3081
+ * `Card` declares it). Ordered: each is weaker than the previous one.
3082
+ */
3083
+ type TPathPresence = "required" | "nullable" | "partial";
3084
+ //#endregion
3009
3085
  //#region src/table/table-metadata.d.ts
3010
3086
  /** Returns true if the annotated type IS the `db.geoPoint` primitive (tag-based). */
3011
3087
  declare function isGeoPointType(fieldType: TAtscriptAnnotatedType): boolean;
@@ -3058,6 +3134,12 @@ declare class TableMetadata {
3058
3134
  /** Adapter-contributed multi-field unique keys (logical paths) — see `TMetadataOverrides.addUniqueKeys`. */
3059
3135
  uniqueKeys: string[][];
3060
3136
  defaults: Map<string, TDbDefaultValue>;
3137
+ /**
3138
+ * Logical paths annotated with `@db.onUpdate.now` (`number.timestamp.updated`
3139
+ * applies it): set to the current time by every update and replace.
3140
+ * @since 0.1.156
3141
+ */
3142
+ onUpdateNow: Set<string>;
3061
3143
  /** Logical path → `@db.column` override (top-level keys only on document storage). */
3062
3144
  columnMap: Map<string, string>;
3063
3145
  dimensions: string[];
@@ -3142,8 +3224,42 @@ declare class TableMetadata {
3142
3224
  private _alwaysAddressable?;
3143
3225
  private _collateMap;
3144
3226
  private _columnFromMap;
3227
+ /** The annotated type `build()` ran on — the root of {@link presence}. */
3228
+ private _rootType?;
3229
+ private readonly _presence;
3145
3230
  constructor(nestedObjects: boolean);
3146
3231
  get isBuilt(): boolean;
3232
+ /**
3233
+ * Whether the value of the LOGICAL field `path` is always there, may be
3234
+ * NULL / missing, or is declared by only some members of a union of
3235
+ * objects on the way ({@link TPathPresence}); `undefined` inside an array.
3236
+ * @since 0.1.155
3237
+ */
3238
+ presence(path: string): TPathPresence | undefined;
3239
+ /**
3240
+ * Whether the LOGICAL field `path` can hold NULL (or be missing): it or a
3241
+ * parent object is optional or a `| null` union, or only some members of
3242
+ * a union of objects declare it. Inside an array: the field or a parent
3243
+ * is optional.
3244
+ * @since 0.1.155
3245
+ */
3246
+ isNullable(path: string): boolean;
3247
+ private _objectLeaves?;
3248
+ /**
3249
+ * The stored fields under the object field `path` that a null test on the
3250
+ * object reads (`rewriteObjectNullTests`, since 0.1.155): its leaf columns
3251
+ * on relational storage, its scalar / array / JSON fields on document
3252
+ * storage (not inside an array or a JSON value). `undefined` when `path`
3253
+ * is no stored object (a leaf, a `@db.json` / encrypted / ignored field,
3254
+ * a navigation relation, inside a JSON value, unknown).
3255
+ */
3256
+ objectLeaves(path: string): readonly string[] | undefined;
3257
+ /**
3258
+ * Whether the column of `path` is nullable: {@link isNullable}, except
3259
+ * inside an array (document storage only), where the field's own
3260
+ * optionality counts.
3261
+ */
3262
+ private _columnNullable;
3147
3263
  /**
3148
3264
  * {@link documentPath} over this table's `columnMap`. A `@db.column.derived`
3149
3265
  * field has no stored path of its own: it maps to its source leaf.
@@ -3184,10 +3300,13 @@ declare class TableMetadata {
3184
3300
  * into the synthetic flat entry of the prop's path, so a member's
3185
3301
  * annotations would reach the column (DDL type, size, default). Since
3186
3302
  * atscript 0.1.103 a built-in primitive member carries its built-in
3187
- * annotations (`number.timestamp.created | null` → `@db.default.now`,
3188
- * `string.char` → `@expect.maxLength 1`). Rebuild such an entry from the
3189
- * prop's own annotations plus the non-`db.*` annotations of named members
3190
- * (aliases, interfaces), so the column is described as before 0.1.103.
3303
+ * annotations (`string.char` → `@expect.maxLength 1`). Rebuild such an
3304
+ * entry from the prop's own annotations plus the non-`db.*` annotations of
3305
+ * named members (aliases, interfaces), so the column is described as before
3306
+ * 0.1.103. Exception: the one non-`null` member of `T | null` is the
3307
+ * column's type, so its `db.*` annotations apply too — `createdAt:
3308
+ * number.timestamp.created | null` gets `@db.default.now` like
3309
+ * `createdAt: number.timestamp.created`.
3191
3310
  */
3192
3311
  private _dropMemberMetadata;
3193
3312
  /**
@@ -3973,6 +4092,22 @@ interface TExistingColumn {
3973
4092
  * @since 0.1.141
3974
4093
  */
3975
4094
  type TDerivedChangeReason = "kind" | "expression" | "type";
4095
+ /**
4096
+ * One column {@link BaseDbAdapter.copyFromJsonColumn} fills from the JSON
4097
+ * text of a column the previous layout stored a whole value in (since 0.1.155).
4098
+ */
4099
+ interface TJsonCopyTarget {
4100
+ /** Physical column to fill. */
4101
+ column: string;
4102
+ /** Path of the value inside the source JSON (logical property names). */
4103
+ path: readonly string[];
4104
+ /**
4105
+ * How the value is read: `text` — a scalar as text, cast to the column
4106
+ * type; `boolean` — a JSON boolean; `json` — the sub-value as JSON.
4107
+ */
4108
+ kind: "text" | "boolean" | "json";
4109
+ field: TDbFieldMeta;
4110
+ }
3976
4111
  /** Result of comparing desired schema against existing database columns. */
3977
4112
  interface TColumnDiff {
3978
4113
  added: TDbFieldMeta[];
@@ -4073,6 +4208,23 @@ interface TEnsureTableOptions {
4073
4208
  */
4074
4209
  deferForeignKeysTo?: ReadonlySet<string>;
4075
4210
  }
4211
+ /**
4212
+ * Options accepted by `BaseDbAdapter.syncIndexes` (since 0.1.156): indexes
4213
+ * that stay as they are because safe mode skipped the change they depend on
4214
+ * (`entry.skipped`) — it is pending, applied by the next run without `safe`.
4215
+ */
4216
+ interface TSyncIndexesOptions {
4217
+ /**
4218
+ * The primary-key rebuild is skipped (`'pk-rebuild'`): an adapter whose
4219
+ * key is an index (MongoDB's `__pk` unique index) keeps the live one.
4220
+ */
4221
+ keepPrimaryKey?: boolean;
4222
+ /**
4223
+ * Physical columns whose type change is skipped (`'recreate'`): indexes
4224
+ * over them are neither dropped, replaced nor created.
4225
+ */
4226
+ keepColumns?: readonly string[];
4227
+ }
4076
4228
  /** Result of applying column diff to the database. */
4077
4229
  interface TSyncColumnResult {
4078
4230
  added: string[];
@@ -4573,4 +4725,4 @@ declare function isJsonValueField(fd: TDbFieldMeta): boolean;
4573
4725
  */
4574
4726
  declare function jsonValueAncestor(path: string, jsonValueParents: ReadonlySet<string>): string | undefined;
4575
4727
  //#endregion
4576
- export { TDbInsertResult as $, DbSpace as $t, TColumnDiff as A, TRelationFilterJunction as An, TReferencingForeignKey as At, TDbDefaultFn as B, TDbEncryptionOptions as Bn, TWriteOptions as Bt, NavPropsOf$1 as C, AtscriptDbReadable as Cn, TIdDescriptor as Ct, PrimaryKeyOf$1 as D, REL_FILTER_MAX_NODES as Dn, TMetaResponse as Dt, OwnPropsOf$1 as E, REL_FILTER_MAX_DEPTH as En, TInsertOptions as Et, TDbActionLevel as F, forEachResolvedRelation as Fn, TTableOptionDiff as Ft, TDbIndex as G, TGenericLogger as Gn, WithRelation$1 as Gt, TDbDeleteResult as H, FieldMappingStrategy as Hn, TypedWithRelation as Ht, TDbActionProcessor as I, hasRelationOp as In, TTableResolver as It, TDbInsertIgnoreOptions as J, TRowOrderKey as Jn, isGeoPointType as Jt, TDbIndexField as K, TExprAggregate as Kn, TableMetadata as Kt, TDbActionTargetSummary as L, isResolvedRelationFilter as Ln, TTouchManyOptions as Lt, TCrudPermissions as M, TRelationStaticFilter as Mn, TRowResolveOptions as Mt, TDbActionInfo as N, andFilters as Nn, TSearchIndexInfo as Nt, TCascadeResolver as O, ResolvedRelationFilter as On, TMetadataOverrides as Ot, TDbActionIntent as P, containsRelationFilter as Pn, TSyncColumnResult as Pt, TDbInsertManyResult as Q, TViewCapability as Qt, TDbAvailableActions as R, relationStaticFilter as Rn, TValueFormatterPair as Rt, FlatOf$1 as S, TCascadePin as Sn, TFkLookupTarget as St, NullsPlacement$1 as T, resolveDesignType as Tn, TIdentification as Tt, TDbFieldMeta as U, TReadControls as Un, Uniquery$1 as Ut, TDbDefaultValue as V, DocumentFieldMapper as Vn, TWriteTableResolver as Vt, TDbForeignKey as W, NoopLogger as Wn, UniqueryControls$1 as Wt, TDbInsertIgnoreSlot as X, ALL_VIEW_CAPABILITIES as Xt, TDbInsertIgnoreResult as Y, UniquSelect as Yn, ALL_BUCKET_UNITS as Yt, TDbInsertManyIgnoreResult as Z, BaseDbAdapter as Zt, DbPatch as _, isFieldRef as _n, TExistingColumn as _t, isJsonValueField as a, isViewType as an, TDbStorageType as at, FieldOpsFor as b, IntegrityStrategy as bn, TFieldMeta as bt, resolveCalendarBuckets as c, AtscriptExprNode$1 as cn, TDbWriteAction as ct, AggregateFn$1 as d, AtscriptQueryFieldRef$1 as dn, TDbWriteGuard as dt, TAdapterFactory as en, TDbObjectKind as et, AggregateQuery$1 as f, AtscriptQueryNode$1 as fn, TDbWriteGuardContext as ft, DbControls as g, evaluateExpr as gn, TEnsureTableOptions as gt, AtscriptDbWritable as h, TViewPlan as hn, TDerivedColumn as ht, isBucketableField as i, isAtscriptDbView as in, TDbRemoveGuardContext as it, TCrudOp as j, TRelationFilterTable as jn, TRelationInfo as jt, TCascadeTarget as k, TRelGuardState as kn, TPrimaryKeyChange as kt, AggregateControls as l, AtscriptOrderItem as ln, TDbWriteCheck as lt, AtscriptDbTableLike as m, TViewJoin as mn, TDerivedChangeReason as mt, TComputedSelect as n, AtscriptDbView as nn, TDbRelation as nt, jsonValueAncestor as o, TViewReadPlan as on, TDbUpdateOptions as ot, AggregateResult as p, AtscriptRef as pn, TDeleteOptions as pt, TDbIndexType as q, TFirstLast as qn, isGeoIndexableType as qt, TResolvedBucket as r, TViewColumnMapping as rn, TDbRemoveGuard as rt, normalizeComputedSelect as s, aliasTargetOf as sn, TDbUpdateResult as st, TBucketFieldSource as t, TDbSpaceOptions as tn, TDbReferentialAction as tt, AggregateExpr$1 as u, AtscriptQueryComparison as un, TDbWriteCheckContext as ut, DbQuery as v, translateQueryTree as vn, TExistingForeignKey as vt, NullableOptional as w, DbResponse as wn, TIdResolveOptions as wt, FilterExpr$1 as x, NativeIntegrity as xn, TFkLookupResolver as xt, DbRow as y, AtscriptDbTable as yn, TExistingTableOption as yt, TDbCollation as z, DbEncryption as zn, TViewJsonType as zt };
4728
+ export { TDbInsertResult as $, ALL_VIEW_CAPABILITIES as $t, TColumnDiff as A, REL_FILTER_MAX_NODES as An, TPrimaryKeyChange as At, TDbDefaultFn as B, isResolvedRelationFilter as Bn, TValueFormatterPair as Bt, NavPropsOf$1 as C, IntegrityStrategy as Cn, TIdDescriptor as Ct, PrimaryKeyOf$1 as D, DbResponse as Dn, TJsonCopyTarget as Dt, OwnPropsOf$1 as E, AtscriptDbReadable as En, TInsertOptions as Et, TDbActionLevel as F, TRelationStaticFilter as Fn, TSyncColumnResult as Ft, TDbIndex as G, FieldMappingStrategy as Gn, Uniquery$1 as Gt, TDbDeleteResult as H, DbEncryption as Hn, TWriteOptions as Ht, TDbActionProcessor as I, andFilters as In, TSyncIndexesOptions as It, TDbInsertIgnoreOptions as J, TGenericLogger as Jn, TableMetadata as Jt, TDbIndexField as K, TReadControls as Kn, UniqueryControls$1 as Kt, TDbActionTargetSummary as L, containsRelationFilter as Ln, TTableOptionDiff as Lt, TCrudPermissions as M, TRelGuardState as Mn, TRelationInfo as Mt, TDbActionInfo as N, TRelationFilterJunction as Nn, TRowResolveOptions as Nt, TCascadeResolver as O, resolveDesignType as On, TMetaResponse as Ot, TDbActionIntent as P, TRelationFilterTable as Pn, TSearchIndexInfo as Pt, TDbInsertManyResult as Q, UniquSelect as Qn, ALL_BUCKET_UNITS as Qt, TDbAvailableActions as R, forEachResolvedRelation as Rn, TTableResolver as Rt, FlatOf$1 as S, AtscriptDbTable as Sn, TFkLookupTarget as St, NullsPlacement$1 as T, TCascadePin as Tn, TIdentification as Tt, TDbFieldMeta as U, TDbEncryptionOptions as Un, TWriteTableResolver as Ut, TDbDefaultValue as V, relationStaticFilter as Vn, TViewJsonType as Vt, TDbForeignKey as W, DocumentFieldMapper as Wn, TypedWithRelation as Wt, TDbInsertIgnoreSlot as X, TFirstLast as Xn, isGeoPointType as Xt, TDbInsertIgnoreResult as Y, TExprAggregate as Yn, isGeoIndexableType as Yt, TDbInsertManyIgnoreResult as Z, TRowOrderKey as Zn, TPathPresence as Zt, DbPatch as _, TViewJoin as _n, TExistingColumn as _t, isJsonValueField as a, AtscriptDbView as an, TDbStorageType as at, FieldOpsFor as b, isFieldRef as bn, TFieldMeta as bt, resolveCalendarBuckets as c, isViewType as cn, TDbWriteAction as ct, AggregateFn$1 as d, AtscriptExprNode$1 as dn, TDbWriteGuard as dt, BaseDbAdapter as en, TDbObjectKind as et, AggregateQuery$1 as f, AtscriptOrderItem as fn, TDbWriteGuardContext as ft, DbControls as g, AtscriptRef as gn, TEnsureTableOptions as gt, AtscriptDbWritable as h, AtscriptQueryNode$1 as hn, TDerivedColumn as ht, isBucketableField as i, TDbSpaceOptions as in, TDbRemoveGuardContext as it, TCrudOp as j, ResolvedRelationFilter as jn, TReferencingForeignKey as jt, TCascadeTarget as k, REL_FILTER_MAX_DEPTH as kn, TMetadataOverrides as kt, AggregateControls as l, TViewReadPlan as ln, TDbWriteCheck as lt, AtscriptDbTableLike as m, AtscriptQueryFieldRef$1 as mn, TDerivedChangeReason as mt, TComputedSelect as n, DbSpace as nn, TDbRelation as nt, jsonValueAncestor as o, TViewColumnMapping as on, TDbUpdateOptions as ot, AggregateResult as p, AtscriptQueryComparison as pn, TDeleteOptions as pt, TDbIndexType as q, NoopLogger as qn, WithRelation$1 as qt, TResolvedBucket as r, TAdapterFactory as rn, TDbRemoveGuard as rt, normalizeComputedSelect as s, isAtscriptDbView as sn, TDbUpdateResult as st, TBucketFieldSource as t, TViewCapability as tn, TDbReferentialAction as tt, AggregateExpr$1 as u, aliasTargetOf as un, TDbWriteCheckContext as ut, DbQuery as v, TViewPlan as vn, TExistingForeignKey as vt, NullableOptional as w, NativeIntegrity as wn, TIdResolveOptions as wt, FilterExpr$1 as x, translateQueryTree as xn, TFkLookupResolver as xt, DbRow as y, evaluateExpr as yn, TExistingTableOption as yt, TDbCollation as z, hasRelationOp as zn, TTouchManyOptions as zt };
@@ -594,7 +594,9 @@ type DbResponse<Data, Nav, Q> = [keyof Nav] extends [never] ? Data : string exte
594
594
  * otherwise trips up every adapter author.
595
595
  *
596
596
  * For union types (e.g., from flattened `{...} | {...}` objects):
597
- * - If all members resolve to the same type → returns that type (strong type)
597
+ * - `null` / `undefined` members are left out (since 0.1.155): `T | null`
598
+ * resolves to the design type of `T`
599
+ * - If all other members resolve to the same type → returns that type (strong type)
598
600
  * - If members disagree → returns `'union'` (out of scope for type management)
599
601
  */
600
602
  declare function resolveDesignType(fieldType: TAtscriptAnnotatedType): string;
@@ -1545,8 +1547,36 @@ declare class AtscriptDbTable<T extends TAtscriptAnnotatedType = TAtscriptAnnota
1545
1547
  * full row). Function defaults (`now` / `uuid` / `increment` / custom) the
1546
1548
  * adapter handles natively are NOT filled — the field stays absent so the
1547
1549
  * engine's own default applies. The version column is never touched.
1548
- */
1549
- protected _applyDefaults(data: Record<string, unknown>): Record<string, unknown>;
1550
+ * A nested field (`audit.createdAt`) is filled inside its object, only when
1551
+ * that object is present (an absent or `null` embedded object stays so), and
1552
+ * in every object of an array on the way; a field inside a JSON value or an
1553
+ * array has no column default, so the SDK fills its function default too.
1554
+ * Every `now` default the SDK fills gets the one time `now` (one per write
1555
+ * call, so `createdAt` / `updatedAt` of a new row are equal).
1556
+ */
1557
+ protected _applyDefaults(data: Record<string, unknown>, now?: number): Record<string, unknown>;
1558
+ /**
1559
+ * `@db.onUpdate.now` (since 0.1.156): sets each such field of a replace /
1560
+ * patch payload to `now`, overriding the caller's value. A nested field
1561
+ * (`audit.updatedAt`) is set inside its object only when the payload
1562
+ * carries that object — in every item of an array on the way and of the
1563
+ * items an array patch operator adds or updates — like
1564
+ * {@link _applyDefaults}. `topLevel: false` (a patch) instead drops the
1565
+ * caller's values of the table's own columns: {@link _stampTopLevel} sets
1566
+ * them once the patch is known to write something.
1567
+ */
1568
+ private _stampOnUpdate;
1569
+ /** Sets the top-level `@db.onUpdate.now` columns of a non-empty patch to `now`. */
1570
+ private _stampTopLevel;
1571
+ /** {@link _nestedDefaultFillable} per nested default path. */
1572
+ private _fillableDefaults?;
1573
+ /**
1574
+ * Whether every parent of the nested default `field` is one object type —
1575
+ * an object, `T | null` of one, or an array of one. Below a tuple or a
1576
+ * union of several types the default cannot be placed (the item it belongs
1577
+ * to is unknown), so it is not filled.
1578
+ */
1579
+ private _nestedDefaultFillable;
1550
1580
  /**
1551
1581
  * Parsed `@db.default 'literal'` values that are primitives — reused for
1552
1582
  * every row (an object / array default is parsed per row: each row gets
@@ -2773,9 +2803,12 @@ declare abstract class BaseDbAdapter {
2773
2803
  abstract deleteMany(filter: FilterExpr): Promise<TDbDeleteResult>;
2774
2804
  /**
2775
2805
  * Synchronizes indexes between the Atscript definitions and the database.
2776
- * Uses `this._table.indexes` for the full index definitions.
2806
+ * Uses `this._table.indexes` for the full index definitions. Schema sync
2807
+ * passes `opts` when safe mode skipped work the indexes depend on (see
2808
+ * {@link TSyncIndexesOptions}); an adapter whose indexes do not depend on it
2809
+ * ignores them.
2777
2810
  */
2778
- abstract syncIndexes(): Promise<void>;
2811
+ abstract syncIndexes(opts?: TSyncIndexesOptions): Promise<void>;
2779
2812
  /**
2780
2813
  * Ensures the table exists in the database, creating it if needed.
2781
2814
  * Uses `this._table.tableName`, `this._table.schema`, etc.
@@ -2878,6 +2911,24 @@ declare abstract class BaseDbAdapter {
2878
2911
  * Optional — only relational adapters implement this.
2879
2912
  */
2880
2913
  dropTable?(): Promise<void>;
2914
+ /**
2915
+ * Schema sync (since 0.1.155): copies the values of `source` — a text
2916
+ * column holding a whole value as JSON (the layout atscript-db ≤ 0.1.154
2917
+ * gave a `T | null` object or a union field) — into the columns that
2918
+ * replace it, in rows where `source` is not NULL and every target is NULL.
2919
+ * A malformed JSON value or one that does not convert to a target's type
2920
+ * throws (the table's sync entry errors before anything is dropped).
2921
+ * Optional — relational adapters implement it.
2922
+ */
2923
+ copyFromJsonColumn?(source: string, targets: readonly TJsonCopyTarget[]): Promise<void>;
2924
+ /**
2925
+ * Schema sync (since 0.1.155): rewrites the values of the text column
2926
+ * `column` that are not JSON as JSON strings (`abc` → `"abc"`), before the
2927
+ * column becomes a JSON column — the layout ≤ 0.1.154 stored a mixed
2928
+ * union's string member as plain text. Idempotent.
2929
+ * Optional — relational adapters implement it.
2930
+ */
2931
+ jsonifyTextColumn?(column: string): Promise<void>;
2881
2932
  /**
2882
2933
  * Drops one or more columns from the table.
2883
2934
  * Used by schema sync to remove stale columns no longer in the schema.
@@ -2889,8 +2940,9 @@ declare abstract class BaseDbAdapter {
2889
2940
  * given columns. Called by schema sync BEFORE {@link dropColumns} — engines
2890
2941
  * like SQLite refuse to drop a column while an index still references it,
2891
2942
  * and a composite index that survives by name must be rebuilt without the
2892
- * removed column (recreated later by {@link syncIndexes}).
2893
- * Optional — only relational adapters implement this.
2943
+ * removed column (recreated later by {@link syncIndexes}). MongoDB drops
2944
+ * them because a unique index would reject the `$unset` (`null` twice).
2945
+ * Optional — the SQL adapters and MongoDB implement this.
2894
2946
  */
2895
2947
  dropIndexesForColumns?(columns: string[]): Promise<void>;
2896
2948
  /**
@@ -2921,7 +2973,7 @@ declare abstract class BaseDbAdapter {
2921
2973
  dropTablesByName(tableNames: string[]): Promise<void>;
2922
2974
  /**
2923
2975
  * Whether the table has at least one row. Schema sync uses it in the
2924
- * pre-flight phase to refuse a primary-key change on a populated table.
2976
+ * pre-flight phase to check a primary-key change on a populated table.
2925
2977
  * Override with an EXISTS/LIMIT 1 probe — this default is `count() > 0`,
2926
2978
  * a full scan on some engines, and it can only answer for the adapter's
2927
2979
  * OWN table: for another `tableName` (or on an administrative adapter
@@ -2955,12 +3007,26 @@ declare abstract class BaseDbAdapter {
2955
3007
  getObjectKind?(name: string): Promise<TDbObjectKind | undefined>;
2956
3008
  /**
2957
3009
  * Rewrites the table's primary key from `change.from` to `change.to`.
2958
- * Called only on an EMPTY table (schema sync refuses populated ones) after
2959
- * new columns were added and before stale columns are dropped, so both
2960
- * column sets exist. Adapters without it fall back to {@link recreateTable}.
3010
+ * Called on an empty table, or (since 0.1.155) on a populated one whose
3011
+ * rows already satisfy the new key ({@link countKeyViolations} answered
3012
+ * `0`), after new columns were added and before stale columns are dropped,
3013
+ * so both column sets exist. Adapters without it fall back to
3014
+ * {@link recreateTable}.
2961
3015
  * @since 0.1.128
2962
3016
  */
2963
3017
  rebuildPrimaryKey?(change: TPrimaryKeyChange): Promise<void>;
3018
+ /**
3019
+ * How many rows of the live table `columns` cannot hold as a primary key:
3020
+ * rows with a NULL (or missing value) in one of them, plus every row that
3021
+ * shares its values with another. Schema sync rebuilds the key of a
3022
+ * populated table only when this answers `0`, and refuses the run with the
3023
+ * count otherwise. Optional — without it a populated key change is refused.
3024
+ *
3025
+ * @param tableName - Check this table instead of the adapter's own (the OLD
3026
+ * name of a table that is about to be renamed).
3027
+ * @since 0.1.155
3028
+ */
3029
+ countKeyViolations?(columns: readonly string[], tableName?: string): Promise<number>;
2964
3030
  /**
2965
3031
  * Renames a table/collection from `oldName` to the adapter's current table name.
2966
3032
  * Used by schema sync when `@db.table.renamed` is present.
@@ -3006,6 +3072,16 @@ declare abstract class BaseDbAdapter {
3006
3072
  formatValue?(field: TDbFieldMeta): TValueFormatterPair | ((value: unknown) => unknown) | undefined;
3007
3073
  }
3008
3074
  //#endregion
3075
+ //#region src/shared/union-shape.d.ts
3076
+ /**
3077
+ * Whether a value at a path is always there (`"required"`), may be NULL /
3078
+ * missing (`"nullable"` — the path or an ancestor object is optional or a
3079
+ * `| null` union), or is declared by only some members of a union of objects
3080
+ * on the way (`"partial"` — `card` of `payment: Card | Bank` when only
3081
+ * `Card` declares it). Ordered: each is weaker than the previous one.
3082
+ */
3083
+ type TPathPresence = "required" | "nullable" | "partial";
3084
+ //#endregion
3009
3085
  //#region src/table/table-metadata.d.ts
3010
3086
  /** Returns true if the annotated type IS the `db.geoPoint` primitive (tag-based). */
3011
3087
  declare function isGeoPointType(fieldType: TAtscriptAnnotatedType): boolean;
@@ -3058,6 +3134,12 @@ declare class TableMetadata {
3058
3134
  /** Adapter-contributed multi-field unique keys (logical paths) — see `TMetadataOverrides.addUniqueKeys`. */
3059
3135
  uniqueKeys: string[][];
3060
3136
  defaults: Map<string, TDbDefaultValue>;
3137
+ /**
3138
+ * Logical paths annotated with `@db.onUpdate.now` (`number.timestamp.updated`
3139
+ * applies it): set to the current time by every update and replace.
3140
+ * @since 0.1.156
3141
+ */
3142
+ onUpdateNow: Set<string>;
3061
3143
  /** Logical path → `@db.column` override (top-level keys only on document storage). */
3062
3144
  columnMap: Map<string, string>;
3063
3145
  dimensions: string[];
@@ -3142,8 +3224,42 @@ declare class TableMetadata {
3142
3224
  private _alwaysAddressable?;
3143
3225
  private _collateMap;
3144
3226
  private _columnFromMap;
3227
+ /** The annotated type `build()` ran on — the root of {@link presence}. */
3228
+ private _rootType?;
3229
+ private readonly _presence;
3145
3230
  constructor(nestedObjects: boolean);
3146
3231
  get isBuilt(): boolean;
3232
+ /**
3233
+ * Whether the value of the LOGICAL field `path` is always there, may be
3234
+ * NULL / missing, or is declared by only some members of a union of
3235
+ * objects on the way ({@link TPathPresence}); `undefined` inside an array.
3236
+ * @since 0.1.155
3237
+ */
3238
+ presence(path: string): TPathPresence | undefined;
3239
+ /**
3240
+ * Whether the LOGICAL field `path` can hold NULL (or be missing): it or a
3241
+ * parent object is optional or a `| null` union, or only some members of
3242
+ * a union of objects declare it. Inside an array: the field or a parent
3243
+ * is optional.
3244
+ * @since 0.1.155
3245
+ */
3246
+ isNullable(path: string): boolean;
3247
+ private _objectLeaves?;
3248
+ /**
3249
+ * The stored fields under the object field `path` that a null test on the
3250
+ * object reads (`rewriteObjectNullTests`, since 0.1.155): its leaf columns
3251
+ * on relational storage, its scalar / array / JSON fields on document
3252
+ * storage (not inside an array or a JSON value). `undefined` when `path`
3253
+ * is no stored object (a leaf, a `@db.json` / encrypted / ignored field,
3254
+ * a navigation relation, inside a JSON value, unknown).
3255
+ */
3256
+ objectLeaves(path: string): readonly string[] | undefined;
3257
+ /**
3258
+ * Whether the column of `path` is nullable: {@link isNullable}, except
3259
+ * inside an array (document storage only), where the field's own
3260
+ * optionality counts.
3261
+ */
3262
+ private _columnNullable;
3147
3263
  /**
3148
3264
  * {@link documentPath} over this table's `columnMap`. A `@db.column.derived`
3149
3265
  * field has no stored path of its own: it maps to its source leaf.
@@ -3184,10 +3300,13 @@ declare class TableMetadata {
3184
3300
  * into the synthetic flat entry of the prop's path, so a member's
3185
3301
  * annotations would reach the column (DDL type, size, default). Since
3186
3302
  * atscript 0.1.103 a built-in primitive member carries its built-in
3187
- * annotations (`number.timestamp.created | null` → `@db.default.now`,
3188
- * `string.char` → `@expect.maxLength 1`). Rebuild such an entry from the
3189
- * prop's own annotations plus the non-`db.*` annotations of named members
3190
- * (aliases, interfaces), so the column is described as before 0.1.103.
3303
+ * annotations (`string.char` → `@expect.maxLength 1`). Rebuild such an
3304
+ * entry from the prop's own annotations plus the non-`db.*` annotations of
3305
+ * named members (aliases, interfaces), so the column is described as before
3306
+ * 0.1.103. Exception: the one non-`null` member of `T | null` is the
3307
+ * column's type, so its `db.*` annotations apply too — `createdAt:
3308
+ * number.timestamp.created | null` gets `@db.default.now` like
3309
+ * `createdAt: number.timestamp.created`.
3191
3310
  */
3192
3311
  private _dropMemberMetadata;
3193
3312
  /**
@@ -3973,6 +4092,22 @@ interface TExistingColumn {
3973
4092
  * @since 0.1.141
3974
4093
  */
3975
4094
  type TDerivedChangeReason = "kind" | "expression" | "type";
4095
+ /**
4096
+ * One column {@link BaseDbAdapter.copyFromJsonColumn} fills from the JSON
4097
+ * text of a column the previous layout stored a whole value in (since 0.1.155).
4098
+ */
4099
+ interface TJsonCopyTarget {
4100
+ /** Physical column to fill. */
4101
+ column: string;
4102
+ /** Path of the value inside the source JSON (logical property names). */
4103
+ path: readonly string[];
4104
+ /**
4105
+ * How the value is read: `text` — a scalar as text, cast to the column
4106
+ * type; `boolean` — a JSON boolean; `json` — the sub-value as JSON.
4107
+ */
4108
+ kind: "text" | "boolean" | "json";
4109
+ field: TDbFieldMeta;
4110
+ }
3976
4111
  /** Result of comparing desired schema against existing database columns. */
3977
4112
  interface TColumnDiff {
3978
4113
  added: TDbFieldMeta[];
@@ -4073,6 +4208,23 @@ interface TEnsureTableOptions {
4073
4208
  */
4074
4209
  deferForeignKeysTo?: ReadonlySet<string>;
4075
4210
  }
4211
+ /**
4212
+ * Options accepted by `BaseDbAdapter.syncIndexes` (since 0.1.156): indexes
4213
+ * that stay as they are because safe mode skipped the change they depend on
4214
+ * (`entry.skipped`) — it is pending, applied by the next run without `safe`.
4215
+ */
4216
+ interface TSyncIndexesOptions {
4217
+ /**
4218
+ * The primary-key rebuild is skipped (`'pk-rebuild'`): an adapter whose
4219
+ * key is an index (MongoDB's `__pk` unique index) keeps the live one.
4220
+ */
4221
+ keepPrimaryKey?: boolean;
4222
+ /**
4223
+ * Physical columns whose type change is skipped (`'recreate'`): indexes
4224
+ * over them are neither dropped, replaced nor created.
4225
+ */
4226
+ keepColumns?: readonly string[];
4227
+ }
4076
4228
  /** Result of applying column diff to the database. */
4077
4229
  interface TSyncColumnResult {
4078
4230
  added: string[];
@@ -4573,4 +4725,4 @@ declare function isJsonValueField(fd: TDbFieldMeta): boolean;
4573
4725
  */
4574
4726
  declare function jsonValueAncestor(path: string, jsonValueParents: ReadonlySet<string>): string | undefined;
4575
4727
  //#endregion
4576
- export { TDbInsertResult as $, DbSpace as $t, TColumnDiff as A, TRelationFilterJunction as An, TReferencingForeignKey as At, TDbDefaultFn as B, TDbEncryptionOptions as Bn, TWriteOptions as Bt, NavPropsOf$1 as C, AtscriptDbReadable as Cn, TIdDescriptor as Ct, PrimaryKeyOf$1 as D, REL_FILTER_MAX_NODES as Dn, TMetaResponse as Dt, OwnPropsOf$1 as E, REL_FILTER_MAX_DEPTH as En, TInsertOptions as Et, TDbActionLevel as F, forEachResolvedRelation as Fn, TTableOptionDiff as Ft, TDbIndex as G, TGenericLogger as Gn, WithRelation$1 as Gt, TDbDeleteResult as H, FieldMappingStrategy as Hn, TypedWithRelation as Ht, TDbActionProcessor as I, hasRelationOp as In, TTableResolver as It, TDbInsertIgnoreOptions as J, TRowOrderKey as Jn, isGeoPointType as Jt, TDbIndexField as K, TExprAggregate as Kn, TableMetadata as Kt, TDbActionTargetSummary as L, isResolvedRelationFilter as Ln, TTouchManyOptions as Lt, TCrudPermissions as M, TRelationStaticFilter as Mn, TRowResolveOptions as Mt, TDbActionInfo as N, andFilters as Nn, TSearchIndexInfo as Nt, TCascadeResolver as O, ResolvedRelationFilter as On, TMetadataOverrides as Ot, TDbActionIntent as P, containsRelationFilter as Pn, TSyncColumnResult as Pt, TDbInsertManyResult as Q, TViewCapability as Qt, TDbAvailableActions as R, relationStaticFilter as Rn, TValueFormatterPair as Rt, FlatOf$1 as S, TCascadePin as Sn, TFkLookupTarget as St, NullsPlacement$1 as T, resolveDesignType as Tn, TIdentification as Tt, TDbFieldMeta as U, TReadControls as Un, Uniquery$1 as Ut, TDbDefaultValue as V, DocumentFieldMapper as Vn, TWriteTableResolver as Vt, TDbForeignKey as W, NoopLogger as Wn, UniqueryControls$1 as Wt, TDbInsertIgnoreSlot as X, ALL_VIEW_CAPABILITIES as Xt, TDbInsertIgnoreResult as Y, UniquSelect as Yn, ALL_BUCKET_UNITS as Yt, TDbInsertManyIgnoreResult as Z, BaseDbAdapter as Zt, DbPatch as _, isFieldRef as _n, TExistingColumn as _t, isJsonValueField as a, isViewType as an, TDbStorageType as at, FieldOpsFor as b, IntegrityStrategy as bn, TFieldMeta as bt, resolveCalendarBuckets as c, AtscriptExprNode$1 as cn, TDbWriteAction as ct, AggregateFn$1 as d, AtscriptQueryFieldRef$1 as dn, TDbWriteGuard as dt, TAdapterFactory as en, TDbObjectKind as et, AggregateQuery$1 as f, AtscriptQueryNode$1 as fn, TDbWriteGuardContext as ft, DbControls as g, evaluateExpr as gn, TEnsureTableOptions as gt, AtscriptDbWritable as h, TViewPlan as hn, TDerivedColumn as ht, isBucketableField as i, isAtscriptDbView as in, TDbRemoveGuardContext as it, TCrudOp as j, TRelationFilterTable as jn, TRelationInfo as jt, TCascadeTarget as k, TRelGuardState as kn, TPrimaryKeyChange as kt, AggregateControls as l, AtscriptOrderItem as ln, TDbWriteCheck as lt, AtscriptDbTableLike as m, TViewJoin as mn, TDerivedChangeReason as mt, TComputedSelect as n, AtscriptDbView as nn, TDbRelation as nt, jsonValueAncestor as o, TViewReadPlan as on, TDbUpdateOptions as ot, AggregateResult as p, AtscriptRef as pn, TDeleteOptions as pt, TDbIndexType as q, TFirstLast as qn, isGeoIndexableType as qt, TResolvedBucket as r, TViewColumnMapping as rn, TDbRemoveGuard as rt, normalizeComputedSelect as s, aliasTargetOf as sn, TDbUpdateResult as st, TBucketFieldSource as t, TDbSpaceOptions as tn, TDbReferentialAction as tt, AggregateExpr$1 as u, AtscriptQueryComparison as un, TDbWriteCheckContext as ut, DbQuery as v, translateQueryTree as vn, TExistingForeignKey as vt, NullableOptional as w, DbResponse as wn, TIdResolveOptions as wt, FilterExpr$1 as x, NativeIntegrity as xn, TFkLookupResolver as xt, DbRow as y, AtscriptDbTable as yn, TExistingTableOption as yt, TDbCollation as z, DbEncryption as zn, TViewJsonType as zt };
4728
+ export { TDbInsertResult as $, ALL_VIEW_CAPABILITIES as $t, TColumnDiff as A, REL_FILTER_MAX_NODES as An, TPrimaryKeyChange as At, TDbDefaultFn as B, isResolvedRelationFilter as Bn, TValueFormatterPair as Bt, NavPropsOf$1 as C, IntegrityStrategy as Cn, TIdDescriptor as Ct, PrimaryKeyOf$1 as D, DbResponse as Dn, TJsonCopyTarget as Dt, OwnPropsOf$1 as E, AtscriptDbReadable as En, TInsertOptions as Et, TDbActionLevel as F, TRelationStaticFilter as Fn, TSyncColumnResult as Ft, TDbIndex as G, FieldMappingStrategy as Gn, Uniquery$1 as Gt, TDbDeleteResult as H, DbEncryption as Hn, TWriteOptions as Ht, TDbActionProcessor as I, andFilters as In, TSyncIndexesOptions as It, TDbInsertIgnoreOptions as J, TGenericLogger as Jn, TableMetadata as Jt, TDbIndexField as K, TReadControls as Kn, UniqueryControls$1 as Kt, TDbActionTargetSummary as L, containsRelationFilter as Ln, TTableOptionDiff as Lt, TCrudPermissions as M, TRelGuardState as Mn, TRelationInfo as Mt, TDbActionInfo as N, TRelationFilterJunction as Nn, TRowResolveOptions as Nt, TCascadeResolver as O, resolveDesignType as On, TMetaResponse as Ot, TDbActionIntent as P, TRelationFilterTable as Pn, TSearchIndexInfo as Pt, TDbInsertManyResult as Q, UniquSelect as Qn, ALL_BUCKET_UNITS as Qt, TDbAvailableActions as R, forEachResolvedRelation as Rn, TTableResolver as Rt, FlatOf$1 as S, AtscriptDbTable as Sn, TFkLookupTarget as St, NullsPlacement$1 as T, TCascadePin as Tn, TIdentification as Tt, TDbFieldMeta as U, TDbEncryptionOptions as Un, TWriteTableResolver as Ut, TDbDefaultValue as V, relationStaticFilter as Vn, TViewJsonType as Vt, TDbForeignKey as W, DocumentFieldMapper as Wn, TypedWithRelation as Wt, TDbInsertIgnoreSlot as X, TFirstLast as Xn, isGeoPointType as Xt, TDbInsertIgnoreResult as Y, TExprAggregate as Yn, isGeoIndexableType as Yt, TDbInsertManyIgnoreResult as Z, TRowOrderKey as Zn, TPathPresence as Zt, DbPatch as _, TViewJoin as _n, TExistingColumn as _t, isJsonValueField as a, AtscriptDbView as an, TDbStorageType as at, FieldOpsFor as b, isFieldRef as bn, TFieldMeta as bt, resolveCalendarBuckets as c, isViewType as cn, TDbWriteAction as ct, AggregateFn$1 as d, AtscriptExprNode$1 as dn, TDbWriteGuard as dt, BaseDbAdapter as en, TDbObjectKind as et, AggregateQuery$1 as f, AtscriptOrderItem as fn, TDbWriteGuardContext as ft, DbControls as g, AtscriptRef as gn, TEnsureTableOptions as gt, AtscriptDbWritable as h, AtscriptQueryNode$1 as hn, TDerivedColumn as ht, isBucketableField as i, TDbSpaceOptions as in, TDbRemoveGuardContext as it, TCrudOp as j, ResolvedRelationFilter as jn, TReferencingForeignKey as jt, TCascadeTarget as k, REL_FILTER_MAX_DEPTH as kn, TMetadataOverrides as kt, AggregateControls as l, TViewReadPlan as ln, TDbWriteCheck as lt, AtscriptDbTableLike as m, AtscriptQueryFieldRef$1 as mn, TDerivedChangeReason as mt, TComputedSelect as n, DbSpace as nn, TDbRelation as nt, jsonValueAncestor as o, TViewColumnMapping as on, TDbUpdateOptions as ot, AggregateResult as p, AtscriptQueryComparison as pn, TDeleteOptions as pt, TDbIndexType as q, NoopLogger as qn, WithRelation$1 as qt, TResolvedBucket as r, TAdapterFactory as rn, TDbRemoveGuard as rt, normalizeComputedSelect as s, isAtscriptDbView as sn, TDbUpdateResult as st, TBucketFieldSource as t, TViewCapability as tn, TDbReferentialAction as tt, AggregateExpr$1 as u, aliasTargetOf as un, TDbWriteCheckContext as ut, DbQuery as v, TViewPlan as vn, TExistingForeignKey as vt, NullableOptional as w, NativeIntegrity as wn, TIdResolveOptions as wt, FilterExpr$1 as x, translateQueryTree as xn, TFkLookupResolver as xt, DbRow as y, evaluateExpr as yn, TExistingTableOption as yt, TDbCollation as z, hasRelationOp as zn, TTouchManyOptions as zt };