@event-driven-io/dumbo 0.13.0-beta.3 → 0.13.0-beta.30

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.
Files changed (91) hide show
  1. package/dist/chunk-4SM4JJJZ.js +83 -0
  2. package/dist/chunk-4SM4JJJZ.js.map +1 -0
  3. package/dist/chunk-EEKBLOCH.cjs +706 -0
  4. package/dist/chunk-EEKBLOCH.cjs.map +1 -0
  5. package/dist/{chunk-OJ34O3Q2.cjs → chunk-GVR3PSDL.cjs} +2474 -1636
  6. package/dist/chunk-GVR3PSDL.cjs.map +1 -0
  7. package/dist/chunk-HZM7GDOT.cjs +34 -0
  8. package/dist/chunk-HZM7GDOT.cjs.map +1 -0
  9. package/dist/{chunk-N7RWT46K.js → chunk-JKE6SULM.js} +2522 -1684
  10. package/dist/chunk-JKE6SULM.js.map +1 -0
  11. package/dist/chunk-MOPKHYYU.cjs +83 -0
  12. package/dist/chunk-MOPKHYYU.cjs.map +1 -0
  13. package/dist/chunk-RA2L3FQW.js +481 -0
  14. package/dist/chunk-RA2L3FQW.js.map +1 -0
  15. package/dist/chunk-UA542GT3.cjs +481 -0
  16. package/dist/chunk-UA542GT3.cjs.map +1 -0
  17. package/dist/chunk-WLWELSA2.js +34 -0
  18. package/dist/chunk-WLWELSA2.js.map +1 -0
  19. package/dist/chunk-XFEGS3YT.js +706 -0
  20. package/dist/chunk-XFEGS3YT.js.map +1 -0
  21. package/dist/cloudflare.cjs +456 -0
  22. package/dist/cloudflare.cjs.map +1 -0
  23. package/dist/cloudflare.d.cts +92 -0
  24. package/dist/cloudflare.d.ts +92 -0
  25. package/dist/cloudflare.js +456 -0
  26. package/dist/cloudflare.js.map +1 -0
  27. package/dist/{columnProcessors-DMPpTPqM.d.ts → columnProcessors-Be2uMYjS.d.cts} +1 -1
  28. package/dist/{columnProcessors-BX-sH7ah.d.cts → columnProcessors-D0ivj_SU.d.ts} +1 -1
  29. package/dist/{connectionString-B1wm0TFc.d.cts → connectionString-Dch_MIRU.d.cts} +394 -168
  30. package/dist/{connectionString-B1wm0TFc.d.ts → connectionString-Dch_MIRU.d.ts} +394 -168
  31. package/dist/index.cjs +100 -4
  32. package/dist/index.cjs.map +1 -1
  33. package/dist/index.d.cts +23 -18
  34. package/dist/index.d.ts +23 -18
  35. package/dist/index.js +105 -9
  36. package/dist/index.js.map +1 -1
  37. package/dist/pg.cjs +383 -9
  38. package/dist/pg.cjs.map +1 -1
  39. package/dist/pg.d.cts +81 -105
  40. package/dist/pg.d.ts +81 -105
  41. package/dist/pg.js +435 -61
  42. package/dist/pg.js.map +1 -1
  43. package/dist/postgresql.cjs +50 -0
  44. package/dist/postgresql.cjs.map +1 -0
  45. package/dist/postgresql.d.cts +61 -0
  46. package/dist/postgresql.d.ts +61 -0
  47. package/dist/postgresql.js +50 -0
  48. package/dist/sqlite.cjs +60 -0
  49. package/dist/sqlite.cjs.map +1 -0
  50. package/dist/{index-C2z_XBn6.d.ts → sqlite.d.cts} +69 -20
  51. package/dist/{index-C0h0c380.d.cts → sqlite.d.ts} +69 -20
  52. package/dist/sqlite.js +60 -0
  53. package/dist/sqlite3.cjs +319 -6
  54. package/dist/sqlite3.cjs.map +1 -1
  55. package/dist/sqlite3.d.cts +45 -25
  56. package/dist/sqlite3.d.ts +45 -25
  57. package/dist/sqlite3.js +335 -22
  58. package/dist/sqlite3.js.map +1 -1
  59. package/package.json +55 -33
  60. package/dist/chunk-A7TC7IOP.cjs +0 -55
  61. package/dist/chunk-A7TC7IOP.cjs.map +0 -1
  62. package/dist/chunk-F7JQ7BX7.js +0 -240
  63. package/dist/chunk-F7JQ7BX7.js.map +0 -1
  64. package/dist/chunk-I34X53VL.js +0 -688
  65. package/dist/chunk-I34X53VL.js.map +0 -1
  66. package/dist/chunk-ISNF6USX.cjs +0 -688
  67. package/dist/chunk-ISNF6USX.cjs.map +0 -1
  68. package/dist/chunk-IYEHOE4S.cjs +0 -405
  69. package/dist/chunk-IYEHOE4S.cjs.map +0 -1
  70. package/dist/chunk-L2YZQAG3.cjs +0 -240
  71. package/dist/chunk-L2YZQAG3.cjs.map +0 -1
  72. package/dist/chunk-N7RWT46K.js.map +0 -1
  73. package/dist/chunk-OJ34O3Q2.cjs.map +0 -1
  74. package/dist/chunk-TXSETOGH.js +0 -55
  75. package/dist/chunk-TXSETOGH.js.map +0 -1
  76. package/dist/chunk-XVV3OOQX.js +0 -405
  77. package/dist/chunk-XVV3OOQX.js.map +0 -1
  78. package/dist/d1.cjs +0 -277
  79. package/dist/d1.cjs.map +0 -1
  80. package/dist/d1.d.cts +0 -72
  81. package/dist/d1.d.ts +0 -72
  82. package/dist/d1.js +0 -277
  83. package/dist/d1.js.map +0 -1
  84. package/dist/pg-3ACXFMU4.cjs +0 -59
  85. package/dist/pg-3ACXFMU4.cjs.map +0 -1
  86. package/dist/pg-GHOW3XSG.js +0 -59
  87. package/dist/sqlite3-EEIKQCJR.js +0 -25
  88. package/dist/sqlite3-SE4DDYZE.cjs +0 -25
  89. package/dist/sqlite3-SE4DDYZE.cjs.map +0 -1
  90. /package/dist/{pg-GHOW3XSG.js.map → postgresql.js.map} +0 -0
  91. /package/dist/{sqlite3-EEIKQCJR.js.map → sqlite.js.map} +0 -0
