indexeddbshim 18.0.0 → 19.0.1
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/dist/DOMException.d.ts +3 -7
- package/dist/DOMException.d.ts.map +1 -1
- package/dist/DOMStringList.d.ts +1 -2
- package/dist/DOMStringList.d.ts.map +1 -1
- package/dist/IDBCursor.d.ts +100 -52
- package/dist/IDBCursor.d.ts.map +1 -1
- package/dist/IDBFactory.d.ts.map +1 -1
- package/dist/IDBIndex.d.ts +8 -7
- package/dist/IDBIndex.d.ts.map +1 -1
- package/dist/IDBKeyRange.d.ts +3 -3
- package/dist/IDBKeyRange.d.ts.map +1 -1
- package/dist/IDBObjectStore.d.ts +22 -22
- package/dist/IDBObjectStore.d.ts.map +1 -1
- package/dist/IDBRequest.d.ts +2 -2
- package/dist/IDBRequest.d.ts.map +1 -1
- package/dist/IDBTransaction.d.ts +13 -13
- package/dist/IDBTransaction.d.ts.map +1 -1
- package/dist/Key.d.ts +14 -15
- package/dist/Key.d.ts.map +1 -1
- package/dist/Sca.d.ts +2 -2
- package/dist/Sca.d.ts.map +1 -1
- package/dist/cmp.d.ts +3 -3
- package/dist/cmp.d.ts.map +1 -1
- package/dist/indexeddbshim-Key.js +36 -45
- 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 +229 -213
- package/dist/indexeddbshim-UnicodeIdentifiers-node.cjs.map +1 -1
- package/dist/indexeddbshim-UnicodeIdentifiers.js +226 -240
- package/dist/indexeddbshim-UnicodeIdentifiers.js.map +1 -1
- package/dist/indexeddbshim-UnicodeIdentifiers.min.js +3 -3
- package/dist/indexeddbshim-UnicodeIdentifiers.min.js.map +1 -1
- package/dist/indexeddbshim-node.cjs +229 -213
- package/dist/indexeddbshim-node.cjs.map +1 -1
- package/dist/indexeddbshim-noninvasive.js +226 -240
- package/dist/indexeddbshim-noninvasive.js.map +1 -1
- package/dist/indexeddbshim-noninvasive.min.js +3 -3
- package/dist/indexeddbshim-noninvasive.min.js.map +1 -1
- package/dist/indexeddbshim.js +226 -240
- package/dist/indexeddbshim.js.map +1 -1
- package/dist/indexeddbshim.min.js +3 -3
- package/dist/indexeddbshim.min.js.map +1 -1
- package/dist/nodeWebSQL.d.ts +2 -2
- package/dist/nodeWebSQL.d.ts.map +1 -1
- package/dist/setGlobalVars.d.ts +1 -2
- package/dist/setGlobalVars.d.ts.map +1 -1
- package/dist/util.d.ts +20 -22
- package/dist/util.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/CFG.js +1 -1
- package/src/DOMException.js +8 -10
- package/src/DOMStringList.js +6 -11
- package/src/Event.js +1 -4
- package/src/IDBCursor.js +95 -47
- package/src/IDBFactory.js +8 -5
- package/src/IDBIndex.js +10 -12
- package/src/IDBKeyRange.js +6 -5
- package/src/IDBObjectStore.js +37 -32
- package/src/IDBRequest.js +1 -1
- package/src/IDBTransaction.js +11 -11
- package/src/IDBVersionChangeEvent.js +1 -4
- package/src/Key.js +32 -31
- package/src/Sca.js +1 -1
- package/src/cmp.js +2 -2
- package/src/nodeWebSQL.js +5 -2
- package/src/setGlobalVars.js +8 -19
- package/src/util.js +19 -16
package/dist/indexeddbshim.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! indexeddbshim -
|
|
1
|
+
/*! indexeddbshim - v19.0.1 - 9/3/2026 */
|
|
2
2
|
|
|
3
3
|
(function (factory) {
|
|
4
4
|
typeof define === 'function' && define.amd ? define(factory) :
|
|
@@ -51,13 +51,6 @@
|
|
|
51
51
|
function _classCallCheck(a, n) {
|
|
52
52
|
if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function");
|
|
53
53
|
}
|
|
54
|
-
function _construct(t, e, r) {
|
|
55
|
-
if (_isNativeReflectConstruct()) return Reflect.construct.apply(null, arguments);
|
|
56
|
-
var o = [null];
|
|
57
|
-
o.push.apply(o, e);
|
|
58
|
-
var p = new (t.bind.apply(t, o))();
|
|
59
|
-
return p;
|
|
60
|
-
}
|
|
61
54
|
function _defineProperties(e, r) {
|
|
62
55
|
for (var t = 0; t < r.length; t++) {
|
|
63
56
|
var o = r[t];
|
|
@@ -1912,7 +1905,7 @@
|
|
|
1912
1905
|
// Callback not used by default
|
|
1913
1906
|
// Defaults to true except in Node builds where we can preserve literal NUL with better-sqlite3
|
|
1914
1907
|
'escapeNULForSQLiteStatements', 'sqlMemoryQuota', 'createIndexes'].forEach(function (prop) {
|
|
1915
|
-
/** @type {(val:
|
|
1908
|
+
/** @type {(val: ConfigValue) => void} */
|
|
1916
1909
|
var validator;
|
|
1917
1910
|
if (Array.isArray(prop)) {
|
|
1918
1911
|
var _prop = prop;
|
|
@@ -2133,9 +2126,11 @@
|
|
|
2133
2126
|
return base.replace(/[\/\\]+$/, '') + sep + name;
|
|
2134
2127
|
}
|
|
2135
2128
|
|
|
2129
|
+
/* eslint-disable jsdoc/valid-types -- Bug */
|
|
2136
2130
|
/**
|
|
2137
|
-
* @typedef {
|
|
2131
|
+
* @typedef {{[Symbol.hasInstance]: (value: unknown) => boolean}} AnyClass
|
|
2138
2132
|
*/
|
|
2133
|
+
/* eslint-enable jsdoc/valid-types -- Bug */
|
|
2139
2134
|
|
|
2140
2135
|
// Babel doesn't seem to provide a means of using the `instanceof` operator with Symbol.hasInstance (yet?)
|
|
2141
2136
|
/**
|
|
@@ -2159,7 +2154,7 @@
|
|
|
2159
2154
|
|
|
2160
2155
|
/**
|
|
2161
2156
|
*
|
|
2162
|
-
* @param {
|
|
2157
|
+
* @param {AnyValue} obj
|
|
2163
2158
|
* @returns {boolean}
|
|
2164
2159
|
*/
|
|
2165
2160
|
function isDate(obj) {
|
|
@@ -2168,7 +2163,7 @@
|
|
|
2168
2163
|
|
|
2169
2164
|
/**
|
|
2170
2165
|
*
|
|
2171
|
-
* @param {
|
|
2166
|
+
* @param {AnyValue} obj
|
|
2172
2167
|
* @returns {boolean}
|
|
2173
2168
|
*/
|
|
2174
2169
|
function isBlob(obj) {
|
|
@@ -2177,7 +2172,7 @@
|
|
|
2177
2172
|
|
|
2178
2173
|
/**
|
|
2179
2174
|
*
|
|
2180
|
-
* @param {
|
|
2175
|
+
* @param {AnyValue} obj
|
|
2181
2176
|
* @returns {boolean}
|
|
2182
2177
|
*/
|
|
2183
2178
|
function isFile(obj) {
|
|
@@ -2199,7 +2194,7 @@
|
|
|
2199
2194
|
/**
|
|
2200
2195
|
*
|
|
2201
2196
|
* @param {AnyValue} obj
|
|
2202
|
-
* @returns {
|
|
2197
|
+
* @returns {obj is Iterable<unknown>}
|
|
2203
2198
|
*/
|
|
2204
2199
|
function isIterable(obj) {
|
|
2205
2200
|
return isObj(obj) &&
|
|
@@ -2245,9 +2240,7 @@
|
|
|
2245
2240
|
|
|
2246
2241
|
/**
|
|
2247
2242
|
*
|
|
2248
|
-
* @param {object
|
|
2249
|
-
* [key: string]: any
|
|
2250
|
-
* }} obj
|
|
2243
|
+
* @param {object} obj
|
|
2251
2244
|
* @param {string[]} listeners
|
|
2252
2245
|
* @returns {void}
|
|
2253
2246
|
*/
|
|
@@ -2255,9 +2248,9 @@
|
|
|
2255
2248
|
listeners = typeof listeners === 'string' ? [listeners] : listeners;
|
|
2256
2249
|
listeners.forEach(function (listener) {
|
|
2257
2250
|
var o = _defineAccessor("set", _defineAccessor("get", {}, listener, function () {
|
|
2258
|
-
return obj
|
|
2251
|
+
return Reflect.get(obj, '__' + listener);
|
|
2259
2252
|
}), listener, function (val) {
|
|
2260
|
-
obj
|
|
2253
|
+
Reflect.set(obj, '__' + listener, val);
|
|
2261
2254
|
});
|
|
2262
2255
|
var desc = /** @type {PropertyDescriptor} */
|
|
2263
2256
|
Object.getOwnPropertyDescriptor(o, listener);
|
|
@@ -2266,7 +2259,7 @@
|
|
|
2266
2259
|
Object.defineProperty(obj, listener, desc);
|
|
2267
2260
|
});
|
|
2268
2261
|
listeners.forEach(function (l) {
|
|
2269
|
-
obj
|
|
2262
|
+
Reflect.set(obj, l, null);
|
|
2270
2263
|
});
|
|
2271
2264
|
}
|
|
2272
2265
|
|
|
@@ -2275,7 +2268,7 @@
|
|
|
2275
2268
|
* @param {object} obj
|
|
2276
2269
|
* @param {string|string[]} props
|
|
2277
2270
|
* @param {null|{
|
|
2278
|
-
* [key: string]:
|
|
2271
|
+
* [key: string]: unknown
|
|
2279
2272
|
* }} getter
|
|
2280
2273
|
* @returns {void}
|
|
2281
2274
|
*/
|
|
@@ -2411,7 +2404,7 @@
|
|
|
2411
2404
|
}
|
|
2412
2405
|
|
|
2413
2406
|
/**
|
|
2414
|
-
* @typedef {
|
|
2407
|
+
* @typedef {unknown} AnyValue
|
|
2415
2408
|
*/
|
|
2416
2409
|
|
|
2417
2410
|
/**
|
|
@@ -2429,8 +2422,11 @@
|
|
|
2429
2422
|
*/
|
|
2430
2423
|
function ToString(o) {
|
|
2431
2424
|
// Todo: See `es-abstract/es7`
|
|
2432
|
-
// `String()` will not throw with Symbols
|
|
2433
|
-
|
|
2425
|
+
// `String()` will not throw with Symbols, but the unchecked `+ ''`
|
|
2426
|
+
// coercion deliberately does (Web IDL requires converting a symbol
|
|
2427
|
+
// to `DOMString` to throw a `TypeError`); the assertion only tells
|
|
2428
|
+
// the compiler to allow the coercion it cannot model.
|
|
2429
|
+
return '' + (/** @type {string} */o); // eslint-disable-line no-implicit-coercion -- Need to throw with symbols
|
|
2434
2430
|
}
|
|
2435
2431
|
|
|
2436
2432
|
/**
|
|
@@ -2537,12 +2533,9 @@
|
|
|
2537
2533
|
// We don't add within polyfill repo as might not always be the desired implementation
|
|
2538
2534
|
Object.defineProperty(ShimEvent, Symbol.hasInstance, {
|
|
2539
2535
|
/* eslint-enable unicorn/no-top-level-side-effects -- Would be good */
|
|
2540
|
-
/**
|
|
2541
|
-
* @typedef {any} AnyValue
|
|
2542
|
-
*/
|
|
2543
2536
|
value:
|
|
2544
2537
|
/**
|
|
2545
|
-
* @param {
|
|
2538
|
+
* @param {unknown} obj
|
|
2546
2539
|
* @returns {boolean}
|
|
2547
2540
|
*/
|
|
2548
2541
|
function value(obj) {
|
|
@@ -2613,12 +2606,9 @@
|
|
|
2613
2606
|
Object.defineProperty(IDBVersionChangeEvent.prototype, prop, desc);
|
|
2614
2607
|
});
|
|
2615
2608
|
Object.defineProperty(IDBVersionChangeEvent, Symbol.hasInstance, {
|
|
2616
|
-
/**
|
|
2617
|
-
* @typedef {any} AnyValue
|
|
2618
|
-
*/
|
|
2619
2609
|
value:
|
|
2620
2610
|
/**
|
|
2621
|
-
* @param {
|
|
2611
|
+
* @param {unknown} obj
|
|
2622
2612
|
* @returns {boolean}
|
|
2623
2613
|
*/
|
|
2624
2614
|
function value(obj) {
|
|
@@ -2900,25 +2890,20 @@
|
|
|
2900
2890
|
}
|
|
2901
2891
|
|
|
2902
2892
|
/**
|
|
2903
|
-
* @
|
|
2904
|
-
*/
|
|
2905
|
-
|
|
2906
|
-
/**
|
|
2907
|
-
* @param {ArbitraryValue} obj
|
|
2893
|
+
* @param {unknown} obj
|
|
2908
2894
|
* @returns {boolean}
|
|
2909
2895
|
*/
|
|
2910
2896
|
function isErrorOrDOMErrorOrDOMException(obj) {
|
|
2911
|
-
return obj && _typeof(obj) === 'object' &&
|
|
2912
2897
|
// We don't use util.isObj here as mutual dependency causing problems in Babel with browser
|
|
2913
|
-
typeof obj.name === 'string';
|
|
2898
|
+
return _typeof(obj) === 'object' && obj !== null && 'name' in obj && typeof obj.name === 'string';
|
|
2914
2899
|
}
|
|
2915
2900
|
|
|
2916
2901
|
/**
|
|
2917
2902
|
* Finds the error argument. This is useful because some WebSQL callbacks
|
|
2918
2903
|
* pass the error as the first argument, and some pass it as the second
|
|
2919
2904
|
* argument.
|
|
2920
|
-
* @param {
|
|
2921
|
-
* @returns {
|
|
2905
|
+
* @param {unknown[]} args
|
|
2906
|
+
* @returns {unknown}
|
|
2922
2907
|
*/
|
|
2923
2908
|
function findError(args) {
|
|
2924
2909
|
var err;
|
|
@@ -2934,7 +2919,7 @@
|
|
|
2934
2919
|
if (isErrorOrDOMErrorOrDOMException(arg)) {
|
|
2935
2920
|
return arg;
|
|
2936
2921
|
}
|
|
2937
|
-
if (arg && typeof arg.message === 'string') {
|
|
2922
|
+
if (_typeof(arg) === 'object' && arg !== null && 'message' in arg && typeof arg.message === 'string') {
|
|
2938
2923
|
err = arg;
|
|
2939
2924
|
}
|
|
2940
2925
|
}
|
|
@@ -3059,7 +3044,7 @@
|
|
|
3059
3044
|
* @typedef {IDBRequest & EventTarget & import('eventtargeter').EventTargetInstance & {
|
|
3060
3045
|
* transaction: import('./IDBTransaction.js').IDBTransactionFull,
|
|
3061
3046
|
* __done: boolean,
|
|
3062
|
-
* __result:
|
|
3047
|
+
* __result: unknown,
|
|
3063
3048
|
* __error: null|DOMException|Error,
|
|
3064
3049
|
* __source: null|import('./IDBDatabase.js').IDBDatabaseFull|
|
|
3065
3050
|
* import('./IDBObjectStore.js').IDBObjectStoreFull|
|
|
@@ -3529,8 +3514,8 @@
|
|
|
3529
3514
|
|
|
3530
3515
|
/**
|
|
3531
3516
|
* Compares two keys.
|
|
3532
|
-
* @param {import('./Key.js').Key} first
|
|
3533
|
-
* @param {import('./Key.js').Key} second
|
|
3517
|
+
* @param {import('./Key.js').Key|null|undefined} first
|
|
3518
|
+
* @param {import('./Key.js').Key|null|undefined} second
|
|
3534
3519
|
* @returns {0|1|-1}
|
|
3535
3520
|
*/
|
|
3536
3521
|
function cmp(first, second) {
|
|
@@ -3607,12 +3592,11 @@
|
|
|
3607
3592
|
*/
|
|
3608
3593
|
|
|
3609
3594
|
/**
|
|
3610
|
-
* @typedef {
|
|
3595
|
+
* @typedef {unknown} Value
|
|
3611
3596
|
*/
|
|
3612
3597
|
|
|
3613
3598
|
/**
|
|
3614
|
-
* @typedef {
|
|
3615
|
-
* @todo Specify possible value more precisely
|
|
3599
|
+
* @typedef {IDBValidKey} Key
|
|
3616
3600
|
*/
|
|
3617
3601
|
|
|
3618
3602
|
/**
|
|
@@ -3679,15 +3663,11 @@
|
|
|
3679
3663
|
*/
|
|
3680
3664
|
var signValues = ['negativeInfinity', 'bigNegative', 'smallNegative', 'smallPositive', 'bigPositive', 'positiveInfinity'];
|
|
3681
3665
|
|
|
3682
|
-
/**
|
|
3683
|
-
* @typedef {any} AnyValue
|
|
3684
|
-
*/
|
|
3685
|
-
|
|
3686
3666
|
/**
|
|
3687
3667
|
* @type {{
|
|
3688
3668
|
* [key: string]: {
|
|
3689
|
-
* encode
|
|
3690
|
-
* decode
|
|
3669
|
+
* encode(param: unknown, inArray?: boolean): string,
|
|
3670
|
+
* decode(param: string, inArray?: boolean): ValueType|undefined
|
|
3691
3671
|
* }
|
|
3692
3672
|
* }}
|
|
3693
3673
|
*/
|
|
@@ -4042,7 +4022,7 @@
|
|
|
4042
4022
|
}
|
|
4043
4023
|
|
|
4044
4024
|
/**
|
|
4045
|
-
* @param {
|
|
4025
|
+
* @param {Value} key
|
|
4046
4026
|
* @returns {KeyType|"invalid"}
|
|
4047
4027
|
*/
|
|
4048
4028
|
function getKeyType(key) {
|
|
@@ -4186,7 +4166,7 @@
|
|
|
4186
4166
|
case 'array':
|
|
4187
4167
|
{
|
|
4188
4168
|
// May throw (from binary)
|
|
4189
|
-
var arr = /** @type {
|
|
4169
|
+
var arr = /** @type {unknown[]} */input;
|
|
4190
4170
|
var len = arr.length;
|
|
4191
4171
|
safePush(seen, input);
|
|
4192
4172
|
|
|
@@ -4219,9 +4199,9 @@
|
|
|
4219
4199
|
};
|
|
4220
4200
|
}
|
|
4221
4201
|
if (!multiEntry || !fullKeys && keys.every(function (k) {
|
|
4222
|
-
return cmp(k, key.value) !== 0;
|
|
4202
|
+
return cmp(/** @type {Key} */k, /** @type {Key} */key.value) !== 0;
|
|
4223
4203
|
}) || fullKeys && keys.every(function (k) {
|
|
4224
|
-
return cmp(k, key) !== 0;
|
|
4204
|
+
return cmp(/** @type {Key} */k, /** @type {Key} */ /** @type {unknown} */key) !== 0;
|
|
4225
4205
|
})) {
|
|
4226
4206
|
safePush(keys, fullKeys ? key : key.value);
|
|
4227
4207
|
}
|
|
@@ -4278,7 +4258,7 @@
|
|
|
4278
4258
|
|
|
4279
4259
|
/**
|
|
4280
4260
|
*
|
|
4281
|
-
* @param {
|
|
4261
|
+
* @param {Value} key
|
|
4282
4262
|
* @param {boolean} [fullKeys]
|
|
4283
4263
|
* @returns {KeyValueObject}
|
|
4284
4264
|
* @todo Document other allowable `key`?
|
|
@@ -4393,7 +4373,7 @@
|
|
|
4393
4373
|
}
|
|
4394
4374
|
if (keyPath === '') {
|
|
4395
4375
|
return {
|
|
4396
|
-
value: value
|
|
4376
|
+
value: (/** @type {KeyPathEvaluateValueValue} */value)
|
|
4397
4377
|
};
|
|
4398
4378
|
}
|
|
4399
4379
|
var identifiers = keyPath.split('.');
|
|
@@ -4427,13 +4407,13 @@
|
|
|
4427
4407
|
}) ? {
|
|
4428
4408
|
failure: true
|
|
4429
4409
|
} : {
|
|
4430
|
-
value: value
|
|
4410
|
+
value: (/** @type {KeyPathEvaluateValueValue} */value)
|
|
4431
4411
|
};
|
|
4432
4412
|
}
|
|
4433
4413
|
|
|
4434
4414
|
/**
|
|
4435
4415
|
* Sets the inline key value.
|
|
4436
|
-
* @param {{[key: string]:
|
|
4416
|
+
* @param {{[key: string]: Value}} value
|
|
4437
4417
|
* @param {Key} key
|
|
4438
4418
|
* @param {string} keyPath
|
|
4439
4419
|
* @returns {void}
|
|
@@ -4451,7 +4431,7 @@
|
|
|
4451
4431
|
configurable: true
|
|
4452
4432
|
});
|
|
4453
4433
|
}
|
|
4454
|
-
value = value[identifier];
|
|
4434
|
+
value = /** @type {{[key: string]: Value}} */value[identifier];
|
|
4455
4435
|
});
|
|
4456
4436
|
Object.defineProperty(value, /** @type {string} */last, {
|
|
4457
4437
|
value: key,
|
|
@@ -4536,7 +4516,7 @@
|
|
|
4536
4516
|
* @returns {Key[]}
|
|
4537
4517
|
*/
|
|
4538
4518
|
function findMultiEntryMatches(keyEntry, range) {
|
|
4539
|
-
/** @type {
|
|
4519
|
+
/** @type {Key[]} */
|
|
4540
4520
|
var matches = [];
|
|
4541
4521
|
if (Array.isArray(keyEntry)) {
|
|
4542
4522
|
var _iterator4 = _createForOfIteratorHelper(keyEntry),
|
|
@@ -4575,7 +4555,7 @@
|
|
|
4575
4555
|
|
|
4576
4556
|
/**
|
|
4577
4557
|
* Not currently in use but keeping for spec parity.
|
|
4578
|
-
* @param {
|
|
4558
|
+
* @param {KeyValueObject} key
|
|
4579
4559
|
* @throws {Error} Upon a "bad key"
|
|
4580
4560
|
* @returns {ValueType}
|
|
4581
4561
|
*/
|
|
@@ -4586,16 +4566,17 @@
|
|
|
4586
4566
|
case 'number':
|
|
4587
4567
|
case 'string':
|
|
4588
4568
|
{
|
|
4589
|
-
return value;
|
|
4569
|
+
return /** @type {number|string} */value;
|
|
4590
4570
|
}
|
|
4591
4571
|
case 'array':
|
|
4592
4572
|
{
|
|
4593
4573
|
/** @type {ValueType[]} */
|
|
4594
4574
|
var array = [];
|
|
4595
|
-
var
|
|
4575
|
+
var arrValue = /** @type {KeyValueObject[]} */value;
|
|
4576
|
+
var len = arrValue.length;
|
|
4596
4577
|
var index = 0;
|
|
4597
4578
|
while (index < len) {
|
|
4598
|
-
var entry = convertKeyToValue(
|
|
4579
|
+
var entry = convertKeyToValue(arrValue[index]);
|
|
4599
4580
|
setArrayValue(array, index, entry);
|
|
4600
4581
|
index++;
|
|
4601
4582
|
}
|
|
@@ -4603,18 +4584,18 @@
|
|
|
4603
4584
|
}
|
|
4604
4585
|
case 'date':
|
|
4605
4586
|
{
|
|
4606
|
-
return new Date(value);
|
|
4587
|
+
return new Date(/** @type {number} */value);
|
|
4607
4588
|
}
|
|
4608
4589
|
case 'binary':
|
|
4609
4590
|
{
|
|
4610
|
-
var
|
|
4591
|
+
var binValue = /** @type {Uint8Array} */value;
|
|
4592
|
+
var _len = binValue.length;
|
|
4611
4593
|
var buffer = new ArrayBuffer(_len);
|
|
4612
4594
|
// Set the entries in buffer's [[ArrayBufferData]] to those in `value`
|
|
4613
|
-
var uint8 = new Uint8Array(buffer,
|
|
4614
|
-
uint8.set(
|
|
4595
|
+
var uint8 = new Uint8Array(buffer, binValue.byteOffset || 0, binValue.byteLength);
|
|
4596
|
+
uint8.set(binValue);
|
|
4615
4597
|
return buffer;
|
|
4616
4598
|
}
|
|
4617
|
-
case 'invalid':
|
|
4618
4599
|
default:
|
|
4619
4600
|
throw new Error('Bad key');
|
|
4620
4601
|
}
|
|
@@ -4622,7 +4603,7 @@
|
|
|
4622
4603
|
|
|
4623
4604
|
/**
|
|
4624
4605
|
*
|
|
4625
|
-
* @param {
|
|
4606
|
+
* @param {Value} key
|
|
4626
4607
|
* @param {boolean} [inArray]
|
|
4627
4608
|
* @returns {string|null}
|
|
4628
4609
|
*/
|
|
@@ -4637,7 +4618,7 @@
|
|
|
4637
4618
|
|
|
4638
4619
|
/**
|
|
4639
4620
|
*
|
|
4640
|
-
* @param {
|
|
4621
|
+
* @param {string|null} key
|
|
4641
4622
|
* @param {boolean} [inArray]
|
|
4642
4623
|
* @throws {Error} Invalid number
|
|
4643
4624
|
* @returns {undefined|ValueType}
|
|
@@ -4651,7 +4632,7 @@
|
|
|
4651
4632
|
|
|
4652
4633
|
/**
|
|
4653
4634
|
*
|
|
4654
|
-
* @param {
|
|
4635
|
+
* @param {Value} key
|
|
4655
4636
|
* @param {boolean} [inArray]
|
|
4656
4637
|
* @returns {undefined|ValueType}
|
|
4657
4638
|
*/
|
|
@@ -4869,8 +4850,8 @@
|
|
|
4869
4850
|
var IDBKeyRangeAlias = IDBKeyRange;
|
|
4870
4851
|
|
|
4871
4852
|
/**
|
|
4872
|
-
* @param {import('./Key.js').
|
|
4873
|
-
* @param {import('./Key.js').
|
|
4853
|
+
* @param {import('./Key.js').Value} lower
|
|
4854
|
+
* @param {import('./Key.js').Value} upper
|
|
4874
4855
|
* @param {boolean} lowerOpen
|
|
4875
4856
|
* @param {boolean} upperOpen
|
|
4876
4857
|
* @returns {import('./IDBKeyRange.js').IDBKeyRangeFull}
|
|
@@ -5067,10 +5048,11 @@
|
|
|
5067
5048
|
function convertValueToKeyRange(value, nullDisallowed) {
|
|
5068
5049
|
if (instanceOf(value, IDBKeyRange)) {
|
|
5069
5050
|
// We still need to validate IDBKeyRange-like objects (the above check is based on loose duck-typing)
|
|
5070
|
-
|
|
5071
|
-
|
|
5051
|
+
var range = /** @type {IDBKeyRangeFull} */value;
|
|
5052
|
+
if (range.toString() !== '[object IDBKeyRange]') {
|
|
5053
|
+
return IDBKeyRange.__createInstance(range.lower, range.upper, range.lowerOpen, range.upperOpen);
|
|
5072
5054
|
}
|
|
5073
|
-
return
|
|
5055
|
+
return range;
|
|
5074
5056
|
}
|
|
5075
5057
|
if (isNullish(value)) {
|
|
5076
5058
|
if (nullDisallowed) {
|
|
@@ -5097,7 +5079,7 @@
|
|
|
5097
5079
|
* clone: () => DOMStringListFull,
|
|
5098
5080
|
* contains: (str: string) => boolean,
|
|
5099
5081
|
* indexOf: (str: string) => Integer,
|
|
5100
|
-
* splice: (index: Integer, howmany: Integer, ...args:
|
|
5082
|
+
* splice: (index: Integer, howmany: Integer, ...args: string[]) => void
|
|
5101
5083
|
* length: Integer
|
|
5102
5084
|
* }} DOMStringListFull
|
|
5103
5085
|
*/
|
|
@@ -5213,9 +5195,10 @@
|
|
|
5213
5195
|
},
|
|
5214
5196
|
/**
|
|
5215
5197
|
* @this {DOMStringListFull}
|
|
5216
|
-
* @
|
|
5198
|
+
* @template T
|
|
5199
|
+
* @param {(value: string, i: Integer, arr: string[]) => T} cb
|
|
5217
5200
|
* @param {object} thisArg
|
|
5218
|
-
* @returns {
|
|
5201
|
+
* @returns {T[]}
|
|
5219
5202
|
*/
|
|
5220
5203
|
map: function map(cb, thisArg) {
|
|
5221
5204
|
// eslint-disable-next-line unicorn/no-array-callback-reference, unicorn/no-array-method-this-argument -- Convenient
|
|
@@ -5240,10 +5223,7 @@
|
|
|
5240
5223
|
this.sortList();
|
|
5241
5224
|
},
|
|
5242
5225
|
/**
|
|
5243
|
-
* @
|
|
5244
|
-
*/
|
|
5245
|
-
/**
|
|
5246
|
-
* @param {[index: Integer, howmany: Integer, ...args: any]} args
|
|
5226
|
+
* @param {[index: Integer, howmany: Integer, ...args: string[]]} args
|
|
5247
5227
|
* @this {DOMStringListFull}
|
|
5248
5228
|
* @returns {void}
|
|
5249
5229
|
*/
|
|
@@ -5281,12 +5261,9 @@
|
|
|
5281
5261
|
}));
|
|
5282
5262
|
|
|
5283
5263
|
/* eslint-disable unicorn/no-top-level-side-effects -- Would be good */
|
|
5284
|
-
/**
|
|
5285
|
-
* @typedef {any} AnyValue
|
|
5286
|
-
*/
|
|
5287
5264
|
Object.defineProperty(DOMStringList, Symbol.hasInstance, {
|
|
5288
5265
|
/**
|
|
5289
|
-
* @param {
|
|
5266
|
+
* @param {unknown} obj
|
|
5290
5267
|
* @returns {boolean}
|
|
5291
5268
|
*/
|
|
5292
5269
|
value: function value(obj) {
|
|
@@ -5367,7 +5344,7 @@
|
|
|
5367
5344
|
/**
|
|
5368
5345
|
* @typedef {{
|
|
5369
5346
|
* op: SQLCallback,
|
|
5370
|
-
* args:
|
|
5347
|
+
* args: unknown[],
|
|
5371
5348
|
* req: import('./IDBRequest.js').IDBRequestFull|null
|
|
5372
5349
|
* }} RequestInfo
|
|
5373
5350
|
*/
|
|
@@ -5419,17 +5396,17 @@
|
|
|
5419
5396
|
* __pushToQueue: (
|
|
5420
5397
|
* request: import('./IDBRequest.js').IDBRequestFull|null,
|
|
5421
5398
|
* callback: SQLCallback,
|
|
5422
|
-
* args?:
|
|
5399
|
+
* args?: unknown[]
|
|
5423
5400
|
* ) => void,
|
|
5424
5401
|
* __assertActive: () => void,
|
|
5425
5402
|
* commit: () => void,
|
|
5426
5403
|
* __addNonRequestToTransactionQueue: (
|
|
5427
5404
|
* callback: SQLCallback,
|
|
5428
|
-
* args?:
|
|
5405
|
+
* args?: unknown[]
|
|
5429
5406
|
* ) => void
|
|
5430
5407
|
* __addToTransactionQueue: (
|
|
5431
5408
|
* callback: SQLCallback,
|
|
5432
|
-
* args:
|
|
5409
|
+
* args: unknown[]|undefined,
|
|
5433
5410
|
* source: import('./IDBDatabase.js').IDBDatabaseFull|
|
|
5434
5411
|
* import('./IDBObjectStore.js').IDBObjectStoreFull|
|
|
5435
5412
|
* import('./IDBIndex.js').IDBIndexFull|
|
|
@@ -5631,7 +5608,7 @@
|
|
|
5631
5608
|
i = -1;
|
|
5632
5609
|
|
|
5633
5610
|
/**
|
|
5634
|
-
* @typedef {
|
|
5611
|
+
* @typedef {unknown} IDBRequestResult
|
|
5635
5612
|
*/
|
|
5636
5613
|
|
|
5637
5614
|
/**
|
|
@@ -6067,8 +6044,8 @@
|
|
|
6067
6044
|
/**
|
|
6068
6045
|
* @typedef {(
|
|
6069
6046
|
* tx: import('websql-configurable/lib/websql/WebSQLTransaction.js').default,
|
|
6070
|
-
* args:
|
|
6071
|
-
* success: (result?:
|
|
6047
|
+
* args: unknown[],
|
|
6048
|
+
* success: (result?: unknown, req?: import('./IDBRequest.js').IDBRequestFull) => void,
|
|
6072
6049
|
* error: (
|
|
6073
6050
|
* tx: import('websql-configurable/lib/websql/WebSQLTransaction.js').default|Error|DOMException,
|
|
6074
6051
|
* err?: Error & {code?: number}
|
|
@@ -6080,7 +6057,7 @@
|
|
|
6080
6057
|
/**
|
|
6081
6058
|
* Adds a callback function to the transaction queue.
|
|
6082
6059
|
* @param {SQLCallback} callback
|
|
6083
|
-
* @param {
|
|
6060
|
+
* @param {unknown[]} args
|
|
6084
6061
|
* @param {import('./IDBDatabase.js').IDBDatabaseFull|
|
|
6085
6062
|
* import('./IDBObjectStore.js').IDBObjectStoreFull|
|
|
6086
6063
|
* import('./IDBIndex.js').IDBIndexFull} source
|
|
@@ -6097,7 +6074,7 @@
|
|
|
6097
6074
|
* Adds a callback function to the transaction queue without generating a
|
|
6098
6075
|
* request.
|
|
6099
6076
|
* @param {SQLCallback} callback
|
|
6100
|
-
* @param {
|
|
6077
|
+
* @param {unknown[]} args
|
|
6101
6078
|
* @this {IDBTransactionFull}
|
|
6102
6079
|
* @returns {void}
|
|
6103
6080
|
*/
|
|
@@ -6109,7 +6086,7 @@
|
|
|
6109
6086
|
* Adds an IDBRequest to the transaction queue.
|
|
6110
6087
|
* @param {import('./IDBRequest.js').IDBRequestFull|null} request
|
|
6111
6088
|
* @param {SQLCallback} callback
|
|
6112
|
-
* @param {
|
|
6089
|
+
* @param {unknown[]} args
|
|
6113
6090
|
* @this {IDBTransactionFull}
|
|
6114
6091
|
* @returns {void}
|
|
6115
6092
|
*/
|
|
@@ -6280,7 +6257,7 @@
|
|
|
6280
6257
|
bubbles: true,
|
|
6281
6258
|
cancelable: true
|
|
6282
6259
|
});
|
|
6283
|
-
return new SyncPromise(/** @type {(resolve: (value?:
|
|
6260
|
+
return new SyncPromise(/** @type {(resolve: (value?: unknown) => void) => void} */
|
|
6284
6261
|
function (resolve) {
|
|
6285
6262
|
setTimeout(function () {
|
|
6286
6263
|
if (!q.req) {
|
|
@@ -8443,7 +8420,7 @@
|
|
|
8443
8420
|
}
|
|
8444
8421
|
|
|
8445
8422
|
/**
|
|
8446
|
-
* @typedef {
|
|
8423
|
+
* @typedef {import('./Key.js').Value} AnyValue
|
|
8447
8424
|
*/
|
|
8448
8425
|
|
|
8449
8426
|
/**
|
|
@@ -8553,7 +8530,7 @@
|
|
|
8553
8530
|
* __keyPath: import('./Key.js').KeyPath,
|
|
8554
8531
|
* __recreated?: boolean,
|
|
8555
8532
|
* __fetchIndexData: (
|
|
8556
|
-
* range:
|
|
8533
|
+
* range: Query,
|
|
8557
8534
|
* opType: "value"|"key"|"count",
|
|
8558
8535
|
* nullDisallowed: boolean,
|
|
8559
8536
|
* count?: number
|
|
@@ -8925,7 +8902,7 @@
|
|
|
8925
8902
|
};
|
|
8926
8903
|
|
|
8927
8904
|
/**
|
|
8928
|
-
* @typedef {
|
|
8905
|
+
* @typedef {IDBValidKey|IDBKeyRange} Query
|
|
8929
8906
|
*/
|
|
8930
8907
|
|
|
8931
8908
|
/**
|
|
@@ -9208,7 +9185,7 @@
|
|
|
9208
9185
|
reject(err);
|
|
9209
9186
|
});
|
|
9210
9187
|
}));
|
|
9211
|
-
SyncPromise.all(indexCreations).then(finish).catch(/** @type {(reason:
|
|
9188
|
+
SyncPromise.all(indexCreations).then(finish).catch(/** @type {(reason: unknown) => PromiseLike<never>} */
|
|
9212
9189
|
error).catch(function (err) {
|
|
9213
9190
|
console.log('Index rename error');
|
|
9214
9191
|
throw err;
|
|
@@ -9220,14 +9197,10 @@
|
|
|
9220
9197
|
});
|
|
9221
9198
|
};
|
|
9222
9199
|
|
|
9223
|
-
/**
|
|
9224
|
-
* @typedef {any} AnyValue
|
|
9225
|
-
*/
|
|
9226
|
-
|
|
9227
9200
|
/* eslint-disable unicorn/no-top-level-side-effects -- Would be good */
|
|
9228
9201
|
Object.defineProperty(IDBIndex, Symbol.hasInstance, {
|
|
9229
9202
|
/**
|
|
9230
|
-
* @param {
|
|
9203
|
+
* @param {unknown} obj
|
|
9231
9204
|
* @returns {boolean}
|
|
9232
9205
|
*/
|
|
9233
9206
|
value: function value(obj) {
|
|
@@ -9255,7 +9228,9 @@
|
|
|
9255
9228
|
* @param {string[]} sqlValues
|
|
9256
9229
|
* @param {WebSQLTransaction} tx
|
|
9257
9230
|
* @param {null|undefined} args
|
|
9258
|
-
* @param {(
|
|
9231
|
+
* @param {(
|
|
9232
|
+
* result: number|undefined|[]|import('./Key.js').Value|import('./Key.js').Value[]
|
|
9233
|
+
* ) => void} success
|
|
9259
9234
|
* @param {(tx: WebSQLTransaction, err: (Error & {code?: number})) => void} error
|
|
9260
9235
|
* @returns {void}
|
|
9261
9236
|
*/
|
|
@@ -9292,7 +9267,7 @@
|
|
|
9292
9267
|
* @param {{
|
|
9293
9268
|
* value: string
|
|
9294
9269
|
* }} record
|
|
9295
|
-
* @returns {
|
|
9270
|
+
* @returns {import('./Key.js').Value}
|
|
9296
9271
|
*/
|
|
9297
9272
|
function (record) {
|
|
9298
9273
|
// when opType is value
|
|
@@ -9306,9 +9281,9 @@
|
|
|
9306
9281
|
var rowKey = /** @type {import('./Key.js').ValueTypeArray} */
|
|
9307
9282
|
_decode(row[escapedIndexNameForKeyCol]);
|
|
9308
9283
|
var record;
|
|
9309
|
-
if (hasKey && (multiChecks && range.some(
|
|
9284
|
+
if (hasKey && (multiChecks && /** @type {import('./Key.js').ValueType[]} */range.some(
|
|
9310
9285
|
/**
|
|
9311
|
-
* @param {
|
|
9286
|
+
* @param {import('./Key.js').ValueType} check
|
|
9312
9287
|
* @returns {boolean}
|
|
9313
9288
|
*/
|
|
9314
9289
|
function (check) {
|
|
@@ -9459,14 +9434,14 @@
|
|
|
9459
9434
|
* __idbdb: import('./IDBDatabase.js').IDBDatabaseFull,
|
|
9460
9435
|
* __validateKeyAndValueAndCloneValue: (
|
|
9461
9436
|
* value: import('./Key.js').Value,
|
|
9462
|
-
* key: import('./Key.js').Key,
|
|
9437
|
+
* key: import('./Key.js').Key|undefined,
|
|
9463
9438
|
* cursorUpdate: boolean
|
|
9464
9439
|
* ) => KeyValueArray,
|
|
9465
9440
|
* __deriveKey: (
|
|
9466
9441
|
* tx: WebSQLTransaction,
|
|
9467
9442
|
* value: import('./Key.js').Value,
|
|
9468
|
-
* key: import('./Key.js').Key,
|
|
9469
|
-
* success: (key: import('./Key.js').
|
|
9443
|
+
* key: import('./Key.js').Key|undefined,
|
|
9444
|
+
* success: (key: import('./Key.js').Value, cn?: Integer) => void,
|
|
9470
9445
|
* failCb: import('./Key.js').SQLFailureCallback
|
|
9471
9446
|
* ) => void,
|
|
9472
9447
|
* __checkIndexConstraints: (
|
|
@@ -9490,7 +9465,7 @@
|
|
|
9490
9465
|
* error: (err: (Error & {code?: number})) => void
|
|
9491
9466
|
* ) => void,
|
|
9492
9467
|
* __get: (
|
|
9493
|
-
* query: import('./
|
|
9468
|
+
* query: import('./IDBIndex.js').Query,
|
|
9494
9469
|
* getKey?: boolean,
|
|
9495
9470
|
* getAll?: boolean,
|
|
9496
9471
|
* count?: Integer
|
|
@@ -9775,7 +9750,7 @@
|
|
|
9775
9750
|
};
|
|
9776
9751
|
|
|
9777
9752
|
/**
|
|
9778
|
-
* @typedef {[import('./Key.js').Key, import('./Key.js').Value]} KeyValueArray
|
|
9753
|
+
* @typedef {[import('./Key.js').Key|undefined, import('./Key.js').Value]} KeyValueArray
|
|
9779
9754
|
*/
|
|
9780
9755
|
|
|
9781
9756
|
// Todo: Although we may end up needing to do cloning genuinely asynchronously (for Blobs and FileLists),
|
|
@@ -9790,7 +9765,7 @@
|
|
|
9790
9765
|
* Determines whether the given inline or out-of-line key is valid,
|
|
9791
9766
|
* according to the object store's schema.
|
|
9792
9767
|
* @param {import('./Key.js').Value} value Used for inline keys
|
|
9793
|
-
* @param {import('./Key.js').Key} key Used for out-of-line keys
|
|
9768
|
+
* @param {import('./Key.js').Key|undefined} key Used for out-of-line keys
|
|
9794
9769
|
* @param {boolean} cursorUpdate
|
|
9795
9770
|
* @throws {DOMException}
|
|
9796
9771
|
* @this {IDBObjectStoreFull}
|
|
@@ -9806,11 +9781,11 @@
|
|
|
9806
9781
|
// occurs sync; then can make cloning and this method without callbacks (except where ok
|
|
9807
9782
|
// to be async)
|
|
9808
9783
|
var _clonedValue = cloneWithInactiveTransaction(/** @type {import('./IDBTransaction.js').IDBTransactionFull} */me.transaction, value);
|
|
9809
|
-
|
|
9810
|
-
if (
|
|
9784
|
+
var extractedKey = extractKeyValueDecodedFromValueUsingKeyPath(_clonedValue, me.keyPath); // May throw so "rethrow"
|
|
9785
|
+
if ('invalid' in extractedKey && extractedKey.invalid) {
|
|
9811
9786
|
throw createDOMException('DataError', 'KeyPath was specified, but key was invalid.');
|
|
9812
9787
|
}
|
|
9813
|
-
if (
|
|
9788
|
+
if ('failure' in extractedKey && extractedKey.failure) {
|
|
9814
9789
|
if (!cursorUpdate) {
|
|
9815
9790
|
if (!me.autoIncrement) {
|
|
9816
9791
|
throw createDOMException('DataError', 'Could not evaluate a key from keyPath and there is no key generator');
|
|
@@ -9825,14 +9800,13 @@
|
|
|
9825
9800
|
throw createDOMException('DataError', 'Could not evaluate a key from keyPath');
|
|
9826
9801
|
}
|
|
9827
9802
|
// An `IDBCursor.update` call will also throw if not equal to the cursor’s effective key
|
|
9828
|
-
return [
|
|
9803
|
+
return [(/** @type {import('./Key.js').Key} */extractedKey.value), _clonedValue];
|
|
9829
9804
|
}
|
|
9830
9805
|
if (key === undefined) {
|
|
9831
9806
|
if (!me.autoIncrement) {
|
|
9832
9807
|
throw createDOMException('DataError', 'The object store uses out-of-line keys and has no key generator and the key parameter was not provided.');
|
|
9833
9808
|
}
|
|
9834
9809
|
// A key will be generated
|
|
9835
|
-
key = undefined;
|
|
9836
9810
|
} else {
|
|
9837
9811
|
convertValueToKeyRethrowingAndIfInvalid(key);
|
|
9838
9812
|
}
|
|
@@ -9847,8 +9821,8 @@
|
|
|
9847
9821
|
* a keyPath leading to a valid but non-numeric or < 1 key).
|
|
9848
9822
|
* @param {WebSQLTransaction} tx
|
|
9849
9823
|
* @param {import('./Key.js').Value} value
|
|
9850
|
-
* @param {import('./Key.js').Key} key
|
|
9851
|
-
* @param {(key: import('./Key.js').
|
|
9824
|
+
* @param {import('./Key.js').Key|undefined} key
|
|
9825
|
+
* @param {(key: import('./Key.js').Value, cn?: Integer) => void} success
|
|
9852
9826
|
* @param {import('./Key.js').SQLFailureCallback} failCb
|
|
9853
9827
|
* @this {IDBObjectStoreFull}
|
|
9854
9828
|
* @returns {void}
|
|
@@ -9863,9 +9837,8 @@
|
|
|
9863
9837
|
*/
|
|
9864
9838
|
function keyCloneThenSuccess(oldCn) {
|
|
9865
9839
|
// We want to return the original key, so we don't need to accept an argument here
|
|
9866
|
-
encode(key, function (
|
|
9867
|
-
|
|
9868
|
-
success(key, oldCn);
|
|
9840
|
+
encode(key, function (encodedKey) {
|
|
9841
|
+
success(decode(encodedKey), oldCn);
|
|
9869
9842
|
});
|
|
9870
9843
|
}
|
|
9871
9844
|
if (me.autoIncrement) {
|
|
@@ -9879,7 +9852,7 @@
|
|
|
9879
9852
|
if (me.keyPath !== null) {
|
|
9880
9853
|
// Should not throw now as checked earlier
|
|
9881
9854
|
// Todo: Could this not be an array here?
|
|
9882
|
-
injectKeyIntoValueUsingKeyPath(value, key, /** @type {string} */me.keyPath);
|
|
9855
|
+
injectKeyIntoValueUsingKeyPath(/** @type {{[key: string]: import('./Key.js').Value}} */value, /** @type {import('./Key.js').Key} */key, /** @type {string} */me.keyPath);
|
|
9883
9856
|
}
|
|
9884
9857
|
success(key, oldCn);
|
|
9885
9858
|
}, failCb);
|
|
@@ -9936,15 +9909,15 @@
|
|
|
9936
9909
|
resolve(undefined);
|
|
9937
9910
|
return;
|
|
9938
9911
|
}
|
|
9939
|
-
|
|
9940
|
-
if (
|
|
9912
|
+
var indexKeyValue = indexKey.value;
|
|
9913
|
+
if (indexKeyValue === undefined) {
|
|
9941
9914
|
resolve(undefined);
|
|
9942
9915
|
return;
|
|
9943
9916
|
}
|
|
9944
|
-
var multiCheck = index.multiEntry && Array.isArray(
|
|
9945
|
-
var fetchArgs = buildFetchIndexDataSQL(true, index,
|
|
9917
|
+
var multiCheck = index.multiEntry && Array.isArray(indexKeyValue);
|
|
9918
|
+
var fetchArgs = buildFetchIndexDataSQL(true, index, indexKeyValue, 'key', multiCheck);
|
|
9946
9919
|
executeFetchIndexData.apply(void 0, [null].concat(_toConsumableArray(fetchArgs), [tx, null, function success(key) {
|
|
9947
|
-
if (key === undefined || excludeKey !== undefined && cmp(key, excludeKey) === 0) {
|
|
9920
|
+
if (key === undefined || excludeKey !== undefined && cmp(/** @type {import('./Key.js').Key} */key, excludeKey) === 0) {
|
|
9948
9921
|
resolve(undefined);
|
|
9949
9922
|
return;
|
|
9950
9923
|
}
|
|
@@ -10017,21 +9990,21 @@
|
|
|
10017
9990
|
resolve(undefined);
|
|
10018
9991
|
return;
|
|
10019
9992
|
}
|
|
10020
|
-
|
|
9993
|
+
var indexKeyValue = indexKey.value;
|
|
10021
9994
|
/**
|
|
10022
9995
|
* @param {import('./IDBIndex.js').IDBIndexFull} index
|
|
10023
9996
|
* @returns {void}
|
|
10024
9997
|
*/
|
|
10025
9998
|
function setIndexInfo(index) {
|
|
10026
|
-
if (
|
|
9999
|
+
if (indexKeyValue === undefined) {
|
|
10027
10000
|
return;
|
|
10028
10001
|
}
|
|
10029
10002
|
paramMap[index.__currentName] = /** @type {string} */
|
|
10030
|
-
_encode(
|
|
10003
|
+
_encode(indexKeyValue, index.multiEntry);
|
|
10031
10004
|
}
|
|
10032
10005
|
if (index.unique) {
|
|
10033
|
-
var multiCheck = index.multiEntry && Array.isArray(
|
|
10034
|
-
var fetchArgs = buildFetchIndexDataSQL(true, index,
|
|
10006
|
+
var multiCheck = index.multiEntry && Array.isArray(indexKeyValue);
|
|
10007
|
+
var fetchArgs = buildFetchIndexDataSQL(true, index, indexKeyValue, 'key', multiCheck);
|
|
10035
10008
|
executeFetchIndexData.apply(void 0, [null].concat(_toConsumableArray(fetchArgs), [tx, null, function success(key) {
|
|
10036
10009
|
if (key === undefined) {
|
|
10037
10010
|
setIndexInfo(index);
|
|
@@ -10199,7 +10172,9 @@
|
|
|
10199
10172
|
var key = arguments[5];
|
|
10200
10173
|
/** @type {import('./IDBTransaction.js').IDBTransactionFull} */
|
|
10201
10174
|
store.transaction.__pushToQueue(request, function (tx, args, success, error) {
|
|
10202
|
-
store.__deriveKey(tx, value, key, function (
|
|
10175
|
+
store.__deriveKey(tx, value, key, function (clonedKeyOrCurrentNumberRaw, oldCn) {
|
|
10176
|
+
var clonedKeyOrCurrentNumber = /** @type {import('./Key.js').Key|Integer} */
|
|
10177
|
+
clonedKeyOrCurrentNumberRaw;
|
|
10203
10178
|
encode(value, function (encoded) {
|
|
10204
10179
|
/**
|
|
10205
10180
|
* @param {WebSQLTransaction} tx
|
|
@@ -10252,7 +10227,7 @@
|
|
|
10252
10227
|
|
|
10253
10228
|
/**
|
|
10254
10229
|
*
|
|
10255
|
-
* @param {import('./
|
|
10230
|
+
* @param {import('./IDBIndex.js').Query} query
|
|
10256
10231
|
* @param {boolean} [getKey]
|
|
10257
10232
|
* @this {IDBObjectStoreFull}
|
|
10258
10233
|
* @returns {import('./IDBRequest.js').IDBRequestFull}
|
|
@@ -10304,7 +10279,7 @@
|
|
|
10304
10279
|
|
|
10305
10280
|
/**
|
|
10306
10281
|
*
|
|
10307
|
-
* @param {import('./
|
|
10282
|
+
* @param {import('./IDBIndex.js').Query} query
|
|
10308
10283
|
* @throws {TypeError}
|
|
10309
10284
|
* @this {IDBObjectStoreFull}
|
|
10310
10285
|
* @returns {import('./IDBRequest.js').IDBRequestFull}
|
|
@@ -10318,7 +10293,7 @@
|
|
|
10318
10293
|
|
|
10319
10294
|
/**
|
|
10320
10295
|
*
|
|
10321
|
-
* @param {import('./
|
|
10296
|
+
* @param {import('./IDBIndex.js').Query} query
|
|
10322
10297
|
* @this {IDBObjectStoreFull}
|
|
10323
10298
|
* @returns {import('./IDBRequest.js').IDBRequestFull}
|
|
10324
10299
|
*/
|
|
@@ -10373,7 +10348,7 @@
|
|
|
10373
10348
|
|
|
10374
10349
|
/**
|
|
10375
10350
|
*
|
|
10376
|
-
* @param {import('./
|
|
10351
|
+
* @param {import('./IDBIndex.js').Query} query
|
|
10377
10352
|
* @throws {TypeError}
|
|
10378
10353
|
* @this {IDBObjectStoreFull}
|
|
10379
10354
|
* @returns {import('./IDBRequest.js').IDBRequestFull}
|
|
@@ -11585,7 +11560,7 @@
|
|
|
11585
11560
|
var sysdbFinishedCb = function sysdbFinishedCb(systx, err, cb) {
|
|
11586
11561
|
if (err) {
|
|
11587
11562
|
/**
|
|
11588
|
-
* @param {
|
|
11563
|
+
* @param {unknown} [errorToShow]
|
|
11589
11564
|
* @returns {void}
|
|
11590
11565
|
*/
|
|
11591
11566
|
var manualRevert = function manualRevert(errorToShow) {
|
|
@@ -11609,7 +11584,9 @@
|
|
|
11609
11584
|
cb(sqlErr); // eslint-disable-line promise/no-callback-in-promise -- Convenient
|
|
11610
11585
|
}, function () {
|
|
11611
11586
|
isRevertingSysdb = false;
|
|
11612
|
-
|
|
11587
|
+
// eslint-disable-next-line promise/no-callback-in-promise -- Convenient
|
|
11588
|
+
cb(/** @type {(Error & {code?: number})|undefined} */
|
|
11589
|
+
errorToShow || reportError);
|
|
11613
11590
|
});
|
|
11614
11591
|
};
|
|
11615
11592
|
try {
|
|
@@ -11642,13 +11619,13 @@
|
|
|
11642
11619
|
newVersion: version
|
|
11643
11620
|
});
|
|
11644
11621
|
req.__result = connection;
|
|
11645
|
-
connection.__upgradeTransaction = req.__transaction =
|
|
11622
|
+
connection.__upgradeTransaction = req.__transaction = connection.__versionTransaction = IDBTransaction.__createInstance(connection, connection.objectStoreNames, 'versionchange');
|
|
11646
11623
|
req.__done = true;
|
|
11647
11624
|
req.transaction.__addNonRequestToTransactionQueue(
|
|
11648
11625
|
/**
|
|
11649
11626
|
* @param {import('websql-configurable/lib/websql/WebSQLTransaction.js').default} tx
|
|
11650
|
-
* @param {
|
|
11651
|
-
* @param {(result?:
|
|
11627
|
+
* @param {unknown[]} args
|
|
11628
|
+
* @param {(result?: unknown, req?: import('./IDBRequest.js').IDBRequestFull) => void} finished
|
|
11652
11629
|
* @returns {void}
|
|
11653
11630
|
*/
|
|
11654
11631
|
function onupgradeneeded(tx, args, finished /* , error */) {
|
|
@@ -12349,16 +12326,16 @@
|
|
|
12349
12326
|
|
|
12350
12327
|
/**
|
|
12351
12328
|
* @typedef {IDBCursor & {
|
|
12352
|
-
* primaryKey: import('./Key.js').Key,
|
|
12353
|
-
* key: import('./Key.js').Key,
|
|
12329
|
+
* primaryKey: import('./Key.js').Key|null|undefined,
|
|
12330
|
+
* key: import('./Key.js').Key|null|undefined,
|
|
12354
12331
|
* direction: string,
|
|
12355
12332
|
* source: import('./IDBObjectStore.js').IDBObjectStoreFull|
|
|
12356
12333
|
* import('./IDBIndex.js').IDBIndexFull,
|
|
12357
12334
|
* __request: import('./IDBRequest.js').IDBRequestFull,
|
|
12358
12335
|
* __advanceCount: Integer|undefined,
|
|
12359
12336
|
* __indexSource: boolean,
|
|
12360
|
-
* __key: import('./Key.js').Key,
|
|
12361
|
-
* __primaryKey: import('./Key.js').Key,
|
|
12337
|
+
* __key: import('./Key.js').Key|null|undefined,
|
|
12338
|
+
* __primaryKey: import('./Key.js').Key|null|undefined,
|
|
12362
12339
|
* __value: import('./Key.js').Value,
|
|
12363
12340
|
* __store: import('./IDBObjectStore.js').IDBObjectStoreFull,
|
|
12364
12341
|
* __range: import('./IDBKeyRange.js').IDBKeyRangeFull|undefined,
|
|
@@ -12366,13 +12343,13 @@
|
|
|
12366
12343
|
* __valueColumnName: string,
|
|
12367
12344
|
* __keyOnly: boolean,
|
|
12368
12345
|
* __valueDecoder: {
|
|
12369
|
-
* decode: (str: string) =>
|
|
12346
|
+
* decode: (str: string) => import('./Key.js').Value,
|
|
12370
12347
|
* },
|
|
12371
12348
|
* __count: boolean,
|
|
12372
12349
|
* __prefetchedIndex: Integer,
|
|
12373
12350
|
* __prefetchedData: null|{
|
|
12374
12351
|
* length: number;
|
|
12375
|
-
* item(index: number):
|
|
12352
|
+
* item(index: number): unknown;
|
|
12376
12353
|
* }|{
|
|
12377
12354
|
* data: RowItemNonNull[],
|
|
12378
12355
|
* length: Integer,
|
|
@@ -12387,7 +12364,14 @@
|
|
|
12387
12364
|
* __multiEntryExhausted: boolean,
|
|
12388
12365
|
* __invalidateCache: () => void,
|
|
12389
12366
|
* __gotValue: boolean,
|
|
12390
|
-
* __find: (
|
|
12367
|
+
* __find: (
|
|
12368
|
+
* key: import('./Key.js').Key|undefined,
|
|
12369
|
+
* primaryKey: import('./Key.js').Key|undefined,
|
|
12370
|
+
* tx: WebSQLTransaction,
|
|
12371
|
+
* success: KeySuccess,
|
|
12372
|
+
* error: FindError,
|
|
12373
|
+
* recordsToLoad?: Integer
|
|
12374
|
+
* ) => void,
|
|
12391
12375
|
* __findBasic: (
|
|
12392
12376
|
* key: import('./Key.js').Key|undefined,
|
|
12393
12377
|
* primaryKey: import('./Key.js').Key|undefined,
|
|
@@ -12408,17 +12392,17 @@
|
|
|
12408
12392
|
* __decode: (
|
|
12409
12393
|
* rowItem: RowItemNonNull,
|
|
12410
12394
|
* callback: (
|
|
12411
|
-
* key: import('./Key.js').Key,
|
|
12395
|
+
* key: import('./Key.js').Key|undefined,
|
|
12412
12396
|
* val: import('./Key.js').Value,
|
|
12413
|
-
* primaryKey: import('./Key.js').Key,
|
|
12397
|
+
* primaryKey: import('./Key.js').Key|undefined,
|
|
12414
12398
|
* encKey?: string
|
|
12415
12399
|
* ) => void
|
|
12416
12400
|
* ) => void,
|
|
12417
12401
|
* __sourceOrEffectiveObjStoreDeleted: () => void,
|
|
12418
12402
|
* __continue: (key?: import('./Key.js').Key, advanceContinue?: boolean) => void,
|
|
12419
12403
|
* __continueFinish: (
|
|
12420
|
-
* key: import('./Key.js').Key,
|
|
12421
|
-
* primaryKey: import('./Key.js').Key,
|
|
12404
|
+
* key: import('./Key.js').Key|undefined,
|
|
12405
|
+
* primaryKey: import('./Key.js').Key|undefined,
|
|
12422
12406
|
* advanceState: boolean
|
|
12423
12407
|
* ) => void
|
|
12424
12408
|
* }} IDBCursorFull
|
|
@@ -12451,7 +12435,7 @@
|
|
|
12451
12435
|
* import('./IDBIndex.js').IDBIndexFull} source
|
|
12452
12436
|
* @param {string} keyColumnName
|
|
12453
12437
|
* @param {string} valueColumnName
|
|
12454
|
-
* @param {boolean} count
|
|
12438
|
+
* @param {boolean} [count]
|
|
12455
12439
|
* @this {IDBCursorFull}
|
|
12456
12440
|
* @returns {void}
|
|
12457
12441
|
*/
|
|
@@ -12492,7 +12476,7 @@
|
|
|
12492
12476
|
this.__valueColumnName = valueColumnName;
|
|
12493
12477
|
this.__keyOnly = valueColumnName === 'key';
|
|
12494
12478
|
this.__valueDecoder = this.__keyOnly ? Key : Sca;
|
|
12495
|
-
this.__count = count;
|
|
12479
|
+
this.__count = Boolean(count);
|
|
12496
12480
|
this.__prefetchedIndex = -1;
|
|
12497
12481
|
this.__continuationKey = undefined;
|
|
12498
12482
|
this.__continuationPrimaryKey = undefined;
|
|
@@ -12511,36 +12495,36 @@
|
|
|
12511
12495
|
|
|
12512
12496
|
/**
|
|
12513
12497
|
*
|
|
12514
|
-
* @param {
|
|
12498
|
+
* @param {IDBKeyRange} query
|
|
12499
|
+
* @param {string} direction
|
|
12500
|
+
* @param {import('./IDBObjectStore.js').IDBObjectStoreFull} store
|
|
12501
|
+
* @param {import('./IDBObjectStore.js').IDBObjectStoreFull|
|
|
12502
|
+
* import('./IDBIndex.js').IDBIndexFull} source
|
|
12503
|
+
* @param {string} keyColumnName
|
|
12504
|
+
* @param {string} valueColumnName
|
|
12505
|
+
* @param {boolean} [count]
|
|
12515
12506
|
* @returns {IDBCursorFull}
|
|
12516
12507
|
*/
|
|
12517
|
-
IDBCursor.__createInstance = function () {
|
|
12508
|
+
IDBCursor.__createInstance = function (query, direction, store, source, keyColumnName, valueColumnName, count) {
|
|
12518
12509
|
var IDBCursor = IDBCursorAlias.__super;
|
|
12519
12510
|
IDBCursor.prototype = IDBCursorAlias.prototype;
|
|
12520
12511
|
|
|
12521
12512
|
// @ts-expect-error It's ok
|
|
12522
|
-
|
|
12523
|
-
args[_key] = arguments[_key];
|
|
12524
|
-
}
|
|
12525
|
-
return _construct(IDBCursor, args);
|
|
12513
|
+
return new IDBCursor(query, direction, store, source, keyColumnName, valueColumnName, count);
|
|
12526
12514
|
};
|
|
12527
12515
|
|
|
12528
12516
|
/**
|
|
12529
12517
|
*
|
|
12530
|
-
* @param {
|
|
12518
|
+
* @param {import('./Key.js').Key|undefined} key
|
|
12519
|
+
* @param {import('./Key.js').Key|undefined} primaryKey
|
|
12520
|
+
* @param {WebSQLTransaction} tx
|
|
12521
|
+
* @param {KeySuccess} success
|
|
12522
|
+
* @param {FindError} error
|
|
12523
|
+
* @param {Integer} [recordsToLoad]
|
|
12531
12524
|
* @this {IDBCursorFull}
|
|
12532
12525
|
* @returns {void}
|
|
12533
12526
|
*/
|
|
12534
|
-
IDBCursor.prototype.__find = function () {
|
|
12535
|
-
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
|
12536
|
-
args[_key2] = arguments[_key2];
|
|
12537
|
-
}
|
|
12538
|
-
var key = args[0],
|
|
12539
|
-
primaryKey = args[1],
|
|
12540
|
-
tx = args[2],
|
|
12541
|
-
success = args[3],
|
|
12542
|
-
error = args[4],
|
|
12543
|
-
recordsToLoad = args[5];
|
|
12527
|
+
IDBCursor.prototype.__find = function (key, primaryKey, tx, success, error, recordsToLoad) {
|
|
12544
12528
|
if (this.__multiEntryIndex) {
|
|
12545
12529
|
this.__findMultiEntry(key, primaryKey, tx, success, error, recordsToLoad);
|
|
12546
12530
|
} else {
|
|
@@ -12550,9 +12534,9 @@
|
|
|
12550
12534
|
|
|
12551
12535
|
/**
|
|
12552
12536
|
* @typedef {(
|
|
12553
|
-
* k: import('./Key.js').Key,
|
|
12537
|
+
* k: import('./Key.js').Key|undefined,
|
|
12554
12538
|
* val: import('./Key.js').Value,
|
|
12555
|
-
* primKey: import('./Key.js').Key
|
|
12539
|
+
* primKey: import('./Key.js').Key|undefined
|
|
12556
12540
|
* ) => void} KeySuccess
|
|
12557
12541
|
*/
|
|
12558
12542
|
|
|
@@ -12649,7 +12633,7 @@
|
|
|
12649
12633
|
me.__prefetchedIndex = 0;
|
|
12650
12634
|
me.__prefetchedData = data.rows;
|
|
12651
12635
|
if (CFG.DEBUG) {
|
|
12652
|
-
console.log('Preloaded ' +
|
|
12636
|
+
console.log('Preloaded ' + data.rows.length + ' records for cursor');
|
|
12653
12637
|
}
|
|
12654
12638
|
me.__decode(/** @type {RowItemNonNull} */data.rows.item(0), success);
|
|
12655
12639
|
} else if (data.rows.length === 1) {
|
|
@@ -12774,7 +12758,7 @@
|
|
|
12774
12758
|
for (var i = 0; i < data.rows.length; i++) {
|
|
12775
12759
|
var rowItem = /** @type {RowItemNonNull} */data.rows.item(i);
|
|
12776
12760
|
var rowKey = _decode(rowItem[me.__keyColumnName], true);
|
|
12777
|
-
var matches = findMultiEntryMatches(rowKey, me.__range);
|
|
12761
|
+
var matches = findMultiEntryMatches(/** @type {import('./Key.js').Key} */rowKey, me.__range);
|
|
12778
12762
|
ct += matches.length;
|
|
12779
12763
|
}
|
|
12780
12764
|
success(undefined, ct, undefined);
|
|
@@ -12794,7 +12778,7 @@
|
|
|
12794
12778
|
for (var _i = 0; _i < data.rows.length; _i++) {
|
|
12795
12779
|
var _rowItem = /** @type {RowItemNonNull} */data.rows.item(_i);
|
|
12796
12780
|
var _rowKey = _decode(_rowItem[me.__keyColumnName], true);
|
|
12797
|
-
var _matches = findMultiEntryMatches(_rowKey, me.__range);
|
|
12781
|
+
var _matches = findMultiEntryMatches(/** @type {import('./Key.js').Key} */_rowKey, me.__range);
|
|
12798
12782
|
var _iterator = _createForOfIteratorHelper(_matches),
|
|
12799
12783
|
_step;
|
|
12800
12784
|
try {
|
|
@@ -12875,11 +12859,11 @@
|
|
|
12875
12859
|
};
|
|
12876
12860
|
|
|
12877
12861
|
/**
|
|
12878
|
-
* @typedef {
|
|
12862
|
+
* @typedef {import('./Key.js').Value} StructuredCloneValue
|
|
12879
12863
|
*/
|
|
12880
12864
|
|
|
12881
12865
|
/**
|
|
12882
|
-
* @typedef {
|
|
12866
|
+
* @typedef {import('./Key.js').Key} IndexedDBKey
|
|
12883
12867
|
*/
|
|
12884
12868
|
|
|
12885
12869
|
/**
|
|
@@ -12891,9 +12875,9 @@
|
|
|
12891
12875
|
|
|
12892
12876
|
/**
|
|
12893
12877
|
* @callback SuccessCallback
|
|
12894
|
-
* @param {IndexedDBKey} key
|
|
12878
|
+
* @param {IndexedDBKey|undefined} key
|
|
12895
12879
|
* @param {StructuredCloneValue} value
|
|
12896
|
-
* @param {IndexedDBKey} primaryKey
|
|
12880
|
+
* @param {IndexedDBKey|undefined} primaryKey
|
|
12897
12881
|
* @returns {void}
|
|
12898
12882
|
*/
|
|
12899
12883
|
|
|
@@ -12933,9 +12917,9 @@
|
|
|
12933
12917
|
*
|
|
12934
12918
|
* @param {RowItemNonNull} rowItem
|
|
12935
12919
|
* @param {(
|
|
12936
|
-
* key: import('./Key.js').Key,
|
|
12920
|
+
* key: import('./Key.js').Key|undefined,
|
|
12937
12921
|
* val: import('./Key.js').Value,
|
|
12938
|
-
* primaryKey: import('./Key.js').Key,
|
|
12922
|
+
* primaryKey: import('./Key.js').Key|undefined,
|
|
12939
12923
|
* encKey?: string
|
|
12940
12924
|
* ) => void} callback
|
|
12941
12925
|
* @this {IDBCursorFull}
|
|
@@ -13010,8 +12994,8 @@
|
|
|
13010
12994
|
|
|
13011
12995
|
/**
|
|
13012
12996
|
*
|
|
13013
|
-
* @param {import('./Key.js').Key} key
|
|
13014
|
-
* @param {import('./Key.js').Key} primaryKey
|
|
12997
|
+
* @param {import('./Key.js').Key|undefined} key
|
|
12998
|
+
* @param {import('./Key.js').Key|undefined} primaryKey
|
|
13015
12999
|
* @param {boolean} advanceState
|
|
13016
13000
|
* @this {IDBCursorFull}
|
|
13017
13001
|
* @returns {void}
|
|
@@ -13025,9 +13009,9 @@
|
|
|
13025
13009
|
/** @type {import('./IDBTransaction.js').IDBTransactionFull} */
|
|
13026
13010
|
me.__store.transaction.__pushToQueue(me.__request, function cursorContinue(tx, args, success, error, executeNextRequest) {
|
|
13027
13011
|
/**
|
|
13028
|
-
* @param {import('./Key.js').Key} k
|
|
13012
|
+
* @param {import('./Key.js').Key|undefined} k
|
|
13029
13013
|
* @param {import('./Key.js').Value} val
|
|
13030
|
-
* @param {import('./Key.js').Key} primKey
|
|
13014
|
+
* @param {import('./Key.js').Key|undefined} primKey
|
|
13031
13015
|
* @returns {void}
|
|
13032
13016
|
*/
|
|
13033
13017
|
function triggerSuccess(k, val, primKey) {
|
|
@@ -13069,7 +13053,7 @@
|
|
|
13069
13053
|
// We have pre-loaded data for the cursor
|
|
13070
13054
|
me.__prefetchedIndex++;
|
|
13071
13055
|
if (me.__prefetchedIndex < me.__prefetchedData.length) {
|
|
13072
|
-
me.__decode(me.__prefetchedData.item(me.__prefetchedIndex), function (k, val, primKey, encKey) {
|
|
13056
|
+
me.__decode(/** @type {RowItemNonNull} */me.__prefetchedData.item(me.__prefetchedIndex), function (k, val, primKey, encKey) {
|
|
13073
13057
|
/**
|
|
13074
13058
|
* @returns {void}
|
|
13075
13059
|
*/
|
|
@@ -13127,8 +13111,8 @@
|
|
|
13127
13111
|
me.__find(key, primaryKey, tx, triggerSuccess, /** @type {FindError} */
|
|
13128
13112
|
function () {
|
|
13129
13113
|
me.__advanceCount = undefined;
|
|
13130
|
-
for (var
|
|
13131
|
-
args[
|
|
13114
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
13115
|
+
args[_key] = arguments[_key];
|
|
13132
13116
|
}
|
|
13133
13117
|
var t = args[0],
|
|
13134
13118
|
err = args[1];
|
|
@@ -13214,12 +13198,18 @@
|
|
|
13214
13198
|
};
|
|
13215
13199
|
|
|
13216
13200
|
/**
|
|
13217
|
-
*
|
|
13201
|
+
* The `{query, count, direction}` options shape shared by
|
|
13202
|
+
* `getAll`/`getAllKeys`/`getAllRecords`.
|
|
13203
|
+
* @typedef {{
|
|
13204
|
+
* query?: import('./IDBIndex.js').Query|null,
|
|
13205
|
+
* count?: Integer,
|
|
13206
|
+
* direction?: IDBCursorDirection
|
|
13207
|
+
* }} GetAllOptions
|
|
13218
13208
|
*/
|
|
13219
13209
|
|
|
13220
13210
|
/**
|
|
13221
13211
|
*
|
|
13222
|
-
* @param {
|
|
13212
|
+
* @param {import('./Key.js').Value} valueToUpdate
|
|
13223
13213
|
* @this {IDBCursorFull}
|
|
13224
13214
|
* @returns {IDBRequest}
|
|
13225
13215
|
*/
|
|
@@ -13345,25 +13335,22 @@
|
|
|
13345
13335
|
var IDBCursorWithValueAlias = IDBCursorWithValue;
|
|
13346
13336
|
/**
|
|
13347
13337
|
*
|
|
13348
|
-
* @param {
|
|
13338
|
+
* @param {IDBKeyRange} query
|
|
13339
|
+
* @param {string} direction
|
|
13340
|
+
* @param {import('./IDBObjectStore.js').IDBObjectStoreFull} store
|
|
13341
|
+
* @param {import('./IDBObjectStore.js').IDBObjectStoreFull|
|
|
13342
|
+
* import('./IDBIndex.js').IDBIndexFull} source
|
|
13343
|
+
* @param {string} keyColumnName
|
|
13344
|
+
* @param {string} valueColumnName
|
|
13345
|
+
* @param {boolean} [count]
|
|
13349
13346
|
* @returns {IDBCursorWithValueFull}
|
|
13350
13347
|
*/
|
|
13351
|
-
IDBCursorWithValue.__createInstance = function () {
|
|
13352
|
-
for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
|
|
13353
|
-
args[_key4] = arguments[_key4];
|
|
13354
|
-
}
|
|
13348
|
+
IDBCursorWithValue.__createInstance = function (query, direction, store, source, keyColumnName, valueColumnName, count) {
|
|
13355
13349
|
/**
|
|
13356
13350
|
* @class
|
|
13357
13351
|
* @this {IDBCursorWithValueFull}
|
|
13358
13352
|
*/
|
|
13359
13353
|
function IDBCursorWithValue() {
|
|
13360
|
-
var query = args[0],
|
|
13361
|
-
direction = args[1],
|
|
13362
|
-
store = args[2],
|
|
13363
|
-
source = args[3],
|
|
13364
|
-
keyColumnName = args[4],
|
|
13365
|
-
valueColumnName = args[5],
|
|
13366
|
-
count = args[6];
|
|
13367
13354
|
IDBCursor.__super.call(this, query, direction, store, source, keyColumnName, valueColumnName, count);
|
|
13368
13355
|
// @ts-expect-error It's ok
|
|
13369
13356
|
this[Symbol.toStringTag] = 'IDBCursorWithValue';
|
|
@@ -13386,12 +13373,16 @@
|
|
|
13386
13373
|
/**
|
|
13387
13374
|
* Validates `direction` and fills in defaults for the `{query, count,
|
|
13388
13375
|
* direction}` shape shared by `getAll`/`getAllKeys`/`getAllRecords`.
|
|
13389
|
-
* @param {
|
|
13376
|
+
* @param {unknown} options
|
|
13390
13377
|
* @throws {TypeError}
|
|
13391
|
-
* @returns {{
|
|
13378
|
+
* @returns {{
|
|
13379
|
+
* query: import('./IDBIndex.js').Query|null|undefined,
|
|
13380
|
+
* count: Integer|undefined,
|
|
13381
|
+
* direction: string
|
|
13382
|
+
* }}
|
|
13392
13383
|
*/
|
|
13393
13384
|
function normalizeGetAllOptions(options) {
|
|
13394
|
-
var _ref = /** @type {
|
|
13385
|
+
var _ref = /** @type {GetAllOptions} */options !== null && options !== void 0 ? options : {},
|
|
13395
13386
|
query = _ref.query,
|
|
13396
13387
|
count = _ref.count,
|
|
13397
13388
|
_ref$direction = _ref.direction,
|
|
@@ -13420,7 +13411,11 @@
|
|
|
13420
13411
|
* first argument wins regardless of how many arguments were actually passed.
|
|
13421
13412
|
* @param {IArguments} args
|
|
13422
13413
|
* @throws {TypeError}
|
|
13423
|
-
* @returns {{
|
|
13414
|
+
* @returns {{
|
|
13415
|
+
* query: import('./IDBIndex.js').Query|null|undefined,
|
|
13416
|
+
* count: Integer|undefined,
|
|
13417
|
+
* direction: string
|
|
13418
|
+
* }}
|
|
13424
13419
|
*/
|
|
13425
13420
|
function parseGetAllArgs(args) {
|
|
13426
13421
|
var arg0 = args[0];
|
|
@@ -13443,7 +13438,11 @@
|
|
|
13443
13438
|
* form to disambiguate against.
|
|
13444
13439
|
* @param {IArguments} args
|
|
13445
13440
|
* @throws {TypeError}
|
|
13446
|
-
* @returns {{
|
|
13441
|
+
* @returns {{
|
|
13442
|
+
* query: import('./IDBIndex.js').Query|null|undefined,
|
|
13443
|
+
* count: Integer|undefined,
|
|
13444
|
+
* direction: string
|
|
13445
|
+
* }}
|
|
13447
13446
|
*/
|
|
13448
13447
|
function parseGetAllRecordsArgs(args) {
|
|
13449
13448
|
return normalizeGetAllOptions(args[0]);
|
|
@@ -13550,7 +13549,7 @@
|
|
|
13550
13549
|
value: direction
|
|
13551
13550
|
});
|
|
13552
13551
|
return tx.__addToTransactionQueue(function collectAllOp(sqlTx, args, success, error) {
|
|
13553
|
-
/** @type {
|
|
13552
|
+
/** @type {unknown[]} */
|
|
13554
13553
|
var results = [];
|
|
13555
13554
|
var recordsToLoad = count || CFG.cursorPreloadPackSize || 100;
|
|
13556
13555
|
|
|
@@ -13590,7 +13589,7 @@
|
|
|
13590
13589
|
if (state.__prefetchedData) {
|
|
13591
13590
|
state.__prefetchedIndex++;
|
|
13592
13591
|
if (state.__prefetchedIndex < state.__prefetchedData.length) {
|
|
13593
|
-
IDBCursor.prototype.__decode.call(state, state.__prefetchedData.item(state.__prefetchedIndex),
|
|
13592
|
+
IDBCursor.prototype.__decode.call(state, /** @type {RowItemNonNull} */state.__prefetchedData.item(state.__prefetchedIndex),
|
|
13594
13593
|
/**
|
|
13595
13594
|
* @param {import('./Key.js').Key} k
|
|
13596
13595
|
* @param {import('./Key.js').Value} val
|
|
@@ -13620,15 +13619,11 @@
|
|
|
13620
13619
|
}, undefined, source);
|
|
13621
13620
|
}
|
|
13622
13621
|
|
|
13623
|
-
/**
|
|
13624
|
-
* @typedef {any} AnyValue
|
|
13625
|
-
*/
|
|
13626
|
-
|
|
13627
13622
|
/**
|
|
13628
13623
|
* @callback SetConfig
|
|
13629
13624
|
* @param {import('./CFG.js').KeyofConfigValues|
|
|
13630
13625
|
* Partial<import('./CFG.js').ConfigValues>} prop
|
|
13631
|
-
* @param {
|
|
13626
|
+
* @param {import('./CFG.js').ConfigValue} [val]
|
|
13632
13627
|
* @throws {Error}
|
|
13633
13628
|
* @returns {void}
|
|
13634
13629
|
*/
|
|
@@ -13713,18 +13708,9 @@
|
|
|
13713
13708
|
function setGlobalVars(idb, initialConfig) {
|
|
13714
13709
|
var IDB = /** @type {ShimmedObject & {[key: string]: unknown}} */
|
|
13715
13710
|
/** @type {unknown} */globalThis || {};
|
|
13716
|
-
/**
|
|
13717
|
-
* @typedef {any} AnyClass
|
|
13718
|
-
*/
|
|
13719
|
-
/**
|
|
13720
|
-
* @typedef {any} AnyValue
|
|
13721
|
-
*/
|
|
13722
|
-
/**
|
|
13723
|
-
* @typedef {Function} AnyFunction
|
|
13724
|
-
*/
|
|
13725
13711
|
/**
|
|
13726
13712
|
* @param {string} name
|
|
13727
|
-
* @param {
|
|
13713
|
+
* @param {unknown} value
|
|
13728
13714
|
* @param {PropertyDescriptor & {
|
|
13729
13715
|
* shimNS?: object
|
|
13730
13716
|
* }|undefined} [propDesc]
|
|
@@ -13752,7 +13738,7 @@
|
|
|
13752
13738
|
}
|
|
13753
13739
|
} else {
|
|
13754
13740
|
var o = _defineAccessor("get", {}, name, function () {
|
|
13755
|
-
return /** @type {
|
|
13741
|
+
return /** @type {() => unknown} */(/** @type {PropertyDescriptor} */propDesc.get).call(this);
|
|
13756
13742
|
});
|
|
13757
13743
|
desc = /** @type {PropertyDescriptor} */
|
|
13758
13744
|
Object.getOwnPropertyDescriptor(o, name);
|
|
@@ -13826,7 +13812,7 @@
|
|
|
13826
13812
|
return shimIndexedDB;
|
|
13827
13813
|
}
|
|
13828
13814
|
});
|
|
13829
|
-
/** @type {[string,
|
|
13815
|
+
/** @type {[string, unknown][]} */
|
|
13830
13816
|
[['IDBFactory', shimIDBFactory], ['IDBDatabase', IDBDatabase], ['IDBObjectStore', IDBObjectStore], ['IDBIndex', IDBIndex], ['IDBTransaction', IDBTransaction], ['IDBCursor', IDBCursor], ['IDBCursorWithValue', IDBCursorWithValue], ['IDBRecord', IDBRecord], ['IDBKeyRange', IDBKeyRange], ['IDBRequest', IDBRequest], ['IDBOpenDBRequest', IDBOpenDBRequest], ['IDBVersionChangeEvent', IDBVersionChangeEvent]].forEach(function (_ref3) {
|
|
13831
13817
|
var _ref4 = _slicedToArray(_ref3, 2),
|
|
13832
13818
|
prop = _ref4[0],
|
|
@@ -13915,7 +13901,7 @@
|
|
|
13915
13901
|
IDB.shimIndexedDB = /** @type {ShimIndexedDB} */{};
|
|
13916
13902
|
/** @type {const} */
|
|
13917
13903
|
['__useShim', '__debug', '__setConfig', '__getConfig', '__setUnicodeIdentifiers'].forEach(function (prop) {
|
|
13918
|
-
/** @type {
|
|
13904
|
+
/** @type {{[key: string]: () => void}} */(/** @type {unknown} */IDB.shimIndexedDB)[prop] = function () {
|
|
13919
13905
|
console.warn('This browser does not have WebSQL to shim.');
|
|
13920
13906
|
};
|
|
13921
13907
|
});
|