@voltro/database 0.44.1 → 0.46.0
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/CHANGELOG.md +280 -1
- package/dist/{frameworkLiveTables-XPFqj8n3.js → frameworkLiveTables-DNu6F6P8.js} +35 -35
- package/dist/index.d.ts +103 -1
- package/dist/index.js +776 -747
- package/dist/sql.js +579 -579
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -819,7 +819,6 @@ export declare const clearResidencyConfig: () => void;
|
|
|
819
819
|
/** Test seam — drop all registrations. */
|
|
820
820
|
export declare const clearRetentions: () => void;
|
|
821
821
|
|
|
822
|
-
/** Wipe — used by tests + the dev-loop hot-reload. */
|
|
823
822
|
export declare const clearTableRegistry: () => void;
|
|
824
823
|
|
|
825
824
|
/** Test seam / dev-restart seam. */
|
|
@@ -2658,6 +2657,25 @@ export declare const defineSeed: (input: SeedDefinitionInput) => SeedDefinition;
|
|
|
2658
2657
|
|
|
2659
2658
|
export declare const denseRank: (alias?: string) => WindowBuilder;
|
|
2660
2659
|
|
|
2660
|
+
/**
|
|
2661
|
+
* A deterministic primary key over `parts`, of constant length.
|
|
2662
|
+
*
|
|
2663
|
+
* `derivedRowId('rowver', table, rowId, version)` → `rowver_<32 hex>` — 39
|
|
2664
|
+
* characters for that prefix, no matter what the parts are.
|
|
2665
|
+
*
|
|
2666
|
+
* Use this wherever a framework table's `id` is COMPOSED from values it does not
|
|
2667
|
+
* control. Where the id is generated (a typeid, a uuid) or built from something
|
|
2668
|
+
* provably bounded (a timestamp, a counter), it is not needed.
|
|
2669
|
+
*/
|
|
2670
|
+
export declare const derivedRowId: (prefix: string, ...parts: ReadonlyArray<string | number>) => string;
|
|
2671
|
+
|
|
2672
|
+
/**
|
|
2673
|
+
* The longest id {@link derivedRowId} can return for a prefix — computed, not
|
|
2674
|
+
* asserted after the fact, so a test can state the bound without constructing
|
|
2675
|
+
* inputs and hoping it picked the worst one.
|
|
2676
|
+
*/
|
|
2677
|
+
export declare const derivedRowIdLength: (prefix: string) => number;
|
|
2678
|
+
|
|
2661
2679
|
/**
|
|
2662
2680
|
* Walk the schema outward from `subjectTable` and return every route to a table
|
|
2663
2681
|
* holding that subject's rows.
|
|
@@ -2732,6 +2750,30 @@ export declare const deriveTypeIdPrefix: (tableName: string) => string;
|
|
|
2732
2750
|
*/
|
|
2733
2751
|
export declare const describeDriverError: (err: unknown) => string | undefined;
|
|
2734
2752
|
|
|
2753
|
+
/**
|
|
2754
|
+
* The TYPE of every binding in a row, and never a value.
|
|
2755
|
+
*
|
|
2756
|
+
* `ER_WRONG_ARGUMENTS` / 1210 is reported as "incorrect arguments", which reads
|
|
2757
|
+
* like a count problem and often is not: a statement with twelve columns and
|
|
2758
|
+
* twelve placeholders is internally consistent, and the driver is refusing one
|
|
2759
|
+
* VALUE it cannot bind. Measured against mariadb 11.8 / mysql2 3.22, and the
|
|
2760
|
+
* result is why this exists at all:
|
|
2761
|
+
*
|
|
2762
|
+
* value bound to a prepared statement mariadb mysql
|
|
2763
|
+
* plain object 1210 accepted
|
|
2764
|
+
* array 1210 accepted
|
|
2765
|
+
* bigint / Invalid Date / NaN accepted (Invalid Date → 1292)
|
|
2766
|
+
*
|
|
2767
|
+
* So the same row is bindable on one engine of the family and not the other,
|
|
2768
|
+
* which is exactly the shape of a suite where mariadb falls and mysql passes in
|
|
2769
|
+
* one run. Knowing WHICH of twelve bindings is an object is the whole diagnosis,
|
|
2770
|
+
* and it is not derivable from the error.
|
|
2771
|
+
*
|
|
2772
|
+
* Types only. A value here would be row data in a log line, which is the reason
|
|
2773
|
+
* the statement itself is carried only in its placeholder form.
|
|
2774
|
+
*/
|
|
2775
|
+
export declare const describeRowBindings: (row: Readonly<Record<string, unknown>>) => string;
|
|
2776
|
+
|
|
2735
2777
|
/**
|
|
2736
2778
|
* Parse JSON-stringified array values back to JS arrays on the read
|
|
2737
2779
|
* side. Tolerates `null` (NULL column → null in JS), pre-deserialised
|
|
@@ -3476,6 +3518,14 @@ export declare interface HybridSearchOptions {
|
|
|
3476
3518
|
*/
|
|
3477
3519
|
export declare const id: (options?: IdSchemeInput) => ColumnBuilder<string, "id", boolean>;
|
|
3478
3520
|
|
|
3521
|
+
/**
|
|
3522
|
+
* The width an `id()` column is emitted at on the dialects that need one
|
|
3523
|
+
* (`VARCHAR(64)` / `NVARCHAR(64)`). Exported so the rule has ONE spelling: a
|
|
3524
|
+
* check that hard-codes 64 somewhere else is a second definition waiting to
|
|
3525
|
+
* disagree with this one.
|
|
3526
|
+
*/
|
|
3527
|
+
export declare const ID_COLUMN_MAX_LENGTH = 64;
|
|
3528
|
+
|
|
3479
3529
|
/**
|
|
3480
3530
|
* Fully-resolved scheme stored on the `id` column definition AFTER
|
|
3481
3531
|
* `table()` walks the fields. For `typeid`, the prefix is always
|
|
@@ -3685,6 +3735,27 @@ export declare const inSubquery: <RowOf = Record<string, unknown>, K extends key
|
|
|
3685
3735
|
|
|
3686
3736
|
export declare const integer: () => ColumnBuilder<number, "integer", boolean>;
|
|
3687
3737
|
|
|
3738
|
+
/** One unfinished destructive run, as the boot sees it. */
|
|
3739
|
+
export declare interface InterruptedReplace {
|
|
3740
|
+
readonly id: string;
|
|
3741
|
+
readonly startedAt: Date;
|
|
3742
|
+
readonly tables: number;
|
|
3743
|
+
readonly capture: string | null;
|
|
3744
|
+
readonly via: string;
|
|
3745
|
+
}
|
|
3746
|
+
|
|
3747
|
+
/**
|
|
3748
|
+
* What the boot says when it finds one.
|
|
3749
|
+
*
|
|
3750
|
+
* A REFUSAL, not a warning, and the asymmetry is deliberate: serving an
|
|
3751
|
+
* application over a database that was emptied and not refilled is the outcome
|
|
3752
|
+
* this exists to prevent, and it is indistinguishable from normal operation
|
|
3753
|
+
* from the inside. The cost of being wrong in the other direction is a boot that
|
|
3754
|
+
* stops until a person looks — which is what you want anyway if a destructive
|
|
3755
|
+
* import did not finish.
|
|
3756
|
+
*/
|
|
3757
|
+
export declare const interruptedReplaceRefusal: (rows: ReadonlyArray<InterruptedReplace>) => string | undefined;
|
|
3758
|
+
|
|
3688
3759
|
/** `INTERSECT` — rows present in EVERY input. */
|
|
3689
3760
|
export declare const intersect: (...queries: ReadonlyArray<QueryWithDescriptorAny>) => Query<Row, string>;
|
|
3690
3761
|
|
|
@@ -5704,6 +5775,8 @@ export declare interface RelationsSpec {
|
|
|
5704
5775
|
readonly relations: RelationMap;
|
|
5705
5776
|
}
|
|
5706
5777
|
|
|
5778
|
+
export declare const REPLACE_IN_PROGRESS_TABLE = "_voltro_replace_in_progress";
|
|
5779
|
+
|
|
5707
5780
|
export declare const requireActors: () => (() => TableLike);
|
|
5708
5781
|
|
|
5709
5782
|
/** Required-by-name lookup — throws when missing so the call site
|
|
@@ -7383,6 +7456,25 @@ export declare interface UniqueSpec {
|
|
|
7383
7456
|
readonly dedup?: 'fail' | 'suffix-counter' | Statement.Fragment;
|
|
7384
7457
|
}
|
|
7385
7458
|
|
|
7459
|
+
/**
|
|
7460
|
+
* Remove ONE name this process added for a bounded operation.
|
|
7461
|
+
*
|
|
7462
|
+
* Deliberately narrow, and the narrowness is the point. `clearTableRegistry`
|
|
7463
|
+
* wipes everything and exists for tests; an app's tables are registered once at
|
|
7464
|
+
* boot and never leave. This is for the opposite shape: a name a single
|
|
7465
|
+
* operation OWNS for its duration and must take with it — the staging tables a
|
|
7466
|
+
* `--mode replace` registers so its typed writes can find the target's column
|
|
7467
|
+
* metadata, then unregisters when the swap is done.
|
|
7468
|
+
*
|
|
7469
|
+
* Leaving one behind is not cosmetic. `allRegisteredTables()` feeds the declared
|
|
7470
|
+
* set, the boot differ and `voltro doctor`, so a leftover staging clone would
|
|
7471
|
+
* read as a table the app declares and nobody created.
|
|
7472
|
+
*
|
|
7473
|
+
* Returns whether anything was removed, so a `finally` that runs twice does not
|
|
7474
|
+
* have to pretend it knows.
|
|
7475
|
+
*/
|
|
7476
|
+
export declare const unregisterTable: (tableName: string) => boolean;
|
|
7477
|
+
|
|
7386
7478
|
export declare const unregisterWriteRecorder: (id: string) => void;
|
|
7387
7479
|
|
|
7388
7480
|
/**
|
|
@@ -7719,6 +7811,16 @@ export declare const _voltroMigrationsTable: TableLike;
|
|
|
7719
7811
|
|
|
7720
7812
|
export declare const _voltroMssqlCdcOffsetsTable: TableLike;
|
|
7721
7813
|
|
|
7814
|
+
/**
|
|
7815
|
+
* The one row a destructive import leaves behind while it is destructive.
|
|
7816
|
+
*
|
|
7817
|
+
* Never more than one in practice — a second concurrent `replace` against one
|
|
7818
|
+
* database is already a mistake — but the table is not keyed on a constant, so
|
|
7819
|
+
* two runs produce two rows and the boot names both rather than one overwriting
|
|
7820
|
+
* the other's evidence.
|
|
7821
|
+
*/
|
|
7822
|
+
export declare const _voltroReplaceInProgressTable: TableLike;
|
|
7823
|
+
|
|
7722
7824
|
/**
|
|
7723
7825
|
* `_voltro_seeds` — one row per registered seed. Written to by the
|
|
7724
7826
|
* seed runner as each seed's lifecycle changes. Unlike migrations,
|