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,4 +1,4 @@
1
- /*! indexeddbshim - v17.7.0 - 9/2/2026 */
1
+ /*! indexeddbshim - v18.0.0 - 9/3/2026 */
2
2
 
3
3
  (function (factory) {
4
4
  typeof define === 'function' && define.amd ? define(factory) :
@@ -2124,6 +2124,28 @@
2124
2124
  return str.replaceAll('^', '^^');
2125
2125
  }
2126
2126
 
2127
+ /**
2128
+ * Minimal replacement for `path.join(base, name)` covering our only use case:
2129
+ * `name` is always a bare file name (no separators and no `.`/`..`), and
2130
+ * `base` is a directory path expected to be absolute and normalized (an
2131
+ * empty string means the current working directory). Unlike `path.join`,
2132
+ * this performs no `.`/`..` resolution. It reuses the separator style of
2133
+ * `base` (backslash only when `base` uses backslashes and no forward
2134
+ * slashes, i.e. a Windows path), otherwise `/`; Node's `fs`, SQLite, and
2135
+ * `websql-configurable` accept either separator on Windows regardless.
2136
+ * Avoiding `node:path` keeps browser bundles free of a path polyfill.
2137
+ * @param {string} base
2138
+ * @param {string} name
2139
+ * @returns {string}
2140
+ */
2141
+ function joinPath(base, name) {
2142
+ if (!base) {
2143
+ return name;
2144
+ }
2145
+ var sep = base.includes('\\') && !base.includes('/') ? '\\' : '/';
2146
+ return base.replace(/[\/\\]+$/, '') + sep + name;
2147
+ }
2148
+
2127
2149
  /**
2128
2150
  * @typedef {Function} AnyClass
2129
2151
  */
@@ -2867,7 +2889,7 @@
2867
2889
 
2868
2890
  /**
2869
2891
  * @typedef {{
2870
- * message: string|DOMString
2892
+ * message: string
2871
2893
  * }} ErrorLike
2872
2894
  */
2873
2895
 
@@ -5358,7 +5380,7 @@
5358
5380
  /**
5359
5381
  * @typedef {{
5360
5382
  * op: SQLCallback,
5361
- * args: ObjectArray,
5383
+ * args: any[],
5362
5384
  * req: import('./IDBRequest.js').IDBRequestFull|null
5363
5385
  * }} RequestInfo
5364
5386
  */
@@ -5410,17 +5432,17 @@
5410
5432
  * __pushToQueue: (
5411
5433
  * request: import('./IDBRequest.js').IDBRequestFull|null,
5412
5434
  * callback: SQLCallback,
5413
- * args?: ObjectArray
5435
+ * args?: any[]
5414
5436
  * ) => void,
5415
5437
  * __assertActive: () => void,
5416
5438
  * commit: () => void,
5417
5439
  * __addNonRequestToTransactionQueue: (
5418
5440
  * callback: SQLCallback,
5419
- * args?: ObjectArray
5441
+ * args?: any[]
5420
5442
  * ) => void
5421
5443
  * __addToTransactionQueue: (
5422
5444
  * callback: SQLCallback,
5423
- * args: ObjectArray|undefined,
5445
+ * args: any[]|undefined,
5424
5446
  * source: import('./IDBDatabase.js').IDBDatabaseFull|
5425
5447
  * import('./IDBObjectStore.js').IDBObjectStoreFull|
5426
5448
  * import('./IDBIndex.js').IDBIndexFull|
@@ -6058,7 +6080,7 @@
6058
6080
  /**
6059
6081
  * @typedef {(
6060
6082
  * tx: import('websql-configurable/lib/websql/WebSQLTransaction.js').default,
6061
- * args: ObjectArray,
6083
+ * args: any[],
6062
6084
  * success: (result?: any, req?: import('./IDBRequest.js').IDBRequestFull) => void,
6063
6085
  * error: (
6064
6086
  * tx: import('websql-configurable/lib/websql/WebSQLTransaction.js').default|Error|DOMException,
@@ -6071,7 +6093,7 @@
6071
6093
  /**
6072
6094
  * Adds a callback function to the transaction queue.
6073
6095
  * @param {SQLCallback} callback
6074
- * @param {ObjectArray} args
6096
+ * @param {any[]} args
6075
6097
  * @param {import('./IDBDatabase.js').IDBDatabaseFull|
6076
6098
  * import('./IDBObjectStore.js').IDBObjectStoreFull|
6077
6099
  * import('./IDBIndex.js').IDBIndexFull} source
@@ -6088,7 +6110,7 @@
6088
6110
  * Adds a callback function to the transaction queue without generating a
6089
6111
  * request.
6090
6112
  * @param {SQLCallback} callback
6091
- * @param {ObjectArray} args
6113
+ * @param {any[]} args
6092
6114
  * @this {IDBTransactionFull}
6093
6115
  * @returns {void}
6094
6116
  */
@@ -6100,7 +6122,7 @@
6100
6122
  * Adds an IDBRequest to the transaction queue.
6101
6123
  * @param {import('./IDBRequest.js').IDBRequestFull|null} request
6102
6124
  * @param {SQLCallback} callback
6103
- * @param {ObjectArray} args
6125
+ * @param {any[]} args
6104
6126
  * @this {IDBTransactionFull}
6105
6127
  * @returns {void}
6106
6128
  */
@@ -10602,216 +10624,6 @@
10602
10624
  writable: false
10603
10625
  });
