@prisma-next/sql-relational-core 0.3.0-pr.93.5 → 0.3.0-pr.94.2

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.
Files changed (160) hide show
  1. package/dist/errors-BwxypN2Q.mjs +3 -0
  2. package/dist/errors-CLx1Ylq0.d.mts +2 -0
  3. package/dist/exports/ast.d.mts +123 -0
  4. package/dist/exports/ast.d.mts.map +1 -0
  5. package/dist/exports/ast.mjs +304 -0
  6. package/dist/exports/ast.mjs.map +1 -0
  7. package/dist/exports/errors.d.mts +2 -0
  8. package/dist/exports/errors.mjs +3 -0
  9. package/dist/exports/guards.d.mts +88 -0
  10. package/dist/exports/guards.d.mts.map +1 -0
  11. package/dist/exports/guards.mjs +3 -0
  12. package/dist/exports/operations-registry.d.mts +5 -0
  13. package/dist/exports/operations-registry.mjs +3 -0
  14. package/dist/exports/param.d.mts +5 -0
  15. package/dist/exports/param.mjs +3 -0
  16. package/dist/exports/plan.d.mts +2 -0
  17. package/dist/exports/plan.mjs +17 -0
  18. package/dist/exports/plan.mjs.map +1 -0
  19. package/dist/exports/query-lane-context.d.mts +2 -0
  20. package/dist/exports/query-lane-context.mjs +1 -0
  21. package/dist/exports/schema.d.mts +5 -0
  22. package/dist/exports/schema.mjs +4 -0
  23. package/dist/exports/types.d.mts +4 -0
  24. package/dist/exports/types.mjs +3 -0
  25. package/dist/guards-4T0IByJo.mjs +132 -0
  26. package/dist/guards-4T0IByJo.mjs.map +1 -0
  27. package/dist/index.d.mts +12 -0
  28. package/dist/index.mjs +12 -0
  29. package/dist/operations-registry-7R5KE2-5.mjs +152 -0
  30. package/dist/operations-registry-7R5KE2-5.mjs.map +1 -0
  31. package/dist/operations-registry-CIcn4f2P.d.mts +9 -0
  32. package/dist/operations-registry-CIcn4f2P.d.mts.map +1 -0
  33. package/dist/param-B4LzVPv2.d.mts +8 -0
  34. package/dist/param-B4LzVPv2.d.mts.map +1 -0
  35. package/dist/param-BFvNAaHR.mjs +14 -0
  36. package/dist/param-BFvNAaHR.mjs.map +1 -0
  37. package/dist/plan-9PvH-Tu3.d.mts +157 -0
  38. package/dist/plan-9PvH-Tu3.d.mts.map +1 -0
  39. package/dist/query-lane-context-wr_XXnB5.d.mts +143 -0
  40. package/dist/query-lane-context-wr_XXnB5.d.mts.map +1 -0
  41. package/dist/schema-BsY2EXAf.mjs +148 -0
  42. package/dist/schema-BsY2EXAf.mjs.map +1 -0
  43. package/dist/schema-Dse48uyP.d.mts +63 -0
  44. package/dist/schema-Dse48uyP.d.mts.map +1 -0
  45. package/dist/types-Bg2kUmUA.d.mts +359 -0
  46. package/dist/types-Bg2kUmUA.d.mts.map +1 -0
  47. package/dist/types-D_FRJvm0.mjs +18 -0
  48. package/dist/types-D_FRJvm0.mjs.map +1 -0
  49. package/package.json +28 -50
  50. package/src/ast/predicate.ts +3 -11
  51. package/src/ast/types.ts +23 -9
  52. package/src/exports/guards.ts +5 -0
  53. package/src/operations-registry.ts +112 -73
  54. package/src/schema.ts +40 -29
  55. package/src/types.ts +102 -52
  56. package/src/utils/guards.ts +88 -18
  57. package/dist/ast/adapter-types.d.ts +0 -28
  58. package/dist/ast/adapter-types.d.ts.map +0 -1
  59. package/dist/ast/codec-types.d.ts +0 -141
  60. package/dist/ast/codec-types.d.ts.map +0 -1
  61. package/dist/ast/common.d.ts +0 -7
  62. package/dist/ast/common.d.ts.map +0 -1
  63. package/dist/ast/delete.d.ts +0 -8
  64. package/dist/ast/delete.d.ts.map +0 -1
  65. package/dist/ast/driver-types.d.ts +0 -20
  66. package/dist/ast/driver-types.d.ts.map +0 -1
  67. package/dist/ast/insert.d.ts +0 -8
  68. package/dist/ast/insert.d.ts.map +0 -1
  69. package/dist/ast/join.d.ts +0 -6
  70. package/dist/ast/join.d.ts.map +0 -1
  71. package/dist/ast/order.d.ts +0 -6
  72. package/dist/ast/order.d.ts.map +0 -1
  73. package/dist/ast/predicate.d.ts +0 -4
  74. package/dist/ast/predicate.d.ts.map +0 -1
  75. package/dist/ast/select.d.ts +0 -18
  76. package/dist/ast/select.d.ts.map +0 -1
  77. package/dist/ast/types.d.ts +0 -118
  78. package/dist/ast/types.d.ts.map +0 -1
  79. package/dist/ast/update.d.ts +0 -9
  80. package/dist/ast/update.d.ts.map +0 -1
  81. package/dist/ast/util.d.ts +0 -2
  82. package/dist/ast/util.d.ts.map +0 -1
  83. package/dist/chunk-2F7DSEOU.js +0 -8
  84. package/dist/chunk-2F7DSEOU.js.map +0 -1
  85. package/dist/chunk-36WJWNHT.js +0 -1
  86. package/dist/chunk-36WJWNHT.js.map +0 -1
  87. package/dist/chunk-5N34PNVZ.js +0 -62
  88. package/dist/chunk-5N34PNVZ.js.map +0 -1
  89. package/dist/chunk-7I3EMQID.js +0 -16
  90. package/dist/chunk-7I3EMQID.js.map +0 -1
  91. package/dist/chunk-D4JLPIWO.js +0 -13
  92. package/dist/chunk-D4JLPIWO.js.map +0 -1
  93. package/dist/chunk-G52ENULI.js +0 -1
  94. package/dist/chunk-G52ENULI.js.map +0 -1
  95. package/dist/chunk-J6O2HVBM.js +0 -320
  96. package/dist/chunk-J6O2HVBM.js.map +0 -1
  97. package/dist/chunk-KYSP7L5C.js +0 -16
  98. package/dist/chunk-KYSP7L5C.js.map +0 -1
  99. package/dist/chunk-M23L3JHG.js +0 -159
  100. package/dist/chunk-M23L3JHG.js.map +0 -1
  101. package/dist/chunk-U7AXAUJA.js +0 -1
  102. package/dist/chunk-U7AXAUJA.js.map +0 -1
  103. package/dist/chunk-U7IAFPVU.js +0 -152
  104. package/dist/chunk-U7IAFPVU.js.map +0 -1
  105. package/dist/errors.d.ts +0 -2
  106. package/dist/errors.d.ts.map +0 -1
  107. package/dist/exports/ast.d.ts +0 -14
  108. package/dist/exports/ast.d.ts.map +0 -1
  109. package/dist/exports/ast.js +0 -46
  110. package/dist/exports/ast.js.map +0 -1
  111. package/dist/exports/errors.d.ts +0 -2
  112. package/dist/exports/errors.d.ts.map +0 -1
  113. package/dist/exports/errors.js +0 -9
  114. package/dist/exports/errors.js.map +0 -1
  115. package/dist/exports/guards.d.ts +0 -2
  116. package/dist/exports/guards.d.ts.map +0 -1
  117. package/dist/exports/guards.js +0 -21
  118. package/dist/exports/guards.js.map +0 -1
  119. package/dist/exports/operations-registry.d.ts +0 -2
  120. package/dist/exports/operations-registry.d.ts.map +0 -1
  121. package/dist/exports/operations-registry.js +0 -9
  122. package/dist/exports/operations-registry.js.map +0 -1
  123. package/dist/exports/param.d.ts +0 -3
  124. package/dist/exports/param.d.ts.map +0 -1
  125. package/dist/exports/param.js +0 -7
  126. package/dist/exports/param.js.map +0 -1
  127. package/dist/exports/plan.d.ts +0 -2
  128. package/dist/exports/plan.d.ts.map +0 -1
  129. package/dist/exports/plan.js +0 -7
  130. package/dist/exports/plan.js.map +0 -1
  131. package/dist/exports/query-lane-context.d.ts +0 -2
  132. package/dist/exports/query-lane-context.d.ts.map +0 -1
  133. package/dist/exports/query-lane-context.js +0 -2
  134. package/dist/exports/query-lane-context.js.map +0 -1
  135. package/dist/exports/schema.d.ts +0 -3
  136. package/dist/exports/schema.d.ts.map +0 -1
  137. package/dist/exports/schema.js +0 -14
  138. package/dist/exports/schema.js.map +0 -1
  139. package/dist/exports/types.d.ts +0 -2
  140. package/dist/exports/types.d.ts.map +0 -1
  141. package/dist/exports/types.js +0 -10
  142. package/dist/exports/types.js.map +0 -1
  143. package/dist/index.d.ts +0 -9
  144. package/dist/index.d.ts.map +0 -1
  145. package/dist/index.js +0 -81
  146. package/dist/index.js.map +0 -1
  147. package/dist/operations-registry.d.ts +0 -5
  148. package/dist/operations-registry.d.ts.map +0 -1
  149. package/dist/param.d.ts +0 -4
  150. package/dist/param.d.ts.map +0 -1
  151. package/dist/plan.d.ts +0 -23
  152. package/dist/plan.d.ts.map +0 -1
  153. package/dist/query-lane-context.d.ts +0 -16
  154. package/dist/query-lane-context.d.ts.map +0 -1
  155. package/dist/schema.d.ts +0 -63
  156. package/dist/schema.d.ts.map +0 -1
  157. package/dist/types.d.ts +0 -332
  158. package/dist/types.d.ts.map +0 -1
  159. package/dist/utils/guards.d.ts +0 -55
  160. package/dist/utils/guards.d.ts.map +0 -1