package/dist/sqlite3.d.ts CHANGED
@@ -1,6 +1,6 @@
1
- import { a as SQLiteDriverType, B as SQLiteClientOptions, G as SQLiteFileNameOrConnectionString, i as SQLiteClientOrPoolClient, b as SQLiteConnectionOptions, $ as SQLiteTransaction, S as SQLiteClient, P as SQLitePoolOptions, Q as SQLitePool, C as SQLiteConnectionString } from './index-C2z_XBn6.js';
2
- export { A as AnySQLiteClientConnection, p as AnySQLiteConnection, o as AnySQLitePoolClientConnection, W as DefaultSQLiteMigratorOptions, I as InMemorySQLiteDatabase, N as SQLiteAlwaysNewConnectionPool, J as SQLiteAmbientConnectionPool, l as SQLiteClientConnection, q as SQLiteClientConnectionDefinitionOptions, h as SQLiteClientFactory, e as SQLiteCommandOptions, n as SQLiteConnection, s as SQLiteConnectionDefinitionOptions, t as SQLiteConnectionFactory, c as SQLiteDatabaseName, d as SQLiteDatabaseType, j as SQLiteError, f as SQLiteParameters, g as SQLitePoolClient, m as SQLitePoolClientConnection, r as SQLitePoolConnectionDefinitionOptions, R as SQLitePoolFactoryOptions, E as SQLiteSQLExecutor, L as SQLiteSingletonConnectionPool, v as SqliteAmbientClientConnectionOptions, T as TransactionNestingCounter, X as defaultPostgreSqlDatabase, H as isInMemoryDatabase, k as isSQLiteError, O as sqliteAlwaysNewConnectionPool, w as sqliteAmbientClientConnection, K as sqliteAmbientConnectionPool, x as sqliteClientConnection, z as sqliteConnection, D as sqliteExecute, _ as sqliteFormatter, V as sqlitePool, y as sqlitePoolClientConnection, F as sqliteSQLExecutor, M as sqliteSingletonConnectionPool, a0 as sqliteTransaction, Z as tableExists, Y as tableExistsSQL, U as toSqlitePoolOptions, u as transactionNestingCounter } from './index-C2z_XBn6.js';
3
- import { C as Connection, a as DatabaseTransactionOptions, d as DumboDatabaseDriver, e as Dumbo, S as SQLFormatter, M as MigratorOptions, f as DumboConnectionOptions } from './connectionString-B1wm0TFc.js';
1
+ import { SQLiteClientOrPoolClient, SQLiteClientOptions, SQLiteFileNameOrConnectionString, SQLiteDriverType, SQLiteTransaction, SQLiteTransactionOptions, SQLiteConnectionOptions, SQLiteClient, SQLitePoolOptions, SQLitePool, AnySQLiteConnection, SQLiteConnectionString } from './sqlite.js';
2
+ export { AnySQLiteClientConnection, AnySQLitePoolClientConnection, BatchSQLiteCommandOptions, DEFAULT_SQLITE_PRAGMA_OPTIONS, DefaultSQLiteMigratorOptions, InMemorySQLiteDatabase, SQLiteAlwaysNewConnectionPool, SQLiteAmbientConnectionPool, SQLiteClientConnection, SQLiteClientConnectionDefinitionOptions, SQLiteClientFactory, SQLiteCommandOptions, SQLiteConnection, SQLiteConnectionDefinitionOptions, SQLiteConnectionFactory, SQLiteDatabaseName, SQLiteDatabaseType, SQLiteError, SQLiteErrorMapper, SQLiteParameters, SQLitePoolClient, SQLitePoolClientConnection, SQLitePoolConnectionDefinitionOptions, SQLitePoolFactoryOptions, SQLitePragmaOptions, SQLiteSQLExecutor, SQLiteSingletonConnectionPool, SQLiteTransactionMode, SqliteAmbientClientConnectionOptions, TransactionNestingCounter, defaultSQLiteDatabase, isInMemoryDatabase, isSQLiteError, mapSqliteError, parsePragmasFromConnectionString, sqliteAlwaysNewConnectionPool, sqliteAmbientClientConnection, sqliteAmbientConnectionPool, sqliteClientConnection, sqliteConnection, sqliteExecute, sqliteFormatter, sqliteMetadata, sqlitePool, sqlitePoolClientConnection, sqliteSQLExecutor, sqliteSingletonConnectionPool, sqliteTransaction, tableExists, toSqlitePoolOptions, transactionNestingCounter } from './sqlite.js';
3
+ import { C as Connection, J as JSONSerializer, c as DumboConnectionOptions, d as DumboDatabaseDriver, e as ConnectionOptions, f as SQLFormatter, M as MigratorOptions, g as DatabaseMetadata } from './connectionString-Dch_MIRU.js';
4
4
 
5
5
  type SQLite3DriverType = SQLiteDriverType<'sqlite3'>;
6
6
  declare const SQLite3DriverType: SQLite3DriverType;
@@ -19,66 +19,86 @@ type SQLite3ConnectionOptions = SQLiteConnectionOptions & ((SQLite3ClientOptions
19
19
  }) | {
20
20
  client: SQLite3Client;
21
21
  });
22
- type SQLite3Connection<ClientType extends SQLiteClientOrPoolClient = SQLiteClientOrPoolClient> = Connection<SQLite3Connection, SQLite3DriverType, ClientType, SQLiteTransaction<SQLite3Connection>, DatabaseTransactionOptions>;
23
- declare const sqlite3Client: (options: SQLite3ClientOptions) => SQLiteClient;
24
- declare const checkConnection: (fileName: string) => Promise<ConnectionCheckResult>;
25
- declare const sqlite3Connection: (options: SQLite3ConnectionOptions) => SQLite3Connection<SQLiteClientOrPoolClient>;
22
+ type SQLite3Connection<ClientType extends SQLiteClientOrPoolClient = SQLiteClientOrPoolClient> = Connection<SQLite3Connection, SQLite3DriverType, ClientType, SQLiteTransaction<SQLite3Connection, SQLiteTransactionOptions>>;
23
+ declare const sqlite3Client: (options: SQLite3ClientOptions & {
24
+ serializer: JSONSerializer;
25
+ }) => SQLiteClient;
26
+ declare const checkConnection: (fileName: string, serializer: JSONSerializer) => Promise<ConnectionCheckResult>;
27
+ declare const sqlite3Connection: (options: SQLite3ConnectionOptions & {
28
+ serializer: JSONSerializer;
29
+ }) => SQLite3Connection<SQLiteClientOrPoolClient>;
26
30
 
27
- type SQLite3DumboOptions = Omit<SQLitePoolOptions<SQLite3Connection, SQLite3ConnectionOptions>, 'driverType'> & SQLite3ConnectionOptions;
31
+ type SQLite3DumboOptions = Omit<SQLitePoolOptions<SQLite3Connection, SQLite3ConnectionOptions>, 'driverType'> & SQLite3ConnectionOptions & {
32
+ serializer?: JSONSerializer;
33
+ };
34
+ type SQLite3PoolOptions = SQLite3DumboOptions;
35
+ type Sqlite3Pool = SQLitePool<SQLite3Connection>;
28
36
  declare const sqlite3Pool: (options: SQLite3DumboOptions) => SQLitePool<SQLite3Connection>;