10604
10626
 
10605
- // Copyright Joyent, Inc. and other Node contributors.
10606
- //
10607
- // Permission is hereby granted, free of charge, to any person obtaining a
10608
- // copy of this software and associated documentation files (the
10609
- // "Software"), to deal in the Software without restriction, including
10610
- // without limitation the rights to use, copy, modify, merge, publish,
10611
- // distribute, sublicense, and/or sell copies of the Software, and to permit
10612
- // persons to whom the Software is furnished to do so, subject to the
10613
- // following conditions:
10614
- //
10615
- // The above copyright notice and this permission notice shall be included
10616
- // in all copies or substantial portions of the Software.
10617
- //
10618
- // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
10619
- // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
10620
- // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
10621
- // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
10622
- // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
10623
- // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
10624
- // USE OR OTHER DEALINGS IN THE SOFTWARE.
10625
-
10626
- // resolves . and .. elements in a path array with directory names there
10627
- // must be no slashes, empty elements, or device names (c:\) in the array
10628
- // (so also no leading and trailing slashes - it does not distinguish
10629
- // relative and absolute paths)
10630
- function normalizeArray(parts, allowAboveRoot) {
10631
- // if the path tries to go above the root, `up` ends up > 0
10632
- var up = 0;
10633
- for (var i = parts.length - 1; i >= 0; i--) {
10634
- var last = parts[i];
10635
- if (last === '.') {
10636
- parts.splice(i, 1);
10637
- } else if (last === '..') {
10638
- parts.splice(i, 1);
10639
- up++;
10640
- } else if (up) {
10641
- parts.splice(i, 1);
10642
- up--;
10643
- }
10644
- }
10645
-
10646
- // if the path is allowed to go above the root, restore leading ..s
10647
- if (allowAboveRoot) {
10648
- for (; up--; up) {
10649
- parts.unshift('..');
10650
- }
10651
- }
10652
- return parts;
10653
- }
10654
-
10655
- // Split a filename into [root, dir, basename, ext], unix version
10656
- // 'root' is just a slash, or nothing.
10657
- var splitPathRe = /^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/;
10658
- var splitPath = function splitPath(filename) {
10659
- return splitPathRe.exec(filename).slice(1);
10660
- };
10661
-
10662
- // path.resolve([from ...], to)
10663
- // posix version
10664
- function resolve() {
10665
- var resolvedPath = '',
10666
- resolvedAbsolute = false;
10667
- for (var i = arguments.length - 1; i >= -1 && !resolvedAbsolute; i--) {
10668
- var path = i >= 0 ? arguments[i] : '/';
10669
-
10670
- // Skip empty and invalid entries
10671
- if (typeof path !== 'string') {
10672
- throw new TypeError('Arguments to path.resolve must be strings');
10673
- } else if (!path) {
10674
- continue;
10675
- }
10676
- resolvedPath = path + '/' + resolvedPath;
10677
- resolvedAbsolute = path.charAt(0) === '/';
10678
- }
10679
-
10680
- // At this point the path should be resolved to a full absolute path, but
10681
- // handle relative paths to be safe (might happen when process.cwd() fails)
10682
-
10683
- // Normalize the path
10684
- resolvedPath = normalizeArray(filter(resolvedPath.split('/'), function (p) {
10685
- return !!p;
10686
- }), !resolvedAbsolute).join('/');
10687
- return (resolvedAbsolute ? '/' : '') + resolvedPath || '.';
10688
- }
10689
-
10690
- // path.normalize(path)
10691
- // posix version
10692
- function normalize(path) {
10693
- var isPathAbsolute = isAbsolute(path),
10694
- trailingSlash = substr(path, -1) === '/';
10695
-
10696
- // Normalize the path
10697
- path = normalizeArray(filter(path.split('/'), function (p) {
10698
- return !!p;
10699
- }), !isPathAbsolute).join('/');
10700
- if (!path && !isPathAbsolute) {
10701
- path = '.';
10702
- }
10703
- if (path && trailingSlash) {
10704
- path += '/';
10705
- }
10706
- return (isPathAbsolute ? '/' : '') + path;
10707
- }
10708
-
10709
- // posix version
10710
- function isAbsolute(path) {
10711
- return path.charAt(0) === '/';
10712
- }
10713
-
10714
- // posix version
10715
- function join() {
10716
- var paths = Array.prototype.slice.call(arguments, 0);
10717
- return normalize(filter(paths, function (p, index) {
10718
- if (typeof p !== 'string') {
10719
- throw new TypeError('Arguments to path.join must be strings');
10720
- }
10721
- return p;
10722
- }).join('/'));
10723
- }
10724
-
10725
- // path.relative(from, to)
10726
- // posix version
10727
- function relative(from, to) {
10728
- from = resolve(from).substr(1);
10729
- to = resolve(to).substr(1);
10730
- function trim(arr) {
10731
- var start = 0;
10732
- for (; start < arr.length; start++) {
10733
- if (arr[start] !== '') break;
10734
- }
10735
- var end = arr.length - 1;
10736
- for (; end >= 0; end--) {
10737
- if (arr[end] !== '') break;
10738
- }
10739
- if (start > end) return [];
10740
- return arr.slice(start, end - start + 1);
10741
- }
10742
- var fromParts = trim(from.split('/'));
10743
- var toParts = trim(to.split('/'));
10744
- var length = Math.min(fromParts.length, toParts.length);
10745
- var samePartsLength = length;
10746
- for (var i = 0; i < length; i++) {
10747
- if (fromParts[i] !== toParts[i]) {
10748
- samePartsLength = i;
10749
- break;
10750
- }
10751
- }
10752
- var outputParts = [];
10753
- for (var i = samePartsLength; i < fromParts.length; i++) {
10754
- outputParts.push('..');
10755
- }
10756
- outputParts = outputParts.concat(toParts.slice(samePartsLength));
10757
- return outputParts.join('/');
10758
- }
10759
- var sep = '/';
10760
- var delimiter = ':';
10761
- function dirname(path) {
10762
- var result = splitPath(path),
10763
- root = result[0],
10764
- dir = result[1];
10765
- if (!root && !dir) {
10766
- // No dirname whatsoever
10767
- return '.';
10768
- }
10769
- if (dir) {
10770
- // It has a dirname, strip trailing slash
10771
- dir = dir.substr(0, dir.length - 1);
10772
- }
10773
- return root + dir;
10774
- }
10775
- function basename(path, ext) {
10776
- var f = splitPath(path)[2];
10777
- // TODO: make this comparison case-insensitive on windows?
10778
- if (ext && f.substr(-1 * ext.length) === ext) {
10779
- f = f.substr(0, f.length - ext.length);
10780
- }
10781
- return f;
10782
- }
10783
- function extname(path) {
10784
- return splitPath(path)[3];
10785
- }
10786
- var path = {
10787
- extname: extname,
10788
- basename: basename,
10789
- dirname: dirname,
10790
- sep: sep,
10791
- delimiter: delimiter,
10792
- relative: relative,
10793
- join: join,
10794
- isAbsolute: isAbsolute,
10795
- normalize: normalize,
10796
- resolve: resolve
10797
- };
10798
- function filter(xs, f) {
10799
- if (xs.filter) return xs.filter(f);
10800
- var res = [];
10801
- for (var i = 0; i < xs.length; i++) {
10802
- if (f(xs[i], i, xs)) res.push(xs[i]);
10803
- }
10804
- return res;
10805
- }
10806
-
10807
- // String.prototype.substr - negative index don't work in IE8
10808
- var substr = 'ab'.substr(-1) === 'b' ? function (str, start, len) {
10809
- return str.substr(start, len);
10810
- } : function (str, start, len) {
10811
- if (start < 0) start = str.length + start;
10812
- return str.substr(start, len);
10813
- };
10814
-
10815
10627
  var listeners = ['onabort', 'onclose', 'onerror', 'onversionchange'];
