@event-driven-io/dumbo 0.13.0-beta.36 → 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 (47) hide show
  1. package/dist/cloudflare.cjs +12 -16
  2. package/dist/cloudflare.cjs.map +1 -1
  3. package/dist/cloudflare.d.cts +1 -1
  4. package/dist/cloudflare.d.ts +1 -1
  5. package/dist/cloudflare.js +12 -16
  6. package/dist/cloudflare.js.map +1 -1
  7. package/dist/{core-DDo4m0Z_.js → core-BG__WVn6.js} +2 -2
  8. package/dist/{core-DDo4m0Z_.js.map → core-BG__WVn6.js.map} +1 -1
  9. package/dist/{core-Bf2ujUFy.js → core-BchvTX3G.js} +3 -3
  10. package/dist/{core-Bf2ujUFy.js.map → core-BchvTX3G.js.map} +1 -1
  11. package/dist/{core-DmbB4qMn.cjs → core-CWZb0zOY.cjs} +23 -91
  12. package/dist/core-CWZb0zOY.cjs.map +1 -0
  13. package/dist/{core-BgYtAxCm.cjs → core-D-smW7cm.cjs} +7 -1
  14. package/dist/{core-BgYtAxCm.cjs.map → core-D-smW7cm.cjs.map} +1 -1
  15. package/dist/{core-Go_IA78L.cjs → core-DXCRR5A9.cjs} +3 -3
  16. package/dist/{core-Go_IA78L.cjs.map → core-DXCRR5A9.cjs.map} +1 -1
  17. package/dist/{core-BeyC5tHn.js → core-DlV8ua1P.js} +23 -91
  18. package/dist/core-DlV8ua1P.js.map +1 -0
  19. package/dist/{index-D1jryNqo.d.ts → index-BgFHGsuP.d.ts} +2 -14
  20. package/dist/{index-DqVvUav9.d.cts → index-N2ly5shv.d.cts} +2 -14
  21. package/dist/index.cjs +3 -3
  22. package/dist/index.js +3 -3
  23. package/dist/pg.cjs +3 -3
  24. package/dist/pg.js +3 -3
  25. package/dist/{postgreSQLMetadata-zMq8yJo_.js → postgreSQLMetadata-BTz6vdwE.js} +2 -2
  26. package/dist/{postgreSQLMetadata-zMq8yJo_.js.map → postgreSQLMetadata-BTz6vdwE.js.map} +1 -1
  27. package/dist/{postgreSQLMetadata-LqX-Z_wo.cjs → postgreSQLMetadata-WGXySO7a.cjs} +2 -2
  28. package/dist/{postgreSQLMetadata-LqX-Z_wo.cjs.map → postgreSQLMetadata-WGXySO7a.cjs.map} +1 -1
  29. package/dist/postgresql.cjs +2 -2
  30. package/dist/postgresql.js +2 -2
  31. package/dist/sqlite.cjs +2 -2
  32. package/dist/sqlite.d.cts +1 -1
  33. package/dist/sqlite.d.ts +1 -1
  34. package/dist/sqlite.js +2 -2
  35. package/dist/sqlite3.cjs +133 -13
  36. package/dist/sqlite3.cjs.map +1 -1
  37. package/dist/sqlite3.d.cts +7 -7
  38. package/dist/sqlite3.d.ts +7 -7
  39. package/dist/sqlite3.js +133 -13
  40. package/dist/sqlite3.js.map +1 -1
  41. package/dist/{sqliteMetadata-BoQ7Sc9I.js → sqliteMetadata-7qBjsMBN.js} +2 -2
  42. package/dist/{sqliteMetadata-BoQ7Sc9I.js.map → sqliteMetadata-7qBjsMBN.js.map} +1 -1
  43. package/dist/{sqliteMetadata-D_2pKeCC.cjs → sqliteMetadata-PJTRPIZ1.cjs} +2 -2
  44. package/dist/{sqliteMetadata-D_2pKeCC.cjs.map → sqliteMetadata-PJTRPIZ1.cjs.map} +1 -1
  45. package/package.json +1 -1
  46. package/dist/core-BeyC5tHn.js.map +0 -1
  47. package/dist/core-DmbB4qMn.cjs.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"postgreSQLMetadata-zMq8yJo_.js","names":[],"sources":["../src/storage/postgresql/core/connections/connectionString.ts","../src/storage/postgresql/core/schema/schema.ts","../src/storage/postgresql/core/schema/postgreSQLMetadata.ts"],"sourcesContent":["import type { DatabaseConnectionString } from '../../../all';\n\nexport const defaultPostgreSQLConnectionString: PostgreSQLConnectionString =\n 'postgresql://postgres@localhost:5432/postgres' as PostgreSQLConnectionString;\n\nexport type PostgreSQLConnectionString = DatabaseConnectionString<\n 'PostgreSQL',\n `postgresql://${string}` | `postgres://${string}`\n>;\n\nexport const PostgreSQLConnectionString = (\n connectionString: string,\n): PostgreSQLConnectionString => {\n if (\n !connectionString.startsWith('postgresql://') &&\n !connectionString.startsWith('postgres://')\n ) {\n throw new Error(\n `Invalid PostgreSQL connection string: ${connectionString}. It should start with \"postgresql://\".`,\n );\n }\n return connectionString as PostgreSQLConnectionString;\n};\n\n// Stripped from https://github.com/brianc/node-postgres\n// Copyright (c) 2010-2014 Brian Carlson (brian.m.carlson@gmail.com)\n// MIT License\n/**\n * Parse database name from a PostgreSQL connection string\n */\nexport function parseDatabaseName(str: string): string | null {\n // Unix socket format: /path/to/socket database_name\n if (str.charAt(0) === '/') {\n const parts = str.split(' ');\n return parts[1] || null;\n }\n\n // Encode spaces if present\n if (/ |%[^a-f0-9]|%[a-f0-9][^a-f0-9]/i.test(str)) {\n str = encodeURI(str).replace(/%25(\\d\\d)/g, '%$1');\n }\n\n let result: URL;\n try {\n result = new URL(str, 'postgres://base');\n } catch {\n // Try with dummy host for malformed URLs\n try {\n result = new URL(str.replace('@/', '@___DUMMY___/'), 'postgres://base');\n } catch {\n return null;\n }\n }\n\n // Socket protocol: socket://path?db=dbname\n if (result.protocol === 'socket:') {\n return result.searchParams.get('db');\n }\n\n // Standard URL: postgres://user:pass@host:port/database\n const pathname = result.pathname.slice(1) || null;\n return pathname ? decodeURI(pathname) : null;\n}\n","import { exists, SQL, type SQLExecutor } from '../../../../core';\nexport * from './schema';\n\nexport const defaultPostgreSqlDatabase = 'postgres';\n\nexport const tableExistsSQL = (tableName: string): SQL =>\n SQL`\n SELECT EXISTS (\n SELECT FROM pg_tables\n WHERE tablename = ${tableName}\n ) AS exists;`;\n\nexport const tableExists = async (\n execute: SQLExecutor,\n tableName: string,\n): Promise<boolean> => exists(execute.query(tableExistsSQL(tableName)));\n\nexport const functionExistsSQL = (functionName: string): SQL =>\n SQL`\n SELECT EXISTS (\n SELECT FROM pg_proc\n WHERE\n proname = ${functionName}\n ) AS exists;`;\n\nexport const functionExists = async (\n execute: SQLExecutor,\n functionName: string,\n): Promise<boolean> => exists(execute.query(functionExistsSQL(functionName)));\n","import type { DatabaseMetadata } from '../../../../core';\nimport { parseDatabaseName } from '../connections';\nimport {\n defaultPostgreSqlDatabase,\n functionExists,\n tableExists,\n} from './schema';\n\nexport const postgreSQLMetadata: DatabaseMetadata<true, true, true> = {\n databaseType: 'PostgreSQL',\n defaultDatabaseName: defaultPostgreSqlDatabase,\n capabilities: {\n supportsSchemas: true,\n supportsFunctions: true,\n supportsMultipleDatabases: true,\n },\n tableExists,\n functionExists,\n parseDatabaseName: (connectionString?: string) =>\n (connectionString ? parseDatabaseName(connectionString) : null) ??\n defaultPostgreSqlDatabase,\n};\n\ndumboDatabaseMetadataRegistry.register('PostgreSQL', postgreSQLMetadata);\n"],"mappings":";;;AAEA,MAAa,oCACX;AAOF,MAAa,8BACX,qBAC+B;AAC/B,KACE,CAAC,iBAAiB,WAAW,gBAAgB,IAC7C,CAAC,iBAAiB,WAAW,cAAc,CAE3C,OAAM,IAAI,MACR,yCAAyC,iBAAiB,yCAC3D;AAEH,QAAO;;;;;AAST,SAAgB,kBAAkB,KAA4B;AAE5D,KAAI,IAAI,OAAO,EAAE,KAAK,IAEpB,QADc,IAAI,MAAM,IAAI,CACf,MAAM;AAIrB,KAAI,mCAAmC,KAAK,IAAI,CAC9C,OAAM,UAAU,IAAI,CAAC,QAAQ,cAAc,MAAM;CAGnD,IAAI;AACJ,KAAI;AACF,WAAS,IAAI,IAAI,KAAK,kBAAkB;SAClC;AAEN,MAAI;AACF,YAAS,IAAI,IAAI,IAAI,QAAQ,MAAM,gBAAgB,EAAE,kBAAkB;UACjE;AACN,UAAO;;;AAKX,KAAI,OAAO,aAAa,UACtB,QAAO,OAAO,aAAa,IAAI,KAAK;CAItC,MAAM,WAAW,OAAO,SAAS,MAAM,EAAE,IAAI;AAC7C,QAAO,WAAW,UAAU,SAAS,GAAG;;;;;AC1D1C,MAAa,4BAA4B;AAEzC,MAAa,kBAAkB,cAC7B,GAAG;;;wBAGmB,UAAU;;AAGlC,MAAa,cAAc,OACzB,SACA,cACqB,OAAO,QAAQ,MAAM,eAAe,UAAU,CAAC,CAAC;AAEvE,MAAa,qBAAqB,iBAChC,GAAG;;;;oBAIe,aAAa;;AAGjC,MAAa,iBAAiB,OAC5B,SACA,iBACqB,OAAO,QAAQ,MAAM,kBAAkB,aAAa,CAAC,CAAC;;;;ACpB7E,MAAa,qBAAyD;CACpE,cAAc;CACd,qBAAqB;CACrB,cAAc;EACZ,iBAAiB;EACjB,mBAAmB;EACnB,2BAA2B;EAC5B;CACD;CACA;CACA,oBAAoB,sBACjB,mBAAmB,kBAAkB,iBAAiB,GAAG;CAE7D;AAED,8BAA8B,SAAS,cAAc,mBAAmB"}
