indexeddbshim 13.0.0-pre.1 → 13.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.
- package/README.md +1 -1
- package/badges/licenses-badge-dev.svg +1 -1
- package/dist/indexeddbshim-Key.js +90 -82
- package/dist/indexeddbshim-Key.js.map +1 -1
- package/dist/indexeddbshim-Key.min.js +2 -2
- package/dist/indexeddbshim-Key.min.js.map +1 -1
- package/dist/indexeddbshim-UnicodeIdentifiers-node.cjs +824 -487
- package/dist/indexeddbshim-UnicodeIdentifiers-node.cjs.map +1 -1
- package/dist/indexeddbshim-UnicodeIdentifiers.js +947 -774
- 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 +824 -487
- package/dist/indexeddbshim-node.cjs.map +1 -1
- package/dist/indexeddbshim-noninvasive.js +947 -774
- 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 +947 -774
- package/dist/indexeddbshim.js.map +1 -1
- package/dist/indexeddbshim.min.js +2 -2
- package/dist/indexeddbshim.min.js.map +1 -1
- package/index.html +1 -1
- package/package.json +35 -34
- package/src/DOMException.js +3 -4
- package/src/DOMStringList.js +1 -1
- package/src/IDBCursor.js +19 -17
- package/src/IDBDatabase.js +1 -0
- package/src/IDBFactory.js +23 -16
- package/src/IDBIndex.js +17 -23
- package/src/IDBKeyRange.js +4 -4
- package/src/IDBObjectStore.js +29 -26
- package/src/IDBTransaction.js +7 -8
- package/src/Key.d.ts +1 -0
- package/src/Key.js +11 -12
- package/src/setGlobalVars.js +3 -1
- package/src/util.js +1 -0
package/README.md
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
<svg xmlns="http://www.w3.org/2000/svg" width="
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="754" height="176"><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 0h88v176H0z"/><path fill="#006400" d="M88 0h183v176H88z"/><path fill="green" d="M271 0h266v176H271z"/><path fill="#cc0" d="M537 0h108v176H537z"/><path fill="#a9a9a9" d="M645 0h109v176H645z"/><path fill="url(#smooth)" d="M0 0h754v176H0z"/></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="93.5" y="87">4. Unlicense</text><text class="high" x="93" y="86">4. Unlicense</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. (Unlicense OR Apache-2.0)</text><text class="high" x="276" y="62">3. (Unlicense OR Apache-2.0)</text><text class="shadow" x="276.5" y="75">4. Apache-2.0</text><text class="high" x="276" y="74">4. Apache-2.0</text><text class="shadow" x="276.5" y="87">5. BSD-2-Clause</text><text class="high" x="276" y="86">5. BSD-2-Clause</text><text class="shadow" x="276.5" y="99">6. BSD-3-Clause</text><text class="high" x="276" y="98">6. BSD-3-Clause</text><text class="shadow" x="276.5" y="111">7. BlueOak-1.0.0</text><text class="high" x="276" y="110">7. BlueOak-1.0.0</text><text class="shadow" x="276.5" y="123">8. CC-BY-3.0</text><text class="high" x="276" y="122">8. CC-BY-3.0</text><text class="shadow" x="276.5" y="135">9. CC-BY-4.0</text><text class="high" x="276" y="134">9. CC-BY-4.0</text><text class="shadow" x="276.5" y="147">10. ISC</text><text class="high" x="276" y="146">10. ISC</text><text class="shadow" x="276.5" y="159">11. MIT</text><text class="high" x="276" y="158">11. MIT</text><text class="shadow" x="276.5" y="171">12. WTFPL</text><text class="high" x="276" y="170">12. 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></g></svg>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! indexeddbshim -
|
|
1
|
+
/*! indexeddbshim - v13.0.0 - 12/7/2023 */
|
|
2
2
|
|
|
3
3
|
(function (global, factory) {
|
|
4
4
|
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
|
|
@@ -6,41 +6,41 @@
|
|
|
6
6
|
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.IDBKeyUtils = {}));
|
|
7
7
|
})(this, (function (exports) { 'use strict';
|
|
8
8
|
|
|
9
|
-
function _iterableToArrayLimit(
|
|
10
|
-
var
|
|
11
|
-
if (null !=
|
|
12
|
-
var
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
9
|
+
function _iterableToArrayLimit(r, l) {
|
|
10
|
+
var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
|
|
11
|
+
if (null != t) {
|
|
12
|
+
var e,
|
|
13
|
+
n,
|
|
14
|
+
i,
|
|
15
|
+
u,
|
|
16
|
+
a = [],
|
|
17
|
+
f = !0,
|
|
18
|
+
o = !1;
|
|
19
19
|
try {
|
|
20
|
-
if (
|
|
21
|
-
if (Object(
|
|
22
|
-
|
|
23
|
-
} else for (; !(
|
|
24
|
-
} catch (
|
|
25
|
-
|
|
20
|
+
if (i = (t = t.call(r)).next, 0 === l) {
|
|
21
|
+
if (Object(t) !== t) return;
|
|
22
|
+
f = !1;
|
|
23
|
+
} else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);
|
|
24
|
+
} catch (r) {
|
|
25
|
+
o = !0, n = r;
|
|
26
26
|
} finally {
|
|
27
27
|
try {
|
|
28
|
-
if (!
|
|
28
|
+
if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return;
|
|
29
29
|
} finally {
|
|
30
|
-
if (
|
|
30
|
+
if (o) throw n;
|
|
31
31
|
}
|
|
32
32
|
}
|
|
33
|
-
return
|
|
33
|
+
return a;
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
|
-
function _typeof(
|
|
36
|
+
function _typeof(o) {
|
|
37
37
|
"@babel/helpers - typeof";
|
|
38
38
|
|
|
39
|
-
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (
|
|
40
|
-
return typeof
|
|
41
|
-
} : function (
|
|
42
|
-
return
|
|
43
|
-
}, _typeof(
|
|
39
|
+
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
|
|
40
|
+
return typeof o;
|
|
41
|
+
} : function (o) {
|
|
42
|
+
return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
|
|
43
|
+
}, _typeof(o);
|
|
44
44
|
}
|
|
45
45
|
function _slicedToArray(arr, i) {
|
|
46
46
|
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
|
|
@@ -463,7 +463,7 @@
|
|
|
463
463
|
function DOMException(message, name) {
|
|
464
464
|
// const err = Error.prototype.constructor.call(this, message); // Any use to this? Won't set this.message
|
|
465
465
|
this[Symbol.toStringTag] = 'DOMException';
|
|
466
|
-
this._code = name in codes ? codes[/** @type {Code} */name] : legacyCodes[/** @type {LegacyCode} */name] || 0;
|
|
466
|
+
this._code = name in codes ? codes[( /** @type {Code} */name)] : legacyCodes[( /** @type {LegacyCode} */name)] || 0;
|
|
467
467
|
this._name = name || 'Error';
|
|
468
468
|
// We avoid `String()` in this next line as it converts Symbols
|
|
469
469
|
this._message = message === undefined ? '' : '' + message; // eslint-disable-line no-implicit-coercion
|
|
@@ -600,10 +600,12 @@
|
|
|
600
600
|
*/
|
|
601
601
|
function logError(name, message, error) {
|
|
602
602
|
if (CFG.DEBUG) {
|
|
603
|
-
var msg = error && _typeof(error) === 'object' && error.message ? error.message : /** @type {string} */error;
|
|
603
|
+
var msg = error && _typeof(error) === 'object' && error.message ? error.message : ( /** @type {string} */error);
|
|
604
604
|
var method = typeof console.error === 'function' ? 'error' : 'log';
|
|
605
605
|
console[method](name + ': ' + message + '. ' + (msg || ''));
|
|
606
|
-
|
|
606
|
+
if (console.trace) {
|
|
607
|
+
console.trace();
|
|
608
|
+
}
|
|
607
609
|
}
|
|
608
610
|
}
|
|
609
611
|
|
|
@@ -632,7 +634,7 @@
|
|
|
632
634
|
}
|
|
633
635
|
} catch (e) {}
|
|
634
636
|
var createDOMException = useNativeDOMException
|
|
635
|
-
// eslint-disable-next-line operator-linebreak -- Need JSDoc
|
|
637
|
+
// eslint-disable-next-line @stylistic/operator-linebreak -- Need JSDoc
|
|
636
638
|
?
|
|
637
639
|
/**
|
|
638
640
|
* @param {string} name
|
|
@@ -644,7 +646,7 @@
|
|
|
644
646
|
logError(name, message, error);
|
|
645
647
|
return createNativeDOMException(name, message);
|
|
646
648
|
}
|
|
647
|
-
// eslint-disable-next-line operator-linebreak -- Need JSDoc
|
|
649
|
+
// eslint-disable-next-line @stylistic/operator-linebreak -- Need JSDoc
|
|
648
650
|
:
|
|
649
651
|
/**
|
|
650
652
|
* @param {string} name
|
|
@@ -865,17 +867,15 @@
|
|
|
865
867
|
var types = {
|
|
866
868
|
invalid: {
|
|
867
869
|
/**
|
|
868
|
-
* @param {AnyValue} _key
|
|
869
870
|
* @returns {string}
|
|
870
871
|
*/
|
|
871
|
-
encode: function encode(
|
|
872
|
+
encode: function encode() {
|
|
872
873
|
return keyTypeToEncodedChar.invalid + '-';
|
|
873
874
|
},
|
|
874
875
|
/**
|
|
875
|
-
* @param {string} _key
|
|
876
876
|
* @returns {undefined}
|
|
877
877
|
*/
|
|
878
|
-
decode: function decode(
|
|
878
|
+
decode: function decode() {
|
|
879
879
|
return undefined;
|
|
880
880
|
}
|
|
881
881
|
},
|
|
@@ -1213,11 +1213,17 @@
|
|
|
1213
1213
|
* @returns {KeyType|"invalid"}
|
|
1214
1214
|
*/
|
|
1215
1215
|
function getKeyType(key) {
|
|
1216
|
-
if (Array.isArray(key))
|
|
1217
|
-
|
|
1218
|
-
|
|
1216
|
+
if (Array.isArray(key)) {
|
|
1217
|
+
return 'array';
|
|
1218
|
+
}
|
|
1219
|
+
if (isDate(key)) {
|
|
1220
|
+
return 'date';
|
|
1221
|
+
}
|
|
1222
|
+
if (isBinary(key)) {
|
|
1223
|
+
return 'binary';
|
|
1224
|
+
}
|
|
1219
1225
|
var keyType = _typeof(key);
|
|
1220
|
-
return ['string', 'number'].includes(keyType) ? /** @type {"string"|"number"} */keyType : 'invalid';
|
|
1226
|
+
return ['string', 'number'].includes(keyType) ? ( /** @type {"string"|"number"} */keyType) : 'invalid';
|
|
1221
1227
|
}
|
|
1222
1228
|
|
|
1223
1229
|
/**
|
|
@@ -1314,13 +1320,11 @@
|
|
|
1314
1320
|
value: 0
|
|
1315
1321
|
};
|
|
1316
1322
|
}
|
|
1317
|
-
return
|
|
1318
|
-
);
|
|
1323
|
+
return /** @type {{type: KeyType; value: Value}} */ret;
|
|
1319
1324
|
}
|
|
1320
1325
|
case 'string':
|
|
1321
1326
|
{
|
|
1322
|
-
return
|
|
1323
|
-
);
|
|
1327
|
+
return /** @type {{type: KeyType; value: Value}} */ret;
|
|
1324
1328
|
}
|
|
1325
1329
|
case 'binary':
|
|
1326
1330
|
{
|
|
@@ -1343,48 +1347,49 @@
|
|
|
1343
1347
|
/** @type {(KeyValueObject|Value)[]} */
|
|
1344
1348
|
var keys = [];
|
|
1345
1349
|
var _loop = function _loop() {
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
return {
|
|
1349
|
-
v: {
|
|
1350
|
-
type: type,
|
|
1351
|
-
invalid: true,
|
|
1352
|
-
message: 'Does not have own index property'
|
|
1353
|
-
}
|
|
1354
|
-
};
|
|
1355
|
-
}
|
|
1356
|
-
try {
|
|
1357
|
-
var entry = arr[i];
|
|
1358
|
-
var key = convertValueToKeyValueDecoded(entry, seen, false, fullKeys); // Though steps do not list rethrowing, the next is returnifabrupt when not multiEntry
|
|
1359
|
-
if (key.invalid) {
|
|
1360
|
-
if (multiEntry) {
|
|
1361
|
-
return "continue";
|
|
1362
|
-
}
|
|
1350
|
+
// We cannot iterate here with array extras as we must ensure sparse arrays are invalidated
|
|
1351
|
+
if (!multiEntry && !Object.hasOwn(arr, i)) {
|
|
1363
1352
|
return {
|
|
1364
1353
|
v: {
|
|
1365
1354
|
type: type,
|
|
1366
1355
|
invalid: true,
|
|
1367
|
-
message: '
|
|
1356
|
+
message: 'Does not have own index property'
|
|
1368
1357
|
}
|
|
1369
1358
|
};
|
|
1370
1359
|
}
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1360
|
+
try {
|
|
1361
|
+
var entry = arr[i];
|
|
1362
|
+
var key = convertValueToKeyValueDecoded(entry, seen, false, fullKeys); // Though steps do not list rethrowing, the next is returnifabrupt when not multiEntry
|
|
1363
|
+
if (key.invalid) {
|
|
1364
|
+
if (multiEntry) {
|
|
1365
|
+
return 0; // continue
|
|
1366
|
+
}
|
|
1367
|
+
return {
|
|
1368
|
+
v: {
|
|
1369
|
+
type: type,
|
|
1370
|
+
invalid: true,
|
|
1371
|
+
message: 'Bad array entry value-to-key conversion'
|
|
1372
|
+
}
|
|
1373
|
+
};
|
|
1374
|
+
}
|
|
1375
|
+
if (!multiEntry || !fullKeys && keys.every(function (k) {
|
|
1376
|
+
return cmp(k, key.value) !== 0;
|
|
1377
|
+
}) || fullKeys && keys.every(function (k) {
|
|
1378
|
+
return cmp(k, key) !== 0;
|
|
1379
|
+
})) {
|
|
1380
|
+
keys.push(fullKeys ? key : key.value);
|
|
1381
|
+
}
|
|
1382
|
+
} catch (err) {
|
|
1383
|
+
if (!multiEntry) {
|
|
1384
|
+
throw err;
|
|
1385
|
+
}
|
|
1381
1386
|
}
|
|
1382
|
-
}
|
|
1383
|
-
|
|
1387
|
+
},
|
|
1388
|
+
_ret;
|
|
1384
1389
|
for (var i = 0; i < len; i++) {
|
|
1385
|
-
|
|
1386
|
-
if (_ret ===
|
|
1387
|
-
if (
|
|
1390
|
+
_ret = _loop();
|
|
1391
|
+
if (_ret === 0) continue;
|
|
1392
|
+
if (_ret) return _ret.v;
|
|
1388
1393
|
}
|
|
1389
1394
|
return {
|
|
1390
1395
|
type: type,
|
|
@@ -1546,7 +1551,7 @@
|
|
|
1546
1551
|
};
|
|
1547
1552
|
}
|
|
1548
1553
|
var identifiers = keyPath.split('.');
|
|
1549
|
-
return identifiers.some(function (idntfr
|
|
1554
|
+
return identifiers.some(function (idntfr) {
|
|
1550
1555
|
if (idntfr === 'length' && (typeof value === 'string' || Array.isArray(value))) {
|
|
1551
1556
|
value = value.length;
|
|
1552
1557
|
} else if (isBlob(value)) {
|
|
@@ -1597,7 +1602,7 @@
|
|
|
1597
1602
|
}
|
|
1598
1603
|
value = value[identifier];
|
|
1599
1604
|
});
|
|
1600
|
-
value[/** @type {string} */last] = key; // key is already a `keyValue` in our processing so no need to convert
|
|
1605
|
+
value[( /** @type {string} */last)] = key; // key is already a `keyValue` in our processing so no need to convert
|
|
1601
1606
|
}
|
|
1602
1607
|
|
|
1603
1608
|
/**
|
|
@@ -1769,6 +1774,7 @@
|
|
|
1769
1774
|
return null;
|
|
1770
1775
|
}
|
|
1771
1776
|
// array, date, number, string, binary (should already have detected "invalid")
|
|
1777
|
+
// @ts-expect-error Argument may be ignored
|
|
1772
1778
|
return types[getKeyType(key)].encode(key, inArray);
|
|
1773
1779
|
}
|
|
1774
1780
|
|
|
@@ -1830,7 +1836,7 @@
|
|
|
1830
1836
|
}
|
|
1831
1837
|
}, function (tx, error) {
|
|
1832
1838
|
sqlFailCb(createDOMException('DataError', 'Could not get the auto increment value for key', error));
|
|
1833
|
-
return
|
|
1839
|
+
return false;
|
|
1834
1840
|
});
|
|
1835
1841
|
}
|
|
1836
1842
|
|
|
@@ -1846,12 +1852,14 @@
|
|
|
1846
1852
|
function assignCurrentNumber(tx, store, num, successCb, failCb) {
|
|
1847
1853
|
var sql = 'UPDATE __sys__ SET "currNum" = ? WHERE "name" = ?';
|
|
1848
1854
|
var sqlValues = [num, escapeSQLiteStatement(store.__currentName)];
|
|
1849
|
-
CFG.DEBUG
|
|
1850
|
-
|
|
1855
|
+
if (CFG.DEBUG) {
|
|
1856
|
+
console.log(sql, sqlValues);
|
|
1857
|
+
}
|
|
1858
|
+
tx.executeSql(sql, sqlValues, function () {
|
|
1851
1859
|
successCb(num);
|
|
1852
1860
|
}, function (tx, err) {
|
|
1853
1861
|
failCb(createDOMException('UnknownError', 'Could not set the auto increment value for key', err));
|
|
1854
|
-
return
|
|
1862
|
+
return false;
|
|
1855
1863
|
});
|
|
1856
1864
|
}
|
|
1857
1865
|
|