litedbmodel 2.0.2 → 2.2.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/README.md +7 -0
- package/dist/DBConditions.d.ts.map +1 -1
- package/dist/DBConditions.js +16 -1
- package/dist/DBConditions.js.map +1 -1
- package/dist/DBHandler.d.ts.map +1 -1
- package/dist/DBHandler.js +6 -0
- package/dist/DBHandler.js.map +1 -1
- package/dist/DBModel.d.ts +84 -2
- package/dist/DBModel.d.ts.map +1 -1
- package/dist/DBModel.js +312 -29
- package/dist/DBModel.js.map +1 -1
- package/dist/decorators.d.ts +52 -0
- package/dist/decorators.d.ts.map +1 -1
- package/dist/decorators.js +127 -24
- package/dist/decorators.js.map +1 -1
- package/dist/drivers/mysql.d.ts.map +1 -1
- package/dist/drivers/mysql.js +12 -2
- package/dist/drivers/mysql.js.map +1 -1
- package/dist/drivers/postgres.d.ts.map +1 -1
- package/dist/drivers/postgres.js +13 -2
- package/dist/drivers/postgres.js.map +1 -1
- package/dist/drivers/sqlite.d.ts +2 -0
- package/dist/drivers/sqlite.d.ts.map +1 -1
- package/dist/drivers/sqlite.js +49 -4
- package/dist/drivers/sqlite.js.map +1 -1
- package/dist/index.cjs +10741 -0
- package/dist/index.d.cts +1 -0
- package/dist/scp/coltype.d.ts +108 -0
- package/dist/scp/coltype.d.ts.map +1 -1
- package/dist/scp/coltype.js +293 -6
- package/dist/scp/coltype.js.map +1 -1
- package/dist/scp/connection-routing.d.ts +312 -0
- package/dist/scp/connection-routing.d.ts.map +1 -0
- package/dist/scp/connection-routing.js +394 -0
- package/dist/scp/connection-routing.js.map +1 -0
- package/dist/scp/dbmodel-runtime.d.ts +101 -0
- package/dist/scp/dbmodel-runtime.d.ts.map +1 -0
- package/dist/scp/dbmodel-runtime.js +174 -0
- package/dist/scp/dbmodel-runtime.js.map +1 -0
- package/dist/scp/decorator-adapter.d.ts +196 -0
- package/dist/scp/decorator-adapter.d.ts.map +1 -0
- package/dist/scp/decorator-adapter.js +286 -0
- package/dist/scp/decorator-adapter.js.map +1 -0
- package/dist/scp/emit/emitter.d.ts +108 -0
- package/dist/scp/emit/emitter.d.ts.map +1 -0
- package/dist/scp/emit/emitter.js +782 -0
- package/dist/scp/emit/emitter.js.map +1 -0
- package/dist/scp/emit/endpoint.d.ts +248 -0
- package/dist/scp/emit/endpoint.d.ts.map +1 -0
- package/dist/scp/emit/endpoint.js +20 -0
- package/dist/scp/emit/endpoint.js.map +1 -0
- package/dist/scp/emit/index.d.ts +11 -0
- package/dist/scp/emit/index.d.ts.map +1 -0
- package/dist/scp/emit/index.js +13 -0
- package/dist/scp/emit/index.js.map +1 -0
- package/dist/scp/errors.d.ts +45 -1
- package/dist/scp/errors.d.ts.map +1 -1
- package/dist/scp/errors.js +47 -1
- package/dist/scp/errors.js.map +1 -1
- package/dist/scp/exec-context.d.ts +390 -0
- package/dist/scp/exec-context.d.ts.map +1 -0
- package/dist/scp/exec-context.js +540 -0
- package/dist/scp/exec-context.js.map +1 -0
- package/dist/scp/grouping.d.ts +32 -0
- package/dist/scp/grouping.d.ts.map +1 -0
- package/dist/scp/grouping.js +0 -0
- package/dist/scp/grouping.js.map +1 -0
- package/dist/scp/index.cjs +6432 -17579
- package/dist/scp/index.d.cts +1 -0
- package/dist/scp/index.d.mts +1 -0
- package/dist/scp/index.d.ts +51 -52
- package/dist/scp/index.d.ts.map +1 -1
- package/dist/scp/index.js +189 -152
- package/dist/scp/index.js.map +1 -1
- package/dist/scp/index.mjs +6067 -3659
- package/dist/scp/leaf-transport.d.ts +50 -0
- package/dist/scp/leaf-transport.d.ts.map +1 -0
- package/dist/scp/leaf-transport.js +92 -0
- package/dist/scp/leaf-transport.js.map +1 -0
- package/dist/scp/leaves.d.ts +174 -0
- package/dist/scp/leaves.d.ts.map +1 -0
- package/dist/scp/leaves.js +287 -0
- package/dist/scp/leaves.js.map +1 -0
- package/dist/scp/limit-config.d.ts +118 -0
- package/dist/scp/limit-config.d.ts.map +1 -0
- package/dist/scp/limit-config.js +126 -0
- package/dist/scp/limit-config.js.map +1 -0
- package/dist/scp/makesql/compile-relation.d.ts +49 -23
- package/dist/scp/makesql/compile-relation.d.ts.map +1 -1
- package/dist/scp/makesql/compile-relation.js +101 -76
- package/dist/scp/makesql/compile-relation.js.map +1 -1
- package/dist/scp/makesql/compile-select.d.ts +45 -10
- package/dist/scp/makesql/compile-select.d.ts.map +1 -1
- package/dist/scp/makesql/compile-select.js +50 -10
- package/dist/scp/makesql/compile-select.js.map +1 -1
- package/dist/scp/makesql/handler.d.ts +1 -1
- package/dist/scp/makesql/handler.d.ts.map +1 -1
- package/dist/scp/makesql/index.d.ts +7 -10
- package/dist/scp/makesql/index.d.ts.map +1 -1
- package/dist/scp/makesql/index.js +19 -30
- package/dist/scp/makesql/index.js.map +1 -1
- package/dist/scp/makesql/json-array.d.ts +65 -0
- package/dist/scp/makesql/json-array.d.ts.map +1 -1
- package/dist/scp/makesql/json-array.js +99 -10
- package/dist/scp/makesql/json-array.js.map +1 -1
- package/dist/scp/makesql/json-batch.d.ts.map +1 -1
- package/dist/scp/makesql/json-batch.js +21 -19
- package/dist/scp/makesql/json-batch.js.map +1 -1
- package/dist/scp/makesql/makesql.d.ts +1 -1
- package/dist/scp/makesql/makesql.d.ts.map +1 -1
- package/dist/scp/makesql/mysql-returning.d.ts +93 -0
- package/dist/scp/makesql/mysql-returning.d.ts.map +1 -0
- package/dist/scp/makesql/mysql-returning.js +215 -0
- package/dist/scp/makesql/mysql-returning.js.map +1 -0
- package/dist/scp/makesql/outtype.d.ts +75 -34
- package/dist/scp/makesql/outtype.d.ts.map +1 -1
- package/dist/scp/makesql/outtype.js +91 -118
- package/dist/scp/makesql/outtype.js.map +1 -1
- package/dist/scp/makesql/pool-executor.d.ts +135 -13
- package/dist/scp/makesql/pool-executor.d.ts.map +1 -1
- package/dist/scp/makesql/pool-executor.js +229 -21
- package/dist/scp/makesql/pool-executor.js.map +1 -1
- package/dist/scp/makesql/tx.d.ts +107 -22
- package/dist/scp/makesql/tx.d.ts.map +1 -1
- package/dist/scp/makesql/tx.js +451 -97
- package/dist/scp/makesql/tx.js.map +1 -1
- package/dist/scp/makesql/writeouttype.d.ts +7 -8
- package/dist/scp/makesql/writeouttype.d.ts.map +1 -1
- package/dist/scp/makesql/writeouttype.js +8 -7
- package/dist/scp/makesql/writeouttype.js.map +1 -1
- package/dist/scp/middleware.d.ts +287 -0
- package/dist/scp/middleware.d.ts.map +1 -0
- package/dist/scp/middleware.js +358 -0
- package/dist/scp/middleware.js.map +1 -0
- package/dist/scp/relation.d.ts +80 -9
- package/dist/scp/relation.d.ts.map +1 -1
- package/dist/scp/relation.js +198 -78
- package/dist/scp/relation.js.map +1 -1
- package/dist/scp/tx-options.d.ts +136 -0
- package/dist/scp/tx-options.d.ts.map +1 -0
- package/dist/scp/tx-options.js +184 -0
- package/dist/scp/tx-options.js.map +1 -0
- package/dist/scp/write-bundle.d.ts +131 -0
- package/dist/scp/write-bundle.d.ts.map +1 -0
- package/dist/scp/write-bundle.js +160 -0
- package/dist/scp/write-bundle.js.map +1 -0
- package/dist/types.d.ts +7 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js.map +1 -1
- package/docs/BENCHMARK.md +58 -56
- package/docs/benchmark-chart.svg +166 -166
- package/docs/design/phase-a-execution-context.md +139 -0
- package/package.json +16 -9
- package/dist/scp/authoring-sql.d.ts +0 -134
- package/dist/scp/authoring-sql.d.ts.map +0 -1
- package/dist/scp/authoring-sql.js +0 -191
- package/dist/scp/authoring-sql.js.map +0 -1
- package/dist/scp/authoring.d.ts +0 -155
- package/dist/scp/authoring.d.ts.map +0 -1
- package/dist/scp/authoring.js +0 -162
- package/dist/scp/authoring.js.map +0 -1
- package/dist/scp/catalog.d.ts +0 -94
- package/dist/scp/catalog.d.ts.map +0 -1
- package/dist/scp/catalog.js +0 -234
- package/dist/scp/catalog.js.map +0 -1
- package/dist/scp/codegen.d.ts +0 -189
- package/dist/scp/codegen.d.ts.map +0 -1
- package/dist/scp/codegen.js +0 -421
- package/dist/scp/codegen.js.map +0 -1
- package/dist/scp/find-filter-guard.d.ts +0 -68
- package/dist/scp/find-filter-guard.d.ts.map +0 -1
- package/dist/scp/find-filter-guard.js +0 -88
- package/dist/scp/find-filter-guard.js.map +0 -1
- package/dist/scp/guard.d.ts +0 -43
- package/dist/scp/guard.d.ts.map +0 -1
- package/dist/scp/guard.js +0 -134
- package/dist/scp/guard.js.map +0 -1
- package/dist/scp/makesql/authoring-compile.d.ts +0 -90
- package/dist/scp/makesql/authoring-compile.d.ts.map +0 -1
- package/dist/scp/makesql/authoring-compile.js +0 -494
- package/dist/scp/makesql/authoring-compile.js.map +0 -1
- package/dist/scp/makesql/ir.d.ts +0 -42
- package/dist/scp/makesql/ir.d.ts.map +0 -1
- package/dist/scp/makesql/ir.js +0 -66
- package/dist/scp/makesql/ir.js.map +0 -1
- package/dist/scp/makesql/static-bundle.d.ts +0 -187
- package/dist/scp/makesql/static-bundle.d.ts.map +0 -1
- package/dist/scp/makesql/static-bundle.js +0 -1113
- package/dist/scp/makesql/static-bundle.js.map +0 -1
- package/dist/scp/runtime.d.ts +0 -242
- package/dist/scp/runtime.d.ts.map +0 -1
- package/dist/scp/runtime.js +0 -400
- package/dist/scp/runtime.js.map +0 -1
|
@@ -0,0 +1,390 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* litedbmodel v2 SCP — the **ExecutionContext + central execute/run seam** (Phase A / #75).
|
|
3
|
+
*
|
|
4
|
+
* This module is the CONTRACT-DEFINING artifact for Phase A: it fixes the shape every runtime
|
|
5
|
+
* (TS here; rust #76 / go #77 / py #78 / php #79 port it) follows. It replaces the raw `driver`
|
|
6
|
+
* parameter threaded through `executeBundle` / `executeReadGraph` / `executeTransaction` with an
|
|
7
|
+
* {@link ExecutionContext} that carries:
|
|
8
|
+
*
|
|
9
|
+
* 1. a **connection provider** — {@link ExecutionContext.connectionFor}`(intent)` resolves WHICH
|
|
10
|
+
* connection a statement runs on (tx-owned / reader / writer / named-DB; Phase A only wires the
|
|
11
|
+
* tx-owned + single-DB cases, the rest are B/C/D on this same seam);
|
|
12
|
+
* 2. a **middleware chain** — {@link ExecutionContext.middleware}, wrapping every SQL (empty in
|
|
13
|
+
* Phase A = passthrough; the registration API is Phase D — this is only the hook point);
|
|
14
|
+
* 3. {@link ExecutionContext.withConnection}`(conn, tx)` — derive a tx-scoped ctx that pins ONE
|
|
15
|
+
* connection so every statement in a transaction body runs on it.
|
|
16
|
+
*
|
|
17
|
+
* ## The central seam (§2 of the design) — ALL SQL funnels through here
|
|
18
|
+
*
|
|
19
|
+
* ```
|
|
20
|
+
* execute(ctx, sql, params) -> Rows // SELECT / RETURNING reads
|
|
21
|
+
* run(ctx, sql, params) -> RunInfo // INSERT/UPDATE/DELETE, BEGIN/COMMIT/ROLLBACK
|
|
22
|
+
* ```
|
|
23
|
+
*
|
|
24
|
+
* Both do the SAME three things, in order:
|
|
25
|
+
* ① run the middleware chain (empty ⇒ passthrough, behavior unchanged);
|
|
26
|
+
* ② resolve the connection via `ctx.connectionFor(intent)`;
|
|
27
|
+
* ③ execute on that connection (the ONLY driver contact point).
|
|
28
|
+
*
|
|
29
|
+
* Every direct `driver.prepare(sql).all()/run()` in the read / tx / relation path is replaced by a
|
|
30
|
+
* call through this seam. A `grep` for `.prepare(` outside this file's connection adapters must come
|
|
31
|
+
* up empty in the runtime SQL path — that is the AC.
|
|
32
|
+
*
|
|
33
|
+
* ## Two flavors — sync (SQLite) and async (live PG / MySQL)
|
|
34
|
+
*
|
|
35
|
+
* The in-process better-sqlite3 path is **synchronous** (and must stay byte-identical to the frozen
|
|
36
|
+
* conformance corpus), so it uses a {@link SyncConnection} and the {@link execute} / {@link run}
|
|
37
|
+
* seam. The live PG / MySQL path is **async + pooled**, where per-execution connection ownership is
|
|
38
|
+
* what actually fixes the concurrent-tx isolation bug; it uses an {@link AsyncConnection} and the
|
|
39
|
+
* {@link executeAsync} / {@link runAsync} seam plus {@link withTransactionAsync}.
|
|
40
|
+
*
|
|
41
|
+
* Both flavors implement the SAME contract shape (`connectionFor` / `middleware` / `withConnection`
|
|
42
|
+
* / a central seam / `withTransaction`); the native ports mirror whichever their runtime needs
|
|
43
|
+
* (rust/go = the owned-connection async model; py = contextvars; php = the single-connection sync
|
|
44
|
+
* model — same contract, no ALS since PHP is 1-request-1-process).
|
|
45
|
+
*
|
|
46
|
+
* ## Per-execution connection ownership (§3) — the concurrent-tx fix
|
|
47
|
+
*
|
|
48
|
+
* A transaction acquires ONE connection, scopes it into an {@link AsyncLocalStorage} ctx, runs its
|
|
49
|
+
* body (every statement resolves that connection via `connectionFor`), COMMITs/ROLLBACKs, and
|
|
50
|
+
* releases it. Concurrent transactions each run in their own ALS ctx with their own connection —
|
|
51
|
+
* **isolated**. There is NO driver-global single-slot writer (the shared-slot model — `pool.query`
|
|
52
|
+
* per statement, or a `Mutex<Option<writer>>` — is what corrupts concurrent transactions; see the
|
|
53
|
+
* `test/integration/tx-isolation` proof).
|
|
54
|
+
*/
|
|
55
|
+
import { type TransactionOptions } from './tx-options';
|
|
56
|
+
import { type RoutingConfig, WriterStickyClock } from './connection-routing';
|
|
57
|
+
import type { Dialect } from './makesql/handler';
|
|
58
|
+
/**
|
|
59
|
+
* What a statement needs from the connection provider (§3): whether it writes (so it must go to a
|
|
60
|
+
* writer / the tx-owned connection, never a read replica) and an optional named DB (multi-DB
|
|
61
|
+
* routing, Phase B). Phase A resolves only `write` (tx-owned vs. primary) and ignores `db` (single
|
|
62
|
+
* DB); the field is in the contract now so the native ports declare the SAME shape and B/C/D extend
|
|
63
|
+
* the resolver — not the seam.
|
|
64
|
+
*/
|
|
65
|
+
export interface StatementIntent {
|
|
66
|
+
/** The statement writes (INSERT/UPDATE/DELETE or BEGIN/COMMIT/ROLLBACK) ⇒ writer / tx connection. */
|
|
67
|
+
readonly write: boolean;
|
|
68
|
+
/** Named-DB routing key (multi-DB, Phase B). Absent ⇒ the primary DB. */
|
|
69
|
+
readonly db?: string;
|
|
70
|
+
}
|
|
71
|
+
/** A SELECT / RETURNING result: the raw driver rows. */
|
|
72
|
+
export type Rows = Record<string, unknown>[];
|
|
73
|
+
/** A non-returning write summary (INSERT/UPDATE/DELETE affected + last insert id). */
|
|
74
|
+
export interface RunInfo {
|
|
75
|
+
readonly changes: number;
|
|
76
|
+
readonly lastInsertRowid: number | bigint;
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* The ONE driver contact point (§5) — a single owned SQLite connection (better-sqlite3 `Database`,
|
|
80
|
+
* or one pooled handle). The seam is the ONLY caller; the runtime SQL path never touches a driver
|
|
81
|
+
* directly. `prepareRaw` is escape-hatched ONLY for the read path's `safeIntegers` toggle (a
|
|
82
|
+
* better-sqlite3 statement-level knob the #59 BIGINT de-box needs) — it is NOT a general driver door.
|
|
83
|
+
*/
|
|
84
|
+
export interface SyncConnection {
|
|
85
|
+
/** Run a SELECT / RETURNING statement; resolve the raw rows. */
|
|
86
|
+
execute(sql: string, params: readonly unknown[]): Rows;
|
|
87
|
+
/**
|
|
88
|
+
* Run a SELECT in better-sqlite3 `safeIntegers` mode (the #59 BIGINT-exact read: int8 comes back
|
|
89
|
+
* as an EXACT `bigint`, not a rounded JS number). A backend with no such toggle falls back to a
|
|
90
|
+
* plain {@link SyncConnection.execute}. Kept BEHIND the seam so the read walker never touches a
|
|
91
|
+
* raw prepared statement — the `safeIntegers` knob is a driver detail, not a runtime-path concern.
|
|
92
|
+
*/
|
|
93
|
+
executeSafeIntegers(sql: string, params: readonly unknown[]): Rows;
|
|
94
|
+
/** Run a non-returning write / DDL / tx-control statement; resolve the affected summary. */
|
|
95
|
+
run(sql: string, params: readonly unknown[]): RunInfo;
|
|
96
|
+
}
|
|
97
|
+
/** The minimal better-sqlite3 prepared statement the read path drives (with the `safeIntegers` knob). */
|
|
98
|
+
export interface RawStmt {
|
|
99
|
+
all(...params: unknown[]): unknown[];
|
|
100
|
+
run(...params: unknown[]): {
|
|
101
|
+
changes: number;
|
|
102
|
+
lastInsertRowid: number | bigint;
|
|
103
|
+
};
|
|
104
|
+
safeIntegers?(v: boolean): unknown;
|
|
105
|
+
}
|
|
106
|
+
/** The async twin: one OWNED pooled connection (PG client / mysql2 connection). */
|
|
107
|
+
export interface AsyncConnection {
|
|
108
|
+
execute(sql: string, params: readonly unknown[]): Promise<Rows>;
|
|
109
|
+
run(sql: string, params: readonly unknown[]): Promise<RunInfo>;
|
|
110
|
+
}
|
|
111
|
+
/** The terminal of a middleware chain: resolve the connection + execute (the seam's ②③). */
|
|
112
|
+
export type SeamNext<T> = (sql: string, params: readonly unknown[]) => T;
|
|
113
|
+
/** One middleware: wrap a statement, delegating to `next` (Phase D supplies the registration API). */
|
|
114
|
+
export type Middleware<T> = (sql: string, params: readonly unknown[], next: SeamNext<T>) => T;
|
|
115
|
+
/**
|
|
116
|
+
* A source of the CURRENT SQL-level middleware stack, resolved at `wrap` time (§4, Phase D). A ctx
|
|
117
|
+
* built by the backward-compat factories carries a source that reads the ambient/global
|
|
118
|
+
* {@link import('./middleware').MiddlewareRegistry} — so a middleware registered AFTER the ctx was
|
|
119
|
+
* built (the normal `DBModel.use(...)`-then-query order) is still seen, and a per-context registry
|
|
120
|
+
* override (concurrent-request isolation) is honored. Absent ⇒ a fixed (possibly empty) stack.
|
|
121
|
+
*/
|
|
122
|
+
export type MiddlewareStackSource = () => readonly Middleware<unknown>[];
|
|
123
|
+
/**
|
|
124
|
+
* The ordered middleware chain a ctx carries (§4). `wrap` folds the middlewares around `next`
|
|
125
|
+
* (the connection-resolve + execute terminal). An EMPTY chain is a pure passthrough — `wrap`
|
|
126
|
+
* returns `next(sql, params)` verbatim, so an unregistered chain is byte-identical. The chain is
|
|
127
|
+
* generic over the seam result type `T` so ONE shape serves both the sync (`Rows`/`RunInfo`) and
|
|
128
|
+
* async (`Promise<…>`) seams.
|
|
129
|
+
*
|
|
130
|
+
* The stack is resolved by a {@link MiddlewareStackSource} at EACH `wrap` (Phase D) rather than
|
|
131
|
+
* captured at construction, so registration (`DBModel.use`) that happens after the ctx is built is
|
|
132
|
+
* still honored and per-execution-scope registries (concurrent isolation) resolve correctly. A chain
|
|
133
|
+
* constructed with an explicit fixed stack (or none) still works — that stack is its constant source.
|
|
134
|
+
*/
|
|
135
|
+
export declare class MiddlewareChain {
|
|
136
|
+
/** Resolve the CURRENT registered SQL-level middlewares, outermost first, at `wrap` time. */
|
|
137
|
+
private readonly source;
|
|
138
|
+
constructor(stackOrSource?: readonly Middleware<unknown>[] | MiddlewareStackSource);
|
|
139
|
+
/** Is the chain empty RIGHT NOW (⇒ this `wrap` is a guaranteed passthrough)? */
|
|
140
|
+
get isEmpty(): boolean;
|
|
141
|
+
/** Fold the chain around `next`, then invoke it. Empty chain ⇒ `next(sql, params)` verbatim. */
|
|
142
|
+
wrap<T>(sql: string, params: readonly unknown[], next: SeamNext<T>): T;
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* The SYNC execution context (better-sqlite3). Carries the connection provider, the middleware
|
|
146
|
+
* chain, and `withConnection` to derive a tx-scoped ctx. The runtime passes THIS (not a raw driver)
|
|
147
|
+
* to `executeBundle` / `executeReadGraph` / `executeTransaction`.
|
|
148
|
+
*/
|
|
149
|
+
export interface ExecutionContext {
|
|
150
|
+
/** Resolve WHICH connection a statement runs on (§3). Phase A: the tx-owned conn, else the primary. */
|
|
151
|
+
connectionFor(intent: StatementIntent): SyncConnection;
|
|
152
|
+
/** The middleware chain wrapping every SQL (§4). Empty in Phase A. */
|
|
153
|
+
readonly middleware: MiddlewareChain;
|
|
154
|
+
/** Derive a tx-scoped ctx pinning `conn` (every statement resolves it while `tx` is true). */
|
|
155
|
+
withConnection(conn: SyncConnection, tx: boolean): ExecutionContext;
|
|
156
|
+
}
|
|
157
|
+
/** The ASYNC execution context (live PG / MySQL) — the same contract, async connections. */
|
|
158
|
+
export interface AsyncExecutionContext {
|
|
159
|
+
connectionFor(intent: StatementIntent): AsyncConnection;
|
|
160
|
+
readonly middleware: MiddlewareChain;
|
|
161
|
+
withConnection(conn: AsyncConnection, tx: boolean): AsyncExecutionContext;
|
|
162
|
+
}
|
|
163
|
+
/**
|
|
164
|
+
* Central READ seam (sync): ① middleware chain, ② resolve the connection, ③ execute. Every read
|
|
165
|
+
* (primary read node, relation batch) funnels through here.
|
|
166
|
+
*/
|
|
167
|
+
export declare function execute(ctx: ExecutionContext, sql: string, params: readonly unknown[], intent?: StatementIntent): Rows;
|
|
168
|
+
/**
|
|
169
|
+
* Central READ seam (sync) in `safeIntegers` mode (§2 + the #59 BIGINT-exact read). Same
|
|
170
|
+
* middleware → connectionFor → execute path, but the terminal runs the SELECT in exact-integer mode
|
|
171
|
+
* so int8/BIGINT columns materialize without rounding. Used by the read walker for a BIGINT-
|
|
172
|
+
* projecting node; a non-BIGINT node uses the plain {@link execute}.
|
|
173
|
+
*/
|
|
174
|
+
export declare function executeSafe(ctx: ExecutionContext, sql: string, params: readonly unknown[], intent?: StatementIntent): Rows;
|
|
175
|
+
/**
|
|
176
|
+
* Central WRITE seam (sync): ① middleware chain, ② resolve the connection, ③ run. Every write and
|
|
177
|
+
* every tx-control statement (BEGIN/COMMIT/ROLLBACK) funnels through here (writes ⇒ `intent.write`).
|
|
178
|
+
*/
|
|
179
|
+
export declare function run(ctx: ExecutionContext, sql: string, params: readonly unknown[], intent?: StatementIntent): RunInfo;
|
|
180
|
+
/** Central READ seam (async) — the live PG / MySQL twin of {@link execute}. */
|
|
181
|
+
export declare function executeAsync(ctx: AsyncExecutionContext, sql: string, params: readonly unknown[], intent?: StatementIntent): Promise<Rows>;
|
|
182
|
+
/** Central WRITE seam (async) — the live PG / MySQL twin of {@link run}. */
|
|
183
|
+
export declare function runAsync(ctx: AsyncExecutionContext, sql: string, params: readonly unknown[], intent?: StatementIntent): Promise<RunInfo>;
|
|
184
|
+
/**
|
|
185
|
+
* GUARDED write seam (sync): enforce the write=tx guard ({@link checkWriteAllowed}) for a
|
|
186
|
+
* DATA-mutating statement, then delegate to {@link run}. A write issued OUTSIDE a transaction throws
|
|
187
|
+
* {@link WriteOutsideTransactionError}; a write in a {@link withReadOnly} scope throws
|
|
188
|
+
* {@link WriteInReadOnlyContextError}. Tx-control statements (BEGIN/COMMIT/ROLLBACK/SET) are NOT
|
|
189
|
+
* guarded — the tx runtime issues them to OPEN the very scope the guard checks. This is the seam a
|
|
190
|
+
* bare model-level write (create/update/delete/upsert/batch) goes through.
|
|
191
|
+
*/
|
|
192
|
+
export declare function runGuarded(ctx: ExecutionContext, sql: string, params: readonly unknown[], operation: string, modelName?: string): RunInfo;
|
|
193
|
+
/**
|
|
194
|
+
* GUARDED write seam (async) — the live PG / MySQL twin of {@link runGuarded}. The guard is enforced
|
|
195
|
+
* inside the returned promise (an async caller gets a REJECTED promise, never a synchronous throw).
|
|
196
|
+
*/
|
|
197
|
+
export declare function runGuardedAsync(ctx: AsyncExecutionContext, sql: string, params: readonly unknown[], operation: string, modelName?: string): Promise<RunInfo>;
|
|
198
|
+
/** The minimal synchronous SQLite driver surface (better-sqlite3 `Database`) the runtime accepts. */
|
|
199
|
+
export interface SqliteDriver {
|
|
200
|
+
prepare(sql: string): {
|
|
201
|
+
all(...params: unknown[]): unknown[];
|
|
202
|
+
run(...params: unknown[]): {
|
|
203
|
+
changes: number;
|
|
204
|
+
lastInsertRowid: number | bigint;
|
|
205
|
+
};
|
|
206
|
+
safeIntegers?(v: boolean): unknown;
|
|
207
|
+
};
|
|
208
|
+
}
|
|
209
|
+
/** Adapt a better-sqlite3 `Database` to the {@link SyncConnection} seam (the ONE driver contact). */
|
|
210
|
+
export declare function connectionForDriver(driver: SqliteDriver): SyncConnection;
|
|
211
|
+
/**
|
|
212
|
+
* **Backward-compat wrapper (§6).** Wrap a raw better-sqlite3 `Database` in a thin
|
|
213
|
+
* {@link ExecutionContext}: reader = writer = the same driver, a single DB. Its middleware chain
|
|
214
|
+
* resolves the ambient/global SQL-level {@link import('./middleware').MiddlewareRegistry} at wrap
|
|
215
|
+
* time (Phase D), so a middleware registered via `DBModel.use(...)` intercepts the SQL — and, when
|
|
216
|
+
* NO middleware is registered, the chain is empty and the seam is a pure passthrough to
|
|
217
|
+
* `driver.prepare(...).all()/run()`, i.e. **byte-identical** (the conformance/livedb runners
|
|
218
|
+
* register none, so they are unchanged).
|
|
219
|
+
*/
|
|
220
|
+
export declare function contextForDriver(driver: SqliteDriver): ExecutionContext;
|
|
221
|
+
/**
|
|
222
|
+
* Build a sync ctx directly over a {@link SyncConnection} (for a caller that already owns a
|
|
223
|
+
* connection adapter — e.g. a non-better-sqlite3 sync backend). Same single-DB / ambient-middleware
|
|
224
|
+
* shape as {@link contextForDriver}.
|
|
225
|
+
*/
|
|
226
|
+
export declare function contextForConnection(conn: SyncConnection): ExecutionContext;
|
|
227
|
+
/**
|
|
228
|
+
* A pool that hands out an OWNED connection per acquire and takes it back on release. This is the
|
|
229
|
+
* substrate for per-execution connection ownership: a transaction `acquire()`s ONE connection,
|
|
230
|
+
* runs its whole body on it, then `release()`s it. Concurrent transactions acquire DISTINCT
|
|
231
|
+
* connections ⇒ isolation. (`pg.Pool.connect()` / `mysql2 pool.getConnection()` fit this shape.)
|
|
232
|
+
*/
|
|
233
|
+
export interface AsyncConnectionPool {
|
|
234
|
+
/** Check out one owned connection for the caller's exclusive use. */
|
|
235
|
+
acquire(): Promise<AsyncConnection>;
|
|
236
|
+
/** Return a connection to the pool. `destroy` ⇒ drop it (a poisoned/aborted connection). */
|
|
237
|
+
release(conn: AsyncConnection, destroy?: boolean): Promise<void>;
|
|
238
|
+
}
|
|
239
|
+
/**
|
|
240
|
+
* A pooled async {@link AsyncExecutionContext}. Outside a transaction, `connectionFor` acquires a
|
|
241
|
+
* fresh pooled connection per statement (the existing read fan-out model — each concurrent sibling
|
|
242
|
+
* on its own connection). Inside a transaction, {@link withTransactionAsync} pins ONE acquired
|
|
243
|
+
* connection into the ALS store; `connectionFor` returns THAT for every statement in the body, so
|
|
244
|
+
* the whole tx runs on one owned connection — isolated from concurrent transactions.
|
|
245
|
+
*
|
|
246
|
+
* NB: outside a tx, `connectionFor` returns a **per-statement** owned connection wrapper that
|
|
247
|
+
* acquires-runs-releases; the read walker issues one statement per `executeAsync`, matching the
|
|
248
|
+
* existing `SqlExecutorAsync` "acquire per exec" semantics byte-for-byte.
|
|
249
|
+
*/
|
|
250
|
+
export declare class PooledAsyncContext implements AsyncExecutionContext {
|
|
251
|
+
readonly middleware: MiddlewareChain;
|
|
252
|
+
/**
|
|
253
|
+
* The full routing config (§3 steps 2-4): the multi-DB {@link ConnectionRegistry} + the
|
|
254
|
+
* {@link WriterStickyClock}. A ctx built from a single `pool` synthesizes a default-only registry
|
|
255
|
+
* (reader === writer) + an always-false sticky clock, so its resolution is byte-identical to the
|
|
256
|
+
* Phase A/B single-pool path. A ctx built with a {@link RoutingConfig} (via {@link setConfig})
|
|
257
|
+
* gets reader/writer separation, writer-sticky, and named-DB routing.
|
|
258
|
+
*/
|
|
259
|
+
private readonly routing;
|
|
260
|
+
/**
|
|
261
|
+
* Construct from EITHER a single {@link AsyncConnectionPool} (backward-compat: default connection,
|
|
262
|
+
* reader === writer, sticky disabled — byte-identical to Phase A/B) OR a full {@link RoutingConfig}
|
|
263
|
+
* (Phase C: reader/writer separation + writer-sticky + named-DB routing).
|
|
264
|
+
*/
|
|
265
|
+
constructor(poolOrRouting: AsyncConnectionPool | RoutingConfig, middleware?: MiddlewareChain);
|
|
266
|
+
connectionFor(intent: StatementIntent): AsyncConnection;
|
|
267
|
+
withConnection(_conn: AsyncConnection, _tx: boolean): AsyncExecutionContext;
|
|
268
|
+
/**
|
|
269
|
+
* The WRITER pool of the connection a transaction runs against (so `withTransactionAsync` acquires
|
|
270
|
+
* the tx's owned connection from the right pool). A transaction is a write ⇒ the writer pool of the
|
|
271
|
+
* named connection (`intent.db`). Absent `db` ⇒ the default connection's writer.
|
|
272
|
+
*/
|
|
273
|
+
connectionPoolFor(intent?: StatementIntent): AsyncConnectionPool;
|
|
274
|
+
/** The default connection's writer pool (backward-compat accessor for the single-DB tx path). */
|
|
275
|
+
get connectionPool(): AsyncConnectionPool;
|
|
276
|
+
/** The writer-sticky clock (the tx runtime `.mark()`s it on a successful write/commit). */
|
|
277
|
+
get stickyClock(): WriterStickyClock;
|
|
278
|
+
}
|
|
279
|
+
/**
|
|
280
|
+
* Run `fn` inside the ALS scope with `conn` pinned as the ambient tx connection (§3). Every
|
|
281
|
+
* `connectionFor` inside `fn` (async boundaries included) returns `conn`. This is the TS
|
|
282
|
+
* per-execution ownership mechanism (v1 `DBModel.ts` `txContext.run`); the native ports use
|
|
283
|
+
* task-local (rust) / `context.Context` (go) / contextvars (py) / an explicit arg (php) for the
|
|
284
|
+
* SAME effect.
|
|
285
|
+
*/
|
|
286
|
+
export declare function runWithPinnedAsyncConnection<R>(conn: AsyncConnection, fn: () => Promise<R>): Promise<R>;
|
|
287
|
+
/**
|
|
288
|
+
* The tx-owned connection pinned in the CURRENT async scope, or `undefined` if not inside a
|
|
289
|
+
* transaction. {@link withTransactionAsync} reads this to detect a NESTED transaction (an inner
|
|
290
|
+
* `withTransactionAsync` running inside an outer's ALS scope joins the outer instead of opening a
|
|
291
|
+
* new physical transaction). The native ports read their task-local / contextvar / `context.Context`
|
|
292
|
+
* for the SAME nested detection.
|
|
293
|
+
*/
|
|
294
|
+
export declare function currentPinnedAsyncConnection(): AsyncConnection | undefined;
|
|
295
|
+
/**
|
|
296
|
+
* Transaction options for {@link withTransactionAsync}. The full Phase B contract (isolation / retry
|
|
297
|
+
* / rollbackOnly) lives in {@link import('./tx-options').TransactionOptions}; this re-exports it so
|
|
298
|
+
* exec-context stays the single tx entry while the option shape + defaults + isolation-SQL mapping +
|
|
299
|
+
* retryable-error classification are defined ONCE in `tx-options.ts` (the file the 4 native ports
|
|
300
|
+
* mirror). `TxOptions` is the historical alias kept for callers; it IS `TransactionOptions`.
|
|
301
|
+
*/
|
|
302
|
+
export type TxOptions = TransactionOptions;
|
|
303
|
+
/**
|
|
304
|
+
* Run a transaction with **per-execution connection ownership** (§3, the concurrent-tx fix) plus the
|
|
305
|
+
* full Phase B tx-completeness contract (#81): isolation level, nested-tx join, rollbackOnly, and
|
|
306
|
+
* whole-tx retry with per-attempt connection acquisition.
|
|
307
|
+
*
|
|
308
|
+
* **Per attempt** (up to `retryLimit`):
|
|
309
|
+
* 1. acquire ONE fresh connection from the pool (a retry after a connection error thus RECONNECTS);
|
|
310
|
+
* 2. pin it into the ALS ctx (`runWithPinnedAsyncConnection`) so EVERY statement `fn` issues
|
|
311
|
+
* resolves THAT connection — never a fresh pooled one;
|
|
312
|
+
* 3. issue the isolation-aware BEGIN ({@link beginStatements}: PG `BEGIN ISOLATION LEVEL …`;
|
|
313
|
+
* MySQL a preceding `SET TRANSACTION ISOLATION LEVEL …` then `BEGIN`);
|
|
314
|
+
* 4. run `fn(txCtx)` → `COMMIT` (or `ROLLBACK` if `rollbackOnly`, still returning the body result);
|
|
315
|
+
* 5. on a body/commit error `ROLLBACK` and either RETRY (retryable error + attempts remain, with
|
|
316
|
+
* exponential backoff `retryDuration·2^(k-1)`) or re-raise;
|
|
317
|
+
* 6. release the connection back to the pool (DESTROYED if the ROLLBACK itself failed, or the whole
|
|
318
|
+
* tx errored non-cleanly — a poisoned connection must not re-enter the pool).
|
|
319
|
+
*
|
|
320
|
+
* **Nested**: if a tx-owned connection is ALREADY pinned in the ALS (an outer `withTransactionAsync`
|
|
321
|
+
* on this async chain), the inner call JOINS the outer — it runs `fn` directly on the outer's ctx
|
|
322
|
+
* with NO new BEGIN/COMMIT/acquire, so the whole nested body is one physical transaction (an inner
|
|
323
|
+
* error propagates and rolls back the WHOLE tx). Mirrors v1 `DBModel.transaction` :2794-2797.
|
|
324
|
+
*
|
|
325
|
+
* Concurrent (non-nested) `withTransactionAsync` calls each acquire a DISTINCT connection and pin it
|
|
326
|
+
* in their OWN ALS scope, so their writes never cross-talk — the isolation the shared-slot model
|
|
327
|
+
* violates. This is the reference the native ports (#82-85) mirror.
|
|
328
|
+
*/
|
|
329
|
+
export declare function withTransactionAsync<R>(ctx: PooledAsyncContext, fn: (txCtx: AsyncExecutionContext) => Promise<R>, opts?: TransactionOptions, dialect?: Dialect, isConnectionError?: (e: Error) => boolean, connection?: string): Promise<R>;
|
|
330
|
+
/**
|
|
331
|
+
* **The public user-controlled transaction boundary** (#86) — the REAL transaction feature v2 was
|
|
332
|
+
* missing. `transaction(ctx, fn, options?)` opens ONE boundary the caller wraps around MULTIPLE
|
|
333
|
+
* arbitrary operations so they commit or roll back TOGETHER:
|
|
334
|
+
*
|
|
335
|
+
* ```ts
|
|
336
|
+
* await transaction(ctx, async () => {
|
|
337
|
+
* await A.create(...); // ← every op inside joins this ONE boundary:
|
|
338
|
+
* await B.update(...); // one connection, one BEGIN…COMMIT, all-or-nothing.
|
|
339
|
+
* }, { isolation: 'serializable' });
|
|
340
|
+
* ```
|
|
341
|
+
*
|
|
342
|
+
* ## What it does (v1 `DBModel.transaction` :2787 parity, on the SCP seam)
|
|
343
|
+
*
|
|
344
|
+
* It acquires ONE pooled connection, issues the isolation-aware `BEGIN`
|
|
345
|
+
* ({@link import('./tx-options').beginStatements}), PINS that connection into the ALS ctx, runs
|
|
346
|
+
* `fn`, then `COMMIT` (or `ROLLBACK` on a body error / `options.rollbackOnly`), with the #81 retry
|
|
347
|
+
* loop (deadlock / serialization / connection error) wrapped around the WHOLE boundary. It is a thin
|
|
348
|
+
* façade over {@link withTransactionAsync}: the ONE mechanism — the same acquire → pin → BEGIN →
|
|
349
|
+
* body → COMMIT/ROLLBACK → release + retry — powers both.
|
|
350
|
+
*
|
|
351
|
+
* ## The ambient-tx JOIN — how operations participate (the core #86 fix)
|
|
352
|
+
*
|
|
353
|
+
* `fn` takes NO connection argument. Instead the pinned connection lives in the ALS
|
|
354
|
+
* ({@link currentPinnedAsyncConnection}) + the "inside a transaction" marker
|
|
355
|
+
* ({@link import('./tx-options').runInTransactionScope}). Every operation `fn` issues — a live-DB
|
|
356
|
+
* write via {@link import('./makesql/tx').executeTransactionAsync}, a read via the async read seam —
|
|
357
|
+
* detects that ambient pinned connection and runs its statements on THAT connection **without opening
|
|
358
|
+
* its own BEGIN/COMMIT** (`withTransactionAsync`'s nested-join, :495). So N operations inside one
|
|
359
|
+
* `transaction(fn)` produce exactly ONE BEGIN + ONE COMMIT on ONE connection. Outside a
|
|
360
|
+
* `transaction(fn)` the ambient pin is absent, so a bare write's own `executeTransactionAsync` sees
|
|
361
|
+
* no ambient tx and the write=tx guard fires ({@link WriteOutsideTransactionError}).
|
|
362
|
+
*
|
|
363
|
+
* NESTED `transaction()` joins the outer (one physical BEGIN/COMMIT; an inner error rolls back the
|
|
364
|
+
* WHOLE tx) — again via `withTransactionAsync`'s nested-join. Isolation/retry/rollbackOnly options on
|
|
365
|
+
* a nested call are ignored (the outer owns them). This is the API REFERENCE the native ports
|
|
366
|
+
* (#82-85) mirror.
|
|
367
|
+
*/
|
|
368
|
+
export declare function transaction<R>(ctx: PooledAsyncContext, fn: () => Promise<R>, options?: TransactionOptions, dialect?: Dialect, isConnectionError?: (e: Error) => boolean, connection?: string): Promise<R>;
|
|
369
|
+
/**
|
|
370
|
+
* **The SYNC transaction boundary (#141)** — the sync twin of {@link withTransactionAsync} for the
|
|
371
|
+
* in-process better-sqlite3 runtime. Pins ONE connection for the whole transaction (BEGIN…COMMIT on
|
|
372
|
+
* the same conn — the per-execution ownership the async path gets from the pool), issues the
|
|
373
|
+
* isolation-aware `BEGIN` ({@link beginStatements}), runs `fn(txCtx)` inside the tx scope marker
|
|
374
|
+
* (`runInTransactionScope` — so a nested write's guard/detection sees an active tx), then COMMITs or
|
|
375
|
+
* ROLLBACKs by the body's signal:
|
|
376
|
+
* - `{ commit: true, value }` → `COMMIT`, return `value`;
|
|
377
|
+
* - `{ commit: false, value }` → `ROLLBACK`, return `value` (a gate short-circuit / rollbackOnly —
|
|
378
|
+
* no committed change, but the body result is still returned, e.g. the short-circuit reason);
|
|
379
|
+
* - a THROW from `fn` → best-effort `ROLLBACK`, re-raise (the caller maps the driver error).
|
|
380
|
+
*
|
|
381
|
+
* Every statement `fn` issues resolves the pinned tx connection via `connectionFor` (the tx-owned
|
|
382
|
+
* conn), so the whole body runs atomically on one connection. This is the boundary the write/tx leaf
|
|
383
|
+
* path runs inside; the tx-control statements (BEGIN/COMMIT/ROLLBACK) go through the seam here, while
|
|
384
|
+
* the body's data statements ride the `executeSQL` transport leaf.
|
|
385
|
+
*/
|
|
386
|
+
export declare function withTransactionSync<R>(outer: ExecutionContext, fn: (txCtx: ExecutionContext) => {
|
|
387
|
+
commit: boolean;
|
|
388
|
+
value: R;
|
|
389
|
+
}, dialect?: Dialect, isolation?: TransactionOptions['isolation']): R;
|
|
390
|
+
//# sourceMappingURL=exec-context.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"exec-context.d.ts","sourceRoot":"","sources":["../../src/scp/exec-context.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqDG;AAGH,OAAO,EACL,KAAK,kBAAkB,EAOxB,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,KAAK,aAAa,EAElB,iBAAiB,EAElB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAKjD;;;;;;GAMG;AACH,MAAM,WAAW,eAAe;IAC9B,qGAAqG;IACrG,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC;IACxB,yEAAyE;IACzE,QAAQ,CAAC,EAAE,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,wDAAwD;AACxD,MAAM,MAAM,IAAI,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,CAAC;AAE7C,sFAAsF;AACtF,MAAM,WAAW,OAAO;IACtB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,eAAe,EAAE,MAAM,GAAG,MAAM,CAAC;CAC3C;AAED;;;;;G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