1
+ {"version":3,"file":"postgreSQLMetadata-BTz6vdwE.js","names":[],"sources":["../src/storage/postgresql/core/connections/connectionString.ts","../src/storage/postgresql/core/schema/schema.ts","../src/storage/postgresql/core/schema/postgreSQLMetadata.ts"],"sourcesContent":["import type { DatabaseConnectionString } from '../../../all';\n\nexport const defaultPostgreSQLConnectionString: PostgreSQLConnectionString =\n 'postgresql://postgres@localhost:5432/postgres' as PostgreSQLConnectionString;\n\nexport type PostgreSQLConnectionString = DatabaseConnectionString<\n 'PostgreSQL',\n `postgresql://${string}` | `postgres://${string}`\n>;\n\nexport const PostgreSQLConnectionString = (\n connectionString: string,\n): PostgreSQLConnectionString => {\n if (\n !connectionString.startsWith('postgresql://') &&\n !connectionString.startsWith('postgres://')\n ) {\n throw new Error(\n `Invalid PostgreSQL connection string: ${connectionString}. It should start with \"postgresql://\".`,\n );\n }\n return connectionString as PostgreSQLConnectionString;\n};\n\n// Stripped from https://github.com/brianc/node-postgres\n// Copyright (c) 2010-2014 Brian Carlson (brian.m.carlson@gmail.com)\n// MIT License\n/**\n * Parse database name from a PostgreSQL connection string\n */\nexport function parseDatabaseName(str: string): string | null {\n // Unix socket format: /path/to/socket database_name\n if (str.charAt(0) === '/') {\n const parts = str.split(' ');\n return parts[1] || null;\n }\n\n // Encode spaces if present\n if (/ |%[^a-f0-9]|%[a-f0-9][^a-f0-9]/i.test(str)) {\n str = encodeURI(str).replace(/%25(\\d\\d)/g, '%$1');\n }\n\n let result: URL;\n try {\n result = new URL(str, 'postgres://base');\n } catch {\n // Try with dummy host for malformed URLs\n try {\n result = new URL(str.replace('@/', '@___DUMMY___/'), 'postgres://base');\n } catch {\n return null;\n }\n }\n\n // Socket protocol: socket://path?db=dbname\n if (result.protocol === 'socket:') {\n return result.searchParams.get('db');\n }\n\n // Standard URL: postgres://user:pass@host:port/database\n const pathname = result.pathname.slice(1) || null;\n return pathname ? decodeURI(pathname) : null;\n}\n","import { exists, SQL, type SQLExecutor } from '../../../../core';\nexport * from './schema';\n\nexport const defaultPostgreSqlDatabase = 'postgres';\n\nexport const tableExistsSQL = (tableName: string): SQL =>\n SQL`\n SELECT EXISTS (\n SELECT FROM pg_tables\n WHERE tablename = ${tableName}\n ) AS exists;`;\n\nexport const tableExists = async (\n execute: SQLExecutor,\n tableName: string,\n): Promise<boolean> => exists(execute.query(tableExistsSQL(tableName)));\n\nexport const functionExistsSQL = (functionName: string): SQL =>\n SQL`\n SELECT EXISTS (\n SELECT FROM pg_proc\n WHERE\n proname = ${functionName}\n ) AS exists;`;\n\nexport const functionExists = async (\n execute: SQLExecutor,\n functionName: string,\n): Promise<boolean> => exists(execute.query(functionExistsSQL(functionName)));\n","import type { DatabaseMetadata } from '../../../../core';\nimport { parseDatabaseName } from '../connections';\nimport {\n defaultPostgreSqlDatabase,\n functionExists,\n tableExists,\n} from './schema';\n\nexport const postgreSQLMetadata: DatabaseMetadata<true, true, true> = {\n databaseType: 'PostgreSQL',\n defaultDatabaseName: defaultPostgreSqlDatabase,\n capabilities: {\n supportsSchemas: true,\n supportsFunctions: true,\n supportsMultipleDatabases: true,\n },\n tableExists,\n functionExists,\n parseDatabaseName: (connectionString?: string) =>\n (connectionString ? parseDatabaseName(connectionString) : null) ??\n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,iBAAiB,GAAG;CAE7D;AAED,8BAA8B,SAAS,cAAc,mBAAmB"}
@@ -1,4 +1,4 @@
1
- const require_core = require('./core-BgYtAxCm.cjs');
1
+ const require_core = require('./core-D-smW7cm.cjs');
2
2
 
3
3
  //#region src/storage/postgresql/core/connections/connectionString.ts
4
4
  const defaultPostgreSQLConnectionString = "postgresql://postgres@localhost:5432/postgres";
@@ -115,4 +115,4 @@ Object.defineProperty(exports, 'tableExistsSQL', {
115
115
  return tableExistsSQL;
116
116
  }
117
117
  });
118
- //# sourceMappingURL=postgreSQLMetadata-LqX-Z_wo.cjs.map
118
+ //# sourceMappingURL=postgreSQLMetadata-WGXySO7a.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"postgreSQLMetadata-LqX-Z_wo.cjs","names":["exists"],"sources":["../src/storage/postgresql/core/connections/connectionString.ts","../src/storage/postgresql/core/schema/schema.ts","../src/storage/postgresql/core/schema/postgreSQLMetadata.ts"],"sourcesContent":["import type { DatabaseConnectionString } from '../../../all';\n\nexport const defaultPostgreSQLConnectionString: PostgreSQLConnectionString =\n 'postgresql://postgres@localhost:5432/postgres' as PostgreSQLConnectionString;\n\nexport type PostgreSQLConnectionString = DatabaseConnectionString<\n 'PostgreSQL',\n `postgresql://${string}` | `postgres://${string}`\n>;\n\nexport const PostgreSQLConnectionString = (\n connectionString: string,\n): PostgreSQLConnectionString => {\n if (\n !connectionString.startsWith('postgresql://') &&\n !connectionString.startsWith('postgres://')\n ) {\n throw new Error(\n `Invalid PostgreSQL connection string: ${connectionString}. It should start with \"postgresql://\".`,\n );\n }\n return connectionString as PostgreSQLConnectionString;\n};\n\n// Stripped from https://github.com/brianc/node-postgres\n// Copyright (c) 2010-2014 Brian Carlson (brian.m.carlson@gmail.com)\n// MIT License\n/**\n * Parse database name from a PostgreSQL connection string\n */\nexport function parseDatabaseName(str: string): string | null {\n // Unix socket format: /path/to/socket database_name\n if (str.charAt(0) === '/') {\n const parts = str.split(' ');\n return parts[1] || null;\n }\n\n // Encode spaces if present\n if (/ |%[^a-f0-9]|%[a-f0-9][^a-f0-9]/i.test(str)) {\n str = encodeURI(str).replace(/%25(\\d\\d)/g, '%$1');\n }\n\n let result: URL;\n try {\n result = new URL(str, 'postgres://base');\n } catch {\n // Try with dummy host for malformed URLs\n try {\n result = new URL(str.replace('@/', '@___DUMMY___/'), 'postgres://base');\n } catch {\n return null;\n }\n }\n\n // Socket protocol: socket://path?db=dbname\n if (result.protocol === 'socket:') {\n return result.searchParams.get('db');\n }\n\n // Standard URL: postgres://user:pass@host:port/database\n const pathname = result.pathname.slice(1) || null;\n return pathname ? decodeURI(pathname) : null;\n}\n","import { exists, SQL, type SQLExecutor } from '../../../../core';\nexport * from './schema';\n\nexport const defaultPostgreSqlDatabase = 'postgres';\n\nexport const tableExistsSQL = (tableName: string): SQL =>\n SQL`\n SELECT EXISTS (\n SELECT FROM pg_tables\n WHERE tablename = ${tableName}\n ) AS exists;`;\n\nexport const tableExists = async (\n execute: SQLExecutor,\n tableName: string,\n): Promise<boolean> => exists(execute.query(tableExistsSQL(tableName)));\n\nexport const functionExistsSQL = (functionName: string): SQL =>\n SQL`\n SELECT EXISTS (\n SELECT FROM pg_proc\n WHERE\n proname = ${functionName}\n ) AS exists;`;\n\nexport const functionExists = async (\n execute: SQLExecutor,\n functionName: string,\n): Promise<boolean> => exists(execute.query(functionExistsSQL(functionName)));\n","import type { DatabaseMetadata } from '../../../../core';\nimport { parseDatabaseName } from '../connections';\nimport {\n defaultPostgreSqlDatabase,\n functionExists,\n tableExists,\n} from './schema';\n\nexport const postgreSQLMetadata: DatabaseMetadata<true, true, true> = {\n databaseType: 'PostgreSQL',\n defaultDatabaseName: defaultPostgreSqlDatabase,\n capabilities: {\n supportsSchemas: true,\n supportsFunctions: true,\n supportsMultipleDatabases: true,\n },\n tableExists,\n functionExists,\n parseDatabaseName: (connectionString?: string) =>\n (connectionString ? parseDatabaseName(connectionString) : null) ??\n defaultPostgreSqlDatabase,\n};\n\ndumboDatab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,8BAA8B,SAAS,cAAc,mBAAmB"}
1
+ {"version":3,"file":"postgreSQLMetadata-WGXySO7a.cjs","names":["exists"],"sources":["../src/storage/postgresql/core/connections/connectionString.ts","../src/storage/postgresql/core/schema/schema.ts","../src/storage/postgresql/core/schema/postgreSQLMetadata.ts"],"sourcesContent":["import type { DatabaseConnectionString } from '../../../all';\n\nexport const defaultPostgreSQLConnectionString: PostgreSQLConnectionString =\n 'postgresql://postgres@localhost:5432/postgres' as PostgreSQLConnectionString;\n\nexport type PostgreSQLConnectionString = DatabaseConnectionString<\n 'PostgreSQL',\n `postgresql://${string}` | `postgres://${string}`\n>;\n\nexport const PostgreSQLConnectionString = (\n connectionString: string,\n): PostgreSQLConnectionString => {\n if (\n !connectionString.startsWith('postgresql://') &&\n !connectionString.startsWith('postgres://')\n ) {\n throw new Error(\n `Invalid PostgreSQL connection string: ${connectionString}. It should start with \"postgresql://\".`,\n );\n }\n return connectionString as PostgreSQLConnectionString;\n};\n\n// Stripped from https://github.com/brianc/node-postgres\n// Copyright (c) 2010-2014 Brian Carlson (brian.m.carlson@gmail.com)\n// MIT License\n/**\n * Parse database name from a PostgreSQL connection string\n */\nexport function parseDatabaseName(str: string): string | null {\n // Unix socket format: /path/to/socket database_name\n if (str.charAt(0) === '/') {\n const parts = str.split(' ');\n return parts[1] || null;\n }\n\n // Encode spaces if present\n if (/ |%[^a-f0-9]|%[a-f0-9][^a-f0-9]/i.test(str)) {\n str = encodeURI(str).replace(/%25(\\d\\d)/g, '%$1');\n }\n\n let result: URL;\n try {\n result = new URL(str, 'postgres://base');\n } catch {\n // Try with dummy host for malformed URLs\n try {\n result = new URL(str.replace('@/', '@___DUMMY___/'), 'postgres://base');\n } catch {\n return null;\n }\n }\n\n // Socket protocol: socket://path?db=dbname\n if (result.protocol === 'socket:') {\n return result.searchParams.get('db');\n }\n\n // Standard URL: postgres://user:pass@host:port/database\n const pathname = result.pathname.slice(1) || null;\n return pathname ? decodeURI(pathname) : null;\n}\n","import { exists, SQL, type SQLExecutor } from '../../../../core';\nexport * from './schema';\n\nexport const defaultPostgreSqlDatabase = 'postgres';\n\nexport const tableExistsSQL = (tableName: string): SQL =>\n SQL`\n SELECT EXISTS (\n SELECT FROM pg_tables\n WHERE tablename = ${tableName}\n ) AS exists;`;\n\nexport const tableExists = async (\n execute: SQLExecutor,\n tableName: string,\n): Promise<boolean> => exists(execute.query(tableExistsSQL(tableName)));\n\nexport const functionExistsSQL = (functionName: string): SQL =>\n SQL`\n SELECT EXISTS (\n SELECT FROM pg_proc\n WHERE\n proname = ${functionName}\n ) AS exists;`;\n\nexport const functionExists = async (\n execute: SQLExecutor,\n functionName: string,\n): Promise<boolean> => exists(execute.query(functionExistsSQL(functionName)));\n","import type { DatabaseMetadata } from '../../../../core';\nimport { parseDatabaseName } from '../connections';\nimport {\n defaultPostgreSqlDatabase,\n functionExists,\n tableExists,\n} from './schema';\n\nexport const postgreSQLMetadata: DatabaseMetadata<true, true, true> = {\n databaseType: 'PostgreSQL',\n defaultDatabaseName: defaultPostgreSqlDatabase,\n capabilities: {\n supportsSchemas: true,\n supportsFunctions: true,\n supportsMultipleDatabases: true,\n },\n tableExists,\n functionExists,\n parseDatabaseName: (connectionString?: string) =>\n (connectionString ? parseDatabaseName(connectionString) : null) ??\n defaultPostgreSqlDatabase,\n};\n\ndumboDatabaseMetadataRegistry.register('PostgreSQL', postgreSQLMetadata);\n"],"mappings":";;;AAEA,MAAa,oCACX;AAOF,MAAa,8BACX,qBAC+B;AAC/B,KACE,CAAC,iBAAiB,WAAW,gBAAgB,IAC7C,CAAC,iBAAiB,WAAW,cAAc,CAE3C,OAAM,IAAI,MACR,yCAAyC,iBAAiB,yCAC3D;AAEH,QAAO;;;;;AAST,SAAgB,kBAAkB,KAA4B;AAE5D,KAAI,IAAI,OAAO,EAAE,KAAK,IAEpB,QADc,IAAI,MAAM,IAAI,CACf,MAAM;AAIrB,KAAI,mCAAmC,KAAK,IAAI,CAC9C,OAAM,UAAU,IAAI,CAAC,QAAQ,cAAc,MAAM;CAGnD,IAAI;AACJ,KAAI;AACF,WAAS,IAAI,IAAI,KAAK,kBAAkB;SAClC;AAEN,MAAI;AACF,YAAS,IAAI,IAAI,IAAI,QAAQ,MAAM,gBAAgB,EAAE,kBAAkB;UACjE;AACN,UAAO;;;AAKX,KAAI,OAAO,aAAa,UACtB,QAAO,OAAO,aAAa,IAAI,KAAK;CAItC,MAAM,WAAW,OAAO,SAAS,MAAM,EAAE,IAAI;AAC7C,QAAO,WAAW,UAAU,SAAS,GAAG;;;;;AC1D1C,MAAa,4BAA4B;AAEzC,MAAa,kBAAkB,cAC7B,gBAAG;;;wBAGmB,UAAU;;AAGlC,MAAa,cAAc,OACzB,SACA,cACqBA,oBAAO,QAAQ,MAAM,eAAe,UAAU,CAAC,CAAC;AAEvE,MAAa,qBAAqB,iBAChC,gBAAG;;;;oBAIe,aAAa;;AAGjC,MAAa,iBAAiB,OAC5B,SACA,iBACqBA,oBAAO,QAAQ,MAAM,kBAAkB,aAAa,CAAC,CAAC;;;;ACpB7E,MAAa,qBAAyD;CACpE,cAAc;CACd,qBAAqB;CACrB,cAAc;EACZ,iBAAiB;EACjB,mBAAmB;EACnB,2BAA2B;EAC5B;CACD;CACA;CACA,oBAAoB,sBACjB,mBAAmB,kBAAkB,iBAAiB,GAAG;CAE7D;AAED,8BAA8B,SAAS,cAAc,mBAAmB"}
@@ -1,6 +1,6 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_postgreSQLMetadata = require('./postgreSQLMetadata-LqX-Z_wo.cjs');
3
- const require_core = require('./core-Go_IA78L.cjs');
2
+ const require_postgreSQLMetadata = require('./postgreSQLMetadata-WGXySO7a.cjs');
3
+ const require_core = require('./core-DXCRR5A9.cjs');
4
4
 
