@prisma/orm-family-sql 8.0.0-rc.18-dev.17 → 8.0.0-rc.18-dev.18
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-DVsHk8HP-DrH_2a-H.mjs +2371 -0
- package/dist/exports-DVsHk8HP-DrH_2a-H.mjs.map +1 -0
- package/dist/{index-DWNoqFzr.d.mts → index-BxlXOVeT.d.mts} +14 -7
- package/dist/{index-DWNoqFzr.d.mts.map → index-BxlXOVeT.d.mts.map} +1 -1
- package/dist/orm-client.d.mts +12 -44
- package/dist/orm-client.d.mts.map +1 -1
- package/dist/orm-client.mjs +505 -187
- package/dist/orm-client.mjs.map +1 -1
- package/dist/runtime.d.mts +2 -2
- package/dist/runtime.mjs +1 -2289
- package/package.json +18 -18
- package/dist/runtime.mjs.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"exports-DVsHk8HP-DrH_2a-H.mjs","names":["runtimeError","#count","#started","#drainWaiters","#ast","#holdFinishedChildren","#runtimeRoute","#openTransactions","#heldQueryables","#openActivityHandles","#inFlight","#refusing","#preparedStatementHandles","#run","#rows","#done","#inner"],"sources":["../../../../2-sql/5-runtime/dist/exports-DVsHk8HP.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 { blindCast, castAs } from \"@internal/utils/casts\";\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 { 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 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 {\n\t\tstartActivity: (activity) => startActivityOn(target(), activity),\n\t\tplanContentHash: (plan) => planContentHashOn(target(), plan)\n\t};\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/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\", `Ad-hoc execute received a bind-site slot for '${slot.name}' — bind-site references are only valid inside runtime.prepare(...).`, { 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 documentScopedCodecTypes(contract) {\n\treturn blindCast(contract.storage.types);\n}\nfunction createSqlExecutionStack(options) {\n\treturn createExecutionStack({\n\t\ttarget: options.target,\n\t\tadapter: options.adapter,\n\t\tdriver: options.driver,\n\t\textensions: options.extensions\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 ${context.typeName ? `type '${context.typeName}'` : `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 collectTypeRefSites(storage) {\n\tconst sites = /* @__PURE__ */ new Map();\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)) {\n\t\tif (typeof column.typeRef !== \"string\") continue;\n\t\tconst list = sites.get(column.typeRef);\n\t\tconst entry = {\n\t\t\ttable: tableName,\n\t\t\tcolumn: columnName\n\t\t};\n\t\tif (list) list.push(entry);\n\t\telse sites.set(column.typeRef, [entry]);\n\t}\n\treturn sites;\n}\nfunction initializeTypeHelpers(storage, documentTypes, codecDescriptors) {\n\tconst helpers = {};\n\tif (!documentTypes) return helpers;\n\tconst typeRefSites = collectTypeRefSites(storage);\n\tfor (const [typeName, typeInstance] of Object.entries(documentTypes)) {\n\t\tconst codecId = typeInstance.codecId;\n\t\tconst typeParams = typeInstance.typeParams;\n\t\tconst descriptor = codecDescriptors.get(codecId);\n\t\tif (!descriptor) {\n\t\t\thelpers[typeName] = typeInstance;\n\t\t\tcontinue;\n\t\t}\n\t\tconst validatedParams = validateTypeParams(typeParams ?? {}, descriptor, { typeName });\n\t\tconst ctx = {\n\t\t\tname: typeName,\n\t\t\tusedAt: typeRefSites.get(typeName) ?? []\n\t\t};\n\t\thelpers[typeName] = descriptor.factory(validatedParams)(ctx);\n\t}\n\treturn helpers;\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, or use a typeRef pointing at a storage.types entry that carries them.`, {\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.types` and `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* - typeRef-shared columns use the `storage.types[name]` name.\n* - inline-`typeParams` columns 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\tconst typeRefSites = collectTypeRefSites(contract.storage);\n\tfor (const [typeName, typeInstance] of Object.entries(documentScopedCodecTypes(contract) ?? {})) {\n\t\tconst instanceTypeParams = typeInstance.typeParams;\n\t\tconst key = refKeyOf(instanceTypeParams !== void 0 && Object.keys(instanceTypeParams).length > 0 ? {\n\t\t\tcodecId: typeInstance.codecId,\n\t\t\ttypeParams: blindCast(instanceTypeParams)\n\t\t} : { codecId: typeInstance.codecId });\n\t\tconst sites = typeRefSites.get(typeName) ?? [];\n\t\tconst existing = usedAtByKey.get(key);\n\t\tif (existing) existing.push(...sites);\n\t\telse {\n\t\t\tusedAtByKey.set(key, [...sites]);\n\t\t\tnameByKey.set(key, typeName);\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, column] of Object.entries(table.columns)) {\n\t\tif (column.typeRef !== void 0) continue;\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\tconst types = initializeTypeHelpers(contract.storage, documentScopedCodecTypes(contract), parameterizedCodecDescriptors);\n\treturn {\n\t\tcontract,\n\t\tcontractCodecs: buildContractCodecRegistry(contract, codecDescriptors),\n\t\tcodecDescriptors,\n\t\taggregateDescriptors,\n\t\tqueryOperations: queryOperationRegistry,\n\t\ttypes,\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\tfor (const [name, column] of Object.entries(ast.result.columns)) {\n\t\taliases.push(name);\n\t\tif (contractCodecs) codecs.set(name, contractCodecs.forCodecRef({ codecId: column.codecId }));\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: EMPTY_MANY_ALIASES,\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/owned-transaction.ts\n/**\n* Begins a transaction on a connection the transaction owns. The connection is released once the transaction has committed or rolled back, and destroyed after a failed rollback or a failed start other than a refusal before `BEGIN`. After a failed commit it stays held for the rollback that follows. A release that fails after the transaction settled is passed to `log.error`, and `commit()` or `rollback()` keeps its own outcome.\n*/\nasync function beginOwnedTransaction(connection, begin, log) {\n\tlet transaction;\n\ttry {\n\t\ttransaction = await begin();\n\t} catch (error) {\n\t\tif (wasRefusedBeforeBegin(connection)) await connection.release().catch(() => void 0);\n\t\telse await connection.destroy(error).catch(() => void 0);\n\t\tthrow error;\n\t}\n\tlet disposed = false;\n\tconst dispose = async (destroyReason) => {\n\t\tif (disposed) return;\n\t\tdisposed = true;\n\t\tif (destroyReason !== void 0) {\n\t\t\tawait connection.destroy(destroyReason.reason).catch(() => void 0);\n\t\t\treturn;\n\t\t}\n\t\ttry {\n\t\t\tawait connection.release();\n\t\t} catch (error) {\n\t\t\ttry {\n\t\t\t\tlog.error({\n\t\t\t\t\tevent: \"runtime.connection.release.error\",\n\t\t\t\t\terror\n\t\t\t\t});\n\t\t\t} catch {}\n\t\t}\n\t};\n\treturn Object.assign(castAs(Object.create(transaction)), {\n\t\tasync commit() {\n\t\t\ttry {\n\t\t\t\tawait transaction.commit();\n\t\t\t} catch (error) {\n\t\t\t\tif (settlementOf(transaction)?.committed === true) await dispose();\n\t\t\t\tthrow error;\n\t\t\t}\n\t\t\tawait dispose();\n\t\t},\n\t\tasync rollback() {\n\t\t\ttry {\n\t\t\t\tawait transaction.rollback();\n\t\t\t} catch (error) {\n\t\t\t\tconst settlement = settlementOf(transaction);\n\t\t\t\tconst settled = settlement?.rolledBack === true || settlement?.committed === true;\n\t\t\t\tawait dispose(settled ? void 0 : { reason: error });\n\t\t\t\tthrow error;\n\t\t\t}\n\t\t\tawait dispose();\n\t\t}\n\t});\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/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\tif (plan.meta.target !== contract.target) throw runtimeError(\"PLAN.TARGET_MISMATCH\", \"Plan target does not match runtime target\", {\n\t\t\tplanTarget: plan.meta.target,\n\t\t\truntimeTarget: contract.target\n\t\t});\n\t\tif (plan.meta.storageHash !== contract.storage.storageHash) throw runtimeError(\"PLAN.HASH_MISMATCH\", \"Plan storage hash does not match runtime contract\", {\n\t\t\tplanStorageHash: plan.meta.storageHash,\n\t\t\truntimeStorageHash: contract.storage.storageHash\n\t\t});\n\t}\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\tcloseRefusal;\n\t#inFlight = new InFlightOperations();\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#openTransactions = /* @__PURE__ */ new WeakMap();\n\tcodecRegistryValidated;\n\t_telemetry;\n\tconstructor(options) {\n\t\tconst { context, adapter, driver, verifyMarker, middleware, mode, log, closeRefusal } = 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._telemetry = 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) => this.beginOwnedTransactionBeneath(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.#openTransactions.get(connection);\n\t\treturn this.queryableRoute(connection, \"connection\", () => openTransaction, {\n\t\t\ttransaction: openTransaction === void 0 ? (parent) => this.beginTransactionBeneathOn(connection, owner, parent) : void 0,\n\t\t\truntimeWork: false\n\t\t});\n\t}\n\tbeginTransactionBeneathOn(connection, owner, parent) {\n\t\tconst openTransaction = this.#openTransactions.get(connection);\n\t\tif (openTransaction !== void 0) return Promise.reject(transactionAlreadyOpenError(parent, openTransaction));\n\t\treturn this.beginTransactionOn(connection, owner, parent);\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.#openTransactions.get(connection))\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\tconst handle = {\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\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\tconst beginTransaction = route.transaction;\n\t\tif (beginTransaction === void 0) return handle;\n\t\treturn Object.assign(handle, { transaction: async () => {\n\t\t\trun.assertAcceptsChildren();\n\t\t\treturn beginTransaction(run);\n\t\t} });\n\t}\n\tasync beginOwnedTransactionBeneath(parent) {\n\t\tconst { driverConnection, connection } = await this.openConnection({ activityParent: parent });\n\t\treturn this.ownTransaction(connection, () => this.beginTransactionOn(driverConnection, connection, parent));\n\t}\n\t/** Begins a transaction with `begin` on a connection the transaction owns; see `beginOwnedTransaction`. */\n\townTransaction(connection, begin) {\n\t\treturn beginOwnedTransaction(connection, begin, this.sqlCtx.log);\n\t}\n\t/**\n\t* Returns the raw driver connection. The connection is a `SqlQueryable` — SQL\n\t* issued on it runs below the middleware/codec/telemetry pipeline. It carries\n\t* its own lifecycle (`release`/`destroy`/`beginTransaction`); the caller owns\n\t* disposal.\n\t*/\n\tacquireRawConnection() {\n\t\treturn this.driver.acquireConnection();\n\t}\n\tasync setupDriverExecution(exec, queryable) {\n\t\tthis.familyAdapter.validatePlan(exec, this.contract);\n\t\tthis._telemetry = 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\twarnWhenWaitingOnlyForActivities(warned) {\n\t\tif (warned.done || this.#openActivityHandles === 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});\n\t}\n\tbeginOperation(queryable, options) {\n\t\tif (queryable === this.driver && this.#refusing && options?.activityParent === void 0) throw runtimeClosedError();\n\t\treturn this.#inFlight.begin();\n\t}\n\tparentOf(queryable, options) {\n\t\tconst openTransaction = this.#openTransactions.get(queryable);\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, onDriverAnswered) {\n\t\tconst rowDecodeContext = createDecodeContext();\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, driverCall)[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\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(queryable, 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, 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) => {\n\t\t\tconst exec = await this.prepareOperation(plan, codecCtx, run);\n\t\t\treturn this.executeEncodedPlan(run, exec, queryable, 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\treturn executeStatement({\n\t\t\tmiddleware: this.middleware,\n\t\t\tplan,\n\t\t\tcontext,\n\t\t\tparent: this.parentOf(queryable, options)\n\t\t}, body);\n\t}\n\tasync executeEncodedPlan(run, exec, queryable, codecCtx, driverCall) {\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, driverCall);\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\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(queryable, options)\n\t\t\t\t}, (run) => self.streamPreparedRows(run, ps, userParams, queryable, 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, 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, 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) => this.executePrepared(run, ps, userParams, queryable, codecCtx));\n\t}\n\tasync executePrepared(run, ps, userParams, queryable, 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, codecCtx, () => queryable.execute(request));\n\t}\n\tasync connection() {\n\t\treturn (await this.openConnection()).connection;\n\t}\n\tasync openConnection(options) {\n\t\tconst endOperation = this.beginOperation(this.driver, options);\n\t\tlet driverConn;\n\t\ttry {\n\t\t\tdriverConn = await this.driver.acquireConnection();\n\t\t} finally {\n\t\t\tendOperation();\n\t\t}\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() {\n\t\t\t\treturn self.beginTransactionOn(driverConn, wrappedConnection, void 0);\n\t\t\t},\n\t\t\t[activitySource]: self.connectionActivitySource(driverConn, () => wrappedConnection),\n\t\t\tasync release() {\n\t\t\t\tawait self.#inFlight.track(() => driverConn.release());\n\t\t\t},\n\t\t\tasync destroy(reason) {\n\t\t\t\tawait self.#inFlight.track(() => driverConn.destroy(reason));\n\t\t\t},\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 {\n\t\t\tdriverConnection: driverConn,\n\t\t\tconnection: wrappedConnection\n\t\t};\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. `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) {\n\t\towner[transactionStart].refusedBeforeBegin = false;\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\towner[transactionStart].refusedBeforeBegin = true;\n\t\t\tthrow error;\n\t\t}\n\t\tlet driverTx;\n\t\ttry {\n\t\t\tdriverTx = await this.#inFlight.track(() => connection.beginTransaction());\n\t\t} catch (error) {\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\treturn this.wrapTransaction(driverTx, connection, activity);\n\t}\n\twrapTransaction(driverTx, connection, activity) {\n\t\tthis.#openTransactions.set(driverTx, activity);\n\t\tthis.#openTransactions.set(connection, activity);\n\t\tconst stopAcceptingChildren = () => {\n\t\t\tactivity.stopAcceptingChildren();\n\t\t\tfor (const queryable of [driverTx, connection]) if (this.#openTransactions.get(queryable) === activity) this.#openTransactions.delete(queryable);\n\t\t};\n\t\tlet commitAttempted = false;\n\t\tconst settlement = {\n\t\t\tcommitted: false,\n\t\t\trolledBack: false,\n\t\t\tlogDroppedError(error) {\n\t\t\t\ttry {\n\t\t\t\t\tactivity.ctx.log.error({\n\t\t\t\t\t\tevent: \"middleware.activityEnded.error\",\n\t\t\t\t\t\terror\n\t\t\t\t\t});\n\t\t\t\t} catch {}\n\t\t\t}\n\t\t};\n\t\tlet commitEnding;\n\t\tconst self = this;\n\t\treturn {\n\t\t\t[transactionSettlement]: settlement,\n\t\t\tasync commit() {\n\t\t\t\tcommitAttempted = true;\n\t\t\t\tstopAcceptingChildren();\n\t\t\t\ttry {\n\t\t\t\t\tawait self.#inFlight.track(() => driverTx.commit());\n\t\t\t\t} catch (error) {\n\t\t\t\t\tawait activity.end({\n\t\t\t\t\t\tby: \"commit\",\n\t\t\t\t\t\toutcome: \"failed\"\n\t\t\t\t\t});\n\t\t\t\t\tthrow error;\n\t\t\t\t}\n\t\t\t\tsettlement.committed = true;\n\t\t\t\tcommitEnding = activity.end({\n\t\t\t\t\tby: \"commit\",\n\t\t\t\t\toutcome: \"succeeded\"\n\t\t\t\t});\n\t\t\t\tawait commitEnding;\n\t\t\t},\n\t\t\tasync rollback() {\n\t\t\t\tstopAcceptingChildren();\n\t\t\t\tif (settlement.committed) {\n\t\t\t\t\tawait commitEnding?.catch(() => void 0);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tif (settlement.rolledBack) return;\n\t\t\t\ttry {\n\t\t\t\t\tawait self.#inFlight.track(() => driverTx.rollback());\n\t\t\t\t} catch (error) {\n\t\t\t\t\tawait activity.end({\n\t\t\t\t\t\tby: \"rollback\",\n\t\t\t\t\t\toutcome: \"failed\",\n\t\t\t\t\t\tcommitAttempted\n\t\t\t\t\t});\n\t\t\t\t\tthrow error;\n\t\t\t\t}\n\t\t\t\tsettlement.rolledBack = true;\n\t\t\t\tawait activity.end({\n\t\t\t\t\tby: \"rollback\",\n\t\t\t\t\toutcome: \"succeeded\",\n\t\t\t\t\tcommitAttempted\n\t\t\t\t});\n\t\t\t},\n\t\t\t[activitySource]: {\n\t\t\t\tstartActivity: (clientActivity) => self.startActivityOnRoute(self.queryableRoute(driverTx, \"transaction\", () => activity, {\n\t\t\t\t\ttransaction: void 0,\n\t\t\t\t\truntimeWork: false\n\t\t\t\t}), clientActivity, void 0),\n\t\t\t\tplanContentHash: (plan) => self.planContentHashFor(plan, \"transaction\", activity)\n\t\t\t},\n\t\t\tquery(plan, options) {\n\t\t\t\treturn self.queryAgainstQueryable(plan, driverTx, {\n\t\t\t\t\t...options,\n\t\t\t\t\tscope: \"transaction\"\n\t\t\t\t});\n\t\t\t},\n\t\t\texecute(plan, options) {\n\t\t\t\treturn self.executeStatisticsAgainstQueryable(plan, driverTx, {\n\t\t\t\t\t...options,\n\t\t\t\t\tscope: \"transaction\"\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, driverTx, {\n\t\t\t\t\t...options,\n\t\t\t\t\tscope: \"transaction\"\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, driverTx, {\n\t\t\t\t\t...options,\n\t\t\t\t\tscope: \"transaction\"\n\t\t\t\t});\n\t\t\t}\n\t\t};\n\t}\n\ttelemetry() {\n\t\treturn this._telemetry;\n\t}\n\tclose() {\n\t\tthis.closePromise ??= this.closeDriverAfterWork();\n\t\treturn this.closePromise;\n\t}\n\tasync closeDriverAfterWork() {\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.warnWhenWaitingOnlyForActivities(warned);\n\t\tawait this.#inFlight.drained();\n\t\tawait this.driver.close();\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.warnWhenWaitingOnlyForActivities(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\tconst contract = this.contract;\n\t\tthis._telemetry = Object.freeze({\n\t\t\tlane: plan.meta.lane,\n\t\t\ttarget: contract.target,\n\t\t\tfingerprint: computeSqlFingerprint(plan.sql),\n\t\t\toutcome,\n\t\t\t...durationMs !== void 0 ? { durationMs } : {}\n\t\t});\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};\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}\nasync function withTransaction(runtime, fn) {\n\tconst connection = await runtime.connection();\n\tlet transaction;\n\ttry {\n\t\ttransaction = await connection.transaction();\n\t} catch (error) {\n\t\tif (wasRefusedBeforeBegin(connection)) await connection.release().catch(() => void 0);\n\t\telse await connection.destroy(error).catch(() => void 0);\n\t\tthrow error;\n\t}\n\tlet invalidated = false;\n\tasync function* guardedStream(inner) {\n\t\tif (invalidated) throw transactionClosedError();\n\t\tfor await (const row of inner) {\n\t\t\tyield row;\n\t\t\tif (invalidated) throw transactionClosedError();\n\t\t}\n\t}\n\tfunction guardedQueryable(target) {\n\t\treturn {\n\t\t\tquery(plan, options) {\n\t\t\t\tif (invalidated) throw transactionClosedError();\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 (invalidated) 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\tif (invalidated) throw transactionClosedError();\n\t\t\t\treturn new AsyncIterableResult(guardedStream(runPreparedQuery(target, ps, params, options)));\n\t\t\t},\n\t\t\t[preparedStatementExecute](ps, params, options) {\n\t\t\t\tif (invalidated) 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 (invalidated) 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\tend: (end) => handle.end(end)\n\t\t};\n\t}\n\tconst txContext = {\n\t\t...guardedQueryable(transaction),\n\t\tget invalidated() {\n\t\t\treturn invalidated;\n\t\t},\n\t\t[activitySource]: guardedSource(transaction)\n\t};\n\tlet connectionDisposed = false;\n\tconst destroyConnection = async (reason) => {\n\t\tif (connectionDisposed) return;\n\t\tconnectionDisposed = true;\n\t\tawait connection.destroy(reason).catch(() => void 0);\n\t};\n\ttry {\n\t\tlet result;\n\t\ttry {\n\t\t\tresult = await fn(txContext);\n\t\t} catch (error) {\n\t\t\ttry {\n\t\t\t\tawait transaction.rollback();\n\t\t\t} catch (rollbackError) {\n\t\t\t\tconst settlement = settlementOf(transaction);\n\t\t\t\tif (settlement?.rolledBack === true) {\n\t\t\t\t\tsettlement.logDroppedError(rollbackError);\n\t\t\t\t\tthrow error;\n\t\t\t\t}\n\t\t\t\tawait destroyConnection(rollbackError);\n\t\t\t\tconst wrapped = runtimeError(\"RUNTIME.TRANSACTION_ROLLBACK_FAILED\", \"Transaction rollback failed after callback error\", { rollbackError });\n\t\t\t\twrapped.cause = error;\n\t\t\t\tthrow wrapped;\n\t\t\t}\n\t\t\tthrow error;\n\t\t} finally {\n\t\t\tinvalidated = true;\n\t\t}\n\t\ttry {\n\t\t\tawait transaction.commit();\n\t\t} catch (commitError) {\n\t\t\tif (settlementOf(transaction)?.committed === true) throw commitError;\n\t\t\ttry {\n\t\t\t\tawait transaction.rollback();\n\t\t\t} catch (rollbackError) {\n\t\t\t\tconst settlement = settlementOf(transaction);\n\t\t\t\tif (settlement?.rolledBack === true) settlement.logDroppedError(rollbackError);\n\t\t\t\telse await destroyConnection(commitError);\n\t\t\t}\n\t\t\tconst wrapped = runtimeError(\"RUNTIME.TRANSACTION_COMMIT_FAILED\", \"Transaction commit failed\", { commitError });\n\t\t\twrapped.cause = commitError;\n\t\t\tthrow wrapped;\n\t\t}\n\t\treturn result;\n\t} finally {\n\t\tif (!connectionDisposed) await connection.release();\n\t}\n}\n//#endregion\nexport { startActivityOn as C, planContentHashOn as S, encodeParamsWithMetadata as _, sqlNativeArrayListDecoder as a, delegatingActivitySource as b, PreparedExecutionImpl as c, budgets as d, lowerSqlPlan as f, deriveParamMetadata as g, validateContractCodecMappings as h, decodeRow as i, PreparedStatementImpl as l, validateCodecRegistryCompleteness as m, withTransaction as n, createExecutionContext as o, extractCodecIds as p, buildDecodeContext as r, createSqlExecutionStack as s, SqlRuntimeBase as t, lints as u, createAstCodecRegistry as v, findActivitySource as x, activitySource as y };\n\n//# sourceMappingURL=exports-DVsHk8HP.mjs.map"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAqBA,MAAM,iBAAiB,OAAO,gBAAgB;AAC9C,SAAS,wBAAwB,QAAQ;CACxC,OAAO,kBAAkB;AAC1B;;AAEA,SAAS,mBAAmB,QAAQ;CACnC,OAAO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ACA,IAAI,qBAAqB;CACzB,MAAM,oBAAoB,OAAO,WAAW;EAC3C,IAAI,oBAAoB;EACxB,qBAAqB;EACrB,MAAM,WAAW,QAAQ,MAAM,CAAC,CAAC,YAAY,KAAK,CAAC;CACpD;CACA,IAAI;EACH,IAAI;EACJ,IAAI;GACH,SAAS,MAAM,GAAG,SAAS;EAC5B,SAAS,OAAO;GACf,IAAI;IACH,MAAM,YAAY,SAAS;GAC5B,SAAS,eAAe;IACvB,MAAM,aAAa,aAAa,WAAW;IAC3C,IAAI,YAAY,eAAe,MAAM;KACpC,WAAW,gBAAgB,aAAa;KACxC,MAAM;IACP;IACA,MAAM,kBAAkB,aAAa;IACrC,MAAM,UAAUA,eAAa,uCAAuC,oDAAoD,EAAE,cAAc,CAAC;IACzI,QAAQ,QAAQ;IAChB,MAAM;GACP;GACA,MAAM;EACP,UAAU;GACT,cAAc;EACf;EACA,IAAI;GACH,MAAM,YAAY,OAAO;EAC1B,SAAS,aAAa;GACrB,IAAI,aAAa,WAAW,CAAC,EAAE,cAAc,MAAM,MAAM;GACzD,IAAI;IACH,MAAM,YAAY,SAAS;GAC5B,SAAS,eAAe;IACvB,MAAM,aAAa,aAAa,WAAW;IAC3C,IAAI,YAAY,eAAe,MAAM,WAAW,gBAAgB,aAAa;SACxE,MAAM,kBAAkB,WAAW;GACzC;GACA,MAAM,UAAUA,eAAa,qCAAqC,6BAA6B,EAAE,YAAY,CAAC;GAC9G,QAAQ,QAAQ;GAChB,MAAM;EACP;EACA,OAAO;CACR,UAAU;EACT,IAAI,CAAC,oBAAoB,MAAM,WAAW,QAAQ;CACnD;AACD"}
|
|
@@ -22,7 +22,7 @@ import { AnyCodecDescriptor, CodecDescriptor } from "@prisma/orm-framework/compo
|
|
|
22
22
|
import { Contract, PlanMeta } from "@prisma/orm-framework/contract/types";
|
|
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, StartActivity, StartActivity as StartActivity$1, StatementActivity, StatementEnded, TransactionActivity, TransactionEnded } from "@prisma/orm-framework/components/runtime";
|
|
24
24
|
import { ExecutionStack, RuntimeAdapterDescriptor, RuntimeAdapterInstance, RuntimeDriverDescriptor, RuntimeDriverInstance, RuntimeExtensionDescriptor, RuntimeExtensionInstance, RuntimeTargetDescriptor, RuntimeTargetInstance } from "@prisma/orm-framework/components/execution";
|
|
25
|
-
//#region ../../../2-sql/5-runtime/dist/activity-handle-
|
|
25
|
+
//#region ../../../2-sql/5-runtime/dist/activity-handle-C3LzuzLW.d.mts
|
|
26
26
|
//#region src/codecs/decoding.d.ts
|
|
27
27
|
type ColumnRef = {
|
|
28
28
|
table: string;
|
|
@@ -251,7 +251,7 @@ declare function createExecutionContext<TContract extends Contract<SqlStorage> =
|
|
|
251
251
|
//#region src/sql-runtime.d.ts
|
|
252
252
|
type Log$1 = RuntimeLog;
|
|
253
253
|
/**
|
|
254
|
-
* When `close()` starts refusing new runtime-scope work. `'when-idle'` (the default) waits until the runtime has been idle for one turn of the event loop, so work that keeps it busy from the close onward is admitted; use it for an owner with one caller, such as a per-request connection. `'at-once'` refuses from the call of `close()`; use it for an owner that many callers share. Both wait for work already in flight.
|
|
254
|
+
* When `close()` starts refusing new runtime-scope work. `'when-idle'` (the default) waits until the runtime has been idle for one turn of the event loop, so work that keeps it busy from the close onward is admitted; use it for an owner with one caller, such as a per-request connection. `'at-once'` refuses from the call of `close()`; use it for an owner that many callers share. Both wait for work already in flight, and an activity already open when `close()` is called, such as an ORM call, finishes its work: its statements, its transaction and the activities started beneath it are admitted until it ends.
|
|
255
255
|
*/
|
|
256
256
|
type CloseRefusal = 'when-idle' | 'at-once';
|
|
257
257
|
interface RuntimeOptions<TContract extends Contract<SqlStorage> = Contract<SqlStorage>> {
|
|
@@ -395,7 +395,7 @@ declare abstract class SqlRuntimeBase<TContract extends Contract<SqlStorage> = C
|
|
|
395
395
|
*/
|
|
396
396
|
protected startActivityOnRoute<K extends ClientActivityKind>(route: ActivityRoute, activity: StartActivity<K>, parent: ActivityParent | undefined): Promise<ActivityHandle<K>>;
|
|
397
397
|
/** The content hash of the statement `plan` would send on a queryable of `scope` beneath `parent`. */
|
|
398
|
-
protected planContentHashFor(plan:
|
|
398
|
+
protected planContentHashFor(plan: HashablePlan, scope: ActivityRoute['scope'], parent: ActivityParent | undefined): Promise<string>;
|
|
399
399
|
/** An activity route whose statements run on `queryable`. */
|
|
400
400
|
protected queryableRoute(queryable: SqlQueryable, scope: ActivityRoute['scope'], parent: () => ActivityParent | undefined, options: Pick<ActivityRoute, 'transaction' | 'runtimeWork'>): ActivityRoute;
|
|
401
401
|
/** The activity route of a held connection that `owner` wraps: its statements run on `connection`, and its transactions begin there. */
|
|
@@ -469,8 +469,15 @@ interface ActivitySource {
|
|
|
469
469
|
*/
|
|
470
470
|
startActivity<K extends ClientActivityKind>(activity: StartActivity<K>): Promise<ActivityHandle<K>>;
|
|
471
471
|
/** The content hash of the statement `plan` sends: after `beforeCompile`, lowering and encoding, without `beforeEncode`. It equals the digest `ctx.contentHash(exec)` returns for the statement's execution plan only when `beforeCompile` gives the same result here as for the statement (it runs here with the scope and parent of the queryable it is called on, and with fresh state; on the runtime itself there is no parent), no `beforeEncode` hook changes the parameters, and the codecs encode deterministically. It starts nothing, so it also works on a handle that has ended. */
|
|
472
|
-
planContentHash(plan:
|
|
472
|
+
planContentHash(plan: HashablePlan): Promise<string>;
|
|
473
473
|
}
|
|
474
|
+
/** A prepared statement and the parameters one execution of it binds; its hash is that of the statement it sends with those parameters. The statement is one the SQL runtime prepared, returning rows or statistics. */
|
|
475
|
+
interface BoundPreparedStatement {
|
|
476
|
+
readonly statement: PreparedStatement<unknown, unknown> | PreparedExecution<unknown>;
|
|
477
|
+
readonly params: unknown;
|
|
478
|
+
}
|
|
479
|
+
/** What `planContentHash` hashes: a plan, or one execution of a prepared statement, whose hash is that of the statement it sends with those parameters. */
|
|
480
|
+
type HashablePlan = SqlQueryPlan | SqlExecutionPlan | BoundPreparedStatement;
|
|
474
481
|
/** An open client activity, to send its statements through and to end. Its `startActivity` and `planContentHash` members are those of its `activitySource` member. */
|
|
475
482
|
interface ActivityHandle<K extends ClientActivityKind> extends RuntimeQueryable, ActivitySource, ActivitySourceTarget {
|
|
476
483
|
readonly activity: ClientActivity<K>;
|
|
@@ -498,7 +505,7 @@ declare function findActivitySource(target: RuntimeScope): ActivitySource | unde
|
|
|
498
505
|
declare function delegatingActivitySource(target: () => RuntimeScope): ActivitySource;
|
|
499
506
|
/** Starts an activity on a queryable through its `activitySource` member. */
|
|
500
507
|
declare function startActivityOn<K extends ClientActivityKind>(target: RuntimeScope, activity: StartActivity<K>): Promise<ActivityHandle<K>>;
|
|
501
|
-
declare function planContentHashOn(target: RuntimeScope, plan:
|
|
508
|
+
declare function planContentHashOn(target: RuntimeScope, plan: HashablePlan): Promise<string>;
|
|
502
509
|
//#endregion
|
|
503
510
|
//#region ../../../2-sql/5-runtime/dist/index.d.mts
|
|
504
511
|
//#region src/codecs/ast-codec-registry.d.ts
|
|
@@ -570,5 +577,5 @@ interface LintsOptions {
|
|
|
570
577
|
*/
|
|
571
578
|
declare function lints(options?: LintsOptions): SqlMiddleware;
|
|
572
579
|
//#endregion
|
|
573
|
-
export {
|
|
574
|
-
//# sourceMappingURL=index-
|
|
580
|
+
export { SqlRuntimeAdapterDescriptor as $, ActivityRoute as A, PreparedStatementInternals as B, extractCodecIds as C, validateContractCodecMappings as D, validateCodecRegistryCompleteness as E, ConnectionProvider as F, RuntimeParameterizedCodecDescriptor as G, RuntimeConnection as H, HashablePlan as I, RuntimeTransaction as J, RuntimeQueryable as K, MarkerReader as L, ActivitySourceTarget as M, BoundPreparedStatement as N, ActivityExecuteOptions as O, CloseRefusal as P, SqlMiddlewareContext as Q, PreparedExecutionImpl as R, createAstCodecRegistry as S, lowerSqlPlan as T, RuntimeFamilyAdapter as U, Runtime as V, RuntimeOptions as W, SqlExecutionStackWithDriver as X, SqlExecutionStack as Y, SqlMiddleware as Z, StatementActivity as _, planContentHashOn as _t, ActivityParent$1 as a, SqlRuntimeTargetDescriptor as at, TransactionEnded as b, ClientActivityEnd$1 as c, TransactionContext as ct, ClientActivityResult$1 as d, createExecutionContext as dt, SqlRuntimeAdapterInstance as et, ExecuteInterceptResult$1 as f, createSqlExecutionStack as ft, StartActivity$1 as g, findActivitySource as gt, QueryInterceptResult$1 as h, encodeParamsWithMetadata as ht, ActivityInterceptResult$1 as i, SqlRuntimeExtensionInstance as it, ActivitySource as j, ActivityHandle as k, ClientActivityEnded as l, VerifyMarkerOption as lt, Log as m, deriveParamMetadata as mt, ActivityEndedResult$1 as n, SqlRuntimeDriverInstance as nt, BudgetsOptions as o, SqlStaticContributions as ot, LintsOptions as p, delegatingActivitySource as pt, RuntimeTelemetryEvent as q, ActivityFinalizedResult$1 as r, SqlRuntimeExtensionDescriptor as rt, ClientActivity$1 as s, TelemetryOutcome as st, Activity$1 as t, SqlRuntimeBase as tt, ClientActivityKind$1 as u, activitySource as ut, StatementEnded as v, startActivityOn as vt, lints as w, budgets as x, TransactionActivity as y, withTransaction as yt, PreparedStatementImpl as z };
|
|
581
|
+
//# sourceMappingURL=index-BxlXOVeT.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index-
|
|
1
|
+
{"version":3,"file":"index-BxlXOVeT.d.mts","names":[],"sources":["../../../../2-sql/5-runtime/dist/activity-handle-C3LzuzLW.d.mts","../../../../2-sql/5-runtime/dist/index.d.mts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;KAeK;EACH;EACA;;KAEG,eAAe,oBAAoB,gBAAgB,mBAAmB,qBAAqB;UAEtF;WACC,SAAS;WACT,QAAQ,oBAAoB;WAC5B,YAAY,oBAAoB;WAChC,gBAAgB;WAChB,aAAa;;;;;;;WAOb;;;;UAeD,6BAA6B;WAC5B,UAAU,SAAS;;;;;;UAMpB;WACC,KAAK;WACL,MAAM;;UAEP,cAAc,kBAAkB,0BAA0B,iCAAiC,kBAAkB,kBAAkB,mBAAmB;WACjJ;EACT,iBAAiB,UAAU,UAAU,KAAK,uBAAuB;EACjE,eAAe,UAAU,UAAU,QAAQ,qBAAqB,KAAK,uBAAuB;EAC5F,mBAAmB,UAAU,UAAU,QAAQ,yBAAyB,KAAK,uBAAuB;;;;;;;;;;;;;;;;;;;EAmBpG,eAAe,OAAO,WAAW,KAAK,uBAAuB,QAAQ;;;;;;EAMrE,cAAc,MAAM,kBAAkB,KAAK,sBAAsB,SAAS,mBAAmB,oBAAoB;EACjH;IACE,SAAS,MAAM,kBAAkB,KAAK,uBAAuB,QAAQ;IACrE,WAAW,MAAM,kBAAkB,KAAK,uBAAuB,QAAQ;IACvE,YAAY,UAAU,gBAAgB,KAAK,uBAAuB,QAAQ;;EAE5E,OAAO,KAAK,yBAAyB,MAAM,kBAAkB,KAAK,uBAAuB;;;;UAIjF;WACC,OAAO;WACP;;iBAEM,oBAAoB,KAAK,uBAAuB;iBAChD,yBAAyB,4BAA4B,mBAAmB,iBAAiB,KAAK,qBAAqB,iBAAiB,wBAAwB;;;UAGnK;WACC;WACA,KAAK;WACL,MAAM;WACN,gBAAgB;WAChB,eAAe;WACf,wBAAwB;;cAErB,sBAAsB,QAAQ,gBAAgB,kBAAkB,QAAQ,MAAM;WACj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AAyB,cAAc,eAAe;;iBAEtD,gBAAgB,UAAU,oBAAoB,QAAQ,cAAc,UAAU,cAAc,KAAK,QAAQ,eAAe;iBACxH,kBAAkB,QAAQ,cAAc,MAAM,eAAe;;;;;;;;;;;;;iBC1e7D,uBAAuB,aAAa,0BAA0B;;;iBAG9D,gBAAgB,UAAU,SAAS,cAAc;iBACjD,8BAA8B,UAAU,yBAAyB,UAAU,SAAS;iBACpF,kCAAkC,UAAU,yBAAyB,UAAU,SAAS;;;;;;;;;;;;iBAYxF,aAAa,KAAK,SAAS,QAAQ,aAAa,SAAS,aAAa,mBAAmB,UAAU,SAAS,aAAa,WAAW,aAAa,OAAO,iBAAiB;;;UAGhL;WACC;WACA;WACA,YAAY;WACZ;WACA;aACE;aACA;;;iBAGI,QAAQ,UAAU,iBAAiB;;;UAG1C;WACC;aACE;aACA;aACA;aACA;aACA;;WAEF;;;;;;;;;;;;;;;;iBAgBM,MAAM,UAAU,eAAe"}
|
package/dist/orm-client.d.mts
CHANGED
|
@@ -18,10 +18,10 @@ import { h as RuntimeScope, o as ComputeColumnJsType } from "./types-Cv5t6_Ly-Cc
|
|
|
18
18
|
import "./types-_7TbRpPw.mjs";
|
|
19
19
|
import { l as PreparedFor, n as Declaration, o as ParamsFromDeclaration, t as BindSiteParams, u as PreparedStatement } from "./transaction-state-DR3nKTmH-n_12DsnU.mjs";
|
|
20
20
|
import "./collection-methods-DQAFcGEB.mjs";
|
|
21
|
-
import {
|
|
21
|
+
import { K as RuntimeQueryable$1, M as ActivitySourceTarget, V as Runtime } from "./index-BxlXOVeT.mjs";
|
|
22
22
|
import { CodecDescriptorRef, ScalarFieldDeclarationBuilder } from "@prisma/orm-framework/components/codec";
|
|
23
23
|
import { Contract } from "@prisma/orm-framework/contract/types";
|
|
24
|
-
import {
|
|
24
|
+
import { AsyncIterableResult, MetaBuilder, ResultType, RuntimeExecuteOptions } from "@prisma/orm-framework/components/runtime";
|
|
25
25
|
import { SimplifyDeep } from "@prisma/orm-framework/utils/simplify-deep";
|
|
26
26
|
//#region ../../../3-extensions/sql-orm-client/dist/index.d.mts
|
|
27
27
|
//#region src/table-scope.d.ts
|
|
@@ -174,16 +174,6 @@ interface CollectionState {
|
|
|
174
174
|
readonly offset: LimitOffsetValue | undefined;
|
|
175
175
|
readonly variantValue: string | undefined;
|
|
176
176
|
readonly locking: ReadonlyArray<LockingClause> | undefined;
|
|
177
|
-
/**
|
|
178
|
-
* Annotations attached to this query at terminal-call time.
|
|
179
|
-
* Populated transiently by the read terminals `all` and `first` just before dispatch. Terminals
|
|
180
|
-
* that compile a plan directly attach annotations to it with `mergeAnnotations` instead; nested
|
|
181
|
-
* `create()`/`update()` validate annotations and then discard them.
|
|
182
|
-
* `Collection` itself has no chainable `.annotate()`. Stored as a
|
|
183
|
-
* `Map<namespace, AnnotationValue>` so
|
|
184
|
-
* duplicate namespaces last-write-win. Empty on a fresh state.
|
|
185
|
-
*/
|
|
186
|
-
readonly annotations: ReadonlyMap<string, AnnotationValue<unknown, OperationKind>>;
|
|
187
177
|
}
|
|
188
178
|
declare function emptyState(tables: CollectionTables): CollectionState;
|
|
189
179
|
/**
|
|
@@ -229,7 +219,7 @@ interface RuntimeTransaction extends RuntimeScope {
|
|
|
229
219
|
commit?(): Promise<void>;
|
|
230
220
|
rollback?(): Promise<void>;
|
|
231
221
|
}
|
|
232
|
-
/** What the ORM sends its statements to. It
|
|
222
|
+
/** What the ORM sends its statements to. It must carry an `activitySource` member, as the SQL runtime's queryables, connections, transactions and activity handles do: every terminal method starts an `orm-call` activity through it, and a terminal method on a queryable without one fails with `ORM.ACTIVITY_SOURCE_MISSING`. The member is optional in this type only because the public runtime types do not show it. */
|
|
233
223
|
interface RuntimeQueryable extends RuntimeScope, Partial<ActivitySourceTarget> {
|
|
234
224
|
connection?(): Promise<RuntimeConnection>;
|
|
235
225
|
transaction?(): Promise<RuntimeTransaction>;
|
|
@@ -1188,16 +1178,15 @@ declare class GroupedCollection<TContract extends Contract<SqlStorage>, ModelNam
|
|
|
1188
1178
|
* pagination methods need a deterministic group order.
|
|
1189
1179
|
*/
|
|
1190
1180
|
offset(n: HasOrderBy extends true ? number | TraitExpression<readonly ['numeric'], false, ExtractCodecTypes<TContract>> : never): GroupedCollection<TContract, ModelName, GroupFields, NsId, HasOrderBy>;
|
|
1181
|
+
get prepared(): {
|
|
1182
|
+
aggregate: <Spec extends AggregateSpec>(fn: (aggregate: AggregateBuilder<TContract, ModelName, NsId>) => Spec, configure?: (meta: MetaBuilder<"read">) => void) => Preparable<Record<string, unknown>, Promise<SimplifyDeep<Pick<DefaultModelRow<TContract, ModelName, NsId>, GroupFields[number]> & AggregateResult<Spec>>[]>>;
|
|
1183
|
+
};
|
|
1191
1184
|
/**
|
|
1192
1185
|
* Read terminal: run a grouped aggregate query.
|
|
1193
1186
|
*
|
|
1194
1187
|
* Accepts an optional `configure` callback that receives a
|
|
1195
|
-
* `MetaBuilder<'read'>` for attaching typed annotations.
|
|
1196
|
-
* Annotations are merged into the compiled plan's `meta.annotations`.
|
|
1188
|
+
* `MetaBuilder<'read'>` for attaching typed annotations to the call.
|
|
1197
1189
|
*/
|
|
1198
|
-
get prepared(): {
|
|
1199
|
-
aggregate: <Spec extends AggregateSpec>(fn: (aggregate: AggregateBuilder<TContract, ModelName, NsId>) => Spec, configure?: (meta: MetaBuilder<"read">) => void) => Preparable<Record<string, unknown>, Promise<SimplifyDeep<Pick<DefaultModelRow<TContract, ModelName, NsId>, GroupFields[number]> & AggregateResult<Spec>>[]>>;
|
|
1200
|
-
};
|
|
1201
1190
|
aggregate<Spec extends AggregateSpec>(fn: (aggregate: AggregateBuilder<TContract, ModelName, NsId>) => Spec, configure?: (meta: MetaBuilder<'read'>) => void): Promise<Array<GroupedAggregateRow<TContract, ModelName, GroupFields, NsId, Spec>>>;
|
|
1202
1191
|
}
|
|
1203
1192
|
//#endregion
|
|
@@ -1573,11 +1562,7 @@ declare class CollectionBase<TContract extends Contract<SqlStorage>, ModelName e
|
|
|
1573
1562
|
* }
|
|
1574
1563
|
* ```
|
|
1575
1564
|
*
|
|
1576
|
-
* Accepts an optional `configure` callback that receives a
|
|
1577
|
-
* `MetaBuilder<'read'>` so the caller can attach typed user
|
|
1578
|
-
* annotations to the executed plan. `meta.annotate(...)` enforces
|
|
1579
|
-
* applicability at the type level and at runtime; annotations are
|
|
1580
|
-
* merged into `plan.meta.annotations` at compile time.
|
|
1565
|
+
* Accepts an optional `configure` callback that receives a `MetaBuilder<'read'>` so the caller can attach typed user annotations to the call. `meta.annotate(...)` enforces applicability at the type level and at runtime. Every terminal method runs as one `orm-call` activity that carries the annotations; the statements it sends carry none.
|
|
1581
1566
|
*
|
|
1582
1567
|
* ```typescript
|
|
1583
1568
|
* await db.orm.User.all((meta) => meta.annotate(cacheAnnotation({ key: 'users' })));
|
|
@@ -1632,8 +1617,7 @@ declare class CollectionBase<TContract extends Contract<SqlStorage>, ModelName e
|
|
|
1632
1617
|
* ```
|
|
1633
1618
|
*
|
|
1634
1619
|
* Accepts an optional `configure` callback that receives a
|
|
1635
|
-
* `MetaBuilder<'read'>` for attaching typed annotations.
|
|
1636
|
-
* Annotations are merged into the compiled plan's `meta.annotations`.
|
|
1620
|
+
* `MetaBuilder<'read'>` for attaching typed annotations to the call.
|
|
1637
1621
|
*/
|
|
1638
1622
|
aggregate<Spec extends AggregateSpec, Self = unknown>(this: Self & HasNoUniqueFilter, fn: (aggregate: AggregateBuilder<TContract, ModelName, State['nsId']>) => Spec, configure?: (meta: MetaBuilder<'read'>) => void): Promise<AggregateResult<Spec>>;
|
|
1639
1623
|
/**
|
|
@@ -1672,16 +1656,7 @@ declare class CollectionBase<TContract extends Contract<SqlStorage>, ModelName e
|
|
|
1672
1656
|
* });
|
|
1673
1657
|
* ```
|
|
1674
1658
|
*
|
|
1675
|
-
* Accepts an optional `configure` callback that receives a
|
|
1676
|
-
* `MetaBuilder<'write'>` for attaching typed annotations.
|
|
1677
|
-
* Annotations are merged into the compiled mutation plan's
|
|
1678
|
-
* `meta.annotations`.
|
|
1679
|
-
*
|
|
1680
|
-
* Note: when the input contains nested-mutation callbacks, the
|
|
1681
|
-
* operation is executed as a graph of internal queries via
|
|
1682
|
-
* `withMutationScope`. In that path the `configure` callback still runs, so `meta.annotate`
|
|
1683
|
-
* validation applies, but the recorded annotations are discarded: neither the nested
|
|
1684
|
-
* statements nor the read-back query carry them.
|
|
1659
|
+
* Accepts an optional `configure` callback that receives a `MetaBuilder<'write'>` for attaching typed annotations to the call, including when the input contains relation callbacks and the call sends several statements and a read-back.
|
|
1685
1660
|
*/
|
|
1686
1661
|
create<Self extends this>(this: Self, data: ResolvedCreateInput<TContract, ModelName, State['variantValue'], State['nsId']>, configure?: (meta: MetaBuilder<'write'>) => void): Promise<CollectionRowOf<Self>>;
|
|
1687
1662
|
create<Self extends this>(this: Self, data: MutationCreateInputWithRelations<TContract, ModelName, State['nsId']>, configure?: (meta: MetaBuilder<'write'>) => void): Promise<CollectionRowOf<Self>>;
|
|
@@ -1718,8 +1693,7 @@ declare class CollectionBase<TContract extends Contract<SqlStorage>, ModelName e
|
|
|
1718
1693
|
*
|
|
1719
1694
|
* Accepts an optional `configure` callback that receives a
|
|
1720
1695
|
* `MetaBuilder<'write'>` for attaching typed annotations to the
|
|
1721
|
-
*
|
|
1722
|
-
* there are no options.
|
|
1696
|
+
* call. It may be passed in second position when there are no options.
|
|
1723
1697
|
*/
|
|
1724
1698
|
createAll<Self extends this>(this: Self, data: readonly ResolvedScalarCreateInput<TContract, ModelName, State['variantValue'], State['nsId']>[], optionsOrConfigure?: CreateConflictOptions<TContract, ModelName> | WriteConfigure, configure?: WriteConfigure): AsyncIterableResult<CollectionRowOf<Self>>;
|
|
1725
1699
|
createAll(data: readonly ResolvedScalarCreateInput<TContract, ModelName, State['variantValue'], State['nsId']>[], optionsOrConfigure?: CreateConflictOptions<TContract, ModelName> | WriteConfigure, configure?: WriteConfigure): AsyncIterableResult<CollectionRowOf<this>>;
|
|
@@ -1824,13 +1798,7 @@ declare class CollectionBase<TContract extends Contract<SqlStorage>, ModelName e
|
|
|
1824
1798
|
* ```
|
|
1825
1799
|
*
|
|
1826
1800
|
* Accepts an optional `configure` callback that receives a
|
|
1827
|
-
* `MetaBuilder<'write'>` for attaching typed annotations.
|
|
1828
|
-
*
|
|
1829
|
-
* Note: when the input contains nested-mutation callbacks, the
|
|
1830
|
-
* operation is executed as a graph of internal queries via
|
|
1831
|
-
* `withMutationScope`. In that path the `configure` callback still runs, so `meta.annotate`
|
|
1832
|
-
* validation applies, but the recorded annotations are discarded: neither the nested
|
|
1833
|
-
* statements nor the read-back query carry them.
|
|
1801
|
+
* `MetaBuilder<'write'>` for attaching typed annotations to the call, including when the input contains relation callbacks.
|
|
1834
1802
|
*/
|
|
1835
1803
|
update<Self extends HasWhere>(this: Self, data: MutationUpdateInput<TContract, ModelName, State['nsId']>, configure?: (meta: MetaBuilder<'write'>) => void): Promise<CollectionRowOf<Self & HasRow<CollectionRowOf<this>>> | null>;
|
|
1836
1804
|
/**
|