@event-driven-io/dumbo 0.13.0-beta.3 → 0.13.0-beta.31
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-4SM4JJJZ.js +83 -0
- package/dist/chunk-4SM4JJJZ.js.map +1 -0
- package/dist/chunk-EEKBLOCH.cjs +706 -0
- package/dist/chunk-EEKBLOCH.cjs.map +1 -0
- package/dist/{chunk-OJ34O3Q2.cjs → chunk-GVR3PSDL.cjs} +2474 -1636
- package/dist/chunk-GVR3PSDL.cjs.map +1 -0
- package/dist/chunk-HZM7GDOT.cjs +34 -0
- package/dist/chunk-HZM7GDOT.cjs.map +1 -0
- package/dist/{chunk-N7RWT46K.js → chunk-JKE6SULM.js} +2522 -1684
- package/dist/chunk-JKE6SULM.js.map +1 -0
- package/dist/chunk-MOPKHYYU.cjs +83 -0
- package/dist/chunk-MOPKHYYU.cjs.map +1 -0
- package/dist/chunk-RA2L3FQW.js +481 -0
- package/dist/chunk-RA2L3FQW.js.map +1 -0
- package/dist/chunk-UA542GT3.cjs +481 -0
- package/dist/chunk-UA542GT3.cjs.map +1 -0
- package/dist/chunk-WLWELSA2.js +34 -0
- package/dist/chunk-WLWELSA2.js.map +1 -0
- package/dist/chunk-XFEGS3YT.js +706 -0
- package/dist/chunk-XFEGS3YT.js.map +1 -0
- package/dist/cloudflare.cjs +456 -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 +456 -0
- package/dist/cloudflare.js.map +1 -0
- package/dist/{columnProcessors-DMPpTPqM.d.ts → columnProcessors-Be2uMYjS.d.cts} +1 -1
- package/dist/{columnProcessors-BX-sH7ah.d.cts → columnProcessors-D0ivj_SU.d.ts} +1 -1
- package/dist/{connectionString-B1wm0TFc.d.cts → connectionString-Dch_MIRU.d.cts} +394 -168
- package/dist/{connectionString-B1wm0TFc.d.ts → connectionString-Dch_MIRU.d.ts} +394 -168
- package/dist/index.cjs +100 -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 +105 -9
- package/dist/index.js.map +1 -1
- package/dist/pg.cjs +383 -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 +435 -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 +60 -0
- package/dist/sqlite.cjs.map +1 -0
- package/dist/{index-C2z_XBn6.d.ts → sqlite.d.cts} +69 -20
- package/dist/{index-C0h0c380.d.cts → sqlite.d.ts} +69 -20
- package/dist/sqlite.js +60 -0
- package/dist/sqlite3.cjs +319 -6
- package/dist/sqlite3.cjs.map +1 -1
- package/dist/sqlite3.d.cts +45 -25
- package/dist/sqlite3.d.ts +45 -25
- package/dist/sqlite3.js +335 -22
- package/dist/sqlite3.js.map +1 -1
- package/package.json +55 -33
- 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 +0 -405
- 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
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { g as DatabaseMetadata, aE as DatabaseConnectionString, m as DumboError, aH as DatabaseLock, ch as SQLExecutor, O as AcquireDatabaseLockOptions, aI as DatabaseLockOptions, N as AcquireDatabaseLockMode, c8 as ReleaseDatabaseLockOptions, M as MigratorOptions, ca as SQL, f as SQLFormatter, a as SQLProcessor, n as SQLArray, o as SQLIn, x as DatabaseDriverType } from './connectionString-Dch_MIRU.cjs';
|
|
2
|
+
import { D as DefaultSQLColumnProcessors } from './columnProcessors-Be2uMYjS.cjs';
|
|
3
|
+
|
|
4
|
+
declare const postgreSQLMetadata: DatabaseMetadata<true, true, true>;
|
|
5
|
+
|
|
6
|
+
declare const defaultPostgreSQLConnectionString: PostgreSQLConnectionString;
|
|
7
|
+
type PostgreSQLConnectionString = DatabaseConnectionString<'PostgreSQL', `postgresql://${string}` | `postgres://${string}`>;
|
|
8
|
+
declare const PostgreSQLConnectionString: (connectionString: string) => PostgreSQLConnectionString;
|
|
9
|
+
/**
|
|
10
|
+
* Parse database name from a PostgreSQL connection string
|
|
11
|
+
*/
|
|
12
|
+
declare function parseDatabaseName(str: string): string | null;
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Maps a PostgreSQL error (from the `pg` driver) to a typed DumboError
|
|
16
|
+
* based on the SQLSTATE code.
|
|
17
|
+
*
|
|
18
|
+
* SQLSTATE reference: https://www.postgresql.org/docs/current/errcodes-appendix.html
|
|
19
|
+
* Transient classification based on Npgsql's PostgresException.IsTransient.
|
|
20
|
+
*
|
|
21
|
+
* Falls back to a generic DumboError (500) if the error is not a recognized PostgreSQL error.
|
|
22
|
+
*/
|
|
23
|
+
declare const mapPostgresError: (error: unknown) => DumboError;
|
|
24
|
+
|
|
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
|
+
|
|
42
|
+
declare const DefaultPostgreSQLMigratorOptions: MigratorOptions;
|
|
43
|
+
|
|
44
|
+
declare const defaultPostgreSqlDatabase = "postgres";
|
|
45
|
+
declare const tableExistsSQL: (tableName: string) => SQL;
|
|
46
|
+
declare const tableExists: (execute: SQLExecutor, tableName: string) => Promise<boolean>;
|
|
47
|
+
declare const functionExistsSQL: (functionName: string) => SQL;
|
|
48
|
+
declare const functionExists: (execute: SQLExecutor, functionName: string) => Promise<boolean>;
|
|
49
|
+
|
|
50
|
+
declare const pgFormatter: SQLFormatter;
|
|
51
|
+
|
|
52
|
+
declare const PostgreSQLArrayProcessor: SQLProcessor<SQLArray>;
|
|
53
|
+
declare const PostgreSQLExpandSQLInProcessor: SQLProcessor<SQLIn>;
|
|
54
|
+
|
|
55
|
+
declare const postgreSQLColumnProcessors: DefaultSQLColumnProcessors;
|
|
56
|
+
|
|
57
|
+
type PostgreSQLDatabaseName = 'PostgreSQL';
|
|
58
|
+
declare const PostgreSQLDatabaseName = "PostgreSQL";
|
|
59
|
+
type PostgreSQLDriverType<DriverName extends string = string> = DatabaseDriverType<PostgreSQLDatabaseName, DriverName>;
|
|
60
|
+
|
|
61
|
+
export { AdvisoryLock, DefaultPostgreSQLMigratorOptions, PostgreSQLArrayProcessor, PostgreSQLConnectionString, PostgreSQLDatabaseName, type PostgreSQLDriverType, PostgreSQLExpandSQLInProcessor, acquireAdvisoryLock, advisoryLock, defaultPostgreSQLConnectionString, defaultPostgreSqlDatabase, functionExists, functionExistsSQL, mapPostgresError, parseDatabaseName, pgFormatter, postgreSQLColumnProcessors, postgreSQLMetadata, releaseAdvisoryLock, tableExists, tableExistsSQL, tryAcquireAdvisoryLock };
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { g as DatabaseMetadata, aE as DatabaseConnectionString, m as DumboError, aH as DatabaseLock, ch as SQLExecutor, O as AcquireDatabaseLockOptions, aI as DatabaseLockOptions, N as AcquireDatabaseLockMode, c8 as ReleaseDatabaseLockOptions, M as MigratorOptions, ca as SQL, f as SQLFormatter, a as SQLProcessor, n as SQLArray, o as SQLIn, x as DatabaseDriverType } from './connectionString-Dch_MIRU.js';
|
|
2
|
+
import { D as DefaultSQLColumnProcessors } from './columnProcessors-D0ivj_SU.js';
|
|
3
|
+
|
|
4
|
+
declare const postgreSQLMetadata: DatabaseMetadata<true, true, true>;
|
|
5
|
+
|
|
6
|
+
declare const defaultPostgreSQLConnectionString: PostgreSQLConnectionString;
|
|
7
|
+
type PostgreSQLConnectionString = DatabaseConnectionString<'PostgreSQL', `postgresql://${string}` | `postgres://${string}`>;
|
|
8
|
+
declare const PostgreSQLConnectionString: (connectionString: string) => PostgreSQLConnectionString;
|
|
9
|
+
/**
|
|
10
|
+
* Parse database name from a PostgreSQL connection string
|
|
11
|
+
*/
|
|
12
|
+
declare function parseDatabaseName(str: string): string | null;
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Maps a PostgreSQL error (from the `pg` driver) to a typed DumboError
|
|
16
|
+
* based on the SQLSTATE code.
|
|
17
|
+
*
|
|
18
|
+
* SQLSTATE reference: https://www.postgresql.org/docs/current/errcodes-appendix.html
|
|
19
|
+
* Transient classification based on Npgsql's PostgresException.IsTransient.
|
|
20
|
+
*
|
|
21
|
+
* Falls back to a generic DumboError (500) if the error is not a recognized PostgreSQL error.
|
|
22
|
+
*/
|
|
23
|
+
declare const mapPostgresError: (error: unknown) => DumboError;
|
|
24
|
+
|
|
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
|
+
|
|
42
|
+
declare const DefaultPostgreSQLMigratorOptions: MigratorOptions;
|
|
43
|
+
|
|
44
|
+
declare const defaultPostgreSqlDatabase = "postgres";
|
|
45
|
+
declare const tableExistsSQL: (tableName: string) => SQL;
|
|
46
|
+
declare const tableExists: (execute: SQLExecutor, tableName: string) => Promise<boolean>;
|
|
47
|
+
declare const functionExistsSQL: (functionName: string) => SQL;
|
|
48
|
+
declare const functionExists: (execute: SQLExecutor, functionName: string) => Promise<boolean>;
|
|
49
|
+
|
|
50
|
+
declare const pgFormatter: SQLFormatter;
|
|
51
|
+
|
|
52
|
+
declare const PostgreSQLArrayProcessor: SQLProcessor<SQLArray>;
|
|
53
|
+
declare const PostgreSQLExpandSQLInProcessor: SQLProcessor<SQLIn>;
|
|
54
|
+
|
|
55
|
+
declare const postgreSQLColumnProcessors: DefaultSQLColumnProcessors;
|
|
56
|
+
|
|
57
|
+
type PostgreSQLDatabaseName = 'PostgreSQL';
|
|
58
|
+
declare const PostgreSQLDatabaseName = "PostgreSQL";
|
|
59
|
+
type PostgreSQLDriverType<DriverName extends string = string> = DatabaseDriverType<PostgreSQLDatabaseName, DriverName>;
|
|
60
|
+
|
|
61
|
+
export { AdvisoryLock, DefaultPostgreSQLMigratorOptions, PostgreSQLArrayProcessor, PostgreSQLConnectionString, PostgreSQLDatabaseName, type PostgreSQLDriverType, PostgreSQLExpandSQLInProcessor, acquireAdvisoryLock, advisoryLock, defaultPostgreSQLConnectionString, defaultPostgreSqlDatabase, functionExists, functionExistsSQL, mapPostgresError, parseDatabaseName, pgFormatter, postgreSQLColumnProcessors, postgreSQLMetadata, releaseAdvisoryLock, tableExists, tableExistsSQL, tryAcquireAdvisoryLock };
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import {
|
|
2
|
+
AdvisoryLock,
|
|
3
|
+
DefaultPostgreSQLMigratorOptions,
|
|
4
|
+
PostgreSQLArrayProcessor,
|
|
5
|
+
PostgreSQLDatabaseName,
|
|
6
|
+
PostgreSQLExpandSQLInProcessor,
|
|
7
|
+
acquireAdvisoryLock,
|
|
8
|
+
advisoryLock,
|
|
9
|
+
mapPostgresError,
|
|
10
|
+
pgFormatter,
|
|
11
|
+
postgreSQLColumnProcessors,
|
|
12
|
+
releaseAdvisoryLock,
|
|
13
|
+
tryAcquireAdvisoryLock
|
|
14
|
+
} from "./chunk-RA2L3FQW.js";
|
|
15
|
+
import {
|
|
16
|
+
PostgreSQLConnectionString,
|
|
17
|
+
defaultPostgreSQLConnectionString,
|
|
18
|
+
defaultPostgreSqlDatabase,
|
|
19
|
+
functionExists,
|
|
20
|
+
functionExistsSQL,
|
|
21
|
+
parseDatabaseName,
|
|
22
|
+
postgreSQLMetadata,
|
|
23
|
+
tableExists,
|
|
24
|
+
tableExistsSQL
|
|
25
|
+
} from "./chunk-4SM4JJJZ.js";
|
|
26
|
+
import "./chunk-JKE6SULM.js";
|
|
27
|
+
export {
|
|
28
|
+
AdvisoryLock,
|
|
29
|
+
DefaultPostgreSQLMigratorOptions,
|
|
30
|
+
PostgreSQLArrayProcessor,
|
|
31
|
+
PostgreSQLConnectionString,
|
|
32
|
+
PostgreSQLDatabaseName,
|
|
33
|
+
PostgreSQLExpandSQLInProcessor,
|
|
34
|
+
acquireAdvisoryLock,
|
|
35
|
+
advisoryLock,
|
|
36
|
+
defaultPostgreSQLConnectionString,
|
|
37
|
+
defaultPostgreSqlDatabase,
|
|
38
|
+
functionExists,
|
|
39
|
+
functionExistsSQL,
|
|
40
|
+
mapPostgresError,
|
|
41
|
+
parseDatabaseName,
|
|
42
|
+
pgFormatter,
|
|
43
|
+
postgreSQLColumnProcessors,
|
|
44
|
+
postgreSQLMetadata,
|
|
45
|
+
releaseAdvisoryLock,
|
|
46
|
+
tableExists,
|
|
47
|
+
tableExistsSQL,
|
|
48
|
+
tryAcquireAdvisoryLock
|
|
49
|
+
};
|
|
50
|
+
//# sourceMappingURL=postgresql.js.map
|
package/dist/sqlite.cjs
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
var _chunkEEKBLOCHcjs = require('./chunk-EEKBLOCH.cjs');
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
var _chunkHZM7GDOTcjs = require('./chunk-HZM7GDOT.cjs');
|
|
31
|
+
require('./chunk-GVR3PSDL.cjs');
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
exports.DEFAULT_SQLITE_PRAGMA_OPTIONS = _chunkEEKBLOCHcjs.DEFAULT_SQLITE_PRAGMA_OPTIONS; exports.DefaultSQLiteMigratorOptions = _chunkEEKBLOCHcjs.DefaultSQLiteMigratorOptions; exports.InMemorySQLiteDatabase = _chunkEEKBLOCHcjs.InMemorySQLiteDatabase; exports.SQLiteConnectionString = _chunkEEKBLOCHcjs.SQLiteConnectionString; exports.SQLiteDatabaseName = _chunkEEKBLOCHcjs.SQLiteDatabaseName; exports.defaultSQLiteDatabase = _chunkHZM7GDOTcjs.defaultSQLiteDatabase; exports.isInMemoryDatabase = _chunkEEKBLOCHcjs.isInMemoryDatabase; exports.isSQLiteError = _chunkEEKBLOCHcjs.isSQLiteError; exports.mapSqliteError = _chunkEEKBLOCHcjs.mapSqliteError; exports.parsePragmasFromConnectionString = _chunkEEKBLOCHcjs.parsePragmasFromConnectionString; exports.sqliteAlwaysNewConnectionPool = _chunkEEKBLOCHcjs.sqliteAlwaysNewConnectionPool; exports.sqliteAmbientClientConnection = _chunkEEKBLOCHcjs.sqliteAmbientClientConnection; exports.sqliteAmbientConnectionPool = _chunkEEKBLOCHcjs.sqliteAmbientConnectionPool; exports.sqliteClientConnection = _chunkEEKBLOCHcjs.sqliteClientConnection; exports.sqliteConnection = _chunkEEKBLOCHcjs.sqliteConnection; exports.sqliteExecute = _chunkEEKBLOCHcjs.sqliteExecute; exports.sqliteFormatter = _chunkEEKBLOCHcjs.sqliteFormatter; exports.sqliteMetadata = _chunkHZM7GDOTcjs.sqliteMetadata; exports.sqlitePool = _chunkEEKBLOCHcjs.sqlitePool; exports.sqlitePoolClientConnection = _chunkEEKBLOCHcjs.sqlitePoolClientConnection; exports.sqliteSQLExecutor = _chunkEEKBLOCHcjs.sqliteSQLExecutor; exports.sqliteSingletonConnectionPool = _chunkEEKBLOCHcjs.sqliteSingletonConnectionPool; exports.sqliteTransaction = _chunkEEKBLOCHcjs.sqliteTransaction; exports.tableExists = _chunkHZM7GDOTcjs.tableExists; exports.toSqlitePoolOptions = _chunkEEKBLOCHcjs.toSqlitePoolOptions; exports.transactionNestingCounter = _chunkEEKBLOCHcjs.transactionNestingCounter;
|
|
60
|
+
//# sourceMappingURL=sqlite.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["/home/runner/work/Pongo/Pongo/src/packages/dumbo/dist/sqlite.cjs"],"names":[],"mappings":"AAAA;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACF,wDAA6B;AAC7B;AACE;AACA;AACA;AACF,wDAA6B;AAC7B,gCAA6B;AAC7B;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACF,q1DAAC","file":"/home/runner/work/Pongo/Pongo/src/packages/dumbo/dist/sqlite.cjs"}
|
|
@@ -1,11 +1,25 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { g as DatabaseMetadata, h as DatabaseTransactionOptions, i as DatabaseTransaction, J as JSONSerializer, bg as InferDbClientFromConnection, bn as InferTransactionFromConnection, aE as DatabaseConnectionString, A as AnyConnection, ch as SQLExecutor, C as Connection, ce as SQLCommandOptions, aa as BatchSQLCommandOptions, e as ConnectionOptions, bi as InferDriverTypeFromConnection, bq as InitTransaction, m as DumboError, l as DbSQLExecutor, f as SQLFormatter, j as ConnectionPool, M as MigratorOptions, x as DatabaseDriverType } from './connectionString-Dch_MIRU.cjs';
|
|
2
|
+
|
|
3
|
+
declare const sqliteMetadata: DatabaseMetadata<false, false, false>;
|
|
4
|
+
|
|
5
|
+
type SQLiteTransaction<ConnectionType extends AnySQLiteConnection = AnySQLiteConnection, TransactionOptions extends SQLiteTransactionOptions = SQLiteTransactionOptions> = DatabaseTransaction<ConnectionType, TransactionOptions>;
|
|
6
|
+
type SQLiteTransactionMode = 'DEFERRED' | 'IMMEDIATE' | 'EXCLUSIVE';
|
|
7
|
+
type SQLiteTransactionOptions = DatabaseTransactionOptions & {
|
|
8
|
+
mode?: SQLiteTransactionMode;
|
|
9
|
+
useSavepoints?: boolean;
|
|
10
|
+
};
|
|
11
|
+
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?: {
|
|
12
|
+
close: (client: InferDbClientFromConnection<ConnectionType>, error?: unknown) => Promise<void>;
|
|
13
|
+
} & SQLiteTransactionOptions) => InferTransactionFromConnection<ConnectionType>;
|
|
2
14
|
|
|
3
15
|
type SQLiteConnectionString = DatabaseConnectionString<'SQLite', `file:${string}` | `:memory:` | `/${string}` | `./${string}`>;
|
|
4
16
|
declare const SQLiteConnectionString: (connectionString: string) => SQLiteConnectionString;
|
|
17
|
+
declare const parsePragmasFromConnectionString: (connectionString: string | SQLiteConnectionString) => Partial<SQLitePragmaOptions>;
|
|
5
18
|
|
|
6
19
|
type SQLiteCommandOptions = SQLCommandOptions & {
|
|
7
20
|
ignoreChangesCount?: boolean;
|
|
8
21
|
};
|
|
22
|
+
type BatchSQLiteCommandOptions = SQLiteCommandOptions & BatchSQLCommandOptions;
|
|
9
23
|
type SQLiteParameters = object | string | bigint | number | boolean | null;
|
|
10
24
|
type SQLiteClient = {
|
|
11
25
|
connect: () => Promise<void>;
|
|
@@ -20,24 +34,26 @@ interface SQLiteError extends Error {
|
|
|
20
34
|
errno: number;
|
|
21
35
|
}
|
|
22
36
|
declare const isSQLiteError: (error: unknown) => error is SQLiteError;
|
|
23
|
-
type SQLiteClientConnection<Self extends AnyConnection = AnyConnection, DriverType extends SQLiteDriverType = SQLiteDriverType, SQLiteClientType extends SQLiteClient = SQLiteClient, TransactionType extends DatabaseTransaction<Self> = DatabaseTransaction<Self
|
|
24
|
-
type SQLitePoolClientConnection<Self extends AnyConnection = AnyConnection, DriverType extends SQLiteDriverType = SQLiteDriverType, SQLitePoolClientType extends SQLitePoolClient = SQLitePoolClient, TransactionType extends DatabaseTransaction<Self> = DatabaseTransaction<Self
|
|
25
|
-
type SQLiteConnection<Self extends AnyConnection = AnyConnection, DriverType extends SQLiteDriverType = SQLiteDriverType, SQLiteClientType extends SQLiteClientOrPoolClient = SQLiteClient | SQLitePoolClient, TransactionType extends DatabaseTransaction<Self> = DatabaseTransaction<Self
|
|
37
|
+
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>;
|
|
38
|
+
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>;
|
|
39
|
+
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);
|
|
26
40
|
type AnySQLiteClientConnection = SQLiteClientConnection<any, any>;
|
|
27
|
-
type AnySQLitePoolClientConnection = SQLitePoolClientConnection<any, any, any, any
|
|
28
|
-
type AnySQLiteConnection = SQLiteConnection<any, any, any, any
|
|
41
|
+
type AnySQLitePoolClientConnection = SQLitePoolClientConnection<any, any, any, any>;
|
|
42
|
+
type AnySQLiteConnection = SQLiteConnection<any, any, any, any>;
|
|
29
43
|
type SQLiteConnectionOptions<ConnectionType extends AnySQLiteConnection = AnySQLiteConnection> = ConnectionOptions<ConnectionType> & SQLiteClientOptions;
|
|
30
44
|
type SQLiteClientConnectionDefinitionOptions<SQLiteConnectionType extends AnySQLiteClientConnection = AnySQLiteClientConnection, ConnectionOptions = SQLiteConnectionOptions> = {
|
|
31
45
|
driverType: InferDriverTypeFromConnection<SQLiteConnectionType>;
|
|
32
46
|
type: 'Client';
|
|
33
47
|
sqliteClientFactory: SQLiteClientFactory<InferDbClientFromConnection<SQLiteConnectionType>, ConnectionOptions>;
|
|
34
48
|
connectionOptions: SQLiteConnectionOptions<SQLiteConnectionType>;
|
|
49
|
+
serializer: JSONSerializer;
|
|
35
50
|
};
|
|
36
51
|
type SQLitePoolConnectionDefinitionOptions<SQLiteConnectionType extends AnySQLitePoolClientConnection = AnySQLitePoolClientConnection, ConnectionOptions = SQLiteConnectionOptions> = {
|
|
37
52
|
driverType: InferDriverTypeFromConnection<SQLiteConnectionType>;
|
|
38
53
|
type: 'PoolClient';
|
|
39
54
|
sqliteClientFactory: SQLiteClientFactory<InferDbClientFromConnection<SQLiteConnectionType>, ConnectionOptions>;
|
|
40
55
|
connectionOptions: SQLiteConnectionOptions<SQLiteConnectionType>;
|
|
56
|
+
serializer: JSONSerializer;
|
|
41
57
|
};
|
|
42
58
|
type SQLiteConnectionDefinitionOptions<SQLiteConnectionType extends AnySQLitePoolClientConnection = AnySQLitePoolClientConnection, ClientOptions = SQLiteClientOptions> = SQLiteClientConnectionDefinitionOptions<SQLiteConnectionType, ClientOptions> | SQLitePoolConnectionDefinitionOptions<SQLiteConnectionType, ClientOptions>;
|
|
43
59
|
type SQLiteConnectionFactory<SQLiteConnectionType extends AnySQLiteConnection = AnySQLiteConnection, ConnectionOptions extends SQLiteConnectionOptions = SQLiteConnectionOptions> = (options: ConnectionOptions) => SQLiteConnectionType;
|
|
@@ -48,11 +64,14 @@ type TransactionNestingCounter = {
|
|
|
48
64
|
level: number;
|
|
49
65
|
};
|
|
50
66
|
declare const transactionNestingCounter: () => TransactionNestingCounter;
|
|
51
|
-
type SqliteAmbientClientConnectionOptions<SQLiteConnectionType extends AnySQLiteClientConnection = AnySQLiteClientConnection
|
|
67
|
+
type SqliteAmbientClientConnectionOptions<SQLiteConnectionType extends AnySQLiteClientConnection = AnySQLiteClientConnection> = {
|
|
52
68
|
driverType: SQLiteConnectionType['driverType'];
|
|
53
69
|
client: InferDbClientFromConnection<SQLiteConnectionType>;
|
|
54
|
-
initTransaction?: InitTransaction<SQLiteConnectionType
|
|
70
|
+
initTransaction?: InitTransaction<SQLiteConnectionType>;
|
|
55
71
|
allowNestedTransactions?: boolean;
|
|
72
|
+
defaultTransactionMode?: SQLiteTransactionMode;
|
|
73
|
+
serializer: JSONSerializer;
|
|
74
|
+
errorMapper?: SQLiteErrorMapper;
|
|
56
75
|
};
|
|
57
76
|
declare const sqliteAmbientClientConnection: <SQLiteConnectionType extends AnySQLiteClientConnection = AnySQLiteClientConnection>(options: SqliteAmbientClientConnectionOptions<SQLiteConnectionType>) => SQLiteConnectionType;
|
|
58
77
|
declare const sqliteClientConnection: <SQLiteConnectionType extends AnySQLiteClientConnection = AnySQLiteClientConnection, ClientOptions = SQLiteClientOptions>(options: SQLiteClientConnectionDefinitionOptions<SQLiteConnectionType, ClientOptions>) => SQLiteConnectionType;
|
|
@@ -60,11 +79,47 @@ declare const sqlitePoolClientConnection: <SQLiteConnectionType extends AnySQLit
|
|
|
60
79
|
declare function sqliteConnection<SQLiteConnectionType extends AnySQLiteConnection = AnySQLiteConnection, ClientOptions = SQLiteClientOptions>(options: SQLiteConnectionDefinitionOptions<SQLiteConnectionType, ClientOptions>): SQLiteConnectionType;
|
|
61
80
|
type InMemorySQLiteDatabase = ':memory:';
|
|
62
81
|
declare const InMemorySQLiteDatabase: SQLiteConnectionString;
|
|
63
|
-
type
|
|
82
|
+
type SQLitePragmaOptions = {
|
|
83
|
+
journal_mode?: 'DELETE' | 'TRUNCATE' | 'PERSIST' | 'MEMORY' | 'WAL' | 'OFF';
|
|
84
|
+
synchronous?: 'OFF' | 'NORMAL' | 'FULL' | 'EXTRA';
|
|
85
|
+
cache_size?: number;
|
|
86
|
+
foreign_keys?: boolean;
|
|
87
|
+
temp_store?: 'DEFAULT' | 'FILE' | 'MEMORY';
|
|
88
|
+
busy_timeout?: number;
|
|
89
|
+
};
|
|
90
|
+
declare const DEFAULT_SQLITE_PRAGMA_OPTIONS: SQLitePragmaOptions;
|
|
91
|
+
type SQLiteClientOptions = {
|
|
92
|
+
pragmaOptions?: Partial<SQLitePragmaOptions>;
|
|
93
|
+
defaultTransactionMode?: SQLiteTransactionMode;
|
|
94
|
+
skipDatabasePragmas?: boolean;
|
|
95
|
+
readonly?: boolean;
|
|
96
|
+
};
|
|
64
97
|
|
|
98
|
+
/**
|
|
99
|
+
* Maps a SQLite error (from the `sqlite3` / node-sqlite3 driver) to a typed
|
|
100
|
+
* DumboError based on the SQLite result code.
|
|
101
|
+
*
|
|
102
|
+
* Result code reference: https://www.sqlite.org/rescode.html
|
|
103
|
+
*
|
|
104
|
+
* Falls back to a generic DumboError (500) if the error is not a recognized SQLite error.
|
|
105
|
+
*/
|
|
106
|
+
declare const mapSqliteError: (error: unknown) => DumboError;
|
|
107
|
+
|
|
108
|
+
type SQLiteErrorMapper = (error: unknown) => DumboError;
|
|
65
109
|
declare const sqliteExecute: <Result = void>(database: SQLiteClient, handle: (client: SQLiteClient) => Promise<Result>) => Promise<Result>;
|
|
66
110
|
type SQLiteSQLExecutor<DriverType extends SQLiteDriverType = SQLiteDriverType> = DbSQLExecutor<DriverType, SQLiteClient>;
|
|
67
|
-
declare const sqliteSQLExecutor: <DriverType extends SQLiteDriverType = SQLiteDriverType>(driverType: DriverType, formatter?: SQLFormatter) => SQLiteSQLExecutor<DriverType>;
|
|
111
|
+
declare const sqliteSQLExecutor: <DriverType extends SQLiteDriverType = SQLiteDriverType>(driverType: DriverType, serializer: JSONSerializer, formatter?: SQLFormatter, errorMapper?: SQLiteErrorMapper) => SQLiteSQLExecutor<DriverType>;
|
|
112
|
+
|
|
113
|
+
type SQLiteDualPoolOptions<SQLiteConnectionType extends AnySQLiteConnection, ConnectionOptions extends SQLiteConnectionOptions> = {
|
|
114
|
+
driverType: SQLiteConnectionType['driverType'];
|
|
115
|
+
dual?: true;
|
|
116
|
+
singleton?: false;
|
|
117
|
+
pooled?: true;
|
|
118
|
+
connection?: never;
|
|
119
|
+
readerPoolSize?: number;
|
|
120
|
+
sqliteConnectionFactory: SQLiteConnectionFactory<SQLiteConnectionType, ConnectionOptions>;
|
|
121
|
+
connectionOptions?: ConnectionOptions;
|
|
122
|
+
};
|
|
68
123
|
|
|
69
124
|
type SQLiteFileNameOrConnectionString = {
|
|
70
125
|
fileName: string | SQLiteConnectionString;
|
|
@@ -107,7 +162,7 @@ type SQLiteAlwaysNewConnectionPool<SQLiteConnectionType extends AnySQLiteConnect
|
|
|
107
162
|
declare const sqliteAlwaysNewConnectionPool: <SQLiteConnectionType extends AnySQLiteConnection = AnySQLiteConnection, ConnectionOptions extends SQLiteConnectionOptions & Record<string, unknown> = SQLiteConnectionOptions & Record<string, unknown>>(options: {
|
|
108
163
|
driverType: SQLiteConnectionType["driverType"];
|
|
109
164
|
} & SQLiteAlwaysNewPoolOptions<SQLiteConnectionType, ConnectionOptions>) => SQLiteAlwaysNewConnectionPool<SQLiteConnectionType>;
|
|
110
|
-
type SQLitePoolOptions<SQLiteConnectionType extends AnySQLiteConnection = AnySQLiteConnection, ConnectionOptions extends SQLiteConnectionOptions = SQLiteConnectionOptions> = (SQLiteAlwaysNewPoolOptions<SQLiteConnectionType, ConnectionOptions> | SQLiteSingletonConnectionPoolOptions<SQLiteConnectionType, ConnectionOptions> | SQLiteAmbientConnectionPoolOptions<SQLiteConnectionType>) & {
|
|
165
|
+
type SQLitePoolOptions<SQLiteConnectionType extends AnySQLiteConnection = AnySQLiteConnection, ConnectionOptions extends SQLiteConnectionOptions = SQLiteConnectionOptions> = (SQLiteAlwaysNewPoolOptions<SQLiteConnectionType, ConnectionOptions> | SQLiteSingletonConnectionPoolOptions<SQLiteConnectionType, ConnectionOptions> | SQLiteAmbientConnectionPoolOptions<SQLiteConnectionType> | SQLiteDualPoolOptions<SQLiteConnectionType, ConnectionOptions>) & {
|
|
111
166
|
driverType: SQLiteConnectionType['driverType'];
|
|
112
167
|
serializer?: JSONSerializer;
|
|
113
168
|
};
|
|
@@ -120,20 +175,14 @@ declare function sqlitePool<SQLiteConnectionType extends AnySQLiteConnection = A
|
|
|
120
175
|
|
|
121
176
|
declare const DefaultSQLiteMigratorOptions: MigratorOptions;
|
|
122
177
|
|
|
123
|
-
declare const
|
|
124
|
-
declare const
|
|
125
|
-
declare const tableExists: (pool: ConnectionPool, tableName: string) => Promise<boolean>;
|
|
178
|
+
declare const defaultSQLiteDatabase = ":memory:";
|
|
179
|
+
declare const tableExists: (execute: SQLExecutor, tableName: string) => Promise<boolean>;
|
|
126
180
|
|
|
127
181
|
declare const sqliteFormatter: SQLFormatter;
|
|
128
182
|
|
|
129
|
-
type SQLiteTransaction<ConnectionType extends AnySQLiteConnection = AnySQLiteConnection> = DatabaseTransaction<ConnectionType>;
|
|
130
|
-
declare const sqliteTransaction: <ConnectionType extends AnySQLiteConnection = AnySQLiteConnection>(driverType: ConnectionType["driverType"], connection: () => ConnectionType, allowNestedTransactions: boolean) => (getClient: Promise<InferDbClientFromConnection<ConnectionType>>, options?: {
|
|
131
|
-
close: (client: InferDbClientFromConnection<ConnectionType>, error?: unknown) => Promise<void>;
|
|
132
|
-
} & DatabaseTransactionOptions) => DatabaseTransaction<ConnectionType>;
|
|
133
|
-
|
|
134
183
|
type SQLiteDatabaseName = 'SQLite';
|
|
135
184
|
declare const SQLiteDatabaseName = "SQLite";
|
|
136
185
|
type SQLiteDriverType<DriverName extends string = string> = DatabaseDriverType<SQLiteDatabaseName, DriverName>;
|
|
137
186
|
type SQLiteDatabaseType = 'SQLite';
|
|
138
187
|
|
|
139
|
-
export { type
|
|
188
|
+
export { type AnySQLiteClientConnection, type AnySQLiteConnection, type AnySQLitePoolClientConnection, type BatchSQLiteCommandOptions, DEFAULT_SQLITE_PRAGMA_OPTIONS, DefaultSQLiteMigratorOptions, InMemorySQLiteDatabase, type SQLiteAlwaysNewConnectionPool, type SQLiteAmbientConnectionPool, type SQLiteClient, type SQLiteClientConnection, type SQLiteClientConnectionDefinitionOptions, type SQLiteClientFactory, type SQLiteClientOptions, type SQLiteClientOrPoolClient, type SQLiteCommandOptions, type SQLiteConnection, type SQLiteConnectionDefinitionOptions, type SQLiteConnectionFactory, type SQLiteConnectionOptions, SQLiteConnectionString, SQLiteDatabaseName, type SQLiteDatabaseType, type SQLiteDriverType, type SQLiteError, type SQLiteErrorMapper, type SQLiteFileNameOrConnectionString, type SQLiteParameters, type SQLitePool, type SQLitePoolClient, type SQLitePoolClientConnection, type SQLitePoolConnectionDefinitionOptions, type SQLitePoolFactoryOptions, type SQLitePoolOptions, type SQLitePragmaOptions, type SQLiteSQLExecutor, type SQLiteSingletonConnectionPool, type SQLiteTransaction, type SQLiteTransactionMode, type SQLiteTransactionOptions, type SqliteAmbientClientConnectionOptions, type TransactionNestingCounter, defaultSQLiteDatabase, isInMemoryDatabase, isSQLiteError, mapSqliteError, parsePragmasFromConnectionString, sqliteAlwaysNewConnectionPool, sqliteAmbientClientConnection, sqliteAmbientConnectionPool, sqliteClientConnection, sqliteConnection, sqliteExecute, sqliteFormatter, sqliteMetadata, sqlitePool, sqlitePoolClientConnection, sqliteSQLExecutor, sqliteSingletonConnectionPool, sqliteTransaction, tableExists, toSqlitePoolOptions, transactionNestingCounter };
|
|
@@ -1,11 +1,25 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { g as DatabaseMetadata, h as DatabaseTransactionOptions, i as DatabaseTransaction, J as JSONSerializer, bg as InferDbClientFromConnection, bn as InferTransactionFromConnection, aE as DatabaseConnectionString, A as AnyConnection, ch as SQLExecutor, C as Connection, ce as SQLCommandOptions, aa as BatchSQLCommandOptions, e as ConnectionOptions, bi as InferDriverTypeFromConnection, bq as InitTransaction, m as DumboError, l as DbSQLExecutor, f as SQLFormatter, j as ConnectionPool, M as MigratorOptions, x as DatabaseDriverType } from './connectionString-Dch_MIRU.js';
|
|
2
|
+
|
|
3
|
+
declare const sqliteMetadata: DatabaseMetadata<false, false, false>;
|
|
4
|
+
|
|
5
|
+
type SQLiteTransaction<ConnectionType extends AnySQLiteConnection = AnySQLiteConnection, TransactionOptions extends SQLiteTransactionOptions = SQLiteTransactionOptions> = DatabaseTransaction<ConnectionType, TransactionOptions>;
|
|
6
|
+
type SQLiteTransactionMode = 'DEFERRED' | 'IMMEDIATE' | 'EXCLUSIVE';
|
|
7
|
+
type SQLiteTransactionOptions = DatabaseTransactionOptions & {
|
|
8
|
+
mode?: SQLiteTransactionMode;
|
|
9
|
+
useSavepoints?: boolean;
|
|
10
|
+
};
|
|
11
|
+
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?: {
|
|
12
|
+
close: (client: InferDbClientFromConnection<ConnectionType>, error?: unknown) => Promise<void>;
|
|
13
|
+
} & SQLiteTransactionOptions) => InferTransactionFromConnection<ConnectionType>;
|
|
2
14
|
|
|
3
15
|
type SQLiteConnectionString = DatabaseConnectionString<'SQLite', `file:${string}` | `:memory:` | `/${string}` | `./${string}`>;
|
|
4
16
|
declare const SQLiteConnectionString: (connectionString: string) => SQLiteConnectionString;
|
|
17
|
+
declare const parsePragmasFromConnectionString: (connectionString: string | SQLiteConnectionString) => Partial<SQLitePragmaOptions>;
|
|
5
18
|
|
|
6
19
|
type SQLiteCommandOptions = SQLCommandOptions & {
|
|
7
20
|
ignoreChangesCount?: boolean;
|
|
8
21
|
};
|
|
22
|
+
type BatchSQLiteCommandOptions = SQLiteCommandOptions & BatchSQLCommandOptions;
|
|
9
23
|
type SQLiteParameters = object | string | bigint | number | boolean | null;
|
|
10
24
|
type SQLiteClient = {
|
|
11
25
|
connect: () => Promise<void>;
|
|
@@ -20,24 +34,26 @@ interface SQLiteError extends Error {
|
|
|
20
34
|
errno: number;
|
|
21
35
|
}
|
|
22
36
|
declare const isSQLiteError: (error: unknown) => error is SQLiteError;
|
|
23
|
-
type SQLiteClientConnection<Self extends AnyConnection = AnyConnection, DriverType extends SQLiteDriverType = SQLiteDriverType, SQLiteClientType extends SQLiteClient = SQLiteClient, TransactionType extends DatabaseTransaction<Self> = DatabaseTransaction<Self
|
|
24
|
-
type SQLitePoolClientConnection<Self extends AnyConnection = AnyConnection, DriverType extends SQLiteDriverType = SQLiteDriverType, SQLitePoolClientType extends SQLitePoolClient = SQLitePoolClient, TransactionType extends DatabaseTransaction<Self> = DatabaseTransaction<Self
|
|
25
|
-
type SQLiteConnection<Self extends AnyConnection = AnyConnection, DriverType extends SQLiteDriverType = SQLiteDriverType, SQLiteClientType extends SQLiteClientOrPoolClient = SQLiteClient | SQLitePoolClient, TransactionType extends DatabaseTransaction<Self> = DatabaseTransaction<Self
|
|
37
|
+
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>;
|
|
38
|
+
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>;
|
|
39
|
+
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);
|
|
26
40
|
type AnySQLiteClientConnection = SQLiteClientConnection<any, any>;
|
|
27
|
-
type AnySQLitePoolClientConnection = SQLitePoolClientConnection<any, any, any, any
|
|
28
|
-
type AnySQLiteConnection = SQLiteConnection<any, any, any, any
|
|
41
|
+
type AnySQLitePoolClientConnection = SQLitePoolClientConnection<any, any, any, any>;
|
|
42
|
+
type AnySQLiteConnection = SQLiteConnection<any, any, any, any>;
|
|
29
43
|
type SQLiteConnectionOptions<ConnectionType extends AnySQLiteConnection = AnySQLiteConnection> = ConnectionOptions<ConnectionType> & SQLiteClientOptions;
|
|
30
44
|
type SQLiteClientConnectionDefinitionOptions<SQLiteConnectionType extends AnySQLiteClientConnection = AnySQLiteClientConnection, ConnectionOptions = SQLiteConnectionOptions> = {
|
|
31
45
|
driverType: InferDriverTypeFromConnection<SQLiteConnectionType>;
|
|
32
46
|
type: 'Client';
|
|
33
47
|
sqliteClientFactory: SQLiteClientFactory<InferDbClientFromConnection<SQLiteConnectionType>, ConnectionOptions>;
|
|
34
48
|
connectionOptions: SQLiteConnectionOptions<SQLiteConnectionType>;
|
|
49
|
+
serializer: JSONSerializer;
|
|
35
50
|
};
|
|
36
51
|
type SQLitePoolConnectionDefinitionOptions<SQLiteConnectionType extends AnySQLitePoolClientConnection = AnySQLitePoolClientConnection, ConnectionOptions = SQLiteConnectionOptions> = {
|
|
37
52
|
driverType: InferDriverTypeFromConnection<SQLiteConnectionType>;
|
|
38
53
|
type: 'PoolClient';
|
|
39
54
|
sqliteClientFactory: SQLiteClientFactory<InferDbClientFromConnection<SQLiteConnectionType>, ConnectionOptions>;
|
|
40
55
|
connectionOptions: SQLiteConnectionOptions<SQLiteConnectionType>;
|
|
56
|
+
serializer: JSONSerializer;
|
|
41
57
|
};
|
|
42
58
|
type SQLiteConnectionDefinitionOptions<SQLiteConnectionType extends AnySQLitePoolClientConnection = AnySQLitePoolClientConnection, ClientOptions = SQLiteClientOptions> = SQLiteClientConnectionDefinitionOptions<SQLiteConnectionType, ClientOptions> | SQLitePoolConnectionDefinitionOptions<SQLiteConnectionType, ClientOptions>;
|
|
43
59
|
type SQLiteConnectionFactory<SQLiteConnectionType extends AnySQLiteConnection = AnySQLiteConnection, ConnectionOptions extends SQLiteConnectionOptions = SQLiteConnectionOptions> = (options: ConnectionOptions) => SQLiteConnectionType;
|
|
@@ -48,11 +64,14 @@ type TransactionNestingCounter = {
|
|
|
48
64
|
level: number;
|
|
49
65
|
};
|
|
50
66
|
declare const transactionNestingCounter: () => TransactionNestingCounter;
|
|
51
|
-
type SqliteAmbientClientConnectionOptions<SQLiteConnectionType extends AnySQLiteClientConnection = AnySQLiteClientConnection
|
|
67
|
+
type SqliteAmbientClientConnectionOptions<SQLiteConnectionType extends AnySQLiteClientConnection = AnySQLiteClientConnection> = {
|
|
52
68
|
driverType: SQLiteConnectionType['driverType'];
|
|
53
69
|
client: InferDbClientFromConnection<SQLiteConnectionType>;
|
|
54
|
-
initTransaction?: InitTransaction<SQLiteConnectionType
|
|
70
|
+
initTransaction?: InitTransaction<SQLiteConnectionType>;
|
|
55
71
|
allowNestedTransactions?: boolean;
|
|
72
|
+
defaultTransactionMode?: SQLiteTransactionMode;
|
|
73
|
+
serializer: JSONSerializer;
|
|
74
|
+
errorMapper?: SQLiteErrorMapper;
|
|
56
75
|
};
|
|
57
76
|
declare const sqliteAmbientClientConnection: <SQLiteConnectionType extends AnySQLiteClientConnection = AnySQLiteClientConnection>(options: SqliteAmbientClientConnectionOptions<SQLiteConnectionType>) => SQLiteConnectionType;
|
|
58
77
|
declare const sqliteClientConnection: <SQLiteConnectionType extends AnySQLiteClientConnection = AnySQLiteClientConnection, ClientOptions = SQLiteClientOptions>(options: SQLiteClientConnectionDefinitionOptions<SQLiteConnectionType, ClientOptions>) => SQLiteConnectionType;
|
|
@@ -60,11 +79,47 @@ declare const sqlitePoolClientConnection: <SQLiteConnectionType extends AnySQLit
|
|
|
60
79
|
declare function sqliteConnection<SQLiteConnectionType extends AnySQLiteConnection = AnySQLiteConnection, ClientOptions = SQLiteClientOptions>(options: SQLiteConnectionDefinitionOptions<SQLiteConnectionType, ClientOptions>): SQLiteConnectionType;
|
|
61
80
|
type InMemorySQLiteDatabase = ':memory:';
|
|
62
81
|
declare const InMemorySQLiteDatabase: SQLiteConnectionString;
|
|
63
|
-
type
|
|
82
|
+
type SQLitePragmaOptions = {
|
|
83
|
+
journal_mode?: 'DELETE' | 'TRUNCATE' | 'PERSIST' | 'MEMORY' | 'WAL' | 'OFF';
|
|
84
|
+
synchronous?: 'OFF' | 'NORMAL' | 'FULL' | 'EXTRA';
|
|
85
|
+
cache_size?: number;
|
|
86
|
+
foreign_keys?: boolean;
|
|
87
|
+
temp_store?: 'DEFAULT' | 'FILE' | 'MEMORY';
|
|
88
|
+
busy_timeout?: number;
|
|
89
|
+
};
|
|
90
|
+
declare const DEFAULT_SQLITE_PRAGMA_OPTIONS: SQLitePragmaOptions;
|
|
91
|
+
type SQLiteClientOptions = {
|
|
92
|
+
pragmaOptions?: Partial<SQLitePragmaOptions>;
|
|
93
|
+
defaultTransactionMode?: SQLiteTransactionMode;
|
|
94
|
+
skipDatabasePragmas?: boolean;
|
|
95
|
+
readonly?: boolean;
|
|
96
|
+
};
|
|
64
97
|
|
|
98
|
+
/**
|
|
99
|
+
* Maps a SQLite error (from the `sqlite3` / node-sqlite3 driver) to a typed
|
|
100
|
+
* DumboError based on the SQLite result code.
|
|
101
|
+
*
|
|
102
|
+
* Result code reference: https://www.sqlite.org/rescode.html
|
|
103
|
+
*
|
|
104
|
+
* Falls back to a generic DumboError (500) if the error is not a recognized SQLite error.
|
|
105
|
+
*/
|
|
106
|
+
declare const mapSqliteError: (error: unknown) => DumboError;
|
|
107
|
+
|
|
108
|
+
type SQLiteErrorMapper = (error: unknown) => DumboError;
|
|
65
109
|
declare const sqliteExecute: <Result = void>(database: SQLiteClient, handle: (client: SQLiteClient) => Promise<Result>) => Promise<Result>;
|
|
66
110
|
type SQLiteSQLExecutor<DriverType extends SQLiteDriverType = SQLiteDriverType> = DbSQLExecutor<DriverType, SQLiteClient>;
|
|
67
|
-
declare const sqliteSQLExecutor: <DriverType extends SQLiteDriverType = SQLiteDriverType>(driverType: DriverType, formatter?: SQLFormatter) => SQLiteSQLExecutor<DriverType>;
|
|
111
|
+
declare const sqliteSQLExecutor: <DriverType extends SQLiteDriverType = SQLiteDriverType>(driverType: DriverType, serializer: JSONSerializer, formatter?: SQLFormatter, errorMapper?: SQLiteErrorMapper) => SQLiteSQLExecutor<DriverType>;
|
|
112
|
+
|
|
113
|
+
type SQLiteDualPoolOptions<SQLiteConnectionType extends AnySQLiteConnection, ConnectionOptions extends SQLiteConnectionOptions> = {
|
|
114
|
+
driverType: SQLiteConnectionType['driverType'];
|
|
115
|
+
dual?: true;
|
|
116
|
+
singleton?: false;
|
|
117
|
+
pooled?: true;
|
|
118
|
+
connection?: never;
|
|
119
|
+
readerPoolSize?: number;
|
|
120
|
+
sqliteConnectionFactory: SQLiteConnectionFactory<SQLiteConnectionType, ConnectionOptions>;
|
|
121
|
+
connectionOptions?: ConnectionOptions;
|
|
122
|
+
};
|
|
68
123
|
|
|
69
124
|
type SQLiteFileNameOrConnectionString = {
|
|
70
125
|
fileName: string | SQLiteConnectionString;
|
|
@@ -107,7 +162,7 @@ type SQLiteAlwaysNewConnectionPool<SQLiteConnectionType extends AnySQLiteConnect
|
|
|
107
162
|
declare const sqliteAlwaysNewConnectionPool: <SQLiteConnectionType extends AnySQLiteConnection = AnySQLiteConnection, ConnectionOptions extends SQLiteConnectionOptions & Record<string, unknown> = SQLiteConnectionOptions & Record<string, unknown>>(options: {
|
|
108
163
|
driverType: SQLiteConnectionType["driverType"];
|
|
109
164
|
} & SQLiteAlwaysNewPoolOptions<SQLiteConnectionType, ConnectionOptions>) => SQLiteAlwaysNewConnectionPool<SQLiteConnectionType>;
|
|
110
|
-
type SQLitePoolOptions<SQLiteConnectionType extends AnySQLiteConnection = AnySQLiteConnection, ConnectionOptions extends SQLiteConnectionOptions = SQLiteConnectionOptions> = (SQLiteAlwaysNewPoolOptions<SQLiteConnectionType, ConnectionOptions> | SQLiteSingletonConnectionPoolOptions<SQLiteConnectionType, ConnectionOptions> | SQLiteAmbientConnectionPoolOptions<SQLiteConnectionType>) & {
|
|
165
|
+
type SQLitePoolOptions<SQLiteConnectionType extends AnySQLiteConnection = AnySQLiteConnection, ConnectionOptions extends SQLiteConnectionOptions = SQLiteConnectionOptions> = (SQLiteAlwaysNewPoolOptions<SQLiteConnectionType, ConnectionOptions> | SQLiteSingletonConnectionPoolOptions<SQLiteConnectionType, ConnectionOptions> | SQLiteAmbientConnectionPoolOptions<SQLiteConnectionType> | SQLiteDualPoolOptions<SQLiteConnectionType, ConnectionOptions>) & {
|
|
111
166
|
driverType: SQLiteConnectionType['driverType'];
|
|
112
167
|
serializer?: JSONSerializer;
|
|
113
168
|
};
|
|
@@ -120,20 +175,14 @@ declare function sqlitePool<SQLiteConnectionType extends AnySQLiteConnection = A
|
|
|
120
175
|
|
|
121
176
|
declare const DefaultSQLiteMigratorOptions: MigratorOptions;
|
|
122
177
|
|
|
123
|
-
declare const
|
|
124
|
-
declare const
|
|
125
|
-
declare const tableExists: (pool: ConnectionPool, tableName: string) => Promise<boolean>;
|
|
178
|
+
declare const defaultSQLiteDatabase = ":memory:";
|
|
179
|
+
declare const tableExists: (execute: SQLExecutor, tableName: string) => Promise<boolean>;
|
|
126
180
|
|
|
127
181
|
declare const sqliteFormatter: SQLFormatter;
|
|
128
182
|
|
|
129
|
-
type SQLiteTransaction<ConnectionType extends AnySQLiteConnection = AnySQLiteConnection> = DatabaseTransaction<ConnectionType>;
|
|
130
|
-
declare const sqliteTransaction: <ConnectionType extends AnySQLiteConnection = AnySQLiteConnection>(driverType: ConnectionType["driverType"], connection: () => ConnectionType, allowNestedTransactions: boolean) => (getClient: Promise<InferDbClientFromConnection<ConnectionType>>, options?: {
|
|
131
|
-
close: (client: InferDbClientFromConnection<ConnectionType>, error?: unknown) => Promise<void>;
|
|
132
|
-
} & DatabaseTransactionOptions) => DatabaseTransaction<ConnectionType>;
|
|
133
|
-
|
|
134
183
|
type SQLiteDatabaseName = 'SQLite';
|
|
135
184
|
declare const SQLiteDatabaseName = "SQLite";
|
|
136
185
|
type SQLiteDriverType<DriverName extends string = string> = DatabaseDriverType<SQLiteDatabaseName, DriverName>;
|
|
137
186
|
type SQLiteDatabaseType = 'SQLite';
|
|
138
187
|
|
|
139
|
-
export { type
|
|
188
|
+
export { type AnySQLiteClientConnection, type AnySQLiteConnection, type AnySQLitePoolClientConnection, type BatchSQLiteCommandOptions, DEFAULT_SQLITE_PRAGMA_OPTIONS, DefaultSQLiteMigratorOptions, InMemorySQLiteDatabase, type SQLiteAlwaysNewConnectionPool, type SQLiteAmbientConnectionPool, type SQLiteClient, type SQLiteClientConnection, type SQLiteClientConnectionDefinitionOptions, type SQLiteClientFactory, type SQLiteClientOptions, type SQLiteClientOrPoolClient, type SQLiteCommandOptions, type SQLiteConnection, type SQLiteConnectionDefinitionOptions, type SQLiteConnectionFactory, type SQLiteConnectionOptions, SQLiteConnectionString, SQLiteDatabaseName, type SQLiteDatabaseType, type SQLiteDriverType, type SQLiteError, type SQLiteErrorMapper, type SQLiteFileNameOrConnectionString, type SQLiteParameters, type SQLitePool, type SQLitePoolClient, type SQLitePoolClientConnection, type SQLitePoolConnectionDefinitionOptions, type SQLitePoolFactoryOptions, type SQLitePoolOptions, type SQLitePragmaOptions, type SQLiteSQLExecutor, type SQLiteSingletonConnectionPool, type SQLiteTransaction, type SQLiteTransactionMode, type SQLiteTransactionOptions, type SqliteAmbientClientConnectionOptions, type TransactionNestingCounter, defaultSQLiteDatabase, isInMemoryDatabase, isSQLiteError, mapSqliteError, parsePragmasFromConnectionString, sqliteAlwaysNewConnectionPool, sqliteAmbientClientConnection, sqliteAmbientConnectionPool, sqliteClientConnection, sqliteConnection, sqliteExecute, sqliteFormatter, sqliteMetadata, sqlitePool, sqlitePoolClientConnection, sqliteSQLExecutor, sqliteSingletonConnectionPool, sqliteTransaction, tableExists, toSqlitePoolOptions, transactionNestingCounter };
|