5
5
  exports.AdvisoryLock = require_core.AdvisoryLock;
6
6
  exports.DefaultPostgreSQLMigratorOptions = require_core.DefaultPostgreSQLMigratorOptions;
@@ -1,4 +1,4 @@
1
- import { a as tableExists, c as defaultPostgreSQLConnectionString, i as functionExistsSQL, l as parseDatabaseName, n as defaultPostgreSqlDatabase, o as tableExistsSQL, r as functionExists, s as PostgreSQLConnectionString, t as postgreSQLMetadata } from "./postgreSQLMetadata-zMq8yJo_.js";
2
- import { a as PostgreSQLExpandSQLInProcessor, c as acquireAdvisoryLock, d as tryAcquireAdvisoryLock, f as mapPostgresError, i as PostgreSQLArrayProcessor, l as advisoryLock, n as pgFormatter, o as DefaultPostgreSQLMigratorOptions, r as postgreSQLColumnProcessors, s as AdvisoryLock, t as PostgreSQLDatabaseName, u as releaseAdvisoryLock } from "./core-Bf2ujUFy.js";
1
+ import { a as tableExists, c as defaultPostgreSQLConnectionString, i as functionExistsSQL, l as parseDatabaseName, n as defaultPostgreSqlDatabase, o as tableExistsSQL, r as functionExists, s as PostgreSQLConnectionString, t as postgreSQLMetadata } from "./postgreSQLMetadata-BTz6vdwE.js";
2
+ import { a as PostgreSQLExpandSQLInProcessor, c as acquireAdvisoryLock, d as tryAcquireAdvisoryLock, f as mapPostgresError, i as PostgreSQLArrayProcessor, l as advisoryLock, n as pgFormatter, o as DefaultPostgreSQLMigratorOptions, r as postgreSQLColumnProcessors, s as AdvisoryLock, t as PostgreSQLDatabaseName, u as releaseAdvisoryLock } from "./core-BchvTX3G.js";
3
3
 
4
4
  export { AdvisoryLock, DefaultPostgreSQLMigratorOptions, PostgreSQLArrayProcessor, PostgreSQLConnectionString, PostgreSQLDatabaseName, PostgreSQLExpandSQLInProcessor, acquireAdvisoryLock, advisoryLock, defaultPostgreSQLConnectionString, defaultPostgreSqlDatabase, functionExists, functionExistsSQL, mapPostgresError, parseDatabaseName, pgFormatter, postgreSQLColumnProcessors, postgreSQLMetadata, releaseAdvisoryLock, tableExists, tableExistsSQL, tryAcquireAdvisoryLock };
package/dist/sqlite.cjs CHANGED
@@ -1,6 +1,6 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_sqliteMetadata = require('./sqliteMetadata-D_2pKeCC.cjs');
3
- const require_core = require('./core-DmbB4qMn.cjs');
2
+ const require_sqliteMetadata = require('./sqliteMetadata-PJTRPIZ1.cjs');
3
+ const require_core = require('./core-CWZb0zOY.cjs');
4
4
 
5
5
  exports.DEFAULT_SQLITE_PRAGMA_OPTIONS = require_core.DEFAULT_SQLITE_PRAGMA_OPTIONS;
6
6
  exports.DefaultSQLiteMigratorOptions = require_core.DefaultSQLiteMigratorOptions;
package/dist/sqlite.d.cts CHANGED
@@ -1,3 +1,3 @@
1
1
  import { n as sqliteMetadata } from "./index-BDSQvDH2.cjs";
