@prisma-next/sql-relational-core 0.5.0-dev.28 → 0.5.0-dev.29

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -93,7 +93,7 @@ flowchart TD
93
93
 
94
94
  ### Codec Factory (`ast/codec-types.ts` via `exports/ast.ts`)
95
95
 
96
- - `codec({...})` is the SQL-side factory for constructing `Codec` values. It accepts `encode` and `decode` author functions in **either sync or async form** with no annotations; the constructed codec exposes Promise-returning query-time methods regardless of which form was used. `encode` may be omitted (identity default); `decode` is required.
96
+ - `codec({...})` is the SQL-side factory for constructing `Codec` values. It accepts `encode` and `decode` author functions in **either sync or async form** with no annotations; the constructed codec exposes Promise-returning query-time methods regardless of which form was used. Both `encode` and `decode` are required so `TInput` and `TWire` are always covered by an explicit author function — the factory installs no identity fallback.
97
97
  - Build-time methods (`encodeJson`, `decodeJson`, `renderOutputType?`) are synchronous and pass through unchanged.
98
98
  - This is the only public entry point for SQL codecs. There is no separate `codecSync` / `codecAsync` factory and no per-codec async marker on the resulting value.
99
99
 
@@ -119,7 +119,43 @@ const secretCodec = codec({
119
119
  });
120
120
  ```
121
121
 
122
- See [ADR 204 Single-Path Async Codec Runtime](../../../../docs/architecture%20docs/adrs/ADR%20204%20-%20Single-Path%20Async%20Codec%20Runtime.md).
122
+ #### Codec call context (`ctx`)
123
+
124
+ Codecs receive a second `ctx` options argument; you may ignore it. The runtime allocates one `SqlCodecCallContext` per `runtime.execute(plan, { signal })` call and threads the same reference to every codec dispatch site as a non-optional argument — when no `signal` is supplied the runtime still threads an empty `{}`, never `undefined`. The internal `Codec` interface declares the parameter as required (`encode(value, ctx: SqlCodecCallContext)` / `decode(wire, ctx: SqlCodecCallContext)`); single-arg author functions `(value) => …` continue to compile via TypeScript's bivariance for trailing parameters, so codec ergonomics are unchanged.
125
+
126
+ - **`ctx.signal`** — the same `AbortSignal` reference at every codec call in one execute. Forward it to network SDKs so aborted queries stop talking to the underlying service.
127
+ - **`ctx.column`** (decode-side only) — `{ table, name }` for cells the runtime can resolve to a single column ref; `undefined` for aggregate aliases, computed projections, and other unresolvable cells. Encode-side `ctx.column` is always `undefined` (encode-time column enrichment is the middleware's domain).
128
+
129
+ ```ts
130
+ // Forward ctx.signal to a network call so aborted queries stop the SDK.
131
+ const kmsSecretCodec = codec({
132
+ typeId: 'pg/kms-secret@1',
133
+ targetTypes: ['text'],
134
+ encode: async (v: string, ctx) =>
135
+ kms.encrypt({ plaintext: v }, { signal: ctx?.signal }),
136
+ decode: async (w: string, ctx) =>
137
+ kms.decrypt({ ciphertext: w }, { signal: ctx?.signal }),
138
+ encodeJson: (v: string) => v,
139
+ decodeJson: (j: string) => j as string,
140
+ });
141
+
142
+ // Use ctx.column on decode to construct an envelope value carrying (table, name).
143
+ const envelopeCodec = codec({
144
+ typeId: 'pg/envelope@1',
145
+ targetTypes: ['text'],
146
+ encode: async (v: string) => v,
147
+ decode: async (w: string, ctx) => ({
148
+ value: w,
149
+ column: ctx?.column,
150
+ }),
151
+ encodeJson: (v: string) => v,
152
+ decodeJson: (j: string) => j as string,
153
+ });
154
+ ```
155
+
156
+ Codec bodies that ignore `ctx.signal` complete in the background (cooperative cancellation); aborts still surface to the caller as `RUNTIME.ABORTED` with `details.phase ∈ { 'encode', 'decode', 'stream' }`.
157
+
158
+ See [ADR 204 — Single-Path Async Codec Runtime](../../../../docs/architecture%20docs/adrs/ADR%20204%20-%20Single-Path%20Async%20Codec%20Runtime.md) and [ADR 207 — Codec call context: per-query `AbortSignal` and column metadata](../../../../docs/architecture%20docs/adrs/ADR%20207%20-%20Codec%20call%20context%20per-query%20AbortSignal%20and%20column%20metadata.md).
123
159
 
124
160
  ### AST Surface (`ast/*` via `exports/ast.ts`)
125
161
  - Query roots: `SelectAst`, `InsertAst`, `UpdateAst`, `DeleteAst`
@@ -1,10 +1,41 @@
1
1
  import { Type } from "arktype";
2
2
  import { JsonValue } from "@prisma-next/contract/types";
3
- import { Codec, CodecTrait, CodecTrait as CodecTrait$1 } from "@prisma-next/framework-components/codec";
3
+ import { Codec, CodecCallContext, CodecCallContext as CodecCallContext$1, 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
7
7
 
8
+ /**
9
+ * SQL-family addressing of a single column. The decode site populates a
10
+ * `SqlColumnRef` whenever it can resolve the cell to a single underlying
11
+ * `(table, column)` (the typical case for projected columns from a
12
+ * single-table source); cells the runtime cannot resolve (aggregate
13
+ * aliases, include aggregate fields, computed projections without a
14
+ * simple ref) get `column = undefined`.
15
+ *
16
+ * The shape is a structural projection of the runtime's `ColumnRef` so
17
+ * the SQL decode site can reuse the resolution it already performs for
18
+ * `RUNTIME.DECODE_FAILED` envelope construction without allocating
19
+ * twice per cell.
20
+ */
21
+ interface SqlColumnRef {
22
+ readonly table: string;
23
+ readonly name: string;
24
+ }
25
+ /**
26
+ * SQL-family per-call context. Extends the framework {@link CodecCallContext}
27
+ * (which carries `signal` only) with `column?: SqlColumnRef`, populated
28
+ * on **decode** call sites that can resolve a single underlying column
29
+ * ref. Encode call sites currently leave `column` undefined (encode-time
30
+ * column context is the middleware's domain).
31
+ *
32
+ * SQL codec authors writing a `(value, ctx)` author function for the SQL
33
+ * `codec()` factory observe this type. The framework codec dispatch
34
+ * surface (and Mongo) sees only the base `CodecCallContext`.
35
+ */
36
+ interface SqlCodecCallContext extends CodecCallContext {
37
+ readonly column?: SqlColumnRef;
38
+ }
8
39
  /**
9
40
  * Descriptor for parameterized codecs that require type parameter validation.
10
41
  * Shared between adapter (compile-time) and runtime layers to avoid duplication.
@@ -46,10 +77,18 @@ interface CodecMeta {
46
77
  * optional parameterized-codec descriptor (`paramsSchema` + `init`) for
47
78
  * codecs that require type-parameter validation (e.g. `pg/vector@1`).
48
79
  *
80
+ * `encode` and `decode` are redeclared here to narrow the per-call
81
+ * context to the SQL-family {@link SqlCodecCallContext} (adds
82
+ * `column?: SqlColumnRef`). TypeScript treats method-syntax declarations
83
+ * bivariantly, so the SQL narrowing is structurally compatible with the
84
+ * framework {@link BaseCodec} super-interface.
85
+ *
49
86
  * See `Codec` in `@prisma-next/framework-components/codec` for the codec
50
87
  * contract that this interface extends.
51
88
  */
