@atscript/db 0.1.148 → 0.1.150
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/agg.d.cts +1 -1
- package/dist/agg.d.mts +1 -1
- package/dist/{buckets-DJiYlMXc.d.cts → buckets-24Ac4sIS.d.cts} +80 -5
- package/dist/{buckets-CNdTOnei.d.mts → buckets-XOz0Bw5x.d.mts} +80 -5
- package/dist/{column-diff-CUU4GvYg.cjs → column-diff-CKKBVDvx.cjs} +646 -341
- package/dist/{column-diff-Cp6ZoyRE.mjs → column-diff-CKLDWBbo.mjs} +522 -253
- package/dist/{fk-diff-BQ4krij8.d.cts → fk-diff-CCLiJ9sJ.d.cts} +2 -1
- package/dist/{fk-diff-DsaIijVX.d.mts → fk-diff-R8eU7gq-.d.mts} +2 -1
- package/dist/index.cjs +10 -3
- package/dist/index.d.cts +66 -4
- package/dist/index.d.mts +66 -4
- package/dist/index.mjs +3 -3
- package/dist/plugin.cjs +143 -36
- package/dist/plugin.mjs +138 -31
- package/dist/rel.d.cts +2 -2
- package/dist/rel.d.mts +2 -2
- package/dist/{relation-helpers-kX7jjgME.d.cts → relation-helpers-DjVJN2ng.d.cts} +1 -1
- package/dist/{relation-helpers-Ba0v49sn.d.mts → relation-helpers-H7UEVkHs.d.mts} +1 -1
- package/dist/search-fields-DBIZKwyb.mjs +117 -0
- package/dist/search-fields-DwrsJUC1.cjs +158 -0
- package/dist/shared.cjs +3 -1
- package/dist/shared.d.cts +19 -1
- package/dist/shared.d.mts +19 -1
- package/dist/shared.mjs +2 -2
- package/dist/sync.cjs +1 -1
- package/dist/sync.d.cts +2 -2
- package/dist/sync.d.mts +2 -2
- package/dist/sync.mjs +1 -1
- package/dist/{validation-utils-Dq0uZ7ef.mjs → validation-utils-DqZAH6aT.mjs} +44 -2
- package/dist/{validation-utils-Da2GjobR.cjs → validation-utils-debIYpq0.cjs} +56 -2
- package/package.json +6 -6
- package/dist/derived-rules-0sKn4f5C.mjs +0 -44
- package/dist/derived-rules-YstgIxG-.cjs +0 -67
- package/dist/numeric-operand-B1jKH7x5.mjs +0 -21
- package/dist/numeric-operand-DKfiRLYp.cjs +0 -26
package/dist/agg.d.cts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { r as TResolvedBucket } from "./buckets-
|
|
1
|
+
import { r as TResolvedBucket } from "./buckets-24Ac4sIS.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-
|
|
1
|
+
import { r as TResolvedBucket } from "./buckets-XOz0Bw5x.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 };
|
|
@@ -744,6 +744,14 @@ declare class AtscriptDbReadable<T extends TAtscriptAnnotatedType = TAtscriptAnn
|
|
|
744
744
|
* @internal Adapter-facing surface; not part of the consumer API.
|
|
745
745
|
*/
|
|
746
746
|
get versionColumnPhysical(): string | undefined;
|
|
747
|
+
/**
|
|
748
|
+
* Logical paths of the `@db.column.version.exempt` fields, including objects
|
|
749
|
+
* whose direct children are all exempt. A patch that writes only these (and
|
|
750
|
+
* no `$cas`) does not bump the version column. Empty when the table has no
|
|
751
|
+
* `@db.column.version`.
|
|
752
|
+
* @since 0.1.150
|
|
753
|
+
*/
|
|
754
|
+
get versionExemptFields(): ReadonlySet<string>;
|
|
747
755
|
/** Dimension fields from `@db.column.dimension`. */
|
|
748
756
|
get dimensions(): readonly string[];
|
|
749
757
|
/** Measure fields from `@db.column.measure`. */
|
|
@@ -2044,6 +2052,13 @@ declare abstract class BaseDbAdapter {
|
|
|
2044
2052
|
* When disabled, no log strings are constructed — zero overhead.
|
|
2045
2053
|
*/
|
|
2046
2054
|
setVerbose(enabled: boolean): void;
|
|
2055
|
+
/**
|
|
2056
|
+
* Physical version column an UPDATE must bump, or `undefined` when it must
|
|
2057
|
+
* not: no `@db.column.version`, or a version-exempt patch
|
|
2058
|
+
* (`opts.keepVersion`, since 0.1.150 — the core never combines it with
|
|
2059
|
+
* `expectedVersion`; a violation throws).
|
|
2060
|
+
*/
|
|
2061
|
+
protected _versionColumnFor(opts?: TDbUpdateOptions, expectedVersion?: number): string | undefined;
|
|
2047
2062
|
/**
|
|
2048
2063
|
* Logs a debug message if verbose mode is enabled.
|
|
2049
2064
|
* Adapters call this to log DB operations with zero overhead when disabled.
|
|
@@ -2309,9 +2324,10 @@ declare abstract class BaseDbAdapter {
|
|
|
2309
2324
|
*
|
|
2310
2325
|
* @param filter - Filter identifying the record to patch.
|
|
2311
2326
|
* @param patch - The patch payload with array operations.
|
|
2327
|
+
* @param opts - `keepVersion`: skip the version bump (see {@link TDbUpdateOptions}).
|
|
2312
2328
|
* @returns Update result.
|
|
2313
2329
|
*/
|
|
2314
|
-
nativePatch(_filter: FilterExpr, _patch: unknown, _ops?: TFieldOps, _expectedVersion?: number): Promise<TDbUpdateResult>;
|
|
2330
|
+
nativePatch(_filter: FilterExpr, _patch: unknown, _ops?: TFieldOps, _expectedVersion?: number, _opts?: TDbUpdateOptions): Promise<TDbUpdateResult>;
|
|
2315
2331
|
/**
|
|
2316
2332
|
* Called before field flattening begins.
|
|
2317
2333
|
* Use to extract table-level adapter-specific annotations.
|
|
@@ -2416,6 +2432,13 @@ declare abstract class BaseDbAdapter {
|
|
|
2416
2432
|
/**
|
|
2417
2433
|
* Returns available search indexes for this adapter.
|
|
2418
2434
|
* UI uses this to show index picker. Override in adapters that support search.
|
|
2435
|
+
*
|
|
2436
|
+
* A fulltext index may carry integer members ({@link TDbIndexField.integer},
|
|
2437
|
+
* since 0.1.150): list them in `fields`, keep them out of the physical text
|
|
2438
|
+
* index, and OR `member = n` into the search predicate when
|
|
2439
|
+
* `searchTermInteger(text)` is defined. An index of integer members only
|
|
2440
|
+
* is still listed (it makes the table natively searchable); a term that is
|
|
2441
|
+
* not a whole number then matches nothing.
|
|
2419
2442
|
*/
|
|
2420
2443
|
getSearchIndexes(): TSearchIndexInfo[];
|
|
2421
2444
|
private _physicalToLogical?;
|
|
@@ -2444,7 +2467,9 @@ declare abstract class BaseDbAdapter {
|
|
|
2444
2467
|
*/
|
|
2445
2468
|
isVectorSearchable(): boolean;
|
|
2446
2469
|
/**
|
|
2447
|
-
* Full-text search. Override in adapters that support search.
|
|
2470
|
+
* Full-text search. Override in adapters that support search. The text
|
|
2471
|
+
* match is OR'd with exact-number equality on the index's integer members
|
|
2472
|
+
* when the whole term is a whole number (see `searchTermInteger`).
|
|
2448
2473
|
*
|
|
2449
2474
|
* @param text - Search text.
|
|
2450
2475
|
* @param query - Filter, sort, limit, etc.
|
|
@@ -2563,12 +2588,17 @@ declare abstract class BaseDbAdapter {
|
|
|
2563
2588
|
/** Whether {@link insertManyIgnore} is implemented (drives `crud.insert: ["onConflict"]` in `/meta`). @since 0.1.148 */
|
|
2564
2589
|
supportsInsertIgnore(): boolean;
|
|
2565
2590
|
abstract replaceOne(filter: FilterExpr, data: Record<string, unknown>, expectedVersion?: number): Promise<TDbUpdateResult>;
|
|
2566
|
-
|
|
2591
|
+
/**
|
|
2592
|
+
* `opts.keepVersion` — skip the version bump (and never combine with
|
|
2593
|
+
* `expectedVersion`); see {@link TDbUpdateOptions}.
|
|
2594
|
+
*/
|
|
2595
|
+
abstract updateOne(filter: FilterExpr, data: Record<string, unknown>, ops?: TFieldOps, expectedVersion?: number, opts?: TDbUpdateOptions): Promise<TDbUpdateResult>;
|
|
2567
2596
|
abstract deleteOne(filter: FilterExpr): Promise<TDbDeleteResult>;
|
|
2568
2597
|
abstract findOne(query: DbQuery): Promise<Record<string, unknown> | null>;
|
|
2569
2598
|
abstract findMany(query: DbQuery): Promise<Array<Record<string, unknown>>>;
|
|
2570
2599
|
abstract count(query: DbQuery): Promise<number>;
|
|
2571
|
-
|
|
2600
|
+
/** `opts.keepVersion` — skip the version bump; see {@link TDbUpdateOptions}. */
|
|
2601
|
+
abstract updateMany(filter: FilterExpr, data: Record<string, unknown>, ops?: TFieldOps, opts?: TDbUpdateOptions): Promise<TDbUpdateResult>;
|
|
2572
2602
|
abstract replaceMany(filter: FilterExpr, data: Record<string, unknown>): Promise<TDbUpdateResult>;
|
|
2573
2603
|
abstract deleteMany(filter: FilterExpr): Promise<TDbDeleteResult>;
|
|
2574
2604
|
/**
|
|
@@ -2862,6 +2892,15 @@ declare class TableMetadata {
|
|
|
2862
2892
|
measures: string[];
|
|
2863
2893
|
/** Logical field name annotated with `@db.column.version`, if any. */
|
|
2864
2894
|
versionField?: string;
|
|
2895
|
+
/** Paths annotated with `@db.column.version.exempt`, as declared (since 0.1.150). */
|
|
2896
|
+
private _versionExemptDeclared;
|
|
2897
|
+
/**
|
|
2898
|
+
* Version-exempt paths (since 0.1.150): the declared ones plus every object
|
|
2899
|
+
* whose direct children are all exempt (upward closure). A path is exempt
|
|
2900
|
+
* when it, or an ancestor, is in this set — see {@link isVersionExemptPath}.
|
|
2901
|
+
* Empty when the table declares no `@db.column.version`.
|
|
2902
|
+
*/
|
|
2903
|
+
versionExemptPaths: ReadonlySet<string>;
|
|
2865
2904
|
/** path → sibling-ref path for `@db.amount.currency.ref` / `@db.unit.ref`. */
|
|
2866
2905
|
quantityRefByField: Map<string, string>;
|
|
2867
2906
|
/** Logical paths annotated with `@db.encrypted` — stored as one opaque ciphertext column. */
|
|
@@ -2977,6 +3016,16 @@ declare class TableMetadata {
|
|
|
2977
3016
|
* Scans `@db.*` and `@meta.id` annotations on a field during flattening.
|
|
2978
3017
|
*/
|
|
2979
3018
|
private _scanGenericAnnotations;
|
|
3019
|
+
/**
|
|
3020
|
+
* Validates the `@db.column.version.exempt` placements (E1–E5, the runtime
|
|
3021
|
+
* mirror of the compile-time check, so pre-compiled models fail fast) and
|
|
3022
|
+
* computes {@link versionExemptPaths} with its upward closure. Runs after
|
|
3023
|
+
* `_applyOverrides` (the primary keys are final) and before `jsonFields` is
|
|
3024
|
+
* released. A table without a version column ignores the annotation.
|
|
3025
|
+
*/
|
|
3026
|
+
private _finalizeVersionExempt;
|
|
3027
|
+
/** Whether `path` — or an ancestor of it — is version-exempt (since 0.1.150). */
|
|
3028
|
+
isVersionExemptPath(path: string): boolean;
|
|
2980
3029
|
/**
|
|
2981
3030
|
* Build-time diagnostics for `@db.encrypted` (§6 of the field-encryption
|
|
2982
3031
|
* spec). Mirrors the compile-time AnnotationSpec validation so models built
|
|
@@ -3030,6 +3079,13 @@ declare class TableMetadata {
|
|
|
3030
3079
|
* Resolves `fkTargetField` for FK fields in field descriptors.
|
|
3031
3080
|
*/
|
|
3032
3081
|
private _resolveFkTargetFields;
|
|
3082
|
+
/**
|
|
3083
|
+
* Flags the integer members of fulltext indexes (matched by exact number,
|
|
3084
|
+
* never part of the physical text index) and enforces that each is
|
|
3085
|
+
* index-backed — the equality branch must not scan. Runs while index field
|
|
3086
|
+
* names are still logical.
|
|
3087
|
+
*/
|
|
3088
|
+
private _resolveIntegerFulltextMembers;
|
|
3033
3089
|
private _finalizeIndexes;
|
|
3034
3090
|
/**
|
|
3035
3091
|
* Captures legitimate row-identifier shapes from the metadata: primary key
|
|
@@ -3446,6 +3502,18 @@ interface TDbUpdateResult {
|
|
|
3446
3502
|
matchedCount: number;
|
|
3447
3503
|
modifiedCount: number;
|
|
3448
3504
|
}
|
|
3505
|
+
/**
|
|
3506
|
+
* Per-call options of an adapter UPDATE (since 0.1.150).
|
|
3507
|
+
*/
|
|
3508
|
+
interface TDbUpdateOptions {
|
|
3509
|
+
/**
|
|
3510
|
+
* The patch writes only `@db.column.version.exempt` fields: leave the
|
|
3511
|
+
* version column untouched (no `+1`). The core sets it only for CAS-free
|
|
3512
|
+
* patches — never together with `expectedVersion`. An adapter that ignores
|
|
3513
|
+
* the option keeps bumping (the pre-0.1.150 behaviour).
|
|
3514
|
+
*/
|
|
3515
|
+
keepVersion?: boolean;
|
|
3516
|
+
}
|
|
3449
3517
|
interface TDbDeleteResult {
|
|
3450
3518
|
deletedCount: number;
|
|
3451
3519
|
}
|
|
@@ -3469,6 +3537,13 @@ interface TDbIndexField {
|
|
|
3469
3537
|
* re-resolving the field type. Undefined when the field cannot be resolved.
|
|
3470
3538
|
*/
|
|
3471
3539
|
designType?: string;
|
|
3540
|
+
/**
|
|
3541
|
+
* Fulltext member matched by exact whole-number equality, never part of the
|
|
3542
|
+
* physical text index (integer field; since 0.1.150). Adapters exclude it
|
|
3543
|
+
* from text DDL and OR `member = n` into their search predicate when the
|
|
3544
|
+
* search term is a whole number (see `searchTermInteger`).
|
|
3545
|
+
*/
|
|
3546
|
+
integer?: boolean;
|
|
3472
3547
|
}
|
|
3473
3548
|
interface TDbIndex {
|
|
3474
3549
|
/** Unique key used for identity/diffing (e.g., "atscript__plain__email") */
|
|
@@ -4263,4 +4338,4 @@ declare function isJsonValueField(fd: TDbFieldMeta): boolean;
|
|
|
4263
4338
|
*/
|
|
4264
4339
|
declare function jsonValueAncestor(path: string, jsonValueParents: ReadonlySet<string>): string | undefined;
|
|
4265
4340
|
//#endregion
|
|
4266
|
-
export { TDbReferentialAction as $,
|
|
4341
|
+
export { TDbReferentialAction as $, TDbSpaceOptions as $t, TCrudOp as A, andFilters as An, TRowResolveOptions as At, TDbDefaultValue as B, TReadControls as Bn, TypedWithRelation as Bt, NavPropsOf$1 as C, REL_FILTER_MAX_DEPTH as Cn, TIdentification as Ct, TCascadeResolver as D, TRelationFilterJunction as Dn, TPrimaryKeyChange as Dt, PrimaryKeyOf$1 as E, TRelGuardState as En, TMetadataOverrides as Et, TDbActionProcessor as F, relationStaticFilter as Fn, TTouchManyOptions as Ft, TDbIndexField as G, TRowOrderKey as Gn, isGeoIndexableType as Gt, TDbFieldMeta as H, TGenericLogger as Hn, UniqueryControls$1 as Ht, TDbActionTargetSummary as I, DbEncryption as In, TValueFormatterPair as It, TDbInsertIgnoreSlot as J, ALL_VIEW_CAPABILITIES as Jt, TDbIndexType as K, UniquSelect as Kn, isGeoPointType as Kt, TDbAvailableActions as L, TDbEncryptionOptions as Ln, TViewJsonType as Lt, TDbActionInfo as M, forEachResolvedRelation as Mn, TSyncColumnResult as Mt, TDbActionIntent as N, hasRelationOp as Nn, TTableOptionDiff as Nt, TCascadeTarget as O, TRelationFilterTable as On, TReferencingForeignKey as Ot, TDbActionLevel as P, isResolvedRelationFilter as Pn, TTableResolver as Pt, TDbObjectKind as Q, TAdapterFactory as Qt, TDbCollation as R, DocumentFieldMapper as Rn, TWriteOptions as Rt, FlatOf$1 as S, resolveDesignType as Sn, TIdResolveOptions as St, OwnPropsOf$1 as T, ResolvedRelationFilter as Tn, TMetaResponse as Tt, TDbForeignKey as U, TExprAggregate as Un, WithRelation$1 as Ut, TDbDeleteResult as V, NoopLogger as Vn, Uniquery$1 as Vt, TDbIndex as W, TFirstLast as Wn, TableMetadata as Wt, TDbInsertManyResult as X, TViewCapability as Xt, TDbInsertManyIgnoreResult as Y, BaseDbAdapter as Yt, TDbInsertResult as Z, DbSpace as Zt, DbPatch as _, IntegrityStrategy as _n, TExistingTableOption as _t, isJsonValueField as a, AtscriptExprNode$1 as an, TDbUpdateResult as at, FieldOpsFor as b, AtscriptDbReadable as bn, TFkLookupTarget as bt, resolveCalendarBuckets as c, AtscriptQueryFieldRef$1 as cn, TDbWriteCheckContext as ct, AggregateFn$1 as d, TViewJoin as dn, TDeleteOptions as dt, AtscriptDbView as en, TDbRelation as et, AggregateQuery$1 as f, TViewPlan as fn, TDerivedChangeReason as ft, DbControls as g, AtscriptDbTable as gn, TExistingForeignKey as gt, AtscriptDbWritable as h, translateQueryTree as hn, TExistingColumn as ht, isBucketableField as i, aliasTargetOf as in, TDbUpdateOptions as it, TCrudPermissions as j, containsRelationFilter as jn, TSearchIndexInfo as jt, TColumnDiff as k, TRelationStaticFilter as kn, TRelationInfo as kt, AggregateControls as l, AtscriptQueryNode$1 as ln, TDbWriteGuard as lt, AtscriptDbTableLike as m, isFieldRef as mn, TEnsureTableOptions as mt, TComputedSelect as n, isAtscriptDbView as nn, TDbRemoveGuardContext as nt, jsonValueAncestor as o, AtscriptOrderItem as on, TDbWriteAction as ot, AggregateResult as p, evaluateExpr as pn, TDerivedColumn as pt, TDbInsertIgnoreResult as q, ALL_BUCKET_UNITS as qt, TResolvedBucket as r, isViewType as rn, TDbStorageType as rt, normalizeComputedSelect as s, AtscriptQueryComparison as sn, TDbWriteCheck as st, TBucketFieldSource as t, TViewColumnMapping as tn, TDbRemoveGuard as tt, AggregateExpr$1 as u, AtscriptRef as un, TDbWriteGuardContext as ut, DbQuery as v, NativeIntegrity as vn, TFieldMeta as vt, NullableOptional as w, REL_FILTER_MAX_NODES as wn, TInsertOptions as wt, FilterExpr$1 as x, DbResponse as xn, TIdDescriptor as xt, DbRow as y, TCascadePin as yn, TFkLookupResolver as yt, TDbDefaultFn as z, FieldMappingStrategy as zn, TWriteTableResolver as zt };
|
|
@@ -744,6 +744,14 @@ declare class AtscriptDbReadable<T extends TAtscriptAnnotatedType = TAtscriptAnn
|
|
|
744
744
|
* @internal Adapter-facing surface; not part of the consumer API.
|
|
745
745
|
*/
|
|
746
746
|
get versionColumnPhysical(): string | undefined;
|
|
747
|
+
/**
|
|
748
|
+
* Logical paths of the `@db.column.version.exempt` fields, including objects
|
|
749
|
+
* whose direct children are all exempt. A patch that writes only these (and
|
|
750
|
+
* no `$cas`) does not bump the version column. Empty when the table has no
|
|
751
|
+
* `@db.column.version`.
|
|
752
|
+
* @since 0.1.150
|
|
753
|
+
*/
|
|
754
|
+
get versionExemptFields(): ReadonlySet<string>;
|
|
747
755
|
/** Dimension fields from `@db.column.dimension`. */
|
|
748
756
|
get dimensions(): readonly string[];
|
|
749
757
|
/** Measure fields from `@db.column.measure`. */
|
|
@@ -2044,6 +2052,13 @@ declare abstract class BaseDbAdapter {
|
|
|
2044
2052
|
* When disabled, no log strings are constructed — zero overhead.
|
|
2045
2053
|
*/
|
|
2046
2054
|
setVerbose(enabled: boolean): void;
|
|
2055
|
+
/**
|
|
2056
|
+
* Physical version column an UPDATE must bump, or `undefined` when it must
|
|
2057
|
+
* not: no `@db.column.version`, or a version-exempt patch
|
|
2058
|
+
* (`opts.keepVersion`, since 0.1.150 — the core never combines it with
|
|
2059
|
+
* `expectedVersion`; a violation throws).
|
|
2060
|
+
*/
|
|
2061
|
+
protected _versionColumnFor(opts?: TDbUpdateOptions, expectedVersion?: number): string | undefined;
|
|
2047
2062
|
/**
|
|
2048
2063
|
* Logs a debug message if verbose mode is enabled.
|
|
2049
2064
|
* Adapters call this to log DB operations with zero overhead when disabled.
|
|
@@ -2309,9 +2324,10 @@ declare abstract class BaseDbAdapter {
|
|
|
2309
2324
|
*
|
|
2310
2325
|
* @param filter - Filter identifying the record to patch.
|
|
2311
2326
|
* @param patch - The patch payload with array operations.
|
|
2327
|
+
* @param opts - `keepVersion`: skip the version bump (see {@link TDbUpdateOptions}).
|
|
2312
2328
|
* @returns Update result.
|
|
2313
2329
|
*/
|
|
2314
|
-
nativePatch(_filter: FilterExpr, _patch: unknown, _ops?: TFieldOps, _expectedVersion?: number): Promise<TDbUpdateResult>;
|
|
2330
|
+
nativePatch(_filter: FilterExpr, _patch: unknown, _ops?: TFieldOps, _expectedVersion?: number, _opts?: TDbUpdateOptions): Promise<TDbUpdateResult>;
|
|
2315
2331
|
/**
|
|
2316
2332
|
* Called before field flattening begins.
|
|
2317
2333
|
* Use to extract table-level adapter-specific annotations.
|
|
@@ -2416,6 +2432,13 @@ declare abstract class BaseDbAdapter {
|
|
|
2416
2432
|
/**
|
|
2417
2433
|
* Returns available search indexes for this adapter.
|
|
2418
2434
|
* UI uses this to show index picker. Override in adapters that support search.
|
|
2435
|
+
*
|
|
2436
|
+
* A fulltext index may carry integer members ({@link TDbIndexField.integer},
|
|
2437
|
+
* since 0.1.150): list them in `fields`, keep them out of the physical text
|
|
2438
|
+
* index, and OR `member = n` into the search predicate when
|
|
2439
|
+
* `searchTermInteger(text)` is defined. An index of integer members only
|
|
2440
|
+
* is still listed (it makes the table natively searchable); a term that is
|
|
2441
|
+
* not a whole number then matches nothing.
|
|
2419
2442
|
*/
|
|
2420
2443
|
getSearchIndexes(): TSearchIndexInfo[];
|
|
2421
2444
|
private _physicalToLogical?;
|
|
@@ -2444,7 +2467,9 @@ declare abstract class BaseDbAdapter {
|
|
|
2444
2467
|
*/
|
|
2445
2468
|
isVectorSearchable(): boolean;
|
|
2446
2469
|
/**
|
|
2447
|
-
* Full-text search. Override in adapters that support search.
|
|
2470
|
+
* Full-text search. Override in adapters that support search. The text
|
|
2471
|
+
* match is OR'd with exact-number equality on the index's integer members
|
|
2472
|
+
* when the whole term is a whole number (see `searchTermInteger`).
|
|
2448
2473
|
*
|
|
2449
2474
|
* @param text - Search text.
|
|
2450
2475
|
* @param query - Filter, sort, limit, etc.
|
|
@@ -2563,12 +2588,17 @@ declare abstract class BaseDbAdapter {
|
|
|
2563
2588
|
/** Whether {@link insertManyIgnore} is implemented (drives `crud.insert: ["onConflict"]` in `/meta`). @since 0.1.148 */
|
|
2564
2589
|
supportsInsertIgnore(): boolean;
|
|
2565
2590
|
abstract replaceOne(filter: FilterExpr, data: Record<string, unknown>, expectedVersion?: number): Promise<TDbUpdateResult>;
|
|
2566
|
-
|
|
2591
|
+
/**
|
|
2592
|
+
* `opts.keepVersion` — skip the version bump (and never combine with
|
|
2593
|
+
* `expectedVersion`); see {@link TDbUpdateOptions}.
|
|
2594
|
+
*/
|
|
2595
|
+
abstract updateOne(filter: FilterExpr, data: Record<string, unknown>, ops?: TFieldOps, expectedVersion?: number, opts?: TDbUpdateOptions): Promise<TDbUpdateResult>;
|
|
2567
2596
|
abstract deleteOne(filter: FilterExpr): Promise<TDbDeleteResult>;
|
|
2568
2597
|
abstract findOne(query: DbQuery): Promise<Record<string, unknown> | null>;
|
|
2569
2598
|
abstract findMany(query: DbQuery): Promise<Array<Record<string, unknown>>>;
|
|
2570
2599
|
abstract count(query: DbQuery): Promise<number>;
|
|
2571
|
-
|
|
2600
|
+
/** `opts.keepVersion` — skip the version bump; see {@link TDbUpdateOptions}. */
|
|
2601
|
+
abstract updateMany(filter: FilterExpr, data: Record<string, unknown>, ops?: TFieldOps, opts?: TDbUpdateOptions): Promise<TDbUpdateResult>;
|
|
2572
2602
|
abstract replaceMany(filter: FilterExpr, data: Record<string, unknown>): Promise<TDbUpdateResult>;
|
|
2573
2603
|
abstract deleteMany(filter: FilterExpr): Promise<TDbDeleteResult>;
|
|
2574
2604
|
/**
|
|
@@ -2862,6 +2892,15 @@ declare class TableMetadata {
|
|
|
2862
2892
|
measures: string[];
|
|
2863
2893
|
/** Logical field name annotated with `@db.column.version`, if any. */
|
|
2864
2894
|
versionField?: string;
|
|
2895
|
+
/** Paths annotated with `@db.column.version.exempt`, as declared (since 0.1.150). */
|
|
2896
|
+
private _versionExemptDeclared;
|
|
2897
|
+
/**
|
|
2898
|
+
* Version-exempt paths (since 0.1.150): the declared ones plus every object
|
|
2899
|
+
* whose direct children are all exempt (upward closure). A path is exempt
|
|
2900
|
+
* when it, or an ancestor, is in this set — see {@link isVersionExemptPath}.
|
|
2901
|
+
* Empty when the table declares no `@db.column.version`.
|
|
2902
|
+
*/
|
|
2903
|
+
versionExemptPaths: ReadonlySet<string>;
|
|
2865
2904
|
/** path → sibling-ref path for `@db.amount.currency.ref` / `@db.unit.ref`. */
|
|
2866
2905
|
quantityRefByField: Map<string, string>;
|
|
2867
2906
|
/** Logical paths annotated with `@db.encrypted` — stored as one opaque ciphertext column. */
|
|
@@ -2977,6 +3016,16 @@ declare class TableMetadata {
|
|
|
2977
3016
|
* Scans `@db.*` and `@meta.id` annotations on a field during flattening.
|
|
2978
3017
|
*/
|
|
2979
3018
|
private _scanGenericAnnotations;
|
|
3019
|
+
/**
|
|
3020
|
+
* Validates the `@db.column.version.exempt` placements (E1–E5, the runtime
|
|
3021
|
+
* mirror of the compile-time check, so pre-compiled models fail fast) and
|
|
3022
|
+
* computes {@link versionExemptPaths} with its upward closure. Runs after
|
|
3023
|
+
* `_applyOverrides` (the primary keys are final) and before `jsonFields` is
|
|
3024
|
+
* released. A table without a version column ignores the annotation.
|
|
3025
|
+
*/
|
|
3026
|
+
private _finalizeVersionExempt;
|
|
3027
|
+
/** Whether `path` — or an ancestor of it — is version-exempt (since 0.1.150). */
|
|
3028
|
+
isVersionExemptPath(path: string): boolean;
|
|
2980
3029
|
/**
|
|
2981
3030
|
* Build-time diagnostics for `@db.encrypted` (§6 of the field-encryption
|
|
2982
3031
|
* spec). Mirrors the compile-time AnnotationSpec validation so models built
|
|
@@ -3030,6 +3079,13 @@ declare class TableMetadata {
|
|
|
3030
3079
|
* Resolves `fkTargetField` for FK fields in field descriptors.
|
|
3031
3080
|
*/
|
|
3032
3081
|
private _resolveFkTargetFields;
|
|
3082
|
+
/**
|
|
3083
|
+
* Flags the integer members of fulltext indexes (matched by exact number,
|
|
3084
|
+
* never part of the physical text index) and enforces that each is
|
|
3085
|
+
* index-backed — the equality branch must not scan. Runs while index field
|
|
3086
|
+
* names are still logical.
|
|
3087
|
+
*/
|
|
3088
|
+
private _resolveIntegerFulltextMembers;
|
|
3033
3089
|
private _finalizeIndexes;
|
|
3034
3090
|
/**
|
|
3035
3091
|
* Captures legitimate row-identifier shapes from the metadata: primary key
|
|
@@ -3446,6 +3502,18 @@ interface TDbUpdateResult {
|
|
|
3446
3502
|
matchedCount: number;
|
|
3447
3503
|
modifiedCount: number;
|
|
3448
3504
|
}
|
|
3505
|
+
/**
|
|
3506
|
+
* Per-call options of an adapter UPDATE (since 0.1.150).
|
|
3507
|
+
*/
|
|
3508
|
+
interface TDbUpdateOptions {
|
|
3509
|
+
/**
|
|
3510
|
+
* The patch writes only `@db.column.version.exempt` fields: leave the
|
|
3511
|
+
* version column untouched (no `+1`). The core sets it only for CAS-free
|
|
3512
|
+
* patches — never together with `expectedVersion`. An adapter that ignores
|
|
3513
|
+
* the option keeps bumping (the pre-0.1.150 behaviour).
|
|
3514
|
+
*/
|
|
3515
|
+
keepVersion?: boolean;
|
|
3516
|
+
}
|
|
3449
3517
|
interface TDbDeleteResult {
|
|
3450
3518
|
deletedCount: number;
|
|
3451
3519
|
}
|
|
@@ -3469,6 +3537,13 @@ interface TDbIndexField {
|
|
|
3469
3537
|
* re-resolving the field type. Undefined when the field cannot be resolved.
|
|
3470
3538
|
*/
|
|
3471
3539
|
designType?: string;
|
|
3540
|
+
/**
|
|
3541
|
+
* Fulltext member matched by exact whole-number equality, never part of the
|
|
3542
|
+
* physical text index (integer field; since 0.1.150). Adapters exclude it
|
|
3543
|
+
* from text DDL and OR `member = n` into their search predicate when the
|
|
3544
|
+
* search term is a whole number (see `searchTermInteger`).
|
|
3545
|
+
*/
|
|
3546
|
+
integer?: boolean;
|
|
3472
3547
|
}
|
|
3473
3548
|
interface TDbIndex {
|
|
3474
3549
|
/** Unique key used for identity/diffing (e.g., "atscript__plain__email") */
|
|
@@ -4263,4 +4338,4 @@ declare function isJsonValueField(fd: TDbFieldMeta): boolean;
|
|
|
4263
4338
|
*/
|
|
4264
4339
|
declare function jsonValueAncestor(path: string, jsonValueParents: ReadonlySet<string>): string | undefined;
|
|
4265
4340
|
//#endregion
|
|
4266
|
-
export { TDbReferentialAction as $,
|
|
4341
|
+
export { TDbReferentialAction as $, TDbSpaceOptions as $t, TCrudOp as A, andFilters as An, TRowResolveOptions as At, TDbDefaultValue as B, TReadControls as Bn, TypedWithRelation as Bt, NavPropsOf$1 as C, REL_FILTER_MAX_DEPTH as Cn, TIdentification as Ct, TCascadeResolver as D, TRelationFilterJunction as Dn, TPrimaryKeyChange as Dt, PrimaryKeyOf$1 as E, TRelGuardState as En, TMetadataOverrides as Et, TDbActionProcessor as F, relationStaticFilter as Fn, TTouchManyOptions as Ft, TDbIndexField as G, TRowOrderKey as Gn, isGeoIndexableType as Gt, TDbFieldMeta as H, TGenericLogger as Hn, UniqueryControls$1 as Ht, TDbActionTargetSummary as I, DbEncryption as In, TValueFormatterPair as It, TDbInsertIgnoreSlot as J, ALL_VIEW_CAPABILITIES as Jt, TDbIndexType as K, UniquSelect as Kn, isGeoPointType as Kt, TDbAvailableActions as L, TDbEncryptionOptions as Ln, TViewJsonType as Lt, TDbActionInfo as M, forEachResolvedRelation as Mn, TSyncColumnResult as Mt, TDbActionIntent as N, hasRelationOp as Nn, TTableOptionDiff as Nt, TCascadeTarget as O, TRelationFilterTable as On, TReferencingForeignKey as Ot, TDbActionLevel as P, isResolvedRelationFilter as Pn, TTableResolver as Pt, TDbObjectKind as Q, TAdapterFactory as Qt, TDbCollation as R, DocumentFieldMapper as Rn, TWriteOptions as Rt, FlatOf$1 as S, resolveDesignType as Sn, TIdResolveOptions as St, OwnPropsOf$1 as T, ResolvedRelationFilter as Tn, TMetaResponse as Tt, TDbForeignKey as U, TExprAggregate as Un, WithRelation$1 as Ut, TDbDeleteResult as V, NoopLogger as Vn, Uniquery$1 as Vt, TDbIndex as W, TFirstLast as Wn, TableMetadata as Wt, TDbInsertManyResult as X, TViewCapability as Xt, TDbInsertManyIgnoreResult as Y, BaseDbAdapter as Yt, TDbInsertResult as Z, DbSpace as Zt, DbPatch as _, IntegrityStrategy as _n, TExistingTableOption as _t, isJsonValueField as a, AtscriptExprNode$1 as an, TDbUpdateResult as at, FieldOpsFor as b, AtscriptDbReadable as bn, TFkLookupTarget as bt, resolveCalendarBuckets as c, AtscriptQueryFieldRef$1 as cn, TDbWriteCheckContext as ct, AggregateFn$1 as d, TViewJoin as dn, TDeleteOptions as dt, AtscriptDbView as en, TDbRelation as et, AggregateQuery$1 as f, TViewPlan as fn, TDerivedChangeReason as ft, DbControls as g, AtscriptDbTable as gn, TExistingForeignKey as gt, AtscriptDbWritable as h, translateQueryTree as hn, TExistingColumn as ht, isBucketableField as i, aliasTargetOf as in, TDbUpdateOptions as it, TCrudPermissions as j, containsRelationFilter as jn, TSearchIndexInfo as jt, TColumnDiff as k, TRelationStaticFilter as kn, TRelationInfo as kt, AggregateControls as l, AtscriptQueryNode$1 as ln, TDbWriteGuard as lt, AtscriptDbTableLike as m, isFieldRef as mn, TEnsureTableOptions as mt, TComputedSelect as n, isAtscriptDbView as nn, TDbRemoveGuardContext as nt, jsonValueAncestor as o, AtscriptOrderItem as on, TDbWriteAction as ot, AggregateResult as p, evaluateExpr as pn, TDerivedColumn as pt, TDbInsertIgnoreResult as q, ALL_BUCKET_UNITS as qt, TResolvedBucket as r, isViewType as rn, TDbStorageType as rt, normalizeComputedSelect as s, AtscriptQueryComparison as sn, TDbWriteCheck as st, TBucketFieldSource as t, TViewColumnMapping as tn, TDbRemoveGuard as tt, AggregateExpr$1 as u, AtscriptRef as un, TDbWriteGuardContext as ut, DbQuery as v, NativeIntegrity as vn, TFieldMeta as vt, NullableOptional as w, REL_FILTER_MAX_NODES as wn, TInsertOptions as wt, FilterExpr$1 as x, DbResponse as xn, TIdDescriptor as xt, DbRow as y, TCascadePin as yn, TFkLookupResolver as yt, TDbDefaultFn as z, FieldMappingStrategy as zn, TWriteTableResolver as zt };
|