10816
10628
  var readonlyProperties$1 = ['name', 'version', 'objectStoreNames'];
10817
10629
 
@@ -11531,7 +11343,7 @@
11531
11343
  }
11532
11344
  if (fs && CFG.deleteDatabaseFiles !== false) {
11533
11345
  closeCachedWebSQLConnections(name, function () {
11534
- fs.unlink(path.join(CFG.databaseBasePath || '', escapedDatabaseName), function (err) {
11346
+ fs.unlink(joinPath(CFG.databaseBasePath || '', escapedDatabaseName), function (err) {
11535
11347
  if (err && err.code !== 'ENOENT') {
11536
11348
  // Ignore if file is already deleted
11537
11349
  var removalError = /** @type {Error & {code?: number}} */
@@ -11545,7 +11357,7 @@
11545
11357
  });
11546
11358
  return;
11547
11359
  }
11548
- var sqliteDB = __openDatabase(path.join(CFG.databaseBasePath || '', escapedDatabaseName), '1', name, CFG.DEFAULT_DB_SIZE);
11360
+ var sqliteDB = __openDatabase(joinPath(CFG.databaseBasePath || '', escapedDatabaseName), '1', name, CFG.DEFAULT_DB_SIZE);
11549
11361
  sqliteDB.transaction(function (tx) {
11550
11362
  tx.executeSql('SELECT "name" FROM __sys__', [], function (tx, data) {
11551
11363
  var tables = data.rows;
@@ -11606,7 +11418,7 @@
11606
11418
  success();
11607
11419
  } else {
11608
11420
  // eslint-disable-next-line unicorn/no-top-level-assignment-in-function -- Necessary?
11609
- 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);
11421
+ 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);
11610
11422
  sysdb.transaction(function (systx) {
11611
11423
  systx.executeSql('CREATE TABLE IF NOT EXISTS dbVersions (name BLOB, version INT);', [], function (systx) {
11612
11424
  if (!CFG.useSQLiteIndexes) {
@@ -11848,7 +11660,7 @@
11848
11660
  req.transaction.__addNonRequestToTransactionQueue(
11849
11661
  /**
11850
11662
  * @param {import('websql-configurable/lib/websql/WebSQLTransaction.js').default} tx
11851
- * @param {ObjectArray} args
11663
+ * @param {any[]} args
11852
11664
  * @param {(result?: any, req?: import('./IDBRequest.js').IDBRequestFull) => void} finished
11853
11665
  * @returns {void}
11854
11666
  */
@@ -12062,7 +11874,7 @@
12062
11874
  if ((useMemoryDatabase || useDatabaseCache) && Object.hasOwn(websqlDBCache, name) && Object.hasOwn(websqlDBCache[name], version)) {
12063
11875
  db = websqlDBCache[name][version];
12064
11876
  } else {
12065
- db = /** @type {DatabaseFull} */me.__openDatabase(useMemoryDatabase ? CFG.memoryDatabase : path.join(CFG.databaseBasePath || '', escapedDatabaseName), '1', name, CFG.DEFAULT_DB_SIZE);
11877
+ db = /** @type {DatabaseFull} */me.__openDatabase(useMemoryDatabase ? CFG.memoryDatabase : joinPath(CFG.databaseBasePath || '', escapedDatabaseName), '1', name, CFG.DEFAULT_DB_SIZE);
12066
11878
  if (useDatabaseCache) {
12067
11879
  if (!Object.hasOwn(websqlDBCache, name)) {
12068
11880
  websqlDBCache[name] = {};
@@ -12571,7 +12383,10 @@
12571
12383
  * },
12572
12384
  * __count: boolean,
12573
12385
  * __prefetchedIndex: Integer,
12574
- * __prefetchedData: null|SQLResultSetRowList|{
12386
+ * __prefetchedData: null|{
12387
+ * length: number;
12388
+ * item(index: number): any;
12389
+ * }|{
12575
12390
  * data: RowItemNonNull[],
12576
12391
  * length: Integer,
12577
12392
  * item: (index: Integer) => RowItemNonNull