@sqlbraid/core 0.1.0-rc.0 → 0.1.0-rc.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +201 -21
- package/README.md +22 -27
- package/dist/index.d.ts +12 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +19 -0
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/LICENSE
CHANGED
|
@@ -1,21 +1,201 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
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 [yyyy] [name of copyright owner]
|
|
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
|
@@ -1,41 +1,36 @@
|
|
|
1
1
|
# @sqlbraid/core
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
The low-level contracts package for SQLBraid adapter and integration authors.
|
|
4
|
+
It defines query types, rendered statements, execution boundaries, result
|
|
5
|
+
mapping, observers, transactions, and capability errors; it does not connect
|
|
6
|
+
to a database.
|
|
4
7
|
|
|
5
8
|
```sh
|
|
6
9
|
npm install @sqlbraid/core
|
|
7
10
|
```
|
|
8
11
|
|
|
9
|
-
Adapter authors implement `QueryExecutor.query`, `QueryExecutor.stream`, and
|
|
10
|
-
`QueryExecutor.call` through the value-only `RenderedStatement` boundary. Every
|
|
11
|
-
operation uses `(statement, binding?, options?)`; `ExecutionOptions` carries an
|
|
12
|
-
optional `AbortSignal`, and row/stream options add Standard Schema validation.
|
|
13
|
-
`QueryExecutor.bulk` and `StatementBindingAdapter.describeBulk` are optional
|
|
14
|
-
command-only homogeneous DML capabilities. `QueryExecutor.call` returns
|
|
15
|
-
normalized internal `DriverRoutineResult`; application code receives
|
|
16
|
-
`RoutineCallResult<Output, Sets, ReturnValue>` with `output`, heterogeneous
|
|
17
|
-
`resultSets`, and an optional `returnValue` after runtime mapping.
|
|
18
|
-
|
|
19
|
-
`UnsupportedFeatureError` is the portable rejection type for missing
|
|
20
|
-
capabilities. It carries `feature`, a stable `BRAID_*` `code`, and `message`.
|
|
21
|
-
Active cancellation must be rejected before I/O with
|
|
22
|
-
`BRAID_CANCEL_UNSUPPORTED` when an adapter cannot cancel. Do not
|
|
23
|
-
buffer streams or guess routine carriers to fake an unsupported operation.
|
|
24
|
-
|
|
25
|
-
`TransactionOptions` contains `isolation` (`read-uncommitted`,
|
|
26
|
-
`read-committed`, `repeatable-read`, or `serializable`) and `readOnly`.
|
|
27
|
-
Adapters advertise which combinations they can honor; unsupported options
|
|
28
|
-
reject rather than silently changing an active transaction.
|
|
29
|
-
|
|
30
12
|
```ts
|
|
31
13
|
import type {
|
|
32
|
-
|
|
33
|
-
BulkExecutionResult,
|
|
14
|
+
Database,
|
|
34
15
|
DriverRoutineResult,
|
|
35
|
-
RenderedBulk,
|
|
36
|
-
RoutineCallResult,
|
|
37
16
|
QueryExecutor,
|
|
17
|
+
RenderedStatement,
|
|
18
|
+
RoutineCallResult,
|
|
38
19
|
} from "@sqlbraid/core";
|
|
39
20
|
```
|
|
40
21
|
|
|
41
|
-
|
|
22
|
+
An adapter implements `QueryExecutor.query`, `stream`, and `call` using a
|
|
23
|
+
`RenderedStatement`. The statement has SQL `segments` and value-only
|
|
24
|
+
`parameters`; its optional `nativeTemplate` preserves native tagged-template
|
|
25
|
+
transport when an adapter supports it. `bulk` and transaction methods are
|
|
26
|
+
optional executor capabilities. `Database` is the application-facing contract
|
|
27
|
+
implemented by the runtime package.
|
|
28
|
+
|
|
29
|
+
`RoutineCallResult` represents normalized routine output as `output`, ordered
|
|
30
|
+
`resultSets`, and an optional `returnValue`. `ExecutionOptions` and
|
|
31
|
+
`RowValidationOptions` carry an optional `AbortSignal` and Standard Schema row
|
|
32
|
+
validation. Use `UnsupportedFeatureError` when an adapter cannot honor a
|
|
33
|
+
requested capability rather than silently changing the operation.
|
|
34
|
+
|
|
35
|
+
See the [SQLBraid documentation](https://clickin.github.io/SQLBraid/) and the
|
|
36
|
+
[routine guide](https://clickin.github.io/SQLBraid/concepts/routines/).
|
package/dist/index.d.ts
CHANGED
|
@@ -73,6 +73,12 @@ export interface RenderedParameter {
|
|
|
73
73
|
export interface RenderedStatement {
|
|
74
74
|
readonly segments: readonly string[];
|
|
75
75
|
readonly parameters: readonly RenderedParameter[];
|
|
76
|
+
/**
|
|
77
|
+
* Optional native tagged-template carrier. This preserves the original
|
|
78
|
+
* TemplateStringsArray when a driver can bind values through its native tag.
|
|
79
|
+
* It is metadata only; segments/parameters remain the logical statement.
|
|
80
|
+
*/
|
|
81
|
+
readonly nativeTemplate?: TemplateStringsArray;
|
|
76
82
|
readonly dialectId: string;
|
|
77
83
|
readonly resultKind: QueryResultKind;
|
|
78
84
|
readonly routineProcedure?: RoutineProcedure;
|
|
@@ -191,6 +197,7 @@ export declare function createRenderedBulk(bulk: RenderedBulk): RenderedBulk;
|
|
|
191
197
|
export declare function createRenderedStatement(statement: {
|
|
192
198
|
readonly segments: readonly string[];
|
|
193
199
|
readonly parameters: readonly RenderedParameter[];
|
|
200
|
+
readonly nativeTemplate?: TemplateStringsArray;
|
|
194
201
|
readonly resultKind: QueryResultKind;
|
|
195
202
|
readonly routineProcedure?: RoutineProcedure;
|
|
196
203
|
readonly dialectId: string;
|
|
@@ -297,6 +304,11 @@ export interface TemplateIr {
|
|
|
297
304
|
readonly version: 1;
|
|
298
305
|
readonly nodes: readonly TemplateNode[];
|
|
299
306
|
readonly sourceLength: number;
|
|
307
|
+
/**
|
|
308
|
+
* Optional parallel node tree preserving raw JavaScript template text for
|
|
309
|
+
* native tagged-template transports. The logical node tree remains cooked.
|
|
310
|
+
*/
|
|
311
|
+
readonly rawNodes?: readonly TemplateNode[];
|
|
300
312
|
}
|
|
301
313
|
export interface SqlFragment {
|
|
302
314
|
readonly [SQL_FRAGMENT]: true;
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","names":[],"sources":["../src/index.ts"],"mappings":";;qBAIa;cAIC;iBAIG;WACN;WACA;;iBAGM;WACN;WACA;WACA;WACA;;YAGC;YAEA;YAKA;YAEA;iBAMK;WACN,WAAW;WACX,gBAAgB;WAChB,UAAU;WACV;;iBAGM;WACN;WACA;;qBAGE,6BAA6B;WAC/B;EAEG,YAAA;;wBAUE,mBAAmB,gBAAgB,QAAQ;;;;;;wBAuC3C,sBAAsB;;;;;;wBAYtB,kBAAkB;wBAsBlB,mBAAmB,gBAAgB;WAAqB;;YAM5D;iBAEK;WACN;WACA;;YAGC,gBAAgB;iBAEX,gBACf,eAAe,SAAS,2BAA2B,SAAS,0BAC5D,sBAAsB,2BAA2B,iBACjD;WAES,SAAS,wBAAsB;WAC/B,aAAa;WACb,cAAc,wBAAsB;WACpC,YAAY;;;;;;;iBAQN;WACN;WACA;WACA,OAAO;WACP,YAAY;WACZ;;iBAGM;WACN;WACA,qBAAqB;
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../src/index.ts"],"mappings":";;qBAIa;cAIC;iBAIG;WACN;WACA;;iBAGM;WACN;WACA;WACA;WACA;;YAGC;YAEA;YAKA;YAEA;iBAMK;WACN,WAAW;WACX,gBAAgB;WAChB,UAAU;WACV;;iBAGM;WACN;WACA;;qBAGE,6BAA6B;WAC/B;EAEG,YAAA;;wBAUE,mBAAmB,gBAAgB,QAAQ;;;;;;wBA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AK,mBAAmB;iBAEvD,WAAW,aAAa,kBAAkB,iBAAiB;GACzE,SAAS,yBAAyB,6BAA6B,MAAM,KAAK;;iBAG5D,mBAAmB,iBAAiB;GAClD,SAAS,yBAAyB,6BAA6B,UAAU,0BAA0B;;iBAGrF;GAEd,OAAO,QAAQ,QAAQ,mBAAiB,OAAO,UAAU,mBAAmB;GAC5E,eAAe,SAAS,yBAAyB,6BAA6B,SAAS;;iBAGzE,eAAe;EAC9B,MAAM;EACN,UAAU,SAAS,yBAAyB,+BAA+B;EAC3E;KACG,eAAe,oBAAoB,mBAAmB,SAAS,yBAAyB,6BAA6B,UAAU;KAC/H,iBAAiB,iBAAiB,UAAU,WAAW,mBAAmB;;EAE7E,KAAK,OAAO,OAAO,QAAQ,QAAQ,MAAM,kBAAkB,SAAS,eAAe;EACnF,IAAI,cAAc,OAAO,oBAAoB;EAC7C,MAAM,OAAO,cAAc,OAAO,QAAQ,QAAQ,OAAO,kBAAkB,SAAS,iBAAiB;EACrG,WAAW,SAAS,yBAAyB,+BAA+B;EAC5E,OAAO;EACP,QAAQ,2CAA2C;EACnD,MAAM,iBAAiB;EACvB,OAAO,gBAAgB,eAAe,YAAY,gBAAgB;EAClE,OAAO,+BAA+B;;qBAG3B,uBAAuB;WACzB;EAEG,YAAA,cAAc"}
|
package/dist/index.js
CHANGED
|
@@ -197,6 +197,23 @@ function copyRoutineProcedure(procedure) {
|
|
|
197
197
|
parameterNames: Object.freeze(parameterNames)
|
|
198
198
|
});
|
|
199
199
|
}
|
|
200
|
+
function copyNativeTemplate(value, segments) {
|
|
201
|
+
if (!Array.isArray(value) || value.length !== segments.length) throw new TypeError("RenderedStatement nativeTemplate must have one string per segment boundary.");
|
|
202
|
+
if (value.some((segment) => typeof segment !== "string")) throw new TypeError("RenderedStatement nativeTemplate must contain cooked strings.");
|
|
203
|
+
if (value.some((segment, index) => segment !== segments[index])) throw new TypeError("RenderedStatement nativeTemplate cooked strings must match logical segments.");
|
|
204
|
+
const raw = value.raw;
|
|
205
|
+
if (!Array.isArray(raw) || raw.length !== value.length || raw.some((segment) => typeof segment !== "string")) throw new TypeError("RenderedStatement nativeTemplate.raw must contain one raw string per segment boundary.");
|
|
206
|
+
if (Object.isFrozen(value) && Object.isFrozen(raw)) return value;
|
|
207
|
+
const cooked = [...value];
|
|
208
|
+
const frozenRaw = Object.freeze([...raw]);
|
|
209
|
+
Object.defineProperty(cooked, "raw", {
|
|
210
|
+
configurable: false,
|
|
211
|
+
enumerable: false,
|
|
212
|
+
value: frozenRaw,
|
|
213
|
+
writable: false
|
|
214
|
+
});
|
|
215
|
+
return Object.freeze(cooked);
|
|
216
|
+
}
|
|
200
217
|
function createRenderedStatement(statement) {
|
|
201
218
|
if (typeof statement !== "object" || statement === null) throw new TypeError("RenderedStatement must be an object.");
|
|
202
219
|
if (knownRenderedStatements.has(statement)) return statement;
|
|
@@ -207,6 +224,7 @@ function createRenderedStatement(statement) {
|
|
|
207
224
|
if (typeof statement.dialectId !== "string" || !statement.dialectId) throw new TypeError("RenderedStatement dialectId must be a non-empty string.");
|
|
208
225
|
const segments = Object.freeze([...statement.segments]);
|
|
209
226
|
if (segments.some((segment) => typeof segment !== "string")) throw new TypeError("RenderedStatement segments must be an array of strings.");
|
|
227
|
+
const nativeTemplate = statement.nativeTemplate === void 0 ? void 0 : copyNativeTemplate(statement.nativeTemplate, segments);
|
|
210
228
|
const parameters = Object.freeze(Array.from(statement.parameters, copyRenderedParameter));
|
|
211
229
|
if (parameters.some((parameter) => parameter.direction === "inout" && statement.resultKind !== "call")) throw new TypeError("INOUT parameters are only valid for call statements.");
|
|
212
230
|
if (parameters.some((parameter) => parameter.direction === "out" && statement.resultKind !== "call" && statement.resultKind !== "rows")) throw new TypeError("OUT parameters are only valid for call and rows statements.");
|
|
@@ -220,6 +238,7 @@ function createRenderedStatement(statement) {
|
|
|
220
238
|
const rendered = Object.freeze({
|
|
221
239
|
segments,
|
|
222
240
|
parameters,
|
|
241
|
+
...nativeTemplate === void 0 ? {} : { nativeTemplate },
|
|
223
242
|
dialectId: statement.dialectId,
|
|
224
243
|
resultKind: statement.resultKind,
|
|
225
244
|
...routineProcedure === void 0 ? {} : { routineProcedure },
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../src/index.ts"],"sourcesContent":["import type { StandardSchemaV1 } from \"@standard-schema/spec\";\n\nexport type { StandardSchemaV1 } from \"@standard-schema/spec\";\n\nexport const SQL_FRAGMENT = Symbol.for(\"sqlbraid.fragment\");\n\nconst SQL_BOUND_PARAMETER = Symbol.for(\"sqlbraid.bound-parameter\");\nconst knownBoundParameters = new WeakSet<object>();\ndeclare const boundParameterBrand: unique symbol;\nconst SQL_ROUTINE_PARAMETER = Symbol.for(\"sqlbraid.routine-parameter\");\nconst knownRoutineParameters = new WeakSet<object>();\n\nexport interface SourceRange {\n readonly start: number;\n readonly end: number;\n}\n\nexport interface RenderLimits {\n readonly maxSqlBytes?: number;\n readonly maxBindCount?: number;\n readonly maxStructuralItems?: number;\n readonly maxNestingDepth?: number;\n}\n\nexport type QueryResultKind = \"rows\" | \"command\" | \"call\" | \"unknown\";\n\nexport type NumericSemantics =\n | \"exact-integer\"\n | \"exact-decimal\"\n | \"approximate-binary\";\n\nexport type NumericRepresentation = \"string\" | \"number\";\n\nexport type TransportFidelity =\n | \"lossless\"\n | \"guarded\"\n | \"lossy\"\n | \"unsupported\";\n\nexport interface NumericTypeContract {\n readonly semantics: NumericSemantics;\n readonly representation: NumericRepresentation;\n readonly fidelity: TransportFidelity;\n readonly binaryPrecision?: 32 | 64;\n}\n\nexport interface ExactIntegerRange {\n readonly min?: bigint;\n readonly max?: bigint;\n}\n\nexport class ResultExactnessError extends Error {\n readonly code = \"BRAID_RESULT_EXACTNESS\";\n\n constructor(message = \"Result value does not have an exact representation.\") {\n super(message);\n this.name = \"ResultExactnessError\";\n }\n}\n\nfunction exactnessFailure(message: string): never {\n throw new ResultExactnessError(message);\n}\n\nexport function decodeExactInteger(value: unknown, range?: ExactIntegerRange): bigint {\n let result: bigint;\n if (typeof value === \"bigint\") {\n result = value;\n } else if (typeof value === \"string\" && /^[+-]?\\d+$/u.test(value)) {\n try {\n result = BigInt(value);\n } catch {\n return exactnessFailure(\"Result value does not have an exact integer representation.\");\n }\n } else if (typeof value === \"number\" && Number.isSafeInteger(value)) {\n result = BigInt(value);\n } else {\n return exactnessFailure(\"Result value does not have an exact integer representation.\");\n }\n\n if (range !== undefined) {\n if (\n (range.min !== undefined && typeof range.min !== \"bigint\")\n || (range.max !== undefined && typeof range.max !== \"bigint\")\n || (range.min !== undefined && range.max !== undefined && range.min > range.max)\n ) {\n throw new TypeError(\"Exact integer range bounds must be ordered bigint values.\");\n }\n if (range.min !== undefined && result < range.min) {\n return exactnessFailure(\"Result exact integer is below the configured minimum.\");\n }\n if (range.max !== undefined && result > range.max) {\n return exactnessFailure(\"Result exact integer is above the configured maximum.\");\n }\n }\n return result;\n}\n\n/**\n * Normalize an exact integer at the raw SQLBraid boundary without changing\n * its textual spelling. This is intentionally not a bigint decoder: callers\n * that need arithmetic may opt in to decodeExactInteger().\n */\nexport function normalizeExactInteger(value: unknown): string {\n if (typeof value === \"string\" && /^[+-]?\\d+$/u.test(value)) return value;\n if (typeof value === \"bigint\") return value.toString(10);\n if (typeof value === \"number\" && Number.isSafeInteger(value)) return String(value);\n return exactnessFailure(\"Result value does not have an exact integer representation.\");\n}\n\n/**\n * Convert a database-reported count to a safe operational Number. Counts are\n * not application values, so unlike exact SQL numerics they remain numbers,\n * but narrowing an unsafe value is never implicit.\n */\nexport function safeDatabaseCount(value: unknown): number {\n if (typeof value === \"number\") {\n if (Number.isSafeInteger(value) && value >= 0) return value === 0 ? 0 : value;\n return exactnessFailure(\"Database count is not a safe non-negative integer.\");\n }\n if (typeof value === \"bigint\") {\n if (value < 0n || value > BigInt(Number.MAX_SAFE_INTEGER)) {\n return exactnessFailure(\"Database count is not a safe non-negative integer.\");\n }\n return Number(value);\n }\n if (typeof value === \"string\" && /^[+]?\\d+$/u.test(value)) {\n try {\n const count = BigInt(value);\n if (count >= 0n && count <= BigInt(Number.MAX_SAFE_INTEGER)) return Number(count);\n } catch {\n // Fall through to the common exactness error.\n }\n }\n return exactnessFailure(\"Database count is not a safe non-negative integer.\");\n}\n\nexport function decodeExactDecimal(value: unknown, options?: { readonly allowBigInt?: boolean }): string {\n if (typeof value === \"string\") return value;\n if (typeof value === \"bigint\" && options?.allowBigInt === true) return value.toString();\n return exactnessFailure(\"Result value does not have an exact decimal representation.\");\n}\n\nexport type RoutineParameterDirection = \"in\" | \"out\" | \"inout\";\n\nexport interface RoutineProcedure {\n readonly name: string;\n readonly parameterNames: readonly string[];\n}\n\nexport type RoutineSchema = StandardSchemaV1<any, any>;\n\nexport interface RoutineContract<\n Output extends Readonly<Record<string, unknown>> = Readonly<Record<string, unknown>>,\n Sets extends readonly RoutineSchema[] = readonly RoutineSchema[],\n ReturnValue = unknown,\n> {\n readonly output?: StandardSchemaV1<any, Output>;\n readonly resultSets?: Sets;\n readonly returnValue?: StandardSchemaV1<any, ReturnValue>;\n readonly procedure?: RoutineProcedure;\n}\n\n/**\n * A rendered parameter is always a value. Adapters MUST NOT interpret it as\n * raw SQL, an identifier, a nested query, a driver-specific fragment, or a\n * structural tagged-template command.\n */\nexport interface RenderedParameter {\n readonly value: unknown;\n readonly interpolation?: number;\n readonly hint?: ParameterTypeHint;\n readonly direction?: RoutineParameterDirection;\n readonly outputName?: string;\n}\n\nexport interface RenderedStatement {\n readonly segments: readonly string[];\n readonly parameters: readonly RenderedParameter[];\n readonly dialectId: string;\n readonly resultKind: QueryResultKind;\n readonly routineProcedure?: RoutineProcedure;\n readonly fingerprint?: string;\n readonly variantFingerprint?: string;\n}\n\nexport interface ParameterTypeHint<Input = unknown> {\n readonly databaseType: string;\n readonly length?: number | \"max\";\n readonly precision?: number;\n readonly scale?: number;\n readonly __input?: Input;\n}\n\nexport interface BoundParameter<Input = unknown> {\n readonly value: Input;\n readonly hint: ParameterTypeHint<Input>;\n readonly [boundParameterBrand]: true;\n}\n\nexport interface RoutineParameter<Input = unknown> {\n readonly value: Input;\n readonly hint?: ParameterTypeHint;\n readonly direction: Exclude<RoutineParameterDirection, \"in\">;\n readonly outputName: string;\n}\n\nfunction validHintNumber(value: unknown): value is number {\n return typeof value === \"number\" && Number.isFinite(value) && Number.isInteger(value) && value >= 0;\n}\n\nfunction validHintInteger(value: unknown): value is number {\n return typeof value === \"number\" && Number.isFinite(value) && Number.isInteger(value);\n}\n\nfunction isParameterTypeHint(value: unknown): value is ParameterTypeHint {\n if (typeof value !== \"object\" || value === null || Array.isArray(value)) return false;\n const candidate = value as { readonly databaseType?: unknown; readonly length?: unknown; readonly precision?: unknown; readonly scale?: unknown };\n return typeof candidate.databaseType === \"string\"\n && candidate.databaseType.trim().length > 0\n && (candidate.length === undefined || candidate.length === \"max\" || validHintNumber(candidate.length))\n && (candidate.precision === undefined || validHintNumber(candidate.precision))\n && (candidate.scale === undefined || validHintInteger(candidate.scale));\n}\n\nexport function createParameterTypeHint<Input = unknown>(hint: ParameterTypeHint<Input>): ParameterTypeHint<Input> {\n if (!isParameterTypeHint(hint)) throw new TypeError(\"sql.bind hint must be an object with valid structural fields.\");\n const candidate = hint as { readonly databaseType?: unknown; readonly length?: unknown; readonly precision?: unknown; readonly scale?: unknown };\n if (typeof candidate.databaseType !== \"string\" || !candidate.databaseType.trim()) throw new TypeError(\"sql.bind hint databaseType must be a non-empty string.\");\n if (candidate.length !== undefined && candidate.length !== \"max\" && !validHintNumber(candidate.length)) throw new TypeError(\"sql.bind hint length must be a non-negative integer or \\\"max\\\".\");\n if (candidate.precision !== undefined && !validHintNumber(candidate.precision)) throw new TypeError(\"sql.bind hint precision must be a non-negative integer.\");\n if (candidate.scale !== undefined && !validHintInteger(candidate.scale)) throw new TypeError(\"sql.bind hint scale must be an integer.\");\n const normalized = {\n databaseType: candidate.databaseType,\n ...(candidate.length === undefined ? {} : { length: candidate.length }),\n ...(candidate.precision === undefined ? {} : { precision: candidate.precision }),\n ...(candidate.scale === undefined ? {} : { scale: candidate.scale }),\n } as ParameterTypeHint<Input>;\n return Object.freeze(normalized);\n}\n\nexport function createBoundParameter<Input>(\n value: NoInfer<Input>,\n hint: ParameterTypeHint<Input>,\n): BoundParameter<Input> {\n const normalizedHint = createParameterTypeHint(hint);\n const bound = Object.freeze({ value, hint: normalizedHint, [SQL_BOUND_PARAMETER]: true });\n knownBoundParameters.add(bound);\n return bound as unknown as BoundParameter<Input>;\n}\n\nexport function isBoundParameter(value: unknown): value is BoundParameter {\n if (typeof value !== \"object\" || value === null || !knownBoundParameters.has(value) || !Object.hasOwn(value, SQL_BOUND_PARAMETER)) return false;\n const candidate = value as { readonly value?: unknown; readonly hint?: unknown; readonly [SQL_BOUND_PARAMETER]?: unknown };\n return candidate[SQL_BOUND_PARAMETER] === true\n && Object.hasOwn(candidate, \"value\")\n && isParameterTypeHint(candidate.hint);\n}\n\nfunction normalizeOutputName(name: unknown): string {\n if (typeof name !== \"string\" || !name.trim()) throw new TypeError(\"Routine outputName must be a non-empty string.\");\n return name;\n}\n\nexport function createRoutineOutParameter(\n name: string,\n hint?: ParameterTypeHint,\n): RoutineParameter<null> {\n const normalizedHint = hint === undefined ? undefined : createParameterTypeHint(hint);\n const parameter = Object.freeze({\n value: null,\n direction: \"out\" as const,\n outputName: normalizeOutputName(name),\n ...(normalizedHint === undefined ? {} : { hint: normalizedHint }),\n [SQL_ROUTINE_PARAMETER]: true as const,\n });\n knownRoutineParameters.add(parameter);\n return parameter;\n}\n\nexport function createRoutineInOutParameter<Input>(\n name: string,\n value: NoInfer<Input>,\n hint?: ParameterTypeHint<Input>,\n): RoutineParameter<Input> {\n const normalizedHint = hint === undefined ? undefined : createParameterTypeHint(hint);\n const parameter = Object.freeze({\n value,\n direction: \"inout\" as const,\n outputName: normalizeOutputName(name),\n ...(normalizedHint === undefined ? {} : { hint: normalizedHint }),\n [SQL_ROUTINE_PARAMETER]: true as const,\n });\n knownRoutineParameters.add(parameter);\n return parameter as RoutineParameter<Input>;\n}\n\nexport function isRoutineParameter(value: unknown): value is RoutineParameter {\n if (typeof value !== \"object\" || value === null || Array.isArray(value) || !knownRoutineParameters.has(value)) return false;\n const candidate = value as {\n readonly value?: unknown;\n readonly direction?: unknown;\n readonly outputName?: unknown;\n readonly hint?: unknown;\n readonly [SQL_ROUTINE_PARAMETER]?: unknown;\n };\n return candidate[SQL_ROUTINE_PARAMETER] === true\n && Object.hasOwn(candidate, \"value\")\n && (candidate.direction === \"out\" || candidate.direction === \"inout\")\n && typeof candidate.outputName === \"string\"\n && Boolean(candidate.outputName.trim())\n && (candidate.hint === undefined || isParameterTypeHint(candidate.hint));\n}\n\nexport type ParameterTransportKind =\n | \"native-value-template\"\n | \"text-positional\"\n | \"text-named\"\n | \"typed-request\";\n\nexport type RequestedReuse = \"auto\" | \"simple\" | \"reuse\";\nexport type EffectiveReuse = \"simple\" | \"reuse\";\nexport type ReuseOwner = \"sqlbraid\" | \"driver\" | \"server\";\n\nexport interface StatementBindingContext {\n readonly dialectId: string;\n readonly requestedReuse: RequestedReuse;\n readonly preparedName?: string;\n readonly transactionScoped?: boolean;\n}\n\nexport interface BindingDescription {\n readonly index: number;\n readonly name?: string;\n readonly interpolation?: number;\n readonly hint?: ParameterTypeHint;\n readonly direction?: RoutineParameterDirection;\n readonly outputName?: string;\n}\n\nexport interface LiteralizeOptions {\n readonly values?: \"inline\" | \"redacted\";\n readonly maxValueLength?: number;\n readonly binary?: \"summary\" | \"full\";\n readonly redact?: (parameter: RenderedParameter, index: number) => boolean;\n}\n\nexport interface LiteralizedSqlResult {\n readonly text: string;\n /**\n * True when no diagnostic parameter representation was truncated. Redaction,\n * unsupported literal markers, and divergence from wire SQL do not make it\n * incomplete.\n */\n readonly complete: boolean;\n readonly redactedParameters: number;\n readonly truncatedParameters: number;\n}\n\nexport interface StatementBindingDescription {\n readonly adapterId: string;\n readonly dialectId: string;\n readonly transport: ParameterTransportKind;\n readonly parameterizedSql?: string;\n readonly bindings: readonly BindingDescription[];\n readonly reuse: {\n readonly requested: RequestedReuse;\n readonly effective: EffectiveReuse;\n readonly owner: ReuseOwner;\n readonly capacity?: number;\n };\n /** Diagnostic reconstruction only; never use this text as execution input. */\n readonly literalizedSql: (options?: LiteralizeOptions) => LiteralizedSqlResult;\n}\n\nexport interface StatementBindingAdapter {\n readonly id: string;\n describe(statement: RenderedStatement, context: StatementBindingContext): StatementBindingDescription;\n describeBulk?(bulk: RenderedBulk, context: StatementBindingContext): BulkBindingDescription;\n}\n\nexport interface StatementBindingDescriptionOptions {\n readonly adapterId: string;\n readonly transport: ParameterTransportKind;\n readonly placeholder?: (index: number) => string;\n readonly reuse: {\n readonly effective: EffectiveReuse;\n readonly owner: ReuseOwner;\n readonly capacity?: number;\n };\n readonly formatLiteral?: (parameter: RenderedParameter, index: number, options: LiteralizeOptions) => string | undefined;\n}\n\nexport interface RenderedBulk {\n readonly statement: RenderedStatement;\n readonly parameterSets: readonly (readonly unknown[])[];\n}\n\nexport interface BulkBindingDescription {\n readonly adapterId: string;\n readonly dialectId: string;\n readonly transport: ParameterTransportKind;\n readonly parameterizedSql?: string;\n readonly bindings: readonly BindingDescription[];\n readonly itemCount: number;\n valuesAt(index: number): readonly unknown[];\n literalizedSql(index: number, options?: LiteralizeOptions): LiteralizedSqlResult;\n}\n\n/**\n * Normalize and snapshot a homogeneous bulk's logical statement and value\n * matrix. Values themselves are application-owned and are not cloned.\n */\nexport function createRenderedBulk(bulk: RenderedBulk): RenderedBulk {\n if (bulk === null || typeof bulk !== \"object\" || Array.isArray(bulk)) {\n throw new TypeError(\"RenderedBulk must be an object.\");\n }\n const statement = createRenderedStatement(bulk.statement);\n if (!Array.isArray(bulk.parameterSets)) {\n throw new TypeError(\"RenderedBulk parameterSets must be an array.\");\n }\n const parameterCount = statement.parameters.length;\n const parameterSets = Object.freeze(bulk.parameterSets.map((values) => {\n if (!Array.isArray(values) || values.length !== parameterCount) {\n throw new TypeError(\"RenderedBulk parameter sets must match the rendered parameter count.\");\n }\n for (let index = 0; index < values.length; index += 1) {\n if (values[index] === undefined && statement.parameters[index]?.direction !== \"out\") {\n throw new SqlRenderError(\n \"BRAID_BIND_VALUE_UNSUPPORTED\",\n \"Undefined bind values are unsupported; use null for SQL NULL.\",\n );\n }\n }\n return Object.isFrozen(values) ? values : Object.freeze([...values]);\n }));\n return Object.freeze({ statement, parameterSets });\n}\n\nconst knownRenderedStatements = new WeakSet<object>();\n\nfunction copyRenderedParameter(parameter: RenderedParameter): RenderedParameter {\n if (typeof parameter !== \"object\" || parameter === null || Array.isArray(parameter)) {\n throw new TypeError(\"RenderedStatement parameters must be parameter records.\");\n }\n const candidate = parameter as {\n readonly value?: unknown;\n readonly interpolation?: unknown;\n readonly hint?: unknown;\n readonly direction?: unknown;\n readonly outputName?: unknown;\n };\n if (!Object.hasOwn(candidate, \"value\")) throw new TypeError(\"RenderedStatement parameters must contain a value.\");\n const interpolation = candidate.interpolation;\n if (interpolation !== undefined && !validHintNumber(interpolation)) {\n throw new TypeError(\"RenderedStatement parameter interpolation must be a non-negative integer.\");\n }\n const hint = candidate.hint === undefined ? undefined : createParameterTypeHint(candidate.hint as ParameterTypeHint);\n const direction = candidate.direction;\n if (direction !== undefined && direction !== \"in\" && direction !== \"out\" && direction !== \"inout\") {\n throw new TypeError(\"RenderedStatement parameter direction is unsupported.\");\n }\n const outputName = candidate.outputName;\n if (outputName !== undefined && (typeof outputName !== \"string\" || !outputName.trim())) {\n throw new TypeError(\"RenderedStatement parameter outputName must be a non-empty string.\");\n }\n if ((direction === \"out\" || direction === \"inout\") && outputName === undefined) {\n throw new TypeError(\"RenderedStatement OUT and INOUT parameters require an outputName.\");\n }\n if (outputName !== undefined && (direction === undefined || direction === \"in\")) {\n throw new TypeError(\"RenderedStatement parameter outputName requires an OUT or INOUT direction.\");\n }\n if (candidate.value === undefined && direction !== \"out\") {\n throw new SqlRenderError(\n \"BRAID_BIND_VALUE_UNSUPPORTED\",\n \"Undefined bind values are unsupported; use null for SQL NULL.\",\n );\n }\n return Object.freeze({\n value: candidate.value,\n ...(interpolation === undefined ? {} : { interpolation }),\n ...(hint === undefined ? {} : { hint }),\n ...(direction === undefined ? {} : { direction }),\n ...(outputName === undefined ? {} : { outputName }),\n });\n}\n\nfunction copyRoutineProcedure(procedure: RoutineProcedure | undefined): RoutineProcedure | undefined {\n if (procedure === undefined) return undefined;\n if (typeof procedure !== \"object\" || procedure === null || typeof procedure.name !== \"string\" || !procedure.name.trim()) {\n throw new TypeError(\"Routine procedure name must be a non-empty string.\");\n }\n if (!Array.isArray(procedure.parameterNames)) throw new TypeError(\"Routine procedure parameterNames must be an array.\");\n const parameterNames = procedure.parameterNames.map((name) => {\n if (typeof name !== \"string\" || !name.trim()) throw new TypeError(\"Routine procedure parameterNames must contain non-empty strings.\");\n return name;\n });\n if (new Set(parameterNames).size !== parameterNames.length) throw new TypeError(\"Routine procedure parameterNames must be unique.\");\n return Object.freeze({ name: procedure.name, parameterNames: Object.freeze(parameterNames) });\n}\n\nexport function createRenderedStatement(statement: {\n readonly segments: readonly string[];\n readonly parameters: readonly RenderedParameter[];\n readonly resultKind: QueryResultKind;\n readonly routineProcedure?: RoutineProcedure;\n readonly dialectId: string;\n readonly fingerprint?: string;\n readonly variantFingerprint?: string;\n}): RenderedStatement {\n if (typeof statement !== \"object\" || statement === null) throw new TypeError(\"RenderedStatement must be an object.\");\n if (knownRenderedStatements.has(statement)) return statement as RenderedStatement;\n if (!Array.isArray(statement.segments)) {\n throw new TypeError(\"RenderedStatement segments must be an array of strings.\");\n }\n if (!Array.isArray(statement.parameters)) throw new TypeError(\"RenderedStatement parameters must be an array.\");\n if (statement.segments.length !== statement.parameters.length + 1) {\n throw new TypeError(\"RenderedStatement invariant violated: segments.length must equal parameters.length + 1.\");\n }\n if (statement.resultKind !== \"call\" && statement.routineProcedure !== undefined) {\n throw new TypeError(\"Routine procedure metadata is only valid for call statements.\");\n }\n if (typeof statement.dialectId !== \"string\" || !statement.dialectId) throw new TypeError(\"RenderedStatement dialectId must be a non-empty string.\");\n const segments = Object.freeze([...statement.segments]);\n if (segments.some((segment) => typeof segment !== \"string\")) throw new TypeError(\"RenderedStatement segments must be an array of strings.\");\n const parameters = Object.freeze(Array.from(statement.parameters, copyRenderedParameter));\n if (parameters.some((parameter) => parameter.direction === \"inout\" && statement.resultKind !== \"call\")) {\n throw new TypeError(\"INOUT parameters are only valid for call statements.\");\n }\n if (parameters.some((parameter) => parameter.direction === \"out\"\n && statement.resultKind !== \"call\"\n && statement.resultKind !== \"rows\")) {\n throw new TypeError(\"OUT parameters are only valid for call and rows statements.\");\n }\n const outputNames = new Set<string>();\n for (const parameter of parameters) {\n if (parameter.outputName !== undefined) {\n if (outputNames.has(parameter.outputName)) throw new TypeError(`Duplicate routine outputName: ${parameter.outputName}`);\n outputNames.add(parameter.outputName);\n }\n }\n const routineProcedure = copyRoutineProcedure(statement.routineProcedure);\n if (routineProcedure !== undefined && routineProcedure.parameterNames.length !== parameters.length) {\n throw new TypeError(\"Routine procedure parameterNames must match the rendered parameter count.\");\n }\n const rendered = Object.freeze({\n segments,\n parameters,\n dialectId: statement.dialectId,\n resultKind: statement.resultKind,\n ...(routineProcedure === undefined ? {} : { routineProcedure }),\n ...(statement.fingerprint === undefined ? {} : { fingerprint: statement.fingerprint }),\n ...(statement.variantFingerprint === undefined ? {} : { variantFingerprint: statement.variantFingerprint }),\n });\n knownRenderedStatements.add(rendered);\n return rendered;\n}\n\nexport function parameterizedSql(statement: RenderedStatement, placeholder: (index: number) => string): string {\n const parts: string[] = [statement.segments[0] ?? \"\"];\n for (let index = 0; index < statement.parameters.length; index += 1) {\n parts.push(placeholder(index + 1), statement.segments[index + 1] ?? \"\");\n }\n return parts.join(\"\");\n}\n\nfunction genericLiteral(parameter: RenderedParameter, dialectId: string, binary: \"summary\" | \"full\"): string {\n const value = parameter.value;\n if (value === null) return \"NULL\";\n if (value === undefined) return \"[undefined]\";\n if (typeof value === \"string\") return `'${value.replaceAll(\"'\", \"''\")}'`;\n if (typeof value === \"boolean\") {\n if (/^(?:mysql|sqlite)/i.test(dialectId) || /^(?:oracle|mssql|sqlserver)/i.test(dialectId)) return value ? \"1\" : \"0\";\n if (/^(?:postgres|postgresql|cockroach|redshift)/i.test(dialectId)) return value ? \"TRUE\" : \"FALSE\";\n return `[boolean ${value ? \"true\" : \"false\"}]`;\n }\n if (typeof value === \"number\") return Number.isFinite(value) ? String(value) : `[unsupported ${String(value)}]`;\n if (typeof value === \"bigint\") return value.toString();\n if (value instanceof Date) {\n try {\n const timestamp = Date.prototype.getTime.call(value);\n return Number.isNaN(timestamp) ? \"[unsupported date]\" : `[date ${Date.prototype.toISOString.call(value)}]`;\n } catch {\n return \"[unsupported date]\";\n }\n }\n if (value instanceof Uint8Array) {\n try {\n if (binary === \"full\") {\n let hex = \"\";\n for (const byte of value) hex += byte.toString(16).padStart(2, \"0\");\n return `X'${hex}'`;\n }\n return `[binary ${value.byteLength} bytes]`;\n } catch {\n return \"[unsupported binary]\";\n }\n }\n if (typeof value === \"object\") return \"[unsupported object]\";\n return `[unsupported ${typeof value}]`;\n}\n\nfunction literalized(\n statement: RenderedStatement,\n dialectId: string,\n formatLiteral: StatementBindingDescriptionOptions[\"formatLiteral\"],\n options: LiteralizeOptions | undefined,\n): LiteralizedSqlResult {\n const resolved: LiteralizeOptions = options ?? {};\n const valuesMode = resolved.values ?? \"redacted\";\n const maxLength = resolved.maxValueLength;\n if (valuesMode !== \"inline\" && valuesMode !== \"redacted\") throw new TypeError(\"literalizedSql values must be \\\"inline\\\" or \\\"redacted\\\".\");\n if (maxLength !== undefined && (!Number.isSafeInteger(maxLength) || maxLength < 0)) {\n throw new TypeError(\"literalizedSql maxValueLength must be a non-negative integer.\");\n }\n const binary = resolved.binary ?? \"summary\";\n if (binary !== \"summary\" && binary !== \"full\") throw new TypeError(\"literalizedSql binary must be \\\"summary\\\" or \\\"full\\\".\");\n if (resolved.redact !== undefined && typeof resolved.redact !== \"function\") throw new TypeError(\"literalizedSql redact must be a function.\");\n const parts: string[] = [statement.segments[0] ?? \"\"];\n let redactedParameters = 0;\n let truncatedParameters = 0;\n for (let index = 0; index < statement.parameters.length; index += 1) {\n const parameter = statement.parameters[index];\n const redact = valuesMode === \"redacted\" || resolved.redact?.(parameter, index) === true;\n let valueText: string;\n if (redact) {\n valueText = \"[REDACTED]\";\n redactedParameters += 1;\n } else {\n valueText = formatLiteral?.(parameter, index, resolved) ?? genericLiteral(parameter, dialectId, binary);\n }\n if (maxLength !== undefined && valueText.length > maxLength) {\n valueText = maxLength === 0 ? \"\" : valueText.slice(0, maxLength);\n truncatedParameters += 1;\n }\n parts.push(valueText, statement.segments[index + 1] ?? \"\");\n }\n return Object.freeze({\n text: parts.join(\"\"),\n complete: truncatedParameters === 0,\n redactedParameters,\n truncatedParameters,\n });\n}\n\nexport function createStatementBindingDescription(\n statement: RenderedStatement,\n context: StatementBindingContext,\n options: StatementBindingDescriptionOptions,\n): StatementBindingDescription {\n const logical = createRenderedStatement(statement);\n const adapterId = options.adapterId;\n const transport = options.transport;\n const placeholder = options.placeholder;\n const formatLiteral = options.formatLiteral;\n const effective = options.reuse.effective;\n const owner = options.reuse.owner;\n const capacity = options.reuse.capacity;\n const dialectId = context.dialectId;\n const requestedReuse = context.requestedReuse;\n if (logical.dialectId !== dialectId) {\n throw new TypeError(`BRAID_DIALECT: statement binding dialect ${dialectId} does not match rendered statement dialect ${logical.dialectId}.`);\n }\n if (typeof adapterId !== \"string\" || !adapterId) throw new TypeError(\"Statement binding adapterId must be a non-empty string.\");\n if (typeof dialectId !== \"string\" || !dialectId) throw new TypeError(\"Statement binding dialectId must be a non-empty string.\");\n if (![\"native-value-template\", \"text-positional\", \"text-named\", \"typed-request\"].includes(transport)) {\n throw new TypeError(\"Statement binding transport is unsupported.\");\n }\n if (transport !== \"native-value-template\" && placeholder === undefined) {\n throw new TypeError(\"Text and typed statement transports require a placeholder function.\");\n }\n if (![\"auto\", \"simple\", \"reuse\"].includes(requestedReuse)) throw new TypeError(\"Statement binding requestedReuse is unsupported.\");\n if (![\"simple\", \"reuse\"].includes(effective) || ![\"sqlbraid\", \"driver\", \"server\"].includes(owner)) {\n throw new TypeError(\"Statement binding reuse policy is unsupported.\");\n }\n if (capacity !== undefined && (!Number.isSafeInteger(capacity) || capacity < 0)) {\n throw new TypeError(\"Statement binding reuse capacity must be a non-negative safe integer.\");\n }\n if (placeholder !== undefined && typeof placeholder !== \"function\") {\n throw new TypeError(\"Statement binding placeholder must be a function.\");\n }\n const bindings = Object.freeze(logical.parameters.map((parameter, offset) => Object.freeze({\n index: offset + 1,\n ...(parameter.outputName === undefined ? {} : { name: parameter.outputName, outputName: parameter.outputName }),\n ...(parameter.interpolation === undefined ? {} : { interpolation: parameter.interpolation }),\n ...(parameter.hint === undefined ? {} : { hint: createParameterTypeHint(parameter.hint) }),\n ...(parameter.direction === undefined ? {} : { direction: parameter.direction }),\n })));\n const reuse = Object.freeze({\n requested: requestedReuse,\n effective,\n owner,\n ...(capacity === undefined ? {} : { capacity }),\n });\n let parameterizedReady = false;\n let parameterized: string | undefined;\n const literalCache = new Map<string, LiteralizedSqlResult>();\n let defaultLiteralized: LiteralizedSqlResult | undefined;\n const description = {\n adapterId,\n dialectId,\n transport,\n bindings,\n reuse,\n literalizedSql: (literalOptions?: LiteralizeOptions): LiteralizedSqlResult => {\n if (literalOptions === undefined) {\n if (defaultLiteralized === undefined) defaultLiteralized = literalized(logical, dialectId, formatLiteral, undefined);\n return defaultLiteralized;\n }\n if (typeof literalOptions !== \"object\" || literalOptions === null) throw new TypeError(\"literalizedSql options must be an object.\");\n const values = literalOptions.values;\n const binary = literalOptions.binary;\n const maxValueLength = literalOptions.maxValueLength;\n const redact = literalOptions.redact;\n const snapshot = Object.freeze({\n ...(values === undefined ? {} : { values }),\n ...(binary === undefined ? {} : { binary }),\n ...(maxValueLength === undefined ? {} : { maxValueLength }),\n ...(redact === undefined ? {} : { redact }),\n });\n const cacheKey = redact === undefined\n ? `${values ?? \"\"}\\u0000${binary ?? \"\"}\\u0000${maxValueLength ?? \"\"}`\n : undefined;\n if (cacheKey !== undefined) {\n const cached = literalCache.get(cacheKey);\n if (cached) return cached;\n }\n const result = literalized(logical, dialectId, formatLiteral, snapshot);\n if (cacheKey !== undefined) literalCache.set(cacheKey, result);\n return result;\n },\n } as StatementBindingDescription;\n if (placeholder !== undefined) {\n Object.defineProperty(description, \"parameterizedSql\", {\n enumerable: true,\n configurable: false,\n get: () => {\n if (!parameterizedReady) {\n parameterized = parameterizedSql(logical, placeholder);\n parameterizedReady = true;\n }\n return parameterized;\n },\n });\n }\n return Object.freeze(description);\n}\n\n/**\n * Build one binding description for a logical bulk statement. The statement\n * metadata is shared by every parameter set; values and diagnostics are\n * addressed only when requested for a particular item.\n */\nexport function createBulkBindingDescription(\n bulk: RenderedBulk,\n context: StatementBindingContext,\n options: StatementBindingDescriptionOptions,\n): BulkBindingDescription {\n const logical = createRenderedBulk(bulk);\n const statementBinding = createStatementBindingDescription(logical.statement, context, options);\n const parameterSets = logical.parameterSets;\n const itemCount = parameterSets.length;\n const valuesAt = (index: number): readonly unknown[] => {\n if (!Number.isSafeInteger(index) || index < 0 || index >= itemCount) {\n throw new RangeError(`Bulk item index ${String(index)} is outside [0, ${itemCount}).`);\n }\n return parameterSets[index]!;\n };\n const literalizedSqlFor = (index: number, literalOptions?: LiteralizeOptions): LiteralizedSqlResult => {\n const values = valuesAt(index);\n const optionsSnapshot = literalOptions === undefined ? undefined : {\n ...(literalOptions.values === undefined ? {} : { values: literalOptions.values }),\n ...(literalOptions.binary === undefined ? {} : { binary: literalOptions.binary }),\n ...(literalOptions.maxValueLength === undefined ? {} : { maxValueLength: literalOptions.maxValueLength }),\n ...(literalOptions.redact === undefined ? {} : { redact: literalOptions.redact }),\n };\n const statement = {\n ...logical.statement,\n parameters: logical.statement.parameters.map((parameter, parameterIndex) => ({\n ...parameter,\n value: values[parameterIndex],\n })),\n };\n const result = createStatementBindingDescription(\n statement,\n context,\n options,\n ).literalizedSql(optionsSnapshot);\n return result;\n };\n const description = {\n adapterId: statementBinding.adapterId,\n dialectId: statementBinding.dialectId,\n transport: statementBinding.transport,\n bindings: statementBinding.bindings,\n itemCount,\n valuesAt,\n literalizedSql: literalizedSqlFor,\n } as BulkBindingDescription;\n if (\"parameterizedSql\" in statementBinding) {\n Object.defineProperty(description, \"parameterizedSql\", {\n enumerable: true,\n configurable: false,\n get: () => statementBinding.parameterizedSql,\n });\n }\n return Object.freeze(description);\n}\n\nexport interface DialectLexicalProfile {\n readonly lineCommentPrefixes: readonly string[];\n readonly supportsNestedBlockComments?: boolean;\n readonly supportsDollarQuotes?: boolean;\n readonly supportsBacktickIdentifiers?: boolean;\n readonly supportsBracketIdentifiers?: boolean;\n readonly supportsOracleQQuotes?: boolean;\n readonly backslashEscapes?: boolean;\n}\n\nexport interface Dialect {\n readonly id: string;\n quoteIdentifier(identifier: string): string;\n readonly lexicalProfile?: DialectLexicalProfile;\n}\n\nexport interface TypeMapping {\n readonly databaseType: string;\n readonly inputType: string;\n readonly outputType: string;\n readonly nullable: boolean;\n readonly numeric?: NumericTypeContract;\n}\n\nexport interface TypePolicy {\n readonly id: string;\n readonly hash: string;\n readonly mappings: readonly TypeMapping[];\n decode(databaseType: string, value: unknown): unknown;\n encode(databaseType: string, value: unknown): unknown;\n}\n\nexport interface TextNode {\n readonly kind: \"text\";\n readonly text: string;\n readonly range: SourceRange;\n}\n\nexport interface BindNode {\n readonly kind: \"bind\";\n readonly interpolation: number;\n readonly range: SourceRange;\n}\n\nexport interface FragmentNode {\n readonly kind: \"fragment\";\n readonly fragment: SqlFragment;\n readonly range: SourceRange;\n}\n\nexport interface IdentifierNode {\n readonly kind: \"identifier\";\n readonly value: string | readonly string[];\n readonly range: SourceRange;\n}\n\nexport interface RawNode {\n readonly kind: \"raw\";\n readonly text: string;\n readonly range: SourceRange;\n}\n\nexport interface ListNode {\n readonly kind: \"list\";\n readonly values: readonly unknown[];\n readonly range: SourceRange;\n}\n\nexport interface IfNode {\n readonly kind: \"if\";\n readonly condition: number;\n readonly children: readonly TemplateNode[];\n readonly range: SourceRange;\n}\n\nexport interface ChooseWhen {\n readonly condition: number;\n readonly children: readonly TemplateNode[];\n readonly range: SourceRange;\n}\n\nexport interface ChooseNode {\n readonly kind: \"choose\";\n readonly whens: readonly ChooseWhen[];\n readonly otherwise?: readonly TemplateNode[];\n readonly range: SourceRange;\n}\n\nexport interface TrimAttributes {\n readonly prefix: string;\n readonly prefixOverrides: readonly string[];\n readonly suffix: string;\n readonly suffixOverrides: readonly string[];\n}\n\nexport interface TrimNode {\n readonly kind: \"trim\";\n readonly attributes: TrimAttributes;\n readonly children: readonly TemplateNode[];\n readonly range: SourceRange;\n}\n\nexport type TemplateNode =\n | TextNode\n | BindNode\n | FragmentNode\n | IdentifierNode\n | RawNode\n | ListNode\n | IfNode\n | ChooseNode\n | TrimNode;\n\nexport interface TemplateIr {\n readonly version: 1;\n readonly nodes: readonly TemplateNode[];\n readonly sourceLength: number;\n}\n\nexport interface SqlFragment {\n readonly [SQL_FRAGMENT]: true;\n readonly ir: TemplateIr;\n readonly values: readonly unknown[];\n readonly dialectId: string;\n}\n\nexport interface Query<Row = unknown, Kind extends QueryResultKind = \"unknown\"> {\n readonly ir: TemplateIr;\n readonly values: readonly unknown[];\n readonly resultKind: Kind;\n /**\n * Application result mapper. Never forwarded to a DB driver.\n */\n readonly resultSchema?: StandardSchemaV1<unknown, Row>;\n readonly routineContract?: RoutineContract;\n render(): RenderedStatement;\n readonly __row?: Row;\n}\n\nexport type RowQuery<Row = unknown> = Query<Row, \"rows\">;\nexport type CommandQuery = Query<CommandResult, \"command\">;\nexport type CallQuery<Result extends RoutineCallResult = RoutineCallResult> = Query<Result, \"call\">;\n\nexport interface CommandResult {\n readonly affectedRows?: number;\n readonly insertId?: string;\n readonly [key: string]: unknown;\n}\n\nexport interface RowsExecutionResult<Row = unknown> {\n readonly kind: \"rows\";\n readonly rows: readonly Row[];\n readonly rowCount?: number;\n readonly command?: never;\n}\n\nexport interface CommandExecutionResult {\n readonly kind: \"command\";\n readonly rows: readonly [];\n readonly rowCount?: number;\n readonly command: CommandResult;\n}\n\nexport type QueryExecutionResult<Row = unknown> =\n | RowsExecutionResult<Row>\n | CommandExecutionResult;\n\nexport interface ExecutionOptions {\n readonly signal?: AbortSignal;\n}\n\nexport interface RowValidationOptions<Row> extends ExecutionOptions {\n readonly schema?: StandardSchemaV1<unknown, NoInfer<Row>>;\n}\n\nexport interface StreamOptions<Row> extends RowValidationOptions<Row> {}\n\nexport type TransactionIsolation =\n | \"read-uncommitted\"\n | \"read-committed\"\n | \"repeatable-read\"\n | \"serializable\";\n\nexport interface TransactionOptions {\n readonly isolation?: TransactionIsolation;\n readonly readOnly?: boolean;\n}\n\nexport class UnsupportedFeatureError extends Error {\n constructor(\n readonly feature: string,\n readonly code: `BRAID_${string}`,\n message: string,\n options?: ErrorOptions,\n ) {\n super(`${code}: ${message}`, options);\n this.name = \"UnsupportedFeatureError\";\n }\n}\n\nexport interface RoutineResultSet<Row = unknown> {\n readonly rows: readonly Row[];\n}\n\nexport type RoutineResultSetTuple<Sets extends readonly unknown[]> = {\n readonly [K in keyof Sets]: RoutineResultSet<Sets[K]>;\n};\n\nexport interface RoutineCallResult<\n Output extends Readonly<Record<string, unknown>> = Readonly<Record<string, unknown>>,\n Sets extends readonly unknown[] = readonly unknown[],\n ReturnValue = unknown,\n> {\n readonly output: Output;\n readonly resultSets: RoutineResultSetTuple<Sets>;\n readonly returnValue?: ReturnValue;\n}\n\nexport type RoutineSchemaOutput<Schema> = Schema extends StandardSchemaV1<any, infer Output> ? Output : never;\n\ntype RoutineRowsFromSchemas<Schemas extends readonly RoutineSchema[]> = {\n readonly [K in keyof Schemas]: RoutineSchemaOutput<Schemas[K]>;\n};\n\nexport type RoutineResultFromContract<Contract extends RoutineContract> = RoutineCallResult<\n Contract[\"output\"] extends RoutineSchema\n ? RoutineSchemaOutput<Contract[\"output\"]> extends Readonly<Record<string, unknown>>\n ? RoutineSchemaOutput<Contract[\"output\"]>\n : Readonly<Record<string, unknown>>\n : Readonly<Record<string, unknown>>,\n Contract[\"resultSets\"] extends infer Schemas extends readonly RoutineSchema[]\n ? RoutineRowsFromSchemas<Schemas>\n : readonly unknown[],\n Contract[\"returnValue\"] extends RoutineSchema ? RoutineSchemaOutput<Contract[\"returnValue\"]> : unknown\n> & (Contract extends { readonly returnValue: RoutineSchema }\n ? { readonly returnValue: RoutineSchemaOutput<Contract[\"returnValue\"]> }\n : {});\n\nexport type RoutineResultSource =\n | {\n readonly kind: \"out-cursor\";\n readonly name?: string;\n readonly parameterIndex?: number;\n }\n | {\n readonly kind: \"implicit\";\n readonly index: number;\n }\n | {\n readonly kind: \"emitted\";\n readonly index: number;\n };\n\nexport interface DriverRoutineResultSet {\n readonly rows: readonly unknown[];\n readonly source: RoutineResultSource;\n}\n\nexport interface DriverRoutineResult {\n readonly output: Readonly<Record<string, unknown>>;\n readonly returnValue?: unknown;\n readonly resultSets: readonly DriverRoutineResultSet[];\n}\n\nexport type RoutineMappingLocation =\n | { readonly kind: \"output\" }\n | { readonly kind: \"return-value\" }\n | {\n readonly kind: \"result-set\";\n readonly resultSetIndex: number;\n readonly rowIndex: number;\n };\n\nexport type DriverCapabilityErrorCode =\n | \"BRAID_STREAM_UNSUPPORTED\"\n | \"BRAID_CALL_UNSUPPORTED\"\n | \"BRAID_CALL_RESULT_SETS\"\n | \"BRAID_CALL_CURSOR_TX_REQUIRED\"\n | \"BRAID_CALL_OUT_UNSUPPORTED\"\n | \"BRAID_CALL_RETURN_UNSUPPORTED\"\n | \"BRAID_CALL_CURSOR_UNSUPPORTED\"\n | \"BRAID_RESOURCE_CLEANUP\";\n\nexport class RoutineMappingError extends Error {\n readonly code = \"BRAID_CALL_MAP\";\n readonly location: RoutineMappingLocation;\n\n constructor(message: string, location: RoutineMappingLocation, options?: { readonly cause?: unknown }) {\n super(message, options);\n this.name = \"RoutineMappingError\";\n this.location = Object.freeze(location);\n }\n}\n\nexport type BulkExecutionMode = \"native-bulk\" | \"pipeline\" | \"prepared-loop\" | \"remote-batch\";\n\nexport interface BulkExecutionResult {\n readonly inputCount: number;\n readonly affectedRows?: number;\n readonly executionMode: BulkExecutionMode;\n}\n\nexport interface QueryExecutor {\n /** Stable identity for the physical execution resource shared by wrappers; pools must use a leased resource. */\n readonly ownershipKey?: object;\n readonly statementBinding: StatementBindingAdapter;\n readonly environment?: DriverEnvironment;\n query<Row>(rendered: RenderedStatement, binding?: StatementBindingDescription, options?: ExecutionOptions): Promise<QueryExecutionResult<Row>>;\n stream<Row>(rendered: RenderedStatement, binding?: StatementBindingDescription, options?: ExecutionOptions): AsyncIterable<Row>;\n call(rendered: RenderedStatement, binding?: StatementBindingDescription, options?: ExecutionOptions): Promise<DriverRoutineResult>;\n bulk?(bulk: RenderedBulk, binding: BulkBindingDescription, options?: ExecutionOptions): Promise<BulkExecutionResult>;\n begin?(options?: TransactionOptions): Promise<void>;\n commit?(): Promise<void>;\n rollback?(): Promise<void>;\n savepoint?(name: string): Promise<void>;\n rollbackTo?(name: string): Promise<void>;\n releaseSavepoint?(name: string): Promise<void>;\n}\n\nexport interface ConnectionLease extends QueryExecutor {\n release(options?: { readonly discard?: boolean }): void | Promise<void>;\n}\n\nexport interface ConnectionProvider {\n readonly statementBinding: StatementBindingAdapter;\n readonly environment?: DriverEnvironment;\n acquire(): Promise<ConnectionLease>;\n}\n\nexport interface QueryExecutionPlan {\n readonly adapterId: string;\n readonly dialectId: string;\n readonly transport: ParameterTransportKind;\n readonly reuse: StatementBindingDescription[\"reuse\"];\n}\n\nexport interface QueryReadyEvent {\n readonly type: \"query:ready\";\n readonly purpose?: \"environment\";\n readonly operationId: string;\n readonly batchId?: string;\n readonly sql?: string;\n readonly values: readonly unknown[];\n readonly bindingMap?: readonly {\n readonly placeholder: number;\n readonly interpolation?: number;\n readonly direction?: RoutineParameterDirection;\n readonly outputName?: string;\n }[];\n readonly parameterHints?: readonly (ParameterTypeHint | undefined)[];\n readonly execution: QueryExecutionPlan;\n readonly literalizedSql: (options?: LiteralizeOptions) => LiteralizedSqlResult;\n readonly declaredKind: QueryResultKind;\n readonly fingerprint?: string;\n readonly variantFingerprint?: string;\n readonly preparedName?: string;\n readonly transactionDepth: number;\n readonly transactionScoped: boolean;\n}\n\nexport interface QueryResultEvent {\n readonly type: \"query:result\";\n readonly purpose?: \"environment\";\n readonly operationId: string;\n readonly preparedName?: string;\n readonly batchId?: string;\n readonly durationMs: number;\n readonly actualKind: \"rows\" | \"command\" | \"call\";\n readonly rowCount?: number;\n readonly resultSetCount?: number;\n readonly outputKeys?: readonly string[];\n readonly hasReturnValue?: boolean;\n readonly command?: Readonly<Record<string, unknown>>;\n readonly transactionDepth: number;\n readonly transactionScoped: boolean;\n}\n\nexport interface QueryMappedEvent {\n readonly type: \"query:mapped\";\n readonly purpose?: \"environment\";\n readonly operationId: string;\n readonly preparedName?: string;\n readonly batchId?: string;\n readonly durationMs: number;\n readonly rowCount: number;\n readonly queryMapped: boolean;\n readonly executionMapped: boolean;\n readonly transactionDepth: number;\n readonly transactionScoped: boolean;\n}\n\nexport interface BulkReadyEvent {\n readonly type: \"bulk:ready\";\n readonly operationId: string;\n readonly itemCount: number;\n readonly transactionDepth: number;\n readonly transactionScoped: boolean;\n readonly sql?: string;\n readonly valuesAt: (index: number) => readonly unknown[];\n readonly literalizedSql: (index: number, options?: LiteralizeOptions) => LiteralizedSqlResult;\n}\n\nexport interface BulkResultEvent {\n readonly type: \"bulk:result\";\n readonly operationId: string;\n readonly itemCount: number;\n readonly affectedRows?: number;\n readonly executionMode: BulkExecutionMode;\n readonly durationMs: number;\n readonly transactionDepth: number;\n readonly transactionScoped: boolean;\n}\n\nexport type QueryErrorStage =\n | \"render\"\n | \"prepared\"\n | \"observer-before\"\n | \"materialize\"\n | \"acquire\"\n | \"driver\"\n | \"result-kind\"\n | \"cardinality\"\n | \"query-map\"\n | \"execution-map\"\n | \"observer-after\"\n | \"release\"\n | \"stream\"\n | \"transaction\";\n\nexport interface QueryErrorEvent {\n readonly type: \"query:error\";\n readonly purpose?: \"environment\";\n readonly operationId: string;\n readonly preparedName?: string;\n readonly batchId?: string;\n readonly error: unknown;\n readonly stage: QueryErrorStage;\n readonly executionStarted: boolean;\n readonly executionCompleted: boolean;\n readonly durationMs?: number;\n readonly transactionDepth: number;\n readonly transactionScoped: boolean;\n}\n\nexport interface StreamStartEvent {\n readonly type: \"stream:start\";\n readonly operationId: string;\n readonly sql?: string;\n readonly values: readonly unknown[];\n readonly bindingMap?: readonly {\n readonly placeholder: number;\n readonly interpolation?: number;\n readonly direction?: RoutineParameterDirection;\n readonly outputName?: string;\n }[];\n readonly parameterHints?: readonly (ParameterTypeHint | undefined)[];\n readonly execution: QueryExecutionPlan;\n readonly literalizedSql: (options?: LiteralizeOptions) => LiteralizedSqlResult;\n readonly declaredKind: \"rows\";\n readonly variantFingerprint?: string;\n readonly preparedName?: string;\n readonly transactionDepth: number;\n readonly transactionScoped: boolean;\n}\n\nexport interface StreamEndEvent {\n readonly type: \"stream:end\";\n readonly operationId: string;\n readonly status: \"completed\" | \"error\";\n readonly durationMs: number;\n readonly rowCount: number;\n readonly error?: unknown;\n readonly transactionDepth: number;\n readonly transactionScoped: boolean;\n}\n\nexport type TransactionEventPhase =\n | \"begin\"\n | \"commit\"\n | \"rollback\"\n | \"savepoint\"\n | \"rollback-to-savepoint\"\n | \"release-savepoint\";\n\nexport interface TransactionEvent {\n readonly type: \"transaction\";\n readonly transactionId: string;\n readonly phase: TransactionEventPhase;\n readonly status: \"requested\" | \"completed\" | \"failed\";\n readonly depth: number;\n readonly savepointName?: string;\n readonly durationMs?: number;\n readonly error?: unknown;\n}\n\nexport type ExecutionEvent =\n | QueryReadyEvent\n | QueryResultEvent\n | QueryMappedEvent\n | BulkReadyEvent\n | BulkResultEvent\n | QueryErrorEvent\n | StreamStartEvent\n | StreamEndEvent\n | TransactionEvent;\n\nexport interface ExecutionObserver {\n onEvent(event: ExecutionEvent): void | Promise<void>;\n}\n\nexport interface EnvironmentCapability {\n readonly status: \"guaranteed\" | \"guarded\" | \"unsupported\";\n readonly canonical?: \"string\" | \"number\" | \"Uint8Array\";\n readonly rawRepresentations?: readonly string[];\n readonly conditionCode?: string;\n}\n\nexport interface DatabaseEnvironment {\n readonly database: { readonly product: string; readonly version?: string; readonly edition?: string };\n readonly driver: { readonly id: string; readonly version?: string; readonly profile?: string };\n readonly runtime: { readonly id: string; readonly version?: string };\n readonly typePolicy?: { readonly id: string; readonly hash: string };\n readonly capabilities: Readonly<Record<string, EnvironmentCapability>>;\n readonly supportMatch: {\n readonly status: \"official\" | \"conditional\" | \"compatible\";\n readonly targetId?: string;\n readonly reason?: string;\n };\n}\n\n/** Adapter evidence only. Probes run through the ordinary observed, leased query path. */\nexport interface DriverEnvironment {\n readonly database: DatabaseEnvironment[\"database\"];\n readonly driver: DatabaseEnvironment[\"driver\"];\n readonly typePolicy?: { readonly id: string; readonly hash: string };\n readonly capabilities: DatabaseEnvironment[\"capabilities\"];\n readonly probe?: {\n readonly statement: RenderedStatement;\n readonly read: (rows: readonly unknown[]) => {\n readonly version?: string;\n readonly edition?: string;\n readonly capabilities?: Readonly<Record<string, EnvironmentCapability>>;\n };\n };\n}\n\n/** Structural subset of a support manifest; importing support tooling is unnecessary. */\nexport interface EnvironmentSupportTarget {\n readonly id: string;\n readonly status: string;\n readonly database: { readonly product: string; readonly version: string; readonly edition: string };\n readonly driver: { readonly id: string; readonly version: string; readonly profile: string };\n readonly runtime: { readonly id: string; readonly version: string };\n readonly typePolicy: { readonly id: string; readonly hash: string };\n readonly evidence: { readonly status: string };\n}\n\nexport interface EnvironmentOptions {\n readonly targets?: readonly EnvironmentSupportTarget[];\n /** Re-probe the current lease instead of returning the cached observation. */\n readonly refresh?: boolean;\n}\n\nexport interface DatabaseOptions {\n readonly observers?: readonly ExecutionObserver[];\n readonly reuse?: RequestedReuse;\n}\n\nexport type PreparableQuery = ExecutableQuery | CallQuery;\n\nexport type PreparedArguments<Input, Options> =\n [Input] extends [never] ? [options?: Options] : [input: Input, options?: Options];\n\nexport type PreparedQuery<Input, Q extends PreparableQuery> = {\n readonly name: string;\n} & (Q extends CallQuery<infer Result>\n ? { call(...args: PreparedArguments<Input, ExecutionOptions>): Promise<Result> }\n : { execute(...args: PreparedArguments<Input, ExecutionOptions>): Promise<ExecutionResultOf<Q>> }\n & (Q extends RowQuery<infer Row> ? {\n all(...args: PreparedArguments<Input, RowValidationOptions<Row>>): Promise<readonly Row[]>;\n one(...args: PreparedArguments<Input, RowValidationOptions<Row>>): Promise<Row>;\n maybeOne(...args: PreparedArguments<Input, RowValidationOptions<Row>>): Promise<Row | undefined>;\n stream(...args: PreparedArguments<Input, StreamOptions<Row>>): AsyncIterable<Row>;\n } : {}));\n\nexport type ExecutableQuery =\n | RowQuery<unknown>\n | Query<unknown, \"command\">\n | Query<unknown, \"unknown\">;\n\nexport type ExecutionResultOf<Q> =\n Q extends RowQuery<infer Row>\n ? RowsExecutionResult<Row>\n : Q extends Query<unknown, \"command\">\n ? CommandExecutionResult\n : Q extends Query<infer Row, \"unknown\">\n ? QueryExecutionResult<Row>\n : never;\n\nexport interface Database {\n environment(options?: EnvironmentOptions): Promise<DatabaseEnvironment>;\n all<Row>(query: RowQuery<Row>, options?: RowValidationOptions<Row>): Promise<readonly Row[]>;\n one<Row>(query: RowQuery<Row>, options?: RowValidationOptions<Row>): Promise<Row>;\n maybeOne<Row>(query: RowQuery<Row>, options?: RowValidationOptions<Row>): Promise<Row | undefined>;\n execute<Q extends ExecutableQuery>(query: Q, options?: ExecutionOptions): Promise<ExecutionResultOf<Q>>;\n call<Result extends RoutineCallResult>(query: CallQuery<Result>, options?: ExecutionOptions): Promise<Result>;\n batch<const Queries extends readonly ExecutableQuery[]>(queries: Queries, options?: ExecutionOptions): Promise<{ readonly [K in keyof Queries]: ExecutionResultOf<Queries[K]> }>;\n bulk<Input>(inputs: readonly Input[], factory: (input: Input, index: number) => CommandQuery, options?: ExecutionOptions): Promise<BulkResult>;\n prepare<Factory extends () => PreparableQuery>(\n name: string,\n factory: Factory & (Parameters<Factory> extends [] ? unknown : never),\n ): PreparedQuery<never, ReturnType<Factory>>;\n prepare<Factory extends (input: never) => PreparableQuery>(\n name: string,\n factory: Factory & (Parameters<Factory> extends [unknown] ? unknown : never),\n ): PreparedQuery<Parameters<Factory>[0], ReturnType<Factory>>;\n stream<Row>(query: RowQuery<Row>, options?: StreamOptions<Row>): AsyncIterable<Row>;\n session<T>(callback: (database: Database) => Promise<T>): Promise<T>;\n tx<T>(callback: (database: Database) => Promise<T>): Promise<T>;\n tx<T>(options: TransactionOptions, callback: (database: Database) => Promise<T>): Promise<T>;\n}\n\nexport interface BulkResult {\n readonly inputCount: number;\n readonly affectedRows?: number;\n}\n\nexport type QueryRow<Q> = Q extends Query<infer Row, QueryResultKind> ? Row : never;\n\nexport interface SqlTagLike<Kind extends QueryResultKind = QueryResultKind, Row = unknown> {\n (strings: TemplateStringsArray, ...values: readonly unknown[]): Query<Row, Kind>;\n}\n\nexport interface RoutineContractTag<Contract extends RoutineContract> {\n (strings: TemplateStringsArray, ...values: readonly unknown[]): CallQuery<RoutineResultFromContract<Contract>>;\n}\n\nexport interface RowsTag {\n // Two type parameters keep this overload out of the sql.rows<Row> instantiation expression.\n <Input, Output>(schema: StandardSchemaV1<Input, Output>): SqlTagLike<\"rows\", Output>;\n <Row = unknown>(strings: TemplateStringsArray, ...values: readonly unknown[]): RowQuery<Row>;\n}\n\nexport interface SqlTag extends SqlTagLike<\"unknown\"> {\n rows: RowsTag;\n command: (strings: TemplateStringsArray, ...values: readonly unknown[]) => CommandQuery;\n call: {\n <Result extends RoutineCallResult = RoutineCallResult>(strings: TemplateStringsArray, ...values: readonly unknown[]): CallQuery<Result>;\n <Contract extends RoutineContract>(contract: Contract): RoutineContractTag<Contract>;\n };\n bind<Input>(value: NoInfer<Input>, hint: ParameterTypeHint<Input>): BoundParameter<Input>;\n out(name: string, hint?: ParameterTypeHint): RoutineParameter<null>;\n inOut<Input>(name: string, value: NoInfer<Input>, hint?: ParameterTypeHint<Input>): RoutineParameter<Input>;\n fragment: (strings: TemplateStringsArray, ...values: readonly unknown[]) => SqlFragment;\n empty: SqlFragment;\n ident: (identifier: string | readonly string[]) => SqlFragment;\n raw: (text: string) => SqlFragment;\n join: (items: readonly SqlFragment[], separator?: SqlFragment) => SqlFragment;\n list: (values: readonly unknown[]) => SqlFragment;\n}\n\nexport class SqlRenderError extends Error {\n readonly code: string;\n\n constructor(code: string, message: string) {\n super(message);\n this.name = \"SqlRenderError\";\n this.code = code;\n }\n}\n"],"mappings":";AAIA,MAAa,eAAe,OAAO,IAAI,mBAAmB;AAE1D,MAAM,sBAAsB,OAAO,IAAI,0BAA0B;AACjE,MAAM,uCAAuB,IAAI,QAAgB;AAEjD,MAAM,wBAAwB,OAAO,IAAI,4BAA4B;AACrE,MAAM,yCAAyB,IAAI,QAAgB;AAyCnD,IAAa,uBAAb,cAA0C,MAAM;CAC9C,AAAS,OAAO;CAEhB,YAAY,UAAU,uDAAuD;EAC3E,MAAM,OAAO;EACb,KAAK,OAAO;CACd;AACF;AAEA,SAAS,iBAAiB,SAAwB;CAChD,MAAM,IAAI,qBAAqB,OAAO;AACxC;AAEA,SAAgB,mBAAmB,OAAgB,OAAmC;CACpF,IAAI;CACJ,IAAI,OAAO,UAAU,UACnB,SAAS;MACJ,IAAI,OAAO,UAAU,YAAY,cAAc,KAAK,KAAK,GAC9D,IAAI;EACF,SAAS,OAAO,KAAK;CACvB,QAAQ;EACN,OAAO,iBAAiB,6DAA6D;CACvF;MACK,IAAI,OAAO,UAAU,YAAY,OAAO,cAAc,KAAK,GAChE,SAAS,OAAO,KAAK;MAErB,OAAO,iBAAiB,6DAA6D;CAGvF,IAAI,UAAU,QAAW;EACvB,IACG,MAAM,QAAQ,UAAa,OAAO,MAAM,QAAQ,YAC7C,MAAM,QAAQ,UAAa,OAAO,MAAM,QAAQ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BAAb,cAA6C,MAAM;CAEtC;CACA;CAFX,YACE,AAAS,SACT,AAAS,MACT,SACA,SACA;EACA,MAAM,GAAG,KAAK,IAAI,WAAW,OAAO;EAL3B;EACA;EAKT,KAAK,OAAO;CACd;AACF;AAqFA,IAAa,sBAAb,cAAyC,MAAM;CAC7C,AAAS,OAAO;CAChB,AAAS;CAET,YAAY,SAAiB,UAAkC,SAAwC;EACrG,MAAM,SAAS,OAAO;EACtB,KAAK,OAAO;EACZ,KAAK,WAAW,OAAO,OAAO,QAAQ;CACxC;AACF;AAiXA,IAAa,iBAAb,cAAoC,MAAM;CACxC,AAAS;CAET,YAAY,MAAc,SAAiB;EACzC,MAAM,OAAO;EACb,KAAK,OAAO;EACZ,KAAK,OAAO;CACd;AACF"}
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../src/index.ts"],"sourcesContent":["import type { StandardSchemaV1 } from \"@standard-schema/spec\";\n\nexport type { StandardSchemaV1 } from \"@standard-schema/spec\";\n\nexport const SQL_FRAGMENT = Symbol.for(\"sqlbraid.fragment\");\n\nconst SQL_BOUND_PARAMETER = Symbol.for(\"sqlbraid.bound-parameter\");\nconst knownBoundParameters = new WeakSet<object>();\ndeclare const boundParameterBrand: unique symbol;\nconst SQL_ROUTINE_PARAMETER = Symbol.for(\"sqlbraid.routine-parameter\");\nconst knownRoutineParameters = new WeakSet<object>();\n\nexport interface SourceRange {\n readonly start: number;\n readonly end: number;\n}\n\nexport interface RenderLimits {\n readonly maxSqlBytes?: number;\n readonly maxBindCount?: number;\n readonly maxStructuralItems?: number;\n readonly maxNestingDepth?: number;\n}\n\nexport type QueryResultKind = \"rows\" | \"command\" | \"call\" | \"unknown\";\n\nexport type NumericSemantics =\n | \"exact-integer\"\n | \"exact-decimal\"\n | \"approximate-binary\";\n\nexport type NumericRepresentation = \"string\" | \"number\";\n\nexport type TransportFidelity =\n | \"lossless\"\n | \"guarded\"\n | \"lossy\"\n | \"unsupported\";\n\nexport interface NumericTypeContract {\n readonly semantics: NumericSemantics;\n readonly representation: NumericRepresentation;\n readonly fidelity: TransportFidelity;\n readonly binaryPrecision?: 32 | 64;\n}\n\nexport interface ExactIntegerRange {\n readonly min?: bigint;\n readonly max?: bigint;\n}\n\nexport class ResultExactnessError extends Error {\n readonly code = \"BRAID_RESULT_EXACTNESS\";\n\n constructor(message = \"Result value does not have an exact representation.\") {\n super(message);\n this.name = \"ResultExactnessError\";\n }\n}\n\nfunction exactnessFailure(message: string): never {\n throw new ResultExactnessError(message);\n}\n\nexport function decodeExactInteger(value: unknown, range?: ExactIntegerRange): bigint {\n let result: bigint;\n if (typeof value === \"bigint\") {\n result = value;\n } else if (typeof value === \"string\" && /^[+-]?\\d+$/u.test(value)) {\n try {\n result = BigInt(value);\n } catch {\n return exactnessFailure(\"Result value does not have an exact integer representation.\");\n }\n } else if (typeof value === \"number\" && Number.isSafeInteger(value)) {\n result = BigInt(value);\n } else {\n return exactnessFailure(\"Result value does not have an exact integer representation.\");\n }\n\n if (range !== undefined) {\n if (\n (range.min !== undefined && typeof range.min !== \"bigint\")\n || (range.max !== undefined && typeof range.max !== \"bigint\")\n || (range.min !== undefined && range.max !== undefined && range.min > range.max)\n ) {\n throw new TypeError(\"Exact integer range bounds must be ordered bigint values.\");\n }\n if (range.min !== undefined && result < range.min) {\n return exactnessFailure(\"Result exact integer is below the configured minimum.\");\n }\n if (range.max !== undefined && result > range.max) {\n return exactnessFailure(\"Result exact integer is above the configured maximum.\");\n }\n }\n return result;\n}\n\n/**\n * Normalize an exact integer at the raw SQLBraid boundary without changing\n * its textual spelling. This is intentionally not a bigint decoder: callers\n * that need arithmetic may opt in to decodeExactInteger().\n */\nexport function normalizeExactInteger(value: unknown): string {\n if (typeof value === \"string\" && /^[+-]?\\d+$/u.test(value)) return value;\n if (typeof value === \"bigint\") return value.toString(10);\n if (typeof value === \"number\" && Number.isSafeInteger(value)) return String(value);\n return exactnessFailure(\"Result value does not have an exact integer representation.\");\n}\n\n/**\n * Convert a database-reported count to a safe operational Number. Counts are\n * not application values, so unlike exact SQL numerics they remain numbers,\n * but narrowing an unsafe value is never implicit.\n */\nexport function safeDatabaseCount(value: unknown): number {\n if (typeof value === \"number\") {\n if (Number.isSafeInteger(value) && value >= 0) return value === 0 ? 0 : value;\n return exactnessFailure(\"Database count is not a safe non-negative integer.\");\n }\n if (typeof value === \"bigint\") {\n if (value < 0n || value > BigInt(Number.MAX_SAFE_INTEGER)) {\n return exactnessFailure(\"Database count is not a safe non-negative integer.\");\n }\n return Number(value);\n }\n if (typeof value === \"string\" && /^[+]?\\d+$/u.test(value)) {\n try {\n const count = BigInt(value);\n if (count >= 0n && count <= BigInt(Number.MAX_SAFE_INTEGER)) return Number(count);\n } catch {\n // Fall through to the common exactness error.\n }\n }\n return exactnessFailure(\"Database count is not a safe non-negative integer.\");\n}\n\nexport function decodeExactDecimal(value: unknown, options?: { readonly allowBigInt?: boolean }): string {\n if (typeof value === \"string\") return value;\n if (typeof value === \"bigint\" && options?.allowBigInt === true) return value.toString();\n return exactnessFailure(\"Result value does not have an exact decimal representation.\");\n}\n\nexport type RoutineParameterDirection = \"in\" | \"out\" | \"inout\";\n\nexport interface RoutineProcedure {\n readonly name: string;\n readonly parameterNames: readonly string[];\n}\n\nexport type RoutineSchema = StandardSchemaV1<any, any>;\n\nexport interface RoutineContract<\n Output extends Readonly<Record<string, unknown>> = Readonly<Record<string, unknown>>,\n Sets extends readonly RoutineSchema[] = readonly RoutineSchema[],\n ReturnValue = unknown,\n> {\n readonly output?: StandardSchemaV1<any, Output>;\n readonly resultSets?: Sets;\n readonly returnValue?: StandardSchemaV1<any, ReturnValue>;\n readonly procedure?: RoutineProcedure;\n}\n\n/**\n * A rendered parameter is always a value. Adapters MUST NOT interpret it as\n * raw SQL, an identifier, a nested query, a driver-specific fragment, or a\n * structural tagged-template command.\n */\nexport interface RenderedParameter {\n readonly value: unknown;\n readonly interpolation?: number;\n readonly hint?: ParameterTypeHint;\n readonly direction?: RoutineParameterDirection;\n readonly outputName?: string;\n}\n\nexport interface RenderedStatement {\n readonly segments: readonly string[];\n readonly parameters: readonly RenderedParameter[];\n /**\n * Optional native tagged-template carrier. This preserves the original\n * TemplateStringsArray when a driver can bind values through its native tag.\n * It is metadata only; segments/parameters remain the logical statement.\n */\n readonly nativeTemplate?: TemplateStringsArray;\n readonly dialectId: string;\n readonly resultKind: QueryResultKind;\n readonly routineProcedure?: RoutineProcedure;\n readonly fingerprint?: string;\n readonly variantFingerprint?: string;\n}\n\nexport interface ParameterTypeHint<Input = unknown> {\n readonly databaseType: string;\n readonly length?: number | \"max\";\n readonly precision?: number;\n readonly scale?: number;\n readonly __input?: Input;\n}\n\nexport interface BoundParameter<Input = unknown> {\n readonly value: Input;\n readonly hint: ParameterTypeHint<Input>;\n readonly [boundParameterBrand]: true;\n}\n\nexport interface RoutineParameter<Input = unknown> {\n readonly value: Input;\n readonly hint?: ParameterTypeHint;\n readonly direction: Exclude<RoutineParameterDirection, \"in\">;\n readonly outputName: string;\n}\n\nfunction validHintNumber(value: unknown): value is number {\n return typeof value === \"number\" && Number.isFinite(value) && Number.isInteger(value) && value >= 0;\n}\n\nfunction validHintInteger(value: unknown): value is number {\n return typeof value === \"number\" && Number.isFinite(value) && Number.isInteger(value);\n}\n\nfunction isParameterTypeHint(value: unknown): value is ParameterTypeHint {\n if (typeof value !== \"object\" || value === null || Array.isArray(value)) return false;\n const candidate = value as { readonly databaseType?: unknown; readonly length?: unknown; readonly precision?: unknown; readonly scale?: unknown };\n return typeof candidate.databaseType === \"string\"\n && candidate.databaseType.trim().length > 0\n && (candidate.length === undefined || candidate.length === \"max\" || validHintNumber(candidate.length))\n && (candidate.precision === undefined || validHintNumber(candidate.precision))\n && (candidate.scale === undefined || validHintInteger(candidate.scale));\n}\n\nexport function createParameterTypeHint<Input = unknown>(hint: ParameterTypeHint<Input>): ParameterTypeHint<Input> {\n if (!isParameterTypeHint(hint)) throw new TypeError(\"sql.bind hint must be an object with valid structural fields.\");\n const candidate = hint as { readonly databaseType?: unknown; readonly length?: unknown; readonly precision?: unknown; readonly scale?: unknown };\n if (typeof candidate.databaseType !== \"string\" || !candidate.databaseType.trim()) throw new TypeError(\"sql.bind hint databaseType must be a non-empty string.\");\n if (candidate.length !== undefined && candidate.length !== \"max\" && !validHintNumber(candidate.length)) throw new TypeError(\"sql.bind hint length must be a non-negative integer or \\\"max\\\".\");\n if (candidate.precision !== undefined && !validHintNumber(candidate.precision)) throw new TypeError(\"sql.bind hint precision must be a non-negative integer.\");\n if (candidate.scale !== undefined && !validHintInteger(candidate.scale)) throw new TypeError(\"sql.bind hint scale must be an integer.\");\n const normalized = {\n databaseType: candidate.databaseType,\n ...(candidate.length === undefined ? {} : { length: candidate.length }),\n ...(candidate.precision === undefined ? {} : { precision: candidate.precision }),\n ...(candidate.scale === undefined ? {} : { scale: candidate.scale }),\n } as ParameterTypeHint<Input>;\n return Object.freeze(normalized);\n}\n\nexport function createBoundParameter<Input>(\n value: NoInfer<Input>,\n hint: ParameterTypeHint<Input>,\n): BoundParameter<Input> {\n const normalizedHint = createParameterTypeHint(hint);\n const bound = Object.freeze({ value, hint: normalizedHint, [SQL_BOUND_PARAMETER]: true });\n knownBoundParameters.add(bound);\n return bound as unknown as BoundParameter<Input>;\n}\n\nexport function isBoundParameter(value: unknown): value is BoundParameter {\n if (typeof value !== \"object\" || value === null || !knownBoundParameters.has(value) || !Object.hasOwn(value, SQL_BOUND_PARAMETER)) return false;\n const candidate = value as { readonly value?: unknown; readonly hint?: unknown; readonly [SQL_BOUND_PARAMETER]?: unknown };\n return candidate[SQL_BOUND_PARAMETER] === true\n && Object.hasOwn(candidate, \"value\")\n && isParameterTypeHint(candidate.hint);\n}\n\nfunction normalizeOutputName(name: unknown): string {\n if (typeof name !== \"string\" || !name.trim()) throw new TypeError(\"Routine outputName must be a non-empty string.\");\n return name;\n}\n\nexport function createRoutineOutParameter(\n name: string,\n hint?: ParameterTypeHint,\n): RoutineParameter<null> {\n const normalizedHint = hint === undefined ? undefined : createParameterTypeHint(hint);\n const parameter = Object.freeze({\n value: null,\n direction: \"out\" as const,\n outputName: normalizeOutputName(name),\n ...(normalizedHint === undefined ? {} : { hint: normalizedHint }),\n [SQL_ROUTINE_PARAMETER]: true as const,\n });\n knownRoutineParameters.add(parameter);\n return parameter;\n}\n\nexport function createRoutineInOutParameter<Input>(\n name: string,\n value: NoInfer<Input>,\n hint?: ParameterTypeHint<Input>,\n): RoutineParameter<Input> {\n const normalizedHint = hint === undefined ? undefined : createParameterTypeHint(hint);\n const parameter = Object.freeze({\n value,\n direction: \"inout\" as const,\n outputName: normalizeOutputName(name),\n ...(normalizedHint === undefined ? {} : { hint: normalizedHint }),\n [SQL_ROUTINE_PARAMETER]: true as const,\n });\n knownRoutineParameters.add(parameter);\n return parameter as RoutineParameter<Input>;\n}\n\nexport function isRoutineParameter(value: unknown): value is RoutineParameter {\n if (typeof value !== \"object\" || value === null || Array.isArray(value) || !knownRoutineParameters.has(value)) return false;\n const candidate = value as {\n readonly value?: unknown;\n readonly direction?: unknown;\n readonly outputName?: unknown;\n readonly hint?: unknown;\n readonly [SQL_ROUTINE_PARAMETER]?: unknown;\n };\n return candidate[SQL_ROUTINE_PARAMETER] === true\n && Object.hasOwn(candidate, \"value\")\n && (candidate.direction === \"out\" || candidate.direction === \"inout\")\n && typeof candidate.outputName === \"string\"\n && Boolean(candidate.outputName.trim())\n && (candidate.hint === undefined || isParameterTypeHint(candidate.hint));\n}\n\nexport type ParameterTransportKind =\n | \"native-value-template\"\n | \"text-positional\"\n | \"text-named\"\n | \"typed-request\";\n\nexport type RequestedReuse = \"auto\" | \"simple\" | \"reuse\";\nexport type EffectiveReuse = \"simple\" | \"reuse\";\nexport type ReuseOwner = \"sqlbraid\" | \"driver\" | \"server\";\n\nexport interface StatementBindingContext {\n readonly dialectId: string;\n readonly requestedReuse: RequestedReuse;\n readonly preparedName?: string;\n readonly transactionScoped?: boolean;\n}\n\nexport interface BindingDescription {\n readonly index: number;\n readonly name?: string;\n readonly interpolation?: number;\n readonly hint?: ParameterTypeHint;\n readonly direction?: RoutineParameterDirection;\n readonly outputName?: string;\n}\n\nexport interface LiteralizeOptions {\n readonly values?: \"inline\" | \"redacted\";\n readonly maxValueLength?: number;\n readonly binary?: \"summary\" | \"full\";\n readonly redact?: (parameter: RenderedParameter, index: number) => boolean;\n}\n\nexport interface LiteralizedSqlResult {\n readonly text: string;\n /**\n * True when no diagnostic parameter representation was truncated. Redaction,\n * unsupported literal markers, and divergence from wire SQL do not make it\n * incomplete.\n */\n readonly complete: boolean;\n readonly redactedParameters: number;\n readonly truncatedParameters: number;\n}\n\nexport interface StatementBindingDescription {\n readonly adapterId: string;\n readonly dialectId: string;\n readonly transport: ParameterTransportKind;\n readonly parameterizedSql?: string;\n readonly bindings: readonly BindingDescription[];\n readonly reuse: {\n readonly requested: RequestedReuse;\n readonly effective: EffectiveReuse;\n readonly owner: ReuseOwner;\n readonly capacity?: number;\n };\n /** Diagnostic reconstruction only; never use this text as execution input. */\n readonly literalizedSql: (options?: LiteralizeOptions) => LiteralizedSqlResult;\n}\n\nexport interface StatementBindingAdapter {\n readonly id: string;\n describe(statement: RenderedStatement, context: StatementBindingContext): StatementBindingDescription;\n describeBulk?(bulk: RenderedBulk, context: StatementBindingContext): BulkBindingDescription;\n}\n\nexport interface StatementBindingDescriptionOptions {\n readonly adapterId: string;\n readonly transport: ParameterTransportKind;\n readonly placeholder?: (index: number) => string;\n readonly reuse: {\n readonly effective: EffectiveReuse;\n readonly owner: ReuseOwner;\n readonly capacity?: number;\n };\n readonly formatLiteral?: (parameter: RenderedParameter, index: number, options: LiteralizeOptions) => string | undefined;\n}\n\nexport interface RenderedBulk {\n readonly statement: RenderedStatement;\n readonly parameterSets: readonly (readonly unknown[])[];\n}\n\nexport interface BulkBindingDescription {\n readonly adapterId: string;\n readonly dialectId: string;\n readonly transport: ParameterTransportKind;\n readonly parameterizedSql?: string;\n readonly bindings: readonly BindingDescription[];\n readonly itemCount: number;\n valuesAt(index: number): readonly unknown[];\n literalizedSql(index: number, options?: LiteralizeOptions): LiteralizedSqlResult;\n}\n\n/**\n * Normalize and snapshot a homogeneous bulk's logical statement and value\n * matrix. Values themselves are application-owned and are not cloned.\n */\nexport function createRenderedBulk(bulk: RenderedBulk): RenderedBulk {\n if (bulk === null || typeof bulk !== \"object\" || Array.isArray(bulk)) {\n throw new TypeError(\"RenderedBulk must be an object.\");\n }\n const statement = createRenderedStatement(bulk.statement);\n if (!Array.isArray(bulk.parameterSets)) {\n throw new TypeError(\"RenderedBulk parameterSets must be an array.\");\n }\n const parameterCount = statement.parameters.length;\n const parameterSets = Object.freeze(bulk.parameterSets.map((values) => {\n if (!Array.isArray(values) || values.length !== parameterCount) {\n throw new TypeError(\"RenderedBulk parameter sets must match the rendered parameter count.\");\n }\n for (let index = 0; index < values.length; index += 1) {\n if (values[index] === undefined && statement.parameters[index]?.direction !== \"out\") {\n throw new SqlRenderError(\n \"BRAID_BIND_VALUE_UNSUPPORTED\",\n \"Undefined bind values are unsupported; use null for SQL NULL.\",\n );\n }\n }\n return Object.isFrozen(values) ? values : Object.freeze([...values]);\n }));\n return Object.freeze({ statement, parameterSets });\n}\n\nconst knownRenderedStatements = new WeakSet<object>();\n\nfunction copyRenderedParameter(parameter: RenderedParameter): RenderedParameter {\n if (typeof parameter !== \"object\" || parameter === null || Array.isArray(parameter)) {\n throw new TypeError(\"RenderedStatement parameters must be parameter records.\");\n }\n const candidate = parameter as {\n readonly value?: unknown;\n readonly interpolation?: unknown;\n readonly hint?: unknown;\n readonly direction?: unknown;\n readonly outputName?: unknown;\n };\n if (!Object.hasOwn(candidate, \"value\")) throw new TypeError(\"RenderedStatement parameters must contain a value.\");\n const interpolation = candidate.interpolation;\n if (interpolation !== undefined && !validHintNumber(interpolation)) {\n throw new TypeError(\"RenderedStatement parameter interpolation must be a non-negative integer.\");\n }\n const hint = candidate.hint === undefined ? undefined : createParameterTypeHint(candidate.hint as ParameterTypeHint);\n const direction = candidate.direction;\n if (direction !== undefined && direction !== \"in\" && direction !== \"out\" && direction !== \"inout\") {\n throw new TypeError(\"RenderedStatement parameter direction is unsupported.\");\n }\n const outputName = candidate.outputName;\n if (outputName !== undefined && (typeof outputName !== \"string\" || !outputName.trim())) {\n throw new TypeError(\"RenderedStatement parameter outputName must be a non-empty string.\");\n }\n if ((direction === \"out\" || direction === \"inout\") && outputName === undefined) {\n throw new TypeError(\"RenderedStatement OUT and INOUT parameters require an outputName.\");\n }\n if (outputName !== undefined && (direction === undefined || direction === \"in\")) {\n throw new TypeError(\"RenderedStatement parameter outputName requires an OUT or INOUT direction.\");\n }\n if (candidate.value === undefined && direction !== \"out\") {\n throw new SqlRenderError(\n \"BRAID_BIND_VALUE_UNSUPPORTED\",\n \"Undefined bind values are unsupported; use null for SQL NULL.\",\n );\n }\n return Object.freeze({\n value: candidate.value,\n ...(interpolation === undefined ? {} : { interpolation }),\n ...(hint === undefined ? {} : { hint }),\n ...(direction === undefined ? {} : { direction }),\n ...(outputName === undefined ? {} : { outputName }),\n });\n}\n\nfunction copyRoutineProcedure(procedure: RoutineProcedure | undefined): RoutineProcedure | undefined {\n if (procedure === undefined) return undefined;\n if (typeof procedure !== \"object\" || procedure === null || typeof procedure.name !== \"string\" || !procedure.name.trim()) {\n throw new TypeError(\"Routine procedure name must be a non-empty string.\");\n }\n if (!Array.isArray(procedure.parameterNames)) throw new TypeError(\"Routine procedure parameterNames must be an array.\");\n const parameterNames = procedure.parameterNames.map((name) => {\n if (typeof name !== \"string\" || !name.trim()) throw new TypeError(\"Routine procedure parameterNames must contain non-empty strings.\");\n return name;\n });\n if (new Set(parameterNames).size !== parameterNames.length) throw new TypeError(\"Routine procedure parameterNames must be unique.\");\n return Object.freeze({ name: procedure.name, parameterNames: Object.freeze(parameterNames) });\n}\n\nfunction copyNativeTemplate(value: unknown, segments: readonly string[]): TemplateStringsArray {\n if (!Array.isArray(value) || value.length !== segments.length) {\n throw new TypeError(\"RenderedStatement nativeTemplate must have one string per segment boundary.\");\n }\n if (value.some((segment) => typeof segment !== \"string\")) {\n throw new TypeError(\"RenderedStatement nativeTemplate must contain cooked strings.\");\n }\n if (value.some((segment, index) => segment !== segments[index])) {\n throw new TypeError(\"RenderedStatement nativeTemplate cooked strings must match logical segments.\");\n }\n const raw = (value as { readonly raw?: unknown }).raw;\n if (!Array.isArray(raw) || raw.length !== value.length || raw.some((segment) => typeof segment !== \"string\")) {\n throw new TypeError(\"RenderedStatement nativeTemplate.raw must contain one raw string per segment boundary.\");\n }\n if (Object.isFrozen(value) && Object.isFrozen(raw)) return value as unknown as TemplateStringsArray;\n const cooked = [...value] as string[] & { raw: readonly string[] };\n const frozenRaw = Object.freeze([...raw]);\n Object.defineProperty(cooked, \"raw\", {\n configurable: false,\n enumerable: false,\n value: frozenRaw,\n writable: false,\n });\n return Object.freeze(cooked) as unknown as TemplateStringsArray;\n}\n\nexport function createRenderedStatement(statement: {\n readonly segments: readonly string[];\n readonly parameters: readonly RenderedParameter[];\n readonly nativeTemplate?: TemplateStringsArray;\n readonly resultKind: QueryResultKind;\n readonly routineProcedure?: RoutineProcedure;\n readonly dialectId: string;\n readonly fingerprint?: string;\n readonly variantFingerprint?: string;\n}): RenderedStatement {\n if (typeof statement !== \"object\" || statement === null) throw new TypeError(\"RenderedStatement must be an object.\");\n if (knownRenderedStatements.has(statement)) return statement as RenderedStatement;\n if (!Array.isArray(statement.segments)) {\n throw new TypeError(\"RenderedStatement segments must be an array of strings.\");\n }\n if (!Array.isArray(statement.parameters)) throw new TypeError(\"RenderedStatement parameters must be an array.\");\n if (statement.segments.length !== statement.parameters.length + 1) {\n throw new TypeError(\"RenderedStatement invariant violated: segments.length must equal parameters.length + 1.\");\n }\n if (statement.resultKind !== \"call\" && statement.routineProcedure !== undefined) {\n throw new TypeError(\"Routine procedure metadata is only valid for call statements.\");\n }\n if (typeof statement.dialectId !== \"string\" || !statement.dialectId) throw new TypeError(\"RenderedStatement dialectId must be a non-empty string.\");\n const segments = Object.freeze([...statement.segments]);\n if (segments.some((segment) => typeof segment !== \"string\")) throw new TypeError(\"RenderedStatement segments must be an array of strings.\");\n const nativeTemplate = statement.nativeTemplate === undefined\n ? undefined\n : copyNativeTemplate(statement.nativeTemplate, segments);\n const parameters = Object.freeze(Array.from(statement.parameters, copyRenderedParameter));\n if (parameters.some((parameter) => parameter.direction === \"inout\" && statement.resultKind !== \"call\")) {\n throw new TypeError(\"INOUT parameters are only valid for call statements.\");\n }\n if (parameters.some((parameter) => parameter.direction === \"out\"\n && statement.resultKind !== \"call\"\n && statement.resultKind !== \"rows\")) {\n throw new TypeError(\"OUT parameters are only valid for call and rows statements.\");\n }\n const outputNames = new Set<string>();\n for (const parameter of parameters) {\n if (parameter.outputName !== undefined) {\n if (outputNames.has(parameter.outputName)) throw new TypeError(`Duplicate routine outputName: ${parameter.outputName}`);\n outputNames.add(parameter.outputName);\n }\n }\n const routineProcedure = copyRoutineProcedure(statement.routineProcedure);\n if (routineProcedure !== undefined && routineProcedure.parameterNames.length !== parameters.length) {\n throw new TypeError(\"Routine procedure parameterNames must match the rendered parameter count.\");\n }\n const rendered = Object.freeze({\n segments,\n parameters,\n ...(nativeTemplate === undefined ? {} : { nativeTemplate }),\n dialectId: statement.dialectId,\n resultKind: statement.resultKind,\n ...(routineProcedure === undefined ? {} : { routineProcedure }),\n ...(statement.fingerprint === undefined ? {} : { fingerprint: statement.fingerprint }),\n ...(statement.variantFingerprint === undefined ? {} : { variantFingerprint: statement.variantFingerprint }),\n });\n knownRenderedStatements.add(rendered);\n return rendered;\n}\n\nexport function parameterizedSql(statement: RenderedStatement, placeholder: (index: number) => string): string {\n const parts: string[] = [statement.segments[0] ?? \"\"];\n for (let index = 0; index < statement.parameters.length; index += 1) {\n parts.push(placeholder(index + 1), statement.segments[index + 1] ?? \"\");\n }\n return parts.join(\"\");\n}\n\nfunction genericLiteral(parameter: RenderedParameter, dialectId: string, binary: \"summary\" | \"full\"): string {\n const value = parameter.value;\n if (value === null) return \"NULL\";\n if (value === undefined) return \"[undefined]\";\n if (typeof value === \"string\") return `'${value.replaceAll(\"'\", \"''\")}'`;\n if (typeof value === \"boolean\") {\n if (/^(?:mysql|sqlite)/i.test(dialectId) || /^(?:oracle|mssql|sqlserver)/i.test(dialectId)) return value ? \"1\" : \"0\";\n if (/^(?:postgres|postgresql|cockroach|redshift)/i.test(dialectId)) return value ? \"TRUE\" : \"FALSE\";\n return `[boolean ${value ? \"true\" : \"false\"}]`;\n }\n if (typeof value === \"number\") return Number.isFinite(value) ? String(value) : `[unsupported ${String(value)}]`;\n if (typeof value === \"bigint\") return value.toString();\n if (value instanceof Date) {\n try {\n const timestamp = Date.prototype.getTime.call(value);\n return Number.isNaN(timestamp) ? \"[unsupported date]\" : `[date ${Date.prototype.toISOString.call(value)}]`;\n } catch {\n return \"[unsupported date]\";\n }\n }\n if (value instanceof Uint8Array) {\n try {\n if (binary === \"full\") {\n let hex = \"\";\n for (const byte of value) hex += byte.toString(16).padStart(2, \"0\");\n return `X'${hex}'`;\n }\n return `[binary ${value.byteLength} bytes]`;\n } catch {\n return \"[unsupported binary]\";\n }\n }\n if (typeof value === \"object\") return \"[unsupported object]\";\n return `[unsupported ${typeof value}]`;\n}\n\nfunction literalized(\n statement: RenderedStatement,\n dialectId: string,\n formatLiteral: StatementBindingDescriptionOptions[\"formatLiteral\"],\n options: LiteralizeOptions | undefined,\n): LiteralizedSqlResult {\n const resolved: LiteralizeOptions = options ?? {};\n const valuesMode = resolved.values ?? \"redacted\";\n const maxLength = resolved.maxValueLength;\n if (valuesMode !== \"inline\" && valuesMode !== \"redacted\") throw new TypeError(\"literalizedSql values must be \\\"inline\\\" or \\\"redacted\\\".\");\n if (maxLength !== undefined && (!Number.isSafeInteger(maxLength) || maxLength < 0)) {\n throw new TypeError(\"literalizedSql maxValueLength must be a non-negative integer.\");\n }\n const binary = resolved.binary ?? \"summary\";\n if (binary !== \"summary\" && binary !== \"full\") throw new TypeError(\"literalizedSql binary must be \\\"summary\\\" or \\\"full\\\".\");\n if (resolved.redact !== undefined && typeof resolved.redact !== \"function\") throw new TypeError(\"literalizedSql redact must be a function.\");\n const parts: string[] = [statement.segments[0] ?? \"\"];\n let redactedParameters = 0;\n let truncatedParameters = 0;\n for (let index = 0; index < statement.parameters.length; index += 1) {\n const parameter = statement.parameters[index];\n const redact = valuesMode === \"redacted\" || resolved.redact?.(parameter, index) === true;\n let valueText: string;\n if (redact) {\n valueText = \"[REDACTED]\";\n redactedParameters += 1;\n } else {\n valueText = formatLiteral?.(parameter, index, resolved) ?? genericLiteral(parameter, dialectId, binary);\n }\n if (maxLength !== undefined && valueText.length > maxLength) {\n valueText = maxLength === 0 ? \"\" : valueText.slice(0, maxLength);\n truncatedParameters += 1;\n }\n parts.push(valueText, statement.segments[index + 1] ?? \"\");\n }\n return Object.freeze({\n text: parts.join(\"\"),\n complete: truncatedParameters === 0,\n redactedParameters,\n truncatedParameters,\n });\n}\n\nexport function createStatementBindingDescription(\n statement: RenderedStatement,\n context: StatementBindingContext,\n options: StatementBindingDescriptionOptions,\n): StatementBindingDescription {\n const logical = createRenderedStatement(statement);\n const adapterId = options.adapterId;\n const transport = options.transport;\n const placeholder = options.placeholder;\n const formatLiteral = options.formatLiteral;\n const effective = options.reuse.effective;\n const owner = options.reuse.owner;\n const capacity = options.reuse.capacity;\n const dialectId = context.dialectId;\n const requestedReuse = context.requestedReuse;\n if (logical.dialectId !== dialectId) {\n throw new TypeError(`BRAID_DIALECT: statement binding dialect ${dialectId} does not match rendered statement dialect ${logical.dialectId}.`);\n }\n if (typeof adapterId !== \"string\" || !adapterId) throw new TypeError(\"Statement binding adapterId must be a non-empty string.\");\n if (typeof dialectId !== \"string\" || !dialectId) throw new TypeError(\"Statement binding dialectId must be a non-empty string.\");\n if (![\"native-value-template\", \"text-positional\", \"text-named\", \"typed-request\"].includes(transport)) {\n throw new TypeError(\"Statement binding transport is unsupported.\");\n }\n if (transport !== \"native-value-template\" && placeholder === undefined) {\n throw new TypeError(\"Text and typed statement transports require a placeholder function.\");\n }\n if (![\"auto\", \"simple\", \"reuse\"].includes(requestedReuse)) throw new TypeError(\"Statement binding requestedReuse is unsupported.\");\n if (![\"simple\", \"reuse\"].includes(effective) || ![\"sqlbraid\", \"driver\", \"server\"].includes(owner)) {\n throw new TypeError(\"Statement binding reuse policy is unsupported.\");\n }\n if (capacity !== undefined && (!Number.isSafeInteger(capacity) || capacity < 0)) {\n throw new TypeError(\"Statement binding reuse capacity must be a non-negative safe integer.\");\n }\n if (placeholder !== undefined && typeof placeholder !== \"function\") {\n throw new TypeError(\"Statement binding placeholder must be a function.\");\n }\n const bindings = Object.freeze(logical.parameters.map((parameter, offset) => Object.freeze({\n index: offset + 1,\n ...(parameter.outputName === undefined ? {} : { name: parameter.outputName, outputName: parameter.outputName }),\n ...(parameter.interpolation === undefined ? {} : { interpolation: parameter.interpolation }),\n ...(parameter.hint === undefined ? {} : { hint: createParameterTypeHint(parameter.hint) }),\n ...(parameter.direction === undefined ? {} : { direction: parameter.direction }),\n })));\n const reuse = Object.freeze({\n requested: requestedReuse,\n effective,\n owner,\n ...(capacity === undefined ? {} : { capacity }),\n });\n let parameterizedReady = false;\n let parameterized: string | undefined;\n const literalCache = new Map<string, LiteralizedSqlResult>();\n let defaultLiteralized: LiteralizedSqlResult | undefined;\n const description = {\n adapterId,\n dialectId,\n transport,\n bindings,\n reuse,\n literalizedSql: (literalOptions?: LiteralizeOptions): LiteralizedSqlResult => {\n if (literalOptions === undefined) {\n if (defaultLiteralized === undefined) defaultLiteralized = literalized(logical, dialectId, formatLiteral, undefined);\n return defaultLiteralized;\n }\n if (typeof literalOptions !== \"object\" || literalOptions === null) throw new TypeError(\"literalizedSql options must be an object.\");\n const values = literalOptions.values;\n const binary = literalOptions.binary;\n const maxValueLength = literalOptions.maxValueLength;\n const redact = literalOptions.redact;\n const snapshot = Object.freeze({\n ...(values === undefined ? {} : { values }),\n ...(binary === undefined ? {} : { binary }),\n ...(maxValueLength === undefined ? {} : { maxValueLength }),\n ...(redact === undefined ? {} : { redact }),\n });\n const cacheKey = redact === undefined\n ? `${values ?? \"\"}\\u0000${binary ?? \"\"}\\u0000${maxValueLength ?? \"\"}`\n : undefined;\n if (cacheKey !== undefined) {\n const cached = literalCache.get(cacheKey);\n if (cached) return cached;\n }\n const result = literalized(logical, dialectId, formatLiteral, snapshot);\n if (cacheKey !== undefined) literalCache.set(cacheKey, result);\n return result;\n },\n } as StatementBindingDescription;\n if (placeholder !== undefined) {\n Object.defineProperty(description, \"parameterizedSql\", {\n enumerable: true,\n configurable: false,\n get: () => {\n if (!parameterizedReady) {\n parameterized = parameterizedSql(logical, placeholder);\n parameterizedReady = true;\n }\n return parameterized;\n },\n });\n }\n return Object.freeze(description);\n}\n\n/**\n * Build one binding description for a logical bulk statement. The statement\n * metadata is shared by every parameter set; values and diagnostics are\n * addressed only when requested for a particular item.\n */\nexport function createBulkBindingDescription(\n bulk: RenderedBulk,\n context: StatementBindingContext,\n options: StatementBindingDescriptionOptions,\n): BulkBindingDescription {\n const logical = createRenderedBulk(bulk);\n const statementBinding = createStatementBindingDescription(logical.statement, context, options);\n const parameterSets = logical.parameterSets;\n const itemCount = parameterSets.length;\n const valuesAt = (index: number): readonly unknown[] => {\n if (!Number.isSafeInteger(index) || index < 0 || index >= itemCount) {\n throw new RangeError(`Bulk item index ${String(index)} is outside [0, ${itemCount}).`);\n }\n return parameterSets[index]!;\n };\n const literalizedSqlFor = (index: number, literalOptions?: LiteralizeOptions): LiteralizedSqlResult => {\n const values = valuesAt(index);\n const optionsSnapshot = literalOptions === undefined ? undefined : {\n ...(literalOptions.values === undefined ? {} : { values: literalOptions.values }),\n ...(literalOptions.binary === undefined ? {} : { binary: literalOptions.binary }),\n ...(literalOptions.maxValueLength === undefined ? {} : { maxValueLength: literalOptions.maxValueLength }),\n ...(literalOptions.redact === undefined ? {} : { redact: literalOptions.redact }),\n };\n const statement = {\n ...logical.statement,\n parameters: logical.statement.parameters.map((parameter, parameterIndex) => ({\n ...parameter,\n value: values[parameterIndex],\n })),\n };\n const result = createStatementBindingDescription(\n statement,\n context,\n options,\n ).literalizedSql(optionsSnapshot);\n return result;\n };\n const description = {\n adapterId: statementBinding.adapterId,\n dialectId: statementBinding.dialectId,\n transport: statementBinding.transport,\n bindings: statementBinding.bindings,\n itemCount,\n valuesAt,\n literalizedSql: literalizedSqlFor,\n } as BulkBindingDescription;\n if (\"parameterizedSql\" in statementBinding) {\n Object.defineProperty(description, \"parameterizedSql\", {\n enumerable: true,\n configurable: false,\n get: () => statementBinding.parameterizedSql,\n });\n }\n return Object.freeze(description);\n}\n\nexport interface DialectLexicalProfile {\n readonly lineCommentPrefixes: readonly string[];\n readonly supportsNestedBlockComments?: boolean;\n readonly supportsDollarQuotes?: boolean;\n readonly supportsBacktickIdentifiers?: boolean;\n readonly supportsBracketIdentifiers?: boolean;\n readonly supportsOracleQQuotes?: boolean;\n readonly backslashEscapes?: boolean;\n}\n\nexport interface Dialect {\n readonly id: string;\n quoteIdentifier(identifier: string): string;\n readonly lexicalProfile?: DialectLexicalProfile;\n}\n\nexport interface TypeMapping {\n readonly databaseType: string;\n readonly inputType: string;\n readonly outputType: string;\n readonly nullable: boolean;\n readonly numeric?: NumericTypeContract;\n}\n\nexport interface TypePolicy {\n readonly id: string;\n readonly hash: string;\n readonly mappings: readonly TypeMapping[];\n decode(databaseType: string, value: unknown): unknown;\n encode(databaseType: string, value: unknown): unknown;\n}\n\nexport interface TextNode {\n readonly kind: \"text\";\n readonly text: string;\n readonly range: SourceRange;\n}\n\nexport interface BindNode {\n readonly kind: \"bind\";\n readonly interpolation: number;\n readonly range: SourceRange;\n}\n\nexport interface FragmentNode {\n readonly kind: \"fragment\";\n readonly fragment: SqlFragment;\n readonly range: SourceRange;\n}\n\nexport interface IdentifierNode {\n readonly kind: \"identifier\";\n readonly value: string | readonly string[];\n readonly range: SourceRange;\n}\n\nexport interface RawNode {\n readonly kind: \"raw\";\n readonly text: string;\n readonly range: SourceRange;\n}\n\nexport interface ListNode {\n readonly kind: \"list\";\n readonly values: readonly unknown[];\n readonly range: SourceRange;\n}\n\nexport interface IfNode {\n readonly kind: \"if\";\n readonly condition: number;\n readonly children: readonly TemplateNode[];\n readonly range: SourceRange;\n}\n\nexport interface ChooseWhen {\n readonly condition: number;\n readonly children: readonly TemplateNode[];\n readonly range: SourceRange;\n}\n\nexport interface ChooseNode {\n readonly kind: \"choose\";\n readonly whens: readonly ChooseWhen[];\n readonly otherwise?: readonly TemplateNode[];\n readonly range: SourceRange;\n}\n\nexport interface TrimAttributes {\n readonly prefix: string;\n readonly prefixOverrides: readonly string[];\n readonly suffix: string;\n readonly suffixOverrides: readonly string[];\n}\n\nexport interface TrimNode {\n readonly kind: \"trim\";\n readonly attributes: TrimAttributes;\n readonly children: readonly TemplateNode[];\n readonly range: SourceRange;\n}\n\nexport type TemplateNode =\n | TextNode\n | BindNode\n | FragmentNode\n | IdentifierNode\n | RawNode\n | ListNode\n | IfNode\n | ChooseNode\n | TrimNode;\n\nexport interface TemplateIr {\n readonly version: 1;\n readonly nodes: readonly TemplateNode[];\n readonly sourceLength: number;\n /**\n * Optional parallel node tree preserving raw JavaScript template text for\n * native tagged-template transports. The logical node tree remains cooked.\n */\n readonly rawNodes?: readonly TemplateNode[];\n}\n\nexport interface SqlFragment {\n readonly [SQL_FRAGMENT]: true;\n readonly ir: TemplateIr;\n readonly values: readonly unknown[];\n readonly dialectId: string;\n}\n\nexport interface Query<Row = unknown, Kind extends QueryResultKind = \"unknown\"> {\n readonly ir: TemplateIr;\n readonly values: readonly unknown[];\n readonly resultKind: Kind;\n /**\n * Application result mapper. Never forwarded to a DB driver.\n */\n readonly resultSchema?: StandardSchemaV1<unknown, Row>;\n readonly routineContract?: RoutineContract;\n render(): RenderedStatement;\n readonly __row?: Row;\n}\n\nexport type RowQuery<Row = unknown> = Query<Row, \"rows\">;\nexport type CommandQuery = Query<CommandResult, \"command\">;\nexport type CallQuery<Result extends RoutineCallResult = RoutineCallResult> = Query<Result, \"call\">;\n\nexport interface CommandResult {\n readonly affectedRows?: number;\n readonly insertId?: string;\n readonly [key: string]: unknown;\n}\n\nexport interface RowsExecutionResult<Row = unknown> {\n readonly kind: \"rows\";\n readonly rows: readonly Row[];\n readonly rowCount?: number;\n readonly command?: never;\n}\n\nexport interface CommandExecutionResult {\n readonly kind: \"command\";\n readonly rows: readonly [];\n readonly rowCount?: number;\n readonly command: CommandResult;\n}\n\nexport type QueryExecutionResult<Row = unknown> =\n | RowsExecutionResult<Row>\n | CommandExecutionResult;\n\nexport interface ExecutionOptions {\n readonly signal?: AbortSignal;\n}\n\nexport interface RowValidationOptions<Row> extends ExecutionOptions {\n readonly schema?: StandardSchemaV1<unknown, NoInfer<Row>>;\n}\n\nexport interface StreamOptions<Row> extends RowValidationOptions<Row> {}\n\nexport type TransactionIsolation =\n | \"read-uncommitted\"\n | \"read-committed\"\n | \"repeatable-read\"\n | \"serializable\";\n\nexport interface TransactionOptions {\n readonly isolation?: TransactionIsolation;\n readonly readOnly?: boolean;\n}\n\nexport class UnsupportedFeatureError extends Error {\n constructor(\n readonly feature: string,\n readonly code: `BRAID_${string}`,\n message: string,\n options?: ErrorOptions,\n ) {\n super(`${code}: ${message}`, options);\n this.name = \"UnsupportedFeatureError\";\n }\n}\n\nexport interface RoutineResultSet<Row = unknown> {\n readonly rows: readonly Row[];\n}\n\nexport type RoutineResultSetTuple<Sets extends readonly unknown[]> = {\n readonly [K in keyof Sets]: RoutineResultSet<Sets[K]>;\n};\n\nexport interface RoutineCallResult<\n Output extends Readonly<Record<string, unknown>> = Readonly<Record<string, unknown>>,\n Sets extends readonly unknown[] = readonly unknown[],\n ReturnValue = unknown,\n> {\n readonly output: Output;\n readonly resultSets: RoutineResultSetTuple<Sets>;\n readonly returnValue?: ReturnValue;\n}\n\nexport type RoutineSchemaOutput<Schema> = Schema extends StandardSchemaV1<any, infer Output> ? Output : never;\n\ntype RoutineRowsFromSchemas<Schemas extends readonly RoutineSchema[]> = {\n readonly [K in keyof Schemas]: RoutineSchemaOutput<Schemas[K]>;\n};\n\nexport type RoutineResultFromContract<Contract extends RoutineContract> = RoutineCallResult<\n Contract[\"output\"] extends RoutineSchema\n ? RoutineSchemaOutput<Contract[\"output\"]> extends Readonly<Record<string, unknown>>\n ? RoutineSchemaOutput<Contract[\"output\"]>\n : Readonly<Record<string, unknown>>\n : Readonly<Record<string, unknown>>,\n Contract[\"resultSets\"] extends infer Schemas extends readonly RoutineSchema[]\n ? RoutineRowsFromSchemas<Schemas>\n : readonly unknown[],\n Contract[\"returnValue\"] extends RoutineSchema ? RoutineSchemaOutput<Contract[\"returnValue\"]> : unknown\n> & (Contract extends { readonly returnValue: RoutineSchema }\n ? { readonly returnValue: RoutineSchemaOutput<Contract[\"returnValue\"]> }\n : {});\n\nexport type RoutineResultSource =\n | {\n readonly kind: \"out-cursor\";\n readonly name?: string;\n readonly parameterIndex?: number;\n }\n | {\n readonly kind: \"implicit\";\n readonly index: number;\n }\n | {\n readonly kind: \"emitted\";\n readonly index: number;\n };\n\nexport interface DriverRoutineResultSet {\n readonly rows: readonly unknown[];\n readonly source: RoutineResultSource;\n}\n\nexport interface DriverRoutineResult {\n readonly output: Readonly<Record<string, unknown>>;\n readonly returnValue?: unknown;\n readonly resultSets: readonly DriverRoutineResultSet[];\n}\n\nexport type RoutineMappingLocation =\n | { readonly kind: \"output\" }\n | { readonly kind: \"return-value\" }\n | {\n readonly kind: \"result-set\";\n readonly resultSetIndex: number;\n readonly rowIndex: number;\n };\n\nexport type DriverCapabilityErrorCode =\n | \"BRAID_STREAM_UNSUPPORTED\"\n | \"BRAID_CALL_UNSUPPORTED\"\n | \"BRAID_CALL_RESULT_SETS\"\n | \"BRAID_CALL_CURSOR_TX_REQUIRED\"\n | \"BRAID_CALL_OUT_UNSUPPORTED\"\n | \"BRAID_CALL_RETURN_UNSUPPORTED\"\n | \"BRAID_CALL_CURSOR_UNSUPPORTED\"\n | \"BRAID_RESOURCE_CLEANUP\";\n\nexport class RoutineMappingError extends Error {\n readonly code = \"BRAID_CALL_MAP\";\n readonly location: RoutineMappingLocation;\n\n constructor(message: string, location: RoutineMappingLocation, options?: { readonly cause?: unknown }) {\n super(message, options);\n this.name = \"RoutineMappingError\";\n this.location = Object.freeze(location);\n }\n}\n\nexport type BulkExecutionMode = \"native-bulk\" | \"pipeline\" | \"prepared-loop\" | \"remote-batch\";\n\nexport interface BulkExecutionResult {\n readonly inputCount: number;\n readonly affectedRows?: number;\n readonly executionMode: BulkExecutionMode;\n}\n\nexport interface QueryExecutor {\n /** Stable identity for the physical execution resource shared by wrappers; pools must use a leased resource. */\n readonly ownershipKey?: object;\n readonly statementBinding: StatementBindingAdapter;\n readonly environment?: DriverEnvironment;\n query<Row>(rendered: RenderedStatement, binding?: StatementBindingDescription, options?: ExecutionOptions): Promise<QueryExecutionResult<Row>>;\n stream<Row>(rendered: RenderedStatement, binding?: StatementBindingDescription, options?: ExecutionOptions): AsyncIterable<Row>;\n call(rendered: RenderedStatement, binding?: StatementBindingDescription, options?: ExecutionOptions): Promise<DriverRoutineResult>;\n bulk?(bulk: RenderedBulk, binding: BulkBindingDescription, options?: ExecutionOptions): Promise<BulkExecutionResult>;\n begin?(options?: TransactionOptions): Promise<void>;\n commit?(): Promise<void>;\n rollback?(): Promise<void>;\n savepoint?(name: string): Promise<void>;\n rollbackTo?(name: string): Promise<void>;\n releaseSavepoint?(name: string): Promise<void>;\n}\n\nexport interface ConnectionLease extends QueryExecutor {\n release(options?: { readonly discard?: boolean }): void | Promise<void>;\n}\n\nexport interface ConnectionProvider {\n readonly statementBinding: StatementBindingAdapter;\n readonly environment?: DriverEnvironment;\n acquire(): Promise<ConnectionLease>;\n}\n\nexport interface QueryExecutionPlan {\n readonly adapterId: string;\n readonly dialectId: string;\n readonly transport: ParameterTransportKind;\n readonly reuse: StatementBindingDescription[\"reuse\"];\n}\n\nexport interface QueryReadyEvent {\n readonly type: \"query:ready\";\n readonly purpose?: \"environment\";\n readonly operationId: string;\n readonly batchId?: string;\n readonly sql?: string;\n readonly values: readonly unknown[];\n readonly bindingMap?: readonly {\n readonly placeholder: number;\n readonly interpolation?: number;\n readonly direction?: RoutineParameterDirection;\n readonly outputName?: string;\n }[];\n readonly parameterHints?: readonly (ParameterTypeHint | undefined)[];\n readonly execution: QueryExecutionPlan;\n readonly literalizedSql: (options?: LiteralizeOptions) => LiteralizedSqlResult;\n readonly declaredKind: QueryResultKind;\n readonly fingerprint?: string;\n readonly variantFingerprint?: string;\n readonly preparedName?: string;\n readonly transactionDepth: number;\n readonly transactionScoped: boolean;\n}\n\nexport interface QueryResultEvent {\n readonly type: \"query:result\";\n readonly purpose?: \"environment\";\n readonly operationId: string;\n readonly preparedName?: string;\n readonly batchId?: string;\n readonly durationMs: number;\n readonly actualKind: \"rows\" | \"command\" | \"call\";\n readonly rowCount?: number;\n readonly resultSetCount?: number;\n readonly outputKeys?: readonly string[];\n readonly hasReturnValue?: boolean;\n readonly command?: Readonly<Record<string, unknown>>;\n readonly transactionDepth: number;\n readonly transactionScoped: boolean;\n}\n\nexport interface QueryMappedEvent {\n readonly type: \"query:mapped\";\n readonly purpose?: \"environment\";\n readonly operationId: string;\n readonly preparedName?: string;\n readonly batchId?: string;\n readonly durationMs: number;\n readonly rowCount: number;\n readonly queryMapped: boolean;\n readonly executionMapped: boolean;\n readonly transactionDepth: number;\n readonly transactionScoped: boolean;\n}\n\nexport interface BulkReadyEvent {\n readonly type: \"bulk:ready\";\n readonly operationId: string;\n readonly itemCount: number;\n readonly transactionDepth: number;\n readonly transactionScoped: boolean;\n readonly sql?: string;\n readonly valuesAt: (index: number) => readonly unknown[];\n readonly literalizedSql: (index: number, options?: LiteralizeOptions) => LiteralizedSqlResult;\n}\n\nexport interface BulkResultEvent {\n readonly type: \"bulk:result\";\n readonly operationId: string;\n readonly itemCount: number;\n readonly affectedRows?: number;\n readonly executionMode: BulkExecutionMode;\n readonly durationMs: number;\n readonly transactionDepth: number;\n readonly transactionScoped: boolean;\n}\n\nexport type QueryErrorStage =\n | \"render\"\n | \"prepared\"\n | \"observer-before\"\n | \"materialize\"\n | \"acquire\"\n | \"driver\"\n | \"result-kind\"\n | \"cardinality\"\n | \"query-map\"\n | \"execution-map\"\n | \"observer-after\"\n | \"release\"\n | \"stream\"\n | \"transaction\";\n\nexport interface QueryErrorEvent {\n readonly type: \"query:error\";\n readonly purpose?: \"environment\";\n readonly operationId: string;\n readonly preparedName?: string;\n readonly batchId?: string;\n readonly error: unknown;\n readonly stage: QueryErrorStage;\n readonly executionStarted: boolean;\n readonly executionCompleted: boolean;\n readonly durationMs?: number;\n readonly transactionDepth: number;\n readonly transactionScoped: boolean;\n}\n\nexport interface StreamStartEvent {\n readonly type: \"stream:start\";\n readonly operationId: string;\n readonly sql?: string;\n readonly values: readonly unknown[];\n readonly bindingMap?: readonly {\n readonly placeholder: number;\n readonly interpolation?: number;\n readonly direction?: RoutineParameterDirection;\n readonly outputName?: string;\n }[];\n readonly parameterHints?: readonly (ParameterTypeHint | undefined)[];\n readonly execution: QueryExecutionPlan;\n readonly literalizedSql: (options?: LiteralizeOptions) => LiteralizedSqlResult;\n readonly declaredKind: \"rows\";\n readonly variantFingerprint?: string;\n readonly preparedName?: string;\n readonly transactionDepth: number;\n readonly transactionScoped: boolean;\n}\n\nexport interface StreamEndEvent {\n readonly type: \"stream:end\";\n readonly operationId: string;\n readonly status: \"completed\" | \"error\";\n readonly durationMs: number;\n readonly rowCount: number;\n readonly error?: unknown;\n readonly transactionDepth: number;\n readonly transactionScoped: boolean;\n}\n\nexport type TransactionEventPhase =\n | \"begin\"\n | \"commit\"\n | \"rollback\"\n | \"savepoint\"\n | \"rollback-to-savepoint\"\n | \"release-savepoint\";\n\nexport interface TransactionEvent {\n readonly type: \"transaction\";\n readonly transactionId: string;\n readonly phase: TransactionEventPhase;\n readonly status: \"requested\" | \"completed\" | \"failed\";\n readonly depth: number;\n readonly savepointName?: string;\n readonly durationMs?: number;\n readonly error?: unknown;\n}\n\nexport type ExecutionEvent =\n | QueryReadyEvent\n | QueryResultEvent\n | QueryMappedEvent\n | BulkReadyEvent\n | BulkResultEvent\n | QueryErrorEvent\n | StreamStartEvent\n | StreamEndEvent\n | TransactionEvent;\n\nexport interface ExecutionObserver {\n onEvent(event: ExecutionEvent): void | Promise<void>;\n}\n\nexport interface EnvironmentCapability {\n readonly status: \"guaranteed\" | \"guarded\" | \"unsupported\";\n readonly canonical?: \"string\" | \"number\" | \"Uint8Array\";\n readonly rawRepresentations?: readonly string[];\n readonly conditionCode?: string;\n}\n\nexport interface DatabaseEnvironment {\n readonly database: { readonly product: string; readonly version?: string; readonly edition?: string };\n readonly driver: { readonly id: string; readonly version?: string; readonly profile?: string };\n readonly runtime: { readonly id: string; readonly version?: string };\n readonly typePolicy?: { readonly id: string; readonly hash: string };\n readonly capabilities: Readonly<Record<string, EnvironmentCapability>>;\n readonly supportMatch: {\n readonly status: \"official\" | \"conditional\" | \"compatible\";\n readonly targetId?: string;\n readonly reason?: string;\n };\n}\n\n/** Adapter evidence only. Probes run through the ordinary observed, leased query path. */\nexport interface DriverEnvironment {\n readonly database: DatabaseEnvironment[\"database\"];\n readonly driver: DatabaseEnvironment[\"driver\"];\n readonly typePolicy?: { readonly id: string; readonly hash: string };\n readonly capabilities: DatabaseEnvironment[\"capabilities\"];\n readonly probe?: {\n readonly statement: RenderedStatement;\n readonly read: (rows: readonly unknown[]) => {\n readonly version?: string;\n readonly edition?: string;\n readonly capabilities?: Readonly<Record<string, EnvironmentCapability>>;\n };\n };\n}\n\n/** Structural subset of a support manifest; importing support tooling is unnecessary. */\nexport interface EnvironmentSupportTarget {\n readonly id: string;\n readonly status: string;\n readonly database: { readonly product: string; readonly version: string; readonly edition: string };\n readonly driver: { readonly id: string; readonly version: string; readonly profile: string };\n readonly runtime: { readonly id: string; readonly version: string };\n readonly typePolicy: { readonly id: string; readonly hash: string };\n readonly evidence: { readonly status: string };\n}\n\nexport interface EnvironmentOptions {\n readonly targets?: readonly EnvironmentSupportTarget[];\n /** Re-probe the current lease instead of returning the cached observation. */\n readonly refresh?: boolean;\n}\n\nexport interface DatabaseOptions {\n readonly observers?: readonly ExecutionObserver[];\n readonly reuse?: RequestedReuse;\n}\n\nexport type PreparableQuery = ExecutableQuery | CallQuery;\n\nexport type PreparedArguments<Input, Options> =\n [Input] extends [never] ? [options?: Options] : [input: Input, options?: Options];\n\nexport type PreparedQuery<Input, Q extends PreparableQuery> = {\n readonly name: string;\n} & (Q extends CallQuery<infer Result>\n ? { call(...args: PreparedArguments<Input, ExecutionOptions>): Promise<Result> }\n : { execute(...args: PreparedArguments<Input, ExecutionOptions>): Promise<ExecutionResultOf<Q>> }\n & (Q extends RowQuery<infer Row> ? {\n all(...args: PreparedArguments<Input, RowValidationOptions<Row>>): Promise<readonly Row[]>;\n one(...args: PreparedArguments<Input, RowValidationOptions<Row>>): Promise<Row>;\n maybeOne(...args: PreparedArguments<Input, RowValidationOptions<Row>>): Promise<Row | undefined>;\n stream(...args: PreparedArguments<Input, StreamOptions<Row>>): AsyncIterable<Row>;\n } : {}));\n\nexport type ExecutableQuery =\n | RowQuery<unknown>\n | Query<unknown, \"command\">\n | Query<unknown, \"unknown\">;\n\nexport type ExecutionResultOf<Q> =\n Q extends RowQuery<infer Row>\n ? RowsExecutionResult<Row>\n : Q extends Query<unknown, \"command\">\n ? CommandExecutionResult\n : Q extends Query<infer Row, \"unknown\">\n ? QueryExecutionResult<Row>\n : never;\n\nexport interface Database {\n environment(options?: EnvironmentOptions): Promise<DatabaseEnvironment>;\n all<Row>(query: RowQuery<Row>, options?: RowValidationOptions<Row>): Promise<readonly Row[]>;\n one<Row>(query: RowQuery<Row>, options?: RowValidationOptions<Row>): Promise<Row>;\n maybeOne<Row>(query: RowQuery<Row>, options?: RowValidationOptions<Row>): Promise<Row | undefined>;\n execute<Q extends ExecutableQuery>(query: Q, options?: ExecutionOptions): Promise<ExecutionResultOf<Q>>;\n call<Result extends RoutineCallResult>(query: CallQuery<Result>, options?: ExecutionOptions): Promise<Result>;\n batch<const Queries extends readonly ExecutableQuery[]>(queries: Queries, options?: ExecutionOptions): Promise<{ readonly [K in keyof Queries]: ExecutionResultOf<Queries[K]> }>;\n bulk<Input>(inputs: readonly Input[], factory: (input: Input, index: number) => CommandQuery, options?: ExecutionOptions): Promise<BulkResult>;\n prepare<Factory extends () => PreparableQuery>(\n name: string,\n factory: Factory & (Parameters<Factory> extends [] ? unknown : never),\n ): PreparedQuery<never, ReturnType<Factory>>;\n prepare<Factory extends (input: never) => PreparableQuery>(\n name: string,\n factory: Factory & (Parameters<Factory> extends [unknown] ? unknown : never),\n ): PreparedQuery<Parameters<Factory>[0], ReturnType<Factory>>;\n stream<Row>(query: RowQuery<Row>, options?: StreamOptions<Row>): AsyncIterable<Row>;\n session<T>(callback: (database: Database) => Promise<T>): Promise<T>;\n tx<T>(callback: (database: Database) => Promise<T>): Promise<T>;\n tx<T>(options: TransactionOptions, callback: (database: Database) => Promise<T>): Promise<T>;\n}\n\nexport interface BulkResult {\n readonly inputCount: number;\n readonly affectedRows?: number;\n}\n\nexport type QueryRow<Q> = Q extends Query<infer Row, QueryResultKind> ? Row : never;\n\nexport interface SqlTagLike<Kind extends QueryResultKind = QueryResultKind, Row = unknown> {\n (strings: TemplateStringsArray, ...values: readonly unknown[]): Query<Row, Kind>;\n}\n\nexport interface RoutineContractTag<Contract extends RoutineContract> {\n (strings: TemplateStringsArray, ...values: readonly unknown[]): CallQuery<RoutineResultFromContract<Contract>>;\n}\n\nexport interface RowsTag {\n // Two type parameters keep this overload out of the sql.rows<Row> instantiation expression.\n <Input, Output>(schema: StandardSchemaV1<Input, Output>): SqlTagLike<\"rows\", Output>;\n <Row = unknown>(strings: TemplateStringsArray, ...values: readonly unknown[]): RowQuery<Row>;\n}\n\nexport interface SqlTag extends SqlTagLike<\"unknown\"> {\n rows: RowsTag;\n command: (strings: TemplateStringsArray, ...values: readonly unknown[]) => CommandQuery;\n call: {\n <Result extends RoutineCallResult = RoutineCallResult>(strings: TemplateStringsArray, ...values: readonly unknown[]): CallQuery<Result>;\n <Contract extends RoutineContract>(contract: Contract): RoutineContractTag<Contract>;\n };\n bind<Input>(value: NoInfer<Input>, hint: ParameterTypeHint<Input>): BoundParameter<Input>;\n out(name: string, hint?: ParameterTypeHint): RoutineParameter<null>;\n inOut<Input>(name: string, value: NoInfer<Input>, hint?: ParameterTypeHint<Input>): RoutineParameter<Input>;\n fragment: (strings: TemplateStringsArray, ...values: readonly unknown[]) => SqlFragment;\n empty: SqlFragment;\n ident: (identifier: string | readonly string[]) => SqlFragment;\n raw: (text: string) => SqlFragment;\n join: (items: readonly SqlFragment[], separator?: SqlFragment) => SqlFragment;\n list: (values: readonly unknown[]) => SqlFragment;\n}\n\nexport class SqlRenderError extends Error {\n readonly code: string;\n\n constructor(code: string, message: string) {\n super(message);\n this.name = \"SqlRenderError\";\n this.code = code;\n }\n}\n"],"mappings":";AAIA,MAAa,eAAe,OAAO,IAAI,mBAAmB;AAE1D,MAAM,sBAAsB,OAAO,IAAI,0BAA0B;AACjE,MAAM,uCAAuB,IAAI,QAAgB;AAEjD,MAAM,wBAAwB,OAAO,IAAI,4BAA4B;AACrE,MAAM,yCAAyB,IAAI,QAAgB;AAyCnD,IAAa,uBAAb,cAA0C,MAAM;CAC9C,AAAS,OAAO;CAEhB,YAAY,UAAU,uDAAuD;EAC3E,MAAM,OAAO;EACb,KAAK,OAAO;CACd;AACF;AAEA,SAAS,iBAAiB,SAAwB;CAChD,MAAM,IAAI,qBAAqB,OAAO;AACxC;AAEA,SAAgB,mBAAmB,OAAgB,OAAmC;CACpF,IAAI;CACJ,IAAI,OAAO,UAAU,UACnB,SAAS;MACJ,IAAI,OAAO,UAAU,YAAY,cAAc,KAAK,KAAK,GAC9D,IAAI;EACF,SAAS,OAAO,KAAK;CACvB,QAAQ;EACN,OAAO,iBAAiB,6DAA6D;CACvF;MACK,IAAI,OAAO,UAAU,YAAY,OAAO,cAAc,KAAK,GAChE,SAAS,OAAO,KAAK;MAErB,OAAO,iBAAiB,6DAA6D;CAGvF,IAAI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ACrG,MAAM,SAAS,OAAO;EACtB,KAAK,OAAO;EACZ,KAAK,WAAW,OAAO,OAAO,QAAQ;CACxC;AACF;AAiXA,IAAa,iBAAb,cAAoC,MAAM;CACxC,AAAS;CAET,YAAY,MAAc,SAAiB;EACzC,MAAM,OAAO;EACb,KAAK,OAAO;EACZ,KAAK,OAAO;CACd;AACF"}
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sqlbraid/core",
|
|
3
|
-
"version": "0.1.0-rc.
|
|
3
|
+
"version": "0.1.0-rc.1",
|
|
4
4
|
"description": "Core SQLBraid types and SQL template interfaces for typed database applications",
|
|
5
|
-
"license": "
|
|
5
|
+
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
8
8
|
"url": "git+https://github.com/Clickin/SQLBraid.git",
|