indexeddbshim 15.0.1 → 15.0.2
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.
- package/README.md +1 -1
- package/dist/indexeddbshim-Key.js +15 -14
- package/dist/indexeddbshim-Key.js.map +1 -1
- package/dist/indexeddbshim-Key.min.js +1 -1
- package/dist/indexeddbshim-Key.min.js.map +1 -1
- package/dist/indexeddbshim-UnicodeIdentifiers-node.cjs +117 -107
- package/dist/indexeddbshim-UnicodeIdentifiers-node.cjs.map +1 -1
- package/dist/indexeddbshim-UnicodeIdentifiers.js +139 -121
- package/dist/indexeddbshim-UnicodeIdentifiers.js.map +1 -1
- package/dist/indexeddbshim-UnicodeIdentifiers.min.js +2 -2
- package/dist/indexeddbshim-UnicodeIdentifiers.min.js.map +1 -1
- package/dist/indexeddbshim-node.cjs +115 -105
- package/dist/indexeddbshim-node.cjs.map +1 -1
- package/dist/indexeddbshim-noninvasive.js +133 -115
- package/dist/indexeddbshim-noninvasive.js.map +1 -1
- package/dist/indexeddbshim-noninvasive.min.js +2 -2
- package/dist/indexeddbshim-noninvasive.min.js.map +1 -1
- package/dist/indexeddbshim.js +119 -109
- package/dist/indexeddbshim.js.map +1 -1
- package/dist/indexeddbshim.min.js +2 -2
- package/dist/indexeddbshim.min.js.map +1 -1
- package/package.json +13 -29
- package/src/DOMException.js +5 -4
- package/src/DOMStringList.js +4 -3
- package/src/IDBCursor.js +4 -4
- package/src/IDBDatabase.js +2 -2
- package/src/IDBFactory.js +15 -12
- package/src/IDBIndex.js +7 -6
- package/src/IDBKeyRange.js +3 -3
- package/src/IDBObjectStore.js +10 -9
- package/src/IDBTransaction.js +5 -5
- package/src/IDBVersionChangeEvent.js +1 -1
- package/src/Key.js +1 -1
- package/src/Sca.js +0 -1
- package/src/UnicodeIdentifiers.js +2 -2
- package/src/setGlobalVars.js +5 -2
- package/src/util.js +2 -2
package/README.md
CHANGED
|
@@ -588,7 +588,7 @@ example:
|
|
|
588
588
|
```js
|
|
589
589
|
(function () {
|
|
590
590
|
// This works on all browsers, and only uses IndexedDBShim as a final fallback
|
|
591
|
-
var indexedDB = window.indexedDB || window.mozIndexedDB || // eslint-disable-line no-var
|
|
591
|
+
var indexedDB = window.indexedDB || window.mozIndexedDB || // eslint-disable-line no-var -- Older browsers
|
|
592
592
|
window.webkitIndexedDB || window.msIndexedDB || window.shimIndexedDB;
|
|
593
593
|
|
|
594
594
|
// This code will use the native IndexedDB, if it exists, or the shim otherwise
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! indexeddbshim - v15.0.
|
|
1
|
+
/*! indexeddbshim - v15.0.1 - 9/5/2024 */
|
|
2
2
|
|
|
3
3
|
(function (global, factory) {
|
|
4
4
|
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
|
|
@@ -305,7 +305,7 @@
|
|
|
305
305
|
* @returns {void}
|
|
306
306
|
*/
|
|
307
307
|
function (val) {
|
|
308
|
-
if (!/^(?::memory:|file::memory:(\?(?:[\0-"\$-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*)?(#(?:[\0-\t\x0B\f\x0E-\u2027\u202A-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*)?)?$/.test(
|
|
308
|
+
if (!/^(?::memory:|file::memory:(\?(?:[\0-"\$-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*)?(#(?:[\0-\t\x0B\f\x0E-\u2027\u202A-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*)?)?$/.test(/** @type {string} */val)) {
|
|
309
309
|
throw new TypeError('`memoryDatabase` must be the empty string, ":memory:", or a ' + '"file::memory:[?queryString][#hash] URL".');
|
|
310
310
|
}
|
|
311
311
|
}],
|
|
@@ -456,10 +456,10 @@
|
|
|
456
456
|
function DOMException(message, name) {
|
|
457
457
|
// const err = Error.prototype.constructor.call(this, message); // Any use to this? Won't set this.message
|
|
458
458
|
this[Symbol.toStringTag] = 'DOMException';
|
|
459
|
-
this._code = name in codes ? codes[(
|
|
459
|
+
this._code = name in codes ? codes[(/** @type {Code} */name)] : legacyCodes[(/** @type {LegacyCode} */name)] || 0;
|
|
460
460
|
this._name = name || 'Error';
|
|
461
461
|
// We avoid `String()` in this next line as it converts Symbols
|
|
462
|
-
this._message = message === undefined ? '' : '' + message; // eslint-disable-line no-implicit-coercion
|
|
462
|
+
this._message = message === undefined ? '' : '' + message; // eslint-disable-line no-implicit-coercion -- Don't convert symbols
|
|
463
463
|
Object.defineProperty(this, 'code', {
|
|
464
464
|
configurable: true,
|
|
465
465
|
enumerable: true,
|
|
@@ -487,12 +487,12 @@
|
|
|
487
487
|
// Necessary for W3C tests which complains if `DOMException` has properties on its "own" prototype
|
|
488
488
|
|
|
489
489
|
// class DummyDOMException extends Error {}; // Sometimes causing problems in Node
|
|
490
|
-
/* eslint-disable func-name-matching */
|
|
490
|
+
/* eslint-disable func-name-matching -- See above */
|
|
491
491
|
/**
|
|
492
492
|
* @class
|
|
493
493
|
*/
|
|
494
494
|
var DummyDOMException = function DOMException() {/* */};
|
|
495
|
-
/* eslint-enable func-name-matching */
|
|
495
|
+
/* eslint-enable func-name-matching -- See above */
|
|
496
496
|
DummyDOMException.prototype = Object.create(Error.prototype); // Intended for subclassing
|
|
497
497
|
/** @type {const} */
|
|
498
498
|
['name', 'message'].forEach(function (prop) {
|
|
@@ -593,7 +593,7 @@
|
|
|
593
593
|
*/
|
|
594
594
|
function logError(name, message, error) {
|
|
595
595
|
if (CFG.DEBUG) {
|
|
596
|
-
var msg = error && _typeof(error) === 'object' && error.message ? error.message : (
|
|
596
|
+
var msg = error && _typeof(error) === 'object' && error.message ? error.message : (/** @type {string} */error);
|
|
597
597
|
var method = typeof console.error === 'function' ? 'error' : 'log';
|
|
598
598
|
console[method](name + ': ' + message + '. ' + (msg || ''));
|
|
599
599
|
if (console.trace) {
|
|
@@ -625,7 +625,8 @@
|
|
|
625
625
|
// Native DOMException works as expected
|
|
626
626
|
useNativeDOMException = true;
|
|
627
627
|
}
|
|
628
|
-
|
|
628
|
+
// eslint-disable-next-line no-unused-vars -- Problem with commonJS rollup
|
|
629
|
+
} catch (err) {}
|
|
629
630
|
var createDOMException = useNativeDOMException
|
|
630
631
|
// eslint-disable-next-line @stylistic/operator-linebreak -- Need JSDoc
|
|
631
632
|
?
|
|
@@ -835,7 +836,7 @@
|
|
|
835
836
|
};
|
|
836
837
|
var keyTypes = /** @type {(KeyType|"invalid")[]} */Object.keys(keyTypeToEncodedChar);
|
|
837
838
|
keyTypes.forEach(function (k) {
|
|
838
|
-
keyTypeToEncodedChar[k] = String.fromCodePoint(
|
|
839
|
+
keyTypeToEncodedChar[k] = String.fromCodePoint(/** @type {number} */keyTypeToEncodedChar[k]);
|
|
839
840
|
});
|
|
840
841
|
var encodedCharToKeyType = keyTypes.reduce(function (o, k) {
|
|
841
842
|
o[keyTypeToEncodedChar[k]] = k;
|
|
@@ -1224,7 +1225,7 @@
|
|
|
1224
1225
|
return 'binary';
|
|
1225
1226
|
}
|
|
1226
1227
|
var keyType = _typeof(key);
|
|
1227
|
-
return ['string', 'number'].includes(keyType) ? (
|
|
1228
|
+
return ['string', 'number'].includes(keyType) ? (/** @type {"string"|"number"} */keyType) : 'invalid';
|
|
1228
1229
|
}
|
|
1229
1230
|
|
|
1230
1231
|
/**
|
|
@@ -1332,7 +1333,7 @@
|
|
|
1332
1333
|
// May throw (if detached)
|
|
1333
1334
|
// Get a copy of the bytes held by the buffer source
|
|
1334
1335
|
// https://heycam.github.io/webidl/#ref-for-dfn-get-buffer-source-copy-2
|
|
1335
|
-
var octets = getCopyBytesHeldByBufferSource(
|
|
1336
|
+
var octets = getCopyBytesHeldByBufferSource(/** @type {BufferSource} */input);
|
|
1336
1337
|
return {
|
|
1337
1338
|
type: 'binary',
|
|
1338
1339
|
value: octets
|
|
@@ -1569,7 +1570,7 @@
|
|
|
1569
1570
|
value = /** @type {File} */value[idntfr];
|
|
1570
1571
|
break;
|
|
1571
1572
|
case 'lastModifiedDate':
|
|
1572
|
-
value = new Date(
|
|
1573
|
+
value = new Date(/** @type {File} */value.lastModified);
|
|
1573
1574
|
break;
|
|
1574
1575
|
}
|
|
1575
1576
|
} else if (!isObj(value) || !Object.hasOwn(value, idntfr)) {
|
|
@@ -1603,7 +1604,7 @@
|
|
|
1603
1604
|
}
|
|
1604
1605
|
value = value[identifier];
|
|
1605
1606
|
});
|
|
1606
|
-
value[(
|
|
1607
|
+
value[(/** @type {string} */last)] = key; // key is already a `keyValue` in our processing so no need to convert
|
|
1607
1608
|
}
|
|
1608
1609
|
|
|
1609
1610
|
/**
|
|
@@ -1900,7 +1901,7 @@
|
|
|
1900
1901
|
getCurrentNumber(tx, store, function (key) {
|
|
1901
1902
|
if (key > MAX_ALLOWED_CURRENT_NUMBER) {
|
|
1902
1903
|
// 2 ^ 53 (See <https://github.com/w3c/IndexedDB/issues/147>)
|
|
1903
|
-
cb('failure');
|
|
1904
|
+
cb('failure');
|
|
1904
1905
|
return;
|
|
1905
1906
|
}
|
|
1906
1907
|
// Increment current number by 1 (we cannot leverage SQLite's
|