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) :
@@ -2111,6 +2111,28 @@
2111
2111
  return str.replaceAll('^', '^^');
2112
2112
  }
2113
2113
 
2114
+ /**
2115
+ * Minimal replacement for `path.join(base, name)` covering our only use case:
2116
+ * `name` is always a bare file name (no separators and no `.`/`..`), and
2117
+ * `base` is a directory path expected to be absolute and normalized (an
2118
+ * empty string means the current working directory). Unlike `path.join`,
2119
+ * this performs no `.`/`..` resolution. It reuses the separator style of
2120
+ * `base` (backslash only when `base` uses backslashes and no forward
2121
+ * slashes, i.e. a Windows path), otherwise `/`; Node's `fs`, SQLite, and
2122
+ * `websql-configurable` accept either separator on Windows regardless.
2123
+ * Avoiding `node:path` keeps browser bundles free of a path polyfill.
2124
+ * @param {string} base
2125
+ * @param {string} name
2126
+ * @returns {string}
2127
+ */
2128
+ function joinPath(base, name) {
2129
+ if (!base) {
2130
+ return name;
2131
+ }
2132
+ var sep = base.includes('\\') && !base.includes('/') ? '\\' : '/';
2133
+ return base.replace(/[\/\\]+$/, '') + sep + name;
2134
+ }
2135
+
2114
2136
  /**
2115
2137
  * @typedef {Function} AnyClass
2116
2138
  */
@@ -2854,7 +2876,7 @@
2854
2876
 
2855
2877
  /**
2856
2878
  * @typedef {{
2857
- * message: string|DOMString
2879
+ * message: string
2858
2880
  * }} ErrorLike
2859
2881
  */
2860
2882
 
@@ -5345,7 +5367,7 @@
5345
5367
  /**
5346
5368
  * @typedef {{
5347
5369
  * op: SQLCallback,
5348
- * args: ObjectArray,
5370
+ * args: any[],
5349
5371
  * req: import('./IDBRequest.js').IDBRequestFull|null
5350
5372
  * }} RequestInfo
5351
5373
  */
@@ -5397,17 +5419,17 @@
5397
5419
  * __pushToQueue: (
5398
5420
  * request: import('./IDBRequest.js').IDBRequestFull|null,
5399
5421
  * callback: SQLCallback,
5400
- * args?: ObjectArray
5422
+ * args?: any[]
5401
5423
  * ) => void,
5402
5424
  * __assertActive: () => void,
5403
5425
  * commit: () => void,
5404
5426
  * __addNonRequestToTransactionQueue: (
5405
5427
  * callback: SQLCallback,
5406
- * args?: ObjectArray
5428
+ * args?: any[]
5407
5429
  * ) => void
5408
5430
  * __addToTransactionQueue: (
5409
5431
  * callback: SQLCallback,
5410
- * args: ObjectArray|undefined,
5432
+ * args: any[]|undefined,
5411
5433
  * source: import('./IDBDatabase.js').IDBDatabaseFull|
5412
5434
  * import('./IDBObjectStore.js').IDBObjectStoreFull|
5413
5435
  * import('./IDBIndex.js').IDBIndexFull|
@@ -6045,7 +6067,7 @@
6045
6067
  /**
6046
6068
  * @typedef {(
6047
6069
  * tx: import('websql-configurable/lib/websql/WebSQLTransaction.js').default,
6048
- * args: ObjectArray,
6070
+ * args: any[],
6049
6071
  * success: (result?: any, req?: import('./IDBRequest.js').IDBRequestFull) => void,
6050
6072
  * error: (
6051
6073
  * tx: import('websql-configurable/lib/websql/WebSQLTransaction.js').default|Error|DOMException,
@@ -6058,7 +6080,7 @@
6058
6080
  /**
6059
6081
  * Adds a callback function to the transaction queue.
6060
6082
  * @param {SQLCallback} callback
6061
- * @param {ObjectArray} args
6083
+ * @param {any[]} args
6062
6084
  * @param {import('./IDBDatabase.js').IDBDatabaseFull|
6063
6085
  * import('./IDBObjectStore.js').IDBObjectStoreFull|
6064
6086
  * import('./IDBIndex.js').IDBIndexFull} source
@@ -6075,7 +6097,7 @@
6075
6097
  * Adds a callback function to the transaction queue without generating a
6076
6098
  * request.
6077
6099
  * @param {SQLCallback} callback
6078
- * @param {ObjectArray} args
6100
+ * @param {any[]} args
6079
6101
  * @this {IDBTransactionFull}
6080
6102
  * @returns {void}
6081
6103
  */
@@ -6087,7 +6109,7 @@
6087
6109
  * Adds an IDBRequest to the transaction queue.
6088
6110
  * @param {import('./IDBRequest.js').IDBRequestFull|null} request
6089
6111
  * @param {SQLCallback} callback
6090
- * @param {ObjectArray} args
6112
+ * @param {any[]} args
6091
6113
  * @this {IDBTransactionFull}
6092
6114
  * @returns {void}
6093
6115
  */
@@ -10589,216 +10611,6 @@
10589
10611
  writable: false
10590
10612
  });
