@prisma/orm-family-sql 8.0.0-rc.24-dev.35 → 8.0.0-rc.24-dev.37
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/dist/{exports-kqOXg2OT-D3lo7jnX.mjs → exports-BLvDBaFs-DZPo5Hei.mjs} +38 -21
- package/dist/exports-BLvDBaFs-DZPo5Hei.mjs.map +1 -0
- package/dist/{index-nW0rAUTr.d.mts → index-CI6diFcZ.d.mts} +6 -5
- package/dist/{index-nW0rAUTr.d.mts.map → index-CI6diFcZ.d.mts.map} +1 -1
- package/dist/orm-client.d.mts +1 -1
- package/dist/orm-client.mjs +2 -2
- package/dist/orm-client.mjs.map +1 -1
- package/dist/runtime.d.mts +1 -1
- package/dist/runtime.mjs +1 -1
- package/package.json +18 -18
- package/dist/exports-kqOXg2OT-D3lo7jnX.mjs.map +0 -1
|
@@ -18,7 +18,7 @@ import { checkContractComponentRequirements, mergeCapabilityMatrices } from "@pr
|
|
|
18
18
|
import { AsyncIterableResult, RuntimeCore, applyMutationDefaults, assertMutationDefaultGeneratorsAvailable, checkAborted, checkMiddlewareCompatibility, collectMutationDefaultGenerators, createContextBeneath, executeStatement, raceAgainstAbort, runtimeError as runtimeError$1, startClientActivity, startTransactionActivity, streamStatement } from "@prisma/orm-framework/components/runtime";
|
|
19
19
|
import { createExecutionStack } from "@prisma/orm-framework/components/execution";
|
|
20
20
|
import { hashContent } from "@prisma/orm-framework/utils/hash-content";
|
|
21
|
-
//#region ../../../2-sql-family/5-runtime/dist/exports-
|
|
21
|
+
//#region ../../../2-sql-family/5-runtime/dist/exports-BLvDBaFs.mjs
|
|
22
22
|
/** The symbol-keyed member through which a runtime, connection, transaction, `withTransaction` context or activity handle starts activities; user-facing types do not show it. */
|
|
23
23
|
const activitySource = Symbol("activitySource");
|
|
24
24
|
function hasActivitySourceMember(target) {
|
|
@@ -1242,12 +1242,13 @@ var TransactionBase = class {
|
|
|
1242
1242
|
this.activity = activity;
|
|
1243
1243
|
this.stack = stack;
|
|
1244
1244
|
this.entry = entry;
|
|
1245
|
-
this.route = runtime.route(driverTx, activity);
|
|
1246
1245
|
this.openTransaction = {
|
|
1247
1246
|
activity,
|
|
1248
1247
|
assertAcceptsStatements: () => this.assertAcceptsStatements(),
|
|
1249
|
-
assertOpen: () => this.assertOpen()
|
|
1248
|
+
assertOpen: () => this.assertOpen(),
|
|
1249
|
+
transactionBeneath: (parent) => this.transactionBeneath(parent)
|
|
1250
1250
|
};
|
|
1251
|
+
this.route = runtime.route(driverTx, this.openTransaction);
|
|
1251
1252
|
runtime.register(driverTx, this.openTransaction);
|
|
1252
1253
|
this[activitySource] = {
|
|
1253
1254
|
startActivity: (clientActivity) => runtime.startActivity(this.route, clientActivity),
|
|
@@ -1283,7 +1284,10 @@ var TransactionBase = class {
|
|
|
1283
1284
|
[preparedStatementExecute](ps, params, options) {
|
|
1284
1285
|
return this.route.preparedExecute(blindCast(ps), params, { ...options });
|
|
1285
1286
|
}
|
|
1286
|
-
|
|
1287
|
+
transaction() {
|
|
1288
|
+
return this.transactionBeneath(this.activity);
|
|
1289
|
+
}
|
|
1290
|
+
async transactionBeneath(parent) {
|
|
1287
1291
|
if (this.isClosed) throw transactionClosedError();
|
|
1288
1292
|
this.assertAcceptsStatements();
|
|
1289
1293
|
const name = this.stack.nextSavepointName();
|
|
@@ -1296,7 +1300,7 @@ var TransactionBase = class {
|
|
|
1296
1300
|
this.stack.push(entry);
|
|
1297
1301
|
let activity;
|
|
1298
1302
|
try {
|
|
1299
|
-
activity = await this.runtime.startTransactionActivity(
|
|
1303
|
+
activity = await this.runtime.startTransactionActivity(parent);
|
|
1300
1304
|
} catch (error) {
|
|
1301
1305
|
this.stack.pop();
|
|
1302
1306
|
throw error;
|
|
@@ -1552,6 +1556,9 @@ var Savepoint = class extends TransactionBase {
|
|
|
1552
1556
|
function transactionClosedError() {
|
|
1553
1557
|
return runtimeError$1("RUNTIME.TRANSACTION_CLOSED", "Cannot use a transaction operation after the transaction has ended. Consume query results and await execute calls inside the transaction callback.", {});
|
|
1554
1558
|
}
|
|
1559
|
+
function savepointOptionsUnsupportedError(options) {
|
|
1560
|
+
return runtimeError$1("RUNTIME.SAVEPOINT_OPTIONS_UNSUPPORTED", "A transaction started inside a transaction is a savepoint, which has the isolation level and timeout of the transaction it is in; it takes no options.", { options });
|
|
1561
|
+
}
|
|
1555
1562
|
function openSavepointOf(stack) {
|
|
1556
1563
|
const { top } = stack;
|
|
1557
1564
|
invariant(top !== void 0, "A transaction below the top of the stack has a savepoint above it");
|
|
@@ -1640,8 +1647,8 @@ var SqlRuntimeBase = class extends RuntimeCore {
|
|
|
1640
1647
|
#transactions = /* @__PURE__ */ new WeakMap();
|
|
1641
1648
|
#startingTransactions = /* @__PURE__ */ new WeakSet();
|
|
1642
1649
|
#transactionRuntime = {
|
|
1643
|
-
route: (driverTx,
|
|
1644
|
-
transaction:
|
|
1650
|
+
route: (driverTx, transaction) => this.queryableRoute(driverTx, "transaction", () => transaction.activity, {
|
|
1651
|
+
transaction: savepointOn(transaction),
|
|
1645
1652
|
runtimeWork: false
|
|
1646
1653
|
}),
|
|
1647
1654
|
startActivity: (route, activity) => this.startActivityOnRoute(route, activity, void 0),
|
|
@@ -1874,9 +1881,9 @@ var SqlRuntimeBase = class extends RuntimeCore {
|
|
|
1874
1881
|
}
|
|
1875
1882
|
/** The activity route of a held connection that `owner` wraps: its statements run on `connection`, and its transactions begin there. */
|
|
1876
1883
|
connectionRoute(connection, owner) {
|
|
1877
|
-
const openTransaction = this.#transactions.get(connection)
|
|
1878
|
-
return this.queryableRoute(connection, "connection", () => openTransaction, {
|
|
1879
|
-
transaction: openTransaction === void 0 ? (parent, fn, options) => this.transactionOnHeldConnection(connection, owner, parent, fn, options) :
|
|
1884
|
+
const openTransaction = this.#transactions.get(connection);
|
|
1885
|
+
return this.queryableRoute(connection, "connection", () => openTransaction?.activity, {
|
|
1886
|
+
transaction: openTransaction === void 0 ? (parent, fn, options) => this.transactionOnHeldConnection(connection, owner, parent, fn, options) : savepointOn(openTransaction),
|
|
1880
1887
|
runtimeWork: false
|
|
1881
1888
|
});
|
|
1882
1889
|
}
|
|
@@ -1919,7 +1926,7 @@ var SqlRuntimeBase = class extends RuntimeCore {
|
|
|
1919
1926
|
},
|
|
1920
1927
|
planContentHash: (plan) => this.planContentHashFor(plan, route.scope, run)
|
|
1921
1928
|
};
|
|
1922
|
-
|
|
1929
|
+
return {
|
|
1923
1930
|
[activitySource]: source,
|
|
1924
1931
|
startActivity: source.startActivity,
|
|
1925
1932
|
planContentHash: source.planContentHash,
|
|
@@ -1941,6 +1948,11 @@ var SqlRuntimeBase = class extends RuntimeCore {
|
|
|
1941
1948
|
run.assertAcceptsChildren();
|
|
1942
1949
|
return route.preparedExecute(blindCast(ps), params, beneath(options));
|
|
1943
1950
|
},
|
|
1951
|
+
inTransaction: () => run.ctx.inTransaction(),
|
|
1952
|
+
async transaction(fn, options) {
|
|
1953
|
+
run.assertAcceptsChildren();
|
|
1954
|
+
return route.transaction(run, fn, options);
|
|
1955
|
+
},
|
|
1944
1956
|
end(end) {
|
|
1945
1957
|
let ending;
|
|
1946
1958
|
try {
|
|
@@ -1955,12 +1967,6 @@ var SqlRuntimeBase = class extends RuntimeCore {
|
|
|
1955
1967
|
});
|
|
1956
1968
|
}
|
|
1957
1969
|
};
|
|
1958
|
-
const transaction = route.transaction;
|
|
1959
|
-
if (transaction === void 0) return handle;
|
|
1960
|
-
return Object.assign(handle, { transaction: async (fn, options) => {
|
|
1961
|
-
run.assertAcceptsChildren();
|
|
1962
|
-
return transaction(run, fn, options);
|
|
1963
|
-
} });
|
|
1964
1970
|
}
|
|
1965
1971
|
/**
|
|
1966
1972
|
* Returns a raw driver connection. SQL issued on it runs below the middleware/codec/telemetry pipeline. It carries its own lifecycle (`release`/`destroy`/`beginTransaction`); the caller owns disposal. It follows the runtime's close rule for connections: see {@link Runtime.close}. Pass the `activityParent` of the activity it is acquired for, so it is admitted after `close()` while that activity is open.
|
|
@@ -2602,8 +2608,14 @@ async function runTransactionOn(connection, fn, options, state) {
|
|
|
2602
2608
|
throw error;
|
|
2603
2609
|
}
|
|
2604
2610
|
}
|
|
2605
|
-
|
|
2606
|
-
|
|
2611
|
+
function savepointOn(transaction) {
|
|
2612
|
+
return async (parent, fn, options) => {
|
|
2613
|
+
if (options !== void 0) throw savepointOptionsUnsupportedError(options);
|
|
2614
|
+
return runInSavepoint(() => transaction.transactionBeneath(parent), fn);
|
|
2615
|
+
};
|
|
2616
|
+
}
|
|
2617
|
+
async function runInSavepoint(open, fn) {
|
|
2618
|
+
const savepoint = await open();
|
|
2607
2619
|
try {
|
|
2608
2620
|
return await runAndSettleTransaction(savepoint, fn);
|
|
2609
2621
|
} catch (error) {
|
|
@@ -2659,6 +2671,11 @@ function guardedTransactionContext(transaction, isClosed) {
|
|
|
2659
2671
|
get intercepted() {
|
|
2660
2672
|
return handle.intercepted;
|
|
2661
2673
|
},
|
|
2674
|
+
inTransaction: () => handle.inTransaction(),
|
|
2675
|
+
async transaction(fn, options) {
|
|
2676
|
+
if (isClosed()) throw transactionClosedError();
|
|
2677
|
+
return handle.transaction(fn, options);
|
|
2678
|
+
},
|
|
2662
2679
|
end: (end) => handle.end(end)
|
|
2663
2680
|
};
|
|
2664
2681
|
}
|
|
@@ -2670,7 +2687,7 @@ function guardedTransactionContext(transaction, isClosed) {
|
|
|
2670
2687
|
[activitySource]: guardedSource(transaction),
|
|
2671
2688
|
async transaction(fn) {
|
|
2672
2689
|
if (isClosed()) throw transactionClosedError();
|
|
2673
|
-
return runInSavepoint(transaction, fn);
|
|
2690
|
+
return runInSavepoint(() => transaction.transaction(), fn);
|
|
2674
2691
|
}
|
|
2675
2692
|
};
|
|
2676
2693
|
}
|
|
@@ -2747,4 +2764,4 @@ function createToSql(stack, contract) {
|
|
|
2747
2764
|
//#endregion
|
|
2748
2765
|
export { validateContractCodecMappings as C, validateCodecRegistryCompleteness as S, withTransactionMembers as T, lints as _, budgets as a, startActivityOn as b, createSqlExecutionStack as c, delegatingRuntime as d, deriveParamMetadata as f, lazyActivitySource as g, findActivitySource as h, activitySource as i, createToSql as l, extractCodecIds as m, PreparedStatementImpl as n, createAstCodecRegistry as o, encodeParamsWithMetadata as p, SqlRuntimeBase as r, createExecutionContext as s, PreparedExecutionImpl as t, delegatingActivitySource as u, lowerSqlPlan as v, withTransaction as w, toRuntimeOptions as x, planContentHashOn as y };
|
|
2749
2766
|
|
|
2750
|
-
//# sourceMappingURL=exports-
|
|
2767
|
+
//# sourceMappingURL=exports-BLvDBaFs-DZPo5Hei.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"exports-BLvDBaFs-DZPo5Hei.mjs","names":["runtimeError","#count","#started","#drainWaiters","#ast","#entries","#savepoints","#invalidated","#holdFinishedChildren","#inFlight","#transactions","#heldQueryables","#transactionWorkOn","#runtimeRoute","#startingTransactions","#openActivityHandles","#refusing","#openTransactionWork","#preparedStatementHandles","#transactionRuntime","#run","#rows","#done","#inner"],"sources":["../../../../2-sql-family/5-runtime/dist/exports-BLvDBaFs.mjs"],"sourcesContent":["import { a as wasRefusedBeforeBegin, c as preparedStatementExecute, i as transactionStart, l as runPreparedExecute, n as settlementOf, o as preparedStatementQuery, r as transactionSettlement, s as runPreparedQuery, t as createTransactionStart } from \"./transaction-state-BfXhs7D7.mjs\";\nimport { invariant } from \"@internal/utils/assertions\";\nimport { materializeCodec, resolveCodecDescriptorOrThrow } from \"@internal/framework-components/codec\";\nimport { canonicalizeJson } from \"@internal/framework-components/utils\";\nimport { AsyncIterableResult, RuntimeCore, applyMutationDefaults, assertMutationDefaultGeneratorsAvailable, checkAborted, checkMiddlewareCompatibility, collectMutationDefaultGenerators, createContextBeneath, executeStatement, raceAgainstAbort, runtimeError, startClientActivity, startTransactionActivity, streamStatement } from \"@internal/framework-components/runtime\";\nimport { PreparedParamRef, collectOrderedParamRefs, isQueryAst } from \"@internal/sql-relational-core/ast\";\nimport { assertNever, isInternalError } from \"@internal/utils/internal-error\";\nimport { isStructuredError, structuredError } from \"@internal/utils/structured-error\";\nimport { ifDefined } from \"@internal/utils/defined\";\nimport { checkContractComponentRequirements, mergeCapabilityMatrices } from \"@internal/framework-components/components\";\nimport { createExecutionStack } from \"@internal/framework-components/execution\";\nimport { createSqlOperationRegistry } from \"@internal/sql-operations\";\nimport { buildSqlAggregateDescriptorRegistry } from \"@internal/sql-relational-core/aggregate-descriptor-registry\";\nimport { buildCodecDescriptorRegistry } from \"@internal/sql-relational-core/codec-descriptor-registry\";\nimport { blindCast, castAs } from \"@internal/utils/casts\";\nimport { createSqlParamRefMutator } from \"@internal/sql-relational-core/middleware\";\nimport { canonicalStringify } from \"@internal/utils/canonical-stringify\";\nimport { hashContent } from \"@internal/utils/hash-content\";\nimport { createHash } from \"node:crypto\";\n//#region src/activity-handle.ts\n/** The symbol-keyed member through which a runtime, connection, transaction, `withTransaction` context or activity handle starts activities; user-facing types do not show it. */\nconst activitySource = Symbol(\"activitySource\");\nfunction hasActivitySourceMember(target) {\n\treturn activitySource in target;\n}\n/** The `activitySource` member of a queryable; `undefined` for a queryable that cannot start activities, such as a test stub. */\nfunction findActivitySource(target) {\n\treturn hasActivitySourceMember(target) ? target[activitySource] : void 0;\n}\nfunction activitySourceOf(target) {\n\tconst source = findActivitySource(target);\n\tinvariant(source !== void 0, \"The queryable cannot start activities\");\n\treturn source;\n}\n/** An activity source that calls `source()` each time it is used, for an object whose source is created later, such as on the first query. */\nfunction lazyActivitySource(source) {\n\treturn {\n\t\tstartActivity: async (activity) => source().startActivity(activity),\n\t\tplanContentHash: async (plan) => source().planContentHash(plan)\n\t};\n}\n/** An activity source that starts activities on whatever queryable `target()` returns when called, for an object that sends its statements to a queryable it looks up each time. */\nfunction delegatingActivitySource(target) {\n\treturn lazyActivitySource(() => activitySourceOf(target()));\n}\n/** Starts an activity on a queryable through its `activitySource` member. */\nfunction startActivityOn(target, activity) {\n\treturn activitySourceOf(target).startActivity(activity);\n}\nfunction planContentHashOn(target, plan) {\n\treturn activitySourceOf(target).planContentHash(plan);\n}\n//#endregion\n//#region src/codecs/ast-codec-resolver.ts\n/**\n* Build an {@link AstCodecResolver} bound to a descriptor registry and a per-call instance-context factory.\n*\n* The instance-context factory lets callers control `name` / `usedAt` for refs the AST supplies (e.g. AST-embedded migration ops where the materialisation site is the AST node, not a contract column). The contract-walk pre-population path constructs its own contexts and invokes the resolver with those refs to seed the cache.\n*/\nfunction createAstCodecResolver(descriptors, instanceContextFor) {\n\tconst cache = /* @__PURE__ */ new Map();\n\treturn { forCodecRef(ref) {\n\t\tconst key = `${ref.codecId}:${canonicalizeJson(ref.typeParams)}`;\n\t\tconst cached = cache.get(key);\n\t\tif (cached) return cached;\n\t\tconst codec = materializeCodec(resolveCodecDescriptorOrThrow((id) => descriptors.descriptorFor(id), ref, \"RUNTIME.CODEC_DESCRIPTOR_MISSING\"), ref, instanceContextFor(ref));\n\t\tcache.set(key, codec);\n\t\treturn codec;\n\t} };\n}\n//#endregion\n//#region src/codecs/ast-codec-registry.ts\n/**\n* Build a contract-free {@link ContractCodecRegistry} that resolves codecs\n* purely from AST-supplied {@link import('@internal/framework-components/codec').CodecRef}s\n* against a target's descriptor registry.\n*\n* Dispatch is driven entirely by `CodecRef`s embedded in AST nodes; no\n* contract walk is needed. `forColumn` always returns `undefined` — this\n* registry carries no column-to-codec mappings.\n*/\nfunction createAstCodecRegistry(descriptors) {\n\tconst resolver = createAstCodecResolver(descriptors, (ref) => ({\n\t\tname: ref.codecId,\n\t\tusedAt: []\n\t}));\n\treturn {\n\t\tforColumn: () => void 0,\n\t\tforCodecRef: (ref) => resolver.forCodecRef(ref)\n\t};\n}\n//#endregion\n//#region src/codecs/encoding.ts\nconst NO_METADATA = Object.freeze({\n\tcodec: void 0,\n\tname: void 0\n});\nfunction deriveParamMetadata(ast) {\n\treturn collectOrderedParamRefs(ast).map((ref) => {\n\t\treturn {\n\t\t\tcodec: ref.codec,\n\t\t\tname: ref.name\n\t\t};\n\t});\n}\nfunction resolveParamCodec(metadata, contractCodecs) {\n\tif (metadata.codec && contractCodecs) return contractCodecs.forCodecRef(metadata.codec);\n}\nfunction paramLabel(metadata, paramIndex) {\n\treturn metadata.name ?? `param[${paramIndex}]`;\n}\nfunction wrapEncodeFailure(error, metadata, paramIndex, codecId) {\n\tif (isInternalError(error)) throw error;\n\tconst label = paramLabel(metadata, paramIndex);\n\tconst wrapped = runtimeError(\"RUNTIME.ENCODE_FAILED\", `Failed to encode parameter ${label} with codec '${codecId}': ${error instanceof Error ? error.message : String(error)}`, {\n\t\tlabel,\n\t\tcodec: codecId,\n\t\tparamIndex\n\t});\n\twrapped.cause = error;\n\tthrow wrapped;\n}\nasync function encodeParamValue(value, metadata, paramIndex, ctx, contractCodecs) {\n\tif (value === null || value === void 0) return null;\n\tconst codec = resolveParamCodec(metadata, contractCodecs);\n\tif (!codec) return value;\n\tif (metadata.codec?.many) {\n\t\tif (!Array.isArray(value)) wrapEncodeFailure(/* @__PURE__ */ new TypeError(`expected an array for many-typed parameter, got ${typeof value}`), metadata, paramIndex, codec.id);\n\t\tconst encoded = [];\n\t\tfor (let i = 0; i < value.length; i++) {\n\t\t\tconst elem = value[i];\n\t\t\tif (elem === null || elem === void 0) {\n\t\t\t\tencoded.push(null);\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\ttry {\n\t\t\t\tencoded.push(await codec.toWire(elem, ctx));\n\t\t\t} catch (error) {\n\t\t\t\tif (isStructuredError(error)) throw error;\n\t\t\t\twrapEncodeFailure(error, metadata, paramIndex, codec.id);\n\t\t\t}\n\t\t}\n\t\treturn encoded;\n\t}\n\ttry {\n\t\treturn await codec.toWire(value, ctx);\n\t} catch (error) {\n\t\tif (isStructuredError(error)) throw error;\n\t\twrapEncodeFailure(error, metadata, paramIndex, codec.id);\n\t}\n}\n/**\n* Encodes all parameters concurrently via `Promise.all`. Per parameter, sync-and async-authored codecs share the same path: `codec.encode → await → return`. Param-level failures are wrapped in `RUNTIME.ENCODE_FAILED`.\n*\n* When `ctx.signal` is provided:\n*\n* - **Already-aborted at entry** short-circuits with `RUNTIME.ABORTED` (`{ phase: 'encode' }`) before any `codec.encode` call is made — codecs can pin this with a per-call counter that stays at zero.\n* - **Mid-flight abort** races the per-param `Promise.all` against `abortable(ctx.signal)`. The runtime returns `RUNTIME.ABORTED` promptly even if codec bodies ignore the signal; the in-flight bodies are abandoned and run to completion in the background (cooperative cancellation, see ADR 204).\n* - Existing structured envelopes (any dotted-code error passing `isStructuredError`, e.g. `RUNTIME.ENCODE_FAILED`) that surface from a codec body before the runtime observes the abort pass through unchanged (no double wrap).\n*/\nasync function encodeParams(plan, ctx, contractCodecs) {\n\treturn encodeParamsWithMetadata(plan.params, deriveParamMetadata(plan.ast), ctx, contractCodecs);\n}\nasync function encodeParamsWithMetadata(values, metadata, ctx, contractCodecs) {\n\tcheckAborted(ctx, \"encode\");\n\tconst signal = ctx.signal;\n\tif (values.length === 0) return values;\n\tconst tasks = values.map((value, i) => encodeParamValue(value, metadata[i] ?? NO_METADATA, i, ctx, contractCodecs));\n\tconst settled = await raceAgainstAbort(Promise.all(tasks), signal, \"encode\");\n\treturn Object.freeze(settled);\n}\n//#endregion\n//#region src/codecs/validation.ts\nfunction extractCodecIds(contract) {\n\tconst codecIds = /* @__PURE__ */ new Set();\n\tfor (const ns of Object.values(contract.storage.namespaces)) for (const table of Object.values(ns.entries.table ?? {})) for (const column of Object.values(table.columns)) {\n\t\tconst codecId = column.codecId;\n\t\tcodecIds.add(codecId);\n\t}\n\treturn codecIds;\n}\nfunction extractColumnCodecRefs(contract) {\n\tconst refs = [];\n\tfor (const [namespaceId, ns] of Object.entries(contract.storage.namespaces)) for (const [tableName, table] of Object.entries(ns.entries.table ?? {})) for (const [columnName, column] of Object.entries(table.columns)) refs.push({\n\t\tnamespaceId,\n\t\ttable: tableName,\n\t\tcolumn: columnName,\n\t\tcodecId: column.codecId\n\t});\n\treturn refs;\n}\nfunction validateContractCodecMappings(registry, contract) {\n\tconst invalidCodecs = extractColumnCodecRefs(contract).filter((ref) => registry.descriptorFor(ref.codecId) === void 0);\n\tif (invalidCodecs.length > 0) {\n\t\tconst details = {\n\t\t\tcontractTarget: contract.target,\n\t\t\tinvalidCodecs\n\t\t};\n\t\tthrow runtimeError(\"RUNTIME.CODEC_MISSING\", `Missing codec implementations for column codecIds: ${invalidCodecs.map((c) => `${c.namespaceId}.${c.table}.${c.column} (${c.codecId})`).join(\", \")}`, details);\n\t}\n}\nfunction validateCodecRegistryCompleteness(registry, contract) {\n\tvalidateContractCodecMappings(registry, contract);\n}\n//#endregion\n//#region src/delegating-runtime.ts\n/**\n* Members that look up the runtime with `getRuntime()` when they are called. When the lookup throws, for example because the client is closed, the member reports the error through what it returns: a result rejects when it is read, and a promise rejects.\n*/\nfunction delegatingRuntime(getRuntime) {\n\treturn {\n\t\tquery(plan, options) {\n\t\t\tlet runtime;\n\t\t\ttry {\n\t\t\t\truntime = getRuntime();\n\t\t\t} catch (error) {\n\t\t\t\treturn AsyncIterableResult.rejected(error);\n\t\t\t}\n\t\t\treturn runtime.query(plan, options);\n\t\t},\n\t\tasync execute(plan, options) {\n\t\t\treturn getRuntime().execute(plan, options);\n\t\t},\n\t\tasync connection() {\n\t\t\treturn getRuntime().connection();\n\t\t},\n\t\tasync prepare(declaration, callback) {\n\t\t\treturn getRuntime().prepare(declaration, callback);\n\t\t},\n\t\t[activitySource]: delegatingActivitySource(getRuntime)\n\t};\n}\n//#endregion\n//#region src/execution-options.ts\nfunction toRuntimeOptions(options) {\n\tconst copies = {\n\t\tverifyMarker: ifDefined(\"verifyMarker\", options.verifyMarker),\n\t\tmiddleware: ifDefined(\"middleware\", options.middleware),\n\t\tlog: ifDefined(\"log\", options.log),\n\t\tmode: ifDefined(\"mode\", options.mode)\n\t};\n\treturn Object.values(copies).reduce((merged, copy) => Object.assign(merged, copy), {});\n}\n//#endregion\n//#region src/lower-sql-plan.ts\n/**\n* Lowers a SQL query plan to an executable Plan by calling the adapter's lower method.\n*\n* Ad-hoc lowerings produce only `{kind: 'literal'}` slots; this helper\n* unwraps them into the bare-value array `SqlExecutionPlan` exposes.\n* Encountering a `{kind: 'bind'}` slot here means the caller passed an\n* AST containing `PreparedParamRef` to the ad-hoc execute path — that's a\n* caller error, surfaced as `RUNTIME.PREPARE_BIND_ON_ADHOC`.\n*/\nfunction lowerSqlPlan(adapter, contract, queryPlan) {\n\tconst lowered = adapter.lower(queryPlan.ast, {\n\t\tcontract,\n\t\tparams: queryPlan.params\n\t});\n\tconst params = lowered.params.map((slot) => {\n\t\tif (slot.kind === \"literal\") return slot.value;\n\t\tthrow runtimeError(\"RUNTIME.PREPARE_BIND_ON_ADHOC\", `The plan has a bind site for '${slot.name}'. A plan built inside prepare(...) runs only as a prepared statement.`, { name: slot.name });\n\t});\n\treturn Object.freeze({\n\t\tsql: lowered.sql,\n\t\tparams,\n\t\tast: queryPlan.ast,\n\t\tmeta: queryPlan.meta\n\t});\n}\n//#endregion\n//#region src/middleware/budgets.ts\nfunction hasAggregateWithoutGroupBy(ast) {\n\tif (ast.groupBy !== void 0) return false;\n\treturn ast.projection.some((item) => item.expr.kind === \"aggregate\");\n}\nfunction primaryTableFromAst(ast) {\n\tif (ast.from === void 0) return void 0;\n\tswitch (ast.from.kind) {\n\t\tcase \"table-source\": return ast.from.name;\n\t\tcase \"derived-table-source\": return ast.from.alias;\n\t\tcase \"function-source\": return ast.from.fn;\n\t\t// v8 ignore next 4\n\t\tdefault: return assertNever(ast.from, `Unsupported source kind: ${ast.from.kind}`);\n\t}\n}\nfunction estimateRowsFromAst(ast, tableRows, defaultTableRows, hasAggregateWithoutGroup) {\n\tif (hasAggregateWithoutGroup) return 1;\n\tconst primaryTable = primaryTableFromAst(ast);\n\tconst tableEstimate = (primaryTable !== void 0 ? tableRows[primaryTable] : void 0) ?? defaultTableRows;\n\tif (typeof ast.limit === \"number\") return Math.min(ast.limit, tableEstimate);\n\treturn tableEstimate;\n}\nfunction emitBudgetViolation(error, shouldBlock, ctx) {\n\tif (shouldBlock) throw error;\n\tctx.log.warn({\n\t\tcode: error.code,\n\t\tmessage: error.message,\n\t\tdetails: error.details\n\t});\n}\nconst observedRows = Symbol(\"budgets.observedRows\");\nfunction budgets(options) {\n\tconst maxRows = options?.maxRows ?? 1e4;\n\tconst defaultTableRows = options?.defaultTableRows ?? 1e4;\n\tconst tableRows = options?.tableRows ?? {};\n\tconst maxLatencyMs = options?.maxLatencyMs ?? 1e3;\n\tconst rowSeverity = options?.severities?.rowCount ?? \"error\";\n\tconst latencySeverity = options?.severities?.latency ?? \"warn\";\n\treturn Object.freeze({\n\t\tname: \"budgets\",\n\t\tfamilyId: \"sql\",\n\t\tasync beforeEncode(plan, ctx) {\n\t\t\tif (isQueryAst(plan.ast) && plan.ast.kind === \"select\") evaluateSelectAst(plan.ast, ctx);\n\t\t},\n\t\tasync onRow(_row, _plan, ctx) {\n\t\t\tconst observed = ctx.state(observedRows);\n\t\t\tconst count = (typeof observed[\"count\"] === \"number\" ? observed[\"count\"] : 0) + 1;\n\t\t\tobserved[\"count\"] = count;\n\t\t\tif (count <= maxRows || observed[\"warned\"] === true) return;\n\t\t\tconst shouldBlock = rowSeverity === \"error\" || ctx.mode === \"strict\";\n\t\t\tif (!shouldBlock) observed[\"warned\"] = true;\n\t\t\temitBudgetViolation(runtimeError(\"BUDGET.ROWS_EXCEEDED\", \"Observed row count exceeds budget\", {\n\t\t\t\tsource: \"observed\",\n\t\t\t\tobservedRows: count,\n\t\t\t\tmaxRows\n\t\t\t}), shouldBlock, ctx);\n\t\t},\n\t\tasync activityEnded(_activity, result, ctx) {\n\t\t\tif (result.kind === \"statement\") checkLatency(result.latencyMs, ctx);\n\t\t}\n\t});\n\tfunction checkLatency(latencyMs, ctx) {\n\t\tif (latencyMs > maxLatencyMs) {\n\t\t\tconst shouldBlock = latencySeverity === \"error\" || ctx.mode === \"strict\";\n\t\t\temitBudgetViolation(runtimeError(\"BUDGET.TIME_EXCEEDED\", \"Query latency exceeds budget\", {\n\t\t\t\tlatencyMs,\n\t\t\t\tmaxLatencyMs\n\t\t\t}), shouldBlock, ctx);\n\t\t}\n\t}\n\tfunction evaluateSelectAst(ast, ctx) {\n\t\tconst hasAggNoGroup = hasAggregateWithoutGroupBy(ast);\n\t\tconst estimated = estimateRowsFromAst(ast, tableRows, defaultTableRows, hasAggNoGroup);\n\t\tconst isUnbounded = ast.limit === void 0 && !hasAggNoGroup;\n\t\tconst shouldBlock = rowSeverity === \"error\" || ctx.mode === \"strict\";\n\t\tif (isUnbounded) {\n\t\t\temitBudgetViolation(runtimeError(\"BUDGET.ROWS_EXCEEDED\", \"Unbounded SELECT query exceeds budget\", estimated >= maxRows ? {\n\t\t\t\tsource: \"ast\",\n\t\t\t\testimatedRows: estimated,\n\t\t\t\tmaxRows\n\t\t\t} : {\n\t\t\t\tsource: \"ast\",\n\t\t\t\tmaxRows\n\t\t\t}), shouldBlock, ctx);\n\t\t\treturn;\n\t\t}\n\t\tif (estimated > maxRows) emitBudgetViolation(runtimeError(\"BUDGET.ROWS_EXCEEDED\", \"Estimated row count exceeds budget\", {\n\t\t\tsource: \"ast\",\n\t\t\testimatedRows: estimated,\n\t\t\tmaxRows\n\t\t}), shouldBlock, ctx);\n\t}\n}\n//#endregion\n//#region src/guardrails/raw.ts\nconst SELECT_STAR_REGEX = /select\\s+\\*/i;\nconst LIMIT_REGEX = /\\blimit\\b/i;\nconst MUTATION_PREFIX_REGEX = /^(insert|update|delete|create|alter|drop|truncate)\\b/i;\nconst READ_ONLY_INTENTS = /* @__PURE__ */ new Set([\n\t\"read\",\n\t\"report\",\n\t\"readonly\"\n]);\nfunction evaluateRawGuardrails(plan, config) {\n\tconst lints = [];\n\tconst budgets = [];\n\tconst normalized = normalizeWhitespace(plan.sql);\n\tconst statementType = classifyStatement(normalized);\n\tif (statementType === \"select\") {\n\t\tif (SELECT_STAR_REGEX.test(normalized)) lints.push(createLint(\"LINT.SELECT_STAR\", \"error\", \"Raw SQL plan selects all columns via *\", { sql: snippet(plan.sql) }));\n\t\tif (!LIMIT_REGEX.test(normalized)) {\n\t\t\tconst severity = config?.budgets?.unboundedSelectSeverity ?? \"error\";\n\t\t\tlints.push(createLint(\"LINT.NO_LIMIT\", \"warn\", \"Raw SQL plan omits LIMIT clause\", { sql: snippet(plan.sql) }));\n\t\t\tbudgets.push(createBudget(\"BUDGET.ROWS_EXCEEDED\", severity, \"Raw SQL plan is unbounded and may exceed row budget\", {\n\t\t\t\tsql: snippet(plan.sql),\n\t\t\t\t...config?.budgets?.estimatedRows !== void 0 ? { estimatedRows: config.budgets.estimatedRows } : {}\n\t\t\t}));\n\t\t}\n\t}\n\tif (isMutationStatement(statementType) && isReadOnlyIntent(plan.meta)) lints.push(createLint(\"LINT.READ_ONLY_MUTATION\", \"error\", \"Raw SQL plan mutates data despite read-only intent\", {\n\t\tsql: snippet(plan.sql),\n\t\tintent: plan.meta.annotations?.[\"intent\"]\n\t}));\n\treturn {\n\t\tlints,\n\t\tbudgets,\n\t\tstatement: statementType\n\t};\n}\nfunction classifyStatement(sql) {\n\tconst trimmed = sql.trim();\n\tconst lower = trimmed.toLowerCase();\n\tif (lower.startsWith(\"with\")) {\n\t\tif (lower.includes(\"select\")) return \"select\";\n\t}\n\tif (lower.startsWith(\"select\")) return \"select\";\n\tif (MUTATION_PREFIX_REGEX.test(trimmed)) return \"mutation\";\n\treturn \"other\";\n}\nfunction isMutationStatement(statement) {\n\treturn statement === \"mutation\";\n}\nfunction isReadOnlyIntent(meta) {\n\tconst annotations = meta.annotations;\n\tconst intent = typeof annotations?.intent === \"string\" ? annotations.intent.toLowerCase() : void 0;\n\treturn intent !== void 0 && READ_ONLY_INTENTS.has(intent);\n}\nfunction normalizeWhitespace(value) {\n\treturn value.replace(/\\s+/g, \" \").trim();\n}\nfunction snippet(sql) {\n\treturn normalizeWhitespace(sql).slice(0, 200);\n}\nfunction createLint(code, severity, message, details) {\n\treturn {\n\t\tcode,\n\t\tseverity,\n\t\tmessage,\n\t\t...details ? { details } : {}\n\t};\n}\nfunction createBudget(code, severity, message, details) {\n\treturn {\n\t\tcode,\n\t\tseverity,\n\t\tmessage,\n\t\t...details ? { details } : {}\n\t};\n}\n//#endregion\n//#region src/middleware/lints.ts\nfunction getFromSourceTableDetail(source) {\n\tswitch (source.kind) {\n\t\tcase \"table-source\": return source.name;\n\t\tcase \"derived-table-source\": return source.alias;\n\t\tcase \"function-source\": return source.fn;\n\t\t// v8 ignore next 4\n\t\tdefault: return assertNever(source, `Unsupported source kind: ${source.kind}`);\n\t}\n}\nfunction evaluateAstLints(ast) {\n\tconst findings = [];\n\tswitch (ast.kind) {\n\t\tcase \"delete\":\n\t\t\tif (ast.where === void 0) findings.push({\n\t\t\t\tcode: \"LINT.DELETE_WITHOUT_WHERE\",\n\t\t\t\tseverity: \"error\",\n\t\t\t\tmessage: \"DELETE without WHERE clause blocks execution to prevent accidental full-table deletion\",\n\t\t\t\tdetails: { table: ast.table.name }\n\t\t\t});\n\t\t\tbreak;\n\t\tcase \"update\":\n\t\t\tif (ast.where === void 0) findings.push({\n\t\t\t\tcode: \"LINT.UPDATE_WITHOUT_WHERE\",\n\t\t\t\tseverity: \"error\",\n\t\t\t\tmessage: \"UPDATE without WHERE clause blocks execution to prevent accidental full-table update\",\n\t\t\t\tdetails: { table: ast.table.name }\n\t\t\t});\n\t\t\tbreak;\n\t\tcase \"select\":\n\t\t\tif (ast.limit === void 0) {\n\t\t\t\tconst table = ast.from !== void 0 ? getFromSourceTableDetail(ast.from) : void 0;\n\t\t\t\tfindings.push({\n\t\t\t\t\tcode: \"LINT.NO_LIMIT\",\n\t\t\t\t\tseverity: \"warn\",\n\t\t\t\t\tmessage: \"Unbounded SELECT may return large result sets\",\n\t\t\t\t\t...ifDefined(\"details\", table !== void 0 ? { table } : void 0)\n\t\t\t\t});\n\t\t\t}\n\t\t\tif (ast.selectAllIntent !== void 0) {\n\t\t\t\tconst table = ast.selectAllIntent.table;\n\t\t\t\tfindings.push({\n\t\t\t\t\tcode: \"LINT.SELECT_STAR\",\n\t\t\t\t\tseverity: \"warn\",\n\t\t\t\t\tmessage: \"Query selects all columns via selectAll intent\",\n\t\t\t\t\t...ifDefined(\"details\", table !== void 0 ? { table } : void 0)\n\t\t\t\t});\n\t\t\t}\n\t\t\tbreak;\n\t\tcase \"insert\": break;\n\t\tcase \"raw-query\": break;\n\t\t// v8 ignore next 2\n\t\tdefault: assertNever(ast, `Unsupported AST kind: ${ast.kind}`);\n\t}\n\treturn findings;\n}\nfunction getConfiguredSeverity(code, options) {\n\tconst severities = options?.severities;\n\tif (!severities) return void 0;\n\tswitch (code) {\n\t\tcase \"LINT.SELECT_STAR\": return severities.selectStar;\n\t\tcase \"LINT.NO_LIMIT\": return severities.noLimit;\n\t\tcase \"LINT.DELETE_WITHOUT_WHERE\": return severities.deleteWithoutWhere;\n\t\tcase \"LINT.UPDATE_WITHOUT_WHERE\": return severities.updateWithoutWhere;\n\t\tcase \"LINT.READ_ONLY_MUTATION\": return severities.readOnlyMutation;\n\t\tdefault: return;\n\t}\n}\n/**\n* AST-first lint middleware for SQL plans. When `plan.ast` is a SQL QueryAst, inspects\n* the AST structurally. When `plan.ast` is missing, falls back to raw heuristic\n* guardrails or skips linting depending on `fallbackWhenAstMissing`.\n*\n* Rules (AST-based):\n* - DELETE without WHERE: blocks execution (configurable severity, default error)\n* - UPDATE without WHERE: blocks execution (configurable severity, default error)\n* - Unbounded SELECT: warn/error (severity from noLimit)\n* - SELECT * intent: warn/error (severity from selectStar)\n*\n* Fallback: When ast is missing, `fallbackWhenAstMissing: 'raw'` uses heuristic\n* SQL parsing; `'skip'` skips all lints. Default is `'raw'`.\n*/\nfunction lints(options) {\n\tconst fallback = options?.fallbackWhenAstMissing ?? \"raw\";\n\tconst beforeOperation = async (plan, ctx) => {\n\t\tconst findings = [];\n\t\tif (isQueryAst(plan.ast)) {\n\t\t\tfindings.push(...evaluateAstLints(plan.ast));\n\t\t\tif (plan.ast.kind === \"raw-query\") findings.push(...evaluateRawGuardrails(plan).lints);\n\t\t} else if (fallback !== \"skip\") findings.push(...evaluateRawGuardrails(plan).lints);\n\t\tfor (const lint of findings) {\n\t\t\tconst effectiveSeverity = getConfiguredSeverity(lint.code, options) ?? lint.severity;\n\t\t\tif (effectiveSeverity === \"error\") throw runtimeError(lint.code, lint.message, lint.details);\n\t\t\tif (effectiveSeverity === \"warn\") ctx.log.warn({\n\t\t\t\tcode: lint.code,\n\t\t\t\tmessage: lint.message,\n\t\t\t\tdetails: lint.details\n\t\t\t});\n\t\t}\n\t};\n\treturn Object.freeze({\n\t\tname: \"lints\",\n\t\tfamilyId: \"sql\",\n\t\tbeforeEncode: beforeOperation\n\t});\n}\n//#endregion\n//#region src/prepared/prepared-statement.ts\nvar PreparedStatementImpl = class {\n\tsql;\n\tast;\n\tmeta;\n\tslots;\n\tdecodeContext;\n\tparamMetadata;\n\tconstructor(internals) {\n\t\tthis.sql = internals.sql;\n\t\tthis.ast = internals.ast;\n\t\tthis.meta = internals.meta;\n\t\tthis.slots = internals.slots;\n\t\tthis.decodeContext = internals.decodeContext;\n\t\tthis.paramMetadata = internals.paramMetadata;\n\t\tObject.freeze(this);\n\t}\n\tquery(target, params, options) {\n\t\treturn runPreparedQuery(target, this, params, options);\n\t}\n};\n/**\n* The statistics-reporting sibling of {@link PreparedStatementImpl}. A plan\n* declaring an affected-row count prepares into one of these, which carries\n* the same lowered statement and bind slots and is consumed by executing it.\n*\n* The two classes are separate so the consumption a plan did not declare is\n* absent from the value, not merely from its type.\n*/\nvar PreparedExecutionImpl = class {\n\tsql;\n\tast;\n\tmeta;\n\tslots;\n\tdecodeContext;\n\tparamMetadata;\n\tconstructor(internals) {\n\t\tthis.sql = internals.sql;\n\t\tthis.ast = internals.ast;\n\t\tthis.meta = internals.meta;\n\t\tthis.slots = internals.slots;\n\t\tthis.decodeContext = internals.decodeContext;\n\t\tthis.paramMetadata = internals.paramMetadata;\n\t\tObject.freeze(this);\n\t}\n\texecute(target, params, options) {\n\t\treturn runPreparedExecute(target, this, params, options);\n\t}\n};\n//#endregion\n//#region src/sql-context.ts\nfunction createSqlExecutionStack(options) {\n\tconst stack = createExecutionStack({\n\t\ttarget: options.target,\n\t\tadapter: options.adapter,\n\t\tdriver: options.driver,\n\t\textensions: options.extensions\n\t});\n\tconst { driver } = stack;\n\treturn driver === void 0 ? stack : {\n\t\t...stack,\n\t\tdriver\n\t};\n}\nfunction assertExecutionStackContractRequirements(contract, stack) {\n\tconst providedComponentIds = /* @__PURE__ */ new Set([\n\t\tstack.target.id,\n\t\tstack.adapter.id,\n\t\t...stack.extensions.map((pack) => pack.id)\n\t]);\n\tconst result = checkContractComponentRequirements({\n\t\tcontract,\n\t\texpectedTargetFamily: \"sql\",\n\t\texpectedTargetId: stack.target.targetId,\n\t\tprovidedComponentIds\n\t});\n\tif (result.familyMismatch) throw runtimeError(\"RUNTIME.CONTRACT_FAMILY_MISMATCH\", `Contract target family '${result.familyMismatch.actual}' does not match runtime family '${result.familyMismatch.expected}'.`, {\n\t\tactual: result.familyMismatch.actual,\n\t\texpected: result.familyMismatch.expected\n\t});\n\tif (result.targetMismatch) throw runtimeError(\"RUNTIME.CONTRACT_TARGET_MISMATCH\", `Contract target '${result.targetMismatch.actual}' does not match runtime target descriptor '${result.targetMismatch.expected}'.`, {\n\t\tactual: result.targetMismatch.actual,\n\t\texpected: result.targetMismatch.expected\n\t});\n\tif (result.missingExtensionPackIds.length > 0) {\n\t\tconst packIds = result.missingExtensionPackIds;\n\t\tthrow runtimeError(\"RUNTIME.MISSING_EXTENSION_PACK\", `Contract requires extension pack(s) ${packIds.map((id) => `'${id}'`).join(\", \")}, but runtime descriptors do not provide matching component(s).`, { packIds });\n\t}\n}\nfunction validateTypeParams(typeParams, descriptor, context) {\n\tconst result = descriptor.paramsSchema[\"~standard\"].validate(typeParams);\n\tif (result instanceof Promise) throw runtimeError(\"RUNTIME.TYPE_PARAMS_INVALID\", `paramsSchema for codec '${descriptor.codecId}' returned a Promise; runtime validation requires a synchronous Standard Schema validator.`, {\n\t\t...context,\n\t\tcodecId: descriptor.codecId,\n\t\ttypeParams\n\t});\n\tif (result.issues) {\n\t\tconst messages = result.issues.map((issue) => issue.message).join(\"; \");\n\t\tthrow runtimeError(\"RUNTIME.TYPE_PARAMS_INVALID\", `Invalid typeParams for column '${context.tableName}.${context.columnName}' (codecId: ${descriptor.codecId}): ${messages}`, {\n\t\t\t...context,\n\t\t\tcodecId: descriptor.codecId,\n\t\t\ttypeParams\n\t\t});\n\t}\n\treturn blindCast(result.value);\n}\n/**\n* Collect every {@link CodecDescriptor} contributed by the SQL stack and partition into \"parameterized\" vs \"non-parameterized\" via the descriptor's own {@link CodecDescriptorImpl.isParameterized} getter: a descriptor is parameterized when it has a `paramsSchema`.\n*\n* The unified descriptor list collapses the legacy split (a separate slot used to register parameterized codecs) — every codec id resolves through the same map (codec-registry-unification spec § Decision).\n*/\nfunction collectCodecDescriptors(contributors) {\n\tconst all = [];\n\tconst parameterized = /* @__PURE__ */ new Map();\n\tconst seen = /* @__PURE__ */ new Set();\n\tfor (const contributor of contributors) for (const descriptor of contributor.codecs()) {\n\t\tif (seen.has(descriptor.codecId)) throw runtimeError(\"RUNTIME.DUPLICATE_CODEC\", `Duplicate codec descriptor for codecId '${descriptor.codecId}'.`, { codecId: descriptor.codecId });\n\t\tseen.add(descriptor.codecId);\n\t\tall.push(descriptor);\n\t\tif (descriptor.isParameterized) parameterized.set(descriptor.codecId, blindCast(descriptor));\n\t}\n\treturn {\n\t\tall,\n\t\tparameterized\n\t};\n}\n/**\n* Flatten every aggregate descriptor the SQL stack contributes. Shape validation, single-ownership of each `(operation, input)` pair, and trait-overlap resolution all happen inside {@link buildSqlAggregateDescriptorRegistry}, so contributions reach it unchecked and fail there — at composition, never mid-query.\n*/\nfunction collectAggregateDescriptorContributions(contributors) {\n\treturn contributors.flatMap((contributor) => contributor.types?.aggregateDescriptors ?? []);\n}\nfunction validateColumnTypeParams(storage, codecDescriptors) {\n\tfor (const ns of Object.values(storage.namespaces)) for (const [tableName, table] of Object.entries(ns.entries.table ?? {})) for (const [columnName, column] of Object.entries(table.columns)) if (column.typeParams) {\n\t\tconst descriptor = codecDescriptors.get(column.codecId);\n\t\tif (descriptor) validateTypeParams(column.typeParams, descriptor, {\n\t\t\ttableName,\n\t\t\tcolumnName\n\t\t});\n\t}\n}\n/**\n* Build-time contract-integrity check: every `(table, column)` resolves to a {@link CodecRef} whose `codecId` is registered and whose `typeParams` presence matches the descriptor's `isParameterized` flag.\n*\n* Surfaces three classes of malformed contract that AST-bound codec resolution would otherwise mask silently:\n*\n* - column references a codecId no contributor registered → `RUNTIME.CODEC_DESCRIPTOR_MISSING`.\n* - parameterized codec, no `typeParams` (legacy \"tolerate refs without params\" shape) → `RUNTIME.CODEC_PARAMETERIZATION_MISMATCH`.\n* - non-parameterized codec, `typeParams` supplied → `RUNTIME.CODEC_PARAMETERIZATION_MISMATCH`.\n*\n* Runs unconditionally from `createExecutionContext` so contract bugs fail fast at construction time instead of silently skipping affected columns in the codec registry's pre-population walk.\n*/\nfunction assertColumnCodecIntegrity(storage, codecDescriptors) {\n\tfor (const [namespaceId, ns] of Object.entries(storage.namespaces)) for (const [tableName, table] of Object.entries(ns.entries.table ?? {})) for (const columnName of Object.keys(table.columns)) {\n\t\tconst ref = codecDescriptors.codecRefForColumn(namespaceId, tableName, columnName);\n\t\tif (!ref) continue;\n\t\tconst descriptor = codecDescriptors.descriptorFor(ref.codecId);\n\t\tif (!descriptor) throw runtimeError(\"RUNTIME.CODEC_DESCRIPTOR_MISSING\", `Column '${tableName}.${columnName}' references codec '${ref.codecId}' but no contributor registered a codec descriptor for that codecId. Add the extension pack that owns the codec to the runtime stack.`, {\n\t\t\ttable: tableName,\n\t\t\tcolumn: columnName,\n\t\t\tcodecId: ref.codecId\n\t\t});\n\t\tconst paramsSchema = descriptor.paramsSchema;\n\t\tif (paramsSchema !== void 0 && ref.typeParams === void 0) {\n\t\t\tconst probe = paramsSchema[\"~standard\"].validate({});\n\t\t\tif (probe instanceof Promise) {\n\t\t\t\tprobe.catch(() => {});\n\t\t\t\tthrow runtimeError(\"RUNTIME.TYPE_PARAMS_INVALID\", `Column '${tableName}.${columnName}' uses parameterized codec '${ref.codecId}' whose paramsSchema returned a Promise; paramsSchema must be a synchronous Standard Schema validator. Return a value/issues result directly instead of a Promise.`, {\n\t\t\t\t\ttable: tableName,\n\t\t\t\t\tcolumn: columnName,\n\t\t\t\t\tcodecId: ref.codecId\n\t\t\t\t});\n\t\t\t}\n\t\t\tif (\"issues\" in probe && !!probe.issues) throw runtimeError(\"RUNTIME.CODEC_PARAMETERIZATION_MISMATCH\", `Column '${tableName}.${columnName}' uses parameterized codec '${ref.codecId}' but no typeParams are supplied. Provide typeParams on the column.`, {\n\t\t\t\ttable: tableName,\n\t\t\t\tcolumn: columnName,\n\t\t\t\tcodecId: ref.codecId,\n\t\t\t\texpected: \"parameterized\",\n\t\t\t\tactual: \"no typeParams\"\n\t\t\t});\n\t\t}\n\t\tconst refTypeParams = ref.typeParams;\n\t\tconst refHasTypeParamKeys = refTypeParams !== void 0 && refTypeParams !== null && typeof refTypeParams === \"object\" && !Array.isArray(refTypeParams) && Object.keys(refTypeParams).length > 0;\n\t\tif (!descriptor.isParameterized && refHasTypeParamKeys) throw runtimeError(\"RUNTIME.CODEC_PARAMETERIZATION_MISMATCH\", `Column '${tableName}.${columnName}' supplies typeParams to non-parameterized codec '${ref.codecId}'. Remove the typeParams or switch to a parameterized codec id.`, {\n\t\t\ttable: tableName,\n\t\t\tcolumn: columnName,\n\t\t\tcodecId: ref.codecId,\n\t\t\texpected: \"non-parameterized\",\n\t\t\tactual: \"has typeParams\"\n\t\t});\n\t}\n}\n/**\n* Build a {@link ContractCodecRegistry} that resolves codecs exclusively through the `forCodecRef` content-keyed cache.\n*\n* One pre-population pass walks `storage.tables[].columns[]` to seed the resolver's per-ref instance context with the *aggregated* `usedAt` set for each canonical `(codecId, typeParams)` key. The same codec materialised through `forColumn` or `forCodecRef` is therefore one instance with one `SqlCodecInstanceContext` — stateful codecs reading `usedAt` see the full column set regardless of which surface the caller used.\n*\n* Per-key instance-name policy:\n*\n* - columns with `typeParams` use `<col:Table.column>` (the first column observed at that key; additional columns sharing the key extend `usedAt`).\n* - non-parameterized codec ids use `<codec:codecId>`, aggregating every column on that codec id into one `usedAt` set.\n* - ad-hoc refs the contract walk did not pre-populate (e.g. AST-supplied refs from deserialised migration ops) fall back to the canonical cache key `${codecId}:${canonicalizeJson(typeParams)}` — the only structurally honest identity for an ad-hoc ref, distinct per `(codecId, typeParams)`.\n*\n* Contract integrity is enforced upstream by {@link assertColumnCodecIntegrity}: every column must reference a registered `codecId` whose `descriptor.isParameterized` flag matches the presence of `typeParams` (via `codecRefForColumn`). The pre-population walk and `forColumn` therefore make no defensive checks — malformed columns fail fast at `createExecutionContext` construction with `RUNTIME.CODEC_DESCRIPTOR_MISSING` or `RUNTIME.CODEC_PARAMETERIZATION_MISMATCH` rather than being silently skipped here.\n*\n* `forColumn(ns, t, c)` is a thin delegate over `forCodecRef(codecRefForColumn(ns, t, c))`; encode/decode hot paths read the resolver directly via `forCodecRef`. The only `undefined` `forColumn` returns is the legitimate \"no such column in the contract\" case.\n*/\nfunction buildContractCodecRegistry(contract, codecDescriptors) {\n\tconst refKeyOf = (ref) => `${ref.codecId}:${canonicalizeJson(ref.typeParams)}`;\n\tconst usedAtByKey = /* @__PURE__ */ new Map();\n\tconst nameByKey = /* @__PURE__ */ new Map();\n\tfor (const [namespaceId, ns] of Object.entries(contract.storage.namespaces)) for (const [tableName, table] of Object.entries(ns.entries.table ?? {})) for (const columnName of Object.keys(table.columns)) {\n\t\tconst ref = codecDescriptors.codecRefForColumn(namespaceId, tableName, columnName);\n\t\tif (!ref) continue;\n\t\tconst key = refKeyOf(ref);\n\t\tconst site = {\n\t\t\ttable: tableName,\n\t\t\tcolumn: columnName\n\t\t};\n\t\tconst existing = usedAtByKey.get(key);\n\t\tif (existing) existing.push(site);\n\t\telse {\n\t\t\tusedAtByKey.set(key, [site]);\n\t\t\tconst name = ref.typeParams !== void 0 ? `<col:${tableName}.${columnName}>` : `<codec:${ref.codecId}>`;\n\t\t\tnameByKey.set(key, name);\n\t\t}\n\t}\n\tconst resolver = createAstCodecResolver(codecDescriptors, (ref) => {\n\t\tconst key = refKeyOf(ref);\n\t\treturn {\n\t\t\tname: nameByKey.get(key) ?? key,\n\t\t\tusedAt: usedAtByKey.get(key) ?? []\n\t\t};\n\t});\n\tfor (const [namespaceId, ns] of Object.entries(contract.storage.namespaces)) for (const [tableName, table] of Object.entries(ns.entries.table ?? {})) for (const columnName of Object.keys(table.columns)) {\n\t\tconst ref = codecDescriptors.codecRefForColumn(namespaceId, tableName, columnName);\n\t\tif (!ref) continue;\n\t\tresolver.forCodecRef(ref);\n\t}\n\treturn {\n\t\tforColumn(namespaceId, table, column) {\n\t\t\tconst ref = codecDescriptors.codecRefForColumn(namespaceId, table, column);\n\t\t\treturn ref ? resolver.forCodecRef(ref) : void 0;\n\t\t},\n\t\tforCodecRef(ref) {\n\t\t\treturn resolver.forCodecRef(ref);\n\t\t}\n\t};\n}\nfunction createExecutionContext(options) {\n\tconst { stack, driver } = options;\n\tassertExecutionStackContractRequirements(options.contract, stack);\n\tconst capabilityContributors = [\n\t\tstack.target,\n\t\tstack.adapter,\n\t\t...driver ? [driver] : [],\n\t\t...stack.extensions\n\t];\n\tconst mergedCapabilities = mergeCapabilityMatrices(options.contract.capabilities, capabilityContributors);\n\tconst contract = {\n\t\t...options.contract,\n\t\tcapabilities: mergedCapabilities\n\t};\n\tconst contributors = [\n\t\tstack.target,\n\t\tstack.adapter,\n\t\t...stack.extensions\n\t];\n\tconst { all: allCodecDescriptors, parameterized: parameterizedCodecDescriptors } = collectCodecDescriptors(contributors);\n\tconst queryOperationRegistry = createSqlOperationRegistry();\n\tfor (const contributor of contributors) {\n\t\tconst ops = contributor.queryOperations?.() ?? {};\n\t\tfor (const [name, op] of Object.entries(ops)) queryOperationRegistry.register(name, op);\n\t}\n\tconst codecDescriptors = buildCodecDescriptorRegistry(allCodecDescriptors, contract.storage);\n\tassertColumnCodecIntegrity(contract.storage, codecDescriptors);\n\tconst aggregateDescriptors = buildSqlAggregateDescriptorRegistry(collectAggregateDescriptorContributions(contributors), codecDescriptors);\n\tconst mutationDefaultGeneratorRegistry = collectMutationDefaultGenerators(contributors);\n\tassertMutationDefaultGeneratorsAvailable(contract.execution, mutationDefaultGeneratorRegistry);\n\tif (parameterizedCodecDescriptors.size > 0) validateColumnTypeParams(contract.storage, parameterizedCodecDescriptors);\n\treturn {\n\t\tcontract,\n\t\tcontractCodecs: buildContractCodecRegistry(contract, codecDescriptors),\n\t\tcodecDescriptors,\n\t\taggregateDescriptors,\n\t\tqueryOperations: queryOperationRegistry,\n\t\trawCodecInferer: stack.adapter.rawCodecInferer,\n\t\tcollectionMethods: contributors.flatMap((contributor) => contributor.collectionMethods?.() ?? []),\n\t\tapplyMutationDefaults: (options) => applyMutationDefaults(contract.execution, mutationDefaultGeneratorRegistry, options)\n\t};\n}\n//#endregion\n//#region src/codecs/decoding.ts\nconst sqlNativeArrayListDecoder = async (wireValue, decodeElement) => {\n\tif (!Array.isArray(wireValue)) throw new TypeError(`expected an array from the driver for many-typed column, got ${typeof wireValue}`);\n\tconst decoded = [];\n\tfor (const elem of wireValue) decoded.push(await decodeElement(elem));\n\treturn decoded;\n};\nconst WIRE_PREVIEW_LIMIT = 100;\nconst EMPTY_INCLUDE_ALIASES = /* @__PURE__ */ new Set();\nfunction projectionListFromAst(ast) {\n\tif (ast.kind === \"select\") return ast.projection;\n\treturn ast.returning;\n}\nfunction resolveProjectionCodec(item, contractCodecs) {\n\tif (item.codec && contractCodecs) return contractCodecs.forCodecRef(item.codec);\n}\nconst EMPTY_MANY_ALIASES = /* @__PURE__ */ new Set();\nfunction undecodedContext() {\n\treturn {\n\t\taliases: void 0,\n\t\tcodecs: /* @__PURE__ */ new Map(),\n\t\tcolumnRefs: /* @__PURE__ */ new Map(),\n\t\tincludeAliases: EMPTY_INCLUDE_ALIASES,\n\t\tmanyAliases: EMPTY_MANY_ALIASES,\n\t\taliasSource: \"projection\"\n\t};\n}\n/**\n* Decode context for a raw statement: the columns come from the row spec its\n* author declared at the terminator, and each carries the codec that decodes\n* it. A statement that reports an affected-row count declares no columns, so\n* its single stats row passes through undecoded.\n*\n* The spec is the only description of the result — the runtime never parses\n* the SQL — so it is also what a mismatched result set is measured against.\n*/\nfunction rawQueryDecodeContext(ast, contractCodecs) {\n\tif (ast.result.kind === \"affected-count\") return undecodedContext();\n\tconst aliases = [];\n\tconst codecs = /* @__PURE__ */ new Map();\n\tconst manyAliases = /* @__PURE__ */ new Set();\n\tfor (const [name, column] of Object.entries(ast.result.columns)) {\n\t\taliases.push(name);\n\t\tconst codec = column.codec ?? { codecId: column.codecId };\n\t\tif (contractCodecs) codecs.set(name, contractCodecs.forCodecRef(codec));\n\t\tif (codec.many) manyAliases.add(name);\n\t}\n\treturn {\n\t\taliases,\n\t\tcodecs,\n\t\tcolumnRefs: /* @__PURE__ */ new Map(),\n\t\tincludeAliases: EMPTY_INCLUDE_ALIASES,\n\t\tmanyAliases,\n\t\taliasSource: \"row-spec\"\n\t};\n}\nfunction buildDecodeContext(ast, contractCodecs) {\n\tif (ast.kind === \"raw-query\") return rawQueryDecodeContext(ast, contractCodecs);\n\tconst projection = projectionListFromAst(ast);\n\tif (!projection || projection.length === 0) return undecodedContext();\n\tconst aliases = [];\n\tconst codecs = /* @__PURE__ */ new Map();\n\tconst columnRefs = /* @__PURE__ */ new Map();\n\tconst includeAliases = /* @__PURE__ */ new Set();\n\tconst manyAliases = /* @__PURE__ */ new Set();\n\tfor (const item of projection) {\n\t\taliases.push(item.alias);\n\t\tconst codec = resolveProjectionCodec(item, contractCodecs);\n\t\tif (codec) codecs.set(item.alias, codec);\n\t\tif (item.codec?.many) manyAliases.add(item.alias);\n\t\tif (item.expr.kind === \"column-ref\") columnRefs.set(item.alias, {\n\t\t\ttable: item.expr.table,\n\t\t\tcolumn: item.expr.column\n\t\t});\n\t\telse if (item.expr.kind === \"subquery\" || item.expr.kind === \"json-array-agg\") includeAliases.add(item.alias);\n\t}\n\treturn {\n\t\taliases,\n\t\tcodecs,\n\t\tcolumnRefs,\n\t\tincludeAliases,\n\t\tmanyAliases,\n\t\taliasSource: \"projection\"\n\t};\n}\nfunction previewWireValue(wireValue) {\n\tif (typeof wireValue === \"string\") return wireValue.length > WIRE_PREVIEW_LIMIT ? `${wireValue.substring(0, WIRE_PREVIEW_LIMIT)}...` : wireValue;\n\treturn String(wireValue).substring(0, WIRE_PREVIEW_LIMIT);\n}\nfunction wrapDecodeFailure(error, alias, ref, codec, wireValue) {\n\tif (isInternalError(error)) throw error;\n\tconst message = error instanceof Error ? error.message : String(error);\n\tconst wrapped = runtimeError(\"RUNTIME.DECODE_FAILED\", `Failed to decode column ${ref ? `${ref.table}.${ref.column}` : alias} with codec '${codec.id}': ${message}`, {\n\t\t...ref ? {\n\t\t\ttable: ref.table,\n\t\t\tcolumn: ref.column\n\t\t} : { alias },\n\t\tcodec: codec.id,\n\t\twirePreview: previewWireValue(wireValue)\n\t});\n\twrapped.cause = error;\n\tthrow wrapped;\n}\nfunction wrapIncludeAggregateFailure(error, alias, wireValue) {\n\tconst wrapped = runtimeError(\"RUNTIME.DECODE_FAILED\", `Failed to parse JSON array for include alias '${alias}': ${error instanceof Error ? error.message : String(error)}`, {\n\t\talias,\n\t\twirePreview: previewWireValue(wireValue)\n\t});\n\twrapped.cause = error;\n\tthrow wrapped;\n}\nfunction decodeIncludeAggregate(alias, wireValue) {\n\tif (wireValue === null || wireValue === void 0) return [];\n\ttry {\n\t\tif (typeof wireValue === \"string\") return JSON.parse(wireValue);\n\t\tif (typeof wireValue === \"object\") return blindCast(wireValue);\n\t\treturn JSON.parse(String(wireValue));\n\t} catch (error) {\n\t\twrapIncludeAggregateFailure(error, alias, wireValue);\n\t}\n}\n/**\n* Decodes a single field. Single-armed: every cell takes the same path — `codec.decode → await → return plain value` — so sync- and async-authored codecs are indistinguishable to callers. JSON-Schema validation, when required, lives inside the resolved codec's `decode` body (e.g. `arktype-json` validates against its rehydrated schema and throws `RUNTIME.JSON_SCHEMA_VALIDATION_FAILED` from `decode` directly); there is\n* no separate validator-registry pass.\n*\n* The row-level `rowCtx` is repackaged into a per-cell `SqlCodecCallContext` whose `column = { table, name }` is a structural projection of the per-cell `ColumnRef = { table, column }` resolved from the AST-backed `DecodeContext` (the same resolution `wrapDecodeFailure` uses for envelope construction — one resolution per cell, two consumers). Cells the runtime cannot resolve to a single underlying column (aggregate\n* aliases, computed projections without a simple ref) get `column: undefined`, matching the spec contract that the runtime never silently defaults this field.\n*\n* For `many`-flagged aliases this function delegates frame traversal to the selected `ListDecoder`, passing `null` elements through unchanged and mapping the same element codec over every non-null element. SQL runtimes without a target-owned contribution select `sqlNativeArrayListDecoder` explicitly before row decoding. Element-level failures surface through the existing `RUNTIME.DECODE_FAILED` envelope with the column/codec context from the parent cell.\n*/\nasync function decodeField(alias, wireValue, decodeCtx, rowCtx, listDecoder) {\n\tif (wireValue === null) return null;\n\tconst codec = decodeCtx.codecs.get(alias);\n\tif (!codec) return wireValue;\n\tconst ref = decodeCtx.columnRefs.get(alias);\n\tlet cellCtx;\n\tif (ref) cellCtx = {\n\t\t...rowCtx,\n\t\tcolumn: {\n\t\t\ttable: ref.table,\n\t\t\tname: ref.column\n\t\t}\n\t};\n\telse {\n\t\tconst { column: _drop, ...rowCtxWithoutColumn } = rowCtx;\n\t\tcellCtx = rowCtxWithoutColumn;\n\t}\n\tconst decodeElement = async (elem) => {\n\t\tif (elem === null || elem === void 0) return null;\n\t\ttry {\n\t\t\treturn await codec.fromWire(elem, cellCtx);\n\t\t} catch (error) {\n\t\t\tif (isStructuredError(error)) throw error;\n\t\t\twrapDecodeFailure(error, alias, ref, codec, elem);\n\t\t}\n\t};\n\tif (decodeCtx.manyAliases.has(alias)) try {\n\t\treturn await listDecoder(wireValue, decodeElement);\n\t} catch (error) {\n\t\tif (isStructuredError(error)) throw error;\n\t\twrapDecodeFailure(error, alias, ref, codec, wireValue);\n\t}\n\ttry {\n\t\treturn await codec.fromWire(wireValue, cellCtx);\n\t} catch (error) {\n\t\tif (isStructuredError(error)) throw error;\n\t\twrapDecodeFailure(error, alias, ref, codec, wireValue);\n\t}\n}\n/**\n* Decodes a row by dispatching all per-cell codec calls concurrently via `Promise.all`. Each cell follows the single-armed `decodeField` path. Structured envelopes thrown by codec bodies (anything passing `isStructuredError`) and an `InternalError` pass through unchanged; all other failures are wrapped in `RUNTIME.DECODE_FAILED` with `{ table, column, codec }` (or `{ alias, codec }` when no column ref is resolvable) and the original error attached on `cause`.\n*\n* When `rowCtx.signal` is provided:\n*\n* - **Already-aborted at entry** short-circuits with `RUNTIME.ABORTED` (`{ phase: 'decode' }`) before any `codec.decode` call is made.\n* - **Mid-flight aborts** race the per-cell `Promise.all` against the signal so the runtime returns promptly even when codec bodies ignore it. In-flight bodies that ignore the signal complete in the background (cooperative cancellation).\n* - Existing structured envelopes (any dotted-code error passing `isStructuredError`, e.g. `RUNTIME.DECODE_FAILED`) from codec bodies pass through unchanged (no double wrap).\n*/\nasync function decodeRow(row, decodeCtx, rowCtx, listDecoder) {\n\tcheckAborted(rowCtx, \"decode\");\n\tconst signal = rowCtx.signal;\n\tconst aliases = decodeCtx.aliases ?? Object.keys(row);\n\tif (decodeCtx.aliases !== void 0) {\n\t\tfor (const alias of decodeCtx.aliases) if (!Object.hasOwn(row, alias)) throw decodeCtx.aliasSource === \"row-spec\" ? runtimeError(\"RUNTIME.RAW_ROW_COLUMN_MISSING\", `Raw statement result has no column \"${alias}\", which its row spec declares`, {\n\t\t\tcolumn: alias,\n\t\t\tdeclaredColumns: decodeCtx.aliases,\n\t\t\tresultColumns: Object.keys(row)\n\t\t}) : runtimeError(\"RUNTIME.DECODE_FAILED\", `Row missing projection alias \"${alias}\"`, {\n\t\t\talias,\n\t\t\texpectedAliases: decodeCtx.aliases,\n\t\t\tpresentKeys: Object.keys(row)\n\t\t});\n\t}\n\tconst tasks = [];\n\tconst includeIndices = [];\n\tfor (let i = 0; i < aliases.length; i++) {\n\t\tconst alias = blindCast(aliases[i]);\n\t\tconst wireValue = row[alias];\n\t\tif (decodeCtx.includeAliases.has(alias)) {\n\t\t\tincludeIndices.push({\n\t\t\t\tindex: i,\n\t\t\t\talias,\n\t\t\t\tvalue: wireValue\n\t\t\t});\n\t\t\ttasks.push(Promise.resolve(void 0));\n\t\t\tcontinue;\n\t\t}\n\t\ttasks.push(decodeField(alias, wireValue, decodeCtx, rowCtx, listDecoder));\n\t}\n\tconst settled = await raceAgainstAbort(Promise.all(tasks), signal, \"decode\");\n\tfor (const entry of includeIndices) settled[entry.index] = decodeIncludeAggregate(entry.alias, entry.value);\n\tconst decoded = {};\n\tfor (let i = 0; i < aliases.length; i++) {\n\t\tconst alias = blindCast(aliases[i]);\n\t\tdecoded[alias] = settled[i];\n\t}\n\treturn decoded;\n}\n//#endregion\n//#region src/content-hash.ts\n/**\n* Computes a stable content hash for a lowered SQL execution plan.\n*\n* Internally builds an unambiguous canonical-stringified preimage from\n* three components:\n*\n* 1. `meta.storageHash` — discriminates by schema. A migration changes the\n* storage hash, which invalidates cached entries automatically.\n* 2. `exec.sql` — the raw lowered SQL text. Two queries with different\n* structure produce different keys. Note that we deliberately do **not**\n* use `computeSqlFingerprint` here: that helper strips literals to group\n* executions by statement shape (used by telemetry), which is the\n* opposite of what a content hash needs — we want per-execution\n* discrimination, not per-statement-shape grouping.\n* 3. `exec.params` — the bound parameters. `canonicalStringify` produces a\n* deterministic serialization that is stable across object key\n* insertion order and that distinguishes types JSON would otherwise\n* conflate (e.g. `BigInt(1)` vs `1`).\n*\n* The components are wrapped in an object and canonicalized as a single\n* unit (rather than concatenated with a delimiter) so component\n* boundaries are unambiguous: any character appearing inside `sql` or\n* `storageHash` cannot bleed across components and produce a collision\n* with a different split of the same characters.\n*\n* The canonical string is then piped through `hashContent` to produce a\n* bounded, opaque digest. See `@internal/utils/hash-content` for the\n* rationale.\n*\n* @internal\n*/\nfunction computeSqlContentHash(exec) {\n\treturn hashContent(canonicalStringify({\n\t\tstorageHash: exec.meta.storageHash,\n\t\tsql: exec.sql,\n\t\tparams: exec.params\n\t}));\n}\n//#endregion\n//#region src/fingerprint.ts\nconst STRING_LITERAL_REGEX = /'(?:''|[^'])*'/g;\nconst NUMERIC_LITERAL_REGEX = /\\b\\d+(?:\\.\\d+)?\\b/g;\nconst WHITESPACE_REGEX = /\\s+/g;\n/**\n* Computes a literal-stripped, normalized fingerprint of a SQL statement.\n*\n* The function strips string and numeric literals, collapses whitespace, and\n* lowercases the result before hashing — so two structurally equivalent\n* statements (with different parameter values) produce the same fingerprint.\n* Used by SQL telemetry to group queries.\n*/\nfunction computeSqlFingerprint(sql) {\n\tconst normalized = sql.replace(STRING_LITERAL_REGEX, \"?\").replace(NUMERIC_LITERAL_REGEX, \"?\").replace(WHITESPACE_REGEX, \" \").trim().toLowerCase();\n\treturn createHash(\"sha256\").update(normalized).digest(\"hex\");\n}\n//#endregion\n//#region src/in-flight-operations.ts\nvar InFlightOperations = class {\n\t#count = 0;\n\t#started = 0;\n\t#drainWaiters = [];\n\t/** Records one operation as in flight; the returned callback ends it and ignores later calls. */\n\tbegin() {\n\t\tthis.#count += 1;\n\t\tthis.#started += 1;\n\t\tlet ended = false;\n\t\treturn () => {\n\t\t\tif (ended) return;\n\t\t\tended = true;\n\t\t\tthis.#count -= 1;\n\t\t\tif (this.#count === 0) for (const wake of this.#drainWaiters.splice(0)) wake();\n\t\t};\n\t}\n\t/** How many operations have begun so far; a change between two reads means work started in between. */\n\tget started() {\n\t\treturn this.#started;\n\t}\n\t/** How many operations are in flight. */\n\tget count() {\n\t\treturn this.#count;\n\t}\n\tget active() {\n\t\treturn this.#count > 0;\n\t}\n\tdrained() {\n\t\tif (this.#count === 0) return Promise.resolve();\n\t\treturn new Promise((resolve) => this.#drainWaiters.push(resolve));\n\t}\n\t/** Records `work` as in flight until it settles. */\n\tasync track(work) {\n\t\tconst end = this.begin();\n\t\ttry {\n\t\t\treturn await work();\n\t\t} finally {\n\t\t\tend();\n\t\t}\n\t}\n};\n//#endregion\n//#region src/middleware/before-compile-chain.ts\nasync function runBeforeCompileChain(middleware, initial, ctx) {\n\tlet current = initial;\n\tfor (const mw of middleware) {\n\t\tif (!mw.beforeCompile) continue;\n\t\tconst result = await mw.beforeCompile(current, ctx);\n\t\tif (result === void 0) continue;\n\t\tif (result.ast === current.ast) continue;\n\t\tctx.log.debug?.({\n\t\t\tevent: \"middleware.rewrite\",\n\t\t\tmiddleware: mw.name,\n\t\t\tlane: current.meta.lane\n\t\t});\n\t\tcurrent = result;\n\t}\n\treturn current;\n}\n//#endregion\n//#region src/prepared/bind-site-params.ts\nfunction normalizeSpec(spec) {\n\tif (typeof spec === \"string\") return {\n\t\tcodec: { codecId: spec },\n\t\tnullable: false\n\t};\n\treturn {\n\t\tcodec: spec.typeParams !== void 0 ? {\n\t\t\tcodecId: spec.codecId,\n\t\t\ttypeParams: spec.typeParams\n\t\t} : { codecId: spec.codecId },\n\t\tnullable: spec.nullable === true\n\t};\n}\nvar BindSiteExpression = class {\n\treturnType;\n\t#ast;\n\tconstructor(ref, returnType) {\n\t\tthis.#ast = ref;\n\t\tthis.returnType = returnType;\n\t}\n\tbuildAst() {\n\t\treturn this.#ast;\n\t}\n};\nfunction buildBindSiteParams(declaration) {\n\tconst params = {};\n\tfor (const [name, spec] of Object.entries(declaration)) {\n\t\tconst { codec, nullable } = normalizeSpec(spec);\n\t\tparams[name] = new BindSiteExpression(PreparedParamRef.of(name, codec, nullable), {\n\t\t\tcodecId: codec.codecId,\n\t\t\tnullable\n\t\t});\n\t}\n\treturn blindCast(Object.freeze(params));\n}\n//#endregion\n//#region src/prepared/encode-prepared.ts\n/**\n* Resolve a PreparedStatement's slot order to the unencoded values it\n* will carry into encode. Literal slots come from the lowered AST;\n* bind slots are looked up by name on `userParams`. Missing user params\n* surface `RUNTIME.PREPARE_MISSING_PARAM` so the caller cannot silently\n* bind `undefined`.\n*/\nfunction isRecord(value) {\n\treturn typeof value === \"object\" && value !== null;\n}\nfunction resolvePreparedSlotValues(ps, userParams) {\n\tif (!isRecord(userParams)) throw runtimeError(\"RUNTIME.PREPARE_MISSING_PARAM\", \"Prepared statement parameters must be an object\");\n\treturn ps.slots.map((slot) => {\n\t\tif (slot.kind === \"literal\") return slot.value;\n\t\tif (!Object.hasOwn(userParams, slot.name)) throw runtimeError(\"RUNTIME.PREPARE_MISSING_PARAM\", `Prepared statement query is missing parameter '${slot.name}'`, { name: slot.name });\n\t\treturn userParams[slot.name];\n\t});\n}\nasync function encodePreparedParams(ps, userParams, ctx, contractCodecs) {\n\treturn encodeParamsWithMetadata(resolvePreparedSlotValues(ps, userParams), ps.paramMetadata, ctx, contractCodecs);\n}\n//#endregion\n//#region src/transaction-stack.ts\nvar TransactionStack = class {\n\t#entries = [];\n\t#savepoints = 0;\n\t#invalidated = false;\n\tpush(entry) {\n\t\tthis.#entries.push(entry);\n\t}\n\tpop() {\n\t\tconst entry = this.#entries.pop();\n\t\tinvariant(entry !== void 0, \"The transaction stack is empty\");\n\t\treturn entry;\n\t}\n\tget top() {\n\t\treturn this.#entries.at(-1);\n\t}\n\tincludes(entry) {\n\t\treturn this.#entries.includes(entry);\n\t}\n\tnextSavepointName() {\n\t\tthis.#savepoints += 1;\n\t\treturn `sp_${this.#savepoints}`;\n\t}\n\tinvalidate() {\n\t\tthis.#invalidated = true;\n\t}\n\tget invalidated() {\n\t\treturn this.#invalidated;\n\t}\n};\n//#endregion\n//#region src/runtime-transaction.ts\nvar TransactionBase = class {\n\t[activitySource];\n\t[transactionSettlement];\n\truntime;\n\tdriverTx;\n\tactivity;\n\tstack;\n\tentry;\n\topenTransaction;\n\troute;\n\tconstructor(runtime, driverTx, activity, stack, entry) {\n\t\tthis.runtime = runtime;\n\t\tthis.driverTx = driverTx;\n\t\tthis.activity = activity;\n\t\tthis.stack = stack;\n\t\tthis.entry = entry;\n\t\tthis.openTransaction = {\n\t\t\tactivity,\n\t\t\tassertAcceptsStatements: () => this.assertAcceptsStatements(),\n\t\t\tassertOpen: () => this.assertOpen(),\n\t\t\ttransactionBeneath: (parent) => this.transactionBeneath(parent)\n\t\t};\n\t\tthis.route = runtime.route(driverTx, this.openTransaction);\n\t\truntime.register(driverTx, this.openTransaction);\n\t\tthis[activitySource] = {\n\t\t\tstartActivity: (clientActivity) => runtime.startActivity(this.route, clientActivity),\n\t\t\tplanContentHash: (plan) => runtime.planContentHash(plan, activity)\n\t\t};\n\t\tconst isClosed = () => this.isClosed;\n\t\tthis[transactionSettlement] = {\n\t\t\tget closed() {\n\t\t\t\treturn isClosed();\n\t\t\t},\n\t\t\tget committed() {\n\t\t\t\treturn entry.state === \"committed\";\n\t\t\t},\n\t\t\tget rolledBack() {\n\t\t\t\treturn entry.state === \"rolled-back\";\n\t\t\t},\n\t\t\tlogDroppedError: (error) => this.logDroppedError(error),\n\t\t\tabandon: async () => {\n\t\t\t\tstack.invalidate();\n\t\t\t\tawait this.rollback().catch(() => void 0);\n\t\t\t}\n\t\t};\n\t}\n\tquery(plan, options) {\n\t\treturn this.route.query(plan, { ...options });\n\t}\n\texecute(plan, options) {\n\t\treturn this.route.execute(plan, { ...options });\n\t}\n\t[preparedStatementQuery](ps, params, options) {\n\t\treturn this.route.preparedQuery(blindCast(ps), params, { ...options });\n\t}\n\t[preparedStatementExecute](ps, params, options) {\n\t\treturn this.route.preparedExecute(blindCast(ps), params, { ...options });\n\t}\n\ttransaction() {\n\t\treturn this.transactionBeneath(this.activity);\n\t}\n\tasync transactionBeneath(parent) {\n\t\tif (this.isClosed) throw transactionClosedError();\n\t\tthis.assertAcceptsStatements();\n\t\tconst name = this.stack.nextSavepointName();\n\t\tconst entry = {\n\t\t\tname,\n\t\t\tactivity: void 0,\n\t\t\tcommitEnding: void 0,\n\t\t\tstate: \"open\"\n\t\t};\n\t\tthis.stack.push(entry);\n\t\tlet activity;\n\t\ttry {\n\t\t\tactivity = await this.runtime.startTransactionActivity(parent);\n\t\t} catch (error) {\n\t\t\tthis.stack.pop();\n\t\t\tthrow error;\n\t\t}\n\t\tentry.activity = activity;\n\t\tlet driverSavepoint;\n\t\ttry {\n\t\t\tdriverSavepoint = await this.runtime.trackInFlight(() => this.driverTx.savepoint(name));\n\t\t} catch (error) {\n\t\t\tthis.stack.pop();\n\t\t\tawait activity.end({\n\t\t\t\tby: \"rollback\",\n\t\t\t\toutcome: \"failed\",\n\t\t\t\tcommitAttempted: false\n\t\t\t});\n\t\t\tthrow error;\n\t\t}\n\t\tthis.runtime.markHeld(this.driverTx, driverSavepoint);\n\t\treturn new Savepoint(this.runtime, driverSavepoint, activity, this.stack, entry, this.rootTransaction);\n\t}\n\tlogDroppedError(error) {\n\t\ttry {\n\t\t\tthis.activity.ctx.log.error({\n\t\t\t\tevent: \"middleware.activityEnded.error\",\n\t\t\t\terror\n\t\t\t});\n\t\t} catch {}\n\t}\n};\nvar OuterTransaction = class extends TransactionBase {\n\tsignal;\n\tcontroller = new AbortController();\n\tconnection;\n\tendTransactionWork;\n\ttimeout;\n\tdeadline;\n\tclosed = false;\n\ttimer;\n\tcommitAttempted = false;\n\tconstructor(runtime, connection, driverTx, activity, endTransactionWork, timeout) {\n\t\tconst entry = {\n\t\t\tname: void 0,\n\t\t\tactivity,\n\t\t\tcommitEnding: void 0,\n\t\t\tstate: \"open\"\n\t\t};\n\t\tsuper(runtime, driverTx, activity, new TransactionStack(), entry);\n\t\tthis.stack.push(entry);\n\t\tthis.signal = this.controller.signal;\n\t\tthis.endTransactionWork = endTransactionWork;\n\t\tthis.timeout = timeout;\n\t\tthis.deadline = performance.now() + (timeout ?? Number.POSITIVE_INFINITY);\n\t\tthis.connection = connection;\n\t\truntime.register(connection, this.openTransaction);\n\t\tif (timeout !== void 0) {\n\t\t\tthis.timer = setTimeout(() => this.expire(), timeout);\n\t\t\truntime.onConnectionReleased(connection, () => this.releaseConnection());\n\t\t}\n\t}\n\tget isClosed() {\n\t\treturn this.closed || this.stack.invalidated;\n\t}\n\tget rootTransaction() {\n\t\treturn this;\n\t}\n\tassertOpen() {\n\t\tif (!this.closed && performance.now() >= this.deadline) this.expire();\n\t\tthis.signal.throwIfAborted();\n\t\tif (this.isClosed) throw transactionClosedError();\n\t}\n\tassertAcceptsStatements() {\n\t\tif (this.stack.invalidated) throw transactionClosedError();\n\t\tif (!this.closed && this.stack.top !== this.entry) throw transactionSuspendedError(this.stack);\n\t}\n\tasync commit() {\n\t\tif (this.timeout !== void 0) this.assertOpen();\n\t\tthis.assertAcceptsStatements();\n\t\tthis.stopDeadline();\n\t\tthis.commitAttempted = true;\n\t\tthis.stopAcceptingChildren();\n\t\ttry {\n\t\t\tawait this.runtime.trackInFlight(() => this.driverTx.commit());\n\t\t} catch (error) {\n\t\t\tthis.endTransactionWork();\n\t\t\tawait this.activity.end({\n\t\t\t\tby: \"commit\",\n\t\t\t\toutcome: \"failed\"\n\t\t\t});\n\t\t\tthrow error;\n\t\t}\n\t\tthis.entry.state = \"committed\";\n\t\tthis.entry.commitEnding = this.activity.end({\n\t\t\tby: \"commit\",\n\t\t\toutcome: \"succeeded\"\n\t\t});\n\t\ttry {\n\t\t\tawait this.entry.commitEnding;\n\t\t} finally {\n\t\t\tthis.endTransactionWork();\n\t\t}\n\t}\n\tasync rollback() {\n\t\tif (this.stack.invalidated) return this.refuseInvalidatedRollback();\n\t\tif (this.stack.top !== this.entry && !this.signal.aborted) throw transactionSuspendedError(this.stack);\n\t\tthis.stopDeadline();\n\t\tthis.stopAcceptingChildren();\n\t\tif (this.entry.commitEnding !== void 0) {\n\t\t\tawait this.entry.commitEnding.catch(() => void 0);\n\t\t\tthrow transactionClosedError();\n\t\t}\n\t\tif (this.entry.state === \"rolled-back\") return;\n\t\ttry {\n\t\t\tawait this.runtime.trackInFlight(() => this.driverTx.rollback());\n\t\t} catch (error) {\n\t\t\tthis.endTransactionWork();\n\t\t\tawait this.activity.end({\n\t\t\t\tby: \"rollback\",\n\t\t\t\toutcome: \"failed\",\n\t\t\t\tcommitAttempted: this.commitAttempted\n\t\t\t});\n\t\t\tthrow error;\n\t\t}\n\t\tthis.entry.state = \"rolled-back\";\n\t\ttry {\n\t\t\tawait this.activity.end({\n\t\t\t\tby: \"rollback\",\n\t\t\t\toutcome: \"succeeded\",\n\t\t\t\tcommitAttempted: this.commitAttempted\n\t\t\t});\n\t\t} finally {\n\t\t\tthis.endTransactionWork();\n\t\t}\n\t}\n\tasync refuseInvalidatedRollback() {\n\t\tthis.stopDeadline();\n\t\tthis.stopAcceptingChildren();\n\t\tthis.endTransactionWork();\n\t\tawait this.activity.end({\n\t\t\tby: \"rollback\",\n\t\t\toutcome: \"failed\",\n\t\t\tcommitAttempted: this.commitAttempted\n\t\t});\n\t\tthrow transactionClosedError();\n\t}\n\tasync releaseConnection() {\n\t\tthis.stopDeadline();\n\t\tthis.stopAcceptingChildren();\n\t\ttry {\n\t\t\tif (this.entry.state !== \"committed\" && this.entry.state !== \"rolled-back\") {\n\t\t\t\tthis.entry.state = \"rolled-back\";\n\t\t\t\tawait this.activity.end({\n\t\t\t\t\tby: \"rollback\",\n\t\t\t\t\toutcome: \"failed\",\n\t\t\t\t\tcommitAttempted: this.commitAttempted\n\t\t\t\t});\n\t\t\t}\n\t\t} catch (error) {\n\t\t\tthis.logDroppedError(error);\n\t\t} finally {\n\t\t\tthis.endTransactionWork();\n\t\t}\n\t}\n\tstopDeadline() {\n\t\tclearTimeout(this.timer);\n\t\tthis.timer = void 0;\n\t\tthis.closed = true;\n\t}\n\texpire() {\n\t\tif (this.closed) return;\n\t\tthis.stopDeadline();\n\t\tthis.activity.stopAcceptingChildren();\n\t\tthis.controller.abort(runtimeError(\"RUNTIME.TRANSACTION_TIMEOUT\", \"Transaction callback exceeded its timeout\", { timeout: this.timeout }));\n\t}\n\tstopAcceptingChildren() {\n\t\tthis.activity.stopAcceptingChildren();\n\t\tthis.runtime.unregister(this.connection, this.openTransaction);\n\t}\n};\nvar Savepoint = class extends TransactionBase {\n\troot;\n\tconstructor(runtime, driverTx, activity, stack, entry, root) {\n\t\tsuper(runtime, driverTx, activity, stack, entry);\n\t\tthis.root = root;\n\t}\n\tget signal() {\n\t\treturn this.root.signal;\n\t}\n\tget isClosed() {\n\t\treturn this.root.isClosed || !this.stack.includes(this.entry);\n\t}\n\tget rootTransaction() {\n\t\treturn this.root;\n\t}\n\tassertOpen() {\n\t\tthis.root.assertOpen();\n\t\tif (this.isClosed) throw transactionClosedError();\n\t}\n\tassertAcceptsStatements() {\n\t\tif (this.isClosed) throw transactionClosedError();\n\t\tif (this.stack.top !== this.entry) throw transactionSuspendedError(this.stack);\n\t}\n\tasync commit() {\n\t\tthis.assertAcceptsStatements();\n\t\ttry {\n\t\t\tawait this.runtime.trackInFlight(() => this.driverTx.commit());\n\t\t} catch (error) {\n\t\t\tthis.entry.state = \"commit-failed\";\n\t\t\tthrow error;\n\t\t}\n\t\tthis.stack.pop();\n\t\tthis.entry.state = \"committed\";\n\t\tthis.entry.commitEnding = this.activity.end({\n\t\t\tby: \"release\",\n\t\t\toutcome: \"succeeded\"\n\t\t});\n\t\tawait this.entry.commitEnding;\n\t}\n\tasync rollback() {\n\t\tif (this.entry.commitEnding !== void 0) {\n\t\t\tawait this.entry.commitEnding.catch(() => void 0);\n\t\t\tthrow transactionClosedError();\n\t\t}\n\t\tconst commitAttempted = this.entry.state === \"commit-failed\";\n\t\tif (this.isClosed) {\n\t\t\tawait this.activity.end({\n\t\t\t\tby: \"rollback\",\n\t\t\t\toutcome: \"failed\",\n\t\t\t\tcommitAttempted\n\t\t\t});\n\t\t\tthrow transactionClosedError();\n\t\t}\n\t\tif (this.stack.top !== this.entry) throw transactionSuspendedError(this.stack);\n\t\ttry {\n\t\t\tawait this.runtime.trackInFlight(() => this.driverTx.rollback());\n\t\t} catch (error) {\n\t\t\tthis.stack.invalidate();\n\t\t\tawait this.activity.end({\n\t\t\t\tby: \"rollback\",\n\t\t\t\toutcome: \"failed\",\n\t\t\t\tcommitAttempted\n\t\t\t});\n\t\t\tthrow error;\n\t\t}\n\t\tthis.stack.pop();\n\t\tthis.entry.state = \"rolled-back\";\n\t\tawait this.activity.end({\n\t\t\tby: \"rollback\",\n\t\t\toutcome: \"succeeded\",\n\t\t\tcommitAttempted\n\t\t});\n\t}\n};\nfunction transactionClosedError() {\n\treturn runtimeError(\"RUNTIME.TRANSACTION_CLOSED\", \"Cannot use a transaction operation after the transaction has ended. Consume query results and await execute calls inside the transaction callback.\", {});\n}\nfunction savepointOptionsUnsupportedError(options) {\n\treturn runtimeError(\"RUNTIME.SAVEPOINT_OPTIONS_UNSUPPORTED\", \"A transaction started inside a transaction is a savepoint, which has the isolation level and timeout of the transaction it is in; it takes no options.\", { options });\n}\nfunction openSavepointOf(stack) {\n\tconst { top } = stack;\n\tinvariant(top !== void 0, \"A transaction below the top of the stack has a savepoint above it\");\n\treturn top;\n}\nfunction transactionSuspendedError(stack) {\n\tconst open = openSavepointOf(stack);\n\treturn runtimeError(\"RUNTIME.TRANSACTION_SUSPENDED\", `Savepoint ${open.name} is open on this transaction; commit or roll it back before using the transaction again.`, { savepointId: open.activity?.activity.id });\n}\n//#endregion\n//#region src/sql-family-adapter.ts\nvar SqlFamilyAdapter = class {\n\tcontract;\n\tmarkerReader;\n\tconstructor(contract, adapterProfile) {\n\t\tthis.contract = contract;\n\t\tthis.markerReader = adapterProfile;\n\t}\n\tvalidatePlan(plan, contract) {\n\t\tvalidateSqlPlan(plan, contract);\n\t}\n};\n/** Rejects a plan built for another target or contract: `PLAN.TARGET_MISMATCH` or `PLAN.HASH_MISMATCH`. */\nfunction validateSqlPlan(plan, contract) {\n\tif (plan.meta.target !== contract.target) throw runtimeError(\"PLAN.TARGET_MISMATCH\", \"The plan was built for another target than the contract\", {\n\t\tplanTarget: plan.meta.target,\n\t\tcontractTarget: contract.target\n\t});\n\tif (plan.meta.storageHash !== contract.storage.storageHash) throw runtimeError(\"PLAN.HASH_MISMATCH\", \"The plan was built for another contract\", {\n\t\tplanStorageHash: plan.meta.storageHash,\n\t\tcontractStorageHash: contract.storage.storageHash\n\t});\n}\n//#endregion\n//#region src/transaction-deadline.ts\nfunction validateTransactionTimeout(timeout) {\n\tif (timeout === void 0 || timeout === null) return void 0;\n\tif (!Number.isInteger(timeout) || timeout < 1 || timeout > 2147483647) throw runtimeError(\"RUNTIME.INVALID_TRANSACTION_TIMEOUT\", \"Transaction timeout must be an integer between 1 and 2147483647 milliseconds\", { timeout });\n\treturn timeout;\n}\n//#endregion\n//#region src/sql-runtime.ts\nfunction isExecutionPlan(plan) {\n\treturn \"sql\" in plan;\n}\nfunction isBoundPreparedStatement(subject) {\n\treturn \"statement\" in subject;\n}\nfunction isPreparedStatementInternals(statement) {\n\treturn statement instanceof PreparedStatementImpl || statement instanceof PreparedExecutionImpl;\n}\n// v8 ignore next 2\nconst noopLogSink = () => {};\nconst noopLog = {\n\tinfo: noopLogSink,\n\twarn: noopLogSink,\n\terror: noopLogSink\n};\nconst scheduleTimer = globalThis.setTimeout;\nfunction runtimeClosedError() {\n\treturn structuredError(\"DRIVER.NOT_CONNECTED\", \"Runtime is closed\", {\n\t\twhy: \"close() was called on this runtime, or on the client or connection that owns it. An await using scope calls close() when it ends.\",\n\t\tfix: \"Await every query, transaction and prepared statement before close(). The usual cause is a query returned without await from an await using scope.\"\n\t});\n}\n/**\n* Abstract family-layer base for SQL runtimes. Subclass to build a target runtime\n* (e.g. `PostgresRuntimeImpl`); app code should consume the `Runtime` interface returned\n* by the target factories, never this class directly.\n*/\nvar SqlRuntimeBase = class extends RuntimeCore {\n\tcontract;\n\tadapter;\n\tdriver;\n\tfamilyAdapter;\n\tcontractCodecs;\n\tcodecDescriptors;\n\tsqlCtx;\n\tverifyMarkerOption;\n\tverifyMarkerPromise;\n\tclosePromise;\n\townsDriver;\n\tcloseRefusal;\n\t#inFlight = new InFlightOperations();\n\t#openTransactionWork = new InFlightOperations();\n\t#transactionWorkOn = /* @__PURE__ */ new WeakMap();\n\t#openActivityHandles = 0;\n\t#refusing = false;\n\t#heldQueryables = /* @__PURE__ */ new WeakSet();\n\t#preparedStatementHandles = /* @__PURE__ */ new WeakMap();\n\t#holdFinishedChildren;\n\t#transactions = /* @__PURE__ */ new WeakMap();\n\t#startingTransactions = /* @__PURE__ */ new WeakSet();\n\t#transactionRuntime = {\n\t\troute: (driverTx, transaction) => this.queryableRoute(driverTx, \"transaction\", () => transaction.activity, {\n\t\t\ttransaction: savepointOn(transaction),\n\t\t\truntimeWork: false\n\t\t}),\n\t\tstartActivity: (route, activity) => this.startActivityOnRoute(route, activity, void 0),\n\t\tplanContentHash: (plan, parent) => this.planContentHashFor(plan, \"transaction\", parent),\n\t\tstartTransactionActivity: (parent) => startTransactionActivity({\n\t\t\tmiddleware: this.middleware,\n\t\t\tcontext: {\n\t\t\t\t...this.sqlCtx,\n\t\t\t\tscope: \"transaction\"\n\t\t\t},\n\t\t\tparent,\n\t\t\tholdFinishedChildren: this.#holdFinishedChildren\n\t\t}),\n\t\ttrackInFlight: (operation) => this.#inFlight.track(operation),\n\t\tregister: (queryable, transaction) => {\n\t\t\tthis.#transactions.set(queryable, transaction);\n\t\t},\n\t\tunregister: (queryable, transaction) => {\n\t\t\tif (this.#transactions.get(queryable) === transaction) this.#transactions.delete(queryable);\n\t\t},\n\t\tmarkHeld: (driverTx, driverSavepoint) => {\n\t\t\tif (this.#heldQueryables.has(driverTx)) this.#heldQueryables.add(driverSavepoint);\n\t\t},\n\t\tonConnectionReleased: (connection, teardown) => {\n\t\t\tthis.#transactionWorkOn.set(connection, teardown);\n\t\t}\n\t};\n\tcodecRegistryValidated;\n\t_pendingTelemetry;\n\t_telemetryCache;\n\tconstructor(options) {\n\t\tconst { context, adapter, driver, verifyMarker, middleware, mode, log, closeRefusal, ownsDriver } = options;\n\t\tif (middleware) for (const mw of middleware) checkMiddlewareCompatibility(mw, \"sql\", context.contract.target);\n\t\tconst sqlCtx = {\n\t\t\tcontract: context.contract,\n\t\t\tmode: mode ?? \"strict\",\n\t\t\tnow: () => Date.now(),\n\t\t\tlog: log ?? noopLog,\n\t\t\tcontentHash: (exec) => computeSqlContentHash(blindCast(exec)),\n\t\t\tscope: \"runtime\"\n\t\t};\n\t\tsuper({\n\t\t\tmiddleware: middleware ?? [],\n\t\t\tctx: sqlCtx\n\t\t});\n\t\tthis.#holdFinishedChildren = this.middleware.some((mw) => mw.activityFinalized !== void 0);\n\t\tthis.contract = context.contract;\n\t\tthis.adapter = adapter;\n\t\tthis.driver = driver;\n\t\tthis.familyAdapter = new SqlFamilyAdapter(context.contract, adapter.profile);\n\t\tthis.contractCodecs = context.contractCodecs;\n\t\tthis.codecDescriptors = context.codecDescriptors;\n\t\tthis.sqlCtx = sqlCtx;\n\t\tthis.verifyMarkerOption = verifyMarker ?? \"onFirstUse\";\n\t\tthis.closeRefusal = closeRefusal ?? \"when-idle\";\n\t\tthis.codecRegistryValidated = false;\n\t\tthis.verifyMarkerPromise = this.verifyMarkerOption === false ? Promise.resolve() : null;\n\t\tthis.closePromise = null;\n\t\tthis.ownsDriver = ownsDriver ?? true;\n\t\tthis._pendingTelemetry = null;\n\t\tthis._telemetryCache = null;\n\t}\n\t/**\n\t* Lower a `SqlQueryPlan` (AST + meta) into a `SqlExecutionPlan`\n\t* with encoded parameters ready for the driver.\n\t*\n\t* Implementation note: SQL splits lower-then-encode across\n\t* {@link lowerToDraft} + {@link encodeDraftParams} so the selected\n\t* operation's middleware chain can run between them:\n\t* {@link prepareOperation} runs the statement's `beforeEncode` chain\n\t* between them (cipherstash bulk-encrypt, for example, mutates pre-encode\n\t* `ParamRef.value` slots). This protected hook composes the two back into\n\t* the cross-family `lower()` shape `RuntimeCore` expects. The production\n\t* operation methods use the matching split form before driver execution.\n\t*\n\t* `ctx: SqlCodecCallContext` is forwarded to `encodeParams` so\n\t* per-query cancellation reaches every codec body during parameter\n\t* encoding. SQL params do not populate `ctx.column` — encode-side\n\t* column metadata is the middleware's domain.\n\t*/\n\tasync lower(plan, ctx) {\n\t\tconst draft = this.lowerToDraft(plan);\n\t\treturn await this.encodeDraftParams(draft, ctx);\n\t}\n\t/**\n\t* AST → pre-encode draft for the selected `query()` or `execute()` operation.\n\t* The returned plan has `sql` rendered and `params` populated with the\n\t* user-domain values the lowering site collected from `ParamRef` nodes. No\n\t* codec encode has happened yet; consumers can mutate `params` via the\n\t* `SqlParamRefMutator` before {@link encodeDraftParams} runs.\n\t*/\n\tlowerToDraft(plan) {\n\t\treturn lowerSqlPlan(this.adapter, this.contract, plan);\n\t}\n\t/**\n\t* Encode a draft plan's params for the selected `query()` or `execute()`\n\t* operation through the per-column codecs and freeze the result into the\n\t* final `SqlExecutionPlan` the driver sees. Errors surface as\n\t* `RUNTIME.ENCODE_FAILED` envelopes from {@link encodeParams}.\n\t*/\n\tasync encodeDraftParams(draft, ctx) {\n\t\treturn Object.freeze({\n\t\t\t...draft,\n\t\t\tparams: await encodeParams(draft, ctx, this.contractCodecs)\n\t\t});\n\t}\n\t/** Default query invocation required by the abstract `RuntimeCore` contract. */\n\t// v8 ignore next 6\n\trunDriver(exec) {\n\t\treturn this.driver.query({\n\t\t\tsql: exec.sql,\n\t\t\tparams: exec.params\n\t\t});\n\t}\n\trunExecute(exec) {\n\t\treturn this.driver.execute({\n\t\t\tsql: exec.sql,\n\t\t\tparams: exec.params\n\t\t});\n\t}\n\t/**\n\t* Runs the registered middleware `beforeCompile` chain over the plan's draft (AST + meta). Returns the original plan unchanged when no middleware rewrote the AST; otherwise returns a new plan carrying the rewritten AST and meta. The lowering adapter and the encoder both walk the rewritten AST directly.\n\t*/\n\tasync compilePlan(plan, middlewareCtx) {\n\t\tconst rewrittenDraft = await runBeforeCompileChain(this.middleware, {\n\t\t\tast: plan.ast,\n\t\t\tmeta: plan.meta\n\t\t}, middlewareCtx);\n\t\treturn rewrittenDraft.ast === plan.ast ? plan : {\n\t\t\t...plan,\n\t\t\tast: rewrittenDraft.ast,\n\t\t\tmeta: rewrittenDraft.meta\n\t\t};\n\t}\n\tquery(plan, options) {\n\t\treturn this.queryAgainstQueryable(plan, this.driver, options);\n\t}\n\texecute(plan, options) {\n\t\treturn this.executeStatisticsAgainstQueryable(plan, this.driver, options);\n\t}\n\t[preparedStatementQuery](ps, params, options) {\n\t\treturn this.runPreparedQueryAgainstQueryable(blindCast(ps), params, this.driver, options);\n\t}\n\t[preparedStatementExecute](ps, params, options) {\n\t\treturn this.runPreparedExecuteAgainstQueryable(blindCast(ps), params, this.driver, options);\n\t}\n\t#runtimeRoute;\n\t[activitySource] = {\n\t\tstartActivity: (activity) => {\n\t\t\tthis.#runtimeRoute ??= this.queryableRoute(this.driver, \"runtime\", () => void 0, {\n\t\t\t\ttransaction: (parent, fn, options) => withTransaction(this, fn, options, parent),\n\t\t\t\truntimeWork: true\n\t\t\t});\n\t\t\treturn this.startActivityOnRoute(this.#runtimeRoute, activity, void 0);\n\t\t},\n\t\tplanContentHash: (plan) => this.planContentHashFor(plan, \"runtime\", void 0)\n\t};\n\t/**\n\t* Starts a client activity whose statements and transaction run on `route`, beneath `parent` or, without one, beneath `route.parent()`.\n\t*/\n\tstartActivityOnRoute(route, activity, parent) {\n\t\tlet endWork = noWork;\n\t\tlet started;\n\t\ttry {\n\t\t\tendWork = route.runtimeWork ? this.beginActivityWork(parent) : noWork;\n\t\t\tstarted = startClientActivity(activity, {\n\t\t\t\tmiddleware: this.middleware,\n\t\t\t\tcontext: route.scope === \"runtime\" ? this.sqlCtx : {\n\t\t\t\t\t...this.sqlCtx,\n\t\t\t\t\tscope: route.scope\n\t\t\t\t},\n\t\t\t\tparent: parent ?? route.parent(),\n\t\t\t\tholdFinishedChildren: this.#holdFinishedChildren\n\t\t\t});\n\t\t} catch (error) {\n\t\t\tendWork();\n\t\t\treturn Promise.reject(error);\n\t\t}\n\t\treturn started.then((run) => this.activityHandle(run, route, endWork), (error) => {\n\t\t\tendWork();\n\t\t\tthrow error;\n\t\t});\n\t}\n\t/** The content hash of the statement `plan` would send on a queryable of `scope` beneath `parent`. */\n\tasync planContentHashFor(plan, scope, parent) {\n\t\tthis.ensureCodecRegistryValidated();\n\t\tif (isBoundPreparedStatement(plan)) {\n\t\t\tconst { statement, params } = plan;\n\t\t\tinvariant(isPreparedStatementInternals(statement), \"The prepared statement was not prepared by a SQL runtime\");\n\t\t\treturn computeSqlContentHash({\n\t\t\t\tsql: statement.sql,\n\t\t\t\tast: statement.ast,\n\t\t\t\tmeta: statement.meta,\n\t\t\t\tparams: await encodePreparedParams(statement, params, {}, this.contractCodecs)\n\t\t\t});\n\t\t}\n\t\tif (isExecutionPlan(plan)) return computeSqlContentHash(Object.freeze({\n\t\t\t...plan,\n\t\t\tparams: await encodeParams(plan, {}, this.contractCodecs)\n\t\t}));\n\t\tconst compiled = await this.compilePlan(plan, createContextBeneath({\n\t\t\t...this.sqlCtx,\n\t\t\tscope\n\t\t}, parent));\n\t\treturn computeSqlContentHash(await this.encodeDraftParams(this.lowerToDraft(compiled), {}));\n\t}\n\t/** An activity route whose statements run on `queryable`. */\n\tqueryableRoute(queryable, scope, parent, options) {\n\t\treturn {\n\t\t\tscope,\n\t\t\tparent,\n\t\t\t...options,\n\t\t\tquery: (plan, executeOptions) => this.queryAgainstQueryable(plan, queryable, {\n\t\t\t\t...executeOptions,\n\t\t\t\tscope\n\t\t\t}),\n\t\t\texecute: (plan, executeOptions) => this.executeStatisticsAgainstQueryable(plan, queryable, {\n\t\t\t\t...executeOptions,\n\t\t\t\tscope\n\t\t\t}),\n\t\t\tpreparedQuery: (statement, params, executeOptions) => this.runPreparedQueryAgainstQueryable(statement, params, queryable, {\n\t\t\t\t...executeOptions,\n\t\t\t\tscope\n\t\t\t}),\n\t\t\tpreparedExecute: (statement, params, executeOptions) => this.runPreparedExecuteAgainstQueryable(statement, params, queryable, {\n\t\t\t\t...executeOptions,\n\t\t\t\tscope\n\t\t\t})\n\t\t};\n\t}\n\t/** The activity route of a held connection that `owner` wraps: its statements run on `connection`, and its transactions begin there. */\n\tconnectionRoute(connection, owner) {\n\t\tconst openTransaction = this.#transactions.get(connection);\n\t\treturn this.queryableRoute(connection, \"connection\", () => openTransaction?.activity, {\n\t\t\ttransaction: openTransaction === void 0 ? (parent, fn, options) => this.transactionOnHeldConnection(connection, owner, parent, fn, options) : savepointOn(openTransaction),\n\t\t\truntimeWork: false\n\t\t});\n\t}\n\tasync transactionOnHeldConnection(connection, owner, parent, fn, options) {\n\t\tconst openTransaction = this.#transactions.get(connection);\n\t\tif (openTransaction !== void 0 || this.#startingTransactions.has(connection)) throw transactionAlreadyOpenError(parent, openTransaction?.activity);\n\t\tconst state = {\n\t\t\tclean: true,\n\t\t\treason: void 0\n\t\t};\n\t\ttry {\n\t\t\treturn await runTransactionOn({\n\t\t\t\t[transactionStart]: owner[transactionStart],\n\t\t\t\ttransaction: (start) => this.beginTransactionOn(connection, owner, parent, start)\n\t\t\t}, fn, options, state);\n\t\t} finally {\n\t\t\tif (!state.clean) await connection.destroy(state.reason).catch(() => void 0);\n\t\t}\n\t}\n\t/** The `activitySource` member of a held connection that `owner()` wraps. */\n\tconnectionActivitySource(connection, owner) {\n\t\treturn {\n\t\t\tstartActivity: (activity) => this.startActivityOnRoute(this.connectionRoute(connection, owner()), activity, void 0),\n\t\t\tplanContentHash: (plan) => this.planContentHashFor(plan, \"connection\", this.#transactions.get(connection)?.activity)\n\t\t};\n\t}\n\tactivityHandle(run, route, endWork) {\n\t\tconst beneath = (options) => ({\n\t\t\t...options,\n\t\t\tactivityParent: run\n\t\t});\n\t\tconst source = {\n\t\t\tstartActivity: (activity) => {\n\t\t\t\ttry {\n\t\t\t\t\trun.assertAcceptsChildren();\n\t\t\t\t} catch (error) {\n\t\t\t\t\treturn Promise.reject(error);\n\t\t\t\t}\n\t\t\t\treturn this.startActivityOnRoute(route, activity, run);\n\t\t\t},\n\t\t\tplanContentHash: (plan) => this.planContentHashFor(plan, route.scope, run)\n\t\t};\n\t\treturn {\n\t\t\t[activitySource]: source,\n\t\t\tstartActivity: source.startActivity,\n\t\t\tplanContentHash: source.planContentHash,\n\t\t\tactivity: run.activity,\n\t\t\tget intercepted() {\n\t\t\t\treturn run.intercepted;\n\t\t\t},\n\t\t\tquery(plan, options) {\n\t\t\t\treturn rowsBeneath(run, () => route.query(plan, beneath(options)));\n\t\t\t},\n\t\t\tasync execute(plan, options) {\n\t\t\t\trun.assertAcceptsChildren();\n\t\t\t\treturn route.execute(plan, beneath(options));\n\t\t\t},\n\t\t\t[preparedStatementQuery](ps, params, options) {\n\t\t\t\treturn rowsBeneath(run, () => route.preparedQuery(blindCast(ps), params, beneath(options)));\n\t\t\t},\n\t\t\tasync [preparedStatementExecute](ps, params, options) {\n\t\t\t\trun.assertAcceptsChildren();\n\t\t\t\treturn route.preparedExecute(blindCast(ps), params, beneath(options));\n\t\t\t},\n\t\t\tinTransaction: () => run.ctx.inTransaction(),\n\t\t\tasync transaction(fn, options) {\n\t\t\t\trun.assertAcceptsChildren();\n\t\t\t\treturn route.transaction(run, fn, options);\n\t\t\t},\n\t\t\tend(end) {\n\t\t\t\tlet ending;\n\t\t\t\ttry {\n\t\t\t\t\tending = run.end(end);\n\t\t\t\t} catch (error) {\n\t\t\t\t\tendWork();\n\t\t\t\t\treturn Promise.reject(error);\n\t\t\t\t}\n\t\t\t\treturn ending.then(endWork, (error) => {\n\t\t\t\t\tendWork();\n\t\t\t\t\tthrow error;\n\t\t\t\t});\n\t\t\t}\n\t\t};\n\t}\n\t/**\n\t* Returns a raw driver connection. SQL issued on it runs below the middleware/codec/telemetry pipeline. It carries its own lifecycle (`release`/`destroy`/`beginTransaction`); the caller owns disposal. It follows the runtime's close rule for connections: see {@link Runtime.close}. Pass the `activityParent` of the activity it is acquired for, so it is admitted after `close()` while that activity is open.\n\t*/\n\tasync acquireRawConnection(options) {\n\t\tconst endOperation = this.beginOperation(this.driver, options);\n\t\tlet connection;\n\t\ttry {\n\t\t\tconnection = await this.driver.acquireConnection();\n\t\t} finally {\n\t\t\tendOperation();\n\t\t}\n\t\tconst dispose = async (teardown) => {\n\t\t\ttry {\n\t\t\t\tawait this.#inFlight.track(teardown);\n\t\t\t} finally {\n\t\t\t\tconst ending = this.#transactionWorkOn.get(held)?.();\n\t\t\t\tif (ending !== void 0) await ending;\n\t\t\t}\n\t\t};\n\t\tconst held = {\n\t\t\tquery: (request) => this.trackRows(connection.query(request)),\n\t\t\texecute: (request) => this.#inFlight.track(() => connection.execute(request)),\n\t\t\tbeginTransaction: (options) => connection.beginTransaction(options),\n\t\t\t...ifDefined(\"explain\", connection.explain?.bind(connection)),\n\t\t\trelease: () => dispose(() => connection.release()),\n\t\t\tdestroy: (reason) => dispose(() => connection.destroy(reason))\n\t\t};\n\t\treturn held;\n\t}\n\tasync *trackRows(rows) {\n\t\tconst iterator = rows[Symbol.asyncIterator]();\n\t\ttry {\n\t\t\tlet next = await this.#inFlight.track(() => iterator.next());\n\t\t\twhile (!next.done) {\n\t\t\t\tyield next.value;\n\t\t\t\tnext = await iterator.next();\n\t\t\t}\n\t\t} finally {\n\t\t\tawait iterator.return?.();\n\t\t}\n\t}\n\tasync setupDriverExecution(exec, queryable) {\n\t\tthis.familyAdapter.validatePlan(exec, this.contract);\n\t\tthis._pendingTelemetry = null;\n\t\tthis._telemetryCache = null;\n\t\tif (this.verifyMarkerPromise === null) {\n\t\t\tconst markerQueryable = this.#heldQueryables.has(queryable) ? queryable : this.driver;\n\t\t\tthis.verifyMarkerPromise = this.verifyMarker(markerQueryable).catch((error) => {\n\t\t\t\tthis.verifyMarkerPromise = null;\n\t\t\t\tthrow error;\n\t\t\t});\n\t\t}\n\t\tawait this.verifyMarkerPromise;\n\t}\n\tbeginActivityWork(parent) {\n\t\tconst endOperation = this.beginOperation(this.driver, { activityParent: parent });\n\t\tthis.#openActivityHandles++;\n\t\tlet ended = false;\n\t\treturn () => {\n\t\t\tif (ended) return;\n\t\t\tended = true;\n\t\t\tthis.#openActivityHandles--;\n\t\t\tendOperation();\n\t\t};\n\t}\n\twarnWhenWaitingOnlyForUnendedWork(warned) {\n\t\tconst openTransactions = this.#refusing ? this.#openTransactionWork.count : 0;\n\t\tif (warned.done || this.#openActivityHandles === 0 && openTransactions === 0) return;\n\t\tif (this.#inFlight.count !== this.#openActivityHandles) return;\n\t\twarned.done = true;\n\t\tthis.sqlCtx.log.warn({\n\t\t\tevent: \"runtime.close.waiting-for-activities\",\n\t\t\topenActivities: this.#openActivityHandles,\n\t\t\topenTransactions\n\t\t});\n\t}\n\tbeginOperation(queryable, options) {\n\t\tconst admittedParent = options?.activityParent?.acceptsChildren() === true;\n\t\tif (queryable === this.driver && this.#refusing && !admittedParent) throw runtimeClosedError();\n\t\treturn this.#inFlight.begin();\n\t}\n\tparentOf(transaction, options) {\n\t\ttransaction?.assertAcceptsStatements();\n\t\tconst openTransaction = transaction?.activity;\n\t\tconst activityParent = options?.activityParent;\n\t\tif (activityParent === void 0) return openTransaction;\n\t\tif (openTransaction !== void 0 && !activityParent.ctx.inTransaction()) throw activityOutsideTransactionError(activityParent, openTransaction);\n\t\treturn activityParent;\n\t}\n\tgetListDecoder() {\n\t\treturn sqlNativeArrayListDecoder;\n\t}\n\tasync *streamDecodedRows(run, exec, createDecodeContext, driverCall, codecCtx, queryable, transaction, onDriverAnswered) {\n\t\tconst rowDecodeContext = createDecodeContext();\n\t\ttransaction?.assertOpen();\n\t\tawait this.setupDriverExecution(exec, queryable);\n\t\tconst startedAt = Date.now();\n\t\tlet telemetryOutcome = null;\n\t\ttry {\n\t\t\tconst iterator = run.runQuery(exec, () => {\n\t\t\t\ttransaction?.assertOpen();\n\t\t\t\treturn driverCall();\n\t\t\t})[Symbol.asyncIterator]();\n\t\t\tlet answered = false;\n\t\t\ttry {\n\t\t\t\twhile (true) {\n\t\t\t\t\tcheckAborted(codecCtx, \"stream\");\n\t\t\t\t\tconst next = answered ? await iterator.next() : await iterator.next().finally(onDriverAnswered);\n\t\t\t\t\tanswered = true;\n\t\t\t\t\tif (next.done) break;\n\t\t\t\t\tyield blindCast(await decodeRow(next.value, rowDecodeContext, codecCtx, this.getListDecoder()));\n\t\t\t\t}\n\t\t\t} finally {\n\t\t\t\tawait iterator.return?.();\n\t\t\t}\n\t\t\ttelemetryOutcome = \"success\";\n\t\t} catch (error) {\n\t\t\ttelemetryOutcome = \"runtime-error\";\n\t\t\tthrow error;\n\t\t} finally {\n\t\t\tif (telemetryOutcome !== null) this.recordTelemetry(exec, telemetryOutcome, Date.now() - startedAt);\n\t\t}\n\t}\n\tcreateQueryContexts(options) {\n\t\tconst signal = options?.signal;\n\t\tconst scope = options?.scope ?? \"runtime\";\n\t\treturn {\n\t\t\tcodecCtx: signal === void 0 ? {} : { signal },\n\t\t\tcontextFields: {\n\t\t\t\t...this.sqlCtx,\n\t\t\t\t...ifDefined(\"signal\", signal),\n\t\t\t\t...scope !== \"runtime\" ? { scope } : {}\n\t\t\t}\n\t\t};\n\t}\n\tasync prepareOperation(plan, codecCtx, run) {\n\t\tcheckAborted(codecCtx, \"stream\");\n\t\tif (isExecutionPlan(plan)) {\n\t\t\tconst mutator = createSqlParamRefMutator(plan);\n\t\t\tawait run.beforeEncode(plan, mutator);\n\t\t\treturn Object.freeze({\n\t\t\t\t...plan,\n\t\t\t\tparams: await encodeParams({\n\t\t\t\t\t...plan,\n\t\t\t\t\tparams: mutator.currentParams()\n\t\t\t\t}, codecCtx, this.contractCodecs)\n\t\t\t});\n\t\t}\n\t\tconst compiled = await this.compilePlan(plan, run.ctx);\n\t\tconst draft = this.lowerToDraft(compiled);\n\t\tconst mutator = createSqlParamRefMutator(draft);\n\t\tawait run.beforeEncode(draft, mutator);\n\t\tconst draftWithMutations = Object.freeze({\n\t\t\t...draft,\n\t\t\tparams: mutator.currentParams()\n\t\t});\n\t\treturn this.encodeDraftParams(draftWithMutations, codecCtx);\n\t}\n\t/** Query rows against a caller-supplied queryable through the shared preparation pipeline. */\n\tqueryAgainstQueryable(plan, queryable, options) {\n\t\tthis.ensureCodecRegistryValidated();\n\t\tconst self = this;\n\t\tconst { codecCtx, contextFields } = this.createQueryContexts(options);\n\t\tconst generator = async function* () {\n\t\t\tconst endOperation = self.beginOperation(queryable, options);\n\t\t\tconst transaction = self.#transactions.get(queryable);\n\t\t\ttry {\n\t\t\t\tyield* streamStatement({\n\t\t\t\t\tmiddleware: self.middleware,\n\t\t\t\t\tplan,\n\t\t\t\t\tcontext: contextFields,\n\t\t\t\t\tparent: self.parentOf(transaction, options)\n\t\t\t\t}, async function* (run) {\n\t\t\t\t\tconst exec = await self.prepareOperation(plan, codecCtx, run);\n\t\t\t\t\tyield* self.streamDecodedRows(run, exec, () => buildDecodeContext(exec.ast, self.contractCodecs), () => queryable.query({\n\t\t\t\t\t\tsql: exec.sql,\n\t\t\t\t\t\tparams: exec.params\n\t\t\t\t\t}), codecCtx, queryable, transaction, endOperation);\n\t\t\t\t});\n\t\t\t} finally {\n\t\t\t\tendOperation();\n\t\t\t}\n\t\t};\n\t\treturn new AsyncIterableResult(generator());\n\t}\n\t/** Execute statistics against a caller-supplied queryable through the shared preparation pipeline. */\n\tasync executeStatisticsAgainstQueryable(plan, queryable, options) {\n\t\tconst endOperation = this.beginOperation(queryable, options);\n\t\ttry {\n\t\t\treturn await this.executeStatisticsInFlight(plan, queryable, options);\n\t\t} finally {\n\t\t\tendOperation();\n\t\t}\n\t}\n\tasync executeStatisticsInFlight(plan, queryable, options) {\n\t\tthis.ensureCodecRegistryValidated();\n\t\tconst { codecCtx, contextFields } = this.createQueryContexts(options);\n\t\treturn this.executeOn(queryable, options, plan, contextFields, async (run, transaction) => {\n\t\t\tconst exec = await this.prepareOperation(plan, codecCtx, run);\n\t\t\treturn this.executeEncodedPlan(run, exec, queryable, transaction, codecCtx, () => queryable.execute({\n\t\t\t\tsql: exec.sql,\n\t\t\t\tparams: exec.params\n\t\t\t}));\n\t\t});\n\t}\n\texecuteOn(queryable, options, plan, context, body) {\n\t\tconst transaction = this.#transactions.get(queryable);\n\t\treturn executeStatement({\n\t\t\tmiddleware: this.middleware,\n\t\t\tplan,\n\t\t\tcontext,\n\t\t\tparent: this.parentOf(transaction, options)\n\t\t}, (run) => body(run, transaction));\n\t}\n\tasync executeEncodedPlan(run, exec, queryable, transaction, codecCtx, driverCall) {\n\t\ttransaction?.assertOpen();\n\t\tawait this.setupDriverExecution(exec, queryable);\n\t\tcheckAborted(codecCtx, \"stream\");\n\t\tconst startedAt = Date.now();\n\t\tlet telemetryOutcome = \"success\";\n\t\ttry {\n\t\t\treturn await run.runExecute(exec, () => {\n\t\t\t\ttransaction?.assertOpen();\n\t\t\t\treturn driverCall();\n\t\t\t});\n\t\t} catch (error) {\n\t\t\ttelemetryOutcome = \"runtime-error\";\n\t\t\tthrow error;\n\t\t} finally {\n\t\t\tthis.recordTelemetry(exec, telemetryOutcome, Date.now() - startedAt);\n\t\t}\n\t}\n\tasync prepare(declaration, callback) {\n\t\tthis.ensureCodecRegistryValidated();\n\t\tconst userPlan = callback(buildBindSiteParams(declaration));\n\t\tconst finalPlan = await this.compilePlan(userPlan, createContextBeneath(this.sqlCtx, void 0));\n\t\tconst orderedRefs = collectOrderedParamRefs(finalPlan.ast);\n\t\tconst referencedNames = /* @__PURE__ */ new Set();\n\t\tfor (const ref of orderedRefs) if (ref.kind === \"prepared-param-ref\") referencedNames.add(ref.name);\n\t\tconst missing = Object.keys(declaration).filter((name) => !referencedNames.has(name));\n\t\tif (missing.length > 0) throw runtimeError(\"RUNTIME.PREPARE_UNUSED_PARAM\", `Prepared statement declaration includes parameter${missing.length === 1 ? \"\" : \"s\"} not referenced by the callback's plan: ${missing.join(\", \")}`, { unused: missing });\n\t\tconst lowered = this.adapter.lower(finalPlan.ast, {\n\t\t\tcontract: this.contract,\n\t\t\tparams: orderedRefs.map((r) => r.kind === \"param-ref\" ? r.value : void 0)\n\t\t});\n\t\tconst decodeContext = buildDecodeContext(finalPlan.ast, this.contractCodecs);\n\t\tconst paramMetadata = deriveParamMetadata(finalPlan.ast);\n\t\tconst internals = Object.freeze({\n\t\t\tsql: lowered.sql,\n\t\t\tast: finalPlan.ast,\n\t\t\tmeta: finalPlan.meta,\n\t\t\tslots: lowered.params,\n\t\t\tdecodeContext,\n\t\t\tparamMetadata\n\t\t});\n\t\treturn blindCast(finalPlan.ast.kind === \"raw-query\" && finalPlan.ast.result.kind === \"affected-count\" ? new PreparedExecutionImpl(internals) : new PreparedStatementImpl(internals));\n\t}\n\t/** Query prepared rows against a caller-supplied queryable through the full pipeline. */\n\trunPreparedQueryAgainstQueryable(ps, userParams, queryable, options) {\n\t\tthis.ensureCodecRegistryValidated();\n\t\tconst self = this;\n\t\tconst { codecCtx, contextFields } = this.createQueryContexts(options);\n\t\tconst generator = async function* () {\n\t\t\tconst endOperation = self.beginOperation(queryable, options);\n\t\t\tconst transaction = self.#transactions.get(queryable);\n\t\t\ttry {\n\t\t\t\tyield* streamStatement({\n\t\t\t\t\tmiddleware: self.middleware,\n\t\t\t\t\tplan: ps,\n\t\t\t\t\tcontext: contextFields,\n\t\t\t\t\tparent: self.parentOf(transaction, options)\n\t\t\t\t}, (run) => self.streamPreparedRows(run, ps, userParams, queryable, transaction, codecCtx, endOperation));\n\t\t\t} finally {\n\t\t\t\tendOperation();\n\t\t\t}\n\t\t};\n\t\treturn new AsyncIterableResult(generator());\n\t}\n\tasync *streamPreparedRows(run, ps, userParams, queryable, transaction, codecCtx, onDriverAnswered) {\n\t\tcheckAborted(codecCtx, \"stream\");\n\t\tconst preEncodeValues = resolvePreparedSlotValues(ps, userParams);\n\t\tconst preEncodeExec = {\n\t\t\tsql: ps.sql,\n\t\t\tparams: preEncodeValues,\n\t\t\tast: ps.ast,\n\t\t\tmeta: ps.meta\n\t\t};\n\t\tconst mutator = createSqlParamRefMutator(preEncodeExec);\n\t\tawait run.beforeEncode(preEncodeExec, mutator);\n\t\tconst encodedParams = await encodeParamsWithMetadata(mutator.currentParams(), ps.paramMetadata, codecCtx, this.contractCodecs);\n\t\tconst exec = {\n\t\t\tsql: ps.sql,\n\t\t\tparams: encodedParams,\n\t\t\tast: ps.ast,\n\t\t\tmeta: ps.meta\n\t\t};\n\t\tconst handles = this.#preparedStatementHandles;\n\t\tconst request = {\n\t\t\tsql: exec.sql,\n\t\t\tparams: exec.params,\n\t\t\tpreparedStatementHandle: {\n\t\t\t\tget: () => handles.get(ps),\n\t\t\t\tset: (value) => {\n\t\t\t\t\thandles.set(ps, value);\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\t\tyield* this.streamDecodedRows(run, exec, () => ps.decodeContext, () => queryable.query(request), codecCtx, queryable, transaction, onDriverAnswered);\n\t}\n\t/** Execute a prepared statement's statistics against a caller-supplied queryable through the full pipeline. */\n\tasync runPreparedExecuteAgainstQueryable(ps, userParams, queryable, options) {\n\t\tconst endOperation = this.beginOperation(queryable, options);\n\t\ttry {\n\t\t\treturn await this.runPreparedExecuteInFlight(ps, userParams, queryable, options);\n\t\t} finally {\n\t\t\tendOperation();\n\t\t}\n\t}\n\tasync runPreparedExecuteInFlight(ps, userParams, queryable, options) {\n\t\tthis.ensureCodecRegistryValidated();\n\t\tconst { codecCtx, contextFields } = this.createQueryContexts(options);\n\t\treturn this.executeOn(queryable, options, ps, contextFields, (run, transaction) => this.executePrepared(run, ps, userParams, queryable, transaction, codecCtx));\n\t}\n\tasync executePrepared(run, ps, userParams, queryable, transaction, codecCtx) {\n\t\tcheckAborted(codecCtx, \"stream\");\n\t\tconst preEncodeValues = resolvePreparedSlotValues(ps, userParams);\n\t\tconst preEncodeExec = {\n\t\t\tsql: ps.sql,\n\t\t\tparams: preEncodeValues,\n\t\t\tast: ps.ast,\n\t\t\tmeta: ps.meta\n\t\t};\n\t\tconst mutator = createSqlParamRefMutator(preEncodeExec);\n\t\tawait run.beforeEncode(preEncodeExec, mutator);\n\t\tconst exec = {\n\t\t\tsql: ps.sql,\n\t\t\tparams: await encodeParamsWithMetadata(mutator.currentParams(), ps.paramMetadata, codecCtx, this.contractCodecs),\n\t\t\tast: ps.ast,\n\t\t\tmeta: ps.meta\n\t\t};\n\t\tconst handles = this.#preparedStatementHandles;\n\t\tconst request = {\n\t\t\tsql: exec.sql,\n\t\t\tparams: exec.params,\n\t\t\tpreparedStatementHandle: {\n\t\t\t\tget: () => handles.get(ps),\n\t\t\t\tset: (value) => {\n\t\t\t\t\thandles.set(ps, value);\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\t\treturn this.executeEncodedPlan(run, exec, queryable, transaction, codecCtx, () => queryable.execute(request));\n\t}\n\tasync connection(options) {\n\t\treturn this.openConnection(options);\n\t}\n\tasync openConnection(options) {\n\t\tconst parent = options?.activityParent;\n\t\tconst driverConn = await this.acquireRawConnection(options);\n\t\tthis.#heldQueryables.add(driverConn);\n\t\tconst self = this;\n\t\tconst wrappedConnection = {\n\t\t\t[transactionStart]: createTransactionStart(),\n\t\t\ttransaction(options) {\n\t\t\t\treturn self.beginTransactionOn(driverConn, wrappedConnection, parent, options);\n\t\t\t},\n\t\t\t[activitySource]: self.connectionActivitySource(driverConn, () => wrappedConnection),\n\t\t\trelease: () => driverConn.release(),\n\t\t\tdestroy: (reason) => driverConn.destroy(reason),\n\t\t\tquery(plan, options) {\n\t\t\t\treturn self.queryAgainstQueryable(plan, driverConn, {\n\t\t\t\t\t...options,\n\t\t\t\t\tscope: \"connection\"\n\t\t\t\t});\n\t\t\t},\n\t\t\texecute(plan, options) {\n\t\t\t\treturn self.executeStatisticsAgainstQueryable(plan, driverConn, {\n\t\t\t\t\t...options,\n\t\t\t\t\tscope: \"connection\"\n\t\t\t\t});\n\t\t\t},\n\t\t\t[preparedStatementQuery](ps, params, options) {\n\t\t\t\treturn self.runPreparedQueryAgainstQueryable(blindCast(ps), params, driverConn, {\n\t\t\t\t\t...options,\n\t\t\t\t\tscope: \"connection\"\n\t\t\t\t});\n\t\t\t},\n\t\t\t[preparedStatementExecute](ps, params, options) {\n\t\t\t\treturn self.runPreparedExecuteAgainstQueryable(blindCast(ps), params, driverConn, {\n\t\t\t\t\t...options,\n\t\t\t\t\tscope: \"connection\"\n\t\t\t\t});\n\t\t\t}\n\t\t};\n\t\treturn wrappedConnection;\n\t}\n\t/**\n\t* Begins a transaction on `connection`, which `owner` wraps, as a transaction activity. When the transaction's `activityStarted` hooks refuse the start, no `BEGIN` is sent, `owner` is recorded as clean, and `withTransaction` releases it; after any other start failure it destroys it. The transaction's `activityStarted` hooks run before `BEGIN`. Every statement sent on the transaction, or on `connection`, from the end of `BEGIN` until `commit()` or `rollback()` is called is the transaction's child, and is finalized when the transaction ends, with its outcome. Once `commit()` or `rollback()` is called, a statement sent on the transaction is refused when it starts, and one started earlier that has not reached the driver yet is refused with `RUNTIME.TRANSACTION_CLOSED`, so neither runs after the `COMMIT` or `ROLLBACK`. `commit()` and `rollback()` resolve after every finalization hook has run. A subclass that holds its own connection begins its transactions here.\n\t*/\n\tasync beginTransactionOn(connection, owner, parent, options) {\n\t\towner[transactionStart].refusedBeforeBegin = true;\n\t\tconst timeout = validateTransactionTimeout(options?.timeout);\n\t\tconst { timeout: _timeout, ...driverOptions } = options ?? {};\n\t\towner[transactionStart].refusedBeforeBegin = false;\n\t\tconst endTransactionWork = this.#openTransactionWork.begin();\n\t\tthis.#transactionWorkOn.set(connection, endTransactionWork);\n\t\tthis.#startingTransactions.add(connection);\n\t\tlet activity;\n\t\ttry {\n\t\t\tactivity = await startTransactionActivity({\n\t\t\t\tmiddleware: this.middleware,\n\t\t\t\tcontext: {\n\t\t\t\t\t...this.sqlCtx,\n\t\t\t\t\tscope: \"transaction\"\n\t\t\t\t},\n\t\t\t\tparent,\n\t\t\t\tholdFinishedChildren: this.#holdFinishedChildren\n\t\t\t});\n\t\t} catch (error) {\n\t\t\tendTransactionWork();\n\t\t\tthis.#startingTransactions.delete(connection);\n\t\t\towner[transactionStart].refusedBeforeBegin = true;\n\t\t\tthrow error;\n\t\t}\n\t\tlet driverTx;\n\t\ttry {\n\t\t\tdriverTx = await connection.beginTransaction(options === void 0 ? void 0 : driverOptions);\n\t\t} catch (error) {\n\t\t\tendTransactionWork();\n\t\t\tthis.#startingTransactions.delete(connection);\n\t\t\tawait activity.end({\n\t\t\t\tby: \"rollback\",\n\t\t\t\toutcome: \"failed\",\n\t\t\t\tcommitAttempted: false\n\t\t\t});\n\t\t\tthrow error;\n\t\t}\n\t\tif (this.#heldQueryables.has(connection)) this.#heldQueryables.add(driverTx);\n\t\tconst transaction = new OuterTransaction(this.#transactionRuntime, connection, driverTx, activity, endTransactionWork, timeout);\n\t\tthis.#startingTransactions.delete(connection);\n\t\treturn transaction;\n\t}\n\ttelemetry() {\n\t\tconst pending = this._pendingTelemetry;\n\t\tif (pending === null) return null;\n\t\tif (this._telemetryCache === null) this._telemetryCache = Object.freeze({\n\t\t\tlane: pending.lane,\n\t\t\ttarget: pending.target,\n\t\t\tfingerprint: computeSqlFingerprint(pending.sql),\n\t\t\toutcome: pending.outcome,\n\t\t\t...ifDefined(\"durationMs\", pending.durationMs)\n\t\t});\n\t\treturn this._telemetryCache;\n\t}\n\tclose() {\n\t\tthis.closePromise ??= this.closeDriverAfterWork();\n\t\treturn this.closePromise;\n\t}\n\tasync closeDriverAfterWork() {\n\t\tawait this.refuseAfterWork();\n\t\tif (this.ownsDriver) await this.driver.close();\n\t}\n\tasync refuseAfterWork() {\n\t\tconst warned = { done: false };\n\t\tif (this.closeRefusal === \"when-idle\") await this.waitForIdleTurn(warned);\n\t\tthis.#refusing = true;\n\t\tthis.warnWhenWaitingOnlyForUnendedWork(warned);\n\t\twhile (this.#inFlight.active || this.#openTransactionWork.active) {\n\t\t\tawait this.#inFlight.drained();\n\t\t\tthis.warnWhenWaitingOnlyForUnendedWork(warned);\n\t\t\tawait this.#openTransactionWork.drained();\n\t\t}\n\t}\n\tasync waitForIdleTurn(warned) {\n\t\tfor (;;) {\n\t\t\tconst startedBefore = this.#inFlight.started;\n\t\t\tawait new Promise((resolve) => scheduleTimer(resolve, 0));\n\t\t\tif (!this.#inFlight.active && this.#inFlight.started === startedBefore) return;\n\t\t\tthis.warnWhenWaitingOnlyForUnendedWork(warned);\n\t\t\tawait this.#inFlight.drained();\n\t\t}\n\t}\n\tensureCodecRegistryValidated() {\n\t\tif (!this.codecRegistryValidated) {\n\t\t\tvalidateCodecRegistryCompleteness(this.codecDescriptors, this.contract);\n\t\t\tthis.codecRegistryValidated = true;\n\t\t}\n\t}\n\tasync verifyMarker(queryable) {\n\t\tconst readResult = await this.familyAdapter.markerReader.readMarker(queryable);\n\t\tconst expectedStorageHash = this.contract.storage.storageHash;\n\t\tconst expectedProfileHash = this.contract.profileHash ?? null;\n\t\tconst expected = {\n\t\t\tstorageHash: expectedStorageHash,\n\t\t\tprofileHash: expectedProfileHash\n\t\t};\n\t\tif (readResult.kind !== \"present\") {\n\t\t\tthis.sqlCtx.log.warn({\n\t\t\t\tcode: \"CONTRACT.MARKER_MISSING\",\n\t\t\t\tscope: \"marker-verification\",\n\t\t\t\texpected,\n\t\t\t\tactual: null,\n\t\t\t\tmessage: \"Contract marker not found in database\"\n\t\t\t});\n\t\t\treturn;\n\t\t}\n\t\tconst marker = readResult.record;\n\t\tconst storageHashMatch = marker.storageHash === expectedStorageHash;\n\t\tconst profileHashMatch = expectedProfileHash === null || marker.profileHash === expectedProfileHash;\n\t\tif (!storageHashMatch || !profileHashMatch) this.sqlCtx.log.warn({\n\t\t\tcode: \"CONTRACT.MARKER_MISMATCH\",\n\t\t\tscope: \"marker-verification\",\n\t\t\texpected,\n\t\t\tactual: {\n\t\t\t\tstorageHash: marker.storageHash,\n\t\t\t\tprofileHash: marker.profileHash ?? null\n\t\t\t},\n\t\t\tmessage: \"Contract marker hash does not match runtime contract\"\n\t\t});\n\t}\n\trecordTelemetry(plan, outcome, durationMs) {\n\t\tthis._pendingTelemetry = {\n\t\t\tlane: plan.meta.lane,\n\t\t\ttarget: this.contract.target,\n\t\t\tsql: plan.sql,\n\t\t\toutcome,\n\t\t\tdurationMs\n\t\t};\n\t\tthis._telemetryCache = null;\n\t}\n};\nfunction activityOutsideTransactionError(parent, openTransaction) {\n\treturn runtimeError(\"RUNTIME.ACTIVITY_OUTSIDE_TRANSACTION\", `Work was sent through a '${parent.activity.kind}' activity onto a connection whose open transaction the activity is not part of. Start the activity on the transaction instead.`, {\n\t\tkind: parent.activity.kind,\n\t\tid: parent.activity.id,\n\t\ttransactionId: openTransaction.activity.id\n\t});\n}\nfunction transactionAlreadyOpenError(parent, openTransaction) {\n\treturn runtimeError(\"RUNTIME.TRANSACTION_ALREADY_OPEN\", `A transaction is already open on this connection; a '${parent.activity.kind}' activity cannot begin another until it commits or rolls back.`, {\n\t\tkind: parent.activity.kind,\n\t\tid: parent.activity.id,\n\t\ttransactionId: openTransaction?.activity.id\n\t});\n}\nfunction noWork() {}\nfunction rowsBeneath(run, rows) {\n\treturn new AsyncIterableResult(new RowsBeneath(run, rows));\n}\n/** The rows of a statement started beneath `run`, checked against `run` on the first `next()`. It forwards to the statement's own iterator rather than adding an async generator, so each row costs no extra turn. */\nvar RowsBeneath = class {\n\t#run;\n\t#rows;\n\t#inner;\n\t#done = false;\n\tconstructor(run, rows) {\n\t\tthis.#run = run;\n\t\tthis.#rows = rows;\n\t}\n\tnext() {\n\t\tif (this.#done) return Promise.resolve({\n\t\t\tdone: true,\n\t\t\tvalue: void 0\n\t\t});\n\t\tif (this.#inner === void 0) try {\n\t\t\tthis.#run.assertAcceptsChildren();\n\t\t\tthis.#inner = this.#rows()[Symbol.asyncIterator]();\n\t\t} catch (error) {\n\t\t\tthis.#done = true;\n\t\t\treturn Promise.reject(error);\n\t\t}\n\t\treturn this.#inner.next();\n\t}\n\treturn() {\n\t\tconst inner = this.#inner;\n\t\tthis.#done = true;\n\t\treturn inner?.return === void 0 ? Promise.resolve({\n\t\t\tdone: true,\n\t\t\tvalue: void 0\n\t\t}) : inner.return();\n\t}\n\tthrow(error) {\n\t\tconst inner = this.#inner;\n\t\tif (inner?.throw === void 0) {\n\t\t\tthis.#done = true;\n\t\t\treturn Promise.reject(error);\n\t\t}\n\t\treturn inner.throw(error);\n\t}\n\t[Symbol.asyncIterator]() {\n\t\treturn this;\n\t}\n\tasync [Symbol.asyncDispose]() {\n\t\tawait this.return();\n\t}\n};\n/**\n* Adds a client's members to the context `withTransaction` passes. The context is the prototype, not spread, so live accessors such as `invalidated` keep reading the transaction's state; spreading would copy their value once.\n*/\nfunction withTransactionMembers(txCtx, members) {\n\treturn Object.assign(castAs(Object.create(txCtx)), members);\n}\nasync function withTransaction(runtime, fn, options, parent) {\n\tvalidateTransactionTimeout(options?.timeout);\n\tconst connection = await runtime.connection(parent === void 0 ? void 0 : { activityParent: parent });\n\tconst state = {\n\t\tclean: true,\n\t\treason: void 0\n\t};\n\ttry {\n\t\treturn await runTransactionOn(connection, fn, options, state);\n\t} finally {\n\t\tif (!state.clean) await connection.destroy(state.reason).catch(() => void 0);\n\t\telse if (wasRefusedBeforeBegin(connection)) await connection.release().catch(() => void 0);\n\t\telse await connection.release();\n\t}\n}\nasync function runTransactionOn(connection, fn, options, state) {\n\tvalidateTransactionTimeout(options?.timeout);\n\tlet transaction;\n\ttry {\n\t\ttransaction = await connection.transaction(options);\n\t} catch (error) {\n\t\tif (!wasRefusedBeforeBegin(connection)) {\n\t\t\tstate.clean = false;\n\t\t\tstate.reason = error;\n\t\t}\n\t\tthrow error;\n\t}\n\ttry {\n\t\treturn await runAndSettleTransaction(transaction, fn);\n\t} catch (error) {\n\t\tconst settlement = settlementOf(transaction);\n\t\tif (settlement?.committed !== true && settlement?.rolledBack !== true) {\n\t\t\tstate.clean = false;\n\t\t\tstate.reason = error;\n\t\t}\n\t\tthrow error;\n\t}\n}\nfunction savepointOn(transaction) {\n\treturn async (parent, fn, options) => {\n\t\tif (options !== void 0) throw savepointOptionsUnsupportedError(options);\n\t\treturn runInSavepoint(() => transaction.transactionBeneath(parent), fn);\n\t};\n}\nasync function runInSavepoint(open, fn) {\n\tconst savepoint = await open();\n\ttry {\n\t\treturn await runAndSettleTransaction(savepoint, fn);\n\t} catch (error) {\n\t\tif (savepoint.signal.aborted && error === savepoint.signal.reason) await savepoint.rollback().catch(() => void 0);\n\t\tthrow error;\n\t}\n}\nfunction guardedTransactionContext(transaction, isClosed) {\n\tasync function* guardedStream(open) {\n\t\tif (isClosed()) throw transactionClosedError();\n\t\tfor await (const row of open()) {\n\t\t\tif (isClosed()) throw transactionClosedError();\n\t\t\tyield row;\n\t\t\tif (isClosed()) throw transactionClosedError();\n\t\t}\n\t}\n\tfunction guardedQueryable(target) {\n\t\treturn {\n\t\t\tquery(plan, options) {\n\t\t\t\treturn new AsyncIterableResult(guardedStream(() => target.query(plan, options)));\n\t\t\t},\n\t\t\tasync execute(plan, options) {\n\t\t\t\tif (isClosed()) throw transactionClosedError();\n\t\t\t\treturn target.execute(plan, options);\n\t\t\t},\n\t\t\t[preparedStatementQuery](ps, params, options) {\n\t\t\t\treturn new AsyncIterableResult(guardedStream(() => runPreparedQuery(target, ps, params, options)));\n\t\t\t},\n\t\t\tasync [preparedStatementExecute](ps, params, options) {\n\t\t\t\tif (isClosed()) throw transactionClosedError();\n\t\t\t\treturn runPreparedExecute(target, ps, params, options);\n\t\t\t}\n\t\t};\n\t}\n\tfunction guardedSource(target) {\n\t\treturn {\n\t\t\tasync startActivity(activity) {\n\t\t\t\tif (isClosed()) throw transactionClosedError();\n\t\t\t\treturn guardedHandle(await startActivityOn(target, activity));\n\t\t\t},\n\t\t\tplanContentHash(plan) {\n\t\t\t\treturn planContentHashOn(target, plan);\n\t\t\t}\n\t\t};\n\t}\n\tfunction guardedHandle(handle) {\n\t\tconst source = guardedSource(handle);\n\t\treturn {\n\t\t\t...source,\n\t\t\t...guardedQueryable(handle),\n\t\t\t[activitySource]: source,\n\t\t\tactivity: handle.activity,\n\t\t\tget intercepted() {\n\t\t\t\treturn handle.intercepted;\n\t\t\t},\n\t\t\tinTransaction: () => handle.inTransaction(),\n\t\t\tasync transaction(fn, options) {\n\t\t\t\tif (isClosed()) throw transactionClosedError();\n\t\t\t\treturn handle.transaction(fn, options);\n\t\t\t},\n\t\t\tend: (end) => handle.end(end)\n\t\t};\n\t}\n\treturn {\n\t\t...guardedQueryable(transaction),\n\t\tget invalidated() {\n\t\t\treturn isClosed();\n\t\t},\n\t\t[activitySource]: guardedSource(transaction),\n\t\tasync transaction(fn) {\n\t\t\tif (isClosed()) throw transactionClosedError();\n\t\t\treturn runInSavepoint(() => transaction.transaction(), fn);\n\t\t}\n\t};\n}\nasync function runAndSettleTransaction(transaction, fn) {\n\tlet invalidated = false;\n\tconst signal = transaction.signal;\n\tlet rejectAbort = (_reason) => {};\n\tconst aborted = new Promise((_, reject) => {\n\t\trejectAbort = reject;\n\t});\n\taborted.catch(() => void 0);\n\tconst onAbort = () => {\n\t\tinvalidated = true;\n\t\trejectAbort(signal.reason);\n\t};\n\tsignal.addEventListener(\"abort\", onAbort, { once: true });\n\tif (signal.aborted) onAbort();\n\tconst settlement = settlementOf(transaction);\n\tconst txContext = guardedTransactionContext(transaction, () => invalidated || settlement?.closed === true);\n\tlet commitRequested = false;\n\ttry {\n\t\tsignal.throwIfAborted();\n\t\tconst result = await Promise.race([Promise.resolve(fn(txContext)), aborted]);\n\t\tinvalidated = true;\n\t\tcommitRequested = true;\n\t\tawait transaction.commit();\n\t\treturn result;\n\t} catch (error) {\n\t\tif (signal.aborted) throw signal.reason;\n\t\tif (!commitRequested) {\n\t\t\tconst selected = error;\n\t\t\tinvalidated = true;\n\t\t\ttry {\n\t\t\t\tawait transaction.rollback();\n\t\t\t} catch (rollbackError) {\n\t\t\t\tif (settlement?.rolledBack === true) {\n\t\t\t\t\tsettlement.logDroppedError(rollbackError);\n\t\t\t\t\tthrow selected;\n\t\t\t\t}\n\t\t\t\tawait settlement?.abandon();\n\t\t\t\tconst wrapped = runtimeError(\"RUNTIME.TRANSACTION_ROLLBACK_FAILED\", \"Transaction rollback failed after callback error\", { rollbackError });\n\t\t\t\twrapped.cause = selected;\n\t\t\t\tthrow wrapped;\n\t\t\t}\n\t\t\tthrow selected;\n\t\t}\n\t\tif (settlement?.committed === true) throw error;\n\t\ttry {\n\t\t\tawait transaction.rollback();\n\t\t} catch (rollbackError) {\n\t\t\tif (settlement?.rolledBack === true) settlement.logDroppedError(rollbackError);\n\t\t\telse await settlement?.abandon();\n\t\t}\n\t\tconst wrapped = runtimeError(\"RUNTIME.TRANSACTION_COMMIT_FAILED\", \"Transaction commit failed\", { commitError: error });\n\t\twrapped.cause = error;\n\t\tthrow wrapped;\n\t} finally {\n\t\tinvalidated = true;\n\t\tsignal.removeEventListener(\"abort\", onAbort);\n\t}\n}\n//#endregion\n//#region src/to-sql.ts\nfunction createToSql(stack, contract) {\n\tlet adapter;\n\treturn (plan) => {\n\t\tvalidateSqlPlan(plan, contract);\n\t\tadapter ??= stack.adapter.create(stack);\n\t\tconst { sql, params } = lowerSqlPlan(adapter, contract, plan);\n\t\treturn {\n\t\t\tsql,\n\t\t\tparams\n\t\t};\n\t};\n}\n//#endregion\nexport { activitySource as C, planContentHashOn as D, lazyActivitySource as E, startActivityOn as O, createAstCodecRegistry as S, findActivitySource as T, extractCodecIds as _, buildDecodeContext as a, deriveParamMetadata as b, createExecutionContext as c, PreparedStatementImpl as d, lints as f, delegatingRuntime as g, toRuntimeOptions as h, withTransactionMembers as i, createSqlExecutionStack as l, lowerSqlPlan as m, SqlRuntimeBase as n, decodeRow as o, budgets as p, withTransaction as r, sqlNativeArrayListDecoder as s, createToSql as t, PreparedExecutionImpl as u, validateCodecRegistryCompleteness as v, delegatingActivitySource as w, encodeParamsWithMetadata as x, validateContractCodecMappings as y };\n\n//# sourceMappingURL=exports-BLvDBaFs.mjs.map"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAqBA,MAAM,iBAAiB,OAAO,gBAAgB;AAC9C,SAAS,wBAAwB,QAAQ;CACxC,OAAO,kBAAkB;AAC1B;;AAEA,SAAS,mBAAmB,QAAQ;CACnC,OAAO,wBAAwB,MAAM,IAAI,OAAO,kBAAkB,KAAK;AACxE;AACA,SAAS,iBAAiB,QAAQ;CACjC,MAAM,SAAS,mBAAmB,MAAM;CACxC,UAAU,WAAW,KAAK,GAAG,uCAAuC;CACpE,OAAO;AACR;;AAEA,SAAS,mBAAmB,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,eAAa,qCAAqC,6BAA6B,EAAE,aAAa,MAAM,CAAC;EACrH,QAAQ,QAAQ;EAChB,MAAM;CACP,UAAU;EACT,cAAc;EACd,OAAO,oBAAoB,SAAS,OAAO;CAC5C;AACD;AAGA,SAAS,YAAY,OAAO,UAAU;CACrC,IAAI;CACJ,QAAQ,SAAS;EAChB,gBAAgB,MAAM,QAAQ;EAC9B,YAAY,MAAM,QAAQ,OAAO,KAAK;EACtC,MAAM,EAAE,KAAK,WAAW,aAAa,SAAS,UAAU,IAAI;EAC5D,OAAO;GACN;GACA;EACD;CACD;AACD"}
|
|
@@ -22,7 +22,7 @@ import { Contract, PlanMeta } from "@prisma/orm-framework/contract/types";
|
|
|
22
22
|
import { AnyCodecDescriptor, CodecDescriptor } from "@prisma/orm-framework/components/codec";
|
|
23
23
|
import { Activity, Activity as Activity$1, ActivityContext, ActivityEndedResult, ActivityEndedResult as ActivityEndedResult$1, ActivityFinalizedResult, ActivityFinalizedResult as ActivityFinalizedResult$1, ActivityInterceptResult, ActivityInterceptResult as ActivityInterceptResult$1, ActivityParent, ActivityParent as ActivityParent$1, AsyncIterableResult, ClientActivity, ClientActivity as ClientActivity$1, ClientActivityEnd, ClientActivityEnd as ClientActivityEnd$1, ClientActivityEnded, ClientActivityKind, ClientActivityKind as ClientActivityKind$1, ClientActivityResult, ClientActivityResult as ClientActivityResult$1, ExecuteInterceptResult, ExecuteInterceptResult as ExecuteInterceptResult$1, ExecutionPlan, MutationDefaultGeneratorContributor, QueryInterceptResult, QueryInterceptResult as QueryInterceptResult$1, RuntimeCore, RuntimeExecuteOptions, RuntimeLog, RuntimeLog as Log, RuntimeMiddleware, RuntimeMode, RuntimeMode as RuntimeMode$1, StartActivity, StartActivity as StartActivity$1, StatementActivity, StatementEnded, TransactionActivity, TransactionEnded } from "@prisma/orm-framework/components/runtime";
|
|
24
24
|
import { RuntimeAdapterDescriptor, RuntimeAdapterInstance, RuntimeDriverDescriptor, RuntimeDriverInstance, RuntimeExtensionDescriptor, RuntimeExtensionInstance, RuntimeTargetDescriptor, RuntimeTargetInstance } from "@prisma/orm-framework/components/execution";
|
|
25
|
-
//#region ../../../2-sql-family/5-runtime/dist/activity-handle-
|
|
25
|
+
//#region ../../../2-sql-family/5-runtime/dist/activity-handle-Dpu6jITI.d.mts
|
|
26
26
|
//#region src/codecs/decoding.d.ts
|
|
27
27
|
type ColumnRef = {
|
|
28
28
|
table: string;
|
|
@@ -330,7 +330,7 @@ interface ActivityRoute {
|
|
|
330
330
|
execute(plan: SqlExecutionPlan<unknown> | SqlQueryPlan<unknown>, options: ActivityExecuteOptions): Promise<SqlStatementStats>;
|
|
331
331
|
preparedQuery<Params, Row>(statement: PreparedStatementImpl<Params, Row>, params: Params, options: ActivityExecuteOptions): AsyncIterableResult<Row>;
|
|
332
332
|
preparedExecute<Params>(statement: PreparedExecutionImpl<Params>, params: Params, options: ActivityExecuteOptions): Promise<SqlStatementStats>;
|
|
333
|
-
readonly transaction:
|
|
333
|
+
readonly transaction: <R>(parent: ActivityParent, fn: (tx: TransactionContext) => PromiseLike<R>, options?: RuntimeTransactionOptions) => Promise<R>;
|
|
334
334
|
/** Whether an open activity on the route is runtime work that `close()` waits for. */
|
|
335
335
|
readonly runtimeWork: boolean;
|
|
336
336
|
}
|
|
@@ -499,8 +499,9 @@ interface ActivityHandle<K extends ClientActivityKind> extends RuntimeQueryable,
|
|
|
499
499
|
readonly intercepted: {
|
|
500
500
|
readonly result: ClientActivityResult<K>;
|
|
501
501
|
} | undefined;
|
|
502
|
-
/** Runs `fn` in a transaction beneath the activity, as `withTransaction` does. On a handle opened on a connection, the transaction runs on that connection and leaves it held.
|
|
503
|
-
readonly transaction
|
|
502
|
+
/** Runs `fn` in a transaction beneath the activity, as `withTransaction` does. On a handle opened on a connection, the transaction runs on that connection and leaves it held. On a handle opened inside a transaction, or on a connection whose transaction is open, it runs `fn` in a savepoint of that transaction and rejects with `RUNTIME.SAVEPOINT_OPTIONS_UNSUPPORTED` when given options. */
|
|
503
|
+
readonly transaction: <R>(fn: (tx: TransactionContext) => PromiseLike<R>, options?: RuntimeTransactionOptions) => Promise<R>;
|
|
504
|
+
inTransaction(): boolean;
|
|
504
505
|
/** Ends the activity. Rejects with `RUNTIME.ACTIVITY_CHILDREN_OPEN` when a statement or activity beneath it has not ended, after ending it `failed`. */
|
|
505
506
|
end(end: ClientActivityEnd<K>): Promise<void>;
|
|
506
507
|
}
|
|
@@ -624,4 +625,4 @@ interface ToSqlMember {
|
|
|
624
625
|
declare function createToSql<TTargetId extends string>(stack: SqlExecutionStack<TTargetId>, contract: Contract<SqlStorage>): ToSqlMember['toSql'];
|
|
625
626
|
//#endregion
|
|
626
627
|
export { RuntimeOptions as $, extractCodecIds as A, withTransaction as At, ActivitySourceTarget as B, ToSqlMember as C, delegatingActivitySource as Ct, createAstCodecRegistry as D, lazyActivitySource as Dt, budgets as E, findActivitySource as Et, validateContractCodecMappings as F, MarkerReader as G, CloseRefusal as H, ActivityExecuteOptions as I, PreparedStatementInternals as J, PreparedExecutionImpl as K, ActivityHandle as L, lowerSqlPlan as M, toRuntimeOptions as N, createToSql as O, planContentHashOn as Ot, validateCodecRegistryCompleteness as P, RuntimeFamilyAdapter as Q, ActivityRoute as R, StatementEnded as S, createSqlExecutionStack as St, TransactionEnded as T, encodeParamsWithMetadata as Tt, ConnectionProvider as U, BoundPreparedStatement as V, HashablePlan as W, RuntimeConnection as X, Runtime as Y, RuntimeExecutionOptions as Z, RenderedSql as _, TelemetryOutcome as _t, ActivityParent$1 as a, SqlExecutionStack as at, StartActivity$1 as b, activitySource as bt, ClientActivityEnd$1 as c, SqlMiddlewareContext as ct, ClientActivityResult$1 as d, SqlRuntimeBase as dt, RuntimeParameterizedCodecDescriptor as et, DelegatingRuntime as f, SqlRuntimeDriverInstance as ft, QueryInterceptResult$1 as g, SqlStaticContributions as gt, Log as h, SqlRuntimeTargetDescriptor as ht, ActivityInterceptResult$1 as i, RuntimeTransactionOptions as it, lints as j, withTransactionMembers as jt, delegatingRuntime as k, startActivityOn as kt, ClientActivityEnded as l, SqlRuntimeAdapterDescriptor as lt, LintsOptions as m, SqlRuntimeExtensionInstance as mt, ActivityEndedResult$1 as n, RuntimeTelemetryEvent as nt, BudgetsOptions as o, SqlExecutionStackWithDriver as ot, ExecuteInterceptResult$1 as p, SqlRuntimeExtensionDescriptor as pt, PreparedStatementImpl as q, ActivityFinalizedResult$1 as r, RuntimeTransaction as rt, ClientActivity$1 as s, SqlMiddleware as st, Activity$1 as t, RuntimeQueryable as tt, ClientActivityKind$1 as u, SqlRuntimeAdapterInstance as ut, RuntimeMode$1 as v, TransactionContext as vt, TransactionActivity as w, deriveParamMetadata as wt, StatementActivity as x, createExecutionContext as xt, SqlExecutionOptions as y, VerifyMarkerOption as yt, ActivitySource as z };
|
|
627
|
-
//# sourceMappingURL=index-
|
|
628
|
+
//# sourceMappingURL=index-CI6diFcZ.d.mts.map
|