@voltro/database 0.84.0 → 0.86.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 +1215 -0
- package/THIRD-PARTY-NOTICES.md +5 -89
- package/dist/actorSnapshot.js +24 -0
- package/dist/arrayCodec.js +32 -0
- package/dist/branchExecute.js +92 -0
- package/dist/branching.js +106 -0
- package/dist/bulkInsertLimits.js +25 -0
- package/dist/cdcOffsetsTables.js +19 -0
- package/dist/changeEvent.js +41 -0
- package/dist/changeIdentity.js +65 -0
- package/dist/changeListenerCeiling.js +6 -0
- package/dist/columnReference.js +17 -0
- package/dist/columns.js +326 -0
- package/dist/committedChanges.js +12 -0
- package/dist/connectionIdentity.js +36 -0
- package/dist/coreTables.js +16 -0
- package/dist/coreTablesRegistry.js +10 -0
- package/dist/dataTransfers.js +22 -0
- package/dist/dbCause.js +222 -0
- package/dist/dbMetrics.js +65 -0
- package/dist/decimalComparison.js +27 -0
- package/dist/derivedRowId.js +5 -0
- package/dist/dialect.js +13 -0
- package/dist/enumRenames.js +14 -0
- package/dist/expiresMixin.js +10 -0
- package/dist/fieldEncryption.js +98 -0
- package/dist/frameworkTables.js +130 -0
- package/dist/ginIndex.js +10 -0
- package/dist/hybridSearch.js +32 -0
- package/dist/idGenerator.js +57 -0
- package/dist/identifierLimits.js +32 -0
- package/dist/index.d.ts +122 -64
- package/dist/index.js +81 -2080
- package/dist/indexAudit.js +61 -0
- package/dist/indexStorage.js +58 -0
- package/dist/joinCompiler.js +160 -0
- package/dist/jsonEagerCompiler.js +436 -0
- package/dist/jsonPatch.js +78 -0
- package/dist/jsonPatchAssignments.js +13 -0
- package/dist/jsonPath.js +31 -0
- package/dist/localFirstMixin.js +12 -0
- package/dist/migrate.js +624 -0
- package/dist/migration.js +18 -0
- package/dist/migrations/appliedAtValue.js +8 -0
- package/dist/migrations/applier.js +1085 -0
- package/dist/migrations/boot.js +196 -0
- package/dist/migrations/branchRehearsal.js +122 -0
- package/dist/migrations/columnEquivalence.js +85 -0
- package/dist/migrations/ddlError.js +63 -0
- package/dist/migrations/declaredSchema.js +162 -0
- package/dist/migrations/deployLedger.js +19 -0
- package/dist/migrations/fileBased.js +57 -0
- package/dist/migrations/fileContext.js +482 -0
- package/dist/migrations/fileDiscovery.js +318 -0
- package/dist/migrations/fileSkipProbes.js +117 -0
- package/dist/migrations/fingerprint.js +46 -0
- package/dist/migrations/fkCycles.js +13 -0
- package/dist/migrations/frameworkLiveTables.js +25 -0
- package/dist/migrations/idempotentDdl.js +37 -0
- package/dist/migrations/indexPredicate.js +50 -0
- package/dist/migrations/introspect.js +799 -0
- package/dist/migrations/ledgerRows.js +4 -0
- package/dist/migrations/lock.js +91 -0
- package/dist/migrations/migrationTableExists.js +9 -0
- package/dist/migrations/mssqlColumnDependencies.js +76 -0
- package/dist/migrations/mysqlEngine.js +11 -0
- package/dist/migrations/namespaceCharset.js +51 -0
- package/dist/migrations/planner.js +775 -0
- package/dist/migrations/postgresEnumCheck.js +19 -0
- package/dist/migrations/reactiveTriggerDrift.js +58 -0
- package/dist/migrations/reactiveTriggerName.js +7 -0
- package/dist/migrations/renameMssqlCheck.js +21 -0
- package/dist/migrations/restoreSnapshots.js +206 -0
- package/dist/migrations/resumeLedger.js +86 -0
- package/dist/migrations/rollingDeploy.js +106 -0
- package/dist/migrations/schemaOwner.js +46 -0
- package/dist/migrations/schemaOwnerTable.js +4 -0
- package/dist/migrations/softDropSnapshot.js +20 -0
- package/dist/migrations/sqlLimit.js +8 -0
- package/dist/migrations/sqliteConstraintIdentity.js +97 -0
- package/dist/migrations/sqliteDecimalBoot.js +22 -0
- package/dist/migrations/sqliteDecimalPublication.js +257 -0
- package/dist/migrations/sqliteDecimalReview.js +30 -0
- package/dist/migrations/sqliteDecimalReviewStore.js +188 -0
- package/dist/migrations/sqliteDecimalReviewWitness.js +38 -0
- package/dist/migrations/sqliteDecimalSource.js +69 -0
- package/dist/migrations/sqliteDecimalStage.js +135 -0
- package/dist/migrations/sqliteForeignKeys.js +38 -0
- package/dist/migrations/sqliteMigrationBatch.js +37 -0
- package/dist/migrations/sqliteRetainedSource.js +106 -0
- package/dist/migrations/sqliteRowIdentity.js +63 -0
- package/dist/migrations/sqliteSchemaEpoch.js +12 -0
- package/dist/migrations/sqliteSnapshotGuard.js +10 -0
- package/dist/migrations/sqliteTableContents.js +34 -0
- package/dist/migrations/sqliteTableCopy.js +25 -0
- package/dist/migrations/sqliteTableSchema.js +19 -0
- package/dist/migrations/sqliteWitnessProtection.js +8 -0
- package/dist/migrations/squash.js +81 -0
- package/dist/migrations/storeCharset.js +66 -0
- package/dist/migrations/transactionCause.js +10 -0
- package/dist/migrations/undeclaredCharset.js +40 -0
- package/dist/migrations/uniqueActiveLowering.js +39 -0
- package/dist/mixins.js +22 -0
- package/dist/mssqlDecimalDistinct.js +51 -0
- package/dist/mssqlJsonValueCheck.js +42 -0
- package/dist/mssqlTextStorage.js +9 -0
- package/dist/namespace.js +21 -0
- package/dist/{wire-B28cPjEp.js → optimisticVersion.js} +2 -2
- package/dist/pendingAttribution.js +79 -0
- package/dist/pluginRef.js +17 -0
- package/dist/predicate.js +266 -0
- package/dist/predicateCoercion.js +13 -0
- package/dist/projectedColumn.js +37 -0
- package/dist/queryBuilder.js +382 -0
- package/dist/rawSql.js +8 -0
- package/dist/relations.js +69 -0
- package/dist/relationsRegistry.js +38 -0
- package/dist/replaceInProgress.js +53 -0
- package/dist/requiredColumns.js +26 -0
- package/dist/residency.js +52 -0
- package/dist/retention.js +62 -0
- package/dist/rowDecoder.js +123 -0
- package/dist/rowKey.js +8 -0
- package/dist/rowSchema.js +31 -0
- package/dist/scopeKey.js +8 -0
- package/dist/seed.js +33 -0
- package/dist/snowflake.js +26 -0
- package/dist/sql.d.ts +58 -29
- package/dist/sql.js +41 -6661
- package/dist/sqlCompiler.js +343 -0
- package/dist/sqlError.js +8 -0
- package/dist/sqlPoolCapacity.js +12 -0
- package/dist/sqliteDecimal.js +22 -0
- package/dist/sqliteDecimalAggregateSql.js +61 -0
- package/dist/sqliteDecimalColumnSql.js +108 -0
- package/dist/sqliteDecimalConversion.js +15 -0
- package/dist/sqliteDecimalCte.js +154 -0
- package/dist/sqliteDecimalEncodeSql.js +32 -0
- package/dist/sqliteDecimalOutputs.js +74 -0
- package/dist/sqliteDecimalPredicate.js +66 -0
- package/dist/sqliteDecimalQuery.js +183 -0
- package/dist/sqliteDecimalQueryPlan.js +37 -0
- package/dist/sqliteDecimalResultSql.js +44 -0
- package/dist/sqliteDecimalRowQuery.js +63 -0
- package/dist/sqliteDecimalSetQuery.js +50 -0
- package/dist/sqliteDecimalSource.js +63 -0
- package/dist/sqliteDecimalStorage.js +29 -0
- package/dist/sqliteDecimalSubquery.js +19 -0
- package/dist/sqliteDecimalWindowQuery.js +196 -0
- package/dist/sqliteValueCoercion.js +4 -0
- package/dist/stampId.js +21 -0
- package/dist/storeErrors.js +9 -0
- package/dist/storeRefusal.js +20 -0
- package/dist/stream.js +36 -0
- package/dist/subjectGraph.js +175 -0
- package/dist/table.js +394 -0
- package/dist/tableRegistry.js +16 -0
- package/dist/tenantSelection.js +27 -0
- package/dist/transactionOutcome.js +97 -0
- package/dist/transientContention.js +36 -0
- package/dist/typedStore.js +16 -0
- package/dist/upsertUpdate.js +20 -0
- package/dist/vectorEmbedding.js +31 -0
- package/dist/view.js +39 -0
- package/dist/wire.d.ts +9 -10
- package/dist/wire.js +6 -2
- package/dist/writeAttribution.js +16 -0
- package/dist/writeRecorder.js +37 -0
- package/package.json +4 -6
- package/dist/replaceInProgress-DUHl5JEz.js +0 -3557
package/dist/index.d.ts
CHANGED
|
@@ -1,21 +1,23 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Config } from 'effect';
|
|
2
2
|
import { Context } from 'effect';
|
|
3
|
+
import { Duration } from 'effect/Duration';
|
|
3
4
|
import { Effect } from 'effect';
|
|
4
5
|
import { Exit } from 'effect';
|
|
5
6
|
import { Layer } from 'effect';
|
|
6
7
|
import { Schedule } from 'effect';
|
|
7
8
|
import { Schema } from 'effect';
|
|
8
|
-
import { SqlClient } from '
|
|
9
|
-
import { SqlError } from '
|
|
10
|
-
import {
|
|
9
|
+
import { SqlClient } from 'effect/sql';
|
|
10
|
+
import { SqlError } from 'effect/sql/SqlError';
|
|
11
|
+
import { SqlError as SqlError_2 } from 'effect/sql';
|
|
12
|
+
import { Statement } from 'effect/sql';
|
|
11
13
|
import { Stream } from 'effect';
|
|
12
|
-
import { TransactionConnection } from '
|
|
14
|
+
import { TransactionConnection } from 'effect/sql/SqlClient';
|
|
13
15
|
import { VoidIfEmpty } from 'effect/Types';
|
|
14
16
|
import { YieldableError } from 'effect/Cause';
|
|
15
17
|
|
|
16
18
|
/** The store shape this needs — a read, nothing more. */
|
|
17
19
|
export declare interface ActorLookupStore {
|
|
18
|
-
query: (descriptor:
|
|
20
|
+
query: (descriptor: QueryDescriptor) => Promise<ReadonlyArray<Record<string, unknown>>>;
|
|
19
21
|
}
|
|
20
22
|
|
|
21
23
|
/** The framework's built-in `actors` core table. */
|
|
@@ -271,7 +273,7 @@ export declare const authoredError: (sentence: string, options?: {
|
|
|
271
273
|
* error carries none — which is the case for everything a driver threw.
|
|
272
274
|
*
|
|
273
275
|
* Walks the same two structures `storeRefusalOf` does: every branch of an
|
|
274
|
-
* Effect `Cause` (
|
|
276
|
+
* Effect `Cause` (an `Exit` keeps its reasons in a list, so `.cause`
|
|
275
277
|
* alone sees nothing), and then each branch's own `.cause` chain, because a
|
|
276
278
|
* driver layer may have wrapped the refusal before Effect saw it. The FIRST
|
|
277
279
|
* marked error wins — the outermost is the one that describes the operation
|
|
@@ -458,6 +460,11 @@ export declare interface BranchIndexName {
|
|
|
458
460
|
* re-derived name is exactly what we do not know. */
|
|
459
461
|
readonly columns: ReadonlyArray<string>;
|
|
460
462
|
readonly unique: boolean;
|
|
463
|
+
/** A partial index's predicate as the parent's catalog prints it
|
|
464
|
+
* (`pg_get_expr`). Two indexes on the same columns — one plain, one
|
|
465
|
+
* `WHERE "readAt" IS NULL` — are told apart only by it; without it the
|
|
466
|
+
* restore can give each the other's name. */
|
|
467
|
+
readonly where?: string;
|
|
461
468
|
/** The name the PARENT's index carries, and the one to restore. */
|
|
462
469
|
readonly name: string;
|
|
463
470
|
}
|
|
@@ -638,13 +645,13 @@ export declare type CaughtUpVerdict = 'caught-up' | 'behind';
|
|
|
638
645
|
/**
|
|
639
646
|
* Expand an error into the concrete failures behind it.
|
|
640
647
|
*
|
|
641
|
-
* A `
|
|
642
|
-
*
|
|
643
|
-
*
|
|
644
|
-
*
|
|
645
|
-
* second
|
|
646
|
-
*
|
|
647
|
-
*
|
|
648
|
+
* A `Cause` holds a flat list of reasons — a failure and a defect and an
|
|
649
|
+
* interrupt can all be present at once — so following `.cause` from the outside
|
|
650
|
+
* reaches none of them. Exported because anything that wants to find something
|
|
651
|
+
* INSIDE a failed Effect needs this same expansion, and a second copy of it is a
|
|
652
|
+
* second definition that nothing keeps in step. (Learned the direct way: a
|
|
653
|
+
* framework refusal marked on an error was invisible to a plain `.cause` walk
|
|
654
|
+
* the moment it came back through a promise boundary.)
|
|
648
655
|
*/
|
|
649
656
|
export declare const causeBranches: (err: unknown, depth?: number) => ReadonlyArray<unknown>;
|
|
650
657
|
|
|
@@ -1018,9 +1025,11 @@ export declare class ColumnBuilder<TsType, Type extends ColumnType, HasDefault e
|
|
|
1018
1025
|
private rejectIfRaw;
|
|
1019
1026
|
nullable(): ColumnBuilder<TsType | null, Type, HasDefault>;
|
|
1020
1027
|
/**
|
|
1021
|
-
* Declare that this scalar id
|
|
1028
|
+
* Declare that this scalar id has no single database foreign key target.
|
|
1022
1029
|
* Use it for provider, gateway, hardware, polymorphic, or cross-installation
|
|
1023
1030
|
* identifiers that intentionally must not become `reference()` columns.
|
|
1031
|
+
* A polymorphic target may live in this same database. The application
|
|
1032
|
+
* validates the target and cleans up orphans.
|
|
1024
1033
|
* This is schema metadata only and does not change the SQL column.
|
|
1025
1034
|
*/
|
|
1026
1035
|
externalId(): this;
|
|
@@ -1265,7 +1274,7 @@ export declare class ColumnBuilder<TsType, Type extends ColumnType, HasDefault e
|
|
|
1265
1274
|
*
|
|
1266
1275
|
* Two flavors:
|
|
1267
1276
|
*
|
|
1268
|
-
* - **SQL** (preferred, 95% case): pass an
|
|
1277
|
+
* - **SQL** (preferred, 95% case): pass an `effect/sql` `Statement.Fragment`
|
|
1269
1278
|
* (a sql`...` template built with `Statement.make`), evaluated
|
|
1270
1279
|
* server-side. Single round-trip, transactional, scales linearly.
|
|
1271
1280
|
*
|
|
@@ -1478,7 +1487,8 @@ export declare interface ColumnDefinition<TsType, Type extends ColumnType = Colu
|
|
|
1478
1487
|
*/
|
|
1479
1488
|
readonly fkAutoIndex?: boolean;
|
|
1480
1489
|
/**
|
|
1481
|
-
* This id-shaped scalar
|
|
1490
|
+
* This id-shaped scalar deliberately has no single foreign key target,
|
|
1491
|
+
* including external-system ids and local polymorphic targets.
|
|
1482
1492
|
* Set by `.externalId()` so schema audits do not guess a local FK from the
|
|
1483
1493
|
* column name. Metadata only; it emits no constraint or DDL.
|
|
1484
1494
|
*/
|
|
@@ -1870,7 +1880,7 @@ export declare interface ColumnReference {
|
|
|
1870
1880
|
* value through unchanged, so the mapping looked right in any test that only
|
|
1871
1881
|
* checked a round trip. Take definitions from `table.fields`.
|
|
1872
1882
|
*/
|
|
1873
|
-
export declare const columnSchema: <TsType, C extends ColumnType>(def: ColumnDefinition<TsType, C>) => Schema.
|
|
1883
|
+
export declare const columnSchema: <TsType, C extends ColumnType>(def: ColumnDefinition<TsType, C>) => Schema.Top;
|
|
1874
1884
|
|
|
1875
1885
|
/**
|
|
1876
1886
|
* A column as seen by the planner: either declared in code (extracted
|
|
@@ -2135,6 +2145,9 @@ export declare const columnsPerRow: (rows: ReadonlyArray<Record<string, unknown>
|
|
|
2135
2145
|
|
|
2136
2146
|
export declare type ColumnType = 'id' | 'text' | 'integer' | 'real' | 'decimal' | 'bigint' | 'boolean' | 'timestamp' | 'date' | 'json' | 'bytes' | 'reference' | 'vector' | 'enum' | 'array' | 'interval' | 'raw';
|
|
2137
2147
|
|
|
2148
|
+
/** The explicit committed-buffer identity, absent for ordinary/CDC events. */
|
|
2149
|
+
export declare const committedChangeBatchOf: (event: ChangeEvent) => object | undefined;
|
|
2150
|
+
|
|
2138
2151
|
/** Exact comparison of fixed-point decimal strings, without a floating-point conversion. */
|
|
2139
2152
|
export declare const compareDecimal: (left: unknown, right: unknown) => number | null;
|
|
2140
2153
|
|
|
@@ -2257,7 +2270,7 @@ export declare interface ConnectionConfig {
|
|
|
2257
2270
|
* timer). The waiting half is UNBOUNDED by default and deliberately so —
|
|
2258
2271
|
* see {@link ConnectionConfig.acquireQueueLimit} for the length bound
|
|
2259
2272
|
* that exists, why it is opt-in, and what it costs.
|
|
2260
|
-
* - **mssql** — establishment only. Maps to
|
|
2273
|
+
* - **mssql** — establishment only. Maps to `effect/sql-mssql`'s
|
|
2261
2274
|
* `connectTimeout` (tedious connect + the boot `SELECT 1` probe); its
|
|
2262
2275
|
* pool is an Effect `Pool` whose `get` has no timeout knob.
|
|
2263
2276
|
* - **sqlite** — ignored. One in-process connection, no pool to exhaust.
|
|
@@ -2285,7 +2298,7 @@ export declare interface ConnectionConfig {
|
|
|
2285
2298
|
* The event loop is never reached again: no timer fires, nothing drains the
|
|
2286
2299
|
* queue that caused the rejection, and nothing is logged.
|
|
2287
2300
|
*
|
|
2288
|
-
* That caller is not hypothetical and not ours to fix:
|
|
2301
|
+
* That caller is not hypothetical and not ours to fix: `effect/cluster`
|
|
2289
2302
|
* releases shards one statement per shard (300 by default) and wraps each in
|
|
2290
2303
|
* `Effect.eventually` — retry until success, no schedule, no delay, logged at
|
|
2291
2304
|
* debug. On a `shardLockDisableAdvisory` (Galera / PXC) runner those releases
|
|
@@ -2314,7 +2327,7 @@ export declare interface ConnectionConfig {
|
|
|
2314
2327
|
* node-postgres' `statement_timeout` pool option — a runaway query is cancelled
|
|
2315
2328
|
* with SQLSTATE 57014, not merely disconnected. Every OTHER dialect currently
|
|
2316
2329
|
* ACCEPTS the field but IGNORES it, and the honest reasons differ:
|
|
2317
|
-
* - **mssql** —
|
|
2330
|
+
* - **mssql** — `effect/sql-mssql` exposes only `connectTimeout` (connection
|
|
2318
2331
|
* establishment), not tedious's per-request `requestTimeout`; mapping this
|
|
2319
2332
|
* onto `connectTimeout` would bound the wrong phase, so it is left unwired
|
|
2320
2333
|
* rather than wrong.
|
|
@@ -3530,6 +3543,9 @@ export declare interface DialectTransactionSpec {
|
|
|
3530
3543
|
/** The store's `sql.withTransaction` — issues BEGIN/COMMIT/ROLLBACK and
|
|
3531
3544
|
* provides `TransactionConnection`. */
|
|
3532
3545
|
readonly withTransaction: <A>(effect: Effect.Effect<A, unknown, never>) => Effect.Effect<A, unknown, never>;
|
|
3546
|
+
/** The store's `sql.transactionService` — the key under which `withTransaction`
|
|
3547
|
+
* provides this client's `[Connection, depth]` (per-client in Effect 4). */
|
|
3548
|
+
readonly transactionService: Context.Service<TransactionConnection, TransactionConnection.Service>;
|
|
3533
3549
|
/** The store's managed runtime, ALWAYS as `runPromiseExit` — `runPromise` is
|
|
3534
3550
|
* the bug this file exists to prevent, so the shared bracket never sees one. */
|
|
3535
3551
|
readonly runPromiseExit: <A>(effect: Effect.Effect<A, unknown, never>) => Promise<Exit.Exit<A, unknown>>;
|
|
@@ -3754,6 +3770,13 @@ export declare interface EagerRootPlan {
|
|
|
3754
3770
|
readonly children: ReadonlyArray<EagerRelationNode>;
|
|
3755
3771
|
}
|
|
3756
3772
|
|
|
3773
|
+
/**
|
|
3774
|
+
* Emit an explicitly committed buffer synchronously, preserving every row
|
|
3775
|
+
* event and its order. Batch identity is process-local metadata, never wire
|
|
3776
|
+
* payload or attribution. Never use for rows still being written.
|
|
3777
|
+
*/
|
|
3778
|
+
export declare const emitCommittedChanges: (events: readonly ChangeEvent[], emit: (event: ChangeEvent) => void) => void;
|
|
3779
|
+
|
|
3757
3780
|
declare type EmptyMerge = unknown;
|
|
3758
3781
|
|
|
3759
3782
|
/**
|
|
@@ -3814,6 +3837,9 @@ export declare const encryptedColumnsOf: (table: TableLike) => ReadonlyArray<str
|
|
|
3814
3837
|
*/
|
|
3815
3838
|
export declare const encryptFieldsForWrite: (row: Row, table: TableLike | undefined, cipher: FieldCipher | undefined, rowId?: unknown) => Row;
|
|
3816
3839
|
|
|
3840
|
+
/** Encrypt a bulk write with one metadata snapshot, retaining per-row AAD. */
|
|
3841
|
+
export declare const encryptFieldsForWriteBatch: (rows: ReadonlyArray<Row>, table: TableLike | undefined, cipher: FieldCipher | undefined) => ReadonlyArray<Row>;
|
|
3842
|
+
|
|
3817
3843
|
/** Mark it finished — AFTER its `routeEvent` has registered, not after the
|
|
3818
3844
|
* statement. That is the whole point: the window being closed is exactly the
|
|
3819
3845
|
* gap between the committing statement and the registration. */
|
|
@@ -4131,7 +4157,7 @@ export declare interface FileMigration {
|
|
|
4131
4157
|
export declare interface FileMigrationContext {
|
|
4132
4158
|
/**
|
|
4133
4159
|
* The escape hatch, and it asks for a reason. `raw('why')` returns the
|
|
4134
|
-
*
|
|
4160
|
+
* `effect/sql` client — `sql.unsafe(...)`, `sql\`...\``,
|
|
4135
4161
|
* `sql.onDialectOrElse({...})` — for the one thing neither `store` nor
|
|
4136
4162
|
* `schema` expresses. The reason is required (an empty one throws), it is
|
|
4137
4163
|
* what `voltro doctor` lists beside every migration that reaches for raw
|
|
@@ -4541,11 +4567,17 @@ export declare type IndexField = string | {
|
|
|
4541
4567
|
export declare type IndexKind = 'btree' | 'gist' | 'gin' | 'brin' | 'hnsw';
|
|
4542
4568
|
|
|
4543
4569
|
/**
|
|
4544
|
-
* Per-kind tuning options.
|
|
4545
|
-
* build-time
|
|
4570
|
+
* Per-kind tuning options. GIN supports a single-column operator class;
|
|
4571
|
+
* HNSW supports pgvector build-time parameters. `m` controls graph connectivity (default 16),
|
|
4546
4572
|
* `efConstruction` the build-time candidate-list size (default 64).
|
|
4547
4573
|
*/
|
|
4548
4574
|
export declare interface IndexKindOptions {
|
|
4575
|
+
/** PostgreSQL GIN operator class for a single plain column.
|
|
4576
|
+
* `gin_trgm_ops` installs pg_trgm and accelerates contains/ILIKE searches.
|
|
4577
|
+
*/
|
|
4578
|
+
readonly gin?: {
|
|
4579
|
+
readonly opclass: string;
|
|
4580
|
+
};
|
|
4549
4581
|
readonly hnsw?: {
|
|
4550
4582
|
readonly m?: number;
|
|
4551
4583
|
readonly efConstruction?: number;
|
|
@@ -5178,7 +5210,7 @@ export declare const makeNamespaceBranchExecutor: (sql: BranchSqlRunner) => Bran
|
|
|
5178
5210
|
* every `Effect.withSpan` inside `transactional()` emits real spans.
|
|
5179
5211
|
*/
|
|
5180
5212
|
export declare interface MakeStoreOptions {
|
|
5181
|
-
readonly sqlLayer: Layer.Layer<SqlClient.SqlClient,
|
|
5213
|
+
readonly sqlLayer: Layer.Layer<SqlClient.SqlClient, Config.ConfigError | SqlError_2.SqlError, never>;
|
|
5182
5214
|
readonly tracerLayer?: Layer.Layer<never, never, never>;
|
|
5183
5215
|
readonly changeStrategy?: ChangeStrategy;
|
|
5184
5216
|
/** Postgres NOTIFY channel name when changeStrategy is 'cdc'. */
|
|
@@ -5338,7 +5370,7 @@ export declare class MigrationExpectationFailed extends Error {
|
|
|
5338
5370
|
* `log` and the two probes the store can answer about its own shape
|
|
5339
5371
|
* (`tableExists`, `columnExists`) work without one; each refusal names what to
|
|
5340
5372
|
* do instead. Also raised at construction when what was handed in as `sql` is not
|
|
5341
|
-
* an
|
|
5373
|
+
* an `effect/sql` client, or when a SQL-backed store arrives without the
|
|
5342
5374
|
* client it executes on — both are refused before a body can run rather
|
|
5343
5375
|
* than surfacing as a TypeError from inside the first helper that touches
|
|
5344
5376
|
* the client.
|
|
@@ -5786,6 +5818,15 @@ export declare interface OneRelation {
|
|
|
5786
5818
|
readonly sourceKey?: string;
|
|
5787
5819
|
}
|
|
5788
5820
|
|
|
5821
|
+
/**
|
|
5822
|
+
* Run `effect` ON a transaction captured by `runRetryingTransaction`: the
|
|
5823
|
+
* whole context the transaction's fiber had — `TransactionConnection` plus
|
|
5824
|
+
* the sql client's transaction semaphore a nested `withTransaction`
|
|
5825
|
+
* (savepoint) takes a permit from. A connection this module never saw is
|
|
5826
|
+
* provided on its own, which is all a plain statement needs.
|
|
5827
|
+
*/
|
|
5828
|
+
export declare const onTransaction: <A, E, R>(effect: Effect.Effect<A, E, R>, transactionService: Context.Service<TransactionConnection, TransactionConnection.Service>, txn: TransactionConnectionContext) => Effect.Effect<A, E, Exclude<R, TransactionConnection>>;
|
|
5829
|
+
|
|
5789
5830
|
export declare const or: (...predicates: ReadonlyArray<Predicate>) => OrPredicate;
|
|
5790
5831
|
|
|
5791
5832
|
export declare interface OrderClause {
|
|
@@ -6003,7 +6044,7 @@ export declare interface PluginRefSpec {
|
|
|
6003
6044
|
readonly onSoftDelete: boolean;
|
|
6004
6045
|
}
|
|
6005
6046
|
|
|
6006
|
-
/** The declared spec
|
|
6047
|
+
/** The declared spec on a builder or its materialized column definition. */
|
|
6007
6048
|
export declare const pluginRefSpecOf: (column: unknown) => PluginRefSpec | undefined;
|
|
6008
6049
|
|
|
6009
6050
|
/** Postgres SQLSTATEs. */
|
|
@@ -6030,6 +6071,12 @@ export declare interface PredicateLeafWithContext extends PredicateLeaf {
|
|
|
6030
6071
|
readonly conjunctive: boolean;
|
|
6031
6072
|
}
|
|
6032
6073
|
|
|
6074
|
+
/** Prepare one synchronous evaluation pass. Recreate after mutating the AST or
|
|
6075
|
+
* its value arrays; no process-wide cache retains descriptors or row values. */
|
|
6076
|
+
export declare const preparePredicate: (predicate: Predicate, subqueries?: SubqueryResults | null, columns?: Readonly<Record<string, {
|
|
6077
|
+
readonly type: string;
|
|
6078
|
+
}>>) => ((row: Row | null) => boolean);
|
|
6079
|
+
|
|
6033
6080
|
export declare interface PrimaryKeyConflictError {
|
|
6034
6081
|
readonly _tag: 'PrimaryKeyConflictError';
|
|
6035
6082
|
readonly table: string;
|
|
@@ -6493,6 +6540,11 @@ Joins extends JoinsMap = {}> {
|
|
|
6493
6540
|
export declare interface QueryDescriptor<R = Row> {
|
|
6494
6541
|
readonly table: string;
|
|
6495
6542
|
readonly predicate: Predicate | undefined;
|
|
6543
|
+
/** Additional reactive invalidation sources, independent of SQL row selection.
|
|
6544
|
+
* The runtime merges a query handler's declared `source` tables here. Changes
|
|
6545
|
+
* to these tables recheck subscription authority even when SQL rows do not
|
|
6546
|
+
* change. They add no joins, predicates or cross-tenant access. */
|
|
6547
|
+
readonly dependentTables?: ReadonlyArray<string>;
|
|
6496
6548
|
/** Phantom — carries the row type through to `store.query()`. Never set at
|
|
6497
6549
|
* runtime; erased entirely by the compiler. */
|
|
6498
6550
|
readonly __row?: R;
|
|
@@ -7429,12 +7481,12 @@ declare type Row_2 = Readonly<Record<string, unknown>>;
|
|
|
7429
7481
|
declare type Row_3 = Readonly<Record<string, unknown>>;
|
|
7430
7482
|
|
|
7431
7483
|
/** Addresses one row: its `id`, or the columns of an explicit primary key. */
|
|
7432
|
-
export declare type RowKey = string | Readonly<Record<string, unknown>>;
|
|
7484
|
+
export declare type RowKey = string | number | Readonly<Record<string, unknown>>;
|
|
7433
7485
|
|
|
7434
7486
|
/**
|
|
7435
7487
|
* The `(column, value)` pairs a key addresses, in declaration order.
|
|
7436
7488
|
*
|
|
7437
|
-
* A
|
|
7489
|
+
* A scalar is the `id` column — that is the contract every existing caller
|
|
7438
7490
|
* relies on, and widening it must not change what a string means.
|
|
7439
7491
|
*/
|
|
7440
7492
|
export declare const rowKeyColumns: (key: RowKey) => ReadonlyArray<readonly [string, unknown]>;
|
|
@@ -7468,7 +7520,7 @@ export declare const rowNumber: (alias?: string) => WindowBuilder;
|
|
|
7468
7520
|
*/
|
|
7469
7521
|
export declare const rowSchema: <T extends TableLike>(table: T, options?: {
|
|
7470
7522
|
readonly omit?: ReadonlyArray<string>;
|
|
7471
|
-
}) => Schema.
|
|
7523
|
+
}) => Schema.Top;
|
|
7472
7524
|
|
|
7473
7525
|
/** The context a rule predicate is evaluated with. */
|
|
7474
7526
|
export declare interface RuleContext {
|
|
@@ -7521,7 +7573,7 @@ export declare interface RuleViolationDetail {
|
|
|
7521
7573
|
* 1. the connection handshake — `withTransaction` + `TransactionConnection`,
|
|
7522
7574
|
* with a loud failure rather than a silent non-transactional run when the
|
|
7523
7575
|
* service is somehow absent;
|
|
7524
|
-
* 2. **commit-defect promotion** —
|
|
7576
|
+
* 2. **commit-defect promotion** — `effect/sql` runs COMMIT as `Effect.orDie`,
|
|
7525
7577
|
* so a serialization/deadlock error raised AT COMMIT arrives as a defect and
|
|
7526
7578
|
* `Effect.retry` never sees it. A retryable defect is promoted back to a
|
|
7527
7579
|
* typed failure so the schedule can replay it; anything else re-dies, so
|
|
@@ -7673,10 +7725,9 @@ export declare interface SchemaTable extends TableLike {
|
|
|
7673
7725
|
/**
|
|
7674
7726
|
* The plugin references DECLARED on this table, surviving `table()`.
|
|
7675
7727
|
*
|
|
7676
|
-
*
|
|
7677
|
-
*
|
|
7678
|
-
*
|
|
7679
|
-
* from the schema sees an ordinary `text()` column.
|
|
7728
|
+
* Derived from column metadata on every table rebuild, including columns
|
|
7729
|
+
* contributed by mixins. Consumers can inspect these rules without knowing
|
|
7730
|
+
* the private metadata on each materialized scalar definition.
|
|
7680
7731
|
*/
|
|
7681
7732
|
readonly appliedPluginRefs?: ReadonlyArray<{
|
|
7682
7733
|
readonly column: string;
|
|
@@ -7893,7 +7944,7 @@ export declare const setTenantCreateSeedHook: (hook: TenantCreateSeedHook | null
|
|
|
7893
7944
|
|
|
7894
7945
|
/**
|
|
7895
7946
|
* Unwrap a transaction program's `Exit`: return the value, or throw the
|
|
7896
|
-
* ORIGINAL error rather than
|
|
7947
|
+
* ORIGINAL error rather than a squashed or wrapped one.
|
|
7897
7948
|
*
|
|
7898
7949
|
* Use with `runtime.runPromiseExit`, never `runPromise` — the wrapper is
|
|
7899
7950
|
* created by `runPromise` itself, so there is nothing left to unwrap by the
|
|
@@ -7902,7 +7953,7 @@ export declare const setTenantCreateSeedHook: (hook: TenantCreateSeedHook | null
|
|
|
7902
7953
|
* `Cause.squash` is what preserves the typing: for a `Fail` it yields the value
|
|
7903
7954
|
* that was thrown (the app's `TaggedError`, so the rpc encoder can still match
|
|
7904
7955
|
* it against the descriptor's `error:` schema); for a `Die` the defect; for an
|
|
7905
|
-
* interrupt an `
|
|
7956
|
+
* interrupt an `Error` ("All fibers interrupted without error"). Retry filtering has already run inside
|
|
7906
7957
|
* the program, so an Exit reaching here is final.
|
|
7907
7958
|
*/
|
|
7908
7959
|
export declare const settleTransactionExit: <A>(exit: Exit.Exit<A, unknown>) => A;
|
|
@@ -7921,6 +7972,14 @@ export declare const settleVersionedUpdate: (input: {
|
|
|
7921
7972
|
readonly current: number | null;
|
|
7922
7973
|
}) => VersionConflict | undefined;
|
|
7923
7974
|
|
|
7975
|
+
/** ONE transaction context key for every SQL client a process builds, whatever
|
|
7976
|
+
* the dialect: v4 keys `TransactionConnection` per client, so a statement issued
|
|
7977
|
+
* through a second client (another layer build, a plugin's own runtime) inside a
|
|
7978
|
+
* store transaction would otherwise take a fresh pool connection — outside the
|
|
7979
|
+
* transaction, and a deadlock when the pool is small. node-postgres shared one
|
|
7980
|
+
* tag; every dialect layer passes this key to its client. */
|
|
7981
|
+
export declare const SHARED_TRANSACTION_SERVICE: Context.Service<SqlClient.TransactionConnection, TransactionConnection.Service>;
|
|
7982
|
+
|
|
7924
7983
|
/** When a `<name>__dropped_<YYYYMMDDHHMMSS>` snapshot was taken (UTC), or
|
|
7925
7984
|
* `undefined` for a name that is not one. */
|
|
7926
7985
|
export declare const softDropSnapshotStamp: (name: string) => Date | undefined;
|
|
@@ -8002,7 +8061,7 @@ export declare type SqlConstructor = Statement.Constructor;
|
|
|
8002
8061
|
* `id` is the canonical name surfaced in logs, boot banners, error
|
|
8003
8062
|
* messages, and the `DB_DIALECT` env value.
|
|
8004
8063
|
*
|
|
8005
|
-
* `makeSqlLayer` constructs the
|
|
8064
|
+
* `makeSqlLayer` constructs the `effect/sql` connection Layer from a
|
|
8006
8065
|
* generic `ConnectionConfig`. Each dialect maps the config to its own
|
|
8007
8066
|
* driver's expected shape.
|
|
8008
8067
|
*
|
|
@@ -8028,12 +8087,14 @@ export declare interface SqlDialect {
|
|
|
8028
8087
|
*/
|
|
8029
8088
|
readonly workflowRunnerStorage?: (connection: ConnectionConfig) => 'memory' | 'sql';
|
|
8030
8089
|
readonly id: DialectId;
|
|
8031
|
-
readonly makeSqlLayer: (conn: ConnectionConfig) => Layer.Layer<SqlClient.SqlClient,
|
|
8090
|
+
readonly makeSqlLayer: (conn: ConnectionConfig) => Layer.Layer<SqlClient.SqlClient, Config.ConfigError | SqlError_2.SqlError, never>;
|
|
8032
8091
|
readonly makeStore: (options: MakeStoreOptions) => Promise<DataStore>;
|
|
8033
8092
|
readonly compileContains: (col: Statement.Identifier, value: string, sql: Statement.Constructor) => Statement.Fragment;
|
|
8034
8093
|
readonly retryFilter: (error: unknown) => RetryDecision;
|
|
8035
8094
|
}
|
|
8036
8095
|
|
|
8096
|
+
export declare const sqlError: (message: string, cause?: unknown) => SqlError;
|
|
8097
|
+
|
|
8037
8098
|
/** SQLite / turso result codes — symbolic and numeric spellings. */
|
|
8038
8099
|
export declare const SQLITE_TRANSIENT_CODES: ReadonlySet<string>;
|
|
8039
8100
|
|
|
@@ -8363,10 +8424,9 @@ export declare interface Table<Name extends string, Fields extends Record<string
|
|
|
8363
8424
|
/**
|
|
8364
8425
|
* The plugin references DECLARED on this table, surviving `table()`.
|
|
8365
8426
|
*
|
|
8366
|
-
*
|
|
8367
|
-
*
|
|
8368
|
-
*
|
|
8369
|
-
* from the schema sees an ordinary `text()` column.
|
|
8427
|
+
* Derived from column metadata on every table rebuild, including columns
|
|
8428
|
+
* contributed by mixins. Consumers can inspect these rules without knowing
|
|
8429
|
+
* the private metadata on each materialized scalar definition.
|
|
8370
8430
|
*/
|
|
8371
8431
|
readonly appliedPluginRefs?: ReadonlyArray<{
|
|
8372
8432
|
readonly column: string;
|
|
@@ -8413,7 +8473,7 @@ export declare interface Table<Name extends string, Fields extends Record<string
|
|
|
8413
8473
|
* BEFORE every INSERT. Populated by `.validate(schema)`. Set
|
|
8414
8474
|
* per-table at table-construction time; immutable thereafter.
|
|
8415
8475
|
*/
|
|
8416
|
-
readonly insertSchema?: Schema.
|
|
8476
|
+
readonly insertSchema?: Schema.Top;
|
|
8417
8477
|
/**
|
|
8418
8478
|
* Optional `effect/Schema` the framework decodes a patch against
|
|
8419
8479
|
* BEFORE every UPDATE. Populated by `.validatePatch(schema)`. The
|
|
@@ -8422,7 +8482,7 @@ export declare interface Table<Name extends string, Fields extends Record<string
|
|
|
8422
8482
|
* are checked. Set per-table at table-construction time; immutable
|
|
8423
8483
|
* thereafter.
|
|
8424
8484
|
*/
|
|
8425
|
-
readonly validatePatchSchema?: Schema.
|
|
8485
|
+
readonly validatePatchSchema?: Schema.Top;
|
|
8426
8486
|
with: <const Mixins extends ReadonlyArray<AnyMixin>>(...mixins: Mixins) => Table<Name, Fields & MergeMixinFields<Mixins>, Reactive, IxNames>;
|
|
8427
8487
|
/**
|
|
8428
8488
|
* Attach an effect/Schema that validates EVERY insert against the
|
|
@@ -8450,7 +8510,7 @@ export declare interface Table<Name extends string, Fields extends Record<string
|
|
|
8450
8510
|
* `id` and `createdAt` are already filled in by the time the
|
|
8451
8511
|
* decoder sees the row.
|
|
8452
8512
|
*/
|
|
8453
|
-
validate: <S extends Schema.
|
|
8513
|
+
validate: <S extends Schema.Top>(schema: S) => Table<Name, Fields, Reactive, IxNames>;
|
|
8454
8514
|
/**
|
|
8455
8515
|
* Attach an effect/Schema that validates UPDATE patches against the
|
|
8456
8516
|
* table. The framework wraps the schema in `Schema.partial`, so a
|
|
@@ -8481,7 +8541,7 @@ export declare interface Table<Name extends string, Fields extends Record<string
|
|
|
8481
8541
|
* wrapping is applied for you, so don't pre-wrap fields in
|
|
8482
8542
|
* `Schema.optional`.
|
|
8483
8543
|
*/
|
|
8484
|
-
validatePatch: <S extends Schema.Schema.
|
|
8544
|
+
validatePatch: <S extends Schema.Struct<Schema.Struct.Fields>>(schema: S) => Table<Name, Fields, Reactive, IxNames>;
|
|
8485
8545
|
/**
|
|
8486
8546
|
* Declare a (possibly composite) secondary index on the table.
|
|
8487
8547
|
*
|
|
@@ -8865,8 +8925,8 @@ export declare interface TableIndex {
|
|
|
8865
8925
|
*/
|
|
8866
8926
|
readonly kind?: IndexKind;
|
|
8867
8927
|
/**
|
|
8868
|
-
* Per-kind tuning
|
|
8869
|
-
*
|
|
8928
|
+
* Per-kind tuning: `gin.opclass` or `hnsw.{m, efConstruction, opclass}`.
|
|
8929
|
+
* Ignored for kinds that do not read the corresponding options.
|
|
8870
8930
|
*/
|
|
8871
8931
|
readonly kindOptions?: IndexKindOptions;
|
|
8872
8932
|
/**
|
|
@@ -9075,7 +9135,7 @@ export declare const timestamp: () => ColumnBuilder<Date, "timestamp", boolean>;
|
|
|
9075
9135
|
* There is deliberately no `timestampMsOptional`: an absent field is
|
|
9076
9136
|
* `Schema.optional(timestampMs)`, which composes without a third export.
|
|
9077
9137
|
*/
|
|
9078
|
-
export declare const timestampMs: Schema.
|
|
9138
|
+
export declare const timestampMs: Schema.Codec<Date, number>;
|
|
9079
9139
|
|
|
9080
9140
|
/**
|
|
9081
9141
|
* `timestampMs` for a NULLABLE timestamp column — `Date | null` in the
|
|
@@ -9087,7 +9147,7 @@ export declare const timestampMs: Schema.Schema<Date, number>;
|
|
|
9087
9147
|
* instead of as nothing. Mirrors what `columnSchema` does for a
|
|
9088
9148
|
* `.nullable()` timestamp.
|
|
9089
9149
|
*/
|
|
9090
|
-
export declare const timestampMsOrNull: Schema.
|
|
9150
|
+
export declare const timestampMsOrNull: Schema.Codec<Date | null, number | null>;
|
|
9091
9151
|
|
|
9092
9152
|
/**
|
|
9093
9153
|
* `transactional()`'s work caught a statement failure the engine had already
|
|
@@ -9173,14 +9233,14 @@ export declare class TransactionBrokenByBodyError extends Error {
|
|
|
9173
9233
|
}
|
|
9174
9234
|
|
|
9175
9235
|
/**
|
|
9176
|
-
* The `[Connection, depth]` tuple
|
|
9236
|
+
* The `[Connection, depth]` tuple `effect/sql` provides inside
|
|
9177
9237
|
* `withTransaction`. Every statement that must run on the transaction's OWN
|
|
9178
9238
|
* connection (rather than a fresh one from the pool) is given this explicitly.
|
|
9179
9239
|
*/
|
|
9180
|
-
export declare type TransactionConnectionContext =
|
|
9240
|
+
export declare type TransactionConnectionContext = TransactionConnection.Service;
|
|
9181
9241
|
|
|
9182
9242
|
/** Shared bounded contention policy, including stores without a SQL connection. */
|
|
9183
|
-
export declare const transactionRetrySchedule: (isRetryable: (error: unknown) => boolean) => Schedule.Schedule<
|
|
9243
|
+
export declare const transactionRetrySchedule: (isRetryable: (error: unknown) => boolean) => Schedule.Schedule< Duration, unknown, never, never>;
|
|
9184
9244
|
|
|
9185
9245
|
/** Turso's MVCC conflicts arrive as messages, not codes. */
|
|
9186
9246
|
export declare const TURSO_TRANSIENT_MESSAGE: RegExp;
|
|
@@ -9573,16 +9633,14 @@ export declare const versionColumnOf: (columns: Readonly<Record<string, {
|
|
|
9573
9633
|
export declare class VersionConflict extends VersionConflict_base {
|
|
9574
9634
|
}
|
|
9575
9635
|
|
|
9576
|
-
declare const VersionConflict_base: Schema.
|
|
9577
|
-
readonly
|
|
9578
|
-
|
|
9579
|
-
table: typeof Schema.String;
|
|
9580
|
-
id: typeof Schema.String;
|
|
9636
|
+
declare const VersionConflict_base: Schema.Class<VersionConflict, Schema.TaggedStruct<"VersionConflict", {
|
|
9637
|
+
readonly table: Schema.String;
|
|
9638
|
+
readonly id: Schema.String;
|
|
9581
9639
|
/** What the caller believed the row was at. */
|
|
9582
|
-
expected:
|
|
9640
|
+
readonly expected: Schema.Number;
|
|
9583
9641
|
/** What it is actually at. `null` when the row is gone entirely. */
|
|
9584
|
-
actual: Schema.NullOr<
|
|
9585
|
-
}>;
|
|
9642
|
+
readonly actual: Schema.NullOr<Schema.Number>;
|
|
9643
|
+
}>, YieldableError>;
|
|
9586
9644
|
|
|
9587
9645
|
/**
|
|
9588
9646
|
* A read-only SQL view descriptor. Structurally a `TableLike` (carries
|
|
@@ -9850,8 +9908,8 @@ export declare interface WindowSpec {
|
|
|
9850
9908
|
* echoes the duplicate value, mssql echoes the truncated one. A cause that
|
|
9851
9909
|
* forwards the sentence ships row contents to whoever provoked the failure.
|
|
9852
9910
|
*
|
|
9853
|
-
* `StoreOperationFailed.cause` did exactly that: `String(error)` on
|
|
9854
|
-
*
|
|
9911
|
+
* `StoreOperationFailed.cause` did exactly that: `String(error)` on the
|
|
9912
|
+
* rejection, which is the message AND the stack, so an absolute server
|
|
9855
9913
|
* path reached any caller that declared the error and every subscriber on a
|
|
9856
9914
|
* stream carrying it.
|
|
9857
9915
|
*
|