@event-driven-io/dumbo 0.13.0-beta.35 → 0.13.0-beta.37

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 (87) hide show
  1. package/dist/cloudflare.cjs +375 -434
  2. package/dist/cloudflare.cjs.map +1 -1
  3. package/dist/cloudflare.d.cts +36 -29
  4. package/dist/cloudflare.d.ts +36 -29
  5. package/dist/cloudflare.js +339 -434
  6. package/dist/cloudflare.js.map +1 -1
  7. package/dist/core-BG__WVn6.js +2262 -0
  8. package/dist/core-BG__WVn6.js.map +1 -0
  9. package/dist/core-BchvTX3G.js +379 -0
  10. package/dist/core-BchvTX3G.js.map +1 -0
  11. package/dist/core-CWZb0zOY.cjs +588 -0
  12. package/dist/core-CWZb0zOY.cjs.map +1 -0
  13. package/dist/core-D-smW7cm.cjs +3243 -0
  14. package/dist/core-D-smW7cm.cjs.map +1 -0
  15. package/dist/core-DXCRR5A9.cjs +450 -0
  16. package/dist/core-DXCRR5A9.cjs.map +1 -0
  17. package/dist/core-DlV8ua1P.js +451 -0
  18. package/dist/core-DlV8ua1P.js.map +1 -0
  19. package/dist/{connectionString-Dch_MIRU.d.cts → index-BDSQvDH2.d.cts} +1010 -922
  20. package/dist/index-BdWFmDhJ.d.cts +68 -0
  21. package/dist/index-BgFHGsuP.d.ts +186 -0
  22. package/dist/index-DaP2fTEX.d.ts +67 -0
  23. package/dist/index-N2ly5shv.d.cts +186 -0
  24. package/dist/index-S_wp0Eaf.d.cts +67 -0
  25. package/dist/index-cxtbLiju.d.ts +68 -0
  26. package/dist/{connectionString-Dch_MIRU.d.ts → index-zkszkJqP.d.ts} +1010 -922
  27. package/dist/index.cjs +212 -359
  28. package/dist/index.cjs.map +1 -1
  29. package/dist/index.d.cts +3 -132
  30. package/dist/index.d.ts +3 -132
  31. package/dist/index.js +52 -361
  32. package/dist/index.js.map +1 -1
  33. package/dist/pg.cjs +366 -431
  34. package/dist/pg.cjs.map +1 -1
  35. package/dist/pg.d.cts +83 -72
  36. package/dist/pg.d.ts +83 -72
  37. package/dist/pg.js +320 -431
  38. package/dist/pg.js.map +1 -1
  39. package/dist/postgreSQLMetadata-BTz6vdwE.js +65 -0
  40. package/dist/postgreSQLMetadata-BTz6vdwE.js.map +1 -0
  41. package/dist/postgreSQLMetadata-WGXySO7a.cjs +118 -0
  42. package/dist/postgreSQLMetadata-WGXySO7a.cjs.map +1 -0
  43. package/dist/postgresql.cjs +25 -50
  44. package/dist/postgresql.d.cts +3 -61
  45. package/dist/postgresql.d.ts +3 -61
  46. package/dist/postgresql.js +4 -50
  47. package/dist/sqlite.cjs +30 -60
  48. package/dist/sqlite.d.cts +3 -190
  49. package/dist/sqlite.d.ts +3 -190
  50. package/dist/sqlite.js +4 -60
  51. package/dist/sqlite3.cjs +432 -380
  52. package/dist/sqlite3.cjs.map +1 -1
  53. package/dist/sqlite3.d.cts +79 -77
  54. package/dist/sqlite3.d.ts +79 -77
  55. package/dist/sqlite3.js +396 -378
  56. package/dist/sqlite3.js.map +1 -1
  57. package/dist/sqliteMetadata-7qBjsMBN.js +29 -0
  58. package/dist/sqliteMetadata-7qBjsMBN.js.map +1 -0
  59. package/dist/sqliteMetadata-PJTRPIZ1.cjs +46 -0
  60. package/dist/sqliteMetadata-PJTRPIZ1.cjs.map +1 -0
  61. package/package.json +12 -12
  62. package/dist/chunk-33P5766L.js +0 -83
  63. package/dist/chunk-33P5766L.js.map +0 -1
  64. package/dist/chunk-4MMMEDQ7.cjs +0 -2944
  65. package/dist/chunk-4MMMEDQ7.cjs.map +0 -1
  66. package/dist/chunk-6HAHSSPW.js +0 -701
  67. package/dist/chunk-6HAHSSPW.js.map +0 -1
  68. package/dist/chunk-GNH5XC6D.cjs +0 -481
  69. package/dist/chunk-GNH5XC6D.cjs.map +0 -1
  70. package/dist/chunk-H2JBS7HM.js +0 -2944
  71. package/dist/chunk-H2JBS7HM.js.map +0 -1
  72. package/dist/chunk-JIZGCEPE.cjs +0 -701
  73. package/dist/chunk-JIZGCEPE.cjs.map +0 -1
  74. package/dist/chunk-NJI6PJFZ.cjs +0 -83
  75. package/dist/chunk-NJI6PJFZ.cjs.map +0 -1
  76. package/dist/chunk-RQ3KKMTP.cjs +0 -34
  77. package/dist/chunk-RQ3KKMTP.cjs.map +0 -1
  78. package/dist/chunk-UK7MXVS2.js +0 -34
  79. package/dist/chunk-UK7MXVS2.js.map +0 -1
  80. package/dist/chunk-Y5TD53QE.js +0 -481
  81. package/dist/chunk-Y5TD53QE.js.map +0 -1
  82. package/dist/columnProcessors-Be2uMYjS.d.cts +0 -8
  83. package/dist/columnProcessors-D0ivj_SU.d.ts +0 -8
  84. package/dist/postgresql.cjs.map +0 -1
  85. package/dist/postgresql.js.map +0 -1
  86. package/dist/sqlite.cjs.map +0 -1
  87. package/dist/sqlite.js.map +0 -1
