@prisma-next/sql-relational-core 0.3.0-dev.4 → 0.3.0-dev.41

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 (138) hide show
  1. package/README.md +5 -2
  2. package/dist/errors-7_V3El9I.mjs +3 -0
  3. package/dist/errors-DVufq9PT.d.mts +2 -0
  4. package/dist/exports/ast.d.mts +189 -0
  5. package/dist/exports/ast.d.mts.map +1 -0
  6. package/dist/exports/ast.mjs +360 -0
  7. package/dist/exports/ast.mjs.map +1 -0
  8. package/dist/exports/errors.d.mts +2 -0
  9. package/dist/exports/errors.mjs +3 -0
  10. package/dist/exports/guards.d.mts +5 -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/exports/utils/guards.d.mts +5 -0
  26. package/dist/exports/utils/guards.mjs +4 -0
  27. package/dist/guards-0ycyntYX.mjs +132 -0
  28. package/dist/guards-0ycyntYX.mjs.map +1 -0
  29. package/dist/guards-l1R3q8pA.d.mts +87 -0
  30. package/dist/guards-l1R3q8pA.d.mts.map +1 -0
  31. package/dist/index.d.mts +12 -0
  32. package/dist/index.mjs +12 -0
  33. package/dist/{exports/operations-registry.d.ts → operations-registry-0GuSkOCC.d.mts} +7 -11
  34. package/dist/operations-registry-0GuSkOCC.d.mts.map +1 -0
  35. package/dist/operations-registry-DPZ5aElH.mjs +152 -0
  36. package/dist/operations-registry-DPZ5aElH.mjs.map +1 -0
  37. package/dist/param-ChBZwVcw.d.mts +8 -0
  38. package/dist/param-ChBZwVcw.d.mts.map +1 -0
  39. package/dist/param-DMU3OWfI.mjs +14 -0
  40. package/dist/param-DMU3OWfI.mjs.map +1 -0
  41. package/dist/plan-cjDF_yFX.d.mts +182 -0
  42. package/dist/plan-cjDF_yFX.d.mts.map +1 -0
  43. package/dist/query-lane-context-CgkPuKaR.d.mts +259 -0
  44. package/dist/query-lane-context-CgkPuKaR.d.mts.map +1 -0
  45. package/dist/schema-Bi5p4aAc.mjs +175 -0
  46. package/dist/schema-Bi5p4aAc.mjs.map +1 -0
  47. package/dist/schema-CEpzzWNY.d.mts +86 -0
  48. package/dist/schema-CEpzzWNY.d.mts.map +1 -0
  49. package/dist/types-Cdi4Whda.mjs +18 -0
  50. package/dist/types-Cdi4Whda.mjs.map +1 -0
  51. package/dist/types-DicmXfBm.d.mts +447 -0
  52. package/dist/types-DicmXfBm.d.mts.map +1 -0
  53. package/package.json +41 -57
  54. package/src/ast/adapter-types.ts +36 -0
  55. package/src/ast/codec-types.ts +444 -0
  56. package/src/ast/common.ts +36 -0
  57. package/src/ast/delete.ts +17 -0
  58. package/src/ast/driver-types.ts +42 -0
  59. package/src/ast/insert.ts +17 -0
  60. package/src/ast/join.ts +54 -0
  61. package/src/ast/order.ts +11 -0
  62. package/src/ast/predicate.ts +40 -0
  63. package/src/ast/select.ts +38 -0
  64. package/src/ast/sql-codecs.ts +67 -0
  65. package/src/ast/types.ts +187 -0
  66. package/src/ast/update.ts +19 -0
  67. package/src/ast/util.ts +9 -0
  68. package/src/exports/ast.ts +14 -0
  69. package/src/exports/errors.ts +1 -0
  70. package/src/exports/guards.ts +15 -0
  71. package/src/exports/operations-registry.ts +1 -0
  72. package/src/exports/param.ts +2 -0
  73. package/src/exports/plan.ts +1 -0
  74. package/src/exports/query-lane-context.ts +1 -0
  75. package/src/exports/schema.ts +6 -0
  76. package/src/exports/types.ts +1 -0
  77. package/src/exports/utils/guards.ts +1 -0
  78. package/src/index.ts +8 -0
  79. package/src/operations-registry.ts +276 -0
  80. package/src/param.ts +15 -0
  81. package/src/plan.ts +39 -0
  82. package/src/query-lane-context.ts +94 -0
  83. package/src/schema.ts +431 -0
  84. package/src/types.ts +799 -0
  85. package/src/utils/guards.ts +193 -0
  86. package/dist/chunk-2F7DSEOU.js +0 -8
  87. package/dist/chunk-2F7DSEOU.js.map +0 -1
  88. package/dist/chunk-36WJWNHT.js +0 -1
  89. package/dist/chunk-36WJWNHT.js.map +0 -1
  90. package/dist/chunk-5N34PNVZ.js +0 -62
  91. package/dist/chunk-5N34PNVZ.js.map +0 -1
  92. package/dist/chunk-7I3EMQID.js +0 -16
  93. package/dist/chunk-7I3EMQID.js.map +0 -1
  94. package/dist/chunk-CBTYMOX2.js +0 -152
  95. package/dist/chunk-CBTYMOX2.js.map +0 -1
  96. package/dist/chunk-G52ENULI.js +0 -1
  97. package/dist/chunk-G52ENULI.js.map +0 -1
  98. package/dist/chunk-KYSP7L5C.js +0 -16
  99. package/dist/chunk-KYSP7L5C.js.map +0 -1
  100. package/dist/chunk-M23L3JHG.js +0 -159
  101. package/dist/chunk-M23L3JHG.js.map +0 -1
  102. package/dist/chunk-MM74SVJ4.js +0 -13
  103. package/dist/chunk-MM74SVJ4.js.map +0 -1
  104. package/dist/chunk-U7AXAUJA.js +0 -1
  105. package/dist/chunk-U7AXAUJA.js.map +0 -1
  106. package/dist/chunk-WZBPVEZI.js +0 -320
  107. package/dist/chunk-WZBPVEZI.js.map +0 -1
  108. package/dist/exports/ast.d.ts +0 -119
  109. package/dist/exports/ast.js +0 -46
  110. package/dist/exports/ast.js.map +0 -1
  111. package/dist/exports/errors.js +0 -9
  112. package/dist/exports/errors.js.map +0 -1
  113. package/dist/exports/guards.d.ts +0 -63
  114. package/dist/exports/guards.js +0 -21
  115. package/dist/exports/guards.js.map +0 -1
  116. package/dist/exports/operations-registry.js +0 -9
  117. package/dist/exports/operations-registry.js.map +0 -1
  118. package/dist/exports/param.d.ts +0 -14
  119. package/dist/exports/param.js +0 -7
  120. package/dist/exports/param.js.map +0 -1
  121. package/dist/exports/plan.d.ts +0 -5
  122. package/dist/exports/plan.js +0 -7
  123. package/dist/exports/plan.js.map +0 -1
  124. package/dist/exports/query-lane-context.d.ts +0 -4
  125. package/dist/exports/query-lane-context.js +0 -2
  126. package/dist/exports/query-lane-context.js.map +0 -1
  127. package/dist/exports/schema.d.ts +0 -69
  128. package/dist/exports/schema.js +0 -14
  129. package/dist/exports/schema.js.map +0 -1
  130. package/dist/exports/types.d.ts +0 -335
  131. package/dist/exports/types.js +0 -10
  132. package/dist/exports/types.js.map +0 -1
  133. package/dist/index.d.ts +0 -13
  134. package/dist/index.js +0 -81
  135. package/dist/index.js.map +0 -1
  136. package/dist/plan-D0OG5qzy.d.ts +0 -142
  137. package/dist/query-lane-context-BhOMmb_K.d.ts +0 -158
  138. /package/{dist/exports/errors.d.ts → src/errors.ts} +0 -0
