@event-driven-io/dumbo 0.13.0-beta.2 → 0.13.0-beta.20
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/dist/chunk-3B24ORM3.js +34 -0
- package/dist/chunk-3B24ORM3.js.map +1 -0
- package/dist/chunk-FXETEUW2.cjs +34 -0
- package/dist/chunk-FXETEUW2.cjs.map +1 -0
- package/dist/chunk-JDP6VMRY.cjs +556 -0
- package/dist/chunk-JDP6VMRY.cjs.map +1 -0
- package/dist/{chunk-OJ34O3Q2.cjs → chunk-PYTHH6WO.cjs} +2161 -1639
- package/dist/chunk-PYTHH6WO.cjs.map +1 -0
- package/dist/chunk-SQXAAA3N.cjs +481 -0
- package/dist/chunk-SQXAAA3N.cjs.map +1 -0
- package/dist/chunk-U445U32Q.js +83 -0
- package/dist/chunk-U445U32Q.js.map +1 -0
- package/dist/{chunk-XVV3OOQX.js → chunk-USPL7TWB.js} +209 -58
- package/dist/chunk-USPL7TWB.js.map +1 -0
- package/dist/chunk-V3QUMPUM.js +481 -0
- package/dist/chunk-V3QUMPUM.js.map +1 -0
- package/dist/chunk-VIQJEUVF.cjs +83 -0
- package/dist/chunk-VIQJEUVF.cjs.map +1 -0
- package/dist/{chunk-N7RWT46K.js → chunk-ZH6YVE3B.js} +2132 -1610
- package/dist/chunk-ZH6YVE3B.js.map +1 -0
- package/dist/cloudflare.cjs +451 -0
- package/dist/cloudflare.cjs.map +1 -0
- package/dist/cloudflare.d.cts +92 -0
- package/dist/cloudflare.d.ts +92 -0
- package/dist/cloudflare.js +451 -0
- package/dist/cloudflare.js.map +1 -0
- package/dist/{columnProcessors-DMPpTPqM.d.ts → columnProcessors-BwcyMnUX.d.ts} +1 -1
- package/dist/{columnProcessors-BX-sH7ah.d.cts → columnProcessors-CO9z2XBz.d.cts} +1 -1
- package/dist/{connectionString-B1wm0TFc.d.cts → connectionString-DHJiGj2D.d.cts} +339 -129
- package/dist/{connectionString-B1wm0TFc.d.ts → connectionString-DHJiGj2D.d.ts} +339 -129
- package/dist/index.cjs +96 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +23 -18
- package/dist/index.d.ts +23 -18
- package/dist/index.js +99 -7
- package/dist/index.js.map +1 -1
- package/dist/pg.cjs +375 -9
- package/dist/pg.cjs.map +1 -1
- package/dist/pg.d.cts +76 -104
- package/dist/pg.d.ts +76 -104
- package/dist/pg.js +427 -61
- package/dist/pg.js.map +1 -1
- package/dist/postgresql.cjs +50 -0
- package/dist/postgresql.cjs.map +1 -0
- package/dist/postgresql.d.cts +61 -0
- package/dist/postgresql.d.ts +61 -0
- package/dist/postgresql.js +50 -0
- package/dist/sqlite.cjs +56 -0
- package/dist/sqlite.cjs.map +1 -0
- package/dist/{index-C0h0c380.d.cts → sqlite.d.cts} +24 -7
- package/dist/{index-C2z_XBn6.d.ts → sqlite.d.ts} +24 -7
- package/dist/sqlite.js +56 -0
- package/dist/sqlite3.cjs +240 -11
- package/dist/sqlite3.cjs.map +1 -1
- package/dist/sqlite3.d.cts +38 -18
- package/dist/sqlite3.d.ts +38 -18
- package/dist/sqlite3.js +251 -22
- package/dist/sqlite3.js.map +1 -1
- package/package.json +69 -29
- package/dist/chunk-A7TC7IOP.cjs +0 -55
- package/dist/chunk-A7TC7IOP.cjs.map +0 -1
- package/dist/chunk-F7JQ7BX7.js +0 -240
- package/dist/chunk-F7JQ7BX7.js.map +0 -1
- package/dist/chunk-I34X53VL.js +0 -688
- package/dist/chunk-I34X53VL.js.map +0 -1
- package/dist/chunk-ISNF6USX.cjs +0 -688
- package/dist/chunk-ISNF6USX.cjs.map +0 -1
- package/dist/chunk-IYEHOE4S.cjs +0 -405
- package/dist/chunk-IYEHOE4S.cjs.map +0 -1
- package/dist/chunk-L2YZQAG3.cjs +0 -240
- package/dist/chunk-L2YZQAG3.cjs.map +0 -1
- package/dist/chunk-N7RWT46K.js.map +0 -1
- package/dist/chunk-OJ34O3Q2.cjs.map +0 -1
- package/dist/chunk-TXSETOGH.js +0 -55
- package/dist/chunk-TXSETOGH.js.map +0 -1
- package/dist/chunk-XVV3OOQX.js.map +0 -1
- package/dist/d1.cjs +0 -277
- package/dist/d1.cjs.map +0 -1
- package/dist/d1.d.cts +0 -72
- package/dist/d1.d.ts +0 -72
- package/dist/d1.js +0 -277
- package/dist/d1.js.map +0 -1
- package/dist/pg-3ACXFMU4.cjs +0 -59
- package/dist/pg-3ACXFMU4.cjs.map +0 -1
- package/dist/pg-GHOW3XSG.js +0 -59
- package/dist/sqlite3-EEIKQCJR.js +0 -25
- package/dist/sqlite3-SE4DDYZE.cjs +0 -25
- package/dist/sqlite3-SE4DDYZE.cjs.map +0 -1
- /package/dist/{pg-GHOW3XSG.js.map → postgresql.js.map} +0 -0
- /package/dist/{sqlite3-EEIKQCJR.js.map → sqlite.js.map} +0 -0
|
@@ -1,3 +1,72 @@
|
|
|
1
|
+
type JSONSerializerOptions = {
|
|
2
|
+
parseDates?: boolean;
|
|
3
|
+
parseBigInts?: boolean;
|
|
4
|
+
failOnBigIntSerialization?: boolean;
|
|
5
|
+
useDefaultDateSerialization?: boolean;
|
|
6
|
+
};
|
|
7
|
+
type JSONSerializeOptions = {
|
|
8
|
+
replacer?: JSONReplacer;
|
|
9
|
+
} & JSONSerializerOptions;
|
|
10
|
+
type JSONDeserializeOptions = {
|
|
11
|
+
reviver?: JSONReviver;
|
|
12
|
+
} & JSONSerializerOptions;
|
|
13
|
+
type JSONCodecSerializationOptions<SerializeOptions extends JSONSerializeOptions = JSONSerializeOptions, DeserializeOptions extends JSONDeserializeOptions = JSONDeserializeOptions> = {
|
|
14
|
+
serializer?: JSONSerializer<SerializeOptions, DeserializeOptions>;
|
|
15
|
+
serializerOptions?: never;
|
|
16
|
+
} | {
|
|
17
|
+
serializer?: never;
|
|
18
|
+
serializerOptions?: JSONSerializerOptions;
|
|
19
|
+
};
|
|
20
|
+
type JSONSerializationOptions<SerializeOptions extends JSONSerializeOptions = JSONSerializeOptions, DeserializeOptions extends JSONDeserializeOptions = JSONDeserializeOptions> = {
|
|
21
|
+
serialization?: {
|
|
22
|
+
serializer?: JSONSerializer<SerializeOptions, DeserializeOptions>;
|
|
23
|
+
options?: JSONSerializeOptions | JSONDeserializeOptions;
|
|
24
|
+
} | undefined;
|
|
25
|
+
};
|
|
26
|
+
type JSONCodecOptions<T, Payload = T, SerializeOptions extends JSONSerializeOptions = JSONSerializeOptions, DeserializeOptions extends JSONDeserializeOptions = JSONDeserializeOptions> = JSONCodecSerializationOptions<SerializeOptions, DeserializeOptions> & {
|
|
27
|
+
upcast?: (document: Payload) => T;
|
|
28
|
+
downcast?: (document: T) => Payload;
|
|
29
|
+
};
|
|
30
|
+
type JSONReviverContext = {
|
|
31
|
+
source: string;
|
|
32
|
+
};
|
|
33
|
+
declare const composeJSONReplacers: (...replacers: (JSONReplacer | undefined)[]) => JSONReplacer | undefined;
|
|
34
|
+
declare const composeJSONRevivers: (...revivers: (JSONReviver | undefined)[]) => JSONReviver | undefined;
|
|
35
|
+
type JSONReplacer = (this: any, key: string, value: any) => any;
|
|
36
|
+
declare const JSONReplacer: (opts?: JSONSerializeOptions) => JSONReplacer | undefined;
|
|
37
|
+
type JSONReviver = (this: any, key: string, value: any, context: JSONReviverContext) => any;
|
|
38
|
+
declare const JSONReviver: (opts?: JSONDeserializeOptions) => JSONReviver | undefined;
|
|
39
|
+
declare const JSONReplacers: {
|
|
40
|
+
bigInt: JSONReplacer;
|
|
41
|
+
date: JSONReplacer;
|
|
42
|
+
};
|
|
43
|
+
declare const JSONRevivers: {
|
|
44
|
+
bigInt: JSONReviver;
|
|
45
|
+
date: JSONReviver;
|
|
46
|
+
};
|
|
47
|
+
declare const jsonSerializer: (options?: JSONSerializerOptions & JSONDeserializeOptions & JSONSerializeOptions) => JSONSerializer;
|
|
48
|
+
interface JSONSerializer<SerializeOptions extends JSONSerializeOptions = JSONSerializeOptions, DeserializeOptions extends JSONDeserializeOptions = JSONDeserializeOptions> extends Serializer<string, SerializeOptions, DeserializeOptions> {
|
|
49
|
+
serialize<T>(object: T, options?: SerializeOptions): string;
|
|
50
|
+
deserialize<T>(payload: string, options?: DeserializeOptions): T;
|
|
51
|
+
}
|
|
52
|
+
declare const JSONSerializer: JSONSerializer & {
|
|
53
|
+
from: <SerializeOptions extends JSONSerializeOptions = JSONSerializeOptions, DeserializeOptions extends JSONDeserializeOptions = JSONDeserializeOptions>(options?: JSONSerializationOptions<SerializeOptions, DeserializeOptions>) => JSONSerializer<SerializeOptions, DeserializeOptions>;
|
|
54
|
+
};
|
|
55
|
+
interface JSONCodec<T, SerializeOptions extends JSONSerializeOptions = JSONSerializeOptions, DeserializeOptions extends JSONDeserializeOptions = JSONDeserializeOptions> extends SerializationCodec<T, string, SerializeOptions, DeserializeOptions> {
|
|
56
|
+
encode(object: T, options?: SerializeOptions): string;
|
|
57
|
+
decode(payload: string, options?: DeserializeOptions): T;
|
|
58
|
+
}
|
|
59
|
+
declare const JSONCodec: <T, Payload = T, SerializeOptions extends JSONSerializeOptions = JSONSerializeOptions, DeserializeOptions extends JSONDeserializeOptions = JSONDeserializeOptions>(options: JSONCodecOptions<T, Payload, SerializeOptions, DeserializeOptions>) => JSONCodec<T, SerializeOptions, DeserializeOptions>;
|
|
60
|
+
|
|
61
|
+
interface Serializer<Payload, SerializeOptions extends Record<string, unknown> = Record<string, unknown>, DeserializeOptions extends Record<string, unknown> = SerializeOptions> {
|
|
62
|
+
serialize<T>(object: T, options?: SerializeOptions): Payload;
|
|
63
|
+
deserialize<T>(payload: Payload, options?: DeserializeOptions): T;
|
|
64
|
+
}
|
|
65
|
+
interface SerializationCodec<T, Payload, SerializeOptions extends Record<string, unknown> = Record<string, unknown>, DeserializeOptions extends Record<string, unknown> = SerializeOptions> {
|
|
66
|
+
encode(object: T, options?: SerializeOptions): Payload;
|
|
67
|
+
decode(payload: Payload, options?: DeserializeOptions): T;
|
|
68
|
+
}
|
|
69
|
+
|
|
1
70
|
interface ParametrizedSQL {
|
|
2
71
|
query: string;
|
|
3
72
|
params: unknown[];
|
|
@@ -49,22 +118,29 @@ declare const SQLLiteral: {
|
|
|
49
118
|
check: (token: unknown) => token is SQLLiteral;
|
|
50
119
|
type: "SQL_LITERAL";
|
|
51
120
|
};
|
|
121
|
+
type SQLArrayMode = 'params' | 'native';
|
|
52
122
|
type SQLArray = SQLToken<'SQL_ARRAY', {
|
|
53
123
|
value: unknown[];
|
|
124
|
+
mode?: SQLArrayMode;
|
|
54
125
|
}>;
|
|
55
126
|
declare const SQLArray: {
|
|
56
|
-
from: (input: unknown[]
|
|
127
|
+
from: (input: unknown[] | {
|
|
128
|
+
value: unknown[];
|
|
129
|
+
mode?: SQLArrayMode;
|
|
130
|
+
}) => SQLArray;
|
|
57
131
|
check: (token: unknown) => token is SQLArray;
|
|
58
132
|
type: "SQL_ARRAY";
|
|
59
133
|
};
|
|
60
134
|
type SQLIn = SQLToken<'SQL_IN', {
|
|
61
135
|
column: SQLIdentifier;
|
|
62
136
|
values: SQLArray;
|
|
137
|
+
mode?: SQLArrayMode;
|
|
63
138
|
}>;
|
|
64
139
|
declare const SQLIn: {
|
|
65
140
|
from: (input: {
|
|
66
141
|
column: string;
|
|
67
142
|
values: unknown[];
|
|
143
|
+
mode?: SQLArrayMode;
|
|
68
144
|
}) => SQLIn;
|
|
69
145
|
check: (token: unknown) => token is SQLIn;
|
|
70
146
|
type: "SQL_IN";
|
|
@@ -248,7 +324,7 @@ declare const SQLColumnToken: {
|
|
|
248
324
|
type: "SQL_COLUMN";
|
|
249
325
|
};
|
|
250
326
|
|
|
251
|
-
type MapSQLParamValue = (value: unknown, options?: MapSQLParamValueOptions) => unknown;
|
|
327
|
+
type MapSQLParamValue = (value: unknown, serializer: JSONSerializer, options?: MapSQLParamValueOptions) => unknown;
|
|
252
328
|
interface MapSQLParamValueOptions {
|
|
253
329
|
mapBoolean?: (value: boolean) => unknown;
|
|
254
330
|
mapArray?: (array: unknown[], mapValue: MapSQLParamValue) => unknown[];
|
|
@@ -283,12 +359,13 @@ interface SQLValueMapper {
|
|
|
283
359
|
mapIdentifier: (value: string) => string;
|
|
284
360
|
}
|
|
285
361
|
declare const SQLValueMapper: (options?: MapSQLParamValueOptions) => SQLValueMapper;
|
|
286
|
-
declare function mapSQLParamValue(value: unknown, options?: MapSQLParamValueOptions): unknown;
|
|
362
|
+
declare function mapSQLParamValue(value: unknown, serializer: JSONSerializer, options?: MapSQLParamValueOptions): unknown;
|
|
287
363
|
|
|
288
364
|
type SQLProcessorContext = {
|
|
289
365
|
mapper: SQLValueMapper;
|
|
290
366
|
builder: ParametrizedSQLBuilder;
|
|
291
367
|
processorsRegistry: SQLProcessorsReadonlyRegistry;
|
|
368
|
+
serializer: JSONSerializer;
|
|
292
369
|
};
|
|
293
370
|
type AnySQLProcessor = SQLProcessor<any>;
|
|
294
371
|
type SQLProcessorOptions<Token extends AnySQLToken = AnySQLToken> = {
|
|
@@ -328,7 +405,12 @@ declare namespace SQL {
|
|
|
328
405
|
export var merge: (sqls: SQL[], separator?: string) => SQL;
|
|
329
406
|
export var format: (sql: SQL | SQL[], formatter: SQLFormatter, options?: FormatSQLOptions) => ParametrizedSQL;
|
|
330
407
|
export var describe: (sql: SQL | SQL[], formatter: SQLFormatter, options?: FormatSQLOptions) => string;
|
|
331
|
-
var _a: (column: string, values: unknown[]
|
|
408
|
+
var _a: (column: string, values: unknown[], options?: {
|
|
409
|
+
mode?: SQLArrayMode;
|
|
410
|
+
}) => SQLIn;
|
|
411
|
+
export var array: (values: unknown[], options?: {
|
|
412
|
+
mode?: SQLArrayMode;
|
|
413
|
+
}) => SQLArray;
|
|
332
414
|
export var identifier: (input: string) => SQLIdentifier;
|
|
333
415
|
export var plain: (input: string) => SQLPlain;
|
|
334
416
|
export var check: {
|
|
@@ -348,19 +430,22 @@ declare namespace SQL {
|
|
|
348
430
|
};
|
|
349
431
|
export { _a as in };
|
|
350
432
|
}
|
|
433
|
+
declare function RawSQL(strings: TemplateStringsArray, ...values: unknown[]): SQL;
|
|
351
434
|
declare const isSQL: (value: unknown) => value is SQL;
|
|
352
435
|
|
|
436
|
+
type FormatContext = Partial<SQLProcessorContext> & Pick<SQLProcessorContext, 'serializer'>;
|
|
353
437
|
type FormatSQLOptions = {
|
|
354
438
|
mapper?: MapSQLParamValueOptions;
|
|
355
439
|
processorsRegistry?: SQLProcessorsReadonlyRegistry;
|
|
440
|
+
serializer?: JSONSerializer;
|
|
356
441
|
};
|
|
357
442
|
type SQLFormatterOptions = Partial<Omit<SQLFormatter, 'valueMapper'>> & {
|
|
358
443
|
valueMapper?: MapSQLParamValueOptions;
|
|
359
444
|
processorsRegistry?: SQLProcessorsReadonlyRegistry;
|
|
360
445
|
};
|
|
361
446
|
interface SQLFormatter {
|
|
362
|
-
format: (sql: SQL | SQL[], context
|
|
363
|
-
describe: (sql: SQL | SQL[], context
|
|
447
|
+
format: (sql: SQL | SQL[], context: FormatContext) => ParametrizedSQL;
|
|
448
|
+
describe: (sql: SQL | SQL[], context: FormatContext) => string;
|
|
364
449
|
valueMapper: SQLValueMapper;
|
|
365
450
|
}
|
|
366
451
|
declare const SQLFormatter: ({ format, describe, valueMapper: valueMapperOptions, processorsRegistry, }: SQLFormatterOptions) => SQLFormatter;
|
|
@@ -369,8 +454,8 @@ declare global {
|
|
|
369
454
|
}
|
|
370
455
|
declare const registerFormatter: (dialect: string, formatter: SQLFormatter) => void;
|
|
371
456
|
declare const getFormatter: (dialect: string) => SQLFormatter;
|
|
372
|
-
declare function formatSQL(sql: SQL | SQL[], formatter: SQLFormatter, context?: FormatSQLOptions): ParametrizedSQL;
|
|
373
|
-
declare const describeSQL: (sql: SQL | SQL[], formatter: SQLFormatter, options?: FormatSQLOptions) => string;
|
|
457
|
+
declare function formatSQL(sql: SQL | SQL[], formatter: SQLFormatter, serializer: JSONSerializer, context?: FormatSQLOptions): ParametrizedSQL;
|
|
458
|
+
declare const describeSQL: (sql: SQL | SQL[], formatter: SQLFormatter, serializer: JSONSerializer, options?: FormatSQLOptions) => string;
|
|
374
459
|
|
|
375
460
|
type MigrationStyle = 'None' | 'CreateOrUpdate';
|
|
376
461
|
type SQLMigration = {
|
|
@@ -833,6 +918,235 @@ type ValidateDatabaseSchemas<Schemas extends DatabaseSchemas> = MapRecordCollect
|
|
|
833
918
|
}> extends infer Results ? AnyTypeValidationFailed<Results> extends true ? TypeValidationError<UnwrapTypeValidationErrors<Results extends readonly AnyTypeValidationError[] ? Results : never>> : TypeValidationSuccess : TypeValidationSuccess;
|
|
834
919
|
type ValidateDatabaseSchemasWithMessages<Schemas extends DatabaseSchemas> = FormatValidationErrors<ValidateDatabaseSchemas<Schemas>>;
|
|
835
920
|
|
|
921
|
+
declare class DumboError extends Error {
|
|
922
|
+
static readonly ErrorCode: number;
|
|
923
|
+
static readonly ErrorType: string;
|
|
924
|
+
errorCode: number;
|
|
925
|
+
errorType: string;
|
|
926
|
+
innerError: Error | undefined;
|
|
927
|
+
constructor(options?: {
|
|
928
|
+
errorCode: number;
|
|
929
|
+
errorType?: string;
|
|
930
|
+
message?: string | undefined;
|
|
931
|
+
innerError?: Error | undefined;
|
|
932
|
+
} | string | number);
|
|
933
|
+
static isInstanceOf<ErrorType extends DumboError = DumboError>(error: unknown, options?: {
|
|
934
|
+
errorCode?: number;
|
|
935
|
+
errorType?: string;
|
|
936
|
+
}): error is ErrorType;
|
|
937
|
+
}
|
|
938
|
+
declare class ConcurrencyError extends DumboError {
|
|
939
|
+
static readonly ErrorCode: number;
|
|
940
|
+
static readonly ErrorType: string;
|
|
941
|
+
constructor(message?: string, innerError?: Error);
|
|
942
|
+
}
|
|
943
|
+
declare class TransientDatabaseError extends DumboError {
|
|
944
|
+
static readonly ErrorCode: number;
|
|
945
|
+
static readonly ErrorType: string;
|
|
946
|
+
constructor(message?: string, innerError?: Error);
|
|
947
|
+
}
|
|
948
|
+
declare class ConnectionError extends TransientDatabaseError {
|
|
949
|
+
static readonly ErrorCode: number;
|
|
950
|
+
static readonly ErrorType: string;
|
|
951
|
+
constructor(message?: string, innerError?: Error);
|
|
952
|
+
}
|
|
953
|
+
declare class SerializationError extends TransientDatabaseError {
|
|
954
|
+
static readonly ErrorCode: number;
|
|
955
|
+
static readonly ErrorType: string;
|
|
956
|
+
constructor(message?: string, innerError?: Error);
|
|
957
|
+
}
|
|
958
|
+
declare class DeadlockError extends TransientDatabaseError {
|
|
959
|
+
static readonly ErrorCode: number;
|
|
960
|
+
static readonly ErrorType: string;
|
|
961
|
+
constructor(message?: string, innerError?: Error);
|
|
962
|
+
}
|
|
963
|
+
declare class LockNotAvailableError extends TransientDatabaseError {
|
|
964
|
+
static readonly ErrorCode: number;
|
|
965
|
+
static readonly ErrorType: string;
|
|
966
|
+
constructor(message?: string, innerError?: Error);
|
|
967
|
+
}
|
|
968
|
+
declare class InsufficientResourcesError extends TransientDatabaseError {
|
|
969
|
+
static readonly ErrorCode: number;
|
|
970
|
+
static readonly ErrorType: string;
|
|
971
|
+
constructor(message?: string, innerError?: Error);
|
|
972
|
+
}
|
|
973
|
+
declare class SystemError extends TransientDatabaseError {
|
|
974
|
+
static readonly ErrorCode: number;
|
|
975
|
+
static readonly ErrorType: string;
|
|
976
|
+
constructor(message?: string, innerError?: Error);
|
|
977
|
+
}
|
|
978
|
+
declare class AdminShutdownError extends TransientDatabaseError {
|
|
979
|
+
static readonly ErrorCode: number;
|
|
980
|
+
static readonly ErrorType: string;
|
|
981
|
+
constructor(message?: string, innerError?: Error);
|
|
982
|
+
}
|
|
983
|
+
declare class QueryCanceledError extends TransientDatabaseError {
|
|
984
|
+
static readonly ErrorCode: number;
|
|
985
|
+
static readonly ErrorType: string;
|
|
986
|
+
constructor(message?: string, innerError?: Error);
|
|
987
|
+
}
|
|
988
|
+
declare class IntegrityConstraintViolationError extends DumboError {
|
|
989
|
+
static readonly ErrorCode: number;
|
|
990
|
+
static readonly ErrorType: string;
|
|
991
|
+
constructor(message?: string, innerError?: Error);
|
|
992
|
+
}
|
|
993
|
+
declare class UniqueConstraintError extends IntegrityConstraintViolationError {
|
|
994
|
+
static readonly ErrorCode: number;
|
|
995
|
+
static readonly ErrorType: string;
|
|
996
|
+
constructor(message?: string, innerError?: Error);
|
|
997
|
+
}
|
|
998
|
+
declare class ForeignKeyViolationError extends IntegrityConstraintViolationError {
|
|
999
|
+
static readonly ErrorCode: number;
|
|
1000
|
+
static readonly ErrorType: string;
|
|
1001
|
+
constructor(message?: string, innerError?: Error);
|
|
1002
|
+
}
|
|
1003
|
+
declare class NotNullViolationError extends IntegrityConstraintViolationError {
|
|
1004
|
+
static readonly ErrorCode: number;
|
|
1005
|
+
static readonly ErrorType: string;
|
|
1006
|
+
constructor(message?: string, innerError?: Error);
|
|
1007
|
+
}
|
|
1008
|
+
declare class CheckViolationError extends IntegrityConstraintViolationError {
|
|
1009
|
+
static readonly ErrorCode: number;
|
|
1010
|
+
static readonly ErrorType: string;
|
|
1011
|
+
constructor(message?: string, innerError?: Error);
|
|
1012
|
+
}
|
|
1013
|
+
declare class ExclusionViolationError extends IntegrityConstraintViolationError {
|
|
1014
|
+
static readonly ErrorCode: number;
|
|
1015
|
+
static readonly ErrorType: string;
|
|
1016
|
+
constructor(message?: string, innerError?: Error);
|
|
1017
|
+
}
|
|
1018
|
+
declare class DataError extends DumboError {
|
|
1019
|
+
static readonly ErrorCode: number;
|
|
1020
|
+
static readonly ErrorType: string;
|
|
1021
|
+
constructor(message?: string, innerError?: Error);
|
|
1022
|
+
}
|
|
1023
|
+
declare class InvalidOperationError extends DumboError {
|
|
1024
|
+
static readonly ErrorCode: number;
|
|
1025
|
+
static readonly ErrorType: string;
|
|
1026
|
+
constructor(message?: string, innerError?: Error);
|
|
1027
|
+
}
|
|
1028
|
+
|
|
1029
|
+
interface QueryResultRow {
|
|
1030
|
+
[column: string]: any;
|
|
1031
|
+
}
|
|
1032
|
+
type QueryResult<Result extends QueryResultRow = QueryResultRow> = {
|
|
1033
|
+
rowCount: number | null;
|
|
1034
|
+
rows: Result[];
|
|
1035
|
+
};
|
|
1036
|
+
|
|
1037
|
+
declare const mapColumnToJSON: (column: string, serializer: JSONSerializer, options?: JSONDeserializeOptions) => {
|
|
1038
|
+
[x: string]: (value: unknown) => unknown;
|
|
1039
|
+
};
|
|
1040
|
+
declare const mapColumnToBigint: (column: string) => {
|
|
1041
|
+
[x: string]: (value: unknown) => unknown;
|
|
1042
|
+
};
|
|
1043
|
+
declare const mapColumnToDate: (column: string) => {
|
|
1044
|
+
[x: string]: (value: unknown) => unknown;
|
|
1045
|
+
};
|
|
1046
|
+
declare const mapSQLQueryResult: <T>(result: T, mapping: SQLQueryResultColumnMapping) => T;
|
|
1047
|
+
type SQLQueryResultColumnMapping = {
|
|
1048
|
+
[column: string]: (value: unknown) => unknown;
|
|
1049
|
+
};
|
|
1050
|
+
type SQLQueryOptions = {
|
|
1051
|
+
timeoutMs?: number | undefined;
|
|
1052
|
+
mapping?: SQLQueryResultColumnMapping;
|
|
1053
|
+
};
|
|
1054
|
+
type SQLCommandOptions = {
|
|
1055
|
+
timeoutMs?: number | undefined;
|
|
1056
|
+
mapping?: SQLQueryResultColumnMapping;
|
|
1057
|
+
};
|
|
1058
|
+
type BatchSQLCommandOptions = SQLCommandOptions & {
|
|
1059
|
+
assertChanges?: boolean;
|
|
1060
|
+
};
|
|
1061
|
+
declare class BatchCommandNoChangesError extends DumboError {
|
|
1062
|
+
readonly statementIndex: number;
|
|
1063
|
+
constructor(statementIndex: number);
|
|
1064
|
+
}
|
|
1065
|
+
type DbSQLExecutorOptions = {
|
|
1066
|
+
serializer: JSONSerializer;
|
|
1067
|
+
};
|
|
1068
|
+
interface DbSQLExecutor<DriverType extends DatabaseDriverType = DatabaseDriverType, DbClient = unknown> {
|
|
1069
|
+
driverType: DriverType;
|
|
1070
|
+
query<Result extends QueryResultRow = QueryResultRow>(client: DbClient, sql: SQL, options?: SQLQueryOptions): Promise<QueryResult<Result>>;
|
|
1071
|
+
batchQuery<Result extends QueryResultRow = QueryResultRow>(client: DbClient, sqls: SQL[], options?: SQLQueryOptions): Promise<QueryResult<Result>[]>;
|
|
1072
|
+
command<Result extends QueryResultRow = QueryResultRow>(client: DbClient, sql: SQL, options?: SQLCommandOptions): Promise<QueryResult<Result>>;
|
|
1073
|
+
batchCommand<Result extends QueryResultRow = QueryResultRow>(client: DbClient, sqls: SQL[], options?: BatchSQLCommandOptions): Promise<QueryResult<Result>[]>;
|
|
1074
|
+
formatter: SQLFormatter;
|
|
1075
|
+
}
|
|
1076
|
+
interface SQLExecutor {
|
|
1077
|
+
query<Result extends QueryResultRow = QueryResultRow>(sql: SQL, options?: SQLQueryOptions): Promise<QueryResult<Result>>;
|
|
1078
|
+
batchQuery<Result extends QueryResultRow = QueryResultRow>(sqls: SQL[], options?: SQLQueryOptions): Promise<QueryResult<Result>[]>;
|
|
1079
|
+
command<Result extends QueryResultRow = QueryResultRow>(sql: SQL, options?: SQLCommandOptions): Promise<QueryResult<Result>>;
|
|
1080
|
+
batchCommand<Result extends QueryResultRow = QueryResultRow>(sqls: SQL[], options?: BatchSQLCommandOptions): Promise<QueryResult<Result>[]>;
|
|
1081
|
+
}
|
|
1082
|
+
interface WithSQLExecutor {
|
|
1083
|
+
execute: SQLExecutor;
|
|
1084
|
+
}
|
|
1085
|
+
declare const sqlExecutor: <DbClient = unknown, DbExecutor extends DbSQLExecutor = DbSQLExecutor>(sqlExecutor: DbExecutor, options: {
|
|
1086
|
+
connect: () => Promise<DbClient>;
|
|
1087
|
+
close?: (client: DbClient, error?: unknown) => Promise<void>;
|
|
1088
|
+
}) => SQLExecutor;
|
|
1089
|
+
declare const sqlExecutorInNewConnection: <ConnectionType extends Connection>(options: {
|
|
1090
|
+
driverType: ConnectionType["driverType"];
|
|
1091
|
+
connection: () => Promise<ConnectionType>;
|
|
1092
|
+
}) => SQLExecutor;
|
|
1093
|
+
declare const sqlExecutorInAmbientConnection: <ConnectionType extends Connection>(options: {
|
|
1094
|
+
driverType: ConnectionType["driverType"];
|
|
1095
|
+
connection: () => Promise<ConnectionType>;
|
|
1096
|
+
}) => SQLExecutor;
|
|
1097
|
+
declare const executeInNewDbClient: <DbClient = unknown, Result = unknown>(handle: (client: DbClient) => Promise<Result>, options: {
|
|
1098
|
+
connect: () => Promise<DbClient>;
|
|
1099
|
+
close?: (client: DbClient, error?: unknown) => Promise<void>;
|
|
1100
|
+
}) => Promise<Result>;
|
|
1101
|
+
declare const executeInNewConnection: <ConnectionType extends Connection, Result>(handle: (connection: ConnectionType) => Promise<Result>, options: {
|
|
1102
|
+
connection: () => Promise<ConnectionType>;
|
|
1103
|
+
}) => Promise<Result>;
|
|
1104
|
+
declare const executeInAmbientConnection: <ConnectionType extends Connection, Result>(handle: (connection: ConnectionType) => Promise<Result>, options: {
|
|
1105
|
+
connection: () => Promise<ConnectionType>;
|
|
1106
|
+
}) => Promise<Result>;
|
|
1107
|
+
|
|
1108
|
+
interface DatabaseCapabilities<SupportsMultipleDatabases extends boolean, SupportsSchemas extends boolean, SupportsFunctions extends boolean> {
|
|
1109
|
+
readonly supportsMultipleDatabases: SupportsMultipleDatabases;
|
|
1110
|
+
readonly supportsSchemas: SupportsSchemas;
|
|
1111
|
+
readonly supportsFunctions: SupportsFunctions;
|
|
1112
|
+
}
|
|
1113
|
+
type DatabaseMetadata<SupportsMultipleDatabases extends boolean = boolean, SupportsSchemas extends boolean = boolean, SupportsFunctions extends boolean = boolean> = {
|
|
1114
|
+
readonly databaseType: DatabaseType;
|
|
1115
|
+
readonly capabilities: DatabaseCapabilities<SupportsMultipleDatabases, SupportsSchemas, SupportsFunctions>;
|
|
1116
|
+
readonly tableExists: (pool: SQLExecutor, tableName: string) => Promise<boolean>;
|
|
1117
|
+
} & (SupportsMultipleDatabases extends true ? {
|
|
1118
|
+
readonly defaultDatabaseName: string;
|
|
1119
|
+
readonly parseDatabaseName: (connectionString?: string) => string | undefined;
|
|
1120
|
+
} : {
|
|
1121
|
+
readonly defaultDatabaseName?: never;
|
|
1122
|
+
readonly parseDatabaseName?: never;
|
|
1123
|
+
}) & (SupportsFunctions extends true ? {
|
|
1124
|
+
readonly functionExists: (pool: SQLExecutor, functionName: string) => Promise<boolean>;
|
|
1125
|
+
} : {
|
|
1126
|
+
readonly functionExists?: (pool: SQLExecutor, functionName: string) => Promise<boolean>;
|
|
1127
|
+
});
|
|
1128
|
+
declare const DumboDatabaseMetadataRegistry: () => {
|
|
1129
|
+
register: (databaseType: DatabaseType, info: DatabaseMetadata | (() => Promise<DatabaseMetadata>)) => void;
|
|
1130
|
+
tryResolve: (databaseType: DatabaseType) => Promise<DatabaseMetadata | null>;
|
|
1131
|
+
tryGet: (databaseType: DatabaseType) => DatabaseMetadata | null;
|
|
1132
|
+
has: (databaseType: DatabaseType) => boolean;
|
|
1133
|
+
readonly databaseTypes: DatabaseType[];
|
|
1134
|
+
};
|
|
1135
|
+
declare global {
|
|
1136
|
+
var dumboDatabaseMetadataRegistry: ReturnType<typeof DumboDatabaseMetadataRegistry>;
|
|
1137
|
+
}
|
|
1138
|
+
declare const dumboDatabaseMetadataRegistry: {
|
|
1139
|
+
register: (databaseType: DatabaseType, info: DatabaseMetadata | (() => Promise<DatabaseMetadata>)) => void;
|
|
1140
|
+
tryResolve: (databaseType: DatabaseType) => Promise<DatabaseMetadata | null>;
|
|
1141
|
+
tryGet: (databaseType: DatabaseType) => DatabaseMetadata | null;
|
|
1142
|
+
has: (databaseType: DatabaseType) => boolean;
|
|
1143
|
+
readonly databaseTypes: DatabaseType[];
|
|
1144
|
+
};
|
|
1145
|
+
declare const getDatabaseMetadata: (driverType: DatabaseDriverType) => DatabaseMetadata | null;
|
|
1146
|
+
declare const resolveDatabaseMetadata: (driverType: DatabaseDriverType, driverOverride?: DatabaseMetadata) => Promise<DatabaseMetadata | null>;
|
|
1147
|
+
declare const getDefaultDatabase: (driverType: DatabaseDriverType) => string | undefined;
|
|
1148
|
+
declare const getDefaultDatabaseAsync: (driverType: DatabaseDriverType) => Promise<string | undefined>;
|
|
1149
|
+
|
|
836
1150
|
declare const DEFAULT_DATABASE_SCHEMA_NAME = "__default_database_schema__";
|
|
837
1151
|
declare function dumboDatabaseSchema<const Tables extends DatabaseSchemaTables = DatabaseSchemaTables>(tables: Tables): DatabaseSchemaSchemaComponent<Tables, typeof DEFAULT_DATABASE_SCHEMA_NAME>;
|
|
838
1152
|
declare function dumboDatabaseSchema<const Tables extends DatabaseSchemaTables = DatabaseSchemaTables, const SchemaName extends string = string>(schemaName: SchemaName, tables: Tables, options?: SchemaComponentOptions): DatabaseSchemaSchemaComponent<Tables, SchemaName>;
|
|
@@ -956,15 +1270,21 @@ type MigratorOptions = {
|
|
|
956
1270
|
options?: Omit<DatabaseLockOptions, 'lockId'> & Partial<Pick<DatabaseLockOptions, 'lockId'>>;
|
|
957
1271
|
};
|
|
958
1272
|
dryRun?: boolean | undefined;
|
|
1273
|
+
ignoreMigrationHashMismatch?: boolean | undefined;
|
|
1274
|
+
migrationTimeoutMs?: number | undefined;
|
|
959
1275
|
};
|
|
960
|
-
|
|
1276
|
+
type RunSQLMigrationsResult = {
|
|
1277
|
+
applied: SQLMigration[];
|
|
1278
|
+
skipped: SQLMigration[];
|
|
1279
|
+
};
|
|
1280
|
+
declare const runSQLMigrations: (pool: Dumbo, migrations: ReadonlyArray<SQLMigration>, partialOptions?: Partial<MigratorOptions>) => Promise<RunSQLMigrationsResult>;
|
|
961
1281
|
declare const combineMigrations: (...migration: Pick<SQLMigration, "sqls">[]) => SQL[];
|
|
962
1282
|
|
|
963
1283
|
interface DumboDatabaseDriver<ConnectionType extends AnyConnection = AnyConnection, DriverOptions extends unknown = unknown, DumboType extends Dumbo<ConnectionType['driverType'], ConnectionType> = Dumbo<ConnectionType['driverType'], ConnectionType>> {
|
|
964
1284
|
readonly driverType: ConnectionType['driverType'];
|
|
965
1285
|
readonly sqlFormatter: SQLFormatter;
|
|
966
1286
|
readonly defaultMigratorOptions: MigratorOptions;
|
|
967
|
-
|
|
1287
|
+
readonly databaseMetadata: DatabaseMetadata;
|
|
968
1288
|
createPool(options: DumboConnectionOptions<this>): DumboType;
|
|
969
1289
|
canHandle(options: DumboConnectionOptions<this>): boolean;
|
|
970
1290
|
}
|
|
@@ -1018,120 +1338,6 @@ declare function getDatabaseDriverName<T extends DatabaseType>(databaseDriverTyp
|
|
|
1018
1338
|
*/
|
|
1019
1339
|
declare function getDatabaseType<T extends DatabaseType>(databaseDriverType: DatabaseDriverType<T>): DatabaseType;
|
|
1020
1340
|
|
|
1021
|
-
interface QueryResultRow {
|
|
1022
|
-
[column: string]: any;
|
|
1023
|
-
}
|
|
1024
|
-
type QueryResult<Result extends QueryResultRow = QueryResultRow> = {
|
|
1025
|
-
rowCount: number | null;
|
|
1026
|
-
rows: Result[];
|
|
1027
|
-
};
|
|
1028
|
-
|
|
1029
|
-
type JSONSerializerOptions = {
|
|
1030
|
-
disableBigIntSerialization?: boolean;
|
|
1031
|
-
};
|
|
1032
|
-
type JSONSerializeOptions = {
|
|
1033
|
-
replacer?: JSONReplacer;
|
|
1034
|
-
} & JSONSerializerOptions;
|
|
1035
|
-
type JSONDeserializeOptions = {
|
|
1036
|
-
reviver?: JSONReviver;
|
|
1037
|
-
} & JSONSerializerOptions;
|
|
1038
|
-
type JSONObjectCodecOptions<SerializeOptions = JSONSerializeOptions, DeserializeOptions = JSONDeserializeOptions> = {
|
|
1039
|
-
serializer?: JSONSerializer<SerializeOptions, DeserializeOptions>;
|
|
1040
|
-
} | {
|
|
1041
|
-
serializerOptions?: JSONSerializerOptions;
|
|
1042
|
-
};
|
|
1043
|
-
declare const composeJSONReplacers: (...replacers: JSONReplacer[]) => JSONReplacer;
|
|
1044
|
-
declare const composeJSONRevivers: (...revivers: JSONReviver[]) => JSONReviver;
|
|
1045
|
-
type JSONReplacer = (this: any, key: string, value: any) => any;
|
|
1046
|
-
declare const JSONReplacer: (opts?: JSONSerializeOptions) => JSONReplacer | undefined;
|
|
1047
|
-
type JSONReviver = (this: any, key: string, value: any) => any;
|
|
1048
|
-
declare const JSONReviver: (opts?: JSONDeserializeOptions) => JSONReviver | undefined;
|
|
1049
|
-
declare const JSONReplacers: {
|
|
1050
|
-
bigInt: JSONReplacer;
|
|
1051
|
-
};
|
|
1052
|
-
declare const JSONRevivers: {
|
|
1053
|
-
bigInt: JSONReviver;
|
|
1054
|
-
};
|
|
1055
|
-
declare const jsonSerializer: (options?: JSONSerializerOptions) => JSONSerializer;
|
|
1056
|
-
interface JSONSerializer<SerializeOptions = JSONSerializeOptions, DeserializeOptions = JSONDeserializeOptions> extends Serializer<string, SerializeOptions, DeserializeOptions> {
|
|
1057
|
-
serialize<T>(object: T, options?: SerializeOptions): string;
|
|
1058
|
-
deserialize<T>(payload: string, options?: DeserializeOptions): T;
|
|
1059
|
-
}
|
|
1060
|
-
declare const JSONSerializer: JSONSerializer<JSONSerializeOptions, JSONDeserializeOptions>;
|
|
1061
|
-
declare const RawJSONSerializer: JSONSerializer<JSONSerializeOptions, JSONDeserializeOptions>;
|
|
1062
|
-
interface JSONObjectCodec<T, SerializeOptions = JSONSerializeOptions, DeserializeOptions = JSONDeserializeOptions> extends ObjectCodec<T, string> {
|
|
1063
|
-
encode(object: T, options?: SerializeOptions): string;
|
|
1064
|
-
decode(payload: string, options?: DeserializeOptions): T;
|
|
1065
|
-
}
|
|
1066
|
-
declare const JSONObjectCodec: <T, SerializeOptions = JSONSerializeOptions, DeserializeOptions = JSONDeserializeOptions>(options: JSONObjectCodecOptions<SerializeOptions, DeserializeOptions>) => JSONObjectCodec<T, SerializeOptions, DeserializeOptions>;
|
|
1067
|
-
|
|
1068
|
-
interface Serializer<Payload, SerializeOptions = never, DeserializeOptions = SerializeOptions> {
|
|
1069
|
-
serialize<T>(object: T, options?: SerializeOptions): Payload;
|
|
1070
|
-
deserialize<T>(payload: Payload, options?: DeserializeOptions): T;
|
|
1071
|
-
}
|
|
1072
|
-
interface ObjectCodec<T, Payload> {
|
|
1073
|
-
encode(object: T): Payload;
|
|
1074
|
-
decode(payload: Payload): T;
|
|
1075
|
-
}
|
|
1076
|
-
|
|
1077
|
-
declare const mapColumnToJSON: (column: string, options?: JSONDeserializeOptions) => {
|
|
1078
|
-
[x: string]: (value: unknown) => unknown;
|
|
1079
|
-
};
|
|
1080
|
-
declare const mapColumnToBigint: (column: string) => {
|
|
1081
|
-
[x: string]: (value: unknown) => unknown;
|
|
1082
|
-
};
|
|
1083
|
-
declare const mapSQLQueryResult: <T>(result: T, mapping: SQLQueryResultColumnMapping) => T;
|
|
1084
|
-
type SQLQueryResultColumnMapping = {
|
|
1085
|
-
[column: string]: (value: unknown) => unknown;
|
|
1086
|
-
};
|
|
1087
|
-
type SQLQueryOptions = {
|
|
1088
|
-
timeoutMs?: number;
|
|
1089
|
-
mapping?: SQLQueryResultColumnMapping;
|
|
1090
|
-
};
|
|
1091
|
-
type SQLCommandOptions = {
|
|
1092
|
-
timeoutMs?: number;
|
|
1093
|
-
mapping?: SQLQueryResultColumnMapping;
|
|
1094
|
-
};
|
|
1095
|
-
interface DbSQLExecutor<DriverType extends DatabaseDriverType = DatabaseDriverType, DbClient = unknown> {
|
|
1096
|
-
driverType: DriverType;
|
|
1097
|
-
query<Result extends QueryResultRow = QueryResultRow>(client: DbClient, sql: SQL, options?: SQLQueryOptions): Promise<QueryResult<Result>>;
|
|
1098
|
-
batchQuery<Result extends QueryResultRow = QueryResultRow>(client: DbClient, sqls: SQL[], options?: SQLQueryOptions): Promise<QueryResult<Result>[]>;
|
|
1099
|
-
command<Result extends QueryResultRow = QueryResultRow>(client: DbClient, sql: SQL, options?: SQLCommandOptions): Promise<QueryResult<Result>>;
|
|
1100
|
-
batchCommand<Result extends QueryResultRow = QueryResultRow>(client: DbClient, sqls: SQL[], options?: SQLCommandOptions): Promise<QueryResult<Result>[]>;
|
|
1101
|
-
formatter: SQLFormatter;
|
|
1102
|
-
}
|
|
1103
|
-
interface SQLExecutor {
|
|
1104
|
-
query<Result extends QueryResultRow = QueryResultRow>(sql: SQL, options?: SQLQueryOptions): Promise<QueryResult<Result>>;
|
|
1105
|
-
batchQuery<Result extends QueryResultRow = QueryResultRow>(sqls: SQL[], options?: SQLQueryOptions): Promise<QueryResult<Result>[]>;
|
|
1106
|
-
command<Result extends QueryResultRow = QueryResultRow>(sql: SQL, options?: SQLCommandOptions): Promise<QueryResult<Result>>;
|
|
1107
|
-
batchCommand<Result extends QueryResultRow = QueryResultRow>(sqls: SQL[], options?: SQLCommandOptions): Promise<QueryResult<Result>[]>;
|
|
1108
|
-
}
|
|
1109
|
-
interface WithSQLExecutor {
|
|
1110
|
-
execute: SQLExecutor;
|
|
1111
|
-
}
|
|
1112
|
-
declare const sqlExecutor: <DbClient = unknown, DbExecutor extends DbSQLExecutor = DbSQLExecutor>(sqlExecutor: DbExecutor, options: {
|
|
1113
|
-
connect: () => Promise<DbClient>;
|
|
1114
|
-
close?: (client: DbClient, error?: unknown) => Promise<void>;
|
|
1115
|
-
}) => SQLExecutor;
|
|
1116
|
-
declare const sqlExecutorInNewConnection: <ConnectionType extends Connection>(options: {
|
|
1117
|
-
driverType: ConnectionType["driverType"];
|
|
1118
|
-
connection: () => Promise<ConnectionType>;
|
|
1119
|
-
}) => SQLExecutor;
|
|
1120
|
-
declare const sqlExecutorInAmbientConnection: <ConnectionType extends Connection>(options: {
|
|
1121
|
-
driverType: ConnectionType["driverType"];
|
|
1122
|
-
connection: () => Promise<ConnectionType>;
|
|
1123
|
-
}) => SQLExecutor;
|
|
1124
|
-
declare const executeInNewDbClient: <DbClient = unknown, Result = unknown>(handle: (client: DbClient) => Promise<Result>, options: {
|
|
1125
|
-
connect: () => Promise<DbClient>;
|
|
1126
|
-
close?: (client: DbClient, error?: unknown) => Promise<void>;
|
|
1127
|
-
}) => Promise<Result>;
|
|
1128
|
-
declare const executeInNewConnection: <ConnectionType extends Connection, Result>(handle: (connection: ConnectionType) => Promise<Result>, options: {
|
|
1129
|
-
connection: () => Promise<ConnectionType>;
|
|
1130
|
-
}) => Promise<Result>;
|
|
1131
|
-
declare const executeInAmbientConnection: <ConnectionType extends Connection, Result>(handle: (connection: ConnectionType) => Promise<Result>, options: {
|
|
1132
|
-
connection: () => Promise<ConnectionType>;
|
|
1133
|
-
}) => Promise<Result>;
|
|
1134
|
-
|
|
1135
1341
|
interface DatabaseTransaction<ConnectionType extends AnyConnection = AnyConnection> extends WithSQLExecutor {
|
|
1136
1342
|
driverType: ConnectionType['driverType'];
|
|
1137
1343
|
connection: ConnectionType;
|
|
@@ -1185,13 +1391,15 @@ type CreateConnectionOptions<ConnectionType extends AnyConnection = AnyConnectio
|
|
|
1185
1391
|
connect: () => Promise<InferDbClientFromConnection<ConnectionType>>;
|
|
1186
1392
|
close: (client: InferDbClientFromConnection<ConnectionType>) => Promise<void>;
|
|
1187
1393
|
initTransaction: InitTransaction<ConnectionType, TransactionType, TransactionOptionsType>;
|
|
1188
|
-
|
|
1394
|
+
serializer: JSONSerializer;
|
|
1395
|
+
executor: (options: DbSQLExecutorOptions) => Executor;
|
|
1189
1396
|
};
|
|
1190
1397
|
type CreateAmbientConnectionOptions<ConnectionType extends AnyConnection = AnyConnection, Executor extends DbSQLExecutor = DbSQLExecutor, TransactionType extends DatabaseTransaction<ConnectionType> = DatabaseTransaction<ConnectionType>, TransactionOptionsType extends DatabaseTransactionOptions = DatabaseTransactionOptions> = {
|
|
1191
1398
|
driverType: InferDriverTypeFromConnection<ConnectionType>;
|
|
1192
1399
|
client: InferDbClientFromConnection<ConnectionType>;
|
|
1400
|
+
serializer: JSONSerializer;
|
|
1193
1401
|
initTransaction: InitTransaction<ConnectionType, TransactionType, TransactionOptionsType>;
|
|
1194
|
-
executor: () => Executor;
|
|
1402
|
+
executor: (options: DbSQLExecutorOptions) => Executor;
|
|
1195
1403
|
};
|
|
1196
1404
|
declare const createAmbientConnection: <ConnectionType extends AnyConnection = AnyConnection, Executor extends DbSQLExecutor = DbSQLExecutor, TransactionType extends DatabaseTransaction<ConnectionType> = DatabaseTransaction<ConnectionType>>(options: CreateAmbientConnectionOptions<ConnectionType, Executor, TransactionType>) => ConnectionType;
|
|
1197
1405
|
type CreateSingletonConnectionOptions<ConnectionType extends AnyConnection = AnyConnection, Executor extends DbSQLExecutor = DbSQLExecutor, TransactionType extends DatabaseTransaction<ConnectionType> = DatabaseTransaction<ConnectionType>, TransactionOptionsType extends DatabaseTransactionOptions = DatabaseTransactionOptions> = {
|
|
@@ -1199,7 +1407,8 @@ type CreateSingletonConnectionOptions<ConnectionType extends AnyConnection = Any
|
|
|
1199
1407
|
connect: () => Promise<InferDbClientFromConnection<ConnectionType>>;
|
|
1200
1408
|
close: (client: InferDbClientFromConnection<ConnectionType>) => Promise<void>;
|
|
1201
1409
|
initTransaction: InitTransaction<ConnectionType, TransactionType, TransactionOptionsType>;
|
|
1202
|
-
|
|
1410
|
+
serializer: JSONSerializer;
|
|
1411
|
+
executor: (options: DbSQLExecutorOptions) => Executor;
|
|
1203
1412
|
};
|
|
1204
1413
|
declare const createSingletonConnection: <ConnectionType extends AnyConnection = AnyConnection, Executor extends DbSQLExecutor = DbSQLExecutor, TransactionType extends DatabaseTransaction<ConnectionType> = DatabaseTransaction<ConnectionType>>(options: CreateSingletonConnectionOptions<ConnectionType, Executor, TransactionType>) => ConnectionType;
|
|
1205
1414
|
type CreateTransientConnectionOptions<ConnectionType extends AnyConnection = AnyConnection, Executor extends DbSQLExecutor = DbSQLExecutor, TransactionType extends DatabaseTransaction<ConnectionType> = DatabaseTransaction<ConnectionType>, TransactionOptionsType extends DatabaseTransactionOptions = DatabaseTransactionOptions> = {
|
|
@@ -1207,7 +1416,8 @@ type CreateTransientConnectionOptions<ConnectionType extends AnyConnection = Any
|
|
|
1207
1416
|
open: () => Promise<InferDbClientFromConnection<ConnectionType>>;
|
|
1208
1417
|
close: () => Promise<void>;
|
|
1209
1418
|
initTransaction: InitTransaction<ConnectionType, TransactionType, TransactionOptionsType>;
|
|
1210
|
-
|
|
1419
|
+
serializer: JSONSerializer;
|
|
1420
|
+
executor: (options: DbSQLExecutorOptions) => Executor;
|
|
1211
1421
|
};
|
|
1212
1422
|
declare const createTransientConnection: <ConnectionType extends AnyConnection = AnyConnection, Executor extends DbSQLExecutor = DbSQLExecutor, TransactionType extends DatabaseTransaction<ConnectionType> = DatabaseTransaction<ConnectionType>>(options: CreateTransientConnectionOptions<ConnectionType, Executor, TransactionType>) => ConnectionType;
|
|
1213
1423
|
declare const createConnection: <ConnectionType extends AnyConnection = AnyConnection, Executor extends DbSQLExecutor = DbSQLExecutor, TransactionType extends DatabaseTransaction<ConnectionType> = DatabaseTransaction<ConnectionType>>(options: CreateConnectionOptions<ConnectionType, Executor, TransactionType>) => ConnectionType;
|
|
@@ -1268,4 +1478,4 @@ type DatabaseConnectionString<DatabaseTypeName extends DatabaseType = DatabaseTy
|
|
|
1268
1478
|
};
|
|
1269
1479
|
declare const parseConnectionString: (connectionString: DatabaseConnectionString | string) => DatabaseDriverTypeParts;
|
|
1270
1480
|
|
|
1271
|
-
export {
|
|
1481
|
+
export { createTransientConnection as $, type AnyConnection as A, type TypeValidationSuccess as B, type Connection as C, type DefaultSQLColumnToken as D, type AnyDumboDatabaseDriver as E, type ExtractDumboDatabaseDriverOptions as F, type ExtractDumboTypeFromDriver as G, type InferDriverTypeFromConnection as H, IndexURN as I, JSONSerializer as J, type InferDbClientFromConnection as K, type InferTransactionFromConnection as L, type MigratorOptions as M, type InferTransactionOptionsFromConnection as N, type ConnectionOptions as O, type ConnectionFactory as P, type QueryResultRow as Q, type InitTransaction as R, SQLColumnTypeTokens as S, TableURN as T, type CreateConnectionOptions as U, type CreateAmbientConnectionOptions as V, type WithConnectionFactory as W, createAmbientConnection as X, type CreateSingletonConnectionOptions as Y, createSingletonConnection as Z, type CreateTransientConnectionOptions as _, SQLProcessor as a, executeInNewConnection as a$, createConnection as a0, type ConnectionPoolFactory as a1, createAmbientConnectionPool as a2, type CreateSingletonConnectionPoolOptions as a3, createSingletonConnectionPool as a4, type CreateSingletonClientPoolOptions as a5, createSingletonClientPool as a6, type CreateAlwaysNewConnectionPoolOptions as a7, createAlwaysNewConnectionPool as a8, type CreateConnectionPoolOptions as a9, SystemError as aA, AdminShutdownError as aB, QueryCanceledError as aC, IntegrityConstraintViolationError as aD, UniqueConstraintError as aE, ForeignKeyViolationError as aF, NotNullViolationError as aG, CheckViolationError as aH, ExclusionViolationError as aI, DataError as aJ, InvalidOperationError as aK, mapColumnToJSON as aL, mapColumnToBigint as aM, mapColumnToDate as aN, mapSQLQueryResult as aO, type SQLQueryResultColumnMapping as aP, type SQLQueryOptions as aQ, type SQLCommandOptions as aR, type BatchSQLCommandOptions as aS, BatchCommandNoChangesError as aT, type DbSQLExecutorOptions as aU, type SQLExecutor as aV, type WithSQLExecutor as aW, sqlExecutor as aX, sqlExecutorInNewConnection as aY, sqlExecutorInAmbientConnection as aZ, executeInNewDbClient as a_, createConnectionPool as aa, type AnyDatabaseTransaction as ab, type WithDatabaseTransactionFactory as ac, type TransactionResult as ad, executeInTransaction as ae, transactionFactoryWithDbClient as af, transactionFactoryWithNewConnection as ag, transactionFactoryWithAmbientConnection as ah, type DatabaseType as ai, type DatabaseDriverName as aj, type InferDriverDatabaseType as ak, type DatabaseDriverTypeParts as al, toDatabaseDriverType as am, fromDatabaseDriverType as an, getDatabaseDriverName as ao, getDatabaseType as ap, canHandleDriverWithConnectionString as aq, DumboDatabaseDriverRegistry as ar, dumboDatabaseDriverRegistry as as, ConcurrencyError as at, TransientDatabaseError as au, ConnectionError as av, SerializationError as aw, DeadlockError as ax, LockNotAvailableError as ay, InsufficientResourcesError as az, type SQLProcessorContext as b, type ValidateReference as b$, executeInAmbientConnection as b0, type DatabaseLockOptions as b1, type AcquireDatabaseLockMode as b2, type AcquireDatabaseLockOptions as b3, type ReleaseDatabaseLockOptions as b4, defaultDatabaseLockOptions as b5, type DatabaseLock as b6, NoDatabaseLock as b7, ColumnURNType as b8, type ColumnSchemaComponent as b9, type ColumnName as bA, type TableColumnName as bB, type SchemaColumnName as bC, type ColumnPath as bD, type ColumnReference as bE, type ColumnPathToReference as bF, type ParseReferencePath as bG, type LookupColumnType as bH, type RelationshipType as bI, type RelationshipDefinition as bJ, type AnyTableRelationshipDefinition as bK, type AnyTableRelationshipDefinitionWithColumns as bL, type TableRelationships as bM, relationship as bN, type AnyRelationshipDefinition as bO, type RelationshipColumnsMismatchError as bP, type RelationshipReferencesLengthMismatchError as bQ, type ColumnReferenceExistanceError as bR, type ColumnReferenceTypeMismatchError as bS, type NoError as bT, type ColumnReferenceError as bU, type RelationshipValidationError as bV, type ValidateRelationshipLength as bW, type ValidateRelationshipColumns as bX, type ValidateColumnReference as bY, type ValidateColumnTypeMatch as bZ, type ValidateColumnsMatch as b_, type AnyColumnSchemaComponent as ba, type ColumnSchemaComponentOptions as bb, columnSchemaComponent as bc, DatabaseURNType as bd, type DatabaseSchemas as be, type DatabaseSchemaComponent as bf, type AnyDatabaseSchemaComponent as bg, databaseSchemaComponent as bh, DatabaseSchemaURNType as bi, type DatabaseSchemaTables as bj, type DatabaseSchemaSchemaComponent as bk, type AnyDatabaseSchemaSchemaComponent as bl, databaseSchemaSchemaComponent as bm, IndexURNType as bn, type IndexSchemaComponent as bo, indexSchemaComponent as bp, type ExtractSchemaNames as bq, type ExtractTableNames as br, type ExtractColumnNames as bs, type ExtractColumnTypeName as bt, type AllColumnTypes as bu, type AllColumnReferences as bv, type AllColumnTypesInSchema as bw, type AllColumnReferencesInSchema as bx, type NormalizeReference as by, type NormalizeColumnPath as bz, type DatabaseTransactionOptions as c, type Serializer as c$, type ValidateReferences as c0, type CollectReferencesErrors as c1, type SchemaTablesWithSingle as c2, type DatabaseSchemasWithSingle as c3, type ValidateRelationship as c4, type CollectRelationshipErrors as c5, type ValidateTableRelationships as c6, type ValidateTable as c7, type ValidateSchemaTables as c8, type ValidateDatabaseSchema as c9, DumboDatabaseMetadataRegistry as cA, dumboDatabaseMetadataRegistry as cB, getDatabaseMetadata as cC, resolveDatabaseMetadata as cD, getDefaultDatabase as cE, getDefaultDatabaseAsync as cF, dumboSchema as cG, MIGRATIONS_LOCK_ID as cH, registerDefaultMigratorOptions as cI, getDefaultMigratorOptionsFromRegistry as cJ, type RunSQLMigrationsResult as cK, runSQLMigrations as cL, combineMigrations as cM, type ExtractAdditionalData as cN, type AnySchemaComponent as cO, type AnySchemaComponentOfType as cP, type SchemaComponentOptions as cQ, type SchemaComponentType as cR, type DumboSchemaComponentType as cS, schemaComponent as cT, isSchemaComponentOfType as cU, filterSchemaComponentsOfType as cV, mapSchemaComponentsOfType as cW, findSchemaComponentsOfType as cX, type MigrationStyle as cY, sqlMigration as cZ, type MigrationRecord as c_, type ValidateDatabaseSchemas as ca, type ValidateDatabaseSchemasWithMessages as cb, type Join as cc, type IndentErrors as cd, type FormatSingleError as ce, type FormatRelationshipBlock as cf, type FormatTableLevel as cg, type FormatSchemaLevel as ch, type FormatDatabaseValidationErrors as ci, type FormatValidationErrors as cj, TableURNType as ck, type TableColumns as cl, type TableSchemaComponent as cm, type InferTableSchemaComponentTypes as cn, type InferTableSchemaComponentColumns as co, type AnyTableSchemaComponent as cp, tableSchemaComponent as cq, type Writable as cr, type InferColumnType as cs, type TableColumnType as ct, type TableColumnNames as cu, type InferTableRow as cv, type TableRowType as cw, type InferSchemaTables as cx, type InferDatabaseSchemas as cy, type DatabaseCapabilities as cz, type DumboDatabaseDriver as d, mapANSISQLParamPlaceholder as d$, type SerializationCodec as d0, composeJSONReplacers as d1, composeJSONRevivers as d2, JSONCodec as d3, JSONReplacer as d4, JSONReplacers as d5, JSONReviver as d6, JSONRevivers as d7, jsonSerializer as d8, type JSONCodecOptions as d9, type JavaScriptValueTypeToNameMap as dA, ColumnTypeToken as dB, type AnyColumnTypeToken as dC, SerialToken as dD, BigSerialToken as dE, IntegerToken as dF, BigIntegerToken as dG, JSONBToken as dH, TimestampToken as dI, TimestamptzToken as dJ, VarcharToken as dK, type NotNullableSQLColumnTokenProps as dL, type NullableSQLColumnTokenProps as dM, SQLColumnToken as dN, AutoIncrementSQLColumnToken as dO, SQLColumnTypeTokensFactory as dP, SQLToken as dQ, type ExtractSQLTokenType as dR, SQLPlain as dS, type SQLArrayMode as dT, type SQLDefaultTokens as dU, type SQLDefaultTokensTypes as dV, SQLValueMapper as dW, type MapSQLParamValue as dX, type MapSQLParamValueOptions as dY, ANSISQLParamPlaceholder as dZ, ANSISQLIdentifierQuote as d_, type JSONDeserializeOptions as da, type JSONSerializeOptions as db, type JSONSerializerOptions as dc, type JSONReviverContext as dd, type FormatContext as de, type FormatSQLOptions as df, type SQLFormatterOptions as dg, registerFormatter as dh, getFormatter as di, formatSQL as dj, describeSQL as dk, type ParametrizedSQL as dl, ParametrizedSQLBuilder as dm, defaultProcessorsRegistry as dn, type AnySQLProcessor as dp, type SQLProcessorOptions as dq, type SQLProcessorsReadonlyRegistry as dr, SQLProcessorsRegistry as ds, SQL as dt, RawSQL as du, isSQL as dv, type JSONValueType as dw, type JSONValueTypeName as dx, type JavaScriptValueType as dy, type JavaScriptValueTypeName as dz, SQLFormatter as e, mapSQLIdentifier as e0, DefaultMapSQLParamValueOptions as e1, mapSQLParamValue as e2, type DatabaseConnectionString as e3, parseConnectionString as e4, type DatabaseMetadata as f, type DumboConnectionOptions as g, type ConnectionPool as h, type JSONSerializationOptions as i, type DatabaseTransaction as j, type DbSQLExecutor as k, DumboError as l, SQLArray as m, SQLIn as n, SQLIdentifier as o, SQLLiteral as p, type AnySQLToken as q, DatabaseURN as r, DatabaseSchemaURN as s, ColumnURN as t, type QueryResult as u, type SchemaComponent as v, type SQLMigration as w, type DatabaseDriverType as x, type Dumbo as y, type AnyTypeValidationError as z };
|