@prisma-next/sql-relational-core 0.16.0-dev.3 → 0.16.0-dev.31
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{codec-types-C8vFGWij.d.mts → codec-types-Bayoa4PI.d.mts} +3 -2
- package/dist/codec-types-Bayoa4PI.d.mts.map +1 -0
- package/dist/{ddl-types-DzaZCtFT.d.mts → ddl-types-B3SfjPGI.d.mts} +3 -3
- package/dist/ddl-types-B3SfjPGI.d.mts.map +1 -0
- package/dist/{ddl-types-DFKQr_qQ.mjs → ddl-types-BUoa33yk.mjs} +3 -2
- package/dist/ddl-types-BUoa33yk.mjs.map +1 -0
- package/dist/exports/ast.d.mts +4 -4
- package/dist/exports/ast.d.mts.map +1 -1
- package/dist/exports/ast.mjs +82 -8
- package/dist/exports/ast.mjs.map +1 -1
- package/dist/exports/codec-descriptor-registry.d.mts +2 -2
- package/dist/exports/codec-descriptor-registry.d.mts.map +1 -1
- package/dist/exports/codec-descriptor-registry.mjs +2 -1
- package/dist/exports/codec-descriptor-registry.mjs.map +1 -1
- package/dist/exports/contract-free.d.mts +3 -3
- package/dist/exports/contract-free.d.mts.map +1 -1
- package/dist/exports/contract-free.mjs +4 -3
- package/dist/exports/contract-free.mjs.map +1 -1
- package/dist/exports/expression.d.mts +2 -2
- package/dist/exports/expression.mjs +1 -1
- package/dist/exports/middleware.d.mts +1 -1
- package/dist/exports/plan.d.mts +2 -2
- package/dist/exports/query-lane-context.d.mts +1 -1
- package/dist/exports/types.d.mts +1 -1
- package/dist/index.d.mts +9 -9
- package/dist/index.mjs +4 -4
- package/dist/{middleware-CFDg6XOc.d.mts → middleware-_9-4TYKC.d.mts} +2 -2
- package/dist/{middleware-CFDg6XOc.d.mts.map → middleware-_9-4TYKC.d.mts.map} +1 -1
- package/dist/{plan-CBT55zev.d.mts → plan-Dq94efZJ.d.mts} +2 -2
- package/dist/{plan-CBT55zev.d.mts.map → plan-Dq94efZJ.d.mts.map} +1 -1
- package/dist/{query-lane-context-BNbbusGn.d.mts → query-lane-context-DTCOHMXn.d.mts} +2 -2
- package/dist/{query-lane-context-BNbbusGn.d.mts.map → query-lane-context-DTCOHMXn.d.mts.map} +1 -1
- package/dist/{sql-execution-plan-CPw3uKrJ.d.mts → sql-execution-plan-B-C-6cZN.d.mts} +2 -2
- package/dist/{sql-execution-plan-CPw3uKrJ.d.mts.map → sql-execution-plan-B-C-6cZN.d.mts.map} +1 -1
- package/dist/{types-DtzFztRV.mjs → types-CINOak-F.mjs} +164 -27
- package/dist/types-CINOak-F.mjs.map +1 -0
- package/dist/{types-BR266jxM.d.mts → types-CRV7uuOC.d.mts} +5 -5
- package/dist/{types-BR266jxM.d.mts.map → types-CRV7uuOC.d.mts.map} +1 -1
- package/dist/{types-Dr3jep6j.d.mts → types-CWlaErjN.d.mts} +97 -13
- package/dist/types-CWlaErjN.d.mts.map +1 -0
- package/package.json +11 -11
- package/src/ast/codec-types.ts +37 -0
- package/src/ast/ddl-types.ts +2 -1
- package/src/ast/json-value-projection.ts +100 -0
- package/src/ast/sql-codec-helpers.ts +20 -5
- package/src/ast/types.ts +235 -52
- package/src/codec-descriptor-registry.ts +4 -1
- package/src/contract-free/table.ts +5 -1
- package/src/exports/ast.ts +1 -0
- package/dist/codec-types-C8vFGWij.d.mts.map +0 -1
- package/dist/ddl-types-DFKQr_qQ.mjs.map +0 -1
- package/dist/ddl-types-DzaZCtFT.d.mts.map +0 -1
- package/dist/types-Dr3jep6j.d.mts.map +0 -1
- package/dist/types-DtzFztRV.mjs.map +0 -1
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Codec, CodecCallContext, CodecCallContext as CodecCallContext$1, CodecDescriptor, CodecDescriptor as CodecDescriptor$1, CodecInstanceContext, CodecRef, CodecRef as CodecRef$1, CodecTrait, CodecTrait as CodecTrait$1 } from "@prisma-next/framework-components/codec";
|
|
2
2
|
//#region src/ast/codec-types.d.ts
|
|
3
|
+
declare function frozenCodecRef(codec: CodecRef): CodecRef;
|
|
3
4
|
/**
|
|
4
5
|
* SQL-family addressing of a single column. The decode site populates a `SqlColumnRef` whenever it can resolve the cell to a single underlying `(table, column)` (the typical case for projected columns from a single-table source); cells the runtime cannot resolve (aggregate aliases, include aggregate fields, computed projections without a simple ref) get `column = undefined`.
|
|
5
6
|
*
|
|
@@ -104,5 +105,5 @@ type ExtractCodecTypes<ScalarNames extends { readonly [K in keyof ScalarNames]:
|
|
|
104
105
|
readonly traits: DescriptorCodecTraits<ScalarNames[K]>;
|
|
105
106
|
}; };
|
|
106
107
|
//#endregion
|
|
107
|
-
export { CodecMeta as a, ContractCodecRegistry as c, DescriptorCodecTraits as d, ExtractCodecTypes as f, SqlColumnRef as h, CodecDescriptor$1 as i, DescriptorCodecId as l, SqlCodecInstanceContext as m, Codec$1 as n, CodecRef$1 as o, SqlCodecCallContext as p, CodecCallContext$1 as r, CodecTrait$1 as s, AnyCodecDescriptor as t, DescriptorCodecInput as u };
|
|
108
|
-
//# sourceMappingURL=codec-types-
|
|
108
|
+
export { CodecMeta as a, ContractCodecRegistry as c, DescriptorCodecTraits as d, ExtractCodecTypes as f, frozenCodecRef as g, SqlColumnRef as h, CodecDescriptor$1 as i, DescriptorCodecId as l, SqlCodecInstanceContext as m, Codec$1 as n, CodecRef$1 as o, SqlCodecCallContext as p, CodecCallContext$1 as r, CodecTrait$1 as s, AnyCodecDescriptor as t, DescriptorCodecInput as u };
|
|
109
|
+
//# sourceMappingURL=codec-types-Bayoa4PI.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"codec-types-Bayoa4PI.d.mts","names":[],"sources":["../src/ast/codec-types.ts"],"mappings":";;iBAwCgB,eAAe,OAAO,WAAW;;;;;;UAkBhC;WACN;WACA;;;;;;;UAQM,4BAA4B;WAClC,SAAS;;;;;;;;;;;UAYH,gCAAgC;WACtC,QAAQ;aAAyB;aAAwB;;;;;;UAMnD;WACN;aACE;eACE;iBACE;;;;;;;;;;;;UAaA,QACf,4BACA,yBAAyB,wBAAwB,cACjD,iBACA,0BACQ,MAAU,IAAI,SAAS,OAAO;EACtC,OAAO,OAAO,QAAQ,KAAK,sBAAsB,QAAQ;EACzD,OAAO,MAAM,OAAO,KAAK,sBAAsB,QAAQ;;;;;;;;;UAUxC;;;;;;EAMf,UAAU,qBAAqB,eAAe,iBAAiB;;;;;;EAO/D,YAAY,KAAK,WAAW;;;;;;KAQlB,qBAAqB;KAE5B,wBAAwB,KAC3B,UAAU,sBAAsB,MAAM,WAAW,WAAW;KAElD,kBAAkB,KAAK,UAAU,qBAAqB;KAEtD,qBAAqB,KAC/B,wBAAwB,WAAW,uBAA2B,6BAA6B,MACvF;;;;;;;KASM,sBAAsB,KAAK;WAC5B,cAAc,yBAAyB;IAE9C,kBAAkB;;;;;;KAQV,kBACV,gCACY,WAAW,cAAc,wBACjC,oCAEM,WAAW,eAAe,kBAAkB,YAAY;WACvD,OAAO,qBAAqB,YAAY;WACxC,QAAQ,qBAAqB,YAAY;WACzC,QAAQ,sBAAsB,YAAY"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { o as CodecRef } from "./codec-types-
|
|
2
|
-
import { d as AnyParamRef } from "./types-
|
|
1
|
+
import { o as CodecRef } from "./codec-types-Bayoa4PI.mjs";
|
|
2
|
+
import { d as AnyParamRef } from "./types-CWlaErjN.mjs";
|
|
3
3
|
import { ColumnDefaultLiteralInputValue } from "@prisma-next/contract/types";
|
|
4
4
|
import { ReferentialAction } from "@prisma-next/sql-contract/types";
|
|
5
5
|
//#region src/ast/ddl-types.d.ts
|
|
@@ -144,4 +144,4 @@ declare class CheckExpressionConstraint {
|
|
|
144
144
|
type DdlTableConstraint = PrimaryKeyConstraint | ForeignKeyConstraint | UniqueConstraint | CheckExpressionConstraint;
|
|
145
145
|
//#endregion
|
|
146
146
|
export { DdlColumnDefaultVisitor as a, DdlTableConstraint as c, LiteralColumnDefault as d, PrimaryKeyConstraint as f, DdlColumnDefault as i, ForeignKeyConstraint as l, isDdlNode as m, CheckExpressionConstraint as n, DdlColumnRenderContext as o, UniqueConstraint as p, DdlColumn as r, DdlNode as s, AnyDdlColumnDefault as t, FunctionColumnDefault as u };
|
|
147
|
-
//# sourceMappingURL=ddl-types-
|
|
147
|
+
//# sourceMappingURL=ddl-types-B3SfjPGI.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ddl-types-B3SfjPGI.d.mts","names":[],"sources":["../src/ast/ddl-types.ts"],"mappings":";;;;;;;;;;;;;;UAgBiB;WACN;;UAGM,wBAAwB;EACvC,QAAQ,MAAM,sBAAsB,KAAK,yBAAyB;EAClE,SAAS,MAAM,uBAAuB,KAAK,yBAAyB;;uBAGhD;oBACF;WACT,OAAO,GAAG,SAAS,wBAAwB,IAAI,KAAK,yBAAyB;YAE5E;;cAKC,6BAA6B;WAC/B;WACA,OAAO;cAEJ,OAAO;EASV,OAAO,GAAG,SAAS,wBAAwB,IAAI,KAAK,yBAAyB;;cAK3E,8BAA8B;WAChC;WACA;cAEG;EAMH,OAAO,GAAG,SAAS,wBAAwB,IAAI,KAAK,yBAAyB;;KAK5E,sBAAsB,uBAAuB;cAE5C;WACF;WACA;WACA;WACA;WACA,UAAU;;WAEV,WAAW;cAER;aACD;aACA;aACA;aACA;aACA,UAAU;aACV,WAAW;;;uBAYF;oBACF;;;;;;;EAQlB;YAIU;EAIV,oBAAoB;;iBAKN,UAAU,iBAAiB,SAAS;;;;;;;;cAoBvC;WACF;WACA,SAAS;WACT;cAEG;aAAoB;aAAqC;;;;;;;;;;cAc1D;WACF;WACA,SAAS;WACT;WACA,YAAY;WACZ,UAAU;WACV,UAAU;WACV;cAEG;aACD;aACA;aACA;aACA,WAAW;aACX,WAAW;aACX;;;;;;;;;;cAmBA;WACF;WACA,SAAS;WACT;cAEG;aAAoB;aAAqC;;;;;;;;;;;;cAgB1D;WACF;WACA;WACA;cAEG;aAAoB;aAAuB;;;KAO7C,qBACR,uBACA,uBACA,mBACA"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { isColumnDefaultLiteralInputValue } from "@prisma-next/contract/types";
|
|
2
|
+
import { structuredError } from "@prisma-next/utils/structured-error";
|
|
2
3
|
//#region src/ast/ddl-types.ts
|
|
3
4
|
var DdlColumnDefault = class {
|
|
4
5
|
freeze() {
|
|
@@ -10,7 +11,7 @@ var LiteralColumnDefault = class extends DdlColumnDefault {
|
|
|
10
11
|
value;
|
|
11
12
|
constructor(value) {
|
|
12
13
|
super();
|
|
13
|
-
if (!isColumnDefaultLiteralInputValue(value)) throw
|
|
14
|
+
if (!isColumnDefaultLiteralInputValue(value)) throw structuredError("CONTRACT.DEFAULT_INVALID", "Invalid column default literal value");
|
|
14
15
|
this.value = value;
|
|
15
16
|
this.freeze();
|
|
16
17
|
}
|
|
@@ -149,4 +150,4 @@ var CheckExpressionConstraint = class {
|
|
|
149
150
|
//#endregion
|
|
150
151
|
export { ForeignKeyConstraint as a, PrimaryKeyConstraint as c, DdlNode as i, UniqueConstraint as l, DdlColumn as n, FunctionColumnDefault as o, DdlColumnDefault as r, LiteralColumnDefault as s, CheckExpressionConstraint as t, isDdlNode as u };
|
|
151
152
|
|
|
152
|
-
//# sourceMappingURL=ddl-types-
|
|
153
|
+
//# sourceMappingURL=ddl-types-BUoa33yk.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ddl-types-BUoa33yk.mjs","names":[],"sources":["../src/ast/ddl-types.ts"],"sourcesContent":["import type { ColumnDefaultLiteralInputValue } from '@prisma-next/contract/types';\nimport { isColumnDefaultLiteralInputValue } from '@prisma-next/contract/types';\nimport type { ReferentialAction } from '@prisma-next/sql-contract/types';\nimport { structuredError } from '@prisma-next/utils/structured-error';\nimport type { CodecRef } from './codec-types';\nimport type { AnyParamRef } from './types';\n\n/**\n * Render-time context the column-default visitor needs to make dialect\n * decisions that depend on the parent column. Today only the parent\n * column's native type (`\"jsonb\"`, `\"text\"`, …) — the Postgres renderer\n * uses it to decide whether to emit a `::jsonb` / `::json` cast on JSON\n * literal defaults so the emitted DDL matches the column type without\n * relying on Postgres's implicit text → jsonb cast at default-evaluation\n * time. Additional fields can join without re-shaping the interface.\n */\nexport interface DdlColumnRenderContext {\n readonly nativeType: string;\n}\n\nexport interface DdlColumnDefaultVisitor<R> {\n literal(node: LiteralColumnDefault, ctx: DdlColumnRenderContext): R;\n function(node: FunctionColumnDefault, ctx: DdlColumnRenderContext): R;\n}\n\nexport abstract class DdlColumnDefault {\n abstract readonly kind: string;\n abstract accept<R>(visitor: DdlColumnDefaultVisitor<R>, ctx: DdlColumnRenderContext): R;\n\n protected freeze(): void {\n Object.freeze(this);\n }\n}\n\nexport class LiteralColumnDefault extends DdlColumnDefault {\n readonly kind = 'literal' as const;\n readonly value: ColumnDefaultLiteralInputValue;\n\n constructor(value: ColumnDefaultLiteralInputValue) {\n super();\n if (!isColumnDefaultLiteralInputValue(value)) {\n throw structuredError('CONTRACT.DEFAULT_INVALID', 'Invalid column default literal value');\n }\n this.value = value;\n this.freeze();\n }\n\n override accept<R>(visitor: DdlColumnDefaultVisitor<R>, ctx: DdlColumnRenderContext): R {\n return visitor.literal(this, ctx);\n }\n}\n\nexport class FunctionColumnDefault extends DdlColumnDefault {\n readonly kind = 'function' as const;\n readonly expression: string;\n\n constructor(expression: string) {\n super();\n this.expression = expression;\n this.freeze();\n }\n\n override accept<R>(visitor: DdlColumnDefaultVisitor<R>, ctx: DdlColumnRenderContext): R {\n return visitor.function(this, ctx);\n }\n}\n\nexport type AnyDdlColumnDefault = LiteralColumnDefault | FunctionColumnDefault;\n\nexport class DdlColumn {\n readonly name: string;\n readonly type: string;\n readonly notNull?: boolean | undefined;\n readonly primaryKey?: boolean | undefined;\n readonly default?: AnyDdlColumnDefault | undefined;\n /** Codec identity for this column. When present, the DDL walker resolves the codec via `codecLookup.get(codecRef.codecId)` and calls `codec.encode(default.value, {})` to obtain the wire value before inlining the literal default into the DDL string. When absent, literal defaults follow RawSqlLiteral wire-scalar semantics (string / number / boolean / bigint / null / Uint8Array / Date inlined directly). */\n readonly codecRef?: CodecRef | undefined;\n\n constructor(options: {\n readonly name: string;\n readonly type: string;\n readonly notNull?: boolean;\n readonly primaryKey?: boolean;\n readonly default?: AnyDdlColumnDefault;\n readonly codecRef?: CodecRef;\n }) {\n this.name = options.name;\n this.type = options.type;\n this.notNull = options.notNull;\n this.primaryKey = options.primaryKey;\n this.default = options.default;\n this.codecRef = options.codecRef;\n Object.freeze(this);\n }\n}\n\nexport abstract class DdlNode {\n abstract readonly kind: string;\n\n /**\n * Structural brand: every DDL node answers `true`. Lets {@link isDdlNode}\n * recognise any `DdlNode` subclass — including target-contributed kinds —\n * without a central kind registry that subclasses would have to register\n * into.\n */\n isDdlNode(): true {\n return true;\n }\n\n protected freeze(): void {\n Object.freeze(this);\n }\n\n collectParamRefs(): AnyParamRef[] {\n return [];\n }\n}\n\nexport function isDdlNode(value: unknown): value is DdlNode {\n return (\n typeof value === 'object' &&\n value !== null &&\n 'isDdlNode' in value &&\n typeof value.isDdlNode === 'function'\n );\n}\n\n// ---------------------------------------------------------------------------\n// Table-level constraint nodes\n// ---------------------------------------------------------------------------\n\n/**\n * A composite (or single-column) PRIMARY KEY constraint on a `CreateTable`\n * node. When `name` is set, the adapter renders `CONSTRAINT <name> PRIMARY KEY\n * (…)`; otherwise it renders an anonymous `PRIMARY KEY (…)`.\n *\n * Frozen on construction — immutable after creation.\n */\nexport class PrimaryKeyConstraint {\n readonly kind = 'primary-key' as const;\n readonly columns: ReadonlyArray<string>;\n readonly name: string | undefined;\n\n constructor(options: { readonly columns: readonly string[]; readonly name?: string }) {\n this.columns = Object.freeze([...options.columns]);\n this.name = options.name;\n Object.freeze(this);\n }\n}\n\n/**\n * A FOREIGN KEY constraint on a `CreateTable` node. `onDelete` and `onUpdate`\n * use the same `ReferentialAction` vocabulary already used by the migration\n * planner and the contract IR — no parallel string enum.\n *\n * Frozen on construction — immutable after creation.\n */\nexport class ForeignKeyConstraint {\n readonly kind = 'foreign-key' as const;\n readonly columns: ReadonlyArray<string>;\n readonly refTable: string;\n readonly refColumns: ReadonlyArray<string>;\n readonly onDelete: ReferentialAction | undefined;\n readonly onUpdate: ReferentialAction | undefined;\n readonly name: string | undefined;\n\n constructor(options: {\n readonly columns: readonly string[];\n readonly refTable: string;\n readonly refColumns: readonly string[];\n readonly onDelete?: ReferentialAction;\n readonly onUpdate?: ReferentialAction;\n readonly name?: string;\n }) {\n this.columns = Object.freeze([...options.columns]);\n this.refTable = options.refTable;\n this.refColumns = Object.freeze([...options.refColumns]);\n this.onDelete = options.onDelete;\n this.onUpdate = options.onUpdate;\n this.name = options.name;\n Object.freeze(this);\n }\n}\n\n/**\n * A table-level UNIQUE constraint on a `CreateTable` node. When `name` is\n * set, the adapter renders `CONSTRAINT <name> UNIQUE (…)`; otherwise it\n * renders an anonymous `UNIQUE (…)`.\n *\n * Frozen on construction — immutable after creation.\n */\nexport class UniqueConstraint {\n readonly kind = 'unique' as const;\n readonly columns: ReadonlyArray<string>;\n readonly name: string | undefined;\n\n constructor(options: { readonly columns: readonly string[]; readonly name?: string }) {\n this.columns = Object.freeze([...options.columns]);\n this.name = options.name;\n Object.freeze(this);\n }\n}\n\n/**\n * A table-level CHECK constraint carrying a raw SQL predicate expression. Used\n * for checks that are not enum value-set restrictions — e.g. the element-non-null\n * constraint on a scalar-array column (`array_position(col, NULL) IS NULL`).\n * The `expression` is emitted verbatim, so callers must supply safe,\n * pre-validated SQL.\n *\n * Frozen on construction — immutable after creation.\n */\nexport class CheckExpressionConstraint {\n readonly kind = 'check-expression' as const;\n readonly name: string;\n readonly expression: string;\n\n constructor(options: { readonly name: string; readonly expression: string }) {\n this.name = options.name;\n this.expression = options.expression;\n Object.freeze(this);\n }\n}\n\nexport type DdlTableConstraint =\n | PrimaryKeyConstraint\n | ForeignKeyConstraint\n | UniqueConstraint\n | CheckExpressionConstraint;\n"],"mappings":";;;AAyBA,IAAsB,mBAAtB,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,IAAI;CACpB;AACF;;;;;;;;AASA,IAAa,uBAAb,MAAkC;CAChC,OAAgB;CAChB;CACA;CACA;CACA;CACA;CACA;CAEA,YAAY,SAOT;EACD,KAAK,UAAU,OAAO,OAAO,CAAC,GAAG,QAAQ,OAAO,CAAC;EACjD,KAAK,WAAW,QAAQ;EACxB,KAAK,aAAa,OAAO,OAAO,CAAC,GAAG,QAAQ,UAAU,CAAC;EACvD,KAAK,WAAW,QAAQ;EACxB,KAAK,WAAW,QAAQ;EACxB,KAAK,OAAO,QAAQ;EACpB,OAAO,OAAO,IAAI;CACpB;AACF;;;;;;;;AASA,IAAa,mBAAb,MAA8B;CAC5B,OAAgB;CAChB;CACA;CAEA,YAAY,SAA0E;EACpF,KAAK,UAAU,OAAO,OAAO,CAAC,GAAG,QAAQ,OAAO,CAAC;EACjD,KAAK,OAAO,QAAQ;EACpB,OAAO,OAAO,IAAI;CACpB;AACF;;;;;;;;;;AAWA,IAAa,4BAAb,MAAuC;CACrC,OAAgB;CAChB;CACA;CAEA,YAAY,SAAiE;EAC3E,KAAK,OAAO,QAAQ;EACpB,KAAK,aAAa,QAAQ;EAC1B,OAAO,OAAO,IAAI;CACpB;AACF"}
|
package/dist/exports/ast.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { a as CodecMeta, c as ContractCodecRegistry, d as DescriptorCodecTraits, f as ExtractCodecTypes, h as SqlColumnRef, i as CodecDescriptor, l as DescriptorCodecId, m as SqlCodecInstanceContext, n as Codec, o as CodecRef, p as SqlCodecCallContext, r as CodecCallContext, s as CodecTrait, t as AnyCodecDescriptor, u as DescriptorCodecInput } from "../codec-types-
|
|
2
|
-
import { $ as
|
|
3
|
-
import { a as DdlColumnDefaultVisitor, c as DdlTableConstraint, d as LiteralColumnDefault, f as PrimaryKeyConstraint, i as DdlColumnDefault, l as ForeignKeyConstraint, m as isDdlNode, n as CheckExpressionConstraint, o as DdlColumnRenderContext, p as UniqueConstraint, r as DdlColumn, s as DdlNode, t as AnyDdlColumnDefault, u as FunctionColumnDefault } from "../ddl-types-
|
|
1
|
+
import { a as CodecMeta, c as ContractCodecRegistry, d as DescriptorCodecTraits, f as ExtractCodecTypes, g as frozenCodecRef, h as SqlColumnRef, i as CodecDescriptor, l as DescriptorCodecId, m as SqlCodecInstanceContext, n as Codec, o as CodecRef, p as SqlCodecCallContext, r as CodecCallContext, s as CodecTrait, t as AnyCodecDescriptor, u as DescriptorCodecInput } from "../codec-types-Bayoa4PI.mjs";
|
|
2
|
+
import { $ as OrderByItem, A as ExpressionRewriter, B as JoinOnExpr, C as Direction, Ct as JsonDocumentProjection, D as ExistsExpr, E as EqColJoinOn, F as IdentifierRef, G as ListExpression, H as JsonObjectEntry, I as InsertAst, J as LoweredStatement, K as LiteralExpr, L as InsertOnConflict, M as FunctionCallExpr, N as FunctionSource, O as ExprVisitor, P as FunctionSourceAlias, Q as OrExpr, R as InsertValue, S as DerivedTableSource, St as CodecJsonValueProjection, T as DoUpdateSetConflictAction, Tt as NativeJsonValueProjection, U as JsonObjectExpr, V as JsonArrayAggExpr, W as LimitOffsetValue, X as NullCheckExpr, Y as NotExpr, Z as OperationExpr, _ as CaseExpr, _t as isQueryAst, a as AndExpr, at as RawSqlExpr, b as DefaultValueExpr, bt as whereExprKinds, c as AnyInsertOnConflictAction, ct as SelectAstOptions, d as AnyParamRef, dt as TableSource, et as ParamRef, f as AnyQueryAst, ft as ToWhereExpr, g as CaseBranch, gt as WindowFuncExpr, h as BinaryOp, ht as WindowFn, i as AggregateOpFn, it as RawExpr, j as ExpressionSource, k as ExpressionFolder, l as AnyInsertValue, lt as SubqueryExpr, m as BinaryExpr, mt as WhereArg, n as AggregateExpr, nt as ProjectionExpr, o as AnyExpression, ot as RawSqlLiteral, p as AstRewriter, pt as UpdateAst, q as LoweredParam, r as AggregateFn, rt as ProjectionItem, s as AnyFromSource, st as SelectAst, t as AggregateCountFn, tt as PreparedParamRef, u as AnyOperationArg, ut as TableRef, v as CastExpr, vt as isWhereExpr, w as DoNothingConflictAction, wt as JsonValueProjectionVisitor, x as DeleteAst, xt as AnyJsonValueProjection, y as ColumnRef, yt as queryAstKinds, z as JoinAst } from "../types-CWlaErjN.mjs";
|
|
3
|
+
import { a as DdlColumnDefaultVisitor, c as DdlTableConstraint, d as LiteralColumnDefault, f as PrimaryKeyConstraint, i as DdlColumnDefault, l as ForeignKeyConstraint, m as isDdlNode, n as CheckExpressionConstraint, o as DdlColumnRenderContext, p as UniqueConstraint, r as DdlColumn, s as DdlNode, t as AnyDdlColumnDefault, u as FunctionColumnDefault } from "../ddl-types-B3SfjPGI.mjs";
|
|
4
4
|
import { ContractMarkerRecord, JsonValue } from "@prisma-next/contract/types";
|
|
5
5
|
import { CodecCallContext as CodecCallContext$1, CodecDescriptorImpl, CodecImpl, CodecInstanceContext } from "@prisma-next/framework-components/codec";
|
|
6
6
|
import { StandardSchemaV1 } from "@standard-schema/spec";
|
|
@@ -269,5 +269,5 @@ declare function compact<T extends Record<string, unknown>>(o: T): T;
|
|
|
269
269
|
*/
|
|
270
270
|
declare function collectOrderedParamRefs(ast: AnyQueryAst): ReadonlyArray<AnyParamRef>;
|
|
271
271
|
//#endregion
|
|
272
|
-
export { Adapter, AdapterProfile, AdapterTarget, AggregateCountFn, AggregateExpr, AggregateFn, AggregateOpFn, AndExpr, AnyCodecDescriptor, AnyDdlColumnDefault, AnyExpression, AnyFromSource, AnyInsertOnConflictAction, AnyInsertValue, AnyOperationArg, AnyParamRef, AnyQueryAst, AstRewriter, BinaryExpr, BinaryOp, CheckExpressionConstraint, Codec, type CodecCallContext, type CodecDescriptor, CodecMeta, type CodecRef, type CodecTrait, ColumnRef, ContractCodecRegistry, DdlColumn, DdlColumnDefault, DdlColumnDefaultVisitor, DdlColumnRenderContext, DdlNode, DdlTableConstraint, DefaultValueExpr, DeleteAst, DerivedTableSource, DescriptorCodecId, DescriptorCodecInput, DescriptorCodecTraits, Direction, DoNothingConflictAction, DoUpdateSetConflictAction, EqColJoinOn, ExistsExpr, ExprVisitor, ExpressionFolder, ExpressionRewriter, ExpressionSource, ExtractCodecTypes, ForeignKeyConstraint, FunctionColumnDefault, FunctionSource, IdentifierRef, InsertAst, InsertOnConflict, InsertValue, JoinAst, JoinOnExpr, JsonArrayAggExpr, JsonObjectEntry, JsonObjectExpr, LimitOffsetValue, ListExpression, LiteralColumnDefault, LiteralExpr, LoweredParam, LoweredStatement, Lowerer, LowererContext, MarkerReadResult, NotExpr, NullCheckExpr, OperationExpr, OrExpr, OrderByItem, ParamRef, PreparedExecuteRequest, PreparedParamRef, PrimaryKeyConstraint, ProjectionExpr, ProjectionItem, RawExpr, RawSqlExpr, RawSqlLiteral, 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, SqlCharCodec, SqlCharDescriptor, SqlCodecCallContext, SqlCodecInstanceContext, SqlColumnRef, SqlConnection, SqlDriver, SqlDriverState, SqlExecuteRequest, SqlExplainResult, SqlFloatCodec, SqlFloatDescriptor, SqlIntCodec, SqlIntDescriptor, SqlQueryResult, SqlQueryable, SqlTextCodec, SqlTextDescriptor, SqlTimestampCodec, SqlTimestampDescriptor, SqlTransaction, SqlVarcharCodec, SqlVarcharDescriptor, SubqueryExpr, TableRef, TableSource, ToWhereExpr, UniqueConstraint, UpdateAst, WhereArg, WindowFn, WindowFuncExpr, collectOrderedParamRefs, compact, isDdlNode, isQueryAst, isWhereExpr, queryAstKinds, sqlCharColumn, sqlCharDecode, sqlCharDescriptor, sqlCharEncode, sqlCharRenderOutputType, sqlFloatColumn, sqlFloatDecode, sqlFloatDescriptor, sqlFloatEncode, sqlIntColumn, sqlIntDecode, sqlIntDescriptor, sqlIntEncode, sqlTextColumn, sqlTextDecode, sqlTextDescriptor, sqlTextEncode, sqlTimestampColumn, sqlTimestampDecode, sqlTimestampDecodeJson, sqlTimestampDescriptor, sqlTimestampEncode, sqlTimestampEncodeJson, sqlTimestampRenderOutputType, sqlVarcharColumn, sqlVarcharDecode, sqlVarcharDescriptor, sqlVarcharEncode, sqlVarcharRenderOutputType, whereExprKinds };
|
|
272
|
+
export { Adapter, AdapterProfile, AdapterTarget, AggregateCountFn, AggregateExpr, AggregateFn, AggregateOpFn, AndExpr, AnyCodecDescriptor, AnyDdlColumnDefault, AnyExpression, AnyFromSource, AnyInsertOnConflictAction, AnyInsertValue, AnyJsonValueProjection, AnyOperationArg, AnyParamRef, AnyQueryAst, AstRewriter, BinaryExpr, BinaryOp, CaseBranch, CaseExpr, CastExpr, CheckExpressionConstraint, Codec, type CodecCallContext, type CodecDescriptor, CodecJsonValueProjection, CodecMeta, type CodecRef, type CodecTrait, ColumnRef, ContractCodecRegistry, DdlColumn, DdlColumnDefault, DdlColumnDefaultVisitor, DdlColumnRenderContext, DdlNode, DdlTableConstraint, DefaultValueExpr, DeleteAst, DerivedTableSource, DescriptorCodecId, DescriptorCodecInput, DescriptorCodecTraits, Direction, DoNothingConflictAction, DoUpdateSetConflictAction, EqColJoinOn, ExistsExpr, ExprVisitor, ExpressionFolder, ExpressionRewriter, ExpressionSource, ExtractCodecTypes, ForeignKeyConstraint, FunctionCallExpr, FunctionColumnDefault, FunctionSource, FunctionSourceAlias, IdentifierRef, InsertAst, InsertOnConflict, InsertValue, JoinAst, JoinOnExpr, JsonArrayAggExpr, JsonDocumentProjection, JsonObjectEntry, JsonObjectExpr, JsonValueProjectionVisitor, LimitOffsetValue, ListExpression, LiteralColumnDefault, LiteralExpr, LoweredParam, LoweredStatement, Lowerer, LowererContext, MarkerReadResult, NativeJsonValueProjection, NotExpr, NullCheckExpr, OperationExpr, OrExpr, OrderByItem, ParamRef, PreparedExecuteRequest, PreparedParamRef, PrimaryKeyConstraint, ProjectionExpr, ProjectionItem, RawExpr, RawSqlExpr, RawSqlLiteral, 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, SqlCharCodec, SqlCharDescriptor, SqlCodecCallContext, SqlCodecInstanceContext, SqlColumnRef, SqlConnection, SqlDriver, SqlDriverState, SqlExecuteRequest, SqlExplainResult, SqlFloatCodec, SqlFloatDescriptor, SqlIntCodec, SqlIntDescriptor, SqlQueryResult, SqlQueryable, SqlTextCodec, SqlTextDescriptor, SqlTimestampCodec, SqlTimestampDescriptor, SqlTransaction, SqlVarcharCodec, SqlVarcharDescriptor, SubqueryExpr, TableRef, TableSource, ToWhereExpr, UniqueConstraint, UpdateAst, WhereArg, WindowFn, WindowFuncExpr, collectOrderedParamRefs, compact, frozenCodecRef, isDdlNode, isQueryAst, isWhereExpr, queryAstKinds, sqlCharColumn, sqlCharDecode, sqlCharDescriptor, sqlCharEncode, sqlCharRenderOutputType, sqlFloatColumn, sqlFloatDecode, sqlFloatDescriptor, sqlFloatEncode, sqlIntColumn, sqlIntDecode, sqlIntDescriptor, sqlIntEncode, sqlTextColumn, sqlTextDecode, sqlTextDescriptor, sqlTextEncode, sqlTimestampColumn, sqlTimestampDecode, sqlTimestampDecodeJson, sqlTimestampDescriptor, sqlTimestampEncode, sqlTimestampEncodeJson, sqlTimestampRenderOutputType, sqlVarcharColumn, sqlVarcharDecode, sqlVarcharDescriptor, sqlVarcharEncode, sqlVarcharRenderOutputType, whereExprKinds };
|
|
273
273
|
//# sourceMappingURL=ast.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ast.d.mts","names":[],"sources":["../../src/ast/driver-types.ts","../../src/ast/adapter-types.ts","../../src/ast/sql-codec-helpers.ts","../../src/ast/sql-codecs.ts","../../src/ast/util.ts"],"mappings":";;;;;;;;;;;;;;;UAQiB;WACN;WACA;;UAGM;WACN;WACA;WACA;IACP;IACA,IAAI;;;UAIS,eAAe,MAAM;WAC3B,MAAM,cAAc;WACpB;YACC;;UAGK,iBAAiB,MAAM;WAC7B,MAAM,cAAc;;KAGnB;UAEK,UAAU,yBAAyB;WACzC,QAAQ;EACjB,QAAQ,SAAS,WAAW;EAC5B,qBAAqB,QAAQ;EAC7B,SAAS;;UAGM,sBAAsB;EACrC,oBAAoB,QAAQ;;;;;;;EAO5B,WAAW;;;;;;;;;;;;;;;;;;;;;;;;EAwBX,QAAQ,mBAAmB;;UAGZ,uBAAuB;EACtC,UAAU;EACV,YAAY;;UAGG;EACf,QAAQ,MAAM,yBAAyB,SAAS,oBAAoB,cAAc;EAClF,gBAAgB,MAAM,yBACpB,SAAS,yBACR,cAAc;EACjB,SAAS,SAAS,oBAAoB,QAAQ;EAC9C,MAAM,MAAM,yBACV,aACA,8BACC,QAAQ,eAAe;;;;KCtFhB;;;;;;;KAQA;WACG;WAA0B,QAAQ;;WAClC;;WACA;;UAEE,eAAe,gBAAgB,gBAAgB;WACrD;WACA,QAAQ;WACR,cAAc;;;;EAIvB,WAAW,WAAW,eAAe,QAAQ;;UAG9B,eAAe;WACrB,UAAU;WACV;;KAGC,QAAQ,eAAe,qBAAqB,QAAQ,qBAC9D,KAAK,KACL,SAAS,eAAe,eACrB;;;;UAKY,QAAQ,eAAe,qBAAqB,QAAQ;WAC1D,SAAS;EAClB,MAAM,KAAK,KAAK,SAAS,eAAe,aAAa;;;;
|
|
1
|
+
{"version":3,"file":"ast.d.mts","names":[],"sources":["../../src/ast/driver-types.ts","../../src/ast/adapter-types.ts","../../src/ast/sql-codec-helpers.ts","../../src/ast/sql-codecs.ts","../../src/ast/util.ts"],"mappings":";;;;;;;;;;;;;;;UAQiB;WACN;WACA;;UAGM;WACN;WACA;WACA;IACP;IACA,IAAI;;;UAIS,eAAe,MAAM;WAC3B,MAAM,cAAc;WACpB;YACC;;UAGK,iBAAiB,MAAM;WAC7B,MAAM,cAAc;;KAGnB;UAEK,UAAU,yBAAyB;WACzC,QAAQ;EACjB,QAAQ,SAAS,WAAW;EAC5B,qBAAq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,MACA;EAEM,OAAO,OAAO,MAAM,MAAM,qBAAmB,QAAQ;EAGrD,OAAO,MAAM,MAAM,MAAM,qBAAmB,QAAQ;EAG1D,WAAW,OAAO,OAAO;EAGzB,WAAW,MAAM,YAAY;;cAKlB,+BAA+B,oBAAoB;WAC5C;WACA;WACA;WACA,cAAc,iBAAiB;EACxC,iBAAiB,QAAQ;EAGzB,QAAQ,SAAS,mBAAmB,KAAK,yBAAyB;;cAKhE,wBAAsB;cAEtB,qBAAsB,SAAQ,sEAAoB,WAAA,mBAAA;;;iBClS/C,QAAQ,UAAU,yBAAyB,GAAG,IAAI;;;;;;;;;;;iBAoBlD,wBAAwB,KAAK,cAAc,cAAc"}
|
package/dist/exports/ast.mjs
CHANGED
|
@@ -1,8 +1,70 @@
|
|
|
1
|
-
import { a as
|
|
2
|
-
import {
|
|
1
|
+
import { A as PreparedParamRef, B as isWhereExpr, C as LiteralExpr, D as OrExpr, E as OperationExpr, F as SubqueryExpr, H as whereExprKinds, I as TableSource, L as UpdateAst, M as RawExpr, N as RawSqlExpr, O as OrderByItem, P as SelectAst, R as WindowFuncExpr, S as ListExpression, T as NullCheckExpr, U as frozenCodecRef, V as queryAstKinds, _ as InsertAst, a as CastExpr, b as JsonArrayAggExpr, c as DeleteAst, d as DoUpdateSetConflictAction, f as EqColJoinOn, g as IdentifierRef, h as FunctionSource, i as CaseExpr, j as ProjectionItem, k as ParamRef, l as DerivedTableSource, m as FunctionCallExpr, n as AndExpr, o as ColumnRef, p as ExistsExpr, r as BinaryExpr, s as DefaultValueExpr, t as AggregateExpr, u as DoNothingConflictAction, v as InsertOnConflict, w as NotExpr, x as JsonObjectExpr, y as JoinAst, z as isQueryAst } from "../types-CINOak-F.mjs";
|
|
2
|
+
import { a as ForeignKeyConstraint, c as PrimaryKeyConstraint, i as DdlNode, l as UniqueConstraint, n as DdlColumn, o as FunctionColumnDefault, r as DdlColumnDefault, s as LiteralColumnDefault, t as CheckExpressionConstraint, u as isDdlNode } from "../ddl-types-BUoa33yk.mjs";
|
|
3
3
|
import { n as compact, t as collectOrderedParamRefs } from "../util-DQQgv2j1.mjs";
|
|
4
|
+
import { structuredError } from "@prisma-next/utils/structured-error";
|
|
4
5
|
import { CodecDescriptorImpl, CodecImpl, column, voidParamsSchema } from "@prisma-next/framework-components/codec";
|
|
5
6
|
import { type } from "arktype";
|
|
7
|
+
//#region src/ast/json-value-projection.ts
|
|
8
|
+
var JsonValueProjection = class {
|
|
9
|
+
value;
|
|
10
|
+
constructor(value) {
|
|
11
|
+
this.value = value;
|
|
12
|
+
}
|
|
13
|
+
fold(folder) {
|
|
14
|
+
return this.value.fold(folder);
|
|
15
|
+
}
|
|
16
|
+
collectColumnRefs() {
|
|
17
|
+
return this.value.collectColumnRefs();
|
|
18
|
+
}
|
|
19
|
+
collectParamRefs() {
|
|
20
|
+
return this.value.collectParamRefs();
|
|
21
|
+
}
|
|
22
|
+
freeze() {
|
|
23
|
+
Object.freeze(this);
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
var CodecJsonValueProjection = class CodecJsonValueProjection extends JsonValueProjection {
|
|
27
|
+
kind = "codec";
|
|
28
|
+
codec;
|
|
29
|
+
constructor(value, codec) {
|
|
30
|
+
super(value);
|
|
31
|
+
this.codec = frozenCodecRef(codec);
|
|
32
|
+
this.freeze();
|
|
33
|
+
}
|
|
34
|
+
accept(visitor) {
|
|
35
|
+
return visitor.codec(this);
|
|
36
|
+
}
|
|
37
|
+
rewrite(rewriter) {
|
|
38
|
+
return new CodecJsonValueProjection(this.value.rewrite(rewriter), this.codec);
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
var NativeJsonValueProjection = class NativeJsonValueProjection extends JsonValueProjection {
|
|
42
|
+
kind = "native";
|
|
43
|
+
constructor(value) {
|
|
44
|
+
super(value);
|
|
45
|
+
this.freeze();
|
|
46
|
+
}
|
|
47
|
+
accept(visitor) {
|
|
48
|
+
return visitor.native(this);
|
|
49
|
+
}
|
|
50
|
+
rewrite(rewriter) {
|
|
51
|
+
return new NativeJsonValueProjection(this.value.rewrite(rewriter));
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
var JsonDocumentProjection = class JsonDocumentProjection extends JsonValueProjection {
|
|
55
|
+
kind = "document";
|
|
56
|
+
constructor(value) {
|
|
57
|
+
super(value);
|
|
58
|
+
this.freeze();
|
|
59
|
+
}
|
|
60
|
+
accept(visitor) {
|
|
61
|
+
return visitor.document(this);
|
|
62
|
+
}
|
|
63
|
+
rewrite(rewriter) {
|
|
64
|
+
return new JsonDocumentProjection(this.value.rewrite(rewriter));
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
//#endregion
|
|
6
68
|
//#region src/ast/sql-codec-helpers.ts
|
|
7
69
|
const SQL_CHAR_CODEC_ID = "sql/char@1";
|
|
8
70
|
const SQL_VARCHAR_CODEC_ID = "sql/varchar@1";
|
|
@@ -15,7 +77,11 @@ const sqlCharDecode = (wire) => wire.trimEnd();
|
|
|
15
77
|
const sqlCharRenderOutputType = (typeParams) => {
|
|
16
78
|
const length = typeParams.length;
|
|
17
79
|
if (length === void 0) return void 0;
|
|
18
|
-
if (typeof length !== "number" || !Number.isFinite(length) || !Number.isInteger(length)) throw
|
|
80
|
+
if (typeof length !== "number" || !Number.isFinite(length) || !Number.isInteger(length)) throw structuredError("RUNTIME.TYPE_PARAMS_INVALID", `renderOutputType: expected integer "length" in typeParams for Char, got ${String(length)}`, { meta: {
|
|
81
|
+
codec: SQL_CHAR_CODEC_ID,
|
|
82
|
+
param: "length",
|
|
83
|
+
received: String(length)
|
|
84
|
+
} });
|
|
19
85
|
return `Char<${length}>`;
|
|
20
86
|
};
|
|
21
87
|
const sqlVarcharEncode = (value) => value;
|
|
@@ -23,7 +89,11 @@ const sqlVarcharDecode = (wire) => wire;
|
|
|
23
89
|
const sqlVarcharRenderOutputType = (typeParams) => {
|
|
24
90
|
const length = typeParams.length;
|
|
25
91
|
if (length === void 0) return void 0;
|
|
26
|
-
if (typeof length !== "number" || !Number.isFinite(length) || !Number.isInteger(length)) throw
|
|
92
|
+
if (typeof length !== "number" || !Number.isFinite(length) || !Number.isInteger(length)) throw structuredError("RUNTIME.TYPE_PARAMS_INVALID", `renderOutputType: expected integer "length" in typeParams for Varchar, got ${String(length)}`, { meta: {
|
|
93
|
+
codec: SQL_VARCHAR_CODEC_ID,
|
|
94
|
+
param: "length",
|
|
95
|
+
received: String(length)
|
|
96
|
+
} });
|
|
27
97
|
return `Varchar<${length}>`;
|
|
28
98
|
};
|
|
29
99
|
const sqlIntEncode = (value) => value;
|
|
@@ -36,15 +106,19 @@ const sqlTimestampEncode = (value) => value;
|
|
|
36
106
|
const sqlTimestampDecode = (wire) => wire;
|
|
37
107
|
const sqlTimestampEncodeJson = (value) => value.toISOString();
|
|
38
108
|
const sqlTimestampDecodeJson = (json) => {
|
|
39
|
-
if (typeof json !== "string") throw
|
|
109
|
+
if (typeof json !== "string") throw structuredError("RUNTIME.DECODE_FAILED", `Expected ISO date string for sql/timestamp@1, got ${typeof json}`, { meta: { codec: SQL_TIMESTAMP_CODEC_ID } });
|
|
40
110
|
const date = new Date(json);
|
|
41
|
-
if (Number.isNaN(date.getTime())) throw
|
|
111
|
+
if (Number.isNaN(date.getTime())) throw structuredError("RUNTIME.DECODE_FAILED", `Invalid ISO date string for sql/timestamp@1: ${json}`, { meta: { codec: SQL_TIMESTAMP_CODEC_ID } });
|
|
42
112
|
return date;
|
|
43
113
|
};
|
|
44
114
|
const sqlTimestampRenderOutputType = (typeParams) => {
|
|
45
115
|
const precision = typeParams.precision;
|
|
46
116
|
if (precision === void 0) return "Timestamp";
|
|
47
|
-
if (typeof precision !== "number" || !Number.isFinite(precision) || !Number.isInteger(precision)) throw
|
|
117
|
+
if (typeof precision !== "number" || !Number.isFinite(precision) || !Number.isInteger(precision)) throw structuredError("RUNTIME.TYPE_PARAMS_INVALID", `renderOutputType: expected integer "precision" in typeParams for Timestamp, got ${String(precision)}`, { meta: {
|
|
118
|
+
codec: SQL_TIMESTAMP_CODEC_ID,
|
|
119
|
+
param: "precision",
|
|
120
|
+
received: String(precision)
|
|
121
|
+
} });
|
|
48
122
|
return `Timestamp<${precision}>`;
|
|
49
123
|
};
|
|
50
124
|
//#endregion
|
|
@@ -231,6 +305,6 @@ var SqlTimestampDescriptor = class extends CodecDescriptorImpl {
|
|
|
231
305
|
const sqlTimestampDescriptor = new SqlTimestampDescriptor();
|
|
232
306
|
const sqlTimestampColumn = (params = {}) => column(sqlTimestampDescriptor.factory(params), sqlTimestampDescriptor.codecId, params, "timestamp");
|
|
233
307
|
//#endregion
|
|
234
|
-
export { AggregateExpr, AndExpr, BinaryExpr, CheckExpressionConstraint, ColumnRef, DdlColumn, DdlColumnDefault, DdlNode, DefaultValueExpr, DeleteAst, DerivedTableSource, DoNothingConflictAction, DoUpdateSetConflictAction, EqColJoinOn, ExistsExpr, ForeignKeyConstraint, FunctionColumnDefault, FunctionSource, IdentifierRef, InsertAst, InsertOnConflict, JoinAst, JsonArrayAggExpr, JsonObjectExpr, ListExpression, LiteralColumnDefault, LiteralExpr, NotExpr, NullCheckExpr, OperationExpr, OrExpr, OrderByItem, ParamRef, PreparedParamRef, PrimaryKeyConstraint, ProjectionItem, RawExpr, RawSqlExpr, 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, SqlCharCodec, SqlCharDescriptor, SqlFloatCodec, SqlFloatDescriptor, SqlIntCodec, SqlIntDescriptor, SqlTextCodec, SqlTextDescriptor, SqlTimestampCodec, SqlTimestampDescriptor, SqlVarcharCodec, SqlVarcharDescriptor, SubqueryExpr, TableSource, UniqueConstraint, UpdateAst, WindowFuncExpr, collectOrderedParamRefs, compact, isDdlNode, isQueryAst, isWhereExpr, queryAstKinds, sqlCharColumn, sqlCharDecode, sqlCharDescriptor, sqlCharEncode, sqlCharRenderOutputType, sqlFloatColumn, sqlFloatDecode, sqlFloatDescriptor, sqlFloatEncode, sqlIntColumn, sqlIntDecode, sqlIntDescriptor, sqlIntEncode, sqlTextColumn, sqlTextDecode, sqlTextDescriptor, sqlTextEncode, sqlTimestampColumn, sqlTimestampDecode, sqlTimestampDecodeJson, sqlTimestampDescriptor, sqlTimestampEncode, sqlTimestampEncodeJson, sqlTimestampRenderOutputType, sqlVarcharColumn, sqlVarcharDecode, sqlVarcharDescriptor, sqlVarcharEncode, sqlVarcharRenderOutputType, whereExprKinds };
|
|
308
|
+
export { AggregateExpr, AndExpr, BinaryExpr, CaseExpr, CastExpr, CheckExpressionConstraint, CodecJsonValueProjection, ColumnRef, DdlColumn, DdlColumnDefault, DdlNode, DefaultValueExpr, DeleteAst, DerivedTableSource, DoNothingConflictAction, DoUpdateSetConflictAction, EqColJoinOn, ExistsExpr, ForeignKeyConstraint, FunctionCallExpr, FunctionColumnDefault, FunctionSource, IdentifierRef, InsertAst, InsertOnConflict, JoinAst, JsonArrayAggExpr, JsonDocumentProjection, JsonObjectExpr, ListExpression, LiteralColumnDefault, LiteralExpr, NativeJsonValueProjection, NotExpr, NullCheckExpr, OperationExpr, OrExpr, OrderByItem, ParamRef, PreparedParamRef, PrimaryKeyConstraint, ProjectionItem, RawExpr, RawSqlExpr, 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, SqlCharCodec, SqlCharDescriptor, SqlFloatCodec, SqlFloatDescriptor, SqlIntCodec, SqlIntDescriptor, SqlTextCodec, SqlTextDescriptor, SqlTimestampCodec, SqlTimestampDescriptor, SqlVarcharCodec, SqlVarcharDescriptor, SubqueryExpr, TableSource, UniqueConstraint, UpdateAst, WindowFuncExpr, collectOrderedParamRefs, compact, frozenCodecRef, isDdlNode, isQueryAst, isWhereExpr, queryAstKinds, sqlCharColumn, sqlCharDecode, sqlCharDescriptor, sqlCharEncode, sqlCharRenderOutputType, sqlFloatColumn, sqlFloatDecode, sqlFloatDescriptor, sqlFloatEncode, sqlIntColumn, sqlIntDecode, sqlIntDescriptor, sqlIntEncode, sqlTextColumn, sqlTextDecode, sqlTextDescriptor, sqlTextEncode, sqlTimestampColumn, sqlTimestampDecode, sqlTimestampDecodeJson, sqlTimestampDescriptor, sqlTimestampEncode, sqlTimestampEncodeJson, sqlTimestampRenderOutputType, sqlVarcharColumn, sqlVarcharDecode, sqlVarcharDescriptor, sqlVarcharEncode, sqlVarcharRenderOutputType, whereExprKinds };
|
|
235
309
|
|
|
236
310
|
//# sourceMappingURL=ast.mjs.map
|
package/dist/exports/ast.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ast.mjs","names":["arktype"],"sources":["../../src/ast/sql-codec-helpers.ts","../../src/ast/sql-codecs.ts"],"sourcesContent":["/**\n * Shared encode/decode/render constants and codec id literals for the six SQL base codecs (`sql/char@1`, `sql/varchar@1`, `sql/int@1`, `sql/float@1`, `sql/text@1`, `sql/timestamp@1`).\n *\n * The codec implementations live in `sql-codecs.ts` (TML-2357). This module retains only the conversion helpers + emit-path renderers the codec methods compose with — keeping a single source of truth for non-trivial conversions while the codec methods provide the framework-required `Promise<…>` boundary.\n */\n\nimport type { JsonValue } from '@prisma-next/contract/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\nexport const sqlCharEncode = (value: string): string => value;\nexport const sqlCharDecode = (wire: string): string => wire.trimEnd();\nexport const sqlCharRenderOutputType = (typeParams: { readonly length?: number }) => {\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\nexport const sqlVarcharEncode = (value: string): string => value;\nexport const sqlVarcharDecode = (wire: string): string => wire;\nexport const sqlVarcharRenderOutputType = (typeParams: { readonly length?: number }) => {\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\nexport const sqlIntEncode = (value: number): number => value;\nexport const sqlIntDecode = (wire: number): number => wire;\n\nexport const sqlFloatEncode = (value: number): number => value;\nexport const sqlFloatDecode = (wire: number): number => wire;\n\nexport const sqlTextEncode = (value: string): string => value;\nexport const sqlTextDecode = (wire: string): string => wire;\n\nexport const sqlTimestampEncode = (value: Date): Date => value;\nexport const sqlTimestampDecode = (wire: Date): Date => wire;\nexport const sqlTimestampEncodeJson = (value: Date): JsonValue => value.toISOString();\nexport const sqlTimestampDecodeJson = (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};\nexport const sqlTimestampRenderOutputType = (typeParams: { readonly precision?: number }) => {\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 * The six SQL base codecs (TML-2357).\n *\n * Each codec ships as three artifacts:\n *\n * 1. A `SqlXCodec` class extending {@link CodecImpl} that wraps the module-level encode/decode constants exported from `sql-codec-helpers.ts` (the single source of truth for runtime behaviour). 2. A `SqlXDescriptor` class extending {@link CodecDescriptorImpl} declaring the codec id, traits, target types, params schema, and (where applicable) the emit-path `renderOutputType`. 3. A per-codec column helper (`sqlXColumn`)\n * that calls `descriptor.factory(...)` directly and packages the result into a {@link ColumnSpec} via the framework {@link column} packager. The helper is tied to its descriptor with `satisfies ColumnHelperFor`.\n *\n * After TML-2357 this file is the canonical source of SQL base codec metadata and runtime behaviour — the legacy `mkCodec` / `defineCodec` carriers retired with the deletion sweep.\n */\n\nimport type { JsonValue } from '@prisma-next/contract/types';\nimport {\n type CodecCallContext,\n CodecDescriptorImpl,\n CodecImpl,\n type CodecInstanceContext,\n type ColumnHelperFor,\n type ColumnHelperForStrict,\n column,\n voidParamsSchema,\n} from '@prisma-next/framework-components/codec';\nimport type { StandardSchemaV1 } from '@standard-schema/spec';\nimport { type as arktype } from 'arktype';\nimport {\n SQL_CHAR_CODEC_ID,\n SQL_FLOAT_CODEC_ID,\n SQL_INT_CODEC_ID,\n SQL_TEXT_CODEC_ID,\n SQL_TIMESTAMP_CODEC_ID,\n SQL_VARCHAR_CODEC_ID,\n sqlCharDecode,\n sqlCharEncode,\n sqlCharRenderOutputType,\n sqlFloatDecode,\n sqlFloatEncode,\n sqlIntDecode,\n sqlIntEncode,\n sqlTextDecode,\n sqlTextEncode,\n sqlTimestampDecode,\n sqlTimestampDecodeJson,\n sqlTimestampEncode,\n sqlTimestampEncodeJson,\n sqlTimestampRenderOutputType,\n sqlVarcharDecode,\n sqlVarcharEncode,\n sqlVarcharRenderOutputType,\n} from './sql-codec-helpers';\n\ntype LengthParams = { readonly length?: number };\ntype PrecisionParams = { readonly precision?: number };\n\nconst lengthParamsSchema = arktype({\n 'length?': 'number.integer > 0',\n}) satisfies StandardSchemaV1<LengthParams>;\n\nconst precisionParamsSchema = arktype({\n 'precision?': 'number.integer >= 0 & number.integer <= 6',\n}) satisfies StandardSchemaV1<PrecisionParams>;\n\nexport class SqlTextCodec extends CodecImpl<\n typeof SQL_TEXT_CODEC_ID,\n readonly ['equality', 'order', 'textual'],\n string,\n string\n> {\n async encode(value: string, _ctx: CodecCallContext): Promise<string> {\n return sqlTextEncode(value);\n }\n async decode(wire: string, _ctx: CodecCallContext): Promise<string> {\n return sqlTextDecode(wire);\n }\n encodeJson(value: string): JsonValue {\n return value;\n }\n decodeJson(json: JsonValue): string {\n return json as string;\n }\n}\n\nexport class SqlTextDescriptor extends CodecDescriptorImpl<void> {\n override readonly codecId = SQL_TEXT_CODEC_ID;\n override readonly traits = ['equality', 'order', 'textual'] as const;\n override readonly targetTypes = ['text'] as const;\n override readonly paramsSchema: StandardSchemaV1<void> = voidParamsSchema;\n override factory(): (ctx: CodecInstanceContext) => SqlTextCodec {\n return () => new SqlTextCodec(this);\n }\n}\n\nexport const sqlTextDescriptor = new SqlTextDescriptor();\n\nexport const sqlTextColumn = () =>\n column(sqlTextDescriptor.factory(), sqlTextDescriptor.codecId, undefined, 'text');\n\nsqlTextColumn satisfies ColumnHelperFor<SqlTextDescriptor>;\nsqlTextColumn satisfies ColumnHelperForStrict<SqlTextDescriptor>;\n\nexport class SqlIntCodec extends CodecImpl<\n typeof SQL_INT_CODEC_ID,\n readonly ['equality', 'order', 'numeric'],\n number,\n number\n> {\n async encode(value: number, _ctx: CodecCallContext): Promise<number> {\n return sqlIntEncode(value);\n }\n async decode(wire: number, _ctx: CodecCallContext): Promise<number> {\n return sqlIntDecode(wire);\n }\n encodeJson(value: number): JsonValue {\n return value;\n }\n decodeJson(json: JsonValue): number {\n return json as number;\n }\n}\n\nexport class SqlIntDescriptor extends CodecDescriptorImpl<void> {\n override readonly codecId = SQL_INT_CODEC_ID;\n override readonly traits = ['equality', 'order', 'numeric'] as const;\n override readonly targetTypes = ['int'] as const;\n override readonly paramsSchema: StandardSchemaV1<void> = voidParamsSchema;\n override factory(): (ctx: CodecInstanceContext) => SqlIntCodec {\n return () => new SqlIntCodec(this);\n }\n}\n\nexport const sqlIntDescriptor = new SqlIntDescriptor();\n\nexport const sqlIntColumn = () =>\n column(sqlIntDescriptor.factory(), sqlIntDescriptor.codecId, undefined, 'int');\n\nsqlIntColumn satisfies ColumnHelperFor<SqlIntDescriptor>;\nsqlIntColumn satisfies ColumnHelperForStrict<SqlIntDescriptor>;\n\nexport class SqlFloatCodec extends CodecImpl<\n typeof SQL_FLOAT_CODEC_ID,\n readonly ['equality', 'order', 'numeric'],\n number,\n number\n> {\n async encode(value: number, _ctx: CodecCallContext): Promise<number> {\n return sqlFloatEncode(value);\n }\n async decode(wire: number, _ctx: CodecCallContext): Promise<number> {\n return sqlFloatDecode(wire);\n }\n encodeJson(value: number): JsonValue {\n return value;\n }\n decodeJson(json: JsonValue): number {\n return json as number;\n }\n}\n\nexport class SqlFloatDescriptor extends CodecDescriptorImpl<void> {\n override readonly codecId = SQL_FLOAT_CODEC_ID;\n override readonly traits = ['equality', 'order', 'numeric'] as const;\n override readonly targetTypes = ['float'] as const;\n override readonly paramsSchema: StandardSchemaV1<void> = voidParamsSchema;\n override factory(): (ctx: CodecInstanceContext) => SqlFloatCodec {\n return () => new SqlFloatCodec(this);\n }\n}\n\nexport const sqlFloatDescriptor = new SqlFloatDescriptor();\n\nexport const sqlFloatColumn = () =>\n column(sqlFloatDescriptor.factory(), sqlFloatDescriptor.codecId, undefined, 'float');\n\nsqlFloatColumn satisfies ColumnHelperFor<SqlFloatDescriptor>;\nsqlFloatColumn satisfies ColumnHelperForStrict<SqlFloatDescriptor>;\n\nexport class SqlCharCodec extends CodecImpl<\n typeof SQL_CHAR_CODEC_ID,\n readonly ['equality', 'order', 'textual'],\n string,\n string\n> {\n async encode(value: string, _ctx: CodecCallContext): Promise<string> {\n return sqlCharEncode(value);\n }\n async decode(wire: string, _ctx: CodecCallContext): Promise<string> {\n return sqlCharDecode(wire);\n }\n encodeJson(value: string): JsonValue {\n return value;\n }\n decodeJson(json: JsonValue): string {\n return json as string;\n }\n}\n\nexport class SqlCharDescriptor extends CodecDescriptorImpl<LengthParams> {\n override readonly codecId = SQL_CHAR_CODEC_ID;\n override readonly traits = ['equality', 'order', 'textual'] as const;\n override readonly targetTypes = ['char'] as const;\n override readonly paramsSchema: StandardSchemaV1<LengthParams> = lengthParamsSchema;\n override renderOutputType(params: LengthParams): string | undefined {\n return sqlCharRenderOutputType(params);\n }\n override factory(_params: LengthParams): (ctx: CodecInstanceContext) => SqlCharCodec {\n return () => new SqlCharCodec(this);\n }\n}\n\nexport const sqlCharDescriptor = new SqlCharDescriptor();\n\nexport const sqlCharColumn = (params: LengthParams = {}) =>\n column(sqlCharDescriptor.factory(params), sqlCharDescriptor.codecId, params, 'char');\n\nsqlCharColumn satisfies ColumnHelperFor<SqlCharDescriptor>;\nsqlCharColumn satisfies ColumnHelperForStrict<SqlCharDescriptor>;\n\nexport class SqlVarcharCodec extends CodecImpl<\n typeof SQL_VARCHAR_CODEC_ID,\n readonly ['equality', 'order', 'textual'],\n string,\n string\n> {\n async encode(value: string, _ctx: CodecCallContext): Promise<string> {\n return sqlVarcharEncode(value);\n }\n async decode(wire: string, _ctx: CodecCallContext): Promise<string> {\n return sqlVarcharDecode(wire);\n }\n encodeJson(value: string): JsonValue {\n return value;\n }\n decodeJson(json: JsonValue): string {\n return json as string;\n }\n}\n\nexport class SqlVarcharDescriptor extends CodecDescriptorImpl<LengthParams> {\n override readonly codecId = SQL_VARCHAR_CODEC_ID;\n override readonly traits = ['equality', 'order', 'textual'] as const;\n override readonly targetTypes = ['varchar'] as const;\n override readonly paramsSchema: StandardSchemaV1<LengthParams> = lengthParamsSchema;\n override renderOutputType(params: LengthParams): string | undefined {\n return sqlVarcharRenderOutputType(params);\n }\n override factory(_params: LengthParams): (ctx: CodecInstanceContext) => SqlVarcharCodec {\n return () => new SqlVarcharCodec(this);\n }\n}\n\nexport const sqlVarcharDescriptor = new SqlVarcharDescriptor();\n\nexport const sqlVarcharColumn = (params: LengthParams = {}) =>\n column(sqlVarcharDescriptor.factory(params), sqlVarcharDescriptor.codecId, params, 'varchar');\n\nsqlVarcharColumn satisfies ColumnHelperFor<SqlVarcharDescriptor>;\nsqlVarcharColumn satisfies ColumnHelperForStrict<SqlVarcharDescriptor>;\n\nexport class SqlTimestampCodec extends CodecImpl<\n typeof SQL_TIMESTAMP_CODEC_ID,\n readonly ['equality', 'order'],\n Date,\n Date\n> {\n async encode(value: Date, _ctx: CodecCallContext): Promise<Date> {\n return sqlTimestampEncode(value);\n }\n async decode(wire: Date, _ctx: CodecCallContext): Promise<Date> {\n return sqlTimestampDecode(wire);\n }\n encodeJson(value: Date): JsonValue {\n return sqlTimestampEncodeJson(value);\n }\n decodeJson(json: JsonValue): Date {\n return sqlTimestampDecodeJson(json);\n }\n}\n\nexport class SqlTimestampDescriptor extends CodecDescriptorImpl<PrecisionParams> {\n override readonly codecId = SQL_TIMESTAMP_CODEC_ID;\n override readonly traits = ['equality', 'order'] as const;\n override readonly targetTypes = ['timestamp'] as const;\n override readonly paramsSchema: StandardSchemaV1<PrecisionParams> = precisionParamsSchema;\n override renderOutputType(params: PrecisionParams): string | undefined {\n return sqlTimestampRenderOutputType(params);\n }\n override factory(_params: PrecisionParams): (ctx: CodecInstanceContext) => SqlTimestampCodec {\n return () => new SqlTimestampCodec(this);\n }\n}\n\nexport const sqlTimestampDescriptor = new SqlTimestampDescriptor();\n\nexport const sqlTimestampColumn = (params: PrecisionParams = {}) =>\n column(\n sqlTimestampDescriptor.factory(params),\n sqlTimestampDescriptor.codecId,\n params,\n 'timestamp',\n );\n\nsqlTimestampColumn satisfies ColumnHelperFor<SqlTimestampDescriptor>;\nsqlTimestampColumn satisfies ColumnHelperForStrict<SqlTimestampDescriptor>;\n"],"mappings":";;;;;;AAQA,MAAa,oBAAoB;AACjC,MAAa,uBAAuB;AACpC,MAAa,mBAAmB;AAChC,MAAa,qBAAqB;AAClC,MAAa,oBAAoB;AACjC,MAAa,yBAAyB;AAEtC,MAAa,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uBAAuB,SACvB,QACA,WACF"}
|
|
1
|
+
{"version":3,"file":"ast.mjs","names":["arktype"],"sources":["../../src/ast/json-value-projection.ts","../../src/ast/sql-codec-helpers.ts","../../src/ast/sql-codecs.ts"],"sourcesContent":["import { type CodecRef, frozenCodecRef } from './codec-types';\nimport type {\n AnyParamRef,\n ColumnRef,\n ExpressionFolder,\n ExpressionRewriter,\n ProjectionExpr,\n} from './types';\n\nabstract class JsonValueProjection {\n abstract readonly kind: string;\n readonly value: ProjectionExpr;\n\n protected constructor(value: ProjectionExpr) {\n this.value = value;\n }\n\n abstract accept<R>(visitor: JsonValueProjectionVisitor<R>): R;\n abstract rewrite(rewriter: ExpressionRewriter): AnyJsonValueProjection;\n\n fold<T>(folder: ExpressionFolder<T>): T {\n return this.value.fold(folder);\n }\n\n collectColumnRefs(): ColumnRef[] {\n return this.value.collectColumnRefs();\n }\n\n collectParamRefs(): AnyParamRef[] {\n return this.value.collectParamRefs();\n }\n\n protected freeze(): void {\n Object.freeze(this);\n }\n}\n\nexport interface JsonValueProjectionVisitor<R> {\n codec(projection: CodecJsonValueProjection): R;\n native(projection: NativeJsonValueProjection): R;\n document(projection: JsonDocumentProjection): R;\n}\n\nexport class CodecJsonValueProjection extends JsonValueProjection {\n readonly kind = 'codec' as const;\n readonly codec: CodecRef;\n\n constructor(value: ProjectionExpr, codec: CodecRef) {\n super(value);\n this.codec = frozenCodecRef(codec);\n this.freeze();\n }\n\n override accept<R>(visitor: JsonValueProjectionVisitor<R>): R {\n return visitor.codec(this);\n }\n\n override rewrite(rewriter: ExpressionRewriter): CodecJsonValueProjection {\n return new CodecJsonValueProjection(this.value.rewrite(rewriter), this.codec);\n }\n}\n\nexport class NativeJsonValueProjection extends JsonValueProjection {\n readonly kind = 'native' as const;\n\n constructor(value: ProjectionExpr) {\n super(value);\n this.freeze();\n }\n\n override accept<R>(visitor: JsonValueProjectionVisitor<R>): R {\n return visitor.native(this);\n }\n\n override rewrite(rewriter: ExpressionRewriter): NativeJsonValueProjection {\n return new NativeJsonValueProjection(this.value.rewrite(rewriter));\n }\n}\n\nexport class JsonDocumentProjection extends JsonValueProjection {\n readonly kind = 'document' as const;\n\n constructor(value: ProjectionExpr) {\n super(value);\n this.freeze();\n }\n\n override accept<R>(visitor: JsonValueProjectionVisitor<R>): R {\n return visitor.document(this);\n }\n\n override rewrite(rewriter: ExpressionRewriter): JsonDocumentProjection {\n return new JsonDocumentProjection(this.value.rewrite(rewriter));\n }\n}\n\nexport type AnyJsonValueProjection =\n | CodecJsonValueProjection\n | NativeJsonValueProjection\n | JsonDocumentProjection;\n","/**\n * Shared encode/decode/render constants and codec id literals for the six SQL base codecs (`sql/char@1`, `sql/varchar@1`, `sql/int@1`, `sql/float@1`, `sql/text@1`, `sql/timestamp@1`).\n *\n * The codec implementations live in `sql-codecs.ts` (TML-2357). This module retains only the conversion helpers + emit-path renderers the codec methods compose with — keeping a single source of truth for non-trivial conversions while the codec methods provide the framework-required `Promise<…>` boundary.\n */\n\nimport type { JsonValue } from '@prisma-next/contract/types';\nimport { structuredError } from '@prisma-next/utils/structured-error';\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\nexport const sqlCharEncode = (value: string): string => value;\nexport const sqlCharDecode = (wire: string): string => wire.trimEnd();\nexport const sqlCharRenderOutputType = (typeParams: { readonly length?: number }) => {\n const length = typeParams.length;\n if (length === undefined) return undefined;\n if (typeof length !== 'number' || !Number.isFinite(length) || !Number.isInteger(length)) {\n throw structuredError(\n 'RUNTIME.TYPE_PARAMS_INVALID',\n `renderOutputType: expected integer \"length\" in typeParams for Char, got ${String(length)}`,\n { meta: { codec: SQL_CHAR_CODEC_ID, param: 'length', received: String(length) } },\n );\n }\n return `Char<${length}>`;\n};\n\nexport const sqlVarcharEncode = (value: string): string => value;\nexport const sqlVarcharDecode = (wire: string): string => wire;\nexport const sqlVarcharRenderOutputType = (typeParams: { readonly length?: number }) => {\n const length = typeParams.length;\n if (length === undefined) return undefined;\n if (typeof length !== 'number' || !Number.isFinite(length) || !Number.isInteger(length)) {\n throw structuredError(\n 'RUNTIME.TYPE_PARAMS_INVALID',\n `renderOutputType: expected integer \"length\" in typeParams for Varchar, got ${String(length)}`,\n { meta: { codec: SQL_VARCHAR_CODEC_ID, param: 'length', received: String(length) } },\n );\n }\n return `Varchar<${length}>`;\n};\n\nexport const sqlIntEncode = (value: number): number => value;\nexport const sqlIntDecode = (wire: number): number => wire;\n\nexport const sqlFloatEncode = (value: number): number => value;\nexport const sqlFloatDecode = (wire: number): number => wire;\n\nexport const sqlTextEncode = (value: string): string => value;\nexport const sqlTextDecode = (wire: string): string => wire;\n\nexport const sqlTimestampEncode = (value: Date): Date => value;\nexport const sqlTimestampDecode = (wire: Date): Date => wire;\nexport const sqlTimestampEncodeJson = (value: Date): JsonValue => value.toISOString();\nexport const sqlTimestampDecodeJson = (json: JsonValue): Date => {\n if (typeof json !== 'string') {\n throw structuredError(\n 'RUNTIME.DECODE_FAILED',\n `Expected ISO date string for sql/timestamp@1, got ${typeof json}`,\n { meta: { codec: SQL_TIMESTAMP_CODEC_ID } },\n );\n }\n const date = new Date(json);\n if (Number.isNaN(date.getTime())) {\n throw structuredError(\n 'RUNTIME.DECODE_FAILED',\n `Invalid ISO date string for sql/timestamp@1: ${json}`,\n { meta: { codec: SQL_TIMESTAMP_CODEC_ID } },\n );\n }\n return date;\n};\nexport const sqlTimestampRenderOutputType = (typeParams: { readonly precision?: number }) => {\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 structuredError(\n 'RUNTIME.TYPE_PARAMS_INVALID',\n `renderOutputType: expected integer \"precision\" in typeParams for Timestamp, got ${String(precision)}`,\n { meta: { codec: SQL_TIMESTAMP_CODEC_ID, param: 'precision', received: String(precision) } },\n );\n }\n return `Timestamp<${precision}>`;\n};\n","/**\n * The six SQL base codecs (TML-2357).\n *\n * Each codec ships as three artifacts:\n *\n * 1. A `SqlXCodec` class extending {@link CodecImpl} that wraps the module-level encode/decode constants exported from `sql-codec-helpers.ts` (the single source of truth for runtime behaviour). 2. A `SqlXDescriptor` class extending {@link CodecDescriptorImpl} declaring the codec id, traits, target types, params schema, and (where applicable) the emit-path `renderOutputType`. 3. A per-codec column helper (`sqlXColumn`)\n * that calls `descriptor.factory(...)` directly and packages the result into a {@link ColumnSpec} via the framework {@link column} packager. The helper is tied to its descriptor with `satisfies ColumnHelperFor`.\n *\n * After TML-2357 this file is the canonical source of SQL base codec metadata and runtime behaviour — the legacy `mkCodec` / `defineCodec` carriers retired with the deletion sweep.\n */\n\nimport type { JsonValue } from '@prisma-next/contract/types';\nimport {\n type CodecCallContext,\n CodecDescriptorImpl,\n CodecImpl,\n type CodecInstanceContext,\n type ColumnHelperFor,\n type ColumnHelperForStrict,\n column,\n voidParamsSchema,\n} from '@prisma-next/framework-components/codec';\nimport type { StandardSchemaV1 } from '@standard-schema/spec';\nimport { type as arktype } from 'arktype';\nimport {\n SQL_CHAR_CODEC_ID,\n SQL_FLOAT_CODEC_ID,\n SQL_INT_CODEC_ID,\n SQL_TEXT_CODEC_ID,\n SQL_TIMESTAMP_CODEC_ID,\n SQL_VARCHAR_CODEC_ID,\n sqlCharDecode,\n sqlCharEncode,\n sqlCharRenderOutputType,\n sqlFloatDecode,\n sqlFloatEncode,\n sqlIntDecode,\n sqlIntEncode,\n sqlTextDecode,\n sqlTextEncode,\n sqlTimestampDecode,\n sqlTimestampDecodeJson,\n sqlTimestampEncode,\n sqlTimestampEncodeJson,\n sqlTimestampRenderOutputType,\n sqlVarcharDecode,\n sqlVarcharEncode,\n sqlVarcharRenderOutputType,\n} from './sql-codec-helpers';\n\ntype LengthParams = { readonly length?: number };\ntype PrecisionParams = { readonly precision?: number };\n\nconst lengthParamsSchema = arktype({\n 'length?': 'number.integer > 0',\n}) satisfies StandardSchemaV1<LengthParams>;\n\nconst precisionParamsSchema = arktype({\n 'precision?': 'number.integer >= 0 & number.integer <= 6',\n}) satisfies StandardSchemaV1<PrecisionParams>;\n\nexport class SqlTextCodec extends CodecImpl<\n typeof SQL_TEXT_CODEC_ID,\n readonly ['equality', 'order', 'textual'],\n string,\n string\n> {\n async encode(value: string, _ctx: CodecCallContext): Promise<string> {\n return sqlTextEncode(value);\n }\n async decode(wire: string, _ctx: CodecCallContext): Promise<string> {\n return sqlTextDecode(wire);\n }\n encodeJson(value: string): JsonValue {\n return value;\n }\n decodeJson(json: JsonValue): string {\n return json as string;\n }\n}\n\nexport class SqlTextDescriptor extends CodecDescriptorImpl<void> {\n override readonly codecId = SQL_TEXT_CODEC_ID;\n override readonly traits = ['equality', 'order', 'textual'] as const;\n override readonly targetTypes = ['text'] as const;\n override readonly paramsSchema: StandardSchemaV1<void> = voidParamsSchema;\n override factory(): (ctx: CodecInstanceContext) => SqlTextCodec {\n return () => new SqlTextCodec(this);\n }\n}\n\nexport const sqlTextDescriptor = new SqlTextDescriptor();\n\nexport const sqlTextColumn = () =>\n column(sqlTextDescriptor.factory(), sqlTextDescriptor.codecId, undefined, 'text');\n\nsqlTextColumn satisfies ColumnHelperFor<SqlTextDescriptor>;\nsqlTextColumn satisfies ColumnHelperForStrict<SqlTextDescriptor>;\n\nexport class SqlIntCodec extends CodecImpl<\n typeof SQL_INT_CODEC_ID,\n readonly ['equality', 'order', 'numeric'],\n number,\n number\n> {\n async encode(value: number, _ctx: CodecCallContext): Promise<number> {\n return sqlIntEncode(value);\n }\n async decode(wire: number, _ctx: CodecCallContext): Promise<number> {\n return sqlIntDecode(wire);\n }\n encodeJson(value: number): JsonValue {\n return value;\n }\n decodeJson(json: JsonValue): number {\n return json as number;\n }\n}\n\nexport class SqlIntDescriptor extends CodecDescriptorImpl<void> {\n override readonly codecId = SQL_INT_CODEC_ID;\n override readonly traits = ['equality', 'order', 'numeric'] as const;\n override readonly targetTypes = ['int'] as const;\n override readonly paramsSchema: StandardSchemaV1<void> = voidParamsSchema;\n override factory(): (ctx: CodecInstanceContext) => SqlIntCodec {\n return () => new SqlIntCodec(this);\n }\n}\n\nexport const sqlIntDescriptor = new SqlIntDescriptor();\n\nexport const sqlIntColumn = () =>\n column(sqlIntDescriptor.factory(), sqlIntDescriptor.codecId, undefined, 'int');\n\nsqlIntColumn satisfies ColumnHelperFor<SqlIntDescriptor>;\nsqlIntColumn satisfies ColumnHelperForStrict<SqlIntDescriptor>;\n\nexport class SqlFloatCodec extends CodecImpl<\n typeof SQL_FLOAT_CODEC_ID,\n readonly ['equality', 'order', 'numeric'],\n number,\n number\n> {\n async encode(value: number, _ctx: CodecCallContext): Promise<number> {\n return sqlFloatEncode(value);\n }\n async decode(wire: number, _ctx: CodecCallContext): Promise<number> {\n return sqlFloatDecode(wire);\n }\n encodeJson(value: number): JsonValue {\n return value;\n }\n decodeJson(json: JsonValue): number {\n return json as number;\n }\n}\n\nexport class SqlFloatDescriptor extends CodecDescriptorImpl<void> {\n override readonly codecId = SQL_FLOAT_CODEC_ID;\n override readonly traits = ['equality', 'order', 'numeric'] as const;\n override readonly targetTypes = ['float'] as const;\n override readonly paramsSchema: StandardSchemaV1<void> = voidParamsSchema;\n override factory(): (ctx: CodecInstanceContext) => SqlFloatCodec {\n return () => new SqlFloatCodec(this);\n }\n}\n\nexport const sqlFloatDescriptor = new SqlFloatDescriptor();\n\nexport const sqlFloatColumn = () =>\n column(sqlFloatDescriptor.factory(), sqlFloatDescriptor.codecId, undefined, 'float');\n\nsqlFloatColumn satisfies ColumnHelperFor<SqlFloatDescriptor>;\nsqlFloatColumn satisfies ColumnHelperForStrict<SqlFloatDescriptor>;\n\nexport class SqlCharCodec extends CodecImpl<\n typeof SQL_CHAR_CODEC_ID,\n readonly ['equality', 'order', 'textual'],\n string,\n string\n> {\n async encode(value: string, _ctx: CodecCallContext): Promise<string> {\n return sqlCharEncode(value);\n }\n async decode(wire: string, _ctx: CodecCallContext): Promise<string> {\n return sqlCharDecode(wire);\n }\n encodeJson(value: string): JsonValue {\n return value;\n }\n decodeJson(json: JsonValue): string {\n return json as string;\n }\n}\n\nexport class SqlCharDescriptor extends CodecDescriptorImpl<LengthParams> {\n override readonly codecId = SQL_CHAR_CODEC_ID;\n override readonly traits = ['equality', 'order', 'textual'] as const;\n override readonly targetTypes = ['char'] as const;\n override readonly paramsSchema: StandardSchemaV1<LengthParams> = lengthParamsSchema;\n override renderOutputType(params: LengthParams): string | undefined {\n return sqlCharRenderOutputType(params);\n }\n override factory(_params: LengthParams): (ctx: CodecInstanceContext) => SqlCharCodec {\n return () => new SqlCharCodec(this);\n }\n}\n\nexport const sqlCharDescriptor = new SqlCharDescriptor();\n\nexport const sqlCharColumn = (params: LengthParams = {}) =>\n column(sqlCharDescriptor.factory(params), sqlCharDescriptor.codecId, params, 'char');\n\nsqlCharColumn satisfies ColumnHelperFor<SqlCharDescriptor>;\nsqlCharColumn satisfies ColumnHelperForStrict<SqlCharDescriptor>;\n\nexport class SqlVarcharCodec extends CodecImpl<\n typeof SQL_VARCHAR_CODEC_ID,\n readonly ['equality', 'order', 'textual'],\n string,\n string\n> {\n async encode(value: string, _ctx: CodecCallContext): Promise<string> {\n return sqlVarcharEncode(value);\n }\n async decode(wire: string, _ctx: CodecCallContext): Promise<string> {\n return sqlVarcharDecode(wire);\n }\n encodeJson(value: string): JsonValue {\n return value;\n }\n decodeJson(json: JsonValue): string {\n return json as string;\n }\n}\n\nexport class SqlVarcharDescriptor extends CodecDescriptorImpl<LengthParams> {\n override readonly codecId = SQL_VARCHAR_CODEC_ID;\n override readonly traits = ['equality', 'order', 'textual'] as const;\n override readonly targetTypes = ['varchar'] as const;\n override readonly paramsSchema: StandardSchemaV1<LengthParams> = lengthParamsSchema;\n override renderOutputType(params: LengthParams): string | undefined {\n return sqlVarcharRenderOutputType(params);\n }\n override factory(_params: LengthParams): (ctx: CodecInstanceContext) => SqlVarcharCodec {\n return () => new SqlVarcharCodec(this);\n }\n}\n\nexport const sqlVarcharDescriptor = new SqlVarcharDescriptor();\n\nexport const sqlVarcharColumn = (params: LengthParams = {}) =>\n column(sqlVarcharDescriptor.factory(params), sqlVarcharDescriptor.codecId, params, 'varchar');\n\nsqlVarcharColumn satisfies ColumnHelperFor<SqlVarcharDescriptor>;\nsqlVarcharColumn satisfies ColumnHelperForStrict<SqlVarcharDescriptor>;\n\nexport class SqlTimestampCodec extends CodecImpl<\n typeof SQL_TIMESTAMP_CODEC_ID,\n readonly ['equality', 'order'],\n Date,\n Date\n> {\n async encode(value: Date, _ctx: CodecCallContext): Promise<Date> {\n return sqlTimestampEncode(value);\n }\n async decode(wire: Date, _ctx: CodecCallContext): Promise<Date> {\n return sqlTimestampDecode(wire);\n }\n encodeJson(value: Date): JsonValue {\n return sqlTimestampEncodeJson(value);\n }\n decodeJson(json: JsonValue): Date {\n return sqlTimestampDecodeJson(json);\n }\n}\n\nexport class SqlTimestampDescriptor extends CodecDescriptorImpl<PrecisionParams> {\n override readonly codecId = SQL_TIMESTAMP_CODEC_ID;\n override readonly traits = ['equality', 'order'] as const;\n override readonly targetTypes = ['timestamp'] as const;\n override readonly paramsSchema: StandardSchemaV1<PrecisionParams> = precisionParamsSchema;\n override renderOutputType(params: PrecisionParams): string | undefined {\n return sqlTimestampRenderOutputType(params);\n }\n override factory(_params: PrecisionParams): (ctx: CodecInstanceContext) => SqlTimestampCodec {\n return () => new SqlTimestampCodec(this);\n }\n}\n\nexport const sqlTimestampDescriptor = new SqlTimestampDescriptor();\n\nexport const sqlTimestampColumn = (params: PrecisionParams = {}) =>\n column(\n sqlTimestampDescriptor.factory(params),\n sqlTimestampDescriptor.codecId,\n params,\n 'timestamp',\n );\n\nsqlTimestampColumn satisfies Col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AuC;EAC9D,OAAO,mBAAmB,IAAI;CAChC;CACA,WAAW,OAAwB;EACjC,OAAO,uBAAuB,KAAK;CACrC;CACA,WAAW,MAAuB;EAChC,OAAO,uBAAuB,IAAI;CACpC;AACF;AAEA,IAAa,yBAAb,cAA4C,oBAAqC;CAC/E,UAA4B;CAC5B,SAA2B,CAAC,YAAY,OAAO;CAC/C,cAAgC,CAAC,WAAW;CAC5C,eAAoE;CACpE,iBAA0B,QAA6C;EACrE,OAAO,6BAA6B,MAAM;CAC5C;CACA,QAAiB,SAA4E;EAC3F,aAAa,IAAI,kBAAkB,IAAI;CACzC;AACF;AAEA,MAAa,yBAAyB,IAAI,uBAAuB;AAEjE,MAAa,sBAAsB,SAA0B,CAAC,MAC5D,OACE,uBAAuB,QAAQ,MAAM,GACrC,uBAAuB,SACvB,QACA,WACF"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { t as AnyCodecDescriptor } from "../codec-types-
|
|
2
|
-
import { n as CodecDescriptorRegistry } from "../query-lane-context-
|
|
1
|
+
import { t as AnyCodecDescriptor } from "../codec-types-Bayoa4PI.mjs";
|
|
2
|
+
import { n as CodecDescriptorRegistry } from "../query-lane-context-DTCOHMXn.mjs";
|
|
3
3
|
import { CodecRef } from "@prisma-next/framework-components/codec";
|
|
4
4
|
import { SqlStorage } from "@prisma-next/sql-contract/types";
|
|
5
5
|
//#region src/codec-descriptor-registry.d.ts
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"codec-descriptor-registry.d.mts","names":[],"sources":["../../src/codec-descriptor-registry.ts","../../src/codec-ref-for-column.ts"],"mappings":";;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"codec-descriptor-registry.d.mts","names":[],"sources":["../../src/codec-descriptor-registry.ts","../../src/codec-ref-for-column.ts"],"mappings":";;;;;;;;;;;;;;;iBAiBgB,6BACd,gBAAgB,cAAc,qBAC9B,UAAU,aACT;;;;;;;;;;;;;;;;;;iBCCa,yBACd,SAAS,YACT,qBACA,mBACA,qBACC"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { structuredError } from "@prisma-next/utils/structured-error";
|
|
1
2
|
import { resolveStorageTable } from "@prisma-next/sql-contract/resolve-storage-table";
|
|
2
3
|
import { isStorageTypeInstance } from "@prisma-next/sql-contract/types";
|
|
3
4
|
import { blindCast } from "@prisma-next/utils/casts";
|
|
@@ -66,7 +67,7 @@ function buildCodecDescriptorRegistry(allDescriptors, storage) {
|
|
|
66
67
|
const byId = /* @__PURE__ */ new Map();
|
|
67
68
|
const byTargetType = /* @__PURE__ */ new Map();
|
|
68
69
|
for (const descriptor of allDescriptors) {
|
|
69
|
-
if (byId.has(descriptor.codecId)) throw
|
|
70
|
+
if (byId.has(descriptor.codecId)) throw structuredError("RUNTIME.DUPLICATE_CODEC", `Duplicate codec descriptor id: '${descriptor.codecId}' — registered twice during registry construction. Each codecId must be contributed by exactly one component (target / adapter / extension pack).`, { meta: { codecId: descriptor.codecId } });
|
|
70
71
|
const widened = descriptor;
|
|
71
72
|
byId.set(descriptor.codecId, widened);
|
|
72
73
|
for (const targetType of descriptor.targetTypes) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"codec-descriptor-registry.mjs","names":[],"sources":["../../src/codec-ref-for-column.ts","../../src/codec-descriptor-registry.ts"],"sourcesContent":["import type { JsonValue } from '@prisma-next/contract/types';\nimport type { CodecRef } from '@prisma-next/framework-components/codec';\nimport { resolveStorageTable } from '@prisma-next/sql-contract/resolve-storage-table';\nimport { isStorageTypeInstance, type SqlStorage } from '@prisma-next/sql-contract/types';\nimport { blindCast } from '@prisma-next/utils/casts';\n\n/**\n * Derive the canonical {@link CodecRef} for a `(table, column)` pair against a {@link SqlStorage}. This is the build-time path every column-bound `ParamRef` / `ProjectionItem` uses to stamp its `codec` slot before the AST is handed to the runtime — the runtime resolver then materialises a memoised {@link import('@prisma-next/sql-relational-core/ast').Codec} for the same `CodecRef` via `forCodecRef`.\n *\n * Resolution rules over namespace `entries.table[table].columns[column]`:\n *\n * - `typeRef` column → `{codecId, typeParams}` from `storage.types[typeRef]` (multiple columns sharing the typeRef share one ref → one memoised codec).\n * - inline `typeParams` column → `{codecId, typeParams}` from the column itself.\n * - non-parameterized column → `{codecId}` with `typeParams` undefined.\n *\n * Returns `undefined` when the table or column is unknown, or when a `typeRef` column references a `storage.types` entry that does not exist.\n *\n * `namespaceId` leads the coordinate args and is always supplied: every\n * model/table sits in an explicit namespace, so the table is resolved strictly\n * within that namespace (see {@link resolveStorageTable}).\n */\nexport function codecRefForStorageColumn(\n storage: SqlStorage,\n namespaceId: string,\n tableName: string,\n columnName: string,\n): CodecRef | undefined {\n const resolved = resolveStorageTable(storage, tableName, namespaceId);\n if (resolved === undefined) return undefined;\n const tableDef = resolved.table;\n const columnDef = tableDef.columns[columnName];\n if (!columnDef) return undefined;\n if (columnDef.typeRef !== undefined) {\n const instance = storage.types?.[columnDef.typeRef];\n if (!instance) return undefined;\n if (isStorageTypeInstance(instance)) {\n const instanceParams = instance.typeParams;\n const hasParamKeys = instanceParams !== undefined && Object.keys(instanceParams).length > 0;\n return hasParamKeys\n ? { codecId: instance.codecId, typeParams: instanceParams as JsonValue }\n : { codecId: instance.codecId };\n }\n return undefined;\n }\n if (columnDef.typeParams !== undefined && Object.keys(columnDef.typeParams).length > 0) {\n const typeParams = blindCast<\n JsonValue,\n 'column typeParams is a validated contract record; its values are JSON-serialisable'\n >(columnDef.typeParams);\n return columnDef.many\n ? { codecId: columnDef.codecId, typeParams, many: true }\n : { codecId: columnDef.codecId, typeParams };\n }\n return columnDef.many\n ? { codecId: columnDef.codecId, many: true }\n : { codecId: columnDef.codecId };\n}\n","import type { CodecDescriptor, CodecRef } from '@prisma-next/framework-components/codec';\nimport type { SqlStorage } from '@prisma-next/sql-contract/types';\nimport type { AnyCodecDescriptor } from './ast/codec-types';\nimport { codecRefForStorageColumn } from './codec-ref-for-column';\nimport type { CodecDescriptorRegistry } from './query-lane-context';\n\n/**\n * Build a {@link CodecDescriptorRegistry} from a flat descriptor list.\n *\n * Used by:\n * - Each codec-shipping package's `core/registry.ts` to expose a package-scoped registry as the public consumer surface (replacing raw descriptor-array exports). See ADR 208.\n * - The runtime's `buildExecutionContext` to construct the contract-bound combined registry from every contributor's `codecs:` slot.\n *\n * The descriptor map is heterogeneous in `P` — each codec id has its own params shape. The public {@link CodecDescriptorRegistry} interface widens to `CodecDescriptor<unknown>` and consumers narrow per codec id at the call site (the descriptor's `paramsSchema` validates JSON-sourced params before the factory ever sees them, so the runtime narrow is safe). The cast at registration goes through `unknown` because\n * `CodecDescriptor<P>` is invariant in `P` (the `factory` and `renderOutputType` slots use `P` contravariantly).\n */\nexport function buildCodecDescriptorRegistry(\n allDescriptors: ReadonlyArray<AnyCodecDescriptor>,\n storage?: SqlStorage,\n): CodecDescriptorRegistry {\n type AnyDescriptor = CodecDescriptor<unknown>;\n const byId = new Map<string, AnyDescriptor>();\n const byTargetType = new Map<string, Array<AnyDescriptor>>();\n\n for (const descriptor of allDescriptors) {\n if (byId.has(descriptor.codecId)) {\n throw
|
|
1
|
+
{"version":3,"file":"codec-descriptor-registry.mjs","names":[],"sources":["../../src/codec-ref-for-column.ts","../../src/codec-descriptor-registry.ts"],"sourcesContent":["import type { JsonValue } from '@prisma-next/contract/types';\nimport type { CodecRef } from '@prisma-next/framework-components/codec';\nimport { resolveStorageTable } from '@prisma-next/sql-contract/resolve-storage-table';\nimport { isStorageTypeInstance, type SqlStorage } from '@prisma-next/sql-contract/types';\nimport { blindCast } from '@prisma-next/utils/casts';\n\n/**\n * Derive the canonical {@link CodecRef} for a `(table, column)` pair against a {@link SqlStorage}. This is the build-time path every column-bound `ParamRef` / `ProjectionItem` uses to stamp its `codec` slot before the AST is handed to the runtime — the runtime resolver then materialises a memoised {@link import('@prisma-next/sql-relational-core/ast').Codec} for the same `CodecRef` via `forCodecRef`.\n *\n * Resolution rules over namespace `entries.table[table].columns[column]`:\n *\n * - `typeRef` column → `{codecId, typeParams}` from `storage.types[typeRef]` (multiple columns sharing the typeRef share one ref → one memoised codec).\n * - inline `typeParams` column → `{codecId, typeParams}` from the column itself.\n * - non-parameterized column → `{codecId}` with `typeParams` undefined.\n *\n * Returns `undefined` when the table or column is unknown, or when a `typeRef` column references a `storage.types` entry that does not exist.\n *\n * `namespaceId` leads the coordinate args and is always supplied: every\n * model/table sits in an explicit namespace, so the table is resolved strictly\n * within that namespace (see {@link resolveStorageTable}).\n */\nexport function codecRefForStorageColumn(\n storage: SqlStorage,\n namespaceId: string,\n tableName: string,\n columnName: string,\n): CodecRef | undefined {\n const resolved = resolveStorageTable(storage, tableName, namespaceId);\n if (resolved === undefined) return undefined;\n const tableDef = resolved.table;\n const columnDef = tableDef.columns[columnName];\n if (!columnDef) return undefined;\n if (columnDef.typeRef !== undefined) {\n const instance = storage.types?.[columnDef.typeRef];\n if (!instance) return undefined;\n if (isStorageTypeInstance(instance)) {\n const instanceParams = instance.typeParams;\n const hasParamKeys = instanceParams !== undefined && Object.keys(instanceParams).length > 0;\n return hasParamKeys\n ? { codecId: instance.codecId, typeParams: instanceParams as JsonValue }\n : { codecId: instance.codecId };\n }\n return undefined;\n }\n if (columnDef.typeParams !== undefined && Object.keys(columnDef.typeParams).length > 0) {\n const typeParams = blindCast<\n JsonValue,\n 'column typeParams is a validated contract record; its values are JSON-serialisable'\n >(columnDef.typeParams);\n return columnDef.many\n ? { codecId: columnDef.codecId, typeParams, many: true }\n : { codecId: columnDef.codecId, typeParams };\n }\n return columnDef.many\n ? { codecId: columnDef.codecId, many: true }\n : { codecId: columnDef.codecId };\n}\n","import type { CodecDescriptor, CodecRef } from '@prisma-next/framework-components/codec';\nimport type { SqlStorage } from '@prisma-next/sql-contract/types';\nimport { structuredError } from '@prisma-next/utils/structured-error';\nimport type { AnyCodecDescriptor } from './ast/codec-types';\nimport { codecRefForStorageColumn } from './codec-ref-for-column';\nimport type { CodecDescriptorRegistry } from './query-lane-context';\n\n/**\n * Build a {@link CodecDescriptorRegistry} from a flat descriptor list.\n *\n * Used by:\n * - Each codec-shipping package's `core/registry.ts` to expose a package-scoped registry as the public consumer surface (replacing raw descriptor-array exports). See ADR 208.\n * - The runtime's `buildExecutionContext` to construct the contract-bound combined registry from every contributor's `codecs:` slot.\n *\n * The descriptor map is heterogeneous in `P` — each codec id has its own params shape. The public {@link CodecDescriptorRegistry} interface widens to `CodecDescriptor<unknown>` and consumers narrow per codec id at the call site (the descriptor's `paramsSchema` validates JSON-sourced params before the factory ever sees them, so the runtime narrow is safe). The cast at registration goes through `unknown` because\n * `CodecDescriptor<P>` is invariant in `P` (the `factory` and `renderOutputType` slots use `P` contravariantly).\n */\nexport function buildCodecDescriptorRegistry(\n allDescriptors: ReadonlyArray<AnyCodecDescriptor>,\n storage?: SqlStorage,\n): CodecDescriptorRegistry {\n type AnyDescriptor = CodecDescriptor<unknown>;\n const byId = new Map<string, AnyDescriptor>();\n const byTargetType = new Map<string, Array<AnyDescriptor>>();\n\n for (const descriptor of allDescriptors) {\n if (byId.has(descriptor.codecId)) {\n throw structuredError(\n 'RUNTIME.DUPLICATE_CODEC',\n `Duplicate codec descriptor id: '${descriptor.codecId}' — registered twice during registry construction. ` +\n 'Each codecId must be contributed by exactly one component (target / adapter / extension pack).',\n { meta: { codecId: descriptor.codecId } },\n );\n }\n const widened = descriptor as unknown as AnyDescriptor;\n byId.set(descriptor.codecId, widened);\n for (const targetType of descriptor.targetTypes) {\n const list = byTargetType.get(targetType);\n if (list) {\n list.push(widened);\n } else {\n byTargetType.set(targetType, [widened]);\n }\n }\n }\n\n return {\n descriptorFor(codecId: string): AnyDescriptor | undefined {\n return byId.get(codecId);\n },\n codecRefForColumn(namespaceId: string, table: string, column: string): CodecRef | undefined {\n if (!storage) return undefined;\n return codecRefForStorageColumn(storage, namespaceId, table, column);\n },\n *values(): IterableIterator<AnyDescriptor> {\n yield* byId.values();\n },\n byTargetType(targetType: string): readonly AnyDescriptor[] {\n return byTargetType.get(targetType) ?? Object.freeze([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WAAW,SAAS,OAAO;EACpC,KAAK,MAAM,cAAc,WAAW,aAAa;GAC/C,MAAM,OAAO,aAAa,IAAI,UAAU;GACxC,IAAI,MACF,KAAK,KAAK,OAAO;QAEjB,aAAa,IAAI,YAAY,CAAC,OAAO,CAAC;EAE1C;CACF;CAEA,OAAO;EACL,cAAc,SAA4C;GACxD,OAAO,KAAK,IAAI,OAAO;EACzB;EACA,kBAAkB,aAAqB,OAAe,QAAsC;GAC1F,IAAI,CAAC,SAAS,OAAO,KAAA;GACrB,OAAO,yBAAyB,SAAS,aAAa,OAAO,MAAM;EACrE;EACA,CAAC,SAA0C;GACzC,OAAO,KAAK,OAAO;EACrB;EACA,aAAa,YAA8C;GACzD,OAAO,aAAa,IAAI,UAAU,KAAK,OAAO,OAAO,CAAC,CAAC;EACzD;CACF;AACF"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { o as CodecRef } from "../codec-types-
|
|
2
|
-
import {
|
|
3
|
-
import { d as LiteralColumnDefault, f as PrimaryKeyConstraint, l as ForeignKeyConstraint, n as CheckExpressionConstraint, p as UniqueConstraint, r as DdlColumn, t as AnyDdlColumnDefault, u as FunctionColumnDefault } from "../ddl-types-
|
|
1
|
+
import { o as CodecRef } from "../codec-types-Bayoa4PI.mjs";
|
|
2
|
+
import { $ as OrderByItem, I as InsertAst, dt as TableSource, o as AnyExpression, pt as UpdateAst, rt as ProjectionItem, s as AnyFromSource, st as SelectAst, y as ColumnRef, z as JoinAst } from "../types-CWlaErjN.mjs";
|
|
3
|
+
import { d as LiteralColumnDefault, f as PrimaryKeyConstraint, l as ForeignKeyConstraint, n as CheckExpressionConstraint, p as UniqueConstraint, r as DdlColumn, t as AnyDdlColumnDefault, u as FunctionColumnDefault } from "../ddl-types-B3SfjPGI.mjs";
|
|
4
4
|
import { ColumnDefaultLiteralInputValue } from "@prisma-next/contract/types";
|
|
5
5
|
import { ReferentialAction } from "@prisma-next/sql-contract/types";
|
|
6
6
|
import { ParamSpec } from "@prisma-next/operations";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contract-free.d.mts","names":[],"sources":["../../src/contract-free/column.ts","../../src/contract-free/table.ts"],"mappings":";;;;;;;UAciB;WACN;WACA;WACA,UAAU;WACV,WAAW;;iBAGN,IAAI,OAAO,iCAAiC;iBAI5C,GAAG,qBAAqB;iBAIxB,IAAI,cAAc,cAAc,UAAU,mBAAmB;iBAI7D,WACd,4BACA;WAAqB;IACpB;iBAIa,WACd,4BACA,kBACA,+BACA;WACW;WACA,WAAW;WACX,WAAW;IAErB;iBAIa,OACd,4BACA;WAAqB;IACpB;iBAIa,gBAAgB,cAAc,qBAAqB;;;
|
|
1
|
+
{"version":3,"file":"contract-free.d.mts","names":[],"sources":["../../src/contract-free/column.ts","../../src/contract-free/table.ts"],"mappings":";;;;;;;UAciB;WACN;WACA;WACA,UAAU;WACV,WAAW;;iBAGN,IAAI,OAAO,iCAAiC;iBAI5C,GAAG,qBAAqB;iBAIxB,IAAI,cAAc,cAAc,UAAU,mBAAmB;iBAI7D,WACd,4BACA;WAAqB;IACpB;iBAIa,WACd,4BACA,kBACA,+BACA;WACW;WACA,WAAW;WACX,WAAW;IAErB;iBAIa,OACd,4BACA;WAAqB;IACpB;iBAIa,gBAAgB,cAAc,qBAAqB;;;UC/BlD;WACN;WACA;;KAGC,eAAe,eAAe;;;;;;cAO7B;WACU,KAAK;cAAL,KAAK;EAE1B,IAAI,OAAO,SAAS;EAIpB,GAAG,OAAO,SAAS;EAInB,OAAO;EAIP,UAAU;EAIV,aAAa;EAIb,MAAM,mCAAmC;EAIzC,MAAM,mCAAmC;EAIzC,QAAQ,gBAAgB,kBAAkB;EAI1C,OAAO,OAAO,SAAS;;UAKR;WACN;WACA;WACA,MAAM;WACN,OAAO,cAAc;WACrB,SAAS;;cAGP;eACE;yCAG0B;+BAGV;wBAGT,kBAAoB;;;;;;;cAS5B,cAAc;+BAeC,eAAiB;eAG/B,cAAc,UAAU;;;;;;mBAQtB,S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YACb,UAAU,cAAc,YAAY,eAAe,WACxD,cAAc;EAQjB,aAAa,cAAc;;cAKhB,cAAc,eAAe;mBAErB;mBACA;mBACA;mBACA;mBACA;cAJA,KAAK,aACL,QAAQ,QACR,WAAW,eAAe,SAC1B,cAAc,cAAc,cAC5B,WAAW,eAAe;EAG7C,SAAS;;cAWE,cAAc,eAAe;mBAErB;mBACA;mBACA;mBACA;mBACA;cAJA,KAAK,aACL,QAAQ,QACR,YAAW,eAAe,qBAC1B,YAAW,oBACX,iBAAgB,cAAc;EAGjD,IAAI,QAAQ,eAAe,UAAU,cAAc;EAInD,MAAM,MAAM,SAAS,cAAc;EAInC,aAAa,SAAS,cAAc,eAAe,cAAc;EAUjE,SAAS;;cAQE;mBAEQ;mBACA;mBACA;mBACA;cAHA,KAAK,aACL,iBAAiB,cAAc,iBAC/B,YAAW,oBACX,eAAc,cAAc;EAG/C,MAAM,MAAM,SAAS;EAIrB,QAAQ,QAAQ,aAAa,uBAA8B;EAQ3D,SAAS;;;;;;;;;;;;;;;;;;;;;iBA0BK,MAAM,eAAe,cACnC,QAAQ,aACR,QAAQ,SACP,YAAY"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { C as LiteralExpr, D as OrExpr, E as OperationExpr, I as TableSource, L as UpdateAst, M as RawExpr, O as OrderByItem, P as SelectAst, T as NullCheckExpr, _ as InsertAst, g as IdentifierRef, j as ProjectionItem, k as ParamRef, n as AndExpr, o as ColumnRef, p as ExistsExpr, r as BinaryExpr, t as AggregateExpr, v as InsertOnConflict, y as JoinAst } from "../types-CINOak-F.mjs";
|
|
2
|
+
import { a as ForeignKeyConstraint, c as PrimaryKeyConstraint, l as UniqueConstraint, n as DdlColumn, o as FunctionColumnDefault, s as LiteralColumnDefault, t as CheckExpressionConstraint } from "../ddl-types-BUoa33yk.mjs";
|
|
3
|
+
import { structuredError } from "@prisma-next/utils/structured-error";
|
|
3
4
|
import { blindCast } from "@prisma-next/utils/casts";
|
|
4
5
|
//#region src/contract-free/column.ts
|
|
5
6
|
function lit(value) {
|
|
@@ -173,7 +174,7 @@ var CfExprSelectQuery = class CfExprSelectQuery {
|
|
|
173
174
|
return new CfExprSelectQuery(this.src, this.projectionItems, this.whereExpr, this.joinItems, value);
|
|
174
175
|
}
|
|
175
176
|
build() {
|
|
176
|
-
if (this.joinItems.length > 0 && this.src === void 0) throw
|
|
177
|
+
if (this.joinItems.length > 0 && this.src === void 0) throw structuredError("ORM.ARGUMENT_INVALID", "CfExprSelectQuery: cannot add a JOIN without a FROM clause");
|
|
177
178
|
const base = this.src !== void 0 ? SelectAst.from(this.src).withProjection(this.projectionItems) : SelectAst.noFrom().withProjection(this.projectionItems);
|
|
178
179
|
const withJoins = this.joinItems.length > 0 ? base.withJoins(this.joinItems) : base;
|
|
179
180
|
const withWhere = this.whereExpr !== void 0 ? withJoins.withWhere(this.whereExpr.ast) : withJoins;
|