🎩 You're Invited:Meet the Socket team at Black Hat in Las Vegas, August 3-6.RSVP
Sign In

@prisma-next/sql-runtime

Package Overview
Dependencies
Maintainers
4
Versions
1012
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@prisma-next/sql-runtime - npm Package Compare versions

Comparing version
0.16.0-dev.19
to
0.16.0-dev.21
dist/exports-tFHOjuUO.mjs

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

+443
import { AnyCodecDescriptor, CodecDescriptor } from "@prisma-next/framework-components/codec";
import { AfterExecuteResult, AsyncIterableResult, ExecutionPlan, RuntimeCore, RuntimeExecuteOptions, RuntimeLog, RuntimeMiddleware, RuntimeMiddlewareContext } from "@prisma-next/framework-components/runtime";
import { Adapter, AnyQueryAst, Codec, CodecRef, ContractCodecRegistry, LoweredParam, LoweredStatement, MarkerReadResult, SqlCodecCallContext, SqlConnection, SqlDriver, SqlQueryable } from "@prisma-next/sql-relational-core/ast";
import { ExecutionStack, RuntimeAdapterDescriptor, RuntimeAdapterInstance, RuntimeDriverDescriptor, RuntimeDriverInstance, RuntimeExtensionDescriptor, RuntimeExtensionInstance, RuntimeTargetDescriptor, RuntimeTargetInstance } from "@prisma-next/framework-components/execution";
import { SqlOperationDescriptors } from "@prisma-next/sql-operations";
import { SqlParamRefMutator } from "@prisma-next/sql-relational-core/middleware";
import { Contract, JsonValue, PlanMeta } from "@prisma-next/contract/types";
import { SqlStorage } from "@prisma-next/sql-contract/types";
import { ExecutionContext, TypeHelperRegistry } from "@prisma-next/sql-relational-core/query-lane-context";
import { SqlExecutionPlan, SqlQueryPlan } from "@prisma-next/sql-relational-core/plan";
import { CodecTypesBase, CodecValue, Expression, RawCodecInferer } from "@prisma-next/sql-relational-core/expression";
import { RuntimeScope } from "@prisma-next/sql-relational-core/types";
//#region src/codecs/encoding.d.ts
interface ParamMetadata {
readonly codec: CodecRef | undefined;
readonly name: string | undefined;
}
declare function deriveParamMetadata(ast: AnyQueryAst): readonly ParamMetadata[];
declare function encodeParamsWithMetadata(values: readonly unknown[], metadata: readonly ParamMetadata[], ctx: SqlCodecCallContext, contractCodecs?: ContractCodecRegistry): Promise<readonly unknown[]>;
//#endregion
//#region src/middleware/sql-middleware.d.ts
interface SqlMiddlewareContext extends RuntimeMiddlewareContext {
readonly contract: Contract<SqlStorage>;
}
/**
* Pre-lowering query view passed to `beforeCompile`. Carries the typed SQL
* AST and plan metadata; `sql`/`params` are produced later by the adapter.
*/
interface DraftPlan {
readonly ast: AnyQueryAst;
readonly meta: PlanMeta;
}
interface SqlMiddleware<TCodecMap extends Record<string, unknown> = Record<string, unknown>> extends RuntimeMiddleware<SqlExecutionPlan, SqlParamRefMutator<TCodecMap>> {
readonly familyId?: 'sql';
/**
* Rewrite the query AST before it is lowered to SQL. Middlewares run in
* registration order; each sees the predecessor's output, so rewrites
* compose (e.g. soft-delete + tenant isolation).
*
* Return `undefined` (or a draft whose `ast` reference equals the input's)
* to pass through. Return a draft with a new `ast` reference to replace it;
* the runtime emits a `middleware.rewrite` debug log event and continues
* with the new draft. `adapter.lower()` runs once after the chain.
*
* Use `AstRewriter` / `SelectAst.withWhere` / `AndExpr.of` etc. to build
* the rewritten AST. Predicates and literals go through parameterized
* constructors by default — no SQL-injection surface is added. **Warning:**
* constructing `LiteralExpr.of(userInput)` from untrusted input bypasses
* that guarantee; use `ParamRef.of(userInput, ...)` instead.
*
* See `docs/architecture docs/subsystems/4. Runtime & Middleware Framework.md`.
*/
beforeCompile?(draft: DraftPlan, ctx: SqlMiddlewareContext): Promise<DraftPlan | undefined>;
/**
* Mutate `ParamRef.value` slots before encode runs. The third
* `params` argument is a {@link SqlParamRefMutator} scoped to value
* slots only — SQL strings, projections, and `ParamRef` membership
* are not mutable. Existing `(plan)` and `(plan, ctx)` middleware
* bodies that ignore the additional argument continue to compile
* and run unchanged.
*
* Lifecycle position:
* `beforeCompile → lowerSqlPlan → beforeExecute → encodeParams → intercept → driver`.
*
* The plan handed in is the SQL execution plan after lowering but
* *before* parameter encoding: `plan.params[i]` is the user-domain
* value the mutator's `entries()` iterator surfaces (e.g. an
* `EncryptedEnvelopeBase` for a cipherstash-codec'd column, or a
* plain JS value for non-codec'd ParamRefs). Mutations applied via
* `params.replaceValue` / `replaceValues` are visible to encode,
* which then renders the mutated value through the column's codec.
*
* `ctx.signal` carries the per-query `AbortSignal` (ADR 207);
* middleware that wraps a network SDK forwards `ctx.signal` to
* that SDK. Cooperative cancellation: a body that ignores the
* signal still surfaces `RUNTIME.ABORTED { phase: 'beforeExecute' }`
* promptly via the runtime's race against the signal.
*/
beforeExecute?(plan: SqlExecutionPlan, ctx: SqlMiddlewareContext, params?: SqlParamRefMutator<TCodecMap>): void | Promise<void>;
onRow?(row: Record<string, unknown>, plan: SqlExecutionPlan, ctx: SqlMiddlewareContext): Promise<void>;
afterExecute?(plan: SqlExecutionPlan, result: AfterExecuteResult, ctx: SqlMiddlewareContext): Promise<void>;
}
//#endregion
//#region src/codecs/decoding.d.ts
type ColumnRef = {
table: string;
column: string;
};
interface DecodeContext {
readonly aliases: ReadonlyArray<string> | undefined;
readonly codecs: ReadonlyMap<string, Codec>;
readonly columnRefs: ReadonlyMap<string, ColumnRef>;
readonly includeAliases: ReadonlySet<string>;
readonly manyAliases: ReadonlySet<string>;
}
declare function buildDecodeContext(ast: AnyQueryAst, contractCodecs: ContractCodecRegistry | undefined): DecodeContext;
/**
* Decodes a row by dispatching all per-cell codec calls concurrently via `Promise.all`. Each cell follows the single-armed `decodeField` path. 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`.
*
* When `rowCtx.signal` is provided:
*
* - **Already-aborted at entry** short-circuits with `RUNTIME.ABORTED` (`{ phase: 'decode' }`) before any `codec.decode` call is made.
* - **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).
* - Existing `RUNTIME.DECODE_FAILED` envelopes from codec bodies pass through unchanged (no double wrap).
*/
declare function decodeRow(row: Record<string, unknown>, decodeCtx: DecodeContext, rowCtx: SqlCodecCallContext): Promise<Record<string, unknown>>;
//#endregion
//#region src/prepared/types.d.ts
type ParamSpec<CT extends CodecTypesBase = CodecTypesBase> = (keyof CT & string) | {
readonly codecId: keyof CT & string;
readonly typeParams?: JsonValue;
readonly nullable?: boolean;
};
type Declaration<CT extends CodecTypesBase = CodecTypesBase> = Readonly<Record<string, ParamSpec<CT>>>;
type DeclaredCodecId<S> = S extends string ? S : S extends {
readonly codecId: infer C extends string;
} ? C : never;
type DeclaredNullable<S> = S extends {
readonly nullable: true;
} ? true : false;
type BindSiteParams<D> = { readonly [K in keyof D]: Expression<{
codecId: DeclaredCodecId<D[K]>;
nullable: DeclaredNullable<D[K]>;
}>; };
type ParamsFromDeclaration<D, CT extends CodecTypesBase> = { readonly [K in keyof D]: CodecValue<DeclaredCodecId<D[K]>, DeclaredNullable<D[K]>, CT>; };
type PrepareCallback<D, Row> = (params: BindSiteParams<D>) => SqlQueryPlan<Row>;
interface PreparedStatement<Params, Row> {
readonly sql: string;
readonly ast: AnyQueryAst;
readonly meta: PlanMeta;
readonly slots: readonly LoweredParam[];
/**
* Run this prepared statement against the given target. The target carries
* the execution scope (top-level runtime, an explicit connection, an active
* transaction). It is required and explicit — there is no implicit binding
* back to the runtime that produced this statement.
*/
execute(target: RuntimeQueryable, params: Params, options?: RuntimeExecuteOptions): AsyncIterableResult<Row>;
}
//#endregion
//#region src/runtime-spi.d.ts
/**
* Reader of the SQL contract marker. SQL runtimes call `readMarker` before executing user queries (unless `verifyMarker` is false). The adapter owns the full marker-read flow — probing for storage, issuing the read, decoding the row — and returns a tagged result so callers can distinguish "marker storage missing", "no row for this space", and "present".
*/
interface MarkerReader {
readMarker(queryable: SqlQueryable): Promise<MarkerReadResult>;
}
/**
* SQL family adapter SPI consumed by `SqlRuntimeBase`. Encapsulates the
* runtime contract, marker reader, and plan validation logic so the
* runtime can be unit-tested without a concrete SQL adapter profile.
*
* Implemented by `SqlFamilyAdapter` for production and by mock classes
* in tests.
*/
interface RuntimeFamilyAdapter<TContract = unknown> {
readonly contract: TContract;
readonly markerReader: MarkerReader;
validatePlan(plan: ExecutionPlan, contract: TContract): void;
}
/**
* Controls whether the runtime reads and checks the contract marker row on first execute.
*
* - `'onFirstUse'` (default when omitted): the marker is read once per runtime lifetime, on the
* first `execute()` call. Any hash mismatch or absent marker emits a structured `warn`-level log
* through the runtime's {@link RuntimeLog} and the query proceeds. Subsequent queries skip the
* marker reader entirely.
* - `false`: the marker reader is never invoked. No log line is emitted. Use this to opt out of
* the diagnostic entirely (e.g. during a known deploy-skew window).
*
* The string-or-false shape is forward-compatible: future modes such as `'startup'` (eager check
* inside the wrapper `connect()` step) can be added as additive union members without an API break.
* `true` is intentionally not permitted — modes are always named.
*
* Default-on so contract drift surfaces by default — teams who never thought to enable the diagnostic
* still see the warning when something goes wrong.
*/
type VerifyMarkerOption = 'onFirstUse' | false;
type TelemetryOutcome = 'success' | 'runtime-error';
interface RuntimeTelemetryEvent {
readonly lane: string;
readonly target: string;
readonly fingerprint: string;
readonly outcome: TelemetryOutcome;
readonly durationMs?: number;
}
//#endregion
//#region src/sql-context.d.ts
/**
* Runtime parameterized codec descriptor.
*
* The unified `CodecDescriptor<P>` shape applied to parameterized codecs — `paramsSchema: StandardSchemaV1<P>` for JSON-boundary validation, `factory: (P) => (CodecInstanceContext) => Codec` for the curried higher-order codec. The factory is called once per `storage.types` instance (or once per inline-`typeParams` column); per-instance state lives in the closure.
*
* Codec-registry-unification spec § Decision.
*/
type RuntimeParameterizedCodecDescriptor<P = Record<string, unknown>> = CodecDescriptor<P>;
/**
* Contributor protocol for SQL components (target, adapter, extension pack). The unified `codecs:` slot returns the full {@link CodecDescriptor} list — non-parameterized and parameterized descriptors live side-by-side in the same array. The framework dispatches every codec id through the unified descriptor map without branching on parameterization.
*/
interface SqlStaticContributions {
readonly codecs: () => ReadonlyArray<AnyCodecDescriptor>;
readonly queryOperations?: () => SqlOperationDescriptors;
readonly mutationDefaultGenerators?: () => ReadonlyArray<RuntimeMutationDefaultGenerator>;
}
/**
* Scope across which a generator's value is constant.
*
* - `'field'` — one value per defaulting site (one column, one row). Cache strategy: no cache; call per defaulting site. Right for per-row identifiers (UUIDs, CUIDs, ULIDs, nanoid, ksuid).
* - `'row'` — one value across all defaulting sites of one row of one operation. Cache strategy: per-call cache keyed by `generatorId`. Right for correlation ids stamped into multiple columns of one row.
* - `'query'` — one value across all rows and columns of one ORM operation. Cache strategy: caller-provided cache keyed by `generatorId`. Right for `timestampNow` (a single timestamp per bulk insert/update).
*/
type GeneratorStability = 'field' | 'row' | 'query';
interface RuntimeMutationDefaultGenerator {
readonly id: string;
readonly generate: (params?: Record<string, unknown>) => unknown;
/**
* Scope across which the generator's value is constant. The framework derives the cache strategy from this declaration; generator authors never need to know about cache keys. See `GeneratorStability` for the per-value semantics.
*/
readonly stability: GeneratorStability;
}
interface SqlRuntimeTargetDescriptor<TTargetId extends string = string, TTargetInstance extends RuntimeTargetInstance<'sql', TTargetId> = RuntimeTargetInstance<'sql', TTargetId>> extends RuntimeTargetDescriptor<'sql', TTargetId, TTargetInstance>, SqlStaticContributions {}
interface SqlRuntimeAdapterDescriptor<TTargetId extends string = string, TAdapterInstance extends RuntimeAdapterInstance<'sql', TTargetId> = SqlRuntimeAdapterInstance<TTargetId>> extends RuntimeAdapterDescriptor<'sql', TTargetId, TAdapterInstance>, SqlStaticContributions {
/**
* Codec inferer used by `fns.raw` to look up the codec id for a bare-literal interpolation. Required on every SQL adapter descriptor — the facade reads it off the descriptor at client-construction time without instantiating the runtime adapter.
*/
readonly rawCodecInferer: RawCodecInferer;
}
interface SqlRuntimeExtensionDescriptor<TTargetId extends string = string> extends RuntimeExtensionDescriptor<'sql', TTargetId, SqlRuntimeExtensionInstance<TTargetId>>, SqlStaticContributions {
create(): SqlRuntimeExtensionInstance<TTargetId>;
}
interface SqlExecutionStack<TTargetId extends string = string> {
readonly target: SqlRuntimeTargetDescriptor<TTargetId>;
readonly adapter: SqlRuntimeAdapterDescriptor<TTargetId>;
readonly extensions: readonly SqlRuntimeExtensionDescriptor<TTargetId>[];
}
type SqlExecutionStackWithDriver<TTargetId extends string = string> = Omit<ExecutionStack<'sql', TTargetId, SqlRuntimeAdapterInstance<TTargetId>, SqlRuntimeDriverInstance<TTargetId>, SqlRuntimeExtensionInstance<TTargetId>>, 'target' | 'adapter' | 'driver' | 'extensions'> & {
readonly target: SqlRuntimeTargetDescriptor<TTargetId>;
readonly adapter: SqlRuntimeAdapterDescriptor<TTargetId, SqlRuntimeAdapterInstance<TTargetId>>;
readonly driver: RuntimeDriverDescriptor<'sql', TTargetId, unknown, SqlRuntimeDriverInstance<TTargetId>> | undefined;
readonly extensions: readonly SqlRuntimeExtensionDescriptor<TTargetId>[];
};
interface SqlRuntimeExtensionInstance<TTargetId extends string> extends RuntimeExtensionInstance<'sql', TTargetId> {}
type SqlRuntimeAdapterInstance<TTargetId extends string = string> = RuntimeAdapterInstance<'sql', TTargetId> & Adapter<AnyQueryAst, Contract<SqlStorage>, LoweredStatement>;
/**
* NOTE: Binding type is intentionally erased to unknown at this shared runtime layer. Target clients (for example `postgres()`) validate and construct the concrete binding before calling `driver.connect(binding)`, which keeps runtime behavior safe today. A future follow-up can preserve TBinding through stack/context generics end-to-end.
*/
type SqlRuntimeDriverInstance<TTargetId extends string = string> = RuntimeDriverInstance<'sql', TTargetId> & SqlDriver<unknown>;
declare function createSqlExecutionStack<TTargetId extends string>(options: {
readonly target: SqlRuntimeTargetDescriptor<TTargetId>;
readonly adapter: SqlRuntimeAdapterDescriptor<TTargetId>;
readonly driver?: RuntimeDriverDescriptor<'sql', TTargetId, unknown, SqlRuntimeDriverInstance<TTargetId>> | undefined;
readonly extensions?: readonly SqlRuntimeExtensionDescriptor<TTargetId>[] | undefined;
}): SqlExecutionStackWithDriver<TTargetId>;
declare function createExecutionContext<TContract extends Contract<SqlStorage> = Contract<SqlStorage>, TTargetId extends string = string>(options: {
readonly contract: TContract;
readonly stack: SqlExecutionStack<TTargetId>;
/**
* Optional driver descriptor. When provided, its `capabilities` are folded into the contract's capability matrix alongside the target, adapter, and extension packs — matching the merge `enrichContract` performs at CLI emit time. The driver is *only* consulted as a capability source here; runtime driver lifecycle is wired separately via {@link instantiateExecutionStack} + `runtime.connect`.
*/
readonly driver?: RuntimeDriverDescriptor<'sql', TTargetId, unknown, SqlRuntimeDriverInstance<TTargetId>>;
}): ExecutionContext<TContract>;
//#endregion
//#region src/sql-runtime.d.ts
type Log = RuntimeLog;
interface RuntimeOptions<TContract extends Contract<SqlStorage> = Contract<SqlStorage>> {
readonly context: ExecutionContext<TContract>;
readonly adapter: Adapter<AnyQueryAst, Contract<SqlStorage>, LoweredStatement>;
readonly driver: SqlDriver<unknown>;
readonly verifyMarker?: VerifyMarkerOption;
readonly middleware?: readonly SqlMiddleware[];
readonly mode?: 'strict' | 'permissive';
readonly log?: Log;
}
/**
* SQL-family runtime interface. Named `Runtime` (not `SqlRuntime`) by deliberate exception
* to avoid a repo-wide rename; see ADR 230 (runtime target layer) for the recorded decision.
*/
interface Runtime extends RuntimeQueryable {
connection(): Promise<RuntimeConnection>;
telemetry(): RuntimeTelemetryEvent | null;
close(): Promise<void>;
/**
* Build a reusable {@link PreparedStatement}. Throws
* `RUNTIME.PREPARE_UNUSED_PARAM` if any declared name is unreferenced
* by the callback's plan.
*/
prepare<D extends Declaration<CT>, Row, CT extends CodecTypesBase = CodecTypesBase>(declaration: D, callback: PrepareCallback<D, Row>): Promise<PreparedStatement<ParamsFromDeclaration<D, CT>, Row>>;
}
interface RuntimeConnection extends RuntimeQueryable {
transaction(): Promise<RuntimeTransaction>;
/**
* Returns the connection to the pool for reuse. Only call this when the connection is known to be in a clean state. If a transaction commit/rollback failed or the connection is otherwise suspect, call `destroy(reason)` instead.
*/
release(): Promise<void>;
/**
* Evicts the connection so it is never reused. Call this when the connection may be in an indeterminate state (e.g. a failed rollback leaving an open transaction, or a broken socket).
*
* If teardown fails the error is propagated and the connection remains retryable, so the caller can decide whether to swallow the failure or retry cleanup. Calling destroy() or release() more than once after a successful teardown is caller error.
*
* `reason` is advisory context only. It may be surfaced to driver-level observability hooks (e.g. pg-pool's `'release'` event) but does not influence eviction behavior and is not rethrown.
*/
destroy(reason?: unknown): Promise<void>;
}
interface RuntimeTransaction extends RuntimeQueryable {
commit(): Promise<void>;
rollback(): Promise<void>;
}
interface RuntimeQueryable extends RuntimeScope {
/**
* Run a prepared statement against this scope. Required for the explicit
* `PreparedStatement.execute(target, params)` API — every scope (top-level
* runtime, connection, transaction) routes prepared executions through the
* `SqlQueryable` it is backed by.
*/
executePrepared<Params, Row>(ps: PreparedStatement<Params, Row>, params: Params, options?: RuntimeExecuteOptions): AsyncIterableResult<Row>;
}
interface TransactionContext extends RuntimeQueryable {
readonly invalidated: boolean;
}
/**
* Abstract family-layer base for SQL runtimes. Subclass to build a target runtime
* (e.g. `PostgresRuntimeImpl`); app code should consume the `Runtime` interface returned
* by the target factories, never this class directly.
*/
declare abstract class SqlRuntimeBase<TContract extends Contract<SqlStorage> = Contract<SqlStorage>> extends RuntimeCore<SqlQueryPlan, SqlExecutionPlan, SqlMiddleware> implements Runtime {
#private;
private readonly contract;
private readonly adapter;
private readonly driver;
private readonly familyAdapter;
private readonly contractCodecs;
private readonly codecDescriptors;
private readonly sqlCtx;
private readonly verifyMarkerOption;
private verifyMarkerPromise;
private codecRegistryValidated;
private _telemetry;
constructor(options: RuntimeOptions<TContract>);
/**
* Lower a `SqlQueryPlan` (AST + meta) into a `SqlExecutionPlan`
* with encoded parameters ready for the driver.
*
* Implementation note: SQL splits lower-then-encode across
* {@link lowerToDraft} + {@link encodeDraftParams} so the runtime
* can fire the `beforeExecute` middleware chain between them
* (cipherstash bulk-encrypt, for example, mutates pre-encode
* `ParamRef.value` slots). This protected hook composes the two
* back into the cross-family `lower()` shape `RuntimeCore.execute`
* expects, and is called from the no-middleware fast paths /
* fixtures that hit `RuntimeCore`'s default template directly.
* `execute()` overrides the template and uses the split form so
* `beforeExecute` lands between the two halves.
*
* `ctx: SqlCodecCallContext` is forwarded to `encodeParams` so
* per-query cancellation reaches every codec body during parameter
* encoding. SQL params do not populate `ctx.column` — encode-side
* column metadata is the middleware's domain.
*/
protected lower(plan: SqlQueryPlan, ctx: SqlCodecCallContext): Promise<SqlExecutionPlan>;
/**
* AST → pre-encode draft. The returned plan has `sql` rendered and
* `params` populated with the user-domain values the lowering site
* collected from `ParamRef` nodes. No codec encode has happened
* yet; consumers can mutate `params` via the `SqlParamRefMutator`
* before {@link encodeDraftParams} runs.
*/
private lowerToDraft;
/**
* Encode a draft plan's params through the per-column codecs and
* freeze the result into the final `SqlExecutionPlan` the driver
* sees. Errors surface as `RUNTIME.ENCODE_FAILED` envelopes from
* {@link encodeParams}.
*/
private encodeDraftParams;
/**
* Default driver invocation required by the abstract `RuntimeCore` contract. Every production path overrides `execute()` and routes through `executeAgainstQueryable`, so this hook is defensive only — subclasses that delegate back to `super.execute()` would land here.
*/
protected runDriver(exec: SqlExecutionPlan): AsyncIterable<Record<string, unknown>>;
/**
* SQL pre-compile hook. 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 AST is the authoritative source of execution metadata, so a rewrite needs no sidecar reconciliation here — the lowering adapter and the encoder both walk the rewritten
* AST directly.
*/
protected runBeforeCompile(plan: SqlQueryPlan): Promise<SqlQueryPlan>;
execute<Row>(plan: (SqlExecutionPlan<unknown> | SqlQueryPlan<unknown>) & {
readonly _row?: Row;
}, options?: RuntimeExecuteOptions): AsyncIterableResult<Row>;
executePrepared<Params, Row>(ps: PreparedStatement<Params, Row>, params: Params, options?: RuntimeExecuteOptions): AsyncIterableResult<Row>;
/**
* Returns the raw driver connection. The connection is a `SqlQueryable` — SQL
* issued on it runs below the middleware/codec/telemetry pipeline. It carries
* its own lifecycle (`release`/`destroy`/`beginTransaction`); the caller owns
* disposal.
*/
protected acquireRawConnection(): Promise<SqlConnection>;
private streamRows;
/**
* Execute a plan against a caller-supplied queryable, running the full
* middleware/codec/telemetry pipeline. Use `acquireRawConnection` to obtain a
* queryable that subclasses can bind typed plans to.
*/
protected executeAgainstQueryable<Row>(plan: SqlExecutionPlan<unknown> | SqlQueryPlan<unknown>, queryable: SqlQueryable, options?: RuntimeExecuteOptions): AsyncIterableResult<Row>;
prepare<D extends Declaration<CT>, Row, CT extends CodecTypesBase = CodecTypesBase>(declaration: D, callback: PrepareCallback<D, Row>): Promise<PreparedStatement<ParamsFromDeclaration<D, CT>, Row>>;
/**
* Execute a prepared statement against a caller-supplied queryable, running
* the full middleware/codec/telemetry pipeline.
*/
protected executePreparedAgainstQueryable<P, Row>(ps: PreparedStatementImpl<P, Row>, userParams: Record<string, unknown>, queryable: SqlQueryable, options?: RuntimeExecuteOptions): AsyncIterableResult<Row>;
connection(): Promise<RuntimeConnection>;
private wrapTransaction;
telemetry(): RuntimeTelemetryEvent | null;
close(): Promise<void>;
private ensureCodecRegistryValidated;
private verifyMarker;
private recordTelemetry;
}
/** Minimal structural type `withTransaction` depends on — anything that can open a connection. */
interface ConnectionProvider {
connection(): Promise<RuntimeConnection>;
}
declare function withTransaction<R>(runtime: ConnectionProvider, fn: (tx: TransactionContext) => PromiseLike<R>): Promise<R>;
//#endregion
//#region src/prepared/prepared-statement.d.ts
interface PreparedStatementInternals {
readonly sql: string;
readonly ast: AnyQueryAst;
readonly meta: PlanMeta;
readonly slots: readonly LoweredParam[];
readonly decodeContext: DecodeContext;
readonly paramMetadata: readonly ParamMetadata[];
}
declare class PreparedStatementImpl<Params, Row> implements PreparedStatement<Params, Row>, PreparedStatementInternals {
readonly sql: string;
readonly ast: AnyQueryAst;
readonly meta: PlanMeta;
readonly slots: readonly LoweredParam[];
readonly decodeContext: DecodeContext;
readonly paramMetadata: readonly ParamMetadata[];
constructor(internals: PreparedStatementInternals);
execute(target: RuntimeQueryable, params: Params, options?: RuntimeExecuteOptions): AsyncIterableResult<Row>;
}
//#endregion
export { RuntimeTelemetryEvent as A, PreparedStatement as B, SqlRuntimeTargetDescriptor as C, createSqlExecutionStack as D, createExecutionContext as E, DeclaredCodecId as F, deriveParamMetadata as G, decodeRow as H, DeclaredNullable as I, encodeParamsWithMetadata as K, ParamSpec as L, VerifyMarkerOption as M, BindSiteParams as N, MarkerReader as O, Declaration as P, ParamsFromDeclaration as R, SqlRuntimeExtensionInstance as S, TypeHelperRegistry as T, SqlMiddleware as U, buildDecodeContext as V, SqlMiddlewareContext as W, SqlExecutionStackWithDriver as _, RuntimeConnection as a, SqlRuntimeDriverInstance as b, RuntimeTransaction as c, withTransaction as d, ExecutionContext as f, SqlExecutionStack as g, RuntimeParameterizedCodecDescriptor as h, Runtime as i, TelemetryOutcome as j, RuntimeFamilyAdapter as k, SqlRuntimeBase as l, RuntimeMutationDefaultGenerator as m, PreparedStatementInternals as n, RuntimeOptions as o, GeneratorStability as p, ConnectionProvider as r, RuntimeQueryable as s, PreparedStatementImpl as t, TransactionContext as u, SqlRuntimeAdapterDescriptor as v, SqlStaticContributions as w, SqlRuntimeExtensionDescriptor as x, SqlRuntimeAdapterInstance as y, PrepareCallback as z };
//# sourceMappingURL=prepared-statement-ChI7xyxZ.d.mts.map
{"version":3,"file":"prepared-statement-ChI7xyxZ.d.mts","names":[],"sources":["../src/codecs/encoding.ts","../src/middleware/sql-middleware.ts","../src/codecs/decoding.ts","../src/prepared/types.ts","../src/runtime-spi.ts","../src/sql-context.ts","../src/sql-runtime.ts","../src/prepared/prepared-statement.ts"],"mappings":";;;;;;;;;;;;;UAgBiB;WACN,OAAO;WACP;;iBAeK,oBAAoB,KAAK,uBAAuB;iBAuI1C,yBACpB,4BACA,mBAAmB,iBACnB,KAAK,qBACL,iBAAiB,wBAChB;;;UClKc,6BAA6B;WACnC,UAAU,SAAS;;;;;;UAOb;WACN,KAAK;WACL,MAAM;;U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UAAU,YAAY,KAAK,KAAK,WAAW,iBAAiB,gBACxE,aAAa,GACb,UAAU,gBAAgB,GAAG,OAC5B,QAAQ,kBAAkB,sBAAsB,GAAG,KAAK;;;;;YA+CjD,gCAAgC,GAAG,KAC3C,IAAI,sBAAsB,GAAG,MAC7B,YAAY,yBACZ,WAAW,cACX,UAAU,wBACT,oBAAoB;EA2EjB,cAAc,QAAQ;UAyCpB;EAiCR,aAAa;EAIP,SAAS;UAIP;UAOM;UAkCN;;;UAyBO;EACf,cAAc,QAAQ;;iBAGF,gBAAgB,GACpC,SAAS,oBACT,KAAK,IAAI,uBAAuB,YAAY,KAC3C,QAAQ;;;UClvBM;WACN;WACA,KAAK;WACL,MAAM;WACN,gBAAgB;WAChB,eAAe;WACf,wBAAwB;;cAGtB,sBAAsB,QAAQ,gBAC9B,kBAAkB,QAAQ,MAAM;WAElC;WACA,KAAK;WACL,MAAM;WACN,gBAAgB;WAChB,eAAe;WACf,wBAAwB;cAErB,WAAW;EAUvB,QACE,QAAQ,kBACR,QAAQ,QACR,UAAU,wBACT,oBAAoB"}
+1
-1

