indexeddbshim 17.7.0 → 18.0.0

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 (36) hide show
  1. package/README.md +13 -3
  2. package/dist/DOMException.d.ts +2 -2
  3. package/dist/DOMException.d.ts.map +1 -1
  4. package/dist/IDBCursor.d.ts +8 -2
  5. package/dist/IDBCursor.d.ts.map +1 -1
  6. package/dist/IDBFactory.d.ts.map +1 -1
  7. package/dist/IDBTransaction.d.ts +12 -12
  8. package/dist/IDBTransaction.d.ts.map +1 -1
  9. package/dist/indexeddbshim-Key.js +2 -2
  10. package/dist/indexeddbshim-Key.js.map +1 -1
  11. package/dist/indexeddbshim-Key.min.js +1 -1
  12. package/dist/indexeddbshim-Key.min.js.map +1 -1
  13. package/dist/indexeddbshim-UnicodeIdentifiers-node.cjs +41 -18
  14. package/dist/indexeddbshim-UnicodeIdentifiers-node.cjs.map +1 -1
  15. package/dist/indexeddbshim-UnicodeIdentifiers.js +41 -226
  16. package/dist/indexeddbshim-UnicodeIdentifiers.js.map +1 -1
  17. package/dist/indexeddbshim-UnicodeIdentifiers.min.js +3 -3
  18. package/dist/indexeddbshim-UnicodeIdentifiers.min.js.map +1 -1
  19. package/dist/indexeddbshim-node.cjs +41 -18
  20. package/dist/indexeddbshim-node.cjs.map +1 -1
  21. package/dist/indexeddbshim-noninvasive.js +41 -226
  22. package/dist/indexeddbshim-noninvasive.js.map +1 -1
  23. package/dist/indexeddbshim-noninvasive.min.js +3 -3
  24. package/dist/indexeddbshim-noninvasive.min.js.map +1 -1
  25. package/dist/indexeddbshim.js +41 -226
  26. package/dist/indexeddbshim.js.map +1 -1
  27. package/dist/indexeddbshim.min.js +3 -3
  28. package/dist/indexeddbshim.min.js.map +1 -1
  29. package/dist/util.d.ts +15 -0
  30. package/dist/util.d.ts.map +1 -1
  31. package/package.json +1 -4
  32. package/src/DOMException.js +1 -1
  33. package/src/IDBCursor.js +4 -1
  34. package/src/IDBFactory.js +5 -7
  35. package/src/IDBTransaction.js +8 -8
  36. package/src/util.js +23 -1
@@ -1,9 +1,8 @@
1
- /*! indexeddbshim - v17.7.0 - 9/2/2026 */
1
+ /*! indexeddbshim - v18.0.0 - 9/3/2026 */
2
2
 
3
3
  'use strict';
4
4
 
5
5
  var fs$1 = require('node:fs');
6
- var path = require('node:path');
7
6
  var customOpenDatabase = require('websql-configurable/custom/index.js');
8
7
  var SQLiteDatabase = require('websql-configurable/lib/sqlite/SQLiteDatabase.js');
9
8
 
@@ -1744,6 +1743,28 @@ function sqlLIKEEscape(str) {
1744
1743
  return str.replaceAll('^', '^^');
1745
1744
  }
1746
1745
 
1746
+ /**
1747
+ * Minimal replacement for `path.join(base, name)` covering our only use case:
1748
+ * `name` is always a bare file name (no separators and no `.`/`..`), and
1749
+ * `base` is a directory path expected to be absolute and normalized (an
1750
+ * empty string means the current working directory). Unlike `path.join`,
1751
+ * this performs no `.`/`..` resolution. It reuses the separator style of
1752
+ * `base` (backslash only when `base` uses backslashes and no forward
1753
+ * slashes, i.e. a Windows path), otherwise `/`; Node's `fs`, SQLite, and
1754
+ * `websql-configurable` accept either separator on Windows regardless.
1755
+ * Avoiding `node:path` keeps browser bundles free of a path polyfill.
1756
+ * @param {string} base
1757
+ * @param {string} name
1758
+ * @returns {string}
1759
+ */
1760
+ function joinPath(base, name) {
1761
+ if (!base) {
1762
+ return name;
1763
+ }
1764
+ const sep = base.includes('\\') && !base.includes('/') ? '\\' : '/';
1765
+ return base.replace(/[/\\]+$/u, '') + sep + name;
1766
+ }
1767
+
1747
1768
  /**
1748
1769
  * @typedef {Function} AnyClass
1749
1770
  */
