indexeddbshim 17.0.0 → 17.2.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 +62 -0
- package/badges/licenses-badge-dev.svg +1 -1
- package/badges/licenses-badge.svg +1 -1
- package/dist/CFG.d.ts +1 -0
- package/dist/CFG.d.ts.map +1 -1
- package/dist/DOMException.d.ts.map +1 -1
- package/dist/IDBCursor.d.ts +25 -18
- package/dist/IDBCursor.d.ts.map +1 -1
- package/dist/IDBFactory.d.ts +19 -19
- package/dist/IDBFactory.d.ts.map +1 -1
- package/dist/IDBIndex.d.ts.map +1 -1
- package/dist/IDBKeyRange.d.ts +5 -5
- package/dist/IDBKeyRange.d.ts.map +1 -1
- package/dist/IDBTransaction.d.ts +24 -3
- package/dist/IDBTransaction.d.ts.map +1 -1
- package/dist/Key.d.ts +41 -41
- package/dist/Key.d.ts.map +1 -1
- package/dist/indexeddbshim-Key.js +88 -69
- 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 +1682 -1056
- package/dist/indexeddbshim-UnicodeIdentifiers-node.cjs.map +1 -1
- package/dist/indexeddbshim-UnicodeIdentifiers.js +886 -663
- package/dist/indexeddbshim-UnicodeIdentifiers.js.map +1 -1
- package/dist/indexeddbshim-UnicodeIdentifiers.min.js +4 -4
- package/dist/indexeddbshim-UnicodeIdentifiers.min.js.map +1 -1
- package/dist/indexeddbshim-node.cjs +1682 -1056
- package/dist/indexeddbshim-node.cjs.map +1 -1
- package/dist/indexeddbshim-noninvasive.js +886 -663
- package/dist/indexeddbshim-noninvasive.js.map +1 -1
- package/dist/indexeddbshim-noninvasive.min.js +4 -4
- package/dist/indexeddbshim-noninvasive.min.js.map +1 -1
- package/dist/indexeddbshim.js +890 -660
- package/dist/indexeddbshim.js.map +1 -1
- package/dist/indexeddbshim.min.js +4 -4
- package/dist/indexeddbshim.min.js.map +1 -1
- package/dist/node-UnicodeIdentifiers.d.ts.map +1 -1
- package/dist/node.d.ts.map +1 -1
- package/dist/nodeSQLiteDatabase.d.ts +65 -0
- package/dist/nodeSQLiteDatabase.d.ts.map +1 -0
- package/dist/nodeWebSQL.d.ts.map +1 -1
- package/dist/util.d.ts +5 -0
- package/dist/util.d.ts.map +1 -1
- package/package.json +22 -18
- package/src/CFG.js +3 -0
- package/src/DOMException.js +10 -10
- package/src/IDBCursor.js +152 -102
- package/src/IDBFactory.js +30 -26
- package/src/IDBIndex.js +1 -2
- package/src/IDBKeyRange.js +5 -5
- package/src/IDBTransaction.js +35 -5
- package/src/Key.js +63 -55
- package/src/node-UnicodeIdentifiers.js +5 -1
- package/src/node.js +5 -1
- package/src/nodeSQLiteDatabase.js +174 -0
- package/src/nodeWebSQL.js +1 -3
- package/src/util.js +62 -3
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! indexeddbshim - v17.
|
|
1
|
+
/*! indexeddbshim - v17.2.0 - 8/18/2026 */
|
|
2
2
|
|
|
3
3
|
(function (global, factory) {
|
|
4
4
|
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
|
|
@@ -101,6 +101,13 @@
|
|
|
101
101
|
function _slicedToArray(r, e) {
|
|
102
102
|
return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest();
|
|
103
103
|
}
|
|
104
|
+
function _taggedTemplateLiteral(e, t) {
|
|
105
|
+
return t || (t = e.slice(0)), Object.freeze(Object.defineProperties(e, {
|
|
106
|
+
raw: {
|
|
107
|
+
value: Object.freeze(t)
|
|
108
|
+
}
|
|
109
|
+
}));
|
|
110
|
+
}
|
|
104
111
|
function _toConsumableArray(r) {
|
|
105
112
|
return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread();
|
|
106
113
|
}
|
|
@@ -165,6 +172,7 @@
|
|
|
165
172
|
* sqlBusyTimeout: number,
|
|
166
173
|
* sqlTrace: () => void,
|
|
167
174
|
* sqlProfile: () => void,
|
|
175
|
+
* escapeNULForSQLiteStatements: boolean,
|
|
168
176
|
* createIndexes: boolean
|
|
169
177
|
* }} ConfigValues
|
|
170
178
|
*/
|
|
@@ -319,8 +327,8 @@
|
|
|
319
327
|
// Callback not used by default
|
|
320
328
|
'sqlProfile',
|
|
321
329
|
// Callback not used by default
|
|
322
|
-
|
|
323
|
-
'createIndexes'].forEach(function (prop) {
|
|
330
|
+
// Defaults to true except in Node builds where we can preserve literal NUL with better-sqlite3
|
|
331
|
+
'escapeNULForSQLiteStatements', 'createIndexes'].forEach(function (prop) {
|
|
324
332
|
/** @type {(val: any) => void} */
|
|
325
333
|
var validator;
|
|
326
334
|
if (Array.isArray(prop)) {
|
|
@@ -630,11 +638,11 @@
|
|
|
630
638
|
// eslint-disable-next-line @stylistic/operator-linebreak -- Need JSDoc
|
|
631
639
|
?
|
|
632
640
|
/**
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
641
|
+
* @param {string} name
|
|
642
|
+
* @param {string} message
|
|
643
|
+
* @param {ErrorLike} [error]
|
|
644
|
+
* @returns {DOMException}
|
|
645
|
+
*/
|
|
638
646
|
function (name, message, error) {
|
|
639
647
|
logError(name, message, error);
|
|
640
648
|
return createNativeDOMException(name, message);
|
|
@@ -642,11 +650,11 @@
|
|
|
642
650
|
// eslint-disable-next-line @stylistic/operator-linebreak -- Need JSDoc
|
|
643
651
|
:
|
|
644
652
|
/**
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
653
|
+
* @param {string} name
|
|
654
|
+
* @param {string} message
|
|
655
|
+
* @param {ErrorLike} [error]
|
|
656
|
+
* @returns {Error}
|
|
657
|
+
*/
|
|
650
658
|
function (name, message, error) {
|
|
651
659
|
logError(name, message, error);
|
|
652
660
|
return createNonNativeDOMException(name, message);
|
|
@@ -678,7 +686,8 @@
|
|
|
678
686
|
* @returns {string}
|
|
679
687
|
*/
|
|
680
688
|
function escapeSQLiteStatement(arg) {
|
|
681
|
-
|
|
689
|
+
var escaped = arg.replaceAll('^', '^^');
|
|
690
|
+
return escapeUnmatchedSurrogates(CFG.escapeNULForSQLiteStatements === false ? escaped : escaped.replaceAll('\0', '^0'));
|
|
682
691
|
}
|
|
683
692
|
|
|
684
693
|
/**
|
|
@@ -772,6 +781,8 @@
|
|
|
772
781
|
return result;
|
|
773
782
|
}
|
|
774
783
|
|
|
784
|
+
var _templateObject, _templateObject2;
|
|
785
|
+
|
|
775
786
|
/**
|
|
776
787
|
* @typedef {NodeJS.TypedArray|DataView} ArrayBufferView
|
|
777
788
|
*/
|
|
@@ -801,14 +812,14 @@
|
|
|
801
812
|
*/
|
|
802
813
|
|
|
803
814
|
/**
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
815
|
+
* @typedef {object} KeyValueObject
|
|
816
|
+
* @property {KeyType|"NaN"|"null"|"undefined"|"boolean"|"object"|"symbol"|
|
|
817
|
+
* "function"|"bigint"} type If not `KeyType`, indicates invalid value
|
|
818
|
+
* @property {Value} [value]
|
|
819
|
+
* @property {boolean} [invalid]
|
|
820
|
+
* @property {string} [message]
|
|
821
|
+
* @todo Specify acceptable `value` more precisely
|
|
822
|
+
*/
|
|
812
823
|
|
|
813
824
|
/**
|
|
814
825
|
* @typedef {number|string|Date|ArrayBuffer} ValueTypePrimitive
|
|
@@ -1047,14 +1058,22 @@
|
|
|
1047
1058
|
_iterator.f();
|
|
1048
1059
|
}
|
|
1049
1060
|
encoded.push(keyTypeToEncodedChar.invalid + '-'); // append an extra item, so empty arrays sort correctly
|
|
1050
|
-
|
|
1061
|
+
var encodedKey = JSON.stringify(encoded);
|
|
1062
|
+
if (CFG.escapeNULForSQLiteStatements === false) {
|
|
1063
|
+
encodedKey = encodedKey.replaceAll(String.raw(_templateObject || (_templateObject = _taggedTemplateLiteral(["\0"], ["\\u0000"]))), '\0');
|
|
1064
|
+
}
|
|
1065
|
+
return keyTypeToEncodedChar.array + '-' + encodedKey;
|
|
1051
1066
|
},
|
|
1052
1067
|
/**
|
|
1053
1068
|
* @param {string} key
|
|
1054
1069
|
* @returns {ValueTypeArray}
|
|
1055
1070
|
*/
|
|
1056
1071
|
decode: function decode(key) {
|
|
1057
|
-
var
|
|
1072
|
+
var decodedKey = key.slice(2);
|
|
1073
|
+
if (CFG.escapeNULForSQLiteStatements === false) {
|
|
1074
|
+
decodedKey = decodedKey.replaceAll('\0', String.raw(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\0"], ["\\u0000"]))));
|
|
1075
|
+
}
|
|
1076
|
+
var decoded = JSON.parse(decodedKey);
|
|
1058
1077
|
decoded.pop(); // remove the extra item
|
|
1059
1078
|
for (var i = 0; i < decoded.length; i++) {
|
|
1060
1079
|
var item = decoded[i];
|
|
@@ -1240,10 +1259,10 @@
|
|
|
1240
1259
|
}
|
|
1241
1260
|
|
|
1242
1261
|
/**
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1262
|
+
* Currently not in use.
|
|
1263
|
+
* @param {Value} input
|
|
1264
|
+
* @returns {KeyValueObject}
|
|
1265
|
+
*/
|
|
1247
1266
|
function convertValueToMultiEntryKey(input) {
|
|
1248
1267
|
return convertValueToKeyValueDecoded(input, null, true, true);
|
|
1249
1268
|
}
|
|
@@ -1278,17 +1297,17 @@
|
|
|
1278
1297
|
}
|
|
1279
1298
|
|
|
1280
1299
|
/**
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1300
|
+
* Shortcut utility to avoid returning full keys from `convertValueToKey`
|
|
1301
|
+
* and subsequent need to process in calling code unless `fullKeys` is
|
|
1302
|
+
* set; may throw.
|
|
1303
|
+
* @param {Value} input
|
|
1304
|
+
* @param {Value[]|null} [seen]
|
|
1305
|
+
* @param {boolean} [multiEntry]
|
|
1306
|
+
* @param {boolean} [fullKeys]
|
|
1307
|
+
* @throws {TypeError} See `getCopyBytesHeldByBufferSource`
|
|
1308
|
+
* @todo Document other allowable `input`
|
|
1309
|
+
* @returns {KeyValueObject}
|
|
1310
|
+
*/
|
|
1292
1311
|
function convertValueToKeyValueDecoded(input, seen, multiEntry, fullKeys) {
|
|
1293
1312
|
seen || (seen = []);
|
|
1294
1313
|
if (seen.includes(input)) {
|
|
@@ -1444,12 +1463,12 @@
|
|
|
1444
1463
|
}
|
|
1445
1464
|
|
|
1446
1465
|
/**
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1466
|
+
* An internal utility.
|
|
1467
|
+
* @param {Value} input
|
|
1468
|
+
* @param {Value[]|null|undefined} [seen]
|
|
1469
|
+
* @throws {DOMException} `DataError`
|
|
1470
|
+
* @returns {KeyValueObject}
|
|
1471
|
+
*/
|
|
1453
1472
|
function convertValueToKeyRethrowingAndIfInvalid(input, seen) {
|
|
1454
1473
|
var key = convertValueToKey(input, seen);
|
|
1455
1474
|
if (key.invalid) {
|
|
@@ -1470,26 +1489,26 @@
|
|
|
1470
1489
|
return extractKeyValueDecodedFromValueUsingKeyPath(value, keyPath, multiEntry, true);
|
|
1471
1490
|
}
|
|
1472
1491
|
/**
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1492
|
+
* Not currently in use.
|
|
1493
|
+
* @param {Value} value
|
|
1494
|
+
* @param {KeyPath} keyPath
|
|
1495
|
+
* @param {boolean} multiEntry
|
|
1496
|
+
* @returns {KeyPathEvaluateValue}
|
|
1497
|
+
*/
|
|
1479
1498
|
function evaluateKeyPathOnValue(value, keyPath, multiEntry) {
|
|
1480
1499
|
return evaluateKeyPathOnValueToDecodedValue(value, keyPath);
|
|
1481
1500
|
}
|
|
1482
1501
|
|
|
1483
1502
|
/**
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1503
|
+
* May throw, return `{failure: true}` (e.g., non-object on keyPath resolution)
|
|
1504
|
+
* or `{invalid: true}` (e.g., `NaN`).
|
|
1505
|
+
* @param {Value} value
|
|
1506
|
+
* @param {KeyPath} keyPath
|
|
1507
|
+
* @param {boolean} [multiEntry]
|
|
1508
|
+
* @param {boolean} [fullKeys]
|
|
1509
|
+
* @returns {KeyValueObject|KeyPathEvaluateValue}
|
|
1510
|
+
* @todo Document other possible return?
|
|
1511
|
+
*/
|
|
1493
1512
|
function extractKeyValueDecodedFromValueUsingKeyPath(value, keyPath, multiEntry, fullKeys) {
|
|
1494
1513
|
var r = evaluateKeyPathOnValueToDecodedValue(value, keyPath);
|
|
1495
1514
|
if (r.failure) {
|
|
@@ -1719,11 +1738,11 @@
|
|
|
1719
1738
|
}
|
|
1720
1739
|
|
|
1721
1740
|
/**
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
|
|
1741
|
+
* Not currently in use but keeping for spec parity.
|
|
1742
|
+
* @param {Key} key
|
|
1743
|
+
* @throws {Error} Upon a "bad key"
|
|
1744
|
+
* @returns {ValueType}
|
|
1745
|
+
*/
|
|
1727
1746
|
function convertKeyToValue(key) {
|
|
1728
1747
|
var type = key.type,
|
|
1729
1748
|
value = key.value;
|
|
@@ -1815,10 +1834,10 @@
|
|
|
1815
1834
|
*/
|
|
1816
1835
|
|
|
1817
1836
|
/**
|
|
1818
|
-
|
|
1819
|
-
|
|
1820
|
-
|
|
1821
|
-
|
|
1837
|
+
* @callback SQLFailureCallback
|
|
1838
|
+
* @param {DOMException|Error} exception
|
|
1839
|
+
* @returns {void}
|
|
1840
|
+
*/
|
|
1822
1841
|
|
|
1823
1842
|
/**
|
|
1824
1843
|
*
|