@prisma/orm-family-sql 8.0.0-rc.18-dev.5 → 8.0.0-rc.18-dev.6

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.
@@ -4,31 +4,45 @@ import { r as SqlOperationDescriptors } from "./index-We-mbWnZ.mjs";
4
4
  import { E as CodecRef$1, Pt as SqlCodecCallContext, S as Codec$1, h as AnyQueryAst, ht as LoweredStatement, k as ContractCodecRegistry, mt as LoweredParam } from "./types-Sh5HuaZE-CqThc46M.mjs";
5
5
  import { c as SqlQueryable, i as SqlDriver, l as SqlStatementStats, r as SqlConnection } from "./driver-types-DRsYeq3j-X_D6hNMZ.mjs";
6
6
  import { n as SqlQueryPlan } from "./plan-cGEaSXHv-j0w37mVT.mjs";
7
- import { a as CodecValue, i as CodecTypesBase, l as RawCodecInferer, o as Expression, t as AffectedCount } from "./expression-Ck1wys3N-RNyviMcU.mjs";
7
+ import { i as CodecTypesBase, l as RawCodecInferer } from "./expression-Ck1wys3N-RNyviMcU.mjs";
8
8
  import "./expression-DWcDQHh9.mjs";
9
9
  import { m as MarkerReadResult, t as Adapter } from "./ast-Dp6lQXUX.mjs";
10
10
  import { t as SqlExecutionPlan } from "./sql-execution-plan-C7XauPPu-eskZJbmm.mjs";
11
11
  import "./plan-_8dKi13Q.mjs";
12
12
  import { n as CollectionMethodContribution } from "./collection-methods-BnR4UjcW-tiz3frtf.mjs";
13
- import { n as ExecutionContext } from "./query-lane-context-C42-u9L1-Bxa4DkI_.mjs";
13
+ import { n as ExecutionContext, t as CodecDescriptorRegistry } from "./query-lane-context-C42-u9L1-Bxa4DkI_.mjs";
14
14
  import "./query-lane-context-DW5q2RAY.mjs";
15
- import { h as RuntimeScope } from "./types-Cl4MLNrS-lbf-K25i.mjs";
15
+ import { _ as SqlOrmPlan, h as RuntimeScope } from "./types-Cl4MLNrS-lbf-K25i.mjs";
16
16
  import "./types-BkA6tyT-.mjs";
17
- import "./collection-methods-DoBrRR69.mjs";
17
+ import { c as PreparedExecution, g as TransactionStartTarget, l as PreparedFor, n as Declaration, o as ParamsFromDeclaration, s as PrepareCallback, u as PreparedStatement, v as preparedStatementExecute, y as preparedStatementQuery } from "./transaction-state-DR3nKTmH-BZ-54Zu0.mjs";
18
18
  import { i as SqlParamRefMutator } from "./middleware-YsFLC19Y-xhimGDiS.mjs";
19
19
  import "./middleware-DOKGNt72.mjs";
20
+ import "./collection-methods-DoBrRR69.mjs";
20
21
  import { AnyCodecDescriptor, CodecDescriptor } from "@prisma/orm-framework/components/codec";
21
- import { Contract, JsonValue, PlanMeta } from "@prisma/orm-framework/contract/types";
22
- import { ActivityContext, ActivityEndedResult, ActivityFinalizedResult, AsyncIterableResult, ExecuteInterceptResult, ExecutionPlan, MutationDefaultGeneratorContributor, QueryInterceptResult, RuntimeActivity, RuntimeCore, RuntimeExecuteOptions, RuntimeLog, RuntimeMiddleware } from "@prisma/orm-framework/components/runtime";
22
+ import { Contract, PlanMeta } from "@prisma/orm-framework/contract/types";
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";
23
24
  import { ExecutionStack, RuntimeAdapterDescriptor, RuntimeAdapterInstance, RuntimeDriverDescriptor, RuntimeDriverInstance, RuntimeExtensionDescriptor, RuntimeExtensionInstance, RuntimeTargetDescriptor, RuntimeTargetInstance } from "@prisma/orm-framework/components/execution";
