@event-driven-io/dumbo 0.13.0-beta.2 → 0.13.0-beta.21
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-65DKXURG.js +481 -0
- package/dist/chunk-65DKXURG.js.map +1 -0
- package/dist/chunk-7WEBHXZD.cjs +481 -0
- package/dist/chunk-7WEBHXZD.cjs.map +1 -0
- package/dist/chunk-AMACBMAZ.cjs +556 -0
- package/dist/chunk-AMACBMAZ.cjs.map +1 -0
- package/dist/chunk-FC4JR2R3.js +83 -0
- package/dist/chunk-FC4JR2R3.js.map +1 -0
- package/dist/chunk-H7ZKIJHB.cjs +83 -0
- package/dist/chunk-H7ZKIJHB.cjs.map +1 -0
- package/dist/chunk-IVJ3SNPJ.js +34 -0
- package/dist/chunk-IVJ3SNPJ.js.map +1 -0
- package/dist/chunk-R7P7CNMK.cjs +34 -0
- package/dist/chunk-R7P7CNMK.cjs.map +1 -0
- package/dist/{chunk-XVV3OOQX.js → chunk-T4A6BQRA.js} +209 -58
- package/dist/chunk-T4A6BQRA.js.map +1 -0
- package/dist/{chunk-N7RWT46K.js → chunk-XO5T5N5S.js} +2135 -1613
- package/dist/chunk-XO5T5N5S.js.map +1 -0
- package/dist/{chunk-OJ34O3Q2.cjs → chunk-XOQHZABK.cjs} +2161 -1639
- package/dist/chunk-XOQHZABK.cjs.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-C7fRa54L.d.ts} +1 -1
- package/dist/{columnProcessors-BX-sH7ah.d.cts → columnProcessors-Difrrk4c.d.cts} +1 -1
- package/dist/{connectionString-B1wm0TFc.d.cts → connectionString-oeg1LD5V.d.cts} +352 -137
- package/dist/{connectionString-B1wm0TFc.d.ts → connectionString-oeg1LD5V.d.ts} +352 -137
- 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 +101 -9
- package/dist/index.js.map +1 -1
- package/dist/pg.cjs +382 -9
- package/dist/pg.cjs.map +1 -1
- package/dist/pg.d.cts +81 -105
- package/dist/pg.d.ts +81 -105
- package/dist/pg.js +434 -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} +31 -10
- package/dist/{index-C2z_XBn6.d.ts → sqlite.d.ts} +31 -10
- package/dist/sqlite.js +56 -0
- package/dist/sqlite3.cjs +240 -11
- package/dist/sqlite3.cjs.map +1 -1
- package/dist/sqlite3.d.cts +39 -19
- package/dist/sqlite3.d.ts +39 -19
- 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;
|
|
@@ -1142,6 +1348,7 @@ interface DatabaseTransaction<ConnectionType extends AnyConnection = AnyConnecti
|
|
|
1142
1348
|
type AnyDatabaseTransaction = DatabaseTransaction<any>;
|
|
1143
1349
|
type DatabaseTransactionOptions = {
|
|
1144
1350
|
allowNestedTransactions?: boolean;
|
|
1351
|
+
readonly?: boolean;
|
|
1145
1352
|
};
|
|
1146
1353
|
interface WithDatabaseTransactionFactory<ConnectionType extends AnyConnection = AnyConnection, TransactionType extends DatabaseTransaction<ConnectionType> = DatabaseTransaction<ConnectionType>, TransactionOptionsType extends DatabaseTransactionOptions = DatabaseTransactionOptions> {
|
|
1147
1354
|
transaction: (options?: TransactionOptionsType) => TransactionType;
|
|
@@ -1173,9 +1380,12 @@ type ConnectionOptions<ConnectionType extends AnyConnection = AnyConnection> = {
|
|
|
1173
1380
|
transactionOptions?: InferTransactionOptionsFromConnection<ConnectionType>;
|
|
1174
1381
|
};
|
|
1175
1382
|
type ConnectionFactory<ConnectionType extends AnyConnection = AnyConnection> = (options: ConnectionOptions<ConnectionType>) => ConnectionType;
|
|
1383
|
+
type WithConnectionOptions = {
|
|
1384
|
+
readonly?: boolean;
|
|
1385
|
+
};
|
|
1176
1386
|
interface WithConnectionFactory<ConnectionType extends AnyConnection = AnyConnection> {
|
|
1177
1387
|
connection: () => Promise<ConnectionType>;
|
|
1178
|
-
withConnection: <Result = unknown>(handle: (connection: ConnectionType) => Promise<Result
|
|
1388
|
+
withConnection: <Result = unknown>(handle: (connection: ConnectionType) => Promise<Result>, options?: WithConnectionOptions) => Promise<Result>;
|
|
1179
1389
|
}
|
|
1180
1390
|
type InitTransaction<ConnectionType extends AnyConnection = AnyConnection, TreansactionType extends DatabaseTransaction<ConnectionType> = DatabaseTransaction<ConnectionType>, TransactionOptionsType extends DatabaseTransactionOptions = DatabaseTransactionOptions> = (connection: () => ConnectionType) => (client: Promise<InferDbClientFromConnection<ConnectionType>>, options?: TransactionOptionsType & {
|
|
1181
1391
|
close: (client: InferDbClientFromConnection<ConnectionType>, error?: unknown) => Promise<void>;
|
|
@@ -1185,13 +1395,15 @@ type CreateConnectionOptions<ConnectionType extends AnyConnection = AnyConnectio
|
|
|
1185
1395
|
connect: () => Promise<InferDbClientFromConnection<ConnectionType>>;
|
|
1186
1396
|
close: (client: InferDbClientFromConnection<ConnectionType>) => Promise<void>;
|
|
1187
1397
|
initTransaction: InitTransaction<ConnectionType, TransactionType, TransactionOptionsType>;
|
|
1188
|
-
|
|
1398
|
+
serializer: JSONSerializer;
|
|
1399
|
+
executor: (options: DbSQLExecutorOptions) => Executor;
|
|
1189
1400
|
};
|
|
1190
1401
|
type CreateAmbientConnectionOptions<ConnectionType extends AnyConnection = AnyConnection, Executor extends DbSQLExecutor = DbSQLExecutor, TransactionType extends DatabaseTransaction<ConnectionType> = DatabaseTransaction<ConnectionType>, TransactionOptionsType extends DatabaseTransactionOptions = DatabaseTransactionOptions> = {
|
|
1191
1402
|
driverType: InferDriverTypeFromConnection<ConnectionType>;
|
|
1192
1403
|
client: InferDbClientFromConnection<ConnectionType>;
|
|
1404
|
+
serializer: JSONSerializer;
|
|
1193
1405
|
initTransaction: InitTransaction<ConnectionType, TransactionType, TransactionOptionsType>;
|
|
1194
|
-
executor: () => Executor;
|
|
1406
|
+
executor: (options: DbSQLExecutorOptions) => Executor;
|
|
1195
1407
|
};
|
|
1196
1408
|
declare const createAmbientConnection: <ConnectionType extends AnyConnection = AnyConnection, Executor extends DbSQLExecutor = DbSQLExecutor, TransactionType extends DatabaseTransaction<ConnectionType> = DatabaseTransaction<ConnectionType>>(options: CreateAmbientConnectionOptions<ConnectionType, Executor, TransactionType>) => ConnectionType;
|
|
1197
1409
|
type CreateSingletonConnectionOptions<ConnectionType extends AnyConnection = AnyConnection, Executor extends DbSQLExecutor = DbSQLExecutor, TransactionType extends DatabaseTransaction<ConnectionType> = DatabaseTransaction<ConnectionType>, TransactionOptionsType extends DatabaseTransactionOptions = DatabaseTransactionOptions> = {
|
|
@@ -1199,7 +1411,8 @@ type CreateSingletonConnectionOptions<ConnectionType extends AnyConnection = Any
|
|
|
1199
1411
|
connect: () => Promise<InferDbClientFromConnection<ConnectionType>>;
|
|
1200
1412
|
close: (client: InferDbClientFromConnection<ConnectionType>) => Promise<void>;
|
|
1201
1413
|
initTransaction: InitTransaction<ConnectionType, TransactionType, TransactionOptionsType>;
|
|
1202
|
-
|
|
1414
|
+
serializer: JSONSerializer;
|
|
1415
|
+
executor: (options: DbSQLExecutorOptions) => Executor;
|
|
1203
1416
|
};
|
|
1204
1417
|
declare const createSingletonConnection: <ConnectionType extends AnyConnection = AnyConnection, Executor extends DbSQLExecutor = DbSQLExecutor, TransactionType extends DatabaseTransaction<ConnectionType> = DatabaseTransaction<ConnectionType>>(options: CreateSingletonConnectionOptions<ConnectionType, Executor, TransactionType>) => ConnectionType;
|
|
1205
1418
|
type CreateTransientConnectionOptions<ConnectionType extends AnyConnection = AnyConnection, Executor extends DbSQLExecutor = DbSQLExecutor, TransactionType extends DatabaseTransaction<ConnectionType> = DatabaseTransaction<ConnectionType>, TransactionOptionsType extends DatabaseTransactionOptions = DatabaseTransactionOptions> = {
|
|
@@ -1207,7 +1420,8 @@ type CreateTransientConnectionOptions<ConnectionType extends AnyConnection = Any
|
|
|
1207
1420
|
open: () => Promise<InferDbClientFromConnection<ConnectionType>>;
|
|
1208
1421
|
close: () => Promise<void>;
|
|
1209
1422
|
initTransaction: InitTransaction<ConnectionType, TransactionType, TransactionOptionsType>;
|
|
1210
|
-
|
|
1423
|
+
serializer: JSONSerializer;
|
|
1424
|
+
executor: (options: DbSQLExecutorOptions) => Executor;
|
|
1211
1425
|
};
|
|
1212
1426
|
declare const createTransientConnection: <ConnectionType extends AnyConnection = AnyConnection, Executor extends DbSQLExecutor = DbSQLExecutor, TransactionType extends DatabaseTransaction<ConnectionType> = DatabaseTransaction<ConnectionType>>(options: CreateTransientConnectionOptions<ConnectionType, Executor, TransactionType>) => ConnectionType;
|
|
1213
1427
|
declare const createConnection: <ConnectionType extends AnyConnection = AnyConnection, Executor extends DbSQLExecutor = DbSQLExecutor, TransactionType extends DatabaseTransaction<ConnectionType> = DatabaseTransaction<ConnectionType>>(options: CreateConnectionOptions<ConnectionType, Executor, TransactionType>) => ConnectionType;
|
|
@@ -1217,24 +1431,25 @@ interface ConnectionPool<ConnectionType extends AnyConnection = AnyConnection, T
|
|
|
1217
1431
|
close: () => Promise<void>;
|
|
1218
1432
|
}
|
|
1219
1433
|
type ConnectionPoolFactory<ConnectionPoolType extends ConnectionPool = ConnectionPool, ConnectionPoolOptions = unknown> = (options: ConnectionPoolOptions) => ConnectionPoolType;
|
|
1220
|
-
|
|
1221
|
-
driverType: ConnectionType[
|
|
1434
|
+
type AmbientConnectionPoolOptions<ConnectionType extends AnyConnection> = {
|
|
1435
|
+
driverType: ConnectionType['driverType'];
|
|
1222
1436
|
connection: ConnectionType;
|
|
1223
|
-
}
|
|
1224
|
-
|
|
1437
|
+
};
|
|
1438
|
+
declare const createAmbientConnectionPool: <ConnectionType extends AnyConnection>(options: AmbientConnectionPoolOptions<ConnectionType>) => ConnectionPool<ConnectionType>;
|
|
1439
|
+
type SingletonConnectionPoolOptions<ConnectionType extends AnyConnection> = {
|
|
1225
1440
|
driverType: ConnectionType['driverType'];
|
|
1226
1441
|
getConnection: () => ConnectionType;
|
|
1227
1442
|
connectionOptions?: never;
|
|
1228
1443
|
};
|
|
1229
|
-
declare const createSingletonConnectionPool: <ConnectionType extends AnyConnection>(options:
|
|
1230
|
-
type
|
|
1444
|
+
declare const createSingletonConnectionPool: <ConnectionType extends AnyConnection>(options: SingletonConnectionPoolOptions<ConnectionType>) => ConnectionPool<ConnectionType>;
|
|
1445
|
+
type SingletonClientConnectionPoolOptions<ConnectionType extends AnyConnection> = {
|
|
1231
1446
|
driverType: ConnectionType['driverType'];
|
|
1232
1447
|
dbClient: InferDbClientFromConnection<ConnectionType>;
|
|
1233
1448
|
connectionFactory: (options: {
|
|
1234
1449
|
dbClient: InferDbClientFromConnection<ConnectionType>;
|
|
1235
1450
|
}) => ConnectionType;
|
|
1236
1451
|
};
|
|
1237
|
-
declare const
|
|
1452
|
+
declare const createSingletonClientConnectionPool: <ConnectionType extends AnyConnection>(options: SingletonClientConnectionPoolOptions<ConnectionType>) => ConnectionPool<ConnectionType>;
|
|
1238
1453
|
type CreateAlwaysNewConnectionPoolOptions<ConnectionType extends AnyConnection, ConnectionOptions extends Record<string, unknown> | undefined = undefined> = ConnectionOptions extends undefined ? {
|
|
1239
1454
|
driverType: ConnectionType['driverType'];
|
|
1240
1455
|
getConnection: () => ConnectionType;
|
|
@@ -1268,4 +1483,4 @@ type DatabaseConnectionString<DatabaseTypeName extends DatabaseType = DatabaseTy
|
|
|
1268
1483
|
};
|
|
1269
1484
|
declare const parseConnectionString: (connectionString: DatabaseConnectionString | string) => DatabaseDriverTypeParts;
|
|
1270
1485
|
|
|
1271
|
-
export { type
|
|
1486
|
+
export { type CreateTransientConnectionOptions as $, type AnyConnection as A, type Dumbo as B, type Connection as C, type DefaultSQLColumnToken as D, type AnyTypeValidationError as E, type TypeValidationSuccess as F, type AnyDumboDatabaseDriver as G, type ExtractDumboDatabaseDriverOptions as H, type InferTransactionFromConnection as I, JSONSerializer as J, type ExtractDumboTypeFromDriver as K, type InferDriverTypeFromConnection as L, type MigratorOptions as M, type InferDbClientFromConnection as N, type ConnectionOptions as O, type ConnectionFactory as P, type QueryResultRow as Q, type WithConnectionFactory as R, SQLColumnTypeTokens as S, TableURN as T, type InitTransaction as U, type CreateConnectionOptions as V, type WithConnectionOptions as W, type CreateAmbientConnectionOptions as X, createAmbientConnection as Y, type CreateSingletonConnectionOptions as Z, createSingletonConnection as _, SQLProcessor as a, sqlExecutorInAmbientConnection as a$, createTransientConnection as a0, createConnection as a1, type ConnectionPoolFactory as a2, type AmbientConnectionPoolOptions as a3, createAmbientConnectionPool as a4, type SingletonConnectionPoolOptions as a5, createSingletonConnectionPool as a6, type SingletonClientConnectionPoolOptions as a7, createSingletonClientConnectionPool as a8, type CreateAlwaysNewConnectionPoolOptions as a9, LockNotAvailableError as aA, InsufficientResourcesError as aB, SystemError as aC, AdminShutdownError as aD, QueryCanceledError as aE, IntegrityConstraintViolationError as aF, UniqueConstraintError as aG, ForeignKeyViolationError as aH, NotNullViolationError as aI, CheckViolationError as aJ, ExclusionViolationError as aK, DataError as aL, InvalidOperationError as aM, mapColumnToJSON as aN, mapColumnToBigint as aO, mapColumnToDate as aP, mapSQLQueryResult as aQ, type SQLQueryResultColumnMapping as aR, type SQLQueryOptions as aS, type SQLCommandOptions as aT, type BatchSQLCommandOptions as aU, BatchCommandNoChangesError as aV, type DbSQLExecutorOptions as aW, type SQLExecutor as aX, type WithSQLExecutor as aY, sqlExecutor as aZ, sqlExecutorInNewConnection as a_, createAlwaysNewConnectionPool as aa, type CreateConnectionPoolOptions as ab, createConnectionPool as ac, type AnyDatabaseTransaction as ad, type WithDatabaseTransactionFactory as ae, type TransactionResult as af, executeInTransaction as ag, transactionFactoryWithDbClient as ah, transactionFactoryWithNewConnection as ai, transactionFactoryWithAmbientConnection as aj, type DatabaseType as ak, type DatabaseDriverName as al, type InferDriverDatabaseType as am, type DatabaseDriverTypeParts as an, toDatabaseDriverType as ao, fromDatabaseDriverType as ap, getDatabaseDriverName as aq, getDatabaseType as ar, canHandleDriverWithConnectionString as as, DumboDatabaseDriverRegistry as at, dumboDatabaseDriverRegistry as au, ConcurrencyError as av, TransientDatabaseError as aw, ConnectionError as ax, SerializationError as ay, DeadlockError as az, type SQLProcessorContext as b, type ValidateColumnTypeMatch as b$, executeInNewDbClient as b0, executeInNewConnection as b1, executeInAmbientConnection as b2, type DatabaseLockOptions as b3, type AcquireDatabaseLockMode as b4, type AcquireDatabaseLockOptions as b5, type ReleaseDatabaseLockOptions as b6, defaultDatabaseLockOptions as b7, type DatabaseLock as b8, NoDatabaseLock as b9, type NormalizeReference as bA, type NormalizeColumnPath as bB, type ColumnName as bC, type TableColumnName as bD, type SchemaColumnName as bE, type ColumnPath as bF, type ColumnReference as bG, type ColumnPathToReference as bH, type ParseReferencePath as bI, type LookupColumnType as bJ, type RelationshipType as bK, type RelationshipDefinition as bL, type AnyTableRelationshipDefinition as bM, type AnyTableRelationshipDefinitionWithColumns as bN, type TableRelationships as bO, relationship as bP, type AnyRelationshipDefinition as bQ, type RelationshipColumnsMismatchError as bR, type RelationshipReferencesLengthMismatchError as bS, type ColumnReferenceExistanceError as bT, type ColumnReferenceTypeMismatchError as bU, type NoError as bV, type ColumnReferenceError as bW, type RelationshipValidationError as bX, type ValidateRelationshipLength as bY, type ValidateRelationshipColumns as bZ, type ValidateColumnReference as b_, ColumnURNType as ba, type ColumnSchemaComponent as bb, type AnyColumnSchemaComponent as bc, type ColumnSchemaComponentOptions as bd, columnSchemaComponent as be, DatabaseURNType as bf, type DatabaseSchemas as bg, type DatabaseSchemaComponent as bh, type AnyDatabaseSchemaComponent as bi, databaseSchemaComponent as bj, DatabaseSchemaURNType as bk, type DatabaseSchemaTables as bl, type DatabaseSchemaSchemaComponent as bm, type AnyDatabaseSchemaSchemaComponent as bn, databaseSchemaSchemaComponent as bo, IndexURNType as bp, type IndexSchemaComponent as bq, indexSchemaComponent as br, type ExtractSchemaNames as bs, type ExtractTableNames as bt, type ExtractColumnNames as bu, type ExtractColumnTypeName as bv, type AllColumnTypes as bw, type AllColumnReferences as bx, type AllColumnTypesInSchema as by, type AllColumnReferencesInSchema as bz, type DumboDatabaseDriver as c, sqlMigration as c$, type ValidateColumnsMatch as c0, type ValidateReference as c1, type ValidateReferences as c2, type CollectReferencesErrors as c3, type SchemaTablesWithSingle as c4, type DatabaseSchemasWithSingle as c5, type ValidateRelationship as c6, type CollectRelationshipErrors as c7, type ValidateTableRelationships as c8, type ValidateTable as c9, type InferDatabaseSchemas as cA, type DatabaseCapabilities as cB, DumboDatabaseMetadataRegistry as cC, dumboDatabaseMetadataRegistry as cD, getDatabaseMetadata as cE, resolveDatabaseMetadata as cF, getDefaultDatabase as cG, getDefaultDatabaseAsync as cH, dumboSchema as cI, MIGRATIONS_LOCK_ID as cJ, registerDefaultMigratorOptions as cK, getDefaultMigratorOptionsFromRegistry as cL, type RunSQLMigrationsResult as cM, runSQLMigrations as cN, combineMigrations as cO, type ExtractAdditionalData as cP, type AnySchemaComponent as cQ, type AnySchemaComponentOfType as cR, type SchemaComponentOptions as cS, type SchemaComponentType as cT, type DumboSchemaComponentType as cU, schemaComponent as cV, isSchemaComponentOfType as cW, filterSchemaComponentsOfType as cX, mapSchemaComponentsOfType as cY, findSchemaComponentsOfType as cZ, type MigrationStyle as c_, type ValidateSchemaTables as ca, type ValidateDatabaseSchema as cb, type ValidateDatabaseSchemas as cc, type ValidateDatabaseSchemasWithMessages as cd, type Join as ce, type IndentErrors as cf, type FormatSingleError as cg, type FormatRelationshipBlock as ch, type FormatTableLevel as ci, type FormatSchemaLevel as cj, type FormatDatabaseValidationErrors as ck, type FormatValidationErrors as cl, TableURNType as cm, type TableColumns as cn, type TableSchemaComponent as co, type InferTableSchemaComponentTypes as cp, type InferTableSchemaComponentColumns as cq, type AnyTableSchemaComponent as cr, tableSchemaComponent as cs, type Writable as ct, type InferColumnType as cu, type TableColumnType as cv, type TableColumnNames as cw, type InferTableRow as cx, type TableRowType as cy, type InferSchemaTables as cz, SQLFormatter as d, ANSISQLParamPlaceholder as d$, type MigrationRecord as d0, type Serializer as d1, type SerializationCodec as d2, composeJSONReplacers as d3, composeJSONRevivers as d4, JSONCodec as d5, JSONReplacer as d6, JSONReplacers as d7, JSONReviver as d8, JSONRevivers as d9, type JavaScriptValueType as dA, type JavaScriptValueTypeName as dB, type JavaScriptValueTypeToNameMap as dC, ColumnTypeToken as dD, type AnyColumnTypeToken as dE, SerialToken as dF, BigSerialToken as dG, IntegerToken as dH, BigIntegerToken as dI, JSONBToken as dJ, TimestampToken as dK, TimestamptzToken as dL, VarcharToken as dM, type NotNullableSQLColumnTokenProps as dN, type NullableSQLColumnTokenProps as dO, SQLColumnToken as dP, AutoIncrementSQLColumnToken as dQ, SQLColumnTypeTokensFactory as dR, SQLToken as dS, type ExtractSQLTokenType as dT, SQLPlain as dU, type SQLArrayMode as dV, type SQLDefaultTokens as dW, type SQLDefaultTokensTypes as dX, SQLValueMapper as dY, type MapSQLParamValue as dZ, type MapSQLParamValueOptions as d_, jsonSerializer as da, type JSONCodecOptions as db, type JSONDeserializeOptions as dc, type JSONSerializeOptions as dd, type JSONSerializerOptions as de, type JSONReviverContext as df, type FormatContext as dg, type FormatSQLOptions as dh, type SQLFormatterOptions as di, registerFormatter as dj, getFormatter as dk, formatSQL as dl, describeSQL as dm, type ParametrizedSQL as dn, ParametrizedSQLBuilder as dp, defaultProcessorsRegistry as dq, type AnySQLProcessor as dr, type SQLProcessorOptions as ds, type SQLProcessorsReadonlyRegistry as dt, SQLProcessorsRegistry as du, SQL as dv, RawSQL as dw, isSQL as dx, type JSONValueType as dy, type JSONValueTypeName as dz, type DatabaseMetadata as e, ANSISQLIdentifierQuote as e0, mapANSISQLParamPlaceholder as e1, mapSQLIdentifier as e2, DefaultMapSQLParamValueOptions as e3, mapSQLParamValue as e4, type DatabaseConnectionString as e5, parseConnectionString as e6, type DumboConnectionOptions as f, type DatabaseTransactionOptions as g, type DatabaseTransaction as h, type ConnectionPool as i, type InferTransactionOptionsFromConnection as j, type JSONSerializationOptions as k, type DbSQLExecutor as l, DumboError as m, SQLArray as n, SQLIn as o, SQLIdentifier as p, SQLLiteral as q, type AnySQLToken as r, DatabaseURN as s, DatabaseSchemaURN as t, ColumnURN as u, IndexURN as v, type QueryResult as w, type SchemaComponent as x, type SQLMigration as y, type DatabaseDriverType as z };
|