@@ -1,2 +0,2 @@

import { A as RuntimeTelemetryEvent, B as PreparedStatement, C as SqlRuntimeTargetDescriptor, D as createSqlExecutionStack, E as createExecutionContext, F as DeclaredCodecId, G as deriveParamMetadata, I as DeclaredNullable, K as encodeParamsWithMetadata, L as ParamSpec, M as VerifyMarkerOption, N as BindSiteParams, O as MarkerReader, P as Declaration, R as ParamsFromDeclaration, S as SqlRuntimeExtensionInstance, T as TypeHelperRegistry, U as SqlMiddleware, W as SqlMiddlewareContext, _ as SqlExecutionStackWithDriver, a as RuntimeConnection, b as SqlRuntimeDriverInstance, c as RuntimeTransaction, d as withTransaction, f as ExecutionContext, g as SqlExecutionStack, h as RuntimeParameterizedCodecDescriptor, i as Runtime, j as TelemetryOutcome, k as RuntimeFamilyAdapter, l as SqlRuntimeBase, m as RuntimeMutationDefaultGenerator, n as PreparedStatementInternals, p as GeneratorStability, r as ConnectionProvider, s as RuntimeQueryable, t as PreparedStatementImpl, u as TransactionContext, v as SqlRuntimeAdapterDescriptor, w as SqlStaticContributions, x as SqlRuntimeExtensionDescriptor, y as SqlRuntimeAdapterInstance, z as PrepareCallback } from "./prepared-statement-BuDdY11z.mjs";
import { A as RuntimeTelemetryEvent, B as PreparedStatement, C as SqlRuntimeTargetDescriptor, D as createSqlExecutionStack, E as createExecutionContext, F as DeclaredCodecId, G as deriveParamMetadata, I as DeclaredNullable, K as encodeParamsWithMetadata, L as ParamSpec, M as VerifyMarkerOption, N as BindSiteParams, O as MarkerReader, P as Declaration, R as ParamsFromDeclaration, S as SqlRuntimeExtensionInstance, T as TypeHelperRegistry, U as SqlMiddleware, W as SqlMiddlewareContext, _ as SqlExecutionStackWithDriver, a as RuntimeConnection, b as SqlRuntimeDriverInstance, c as RuntimeTransaction, d as withTransaction, f as ExecutionContext, g as SqlExecutionStack, h as RuntimeParameterizedCodecDescriptor, i as Runtime, j as TelemetryOutcome, k as RuntimeFamilyAdapter, l as SqlRuntimeBase, m as RuntimeMutationDefaultGenerator, n as PreparedStatementInternals, p as GeneratorStability, r as ConnectionProvider, s as RuntimeQueryable, t as PreparedStatementImpl, u as TransactionContext, v as SqlRuntimeAdapterDescriptor, w as SqlStaticContributions, x as SqlRuntimeExtensionDescriptor, y as SqlRuntimeAdapterInstance, z as PrepareCallback } from "./prepared-statement-ChI7xyxZ.mjs";
import { AfterExecuteResult, RuntimeLog as Log } from "@prisma-next/framework-components/runtime";

