@prisma-next/sql-relational-core 0.3.0-dev.7 → 0.3.0-dev.71

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 (174) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +18 -2
  3. package/dist/errors-7_V3El9I.mjs +3 -0
  4. package/dist/errors-DVufq9PT.d.mts +2 -0
  5. package/dist/exports/ast.d.mts +192 -0
  6. package/dist/exports/ast.d.mts.map +1 -0
  7. package/dist/exports/ast.mjs +361 -0
  8. package/dist/exports/ast.mjs.map +1 -0
  9. package/dist/exports/errors.d.mts +2 -0
  10. package/dist/exports/errors.mjs +3 -0
  11. package/dist/exports/guards.d.mts +5 -0
  12. package/dist/exports/guards.mjs +3 -0
  13. package/dist/exports/operations-registry.d.mts +5 -0
  14. package/dist/exports/operations-registry.mjs +3 -0
  15. package/dist/exports/param.d.mts +5 -0
  16. package/dist/exports/param.mjs +3 -0
  17. package/dist/exports/plan.d.mts +2 -0
  18. package/dist/exports/plan.mjs +17 -0
  19. package/dist/exports/plan.mjs.map +1 -0
  20. package/dist/exports/query-lane-context.d.mts +2 -0
  21. package/dist/exports/query-lane-context.mjs +1 -0
  22. package/dist/exports/schema.d.mts +5 -0
  23. package/dist/exports/schema.mjs +4 -0
  24. package/dist/exports/types.d.mts +4 -0
  25. package/dist/exports/types.mjs +3 -0
  26. package/dist/exports/utils/guards.d.mts +5 -0
  27. package/dist/exports/utils/guards.mjs +4 -0
  28. package/dist/guards-0ycyntYX.mjs +132 -0
  29. package/dist/guards-0ycyntYX.mjs.map +1 -0
  30. package/dist/guards-DCCpAlOL.d.mts +87 -0
  31. package/dist/guards-DCCpAlOL.d.mts.map +1 -0
  32. package/dist/index.d.mts +12 -0
  33. package/dist/index.mjs +12 -0
  34. package/dist/operations-registry-DPZ5aElH.mjs +152 -0
  35. package/dist/operations-registry-DPZ5aElH.mjs.map +1 -0
  36. package/dist/operations-registry-wVEaiLyt.d.mts +9 -0
  37. package/dist/operations-registry-wVEaiLyt.d.mts.map +1 -0
  38. package/dist/param-C4n0OW59.d.mts +8 -0
  39. package/dist/param-C4n0OW59.d.mts.map +1 -0
  40. package/dist/param-DMU3OWfI.mjs +14 -0
  41. package/dist/param-DMU3OWfI.mjs.map +1 -0
  42. package/dist/plan-BhSWuTfw.d.mts +194 -0
  43. package/dist/plan-BhSWuTfw.d.mts.map +1 -0
  44. package/dist/query-lane-context-CgkPuKaR.d.mts +259 -0
  45. package/dist/query-lane-context-CgkPuKaR.d.mts.map +1 -0
  46. package/dist/schema-Bi5p4aAc.mjs +175 -0
  47. package/dist/schema-Bi5p4aAc.mjs.map +1 -0
  48. package/dist/schema-CgrEMqEd.d.mts +86 -0
  49. package/dist/schema-CgrEMqEd.d.mts.map +1 -0
  50. package/dist/types-CEUzDuDC.d.mts +447 -0
  51. package/dist/types-CEUzDuDC.d.mts.map +1 -0
  52. package/dist/types-Cdi4Whda.mjs +18 -0
  53. package/dist/types-Cdi4Whda.mjs.map +1 -0
  54. package/package.json +39 -56
  55. package/src/ast/codec-types.ts +77 -8
  56. package/src/ast/delete.ts +2 -2
  57. package/src/ast/driver-types.ts +20 -3
  58. package/src/ast/predicate.ts +14 -4
  59. package/src/ast/select.ts +4 -3
  60. package/src/ast/sql-codecs.ts +67 -0
  61. package/src/ast/types.ts +89 -19
  62. package/src/ast/update.ts +2 -2
  63. package/src/exports/ast.ts +1 -0
  64. package/src/exports/guards.ts +5 -0
  65. package/src/exports/utils/guards.ts +1 -0
  66. package/src/operations-registry.ts +112 -73
  67. package/src/query-lane-context.ts +77 -1
  68. package/src/schema.ts +91 -33
  69. package/src/types.ts +327 -75
  70. package/src/utils/guards.ts +88 -18
  71. package/dist/ast/adapter-types.d.ts +0 -28
  72. package/dist/ast/adapter-types.d.ts.map +0 -1
  73. package/dist/ast/codec-types.d.ts +0 -141
  74. package/dist/ast/codec-types.d.ts.map +0 -1
  75. package/dist/ast/common.d.ts +0 -7
  76. package/dist/ast/common.d.ts.map +0 -1
  77. package/dist/ast/delete.d.ts +0 -8
  78. package/dist/ast/delete.d.ts.map +0 -1
  79. package/dist/ast/driver-types.d.ts +0 -20
  80. package/dist/ast/driver-types.d.ts.map +0 -1
  81. package/dist/ast/insert.d.ts +0 -8
  82. package/dist/ast/insert.d.ts.map +0 -1
  83. package/dist/ast/join.d.ts +0 -6
  84. package/dist/ast/join.d.ts.map +0 -1
  85. package/dist/ast/order.d.ts +0 -6
  86. package/dist/ast/order.d.ts.map +0 -1
  87. package/dist/ast/predicate.d.ts +0 -4
  88. package/dist/ast/predicate.d.ts.map +0 -1
  89. package/dist/ast/select.d.ts +0 -18
  90. package/dist/ast/select.d.ts.map +0 -1
  91. package/dist/ast/types.d.ts +0 -118
  92. package/dist/ast/types.d.ts.map +0 -1
  93. package/dist/ast/update.d.ts +0 -9
  94. package/dist/ast/update.d.ts.map +0 -1
  95. package/dist/ast/util.d.ts +0 -2
  96. package/dist/ast/util.d.ts.map +0 -1
  97. package/dist/chunk-2F7DSEOU.js +0 -8
  98. package/dist/chunk-2F7DSEOU.js.map +0 -1
  99. package/dist/chunk-36WJWNHT.js +0 -1
  100. package/dist/chunk-36WJWNHT.js.map +0 -1
  101. package/dist/chunk-5N34PNVZ.js +0 -62
  102. package/dist/chunk-5N34PNVZ.js.map +0 -1
  103. package/dist/chunk-7I3EMQID.js +0 -16
  104. package/dist/chunk-7I3EMQID.js.map +0 -1
  105. package/dist/chunk-CBTYMOX2.js +0 -152
  106. package/dist/chunk-CBTYMOX2.js.map +0 -1
  107. package/dist/chunk-G52ENULI.js +0 -1
  108. package/dist/chunk-G52ENULI.js.map +0 -1
  109. package/dist/chunk-KYSP7L5C.js +0 -16
  110. package/dist/chunk-KYSP7L5C.js.map +0 -1
  111. package/dist/chunk-M23L3JHG.js +0 -159
  112. package/dist/chunk-M23L3JHG.js.map +0 -1
  113. package/dist/chunk-MM74SVJ4.js +0 -13
  114. package/dist/chunk-MM74SVJ4.js.map +0 -1
  115. package/dist/chunk-U7AXAUJA.js +0 -1
  116. package/dist/chunk-U7AXAUJA.js.map +0 -1
  117. package/dist/chunk-WZBPVEZI.js +0 -320
  118. package/dist/chunk-WZBPVEZI.js.map +0 -1
  119. package/dist/errors.d.ts +0 -2
  120. package/dist/errors.d.ts.map +0 -1
  121. package/dist/exports/ast.d.ts +0 -14
  122. package/dist/exports/ast.d.ts.map +0 -1
  123. package/dist/exports/ast.js +0 -46
  124. package/dist/exports/ast.js.map +0 -1
  125. package/dist/exports/errors.d.ts +0 -2
  126. package/dist/exports/errors.d.ts.map +0 -1
  127. package/dist/exports/errors.js +0 -9
  128. package/dist/exports/errors.js.map +0 -1
  129. package/dist/exports/guards.d.ts +0 -2
  130. package/dist/exports/guards.d.ts.map +0 -1
  131. package/dist/exports/guards.js +0 -21
  132. package/dist/exports/guards.js.map +0 -1
  133. package/dist/exports/operations-registry.d.ts +0 -2
  134. package/dist/exports/operations-registry.d.ts.map +0 -1
  135. package/dist/exports/operations-registry.js +0 -9
  136. package/dist/exports/operations-registry.js.map +0 -1
  137. package/dist/exports/param.d.ts +0 -3
  138. package/dist/exports/param.d.ts.map +0 -1
  139. package/dist/exports/param.js +0 -7
  140. package/dist/exports/param.js.map +0 -1
  141. package/dist/exports/plan.d.ts +0 -2
  142. package/dist/exports/plan.d.ts.map +0 -1
  143. package/dist/exports/plan.js +0 -7
  144. package/dist/exports/plan.js.map +0 -1
  145. package/dist/exports/query-lane-context.d.ts +0 -2
  146. package/dist/exports/query-lane-context.d.ts.map +0 -1
  147. package/dist/exports/query-lane-context.js +0 -2
  148. package/dist/exports/query-lane-context.js.map +0 -1
  149. package/dist/exports/schema.d.ts +0 -3
  150. package/dist/exports/schema.d.ts.map +0 -1
  151. package/dist/exports/schema.js +0 -14
  152. package/dist/exports/schema.js.map +0 -1
  153. package/dist/exports/types.d.ts +0 -2
  154. package/dist/exports/types.d.ts.map +0 -1
  155. package/dist/exports/types.js +0 -10
  156. package/dist/exports/types.js.map +0 -1
  157. package/dist/index.d.ts +0 -9
  158. package/dist/index.d.ts.map +0 -1
  159. package/dist/index.js +0 -81
  160. package/dist/index.js.map +0 -1
  161. package/dist/operations-registry.d.ts +0 -5
  162. package/dist/operations-registry.d.ts.map +0 -1
  163. package/dist/param.d.ts +0 -4
  164. package/dist/param.d.ts.map +0 -1
  165. package/dist/plan.d.ts +0 -23
  166. package/dist/plan.d.ts.map +0 -1
  167. package/dist/query-lane-context.d.ts +0 -16
  168. package/dist/query-lane-context.d.ts.map +0 -1
  169. package/dist/schema.d.ts +0 -63
  170. package/dist/schema.d.ts.map +0 -1
  171. package/dist/types.d.ts +0 -332
  172. package/dist/types.d.ts.map +0 -1
  173. package/dist/utils/guards.d.ts +0 -55
  174. package/dist/utils/guards.d.ts.map +0 -1
