@voltro/database 0.68.0 → 0.69.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 +222 -0
- package/dist/index.d.ts +93 -0
- package/dist/index.js +38 -31
- package/dist/sql.d.ts +25 -9
- package/dist/sql.js +801 -819
- package/package.json +2 -2
package/dist/sql.d.ts
CHANGED
|
@@ -7,7 +7,7 @@ import { SqlError } from '@effect/sql';
|
|
|
7
7
|
import { SqlError as SqlError_2 } from '@effect/sql/SqlError';
|
|
8
8
|
import { Statement } from '@effect/sql';
|
|
9
9
|
|
|
10
|
-
export declare const acquireMigrationLock: (sql: SqlClient.SqlClient, scope?: MigrationLockScope) => Effect.Effect<
|
|
10
|
+
export declare const acquireMigrationLock: (sql: SqlClient.SqlClient, scope?: MigrationLockScope) => Effect.Effect<HeldMigrationLock, SqlError_2>;
|
|
11
11
|
|
|
12
12
|
declare interface AggregateColumn<TResult = number | Date | null> {
|
|
13
13
|
readonly op: 'count' | 'sum' | 'avg' | 'min' | 'max' | 'count-distinct' | 'window-row-number' | 'window-rank' | 'window-dense-rank' | 'window-lag' | 'window-lead' | 'window-sum-over' | 'window-avg-over' | 'column';
|
|
@@ -126,6 +126,14 @@ export declare interface AppliedOp {
|
|
|
126
126
|
*/
|
|
127
127
|
export declare const applyNamespacedSchema: (tables: ReadonlyArray<AnyTable>, namespace: string, dialect?: DialectId, options?: SchemaApplyOptions) => Effect.Effect<void, never, SqlClient.SqlClient>;
|
|
128
128
|
|
|
129
|
+
/**
|
|
130
|
+
* Apply a plan, holding the migration lock for the whole of it.
|
|
131
|
+
*
|
|
132
|
+
* `acquireUseRelease` rather than a `try/finally` in the body: Effect's own
|
|
133
|
+
* bracket runs its release on success, on failure, on a defect AND on
|
|
134
|
+
* interruption, which is exactly the set a JS `finally` inside `Effect.gen`
|
|
135
|
+
* does not cover.
|
|
136
|
+
*/
|
|
129
137
|
export declare const applyPlan: (sql: SqlClient.SqlClient, plan: MigrationPlan, ctx: ApplyPlanCtx) => Effect.Effect<AppliedMigration, SqlError_2, SqlClient.SqlClient>;
|
|
130
138
|
|
|
131
139
|
export declare interface ApplyPlanCtx {
|
|
@@ -1344,6 +1352,22 @@ export declare const formatBranchRehearsal: (report: BranchRehearsalReport) => s
|
|
|
1344
1352
|
/** Human report, or `undefined` when the database and the schema agree. */
|
|
1345
1353
|
export declare const formatReactiveTriggerDrift: (drift: ReactiveTriggerDrift) => string | undefined;
|
|
1346
1354
|
|
|
1355
|
+
/**
|
|
1356
|
+
* A lock that is being HELD, and the only way to let it go.
|
|
1357
|
+
*
|
|
1358
|
+
* The reserved connection lives inside this handle: `release` gives the lock
|
|
1359
|
+
* back and closes the reservation, in that order. Returning it as a value
|
|
1360
|
+
* rather than exposing a free `releaseMigrationLock(sql, scope)` is deliberate
|
|
1361
|
+
* — a free release cannot know WHICH connection took the lock, and on every
|
|
1362
|
+
* session-scoped dialect a release on the wrong connection is a no-op that
|
|
1363
|
+
* reports success.
|
|
1364
|
+
*/
|
|
1365
|
+
export declare interface HeldMigrationLock {
|
|
1366
|
+
/** Release the lock and return its connection to the pool. Idempotent only
|
|
1367
|
+
* in the sense that the dialect statements are; call it once. */
|
|
1368
|
+
readonly release: Effect.Effect<void, SqlError_2>;
|
|
1369
|
+
}
|
|
1370
|
+
|
|
1347
1371
|
/**
|
|
1348
1372
|
* Fully-resolved scheme stored on the `id` column definition AFTER
|
|
1349
1373
|
* `table()` walks the fields. For `typeid`, the prefix is always
|
|
@@ -2555,8 +2579,6 @@ export declare const rehearsedOperation: (planned: PlannedOperation) => Rehearse
|
|
|
2555
2579
|
*/
|
|
2556
2580
|
export declare const rehearseMigrationOnBranch: (ops: BranchRehearsalOps) => Promise<BranchRehearsalReport>;
|
|
2557
2581
|
|
|
2558
|
-
export declare const releaseMigrationLock: (sql: SqlClient.SqlClient, scope?: MigrationLockScope) => Effect.Effect<void, SqlError_2>;
|
|
2559
|
-
|
|
2560
2582
|
export declare const renderColumnMysql: (col: ColumnSnapshot) => string;
|
|
2561
2583
|
|
|
2562
2584
|
export declare const renderColumnPg: (col: ColumnSnapshot) => string;
|
|
@@ -3570,12 +3592,6 @@ declare interface WindowSpec {
|
|
|
3570
3592
|
}>;
|
|
3571
3593
|
}
|
|
3572
3594
|
|
|
3573
|
-
/**
|
|
3574
|
-
* Convenience wrapper: acquire → run `work` → release. Releases even
|
|
3575
|
-
* on failure via `Effect.ensuring`, but a process crash mid-work
|
|
3576
|
-
* leaves the postgres lock held until that connection closes (which
|
|
3577
|
-
* the pooled SqlClient does on Effect scope cleanup).
|
|
3578
|
-
*/
|
|
3579
3595
|
export declare const withMigrationLock: <A, E, R = never>(sql: SqlClient.SqlClient, work: Effect.Effect<A, E, R>, scope?: MigrationLockScope) => Effect.Effect<A, E | SqlError_2, R>;
|
|
3580
3596
|
|
|
3581
3597
|
/** Tree of relations to eager-load. */
|