2
- import { $ as SQLitePragmaOptions, A as SQLiteClientConnectionDefinitionOptions, B as SQLiteParameters, C as AnySQLiteConnection, D as InMemorySQLiteDatabase, E as DEFAULT_SQLITE_PRAGMA_OPTIONS, F as SQLiteConnection, G as TransactionNestingCounter, H as SQLitePoolClientConnection, I as SQLiteConnectionDefinitionOptions, J as sqliteClientConnection, K as isSQLiteError, L as SQLiteConnectionFactory, M as SQLiteClientOptions, N as SQLiteClientOrPoolClient, O as SQLiteClient, P as SQLiteCommandOptions, Q as SQLiteConnectionString, R as SQLiteConnectionOptions, S as AnySQLiteClientConnection, T as BatchSQLiteCommandOptions, U as SQLitePoolConnectionDefinitionOptions, V as SQLitePoolClient, W as SqliteAmbientClientConnectionOptions, X as sqlitePoolClientConnection, Y as sqliteConnection, Z as transactionNestingCounter, _ as sqliteAmbientConnectionPool, a as defaultSQLiteDatabase, at as SQLiteErrorMapper, b as toSqlitePoolOptions, c as SQLiteAlwaysNewConnectionPool, ct as sqliteSQLExecutor, d as SQLitePool, et as parsePragmasFromConnectionString, f as SQLitePoolFactoryOptions, g as sqliteAlwaysNewConnectionPool, h as isInMemoryDatabase, i as sqliteFormatter, it as sqliteTransaction, j as SQLiteClientFactory, k as SQLiteClientConnection, l as SQLiteAmbientConnectionPool, m as SQLiteSingletonConnectionPool, n as SQLiteDatabaseType, nt as SQLiteTransactionMode, o as tableExists, ot as SQLiteSQLExecutor, p as SQLitePoolOptions, q as sqliteAmbientClientConnection, r as SQLiteDriverType, rt as SQLiteTransactionOptions, s as DefaultSQLiteMigratorOptions, st as sqliteExecute, t as SQLiteDatabaseName, tt as SQLiteTransaction, u as SQLiteFileNameOrConnectionString, v as sqlitePool, w as AnySQLitePoolClientConnection, x as mapSqliteError, y as sqliteSingletonConnectionPool, z as SQLiteError } from "./index-DqVvUav9.cjs";
2
+ import { $ as SQLitePragmaOptions, A as SQLiteClientConnectionDefinitionOptions, B as SQLiteParameters, C as AnySQLiteConnection, D as InMemorySQLiteDatabase, E as DEFAULT_SQLITE_PRAGMA_OPTIONS, F as SQLiteConnection, G as TransactionNestingCounter, H as SQLitePoolClientConnection, I as SQLiteConnectionDefinitionOptions, J as sqliteClientConnection, K as isSQLiteError, L as SQLiteConnectionFactory, M as SQLiteClientOptions, N as SQLiteClientOrPoolClient, O as SQLiteClient, P as SQLiteCommandOptions, Q as SQLiteConnectionString, R as SQLiteConnectionOptions, S as AnySQLiteClientConnection, T as BatchSQLiteCommandOptions, U as SQLitePoolConnectionDefinitionOptions, V as SQLitePoolClient, W as SqliteAmbientClientConnectionOptions, X as sqlitePoolClientConnection, Y as sqliteConnection, Z as transactionNestingCounter, _ as sqliteAmbientConnectionPool, a as defaultSQLiteDatabase, at as SQLiteErrorMapper, b as toSqlitePoolOptions, c as SQLiteAlwaysNewConnectionPool, ct as sqliteSQLExecutor, d as SQLitePool, et as parsePragmasFromConnectionString, f as SQLitePoolFactoryOptions, g as sqliteAlwaysNewConnectionPool, h as isInMemoryDatabase, i as sqliteFormatter, it as sqliteTransaction, j as SQLiteClientFactory, k as SQLiteClientConnection, l as SQLiteAmbientConnectionPool, m as SQLiteSingletonConnectionPool, n as SQLiteDatabaseType, nt as SQLiteTransactionMode, o as tableExists, ot as SQLiteSQLExecutor, p as SQLitePoolOptions, q as sqliteAmbientClientConnection, r as SQLiteDriverType, rt as SQLiteTransactionOptions, s as DefaultSQLiteMigratorOptions, st as sqliteExecute, t as SQLiteDatabaseName, tt as SQLiteTransaction, u as SQLiteFileNameOrConnectionString, v as sqlitePool, w as AnySQLitePoolClientConnection, x as mapSqliteError, y as sqliteSingletonConnectionPool, z as SQLiteError } from "./index-N2ly5shv.cjs";
3
3
  export { AnySQLiteClientConnection, AnySQLiteConnection, AnySQLitePoolClientConnection, BatchSQLiteCommandOptions, DEFAULT_SQLITE_PRAGMA_OPTIONS, DefaultSQLiteMigratorOptions, InMemorySQLiteDatabase, SQLiteAlwaysNewConnectionPool, SQLiteAmbientConnectionPool, SQLiteClient, SQLiteClientConnection, SQLiteClientConnectionDefinitionOptions, SQLiteClientFactory, SQLiteClientOptions, SQLiteClientOrPoolClient, SQLiteCommandOptions, SQLiteConnection, SQLiteConnectionDefinitionOptions, SQLiteConnectionFactory, SQLiteConnectionOptions, SQLiteConnectionString, SQLiteDatabaseName, SQLiteDatabaseType, SQLiteDriverType, SQLiteError, SQLiteErrorMapper, SQLiteFileNameOrConnectionString, SQLiteParameters, SQLitePool, SQLitePoolClient, SQLitePoolClientConnection, SQLitePoolConnectionDefinitionOptions, SQLitePoolFactoryOptions, SQLitePoolOptions, SQLitePragmaOptions, SQLiteSQLExecutor, SQLiteSingletonConnectionPool, SQLiteTransaction, SQLiteTransactionMode, SQLiteTransactionOptions, SqliteAmbientClientConnectionOptions, TransactionNestingCounter, defaultSQLiteDatabase, isInMemoryDatabase, isSQLiteError, mapSqliteError, parsePragmasFromConnectionString, sqliteAlwaysNewConnectionPool, sqliteAmbientClientConnection, sqliteAmbientConnectionPool, sqliteClientConnection, sqliteConnection, sqliteExecute, sqliteFormatter, sqliteMetadata, sqlitePool, sqlitePoolClientConnection, sqliteSQLExecutor, sqliteSingletonConnectionPool, sqliteTransaction, tableExists, toSqlitePoolOptions, transactionNestingCounter };
package/dist/sqlite.d.ts CHANGED
@@ -1,3 +1,3 @@
1
1
  import { n as sqliteMetadata } from "./index-zkszkJqP.js";
2
- import { $ as SQLitePragmaOptions, A as SQLiteClientConnectionDefinitionOptions, B as SQLiteParameters, C as AnySQLiteConnection, D as InMemorySQLiteDatabase, E as DEFAULT_SQLITE_PRAGMA_OPTIONS, F as SQLiteConnection, G as TransactionNestingCounter, H as SQLitePoolClientConnection, I as SQLiteConnectionDefinitionOptions, J as sqliteClientConnection, K as isSQLiteError, L as SQLiteConnectionFactory, M as SQLiteClientOptions, N as SQLiteClientOrPoolClient, O as SQLiteClient, P as SQLiteCommandOptions, Q as SQLiteConnectionString, R as SQLiteConnectionOptions, S as AnySQLiteClientConnection, T as BatchSQLiteCommandOptions, U as SQLitePoolConnectionDefinitionOptions, V as SQLitePoolClient, W as SqliteAmbientClientConnectionOptions, X as sqlitePoolClientConnection, Y as sqliteConnection, Z as transactionNestingCounter, _ as sqliteAmbientConnectionPool, a as defaultSQLiteDatabase, at as SQLiteErrorMapper, b as toSqlitePoolOptions, c as SQLiteAlwaysNewConnectionPool, ct as sqliteSQLExecutor, d as SQLitePool, et as parsePragmasFromConnectionString, f as SQLitePoolFactoryOptions, g as sqliteAlwaysNewConnectionPool, h as isInMemoryDatabase, i as sqliteFormatter, it as sqliteTransaction, j as SQLiteClientFactory, k as SQLiteClientConnection, l as SQLiteAmbientConnectionPool, m as SQLiteSingletonConnectionPool, n as SQLiteDatabaseType, nt as SQLiteTransactionMode, o as tableExists, ot as SQLiteSQLExecutor, p as SQLitePoolOptions, q as sqliteAmbientClientConnection, r as SQLiteDriverType, rt as SQLiteTransactionOptions, s as DefaultSQLiteMigratorOptions, st as sqliteExecute, t as SQLiteDatabaseName, tt as SQLiteTransaction, u as SQLiteFileNameOrConnectionString, v as sqlitePool, w as AnySQLitePoolClientConnection, x as mapSqliteError, y as sqliteSingletonConnectionPool, z as SQLiteError } from "./index-D1jryNqo.js";
2
+ import { $ as SQLitePragmaOptions, A as SQLiteClientConnectionDefinitionOptions, B as SQLiteParameters, C as AnySQLiteConnection, D as InMemorySQLiteDatabase, E as DEFAULT_SQLITE_PRAGMA_OPTIONS, F as SQLiteConnection, G as TransactionNestingCounter, H as SQLitePoolClientConnection, I as SQLiteConnectionDefinitionOptions, J as sqliteClientConnection, K as isSQLiteError, L as SQLiteConnectionFactory, M as SQLiteClientOptions, N as SQLiteClientOrPoolClient, O as SQLiteClient, P as SQLiteCommandOptions, Q as SQLiteConnectionString, R as SQLiteConnectionOptions, S as AnySQLiteClientConnection, T as BatchSQLiteCommandOptions, U as SQLitePoolConnectionDefinitionOptions, V as SQLitePoolClient, W as SqliteAmbientClientConnectionOptions, X as sqlitePoolClientConnection, Y as sqliteConnection, Z as transactionNestingCounter, _ as sqliteAmbientConnectionPool, a as defaultSQLiteDatabase, at as SQLiteErrorMapper, b as toSqlitePoolOptions, c as SQLiteAlwaysNewConnectionPool, ct as sqliteSQLExecutor, d as SQLitePool, et as parsePragmasFromConnectionString, f as SQLitePoolFactoryOptions, g as sqliteAlwaysNewConnectionPool, h as isInMemoryDatabase, i as sqliteFormatter, it as sqliteTransaction, j as SQLiteClientFactory, k as SQLiteClientConnection, l as SQLiteAmbientConnectionPool, m as SQLiteSingletonConnectionPool, n as SQLiteDatabaseType, nt as SQLiteTransactionMode, o as tableExists, ot as SQLiteSQLExecutor, p as SQLitePoolOptions, q as sqliteAmbientClientConnection, r as SQLiteDriverType, rt as SQLiteTransactionOptions, s as DefaultSQLiteMigratorOptions, st as sqliteExecute, t as SQLiteDatabaseName, tt as SQLiteTransaction, u as SQLiteFileNameOrConnectionString, v as sqlitePool, w as AnySQLitePoolClientConnection, x as mapSqliteError, y as sqliteSingletonConnectionPool, z as SQLiteError } from "./index-BgFHGsuP.js";
3
3
  export { AnySQLiteClientConnection, AnySQLiteConnection, AnySQLitePoolClientConnection, BatchSQLiteCommandOptions, DEFAULT_SQLITE_PRAGMA_OPTIONS, DefaultSQLiteMigratorOptions, InMemorySQLiteDatabase, SQLiteAlwaysNewConnectionPool, SQLiteAmbientConnectionPool, SQLiteClient, SQLiteClientConnection, SQLiteClientConnectionDefinitionOptions, SQLiteClientFactory, SQLiteClientOptions, SQLiteClientOrPoolClient, SQLiteCommandOptions, SQLiteConnection, SQLiteConnectionDefinitionOptions, SQLiteConnectionFactory, SQLiteConnectionOptions, SQLiteConnectionString, SQLiteDatabaseName, SQLiteDatabaseType, SQLiteDriverType, SQLiteError, SQLiteErrorMapper, SQLiteFileNameOrConnectionString, SQLiteParameters, SQLitePool, SQLitePoolClient, SQLitePoolClientConnection, SQLitePoolConnectionDefinitionOptions, SQLitePoolFactoryOptions, SQLitePoolOptions, SQLitePragmaOptions, SQLiteSQLExecutor, SQLiteSingletonConnectionPool, SQLiteTransaction, SQLiteTransactionMode, SQLiteTransactionOptions, SqliteAmbientClientConnectionOptions, TransactionNestingCounter, defaultSQLiteDatabase, isInMemoryDatabase, isSQLiteError, mapSqliteError, parsePragmasFromConnectionString, sqliteAlwaysNewConnectionPool, sqliteAmbientClientConnection, sqliteAmbientConnectionPool, sqliteClientConnection, sqliteConnection, sqliteExecute, sqliteFormatter, sqliteMetadata, sqlitePool, sqlitePoolClientConnection, sqliteSQLExecutor, sqliteSingletonConnectionPool, sqliteTransaction, tableExists, toSqlitePoolOptions, transactionNestingCounter };