@@ -0,0 +1,588 @@
1
+ const require_core = require('./core-D-smW7cm.cjs');
2
+ require('./sqliteMetadata-PJTRPIZ1.cjs');
3
+
4
+ //#region src/storage/sqlite/core/errors/errorMapper.ts
5
+ /**
6
+ * Extracts the SQLite error code string from a `sqlite3` driver error.
7
+ *
8
+ * The `sqlite3` (node-sqlite3) driver sets `error.code` to a string like
9
+ * `'SQLITE_CONSTRAINT'` and `error.errno` to the numeric result code.
10
+ * See: https://github.com/TryGhost/node-sqlite3
11
+ */
12
+ const getSqliteErrorCode = (error) => {
13
+ if (error instanceof Error && "code" in error && typeof error.code === "string") return error.code;
14
+ };
15
+ const getErrorMessage = (error) => error instanceof Error ? error.message : void 0;
16
+ const asError = (error) => error instanceof Error ? error : void 0;
17
+ /**
18
+ * Maps a constraint error to a specific DumboError subtype by inspecting the
19
+ * error message. The `sqlite3` driver only exposes the primary result code
20
+ * `SQLITE_CONSTRAINT` — the constraint subtype (UNIQUE, FOREIGN KEY, etc.)
21
+ * is embedded in the message string by SQLite, e.g.:
22
+ * "SQLITE_CONSTRAINT: UNIQUE constraint failed: users.email"
23
+ *
24
+ * Reference: https://www.sqlite.org/rescode.html (extended result codes 275–3091)
25
+ */
26
+ const mapConstraintError = (message, innerError) => {
27
+ const upperMessage = message?.toUpperCase() ?? "";
28
+ if (upperMessage.includes("UNIQUE") || upperMessage.includes("PRIMARY KEY")) return new require_core.UniqueConstraintError(message, innerError);
29
+ if (upperMessage.includes("FOREIGN KEY")) return new require_core.ForeignKeyViolationError(message, innerError);
30
+ if (upperMessage.includes("NOT NULL")) return new require_core.NotNullViolationError(message, innerError);
31
+ if (upperMessage.includes("CHECK")) return new require_core.CheckViolationError(message, innerError);
32
+ return new require_core.IntegrityConstraintViolationError(message, innerError);
33
+ };
34
+ /**
35
+ * Maps a SQLite error (from the `sqlite3` / node-sqlite3 driver) to a typed
36
+ * DumboError based on the SQLite result code.
37
+ *
38
+ * Result code reference: https://www.sqlite.org/rescode.html
39
+ *
40
+ * Falls back to a generic DumboError (500) if the error is not a recognized SQLite error.
41
+ */
42
+ const mapSqliteError = (error) => {
43
+ if (require_core.DumboError.isInstanceOf(error)) return error;
44
+ const code = getSqliteErrorCode(error);
45
+ if (!code) return new require_core.DumboError({
46
+ errorCode: 500,
47
+ message: getErrorMessage(error),
48
+ innerError: asError(error)
49
+ });
50
+ const message = getErrorMessage(error);
51
+ const innerError = asError(error);
52
+ switch (code) {
53
+ case "SQLITE_CONSTRAINT": return mapConstraintError(message, innerError);
54
+ case "SQLITE_BUSY": return new require_core.LockNotAvailableError(message, innerError);
55
+ case "SQLITE_LOCKED": return new require_core.DeadlockError(message, innerError);
56
+ case "SQLITE_PROTOCOL": return new require_core.LockNotAvailableError(message, innerError);
57
+ case "SQLITE_CANTOPEN": return new require_core.ConnectionError(message, innerError);
58
+ case "SQLITE_NOTADB": return new require_core.ConnectionError(message, innerError);
59
+ case "SQLITE_NOMEM": return new require_core.InsufficientResourcesError(message, innerError);
60
+ case "SQLITE_FULL": return new require_core.InsufficientResourcesError(message, innerError);
61
+ case "SQLITE_IOERR": return new require_core.SystemError(message, innerError);
62
+ case "SQLITE_CORRUPT": return new require_core.SystemError(message, innerError);
63
+ case "SQLITE_INTERNAL": return new require_core.SystemError(message, innerError);
64
+ case "SQLITE_NOLFS": return new require_core.SystemError(message, innerError);
65
+ case "SQLITE_TOOBIG": return new require_core.DataError(message, innerError);
66
+ case "SQLITE_MISMATCH": return new require_core.DataError(message, innerError);
67
+ case "SQLITE_RANGE": return new require_core.DataError(message, innerError);
68
+ case "SQLITE_ERROR": return new require_core.InvalidOperationError(message, innerError);
69
+ case "SQLITE_READONLY": return new require_core.InvalidOperationError(message, innerError);
70
+ case "SQLITE_MISUSE": return new require_core.InvalidOperationError(message, innerError);
71
+ case "SQLITE_AUTH": return new require_core.InvalidOperationError(message, innerError);
72
+ case "SQLITE_PERM": return new require_core.InvalidOperationError(message, innerError);
73
+ case "SQLITE_SCHEMA": return new require_core.InvalidOperationError(message, innerError);
74
+ case "SQLITE_ABORT": return new require_core.SerializationError(message, innerError);
75
+ case "SQLITE_INTERRUPT": return new require_core.SerializationError(message, innerError);
76
+ }
77
+ return new require_core.DumboError({
78
+ errorCode: 500,
79
+ message,
80
+ innerError
81
+ });
82
+ };
83
+
84
+ //#endregion
85
+ //#region src/storage/sqlite/core/sql/processors/columProcessors.ts
86
+ const mapColumnType = (token, { builder }) => {
87
+ let columnSQL;
88
+ const { sqlTokenType } = token;
89
+ switch (sqlTokenType) {
90
+ case "SQL_COLUMN_AUTO_INCREMENT":
91
+ columnSQL = `INTEGER ${token.primaryKey ? "PRIMARY KEY" : ""} AUTOINCREMENT`;
92
+ break;
93
+ case "SQL_COLUMN_BIGINT":
94
+ columnSQL = "INTEGER";
95
+ break;
96
+ case "SQL_COLUMN_SERIAL":
97
+ columnSQL = "INTEGER";
98
+ break;
99
+ case "SQL_COLUMN_INTEGER":
100
+ columnSQL = "INTEGER";
101
+ break;
102
+ case "SQL_COLUMN_JSONB":
103
+ columnSQL = "BLOB";
104
+ break;
105
+ case "SQL_COLUMN_BIGSERIAL":
106
+ columnSQL = "INTEGER";
107
+ break;
108
+ case "SQL_COLUMN_TIMESTAMP":
109
+ columnSQL = "DATETIME";
110
+ break;
111
+ case "SQL_COLUMN_TIMESTAMPTZ":
112
+ columnSQL = "DATETIME";
113
+ break;
114
+ case "SQL_COLUMN_VARCHAR":
115
+ columnSQL = `VARCHAR ${Number.isNaN(token.length) ? "" : `(${token.length})`}`;
116
+ break;
117
+ default: throw new Error(`Unknown column type: ${sqlTokenType}`);
118
+ }
119
+ builder.addSQL(columnSQL);
120
+ };
121
+ const sqliteColumnProcessors = require_core.mapDefaultSQLColumnProcessors(mapColumnType);
122
+
123
+ //#endregion
124
+ //#region src/storage/sqlite/core/sql/formatter/index.ts
125
+ const sqliteFormatter = require_core.SQLFormatter({ processorsRegistry: require_core.SQLProcessorsRegistry({ from: require_core.defaultProcessorsRegistry }).register(sqliteColumnProcessors) });
126
+ require_core.registerFormatter("SQLite", sqliteFormatter);
127
+
128
+ //#endregion
129
+ //#region src/storage/sqlite/core/execute/execute.ts
130
+ const sqliteExecute = async (database, handle) => {
131
+ try {
132
+ return await handle(database);
133
+ } finally {
134
+ await database.close();
135
+ }
136
+ };
137
+ const sqliteSQLExecutor = (driverType, serializer, formatter, errorMapper) => ({
138
+ driverType,
139
+ query: async (client, sql, options) => {
140
+ require_core.tracer.info("db:sql:query", {
141
+ query: (formatter ?? sqliteFormatter).format(sql, { serializer }).query,
142
+ params: (formatter ?? sqliteFormatter).format(sql, { serializer }).params,
143
+ debugSQL: (formatter ?? sqliteFormatter).describe(sql, { serializer })
144
+ });
145
+ try {
146
+ let result = await client.query(sql, options);
147
+ if (options?.mapping) result = {
148
+ ...result,
149
+ rows: result.rows.map((row) => require_core.mapSQLQueryResult(row, options.mapping))
150
+ };
151
+ return result;
152
+ } catch (error) {
153
+ require_core.tracer.error("db:sql:query:execute:error", { error });
154
+ throw (errorMapper ?? mapSqliteError)(error);
155
+ }
156
+ },
157
+ batchQuery: async (client, sqls, options) => {
158
+ try {
159
+ const results = await client.batchQuery(sqls, options);
160
+ if (options?.mapping) return results.map((result) => ({
161
+ ...result,
162
+ rows: result.rows.map((row) => require_core.mapSQLQueryResult(row, options.mapping))
163
+ }));
164
+ return results;
165
+ } catch (error) {
166
+ require_core.tracer.error("db:sql:batch_query:execute:error", { error });
167
+ throw (errorMapper ?? mapSqliteError)(error);
168
+ }
169
+ },
170
+ command: async (client, sql, options) => {
171
+ require_core.tracer.info("db:sql:command", {
172
+ query: (formatter ?? sqliteFormatter).format(sql, { serializer }).query,
173
+ params: (formatter ?? sqliteFormatter).format(sql, { serializer }).params,
174
+ debugSQL: (formatter ?? sqliteFormatter).describe(sql, { serializer })
175
+ });
176
+ try {
177
+ return await client.command(sql, options);
178
+ } catch (error) {
179
+ require_core.tracer.error("db:sql:command:execute:error", { error });
180
+ throw (errorMapper ?? mapSqliteError)(error);
181
+ }
182
+ },
183
+ batchCommand: async (client, sqls, options) => {
184
+ try {
185
+ return await client.batchCommand(sqls, options);
186
+ } catch (error) {
187
+ require_core.tracer.error("db:sql:batch_command:execute:error", { error });
188
+ throw (errorMapper ?? mapSqliteError)(error);
189
+ }
190
+ },
191
+ formatter: formatter ?? sqliteFormatter
192
+ });
193
+
194
+ //#endregion
195
+ //#region src/storage/sqlite/core/transactions/index.ts
196
+ const sqliteTransaction = (driverType, connection, allowNestedTransactions, serializer, defaultTransactionMode) => (getClient, options) => {
197
+ const transactionCounter = transactionNestingCounter();
198
+ allowNestedTransactions = options?.allowNestedTransactions ?? allowNestedTransactions;
199
+ let hasBegun = false;
200
+ return {
201
+ connection: connection(),
202
+ driverType,
203
+ begin: async function() {
204
+ const client = await getClient;
205
+ if (allowNestedTransactions) {
206
+ if (transactionCounter.level >= 1) {
207
+ transactionCounter.increment();
208
+ if (options?.useSavepoints) await client.command(require_core.SQL`SAVEPOINT transaction${require_core.SQL.plain(transactionCounter.level.toString())}`);
209
+ return;
210
+ }
211
+ transactionCounter.increment();
212
+ } else if (hasBegun) throw new require_core.InvalidOperationError("Cannot start a nested transaction: allowNestedTransactions is false. Set transactionOptions: { allowNestedTransactions: true } on your pool or connection.");
213
+ hasBegun = true;
214
+ const mode = options?.mode ?? defaultTransactionMode ?? "IMMEDIATE";
215
+ await client.command(require_core.SQL`BEGIN ${require_core.SQL.plain(mode)} TRANSACTION`);
216
+ },
217
+ commit: async function() {
218
+ const client = await getClient;
219
+ if (allowNestedTransactions && transactionCounter.level > 1) {
220
+ if (options?.useSavepoints) await client.command(require_core.SQL`RELEASE transaction${require_core.SQL.plain(transactionCounter.level.toString())}`);
221
+ transactionCounter.decrement();
222
+ return;
223
+ }
224
+ try {
225
+ if (allowNestedTransactions) transactionCounter.reset();
226
+ hasBegun = false;
227
+ await client.command(require_core.SQL`COMMIT`);
228
+ } finally {
229
+ if (options?.close) await options?.close(client);
230
+ }
231
+ },
232
+ rollback: async function(error) {
233
+ const client = await getClient;
234
+ if (allowNestedTransactions && transactionCounter.level > 1) {
235
+ transactionCounter.decrement();
236
+ return;
237
+ }
238
+ try {
239
+ hasBegun = false;
240
+ await client.command(require_core.SQL`ROLLBACK`);
241
+ } finally {
242
+ if (options?.close) await options?.close(client, error);
243
+ }
244
+ },
245
+ execute: require_core.sqlExecutor(sqliteSQLExecutor(driverType, serializer), { connect: () => getClient }),
246
+ _transactionOptions: {
247
+ ...options,
248
+ allowNestedTransactions
249
+ }
250
+ };
251
+ };
252
+
253
+ //#endregion
254
+ //#region src/storage/sqlite/core/connections/connectionString.ts
255
+ const SQLiteConnectionString = (connectionString) => {
256
+ if (!connectionString.startsWith("file:") && connectionString !== ":memory:" && !connectionString.startsWith("/") && !connectionString.startsWith("./")) throw new Error(`Invalid SQLite connection string: ${connectionString}. It should start with "file:", ":memory:", "/", or "./".`);
257
+ return connectionString;
258
+ };
259
+ const parsePragmasFromConnectionString = (connectionString) => {
260
+ const str = String(connectionString);
261
+ if (!str.startsWith("file:")) return {};
262
+ const params = new URL(str).searchParams;
263
+ const pragmas = {};
264
+ const journalMode = params.get("journal_mode");
265
+ if (journalMode !== null) pragmas.journal_mode = journalMode;
266
+ const synchronous = params.get("synchronous");
267
+ if (synchronous !== null) pragmas.synchronous = synchronous;
268
+ const cacheSize = params.get("cache_size");
269
+ if (cacheSize !== null) pragmas.cache_size = parseInt(cacheSize, 10);
270
+ const foreignKeys = params.get("foreign_keys");
271
+ if (foreignKeys !== null) {
272
+ const val = foreignKeys.toLowerCase();
273
+ pragmas.foreign_keys = val === "true" || val === "on" || val === "1";
274
+ }
275
+ const tempStore = params.get("temp_store");
276
+ if (tempStore !== null) pragmas.temp_store = tempStore.toUpperCase();
277
+ const busyTimeout = params.get("busy_timeout");
278
+ if (busyTimeout !== null) pragmas.busy_timeout = parseInt(busyTimeout, 10);
279
+ const mmapSize = params.get("mmap_size");
280
+ if (mmapSize !== null) pragmas.mmap_size = parseInt(mmapSize, 10);
281
+ return pragmas;
282
+ };
283
+
284
+ //#endregion
285
+ //#region src/storage/sqlite/core/connections/index.ts
286
+ const isSQLiteError = (error) => {
287
+ if (error instanceof Error && "code" in error) return true;
288
+ return false;
289
+ };
290
+ const transactionNestingCounter = () => {
291
+ let transactionLevel = 0;
292
+ return {
293
+ reset: () => {
294
+ transactionLevel = 0;
295
+ },
296
+ increment: () => {
297
+ transactionLevel++;
298
+ },
299
+ decrement: () => {
300
+ transactionLevel--;
301
+ if (transactionLevel < 0) throw new Error("Transaction level is out of bounds");
302
+ },
303
+ get level() {
304
+ return transactionLevel;
305
+ }
306
+ };
307
+ };
308
+ const sqliteAmbientClientConnection = (options) => {
309
+ const { client, driverType, initTransaction, allowNestedTransactions, defaultTransactionMode, serializer, errorMapper } = options;
310
+ return require_core.createAmbientConnection({
311
+ driverType,
312
+ client,
313
+ initTransaction: initTransaction ?? ((connection) => sqliteTransaction(driverType, connection, allowNestedTransactions ?? false, serializer, defaultTransactionMode)),
314
+ executor: ({ serializer }) => sqliteSQLExecutor(driverType, serializer, void 0, errorMapper),
315
+ serializer
316
+ });
317
+ };
318
+ const sqliteClientConnection = (options) => {
319
+ const { connectionOptions, sqliteClientFactory, serializer } = options;
320
+ let client = null;
321
+ const connect = async () => {
322
+ if (client) return Promise.resolve(client);
323
+ client = sqliteClientFactory(connectionOptions);
324
+ if (client && "connect" in client && typeof client.connect === "function") try {
325
+ await client.connect();
326
+ } catch (error) {
327
+ throw mapSqliteError(error);
328
+ }
329
+ return client;
330
+ };
331
+ return require_core.createConnection({
332
+ driverType: options.driverType,
333
+ connect,
334
+ close: async () => {
335
+ if (client && "close" in client && typeof client.close === "function") await client.close();
336
+ else if (client && "release" in client && typeof client.release === "function") client.release();
337
+ },
338
+ initTransaction: (connection) => sqliteTransaction(options.driverType, connection, connectionOptions.transactionOptions?.allowNestedTransactions ?? false, serializer, connectionOptions.defaultTransactionMode),
339
+ executor: ({ serializer }) => sqliteSQLExecutor(options.driverType, serializer),
340
+ serializer
341
+ });
342
+ };
343
+ const sqlitePoolClientConnection = (options) => {
344
+ const { connectionOptions, sqliteClientFactory, serializer } = options;
345
+ let client = null;
346
+ const connect = async () => {
347
+ if (client) return Promise.resolve(client);
348
+ client = sqliteClientFactory(connectionOptions);
349
+ try {
350
+ await client.connect();
351
+ } catch (error) {
352
+ throw mapSqliteError(error);
353
+ }
354
+ return client;
355
+ };
356
+ return require_core.createConnection({
357
+ driverType: options.driverType,
358
+ connect,
359
+ close: () => client !== null ? Promise.resolve(client.release()) : Promise.resolve(),
360
+ initTransaction: (connection) => sqliteTransaction(options.driverType, connection, connectionOptions.transactionOptions?.allowNestedTransactions ?? false, serializer, connectionOptions.defaultTransactionMode),
361
+ executor: ({ serializer }) => sqliteSQLExecutor(options.driverType, serializer),
362
+ serializer
363
+ });
364
+ };
365
+ function sqliteConnection(options) {
366
+ return options.type === "Client" ? sqliteClientConnection(options) : sqlitePoolClientConnection(options);
367
+ }
368
+ const InMemorySQLiteDatabase = SQLiteConnectionString(":memory:");
369
+ const DEFAULT_SQLITE_PRAGMA_OPTIONS = {
370
+ journal_mode: "WAL",
371
+ synchronous: "NORMAL",
372
+ cache_size: -1e6,
373
+ foreign_keys: true,
374
+ temp_store: "MEMORY",
375
+ busy_timeout: 5e3,
376
+ mmap_size: 268435456
377
+ };
378
+
379
+ //#endregion
380
+ //#region src/storage/sqlite/core/pool/pool.ts
381
+ const isInMemoryDatabase = (options) => {
382
+ if ("fileName" in options) return options.fileName === InMemorySQLiteDatabase;
383
+ if ("connectionString" in options) return options.connectionString === InMemorySQLiteDatabase;
384
+ return false;
385
+ };
386
+ const sqliteAmbientConnectionPool = (options) => {
387
+ const { connection, driverType } = options;
388
+ return require_core.createAmbientConnectionPool({
389
+ driverType,
390
+ connection
391
+ });
392
+ };
393
+ const sqliteSingletonConnectionPool = (options) => {
394
+ const { driverType, sqliteConnectionFactory, connectionOptions } = options;
395
+ return require_core.createSingletonConnectionPool({
396
+ driverType,
397
+ getConnection: () => sqliteConnectionFactory(connectionOptions)
398
+ });
399
+ };
400
+ const sqliteAlwaysNewConnectionPool = (options) => {
401
+ const { driverType, sqliteConnectionFactory, connectionOptions } = options;
402
+ return require_core.createAlwaysNewConnectionPool({
403
+ driverType,
404
+ getConnection: () => sqliteConnectionFactory(connectionOptions)
405
+ });
406
+ };
407
+ const toSqlitePoolOptions = (options) => {
408
+ const { singleton, ...rest } = options;
409
+ const isInMemory = isInMemoryDatabase(options);
410
+ if ("client" in options && options.client) return {
411
+ ...rest,
412
+ singleton: true
413
+ };
414
+ if (isInMemory) return {
415
+ ...rest,
416
+ singleton: true
417
+ };
418
+ if (singleton === true) return {
419
+ ...rest,
420
+ singleton: true
421
+ };
422
+ return rest;
423
+ };
424
+ function sqlitePool(options) {
425
+ const { driverType } = options;
426
+ if (options.connection) return require_core.createAmbientConnectionPool({
427
+ driverType,
428
+ connection: options.connection
429
+ });
430
+ if (options.singleton === true && options.sqliteConnectionFactory) return require_core.createSingletonConnectionPool({
431
+ driverType,
432
+ getConnection: () => options.sqliteConnectionFactory(options.connectionOptions)
433
+ });
434
+ return require_core.createAlwaysNewConnectionPool({
435
+ driverType,
436
+ getConnection: () => options.sqliteConnectionFactory(options.connectionOptions)
437
+ });
438
+ }
439
+
440
+ //#endregion
441
+ //#region src/storage/sqlite/core/schema/migrations.ts
442
+ const DefaultSQLiteMigratorOptions = {};
443
+ require_core.registerDefaultMigratorOptions("SQLite", DefaultSQLiteMigratorOptions);
444
+
445
+ //#endregion
446
+ //#region src/storage/sqlite/core/index.ts
447
+ const SQLiteDatabaseName = "SQLite";
448
+
449
+ //#endregion
450
+ Object.defineProperty(exports, 'DEFAULT_SQLITE_PRAGMA_OPTIONS', {
451
+ enumerable: true,
452
+ get: function () {
453
+ return DEFAULT_SQLITE_PRAGMA_OPTIONS;
454
+ }
455
+ });
456
+ Object.defineProperty(exports, 'DefaultSQLiteMigratorOptions', {
457
+ enumerable: true,
458
+ get: function () {
459
+ return DefaultSQLiteMigratorOptions;
460
+ }
461
+ });
462
+ Object.defineProperty(exports, 'InMemorySQLiteDatabase', {
463
+ enumerable: true,
464
+ get: function () {
465
+ return InMemorySQLiteDatabase;
466
+ }
467
+ });
468
+ Object.defineProperty(exports, 'SQLiteConnectionString', {
469
+ enumerable: true,
470
+ get: function () {
471
+ return SQLiteConnectionString;
472
+ }
473
+ });
474
+ Object.defineProperty(exports, 'SQLiteDatabaseName', {
475
+ enumerable: true,
476
+ get: function () {
477
+ return SQLiteDatabaseName;
478
+ }
479
+ });
480
+ Object.defineProperty(exports, 'isInMemoryDatabase', {
481
+ enumerable: true,
482
+ get: function () {
483
+ return isInMemoryDatabase;
484
+ }
485
+ });
486
+ Object.defineProperty(exports, 'isSQLiteError', {
487
+ enumerable: true,
488
+ get: function () {
489
+ return isSQLiteError;
490
+ }
491
+ });
492
+ Object.defineProperty(exports, 'mapSqliteError', {
493
+ enumerable: true,
494
+ get: function () {
495
+ return mapSqliteError;
496
+ }
497
+ });
498
+ Object.defineProperty(exports, 'parsePragmasFromConnectionString', {
499
+ enumerable: true,
500
+ get: function () {
501
+ return parsePragmasFromConnectionString;
502
+ }
503
+ });
504
+ Object.defineProperty(exports, 'sqliteAlwaysNewConnectionPool', {
505
+ enumerable: true,
506
+ get: function () {
507
+ return sqliteAlwaysNewConnectionPool;
508
+ }
509
+ });
510
+ Object.defineProperty(exports, 'sqliteAmbientClientConnection', {
511
+ enumerable: true,
512
+ get: function () {
513
+ return sqliteAmbientClientConnection;
514
+ }
515
+ });
516
+ Object.defineProperty(exports, 'sqliteAmbientConnectionPool', {
517
+ enumerable: true,
518
+ get: function () {
519
+ return sqliteAmbientConnectionPool;
520
+ }
521
+ });
522
+ Object.defineProperty(exports, 'sqliteClientConnection', {
523
+ enumerable: true,
524
+ get: function () {
525
+ return sqliteClientConnection;
526
+ }
527
+ });
528
+ Object.defineProperty(exports, 'sqliteConnection', {
529
+ enumerable: true,
530
+ get: function () {
531
+ return sqliteConnection;
532
+ }
533
+ });
534
+ Object.defineProperty(exports, 'sqliteExecute', {
535
+ enumerable: true,
536
+ get: function () {
537
+ return sqliteExecute;
538
+ }
539
+ });
540
+ Object.defineProperty(exports, 'sqliteFormatter', {
541
+ enumerable: true,
542
+ get: function () {
543
+ return sqliteFormatter;
544
+ }
545
+ });
546
+ Object.defineProperty(exports, 'sqlitePool', {
547
+ enumerable: true,
548
+ get: function () {
549
+ return sqlitePool;
550
+ }
551
+ });
552
+ Object.defineProperty(exports, 'sqlitePoolClientConnection', {
553
+ enumerable: true,
554
+ get: function () {
555
+ return sqlitePoolClientConnection;
556
+ }
557
+ });
558
+ Object.defineProperty(exports, 'sqliteSQLExecutor', {
559
+ enumerable: true,
560
+ get: function () {
561
+ return sqliteSQLExecutor;
562
+ }
563
+ });
564
+ Object.defineProperty(exports, 'sqliteSingletonConnectionPool', {
565
+ enumerable: true,
566
+ get: function () {
567
+ return sqliteSingletonConnectionPool;
568
+ }
569
+ });
570
+ Object.defineProperty(exports, 'sqliteTransaction', {
571
+ enumerable: true,
572
+ get: function () {
573
+ return sqliteTransaction;
574
+ }
575
+ });
576
+ Object.defineProperty(exports, 'toSqlitePoolOptions', {
577
+ enumerable: true,
578
+ get: function () {
579
+ return toSqlitePoolOptions;
580
+ }
581
+ });
582
+ Object.defineProperty(exports, 'transactionNestingCounter', {
583
+ enumerable: true,
584
+ get: function () {
585
+ return transactionNestingCounter;
586
+ }
587
+ });
588
+ //# sourceMappingURL=core-CWZb0zOY.cjs.map