@prisma-next/sql-runtime 0.3.0-dev.6 → 0.3.0-dev.64
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/LICENSE +201 -0
- package/README.md +137 -26
- package/dist/exports-BhZqJPVb.mjs +771 -0
- package/dist/exports-BhZqJPVb.mjs.map +1 -0
- package/dist/index-D59jqEKF.d.mts +159 -0
- package/dist/index-D59jqEKF.d.mts.map +1 -0
- package/dist/index.d.mts +2 -0
- package/dist/index.mjs +3 -0
- package/dist/test/utils.d.mts +82 -0
- package/dist/test/utils.d.mts.map +1 -0
- package/dist/test/utils.mjs +212 -0
- package/dist/test/utils.mjs.map +1 -0
- package/package.json +32 -25
- package/src/codecs/decoding.ts +84 -3
- package/src/codecs/encoding.ts +15 -2
- package/src/codecs/json-schema-validation.ts +61 -0
- package/src/exports/index.ts +14 -6
- package/src/lower-sql-plan.ts +8 -8
- package/src/plugins/lints.ts +204 -0
- package/src/sql-context.ts +385 -98
- package/src/sql-family-adapter.ts +9 -5
- package/src/sql-marker.ts +2 -2
- package/src/sql-runtime.ts +131 -31
- package/test/async-iterable-result.test.ts +42 -34
- package/test/context.types.test-d.ts +68 -0
- package/test/execution-stack.test.ts +166 -0
- package/test/json-schema-validation.test.ts +653 -0
- package/test/lints.test.ts +330 -0
- package/test/parameterized-types.test.ts +539 -0
- package/test/sql-context.test.ts +292 -117
- package/test/sql-family-adapter.test.ts +7 -6
- package/test/sql-runtime.test.ts +218 -30
- package/test/utils.ts +80 -51
- package/dist/accelerate-EEKAFGN3-P6A6XJWJ.js +0 -137863
- package/dist/accelerate-EEKAFGN3-P6A6XJWJ.js.map +0 -1
- package/dist/amcheck-24VY6X5V.js +0 -13
- package/dist/amcheck-24VY6X5V.js.map +0 -1
- package/dist/bloom-VS74NLHT.js +0 -13
- package/dist/bloom-VS74NLHT.js.map +0 -1
- package/dist/btree_gin-WBC4EAAI.js +0 -13
- package/dist/btree_gin-WBC4EAAI.js.map +0 -1
- package/dist/btree_gist-UNC6QD3M.js +0 -13
- package/dist/btree_gist-UNC6QD3M.js.map +0 -1
- package/dist/chunk-3KTOEDFX.js +0 -49
- package/dist/chunk-3KTOEDFX.js.map +0 -1
- package/dist/chunk-47DZBRQC.js +0 -1280
- package/dist/chunk-47DZBRQC.js.map +0 -1
- package/dist/chunk-52N6AFZM.js +0 -133
- package/dist/chunk-52N6AFZM.js.map +0 -1
- package/dist/chunk-7D4SUZUM.js +0 -38
- package/dist/chunk-7D4SUZUM.js.map +0 -1
- package/dist/chunk-C6I3V3DM.js +0 -455
- package/dist/chunk-C6I3V3DM.js.map +0 -1
- package/dist/chunk-ECWIHLAT.js +0 -37
- package/dist/chunk-ECWIHLAT.js.map +0 -1
- package/dist/chunk-EI626SDC.js +0 -105
- package/dist/chunk-EI626SDC.js.map +0 -1
- package/dist/chunk-UKKOYUGL.js +0 -578
- package/dist/chunk-UKKOYUGL.js.map +0 -1
- package/dist/chunk-XPLNMXQV.js +0 -1537
- package/dist/chunk-XPLNMXQV.js.map +0 -1
- package/dist/citext-T7MXGUY7.js +0 -13
- package/dist/citext-T7MXGUY7.js.map +0 -1
- package/dist/client-5FENX6AW.js +0 -299
- package/dist/client-5FENX6AW.js.map +0 -1
- package/dist/cube-TFDQBZCI.js +0 -13
- package/dist/cube-TFDQBZCI.js.map +0 -1
- package/dist/dict_int-AEUOPGWP.js +0 -13
- package/dist/dict_int-AEUOPGWP.js.map +0 -1
- package/dist/dict_xsyn-DAAYX3FL.js +0 -13
- package/dist/dict_xsyn-DAAYX3FL.js.map +0 -1
- package/dist/dist-AQ3LWXOX.js +0 -570
- package/dist/dist-AQ3LWXOX.js.map +0 -1
- package/dist/dist-LBVX6BJW.js +0 -189
- package/dist/dist-LBVX6BJW.js.map +0 -1
- package/dist/dist-WLKUVDN2.js +0 -5127
- package/dist/dist-WLKUVDN2.js.map +0 -1
- package/dist/earthdistance-KIGTF4LE.js +0 -13
- package/dist/earthdistance-KIGTF4LE.js.map +0 -1
- package/dist/file_fdw-5N55UP6I.js +0 -13
- package/dist/file_fdw-5N55UP6I.js.map +0 -1
- package/dist/fuzzystrmatch-KN3YWBFP.js +0 -13
- package/dist/fuzzystrmatch-KN3YWBFP.js.map +0 -1
- package/dist/hstore-YX726NKN.js +0 -13
- package/dist/hstore-YX726NKN.js.map +0 -1
- package/dist/http-exception-FZY2H4OF.js +0 -8
- package/dist/http-exception-FZY2H4OF.js.map +0 -1
- package/dist/index.js +0 -30
- package/dist/index.js.map +0 -1
- package/dist/intarray-NKVXNO2D.js +0 -13
- package/dist/intarray-NKVXNO2D.js.map +0 -1
- package/dist/isn-FTEMJGEV.js +0 -13
- package/dist/isn-FTEMJGEV.js.map +0 -1
- package/dist/lo-DB7L4NGI.js +0 -13
- package/dist/lo-DB7L4NGI.js.map +0 -1
- package/dist/logger-WQ7SHNDD.js +0 -68
- package/dist/logger-WQ7SHNDD.js.map +0 -1
- package/dist/ltree-Z32TZT6W.js +0 -13
- package/dist/ltree-Z32TZT6W.js.map +0 -1
- package/dist/nodefs-NM46ACH7.js +0 -31
- package/dist/nodefs-NM46ACH7.js.map +0 -1
- package/dist/opfs-ahp-NJO33LVZ.js +0 -332
- package/dist/opfs-ahp-NJO33LVZ.js.map +0 -1
- package/dist/pageinspect-YP3IZR4X.js +0 -13
- package/dist/pageinspect-YP3IZR4X.js.map +0 -1
- package/dist/pg_buffercache-7TD5J2FB.js +0 -13
- package/dist/pg_buffercache-7TD5J2FB.js.map +0 -1
- package/dist/pg_dump-SG4KYBUB.js +0 -2492
- package/dist/pg_dump-SG4KYBUB.js.map +0 -1
- package/dist/pg_freespacemap-DZDNCPZK.js +0 -13
- package/dist/pg_freespacemap-DZDNCPZK.js.map +0 -1
- package/dist/pg_surgery-J2MUEWEP.js +0 -13
- package/dist/pg_surgery-J2MUEWEP.js.map +0 -1
- package/dist/pg_trgm-7VNQOYS6.js +0 -13
- package/dist/pg_trgm-7VNQOYS6.js.map +0 -1
- package/dist/pg_visibility-TTSIPHFL.js +0 -13
- package/dist/pg_visibility-TTSIPHFL.js.map +0 -1
- package/dist/pg_walinspect-KPFHSHRJ.js +0 -13
- package/dist/pg_walinspect-KPFHSHRJ.js.map +0 -1
- package/dist/proxy-signals-GUDAMDHV.js +0 -39
- package/dist/proxy-signals-GUDAMDHV.js.map +0 -1
- package/dist/seg-IYVDLE4O.js +0 -13
- package/dist/seg-IYVDLE4O.js.map +0 -1
- package/dist/src/codecs/decoding.d.ts +0 -4
- package/dist/src/codecs/decoding.d.ts.map +0 -1
- package/dist/src/codecs/encoding.d.ts +0 -5
- package/dist/src/codecs/encoding.d.ts.map +0 -1
- package/dist/src/codecs/validation.d.ts +0 -6
- package/dist/src/codecs/validation.d.ts.map +0 -1
- package/dist/src/exports/index.d.ts +0 -11
- package/dist/src/exports/index.d.ts.map +0 -1
- package/dist/src/index.d.ts +0 -2
- package/dist/src/index.d.ts.map +0 -1
- package/dist/src/lower-sql-plan.d.ts +0 -15
- package/dist/src/lower-sql-plan.d.ts.map +0 -1
- package/dist/src/sql-context.d.ts +0 -65
- package/dist/src/sql-context.d.ts.map +0 -1
- package/dist/src/sql-family-adapter.d.ts +0 -10
- package/dist/src/sql-family-adapter.d.ts.map +0 -1
- package/dist/src/sql-marker.d.ts +0 -22
- package/dist/src/sql-marker.d.ts.map +0 -1
- package/dist/src/sql-runtime.d.ts +0 -25
- package/dist/src/sql-runtime.d.ts.map +0 -1
- package/dist/tablefunc-EF4RCS7S.js +0 -13
- package/dist/tablefunc-EF4RCS7S.js.map +0 -1
- package/dist/tcn-3VT5BQYW.js +0 -13
- package/dist/tcn-3VT5BQYW.js.map +0 -1
- package/dist/test/utils.d.ts +0 -59
- package/dist/test/utils.d.ts.map +0 -1
- package/dist/test/utils.js +0 -24634
- package/dist/test/utils.js.map +0 -1
- package/dist/tiny-CW6F4GX6.js +0 -10
- package/dist/tiny-CW6F4GX6.js.map +0 -1
- package/dist/tsm_system_rows-ES7KNUQH.js +0 -13
- package/dist/tsm_system_rows-ES7KNUQH.js.map +0 -1
- package/dist/tsm_system_time-76WEIMBG.js +0 -13
- package/dist/tsm_system_time-76WEIMBG.js.map +0 -1
- package/dist/unaccent-7RYF3R64.js +0 -13
- package/dist/unaccent-7RYF3R64.js.map +0 -1
- package/dist/utility-Q5A254LJ-J4HTKZPT.js +0 -347
- package/dist/utility-Q5A254LJ-J4HTKZPT.js.map +0 -1
- package/dist/uuid_ossp-4ETE4FPE.js +0 -13
- package/dist/uuid_ossp-4ETE4FPE.js.map +0 -1
- package/dist/vector-74GPNV7V.js +0 -13
- package/dist/vector-74GPNV7V.js.map +0 -1
- package/src/index.ts +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
|
@@ -10,7 +10,7 @@ SQL runtime implementation for Prisma Next.
|
|
|
10
10
|
|
|
11
11
|
## Overview
|
|
12
12
|
|
|
13
|
-
The SQL runtime package implements the SQL family runtime by composing `@prisma-next/runtime-executor` with SQL-specific adapters, drivers, and codecs. It provides the public runtime API for SQL-based databases
|
|
13
|
+
The SQL runtime package implements the SQL family runtime by composing `@prisma-next/runtime-executor` with SQL-specific adapters, drivers, and codecs. It provides the public runtime API for SQL-based databases, including descriptor-based static context derivation via `SqlStaticContributions` and execution-plane composition via `ExecutionStack`.
|
|
14
14
|
|
|
15
15
|
## Purpose
|
|
16
16
|
|
|
@@ -18,6 +18,8 @@ Execute SQL query Plans with deterministic verification, guardrails, and feedbac
|
|
|
18
18
|
|
|
19
19
|
## Responsibilities
|
|
20
20
|
|
|
21
|
+
- **Execution Stack Composition**: Compose runtime descriptors into a reusable `ExecutionStack`
|
|
22
|
+
- **Descriptor-Based Static Context Derivation**: Build `ExecutionContext` from `SqlStaticContributions` on descriptors without instantiation
|
|
21
23
|
- **SQL Context Creation**: Create runtime contexts with SQL contracts, adapters, and codecs
|
|
22
24
|
- **SQL Marker Management**: Provide SQL statements for reading/writing contract markers
|
|
23
25
|
- **Codec Encoding/Decoding**: Encode parameters and decode rows using SQL codec registries
|
|
@@ -27,33 +29,41 @@ Execute SQL query Plans with deterministic verification, guardrails, and feedbac
|
|
|
27
29
|
|
|
28
30
|
## Dependencies
|
|
29
31
|
|
|
32
|
+
- `@prisma-next/core-execution-plane` - Runtime component descriptor types
|
|
30
33
|
- `@prisma-next/runtime-executor` - Target-neutral execution engine
|
|
31
|
-
- `@prisma-next/sql-contract` - SQL contract types
|
|
32
|
-
- `@prisma-next/sql-target` - SQL family interfaces (legacy transitional package)
|
|
34
|
+
- `@prisma-next/sql-contract` - SQL contract types (via `@prisma-next/sql-contract/types`)
|
|
33
35
|
- `@prisma-next/operations` - Operation registry
|
|
34
36
|
|
|
35
37
|
## Usage
|
|
36
38
|
|
|
37
39
|
```typescript
|
|
38
|
-
import
|
|
39
|
-
import
|
|
40
|
-
import
|
|
40
|
+
import postgresAdapter from '@prisma-next/adapter-postgres/runtime';
|
|
41
|
+
import postgresDriver from '@prisma-next/driver-postgres/runtime';
|
|
42
|
+
import pgvector from '@prisma-next/extension-pgvector/runtime';
|
|
43
|
+
import postgresTarget from '@prisma-next/target-postgres/runtime';
|
|
44
|
+
import { instantiateExecutionStack } from '@prisma-next/core-execution-plane/stack';
|
|
45
|
+
import { createExecutionContext, createRuntime, createSqlExecutionStack } from '@prisma-next/sql-runtime';
|
|
41
46
|
|
|
42
47
|
const contract = validateContract<Contract>(contractJson);
|
|
43
|
-
const
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
extensions: [pgVector()],
|
|
48
|
+
const stack = createSqlExecutionStack({
|
|
49
|
+
target: postgresTarget,
|
|
50
|
+
adapter: postgresAdapter,
|
|
51
|
+
driver: postgresDriver,
|
|
52
|
+
extensionPacks: [pgvector],
|
|
49
53
|
});
|
|
50
54
|
|
|
55
|
+
// Static context (no instantiation needed)
|
|
56
|
+
const context = createExecutionContext({ contract, stack });
|
|
57
|
+
|
|
58
|
+
// Dynamic runtime
|
|
59
|
+
const stackInstance = instantiateExecutionStack(stack);
|
|
60
|
+
const driver = stack.driver.create({ connect: { connectionString: process.env.DATABASE_URL } });
|
|
51
61
|
const runtime = createRuntime({
|
|
52
|
-
|
|
53
|
-
driver: createPostgresDriver({ connectionString: process.env.DATABASE_URL }),
|
|
54
|
-
verify: { mode: 'onFirstUse', requireMarker: false },
|
|
62
|
+
stackInstance,
|
|
55
63
|
context,
|
|
56
|
-
|
|
64
|
+
driver,
|
|
65
|
+
verify: { mode: 'onFirstUse', requireMarker: false },
|
|
66
|
+
plugins: [budgets()],
|
|
57
67
|
});
|
|
58
68
|
|
|
59
69
|
for await (const row of runtime.execute(plan)) {
|
|
@@ -63,22 +73,123 @@ for await (const row of runtime.execute(plan)) {
|
|
|
63
73
|
|
|
64
74
|
## Exports
|
|
65
75
|
|
|
76
|
+
### Runtime
|
|
77
|
+
|
|
66
78
|
- `createRuntime` - Create a SQL runtime instance
|
|
67
|
-
- `
|
|
68
|
-
- `
|
|
69
|
-
- `
|
|
70
|
-
- `
|
|
71
|
-
|
|
79
|
+
- `Runtime` - Runtime instance type
|
|
80
|
+
- `CreateRuntimeOptions` - Options for `createRuntime`
|
|
81
|
+
- `RuntimeVerifyOptions` - Verification mode configuration
|
|
82
|
+
- `RuntimeTelemetryEvent`, `TelemetryOutcome` - Telemetry event types
|
|
83
|
+
|
|
84
|
+
### Context
|
|
85
|
+
|
|
86
|
+
- `createExecutionContext` - Create an execution context from contract + descriptors-only stack
|
|
87
|
+
- `createSqlExecutionStack` - SQL-specific stack factory that preserves descriptor types
|
|
88
|
+
- `ExecutionContext` - Context type for SQL operations
|
|
89
|
+
- `TypeHelperRegistry` - Registry for type helper lookup
|
|
90
|
+
|
|
91
|
+
### Descriptors & Stack
|
|
92
|
+
|
|
93
|
+
- `SqlStaticContributions` - Interface for descriptor-level static contributions (codecs, operations, parameterized codecs)
|
|
94
|
+
- `SqlRuntimeTargetDescriptor`, `SqlRuntimeAdapterDescriptor`, `SqlRuntimeExtensionDescriptor` - Structural descriptor types requiring `SqlStaticContributions`
|
|
95
|
+
- `SqlRuntimeAdapterInstance`, `SqlRuntimeDriverInstance`, `SqlRuntimeExtensionInstance` - Instance types
|
|
96
|
+
- `SqlExecutionStack` - Descriptors-only stack type for static context creation
|
|
97
|
+
- `SqlExecutionStackWithDriver` - Descriptor stack including driver for runtime instantiation
|
|
98
|
+
- `RuntimeParameterizedCodecDescriptor` - Parameterized codec descriptor type
|
|
99
|
+
|
|
100
|
+
### Codecs
|
|
101
|
+
|
|
72
102
|
- `validateCodecRegistryCompleteness` - Codec validation
|
|
103
|
+
- `extractCodecIds` - Extract codec IDs from a contract
|
|
104
|
+
- `validateContractCodecMappings` - Validate contract codec mappings against registry
|
|
105
|
+
|
|
106
|
+
### SQL Marker
|
|
107
|
+
|
|
108
|
+
- `readContractMarker`, `writeContractMarker` - SQL marker statements
|
|
109
|
+
- `ensureSchemaStatement`, `ensureTableStatement` - DDL statements for marker table setup
|
|
110
|
+
- `SqlStatement` - SQL statement type
|
|
111
|
+
|
|
112
|
+
### Plan Lowering
|
|
113
|
+
|
|
114
|
+
- `lowerSqlPlan` - SQL plan lowering via adapter
|
|
115
|
+
|
|
116
|
+
### Plugins
|
|
117
|
+
|
|
118
|
+
- `budgets` - Re-exported from `@prisma-next/runtime-executor` (target-neutral)
|
|
119
|
+
- `lints` - **AST-first lint plugin** (canonical in SQL domain), inspects `plan.ast` when present
|
|
120
|
+
- `BudgetsOptions`, `LintsOptions` - Plugin option types
|
|
121
|
+
- `Plugin`, `PluginContext` - Plugin interface types (from runtime-executor)
|
|
122
|
+
- `AfterExecuteResult` - Plugin hook result type
|
|
123
|
+
- `Log` - Log entry type
|
|
124
|
+
|
|
125
|
+
#### Lints plugin (SQL domain)
|
|
126
|
+
|
|
127
|
+
The `lints` plugin operates on `plan.ast` when it is a SQL `QueryAst`:
|
|
128
|
+
|
|
129
|
+
- **DELETE without WHERE** — blocks execution (configurable severity)
|
|
130
|
+
- **UPDATE without WHERE** — blocks execution (configurable severity)
|
|
131
|
+
- **Unbounded SELECT** — warns/errors when `limit` is missing
|
|
132
|
+
- **SELECT \* intent** — warns/errors when `selectAllIntent` is present
|
|
133
|
+
|
|
134
|
+
When `plan.ast` is missing, the plugin falls back to raw heuristic guardrails (`fallbackWhenAstMissing: 'raw'`) or skips linting (`fallbackWhenAstMissing: 'skip'`). Default is `'raw'`.
|
|
135
|
+
|
|
136
|
+
```typescript
|
|
137
|
+
import { createRuntime, lints } from '@prisma-next/sql-runtime';
|
|
138
|
+
|
|
139
|
+
const runtime = createRuntime({
|
|
140
|
+
// ...
|
|
141
|
+
plugins: [lints({ severities: { noLimit: 'error' } })],
|
|
142
|
+
});
|
|
143
|
+
```
|
|
73
144
|
|
|
74
145
|
## Architecture
|
|
75
146
|
|
|
76
|
-
The SQL runtime composes runtime-executor with SQL-specific implementations
|
|
147
|
+
The SQL runtime composes runtime-executor with SQL-specific implementations. Descriptors implement `SqlStaticContributions` so `ExecutionContext` can be derived from the descriptors-only stack without instantiation.
|
|
148
|
+
|
|
149
|
+
1. **ExecutionStack**: Descriptors-only stack (from `@prisma-next/core-execution-plane`)
|
|
150
|
+
2. **SqlStaticContributions**: Codecs, operation signatures, and parameterized codecs contributed by each descriptor
|
|
151
|
+
3. **ExecutionContext**: Built from contract + stack descriptors (no instantiation)
|
|
152
|
+
4. **ExecutionStackInstance**: Instantiated components used at runtime for execution
|
|
153
|
+
5. **SqlRuntime**: Wraps `RuntimeCore` and adds SQL-specific encoding/decoding
|
|
154
|
+
6. **SqlMarker**: Provides SQL statements for marker management
|
|
155
|
+
|
|
156
|
+
```mermaid
|
|
157
|
+
flowchart LR
|
|
158
|
+
Stack[ExecutionStack] --> Context[ExecutionContext]
|
|
159
|
+
Stack --> StackI[ExecutionStackInstance]
|
|
160
|
+
Stack --> DriverDesc[Driver Descriptor]
|
|
161
|
+
Stack --> AdapterDesc[Adapter Descriptor]
|
|
162
|
+
Stack --> Packs[Extension Packs]
|
|
163
|
+
Context --> Runtime[SqlRuntime]
|
|
164
|
+
Runtime --> Core[RuntimeCore]
|
|
165
|
+
DriverDesc --> DriverInst[Driver Instance]
|
|
166
|
+
AdapterDesc --> AdapterInst[Adapter Instance]
|
|
167
|
+
Runtime --> DriverInst
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
## Related Subsystems
|
|
171
|
+
|
|
172
|
+
- **[Query Lanes](../../../../docs/architecture%20docs/subsystems/3.%20Query%20Lanes.md)** — Lane authoring and plan building
|
|
173
|
+
- **[Runtime & Plugin Framework](../../../../docs/architecture%20docs/subsystems/4.%20Runtime%20&%20Plugin%20Framework.md)** — Runtime execution pipeline
|
|
174
|
+
- **[Adapters & Targets](../../../../docs/architecture%20docs/subsystems/5.%20Adapters%20&%20Targets.md)** — Adapter and driver responsibilities
|
|
175
|
+
|
|
176
|
+
## Related ADRs
|
|
177
|
+
|
|
178
|
+
- [ADR 152 - Execution Plane Descriptors and Instances](../../../../docs/architecture%20docs/adrs/ADR%20152%20-%20Execution%20Plane%20Descriptors%20and%20Instances.md)
|
|
179
|
+
|
|
180
|
+
## Error Codes
|
|
181
|
+
|
|
182
|
+
The SQL runtime uses stable error codes for programmatic error handling:
|
|
183
|
+
|
|
184
|
+
- `RUNTIME.CONTRACT_FAMILY_MISMATCH` — Contract target family differs from runtime family
|
|
185
|
+
- `RUNTIME.CONTRACT_TARGET_MISMATCH` — Contract target differs from stack target descriptor
|
|
186
|
+
- `RUNTIME.MISSING_EXTENSION_PACK` — Contract requires an extension pack not provided in stack
|
|
187
|
+
- `RUNTIME.DUPLICATE_PARAMETERIZED_CODEC` — Multiple extensions registered same parameterized codec
|
|
188
|
+
- `RUNTIME.TYPE_PARAMS_INVALID` — Type parameters fail codec schema validation
|
|
189
|
+
- `RUNTIME.CODEC_MISSING` — Required codec not found in registry
|
|
190
|
+
- `RUNTIME.DECODE_FAILED` — Row decoding failed
|
|
77
191
|
|
|
78
|
-
|
|
79
|
-
2. **SqlRuntime**: Wraps `RuntimeCore` and adds SQL-specific encoding/decoding
|
|
80
|
-
3. **SqlContext**: Creates contexts with SQL contracts, adapters, and codecs
|
|
81
|
-
4. **SqlMarker**: Provides SQL statements for marker management
|
|
192
|
+
All errors follow the repo's error envelope convention with `code`, `category`, `severity`, and optional `details`.
|
|
82
193
|
|
|
83
194
|
## Testing
|
|
84
195
|
|