@sqlbraid/core 1.0.0-rc.1 → 1.0.2
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 +1 -1
- package/README.md +3 -6
- package/dist/driver.d.ts +55 -0
- package/dist/driver.d.ts.map +1 -0
- package/dist/driver.js +156 -0
- package/dist/driver.js.map +1 -0
- package/dist/index.d.ts +674 -311
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +503 -184
- package/dist/index.js.map +1 -1
- package/package.json +22 -18
package/dist/index.d.ts
CHANGED
|
@@ -1,50 +1,22 @@
|
|
|
1
1
|
import { StandardSchemaV1, StandardSchemaV1 as StandardSchemaV1$1 } from "@standard-schema/spec";
|
|
2
|
-
//#region src/
|
|
3
|
-
/**
|
|
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
|
|
11
|
-
//#region src/index.d.ts
|
|
12
|
-
export declare const SQL_FRAGMENT: unique symbol;
|
|
13
|
-
declare const boundParameterBrand: unique symbol;
|
|
14
|
-
export interface SourceRange {
|
|
15
|
-
readonly start: number;
|
|
16
|
-
readonly end: number;
|
|
17
|
-
}
|
|
18
|
-
export interface RenderLimits {
|
|
19
|
-
readonly maxSqlBytes?: number;
|
|
20
|
-
readonly maxBindCount?: number;
|
|
21
|
-
readonly maxStructuralItems?: number;
|
|
22
|
-
readonly maxNestingDepth?: number;
|
|
23
|
-
}
|
|
24
|
-
export type QueryResultKind = "rows" | "command" | "call" | "unknown";
|
|
25
|
-
export type NumericSemantics = "exact-integer" | "exact-decimal" | "approximate-binary";
|
|
26
|
-
export type NumericRepresentation = "string" | "number";
|
|
27
|
-
export type TransportFidelity = "lossless" | "guarded" | "lossy" | "unsupported";
|
|
28
|
-
export interface NumericTypeContract {
|
|
29
|
-
readonly semantics: NumericSemantics;
|
|
30
|
-
readonly representation: NumericRepresentation;
|
|
31
|
-
readonly fidelity: TransportFidelity;
|
|
32
|
-
readonly binaryPrecision?: 32 | 64;
|
|
33
|
-
}
|
|
34
|
-
export interface ExactIntegerRange {
|
|
35
|
-
readonly min?: bigint;
|
|
36
|
-
readonly max?: bigint;
|
|
37
|
-
}
|
|
2
|
+
//#region src/errors.d.ts
|
|
3
|
+
/** Thrown when a driver value cannot be represented without losing database information. */
|
|
38
4
|
export declare class ResultExactnessError extends Error {
|
|
39
5
|
static readonly code: "BRAID_RESULT_EXACTNESS";
|
|
40
6
|
readonly code: "BRAID_RESULT_EXACTNESS";
|
|
41
7
|
constructor(message?: string);
|
|
42
8
|
}
|
|
43
9
|
export type PublicErrorCategory = "runtime" | "adapter" | "compiler";
|
|
10
|
+
/** One deliberately public SQLBraid error code; an arbitrary `BRAID_` message is not automatically public. */
|
|
44
11
|
export interface PublicErrorDefinition {
|
|
45
12
|
readonly code: string;
|
|
46
13
|
readonly category: PublicErrorCategory;
|
|
47
14
|
readonly owner: string;
|
|
15
|
+
/**
|
|
16
|
+
* UnsupportedFeatureError only: features for which this code is a public
|
|
17
|
+
* contract. Other public errors intentionally omit this metadata.
|
|
18
|
+
*/
|
|
19
|
+
readonly features?: readonly string[];
|
|
48
20
|
}
|
|
49
21
|
/**
|
|
50
22
|
* The intentionally small compatibility boundary for SQLBraid-owned errors.
|
|
@@ -54,6 +26,45 @@ export interface PublicErrorDefinition {
|
|
|
54
26
|
* happens to use the project prefix.
|
|
55
27
|
*/
|
|
56
28
|
export declare const PUBLIC_ERROR_DEFINITIONS: readonly PublicErrorDefinition[];
|
|
29
|
+
/** Public adapter capability failure. Unsupported features reject explicitly rather than being buffered or simulated. */
|
|
30
|
+
export declare class UnsupportedFeatureError extends Error {
|
|
31
|
+
readonly feature: string;
|
|
32
|
+
readonly code: `BRAID_${string}`;
|
|
33
|
+
constructor(feature: string, code: `BRAID_${string}`, message: string, options?: ErrorOptions);
|
|
34
|
+
}
|
|
35
|
+
/** Return true only for a registered, semantically valid feature/code pair. */
|
|
36
|
+
export declare function isPublicUnsupportedFeatureError(error: unknown): error is UnsupportedFeatureError;
|
|
37
|
+
/** An adapter-owned input/transport failure that retains TypeError semantics. */
|
|
38
|
+
export declare class AdapterError extends TypeError {
|
|
39
|
+
readonly code: `BRAID_${string}`;
|
|
40
|
+
constructor(code: `BRAID_${string}`, message: string, options?: ErrorOptions);
|
|
41
|
+
}
|
|
42
|
+
/** Rendering/authoring failure with a stable diagnostic code, raised before driver execution. */
|
|
43
|
+
export declare class SqlRenderError extends Error {
|
|
44
|
+
readonly code: string;
|
|
45
|
+
constructor(code: string, message: string);
|
|
46
|
+
}
|
|
47
|
+
//#endregion
|
|
48
|
+
//#region src/numeric.d.ts
|
|
49
|
+
export type NumericSemantics = "exact-integer" | "exact-decimal" | "approximate-binary";
|
|
50
|
+
export type NumericRepresentation = "string" | "number";
|
|
51
|
+
export type TransportFidelity = "lossless" | "guarded" | "lossy" | "unsupported";
|
|
52
|
+
/** Database type semantics, JavaScript representation, and transport-fidelity claim for one mapping. */
|
|
53
|
+
export interface NumericTypeContract {
|
|
54
|
+
readonly semantics: NumericSemantics;
|
|
55
|
+
readonly representation: NumericRepresentation;
|
|
56
|
+
readonly fidelity: TransportFidelity;
|
|
57
|
+
readonly binaryPrecision?: 32 | 64;
|
|
58
|
+
}
|
|
59
|
+
export interface ExactIntegerRange {
|
|
60
|
+
readonly min?: bigint;
|
|
61
|
+
readonly max?: bigint;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Decode an exact integer from driver output, optionally enforcing bigint bounds.
|
|
65
|
+
*
|
|
66
|
+
* @throws {ResultExactnessError} When the value is not an exact integer or violates the requested range.
|
|
67
|
+
*/
|
|
57
68
|
export declare function decodeExactInteger(value: unknown, range?: ExactIntegerRange): bigint;
|
|
58
69
|
/**
|
|
59
70
|
* Normalize an exact integer at the raw SQLBraid boundary without changing
|
|
@@ -67,21 +78,225 @@ export declare function normalizeExactInteger(value: unknown): string;
|
|
|
67
78
|
* but narrowing an unsafe value is never implicit.
|
|
68
79
|
*/
|
|
69
80
|
export declare function safeDatabaseCount(value: unknown): number;
|
|
81
|
+
/**
|
|
82
|
+
* Preserve an exact decimal as text; numeric JavaScript values are rejected because they may already be rounded.
|
|
83
|
+
*
|
|
84
|
+
* @throws {ResultExactnessError} When the value cannot prove exact decimal fidelity.
|
|
85
|
+
*/
|
|
70
86
|
export declare function decodeExactDecimal(value: unknown, options?: {
|
|
71
87
|
readonly allowBigInt?: boolean;
|
|
72
88
|
}): string;
|
|
89
|
+
//#endregion
|
|
90
|
+
//#region src/parameter.d.ts
|
|
91
|
+
declare const boundParameterBrand: unique symbol;
|
|
73
92
|
export type RoutineParameterDirection = "in" | "out" | "inout";
|
|
93
|
+
/** Explicit database-type metadata for one bound value; this is not application validation or an input codec. */
|
|
94
|
+
export interface ParameterTypeHint<Input = unknown> {
|
|
95
|
+
readonly databaseType: string;
|
|
96
|
+
readonly length?: number | "max";
|
|
97
|
+
readonly precision?: number;
|
|
98
|
+
readonly scale?: number;
|
|
99
|
+
readonly __input?: Input;
|
|
100
|
+
}
|
|
101
|
+
/** Value plus an explicit database type hint, created by `sql.bind()`. */
|
|
102
|
+
export interface BoundParameter<Input = unknown> {
|
|
103
|
+
readonly value: Input;
|
|
104
|
+
readonly hint: ParameterTypeHint<Input>;
|
|
105
|
+
readonly [boundParameterBrand]: true;
|
|
106
|
+
}
|
|
107
|
+
/** Value-only routine OUT/INOUT marker; the direction and output name are interpreted by the adapter. */
|
|
108
|
+
export interface RoutineParameter<Input = unknown> {
|
|
109
|
+
readonly value: Input;
|
|
110
|
+
readonly hint?: ParameterTypeHint;
|
|
111
|
+
readonly direction: Exclude<RoutineParameterDirection, "in">;
|
|
112
|
+
readonly outputName: string;
|
|
113
|
+
}
|
|
114
|
+
/** Validate and freeze an explicit database parameter-type hint. */
|
|
115
|
+
export declare function createParameterTypeHint<Input = unknown>(hint: ParameterTypeHint<Input>): ParameterTypeHint<Input>;
|
|
116
|
+
/** Create the value-only marker consumed by adapter binding for an explicitly typed input. */
|
|
117
|
+
export declare function createBoundParameter<Input>(value: NoInfer<Input>, hint: ParameterTypeHint<Input>): BoundParameter<Input>;
|
|
118
|
+
/** Recognize only bound-parameter objects created by SQLBraid's own constructor. */
|
|
119
|
+
export declare function isBoundParameter(value: unknown): value is BoundParameter;
|
|
120
|
+
/** Create a value-only OUT parameter descriptor; the adapter supplies the native carrier. */
|
|
121
|
+
export declare function createRoutineOutParameter(name: string, hint?: ParameterTypeHint): RoutineParameter<null>;
|
|
122
|
+
/** Create a value-only INOUT parameter descriptor; input value and output channel stay distinct. */
|
|
123
|
+
export declare function createRoutineInOutParameter<Input>(name: string, value: NoInfer<Input>, hint?: ParameterTypeHint<Input>): RoutineParameter<Input>;
|
|
124
|
+
/** Recognize only routine OUT/INOUT descriptors created by SQLBraid's own constructor. */
|
|
125
|
+
export declare function isRoutineParameter(value: unknown): value is RoutineParameter;
|
|
126
|
+
//#endregion
|
|
127
|
+
//#region src/routine.d.ts
|
|
128
|
+
/** Optional routine identity metadata used by procedure-aware adapters and prepared-shape checks. */
|
|
74
129
|
export interface RoutineProcedure {
|
|
75
130
|
readonly name: string;
|
|
76
131
|
readonly parameterNames: readonly string[];
|
|
77
132
|
}
|
|
78
133
|
export type RoutineSchema = StandardSchemaV1$1<any, any>;
|
|
134
|
+
/**
|
|
135
|
+
* Application mapping contracts for routine OUT values, result sets, and return values.
|
|
136
|
+
* Each channel is independent; an OUT cursor is represented as a result set, not as scalar output.
|
|
137
|
+
*/
|
|
79
138
|
export interface RoutineContract<Output extends Readonly<Record<string, unknown>> = Readonly<Record<string, unknown>>, Sets extends readonly RoutineSchema[] = readonly RoutineSchema[], ReturnValue = unknown> {
|
|
80
139
|
readonly output?: StandardSchemaV1$1<any, Output>;
|
|
81
140
|
readonly resultSets?: Sets;
|
|
82
141
|
readonly returnValue?: StandardSchemaV1$1<any, ReturnValue>;
|
|
83
142
|
readonly procedure?: RoutineProcedure;
|
|
84
143
|
}
|
|
144
|
+
/** One materialized routine result set, kept separate from scalar OUT and return-value channels. */
|
|
145
|
+
export interface RoutineResultSet<Row = unknown> {
|
|
146
|
+
readonly rows: readonly Row[];
|
|
147
|
+
}
|
|
148
|
+
export type RoutineResultSetTuple<Sets extends readonly unknown[]> = { readonly [K in keyof Sets]: RoutineResultSet<Sets[K]>; };
|
|
149
|
+
/** Application-facing routine result with independent output, result-set, and return-value channels. */
|
|
150
|
+
export interface RoutineCallResult<Output extends Readonly<Record<string, unknown>> = Readonly<Record<string, unknown>>, Sets extends readonly unknown[] = readonly unknown[], ReturnValue = unknown> {
|
|
151
|
+
readonly output: Output;
|
|
152
|
+
readonly resultSets: RoutineResultSetTuple<Sets>;
|
|
153
|
+
readonly returnValue?: ReturnValue;
|
|
154
|
+
}
|
|
155
|
+
export type RoutineSchemaOutput<Schema> = Schema extends StandardSchemaV1$1<any, infer Output> ? Output : never;
|
|
156
|
+
type RoutineRowsFromSchemas<Schemas extends readonly RoutineSchema[]> = { readonly [K in keyof Schemas]: RoutineSchemaOutput<Schemas[K]>; };
|
|
157
|
+
export type RoutineResultFromContract<Contract extends RoutineContract> = RoutineCallResult<Contract["output"] extends RoutineSchema ? RoutineSchemaOutput<Contract["output"]> extends Readonly<Record<string, unknown>> ? RoutineSchemaOutput<Contract["output"]> : Readonly<Record<string, unknown>> : Readonly<Record<string, unknown>>, Contract["resultSets"] extends (infer Schemas extends readonly RoutineSchema[]) ? RoutineRowsFromSchemas<Schemas> : readonly unknown[], Contract["returnValue"] extends RoutineSchema ? RoutineSchemaOutput<Contract["returnValue"]> : unknown> & (Contract extends {
|
|
158
|
+
readonly returnValue: RoutineSchema;
|
|
159
|
+
} ? {
|
|
160
|
+
readonly returnValue: RoutineSchemaOutput<Contract["returnValue"]>;
|
|
161
|
+
} : {});
|
|
162
|
+
export type RoutineResultSource = {
|
|
163
|
+
readonly kind: "out-cursor";
|
|
164
|
+
readonly name?: string;
|
|
165
|
+
readonly parameterIndex?: number;
|
|
166
|
+
} | {
|
|
167
|
+
readonly kind: "implicit";
|
|
168
|
+
readonly index: number;
|
|
169
|
+
} | {
|
|
170
|
+
readonly kind: "emitted";
|
|
171
|
+
readonly index: number;
|
|
172
|
+
};
|
|
173
|
+
/** Driver result-set payload with provenance for OUT cursors and emitted/implicit sets. */
|
|
174
|
+
export interface DriverRoutineResultSet {
|
|
175
|
+
readonly rows: readonly unknown[];
|
|
176
|
+
readonly source: RoutineResultSource;
|
|
177
|
+
}
|
|
178
|
+
/** Fully materialized routine result; native cursors, requests, and LOB handles must not escape this boundary. */
|
|
179
|
+
export interface DriverRoutineResult {
|
|
180
|
+
readonly output: Readonly<Record<string, unknown>>;
|
|
181
|
+
readonly returnValue?: unknown;
|
|
182
|
+
readonly resultSets: readonly DriverRoutineResultSet[];
|
|
183
|
+
}
|
|
184
|
+
export type RoutineMappingLocation = {
|
|
185
|
+
readonly kind: "output";
|
|
186
|
+
} | {
|
|
187
|
+
readonly kind: "return-value";
|
|
188
|
+
} | {
|
|
189
|
+
readonly kind: "result-set";
|
|
190
|
+
readonly resultSetIndex: number;
|
|
191
|
+
readonly rowIndex: number;
|
|
192
|
+
};
|
|
193
|
+
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";
|
|
194
|
+
/** Identifies which routine channel or row failed during Standard Schema mapping. */
|
|
195
|
+
export declare class RoutineMappingError extends Error {
|
|
196
|
+
static readonly code: "BRAID_CALL_MAP";
|
|
197
|
+
readonly code: "BRAID_CALL_MAP";
|
|
198
|
+
readonly location: RoutineMappingLocation;
|
|
199
|
+
constructor(message: string, location: RoutineMappingLocation, options?: {
|
|
200
|
+
readonly cause?: unknown;
|
|
201
|
+
});
|
|
202
|
+
}
|
|
203
|
+
//#endregion
|
|
204
|
+
//#region src/template-ir.d.ts
|
|
205
|
+
export declare const SQL_FRAGMENT: unique symbol;
|
|
206
|
+
/** Half-open source range in the cooked template text, used for diagnostics and source mapping. */
|
|
207
|
+
export interface SourceRange {
|
|
208
|
+
readonly start: number;
|
|
209
|
+
readonly end: number;
|
|
210
|
+
}
|
|
211
|
+
/** Safety bounds applied while parsing and rendering dynamic SQL. */
|
|
212
|
+
export interface RenderLimits {
|
|
213
|
+
readonly maxSqlBytes?: number;
|
|
214
|
+
readonly maxBindCount?: number;
|
|
215
|
+
readonly maxStructuralItems?: number;
|
|
216
|
+
readonly maxNestingDepth?: number;
|
|
217
|
+
}
|
|
218
|
+
/** Declared logical result channel; runtime checks the driver's actual result kind against it. */
|
|
219
|
+
export type QueryResultKind = "rows" | "command" | "call" | "unknown";
|
|
220
|
+
export interface TextNode {
|
|
221
|
+
readonly kind: "text";
|
|
222
|
+
readonly text: string;
|
|
223
|
+
readonly range: SourceRange;
|
|
224
|
+
}
|
|
225
|
+
export interface BindNode {
|
|
226
|
+
readonly kind: "bind";
|
|
227
|
+
readonly interpolation: number;
|
|
228
|
+
readonly range: SourceRange;
|
|
229
|
+
}
|
|
230
|
+
export interface FragmentNode {
|
|
231
|
+
readonly kind: "fragment";
|
|
232
|
+
readonly fragment: SqlFragment;
|
|
233
|
+
readonly range: SourceRange;
|
|
234
|
+
}
|
|
235
|
+
export interface IdentifierNode {
|
|
236
|
+
readonly kind: "identifier";
|
|
237
|
+
readonly value: string | readonly string[];
|
|
238
|
+
readonly range: SourceRange;
|
|
239
|
+
}
|
|
240
|
+
export interface RawNode {
|
|
241
|
+
readonly kind: "raw";
|
|
242
|
+
readonly text: string;
|
|
243
|
+
readonly range: SourceRange;
|
|
244
|
+
}
|
|
245
|
+
export interface ListNode {
|
|
246
|
+
readonly kind: "list";
|
|
247
|
+
readonly values: readonly unknown[];
|
|
248
|
+
readonly range: SourceRange;
|
|
249
|
+
}
|
|
250
|
+
export interface IfNode {
|
|
251
|
+
readonly kind: "if";
|
|
252
|
+
readonly condition: number;
|
|
253
|
+
readonly children: readonly TemplateNode[];
|
|
254
|
+
readonly range: SourceRange;
|
|
255
|
+
}
|
|
256
|
+
export interface ChooseWhen {
|
|
257
|
+
readonly condition: number;
|
|
258
|
+
readonly children: readonly TemplateNode[];
|
|
259
|
+
readonly range: SourceRange;
|
|
260
|
+
}
|
|
261
|
+
export interface ChooseNode {
|
|
262
|
+
readonly kind: "choose";
|
|
263
|
+
readonly whens: readonly ChooseWhen[];
|
|
264
|
+
readonly otherwise?: readonly TemplateNode[];
|
|
265
|
+
readonly range: SourceRange;
|
|
266
|
+
}
|
|
267
|
+
export interface TrimAttributes {
|
|
268
|
+
readonly prefix: string;
|
|
269
|
+
readonly prefixOverrides: readonly string[];
|
|
270
|
+
readonly suffix: string;
|
|
271
|
+
readonly suffixOverrides: readonly string[];
|
|
272
|
+
}
|
|
273
|
+
export interface TrimNode {
|
|
274
|
+
readonly kind: "trim";
|
|
275
|
+
readonly attributes: TrimAttributes;
|
|
276
|
+
readonly children: readonly TemplateNode[];
|
|
277
|
+
readonly range: SourceRange;
|
|
278
|
+
}
|
|
279
|
+
export type TemplateNode = TextNode | BindNode | FragmentNode | IdentifierNode | RawNode | ListNode | IfNode | ChooseNode | TrimNode;
|
|
280
|
+
/** Frozen template intermediate representation with source ranges and optional raw-text parallel nodes. */
|
|
281
|
+
export interface TemplateIr {
|
|
282
|
+
readonly version: 1;
|
|
283
|
+
readonly nodes: readonly TemplateNode[];
|
|
284
|
+
readonly sourceLength: number;
|
|
285
|
+
/**
|
|
286
|
+
* Optional parallel node tree preserving raw JavaScript template text for
|
|
287
|
+
* native tagged-template transports. The logical node tree remains cooked.
|
|
288
|
+
*/
|
|
289
|
+
readonly rawNodes?: readonly TemplateNode[];
|
|
290
|
+
}
|
|
291
|
+
/** Explicit structural SQL fragment. Ordinary interpolations are values; fragments opt into SQL structure. */
|
|
292
|
+
export interface SqlFragment {
|
|
293
|
+
readonly [SQL_FRAGMENT]: true;
|
|
294
|
+
readonly ir: TemplateIr;
|
|
295
|
+
readonly values: readonly unknown[];
|
|
296
|
+
readonly dialectId: string;
|
|
297
|
+
}
|
|
298
|
+
//#endregion
|
|
299
|
+
//#region src/statement.d.ts
|
|
85
300
|
/**
|
|
86
301
|
* A rendered parameter is always a value. Adapters MUST NOT interpret it as
|
|
87
302
|
* raw SQL, an identifier, a nested query, a driver-specific fragment, or a
|
|
@@ -94,6 +309,10 @@ export interface RenderedParameter {
|
|
|
94
309
|
readonly direction?: RoutineParameterDirection;
|
|
95
310
|
readonly outputName?: string;
|
|
96
311
|
}
|
|
312
|
+
/**
|
|
313
|
+
* Immutable logical statement before driver materialization.
|
|
314
|
+
* `segments.length` is always `parameters.length + 1`; structural SQL lives in segments and parameters remain values.
|
|
315
|
+
*/
|
|
97
316
|
export interface RenderedStatement {
|
|
98
317
|
readonly segments: readonly string[];
|
|
99
318
|
readonly parameters: readonly RenderedParameter[];
|
|
@@ -109,34 +328,31 @@ export interface RenderedStatement {
|
|
|
109
328
|
readonly fingerprint?: string;
|
|
110
329
|
readonly variantFingerprint?: string;
|
|
111
330
|
}
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
readonly
|
|
115
|
-
readonly
|
|
116
|
-
readonly scale?: number;
|
|
117
|
-
readonly __input?: Input;
|
|
118
|
-
}
|
|
119
|
-
export interface BoundParameter<Input = unknown> {
|
|
120
|
-
readonly value: Input;
|
|
121
|
-
readonly hint: ParameterTypeHint<Input>;
|
|
122
|
-
readonly [boundParameterBrand]: true;
|
|
123
|
-
}
|
|
124
|
-
export interface RoutineParameter<Input = unknown> {
|
|
125
|
-
readonly value: Input;
|
|
126
|
-
readonly hint?: ParameterTypeHint;
|
|
127
|
-
readonly direction: Exclude<RoutineParameterDirection, "in">;
|
|
128
|
-
readonly outputName: string;
|
|
331
|
+
/** One logical command shape plus its value matrix; all rows must remain homogeneous. */
|
|
332
|
+
export interface RenderedBulk {
|
|
333
|
+
readonly statement: RenderedStatement;
|
|
334
|
+
readonly parameterSets: readonly (readonly unknown[])[];
|
|
129
335
|
}
|
|
130
|
-
export declare function
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
export declare function
|
|
134
|
-
|
|
135
|
-
|
|
336
|
+
export declare function createRenderedBulk(bulk: RenderedBulk): RenderedBulk;
|
|
337
|
+
/** Validate and freeze one logical statement without creating a second mutable SQL/value source of truth. */
|
|
338
|
+
/** @throws {TypeError|SqlRenderError} For broken segment/parameter invariants or unsupported bind values. */
|
|
339
|
+
export declare function createRenderedStatement(statement: {
|
|
340
|
+
readonly segments: readonly string[];
|
|
341
|
+
readonly parameters: readonly RenderedParameter[];
|
|
342
|
+
readonly nativeTemplate?: TemplateStringsArray;
|
|
343
|
+
readonly resultKind: QueryResultKind;
|
|
344
|
+
readonly routineProcedure?: RoutineProcedure;
|
|
345
|
+
readonly dialectId: string;
|
|
346
|
+
readonly fingerprint?: string;
|
|
347
|
+
readonly variantFingerprint?: string;
|
|
348
|
+
}): RenderedStatement;
|
|
349
|
+
//#endregion
|
|
350
|
+
//#region src/binding.d.ts
|
|
136
351
|
export type ParameterTransportKind = "native-value-template" | "text-positional" | "text-named" | "typed-request";
|
|
137
352
|
export type RequestedReuse = "auto" | "simple" | "reuse";
|
|
138
353
|
export type EffectiveReuse = "simple" | "reuse";
|
|
139
354
|
export type ReuseOwner = "sqlbraid" | "driver" | "server";
|
|
355
|
+
/** Inputs to pure binding description. Placeholder syntax and prepared reuse remain adapter-owned. */
|
|
140
356
|
export interface StatementBindingContext {
|
|
141
357
|
readonly dialectId: string;
|
|
142
358
|
readonly requestedReuse: RequestedReuse;
|
|
@@ -151,12 +367,14 @@ export interface BindingDescription {
|
|
|
151
367
|
readonly direction?: RoutineParameterDirection;
|
|
152
368
|
readonly outputName?: string;
|
|
153
369
|
}
|
|
370
|
+
/** Diagnostic-only literalization controls; the result must never be sent to a database. */
|
|
154
371
|
export interface LiteralizeOptions {
|
|
155
372
|
readonly values?: "inline" | "redacted";
|
|
156
373
|
readonly maxValueLength?: number;
|
|
157
374
|
readonly binary?: "summary" | "full";
|
|
158
375
|
readonly redact?: (parameter: RenderedParameter, index: number) => boolean;
|
|
159
376
|
}
|
|
377
|
+
/** Diagnostic SQL reconstruction with explicit redaction/truncation evidence. */
|
|
160
378
|
export interface LiteralizedSqlResult {
|
|
161
379
|
readonly text: string;
|
|
162
380
|
/**
|
|
@@ -168,6 +386,10 @@ export interface LiteralizedSqlResult {
|
|
|
168
386
|
readonly redactedParameters: number;
|
|
169
387
|
readonly truncatedParameters: number;
|
|
170
388
|
}
|
|
389
|
+
/**
|
|
390
|
+
* Immutable transport description derived from one logical statement.
|
|
391
|
+
* `literalizedSql()` reconstructs diagnostics from segments and values; it is never execution input.
|
|
392
|
+
*/
|
|
171
393
|
export interface StatementBindingDescription {
|
|
172
394
|
readonly adapterId: string;
|
|
173
395
|
readonly dialectId: string;
|
|
@@ -183,6 +405,10 @@ export interface StatementBindingDescription {
|
|
|
183
405
|
/** Diagnostic reconstruction only; never use this text as execution input. */
|
|
184
406
|
readonly literalizedSql: (options?: LiteralizeOptions) => LiteralizedSqlResult;
|
|
185
407
|
}
|
|
408
|
+
/**
|
|
409
|
+
* Driver-owned binding policy. Implementations choose transport, placeholders, type encoding, and reuse ownership.
|
|
410
|
+
* `describe` must be pure and safe to run before connection acquisition.
|
|
411
|
+
*/
|
|
186
412
|
export interface StatementBindingAdapter {
|
|
187
413
|
readonly id: string;
|
|
188
414
|
describe(statement: RenderedStatement, context: StatementBindingContext): StatementBindingDescription;
|
|
@@ -199,10 +425,7 @@ export interface StatementBindingDescriptionOptions {
|
|
|
199
425
|
};
|
|
200
426
|
readonly formatLiteral?: (parameter: RenderedParameter, index: number, options: LiteralizeOptions) => string | undefined;
|
|
201
427
|
}
|
|
202
|
-
|
|
203
|
-
readonly statement: RenderedStatement;
|
|
204
|
-
readonly parameterSets: readonly (readonly unknown[])[];
|
|
205
|
-
}
|
|
428
|
+
/** Binding metadata for a homogeneous bulk operation; values are fetched by item index. */
|
|
206
429
|
export interface BulkBindingDescription {
|
|
207
430
|
readonly adapterId: string;
|
|
208
431
|
readonly dialectId: string;
|
|
@@ -213,31 +436,24 @@ export interface BulkBindingDescription {
|
|
|
213
436
|
valuesAt(index: number): readonly unknown[];
|
|
214
437
|
literalizedSql(index: number, options?: LiteralizeOptions): LiteralizedSqlResult;
|
|
215
438
|
}
|
|
216
|
-
/**
|
|
217
|
-
* Normalize and snapshot a homogeneous bulk's logical statement and value
|
|
218
|
-
* matrix. Values themselves are application-owned and are not cloned.
|
|
219
|
-
*/
|
|
220
|
-
export declare function createRenderedBulk(bulk: RenderedBulk): RenderedBulk;
|
|
221
|
-
export declare function createRenderedStatement(statement: {
|
|
222
|
-
readonly segments: readonly string[];
|
|
223
|
-
readonly parameters: readonly RenderedParameter[];
|
|
224
|
-
readonly nativeTemplate?: TemplateStringsArray;
|
|
225
|
-
readonly resultKind: QueryResultKind;
|
|
226
|
-
readonly routineProcedure?: RoutineProcedure;
|
|
227
|
-
readonly dialectId: string;
|
|
228
|
-
readonly fingerprint?: string;
|
|
229
|
-
readonly variantFingerprint?: string;
|
|
230
|
-
}): RenderedStatement;
|
|
439
|
+
/** Materialize placeholder text as a derived view; this helper does not own reuse or driver transport policy. */
|
|
231
440
|
export declare function parameterizedSql(statement: RenderedStatement, placeholder: (index: number) => string): string;
|
|
441
|
+
/** Build an immutable binding description before I/O, including adapter reuse policy and diagnostic literalization. */
|
|
232
442
|
export declare function createStatementBindingDescription(statement: RenderedStatement, context: StatementBindingContext, options: StatementBindingDescriptionOptions): StatementBindingDescription;
|
|
233
443
|
/**
|
|
234
|
-
* Build one binding description for a
|
|
235
|
-
* metadata is shared by every parameter set; values and diagnostics are
|
|
236
|
-
* addressed only when requested for a particular item.
|
|
444
|
+
* Build one binding description for a homogeneous bulk statement without cloning application-owned values.
|
|
445
|
+
* Statement metadata is shared by every parameter set; values and diagnostics are addressed by item index.
|
|
237
446
|
*/
|
|
238
447
|
export declare function createBulkBindingDescription(bulk: RenderedBulk, context: StatementBindingContext, options: StatementBindingDescriptionOptions): BulkBindingDescription;
|
|
448
|
+
//#endregion
|
|
449
|
+
//#region src/dialect.d.ts
|
|
450
|
+
/** Lexical features the template parser must know to avoid treating SQL text inside comments/quotes as directives. */
|
|
239
451
|
export interface DialectLexicalProfile {
|
|
240
452
|
readonly lineCommentPrefixes: readonly string[];
|
|
453
|
+
/** Require whitespace/control after -- (MySQL/MariaDB). Defaults to false. */
|
|
454
|
+
readonly doubleDashRequiresWhitespace?: boolean;
|
|
455
|
+
/** Characters that terminate a line comment. Defaults to CR and LF. */
|
|
456
|
+
readonly lineCommentTerminators?: string;
|
|
241
457
|
readonly supportsNestedBlockComments?: boolean;
|
|
242
458
|
readonly supportsDollarQuotes?: boolean;
|
|
243
459
|
readonly supportsBacktickIdentifiers?: boolean;
|
|
@@ -245,101 +461,34 @@ export interface DialectLexicalProfile {
|
|
|
245
461
|
readonly supportsOracleQQuotes?: boolean;
|
|
246
462
|
readonly backslashEscapes?: boolean;
|
|
247
463
|
}
|
|
464
|
+
/** SQL dialect boundary: identifier quoting plus lexical behavior used by template parsing and trimming. */
|
|
248
465
|
export interface Dialect {
|
|
249
466
|
readonly id: string;
|
|
250
467
|
quoteIdentifier(identifier: string): string;
|
|
251
468
|
readonly lexicalProfile?: DialectLexicalProfile;
|
|
252
469
|
}
|
|
470
|
+
/** One database type's input/output representation and numeric fidelity claim. */
|
|
253
471
|
export interface TypeMapping {
|
|
254
472
|
readonly databaseType: string;
|
|
255
473
|
readonly inputType: string;
|
|
256
474
|
readonly outputType: string;
|
|
257
|
-
readonly nullable: boolean;
|
|
258
|
-
readonly numeric?: NumericTypeContract;
|
|
259
|
-
}
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
readonly
|
|
263
|
-
readonly
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
export interface TextNode {
|
|
268
|
-
readonly kind: "text";
|
|
269
|
-
readonly text: string;
|
|
270
|
-
readonly range: SourceRange;
|
|
271
|
-
}
|
|
272
|
-
export interface BindNode {
|
|
273
|
-
readonly kind: "bind";
|
|
274
|
-
readonly interpolation: number;
|
|
275
|
-
readonly range: SourceRange;
|
|
276
|
-
}
|
|
277
|
-
export interface FragmentNode {
|
|
278
|
-
readonly kind: "fragment";
|
|
279
|
-
readonly fragment: SqlFragment;
|
|
280
|
-
readonly range: SourceRange;
|
|
281
|
-
}
|
|
282
|
-
export interface IdentifierNode {
|
|
283
|
-
readonly kind: "identifier";
|
|
284
|
-
readonly value: string | readonly string[];
|
|
285
|
-
readonly range: SourceRange;
|
|
286
|
-
}
|
|
287
|
-
export interface RawNode {
|
|
288
|
-
readonly kind: "raw";
|
|
289
|
-
readonly text: string;
|
|
290
|
-
readonly range: SourceRange;
|
|
291
|
-
}
|
|
292
|
-
export interface ListNode {
|
|
293
|
-
readonly kind: "list";
|
|
294
|
-
readonly values: readonly unknown[];
|
|
295
|
-
readonly range: SourceRange;
|
|
296
|
-
}
|
|
297
|
-
export interface IfNode {
|
|
298
|
-
readonly kind: "if";
|
|
299
|
-
readonly condition: number;
|
|
300
|
-
readonly children: readonly TemplateNode[];
|
|
301
|
-
readonly range: SourceRange;
|
|
302
|
-
}
|
|
303
|
-
export interface ChooseWhen {
|
|
304
|
-
readonly condition: number;
|
|
305
|
-
readonly children: readonly TemplateNode[];
|
|
306
|
-
readonly range: SourceRange;
|
|
307
|
-
}
|
|
308
|
-
export interface ChooseNode {
|
|
309
|
-
readonly kind: "choose";
|
|
310
|
-
readonly whens: readonly ChooseWhen[];
|
|
311
|
-
readonly otherwise?: readonly TemplateNode[];
|
|
312
|
-
readonly range: SourceRange;
|
|
313
|
-
}
|
|
314
|
-
export interface TrimAttributes {
|
|
315
|
-
readonly prefix: string;
|
|
316
|
-
readonly prefixOverrides: readonly string[];
|
|
317
|
-
readonly suffix: string;
|
|
318
|
-
readonly suffixOverrides: readonly string[];
|
|
319
|
-
}
|
|
320
|
-
export interface TrimNode {
|
|
321
|
-
readonly kind: "trim";
|
|
322
|
-
readonly attributes: TrimAttributes;
|
|
323
|
-
readonly children: readonly TemplateNode[];
|
|
324
|
-
readonly range: SourceRange;
|
|
325
|
-
}
|
|
326
|
-
export type TemplateNode = TextNode | BindNode | FragmentNode | IdentifierNode | RawNode | ListNode | IfNode | ChooseNode | TrimNode;
|
|
327
|
-
export interface TemplateIr {
|
|
328
|
-
readonly version: 1;
|
|
329
|
-
readonly nodes: readonly TemplateNode[];
|
|
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[];
|
|
336
|
-
}
|
|
337
|
-
export interface SqlFragment {
|
|
338
|
-
readonly [SQL_FRAGMENT]: true;
|
|
339
|
-
readonly ir: TemplateIr;
|
|
340
|
-
readonly values: readonly unknown[];
|
|
341
|
-
readonly dialectId: string;
|
|
475
|
+
readonly nullable: boolean;
|
|
476
|
+
readonly numeric?: NumericTypeContract;
|
|
477
|
+
}
|
|
478
|
+
/** Adapter type policy; it normalizes driver values and encodes inputs without becoming a schema validator. */
|
|
479
|
+
export interface TypePolicy {
|
|
480
|
+
readonly id: string;
|
|
481
|
+
readonly hash: string;
|
|
482
|
+
readonly mappings: readonly TypeMapping[];
|
|
483
|
+
decode(databaseType: string, value: unknown): unknown;
|
|
484
|
+
encode(databaseType: string, value: unknown): unknown;
|
|
342
485
|
}
|
|
486
|
+
//#endregion
|
|
487
|
+
//#region src/query.d.ts
|
|
488
|
+
/**
|
|
489
|
+
* SQLBraid query value. It retains template IR and application mapping metadata until runtime rendering.
|
|
490
|
+
* `resultSchema` is applied after driver materialization and is never forwarded to the driver.
|
|
491
|
+
*/
|
|
343
492
|
export interface Query<Row = unknown, Kind extends QueryResultKind = "unknown"> {
|
|
344
493
|
readonly ir: TemplateIr;
|
|
345
494
|
readonly values: readonly unknown[];
|
|
@@ -355,17 +504,20 @@ export interface Query<Row = unknown, Kind extends QueryResultKind = "unknown">
|
|
|
355
504
|
export type RowQuery<Row = unknown> = Query<Row, "rows">;
|
|
356
505
|
export type CommandQuery = Query<CommandResult, "command">;
|
|
357
506
|
export type CallQuery<Result extends RoutineCallResult = RoutineCallResult> = Query<Result, "call">;
|
|
507
|
+
/** Driver-normalized command metadata; adapters may expose additional native fields without changing the kind. */
|
|
358
508
|
export interface CommandResult {
|
|
359
509
|
readonly affectedRows?: number;
|
|
360
510
|
readonly insertId?: string;
|
|
361
511
|
readonly [key: string]: unknown;
|
|
362
512
|
}
|
|
513
|
+
/** Materialized row result. Runtime validates that it matches a rows query declaration. */
|
|
363
514
|
export interface RowsExecutionResult<Row = unknown> {
|
|
364
515
|
readonly kind: "rows";
|
|
365
516
|
readonly rows: readonly Row[];
|
|
366
517
|
readonly rowCount?: number;
|
|
367
518
|
readonly command?: never;
|
|
368
519
|
}
|
|
520
|
+
/** Materialized command result. Command executions intentionally expose no row payload. */
|
|
369
521
|
export interface CommandExecutionResult {
|
|
370
522
|
readonly kind: "command";
|
|
371
523
|
readonly rows: readonly [];
|
|
@@ -373,121 +525,173 @@ export interface CommandExecutionResult {
|
|
|
373
525
|
readonly command: CommandResult;
|
|
374
526
|
}
|
|
375
527
|
export type QueryExecutionResult<Row = unknown> = RowsExecutionResult<Row> | CommandExecutionResult;
|
|
528
|
+
/** Execution controls shared by materialized, routine, batch, and stream operations. */
|
|
376
529
|
export interface ExecutionOptions {
|
|
377
530
|
readonly signal?: AbortSignal;
|
|
378
531
|
}
|
|
532
|
+
/** Physical SPI may complete synchronously; the public database surface remains asynchronous. */
|
|
379
533
|
export type Awaitable<T> = T | PromiseLike<T>;
|
|
534
|
+
/** Optional Standard Schema mapping applied after query-bound mapping and driver materialization. */
|
|
380
535
|
export interface RowValidationOptions<Row> extends ExecutionOptions {
|
|
381
536
|
readonly schema?: StandardSchemaV1$1<unknown, NoInfer<Row>>;
|
|
382
537
|
}
|
|
383
538
|
export interface StreamOptions<Row> extends RowValidationOptions<Row> {}
|
|
539
|
+
/** Portable transaction isolation vocabulary; adapters reject levels they cannot provide. */
|
|
384
540
|
export type TransactionIsolation = "read-uncommitted" | "read-committed" | "repeatable-read" | "serializable";
|
|
541
|
+
/** Options for the outer physical transaction. Nested `db.tx()` calls are savepoints and accept no second option set. */
|
|
385
542
|
export interface TransactionOptions {
|
|
386
543
|
readonly isolation?: TransactionIsolation;
|
|
387
544
|
readonly readOnly?: boolean;
|
|
388
545
|
}
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
readonly code: `BRAID_${string}`;
|
|
397
|
-
constructor(code: `BRAID_${string}`, message: string, options?: ErrorOptions);
|
|
398
|
-
}
|
|
399
|
-
export interface RoutineResultSet<Row = unknown> {
|
|
400
|
-
readonly rows: readonly Row[];
|
|
546
|
+
//#endregion
|
|
547
|
+
//#region src/environment.d.ts
|
|
548
|
+
export interface EnvironmentCapability {
|
|
549
|
+
readonly status: "guaranteed" | "guarded" | "unsupported";
|
|
550
|
+
readonly canonical?: "string" | "number" | "Uint8Array";
|
|
551
|
+
readonly rawRepresentations?: readonly string[];
|
|
552
|
+
readonly conditionCode?: string;
|
|
401
553
|
}
|
|
402
|
-
|
|
403
|
-
export interface
|
|
404
|
-
readonly
|
|
405
|
-
|
|
406
|
-
|
|
554
|
+
/** Observed database/driver/runtime evidence plus exact support-target matching. */
|
|
555
|
+
export interface DatabaseEnvironment {
|
|
556
|
+
readonly database: {
|
|
557
|
+
readonly product: string;
|
|
558
|
+
readonly version?: string;
|
|
559
|
+
readonly edition?: string;
|
|
560
|
+
};
|
|
561
|
+
readonly driver: {
|
|
562
|
+
readonly id: string;
|
|
563
|
+
readonly version?: string;
|
|
564
|
+
readonly profile?: string;
|
|
565
|
+
};
|
|
566
|
+
readonly runtime: {
|
|
567
|
+
readonly id: string;
|
|
568
|
+
readonly version?: string;
|
|
569
|
+
};
|
|
570
|
+
readonly typePolicy?: {
|
|
571
|
+
readonly id: string;
|
|
572
|
+
readonly hash: string;
|
|
573
|
+
};
|
|
574
|
+
readonly capabilities: Readonly<Record<string, EnvironmentCapability>>;
|
|
575
|
+
readonly supportMatch: {
|
|
576
|
+
readonly status: "official" | "conditional" | "compatible";
|
|
577
|
+
readonly targetId?: string;
|
|
578
|
+
readonly reason?: string;
|
|
579
|
+
};
|
|
407
580
|
}
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
readonly
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
readonly
|
|
417
|
-
readonly
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
};
|
|
426
|
-
export interface DriverRoutineResultSet {
|
|
427
|
-
readonly rows: readonly unknown[];
|
|
428
|
-
readonly source: RoutineResultSource;
|
|
581
|
+
/** Adapter evidence only. Probes run through the ordinary observed, leased query path. */
|
|
582
|
+
export interface DriverEnvironment {
|
|
583
|
+
readonly database: DatabaseEnvironment["database"];
|
|
584
|
+
readonly driver: DatabaseEnvironment["driver"];
|
|
585
|
+
readonly typePolicy?: {
|
|
586
|
+
readonly id: string;
|
|
587
|
+
readonly hash: string;
|
|
588
|
+
};
|
|
589
|
+
readonly capabilities: DatabaseEnvironment["capabilities"];
|
|
590
|
+
readonly probe?: {
|
|
591
|
+
readonly statement: RenderedStatement;
|
|
592
|
+
readonly read: (rows: readonly unknown[]) => {
|
|
593
|
+
readonly version?: string;
|
|
594
|
+
readonly edition?: string;
|
|
595
|
+
readonly capabilities?: Readonly<Record<string, EnvironmentCapability>>;
|
|
596
|
+
};
|
|
597
|
+
};
|
|
429
598
|
}
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
readonly
|
|
433
|
-
readonly
|
|
599
|
+
/** Structural subset of a support manifest; importing support tooling is unnecessary. */
|
|
600
|
+
export interface EnvironmentSupportTarget {
|
|
601
|
+
readonly id: string;
|
|
602
|
+
readonly status: string;
|
|
603
|
+
readonly database: {
|
|
604
|
+
readonly product: string;
|
|
605
|
+
readonly version: string;
|
|
606
|
+
readonly edition: string;
|
|
607
|
+
};
|
|
608
|
+
readonly driver: {
|
|
609
|
+
readonly id: string;
|
|
610
|
+
readonly version: string;
|
|
611
|
+
readonly profile: string;
|
|
612
|
+
};
|
|
613
|
+
readonly runtime: {
|
|
614
|
+
readonly id: string;
|
|
615
|
+
readonly version: string;
|
|
616
|
+
};
|
|
617
|
+
readonly typePolicy: {
|
|
618
|
+
readonly id: string;
|
|
619
|
+
readonly hash: string;
|
|
620
|
+
};
|
|
621
|
+
readonly evidence: {
|
|
622
|
+
readonly status: string;
|
|
623
|
+
};
|
|
434
624
|
}
|
|
435
|
-
export
|
|
436
|
-
readonly
|
|
437
|
-
|
|
438
|
-
readonly
|
|
439
|
-
} | {
|
|
440
|
-
readonly kind: "result-set";
|
|
441
|
-
readonly resultSetIndex: number;
|
|
442
|
-
readonly rowIndex: number;
|
|
443
|
-
};
|
|
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";
|
|
445
|
-
export declare class RoutineMappingError extends Error {
|
|
446
|
-
static readonly code: "BRAID_CALL_MAP";
|
|
447
|
-
readonly code: "BRAID_CALL_MAP";
|
|
448
|
-
readonly location: RoutineMappingLocation;
|
|
449
|
-
constructor(message: string, location: RoutineMappingLocation, options?: {
|
|
450
|
-
readonly cause?: unknown;
|
|
451
|
-
});
|
|
625
|
+
export interface EnvironmentOptions {
|
|
626
|
+
readonly targets?: readonly EnvironmentSupportTarget[];
|
|
627
|
+
/** Re-probe the current lease instead of returning the cached observation. */
|
|
628
|
+
readonly refresh?: boolean;
|
|
452
629
|
}
|
|
630
|
+
//#endregion
|
|
631
|
+
//#region src/executor.d.ts
|
|
632
|
+
/** Native or adapter execution strategy reported for a bulk operation; the label does not imply atomicity. */
|
|
453
633
|
export type BulkExecutionMode = "native-bulk" | "pipeline" | "prepared-loop" | "remote-batch";
|
|
634
|
+
/** Driver bulk result normalized for runtime accounting and observer events. */
|
|
454
635
|
export interface BulkExecutionResult {
|
|
455
636
|
readonly inputCount: number;
|
|
456
637
|
readonly affectedRows?: number;
|
|
457
638
|
readonly executionMode: BulkExecutionMode;
|
|
458
639
|
}
|
|
640
|
+
/**
|
|
641
|
+
* Physical execution SPI for one serialized resource.
|
|
642
|
+
* Query/call/control methods may be synchronous at this boundary; streams remain async iterables and retain ownership until closed.
|
|
643
|
+
*/
|
|
459
644
|
export interface QueryExecutor {
|
|
460
645
|
/** Stable identity for the physical execution resource shared by wrappers; pools must use a leased resource. */
|
|
461
646
|
readonly ownershipKey?: object;
|
|
462
647
|
readonly statementBinding: StatementBindingAdapter;
|
|
463
648
|
readonly environment?: DriverEnvironment;
|
|
649
|
+
/** Execute one materialized statement on this physical resource. */
|
|
464
650
|
query<Row>(rendered: RenderedStatement, binding?: StatementBindingDescription, options?: ExecutionOptions): Awaitable<QueryExecutionResult<Row>>;
|
|
651
|
+
/** Open a true driver stream; the physical resource remains owned until iteration closes. */
|
|
465
652
|
stream<Row>(rendered: RenderedStatement, binding?: StatementBindingDescription, options?: ExecutionOptions): AsyncIterable<Row>;
|
|
653
|
+
/** Execute a routine call and return normalized scalar/result-set channels. */
|
|
466
654
|
call(rendered: RenderedStatement, binding?: StatementBindingDescription, options?: ExecutionOptions): Awaitable<DriverRoutineResult>;
|
|
655
|
+
/** Optional homogeneous bulk protocol. The reported execution mode does not imply atomicity. */
|
|
467
656
|
bulk?(bulk: RenderedBulk, binding: BulkBindingDescription, options?: ExecutionOptions): Awaitable<BulkExecutionResult>;
|
|
657
|
+
/** Pure pre-acquire validation for adapter-specific transaction option support. */
|
|
658
|
+
validateTransactionOptions?(options: TransactionOptions): void;
|
|
659
|
+
/** Begin the outer transaction on this physical resource. */
|
|
468
660
|
begin?(options?: TransactionOptions): Awaitable<void>;
|
|
661
|
+
/** Commit the outer transaction on this physical resource. */
|
|
469
662
|
commit?(): Awaitable<void>;
|
|
663
|
+
/** Roll back the outer transaction on this physical resource. */
|
|
470
664
|
rollback?(): Awaitable<void>;
|
|
665
|
+
/** Create a nested transaction boundary on the current resource. */
|
|
471
666
|
savepoint?(name: string): Awaitable<void>;
|
|
667
|
+
/** Roll back the current resource to a previously created savepoint. */
|
|
472
668
|
rollbackTo?(name: string): Awaitable<void>;
|
|
669
|
+
/** End the logical savepoint boundary; adapters may implement this as a no-op when the database releases implicitly. */
|
|
473
670
|
releaseSavepoint?(name: string): Awaitable<void>;
|
|
474
671
|
}
|
|
672
|
+
/** Acquired physical resource. The lease owns release/discard, while runtime owns operation serialization. */
|
|
475
673
|
export interface ConnectionLease extends QueryExecutor {
|
|
476
674
|
release(options?: {
|
|
477
675
|
readonly discard?: boolean;
|
|
478
676
|
}): void | Promise<void>;
|
|
479
677
|
}
|
|
678
|
+
/** Lease factory for pools; acquiring one lease is the boundary that establishes physical connection ownership. */
|
|
480
679
|
export interface ConnectionProvider {
|
|
481
680
|
readonly statementBinding: StatementBindingAdapter;
|
|
482
681
|
readonly environment?: DriverEnvironment;
|
|
682
|
+
validateTransactionOptions?(options: TransactionOptions): void;
|
|
483
683
|
acquire(): Promise<ConnectionLease>;
|
|
484
684
|
}
|
|
685
|
+
//#endregion
|
|
686
|
+
//#region src/observers.d.ts
|
|
687
|
+
/** Immutable observer projection of adapter transport and reuse decisions. */
|
|
485
688
|
export interface QueryExecutionPlan {
|
|
486
689
|
readonly adapterId: string;
|
|
487
690
|
readonly dialectId: string;
|
|
488
691
|
readonly transport: ParameterTransportKind;
|
|
489
692
|
readonly reuse: StatementBindingDescription["reuse"];
|
|
490
693
|
}
|
|
694
|
+
/** Observer event emitted after rendering and binding, before physical execution. */
|
|
491
695
|
export interface QueryReadyEvent {
|
|
492
696
|
readonly type: "query:ready";
|
|
493
697
|
readonly purpose?: "environment";
|
|
@@ -511,6 +715,7 @@ export interface QueryReadyEvent {
|
|
|
511
715
|
readonly transactionDepth: number;
|
|
512
716
|
readonly transactionScoped: boolean;
|
|
513
717
|
}
|
|
718
|
+
/** Observer event emitted after driver materialization and result-kind validation, before mapping. */
|
|
514
719
|
export interface QueryResultEvent {
|
|
515
720
|
readonly type: "query:result";
|
|
516
721
|
readonly purpose?: "environment";
|
|
@@ -527,6 +732,7 @@ export interface QueryResultEvent {
|
|
|
527
732
|
readonly transactionDepth: number;
|
|
528
733
|
readonly transactionScoped: boolean;
|
|
529
734
|
}
|
|
735
|
+
/** Observer event emitted after query-bound and execution-level mapping completes. */
|
|
530
736
|
export interface QueryMappedEvent {
|
|
531
737
|
readonly type: "query:mapped";
|
|
532
738
|
readonly purpose?: "environment";
|
|
@@ -540,6 +746,7 @@ export interface QueryMappedEvent {
|
|
|
540
746
|
readonly transactionDepth: number;
|
|
541
747
|
readonly transactionScoped: boolean;
|
|
542
748
|
}
|
|
749
|
+
/** Observer event emitted after the complete homogeneous bulk is prepared, before physical execution. */
|
|
543
750
|
export interface BulkReadyEvent {
|
|
544
751
|
readonly type: "bulk:ready";
|
|
545
752
|
readonly operationId: string;
|
|
@@ -550,6 +757,7 @@ export interface BulkReadyEvent {
|
|
|
550
757
|
readonly valuesAt: (index: number) => readonly unknown[];
|
|
551
758
|
readonly literalizedSql: (index: number, options?: LiteralizeOptions) => LiteralizedSqlResult;
|
|
552
759
|
}
|
|
760
|
+
/** Observer event emitted after bulk execution and result normalization. */
|
|
553
761
|
export interface BulkResultEvent {
|
|
554
762
|
readonly type: "bulk:result";
|
|
555
763
|
readonly operationId: string;
|
|
@@ -561,6 +769,7 @@ export interface BulkResultEvent {
|
|
|
561
769
|
readonly transactionScoped: boolean;
|
|
562
770
|
}
|
|
563
771
|
export type QueryErrorStage = "render" | "prepared" | "observer-before" | "materialize" | "acquire" | "driver" | "result-kind" | "cardinality" | "query-map" | "execution-map" | "observer-after" | "release" | "stream" | "transaction";
|
|
772
|
+
/** Observer event describing the stage and truthful execution flags for a failed operation. */
|
|
564
773
|
export interface QueryErrorEvent {
|
|
565
774
|
readonly type: "query:error";
|
|
566
775
|
readonly purpose?: "environment";
|
|
@@ -575,6 +784,7 @@ export interface QueryErrorEvent {
|
|
|
575
784
|
readonly transactionDepth: number;
|
|
576
785
|
readonly transactionScoped: boolean;
|
|
577
786
|
}
|
|
787
|
+
/** Observer event emitted when a stream is admitted and its lease is about to be retained. */
|
|
578
788
|
export interface StreamStartEvent {
|
|
579
789
|
readonly type: "stream:start";
|
|
580
790
|
readonly operationId: string;
|
|
@@ -595,6 +805,7 @@ export interface StreamStartEvent {
|
|
|
595
805
|
readonly transactionDepth: number;
|
|
596
806
|
readonly transactionScoped: boolean;
|
|
597
807
|
}
|
|
808
|
+
/** Terminal stream event; delivery is attempted for every observer even if one observer fails. */
|
|
598
809
|
export interface StreamEndEvent {
|
|
599
810
|
readonly type: "stream:end";
|
|
600
811
|
readonly operationId: string;
|
|
@@ -606,6 +817,7 @@ export interface StreamEndEvent {
|
|
|
606
817
|
readonly transactionScoped: boolean;
|
|
607
818
|
}
|
|
608
819
|
export type TransactionEventPhase = "begin" | "commit" | "rollback" | "savepoint" | "rollback-to-savepoint" | "release-savepoint";
|
|
820
|
+
/** Transaction-control lifecycle event for outer transactions and nested savepoints. */
|
|
609
821
|
export interface TransactionEvent {
|
|
610
822
|
readonly type: "transaction";
|
|
611
823
|
readonly transactionId: string;
|
|
@@ -617,90 +829,13 @@ export interface TransactionEvent {
|
|
|
617
829
|
readonly error?: unknown;
|
|
618
830
|
}
|
|
619
831
|
export type ExecutionEvent = QueryReadyEvent | QueryResultEvent | QueryMappedEvent | BulkReadyEvent | BulkResultEvent | QueryErrorEvent | StreamStartEvent | StreamEndEvent | TransactionEvent;
|
|
832
|
+
/** Readonly observer hook. Observers may fail execution, but cannot rewrite SQL, binds, routing, or results. */
|
|
620
833
|
export interface ExecutionObserver {
|
|
621
834
|
onEvent(event: ExecutionEvent): void | Promise<void>;
|
|
622
835
|
}
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
readonly rawRepresentations?: readonly string[];
|
|
627
|
-
readonly conditionCode?: string;
|
|
628
|
-
}
|
|
629
|
-
export interface DatabaseEnvironment {
|
|
630
|
-
readonly database: {
|
|
631
|
-
readonly product: string;
|
|
632
|
-
readonly version?: string;
|
|
633
|
-
readonly edition?: string;
|
|
634
|
-
};
|
|
635
|
-
readonly driver: {
|
|
636
|
-
readonly id: string;
|
|
637
|
-
readonly version?: string;
|
|
638
|
-
readonly profile?: string;
|
|
639
|
-
};
|
|
640
|
-
readonly runtime: {
|
|
641
|
-
readonly id: string;
|
|
642
|
-
readonly version?: string;
|
|
643
|
-
};
|
|
644
|
-
readonly typePolicy?: {
|
|
645
|
-
readonly id: string;
|
|
646
|
-
readonly hash: string;
|
|
647
|
-
};
|
|
648
|
-
readonly capabilities: Readonly<Record<string, EnvironmentCapability>>;
|
|
649
|
-
readonly supportMatch: {
|
|
650
|
-
readonly status: "official" | "conditional" | "compatible";
|
|
651
|
-
readonly targetId?: string;
|
|
652
|
-
readonly reason?: string;
|
|
653
|
-
};
|
|
654
|
-
}
|
|
655
|
-
/** Adapter evidence only. Probes run through the ordinary observed, leased query path. */
|
|
656
|
-
export interface DriverEnvironment {
|
|
657
|
-
readonly database: DatabaseEnvironment["database"];
|
|
658
|
-
readonly driver: DatabaseEnvironment["driver"];
|
|
659
|
-
readonly typePolicy?: {
|
|
660
|
-
readonly id: string;
|
|
661
|
-
readonly hash: string;
|
|
662
|
-
};
|
|
663
|
-
readonly capabilities: DatabaseEnvironment["capabilities"];
|
|
664
|
-
readonly probe?: {
|
|
665
|
-
readonly statement: RenderedStatement;
|
|
666
|
-
readonly read: (rows: readonly unknown[]) => {
|
|
667
|
-
readonly version?: string;
|
|
668
|
-
readonly edition?: string;
|
|
669
|
-
readonly capabilities?: Readonly<Record<string, EnvironmentCapability>>;
|
|
670
|
-
};
|
|
671
|
-
};
|
|
672
|
-
}
|
|
673
|
-
/** Structural subset of a support manifest; importing support tooling is unnecessary. */
|
|
674
|
-
export interface EnvironmentSupportTarget {
|
|
675
|
-
readonly id: string;
|
|
676
|
-
readonly status: string;
|
|
677
|
-
readonly database: {
|
|
678
|
-
readonly product: string;
|
|
679
|
-
readonly version: string;
|
|
680
|
-
readonly edition: string;
|
|
681
|
-
};
|
|
682
|
-
readonly driver: {
|
|
683
|
-
readonly id: string;
|
|
684
|
-
readonly version: string;
|
|
685
|
-
readonly profile: string;
|
|
686
|
-
};
|
|
687
|
-
readonly runtime: {
|
|
688
|
-
readonly id: string;
|
|
689
|
-
readonly version: string;
|
|
690
|
-
};
|
|
691
|
-
readonly typePolicy: {
|
|
692
|
-
readonly id: string;
|
|
693
|
-
readonly hash: string;
|
|
694
|
-
};
|
|
695
|
-
readonly evidence: {
|
|
696
|
-
readonly status: string;
|
|
697
|
-
};
|
|
698
|
-
}
|
|
699
|
-
export interface EnvironmentOptions {
|
|
700
|
-
readonly targets?: readonly EnvironmentSupportTarget[];
|
|
701
|
-
/** Re-probe the current lease instead of returning the cached observation. */
|
|
702
|
-
readonly refresh?: boolean;
|
|
703
|
-
}
|
|
836
|
+
//#endregion
|
|
837
|
+
//#region src/database.d.ts
|
|
838
|
+
/** Root database behavior: observers and default prepared-reuse preference. */
|
|
704
839
|
export interface DatabaseOptions {
|
|
705
840
|
readonly observers?: readonly ExecutionObserver[];
|
|
706
841
|
readonly reuse?: RequestedReuse;
|
|
@@ -712,6 +847,7 @@ export type PreparedFactoryOptions = {
|
|
|
712
847
|
readonly input: "required";
|
|
713
848
|
};
|
|
714
849
|
export type PreparedArguments<Input, Options> = [Input] extends [never] ? [options?: Options] : [input: Input, options?: Options];
|
|
850
|
+
/** Prepared handle whose input arity and result helpers are fixed by the factory's query kind. */
|
|
715
851
|
export type PreparedQuery<Input, Q extends PreparableQuery> = {
|
|
716
852
|
readonly name: string;
|
|
717
853
|
} & (Q extends CallQuery<infer Result> ? {
|
|
@@ -726,15 +862,29 @@ export type PreparedQuery<Input, Q extends PreparableQuery> = {
|
|
|
726
862
|
} : {}));
|
|
727
863
|
export type ExecutableQuery = RowQuery<unknown> | Query<unknown, "command"> | Query<unknown, "unknown">;
|
|
728
864
|
export type ExecutionResultOf<Q> = Q extends RowQuery<infer Row> ? RowsExecutionResult<Row> : Q extends Query<unknown, "command"> ? CommandExecutionResult : Q extends Query<infer Row, "unknown"> ? QueryExecutionResult<Row> : never;
|
|
865
|
+
/**
|
|
866
|
+
* Async application database surface.
|
|
867
|
+
* Root pooled operations acquire/release per operation; `session()` and `tx()` callbacks pin a scoped resource.
|
|
868
|
+
* Scoped handles expire when their callback returns, and streams must close before a scope can finish.
|
|
869
|
+
*/
|
|
729
870
|
export interface Database {
|
|
871
|
+
/** Observe database/driver/runtime evidence and optionally match it against exact support targets. */
|
|
730
872
|
environment(options?: EnvironmentOptions): Promise<DatabaseEnvironment>;
|
|
873
|
+
/** Materialize every row and apply query/execution mapping after the root lease is released. */
|
|
731
874
|
all<Row>(query: RowQuery<Row>, options?: RowValidationOptions<Row>): Promise<readonly Row[]>;
|
|
875
|
+
/** Require exactly one row; cardinality is checked before application mapping. */
|
|
732
876
|
one<Row>(query: RowQuery<Row>, options?: RowValidationOptions<Row>): Promise<Row>;
|
|
877
|
+
/** Return `undefined` for zero rows and reject when more than one row is returned. */
|
|
733
878
|
maybeOne<Row>(query: RowQuery<Row>, options?: RowValidationOptions<Row>): Promise<Row | undefined>;
|
|
879
|
+
/** Execute a row, command, or unknown query and preserve its normalized result kind. */
|
|
734
880
|
execute<Q extends ExecutableQuery>(query: Q, options?: ExecutionOptions): Promise<ExecutionResultOf<Q>>;
|
|
881
|
+
/** Execute a routine query and materialize all normalized routine channels before mapping. */
|
|
735
882
|
call<Result extends RoutineCallResult>(query: CallQuery<Result>, options?: ExecutionOptions): Promise<Result>;
|
|
883
|
+
/** Execute different queries sequentially on one physical use/lease. This is not an implicit transaction. */
|
|
736
884
|
batch<const Queries extends readonly ExecutableQuery[]>(queries: Queries, options?: ExecutionOptions): Promise<{ readonly [K in keyof Queries]: ExecutionResultOf<Queries[K]>; }>;
|
|
885
|
+
/** Execute one homogeneous command shape for many inputs using the adapter's bulk strategy. */
|
|
737
886
|
bulk<Input>(inputs: readonly Input[], factory: (input: Input, index: number) => CommandQuery, options?: ExecutionOptions): Promise<BulkResult>;
|
|
887
|
+
/** Create a prepared handle whose first successful execution locks the logical SQLBraid shape. */
|
|
738
888
|
prepare<Factory extends () => PreparableQuery>(name: string, factory: Factory & (Parameters<Factory> extends [] ? unknown : never), options: {
|
|
739
889
|
readonly input: "none";
|
|
740
890
|
}): PreparedQuery<never, ReturnType<Factory>>;
|
|
@@ -742,47 +892,260 @@ export interface Database {
|
|
|
742
892
|
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
893
|
readonly input: "required";
|
|
744
894
|
}): PreparedQuery<Parameters<Factory>[0], ReturnType<Factory>>;
|
|
895
|
+
/** Stream rows without full buffering; the physical resource remains pinned until iteration closes. */
|
|
745
896
|
stream<Row>(query: RowQuery<Row>, options?: StreamOptions<Row>): AsyncIterable<Row>;
|
|
897
|
+
/** Pin one physical resource for the callback without implicitly starting a transaction. */
|
|
746
898
|
session<T>(callback: (database: Database) => Promise<T>): Promise<T>;
|
|
899
|
+
/** Run the callback in one physical transaction; nested calls use savepoints on the same resource. */
|
|
747
900
|
tx<T>(callback: (database: Database) => Promise<T>): Promise<T>;
|
|
748
901
|
tx<T>(options: TransactionOptions, callback: (database: Database) => Promise<T>): Promise<T>;
|
|
749
902
|
}
|
|
903
|
+
/** Normalized bulk accounting; root bulk is not implicitly transactional. */
|
|
750
904
|
export interface BulkResult {
|
|
751
905
|
readonly inputCount: number;
|
|
752
906
|
readonly affectedRows?: number;
|
|
753
907
|
}
|
|
754
908
|
export type QueryRow<Q> = Q extends Query<infer Row, QueryResultKind> ? Row : never;
|
|
909
|
+
//#endregion
|
|
910
|
+
//#region src/authoring.d.ts
|
|
911
|
+
/** Generic SQL tag shape used by configured dialect/query-kind specializations. */
|
|
755
912
|
export interface SqlTagLike<Kind extends QueryResultKind = QueryResultKind, Row = unknown> {
|
|
756
913
|
(strings: TemplateStringsArray, ...values: readonly unknown[]): Query<Row, Kind>;
|
|
757
914
|
}
|
|
758
915
|
export interface RoutineContractTag<Contract extends RoutineContract> {
|
|
759
916
|
(strings: TemplateStringsArray, ...values: readonly unknown[]): CallQuery<RoutineResultFromContract<Contract>>;
|
|
760
917
|
}
|
|
918
|
+
/** Row-specialized tag supporting either a TypeScript row type or a Standard Schema mapper. */
|
|
761
919
|
export interface RowsTag {
|
|
762
920
|
<Input, Output>(schema: StandardSchemaV1$1<Input, Output>): SqlTagLike<"rows", Output>;
|
|
763
921
|
<Row = unknown>(strings: TemplateStringsArray, ...values: readonly unknown[]): RowQuery<Row>;
|
|
764
922
|
}
|
|
923
|
+
/**
|
|
924
|
+
* SQL authoring surface. Values are bound by default; `ident`, `fragment`, `list`, `join`, and `raw` are explicit structure.
|
|
925
|
+
*/
|
|
765
926
|
export interface SqlTag extends SqlTagLike<"unknown"> {
|
|
927
|
+
/** Declare a row-producing query, optionally with query-bound Standard Schema mapping. */
|
|
766
928
|
rows: RowsTag;
|
|
929
|
+
/** Declare a command query that must normalize to command metadata. */
|
|
767
930
|
command: (strings: TemplateStringsArray, ...values: readonly unknown[]) => CommandQuery;
|
|
931
|
+
/** Declare a routine query, optionally with explicit output/result-set/return mapping contracts. */
|
|
768
932
|
call: {
|
|
769
933
|
<Result extends RoutineCallResult = RoutineCallResult>(strings: TemplateStringsArray, ...values: readonly unknown[]): CallQuery<Result>;
|
|
770
934
|
<Contract extends RoutineContract>(contract: Contract): RoutineContractTag<Contract>;
|
|
771
935
|
};
|
|
936
|
+
/** Attach explicit database parameter metadata without turning the value into SQL structure. */
|
|
772
937
|
bind<Input>(value: NoInfer<Input>, hint: ParameterTypeHint<Input>): BoundParameter<Input>;
|
|
938
|
+
/** Declare a routine OUT parameter owned by the adapter. */
|
|
773
939
|
out(name: string, hint?: ParameterTypeHint): RoutineParameter<null>;
|
|
940
|
+
/** Declare a routine INOUT parameter owned by the adapter. */
|
|
774
941
|
inOut<Input>(name: string, value: NoInfer<Input>, hint?: ParameterTypeHint<Input>): RoutineParameter<Input>;
|
|
942
|
+
/** Create explicit SQL structure while preserving ordinary interpolations as values. */
|
|
775
943
|
fragment: (strings: TemplateStringsArray, ...values: readonly unknown[]) => SqlFragment;
|
|
944
|
+
/** Empty structural fragment for conditional composition. */
|
|
776
945
|
empty: SqlFragment;
|
|
946
|
+
/** Create a dialect-quoted identifier or qualified identifier path. */
|
|
777
947
|
ident: (identifier: string | readonly string[]) => SqlFragment;
|
|
948
|
+
/** Insert verbatim SQL structure. Never pass user-controlled or otherwise untrusted text. */
|
|
778
949
|
raw: (text: string) => SqlFragment;
|
|
950
|
+
/** Join already-structural fragments with a structural separator. */
|
|
779
951
|
join: (items: readonly SqlFragment[], separator?: SqlFragment) => SqlFragment;
|
|
952
|
+
/** Expand an array as a structural comma-separated list of value binds. */
|
|
780
953
|
list: (values: readonly unknown[]) => SqlFragment;
|
|
781
954
|
}
|
|
782
|
-
export declare class SqlRenderError extends Error {
|
|
783
|
-
readonly code: string;
|
|
784
|
-
constructor(code: string, message: string);
|
|
785
|
-
}
|
|
786
955
|
//#endregion
|
|
787
|
-
|
|
956
|
+
//#region src/authoring-modules.d.ts
|
|
957
|
+
/** Data-only authoring identity shared by compiler, tooling, and editor consumers. */
|
|
958
|
+
type AuthoringModuleCatalogEntry = {
|
|
959
|
+
readonly moduleSpecifier: string;
|
|
960
|
+
readonly dialectId?: "postgres" | "mysql" | "mariadb" | "sqlite" | "oracle" | "mssql";
|
|
961
|
+
readonly helperFamily: "template" | "facade";
|
|
962
|
+
};
|
|
963
|
+
export declare const AUTHORING_MODULE_CATALOG: readonly AuthoringModuleCatalogEntry[];
|
|
964
|
+
//#endregion
|
|
965
|
+
//#region src/capabilities.d.ts
|
|
966
|
+
/**
|
|
967
|
+
* The machine-readable capability vocabulary shared by adapters, support data,
|
|
968
|
+
* and documentation. A capability's family describes what its status proves;
|
|
969
|
+
* representation and metadata evidence are not execution support aliases.
|
|
970
|
+
*/
|
|
971
|
+
type CapabilityFamily = "support" | "representation" | "metadata";
|
|
972
|
+
interface WellKnownCapability {
|
|
973
|
+
readonly id: string;
|
|
974
|
+
readonly family: CapabilityFamily;
|
|
975
|
+
}
|
|
976
|
+
declare const definitions: readonly [{
|
|
977
|
+
readonly id: "sql.native-transparency";
|
|
978
|
+
readonly family: "support";
|
|
979
|
+
}, {
|
|
980
|
+
readonly id: "sql.generated-structure";
|
|
981
|
+
readonly family: "support";
|
|
982
|
+
}, {
|
|
983
|
+
readonly id: "result.rows";
|
|
984
|
+
readonly family: "support";
|
|
985
|
+
}, {
|
|
986
|
+
readonly id: "result.command";
|
|
987
|
+
readonly family: "support";
|
|
988
|
+
}, {
|
|
989
|
+
readonly id: "result.multiple-sets";
|
|
990
|
+
readonly family: "support";
|
|
991
|
+
}, {
|
|
992
|
+
readonly id: "result.standard-schema";
|
|
993
|
+
readonly family: "support";
|
|
994
|
+
}, {
|
|
995
|
+
readonly id: "numeric.exact-integer";
|
|
996
|
+
readonly family: "representation";
|
|
997
|
+
}, {
|
|
998
|
+
readonly id: "numeric.exact-decimal";
|
|
999
|
+
readonly family: "representation";
|
|
1000
|
+
}, {
|
|
1001
|
+
readonly id: "numeric.approximate-float";
|
|
1002
|
+
readonly family: "representation";
|
|
1003
|
+
}, {
|
|
1004
|
+
readonly id: "numeric.approximate-special";
|
|
1005
|
+
readonly family: "representation";
|
|
1006
|
+
}, {
|
|
1007
|
+
readonly id: "numeric.bind-exact";
|
|
1008
|
+
readonly family: "representation";
|
|
1009
|
+
}, {
|
|
1010
|
+
readonly id: "numeric.aggregate";
|
|
1011
|
+
readonly family: "representation";
|
|
1012
|
+
}, {
|
|
1013
|
+
readonly id: "numeric.command-metadata";
|
|
1014
|
+
readonly family: "representation";
|
|
1015
|
+
}, {
|
|
1016
|
+
readonly id: "numeric.special-values";
|
|
1017
|
+
readonly family: "representation";
|
|
1018
|
+
}, {
|
|
1019
|
+
readonly id: "numeric.scale-greater-than-precision";
|
|
1020
|
+
readonly family: "representation";
|
|
1021
|
+
}, {
|
|
1022
|
+
readonly id: "numeric.negative-scale";
|
|
1023
|
+
readonly family: "representation";
|
|
1024
|
+
}, {
|
|
1025
|
+
readonly id: "data.json-parsed";
|
|
1026
|
+
readonly family: "representation";
|
|
1027
|
+
}, {
|
|
1028
|
+
readonly id: "data.json-lossless-text";
|
|
1029
|
+
readonly family: "representation";
|
|
1030
|
+
}, {
|
|
1031
|
+
readonly id: "data.sql-variant";
|
|
1032
|
+
readonly family: "representation";
|
|
1033
|
+
}, {
|
|
1034
|
+
readonly id: "data.oracle-object";
|
|
1035
|
+
readonly family: "representation";
|
|
1036
|
+
}, {
|
|
1037
|
+
readonly id: "data.oracle-collection";
|
|
1038
|
+
readonly family: "representation";
|
|
1039
|
+
}, {
|
|
1040
|
+
readonly id: "data.vector";
|
|
1041
|
+
readonly family: "representation";
|
|
1042
|
+
}, {
|
|
1043
|
+
readonly id: "data.binary";
|
|
1044
|
+
readonly family: "representation";
|
|
1045
|
+
}, {
|
|
1046
|
+
readonly id: "data.uuid";
|
|
1047
|
+
readonly family: "representation";
|
|
1048
|
+
}, {
|
|
1049
|
+
readonly id: "data.temporal-native";
|
|
1050
|
+
readonly family: "representation";
|
|
1051
|
+
}, {
|
|
1052
|
+
readonly id: "data.temporal-lossless";
|
|
1053
|
+
readonly family: "representation";
|
|
1054
|
+
}, {
|
|
1055
|
+
readonly id: "data.timezone";
|
|
1056
|
+
readonly family: "representation";
|
|
1057
|
+
}, {
|
|
1058
|
+
readonly id: "metadata.command-safe";
|
|
1059
|
+
readonly family: "metadata";
|
|
1060
|
+
}, {
|
|
1061
|
+
readonly id: "dml.insert-returning";
|
|
1062
|
+
readonly family: "support";
|
|
1063
|
+
}, {
|
|
1064
|
+
readonly id: "dml.update-returning";
|
|
1065
|
+
readonly family: "support";
|
|
1066
|
+
}, {
|
|
1067
|
+
readonly id: "dml.delete-returning";
|
|
1068
|
+
readonly family: "support";
|
|
1069
|
+
}, {
|
|
1070
|
+
readonly id: "dml.merge-returning";
|
|
1071
|
+
readonly family: "support";
|
|
1072
|
+
}, {
|
|
1073
|
+
readonly id: "dml.upsert-returning";
|
|
1074
|
+
readonly family: "support";
|
|
1075
|
+
}, {
|
|
1076
|
+
readonly id: "session.pinned";
|
|
1077
|
+
readonly family: "support";
|
|
1078
|
+
}, {
|
|
1079
|
+
readonly id: "statement.prepare";
|
|
1080
|
+
readonly family: "support";
|
|
1081
|
+
}, {
|
|
1082
|
+
readonly id: "statement.cancel";
|
|
1083
|
+
readonly family: "support";
|
|
1084
|
+
}, {
|
|
1085
|
+
readonly id: "statement.stream";
|
|
1086
|
+
readonly family: "support";
|
|
1087
|
+
}, {
|
|
1088
|
+
readonly id: "statement.bulk";
|
|
1089
|
+
readonly family: "support";
|
|
1090
|
+
}, {
|
|
1091
|
+
readonly id: "execution.bulk-fidelity";
|
|
1092
|
+
readonly family: "support";
|
|
1093
|
+
}, {
|
|
1094
|
+
readonly id: "transaction";
|
|
1095
|
+
readonly family: "support";
|
|
1096
|
+
}, {
|
|
1097
|
+
readonly id: "transaction.savepoint";
|
|
1098
|
+
readonly family: "support";
|
|
1099
|
+
}, {
|
|
1100
|
+
readonly id: "transaction.read-only";
|
|
1101
|
+
readonly family: "support";
|
|
1102
|
+
}, {
|
|
1103
|
+
readonly id: "transaction.isolation.read-uncommitted";
|
|
1104
|
+
readonly family: "support";
|
|
1105
|
+
}, {
|
|
1106
|
+
readonly id: "transaction.isolation.read-committed";
|
|
1107
|
+
readonly family: "support";
|
|
1108
|
+
}, {
|
|
1109
|
+
readonly id: "transaction.isolation.repeatable-read";
|
|
1110
|
+
readonly family: "support";
|
|
1111
|
+
}, {
|
|
1112
|
+
readonly id: "transaction.isolation.serializable";
|
|
1113
|
+
readonly family: "support";
|
|
1114
|
+
}, {
|
|
1115
|
+
readonly id: "routine.call";
|
|
1116
|
+
readonly family: "support";
|
|
1117
|
+
}, {
|
|
1118
|
+
readonly id: "routine.out";
|
|
1119
|
+
readonly family: "support";
|
|
1120
|
+
}, {
|
|
1121
|
+
readonly id: "routine.inout";
|
|
1122
|
+
readonly family: "support";
|
|
1123
|
+
}, {
|
|
1124
|
+
readonly id: "routine.result-sets";
|
|
1125
|
+
readonly family: "support";
|
|
1126
|
+
}, {
|
|
1127
|
+
readonly id: "routine.out-cursor";
|
|
1128
|
+
readonly family: "support";
|
|
1129
|
+
}, {
|
|
1130
|
+
readonly id: "routine.return-value";
|
|
1131
|
+
readonly family: "support";
|
|
1132
|
+
}, {
|
|
1133
|
+
readonly id: "metadata.identity";
|
|
1134
|
+
readonly family: "metadata";
|
|
1135
|
+
}, {
|
|
1136
|
+
readonly id: "metadata.generated";
|
|
1137
|
+
readonly family: "metadata";
|
|
1138
|
+
}, {
|
|
1139
|
+
readonly id: "metadata.routines";
|
|
1140
|
+
readonly family: "metadata";
|
|
1141
|
+
}, {
|
|
1142
|
+
readonly id: "metadata.types";
|
|
1143
|
+
readonly family: "metadata";
|
|
1144
|
+
}];
|
|
1145
|
+
export declare const WELL_KNOWN_CAPABILITIES: readonly WellKnownCapability[];
|
|
1146
|
+
type WellKnownCapabilityId = (typeof definitions)[number]["id"];
|
|
1147
|
+
export declare const WELL_KNOWN_CAPABILITY_IDS: readonly WellKnownCapabilityId[];
|
|
1148
|
+
export declare function isWellKnownCapabilityId(value: string): value is WellKnownCapabilityId;
|
|
1149
|
+
//#endregion
|
|
1150
|
+
export type { AuthoringModuleCatalogEntry, CapabilityFamily, StandardSchemaV1, WellKnownCapability, WellKnownCapabilityId };
|
|
788
1151
|
//# sourceMappingURL=index.d.ts.map
|