@@ -0,0 +1,3 @@
1
+ import { planInvalid as planInvalid$1, planUnsupported } from "@prisma-next/plan";
2
+
3
+ export { planUnsupported as n, planInvalid$1 as t };
@@ -0,0 +1,2 @@
1
+ import { planInvalid as planInvalid$1, planUnsupported } from "@prisma-next/plan";
2
+ export { planUnsupported as n, planInvalid$1 as t };
@@ -0,0 +1,123 @@
1
+ import { a as CodecInput, c as CodecRegistry, d as codec, f as createCodecRegistry, i as CodecId, l as ExtractCodecTypes, n as Codec, o as CodecMeta, p as defineCodecs, r as CodecDefBuilder, s as CodecOutput, u as ExtractDataTypes } from "../query-lane-context-wr_XXnB5.mjs";
2
+ import { C as UpdateAst, S as TableRef, _ as LoweredStatement, a as ColumnRef, b as QueryAst, c as ExistsExpr, d as IncludeAst, f as IncludeRef, g as LiteralExpr, h as JoinOnExpr, i as BinaryOp, l as Expression, m as JoinAst, o as DeleteAst, p as InsertAst, r as BinaryExpr, s as Direction, u as ExpressionSource, v as OperationExpr, w as isOperationExpr, x as SelectAst, y as ParamRef } from "../plan-9PvH-Tu3.mjs";
3
+ import { y as JoinOnBuilder } from "../types-Bg2kUmUA.mjs";
4
+
5
+ //#region src/ast/adapter-types.d.ts
6
+ type AdapterTarget = string;
7
+ interface AdapterProfile<TTarget extends AdapterTarget = AdapterTarget> {
8
+ readonly id: string;
9
+ readonly target: TTarget;
10
+ readonly capabilities: Record<string, unknown>;
11
+ /**
12
+ * Returns the adapter's default codec registry.
13
+ * The registry contains codecs provided by the adapter for converting
14
+ * between wire types and JavaScript types.
15
+ */
16
+ codecs(): CodecRegistry;
17
+ }
18
+ interface LoweredPayload<TBody = unknown> {
19
+ readonly profileId?: string;
20
+ readonly body: TBody;
21
+ readonly annotations?: Record<string, unknown>;
22
+ }
23
+ interface LowererContext<TContract = unknown> {
24
+ readonly contract: TContract;
25
+ readonly params?: readonly unknown[];
26
+ }
27
+ type Lowerer<Ast = unknown, TContract = unknown, TBody = unknown> = (ast: Ast, context: LowererContext<TContract>) => LoweredPayload<TBody>;
28
+ interface Adapter<Ast = unknown, TContract = unknown, TBody = unknown> {
29
+ readonly profile: AdapterProfile;
30
+ lower(ast: Ast, context: LowererContext<TContract>): LoweredPayload<TBody>;
31
+ }
32
+ //#endregion
33
+ //#region src/ast/common.d.ts
34
+ declare function createTableRef(name: string): TableRef;
35
+ declare function createColumnRef(table: string, column: string): ColumnRef;
36
+ declare function createParamRef(index: number, name?: string): ParamRef;
37
+ declare function createOperationExpr(operation: OperationExpr): OperationExpr;
38
+ declare function createLiteralExpr(value: unknown): LiteralExpr;
39
+ //#endregion
40
+ //#region src/ast/delete.d.ts
41
+ interface CreateDeleteAstOptions {
42
+ readonly table: TableRef;
43
+ readonly where: BinaryExpr;
44
+ readonly returning?: ReadonlyArray<ColumnRef>;
45
+ }
46
+ declare function createDeleteAst(options: CreateDeleteAstOptions): DeleteAst;
47
+ //#endregion
48
+ //#region src/ast/driver-types.d.ts
49
+ interface SqlExecuteRequest {
50
+ readonly sql: string;
51
+ readonly params?: readonly unknown[];
52
+ }
53
+ interface SqlQueryResult<Row = Record<string, unknown>> {
54
+ readonly rows: ReadonlyArray<Row>;
55
+ readonly rowCount?: number | null;
56
+ readonly [key: string]: unknown;
57
+ }
58
+ interface SqlExplainResult<Row = Record<string, unknown>> {
59
+ readonly rows: ReadonlyArray<Row>;
60
+ }
61
+ interface SqlDriver {
62
+ connect(): Promise<void>;
63
+ execute<Row = Record<string, unknown>>(request: SqlExecuteRequest): AsyncIterable<Row>;
64
+ explain?(request: SqlExecuteRequest): Promise<SqlExplainResult>;
65
+ query<Row = Record<string, unknown>>(sql: string, params?: readonly unknown[]): Promise<SqlQueryResult<Row>>;
66
+ close(): Promise<void>;
67
+ }
68
+ //#endregion
69
+ //#region src/ast/insert.d.ts
70
+ interface CreateInsertAstOptions {
71
+ readonly table: TableRef;
72
+ readonly values: Record<string, ColumnRef | ParamRef>;
73
+ readonly returning?: ReadonlyArray<ColumnRef>;
74
+ }
75
+ declare function createInsertAst(options: CreateInsertAstOptions): InsertAst;
76
+ //#endregion
77
+ //#region src/ast/join.d.ts
78
+ declare function createJoin(joinType: 'inner' | 'left' | 'right' | 'full', table: TableRef, on: JoinOnExpr): JoinAst;
79
+ declare function createJoinOnExpr(left: ColumnRef, right: ColumnRef): JoinOnExpr;
80
+ declare function createJoinOnBuilder(): JoinOnBuilder;
81
+ //#endregion
82
+ //#region src/ast/order.d.ts
83
+ declare function createOrderByItem(expr: ColumnRef | OperationExpr, dir: 'asc' | 'desc'): {
84
+ expr: ColumnRef | OperationExpr;
85
+ dir: Direction;
86
+ };
87
+ //#endregion
88
+ //#region src/ast/predicate.d.ts
89
+ declare function createBinaryExpr(op: BinaryOp, left: Expression, right: Expression | ParamRef): BinaryExpr;
90
+ declare function createExistsExpr(not: boolean, subquery: SelectAst): ExistsExpr;
91
+ //#endregion
92
+ //#region src/ast/select.d.ts
93
+ interface CreateSelectAstOptions {
94
+ readonly from: TableRef;
95
+ readonly joins?: ReadonlyArray<JoinAst>;
96
+ readonly includes?: ReadonlyArray<IncludeAst>;
97
+ readonly project: ReadonlyArray<{
98
+ alias: string;
99
+ expr: ColumnRef | IncludeRef | OperationExpr;
100
+ }>;
101
+ readonly where?: BinaryExpr | ExistsExpr;
102
+ readonly orderBy?: ReadonlyArray<{
103
+ expr: ColumnRef | OperationExpr;
104
+ dir: Direction;
105
+ }>;
106
+ readonly limit?: number;
107
+ }
108
+ declare function createSelectAst(options: CreateSelectAstOptions): SelectAst;
109
+ //#endregion
110
+ //#region src/ast/update.d.ts
111
+ interface CreateUpdateAstOptions {
112
+ readonly table: TableRef;
113
+ readonly set: Record<string, ColumnRef | ParamRef>;
114
+ readonly where: BinaryExpr;
115
+ readonly returning?: ReadonlyArray<ColumnRef>;
116
+ }
117
+ declare function createUpdateAst(options: CreateUpdateAstOptions): UpdateAst;
118
+ //#endregion
119
+ //#region src/ast/util.d.ts
120
+ declare function compact<T extends Record<string, unknown>>(o: T): T;
121
+ //#endregion
122
+ export { Adapter, AdapterProfile, AdapterTarget, BinaryExpr, BinaryOp, Codec, CodecDefBuilder, CodecId, CodecInput, CodecMeta, CodecOutput, CodecRegistry, ColumnRef, CreateDeleteAstOptions, CreateInsertAstOptions, CreateSelectAstOptions, CreateUpdateAstOptions, DeleteAst, Direction, ExistsExpr, Expression, ExpressionSource, ExtractCodecTypes, ExtractDataTypes, IncludeAst, IncludeRef, InsertAst, JoinAst, JoinOnExpr, LiteralExpr, LoweredPayload, LoweredStatement, Lowerer, LowererContext, OperationExpr, ParamRef, QueryAst, SelectAst, SqlDriver, SqlExecuteRequest, SqlExplainResult, SqlQueryResult, TableRef, UpdateAst, codec, compact, createBinaryExpr, createCodecRegistry, createColumnRef, createDeleteAst, createExistsExpr, createInsertAst, createJoin, createJoinOnBuilder, createJoinOnExpr, createLiteralExpr, createOperationExpr, createOrderByItem, createParamRef, createSelectAst, createTableRef, createUpdateAst, defineCodecs, isOperationExpr };
123
+ //# sourceMappingURL=ast.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ast.d.mts","names":[],"sources":["../../src/ast/adapter-types.ts","../../src/ast/common.ts","../../src/ast/delete.ts","../../src/ast/driver-types.ts","../../src/ast/insert.ts","../../src/ast/join.ts","../../src/ast/order.ts","../../src/ast/predicate.ts","../../src/ast/select.ts","../../src/ast/update.ts","../../src/ast/util.ts"],"sourcesContent":[],"mappings":";;;;;KAEY,aAAA;UAEK,+BAA+B,gBAAgB;;mBAE7C;EAJP,SAAA,YAAa,EAKA,MALA,CAAA,MAAA,EAAA,OAAA,CAAA;EAER;;;;;EASL,MAAA,EAAA,EAAA,aAAA;;AAGK,UAAA,cAAc,CAAA,QAEd,OACQ,CAAA,CAAA;EAGR,SAAA,SAAc,CAAA,EAAA,MAAA;EAKnB,SAAA,IAAO,EATF,KASE;EACZ,SAAA,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A,CAAA,EAAc,MAAA;AAK/B;AACO,iBQDS,eAAA,CRCT,OAAA,EQDkC,sBRClC,CAAA,EQD2D,SRC3D;;;USzBU,sBAAA;kBACC;gBACF,eAAe,YAAY;kBACzB;ETJN,SAAA,SAAa,CAAA,ESKF,aTLE,CSKY,STLZ,CAAA;AAEzB;AAAgD,iBSMhC,eAAA,CTNgC,OAAA,ESMP,sBTNO,CAAA,ESMkB,STNlB;;;iBUJhC,kBAAkB,4BAA4B,IAAI"}
@@ -0,0 +1,304 @@
1
+ import { n as isColumnBuilder } from "../types-D_FRJvm0.mjs";
2
+ import { planInvalid } from "@prisma-next/plan";
3
+
4
+ //#region src/ast/codec-types.ts
5
+ /**
6
+ * Implementation of CodecRegistry.
7
+ */
8
+ var CodecRegistryImpl = class {
9
+ _byId = /* @__PURE__ */ new Map();
10
+ _byScalar = /* @__PURE__ */ new Map();
11
+ /**
12
+ * Map-like interface for codec lookup by ID.
13
+ * Example: registry.get('pg/text@1')
14
+ */
15
+ get(id) {
16
+ return this._byId.get(id);
17
+ }
18
+ /**
19
+ * Check if a codec with the given ID is registered.
20
+ */
21
+ has(id) {
22
+ return this._byId.has(id);
23
+ }
24
+ /**
25
+ * Get all codecs that handle a given scalar type.
26
+ * Returns an empty frozen array if no codecs are found.
27
+ * Example: registry.getByScalar('text') → [codec1, codec2, ...]
28
+ */
29
+ getByScalar(scalar) {
30
+ return this._byScalar.get(scalar) ?? Object.freeze([]);
31
+ }
32
+ /**
33
+ * Get the default codec for a scalar type (first registered codec).
34
+ * Returns undefined if no codec handles this scalar type.
35
+ */
36
+ getDefaultCodec(scalar) {
37
+ return this._byScalar.get(scalar)?.[0];
38
+ }
39
+ /**
40
+ * Register a codec in the registry.
41
+ * Throws an error if a codec with the same ID is already registered.
42
+ *
43
+ * @param codec - The codec to register
44
+ * @throws Error if a codec with the same ID already exists
45
+ */
46
+ register(codec$1) {
47
+ if (this._byId.has(codec$1.id)) throw new Error(`Codec with ID '${codec$1.id}' is already registered`);
48
+ this._byId.set(codec$1.id, codec$1);
49
+ for (const scalarType of codec$1.targetTypes) {
50
+ const existing = this._byScalar.get(scalarType);
51
+ if (existing) existing.push(codec$1);
52
+ else this._byScalar.set(scalarType, [codec$1]);
53
+ }
54
+ }
55
+ /**
56
+ * Returns an iterator over all registered codecs.
57
+ * Useful for iterating through codecs from another registry.
58
+ */
59
+ *[Symbol.iterator]() {
60
+ for (const codec$1 of this._byId.values()) yield codec$1;
61
+ }
62
+ /**
63
+ * Returns an iterable of all registered codecs.
64
+ */
65
+ values() {
66
+ return this._byId.values();
67
+ }
68
+ };
69
+ /**
70
+ * Codec factory - creates a codec with typeId and encode/decode functions.
71
+ */
72
+ function codec(config) {
73
+ return {
74
+ id: config.typeId,
75
+ targetTypes: config.targetTypes,
76
+ ...config.meta ? { meta: config.meta } : {},
77
+ encode: config.encode,
78
+ decode: config.decode
79
+ };
80
+ }
81
+ /**
82
+ * Implementation of CodecDefBuilder.
83
+ */
84
+ var CodecDefBuilderImpl = class CodecDefBuilderImpl {
85
+ _codecs;
86
+ CodecTypes;
87
+ dataTypes;
88
+ constructor(codecs) {
89
+ this._codecs = codecs;
90
+ const codecTypes = {};
91
+ for (const [, codecImpl] of Object.entries(this._codecs)) {
92
+ const codecImplTyped = codecImpl;
93
+ codecTypes[codecImplTyped.id] = {
94
+ input: void 0,
95
+ output: void 0
96
+ };
97
+ }
98
+ this.CodecTypes = codecTypes;
99
+ const dataTypes = {};
100
+ for (const key in this._codecs) if (Object.hasOwn(this._codecs, key)) dataTypes[key] = this._codecs[key].id;
101
+ this.dataTypes = dataTypes;
102
+ }
103
+ add(scalarName, codecImpl) {
104
+ return new CodecDefBuilderImpl({
105
+ ...this._codecs,
106
+ [scalarName]: codecImpl
107
+ });
108
+ }
109
+ /**
110
+ * Derive codecDefinitions structure.
111
+ */
112
+ get codecDefinitions() {
113
+ const result = {};
114
+ for (const [scalarName, codecImpl] of Object.entries(this._codecs)) {
115
+ const codec$1 = codecImpl;
116
+ result[scalarName] = {
117
+ typeId: codec$1.id,
118
+ scalar: scalarName,
119
+ codec: codec$1,
120
+ input: void 0,
121
+ output: void 0,
122
+ jsType: void 0
123
+ };
124
+ }
125
+ return result;
126
+ }
127
+ };
128
+ /**
129
+ * Create a new codec registry.
130
+ */
131
+ function createCodecRegistry() {
132
+ return new CodecRegistryImpl();
133
+ }
134
+ /**
135
+ * Create a new codec definition builder.
136
+ */
137
+ function defineCodecs() {
138
+ return new CodecDefBuilderImpl({});
139
+ }
140
+
141
+ //#endregion
142
+ //#region src/ast/util.ts
143
+ function compact(o) {
144
+ const out = {};
145
+ for (const [k, v] of Object.entries(o)) {
146
+ if (v === void 0 || v === null) continue;
147
+ if (Array.isArray(v) && v.length === 0) continue;
148
+ out[k] = v;
149
+ }
150
+ return out;
151
+ }
152
+
153
+ //#endregion
154
+ //#region src/ast/common.ts
155
+ function createTableRef(name) {
156
+ return {
157
+ kind: "table",
158
+ name
159
+ };
160
+ }
161
+ function createColumnRef(table, column) {
162
+ return {
163
+ kind: "col",
164
+ table,
165
+ column
166
+ };
167
+ }
168
+ function createParamRef(index, name) {
169
+ return compact({
170
+ kind: "param",
171
+ index,
172
+ name
173
+ });
174
+ }
175
+ function createOperationExpr(operation) {
176
+ return operation;
177
+ }
178
+ function createLiteralExpr(value) {
179
+ return {
180
+ kind: "literal",
181
+ value
182
+ };
183
+ }
184
+
185
+ //#endregion
186
+ //#region src/ast/delete.ts
187
+ function createDeleteAst(options) {
188
+ return compact({
189
+ kind: "delete",
190
+ table: options.table,
191
+ where: options.where,
192
+ returning: options.returning
193
+ });
194
+ }
195
+
196
+ //#endregion
197
+ //#region src/ast/insert.ts
198
+ function createInsertAst(options) {
199
+ return compact({
200
+ kind: "insert",
201
+ table: options.table,
202
+ values: options.values,
203
+ returning: options.returning
204
+ });
205
+ }
206
+
207
+ //#endregion
208
+ //#region src/ast/join.ts
209
+ function createJoin(joinType, table, on) {
210
+ return {
211
+ kind: "join",
212
+ joinType,
213
+ table,
214
+ on
215
+ };
216
+ }
217
+ function createJoinOnExpr(left, right) {
218
+ return {
219
+ kind: "eqCol",
220
+ left,
221
+ right
222
+ };
223
+ }
224
+ var JoinOnBuilderImpl = class {
225
+ eqCol(left, right) {
226
+ if (!left || !isColumnBuilder(left)) throw planInvalid("Join ON left operand must be a column");
227
+ if (!right || !isColumnBuilder(right)) throw planInvalid("Join ON right operand must be a column");
228
+ const leftCol = left;
229
+ const rightCol = right;
230
+ if (leftCol.table === rightCol.table) throw planInvalid("Self-joins are not supported in MVP");
231
+ return {
232
+ kind: "join-on",
233
+ left,
234
+ right
235
+ };
236
+ }
237
+ };
238
+ function createJoinOnBuilder() {
239
+ return new JoinOnBuilderImpl();
240
+ }
241
+
242
+ //#endregion
243
+ //#region src/ast/order.ts
244
+ function createOrderByItem(expr, dir) {
245
+ return {
246
+ expr,
247
+ dir
248
+ };
249
+ }
250
+
251
+ //#endregion
252
+ //#region src/ast/predicate.ts
253
+ function createBinaryExpr(op, left, right) {
254
+ return {
255
+ kind: "bin",
256
+ op,
257
+ left,
258
+ right
259
+ };
260
+ }
261
+ function createExistsExpr(not, subquery) {
262
+ return {
263
+ kind: "exists",
264
+ not,
265
+ subquery
266
+ };
267
+ }
268
+
269
+ //#endregion
270
+ //#region src/ast/select.ts
271
+ function createSelectAst(options) {
272
+ return compact({
273
+ kind: "select",
274
+ from: options.from,
275
+ joins: options.joins,
276
+ includes: options.includes,
277
+ project: options.project,
278
+ where: options.where,
279
+ orderBy: options.orderBy,
280
+ limit: options.limit
281
+ });
282
+ }
283
+
284
+ //#endregion
285
+ //#region src/ast/types.ts
286
+ function isOperationExpr(expr) {
287
+ return expr.kind === "operation";
288
+ }
289
+
290
+ //#endregion
291
+ //#region src/ast/update.ts
292
+ function createUpdateAst(options) {
293
+ return compact({
294
+ kind: "update",
295
+ table: options.table,
296
+ set: options.set,
297
+ where: options.where,
298
+ returning: options.returning
299
+ });
300
+ }
301
+
302
+ //#endregion
303
+ export { codec, compact, createBinaryExpr, createCodecRegistry, createColumnRef, createDeleteAst, createExistsExpr, createInsertAst, createJoin, createJoinOnBuilder, createJoinOnExpr, createLiteralExpr, createOperationExpr, createOrderByItem, createParamRef, createSelectAst, createTableRef, createUpdateAst, defineCodecs, isOperationExpr };
304
+ //# sourceMappingURL=ast.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ast.mjs","names":["codec","codecTypes: Record<string, { readonly input: unknown; readonly output: unknown }>","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 >","out: Record<string, unknown>"],"sources":["../../src/ast/codec-types.ts","../../src/ast/util.ts","../../src/ast/common.ts","../../src/ast/delete.ts","../../src/ast/insert.ts","../../src/ast/join.ts","../../src/ast/order.ts","../../src/ast/predicate.ts","../../src/ast/select.ts","../../src/ast/types.ts","../../src/ast/update.ts"],"sourcesContent":["import type { O } from 'ts-toolbelt';\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 * Codec interface for encoding/decoding values between wire format and JavaScript types.\n *\n * Codecs are pure, synchronous functions with no side effects or IO.\n * They provide deterministic conversion between database wire types and JS values.\n */\nexport interface Codec<Id extends string = string, TWire = unknown, TJs = unknown> {\n /**\n * Namespaced codec identifier in format 'namespace/name@version'\n * Examples: 'pg/text@1', 'pg/uuid@1', 'pg/timestamptz@1'\n */\n readonly id: Id;\n\n /**\n * Contract scalar type IDs that this codec can handle.\n * Examples: ['text'], ['int4', 'float8'], ['timestamp', 'timestamptz']\n */\n readonly targetTypes: readonly string[];\n\n /**\n * Optional metadata for database-specific type information.\n * Used for schema introspection and verification.\n */\n readonly meta?: CodecMeta;\n\n /**\n * Decode a wire value (from database) to JavaScript type.\n * Must be synchronous and pure (no side effects).\n */\n decode(wire: TWire): TJs;\n\n /**\n * Encode a JavaScript value to wire format (for database).\n * Optional - if not provided, values pass through unchanged.\n * Must be synchronous and pure (no side effects).\n */\n encode?(value: TJs): TWire;\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 [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 /**\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 * Codec factory - creates a codec with typeId and encode/decode functions.\n */\nexport function codec<Id extends string, TWire, TJs>(config: {\n typeId: Id;\n targetTypes: readonly string[];\n encode: (value: TJs) => TWire;\n decode: (wire: TWire) => TJs;\n meta?: CodecMeta;\n}): Codec<Id, TWire, TJs> {\n return {\n id: config.typeId,\n targetTypes: config.targetTypes,\n ...(config.meta ? { meta: config.meta } : {}),\n encode: config.encode,\n decode: config.decode,\n };\n}\n\n/**\n * Type helpers to extract codec types.\n */\nexport type CodecId<T> =\n T extends Codec<infer Id, unknown, unknown>\n ? Id\n : T extends { readonly id: infer Id }\n ? Id\n : never;\nexport type CodecInput<T> = T extends Codec<string, unknown, infer JsT> ? JsT : never;\nexport type CodecOutput<T> = T extends Codec<string, unknown, infer JsT> ? JsT : 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, unknown, unknown>\n ? Id\n : never]: {\n readonly input: CodecInput<ScalarNames[K]>;\n readonly output: CodecOutput<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, unknown, unknown>\n ? Id\n : never;\n readonly scalar: K;\n readonly codec: ScalarNames[K];\n readonly input: CodecInput<ScalarNames[K]>;\n readonly output: CodecOutput<ScalarNames[K]>;\n readonly jsType: CodecOutput<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<string, { readonly input: unknown; readonly output: unknown }> = {};\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 CodecOutput<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, unknown, unknown> ? Id : never;\n readonly scalar: K;\n readonly codec: ScalarNames[K];\n readonly input: CodecInput<ScalarNames[K]>;\n readonly output: CodecOutput<ScalarNames[K]>;\n readonly jsType: CodecOutput<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 CodecOutput<typeof codec>,\n jsType: undefined as unknown as CodecOutput<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, unknown, unknown>\n ? Id\n : never;\n readonly scalar: K;\n readonly codec: ScalarNames[K];\n readonly input: CodecInput<ScalarNames[K]>;\n readonly output: CodecOutput<ScalarNames[K]>;\n readonly jsType: CodecOutput<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","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","import type { ColumnRef, LiteralExpr, OperationExpr, ParamRef, TableRef } from './types';\nimport { compact } from './util';\n\nexport function createTableRef(name: string): TableRef {\n return {\n kind: 'table',\n name,\n };\n}\n\nexport function createColumnRef(table: string, column: string): ColumnRef {\n return {\n kind: 'col',\n table,\n column,\n };\n}\n\nexport function createParamRef(index: number, name?: string): ParamRef {\n return compact({\n kind: 'param',\n index,\n name,\n }) as ParamRef;\n}\n\nexport function createOperationExpr(operation: OperationExpr): OperationExpr {\n return operation;\n}\n\nexport function createLiteralExpr(value: unknown): LiteralExpr {\n return {\n kind: 'literal',\n value,\n };\n}\n","import type { BinaryExpr, ColumnRef, DeleteAst, TableRef } from './types';\nimport { compact } from './util';\n\nexport interface CreateDeleteAstOptions {\n readonly table: TableRef;\n readonly where: BinaryExpr;\n readonly returning?: ReadonlyArray<ColumnRef>;\n}\n\nexport function createDeleteAst(options: CreateDeleteAstOptions): DeleteAst {\n return compact({\n kind: 'delete',\n table: options.table,\n where: options.where,\n returning: options.returning,\n }) as DeleteAst;\n}\n","import type { ColumnRef, InsertAst, ParamRef, TableRef } from './types';\nimport { compact } from './util';\n\nexport interface CreateInsertAstOptions {\n readonly table: TableRef;\n readonly values: Record<string, ColumnRef | ParamRef>;\n readonly returning?: ReadonlyArray<ColumnRef>;\n}\n\nexport function createInsertAst(options: CreateInsertAstOptions): InsertAst {\n return compact({\n kind: 'insert',\n table: options.table,\n values: options.values,\n returning: options.returning,\n }) as InsertAst;\n}\n","import { planInvalid } from '@prisma-next/plan';\nimport type { AnyColumnBuilder, JoinOnBuilder, JoinOnPredicate } from '../types';\nimport { isColumnBuilder } from '../types';\nimport type { ColumnRef, JoinAst, JoinOnExpr, TableRef } from './types';\n\nexport function createJoin(\n joinType: 'inner' | 'left' | 'right' | 'full',\n table: TableRef,\n on: JoinOnExpr,\n): JoinAst {\n return {\n kind: 'join',\n joinType,\n table,\n on,\n };\n}\n\nexport function createJoinOnExpr(left: ColumnRef, right: ColumnRef): JoinOnExpr {\n return {\n kind: 'eqCol',\n left,\n right,\n };\n}\n\nclass JoinOnBuilderImpl implements JoinOnBuilder {\n eqCol(left: AnyColumnBuilder, right: AnyColumnBuilder): JoinOnPredicate {\n if (!left || !isColumnBuilder(left)) {\n throw planInvalid('Join ON left operand must be a column');\n }\n\n if (!right || !isColumnBuilder(right)) {\n throw planInvalid('Join ON right operand must be a column');\n }\n\n // TypeScript can't narrow ColumnBuilder properly, so we assert\n const leftCol = left as unknown as { table: string; column: string };\n const rightCol = right as unknown as { table: string; column: string };\n if (leftCol.table === rightCol.table) {\n throw planInvalid('Self-joins are not supported in MVP');\n }\n\n return {\n kind: 'join-on',\n left: left as AnyColumnBuilder,\n right: right as AnyColumnBuilder,\n };\n }\n}\n\nexport function createJoinOnBuilder(): JoinOnBuilder {\n return new JoinOnBuilderImpl();\n}\n","import type { ColumnRef, Direction, OperationExpr } from './types';\n\nexport function createOrderByItem(\n expr: ColumnRef | OperationExpr,\n dir: 'asc' | 'desc',\n): { expr: ColumnRef | OperationExpr; dir: Direction } {\n return {\n expr,\n dir,\n };\n}\n","import type { BinaryExpr, BinaryOp, ExistsExpr, Expression, ParamRef, SelectAst } from './types';\n\nexport function createBinaryExpr(\n op: BinaryOp,\n left: Expression,\n right: Expression | ParamRef,\n): BinaryExpr {\n return {\n kind: 'bin',\n op,\n left,\n right,\n };\n}\n\nexport function createExistsExpr(not: boolean, subquery: SelectAst): ExistsExpr {\n return {\n kind: 'exists',\n not,\n subquery,\n };\n}\n","import type {\n BinaryExpr,\n ColumnRef,\n Direction,\n ExistsExpr,\n IncludeAst,\n IncludeRef,\n JoinAst,\n OperationExpr,\n SelectAst,\n TableRef,\n} from './types';\nimport { compact } from './util';\n\nexport interface CreateSelectAstOptions {\n readonly from: TableRef;\n readonly joins?: ReadonlyArray<JoinAst>;\n readonly includes?: ReadonlyArray<IncludeAst>;\n readonly project: ReadonlyArray<{\n alias: string;\n expr: ColumnRef | IncludeRef | OperationExpr;\n }>;\n readonly where?: BinaryExpr | ExistsExpr;\n readonly orderBy?: ReadonlyArray<{ expr: ColumnRef | OperationExpr; dir: Direction }>;\n readonly limit?: number;\n}\n\nexport function createSelectAst(options: CreateSelectAstOptions): SelectAst {\n return compact({\n kind: 'select',\n from: options.from,\n joins: options.joins,\n includes: options.includes,\n project: options.project,\n where: options.where,\n orderBy: options.orderBy,\n limit: options.limit,\n }) as SelectAst;\n}\n","import type { ReturnSpec } from '@prisma-next/operations';\nimport type { SqlLoweringSpec } from '@prisma-next/sql-operations';\n\n// SQL-specific AST types and supporting types\n// These types are needed by adapters and runtime for SQL query execution\n\nexport type Direction = 'asc' | 'desc';\n\nexport interface TableRef {\n readonly kind: 'table';\n readonly name: string;\n}\n\nexport interface ColumnRef {\n readonly kind: 'col';\n readonly table: string;\n readonly column: string;\n}\n\nexport interface ParamRef {\n readonly kind: 'param';\n readonly index: number;\n readonly name?: string;\n}\n\nexport interface LiteralExpr {\n readonly kind: 'literal';\n readonly value: unknown;\n}\n\nexport interface OperationExpr {\n readonly kind: 'operation';\n readonly method: string;\n readonly forTypeId: string;\n readonly self: Expression;\n readonly args: ReadonlyArray<Expression | ParamRef | LiteralExpr>;\n readonly returns: ReturnSpec;\n readonly lowering: SqlLoweringSpec;\n}\n\n/**\n * Unified expression type - the canonical AST representation for column references\n * and operation expressions. This is what all builders convert to via toExpr().\n */\nexport type Expression = ColumnRef | OperationExpr;\n\n/**\n * Interface for any builder that can produce an Expression.\n * Implemented by ColumnBuilder and ExpressionBuilder.\n */\nexport interface ExpressionSource {\n toExpr(): Expression;\n}\n\nexport function isOperationExpr(expr: Expression): expr is OperationExpr {\n return expr.kind === 'operation';\n}\n\nexport type BinaryOp = 'eq' | 'neq' | 'gt' | 'lt' | 'gte' | 'lte';\n\nexport interface BinaryExpr {\n readonly kind: 'bin';\n readonly op: BinaryOp;\n readonly left: Expression;\n readonly right: Expression | ParamRef;\n}\n\nexport interface ExistsExpr {\n readonly kind: 'exists';\n readonly not: boolean;\n readonly subquery: SelectAst;\n}\n\nexport type JoinOnExpr = {\n readonly kind: 'eqCol';\n readonly left: ColumnRef;\n readonly right: ColumnRef;\n};\n\nexport interface JoinAst {\n readonly kind: 'join';\n readonly joinType: 'inner' | 'left' | 'right' | 'full';\n readonly table: TableRef;\n readonly on: JoinOnExpr;\n}\n\nexport interface IncludeRef {\n readonly kind: 'includeRef';\n readonly alias: string;\n}\n\nexport interface IncludeAst {\n readonly kind: 'includeMany';\n readonly alias: string;\n readonly child: {\n readonly table: TableRef;\n readonly on: JoinOnExpr;\n readonly where?: BinaryExpr | ExistsExpr;\n readonly orderBy?: ReadonlyArray<{ expr: Expression; dir: Direction }>;\n readonly limit?: number;\n readonly project: ReadonlyArray<{ alias: string; expr: Expression }>;\n };\n}\n\nexport interface SelectAst {\n readonly kind: 'select';\n readonly from: TableRef;\n readonly joins?: ReadonlyArray<JoinAst>;\n readonly includes?: ReadonlyArray<IncludeAst>;\n readonly project: ReadonlyArray<{\n alias: string;\n expr: Expression | IncludeRef | LiteralExpr;\n }>;\n readonly where?: BinaryExpr | ExistsExpr;\n readonly orderBy?: ReadonlyArray<{ expr: Expression; dir: Direction }>;\n readonly limit?: number;\n}\n\nexport interface InsertAst {\n readonly kind: 'insert';\n readonly table: TableRef;\n readonly values: Record<string, ColumnRef | ParamRef>;\n readonly returning?: ReadonlyArray<ColumnRef>;\n}\n\nexport interface UpdateAst {\n readonly kind: 'update';\n readonly table: TableRef;\n readonly set: Record<string, ColumnRef | ParamRef>;\n readonly where: BinaryExpr;\n readonly returning?: ReadonlyArray<ColumnRef>;\n}\n\nexport interface DeleteAst {\n readonly kind: 'delete';\n readonly table: TableRef;\n readonly where: BinaryExpr;\n readonly returning?: ReadonlyArray<ColumnRef>;\n}\n\nexport type QueryAst = SelectAst | InsertAst | UpdateAst | DeleteAst;\n\nexport interface LoweredStatement {\n readonly sql: string;\n readonly params: readonly unknown[];\n readonly annotations?: Record<string, unknown>;\n}\n","import type { BinaryExpr, ColumnRef, ParamRef, TableRef, UpdateAst } from './types';\nimport { compact } from './util';\n\nexport interface CreateUpdateAstOptions {\n readonly table: TableRef;\n readonly set: Record<string, ColumnRef | ParamRef>;\n readonly where: BinaryExpr;\n readonly returning?: ReadonlyArray<ColumnRef>;\n}\n\nexport function createUpdateAst(options: CreateUpdateAstOptions): UpdateAst {\n return compact({\n kind: 'update',\n table: options.table,\n set: options.set,\n where: options.where,\n returning: options.returning,\n }) as UpdateAst;\n}\n"],"mappings":";;;;;;;AA4EA,IAAM,oBAAN,MAAiD;CAC/C,AAAiB,wBAAQ,IAAI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jB,OAAO,QAAQ;EAChB,CAAC;;;;;ACiBJ,SAAgB,gBAAgB,MAAyC;AACvE,QAAO,KAAK,SAAS;;;;;AC7CvB,SAAgB,gBAAgB,SAA4C;AAC1E,QAAO,QAAQ;EACb,MAAM;EACN,OAAO,QAAQ;EACf,KAAK,QAAQ;EACb,OAAO,QAAQ;EACf,WAAW,QAAQ;EACpB,CAAC"}
@@ -0,0 +1,2 @@
1
+ import { n as planUnsupported, t as planInvalid } from "../errors-CLx1Ylq0.mjs";
2
+ export { planInvalid, planUnsupported };
@@ -0,0 +1,3 @@
1
+ import { n as planUnsupported, t as planInvalid } from "../errors-BwxypN2Q.mjs";
2
+
3
+ export { planInvalid, planUnsupported };
@@ -0,0 +1,88 @@
1
+ import "../query-lane-context-wr_XXnB5.mjs";
2
+ import { a as ColumnRef, g as LiteralExpr, l as Expression, u as ExpressionSource, v as OperationExpr, y as ParamRef } from "../plan-9PvH-Tu3.mjs";
3
+ import { A as ParamPlaceholder, U as ValueSource, i as AnyExpressionSource, m as ExpressionBuilder, n as AnyColumnBuilder } from "../types-Bg2kUmUA.mjs";
4
+ import { StorageColumn } from "@prisma-next/sql-contract/types";
5
+
6
+ //#region src/utils/guards.d.ts
7
+
8
+ /**
9
+ * Helper to extract columnMeta from a ColumnBuilder or ExpressionBuilder.
10
+ * Returns StorageColumn if present, undefined otherwise.
11
+ * Both ColumnBuilder and ExpressionBuilder have columnMeta property.
12
+ */
13
+ declare function getColumnMeta(expr: AnyExpressionSource): StorageColumn | undefined;
14
+ /**
15
+ * Type predicate to check if a value is a ParamPlaceholder.
16
+ */
17
+ declare function isParamPlaceholder(value: unknown): value is ParamPlaceholder;
18
+ /**
19
+ * Recursively extracts the base ColumnRef from an OperationExpr.
20
+ * If the expression is already a ColumnRef, it is returned directly.
21
+ */
22
+ declare function extractBaseColumnRef(expr: ColumnRef | OperationExpr): ColumnRef;
23
+ /**
24
+ * Recursively collects all ColumnRef nodes from an expression tree.
25
+ * Handles nested OperationExpr structures by traversing both self and args.
26
+ */
27
+ declare function collectColumnRefs(expr: ColumnRef | ParamRef | LiteralExpr | OperationExpr): ColumnRef[];
28
+ /**
29
+ * Type predicate to check if an expression is an OperationExpr.
30
+ */
31
+ declare function isOperationExpr(expr: AnyExpressionSource | OperationExpr | Expression): expr is OperationExpr;
32
+ /**
33
+ * Helper to extract table and column from a ColumnBuilder, ExpressionBuilder, or OperationExpr.
34
+ * For ExpressionBuilder or OperationExpr, recursively unwraps to find the base ColumnRef.
35
+ */
36
+ declare function getColumnInfo(expr: AnyExpressionSource | OperationExpr): {
37
+ table: string;
38
+ column: string;
39
+ };
40
+ /**
41
+ * Type predicate to check if a value is a ColumnBuilder.
42
+ */
43
+ declare function isColumnBuilder(value: unknown): value is AnyColumnBuilder;
44
+ /**
45
+ * Type predicate to check if a value is an ExpressionBuilder.
46
+ */
47
+ declare function isExpressionBuilder(value: unknown): value is ExpressionBuilder;
48
+ /**
49
+ * Type predicate to check if a value is an ExpressionSource (has toExpr method).
50
+ */
51
+ declare function isExpressionSource(value: unknown): value is ExpressionSource;
52
+ /**
53
+ * Converts any ExpressionSource to an Expression.
54
+ * This is the canonical way to get an AST Expression from a builder.
55
+ *
56
+ * @param source - A ColumnBuilder or ExpressionBuilder
57
+ * @returns The corresponding Expression (ColumnRef or OperationExpr)
58
+ */
59
+ declare function toExpression(source: ExpressionSource): Expression;
60
+ /**
61
+ * Converts an AnyExpressionSource to an Expression.
62
+ * Handles both ColumnBuilder and ExpressionBuilder.
63
+ *
64
+ * @param source - A ColumnBuilder or ExpressionBuilder
65
+ * @returns The corresponding Expression (ColumnRef or OperationExpr)
66
+ */
67
+ declare function expressionFromSource(source: AnyExpressionSource): Expression;
68
+ /**
69
+ * Type predicate to check if a value is a ValueSource.
70
+ * ValueSource is either a ParamPlaceholder or an ExpressionSource.
71
+ */
72
+ declare function isValueSource(value: unknown): value is ValueSource;
73
+ /**
74
+ * Extracts and returns an OperationExpr from a builder.
75
+ * Returns the OperationExpr if the builder is an OperationExpr or has an _operationExpr property,
76
+ * otherwise returns undefined.
77
+ *
78
+ * @deprecated Use isExpressionBuilder() instead. This function exists for backward compatibility
79
+ * with code that uses the hidden _operationExpr property pattern.
80
+ *
81
+ * @design-note: This function accesses the hidden `_operationExpr` property, which is a code smell.
82
+ * The ExpressionBuilder type (introduced in the operation-expr-refactoring) provides a cleaner
83
+ * approach by explicitly representing operation results as a distinct type.
84
+ */
85
+ declare function getOperationExpr(builder: AnyColumnBuilder | OperationExpr): OperationExpr | undefined;
86
+ //#endregion
87
+ export { collectColumnRefs, expressionFromSource, extractBaseColumnRef, getColumnInfo, getColumnMeta, getOperationExpr, isColumnBuilder, isExpressionBuilder, isExpressionSource, isOperationExpr, isParamPlaceholder, isValueSource, toExpression };
88
+ //# sourceMappingURL=guards.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"guards.d.mts","names":[],"sources":["../../src/utils/guards.ts"],"sourcesContent":[],"mappings":";;;;;;;;;;AAsBA;AAYA;AAegB,iBA3BA,aAAA,CA2BoB,IAAA,EA3BA,mBA2BA,CAAA,EA3BsB,aA2BtB,GAAA,SAAA;;;;AAA4C,iBAfhE,kBAAA,CAegE,KAAA,EAAA,OAAA,CAAA,EAAA,KAAA,IAfnB,gBAemB;AAWhF;;;;AAC6C,iBAZ7B,oBAAA,CAY6B,IAAA,EAZF,SAYE,GAZU,aAYV,CAAA,EAZ0B,SAY1B;;;AAkB7C;;AAC8B,iBApBd,iBAAA,CAoBc,IAAA,EAnBtB,SAmBsB,GAnBV,QAmBU,GAnBC,WAmBD,GAnBe,aAmBf,CAAA,EAlB3B,SAkB2B,EAAA;;;;AASd,iBAVA,eAAA,CAUoB,IAAA,EAT5B,mBASkD,GAT5B,aASyC,GATzB,UASyB,CAAA,EAAA,IAAA,IAR5D,aAQ4D;AAoBvE;AAYA;AAYA;AAgBA;AAWgB,iBAvEA,aAAA,CAuEoB,IAAS,EAvET,mBAuE+B,GAvET,aAuEmB,CAAA,EAAA;EAQ7D,KAAA,EAAA,MAAA;EAgBA,MAAA,EAAA,MAAA;CACL;;;;iBA5EK,eAAA,2BAA0C;;;;iBAY1C,mBAAA,2BAA8C;;;;iBAY9C,kBAAA,2BAA6C;;;;;;;;iBAgB7C,YAAA,SAAqB,mBAAmB;;;;;;;;iBAWxC,oBAAA,SAA6B,sBAAsB;;;;;iBAQnD,aAAA,2BAAwC;;;;;;;;;;;;;iBAgBxC,gBAAA,UACL,mBAAmB,gBAC3B"}
@@ -0,0 +1,3 @@
1
+ import { a as getColumnMeta, c as isExpressionBuilder, d as isParamPlaceholder, f as isValueSource, i as getColumnInfo, l as isExpressionSource, n as expressionFromSource, o as getOperationExpr, p as toExpression, r as extractBaseColumnRef, s as isColumnBuilder, t as collectColumnRefs, u as isOperationExpr } from "../guards-4T0IByJo.mjs";
2
+
3
+ export { collectColumnRefs, expressionFromSource, extractBaseColumnRef, getColumnInfo, getColumnMeta, getOperationExpr, isColumnBuilder, isExpressionBuilder, isExpressionSource, isOperationExpr, isParamPlaceholder, isValueSource, toExpression };
@@ -0,0 +1,5 @@
1
+ import "../query-lane-context-wr_XXnB5.mjs";
2
+ import "../plan-9PvH-Tu3.mjs";
3
+ import "../types-Bg2kUmUA.mjs";
4
+ import { t as attachOperationsToColumnBuilder } from "../operations-registry-CIcn4f2P.mjs";
5
+ export { attachOperationsToColumnBuilder };
@@ -0,0 +1,3 @@
1
+ import { t as attachOperationsToColumnBuilder } from "../operations-registry-7R5KE2-5.mjs";
2
+
3
+ export { attachOperationsToColumnBuilder };
@@ -0,0 +1,5 @@
1
+ import "../query-lane-context-wr_XXnB5.mjs";
2
+ import "../plan-9PvH-Tu3.mjs";
3
+ import "../types-Bg2kUmUA.mjs";
4
+ import { n as param, t as Parameter } from "../param-B4LzVPv2.mjs";
5
+ export { Parameter, param };
@@ -0,0 +1,3 @@
1
+ import { t as param } from "../param-BFvNAaHR.mjs";
2
+
3
+ export { param };
@@ -0,0 +1,2 @@
1
+ import { n as augmentDescriptorWithColumnMeta, t as SqlQueryPlan } from "../plan-9PvH-Tu3.mjs";
2
+ export { SqlQueryPlan, augmentDescriptorWithColumnMeta };
@@ -0,0 +1,17 @@
1
+ //#region src/plan.ts
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