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 (global, factory) {
4
4
  typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
@@ -2119,6 +2119,28 @@
2119
2119
  return str.replaceAll('^', '^^');
2120
2120
  }
2121
2121
 
2122
+ /**
2123
+ * Minimal replacement for `path.join(base, name)` covering our only use case:
2124
+ * `name` is always a bare file name (no separators and no `.`/`..`), and
2125
+ * `base` is a directory path expected to be absolute and normalized (an
2126
+ * empty string means the current working directory). Unlike `path.join`,
2127
+ * this performs no `.`/`..` resolution. It reuses the separator style of
2128
+ * `base` (backslash only when `base` uses backslashes and no forward
2129
+ * slashes, i.e. a Windows path), otherwise `/`; Node's `fs`, SQLite, and
2130
+ * `websql-configurable` accept either separator on Windows regardless.
2131
+ * Avoiding `node:path` keeps browser bundles free of a path polyfill.
2132
+ * @param {string} base
2133
+ * @param {string} name
2134
+ * @returns {string}
2135
+ */
2136
+ function joinPath(base, name) {
2137
+ if (!base) {
2138
+ return name;
2139
+ }
2140
+ var sep = base.includes('\\') && !base.includes('/') ? '\\' : '/';
2141
+ return base.replace(/[\/\\]+$/, '') + sep + name;
2142
+ }
2143
+
2122
2144
  /**
2123
2145
  * @typedef {Function} AnyClass
2124
2146
  */
@@ -2862,7 +2884,7 @@
2862
2884
 
2863
2885
  /**
2864
2886
  * @typedef {{
2865
- * message: string|DOMString
2887
+ * message: string
2866
2888
  * }} ErrorLike
2867
2889
  */
2868
2890
 
@@ -5353,7 +5375,7 @@
5353
5375
  /**
5354
5376
  * @typedef {{
5355
5377
  * op: SQLCallback,
5356
- * args: ObjectArray,
5378
+ * args: any[],
5357
5379
  * req: import('./IDBRequest.js').IDBRequestFull|null
5358
5380
  * }} RequestInfo
5359
5381
  */
@@ -5405,17 +5427,17 @@
5405
5427
  * __pushToQueue: (
5406
5428
  * request: import('./IDBRequest.js').IDBRequestFull|null,
5407
5429
  * callback: SQLCallback,
5408
- * args?: ObjectArray
5430
+ * args?: any[]
5409
5431
  * ) => void,
5410
5432
  * __assertActive: () => void,
5411
5433
  * commit: () => void,
5412
5434
  * __addNonRequestToTransactionQueue: (
5413
5435
  * callback: SQLCallback,
5414
- * args?: ObjectArray
5436
+ * args?: any[]
5415
5437
  * ) => void
5416
5438
  * __addToTransactionQueue: (
5417
5439
  * callback: SQLCallback,
5418
- * args: ObjectArray|undefined,
5440
+ * args: any[]|undefined,
5419
5441
  * source: import('./IDBDatabase.js').IDBDatabaseFull|
5420
5442
  * import('./IDBObjectStore.js').IDBObjectStoreFull|
5421
5443
  * import('./IDBIndex.js').IDBIndexFull|
@@ -6053,7 +6075,7 @@
6053
6075
  /**
6054
6076
  * @typedef {(
6055
6077
  * tx: import('websql-configurable/lib/websql/WebSQLTransaction.js').default,
6056
- * args: ObjectArray,
6078
+ * args: any[],
6057
6079
  * success: (result?: any, req?: import('./IDBRequest.js').IDBRequestFull) => void,
6058
6080
  * error: (
6059
6081
  * tx: import('websql-configurable/lib/websql/WebSQLTransaction.js').default|Error|DOMException,
@@ -6066,7 +6088,7 @@
6066
6088
  /**
6067
6089
  * Adds a callback function to the transaction queue.
6068
6090
  * @param {SQLCallback} callback
6069
- * @param {ObjectArray} args
6091
+ * @param {any[]} args
6070
6092
  * @param {import('./IDBDatabase.js').IDBDatabaseFull|
6071
6093
  * import('./IDBObjectStore.js').IDBObjectStoreFull|
6072
6094
  * import('./IDBIndex.js').IDBIndexFull} source
@@ -6083,7 +6105,7 @@
6083
6105
  * Adds a callback function to the transaction queue without generating a
6084
6106
  * request.
6085
6107
  * @param {SQLCallback} callback
6086
- * @param {ObjectArray} args
6108
+ * @param {any[]} args
6087
6109
  * @this {IDBTransactionFull}
6088
6110
  * @returns {void}
6089
6111
  */
@@ -6095,7 +6117,7 @@
6095
6117
  * Adds an IDBRequest to the transaction queue.
6096
6118
  * @param {import('./IDBRequest.js').IDBRequestFull|null} request
6097
6119
  * @param {SQLCallback} callback
6098
- * @param {ObjectArray} args
6120
+ * @param {any[]} args
6099
6121
  * @this {IDBTransactionFull}
6100
6122
  * @returns {void}
6101
6123
  */
@@ -10597,216 +10619,6 @@
10597
10619
  writable: false
10598
10620
  });
