@prisma-next/sql-runtime 0.3.0-pr.100.1 → 0.3.0-pr.101.2

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.
@@ -6,7 +6,7 @@ import type {
6
6
  RuntimeTargetDescriptor,
7
7
  } from '@prisma-next/core-execution-plane/types';
8
8
  import { createOperationRegistry } from '@prisma-next/operations';
9
- import type { SqlContract, SqlStorage, StorageTypeInstance } from '@prisma-next/sql-contract/types';
9
+ import type { SqlContract, SqlStorage } from '@prisma-next/sql-contract/types';
10
10
  import type { SqlOperationSignature } from '@prisma-next/sql-operations';
11
11
  import type {
12
12
  Adapter,
@@ -15,42 +15,7 @@ import type {
15
15
  QueryAst,
16
16
  } from '@prisma-next/sql-relational-core/ast';
17
17
  import { createCodecRegistry } from '@prisma-next/sql-relational-core/ast';
18
- import type {
19
- QueryLaneContext,
20
- TypeHelperRegistry,
21
- } from '@prisma-next/sql-relational-core/query-lane-context';
22
- import type { Type } from 'arktype';
23
- import { type as arktype } from 'arktype';
24
-
25
- // ============================================================================
26
- // Runtime Parameterized Codec Descriptor Types
27
- // ============================================================================
28
-
29
- /**
30
- * Runtime parameterized codec descriptor.
31
- * Provides validation schema and optional init hook for codecs that support type parameters.
32
- * Used at runtime to validate typeParams and create type helpers.
33
- */
34
- export interface RuntimeParameterizedCodecDescriptor<
35
- TParams = Record<string, unknown>,
36
- THelper = unknown,
37
- > {
38
- /** The codec ID this descriptor applies to (e.g., 'pg/vector@1') */
39
- readonly codecId: string;
40
-
41
- /**
42
- * Arktype schema for validating typeParams.
43
- * The schema is used to validate both storage.types entries and inline column typeParams.
44
- */
45
- readonly paramsSchema: Type<TParams>;
46
-
47
- /**
48
- * Optional init hook called during runtime context creation.
49
- * Receives validated params and returns a helper object to be stored in context.types.
50
- * If not provided, the validated params are stored directly.
51
- */
52
- readonly init?: (params: TParams) => THelper;
53
- }
18
+ import type { QueryLaneContext } from '@prisma-next/sql-relational-core/query-lane-context';
54
19
 
55
20
  // ============================================================================
56
21
  // SQL Runtime Extension Types
@@ -69,12 +34,6 @@ export interface SqlRuntimeExtensionInstance<TTargetId extends string>
69
34
  codecs?(): CodecRegistry;
70
35
  /** Returns operations to register in the runtime context. */
71
36
  operations?(): ReadonlyArray<SqlOperationSignature>;
72
- /**
73
- * Returns parameterized codec descriptors for type validation and helper creation.
74
- * Uses unknown for type parameters to allow any concrete descriptor types.
75
- */
76
- // biome-ignore lint/suspicious/noExplicitAny: needed for covariance with concrete descriptor types
77
- parameterizedCodecs?(): ReadonlyArray<RuntimeParameterizedCodecDescriptor<any, any>>;
78
37
  }
79
38
 
80
39
  /**
@@ -109,21 +68,11 @@ export type SqlRuntimeAdapterInstance<TTargetId extends string = string> = Runti
109
68
  // SQL Runtime Context
110
69
  // ============================================================================
111
70
 
112
- export type { TypeHelperRegistry };
113
-
114
71
  export interface RuntimeContext<TContract extends SqlContract<SqlStorage> = SqlContract<SqlStorage>>
115
72
  extends QueryLaneContext<TContract> {
116
73
  readonly adapter:
117
74
  | Adapter<QueryAst, TContract, LoweredStatement>
118
75
  | Adapter<QueryAst, SqlContract<SqlStorage>, LoweredStatement>;
119
-
120
- /**
121
- * Initialized type helpers from storage.types.
122
- * Each entry corresponds to a named type instance in the contract's storage.types.
123
- * The value is the result of calling the codec's init hook (if provided)
124
- * or the validated typeParams (if no init hook).
125
- */
126
- readonly types?: TypeHelperRegistry;
127
76
  }
128
77
 