package/dist/sqlite.js CHANGED
@@ -1,4 +1,4 @@
1
- import { n as defaultSQLiteDatabase, r as tableExists, t as sqliteMetadata } from "./sqliteMetadata-BoQ7Sc9I.js";
2
- import { C as mapSqliteError, S as sqliteFormatter, _ as SQLiteConnectionString, a as sqliteAmbientConnectionPool, b as sqliteExecute, c as toSqlitePoolOptions, d as isSQLiteError, f as sqliteAmbientClientConnection, g as transactionNestingCounter, h as sqlitePoolClientConnection, i as sqliteAlwaysNewConnectionPool, l as DEFAULT_SQLITE_PRAGMA_OPTIONS, m as sqliteConnection, n as DefaultSQLiteMigratorOptions, o as sqlitePool, p as sqliteClientConnection, r as isInMemoryDatabase, s as sqliteSingletonConnectionPool, t as SQLiteDatabaseName, u as InMemorySQLiteDatabase, v as parsePragmasFromConnectionString, x as sqliteSQLExecutor, y as sqliteTransaction } from "./core-BeyC5tHn.js";
1
+ import { n as defaultSQLiteDatabase, r as tableExists, t as sqliteMetadata } from "./sqliteMetadata-7qBjsMBN.js";
2
+ import { C as mapSqliteError, S as sqliteFormatter, _ as SQLiteConnectionString, a as sqliteAmbientConnectionPool, b as sqliteExecute, c as toSqlitePoolOptions, d as isSQLiteError, f as sqliteAmbientClientConnection, g as transactionNestingCounter, h as sqlitePoolClientConnection, i as sqliteAlwaysNewConnectionPool, l as DEFAULT_SQLITE_PRAGMA_OPTIONS, m as sqliteConnection, n as DefaultSQLiteMigratorOptions, o as sqlitePool, p as sqliteClientConnection, r as isInMemoryDatabase, s as sqliteSingletonConnectionPool, t as SQLiteDatabaseName, u as InMemorySQLiteDatabase, v as parsePragmasFromConnectionString, x as sqliteSQLExecutor, y as sqliteTransaction } from "./core-DlV8ua1P.js";
3
3
 
4
4
  export { DEFAULT_SQLITE_PRAGMA_OPTIONS, DefaultSQLiteMigratorOptions, InMemorySQLiteDatabase, SQLiteConnectionString, SQLiteDatabaseName, defaultSQLiteDatabase, isInMemoryDatabase, isSQLiteError, mapSqliteError, parsePragmasFromConnectionString, sqliteAlwaysNewConnectionPool, sqliteAmbientClientConnection, sqliteAmbientConnectionPool, sqliteClientConnection, sqliteConnection, sqliteExecute, sqliteFormatter, sqliteMetadata, sqlitePool, sqlitePoolClientConnection, sqliteSQLExecutor, sqliteSingletonConnectionPool, sqliteTransaction, tableExists, toSqlitePoolOptions, transactionNestingCounter };
package/dist/sqlite3.cjs CHANGED
@@ -1,9 +1,11 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_core = require('./core-BgYtAxCm.cjs');
3
- const require_sqliteMetadata = require('./sqliteMetadata-D_2pKeCC.cjs');
4
- const require_core$1 = require('./core-DmbB4qMn.cjs');
2
+ const require_core = require('./core-D-smW7cm.cjs');
3
+ const require_sqliteMetadata = require('./sqliteMetadata-PJTRPIZ1.cjs');
4
+ const require_core$1 = require('./core-CWZb0zOY.cjs');
5
5
  let sqlite3 = require("sqlite3");
6
6
  sqlite3 = require_core.__toESM(sqlite3, 1);
7
+ let os = require("os");
8
+ let node_async_hooks = require("node:async_hooks");
7
9
 
8
10
  //#region src/storage/sqlite/core/connections/pragmas.ts