@@ -3,0 +3,0 @@ import { Adapter, AnyQueryAst, ContractCodecRegistry, LoweredStatement, MarkerReadResult } from "@prisma-next/sql-relational-core/ast";

@@ -1,2 +0,2 @@

import { a as createExecutionContext, c as lints, d as extractCodecIds, f as validateCodecRegistryCompleteness, g as createAstCodecRegistry, h as encodeParamsWithMetadata, l as budgets, m as deriveParamMetadata, n as withTransaction, o as createSqlExecutionStack, p as validateContractCodecMappings, s as PreparedStatementImpl, t as SqlRuntimeBase, u as lowerSqlPlan } from "./exports-CJ9csSx4.mjs";
import { a as createExecutionContext, c as lints, d as extractCodecIds, f as validateCodecRegistryCompleteness, g as createAstCodecRegistry, h as encodeParamsWithMetadata, l as budgets, m as deriveParamMetadata, n as withTransaction, o as createSqlExecutionStack, p as validateContractCodecMappings, s as PreparedStatementImpl, t as SqlRuntimeBase, u as lowerSqlPlan } from "./exports-tFHOjuUO.mjs";
export { PreparedStatementImpl, SqlRuntimeBase, budgets, createAstCodecRegistry, createExecutionContext, createSqlExecutionStack, deriveParamMetadata, encodeParamsWithMetadata, extractCodecIds, lints, lowerSqlPlan, validateCodecRegistryCompleteness, validateContractCodecMappings, withTransaction };