10599
10621
 
10600
- // Copyright Joyent, Inc. and other Node contributors.
10601
- //
10602
- // Permission is hereby granted, free of charge, to any person obtaining a
10603
- // copy of this software and associated documentation files (the
10604
- // "Software"), to deal in the Software without restriction, including
10605
- // without limitation the rights to use, copy, modify, merge, publish,
10606
- // distribute, sublicense, and/or sell copies of the Software, and to permit
10607
- // persons to whom the Software is furnished to do so, subject to the
10608
- // following conditions:
10609
- //
10610
- // The above copyright notice and this permission notice shall be included
10611
- // in all copies or substantial portions of the Software.
10612
- //
10613
- // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
10614
- // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
10615
- // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
10616
- // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
10617
- // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
10618
- // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
10619
- // USE OR OTHER DEALINGS IN THE SOFTWARE.
10620
-
10621
- // resolves . and .. elements in a path array with directory names there
10622
- // must be no slashes, empty elements, or device names (c:\) in the array
10623
- // (so also no leading and trailing slashes - it does not distinguish
10624
- // relative and absolute paths)
10625
- function normalizeArray(parts, allowAboveRoot) {
10626
- // if the path tries to go above the root, `up` ends up > 0
10627
- var up = 0;
10628
- for (var i = parts.length - 1; i >= 0; i--) {
10629
- var last = parts[i];
10630
- if (last === '.') {
10631
- parts.splice(i, 1);
10632
- } else if (last === '..') {
10633
- parts.splice(i, 1);
10634
- up++;
10635
- } else if (up) {
10636
- parts.splice(i, 1);
10637
- up--;
10638
- }
10639
- }
10640
-
10641
- // if the path is allowed to go above the root, restore leading ..s
10642
- if (allowAboveRoot) {
10643
- for (; up--; up) {
10644
- parts.unshift('..');
10645
- }
10646
- }
10647
- return parts;
10648
- }
10649
-
10650
- // Split a filename into [root, dir, basename, ext], unix version
10651
- // 'root' is just a slash, or nothing.
10652
- var splitPathRe = /^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/;
10653
- var splitPath = function splitPath(filename) {
10654
- return splitPathRe.exec(filename).slice(1);
10655
- };
10656
-
10657
- // path.resolve([from ...], to)
10658
- // posix version
10659
- function resolve() {
10660
- var resolvedPath = '',
10661
- resolvedAbsolute = false;
10662
- for (var i = arguments.length - 1; i >= -1 && !resolvedAbsolute; i--) {
10663
- var path = i >= 0 ? arguments[i] : '/';
10664
-
10665
- // Skip empty and invalid entries
10666
- if (typeof path !== 'string') {
10667
- throw new TypeError('Arguments to path.resolve must be strings');
10668
- } else if (!path) {
10669
- continue;
10670
- }
10671
- resolvedPath = path + '/' + resolvedPath;
10672
- resolvedAbsolute = path.charAt(0) === '/';
10673
- }
10674
-
10675
- // At this point the path should be resolved to a full absolute path, but
10676
- // handle relative paths to be safe (might happen when process.cwd() fails)
10677
-
10678
- // Normalize the path
10679
- resolvedPath = normalizeArray(filter(resolvedPath.split('/'), function (p) {
10680
- return !!p;
10681
- }), !resolvedAbsolute).join('/');
10682
- return (resolvedAbsolute ? '/' : '') + resolvedPath || '.';
10683
- }
10684
-
10685
- // path.normalize(path)
10686
- // posix version
10687
- function normalize(path) {
10688
- var isPathAbsolute = isAbsolute(path),
10689
- trailingSlash = substr(path, -1) === '/';
10690
-
10691
- // Normalize the path
10692
- path = normalizeArray(filter(path.split('/'), function (p) {
10693
- return !!p;
10694
- }), !isPathAbsolute).join('/');
10695
- if (!path && !isPathAbsolute) {
10696
- path = '.';
10697
- }
10698
- if (path && trailingSlash) {
10699
- path += '/';
10700
- }
10701
- return (isPathAbsolute ? '/' : '') + path;
10702
- }
10703
-
10704
- // posix version
10705
- function isAbsolute(path) {
10706
- return path.charAt(0) === '/';
10707
- }
10708
-
10709
- // posix version
10710
- function join() {
10711
- var paths = Array.prototype.slice.call(arguments, 0);
10712
- return normalize(filter(paths, function (p, index) {
10713
- if (typeof p !== 'string') {
10714
- throw new TypeError('Arguments to path.join must be strings');
10715
- }
10716
- return p;
10717
- }).join('/'));
10718
- }
10719
-
10720
- // path.relative(from, to)
10721
- // posix version
10722
- function relative(from, to) {
10723
- from = resolve(from).substr(1);
10724
- to = resolve(to).substr(1);
10725
- function trim(arr) {
10726
- var start = 0;
10727
- for (; start < arr.length; start++) {
10728
- if (arr[start] !== '') break;
10729
- }
10730
- var end = arr.length - 1;
10731
- for (; end >= 0; end--) {
10732
- if (arr[end] !== '') break;
10733
- }
10734
- if (start > end) return [];
10735
- return arr.slice(start, end - start + 1);
10736
- }
10737
- var fromParts = trim(from.split('/'));
10738
- var toParts = trim(to.split('/'));
10739
- var length = Math.min(fromParts.length, toParts.length);
10740
- var samePartsLength = length;
10741
- for (var i = 0; i < length; i++) {
10742
- if (fromParts[i] !== toParts[i]) {
10743
- samePartsLength = i;
10744
- break;
10745
- }
10746
- }
10747
- var outputParts = [];
10748
- for (var i = samePartsLength; i < fromParts.length; i++) {
10749
- outputParts.push('..');
10750
- }
10751
- outputParts = outputParts.concat(toParts.slice(samePartsLength));
10752
- return outputParts.join('/');
10753
- }
10754
- var sep = '/';
10755
- var delimiter = ':';
10756
- function dirname(path) {
10757
- var result = splitPath(path),
10758
- root = result[0],
10759
- dir = result[1];
10760
- if (!root && !dir) {
10761
- // No dirname whatsoever
10762
- return '.';
10763
- }
10764
- if (dir) {
10765
- // It has a dirname, strip trailing slash
10766
- dir = dir.substr(0, dir.length - 1);
10767
- }
10768
- return root + dir;
10769
- }
10770
- function basename(path, ext) {
10771
- var f = splitPath(path)[2];
10772
- // TODO: make this comparison case-insensitive on windows?
10773
- if (ext && f.substr(-1 * ext.length) === ext) {
10774
- f = f.substr(0, f.length - ext.length);
10775
- }
10776
- return f;
10777
- }
10778
- function extname(path) {
10779
- return splitPath(path)[3];
10780
- }
10781
- var path = {
10782
- extname: extname,
10783
- basename: basename,
10784
- dirname: dirname,
10785
- sep: sep,
10786
- delimiter: delimiter,
10787
- relative: relative,
10788
- join: join,
10789
- isAbsolute: isAbsolute,
10790
- normalize: normalize,
10791
- resolve: resolve
10792
- };
10793
- function filter(xs, f) {
10794
- if (xs.filter) return xs.filter(f);
10795
- var res = [];
10796
- for (var i = 0; i < xs.length; i++) {
10797
- if (f(xs[i], i, xs)) res.push(xs[i]);
10798
- }
10799
- return res;
10800
- }
10801
-
10802
- // String.prototype.substr - negative index don't work in IE8
10803
- var substr = 'ab'.substr(-1) === 'b' ? function (str, start, len) {
10804
- return str.substr(start, len);
10805
- } : function (str, start, len) {
10806
- if (start < 0) start = str.length + start;
10807
- return str.substr(start, len);
10808
- };
10809
-
10810
10622
  var listeners = ['onabort', 'onclose', 'onerror', 'onversionchange'];
