@event-driven-io/dumbo 0.13.0-beta.34 → 0.13.0-beta.36
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/cloudflare.cjs +379 -434
- package/dist/cloudflare.cjs.map +1 -1
- package/dist/cloudflare.d.cts +36 -29
- package/dist/cloudflare.d.ts +36 -29
- package/dist/cloudflare.js +343 -434
- package/dist/cloudflare.js.map +1 -1
- package/dist/core-BeyC5tHn.js +519 -0
- package/dist/core-BeyC5tHn.js.map +1 -0
- package/dist/core-Bf2ujUFy.js +379 -0
- package/dist/core-Bf2ujUFy.js.map +1 -0
- package/dist/core-BgYtAxCm.cjs +3237 -0
- package/dist/core-BgYtAxCm.cjs.map +1 -0
- package/dist/core-DDo4m0Z_.js +2262 -0
- package/dist/core-DDo4m0Z_.js.map +1 -0
- package/dist/core-DmbB4qMn.cjs +656 -0
- package/dist/core-DmbB4qMn.cjs.map +1 -0
- package/dist/core-Go_IA78L.cjs +450 -0
- package/dist/core-Go_IA78L.cjs.map +1 -0
- package/dist/{connectionString-Dch_MIRU.d.cts → index-BDSQvDH2.d.cts} +1010 -922
- package/dist/index-BdWFmDhJ.d.cts +68 -0
- package/dist/index-D1jryNqo.d.ts +198 -0
- package/dist/index-DaP2fTEX.d.ts +67 -0
- package/dist/index-DqVvUav9.d.cts +198 -0
- package/dist/index-S_wp0Eaf.d.cts +67 -0
- package/dist/index-cxtbLiju.d.ts +68 -0
- package/dist/{connectionString-Dch_MIRU.d.ts → index-zkszkJqP.d.ts} +1010 -922
- package/dist/index.cjs +212 -359
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -132
- package/dist/index.d.ts +3 -132
- package/dist/index.js +52 -361
- package/dist/index.js.map +1 -1
- package/dist/pg.cjs +366 -431
- package/dist/pg.cjs.map +1 -1
- package/dist/pg.d.cts +83 -72
- package/dist/pg.d.ts +83 -72
- package/dist/pg.js +320 -431
- package/dist/pg.js.map +1 -1
- package/dist/postgreSQLMetadata-LqX-Z_wo.cjs +118 -0
- package/dist/postgreSQLMetadata-LqX-Z_wo.cjs.map +1 -0
- package/dist/postgreSQLMetadata-zMq8yJo_.js +65 -0
- package/dist/postgreSQLMetadata-zMq8yJo_.js.map +1 -0
- package/dist/postgresql.cjs +25 -50
- package/dist/postgresql.d.cts +3 -61
- package/dist/postgresql.d.ts +3 -61
- package/dist/postgresql.js +4 -50
- package/dist/sqlite.cjs +30 -60
- package/dist/sqlite.d.cts +3 -190
- package/dist/sqlite.d.ts +3 -190
- package/dist/sqlite.js +4 -60
- package/dist/sqlite3.cjs +312 -380
- package/dist/sqlite3.cjs.map +1 -1
- package/dist/sqlite3.d.cts +79 -77
- package/dist/sqlite3.d.ts +79 -77
- package/dist/sqlite3.js +276 -378
- package/dist/sqlite3.js.map +1 -1
- package/dist/sqliteMetadata-BoQ7Sc9I.js +29 -0
- package/dist/sqliteMetadata-BoQ7Sc9I.js.map +1 -0
- package/dist/sqliteMetadata-D_2pKeCC.cjs +46 -0
- package/dist/sqliteMetadata-D_2pKeCC.cjs.map +1 -0
- package/package.json +12 -12
- package/dist/chunk-33P5766L.js +0 -83
- package/dist/chunk-33P5766L.js.map +0 -1
- package/dist/chunk-4MMMEDQ7.cjs +0 -2944
- package/dist/chunk-4MMMEDQ7.cjs.map +0 -1
- package/dist/chunk-6HAHSSPW.js +0 -701
- package/dist/chunk-6HAHSSPW.js.map +0 -1
- package/dist/chunk-GNH5XC6D.cjs +0 -481
- package/dist/chunk-GNH5XC6D.cjs.map +0 -1
- package/dist/chunk-H2JBS7HM.js +0 -2944
- package/dist/chunk-H2JBS7HM.js.map +0 -1
- package/dist/chunk-JIZGCEPE.cjs +0 -701
- package/dist/chunk-JIZGCEPE.cjs.map +0 -1
- package/dist/chunk-NJI6PJFZ.cjs +0 -83
- package/dist/chunk-NJI6PJFZ.cjs.map +0 -1
- package/dist/chunk-RQ3KKMTP.cjs +0 -34
- package/dist/chunk-RQ3KKMTP.cjs.map +0 -1
- package/dist/chunk-UK7MXVS2.js +0 -34
- package/dist/chunk-UK7MXVS2.js.map +0 -1
- package/dist/chunk-Y5TD53QE.js +0 -481
- package/dist/chunk-Y5TD53QE.js.map +0 -1
- package/dist/columnProcessors-Be2uMYjS.d.cts +0 -8
- package/dist/columnProcessors-D0ivj_SU.d.ts +0 -8
- package/dist/postgresql.cjs.map +0 -1
- package/dist/postgresql.js.map +0 -1
- package/dist/sqlite.cjs.map +0 -1
- package/dist/sqlite.js.map +0 -1
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { At as DatabaseLockOptions, Dt as AcquireDatabaseLockMode, Gi as SQL, Jt as SQLExecutor, Mt as ReleaseDatabaseLockOptions, Ot as AcquireDatabaseLockOptions, Qi as DefaultSQLColumnProcessors, Ri as SQLFormatter, Wa as SQLIn, gn as DumboError, i as DatabaseConnectionString, kt as DatabaseLock, ra as SQLProcessor, rt as DatabaseDriverType, xt as MigratorOptions, za as SQLArray } from "./index-BDSQvDH2.cjs";
|
|
2
|
+
|
|
3
|
+
//#region src/storage/postgresql/core/connections/connectionString.d.ts
|
|
4
|
+
declare const defaultPostgreSQLConnectionString: PostgreSQLConnectionString;
|
|
5
|
+
type PostgreSQLConnectionString = DatabaseConnectionString<'PostgreSQL', `postgresql://${string}` | `postgres://${string}`>;
|
|
6
|
+
declare const PostgreSQLConnectionString: (connectionString: string) => PostgreSQLConnectionString;
|
|
7
|
+
/**
|
|
8
|
+
* Parse database name from a PostgreSQL connection string
|
|
9
|
+
*/
|
|
10
|
+
declare function parseDatabaseName(str: string): string | null;
|
|
11
|
+
//#endregion
|
|
12
|
+
//#region src/storage/postgresql/core/errors/errorMapper.d.ts
|
|
13
|
+
/**
|
|
14
|
+
* Maps a PostgreSQL error (from the `pg` driver) to a typed DumboError
|
|
15
|
+
* based on the SQLSTATE code.
|
|
16
|
+
*
|
|
17
|
+
* SQLSTATE reference: https://www.postgresql.org/docs/current/errcodes-appendix.html
|
|
18
|
+
* Transient classification based on Npgsql's PostgresException.IsTransient.
|
|
19
|
+
*
|
|
20
|
+
* Falls back to a generic DumboError (500) if the error is not a recognized PostgreSQL error.
|
|
21
|
+
*/
|
|
22
|
+
declare const mapPostgresError: (error: unknown) => DumboError;
|
|
23
|
+
//#endregion
|
|
24
|
+
//#region src/storage/postgresql/core/locks/advisoryLocks.d.ts
|
|
25
|
+
declare const tryAcquireAdvisoryLock: (execute: SQLExecutor, options: AcquireDatabaseLockOptions) => Promise<boolean>;
|
|
26
|
+
declare const releaseAdvisoryLock: (execute: SQLExecutor, options: ReleaseDatabaseLockOptions) => Promise<boolean>;
|
|
27
|
+
declare const acquireAdvisoryLock: (execute: SQLExecutor, options: AcquireDatabaseLockOptions) => Promise<void>;
|
|
28
|
+
declare const AdvisoryLock: DatabaseLock;
|
|
29
|
+
declare const advisoryLock: (execute: SQLExecutor, options: DatabaseLockOptions) => {
|
|
30
|
+
acquire: (acquireOptions?: {
|
|
31
|
+
mode: AcquireDatabaseLockMode;
|
|
32
|
+
}) => Promise<void>;
|
|
33
|
+
tryAcquire: (acquireOptions?: {
|
|
34
|
+
mode: AcquireDatabaseLockMode;
|
|
35
|
+
}) => Promise<boolean>;
|
|
36
|
+
release: () => Promise<boolean>;
|
|
37
|
+
withAcquire: <Result>(handle: () => Promise<Result>, acquireOptions?: {
|
|
38
|
+
mode: AcquireDatabaseLockMode;
|
|
39
|
+
}) => Promise<Result>;
|
|
40
|
+
};
|
|
41
|
+
//#endregion
|
|
42
|
+
//#region src/storage/postgresql/core/schema/migrations.d.ts
|
|
43
|
+
declare const DefaultPostgreSQLMigratorOptions: MigratorOptions;
|
|
44
|
+
//#endregion
|
|
45
|
+
//#region src/storage/postgresql/core/schema/schema.d.ts
|
|
46
|
+
declare const defaultPostgreSqlDatabase = "postgres";
|
|
47
|
+
declare const tableExistsSQL: (tableName: string) => SQL;
|
|
48
|
+
declare const tableExists: (execute: SQLExecutor, tableName: string) => Promise<boolean>;
|
|
49
|
+
declare const functionExistsSQL: (functionName: string) => SQL;
|
|
50
|
+
declare const functionExists: (execute: SQLExecutor, functionName: string) => Promise<boolean>;
|
|
51
|
+
//#endregion
|
|
52
|
+
//#region src/storage/postgresql/core/sql/formatter/index.d.ts
|
|
53
|
+
declare const pgFormatter: SQLFormatter;
|
|
54
|
+
//#endregion
|
|
55
|
+
//#region src/storage/postgresql/core/sql/processors/arrayProcessors.d.ts
|
|
56
|
+
declare const PostgreSQLArrayProcessor: SQLProcessor<SQLArray>;
|
|
57
|
+
declare const PostgreSQLExpandSQLInProcessor: SQLProcessor<SQLIn>;
|
|
58
|
+
//#endregion
|
|
59
|
+
//#region src/storage/postgresql/core/sql/processors/columProcessors.d.ts
|
|
60
|
+
declare const postgreSQLColumnProcessors: DefaultSQLColumnProcessors;
|
|
61
|
+
//#endregion
|
|
62
|
+
//#region src/storage/postgresql/core/index.d.ts
|
|
63
|
+
type PostgreSQLDatabaseName = 'PostgreSQL';
|
|
64
|
+
declare const PostgreSQLDatabaseName = "PostgreSQL";
|
|
65
|
+
type PostgreSQLDriverType<DriverName extends string = string> = DatabaseDriverType<PostgreSQLDatabaseName, DriverName>;
|
|
66
|
+
//#endregion
|
|
67
|
+
export { tryAcquireAdvisoryLock as _, PostgreSQLExpandSQLInProcessor as a, defaultPostgreSQLConnectionString as b, functionExists as c, tableExistsSQL as d, DefaultPostgreSQLMigratorOptions as f, releaseAdvisoryLock as g, advisoryLock as h, PostgreSQLArrayProcessor as i, functionExistsSQL as l, acquireAdvisoryLock as m, PostgreSQLDriverType as n, pgFormatter as o, AdvisoryLock as p, postgreSQLColumnProcessors as r, defaultPostgreSqlDatabase as s, PostgreSQLDatabaseName as t, tableExists as u, mapPostgresError as v, parseDatabaseName as x, PostgreSQLConnectionString as y };
|
|
68
|
+
//# sourceMappingURL=index-BdWFmDhJ.d.cts.map
|
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
import { D as Connection, E as AnyConnection, F as InferDriverTypeFromConnection, Gt as DbSQLExecutor, I as InferTransactionFromConnection, Jt as SQLExecutor, K as DatabaseTransaction, P as InferDbClientFromConnection, R as InitTransaction, Ri as SQLFormatter, Wt as BatchSQLCommandOptions, co as JSONSerializer, gn as DumboError, i as DatabaseConnectionString, k as ConnectionOptions, p as ConnectionPool, q as DatabaseTransactionOptions, qt as SQLCommandOptions, rt as DatabaseDriverType, xt as MigratorOptions } from "./index-zkszkJqP.js";
|
|
2
|
+
//#region src/storage/sqlite/core/execute/execute.d.ts
|
|
3
|
+
type SQLiteErrorMapper = (error: unknown) => DumboError;
|
|
4
|
+
declare const sqliteExecute: <Result = void>(database: SQLiteClient, handle: (client: SQLiteClient) => Promise<Result>) => Promise<Result>;
|
|
5
|
+
type SQLiteSQLExecutor<DriverType extends SQLiteDriverType = SQLiteDriverType> = DbSQLExecutor<DriverType, SQLiteClient>;
|
|
6
|
+
declare const sqliteSQLExecutor: <DriverType extends SQLiteDriverType = SQLiteDriverType>(driverType: DriverType, serializer: JSONSerializer, formatter?: SQLFormatter, errorMapper?: SQLiteErrorMapper) => SQLiteSQLExecutor<DriverType>;
|
|
7
|
+
//#endregion
|
|
8
|
+
//#region src/storage/sqlite/core/transactions/index.d.ts
|
|
9
|
+
type SQLiteTransaction<ConnectionType extends AnySQLiteConnection = AnySQLiteConnection, TransactionOptions extends SQLiteTransactionOptions = SQLiteTransactionOptions> = DatabaseTransaction<ConnectionType, TransactionOptions>;
|
|
10
|
+
type SQLiteTransactionMode = 'DEFERRED' | 'IMMEDIATE' | 'EXCLUSIVE';
|
|
11
|
+
type SQLiteTransactionOptions = DatabaseTransactionOptions & {
|
|
12
|
+
mode?: SQLiteTransactionMode;
|
|
13
|
+
useSavepoints?: boolean;
|
|
14
|
+
};
|
|
15
|
+
declare const sqliteTransaction: <ConnectionType extends AnySQLiteConnection = AnySQLiteConnection>(driverType: ConnectionType["driverType"], connection: () => ConnectionType, allowNestedTransactions: boolean, serializer: JSONSerializer, defaultTransactionMode?: "IMMEDIATE" | "DEFERRED" | "EXCLUSIVE") => (getClient: Promise<InferDbClientFromConnection<ConnectionType>>, options?: {
|
|
16
|
+
close: (client: InferDbClientFromConnection<ConnectionType>, error?: unknown) => Promise<void>;
|
|
17
|
+
} & SQLiteTransactionOptions) => InferTransactionFromConnection<ConnectionType>;
|
|
18
|
+
//#endregion
|
|
19
|
+
//#region src/storage/sqlite/core/connections/connectionString.d.ts
|
|
20
|
+
type SQLitePragmaOptions = {
|
|
21
|
+
journal_mode?: 'DELETE' | 'TRUNCATE' | 'PERSIST' | 'MEMORY' | 'WAL' | 'OFF';
|
|
22
|
+
synchronous?: 'OFF' | 'NORMAL' | 'FULL' | 'EXTRA';
|
|
23
|
+
cache_size?: number;
|
|
24
|
+
foreign_keys?: boolean;
|
|
25
|
+
temp_store?: 'DEFAULT' | 'FILE' | 'MEMORY';
|
|
26
|
+
busy_timeout?: number;
|
|
27
|
+
mmap_size?: number;
|
|
28
|
+
};
|
|
29
|
+
type SQLiteConnectionString = DatabaseConnectionString<'SQLite', `file:${string}` | `:memory:` | `/${string}` | `./${string}`>;
|
|
30
|
+
declare const SQLiteConnectionString: (connectionString: string) => SQLiteConnectionString;
|
|
31
|
+
declare const parsePragmasFromConnectionString: (connectionString: string | SQLiteConnectionString) => Partial<SQLitePragmaOptions>;
|
|
32
|
+
//#endregion
|
|
33
|
+
//#region src/storage/sqlite/core/connections/index.d.ts
|
|
34
|
+
type SQLiteCommandOptions = SQLCommandOptions & {
|
|
35
|
+
ignoreChangesCount?: boolean;
|
|
36
|
+
};
|
|
37
|
+
type BatchSQLiteCommandOptions = SQLiteCommandOptions & BatchSQLCommandOptions;
|
|
38
|
+
type SQLiteParameters = object | string | bigint | number | boolean | null;
|
|
39
|
+
type SQLiteClient = {
|
|
40
|
+
connect: () => Promise<void>;
|
|
41
|
+
close: () => Promise<void>;
|
|
42
|
+
} & SQLExecutor;
|
|
43
|
+
type SQLitePoolClient = {
|
|
44
|
+
release: () => void;
|
|
45
|
+
} & SQLExecutor;
|
|
46
|
+
type SQLiteClientFactory<SQLiteClientType extends SQLiteClient = SQLiteClient, ClientOptions = SQLiteClientOptions> = (options: ClientOptions) => SQLiteClientType;
|
|
47
|
+
type SQLiteClientOrPoolClient = SQLitePoolClient | SQLiteClient;
|
|
48
|
+
interface SQLiteError extends Error {
|
|
49
|
+
errno: number;
|
|
50
|
+
}
|
|
51
|
+
declare const isSQLiteError: (error: unknown) => error is SQLiteError;
|
|
52
|
+
type SQLiteClientConnection<Self extends AnyConnection = AnyConnection, DriverType extends SQLiteDriverType = SQLiteDriverType, SQLiteClientType extends SQLiteClient = SQLiteClient, TransactionType extends DatabaseTransaction<Self> = DatabaseTransaction<Self>> = Connection<Self, DriverType, SQLiteClientType, TransactionType>;
|
|
53
|
+
type SQLitePoolClientConnection<Self extends AnyConnection = AnyConnection, DriverType extends SQLiteDriverType = SQLiteDriverType, SQLitePoolClientType extends SQLitePoolClient = SQLitePoolClient, TransactionType extends DatabaseTransaction<Self> = DatabaseTransaction<Self>> = Connection<Self, DriverType, SQLitePoolClientType, TransactionType>;
|
|
54
|
+
type SQLiteConnection<Self extends AnyConnection = AnyConnection, DriverType extends SQLiteDriverType = SQLiteDriverType, SQLiteClientType extends SQLiteClientOrPoolClient = SQLiteClient | SQLitePoolClient, TransactionType extends DatabaseTransaction<Self> = DatabaseTransaction<Self>> = (SQLiteClientType extends SQLiteClient ? SQLiteClientConnection<Self, DriverType, SQLiteClientType, TransactionType> : never) | (SQLiteClientType extends SQLitePoolClient ? SQLitePoolClientConnection<Self, DriverType, SQLiteClientType, TransactionType> : never);
|
|
55
|
+
type AnySQLiteClientConnection = SQLiteClientConnection<any, any>;
|
|
56
|
+
type AnySQLitePoolClientConnection = SQLitePoolClientConnection<any, any, any, any>;
|
|
57
|
+
type AnySQLiteConnection = SQLiteConnection<any, any, any, any>;
|
|
58
|
+
type SQLiteConnectionOptions<ConnectionType extends AnySQLiteConnection = AnySQLiteConnection> = ConnectionOptions<ConnectionType> & SQLiteClientOptions;
|
|
59
|
+
type SQLiteClientConnectionDefinitionOptions<SQLiteConnectionType extends AnySQLiteClientConnection = AnySQLiteClientConnection, ConnectionOptions = SQLiteConnectionOptions> = {
|
|
60
|
+
driverType: InferDriverTypeFromConnection<SQLiteConnectionType>;
|
|
61
|
+
type: 'Client';
|
|
62
|
+
sqliteClientFactory: SQLiteClientFactory<InferDbClientFromConnection<SQLiteConnectionType>, ConnectionOptions>;
|
|
63
|
+
connectionOptions: SQLiteConnectionOptions<SQLiteConnectionType>;
|
|
64
|
+
serializer: JSONSerializer;
|
|
65
|
+
};
|
|
66
|
+
type SQLitePoolConnectionDefinitionOptions<SQLiteConnectionType extends AnySQLitePoolClientConnection = AnySQLitePoolClientConnection, ConnectionOptions = SQLiteConnectionOptions> = {
|
|
67
|
+
driverType: InferDriverTypeFromConnection<SQLiteConnectionType>;
|
|
68
|
+
type: 'PoolClient';
|
|
69
|
+
sqliteClientFactory: SQLiteClientFactory<InferDbClientFromConnection<SQLiteConnectionType>, ConnectionOptions>;
|
|
70
|
+
connectionOptions: SQLiteConnectionOptions<SQLiteConnectionType>;
|
|
71
|
+
serializer: JSONSerializer;
|
|
72
|
+
};
|
|
73
|
+
type SQLiteConnectionDefinitionOptions<SQLiteConnectionType extends AnySQLitePoolClientConnection = AnySQLitePoolClientConnection, ClientOptions = SQLiteClientOptions> = SQLiteClientConnectionDefinitionOptions<SQLiteConnectionType, ClientOptions> | SQLitePoolConnectionDefinitionOptions<SQLiteConnectionType, ClientOptions>;
|
|
74
|
+
type SQLiteConnectionFactory<SQLiteConnectionType extends AnySQLiteConnection = AnySQLiteConnection, ConnectionOptions extends SQLiteConnectionOptions = SQLiteConnectionOptions> = (options: ConnectionOptions) => SQLiteConnectionType;
|
|
75
|
+
type TransactionNestingCounter = {
|
|
76
|
+
increment: () => void;
|
|
77
|
+
decrement: () => void;
|
|
78
|
+
reset: () => void;
|
|
79
|
+
level: number;
|
|
80
|
+
};
|
|
81
|
+
declare const transactionNestingCounter: () => TransactionNestingCounter;
|
|
82
|
+
type SqliteAmbientClientConnectionOptions<SQLiteConnectionType extends AnySQLiteClientConnection = AnySQLiteClientConnection> = {
|
|
83
|
+
driverType: SQLiteConnectionType['driverType'];
|
|
84
|
+
client: InferDbClientFromConnection<SQLiteConnectionType>;
|
|
85
|
+
initTransaction?: InitTransaction<SQLiteConnectionType>;
|
|
86
|
+
allowNestedTransactions?: boolean;
|
|
87
|
+
defaultTransactionMode?: SQLiteTransactionMode;
|
|
88
|
+
serializer: JSONSerializer;
|
|
89
|
+
errorMapper?: SQLiteErrorMapper;
|
|
90
|
+
};
|
|
91
|
+
declare const sqliteAmbientClientConnection: <SQLiteConnectionType extends AnySQLiteClientConnection = AnySQLiteClientConnection>(options: SqliteAmbientClientConnectionOptions<SQLiteConnectionType>) => SQLiteConnectionType;
|
|
92
|
+
declare const sqliteClientConnection: <SQLiteConnectionType extends AnySQLiteClientConnection = AnySQLiteClientConnection, ClientOptions = SQLiteClientOptions>(options: SQLiteClientConnectionDefinitionOptions<SQLiteConnectionType, ClientOptions>) => SQLiteConnectionType;
|
|
93
|
+
declare const sqlitePoolClientConnection: <SQLiteConnectionType extends AnySQLiteClientConnection = AnySQLiteClientConnection, ClientOptions = SQLiteClientOptions>(options: SQLitePoolConnectionDefinitionOptions<SQLiteConnectionType, ClientOptions>) => SQLiteConnectionType;
|
|
94
|
+
declare function sqliteConnection<SQLiteConnectionType extends AnySQLiteConnection = AnySQLiteConnection, ClientOptions = SQLiteClientOptions>(options: SQLiteConnectionDefinitionOptions<SQLiteConnectionType, ClientOptions>): SQLiteConnectionType;
|
|
95
|
+
type InMemorySQLiteDatabase = ':memory:';
|
|
96
|
+
declare const InMemorySQLiteDatabase: SQLiteConnectionString;
|
|
97
|
+
declare const DEFAULT_SQLITE_PRAGMA_OPTIONS: SQLitePragmaOptions;
|
|
98
|
+
type SQLiteClientOptions = {
|
|
99
|
+
pragmaOptions?: Partial<SQLitePragmaOptions>;
|
|
100
|
+
defaultTransactionMode?: SQLiteTransactionMode;
|
|
101
|
+
skipDatabasePragmas?: boolean;
|
|
102
|
+
readonly?: boolean;
|
|
103
|
+
};
|
|
104
|
+
//#endregion
|
|
105
|
+
//#region src/storage/sqlite/core/errors/errorMapper.d.ts
|
|
106
|
+
/**
|
|
107
|
+
* Maps a SQLite error (from the `sqlite3` / node-sqlite3 driver) to a typed
|
|
108
|
+
* DumboError based on the SQLite result code.
|
|
109
|
+
*
|
|
110
|
+
* Result code reference: https://www.sqlite.org/rescode.html
|
|
111
|
+
*
|
|
112
|
+
* Falls back to a generic DumboError (500) if the error is not a recognized SQLite error.
|
|
113
|
+
*/
|
|
114
|
+
declare const mapSqliteError: (error: unknown) => DumboError;
|
|
115
|
+
//#endregion
|
|
116
|
+
//#region src/storage/sqlite/core/pool/dualPool.d.ts
|
|
117
|
+
type SQLiteDualPoolOptions<SQLiteConnectionType extends AnySQLiteConnection, ConnectionOptions extends SQLiteConnectionOptions> = {
|
|
118
|
+
driverType: SQLiteConnectionType['driverType'];
|
|
119
|
+
dual?: true;
|
|
120
|
+
singleton?: false;
|
|
121
|
+
pooled?: true;
|
|
122
|
+
connection?: never;
|
|
123
|
+
readerPoolSize?: number;
|
|
124
|
+
sqliteConnectionFactory: SQLiteConnectionFactory<SQLiteConnectionType, ConnectionOptions>;
|
|
125
|
+
connectionOptions?: ConnectionOptions;
|
|
126
|
+
};
|
|
127
|
+
//#endregion
|
|
128
|
+
//#region src/storage/sqlite/core/pool/pool.d.ts
|
|
129
|
+
type SQLiteFileNameOrConnectionString = {
|
|
130
|
+
fileName: string | SQLiteConnectionString;
|
|
131
|
+
connectionString?: never;
|
|
132
|
+
} | {
|
|
133
|
+
connectionString: string | SQLiteConnectionString;
|
|
134
|
+
fileName?: never;
|
|
135
|
+
};
|
|
136
|
+
declare const isInMemoryDatabase: (options: Record<string, unknown>) => boolean;
|
|
137
|
+
type SQLiteAmbientConnectionPool<SQLiteConnectionType extends AnySQLiteConnection = AnySQLiteConnection> = ConnectionPool<SQLiteConnectionType>;
|
|
138
|
+
type SQLiteAmbientConnectionPoolOptions<SQLiteConnectionType extends AnySQLiteConnection = AnySQLiteConnection> = {
|
|
139
|
+
singleton?: true;
|
|
140
|
+
pooled?: false;
|
|
141
|
+
sqliteConnectionFactory?: never;
|
|
142
|
+
connection: SQLiteConnectionType;
|
|
143
|
+
connectionOptions?: never;
|
|
144
|
+
};
|
|
145
|
+
declare const sqliteAmbientConnectionPool: <SQLiteConnectionType extends AnySQLiteConnection = AnySQLiteConnection>(options: {
|
|
146
|
+
driverType: SQLiteConnectionType["driverType"];
|
|
147
|
+
} & SQLiteAmbientConnectionPoolOptions<SQLiteConnectionType["driverType"]>) => SQLiteAmbientConnectionPool<SQLiteConnectionType["driverType"]>;
|
|
148
|
+
type SQLiteSingletonConnectionPoolOptions<SQLiteConnectionType extends AnySQLiteConnection = AnySQLiteConnection, ConnectionOptions extends SQLiteConnectionOptions = SQLiteConnectionOptions> = {
|
|
149
|
+
singleton: true;
|
|
150
|
+
pooled?: true;
|
|
151
|
+
sqliteConnectionFactory: SQLiteConnectionFactory<SQLiteConnectionType, ConnectionOptions>;
|
|
152
|
+
connection?: never;
|
|
153
|
+
connectionOptions: ConnectionOptions;
|
|
154
|
+
};
|
|
155
|
+
type SQLiteSingletonConnectionPool<SQLiteConnectionType extends AnySQLiteConnection = AnySQLiteConnection> = ConnectionPool<SQLiteConnectionType>;
|
|
156
|
+
declare const sqliteSingletonConnectionPool: <SQLiteConnectionType extends AnySQLiteConnection = AnySQLiteConnection, ConnectionOptions extends SQLiteConnectionOptions & Record<string, unknown> = SQLiteConnectionOptions & Record<string, unknown>>(options: {
|
|
157
|
+
driverType: SQLiteConnectionType["driverType"];
|
|
158
|
+
} & SQLiteSingletonConnectionPoolOptions<SQLiteConnectionType, ConnectionOptions>) => SQLiteSingletonConnectionPool<SQLiteConnectionType>;
|
|
159
|
+
type SQLiteAlwaysNewPoolOptions<SQLiteConnectionType extends AnySQLiteConnection = AnySQLiteConnection, ConnectionOptions extends SQLiteConnectionOptions = SQLiteConnectionOptions> = {
|
|
160
|
+
singleton?: false;
|
|
161
|
+
pooled?: true;
|
|
162
|
+
sqliteConnectionFactory: SQLiteConnectionFactory<SQLiteConnectionType, ConnectionOptions>;
|
|
163
|
+
connection?: never;
|
|
164
|
+
connectionOptions: ConnectionOptions;
|
|
165
|
+
};
|
|
166
|
+
type SQLiteAlwaysNewConnectionPool<SQLiteConnectionType extends AnySQLiteConnection = AnySQLiteConnection> = ConnectionPool<SQLiteConnectionType>;
|
|
167
|
+
declare const sqliteAlwaysNewConnectionPool: <SQLiteConnectionType extends AnySQLiteConnection = AnySQLiteConnection, ConnectionOptions extends SQLiteConnectionOptions & Record<string, unknown> = SQLiteConnectionOptions & Record<string, unknown>>(options: {
|
|
168
|
+
driverType: SQLiteConnectionType["driverType"];
|
|
169
|
+
} & SQLiteAlwaysNewPoolOptions<SQLiteConnectionType, ConnectionOptions>) => SQLiteAlwaysNewConnectionPool<SQLiteConnectionType>;
|
|
170
|
+
type SQLitePoolOptions<SQLiteConnectionType extends AnySQLiteConnection = AnySQLiteConnection, ConnectionOptions extends SQLiteConnectionOptions = SQLiteConnectionOptions> = (SQLiteAlwaysNewPoolOptions<SQLiteConnectionType, ConnectionOptions> | SQLiteSingletonConnectionPoolOptions<SQLiteConnectionType, ConnectionOptions> | SQLiteAmbientConnectionPoolOptions<SQLiteConnectionType> | SQLiteDualPoolOptions<SQLiteConnectionType, ConnectionOptions>) & {
|
|
171
|
+
driverType: SQLiteConnectionType['driverType'];
|
|
172
|
+
serializer?: JSONSerializer;
|
|
173
|
+
};
|
|
174
|
+
type SQLitePool<SQLiteConnectionType extends AnySQLiteConnection = AnySQLiteConnection> = SQLiteAmbientConnectionPool<SQLiteConnectionType> | SQLiteSingletonConnectionPool<SQLiteConnectionType> | SQLiteAlwaysNewConnectionPool<SQLiteConnectionType>;
|
|
175
|
+
type SQLitePoolFactoryOptions<SQLiteConnectionType extends AnySQLiteConnection, ConnectionOptions extends SQLiteConnectionOptions> = Omit<SQLitePoolOptions<SQLiteConnectionType, ConnectionOptions>, 'singleton'> & {
|
|
176
|
+
singleton?: boolean;
|
|
177
|
+
};
|
|
178
|
+
declare const toSqlitePoolOptions: <SQLiteConnectionType extends AnySQLiteConnection, ConnectionOptions extends SQLiteConnectionOptions>(options: SQLitePoolFactoryOptions<SQLiteConnectionType, ConnectionOptions>) => SQLitePoolOptions<SQLiteConnectionType, ConnectionOptions>;
|
|
179
|
+
declare function sqlitePool<SQLiteConnectionType extends AnySQLiteConnection = AnySQLiteConnection, ConnectionOptions extends SQLiteConnectionOptions = SQLiteConnectionOptions>(options: SQLitePoolOptions<SQLiteConnectionType, ConnectionOptions>): SQLitePool<SQLiteConnectionType>;
|
|
180
|
+
//#endregion
|
|
181
|
+
//#region src/storage/sqlite/core/schema/migrations.d.ts
|
|
182
|
+
declare const DefaultSQLiteMigratorOptions: MigratorOptions;
|
|
183
|
+
//#endregion
|
|
184
|
+
//#region src/storage/sqlite/core/schema/schema.d.ts
|
|
185
|
+
declare const defaultSQLiteDatabase = ":memory:";
|
|
186
|
+
declare const tableExists: (execute: SQLExecutor, tableName: string) => Promise<boolean>;
|
|
187
|
+
//#endregion
|
|
188
|
+
//#region src/storage/sqlite/core/sql/formatter/index.d.ts
|
|
189
|
+
declare const sqliteFormatter: SQLFormatter;
|
|
190
|
+
//#endregion
|
|
191
|
+
//#region src/storage/sqlite/core/index.d.ts
|
|
192
|
+
type SQLiteDatabaseName = 'SQLite';
|
|
193
|
+
declare const SQLiteDatabaseName = "SQLite";
|
|
194
|
+
type SQLiteDriverType<DriverName extends string = string> = DatabaseDriverType<SQLiteDatabaseName, DriverName>;
|
|
195
|
+
type SQLiteDatabaseType = 'SQLite';
|
|
196
|
+
//#endregion
|
|
197
|
+
export { SQLitePragmaOptions as $, SQLiteClientConnectionDefinitionOptions as A, SQLiteParameters as B, AnySQLiteConnection as C, InMemorySQLiteDatabase as D, DEFAULT_SQLITE_PRAGMA_OPTIONS as E, SQLiteConnection as F, TransactionNestingCounter as G, SQLitePoolClientConnection as H, SQLiteConnectionDefinitionOptions as I, sqliteClientConnection as J, isSQLiteError as K, SQLiteConnectionFactory as L, SQLiteClientOptions as M, SQLiteClientOrPoolClient as N, SQLiteClient as O, SQLiteCommandOptions as P, SQLiteConnectionString as Q, SQLiteConnectionOptions as R, AnySQLiteClientConnection as S, BatchSQLiteCommandOptions as T, SQLitePoolConnectionDefinitionOptions as U, SQLitePoolClient as V, SqliteAmbientClientConnectionOptions as W, sqlitePoolClientConnection as X, sqliteConnection as Y, transactionNestingCounter as Z, sqliteAmbientConnectionPool as _, defaultSQLiteDatabase as a, SQLiteErrorMapper as at, toSqlitePoolOptions as b, SQLiteAlwaysNewConnectionPool as c, sqliteSQLExecutor as ct, SQLitePool as d, parsePragmasFromConnectionString as et, SQLitePoolFactoryOptions as f, sqliteAlwaysNewConnectionPool as g, isInMemoryDatabase as h, sqliteFormatter as i, sqliteTransaction as it, SQLiteClientFactory as j, SQLiteClientConnection as k, SQLiteAmbientConnectionPool as l, SQLiteSingletonConnectionPool as m, SQLiteDatabaseType as n, SQLiteTransactionMode as nt, tableExists as o, SQLiteSQLExecutor as ot, SQLitePoolOptions as p, sqliteAmbientClientConnection as q, SQLiteDriverType as r, SQLiteTransactionOptions as rt, DefaultSQLiteMigratorOptions as s, sqliteExecute as st, SQLiteDatabaseName as t, SQLiteTransaction as tt, SQLiteFileNameOrConnectionString as u, sqlitePool as v, AnySQLitePoolClientConnection as w, mapSqliteError as x, sqliteSingletonConnectionPool as y, SQLiteError as z };
|
|
198
|
+
//# sourceMappingURL=index-D1jryNqo.d.ts.map
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { La as AnySQLToken, ci as AnyTypeValidationError, cn as QueryResult, li as TypeValidationSuccess, ln as QueryResultRow } from "./index-zkszkJqP.js";
|
|
2
|
+
|
|
3
|
+
//#region src/core/sql/valueMappers/reservedSqlWords.d.ts
|
|
4
|
+
declare const ansiSqlReservedMap: {
|
|
5
|
+
[key: string]: boolean;
|
|
6
|
+
};
|
|
7
|
+
//#endregion
|
|
8
|
+
//#region src/core/sql/tokenizedSQL/tokenizedSQL.d.ts
|
|
9
|
+
type TokenizedSQL = Readonly<{
|
|
10
|
+
__brand: 'tokenized-sql';
|
|
11
|
+
sqlChunks: ReadonlyArray<string>;
|
|
12
|
+
sqlTokens: ReadonlyArray<AnySQLToken>;
|
|
13
|
+
}>;
|
|
14
|
+
declare const TokenizedSQL: {
|
|
15
|
+
(strings: ReadonlyArray<string>, values: unknown[]): TokenizedSQL;
|
|
16
|
+
paramPlaceholder: string;
|
|
17
|
+
empty: {
|
|
18
|
+
__brand: "tokenized-sql";
|
|
19
|
+
sqlChunks: string[];
|
|
20
|
+
sqlTokens: never[];
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
declare const isTokenizedSQL: (value: unknown) => value is TokenizedSQL;
|
|
24
|
+
//#endregion
|
|
25
|
+
//#region src/core/query/mappers.d.ts
|
|
26
|
+
declare const mapRows: <Result extends QueryResultRow = QueryResultRow, Mapped = unknown>(getResult: Promise<QueryResult<Result>>, map: (row: Result) => Mapped) => Promise<Mapped[]>;
|
|
27
|
+
declare const toCamelCase: (snakeStr: string) => string;
|
|
28
|
+
declare const mapToCamelCase: <T extends Record<string, unknown>>(obj: Record<string, unknown>) => T;
|
|
29
|
+
//#endregion
|
|
30
|
+
//#region src/core/query/selectors.d.ts
|
|
31
|
+
declare const firstOrNull: <Result extends QueryResultRow = QueryResultRow>(getResult: Promise<QueryResult<Result>>) => Promise<Result | null>;
|
|
32
|
+
declare const first: <Result extends QueryResultRow = QueryResultRow>(getResult: Promise<QueryResult<Result>>) => Promise<Result>;
|
|
33
|
+
declare const singleOrNull: <Result extends QueryResultRow = QueryResultRow>(getResult: Promise<QueryResult<Result>>) => Promise<Result | null>;
|
|
34
|
+
declare const single: <Result extends QueryResultRow = QueryResultRow>(getResult: Promise<QueryResult<Result>>) => Promise<Result>;
|
|
35
|
+
type CountSQLQueryResult = {
|
|
36
|
+
count: number;
|
|
37
|
+
};
|
|
38
|
+
declare const count: (getResult: Promise<QueryResult<CountSQLQueryResult>>) => Promise<number>;
|
|
39
|
+
type ExistsSQLQueryResult = {
|
|
40
|
+
exists: boolean | 1 | 0;
|
|
41
|
+
};
|
|
42
|
+
declare const exists: (getResult: Promise<QueryResult<ExistsSQLQueryResult>>) => Promise<boolean>;
|
|
43
|
+
//#endregion
|
|
44
|
+
//#region src/core/testing/typesTesting.d.ts
|
|
45
|
+
type Expect<T extends true> = T;
|
|
46
|
+
type Equals<X, Y> = (<T>() => T extends X ? 1 : 2) extends (<T>() => T extends Y ? 1 : 2) ? true : false;
|
|
47
|
+
type IsError<T> = T extends AnyTypeValidationError ? true : false;
|
|
48
|
+
type IsOK<T> = T extends TypeValidationSuccess ? true : false;
|
|
49
|
+
//#endregion
|
|
50
|
+
//#region src/core/tracing/printing/color.d.ts
|
|
51
|
+
declare const color: {
|
|
52
|
+
level: 0 | 1;
|
|
53
|
+
hex: (value: string) => (text: string) => string;
|
|
54
|
+
red: (value: string) => string;
|
|
55
|
+
green: (value: string) => string;
|
|
56
|
+
blue: (value: string) => string;
|
|
57
|
+
cyan: (value: string) => string;
|
|
58
|
+
yellow: (value: string) => string;
|
|
59
|
+
};
|
|
60
|
+
//#endregion
|
|
61
|
+
//#region src/core/tracing/printing/pretty.d.ts
|
|
62
|
+
declare const prettyJson: (obj: unknown, options?: {
|
|
63
|
+
handleMultiline?: boolean;
|
|
64
|
+
}) => string;
|
|
65
|
+
//#endregion
|
|
66
|
+
export { toCamelCase as _, IsError as a, ansiSqlReservedMap as b, ExistsSQLQueryResult as c, first as d, firstOrNull as f, mapToCamelCase as g, mapRows as h, Expect as i, count as l, singleOrNull as m, color as n, IsOK as o, single as p, Equals as r, CountSQLQueryResult as s, prettyJson as t, exists as u, TokenizedSQL as v, isTokenizedSQL as y };
|
|
67
|
+
//# sourceMappingURL=index-DaP2fTEX.d.ts.map
|
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
import { D as Connection, E as AnyConnection, F as InferDriverTypeFromConnection, Gt as DbSQLExecutor, I as InferTransactionFromConnection, Jt as SQLExecutor, K as DatabaseTransaction, P as InferDbClientFromConnection, R as InitTransaction, Ri as SQLFormatter, Wt as BatchSQLCommandOptions, co as JSONSerializer, gn as DumboError, i as DatabaseConnectionString, k as ConnectionOptions, p as ConnectionPool, q as DatabaseTransactionOptions, qt as SQLCommandOptions, rt as DatabaseDriverType, xt as MigratorOptions } from "./index-BDSQvDH2.cjs";
|
|
2
|
+
//#region src/storage/sqlite/core/execute/execute.d.ts
|
|
3
|
+
type SQLiteErrorMapper = (error: unknown) => DumboError;
|
|
4
|
+
declare const sqliteExecute: <Result = void>(database: SQLiteClient, handle: (client: SQLiteClient) => Promise<Result>) => Promise<Result>;
|
|
5
|
+
type SQLiteSQLExecutor<DriverType extends SQLiteDriverType = SQLiteDriverType> = DbSQLExecutor<DriverType, SQLiteClient>;
|
|
6
|
+
declare const sqliteSQLExecutor: <DriverType extends SQLiteDriverType = SQLiteDriverType>(driverType: DriverType, serializer: JSONSerializer, formatter?: SQLFormatter, errorMapper?: SQLiteErrorMapper) => SQLiteSQLExecutor<DriverType>;
|
|
7
|
+
//#endregion
|
|
8
|
+
//#region src/storage/sqlite/core/transactions/index.d.ts
|
|
9
|
+
type SQLiteTransaction<ConnectionType extends AnySQLiteConnection = AnySQLiteConnection, TransactionOptions extends SQLiteTransactionOptions = SQLiteTransactionOptions> = DatabaseTransaction<ConnectionType, TransactionOptions>;
|
|
10
|
+
type SQLiteTransactionMode = 'DEFERRED' | 'IMMEDIATE' | 'EXCLUSIVE';
|
|
11
|
+
type SQLiteTransactionOptions = DatabaseTransactionOptions & {
|
|
12
|
+
mode?: SQLiteTransactionMode;
|
|
13
|
+
useSavepoints?: boolean;
|
|
14
|
+
};
|
|
15
|
+
declare const sqliteTransaction: <ConnectionType extends AnySQLiteConnection = AnySQLiteConnection>(driverType: ConnectionType["driverType"], connection: () => ConnectionType, allowNestedTransactions: boolean, serializer: JSONSerializer, defaultTransactionMode?: "IMMEDIATE" | "DEFERRED" | "EXCLUSIVE") => (getClient: Promise<InferDbClientFromConnection<ConnectionType>>, options?: {
|
|
16
|
+
close: (client: InferDbClientFromConnection<ConnectionType>, error?: unknown) => Promise<void>;
|
|
17
|
+
} & SQLiteTransactionOptions) => InferTransactionFromConnection<ConnectionType>;
|
|
18
|
+
//#endregion
|
|
19
|
+
//#region src/storage/sqlite/core/connections/connectionString.d.ts
|
|
20
|
+
type SQLitePragmaOptions = {
|
|
21
|
+
journal_mode?: 'DELETE' | 'TRUNCATE' | 'PERSIST' | 'MEMORY' | 'WAL' | 'OFF';
|
|
22
|
+
synchronous?: 'OFF' | 'NORMAL' | 'FULL' | 'EXTRA';
|
|
23
|
+
cache_size?: number;
|
|
24
|
+
foreign_keys?: boolean;
|
|
25
|
+
temp_store?: 'DEFAULT' | 'FILE' | 'MEMORY';
|
|
26
|
+
busy_timeout?: number;
|
|
27
|
+
mmap_size?: number;
|
|
28
|
+
};
|
|
29
|
+
type SQLiteConnectionString = DatabaseConnectionString<'SQLite', `file:${string}` | `:memory:` | `/${string}` | `./${string}`>;
|
|
30
|
+
declare const SQLiteConnectionString: (connectionString: string) => SQLiteConnectionString;
|
|
31
|
+
declare const parsePragmasFromConnectionString: (connectionString: string | SQLiteConnectionString) => Partial<SQLitePragmaOptions>;
|
|
32
|
+
//#endregion
|
|
33
|
+
//#region src/storage/sqlite/core/connections/index.d.ts
|
|
34
|
+
type SQLiteCommandOptions = SQLCommandOptions & {
|
|
35
|
+
ignoreChangesCount?: boolean;
|
|
36
|
+
};
|
|
37
|
+
type BatchSQLiteCommandOptions = SQLiteCommandOptions & BatchSQLCommandOptions;
|
|
38
|
+
type SQLiteParameters = object | string | bigint | number | boolean | null;
|
|
39
|
+
type SQLiteClient = {
|
|
40
|
+
connect: () => Promise<void>;
|
|
41
|
+
close: () => Promise<void>;
|
|
42
|
+
} & SQLExecutor;
|
|
43
|
+
type SQLitePoolClient = {
|
|
44
|
+
release: () => void;
|
|
45
|
+
} & SQLExecutor;
|
|
46
|
+
type SQLiteClientFactory<SQLiteClientType extends SQLiteClient = SQLiteClient, ClientOptions = SQLiteClientOptions> = (options: ClientOptions) => SQLiteClientType;
|
|
47
|
+
type SQLiteClientOrPoolClient = SQLitePoolClient | SQLiteClient;
|
|
48
|
+
interface SQLiteError extends Error {
|
|
49
|
+
errno: number;
|
|
50
|
+
}
|
|
51
|
+
declare const isSQLiteError: (error: unknown) => error is SQLiteError;
|
|
52
|
+
type SQLiteClientConnection<Self extends AnyConnection = AnyConnection, DriverType extends SQLiteDriverType = SQLiteDriverType, SQLiteClientType extends SQLiteClient = SQLiteClient, TransactionType extends DatabaseTransaction<Self> = DatabaseTransaction<Self>> = Connection<Self, DriverType, SQLiteClientType, TransactionType>;
|
|
53
|
+
type SQLitePoolClientConnection<Self extends AnyConnection = AnyConnection, DriverType extends SQLiteDriverType = SQLiteDriverType, SQLitePoolClientType extends SQLitePoolClient = SQLitePoolClient, TransactionType extends DatabaseTransaction<Self> = DatabaseTransaction<Self>> = Connection<Self, DriverType, SQLitePoolClientType, TransactionType>;
|
|
54
|
+
type SQLiteConnection<Self extends AnyConnection = AnyConnection, DriverType extends SQLiteDriverType = SQLiteDriverType, SQLiteClientType extends SQLiteClientOrPoolClient = SQLiteClient | SQLitePoolClient, TransactionType extends DatabaseTransaction<Self> = DatabaseTransaction<Self>> = (SQLiteClientType extends SQLiteClient ? SQLiteClientConnection<Self, DriverType, SQLiteClientType, TransactionType> : never) | (SQLiteClientType extends SQLitePoolClient ? SQLitePoolClientConnection<Self, DriverType, SQLiteClientType, TransactionType> : never);
|
|
55
|
+
type AnySQLiteClientConnection = SQLiteClientConnection<any, any>;
|
|
56
|
+
type AnySQLitePoolClientConnection = SQLitePoolClientConnection<any, any, any, any>;
|
|
57
|
+
type AnySQLiteConnection = SQLiteConnection<any, any, any, any>;
|
|
58
|
+
type SQLiteConnectionOptions<ConnectionType extends AnySQLiteConnection = AnySQLiteConnection> = ConnectionOptions<ConnectionType> & SQLiteClientOptions;
|
|
59
|
+
type SQLiteClientConnectionDefinitionOptions<SQLiteConnectionType extends AnySQLiteClientConnection = AnySQLiteClientConnection, ConnectionOptions = SQLiteConnectionOptions> = {
|
|
60
|
+
driverType: InferDriverTypeFromConnection<SQLiteConnectionType>;
|
|
61
|
+
type: 'Client';
|
|
62
|
+
sqliteClientFactory: SQLiteClientFactory<InferDbClientFromConnection<SQLiteConnectionType>, ConnectionOptions>;
|
|
63
|
+
connectionOptions: SQLiteConnectionOptions<SQLiteConnectionType>;
|
|
64
|
+
serializer: JSONSerializer;
|
|
65
|
+
};
|
|
66
|
+
type SQLitePoolConnectionDefinitionOptions<SQLiteConnectionType extends AnySQLitePoolClientConnection = AnySQLitePoolClientConnection, ConnectionOptions = SQLiteConnectionOptions> = {
|
|
67
|
+
driverType: InferDriverTypeFromConnection<SQLiteConnectionType>;
|
|
68
|
+
type: 'PoolClient';
|
|
69
|
+
sqliteClientFactory: SQLiteClientFactory<InferDbClientFromConnection<SQLiteConnectionType>, ConnectionOptions>;
|
|
70
|
+
connectionOptions: SQLiteConnectionOptions<SQLiteConnectionType>;
|
|
71
|
+
serializer: JSONSerializer;
|
|
72
|
+
};
|
|
73
|
+
type SQLiteConnectionDefinitionOptions<SQLiteConnectionType extends AnySQLitePoolClientConnection = AnySQLitePoolClientConnection, ClientOptions = SQLiteClientOptions> = SQLiteClientConnectionDefinitionOptions<SQLiteConnectionType, ClientOptions> | SQLitePoolConnectionDefinitionOptions<SQLiteConnectionType, ClientOptions>;
|
|
74
|
+
type SQLiteConnectionFactory<SQLiteConnectionType extends AnySQLiteConnection = AnySQLiteConnection, ConnectionOptions extends SQLiteConnectionOptions = SQLiteConnectionOptions> = (options: ConnectionOptions) => SQLiteConnectionType;
|
|
75
|
+
type TransactionNestingCounter = {
|
|
76
|
+
increment: () => void;
|
|
77
|
+
decrement: () => void;
|
|
78
|
+
reset: () => void;
|
|
79
|
+
level: number;
|
|
80
|
+
};
|
|
81
|
+
declare const transactionNestingCounter: () => TransactionNestingCounter;
|
|
82
|
+
type SqliteAmbientClientConnectionOptions<SQLiteConnectionType extends AnySQLiteClientConnection = AnySQLiteClientConnection> = {
|
|
83
|
+
driverType: SQLiteConnectionType['driverType'];
|
|
84
|
+
client: InferDbClientFromConnection<SQLiteConnectionType>;
|
|
85
|
+
initTransaction?: InitTransaction<SQLiteConnectionType>;
|
|
86
|
+
allowNestedTransactions?: boolean;
|
|
87
|
+
defaultTransactionMode?: SQLiteTransactionMode;
|
|
88
|
+
serializer: JSONSerializer;
|
|
89
|
+
errorMapper?: SQLiteErrorMapper;
|
|
90
|
+
};
|
|
91
|
+
declare const sqliteAmbientClientConnection: <SQLiteConnectionType extends AnySQLiteClientConnection = AnySQLiteClientConnection>(options: SqliteAmbientClientConnectionOptions<SQLiteConnectionType>) => SQLiteConnectionType;
|
|
92
|
+
declare const sqliteClientConnection: <SQLiteConnectionType extends AnySQLiteClientConnection = AnySQLiteClientConnection, ClientOptions = SQLiteClientOptions>(options: SQLiteClientConnectionDefinitionOptions<SQLiteConnectionType, ClientOptions>) => SQLiteConnectionType;
|
|
93
|
+
declare const sqlitePoolClientConnection: <SQLiteConnectionType extends AnySQLiteClientConnection = AnySQLiteClientConnection, ClientOptions = SQLiteClientOptions>(options: SQLitePoolConnectionDefinitionOptions<SQLiteConnectionType, ClientOptions>) => SQLiteConnectionType;
|
|
94
|
+
declare function sqliteConnection<SQLiteConnectionType extends AnySQLiteConnection = AnySQLiteConnection, ClientOptions = SQLiteClientOptions>(options: SQLiteConnectionDefinitionOptions<SQLiteConnectionType, ClientOptions>): SQLiteConnectionType;
|
|
95
|
+
type InMemorySQLiteDatabase = ':memory:';
|
|
96
|
+
declare const InMemorySQLiteDatabase: SQLiteConnectionString;
|
|
97
|
+
declare const DEFAULT_SQLITE_PRAGMA_OPTIONS: SQLitePragmaOptions;
|
|
98
|
+
type SQLiteClientOptions = {
|
|
99
|
+
pragmaOptions?: Partial<SQLitePragmaOptions>;
|
|
100
|
+
defaultTransactionMode?: SQLiteTransactionMode;
|
|
101
|
+
skipDatabasePragmas?: boolean;
|
|
102
|
+
readonly?: boolean;
|
|
103
|
+
};
|
|
104
|
+
//#endregion
|
|
105
|
+
//#region src/storage/sqlite/core/errors/errorMapper.d.ts
|
|
106
|
+
/**
|
|
107
|
+
* Maps a SQLite error (from the `sqlite3` / node-sqlite3 driver) to a typed
|
|
108
|
+
* DumboError based on the SQLite result code.
|
|
109
|
+
*
|
|
110
|
+
* Result code reference: https://www.sqlite.org/rescode.html
|
|
111
|
+
*
|
|
112
|
+
* Falls back to a generic DumboError (500) if the error is not a recognized SQLite error.
|
|
113
|
+
*/
|
|
114
|
+
declare const mapSqliteError: (error: unknown) => DumboError;
|
|
115
|
+
//#endregion
|
|
116
|
+
//#region src/storage/sqlite/core/pool/dualPool.d.ts
|
|
117
|
+
type SQLiteDualPoolOptions<SQLiteConnectionType extends AnySQLiteConnection, ConnectionOptions extends SQLiteConnectionOptions> = {
|
|
118
|
+
driverType: SQLiteConnectionType['driverType'];
|
|
119
|
+
dual?: true;
|
|
120
|
+
singleton?: false;
|
|
121
|
+
pooled?: true;
|
|
122
|
+
connection?: never;
|
|
123
|
+
readerPoolSize?: number;
|
|
124
|
+
sqliteConnectionFactory: SQLiteConnectionFactory<SQLiteConnectionType, ConnectionOptions>;
|
|
125
|
+
connectionOptions?: ConnectionOptions;
|
|
126
|
+
};
|
|
127
|
+
//#endregion
|
|
128
|
+
//#region src/storage/sqlite/core/pool/pool.d.ts
|
|
129
|
+
type SQLiteFileNameOrConnectionString = {
|
|
130
|
+
fileName: string | SQLiteConnectionString;
|
|
131
|
+
connectionString?: never;
|
|
132
|
+
} | {
|
|
133
|
+
connectionString: string | SQLiteConnectionString;
|
|
134
|
+
fileName?: never;
|
|
135
|
+
};
|
|
136
|
+
declare const isInMemoryDatabase: (options: Record<string, unknown>) => boolean;
|
|
137
|
+
type SQLiteAmbientConnectionPool<SQLiteConnectionType extends AnySQLiteConnection = AnySQLiteConnection> = ConnectionPool<SQLiteConnectionType>;
|
|
138
|
+
type SQLiteAmbientConnectionPoolOptions<SQLiteConnectionType extends AnySQLiteConnection = AnySQLiteConnection> = {
|
|
139
|
+
singleton?: true;
|
|
140
|
+
pooled?: false;
|
|
141
|
+
sqliteConnectionFactory?: never;
|
|
142
|
+
connection: SQLiteConnectionType;
|
|
143
|
+
connectionOptions?: never;
|
|
144
|
+
};
|
|
145
|
+
declare const sqliteAmbientConnectionPool: <SQLiteConnectionType extends AnySQLiteConnection = AnySQLiteConnection>(options: {
|
|
146
|
+
driverType: SQLiteConnectionType["driverType"];
|
|
147
|
+
} & SQLiteAmbientConnectionPoolOptions<SQLiteConnectionType["driverType"]>) => SQLiteAmbientConnectionPool<SQLiteConnectionType["driverType"]>;
|
|
148
|
+
type SQLiteSingletonConnectionPoolOptions<SQLiteConnectionType extends AnySQLiteConnection = AnySQLiteConnection, ConnectionOptions extends SQLiteConnectionOptions = SQLiteConnectionOptions> = {
|
|
149
|
+
singleton: true;
|
|
150
|
+
pooled?: true;
|
|
151
|
+
sqliteConnectionFactory: SQLiteConnectionFactory<SQLiteConnectionType, ConnectionOptions>;
|
|
152
|
+
connection?: never;
|
|
153
|
+
connectionOptions: ConnectionOptions;
|
|
154
|
+
};
|
|
155
|
+
type SQLiteSingletonConnectionPool<SQLiteConnectionType extends AnySQLiteConnection = AnySQLiteConnection> = ConnectionPool<SQLiteConnectionType>;
|
|
156
|
+
declare const sqliteSingletonConnectionPool: <SQLiteConnectionType extends AnySQLiteConnection = AnySQLiteConnection, ConnectionOptions extends SQLiteConnectionOptions & Record<string, unknown> = SQLiteConnectionOptions & Record<string, unknown>>(options: {
|
|
157
|
+
driverType: SQLiteConnectionType["driverType"];
|
|
158
|
+
} & SQLiteSingletonConnectionPoolOptions<SQLiteConnectionType, ConnectionOptions>) => SQLiteSingletonConnectionPool<SQLiteConnectionType>;
|
|
159
|
+
type SQLiteAlwaysNewPoolOptions<SQLiteConnectionType extends AnySQLiteConnection = AnySQLiteConnection, ConnectionOptions extends SQLiteConnectionOptions = SQLiteConnectionOptions> = {
|
|
160
|
+
singleton?: false;
|
|
161
|
+
pooled?: true;
|
|
162
|
+
sqliteConnectionFactory: SQLiteConnectionFactory<SQLiteConnectionType, ConnectionOptions>;
|
|
163
|
+
connection?: never;
|
|
164
|
+
connectionOptions: ConnectionOptions;
|
|
165
|
+
};
|
|
166
|
+
type SQLiteAlwaysNewConnectionPool<SQLiteConnectionType extends AnySQLiteConnection = AnySQLiteConnection> = ConnectionPool<SQLiteConnectionType>;
|
|
167
|
+
declare const sqliteAlwaysNewConnectionPool: <SQLiteConnectionType extends AnySQLiteConnection = AnySQLiteConnection, ConnectionOptions extends SQLiteConnectionOptions & Record<string, unknown> = SQLiteConnectionOptions & Record<string, unknown>>(options: {
|
|
168
|
+
driverType: SQLiteConnectionType["driverType"];
|
|
169
|
+
} & SQLiteAlwaysNewPoolOptions<SQLiteConnectionType, ConnectionOptions>) => SQLiteAlwaysNewConnectionPool<SQLiteConnectionType>;
|
|
170
|
+
type SQLitePoolOptions<SQLiteConnectionType extends AnySQLiteConnection = AnySQLiteConnection, ConnectionOptions extends SQLiteConnectionOptions = SQLiteConnectionOptions> = (SQLiteAlwaysNewPoolOptions<SQLiteConnectionType, ConnectionOptions> | SQLiteSingletonConnectionPoolOptions<SQLiteConnectionType, ConnectionOptions> | SQLiteAmbientConnectionPoolOptions<SQLiteConnectionType> | SQLiteDualPoolOptions<SQLiteConnectionType, ConnectionOptions>) & {
|
|
171
|
+
driverType: SQLiteConnectionType['driverType'];
|
|
172
|
+
serializer?: JSONSerializer;
|
|
173
|
+
};
|
|
174
|
+
type SQLitePool<SQLiteConnectionType extends AnySQLiteConnection = AnySQLiteConnection> = SQLiteAmbientConnectionPool<SQLiteConnectionType> | SQLiteSingletonConnectionPool<SQLiteConnectionType> | SQLiteAlwaysNewConnectionPool<SQLiteConnectionType>;
|
|
175
|
+
type SQLitePoolFactoryOptions<SQLiteConnectionType extends AnySQLiteConnection, ConnectionOptions extends SQLiteConnectionOptions> = Omit<SQLitePoolOptions<SQLiteConnectionType, ConnectionOptions>, 'singleton'> & {
|
|
176
|
+
singleton?: boolean;
|
|
177
|
+
};
|
|
178
|
+
declare const toSqlitePoolOptions: <SQLiteConnectionType extends AnySQLiteConnection, ConnectionOptions extends SQLiteConnectionOptions>(options: SQLitePoolFactoryOptions<SQLiteConnectionType, ConnectionOptions>) => SQLitePoolOptions<SQLiteConnectionType, ConnectionOptions>;
|
|
179
|
+
declare function sqlitePool<SQLiteConnectionType extends AnySQLiteConnection = AnySQLiteConnection, ConnectionOptions extends SQLiteConnectionOptions = SQLiteConnectionOptions>(options: SQLitePoolOptions<SQLiteConnectionType, ConnectionOptions>): SQLitePool<SQLiteConnectionType>;
|
|
180
|
+
//#endregion
|
|
181
|
+
//#region src/storage/sqlite/core/schema/migrations.d.ts
|
|
182
|
+
declare const DefaultSQLiteMigratorOptions: MigratorOptions;
|
|
183
|
+
//#endregion
|
|
184
|
+
//#region src/storage/sqlite/core/schema/schema.d.ts
|
|
185
|
+
declare const defaultSQLiteDatabase = ":memory:";
|
|
186
|
+
declare const tableExists: (execute: SQLExecutor, tableName: string) => Promise<boolean>;
|
|
187
|
+
//#endregion
|
|
188
|
+
//#region src/storage/sqlite/core/sql/formatter/index.d.ts
|
|
189
|
+
declare const sqliteFormatter: SQLFormatter;
|
|
190
|
+
//#endregion
|
|
191
|
+
//#region src/storage/sqlite/core/index.d.ts
|
|
192
|
+
type SQLiteDatabaseName = 'SQLite';
|
|
193
|
+
declare const SQLiteDatabaseName = "SQLite";
|
|
194
|
+
type SQLiteDriverType<DriverName extends string = string> = DatabaseDriverType<SQLiteDatabaseName, DriverName>;
|
|
195
|
+
type SQLiteDatabaseType = 'SQLite';
|
|
196
|
+
//#endregion
|
|
197
|
+
export { SQLitePragmaOptions as $, SQLiteClientConnectionDefinitionOptions as A, SQLiteParameters as B, AnySQLiteConnection as C, InMemorySQLiteDatabase as D, DEFAULT_SQLITE_PRAGMA_OPTIONS as E, SQLiteConnection as F, TransactionNestingCounter as G, SQLitePoolClientConnection as H, SQLiteConnectionDefinitionOptions as I, sqliteClientConnection as J, isSQLiteError as K, SQLiteConnectionFactory as L, SQLiteClientOptions as M, SQLiteClientOrPoolClient as N, SQLiteClient as O, SQLiteCommandOptions as P, SQLiteConnectionString as Q, SQLiteConnectionOptions as R, AnySQLiteClientConnection as S, BatchSQLiteCommandOptions as T, SQLitePoolConnectionDefinitionOptions as U, SQLitePoolClient as V, SqliteAmbientClientConnectionOptions as W, sqlitePoolClientConnection as X, sqliteConnection as Y, transactionNestingCounter as Z, sqliteAmbientConnectionPool as _, defaultSQLiteDatabase as a, SQLiteErrorMapper as at, toSqlitePoolOptions as b, SQLiteAlwaysNewConnectionPool as c, sqliteSQLExecutor as ct, SQLitePool as d, parsePragmasFromConnectionString as et, SQLitePoolFactoryOptions as f, sqliteAlwaysNewConnectionPool as g, isInMemoryDatabase as h, sqliteFormatter as i, sqliteTransaction as it, SQLiteClientFactory as j, SQLiteClientConnection as k, SQLiteAmbientConnectionPool as l, SQLiteSingletonConnectionPool as m, SQLiteDatabaseType as n, SQLiteTransactionMode as nt, tableExists as o, SQLiteSQLExecutor as ot, SQLitePoolOptions as p, sqliteAmbientClientConnection as q, SQLiteDriverType as r, SQLiteTransactionOptions as rt, DefaultSQLiteMigratorOptions as s, sqliteExecute as st, SQLiteDatabaseName as t, SQLiteTransaction as tt, SQLiteFileNameOrConnectionString as u, sqlitePool as v, AnySQLitePoolClientConnection as w, mapSqliteError as x, sqliteSingletonConnectionPool as y, SQLiteError as z };
|
|
198
|
+
//# sourceMappingURL=index-DqVvUav9.d.cts.map
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { La as AnySQLToken, ci as AnyTypeValidationError, cn as QueryResult, li as TypeValidationSuccess, ln as QueryResultRow } from "./index-BDSQvDH2.cjs";
|
|
2
|
+
|
|
3
|
+
//#region src/core/sql/valueMappers/reservedSqlWords.d.ts
|
|
4
|
+
declare const ansiSqlReservedMap: {
|
|
5
|
+
[key: string]: boolean;
|
|
6
|
+
};
|
|
7
|
+
//#endregion
|
|
8
|
+
//#region src/core/sql/tokenizedSQL/tokenizedSQL.d.ts
|
|
9
|
+
type TokenizedSQL = Readonly<{
|
|
10
|
+
__brand: 'tokenized-sql';
|
|
11
|
+
sqlChunks: ReadonlyArray<string>;
|
|
12
|
+
sqlTokens: ReadonlyArray<AnySQLToken>;
|
|
13
|
+
}>;
|
|
14
|
+
declare const TokenizedSQL: {
|
|
15
|
+
(strings: ReadonlyArray<string>, values: unknown[]): TokenizedSQL;
|
|
16
|
+
paramPlaceholder: string;
|
|
17
|
+
empty: {
|
|
18
|
+
__brand: "tokenized-sql";
|
|
19
|
+
sqlChunks: string[];
|
|
20
|
+
sqlTokens: never[];
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
declare const isTokenizedSQL: (value: unknown) => value is TokenizedSQL;
|
|
24
|
+
//#endregion
|
|
25
|
+
//#region src/core/query/mappers.d.ts
|
|
26
|
+
declare const mapRows: <Result extends QueryResultRow = QueryResultRow, Mapped = unknown>(getResult: Promise<QueryResult<Result>>, map: (row: Result) => Mapped) => Promise<Mapped[]>;
|
|
27
|
+
declare const toCamelCase: (snakeStr: string) => string;
|
|
28
|
+
declare const mapToCamelCase: <T extends Record<string, unknown>>(obj: Record<string, unknown>) => T;
|
|
29
|
+
//#endregion
|
|
30
|
+
//#region src/core/query/selectors.d.ts
|
|
31
|
+
declare const firstOrNull: <Result extends QueryResultRow = QueryResultRow>(getResult: Promise<QueryResult<Result>>) => Promise<Result | null>;
|
|
32
|
+
declare const first: <Result extends QueryResultRow = QueryResultRow>(getResult: Promise<QueryResult<Result>>) => Promise<Result>;
|
|
33
|
+
declare const singleOrNull: <Result extends QueryResultRow = QueryResultRow>(getResult: Promise<QueryResult<Result>>) => Promise<Result | null>;
|
|
34
|
+
declare const single: <Result extends QueryResultRow = QueryResultRow>(getResult: Promise<QueryResult<Result>>) => Promise<Result>;
|
|
35
|
+
type CountSQLQueryResult = {
|
|
36
|
+
count: number;
|
|
37
|
+
};
|
|
38
|
+
declare const count: (getResult: Promise<QueryResult<CountSQLQueryResult>>) => Promise<number>;
|
|
39
|
+
type ExistsSQLQueryResult = {
|
|
40
|
+
exists: boolean | 1 | 0;
|
|
41
|
+
};
|
|
42
|
+
declare const exists: (getResult: Promise<QueryResult<ExistsSQLQueryResult>>) => Promise<boolean>;
|
|
43
|
+
//#endregion
|
|
44
|
+
//#region src/core/testing/typesTesting.d.ts
|
|
45
|
+
type Expect<T extends true> = T;
|
|
46
|
+
type Equals<X, Y> = (<T>() => T extends X ? 1 : 2) extends (<T>() => T extends Y ? 1 : 2) ? true : false;
|
|
47
|
+
type IsError<T> = T extends AnyTypeValidationError ? true : false;
|
|
48
|
+
type IsOK<T> = T extends TypeValidationSuccess ? true : false;
|
|
49
|
+
//#endregion
|
|
50
|
+
//#region src/core/tracing/printing/color.d.ts
|
|
51
|
+
declare const color: {
|
|
52
|
+
level: 0 | 1;
|
|
53
|
+
hex: (value: string) => (text: string) => string;
|
|
54
|
+
red: (value: string) => string;
|
|
55
|
+
green: (value: string) => string;
|
|
56
|
+
blue: (value: string) => string;
|
|
57
|
+
cyan: (value: string) => string;
|
|
58
|
+
yellow: (value: string) => string;
|
|
59
|
+
};
|
|
60
|
+
//#endregion
|
|
61
|
+
//#region src/core/tracing/printing/pretty.d.ts
|
|
62
|
+
declare const prettyJson: (obj: unknown, options?: {
|
|
63
|
+
handleMultiline?: boolean;
|
|
64
|
+
}) => string;
|
|
65
|
+
//#endregion
|
|
66
|
+
export { toCamelCase as _, IsError as a, ansiSqlReservedMap as b, ExistsSQLQueryResult as c, first as d, firstOrNull as f, mapToCamelCase as g, mapRows as h, Expect as i, count as l, singleOrNull as m, color as n, IsOK as o, single as p, Equals as r, CountSQLQueryResult as s, prettyJson as t, exists as u, TokenizedSQL as v, isTokenizedSQL as y };
|
|
67
|
+
//# sourceMappingURL=index-S_wp0Eaf.d.cts.map
|