@prisma-next/sql-runtime 0.5.0-dev.8 → 0.5.0-dev.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +29 -21
- package/dist/{exports-Cssiepsb.mjs → exports-BOHa3Emo.mjs} +326 -60
- package/dist/exports-BOHa3Emo.mjs.map +1 -0
- package/dist/{index-yb51L_1h.d.mts → index-CZmC2kD3.d.mts} +53 -16
- package/dist/index-CZmC2kD3.d.mts.map +1 -0
- package/dist/index.d.mts +2 -2
- package/dist/index.mjs +1 -1
- package/dist/test/utils.d.mts +6 -5
- package/dist/test/utils.d.mts.map +1 -1
- package/dist/test/utils.mjs +1 -1
- package/dist/test/utils.mjs.map +1 -1
- package/package.json +9 -10
- package/src/codecs/decoding.ts +11 -7
- package/src/codecs/encoding.ts +3 -2
- package/src/exports/index.ts +10 -7
- package/src/fingerprint.ts +22 -0
- package/src/guardrails/raw.ts +214 -0
- package/src/lower-sql-plan.ts +3 -3
- package/src/marker.ts +82 -0
- package/src/middleware/budgets.ts +14 -11
- package/src/middleware/lints.ts +3 -3
- package/src/middleware/sql-middleware.ts +6 -5
- package/src/runtime-spi.ts +43 -0
- package/src/sql-family-adapter.ts +3 -2
- package/src/sql-marker.ts +1 -1
- package/src/sql-runtime.ts +272 -112
- package/dist/exports-Cssiepsb.mjs.map +0 -1
- package/dist/index-yb51L_1h.d.mts.map +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"exports-Cssiepsb.mjs","names":["invalidCodecs: Array<{ table: string; column: string; codecId: string }>","details: Record<string, unknown>","findings: LintFinding[]","arktype","helpers: TypeHelperRegistry","applied: AppliedMutationDefault[]","contributors: Array<SqlStaticContributions & ComponentDescriptor<string>>","options","ensureSchemaStatement: SqlStatement","ensureTableStatement: SqlStatement","baseParams: readonly unknown[]","codec","index: ColumnRefIndex","parsed: unknown","decoded: unknown","aliases: readonly string[]","tasks: Promise<unknown>[]","includeIndices: { index: number; alias: string; value: unknown }[]","decoded: Record<string, unknown>","codec","tasks: Promise<unknown>[]","meta: PlanMeta","descriptors: ParamDescriptor[]","planToLower: SqlQueryPlan<Row>","planWithEncodedParams: ExecutionPlan<Row>","runtimeError","txContext: TransactionContext","result: R"],"sources":["../src/codecs/validation.ts","../src/lower-sql-plan.ts","../src/middleware/budgets.ts","../src/middleware/lints.ts","../src/sql-context.ts","../src/sql-marker.ts","../src/codecs/json-schema-validation.ts","../src/codecs/decoding.ts","../src/codecs/encoding.ts","../src/middleware/before-compile-chain.ts","../src/sql-family-adapter.ts","../src/sql-runtime.ts"],"sourcesContent":["import type { Contract } from '@prisma-next/contract/types';\nimport { runtimeError } from '@prisma-next/framework-components/runtime';\nimport type { SqlStorage } from '@prisma-next/sql-contract/types';\nimport type { CodecRegistry } from '@prisma-next/sql-relational-core/ast';\n\nexport function extractCodecIds(contract: Contract<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: Contract<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: Contract<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: Contract<SqlStorage>,\n): void {\n validateContractCodecMappings(registry, contract);\n}\n","import type { Contract, ExecutionPlan } from '@prisma-next/contract/types';\nimport type { SqlStorage } from '@prisma-next/sql-contract/types';\nimport type { Adapter, AnyQueryAst, LoweredStatement } from '@prisma-next/sql-relational-core/ast';\nimport type { SqlQueryPlan } from '@prisma-next/sql-relational-core/plan';\n\n/**\n * Lowers a SQL query plan to an executable Plan by calling the adapter's lower method.\n *\n * @param adapter - Adapter to lower AST to SQL\n * @param contract - Contract for lowering context\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 adapter: Adapter<AnyQueryAst, Contract<SqlStorage>, LoweredStatement>,\n contract: Contract<SqlStorage>,\n queryPlan: SqlQueryPlan<Row>,\n): ExecutionPlan<Row> {\n const lowered = adapter.lower(queryPlan.ast, {\n contract,\n params: queryPlan.params,\n });\n\n return Object.freeze({\n sql: lowered.sql,\n params: lowered.params ?? queryPlan.params,\n ast: queryPlan.ast,\n meta: queryPlan.meta,\n });\n}\n","import type { ExecutionPlan } from '@prisma-next/contract/types';\nimport { type RuntimeErrorEnvelope, runtimeError } from '@prisma-next/framework-components/runtime';\nimport type { AfterExecuteResult } from '@prisma-next/runtime-executor';\nimport { isQueryAst, type SelectAst } from '@prisma-next/sql-relational-core/ast';\nimport type { SqlMiddleware, SqlMiddlewareContext } from './sql-middleware';\n\nexport interface BudgetsOptions {\n readonly maxRows?: number;\n readonly defaultTableRows?: number;\n readonly tableRows?: Record<string, number>;\n readonly maxLatencyMs?: number;\n readonly severities?: {\n readonly rowCount?: 'warn' | 'error';\n readonly latency?: 'warn' | 'error';\n };\n}\n\nfunction hasAggregateWithoutGroupBy(ast: SelectAst): boolean {\n if (ast.groupBy !== undefined) {\n return false;\n }\n return ast.projection.some((item) => item.expr.kind === 'aggregate');\n}\n\nfunction estimateRowsFromAst(\n ast: SelectAst,\n tableRows: Record<string, number>,\n defaultTableRows: number,\n refs: { tables?: readonly string[] } | undefined,\n hasAggregateWithoutGroup: boolean,\n): number | null {\n if (hasAggregateWithoutGroup) {\n return 1;\n }\n\n const table = refs?.tables?.[0];\n if (!table) {\n return null;\n }\n\n const tableEstimate = tableRows[table] ?? defaultTableRows;\n\n if (ast.limit !== undefined) {\n return Math.min(ast.limit, tableEstimate);\n }\n\n return tableEstimate;\n}\n\nfunction estimateRowsFromHeuristics(\n plan: ExecutionPlan,\n tableRows: Record<string, number>,\n defaultTableRows: number,\n): number | null {\n const table = plan.meta.refs?.tables?.[0];\n if (!table) {\n return null;\n }\n\n const tableEstimate = tableRows[table] ?? defaultTableRows;\n\n const limit = plan.meta.annotations?.['limit'];\n if (typeof limit === 'number') {\n return Math.min(limit, tableEstimate);\n }\n\n return tableEstimate;\n}\n\nfunction hasDetectableLimitFromHeuristics(plan: ExecutionPlan): boolean {\n return typeof plan.meta.annotations?.['limit'] === 'number';\n}\n\nfunction emitBudgetViolation(\n error: RuntimeErrorEnvelope,\n shouldBlock: boolean,\n ctx: SqlMiddlewareContext,\n): void {\n if (shouldBlock) {\n throw error;\n }\n ctx.log.warn({\n code: error.code,\n message: error.message,\n details: error.details,\n });\n}\n\nexport function budgets(options?: BudgetsOptions): SqlMiddleware {\n const maxRows = options?.maxRows ?? 10_000;\n const defaultTableRows = options?.defaultTableRows ?? 10_000;\n const tableRows = options?.tableRows ?? {};\n const maxLatencyMs = options?.maxLatencyMs ?? 1_000;\n const rowSeverity = options?.severities?.rowCount ?? 'error';\n\n const observedRowsByPlan = new WeakMap<ExecutionPlan, { count: number }>();\n\n return Object.freeze({\n name: 'budgets',\n familyId: 'sql' as const,\n\n async beforeExecute(plan: ExecutionPlan, ctx: SqlMiddlewareContext) {\n observedRowsByPlan.set(plan, { count: 0 });\n\n if (isQueryAst(plan.ast)) {\n if (plan.ast.kind === 'select') {\n return evaluateSelectAst(plan, plan.ast, ctx);\n }\n return;\n }\n\n return evaluateWithHeuristics(plan, ctx);\n },\n\n async onRow(_row: Record<string, unknown>, plan: ExecutionPlan, _ctx: SqlMiddlewareContext) {\n const state = observedRowsByPlan.get(plan);\n if (!state) return;\n state.count += 1;\n if (state.count > maxRows) {\n throw runtimeError('BUDGET.ROWS_EXCEEDED', 'Observed row count exceeds budget', {\n source: 'observed',\n observedRows: state.count,\n maxRows,\n });\n }\n },\n\n async afterExecute(\n _plan: ExecutionPlan,\n result: AfterExecuteResult,\n ctx: SqlMiddlewareContext,\n ) {\n const latencyMs = result.latencyMs;\n if (latencyMs > maxLatencyMs) {\n const shouldBlock = ctx.mode === 'strict';\n emitBudgetViolation(\n runtimeError('BUDGET.TIME_EXCEEDED', 'Query latency exceeds budget', {\n latencyMs,\n maxLatencyMs,\n }),\n shouldBlock,\n ctx,\n );\n }\n },\n });\n\n function evaluateSelectAst(plan: ExecutionPlan, ast: SelectAst, ctx: SqlMiddlewareContext) {\n const hasAggNoGroup = hasAggregateWithoutGroupBy(ast);\n const estimated = estimateRowsFromAst(\n ast,\n tableRows,\n defaultTableRows,\n plan.meta.refs,\n hasAggNoGroup,\n );\n const isUnbounded = ast.limit === undefined && !hasAggNoGroup;\n const shouldBlock = rowSeverity === 'error' || ctx.mode === 'strict';\n\n if (isUnbounded) {\n if (estimated !== null && estimated >= maxRows) {\n emitBudgetViolation(\n runtimeError('BUDGET.ROWS_EXCEEDED', 'Unbounded SELECT query exceeds budget', {\n source: 'ast',\n estimatedRows: estimated,\n maxRows,\n }),\n shouldBlock,\n ctx,\n );\n return;\n }\n\n emitBudgetViolation(\n runtimeError('BUDGET.ROWS_EXCEEDED', 'Unbounded SELECT query exceeds budget', {\n source: 'ast',\n maxRows,\n }),\n shouldBlock,\n ctx,\n );\n return;\n }\n\n if (estimated !== null && estimated > maxRows) {\n emitBudgetViolation(\n runtimeError('BUDGET.ROWS_EXCEEDED', 'Estimated row count exceeds budget', {\n source: 'ast',\n estimatedRows: estimated,\n maxRows,\n }),\n shouldBlock,\n ctx,\n );\n }\n }\n\n async function evaluateWithHeuristics(plan: ExecutionPlan, ctx: SqlMiddlewareContext) {\n const estimated = estimateRowsFromHeuristics(plan, tableRows, defaultTableRows);\n const isUnbounded = !hasDetectableLimitFromHeuristics(plan);\n const sqlUpper = plan.sql.trimStart().toUpperCase();\n const isSelect = sqlUpper.startsWith('SELECT');\n const shouldBlock = rowSeverity === 'error' || ctx.mode === 'strict';\n\n if (isSelect && isUnbounded) {\n if (estimated !== null && estimated >= maxRows) {\n emitBudgetViolation(\n runtimeError('BUDGET.ROWS_EXCEEDED', 'Unbounded SELECT query exceeds budget', {\n source: 'heuristic',\n estimatedRows: estimated,\n maxRows,\n }),\n shouldBlock,\n ctx,\n );\n return;\n }\n\n emitBudgetViolation(\n runtimeError('BUDGET.ROWS_EXCEEDED', 'Unbounded SELECT query exceeds budget', {\n source: 'heuristic',\n maxRows,\n }),\n shouldBlock,\n ctx,\n );\n return;\n }\n\n if (estimated !== null) {\n if (estimated > maxRows) {\n emitBudgetViolation(\n runtimeError('BUDGET.ROWS_EXCEEDED', 'Estimated row count exceeds budget', {\n source: 'heuristic',\n estimatedRows: estimated,\n maxRows,\n }),\n shouldBlock,\n ctx,\n );\n }\n return;\n }\n }\n}\n","import type { ExecutionPlan } from '@prisma-next/contract/types';\nimport { runtimeError } from '@prisma-next/framework-components/runtime';\nimport { evaluateRawGuardrails } from '@prisma-next/runtime-executor';\nimport {\n type AnyFromSource,\n type AnyQueryAst,\n isQueryAst,\n} from '@prisma-next/sql-relational-core/ast';\nimport { ifDefined } from '@prisma-next/utils/defined';\nimport type { SqlMiddleware, SqlMiddlewareContext } from './sql-middleware';\n\nexport interface LintsOptions {\n readonly severities?: {\n readonly selectStar?: 'warn' | 'error';\n readonly noLimit?: 'warn' | 'error';\n readonly deleteWithoutWhere?: 'warn' | 'error';\n readonly updateWithoutWhere?: 'warn' | 'error';\n readonly readOnlyMutation?: 'warn' | 'error';\n readonly unindexedPredicate?: 'warn' | 'error';\n };\n readonly fallbackWhenAstMissing?: 'raw' | 'skip';\n}\n\nexport interface LintFinding {\n readonly code: `LINT.${string}`;\n readonly severity: 'error' | 'warn';\n readonly message: string;\n readonly details?: Record<string, unknown>;\n}\n\nfunction getFromSourceTableDetail(source: AnyFromSource): string | undefined {\n switch (source.kind) {\n case 'table-source':\n return source.name;\n case 'derived-table-source':\n return source.alias;\n // v8 ignore next 4\n default:\n throw new Error(\n `Unsupported source kind: ${(source satisfies never as { kind: string }).kind}`,\n );\n }\n}\n\nfunction evaluateAstLints(ast: AnyQueryAst): LintFinding[] {\n const findings: LintFinding[] = [];\n\n switch (ast.kind) {\n case 'delete':\n if (ast.where === undefined) {\n findings.push({\n code: 'LINT.DELETE_WITHOUT_WHERE',\n severity: 'error',\n message:\n 'DELETE without WHERE clause blocks execution to prevent accidental full-table deletion',\n details: { table: ast.table.name },\n });\n }\n break;\n\n case 'update':\n if (ast.where === undefined) {\n findings.push({\n code: 'LINT.UPDATE_WITHOUT_WHERE',\n severity: 'error',\n message:\n 'UPDATE without WHERE clause blocks execution to prevent accidental full-table update',\n details: { table: ast.table.name },\n });\n }\n break;\n\n case 'select':\n if (ast.limit === undefined) {\n const table = getFromSourceTableDetail(ast.from);\n findings.push({\n code: 'LINT.NO_LIMIT',\n severity: 'warn',\n message: 'Unbounded SELECT may return large result sets',\n ...ifDefined('details', table !== undefined ? { table } : undefined),\n });\n }\n if (ast.selectAllIntent !== undefined) {\n const table = ast.selectAllIntent.table;\n findings.push({\n code: 'LINT.SELECT_STAR',\n severity: 'warn',\n message: 'Query selects all columns via selectAll intent',\n ...ifDefined('details', table !== undefined ? { table } : undefined),\n });\n }\n break;\n\n case 'insert':\n break;\n\n // v8 ignore next 2\n default:\n throw new Error(`Unsupported AST kind: ${(ast satisfies never as { kind: string }).kind}`);\n }\n\n return findings;\n}\n\nfunction getConfiguredSeverity(code: string, options?: LintsOptions): 'warn' | 'error' | undefined {\n const severities = options?.severities;\n if (!severities) return undefined;\n\n switch (code) {\n case 'LINT.SELECT_STAR':\n return severities.selectStar;\n case 'LINT.NO_LIMIT':\n return severities.noLimit;\n case 'LINT.DELETE_WITHOUT_WHERE':\n return severities.deleteWithoutWhere;\n case 'LINT.UPDATE_WITHOUT_WHERE':\n return severities.updateWithoutWhere;\n case 'LINT.READ_ONLY_MUTATION':\n return severities.readOnlyMutation;\n case 'LINT.UNINDEXED_PREDICATE':\n return severities.unindexedPredicate;\n default:\n return undefined;\n }\n}\n\n/**\n * AST-first lint middleware for SQL plans. When `plan.ast` is a SQL QueryAst, inspects\n * the AST structurally. When `plan.ast` is missing, falls back to raw heuristic\n * guardrails or skips linting depending on `fallbackWhenAstMissing`.\n *\n * Rules (AST-based):\n * - DELETE without WHERE: blocks execution (configurable severity, default error)\n * - UPDATE without WHERE: blocks execution (configurable severity, default error)\n * - Unbounded SELECT: warn/error (severity from noLimit)\n * - SELECT * intent: warn/error (severity from selectStar)\n *\n * Fallback: When ast is missing, `fallbackWhenAstMissing: 'raw'` uses heuristic\n * SQL parsing; `'skip'` skips all lints. Default is `'raw'`.\n */\nexport function lints(options?: LintsOptions): SqlMiddleware {\n const fallback = options?.fallbackWhenAstMissing ?? 'raw';\n\n return Object.freeze({\n name: 'lints',\n familyId: 'sql' as const,\n\n async beforeExecute(plan: ExecutionPlan, ctx: SqlMiddlewareContext) {\n if (isQueryAst(plan.ast)) {\n const findings = evaluateAstLints(plan.ast);\n\n for (const lint of findings) {\n const configuredSeverity = getConfiguredSeverity(lint.code, options);\n const effectiveSeverity = configuredSeverity ?? lint.severity;\n\n if (effectiveSeverity === 'error') {\n throw runtimeError(lint.code, lint.message, lint.details);\n }\n if (effectiveSeverity === 'warn') {\n ctx.log.warn({\n code: lint.code,\n message: lint.message,\n details: lint.details,\n });\n }\n }\n return;\n }\n\n if (fallback === 'skip') {\n return;\n }\n\n const evaluation = evaluateRawGuardrails(plan);\n for (const lint of evaluation.lints) {\n const configuredSeverity = getConfiguredSeverity(lint.code, options);\n const effectiveSeverity = configuredSeverity ?? lint.severity;\n\n if (effectiveSeverity === 'error') {\n throw runtimeError(lint.code, lint.message, lint.details);\n }\n if (effectiveSeverity === 'warn') {\n ctx.log.warn({\n code: lint.code,\n message: lint.message,\n details: lint.details,\n });\n }\n }\n },\n });\n}\n","import type { Contract, ExecutionMutationDefaultValue } from '@prisma-next/contract/types';\nimport type { ComponentDescriptor } from '@prisma-next/framework-components/components';\nimport { checkContractComponentRequirements } from '@prisma-next/framework-components/components';\nimport {\n createExecutionStack,\n type ExecutionStack,\n type RuntimeAdapterDescriptor,\n type RuntimeAdapterInstance,\n type RuntimeDriverDescriptor,\n type RuntimeDriverInstance,\n type RuntimeExtensionDescriptor,\n type RuntimeExtensionInstance,\n type RuntimeTargetDescriptor,\n type RuntimeTargetInstance,\n} from '@prisma-next/framework-components/execution';\nimport { runtimeError } from '@prisma-next/framework-components/runtime';\nimport type { SqlStorage, StorageTypeInstance } from '@prisma-next/sql-contract/types';\nimport {\n createSqlOperationRegistry,\n type SqlOperationDescriptor,\n} from '@prisma-next/sql-operations';\nimport type {\n Adapter,\n AnyQueryAst,\n CodecParamsDescriptor,\n CodecRegistry,\n LoweredStatement,\n SqlDriver,\n} from '@prisma-next/sql-relational-core/ast';\nimport { createCodecRegistry } from '@prisma-next/sql-relational-core/ast';\nimport type {\n AppliedMutationDefault,\n ExecutionContext,\n JsonSchemaValidateFn,\n JsonSchemaValidatorRegistry,\n MutationDefaultsOptions,\n TypeHelperRegistry,\n} from '@prisma-next/sql-relational-core/query-lane-context';\nimport { type as arktype } from 'arktype';\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 *\n * This is a type alias for `CodecParamsDescriptor` from the AST layer,\n * which is the shared definition used by both adapter and runtime.\n */\nexport type RuntimeParameterizedCodecDescriptor<\n TParams = Record<string, unknown>,\n THelper = unknown,\n> = CodecParamsDescriptor<TParams, THelper>;\n\nexport interface SqlStaticContributions {\n readonly codecs: () => CodecRegistry;\n // biome-ignore lint/suspicious/noExplicitAny: needed for covariance with concrete descriptor types\n readonly parameterizedCodecs: () => ReadonlyArray<RuntimeParameterizedCodecDescriptor<any, any>>;\n readonly queryOperations?: () => ReadonlyArray<SqlOperationDescriptor>;\n readonly mutationDefaultGenerators?: () => ReadonlyArray<RuntimeMutationDefaultGenerator>;\n}\n\nexport interface RuntimeMutationDefaultGenerator {\n readonly id: string;\n readonly generate: (params?: Record<string, unknown>) => unknown;\n}\n\nexport interface SqlRuntimeTargetDescriptor<\n TTargetId extends string = string,\n TTargetInstance extends RuntimeTargetInstance<'sql', TTargetId> = RuntimeTargetInstance<\n 'sql',\n TTargetId\n >,\n> extends RuntimeTargetDescriptor<'sql', TTargetId, TTargetInstance>,\n SqlStaticContributions {}\n\nexport interface SqlRuntimeAdapterDescriptor<\n TTargetId extends string = string,\n TAdapterInstance extends RuntimeAdapterInstance<\n 'sql',\n TTargetId\n > = SqlRuntimeAdapterInstance<TTargetId>,\n> extends RuntimeAdapterDescriptor<'sql', TTargetId, TAdapterInstance>,\n SqlStaticContributions {}\n\nexport interface SqlRuntimeExtensionDescriptor<TTargetId extends string = string>\n extends RuntimeExtensionDescriptor<'sql', TTargetId, SqlRuntimeExtensionInstance<TTargetId>>,\n SqlStaticContributions {\n create(): SqlRuntimeExtensionInstance<TTargetId>;\n}\n\nexport interface SqlExecutionStack<TTargetId extends string = string> {\n readonly target: SqlRuntimeTargetDescriptor<TTargetId>;\n readonly adapter: SqlRuntimeAdapterDescriptor<TTargetId>;\n readonly extensionPacks: readonly SqlRuntimeExtensionDescriptor<TTargetId>[];\n}\n\nexport type SqlExecutionStackWithDriver<TTargetId extends string = string> = Omit<\n ExecutionStack<\n 'sql',\n TTargetId,\n SqlRuntimeAdapterInstance<TTargetId>,\n SqlRuntimeDriverInstance<TTargetId>,\n SqlRuntimeExtensionInstance<TTargetId>\n >,\n 'target' | 'adapter' | 'driver' | 'extensionPacks'\n> & {\n readonly target: SqlRuntimeTargetDescriptor<TTargetId>;\n readonly adapter: SqlRuntimeAdapterDescriptor<TTargetId, SqlRuntimeAdapterInstance<TTargetId>>;\n readonly driver:\n | RuntimeDriverDescriptor<'sql', TTargetId, unknown, SqlRuntimeDriverInstance<TTargetId>>\n | undefined;\n readonly extensionPacks: readonly SqlRuntimeExtensionDescriptor<TTargetId>[];\n};\n\nexport interface SqlRuntimeExtensionInstance<TTargetId extends string>\n extends RuntimeExtensionInstance<'sql', TTargetId> {}\n\nexport type SqlRuntimeAdapterInstance<TTargetId extends string = string> = RuntimeAdapterInstance<\n 'sql',\n TTargetId\n> &\n Adapter<AnyQueryAst, Contract<SqlStorage>, LoweredStatement>;\n\n/**\n * NOTE: Binding type is intentionally erased to unknown at this shared runtime layer.\n * Target clients (for example `postgres()`) validate and construct the concrete binding\n * before calling `driver.connect(binding)`, which keeps runtime behavior safe today.\n * A future follow-up can preserve TBinding through stack/context generics end-to-end.\n */\nexport type SqlRuntimeDriverInstance<TTargetId extends string = string> = RuntimeDriverInstance<\n 'sql',\n TTargetId\n> &\n SqlDriver<unknown>;\n\nexport function createSqlExecutionStack<TTargetId extends string>(options: {\n readonly target: SqlRuntimeTargetDescriptor<TTargetId>;\n readonly adapter: SqlRuntimeAdapterDescriptor<TTargetId>;\n readonly driver?:\n | RuntimeDriverDescriptor<'sql', TTargetId, unknown, SqlRuntimeDriverInstance<TTargetId>>\n | undefined;\n readonly extensionPacks?: readonly SqlRuntimeExtensionDescriptor<TTargetId>[] | undefined;\n}): SqlExecutionStackWithDriver<TTargetId> {\n return createExecutionStack({\n target: options.target,\n adapter: options.adapter,\n driver: options.driver,\n extensionPacks: options.extensionPacks,\n });\n}\n\nexport type { ExecutionContext, JsonSchemaValidatorRegistry, TypeHelperRegistry };\n\nexport function assertExecutionStackContractRequirements(\n contract: Contract<SqlStorage>,\n stack: SqlExecutionStack,\n): void {\n const providedComponentIds = new Set<string>([\n stack.target.id,\n stack.adapter.id,\n ...stack.extensionPacks.map((pack) => pack.id),\n ]);\n\n const result = checkContractComponentRequirements({\n contract,\n expectedTargetFamily: 'sql',\n expectedTargetId: stack.target.targetId,\n providedComponentIds,\n });\n\n if (result.familyMismatch) {\n throw runtimeError(\n 'RUNTIME.CONTRACT_FAMILY_MISMATCH',\n `Contract target family '${result.familyMismatch.actual}' does not match runtime family '${result.familyMismatch.expected}'.`,\n {\n actual: result.familyMismatch.actual,\n expected: result.familyMismatch.expected,\n },\n );\n }\n\n if (result.targetMismatch) {\n throw runtimeError(\n 'RUNTIME.CONTRACT_TARGET_MISMATCH',\n `Contract target '${result.targetMismatch.actual}' does not match runtime target descriptor '${result.targetMismatch.expected}'.`,\n {\n actual: result.targetMismatch.actual,\n expected: result.targetMismatch.expected,\n },\n );\n }\n\n if (result.missingExtensionPackIds.length > 0) {\n const packIds = result.missingExtensionPackIds;\n const packList = packIds.map((id) => `'${id}'`).join(', ');\n throw runtimeError(\n 'RUNTIME.MISSING_EXTENSION_PACK',\n `Contract requires extension pack(s) ${packList}, but runtime descriptors do not provide matching component(s).`,\n { packIds },\n );\n }\n}\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 runtimeError(\n 'RUNTIME.TYPE_PARAMS_INVALID',\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\nfunction collectParameterizedCodecDescriptors(\n contributors: ReadonlyArray<SqlStaticContributions>,\n): Map<string, RuntimeParameterizedCodecDescriptor> {\n const descriptors = new Map<string, RuntimeParameterizedCodecDescriptor>();\n\n for (const contributor of contributors) {\n for (const descriptor of contributor.parameterizedCodecs()) {\n if (descriptors.has(descriptor.codecId)) {\n throw runtimeError(\n 'RUNTIME.DUPLICATE_PARAMETERIZED_CODEC',\n `Duplicate parameterized codec descriptor for codecId '${descriptor.codecId}'.`,\n { codecId: descriptor.codecId },\n );\n }\n descriptors.set(descriptor.codecId, descriptor);\n }\n }\n\n return descriptors;\n}\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 const validatedParams = validateTypeParams(typeInstance.typeParams, descriptor, {\n typeName,\n });\n\n if (descriptor.init) {\n helpers[typeName] = descriptor.init(validatedParams);\n } else {\n helpers[typeName] = typeInstance;\n }\n } else {\n helpers[typeName] = typeInstance;\n }\n }\n\n return helpers;\n}\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 * Builds a registry of compiled JSON Schema validators by scanning the contract\n * for columns whose codec descriptor provides an `init` hook returning `{ validate }`.\n *\n * Handles both:\n * - Inline `typeParams.schema` on columns\n * - `typeRef` → `storage.types[ref]` with init hook results already in `types` registry\n */\nfunction buildJsonSchemaValidatorRegistry(\n contract: Contract<SqlStorage>,\n types: TypeHelperRegistry,\n codecDescriptors: Map<string, RuntimeParameterizedCodecDescriptor>,\n): JsonSchemaValidatorRegistry | undefined {\n const validators = new Map<string, JsonSchemaValidateFn>();\n\n // Collect codec IDs that have init hooks (these produce { validate } helpers)\n const codecIdsWithInit = new Set<string>();\n for (const [codecId, descriptor] of codecDescriptors) {\n if (descriptor.init) {\n codecIdsWithInit.add(codecId);\n }\n }\n\n if (codecIdsWithInit.size === 0) {\n return undefined;\n }\n\n for (const [tableName, table] of Object.entries(contract.storage.tables)) {\n for (const [columnName, column] of Object.entries(table.columns)) {\n if (!codecIdsWithInit.has(column.codecId)) continue;\n\n const key = `${tableName}.${columnName}`;\n\n // Case 1: column references a named type → validator already compiled via init hook\n if (column.typeRef) {\n const helper = types[column.typeRef] as { validate?: JsonSchemaValidateFn } | undefined;\n if (helper?.validate) {\n validators.set(key, helper.validate);\n }\n continue;\n }\n\n // Case 2: inline typeParams with schema → compile via init hook\n if (column.typeParams) {\n const descriptor = codecDescriptors.get(column.codecId);\n if (descriptor?.init) {\n const helper = descriptor.init(column.typeParams) as\n | { validate?: JsonSchemaValidateFn }\n | undefined;\n if (helper?.validate) {\n validators.set(key, helper.validate);\n }\n }\n }\n }\n }\n\n if (validators.size === 0) return undefined;\n return {\n get: (key: string) => validators.get(key),\n size: validators.size,\n };\n}\n\nfunction collectMutationDefaultGenerators(\n contributors: ReadonlyArray<SqlStaticContributions & { readonly id: string }>,\n): ReadonlyMap<string, RuntimeMutationDefaultGenerator> {\n const generators = new Map<string, RuntimeMutationDefaultGenerator>();\n const owners = new Map<string, string>();\n\n for (const contributor of contributors) {\n const nextGenerators = contributor.mutationDefaultGenerators?.() ?? [];\n for (const generator of nextGenerators) {\n const existingOwner = owners.get(generator.id);\n if (existingOwner !== undefined) {\n throw runtimeError(\n 'RUNTIME.DUPLICATE_MUTATION_DEFAULT_GENERATOR',\n `Duplicate mutation default generator '${generator.id}'.`,\n {\n id: generator.id,\n existingOwner,\n incomingOwner: contributor.id,\n },\n );\n }\n generators.set(generator.id, generator);\n owners.set(generator.id, contributor.id);\n }\n }\n\n return generators;\n}\n\nfunction computeExecutionDefaultValue(\n spec: ExecutionMutationDefaultValue,\n generatorRegistry: ReadonlyMap<string, RuntimeMutationDefaultGenerator>,\n): unknown {\n switch (spec.kind) {\n case 'generator': {\n const generator = generatorRegistry.get(spec.id);\n if (!generator) {\n throw runtimeError(\n 'RUNTIME.MUTATION_DEFAULT_GENERATOR_MISSING',\n `Contract references mutation default generator '${spec.id}' but no runtime component provides it.`,\n {\n id: spec.id,\n },\n );\n }\n // nosemgrep: javascript.express.security.express-wkhtml-injection.express-wkhtmltoimage-injection\n return generator.generate(spec.params);\n }\n }\n}\n\nfunction applyMutationDefaults(\n contract: Contract<SqlStorage>,\n generatorRegistry: ReadonlyMap<string, RuntimeMutationDefaultGenerator>,\n options: MutationDefaultsOptions,\n): ReadonlyArray<AppliedMutationDefault> {\n const defaults = contract.execution?.mutations.defaults ?? [];\n if (defaults.length === 0) {\n return [];\n }\n\n const applied: AppliedMutationDefault[] = [];\n const appliedColumns = new Set<string>();\n\n for (const mutationDefault of defaults) {\n if (mutationDefault.ref.table !== options.table) {\n continue;\n }\n\n const defaultSpec =\n options.op === 'create' ? mutationDefault.onCreate : mutationDefault.onUpdate;\n if (!defaultSpec) {\n continue;\n }\n\n const columnName = mutationDefault.ref.column;\n if (Object.hasOwn(options.values, columnName) || appliedColumns.has(columnName)) {\n continue;\n }\n\n applied.push({\n column: columnName,\n value: computeExecutionDefaultValue(defaultSpec, generatorRegistry),\n });\n appliedColumns.add(columnName);\n }\n\n return applied;\n}\n\nexport function createExecutionContext<\n TContract extends Contract<SqlStorage> = Contract<SqlStorage>,\n TTargetId extends string = string,\n>(options: {\n readonly contract: TContract;\n readonly stack: SqlExecutionStack<TTargetId>;\n}): ExecutionContext<TContract> {\n const { contract, stack } = options;\n\n assertExecutionStackContractRequirements(contract, stack);\n\n const codecRegistry = createCodecRegistry();\n\n const contributors: Array<SqlStaticContributions & ComponentDescriptor<string>> = [\n stack.target,\n stack.adapter,\n ...stack.extensionPacks,\n ];\n\n for (const contributor of contributors) {\n for (const c of contributor.codecs().values()) {\n codecRegistry.register(c);\n }\n }\n\n const queryOperationRegistry = createSqlOperationRegistry();\n for (const contributor of contributors) {\n for (const op of contributor.queryOperations?.() ?? []) {\n queryOperationRegistry.register(op);\n }\n }\n\n const parameterizedCodecDescriptors = collectParameterizedCodecDescriptors(contributors);\n const mutationDefaultGeneratorRegistry = collectMutationDefaultGenerators(contributors);\n\n if (parameterizedCodecDescriptors.size > 0) {\n validateColumnTypeParams(contract.storage, parameterizedCodecDescriptors);\n }\n\n const types = initializeTypeHelpers(contract.storage.types, parameterizedCodecDescriptors);\n\n const jsonSchemaValidators = buildJsonSchemaValidatorRegistry(\n contract,\n types,\n parameterizedCodecDescriptors,\n );\n\n return {\n contract,\n codecs: codecRegistry,\n queryOperations: queryOperationRegistry,\n types,\n ...(jsonSchemaValidators ? { jsonSchemaValidators } : {}),\n applyMutationDefaults: (options) =>\n applyMutationDefaults(contract, mutationDefaultGeneratorRegistry, options),\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 storageHash: 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.storageHash,\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 { runtimeError } from '@prisma-next/framework-components/runtime';\nimport type {\n JsonSchemaValidationError,\n JsonSchemaValidatorRegistry,\n} from '@prisma-next/sql-relational-core/query-lane-context';\n\n/**\n * Validates a JSON value against its column's JSON Schema, if a validator exists.\n *\n * Throws `RUNTIME.JSON_SCHEMA_VALIDATION_FAILED` on validation failure.\n * No-ops if no validator is registered for the column.\n */\nexport function validateJsonValue(\n registry: JsonSchemaValidatorRegistry,\n table: string,\n column: string,\n value: unknown,\n direction: 'encode' | 'decode',\n codecId?: string,\n): void {\n const key = `${table}.${column}`;\n const validate = registry.get(key);\n if (!validate) return;\n\n const result = validate(value);\n if (result.valid) return;\n\n throw createJsonSchemaValidationError(table, column, direction, result.errors, codecId);\n}\n\nfunction createJsonSchemaValidationError(\n table: string,\n column: string,\n direction: 'encode' | 'decode',\n errors: ReadonlyArray<JsonSchemaValidationError>,\n codecId?: string,\n): Error {\n const summary = formatErrorSummary(errors);\n return runtimeError(\n 'RUNTIME.JSON_SCHEMA_VALIDATION_FAILED',\n `JSON schema validation failed for column '${table}.${column}' (${direction}): ${summary}`,\n {\n table,\n column,\n codecId,\n direction,\n errors: [...errors],\n },\n );\n}\n\nfunction formatErrorSummary(errors: ReadonlyArray<JsonSchemaValidationError>): string {\n if (errors.length === 0) return 'unknown validation error';\n if (errors.length === 1) {\n const err = errors[0] as JsonSchemaValidationError;\n return err.path === '/' ? err.message : `${err.path}: ${err.message}`;\n }\n return errors\n .map((err) => (err.path === '/' ? err.message : `${err.path}: ${err.message}`))\n .join('; ');\n}\n","import type { ExecutionPlan } from '@prisma-next/contract/types';\nimport { isRuntimeError, runtimeError } from '@prisma-next/framework-components/runtime';\nimport type { Codec, CodecRegistry } from '@prisma-next/sql-relational-core/ast';\nimport type { JsonSchemaValidatorRegistry } from '@prisma-next/sql-relational-core/query-lane-context';\nimport { validateJsonValue } from './json-schema-validation';\n\ntype ColumnRef = { table: string; column: string };\ntype ColumnRefIndex = Map<string, ColumnRef>;\n\nconst WIRE_PREVIEW_LIMIT = 100;\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\nfunction buildColumnRefIndex(plan: ExecutionPlan): ColumnRefIndex | null {\n const columns = plan.meta.refs?.columns;\n if (!columns) return null;\n\n const index: ColumnRefIndex = new Map();\n for (const ref of columns) {\n index.set(ref.column, ref);\n }\n return index;\n}\n\nfunction parseProjectionRef(value: string): ColumnRef | null {\n if (value.startsWith('include:') || value.startsWith('operation:')) {\n return null;\n }\n\n const separatorIndex = value.indexOf('.');\n if (separatorIndex <= 0 || separatorIndex === value.length - 1) {\n return null;\n }\n\n return {\n table: value.slice(0, separatorIndex),\n column: value.slice(separatorIndex + 1),\n };\n}\n\nfunction resolveColumnRefForAlias(\n alias: string,\n projection: ExecutionPlan['meta']['projection'],\n fallbackColumnRefIndex: ColumnRefIndex | null,\n): ColumnRef | undefined {\n if (projection && !Array.isArray(projection)) {\n const mappedRef = (projection as Record<string, string>)[alias];\n if (typeof mappedRef !== 'string') {\n return undefined;\n }\n return parseProjectionRef(mappedRef) ?? undefined;\n }\n\n return fallbackColumnRefIndex?.get(alias);\n}\n\nfunction previewWireValue(wireValue: unknown): string {\n if (typeof wireValue === 'string') {\n return wireValue.length > WIRE_PREVIEW_LIMIT\n ? `${wireValue.substring(0, WIRE_PREVIEW_LIMIT)}...`\n : wireValue;\n }\n return String(wireValue).substring(0, WIRE_PREVIEW_LIMIT);\n}\n\nfunction isJsonSchemaValidationError(error: unknown): boolean {\n return isRuntimeError(error) && error.code === 'RUNTIME.JSON_SCHEMA_VALIDATION_FAILED';\n}\n\nfunction wrapDecodeFailure(\n error: unknown,\n alias: string,\n ref: ColumnRef | undefined,\n codec: Codec,\n wireValue: unknown,\n): never {\n const message = error instanceof Error ? error.message : String(error);\n const target = ref ? `${ref.table}.${ref.column}` : alias;\n const wrapped = runtimeError(\n 'RUNTIME.DECODE_FAILED',\n `Failed to decode column ${target} with codec '${codec.id}': ${message}`,\n {\n ...(ref ? { table: ref.table, column: ref.column } : { alias }),\n codec: codec.id,\n wirePreview: previewWireValue(wireValue),\n },\n );\n wrapped.cause = error;\n throw wrapped;\n}\n\nfunction wrapIncludeAggregateFailure(error: unknown, alias: string, wireValue: unknown): never {\n const message = error instanceof Error ? error.message : String(error);\n const wrapped = runtimeError(\n 'RUNTIME.DECODE_FAILED',\n `Failed to parse JSON array for include alias '${alias}': ${message}`,\n {\n alias,\n wirePreview: previewWireValue(wireValue),\n },\n );\n wrapped.cause = error;\n throw wrapped;\n}\n\nfunction decodeIncludeAggregate(alias: string, wireValue: unknown): unknown {\n if (wireValue === null || wireValue === undefined) {\n return [];\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 return parsed;\n } catch (error) {\n wrapIncludeAggregateFailure(error, alias, wireValue);\n }\n}\n\n/**\n * Decodes a single field. Single-armed: every cell takes the same path —\n * `codec.decode → await → JSON-Schema validate → return plain value` — so\n * sync- and async-authored codecs are indistinguishable to callers.\n */\nasync function decodeField(\n alias: string,\n wireValue: unknown,\n plan: ExecutionPlan,\n registry: CodecRegistry,\n jsonValidators: JsonSchemaValidatorRegistry | undefined,\n projection: ExecutionPlan['meta']['projection'],\n fallbackColumnRefIndex: ColumnRefIndex | null,\n): Promise<unknown> {\n if (wireValue === null || wireValue === undefined) {\n return wireValue;\n }\n\n const codec = resolveRowCodec(alias, plan, registry);\n if (!codec) {\n return wireValue;\n }\n\n const ref = resolveColumnRefForAlias(alias, projection, fallbackColumnRefIndex);\n\n let decoded: unknown;\n try {\n decoded = await codec.decode(wireValue);\n } catch (error) {\n wrapDecodeFailure(error, alias, ref, codec, wireValue);\n }\n\n if (jsonValidators && ref) {\n try {\n validateJsonValue(jsonValidators, ref.table, ref.column, decoded, 'decode', codec.id);\n } catch (error) {\n if (isJsonSchemaValidationError(error)) throw error;\n wrapDecodeFailure(error, alias, ref, codec, wireValue);\n }\n }\n\n return decoded;\n}\n\n/**\n * Decodes a row by dispatching all per-cell codec calls concurrently via\n * `Promise.all`. Each cell follows the single-armed `decodeField` path.\n * Failures are wrapped in `RUNTIME.DECODE_FAILED` with `{ table, column,\n * codec }` (or `{ alias, codec }` when no column ref is resolvable) and the\n * original error attached on `cause`.\n */\nexport async function decodeRow(\n row: Record<string, unknown>,\n plan: ExecutionPlan,\n registry: CodecRegistry,\n jsonValidators?: JsonSchemaValidatorRegistry,\n): Promise<Record<string, unknown>> {\n const projection = plan.meta.projection;\n\n // Build a column-ref index when the projection alias-to-ref mapping is\n // unavailable so that decode failures and JSON-Schema validation can both\n // surface { table, column } from `meta.refs.columns` when present.\n const fallbackColumnRefIndex =\n !projection || Array.isArray(projection) ? buildColumnRefIndex(plan) : null;\n\n let aliases: readonly string[];\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 const tasks: Promise<unknown>[] = [];\n const includeIndices: { index: number; alias: string; value: unknown }[] = [];\n\n for (let i = 0; i < aliases.length; i++) {\n const alias = aliases[i] as string;\n const wireValue = row[alias];\n\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 includeIndices.push({ index: i, alias, value: wireValue });\n tasks.push(Promise.resolve(undefined));\n continue;\n }\n\n tasks.push(\n decodeField(\n alias,\n wireValue,\n plan,\n registry,\n jsonValidators,\n projection,\n fallbackColumnRefIndex,\n ),\n );\n }\n\n const settled = await Promise.all(tasks);\n\n // Include aggregates are decoded synchronously after concurrent codec\n // dispatch settles, so any decode failures upstream propagate first.\n for (const entry of includeIndices) {\n settled[entry.index] = decodeIncludeAggregate(entry.alias, entry.value);\n }\n\n const decoded: Record<string, unknown> = {};\n for (let i = 0; i < aliases.length; i++) {\n decoded[aliases[i] as string] = settled[i];\n }\n return decoded;\n}\n","import type { ExecutionPlan, ParamDescriptor } from '@prisma-next/contract/types';\nimport { runtimeError } from '@prisma-next/framework-components/runtime';\nimport type { Codec, CodecRegistry } from '@prisma-next/sql-relational-core/ast';\n\nfunction resolveParamCodec(\n paramDescriptor: ParamDescriptor,\n registry: CodecRegistry,\n): Codec | null {\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\nfunction paramLabel(paramDescriptor: ParamDescriptor, paramIndex: number): string {\n return paramDescriptor.name ?? `param[${paramIndex}]`;\n}\n\nfunction wrapEncodeFailure(\n error: unknown,\n paramDescriptor: ParamDescriptor,\n paramIndex: number,\n codecId: string,\n): never {\n const label = paramLabel(paramDescriptor, paramIndex);\n const message = error instanceof Error ? error.message : String(error);\n const wrapped = runtimeError(\n 'RUNTIME.ENCODE_FAILED',\n `Failed to encode parameter ${label} with codec '${codecId}': ${message}`,\n { label, codec: codecId, paramIndex },\n );\n wrapped.cause = error;\n throw wrapped;\n}\n\n/**\n * Encodes a single parameter through its codec. Always awaits codec.encode so\n * a Promise can never leak into the driver, even if a sync-authored codec is\n * lifted to async by the codec() factory. Failures are wrapped in\n * `RUNTIME.ENCODE_FAILED` with `{ label, codec, paramIndex }` and the original\n * error attached on `cause`.\n */\nexport async function encodeParam(\n value: unknown,\n paramDescriptor: ParamDescriptor,\n paramIndex: number,\n registry: CodecRegistry,\n): Promise<unknown> {\n if (value === null || value === undefined) {\n return null;\n }\n\n const codec = resolveParamCodec(paramDescriptor, registry);\n if (!codec) {\n return value;\n }\n\n try {\n return await codec.encode(value);\n } catch (error) {\n wrapEncodeFailure(error, paramDescriptor, paramIndex, codec.id);\n }\n}\n\n/**\n * Encodes all parameters concurrently via `Promise.all`. Per parameter, sync-\n * and async-authored codecs share the same path: `codec.encode → await →\n * return`. Param-level failures are wrapped in `RUNTIME.ENCODE_FAILED`.\n */\nexport async function encodeParams(\n plan: ExecutionPlan,\n registry: CodecRegistry,\n): Promise<readonly unknown[]> {\n if (plan.params.length === 0) {\n return plan.params;\n }\n\n const descriptorCount = plan.meta.paramDescriptors.length;\n const paramCount = plan.params.length;\n\n const tasks: Promise<unknown>[] = new Array(paramCount);\n for (let i = 0; i < paramCount; i++) {\n const paramValue = plan.params[i];\n const paramDescriptor = plan.meta.paramDescriptors[i];\n\n if (!paramDescriptor) {\n throw runtimeError(\n 'RUNTIME.MISSING_PARAM_DESCRIPTOR',\n `Missing paramDescriptor for parameter at index ${i} (plan has ${paramCount} params, ${descriptorCount} descriptors). The planner must emit one descriptor per param; this is a contract violation.`,\n { paramIndex: i, paramCount, descriptorCount },\n );\n }\n\n tasks[i] = encodeParam(paramValue, paramDescriptor, i, registry);\n }\n\n const encoded = await Promise.all(tasks);\n return Object.freeze(encoded);\n}\n","import type { ParamDescriptor, PlanMeta } from '@prisma-next/contract/types';\nimport type { AnyQueryAst } from '@prisma-next/sql-relational-core/ast';\nimport type { DraftPlan, SqlMiddleware, SqlMiddlewareContext } from './sql-middleware';\n\nexport async function runBeforeCompileChain(\n middleware: readonly SqlMiddleware[],\n initial: DraftPlan,\n ctx: SqlMiddlewareContext,\n): Promise<DraftPlan> {\n let current = initial;\n for (const mw of middleware) {\n if (!mw.beforeCompile) {\n continue;\n }\n const result = await mw.beforeCompile(current, ctx);\n if (result === undefined) {\n continue;\n }\n if (result.ast === current.ast) {\n continue;\n }\n ctx.log.debug?.({\n event: 'middleware.rewrite',\n middleware: mw.name,\n lane: current.meta.lane,\n });\n current = result;\n }\n\n if (current.ast === initial.ast) {\n return current;\n }\n\n // The rewritten AST may have introduced, removed, or replaced ParamRefs, so\n // the descriptors collected at lane build time no longer line up with what\n // the adapter will emit when it walks the new AST. Re-derive descriptors\n // from the rewritten AST so `params` and `paramDescriptors` stay in lockstep\n // by the time `encodeParams` runs.\n const paramDescriptors = deriveParamDescriptorsFromAst(current.ast);\n const meta: PlanMeta = { ...current.meta, paramDescriptors };\n return { ast: current.ast, meta };\n}\n\nfunction deriveParamDescriptorsFromAst(ast: AnyQueryAst): ReadonlyArray<ParamDescriptor> {\n const refs = ast.collectParamRefs();\n const seen = new Set<unknown>();\n const descriptors: ParamDescriptor[] = [];\n for (const ref of refs) {\n if (seen.has(ref)) continue;\n seen.add(ref);\n descriptors.push({\n index: descriptors.length + 1,\n ...(ref.name !== undefined ? { name: ref.name } : {}),\n source: 'dsl',\n ...(ref.codecId !== undefined ? { codecId: ref.codecId } : {}),\n });\n }\n return descriptors;\n}\n","import type { Contract, ExecutionPlan } from '@prisma-next/contract/types';\nimport { runtimeError } from '@prisma-next/framework-components/runtime';\nimport type { MarkerReader, RuntimeFamilyAdapter } from '@prisma-next/runtime-executor';\nimport type { SqlStorage } from '@prisma-next/sql-contract/types';\nimport type { AdapterProfile } from '@prisma-next/sql-relational-core/ast';\n\nexport class SqlFamilyAdapter<TContract extends Contract<SqlStorage>>\n implements RuntimeFamilyAdapter<TContract>\n{\n readonly contract: TContract;\n readonly markerReader: MarkerReader;\n\n constructor(contract: TContract, adapterProfile: AdapterProfile) {\n this.contract = contract;\n this.markerReader = adapterProfile;\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.storageHash !== contract.storage.storageHash) {\n throw runtimeError(\n 'PLAN.HASH_MISMATCH',\n 'Plan storage hash does not match runtime contract',\n {\n planStorageHash: plan.meta.storageHash,\n runtimeStorageHash: contract.storage.storageHash,\n },\n );\n }\n }\n}\n","import type { Contract, ExecutionPlan } from '@prisma-next/contract/types';\nimport type {\n ExecutionStackInstance,\n RuntimeDriverInstance,\n} from '@prisma-next/framework-components/execution';\nimport { checkMiddlewareCompatibility } from '@prisma-next/framework-components/runtime';\nimport type {\n Log,\n RuntimeCore,\n RuntimeCoreOptions,\n RuntimeTelemetryEvent,\n RuntimeVerifyOptions,\n TelemetryOutcome,\n} from '@prisma-next/runtime-executor';\nimport {\n AsyncIterableResult,\n createRuntimeCore,\n runtimeError,\n} from '@prisma-next/runtime-executor';\nimport type { SqlStorage } from '@prisma-next/sql-contract/types';\nimport type {\n Adapter,\n AnyQueryAst,\n CodecRegistry,\n LoweredStatement,\n SqlDriver,\n} from '@prisma-next/sql-relational-core/ast';\nimport type { SqlQueryPlan } from '@prisma-next/sql-relational-core/plan';\nimport type { JsonSchemaValidatorRegistry } from '@prisma-next/sql-relational-core/query-lane-context';\nimport { ifDefined } from '@prisma-next/utils/defined';\nimport { decodeRow } from './codecs/decoding';\nimport { encodeParams } from './codecs/encoding';\nimport { validateCodecRegistryCompleteness } from './codecs/validation';\nimport { lowerSqlPlan } from './lower-sql-plan';\nimport { runBeforeCompileChain } from './middleware/before-compile-chain';\nimport type { SqlMiddleware } from './middleware/sql-middleware';\nimport type {\n ExecutionContext,\n SqlRuntimeAdapterInstance,\n SqlRuntimeExtensionInstance,\n} from './sql-context';\nimport { SqlFamilyAdapter } from './sql-family-adapter';\n\nexport interface RuntimeOptions<TContract extends Contract<SqlStorage> = Contract<SqlStorage>> {\n readonly context: ExecutionContext<TContract>;\n readonly adapter: Adapter<AnyQueryAst, Contract<SqlStorage>, LoweredStatement>;\n readonly driver: SqlDriver<unknown>;\n readonly verify: RuntimeVerifyOptions;\n readonly middleware?: readonly SqlMiddleware[];\n readonly mode?: 'strict' | 'permissive';\n readonly log?: Log;\n}\n\nexport interface CreateRuntimeOptions<\n TContract extends Contract<SqlStorage> = Contract<SqlStorage>,\n TTargetId extends string = string,\n> {\n readonly stackInstance: ExecutionStackInstance<\n 'sql',\n TTargetId,\n SqlRuntimeAdapterInstance<TTargetId>,\n RuntimeDriverInstance<'sql', TTargetId>,\n SqlRuntimeExtensionInstance<TTargetId>\n >;\n readonly context: ExecutionContext<TContract>;\n readonly driver: SqlDriver<unknown>;\n readonly verify: RuntimeVerifyOptions;\n readonly middleware?: readonly SqlMiddleware[];\n readonly mode?: 'strict' | 'permissive';\n readonly log?: Log;\n}\n\nexport interface Runtime extends RuntimeQueryable {\n connection(): Promise<RuntimeConnection>;\n telemetry(): RuntimeTelemetryEvent | null;\n close(): Promise<void>;\n}\n\nexport interface RuntimeConnection extends RuntimeQueryable {\n transaction(): Promise<RuntimeTransaction>;\n /**\n * Returns the connection to the pool for reuse. Only call this when the\n * connection is known to be in a clean state. If a transaction\n * commit/rollback failed or the connection is otherwise suspect, call\n * `destroy(reason)` instead.\n */\n release(): Promise<void>;\n /**\n * Evicts the connection so it is never reused. Call this when the\n * connection may be in an indeterminate state (e.g. a failed rollback\n * leaving an open transaction, or a broken socket).\n *\n * If teardown fails the error is propagated and the connection remains\n * retryable, so the caller can decide whether to swallow the failure or\n * retry cleanup. Calling destroy() or release() more than once after a\n * successful teardown is caller error.\n *\n * `reason` is advisory context only. It may be surfaced to driver-level\n * observability hooks (e.g. pg-pool's `'release'` event) but does not\n * influence eviction behavior and is not rethrown.\n */\n destroy(reason?: unknown): Promise<void>;\n}\n\nexport interface RuntimeTransaction extends RuntimeQueryable {\n commit(): Promise<void>;\n rollback(): Promise<void>;\n}\n\nexport interface RuntimeQueryable {\n execute<Row = Record<string, unknown>>(\n plan: ExecutionPlan<Row> | SqlQueryPlan<Row>,\n ): AsyncIterableResult<Row>;\n}\n\nexport interface TransactionContext extends RuntimeQueryable {\n readonly invalidated: boolean;\n}\n\ninterface CoreQueryable {\n execute<Row = Record<string, unknown>>(plan: ExecutionPlan<Row>): AsyncIterableResult<Row>;\n}\n\nexport type { RuntimeTelemetryEvent, RuntimeVerifyOptions, TelemetryOutcome };\n\nclass SqlRuntimeImpl<TContract extends Contract<SqlStorage> = Contract<SqlStorage>>\n implements Runtime\n{\n private readonly core: RuntimeCore<TContract, SqlDriver<unknown>, SqlMiddleware>;\n private readonly contract: TContract;\n private readonly adapter: Adapter<AnyQueryAst, Contract<SqlStorage>, LoweredStatement>;\n private readonly codecRegistry: CodecRegistry;\n private readonly jsonSchemaValidators: JsonSchemaValidatorRegistry | undefined;\n private codecRegistryValidated: boolean;\n\n constructor(options: RuntimeOptions<TContract>) {\n const { context, adapter, driver, verify, middleware, mode, log } = options;\n this.contract = context.contract;\n this.adapter = adapter;\n this.codecRegistry = context.codecs;\n this.jsonSchemaValidators = context.jsonSchemaValidators;\n this.codecRegistryValidated = false;\n\n if (middleware) {\n for (const mw of middleware) {\n checkMiddlewareCompatibility(mw, 'sql', context.contract.target);\n }\n }\n\n const familyAdapter = new SqlFamilyAdapter(context.contract, adapter.profile);\n\n const coreOptions: RuntimeCoreOptions<TContract, SqlDriver<unknown>, SqlMiddleware> = {\n familyAdapter,\n driver,\n verify,\n ...ifDefined('middleware', middleware),\n ...ifDefined('mode', mode),\n ...ifDefined('log', log),\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: Contract<SqlStorage>): void {\n if (!this.codecRegistryValidated) {\n validateCodecRegistryCompleteness(this.codecRegistry, contract);\n this.codecRegistryValidated = true;\n }\n }\n\n private async toExecutionPlan<Row>(\n plan: ExecutionPlan<Row> | SqlQueryPlan<Row>,\n ): Promise<ExecutionPlan<Row>> {\n const isSqlQueryPlan = (p: ExecutionPlan<Row> | SqlQueryPlan<Row>): p is SqlQueryPlan<Row> => {\n return 'ast' in p && !('sql' in p);\n };\n\n if (!isSqlQueryPlan(plan)) {\n return plan;\n }\n\n const rewrittenDraft = await runBeforeCompileChain(\n this.core.middleware,\n { ast: plan.ast, meta: plan.meta },\n this.core.middlewareContext,\n );\n\n const planToLower: SqlQueryPlan<Row> =\n rewrittenDraft.ast === plan.ast\n ? plan\n : { ...plan, ast: rewrittenDraft.ast, meta: rewrittenDraft.meta };\n\n return lowerSqlPlan(this.adapter, this.contract, planToLower);\n }\n\n private executeAgainstQueryable<Row = Record<string, unknown>>(\n plan: ExecutionPlan<Row> | SqlQueryPlan<Row>,\n queryable: CoreQueryable,\n ): AsyncIterableResult<Row> {\n this.ensureCodecRegistryValidated(this.contract);\n\n const iterator = async function* (\n self: SqlRuntimeImpl<TContract>,\n ): AsyncGenerator<Row, void, unknown> {\n const executablePlan = await self.toExecutionPlan(plan);\n const encodedParams = await encodeParams(executablePlan, self.codecRegistry);\n const planWithEncodedParams: ExecutionPlan<Row> = {\n ...executablePlan,\n params: encodedParams,\n };\n\n const coreIterator = queryable.execute(planWithEncodedParams);\n\n for await (const rawRow of coreIterator) {\n const decodedRow = await decodeRow(\n rawRow as Record<string, unknown>,\n executablePlan,\n self.codecRegistry,\n self.jsonSchemaValidators,\n );\n yield decodedRow as Row;\n }\n };\n\n return new AsyncIterableResult(iterator(this));\n }\n\n execute<Row = Record<string, unknown>>(\n plan: ExecutionPlan<Row> | SqlQueryPlan<Row>,\n ): AsyncIterableResult<Row> {\n return this.executeAgainstQueryable(plan, this.core);\n }\n\n async connection(): Promise<RuntimeConnection> {\n const coreConn = await this.core.connection();\n const self = this;\n const wrappedConnection: RuntimeConnection = {\n async transaction(): Promise<RuntimeTransaction> {\n const coreTx = await coreConn.transaction();\n return {\n commit: coreTx.commit.bind(coreTx),\n rollback: coreTx.rollback.bind(coreTx),\n execute<Row = Record<string, unknown>>(\n plan: ExecutionPlan<Row> | SqlQueryPlan<Row>,\n ): AsyncIterableResult<Row> {\n return self.executeAgainstQueryable(plan, coreTx);\n },\n };\n },\n release: coreConn.release.bind(coreConn),\n destroy: coreConn.destroy.bind(coreConn),\n execute<Row = Record<string, unknown>>(\n plan: ExecutionPlan<Row> | SqlQueryPlan<Row>,\n ): AsyncIterableResult<Row> {\n return self.executeAgainstQueryable(plan, coreConn);\n },\n };\n return wrappedConnection;\n }\n\n telemetry(): RuntimeTelemetryEvent | null {\n return this.core.telemetry();\n }\n\n close(): Promise<void> {\n return this.core.close();\n }\n}\n\nfunction transactionClosedError(): Error {\n return runtimeError(\n 'RUNTIME.TRANSACTION_CLOSED',\n 'Cannot read from a query result after the transaction has ended. Await the result or call .toArray() inside the transaction callback.',\n {},\n );\n}\n\nexport async function withTransaction<R>(\n runtime: Runtime,\n fn: (tx: TransactionContext) => PromiseLike<R>,\n): Promise<R> {\n const connection = await runtime.connection();\n const transaction = await connection.transaction();\n\n let invalidated = false;\n const txContext: TransactionContext = {\n get invalidated() {\n return invalidated;\n },\n execute<Row = Record<string, unknown>>(\n plan: ExecutionPlan<Row> | SqlQueryPlan<Row>,\n ): AsyncIterableResult<Row> {\n if (invalidated) {\n throw transactionClosedError();\n }\n const inner = transaction.execute(plan);\n const guarded = async function* (): AsyncGenerator<Row, void, unknown> {\n for await (const row of inner) {\n if (invalidated) {\n throw transactionClosedError();\n }\n yield row;\n }\n };\n return new AsyncIterableResult(guarded());\n },\n };\n\n let connectionDisposed = false;\n const destroyConnection = async (reason: unknown): Promise<void> => {\n if (connectionDisposed) return;\n connectionDisposed = true;\n // SqlConnection.destroy() propagates teardown errors so callers can\n // decide what to do with them. Here, we're already about to throw a\n // more informative error describing why we're evicting the connection\n // (rollback/commit failure), so swallowing the teardown error is the\n // right call — surfacing it would mask the original cause.\n await connection.destroy(reason).catch(() => undefined);\n };\n\n try {\n let result: R;\n try {\n result = await fn(txContext);\n } catch (error) {\n try {\n await transaction.rollback();\n } catch (rollbackError) {\n await destroyConnection(rollbackError);\n const wrapped = runtimeError(\n 'RUNTIME.TRANSACTION_ROLLBACK_FAILED',\n 'Transaction rollback failed after callback error',\n { rollbackError },\n );\n wrapped.cause = error;\n throw wrapped;\n }\n throw error;\n } finally {\n invalidated = true;\n }\n\n try {\n await transaction.commit();\n } catch (commitError) {\n // After a failed COMMIT the server-side transaction may be: (a) already\n // committed (error on response path), (b) already rolled back (deferred\n // constraint / serialization failure), or (c) still open (COMMIT never\n // reached the server). Attempt a best-effort rollback to cover (c) and\n // confirm the protocol is healthy.\n //\n // If rollback succeeds, the server is definitely no longer in a\n // transaction (no-op in (a)/(b), real cleanup in (c)) and we've just\n // proved the connection round-trips correctly — it's safe to return\n // to the pool. If rollback fails, the connection state is ambiguous\n // (broken socket, protocol desync, etc.) and we must destroy it.\n try {\n await transaction.rollback();\n } catch {\n await destroyConnection(commitError);\n }\n const wrapped = runtimeError(\n 'RUNTIME.TRANSACTION_COMMIT_FAILED',\n 'Transaction commit failed',\n { commitError },\n );\n wrapped.cause = commitError;\n throw wrapped;\n }\n return result;\n } finally {\n if (!connectionDisposed) {\n await connection.release();\n }\n }\n}\n\nexport function createRuntime<TContract extends Contract<SqlStorage>, TTargetId extends string>(\n options: CreateRuntimeOptions<TContract, TTargetId>,\n): Runtime {\n const { stackInstance, context, driver, verify, middleware, mode, log } = options;\n\n return new SqlRuntimeImpl({\n context,\n adapter: stackInstance.adapter,\n driver,\n verify,\n ...ifDefined('middleware', middleware),\n ...ifDefined('mode', mode),\n ...ifDefined('log', log),\n });\n}\n"],"mappings":";;;;;;;;;;AAKA,SAAgB,gBAAgB,UAA6C;CAC3E,MAAM,2BAAW,IAAI,KAAa;AAElC,MAAK,MAAM,SAAS,OAAO,OAAO,SAAS,QAAQ,OAAO,CACxD,MAAK,MAAM,UAAU,OAAO,OAAO,MAAM,QAAQ,EAAE;EACjD,MAAM,UAAU,OAAO;AACvB,WAAS,IAAI,QAAQ;;AAIzB,QAAO;;AAGT,SAAS,2BAA2B,UAAqD;CACvF,MAAM,2BAAW,IAAI,KAAqB;AAE1C,MAAK,MAAM,CAAC,WAAW,UAAU,OAAO,QAAQ,SAAS,QAAQ,OAAO,CACtE,MAAK,MAAM,CAAC,YAAY,WAAW,OAAO,QAAQ,MAAM,QAAQ,EAAE;EAChE,MAAM,UAAU,OAAO;EACvB,MAAM,MAAM,GAAG,UAAU,GAAG;AAC5B,WAAS,IAAI,KAAK,QAAQ;;AAI9B,QAAO;;AAGT,SAAgB,8BACd,UACA,UACM;CACN,MAAM,WAAW,2BAA2B,SAAS;CACrD,MAAMA,gBAA2E,EAAE;AAEnF,MAAK,MAAM,CAAC,KAAK,YAAY,SAAS,SAAS,CAC7C,KAAI,CAAC,SAAS,IAAI,QAAQ,EAAE;EAC1B,MAA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E;AACR,iBAAc;;AAGhB,MAAI;AACF,SAAM,YAAY,QAAQ;WACnB,aAAa;AAYpB,OAAI;AACF,UAAM,YAAY,UAAU;WACtB;AACN,UAAM,kBAAkB,YAAY;;GAEtC,MAAM,UAAUA,eACd,qCACA,6BACA,EAAE,aAAa,CAChB;AACD,WAAQ,QAAQ;AAChB,SAAM;;AAER,SAAO;WACC;AACR,MAAI,CAAC,mBACH,OAAM,WAAW,SAAS;;;AAKhC,SAAgB,cACd,SACS;CACT,MAAM,EAAE,eAAe,SAAS,QAAQ,QAAQ,YAAY,MAAM,QAAQ;AAE1E,QAAO,IAAI,eAAe;EACxB;EACA,SAAS,cAAc;EACvB;EACA;EACA,GAAG,UAAU,cAAc,WAAW;EACtC,GAAG,UAAU,QAAQ,KAAK;EAC1B,GAAG,UAAU,OAAO,IAAI;EACzB,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index-yb51L_1h.d.mts","names":[],"sources":["../src/codecs/validation.ts","../src/lower-sql-plan.ts","../src/middleware/sql-middleware.ts","../src/middleware/budgets.ts","../src/middleware/lints.ts","../src/sql-context.ts","../src/sql-marker.ts","../src/sql-runtime.ts"],"sourcesContent":[],"mappings":";;;;;;;;;;;iBAKgB,eAAA,WAA0B,SAAS,cAAc;iBA2BjD,6BAAA,WACJ,yBACA,SAAS;iBA4BL,iCAAA,WACJ,yBACA,SAAS;;;;;;;;;;AA3DrB;AAAmD,iBCQnC,YDRmC,CAAA,GAAA,CAAA,CAAA,OAAA,ECSxC,ODTwC,CCShC,WDTgC,ECSnB,QDTmB,CCSV,UDTU,CAAA,ECSG,gBDTH,CAAA,EAAA,QAAA,ECUvC,QDVuC,CCU9B,UDV8B,CAAA,EAAA,SAAA,ECWtC,YDXsC,CCWzB,GDXyB,CAAA,CAAA,ECYhD,aDZgD,CCYlC,GDZkC,CAAA;;;UEIlC,oBAAA,SAA6B;qBACzB,SAAS;;;;;;AFLd,UEYC,SAAA,CFZc;EAAo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