@prisma-next/sql-runtime 0.5.0-dev.8 → 0.5.0-dev.81

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.
@@ -1,17 +1,20 @@
1
- import { AfterExecuteResult, RuntimeMiddleware, RuntimeMiddlewareContext } from "@prisma-next/framework-components/runtime";
2
- import { Adapter, AnyQueryAst, CodecParamsDescriptor, CodecRegistry, LoweredStatement, SqlDriver } from "@prisma-next/sql-relational-core/ast";
3
- import { AfterExecuteResult as AfterExecuteResult$1, AsyncIterableResult, Log, Log as Log$1, MarkerStatement, Middleware, MiddlewareContext, RuntimeTelemetryEvent, RuntimeVerifyOptions, TelemetryOutcome } from "@prisma-next/runtime-executor";
1
+ import { AfterExecuteResult, AfterExecuteResult as AfterExecuteResult$1, ExecutionPlan, RuntimeLog, RuntimeLog as Log, RuntimeMiddleware, RuntimeMiddlewareContext } from "@prisma-next/framework-components/runtime";
2
+ import { Adapter, AnyQueryAst, LoweredStatement, MarkerStatement, MarkerStatement as MarkerStatement$1, SqlDriver } from "@prisma-next/sql-relational-core/ast";
4
3
  import { ExecutionStack, ExecutionStackInstance, RuntimeAdapterDescriptor, RuntimeAdapterInstance, RuntimeDriverDescriptor, RuntimeDriverInstance, RuntimeExtensionDescriptor, RuntimeExtensionInstance, RuntimeTargetDescriptor, RuntimeTargetInstance } from "@prisma-next/framework-components/execution";
5
4
  import { SqlOperationDescriptor } from "@prisma-next/sql-operations";
6
- import { Contract, ExecutionPlan, PlanMeta } from "@prisma-next/contract/types";
5
+ import { APP_SPACE_ID } from "@prisma-next/framework-components/control";
6
+ import { SqlParamRefMutator } from "@prisma-next/sql-relational-core/middleware";
7
+ import { Contract, ContractMarkerRecord, PlanMeta } from "@prisma-next/contract/types";
8
+ import { AnyCodecDescriptor, CodecDescriptor } from "@prisma-next/framework-components/codec";
7
9
  import { SqlStorage } from "@prisma-next/sql-contract/types";
8
- import { SqlQueryPlan } from "@prisma-next/sql-relational-core/plan";
9
- import { ExecutionContext, TypeHelperRegistry } from "@prisma-next/sql-relational-core/query-lane-context";
10
+ import { CodecDescriptorRegistry, ExecutionContext, TypeHelperRegistry } from "@prisma-next/sql-relational-core/query-lane-context";
11
+ import { SqlExecutionPlan, SqlQueryPlan } from "@prisma-next/sql-relational-core/plan";
12
+ import { RuntimeScope } from "@prisma-next/sql-relational-core/types";
10
13
 
11
14
  //#region src/codecs/validation.d.ts
12
15
  declare function extractCodecIds(contract: Contract<SqlStorage>): Set<string>;
13
- declare function validateContractCodecMappings(registry: CodecRegistry, contract: Contract<SqlStorage>): void;
14
- declare function validateCodecRegistryCompleteness(registry: CodecRegistry, contract: Contract<SqlStorage>): void;
16
+ declare function validateContractCodecMappings(registry: CodecDescriptorRegistry, contract: Contract<SqlStorage>): void;
17
+ declare function validateCodecRegistryCompleteness(registry: CodecDescriptorRegistry, contract: Contract<SqlStorage>): void;
15
18
  //#endregion
16
19
  //#region src/lower-sql-plan.d.ts
17
20
  /**
@@ -22,7 +25,10 @@ declare function validateCodecRegistryCompleteness(registry: CodecRegistry, cont
22
25
  * @param queryPlan - SQL query plan from a lane (contains AST, params, meta, but no SQL)
23
26
  * @returns Fully executable Plan with SQL string
24
27
  */
25
- declare function lowerSqlPlan<Row>(adapter: Adapter<AnyQueryAst, Contract<SqlStorage>, LoweredStatement>, contract: Contract<SqlStorage>, queryPlan: SqlQueryPlan<Row>): ExecutionPlan<Row>;
28
+ declare function lowerSqlPlan<Row>(adapter: Adapter<AnyQueryAst, Contract<SqlStorage>, LoweredStatement>, contract: Contract<SqlStorage>, queryPlan: SqlQueryPlan<Row>): SqlExecutionPlan<Row>;
29
+ //#endregion
30
+ //#region src/marker.d.ts
31
+ declare function parseContractMarkerRow(row: unknown): ContractMarkerRecord;
26
32
  //#endregion
27
33
  //#region src/middleware/sql-middleware.d.ts