10591
10613
 
10592
- // Copyright Joyent, Inc. and other Node contributors.
10593
- //
10594
- // Permission is hereby granted, free of charge, to any person obtaining a
10595
- // copy of this software and associated documentation files (the
10596
- // "Software"), to deal in the Software without restriction, including
10597
- // without limitation the rights to use, copy, modify, merge, publish,
10598
- // distribute, sublicense, and/or sell copies of the Software, and to permit
10599
- // persons to whom the Software is furnished to do so, subject to the
10600
- // following conditions:
10601
- //
10602
- // The above copyright notice and this permission notice shall be included
10603
- // in all copies or substantial portions of the Software.
10604
- //
10605
- // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
10606
- // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
10607
- // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
10608
- // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
10609
- // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
10610
- // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
10611
- // USE OR OTHER DEALINGS IN THE SOFTWARE.
10612
-
10613
- // resolves . and .. elements in a path array with directory names there
10614
- // must be no slashes, empty elements, or device names (c:\) in the array
10615
- // (so also no leading and trailing slashes - it does not distinguish
10616
- // relative and absolute paths)
10617
- function normalizeArray(parts, allowAboveRoot) {
10618
- // if the path tries to go above the root, `up` ends up > 0
10619
- var up = 0;
10620
- for (var i = parts.length - 1; i >= 0; i--) {
10621
- var last = parts[i];
10622
- if (last === '.') {
10623
- parts.splice(i, 1);
10624
- } else if (last === '..') {
10625
- parts.splice(i, 1);
10626
- up++;
10627
- } else if (up) {
10628
- parts.splice(i, 1);
10629
- up--;
10630
- }
10631
- }
10632
-
10633
- // if the path is allowed to go above the root, restore leading ..s
10634
- if (allowAboveRoot) {
10635
- for (; up--; up) {
10636
- parts.unshift('..');
10637
- }
10638
- }
10639
- return parts;
10640
- }
10641
-
10642
- // Split a filename into [root, dir, basename, ext], unix version
10643
- // 'root' is just a slash, or nothing.
10644
- var splitPathRe = /^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/;
10645
- var splitPath = function splitPath(filename) {
10646
- return splitPathRe.exec(filename).slice(1);
10647
- };
10648
-
10649
- // path.resolve([from ...], to)
10650
- // posix version
10651
- function resolve() {
10652
- var resolvedPath = '',
10653
- resolvedAbsolute = false;
10654
- for (var i = arguments.length - 1; i >= -1 && !resolvedAbsolute; i--) {
10655
- var path = i >= 0 ? arguments[i] : '/';
10656
-
10657
- // Skip empty and invalid entries
10658
- if (typeof path !== 'string') {
10659
- throw new TypeError('Arguments to path.resolve must be strings');
10660
- } else if (!path) {
10661
- continue;
10662
- }
10663
- resolvedPath = path + '/' + resolvedPath;
10664
- resolvedAbsolute = path.charAt(0) === '/';
10665
- }
10666
-
10667
- // At this point the path should be resolved to a full absolute path, but
10668
- // handle relative paths to be safe (might happen when process.cwd() fails)
10669
-
10670
- // Normalize the path
10671
- resolvedPath = normalizeArray(filter(resolvedPath.split('/'), function (p) {
10672
- return !!p;
10673
- }), !resolvedAbsolute).join('/');
10674
- return (resolvedAbsolute ? '/' : '') + resolvedPath || '.';
10675
- }
10676
-
10677
- // path.normalize(path)
10678
- // posix version
10679
- function normalize(path) {
10680
- var isPathAbsolute = isAbsolute(path),
10681
- trailingSlash = substr(path, -1) === '/';
10682
-
10683
- // Normalize the path
10684
- path = normalizeArray(filter(path.split('/'), function (p) {
10685
- return !!p;
10686
- }), !isPathAbsolute).join('/');
10687
- if (!path && !isPathAbsolute) {
10688
- path = '.';
10689
- }
10690
- if (path && trailingSlash) {
10691
- path += '/';
10692
- }
10693
- return (isPathAbsolute ? '/' : '') + path;
10694
- }
10695
-
10696
- // posix version
10697
- function isAbsolute(path) {
10698
- return path.charAt(0) === '/';
10699
- }
10700
-
10701
- // posix version
10702
- function join() {
10703
- var paths = Array.prototype.slice.call(arguments, 0);
10704
- return normalize(filter(paths, function (p, index) {
10705
- if (typeof p !== 'string') {
10706
- throw new TypeError('Arguments to path.join must be strings');
10707
- }
10708
- return p;
10709
- }).join('/'));
10710
- }
10711
-
10712
- // path.relative(from, to)
10713
- // posix version
10714
- function relative(from, to) {
10715
- from = resolve(from).substr(1);
10716
- to = resolve(to).substr(1);
10717
- function trim(arr) {
10718
- var start = 0;
10719
- for (; start < arr.length; start++) {
10720
- if (arr[start] !== '') break;
10721
- }
10722
- var end = arr.length - 1;
10723
- for (; end >= 0; end--) {
10724
- if (arr[end] !== '') break;
10725
- }
10726
- if (start > end) return [];
10727
- return arr.slice(start, end - start + 1);
10728
- }
10729
- var fromParts = trim(from.split('/'));
10730
- var toParts = trim(to.split('/'));
10731
- var length = Math.min(fromParts.length, toParts.length);
10732
- var samePartsLength = length;
10733
- for (var i = 0; i < length; i++) {
10734
- if (fromParts[i] !== toParts[i]) {
10735
- samePartsLength = i;
10736
- break;
10737
- }
10738
- }
10739
- var outputParts = [];
10740
- for (var i = samePartsLength; i < fromParts.length; i++) {
10741
- outputParts.push('..');
10742
- }
10743
- outputParts = outputParts.concat(toParts.slice(samePartsLength));
10744
- return outputParts.join('/');
10745
- }
10746
- var sep = '/';
10747
- var delimiter = ':';
10748
- function dirname(path) {
10749
- var result = splitPath(path),
10750
- root = result[0],
10751
- dir = result[1];
10752
- if (!root && !dir) {
10753
- // No dirname whatsoever
10754
- return '.';
10755
- }
10756
- if (dir) {
10757
- // It has a dirname, strip trailing slash
10758
- dir = dir.substr(0, dir.length - 1);
10759
- }
10760
- return root + dir;
10761
- }
10762
- function basename(path, ext) {
10763
- var f = splitPath(path)[2];
10764
- // TODO: make this comparison case-insensitive on windows?
10765
- if (ext && f.substr(-1 * ext.length) === ext) {
10766
- f = f.substr(0, f.length - ext.length);
10767
- }
10768
- return f;
10769
- }
10770
- function extname(path) {
10771
- return splitPath(path)[3];
10772
- }
10773
- var path = {
10774
- extname: extname,
10775
- basename: basename,
10776
- dirname: dirname,
10777
- sep: sep,
10778
- delimiter: delimiter,
10779
- relative: relative,
10780
- join: join,
10781
- isAbsolute: isAbsolute,
10782
- normalize: normalize,
10783
- resolve: resolve
10784
- };
10785
- function filter(xs, f) {
10786
- if (xs.filter) return xs.filter(f);
10787
- var res = [];
10788
- for (var i = 0; i < xs.length; i++) {
10789
- if (f(xs[i], i, xs)) res.push(xs[i]);
10790
- }
10791
- return res;
10792
- }
10793
-
10794
- // String.prototype.substr - negative index don't work in IE8
10795
- var substr = 'ab'.substr(-1) === 'b' ? function (str, start, len) {
10796
- return str.substr(start, len);
10797
- } : function (str, start, len) {
10798
- if (start < 0) start = str.length + start;
10799
- return str.substr(start, len);
10800
- };
10801
-
10802
10614
  var listeners = ['onabort', 'onclose', 'onerror', 'onversionchange'];