9
11
  const mergePragmaOptions = (connectionString, userOptions) => {
@@ -256,19 +258,137 @@ const sqlite3Connection = (options) => require_core$1.sqliteConnection({
256
258
  serializer: options.serializer
257
259
  });
258
260
 
261
+ //#endregion
262
+ //#region src/storage/sqlite/sqlite3/pool/singletonPool.ts
263
+ const sqlite3SingletonPool = (options) => {
264
+ const inner = require_core.createSingletonConnectionPool({
265
+ driverType: options.driverType,
266
+ getConnection: options.getConnection,
267
+ ...options.closeConnection ? { closeConnection: options.closeConnection } : {}
268
+ });
269
+ const taskProcessor = new require_core.TaskProcessor({
270
+ maxActiveTasks: 1,
271
+ maxQueueSize: options.maxQueueSize ?? 1e3
272
+ });
273
+ const insideWriterTask = new node_async_hooks.AsyncLocalStorage();
274
+ const enqueue = (op) => {
275
+ if (insideWriterTask.getStore() === true) return op();
276
+ return taskProcessor.enqueue(({ ack }) => insideWriterTask.run(true, async () => {
277
+ try {
278
+ return await op();
279
+ } finally {
280
+ ack();
281
+ }
282
+ }));
283
+ };
284
+ return {
285
+ driverType: inner.driverType,
286
+ connection: inner.connection.bind(inner),
287
+ transaction: inner.transaction.bind(inner),
288
+ withConnection: (handle, connectionOptions) => enqueue(() => inner.withConnection(handle, connectionOptions)),
289
+ withTransaction: (handle, transactionOptions) => enqueue(() => inner.withTransaction(handle, transactionOptions)),
290
+ execute: {
291
+ query: (sql, queryOptions) => enqueue(() => inner.execute.query(sql, queryOptions)),
292
+ batchQuery: (sqls, queryOptions) => enqueue(() => inner.execute.batchQuery(sqls, queryOptions)),
293
+ command: (sql, commandOptions) => enqueue(() => inner.execute.command(sql, commandOptions)),
294
+ batchCommand: (sqls, commandOptions) => enqueue(() => inner.execute.batchCommand(sqls, commandOptions))
295
+ },
296
+ close: async () => {
297
+ await taskProcessor.stop();
298
+ await inner.close();
299
+ }
300
+ };
301
+ };
302
+
303
+ //#endregion
304
+ //#region src/storage/sqlite/sqlite3/pool/dualPool.ts
305
+ const sqliteDualConnectionPool = (options) => {
306
+ const { sqliteConnectionFactory, connectionOptions } = options;
307
+ const readerPoolSize = options.readerPoolSize ?? Math.max(4, (0, os.cpus)().length);
308
+ let databaseInitPromise = null;
309
+ const guardSingleConnection = require_core.guardInitializedOnce(async () => {
310
+ if (databaseInitPromise !== null) return databaseInitPromise;
311
+ const initConnection = sqliteConnectionFactory({
312
+ ...connectionOptions,
313
+ skipDatabasePragmas: false,
314
+ readonly: false
315
+ });
316
+ const initPromise = initConnection.open();
317
+ databaseInitPromise = initPromise;
318
+ try {
319
+ await initPromise;
320
+ await initConnection.close();
321
+ } catch (error) {
322
+ databaseInitPromise = null;
323
+ await initConnection.close();
324
+ throw require_core$1.mapSqliteError(error);
325
+ }
326
+ });
327
+ const ensureDatabaseInitialized = async () => {
328
+ if (databaseInitPromise !== null) return databaseInitPromise;
329
+ return guardSingleConnection.ensureInitialized();
330
+ };
331
+ const wrappedConnectionFactory = async (readonly, connectionOptions) => {
332
+ await ensureDatabaseInitialized();
333
+ const connection = sqliteConnectionFactory({
334
+ ...connectionOptions,
335
+ skipDatabasePragmas: true,
336
+ readonly
337
+ });
338
+ await connection.open();
339
+ return connection;
340
+ };
341
+ const writerPool = sqlite3SingletonPool({
342
+ driverType: options.driverType,
343
+ getConnection: () => wrappedConnectionFactory(false, connectionOptions)
344
+ });
345
+ const readerPool = require_core.createBoundedConnectionPool({
346
+ driverType: options.driverType,
347
+ getConnection: () => wrappedConnectionFactory(true, connectionOptions),
348
+ maxConnections: readerPoolSize
349
+ });
350
+ return {
351
+ driverType: options.driverType,
352
+ connection: (connectionOptions) => connectionOptions?.readonly ? readerPool.connection(connectionOptions) : writerPool.connection(connectionOptions),
353
+ execute: {
354
+ query: (...args) => readerPool.execute.query(...args),
355
+ batchQuery: (...args) => readerPool.execute.batchQuery(...args),
356
+ command: (...args) => writerPool.execute.command(...args),
357
+ batchCommand: (...args) => writerPool.execute.batchCommand(...args)
358
+ },
359
+ withConnection: (handle, connectionOptions) => connectionOptions?.readonly ? readerPool.withConnection(handle, connectionOptions) : writerPool.withConnection(handle, connectionOptions),
360
+ transaction: writerPool.transaction,
361
+ withTransaction: writerPool.withTransaction,
362
+ close: async () => {
363
+ await guardSingleConnection.stop();
364
+ await Promise.all([writerPool.close(), readerPool.close()]);
365
+ }
366
+ };
367
+ };
368
+
259
369
  //#endregion
260
370
  //#region src/storage/sqlite/sqlite3/index.ts
261
- const sqlite3Pool = (options) => require_core$1.sqlitePool(require_core$1.toSqlitePoolOptions({
262
- ...options,
263
- driverType: SQLite3DriverType,
264
- ..."connection" in options ? {} : {
371
+ const sqlite3Pool = (options) => {
372
+ if ("connection" in options && options.connection) return require_core$1.sqlitePool(require_core$1.toSqlitePoolOptions({
373
+ ...options,
374
+ driverType: SQLite3DriverType
375
+ }));
376
+ const sqliteConnectionFactory = (opts) => sqlite3Connection({
377
+ ...opts,
378
+ serializer: options.serializer ?? require_core.JSONSerializer
379
+ });
380
+ if (require_core$1.isInMemoryDatabase(options) || "client" in options && Boolean(options.client) || options.singleton === true) return sqlite3SingletonPool({
381
+ driverType: SQLite3DriverType,
382
+ getConnection: () => sqliteConnectionFactory(options)
383
+ });
384
+ const readerPoolSize = options.readerPoolSize;
385
+ return sqliteDualConnectionPool({
386
+ driverType: SQLite3DriverType,
387
+ sqliteConnectionFactory,
265
388
  connectionOptions: options,
266
- sqliteConnectionFactory: (opts) => sqlite3Connection({
267
- ...opts,
268
- serializer: options.serializer ?? require_core.JSONSerializer
269
- })
270
- }
271
- }));
389
+ ...readerPoolSize !== void 0 ? { readerPoolSize } : {}
390
+ });
391
+ };
272
392
  const tryParseConnectionString = (connectionString) => {
273
393
  try {
274
394
  return require_core$1.SQLiteConnectionString(connectionString);
@@ -1 +1 @@
1
- {"version":3,"file":"sqlite3.cjs","names":["parsePragmasFromConnectionString","DEFAULT_SQLITE_PRAGMA_OPTIONS","InMemorySQLiteDatabase","DEFAULT_SQLITE_PRAGMA_OPTIONS","mapSqliteError","sqliteFormatter","BatchCommandNoChangesError","sqliteConnection","sqlitePool","toSqlitePoolOptions","JSONSerializer","SQLiteConnectionString","sqliteFormatter","DefaultSQLiteMigratorOptions","canHandleDriverWithConnectionString","sqliteMetadata"],"sources":["../src/storage/sqlite/core/connections/pragmas.ts","../src/storage/sqlite/sqlite3/connections/connection.ts","../src/storage/sqlite/sqlite3/index.ts"],"sourcesContent":["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 ...(pragmas.mmap_size !== undefined\n ? [{ pragma: 'mmap_size', value: pragmas.mmap_size }]\n : []),\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","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 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 { mapSqliteError } from '../../core/errors/errorMapper';\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\nconst hasReturningClause = (sql: string): boolean => /\\bRETURNING\\b/i.test(sql);\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 instanceof Error ? error : new Error(String(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 instanceof Error ? error : new Error(String(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\n if (hasReturningClause(sql)) {\n db.all(sql, params ?? [], (err, rows: Result[]) => {\n if (err) return reject(err);\n resolve({ rowCount: rows.length, rows });\n });\n return;\n }\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 instanceof Error ? error : new Error(String(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","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,\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":";;;;;;;;AAMA,MAAa,sBACX,kBACA,gBACwB;CACxB,MAAM,0BACJA,gDAAiC,iBAAiB;AAEpD,QAAO;EACL,GAAGC;EACH,GAAG;EACH,GAAG;EACJ;;AAGH,MAAa,mCACX,YACsD;CAEtD;EAAE,QAAQ;EAAgB,OAAO,QAAQ;EAAe;CACxD;EAAE,QAAQ;EAAe,OAAO,QAAQ;EAAc;CACtD;EAAE,QAAQ;EAAc,OAAO,QAAQ;EAAa;CACpD;EAAE,QAAQ;EAAgB,OAAO,QAAQ,eAAe,OAAO;EAAO;CACtE;EAAE,QAAQ;EAAc,OAAO,QAAQ;EAAa;CACpD,GAAI,QAAQ,c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AAG;CACH,YAAY;CACZ,GAAI,gBAAgB,UAChB,EAAE,GACF;EACE,mBAAmB;EACnB,0BAA0B,SACxB,kBAAkB;GAChB,GAAG;GACH,YAAY,QAAQ,cAAcC;GACnC,CAAC;EACL;CACN,CAAC,CACH;AAEH,MAAM,4BAA4B,qBAA6B;AAC7D,KAAI;AACF,SAAOC,sCAAuB,iBAAiB;SACzC;AACN,SAAO;;;AAIX,MAAa,qBAAqB;CAChC,YAAY;CACZ,aAAa,YAAY,YAAY,QAA+B;CACpE,cAAcC;CACd,wBAAwBC;CACxB,WAAWC,iDACT,mBACA,yBACD;CACD,kBAAkBC;CACnB;AAMD,MAAa,8BAA8B;AACzC,0CAA4B,SAAS,mBAAmB,mBAAmB;;AAO7E,uBAAuB"}
1
+ {"version":3,"file":"sqlite3.cjs","names":["parsePragmasFromConnectionString","DEFAULT_SQLITE_PRAGMA_OPTIONS","InMemorySQLiteDatabase","DEFAULT_SQLITE_PRAGMA_OPTIONS","mapSqliteError","sqliteFormatter","BatchCommandNoChangesError","sqliteConnection","createSingletonConnectionPool","TaskProcessor","AsyncLocalStorage","guardInitializedOnce","mapSqliteError","createBoundedConnectionPool","sqlitePool","toSqlitePoolOptions","JSONSerializer","isInMemoryDatabase","SQLiteConnectionString","sqliteFormatter","DefaultSQLiteMigratorOptions","canHandleDriverWithConnectionString","sqliteMetadata"],"sources":["../src/storage/sqlite/core/connections/pragmas.ts","../src/storage/sqlite/sqlite3/connections/connection.ts","../src/storage/sqlite/sqlite3/pool/singletonPool.ts","../src/storage/sqlite/sqlite3/pool/dualPool.ts","../src/storage/sqlite/sqlite3/index.ts"],"sourcesContent":["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 ...(pragmas.mmap_size !== undefined\n ? [{ pragma: 'mmap_size', value: pragmas.mmap_size }]\n : []),\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","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 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 { mapSqliteError } from '../../core/errors/errorMapper';\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\nconst hasReturningClause = (sql: string): boolean => /\\bRETURNING\\b/i.test(sql);\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 instanceof Error ? error : new Error(String(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 instanceof Error ? error : new Error(String(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\n if (hasReturningClause(sql)) {\n db.all(sql, params ?? [], (err, rows: Result[]) => {\n if (err) return reject(err);\n resolve({ rowCount: rows.length, rows });\n });\n return;\n }\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 instanceof Error ? error : new Error(String(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 { AsyncLocalStorage } from 'node:async_hooks';\nimport {\n createSingletonConnectionPool,\n type ConnectionPool,\n} from '../../../../core';\nimport { TaskProcessor } from '../../../../core/taskProcessing';\nimport type { AnySQLiteConnection } from '../../core';\n\nexport type SQLite3SingletonPoolOptions<\n SQLiteConnectionType extends AnySQLiteConnection,\n> = {\n driverType: SQLiteConnectionType['driverType'];\n getConnection: () => SQLiteConnectionType | Promise<SQLiteConnectionType>;\n closeConnection?: (connection: SQLiteConnectionType) => void | Promise<void>;\n maxQueueSize?: number;\n};\n\n// Creates a singleton-connection pool whose callers serialise through a\n// single-slot TaskProcessor. An AsyncLocalStorage flag lets re-entrant calls\n// (made from inside an active task on this pool) bypass the queue instead of\n// deadlocking — that's the path emmett relies on when a workflow handler\n// internally calls back through the same pool (e.g. messageStore.appendToStream).\nexport const sqlite3SingletonPool = <\n SQLiteConnectionType extends AnySQLiteConnection,\n>(\n options: SQLite3SingletonPoolOptions<SQLiteConnectionType>,\n): ConnectionPool<SQLiteConnectionType> => {\n const inner = createSingletonConnectionPool<SQLiteConnectionType>({\n driverType: options.driverType,\n getConnection: options.getConnection,\n ...(options.closeConnection\n ? { closeConnection: options.closeConnection }\n : {}),\n });\n\n const taskProcessor = new TaskProcessor({\n maxActiveTasks: 1,\n maxQueueSize: options.maxQueueSize ?? 1000,\n });\n const insideWriterTask = new AsyncLocalStorage<true>();\n\n const enqueue = <Result>(op: () => Promise<Result>): Promise<Result> => {\n if (insideWriterTask.getStore() === true) {\n return op();\n }\n return taskProcessor.enqueue(({ ack }) =>\n insideWriterTask.run(true, async () => {\n try {\n return await op();\n } finally {\n ack();\n }\n }),\n );\n };\n\n return {\n driverType: inner.driverType,\n connection: inner.connection.bind(inner),\n transaction: inner.transaction.bind(inner),\n withConnection: (handle, connectionOptions) =>\n enqueue(() => inner.withConnection(handle, connectionOptions)),\n withTransaction: (handle, transactionOptions) =>\n enqueue(() => inner.withTransaction(handle, transactionOptions)),\n execute: {\n query: (sql, queryOptions) =>\n enqueue(() => inner.execute.query(sql, queryOptions)),\n batchQuery: (sqls, queryOptions) =>\n enqueue(() => inner.execute.batchQuery(sqls, queryOptions)),\n command: (sql, commandOptions) =>\n enqueue(() => inner.execute.command(sql, commandOptions)),\n batchCommand: (sqls, commandOptions) =>\n enqueue(() => inner.execute.batchCommand(sqls, commandOptions)),\n },\n close: async () => {\n await taskProcessor.stop();\n await inner.close();\n },\n };\n};\n","import { cpus } from 'os';\nimport { createBoundedConnectionPool } from '../../../../core';\nimport { guardInitializedOnce } from '../../../../core/taskProcessing';\nimport type {\n AnySQLiteConnection,\n SQLiteConnectionFactory,\n SQLiteConnectionOptions,\n SQLitePool,\n} from '../../core';\nimport { mapSqliteError } from '../../core/errors';\nimport { sqlite3SingletonPool } from './singletonPool';\n\nexport type SQLiteDualPoolOptions<\n SQLiteConnectionType extends AnySQLiteConnection,\n ConnectionOptions extends SQLiteConnectionOptions,\n> = {\n driverType: SQLiteConnectionType['driverType'];\n dual?: true;\n singleton?: false;\n pooled?: true;\n connection?: never;\n readerPoolSize?: number;\n sqliteConnectionFactory: SQLiteConnectionFactory<\n SQLiteConnectionType,\n ConnectionOptions\n >;\n connectionOptions?: ConnectionOptions;\n};\n\nexport const sqliteDualConnectionPool = <\n SQLiteConnectionType extends AnySQLiteConnection,\n ConnectionOptions extends SQLiteConnectionOptions,\n>(\n options: SQLiteDualPoolOptions<SQLiteConnectionType, ConnectionOptions>,\n): SQLitePool<SQLiteConnectionType> => {\n const { sqliteConnectionFactory, connectionOptions } = options;\n const readerPoolSize = options.readerPoolSize ?? Math.max(4, cpus().length);\n\n let databaseInitPromise: Promise<void> | null = null;\n\n const guardSingleConnection = guardInitializedOnce(async () => {\n if (databaseInitPromise !== null) {\n return databaseInitPromise;\n }\n\n const initConnection = sqliteConnectionFactory({\n ...connectionOptions,\n skipDatabasePragmas: false,\n readonly: false,\n } as ConnectionOptions);\n\n const initPromise = initConnection.open();\n databaseInitPromise = initPromise;\n\n try {\n await initPromise;\n await initConnection.close();\n } catch (error) {\n databaseInitPromise = null;\n await initConnection.close();\n throw mapSqliteError(error);\n }\n });\n\n const ensureDatabaseInitialized = async (): Promise<void> => {\n if (databaseInitPromise !== null) {\n return databaseInitPromise;\n }\n\n return guardSingleConnection.ensureInitialized();\n };\n\n const wrappedConnectionFactory = async (\n readonly: boolean,\n connectionOptions: ConnectionOptions | undefined,\n ): Promise<SQLiteConnectionType> => {\n await ensureDatabaseInitialized();\n\n const connection = sqliteConnectionFactory({\n ...connectionOptions,\n skipDatabasePragmas: true,\n readonly,\n } as ConnectionOptions);\n\n await connection.open();\n\n return connection;\n };\n\n const writerPool = sqlite3SingletonPool<SQLiteConnectionType>({\n driverType: options.driverType,\n getConnection: () => wrappedConnectionFactory(false, connectionOptions),\n });\n\n const readerPool = createBoundedConnectionPool({\n driverType: options.driverType,\n getConnection: () => wrappedConnectionFactory(true, connectionOptions),\n maxConnections: readerPoolSize,\n });\n\n return {\n driverType: options.driverType,\n connection: (connectionOptions) =>\n connectionOptions?.readonly\n ? readerPool.connection(connectionOptions)\n : writerPool.connection(connectionOptions),\n execute: {\n query: (...args) => readerPool.execute.query(...args),\n batchQuery: (...args) => readerPool.execute.batchQuery(...args),\n command: (...args) => writerPool.execute.command(...args),\n batchCommand: (...args) => writerPool.execute.batchCommand(...args),\n },\n withConnection: (handle, connectionOptions) =>\n connectionOptions?.readonly\n ? readerPool.withConnection(handle, connectionOptions)\n : writerPool.withConnection(handle, connectionOptions),\n transaction: writerPool.transaction,\n withTransaction: writerPool.withTransaction,\n close: async () => {\n await guardSingleConnection.stop();\n await Promise.all([writerPool.close(), readerPool.close()]);\n },\n };\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 isInMemoryDatabase,\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';\nimport { sqliteDualConnectionPool } from './pool/dualPool';\nimport { sqlite3SingletonPool } from './pool/singletonPool';\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 = (\n options: SQLite3DumboOptions,\n): SQLitePool<SQLite3Connection> => {\n // Ambient: caller-managed connection. No acquisition, no serialisation.\n if ('connection' in options && options.connection) {\n return sqlitePool(\n toSqlitePoolOptions({\n ...options,\n driverType: SQLite3DriverType,\n }),\n );\n }\n\n const sqliteConnectionFactory = (opts: SQLite3ConnectionOptions) =>\n sqlite3Connection({\n ...opts,\n serializer: options.serializer ?? JSONSerializer,\n });\n\n // Singleton-shaped: in-memory DBs, an explicit client, or `singleton: true`.\n // One connection shared across callers — wrap it so concurrent callers\n // serialise through a single-slot TaskProcessor with ALS-based reentrancy.\n const isSingleton =\n isInMemoryDatabase(options) ||\n ('client' in options && Boolean(options.client)) ||\n options.singleton === true;\n\n if (isSingleton) {\n return sqlite3SingletonPool<SQLite3Connection>({\n driverType: SQLite3DriverType,\n getConnection: () => sqliteConnectionFactory(options),\n });\n }\n\n // Default: file-backed dual pool. Its writer side is serialised inside\n // sqliteDualConnectionPool via the same primitive.\n const readerPoolSize = (options as { readerPoolSize?: number })\n .readerPoolSize;\n return sqliteDualConnectionPool({\n driverType: SQLite3DriverType,\n sqliteConnectionFactory,\n connectionOptions: options,\n ...(readerPoolSize !== undefined ? { readerPoolSize } : {}),\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":";;;;;;;;;;AAMA,MAAa,sBACX,kBACA,gBACwB;CACxB,MAAM,0BACJA,gDAAiC,iBAAiB;AAEpD,QAAO;EACL,GAAGC;EACH,GAAG;EACH,GAAG;EACJ;;AAGH,MAAa,mCACX,YACsD;CAEtD;EAAE,QAAQ;EAAgB,OAAO,QAAQ;EAAe;CACxD;EAAE,QAAQ;EAAe,OAAO,QAAQ;EAAc;CACtD;EAAE,QAAQ;EAAc,OAAO,QAAQ;EAAa;CACpD;EAAE,QAAQ;EAAgB,OAAO,QAAQ,eAAe,OAAO;EAAO;CACtE;EAAE,QAAQ;EAAc,OAAO,QAAQ;EAAa;CACpD,GAAI,QAAQ,cAAc,SACtB,CAAC;EAAE,QAAQ;EAAa,OAAO,QAAQ;EAAW,CAAC,GACnD,EAAE;CACP;AAED,MAAa,iCACX,YACsD,CACtD;CAAE,QAAQ;CAAgB,OAAO,QAAQ;CA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WAAW,OAAO,CAAC,CAAC;;EAE9D;;;;;ACpFH,MAAa,eACX,YACkC;AAElC,KAAI,gBAAgB,WAAW,QAAQ,WACrC,QAAOC,0BACLC,mCAAoB;EAClB,GAAG;EACH,YAAY;EACb,CAAC,CACH;CAGH,MAAM,2BAA2B,SAC/B,kBAAkB;EAChB,GAAG;EACH,YAAY,QAAQ,cAAcC;EACnC,CAAC;AAUJ,KAJEC,kCAAmB,QAAQ,IAC1B,YAAY,WAAW,QAAQ,QAAQ,OAAO,IAC/C,QAAQ,cAAc,KAGtB,QAAO,qBAAwC;EAC7C,YAAY;EACZ,qBAAqB,wBAAwB,QAAQ;EACtD,CAAC;CAKJ,MAAM,iBAAkB,QACrB;AACH,QAAO,yBAAyB;EAC9B,YAAY;EACZ;EACA,mBAAmB;EACnB,GAAI,mBAAmB,SAAY,EAAE,gBAAgB,GAAG,EAAE;EAC3D,CAAC;;AAGJ,MAAM,4BAA4B,qBAA6B;AAC7D,KAAI;AACF,SAAOC,sCAAuB,iBAAiB;SACzC;AACN,SAAO;;;AAIX,MAAa,qBAAqB;CAChC,YAAY;CACZ,aAAa,YAAY,YAAY,QAA+B;CACpE,cAAcC;CACd,wBAAwBC;CACxB,WAAWC,iDACT,mBACA,yBACD;CACD,kBAAkBC;CACnB;AAMD,MAAa,8BAA8B;AACzC,0CAA4B,SAAS,mBAAmB,mBAAmB;;AAO7E,uBAAuB"}
@@ -1,5 +1,5 @@
1
1
  import { D as Connection, It as DatabaseMetadata, Ri as SQLFormatter, co as JSONSerializer, ft as DumboDatabaseDriver, k as ConnectionOptions, n as sqliteMetadata, s as DumboConnectionOptions, xt as MigratorOptions } from "./index-BDSQvDH2.cjs";
2
- import { $ as SQLitePragmaOptions, A as SQLiteClientConnectionDefinitionOptions, B as SQLiteParameters, C as AnySQLiteConnection, D as InMemorySQLiteDatabase, E as DEFAULT_SQLITE_PRAGMA_OPTIONS, F as SQLiteConnection, G as TransactionNestingCounter, H as SQLitePoolClientConnection, I as SQLiteConnectionDefinitionOptions, J as sqliteClientConnection, K as isSQLiteError, L as SQLiteConnectionFactory, M as SQLiteClientOptions, N as SQLiteClientOrPoolClient, O as SQLiteClient, P as SQLiteCommandOptions, Q as SQLiteConnectionString, R as SQLiteConnectionOptions, S as AnySQLiteClientConnection, T as BatchSQLiteCommandOptions, U as SQLitePoolConnectionDefinitionOptions, V as SQLitePoolClient, W as SqliteAmbientClientConnectionOptions, X as sqlitePoolClientConnection, Y as sqliteConnection, Z as transactionNestingCounter, _ as sqliteAmbientConnectionPool, a as defaultSQLiteDatabase, at as SQLiteErrorMapper, b as toSqlitePoolOptions, c as SQLiteAlwaysNewConnectionPool, ct as sqliteSQLExecutor, d as SQLitePool, et as parsePragmasFromConnectionString, f as SQLitePoolFactoryOptions, g as sqliteAlwaysNewConnectionPool, h as isInMemoryDatabase, i as sqliteFormatter, it as sqliteTransaction, j as SQLiteClientFactory, k as SQLiteClientConnection, l as SQLiteAmbientConnectionPool, m as SQLiteSingletonConnectionPool, n as SQLiteDatabaseType, nt as SQLiteTransactionMode, o as tableExists, ot as SQLiteSQLExecutor, p as SQLitePoolOptions, q as sqliteAmbientClientConnection, r as SQLiteDriverType, rt as SQLiteTransactionOptions, s as DefaultSQLiteMigratorOptions, st as sqliteExecute, t as SQLiteDatabaseName, tt as SQLiteTransaction, u as SQLiteFileNameOrConnectionString, v as sqlitePool, w as AnySQLitePoolClientConnection, x as mapSqliteError, y as sqliteSingletonConnectionPool, z as SQLiteError } from "./index-DqVvUav9.cjs";
2
+ import { $ as SQLitePragmaOptions, A as SQLiteClientConnectionDefinitionOptions, B as SQLiteParameters, C as AnySQLiteConnection, D as InMemorySQLiteDatabase, E as DEFAULT_SQLITE_PRAGMA_OPTIONS, F as SQLiteConnection, G as TransactionNestingCounter, H as SQLitePoolClientConnection, I as SQLiteConnectionDefinitionOptions, J as sqliteClientConnection, K as isSQLiteError, L as SQLiteConnectionFactory, M as SQLiteClientOptions, N as SQLiteClientOrPoolClient, O as SQLiteClient, P as SQLiteCommandOptions, Q as SQLiteConnectionString, R as SQLiteConnectionOptions, S as AnySQLiteClientConnection, T as BatchSQLiteCommandOptions, U as SQLitePoolConnectionDefinitionOptions, V as SQLitePoolClient, W as SqliteAmbientClientConnectionOptions, X as sqlitePoolClientConnection, Y as sqliteConnection, Z as transactionNestingCounter, _ as sqliteAmbientConnectionPool, a as defaultSQLiteDatabase, at as SQLiteErrorMapper, b as toSqlitePoolOptions, c as SQLiteAlwaysNewConnectionPool, ct as sqliteSQLExecutor, d as SQLitePool, et as parsePragmasFromConnectionString, f as SQLitePoolFactoryOptions, g as sqliteAlwaysNewConnectionPool, h as isInMemoryDatabase, i as sqliteFormatter, it as sqliteTransaction, j as SQLiteClientFactory, k as SQLiteClientConnection, l as SQLiteAmbientConnectionPool, m as SQLiteSingletonConnectionPool, n as SQLiteDatabaseType, nt as SQLiteTransactionMode, o as tableExists, ot as SQLiteSQLExecutor, p as SQLitePoolOptions, q as sqliteAmbientClientConnection, r as SQLiteDriverType, rt as SQLiteTransactionOptions, s as DefaultSQLiteMigratorOptions, st as sqliteExecute, t as SQLiteDatabaseName, tt as SQLiteTransaction, u as SQLiteFileNameOrConnectionString, v as sqlitePool, w as AnySQLitePoolClientConnection, x as mapSqliteError, y as sqliteSingletonConnectionPool, z as SQLiteError } from "./index-N2ly5shv.cjs";
3
3
 
4
4
  //#region src/storage/sqlite/sqlite3/connections/connection.d.ts
5
5
  type SQLite3DriverType = SQLiteDriverType<'sqlite3'>;
@@ -47,7 +47,7 @@ declare const sqlite3DumboDriver: {
47
47
  client?: never;
48
48
  } & {
49
49
  serializer?: JSONSerializer;
50
- }, "driverType" | "connectionString" | "driver">) | ({
50
+ }, "driverType" | "driver" | "connectionString">) | ({
51
51
  driver?: DumboDatabaseDriver<SQLite3Connection, SQLite3DumboOptions, Sqlite3Pool>;
52
52
  driverType?: "SQLite:sqlite3";
53
53
  } & Omit<Omit<SQLitePoolOptions<SQLite3Connection, SQLite3ConnectionOptions>, "driverType"> & ConnectionOptions<AnySQLiteConnection> & SQLiteClientOptions & {
@@ -57,14 +57,14 @@ declare const sqlite3DumboDriver: {
57
57
  client?: never;
58
58
  } & {
59
59
  serializer?: JSONSerializer;
60
- }, "driverType" | "connectionString" | "driver">) | ({
60
+ }, "driverType" | "driver" | "connectionString">) | ({
61
61
  driver?: DumboDatabaseDriver<SQLite3Connection, SQLite3DumboOptions, Sqlite3Pool>;
62
62
  driverType?: "SQLite:sqlite3";
63
63
  } & Omit<Omit<SQLitePoolOptions<SQLite3Connection, SQLite3ConnectionOptions>, "driverType"> & ConnectionOptions<AnySQLiteConnection> & SQLiteClientOptions & {
64
64
  client: SQLite3Client;
65
65
  } & {
66
66
  serializer?: JSONSerializer;
67
- }, "driverType" | "connectionString" | "driver">)) => SQLitePool<SQLite3Connection>;
67
+ }, "driverType" | "driver" | "connectionString">)) => SQLitePool<SQLite3Connection>;
68
68
  sqlFormatter: SQLFormatter;
69
69
  defaultMigratorOptions: MigratorOptions;
70
70
  canHandle: (options: ({
@@ -77,7 +77,7 @@ declare const sqlite3DumboDriver: {
77
77
  client?: never;
78
78
  } & {
79
79
  serializer?: JSONSerializer;
80
- }, "driverType" | "connectionString" | "driver">) | ({
80
+ }, "driverType" | "driver" | "connectionString">) | ({
81
81
  driver?: DumboDatabaseDriver<SQLite3Connection, SQLite3DumboOptions, Sqlite3Pool>;
82
82
  driverType?: "SQLite:sqlite3";
83
83
  } & Omit<Omit<SQLitePoolOptions<SQLite3Connection, SQLite3ConnectionOptions>, "driverType"> & ConnectionOptions<AnySQLiteConnection> & SQLiteClientOptions & {
@@ -87,14 +87,14 @@ declare const sqlite3DumboDriver: {
87
87
  client?: never;
88
88
  } & {
89
89
  serializer?: JSONSerializer;
90
- }, "driverType" | "connectionString" | "driver">) | ({
90
+ }, "driverType" | "driver" | "connectionString">) | ({
91
91
  driver?: DumboDatabaseDriver<SQLite3Connection, SQLite3DumboOptions, Sqlite3Pool>;
92
92
  driverType?: "SQLite:sqlite3";
93
93
  } & Omit<Omit<SQLitePoolOptions<SQLite3Connection, SQLite3ConnectionOptions>, "driverType"> & ConnectionOptions<AnySQLiteConnection> & SQLiteClientOptions & {
94
94
  client: SQLite3Client;
95
95
  } & {
96
96
  serializer?: JSONSerializer;
97
- }, "driverType" | "connectionString" | "driver">)) => boolean;
97
+ }, "driverType" | "driver" | "connectionString">)) => boolean;
98
98
  databaseMetadata: DatabaseMetadata<false, false, false>;
