@prisma-next/sql-relational-core 0.3.0-pr.93.5 → 0.3.0-pr.94.1
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/errors-BwxypN2Q.mjs +3 -0
- package/dist/errors-CLx1Ylq0.d.mts +2 -0
- package/dist/exports/ast.d.mts +123 -0
- package/dist/exports/ast.d.mts.map +1 -0
- package/dist/exports/ast.mjs +304 -0
- package/dist/exports/ast.mjs.map +1 -0
- package/dist/exports/errors.d.mts +2 -0
- package/dist/exports/errors.mjs +3 -0
- package/dist/exports/guards.d.mts +88 -0
- package/dist/exports/guards.d.mts.map +1 -0
- package/dist/exports/guards.mjs +3 -0
- package/dist/exports/operations-registry.d.mts +5 -0
- package/dist/exports/operations-registry.mjs +3 -0
- package/dist/exports/param.d.mts +5 -0
- package/dist/exports/param.mjs +3 -0
- package/dist/exports/plan.d.mts +2 -0
- package/dist/exports/plan.mjs +17 -0
- package/dist/exports/plan.mjs.map +1 -0
- package/dist/exports/query-lane-context.d.mts +2 -0
- package/dist/exports/query-lane-context.mjs +1 -0
- package/dist/exports/schema.d.mts +5 -0
- package/dist/exports/schema.mjs +4 -0
- package/dist/exports/types.d.mts +4 -0
- package/dist/exports/types.mjs +3 -0
- package/dist/guards-4T0IByJo.mjs +132 -0
- package/dist/guards-4T0IByJo.mjs.map +1 -0
- package/dist/index.d.mts +12 -0
- package/dist/index.mjs +12 -0
- package/dist/operations-registry-7R5KE2-5.mjs +152 -0
- package/dist/operations-registry-7R5KE2-5.mjs.map +1 -0
- package/dist/operations-registry-CIcn4f2P.d.mts +9 -0
- package/dist/operations-registry-CIcn4f2P.d.mts.map +1 -0
- package/dist/param-B4LzVPv2.d.mts +8 -0
- package/dist/param-B4LzVPv2.d.mts.map +1 -0
- package/dist/param-BFvNAaHR.mjs +14 -0
- package/dist/param-BFvNAaHR.mjs.map +1 -0
- package/dist/plan-9PvH-Tu3.d.mts +157 -0
- package/dist/plan-9PvH-Tu3.d.mts.map +1 -0
- package/dist/query-lane-context-wr_XXnB5.d.mts +143 -0
- package/dist/query-lane-context-wr_XXnB5.d.mts.map +1 -0
- package/dist/schema-BsY2EXAf.mjs +148 -0
- package/dist/schema-BsY2EXAf.mjs.map +1 -0
- package/dist/schema-Dse48uyP.d.mts +63 -0
- package/dist/schema-Dse48uyP.d.mts.map +1 -0
- package/dist/types-Bg2kUmUA.d.mts +359 -0
- package/dist/types-Bg2kUmUA.d.mts.map +1 -0
- package/dist/types-D_FRJvm0.mjs +18 -0
- package/dist/types-D_FRJvm0.mjs.map +1 -0
- package/package.json +27 -49
- package/src/ast/predicate.ts +3 -11
- package/src/ast/types.ts +23 -9
- package/src/exports/guards.ts +5 -0
- package/src/operations-registry.ts +112 -73
- package/src/schema.ts +40 -29
- package/src/types.ts +102 -52
- package/src/utils/guards.ts +88 -18
- package/dist/ast/adapter-types.d.ts +0 -28
- package/dist/ast/adapter-types.d.ts.map +0 -1
- package/dist/ast/codec-types.d.ts +0 -141
- package/dist/ast/codec-types.d.ts.map +0 -1
- package/dist/ast/common.d.ts +0 -7
- package/dist/ast/common.d.ts.map +0 -1
- package/dist/ast/delete.d.ts +0 -8
- package/dist/ast/delete.d.ts.map +0 -1
- package/dist/ast/driver-types.d.ts +0 -20
- package/dist/ast/driver-types.d.ts.map +0 -1
- package/dist/ast/insert.d.ts +0 -8
- package/dist/ast/insert.d.ts.map +0 -1
- package/dist/ast/join.d.ts +0 -6
- package/dist/ast/join.d.ts.map +0 -1
- package/dist/ast/order.d.ts +0 -6
- package/dist/ast/order.d.ts.map +0 -1
- package/dist/ast/predicate.d.ts +0 -4
- package/dist/ast/predicate.d.ts.map +0 -1
- package/dist/ast/select.d.ts +0 -18
- package/dist/ast/select.d.ts.map +0 -1
- package/dist/ast/types.d.ts +0 -118
- package/dist/ast/types.d.ts.map +0 -1
- package/dist/ast/update.d.ts +0 -9
- package/dist/ast/update.d.ts.map +0 -1
- package/dist/ast/util.d.ts +0 -2
- package/dist/ast/util.d.ts.map +0 -1
- package/dist/chunk-2F7DSEOU.js +0 -8
- package/dist/chunk-2F7DSEOU.js.map +0 -1
- package/dist/chunk-36WJWNHT.js +0 -1
- package/dist/chunk-36WJWNHT.js.map +0 -1
- package/dist/chunk-5N34PNVZ.js +0 -62
- package/dist/chunk-5N34PNVZ.js.map +0 -1
- package/dist/chunk-7I3EMQID.js +0 -16
- package/dist/chunk-7I3EMQID.js.map +0 -1
- package/dist/chunk-D4JLPIWO.js +0 -13
- package/dist/chunk-D4JLPIWO.js.map +0 -1
- package/dist/chunk-G52ENULI.js +0 -1
- package/dist/chunk-G52ENULI.js.map +0 -1
- package/dist/chunk-J6O2HVBM.js +0 -320
- package/dist/chunk-J6O2HVBM.js.map +0 -1
- package/dist/chunk-KYSP7L5C.js +0 -16
- package/dist/chunk-KYSP7L5C.js.map +0 -1
- package/dist/chunk-M23L3JHG.js +0 -159
- package/dist/chunk-M23L3JHG.js.map +0 -1
- package/dist/chunk-U7AXAUJA.js +0 -1
- package/dist/chunk-U7AXAUJA.js.map +0 -1
- package/dist/chunk-U7IAFPVU.js +0 -152
- package/dist/chunk-U7IAFPVU.js.map +0 -1
- package/dist/errors.d.ts +0 -2
- package/dist/errors.d.ts.map +0 -1
- package/dist/exports/ast.d.ts +0 -14
- package/dist/exports/ast.d.ts.map +0 -1
- package/dist/exports/ast.js +0 -46
- package/dist/exports/ast.js.map +0 -1
- package/dist/exports/errors.d.ts +0 -2
- package/dist/exports/errors.d.ts.map +0 -1
- package/dist/exports/errors.js +0 -9
- package/dist/exports/errors.js.map +0 -1
- package/dist/exports/guards.d.ts +0 -2
- package/dist/exports/guards.d.ts.map +0 -1
- package/dist/exports/guards.js +0 -21
- package/dist/exports/guards.js.map +0 -1
- package/dist/exports/operations-registry.d.ts +0 -2
- package/dist/exports/operations-registry.d.ts.map +0 -1
- package/dist/exports/operations-registry.js +0 -9
- package/dist/exports/operations-registry.js.map +0 -1
- package/dist/exports/param.d.ts +0 -3
- package/dist/exports/param.d.ts.map +0 -1
- package/dist/exports/param.js +0 -7
- package/dist/exports/param.js.map +0 -1
- package/dist/exports/plan.d.ts +0 -2
- package/dist/exports/plan.d.ts.map +0 -1
- package/dist/exports/plan.js +0 -7
- package/dist/exports/plan.js.map +0 -1
- package/dist/exports/query-lane-context.d.ts +0 -2
- package/dist/exports/query-lane-context.d.ts.map +0 -1
- package/dist/exports/query-lane-context.js +0 -2
- package/dist/exports/query-lane-context.js.map +0 -1
- package/dist/exports/schema.d.ts +0 -3
- package/dist/exports/schema.d.ts.map +0 -1
- package/dist/exports/schema.js +0 -14
- package/dist/exports/schema.js.map +0 -1
- package/dist/exports/types.d.ts +0 -2
- package/dist/exports/types.d.ts.map +0 -1
- package/dist/exports/types.js +0 -10
- package/dist/exports/types.js.map +0 -1
- package/dist/index.d.ts +0 -9
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -81
- package/dist/index.js.map +0 -1
- package/dist/operations-registry.d.ts +0 -5
- package/dist/operations-registry.d.ts.map +0 -1
- package/dist/param.d.ts +0 -4
- package/dist/param.d.ts.map +0 -1
- package/dist/plan.d.ts +0 -23
- package/dist/plan.d.ts.map +0 -1
- package/dist/query-lane-context.d.ts +0 -16
- package/dist/query-lane-context.d.ts.map +0 -1
- package/dist/schema.d.ts +0 -63
- package/dist/schema.d.ts.map +0 -1
- package/dist/types.d.ts +0 -332
- package/dist/types.d.ts.map +0 -1
- package/dist/utils/guards.d.ts +0 -55
- package/dist/utils/guards.d.ts.map +0 -1
package/dist/ast/join.d.ts
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import type { JoinOnBuilder } from '../types';
|
|
2
|
-
import type { ColumnRef, JoinAst, JoinOnExpr, TableRef } from './types';
|
|
3
|
-
export declare function createJoin(joinType: 'inner' | 'left' | 'right' | 'full', table: TableRef, on: JoinOnExpr): JoinAst;
|
|
4
|
-
export declare function createJoinOnExpr(left: ColumnRef, right: ColumnRef): JoinOnExpr;
|
|
5
|
-
export declare function createJoinOnBuilder(): JoinOnBuilder;
|
|
6
|
-
//# sourceMappingURL=join.d.ts.map
|
package/dist/ast/join.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"join.d.ts","sourceRoot":"","sources":["../../src/ast/join.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAoB,aAAa,EAAmB,MAAM,UAAU,CAAC;AAEjF,OAAO,KAAK,EAAE,SAAS,EAAE,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAExE,wBAAgB,UAAU,CACxB,QAAQ,EAAE,OAAO,GAAG,MAAM,GAAG,OAAO,GAAG,MAAM,EAC7C,KAAK,EAAE,QAAQ,EACf,EAAE,EAAE,UAAU,GACb,OAAO,CAOT;AAED,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,SAAS,GAAG,UAAU,CAM9E;AA2BD,wBAAgB,mBAAmB,IAAI,aAAa,CAEnD"}
|
package/dist/ast/order.d.ts
DELETED
package/dist/ast/order.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"order.d.ts","sourceRoot":"","sources":["../../src/ast/order.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAEnE,wBAAgB,iBAAiB,CAC/B,IAAI,EAAE,SAAS,GAAG,aAAa,EAC/B,GAAG,EAAE,KAAK,GAAG,MAAM,GAClB;IAAE,IAAI,EAAE,SAAS,GAAG,aAAa,CAAC;IAAC,GAAG,EAAE,SAAS,CAAA;CAAE,CAKrD"}
|
package/dist/ast/predicate.d.ts
DELETED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import type { BinaryExpr, BinaryOp, ColumnRef, ExistsExpr, OperationExpr, ParamRef, SelectAst } from './types';
|
|
2
|
-
export declare function createBinaryExpr(op: BinaryOp, left: ColumnRef | OperationExpr, right: ColumnRef | ParamRef): BinaryExpr;
|
|
3
|
-
export declare function createExistsExpr(not: boolean, subquery: SelectAst): ExistsExpr;
|
|
4
|
-
//# sourceMappingURL=predicate.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"predicate.d.ts","sourceRoot":"","sources":["../../src/ast/predicate.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,UAAU,EACV,QAAQ,EACR,SAAS,EACT,UAAU,EACV,aAAa,EACb,QAAQ,EACR,SAAS,EACV,MAAM,SAAS,CAAC;AAEjB,wBAAgB,gBAAgB,CAC9B,EAAE,EAAE,QAAQ,EACZ,IAAI,EAAE,SAAS,GAAG,aAAa,EAC/B,KAAK,EAAE,SAAS,GAAG,QAAQ,GAC1B,UAAU,CAOZ;AAED,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,OAAO,EAAE,QAAQ,EAAE,SAAS,GAAG,UAAU,CAM9E"}
|
package/dist/ast/select.d.ts
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import type { BinaryExpr, ColumnRef, Direction, ExistsExpr, IncludeAst, IncludeRef, JoinAst, OperationExpr, SelectAst, TableRef } from './types';
|
|
2
|
-
export interface CreateSelectAstOptions {
|
|
3
|
-
readonly from: TableRef;
|
|
4
|
-
readonly joins?: ReadonlyArray<JoinAst>;
|
|
5
|
-
readonly includes?: ReadonlyArray<IncludeAst>;
|
|
6
|
-
readonly project: ReadonlyArray<{
|
|
7
|
-
alias: string;
|
|
8
|
-
expr: ColumnRef | IncludeRef | OperationExpr;
|
|
9
|
-
}>;
|
|
10
|
-
readonly where?: BinaryExpr | ExistsExpr;
|
|
11
|
-
readonly orderBy?: ReadonlyArray<{
|
|
12
|
-
expr: ColumnRef | OperationExpr;
|
|
13
|
-
dir: Direction;
|
|
14
|
-
}>;
|
|
15
|
-
readonly limit?: number;
|
|
16
|
-
}
|
|
17
|
-
export declare function createSelectAst(options: CreateSelectAstOptions): SelectAst;
|
|
18
|
-
//# sourceMappingURL=select.d.ts.map
|
package/dist/ast/select.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"select.d.ts","sourceRoot":"","sources":["../../src/ast/select.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,UAAU,EACV,SAAS,EACT,SAAS,EACT,UAAU,EACV,UAAU,EACV,UAAU,EACV,OAAO,EACP,aAAa,EACb,SAAS,EACT,QAAQ,EACT,MAAM,SAAS,CAAC;AAGjB,MAAM,WAAW,sBAAsB;IACrC,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC;IACxB,QAAQ,CAAC,KAAK,CAAC,EAAE,aAAa,CAAC,OAAO,CAAC,CAAC;IACxC,QAAQ,CAAC,QAAQ,CAAC,EAAE,aAAa,CAAC,UAAU,CAAC,CAAC;IAC9C,QAAQ,CAAC,OAAO,EAAE,aAAa,CAAC;QAC9B,KAAK,EAAE,MAAM,CAAC;QACd,IAAI,EAAE,SAAS,GAAG,UAAU,GAAG,aAAa,CAAC;KAC9C,CAAC,CAAC;IACH,QAAQ,CAAC,KAAK,CAAC,EAAE,UAAU,GAAG,UAAU,CAAC;IACzC,QAAQ,CAAC,OAAO,CAAC,EAAE,aAAa,CAAC;QAAE,IAAI,EAAE,SAAS,GAAG,aAAa,CAAC;QAAC,GAAG,EAAE,SAAS,CAAA;KAAE,CAAC,CAAC;IACtF,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;CACzB;AAED,wBAAgB,eAAe,CAAC,OAAO,EAAE,sBAAsB,GAAG,SAAS,CAW1E"}
|
package/dist/ast/types.d.ts
DELETED
|
@@ -1,118 +0,0 @@
|
|
|
1
|
-
import type { ReturnSpec } from '@prisma-next/operations';
|
|
2
|
-
import type { SqlLoweringSpec } from '@prisma-next/sql-operations';
|
|
3
|
-
export type Direction = 'asc' | 'desc';
|
|
4
|
-
export interface TableRef {
|
|
5
|
-
readonly kind: 'table';
|
|
6
|
-
readonly name: string;
|
|
7
|
-
}
|
|
8
|
-
export interface ColumnRef {
|
|
9
|
-
readonly kind: 'col';
|
|
10
|
-
readonly table: string;
|
|
11
|
-
readonly column: string;
|
|
12
|
-
}
|
|
13
|
-
export interface ParamRef {
|
|
14
|
-
readonly kind: 'param';
|
|
15
|
-
readonly index: number;
|
|
16
|
-
readonly name?: string;
|
|
17
|
-
}
|
|
18
|
-
export interface LiteralExpr {
|
|
19
|
-
readonly kind: 'literal';
|
|
20
|
-
readonly value: unknown;
|
|
21
|
-
}
|
|
22
|
-
export interface OperationExpr {
|
|
23
|
-
readonly kind: 'operation';
|
|
24
|
-
readonly method: string;
|
|
25
|
-
readonly forTypeId: string;
|
|
26
|
-
readonly self: ColumnRef | OperationExpr;
|
|
27
|
-
readonly args: ReadonlyArray<ColumnRef | ParamRef | LiteralExpr | OperationExpr>;
|
|
28
|
-
readonly returns: ReturnSpec;
|
|
29
|
-
readonly lowering: SqlLoweringSpec;
|
|
30
|
-
}
|
|
31
|
-
export declare function isOperationExpr(expr: ColumnRef | OperationExpr): expr is OperationExpr;
|
|
32
|
-
export type BinaryOp = 'eq' | 'neq' | 'gt' | 'lt' | 'gte' | 'lte';
|
|
33
|
-
export interface BinaryExpr {
|
|
34
|
-
readonly kind: 'bin';
|
|
35
|
-
readonly op: BinaryOp;
|
|
36
|
-
readonly left: ColumnRef | OperationExpr;
|
|
37
|
-
readonly right: ColumnRef | ParamRef;
|
|
38
|
-
}
|
|
39
|
-
export interface ExistsExpr {
|
|
40
|
-
readonly kind: 'exists';
|
|
41
|
-
readonly not: boolean;
|
|
42
|
-
readonly subquery: SelectAst;
|
|
43
|
-
}
|
|
44
|
-
export type JoinOnExpr = {
|
|
45
|
-
readonly kind: 'eqCol';
|
|
46
|
-
readonly left: ColumnRef;
|
|
47
|
-
readonly right: ColumnRef;
|
|
48
|
-
};
|
|
49
|
-
export interface JoinAst {
|
|
50
|
-
readonly kind: 'join';
|
|
51
|
-
readonly joinType: 'inner' | 'left' | 'right' | 'full';
|
|
52
|
-
readonly table: TableRef;
|
|
53
|
-
readonly on: JoinOnExpr;
|
|
54
|
-
}
|
|
55
|
-
export interface IncludeRef {
|
|
56
|
-
readonly kind: 'includeRef';
|
|
57
|
-
readonly alias: string;
|
|
58
|
-
}
|
|
59
|
-
export interface IncludeAst {
|
|
60
|
-
readonly kind: 'includeMany';
|
|
61
|
-
readonly alias: string;
|
|
62
|
-
readonly child: {
|
|
63
|
-
readonly table: TableRef;
|
|
64
|
-
readonly on: JoinOnExpr;
|
|
65
|
-
readonly where?: BinaryExpr | ExistsExpr;
|
|
66
|
-
readonly orderBy?: ReadonlyArray<{
|
|
67
|
-
expr: ColumnRef | OperationExpr;
|
|
68
|
-
dir: Direction;
|
|
69
|
-
}>;
|
|
70
|
-
readonly limit?: number;
|
|
71
|
-
readonly project: ReadonlyArray<{
|
|
72
|
-
alias: string;
|
|
73
|
-
expr: ColumnRef | OperationExpr;
|
|
74
|
-
}>;
|
|
75
|
-
};
|
|
76
|
-
}
|
|
77
|
-
export interface SelectAst {
|
|
78
|
-
readonly kind: 'select';
|
|
79
|
-
readonly from: TableRef;
|
|
80
|
-
readonly joins?: ReadonlyArray<JoinAst>;
|
|
81
|
-
readonly includes?: ReadonlyArray<IncludeAst>;
|
|
82
|
-
readonly project: ReadonlyArray<{
|
|
83
|
-
alias: string;
|
|
84
|
-
expr: ColumnRef | IncludeRef | OperationExpr | LiteralExpr;
|
|
85
|
-
}>;
|
|
86
|
-
readonly where?: BinaryExpr | ExistsExpr;
|
|
87
|
-
readonly orderBy?: ReadonlyArray<{
|
|
88
|
-
expr: ColumnRef | OperationExpr;
|
|
89
|
-
dir: Direction;
|
|
90
|
-
}>;
|
|
91
|
-
readonly limit?: number;
|
|
92
|
-
}
|
|
93
|
-
export interface InsertAst {
|
|
94
|
-
readonly kind: 'insert';
|
|
95
|
-
readonly table: TableRef;
|
|
96
|
-
readonly values: Record<string, ColumnRef | ParamRef>;
|
|
97
|
-
readonly returning?: ReadonlyArray<ColumnRef>;
|
|
98
|
-
}
|
|
99
|
-
export interface UpdateAst {
|
|
100
|
-
readonly kind: 'update';
|
|
101
|
-
readonly table: TableRef;
|
|
102
|
-
readonly set: Record<string, ColumnRef | ParamRef>;
|
|
103
|
-
readonly where: BinaryExpr;
|
|
104
|
-
readonly returning?: ReadonlyArray<ColumnRef>;
|
|
105
|
-
}
|
|
106
|
-
export interface DeleteAst {
|
|
107
|
-
readonly kind: 'delete';
|
|
108
|
-
readonly table: TableRef;
|
|
109
|
-
readonly where: BinaryExpr;
|
|
110
|
-
readonly returning?: ReadonlyArray<ColumnRef>;
|
|
111
|
-
}
|
|
112
|
-
export type QueryAst = SelectAst | InsertAst | UpdateAst | DeleteAst;
|
|
113
|
-
export interface LoweredStatement {
|
|
114
|
-
readonly sql: string;
|
|
115
|
-
readonly params: readonly unknown[];
|
|
116
|
-
readonly annotations?: Record<string, unknown>;
|
|
117
|
-
}
|
|
118
|
-
//# sourceMappingURL=types.d.ts.map
|
package/dist/ast/types.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/ast/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAKnE,MAAM,MAAM,SAAS,GAAG,KAAK,GAAG,MAAM,CAAC;AAEvC,MAAM,WAAW,QAAQ;IACvB,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;IACvB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,SAAS;IACxB,QAAQ,CAAC,IAAI,EAAE,KAAK,CAAC;IACrB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB;AAED,MAAM,WAAW,QAAQ;IACvB,QAAQ,C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E,QAAQ,CAAC;IACxB,QAAQ,CAAC,KAAK,EAAE,QAAQ,CAAC;IACzB,QAAQ,CAAC,KAAK,EAAE,UAAU,CAAC;IAC3B,QAAQ,CAAC,SAAS,CAAC,EAAE,aAAa,CAAC,SAAS,CAAC,CAAC;CAC/C;AAED,MAAM,MAAM,QAAQ,GAAG,SAAS,GAAG,SAAS,GAAG,SAAS,GAAG,SAAS,CAAC;AAErE,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,MAAM,EAAE,SAAS,OAAO,EAAE,CAAC;IACpC,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAChD"}
|
package/dist/ast/update.d.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type { BinaryExpr, ColumnRef, ParamRef, TableRef, UpdateAst } from './types';
|
|
2
|
-
export interface CreateUpdateAstOptions {
|
|
3
|
-
readonly table: TableRef;
|
|
4
|
-
readonly set: Record<string, ColumnRef | ParamRef>;
|
|
5
|
-
readonly where: BinaryExpr;
|
|
6
|
-
readonly returning?: ReadonlyArray<ColumnRef>;
|
|
7
|
-
}
|
|
8
|
-
export declare function createUpdateAst(options: CreateUpdateAstOptions): UpdateAst;
|
|
9
|
-
//# sourceMappingURL=update.d.ts.map
|
package/dist/ast/update.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"update.d.ts","sourceRoot":"","sources":["../../src/ast/update.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,QAAQ,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAGpF,MAAM,WAAW,sBAAsB;IACrC,QAAQ,CAAC,KAAK,EAAE,QAAQ,CAAC;IACzB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,GAAG,QAAQ,CAAC,CAAC;IACnD,QAAQ,CAAC,KAAK,EAAE,UAAU,CAAC;IAC3B,QAAQ,CAAC,SAAS,CAAC,EAAE,aAAa,CAAC,SAAS,CAAC,CAAC;CAC/C;AAED,wBAAgB,eAAe,CAAC,OAAO,EAAE,sBAAsB,GAAG,SAAS,CAQ1E"}
|
package/dist/ast/util.d.ts
DELETED
package/dist/ast/util.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"util.d.ts","sourceRoot":"","sources":["../../src/ast/util.ts"],"names":[],"mappings":"AAAA,wBAAgB,OAAO,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,CAAC,EAAE,CAAC,GAAG,CAAC,CAQlE"}
|
package/dist/chunk-2F7DSEOU.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/errors.ts"],"sourcesContent":["export { planInvalid, planUnsupported } from '@prisma-next/plan';\n"],"mappings":";AAAA,SAAS,aAAa,uBAAuB;","names":[]}
|
package/dist/chunk-36WJWNHT.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
//# sourceMappingURL=chunk-36WJWNHT.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
package/dist/chunk-5N34PNVZ.js
DELETED
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
// src/utils/guards.ts
|
|
2
|
-
function getColumnMeta(expr) {
|
|
3
|
-
if ("columnMeta" in expr) {
|
|
4
|
-
return expr.columnMeta;
|
|
5
|
-
}
|
|
6
|
-
return void 0;
|
|
7
|
-
}
|
|
8
|
-
function isParamPlaceholder(value) {
|
|
9
|
-
return typeof value === "object" && value !== null && "kind" in value && value.kind === "param-placeholder" && "name" in value && typeof value.name === "string";
|
|
10
|
-
}
|
|
11
|
-
function extractBaseColumnRef(expr) {
|
|
12
|
-
if (expr.kind === "col") {
|
|
13
|
-
return expr;
|
|
14
|
-
}
|
|
15
|
-
return extractBaseColumnRef(expr.self);
|
|
16
|
-
}
|
|
17
|
-
function collectColumnRefs(expr) {
|
|
18
|
-
if (expr.kind === "col") {
|
|
19
|
-
return [expr];
|
|
20
|
-
}
|
|
21
|
-
if (expr.kind === "operation") {
|
|
22
|
-
const refs = collectColumnRefs(expr.self);
|
|
23
|
-
for (const arg of expr.args) {
|
|
24
|
-
refs.push(...collectColumnRefs(arg));
|
|
25
|
-
}
|
|
26
|
-
return refs;
|
|
27
|
-
}
|
|
28
|
-
return [];
|
|
29
|
-
}
|
|
30
|
-
function isOperationExpr(expr) {
|
|
31
|
-
return typeof expr === "object" && expr !== null && "kind" in expr && expr.kind === "operation";
|
|
32
|
-
}
|
|
33
|
-
function getColumnInfo(expr) {
|
|
34
|
-
if (isOperationExpr(expr)) {
|
|
35
|
-
const baseCol = extractBaseColumnRef(expr);
|
|
36
|
-
return { table: baseCol.table, column: baseCol.column };
|
|
37
|
-
}
|
|
38
|
-
const colBuilder = expr;
|
|
39
|
-
return { table: colBuilder.table, column: colBuilder.column };
|
|
40
|
-
}
|
|
41
|
-
function isColumnBuilder(value) {
|
|
42
|
-
return typeof value === "object" && value !== null && "kind" in value && value.kind === "column";
|
|
43
|
-
}
|
|
44
|
-
function getOperationExpr(builder) {
|
|
45
|
-
if (isOperationExpr(builder)) {
|
|
46
|
-
return builder;
|
|
47
|
-
}
|
|
48
|
-
const builderWithExpr = builder;
|
|
49
|
-
return builderWithExpr._operationExpr;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
export {
|
|
53
|
-
getColumnMeta,
|
|
54
|
-
isParamPlaceholder,
|
|
55
|
-
extractBaseColumnRef,
|
|
56
|
-
collectColumnRefs,
|
|
57
|
-
isOperationExpr,
|
|
58
|
-
getColumnInfo,
|
|
59
|
-
isColumnBuilder,
|
|
60
|
-
getOperationExpr
|
|
61
|
-
};
|
|
62
|
-
//# sourceMappingURL=chunk-5N34PNVZ.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/utils/guards.ts"],"sourcesContent":["import type { StorageColumn } from '@prisma-next/sql-contract/types';\nimport type { ColumnRef, LiteralExpr, OperationExpr, ParamRef } from '../ast/types';\nimport type { AnyColumnBuilder, ParamPlaceholder } from '../types';\n\n/**\n * Helper to extract columnMeta from a ColumnBuilder.\n * Returns StorageColumn if present, undefined otherwise.\n * AnyColumnBuilder is a union that includes types with columnMeta property,\n * so we can safely access it after checking for existence.\n */\nexport function getColumnMeta(expr: AnyColumnBuilder): StorageColumn | undefined {\n // AnyColumnBuilder includes AnyColumnBuilderBase which has columnMeta: StorageColumn\n // and ColumnBuilder which has columnMeta: ColumnMeta extends StorageColumn\n // TypeScript should narrow the type after the 'in' check\n if ('columnMeta' in expr) {\n return expr.columnMeta;\n }\n return undefined;\n}\n\n/**\n * Type predicate to check if a value is a ParamPlaceholder.\n */\nexport function isParamPlaceholder(value: unknown): value is ParamPlaceholder {\n return (\n typeof value === 'object' &&\n value !== null &&\n 'kind' in value &&\n (value as { kind: unknown }).kind === 'param-placeholder' &&\n 'name' in value &&\n typeof (value as { name: unknown }).name === 'string'\n );\n}\n\n/**\n * Recursively extracts the base ColumnRef from an OperationExpr.\n * If the expression is already a ColumnRef, it is returned directly.\n */\nexport function extractBaseColumnRef(expr: ColumnRef | OperationExpr): ColumnRef {\n if (expr.kind === 'col') {\n return expr;\n }\n return extractBaseColumnRef(expr.self);\n}\n\n/**\n * Recursively collects all ColumnRef nodes from an expression tree.\n * Handles nested OperationExpr structures by traversing both self and args.\n */\nexport function collectColumnRefs(\n expr: ColumnRef | ParamRef | LiteralExpr | OperationExpr,\n): ColumnRef[] {\n if (expr.kind === 'col') {\n return [expr];\n }\n if (expr.kind === 'operation') {\n const refs: ColumnRef[] = collectColumnRefs(expr.self);\n for (const arg of expr.args) {\n refs.push(...collectColumnRefs(arg));\n }\n return refs;\n }\n return [];\n}\n\n/**\n * Type predicate to check if an expression is an OperationExpr.\n */\nexport function isOperationExpr(expr: AnyColumnBuilder | OperationExpr): expr is OperationExpr {\n return typeof expr === 'object' && expr !== null && 'kind' in expr && expr.kind === 'operation';\n}\n\n/**\n * Helper to extract table and column from a ColumnBuilder or OperationExpr.\n * For OperationExpr, recursively unwraps to find the base ColumnRef.\n */\nexport function getColumnInfo(expr: AnyColumnBuilder | OperationExpr): {\n table: string;\n column: string;\n} {\n if (isOperationExpr(expr)) {\n const baseCol = extractBaseColumnRef(expr);\n return { table: baseCol.table, column: baseCol.column };\n }\n // expr is ColumnBuilder - TypeScript can't narrow properly\n const colBuilder = expr as unknown as { table: string; column: string };\n return { table: colBuilder.table, column: colBuilder.column };\n}\n\n/**\n * Type predicate to check if a value is a ColumnBuilder.\n */\nexport function isColumnBuilder(value: unknown): value is AnyColumnBuilder {\n return (\n typeof value === 'object' &&\n value !== null &&\n 'kind' in value &&\n (value as { kind: unknown }).kind === 'column'\n );\n}\n\n/**\n * Extracts and returns an OperationExpr from a builder.\n * Returns the OperationExpr if the builder is an OperationExpr or has an _operationExpr property,\n * otherwise returns undefined.\n *\n * @design-note: This function accesses the hidden `_operationExpr` property, which is a code smell.\n * The issue is that `executeOperation()` in relational-core returns a ColumnBuilder-shaped object\n * with a hidden `_operationExpr` property, creating coupling between lanes and relational-core\n * implementation details. A cleaner design would be to have operation results be a separate\n * type (e.g., `OperationResultBuilder`) that properly represents expression nodes rather than\n * pretending to be a ColumnBuilder. This would require refactoring the operation execution\n * system in relational-core to return proper expression types.\n */\nexport function getOperationExpr(\n builder: AnyColumnBuilder | OperationExpr,\n): OperationExpr | undefined {\n if (isOperationExpr(builder)) {\n return builder;\n }\n const builderWithExpr = builder as unknown as { _operationExpr?: OperationExpr };\n return builderWithExpr._operationExpr;\n}\n"],"mappings":";AAUO,SAAS,cAAc,MAAmD;AAI/E,MAAI,gBAAgB,MAAM;AACxB,WAAO,KAAK;AAAA,EACd;AACA,SAAO;AACT;AAKO,SAAS,mBAAmB,OAA2C;AAC5E,SACE,OAAO,UAAU,YACjB,UAAU,QACV,UAAU,SACT,MAA4B,SAAS,uBACtC,UAAU,SACV,OAAQ,MAA4B,SAAS;AAEjD;AAMO,SAAS,qBAAqB,MAA4C;AAC/E,MAAI,KAAK,SAAS,OAAO;AACvB,WAAO;AAAA,EACT;AACA,SAAO,qBAAqB,KAAK,IAAI;AACvC;AAMO,SAAS,kBACd,MACa;AACb,MAAI,KAAK,SAAS,OAAO;AACvB,WAAO,CAAC,IAAI;AAAA,EACd;AACA,MAAI,KAAK,SAAS,aAAa;AAC7B,UAAM,OAAoB,kBAAkB,KAAK,IAAI;AACrD,eAAW,OAAO,KAAK,MAAM;AAC3B,WAAK,KAAK,GAAG,kBAAkB,GAAG,CAAC;AAAA,IACrC;AACA,WAAO;AAAA,EACT;AACA,SAAO,CAAC;AACV;AAKO,SAAS,gBAAgB,MAA+D;AAC7F,SAAO,OAAO,SAAS,YAAY,SAAS,QAAQ,UAAU,QAAQ,KAAK,SAAS;AACtF;AAMO,SAAS,cAAc,MAG5B;AACA,MAAI,gBAAgB,IAAI,GAAG;AACzB,UAAM,UAAU,qBAAqB,IAAI;AACzC,WAAO,EAAE,OAAO,QAAQ,OAAO,QAAQ,QAAQ,OAAO;AAAA,EACxD;AAEA,QAAM,aAAa;AACnB,SAAO,EAAE,OAAO,WAAW,OAAO,QAAQ,WAAW,OAAO;AAC9D;AAKO,SAAS,gBAAgB,OAA2C;AACzE,SACE,OAAO,UAAU,YACjB,UAAU,QACV,UAAU,SACT,MAA4B,SAAS;AAE1C;AAeO,SAAS,iBACd,SAC2B;AAC3B,MAAI,gBAAgB,OAAO,GAAG;AAC5B,WAAO;AAAA,EACT;AACA,QAAM,kBAAkB;AACxB,SAAO,gBAAgB;AACzB;","names":[]}
|
package/dist/chunk-7I3EMQID.js
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
// src/param.ts
|
|
2
|
-
import { planInvalid } from "@prisma-next/plan";
|
|
3
|
-
function param(name) {
|
|
4
|
-
if (typeof name !== "string" || name.length === 0) {
|
|
5
|
-
throw planInvalid("Parameter name must be a non-empty string");
|
|
6
|
-
}
|
|
7
|
-
return Object.freeze({
|
|
8
|
-
kind: "param-placeholder",
|
|
9
|
-
name
|
|
10
|
-
});
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export {
|
|
14
|
-
param
|
|
15
|
-
};
|
|
16
|
-
//# sourceMappingURL=chunk-7I3EMQID.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/param.ts"],"sourcesContent":["import { planInvalid } from '@prisma-next/plan';\nimport type { ParamPlaceholder } from './types';\n\nexport type Parameter = ParamPlaceholder;\n\nexport function param(name: string): Parameter {\n if (typeof name !== 'string' || name.length === 0) {\n throw planInvalid('Parameter name must be a non-empty string');\n }\n\n return Object.freeze({\n kind: 'param-placeholder' as const,\n name,\n }) satisfies Parameter;\n}\n"],"mappings":";AAAA,SAAS,mBAAmB;AAKrB,SAAS,MAAM,MAAyB;AAC7C,MAAI,OAAO,SAAS,YAAY,KAAK,WAAW,GAAG;AACjD,UAAM,YAAY,2CAA2C;AAAA,EAC/D;AAEA,SAAO,OAAO,OAAO;AAAA,IACnB,MAAM;AAAA,IACN;AAAA,EACF,CAAC;AACH;","names":[]}
|
package/dist/chunk-D4JLPIWO.js
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
// src/types.ts
|
|
2
|
-
function createOrderBuilder(expr, dir) {
|
|
3
|
-
return { kind: "order", expr, dir };
|
|
4
|
-
}
|
|
5
|
-
function isColumnBuilder(value) {
|
|
6
|
-
return typeof value === "object" && value !== null && "kind" in value && value.kind === "column";
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
export {
|
|
10
|
-
createOrderBuilder,
|
|
11
|
-
isColumnBuilder
|
|
12
|
-
};
|
|
13
|
-
//# sourceMappingURL=chunk-D4JLPIWO.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/types.ts"],"sourcesContent":["import type {\n ResultType as CoreResultType,\n ExecutionPlan,\n PlanRefs,\n} from '@prisma-next/contract/types';\nimport type { ArgSpec, ReturnSpec } from '@prisma-next/operations';\nimport type { SqlContract, SqlStorage, StorageColumn } from '@prisma-next/sql-contract/types';\nimport type { SqlLoweringSpec } from '@prisma-next/sql-operations';\nimport type {\n BinaryOp,\n ColumnRef,\n Direction,\n OperationExpr,\n ParamRef,\n QueryAst,\n} from './ast/types';\nimport type { SqlQueryPlan } from './plan';\nimport type { QueryLaneContext } from './query-lane-context';\n\nexport interface ParamPlaceholder {\n readonly kind: 'param-placeholder';\n readonly name: string;\n}\n\nexport interface OrderBuilder<\n ColumnName extends string = string,\n ColumnMeta extends StorageColumn = StorageColumn,\n JsType = unknown,\n> {\n readonly kind: 'order';\n readonly expr: ColumnBuilder<ColumnName, ColumnMeta, JsType> | OperationExpr;\n readonly dir: Direction;\n}\n\n/**\n * Creates an OrderBuilder for use in orderBy clauses.\n */\nexport function createOrderBuilder(\n expr: AnyColumnBuilder | OperationExpr,\n dir: Direction,\n): AnyOrderBuilder {\n return { kind: 'order', expr, dir } as AnyOrderBuilder;\n}\n\n/**\n * ColumnBuilder with optional operation methods based on the column's typeId.\n * When Operations is provided and the column's typeId matches, operation methods are included.\n */\nexport type ColumnBuilder<\n ColumnName extends string = string,\n ColumnMeta extends StorageColumn = StorageColumn,\n JsType = unknown,\n Operations extends OperationTypes = Record<string, never>,\n> = {\n readonly kind: 'column';\n readonly table: string;\n readonly column: ColumnName;\n readonly columnMeta: ColumnMeta;\n eq(value: ParamPlaceholder | AnyColumnBuilderBase): BinaryBuilder<ColumnName, ColumnMeta, JsType>;\n neq(\n value: ParamPlaceholder | AnyColumnBuilderBase,\n ): BinaryBuilder<ColumnName, ColumnMeta, JsType>;\n gt(value: ParamPlaceholder | AnyColumnBuilderBase): BinaryBuilder<ColumnName, ColumnMeta, JsType>;\n lt(value: ParamPlaceholder | AnyColumnBuilderBase): BinaryBuilder<ColumnName, ColumnMeta, JsType>;\n gte(\n value: ParamPlaceholder | AnyColumnBuilderBase,\n ): BinaryBuilder<ColumnName, ColumnMeta, JsType>;\n lte(\n value: ParamPlaceholder | AnyColumnBuilderBase,\n ): BinaryBuilder<ColumnName, ColumnMeta, JsType>;\n asc(): OrderBuilder<ColumnName, ColumnMeta, JsType>;\n desc(): OrderBuilder<ColumnName, ColumnMeta, JsType>;\n // Helper property for type extraction (not used at runtime)\n readonly __jsType: JsType;\n} & (ColumnMeta['codecId'] extends string\n ? ColumnMeta['codecId'] extends keyof Operations\n ? OperationMethods<\n OperationsForTypeId<ColumnMeta['codecId'] & string, Operations>,\n ColumnName,\n StorageColumn,\n JsType\n >\n : Record<string, never>\n : Record<string, never>);\n\nexport interface BinaryBuilder<\n ColumnName extends string = string,\n ColumnMeta extends StorageColumn = StorageColumn,\n JsType = unknown,\n> {\n readonly kind: 'binary';\n readonly op: BinaryOp;\n readonly left: ColumnBuilder<ColumnName, ColumnMeta, JsType> | OperationExpr;\n readonly right: ParamPlaceholder | AnyColumnBuilderBase;\n}\n\n// Helper aliases for usage sites where the specific column parameters are irrelevant\n// Accepts any ColumnBuilder regardless of its Operations parameter\n// Note: We use `any` here because TypeScript's variance rules don't allow us to express\n// \"any type that extends OperationTypes\" in a way that works for assignment.\n// Contract-specific OperationTypes (e.g., PgVectorOperationTypes) are not assignable\n// to the base OperationTypes in generic parameter position, even though they extend it structurally.\n// Helper type that accepts any ColumnBuilder regardless of its generic parameters\n// This is needed because conditional types in ColumnBuilder create incompatible intersection types\n// when Operations differs, even though structurally they're compatible\nexport type AnyColumnBuilderBase = {\n readonly kind: 'column';\n readonly table: string;\n readonly column: string;\n readonly columnMeta: StorageColumn;\n eq(value: ParamPlaceholder | AnyColumnBuilderBase): AnyBinaryBuilder;\n neq(value: ParamPlaceholder | AnyColumnBuilderBase): AnyBinaryBuilder;\n gt(value: ParamPlaceholder | AnyColumnBuilderBase): AnyBinaryBuilder;\n lt(value: ParamPlaceholder | AnyColumnBuilderBase): AnyBinaryBuilder;\n gte(value: ParamPlaceholder | AnyColumnBuilderBase): AnyBinaryBuilder;\n lte(value: ParamPlaceholder | AnyColumnBuilderBase): AnyBinaryBuilder;\n asc(): AnyOrderBuilder;\n desc(): AnyOrderBuilder;\n readonly __jsType: unknown;\n // Allow any operation methods (from conditional type)\n readonly [key: string]: unknown;\n};\n\nexport type AnyColumnBuilder =\n | ColumnBuilder<\n string,\n StorageColumn,\n unknown,\n // biome-ignore lint/suspicious/noExplicitAny: AnyColumnBuilder must accept column builders with any operation types\n any\n >\n | AnyColumnBuilderBase;\nexport type AnyBinaryBuilder = BinaryBuilder<string, StorageColumn, unknown>;\nexport type AnyOrderBuilder = OrderBuilder<string, StorageColumn, unknown>;\n\nexport function isColumnBuilder(value: unknown): value is AnyColumnBuilder {\n return (\n typeof value === 'object' &&\n value !== null &&\n 'kind' in value &&\n (value as { kind: unknown }).kind === 'column'\n );\n}\n\nexport interface JoinOnBuilder {\n eqCol(left: AnyColumnBuilder, right: AnyColumnBuilder): JoinOnPredicate;\n}\n\nexport interface JoinOnPredicate {\n readonly kind: 'join-on';\n readonly left: AnyColumnBuilder;\n readonly right: AnyColumnBuilder;\n}\n\nexport type Expr = ColumnRef | ParamRef;\n\n/**\n * Helper type to extract codec output type from CodecTypes.\n * Returns never if the codecId is not found in CodecTypes.\n */\ntype ExtractCodecOutputType<\n CodecId extends string,\n CodecTypes extends Record<string, { readonly output: unknown }>,\n> = CodecId extends keyof CodecTypes\n ? CodecTypes[CodecId] extends { readonly output: infer Output }\n ? Output\n : never\n : never;\n\n/**\n * Type-level operation signature.\n * Represents an operation at the type level, similar to OperationSignature at runtime.\n */\nexport type OperationTypeSignature = {\n readonly args: ReadonlyArray<ArgSpec>;\n readonly returns: ReturnSpec;\n readonly lowering: SqlLoweringSpec;\n readonly capabilities?: ReadonlyArray<string>;\n};\n\n/**\n * Type-level operation registry.\n * Maps typeId → operations, where operations is a record of method name → operation signature.\n *\n * Example:\n * ```typescript\n * type MyOperations: OperationTypes = {\n * 'pg/vector@1': {\n * cosineDistance: {\n * args: [{ kind: 'typeId'; type: 'pg/vector@1' }];\n * returns: { kind: 'builtin'; type: 'number' };\n * lowering: { targetFamily: 'sql'; strategy: 'function'; template: '...' };\n * };\n * };\n * };\n * ```\n */\nexport type OperationTypes = Record<string, Record<string, OperationTypeSignature>>;\n\n/**\n * CodecTypes represents a map of typeId to codec definitions.\n * Each codec definition must have an `output` property indicating the JavaScript type.\n *\n * Example:\n * ```typescript\n * type MyCodecTypes: CodecTypes = {\n * 'pg/int4@1': { output: number };\n * 'pg/text@1': { output: string };\n * };\n * ```\n */\nexport type CodecTypes = Record<string, { readonly output: unknown }>;\n\n/**\n * Extracts operations for a given typeId from the operation registry.\n * Returns an empty record if the typeId is not found.\n *\n * @example\n * ```typescript\n * type Ops = OperationsForTypeId<'pg/vector@1', MyOperations>;\n * // Ops = { cosineDistance: { ... }, l2Distance: { ... } }\n * ```\n */\nexport type OperationsForTypeId<\n TypeId extends string,\n Operations extends OperationTypes,\n> = Operations extends Record<string, never>\n ? Record<string, never>\n : TypeId extends keyof Operations\n ? Operations[TypeId]\n : Record<string, never>;\n\n/**\n * Maps operation signatures to method signatures on ColumnBuilder.\n * Each operation becomes a method that returns a ColumnBuilder or BinaryBuilder\n * based on the return type.\n */\ntype OperationMethods<\n Ops extends Record<string, OperationTypeSignature>,\n ColumnName extends string,\n ColumnMeta extends StorageColumn,\n JsType,\n> = {\n [K in keyof Ops]: Ops[K] extends OperationTypeSignature\n ? (\n ...args: OperationArgs<Ops[K]['args']>\n ) => OperationReturn<Ops[K]['returns'], ColumnName, ColumnMeta, JsType>\n : never;\n};\n\n/**\n * Maps operation argument specs to TypeScript argument types.\n * - typeId args: ColumnBuilder (accepts base columns or operation results)\n * - param args: ParamPlaceholder\n * - literal args: unknown (could be more specific in future)\n */\ntype OperationArgs<Args extends ReadonlyArray<ArgSpec>> = Args extends readonly [\n infer First,\n ...infer Rest,\n]\n ? First extends ArgSpec\n ? [ArgToType<First>, ...(Rest extends ReadonlyArray<ArgSpec> ? OperationArgs<Rest> : [])]\n : []\n : [];\n\ntype ArgToType<Arg extends ArgSpec> = Arg extends { kind: 'typeId' }\n ? AnyColumnBuilder\n : Arg extends { kind: 'param' }\n ? ParamPlaceholder\n : Arg extends { kind: 'literal' }\n ? unknown\n : never;\n\n/**\n * Maps operation return spec to return type.\n * - builtin types: ColumnBuilder with appropriate JsType (matches runtime behavior)\n * - typeId types: ColumnBuilder (for now, could be more specific in future)\n */\ntype OperationReturn<\n Returns extends ReturnSpec,\n ColumnName extends string,\n ColumnMeta extends StorageColumn,\n _JsType,\n> = Returns extends { kind: 'builtin'; type: infer T }\n ? T extends 'number'\n ? ColumnBuilder<ColumnName, ColumnMeta, number>\n : T extends 'boolean'\n ? ColumnBuilder<ColumnName, ColumnMeta, boolean>\n : T extends 'string'\n ? ColumnBuilder<ColumnName, ColumnMeta, string>\n : ColumnBuilder<ColumnName, ColumnMeta, unknown>\n : Returns extends { kind: 'typeId' }\n ? AnyColumnBuilder\n : ColumnBuilder<ColumnName, ColumnMeta, unknown>;\n\n/**\n * Computes JavaScript type for a column at column creation time.\n *\n * Type inference:\n * - Read columnMeta.codecId as typeId string literal\n * - Look up CodecTypes[typeId].output\n * - Apply nullability: nullable ? Output | null : Output\n */\ntype ColumnMetaTypeId<ColumnMeta> = ColumnMeta extends { codecId: infer CodecId extends string }\n ? CodecId\n : ColumnMeta extends { type: infer TypeId extends string }\n ? TypeId\n : never;\n\nexport type ComputeColumnJsType<\n _Contract extends SqlContract<SqlStorage>,\n _TableName extends string,\n _ColumnName extends string,\n ColumnMeta extends StorageColumn,\n CodecTypes extends Record<string, { readonly output: unknown }>,\n> = ColumnMeta extends { nullable: infer Nullable }\n ? ColumnMetaTypeId<ColumnMeta> extends infer TypeId\n ? TypeId extends string\n ? ExtractCodecOutputType<TypeId, CodecTypes> extends infer CodecOutput\n ? [CodecOutput] extends [never]\n ? unknown // Codec not found in CodecTypes\n : Nullable extends true\n ? CodecOutput | null\n : CodecOutput\n : unknown\n : unknown\n : unknown\n : unknown;\n\n/**\n * Infers Row type from a projection object.\n * Maps Record<string, ColumnBuilder> to Record<string, JSType>\n *\n * Extracts the pre-computed JsType from each ColumnBuilder in the projection.\n */\n/**\n * Extracts the inferred JsType carried by a ColumnBuilder.\n */\ntype ExtractJsTypeFromColumnBuilder<CB extends AnyColumnBuilder> =\n CB extends ColumnBuilder<\n infer _ColumnName extends string,\n infer _ColumnMeta extends StorageColumn,\n infer JsType,\n infer _Ops\n >\n ? JsType\n : never;\n\nexport type InferProjectionRow<P extends Record<string, AnyColumnBuilder>> = {\n [K in keyof P]: ExtractJsTypeFromColumnBuilder<P[K]>;\n};\n\n/**\n * Nested projection type - allows recursive nesting of ColumnBuilder or nested objects.\n */\nexport type NestedProjection = Record<\n string,\n | AnyColumnBuilder\n | Record<\n string,\n | AnyColumnBuilder\n | Record<\n string,\n AnyColumnBuilder | Record<string, AnyColumnBuilder | Record<string, AnyColumnBuilder>>\n >\n >\n>;\n\n/**\n * Helper type to extract include type from Includes map.\n * Returns the value type if K is a key of Includes, otherwise returns unknown.\n */\ntype ExtractIncludeType<\n K extends string,\n Includes extends Record<string, unknown>,\n> = K extends keyof Includes ? Includes[K] : unknown;\n\n/**\n * Infers Row type from a nested projection object.\n * Recursively maps Record<string, ColumnBuilder | boolean | NestedProjection> to nested object types.\n *\n * Extracts the pre-computed JsType from each ColumnBuilder at leaves.\n * When a value is `true`, it represents an include reference and infers `Array<ChildShape>`\n * by looking up the include alias in the Includes type map.\n */\nexport type InferNestedProjectionRow<\n P extends Record<string, AnyColumnBuilder | boolean | NestedProjection>,\n CodecTypes extends Record<string, { readonly output: unknown }> = Record<string, never>,\n Includes extends Record<string, unknown> = Record<string, never>,\n> = {\n [K in keyof P]: P[K] extends AnyColumnBuilder\n ? ExtractJsTypeFromColumnBuilder<P[K]>\n : P[K] extends true\n ? Array<ExtractIncludeType<K & string, Includes>> // Include reference - infers Array<ChildShape> from Includes map\n : P[K] extends NestedProjection\n ? InferNestedProjectionRow<P[K], CodecTypes, Includes>\n : never;\n};\n\n/**\n * Infers Row type from a tuple of ColumnBuilders used in returning() clause.\n * Extracts column name and JsType from each ColumnBuilder and creates a Record.\n */\nexport type InferReturningRow<Columns extends readonly AnyColumnBuilder[]> =\n Columns extends readonly [infer First, ...infer Rest]\n ? First extends ColumnBuilder<\n infer Name,\n infer _Meta,\n infer JsType,\n infer _Ops extends OperationTypes\n >\n ? Name extends string\n ? Rest extends readonly AnyColumnBuilder[]\n ? { [K in Name]: JsType } & InferReturningRow<Rest>\n : { [K in Name]: JsType }\n : never\n : never\n : Record<string, never>;\n\n/**\n * Utility type to check if a contract has the required capabilities for includeMany.\n * Requires both `lateral` and `jsonAgg` to be `true` in the contract's capabilities for the target.\n * Capabilities are nested by target: `{ [target]: { lateral: true, jsonAgg: true } }`\n */\nexport type HasIncludeManyCapabilities<TContract extends SqlContract<SqlStorage>> =\n TContract extends { capabilities: infer C; target: infer T }\n ? T extends string\n ? C extends Record<string, Record<string, boolean>>\n ? C extends { [K in T]: infer TargetCaps }\n ? TargetCaps extends { lateral: true; jsonAgg: true }\n ? true\n : false\n : false\n : false\n : false\n : false;\n\n/**\n * SQL-specific Plan type that refines the ast field to use QueryAst.\n * This is the type used by SQL query builders.\n */\nexport type SqlPlan<Row = unknown> = ExecutionPlan<Row, QueryAst>;\n\n/**\n * Helper types for extracting contract structure.\n */\nexport type TablesOf<TContract> = TContract extends {\n storage: { tables: infer U };\n}\n ? U\n : never;\n\nexport type TableKey<TContract> = Extract<keyof TablesOf<TContract>, string>;\n\n// Common types for contract.d.ts generation (SQL-specific)\n// These types are used by emitted contract.d.ts files to provide type-safe DSL/ORM types\n\n/**\n * Unique symbol for metadata property to avoid collisions with user-defined properties\n */\nexport declare const META: unique symbol;\n\n/**\n * Extracts metadata from a type that has a META property\n */\nexport type Meta<T extends { [META]: unknown }> = T[typeof META];\n\n/**\n * Metadata interface for table definitions\n */\nexport interface TableMetadata<Name extends string> {\n name: Name;\n}\n\n/**\n * Metadata interface for model definitions\n */\nexport interface ModelMetadata<Name extends string> {\n name: Name;\n}\n\n/**\n * Base interface for table definitions with metadata\n * Used in contract.d.ts to define storage-level table types\n */\nexport interface TableDef<Name extends string> {\n readonly [META]: TableMetadata<Name>;\n}\n\n/**\n * Base interface for model definitions with metadata\n * Used in contract.d.ts to define application-level model types\n */\nexport interface ModelDef<Name extends string> {\n readonly [META]: ModelMetadata<Name>;\n}\n\nexport type ColumnsOf<\n TContract,\n K extends TableKey<TContract>,\n> = K extends keyof TablesOf<TContract>\n ? TablesOf<TContract>[K] extends { columns: infer C }\n ? C\n : never\n : never;\n\nexport interface RawTemplateOptions {\n readonly refs?: PlanRefs;\n readonly annotations?: Record<string, unknown>;\n readonly projection?: ReadonlyArray<string>;\n}\n\nexport interface RawFunctionOptions extends RawTemplateOptions {\n readonly params: ReadonlyArray<unknown>;\n}\n\nexport type RawTemplateFactory = (\n strings: TemplateStringsArray,\n ...values: readonly unknown[]\n) => ExecutionPlan;\n\nexport interface RawFactory extends RawTemplateFactory {\n (text: string, options: RawFunctionOptions): ExecutionPlan;\n with(options: RawTemplateOptions): RawTemplateFactory;\n}\n\nexport type { RuntimeError } from '@prisma-next/plan';\n\nexport interface BuildParamsMap {\n readonly [name: string]: unknown;\n}\n\nexport interface BuildOptions {\n readonly params?: BuildParamsMap;\n}\n\nexport interface SqlBuilderOptions<\n TContract extends SqlContract<SqlStorage> = SqlContract<SqlStorage>,\n> {\n readonly context: QueryLaneContext<TContract>;\n}\n\n/**\n * SQL-specific ResultType that works with both Plan and SqlQueryPlan.\n * This extends the core ResultType to also handle SqlQueryPlan.\n * Example: `type Row = ResultType<typeof plan>`\n */\nexport type ResultType<P> = P extends SqlQueryPlan<infer R> ? R : CoreResultType<P>;\n"],"mappings":";AAqCO,SAAS,mBACd,MACA,KACiB;AACjB,SAAO,EAAE,MAAM,SAAS,MAAM,IAAI;AACpC;AA6FO,SAAS,gBAAgB,OAA2C;AACzE,SACE,OAAO,UAAU,YACjB,UAAU,QACV,UAAU,SACT,MAA4B,SAAS;AAE1C;","names":[]}
|
package/dist/chunk-G52ENULI.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
//# sourceMappingURL=chunk-G52ENULI.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|