@@ -1,2 +0,2 @@

import { C as SqlRuntimeTargetDescriptor, H as decodeRow, S as SqlRuntimeExtensionInstance, V as buildDecodeContext, b as SqlRuntimeDriverInstance, f as ExecutionContext, i as Runtime, o as RuntimeOptions, v as SqlRuntimeAdapterDescriptor, x as SqlRuntimeExtensionDescriptor, y as SqlRuntimeAdapterInstance } from "../prepared-statement-BuDdY11z.mjs";
import { C as SqlRuntimeTargetDescriptor, H as decodeRow, S as SqlRuntimeExtensionInstance, V as buildDecodeContext, b as SqlRuntimeDriverInstance, f as ExecutionContext, i as Runtime, o as RuntimeOptions, v as SqlRuntimeAdapterDescriptor, x as SqlRuntimeExtensionDescriptor, y as SqlRuntimeAdapterInstance } from "../prepared-statement-ChI7xyxZ.mjs";
import { CodecDescriptor } from "@prisma-next/framework-components/codec";

@@ -494,6 +494,6 @@ import { ResultType } from "@prisma-next/framework-components/runtime";

declare function createTestContext<TContract extends Contract<SqlStorage>>(contract: TContract, adapter: StubAdapter, options?: {
extensionPacks?: ReadonlyArray<SqlRuntimeExtensionDescriptor<'postgres'>>;
extensions?: ReadonlyArray<SqlRuntimeExtensionDescriptor<'postgres'>>;
}): ExecutionContext<TContract>;
declare function createTestStackInstance(options?: {
extensionPacks?: ReadonlyArray<SqlRuntimeExtensionDescriptor<'postgres'>>;
extensions?: ReadonlyArray<SqlRuntimeExtensionDescriptor<'postgres'>>;
driver?: RuntimeDriverDescriptor<'sql', 'postgres', unknown, SqlRuntimeDriverInstance<'postgres'>>;

@@ -500,0 +500,0 @@ }): import("@prisma-next/framework-components/execution").ExecutionStackInstance<"sql", "postgres", SqlRuntimeAdapterInstance<"postgres">, SqlRuntimeDriverInstance<"postgres">, SqlRuntimeExtensionInstance<"postgres">>;

@@ -1,1 +0,1 @@