129
78
  /**
@@ -147,180 +96,6 @@ export interface CreateRuntimeContextOptions<
147
96
  readonly extensionPacks?: ReadonlyArray<SqlRuntimeExtensionDescriptor<TTargetId>>;
148
97
  }
149
98
 
150
- // ============================================================================
151
- // Runtime Error Types and Helpers
152
- // ============================================================================
153
-
154
- /**
155
- * Structured error thrown by the SQL runtime.
156
- *
157
- * Aligns with the repository's error envelope convention:
158
- * - `code`: Stable error code for programmatic handling (e.g., `RUNTIME.TYPE_PARAMS_INVALID`)
159
- * - `category`: Error source category (`RUNTIME`)
160
- * - `severity`: Error severity level (`error`)
161
- * - `details`: Optional structured details for debugging
162
- *
163
- * @example
164
- * ```typescript
165
- * try {
166
- * createRuntimeContext({ ... });
167
- * } catch (e) {
168
- * if ((e as RuntimeError).code === 'RUNTIME.TYPE_PARAMS_INVALID') {
169
- * console.error('Invalid type parameters:', (e as RuntimeError).details);
170
- * }
171
- * }
172
- * ```
173
- */
174
- export interface RuntimeError extends Error {
175
- /** Stable error code for programmatic handling (e.g., `RUNTIME.TYPE_PARAMS_INVALID`) */
176
- readonly code: string;
177
- /** Error source category */
178
- readonly category: 'RUNTIME';
179
- /** Error severity level */
180
- readonly severity: 'error';
181
- /** Optional structured details for debugging */
182
- readonly details?: Record<string, unknown>;
183
- }
184
-
185
- /**
186
- * Creates a RuntimeError for invalid type parameters.
187
- *
188
- * Error code: `RUNTIME.TYPE_PARAMS_INVALID`
189
- *
190
- * Thrown when:
191
- * - `storage.types` entries have typeParams that fail codec schema validation
192
- * - Column inline typeParams fail codec schema validation
193
- *
194
- * @internal
195
- */
196
- function runtimeTypeParamsInvalid(
197
- message: string,
198
- details?: Record<string, unknown>,
199
- ): RuntimeError {
200
- const error = new Error(message) as RuntimeError;
201
- Object.defineProperty(error, 'name', { value: 'RuntimeError', configurable: true });
202
- return Object.assign(error, {
203
- code: 'RUNTIME.TYPE_PARAMS_INVALID',
204
- category: 'RUNTIME' as const,
205
- severity: 'error' as const,
206
- details,
207
- });
208
- }
209
-
210
- // ============================================================================
211
- // Parameterized Type Validation
212
- // ============================================================================
213
-
214
- /**
215
- * Validates typeParams against the codec's paramsSchema.
216
- * @throws RuntimeError with code RUNTIME.TYPE_PARAMS_INVALID if validation fails
217
- */
218
- function validateTypeParams(
219
- typeParams: Record<string, unknown>,
220
- codecDescriptor: RuntimeParameterizedCodecDescriptor,
221
- context: { typeName?: string; tableName?: string; columnName?: string },
222
- ): Record<string, unknown> {
223
- const result = codecDescriptor.paramsSchema(typeParams);
224
- if (result instanceof arktype.errors) {
225
- const messages = result.map((p: { message: string }) => p.message).join('; ');
226
- const locationInfo = context.typeName
227
- ? `type '${context.typeName}'`
228
- : `column '${context.tableName}.${context.columnName}'`;
229
- throw runtimeTypeParamsInvalid(
230
- `Invalid typeParams for ${locationInfo} (codecId: ${codecDescriptor.codecId}): ${messages}`,
231
- { ...context, codecId: codecDescriptor.codecId, typeParams },
232
- );
233
- }
234
- return result as Record<string, unknown>;
235
- }
236
-
237
- /**
238
- * Collects parameterized codec descriptors from extension instances.
239
- * Returns a map of codecId → descriptor for quick lookup.
240
- */
241
- function collectParameterizedCodecDescriptors(
242
- extensionInstances: ReadonlyArray<SqlRuntimeExtensionInstance<string>>,
243
- ): Map<string, RuntimeParameterizedCodecDescriptor> {
244
- const descriptors = new Map<string, RuntimeParameterizedCodecDescriptor>();
245
-
246
- for (const extInstance of extensionInstances) {
247
- const paramCodecs = extInstance.parameterizedCodecs?.();
248
- if (paramCodecs) {
249
- for (const descriptor of paramCodecs) {
250
- descriptors.set(descriptor.codecId, descriptor);
251
- }
252
- }
253
- }
254
-
255
- return descriptors;
256
- }
257
-
258
- /**
259
- * Initializes type helpers from storage.types using codec descriptors.
260
- *
261
- * For each named type instance in `storage.types`:
262
- * - If a codec descriptor exists with an `init` hook: calls the hook and stores the result
263
- * - Otherwise: stores the full type instance metadata directly (codecId, nativeType, typeParams)
264
- *
265
- * This matches the typing in `ExtractSchemaTypes<Contract>` which extracts
266
- * `Contract['storage']['types']` directly, ensuring runtime values match static types
267
- * when no init hook transforms the value.
268
- */
269
- function initializeTypeHelpers(
270
- storageTypes: Record<string, StorageTypeInstance> | undefined,
271
- codecDescriptors: Map<string, RuntimeParameterizedCodecDescriptor>,
272
- ): TypeHelperRegistry {
273
- const helpers: TypeHelperRegistry = {};
274
-
275
- if (!storageTypes) {
276
- return helpers;
277
- }
278
-
279
- for (const [typeName, typeInstance] of Object.entries(storageTypes)) {
280
- const descriptor = codecDescriptors.get(typeInstance.codecId);
281
-
282
- if (descriptor) {
283
- // Validate typeParams against the codec's schema
284
- const validatedParams = validateTypeParams(typeInstance.typeParams, descriptor, {
285
- typeName,
286
- });
287
-
288
- // Call init hook if provided, otherwise store full type instance
289
- if (descriptor.init) {
290
- helpers[typeName] = descriptor.init(validatedParams);
291
- } else {
292
- // No init hook: expose full type instance metadata (matches contract typing)
293
- helpers[typeName] = typeInstance;
294
- }
295
- } else {
296
- // No descriptor found: expose full type instance (no validation possible)
297
- helpers[typeName] = typeInstance;
298
- }
299
- }
300
-
301
- return helpers;
302
- }
303
-
304
- /**
305
- * Validates inline column typeParams across all tables.
306
- * @throws RuntimeError with code RUNTIME.TYPE_PARAMS_INVALID if validation fails
307
- */
308
- function validateColumnTypeParams(
309
- storage: SqlStorage,
310
- codecDescriptors: Map<string, RuntimeParameterizedCodecDescriptor>,
311
- ): void {
312
- for (const [tableName, table] of Object.entries(storage.tables)) {
313
- for (const [columnName, column] of Object.entries(table.columns)) {
314
- if (column.typeParams) {
315
- const descriptor = codecDescriptors.get(column.codecId);
316
- if (descriptor) {
317
- validateTypeParams(column.typeParams, descriptor, { tableName, columnName });
318
- }
319
- }
320
- }
321
- }
322
- }
323
-
324
99
  /**
325
100
  * Creates a SQL runtime context from descriptor-first composition.
326
101
  *
@@ -329,7 +104,6 @@ function validateColumnTypeParams(
329
104
  * - The adapter instance (created from descriptor)
330
105
  * - Codec registry (populated from adapter + extension instances)
331
106
  * - Operation registry (populated from extension instances)
332
- * - Types registry (initialized helpers from storage.types)
333
107
  *
334
108
  * @param options - Descriptor-first composition options
335
109
  * @returns RuntimeContext with registries wired from all components
@@ -354,12 +128,9 @@ export function createRuntimeContext<
354
128
  codecRegistry.register(codec);
355
129
  }
356
130
 
357
- // Create extension instances and collect their contributions
358
- const extensionInstances: SqlRuntimeExtensionInstance<TTargetId>[] = [];
359
-
131
+ // Create extension instances and register their codecs/operations
360
132
  for (const extDescriptor of extensionPacks ?? []) {
361
133
  const extInstance = extDescriptor.create();
362
- extensionInstances.push(extInstance);
363
134
 
364
135
  const extCodecs = extInstance.codecs?.();
365
136
  if (extCodecs) {
@@ -376,22 +147,10 @@ export function createRuntimeContext<
376
147
  }
377
148
  }
378
149
 
379
- // Collect parameterized codec descriptors from extensions
380
- const parameterizedCodecDescriptors = collectParameterizedCodecDescriptors(extensionInstances);
381
-
382
- // Validate column typeParams if any descriptors are registered
383
- if (parameterizedCodecDescriptors.size > 0) {
384
- validateColumnTypeParams(contract.storage, parameterizedCodecDescriptors);
385
- }
386
-
387
- // Initialize type helpers from storage.types
388
- const types = initializeTypeHelpers(contract.storage.types, parameterizedCodecDescriptors);
389
-
390
150
  return {
391
151
  contract,
392
152
  adapter: adapterInstance,
393
153
  operations: operationRegistry,
394
154
  codecs: codecRegistry,
395
- types,
396
155
  };
397
156
  }
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/codecs/validation.ts","../src/lower-sql-plan.ts","../src/sql-context.ts","../src/sql-marker.ts","../src/sql-runtime.ts","../src/codecs/decoding.ts","../src/codecs/encoding.ts","../src/sql-family-adapter.ts","../src/exports/index.ts"],"sourcesContent":["import { runtimeError } from '@prisma-next/runtime-executor';\nimport type { SqlContract, SqlStorage } from '@prisma-next/sql-contract/types';\nimport type { CodecRegistry } from '@prisma-next/sql-relational-core/ast';\n\nexport function extractCodecIds(contract: SqlContract<SqlStorage>): Set<string> {\n const codecIds = new Set<string>();\n\n for (const table of Object.values(contract.storage.tables)) {\n for (const column of Object.values(table.columns)) {\n const codecId = column.codecId;\n codecIds.add(codecId);\n }\n }\n\n return codecIds;\n}\n\nfunction extractCodecIdsFromColumns(contract: SqlContract<SqlStorage>): Map<string, string> {\n const codecIds = new Map<string, string>();\n\n for (const [tableName, table] of Object.entries(contract.storage.tables)) {\n for (const [columnName, column] of Object.entries(table.columns)) {\n const codecId = column.codecId;\n const key = `${tableName}.${columnName}`;\n codecIds.set(key, codecId);\n }\n }\n\n return codecIds;\n}\n\nexport function validateContractCodecMappings(\n registry: CodecRegistry,\n contract: SqlContract<SqlStorage>,\n): void {\n const codecIds = extractCodecIdsFromColumns(contract);\n const invalidCodecs: Array<{ table: string; column: string; codecId: string }> = [];\n\n for (const [key, codecId] of codecIds.entries()) {\n if (!registry.has(codecId)) {\n const parts = key.split('.');\n const table = parts[0] ?? '';\n const column = parts[1] ?? '';\n invalidCodecs.push({ table, column, codecId });\n }\n }\n\n if (invalidCodecs.length > 0) {\n const details: Record<string, unknown> = {\n contractTarget: contract.target,\n invalidCodecs,\n };\n\n throw runtimeError(\n 'RUNTIME.CODEC_MISSING',\n `Missing codec implementations for column codecIds: ${invalidCodecs.map((c) => `${c.table}.${c.column} (${c.codecId})`).join(', ')}`,\n details,\n );\n }\n}\n\nexport function validateCodecRegistryCompleteness(\n registry: CodecRegistry,\n contract: SqlContract<SqlStorage>,\n): void {\n validateContractCodecMappings(registry, contract);\n}\n","import type { ExecutionPlan } from '@prisma-next/contract/types';\nimport type { SqlQueryPlan } from '@prisma-next/sql-relational-core/plan';\nimport type { RuntimeContext } from './sql-context';\n\n/**\n * Lowers a SQL query plan to an executable Plan by calling the adapter's lower method.\n *\n * This function is responsible for converting a lane-produced SqlQueryPlan (which contains\n * AST and params but no SQL) into a fully executable Plan (which includes SQL string).\n *\n * @param context - Runtime context containing the adapter\n * @param queryPlan - SQL query plan from a lane (contains AST, params, meta, but no SQL)\n * @returns Fully executable Plan with SQL string\n */\nexport function lowerSqlPlan<Row>(\n context: RuntimeContext,\n queryPlan: SqlQueryPlan<Row>,\n): ExecutionPlan<Row> {\n const lowered = context.adapter.lower(queryPlan.ast, {\n contract: context.contract,\n params: queryPlan.params,\n });\n\n const body = lowered.body;\n\n return Object.freeze({\n sql: body.sql,\n params: body.params ?? queryPlan.params,\n ast: queryPlan.ast,\n meta: queryPlan.meta,\n });\n}\n","import type {\n RuntimeAdapterDescriptor,\n RuntimeAdapterInstance,\n RuntimeExtensionDescriptor,\n RuntimeExtensionInstance,\n RuntimeTargetDescriptor,\n} from '@prisma-next/core-execution-plane/types';\nimport { createOperationRegistry } from '@prisma-next/operations';\nimport type { SqlContract, SqlStorage, StorageTypeInstance } from '@prisma-next/sql-contract/types';\nimport type { SqlOperationSignature } from '@prisma-next/sql-operations';\nimport type {\n Adapter,\n CodecRegistry,\n LoweredStatement,\n QueryAst,\n} from '@prisma-next/sql-relational-core/ast';\nimport { createCodecRegistry } from '@prisma-next/sql-relational-core/ast';\nimport type {\n QueryLaneContext,\n TypeHelperRegistry,\n} from '@prisma-next/sql-relational-core/query-lane-context';\nimport type { Type } from 'arktype';\nimport { type as arktype } from 'arktype';\n\n// ============================================================================\n// Runtime Parameterized Codec Descriptor Types\n// ============================================================================\n\n/**\n * Runtime parameterized codec descriptor.\n * Provides validation schema and optional init hook for codecs that support type parameters.\n * Used at runtime to validate typeParams and create type helpers.\n */\nexport interface RuntimeParameterizedCodecDescriptor<\n TParams = Record<string, unknown>,\n THelper = unknown,\n> {\n /** The codec ID this descriptor applies to (e.g., 'pg/vector@1') */\n readonly codecId: string;\n\n /**\n * Arktype schema for validating typeParams.\n * The schema is used to validate both storage.types entries and inline column typeParams.\n */\n readonly paramsSchema: Type<TParams>;\n\n /**\n * Optional init hook called during runtime context creation.\n * Receives validated params and returns a helper object to be stored in context.types.\n * If not provided, the validated params are stored directly.\n */\n readonly init?: (params: TParams) => THelper;\n}\n\n// ============================================================================\n// SQL Runtime Extension Types\n// ============================================================================\n\n/**\n * SQL runtime extension instance.\n * Extends the framework RuntimeExtensionInstance with SQL-specific hooks\n * for contributing codecs and operations to the runtime context.\n *\n * @template TTargetId - The target ID (e.g., 'postgres', 'mysql')\n */\nexport interface SqlRuntimeExtensionInstance<TTargetId extends string>\n extends RuntimeExtensionInstance<'sql', TTargetId> {\n /** Returns codecs to register in the runtime context. */\n codecs?(): CodecRegistry;\n /** Returns operations to register in the runtime context. */\n operations?(): ReadonlyArray<SqlOperationSignature>;\n /**\n * Returns parameterized codec descriptors for type validation and helper creation.\n * Uses unknown for type parameters to allow any concrete descriptor types.\n */\n // biome-ignore lint/suspicious/noExplicitAny: needed for covariance with concrete descriptor types\n parameterizedCodecs?(): ReadonlyArray<RuntimeParameterizedCodecDescriptor<any, any>>;\n}\n\n/**\n * SQL runtime extension descriptor.\n * Extends the framework RuntimeExtensionDescriptor with SQL-specific instance type.\n *\n * @template TTargetId - The target ID (e.g., 'postgres', 'mysql')\n */\nexport interface SqlRuntimeExtensionDescriptor<TTargetId extends string>\n extends RuntimeExtensionDescriptor<'sql', TTargetId, SqlRuntimeExtensionInstance<TTargetId>> {\n create(): SqlRuntimeExtensionInstance<TTargetId>;\n}\n\n// ============================================================================\n// SQL Runtime Adapter Instance\n// ============================================================================\n\n/**\n * SQL runtime adapter instance interface.\n * Combines RuntimeAdapterInstance identity with SQL Adapter behavior.\n * The instance IS an Adapter (via intersection), not HAS an adapter property.\n *\n * @template TTargetId - The target ID (e.g., 'postgres', 'mysql')\n */\nexport type SqlRuntimeAdapterInstance<TTargetId extends string = string> = RuntimeAdapterInstance<\n 'sql',\n TTargetId\n> &\n Adapter<QueryAst, SqlContract<SqlStorage>, LoweredStatement>;\n\n// ============================================================================\n// SQL Runtime Context\n// ============================================================================\n\nexport type { TypeHelperRegistry };\n\nexport interface RuntimeContext<TContract extends SqlContract<SqlStorage> = SqlContract<SqlStorage>>\n extends QueryLaneContext<TContract> {\n readonly adapter:\n | Adapter<QueryAst, TContract, LoweredStatement>\n | Adapter<QueryAst, SqlContract<SqlStorage>, LoweredStatement>;\n\n /**\n * Initialized type helpers from storage.types.\n * Each entry corresponds to a named type instance in the contract's storage.types.\n * The value is the result of calling the codec's init hook (if provided)\n * or the validated typeParams (if no init hook).\n */\n readonly types?: TypeHelperRegistry;\n}\n\n/**\n * Descriptor-first options for creating a SQL runtime context.\n * Takes the same framework composition as control-plane: target, adapter, extensionPacks.\n *\n * @template TContract - The SQL contract type\n * @template TTargetId - The target ID (e.g., 'postgres', 'mysql')\n */\nexport interface CreateRuntimeContextOptions<\n TContract extends SqlContract<SqlStorage> = SqlContract<SqlStorage>,\n TTargetId extends string = string,\n> {\n readonly contract: TContract;\n readonly target: RuntimeTargetDescriptor<'sql', TTargetId>;\n readonly adapter: RuntimeAdapterDescriptor<\n 'sql',\n TTargetId,\n SqlRuntimeAdapterInstance<TTargetId>\n >;\n readonly extensionPacks?: ReadonlyArray<SqlRuntimeExtensionDescriptor<TTargetId>>;\n}\n\n// ============================================================================\n// Runtime Error Types and Helpers\n// ============================================================================\n\n/**\n * Structured error thrown by the SQL runtime.\n *\n * Aligns with the repository's error envelope convention:\n * - `code`: Stable error code for programmatic handling (e.g., `RUNTIME.TYPE_PARAMS_INVALID`)\n * - `category`: Error source category (`RUNTIME`)\n * - `severity`: Error severity level (`error`)\n * - `details`: Optional structured details for debugging\n *\n * @example\n * ```typescript\n * try {\n * createRuntimeContext({ ... });\n * } catch (e) {\n * if ((e as RuntimeError).code === 'RUNTIME.TYPE_PARAMS_INVALID') {\n * console.error('Invalid type parameters:', (e as RuntimeError).details);\n * }\n * }\n * ```\n */\nexport interface RuntimeError extends Error {\n /** Stable error code for programmatic handling (e.g., `RUNTIME.TYPE_PARAMS_INVALID`) */\n readonly code: string;\n /** Error source category */\n readonly category: 'RUNTIME';\n /** Error severity level */\n readonly severity: 'error';\n /** Optional structured details for debugging */\n readonly details?: Record<string, unknown>;\n}\n\n/**\n * Creates a RuntimeError for invalid type parameters.\n *\n * Error code: `RUNTIME.TYPE_PARAMS_INVALID`\n *\n * Thrown when:\n * - `storage.types` entries have typeParams that fail codec schema validation\n * - Column inline typeParams fail codec schema validation\n *\n * @internal\n */\nfunction runtimeTypeParamsInvalid(\n message: string,\n details?: Record<string, unknown>,\n): RuntimeError {\n const error = new Error(message) as RuntimeError;\n Object.defineProperty(error, 'name', { value: 'RuntimeError', configurable: true });\n return Object.assign(error, {\n code: 'RUNTIME.TYPE_PARAMS_INVALID',\n category: 'RUNTIME' as const,\n severity: 'error' as const,\n details,\n });\n}\n\n// ============================================================================\n// Parameterized Type Validation\n// ============================================================================\n\n/**\n * Validates typeParams against the codec's paramsSchema.\n * @throws RuntimeError with code RUNTIME.TYPE_PARAMS_INVALID if validation fails\n */\nfunction validateTypeParams(\n typeParams: Record<string, unknown>,\n codecDescriptor: RuntimeParameterizedCodecDescriptor,\n context: { typeName?: string; tableName?: string; columnName?: string },\n): Record<string, unknown> {\n const result = codecDescriptor.paramsSchema(typeParams);\n if (result instanceof arktype.errors) {\n const messages = result.map((p: { message: string }) => p.message).join('; ');\n const locationInfo = context.typeName\n ? `type '${context.typeName}'`\n : `column '${context.tableName}.${context.columnName}'`;\n throw runtimeTypeParamsInvalid(\n `Invalid typeParams for ${locationInfo} (codecId: ${codecDescriptor.codecId}): ${messages}`,\n { ...context, codecId: codecDescriptor.codecId, typeParams },\n );\n }\n return result as Record<string, unknown>;\n}\n\n/**\n * Collects parameterized codec descriptors from extension instances.\n * Returns a map of codecId → descriptor for quick lookup.\n */\nfunction collectParameterizedCodecDescriptors(\n extensionInstances: ReadonlyArray<SqlRuntimeExtensionInstance<string>>,\n): Map<string, RuntimeParameterizedCodecDescriptor> {\n const descriptors = new Map<string, RuntimeParameterizedCodecDescriptor>();\n\n for (const extInstance of extensionInstances) {\n const paramCodecs = extInstance.parameterizedCodecs?.();\n if (paramCodecs) {\n for (const descriptor of paramCodecs) {\n descriptors.set(descriptor.codecId, descriptor);\n }\n }\n }\n\n return descriptors;\n}\n\n/**\n * Initializes type helpers from storage.types using codec descriptors.\n *\n * For each named type instance in `storage.types`:\n * - If a codec descriptor exists with an `init` hook: calls the hook and stores the result\n * - Otherwise: stores the full type instance metadata directly (codecId, nativeType, typeParams)\n *\n * This matches the typing in `ExtractSchemaTypes<Contract>` which extracts\n * `Contract['storage']['types']` directly, ensuring runtime values match static types\n * when no init hook transforms the value.\n */\nfunction initializeTypeHelpers(\n storageTypes: Record<string, StorageTypeInstance> | undefined,\n codecDescriptors: Map<string, RuntimeParameterizedCodecDescriptor>,\n): TypeHelperRegistry {\n const helpers: TypeHelperRegistry = {};\n\n if (!storageTypes) {\n return helpers;\n }\n\n for (const [typeName, typeInstance] of Object.entries(storageTypes)) {\n const descriptor = codecDescriptors.get(typeInstance.codecId);\n\n if (descriptor) {\n // Validate typeParams against the codec's schema\n const validatedParams = validateTypeParams(typeInstance.typeParams, descriptor, {\n typeName,\n });\n\n // Call init hook if provided, otherwise store full type instance\n if (descriptor.init) {\n helpers[typeName] = descriptor.init(validatedParams);\n } else {\n // No init hook: expose full type instance metadata (matches contract typing)\n helpers[typeName] = typeInstance;\n }\n } else {\n // No descriptor found: expose full type instance (no validation possible)\n helpers[typeName] = typeInstance;\n }\n }\n\n return helpers;\n}\n\n/**\n * Validates inline column typeParams across all tables.\n * @throws RuntimeError with code RUNTIME.TYPE_PARAMS_INVALID if validation fails\n */\nfunction validateColumnTypeParams(\n storage: SqlStorage,\n codecDescriptors: Map<string, RuntimeParameterizedCodecDescriptor>,\n): void {\n for (const [tableName, table] of Object.entries(storage.tables)) {\n for (const [columnName, column] of Object.entries(table.columns)) {\n if (column.typeParams) {\n const descriptor = codecDescriptors.get(column.codecId);\n if (descriptor) {\n validateTypeParams(column.typeParams, descriptor, { tableName, columnName });\n }\n }\n }\n }\n}\n\n/**\n * Creates a SQL runtime context from descriptor-first composition.\n *\n * The context includes:\n * - The validated contract\n * - The adapter instance (created from descriptor)\n * - Codec registry (populated from adapter + extension instances)\n * - Operation registry (populated from extension instances)\n * - Types registry (initialized helpers from storage.types)\n *\n * @param options - Descriptor-first composition options\n * @returns RuntimeContext with registries wired from all components\n */\nexport function createRuntimeContext<\n TContract extends SqlContract<SqlStorage> = SqlContract<SqlStorage>,\n TTargetId extends string = string,\n>(options: CreateRuntimeContextOptions<TContract, TTargetId>): RuntimeContext<TContract> {\n const { contract, adapter: adapterDescriptor, extensionPacks } = options;\n\n // Create adapter instance from descriptor\n // The adapter instance IS an Adapter (via intersection)\n const adapterInstance = adapterDescriptor.create();\n\n // Create registries\n const codecRegistry = createCodecRegistry();\n const operationRegistry = createOperationRegistry();\n\n // Register adapter codecs (adapter instance has profile.codecs())\n const adapterCodecs = adapterInstance.profile.codecs();\n for (const codec of adapterCodecs.values()) {\n codecRegistry.register(codec);\n }\n\n // Create extension instances and collect their contributions\n const extensionInstances: SqlRuntimeExtensionInstance<TTargetId>[] = [];\n\n for (const extDescriptor of extensionPacks ?? []) {\n const extInstance = extDescriptor.create();\n extensionInstances.push(extInstance);\n\n const extCodecs = extInstance.codecs?.();\n if (extCodecs) {\n for (const codec of extCodecs.values()) {\n codecRegistry.register(codec);\n }\n }\n\n const extOperations = extInstance.operations?.();\n if (extOperations) {\n for (const operation of extOperations) {\n operationRegistry.register(operation);\n }\n }\n }\n\n // Collect parameterized codec descriptors from extensions\n const parameterizedCodecDescriptors = collectParameterizedCodecDescriptors(extensionInstances);\n\n // Validate column typeParams if any descriptors are registered\n if (parameterizedCodecDescriptors.size > 0) {\n validateColumnTypeParams(contract.storage, parameterizedCodecDescriptors);\n }\n\n // Initialize type helpers from storage.types\n const types = initializeTypeHelpers(contract.storage.types, parameterizedCodecDescriptors);\n\n return {\n contract,\n adapter: adapterInstance,\n operations: operationRegistry,\n codecs: codecRegistry,\n types,\n };\n}\n","import type { MarkerStatement } from '@prisma-next/runtime-executor';\n\nexport interface SqlStatement {\n readonly sql: string;\n readonly params: readonly unknown[];\n}\n\nexport interface WriteMarkerInput {\n readonly coreHash: string;\n readonly profileHash: string;\n readonly contractJson?: unknown;\n readonly canonicalVersion?: number;\n readonly appTag?: string;\n readonly meta?: Record<string, unknown>;\n}\n\nexport const ensureSchemaStatement: SqlStatement = {\n sql: 'create schema if not exists prisma_contract',\n params: [],\n};\n\nexport const ensureTableStatement: SqlStatement = {\n sql: `create table if not exists prisma_contract.marker (\n id smallint primary key default 1,\n core_hash text not null,\n profile_hash text not null,\n contract_json jsonb,\n canonical_version int,\n updated_at timestamptz not null default now(),\n app_tag text,\n meta jsonb not null default '{}'\n )`,\n params: [],\n};\n\nexport function readContractMarker(): MarkerStatement {\n return {\n sql: `select\n core_hash,\n profile_hash,\n contract_json,\n canonical_version,\n updated_at,\n app_tag,\n meta\n from prisma_contract.marker\n where id = $1`,\n params: [1],\n };\n}\n\nexport interface WriteContractMarkerStatements {\n readonly insert: SqlStatement;\n readonly update: SqlStatement;\n}\n\nexport function writeContractMarker(input: WriteMarkerInput): WriteContractMarkerStatements {\n const baseParams: readonly unknown[] = [\n 1,\n input.coreHash,\n input.profileHash,\n input.contractJson ?? null,\n input.canonicalVersion ?? null,\n input.appTag ?? null,\n JSON.stringify(input.meta ?? {}),\n ];\n\n const insert: SqlStatement = {\n sql: `insert into prisma_contract.marker (\n id,\n core_hash,\n profile_hash,\n contract_json,\n canonical_version,\n updated_at,\n app_tag,\n meta\n ) values (\n $1,\n $2,\n $3,\n $4::jsonb,\n $5,\n now(),\n $6,\n $7::jsonb\n )`,\n params: baseParams,\n };\n\n const update: SqlStatement = {\n sql: `update prisma_contract.marker set\n core_hash = $2,\n profile_hash = $3,\n contract_json = $4::jsonb,\n canonical_version = $5,\n updated_at = now(),\n app_tag = $6,\n meta = $7::jsonb\n where id = $1`,\n params: baseParams,\n };\n\n return { insert, update };\n}\n","import type { ExecutionPlan } from '@prisma-next/contract/types';\nimport type { OperationRegistry } from '@prisma-next/operations';\nimport type {\n Log,\n Plugin,\n RuntimeCore,\n RuntimeCoreOptions,\n RuntimeTelemetryEvent,\n RuntimeVerifyOptions,\n TelemetryOutcome,\n} from '@prisma-next/runtime-executor';\nimport { AsyncIterableResult, createRuntimeCore } from '@prisma-next/runtime-executor';\nimport type { SqlContract, SqlStorage } from '@prisma-next/sql-contract/types';\nimport type {\n Adapter,\n CodecRegistry,\n LoweredStatement,\n SelectAst,\n SqlDriver,\n} from '@prisma-next/sql-relational-core/ast';\nimport type { SqlQueryPlan } from '@prisma-next/sql-relational-core/plan';\nimport { decodeRow } from './codecs/decoding';\nimport { encodeParams } from './codecs/encoding';\nimport { validateCodecRegistryCompleteness } from './codecs/validation';\nimport { lowerSqlPlan } from './lower-sql-plan';\nimport type { RuntimeContext } from './sql-context';\nimport { SqlFamilyAdapter } from './sql-family-adapter';\n\nexport interface RuntimeOptions<\n TContract extends SqlContract<SqlStorage> = SqlContract<SqlStorage>,\n> {\n readonly driver: SqlDriver;\n readonly verify: RuntimeVerifyOptions;\n readonly context: RuntimeContext<TContract>;\n readonly plugins?: readonly Plugin<\n TContract,\n Adapter<SelectAst, SqlContract<SqlStorage>, LoweredStatement>,\n SqlDriver\n >[];\n readonly mode?: 'strict' | 'permissive';\n readonly log?: Log;\n}\n\nexport interface Runtime {\n execute<Row = Record<string, unknown>>(\n plan: ExecutionPlan<Row> | SqlQueryPlan<Row>,\n ): AsyncIterableResult<Row>;\n telemetry(): RuntimeTelemetryEvent | null;\n close(): Promise<void>;\n operations(): OperationRegistry;\n}\n\nexport type { RuntimeTelemetryEvent, RuntimeVerifyOptions, TelemetryOutcome };\n\nclass SqlRuntimeImpl<TContract extends SqlContract<SqlStorage> = SqlContract<SqlStorage>>\n implements Runtime\n{\n private readonly core: RuntimeCore<\n TContract,\n Adapter<SelectAst, SqlContract<SqlStorage>, LoweredStatement>,\n SqlDriver\n >;\n private readonly contract: TContract;\n private readonly context: RuntimeContext<TContract>;\n private readonly codecRegistry: CodecRegistry;\n private codecRegistryValidated: boolean;\n\n constructor(options: RuntimeOptions<TContract>) {\n const { context, driver, verify, plugins, mode, log } = options;\n this.contract = context.contract;\n this.context = context;\n this.codecRegistry = context.codecs;\n this.codecRegistryValidated = false;\n\n const familyAdapter = new SqlFamilyAdapter(context.contract);\n\n const coreOptions: RuntimeCoreOptions<\n TContract,\n Adapter<SelectAst, SqlContract<SqlStorage>, LoweredStatement>,\n SqlDriver\n > = {\n familyAdapter,\n driver,\n verify,\n plugins: plugins as readonly Plugin<\n TContract,\n Adapter<SelectAst, SqlContract<SqlStorage>, LoweredStatement>,\n SqlDriver\n >[],\n ...(mode !== undefined ? { mode } : {}),\n ...(log !== undefined ? { log } : {}),\n operationRegistry: context.operations,\n };\n\n this.core = createRuntimeCore(coreOptions);\n\n if (verify.mode === 'startup') {\n validateCodecRegistryCompleteness(this.codecRegistry, context.contract);\n this.codecRegistryValidated = true;\n }\n }\n\n private ensureCodecRegistryValidated(contract: SqlContract<SqlStorage>): void {\n if (!this.codecRegistryValidated) {\n validateCodecRegistryCompleteness(this.codecRegistry, contract);\n this.codecRegistryValidated = true;\n }\n }\n\n execute<Row = Record<string, unknown>>(\n plan: ExecutionPlan<Row> | SqlQueryPlan<Row>,\n ): AsyncIterableResult<Row> {\n this.ensureCodecRegistryValidated(this.contract);\n\n // Check if plan is SqlQueryPlan (has ast but no sql)\n const isSqlQueryPlan = (p: ExecutionPlan<Row> | SqlQueryPlan<Row>): p is SqlQueryPlan<Row> => {\n return 'ast' in p && !('sql' in p);\n };\n\n // Lower SqlQueryPlan to Plan if needed\n const executablePlan: ExecutionPlan<Row> = isSqlQueryPlan(plan)\n ? lowerSqlPlan(this.context, plan)\n : plan;\n\n const iterator = async function* (\n self: SqlRuntimeImpl<TContract>,\n ): AsyncGenerator<Row, void, unknown> {\n const encodedParams = encodeParams(executablePlan, self.codecRegistry);\n const planWithEncodedParams: ExecutionPlan<Row> = {\n ...executablePlan,\n params: encodedParams,\n };\n\n const coreIterator = self.core.execute(planWithEncodedParams);\n\n for await (const rawRow of coreIterator) {\n const decodedRow = decodeRow(\n rawRow as Record<string, unknown>,\n executablePlan,\n self.codecRegistry,\n );\n yield decodedRow as Row;\n }\n };\n\n return new AsyncIterableResult(iterator(this));\n }\n\n telemetry(): RuntimeTelemetryEvent | null {\n return this.core.telemetry();\n }\n\n operations(): OperationRegistry {\n return this.core.operations();\n }\n\n close(): Promise<void> {\n return this.core.close();\n }\n}\n\nexport function createRuntime<TContract extends SqlContract<SqlStorage>>(\n options: RuntimeOptions<TContract>,\n): Runtime {\n return new SqlRuntimeImpl(options);\n}\n","import type { ExecutionPlan } from '@prisma-next/contract/types';\nimport type { Codec, CodecRegistry } from '@prisma-next/sql-relational-core/ast';\n\nfunction resolveRowCodec(\n alias: string,\n plan: ExecutionPlan,\n registry: CodecRegistry,\n): Codec | null {\n const planCodecId = plan.meta.annotations?.codecs?.[alias] as string | undefined;\n if (planCodecId) {\n const codec = registry.get(planCodecId);\n if (codec) {\n return codec;\n }\n }\n\n if (plan.meta.projectionTypes) {\n const typeId = plan.meta.projectionTypes[alias];\n if (typeId) {\n const codec = registry.get(typeId);\n if (codec) {\n return codec;\n }\n }\n }\n\n return null;\n}\n\nexport function decodeRow(\n row: Record<string, unknown>,\n plan: ExecutionPlan,\n registry: CodecRegistry,\n): Record<string, unknown> {\n const decoded: Record<string, unknown> = {};\n\n let aliases: readonly string[];\n const projection = plan.meta.projection;\n if (projection && !Array.isArray(projection)) {\n aliases = Object.keys(projection);\n } else if (projection && Array.isArray(projection)) {\n aliases = projection;\n } else {\n aliases = Object.keys(row);\n }\n\n for (const alias of aliases) {\n const wireValue = row[alias];\n\n const projection = plan.meta.projection;\n const projectionValue =\n projection && typeof projection === 'object' && !Array.isArray(projection)\n ? (projection as Record<string, string>)[alias]\n : undefined;\n\n if (typeof projectionValue === 'string' && projectionValue.startsWith('include:')) {\n if (wireValue === null || wireValue === undefined) {\n decoded[alias] = [];\n continue;\n }\n\n try {\n let parsed: unknown;\n if (typeof wireValue === 'string') {\n parsed = JSON.parse(wireValue);\n } else if (Array.isArray(wireValue)) {\n parsed = wireValue;\n } else {\n parsed = JSON.parse(String(wireValue));\n }\n\n if (!Array.isArray(parsed)) {\n throw new Error(`Expected array for include alias '${alias}', got ${typeof parsed}`);\n }\n\n decoded[alias] = parsed;\n } catch (error) {\n const decodeError = new Error(\n `Failed to parse JSON array for include alias '${alias}': ${error instanceof Error ? error.message : String(error)}`,\n ) as Error & {\n code: string;\n category: string;\n severity: string;\n details?: Record<string, unknown>;\n };\n decodeError.code = 'RUNTIME.DECODE_FAILED';\n decodeError.category = 'RUNTIME';\n decodeError.severity = 'error';\n decodeError.details = {\n alias,\n wirePreview:\n typeof wireValue === 'string' && wireValue.length > 100\n ? `${wireValue.substring(0, 100)}...`\n : String(wireValue).substring(0, 100),\n };\n throw decodeError;\n }\n continue;\n }\n\n if (wireValue === null || wireValue === undefined) {\n decoded[alias] = wireValue;\n continue;\n }\n\n const codec = resolveRowCodec(alias, plan, registry);\n\n if (!codec) {\n decoded[alias] = wireValue;\n continue;\n }\n\n try {\n decoded[alias] = codec.decode(wireValue);\n } catch (error) {\n const decodeError = new Error(\n `Failed to decode row alias '${alias}' with codec '${codec.id}': ${error instanceof Error ? error.message : String(error)}`,\n ) as Error & {\n code: string;\n category: string;\n severity: string;\n details?: Record<string, unknown>;\n };\n decodeError.code = 'RUNTIME.DECODE_FAILED';\n decodeError.category = 'RUNTIME';\n decodeError.severity = 'error';\n decodeError.details = {\n alias,\n codec: codec.id,\n wirePreview:\n typeof wireValue === 'string' && wireValue.length > 100\n ? `${wireValue.substring(0, 100)}...`\n : String(wireValue).substring(0, 100),\n };\n throw decodeError;\n }\n }\n\n return decoded;\n}\n","import type { ExecutionPlan, ParamDescriptor } from '@prisma-next/contract/types';\nimport type { Codec, CodecRegistry } from '@prisma-next/sql-relational-core/ast';\n\nfunction resolveParamCodec(\n paramDescriptor: ParamDescriptor,\n plan: ExecutionPlan,\n registry: CodecRegistry,\n): Codec | null {\n const paramName = paramDescriptor.name ?? `param_${paramDescriptor.index ?? 0}`;\n\n const planCodecId = plan.meta.annotations?.codecs?.[paramName] as string | undefined;\n if (planCodecId) {\n const codec = registry.get(planCodecId);\n if (codec) {\n return codec;\n }\n }\n\n if (paramDescriptor.codecId) {\n const codec = registry.get(paramDescriptor.codecId);\n if (codec) {\n return codec;\n }\n }\n\n return null;\n}\n\nexport function encodeParam(\n value: unknown,\n paramDescriptor: ParamDescriptor,\n plan: ExecutionPlan,\n registry: CodecRegistry,\n): unknown {\n if (value === null || value === undefined) {\n return null;\n }\n\n const codec = resolveParamCodec(paramDescriptor, plan, registry);\n if (!codec) {\n return value;\n }\n\n if (codec.encode) {\n try {\n return codec.encode(value);\n } catch (error) {\n throw new Error(\n `Failed to encode parameter ${paramDescriptor.name ?? paramDescriptor.index}: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n }\n\n return value;\n}\n\nexport function encodeParams(plan: ExecutionPlan, registry: CodecRegistry): readonly unknown[] {\n if (plan.params.length === 0) {\n return plan.params;\n }\n\n const encoded: unknown[] = [];\n\n for (let i = 0; i < plan.params.length; i++) {\n const paramValue = plan.params[i];\n const paramDescriptor = plan.meta.paramDescriptors[i];\n\n if (paramDescriptor) {\n encoded.push(encodeParam(paramValue, paramDescriptor, plan, registry));\n } else {\n encoded.push(paramValue);\n }\n }\n\n return Object.freeze(encoded);\n}\n","import type { ExecutionPlan } from '@prisma-next/contract/types';\nimport type {\n MarkerReader,\n MarkerStatement,\n RuntimeFamilyAdapter,\n} from '@prisma-next/runtime-executor';\nimport { runtimeError } from '@prisma-next/runtime-executor';\nimport type { SqlContract, SqlStorage } from '@prisma-next/sql-contract/types';\nimport { readContractMarker } from './sql-marker';\n\nclass SqlMarkerReader implements MarkerReader {\n readMarkerStatement(): MarkerStatement {\n return readContractMarker();\n }\n}\n\nexport class SqlFamilyAdapter<TContract extends SqlContract<SqlStorage>>\n implements RuntimeFamilyAdapter<TContract>\n{\n readonly contract: TContract;\n readonly markerReader: MarkerReader;\n\n constructor(contract: TContract) {\n this.contract = contract;\n this.markerReader = new SqlMarkerReader();\n }\n\n validatePlan(plan: ExecutionPlan, contract: TContract): void {\n if (plan.meta.target !== contract.target) {\n throw runtimeError('PLAN.TARGET_MISMATCH', 'Plan target does not match runtime target', {\n planTarget: plan.meta.target,\n runtimeTarget: contract.target,\n });\n }\n\n if (plan.meta.coreHash !== contract.coreHash) {\n throw runtimeError('PLAN.HASH_MISMATCH', 'Plan core hash does not match runtime contract', {\n planCoreHash: plan.meta.coreHash,\n runtimeCoreHash: contract.coreHash,\n });\n }\n }\n}\n","export type {\n AfterExecuteResult,\n BudgetsOptions,\n LintsOptions,\n Log,\n Plugin,\n PluginContext,\n} from '@prisma-next/runtime-executor';\nexport { budgets, lints } from '@prisma-next/runtime-executor';\nexport {\n extractCodecIds,\n validateCodecRegistryCompleteness,\n validateContractCodecMappings,\n} from '../codecs/validation';\nexport { lowerSqlPlan } from '../lower-sql-plan';\nexport type {\n CreateRuntimeContextOptions,\n RuntimeContext,\n RuntimeParameterizedCodecDescriptor,\n SqlRuntimeAdapterInstance,\n SqlRuntimeExtensionDescriptor,\n SqlRuntimeExtensionInstance,\n TypeHelperRegistry,\n} from '../sql-context';\nexport { createRuntimeContext } from '../sql-context';\nexport type { SqlStatement } from '../sql-marker';\nexport {\n ensureSchemaStatement,\n ensureTableStatement,\n readContractMarker,\n writeContractMarker,\n} from '../sql-marker';\nexport type {\n Runtime,\n RuntimeOptions,\n RuntimeTelemetryEvent,\n RuntimeVerifyOptions,\n TelemetryOutcome,\n} from '../sql-runtime';\nexport { createRuntime } from '../sql-runtime';\n"],"mappings":";AAAA,SAAS,oBAAoB;AAItB,SAAS,gBAAgB,UAAgD;AAC9E,QAAM,WAAW,oBAAI,IAAY;AAEjC,aAAW,SAAS,OAAO,OAAO,SAAS,QAAQ,MAAM,GAAG;AAC1D,eAAW,UAAU,OAAO,OAAO,MAAM,OAAO,GAAG;AACjD,YAAM,UAAU,OAAO;AACvB,eAAS,IAAI,OAAO;AAAA,IACtB;AAAA,EACF;AAEA,SAAO;AACT;AAEA,SAAS,2BAA2B,UAAwD;AAC1F,QAAM,WAAW,oBAAI,IAAoB;AAEzC,aAAW,CAAC,WAAW,KAAK,KAAK,OAAO,QAAQ,SAAS,QAAQ,MAAM,GAAG;AACxE,eAAW,CAAC,YAAY,MAAM,KAAK,OAAO,QAAQ,MAAM,OAAO,GAAG;AAChE,YAAM,UAAU,OAAO;AACvB,YAAM,MAAM,GAAG,SAAS,IAAI,UAAU;AACtC,eAAS,IAAI,KAAK,OAAO;AAAA,IAC3B;AAAA,EACF;AAEA,SAAO;AACT;AAEO,SAAS,8BACd,UACA,UACM;AACN,QAAM,WAAW,2BAA2B,QAAQ;AACpD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,QAAQ,QAAQ;AACtE,WAAK,yBAAyB;AAAA,IAChC;AAAA,EACF;AAAA,EAEQ,6BAA6B,UAAyC;AAC5E,QAAI,CAAC,KAAK,wBAAwB;AAChC,wCAAkC,KAAK,eAAe,QAAQ;AAC9D,WAAK,yBAAyB;AAAA,IAChC;AAAA,EACF;AAAA,EAEA,QACE,MAC0B;AAC1B,SAAK,6BAA6B,KAAK,QAAQ;AAG/C,UAAM,iBAAiB,CAAC,MAAsE;AAC5F,aAAO,SAAS,KAAK,EAAE,SAAS;AAAA,IAClC;AAGA,UAAM,iBAAqC,eAAe,IAAI,IAC1D,aAAa,KAAK,SAAS,IAAI,IAC/B;AAEJ,UAAM,WAAW,iBACf,MACoC;AACpC,YAAM,gBAAgB,aAAa,gBAAgB,KAAK,aAAa;AACrE,YAAM,wBAA4C;AAAA,QAChD,GAAG;AAAA,QACH,QAAQ;AAAA,MACV;AAEA,YAAM,eAAe,KAAK,KAAK,QAAQ,qBAAqB;AAE5D,uBAAiB,UAAU,cAAc;AACvC,cAAM,aAAa;AAAA,UACjB;AAAA,UACA;AAAA,UACA,KAAK;AAAA,QACP;AACA,cAAM;AAAA,MACR;AAAA,IACF;AAEA,WAAO,IAAI,oBAAoB,SAAS,IAAI,CAAC;AAAA,EAC/C;AAAA,EAEA,YAA0C;AACxC,WAAO,KAAK,KAAK,UAAU;AAAA,EAC7B;AAAA,EAEA,aAAgC;AAC9B,WAAO,KAAK,KAAK,WAAW;AAAA,EAC9B;AAAA,EAEA,QAAuB;AACrB,WAAO,KAAK,KAAK,MAAM;AAAA,EACzB;AACF;AAEO,SAAS,cACd,SACS;AACT,SAAO,IAAI,eAAe,OAAO;AACnC;;;AI7JA,SAAS,SAAS,aAAa;","names":["projection","runtimeError","runtimeError"]}
@@ -1,70 +0,0 @@
1
- import type { SqlContract, SqlMappings, SqlStorage } from '@prisma-next/sql-contract/types';
2
- import { expectTypeOf, test } from 'vitest';
3
- import type { RuntimeContext, TypeHelperRegistry } from '../src/sql-context';
4
-
5
- // Contract type with storage.types using literal types (matching emission output)
6
- type TestContract = SqlContract<
7
- {
8
- readonly tables: {
9
- readonly document: {
10
- readonly columns: {
11
- readonly id: {
12
- readonly nativeType: 'int4';
13
- readonly codecId: 'pg/int4@1';
14
- nullable: false;
15
- };
16
- };
17
- readonly primaryKey: { readonly columns: readonly ['id'] };
18
- readonly uniques: readonly [];
19
- readonly indexes: readonly [];
20
- readonly foreignKeys: readonly [];
21
- };
22
- };
23
- readonly types: {
24
- readonly Vector1536: {
25
- readonly codecId: 'pg/vector@1';
26
- readonly nativeType: 'vector';
27
- readonly typeParams: { readonly length: 1536 };
28
- };
29
- };
30
- },
31
- Record<string, never>,
32
- Record<string, never>,
33
- SqlMappings
34
- >;
35
-
36
- test('RuntimeContext.types is TypeHelperRegistry', () => {
37
- // RuntimeContext.types is intentionally loose (Record<string, unknown>)
38
- // The strong typing comes from schema(context).types via ExtractSchemaTypes
39
- expectTypeOf<RuntimeContext<TestContract>['types']>().toEqualTypeOf<
40
- TypeHelperRegistry | undefined
41
- >();
42
-
43
- // TypeHelperRegistry allows any values - the actual type depends on init hooks
44
- expectTypeOf<TypeHelperRegistry>().toEqualTypeOf<Record<string, unknown>>();
45
- });
46
-
47
- test('RuntimeContext preserves contract type parameter', () => {
48
- // Verify the contract type is preserved in RuntimeContext
49
- expectTypeOf<RuntimeContext<TestContract>['contract']>().toEqualTypeOf<TestContract>();
50
-
51
- // Verify we can access storage.types through the context's contract
52
- type ContractStorageTypes = RuntimeContext<TestContract>['contract']['storage']['types'];
53
- expectTypeOf<ContractStorageTypes>().toMatchTypeOf<
54
- | {
55
- readonly Vector1536: {
56
- readonly codecId: 'pg/vector@1';
57
- readonly nativeType: 'vector';
58
- readonly typeParams: { readonly length: 1536 };
59
- };
60
- }
61
- | undefined
62
- >();
63
- });
64
-
65
- test('RuntimeContext accepts generic SqlContract', () => {
66
- // Verify RuntimeContext defaults work
67
- type DefaultContext = RuntimeContext;
68
- expectTypeOf<DefaultContext['contract']>().toMatchTypeOf<SqlContract<SqlStorage>>();
69
- expectTypeOf<DefaultContext['types']>().toEqualTypeOf<TypeHelperRegistry | undefined>();
70
- });