@voltro/database 0.26.0 → 0.28.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 +532 -0
- package/dist/{frameworkLiveTables-BQwB8K6R.js → frameworkLiveTables-CS_Hyhgz.js} +162 -147
- package/dist/index.d.ts +57 -0
- package/dist/index.js +690 -664
- package/dist/sql.d.ts +27 -0
- package/dist/sql.js +1 -1
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -488,6 +488,9 @@ export declare interface CdcConfig {
|
|
|
488
488
|
* warns. See this file's header for why it is 512 and why it is not `0`. */
|
|
489
489
|
export declare const CHANGE_LISTENER_CEILING = 512;
|
|
490
490
|
|
|
491
|
+
/** A row was removed from the table. `new` is null, always. */
|
|
492
|
+
export declare const changeDelete: (table: string, row: Row, meta?: ChangeEventMeta) => ChangeEvent;
|
|
493
|
+
|
|
491
494
|
/**
|
|
492
495
|
* A row-change event emitted by the data store (in-memory) or the CDC
|
|
493
496
|
* consumer (Postgres logical replication). Drives the reactive engine.
|
|
@@ -548,6 +551,29 @@ export declare type ChangeEvent = {
|
|
|
548
551
|
readonly procedure?: string;
|
|
549
552
|
};
|
|
550
553
|
|
|
554
|
+
/** Attribution and origin, identical on every constructor. */
|
|
555
|
+
export declare type ChangeEventMeta = Pick<ChangeEvent, 'origin' | 'traceId' | 'subjectId' | 'procedure'>;
|
|
556
|
+
|
|
557
|
+
/** A row was created. `old` is null, always. */
|
|
558
|
+
export declare const changeInsert: (table: string, row: Row, meta?: ChangeEventMeta) => ChangeEvent;
|
|
559
|
+
|
|
560
|
+
/**
|
|
561
|
+
* A row was SOFT-deleted — an `update` that sets `deletedAt`.
|
|
562
|
+
*
|
|
563
|
+
* Not a `delete`, and that is the point. A test reaching for `changeDelete`
|
|
564
|
+
* here is describing a hard delete, which is a different event with different
|
|
565
|
+
* consequences: a soft delete is reversible, so anything cascading off it
|
|
566
|
+
* destroys rows a restore cannot bring back.
|
|
567
|
+
*
|
|
568
|
+
* `at` defaults to a fixed instant rather than `new Date()`: the value is never
|
|
569
|
+
* what a soft-delete rule reads — the null → non-null TRANSITION is — and a
|
|
570
|
+
* moving default makes a test that snapshots the event flake for no reason.
|
|
571
|
+
*/
|
|
572
|
+
export declare const changeSoftDelete: (table: string, row: Row, opts?: {
|
|
573
|
+
readonly at?: string | Date;
|
|
574
|
+
readonly column?: string;
|
|
575
|
+
} & ChangeEventMeta) => ChangeEvent;
|
|
576
|
+
|
|
551
577
|
/**
|
|
552
578
|
* Whether the DataStore emits ChangeEvents inline from each write
|
|
553
579
|
* (`inline`) or via the dialect's CDC consumer (`cdc`).
|
|
@@ -560,6 +586,9 @@ export declare type ChangeEvent = {
|
|
|
560
586
|
*/
|
|
561
587
|
export declare type ChangeStrategy = 'inline' | 'cdc';
|
|
562
588
|
|
|
589
|
+
/** A row changed. Both sides are present, because an update has both. */
|
|
590
|
+
export declare const changeUpdate: (table: string, before: Row, after: Row, meta?: ChangeEventMeta) => ChangeEvent;
|
|
591
|
+
|
|
563
592
|
/**
|
|
564
593
|
* Claim the attribution for an echo, or `undefined` if this write did not
|
|
565
594
|
* originate here.
|
|
@@ -4820,6 +4849,20 @@ export declare interface SchemaTable extends TableLike {
|
|
|
4820
4849
|
readonly tableName: string;
|
|
4821
4850
|
readonly fields: Record<string, ColumnDefinition<unknown>>;
|
|
4822
4851
|
readonly appliedIndexes: ReadonlyArray<TableIndex>;
|
|
4852
|
+
/**
|
|
4853
|
+
* The plugin references DECLARED on this table, surviving `table()`.
|
|
4854
|
+
*
|
|
4855
|
+
* `pluginRefSpecOf` reads a column BUILDER, and materialisation replaces it
|
|
4856
|
+
* with a plain field descriptor — so without this the declaration is
|
|
4857
|
+
* unreadable the moment the table exists, and any tool deriving structure
|
|
4858
|
+
* from the schema sees an ordinary `text()` column.
|
|
4859
|
+
*/
|
|
4860
|
+
readonly appliedPluginRefs?: ReadonlyArray<{
|
|
4861
|
+
readonly column: string;
|
|
4862
|
+
readonly target: () => unknown;
|
|
4863
|
+
readonly orphanPolicy: PluginRefOrphanPolicy;
|
|
4864
|
+
readonly onSoftDelete: boolean;
|
|
4865
|
+
}>;
|
|
4823
4866
|
/**
|
|
4824
4867
|
* Declared full-text indexes. Carried so a `SchemaTable`-annotated table
|
|
4825
4868
|
* is still a valid `queryFor(...)` input (the builder reads this to let
|
|
@@ -5247,6 +5290,20 @@ export declare interface Table<Name extends string, Fields extends Record<string
|
|
|
5247
5290
|
readonly isReactive: Reactive;
|
|
5248
5291
|
readonly appliedMixins: ReadonlyArray<AnyMixin>;
|
|
5249
5292
|
readonly appliedIndexes: ReadonlyArray<TableIndex>;
|
|
5293
|
+
/**
|
|
5294
|
+
* The plugin references DECLARED on this table, surviving `table()`.
|
|
5295
|
+
*
|
|
5296
|
+
* `pluginRefSpecOf` reads a column BUILDER, and materialisation replaces it
|
|
5297
|
+
* with a plain field descriptor — so without this the declaration is
|
|
5298
|
+
* unreadable the moment the table exists, and any tool deriving structure
|
|
5299
|
+
* from the schema sees an ordinary `text()` column.
|
|
5300
|
+
*/
|
|
5301
|
+
readonly appliedPluginRefs?: ReadonlyArray<{
|
|
5302
|
+
readonly column: string;
|
|
5303
|
+
readonly target: () => unknown;
|
|
5304
|
+
readonly orphanPolicy: PluginRefOrphanPolicy;
|
|
5305
|
+
readonly onSoftDelete: boolean;
|
|
5306
|
+
}>;
|
|
5250
5307
|
readonly appliedUniques: ReadonlyArray<TableUnique>;
|
|
5251
5308
|
readonly appliedFullText: ReadonlyArray<TableFullTextIndex>;
|
|
5252
5309
|
readonly appliedChecks: ReadonlyArray<TableCheck>;
|