{"version":3,"file":"utils.d.mts","names":[],"sources":["../../../1-core/contract/src/ir/sql-node.ts","../../../1-core/contract/src/ir/check-constraint.ts","../../../1-core/contract/src/ir/foreign-key-reference.ts","../../../1-core/contract/src/ir/foreign-key.ts","../../../1-core/contract/src/ir/primary-key.ts","../../../1-core/contract/src/ir/sql-index.ts","../../../1-core/contract/src/ir/storage-column.ts","../../../1-core/contract/src/ir/unique-constraint.ts","../../../1-core/contract/src/ir/storage-table.ts","../../../1-core/contract/src/ir/storage-value-set.ts","../../../1-core/contract/src/ir/sql-storage.ts","../../../1-core/contract/test/test-support.ts","../../test/utils.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;uBAkCsB,gBAAgB;WAC3B;;;;;;;;;;UC1BM;WACN;WACA;WACA,UAAU;;;;;;;;;;;;;;;;cAiBR,wBAAwB;WAC1B;WACA;WACA,UAAU;cAEP,OAAO;;;;;;;;;;;;;;;UCnBJ;WACN;WACA;WACA;WACA;;;;;;;;;;;;;;;;;;cAmBE,4BAA4B;WAC9B,aAAa;WACb;WACA;WACQ;cAEL,OAAO;;;;KCxCT;UAEK;WACN,QAAQ,sBAAsB;WAC9B,QAAQ,sBAAsB;WAC9B;WACA,WAAW;WACX,WAAW;;;;;;;;;;;;;;;;;;;;;;cAuBT,mBAAmB;WACrB,QAAQ;WACR,QAAQ;WACA;WACA,WAAW;WACX,WAAW;cAEhB,OAAO;;;;UCtCJ;WACN;WACA;;;;;cAME,mBAAmB;WACrB;WACQ;cAEL,OAAO;;;;U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I,WAAW"}
{"version":3,"file":"utils.d.mts","names":[],"sources":["../../../1-core/contract/src/ir/sql-node.ts","../../../1-core/contract/src/ir/check-constraint.ts","../../../1-core/contract/src/ir/foreign-key-reference.ts","../../../1-core/contract/src/ir/foreign-key.ts","../../../1-core/contract/src/ir/primary-key.ts","../../../1-core/contract/src/ir/sql-index.ts","../../../1-core/contract/src/ir/storage-column.ts","../../../1-core/contract/src/ir/unique-constraint.ts","../../../1-core/contract/src/ir/storage-table.ts","../../../1-core/contract/src/ir/storage-value-set.ts","../../../1-core/contract/src/ir/sql-storage.ts","../../../1-core/contract/test/test-support.ts","../../test/utils.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;uBAkCsB,gBAAgB;WAC3B;;;;;;;;;;UC1BM;WACN;WACA;WACA,UAAU;;;;;;;;;;;;;;;;cAiBR,wBAAwB;WAC1B;WACA;WACA,UAAU;cAEP,OAAO;;;;;;;;;;;;;;;UCnBJ;WACN;WACA;WACA;WACA;;;;;;;;;;;;;;;;;;cAmBE,4BAA4B;WAC9B,aAAa;WACb;WACA;WACQ;cAEL,OAAO;;;;KCxCT;UAEK;WACN,QAAQ,sBAAsB;WAC9B,QAAQ,sBAAsB;WAC9B;WACA,WAAW;WACX,WAAW;;;;;;;;;;;;;;;;;;;;;;cAuBT,mBAAmB;WACrB,QAAQ;WACR,QAAQ;WACA;WACA,WAAW;WACX,WAAW;cAEhB,OAAO;;;;UCtCJ;WACN;WACA;;;;;cAME,mBAAmB;WACrB;WACQ;cAEL,OAAO;;;;UCZJ;WACN;WACA;WACA;WACA,UAAU;;;;;;;;;;cAWR,cAAc;WAChB;WACQ;WACA;WACA,UAAU;cAEf,OAAO;;;;;;;;;;;;;;UCVJ;WACN;WACA;WACA;WACA;WACA,aAAa;WACb;WACA,UAAU;WACV,UAAU;WACV,WAAW;;;;;;;;;;;;;;;cAgBT,sBAAsB;WACxB;WACA;WACA;WACQ;WACA,aAAa;WACb;WACA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AU,iBAAiB,WAAW,MAAM,aAAa,WAAW,KACpE,SAAS,SAAS,MAAM,IAAI,QAAQ,WAAW;;;;iBAQ3B,mBACpB,SAAS,SACT,MAAM,mBAAmB,wBACxB;;;;;;;;iBAWmB,kBACpB,QAAQ,QACR,UAAU,SAAS,aACnB,UAAU,QAAQ,WAAW,eAC7B,wBAAwB,QAAQ,WAAW,gBAC1C;UAUc;;WAEN;WACA;WACA;WACA;WACA;WACA;;;;;;;;iBASW,eAAe,QAAQ,QAAQ,OAAO,kBAAkB;;;;;iBAoBxD,wBACpB,QAAQ,QACR,UAAU,SAAS,cAClB;;;;;;;iBAea,wBACd,QAAQ,cAAc,iBACrB;;;;;iBAqCa,sBACd,QAAQ,cAAc,iBACrB,cAAc;iBAuCD,4BACd,SAAS,cACR;;;;iBAoBa,8BAA8B;;;;;;iBAmB9B,kBAAkB,kBAAkB,SAAS,aAC3D,UAAU,WACV,SAAS,aACT;EACE,aAAa,cAAc;IAE5B,iBAAiB;iBAWJ,wBAAwB;EACtC,aAAa,cAAc;EAC3B,SAAS,oDAIP;0DAEH,0CAAA,uCAAA,sCAAA;;;;KAcW,cAAc,QAAQ,WAAW,SAAS,aAAa;WACxD,UAAU,cAAc;;;;;;;iBAQnB,qBAAqB;iBA0FrB,2BACd,QAAQ,eAAe,qBACtB,kBAAkB;iBAIL,4DAAkB;iBAIlB,mBACd,UAAU,QAAQ,KAAK,SAAS;EAC9B;EACA;EACA,SAAS,eAAe;EACxB,SAAS,SAAS;EAClB,UAAU,QAAQ,KAAK;IAExB,SAAS;iBA+BI,WAAW"}

@@ -1,2 +0,2 @@

import { a as createExecutionContext, i as decodeRow, o as createSqlExecutionStack, r as buildDecodeContext, t as SqlRuntimeBase } from "../exports-CJ9csSx4.mjs";
import { a as createExecutionContext, i as decodeRow, o as createSqlExecutionStack, r as buildDecodeContext, t as SqlRuntimeBase } from "../exports-tFHOjuUO.mjs";
import { canonicalizeJson } from "@prisma-next/framework-components/utils";

@@ -706,3 +706,3 @@ import { runtimeError } from "@prisma-next/framework-components/runtime";

adapter: createTestAdapterDescriptor(adapter),
extensionPacks: options?.extensionPacks ?? []
extensions: options?.extensions ?? []
}

@@ -716,3 +716,3 @@ });

driver: options?.driver,
extensionPacks: options?.extensionPacks ?? []
extensions: options?.extensions ?? []
}));

@@ -840,3 +840,3 @@ }

capabilities: rest["capabilities"] ?? {},
extensionPacks: rest["extensionPacks"] ?? {},
extensions: rest["extensions"] ?? {},
meta: rest["meta"] ?? {},

@@ -843,0 +843,0 @@ ...execution ? { execution } : {},

{
"name": "@prisma-next/sql-runtime",
"version": "0.16.0-dev.19",
"version": "0.16.0-dev.21",
"license": "Apache-2.0",

@@ -9,18 +9,18 @@ "type": "module",

"dependencies": {
"@prisma-next/contract": "0.16.0-dev.19",
"@prisma-next/utils": "0.16.0-dev.19",
"@prisma-next/framework-components": "0.16.0-dev.19",
"@prisma-next/ids": "0.16.0-dev.19",
"@prisma-next/operations": "0.16.0-dev.19",
"@prisma-next/sql-contract": "0.16.0-dev.19",
"@prisma-next/sql-operations": "0.16.0-dev.19",
"@prisma-next/sql-relational-core": "0.16.0-dev.19",
"@prisma-next/contract": "0.16.0-dev.21",
"@prisma-next/utils": "0.16.0-dev.21",
"@prisma-next/framework-components": "0.16.0-dev.21",
"@prisma-next/ids": "0.16.0-dev.21",
"@prisma-next/operations": "0.16.0-dev.21",
"@prisma-next/sql-contract": "0.16.0-dev.21",
"@prisma-next/sql-operations": "0.16.0-dev.21",
"@prisma-next/sql-relational-core": "0.16.0-dev.21",
"arktype": "^2.2.2"
},
"devDependencies": {
"@prisma-next/test-utils": "0.16.0-dev.19",
"@prisma-next/tsconfig": "0.16.0-dev.19",
"@prisma-next/test-utils": "0.16.0-dev.21",
"@prisma-next/tsconfig": "0.16.0-dev.21",
"@types/pg": "8.20.0",
"pg": "8.22.0",
"@prisma-next/tsdown": "0.16.0-dev.19",
"@prisma-next/tsdown": "0.16.0-dev.21",
"tsdown": "0.22.8",

@@ -27,0 +27,0 @@ "typescript": "5.9.3",

@@ -133,3 +133,3 @@ import type {

readonly adapter: SqlRuntimeAdapterDescriptor<TTargetId>;
readonly extensionPacks: readonly SqlRuntimeExtensionDescriptor<TTargetId>[];
readonly extensions: readonly SqlRuntimeExtensionDescriptor<TTargetId>[];
}

@@ -145,3 +145,3 @@

>,
'target' | 'adapter' | 'driver' | 'extensionPacks'
'target' | 'adapter' | 'driver' | 'extensions'
> & {

@@ -153,3 +153,3 @@ readonly target: SqlRuntimeTargetDescriptor<TTargetId>;

| undefined;
readonly extensionPacks: readonly SqlRuntimeExtensionDescriptor<TTargetId>[];
readonly extensions: readonly SqlRuntimeExtensionDescriptor<TTargetId>[];
};

@@ -181,3 +181,3 @@

| undefined;
readonly extensionPacks?: readonly SqlRuntimeExtensionDescriptor<TTargetId>[] | undefined;
readonly extensions?: readonly SqlRuntimeExtensionDescriptor<TTargetId>[] | undefined;
}): SqlExecutionStackWithDriver<TTargetId> {

@@ -188,3 +188,3 @@ return createExecutionStack({

driver: options.driver,
extensionPacks: options.extensionPacks,
extensions: options.extensions,
});

@@ -202,3 +202,3 @@ }

stack.adapter.id,
...stack.extensionPacks.map((pack) => pack.id),
...stack.extensions.map((pack) => pack.id),
]);

@@ -783,3 +783,3 @@

...(driver ? [driver] : []),
...stack.extensionPacks,
...stack.extensions,
];

@@ -798,3 +798,3 @@ const mergedCapabilities = mergeCapabilityMatrices(

stack.adapter,
...stack.extensionPacks,
...stack.extensions,
];

@@ -801,0 +801,0 @@

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