24
- //#region ../../../2-sql/5-runtime/dist/prepared-statement-BwHkxfuI.d.mts
25
- //#region src/codecs/encoding.d.ts
26
- interface ParamMetadata {
27
- readonly codec: CodecRef$1 | undefined;
28
- readonly name: string | undefined;
25
+ //#region ../../../2-sql/5-runtime/dist/activity-handle-ZJxB73iI.d.mts
26
+ //#region src/codecs/decoding.d.ts
27
+ type ColumnRef = {
28
+ table: string;
29
+ column: string;
30
+ };
31
+ type ListDecoder = (wireValue: unknown, decodeElement: (value: unknown) => Promise<unknown>) => Promise<readonly unknown[]> | readonly unknown[];
32
+ interface DecodeContext {
33
+ readonly aliases: ReadonlyArray<string> | undefined;
34
+ readonly codecs: ReadonlyMap<string, Codec$1>;
35
+ readonly columnRefs: ReadonlyMap<string, ColumnRef>;
36
+ readonly includeAliases: ReadonlySet<string>;
37
+ readonly manyAliases: ReadonlySet<string>;
38
+ /**
39
+ * Where {@link DecodeContext.aliases} came from, which decides how a row
40
+ * that lacks one of them reads: a projection the builder wrote is the
41
+ * runtime's own doing, while a row spec is the author's declaration about a
42
+ * statement the runtime never inspected.
43
+ */
44
+ readonly aliasSource: 'projection' | 'row-spec';
29
45
  }
30
- declare function deriveParamMetadata(ast: AnyQueryAst): readonly ParamMetadata[];
31
- declare function encodeParamsWithMetadata(values: readonly unknown[], metadata: readonly ParamMetadata[], ctx: SqlCodecCallContext, contractCodecs?: ContractCodecRegistry): Promise<readonly unknown[]>;
32
46
  //#endregion
33
47
  //#region src/middleware/sql-middleware.d.ts
34
48
  interface SqlMiddlewareContext extends ActivityContext {
@@ -44,9 +58,9 @@ interface DraftPlan {
44
58
  }
45
59
  interface SqlMiddleware<TCodecMap extends Record<string, unknown> = Record<string, unknown>> extends RuntimeMiddleware<SqlExecutionPlan, SqlParamRefMutator<TCodecMap>> {
46
60
  readonly familyId?: 'sql';
47
- activityStarted?(activity: RuntimeActivity, ctx: SqlMiddlewareContext): Promise<void>;
48
- activityEnded?(activity: RuntimeActivity, result: ActivityEndedResult, ctx: SqlMiddlewareContext): Promise<void>;
49
- activityFinalized?(activity: RuntimeActivity, result: ActivityFinalizedResult, ctx: SqlMiddlewareContext): Promise<void>;
61
+ activityStarted?(activity: Activity, ctx: SqlMiddlewareContext): Promise<void>;
62
+ activityEnded?(activity: Activity, result: ActivityEndedResult, ctx: SqlMiddlewareContext): Promise<void>;
63
+ activityFinalized?(activity: Activity, result: ActivityFinalizedResult, ctx: SqlMiddlewareContext): Promise<void>;
50
64
  /**
51
65
  * Rewrite the query AST before it is lowered to SQL. Middlewares run in
52
66
  * registration order; each sees the predecessor's output, so rewrites
@@ -75,101 +89,55 @@ interface SqlMiddleware<TCodecMap extends Record<string, unknown> = Record<strin
75
89
  intercept?: {
76
90
  onQuery?(plan: SqlExecutionPlan, ctx: SqlMiddlewareContext): Promise<QueryInterceptResult | undefined>;
77
91
  onExecute?(plan: SqlExecutionPlan, ctx: SqlMiddlewareContext): Promise<ExecuteInterceptResult | undefined>;
92
+ onActivity?(activity: ClientActivity, ctx: SqlMiddlewareContext): Promise<ActivityInterceptResult | undefined>;
78
93
  };
79
94
  onRow?(row: Record<string, unknown>, plan: SqlExecutionPlan, ctx: SqlMiddlewareContext): Promise<void>;
80
95
  }
81
96
  //#endregion
82
- //#region src/codecs/decoding.d.ts
83
- type ColumnRef = {
84
- table: string;
85
- column: string;
86
- };
87
- type ListDecoder = (wireValue: unknown, decodeElement: (value: unknown) => Promise<unknown>) => Promise<readonly unknown[]> | readonly unknown[];
88
- interface DecodeContext {
89
- readonly aliases: ReadonlyArray<string> | undefined;
90
- readonly codecs: ReadonlyMap<string, Codec$1>;
91
- readonly columnRefs: ReadonlyMap<string, ColumnRef>;
92
- readonly includeAliases: ReadonlySet<string>;
93
- readonly manyAliases: ReadonlySet<string>;
94
- /**
95
- * Where {@link DecodeContext.aliases} came from, which decides how a row
96
- * that lacks one of them reads: a projection the builder wrote is the
97
- * runtime's own doing, while a row spec is the author's declaration about a
98
- * statement the runtime never inspected.
99
- */
100
- readonly aliasSource: 'projection' | 'row-spec';
97
+ //#region src/codecs/encoding.d.ts
98
+ interface ParamMetadata {
99
+ readonly codec: CodecRef$1 | undefined;
100
+ readonly name: string | undefined;
101
101
  }
102
+ declare function deriveParamMetadata(ast: AnyQueryAst): readonly ParamMetadata[];
103
+ declare function encodeParamsWithMetadata(values: readonly unknown[], metadata: readonly ParamMetadata[], ctx: SqlCodecCallContext, contractCodecs?: ContractCodecRegistry): Promise<readonly unknown[]>;
102
104
  //#endregion
103
- //#region src/prepared/types.d.ts
104
- type ParamSpec<CT extends CodecTypesBase = CodecTypesBase> = (keyof CT & string) | {
105
- readonly codecId: keyof CT & string;
106
- readonly typeParams?: JsonValue;
107
- readonly nullable?: boolean;
108
- };
109
- type Declaration<CT extends CodecTypesBase = CodecTypesBase> = Readonly<Record<string, ParamSpec<CT>>>;
110
- type DeclaredCodecId<S> = S extends string ? S : S extends {
111
- readonly codecId: infer C extends string;
112
- } ? C : never;
113
- type DeclaredNullable<S> = S extends {
114
- readonly nullable: true;
115
- } ? true : false;
116
- type BindSiteParams<D> = { readonly [K in keyof D]: Expression<{
117
- codecId: DeclaredCodecId<D[K]>;
118
- nullable: DeclaredNullable<D[K]>;
119
- }>; };
120
- type ParamsFromDeclaration<D, CT extends CodecTypesBase> = { readonly [K in keyof D]: CodecValue<DeclaredCodecId<D[K]>, DeclaredNullable<D[K]>, CT>; };
121
- type PrepareCallback<D, Row> = (params: BindSiteParams<D>) => SqlQueryPlan<Row>;
122
- interface PreparedStatement<Params, Row> {
105
+ //#region src/prepared/prepared-statement.d.ts
106
+ interface PreparedStatementInternals {
123
107
  readonly sql: string;
124
108
  readonly ast: AnyQueryAst;
125
109
  readonly meta: PlanMeta;
126
110
  readonly slots: readonly LoweredParam[];
127
- readonly _params?: Params;
128
- readonly _row?: Row;
129
- query(target: RuntimeQueryable, params: Params, options?: RuntimeExecuteOptions): AsyncIterableResult<Row>;
111
+ readonly decodeContext: DecodeContext;
112
+ readonly paramMetadata: readonly ParamMetadata[];
130
113
  }
131
- /**
132
- * A prepared statement whose plan declares statement statistics rather than
133
- * rows. It carries the same lowered statement and bind slots as its
134
- * row-streaming sibling and differs in one way: it is consumed by executing
135
- * it, which resolves the statistics the statement reports.
136
- */
137
- interface PreparedExecution<Params> {
114
+ declare class PreparedStatementImpl<Params, Row> implements PreparedStatement<Params, Row>, PreparedStatementInternals {
138
115
  readonly sql: string;
139
116
  readonly ast: AnyQueryAst;
140
117
  readonly meta: PlanMeta;
141
118
  readonly slots: readonly LoweredParam[];
142
- readonly _params?: Params;
143
- execute(target: RuntimeQueryable, params: Params, options?: RuntimeExecuteOptions): Promise<SqlStatementStats>;
119
+ readonly decodeContext: DecodeContext;
120
+ readonly paramMetadata: readonly ParamMetadata[];
121
+ constructor(internals: PreparedStatementInternals);
122
+ query(target: RuntimeScope, params: Params, options?: RuntimeExecuteOptions): AsyncIterableResult<Row>;
144
123
  }
145
124
  /**
146
- * The prepared handle a plan earns, keyed on the result the plan declares:
147
- * statistics prepare into a {@link PreparedExecution}, rows into a
148
- * {@link PreparedStatement}. The two faces share no consumption method, so a
149
- * handle cannot be read the wrong way round.
150
- *
151
- * The key is `AffectedCount`'s brand rather than the statistics shape, so a
152
- * row spec free to declare a column named `affectedRows` cannot select the
153
- * execution face by coincidence. This is the same fact `prepare()` reads at
154
- * runtime from the AST's declared result — one decision, stated twice.
125
+ * The statistics-reporting sibling of {@link PreparedStatementImpl}. A plan
126
+ * declaring an affected-row count prepares into one of these, which carries
127
+ * the same lowered statement and bind slots and is consumed by executing it.
155
128
  *
156
- * `never` is answered first because it satisfies every `extends`: a builder
157
- * state that projects nothing types its rows as `never`, and such a plan
158
- * declares rows in its AST, so it earns the statement face the runtime builds
159
- * for it.
129
+ * The two classes are separate so the consumption a plan did not declare is
130
+ * absent from the value, not merely from its type.
160
131
  */
161
- type PreparedFor<Params, Row> = [Row] extends [never] ? PreparedStatement<Params, Row> : [Row] extends [AffectedCount] ? PreparedExecution<Params> : PreparedStatement<Params, Row>;
162
- //#endregion
163
- //#region src/prepared/prepared-execute.d.ts
164
- declare const preparedStatementExecute: unique symbol;
165
- interface PreparedStatementExecuteTarget extends RuntimeQueryable {
166
- [preparedStatementExecute]<Params>(statement: PreparedExecution<Params>, params: Params, options?: RuntimeExecuteOptions): Promise<SqlStatementStats>;
167
- }
168
- //#endregion
169
- //#region src/prepared/prepared-query.d.ts
170
- declare const preparedStatementQuery: unique symbol;
171
- interface PreparedStatementQueryTarget extends RuntimeQueryable {
172
- [preparedStatementQuery]<Params, Row>(statement: PreparedStatement<Params, Row>, params: Params, options?: RuntimeExecuteOptions): AsyncIterableResult<Row>;
132
+ declare class PreparedExecutionImpl<Params> implements PreparedExecution<Params>, PreparedStatementInternals {
133
+ readonly sql: string;
134
+ readonly ast: AnyQueryAst;
135
+ readonly meta: PlanMeta;
136
+ readonly slots: readonly LoweredParam[];
137
+ readonly decodeContext: DecodeContext;
138
+ readonly paramMetadata: readonly ParamMetadata[];
139
+ constructor(internals: PreparedStatementInternals);
140
+ execute(target: RuntimeScope, params: Params, options?: RuntimeExecuteOptions): Promise<SqlStatementStats>;
173
141
  }
174
142
  //#endregion
175
143
  //#region src/runtime-spi.d.ts
@@ -280,37 +248,8 @@ declare function createExecutionContext<TContract extends Contract<SqlStorage> =
280
248
  readonly driver?: RuntimeDriverDescriptor<'sql', TTargetId, unknown, SqlRuntimeDriverInstance<TTargetId>>;
281
249
  }): ExecutionContext<TContract>;
282
250
  //#endregion
283
- //#region src/transaction-state.d.ts
284
- /**
285
- * What the database did with a transaction the runtime wrapped. `withTransaction` and the ORM read it to tell a failed `COMMIT` or `ROLLBACK` from an `activityEnded` hook that threw after the database had already settled the transaction.
286
- */
287
- declare const transactionSettlement: unique symbol;
288
- interface TransactionSettlementState {
289
- /** The driver's `COMMIT` resolved. */
290
- readonly committed: boolean;
291
- /** The driver's `ROLLBACK` resolved. */
292
- readonly rolledBack: boolean;
293
- /** Passes an `activityEnded` error the caller does not receive to the transaction's log, so it is not lost. */
294
- logDroppedError(error: unknown): void;
295
- }
296
- interface SettledTransactionTarget {
297
- readonly [transactionSettlement]: TransactionSettlementState;
298
- }
299
- declare function settlementOf(transaction: object): TransactionSettlementState | undefined;
300
- /**
301
- * How the last transaction start on a connection the runtime made went. `withTransaction` releases the connection after a start the `activityStarted` hooks refused before any `BEGIN` was sent, and destroys it after any other start failure.
302
- */
303
- declare const transactionStart: unique symbol;
304
- interface TransactionStart {
305
- refusedBeforeBegin: boolean;
306
- }
307
- interface TransactionStartTarget {
308
- readonly [transactionStart]: TransactionStart;
309
- }
310
- declare function createTransactionStart(): TransactionStart;
311
- //#endregion
312
251
  //#region src/sql-runtime.d.ts
313
- type Log = RuntimeLog;
252
+ type Log$1 = RuntimeLog;
314
253
  /**
315
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.
316
255
  */
@@ -322,7 +261,7 @@ interface RuntimeOptions<TContract extends Contract<SqlStorage> = Contract<SqlSt
322
261
  readonly verifyMarker?: VerifyMarkerOption;
323
262
  readonly middleware?: readonly SqlMiddleware[];
324
263
  readonly mode?: 'strict' | 'permissive';
325
- readonly log?: Log;
264
+ readonly log?: Log$1;
326
265
  readonly closeRefusal?: CloseRefusal | undefined;
327
266
  }
328
267
  /**
@@ -366,6 +305,22 @@ interface RuntimeQueryable extends RuntimeScope {}
366
305
  interface TransactionContext extends RuntimeQueryable {
367
306
  readonly invalidated: boolean;
368
307
  }
308
+ /**
309
+ * The route a client activity's statements and transaction take to the database. A subclass whose statements run on its own sessions, such as role sessions, builds one and starts activities on it with `startActivityOnRoute`.
310
+ */
311
+ interface ActivityRoute {
312
+ readonly scope: 'runtime' | 'connection' | 'transaction';
313
+ /** The parent of an activity started on the route itself. */
314
+ parent(): ActivityParent | undefined;
315
+ query<Row>(plan: SqlOrmPlan<Row>, options: ActivityExecuteOptions): AsyncIterableResult<Row>;
316
+ execute(plan: SqlExecutionPlan<unknown> | SqlQueryPlan<unknown>, options: ActivityExecuteOptions): Promise<SqlStatementStats>;
317
+ preparedQuery<Params, Row>(statement: PreparedStatementImpl<Params, Row>, params: Params, options: ActivityExecuteOptions): AsyncIterableResult<Row>;
318
+ preparedExecute<Params>(statement: PreparedExecutionImpl<Params>, params: Params, options: ActivityExecuteOptions): Promise<SqlStatementStats>;
319
+ /** Begins a transaction beneath `parent`; absent where the route is a transaction. */
320
+ readonly transaction: ((parent: ActivityParent) => Promise<RuntimeTransaction>) | undefined;
321
+ /** Whether an open activity on the route is runtime work that `close()` waits for. */
322
+ readonly runtimeWork: boolean;
323
+ }
369
324
  /**
370
325
  * Abstract family-layer base for SQL runtimes. Subclass to build a target runtime
371
326
  * (e.g. `PostgresRuntimeImpl`); app code should consume the `Runtime` interface returned
@@ -434,6 +389,24 @@ declare abstract class SqlRuntimeBase<TContract extends Contract<SqlStorage> = C
434
389
  execute(plan: SqlExecutionPlan<unknown> | SqlQueryPlan<unknown>, options?: RuntimeExecuteOptions): Promise<SqlStatementStats>;
435
390
  [preparedStatementQuery]<Params, Row>(ps: PreparedStatement<Params, Row>, params: Params, options?: RuntimeExecuteOptions): AsyncIterableResult<Row>;
436
391
  [preparedStatementExecute]<Params>(ps: PreparedExecution<Params>, params: Params, options?: RuntimeExecuteOptions): Promise<SqlStatementStats>;
392
+ readonly [activitySource]: ActivitySource;
393
+ /**
394
+ * Starts a client activity whose statements and transaction run on `route`, beneath `parent` or, without one, beneath `route.parent()`.
395
+ */
396
+ protected startActivityOnRoute<K extends ClientActivityKind>(route: ActivityRoute, activity: StartActivity<K>, parent: ActivityParent | undefined): Promise<ActivityHandle<K>>;
397
+ /** The content hash of the statement `plan` would send on a queryable of `scope` beneath `parent`. */
398
+ protected planContentHashFor(plan: SqlQueryPlan | SqlExecutionPlan, scope: ActivityRoute['scope'], parent: ActivityParent | undefined): Promise<string>;
399
+ /** An activity route whose statements run on `queryable`. */
400
+ protected queryableRoute(queryable: SqlQueryable, scope: ActivityRoute['scope'], parent: () => ActivityParent | undefined, options: Pick<ActivityRoute, 'transaction' | 'runtimeWork'>): ActivityRoute;
401
+ /** The activity route of a held connection that `owner` wraps: its statements run on `connection`, and its transactions begin there. */
402
+ protected connectionRoute(connection: SqlConnection, owner: TransactionStartTarget): ActivityRoute;
403
+ private beginTransactionBeneathOn;
404
+ /** The `activitySource` member of a held connection that `owner()` wraps. */
405
+ protected connectionActivitySource(connection: SqlConnection, owner: () => TransactionStartTarget): ActivitySource;
406
+ private activityHandle;
407
+ private beginOwnedTransactionBeneath;
408
+ /** Begins a transaction with `begin` on a connection the transaction owns; see `beginOwnedTransaction`. */
409
+ protected ownTransaction(connection: Pick<RuntimeConnection, 'release' | 'destroy'>, begin: () => Promise<RuntimeTransaction>): Promise<RuntimeTransaction>;
437
410
  /**
438
411
  * Returns the raw driver connection. The connection is a `SqlQueryable` — SQL
439
412
  * issued on it runs below the middleware/codec/telemetry pipeline. It carries
@@ -442,6 +415,8 @@ declare abstract class SqlRuntimeBase<TContract extends Contract<SqlStorage> = C
442
415
  */
443
416
  protected acquireRawConnection(): Promise<SqlConnection>;
444
417
  private setupDriverExecution;
418
+ private beginActivityWork;
419
+ private warnWhenWaitingOnlyForActivities;
445
420
  private beginOperation;
446
421
  private parentOf;
447
422
  protected getListDecoder(): ListDecoder;
@@ -449,25 +424,26 @@ declare abstract class SqlRuntimeBase<TContract extends Contract<SqlStorage> = C
449
424
  private createQueryContexts;
450
425
  private prepareOperation;
451
426
  /** Query rows against a caller-supplied queryable through the shared preparation pipeline. */
452
- protected queryAgainstQueryable<Row>(plan: SqlExecutionPlan<unknown> | SqlQueryPlan<unknown>, queryable: SqlQueryable, options?: RuntimeExecuteOptions): AsyncIterableResult<Row>;
427
+ protected queryAgainstQueryable<Row>(plan: SqlExecutionPlan<unknown> | SqlQueryPlan<unknown>, queryable: SqlQueryable, options?: ActivityExecuteOptions): AsyncIterableResult<Row>;
453
428
  /** Execute statistics against a caller-supplied queryable through the shared preparation pipeline. */
454
- protected executeStatisticsAgainstQueryable(plan: SqlExecutionPlan<unknown> | SqlQueryPlan<unknown>, queryable: SqlQueryable, options?: RuntimeExecuteOptions): Promise<SqlStatementStats>;
429
+ protected executeStatisticsAgainstQueryable(plan: SqlExecutionPlan<unknown> | SqlQueryPlan<unknown>, queryable: SqlQueryable, options?: ActivityExecuteOptions): Promise<SqlStatementStats>;
455
430
  private executeStatisticsInFlight;
456
431
  private executeOn;
457
432
  private executeEncodedPlan;
458
433
  prepare<D extends Declaration<CT>, Row, CT extends CodecTypesBase = CodecTypesBase>(declaration: D, callback: PrepareCallback<D, Row>): Promise<PreparedFor<ParamsFromDeclaration<D, CT>, Row>>;
459
434
  /** Query prepared rows against a caller-supplied queryable through the full pipeline. */
460
- protected runPreparedQueryAgainstQueryable<P, Row>(ps: PreparedStatementImpl<P, Row>, userParams: unknown, queryable: SqlQueryable, options?: RuntimeExecuteOptions): AsyncIterableResult<Row>;
435
+ protected runPreparedQueryAgainstQueryable<P, Row>(ps: PreparedStatementImpl<P, Row>, userParams: unknown, queryable: SqlQueryable, options?: ActivityExecuteOptions): AsyncIterableResult<Row>;
461
436
  private streamPreparedRows;
462
437
  /** Execute a prepared statement's statistics against a caller-supplied queryable through the full pipeline. */
463
- protected runPreparedExecuteAgainstQueryable<P>(ps: PreparedExecutionImpl<P>, userParams: unknown, queryable: SqlQueryable, options?: RuntimeExecuteOptions): Promise<SqlStatementStats>;
438
+ protected runPreparedExecuteAgainstQueryable<P>(ps: PreparedExecutionImpl<P>, userParams: unknown, queryable: SqlQueryable, options?: ActivityExecuteOptions): Promise<SqlStatementStats>;
464
439
  private runPreparedExecuteInFlight;
465
440
  private executePrepared;
466
441
  connection(): Promise<RuntimeConnection>;
442
+ private openConnection;
467
443
  /**
468
444
  * 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.
469
445
  */
470
- protected beginTransactionOn(connection: SqlConnection, owner: TransactionStartTarget): Promise<RuntimeTransaction>;
446
+ protected beginTransactionOn(connection: SqlConnection, owner: TransactionStartTarget, parent: ActivityParent | undefined): Promise<RuntimeTransaction>;
471
447
  private wrapTransaction;
472
448
  telemetry(): RuntimeTelemetryEvent | null;
473
449
  close(): Promise<void>;
@@ -485,43 +461,114 @@ interface ConnectionProvider {
485
461
  }
486
462
  declare function withTransaction<R>(runtime: ConnectionProvider, fn: (tx: TransactionContext) => PromiseLike<R>): Promise<R>;
487
463
  //#endregion
488
- //#region src/prepared/prepared-statement.d.ts
489
- interface PreparedStatementInternals {
490
- readonly sql: string;
491
- readonly ast: AnyQueryAst;
492
- readonly meta: PlanMeta;
493
- readonly slots: readonly LoweredParam[];
494
- readonly decodeContext: DecodeContext;
495
- readonly paramMetadata: readonly ParamMetadata[];
464
+ //#region src/activity-handle.d.ts
465
+ /** What starts client activities and hashes plans. The runtime's queryables and activity handles carry one through `activitySource`. */
466
+ interface ActivitySource {
467
+ /**
468
+ * Starts an activity for an act the runtime would not otherwise see, such as an ORM call. Statements and activities started through the handle are its children. An open handle on the runtime keeps the runtime busy, so `close()` waits for its `end()`; a handle never ended keeps it busy, as a connection never released does.
469
+ */
470
+ startActivity<K extends ClientActivityKind>(activity: StartActivity<K>): Promise<ActivityHandle<K>>;
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: SqlQueryPlan | SqlExecutionPlan): Promise<string>;
496
473
  }
497
- declare class PreparedStatementImpl<Params, Row> implements PreparedStatement<Params, Row>, PreparedStatementInternals {
498
- readonly sql: string;
499
- readonly ast: AnyQueryAst;
500
- readonly meta: PlanMeta;
501
- readonly slots: readonly LoweredParam[];
502
- readonly decodeContext: DecodeContext;
503
- readonly paramMetadata: readonly ParamMetadata[];
504
- constructor(internals: PreparedStatementInternals);
505
- query(target: RuntimeQueryable, params: Params, options?: RuntimeExecuteOptions): AsyncIterableResult<Row>;
474
+ /** An open client activity, to send its statements through and to end. Its `startActivity` and `planContentHash` members are those of its `activitySource` member. */
475
+ interface ActivityHandle<K extends ClientActivityKind> extends RuntimeQueryable, ActivitySource, ActivitySourceTarget {
476
+ readonly activity: ClientActivity<K>;
477
+ /** Set when an `intercept.onActivity` handler supplied the result; the client then returns it without running anything. */
478
+ readonly intercepted: {
479
+ readonly result: ClientActivityResult<K>;
480
+ } | undefined;
481
+ /** Starts a transaction beneath the activity. Absent on a handle opened under a transaction, or on a connection whose transaction is open. */
482
+ readonly transaction?: () => Promise<RuntimeTransaction>;
483
+ /** Ends the activity. Rejects with `RUNTIME.ACTIVITY_CHILDREN_OPEN` when a statement or activity beneath it has not ended, after ending it `failed`. */
484
+ end(end: ClientActivityEnd<K>): Promise<void>;
506
485
  }
486
+ /** Options a queryable's statements carry: the activity they start beneath. */
487
+ interface ActivityExecuteOptions extends RuntimeExecuteOptions {
488
+ readonly activityParent?: ActivityParent | undefined;
489
+ }
490
+ /** The symbol-keyed member through which a runtime, connection, transaction, `withTransaction` context or activity handle starts activities; user-facing types do not show it. */
491
+ declare const activitySource: unique symbol;
492
+ interface ActivitySourceTarget {
493
+ readonly [activitySource]: ActivitySource;
494
+ }
495
+ /** The `activitySource` member of a queryable; `undefined` for a queryable that cannot start activities, such as a test stub. */
496
+ declare function findActivitySource(target: RuntimeScope): ActivitySource | undefined;
497
+ /** 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. */
498
+ declare function delegatingActivitySource(target: () => RuntimeScope): ActivitySource;
499
+ /** Starts an activity on a queryable through its `activitySource` member. */
500
+ declare function startActivityOn<K extends ClientActivityKind>(target: RuntimeScope, activity: StartActivity<K>): Promise<ActivityHandle<K>>;
501
+ declare function planContentHashOn(target: RuntimeScope, plan: SqlQueryPlan | SqlExecutionPlan): Promise<string>;
502
+ //#endregion
503
+ //#region ../../../2-sql/5-runtime/dist/index.d.mts
504
+ //#region src/codecs/ast-codec-registry.d.ts
507
505
  /**
508
- * The statistics-reporting sibling of {@link PreparedStatementImpl}. A plan
509
- * declaring an affected-row count prepares into one of these, which carries
510
- * the same lowered statement and bind slots and is consumed by executing it.
506
+ * Build a contract-free {@link ContractCodecRegistry} that resolves codecs
507
+ * purely from AST-supplied {@link import('@prisma/orm-framework/components/codec').CodecRef}s
508
+ * against a target's descriptor registry.
511
509
  *
512
- * The two classes are separate so the consumption a plan did not declare is
513
- * absent from the value, not merely from its type.
510
+ * Dispatch is driven entirely by `CodecRef`s embedded in AST nodes; no
511
+ * contract walk is needed. `forColumn` always returns `undefined` — this
512
+ * registry carries no column-to-codec mappings.
514
513
  */
515
- declare class PreparedExecutionImpl<Params> implements PreparedExecution<Params>, PreparedStatementInternals {
516
- readonly sql: string;
517
- readonly ast: AnyQueryAst;
518
- readonly meta: PlanMeta;
519
- readonly slots: readonly LoweredParam[];
520
- readonly decodeContext: DecodeContext;
521
- readonly paramMetadata: readonly ParamMetadata[];
522
- constructor(internals: PreparedStatementInternals);
523
- execute(target: RuntimeQueryable, params: Params, options?: RuntimeExecuteOptions): Promise<SqlStatementStats>;
514
+ declare function createAstCodecRegistry(descriptors: CodecDescriptorRegistry): ContractCodecRegistry;
515
+ //#endregion
516
+ //#region src/codecs/validation.d.ts
517
+ declare function extractCodecIds(contract: Contract<SqlStorage>): Set<string>;
518
+ declare function validateContractCodecMappings(registry: CodecDescriptorRegistry, contract: Contract<SqlStorage>): void;
519
+ declare function validateCodecRegistryCompleteness(registry: CodecDescriptorRegistry, contract: Contract<SqlStorage>): void;
520
+ //#endregion
521
+ //#region src/lower-sql-plan.d.ts
522
+ /**
523
+ * Lowers a SQL query plan to an executable Plan by calling the adapter's lower method.
524
+ *
525
+ * Ad-hoc lowerings produce only `{kind: 'literal'}` slots; this helper
526
+ * unwraps them into the bare-value array `SqlExecutionPlan` exposes.
527
+ * Encountering a `{kind: 'bind'}` slot here means the caller passed an
528
+ * AST containing `PreparedParamRef` to the ad-hoc execute path — that's a
529
+ * caller error, surfaced as `RUNTIME.PREPARE_BIND_ON_ADHOC`.
530
+ */
531
+ declare function lowerSqlPlan<Row>(adapter: Adapter<AnyQueryAst, Contract<SqlStorage>, LoweredStatement>, contract: Contract<SqlStorage>, queryPlan: SqlQueryPlan<Row>): SqlExecutionPlan<Row>;
532
+ //#endregion
533
+ //#region src/middleware/budgets.d.ts
534
+ interface BudgetsOptions {
535
+ readonly maxRows?: number;
536
+ readonly defaultTableRows?: number;
537
+ readonly tableRows?: Record<string, number>;
538
+ readonly maxLatencyMs?: number;
539
+ readonly severities?: {
540
+ readonly rowCount?: 'warn' | 'error';
541
+ readonly latency?: 'warn' | 'error';
542
+ };
543
+ }
544
+ declare function budgets(options?: BudgetsOptions): SqlMiddleware;
545
+ //#endregion
546
+ //#region src/middleware/lints.d.ts
547
+ interface LintsOptions {
548
+ readonly severities?: {
549
+ readonly selectStar?: 'warn' | 'error';
550
+ readonly noLimit?: 'warn' | 'error';
551
+ readonly deleteWithoutWhere?: 'warn' | 'error';
552
+ readonly updateWithoutWhere?: 'warn' | 'error';
553
+ readonly readOnlyMutation?: 'warn' | 'error';
554
+ };
555
+ readonly fallbackWhenAstMissing?: 'raw' | 'skip';
524
556
  }
557
+ /**
558
+ * AST-first lint middleware for SQL plans. When `plan.ast` is a SQL QueryAst, inspects
559
+ * the AST structurally. When `plan.ast` is missing, falls back to raw heuristic
560
+ * guardrails or skips linting depending on `fallbackWhenAstMissing`.
561
+ *
562
+ * Rules (AST-based):
563
+ * - DELETE without WHERE: blocks execution (configurable severity, default error)
564
+ * - UPDATE without WHERE: blocks execution (configurable severity, default error)
565
+ * - Unbounded SELECT: warn/error (severity from noLimit)
566
+ * - SELECT * intent: warn/error (severity from selectStar)
567
+ *
568
+ * Fallback: When ast is missing, `fallbackWhenAstMissing: 'raw'` uses heuristic
569
+ * SQL parsing; `'skip'` skips all lints. Default is `'raw'`.
570
+ */
571
+ declare function lints(options?: LintsOptions): SqlMiddleware;
525
572
  //#endregion
526
- export { settlementOf as $, SqlMiddleware as A, TelemetryOutcome as B, RuntimeParameterizedCodecDescriptor as C, SettledTransactionTarget as D, RuntimeTransaction as E, SqlRuntimeDriverInstance as F, VerifyMarkerOption as G, TransactionSettlementState as H, SqlRuntimeExtensionDescriptor as I, createTransactionStart as J, createExecutionContext as K, SqlRuntimeExtensionInstance as L, SqlRuntimeAdapterDescriptor as M, SqlRuntimeAdapterInstance as N, SqlExecutionStack as O, SqlRuntimeBase as P, preparedStatementQuery as Q, SqlRuntimeTargetDescriptor as R, RuntimeOptions as S, RuntimeTelemetryEvent as T, TransactionStart as U, TransactionContext as V, TransactionStartTarget as W, encodeParamsWithMetadata as X, deriveParamMetadata as Y, preparedStatementExecute as Z, PreparedStatementInternals as _, DeclaredCodecId as a, RuntimeConnection as b, ParamSpec as c, PreparedExecution as d, transactionSettlement as et, PreparedExecutionImpl as f, PreparedStatementImpl as g, PreparedStatementExecuteTarget as h, Declaration as i, SqlMiddlewareContext as j, SqlExecutionStackWithDriver as k, ParamsFromDeclaration as l, PreparedStatement as m, CloseRefusal as n, withTransaction as nt, DeclaredNullable as o, PreparedFor as p, createSqlExecutionStack as q, ConnectionProvider as r, MarkerReader as s, BindSiteParams as t, transactionStart as tt, PrepareCallback as u, PreparedStatementQueryTarget as v, RuntimeQueryable as w, RuntimeFamilyAdapter as x, Runtime as y, SqlStaticContributions as z };
527
- //# sourceMappingURL=prepared-statement-BwHkxfuI-CKkkrS6r.d.mts.map
573
+ export { SqlRuntimeBase as $, ActivityRoute as A, RuntimeConnection as B, extractCodecIds as C, validateContractCodecMappings as D, validateCodecRegistryCompleteness as E, MarkerReader as F, RuntimeTelemetryEvent as G, RuntimeOptions as H, PreparedExecutionImpl as I, SqlExecutionStackWithDriver as J, RuntimeTransaction as K, PreparedStatementImpl as L, ActivitySourceTarget as M, CloseRefusal as N, ActivityExecuteOptions as O, ConnectionProvider as P, SqlRuntimeAdapterInstance as Q, PreparedStatementInternals as R, createAstCodecRegistry as S, lowerSqlPlan as T, RuntimeParameterizedCodecDescriptor as U, RuntimeFamilyAdapter as V, RuntimeQueryable as W, SqlMiddlewareContext as X, SqlMiddleware as Y, SqlRuntimeAdapterDescriptor as Z, StatementActivity as _, withTransaction as _t, ActivityParent$1 as a, TelemetryOutcome as at, TransactionEnded as b, ClientActivityEnd$1 as c, activitySource as ct, ClientActivityResult$1 as d, delegatingActivitySource as dt, SqlRuntimeDriverInstance as et, ExecuteInterceptResult$1 as f, deriveParamMetadata as ft, StartActivity$1 as g, startActivityOn as gt, QueryInterceptResult$1 as h, planContentHashOn as ht, ActivityInterceptResult$1 as i, SqlStaticContributions as it, ActivitySource as j, ActivityHandle as k, ClientActivityEnded as l, createExecutionContext as lt, Log as m, findActivitySource as mt, ActivityEndedResult$1 as n, SqlRuntimeExtensionInstance as nt, BudgetsOptions as o, TransactionContext as ot, LintsOptions as p, encodeParamsWithMetadata as pt, SqlExecutionStack as q, ActivityFinalizedResult$1 as r, SqlRuntimeTargetDescriptor as rt, ClientActivity$1 as s, VerifyMarkerOption as st, Activity$1 as t, SqlRuntimeExtensionDescriptor as tt, ClientActivityKind$1 as u, createSqlExecutionStack as ut, StatementEnded as v, lints as w, budgets as x, TransactionActivity as y, Runtime as z };
574
+ //# sourceMappingURL=index-UHjF-U84.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index-UHjF-U84.d.mts","names":[],"sources":["../../../../2-sql/5-runtime/dist/activity-handle-ZJxB73iI.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,iBA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,kBAAkB,KAAK;;;UAGxB,+BAA+B;WAC9B,iBAAiB;;;cAGd;UACJ;YACE,iBAAiB;;;iBAGZ,mBAAmB,QAAQ,eAAe;;iBAE1C,yBAAyB,cAAc,eAAe;;iBAEtD,gBAAgB,UAAU,oBAAoB,QAAQ,cAAc,UAAU,cAAc,KAAK,QAAQ,eAAe;iBACxH,kBAAkB,QAAQ,cAAc,MAAM,eAAe,mBAAmB;;;;;;;;;;;;;iBCnehF,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"}
@@ -16,9 +16,9 @@ import { n as ExecutionContext } from "./query-lane-context-C42-u9L1-Bxa4DkI_.mj
16
16
  import "./query-lane-context-DW5q2RAY.mjs";
17
17
  import { h as RuntimeScope, o as ComputeColumnJsType } from "./types-Cl4MLNrS-lbf-K25i.mjs";
18
18
  import "./types-BkA6tyT-.mjs";
19
+ import { l as PreparedFor, n as Declaration, o as ParamsFromDeclaration, t as BindSiteParams, u as PreparedStatement } from "./transaction-state-DR3nKTmH-BZ-54Zu0.mjs";
19
20
  import "./collection-methods-DoBrRR69.mjs";
20
- import { i as Declaration, l as ParamsFromDeclaration, m as PreparedStatement, p as PreparedFor, t as BindSiteParams, w as RuntimeQueryable$1, y as Runtime } from "./prepared-statement-BwHkxfuI-CKkkrS6r.mjs";
21
- import "./index-CmKqLvvO.mjs";
21
+ import { M as ActivitySourceTarget, W as RuntimeQueryable$1, z as Runtime } from "./index-UHjF-U84.mjs";
22
22
  import { CodecDescriptorRef, ScalarFieldDeclarationBuilder } from "@prisma/orm-framework/components/codec";
23
23
  import { Contract } from "@prisma/orm-framework/contract/types";
24
24
  import { AnnotationValue, AsyncIterableResult, MetaBuilder, OperationKind, ResultType, RuntimeExecuteOptions } from "@prisma/orm-framework/components/runtime";
@@ -229,7 +229,8 @@ interface RuntimeTransaction extends RuntimeScope {
229
229
  commit?(): Promise<void>;
230
230
  rollback?(): Promise<void>;
231
231
  }
232
- interface RuntimeQueryable extends RuntimeScope {
232
+ /** What the ORM sends its statements to. It may carry an `activitySource` member, as the SQL runtime's queryables do, through which `startActivityOn` reaches activities; a queryable without one, such as a test stub, has none. */
233
+ interface RuntimeQueryable extends RuntimeScope, Partial<ActivitySourceTarget> {
233
234
  connection?(): Promise<RuntimeConnection>;
234
235
  transaction?(): Promise<RuntimeTransaction>;
235
236
  }