28
34
  interface SqlMiddlewareContext extends RuntimeMiddlewareContext {
@@ -36,7 +42,7 @@ interface DraftPlan {
36
42
  readonly ast: AnyQueryAst;
37
43
  readonly meta: PlanMeta;
38
44
  }
39
- interface SqlMiddleware extends RuntimeMiddleware {
45
+ interface SqlMiddleware<TCodecMap extends Record<string, unknown> = Record<string, unknown>> extends RuntimeMiddleware<SqlExecutionPlan, SqlParamRefMutator<TCodecMap>> {
40
46
  readonly familyId?: 'sql';
41
47
  /**
42
48
  * Rewrite the query AST before it is lowered to SQL. Middlewares run in
@@ -57,9 +63,22 @@ interface SqlMiddleware extends RuntimeMiddleware {
57
63
  * See `docs/architecture docs/subsystems/4. Runtime & Middleware Framework.md`.
58
64
  */
59
65
  beforeCompile?(draft: DraftPlan, ctx: SqlMiddlewareContext): Promise<DraftPlan | undefined>;
60
- beforeExecute?(plan: ExecutionPlan, ctx: SqlMiddlewareContext): Promise<void>;
61
- onRow?(row: Record<string, unknown>, plan: ExecutionPlan, ctx: SqlMiddlewareContext): Promise<void>;
62
- afterExecute?(plan: ExecutionPlan, result: AfterExecuteResult, ctx: SqlMiddlewareContext): Promise<void>;
66
+ /**
67
+ * Mutate `ParamRef.value` slots before encode runs. The third `params`
68
+ * argument is a {@link SqlParamRefMutator} scoped to value slots only —
69
+ * SQL strings, projections, and `ParamRef` membership are not mutable.
70
+ * Existing `(plan)` and `(plan, ctx)` middleware bodies that ignore the
71
+ * additional argument continue to compile and run unchanged.
72
+ *
73
+ * `ctx.signal` carries the per-query `AbortSignal` (ADR 207); middleware
74
+ * that wraps a network SDK forwards `ctx.signal` to that SDK.
75
+ * Cooperative cancellation: a body that ignores the signal still
76
+ * surfaces `RUNTIME.ABORTED { phase: 'beforeExecute' }` promptly via
77
+ * the runtime's race against the signal.
78
+ */
79
+ beforeExecute?(plan: SqlExecutionPlan, ctx: SqlMiddlewareContext, params?: SqlParamRefMutator<TCodecMap>): void | Promise<void>;
80
+ onRow?(row: Record<string, unknown>, plan: SqlExecutionPlan, ctx: SqlMiddlewareContext): Promise<void>;
81
+ afterExecute?(plan: SqlExecutionPlan, result: AfterExecuteResult, ctx: SqlMiddlewareContext): Promise<void>;
63
82
  }
64
83
  //#endregion
65
84
  //#region src/middleware/budgets.d.ts
@@ -103,25 +122,76 @@ interface LintsOptions {
103
122
  */
104
123
  declare function lints(options?: LintsOptions): SqlMiddleware;
105
124
  //#endregion
125
+ //#region src/runtime-spi.d.ts
126
+ /**
127
+ * Reader of the SQL contract marker. SQL runtimes verify the database's
128
+ * `prisma_contract.marker` row against the runtime's contract by issuing
129
+ * this statement before executing user queries (when `verify` is enabled).
130
+ * Each adapter is responsible for any target-specific row decoding before
131
+ * delegating to the shared row schema.
132
+ */
133
+ interface MarkerReader {
134
+ readMarkerStatement(): MarkerStatement;
135
+ parseMarkerRow(row: unknown): ContractMarkerRecord;
136
+ }
137
+ /**
138
+ * SQL family adapter SPI consumed by `SqlRuntime`. Encapsulates the
139
+ * runtime contract, marker reader, and plan validation logic so the
140
+ * runtime can be unit-tested without a concrete SQL adapter profile.
141
+ *
142
+ * Implemented by `SqlFamilyAdapter` for production and by mock classes
143
+ * in tests.
144
+ */
145
+ interface RuntimeFamilyAdapter<TContract = unknown> {
146
+ readonly contract: TContract;
147
+ readonly markerReader: MarkerReader;
148
+ validatePlan(plan: ExecutionPlan, contract: TContract): void;
149
+ }
150
+ interface RuntimeVerifyOptions {
151
+ readonly mode: 'onFirstUse' | 'startup' | 'always';
152
+ readonly requireMarker: boolean;
153
+ }
154
+ type TelemetryOutcome = 'success' | 'runtime-error';
155
+ interface RuntimeTelemetryEvent {
156
+ readonly lane: string;
157
+ readonly target: string;
158
+ readonly fingerprint: string;
159
+ readonly outcome: TelemetryOutcome;
160
+ readonly durationMs?: number;
161
+ }
162
+ //#endregion
106
163
  //#region src/sql-context.d.ts
107
164
  /**
108
165
  * Runtime parameterized codec descriptor.
109
- * Provides validation schema and optional init hook for codecs that support type parameters.
110
- * Used at runtime to validate typeParams and create type helpers.
111
166
  *
112
- * This is a type alias for `CodecParamsDescriptor` from the AST layer,
113
- * which is the shared definition used by both adapter and runtime.
167
+ * 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.
168
+ *
169
+ * Codec-registry-unification spec § Decision.
170
+ */
171
+ type RuntimeParameterizedCodecDescriptor<P = Record<string, unknown>> = CodecDescriptor<P>;
172
+ /**
173
+ * 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.
114
174
  */
115
- type RuntimeParameterizedCodecDescriptor<TParams = Record<string, unknown>, THelper = unknown> = CodecParamsDescriptor<TParams, THelper>;
116
175
  interface SqlStaticContributions {
117
- readonly codecs: () => CodecRegistry;
118
- readonly parameterizedCodecs: () => ReadonlyArray<RuntimeParameterizedCodecDescriptor<any, any>>;
176
+ readonly codecs: () => ReadonlyArray<AnyCodecDescriptor>;
119
177
  readonly queryOperations?: () => ReadonlyArray<SqlOperationDescriptor>;
120
178
  readonly mutationDefaultGenerators?: () => ReadonlyArray<RuntimeMutationDefaultGenerator>;
121
179
  }
180
+ /**
181
+ * Scope across which a generator's value is constant.
182
+ *
183
+ * - `'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).
184
+ * - `'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.
185
+ * - `'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).
186
+ */
187
+ type GeneratorStability = 'field' | 'row' | 'query';
122
188
  interface RuntimeMutationDefaultGenerator {
123
189
  readonly id: string;
124
190
  readonly generate: (params?: Record<string, unknown>) => unknown;
191
+ /**
192
+ * 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.
193
+ */
194
+ readonly stability: GeneratorStability;
125
195
  }
126
196
  interface SqlRuntimeTargetDescriptor<TTargetId extends string = string, TTargetInstance extends RuntimeTargetInstance<'sql', TTargetId> = RuntimeTargetInstance<'sql', TTargetId>> extends RuntimeTargetDescriptor<'sql', TTargetId, TTargetInstance>, SqlStaticContributions {}
127
197
  interface SqlRuntimeAdapterDescriptor<TTargetId extends string = string, TAdapterInstance extends RuntimeAdapterInstance<'sql', TTargetId> = SqlRuntimeAdapterInstance<TTargetId>> extends RuntimeAdapterDescriptor<'sql', TTargetId, TAdapterInstance>, SqlStaticContributions {}
@@ -142,10 +212,7 @@ type SqlExecutionStackWithDriver<TTargetId extends string = string> = Omit<Execu
142
212
  interface SqlRuntimeExtensionInstance<TTargetId extends string> extends RuntimeExtensionInstance<'sql', TTargetId> {}
143
213
  type SqlRuntimeAdapterInstance<TTargetId extends string = string> = RuntimeAdapterInstance<'sql', TTargetId> & Adapter<AnyQueryAst, Contract<SqlStorage>, LoweredStatement>;
144
214
  /**
145
- * NOTE: Binding type is intentionally erased to unknown at this shared runtime layer.
146
- * Target clients (for example `postgres()`) validate and construct the concrete binding
147
- * before calling `driver.connect(binding)`, which keeps runtime behavior safe today.
148
- * A future follow-up can preserve TBinding through stack/context generics end-to-end.
215
+ * 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.
149
216
  */
150
217
  type SqlRuntimeDriverInstance<TTargetId extends string = string> = RuntimeDriverInstance<'sql', TTargetId> & SqlDriver<unknown>;
151
218
  declare function createSqlExecutionStack<TTargetId extends string>(options: {
@@ -165,16 +232,45 @@ interface SqlStatement {
165
232
  readonly params: readonly unknown[];
166
233
  }
167
234
  interface WriteMarkerInput {
235
+ /**
236
+ * Logical space identifier for this marker row. Required at every
237
+ * call site so the type system surfaces every place that needs to
238
+ * thread the value (rather than letting an `?? APP_SPACE_ID`
239
+ * fall-through silently collapse multi-space markers onto the
240
+ * `'app'` row). App-plan callers pass {@link APP_SPACE_ID}
241
+ * (`'app'`); per-extension callers pass the extension's space id.
242
+ */
243
+ readonly space: string;
168
244
  readonly storageHash: string;
169
245
  readonly profileHash: string;
170
246
  readonly contractJson?: unknown;
171
247
  readonly canonicalVersion?: number;
172
248
  readonly appTag?: string;
173
249
  readonly meta?: Record<string, unknown>;
250
+ /**
251
+ * Applied-invariants set on the marker.
252
+ *
253
+ * - `undefined` → existing column left untouched. Sign and
254
+ * verify-database paths use this; they don't accumulate invariants.
255
+ * - explicit value (including `[]`) → column overwritten with
256
+ * exactly that value.
257
+ */
258
+ readonly invariants?: readonly string[];
174
259
  }
175
260
  declare const ensureSchemaStatement: SqlStatement;
261
+ /**
262
+ * Schema for `prisma_contract.marker`. The `space text` primary key
263
+ * supports one row per loaded contract space (`'app'`,
264
+ * `'<extension-id>'`, …); brand-new databases create this shape
265
+ * directly. Pre-1.0 single-row markers (no `space` column) are not
266
+ * auto-migrated — the target-specific migration runner detects the
267
+ * legacy shape at boot and surfaces a structured `LEGACY_MARKER_SHAPE`
268
+ * failure pointing the operator at re-running `dbInit`.
269
+ *
270
+ * @see specs/framework-mechanism.spec.md § 2.
271
+ */
176
272
  declare const ensureTableStatement: SqlStatement;
177
- declare function readContractMarker(): MarkerStatement;
273
+ declare function readContractMarker(space: string): MarkerStatement;
178
274
  interface WriteContractMarkerStatements {
179
275
  readonly insert: SqlStatement;
180
276
  readonly update: SqlStatement;
@@ -182,6 +278,7 @@ interface WriteContractMarkerStatements {
182
278
  declare function writeContractMarker(input: WriteMarkerInput): WriteContractMarkerStatements;
183
279
  //#endregion
184
280
  //#region src/sql-runtime.d.ts
281
+ type Log$1 = RuntimeLog;
185
282
  interface CreateRuntimeOptions<TContract extends Contract<SqlStorage> = Contract<SqlStorage>, TTargetId extends string = string> {
186
283
  readonly stackInstance: ExecutionStackInstance<'sql', TTargetId, SqlRuntimeAdapterInstance<TTargetId>, RuntimeDriverInstance<'sql', TTargetId>, SqlRuntimeExtensionInstance<TTargetId>>;
187
284
  readonly context: ExecutionContext<TContract>;
@@ -189,7 +286,7 @@ interface CreateRuntimeOptions<TContract extends Contract<SqlStorage> = Contract
189
286
  readonly verify: RuntimeVerifyOptions;
190
287
  readonly middleware?: readonly SqlMiddleware[];
191
288
  readonly mode?: 'strict' | 'permissive';
192
- readonly log?: Log;
289
+ readonly log?: Log$1;
193
290
  }
194
291
  interface Runtime extends RuntimeQueryable {
195
292
  connection(): Promise<RuntimeConnection>;
@@ -199,25 +296,15 @@ interface Runtime extends RuntimeQueryable {
199
296
  interface RuntimeConnection extends RuntimeQueryable {
200
297
  transaction(): Promise<RuntimeTransaction>;
201
298
  /**
202
- * Returns the connection to the pool for reuse. Only call this when the
203
- * connection is known to be in a clean state. If a transaction
204
- * commit/rollback failed or the connection is otherwise suspect, call
205
- * `destroy(reason)` instead.
299
+ * 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.
206
300
  */
207
301
  release(): Promise<void>;
208
302
  /**
209
- * Evicts the connection so it is never reused. Call this when the
210
- * connection may be in an indeterminate state (e.g. a failed rollback
211
- * leaving an open transaction, or a broken socket).
303
+ * 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).
212
304
  *
213
- * If teardown fails the error is propagated and the connection remains
214
- * retryable, so the caller can decide whether to swallow the failure or
215
- * retry cleanup. Calling destroy() or release() more than once after a
216
- * successful teardown is caller error.
305
+ * 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.
217
306
  *
218
- * `reason` is advisory context only. It may be surfaced to driver-level
219
- * observability hooks (e.g. pg-pool's `'release'` event) but does not
220
- * influence eviction behavior and is not rethrown.
307
+ * `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.
221
308
  */
222
309
  destroy(reason?: unknown): Promise<void>;
223
310
  }
@@ -225,14 +312,12 @@ interface RuntimeTransaction extends RuntimeQueryable {
225
312
  commit(): Promise<void>;
226
313
  rollback(): Promise<void>;
227
314
  }
228
- interface RuntimeQueryable {
229
- execute<Row = Record<string, unknown>>(plan: ExecutionPlan<Row> | SqlQueryPlan<Row>): AsyncIterableResult<Row>;
230
- }
315
+ interface RuntimeQueryable extends RuntimeScope {}
231
316
  interface TransactionContext extends RuntimeQueryable {
232
317
  readonly invalidated: boolean;
233
318
  }
234
319
  declare function withTransaction<R>(runtime: Runtime, fn: (tx: TransactionContext) => PromiseLike<R>): Promise<R>;
235
320
  declare function createRuntime<TContract extends Contract<SqlStorage>, TTargetId extends string>(options: CreateRuntimeOptions<TContract, TTargetId>): Runtime;
236
321
  //#endregion
237
- export { SqlRuntimeExtensionInstance as A, SqlMiddleware as B, RuntimeParameterizedCodecDescriptor as C, SqlRuntimeAdapterInstance as D, SqlRuntimeAdapterDescriptor as E, createSqlExecutionStack as F, validateContractCodecMappings as G, lowerSqlPlan as H, LintsOptions as I, lints as L, SqlStaticContributions as M, TypeHelperRegistry as N, SqlRuntimeDriverInstance as O, createExecutionContext as P, BudgetsOptions as R, RuntimeMutationDefaultGenerator as S, SqlExecutionStackWithDriver as T, extractCodecIds as U, SqlMiddlewareContext as V, validateCodecRegistryCompleteness as W, ensureSchemaStatement as _, CreateRuntimeOptions as a, writeContractMarker as b, RuntimeQueryable as c, RuntimeVerifyOptions as d, TelemetryOutcome as f, SqlStatement as g, withTransaction as h, MiddlewareContext as i, SqlRuntimeTargetDescriptor as j, SqlRuntimeExtensionDescriptor as k, RuntimeTelemetryEvent as l, createRuntime as m, Log$1 as n, Runtime as o, TransactionContext as p, Middleware as r, RuntimeConnection as s, AfterExecuteResult$1 as t, RuntimeTransaction as u, ensureTableStatement as v, SqlExecutionStack as w, ExecutionContext as x, readContractMarker as y, budgets as z };
238
- //# sourceMappingURL=index-yb51L_1h.d.mts.map
322
+ export { SqlStaticContributions as A, lints as B, SqlExecutionStackWithDriver as C, SqlRuntimeExtensionDescriptor as D, SqlRuntimeDriverInstance as E, RuntimeFamilyAdapter as F, parseContractMarkerRow as G, budgets as H, RuntimeTelemetryEvent as I, validateCodecRegistryCompleteness as J, lowerSqlPlan as K, RuntimeVerifyOptions as L, createExecutionContext as M, createSqlExecutionStack as N, SqlRuntimeExtensionInstance as O, MarkerReader as P, TelemetryOutcome as R, SqlExecutionStack as S, SqlRuntimeAdapterInstance as T, SqlMiddleware as U, BudgetsOptions as V, SqlMiddlewareContext as W, validateContractCodecMappings as Y, writeContractMarker as _, Runtime as a, RuntimeMutationDefaultGenerator as b, RuntimeTransaction as c, withTransaction as d, APP_SPACE_ID as f, readContractMarker as g, ensureTableStatement as h, CreateRuntimeOptions as i, TypeHelperRegistry as j, SqlRuntimeTargetDescriptor as k, TransactionContext as l, ensureSchemaStatement as m, Log as n, RuntimeConnection as o, SqlStatement as p, extractCodecIds as q, MarkerStatement$1 as r, RuntimeQueryable as s, AfterExecuteResult$1 as t, createRuntime as u, ExecutionContext as v, SqlRuntimeAdapterDescriptor as w, RuntimeParameterizedCodecDescriptor as x, GeneratorStability as y, LintsOptions as z };
323
+ //# sourceMappingURL=index-CFbuVnYJ.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index-CFbuVnYJ.d.mts","names":[],"sources":["../src/codecs/validation.ts","../src/lower-sql-plan.ts","../src/marker.ts","../src/middleware/sql-middleware.ts","../src/middleware/budgets.ts","../src/middleware/lints.ts","../src/runtime-spi.ts","../src/sql-context.ts","../src/sql-marker.ts","../src/sql-runtime.ts"],"mappings":";;;;;;;;;;;;;;iBAKgB,eAAA,CAAgB,QAAA,EAAU,QAAA,CAAS,UAAA,IAAc,GA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AA,SACR,MAAA,EAAQ,oBAAA;EAAA,SACR,UAAA,YAAsB,aAAA;EAAA,SACtB,IAAA;EAAA,SACA,GAAA,GAAM,KAAA;AAAA;AAAA,UAGA,OAAA,SAAgB,gBAAA;EAC/B,UAAA,IAAc,OAAA,CAAQ,iBAAA;EACtB,SAAA,IAAa,qBAAA;EACb,KAAA,IAAS,OAAA;AAAA;AAAA,UAGM,iBAAA,SAA0B,gBAAA;EACzC,WAAA,IAAe,OAAA,CAAQ,kBAAA;ET7DL;;;ESiElB,OAAA,IAAW,OAAA;ETjEQ;;;;AA4BrB;;;ES6CE,OAAA,CAAQ,MAAA,aAAmB,OAAA;AAAA;AAAA,UAGZ,kBAAA,SAA2B,gBAAA;EAC1C,MAAA,IAAU,OAAA;EACV,QAAA,IAAY,OAAA;AAAA;AAAA,UAGG,gBAAA,SAAyB,YAAA;AAAA,UAEzB,kBAAA,SAA2B,gBAAA;EAAA,SACjC,WAAA;AAAA;AAAA,iBAkWW,eAAA,GAAA,CACpB,OAAA,EAAS,OAAA,EACT,EAAA,GAAK,EAAA,EAAI,kBAAA,KAAuB,WAAA,CAAY,CAAA,IAC3C,OAAA,CAAQ,CAAA;AAAA,iBAsFK,aAAA,mBAAgC,QAAA,CAAS,UAAA,4BAAA,CACvD,OAAA,EAAS,oBAAA,CAAqB,SAAA,EAAW,SAAA,IACxC,OAAA"}
package/dist/index.d.mts CHANGED
@@ -1,2 +1,2 @@
1
- import { A as SqlRuntimeExtensionInstance, B as SqlMiddleware, C as RuntimeParameterizedCodecDescriptor, D as SqlRuntimeAdapterInstance, E as SqlRuntimeAdapterDescriptor, F as createSqlExecutionStack, G as validateContractCodecMappings, H as lowerSqlPlan, I as LintsOptions, L as lints, M as SqlStaticContributions, N as TypeHelperRegistry, O as SqlRuntimeDriverInstance, P as createExecutionContext, R as BudgetsOptions, S as RuntimeMutationDefaultGenerator, T as SqlExecutionStackWithDriver, U as extractCodecIds, V as SqlMiddlewareContext, W as validateCodecRegistryCompleteness, _ as ensureSchemaStatement, a as CreateRuntimeOptions, b as writeContractMarker, c as RuntimeQueryable, d as RuntimeVerifyOptions, f as TelemetryOutcome, g as SqlStatement, h as withTransaction, i as MiddlewareContext, j as SqlRuntimeTargetDescriptor, k as SqlRuntimeExtensionDescriptor, l as RuntimeTelemetryEvent, m as createRuntime, n as Log, o as Runtime, p as TransactionContext, r as Middleware, s as RuntimeConnection, t as AfterExecuteResult, u as RuntimeTransaction, v as ensureTableStatement, w as SqlExecutionStack, x as ExecutionContext, y as readContractMarker, z as budgets } from "./index-yb51L_1h.mjs";
2
- export { AfterExecuteResult, BudgetsOptions, CreateRuntimeOptions, ExecutionContext, LintsOptions, Log, Middleware, MiddlewareContext, Runtime, RuntimeConnection, RuntimeMutationDefaultGenerator, RuntimeParameterizedCodecDescriptor, RuntimeQueryable, RuntimeTelemetryEvent, RuntimeTransaction, RuntimeVerifyOptions, SqlExecutionStack, SqlExecutionStackWithDriver, SqlMiddleware, SqlMiddlewareContext, SqlRuntimeAdapterDescriptor, SqlRuntimeAdapterInstance, SqlRuntimeDriverInstance, SqlRuntimeExtensionDescriptor, SqlRuntimeExtensionInstance, SqlRuntimeTargetDescriptor, SqlStatement, SqlStaticContributions, TelemetryOutcome, TransactionContext, TypeHelperRegistry, budgets, createExecutionContext, createRuntime, createSqlExecutionStack, ensureSchemaStatement, ensureTableStatement, extractCodecIds, lints, lowerSqlPlan, readContractMarker, validateCodecRegistryCompleteness, validateContractCodecMappings, withTransaction, writeContractMarker };
1
+ import { A as SqlStaticContributions, B as lints, C as SqlExecutionStackWithDriver, D as SqlRuntimeExtensionDescriptor, E as SqlRuntimeDriverInstance, F as RuntimeFamilyAdapter, G as parseContractMarkerRow, H as budgets, I as RuntimeTelemetryEvent, J as validateCodecRegistryCompleteness, K as lowerSqlPlan, L as RuntimeVerifyOptions, M as createExecutionContext, N as createSqlExecutionStack, O as SqlRuntimeExtensionInstance, P as MarkerReader, R as TelemetryOutcome, S as SqlExecutionStack, T as SqlRuntimeAdapterInstance, U as SqlMiddleware, V as BudgetsOptions, W as SqlMiddlewareContext, Y as validateContractCodecMappings, _ as writeContractMarker, a as Runtime, b as RuntimeMutationDefaultGenerator, c as RuntimeTransaction, d as withTransaction, f as APP_SPACE_ID, g as readContractMarker, h as ensureTableStatement, i as CreateRuntimeOptions, j as TypeHelperRegistry, k as SqlRuntimeTargetDescriptor, l as TransactionContext, m as ensureSchemaStatement, n as Log, o as RuntimeConnection, p as SqlStatement, q as extractCodecIds, r as MarkerStatement, s as RuntimeQueryable, t as AfterExecuteResult, u as createRuntime, v as ExecutionContext, w as SqlRuntimeAdapterDescriptor, x as RuntimeParameterizedCodecDescriptor, y as GeneratorStability, z as LintsOptions } from "./index-CFbuVnYJ.mjs";
2
+ export { APP_SPACE_ID, AfterExecuteResult, BudgetsOptions, CreateRuntimeOptions, ExecutionContext, GeneratorStability, LintsOptions, Log, MarkerReader, MarkerStatement, Runtime, RuntimeConnection, RuntimeFamilyAdapter, RuntimeMutationDefaultGenerator, RuntimeParameterizedCodecDescriptor, RuntimeQueryable, RuntimeTelemetryEvent, RuntimeTransaction, RuntimeVerifyOptions, SqlExecutionStack, SqlExecutionStackWithDriver, SqlMiddleware, SqlMiddlewareContext, SqlRuntimeAdapterDescriptor, SqlRuntimeAdapterInstance, SqlRuntimeDriverInstance, SqlRuntimeExtensionDescriptor, SqlRuntimeExtensionInstance, SqlRuntimeTargetDescriptor, SqlStatement, SqlStaticContributions, TelemetryOutcome, TransactionContext, TypeHelperRegistry, budgets, createExecutionContext, createRuntime, createSqlExecutionStack, ensureSchemaStatement, ensureTableStatement, extractCodecIds, lints, lowerSqlPlan, parseContractMarkerRow, readContractMarker, validateCodecRegistryCompleteness, validateContractCodecMappings, withTransaction, writeContractMarker };
package/dist/index.mjs CHANGED
@@ -1,3 +1,2 @@
1
- import { a as readContractMarker, c as createSqlExecutionStack, d as lowerSqlPlan, f as extractCodecIds, i as ensureTableStatement, l as lints, m as validateContractCodecMappings, n as withTransaction, o as writeContractMarker, p as validateCodecRegistryCompleteness, r as ensureSchemaStatement, s as createExecutionContext, t as createRuntime, u as budgets } from "./exports-Cssiepsb.mjs";
2
-
3
- export { budgets, createExecutionContext, createRuntime, createSqlExecutionStack, ensureSchemaStatement, ensureTableStatement, extractCodecIds, lints, lowerSqlPlan, readContractMarker, validateCodecRegistryCompleteness, validateContractCodecMappings, withTransaction, writeContractMarker };
1
+ import { a as ensureTableStatement, c as createExecutionContext, d as budgets, f as parseContractMarkerRow, g as validateContractCodecMappings, h as validateCodecRegistryCompleteness, i as ensureSchemaStatement, l as createSqlExecutionStack, m as extractCodecIds, n as withTransaction, o as readContractMarker, p as lowerSqlPlan, r as APP_SPACE_ID, s as writeContractMarker, t as createRuntime, u as lints } from "./exports-C0exnDCV.mjs";
2
+ export { APP_SPACE_ID, budgets, createExecutionContext, createRuntime, createSqlExecutionStack, ensureSchemaStatement, ensureTableStatement, extractCodecIds, lints, lowerSqlPlan, parseContractMarkerRow, readContractMarker, validateCodecRegistryCompleteness, validateContractCodecMappings, withTransaction, writeContractMarker };
@@ -1,77 +1,82 @@
1
- import { A as SqlRuntimeExtensionInstance, D as SqlRuntimeAdapterInstance, E as SqlRuntimeAdapterDescriptor, O as SqlRuntimeDriverInstance, g as SqlStatement, j as SqlRuntimeTargetDescriptor, k as SqlRuntimeExtensionDescriptor, m as createRuntime, x as ExecutionContext } from "../index-yb51L_1h.mjs";
2
- import { Adapter, LoweredStatement, SelectAst } from "@prisma-next/sql-relational-core/ast";
3
- import * as _prisma_next_framework_components_execution0 from "@prisma-next/framework-components/execution";
1
+ import { D as SqlRuntimeExtensionDescriptor, E as SqlRuntimeDriverInstance, O as SqlRuntimeExtensionInstance, T as SqlRuntimeAdapterInstance, k as SqlRuntimeTargetDescriptor, p as SqlStatement, u as createRuntime, v as ExecutionContext, w as SqlRuntimeAdapterDescriptor } from "../index-CFbuVnYJ.mjs";
2
+ import { ResultType } from "@prisma-next/framework-components/runtime";
3
+ import { Adapter, Codec, ContractCodecRegistry, LoweredStatement, SelectAst } from "@prisma-next/sql-relational-core/ast";
4
+ import * as _$_prisma_next_framework_components_execution0 from "@prisma-next/framework-components/execution";
4
5
  import { RuntimeDriverDescriptor } from "@prisma-next/framework-components/execution";
5
- import { Contract, ExecutionPlan, ResultType } from "@prisma-next/contract/types";
6
+ import { Contract } from "@prisma-next/contract/types";
7
+ import { CodecDescriptor } from "@prisma-next/framework-components/codec";
6
8
  import { DevDatabase, collectAsync, createDevDatabase, teardownTestDatabase, withClient } from "@prisma-next/test-utils";
7
9
  import { SqlStorage } from "@prisma-next/sql-contract/types";
8
- import { SqlQueryPlan } from "@prisma-next/sql-relational-core/plan";
10
+ import { SqlExecutionPlan, SqlQueryPlan } from "@prisma-next/sql-relational-core/plan";
9
11
  import { Client } from "pg";
10
12
 
11
13
  //#region test/utils.d.ts
12
-
13
14
  /**
14
- * Executes a plan and collects all results into an array.
15
- * This helper DRYs up the common pattern of executing plans in tests.
16
- * The return type is inferred from the plan's type parameter.
15
+ * Executes a plan and collects all results into an array. This helper DRYs up the common pattern of executing plans in tests. The return type is inferred from the plan's type parameter.
17
16
  */
18
- declare function executePlanAndCollect<P extends ExecutionPlan<ResultType<P>> | SqlQueryPlan<ResultType<P>>>(runtime: ReturnType<typeof createRuntime>, plan: P): Promise<ResultType<P>[]>;
17
+ declare function executePlanAndCollect<P extends SqlExecutionPlan<ResultType<P>> | SqlQueryPlan<ResultType<P>>>(runtime: ReturnType<typeof createRuntime>, plan: P): Promise<ResultType<P>[]>;
19
18
  /**
20
- * Drains a plan execution, consuming all results without collecting them.
21
- * Useful for testing side effects without memory overhead.
19
+ * Drains a plan execution, consuming all results without collecting them. Useful for testing side effects without memory overhead.
22
20
  */
23
- declare function drainPlanExecution(runtime: ReturnType<typeof createRuntime>, plan: ExecutionPlan | SqlQueryPlan<unknown>): Promise<void>;
21
+ declare function drainPlanExecution(runtime: ReturnType<typeof createRuntime>, plan: SqlExecutionPlan | SqlQueryPlan<unknown>): Promise<void>;
24
22
  /**
25
23
  * Executes a SQL statement on a database client.
26
24
  */
27
25
  declare function executeStatement(client: Client, statement: SqlStatement): Promise<void>;
28
26
  /**
29
- * Sets up database schema and data, then writes the contract marker.
30
- * This helper DRYs up the common pattern of database setup in tests.
27
+ * Sets up database schema and data, then writes the contract marker. This helper DRYs up the common pattern of database setup in tests.
31
28
  */
32
29
  declare function setupTestDatabase(client: Client, contract: Contract<SqlStorage>, setupFn: (client: Client) => Promise<void>): Promise<void>;
33
30
  /**
34
- * Writes a contract marker to the database.
35
- * This helper DRYs up the common pattern of writing contract markers in tests.
31
+ * Writes a contract marker to the database. This helper DRYs up the common pattern of writing contract markers in tests.
36
32
  */
37
33
  declare function writeTestContractMarker(client: Client, contract: Contract<SqlStorage>): Promise<void>;
38
34
  /**
39
- * Creates a test adapter descriptor from a raw adapter.
40
- * Wraps the adapter in an SqlRuntimeAdapterDescriptor with static contributions
41
- * derived from the adapter's codec registry.
35
+ * Creates a test adapter descriptor from a raw adapter. Wraps the adapter in an SqlRuntimeAdapterDescriptor with static contributions derived from the adapter's codec registry.
36
+ */
37
+ /**
38
+ * Build a {@link ContractCodecRegistry} from a codec array for tests that exercise `encodeParam(s)` / `decodeRow` in isolation. The production runtime builds `ContractCodecRegistry` from contract walk + descriptor list and never goes through this helper; tests use it to wire a hand-built codec set into the surface those functions consume in production.
42
39
  */
43
- declare function createTestAdapterDescriptor(adapter: Adapter<SelectAst, Contract<SqlStorage>, LoweredStatement>): SqlRuntimeAdapterDescriptor<'postgres'>;
40
+ declare function buildTestContractCodecs(codecs: ReadonlyArray<Codec<string>>): ContractCodecRegistry;
41
+ /**
42
+ * Synthesize `CodecDescriptor`s from a codec array of non-parameterized codec instances. Test-only: the production synthesis bridge was retired under TML-2357. Lets the existing `createTestAdapterDescriptor` pattern keep wrapping a stub `Adapter` (whose `__codecs` slot still exposes the codec set) into the descriptor-list shape that `SqlStaticContributions.codecs:` now expects. The `Codec` instances carry
43
+ * `traits`/`targetTypes`/`meta` via the SQL family extension; the structural narrow reads those fields directly.
44
+ */
45
+ declare function descriptorsFromCodecs(codecs: ReadonlyArray<Codec<string>>): ReadonlyArray<CodecDescriptor>;
46
+ declare function createTestAdapterDescriptor(adapter: StubAdapter): SqlRuntimeAdapterDescriptor<'postgres'>;
44
47
  /**
45
48
  * Creates a test target descriptor with empty static contributions.
46
49
  */
47
50
  declare function createTestTargetDescriptor(): SqlRuntimeTargetDescriptor<'postgres'>;
48
51
  /**
49
- * Creates an ExecutionContext for testing.
50
- * This helper DRYs up the common pattern of context creation in tests.
52
+ * Creates an ExecutionContext for testing. This helper DRYs up the common pattern of context creation in tests.
51
53
  *
52
- * Accepts a raw adapter and optional extension descriptors, wrapping the
53
- * adapter in a descriptor internally for descriptor-first context creation.
54
+ * Accepts a raw adapter and optional extension descriptors, wrapping the adapter in a descriptor internally for descriptor-first context creation.
54
55
  */
55
- declare function createTestContext<TContract extends Contract<SqlStorage>>(contract: TContract, adapter: Adapter<SelectAst, Contract<SqlStorage>, LoweredStatement>, options?: {
56
+ declare function createTestContext<TContract extends Contract<SqlStorage>>(contract: TContract, adapter: StubAdapter, options?: {
56
57
  extensionPacks?: ReadonlyArray<SqlRuntimeExtensionDescriptor<'postgres'>>;
57
58
  }): ExecutionContext<TContract>;
58
59
  declare function createTestStackInstance(options?: {
59
60
  extensionPacks?: ReadonlyArray<SqlRuntimeExtensionDescriptor<'postgres'>>;
60
61
  driver?: RuntimeDriverDescriptor<'sql', 'postgres', unknown, SqlRuntimeDriverInstance<'postgres'>>;
61
- }): _prisma_next_framework_components_execution0.ExecutionStackInstance<"sql", "postgres", SqlRuntimeAdapterInstance<"postgres">, SqlRuntimeDriverInstance<"postgres">, SqlRuntimeExtensionInstance<"postgres">>;
62
+ }): _$_prisma_next_framework_components_execution0.ExecutionStackInstance<"sql", "postgres", SqlRuntimeAdapterInstance<"postgres">, SqlRuntimeDriverInstance<"postgres">, SqlRuntimeExtensionInstance<"postgres">>;
63
+ /**
64
+ * Stub-adapter type augments the public {@link Adapter} surface with a `__codecs` slot that exposes the test stub's runtime codec set to descriptor-shaping helpers (`createTestAdapterDescriptor`). Production adapters do not declare this slot — runtime codecs flow through the descriptor list from `SqlRuntimeAdapterDescriptor.codecs()` — so the augmentation is intentionally test-only.
65
+ */
66
+ type StubAdapter = Adapter<SelectAst, Contract<SqlStorage>, LoweredStatement> & {
67
+ readonly __codecs: ReadonlyArray<Codec<string>>;
68
+ };
62
69
  /**
63
- * Creates a stub adapter for testing.
64
- * This helper DRYs up the common pattern of adapter creation in tests.
70
+ * Creates a stub adapter for testing. This helper DRYs up the common pattern of adapter creation in tests.
65
71
  *
66
- * The stub adapter includes simple codecs for common test types (pg/int4@1, pg/text@1, pg/timestamptz@1)
67
- * to enable type inference in tests without requiring the postgres adapter package.
72
+ * The stub adapter includes simple codecs for common test types (pg/int4@1, pg/text@1, pg/timestamptz@1) to enable type inference in tests without requiring the postgres adapter package.
68
73
  */
69
- declare function createStubAdapter(): Adapter<SelectAst, Contract<SqlStorage>, LoweredStatement>;
74
+ declare function createStubAdapter(): StubAdapter;
70
75
  declare function createTestContract(contract: Partial<Omit<Contract<SqlStorage>, 'profileHash' | 'storage'>> & {
71
76
  storageHash?: string;
72
77
  profileHash?: string;
73
78
  storage?: Omit<SqlStorage, 'storageHash'>;
74
79
  }): Contract<SqlStorage>;
75
80
  //#endregion
76
- export { type DevDatabase, collectAsync, createDevDatabase, createStubAdapter, createTestAdapterDescriptor, createTestContext, createTestContract, createTestStackInstance, createTestTargetDescriptor, drainPlanExecution, executePlanAndCollect, executeStatement, setupTestDatabase, teardownTestDatabase, withClient, writeTestContractMarker };
81
+ export { type DevDatabase, StubAdapter, buildTestContractCodecs, collectAsync, createDevDatabase, createStubAdapter, createTestAdapterDescriptor, createTestContext, createTestContract, createTestStackInstance, createTestTargetDescriptor, descriptorsFromCodecs, drainPlanExecution, executePlanAndCollect, executeStatement, setupTestDatabase, teardownTestDatabase, withClient, writeTestContractMarker };
77
82
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