99
99
  };
100
100
  declare const useSqlite3DumboDriver: () => void;
package/dist/sqlite3.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { D as Connection, It as DatabaseMetadata, Ri as SQLFormatter, co as JSONSerializer, ft as DumboDatabaseDriver, k as ConnectionOptions, n as sqliteMetadata, s as DumboConnectionOptions, xt as MigratorOptions } from "./index-zkszkJqP.js";
2
- import { $ as SQLitePragmaOptions, A as SQLiteClientConnectionDefinitionOptions, B as SQLiteParameters, C as AnySQLiteConnection, D as InMemorySQLiteDatabase, E as DEFAULT_SQLITE_PRAGMA_OPTIONS, F as SQLiteConnection, G as TransactionNestingCounter, H as SQLitePoolClientConnection, I as SQLiteConnectionDefinitionOptions, J as sqliteClientConnection, K as isSQLiteError, L as SQLiteConnectionFactory, M as SQLiteClientOptions, N as SQLiteClientOrPoolClient, O as SQLiteClient, P as SQLiteCommandOptions, Q as SQLiteConnectionString, R as SQLiteConnectionOptions, S as AnySQLiteClientConnection, T as BatchSQLiteCommandOptions, U as SQLitePoolConnectionDefinitionOptions, V as SQLitePoolClient, W as SqliteAmbientClientConnectionOptions, X as sqlitePoolClientConnection, Y as sqliteConnection, Z as transactionNestingCounter, _ as sqliteAmbientConnectionPool, a as defaultSQLiteDatabase, at as SQLiteErrorMapper, b as toSqlitePoolOptions, c as SQLiteAlwaysNewConnectionPool, ct as sqliteSQLExecutor, d as SQLitePool, et as parsePragmasFromConnectionString, f as SQLitePoolFactoryOptions, g as sqliteAlwaysNewConnectionPool, h as isInMemoryDatabase, i as sqliteFormatter, it as sqliteTransaction, j as SQLiteClientFactory, k as SQLiteClientConnection, l as SQLiteAmbientConnectionPool, m as SQLiteSingletonConnectionPool, n as SQLiteDatabaseType, nt as SQLiteTransactionMode, o as tableExists, ot as SQLiteSQLExecutor, p as SQLitePoolOptions, q as sqliteAmbientClientConnection, r as SQLiteDriverType, rt as SQLiteTransactionOptions, s as DefaultSQLiteMigratorOptions, st as sqliteExecute, t as SQLiteDatabaseName, tt as SQLiteTransaction, u as SQLiteFileNameOrConnectionString, v as sqlitePool, w as AnySQLitePoolClientConnection, x as mapSqliteError, y as sqliteSingletonConnectionPool, z as SQLiteError } from "./index-D1jryNqo.js";
2
+ import { $ as SQLitePragmaOptions, A as SQLiteClientConnectionDefinitionOptions, B as SQLiteParameters, C as AnySQLiteConnection, D as InMemorySQLiteDatabase, E as DEFAULT_SQLITE_PRAGMA_OPTIONS, F as SQLiteConnection, G as TransactionNestingCounter, H as SQLitePoolClientConnection, I as SQLiteConnectionDefinitionOptions, J as sqliteClientConnection, K as isSQLiteError, L as SQLiteConnectionFactory, M as SQLiteClientOptions, N as SQLiteClientOrPoolClient, O as SQLiteClient, P as SQLiteCommandOptions, Q as SQLiteConnectionString, R as SQLiteConnectionOptions, S as AnySQLiteClientConnection, T as BatchSQLiteCommandOptions, U as SQLitePoolConnectionDefinitionOptions, V as SQLitePoolClient, W as SqliteAmbientClientConnectionOptions, X as sqlitePoolClientConnection, Y as sqliteConnection, Z as transactionNestingCounter, _ as sqliteAmbientConnectionPool, a as defaultSQLiteDatabase, at as SQLiteErrorMapper, b as toSqlitePoolOptions, c as SQLiteAlwaysNewConnectionPool, ct as sqliteSQLExecutor, d as SQLitePool, et as parsePragmasFromConnectionString, f as SQLitePoolFactoryOptions, g as sqliteAlwaysNewConnectionPool, h as isInMemoryDatabase, i as sqliteFormatter, it as sqliteTransaction, j as SQLiteClientFactory, k as SQLiteClientConnection, l as SQLiteAmbientConnectionPool, m as SQLiteSingletonConnectionPool, n as SQLiteDatabaseType, nt as SQLiteTransactionMode, o as tableExists, ot as SQLiteSQLExecutor, p as SQLitePoolOptions, q as sqliteAmbientClientConnection, r as SQLiteDriverType, rt as SQLiteTransactionOptions, s as DefaultSQLiteMigratorOptions, st as sqliteExecute, t as SQLiteDatabaseName, tt as SQLiteTransaction, u as SQLiteFileNameOrConnectionString, v as sqlitePool, w as AnySQLitePoolClientConnection, x as mapSqliteError, y as sqliteSingletonConnectionPool, z as SQLiteError } from "./index-BgFHGsuP.js";
3
3
 