29
- declare const sqlite3DatabaseDriver: {
37
+ declare const sqlite3DumboDriver: {
30
38
  driverType: "SQLite:sqlite3";
31
39
  createPool: (options: ({
32
- driver?: DumboDatabaseDriver<SQLite3Connection, SQLite3DumboOptions, Dumbo<"SQLite:sqlite3", SQLite3Connection>>;
40
+ driver?: DumboDatabaseDriver<SQLite3Connection, SQLite3DumboOptions, Sqlite3Pool>;
33
41
  driverType?: "SQLite:sqlite3";
34
- } & Omit<Omit<SQLitePoolOptions<SQLite3Connection, SQLite3ConnectionOptions>, "driverType"> & SQLiteConnectionOptions & {
42
+ } & Omit<Omit<SQLitePoolOptions<SQLite3Connection, SQLite3ConnectionOptions>, "driverType"> & ConnectionOptions<AnySQLiteConnection> & SQLiteClientOptions & {
35
43
  fileName: string | SQLiteConnectionString;
36
44
  connectionString?: never;
37
45
  } & {
38
46
  client?: never;
47
+ } & {
48
+ serializer?: JSONSerializer;
39
49
  }, "driverType" | "driver" | "connectionString">) | ({
40
- driver?: DumboDatabaseDriver<SQLite3Connection, SQLite3DumboOptions, Dumbo<"SQLite:sqlite3", SQLite3Connection>>;
50
+ driver?: DumboDatabaseDriver<SQLite3Connection, SQLite3DumboOptions, Sqlite3Pool>;
41
51
  driverType?: "SQLite:sqlite3";
42
- } & Omit<Omit<SQLitePoolOptions<SQLite3Connection, SQLite3ConnectionOptions>, "driverType"> & SQLiteConnectionOptions & {
52
+ } & Omit<Omit<SQLitePoolOptions<SQLite3Connection, SQLite3ConnectionOptions>, "driverType"> & ConnectionOptions<AnySQLiteConnection> & SQLiteClientOptions & {
43
53
  connectionString: string | SQLiteConnectionString;
44
54
  fileName?: never;
45
55
  } & {
46
56
  client?: never;
57
+ } & {
58
+ serializer?: JSONSerializer;
47
59
  }, "driverType" | "driver" | "connectionString">) | ({
48
- driver?: DumboDatabaseDriver<SQLite3Connection, SQLite3DumboOptions, Dumbo<"SQLite:sqlite3", SQLite3Connection>>;
60
+ driver?: DumboDatabaseDriver<SQLite3Connection, SQLite3DumboOptions, Sqlite3Pool>;
49
61
  driverType?: "SQLite:sqlite3";
50
- } & Omit<Omit<SQLitePoolOptions<SQLite3Connection, SQLite3ConnectionOptions>, "driverType"> & SQLiteConnectionOptions & {
62
+ } & Omit<Omit<SQLitePoolOptions<SQLite3Connection, SQLite3ConnectionOptions>, "driverType"> & ConnectionOptions<AnySQLiteConnection> & SQLiteClientOptions & {
51
63
  client: SQLite3Client;
64
+ } & {
65
+ serializer?: JSONSerializer;
52
66
  }, "driverType" | "driver" | "connectionString">)) => SQLitePool<SQLite3Connection>;
53
67
  sqlFormatter: SQLFormatter;
54
68
  defaultMigratorOptions: MigratorOptions;
55
- getDatabaseNameOrDefault: () => SQLiteConnectionString;
56
69
  canHandle: (options: ({
57
- driver?: DumboDatabaseDriver<SQLite3Connection, SQLite3DumboOptions, Dumbo<"SQLite:sqlite3", SQLite3Connection>>;
70
+ driver?: DumboDatabaseDriver<SQLite3Connection, SQLite3DumboOptions, Sqlite3Pool>;
58
71
  driverType?: "SQLite:sqlite3";
59
- } & Omit<Omit<SQLitePoolOptions<SQLite3Connection, SQLite3ConnectionOptions>, "driverType"> & SQLiteConnectionOptions & {
72
+ } & Omit<Omit<SQLitePoolOptions<SQLite3Connection, SQLite3ConnectionOptions>, "driverType"> & ConnectionOptions<AnySQLiteConnection> & SQLiteClientOptions & {
60
73
  fileName: string | SQLiteConnectionString;
61
74
  connectionString?: never;
62
75
  } & {
63
76
  client?: never;
77
+ } & {
78
+ serializer?: JSONSerializer;
64
79
  }, "driverType" | "driver" | "connectionString">) | ({
65
- driver?: DumboDatabaseDriver<SQLite3Connection, SQLite3DumboOptions, Dumbo<"SQLite:sqlite3", SQLite3Connection>>;
80
+ driver?: DumboDatabaseDriver<SQLite3Connection, SQLite3DumboOptions, Sqlite3Pool>;
66
81
  driverType?: "SQLite:sqlite3";
67
- } & Omit<Omit<SQLitePoolOptions<SQLite3Connection, SQLite3ConnectionOptions>, "driverType"> & SQLiteConnectionOptions & {
82
+ } & Omit<Omit<SQLitePoolOptions<SQLite3Connection, SQLite3ConnectionOptions>, "driverType"> & ConnectionOptions<AnySQLiteConnection> & SQLiteClientOptions & {
68
83
  connectionString: string | SQLiteConnectionString;
69
84
  fileName?: never;
70
85
  } & {
71
86
  client?: never;
87
+ } & {
88
+ serializer?: JSONSerializer;
72
89
  }, "driverType" | "driver" | "connectionString">) | ({
73
- driver?: DumboDatabaseDriver<SQLite3Connection, SQLite3DumboOptions, Dumbo<"SQLite:sqlite3", SQLite3Connection>>;
90
+ driver?: DumboDatabaseDriver<SQLite3Connection, SQLite3DumboOptions, Sqlite3Pool>;
74
91
  driverType?: "SQLite:sqlite3";
75
- } & Omit<Omit<SQLitePoolOptions<SQLite3Connection, SQLite3ConnectionOptions>, "driverType"> & SQLiteConnectionOptions & {
92
+ } & Omit<Omit<SQLitePoolOptions<SQLite3Connection, SQLite3ConnectionOptions>, "driverType"> & ConnectionOptions<AnySQLiteConnection> & SQLiteClientOptions & {
76
93
  client: SQLite3Client;
94
+ } & {
95
+ serializer?: JSONSerializer;
77
96
  }, "driverType" | "driver" | "connectionString">)) => boolean;
97
+ databaseMetadata: DatabaseMetadata<false, false, false>;
78
98
  };
79
- declare const useSqlite3DatabaseDriver: () => void;
80
- type SQLite3DumboConnectionOptions = DumboConnectionOptions<typeof sqlite3DatabaseDriver> & {
99
+ declare const useSqlite3DumboDriver: () => void;
100
+ type SQLite3DumboConnectionOptions = DumboConnectionOptions<typeof sqlite3DumboDriver> & {
81
101
  connectionString: string | SQLiteConnectionString;
82
102
  };
83
103
 
84
- export { type ConnectionCheckResult, type SQLite3Client, type SQLite3ClientOptions, type SQLite3Connection, type SQLite3ConnectionOptions, SQLite3DriverType, type SQLite3DumboConnectionOptions, type SQLite3DumboOptions, SQLiteClient, SQLiteClientOptions, SQLiteClientOrPoolClient, SQLiteConnectionOptions, SQLiteConnectionString, SQLiteDriverType, SQLiteFileNameOrConnectionString, SQLitePool, SQLitePoolOptions, SQLiteTransaction, checkConnection, sqlite3Pool as connectionPool, sqlite3DatabaseDriver as databaseDriver, sqlite3Client, sqlite3Connection, sqlite3DatabaseDriver, sqlite3Pool, sqlite3Client as sqliteClient, useSqlite3DatabaseDriver };
104
+ export { AnySQLiteConnection, type ConnectionCheckResult, type SQLite3Client, type SQLite3ClientOptions, type SQLite3Connection, type SQLite3ConnectionOptions, SQLite3DriverType, type SQLite3DumboConnectionOptions, type SQLite3DumboOptions, type SQLite3PoolOptions, SQLiteClient, SQLiteClientOptions, SQLiteClientOrPoolClient, SQLiteConnectionOptions, SQLiteConnectionString, SQLiteDriverType, SQLiteFileNameOrConnectionString, SQLitePool, SQLitePoolOptions, SQLiteTransaction, SQLiteTransactionOptions, type Sqlite3Pool, checkConnection, sqlite3Client, sqlite3Connection, sqlite3DumboDriver, sqlite3Pool, useSqlite3DumboDriver };
package/dist/sqlite3.js CHANGED
@@ -1,20 +1,13 @@
1
1
  import {
2
- SQLite3DriverType,
3
- checkConnection,
4
- sqlite3Client,
5
- sqlite3Connection,
6
- sqlite3DatabaseDriver,
7
- sqlite3Pool,
8
- useSqlite3DatabaseDriver
9
- } from "./chunk-F7JQ7BX7.js";
10
- import {
2
+ DEFAULT_SQLITE_PRAGMA_OPTIONS,
11
3
  DefaultSQLiteMigratorOptions,
12
4
  InMemorySQLiteDatabase,
13
5
  SQLiteConnectionString,
14
6
  SQLiteDatabaseName,
15
- defaultPostgreSqlDatabase,
16
7
  isInMemoryDatabase,
17
8
  isSQLiteError,
9
+ mapSqliteError,
10
+ parsePragmasFromConnectionString,
18
11
  sqliteAlwaysNewConnectionPool,
19
12
  sqliteAmbientClientConnection,
20
13
  sqliteAmbientConnectionPool,
@@ -27,46 +20,366 @@ import {
27
20
  sqliteSQLExecutor,
28
21
  sqliteSingletonConnectionPool,
29
22
  sqliteTransaction,
30
- tableExists,
31
- tableExistsSQL,
32
23
  toSqlitePoolOptions,
33
24
  transactionNestingCounter
34
- } from "./chunk-XVV3OOQX.js";
35
- import "./chunk-TXSETOGH.js";
36
- import "./chunk-N7RWT46K.js";
25
+ } from "./chunk-XFEGS3YT.js";
26
+ import {
27
+ defaultSQLiteDatabase,
28
+ sqliteMetadata,
29
+ tableExists
30
+ } from "./chunk-WLWELSA2.js";
31
+ import {
32
+ BatchCommandNoChangesError,
33
+ JSONSerializer,
34
+ SQL,
35
+ canHandleDriverWithConnectionString,
36
+ dumboDatabaseDriverRegistry
37
+ } from "./chunk-JKE6SULM.js";
38
+
39
+ // src/storage/sqlite/sqlite3/connections/connection.ts
40
+ import sqlite3 from "sqlite3";
41
+
42
+ // src/storage/sqlite/core/connections/pragmas.ts
43
+ var mergePragmaOptions = (connectionString, userOptions) => {
44
+ const connectionStringPragmas = parsePragmasFromConnectionString(connectionString);
45
+ return {
46
+ ...DEFAULT_SQLITE_PRAGMA_OPTIONS,
47
+ ...connectionStringPragmas,
48
+ ...userOptions
49
+ };
50
+ };
51
+ var buildConnectionPragmaStatements = (pragmas) => [
52
+ // busy_timeout FIRST - enables waiting on locks for subsequent operations
53
+ { pragma: "busy_timeout", value: pragmas.busy_timeout },
54
+ { pragma: "synchronous", value: pragmas.synchronous },
55
+ { pragma: "cache_size", value: pragmas.cache_size },
56
+ { pragma: "foreign_keys", value: pragmas.foreign_keys ? "ON" : "OFF" },
57
+ { pragma: "temp_store", value: pragmas.temp_store }
58
+ ];
59
+ var buildDatabasePragmaStatements = (pragmas) => [
60
+ { pragma: "journal_mode", value: pragmas.journal_mode }
61
+ ];
62
+
63
+ // src/storage/sqlite/sqlite3/connections/connection.ts
64
+ var SQLite3DriverType = "SQLite:sqlite3";
65
+ var applyPragma = (database, pragma, value) => {
66
+ return new Promise((resolve, reject) => {
67
+ database.run(`PRAGMA ${pragma} = ${value};`, (err) => {
68
+ if (err) reject(err);
69
+ else resolve();
70
+ });
71
+ });
72
+ };
73
+ var queryPragma = (database, pragma) => new Promise((resolve, reject) => {
74
+ database.get(
75
+ `PRAGMA ${pragma};`,
76
+ (err, row) => {
77
+ if (err) reject(err);
78
+ else resolve(row?.[pragma] ?? "");
79
+ }
80
+ );
81
+ });
82
+ var applyPragmas = (database, pragmas) => pragmas.reduce(
83
+ (promise, { pragma, value }) => promise.then(() => applyPragma(database, pragma, value)),
84
+ Promise.resolve()
85
+ );
86
+ var sqlite3Client = (options) => {
87
+ let db;
88
+ let isClosed = false;
89
+ const { serializer } = options;
90
+ const connectionString = options.fileName ?? options.connectionString ?? InMemorySQLiteDatabase;
91
+ const finalPragmas = mergePragmaOptions(
92
+ String(connectionString),
93
+ options.pragmaOptions
94
+ );
95
+ const connectionPragmas = buildConnectionPragmaStatements(finalPragmas);
96
+ const connect = () => db ? Promise.resolve() : new Promise((resolve, reject) => {
97
+ try {
98
+ db = new sqlite3.Database(
99
+ connectionString,
100
+ sqlite3.OPEN_URI | sqlite3.OPEN_READWRITE | sqlite3.OPEN_CREATE,
101
+ (err) => {
102
+ if (err) {
103
+ reject(err);
104
+ return;
105
+ }
106
+ const busyTimeout = finalPragmas.busy_timeout ?? DEFAULT_SQLITE_PRAGMA_OPTIONS.busy_timeout;
107
+ db.configure("busyTimeout", busyTimeout);
108
+ applyPragmas(
109
+ db,
110
+ connectionPragmas.filter((p) => p.pragma !== "busy_timeout")
111
+ ).then(async () => {
112
+ if (options.skipDatabasePragmas) return;
113
+ const databasePragmas = buildDatabasePragmaStatements(finalPragmas);
114
+ for (const { pragma, value } of databasePragmas) {
115
+ const current = await queryPragma(db, pragma);
116
+ if (current.toUpperCase() !== String(value).toUpperCase()) {
117
+ await applyPragma(db, pragma, value);
118
+ }
119
+ }
120
+ }).then(() => resolve()).catch(reject);
121
+ }
122
+ );
123
+ } catch (error) {
124
+ reject(error);
125
+ }
126
+ });
127
+ const executeQuery = (sql, params) => new Promise((resolve, reject) => {
128
+ try {
129
+ db.all(sql, params ?? [], (err, result) => {
130
+ if (err) {
131
+ reject(err);
132
+ return;
133
+ }
134
+ resolve(result);
135
+ });
136
+ } catch (error) {
137
+ reject(error);
138
+ }
139
+ });
140
+ const executeCommand = (sql, params, options2) => new Promise((resolve, reject) => {
141
+ try {
142
+ if (options2?.ignoreChangesCount === true) {
143
+ db.run(
144
+ sql,
145
+ params ?? [],
146
+ function(err, rows) {
147
+ if (err) {
148
+ reject(err);
149
+ return;
150
+ }
151
+ resolve({
152
+ rowCount: 0,
153
+ rows: rows ?? []
154
+ });
155
+ }
156
+ );
157
+ return;
158
+ }
159
+ db.serialize(() => {
160
+ let hasFailed = false;
161
+ let resultRows = [];
162
+ db.all(sql, params ?? [], (err, rows) => {
163
+ if (err) {
164
+ hasFailed = true;
165
+ return reject(err);
166
+ }
167
+ resultRows = rows;
168
+ });
169
+ db.get(
170
+ "SELECT changes() as changes",
171
+ (err, row) => {
172
+ if (hasFailed) return;
173
+ if (err) return reject(err);
174
+ resolve({
175
+ rowCount: row?.changes ?? 0,
176
+ rows: resultRows
177
+ });
178
+ }
179
+ );
180
+ });
181
+ } catch (error) {
182
+ reject(error);
183
+ }
184
+ });
185
+ return {
186
+ connect,
187
+ close: async () => {
188
+ if (isClosed) {
189
+ return;
190
+ }
191
+ isClosed = true;
192
+ if (db) {
193
+ try {
194
+ await new Promise((resolve, reject) => {
195
+ db.close((err) => {
196
+ if (err) {
197
+ reject(err);
198
+ return;
199
+ }
200
+ resolve();
201
+ });
202
+ });
203
+ } catch (error) {
204
+ throw mapSqliteError(error);
205
+ }
206
+ }
207
+ },
208
+ query: async (sql, _options) => {
209
+ try {
210
+ const { query, params } = sqliteFormatter.format(sql, {
211
+ serializer
212
+ });
213
+ const result = await executeQuery(
214
+ query,
215
+ params
216
+ );
217
+ return { rowCount: result.length, rows: result };
218
+ } catch (error) {
219
+ throw mapSqliteError(error);
220
+ }
221
+ },
222
+ batchQuery: async (sqls, _options) => {
223
+ try {
224
+ const results = [];
225
+ for (const sql of sqls) {
226
+ const { query, params } = sqliteFormatter.format(sql, {
227
+ serializer
228
+ });
229
+ const result = await executeQuery(
230
+ query,
231
+ params
232
+ );
233
+ results.push({ rowCount: result.length, rows: result });
234
+ }
235
+ return results;
236
+ } catch (error) {
237
+ throw mapSqliteError(error);
238
+ }
239
+ },
240
+ command: async (sql, options2) => {
241
+ try {
242
+ const { query, params } = sqliteFormatter.format(sql, {
243
+ serializer
244
+ });
245
+ return await executeCommand(
246
+ query,
247
+ params,
248
+ options2
249
+ );
250
+ } catch (error) {
251
+ throw mapSqliteError(error);
252
+ }
253
+ },
254
+ batchCommand: async (sqls, options2) => {
255
+ try {
256
+ const results = [];
257
+ for (let i = 0; i < sqls.length; i++) {
258
+ const { query, params } = sqliteFormatter.format(sqls[i], {
259
+ serializer
260
+ });
261
+ const result = await executeCommand(
262
+ query,
263
+ params,
264
+ options2
265
+ );
266
+ results.push(result);
267
+ if (options2?.assertChanges && (result.rowCount ?? 0) === 0) {
268
+ throw new BatchCommandNoChangesError(i);
269
+ }
270
+ }
271
+ return results;
272
+ } catch (error) {
273
+ throw mapSqliteError(error);
274
+ }
275
+ }
276
+ };
277
+ };
278
+ var checkConnection = async (fileName, serializer) => {
279
+ const client = sqlite3Client({
280
+ fileName,
281
+ serializer
282
+ });
283
+ try {
284
+ await client.query(SQL`SELECT 1`);
285
+ return { successful: true };
286
+ } catch (error) {
287
+ const code = error instanceof Error && "code" in error && typeof error.code === "string" ? error.code : void 0;
288
+ return {
289
+ successful: false,
290
+ errorType: code === "SQLITE_CANTOPEN" ? "ConnectionRefused" : code === "SQLITE_AUTH" ? "Authentication" : "Unknown",
291
+ code,
292
+ error
293
+ };
294
+ } finally {
295
+ await client.close();
296
+ }
297
+ };
298
+ var sqlite3Connection = (options) => sqliteConnection({
299
+ type: "Client",
300
+ driverType: SQLite3DriverType,
301
+ sqliteClientFactory: (connectionOptions) => {
302
+ if ("client" in connectionOptions && connectionOptions.client) {
303
+ return connectionOptions.client;
304
+ }
305
+ return sqlite3Client({
306
+ ...connectionOptions,
307
+ serializer: options.serializer
308
+ });
309
+ },
310
+ connectionOptions: options,
311
+ serializer: options.serializer
312
+ });
313
+
314
+ // src/storage/sqlite/sqlite3/index.ts
315
+ var sqlite3Pool = (options) => sqlitePool(
316
+ toSqlitePoolOptions({
317
+ ...options,
318
+ driverType: SQLite3DriverType,
319
+ ..."connection" in options ? {} : {
320
+ connectionOptions: options,
321
+ sqliteConnectionFactory: (opts) => sqlite3Connection({
322
+ ...opts,
323
+ serializer: options.serializer ?? JSONSerializer
324
+ })
325
+ }
326
+ })
327
+ );
328
+ var tryParseConnectionString = (connectionString) => {
329
+ try {
330
+ return SQLiteConnectionString(connectionString);
331
+ } catch {
332
+ return null;
333
+ }
334
+ };
335
+ var sqlite3DumboDriver = {
336
+ driverType: SQLite3DriverType,
337
+ createPool: (options) => sqlite3Pool(options),
338
+ sqlFormatter: sqliteFormatter,
339
+ defaultMigratorOptions: DefaultSQLiteMigratorOptions,
340
+ canHandle: canHandleDriverWithConnectionString(
341
+ SQLite3DriverType,
342
+ tryParseConnectionString
343
+ ),
344
+ databaseMetadata: sqliteMetadata
345
+ };
346
+ var useSqlite3DumboDriver = () => {
347
+ dumboDatabaseDriverRegistry.register(SQLite3DriverType, sqlite3DumboDriver);
348
+ };
349
+ useSqlite3DumboDriver();
37
350
  export {
351
+ DEFAULT_SQLITE_PRAGMA_OPTIONS,
38
352
  DefaultSQLiteMigratorOptions,
39
353
  InMemorySQLiteDatabase,
40
354
  SQLite3DriverType,
41
355
  SQLiteConnectionString,
42
356
  SQLiteDatabaseName,
43
357
  checkConnection,
44
- sqlite3Pool as connectionPool,
45
- sqlite3DatabaseDriver as databaseDriver,
46
- defaultPostgreSqlDatabase,
358
+ defaultSQLiteDatabase,
47
359
  isInMemoryDatabase,
48
360
  isSQLiteError,
361
+ mapSqliteError,
362
+ parsePragmasFromConnectionString,
49
363
  sqlite3Client,
50
364
  sqlite3Connection,
51
- sqlite3DatabaseDriver,
365
+ sqlite3DumboDriver,
52
366
  sqlite3Pool,
53
367
  sqliteAlwaysNewConnectionPool,
54
368
  sqliteAmbientClientConnection,
55
369
  sqliteAmbientConnectionPool,
56
- sqlite3Client as sqliteClient,
57
370
  sqliteClientConnection,
58
371
  sqliteConnection,
59
372
  sqliteExecute,
60
373
  sqliteFormatter,
374
+ sqliteMetadata,
61
375
  sqlitePool,
62
376
  sqlitePoolClientConnection,
63
377
  sqliteSQLExecutor,
64
378
  sqliteSingletonConnectionPool,
65
379
  sqliteTransaction,
66
380
  tableExists,
67
- tableExistsSQL,
68
381
  toSqlitePoolOptions,
69
382
  transactionNestingCounter,
70
- useSqlite3DatabaseDriver
383
+ useSqlite3DumboDriver
71
384
  };
72
385
  //# sourceMappingURL=sqlite3.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
1
+ {"version":3,"sources":["../src/storage/sqlite/sqlite3/connections/connection.ts","../src/storage/sqlite/core/connections/pragmas.ts","../src/storage/sqlite/sqlite3/index.ts"],"sourcesContent":["import sqlite3 from 'sqlite3';\nimport type { JSONSerializer } from '../../../../core';\nimport {\n BatchCommandNoChangesError,\n SQL,\n type Connection,\n type QueryResult,\n type QueryResultRow,\n type SQLQueryOptions,\n} from '../../../../core';\nimport { mapSqliteError } from '../../core/errors/errorMapper';\nimport type {\n SQLiteClient,\n SQLiteClientOrPoolClient,\n SQLiteConnectionOptions,\n SQLiteDriverType,\n SQLiteFileNameOrConnectionString,\n SQLiteTransaction,\n SQLiteTransactionOptions,\n} from '../../core';\nimport {\n DEFAULT_SQLITE_PRAGMA_OPTIONS,\n InMemorySQLiteDatabase,\n sqliteConnection,\n type BatchSQLiteCommandOptions,\n type SQLiteClientOptions,\n type SQLiteCommandOptions,\n type SQLiteParameters,\n} from '../../core/connections';\nimport {\n buildConnectionPragmaStatements,\n buildDatabasePragmaStatements,\n mergePragmaOptions,\n} from '../../core/connections/pragmas';\nimport { sqliteFormatter } from '../../core/sql/formatter';\n\nexport type SQLite3DriverType = SQLiteDriverType<'sqlite3'>;\nexport const SQLite3DriverType: SQLite3DriverType = 'SQLite:sqlite3';\n\nexport type ConnectionCheckResult =\n | { successful: true }\n | {\n successful: false;\n code: string | undefined;\n errorType: 'ConnectionRefused' | 'Authentication' | 'Unknown';\n error: unknown;\n };\n\nexport type SQLite3ClientOptions = SQLiteClientOptions &\n SQLiteFileNameOrConnectionString;\n\nexport type SQLite3Client = SQLiteClientOrPoolClient;\n\nexport type SQLite3ConnectionOptions = SQLiteConnectionOptions &\n ((SQLite3ClientOptions & { client?: never }) | { client: SQLite3Client });\n\nexport type SQLite3Connection<\n ClientType extends SQLiteClientOrPoolClient = SQLiteClientOrPoolClient,\n> = Connection<\n SQLite3Connection,\n SQLite3DriverType,\n ClientType,\n SQLiteTransaction<SQLite3Connection, SQLiteTransactionOptions>\n>;\n\nconst applyPragma = (\n database: sqlite3.Database,\n pragma: string,\n value: string | number,\n) => {\n return new Promise<void>((resolve, reject) => {\n database.run(`PRAGMA ${pragma} = ${value};`, (err) => {\n if (err) reject(err);\n else resolve();\n });\n });\n};\n\nconst queryPragma = (\n database: sqlite3.Database,\n pragma: string,\n): Promise<string> =>\n new Promise((resolve, reject) => {\n database.get(\n `PRAGMA ${pragma};`,\n (err: Error | null, row: { [key: string]: string } | null) => {\n if (err) reject(err);\n else resolve(row?.[pragma] ?? '');\n },\n );\n });\n\nconst applyPragmas = (\n database: sqlite3.Database,\n pragmas: Array<{ pragma: string; value: string | number }>,\n) =>\n pragmas.reduce(\n (promise, { pragma, value }) =>\n promise.then(() => applyPragma(database, pragma, value)),\n Promise.resolve(),\n );\n\nexport const sqlite3Client = (\n options: SQLite3ClientOptions & {\n serializer: JSONSerializer;\n },\n): SQLiteClient => {\n let db: sqlite3.Database;\n\n let isClosed = false;\n\n const { serializer } = options;\n\n const connectionString =\n options.fileName ?? options.connectionString ?? InMemorySQLiteDatabase;\n\n const finalPragmas = mergePragmaOptions(\n String(connectionString),\n options.pragmaOptions,\n );\n\n const connectionPragmas = buildConnectionPragmaStatements(finalPragmas);\n\n const connect: () => Promise<void> = () =>\n db\n ? Promise.resolve()\n : new Promise((resolve, reject) => {\n try {\n db = new sqlite3.Database(\n connectionString,\n sqlite3.OPEN_URI | sqlite3.OPEN_READWRITE | sqlite3.OPEN_CREATE,\n (err) => {\n if (err) {\n reject(err);\n return;\n }\n\n const busyTimeout =\n finalPragmas.busy_timeout ??\n DEFAULT_SQLITE_PRAGMA_OPTIONS.busy_timeout!;\n\n db.configure('busyTimeout', busyTimeout);\n\n applyPragmas(\n db,\n connectionPragmas.filter((p) => p.pragma !== 'busy_timeout'),\n )\n .then(async () => {\n if (options.skipDatabasePragmas) return;\n\n const databasePragmas =\n buildDatabasePragmaStatements(finalPragmas);\n for (const { pragma, value } of databasePragmas) {\n const current = await queryPragma(db, pragma);\n if (\n current.toUpperCase() !== String(value).toUpperCase()\n ) {\n await applyPragma(db, pragma, value);\n }\n }\n })\n .then(() => resolve())\n .catch(reject);\n },\n );\n\n // Apply connection-level pragmas first (busy_timeout is first)\n } catch (error) {\n reject(error as Error);\n }\n });\n\n const executeQuery = <T>(\n sql: string,\n params?: SQLiteParameters[],\n ): Promise<T[]> =>\n new Promise((resolve, reject) => {\n try {\n db.all(sql, params ?? [], (err: Error | null, result: T[]) => {\n if (err) {\n reject(err);\n return;\n }\n\n resolve(result);\n });\n } catch (error) {\n reject(error as Error);\n }\n });\n\n const executeCommand = <Result extends QueryResultRow = QueryResultRow>(\n sql: string,\n params?: SQLiteParameters[],\n options?: SQLiteCommandOptions,\n ): Promise<QueryResult<Result>> =>\n new Promise((resolve, reject) => {\n try {\n if (options?.ignoreChangesCount === true) {\n db.run(\n sql,\n params ?? [],\n function (err: Error | null, rows: Result[]) {\n if (err) {\n reject(err);\n return;\n }\n resolve({\n rowCount: 0,\n rows: rows ?? [],\n });\n },\n );\n return;\n }\n // OD: 2026-01-21\n // This is needed as SQLite does not return changes count properly\n // We need to query it separately with SELECT changes()\n // This may be fixed eventually in sqlite3 library as Node.js team did here:\n // https://github.com/nodejs/node/issues/57344\n // But for now, we do it manually, as a workaround\n // We also serialize it to avoid race conditions\n db.serialize(() => {\n let hasFailed = false;\n let resultRows: Result[] = [];\n\n db.all(sql, params ?? [], (err, rows: Result[]) => {\n if (err) {\n hasFailed = true;\n return reject(err);\n }\n resultRows = rows;\n });\n\n db.get(\n 'SELECT changes() as changes',\n (err, row: { changes: number } | null) => {\n // If the first query failed, we exit immediately.\n // The promise is already rejected; we don't want to touch it.\n if (hasFailed) return;\n\n if (err) return reject(err);\n\n resolve({\n rowCount: row?.changes ?? 0,\n rows: resultRows,\n });\n },\n );\n });\n } catch (error) {\n reject(error as Error);\n }\n });\n\n return {\n connect,\n close: async (): Promise<void> => {\n if (isClosed) {\n return;\n }\n isClosed = true;\n if (db) {\n try {\n await new Promise<void>((resolve, reject) => {\n db.close((err: Error | null) => {\n if (err) {\n reject(err);\n return;\n }\n resolve();\n });\n });\n } catch (error) {\n throw mapSqliteError(error);\n }\n }\n },\n query: async <Result extends QueryResultRow = QueryResultRow>(\n sql: SQL,\n _options?: SQLQueryOptions,\n ): Promise<QueryResult<Result>> => {\n try {\n const { query, params } = sqliteFormatter.format(sql, {\n serializer,\n });\n const result = await executeQuery<Result>(\n query,\n params as SQLiteParameters[],\n );\n return { rowCount: result.length, rows: result };\n } catch (error) {\n throw mapSqliteError(error);\n }\n },\n batchQuery: async <Result extends QueryResultRow = QueryResultRow>(\n sqls: SQL[],\n _options?: SQLQueryOptions,\n ): Promise<QueryResult<Result>[]> => {\n try {\n const results: QueryResult<Result>[] = [];\n for (const sql of sqls) {\n const { query, params } = sqliteFormatter.format(sql, {\n serializer,\n });\n const result = await executeQuery<Result>(\n query,\n params as SQLiteParameters[],\n );\n results.push({ rowCount: result.length, rows: result });\n }\n return results;\n } catch (error) {\n throw mapSqliteError(error);\n }\n },\n command: async <Result extends QueryResultRow = QueryResultRow>(\n sql: SQL,\n options?: SQLiteCommandOptions,\n ): Promise<QueryResult<Result>> => {\n try {\n const { query, params } = sqliteFormatter.format(sql, {\n serializer,\n });\n\n return await executeCommand<Result>(\n query,\n params as SQLiteParameters[],\n options,\n );\n } catch (error) {\n throw mapSqliteError(error);\n }\n },\n batchCommand: async <Result extends QueryResultRow = QueryResultRow>(\n sqls: SQL[],\n options?: BatchSQLiteCommandOptions,\n ): Promise<QueryResult<Result>[]> => {\n try {\n const results: QueryResult<Result>[] = [];\n\n for (let i = 0; i < sqls.length; i++) {\n const { query, params } = sqliteFormatter.format(sqls[i]!, {\n serializer,\n });\n const result = await executeCommand<Result>(\n query,\n params as SQLiteParameters[],\n options,\n );\n results.push(result);\n\n if (options?.assertChanges && (result.rowCount ?? 0) === 0) {\n throw new BatchCommandNoChangesError(i);\n }\n }\n return results;\n } catch (error) {\n throw mapSqliteError(error);\n }\n },\n };\n};\n\nexport const checkConnection = async (\n fileName: string,\n serializer: JSONSerializer,\n): Promise<ConnectionCheckResult> => {\n const client = sqlite3Client({\n fileName,\n serializer,\n });\n\n try {\n await client.query(SQL`SELECT 1`);\n return { successful: true };\n } catch (error) {\n const code =\n error instanceof Error &&\n 'code' in error &&\n typeof error.code === 'string'\n ? error.code\n : undefined;\n\n return {\n successful: false,\n errorType:\n code === 'SQLITE_CANTOPEN'\n ? 'ConnectionRefused'\n : code === 'SQLITE_AUTH'\n ? 'Authentication'\n : 'Unknown',\n code,\n error,\n };\n } finally {\n await client.close();\n }\n};\n\nexport const sqlite3Connection = (\n options: SQLite3ConnectionOptions & { serializer: JSONSerializer },\n) =>\n sqliteConnection<SQLite3Connection, SQLite3ConnectionOptions>({\n type: 'Client',\n driverType: SQLite3DriverType,\n sqliteClientFactory: (connectionOptions) => {\n if ('client' in connectionOptions && connectionOptions.client) {\n return connectionOptions.client;\n }\n return sqlite3Client({\n ...connectionOptions,\n serializer: options.serializer,\n });\n },\n connectionOptions: options,\n serializer: options.serializer,\n });\n","import { parsePragmasFromConnectionString } from './connectionString';\nimport {\n DEFAULT_SQLITE_PRAGMA_OPTIONS,\n type SQLitePragmaOptions,\n} from './index';\n\nexport const mergePragmaOptions = (\n connectionString: string,\n userOptions?: Partial<SQLitePragmaOptions>,\n): SQLitePragmaOptions => {\n const connectionStringPragmas =\n parsePragmasFromConnectionString(connectionString);\n\n return {\n ...DEFAULT_SQLITE_PRAGMA_OPTIONS,\n ...connectionStringPragmas,\n ...userOptions,\n };\n};\n\nexport const buildConnectionPragmaStatements = (\n pragmas: SQLitePragmaOptions,\n): Array<{ pragma: string; value: string | number }> => [\n // busy_timeout FIRST - enables waiting on locks for subsequent operations\n { pragma: 'busy_timeout', value: pragmas.busy_timeout! },\n { pragma: 'synchronous', value: pragmas.synchronous! },\n { pragma: 'cache_size', value: pragmas.cache_size! },\n { pragma: 'foreign_keys', value: pragmas.foreign_keys ? 'ON' : 'OFF' },\n { pragma: 'temp_store', value: pragmas.temp_store! },\n];\n\nexport const buildDatabasePragmaStatements = (\n pragmas: SQLitePragmaOptions,\n): Array<{ pragma: string; value: string | number }> => [\n { pragma: 'journal_mode', value: pragmas.journal_mode! },\n];\n","export * from './connections';\nimport {\n canHandleDriverWithConnectionString,\n dumboDatabaseDriverRegistry,\n JSONSerializer,\n type DumboConnectionOptions,\n type DumboDatabaseDriver,\n} from '../../../core';\nimport {\n DefaultSQLiteMigratorOptions,\n SQLiteConnectionString,\n sqliteFormatter,\n sqliteMetadata,\n sqlitePool,\n toSqlitePoolOptions,\n type SQLitePool,\n type SQLitePoolOptions,\n} from '../core';\nimport {\n sqlite3Connection,\n SQLite3DriverType,\n type SQLite3Connection,\n type SQLite3ConnectionOptions,\n} from './connections';\n\nexport type SQLite3DumboOptions = Omit<\n SQLitePoolOptions<SQLite3Connection, SQLite3ConnectionOptions>,\n 'driverType'\n> &\n SQLite3ConnectionOptions & { serializer?: JSONSerializer };\n\nexport type SQLite3PoolOptions = SQLite3DumboOptions;\n\nexport type Sqlite3Pool = SQLitePool<SQLite3Connection>;\n\nexport const sqlite3Pool = (options: SQLite3DumboOptions) =>\n sqlitePool(\n toSqlitePoolOptions({\n ...options,\n driverType: SQLite3DriverType,\n ...('connection' in options\n ? {}\n : {\n connectionOptions: options as SQLite3ConnectionOptions,\n sqliteConnectionFactory: (opts: SQLite3ConnectionOptions) =>\n sqlite3Connection({\n ...opts,\n serializer: options.serializer ?? JSONSerializer,\n }),\n }),\n }),\n );\n\nconst tryParseConnectionString = (connectionString: string) => {\n try {\n return SQLiteConnectionString(connectionString);\n } catch {\n return null;\n }\n};\n\nexport const sqlite3DumboDriver = {\n driverType: SQLite3DriverType,\n createPool: (options) => sqlite3Pool(options as SQLite3DumboOptions),\n sqlFormatter: sqliteFormatter,\n defaultMigratorOptions: DefaultSQLiteMigratorOptions,\n canHandle: canHandleDriverWithConnectionString(\n SQLite3DriverType,\n tryParseConnectionString,\n ),\n databaseMetadata: sqliteMetadata,\n} satisfies DumboDatabaseDriver<\n SQLite3Connection,\n SQLite3DumboOptions,\n Sqlite3Pool\n>;\n\nexport const useSqlite3DumboDriver = () => {\n dumboDatabaseDriverRegistry.register(SQLite3DriverType, sqlite3DumboDriver);\n};\n\nexport type SQLite3DumboConnectionOptions = DumboConnectionOptions<\n typeof sqlite3DumboDriver\n> & { connectionString: string | SQLiteConnectionString };\n\nuseSqlite3DumboDriver();\n\nexport * from './connections';\nexport * from './formatter';\nexport * from './transactions';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,aAAa;;;ACMb,IAAM,qBAAqB,CAChC,kBACA,gBACwB;AACxB,QAAM,0BACJ,iCAAiC,gBAAgB;AAEnD,SAAO;AAAA,IACL,GAAG;AAAA,IACH,GAAG;AAAA,IACH,GAAG;AAAA,EACL;AACF;AAEO,IAAM,kCAAkC,CAC7C,YACsD;AAAA;AAAA,EAEtD,EAAE,QAAQ,gBAAgB,OAAO,QAAQ,aAAc;AAAA,EACvD,EAAE,QAAQ,eAAe,OAAO,QAAQ,YAAa;AAAA,EACrD,EAAE,QAAQ,cAAc,OAAO,QAAQ,WAAY;AAAA,EACnD,EAAE,QAAQ,gBAAgB,OAAO,QAAQ,eAAe,OAAO,MAAM;AAAA,EACrE,EAAE,QAAQ,cAAc,OAAO,QAAQ,WAAY;AACrD;AAEO,IAAM,gCAAgC,CAC3C,YACsD;AAAA,EACtD,EAAE,QAAQ,gBAAgB,OAAO,QAAQ,aAAc;AACzD;;;ADEO,IAAM,oBAAuC;AA4BpD,IAAM,cAAc,CAClB,UACA,QACA,UACG;AACH,SAAO,IAAI,QAAc,CAAC,SAAS,WAAW;AAC5C,aAAS,IAAI,UAAU,MAAM,MAAM,KAAK,KAAK,CAAC,QAAQ;AACpD,UAAI,IAAK,QAAO,GAAG;AAAA,UACd,SAAQ;AAAA,IACf,CAAC;AAAA,EACH,CAAC;AACH;AAEA,IAAM,cAAc,CAClB,UACA,WAEA,IAAI,QAAQ,CAAC,SAAS,WAAW;AAC/B,WAAS;AAAA,IACP,UAAU,MAAM;AAAA,IAChB,CAAC,KAAmB,QAA0C;AAC5D,UAAI,IAAK,QAAO,GAAG;AAAA,UACd,SAAQ,MAAM,MAAM,KAAK,EAAE;AAAA,IAClC;AAAA,EACF;AACF,CAAC;AAEH,IAAM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