@prisma-next/sql-relational-core 0.5.0-dev.23 → 0.5.0-dev.25
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 +1 -1
- package/dist/{errors-DGTx5yrY.d.mts → errors-0WBzgMtY.d.mts} +2 -2
- package/dist/errors-0WBzgMtY.d.mts.map +1 -0
- package/dist/exports/ast.d.mts +13 -2
- package/dist/exports/ast.d.mts.map +1 -1
- package/dist/exports/ast.mjs +22 -2
- package/dist/exports/ast.mjs.map +1 -1
- package/dist/exports/errors.d.mts +2 -2
- package/dist/exports/expression.d.mts +1 -1
- package/dist/exports/expression.d.mts.map +1 -1
- package/dist/exports/expression.mjs +1 -1
- package/dist/exports/plan.d.mts +3 -3
- package/dist/exports/plan.mjs +1 -17
- package/dist/exports/types.d.mts +2 -2
- package/dist/index.d.mts +8 -8
- package/dist/index.mjs +4 -4
- package/dist/{plan-fzKZz634.d.mts → plan-C7SiEWkN.d.mts} +3 -10
- package/dist/plan-C7SiEWkN.d.mts.map +1 -0
- package/dist/query-lane-context-2K0OsuLw.d.mts.map +1 -1
- package/dist/{sql-execution-plan-CRa8P62o.d.mts → sql-execution-plan-Dgx7BGin.d.mts} +2 -2
- package/dist/{sql-execution-plan-CRa8P62o.d.mts.map → sql-execution-plan-Dgx7BGin.d.mts.map} +1 -1
- package/dist/{types-DMssjYwC.d.mts → types-3qZo79jt.d.mts} +4 -6
- package/dist/{types-DMssjYwC.d.mts.map → types-3qZo79jt.d.mts.map} +1 -1
- package/dist/{types-DKqt0Ynw.d.mts → types-B4dL4lc3.d.mts} +17 -22
- package/dist/types-B4dL4lc3.d.mts.map +1 -0
- package/dist/{types-BmPWLErB.d.mts → types-BUlUvdIU.d.mts} +3 -3
- package/dist/{types-BmPWLErB.d.mts.map → types-BUlUvdIU.d.mts.map} +1 -1
- package/dist/{types--BjM9czT.mjs → types-DUL-3vy6.mjs} +71 -89
- package/dist/types-DUL-3vy6.mjs.map +1 -0
- package/package.json +9 -9
- package/src/ast/types.ts +142 -172
- package/src/ast/util.ts +23 -0
- package/src/plan.ts +0 -20
- package/src/types.ts +1 -3
- package/dist/errors-DGTx5yrY.d.mts.map +0 -1
- package/dist/exports/plan.mjs.map +0 -1
- package/dist/plan-fzKZz634.d.mts.map +0 -1
- package/dist/types--BjM9czT.mjs.map +0 -1
- package/dist/types-DKqt0Ynw.d.mts.map +0 -1
package/README.md
CHANGED
|
@@ -89,7 +89,7 @@ flowchart TD
|
|
|
89
89
|
|
|
90
90
|
### Plan Helpers (`plan.ts`)
|
|
91
91
|
- Defines `SqlQueryPlan<Row>` interface for SQL query plans produced by lanes before lowering
|
|
92
|
-
-
|
|
92
|
+
- Per [ADR 205](../../../../docs/architecture%20docs/adrs/ADR%20205%20-%20Execution%20metadata%20lives%20on%20AST.md), codec IDs travel on `ProjectionItem.codecId` (output) and `ParamRef.codecId` (parameters) on the AST itself, not on plan-level descriptor lists
|
|
93
93
|
|
|
94
94
|
### Codec Factory (`ast/codec-types.ts` via `exports/ast.ts`)
|
|
95
95
|
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { y as RuntimeError } from "./types-
|
|
1
|
+
import { y as RuntimeError } from "./types-3qZo79jt.mjs";
|
|
2
2
|
|
|
3
3
|
//#region src/errors.d.ts
|
|
4
4
|
declare function planInvalid(message: string, details?: Record<string, unknown>, hints?: readonly string[], docs?: readonly string[]): RuntimeError;
|
|
5
5
|
declare function planUnsupported(message: string, details?: Record<string, unknown>, hints?: readonly string[], docs?: readonly string[]): RuntimeError;
|
|
6
6
|
//#endregion
|
|
7
7
|
export { planUnsupported as n, planInvalid as t };
|
|
8
|
-
//# sourceMappingURL=errors-
|
|
8
|
+
//# sourceMappingURL=errors-0WBzgMtY.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors-0WBzgMtY.d.mts","names":[],"sources":["../src/errors.ts"],"sourcesContent":[],"mappings":";;;iBAEgB,WAAA,4BAEJ,+EAGT;iBAkBa,eAAA,4BAEJ,+EAGT"}
|
package/dist/exports/ast.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
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";
|
|
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-
|
|
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
|
|
|
5
5
|
//#region src/ast/adapter-types.d.ts
|
|
@@ -193,6 +193,17 @@ type SqlCodecTypes = typeof codecs.CodecTypes;
|
|
|
193
193
|
//#endregion
|
|
194
194
|
//#region src/ast/util.d.ts
|
|
195
195
|
declare function compact<T extends Record<string, unknown>>(o: T): T;
|
|
196
|
+
/**
|
|
197
|
+
* Walks an AST's parameter references in first-encounter order and dedupes
|
|
198
|
+
* by ParamRef identity. The single canonical helper used by every consumer
|
|
199
|
+
* that aligns `plan.params` with metadata-by-index — the SQL builder lane,
|
|
200
|
+
* the SQL ORM client, the SQL runtime encoder, and the Postgres renderer's
|
|
201
|
+
* `$N` index map — so the four walks cannot drift in dedupe semantics.
|
|
202
|
+
*
|
|
203
|
+
* SQLite's `?`-placeholder renderer intentionally does NOT use this helper
|
|
204
|
+
* because it needs one params entry per occurrence in the SQL.
|
|
205
|
+
*/
|
|
206
|
+
declare function collectOrderedParamRefs(ast: AnyQueryAst): ReadonlyArray<ParamRef>;
|
|
196
207
|
//#endregion
|
|
197
|
-
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, compact, createCodecRegistry, defineCodecs, isQueryAst, isWhereExpr, queryAstKinds, sqlCodecDefinitions, sqlDataTypes, whereExprKinds };
|
|
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 };
|
|
198
209
|
//# 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,EA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,OAAA,EAAA,SAAA,CAAA,EAAA,MAAA,EAAA,MAAA,QAAA,CAAA,MAAA,EAAA,OAAA,CAAA,EAAA,OAAA,CAAA;IAAR,SAAA,KAAA,EAAA,MAAA;IACZ,SAAA,MAAA,EAAA,MAAA;IAJyC,SAAA,MAAA,EAAA,MAAA;EAAY,CAAA;EAO/C,SAAA,SAAc,EAAA;IACD,SAAA,MAAA,EAAA,iBAAA;IAAR,SAAA,MAAA,EAAA,WAAA;IAOT,SAAA,KAAA,OAAA,CAAA,iBAAA,EAAA,SAAA,CAAA,UAAA,EAAA,OAAA,CAAA,EAAA,MAAA,EAAA,MAAA,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;;;
|
|
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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AAA,QAAA,CAAA,MAAA,EAAA,OAAA,CAAA,EAAA,OAAA,CAAA;IAAR,SAAA,KAAA,EAAA,MAAA;IACZ,SAAA,MAAA,EAAA,MAAA;IAJyC,SAAA,MAAA,EAAA,MAAA;EAAY,CAAA;EAO/C,SAAA,SAAc,EAAA;IACD,SAAA,MAAA,EAAA,iBAAA;IAAR,SAAA,MAAA,EAAA,WAAA;IAOT,SAAA,KAAA,OAAA,CAAA,iBAAA,EAAA,SAAA,CAAA,UAAA,EAAA,OAAA,CAAA,EAAA,MAAA,EAAA,MAAA,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"}
|
package/dist/exports/ast.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A as UpdateAst, C as OrExpr, D as SelectAst, E as ProjectionItem, M as isWhereExpr, N as queryAstKinds, O as SubqueryExpr, P as whereExprKinds, S as OperationExpr, T as ParamRef, _ as JsonObjectExpr, a as DefaultValueExpr, b as NotExpr, c as DoNothingConflictAction, d as ExistsExpr, f as IdentifierRef, g as JsonArrayAggExpr, h as JoinAst, i as ColumnRef, j as isQueryAst, k as TableSource, l as DoUpdateSetConflictAction, m as InsertOnConflict, n as AndExpr, o as DeleteAst, p as InsertAst, r as BinaryExpr, s as DerivedTableSource, t as AggregateExpr, u as EqColJoinOn, v as ListExpression, w as OrderByItem, x as NullCheckExpr, y as LiteralExpr } from "../types
|
|
1
|
+
import { A as UpdateAst, C as OrExpr, D as SelectAst, E as ProjectionItem, M as isWhereExpr, N as queryAstKinds, O as SubqueryExpr, P as whereExprKinds, S as OperationExpr, T as ParamRef, _ as JsonObjectExpr, a as DefaultValueExpr, b as NotExpr, c as DoNothingConflictAction, d as ExistsExpr, f as IdentifierRef, g as JsonArrayAggExpr, h as JoinAst, i as ColumnRef, j as isQueryAst, k as TableSource, l as DoUpdateSetConflictAction, m as InsertOnConflict, n as AndExpr, o as DeleteAst, p as InsertAst, r as BinaryExpr, s as DerivedTableSource, t as AggregateExpr, u as EqColJoinOn, v as ListExpression, w as OrderByItem, x as NullCheckExpr, y as LiteralExpr } from "../types-DUL-3vy6.mjs";
|
|
2
2
|
import { ifDefined } from "@prisma-next/utils/defined";
|
|
3
3
|
import { type } from "arktype";
|
|
4
4
|
|
|
@@ -295,7 +295,27 @@ function compact(o) {
|
|
|
295
295
|
}
|
|
296
296
|
return out;
|
|
297
297
|
}
|
|
298
|
+
/**
|
|
299
|
+
* Walks an AST's parameter references in first-encounter order and dedupes
|
|
300
|
+
* by ParamRef identity. The single canonical helper used by every consumer
|
|
301
|
+
* that aligns `plan.params` with metadata-by-index — the SQL builder lane,
|
|
302
|
+
* the SQL ORM client, the SQL runtime encoder, and the Postgres renderer's
|
|
303
|
+
* `$N` index map — so the four walks cannot drift in dedupe semantics.
|
|
304
|
+
*
|
|
305
|
+
* SQLite's `?`-placeholder renderer intentionally does NOT use this helper
|
|
306
|
+
* because it needs one params entry per occurrence in the SQL.
|
|
307
|
+
*/
|
|
308
|
+
function collectOrderedParamRefs(ast) {
|
|
309
|
+
const seen = /* @__PURE__ */ new Set();
|
|
310
|
+
const ordered = [];
|
|
311
|
+
for (const ref of ast.collectParamRefs()) {
|
|
312
|
+
if (seen.has(ref)) continue;
|
|
313
|
+
seen.add(ref);
|
|
314
|
+
ordered.push(ref);
|
|
315
|
+
}
|
|
316
|
+
return Object.freeze(ordered);
|
|
317
|
+
}
|
|
298
318
|
|
|
299
319
|
//#endregion
|
|
300
|
-
export { AggregateExpr, AndExpr, BinaryExpr, ColumnRef, DefaultValueExpr, DeleteAst, DerivedTableSource, DoNothingConflictAction, DoUpdateSetConflictAction, EqColJoinOn, ExistsExpr, IdentifierRef, InsertAst, InsertOnConflict, JoinAst, JsonArrayAggExpr, JsonObjectExpr, ListExpression, LiteralExpr, NotExpr, NullCheckExpr, OperationExpr, OrExpr, OrderByItem, ParamRef, 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, SubqueryExpr, TableSource, UpdateAst, codec, compact, createCodecRegistry, defineCodecs, isQueryAst, isWhereExpr, queryAstKinds, sqlCodecDefinitions, sqlDataTypes, whereExprKinds };
|
|
320
|
+
export { AggregateExpr, AndExpr, BinaryExpr, ColumnRef, DefaultValueExpr, DeleteAst, DerivedTableSource, DoNothingConflictAction, DoUpdateSetConflictAction, EqColJoinOn, ExistsExpr, IdentifierRef, InsertAst, InsertOnConflict, JoinAst, JsonArrayAggExpr, JsonObjectExpr, ListExpression, LiteralExpr, NotExpr, NullCheckExpr, OperationExpr, OrExpr, OrderByItem, ParamRef, 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, SubqueryExpr, TableSource, UpdateAst, codec, collectOrderedParamRefs, compact, createCodecRegistry, defineCodecs, isQueryAst, isWhereExpr, queryAstKinds, sqlCodecDefinitions, sqlDataTypes, whereExprKinds };
|
|
301
321
|
//# sourceMappingURL=ast.mjs.map
|
package/dist/exports/ast.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ast.mjs","names":["codec","codecs","codecTypes: Record<\n string,\n { readonly input: unknown; readonly output: unknown; readonly traits: unknown }\n >","result: Record<\n string,\n {\n typeId: string;\n scalar: string;\n codec: Codec;\n input: unknown;\n output: unknown;\n jsType: unknown;\n }\n >","arktype","out: Record<string, unknown>"],"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","export 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"],"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,OAAK,MAAM,cAAcA,QAAM,aAAa;GAC1C,MAAM,WAAW,KAAK,UAAU,IAAI,WAAW;AAC/C,OAAI,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MAAM;CAC9B,QAAQ;CACR,aAAa,CAAC,YAAY;CAC1B,QAAQ,CAAC,YAAY,QAAQ;CAC7B,SAAS,UAAkC,iBAAiB,OAAO,MAAM,aAAa,GAAG;CACzF,SAAS,SAAiC,gBAAgB,OAAO,KAAK,aAAa,GAAG;CACtF,cAAc;CACd,mBAAmB,eAAe;EAChC,MAAM,YAAY,WAAW;AAC7B,MAAI,cAAc,OAChB,QAAO;AAET,MACE,OAAO,cAAc,YACrB,CAAC,OAAO,SAAS,UAAU,IAC3B,CAAC,OAAO,UAAU,UAAU,CAE5B,OAAM,IAAI,MACR,mFAAmF,OAAO,UAAU,GACrG;AAEH,SAAO,aAAa,UAAU;;CAEjC,CAAC;AAEF,MAAM,SAAS,cAAc,CAC1B,IAAI,QAAQ,aAAa,CACzB,IAAI,WAAW,gBAAgB,CAC/B,IAAI,OAAO,YAAY,CACvB,IAAI,SAAS,cAAc,CAC3B,IAAI,QAAQ,aAAa,CACzB,IAAI,aAAa,kBAAkB;AAEtC,MAAa,sBAAsB,OAAO;AAC1C,MAAa,eAAe,OAAO;;;;AC5InC,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"}
|
|
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,OAAK,MAAM,cAAcA,QAAM,aAAa;GAC1C,MAAM,WAAW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 +1,5 @@
|
|
|
1
1
|
import "../codec-types-Dd0wpQJf.mjs";
|
|
2
2
|
import "../query-lane-context-2K0OsuLw.mjs";
|
|
3
|
-
import "../types-
|
|
4
|
-
import { n as planUnsupported, t as planInvalid } from "../errors-
|
|
3
|
+
import "../types-3qZo79jt.mjs";
|
|
4
|
+
import { n as planUnsupported, t as planInvalid } from "../errors-0WBzgMtY.mjs";
|
|
5
5
|
export { planInvalid, planUnsupported };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { o as AnyExpression } from "../types-
|
|
1
|
+
import { o as AnyExpression } from "../types-B4dL4lc3.mjs";
|
|
2
2
|
import { ParamSpec } from "@prisma-next/operations";
|
|
3
3
|
import { SqlLoweringSpec } from "@prisma-next/sql-operations";
|
|
4
4
|
import { QueryOperationReturn } from "@prisma-next/sql-contract/types";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"expression.d.mts","names":[],"sources":["../../src/expression.ts"],"sourcesContent":[],"mappings":";;;;;;KAMY,UAAA;;EAAA,QAAA,EAAA,OAAU;AAQtB,CAAA;;;;;;AAGE;AAGW,KAND,UAMC,CAAA,YANoB,UAMpB,CAAA,GANkC,oBAMlC,GAAA;EAGC,SAAA,UAAA,EARS,GAQT;EAAc,QAAA,EAAA,EAPd,aAOc;CAAG;KAJ1B,iBAKE,CAAA,WAJM,MAIN,CAAA,MAAA,EAAA;EAAiC,SAAA,KAAA,EAAA,OAAA;CAChC,CAAA,EAAA,uBAAA,SAAA,MAAA,EAAA,CAAA,GAAA,QAGA,MALM,EAKN,GAAA,MAAA,GALoB,EAKpB,CALuB,CAKvB,CAAA,SAAA;EAAE,SAAA,MAAA,EAAA,KAAA,EAAA;AAEL,CAAA,GAAA,CANE,cAMQ,CAAA,
|
|
1
|
+
{"version":3,"file":"expression.d.mts","names":[],"sources":["../../src/expression.ts"],"sourcesContent":[],"mappings":";;;;;;KAMY,UAAA;;EAAA,QAAA,EAAA,OAAU;AAQtB,CAAA;;;;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AiCG,CAAA,EAjCM,QAiCN,EAjCgB,EAiChB,CAAA;;;;;AAU7C;;;;AAA8F,iBAjC9E,MAAA,CAiC8E,KAAA,EAAA,OAAA,EAAA,OAAA,CAAA,EAAA,MAAA,CAAA,EAjCpC,aAiCoC;AAAX,UAjBlE,kBAiBkE,CAAA,UAjBrC,UAiBqC,CAAA,CAAA;EAAU,SAAA,MAAA,EAAA,MAAA;;;;;;2BAVlE,kBAAkB;oBACzB,IAAI;qBACH;;;;;;;iBAQL,yBAAyB,kBAAkB,mBAAmB,KAAK,WAAW"}
|
package/dist/exports/plan.d.mts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { t as SqlExecutionPlan } from "../sql-execution-plan-
|
|
2
|
-
import {
|
|
3
|
-
export { type SqlExecutionPlan, SqlQueryPlan
|
|
1
|
+
import { t as SqlExecutionPlan } from "../sql-execution-plan-Dgx7BGin.mjs";
|
|
2
|
+
import { t as SqlQueryPlan } from "../plan-C7SiEWkN.mjs";
|
|
3
|
+
export { type SqlExecutionPlan, SqlQueryPlan };
|
package/dist/exports/plan.mjs
CHANGED
|
@@ -1,17 +1 @@
|
|
|
1
|
-
|
|
2
|
-
/**
|
|
3
|
-
* Augments the last ParamDescriptor in the array with codecId and nativeType from columnMeta.
|
|
4
|
-
* This is used when building WHERE expressions to ensure param descriptors have type information.
|
|
5
|
-
*/
|
|
6
|
-
function augmentDescriptorWithColumnMeta(descriptors, columnMeta) {
|
|
7
|
-
const descriptor = descriptors[descriptors.length - 1];
|
|
8
|
-
if (descriptor && columnMeta) descriptors[descriptors.length - 1] = {
|
|
9
|
-
...descriptor,
|
|
10
|
-
codecId: columnMeta.codecId,
|
|
11
|
-
nativeType: columnMeta.nativeType
|
|
12
|
-
};
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
//#endregion
|
|
16
|
-
export { augmentDescriptorWithColumnMeta };
|
|
17
|
-
//# sourceMappingURL=plan.mjs.map
|
|
1
|
+
export { };
|
package/dist/exports/types.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import "../codec-types-Dd0wpQJf.mjs";
|
|
2
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-
|
|
4
|
-
import { n as SqlOrmPlan, t as RuntimeScope } from "../types-
|
|
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";
|
|
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
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";
|
|
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-
|
|
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, compact, sqlCodecDefinitions, sqlDataTypes } from "./exports/ast.mjs";
|
|
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
|
+
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
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";
|
|
5
|
-
import { t as SqlExecutionPlan } from "./sql-execution-plan-
|
|
6
|
-
import { C as TableKey, S as TableDef, T as TablesOf, _ as RawTemplateFactory, a as ComputeColumnJsType, b as SqlBuilderOptions, c as META, d as ModelMetadata, f as OperationTypeSignature, g as RawFunctionOptions, h as RawFactory, i as ColumnsOf, l as Meta, m as OperationsForTypeId, n as BuildParamsMap, o as Expr, p as OperationTypes, r as CodecTypes, s as HasIncludeManyCapabilities, t as BuildOptions, u as ModelDef, v as RawTemplateOptions, w as TableMetadata, x as SqlPlan, y as RuntimeError } from "./types-
|
|
7
|
-
import { n as planUnsupported, t as planInvalid } from "./errors-
|
|
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";
|
|
8
8
|
import { BuildOperationSpec, CodecExpression, Expression, ScopeField, TraitExpression, buildOperation, toExpr } from "./exports/expression.mjs";
|
|
9
|
-
import {
|
|
9
|
+
import { t as SqlQueryPlan } from "./plan-C7SiEWkN.mjs";
|
|
10
10
|
import "./exports/plan.mjs";
|
|
11
11
|
import "./exports/query-lane-context.mjs";
|
|
12
|
-
import { n as SqlOrmPlan, t as RuntimeScope } from "./types-
|
|
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,
|
|
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 };
|
package/dist/index.mjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { A as UpdateAst, C as OrExpr, D as SelectAst, E as ProjectionItem, M as isWhereExpr, N as queryAstKinds, O as SubqueryExpr, P as whereExprKinds, S as OperationExpr, T as ParamRef, _ as JsonObjectExpr, a as DefaultValueExpr, b as NotExpr, c as DoNothingConflictAction, d as ExistsExpr, f as IdentifierRef, g as JsonArrayAggExpr, h as JoinAst, i as ColumnRef, j as isQueryAst, k as TableSource, l as DoUpdateSetConflictAction, m as InsertOnConflict, n as AndExpr, o as DeleteAst, p as InsertAst, r as BinaryExpr, s as DerivedTableSource, t as AggregateExpr, u as EqColJoinOn, v as ListExpression, w as OrderByItem, x as NullCheckExpr, y as LiteralExpr } from "./types
|
|
2
|
-
import { SQL_CHAR_CODEC_ID, SQL_FLOAT_CODEC_ID, SQL_INT_CODEC_ID, SQL_TEXT_CODEC_ID, SQL_TIMESTAMP_CODEC_ID, SQL_VARCHAR_CODEC_ID, codec, compact, createCodecRegistry, defineCodecs, sqlCodecDefinitions, sqlDataTypes } from "./exports/ast.mjs";
|
|
1
|
+
import { A as UpdateAst, C as OrExpr, D as SelectAst, E as ProjectionItem, M as isWhereExpr, N as queryAstKinds, O as SubqueryExpr, P as whereExprKinds, S as OperationExpr, T as ParamRef, _ as JsonObjectExpr, a as DefaultValueExpr, b as NotExpr, c as DoNothingConflictAction, d as ExistsExpr, f as IdentifierRef, g as JsonArrayAggExpr, h as JoinAst, i as ColumnRef, j as isQueryAst, k as TableSource, l as DoUpdateSetConflictAction, m as InsertOnConflict, n as AndExpr, o as DeleteAst, p as InsertAst, r as BinaryExpr, s as DerivedTableSource, t as AggregateExpr, u as EqColJoinOn, v as ListExpression, w as OrderByItem, x as NullCheckExpr, y as LiteralExpr } from "./types-DUL-3vy6.mjs";
|
|
2
|
+
import { SQL_CHAR_CODEC_ID, SQL_FLOAT_CODEC_ID, SQL_INT_CODEC_ID, SQL_TEXT_CODEC_ID, SQL_TIMESTAMP_CODEC_ID, SQL_VARCHAR_CODEC_ID, codec, collectOrderedParamRefs, compact, createCodecRegistry, defineCodecs, sqlCodecDefinitions, sqlDataTypes } from "./exports/ast.mjs";
|
|
3
3
|
import { n as planUnsupported, t as planInvalid } from "./errors-D6kqqjHM.mjs";
|
|
4
4
|
import { buildOperation, toExpr } from "./exports/expression.mjs";
|
|
5
|
-
import
|
|
5
|
+
import "./exports/plan.mjs";
|
|
6
6
|
import "./exports/query-lane-context.mjs";
|
|
7
7
|
import "./exports/types.mjs";
|
|
8
8
|
|
|
9
|
-
export { AggregateExpr, AndExpr, BinaryExpr, ColumnRef, DefaultValueExpr, DeleteAst, DerivedTableSource, DoNothingConflictAction, DoUpdateSetConflictAction, EqColJoinOn, ExistsExpr, IdentifierRef, InsertAst, InsertOnConflict, JoinAst, JsonArrayAggExpr, JsonObjectExpr, ListExpression, LiteralExpr, NotExpr, NullCheckExpr, OperationExpr, OrExpr, OrderByItem, ParamRef, 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, SubqueryExpr, TableSource, UpdateAst,
|
|
9
|
+
export { AggregateExpr, AndExpr, BinaryExpr, ColumnRef, DefaultValueExpr, DeleteAst, DerivedTableSource, DoNothingConflictAction, DoUpdateSetConflictAction, EqColJoinOn, ExistsExpr, IdentifierRef, InsertAst, InsertOnConflict, JoinAst, JsonArrayAggExpr, JsonObjectExpr, ListExpression, LiteralExpr, NotExpr, NullCheckExpr, OperationExpr, OrExpr, OrderByItem, ParamRef, 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, SubqueryExpr, TableSource, UpdateAst, buildOperation, codec, collectOrderedParamRefs, compact, createCodecRegistry, defineCodecs, isQueryAst, isWhereExpr, planInvalid, planUnsupported, queryAstKinds, sqlCodecDefinitions, sqlDataTypes, toExpr, whereExprKinds };
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import { d as AnyQueryAst } from "./types-
|
|
2
|
-
import { ParamDescriptor } from "@prisma-next/contract/types";
|
|
3
|
-
import { StorageColumn } from "@prisma-next/sql-contract/types";
|
|
1
|
+
import { d as AnyQueryAst } from "./types-B4dL4lc3.mjs";
|
|
4
2
|
import { QueryPlan } from "@prisma-next/framework-components/runtime";
|
|
5
3
|
|
|
6
4
|
//#region src/plan.d.ts
|
|
@@ -22,11 +20,6 @@ interface SqlQueryPlan<Row = unknown> extends QueryPlan<Row> {
|
|
|
22
20
|
readonly ast: AnyQueryAst;
|
|
23
21
|
readonly params: readonly unknown[];
|
|
24
22
|
}
|
|
25
|
-
/**
|
|
26
|
-
* Augments the last ParamDescriptor in the array with codecId and nativeType from columnMeta.
|
|
27
|
-
* This is used when building WHERE expressions to ensure param descriptors have type information.
|
|
28
|
-
*/
|
|
29
|
-
declare function augmentDescriptorWithColumnMeta(descriptors: ParamDescriptor[], columnMeta: StorageColumn | undefined): void;
|
|
30
23
|
//#endregion
|
|
31
|
-
export {
|
|
32
|
-
//# sourceMappingURL=plan-
|
|
24
|
+
export { SqlQueryPlan as t };
|
|
25
|
+
//# sourceMappingURL=plan-C7SiEWkN.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plan-C7SiEWkN.d.mts","names":[],"sources":["../src/plan.ts"],"sourcesContent":[],"mappings":";;;;;;;AAgBA;;;;;;;;;;;UAAiB,oCAAoC,UAAU;gBAC/C"}
|
|
@@ -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,
|
|
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,4 +1,4 @@
|
|
|
1
|
-
import { d as AnyQueryAst } from "./types-
|
|
1
|
+
import { d as AnyQueryAst } from "./types-B4dL4lc3.mjs";
|
|
2
2
|
import { ExecutionPlan } from "@prisma-next/framework-components/runtime";
|
|
3
3
|
|
|
4
4
|
//#region src/sql-execution-plan.d.ts
|
|
@@ -30,4 +30,4 @@ interface SqlExecutionPlan<Row = unknown> extends ExecutionPlan<Row> {
|
|
|
30
30
|
}
|
|
31
31
|
//#endregion
|
|
32
32
|
export { SqlExecutionPlan as t };
|
|
33
|
-
//# sourceMappingURL=sql-execution-plan-
|
|
33
|
+
//# sourceMappingURL=sql-execution-plan-Dgx7BGin.d.mts.map
|
package/dist/{sql-execution-plan-CRa8P62o.d.mts.map → sql-execution-plan-Dgx7BGin.d.mts.map}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sql-execution-plan-
|
|
1
|
+
{"version":3,"file":"sql-execution-plan-Dgx7BGin.d.mts","names":[],"sources":["../src/sql-execution-plan.ts"],"sourcesContent":[],"mappings":";;;;;;;AAuBA;;;;;;;;;;;;;;;;;;UAAiB,wCAAwC,cAAc;;;iBAGtD"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { G as ParamRef, h as ColumnRef } from "./types-
|
|
1
|
+
import { G as ParamRef, h as ColumnRef } from "./types-B4dL4lc3.mjs";
|
|
2
2
|
import { n as ExecutionContext } from "./query-lane-context-2K0OsuLw.mjs";
|
|
3
|
-
import { t as SqlExecutionPlan } from "./sql-execution-plan-
|
|
4
|
-
import { Contract
|
|
3
|
+
import { t as SqlExecutionPlan } from "./sql-execution-plan-Dgx7BGin.mjs";
|
|
4
|
+
import { Contract } from "@prisma-next/contract/types";
|
|
5
5
|
import { ParamSpec } from "@prisma-next/operations";
|
|
6
6
|
import { SqlLoweringSpec } from "@prisma-next/sql-operations";
|
|
7
7
|
import { ExtractFieldOutputTypes, SqlStorage, StorageColumn } from "@prisma-next/sql-contract/types";
|
|
@@ -161,9 +161,7 @@ type ColumnsOf<TContract, K extends TableKey<TContract>> = K extends keyof Table
|
|
|
161
161
|
columns: infer C;
|
|
162
162
|
} ? C : never : never;
|
|
163
163
|
interface RawTemplateOptions {
|
|
164
|
-
readonly refs?: PlanRefs;
|
|
165
164
|
readonly annotations?: Record<string, unknown>;
|
|
166
|
-
readonly projection?: ReadonlyArray<string>;
|
|
167
165
|
}
|
|
168
166
|
interface RawFunctionOptions extends RawTemplateOptions {
|
|
169
167
|
readonly params: ReadonlyArray<unknown>;
|
|
@@ -192,4 +190,4 @@ interface SqlBuilderOptions<TContract extends Contract<SqlStorage> = Contract<Sq
|
|
|
192
190
|
}
|
|
193
191
|
//#endregion
|
|
194
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 };
|
|
195
|
-
//# sourceMappingURL=types-
|
|
193
|
+
//# sourceMappingURL=types-3qZo79jt.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types-
|
|
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,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