package/LICENSE ADDED
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright [2026] [Prisma Data, Inc]
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
package/README.md CHANGED
@@ -24,7 +24,9 @@ Provide shared relational primitives (schema builders, column builders, paramete
24
24
  - **Column Builders**: Provides column accessors with operation methods attached based on column typeId
25
25
  - **Parameter Helpers**: Creates parameter placeholders for query building
26
26
  - **Operations Registry**: Attaches registered operations as methods on column builders
27
+ - **Execution Context Types**: Defines the context shape used by query lanes
27
28
  - **Type Definitions**: Defines TypeScript types for column builders, operations, and projections
29
+ - **Codec Registry Types**: Defines codec interfaces and base SQL codec definitions
28
30
 
29
31
  **Non-goals:**
30
32
  - Query DSL construction (sql-lane)
@@ -42,6 +44,7 @@ flowchart TD
42
44
  PARAM[Parameter Helpers]
43
45
  OPS[Operations Registry]
44
46
  TYPES[Type Definitions]
47
+ AST[AST Types]
45
48
  end
46
49
 
47
50
  subgraph "Consumers"
@@ -59,6 +62,8 @@ flowchart TD
59
62
  OPS --> ORM
60
63
  TYPES --> SQL
61
64
  TYPES --> ORM
65
+ AST --> SQL
66
+ AST --> ORM
62
67
  ```
63
68
 
64
69
  ## Components
@@ -86,6 +91,15 @@ flowchart TD
86
91
  - Defines `SqlQueryPlan<Row>` interface for SQL query plans produced by lanes before lowering
87
92
  - Provides `augmentDescriptorWithColumnMeta(descriptors, columnMeta)` helper to update ParamDescriptor with `codecId` and `nativeType` from column metadata
88
93
 
94
+ ### AST Surface (`ast/*` via `exports/ast.ts`)
95
+ - Query roots: `SelectAst`, `InsertAst`, `UpdateAst`, `DeleteAst`
96
+ - Expressions: `ColumnRef`, `ParamRef`, `LiteralExpr`, `OperationExpr`, `ListLiteralExpr`
97
+ - Predicates: `BinaryExpr` (ops: `eq`, `neq`, `gt`, `lt`, `gte`, `lte`, `like`, `ilike`, `in`, `notIn`), `AndExpr`, `OrExpr`, `ExistsExpr`, `NullCheckExpr`
98
+ - Lane-agnostic filter interop: `WhereArg`, `ToWhereExpr`, and `BoundWhereExpr` for passing pre-bound filter payloads without lane-specific types
99
+ - Joins: `JoinAst`, `JoinOnExpr` (eqCol or WhereExpr)
100
+ - `SelectAst.selectAllIntent` — preserves select-all intent when normalized to explicit columns
101
+ - `DeleteAst.where` and `UpdateAst.where` optional for mutation-without-WHERE lint support
102
+
89
103
  ### Type Definitions (`types.ts`)
90
104
  - Defines TypeScript types for column builders, operations, projections
91
105
  - Provides type inference utilities for extracting JavaScript types from codec types (e.g., `ExtractJsTypeFromColumnBuilder`)
@@ -95,9 +109,10 @@ flowchart TD
95
109
  ## Dependencies
96
110
 
97
111
  - **`@prisma-next/contract`**: Core contract types
112
+ - **`@prisma-next/operations`**: Operation registry used by schema builders
98
113
  - **`@prisma-next/plan`**: Plan error helpers (`planInvalid`, `planUnsupported`) and `RuntimeError` type
99
- - **`@prisma-next/runtime`**: Runtime context types (TODO: Slice 6 will clean this up)
100
- - **`@prisma-next/sql-target`**: SQL contract types, adapter interfaces
114
+ - **`@prisma-next/sql-contract`**: SQL contract types (via `@prisma-next/sql-contract/types`)
115
+ - **`arktype`**: Parameter schema typing for codec definitions
101
116
 
102
117
  **Note**: This package does not depend on specific adapters (e.g., `@prisma-next/adapter-postgres`). Test fixtures define `CodecTypes` inline to remain adapter-agnostic and avoid cyclic dependencies.
103
118
 
@@ -112,6 +127,7 @@ This package follows the standard `exports/` directory pattern:
112
127
  - `src/exports/types.ts` - Re-exports type definitions
113
128
  - `src/exports/operations-registry.ts` - Re-exports operations registry
114
129
  - `src/exports/plan.ts` - Re-exports plan types and helpers
130
+ - `src/exports/ast.ts` - Re-exports SQL AST types
115
131
  - `src/exports/errors.ts` - Re-exports error helpers (from `@prisma-next/plan`)
116
132
  - `src/index.ts` - Main entry point that re-exports from `exports/`
117
133
 
@@ -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,192 @@
1
+ import { S as defineCodecs, _ as CodecRegistry, b as codec, d as CodecDefBuilder, f as CodecId, g as CodecParamsDescriptor, h as CodecOutput, m as CodecMeta, p as CodecInput, u as Codec, v as ExtractCodecTypes, x as createCodecRegistry, y as ExtractDataTypes } from "../query-lane-context-CgkPuKaR.mjs";
2
+ import { A as WhereArg, C as OrExpr, D as TableRef, E as SelectAst, M as isOperationExpr, O as ToWhereExpr, S as OperationExpr, T as QueryAst, _ as JoinOnExpr, a as BinaryOp, b as LoweredStatement, c as DeleteAst, d as Expression, f as ExpressionSource, g as JoinAst, h as InsertAst, i as BinaryExpr, j as WhereExpr, k as UpdateAst, l as Direction, m as IncludeRef, o as BoundWhereExpr, p as IncludeAst, r as AndExpr, s as ColumnRef, u as ExistsExpr, v as ListLiteralExpr, w as ParamRef, x as NullCheckExpr, y as LiteralExpr } from "../plan-BhSWuTfw.mjs";
3
+ import { b as JoinOnBuilder } from "../types-CEUzDuDC.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: WhereExpr;
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
+ type SqlDriverState = 'unbound' | 'connected' | 'closed';
62
+ interface SqlDriver<TBinding = void> extends SqlQueryable {
63
+ readonly state?: SqlDriverState;
64
+ connect(binding: TBinding): Promise<void>;
65
+ acquireConnection(): Promise<SqlConnection>;
66
+ close(): Promise<void>;
67
+ }
68
+ interface SqlConnection extends SqlQueryable {
69
+ beginTransaction(): Promise<SqlTransaction>;
70
+ release(): Promise<void>;
71
+ }
72
+ interface SqlTransaction extends SqlQueryable {
73
+ commit(): Promise<void>;
74
+ rollback(): Promise<void>;
75
+ }
76
+ interface SqlQueryable {
77
+ execute<Row = Record<string, unknown>>(request: SqlExecuteRequest): AsyncIterable<Row>;
78
+ explain?(request: SqlExecuteRequest): Promise<SqlExplainResult>;
79
+ query<Row = Record<string, unknown>>(sql: string, params?: readonly unknown[]): Promise<SqlQueryResult<Row>>;
80
+ }
81
+ //#endregion
82
+ //#region src/ast/insert.d.ts
83
+ interface CreateInsertAstOptions {
84
+ readonly table: TableRef;
85
+ readonly values: Record<string, ColumnRef | ParamRef>;
86
+ readonly returning?: ReadonlyArray<ColumnRef>;
87
+ }
88
+ declare function createInsertAst(options: CreateInsertAstOptions): InsertAst;
89
+ //#endregion
90
+ //#region src/ast/join.d.ts
91
+ declare function createJoin(joinType: 'inner' | 'left' | 'right' | 'full', table: TableRef, on: JoinOnExpr): JoinAst;
92
+ declare function createJoinOnExpr(left: ColumnRef, right: ColumnRef): JoinOnExpr;
93
+ declare function createJoinOnBuilder(): JoinOnBuilder;
94
+ //#endregion
95
+ //#region src/ast/order.d.ts
96
+ declare function createOrderByItem(expr: ColumnRef | OperationExpr, dir: 'asc' | 'desc'): {
97
+ expr: ColumnRef | OperationExpr;
98
+ dir: Direction;
99
+ };
100
+ //#endregion
101
+ //#region src/ast/predicate.d.ts
102
+ declare function createBinaryExpr(op: BinaryOp, left: Expression, right: Expression | ParamRef | LiteralExpr | ListLiteralExpr): BinaryExpr;
103
+ declare function createExistsExpr(not: boolean, subquery: SelectAst): ExistsExpr;
104
+ declare function createNullCheckExpr(expr: Expression, isNull: boolean): NullCheckExpr;
105
+ //#endregion
106
+ //#region src/ast/select.d.ts
107
+ interface CreateSelectAstOptions {
108
+ readonly from: TableRef;
109
+ readonly joins?: ReadonlyArray<JoinAst>;
110
+ readonly includes?: ReadonlyArray<IncludeAst>;
111
+ readonly project: ReadonlyArray<{
112
+ alias: string;
113
+ expr: ColumnRef | IncludeRef | OperationExpr;
114
+ }>;
115
+ readonly where?: WhereExpr;
116
+ readonly orderBy?: ReadonlyArray<{
117
+ expr: ColumnRef | OperationExpr;
118
+ dir: Direction;
119
+ }>;
120
+ readonly limit?: number;
121
+ readonly selectAllIntent?: {
122
+ table?: string;
123
+ };
124
+ }
125
+ declare function createSelectAst(options: CreateSelectAstOptions): SelectAst;
126
+ //#endregion
127
+ //#region src/ast/sql-codecs.d.ts
128
+ declare const SQL_CHAR_CODEC_ID: "sql/char@1";
129
+ declare const SQL_VARCHAR_CODEC_ID: "sql/varchar@1";
130
+ declare const SQL_INT_CODEC_ID: "sql/int@1";
131
+ declare const SQL_FLOAT_CODEC_ID: "sql/float@1";
132
+ declare const codecs: CodecDefBuilder<{
133
+ char: Codec<"sql/char@1", string, string, Record<string, unknown>, unknown>;
134
+ varchar: Codec<"sql/varchar@1", string, string, Record<string, unknown>, unknown>;
135
+ int: Codec<"sql/int@1", number, number, Record<string, unknown>, unknown>;
136
+ } & Record<"float", Codec<"sql/float@1", number, number, Record<string, unknown>, unknown>>>;
137
+ declare const sqlCodecDefinitions: {
138
+ readonly char: {
139
+ readonly typeId: "sql/char@1";
140
+ readonly scalar: "char";
141
+ readonly codec: Codec<"sql/char@1", string, string, Record<string, unknown>, unknown>;
142
+ readonly input: string;
143
+ readonly output: string;
144
+ readonly jsType: string;
145
+ };
146
+ readonly varchar: {
147
+ readonly typeId: "sql/varchar@1";
148
+ readonly scalar: "varchar";
149
+ readonly codec: Codec<"sql/varchar@1", string, string, Record<string, unknown>, unknown>;
150
+ readonly input: string;
151
+ readonly output: string;
152
+ readonly jsType: string;
153
+ };
154
+ readonly int: {
155
+ readonly typeId: "sql/int@1";
156
+ readonly scalar: "int";
157
+ readonly codec: Codec<"sql/int@1", number, number, Record<string, unknown>, unknown>;
158
+ readonly input: number;
159
+ readonly output: number;
160
+ readonly jsType: number;
161
+ };
162
+ readonly float: {
163
+ readonly typeId: "sql/float@1";
164
+ readonly scalar: "float";
165
+ readonly codec: Codec<"sql/float@1", number, number, Record<string, unknown>, unknown>;
166
+ readonly input: number;
167
+ readonly output: number;
168
+ readonly jsType: number;
169
+ };
170
+ };
171
+ declare const sqlDataTypes: {
172
+ readonly char: "sql/char@1";
173
+ readonly varchar: "sql/varchar@1";
174
+ readonly int: "sql/int@1";
175
+ readonly float: "sql/float@1";
176
+ };
177
+ type SqlCodecTypes = typeof codecs.CodecTypes;
178
+ //#endregion
179
+ //#region src/ast/update.d.ts
180
+ interface CreateUpdateAstOptions {
181
+ readonly table: TableRef;
182
+ readonly set: Record<string, ColumnRef | ParamRef>;
183
+ readonly where?: WhereExpr;
184
+ readonly returning?: ReadonlyArray<ColumnRef>;
185
+ }
186
+ declare function createUpdateAst(options: CreateUpdateAstOptions): UpdateAst;
187
+ //#endregion
188
+ //#region src/ast/util.d.ts
189
+ declare function compact<T extends Record<string, unknown>>(o: T): T;
190
+ //#endregion
191
+ export { Adapter, AdapterProfile, AdapterTarget, AndExpr, BinaryExpr, BinaryOp, BoundWhereExpr, Codec, CodecDefBuilder, CodecId, CodecInput, CodecMeta, CodecOutput, CodecParamsDescriptor, CodecRegistry, ColumnRef, CreateDeleteAstOptions, CreateInsertAstOptions, CreateSelectAstOptions, CreateUpdateAstOptions, DeleteAst, Direction, ExistsExpr, Expression, ExpressionSource, ExtractCodecTypes, ExtractDataTypes, IncludeAst, IncludeRef, InsertAst, JoinAst, JoinOnExpr, ListLiteralExpr, LiteralExpr, LoweredPayload, LoweredStatement, Lowerer, LowererContext, NullCheckExpr, OperationExpr, OrExpr, ParamRef, QueryAst, SQL_CHAR_CODEC_ID, SQL_FLOAT_CODEC_ID, SQL_INT_CODEC_ID, SQL_VARCHAR_CODEC_ID, SelectAst, SqlCodecTypes, SqlConnection, SqlDriver, SqlDriverState, SqlExecuteRequest, SqlExplainResult, SqlQueryResult, SqlQueryable, SqlTransaction, TableRef, ToWhereExpr, UpdateAst, WhereArg, WhereExpr, codec, compact, createBinaryExpr, createCodecRegistry, createColumnRef, createDeleteAst, createExistsExpr, createInsertAst, createJoin, createJoinOnBuilder, createJoinOnExpr, createLiteralExpr, createNullCheckExpr, createOperationExpr, createOrderByItem, createParamRef, createSelectAst, createTableRef, createUpdateAst, defineCodecs, isOperationExpr, sqlCodecDefinitions, sqlDataTypes };
192
+ //# 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/sql-codecs.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,WAAA,CAAA,EATkB,MASlB,CAAA,MAAA,EAAA,OAAA,CAAA;;AACI,UAPM,cAON,CAAA,YAAA,OAAA,CAAA,CAAA;EACS,SAAA,QAAA,EAPC,SAOD;EAAf,SAAA,MAAA,CAAA,EAAA,SAAA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