@sqlbraid/core 0.1.0-rc.0 → 1.0.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 +6 -33
- package/dist/index.d.ts +66 -13
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +421 -9
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
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,14 @@
|
|
|
1
1
|
# @sqlbraid/core
|
|
2
2
|
|
|
3
|
-
Public
|
|
3
|
+
Public TypeScript contracts for SQLBraid templates, rendered statements,
|
|
4
|
+
execution boundaries, result mapping, and adapter capabilities.
|
|
4
5
|
|
|
5
6
|
```sh
|
|
6
7
|
npm install @sqlbraid/core
|
|
7
8
|
```
|
|
8
9
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
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.
|
|
10
|
+
Use this low-level package when authoring an adapter or integration. It defines
|
|
11
|
+
contracts only and does not connect to a database or execute queries; use
|
|
12
|
+
`@sqlbraid/runtime` for application execution.
|
|
18
13
|
|
|
19
|
-
|
|
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
|
-
```ts
|
|
31
|
-
import type {
|
|
32
|
-
BulkBindingDescription,
|
|
33
|
-
BulkExecutionResult,
|
|
34
|
-
DriverRoutineResult,
|
|
35
|
-
RenderedBulk,
|
|
36
|
-
RoutineCallResult,
|
|
37
|
-
QueryExecutor,
|
|
38
|
-
} from "@sqlbraid/core";
|
|
39
|
-
```
|
|
40
|
-
|
|
41
|
-
See the [driver-author guide](https://clickin.github.io/SQLBraid/dev/agents/driver-author/) and [routine guide](https://clickin.github.io/SQLBraid/concepts/routines/).
|
|
14
|
+
See the [SQLBraid documentation](https://clickin.github.io/SQLBraid/).
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,13 @@
|
|
|
1
1
|
import { StandardSchemaV1, StandardSchemaV1 as StandardSchemaV1$1 } from "@standard-schema/spec";
|
|
2
|
+
//#region src/authoring-modules.d.ts
|
|
3
|
+
/** Data-only authoring identity shared by compiler, tooling, and editor consumers. */
|
|
4
|
+
type AuthoringModuleCatalogEntry = {
|
|
5
|
+
readonly moduleSpecifier: string;
|
|
6
|
+
readonly dialectId?: "postgres" | "mysql" | "mariadb" | "sqlite" | "oracle" | "mssql";
|
|
7
|
+
readonly helperFamily: "template" | "facade";
|
|
8
|
+
};
|
|
9
|
+
export declare const AUTHORING_MODULE_CATALOG: readonly AuthoringModuleCatalogEntry[];
|
|
10
|
+
//#endregion
|
|
2
11
|
//#region src/index.d.ts
|
|
3
12
|
export declare const SQL_FRAGMENT: unique symbol;
|
|
4
13
|
declare const boundParameterBrand: unique symbol;
|
|
@@ -27,9 +36,24 @@ export interface ExactIntegerRange {
|
|
|
27
36
|
readonly max?: bigint;
|
|
28
37
|
}
|
|
29
38
|
export declare class ResultExactnessError extends Error {
|
|
30
|
-
readonly code
|
|
39
|
+
static readonly code: "BRAID_RESULT_EXACTNESS";
|
|
40
|
+
readonly code: "BRAID_RESULT_EXACTNESS";
|
|
31
41
|
constructor(message?: string);
|
|
32
42
|
}
|
|
43
|
+
export type PublicErrorCategory = "runtime" | "adapter" | "compiler";
|
|
44
|
+
export interface PublicErrorDefinition {
|
|
45
|
+
readonly code: string;
|
|
46
|
+
readonly category: PublicErrorCategory;
|
|
47
|
+
readonly owner: string;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* The intentionally small compatibility boundary for SQLBraid-owned errors.
|
|
51
|
+
*
|
|
52
|
+
* Keep this registry explicit. In particular, a BRAID_ token in a driver
|
|
53
|
+
* message or an internal compiler fallback is not public merely because it
|
|
54
|
+
* happens to use the project prefix.
|
|
55
|
+
*/
|
|
56
|
+
export declare const PUBLIC_ERROR_DEFINITIONS: readonly PublicErrorDefinition[];
|
|
33
57
|
export declare function decodeExactInteger(value: unknown, range?: ExactIntegerRange): bigint;
|
|
34
58
|
/**
|
|
35
59
|
* Normalize an exact integer at the raw SQLBraid boundary without changing
|
|
@@ -73,6 +97,12 @@ export interface RenderedParameter {
|
|
|
73
97
|
export interface RenderedStatement {
|
|
74
98
|
readonly segments: readonly string[];
|
|
75
99
|
readonly parameters: readonly RenderedParameter[];
|
|
100
|
+
/**
|
|
101
|
+
* Optional native tagged-template carrier. This preserves the original
|
|
102
|
+
* TemplateStringsArray when a driver can bind values through its native tag.
|
|
103
|
+
* It is metadata only; segments/parameters remain the logical statement.
|
|
104
|
+
*/
|
|
105
|
+
readonly nativeTemplate?: TemplateStringsArray;
|
|
76
106
|
readonly dialectId: string;
|
|
77
107
|
readonly resultKind: QueryResultKind;
|
|
78
108
|
readonly routineProcedure?: RoutineProcedure;
|
|
@@ -191,6 +221,7 @@ export declare function createRenderedBulk(bulk: RenderedBulk): RenderedBulk;
|
|
|
191
221
|
export declare function createRenderedStatement(statement: {
|
|
192
222
|
readonly segments: readonly string[];
|
|
193
223
|
readonly parameters: readonly RenderedParameter[];
|
|
224
|
+
readonly nativeTemplate?: TemplateStringsArray;
|
|
194
225
|
readonly resultKind: QueryResultKind;
|
|
195
226
|
readonly routineProcedure?: RoutineProcedure;
|
|
196
227
|
readonly dialectId: string;
|
|
@@ -297,6 +328,11 @@ export interface TemplateIr {
|
|
|
297
328
|
readonly version: 1;
|
|
298
329
|
readonly nodes: readonly TemplateNode[];
|
|
299
330
|
readonly sourceLength: number;
|
|
331
|
+
/**
|
|
332
|
+
* Optional parallel node tree preserving raw JavaScript template text for
|
|
333
|
+
* native tagged-template transports. The logical node tree remains cooked.
|
|
334
|
+
*/
|
|
335
|
+
readonly rawNodes?: readonly TemplateNode[];
|
|
300
336
|
}
|
|
301
337
|
export interface SqlFragment {
|
|
302
338
|
readonly [SQL_FRAGMENT]: true;
|
|
@@ -340,6 +376,7 @@ export type QueryExecutionResult<Row = unknown> = RowsExecutionResult<Row> | Com
|
|
|
340
376
|
export interface ExecutionOptions {
|
|
341
377
|
readonly signal?: AbortSignal;
|
|
342
378
|
}
|
|
379
|
+
export type Awaitable<T> = T | PromiseLike<T>;
|
|
343
380
|
export interface RowValidationOptions<Row> extends ExecutionOptions {
|
|
344
381
|
readonly schema?: StandardSchemaV1$1<unknown, NoInfer<Row>>;
|
|
345
382
|
}
|
|
@@ -354,6 +391,11 @@ export declare class UnsupportedFeatureError extends Error {
|
|
|
354
391
|
readonly code: `BRAID_${string}`;
|
|
355
392
|
constructor(feature: string, code: `BRAID_${string}`, message: string, options?: ErrorOptions);
|
|
356
393
|
}
|
|
394
|
+
/** An adapter-owned input/transport failure that retains TypeError semantics. */
|
|
395
|
+
export declare class AdapterError extends TypeError {
|
|
396
|
+
readonly code: `BRAID_${string}`;
|
|
397
|
+
constructor(code: `BRAID_${string}`, message: string, options?: ErrorOptions);
|
|
398
|
+
}
|
|
357
399
|
export interface RoutineResultSet<Row = unknown> {
|
|
358
400
|
readonly rows: readonly Row[];
|
|
359
401
|
}
|
|
@@ -401,7 +443,8 @@ export type RoutineMappingLocation = {
|
|
|
401
443
|
};
|
|
402
444
|
export type DriverCapabilityErrorCode = "BRAID_STREAM_UNSUPPORTED" | "BRAID_CALL_UNSUPPORTED" | "BRAID_CALL_RESULT_SETS" | "BRAID_CALL_CURSOR_TX_REQUIRED" | "BRAID_CALL_OUT_UNSUPPORTED" | "BRAID_CALL_RETURN_UNSUPPORTED" | "BRAID_CALL_CURSOR_UNSUPPORTED" | "BRAID_RESOURCE_CLEANUP";
|
|
403
445
|
export declare class RoutineMappingError extends Error {
|
|
404
|
-
readonly code
|
|
446
|
+
static readonly code: "BRAID_CALL_MAP";
|
|
447
|
+
readonly code: "BRAID_CALL_MAP";
|
|
405
448
|
readonly location: RoutineMappingLocation;
|
|
406
449
|
constructor(message: string, location: RoutineMappingLocation, options?: {
|
|
407
450
|
readonly cause?: unknown;
|
|
@@ -418,16 +461,16 @@ export interface QueryExecutor {
|
|
|
418
461
|
readonly ownershipKey?: object;
|
|
419
462
|
readonly statementBinding: StatementBindingAdapter;
|
|
420
463
|
readonly environment?: DriverEnvironment;
|
|
421
|
-
query<Row>(rendered: RenderedStatement, binding?: StatementBindingDescription, options?: ExecutionOptions):
|
|
464
|
+
query<Row>(rendered: RenderedStatement, binding?: StatementBindingDescription, options?: ExecutionOptions): Awaitable<QueryExecutionResult<Row>>;
|
|
422
465
|
stream<Row>(rendered: RenderedStatement, binding?: StatementBindingDescription, options?: ExecutionOptions): AsyncIterable<Row>;
|
|
423
|
-
call(rendered: RenderedStatement, binding?: StatementBindingDescription, options?: ExecutionOptions):
|
|
424
|
-
bulk?(bulk: RenderedBulk, binding: BulkBindingDescription, options?: ExecutionOptions):
|
|
425
|
-
begin?(options?: TransactionOptions):
|
|
426
|
-
commit?():
|
|
427
|
-
rollback?():
|
|
428
|
-
savepoint?(name: string):
|
|
429
|
-
rollbackTo?(name: string):
|
|
430
|
-
releaseSavepoint?(name: string):
|
|
466
|
+
call(rendered: RenderedStatement, binding?: StatementBindingDescription, options?: ExecutionOptions): Awaitable<DriverRoutineResult>;
|
|
467
|
+
bulk?(bulk: RenderedBulk, binding: BulkBindingDescription, options?: ExecutionOptions): Awaitable<BulkExecutionResult>;
|
|
468
|
+
begin?(options?: TransactionOptions): Awaitable<void>;
|
|
469
|
+
commit?(): Awaitable<void>;
|
|
470
|
+
rollback?(): Awaitable<void>;
|
|
471
|
+
savepoint?(name: string): Awaitable<void>;
|
|
472
|
+
rollbackTo?(name: string): Awaitable<void>;
|
|
473
|
+
releaseSavepoint?(name: string): Awaitable<void>;
|
|
431
474
|
}
|
|
432
475
|
export interface ConnectionLease extends QueryExecutor {
|
|
433
476
|
release(options?: {
|
|
@@ -663,6 +706,11 @@ export interface DatabaseOptions {
|
|
|
663
706
|
readonly reuse?: RequestedReuse;
|
|
664
707
|
}
|
|
665
708
|
export type PreparableQuery = ExecutableQuery | CallQuery;
|
|
709
|
+
export type PreparedFactoryOptions = {
|
|
710
|
+
readonly input: "none";
|
|
711
|
+
} | {
|
|
712
|
+
readonly input: "required";
|
|
713
|
+
};
|
|
666
714
|
export type PreparedArguments<Input, Options> = [Input] extends [never] ? [options?: Options] : [input: Input, options?: Options];
|
|
667
715
|
export type PreparedQuery<Input, Q extends PreparableQuery> = {
|
|
668
716
|
readonly name: string;
|
|
@@ -687,8 +735,13 @@ export interface Database {
|
|
|
687
735
|
call<Result extends RoutineCallResult>(query: CallQuery<Result>, options?: ExecutionOptions): Promise<Result>;
|
|
688
736
|
batch<const Queries extends readonly ExecutableQuery[]>(queries: Queries, options?: ExecutionOptions): Promise<{ readonly [K in keyof Queries]: ExecutionResultOf<Queries[K]>; }>;
|
|
689
737
|
bulk<Input>(inputs: readonly Input[], factory: (input: Input, index: number) => CommandQuery, options?: ExecutionOptions): Promise<BulkResult>;
|
|
690
|
-
prepare<Factory extends () => PreparableQuery>(name: string, factory: Factory & (Parameters<Factory> extends [] ? unknown : never)
|
|
738
|
+
prepare<Factory extends () => PreparableQuery>(name: string, factory: Factory & (Parameters<Factory> extends [] ? unknown : never), options: {
|
|
739
|
+
readonly input: "none";
|
|
740
|
+
}): PreparedQuery<never, ReturnType<Factory>>;
|
|
691
741
|
prepare<Factory extends (input: never) => PreparableQuery>(name: string, factory: Factory & (Parameters<Factory> extends [unknown] ? unknown : never)): PreparedQuery<Parameters<Factory>[0], ReturnType<Factory>>;
|
|
742
|
+
prepare<Factory extends (input: never) => PreparableQuery>(name: string, factory: Factory & (number extends Parameters<Factory>["length"] ? unknown : Parameters<Factory>["length"] extends 0 | 1 ? unknown : never), options: {
|
|
743
|
+
readonly input: "required";
|
|
744
|
+
}): PreparedQuery<Parameters<Factory>[0], ReturnType<Factory>>;
|
|
692
745
|
stream<Row>(query: RowQuery<Row>, options?: StreamOptions<Row>): AsyncIterable<Row>;
|
|
693
746
|
session<T>(callback: (database: Database) => Promise<T>): Promise<T>;
|
|
694
747
|
tx<T>(callback: (database: Database) => Promise<T>): Promise<T>;
|
|
@@ -731,5 +784,5 @@ export declare class SqlRenderError extends Error {
|
|
|
731
784
|
constructor(code: string, message: string);
|
|
732
785
|
}
|
|
733
786
|
//#endregion
|
|
734
|
-
export type { StandardSchemaV1 };
|
|
787
|
+
export type { AuthoringModuleCatalogEntry, StandardSchemaV1 };
|
|
735
788
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","names":[],"sources":["../src/index.ts"],"mappings":";;
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../src/authoring-modules.ts","../src/index.ts"],"mappings":";;;KACY;WACD;WACA;WACA;;qBAGE,mCAAmC;;;qBCHnC;cAIC;iBAIG;WACN;WACA;;iBAGM;WACN;WACA;WACA;WACA;;YAGC;YAGA;YAKA;YAEA;iBAMK;WACN,WAAW;WACX,gBAAgB;WAChB,UAAU;WACV;;iBAGM;WACN;WACA;;qBAGE,6BAA6B;kBACxB;WACP;EAEG,YAAA;;YAMF;iBAEK;WACN;WACA,UAAU;WACV;;;;;;;;;qBAUE,mCAAmC;wBA2DhC,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;;;;;;WAMrB,iBAAiB;WACjB;WACA,YAAY;WACZ,mBAAmB;WACnB;WACA;;iBAGM,kBAAkB;WACxB;WACA;WACA;WACA;WACA,UAAU;;iBAGJ,eAAe;WACrB,OAAO;WACP,MAAM,kBAAkB;YACvB;;iBAGK,iBAAiB;WACvB,OAAO;WACP,OAAO;WACP,WAAW,QAAQ;WACnB;;wBAqBK,wBAAwB,iBAAiB,MAAM,kBAAkB,SAAS,kBAAkB;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B,kBAAkB,eAAe;;iBAGlB,wBAAwB;EACvC,QAAQ;aAAqB;aAA6B;;iBAG3C;WACN,kBAAkB;WAClB,cAAc;EACvB,WAAW,QAAQ;;iBAGJ;WACN;WACA;WACA,WAAW;WACX,OAAO;;iBAGD;WACN;WACA;WACA;WACA;WACA;WACA;WACA;aACE;aACA;aACA,YAAY;aACZ;;WAEF,2BAA2B;WAC3B,WAAW;WACX,iBAAiB,UAAU,sBAAsB;WACjD,cAAc;WACd;WACA;WACA;WACA;WACA;;iBAGM;WACN;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA,UAAU,SAAS;WACnB;WACA;;iBAGM;WACN;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;;iBAGM;WACN;WACA;WACA;WACA;WACA;WACA;WACA,WAAW;WACX,iBAAiB,eAAe,UAAU,sBAAsB;;iBAG1D;WACN;WACA;WACA;WACA;WACA,eAAe;WACf;WACA;WACA;;YAGC;iBAgBK;WACN;WACA;WACA;WACA;WACA;WACA;WACA,OAAO;WACP;WACA;WACA;WACA;WACA;;iBAGM;WACN;WACA;WACA;WACA;WACA;aACE;aACA;aACA,YAAY;aACZ;;WAEF,2BAA2B;WAC3B,WAAW;WACX,iBAAiB,UAAU,sBAAsB;WACjD;WACA;WACA;WACA;WACA;;iBAGM;WACN;WACA;WACA;WACA;WACA;WACA;WACA;WACA;;YAGC;iBAQK;WACN;WACA;WACA,OAAO;WACP;WACA;WACA;WACA;WACA;;YAGC,iBACR,kBACA,mBACA,mBACA,iBACA,kBACA,kBACA,mBACA,iBACA;iBAEa;EACf,QAAQ,OAAO,wBAAwB;;iBAGxB;WACN;WACA;WACA;WACA;;iBAGM;WACN;aAAqB;aAA0B;aAA2B;;WAC1E;aAAmB;aAAqB;aAA2B;;WACnE;aAAoB;aAAqB;;WACzC;aAAwB;aAAqB;;WAC7C,cAAc,SAAS,eAAe;WACtC;aACE;aACA;aACA;;;;iBAKI;WACN,UAAU;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