@@ -2495,7 +2516,7 @@ function createNonNativeDOMException(name, message) {
2495
2516
 
2496
2517
  /**
2497
2518
  * @typedef {{
2498
- * message: string|DOMString
2519
+ * message: string
2499
2520
  * }} ErrorLike
2500
2521
  */
2501
2522
 
@@ -4910,7 +4931,7 @@ const readonlyProperties$4 = ['objectStoreNames', 'mode', 'durability', 'db', 'e
4910
4931
  /**
4911
4932
  * @typedef {{
4912
4933
  * op: SQLCallback,
4913
- * args: ObjectArray,
4934
+ * args: any[],
4914
4935
  * req: import('./IDBRequest.js').IDBRequestFull|null
4915
4936
  * }} RequestInfo
4916
4937
  */
@@ -4962,17 +4983,17 @@ const readonlyProperties$4 = ['objectStoreNames', 'mode', 'durability', 'db', 'e
4962
4983
  * __pushToQueue: (
4963
4984
  * request: import('./IDBRequest.js').IDBRequestFull|null,
4964
4985
  * callback: SQLCallback,
4965
- * args?: ObjectArray
4986
+ * args?: any[]
4966
4987
  * ) => void,
4967
4988
  * __assertActive: () => void,
4968
4989
  * commit: () => void,
4969
4990
  * __addNonRequestToTransactionQueue: (
4970
4991
  * callback: SQLCallback,
4971
- * args?: ObjectArray
4992
+ * args?: any[]
4972
4993
  * ) => void
4973
4994
  * __addToTransactionQueue: (
4974
4995
  * callback: SQLCallback,
4975
- * args: ObjectArray|undefined,
4996
+ * args: any[]|undefined,
4976
4997
  * source: import('./IDBDatabase.js').IDBDatabaseFull|
4977
4998
  * import('./IDBObjectStore.js').IDBObjectStoreFull|
4978
4999
  * import('./IDBIndex.js').IDBIndexFull|
@@ -5603,7 +5624,7 @@ IDBTransaction.prototype.__createRequest = function (source) {
5603
5624
  /**
5604
5625
  * @typedef {(
5605
5626
  * tx: import('websql-configurable/lib/websql/WebSQLTransaction.js').default,
5606
- * args: ObjectArray,
5627
+ * args: any[],
5607
5628
  * success: (result?: any, req?: import('./IDBRequest.js').IDBRequestFull) => void,
5608
5629
  * error: (
5609
5630
  * tx: import('websql-configurable/lib/websql/WebSQLTransaction.js').default|Error|DOMException,
@@ -5616,7 +5637,7 @@ IDBTransaction.prototype.__createRequest = function (source) {
5616
5637
  /**
5617
5638
  * Adds a callback function to the transaction queue.
5618
5639
  * @param {SQLCallback} callback
5619
- * @param {ObjectArray} args
5640
+ * @param {any[]} args
5620
5641
  * @param {import('./IDBDatabase.js').IDBDatabaseFull|
5621
5642
  * import('./IDBObjectStore.js').IDBObjectStoreFull|
5622
5643
  * import('./IDBIndex.js').IDBIndexFull} source
@@ -5633,7 +5654,7 @@ IDBTransaction.prototype.__addToTransactionQueue = function (callback, args, sou
5633
5654
  * Adds a callback function to the transaction queue without generating a
5634
5655
  * request.
5635
5656
  * @param {SQLCallback} callback
5636
- * @param {ObjectArray} args
5657
+ * @param {any[]} args
5637
5658
  * @this {IDBTransactionFull}
5638
5659
  * @returns {void}
5639
5660
  */
@@ -5645,7 +5666,7 @@ IDBTransaction.prototype.__addNonRequestToTransactionQueue = function (callback,
5645
5666
  * Adds an IDBRequest to the transaction queue.
5646
5667
  * @param {import('./IDBRequest.js').IDBRequestFull|null} request
5647
5668
  * @param {SQLCallback} callback
5648
- * @param {ObjectArray} args
5669
+ * @param {any[]} args
5649
5670
  * @this {IDBTransactionFull}
5650
5671
  * @returns {void}
5651
5672
  */
@@ -10128,7 +10149,6 @@ Object.defineProperty(IDBDatabase, 'prototype', {
10128
10149
  });
10129
10150
 
10130
10151
  /* eslint-disable sonarjs/no-invariant-returns -- Convenient here */
10131
- // eslint-disable-next-line no-restricted-imports -- Can be polyfilled
10132
10152
 
10133
10153
  /**
10134
10154
  * @typedef {number} Integer
@@ -10488,7 +10508,7 @@ function cleanupDatabaseResources(__openDatabase, name, escapedDatabaseName, dat
10488
10508
  }
10489
10509
  if (fs && CFG.deleteDatabaseFiles !== false) {
10490
10510
  closeCachedWebSQLConnections(name, () => {
10491
- fs.unlink(path.join(CFG.databaseBasePath || '', escapedDatabaseName), err => {
10511
+ fs.unlink(joinPath(CFG.databaseBasePath || '', escapedDatabaseName), err => {
10492
10512
  if (err && err.code !== 'ENOENT') {
10493
10513
  // Ignore if file is already deleted
10494
10514
  const removalError = /** @type {Error & {code?: number}} */
@@ -10502,7 +10522,7 @@ function cleanupDatabaseResources(__openDatabase, name, escapedDatabaseName, dat
10502
10522
  });
10503
10523
  return;
10504
10524
  }
10505
- const sqliteDB = __openDatabase(path.join(CFG.databaseBasePath || '', escapedDatabaseName), '1', name, CFG.DEFAULT_DB_SIZE);
10525
+ const sqliteDB = __openDatabase(joinPath(CFG.databaseBasePath || '', escapedDatabaseName), '1', name, CFG.DEFAULT_DB_SIZE);
10506
10526
  sqliteDB.transaction(function (tx) {
10507
10527
  tx.executeSql('SELECT "name" FROM __sys__', [], function (tx, data) {
10508
10528
  const tables = data.rows;
@@ -10563,7 +10583,7 @@ function createSysDB(__openDatabase, success, failure) {
10563
10583
  success();
10564
10584
  } else {
10565
10585
  // eslint-disable-next-line unicorn/no-top-level-assignment-in-function -- Necessary?
10566
- sysdb = __openDatabase(typeof CFG.memoryDatabase === 'string' ? CFG.memoryDatabase : path.join(typeof CFG.sysDatabaseBasePath === 'string' ? CFG.sysDatabaseBasePath : CFG.databaseBasePath || '', '__sysdb__' + (CFG.addSQLiteExtension !== false ? '.sqlite' : '')), '1', 'System Database', CFG.DEFAULT_DB_SIZE);
10586
+ sysdb = __openDatabase(typeof CFG.memoryDatabase === 'string' ? CFG.memoryDatabase : joinPath(typeof CFG.sysDatabaseBasePath === 'string' ? CFG.sysDatabaseBasePath : CFG.databaseBasePath || '', '__sysdb__' + (CFG.addSQLiteExtension !== false ? '.sqlite' : '')), '1', 'System Database', CFG.DEFAULT_DB_SIZE);
10567
10587
  sysdb.transaction(function (systx) {
10568
10588
  systx.executeSql('CREATE TABLE IF NOT EXISTS dbVersions (name BLOB, version INT);', [], function (systx) {
10569
10589
  if (!CFG.useSQLiteIndexes) {
@@ -10805,7 +10825,7 @@ IDBFactory.prototype.open = function (name /* , version */) {
10805
10825
  req.transaction.__addNonRequestToTransactionQueue(
10806
10826
  /**
10807
10827
  * @param {import('websql-configurable/lib/websql/WebSQLTransaction.js').default} tx
10808
- * @param {ObjectArray} args
10828
+ * @param {any[]} args
10809
10829
  * @param {(result?: any, req?: import('./IDBRequest.js').IDBRequestFull) => void} finished
10810
10830
  * @returns {void}
10811
10831
  */
@@ -11019,7 +11039,7 @@ IDBFactory.prototype.open = function (name /* , version */) {
11019
11039
  if ((useMemoryDatabase || useDatabaseCache) && Object.hasOwn(websqlDBCache, name) && Object.hasOwn(websqlDBCache[name], version)) {
11020
11040
  db = websqlDBCache[name][version];
11021
11041
  } else {
11022
- db = /** @type {DatabaseFull} */me.__openDatabase(useMemoryDatabase ? CFG.memoryDatabase : path.join(CFG.databaseBasePath || '', escapedDatabaseName), '1', name, CFG.DEFAULT_DB_SIZE);
11042
+ db = /** @type {DatabaseFull} */me.__openDatabase(useMemoryDatabase ? CFG.memoryDatabase : joinPath(CFG.databaseBasePath || '', escapedDatabaseName), '1', name, CFG.DEFAULT_DB_SIZE);
11023
11043
  if (useDatabaseCache) {
11024
11044
  if (!Object.hasOwn(websqlDBCache, name)) {
11025
11045
  websqlDBCache[name] = {};
@@ -11534,7 +11554,10 @@ const cursorDirections = ['next', 'prev', 'nextunique', 'prevunique'];
11534
11554
  * },
11535
11555
  * __count: boolean,
11536
11556
  * __prefetchedIndex: Integer,
11537
- * __prefetchedData: null|SQLResultSetRowList|{
11557
+ * __prefetchedData: null|{
11558
+ * length: number;
11559
+ * item(index: number): any;
11560
+ * }|{
11538
11561
  * data: RowItemNonNull[],
11539
11562
  * length: Integer,
11540
11563
  * item: (index: Integer) => RowItemNonNull