import { AnyCodecDescriptor, CodecDescriptor } from "@prisma-next/framework-components/codec";
import { AfterExecuteResult, AsyncIterableResult, ExecutionPlan, RuntimeCore, RuntimeExecuteOptions, RuntimeLog, RuntimeMiddleware, RuntimeMiddlewareContext } from "@prisma-next/framework-components/runtime";
import { Adapter, AnyQueryAst, Codec, CodecRef, ContractCodecRegistry, LoweredParam, LoweredStatement, MarkerReadResult, SqlCodecCallContext, SqlConnection, SqlDriver, SqlQueryable } from "@prisma-next/sql-relational-core/ast";
import { ExecutionStack, RuntimeAdapterDescriptor, RuntimeAdapterInstance, RuntimeDriverDescriptor, RuntimeDriverInstance, RuntimeExtensionDescriptor, RuntimeExtensionInstance, RuntimeTargetDescriptor, RuntimeTargetInstance } from "@prisma-next/framework-components/execution";
import { SqlOperationDescriptors } from "@prisma-next/sql-operations";
import { SqlParamRefMutator } from "@prisma-next/sql-relational-core/middleware";
import { Contract, JsonValue, PlanMeta } from "@prisma-next/contract/types";
import { SqlStorage } from "@prisma-next/sql-contract/types";
import { ExecutionContext, TypeHelperRegistry } from "@prisma-next/sql-relational-core/query-lane-context";
import { SqlExecutionPlan, SqlQueryPlan } from "@prisma-next/sql-relational-core/plan";
import { CodecTypesBase, CodecValue, Expression, RawCodecInferer } from "@prisma-next/sql-relational-core/expression";
import { RuntimeScope } from "@prisma-next/sql-relational-core/types";
//#region src/codecs/encoding.d.ts
interface ParamMetadata {
readonly codec: CodecRef | undefined;
readonly name: string | undefined;
}
declare function deriveParamMetadata(ast: AnyQueryAst): readonly ParamMetadata[];
declare function encodeParamsWithMetadata(values: readonly unknown[], metadata: readonly ParamMetadata[], ctx: SqlCodecCallContext, contractCodecs?: ContractCodecRegistry): Promise<readonly unknown[]>;
//#endregion
//#region src/middleware/sql-middleware.d.ts
interface SqlMiddlewareContext extends RuntimeMiddlewareContext {
readonly contract: Contract<SqlStorage>;
}
/**
* Pre-lowering query view passed to `beforeCompile`. Carries the typed SQL
* AST and plan metadata; `sql`/`params` are produced later by the adapter.
*/
interface DraftPlan {
readonly ast: AnyQueryAst;
readonly meta: PlanMeta;
}
interface SqlMiddleware<TCodecMap extends Record<string, unknown> = Record<string, unknown>> extends RuntimeMiddleware<SqlExecutionPlan, SqlParamRefMutator<TCodecMap>> {
readonly familyId?: 'sql';
/**
* Rewrite the query AST before it is lowered to SQL. Middlewares run in
* registration order; each sees the predecessor's output, so rewrites
* compose (e.g. soft-delete + tenant isolation).
*
* Return `undefined` (or a draft whose `ast` reference equals the input's)
* to pass through. Return a draft with a new `ast` reference to replace it;
* the runtime emits a `middleware.rewrite` debug log event and continues
* with the new draft. `adapter.lower()` runs once after the chain.
*
* Use `AstRewriter` / `SelectAst.withWhere` / `AndExpr.of` etc. to build
* the rewritten AST. Predicates and literals go through parameterized
* constructors by default — no SQL-injection surface is added. **Warning:**
* constructing `LiteralExpr.of(userInput)` from untrusted input bypasses
* that guarantee; use `ParamRef.of(userInput, ...)` instead.
*
* See `docs/architecture docs/subsystems/4. Runtime & Middleware Framework.md`.
*/
beforeCompile?(draft: DraftPlan, ctx: SqlMiddlewareContext): Promise<DraftPlan | undefined>;
/**
* Mutate `ParamRef.value` slots before encode runs. The third
* `params` argument is a {@link SqlParamRefMutator} scoped to value
* slots only — SQL strings, projections, and `ParamRef` membership
* are not mutable. Existing `(plan)` and `(plan, ctx)` middleware
* bodies that ignore the additional argument continue to compile
* and run unchanged.
*
* Lifecycle position:
* `beforeCompile → lowerSqlPlan → beforeExecute → encodeParams → intercept → driver`.
*
* The plan handed in is the SQL execution plan after lowering but
* *before* parameter encoding: `plan.params[i]` is the user-domain
* value the mutator's `entries()` iterator surfaces (e.g. an
* `EncryptedEnvelopeBase` for a cipherstash-codec'd column, or a
* plain JS value for non-codec'd ParamRefs). Mutations applied via
* `params.replaceValue` / `replaceValues` are visible to encode,
* which then renders the mutated value through the column's codec.
*
* `ctx.signal` carries the per-query `AbortSignal` (ADR 207);
* middleware that wraps a network SDK forwards `ctx.signal` to
* that SDK. Cooperative cancellation: a body that ignores the
* signal still surfaces `RUNTIME.ABORTED { phase: 'beforeExecute' }`
* promptly via the runtime's race against the signal.
*/
beforeExecute?(plan: SqlExecutionPlan, ctx: SqlMiddlewareContext, params?: SqlParamRefMutator<TCodecMap>): void | Promise<void>;
onRow?(row: Record<string, unknown>, plan: SqlExecutionPlan, ctx: SqlMiddlewareContext): Promise<void>;
afterExecute?(plan: SqlExecutionPlan, result: AfterExecuteResult, ctx: SqlMiddlewareContext): Promise<void>;
}
//#endregion
//#region src/codecs/decoding.d.ts
type ColumnRef = {
table: string;
column: string;
};
interface DecodeContext {
readonly aliases: ReadonlyArray<string> | undefined;
readonly codecs: ReadonlyMap<string, Codec>;
readonly columnRefs: ReadonlyMap<string, ColumnRef>;
readonly includeAliases: ReadonlySet<string>;
readonly manyAliases: ReadonlySet<string>;
}
declare function buildDecodeContext(ast: AnyQueryAst, contractCodecs: ContractCodecRegistry | undefined): DecodeContext;
/**
* Decodes a row by dispatching all per-cell codec calls concurrently via `Promise.all`. Each cell follows the single-armed `decodeField` path. 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`.
*
* When `rowCtx.signal` is provided:
*
* - **Already-aborted at entry** short-circuits with `RUNTIME.ABORTED` (`{ phase: 'decode' }`) before any `codec.decode` call is made.
* - **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).
* - Existing `RUNTIME.DECODE_FAILED` envelopes from codec bodies pass through unchanged (no double wrap).
*/
declare function decodeRow(row: Record<string, unknown>, decodeCtx: DecodeContext, rowCtx: SqlCodecCallContext): Promise<Record<string, unknown>>;
//#endregion
//#region src/prepared/types.d.ts
type ParamSpec<CT extends CodecTypesBase = CodecTypesBase> = (keyof CT & string) | {
readonly codecId: keyof CT & string;
readonly typeParams?: JsonValue;
readonly nullable?: boolean;
};
type Declaration<CT extends CodecTypesBase = CodecTypesBase> = Readonly<Record<string, ParamSpec<CT>>>;
type DeclaredCodecId<S> = S extends string ? S : S extends {
readonly codecId: infer C extends string;
} ? C : never;
type DeclaredNullable<S> = S extends {
readonly nullable: true;
} ? true : false;
type BindSiteParams<D> = { readonly [K in keyof D]: Expression<{
codecId: DeclaredCodecId<D[K]>;
nullable: DeclaredNullable<D[K]>;
}>; };
type ParamsFromDeclaration<D, CT extends CodecTypesBase> = { readonly [K in keyof D]: CodecValue<DeclaredCodecId<D[K]>, DeclaredNullable<D[K]>, CT>; };
type PrepareCallback<D, Row> = (params: BindSiteParams<D>) => SqlQueryPlan<Row>;
interface PreparedStatement<Params, Row> {
readonly sql: string;
readonly ast: AnyQueryAst;
readonly meta: PlanMeta;
readonly slots: readonly LoweredParam[];
/**
* Run this prepared statement against the given target. The target carries
* the execution scope (top-level runtime, an explicit connection, an active
* transaction). It is required and explicit — there is no implicit binding
* back to the runtime that produced this statement.
*/
execute(target: RuntimeQueryable, params: Params, options?: RuntimeExecuteOptions): AsyncIterableResult<Row>;
}
//#endregion
//#region src/runtime-spi.d.ts
/**
* Reader of the SQL contract marker. SQL runtimes call `readMarker` before executing user queries (unless `verifyMarker` is false). The adapter owns the full marker-read flow — probing for storage, issuing the read, decoding the row — and returns a tagged result so callers can distinguish "marker storage missing", "no row for this space", and "present".
*/
interface MarkerReader {
readMarker(queryable: SqlQueryable): Promise<MarkerReadResult>;
}
/**
* SQL family adapter SPI consumed by `SqlRuntimeBase`. Encapsulates the
* runtime contract, marker reader, and plan validation logic so the
* runtime can be unit-tested without a concrete SQL adapter profile.
*
* Implemented by `SqlFamilyAdapter` for production and by mock classes
* in tests.
*/
interface RuntimeFamilyAdapter<TContract = unknown> {
readonly contract: TContract;
readonly markerReader: MarkerReader;
validatePlan(plan: ExecutionPlan, contract: TContract): void;
}
/**
* Controls whether the runtime reads and checks the contract marker row on first execute.
*
* - `'onFirstUse'` (default when omitted): the marker is read once per runtime lifetime, on the
* first `execute()` call. Any hash mismatch or absent marker emits a structured `warn`-level log
* through the runtime's {@link RuntimeLog} and the query proceeds. Subsequent queries skip the
* marker reader entirely.
* - `false`: the marker reader is never invoked. No log line is emitted. Use this to opt out of
* the diagnostic entirely (e.g. during a known deploy-skew window).
*
* The string-or-false shape is forward-compatible: future modes such as `'startup'` (eager check
* inside the wrapper `connect()` step) can be added as additive union members without an API break.
* `true` is intentionally not permitted — modes are always named.
*
* Default-on so contract drift surfaces by default — teams who never thought to enable the diagnostic
* still see the warning when something goes wrong.
*/
type VerifyMarkerOption = 'onFirstUse' | false;
type TelemetryOutcome = 'success' | 'runtime-error';
interface RuntimeTelemetryEvent {
readonly lane: string;
readonly target: string;
readonly fingerprint: string;
readonly outcome: TelemetryOutcome;
readonly durationMs?: number;
}
//#endregion
//#region src/sql-context.d.ts
/**
* Runtime parameterized codec descriptor.
*
* The unified `CodecDescriptor<P>` shape applied to parameterized codecs — `paramsSchema: StandardSchemaV1<P>` for JSON-boundary validation, `factory: (P) => (CodecInstanceContext) => Codec` for the curried higher-order codec. The factory is called once per `storage.types` instance (or once per inline-`typeParams` column); per-instance state lives in the closure.
*
* Codec-registry-unification spec § Decision.
*/
type RuntimeParameterizedCodecDescriptor<P = Record<string, unknown>> = CodecDescriptor<P>;
/**
* Contributor protocol for SQL components (target, adapter, extension pack). The unified `codecs:` slot returns the full {@link CodecDescriptor} list — non-parameterized and parameterized descriptors live side-by-side in the same array. The framework dispatches every codec id through the unified descriptor map without branching on parameterization.
*/
interface SqlStaticContributions {
readonly codecs: () => ReadonlyArray<AnyCodecDescriptor>;
readonly queryOperations?: () => SqlOperationDescriptors;
readonly mutationDefaultGenerators?: () => ReadonlyArray<RuntimeMutationDefaultGenerator>;
}
/**
* Scope across which a generator's value is constant.
*
* - `'field'` — one value per defaulting site (one column, one row). Cache strategy: no cache; call per defaulting site. Right for per-row identifiers (UUIDs, CUIDs, ULIDs, nanoid, ksuid).
* - `'row'` — one value across all defaulting sites of one row of one operation. Cache strategy: per-call cache keyed by `generatorId`. Right for correlation ids stamped into multiple columns of one row.
* - `'query'` — one value across all rows and columns of one ORM operation. Cache strategy: caller-provided cache keyed by `generatorId`. Right for `timestampNow` (a single timestamp per bulk insert/update).
*/
type GeneratorStability = 'field' | 'row' | 'query';
interface RuntimeMutationDefaultGenerator {
readonly id: string;
readonly generate: (params?: Record<string, unknown>) => unknown;
/**
* Scope across which the generator's value is constant. The framework derives the cache strategy from this declaration; generator authors never need to know about cache keys. See `GeneratorStability` for the per-value semantics.
*/
readonly stability: GeneratorStability;
}
interface SqlRuntimeTargetDescriptor<TTargetId extends string = string, TTargetInstance extends RuntimeTargetInstance<'sql', TTargetId> = RuntimeTargetInstance<'sql', TTargetId>> extends RuntimeTargetDescriptor<'sql', TTargetId, TTargetInstance>, SqlStaticContributions {}
interface SqlRuntimeAdapterDescriptor<TTargetId extends string = string, TAdapterInstance extends RuntimeAdapterInstance<'sql', TTargetId> = SqlRuntimeAdapterInstance<TTargetId>> extends RuntimeAdapterDescriptor<'sql', TTargetId, TAdapterInstance>, SqlStaticContributions {
/**
* Codec inferer used by `fns.raw` to look up the codec id for a bare-literal interpolation. Required on every SQL adapter descriptor — the facade reads it off the descriptor at client-construction time without instantiating the runtime adapter.
*/
readonly rawCodecInferer: RawCodecInferer;
}
interface SqlRuntimeExtensionDescriptor<TTargetId extends string = string> extends RuntimeExtensionDescriptor<'sql', TTargetId, SqlRuntimeExtensionInstance<TTargetId>>, SqlStaticContributions {
create(): SqlRuntimeExtensionInstance<TTargetId>;
}
interface SqlExecutionStack<TTargetId extends string = string> {
readonly target: SqlRuntimeTargetDescriptor<TTargetId>;
readonly adapter: SqlRuntimeAdapterDescriptor<TTargetId>;
readonly extensionPacks: readonly SqlRuntimeExtensionDescriptor<TTargetId>[];
}
type SqlExecutionStackWithDriver<TTargetId extends string = string> = Omit<ExecutionStack<'sql', TTargetId, SqlRuntimeAdapterInstance<TTargetId>, SqlRuntimeDriverInstance<TTargetId>, SqlRuntimeExtensionInstance<TTargetId>>, 'target' | 'adapter' | 'driver' | 'extensionPacks'> & {
readonly target: SqlRuntimeTargetDescriptor<TTargetId>;
readonly adapter: SqlRuntimeAdapterDescriptor<TTargetId, SqlRuntimeAdapterInstance<TTargetId>>;
readonly driver: RuntimeDriverDescriptor<'sql', TTargetId, unknown, SqlRuntimeDriverInstance<TTargetId>> | undefined;
readonly extensionPacks: readonly SqlRuntimeExtensionDescriptor<TTargetId>[];
};
interface SqlRuntimeExtensionInstance<TTargetId extends string> extends RuntimeExtensionInstance<'sql', TTargetId> {}
type SqlRuntimeAdapterInstance<TTargetId extends string = string> = RuntimeAdapterInstance<'sql', TTargetId> & Adapter<AnyQueryAst, Contract<SqlStorage>, LoweredStatement>;
/**
* NOTE: Binding type is intentionally erased to unknown at this shared runtime layer. Target clients (for example `postgres()`) validate and construct the concrete binding before calling `driver.connect(binding)`, which keeps runtime behavior safe today. A future follow-up can preserve TBinding through stack/context generics end-to-end.
*/
type SqlRuntimeDriverInstance<TTargetId extends string = string> = RuntimeDriverInstance<'sql', TTargetId> & SqlDriver<unknown>;
declare function createSqlExecutionStack<TTargetId extends string>(options: {
readonly target: SqlRuntimeTargetDescriptor<TTargetId>;
readonly adapter: SqlRuntimeAdapterDescriptor<TTargetId>;
readonly driver?: RuntimeDriverDescriptor<'sql', TTargetId, unknown, SqlRuntimeDriverInstance<TTargetId>> | undefined;
readonly extensionPacks?: readonly SqlRuntimeExtensionDescriptor<TTargetId>[] | undefined;
}): SqlExecutionStackWithDriver<TTargetId>;
declare function createExecutionContext<TContract extends Contract<SqlStorage> = Contract<SqlStorage>, TTargetId extends string = string>(options: {
readonly contract: TContract;
readonly stack: SqlExecutionStack<TTargetId>;
/**
* Optional driver descriptor. When provided, its `capabilities` are folded into the contract's capability matrix alongside the target, adapter, and extension packs — matching the merge `enrichContract` performs at CLI emit time. The driver is *only* consulted as a capability source here; runtime driver lifecycle is wired separately via {@link instantiateExecutionStack} + `runtime.connect`.
*/
readonly driver?: RuntimeDriverDescriptor<'sql', TTargetId, unknown, SqlRuntimeDriverInstance<TTargetId>>;
}): ExecutionContext<TContract>;
//#endregion
//#region src/sql-runtime.d.ts
type Log = RuntimeLog;
interface RuntimeOptions<TContract extends Contract<SqlStorage> = Contract<SqlStorage>> {
readonly context: ExecutionContext<TContract>;
readonly adapter: Adapter<AnyQueryAst, Contract<SqlStorage>, LoweredStatement>;
readonly driver: SqlDriver<unknown>;
readonly verifyMarker?: VerifyMarkerOption;
readonly middleware?: readonly SqlMiddleware[];
readonly mode?: 'strict' | 'permissive';
readonly log?: Log;
}
/**
* SQL-family runtime interface. Named `Runtime` (not `SqlRuntime`) by deliberate exception
* to avoid a repo-wide rename; see ADR 230 (runtime target layer) for the recorded decision.
*/
interface Runtime extends RuntimeQueryable {
connection(): Promise<RuntimeConnection>;
telemetry(): RuntimeTelemetryEvent | null;
close(): Promise<void>;
/**
* Build a reusable {@link PreparedStatement}. Throws
* `RUNTIME.PREPARE_UNUSED_PARAM` if any declared name is unreferenced
* by the callback's plan.
*/
prepare<D extends Declaration<CT>, Row, CT extends CodecTypesBase = CodecTypesBase>(declaration: D, callback: PrepareCallback<D, Row>): Promise<PreparedStatement<ParamsFromDeclaration<D, CT>, Row>>;
}
interface RuntimeConnection extends RuntimeQueryable {
transaction(): Promise<RuntimeTransaction>;
/**
* Returns the connection to the pool for reuse. Only call this when the connection is known to be in a clean state. If a transaction commit/rollback failed or the connection is otherwise suspect, call `destroy(reason)` instead.
*/
release(): Promise<void>;
/**
* Evicts the connection so it is never reused. Call this when the connection may be in an indeterminate state (e.g. a failed rollback leaving an open transaction, or a broken socket).
*
* If teardown fails the error is propagated and the connection remains retryable, so the caller can decide whether to swallow the failure or retry cleanup. Calling destroy() or release() more than once after a successful teardown is caller error.
*
* `reason` is advisory context only. It may be surfaced to driver-level observability hooks (e.g. pg-pool's `'release'` event) but does not influence eviction behavior and is not rethrown.
*/
destroy(reason?: unknown): Promise<void>;
}
interface RuntimeTransaction extends RuntimeQueryable {
commit(): Promise<void>;
rollback(): Promise<void>;
}
interface RuntimeQueryable extends RuntimeScope {
/**
* Run a prepared statement against this scope. Required for the explicit
* `PreparedStatement.execute(target, params)` API — every scope (top-level
* runtime, connection, transaction) routes prepared executions through the
* `SqlQueryable` it is backed by.
*/
executePrepared<Params, Row>(ps: PreparedStatement<Params, Row>, params: Params, options?: RuntimeExecuteOptions): AsyncIterableResult<Row>;
}
interface TransactionContext extends RuntimeQueryable {
readonly invalidated: boolean;
}
/**
* Abstract family-layer base for SQL runtimes. Subclass to build a target runtime
* (e.g. `PostgresRuntimeImpl`); app code should consume the `Runtime` interface returned
* by the target factories, never this class directly.
*/
declare abstract class SqlRuntimeBase<TContract extends Contract<SqlStorage> = Contract<SqlStorage>> extends RuntimeCore<SqlQueryPlan, SqlExecutionPlan, SqlMiddleware> implements Runtime {
#private;
private readonly contract;
private readonly adapter;
private readonly driver;
private readonly familyAdapter;
private readonly contractCodecs;
private readonly codecDescriptors;
private readonly sqlCtx;
private readonly verifyMarkerOption;
private verifyMarkerPromise;
private codecRegistryValidated;
private _telemetry;
constructor(options: RuntimeOptions<TContract>);
/**
* Lower a `SqlQueryPlan` (AST + meta) into a `SqlExecutionPlan`
* with encoded parameters ready for the driver.
*
* Implementation note: SQL splits lower-then-encode across
* {@link lowerToDraft} + {@link encodeDraftParams} so the runtime
* can fire the `beforeExecute` middleware chain between them
* (cipherstash bulk-encrypt, for example, mutates pre-encode
* `ParamRef.value` slots). This protected hook composes the two
* back into the cross-family `lower()` shape `RuntimeCore.execute`
* expects, and is called from the no-middleware fast paths /
* fixtures that hit `RuntimeCore`'s default template directly.
* `execute()` overrides the template and uses the split form so
* `beforeExecute` lands between the two halves.
*
* `ctx: SqlCodecCallContext` is forwarded to `encodeParams` so
* per-query cancellation reaches every codec body during parameter
* encoding. SQL params do not populate `ctx.column` — encode-side
* column metadata is the middleware's domain.
*/
protected lower(plan: SqlQueryPlan, ctx: SqlCodecCallContext): Promise<SqlExecutionPlan>;
/**
* AST → pre-encode draft. The returned plan has `sql` rendered and
* `params` populated with the user-domain values the lowering site
* collected from `ParamRef` nodes. No codec encode has happened
* yet; consumers can mutate `params` via the `SqlParamRefMutator`
* before {@link encodeDraftParams} runs.
*/
private lowerToDraft;
/**
* Encode a draft plan's params through the per-column codecs and
* freeze the result into the final `SqlExecutionPlan` the driver
* sees. Errors surface as `RUNTIME.ENCODE_FAILED` envelopes from
* {@link encodeParams}.
*/
private encodeDraftParams;
/**
* Default driver invocation required by the abstract `RuntimeCore` contract. Every production path overrides `execute()` and routes through `executeAgainstQueryable`, so this hook is defensive only — subclasses that delegate back to `super.execute()` would land here.
*/
protected runDriver(exec: SqlExecutionPlan): AsyncIterable<Record<string, unknown>>;
/**
* SQL pre-compile hook. 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 AST is the authoritative source of execution metadata, so a rewrite needs no sidecar reconciliation here — the lowering adapter and the encoder both walk the rewritten
* AST directly.
*/
protected runBeforeCompile(plan: SqlQueryPlan): Promise<SqlQueryPlan>;
execute<Row>(plan: (SqlExecutionPlan<unknown> | SqlQueryPlan<unknown>) & {
readonly _row?: Row;
}, options?: RuntimeExecuteOptions): AsyncIterableResult<Row>;
executePrepared<Params, Row>(ps: PreparedStatement<Params, Row>, params: Params, options?: RuntimeExecuteOptions): AsyncIterableResult<Row>;
/**
* Returns the raw driver connection. The connection is a `SqlQueryable` — SQL
* issued on it runs below the middleware/codec/telemetry pipeline. It carries
* its own lifecycle (`release`/`destroy`/`beginTransaction`); the caller owns
* disposal.
*/
protected acquireRawConnection(): Promise<SqlConnection>;
private streamRows;
/**
* Execute a plan against a caller-supplied queryable, running the full
* middleware/codec/telemetry pipeline. Use `acquireRawConnection` to obtain a
* queryable that subclasses can bind typed plans to.
*/
protected executeAgainstQueryable<Row>(plan: SqlExecutionPlan<unknown> | SqlQueryPlan<unknown>, queryable: SqlQueryable, options?: RuntimeExecuteOptions): AsyncIterableResult<Row>;
prepare<D extends Declaration<CT>, Row, CT extends CodecTypesBase = CodecTypesBase>(declaration: D, callback: PrepareCallback<D, Row>): Promise<PreparedStatement<ParamsFromDeclaration<D, CT>, Row>>;
/**
* Execute a prepared statement against a caller-supplied queryable, running
* the full middleware/codec/telemetry pipeline.
*/
protected executePreparedAgainstQueryable<P, Row>(ps: PreparedStatementImpl<P, Row>, userParams: Record<string, unknown>, queryable: SqlQueryable, options?: RuntimeExecuteOptions): AsyncIterableResult<Row>;
connection(): Promise<RuntimeConnection>;
private wrapTransaction;
telemetry(): RuntimeTelemetryEvent | null;
close(): Promise<void>;
private ensureCodecRegistryValidated;
private verifyMarker;
private recordTelemetry;
}
/** Minimal structural type `withTransaction` depends on — anything that can open a connection. */
interface ConnectionProvider {
connection(): Promise<RuntimeConnection>;
}
declare function withTransaction<R>(runtime: ConnectionProvider, fn: (tx: TransactionContext) => PromiseLike<R>): Promise<R>;
//#endregion
//#region src/prepared/prepared-statement.d.ts
interface PreparedStatementInternals {
readonly sql: string;
readonly ast: AnyQueryAst;
readonly meta: PlanMeta;
readonly slots: readonly LoweredParam[];
readonly decodeContext: DecodeContext;
readonly paramMetadata: readonly ParamMetadata[];
}
declare class PreparedStatementImpl<Params, Row> implements PreparedStatement<Params, Row>, PreparedStatementInternals {
readonly sql: string;
readonly ast: AnyQueryAst;
readonly meta: PlanMeta;
readonly slots: readonly LoweredParam[];
readonly decodeContext: DecodeContext;
readonly paramMetadata: readonly ParamMetadata[];
constructor(internals: PreparedStatementInternals);
execute(target: RuntimeQueryable, params: Params, options?: RuntimeExecuteOptions): AsyncIterableResult<Row>;
}
//#endregion
export { RuntimeTelemetryEvent as A, PreparedStatement as B, SqlRuntimeTargetDescriptor as C, createSqlExecutionStack as D, createExecutionContext as E, DeclaredCodecId as F, deriveParamMetadata as G, decodeRow as H, DeclaredNullable as I, encodeParamsWithMetadata as K, ParamSpec as L, VerifyMarkerOption as M, BindSiteParams as N, MarkerReader as O, Declaration as P, ParamsFromDeclaration as R, SqlRuntimeExtensionInstance as S, TypeHelperRegistry as T, SqlMiddleware as U, buildDecodeContext as V, SqlMiddlewareContext as W, SqlExecutionStackWithDriver as _, RuntimeConnection as a, SqlRuntimeDriverInstance as b, RuntimeTransaction as c, withTransaction as d, ExecutionContext as f, SqlExecutionStack as g, RuntimeParameterizedCodecDescriptor as h, Runtime as i, TelemetryOutcome as j, RuntimeFamilyAdapter as k, SqlRuntimeBase as l, RuntimeMutationDefaultGenerator as m, PreparedStatementInternals as n, RuntimeOptions as o, GeneratorStability as p, ConnectionProvider as r, RuntimeQueryable as s, PreparedStatementImpl as t, TransactionContext as u, SqlRuntimeAdapterDescriptor as v, SqlStaticContributions as w, SqlRuntimeExtensionDescriptor as x, SqlRuntimeAdapterInstance as y, PrepareCallback as z };
//# sourceMappingURL=prepared-statement-BuDdY11z.d.mts.map
{"version":3,"file":"prepared-statement-BuDdY11z.d.mts","names":[],"sources":["../src/codecs/encoding.ts","../src/middleware/sql-middleware.ts","../src/codecs/decoding.ts","../src/prepared/types.ts","../src/runtime-spi.ts","../src/sql-context.ts","../src/sql-runtime.ts","../src/prepared/prepared-statement.ts"],"mappings":";;;;;;;;;;;;;UAgBiB;WACN,OAAO;WACP;;iBAeK,oBAAoB,KAAK,uBAAuB;iBAuI1C,yBACpB,4BACA,mBAAmB,iBACnB,KAAK,qBACL,iBAAiB,wBAChB;;;UClKc,6BAA6B;WACnC,UAAU,SAAS;;;;;;UAOb;WACN,KAAK;WACL,MAAM;;UAGA,cAAc,kBAAkB,0BAA0B,iCACjE,kBAAkB,kBAAkB,mBAAmB;WACtD;;;;;;;;;;;;;;;;;;;EAmBT,eAAe,OAAO,WAAW,KAAK,uBAAuB,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;EA0BrE,eACE,MAAM,kBACN,KAAK,sBACL,SAAS,mBAAmB,oBACpB;EACV,OACE,KAAK,yBACL,MAAM,kBACN,KAAK,uBACJ;EACH,cACE,MAAM,kBACN,QAAQ,oBACR,KAAK,uBACJ;;;;KCvEA;EAAc;EAAe;;UAEjB;WACN,SAAS;WACT,QAAQ,oBAAoB;WAC5B,YAAY,oBAAoB;WAChC,gBAAgB;WAChB,aAAa;;iBA4BR,mBACd,KAAK,aACL,gBAAgB,oCACf;;;;;;;;;;iBAgMmB,UACpB,KAAK,yBACL,WAAW,eACX,QAAQ,sBACP,QAAQ;;;KC1OC,U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