4
4
  //#region src/storage/sqlite/sqlite3/connections/connection.d.ts
5
5
  type SQLite3DriverType = SQLiteDriverType<'sqlite3'>;
@@ -47,7 +47,7 @@ declare const sqlite3DumboDriver: {
47
47
  client?: never;
48
48
  } & {
49
49
  serializer?: JSONSerializer;
50
- }, "driverType" | "connectionString" | "driver">) | ({
50
+ }, "driverType" | "driver" | "connectionString">) | ({
51
51
  driver?: DumboDatabaseDriver<SQLite3Connection, SQLite3DumboOptions, Sqlite3Pool>;
52
52
  driverType?: "SQLite:sqlite3";
53
53
  } & Omit<Omit<SQLitePoolOptions<SQLite3Connection, SQLite3ConnectionOptions>, "driverType"> & ConnectionOptions<AnySQLiteConnection> & SQLiteClientOptions & {
@@ -57,14 +57,14 @@ declare const sqlite3DumboDriver: {
57
57
  client?: never;
58
58
  } & {
59
59
  serializer?: JSONSerializer;
60
- }, "driverType" | "connectionString" | "driver">) | ({
60
+ }, "driverType" | "driver" | "connectionString">) | ({
61
61
  driver?: DumboDatabaseDriver<SQLite3Connection, SQLite3DumboOptions, Sqlite3Pool>;
62
62
  driverType?: "SQLite:sqlite3";
63
63
  } & Omit<Omit<SQLitePoolOptions<SQLite3Connection, SQLite3ConnectionOptions>, "driverType"> & ConnectionOptions<AnySQLiteConnection> & SQLiteClientOptions & {
64
64
  client: SQLite3Client;
65
65
  } & {
66
66
  serializer?: JSONSerializer;
67
- }, "driverType" | "connectionString" | "driver">)) => SQLitePool<SQLite3Connection>;
67
+ }, "driverType" | "driver" | "connectionString">)) => SQLitePool<SQLite3Connection>;
68
68
  sqlFormatter: SQLFormatter;
69
69
  defaultMigratorOptions: MigratorOptions;
70
70
  canHandle: (options: ({
@@ -77,7 +77,7 @@ declare const sqlite3DumboDriver: {
77
77
  client?: never;
78
78
  } & {
79
79
  serializer?: JSONSerializer;
80
- }, "driverType" | "connectionString" | "driver">) | ({
80
+ }, "driverType" | "driver" | "connectionString">) | ({
81
81
  driver?: DumboDatabaseDriver<SQLite3Connection, SQLite3DumboOptions, Sqlite3Pool>;
82
82
  driverType?: "SQLite:sqlite3";
83
83
  } & Omit<Omit<SQLitePoolOptions<SQLite3Connection, SQLite3ConnectionOptions>, "driverType"> & ConnectionOptions<AnySQLiteConnection> & SQLiteClientOptions & {
@@ -87,14 +87,14 @@ declare const sqlite3DumboDriver: {
87
87
  client?: never;
88
88
  } & {
89
89
  serializer?: JSONSerializer;
90
- }, "driverType" | "connectionString" | "driver">) | ({
90
+ }, "driverType" | "driver" | "connectionString">) | ({
91
91
  driver?: DumboDatabaseDriver<SQLite3Connection, SQLite3DumboOptions, Sqlite3Pool>;
92
92
  driverType?: "SQLite:sqlite3";
93
93
  } & Omit<Omit<SQLitePoolOptions<SQLite3Connection, SQLite3ConnectionOptions>, "driverType"> & ConnectionOptions<AnySQLiteConnection> & SQLiteClientOptions & {
94
94
  client: SQLite3Client;
95
95
  } & {
96
96
  serializer?: JSONSerializer;
97
- }, "driverType" | "connectionString" | "driver">)) => boolean;
97
+ }, "driverType" | "driver" | "connectionString">)) => boolean;
98
98
  databaseMetadata: DatabaseMetadata<false, false, false>;
99
99
  };
100
100
  declare const useSqlite3DumboDriver: () => void;