@prisma-next/sql-relational-core 0.5.0-dev.30 → 0.5.0-dev.32
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/dist/{codec-types-DAQNecFs.d.mts → codec-types-DJEaWT36.d.mts} +111 -5
- package/dist/codec-types-DJEaWT36.d.mts.map +1 -0
- package/dist/{errors-CJKxtKSt.d.mts → errors-BRt5yHo9.d.mts} +2 -2
- package/dist/errors-BRt5yHo9.d.mts.map +1 -0
- package/dist/exports/ast.d.mts +2 -2
- package/dist/exports/ast.mjs.map +1 -1
- package/dist/exports/errors.d.mts +4 -4
- package/dist/exports/expression.d.mts.map +1 -1
- package/dist/exports/query-lane-context.d.mts +3 -3
- package/dist/exports/types.d.mts +3 -3
- package/dist/index.d.mts +5 -5
- package/dist/{query-lane-context-Cch9CN9H.d.mts → query-lane-context-BF-wuc0r.d.mts} +53 -3
- package/dist/query-lane-context-BF-wuc0r.d.mts.map +1 -0
- package/dist/{types-TPM2rhCa.d.mts → types-BWOCTYd8.d.mts} +2 -2
- package/dist/{types-TPM2rhCa.d.mts.map → types-BWOCTYd8.d.mts.map} +1 -1
- package/package.json +8 -8
- package/src/ast/codec-types.ts +109 -2
- package/src/query-lane-context.ts +52 -1
- package/dist/codec-types-DAQNecFs.d.mts.map +0 -1
- package/dist/errors-CJKxtKSt.d.mts.map +0 -1
- package/dist/query-lane-context-Cch9CN9H.d.mts.map +0 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Type } from "arktype";
|
|
2
2
|
import { JsonValue } from "@prisma-next/contract/types";
|
|
3
|
-
import { Codec, CodecCallContext, CodecCallContext as CodecCallContext$1, CodecTrait, CodecTrait as CodecTrait$1 } from "@prisma-next/framework-components/codec";
|
|
3
|
+
import { Codec, CodecCallContext, CodecCallContext as CodecCallContext$1, CodecInstanceContext, CodecTrait, CodecTrait as CodecTrait$1 } from "@prisma-next/framework-components/codec";
|
|
4
4
|
import { O } from "ts-toolbelt";
|
|
5
5
|
|
|
6
6
|
//#region src/ast/codec-types.d.ts
|
|
@@ -37,8 +37,46 @@ interface SqlCodecCallContext extends CodecCallContext {
|
|
|
37
37
|
readonly column?: SqlColumnRef;
|
|
38
38
|
}
|
|
39
39
|
/**
|
|
40
|
-
*
|
|
41
|
-
*
|
|
40
|
+
* SQL-family per-instance context. Extends the framework
|
|
41
|
+
* {@link CodecInstanceContext} (`name` only) with `usedAt`, the set of
|
|
42
|
+
* `(table, column)` pairs the resolved codec serves.
|
|
43
|
+
*
|
|
44
|
+
* - For `typeRef` columns sharing one named `storage.types` instance, the
|
|
45
|
+
* array lists every referencing column — a column-scoped stateful codec
|
|
46
|
+
* (e.g. encryption) can derive aggregated per-instance state across all
|
|
47
|
+
* the columns sharing the named instance.
|
|
48
|
+
* - For inline-`typeParams` columns, the array has exactly one entry —
|
|
49
|
+
* the column that owns the inline params.
|
|
50
|
+
* - For shared non-parameterized codecs, the array carries one
|
|
51
|
+
* representative entry (the column that triggered materialization);
|
|
52
|
+
* the codec is shared across every column with that codec id, so the
|
|
53
|
+
* `usedAt` is informational only.
|
|
54
|
+
*
|
|
55
|
+
* SQL extensions consuming `usedAt` (e.g. column-scoped state derivation)
|
|
56
|
+
* type their factory parameter as `SqlCodecInstanceContext`. Extensions
|
|
57
|
+
* that don't read `usedAt` type their factory parameter as the
|
|
58
|
+
* family-agnostic {@link CodecInstanceContext} — a `SqlCodecInstanceContext`
|
|
59
|
+
* is structurally assignable to the base.
|
|
60
|
+
*/
|
|
61
|
+
interface SqlCodecInstanceContext extends CodecInstanceContext {
|
|
62
|
+
readonly usedAt: ReadonlyArray<{
|
|
63
|
+
readonly table: string;
|
|
64
|
+
readonly column: string;
|
|
65
|
+
}>;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Legacy adapter-level descriptor for parameterized codecs that require
|
|
69
|
+
* type-parameter validation at compile time. The runtime descriptor
|
|
70
|
+
* (`RuntimeParameterizedCodecDescriptor` in `@prisma-next/sql-runtime`)
|
|
71
|
+
* has migrated to the unified `CodecDescriptor<P>` shape with
|
|
72
|
+
* `factory: (P) => (CodecInstanceContext) => Codec`; this descriptor stays only because
|
|
73
|
+
* the SQL `Adapter.parameterizedCodecs()` surface still returns
|
|
74
|
+
* `CodecParamsDescriptor[]` (compile-time typeParams validation only,
|
|
75
|
+
* not runtime materialization).
|
|
76
|
+
*
|
|
77
|
+
* Retirement is tracked under TML-2357 T3.5.4 (single registration slot)
|
|
78
|
+
* — the adapter-level `parameterizedCodecs()` collapses into the unified
|
|
79
|
+
* runtime descriptor map once contributors migrate fully.
|
|
42
80
|
*
|
|
43
81
|
* @template TParams - The shape of the type parameters (e.g., `{ length: number }`)
|
|
44
82
|
* @template THelper - The type returned by the optional `init` hook
|
|
@@ -55,6 +93,14 @@ interface CodecParamsDescriptor<TParams = Record<string, unknown>, THelper = unk
|
|
|
55
93
|
* Optional init hook called during runtime context creation.
|
|
56
94
|
* Receives validated params and returns a helper object to be stored in context.types.
|
|
57
95
|
* If not provided, the validated params are stored directly.
|
|
96
|
+
*
|
|
97
|
+
* Predecessor pattern. The runtime descriptor's curried
|
|
98
|
+
* `factory: (P) => (CodecInstanceContext) => Codec` subsumes this hook — per-instance
|
|
99
|
+
* state lives on the resolved codec rather than in a parallel
|
|
100
|
+
* `TypeHelperRegistry` entry. Retirement tracked under TML-2357 T3.5.2
|
|
101
|
+
* (narrow runtime `Codec` interface) and T3.5.4 (single registration
|
|
102
|
+
* slot). Adapter-level callers reading codec-self-carried `init` should
|
|
103
|
+
* migrate to the runtime descriptor map's factory instead.
|
|
58
104
|
*/
|
|
59
105
|
readonly init?: (params: TParams) => THelper;
|
|
60
106
|
}
|
|
@@ -83,6 +129,14 @@ interface CodecMeta {
|
|
|
83
129
|
* bivariantly, so the SQL narrowing is structurally compatible with the
|
|
84
130
|
* framework {@link BaseCodec} super-interface.
|
|
85
131
|
*
|
|
132
|
+
* Note: `paramsSchema` and `init` here are the legacy adapter-level slots
|
|
133
|
+
* mirrored from {@link CodecParamsDescriptor}. The runtime materialization
|
|
134
|
+
* path uses `RuntimeParameterizedCodecDescriptor` (in
|
|
135
|
+
* `@prisma-next/sql-runtime`) via the unified `CodecDescriptor<P>` shape;
|
|
136
|
+
* codec-self-carried `paramsSchema`/`init` retire under TML-2357 (T3.5.2
|
|
137
|
+
* narrows the runtime `Codec` interface; T3.5.4 collapses the parallel
|
|
138
|
+
* registration slots).
|
|
139
|
+
*
|
|
86
140
|
* See `Codec` in `@prisma-next/framework-components/codec` for the codec
|
|
87
141
|
* contract that this interface extends.
|
|
88
142
|
*/
|
|
@@ -91,8 +145,60 @@ interface Codec$1<Id$1 extends string = string, TTraits$1 extends readonly Codec
|
|
|
91
145
|
decode(wire: TWire, ctx: SqlCodecCallContext): Promise<TInput>;
|
|
92
146
|
readonly meta?: CodecMeta;
|
|
93
147
|
readonly paramsSchema?: Type<TParams>;
|
|
148
|
+
/**
|
|
149
|
+
* Predecessor init hook. Retirement tracked under TML-2357 (T3.5.2 /
|
|
150
|
+
* T3.5.4); the unified runtime descriptor's
|
|
151
|
+
* `factory: (P) => (CodecInstanceContext) => Codec` is the replacement.
|
|
152
|
+
*/
|
|
94
153
|
readonly init?: (params: TParams) => THelper;
|
|
95
154
|
}
|
|
155
|
+
/**
|
|
156
|
+
* Contract-bound codec registry.
|
|
157
|
+
*
|
|
158
|
+
* The dispatch interface for encode/decode at runtime: built once at
|
|
159
|
+
* `ExecutionContext` construction time by walking the contract's
|
|
160
|
+
* `storage.tables[].columns[]` and resolving each column to either a per-
|
|
161
|
+
* instance parameterized codec (via `descriptor.factory(typeParams)(ctx)`)
|
|
162
|
+
* or the shared codec instance from the legacy `CodecRegistry` (for non-
|
|
163
|
+
* parameterized codecs). The dispatch path calls
|
|
164
|
+
* `forColumn(table, column).encode/decode(...)` and doesn't know whether
|
|
165
|
+
* the codec is parameterized.
|
|
166
|
+
*
|
|
167
|
+
* `forCodecId(codecId)` is a fallback for sites that don't carry the
|
|
168
|
+
* `(table, column)` ref through to the encode/decode call site —
|
|
169
|
+
* primarily the param-encoding path, where `ParamRef.refs` is not
|
|
170
|
+
* populated by the SQL builder today (every `ParamRef` carries `codecId`
|
|
171
|
+
* but not the column it relates to). For the parameterized codecs shipped
|
|
172
|
+
* at Phase B, encode is per-instance-stateless (pgvector formats
|
|
173
|
+
* `[v1,v2,v3]` regardless of length; JSON's `encode` is `JSON.stringify`
|
|
174
|
+
* regardless of schema), so a codec-id-keyed lookup yields a structurally
|
|
175
|
+
* equivalent encoder; the fallback is the bridge that lets the legacy
|
|
176
|
+
* `codecs:` registration retire from the dispatch path while staying as
|
|
177
|
+
* the codec-id-only source for now.
|
|
178
|
+
*
|
|
179
|
+
* The encode-side fallback is the AC-5-deferred carve-out documented in
|
|
180
|
+
* the codec-registry-unification spec § Non-functional constraints.
|
|
181
|
+
* TML-2357 retires the fallback by threading `ParamRef.refs` through
|
|
182
|
+
* column-bound construction sites.
|
|
183
|
+
*/
|
|
184
|
+
interface ContractCodecRegistry {
|
|
185
|
+
/**
|
|
186
|
+
* Resolve the codec for `(table, column)`. Returns the per-instance
|
|
187
|
+
* parameterized codec for parameterized columns, the shared codec for
|
|
188
|
+
* non-parameterized columns, or `undefined` if the column is unknown
|
|
189
|
+
* or the codec isn't registered.
|
|
190
|
+
*/
|
|
191
|
+
forColumn(table: string, column: string): Codec$1 | undefined;
|
|
192
|
+
/**
|
|
193
|
+
* Resolve a codec by id. Returns the same codec instance the legacy
|
|
194
|
+
* `CodecRegistry.get(codecId)` would return — for non-parameterized
|
|
195
|
+
* codecs that's the shared instance; for parameterized codecs that's
|
|
196
|
+
* a representative resolved instance. Used by sites that don't carry
|
|
197
|
+
* `(table, column)` through to the encode/decode call site (the AC-5
|
|
198
|
+
* carve-out path).
|
|
199
|
+
*/
|
|
200
|
+
forCodecId(codecId: string): Codec$1 | undefined;
|
|
201
|
+
}
|
|
96
202
|
/**
|
|
97
203
|
* Registry interface for codecs organized by ID and by contract scalar type.
|
|
98
204
|
*
|
|
@@ -203,5 +309,5 @@ declare function createCodecRegistry(): CodecRegistry;
|
|
|
203
309
|
*/
|
|
204
310
|
declare function defineCodecs(): CodecDefBuilder<Record<never, never>>;
|
|
205
311
|
//#endregion
|
|
206
|
-
export {
|
|
207
|
-
//# sourceMappingURL=codec-types-
|
|
312
|
+
export { codec as _, CodecInput as a, CodecRegistry as c, ContractCodecRegistry as d, ExtractCodecTypes as f, SqlColumnRef as g, SqlCodecInstanceContext as h, CodecId as i, CodecTrait$1 as l, SqlCodecCallContext as m, CodecCallContext$1 as n, CodecMeta as o, ExtractDataTypes as p, CodecDefBuilder as r, CodecParamsDescriptor as s, Codec$1 as t, CodecTraits as u, createCodecRegistry as v, defineCodecs as y };
|
|
313
|
+
//# sourceMappingURL=codec-types-DJEaWT36.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"codec-types-DJEaWT36.d.mts","names":[],"sources":["../src/ast/codec-types.ts"],"sourcesContent":[],"mappings":";;;;;;;;AA0BA;AAgBA;AA0BA;AAqBA;;;;;;;AA8BA;AAiCA;AAE2B,UAhIV,YAAA,CAgIU;EAAwB,SAAA,KAAA,EAAA,MAAA;EAGvC,SAAA,IAAA,EAAA,MAAA;;;;;;;;;;;;;AAKM,UAxHD,mBAAA,SAA4B,gBAwH3B,CAAA;EACa,SAAA,MAAA,CAAA,EAxHX,YAwHW;;;;;;AAsC/B;AA4BA;;;;;;;;;;;;AAYC;;;;;AAwGyB,UArRT,uBAAA,SAAgC,oBAqRvB,CAAA;EAAc,SAAA,MAAA,EApRrB,aAoRqB,CAAA;IAGd,SAAA,KAAA,EAAA,MAAA;IAAW,SAAA,MAAA,EAAA,MAAA;EACZ,CAAA,CAAA;;;AAkBzB;;;;;;;;;;;;;;;;AAcmB,UApSF,qBAoSE,CAAA,UApS8B,MAoS9B,CAAA,MAAA,EAAA,OAAA,CAAA,EAAA,UAAA,OAAA,CAAA,CAAA;EACC;EAAY,SAAA,OA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uB;;;;iBAOvB,YAAA,CAAA,GAAgB,gBAAgB"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { y as RuntimeError } from "./types-
|
|
1
|
+
import { y as RuntimeError } from "./types-BWOCTYd8.mjs";
|
|
2
2
|
|
|
3
3
|
//#region src/errors.d.ts
|
|
4
4
|
declare function planInvalid(message: string, details?: Record<string, unknown>, hints?: readonly string[], docs?: readonly string[]): RuntimeError;
|
|
5
5
|
declare function planUnsupported(message: string, details?: Record<string, unknown>, hints?: readonly string[], docs?: readonly string[]): RuntimeError;
|
|
6
6
|
//#endregion
|
|
7
7
|
export { planUnsupported as n, planInvalid as t };
|
|
8
|
-
//# sourceMappingURL=errors-
|
|
8
|
+
//# sourceMappingURL=errors-BRt5yHo9.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors-BRt5yHo9.d.mts","names":[],"sources":["../src/errors.ts"],"sourcesContent":[],"mappings":";;;iBAEgB,WAAA,4BAEJ,+EAGT;iBAkBa,eAAA,4BAEJ,+EAGT"}
|
package/dist/exports/ast.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { _ as
|
|
1
|
+
import { _ as codec, a as CodecInput, c as CodecRegistry, d as ContractCodecRegistry, f as ExtractCodecTypes, g as SqlColumnRef, h as SqlCodecInstanceContext, i as CodecId, l as CodecTrait, m as SqlCodecCallContext, n as CodecCallContext, o as CodecMeta, p as ExtractDataTypes, r as CodecDefBuilder, s as CodecParamsDescriptor, t as Codec, u as CodecTraits, v as createCodecRegistry, y as defineCodecs } from "../codec-types-DJEaWT36.mjs";
|
|
2
2
|
import { $ as ToWhereExpr, A as InsertOnConflict, B as NotExpr, C as ExistsExpr, D as ExpressionSource, E as ExpressionRewriter, F as JsonObjectEntry, G as ParamRef, H as OperationExpr, I as JsonObjectExpr, J as SelectAst, K as ProjectionExpr, L as ListExpression, M as JoinAst, N as JoinOnExpr, O as IdentifierRef, P as JsonArrayAggExpr, Q as TableSource, R as LiteralExpr, S as EqColJoinOn, T as ExpressionFolder, U as OrExpr, V as NullCheckExpr, W as OrderByItem, X as SubqueryExpr, Y as SelectAstOptions, Z as TableRef, _ as DeleteAst, a as AndExpr, at as whereExprKinds, b as DoNothingConflictAction, c as AnyInsertOnConflictAction, d as AnyQueryAst, et as UpdateAst, f as AstRewriter, g as DefaultValueExpr, h as ColumnRef, i as AggregateOpFn, it as queryAstKinds, j as InsertValue, k as InsertAst, l as AnyInsertValue, m as BinaryOp, n as AggregateExpr, nt as isQueryAst, o as AnyExpression, p as BinaryExpr, q as ProjectionItem, r as AggregateFn, rt as isWhereExpr, s as AnyFromSource, t as AggregateCountFn, tt as WhereArg, u as AnyOperationArg, v as DerivedTableSource, w as ExprVisitor, x as DoUpdateSetConflictAction, y as Direction, z as LoweredStatement } from "../types-B4dL4lc3.mjs";
|
|
3
3
|
import { ContractMarkerRecord } from "@prisma-next/contract/types";
|
|
4
4
|
|
|
@@ -201,5 +201,5 @@ declare function compact<T extends Record<string, unknown>>(o: T): T;
|
|
|
201
201
|
*/
|
|
202
202
|
declare function collectOrderedParamRefs(ast: AnyQueryAst): ReadonlyArray<ParamRef>;
|
|
203
203
|
//#endregion
|
|
204
|
-
export { Adapter, AdapterProfile, AdapterTarget, AggregateCountFn, AggregateExpr, AggregateFn, AggregateOpFn, AndExpr, AnyExpression, AnyFromSource, AnyInsertOnConflictAction, AnyInsertValue, AnyOperationArg, AnyQueryAst, AstRewriter, BinaryExpr, BinaryOp, Codec, CodecCallContext, CodecDefBuilder, CodecId, CodecInput, CodecMeta, CodecParamsDescriptor, CodecRegistry, CodecTrait, CodecTraits, ColumnRef, DefaultValueExpr, DeleteAst, DerivedTableSource, Direction, DoNothingConflictAction, DoUpdateSetConflictAction, EqColJoinOn, ExistsExpr, ExprVisitor, ExpressionFolder, ExpressionRewriter, ExpressionSource, ExtractCodecTypes, ExtractDataTypes, IdentifierRef, InsertAst, InsertOnConflict, InsertValue, JoinAst, JoinOnExpr, JsonArrayAggExpr, JsonObjectEntry, JsonObjectExpr, ListExpression, LiteralExpr, LoweredStatement, Lowerer, LowererContext, MarkerStatement, NotExpr, NullCheckExpr, OperationExpr, OrExpr, OrderByItem, ParamRef, ProjectionExpr, ProjectionItem, SQL_CHAR_CODEC_ID, SQL_FLOAT_CODEC_ID, SQL_INT_CODEC_ID, SQL_TEXT_CODEC_ID, SQL_TIMESTAMP_CODEC_ID, SQL_VARCHAR_CODEC_ID, SelectAst, SelectAstOptions, SqlCodecCallContext, SqlCodecTypes, SqlColumnRef, SqlConnection, SqlDriver, SqlDriverState, SqlExecuteRequest, SqlExplainResult, SqlQueryResult, SqlQueryable, SqlTransaction, SubqueryExpr, TableRef, TableSource, ToWhereExpr, UpdateAst, WhereArg, codec, collectOrderedParamRefs, compact, createCodecRegistry, defineCodecs, isQueryAst, isWhereExpr, queryAstKinds, sqlCodecDefinitions, sqlDataTypes, whereExprKinds };
|
|
204
|
+
export { Adapter, AdapterProfile, AdapterTarget, AggregateCountFn, AggregateExpr, AggregateFn, AggregateOpFn, AndExpr, AnyExpression, AnyFromSource, AnyInsertOnConflictAction, AnyInsertValue, AnyOperationArg, AnyQueryAst, AstRewriter, BinaryExpr, BinaryOp, Codec, CodecCallContext, CodecDefBuilder, CodecId, CodecInput, CodecMeta, CodecParamsDescriptor, CodecRegistry, CodecTrait, CodecTraits, ColumnRef, ContractCodecRegistry, DefaultValueExpr, DeleteAst, DerivedTableSource, Direction, DoNothingConflictAction, DoUpdateSetConflictAction, EqColJoinOn, ExistsExpr, ExprVisitor, ExpressionFolder, ExpressionRewriter, ExpressionSource, ExtractCodecTypes, ExtractDataTypes, IdentifierRef, InsertAst, InsertOnConflict, InsertValue, JoinAst, JoinOnExpr, JsonArrayAggExpr, JsonObjectEntry, JsonObjectExpr, ListExpression, LiteralExpr, LoweredStatement, Lowerer, LowererContext, MarkerStatement, NotExpr, NullCheckExpr, OperationExpr, OrExpr, OrderByItem, ParamRef, ProjectionExpr, ProjectionItem, SQL_CHAR_CODEC_ID, SQL_FLOAT_CODEC_ID, SQL_INT_CODEC_ID, SQL_TEXT_CODEC_ID, SQL_TIMESTAMP_CODEC_ID, SQL_VARCHAR_CODEC_ID, SelectAst, SelectAstOptions, SqlCodecCallContext, SqlCodecInstanceContext, SqlCodecTypes, SqlColumnRef, SqlConnection, SqlDriver, SqlDriverState, SqlExecuteRequest, SqlExplainResult, SqlQueryResult, SqlQueryable, SqlTransaction, SubqueryExpr, TableRef, TableSource, ToWhereExpr, UpdateAst, WhereArg, codec, collectOrderedParamRefs, compact, createCodecRegistry, defineCodecs, isQueryAst, isWhereExpr, queryAstKinds, sqlCodecDefinitions, sqlDataTypes, whereExprKinds };
|
|
205
205
|
//# sourceMappingURL=ast.d.mts.map
|
package/dist/exports/ast.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ast.mjs","names":["codec","codecs","codecTypes: Record<\n string,\n { readonly input: unknown; readonly output: unknown; readonly traits: unknown }\n >","result: Record<\n string,\n {\n typeId: string;\n scalar: string;\n codec: Codec;\n input: unknown;\n output: unknown;\n jsType: unknown;\n }\n >","arktype","out: Record<string, unknown>","ordered: ParamRef[]"],"sources":["../../src/ast/codec-types.ts","../../src/ast/sql-codecs.ts","../../src/ast/util.ts"],"sourcesContent":["import type { JsonValue } from '@prisma-next/contract/types';\nimport type {\n Codec as BaseCodec,\n CodecCallContext,\n CodecTrait,\n} from '@prisma-next/framework-components/codec';\nimport { ifDefined } from '@prisma-next/utils/defined';\nimport type { Type } from 'arktype';\nimport type { O } from 'ts-toolbelt';\n\nexport type { CodecCallContext, CodecTrait } from '@prisma-next/framework-components/codec';\n\n/**\n * SQL-family addressing of a single column. The decode site populates a\n * `SqlColumnRef` whenever it can resolve the cell to a single underlying\n * `(table, column)` (the typical case for projected columns from a\n * single-table source); cells the runtime cannot resolve (aggregate\n * aliases, include aggregate fields, computed projections without a\n * simple ref) get `column = undefined`.\n *\n * The shape is a structural projection of the runtime's `ColumnRef` so\n * the SQL decode site can reuse the resolution it already performs for\n * `RUNTIME.DECODE_FAILED` envelope construction without allocating\n * twice per cell.\n */\nexport interface SqlColumnRef {\n readonly table: string;\n readonly name: string;\n}\n\n/**\n * SQL-family per-call context. Extends the framework {@link CodecCallContext}\n * (which carries `signal` only) with `column?: SqlColumnRef`, populated\n * on **decode** call sites that can resolve a single underlying column\n * ref. Encode call sites currently leave `column` undefined (encode-time\n * column context is the middleware's domain).\n *\n * SQL codec authors writing a `(value, ctx)` author function for the SQL\n * `codec()` factory observe this type. The framework codec dispatch\n * surface (and Mongo) sees only the base `CodecCallContext`.\n */\nexport interface SqlCodecCallContext extends CodecCallContext {\n readonly column?: SqlColumnRef;\n}\n\n/**\n * Descriptor for parameterized codecs that require type parameter validation.\n * Shared between adapter (compile-time) and runtime layers to avoid duplication.\n *\n * @template TParams - The shape of the type parameters (e.g., `{ length: number }`)\n * @template THelper - The type returned by the optional `init` hook\n */\nexport interface CodecParamsDescriptor<TParams = Record<string, unknown>, THelper = unknown> {\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 * 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 * Codec metadata for database-specific type information.\n * Used for schema introspection and verification.\n */\nexport interface CodecMeta {\n readonly db?: {\n readonly sql?: {\n readonly postgres?: {\n readonly nativeType: string; // e.g. 'integer', 'text', 'vector', 'timestamp with time zone'\n };\n };\n };\n}\n\n/**\n * SQL codec — extends the framework codec base with SQL-specific metadata:\n * driver-native type info (`meta.db.sql.<dialect>.nativeType`) and an\n * optional parameterized-codec descriptor (`paramsSchema` + `init`) for\n * codecs that require type-parameter validation (e.g. `pg/vector@1`).\n *\n * `encode` and `decode` are redeclared here to narrow the per-call\n * context to the SQL-family {@link SqlCodecCallContext} (adds\n * `column?: SqlColumnRef`). TypeScript treats method-syntax declarations\n * bivariantly, so the SQL narrowing is structurally compatible with the\n * framework {@link BaseCodec} super-interface.\n *\n * See `Codec` in `@prisma-next/framework-components/codec` for the codec\n * contract that this interface extends.\n */\nexport interface Codec<\n Id extends string = string,\n TTraits extends readonly CodecTrait[] = readonly CodecTrait[],\n TWire = unknown,\n TInput = unknown,\n TParams = Record<string, unknown>,\n THelper = unknown,\n> extends BaseCodec<Id, TTraits, TWire, TInput> {\n encode(value: TInput, ctx: SqlCodecCallContext): Promise<TWire>;\n decode(wire: TWire, ctx: SqlCodecCallContext): Promise<TInput>;\n readonly meta?: CodecMeta;\n readonly paramsSchema?: Type<TParams>;\n readonly init?: (params: TParams) => THelper;\n}\n\n/**\n * Registry interface for codecs organized by ID and by contract scalar type.\n *\n * The registry allows looking up codecs by their namespaced ID or by the\n * contract scalar types they handle. Multiple codecs may handle the same\n * scalar type; ordering in byScalar reflects preference (adapter first,\n * then packs, then app overrides).\n */\nexport interface CodecRegistry {\n get(id: string): Codec<string> | undefined;\n has(id: string): boolean;\n getByScalar(scalar: string): readonly Codec<string>[];\n getDefaultCodec(scalar: string): Codec<string> | undefined;\n register(codec: Codec<string>): void;\n /** Returns true if the codec with this ID has the given trait. */\n hasTrait(codecId: string, trait: CodecTrait): boolean;\n /** Returns all traits for a codec, or an empty array if not found. */\n traitsOf(codecId: string): readonly CodecTrait[];\n [Symbol.iterator](): Iterator<Codec<string>>;\n values(): IterableIterator<Codec<string>>;\n}\n\n/**\n * Implementation of CodecRegistry.\n */\nclass CodecRegistryImpl implements CodecRegistry {\n private readonly _byId = new Map<string, Codec<string>>();\n private readonly _byScalar = new Map<string, Codec<string>[]>();\n\n /**\n * Map-like interface for codec lookup by ID.\n * Example: registry.get('pg/text@1')\n */\n get(id: string): Codec<string> | undefined {\n return this._byId.get(id);\n }\n\n /**\n * Check if a codec with the given ID is registered.\n */\n has(id: string): boolean {\n return this._byId.has(id);\n }\n\n /**\n * Get all codecs that handle a given scalar type.\n * Returns an empty frozen array if no codecs are found.\n * Example: registry.getByScalar('text') → [codec1, codec2, ...]\n */\n getByScalar(scalar: string): readonly Codec<string>[] {\n return this._byScalar.get(scalar) ?? Object.freeze([]);\n }\n\n /**\n * Get the default codec for a scalar type (first registered codec).\n * Returns undefined if no codec handles this scalar type.\n */\n getDefaultCodec(scalar: string): Codec<string> | undefined {\n const _codecs = this._byScalar.get(scalar);\n return _codecs?.[0];\n }\n\n /**\n * Register a codec in the registry.\n * Throws an error if a codec with the same ID is already registered.\n *\n * @param codec - The codec to register\n * @throws Error if a codec with the same ID already exists\n */\n register(codec: Codec<string>): void {\n if (this._byId.has(codec.id)) {\n throw new Error(`Codec with ID '${codec.id}' is already registered`);\n }\n\n this._byId.set(codec.id, codec);\n\n // Update byScalar mapping\n for (const scalarType of codec.targetTypes) {\n const existing = this._byScalar.get(scalarType);\n if (existing) {\n existing.push(codec);\n } else {\n this._byScalar.set(scalarType, [codec]);\n }\n }\n }\n\n hasTrait(codecId: string, trait: CodecTrait): boolean {\n const codec = this._byId.get(codecId);\n return codec?.traits?.includes(trait) ?? false;\n }\n\n traitsOf(codecId: string): readonly CodecTrait[] {\n return this._byId.get(codecId)?.traits ?? [];\n }\n\n /**\n * Returns an iterator over all registered codecs.\n * Useful for iterating through codecs from another registry.\n */\n *[Symbol.iterator](): Iterator<Codec<string>> {\n for (const codec of this._byId.values()) {\n yield codec;\n }\n }\n\n /**\n * Returns an iterable of all registered codecs.\n */\n values(): IterableIterator<Codec<string>> {\n return this._byId.values();\n }\n}\n\n/**\n * Conditional bundle for `encodeJson`/`decodeJson`: when `TInput` is\n * structurally assignable to `JsonValue` the identity defaults are\n * sound and both fields are optional; otherwise both fields are\n * required so an author cannot silently produce a non-JSON-safe\n * contract artifact.\n */\ntype JsonRoundTripConfig<TInput> = [TInput] extends [JsonValue]\n ? {\n encodeJson?: (value: TInput) => JsonValue;\n decodeJson?: (json: JsonValue) => TInput;\n }\n : {\n encodeJson: (value: TInput) => JsonValue;\n decodeJson: (json: JsonValue) => TInput;\n };\n\n/**\n * Construct a SQL codec from author functions and optional metadata.\n *\n * Author `encode` and `decode` as sync or async functions; the factory\n * produces a {@link Codec} whose query-time methods follow the boundary\n * contract documented on `Codec`. Authors receive a second `ctx` options\n * argument carrying the SQL-family per-call context; ignore it if you\n * don't need it.\n *\n * Both `encode` and `decode` are required so `TInput` and `TWire` are\n * always covered by an explicit author function — the factory installs\n * no identity fallback. `encodeJson` and `decodeJson` default to identity\n * **only when `TInput` is assignable to `JsonValue`**; otherwise both are\n * required so the contract artifact stays JSON-safe.\n */\nexport function codec<\n Id extends string,\n const TTraits extends readonly CodecTrait[] = readonly [],\n TWire = unknown,\n TInput = unknown,\n TParams = Record<string, unknown>,\n THelper = unknown,\n>(\n config: {\n typeId: Id;\n targetTypes: readonly string[];\n encode: (value: TInput, ctx: SqlCodecCallContext) => TWire | Promise<TWire>;\n decode: (wire: TWire, ctx: SqlCodecCallContext) => TInput | Promise<TInput>;\n meta?: CodecMeta;\n paramsSchema?: Type<TParams>;\n init?: (params: TParams) => THelper;\n traits?: TTraits;\n renderOutputType?: (typeParams: Record<string, unknown>) => string | undefined;\n } & JsonRoundTripConfig<TInput>,\n): Codec<Id, TTraits, TWire, TInput, TParams, THelper> {\n const identity = (v: unknown) => v;\n // The runtime allocates one `SqlCodecCallContext` per `runtime.execute()`\n // call (no caller-supplied `signal` produces `{}` instead of `undefined`)\n // and threads it as a non-optional reference to every codec call. The\n // author surface keeps the second parameter optional so single-arg\n // `(value) => …` authors continue to satisfy the signature via\n // TypeScript's bivariance for trailing parameters.\n const userEncode = config.encode;\n const userDecode = config.decode;\n // The conditional JsonRoundTripConfig narrows TInput|JsonValue at the\n // boundary; widen back to the generic shape inside the factory body.\n const widenedConfig = config as {\n encodeJson?: (value: TInput) => JsonValue;\n decodeJson?: (json: JsonValue) => TInput;\n };\n return {\n id: config.typeId,\n targetTypes: config.targetTypes,\n ...ifDefined('meta', config.meta),\n ...ifDefined('paramsSchema', config.paramsSchema),\n ...ifDefined('init', config.init),\n ...ifDefined(\n 'traits',\n config.traits ? (Object.freeze([...config.traits]) as TTraits) : undefined,\n ),\n ...ifDefined('renderOutputType', config.renderOutputType),\n encode: (value, ctx) => {\n try {\n return Promise.resolve(userEncode(value, ctx));\n } catch (error) {\n return Promise.reject(error);\n }\n },\n decode: (wire, ctx) => {\n try {\n return Promise.resolve(userDecode(wire, ctx));\n } catch (error) {\n return Promise.reject(error);\n }\n },\n encodeJson: (widenedConfig.encodeJson ?? identity) as (value: TInput) => JsonValue,\n decodeJson: (widenedConfig.decodeJson ?? identity) as (json: JsonValue) => TInput,\n };\n}\n\n/**\n * Type helpers to extract codec types.\n */\nexport type CodecId<T> =\n T extends Codec<infer Id> ? Id : T extends { readonly id: infer Id } ? Id : never;\nexport type CodecInput<T> =\n T extends Codec<string, readonly CodecTrait[], unknown, infer In> ? In : never;\nexport type CodecTraits<T> =\n T extends Codec<string, infer TTraits> ? TTraits[number] & CodecTrait : never;\n\n/**\n * Type helper to extract codec types from builder instance.\n */\nexport type ExtractCodecTypes<\n ScalarNames extends { readonly [K in keyof ScalarNames]: Codec<string> } = Record<never, never>,\n> = {\n readonly [K in keyof ScalarNames as ScalarNames[K] extends Codec<infer Id> ? Id : never]: {\n readonly input: CodecInput<ScalarNames[K]>;\n readonly output: CodecInput<ScalarNames[K]>;\n readonly traits: CodecTraits<ScalarNames[K]>;\n };\n};\n\n/**\n * Type helper to extract data type IDs from builder instance.\n * Uses ExtractCodecTypes which preserves literal types as keys.\n * Since ExtractCodecTypes<Record<K, ScalarNames[K]>> has exactly one key (the Id),\n * we extract it by creating a mapped type that uses the Id as both key and value,\n * then extract the value type. This preserves literal types.\n */\nexport type ExtractDataTypes<\n ScalarNames extends { readonly [K in keyof ScalarNames]: Codec<string> },\n> = {\n readonly [K in keyof ScalarNames]: {\n readonly [Id in keyof ExtractCodecTypes<Record<K, ScalarNames[K]>>]: Id;\n }[keyof ExtractCodecTypes<Record<K, ScalarNames[K]>>];\n};\n\n/**\n * Builder interface for declaring codecs.\n */\nexport interface CodecDefBuilder<\n ScalarNames extends { readonly [K in keyof ScalarNames]: Codec<string> } = Record<never, never>,\n> {\n readonly CodecTypes: ExtractCodecTypes<ScalarNames>;\n\n add<ScalarName extends string, CodecImpl extends Codec<string>>(\n scalarName: ScalarName,\n codecImpl: CodecImpl,\n ): CodecDefBuilder<\n O.Overwrite<ScalarNames, Record<ScalarName, CodecImpl>> & Record<ScalarName, CodecImpl>\n >;\n\n readonly codecDefinitions: {\n readonly [K in keyof ScalarNames]: {\n readonly typeId: ScalarNames[K] extends Codec<infer Id extends string> ? Id : never;\n readonly scalar: K;\n readonly codec: ScalarNames[K];\n readonly input: CodecInput<ScalarNames[K]>;\n readonly output: CodecInput<ScalarNames[K]>;\n readonly jsType: CodecInput<ScalarNames[K]>;\n };\n };\n\n readonly dataTypes: {\n readonly [K in keyof ScalarNames]: {\n readonly [Id in keyof ExtractCodecTypes<Record<K, ScalarNames[K]>>]: Id;\n }[keyof ExtractCodecTypes<Record<K, ScalarNames[K]>>];\n };\n}\n\n/**\n * Implementation of CodecDefBuilder.\n */\nclass CodecDefBuilderImpl<\n ScalarNames extends { readonly [K in keyof ScalarNames]: Codec<string> } = Record<never, never>,\n> implements CodecDefBuilder<ScalarNames>\n{\n private readonly _codecs: ScalarNames;\n\n public readonly CodecTypes: ExtractCodecTypes<ScalarNames>;\n public readonly dataTypes: {\n readonly [K in keyof ScalarNames]: {\n readonly [Id in keyof ExtractCodecTypes<Record<K, ScalarNames[K]>>]: Id;\n }[keyof ExtractCodecTypes<Record<K, ScalarNames[K]>>];\n };\n\n constructor(codecs: ScalarNames) {\n this._codecs = codecs;\n\n // Populate CodecTypes from codecs\n const codecTypes: Record<\n string,\n { readonly input: unknown; readonly output: unknown; readonly traits: unknown }\n > = {};\n for (const [, codecImpl] of Object.entries(this._codecs)) {\n const codecImplTyped = codecImpl as Codec<string>;\n codecTypes[codecImplTyped.id] = {\n input: undefined as unknown as CodecInput<typeof codecImplTyped>,\n output: undefined as unknown as CodecInput<typeof codecImplTyped>,\n traits: undefined as unknown as CodecTraits<typeof codecImplTyped>,\n };\n }\n this.CodecTypes = codecTypes as ExtractCodecTypes<ScalarNames>;\n\n // Populate dataTypes from codecs - extract id property from each codec\n // Build object preserving keys from ScalarNames\n // Type assertion is safe because we know ScalarNames structure matches the return type\n // biome-ignore lint/suspicious/noExplicitAny: dynamic codec mapping requires any\n const dataTypes = {} as any;\n for (const key in this._codecs) {\n if (Object.hasOwn(this._codecs, key)) {\n const codec = this._codecs[key] as Codec<string>;\n dataTypes[key] = codec.id;\n }\n }\n this.dataTypes = dataTypes as {\n readonly [K in keyof ScalarNames]: {\n readonly [Id in keyof ExtractCodecTypes<Record<K, ScalarNames[K]>>]: Id;\n }[keyof ExtractCodecTypes<Record<K, ScalarNames[K]>>];\n };\n }\n\n add<ScalarName extends string, CodecImpl extends Codec<string>>(\n scalarName: ScalarName,\n codecImpl: CodecImpl,\n ): CodecDefBuilder<\n O.Overwrite<ScalarNames, Record<ScalarName, CodecImpl>> & Record<ScalarName, CodecImpl>\n > {\n return new CodecDefBuilderImpl({\n ...this._codecs,\n [scalarName]: codecImpl,\n } as O.Overwrite<ScalarNames, Record<ScalarName, CodecImpl>> & Record<ScalarName, CodecImpl>);\n }\n\n /**\n * Derive codecDefinitions structure.\n */\n get codecDefinitions(): {\n readonly [K in keyof ScalarNames]: {\n readonly typeId: ScalarNames[K] extends Codec<infer Id> ? Id : never;\n readonly scalar: K;\n readonly codec: ScalarNames[K];\n readonly input: CodecInput<ScalarNames[K]>;\n readonly output: CodecInput<ScalarNames[K]>;\n readonly jsType: CodecInput<ScalarNames[K]>;\n };\n } {\n const result: Record<\n string,\n {\n typeId: string;\n scalar: string;\n codec: Codec;\n input: unknown;\n output: unknown;\n jsType: unknown;\n }\n > = {};\n\n for (const [scalarName, codecImpl] of Object.entries(this._codecs)) {\n const codec = codecImpl as Codec<string>;\n result[scalarName] = {\n typeId: codec.id,\n scalar: scalarName,\n codec: codec,\n input: undefined as unknown as CodecInput<typeof codec>,\n output: undefined as unknown as CodecInput<typeof codec>,\n jsType: undefined as unknown as CodecInput<typeof codec>,\n };\n }\n\n return result as {\n readonly [K in keyof ScalarNames]: {\n readonly typeId: ScalarNames[K] extends Codec<infer Id extends string> ? Id : never;\n readonly scalar: K;\n readonly codec: ScalarNames[K];\n readonly input: CodecInput<ScalarNames[K]>;\n readonly output: CodecInput<ScalarNames[K]>;\n readonly jsType: CodecInput<ScalarNames[K]>;\n };\n };\n }\n}\n\n/**\n * Create a new codec registry.\n */\nexport function createCodecRegistry(): CodecRegistry {\n return new CodecRegistryImpl();\n}\n\n/**\n * Create a new codec definition builder.\n */\nexport function defineCodecs(): CodecDefBuilder<Record<never, never>> {\n return new CodecDefBuilderImpl({});\n}\n","import type { JsonValue } from '@prisma-next/contract/types';\nimport { type as arktype } from 'arktype';\nimport { codec, defineCodecs } from './codec-types';\n\nexport const SQL_CHAR_CODEC_ID = 'sql/char@1' as const;\nexport const SQL_VARCHAR_CODEC_ID = 'sql/varchar@1' as const;\nexport const SQL_INT_CODEC_ID = 'sql/int@1' as const;\nexport const SQL_FLOAT_CODEC_ID = 'sql/float@1' as const;\nexport const SQL_TEXT_CODEC_ID = 'sql/text@1' as const;\nexport const SQL_TIMESTAMP_CODEC_ID = 'sql/timestamp@1' as const;\n\nconst lengthParamsSchema = arktype({\n length: 'number.integer > 0',\n});\n\nconst precisionParamsSchema = arktype({\n 'precision?': 'number.integer >= 0 & number.integer <= 6',\n});\n\ntype LengthTypeHelper = {\n readonly kind: 'fixed' | 'variable';\n readonly maxLength: number;\n};\n\nfunction createLengthTypeHelper(\n kind: LengthTypeHelper['kind'],\n): (params: Record<string, unknown>) => LengthTypeHelper {\n return (params) => ({\n kind,\n maxLength: params['length'] as number,\n });\n}\n\nconst sqlCharCodec = codec<\n typeof SQL_CHAR_CODEC_ID,\n readonly ['equality', 'order', 'textual'],\n string,\n string\n>({\n typeId: SQL_CHAR_CODEC_ID,\n targetTypes: ['char'],\n traits: ['equality', 'order', 'textual'],\n encode: (value: string): string => value,\n decode: (wire: string): string => wire.trimEnd(),\n paramsSchema: lengthParamsSchema,\n init: createLengthTypeHelper('fixed'),\n renderOutputType: (typeParams) => {\n const length = typeParams['length'];\n if (length === undefined) return undefined;\n if (typeof length !== 'number' || !Number.isFinite(length) || !Number.isInteger(length)) {\n throw new Error(\n `renderOutputType: expected integer \"length\" in typeParams for Char, got ${String(length)}`,\n );\n }\n return `Char<${length}>`;\n },\n});\n\nconst sqlVarcharCodec = codec<\n typeof SQL_VARCHAR_CODEC_ID,\n readonly ['equality', 'order', 'textual'],\n string,\n string\n>({\n typeId: SQL_VARCHAR_CODEC_ID,\n targetTypes: ['varchar'],\n traits: ['equality', 'order', 'textual'],\n encode: (value: string): string => value,\n decode: (wire: string): string => wire,\n paramsSchema: lengthParamsSchema,\n init: createLengthTypeHelper('variable'),\n renderOutputType: (typeParams) => {\n const length = typeParams['length'];\n if (length === undefined) return undefined;\n if (typeof length !== 'number' || !Number.isFinite(length) || !Number.isInteger(length)) {\n throw new Error(\n `renderOutputType: expected integer \"length\" in typeParams for Varchar, got ${String(length)}`,\n );\n }\n return `Varchar<${length}>`;\n },\n});\n\nconst sqlIntCodec = codec({\n typeId: SQL_INT_CODEC_ID,\n targetTypes: ['int'],\n traits: ['equality', 'order', 'numeric'],\n encode: (value: number): number => value,\n decode: (wire: number): number => wire,\n});\n\nconst sqlFloatCodec = codec({\n typeId: SQL_FLOAT_CODEC_ID,\n targetTypes: ['float'],\n traits: ['equality', 'order', 'numeric'],\n encode: (value: number): number => value,\n decode: (wire: number): number => wire,\n});\n\nconst sqlTextCodec = codec({\n typeId: SQL_TEXT_CODEC_ID,\n targetTypes: ['text'],\n traits: ['equality', 'order', 'textual'],\n encode: (value: string): string => value,\n decode: (wire: string): string => wire,\n});\n\nconst sqlTimestampCodec = codec<\n typeof SQL_TIMESTAMP_CODEC_ID,\n readonly ['equality', 'order'],\n Date,\n Date\n>({\n typeId: SQL_TIMESTAMP_CODEC_ID,\n targetTypes: ['timestamp'],\n traits: ['equality', 'order'],\n encode: (value: Date): Date => value,\n decode: (wire: Date): Date => wire,\n encodeJson: (value: Date): JsonValue => value.toISOString(),\n decodeJson: (json: JsonValue): Date => {\n if (typeof json !== 'string') {\n throw new Error(`Expected ISO date string for sql/timestamp@1, got ${typeof json}`);\n }\n const date = new Date(json);\n if (Number.isNaN(date.getTime())) {\n throw new Error(`Invalid ISO date string for sql/timestamp@1: ${json}`);\n }\n return date;\n },\n paramsSchema: precisionParamsSchema,\n renderOutputType: (typeParams) => {\n const precision = typeParams['precision'];\n if (precision === undefined) {\n return 'Timestamp';\n }\n if (\n typeof precision !== 'number' ||\n !Number.isFinite(precision) ||\n !Number.isInteger(precision)\n ) {\n throw new Error(\n `renderOutputType: expected integer \"precision\" in typeParams for Timestamp, got ${String(precision)}`,\n );\n }\n return `Timestamp<${precision}>`;\n },\n});\n\nconst codecs = defineCodecs()\n .add('char', sqlCharCodec)\n .add('varchar', sqlVarcharCodec)\n .add('int', sqlIntCodec)\n .add('float', sqlFloatCodec)\n .add('text', sqlTextCodec)\n .add('timestamp', sqlTimestampCodec);\n\nexport const sqlCodecDefinitions = codecs.codecDefinitions;\nexport const sqlDataTypes = codecs.dataTypes;\nexport type SqlCodecTypes = typeof codecs.CodecTypes;\n","import type { AnyQueryAst, ParamRef } from './types';\n\nexport function compact<T extends Record<string, unknown>>(o: T): T {\n const out: Record<string, unknown> = {};\n for (const [k, v] of Object.entries(o)) {\n if (v === undefined || v === null) continue;\n if (Array.isArray(v) && v.length === 0) continue;\n out[k] = v;\n }\n return out as T;\n}\n\n/**\n * Walks an AST's parameter references in first-encounter order and dedupes\n * by ParamRef identity. The single canonical helper used by every consumer\n * that aligns `plan.params` with metadata-by-index — the SQL builder lane,\n * the SQL ORM client, the SQL runtime encoder, and the Postgres renderer's\n * `$N` index map — so the four walks cannot drift in dedupe semantics.\n *\n * SQLite's `?`-placeholder renderer intentionally does NOT use this helper\n * because it needs one params entry per occurrence in the SQL.\n */\nexport function collectOrderedParamRefs(ast: AnyQueryAst): ReadonlyArray<ParamRef> {\n const seen = new Set<ParamRef>();\n const ordered: ParamRef[] = [];\n for (const ref of ast.collectParamRefs()) {\n if (seen.has(ref)) continue;\n seen.add(ref);\n ordered.push(ref);\n }\n return Object.freeze(ordered);\n}\n"],"mappings":";;;;;;;;AA2IA,IAAM,oBAAN,MAAiD;CAC/C,AAAiB,wBAAQ,IAAI,KAA4B;CACzD,AAAiB,4BAAY,IAAI,KAA8B;;;;;CAM/D,IAAI,IAAuC;AACzC,SAAO,KAAK,MAAM,IAAI,GAAG;;;;;CAM3B,IAAI,IAAqB;AACvB,SAAO,KAAK,MAAM,IAAI,GAAG;;;;;;;CAQ3B,YAAY,QAA0C;AACpD,SAAO,KAAK,UAAU,IAAI,OAAO,IAAI,OAAO,OAAO,EAAE,CAAC;;;;;;CAOxD,gBAAgB,QAA2C;AAEzD,SADgB,KAAK,UAAU,IAAI,OAAO,GACzB;;;;;;;;;CAUnB,SAAS,SAA4B;AACnC,MAAI,KAAK,MAAM,IAAIA,QAAM,GAAG,CAC1B,OAAM,IAAI,MAAM,kBAAkBA,QAAM,GAAG,yBAAyB;AAGtE,OAAK,MAAM,IAAIA,QAAM,IAAIA,QAAM;AAG/B,OAAK,MAAM,cAAcA,QAAM,aAAa;GAC1C,MAAM,WAAW,KAAK,UAAU,IAAI,WAAW;AAC/C,OAAI,SACF,UAAS,KAAKA,QAAM;OAEpB,MAAK,UAAU,IAAI,YAAY,CAACA,QAAM,CAAC;;;CAK7C,SAAS,SAAiB,OAA4B;AAEpD,SADc,KAAK,MAAM,IAAI,QAAQ,EACvB,QAAQ,SAAS,MAAM,IAAI;;CAG3C,SAAS,SAAwC;AAC/C,SAAO,KAAK,MAAM,IAAI,QAAQ,E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output: unknown; readonly traits: unknown }\n >","result: Record<\n string,\n {\n typeId: string;\n scalar: string;\n codec: Codec;\n input: unknown;\n output: unknown;\n jsType: unknown;\n }\n >","arktype","out: Record<string, unknown>","ordered: ParamRef[]"],"sources":["../../src/ast/codec-types.ts","../../src/ast/sql-codecs.ts","../../src/ast/util.ts"],"sourcesContent":["import type { JsonValue } from '@prisma-next/contract/types';\nimport type {\n Codec as BaseCodec,\n CodecCallContext,\n CodecInstanceContext,\n CodecTrait,\n} from '@prisma-next/framework-components/codec';\nimport { ifDefined } from '@prisma-next/utils/defined';\nimport type { Type } from 'arktype';\nimport type { O } from 'ts-toolbelt';\n\nexport type { CodecCallContext, CodecTrait } from '@prisma-next/framework-components/codec';\n\n/**\n * SQL-family addressing of a single column. The decode site populates a\n * `SqlColumnRef` whenever it can resolve the cell to a single underlying\n * `(table, column)` (the typical case for projected columns from a\n * single-table source); cells the runtime cannot resolve (aggregate\n * aliases, include aggregate fields, computed projections without a\n * simple ref) get `column = undefined`.\n *\n * The shape is a structural projection of the runtime's `ColumnRef` so\n * the SQL decode site can reuse the resolution it already performs for\n * `RUNTIME.DECODE_FAILED` envelope construction without allocating\n * twice per cell.\n */\nexport interface SqlColumnRef {\n readonly table: string;\n readonly name: string;\n}\n\n/**\n * SQL-family per-call context. Extends the framework {@link CodecCallContext}\n * (which carries `signal` only) with `column?: SqlColumnRef`, populated\n * on **decode** call sites that can resolve a single underlying column\n * ref. Encode call sites currently leave `column` undefined (encode-time\n * column context is the middleware's domain).\n *\n * SQL codec authors writing a `(value, ctx)` author function for the SQL\n * `codec()` factory observe this type. The framework codec dispatch\n * surface (and Mongo) sees only the base `CodecCallContext`.\n */\nexport interface SqlCodecCallContext extends CodecCallContext {\n readonly column?: SqlColumnRef;\n}\n\n/**\n * SQL-family per-instance context. Extends the framework\n * {@link CodecInstanceContext} (`name` only) with `usedAt`, the set of\n * `(table, column)` pairs the resolved codec serves.\n *\n * - For `typeRef` columns sharing one named `storage.types` instance, the\n * array lists every referencing column — a column-scoped stateful codec\n * (e.g. encryption) can derive aggregated per-instance state across all\n * the columns sharing the named instance.\n * - For inline-`typeParams` columns, the array has exactly one entry —\n * the column that owns the inline params.\n * - For shared non-parameterized codecs, the array carries one\n * representative entry (the column that triggered materialization);\n * the codec is shared across every column with that codec id, so the\n * `usedAt` is informational only.\n *\n * SQL extensions consuming `usedAt` (e.g. column-scoped state derivation)\n * type their factory parameter as `SqlCodecInstanceContext`. Extensions\n * that don't read `usedAt` type their factory parameter as the\n * family-agnostic {@link CodecInstanceContext} — a `SqlCodecInstanceContext`\n * is structurally assignable to the base.\n */\nexport interface SqlCodecInstanceContext extends CodecInstanceContext {\n readonly usedAt: ReadonlyArray<{ readonly table: string; readonly column: string }>;\n}\n\n/**\n * Legacy adapter-level descriptor for parameterized codecs that require\n * type-parameter validation at compile time. The runtime descriptor\n * (`RuntimeParameterizedCodecDescriptor` in `@prisma-next/sql-runtime`)\n * has migrated to the unified `CodecDescriptor<P>` shape with\n * `factory: (P) => (CodecInstanceContext) => Codec`; this descriptor stays only because\n * the SQL `Adapter.parameterizedCodecs()` surface still returns\n * `CodecParamsDescriptor[]` (compile-time typeParams validation only,\n * not runtime materialization).\n *\n * Retirement is tracked under TML-2357 T3.5.4 (single registration slot)\n * — the adapter-level `parameterizedCodecs()` collapses into the unified\n * runtime descriptor map once contributors migrate fully.\n *\n * @template TParams - The shape of the type parameters (e.g., `{ length: number }`)\n * @template THelper - The type returned by the optional `init` hook\n */\nexport interface CodecParamsDescriptor<TParams = Record<string, unknown>, THelper = unknown> {\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 * 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 * Predecessor pattern. The runtime descriptor's curried\n * `factory: (P) => (CodecInstanceContext) => Codec` subsumes this hook — per-instance\n * state lives on the resolved codec rather than in a parallel\n * `TypeHelperRegistry` entry. Retirement tracked under TML-2357 T3.5.2\n * (narrow runtime `Codec` interface) and T3.5.4 (single registration\n * slot). Adapter-level callers reading codec-self-carried `init` should\n * migrate to the runtime descriptor map's factory instead.\n */\n readonly init?: (params: TParams) => THelper;\n}\n\n/**\n * Codec metadata for database-specific type information.\n * Used for schema introspection and verification.\n */\nexport interface CodecMeta {\n readonly db?: {\n readonly sql?: {\n readonly postgres?: {\n readonly nativeType: string; // e.g. 'integer', 'text', 'vector', 'timestamp with time zone'\n };\n };\n };\n}\n\n/**\n * SQL codec — extends the framework codec base with SQL-specific metadata:\n * driver-native type info (`meta.db.sql.<dialect>.nativeType`) and an\n * optional parameterized-codec descriptor (`paramsSchema` + `init`) for\n * codecs that require type-parameter validation (e.g. `pg/vector@1`).\n *\n * `encode` and `decode` are redeclared here to narrow the per-call\n * context to the SQL-family {@link SqlCodecCallContext} (adds\n * `column?: SqlColumnRef`). TypeScript treats method-syntax declarations\n * bivariantly, so the SQL narrowing is structurally compatible with the\n * framework {@link BaseCodec} super-interface.\n *\n * Note: `paramsSchema` and `init` here are the legacy adapter-level slots\n * mirrored from {@link CodecParamsDescriptor}. The runtime materialization\n * path uses `RuntimeParameterizedCodecDescriptor` (in\n * `@prisma-next/sql-runtime`) via the unified `CodecDescriptor<P>` shape;\n * codec-self-carried `paramsSchema`/`init` retire under TML-2357 (T3.5.2\n * narrows the runtime `Codec` interface; T3.5.4 collapses the parallel\n * registration slots).\n *\n * See `Codec` in `@prisma-next/framework-components/codec` for the codec\n * contract that this interface extends.\n */\nexport interface Codec<\n Id extends string = string,\n TTraits extends readonly CodecTrait[] = readonly CodecTrait[],\n TWire = unknown,\n TInput = unknown,\n TParams = Record<string, unknown>,\n THelper = unknown,\n> extends BaseCodec<Id, TTraits, TWire, TInput> {\n encode(value: TInput, ctx: SqlCodecCallContext): Promise<TWire>;\n decode(wire: TWire, ctx: SqlCodecCallContext): Promise<TInput>;\n readonly meta?: CodecMeta;\n readonly paramsSchema?: Type<TParams>;\n /**\n * Predecessor init hook. Retirement tracked under TML-2357 (T3.5.2 /\n * T3.5.4); the unified runtime descriptor's\n * `factory: (P) => (CodecInstanceContext) => Codec` is the replacement.\n */\n readonly init?: (params: TParams) => THelper;\n}\n\n/**\n * Contract-bound codec registry.\n *\n * The dispatch interface for encode/decode at runtime: built once at\n * `ExecutionContext` construction time by walking the contract's\n * `storage.tables[].columns[]` and resolving each column to either a per-\n * instance parameterized codec (via `descriptor.factory(typeParams)(ctx)`)\n * or the shared codec instance from the legacy `CodecRegistry` (for non-\n * parameterized codecs). The dispatch path calls\n * `forColumn(table, column).encode/decode(...)` and doesn't know whether\n * the codec is parameterized.\n *\n * `forCodecId(codecId)` is a fallback for sites that don't carry the\n * `(table, column)` ref through to the encode/decode call site —\n * primarily the param-encoding path, where `ParamRef.refs` is not\n * populated by the SQL builder today (every `ParamRef` carries `codecId`\n * but not the column it relates to). For the parameterized codecs shipped\n * at Phase B, encode is per-instance-stateless (pgvector formats\n * `[v1,v2,v3]` regardless of length; JSON's `encode` is `JSON.stringify`\n * regardless of schema), so a codec-id-keyed lookup yields a structurally\n * equivalent encoder; the fallback is the bridge that lets the legacy\n * `codecs:` registration retire from the dispatch path while staying as\n * the codec-id-only source for now.\n *\n * The encode-side fallback is the AC-5-deferred carve-out documented in\n * the codec-registry-unification spec § Non-functional constraints.\n * TML-2357 retires the fallback by threading `ParamRef.refs` through\n * column-bound construction sites.\n */\nexport interface ContractCodecRegistry {\n /**\n * Resolve the codec for `(table, column)`. Returns the per-instance\n * parameterized codec for parameterized columns, the shared codec for\n * non-parameterized columns, or `undefined` if the column is unknown\n * or the codec isn't registered.\n */\n forColumn(table: string, column: string): Codec | undefined;\n\n /**\n * Resolve a codec by id. Returns the same codec instance the legacy\n * `CodecRegistry.get(codecId)` would return — for non-parameterized\n * codecs that's the shared instance; for parameterized codecs that's\n * a representative resolved instance. Used by sites that don't carry\n * `(table, column)` through to the encode/decode call site (the AC-5\n * carve-out path).\n */\n forCodecId(codecId: string): Codec | undefined;\n}\n\n/**\n * Registry interface for codecs organized by ID and by contract scalar type.\n *\n * The registry allows looking up codecs by their namespaced ID or by the\n * contract scalar types they handle. Multiple codecs may handle the same\n * scalar type; ordering in byScalar reflects preference (adapter first,\n * then packs, then app overrides).\n */\nexport interface CodecRegistry {\n get(id: string): Codec<string> | undefined;\n has(id: string): boolean;\n getByScalar(scalar: string): readonly Codec<string>[];\n getDefaultCodec(scalar: string): Codec<string> | undefined;\n register(codec: Codec<string>): void;\n /** Returns true if the codec with this ID has the given trait. */\n hasTrait(codecId: string, trait: CodecTrait): boolean;\n /** Returns all traits for a codec, or an empty array if not found. */\n traitsOf(codecId: string): readonly CodecTrait[];\n [Symbol.iterator](): Iterator<Codec<string>>;\n values(): IterableIterator<Codec<string>>;\n}\n\n/**\n * Implementation of CodecRegistry.\n */\nclass CodecRegistryImpl implements CodecRegistry {\n private readonly _byId = new Map<string, Codec<string>>();\n private readonly _byScalar = new Map<string, Codec<string>[]>();\n\n /**\n * Map-like interface for codec lookup by ID.\n * Example: registry.get('pg/text@1')\n */\n get(id: string): Codec<string> | undefined {\n return this._byId.get(id);\n }\n\n /**\n * Check if a codec with the given ID is registered.\n */\n has(id: string): boolean {\n return this._byId.has(id);\n }\n\n /**\n * Get all codecs that handle a given scalar type.\n * Returns an empty frozen array if no codecs are found.\n * Example: registry.getByScalar('text') → [codec1, codec2, ...]\n */\n getByScalar(scalar: string): readonly Codec<string>[] {\n return this._byScalar.get(scalar) ?? Object.freeze([]);\n }\n\n /**\n * Get the default codec for a scalar type (first registered codec).\n * Returns undefined if no codec handles this scalar type.\n */\n getDefaultCodec(scalar: string): Codec<string> | undefined {\n const _codecs = this._byScalar.get(scalar);\n return _codecs?.[0];\n }\n\n /**\n * Register a codec in the registry.\n * Throws an error if a codec with the same ID is already registered.\n *\n * @param codec - The codec to register\n * @throws Error if a codec with the same ID already exists\n */\n register(codec: Codec<string>): void {\n if (this._byId.has(codec.id)) {\n throw new Error(`Codec with ID '${codec.id}' is already registered`);\n }\n\n this._byId.set(codec.id, codec);\n\n // Update byScalar mapping\n for (const scalarType of codec.targetTypes) {\n const existing = this._byScalar.get(scalarType);\n if (existing) {\n existing.push(codec);\n } else {\n this._byScalar.set(scalarType, [codec]);\n }\n }\n }\n\n hasTrait(codecId: string, trait: CodecTrait): boolean {\n const codec = this._byId.get(codecId);\n return codec?.traits?.includes(trait) ?? false;\n }\n\n traitsOf(codecId: string): readonly CodecTrait[] {\n return this._byId.get(codecId)?.traits ?? [];\n }\n\n /**\n * Returns an iterator over all registered codecs.\n * Useful for iterating through codecs from another registry.\n */\n *[Symbol.iterator](): Iterator<Codec<string>> {\n for (const codec of this._byId.values()) {\n yield codec;\n }\n }\n\n /**\n * Returns an iterable of all registered codecs.\n */\n values(): IterableIterator<Codec<string>> {\n return this._byId.values();\n }\n}\n\n/**\n * Conditional bundle for `encodeJson`/`decodeJson`: when `TInput` is\n * structurally assignable to `JsonValue` the identity defaults are\n * sound and both fields are optional; otherwise both fields are\n * required so an author cannot silently produce a non-JSON-safe\n * contract artifact.\n */\ntype JsonRoundTripConfig<TInput> = [TInput] extends [JsonValue]\n ? {\n encodeJson?: (value: TInput) => JsonValue;\n decodeJson?: (json: JsonValue) => TInput;\n }\n : {\n encodeJson: (value: TInput) => JsonValue;\n decodeJson: (json: JsonValue) => TInput;\n };\n\n/**\n * Construct a SQL codec from author functions and optional metadata.\n *\n * Author `encode` and `decode` as sync or async functions; the factory\n * produces a {@link Codec} whose query-time methods follow the boundary\n * contract documented on `Codec`. Authors receive a second `ctx` options\n * argument carrying the SQL-family per-call context; ignore it if you\n * don't need it.\n *\n * Both `encode` and `decode` are required so `TInput` and `TWire` are\n * always covered by an explicit author function — the factory installs\n * no identity fallback. `encodeJson` and `decodeJson` default to identity\n * **only when `TInput` is assignable to `JsonValue`**; otherwise both are\n * required so the contract artifact stays JSON-safe.\n */\nexport function codec<\n Id extends string,\n const TTraits extends readonly CodecTrait[] = readonly [],\n TWire = unknown,\n TInput = unknown,\n TParams = Record<string, unknown>,\n THelper = unknown,\n>(\n config: {\n typeId: Id;\n targetTypes: readonly string[];\n encode: (value: TInput, ctx: SqlCodecCallContext) => TWire | Promise<TWire>;\n decode: (wire: TWire, ctx: SqlCodecCallContext) => TInput | Promise<TInput>;\n meta?: CodecMeta;\n paramsSchema?: Type<TParams>;\n init?: (params: TParams) => THelper;\n traits?: TTraits;\n renderOutputType?: (typeParams: Record<string, unknown>) => string | undefined;\n } & JsonRoundTripConfig<TInput>,\n): Codec<Id, TTraits, TWire, TInput, TParams, THelper> {\n const identity = (v: unknown) => v;\n // The runtime allocates one `SqlCodecCallContext` per `runtime.execute()`\n // call (no caller-supplied `signal` produces `{}` instead of `undefined`)\n // and threads it as a non-optional reference to every codec call. The\n // author surface keeps the second parameter optional so single-arg\n // `(value) => …` authors continue to satisfy the signature via\n // TypeScript's bivariance for trailing parameters.\n const userEncode = config.encode;\n const userDecode = config.decode;\n // The conditional JsonRoundTripConfig narrows TInput|JsonValue at the\n // boundary; widen back to the generic shape inside the factory body.\n const widenedConfig = config as {\n encodeJson?: (value: TInput) => JsonValue;\n decodeJson?: (json: JsonValue) => TInput;\n };\n return {\n id: config.typeId,\n targetTypes: config.targetTypes,\n ...ifDefined('meta', config.meta),\n ...ifDefined('paramsSchema', config.paramsSchema),\n ...ifDefined('init', config.init),\n ...ifDefined(\n 'traits',\n config.traits ? (Object.freeze([...config.traits]) as TTraits) : undefined,\n ),\n ...ifDefined('renderOutputType', config.renderOutputType),\n encode: (value, ctx) => {\n try {\n return Promise.resolve(userEncode(value, ctx));\n } catch (error) {\n return Promise.reject(error);\n }\n },\n decode: (wire, ctx) => {\n try {\n return Promise.resolve(userDecode(wire, ctx));\n } catch (error) {\n return Promise.reject(error);\n }\n },\n encodeJson: (widenedConfig.encodeJson ?? identity) as (value: TInput) => JsonValue,\n decodeJson: (widenedConfig.decodeJson ?? identity) as (json: JsonValue) => TInput,\n };\n}\n\n/**\n * Type helpers to extract codec types.\n */\nexport type CodecId<T> =\n T extends Codec<infer Id> ? Id : T extends { readonly id: infer Id } ? Id : never;\nexport type CodecInput<T> =\n T extends Codec<string, readonly CodecTrait[], unknown, infer In> ? In : never;\nexport type CodecTraits<T> =\n T extends Codec<string, infer TTraits> ? TTraits[number] & CodecTrait : never;\n\n/**\n * Type helper to extract codec types from builder instance.\n */\nexport type ExtractCodecTypes<\n ScalarNames extends { readonly [K in keyof ScalarNames]: Codec<string> } = Record<never, never>,\n> = {\n readonly [K in keyof ScalarNames as ScalarNames[K] extends Codec<infer Id> ? Id : never]: {\n readonly input: CodecInput<ScalarNames[K]>;\n readonly output: CodecInput<ScalarNames[K]>;\n readonly traits: CodecTraits<ScalarNames[K]>;\n };\n};\n\n/**\n * Type helper to extract data type IDs from builder instance.\n * Uses ExtractCodecTypes which preserves literal types as keys.\n * Since ExtractCodecTypes<Record<K, ScalarNames[K]>> has exactly one key (the Id),\n * we extract it by creating a mapped type that uses the Id as both key and value,\n * then extract the value type. This preserves literal types.\n */\nexport type ExtractDataTypes<\n ScalarNames extends { readonly [K in keyof ScalarNames]: Codec<string> },\n> = {\n readonly [K in keyof ScalarNames]: {\n readonly [Id in keyof ExtractCodecTypes<Record<K, ScalarNames[K]>>]: Id;\n }[keyof ExtractCodecTypes<Record<K, ScalarNames[K]>>];\n};\n\n/**\n * Builder interface for declaring codecs.\n */\nexport interface CodecDefBuilder<\n ScalarNames extends { readonly [K in keyof ScalarNames]: Codec<string> } = Record<never, never>,\n> {\n readonly CodecTypes: ExtractCodecTypes<ScalarNames>;\n\n add<ScalarName extends string, CodecImpl extends Codec<string>>(\n scalarName: ScalarName,\n codecImpl: CodecImpl,\n ): CodecDefBuilder<\n O.Overwrite<ScalarNames, Record<ScalarName, CodecImpl>> & Record<ScalarName, CodecImpl>\n >;\n\n readonly codecDefinitions: {\n readonly [K in keyof ScalarNames]: {\n readonly typeId: ScalarNames[K] extends Codec<infer Id extends string> ? Id : never;\n readonly scalar: K;\n readonly codec: ScalarNames[K];\n readonly input: CodecInput<ScalarNames[K]>;\n readonly output: CodecInput<ScalarNames[K]>;\n readonly jsType: CodecInput<ScalarNames[K]>;\n };\n };\n\n readonly dataTypes: {\n readonly [K in keyof ScalarNames]: {\n readonly [Id in keyof ExtractCodecTypes<Record<K, ScalarNames[K]>>]: Id;\n }[keyof ExtractCodecTypes<Record<K, ScalarNames[K]>>];\n };\n}\n\n/**\n * Implementation of CodecDefBuilder.\n */\nclass CodecDefBuilderImpl<\n ScalarNames extends { readonly [K in keyof ScalarNames]: Codec<string> } = Record<never, never>,\n> implements CodecDefBuilder<ScalarNames>\n{\n private readonly _codecs: ScalarNames;\n\n public readonly CodecTypes: ExtractCodecTypes<ScalarNames>;\n public readonly dataTypes: {\n readonly [K in keyof ScalarNames]: {\n readonly [Id in keyof ExtractCodecTypes<Record<K, ScalarNames[K]>>]: Id;\n }[keyof ExtractCodecTypes<Record<K, ScalarNames[K]>>];\n };\n\n constructor(codecs: ScalarNames) {\n this._codecs = codecs;\n\n // Populate CodecTypes from codecs\n const codecTypes: Record<\n string,\n { readonly input: unknown; readonly output: unknown; readonly traits: unknown }\n > = {};\n for (const [, codecImpl] of Object.entries(this._codecs)) {\n const codecImplTyped = codecImpl as Codec<string>;\n codecTypes[codecImplTyped.id] = {\n input: undefined as unknown as CodecInput<typeof codecImplTyped>,\n output: undefined as unknown as CodecInput<typeof codecImplTyped>,\n traits: undefined as unknown as CodecTraits<typeof codecImplTyped>,\n };\n }\n this.CodecTypes = codecTypes as ExtractCodecTypes<ScalarNames>;\n\n // Populate dataTypes from codecs - extract id property from each codec\n // Build object preserving keys from ScalarNames\n // Type assertion is safe because we know ScalarNames structure matches the return type\n // biome-ignore lint/suspicious/noExplicitAny: dynamic codec mapping requires any\n const dataTypes = {} as any;\n for (const key in this._codecs) {\n if (Object.hasOwn(this._codecs, key)) {\n const codec = this._codecs[key] as Codec<string>;\n dataTypes[key] = codec.id;\n }\n }\n this.dataTypes = dataTypes as {\n readonly [K in keyof ScalarNames]: {\n readonly [Id in keyof ExtractCodecTypes<Record<K, ScalarNames[K]>>]: Id;\n }[keyof ExtractCodecTypes<Record<K, ScalarNames[K]>>];\n };\n }\n\n add<ScalarName extends string, CodecImpl extends Codec<string>>(\n scalarName: ScalarName,\n codecImpl: CodecImpl,\n ): CodecDefBuilder<\n O.Overwrite<ScalarNames, Record<ScalarName, CodecImpl>> & Record<ScalarName, CodecImpl>\n > {\n return new CodecDefBuilderImpl({\n ...this._codecs,\n [scalarName]: codecImpl,\n } as O.Overwrite<ScalarNames, Record<ScalarName, CodecImpl>> & Record<ScalarName, CodecImpl>);\n }\n\n /**\n * Derive codecDefinitions structure.\n */\n get codecDefinitions(): {\n readonly [K in keyof ScalarNames]: {\n readonly typeId: ScalarNames[K] extends Codec<infer Id> ? Id : never;\n readonly scalar: K;\n readonly codec: ScalarNames[K];\n readonly input: CodecInput<ScalarNames[K]>;\n readonly output: CodecInput<ScalarNames[K]>;\n readonly jsType: CodecInput<ScalarNames[K]>;\n };\n } {\n const result: Record<\n string,\n {\n typeId: string;\n scalar: string;\n codec: Codec;\n input: unknown;\n output: unknown;\n jsType: unknown;\n }\n > = {};\n\n for (const [scalarName, codecImpl] of Object.entries(this._codecs)) {\n const codec = codecImpl as Codec<string>;\n result[scalarName] = {\n typeId: codec.id,\n scalar: scalarName,\n codec: codec,\n input: undefined as unknown as CodecInput<typeof codec>,\n output: undefined as unknown as CodecInput<typeof codec>,\n jsType: undefined as unknown as CodecInput<typeof codec>,\n };\n }\n\n return result as {\n readonly [K in keyof ScalarNames]: {\n readonly typeId: ScalarNames[K] extends Codec<infer Id extends string> ? Id : never;\n readonly scalar: K;\n readonly codec: ScalarNames[K];\n readonly input: CodecInput<ScalarNames[K]>;\n readonly output: CodecInput<ScalarNames[K]>;\n readonly jsType: CodecInput<ScalarNames[K]>;\n };\n };\n }\n}\n\n/**\n * Create a new codec registry.\n */\nexport function createCodecRegistry(): CodecRegistry {\n return new CodecRegistryImpl();\n}\n\n/**\n * Create a new codec definition builder.\n */\nexport function defineCodecs(): CodecDefBuilder<Record<never, never>> {\n return new CodecDefBuilderImpl({});\n}\n","import type { JsonValue } from '@prisma-next/contract/types';\nimport { type as arktype } from 'arktype';\nimport { codec, defineCodecs } from './codec-types';\n\nexport const SQL_CHAR_CODEC_ID = 'sql/char@1' as const;\nexport const SQL_VARCHAR_CODEC_ID = 'sql/varchar@1' as const;\nexport const SQL_INT_CODEC_ID = 'sql/int@1' as const;\nexport const SQL_FLOAT_CODEC_ID = 'sql/float@1' as const;\nexport const SQL_TEXT_CODEC_ID = 'sql/text@1' as const;\nexport const SQL_TIMESTAMP_CODEC_ID = 'sql/timestamp@1' as const;\n\nconst lengthParamsSchema = arktype({\n length: 'number.integer > 0',\n});\n\nconst precisionParamsSchema = arktype({\n 'precision?': 'number.integer >= 0 & number.integer <= 6',\n});\n\ntype LengthTypeHelper = {\n readonly kind: 'fixed' | 'variable';\n readonly maxLength: number;\n};\n\nfunction createLengthTypeHelper(\n kind: LengthTypeHelper['kind'],\n): (params: Record<string, unknown>) => LengthTypeHelper {\n return (params) => ({\n kind,\n maxLength: params['length'] as number,\n });\n}\n\nconst sqlCharCodec = codec<\n typeof SQL_CHAR_CODEC_ID,\n readonly ['equality', 'order', 'textual'],\n string,\n string\n>({\n typeId: SQL_CHAR_CODEC_ID,\n targetTypes: ['char'],\n traits: ['equality', 'order', 'textual'],\n encode: (value: string): string => value,\n decode: (wire: string): string => wire.trimEnd(),\n paramsSchema: lengthParamsSchema,\n init: createLengthTypeHelper('fixed'),\n renderOutputType: (typeParams) => {\n const length = typeParams['length'];\n if (length === undefined) return undefined;\n if (typeof length !== 'number' || !Number.isFinite(length) || !Number.isInteger(length)) {\n throw new Error(\n `renderOutputType: expected integer \"length\" in typeParams for Char, got ${String(length)}`,\n );\n }\n return `Char<${length}>`;\n },\n});\n\nconst sqlVarcharCodec = codec<\n typeof SQL_VARCHAR_CODEC_ID,\n readonly ['equality', 'order', 'textual'],\n string,\n string\n>({\n typeId: SQL_VARCHAR_CODEC_ID,\n targetTypes: ['varchar'],\n traits: ['equality', 'order', 'textual'],\n encode: (value: string): string => value,\n decode: (wire: string): string => wire,\n paramsSchema: lengthParamsSchema,\n init: createLengthTypeHelper('variable'),\n renderOutputType: (typeParams) => {\n const length = typeParams['length'];\n if (length === undefined) return undefined;\n if (typeof length !== 'number' || !Number.isFinite(length) || !Number.isInteger(length)) {\n throw new Error(\n `renderOutputType: expected integer \"length\" in typeParams for Varchar, got ${String(length)}`,\n );\n }\n return `Varchar<${length}>`;\n },\n});\n\nconst sqlIntCodec = codec({\n typeId: SQL_INT_CODEC_ID,\n targetTypes: ['int'],\n traits: ['equality', 'order', 'numeric'],\n encode: (value: number): number => value,\n decode: (wire: number): number => wire,\n});\n\nconst sqlFloatCodec = codec({\n typeId: SQL_FLOAT_CODEC_ID,\n targetTypes: ['float'],\n traits: ['equality', 'order', 'numeric'],\n encode: (value: number): number => value,\n decode: (wire: number): number => wire,\n});\n\nconst sqlTextCodec = codec({\n typeId: SQL_TEXT_CODEC_ID,\n targetTypes: ['text'],\n traits: ['equality', 'order', 'textual'],\n encode: (value: string): string => value,\n decode: (wire: string): string => wire,\n});\n\nconst sqlTimestampCodec = codec<\n typeof SQL_TIMESTAMP_CODEC_ID,\n readonly ['equality', 'order'],\n Date,\n Date\n>({\n typeId: SQL_TIMESTAMP_CODEC_ID,\n targetTypes: ['timestamp'],\n traits: ['equality', 'order'],\n encode: (value: Date): Date => value,\n decode: (wire: Date): Date => wire,\n encodeJson: (value: Date): JsonValue => value.toISOString(),\n decodeJson: (json: JsonValue): Date => {\n if (typeof json !== 'string') {\n throw new Error(`Expected ISO date string for sql/timestamp@1, got ${typeof json}`);\n }\n const date = new Date(json);\n if (Number.isNaN(date.getTime())) {\n throw new Error(`Invalid ISO date string for sql/timestamp@1: ${json}`);\n }\n return date;\n },\n paramsSchema: precisionParamsSchema,\n renderOutputType: (typeParams) => {\n const precision = typeParams['precision'];\n if (precision === undefined) {\n return 'Timestamp';\n }\n if (\n typeof precision !== 'number' ||\n !Number.isFinite(precision) ||\n !Number.isInteger(precision)\n ) {\n throw new Error(\n `renderOutputType: expected integer \"precision\" in typeParams for Timestamp, got ${String(precision)}`,\n );\n }\n return `Timestamp<${precision}>`;\n },\n});\n\nconst codecs = defineCodecs()\n .add('char', sqlCharCodec)\n .add('varchar', sqlVarcharCodec)\n .add('int', sqlIntCodec)\n .add('float', sqlFloatCodec)\n .add('text', sqlTextCodec)\n .add('timestamp', sqlTimestampCodec);\n\nexport const sqlCodecDefinitions = codecs.codecDefinitions;\nexport const sqlDataTypes = codecs.dataTypes;\nexport type SqlCodecTypes = typeof codecs.CodecTypes;\n","import type { AnyQueryAst, ParamRef } from './types';\n\nexport function compact<T extends Record<string, unknown>>(o: T): T {\n const out: Record<string, unknown> = {};\n for (const [k, v] of Object.entries(o)) {\n if (v === undefined || v === null) continue;\n if (Array.isArray(v) && v.length === 0) continue;\n out[k] = v;\n }\n return out as T;\n}\n\n/**\n * Walks an AST's parameter references in first-encounter order and dedupes\n * by ParamRef identity. The single canonical helper used by every consumer\n * that aligns `plan.params` with metadata-by-index — the SQL builder lane,\n * the SQL ORM client, the SQL runtime encoder, and the Postgres renderer's\n * `$N` index map — so the four walks cannot drift in dedupe semantics.\n *\n * SQLite's `?`-placeholder renderer intentionally does NOT use this helper\n * because it needs one params entry per occurrence in the SQL.\n */\nexport function collectOrderedParamRefs(ast: AnyQueryAst): ReadonlyArray<ParamRef> {\n const seen = new Set<ParamRef>();\n const ordered: ParamRef[] = [];\n for (const ref of ast.collectParamRefs()) {\n if (seen.has(ref)) continue;\n seen.add(ref);\n ordered.push(ref);\n }\n return Object.freeze(ordered);\n}\n"],"mappings":";;;;;;;;AAsPA,IAAM,oBAAN,MAAiD;CAC/C,AAAiB,wBAAQ,IAAI,KAA4B;CACzD,AAAiB,4BAAY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AAS,cAAc,CAC1B,IAAI,QAAQ,aAAa,CACzB,IAAI,WAAW,gBAAgB,CAC/B,IAAI,OAAO,YAAY,CACvB,IAAI,SAAS,cAAc,CAC3B,IAAI,QAAQ,aAAa,CACzB,IAAI,aAAa,kBAAkB;AAEtC,MAAa,sBAAsB,OAAO;AAC1C,MAAa,eAAe,OAAO;;;;AC3JnC,SAAgB,QAA2C,GAAS;CAClE,MAAMC,MAA+B,EAAE;AACvC,MAAK,MAAM,CAAC,GAAG,MAAM,OAAO,QAAQ,EAAE,EAAE;AACtC,MAAI,MAAM,UAAa,MAAM,KAAM;AACnC,MAAI,MAAM,QAAQ,EAAE,IAAI,EAAE,WAAW,EAAG;AACxC,MAAI,KAAK;;AAEX,QAAO;;;;;;;;;;;;AAaT,SAAgB,wBAAwB,KAA2C;CACjF,MAAM,uBAAO,IAAI,KAAe;CAChC,MAAMC,UAAsB,EAAE;AAC9B,MAAK,MAAM,OAAO,IAAI,kBAAkB,EAAE;AACxC,MAAI,KAAK,IAAI,IAAI,CAAE;AACnB,OAAK,IAAI,IAAI;AACb,UAAQ,KAAK,IAAI;;AAEnB,QAAO,OAAO,OAAO,QAAQ"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import "../codec-types-
|
|
2
|
-
import "../query-lane-context-
|
|
3
|
-
import "../types-
|
|
4
|
-
import { n as planUnsupported, t as planInvalid } from "../errors-
|
|
1
|
+
import "../codec-types-DJEaWT36.mjs";
|
|
2
|
+
import "../query-lane-context-BF-wuc0r.mjs";
|
|
3
|
+
import "../types-BWOCTYd8.mjs";
|
|
4
|
+
import { n as planUnsupported, t as planInvalid } from "../errors-BRt5yHo9.mjs";
|
|
5
5
|
export { planInvalid, planUnsupported };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"expression.d.mts","names":[],"sources":["../../src/expression.ts"],"sourcesContent":[],"mappings":";;;;;;KAMY,UAAA;;EAAA,QAAA,EAAA,OAAU;AAQtB,CAAA;;;;;;AA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EAAA,WAJS,MAIT,CAAA,MAAA,EAAA;EAAU,SAAA,KAAA,EAAA,OAAA;AASd,CAAA,CAAA,CAAA,GAXI,UAWQ,CAAA;EAGC,OAAA,EAda,OAcb;EACyB,QAAA,EAfO,QAeP;CAAI,CAAA,GAAA,CAdrC,OAcqC,SAAA,MAdf,EAce,GAdV,EAcU,CAdP,OAcO,CAAA,CAAA,OAAA,CAAA,GAAA,KAAA,CAAA,GAbtC,UAasC,CAb3B,QAa2B,CAAA;;;;;;AAU1C;AAgBA;AAA8C,KA9BlC,eA8BkC,CAAA,eAAA,SAAA,MAAA,EAAA,EAAA,iBAAA,OAAA,EAAA,WA3BjC,MA2BiC,CAAA,MAAA,EAAA;EAOnB,SAAA,KAAA,EAAA,OAAA;CAAkB,CAAA,CAAA,GAjCzC,eAiCyC,CAjCzB,iBAiCyB,CAjCP,EAiCO,EAjCH,MAiCG,CAAA,EAjCM,QAiCN,EAjCgB,EAiChB,CAAA;;;;;AAU7C;;;;AAA8F,iBAjC9E,MAAA,CAiC8E,KAAA,EAAA,OAAA,EAAA,OAAA,CAAA,EAAA,MAAA,CAAA,EAjCpC,aAiCoC;AAAX,UAjBlE,kBAiBkE,CAAA,UAjBrC,UAiBqC,CAAA,CAAA;EAAU,SAAA,MAAA,EAAA,MAAA;;;;;;2BAVlE,kBAAkB;oBACzB,IAAI;qBACH;;;;;;;iBAQL,yBAAyB,kBAAkB,mBAAmB,KAAK,WAAW"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import "../codec-types-
|
|
2
|
-
import { a as
|
|
3
|
-
export { AppliedMutationDefault, ExecutionContext, JsonSchemaValidateFn, JsonSchemaValidationError, JsonSchemaValidationResult, JsonSchemaValidatorRegistry, MutationDefaultsOp, MutationDefaultsOptions, TypeHelperRegistry };
|
|
1
|
+
import "../codec-types-DJEaWT36.mjs";
|
|
2
|
+
import { a as JsonSchemaValidationError, c as MutationDefaultsOp, i as JsonSchemaValidateFn, l as MutationDefaultsOptions, n as CodecDescriptorRegistry, o as JsonSchemaValidationResult, r as ExecutionContext, s as JsonSchemaValidatorRegistry, t as AppliedMutationDefault, u as TypeHelperRegistry } from "../query-lane-context-BF-wuc0r.mjs";
|
|
3
|
+
export { AppliedMutationDefault, CodecDescriptorRegistry, ExecutionContext, JsonSchemaValidateFn, JsonSchemaValidationError, JsonSchemaValidationResult, JsonSchemaValidatorRegistry, MutationDefaultsOp, MutationDefaultsOptions, TypeHelperRegistry };
|
package/dist/exports/types.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import "../codec-types-
|
|
2
|
-
import "../query-lane-context-
|
|
3
|
-
import { C as TableKey, S as TableDef, T as TablesOf, _ as RawTemplateFactory, a as ComputeColumnJsType, b as SqlBuilderOptions, c as META, d as ModelMetadata, f as OperationTypeSignature, g as RawFunctionOptions, h as RawFactory, i as ColumnsOf, l as Meta, m as OperationsForTypeId, n as BuildParamsMap, o as Expr, p as OperationTypes, r as CodecTypes, s as HasIncludeManyCapabilities, t as BuildOptions, u as ModelDef, v as RawTemplateOptions, w as TableMetadata, x as SqlPlan, y as RuntimeError } from "../types-
|
|
1
|
+
import "../codec-types-DJEaWT36.mjs";
|
|
2
|
+
import "../query-lane-context-BF-wuc0r.mjs";
|
|
3
|
+
import { C as TableKey, S as TableDef, T as TablesOf, _ as RawTemplateFactory, a as ComputeColumnJsType, b as SqlBuilderOptions, c as META, d as ModelMetadata, f as OperationTypeSignature, g as RawFunctionOptions, h as RawFactory, i as ColumnsOf, l as Meta, m as OperationsForTypeId, n as BuildParamsMap, o as Expr, p as OperationTypes, r as CodecTypes, s as HasIncludeManyCapabilities, t as BuildOptions, u as ModelDef, v as RawTemplateOptions, w as TableMetadata, x as SqlPlan, y as RuntimeError } from "../types-BWOCTYd8.mjs";
|
|
4
4
|
import { n as SqlOrmPlan, t as RuntimeScope } from "../types-BUlUvdIU.mjs";
|
|
5
5
|
export { BuildOptions, BuildParamsMap, CodecTypes, ColumnsOf, ComputeColumnJsType, Expr, HasIncludeManyCapabilities, META, Meta, ModelDef, ModelMetadata, OperationTypeSignature, OperationTypes, OperationsForTypeId, RawFactory, RawFunctionOptions, RawTemplateFactory, RawTemplateOptions, RuntimeError, RuntimeScope, SqlBuilderOptions, SqlOrmPlan, SqlPlan, TableDef, TableKey, TableMetadata, TablesOf };
|
package/dist/index.d.mts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { _ as
|
|
1
|
+
import { _ as codec, a as CodecInput, c as CodecRegistry, d as ContractCodecRegistry, f as ExtractCodecTypes, g as SqlColumnRef, h as SqlCodecInstanceContext, i as CodecId, l as CodecTrait, m as SqlCodecCallContext, n as CodecCallContext, o as CodecMeta, p as ExtractDataTypes, r as CodecDefBuilder, s as CodecParamsDescriptor, t as Codec, u as CodecTraits, v as createCodecRegistry, y as defineCodecs } from "./codec-types-DJEaWT36.mjs";
|
|
2
2
|
import { $ as ToWhereExpr, A as InsertOnConflict, B as NotExpr, C as ExistsExpr, D as ExpressionSource, E as ExpressionRewriter, F as JsonObjectEntry, G as ParamRef, H as OperationExpr, I as JsonObjectExpr, J as SelectAst, K as ProjectionExpr, L as ListExpression, M as JoinAst, N as JoinOnExpr, O as IdentifierRef, P as JsonArrayAggExpr, Q as TableSource, R as LiteralExpr, S as EqColJoinOn, T as ExpressionFolder, U as OrExpr, V as NullCheckExpr, W as OrderByItem, X as SubqueryExpr, Y as SelectAstOptions, Z as TableRef, _ as DeleteAst, a as AndExpr, at as whereExprKinds, b as DoNothingConflictAction, c as AnyInsertOnConflictAction, d as AnyQueryAst, et as UpdateAst, f as AstRewriter, g as DefaultValueExpr, h as ColumnRef, i as AggregateOpFn, it as queryAstKinds, j as InsertValue, k as InsertAst, l as AnyInsertValue, m as BinaryOp, n as AggregateExpr, nt as isQueryAst, o as AnyExpression, p as BinaryExpr, q as ProjectionItem, r as AggregateFn, rt as isWhereExpr, s as AnyFromSource, t as AggregateCountFn, tt as WhereArg, u as AnyOperationArg, v as DerivedTableSource, w as ExprVisitor, x as DoUpdateSetConflictAction, y as Direction, z as LoweredStatement } from "./types-B4dL4lc3.mjs";
|
|
3
3
|
import { Adapter, AdapterProfile, AdapterTarget, Lowerer, LowererContext, MarkerStatement, SQL_CHAR_CODEC_ID, SQL_FLOAT_CODEC_ID, SQL_INT_CODEC_ID, SQL_TEXT_CODEC_ID, SQL_TIMESTAMP_CODEC_ID, SQL_VARCHAR_CODEC_ID, SqlCodecTypes, SqlConnection, SqlDriver, SqlDriverState, SqlExecuteRequest, SqlExplainResult, SqlQueryResult, SqlQueryable, SqlTransaction, collectOrderedParamRefs, compact, sqlCodecDefinitions, sqlDataTypes } from "./exports/ast.mjs";
|
|
4
|
-
import { a as
|
|
4
|
+
import { a as JsonSchemaValidationError, c as MutationDefaultsOp, i as JsonSchemaValidateFn, l as MutationDefaultsOptions, n as CodecDescriptorRegistry, o as JsonSchemaValidationResult, r as ExecutionContext, s as JsonSchemaValidatorRegistry, t as AppliedMutationDefault, u as TypeHelperRegistry } from "./query-lane-context-BF-wuc0r.mjs";
|
|
5
5
|
import { t as SqlExecutionPlan } from "./sql-execution-plan-Dgx7BGin.mjs";
|
|
6
|
-
import { C as TableKey, S as TableDef, T as TablesOf, _ as RawTemplateFactory, a as ComputeColumnJsType, b as SqlBuilderOptions, c as META, d as ModelMetadata, f as OperationTypeSignature, g as RawFunctionOptions, h as RawFactory, i as ColumnsOf, l as Meta, m as OperationsForTypeId, n as BuildParamsMap, o as Expr, p as OperationTypes, r as CodecTypes, s as HasIncludeManyCapabilities, t as BuildOptions, u as ModelDef, v as RawTemplateOptions, w as TableMetadata, x as SqlPlan, y as RuntimeError } from "./types-
|
|
7
|
-
import { n as planUnsupported, t as planInvalid } from "./errors-
|
|
6
|
+
import { C as TableKey, S as TableDef, T as TablesOf, _ as RawTemplateFactory, a as ComputeColumnJsType, b as SqlBuilderOptions, c as META, d as ModelMetadata, f as OperationTypeSignature, g as RawFunctionOptions, h as RawFactory, i as ColumnsOf, l as Meta, m as OperationsForTypeId, n as BuildParamsMap, o as Expr, p as OperationTypes, r as CodecTypes, s as HasIncludeManyCapabilities, t as BuildOptions, u as ModelDef, v as RawTemplateOptions, w as TableMetadata, x as SqlPlan, y as RuntimeError } from "./types-BWOCTYd8.mjs";
|
|
7
|
+
import { n as planUnsupported, t as planInvalid } from "./errors-BRt5yHo9.mjs";
|
|
8
8
|
import { BuildOperationSpec, CodecExpression, Expression, ScopeField, TraitExpression, buildOperation, toExpr } from "./exports/expression.mjs";
|
|
9
9
|
import { t as SqlQueryPlan } from "./plan-C7SiEWkN.mjs";
|
|
10
10
|
import "./exports/plan.mjs";
|
|
11
11
|
import "./exports/query-lane-context.mjs";
|
|
12
12
|
import { n as SqlOrmPlan, t as RuntimeScope } from "./types-BUlUvdIU.mjs";
|
|
13
|
-
export { Adapter, AdapterProfile, AdapterTarget, AggregateCountFn, AggregateExpr, AggregateFn, AggregateOpFn, AndExpr, AnyExpression, AnyFromSource, AnyInsertOnConflictAction, AnyInsertValue, AnyOperationArg, AnyQueryAst, AppliedMutationDefault, AstRewriter, BinaryExpr, BinaryOp, BuildOperationSpec, BuildOptions, BuildParamsMap, Codec, CodecCallContext, CodecDefBuilder, CodecExpression, CodecId, CodecInput, CodecMeta, CodecParamsDescriptor, CodecRegistry, CodecTrait, CodecTraits, CodecTypes, ColumnRef, ColumnsOf, ComputeColumnJsType, DefaultValueExpr, DeleteAst, DerivedTableSource, Direction, DoNothingConflictAction, DoUpdateSetConflictAction, EqColJoinOn, ExecutionContext, ExistsExpr, Expr, ExprVisitor, Expression, ExpressionFolder, ExpressionRewriter, ExpressionSource, ExtractCodecTypes, ExtractDataTypes, HasIncludeManyCapabilities, IdentifierRef, InsertAst, InsertOnConflict, InsertValue, JoinAst, JoinOnExpr, JsonArrayAggExpr, JsonObjectEntry, JsonObjectExpr, JsonSchemaValidateFn, JsonSchemaValidationError, JsonSchemaValidationResult, JsonSchemaValidatorRegistry, ListExpression, LiteralExpr, LoweredStatement, Lowerer, LowererContext, META, MarkerStatement, Meta, ModelDef, ModelMetadata, MutationDefaultsOp, MutationDefaultsOptions, NotExpr, NullCheckExpr, OperationExpr, OperationTypeSignature, OperationTypes, OperationsForTypeId, OrExpr, OrderByItem, ParamRef, ProjectionExpr, ProjectionItem, RawFactory, RawFunctionOptions, RawTemplateFactory, RawTemplateOptions, RuntimeError, RuntimeScope, SQL_CHAR_CODEC_ID, SQL_FLOAT_CODEC_ID, SQL_INT_CODEC_ID, SQL_TEXT_CODEC_ID, SQL_TIMESTAMP_CODEC_ID, SQL_VARCHAR_CODEC_ID, ScopeField, SelectAst, SelectAstOptions, SqlBuilderOptions, SqlCodecCallContext, SqlCodecTypes, SqlColumnRef, SqlConnection, SqlDriver, SqlDriverState, SqlExecuteRequest, SqlExecutionPlan, SqlExplainResult, SqlOrmPlan, SqlPlan, SqlQueryPlan, SqlQueryResult, SqlQueryable, SqlTransaction, SubqueryExpr, TableDef, TableKey, TableMetadata, TableRef, TableSource, TablesOf, ToWhereExpr, TraitExpression, TypeHelperRegistry, UpdateAst, WhereArg, buildOperation, codec, collectOrderedParamRefs, compact, createCodecRegistry, defineCodecs, isQueryAst, isWhereExpr, planInvalid, planUnsupported, queryAstKinds, sqlCodecDefinitions, sqlDataTypes, toExpr, whereExprKinds };
|
|
13
|
+
export { Adapter, AdapterProfile, AdapterTarget, AggregateCountFn, AggregateExpr, AggregateFn, AggregateOpFn, AndExpr, AnyExpression, AnyFromSource, AnyInsertOnConflictAction, AnyInsertValue, AnyOperationArg, AnyQueryAst, AppliedMutationDefault, AstRewriter, BinaryExpr, BinaryOp, BuildOperationSpec, BuildOptions, BuildParamsMap, Codec, CodecCallContext, CodecDefBuilder, CodecDescriptorRegistry, CodecExpression, CodecId, CodecInput, CodecMeta, CodecParamsDescriptor, CodecRegistry, CodecTrait, CodecTraits, CodecTypes, ColumnRef, ColumnsOf, ComputeColumnJsType, ContractCodecRegistry, DefaultValueExpr, DeleteAst, DerivedTableSource, Direction, DoNothingConflictAction, DoUpdateSetConflictAction, EqColJoinOn, ExecutionContext, ExistsExpr, Expr, ExprVisitor, Expression, ExpressionFolder, ExpressionRewriter, ExpressionSource, ExtractCodecTypes, ExtractDataTypes, HasIncludeManyCapabilities, IdentifierRef, InsertAst, InsertOnConflict, InsertValue, JoinAst, JoinOnExpr, JsonArrayAggExpr, JsonObjectEntry, JsonObjectExpr, JsonSchemaValidateFn, JsonSchemaValidationError, JsonSchemaValidationResult, JsonSchemaValidatorRegistry, ListExpression, LiteralExpr, LoweredStatement, Lowerer, LowererContext, META, MarkerStatement, Meta, ModelDef, ModelMetadata, MutationDefaultsOp, MutationDefaultsOptions, NotExpr, NullCheckExpr, OperationExpr, OperationTypeSignature, OperationTypes, OperationsForTypeId, OrExpr, OrderByItem, ParamRef, ProjectionExpr, ProjectionItem, RawFactory, RawFunctionOptions, RawTemplateFactory, RawTemplateOptions, RuntimeError, RuntimeScope, SQL_CHAR_CODEC_ID, SQL_FLOAT_CODEC_ID, SQL_INT_CODEC_ID, SQL_TEXT_CODEC_ID, SQL_TIMESTAMP_CODEC_ID, SQL_VARCHAR_CODEC_ID, ScopeField, SelectAst, SelectAstOptions, SqlBuilderOptions, SqlCodecCallContext, SqlCodecInstanceContext, SqlCodecTypes, SqlColumnRef, SqlConnection, SqlDriver, SqlDriverState, SqlExecuteRequest, SqlExecutionPlan, SqlExplainResult, SqlOrmPlan, SqlPlan, SqlQueryPlan, SqlQueryResult, SqlQueryable, SqlTransaction, SubqueryExpr, TableDef, TableKey, TableMetadata, TableRef, TableSource, TablesOf, ToWhereExpr, TraitExpression, TypeHelperRegistry, UpdateAst, WhereArg, buildOperation, codec, collectOrderedParamRefs, compact, createCodecRegistry, defineCodecs, isQueryAst, isWhereExpr, planInvalid, planUnsupported, queryAstKinds, sqlCodecDefinitions, sqlDataTypes, toExpr, whereExprKinds };
|
|
@@ -1,10 +1,37 @@
|
|
|
1
|
-
import { c as CodecRegistry } from "./codec-types-
|
|
1
|
+
import { c as CodecRegistry, d as ContractCodecRegistry } from "./codec-types-DJEaWT36.mjs";
|
|
2
2
|
import { Contract } from "@prisma-next/contract/types";
|
|
3
|
+
import { CodecDescriptor } from "@prisma-next/framework-components/codec";
|
|
3
4
|
import { SqlOperationRegistry } from "@prisma-next/sql-operations";
|
|
4
5
|
import { SqlStorage } from "@prisma-next/sql-contract/types";
|
|
5
6
|
|
|
6
7
|
//#region src/query-lane-context.d.ts
|
|
7
8
|
|
|
9
|
+
/**
|
|
10
|
+
* Codec-id-keyed accessor for descriptor metadata. The unified read API
|
|
11
|
+
* for codec-id-keyed metadata (`traits`, `targetTypes`, `meta`) — non-
|
|
12
|
+
* branching for parameterized vs. non-parameterized codecs since every
|
|
13
|
+
* codec ships as (or is synthesized into) a `CodecDescriptor`.
|
|
14
|
+
*
|
|
15
|
+
* See codec-registry-unification spec § Decision and AC-3.
|
|
16
|
+
*/
|
|
17
|
+
interface CodecDescriptorRegistry {
|
|
18
|
+
/**
|
|
19
|
+
* Descriptors carry distinct param shapes per codec id; the registry is
|
|
20
|
+
* heterogeneous and the consumer narrows per codec.
|
|
21
|
+
*/
|
|
22
|
+
descriptorFor(codecId: string): CodecDescriptor<unknown> | undefined;
|
|
23
|
+
/**
|
|
24
|
+
* All registered descriptors. Used by `validateCodecRegistryCompleteness`
|
|
25
|
+
* and other startup-time consumers that enumerate descriptors.
|
|
26
|
+
*/
|
|
27
|
+
values(): IterableIterator<CodecDescriptor<unknown>>;
|
|
28
|
+
/**
|
|
29
|
+
* Descriptors indexed by `targetTypes[i]` (each scalar type the codec
|
|
30
|
+
* advertises). Multiple descriptors may map to the same scalar type;
|
|
31
|
+
* ordering reflects registration order.
|
|
32
|
+
*/
|
|
33
|
+
byTargetType(targetType: string): readonly CodecDescriptor<unknown>[];
|
|
34
|
+
}
|
|
8
35
|
/**
|
|
9
36
|
* Registry of initialized type helpers from storage.types.
|
|
10
37
|
* Each key is a type name from storage.types, and the value is:
|
|
@@ -66,7 +93,30 @@ type MutationDefaultsOptions = {
|
|
|
66
93
|
*/
|
|
67
94
|
interface ExecutionContext<TContract extends Contract<SqlStorage> = Contract<SqlStorage>> {
|
|
68
95
|
readonly contract: TContract;
|
|
96
|
+
/**
|
|
97
|
+
* Codec registry indexed by codec id. Source of shared, non-parameterized
|
|
98
|
+
* codec instances; also used as the codec-id-only fallback at the
|
|
99
|
+
* `forCodecId` boundary while AC-5's `ParamRef.refs` plumbing remains
|
|
100
|
+
* deferred (TML-2357).
|
|
101
|
+
*/
|
|
69
102
|
readonly codecs: CodecRegistry;
|
|
103
|
+
/**
|
|
104
|
+
* Contract-bound codec registry built once at context-construction time
|
|
105
|
+
* by walking the contract's columns and resolving each to its per-
|
|
106
|
+
* instance codec (parameterized columns) or the shared codec from the
|
|
107
|
+
* legacy registry (non-parameterized columns). The dispatch path
|
|
108
|
+
* (`encodeParam` / `decodeRow`) consults `forColumn(table, column)`
|
|
109
|
+
* when the call site has the ref, falling back to `forCodecId(codecId)`
|
|
110
|
+
* otherwise. Codec-registry-unification spec § AC-4.
|
|
111
|
+
*/
|
|
112
|
+
readonly contractCodecs: ContractCodecRegistry;
|
|
113
|
+
/**
|
|
114
|
+
* Codec-id-keyed descriptor map. Single source of truth for codec-id-
|
|
115
|
+
* keyed metadata (`traits`, `targetTypes`, `meta`) — every codec,
|
|
116
|
+
* parameterized or not, resolves through this map without branching.
|
|
117
|
+
* Codec-registry-unification spec § AC-3.
|
|
118
|
+
*/
|
|
119
|
+
readonly codecDescriptors: CodecDescriptorRegistry;
|
|
70
120
|
readonly queryOperations: SqlOperationRegistry;
|
|
71
121
|
/**
|
|
72
122
|
* Type helper registry for parameterized types.
|
|
@@ -85,5 +135,5 @@ interface ExecutionContext<TContract extends Contract<SqlStorage> = Contract<Sql
|
|
|
85
135
|
applyMutationDefaults(options: MutationDefaultsOptions): ReadonlyArray<AppliedMutationDefault>;
|
|
86
136
|
}
|
|
87
137
|
//#endregion
|
|
88
|
-
export {
|
|
89
|
-
//# sourceMappingURL=query-lane-context-
|
|
138
|
+
export { JsonSchemaValidationError as a, MutationDefaultsOp as c, JsonSchemaValidateFn as i, MutationDefaultsOptions as l, CodecDescriptorRegistry as n, JsonSchemaValidationResult as o, ExecutionContext as r, JsonSchemaValidatorRegistry as s, AppliedMutationDefault as t, TypeHelperRegistry as u };
|
|
139
|
+
//# sourceMappingURL=query-lane-context-BF-wuc0r.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"query-lane-context-BF-wuc0r.d.mts","names":[],"sources":["../src/query-lane-context.ts"],"sourcesContent":[],"mappings":";;;;;;;;;;AAcA;;;;;;AAyBY,UAzBK,uBAAA,CAyBgB;EAShB;AASjB;AAQA;AASA;EAOY,aAAA,CAAA,OAAkB,EAAA,MAAA,CAAA,EA9DI,eA8DJ,CAAA,OAAA,CAAA,GAAA,SAAA;EAElB;AAKZ;AAaA;;EAAoD,MAAA,EAAA,EA7ExC,gBA6EwC,CA7EvB,eA6EuB,CAAA,OAAA,CAAA,CAAA;EAAgC;;;;;EAyBvD,YAAA,CAAA,UAAA,EAAA,MAAA,CAAA,EAAA,SAhGgB,eAgGhB,CAAA,OAAA,CAAA,EAAA;;;;;;;;KAvFjB,kBAAA,GAAqB;;;;UAShB,yBAAA;;;;;;;;KASL,0BAAA;;;;mBAEkC,cAAc;;;;;;KAMhD,oBAAA,uBAA2C;;;;;;;;UAStC,2BAAA;;oBAEG;;;;KAKR,kBAAA;KAEA,sBAAA;;;;KAKA,uBAAA;eACG;;mBAEI;;;;;;;;;UAUF,mCAAmC,SAAS,cAAc,SAAS;qBAC/D;;;;;;;mBAOF;;;;;;;;;;2BAUQ;;;;;;;6BAOE;4BACD;;;;;kBAKV;;;;;kCAKgB;;;;;iCAKD,0BAA0B,cAAc"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { G as ParamRef, h as ColumnRef } from "./types-B4dL4lc3.mjs";
|
|
2
|
-
import {
|
|
2
|
+
import { r as ExecutionContext } from "./query-lane-context-BF-wuc0r.mjs";
|
|
3
3
|
import { t as SqlExecutionPlan } from "./sql-execution-plan-Dgx7BGin.mjs";
|
|
4
4
|
import { Contract } from "@prisma-next/contract/types";
|
|
5
5
|
import { ParamSpec } from "@prisma-next/operations";
|
|
@@ -190,4 +190,4 @@ interface SqlBuilderOptions<TContract extends Contract<SqlStorage> = Contract<Sq
|
|
|
190
190
|
}
|
|
191
191
|
//#endregion
|
|
192
192
|
export { TableKey as C, TableDef as S, TablesOf as T, RawTemplateFactory as _, ComputeColumnJsType as a, SqlBuilderOptions as b, META as c, ModelMetadata as d, OperationTypeSignature as f, RawFunctionOptions as g, RawFactory as h, ColumnsOf as i, Meta as l, OperationsForTypeId as m, BuildParamsMap as n, Expr as o, OperationTypes as p, CodecTypes as r, HasIncludeManyCapabilities as s, BuildOptions as t, ModelDef as u, RawTemplateOptions as v, TableMetadata as w, SqlPlan as x, RuntimeError as y };
|
|
193
|
-
//# sourceMappingURL=types-
|
|
193
|
+
//# sourceMappingURL=types-BWOCTYd8.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types-
|
|
1
|
+
{"version":3,"file":"types-BWOCTYd8.d.mts","names":[],"sources":["../src/types.ts"],"sourcesContent":[],"mappings":";;;;;;;;;KAYY,IAAA,GAAO,YAAY;;AAA/B;AAAwC;;KAMnC,mBACe,CAAA,kBAAA,QAAA,CAAS,UAAT,CAAA,EAAA,kBAAA,MAAA,CAAA,GAEhB,SAFgB,CAAA,QAAA,CAAA,SAAA,KAAA,gBAEiC,MAFjC,CAAA,MAAA,EAAA,OAAA,CAAA,GAAA,QAEhB,MAEc,MAFd,GAAA,MAAA,GAEgC,MAFhC,CAEuC,CAFvC,CAAA,SAAA;EAAiD,SAAA,OAAA,EAAA;IAEnC,SAAA,KAAA,EAC0B,SAD1B;EAAkB,CAAA;AAAO,CAAA,GAGjC,CAHiC,GAAA,KAAA,EACC,CAAA,MAIhC,MAJgC,GAAA,MAAA,CAAA,GAAA,KAAA;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
1
|
{
|
|
2
2
|
"name": "@prisma-next/sql-relational-core",
|
|
3
|
-
"version": "0.5.0-dev.
|
|
3
|
+
"version": "0.5.0-dev.32",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"description": "AST types, query lane context, and type utilities for Prisma Next SQL lanes",
|
|
7
7
|
"dependencies": {
|
|
8
8
|
"arktype": "^2.1.29",
|
|
9
9
|
"ts-toolbelt": "^9.6.0",
|
|
10
|
-
"@prisma-next/
|
|
11
|
-
"@prisma-next/
|
|
12
|
-
"@prisma-next/
|
|
13
|
-
"@prisma-next/
|
|
14
|
-
"@prisma-next/
|
|
15
|
-
"@prisma-next/
|
|
10
|
+
"@prisma-next/contract": "0.5.0-dev.32",
|
|
11
|
+
"@prisma-next/framework-components": "0.5.0-dev.32",
|
|
12
|
+
"@prisma-next/operations": "0.5.0-dev.32",
|
|
13
|
+
"@prisma-next/sql-contract": "0.5.0-dev.32",
|
|
14
|
+
"@prisma-next/utils": "0.5.0-dev.32",
|
|
15
|
+
"@prisma-next/sql-operations": "0.5.0-dev.32"
|
|
16
16
|
},
|
|
17
17
|
"devDependencies": {
|
|
18
18
|
"tsdown": "0.18.4",
|
|
19
19
|
"typescript": "5.9.3",
|
|
20
20
|
"vitest": "4.0.17",
|
|
21
|
-
"@prisma-next/sql-contract-ts": "0.5.0-dev.30",
|
|
22
21
|
"@prisma-next/test-utils": "0.0.1",
|
|
22
|
+
"@prisma-next/sql-contract-ts": "0.5.0-dev.32",
|
|
23
23
|
"@prisma-next/tsconfig": "0.0.0",
|
|
24
24
|
"@prisma-next/tsdown": "0.0.0"
|
|
25
25
|
},
|
package/src/ast/codec-types.ts
CHANGED
|
@@ -2,6 +2,7 @@ import type { JsonValue } from '@prisma-next/contract/types';
|
|
|
2
2
|
import type {
|
|
3
3
|
Codec as BaseCodec,
|
|
4
4
|
CodecCallContext,
|
|
5
|
+
CodecInstanceContext,
|
|
5
6
|
CodecTrait,
|
|
6
7
|
} from '@prisma-next/framework-components/codec';
|
|
7
8
|
import { ifDefined } from '@prisma-next/utils/defined';
|
|
@@ -44,8 +45,44 @@ export interface SqlCodecCallContext extends CodecCallContext {
|
|
|
44
45
|
}
|
|
45
46
|
|
|
46
47
|
/**
|
|
47
|
-
*
|
|
48
|
-
*
|
|
48
|
+
* SQL-family per-instance context. Extends the framework
|
|
49
|
+
* {@link CodecInstanceContext} (`name` only) with `usedAt`, the set of
|
|
50
|
+
* `(table, column)` pairs the resolved codec serves.
|
|
51
|
+
*
|
|
52
|
+
* - For `typeRef` columns sharing one named `storage.types` instance, the
|
|
53
|
+
* array lists every referencing column — a column-scoped stateful codec
|
|
54
|
+
* (e.g. encryption) can derive aggregated per-instance state across all
|
|
55
|
+
* the columns sharing the named instance.
|
|
56
|
+
* - For inline-`typeParams` columns, the array has exactly one entry —
|
|
57
|
+
* the column that owns the inline params.
|
|
58
|
+
* - For shared non-parameterized codecs, the array carries one
|
|
59
|
+
* representative entry (the column that triggered materialization);
|
|
60
|
+
* the codec is shared across every column with that codec id, so the
|
|
61
|
+
* `usedAt` is informational only.
|
|
62
|
+
*
|
|
63
|
+
* SQL extensions consuming `usedAt` (e.g. column-scoped state derivation)
|
|
64
|
+
* type their factory parameter as `SqlCodecInstanceContext`. Extensions
|
|
65
|
+
* that don't read `usedAt` type their factory parameter as the
|
|
66
|
+
* family-agnostic {@link CodecInstanceContext} — a `SqlCodecInstanceContext`
|
|
67
|
+
* is structurally assignable to the base.
|
|
68
|
+
*/
|
|
69
|
+
export interface SqlCodecInstanceContext extends CodecInstanceContext {
|
|
70
|
+
readonly usedAt: ReadonlyArray<{ readonly table: string; readonly column: string }>;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Legacy adapter-level descriptor for parameterized codecs that require
|
|
75
|
+
* type-parameter validation at compile time. The runtime descriptor
|
|
76
|
+
* (`RuntimeParameterizedCodecDescriptor` in `@prisma-next/sql-runtime`)
|
|
77
|
+
* has migrated to the unified `CodecDescriptor<P>` shape with
|
|
78
|
+
* `factory: (P) => (CodecInstanceContext) => Codec`; this descriptor stays only because
|
|
79
|
+
* the SQL `Adapter.parameterizedCodecs()` surface still returns
|
|
80
|
+
* `CodecParamsDescriptor[]` (compile-time typeParams validation only,
|
|
81
|
+
* not runtime materialization).
|
|
82
|
+
*
|
|
83
|
+
* Retirement is tracked under TML-2357 T3.5.4 (single registration slot)
|
|
84
|
+
* — the adapter-level `parameterizedCodecs()` collapses into the unified
|
|
85
|
+
* runtime descriptor map once contributors migrate fully.
|
|
49
86
|
*
|
|
50
87
|
* @template TParams - The shape of the type parameters (e.g., `{ length: number }`)
|
|
51
88
|
* @template THelper - The type returned by the optional `init` hook
|
|
@@ -64,6 +101,14 @@ export interface CodecParamsDescriptor<TParams = Record<string, unknown>, THelpe
|
|
|
64
101
|
* Optional init hook called during runtime context creation.
|
|
65
102
|
* Receives validated params and returns a helper object to be stored in context.types.
|
|
66
103
|
* If not provided, the validated params are stored directly.
|
|
104
|
+
*
|
|
105
|
+
* Predecessor pattern. The runtime descriptor's curried
|
|
106
|
+
* `factory: (P) => (CodecInstanceContext) => Codec` subsumes this hook — per-instance
|
|
107
|
+
* state lives on the resolved codec rather than in a parallel
|
|
108
|
+
* `TypeHelperRegistry` entry. Retirement tracked under TML-2357 T3.5.2
|
|
109
|
+
* (narrow runtime `Codec` interface) and T3.5.4 (single registration
|
|
110
|
+
* slot). Adapter-level callers reading codec-self-carried `init` should
|
|
111
|
+
* migrate to the runtime descriptor map's factory instead.
|
|
67
112
|
*/
|
|
68
113
|
readonly init?: (params: TParams) => THelper;
|
|
69
114
|
}
|
|
@@ -94,6 +139,14 @@ export interface CodecMeta {
|
|
|
94
139
|
* bivariantly, so the SQL narrowing is structurally compatible with the
|
|
95
140
|
* framework {@link BaseCodec} super-interface.
|
|
96
141
|
*
|
|
142
|
+
* Note: `paramsSchema` and `init` here are the legacy adapter-level slots
|
|
143
|
+
* mirrored from {@link CodecParamsDescriptor}. The runtime materialization
|
|
144
|
+
* path uses `RuntimeParameterizedCodecDescriptor` (in
|
|
145
|
+
* `@prisma-next/sql-runtime`) via the unified `CodecDescriptor<P>` shape;
|
|
146
|
+
* codec-self-carried `paramsSchema`/`init` retire under TML-2357 (T3.5.2
|
|
147
|
+
* narrows the runtime `Codec` interface; T3.5.4 collapses the parallel
|
|
148
|
+
* registration slots).
|
|
149
|
+
*
|
|
97
150
|
* See `Codec` in `@prisma-next/framework-components/codec` for the codec
|
|
98
151
|
* contract that this interface extends.
|
|
99
152
|
*/
|
|
@@ -109,9 +162,63 @@ export interface Codec<
|
|
|
109
162
|
decode(wire: TWire, ctx: SqlCodecCallContext): Promise<TInput>;
|
|
110
163
|
readonly meta?: CodecMeta;
|
|
111
164
|
readonly paramsSchema?: Type<TParams>;
|
|
165
|
+
/**
|
|
166
|
+
* Predecessor init hook. Retirement tracked under TML-2357 (T3.5.2 /
|
|
167
|
+
* T3.5.4); the unified runtime descriptor's
|
|
168
|
+
* `factory: (P) => (CodecInstanceContext) => Codec` is the replacement.
|
|
169
|
+
*/
|
|
112
170
|
readonly init?: (params: TParams) => THelper;
|
|
113
171
|
}
|
|
114
172
|
|
|
173
|
+
/**
|
|
174
|
+
* Contract-bound codec registry.
|
|
175
|
+
*
|
|
176
|
+
* The dispatch interface for encode/decode at runtime: built once at
|
|
177
|
+
* `ExecutionContext` construction time by walking the contract's
|
|
178
|
+
* `storage.tables[].columns[]` and resolving each column to either a per-
|
|
179
|
+
* instance parameterized codec (via `descriptor.factory(typeParams)(ctx)`)
|
|
180
|
+
* or the shared codec instance from the legacy `CodecRegistry` (for non-
|
|
181
|
+
* parameterized codecs). The dispatch path calls
|
|
182
|
+
* `forColumn(table, column).encode/decode(...)` and doesn't know whether
|
|
183
|
+
* the codec is parameterized.
|
|
184
|
+
*
|
|
185
|
+
* `forCodecId(codecId)` is a fallback for sites that don't carry the
|
|
186
|
+
* `(table, column)` ref through to the encode/decode call site —
|
|
187
|
+
* primarily the param-encoding path, where `ParamRef.refs` is not
|
|
188
|
+
* populated by the SQL builder today (every `ParamRef` carries `codecId`
|
|
189
|
+
* but not the column it relates to). For the parameterized codecs shipped
|
|
190
|
+
* at Phase B, encode is per-instance-stateless (pgvector formats
|
|
191
|
+
* `[v1,v2,v3]` regardless of length; JSON's `encode` is `JSON.stringify`
|
|
192
|
+
* regardless of schema), so a codec-id-keyed lookup yields a structurally
|
|
193
|
+
* equivalent encoder; the fallback is the bridge that lets the legacy
|
|
194
|
+
* `codecs:` registration retire from the dispatch path while staying as
|
|
195
|
+
* the codec-id-only source for now.
|
|
196
|
+
*
|
|
197
|
+
* The encode-side fallback is the AC-5-deferred carve-out documented in
|
|
198
|
+
* the codec-registry-unification spec § Non-functional constraints.
|
|
199
|
+
* TML-2357 retires the fallback by threading `ParamRef.refs` through
|
|
200
|
+
* column-bound construction sites.
|
|
201
|
+
*/
|
|
202
|
+
export interface ContractCodecRegistry {
|
|
203
|
+
/**
|
|
204
|
+
* Resolve the codec for `(table, column)`. Returns the per-instance
|
|
205
|
+
* parameterized codec for parameterized columns, the shared codec for
|
|
206
|
+
* non-parameterized columns, or `undefined` if the column is unknown
|
|
207
|
+
* or the codec isn't registered.
|
|
208
|
+
*/
|
|
209
|
+
forColumn(table: string, column: string): Codec | undefined;
|
|
210
|
+
|
|
211
|
+
/**
|
|
212
|
+
* Resolve a codec by id. Returns the same codec instance the legacy
|
|
213
|
+
* `CodecRegistry.get(codecId)` would return — for non-parameterized
|
|
214
|
+
* codecs that's the shared instance; for parameterized codecs that's
|
|
215
|
+
* a representative resolved instance. Used by sites that don't carry
|
|
216
|
+
* `(table, column)` through to the encode/decode call site (the AC-5
|
|
217
|
+
* carve-out path).
|
|
218
|
+
*/
|
|
219
|
+
forCodecId(codecId: string): Codec | undefined;
|
|
220
|
+
}
|
|
221
|
+
|
|
115
222
|
/**
|
|
116
223
|
* Registry interface for codecs organized by ID and by contract scalar type.
|
|
117
224
|
*
|
|
@@ -1,7 +1,35 @@
|
|
|
1
1
|
import type { Contract } from '@prisma-next/contract/types';
|
|
2
|
+
import type { CodecDescriptor } from '@prisma-next/framework-components/codec';
|
|
2
3
|
import type { SqlStorage } from '@prisma-next/sql-contract/types';
|
|
3
4
|
import type { SqlOperationRegistry } from '@prisma-next/sql-operations';
|
|
4
|
-
import type { CodecRegistry } from './ast/codec-types';
|
|
5
|
+
import type { CodecRegistry, ContractCodecRegistry } from './ast/codec-types';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Codec-id-keyed accessor for descriptor metadata. The unified read API
|
|
9
|
+
* for codec-id-keyed metadata (`traits`, `targetTypes`, `meta`) — non-
|
|
10
|
+
* branching for parameterized vs. non-parameterized codecs since every
|
|
11
|
+
* codec ships as (or is synthesized into) a `CodecDescriptor`.
|
|
12
|
+
*
|
|
13
|
+
* See codec-registry-unification spec § Decision and AC-3.
|
|
14
|
+
*/
|
|
15
|
+
export interface CodecDescriptorRegistry {
|
|
16
|
+
/**
|
|
17
|
+
* Descriptors carry distinct param shapes per codec id; the registry is
|
|
18
|
+
* heterogeneous and the consumer narrows per codec.
|
|
19
|
+
*/
|
|
20
|
+
descriptorFor(codecId: string): CodecDescriptor<unknown> | undefined;
|
|
21
|
+
/**
|
|
22
|
+
* All registered descriptors. Used by `validateCodecRegistryCompleteness`
|
|
23
|
+
* and other startup-time consumers that enumerate descriptors.
|
|
24
|
+
*/
|
|
25
|
+
values(): IterableIterator<CodecDescriptor<unknown>>;
|
|
26
|
+
/**
|
|
27
|
+
* Descriptors indexed by `targetTypes[i]` (each scalar type the codec
|
|
28
|
+
* advertises). Multiple descriptors may map to the same scalar type;
|
|
29
|
+
* ordering reflects registration order.
|
|
30
|
+
*/
|
|
31
|
+
byTargetType(targetType: string): readonly CodecDescriptor<unknown>[];
|
|
32
|
+
}
|
|
5
33
|
|
|
6
34
|
/**
|
|
7
35
|
* Registry of initialized type helpers from storage.types.
|
|
@@ -73,7 +101,30 @@ export type MutationDefaultsOptions = {
|
|
|
73
101
|
*/
|
|
74
102
|
export interface ExecutionContext<TContract extends Contract<SqlStorage> = Contract<SqlStorage>> {
|
|
75
103
|
readonly contract: TContract;
|
|
104
|
+
/**
|
|
105
|
+
* Codec registry indexed by codec id. Source of shared, non-parameterized
|
|
106
|
+
* codec instances; also used as the codec-id-only fallback at the
|
|
107
|
+
* `forCodecId` boundary while AC-5's `ParamRef.refs` plumbing remains
|
|
108
|
+
* deferred (TML-2357).
|
|
109
|
+
*/
|
|
76
110
|
readonly codecs: CodecRegistry;
|
|
111
|
+
/**
|
|
112
|
+
* Contract-bound codec registry built once at context-construction time
|
|
113
|
+
* by walking the contract's columns and resolving each to its per-
|
|
114
|
+
* instance codec (parameterized columns) or the shared codec from the
|
|
115
|
+
* legacy registry (non-parameterized columns). The dispatch path
|
|
116
|
+
* (`encodeParam` / `decodeRow`) consults `forColumn(table, column)`
|
|
117
|
+
* when the call site has the ref, falling back to `forCodecId(codecId)`
|
|
118
|
+
* otherwise. Codec-registry-unification spec § AC-4.
|
|
119
|
+
*/
|
|
120
|
+
readonly contractCodecs: ContractCodecRegistry;
|
|
121
|
+
/**
|
|
122
|
+
* Codec-id-keyed descriptor map. Single source of truth for codec-id-
|
|
123
|
+
* keyed metadata (`traits`, `targetTypes`, `meta`) — every codec,
|
|
124
|
+
* parameterized or not, resolves through this map without branching.
|
|
125
|
+
* Codec-registry-unification spec § AC-3.
|
|
126
|
+
*/
|
|
127
|
+
readonly codecDescriptors: CodecDescriptorRegistry;
|
|
77
128
|
readonly queryOperations: SqlOperationRegistry;
|
|
78
129
|
/**
|
|
79
130
|
* Type helper registry for parameterized types.
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"codec-types-DAQNecFs.d.mts","names":[],"sources":["../src/ast/codec-types.ts"],"sourcesContent":[],"mappings":";;;;;;;;AAyBA;AAgBA;AAWA;;;;;;;AAsBA;AAyBA;;AAEmD,UA5ElC,YAAA,CA4EkC;EAGvC,SAAA,KAAA,EAAA,MAAA;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CAjC6B,CAiC7B,CAAA,CAAA,CAAA,GAjCoC,EAiCpC,EAAG,CAAA,MAhC9B,iBAgC8B,CAhCZ,MAgCY,CAhCL,CAgCK,EAhCF,WAgCE,CAhCU,CAgCV,CAAA,CAAA,CAAA,CAAA,EAAY;;;;AAyHpC,UAnJC,eAmJkB,CAAA,oBAAiB,iBAOxB,MAzJiB,WAyJG,GAzJW,OAyJ3B,CAAA,MAAA,CAAA,KAzJ6C;uBAEtD,kBAAkB;mDAEU,6BACnC,uBACD,YACV,gBACD,CAAA,CAAE,UAAU,aAAa,OAAO,YAAY,cAAc,OAAO,YAAY;oDAIxD;qBACF,YAAY,WAAW;qBACvB;oBACD,YAAY;oBACZ,WAAW,YAAY;qBACtB,WAAW,YAAY;qBACvB,WAAW,YAAY;;6CAKrB,sCACG,kBAAkB,OAAO,GAAG,YAAY,OAAO,WAC/D,kBAAkB,OAAO,GAAG,YAAY;;;;;iBAyHpC,mBAAA,CAAA,GAAuB;;;;iBAOvB,YAAA,CAAA,GAAgB,gBAAgB"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"errors-CJKxtKSt.d.mts","names":[],"sources":["../src/errors.ts"],"sourcesContent":[],"mappings":";;;iBAEgB,WAAA,4BAEJ,+EAGT;iBAkBa,eAAA,4BAEJ,+EAGT"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"query-lane-context-Cch9CN9H.d.mts","names":[],"sources":["../src/query-lane-context.ts"],"sourcesContent":[],"mappings":";;;;;;;;;AAWA;AASA;AASA;AAQA;AASiB,KAnCL,kBAAA,GAAqB,MAmCW,CAAA,MAExB,EAAA,OAAA,CAAA;AAKpB;AAEA;AAKA;AAaiB,UArDA,yBAAA,CAqDgB;EAA4B,SAAA,IAAA,EAAA,MAAA;EAAT,SAAA,OAAA,EAAA,MAAA;EAAgC,SAAA,OAAA,EAAA,MAAA;;;;;AAQlE,KApDN,0BAAA,GAoDM;EAKgB,SAAA,KAAA,EAAA,IAAA;CAKD,GAAA;EAAwC,SAAA,KAAA,EAAA,KAAA;EAAd,SAAA,MAAA,EA5Db,aA4Da,CA5DC,yBA4DD,CAAA;CAAa;;;;;KAtD5D,oBAAA,uBAA2C;;;;;;;;UAStC,2BAAA;;oBAEG;;;;KAKR,kBAAA;KAEA,sBAAA;;;;KAKA,uBAAA;eACG;;mBAEI;;;;;;;;;UAUF,mCAAmC,SAAS,cAAc,SAAS;qBAC/D;mBACF;4BACS;;;;;kBAKV;;;;;kCAKgB;;;;;iCAKD,0BAA0B,cAAc"}
|