10811
10623
  var readonlyProperties$1 = ['name', 'version', 'objectStoreNames'];
10812
10624
 
@@ -11526,7 +11338,7 @@
11526
11338
  }
11527
11339
  if (fs && CFG.deleteDatabaseFiles !== false) {
11528
11340
  closeCachedWebSQLConnections(name, function () {
11529
- fs.unlink(path.join(CFG.databaseBasePath || '', escapedDatabaseName), function (err) {
11341
+ fs.unlink(joinPath(CFG.databaseBasePath || '', escapedDatabaseName), function (err) {
11530
11342
  if (err && err.code !== 'ENOENT') {
11531
11343
  // Ignore if file is already deleted
11532
11344
  var removalError = /** @type {Error & {code?: number}} */
@@ -11540,7 +11352,7 @@
11540
11352
  });
11541
11353
  return;
11542
11354
  }
11543
- var sqliteDB = __openDatabase(path.join(CFG.databaseBasePath || '', escapedDatabaseName), '1', name, CFG.DEFAULT_DB_SIZE);
11355
+ var sqliteDB = __openDatabase(joinPath(CFG.databaseBasePath || '', escapedDatabaseName), '1', name, CFG.DEFAULT_DB_SIZE);
11544
11356
  sqliteDB.transaction(function (tx) {
11545
11357
  tx.executeSql('SELECT "name" FROM __sys__', [], function (tx, data) {
11546
11358
  var tables = data.rows;
@@ -11601,7 +11413,7 @@
11601
11413
  success();
11602
11414
  } else {
11603
11415
  // eslint-disable-next-line unicorn/no-top-level-assignment-in-function -- Necessary?
11604
- 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);
11416
+ 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);
11605
11417
  sysdb.transaction(function (systx) {
11606
11418
  systx.executeSql('CREATE TABLE IF NOT EXISTS dbVersions (name BLOB, version INT);', [], function (systx) {
11607
11419
  if (!CFG.useSQLiteIndexes) {
@@ -11843,7 +11655,7 @@
11843
11655
  req.transaction.__addNonRequestToTransactionQueue(
11844
11656
  /**
11845
11657
  * @param {import('websql-configurable/lib/websql/WebSQLTransaction.js').default} tx
11846
- * @param {ObjectArray} args
11658
+ * @param {any[]} args
11847
11659
  * @param {(result?: any, req?: import('./IDBRequest.js').IDBRequestFull) => void} finished
11848
11660
  * @returns {void}
11849
11661
  */
@@ -12057,7 +11869,7 @@
12057
11869
  if ((useMemoryDatabase || useDatabaseCache) && Object.hasOwn(websqlDBCache, name) && Object.hasOwn(websqlDBCache[name], version)) {
12058
11870
  db = websqlDBCache[name][version];
12059
11871
  } else {
12060
- db = /** @type {DatabaseFull} */me.__openDatabase(useMemoryDatabase ? CFG.memoryDatabase : path.join(CFG.databaseBasePath || '', escapedDatabaseName), '1', name, CFG.DEFAULT_DB_SIZE);
11872
+ db = /** @type {DatabaseFull} */me.__openDatabase(useMemoryDatabase ? CFG.memoryDatabase : joinPath(CFG.databaseBasePath || '', escapedDatabaseName), '1', name, CFG.DEFAULT_DB_SIZE);
12061
11873
  if (useDatabaseCache) {
12062
11874
  if (!Object.hasOwn(websqlDBCache, name)) {
12063
11875
  websqlDBCache[name] = {};
@@ -12566,7 +12378,10 @@
12566
12378
  * },
12567
12379
  * __count: boolean,
12568
12380
  * __prefetchedIndex: Integer,
12569
- * __prefetchedData: null|SQLResultSetRowList|{
12381
+ * __prefetchedData: null|{
12382
+ * length: number;
12383
+ * item(index: number): any;
12384
+ * }|{
12570
12385
  * data: RowItemNonNull[],
12571
12386
  * length: Integer,
12572
12387
  * item: (index: Integer) => RowItemNonNull