@@ -1,119 +0,0 @@
1
- import { b as CodecRegistry } from '../query-lane-context-BhOMmb_K.js';
2
- export { a as Codec, h as CodecDefBuilder, d as CodecId, e as CodecInput, C as CodecMeta, f as CodecOutput, E as ExtractCodecTypes, g as ExtractDataTypes, c as codec, i as createCodecRegistry, j as defineCodecs } from '../query-lane-context-BhOMmb_K.js';
3
- import { T as TableRef, C as ColumnRef, P as ParamRef, O as OperationExpr, L as LiteralExpr, a as BinaryExpr, e as DeleteAst, d as InsertAst, J as JoinOnExpr, b as JoinAst, D as Direction, B as BinaryOp, S as SelectAst, E as ExistsExpr, c as IncludeAst, I as IncludeRef, U as UpdateAst } from '../plan-D0OG5qzy.js';
4
- export { f as LoweredStatement, Q as QueryAst, i as isOperationExpr } from '../plan-D0OG5qzy.js';
5
- import { JoinOnBuilder } from './types.js';
6
- import '@prisma-next/operations';
7
- import '@prisma-next/sql-contract/types';
8
- import 'ts-toolbelt';
9
- import '@prisma-next/contract/types';
10
- import '@prisma-next/sql-operations';
11
- import '@prisma-next/plan';
12
-
13
- type AdapterTarget = string;
14
- interface AdapterProfile<TTarget extends AdapterTarget = AdapterTarget> {
15
- readonly id: string;
16
- readonly target: TTarget;
17
- readonly capabilities: Record<string, unknown>;
18
- /**
19
- * Returns the adapter's default codec registry.
20
- * The registry contains codecs provided by the adapter for converting
21
- * between wire types and JavaScript types.
22
- */
23
- codecs(): CodecRegistry;
24
- }
25
- interface LoweredPayload<TBody = unknown> {
26
- readonly profileId?: string;
27
- readonly body: TBody;
28
- readonly annotations?: Record<string, unknown>;
29
- }
30
- interface LowererContext<TContract = unknown> {
31
- readonly contract: TContract;
32
- readonly params?: readonly unknown[];
33
- }
34
- type Lowerer<Ast = unknown, TContract = unknown, TBody = unknown> = (ast: Ast, context: LowererContext<TContract>) => LoweredPayload<TBody>;
35
- interface Adapter<Ast = unknown, TContract = unknown, TBody = unknown> {
36
- readonly profile: AdapterProfile;
37
- lower(ast: Ast, context: LowererContext<TContract>): LoweredPayload<TBody>;
38
- }
39
-
40
- declare function createTableRef(name: string): TableRef;
41
- declare function createColumnRef(table: string, column: string): ColumnRef;
42
- declare function createParamRef(index: number, name?: string): ParamRef;
43
- declare function createOperationExpr(operation: OperationExpr): OperationExpr;
44
- declare function createLiteralExpr(value: unknown): LiteralExpr;
45
-
46
- interface CreateDeleteAstOptions {
47
- readonly table: TableRef;
48
- readonly where: BinaryExpr;
49
- readonly returning?: ReadonlyArray<ColumnRef>;
50
- }
51
- declare function createDeleteAst(options: CreateDeleteAstOptions): DeleteAst;
52
-
53
- interface SqlExecuteRequest {
54
- readonly sql: string;
55
- readonly params?: readonly unknown[];
56
- }
57
- interface SqlQueryResult<Row = Record<string, unknown>> {
58
- readonly rows: ReadonlyArray<Row>;
59
- readonly rowCount?: number | null;
60
- readonly [key: string]: unknown;
61
- }
62
- interface SqlExplainResult<Row = Record<string, unknown>> {
63
- readonly rows: ReadonlyArray<Row>;
64
- }
65
- interface SqlDriver {
66
- connect(): Promise<void>;
67
- execute<Row = Record<string, unknown>>(request: SqlExecuteRequest): AsyncIterable<Row>;
68
- explain?(request: SqlExecuteRequest): Promise<SqlExplainResult>;
69
- query<Row = Record<string, unknown>>(sql: string, params?: readonly unknown[]): Promise<SqlQueryResult<Row>>;
70
- close(): Promise<void>;
71
- }
72
-
73
- interface CreateInsertAstOptions {
74
- readonly table: TableRef;
75
- readonly values: Record<string, ColumnRef | ParamRef>;
76
- readonly returning?: ReadonlyArray<ColumnRef>;
77
- }
78
- declare function createInsertAst(options: CreateInsertAstOptions): InsertAst;
79
-
80
- declare function createJoin(joinType: 'inner' | 'left' | 'right' | 'full', table: TableRef, on: JoinOnExpr): JoinAst;
81
- declare function createJoinOnExpr(left: ColumnRef, right: ColumnRef): JoinOnExpr;
82
- declare function createJoinOnBuilder(): JoinOnBuilder;
83
-
84
- declare function createOrderByItem(expr: ColumnRef | OperationExpr, dir: 'asc' | 'desc'): {
85
- expr: ColumnRef | OperationExpr;
86
- dir: Direction;
87
- };
88
-
89
- declare function createBinaryExpr(op: BinaryOp, left: ColumnRef | OperationExpr, right: ColumnRef | ParamRef): BinaryExpr;
90
- declare function createExistsExpr(not: boolean, subquery: SelectAst): ExistsExpr;
91
-
92
- interface CreateSelectAstOptions {
93
- readonly from: TableRef;
94
- readonly joins?: ReadonlyArray<JoinAst>;
95
- readonly includes?: ReadonlyArray<IncludeAst>;
96
- readonly project: ReadonlyArray<{
97
- alias: string;
98
- expr: ColumnRef | IncludeRef | OperationExpr;
99
- }>;
100
- readonly where?: BinaryExpr | ExistsExpr;
101
- readonly orderBy?: ReadonlyArray<{
102
- expr: ColumnRef | OperationExpr;
103
- dir: Direction;
104
- }>;
105
- readonly limit?: number;
106
- }
107
- declare function createSelectAst(options: CreateSelectAstOptions): SelectAst;
108
-
109
- interface CreateUpdateAstOptions {
110
- readonly table: TableRef;
111
- readonly set: Record<string, ColumnRef | ParamRef>;
112
- readonly where: BinaryExpr;
113
- readonly returning?: ReadonlyArray<ColumnRef>;
114
- }
115
- declare function createUpdateAst(options: CreateUpdateAstOptions): UpdateAst;
116
-
117
- declare function compact<T extends Record<string, unknown>>(o: T): T;
118
-
119
- export { type Adapter, type AdapterProfile, type AdapterTarget, BinaryExpr, BinaryOp, CodecRegistry, ColumnRef, type CreateDeleteAstOptions, type CreateInsertAstOptions, type CreateSelectAstOptions, type CreateUpdateAstOptions, DeleteAst, Direction, ExistsExpr, IncludeAst, IncludeRef, InsertAst, JoinAst, JoinOnExpr, LiteralExpr, type LoweredPayload, type Lowerer, type LowererContext, OperationExpr, ParamRef, SelectAst, type SqlDriver, type SqlExecuteRequest, type SqlExplainResult, type SqlQueryResult, TableRef, UpdateAst, compact, createBinaryExpr, createColumnRef, createDeleteAst, createExistsExpr, createInsertAst, createJoin, createJoinOnBuilder, createJoinOnExpr, createLiteralExpr, createOperationExpr, createOrderByItem, createParamRef, createSelectAst, createTableRef, createUpdateAst };
@@ -1,46 +0,0 @@
1
- import {
2
- codec,
3
- compact,
4
- createBinaryExpr,
5
- createCodecRegistry,
6
- createColumnRef,
7
- createDeleteAst,
8
- createExistsExpr,
9
- createInsertAst,
10
- createJoin,
11
- createJoinOnBuilder,
12
- createJoinOnExpr,
13
- createLiteralExpr,
14
- createOperationExpr,
15
- createOrderByItem,
16
- createParamRef,
17
- createSelectAst,
18
- createTableRef,
19
- createUpdateAst,
20
- defineCodecs,
21
- isOperationExpr
22
- } from "../chunk-WZBPVEZI.js";
23
- import "../chunk-MM74SVJ4.js";
24
- export {
25
- codec,
26
- compact,
27
- createBinaryExpr,
28
- createCodecRegistry,
29
- createColumnRef,
30
- createDeleteAst,
31
- createExistsExpr,
32
- createInsertAst,
33
- createJoin,
34
- createJoinOnBuilder,
35
- createJoinOnExpr,
36
- createLiteralExpr,
37
- createOperationExpr,
38
- createOrderByItem,
39
- createParamRef,
40
- createSelectAst,
41
- createTableRef,
42
- createUpdateAst,
43
- defineCodecs,
44
- isOperationExpr
45
- };
46
- //# sourceMappingURL=ast.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -1,9 +0,0 @@
1
- import {
2
- planInvalid,
3
- planUnsupported
4
- } from "../chunk-2F7DSEOU.js";
5
- export {
6
- planInvalid,
7
- planUnsupported
8
- };
9
- //# sourceMappingURL=errors.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -1,63 +0,0 @@
1
- import { StorageColumn } from '@prisma-next/sql-contract/types';
2
- import { C as ColumnRef, P as ParamRef, L as LiteralExpr, O as OperationExpr } from '../plan-D0OG5qzy.js';
3
- import { AnyColumnBuilder, ParamPlaceholder } from './types.js';
4
- import '@prisma-next/contract/types';
5
- import '@prisma-next/operations';
6
- import '@prisma-next/sql-operations';
7
- import '../query-lane-context-BhOMmb_K.js';
8
- import 'ts-toolbelt';
9
- import '@prisma-next/plan';
10
-
11
- /**
12
- * Helper to extract columnMeta from a ColumnBuilder.
13
- * Returns StorageColumn if present, undefined otherwise.
14
- * AnyColumnBuilder is a union that includes types with columnMeta property,
15
- * so we can safely access it after checking for existence.
16
- */
17
- declare function getColumnMeta(expr: AnyColumnBuilder): StorageColumn | undefined;
18
- /**
19
- * Type predicate to check if a value is a ParamPlaceholder.
20
- */
21
- declare function isParamPlaceholder(value: unknown): value is ParamPlaceholder;
22
- /**
23
- * Recursively extracts the base ColumnRef from an OperationExpr.
24
- * If the expression is already a ColumnRef, it is returned directly.
25
- */
26
- declare function extractBaseColumnRef(expr: ColumnRef | OperationExpr): ColumnRef;
27
- /**
28
- * Recursively collects all ColumnRef nodes from an expression tree.
29
- * Handles nested OperationExpr structures by traversing both self and args.
30
- */
31
- declare function collectColumnRefs(expr: ColumnRef | ParamRef | LiteralExpr | OperationExpr): ColumnRef[];
32
- /**
33
- * Type predicate to check if an expression is an OperationExpr.
34
- */
35
- declare function isOperationExpr(expr: AnyColumnBuilder | OperationExpr): expr is OperationExpr;
36
- /**
37
- * Helper to extract table and column from a ColumnBuilder or OperationExpr.
38
- * For OperationExpr, recursively unwraps to find the base ColumnRef.
39
- */
40
- declare function getColumnInfo(expr: AnyColumnBuilder | OperationExpr): {
41
- table: string;
42
- column: string;
43
- };
44
- /**
45
- * Type predicate to check if a value is a ColumnBuilder.
46
- */
47
- declare function isColumnBuilder(value: unknown): value is AnyColumnBuilder;
48
- /**
49
- * Extracts and returns an OperationExpr from a builder.
50
- * Returns the OperationExpr if the builder is an OperationExpr or has an _operationExpr property,
51
- * otherwise returns undefined.
52
- *
53
- * @design-note: This function accesses the hidden `_operationExpr` property, which is a code smell.
54
- * The issue is that `executeOperation()` in relational-core returns a ColumnBuilder-shaped object
55
- * with a hidden `_operationExpr` property, creating coupling between lanes and relational-core
56
- * implementation details. A cleaner design would be to have operation results be a separate
57
- * type (e.g., `OperationResultBuilder`) that properly represents expression nodes rather than
58
- * pretending to be a ColumnBuilder. This would require refactoring the operation execution
59
- * system in relational-core to return proper expression types.
60
- */
61
- declare function getOperationExpr(builder: AnyColumnBuilder | OperationExpr): OperationExpr | undefined;
62
-
63
- export { collectColumnRefs, extractBaseColumnRef, getColumnInfo, getColumnMeta, getOperationExpr, isColumnBuilder, isOperationExpr, isParamPlaceholder };
@@ -1,21 +0,0 @@
1
- import {
2
- collectColumnRefs,
3
- extractBaseColumnRef,
4
- getColumnInfo,
5
- getColumnMeta,
6
- getOperationExpr,
7
- isColumnBuilder,
8
- isOperationExpr,
9
- isParamPlaceholder
10
- } from "../chunk-5N34PNVZ.js";
11
- export {
12
- collectColumnRefs,
13
- extractBaseColumnRef,
14
- getColumnInfo,
15
- getColumnMeta,
16
- getOperationExpr,
17
- isColumnBuilder,
18
- isOperationExpr,
19
- isParamPlaceholder
20
- };
21
- //# sourceMappingURL=guards.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -1,9 +0,0 @@
1
- import "../chunk-G52ENULI.js";
2
- import {
3
- attachOperationsToColumnBuilder
4
- } from "../chunk-M23L3JHG.js";
5
- import "../chunk-5N34PNVZ.js";
6
- export {
7
- attachOperationsToColumnBuilder
8
- };
9
- //# sourceMappingURL=operations-registry.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -1,14 +0,0 @@
1
- import { ParamPlaceholder } from './types.js';
2
- import '@prisma-next/contract/types';
3
- import '@prisma-next/operations';
4
- import '@prisma-next/sql-contract/types';
5
- import '@prisma-next/sql-operations';
6
- import '../plan-D0OG5qzy.js';
7
- import '../query-lane-context-BhOMmb_K.js';
8
- import 'ts-toolbelt';
9
- import '@prisma-next/plan';
10
-
11
- type Parameter = ParamPlaceholder;
12
- declare function param(name: string): Parameter;
13
-
14
- export { type Parameter, param };
@@ -1,7 +0,0 @@
1
- import {
2
- param
3
- } from "../chunk-7I3EMQID.js";
4
- export {
5
- param
6
- };
7
- //# sourceMappingURL=param.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -1,5 +0,0 @@
1
- export { g as SqlQueryPlan, h as augmentDescriptorWithColumnMeta } from '../plan-D0OG5qzy.js';
2
- import '@prisma-next/contract/types';
3
- import '@prisma-next/sql-contract/types';
4
- import '@prisma-next/operations';
5
- import '@prisma-next/sql-operations';
@@ -1,7 +0,0 @@
1
- import {
2
- augmentDescriptorWithColumnMeta
3
- } from "../chunk-KYSP7L5C.js";
4
- export {
5
- augmentDescriptorWithColumnMeta
6
- };
7
- //# sourceMappingURL=plan.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -1,4 +0,0 @@
1
- export { Q as QueryLaneContext } from '../query-lane-context-BhOMmb_K.js';
2
- import '@prisma-next/operations';
3
- import '@prisma-next/sql-contract/types';
4
- import 'ts-toolbelt';
@@ -1,2 +0,0 @@
1
- import "../chunk-U7AXAUJA.js";
2
- //# sourceMappingURL=query-lane-context.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -1,69 +0,0 @@
1
- import { StorageColumn, SqlContract, SqlStorage, ExtractCodecTypes, ExtractOperationTypes } from '@prisma-next/sql-contract/types';
2
- import { T as TableRef } from '../plan-D0OG5qzy.js';
3
- import { Q as QueryLaneContext } from '../query-lane-context-BhOMmb_K.js';
4
- import { ParamPlaceholder, AnyColumnBuilderBase, BinaryBuilder, OrderBuilder, CodecTypes, OperationTypes, ColumnBuilder, ComputeColumnJsType, OperationTypeSignature } from './types.js';
5
- import '@prisma-next/contract/types';
6
- import '@prisma-next/operations';
7
- import '@prisma-next/sql-operations';
8
- import 'ts-toolbelt';
9
- import '@prisma-next/plan';
10
-
11
- type TableColumns<Table extends {
12
- columns: Record<string, StorageColumn>;
13
- }> = Table['columns'];
14
- type ColumnBuilders<Contract extends SqlContract<SqlStorage>, TableName extends string, Columns extends Record<string, StorageColumn>, CodecTypes extends CodecTypes, Operations extends OperationTypes> = {
15
- readonly [K in keyof Columns]: ColumnBuilder<K & string, Columns[K], ComputeColumnJsType<Contract, TableName, K & string, Columns[K], CodecTypes>, Operations>;
16
- };
17
- declare class ColumnBuilderImpl<ColumnName extends string, ColumnMeta extends StorageColumn, JsType = unknown> {
18
- readonly table: string;
19
- readonly column: ColumnName;
20
- private readonly storageColumn;
21
- readonly kind: "column";
22
- constructor(table: string, column: ColumnName, storageColumn: ColumnMeta);
23
- get columnMeta(): ColumnMeta;
24
- get __jsType(): JsType;
25
- private createBinaryBuilder;
26
- eq(value: ParamPlaceholder | AnyColumnBuilderBase): BinaryBuilder<ColumnName, ColumnMeta, JsType>;
27
- neq(value: ParamPlaceholder | AnyColumnBuilderBase): BinaryBuilder<ColumnName, ColumnMeta, JsType>;
28
- gt(value: ParamPlaceholder | AnyColumnBuilderBase): BinaryBuilder<ColumnName, ColumnMeta, JsType>;
29
- lt(value: ParamPlaceholder | AnyColumnBuilderBase): BinaryBuilder<ColumnName, ColumnMeta, JsType>;
30
- gte(value: ParamPlaceholder | AnyColumnBuilderBase): BinaryBuilder<ColumnName, ColumnMeta, JsType>;
31
- lte(value: ParamPlaceholder | AnyColumnBuilderBase): BinaryBuilder<ColumnName, ColumnMeta, JsType>;
32
- asc(): OrderBuilder<ColumnName, ColumnMeta, JsType>;
33
- desc(): OrderBuilder<ColumnName, ColumnMeta, JsType>;
34
- }
35
- declare class TableBuilderImpl<Contract extends SqlContract<SqlStorage>, TableName extends string, Columns extends Record<string, StorageColumn>, CodecTypes extends CodecTypes, Operations extends OperationTypes> implements TableRef {
36
- readonly kind: "table";
37
- readonly columns: ColumnBuilders<Contract, TableName, Columns, CodecTypes, Operations>;
38
- private readonly _name;
39
- constructor(name: TableName, columns: ColumnBuilders<Contract, TableName, Columns, CodecTypes, Operations>);
40
- get name(): string;
41
- }
42
- type ExtractSchemaTables<Contract extends SqlContract<SqlStorage>, CodecTypes extends CodecTypes, Operations extends OperationTypes> = {
43
- readonly [TableName in keyof Contract['storage']['tables']]: TableBuilderImpl<Contract, TableName & string, TableColumns<Contract['storage']['tables'][TableName]>, CodecTypes, Operations> & TableRef;
44
- };
45
- type SchemaHandle<Contract extends SqlContract<SqlStorage> = SqlContract<SqlStorage>, CodecTypes extends CodecTypes = CodecTypes, Operations extends OperationTypes = Record<string, never>> = {
46
- readonly tables: ExtractSchemaTables<Contract, CodecTypes, Operations>;
47
- };
48
- type SchemaReturnType<Contract extends SqlContract<SqlStorage>> = SchemaHandle<Contract, ExtractCodecTypes<Contract>, ToOperationTypes<ExtractOperationTypes<Contract>>>;
49
- type NormalizeOperationTypes<T> = {
50
- [TypeId in keyof T]: {
51
- [Method in keyof T[TypeId]]: T[TypeId][Method] extends OperationTypeSignature ? T[TypeId][Method] : OperationTypeSignature;
52
- };
53
- };
54
- type ToOperationTypes<T> = T extends OperationTypes ? T : NormalizeOperationTypes<T>;
55
- /**
56
- * Creates a schema handle for building SQL queries.
57
- *
58
- * @param context - Query lane context containing contract, codec and operation registries
59
- * @returns A schema handle with typed table builders
60
- *
61
- * @example
62
- * ```typescript
63
- * const schemaHandle = schema<Contract>(context);
64
- * const userTable = schemaHandle.tables.user;
65
- * ```
66
- */
67
- declare function schema<Contract extends SqlContract<SqlStorage>>(context: QueryLaneContext<Contract>): SchemaReturnType<Contract>;
68
-
69
- export { ColumnBuilderImpl as Column, ColumnBuilderImpl, type SchemaHandle, TableBuilderImpl as Table, TableBuilderImpl, schema };
@@ -1,14 +0,0 @@
1
- import {
2
- ColumnBuilderImpl,
3
- TableBuilderImpl,
4
- schema
5
- } from "../chunk-CBTYMOX2.js";
6
- import "../chunk-M23L3JHG.js";
7
- import "../chunk-5N34PNVZ.js";
8
- import "../chunk-MM74SVJ4.js";
9
- export {
10
- ColumnBuilderImpl,
11
- TableBuilderImpl,
12
- schema
13
- };
14
- //# sourceMappingURL=schema.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}