indexeddbshim 15.0.0 → 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/badges/licenses-badge-dev.svg +1 -1
- package/dist/indexeddbshim-Key.js +24 -16
- 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 +142 -114
- package/dist/indexeddbshim-UnicodeIdentifiers-node.cjs.map +1 -1
- package/dist/indexeddbshim-UnicodeIdentifiers.js +165 -129
- 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 +140 -112
- package/dist/indexeddbshim-node.cjs.map +1 -1
- package/dist/indexeddbshim-noninvasive.js +159 -123
- 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 +145 -117
- 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 +85 -102
- package/src/DOMException.js +5 -4
- package/src/DOMStringList.js +4 -3
- package/src/IDBCursor.js +4 -4
- package/src/IDBDatabase.js +7 -2
- package/src/IDBFactory.js +25 -16
- 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 +9 -2
- 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 +1 @@
|
|
|
1
|
-
<svg xmlns="http://www.w3.org/2000/svg" width="
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="887" height="200"><defs><style>text{font-size:11px;font-family:Verdana,DejaVu Sans,Geneva,sans-serif}text.shadow{fill:#010101;fill-opacity:.3}text.high{fill:#fff}</style><linearGradient id="smooth" x2="0" y2="100%"><stop offset="0" stop-color="#aaa" stop-opacity=".1"/><stop offset="1" stop-opacity=".1"/></linearGradient><mask id="round"><rect width="100%" height="100%" rx="3" fill="#fff"/></mask></defs><g id="bg" mask="url(#round)"><path fill="navy" d="M0 0h88v200H0z"/><path fill="#006400" d="M88 0h183v200H88z"/><path fill="green" d="M271 0h266v200H271z"/><path fill="#cc0" d="M537 0h108v200H537z"/><path fill="#a9a9a9" d="M645 0h109v200H645z"/><path fill="#d3d3d3" d="M754 0h133v200H754z"/><path fill="url(#smooth)" d="M0 0h887v200H0z"/></g><g id="fg"><text class="shadow" x="5.5" y="15">License types</text><text class="high" x="5" y="14">License types</text><text class="shadow" x="5.5" y="27">(all devDeps)</text><text class="high" x="5" y="26">(all devDeps)</text><text class="shadow" x="93.5" y="15">Public</text><text class="high" x="93" y="14">Public</text><text class="shadow" x="93.5" y="27">domain</text><text class="high" x="93" y="26">domain</text><text class="shadow" x="93.5" y="51">1. (MIT OR CC0-1.0)</text><text class="high" x="93" y="50">1. (MIT OR CC0-1.0)</text><text class="shadow" x="93.5" y="63">2. (Unlicense OR Apache-2.0)</text><text class="high" x="93" y="62">2. (Unlicense OR Apache-2.0)</text><text class="shadow" x="93.5" y="75">3. CC0-1.0</text><text class="high" x="93" y="74">3. CC0-1.0</text><text class="shadow" x="276.5" y="15">Permissive</text><text class="high" x="276" y="14">Permissive</text><text class="shadow" x="276.5" y="39">1. (BSD-2-Clause OR (MIT OR Apache-2.0))</text><text class="high" x="276" y="38">1. (BSD-2-Clause OR (MIT OR Apache-2.0))</text><text class="shadow" x="276.5" y="51">2. (MIT OR CC0-1.0)</text><text class="high" x="276" y="50">2. (MIT OR CC0-1.0)</text><text class="shadow" x="276.5" y="63">3. (MIT OR WTFPL)</text><text class="high" x="276" y="62">3. (MIT OR WTFPL)</text><text class="shadow" x="276.5" y="75">4. (Unlicense OR Apache-2.0)</text><text class="high" x="276" y="74">4. (Unlicense OR Apache-2.0)</text><text class="shadow" x="276.5" y="87">5. 0BSD</text><text class="high" x="276" y="86">5. 0BSD</text><text class="shadow" x="276.5" y="99">6. Apache-2.0</text><text class="high" x="276" y="98">6. Apache-2.0</text><text class="shadow" x="276.5" y="111">7. BSD-2-Clause</text><text class="high" x="276" y="110">7. BSD-2-Clause</text><text class="shadow" x="276.5" y="123">8. BSD-3-Clause</text><text class="high" x="276" y="122">8. BSD-3-Clause</text><text class="shadow" x="276.5" y="135">9. BlueOak-1.0.0</text><text class="high" x="276" y="134">9. BlueOak-1.0.0</text><text class="shadow" x="276.5" y="147">10. CC-BY-3.0</text><text class="high" x="276" y="146">10. CC-BY-3.0</text><text class="shadow" x="276.5" y="159">11. CC-BY-4.0</text><text class="high" x="276" y="158">11. CC-BY-4.0</text><text class="shadow" x="276.5" y="171">12. ISC</text><text class="high" x="276" y="170">12. ISC</text><text class="shadow" x="276.5" y="183">13. MIT</text><text class="high" x="276" y="182">13. MIT</text><text class="shadow" x="276.5" y="195">14. WTFPL</text><text class="high" x="276" y="194">14. WTFPL</text><text class="shadow" x="542.5" y="15">Weakly</text><text class="high" x="542" y="14">Weakly</text><text class="shadow" x="542.5" y="27">protective</text><text class="high" x="542" y="26">protective</text><text class="shadow" x="542.5" y="51">1. LGPL-3.0-only</text><text class="high" x="542" y="50">1. LGPL-3.0-only</text><text class="shadow" x="542.5" y="63">2. MPL-2.0</text><text class="high" x="542" y="62">2. MPL-2.0</text><text class="shadow" x="650.5" y="15">Uncategorized</text><text class="high" x="650" y="14">Uncategorized</text><text class="shadow" x="650.5" y="39">1. neodoc (2.0.2)</text><text class="high" x="650" y="38">1. neodoc (2.0.2)</text><text class="shadow" x="759.5" y="15">Missing</text><text class="high" x="759" y="14">Missing</text><text class="shadow" x="759.5" y="39">1. atomically (2.0.3)</text><text class="high" x="759" y="38">1. atomically (2.0.3)</text><text class="shadow" x="759.5" y="51">2. stubborn-fs (1.2.5)</text><text class="high" x="759" y="50">2. stubborn-fs (1.2.5)</text><text class="shadow" x="759.5" y="63">3. when-exit (2.1.3)</text><text class="high" x="759" y="62">3. when-exit (2.1.3)</text></g></svg>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! indexeddbshim -
|
|
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) :
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
function _createForOfIteratorHelper(r, e) {
|
|
21
21
|
var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
|
|
22
22
|
if (!t) {
|
|
23
|
-
if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e
|
|
23
|
+
if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e) {
|
|
24
24
|
t && (r = t);
|
|
25
25
|
var n = 0,
|
|
26
26
|
F = function () {};
|
|
@@ -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;
|
|
@@ -857,6 +858,14 @@
|
|
|
857
858
|
* @typedef {any} AnyValue
|
|
858
859
|
*/
|
|
859
860
|
|
|
861
|
+
/**
|
|
862
|
+
* @type {{
|
|
863
|
+
* [key: string]: {
|
|
864
|
+
* encode: (param: any, inArray?: boolean) => string,
|
|
865
|
+
* decode: (param: string, inArray?: boolean) => any
|
|
866
|
+
* }
|
|
867
|
+
* }}
|
|
868
|
+
*/
|
|
860
869
|
var types = {
|
|
861
870
|
invalid: {
|
|
862
871
|
/**
|
|
@@ -1216,7 +1225,7 @@
|
|
|
1216
1225
|
return 'binary';
|
|
1217
1226
|
}
|
|
1218
1227
|
var keyType = _typeof(key);
|
|
1219
|
-
return ['string', 'number'].includes(keyType) ? (
|
|
1228
|
+
return ['string', 'number'].includes(keyType) ? (/** @type {"string"|"number"} */keyType) : 'invalid';
|
|
1220
1229
|
}
|
|
1221
1230
|
|
|
1222
1231
|
/**
|
|
@@ -1324,7 +1333,7 @@
|
|
|
1324
1333
|
// May throw (if detached)
|
|
1325
1334
|
// Get a copy of the bytes held by the buffer source
|
|
1326
1335
|
// https://heycam.github.io/webidl/#ref-for-dfn-get-buffer-source-copy-2
|
|
1327
|
-
var octets = getCopyBytesHeldByBufferSource(
|
|
1336
|
+
var octets = getCopyBytesHeldByBufferSource(/** @type {BufferSource} */input);
|
|
1328
1337
|
return {
|
|
1329
1338
|
type: 'binary',
|
|
1330
1339
|
value: octets
|
|
@@ -1561,7 +1570,7 @@
|
|
|
1561
1570
|
value = /** @type {File} */value[idntfr];
|
|
1562
1571
|
break;
|
|
1563
1572
|
case 'lastModifiedDate':
|
|
1564
|
-
value = new Date(
|
|
1573
|
+
value = new Date(/** @type {File} */value.lastModified);
|
|
1565
1574
|
break;
|
|
1566
1575
|
}
|
|
1567
1576
|
} else if (!isObj(value) || !Object.hasOwn(value, idntfr)) {
|
|
@@ -1595,7 +1604,7 @@
|
|
|
1595
1604
|
}
|
|
1596
1605
|
value = value[identifier];
|
|
1597
1606
|
});
|
|
1598
|
-
value[(
|
|
1607
|
+
value[(/** @type {string} */last)] = key; // key is already a `keyValue` in our processing so no need to convert
|
|
1599
1608
|
}
|
|
1600
1609
|
|
|
1601
1610
|
/**
|
|
@@ -1767,7 +1776,6 @@
|
|
|
1767
1776
|
return null;
|
|
1768
1777
|
}
|
|
1769
1778
|
// array, date, number, string, binary (should already have detected "invalid")
|
|
1770
|
-
// @ts-expect-error Argument may be ignored
|
|
1771
1779
|
return types[getKeyType(key)].encode(key, inArray);
|
|
1772
1780
|
}
|
|
1773
1781
|
|
|
@@ -1893,7 +1901,7 @@
|
|
|
1893
1901
|
getCurrentNumber(tx, store, function (key) {
|
|
1894
1902
|
if (key > MAX_ALLOWED_CURRENT_NUMBER) {
|
|
1895
1903
|
// 2 ^ 53 (See <https://github.com/w3c/IndexedDB/issues/147>)
|
|
1896
|
-
cb('failure');
|
|
1904
|
+
cb('failure');
|
|
1897
1905
|
return;
|
|
1898
1906
|
}
|
|
1899
1907
|
// Increment current number by 1 (we cannot leverage SQLite's
|