52
89
  interface Codec$1<Id$1 extends string = string, TTraits$1 extends readonly CodecTrait[] = readonly CodecTrait[], TWire = unknown, TInput = unknown, TParams = Record<string, unknown>, THelper = unknown> extends Codec<Id$1, TTraits$1, TWire, TInput> {
90
+ encode(value: TInput, ctx: SqlCodecCallContext): Promise<TWire>;
91
+ decode(wire: TWire, ctx: SqlCodecCallContext): Promise<TInput>;
53
92
  readonly meta?: CodecMeta;
54
93
  readonly paramsSchema?: Type<TParams>;
55
94
  readonly init?: (params: TParams) => THelper;
@@ -94,20 +133,21 @@ type JsonRoundTripConfig<TInput> = [TInput] extends [JsonValue] ? {
94
133
  *
95
134
  * Author `encode` and `decode` as sync or async functions; the factory
96
135
  * produces a {@link Codec} whose query-time methods follow the boundary
97
- * contract documented on `Codec`.
136
+ * contract documented on `Codec`. Authors receive a second `ctx` options
137
+ * argument carrying the SQL-family per-call context; ignore it if you
138
+ * don't need it.
98
139
  *
99
- * `encode` is optional when omitted, an identity default is installed
100
- * (declaring "the input value already is the wire value", so `TInput` and
101
- * `TWire` are interchangeable for that codec). `decode` is always
102
- * required. `encodeJson` and `decodeJson` default to identity **only when
103
- * `TInput` is assignable to `JsonValue`**; otherwise both are required
104
- * so the contract artifact stays JSON-safe.
140
+ * Both `encode` and `decode` are required so `TInput` and `TWire` are
141
+ * always covered by an explicit author function the factory installs
142
+ * no identity fallback. `encodeJson` and `decodeJson` default to identity
143
+ * **only when `TInput` is assignable to `JsonValue`**; otherwise both are
144
+ * required so the contract artifact stays JSON-safe.
105
145
  */
106
146
  declare function codec<Id$1 extends string, const TTraits$1 extends readonly CodecTrait[] = readonly [], TWire = unknown, TInput = unknown, TParams = Record<string, unknown>, THelper = unknown>(config: {
107
147
  typeId: Id$1;
108
148
  targetTypes: readonly string[];
109
- encode?: (value: TInput) => TWire | Promise<TWire>;
110
- decode: (wire: TWire) => TInput | Promise<TInput>;
149
+ encode: (value: TInput, ctx: SqlCodecCallContext) => TWire | Promise<TWire>;
150
+ decode: (wire: TWire, ctx: SqlCodecCallContext) => TInput | Promise<TInput>;
111
151
  meta?: CodecMeta;
112
152
  paramsSchema?: Type<TParams>;
113
153
  init?: (params: TParams) => THelper;
@@ -163,5 +203,5 @@ declare function createCodecRegistry(): CodecRegistry;
163
203
  */
164
204
  declare function defineCodecs(): CodecDefBuilder<Record<never, never>>;
165
205
  //#endregion
166
- export { CodecMeta as a, CodecTrait$1 as c, ExtractDataTypes as d, codec as f, CodecInput as i, CodecTraits as l, defineCodecs as m, CodecDefBuilder as n, CodecParamsDescriptor as o, createCodecRegistry as p, CodecId as r, CodecRegistry as s, Codec$1 as t, ExtractCodecTypes as u };
167
- //# sourceMappingURL=codec-types-Dd0wpQJf.d.mts.map
206
+ export { defineCodecs as _, CodecInput as a, CodecRegistry as c, ExtractCodecTypes as d, ExtractDataTypes as f, createCodecRegistry as g, codec as h, CodecId as i, CodecTrait$1 as l, SqlColumnRef as m, CodecCallContext$1 as n, CodecMeta as o, SqlCodecCallContext as p, CodecDefBuilder as r, CodecParamsDescriptor as s, Codec$1 as t, CodecTraits as u };
207
+ //# sourceMappingURL=codec-types-DAQNecFs.d.mts.map
@@ -0,0 +1 @@
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;EAEQ,SAAA,IAAA,EAAA,MAAA;;;;;;;;;;;;;AAIW,UArEd,mBAAA,SAA4B,gBAqEd,CAAA;EAAL,SAAA,MAAA,CAAA,EApEN,YAoE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gCE,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,8 +1,8 @@
1
- import { y as RuntimeError } from "./types-3qZo79jt.mjs";
1
+ import { y as RuntimeError } from "./types-TPM2rhCa.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-0WBzgMtY.d.mts.map
8
+ //# sourceMappingURL=errors-CJKxtKSt.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors-CJKxtKSt.d.mts","names":[],"sources":["../src/errors.ts"],"sourcesContent":[],"mappings":";;;iBAEgB,WAAA,4BAEJ,+EAGT;iBAkBa,eAAA,4BAEJ,+EAGT"}
@@ -1,4 +1,4 @@
1
- import { a as CodecMeta, c as CodecTrait, d as ExtractDataTypes, f as codec, i as CodecInput, l as CodecTraits, m as defineCodecs, n as CodecDefBuilder, o as CodecParamsDescriptor, p as createCodecRegistry, r as CodecId, s as CodecRegistry, t as Codec, u as ExtractCodecTypes } from "../codec-types-Dd0wpQJf.mjs";
1
+ import { _ as defineCodecs, a as CodecInput, c as CodecRegistry, d as ExtractCodecTypes, f as ExtractDataTypes, g as createCodecRegistry, h as codec, i as CodecId, l as CodecTrait, m as SqlColumnRef, n as CodecCallContext, o as CodecMeta, p as SqlCodecCallContext, r as CodecDefBuilder, s as CodecParamsDescriptor, t as Codec, u as CodecTraits } from "../codec-types-DAQNecFs.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
 
@@ -126,9 +126,7 @@ declare const codecs: CodecDefBuilder<{
126
126
  int: Codec<"sql/int@1", readonly ["equality", "order", "numeric"], number, number, Record<string, unknown>, unknown>;
127
127
  float: Codec<"sql/float@1", readonly ["equality", "order", "numeric"], number, number, Record<string, unknown>, unknown>;
128
128
  text: Codec<"sql/text@1", readonly ["equality", "order", "textual"], string, string, Record<string, unknown>, unknown>;
129
- } & Record<"timestamp", Codec<"sql/timestamp@1", readonly ["equality", "order"], string, string, {
130
- precision?: number;
131
- }, unknown>>>;
129
+ } & Record<"timestamp", Codec<"sql/timestamp@1", readonly ["equality", "order"], Date, Date, Record<string, unknown>, unknown>>>;
132
130
  declare const sqlCodecDefinitions: {
133
131
  readonly char: {
134
132
  readonly typeId: "sql/char@1";
@@ -173,12 +171,10 @@ declare const sqlCodecDefinitions: {
173
171
  readonly timestamp: {
174
172
  readonly typeId: "sql/timestamp@1";
175
173
  readonly scalar: "timestamp";
176
- readonly codec: Codec<"sql/timestamp@1", readonly ["equality", "order"], string, string, {
177
- precision?: number;
178
- }, unknown>;
179
- readonly input: string;
180
- readonly output: string;
181
- readonly jsType: string;
174
+ readonly codec: Codec<"sql/timestamp@1", readonly ["equality", "order"], Date, Date, Record<string, unknown>, unknown>;
175
+ readonly input: Date;
176
+ readonly output: Date;
177
+ readonly jsType: Date;
182
178
  };
183
179
  };
184
180
  declare const sqlDataTypes: {
@@ -205,5 +201,5 @@ declare function compact<T extends Record<string, unknown>>(o: T): T;
205
201
  */
206
202
  declare function collectOrderedParamRefs(ast: AnyQueryAst): ReadonlyArray<ParamRef>;
207
203
  //#endregion
208
- export { Adapter, AdapterProfile, AdapterTarget, AggregateCountFn, AggregateExpr, AggregateFn, AggregateOpFn, AndExpr, AnyExpression, AnyFromSource, AnyInsertOnConflictAction, AnyInsertValue, AnyOperationArg, AnyQueryAst, AstRewriter, BinaryExpr, BinaryOp, Codec, 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, SqlCodecTypes, 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, 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 };
209
205
  //# sourceMappingURL=ast.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ast.d.mts","names":[],"sources":["../../src/ast/adapter-types.ts","../../src/ast/driver-types.ts","../../src/ast/sql-codecs.ts","../../src/ast/util.ts"],"sourcesContent":[],"mappings":";;;;;KAIY,aAAA;UAEK,eAAA;EAFL,SAAA,GAAA,EAAA,MAAa;EAER,SAAA,MAAA,EAAA,SAAe,OAAA,EAAA;AAKhC;AAAgD,UAA/B,cAA+B,CAAA,gBAAA,aAAA,GAAgB,aAAhB,CAAA,CAAA;EAAgB,SAAA,EAAA,EAAA,MAAA;EAE7C,SAAA,MAAA,EAAA,OAAA;EACM,SAAA,YAAA,EAAA,MAAA,CAAA,MAAA,EAAA,OAAA,CAAA;EAMb;;;;AAgBZ;EAKY,MAAA,EAAA,EArBA,aAqBO;EAA6C;;;;;EAGtD,mBAAA,EAAA,EAlBe,eAkBf;EASO;;;;;;EAEsC,cAAA,CAAA,GAAA,EAAA,OAAA,CAAA,EAtBvB,oBAsBuB;;UAnBtC;qBACI;;ACrCrB;AAKiB,KDoCL,OCpCK,CAAA,MAAc,OAAA,EAAA,YAAA,OAAA,EAAA,QDoCiC,gBCpCjC,CAAA,GAAA,CAA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AAA,EAAA;MAwBgB,SAAA,CAAA,EAAA,MAAA;IAhCU,CAAA,EAAA,OAAA,CAAA;IAAY,SAAA,KAAA,EAAA,MAAA;IAmClC,SAAA,MAAe,EAAA,MAAA;IACpB,SAAA,MAAA,EAAA,MAAA;EACE,CAAA;CAF0B;AAAY,cCiFvC,YDjFuC,EAAA;EAKnC,SAAA,IAAA,EAAY,YAAA;EACb,SAAA,OAAA,EAAA,eAAA;EAAkC,SAAA,GAAA,EAAA,WAAA;EAAkC,SAAA,KAAA,EAAA,aAAA;EAAd,SAAA,IAAA,EAAA,YAAA;EAClD,SAAA,SAAA,EAAA,iBAAA;CAA4B;AAAR,KC2E5B,aAAA,GD3E4B,OC2EL,MAAA,CAAO,UD3EF;;;iBEhExB,kBAAkB,4BAA4B,IAAI;;;;AHElE;AAEA;AAKA;;;;;AASY,iBGEI,uBAAA,CHFJ,GAAA,EGEiC,WHFjC,CAAA,EGE+C,aHF/C,CGE6D,QHF7D,CAAA"}
1
+ {"version":3,"file":"ast.d.mts","names":[],"sources":["../../src/ast/adapter-types.ts","../../src/ast/driver-types.ts","../../src/ast/sql-codecs.ts","../../src/ast/util.ts"],"sourcesContent":[],"mappings":";;;;;KAIY,aAAA;UAEK,eAAA;EAFL,SAAA,GAAA,EAAA,MAAa;EAER,SAAA,MAAA,EAAA,SAAe,OAAA,EAAA;AAKhC;AAAgD,UAA/B,cAA+B,CAAA,gBAAA,aAAA,GAAgB,aAAhB,CAAA,CAAA;EAAgB,SAAA,EAAA,EAAA,MAAA;EAE7C,SAAA,MAAA,EAAA,OAAA;EACM,SAAA,YAAA,EAAA,MAAA,CAAA,MAAA,EAAA,OAAA,CAAA;EAMb;;;;AAgBZ;EAKY,MAAA,EAAA,EArBA,aAqBO;EAA6C;;;;;EAGtD,mBAAA,EAAA,EAlBe,eAkBf;EASO;;;;;;EAEsC,cAAA,CAAA,GAAA,EAAA,OAAA,CAAA,EAtBvB,oBAsBuB;;UAnBtC;qBACI;;ACrCrB;AA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AAA;IAOT,SAAA,MAAA,MAAA;IAwBgB,SAAA,MAAA,MAAA;EAhCU,CAAA;CAAY;AAmClC,cCkGJ,YDlGmB,EAAA;EACpB,SAAA,IAAA,EAAA,YAAA;EACE,SAAA,OAAA,EAAA,eAAA;EAF0B,SAAA,GAAA,EAAA,WAAA;EAAY,SAAA,KAAA,EAAA,aAAA;EAKnC,SAAA,IAAA,EAAY,YAAA;EACb,SAAA,SAAA,EAAA,iBAAA;CAAkC;AAAkC,KC6FxE,aAAA,GD7FwE,OC6FjD,MAAA,CAAO,UD7F0C;;;iBE/DpE,kBAAkB,4BAA4B,IAAI;;;;AHElE;AAEA;AAKA;;;;;AASY,iBGEI,uBAAA,CHFJ,GAAA,EGEiC,WHFjC,CAAA,EGE+C,aHF/C,CGE6D,QHF7D,CAAA"}
@@ -78,18 +78,19 @@ var CodecRegistryImpl = class {
78
78
  *
79
79
  * Author `encode` and `decode` as sync or async functions; the factory
80
80
  * produces a {@link Codec} whose query-time methods follow the boundary
81
- * contract documented on `Codec`.
81
+ * contract documented on `Codec`. Authors receive a second `ctx` options
82
+ * argument carrying the SQL-family per-call context; ignore it if you
83
+ * don't need it.
82
84
  *
83
- * `encode` is optional when omitted, an identity default is installed
84
- * (declaring "the input value already is the wire value", so `TInput` and
85
- * `TWire` are interchangeable for that codec). `decode` is always
86
- * required. `encodeJson` and `decodeJson` default to identity **only when
87
- * `TInput` is assignable to `JsonValue`**; otherwise both are required
88
- * so the contract artifact stays JSON-safe.
85
+ * Both `encode` and `decode` are required so `TInput` and `TWire` are
86
+ * always covered by an explicit author function the factory installs
87
+ * no identity fallback. `encodeJson` and `decodeJson` default to identity
88
+ * **only when `TInput` is assignable to `JsonValue`**; otherwise both are
89
+ * required so the contract artifact stays JSON-safe.
89
90
  */
90
91
  function codec(config) {
91
92
  const identity = (v) => v;
92
- const userEncode = config.encode ?? ((value) => value);
93
+ const userEncode = config.encode;
93
94
  const userDecode = config.decode;
94
95
  const widenedConfig = config;
95
96
  return {
@@ -100,16 +101,16 @@ function codec(config) {
100
101
  ...ifDefined("init", config.init),
101
102
  ...ifDefined("traits", config.traits ? Object.freeze([...config.traits]) : void 0),
102
103
  ...ifDefined("renderOutputType", config.renderOutputType),
103
- encode: (value) => {
104
+ encode: (value, ctx) => {
104
105
  try {
105
- return Promise.resolve(userEncode(value));
106
+ return Promise.resolve(userEncode(value, ctx));
106
107
  } catch (error) {
107
108
  return Promise.reject(error);
108
109
  }
109
110
  },
110
- decode: (wire) => {
111
+ decode: (wire, ctx) => {
111
112
  try {
112
- return Promise.resolve(userDecode(wire));
113
+ return Promise.resolve(userDecode(wire, ctx));
113
114
  } catch (error) {
114
115
  return Promise.reject(error);
115
116
  }
@@ -270,8 +271,15 @@ const sqlTimestampCodec = codec({
270
271
  typeId: SQL_TIMESTAMP_CODEC_ID,
271
272
  targetTypes: ["timestamp"],
272
273
  traits: ["equality", "order"],
273
- encode: (value) => value instanceof Date ? value.toISOString() : value,
274
- decode: (wire) => wire instanceof Date ? wire.toISOString() : wire,
274
+ encode: (value) => value,
275
+ decode: (wire) => wire,
276
+ encodeJson: (value) => value.toISOString(),
277
+ decodeJson: (json) => {
278
+ if (typeof json !== "string") throw new Error(`Expected ISO date string for sql/timestamp@1, got ${typeof json}`);
279
+ const date = new Date(json);
280
+ if (Number.isNaN(date.getTime())) throw new Error(`Invalid ISO date string for sql/timestamp@1: ${json}`);
281
+ return date;
282
+ },
275
283
  paramsSchema: precisionParamsSchema,
276
284
  renderOutputType: (typeParams) => {
277
285
  const precision = typeParams["precision"];
@@ -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 { Codec as BaseCodec, CodecTrait } 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 { CodecTrait } from '@prisma-next/framework-components/codec';\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 * 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 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`.\n *\n * `encode` is optional — when omitted, an identity default is installed\n * (declaring \"the input value already is the wire value\", so `TInput` and\n * `TWire` are interchangeable for that codec). `decode` is always\n * required. `encodeJson` and `decodeJson` default to identity **only when\n * `TInput` is assignable to `JsonValue`**; otherwise both are required\n * 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) => TWire | Promise<TWire>;\n decode: (wire: TWire) => 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 synchronous identity default is only safe when the author has\n // declared \"the input is already the wire value\" (i.e. TInput == TWire);\n // it returns the value directly, never a Promise.\n const userEncode = config.encode ?? ((value: TInput) => value as unknown as TWire);\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) => {\n try {\n return Promise.resolve(userEncode(value));\n } catch (error) {\n return Promise.reject(error);\n }\n },\n decode: (wire) => {\n try {\n return Promise.resolve(userDecode(wire));\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 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 typeId: SQL_TIMESTAMP_CODEC_ID,\n targetTypes: ['timestamp'],\n traits: ['equality', 'order'],\n encode: (value: string | Date): string => (value instanceof Date ? value.toISOString() : value),\n decode: (wire: string | Date): string => (wire instanceof Date ? wire.toISOString() : wire),\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":";;;;;;;;AA8FA,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,O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AAEnB,QAAO,OAAO,OAAO,QAAQ"}
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,GAA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AAI,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-Dd0wpQJf.mjs";
2
- import "../query-lane-context-2K0OsuLw.mjs";
3
- import "../types-3qZo79jt.mjs";
4
- import { n as planUnsupported, t as planInvalid } from "../errors-0WBzgMtY.mjs";
1
+ import "../codec-types-DAQNecFs.mjs";
2
+ import "../query-lane-context-Cch9CN9H.mjs";
3
+ import "../types-TPM2rhCa.mjs";
4
+ import { n as planUnsupported, t as planInvalid } from "../errors-CJKxtKSt.mjs";
5
5
  export { planInvalid, planUnsupported };
@@ -1,3 +1,3 @@
1
- import "../codec-types-Dd0wpQJf.mjs";
2
- import { a as JsonSchemaValidationResult, c as MutationDefaultsOptions, i as JsonSchemaValidationError, l as TypeHelperRegistry, n as ExecutionContext, o as JsonSchemaValidatorRegistry, r as JsonSchemaValidateFn, s as MutationDefaultsOp, t as AppliedMutationDefault } from "../query-lane-context-2K0OsuLw.mjs";
1
+ import "../codec-types-DAQNecFs.mjs";
2
+ import { a as JsonSchemaValidationResult, c as MutationDefaultsOptions, i as JsonSchemaValidationError, l as TypeHelperRegistry, n as ExecutionContext, o as JsonSchemaValidatorRegistry, r as JsonSchemaValidateFn, s as MutationDefaultsOp, t as AppliedMutationDefault } from "../query-lane-context-Cch9CN9H.mjs";
3
3
  export { AppliedMutationDefault, ExecutionContext, JsonSchemaValidateFn, JsonSchemaValidationError, JsonSchemaValidationResult, JsonSchemaValidatorRegistry, MutationDefaultsOp, MutationDefaultsOptions, TypeHelperRegistry };
@@ -1,5 +1,5 @@
1
- import "../codec-types-Dd0wpQJf.mjs";
2
- import "../query-lane-context-2K0OsuLw.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-3qZo79jt.mjs";
1
+ import "../codec-types-DAQNecFs.mjs";
2
+ import "../query-lane-context-Cch9CN9H.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-TPM2rhCa.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 { a as CodecMeta, c as CodecTrait, d as ExtractDataTypes, f as codec, i as CodecInput, l as CodecTraits, m as defineCodecs, n as CodecDefBuilder, o as CodecParamsDescriptor, p as createCodecRegistry, r as CodecId, s as CodecRegistry, t as Codec, u as ExtractCodecTypes } from "./codec-types-Dd0wpQJf.mjs";
1
+ import { _ as defineCodecs, a as CodecInput, c as CodecRegistry, d as ExtractCodecTypes, f as ExtractDataTypes, g as createCodecRegistry, h as codec, i as CodecId, l as CodecTrait, m as SqlColumnRef, n as CodecCallContext, o as CodecMeta, p as SqlCodecCallContext, r as CodecDefBuilder, s as CodecParamsDescriptor, t as Codec, u as CodecTraits } from "./codec-types-DAQNecFs.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 JsonSchemaValidationResult, c as MutationDefaultsOptions, i as JsonSchemaValidationError, l as TypeHelperRegistry, n as ExecutionContext, o as JsonSchemaValidatorRegistry, r as JsonSchemaValidateFn, s as MutationDefaultsOp, t as AppliedMutationDefault } from "./query-lane-context-2K0OsuLw.mjs";
4
+ import { a as JsonSchemaValidationResult, c as MutationDefaultsOptions, i as JsonSchemaValidationError, l as TypeHelperRegistry, n as ExecutionContext, o as JsonSchemaValidatorRegistry, r as JsonSchemaValidateFn, s as MutationDefaultsOp, t as AppliedMutationDefault } from "./query-lane-context-Cch9CN9H.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-3qZo79jt.mjs";
7
- import { n as planUnsupported, t as planInvalid } from "./errors-0WBzgMtY.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-TPM2rhCa.mjs";
7
+ import { n as planUnsupported, t as planInvalid } from "./errors-CJKxtKSt.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, 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, SqlCodecTypes, 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, 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 };
@@ -1,4 +1,4 @@
1
- import { s as CodecRegistry } from "./codec-types-Dd0wpQJf.mjs";
1
+ import { c as CodecRegistry } from "./codec-types-DAQNecFs.mjs";
2
2
  import { Contract } from "@prisma-next/contract/types";
3
3
  import { SqlOperationRegistry } from "@prisma-next/sql-operations";
4
4
  import { SqlStorage } from "@prisma-next/sql-contract/types";
@@ -86,4 +86,4 @@ interface ExecutionContext<TContract extends Contract<SqlStorage> = Contract<Sql
86
86
  }
87
87
  //#endregion
88
88
  export { JsonSchemaValidationResult as a, MutationDefaultsOptions as c, JsonSchemaValidationError as i, TypeHelperRegistry as l, ExecutionContext as n, JsonSchemaValidatorRegistry as o, JsonSchemaValidateFn as r, MutationDefaultsOp as s, AppliedMutationDefault as t };
89
- //# sourceMappingURL=query-lane-context-2K0OsuLw.d.mts.map
89
+ //# sourceMappingURL=query-lane-context-Cch9CN9H.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"query-lane-context-2K0OsuLw.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"}
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"}
@@ -1,5 +1,5 @@
1
1
  import { G as ParamRef, h as ColumnRef } from "./types-B4dL4lc3.mjs";
2
- import { n as ExecutionContext } from "./query-lane-context-2K0OsuLw.mjs";
2
+ import { n as ExecutionContext } from "./query-lane-context-Cch9CN9H.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-3qZo79jt.d.mts.map
193
+ //# sourceMappingURL=types-TPM2rhCa.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types-3qZo79jt.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;;;;AAI1B;KAOb,oBACwB,CAAA,kBAAT,QAAS,CAAA,UAAA,CAAA,EAAA,kBAAA,MAAA,EAAA,mBAAA,MAAA,CAAA,GAGzB,mBAHyB,CAGL,SAHK,EAGM,SAHN,CAAA,SAAA,KAAA,mBAAA,MAAA,GAIzB,SAJyB,CAAA,QAAA,CAAA,SAAA,KAAA,gBAIwB,MAJxB,CAAA,MAAA,EAAA,OAAA,CAAA,GAKvB,SALuB,GAAA,MAKL,MALK,SAAA,KAAA,cAAA,MAAA,GAMrB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B,YAAA,SAAqB;;;;qBAIjB;;;;UAKJ,cAAA;;;UAIA,YAAA;oBACG;;UAGH,oCAAoC,SAAS,cAAc,SAAS;oBACjE,iBAAiB"}
package/package.json CHANGED
@@ -1,24 +1,24 @@
1
1
  {
2
2
  "name": "@prisma-next/sql-relational-core",
3
- "version": "0.5.0-dev.28",
3
+ "version": "0.5.0-dev.29",
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/contract": "0.5.0-dev.28",
11
- "@prisma-next/sql-contract": "0.5.0-dev.28",
12
- "@prisma-next/sql-operations": "0.5.0-dev.28",
13
- "@prisma-next/utils": "0.5.0-dev.28",
14
- "@prisma-next/framework-components": "0.5.0-dev.28",
15
- "@prisma-next/operations": "0.5.0-dev.28"
10
+ "@prisma-next/contract": "0.5.0-dev.29",
11
+ "@prisma-next/framework-components": "0.5.0-dev.29",
12
+ "@prisma-next/sql-contract": "0.5.0-dev.29",
13
+ "@prisma-next/operations": "0.5.0-dev.29",
14
+ "@prisma-next/utils": "0.5.0-dev.29",
15
+ "@prisma-next/sql-operations": "0.5.0-dev.29"
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.28",
21
+ "@prisma-next/sql-contract-ts": "0.5.0-dev.29",
22
22
  "@prisma-next/test-utils": "0.0.1",
23
23
  "@prisma-next/tsconfig": "0.0.0",
24
24
  "@prisma-next/tsdown": "0.0.0"
@@ -1,10 +1,47 @@
1
1
  import type { JsonValue } from '@prisma-next/contract/types';
2
- import type { Codec as BaseCodec, CodecTrait } from '@prisma-next/framework-components/codec';
2
+ import type {
3
+ Codec as BaseCodec,
4
+ CodecCallContext,
5
+ CodecTrait,
6
+ } from '@prisma-next/framework-components/codec';
3
7
  import { ifDefined } from '@prisma-next/utils/defined';
4
8
  import type { Type } from 'arktype';
5
9
  import type { O } from 'ts-toolbelt';
6
10
 
7
- export type { CodecTrait } from '@prisma-next/framework-components/codec';
11
+ export type { CodecCallContext, CodecTrait } from '@prisma-next/framework-components/codec';
12
+
13
+ /**
14
+ * SQL-family addressing of a single column. The decode site populates a
15
+ * `SqlColumnRef` whenever it can resolve the cell to a single underlying
16
+ * `(table, column)` (the typical case for projected columns from a
17
+ * single-table source); cells the runtime cannot resolve (aggregate
18
+ * aliases, include aggregate fields, computed projections without a
19
+ * simple ref) get `column = undefined`.
20
+ *
21
+ * The shape is a structural projection of the runtime's `ColumnRef` so
22
+ * the SQL decode site can reuse the resolution it already performs for
23
+ * `RUNTIME.DECODE_FAILED` envelope construction without allocating
24
+ * twice per cell.
25
+ */
26
+ export interface SqlColumnRef {
27
+ readonly table: string;
28
+ readonly name: string;
29
+ }
30
+
31
+ /**
32
+ * SQL-family per-call context. Extends the framework {@link CodecCallContext}
33
+ * (which carries `signal` only) with `column?: SqlColumnRef`, populated
34
+ * on **decode** call sites that can resolve a single underlying column
35
+ * ref. Encode call sites currently leave `column` undefined (encode-time
36
+ * column context is the middleware's domain).
37
+ *
38
+ * SQL codec authors writing a `(value, ctx)` author function for the SQL
39
+ * `codec()` factory observe this type. The framework codec dispatch
40
+ * surface (and Mongo) sees only the base `CodecCallContext`.
41
+ */
42
+ export interface SqlCodecCallContext extends CodecCallContext {
43
+ readonly column?: SqlColumnRef;
44
+ }
8
45
 
9
46
  /**
10
47
  * Descriptor for parameterized codecs that require type parameter validation.
@@ -51,6 +88,12 @@ export interface CodecMeta {
51
88
  * optional parameterized-codec descriptor (`paramsSchema` + `init`) for
52
89
  * codecs that require type-parameter validation (e.g. `pg/vector@1`).
53
90
  *
91
+ * `encode` and `decode` are redeclared here to narrow the per-call
92
+ * context to the SQL-family {@link SqlCodecCallContext} (adds
93
+ * `column?: SqlColumnRef`). TypeScript treats method-syntax declarations
94
+ * bivariantly, so the SQL narrowing is structurally compatible with the
95
+ * framework {@link BaseCodec} super-interface.
96
+ *
54
97
  * See `Codec` in `@prisma-next/framework-components/codec` for the codec
55
98
  * contract that this interface extends.
56
99
  */
@@ -62,6 +105,8 @@ export interface Codec<
62
105
  TParams = Record<string, unknown>,
63
106
  THelper = unknown,
64
107
  > extends BaseCodec<Id, TTraits, TWire, TInput> {
108
+ encode(value: TInput, ctx: SqlCodecCallContext): Promise<TWire>;
109
+ decode(wire: TWire, ctx: SqlCodecCallContext): Promise<TInput>;
65
110
  readonly meta?: CodecMeta;
66
111
  readonly paramsSchema?: Type<TParams>;
67
112
  readonly init?: (params: TParams) => THelper;
@@ -203,14 +248,15 @@ type JsonRoundTripConfig<TInput> = [TInput] extends [JsonValue]
203
248
  *
204
249
  * Author `encode` and `decode` as sync or async functions; the factory
205
250
  * produces a {@link Codec} whose query-time methods follow the boundary
206
- * contract documented on `Codec`.
251
+ * contract documented on `Codec`. Authors receive a second `ctx` options
252
+ * argument carrying the SQL-family per-call context; ignore it if you
253
+ * don't need it.
207
254
  *
208
- * `encode` is optional when omitted, an identity default is installed
209
- * (declaring "the input value already is the wire value", so `TInput` and
210
- * `TWire` are interchangeable for that codec). `decode` is always
211
- * required. `encodeJson` and `decodeJson` default to identity **only when
212
- * `TInput` is assignable to `JsonValue`**; otherwise both are required
213
- * so the contract artifact stays JSON-safe.
255
+ * Both `encode` and `decode` are required so `TInput` and `TWire` are
256
+ * always covered by an explicit author function the factory installs
257
+ * no identity fallback. `encodeJson` and `decodeJson` default to identity
258
+ * **only when `TInput` is assignable to `JsonValue`**; otherwise both are
259
+ * required so the contract artifact stays JSON-safe.
214
260
  */
215
261
  export function codec<
216
262
  Id extends string,
@@ -223,8 +269,8 @@ export function codec<
223
269
  config: {
224
270
  typeId: Id;
225
271
  targetTypes: readonly string[];
226
- encode?: (value: TInput) => TWire | Promise<TWire>;
227
- decode: (wire: TWire) => TInput | Promise<TInput>;
272
+ encode: (value: TInput, ctx: SqlCodecCallContext) => TWire | Promise<TWire>;
273
+ decode: (wire: TWire, ctx: SqlCodecCallContext) => TInput | Promise<TInput>;
228
274
  meta?: CodecMeta;
229
275
  paramsSchema?: Type<TParams>;
230
276
  init?: (params: TParams) => THelper;
@@ -233,10 +279,13 @@ export function codec<
233
279
  } & JsonRoundTripConfig<TInput>,
234
280
  ): Codec<Id, TTraits, TWire, TInput, TParams, THelper> {
235
281
  const identity = (v: unknown) => v;
236
- // The synchronous identity default is only safe when the author has
237
- // declared "the input is already the wire value" (i.e. TInput == TWire);
238
- // it returns the value directly, never a Promise.
239
- const userEncode = config.encode ?? ((value: TInput) => value as unknown as TWire);
282
+ // The runtime allocates one `SqlCodecCallContext` per `runtime.execute()`
283
+ // call (no caller-supplied `signal` produces `{}` instead of `undefined`)
284
+ // and threads it as a non-optional reference to every codec call. The
285
+ // author surface keeps the second parameter optional so single-arg
286
+ // `(value) => …` authors continue to satisfy the signature via
287
+ // TypeScript's bivariance for trailing parameters.
288
+ const userEncode = config.encode;
240
289
  const userDecode = config.decode;
241
290
  // The conditional JsonRoundTripConfig narrows TInput|JsonValue at the
242
291
  // boundary; widen back to the generic shape inside the factory body.
@@ -255,16 +304,16 @@ export function codec<
255
304
  config.traits ? (Object.freeze([...config.traits]) as TTraits) : undefined,
256
305
  ),
257
306
  ...ifDefined('renderOutputType', config.renderOutputType),
258
- encode: (value) => {
307
+ encode: (value, ctx) => {
259
308
  try {
260
- return Promise.resolve(userEncode(value));
309
+ return Promise.resolve(userEncode(value, ctx));
261
310
  } catch (error) {
262
311
  return Promise.reject(error);
263
312
  }
264
313
  },
265
- decode: (wire) => {
314
+ decode: (wire, ctx) => {
266
315
  try {
267
- return Promise.resolve(userDecode(wire));
316
+ return Promise.resolve(userDecode(wire, ctx));
268
317
  } catch (error) {
269
318
  return Promise.reject(error);
270
319
  }
@@ -1,3 +1,4 @@
1
+ import type { JsonValue } from '@prisma-next/contract/types';
1
2
  import { type as arktype } from 'arktype';
2
3
  import { codec, defineCodecs } from './codec-types';
3
4
 
@@ -104,12 +105,28 @@ const sqlTextCodec = codec({
104
105
  decode: (wire: string): string => wire,
105
106
  });
106
107
 
107
- const sqlTimestampCodec = codec({
108
+ const sqlTimestampCodec = codec<
109
+ typeof SQL_TIMESTAMP_CODEC_ID,
110
+ readonly ['equality', 'order'],
111
+ Date,
112
+ Date
113
+ >({
108
114
  typeId: SQL_TIMESTAMP_CODEC_ID,
109
115
  targetTypes: ['timestamp'],
110
116
  traits: ['equality', 'order'],
111
- encode: (value: string | Date): string => (value instanceof Date ? value.toISOString() : value),
112
- decode: (wire: string | Date): string => (wire instanceof Date ? wire.toISOString() : wire),
117
+ encode: (value: Date): Date => value,
118
+ decode: (wire: Date): Date => wire,
119
+ encodeJson: (value: Date): JsonValue => value.toISOString(),
120
+ decodeJson: (json: JsonValue): Date => {
121
+ if (typeof json !== 'string') {
122
+ throw new Error(`Expected ISO date string for sql/timestamp@1, got ${typeof json}`);
123
+ }
124
+ const date = new Date(json);
125
+ if (Number.isNaN(date.getTime())) {
126
+ throw new Error(`Invalid ISO date string for sql/timestamp@1: ${json}`);
127
+ }
128
+ return date;
129
+ },
113
130
  paramsSchema: precisionParamsSchema,
114
131
  renderOutputType: (typeParams) => {
115
132
  const precision = typeParams['precision'];
@@ -1 +0,0 @@
1
- {"version":3,"file":"codec-types-Dd0wpQJf.d.mts","names":[],"sources":["../src/ast/codec-types.ts"],"sourcesContent":[],"mappings":";;;;;;;;AAeA;;;;;;AAe8C,UAf7B,qBAe6B,CAAA,UAfG,MAeH,CAAA,MAAA,EAAA,OAAA,CAAA,EAAA,UAAA,OAAA,CAAA,CAAA;EAO7B;EAmBA,SAAA,OAAK,EAAA,MAAA;EAEK;;;;EAKH,SAAA,YAAA,EAxCC,IAwCD,CAxCM,OAwCN,CAAA;EAAS;;;;;EAGN,SAAA,IAAA,CAAA,EAAA,CAAA,MAAA,EApCA,OAoCA,EAAA,GApCY,OAoCZ;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