indexeddbshim 18.0.0 → 19.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/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 +12 -12
- 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 +224 -208
- package/dist/indexeddbshim-UnicodeIdentifiers-node.cjs.map +1 -1
- package/dist/indexeddbshim-UnicodeIdentifiers.js +221 -235
- 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 +224 -208
- package/dist/indexeddbshim-node.cjs.map +1 -1
- package/dist/indexeddbshim-noninvasive.js +221 -235
- 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 +221 -235
- 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 +32 -27
- 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
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! indexeddbshim -
|
|
1
|
+
/*! indexeddbshim - v19.0.0 - 9/3/2026 */
|
|
2
2
|
|
|
3
3
|
(function (global, factory) {
|
|
4
4
|
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
|
|
@@ -52,13 +52,6 @@
|
|
|
52
52
|
function _classCallCheck(a, n) {
|
|
53
53
|
if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function");
|
|
54
54
|
}
|
|
55
|
-
function _construct(t, e, r) {
|
|
56
|
-
if (_isNativeReflectConstruct()) return Reflect.construct.apply(null, arguments);
|
|
57
|
-
var o = [null];
|
|
58
|
-
o.push.apply(o, e);
|
|
59
|
-
var p = new (t.bind.apply(t, o))();
|
|
60
|
-
return p;
|
|
61
|
-
}
|
|
62
55
|
function _defineProperties(e, r) {
|
|
63
56
|
for (var t = 0; t < r.length; t++) {
|
|
64
57
|
var o = r[t];
|
|
@@ -1920,7 +1913,7 @@
|
|
|
1920
1913
|
// Callback not used by default
|
|
1921
1914
|
// Defaults to true except in Node builds where we can preserve literal NUL with better-sqlite3
|
|
1922
1915
|
'escapeNULForSQLiteStatements', 'sqlMemoryQuota', 'createIndexes'].forEach(function (prop) {
|
|
1923
|
-
/** @type {(val:
|
|
1916
|
+
/** @type {(val: ConfigValue) => void} */
|
|
1924
1917
|
var validator;
|
|
1925
1918
|
if (Array.isArray(prop)) {
|
|
1926
1919
|
var _prop = prop;
|
|
@@ -2141,9 +2134,11 @@
|
|
|
2141
2134
|
return base.replace(/[\/\\]+$/, '') + sep + name;
|
|
2142
2135
|
}
|
|
2143
2136
|
|
|
2137
|
+
/* eslint-disable jsdoc/valid-types -- Bug */
|
|
2144
2138
|
/**
|
|
2145
|
-
* @typedef {
|
|
2139
|
+
* @typedef {{[Symbol.hasInstance]: (value: unknown) => boolean}} AnyClass
|
|
2146
2140
|
*/
|
|
2141
|
+
/* eslint-enable jsdoc/valid-types -- Bug */
|
|
2147
2142
|
|
|
2148
2143
|
// Babel doesn't seem to provide a means of using the `instanceof` operator with Symbol.hasInstance (yet?)
|
|
2149
2144
|
/**
|
|
@@ -2167,7 +2162,7 @@
|
|
|
2167
2162
|
|
|
2168
2163
|
/**
|
|
2169
2164
|
*
|
|
2170
|
-
* @param {
|
|
2165
|
+
* @param {AnyValue} obj
|
|
2171
2166
|
* @returns {boolean}
|
|
2172
2167
|
*/
|
|
2173
2168
|
function isDate(obj) {
|
|
@@ -2176,7 +2171,7 @@
|
|
|
2176
2171
|
|
|
2177
2172
|
/**
|
|
2178
2173
|
*
|
|
2179
|
-
* @param {
|
|
2174
|
+
* @param {AnyValue} obj
|
|
2180
2175
|
* @returns {boolean}
|
|
2181
2176
|
*/
|
|
2182
2177
|
function isBlob(obj) {
|
|
@@ -2185,7 +2180,7 @@
|
|
|
2185
2180
|
|
|
2186
2181
|
/**
|
|
2187
2182
|
*
|
|
2188
|
-
* @param {
|
|
2183
|
+
* @param {AnyValue} obj
|
|
2189
2184
|
* @returns {boolean}
|
|
2190
2185
|
*/
|
|
2191
2186
|
function isFile(obj) {
|
|
@@ -2207,7 +2202,7 @@
|
|
|
2207
2202
|
/**
|
|
2208
2203
|
*
|
|
2209
2204
|
* @param {AnyValue} obj
|
|
2210
|
-
* @returns {
|
|
2205
|
+
* @returns {obj is Iterable<unknown>}
|
|
2211
2206
|
*/
|
|
2212
2207
|
function isIterable(obj) {
|
|
2213
2208
|
return isObj(obj) &&
|
|
@@ -2253,9 +2248,7 @@
|
|
|
2253
2248
|
|
|
2254
2249
|
/**
|
|
2255
2250
|
*
|
|
2256
|
-
* @param {object
|
|
2257
|
-
* [key: string]: any
|
|
2258
|
-
* }} obj
|
|
2251
|
+
* @param {object} obj
|
|
2259
2252
|
* @param {string[]} listeners
|
|
2260
2253
|
* @returns {void}
|
|
2261
2254
|
*/
|
|
@@ -2263,9 +2256,9 @@
|
|
|
2263
2256
|
listeners = typeof listeners === 'string' ? [listeners] : listeners;
|
|
2264
2257
|
listeners.forEach(function (listener) {
|
|
2265
2258
|
var o = _defineAccessor("set", _defineAccessor("get", {}, listener, function () {
|
|
2266
|
-
return obj
|
|
2259
|
+
return Reflect.get(obj, '__' + listener);
|
|
2267
2260
|
}), listener, function (val) {
|
|
2268
|
-
obj
|
|
2261
|
+
Reflect.set(obj, '__' + listener, val);
|
|
2269
2262
|
});
|
|
2270
2263
|
var desc = /** @type {PropertyDescriptor} */
|
|
2271
2264
|
Object.getOwnPropertyDescriptor(o, listener);
|
|
@@ -2274,7 +2267,7 @@
|
|
|
2274
2267
|
Object.defineProperty(obj, listener, desc);
|
|
2275
2268
|
});
|
|
2276
2269
|
listeners.forEach(function (l) {
|
|
2277
|
-
obj
|
|
2270
|
+
Reflect.set(obj, l, null);
|
|
2278
2271
|
});
|
|
2279
2272
|
}
|
|
2280
2273
|
|
|
@@ -2283,7 +2276,7 @@
|
|
|
2283
2276
|
* @param {object} obj
|
|
2284
2277
|
* @param {string|string[]} props
|
|
2285
2278
|
* @param {null|{
|
|
2286
|
-
* [key: string]:
|
|
2279
|
+
* [key: string]: unknown
|
|
2287
2280
|
* }} getter
|
|
2288
2281
|
* @returns {void}
|
|
2289
2282
|
*/
|
|
@@ -2419,7 +2412,7 @@
|
|
|
2419
2412
|
}
|
|
2420
2413
|
|
|
2421
2414
|
/**
|
|
2422
|
-
* @typedef {
|
|
2415
|
+
* @typedef {unknown} AnyValue
|
|
2423
2416
|
*/
|
|
2424
2417
|
|
|
2425
2418
|
/**
|
|
@@ -2437,8 +2430,11 @@
|
|
|
2437
2430
|
*/
|
|
2438
2431
|
function ToString(o) {
|
|
2439
2432
|
// Todo: See `es-abstract/es7`
|
|
2440
|
-
// `String()` will not throw with Symbols
|
|
2441
|
-
|
|
2433
|
+
// `String()` will not throw with Symbols, but the unchecked `+ ''`
|
|
2434
|
+
// coercion deliberately does (Web IDL requires converting a symbol
|
|
2435
|
+
// to `DOMString` to throw a `TypeError`); the assertion only tells
|
|
2436
|
+
// the compiler to allow the coercion it cannot model.
|
|
2437
|
+
return '' + (/** @type {string} */o); // eslint-disable-line no-implicit-coercion -- Need to throw with symbols
|
|
2442
2438
|
}
|
|
2443
2439
|
|
|
2444
2440
|
/**
|
|
@@ -2545,12 +2541,9 @@
|
|
|
2545
2541
|
// We don't add within polyfill repo as might not always be the desired implementation
|
|
2546
2542
|
Object.defineProperty(ShimEvent, Symbol.hasInstance, {
|
|
2547
2543
|
/* eslint-enable unicorn/no-top-level-side-effects -- Would be good */
|
|
2548
|
-
/**
|
|
2549
|
-
* @typedef {any} AnyValue
|
|
2550
|
-
*/
|
|
2551
2544
|
value:
|
|
2552
2545
|
/**
|
|
2553
|
-
* @param {
|
|
2546
|
+
* @param {unknown} obj
|
|
2554
2547
|
* @returns {boolean}
|
|
2555
2548
|
*/
|
|
2556
2549
|
function value(obj) {
|
|
@@ -2621,12 +2614,9 @@
|
|
|
2621
2614
|
Object.defineProperty(IDBVersionChangeEvent.prototype, prop, desc);
|
|
2622
2615
|
});
|
|
2623
2616
|
Object.defineProperty(IDBVersionChangeEvent, Symbol.hasInstance, {
|
|
2624
|
-
/**
|
|
2625
|
-
* @typedef {any} AnyValue
|
|
2626
|
-
*/
|
|
2627
2617
|
value:
|
|
2628
2618
|
/**
|
|
2629
|
-
* @param {
|
|
2619
|
+
* @param {unknown} obj
|
|
2630
2620
|
* @returns {boolean}
|
|
2631
2621
|
*/
|
|
2632
2622
|
function value(obj) {
|
|
@@ -2908,25 +2898,20 @@
|
|
|
2908
2898
|
}
|
|
2909
2899
|
|
|
2910
2900
|
/**
|
|
2911
|
-
* @
|
|
2912
|
-
*/
|
|
2913
|
-
|
|
2914
|
-
/**
|
|
2915
|
-
* @param {ArbitraryValue} obj
|
|
2901
|
+
* @param {unknown} obj
|
|
2916
2902
|
* @returns {boolean}
|
|
2917
2903
|
*/
|
|
2918
2904
|
function isErrorOrDOMErrorOrDOMException(obj) {
|
|
2919
|
-
return obj && _typeof(obj) === 'object' &&
|
|
2920
2905
|
// We don't use util.isObj here as mutual dependency causing problems in Babel with browser
|
|
2921
|
-
typeof obj.name === 'string';
|
|
2906
|
+
return _typeof(obj) === 'object' && obj !== null && 'name' in obj && typeof obj.name === 'string';
|
|
2922
2907
|
}
|
|
2923
2908
|
|
|
2924
2909
|
/**
|
|
2925
2910
|
* Finds the error argument. This is useful because some WebSQL callbacks
|
|
2926
2911
|
* pass the error as the first argument, and some pass it as the second
|
|
2927
2912
|
* argument.
|
|
2928
|
-
* @param {
|
|
2929
|
-
* @returns {
|
|
2913
|
+
* @param {unknown[]} args
|
|
2914
|
+
* @returns {unknown}
|
|
2930
2915
|
*/
|
|
2931
2916
|
function findError(args) {
|
|
2932
2917
|
var err;
|
|
@@ -2942,7 +2927,7 @@
|
|
|
2942
2927
|
if (isErrorOrDOMErrorOrDOMException(arg)) {
|
|
2943
2928
|
return arg;
|
|
2944
2929
|
}
|
|
2945
|
-
if (arg && typeof arg.message === 'string') {
|
|
2930
|
+
if (_typeof(arg) === 'object' && arg !== null && 'message' in arg && typeof arg.message === 'string') {
|
|
2946
2931
|
err = arg;
|
|
2947
2932
|
}
|
|
2948
2933
|
}
|
|
@@ -3067,7 +3052,7 @@
|
|
|
3067
3052
|
* @typedef {IDBRequest & EventTarget & import('eventtargeter').EventTargetInstance & {
|
|
3068
3053
|
* transaction: import('./IDBTransaction.js').IDBTransactionFull,
|
|
3069
3054
|
* __done: boolean,
|
|
3070
|
-
* __result:
|
|
3055
|
+
* __result: unknown,
|
|
3071
3056
|
* __error: null|DOMException|Error,
|
|
3072
3057
|
* __source: null|import('./IDBDatabase.js').IDBDatabaseFull|
|
|
3073
3058
|
* import('./IDBObjectStore.js').IDBObjectStoreFull|
|
|
@@ -3537,8 +3522,8 @@
|
|
|
3537
3522
|
|
|
3538
3523
|
/**
|
|
3539
3524
|
* Compares two keys.
|
|
3540
|
-
* @param {import('./Key.js').Key} first
|
|
3541
|
-
* @param {import('./Key.js').Key} second
|
|
3525
|
+
* @param {import('./Key.js').Key|null|undefined} first
|
|
3526
|
+
* @param {import('./Key.js').Key|null|undefined} second
|
|
3542
3527
|
* @returns {0|1|-1}
|
|
3543
3528
|
*/
|
|
3544
3529
|
function cmp(first, second) {
|
|
@@ -3615,12 +3600,11 @@
|
|
|
3615
3600
|
*/
|
|
3616
3601
|
|
|
3617
3602
|
/**
|
|
3618
|
-
* @typedef {
|
|
3603
|
+
* @typedef {unknown} Value
|
|
3619
3604
|
*/
|
|
3620
3605
|
|
|
3621
3606
|
/**
|
|
3622
|
-
* @typedef {
|
|
3623
|
-
* @todo Specify possible value more precisely
|
|
3607
|
+
* @typedef {IDBValidKey} Key
|
|
3624
3608
|
*/
|
|
3625
3609
|
|
|
3626
3610
|
/**
|
|
@@ -3687,15 +3671,11 @@
|
|
|
3687
3671
|
*/
|
|
3688
3672
|
var signValues = ['negativeInfinity', 'bigNegative', 'smallNegative', 'smallPositive', 'bigPositive', 'positiveInfinity'];
|
|
3689
3673
|
|
|
3690
|
-
/**
|
|
3691
|
-
* @typedef {any} AnyValue
|
|
3692
|
-
*/
|
|
3693
|
-
|
|
3694
3674
|
/**
|
|
3695
3675
|
* @type {{
|
|
3696
3676
|
* [key: string]: {
|
|
3697
|
-
* encode
|
|
3698
|
-
* decode
|
|
3677
|
+
* encode(param: unknown, inArray?: boolean): string,
|
|
3678
|
+
* decode(param: string, inArray?: boolean): ValueType|undefined
|
|
3699
3679
|
* }
|
|
3700
3680
|
* }}
|
|
3701
3681
|
*/
|
|
@@ -4050,7 +4030,7 @@
|
|
|
4050
4030
|
}
|
|
4051
4031
|
|
|
4052
4032
|
/**
|
|
4053
|
-
* @param {
|
|
4033
|
+
* @param {Value} key
|
|
4054
4034
|
* @returns {KeyType|"invalid"}
|
|
4055
4035
|
*/
|
|
4056
4036
|
function getKeyType(key) {
|
|
@@ -4194,7 +4174,7 @@
|
|
|
4194
4174
|
case 'array':
|
|
4195
4175
|
{
|
|
4196
4176
|
// May throw (from binary)
|
|
4197
|
-
var arr = /** @type {
|
|
4177
|
+
var arr = /** @type {unknown[]} */input;
|
|
4198
4178
|
var len = arr.length;
|
|
4199
4179
|
safePush(seen, input);
|
|
4200
4180
|
|
|
@@ -4227,9 +4207,9 @@
|
|
|
4227
4207
|
};
|
|
4228
4208
|
}
|
|
4229
4209
|
if (!multiEntry || !fullKeys && keys.every(function (k) {
|
|
4230
|
-
return cmp(k, key.value) !== 0;
|
|
4210
|
+
return cmp(/** @type {Key} */k, /** @type {Key} */key.value) !== 0;
|
|
4231
4211
|
}) || fullKeys && keys.every(function (k) {
|
|
4232
|
-
return cmp(k, key) !== 0;
|
|
4212
|
+
return cmp(/** @type {Key} */k, /** @type {Key} */ /** @type {unknown} */key) !== 0;
|
|
4233
4213
|
})) {
|
|
4234
4214
|
safePush(keys, fullKeys ? key : key.value);
|
|
4235
4215
|
}
|
|
@@ -4286,7 +4266,7 @@
|
|
|
4286
4266
|
|
|
4287
4267
|
/**
|
|
4288
4268
|
*
|
|
4289
|
-
* @param {
|
|
4269
|
+
* @param {Value} key
|
|
4290
4270
|
* @param {boolean} [fullKeys]
|
|
4291
4271
|
* @returns {KeyValueObject}
|
|
4292
4272
|
* @todo Document other allowable `key`?
|
|
@@ -4401,7 +4381,7 @@
|
|
|
4401
4381
|
}
|
|
4402
4382
|
if (keyPath === '') {
|
|
4403
4383
|
return {
|
|
4404
|
-
value: value
|
|
4384
|
+
value: (/** @type {KeyPathEvaluateValueValue} */value)
|
|
4405
4385
|
};
|
|
4406
4386
|
}
|
|
4407
4387
|
var identifiers = keyPath.split('.');
|
|
@@ -4435,13 +4415,13 @@
|
|
|
4435
4415
|
}) ? {
|
|
4436
4416
|
failure: true
|
|
4437
4417
|
} : {
|
|
4438
|
-
value: value
|
|
4418
|
+
value: (/** @type {KeyPathEvaluateValueValue} */value)
|
|
4439
4419
|
};
|
|
4440
4420
|
}
|
|
4441
4421
|
|
|
4442
4422
|
/**
|
|
4443
4423
|
* Sets the inline key value.
|
|
4444
|
-
* @param {{[key: string]:
|
|
4424
|
+
* @param {{[key: string]: Value}} value
|
|
4445
4425
|
* @param {Key} key
|
|
4446
4426
|
* @param {string} keyPath
|
|
4447
4427
|
* @returns {void}
|
|
@@ -4459,7 +4439,7 @@
|
|
|
4459
4439
|
configurable: true
|
|
4460
4440
|
});
|
|
4461
4441
|
}
|
|
4462
|
-
value = value[identifier];
|
|
4442
|
+
value = /** @type {{[key: string]: Value}} */value[identifier];
|
|
4463
4443
|
});
|
|
4464
4444
|
Object.defineProperty(value, /** @type {string} */last, {
|
|
4465
4445
|
value: key,
|
|
@@ -4544,7 +4524,7 @@
|
|
|
4544
4524
|
* @returns {Key[]}
|
|
4545
4525
|
*/
|
|
4546
4526
|
function findMultiEntryMatches(keyEntry, range) {
|
|
4547
|
-
/** @type {
|
|
4527
|
+
/** @type {Key[]} */
|
|
4548
4528
|
var matches = [];
|
|
4549
4529
|
if (Array.isArray(keyEntry)) {
|
|
4550
4530
|
var _iterator4 = _createForOfIteratorHelper(keyEntry),
|
|
@@ -4583,7 +4563,7 @@
|
|
|
4583
4563
|
|
|
4584
4564
|
/**
|
|
4585
4565
|
* Not currently in use but keeping for spec parity.
|
|
4586
|
-
* @param {
|
|
4566
|
+
* @param {KeyValueObject} key
|
|
4587
4567
|
* @throws {Error} Upon a "bad key"
|
|
4588
4568
|
* @returns {ValueType}
|
|
4589
4569
|
*/
|
|
@@ -4594,16 +4574,17 @@
|
|
|
4594
4574
|
case 'number':
|
|
4595
4575
|
case 'string':
|
|
4596
4576
|
{
|
|
4597
|
-
return value;
|
|
4577
|
+
return /** @type {number|string} */value;
|
|
4598
4578
|
}
|
|
4599
4579
|
case 'array':
|
|
4600
4580
|
{
|
|
4601
4581
|
/** @type {ValueType[]} */
|
|
4602
4582
|
var array = [];
|
|
4603
|
-
var
|
|
4583
|
+
var arrValue = /** @type {KeyValueObject[]} */value;
|
|
4584
|
+
var len = arrValue.length;
|
|
4604
4585
|
var index = 0;
|
|
4605
4586
|
while (index < len) {
|
|
4606
|
-
var entry = convertKeyToValue(
|
|
4587
|
+
var entry = convertKeyToValue(arrValue[index]);
|
|
4607
4588
|
setArrayValue(array, index, entry);
|
|
4608
4589
|
index++;
|
|
4609
4590
|
}
|
|
@@ -4611,18 +4592,18 @@
|
|
|
4611
4592
|
}
|
|
4612
4593
|
case 'date':
|
|
4613
4594
|
{
|
|
4614
|
-
return new Date(value);
|
|
4595
|
+
return new Date(/** @type {number} */value);
|
|
4615
4596
|
}
|
|
4616
4597
|
case 'binary':
|
|
4617
4598
|
{
|
|
4618
|
-
var
|
|
4599
|
+
var binValue = /** @type {Uint8Array} */value;
|
|
4600
|
+
var _len = binValue.length;
|
|
4619
4601
|
var buffer = new ArrayBuffer(_len);
|
|
4620
4602
|
// Set the entries in buffer's [[ArrayBufferData]] to those in `value`
|
|
4621
|
-
var uint8 = new Uint8Array(buffer,
|
|
4622
|
-
uint8.set(
|
|
4603
|
+
var uint8 = new Uint8Array(buffer, binValue.byteOffset || 0, binValue.byteLength);
|
|
4604
|
+
uint8.set(binValue);
|
|
4623
4605
|
return buffer;
|
|
4624
4606
|
}
|
|
4625
|
-
case 'invalid':
|
|
4626
4607
|
default:
|
|
4627
4608
|
throw new Error('Bad key');
|
|
4628
4609
|
}
|
|
@@ -4630,7 +4611,7 @@
|
|
|
4630
4611
|
|
|
4631
4612
|
/**
|
|
4632
4613
|
*
|
|
4633
|
-
* @param {
|
|
4614
|
+
* @param {Value} key
|
|
4634
4615
|
* @param {boolean} [inArray]
|
|
4635
4616
|
* @returns {string|null}
|
|
4636
4617
|
*/
|
|
@@ -4645,7 +4626,7 @@
|
|
|
4645
4626
|
|
|
4646
4627
|
/**
|
|
4647
4628
|
*
|
|
4648
|
-
* @param {
|
|
4629
|
+
* @param {string|null} key
|
|
4649
4630
|
* @param {boolean} [inArray]
|
|
4650
4631
|
* @throws {Error} Invalid number
|
|
4651
4632
|
* @returns {undefined|ValueType}
|
|
@@ -4659,7 +4640,7 @@
|
|
|
4659
4640
|
|
|
4660
4641
|
/**
|
|
4661
4642
|
*
|
|
4662
|
-
* @param {
|
|
4643
|
+
* @param {Value} key
|
|
4663
4644
|
* @param {boolean} [inArray]
|
|
4664
4645
|
* @returns {undefined|ValueType}
|
|
4665
4646
|
*/
|
|
@@ -4877,8 +4858,8 @@
|
|
|
4877
4858
|
var IDBKeyRangeAlias = IDBKeyRange;
|
|
4878
4859
|
|
|
4879
4860
|
/**
|
|
4880
|
-
* @param {import('./Key.js').
|
|
4881
|
-
* @param {import('./Key.js').
|
|
4861
|
+
* @param {import('./Key.js').Value} lower
|
|
4862
|
+
* @param {import('./Key.js').Value} upper
|
|
4882
4863
|
* @param {boolean} lowerOpen
|
|
4883
4864
|
* @param {boolean} upperOpen
|
|
4884
4865
|
* @returns {import('./IDBKeyRange.js').IDBKeyRangeFull}
|
|
@@ -5075,10 +5056,11 @@
|
|
|
5075
5056
|
function convertValueToKeyRange(value, nullDisallowed) {
|
|
5076
5057
|
if (instanceOf(value, IDBKeyRange)) {
|
|
5077
5058
|
// We still need to validate IDBKeyRange-like objects (the above check is based on loose duck-typing)
|
|
5078
|
-
|
|
5079
|
-
|
|
5059
|
+
var range = /** @type {IDBKeyRangeFull} */value;
|
|
5060
|
+
if (range.toString() !== '[object IDBKeyRange]') {
|
|
5061
|
+
return IDBKeyRange.__createInstance(range.lower, range.upper, range.lowerOpen, range.upperOpen);
|
|
5080
5062
|
}
|
|
5081
|
-
return
|
|
5063
|
+
return range;
|
|
5082
5064
|
}
|
|
5083
5065
|
if (isNullish(value)) {
|
|
5084
5066
|
if (nullDisallowed) {
|
|
@@ -5105,7 +5087,7 @@
|
|
|
5105
5087
|
* clone: () => DOMStringListFull,
|
|
5106
5088
|
* contains: (str: string) => boolean,
|
|
5107
5089
|
* indexOf: (str: string) => Integer,
|
|
5108
|
-
* splice: (index: Integer, howmany: Integer, ...args:
|
|
5090
|
+
* splice: (index: Integer, howmany: Integer, ...args: string[]) => void
|
|
5109
5091
|
* length: Integer
|
|
5110
5092
|
* }} DOMStringListFull
|
|
5111
5093
|
*/
|
|
@@ -5221,9 +5203,10 @@
|
|
|
5221
5203
|
},
|
|
5222
5204
|
/**
|
|
5223
5205
|
* @this {DOMStringListFull}
|
|
5224
|
-
* @
|
|
5206
|
+
* @template T
|
|
5207
|
+
* @param {(value: string, i: Integer, arr: string[]) => T} cb
|
|
5225
5208
|
* @param {object} thisArg
|
|
5226
|
-
* @returns {
|
|
5209
|
+
* @returns {T[]}
|
|
5227
5210
|
*/
|
|
5228
5211
|
map: function map(cb, thisArg) {
|
|
5229
5212
|
// eslint-disable-next-line unicorn/no-array-callback-reference, unicorn/no-array-method-this-argument -- Convenient
|
|
@@ -5248,10 +5231,7 @@
|
|
|
5248
5231
|
this.sortList();
|
|
5249
5232
|
},
|
|
5250
5233
|
/**
|
|
5251
|
-
* @
|
|
5252
|
-
*/
|
|
5253
|
-
/**
|
|
5254
|
-
* @param {[index: Integer, howmany: Integer, ...args: any]} args
|
|
5234
|
+
* @param {[index: Integer, howmany: Integer, ...args: string[]]} args
|
|
5255
5235
|
* @this {DOMStringListFull}
|
|
5256
5236
|
* @returns {void}
|
|
5257
5237
|
*/
|
|
@@ -5289,12 +5269,9 @@
|
|
|
5289
5269
|
}));
|
|
5290
5270
|
|
|
5291
5271
|
/* eslint-disable unicorn/no-top-level-side-effects -- Would be good */
|
|
5292
|
-
/**
|
|
5293
|
-
* @typedef {any} AnyValue
|
|
5294
|
-
*/
|
|
5295
5272
|
Object.defineProperty(DOMStringList, Symbol.hasInstance, {
|
|
5296
5273
|
/**
|
|
5297
|
-
* @param {
|
|
5274
|
+
* @param {unknown} obj
|
|
5298
5275
|
* @returns {boolean}
|
|
5299
5276
|
*/
|
|
5300
5277
|
value: function value(obj) {
|
|
@@ -5375,7 +5352,7 @@
|
|
|
5375
5352
|
/**
|
|
5376
5353
|
* @typedef {{
|
|
5377
5354
|
* op: SQLCallback,
|
|
5378
|
-
* args:
|
|
5355
|
+
* args: unknown[],
|
|
5379
5356
|
* req: import('./IDBRequest.js').IDBRequestFull|null
|
|
5380
5357
|
* }} RequestInfo
|
|
5381
5358
|
*/
|
|
@@ -5427,17 +5404,17 @@
|
|
|
5427
5404
|
* __pushToQueue: (
|
|
5428
5405
|
* request: import('./IDBRequest.js').IDBRequestFull|null,
|
|
5429
5406
|
* callback: SQLCallback,
|
|
5430
|
-
* args?:
|
|
5407
|
+
* args?: unknown[]
|
|
5431
5408
|
* ) => void,
|
|
5432
5409
|
* __assertActive: () => void,
|
|
5433
5410
|
* commit: () => void,
|
|
5434
5411
|
* __addNonRequestToTransactionQueue: (
|
|
5435
5412
|
* callback: SQLCallback,
|
|
5436
|
-
* args?:
|
|
5413
|
+
* args?: unknown[]
|
|
5437
5414
|
* ) => void
|
|
5438
5415
|
* __addToTransactionQueue: (
|
|
5439
5416
|
* callback: SQLCallback,
|
|
5440
|
-
* args:
|
|
5417
|
+
* args: unknown[]|undefined,
|
|
5441
5418
|
* source: import('./IDBDatabase.js').IDBDatabaseFull|
|
|
5442
5419
|
* import('./IDBObjectStore.js').IDBObjectStoreFull|
|
|
5443
5420
|
* import('./IDBIndex.js').IDBIndexFull|
|
|
@@ -5639,7 +5616,7 @@
|
|
|
5639
5616
|
i = -1;
|
|
5640
5617
|
|
|
5641
5618
|
/**
|
|
5642
|
-
* @typedef {
|
|
5619
|
+
* @typedef {unknown} IDBRequestResult
|
|
5643
5620
|
*/
|
|
5644
5621
|
|
|
5645
5622
|
/**
|
|
@@ -6075,8 +6052,8 @@
|
|
|
6075
6052
|
/**
|
|
6076
6053
|
* @typedef {(
|
|
6077
6054
|
* tx: import('websql-configurable/lib/websql/WebSQLTransaction.js').default,
|
|
6078
|
-
* args:
|
|
6079
|
-
* success: (result?:
|
|
6055
|
+
* args: unknown[],
|
|
6056
|
+
* success: (result?: unknown, req?: import('./IDBRequest.js').IDBRequestFull) => void,
|
|
6080
6057
|
* error: (
|
|
6081
6058
|
* tx: import('websql-configurable/lib/websql/WebSQLTransaction.js').default|Error|DOMException,
|
|
6082
6059
|
* err?: Error & {code?: number}
|
|
@@ -6088,7 +6065,7 @@
|
|
|
6088
6065
|
/**
|
|
6089
6066
|
* Adds a callback function to the transaction queue.
|
|
6090
6067
|
* @param {SQLCallback} callback
|
|
6091
|
-
* @param {
|
|
6068
|
+
* @param {unknown[]} args
|
|
6092
6069
|
* @param {import('./IDBDatabase.js').IDBDatabaseFull|
|
|
6093
6070
|
* import('./IDBObjectStore.js').IDBObjectStoreFull|
|
|
6094
6071
|
* import('./IDBIndex.js').IDBIndexFull} source
|
|
@@ -6105,7 +6082,7 @@
|
|
|
6105
6082
|
* Adds a callback function to the transaction queue without generating a
|
|
6106
6083
|
* request.
|
|
6107
6084
|
* @param {SQLCallback} callback
|
|
6108
|
-
* @param {
|
|
6085
|
+
* @param {unknown[]} args
|
|
6109
6086
|
* @this {IDBTransactionFull}
|
|
6110
6087
|
* @returns {void}
|
|
6111
6088
|
*/
|
|
@@ -6117,7 +6094,7 @@
|
|
|
6117
6094
|
* Adds an IDBRequest to the transaction queue.
|
|
6118
6095
|
* @param {import('./IDBRequest.js').IDBRequestFull|null} request
|
|
6119
6096
|
* @param {SQLCallback} callback
|
|
6120
|
-
* @param {
|
|
6097
|
+
* @param {unknown[]} args
|
|
6121
6098
|
* @this {IDBTransactionFull}
|
|
6122
6099
|
* @returns {void}
|
|
6123
6100
|
*/
|
|
@@ -6288,7 +6265,7 @@
|
|
|
6288
6265
|
bubbles: true,
|
|
6289
6266
|
cancelable: true
|
|
6290
6267
|
});
|
|
6291
|
-
return new SyncPromise(/** @type {(resolve: (value?:
|
|
6268
|
+
return new SyncPromise(/** @type {(resolve: (value?: unknown) => void) => void} */
|
|
6292
6269
|
function (resolve) {
|
|
6293
6270
|
setTimeout(function () {
|
|
6294
6271
|
if (!q.req) {
|
|
@@ -8451,7 +8428,7 @@
|
|
|
8451
8428
|
}
|
|
8452
8429
|
|
|
8453
8430
|
/**
|
|
8454
|
-
* @typedef {
|
|
8431
|
+
* @typedef {import('./Key.js').Value} AnyValue
|
|
8455
8432
|
*/
|
|
8456
8433
|
|
|
8457
8434
|
/**
|
|
@@ -8561,7 +8538,7 @@
|
|
|
8561
8538
|
* __keyPath: import('./Key.js').KeyPath,
|
|
8562
8539
|
* __recreated?: boolean,
|
|
8563
8540
|
* __fetchIndexData: (
|
|
8564
|
-
* range:
|
|
8541
|
+
* range: Query,
|
|
8565
8542
|
* opType: "value"|"key"|"count",
|
|
8566
8543
|
* nullDisallowed: boolean,
|
|
8567
8544
|
* count?: number
|
|
@@ -8933,7 +8910,7 @@
|
|
|
8933
8910
|
};
|
|
8934
8911
|
|
|
8935
8912
|
/**
|
|
8936
|
-
* @typedef {
|
|
8913
|
+
* @typedef {import('./Key.js').Value|IDBKeyRange} Query
|
|
8937
8914
|
*/
|
|
8938
8915
|
|
|
8939
8916
|
/**
|
|
@@ -9216,7 +9193,7 @@
|
|
|
9216
9193
|
reject(err);
|
|
9217
9194
|
});
|
|
9218
9195
|
}));
|
|
9219
|
-
SyncPromise.all(indexCreations).then(finish).catch(/** @type {(reason:
|
|
9196
|
+
SyncPromise.all(indexCreations).then(finish).catch(/** @type {(reason: unknown) => PromiseLike<never>} */
|
|
9220
9197
|
error).catch(function (err) {
|
|
9221
9198
|
console.log('Index rename error');
|
|
9222
9199
|
throw err;
|
|
@@ -9228,14 +9205,10 @@
|
|
|
9228
9205
|
});
|
|
9229
9206
|
};
|
|
9230
9207
|
|
|
9231
|
-
/**
|
|
9232
|
-
* @typedef {any} AnyValue
|
|
9233
|
-
*/
|
|
9234
|
-
|
|
9235
9208
|
/* eslint-disable unicorn/no-top-level-side-effects -- Would be good */
|
|
9236
9209
|
Object.defineProperty(IDBIndex, Symbol.hasInstance, {
|
|
9237
9210
|
/**
|
|
9238
|
-
* @param {
|
|
9211
|
+
* @param {unknown} obj
|
|
9239
9212
|
* @returns {boolean}
|
|
9240
9213
|
*/
|
|
9241
9214
|
value: function value(obj) {
|
|
@@ -9263,7 +9236,9 @@
|
|
|
9263
9236
|
* @param {string[]} sqlValues
|
|
9264
9237
|
* @param {WebSQLTransaction} tx
|
|
9265
9238
|
* @param {null|undefined} args
|
|
9266
|
-
* @param {(
|
|
9239
|
+
* @param {(
|
|
9240
|
+
* result: number|undefined|[]|import('./Key.js').Value|import('./Key.js').Value[]
|
|
9241
|
+
* ) => void} success
|
|
9267
9242
|
* @param {(tx: WebSQLTransaction, err: (Error & {code?: number})) => void} error
|
|
9268
9243
|
* @returns {void}
|
|
9269
9244
|
*/
|
|
@@ -9300,7 +9275,7 @@
|
|
|
9300
9275
|
* @param {{
|
|
9301
9276
|
* value: string
|
|
9302
9277
|
* }} record
|
|
9303
|
-
* @returns {
|
|
9278
|
+
* @returns {import('./Key.js').Value}
|
|
9304
9279
|
*/
|
|
9305
9280
|
function (record) {
|
|
9306
9281
|
// when opType is value
|
|
@@ -9314,9 +9289,9 @@
|
|
|
9314
9289
|
var rowKey = /** @type {import('./Key.js').ValueTypeArray} */
|
|
9315
9290
|
_decode(row[escapedIndexNameForKeyCol]);
|
|
9316
9291
|
var record;
|
|
9317
|
-
if (hasKey && (multiChecks && range.some(
|
|
9292
|
+
if (hasKey && (multiChecks && /** @type {import('./Key.js').ValueType[]} */range.some(
|
|
9318
9293
|
/**
|
|
9319
|
-
* @param {
|
|
9294
|
+
* @param {import('./Key.js').ValueType} check
|
|
9320
9295
|
* @returns {boolean}
|
|
9321
9296
|
*/
|
|
9322
9297
|
function (check) {
|
|
@@ -9467,14 +9442,14 @@
|
|
|
9467
9442
|
* __idbdb: import('./IDBDatabase.js').IDBDatabaseFull,
|
|
9468
9443
|
* __validateKeyAndValueAndCloneValue: (
|
|
9469
9444
|
* value: import('./Key.js').Value,
|
|
9470
|
-
* key: import('./Key.js').Key,
|
|
9445
|
+
* key: import('./Key.js').Key|undefined,
|
|
9471
9446
|
* cursorUpdate: boolean
|
|
9472
9447
|
* ) => KeyValueArray,
|
|
9473
9448
|
* __deriveKey: (
|
|
9474
9449
|
* tx: WebSQLTransaction,
|
|
9475
9450
|
* value: import('./Key.js').Value,
|
|
9476
|
-
* key: import('./Key.js').Key,
|
|
9477
|
-
* success: (key: import('./Key.js').
|
|
9451
|
+
* key: import('./Key.js').Key|undefined,
|
|
9452
|
+
* success: (key: import('./Key.js').Value, cn?: Integer) => void,
|
|
9478
9453
|
* failCb: import('./Key.js').SQLFailureCallback
|
|
9479
9454
|
* ) => void,
|
|
9480
9455
|
* __checkIndexConstraints: (
|
|
@@ -9783,7 +9758,7 @@
|
|
|
9783
9758
|
};
|
|
9784
9759
|
|
|
9785
9760
|
/**
|
|
9786
|
-
* @typedef {[import('./Key.js').Key, import('./Key.js').Value]} KeyValueArray
|
|
9761
|
+
* @typedef {[import('./Key.js').Key|undefined, import('./Key.js').Value]} KeyValueArray
|
|
9787
9762
|
*/
|
|
9788
9763
|
|
|
9789
9764
|
// Todo: Although we may end up needing to do cloning genuinely asynchronously (for Blobs and FileLists),
|
|
@@ -9798,7 +9773,7 @@
|
|
|
9798
9773
|
* Determines whether the given inline or out-of-line key is valid,
|
|
9799
9774
|
* according to the object store's schema.
|
|
9800
9775
|
* @param {import('./Key.js').Value} value Used for inline keys
|
|
9801
|
-
* @param {import('./Key.js').Key} key Used for out-of-line keys
|
|
9776
|
+
* @param {import('./Key.js').Key|undefined} key Used for out-of-line keys
|
|
9802
9777
|
* @param {boolean} cursorUpdate
|
|
9803
9778
|
* @throws {DOMException}
|
|
9804
9779
|
* @this {IDBObjectStoreFull}
|
|
@@ -9814,11 +9789,11 @@
|
|
|
9814
9789
|
// occurs sync; then can make cloning and this method without callbacks (except where ok
|
|
9815
9790
|
// to be async)
|
|
9816
9791
|
var _clonedValue = cloneWithInactiveTransaction(/** @type {import('./IDBTransaction.js').IDBTransactionFull} */me.transaction, value);
|
|
9817
|
-
|
|
9818
|
-
if (
|
|
9792
|
+
var extractedKey = extractKeyValueDecodedFromValueUsingKeyPath(_clonedValue, me.keyPath); // May throw so "rethrow"
|
|
9793
|
+
if ('invalid' in extractedKey && extractedKey.invalid) {
|
|
9819
9794
|
throw createDOMException('DataError', 'KeyPath was specified, but key was invalid.');
|
|
9820
9795
|
}
|
|
9821
|
-
if (
|
|
9796
|
+
if ('failure' in extractedKey && extractedKey.failure) {
|
|
9822
9797
|
if (!cursorUpdate) {
|
|
9823
9798
|
if (!me.autoIncrement) {
|
|
9824
9799
|
throw createDOMException('DataError', 'Could not evaluate a key from keyPath and there is no key generator');
|
|
@@ -9833,14 +9808,13 @@
|
|
|
9833
9808
|
throw createDOMException('DataError', 'Could not evaluate a key from keyPath');
|
|
9834
9809
|
}
|
|
9835
9810
|
// An `IDBCursor.update` call will also throw if not equal to the cursor’s effective key
|
|
9836
|
-
return [
|
|
9811
|
+
return [(/** @type {import('./Key.js').Key} */extractedKey.value), _clonedValue];
|
|
9837
9812
|
}
|
|
9838
9813
|
if (key === undefined) {
|
|
9839
9814
|
if (!me.autoIncrement) {
|
|
9840
9815
|
throw createDOMException('DataError', 'The object store uses out-of-line keys and has no key generator and the key parameter was not provided.');
|
|
9841
9816
|
}
|
|
9842
9817
|
// A key will be generated
|
|
9843
|
-
key = undefined;
|
|
9844
9818
|
} else {
|
|
9845
9819
|
convertValueToKeyRethrowingAndIfInvalid(key);
|
|
9846
9820
|
}
|
|
@@ -9855,8 +9829,8 @@
|
|
|
9855
9829
|
* a keyPath leading to a valid but non-numeric or < 1 key).
|
|
9856
9830
|
* @param {WebSQLTransaction} tx
|
|
9857
9831
|
* @param {import('./Key.js').Value} value
|
|
9858
|
-
* @param {import('./Key.js').Key} key
|
|
9859
|
-
* @param {(key: import('./Key.js').
|
|
9832
|
+
* @param {import('./Key.js').Key|undefined} key
|
|
9833
|
+
* @param {(key: import('./Key.js').Value, cn?: Integer) => void} success
|
|
9860
9834
|
* @param {import('./Key.js').SQLFailureCallback} failCb
|
|
9861
9835
|
* @this {IDBObjectStoreFull}
|
|
9862
9836
|
* @returns {void}
|
|
@@ -9871,9 +9845,8 @@
|
|
|
9871
9845
|
*/
|
|
9872
9846
|
function keyCloneThenSuccess(oldCn) {
|
|
9873
9847
|
// We want to return the original key, so we don't need to accept an argument here
|
|
9874
|
-
encode(key, function (
|
|
9875
|
-
|
|
9876
|
-
success(key, oldCn);
|
|
9848
|
+
encode(key, function (encodedKey) {
|
|
9849
|
+
success(decode(encodedKey), oldCn);
|
|
9877
9850
|
});
|
|
9878
9851
|
}
|
|
9879
9852
|
if (me.autoIncrement) {
|
|
@@ -9887,7 +9860,7 @@
|
|
|
9887
9860
|
if (me.keyPath !== null) {
|
|
9888
9861
|
// Should not throw now as checked earlier
|
|
9889
9862
|
// Todo: Could this not be an array here?
|
|
9890
|
-
injectKeyIntoValueUsingKeyPath(value, key, /** @type {string} */me.keyPath);
|
|
9863
|
+
injectKeyIntoValueUsingKeyPath(/** @type {{[key: string]: import('./Key.js').Value}} */value, /** @type {import('./Key.js').Key} */key, /** @type {string} */me.keyPath);
|
|
9891
9864
|
}
|
|
9892
9865
|
success(key, oldCn);
|
|
9893
9866
|
}, failCb);
|
|
@@ -9944,15 +9917,15 @@
|
|
|
9944
9917
|
resolve(undefined);
|
|
9945
9918
|
return;
|
|
9946
9919
|
}
|
|
9947
|
-
|
|
9948
|
-
if (
|
|
9920
|
+
var indexKeyValue = indexKey.value;
|
|
9921
|
+
if (indexKeyValue === undefined) {
|
|
9949
9922
|
resolve(undefined);
|
|
9950
9923
|
return;
|
|
9951
9924
|
}
|
|
9952
|
-
var multiCheck = index.multiEntry && Array.isArray(
|
|
9953
|
-
var fetchArgs = buildFetchIndexDataSQL(true, index,
|
|
9925
|
+
var multiCheck = index.multiEntry && Array.isArray(indexKeyValue);
|
|
9926
|
+
var fetchArgs = buildFetchIndexDataSQL(true, index, indexKeyValue, 'key', multiCheck);
|
|
9954
9927
|
executeFetchIndexData.apply(void 0, [null].concat(_toConsumableArray(fetchArgs), [tx, null, function success(key) {
|
|
9955
|
-
if (key === undefined || excludeKey !== undefined && cmp(key, excludeKey) === 0) {
|
|
9928
|
+
if (key === undefined || excludeKey !== undefined && cmp(/** @type {import('./Key.js').Key} */key, excludeKey) === 0) {
|
|
9956
9929
|
resolve(undefined);
|
|
9957
9930
|
return;
|
|
9958
9931
|
}
|
|
@@ -10025,21 +9998,21 @@
|
|
|
10025
9998
|
resolve(undefined);
|
|
10026
9999
|
return;
|
|
10027
10000
|
}
|
|
10028
|
-
|
|
10001
|
+
var indexKeyValue = indexKey.value;
|
|
10029
10002
|
/**
|
|
10030
10003
|
* @param {import('./IDBIndex.js').IDBIndexFull} index
|
|
10031
10004
|
* @returns {void}
|
|
10032
10005
|
*/
|
|
10033
10006
|
function setIndexInfo(index) {
|
|
10034
|
-
if (
|
|
10007
|
+
if (indexKeyValue === undefined) {
|
|
10035
10008
|
return;
|
|
10036
10009
|
}
|
|
10037
10010
|
paramMap[index.__currentName] = /** @type {string} */
|
|
10038
|
-
_encode(
|
|
10011
|
+
_encode(indexKeyValue, index.multiEntry);
|
|
10039
10012
|
}
|
|
10040
10013
|
if (index.unique) {
|
|
10041
|
-
var multiCheck = index.multiEntry && Array.isArray(
|
|
10042
|
-
var fetchArgs = buildFetchIndexDataSQL(true, index,
|
|
10014
|
+
var multiCheck = index.multiEntry && Array.isArray(indexKeyValue);
|
|
10015
|
+
var fetchArgs = buildFetchIndexDataSQL(true, index, indexKeyValue, 'key', multiCheck);
|
|
10043
10016
|
executeFetchIndexData.apply(void 0, [null].concat(_toConsumableArray(fetchArgs), [tx, null, function success(key) {
|
|
10044
10017
|
if (key === undefined) {
|
|
10045
10018
|
setIndexInfo(index);
|
|
@@ -10207,7 +10180,9 @@
|
|
|
10207
10180
|
var key = arguments[5];
|
|
10208
10181
|
/** @type {import('./IDBTransaction.js').IDBTransactionFull} */
|
|
10209
10182
|
store.transaction.__pushToQueue(request, function (tx, args, success, error) {
|
|
10210
|
-
store.__deriveKey(tx, value, key, function (
|
|
10183
|
+
store.__deriveKey(tx, value, key, function (clonedKeyOrCurrentNumberRaw, oldCn) {
|
|
10184
|
+
var clonedKeyOrCurrentNumber = /** @type {import('./Key.js').Key|Integer} */
|
|
10185
|
+
clonedKeyOrCurrentNumberRaw;
|
|
10211
10186
|
encode(value, function (encoded) {
|
|
10212
10187
|
/**
|
|
10213
10188
|
* @param {WebSQLTransaction} tx
|
|
@@ -11593,7 +11568,7 @@
|
|
|
11593
11568
|
var sysdbFinishedCb = function sysdbFinishedCb(systx, err, cb) {
|
|
11594
11569
|
if (err) {
|
|
11595
11570
|
/**
|
|
11596
|
-
* @param {
|
|
11571
|
+
* @param {unknown} [errorToShow]
|
|
11597
11572
|
* @returns {void}
|
|
11598
11573
|
*/
|
|
11599
11574
|
var manualRevert = function manualRevert(errorToShow) {
|
|
@@ -11617,7 +11592,9 @@
|
|
|
11617
11592
|
cb(sqlErr); // eslint-disable-line promise/no-callback-in-promise -- Convenient
|
|
11618
11593
|
}, function () {
|
|
11619
11594
|
isRevertingSysdb = false;
|
|
11620
|
-
|
|
11595
|
+
// eslint-disable-next-line promise/no-callback-in-promise -- Convenient
|
|
11596
|
+
cb(/** @type {(Error & {code?: number})|undefined} */
|
|
11597
|
+
errorToShow || reportError);
|
|
11621
11598
|
});
|
|
11622
11599
|
};
|
|
11623
11600
|
try {
|
|
@@ -11650,13 +11627,13 @@
|
|
|
11650
11627
|
newVersion: version
|
|
11651
11628
|
});
|
|
11652
11629
|
req.__result = connection;
|
|
11653
|
-
connection.__upgradeTransaction = req.__transaction =
|
|
11630
|
+
connection.__upgradeTransaction = req.__transaction = connection.__versionTransaction = IDBTransaction.__createInstance(connection, connection.objectStoreNames, 'versionchange');
|
|
11654
11631
|
req.__done = true;
|
|
11655
11632
|
req.transaction.__addNonRequestToTransactionQueue(
|
|
11656
11633
|
/**
|
|
11657
11634
|
* @param {import('websql-configurable/lib/websql/WebSQLTransaction.js').default} tx
|
|
11658
|
-
* @param {
|
|
11659
|
-
* @param {(result?:
|
|
11635
|
+
* @param {unknown[]} args
|
|
11636
|
+
* @param {(result?: unknown, req?: import('./IDBRequest.js').IDBRequestFull) => void} finished
|
|
11660
11637
|
* @returns {void}
|
|
11661
11638
|
*/
|
|
11662
11639
|
function onupgradeneeded(tx, args, finished /* , error */) {
|
|
@@ -12357,16 +12334,16 @@
|
|
|
12357
12334
|
|
|
12358
12335
|
/**
|
|
12359
12336
|
* @typedef {IDBCursor & {
|
|
12360
|
-
* primaryKey: import('./Key.js').Key,
|
|
12361
|
-
* key: import('./Key.js').Key,
|
|
12337
|
+
* primaryKey: import('./Key.js').Key|null|undefined,
|
|
12338
|
+
* key: import('./Key.js').Key|null|undefined,
|
|
12362
12339
|
* direction: string,
|
|
12363
12340
|
* source: import('./IDBObjectStore.js').IDBObjectStoreFull|
|
|
12364
12341
|
* import('./IDBIndex.js').IDBIndexFull,
|
|
12365
12342
|
* __request: import('./IDBRequest.js').IDBRequestFull,
|
|
12366
12343
|
* __advanceCount: Integer|undefined,
|
|
12367
12344
|
* __indexSource: boolean,
|
|
12368
|
-
* __key: import('./Key.js').Key,
|
|
12369
|
-
* __primaryKey: import('./Key.js').Key,
|
|
12345
|
+
* __key: import('./Key.js').Key|null|undefined,
|
|
12346
|
+
* __primaryKey: import('./Key.js').Key|null|undefined,
|
|
12370
12347
|
* __value: import('./Key.js').Value,
|
|
12371
12348
|
* __store: import('./IDBObjectStore.js').IDBObjectStoreFull,
|
|
12372
12349
|
* __range: import('./IDBKeyRange.js').IDBKeyRangeFull|undefined,
|
|
@@ -12374,13 +12351,13 @@
|
|
|
12374
12351
|
* __valueColumnName: string,
|
|
12375
12352
|
* __keyOnly: boolean,
|
|
12376
12353
|
* __valueDecoder: {
|
|
12377
|
-
* decode: (str: string) =>
|
|
12354
|
+
* decode: (str: string) => import('./Key.js').Value,
|
|
12378
12355
|
* },
|
|
12379
12356
|
* __count: boolean,
|
|
12380
12357
|
* __prefetchedIndex: Integer,
|
|
12381
12358
|
* __prefetchedData: null|{
|
|
12382
12359
|
* length: number;
|
|
12383
|
-
* item(index: number):
|
|
12360
|
+
* item(index: number): unknown;
|
|
12384
12361
|
* }|{
|
|
12385
12362
|
* data: RowItemNonNull[],
|
|
12386
12363
|
* length: Integer,
|
|
@@ -12395,7 +12372,14 @@
|
|
|
12395
12372
|
* __multiEntryExhausted: boolean,
|
|
12396
12373
|
* __invalidateCache: () => void,
|
|
12397
12374
|
* __gotValue: boolean,
|
|
12398
|
-
* __find: (
|
|
12375
|
+
* __find: (
|
|
12376
|
+
* key: import('./Key.js').Key|undefined,
|
|
12377
|
+
* primaryKey: import('./Key.js').Key|undefined,
|
|
12378
|
+
* tx: WebSQLTransaction,
|
|
12379
|
+
* success: KeySuccess,
|
|
12380
|
+
* error: FindError,
|
|
12381
|
+
* recordsToLoad?: Integer
|
|
12382
|
+
* ) => void,
|
|
12399
12383
|
* __findBasic: (
|
|
12400
12384
|
* key: import('./Key.js').Key|undefined,
|
|
12401
12385
|
* primaryKey: import('./Key.js').Key|undefined,
|
|
@@ -12416,17 +12400,17 @@
|
|
|
12416
12400
|
* __decode: (
|
|
12417
12401
|
* rowItem: RowItemNonNull,
|
|
12418
12402
|
* callback: (
|
|
12419
|
-
* key: import('./Key.js').Key,
|
|
12403
|
+
* key: import('./Key.js').Key|undefined,
|
|
12420
12404
|
* val: import('./Key.js').Value,
|
|
12421
|
-
* primaryKey: import('./Key.js').Key,
|
|
12405
|
+
* primaryKey: import('./Key.js').Key|undefined,
|
|
12422
12406
|
* encKey?: string
|
|
12423
12407
|
* ) => void
|
|
12424
12408
|
* ) => void,
|
|
12425
12409
|
* __sourceOrEffectiveObjStoreDeleted: () => void,
|
|
12426
12410
|
* __continue: (key?: import('./Key.js').Key, advanceContinue?: boolean) => void,
|
|
12427
12411
|
* __continueFinish: (
|
|
12428
|
-
* key: import('./Key.js').Key,
|
|
12429
|
-
* primaryKey: import('./Key.js').Key,
|
|
12412
|
+
* key: import('./Key.js').Key|undefined,
|
|
12413
|
+
* primaryKey: import('./Key.js').Key|undefined,
|
|
12430
12414
|
* advanceState: boolean
|
|
12431
12415
|
* ) => void
|
|
12432
12416
|
* }} IDBCursorFull
|
|
@@ -12459,7 +12443,7 @@
|
|
|
12459
12443
|
* import('./IDBIndex.js').IDBIndexFull} source
|
|
12460
12444
|
* @param {string} keyColumnName
|
|
12461
12445
|
* @param {string} valueColumnName
|
|
12462
|
-
* @param {boolean} count
|
|
12446
|
+
* @param {boolean} [count]
|
|
12463
12447
|
* @this {IDBCursorFull}
|
|
12464
12448
|
* @returns {void}
|
|
12465
12449
|
*/
|
|
@@ -12500,7 +12484,7 @@
|
|
|
12500
12484
|
this.__valueColumnName = valueColumnName;
|
|
12501
12485
|
this.__keyOnly = valueColumnName === 'key';
|
|
12502
12486
|
this.__valueDecoder = this.__keyOnly ? Key : Sca;
|
|
12503
|
-
this.__count = count;
|
|
12487
|
+
this.__count = Boolean(count);
|
|
12504
12488
|
this.__prefetchedIndex = -1;
|
|
12505
12489
|
this.__continuationKey = undefined;
|
|
12506
12490
|
this.__continuationPrimaryKey = undefined;
|
|
@@ -12519,36 +12503,36 @@
|
|
|
12519
12503
|
|
|
12520
12504
|
/**
|
|
12521
12505
|
*
|
|
12522
|
-
* @param {
|
|
12506
|
+
* @param {IDBKeyRange} query
|
|
12507
|
+
* @param {string} direction
|
|
12508
|
+
* @param {import('./IDBObjectStore.js').IDBObjectStoreFull} store
|
|
12509
|
+
* @param {import('./IDBObjectStore.js').IDBObjectStoreFull|
|
|
12510
|
+
* import('./IDBIndex.js').IDBIndexFull} source
|
|
12511
|
+
* @param {string} keyColumnName
|
|
12512
|
+
* @param {string} valueColumnName
|
|
12513
|
+
* @param {boolean} [count]
|
|
12523
12514
|
* @returns {IDBCursorFull}
|
|
12524
12515
|
*/
|
|
12525
|
-
IDBCursor.__createInstance = function () {
|
|
12516
|
+
IDBCursor.__createInstance = function (query, direction, store, source, keyColumnName, valueColumnName, count) {
|
|
12526
12517
|
var IDBCursor = IDBCursorAlias.__super;
|
|
12527
12518
|
IDBCursor.prototype = IDBCursorAlias.prototype;
|
|
12528
12519
|
|
|
12529
12520
|
// @ts-expect-error It's ok
|
|
12530
|
-
|
|
12531
|
-
args[_key] = arguments[_key];
|
|
12532
|
-
}
|
|
12533
|
-
return _construct(IDBCursor, args);
|
|
12521
|
+
return new IDBCursor(query, direction, store, source, keyColumnName, valueColumnName, count);
|
|
12534
12522
|
};
|
|
12535
12523
|
|
|
12536
12524
|
/**
|
|
12537
12525
|
*
|
|
12538
|
-
* @param {
|
|
12526
|
+
* @param {import('./Key.js').Key|undefined} key
|
|
12527
|
+
* @param {import('./Key.js').Key|undefined} primaryKey
|
|
12528
|
+
* @param {WebSQLTransaction} tx
|
|
12529
|
+
* @param {KeySuccess} success
|
|
12530
|
+
* @param {FindError} error
|
|
12531
|
+
* @param {Integer} [recordsToLoad]
|
|
12539
12532
|
* @this {IDBCursorFull}
|
|
12540
12533
|
* @returns {void}
|
|
12541
12534
|
*/
|
|
12542
|
-
IDBCursor.prototype.__find = function () {
|
|
12543
|
-
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
|
12544
|
-
args[_key2] = arguments[_key2];
|
|
12545
|
-
}
|
|
12546
|
-
var key = args[0],
|
|
12547
|
-
primaryKey = args[1],
|
|
12548
|
-
tx = args[2],
|
|
12549
|
-
success = args[3],
|
|
12550
|
-
error = args[4],
|
|
12551
|
-
recordsToLoad = args[5];
|
|
12535
|
+
IDBCursor.prototype.__find = function (key, primaryKey, tx, success, error, recordsToLoad) {
|
|
12552
12536
|
if (this.__multiEntryIndex) {
|
|
12553
12537
|
this.__findMultiEntry(key, primaryKey, tx, success, error, recordsToLoad);
|
|
12554
12538
|
} else {
|
|
@@ -12558,9 +12542,9 @@
|
|
|
12558
12542
|
|
|
12559
12543
|
/**
|
|
12560
12544
|
* @typedef {(
|
|
12561
|
-
* k: import('./Key.js').Key,
|
|
12545
|
+
* k: import('./Key.js').Key|undefined,
|
|
12562
12546
|
* val: import('./Key.js').Value,
|
|
12563
|
-
* primKey: import('./Key.js').Key
|
|
12547
|
+
* primKey: import('./Key.js').Key|undefined
|
|
12564
12548
|
* ) => void} KeySuccess
|
|
12565
12549
|
*/
|
|
12566
12550
|
|
|
@@ -12657,7 +12641,7 @@
|
|
|
12657
12641
|
me.__prefetchedIndex = 0;
|
|
12658
12642
|
me.__prefetchedData = data.rows;
|
|
12659
12643
|
if (CFG.DEBUG) {
|
|
12660
|
-
console.log('Preloaded ' +
|
|
12644
|
+
console.log('Preloaded ' + data.rows.length + ' records for cursor');
|
|
12661
12645
|
}
|
|
12662
12646
|
me.__decode(/** @type {RowItemNonNull} */data.rows.item(0), success);
|
|
12663
12647
|
} else if (data.rows.length === 1) {
|
|
@@ -12782,7 +12766,7 @@
|
|
|
12782
12766
|
for (var i = 0; i < data.rows.length; i++) {
|
|
12783
12767
|
var rowItem = /** @type {RowItemNonNull} */data.rows.item(i);
|
|
12784
12768
|
var rowKey = _decode(rowItem[me.__keyColumnName], true);
|
|
12785
|
-
var matches = findMultiEntryMatches(rowKey, me.__range);
|
|
12769
|
+
var matches = findMultiEntryMatches(/** @type {import('./Key.js').Key} */rowKey, me.__range);
|
|
12786
12770
|
ct += matches.length;
|
|
12787
12771
|
}
|
|
12788
12772
|
success(undefined, ct, undefined);
|
|
@@ -12802,7 +12786,7 @@
|
|
|
12802
12786
|
for (var _i = 0; _i < data.rows.length; _i++) {
|
|
12803
12787
|
var _rowItem = /** @type {RowItemNonNull} */data.rows.item(_i);
|
|
12804
12788
|
var _rowKey = _decode(_rowItem[me.__keyColumnName], true);
|
|
12805
|
-
var _matches = findMultiEntryMatches(_rowKey, me.__range);
|
|
12789
|
+
var _matches = findMultiEntryMatches(/** @type {import('./Key.js').Key} */_rowKey, me.__range);
|
|
12806
12790
|
var _iterator = _createForOfIteratorHelper(_matches),
|
|
12807
12791
|
_step;
|
|
12808
12792
|
try {
|
|
@@ -12883,11 +12867,11 @@
|
|
|
12883
12867
|
};
|
|
12884
12868
|
|
|
12885
12869
|
/**
|
|
12886
|
-
* @typedef {
|
|
12870
|
+
* @typedef {import('./Key.js').Value} StructuredCloneValue
|
|
12887
12871
|
*/
|
|
12888
12872
|
|
|
12889
12873
|
/**
|
|
12890
|
-
* @typedef {
|
|
12874
|
+
* @typedef {import('./Key.js').Key} IndexedDBKey
|
|
12891
12875
|
*/
|
|
12892
12876
|
|
|
12893
12877
|
/**
|
|
@@ -12899,9 +12883,9 @@
|
|
|
12899
12883
|
|
|
12900
12884
|
/**
|
|
12901
12885
|
* @callback SuccessCallback
|
|
12902
|
-
* @param {IndexedDBKey} key
|
|
12886
|
+
* @param {IndexedDBKey|undefined} key
|
|
12903
12887
|
* @param {StructuredCloneValue} value
|
|
12904
|
-
* @param {IndexedDBKey} primaryKey
|
|
12888
|
+
* @param {IndexedDBKey|undefined} primaryKey
|
|
12905
12889
|
* @returns {void}
|
|
12906
12890
|
*/
|
|
12907
12891
|
|
|
@@ -12941,9 +12925,9 @@
|
|
|
12941
12925
|
*
|
|
12942
12926
|
* @param {RowItemNonNull} rowItem
|
|
12943
12927
|
* @param {(
|
|
12944
|
-
* key: import('./Key.js').Key,
|
|
12928
|
+
* key: import('./Key.js').Key|undefined,
|
|
12945
12929
|
* val: import('./Key.js').Value,
|
|
12946
|
-
* primaryKey: import('./Key.js').Key,
|
|
12930
|
+
* primaryKey: import('./Key.js').Key|undefined,
|
|
12947
12931
|
* encKey?: string
|
|
12948
12932
|
* ) => void} callback
|
|
12949
12933
|
* @this {IDBCursorFull}
|
|
@@ -13018,8 +13002,8 @@
|
|
|
13018
13002
|
|
|
13019
13003
|
/**
|
|
13020
13004
|
*
|
|
13021
|
-
* @param {import('./Key.js').Key} key
|
|
13022
|
-
* @param {import('./Key.js').Key} primaryKey
|
|
13005
|
+
* @param {import('./Key.js').Key|undefined} key
|
|
13006
|
+
* @param {import('./Key.js').Key|undefined} primaryKey
|
|
13023
13007
|
* @param {boolean} advanceState
|
|
13024
13008
|
* @this {IDBCursorFull}
|
|
13025
13009
|
* @returns {void}
|
|
@@ -13033,9 +13017,9 @@
|
|
|
13033
13017
|
/** @type {import('./IDBTransaction.js').IDBTransactionFull} */
|
|
13034
13018
|
me.__store.transaction.__pushToQueue(me.__request, function cursorContinue(tx, args, success, error, executeNextRequest) {
|
|
13035
13019
|
/**
|
|
13036
|
-
* @param {import('./Key.js').Key} k
|
|
13020
|
+
* @param {import('./Key.js').Key|undefined} k
|
|
13037
13021
|
* @param {import('./Key.js').Value} val
|
|
13038
|
-
* @param {import('./Key.js').Key} primKey
|
|
13022
|
+
* @param {import('./Key.js').Key|undefined} primKey
|
|
13039
13023
|
* @returns {void}
|
|
13040
13024
|
*/
|
|
13041
13025
|
function triggerSuccess(k, val, primKey) {
|
|
@@ -13077,7 +13061,7 @@
|
|
|
13077
13061
|
// We have pre-loaded data for the cursor
|
|
13078
13062
|
me.__prefetchedIndex++;
|
|
13079
13063
|
if (me.__prefetchedIndex < me.__prefetchedData.length) {
|
|
13080
|
-
me.__decode(me.__prefetchedData.item(me.__prefetchedIndex), function (k, val, primKey, encKey) {
|
|
13064
|
+
me.__decode(/** @type {RowItemNonNull} */me.__prefetchedData.item(me.__prefetchedIndex), function (k, val, primKey, encKey) {
|
|
13081
13065
|
/**
|
|
13082
13066
|
* @returns {void}
|
|
13083
13067
|
*/
|
|
@@ -13135,8 +13119,8 @@
|
|
|
13135
13119
|
me.__find(key, primaryKey, tx, triggerSuccess, /** @type {FindError} */
|
|
13136
13120
|
function () {
|
|
13137
13121
|
me.__advanceCount = undefined;
|
|
13138
|
-
for (var
|
|
13139
|
-
args[
|
|
13122
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
13123
|
+
args[_key] = arguments[_key];
|
|
13140
13124
|
}
|
|
13141
13125
|
var t = args[0],
|
|
13142
13126
|
err = args[1];
|
|
@@ -13222,12 +13206,18 @@
|
|
|
13222
13206
|
};
|
|
13223
13207
|
|
|
13224
13208
|
/**
|
|
13225
|
-
*
|
|
13209
|
+
* The `{query, count, direction}` options shape shared by
|
|
13210
|
+
* `getAll`/`getAllKeys`/`getAllRecords`.
|
|
13211
|
+
* @typedef {{
|
|
13212
|
+
* query?: import('./Key.js').Value,
|
|
13213
|
+
* count?: Integer,
|
|
13214
|
+
* direction?: string
|
|
13215
|
+
* }} GetAllOptions
|
|
13226
13216
|
*/
|
|
13227
13217
|
|
|
13228
13218
|
/**
|
|
13229
13219
|
*
|
|
13230
|
-
* @param {
|
|
13220
|
+
* @param {import('./Key.js').Value} valueToUpdate
|
|
13231
13221
|
* @this {IDBCursorFull}
|
|
13232
13222
|
* @returns {IDBRequest}
|
|
13233
13223
|
*/
|
|
@@ -13353,25 +13343,22 @@
|
|
|
13353
13343
|
var IDBCursorWithValueAlias = IDBCursorWithValue;
|
|
13354
13344
|
/**
|
|
13355
13345
|
*
|
|
13356
|
-
* @param {
|
|
13346
|
+
* @param {IDBKeyRange} query
|
|
13347
|
+
* @param {string} direction
|
|
13348
|
+
* @param {import('./IDBObjectStore.js').IDBObjectStoreFull} store
|
|
13349
|
+
* @param {import('./IDBObjectStore.js').IDBObjectStoreFull|
|
|
13350
|
+
* import('./IDBIndex.js').IDBIndexFull} source
|
|
13351
|
+
* @param {string} keyColumnName
|
|
13352
|
+
* @param {string} valueColumnName
|
|
13353
|
+
* @param {boolean} [count]
|
|
13357
13354
|
* @returns {IDBCursorWithValueFull}
|
|
13358
13355
|
*/
|
|
13359
|
-
IDBCursorWithValue.__createInstance = function () {
|
|
13360
|
-
for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
|
|
13361
|
-
args[_key4] = arguments[_key4];
|
|
13362
|
-
}
|
|
13356
|
+
IDBCursorWithValue.__createInstance = function (query, direction, store, source, keyColumnName, valueColumnName, count) {
|
|
13363
13357
|
/**
|
|
13364
13358
|
* @class
|
|
13365
13359
|
* @this {IDBCursorWithValueFull}
|
|
13366
13360
|
*/
|
|
13367
13361
|
function IDBCursorWithValue() {
|
|
13368
|
-
var query = args[0],
|
|
13369
|
-
direction = args[1],
|
|
13370
|
-
store = args[2],
|
|
13371
|
-
source = args[3],
|
|
13372
|
-
keyColumnName = args[4],
|
|
13373
|
-
valueColumnName = args[5],
|
|
13374
|
-
count = args[6];
|
|
13375
13362
|
IDBCursor.__super.call(this, query, direction, store, source, keyColumnName, valueColumnName, count);
|
|
13376
13363
|
// @ts-expect-error It's ok
|
|
13377
13364
|
this[Symbol.toStringTag] = 'IDBCursorWithValue';
|
|
@@ -13394,12 +13381,16 @@
|
|
|
13394
13381
|
/**
|
|
13395
13382
|
* Validates `direction` and fills in defaults for the `{query, count,
|
|
13396
13383
|
* direction}` shape shared by `getAll`/`getAllKeys`/`getAllRecords`.
|
|
13397
|
-
* @param {
|
|
13384
|
+
* @param {unknown} options
|
|
13398
13385
|
* @throws {TypeError}
|
|
13399
|
-
* @returns {{
|
|
13386
|
+
* @returns {{
|
|
13387
|
+
* query: import('./Key.js').Value|undefined,
|
|
13388
|
+
* count: Integer|undefined,
|
|
13389
|
+
* direction: string
|
|
13390
|
+
* }}
|
|
13400
13391
|
*/
|
|
13401
13392
|
function normalizeGetAllOptions(options) {
|
|
13402
|
-
var _ref = /** @type {
|
|
13393
|
+
var _ref = /** @type {GetAllOptions} */options !== null && options !== void 0 ? options : {},
|
|
13403
13394
|
query = _ref.query,
|
|
13404
13395
|
count = _ref.count,
|
|
13405
13396
|
_ref$direction = _ref.direction,
|
|
@@ -13428,7 +13419,11 @@
|
|
|
13428
13419
|
* first argument wins regardless of how many arguments were actually passed.
|
|
13429
13420
|
* @param {IArguments} args
|
|
13430
13421
|
* @throws {TypeError}
|
|
13431
|
-
* @returns {{
|
|
13422
|
+
* @returns {{
|
|
13423
|
+
* query: import('./Key.js').Value|undefined,
|
|
13424
|
+
* count: Integer|undefined,
|
|
13425
|
+
* direction: string
|
|
13426
|
+
* }}
|
|
13432
13427
|
*/
|
|
13433
13428
|
function parseGetAllArgs(args) {
|
|
13434
13429
|
var arg0 = args[0];
|
|
@@ -13451,7 +13446,11 @@
|
|
|
13451
13446
|
* form to disambiguate against.
|
|
13452
13447
|
* @param {IArguments} args
|
|
13453
13448
|
* @throws {TypeError}
|
|
13454
|
-
* @returns {{
|
|
13449
|
+
* @returns {{
|
|
13450
|
+
* query: import('./Key.js').Value|undefined,
|
|
13451
|
+
* count: Integer|undefined,
|
|
13452
|
+
* direction: string
|
|
13453
|
+
* }}
|
|
13455
13454
|
*/
|
|
13456
13455
|
function parseGetAllRecordsArgs(args) {
|
|
13457
13456
|
return normalizeGetAllOptions(args[0]);
|
|
@@ -13558,7 +13557,7 @@
|
|
|
13558
13557
|
value: direction
|
|
13559
13558
|
});
|
|
13560
13559
|
return tx.__addToTransactionQueue(function collectAllOp(sqlTx, args, success, error) {
|
|
13561
|
-
/** @type {
|
|
13560
|
+
/** @type {unknown[]} */
|
|
13562
13561
|
var results = [];
|
|
13563
13562
|
var recordsToLoad = count || CFG.cursorPreloadPackSize || 100;
|
|
13564
13563
|
|
|
@@ -13598,7 +13597,7 @@
|
|
|
13598
13597
|
if (state.__prefetchedData) {
|
|
13599
13598
|
state.__prefetchedIndex++;
|
|
13600
13599
|
if (state.__prefetchedIndex < state.__prefetchedData.length) {
|
|
13601
|
-
IDBCursor.prototype.__decode.call(state, state.__prefetchedData.item(state.__prefetchedIndex),
|
|
13600
|
+
IDBCursor.prototype.__decode.call(state, /** @type {RowItemNonNull} */state.__prefetchedData.item(state.__prefetchedIndex),
|
|
13602
13601
|
/**
|
|
13603
13602
|
* @param {import('./Key.js').Key} k
|
|
13604
13603
|
* @param {import('./Key.js').Value} val
|
|
@@ -13628,15 +13627,11 @@
|
|
|
13628
13627
|
}, undefined, source);
|
|
13629
13628
|
}
|
|
13630
13629
|
|
|
13631
|
-
/**
|
|
13632
|
-
* @typedef {any} AnyValue
|
|
13633
|
-
*/
|
|
13634
|
-
|
|
13635
13630
|
/**
|
|
13636
13631
|
* @callback SetConfig
|
|
13637
13632
|
* @param {import('./CFG.js').KeyofConfigValues|
|
|
13638
13633
|
* Partial<import('./CFG.js').ConfigValues>} prop
|
|
13639
|
-
* @param {
|
|
13634
|
+
* @param {import('./CFG.js').ConfigValue} [val]
|
|
13640
13635
|
* @throws {Error}
|
|
13641
13636
|
* @returns {void}
|
|
13642
13637
|
*/
|
|
@@ -13724,18 +13719,9 @@
|
|
|
13724
13719
|
}
|
|
13725
13720
|
var IDB = /** @type {ShimmedObject & {[key: string]: unknown}} */
|
|
13726
13721
|
/** @type {unknown} */idb || globalThis || {};
|
|
13727
|
-
/**
|
|
13728
|
-
* @typedef {any} AnyClass
|
|
13729
|
-
*/
|
|
13730
|
-
/**
|
|
13731
|
-
* @typedef {any} AnyValue
|
|
13732
|
-
*/
|
|
13733
|
-
/**
|
|
13734
|
-
* @typedef {Function} AnyFunction
|
|
13735
|
-
*/
|
|
13736
13722
|
/**
|
|
13737
13723
|
* @param {string} name
|
|
13738
|
-
* @param {
|
|
13724
|
+
* @param {unknown} value
|
|
13739
13725
|
* @param {PropertyDescriptor & {
|
|
13740
13726
|
* shimNS?: object
|
|
13741
13727
|
* }|undefined} [propDesc]
|
|
@@ -13763,7 +13749,7 @@
|
|
|
13763
13749
|
}
|
|
13764
13750
|
} else {
|
|
13765
13751
|
var o = _defineAccessor("get", {}, name, function () {
|
|
13766
|
-
return /** @type {
|
|
13752
|
+
return /** @type {() => unknown} */(/** @type {PropertyDescriptor} */propDesc.get).call(this);
|
|
13767
13753
|
});
|
|
13768
13754
|
desc = /** @type {PropertyDescriptor} */
|
|
13769
13755
|
Object.getOwnPropertyDescriptor(o, name);
|
|
@@ -13837,7 +13823,7 @@
|
|
|
13837
13823
|
return shimIndexedDB;
|
|
13838
13824
|
}
|
|
13839
13825
|
});
|
|
13840
|
-
/** @type {[string,
|
|
13826
|
+
/** @type {[string, unknown][]} */
|
|
13841
13827
|
[['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) {
|
|
13842
13828
|
var _ref4 = _slicedToArray(_ref3, 2),
|
|
13843
13829
|
prop = _ref4[0],
|
|
@@ -13926,7 +13912,7 @@
|
|
|
13926
13912
|
IDB.shimIndexedDB = /** @type {ShimIndexedDB} */{};
|
|
13927
13913
|
/** @type {const} */
|
|
13928
13914
|
['__useShim', '__debug', '__setConfig', '__getConfig', '__setUnicodeIdentifiers'].forEach(function (prop) {
|
|
13929
|
-
/** @type {
|
|
13915
|
+
/** @type {{[key: string]: () => void}} */(/** @type {unknown} */IDB.shimIndexedDB)[prop] = function () {
|
|
13930
13916
|
console.warn('This browser does not have WebSQL to shim.');
|
|
13931
13917
|
};
|
|
13932
13918
|
});
|