10803
10615
  var readonlyProperties$1 = ['name', 'version', 'objectStoreNames'];
10804
10616
 
@@ -11518,7 +11330,7 @@
11518
11330
  }
11519
11331
  if (fs && CFG.deleteDatabaseFiles !== false) {
11520
11332
  closeCachedWebSQLConnections(name, function () {
11521
- fs.unlink(path.join(CFG.databaseBasePath || '', escapedDatabaseName), function (err) {
11333
+ fs.unlink(joinPath(CFG.databaseBasePath || '', escapedDatabaseName), function (err) {
11522
11334
  if (err && err.code !== 'ENOENT') {
11523
11335
  // Ignore if file is already deleted
11524
11336
  var removalError = /** @type {Error & {code?: number}} */
@@ -11532,7 +11344,7 @@
11532
11344
  });
11533
11345
  return;
11534
11346
  }
11535
- var sqliteDB = __openDatabase(path.join(CFG.databaseBasePath || '', escapedDatabaseName), '1', name, CFG.DEFAULT_DB_SIZE);
11347
+ var sqliteDB = __openDatabase(joinPath(CFG.databaseBasePath || '', escapedDatabaseName), '1', name, CFG.DEFAULT_DB_SIZE);
11536
11348
  sqliteDB.transaction(function (tx) {
11537
11349
  tx.executeSql('SELECT "name" FROM __sys__', [], function (tx, data) {
11538
11350
  var tables = data.rows;
@@ -11593,7 +11405,7 @@
11593
11405
  success();
11594
11406
  } else {
11595
11407
  // eslint-disable-next-line unicorn/no-top-level-assignment-in-function -- Necessary?
11596
- 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);
11408
+ 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);
11597
11409
  sysdb.transaction(function (systx) {
11598
11410
  systx.executeSql('CREATE TABLE IF NOT EXISTS dbVersions (name BLOB, version INT);', [], function (systx) {
11599
11411
  if (!CFG.useSQLiteIndexes) {
@@ -11835,7 +11647,7 @@
11835
11647
  req.transaction.__addNonRequestToTransactionQueue(
11836
11648
  /**
11837
11649
  * @param {import('websql-configurable/lib/websql/WebSQLTransaction.js').default} tx
11838
- * @param {ObjectArray} args
11650
+ * @param {any[]} args
11839
11651
  * @param {(result?: any, req?: import('./IDBRequest.js').IDBRequestFull) => void} finished
11840
11652
  * @returns {void}
11841
11653
  */
@@ -12049,7 +11861,7 @@
12049
11861
  if ((useMemoryDatabase || useDatabaseCache) && Object.hasOwn(websqlDBCache, name) && Object.hasOwn(websqlDBCache[name], version)) {
12050
11862
  db = websqlDBCache[name][version];
12051
11863
  } else {
12052
- db = /** @type {DatabaseFull} */me.__openDatabase(useMemoryDatabase ? CFG.memoryDatabase : path.join(CFG.databaseBasePath || '', escapedDatabaseName), '1', name, CFG.DEFAULT_DB_SIZE);
11864
+ db = /** @type {DatabaseFull} */me.__openDatabase(useMemoryDatabase ? CFG.memoryDatabase : joinPath(CFG.databaseBasePath || '', escapedDatabaseName), '1', name, CFG.DEFAULT_DB_SIZE);
12053
11865
  if (useDatabaseCache) {
12054
11866
  if (!Object.hasOwn(websqlDBCache, name)) {
12055
11867
  websqlDBCache[name] = {};
@@ -12558,7 +12370,10 @@
12558
12370
  * },
12559
12371
  * __count: boolean,
12560
12372
  * __prefetchedIndex: Integer,
12561
- * __prefetchedData: null|SQLResultSetRowList|{
12373
+ * __prefetchedData: null|{
12374
+ * length: number;
12375
+ * item(index: number): any;
12376
+ * }|{
12562
12377
  * data: RowItemNonNull[],
12563
12378
  * length: Integer,
12564
12379
  * item: (index: Integer) => RowItemNonNull