indexeddbshim 15.0.1 → 15.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/indexeddbshim-Key.js +15 -14
- package/dist/indexeddbshim-Key.js.map +1 -1
- package/dist/indexeddbshim-Key.min.js +1 -1
- package/dist/indexeddbshim-Key.min.js.map +1 -1
- package/dist/indexeddbshim-UnicodeIdentifiers-node.cjs +117 -107
- package/dist/indexeddbshim-UnicodeIdentifiers-node.cjs.map +1 -1
- package/dist/indexeddbshim-UnicodeIdentifiers.js +139 -121
- package/dist/indexeddbshim-UnicodeIdentifiers.js.map +1 -1
- package/dist/indexeddbshim-UnicodeIdentifiers.min.js +2 -2
- package/dist/indexeddbshim-UnicodeIdentifiers.min.js.map +1 -1
- package/dist/indexeddbshim-node.cjs +115 -105
- package/dist/indexeddbshim-node.cjs.map +1 -1
- package/dist/indexeddbshim-noninvasive.js +133 -115
- package/dist/indexeddbshim-noninvasive.js.map +1 -1
- package/dist/indexeddbshim-noninvasive.min.js +2 -2
- package/dist/indexeddbshim-noninvasive.min.js.map +1 -1
- package/dist/indexeddbshim.js +119 -109
- package/dist/indexeddbshim.js.map +1 -1
- package/dist/indexeddbshim.min.js +2 -2
- package/dist/indexeddbshim.min.js.map +1 -1
- package/package.json +13 -29
- package/src/DOMException.js +5 -4
- package/src/DOMStringList.js +4 -3
- package/src/IDBCursor.js +4 -4
- package/src/IDBDatabase.js +2 -2
- package/src/IDBFactory.js +15 -12
- package/src/IDBIndex.js +7 -6
- package/src/IDBKeyRange.js +3 -3
- package/src/IDBObjectStore.js +10 -9
- package/src/IDBTransaction.js +5 -5
- package/src/IDBVersionChangeEvent.js +1 -1
- package/src/Key.js +1 -1
- package/src/Sca.js +0 -1
- package/src/UnicodeIdentifiers.js +2 -2
- package/src/setGlobalVars.js +5 -2
- package/src/util.js +2 -2
package/dist/indexeddbshim.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! indexeddbshim - v15.0.
|
|
1
|
+
/*! indexeddbshim - v15.0.1 - 9/5/2024 */
|
|
2
2
|
|
|
3
3
|
(function (factory) {
|
|
4
4
|
typeof define === 'function' && define.amd ? define(factory) :
|
|
@@ -1046,7 +1046,7 @@
|
|
|
1046
1046
|
* "addDefaultEventListener"|"removeDefaultEventListener"|"hasDefaultEventListener"
|
|
1047
1047
|
* } ListenerName
|
|
1048
1048
|
*/
|
|
1049
|
-
Object.assign(EventTarget.prototype, ['Early', '', 'Late', 'Default'].reduce(function (
|
|
1049
|
+
Object.assign(EventTarget.prototype, ['Early', '', 'Late', 'Default'].reduce(function (/** @type {{[key: string]: Function}} */
|
|
1050
1050
|
obj, listenerType) {
|
|
1051
1051
|
['add', 'remove', 'has'].forEach(function (method) {
|
|
1052
1052
|
var mainMethod = /** @type {ListenerName} */method + listenerType + 'EventListener';
|
|
@@ -1637,7 +1637,7 @@
|
|
|
1637
1637
|
* @returns {void}
|
|
1638
1638
|
*/
|
|
1639
1639
|
function (val) {
|
|
1640
|
-
if (!/^(?::memory:|file::memory:(\?(?:[\0-"\$-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*)?(#(?:[\0-\t\x0B\f\x0E-\u2027\u202A-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*)?)?$/.test(
|
|
1640
|
+
if (!/^(?::memory:|file::memory:(\?(?:[\0-"\$-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*)?(#(?:[\0-\t\x0B\f\x0E-\u2027\u202A-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*)?)?$/.test(/** @type {string} */val)) {
|
|
1641
1641
|
throw new TypeError('`memoryDatabase` must be the empty string, ":memory:", or a ' + '"file::memory:[?queryString][#hash] URL".');
|
|
1642
1642
|
}
|
|
1643
1643
|
}],
|
|
@@ -1782,7 +1782,7 @@
|
|
|
1782
1782
|
}
|
|
1783
1783
|
if (CFG.databaseCharacterEscapeList !== false) {
|
|
1784
1784
|
db = db.replace(CFG.databaseCharacterEscapeList ? new RegExp(CFG.databaseCharacterEscapeList, 'gu') : /[\0-\x1F"\*\/:<>\?\\\|\x7F]/g,
|
|
1785
|
-
// eslint-disable-line no-control-regex
|
|
1785
|
+
// eslint-disable-line no-control-regex -- Controls needed
|
|
1786
1786
|
function (n0) {
|
|
1787
1787
|
// eslint-disable-next-line unicorn/prefer-code-point -- Switch to `codePointAt`?
|
|
1788
1788
|
return '^1' + n0.charCodeAt(0).toString(16).padStart(2, '0');
|
|
@@ -2104,7 +2104,7 @@
|
|
|
2104
2104
|
function ToString(o) {
|
|
2105
2105
|
// Todo: See `es-abstract/es7`
|
|
2106
2106
|
// `String()` will not throw with Symbols
|
|
2107
|
-
return '' + o; // eslint-disable-line no-implicit-coercion
|
|
2107
|
+
return '' + o; // eslint-disable-line no-implicit-coercion -- Need to throw with symbols
|
|
2108
2108
|
}
|
|
2109
2109
|
|
|
2110
2110
|
/**
|
|
@@ -2183,7 +2183,7 @@
|
|
|
2183
2183
|
this.toString = function () {
|
|
2184
2184
|
return '[object IDBVersionChangeEvent]';
|
|
2185
2185
|
};
|
|
2186
|
-
// eslint-disable-next-line prefer-rest-params
|
|
2186
|
+
// eslint-disable-next-line prefer-rest-params -- API
|
|
2187
2187
|
this.__eventInitDict = arguments[1] || {};
|
|
2188
2188
|
}
|
|
2189
2189
|
|
|
@@ -2345,10 +2345,10 @@
|
|
|
2345
2345
|
function DOMException(message, name) {
|
|
2346
2346
|
// const err = Error.prototype.constructor.call(this, message); // Any use to this? Won't set this.message
|
|
2347
2347
|
this[Symbol.toStringTag] = 'DOMException';
|
|
2348
|
-
this._code = name in codes ? codes[(
|
|
2348
|
+
this._code = name in codes ? codes[(/** @type {Code} */name)] : legacyCodes[(/** @type {LegacyCode} */name)] || 0;
|
|
2349
2349
|
this._name = name || 'Error';
|
|
2350
2350
|
// We avoid `String()` in this next line as it converts Symbols
|
|
2351
|
-
this._message = message === undefined ? '' : '' + message; // eslint-disable-line no-implicit-coercion
|
|
2351
|
+
this._message = message === undefined ? '' : '' + message; // eslint-disable-line no-implicit-coercion -- Don't convert symbols
|
|
2352
2352
|
Object.defineProperty(this, 'code', {
|
|
2353
2353
|
configurable: true,
|
|
2354
2354
|
enumerable: true,
|
|
@@ -2376,12 +2376,12 @@
|
|
|
2376
2376
|
// Necessary for W3C tests which complains if `DOMException` has properties on its "own" prototype
|
|
2377
2377
|
|
|
2378
2378
|
// class DummyDOMException extends Error {}; // Sometimes causing problems in Node
|
|
2379
|
-
/* eslint-disable func-name-matching */
|
|
2379
|
+
/* eslint-disable func-name-matching -- See above */
|
|
2380
2380
|
/**
|
|
2381
2381
|
* @class
|
|
2382
2382
|
*/
|
|
2383
2383
|
var DummyDOMException = function DOMException() {/* */};
|
|
2384
|
-
/* eslint-enable func-name-matching */
|
|
2384
|
+
/* eslint-enable func-name-matching -- See above */
|
|
2385
2385
|
DummyDOMException.prototype = Object.create(Error.prototype); // Intended for subclassing
|
|
2386
2386
|
/** @type {const} */
|
|
2387
2387
|
['name', 'message'].forEach(function (prop) {
|
|
@@ -2482,7 +2482,7 @@
|
|
|
2482
2482
|
*/
|
|
2483
2483
|
function logError(name, message, error) {
|
|
2484
2484
|
if (CFG.DEBUG) {
|
|
2485
|
-
var msg = error && _typeof$2(error) === 'object' && error.message ? error.message : (
|
|
2485
|
+
var msg = error && _typeof$2(error) === 'object' && error.message ? error.message : (/** @type {string} */error);
|
|
2486
2486
|
var method = typeof console.error === 'function' ? 'error' : 'log';
|
|
2487
2487
|
console[method](name + ': ' + message + '. ' + (msg || ''));
|
|
2488
2488
|
if (console.trace) {
|
|
@@ -2593,7 +2593,8 @@
|
|
|
2593
2593
|
// Native DOMException works as expected
|
|
2594
2594
|
useNativeDOMException = true;
|
|
2595
2595
|
}
|
|
2596
|
-
|
|
2596
|
+
// eslint-disable-next-line no-unused-vars -- Problem with commonJS rollup
|
|
2597
|
+
} catch (err) {}
|
|
2597
2598
|
var createDOMException = useNativeDOMException
|
|
2598
2599
|
// eslint-disable-next-line @stylistic/operator-linebreak -- Need JSDoc
|
|
2599
2600
|
?
|
|
@@ -2902,7 +2903,7 @@
|
|
|
2902
2903
|
// assume that we will resolve/reject (truly) synchronously
|
|
2903
2904
|
// and thus we avoid flagging checks about whether we've
|
|
2904
2905
|
// already resolved/rejected.
|
|
2905
|
-
if (
|
|
2906
|
+
if (/** @type {Callbacks} */that.c[state].length) {
|
|
2906
2907
|
that.c = null;
|
|
2907
2908
|
}
|
|
2908
2909
|
}
|
|
@@ -2940,7 +2941,7 @@
|
|
|
2940
2941
|
SyncPromise.prototype.then = function (cb, errBack) {
|
|
2941
2942
|
/* eslint-enable unicorn/no-thenable -- Promise API */
|
|
2942
2943
|
var that = this;
|
|
2943
|
-
return new SyncPromise(
|
|
2944
|
+
return new SyncPromise(/** @type {ResolveReject} */
|
|
2944
2945
|
function (resolve, reject) {
|
|
2945
2946
|
var rej = typeof errBack === 'function' ? errBack : reject;
|
|
2946
2947
|
|
|
@@ -2970,7 +2971,7 @@
|
|
|
2970
2971
|
*/
|
|
2971
2972
|
SyncPromise.prototype["catch"] = function (cb) {
|
|
2972
2973
|
var that = this;
|
|
2973
|
-
return new SyncPromise(
|
|
2974
|
+
return new SyncPromise(/** @type {ResolveReject} */
|
|
2974
2975
|
function (resolve, reject) {
|
|
2975
2976
|
/**
|
|
2976
2977
|
* @returns {void}
|
|
@@ -2999,7 +3000,7 @@
|
|
|
2999
3000
|
* @returns {SyncPromise}
|
|
3000
3001
|
*/
|
|
3001
3002
|
SyncPromise.all = function (promises) {
|
|
3002
|
-
return new SyncPromise(
|
|
3003
|
+
return new SyncPromise(/** @type {ResolveReject} */
|
|
3003
3004
|
function (resolve, reject) {
|
|
3004
3005
|
var l = promises.length;
|
|
3005
3006
|
/** @type {ArbitraryValue[]} */
|
|
@@ -3009,8 +3010,8 @@
|
|
|
3009
3010
|
return;
|
|
3010
3011
|
}
|
|
3011
3012
|
promises.forEach(function (p, i) {
|
|
3012
|
-
if (isPromise(
|
|
3013
|
-
addReject(
|
|
3013
|
+
if (isPromise(/** @type {PromiseLike<any>} */p)) {
|
|
3014
|
+
addReject(/** @type {PromiseLike<any>} */p.then(/** @type {OnFulfilled} */
|
|
3014
3015
|
function (res) {
|
|
3015
3016
|
newPromises[i] = res;
|
|
3016
3017
|
--l || resolve(newPromises);
|
|
@@ -3029,11 +3030,11 @@
|
|
|
3029
3030
|
*/
|
|
3030
3031
|
SyncPromise.race = function (promises) {
|
|
3031
3032
|
var resolved = false;
|
|
3032
|
-
return new SyncPromise(
|
|
3033
|
+
return new SyncPromise(/** @type {ResolveReject} */
|
|
3033
3034
|
function (resolve, reject) {
|
|
3034
3035
|
promises.some(function (p, i) {
|
|
3035
|
-
if (isPromise(
|
|
3036
|
-
addReject(
|
|
3036
|
+
if (isPromise(/** @type {PromiseLike<any>} */p)) {
|
|
3037
|
+
addReject(/** @type {PromiseLike<any>} */p.then(/** @type {OnFulfilled} */
|
|
3037
3038
|
function (res) {
|
|
3038
3039
|
if (resolved) {
|
|
3039
3040
|
return;
|
|
@@ -3055,7 +3056,7 @@
|
|
|
3055
3056
|
* @returns {SyncPromise}
|
|
3056
3057
|
*/
|
|
3057
3058
|
SyncPromise.resolve = function (val) {
|
|
3058
|
-
return new SyncPromise(
|
|
3059
|
+
return new SyncPromise(/** @type {ResolveReject} */
|
|
3059
3060
|
function (resolve, reject) {
|
|
3060
3061
|
resolve(val);
|
|
3061
3062
|
});
|
|
@@ -3066,7 +3067,7 @@
|
|
|
3066
3067
|
* @returns {SyncPromise}
|
|
3067
3068
|
*/
|
|
3068
3069
|
SyncPromise.reject = function (val) {
|
|
3069
|
-
return new SyncPromise(
|
|
3070
|
+
return new SyncPromise(/** @type {ResolveReject} */
|
|
3070
3071
|
function (resolve, reject) {
|
|
3071
3072
|
reject(val);
|
|
3072
3073
|
});
|
|
@@ -3170,7 +3171,7 @@
|
|
|
3170
3171
|
};
|
|
3171
3172
|
var keyTypes = /** @type {(KeyType|"invalid")[]} */Object.keys(keyTypeToEncodedChar);
|
|
3172
3173
|
keyTypes.forEach(function (k) {
|
|
3173
|
-
keyTypeToEncodedChar[k] = String.fromCodePoint(
|
|
3174
|
+
keyTypeToEncodedChar[k] = String.fromCodePoint(/** @type {number} */keyTypeToEncodedChar[k]);
|
|
3174
3175
|
});
|
|
3175
3176
|
var encodedCharToKeyType = keyTypes.reduce(function (o, k) {
|
|
3176
3177
|
o[keyTypeToEncodedChar[k]] = k;
|
|
@@ -3559,7 +3560,7 @@
|
|
|
3559
3560
|
return 'binary';
|
|
3560
3561
|
}
|
|
3561
3562
|
var keyType = _typeof$2(key);
|
|
3562
|
-
return ['string', 'number'].includes(keyType) ? (
|
|
3563
|
+
return ['string', 'number'].includes(keyType) ? (/** @type {"string"|"number"} */keyType) : 'invalid';
|
|
3563
3564
|
}
|
|
3564
3565
|
|
|
3565
3566
|
/**
|
|
@@ -3667,7 +3668,7 @@
|
|
|
3667
3668
|
// May throw (if detached)
|
|
3668
3669
|
// Get a copy of the bytes held by the buffer source
|
|
3669
3670
|
// https://heycam.github.io/webidl/#ref-for-dfn-get-buffer-source-copy-2
|
|
3670
|
-
var octets = getCopyBytesHeldByBufferSource(
|
|
3671
|
+
var octets = getCopyBytesHeldByBufferSource(/** @type {BufferSource} */input);
|
|
3671
3672
|
return {
|
|
3672
3673
|
type: 'binary',
|
|
3673
3674
|
value: octets
|
|
@@ -3904,7 +3905,7 @@
|
|
|
3904
3905
|
value = /** @type {File} */value[idntfr];
|
|
3905
3906
|
break;
|
|
3906
3907
|
case 'lastModifiedDate':
|
|
3907
|
-
value = new Date(
|
|
3908
|
+
value = new Date(/** @type {File} */value.lastModified);
|
|
3908
3909
|
break;
|
|
3909
3910
|
}
|
|
3910
3911
|
} else if (!isObj(value) || !Object.hasOwn(value, idntfr)) {
|
|
@@ -3938,7 +3939,7 @@
|
|
|
3938
3939
|
}
|
|
3939
3940
|
value = value[identifier];
|
|
3940
3941
|
});
|
|
3941
|
-
value[(
|
|
3942
|
+
value[(/** @type {string} */last)] = key; // key is already a `keyValue` in our processing so no need to convert
|
|
3942
3943
|
}
|
|
3943
3944
|
|
|
3944
3945
|
/**
|
|
@@ -4235,7 +4236,7 @@
|
|
|
4235
4236
|
getCurrentNumber(tx, store, function (key) {
|
|
4236
4237
|
if (key > MAX_ALLOWED_CURRENT_NUMBER) {
|
|
4237
4238
|
// 2 ^ 53 (See <https://github.com/w3c/IndexedDB/issues/147>)
|
|
4238
|
-
cb('failure');
|
|
4239
|
+
cb('failure');
|
|
4239
4240
|
return;
|
|
4240
4241
|
}
|
|
4241
4242
|
// Increment current number by 1 (we cannot leverage SQLite's
|
|
@@ -4361,7 +4362,7 @@
|
|
|
4361
4362
|
convertValueToKeyRethrowingAndIfInvalid(upper);
|
|
4362
4363
|
}
|
|
4363
4364
|
if (lower !== undefined && upper !== undefined && lower !== upper) {
|
|
4364
|
-
if (
|
|
4365
|
+
if (/** @type {string} */_encode(lower) > (/** @type {string} */_encode(upper))) {
|
|
4365
4366
|
throw createDOMException('DataError', '`lower` must not be greater than `upper` argument in `bound()` call.');
|
|
4366
4367
|
}
|
|
4367
4368
|
}
|
|
@@ -4412,7 +4413,7 @@
|
|
|
4412
4413
|
if (!arguments.length) {
|
|
4413
4414
|
throw new TypeError('IDBKeyRange.lowerBound requires a value argument');
|
|
4414
4415
|
}
|
|
4415
|
-
// eslint-disable-next-line prefer-rest-params
|
|
4416
|
+
// eslint-disable-next-line prefer-rest-params -- API
|
|
4416
4417
|
return IDBKeyRange.__createInstance(value, undefined, arguments[1], true);
|
|
4417
4418
|
};
|
|
4418
4419
|
|
|
@@ -4424,7 +4425,7 @@
|
|
|
4424
4425
|
if (!arguments.length) {
|
|
4425
4426
|
throw new TypeError('IDBKeyRange.upperBound requires a value argument');
|
|
4426
4427
|
}
|
|
4427
|
-
// eslint-disable-next-line prefer-rest-params
|
|
4428
|
+
// eslint-disable-next-line prefer-rest-params -- API
|
|
4428
4429
|
return IDBKeyRange.__createInstance(undefined, value, true, arguments[1]);
|
|
4429
4430
|
};
|
|
4430
4431
|
|
|
@@ -4437,7 +4438,7 @@
|
|
|
4437
4438
|
if (arguments.length <= 1) {
|
|
4438
4439
|
throw new TypeError('IDBKeyRange.bound requires lower and upper arguments');
|
|
4439
4440
|
}
|
|
4440
|
-
// eslint-disable-next-line prefer-rest-params
|
|
4441
|
+
// eslint-disable-next-line prefer-rest-params -- API
|
|
4441
4442
|
return IDBKeyRange.__createInstance(lower, upper, arguments[2], arguments[3]);
|
|
4442
4443
|
};
|
|
4443
4444
|
IDBKeyRange.prototype[Symbol.toStringTag] = 'IDBKeyRangePrototype';
|
|
@@ -4499,7 +4500,7 @@
|
|
|
4499
4500
|
encodedUpperKey = checkCached ? range.__upperCached : _encode(range.upper);
|
|
4500
4501
|
}
|
|
4501
4502
|
if (hasLower) {
|
|
4502
|
-
sqlValues.push(escapeSQLiteStatement(
|
|
4503
|
+
sqlValues.push(escapeSQLiteStatement(/** @type {string} */encodedLowerKey));
|
|
4503
4504
|
if (hasUpper && encodedLowerKey === encodedUpperKey && !range.lowerOpen && !range.upperOpen) {
|
|
4504
4505
|
sql.push(quotedKeyColumnName, '=', '?');
|
|
4505
4506
|
return;
|
|
@@ -4511,7 +4512,7 @@
|
|
|
4511
4512
|
}
|
|
4512
4513
|
if (hasUpper) {
|
|
4513
4514
|
sql.push(quotedKeyColumnName, range.upperOpen ? '<' : '<=', '?');
|
|
4514
|
-
sqlValues.push(escapeSQLiteStatement(
|
|
4515
|
+
sqlValues.push(escapeSQLiteStatement(/** @type {string} */encodedUpperKey));
|
|
4515
4516
|
}
|
|
4516
4517
|
}
|
|
4517
4518
|
}
|
|
@@ -4573,7 +4574,8 @@
|
|
|
4573
4574
|
if (testObject.test) {
|
|
4574
4575
|
cleanInterface = true;
|
|
4575
4576
|
}
|
|
4576
|
-
|
|
4577
|
+
// eslint-disable-next-line no-unused-vars -- Problem with commonJS rollup
|
|
4578
|
+
} catch (err) {
|
|
4577
4579
|
// Object.defineProperty does not work as intended.
|
|
4578
4580
|
}
|
|
4579
4581
|
}
|
|
@@ -4655,7 +4657,7 @@
|
|
|
4655
4657
|
* @returns {void}
|
|
4656
4658
|
*/
|
|
4657
4659
|
forEach: function forEach(cb, thisArg) {
|
|
4658
|
-
// eslint-disable-next-line unicorn/no-array-callback-reference, unicorn/no-array-method-this-argument
|
|
4660
|
+
// eslint-disable-next-line unicorn/no-array-callback-reference, unicorn/no-array-method-this-argument -- Convenient
|
|
4659
4661
|
this._items.forEach(cb, thisArg);
|
|
4660
4662
|
},
|
|
4661
4663
|
/**
|
|
@@ -4664,7 +4666,7 @@
|
|
|
4664
4666
|
* @returns {any[]}
|
|
4665
4667
|
*/
|
|
4666
4668
|
map: function map(cb, thisArg) {
|
|
4667
|
-
// eslint-disable-next-line unicorn/no-array-callback-reference, unicorn/no-array-method-this-argument
|
|
4669
|
+
// eslint-disable-next-line unicorn/no-array-callback-reference, unicorn/no-array-method-this-argument -- Convenient
|
|
4668
4670
|
return this._items.map(cb, thisArg);
|
|
4669
4671
|
},
|
|
4670
4672
|
/**
|
|
@@ -4931,7 +4933,6 @@
|
|
|
4931
4933
|
|
|
4932
4934
|
// @ts-expect-error It's ok
|
|
4933
4935
|
IDBTransaction.prototype = EventTargetFactory.createInstance({
|
|
4934
|
-
// eslint-disable-next-line n/no-sync -- API
|
|
4935
4936
|
defaultSync: true,
|
|
4936
4937
|
// Ensure EventTarget preserves our properties
|
|
4937
4938
|
extraProperties: ['complete']
|
|
@@ -5089,7 +5090,7 @@
|
|
|
5089
5090
|
}
|
|
5090
5091
|
q.op(tx, q.args, success, error, executeNextRequest);
|
|
5091
5092
|
} catch (e) {
|
|
5092
|
-
error(
|
|
5093
|
+
error(/** @type {Error} */e);
|
|
5093
5094
|
}
|
|
5094
5095
|
}
|
|
5095
5096
|
}
|
|
@@ -5100,7 +5101,7 @@
|
|
|
5100
5101
|
// Not a genuine SQL error
|
|
5101
5102
|
return;
|
|
5102
5103
|
}
|
|
5103
|
-
var err = webSQLErrback(
|
|
5104
|
+
var err = webSQLErrback(/** @type {SQLError} */webSQLErr);
|
|
5104
5105
|
me.__abortTransaction(err);
|
|
5105
5106
|
}, function () {
|
|
5106
5107
|
// For Node, we don't need to try running here as we can keep
|
|
@@ -5301,7 +5302,7 @@
|
|
|
5301
5302
|
}
|
|
5302
5303
|
IDBTransaction.__assertNotFinished(me);
|
|
5303
5304
|
if (me.__objectStoreNames.indexOf(objectStoreName) === -1) {
|
|
5304
|
-
// eslint-disable-line unicorn/prefer-includes
|
|
5305
|
+
// eslint-disable-line unicorn/prefer-includes -- Not supported
|
|
5305
5306
|
throw createDOMException('NotFoundError', objectStoreName + ' is not participating in this transaction');
|
|
5306
5307
|
}
|
|
5307
5308
|
var store = me.db.__objectStores[objectStoreName];
|
|
@@ -5338,7 +5339,7 @@
|
|
|
5338
5339
|
me.__objectStoreNames = me.db.__oldObjectStoreNames;
|
|
5339
5340
|
Object.values(me.db.__objectStores).concat(Object.values(me.__storeHandles)).forEach(function (store) {
|
|
5340
5341
|
// Store was already created so we restore to name before the rename
|
|
5341
|
-
if ('__pendingName' in store && me.db.__oldObjectStoreNames.indexOf(store.__pendingName) > -1 // eslint-disable-line unicorn/prefer-includes
|
|
5342
|
+
if ('__pendingName' in store && me.db.__oldObjectStoreNames.indexOf(store.__pendingName) > -1 // eslint-disable-line unicorn/prefer-includes -- Not supported
|
|
5342
5343
|
) {
|
|
5343
5344
|
store.__name = store.__originalName;
|
|
5344
5345
|
}
|
|
@@ -5346,7 +5347,7 @@
|
|
|
5346
5347
|
delete store.__pendingDelete;
|
|
5347
5348
|
Object.values(store.__indexes).concat(Object.values(store.__indexHandles)).forEach(function (index) {
|
|
5348
5349
|
// Index was already created so we restore to name before the rename
|
|
5349
|
-
if ('__pendingName' in index && store.__oldIndexNames.indexOf(index.__pendingName) > -1 // eslint-disable-line unicorn/prefer-includes
|
|
5350
|
+
if ('__pendingName' in index && store.__oldIndexNames.indexOf(index.__pendingName) > -1 // eslint-disable-line unicorn/prefer-includes -- Not supported
|
|
5350
5351
|
) {
|
|
5351
5352
|
index.__name = index.__originalName;
|
|
5352
5353
|
}
|
|
@@ -5386,7 +5387,7 @@
|
|
|
5386
5387
|
}
|
|
5387
5388
|
me.dispatchEvent(createEvent('__preabort'));
|
|
5388
5389
|
me.__requests.filter(function (q, i, arr) {
|
|
5389
|
-
// eslint-disable-line promise/no-promise-in-callback
|
|
5390
|
+
// eslint-disable-line promise/no-promise-in-callback -- Sync promise
|
|
5390
5391
|
return q.req && !q.req.__done && [i, -1].includes(arr.map(function (q) {
|
|
5391
5392
|
return q.req;
|
|
5392
5393
|
}).lastIndexOf(q.req));
|
|
@@ -5407,7 +5408,7 @@
|
|
|
5407
5408
|
bubbles: true,
|
|
5408
5409
|
cancelable: true
|
|
5409
5410
|
});
|
|
5410
|
-
return new SyncPromise(
|
|
5411
|
+
return new SyncPromise(/** @type {() => void} */
|
|
5411
5412
|
function (resolve) {
|
|
5412
5413
|
setTimeout(function () {
|
|
5413
5414
|
if (!q.req) {
|
|
@@ -5452,6 +5453,7 @@
|
|
|
5452
5453
|
}
|
|
5453
5454
|
try {
|
|
5454
5455
|
me.__tx.executeSql('ROLLBACK', [], abort, /** @type {SQLStatementErrorCallback} */abort); // Not working in some circumstances, even in Node
|
|
5456
|
+
// eslint-disable-next-line no-unused-vars -- Problem with commonJS rollup
|
|
5455
5457
|
} catch (err) {
|
|
5456
5458
|
// Browser errs when transaction has ended and since it most likely already erred here,
|
|
5457
5459
|
// we call to abort
|
|
@@ -6404,8 +6406,8 @@
|
|
|
6404
6406
|
return "CryptoKey" === toStringTag(e) && e.extractable;
|
|
6405
6407
|
},
|
|
6406
6408
|
replaceAsync: function replaceAsync(t) {
|
|
6407
|
-
return new e(
|
|
6408
|
-
var _ref = _asyncToGenerator(
|
|
6409
|
+
return new e(/*#__PURE__*/function () {
|
|
6410
|
+
var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(e, r) {
|
|
6409
6411
|
var n;
|
|
6410
6412
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
6411
6413
|
while (1) switch (_context.prev = _context.next) {
|
|
@@ -6789,8 +6791,8 @@
|
|
|
6789
6791
|
a = document.createElement("img");
|
|
6790
6792
|
return a.addEventListener("load", function () {
|
|
6791
6793
|
n.drawImage(a, 0, 0);
|
|
6792
|
-
}), a.src = t.dataURL, new e(
|
|
6793
|
-
var _ref10 = _asyncToGenerator(
|
|
6794
|
+
}), a.src = t.dataURL, new e(/*#__PURE__*/function () {
|
|
6795
|
+
var _ref10 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2(e, t) {
|
|
6794
6796
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
6795
6797
|
while (1) switch (_context2.prev = _context2.next) {
|
|
6796
6798
|
case 0:
|
|
@@ -6916,7 +6918,9 @@
|
|
|
6916
6918
|
test: function test(e) {
|
|
6917
6919
|
return "Boolean" === toStringTag(e) && "object" == _typeof$2(e);
|
|
6918
6920
|
},
|
|
6919
|
-
replace:
|
|
6921
|
+
replace: function replace(e) {
|
|
6922
|
+
return e.valueOf();
|
|
6923
|
+
},
|
|
6920
6924
|
revive: function revive(e) {
|
|
6921
6925
|
return new Boolean(e);
|
|
6922
6926
|
}
|
|
@@ -7115,7 +7119,6 @@
|
|
|
7115
7119
|
function encode(obj, func) {
|
|
7116
7120
|
var ret;
|
|
7117
7121
|
try {
|
|
7118
|
-
// eslint-disable-next-line n/no-sync
|
|
7119
7122
|
ret = typeson.stringifySync(obj);
|
|
7120
7123
|
} catch (err) {
|
|
7121
7124
|
// SCA in typeson-registry using `DOMException` which is not defined (e.g., in Node)
|
|
@@ -7249,7 +7252,7 @@
|
|
|
7249
7252
|
* @returns {string}
|
|
7250
7253
|
*/
|
|
7251
7254
|
get: function get() {
|
|
7252
|
-
return '__pendingName' in me ? (
|
|
7255
|
+
return '__pendingName' in me ? (/** @type {string} */me.__pendingName) : me.name;
|
|
7253
7256
|
}
|
|
7254
7257
|
});
|
|
7255
7258
|
Object.defineProperty(me, 'name', {
|
|
@@ -7428,7 +7431,8 @@
|
|
|
7428
7431
|
tx.executeSql('UPDATE ' + escapeStoreNameForSQL(storeName) + ' SET ' + escapeIndexNameForSQL(indexName) + ' = ? WHERE "key" = ?', [escapeSQLiteStatement(indexKeyStr), data.rows.item(i).key], function () {
|
|
7429
7432
|
addIndexEntry(i + 1);
|
|
7430
7433
|
}, /** @type {SQLStatementErrorCallback} */error);
|
|
7431
|
-
|
|
7434
|
+
// eslint-disable-next-line no-unused-vars -- Problem with commonJS rollup
|
|
7435
|
+
} catch (err) {
|
|
7432
7436
|
// Not a valid value to insert into index, so just continue
|
|
7433
7437
|
addIndexEntry(i + 1);
|
|
7434
7438
|
}
|
|
@@ -7616,7 +7620,7 @@
|
|
|
7616
7620
|
IDBIndex.prototype.openCursor = function /* query, direction */
|
|
7617
7621
|
() {
|
|
7618
7622
|
var me = this;
|
|
7619
|
-
// eslint-disable-next-line prefer-rest-params
|
|
7623
|
+
// eslint-disable-next-line prefer-rest-params -- API
|
|
7620
7624
|
var _arguments = Array.prototype.slice.call(arguments),
|
|
7621
7625
|
query = _arguments[0],
|
|
7622
7626
|
direction = _arguments[1];
|
|
@@ -7633,7 +7637,7 @@
|
|
|
7633
7637
|
IDBIndex.prototype.openKeyCursor = function /* query, direction */
|
|
7634
7638
|
() {
|
|
7635
7639
|
var me = this;
|
|
7636
|
-
// eslint-disable-next-line prefer-rest-params
|
|
7640
|
+
// eslint-disable-next-line prefer-rest-params -- API
|
|
7637
7641
|
var _arguments2 = Array.prototype.slice.call(arguments),
|
|
7638
7642
|
query = _arguments2[0],
|
|
7639
7643
|
direction = _arguments2[1];
|
|
@@ -7678,7 +7682,7 @@
|
|
|
7678
7682
|
*/
|
|
7679
7683
|
IDBIndex.prototype.getAll = function /* query, count */
|
|
7680
7684
|
() {
|
|
7681
|
-
// eslint-disable-next-line prefer-rest-params
|
|
7685
|
+
// eslint-disable-next-line prefer-rest-params -- API
|
|
7682
7686
|
var _arguments3 = Array.prototype.slice.call(arguments),
|
|
7683
7687
|
query = _arguments3[0],
|
|
7684
7688
|
count = _arguments3[1];
|
|
@@ -7691,7 +7695,7 @@
|
|
|
7691
7695
|
*/
|
|
7692
7696
|
IDBIndex.prototype.getAllKeys = function /* query, count */
|
|
7693
7697
|
() {
|
|
7694
|
-
// eslint-disable-next-line prefer-rest-params
|
|
7698
|
+
// eslint-disable-next-line prefer-rest-params -- API
|
|
7695
7699
|
var _arguments4 = Array.prototype.slice.call(arguments),
|
|
7696
7700
|
query = _arguments4[0],
|
|
7697
7701
|
count = _arguments4[1];
|
|
@@ -7705,7 +7709,7 @@
|
|
|
7705
7709
|
IDBIndex.prototype.count = function /* query */
|
|
7706
7710
|
() {
|
|
7707
7711
|
var me = this;
|
|
7708
|
-
// eslint-disable-next-line prefer-rest-params
|
|
7712
|
+
// eslint-disable-next-line prefer-rest-params -- API
|
|
7709
7713
|
var query = arguments[0];
|
|
7710
7714
|
// With the exception of needing to check whether the index has been
|
|
7711
7715
|
// deleted, we could, for greater spec parity (if not accuracy),
|
|
@@ -7944,7 +7948,7 @@
|
|
|
7944
7948
|
return rowKey.includes(check);
|
|
7945
7949
|
}) ||
|
|
7946
7950
|
// More precise than our SQL
|
|
7947
|
-
isMultiEntryMatch(
|
|
7951
|
+
isMultiEntryMatch(/** @type {string} */
|
|
7948
7952
|
encodedKey, row[escapedIndexNameForKeyCol]))) {
|
|
7949
7953
|
recordCount++;
|
|
7950
7954
|
record = row;
|
|
@@ -8016,12 +8020,12 @@
|
|
|
8016
8020
|
sql.push('OR');
|
|
8017
8021
|
}
|
|
8018
8022
|
sql.push(escapeIndexNameForSQL(index.name), "LIKE ? ESCAPE '^' ");
|
|
8019
|
-
sqlValues.push('%' + sqlLIKEEscape(
|
|
8023
|
+
sqlValues.push('%' + sqlLIKEEscape(/** @type {string} */_encode(innerKey, index.multiEntry)) + '%');
|
|
8020
8024
|
});
|
|
8021
8025
|
sql.push(')');
|
|
8022
8026
|
} else if (index.multiEntry) {
|
|
8023
8027
|
sql.push('AND', escapeIndexNameForSQL(index.name), "LIKE ? ESCAPE '^'");
|
|
8024
|
-
sqlValues.push('%' + sqlLIKEEscape(
|
|
8028
|
+
sqlValues.push('%' + sqlLIKEEscape(/** @type {string} */_encode(range, index.multiEntry)) + '%');
|
|
8025
8029
|
} else {
|
|
8026
8030
|
var convertedRange = convertValueToKeyRange(range, nullDisallowed);
|
|
8027
8031
|
setSQLForKeyRange(convertedRange, escapeIndexNameForSQL(index.name), sql, sqlValues, true, false);
|
|
@@ -8526,6 +8530,7 @@
|
|
|
8526
8530
|
if ('invalid' in indexKey && indexKey.invalid || 'failure' in indexKey && indexKey.failure) {
|
|
8527
8531
|
throw new Error('Go to catch');
|
|
8528
8532
|
}
|
|
8533
|
+
// eslint-disable-next-line no-unused-vars -- Problem with commonJS rollup
|
|
8529
8534
|
} catch (err) {
|
|
8530
8535
|
resolve(undefined);
|
|
8531
8536
|
return;
|
|
@@ -8567,7 +8572,7 @@
|
|
|
8567
8572
|
// Key.convertValueToKey(primaryKey); // Already run
|
|
8568
8573
|
sqlStart.push(sqlQuote('key'), ',');
|
|
8569
8574
|
sqlEnd.push('?,');
|
|
8570
|
-
insertSqlValues.push(escapeSQLiteStatement(
|
|
8575
|
+
insertSqlValues.push(escapeSQLiteStatement(/** @type {string} */_encode(clonedKeyOrCurrentNumber)));
|
|
8571
8576
|
}
|
|
8572
8577
|
Object.entries(paramMap).forEach(function (_ref) {
|
|
8573
8578
|
var _ref2 = _slicedToArray$1(_ref, 2),
|
|
@@ -8620,7 +8625,7 @@
|
|
|
8620
8625
|
*/
|
|
8621
8626
|
IDBObjectStore.prototype.add = function (value /* , key */) {
|
|
8622
8627
|
var me = this;
|
|
8623
|
-
// eslint-disable-next-line prefer-rest-params
|
|
8628
|
+
// eslint-disable-next-line prefer-rest-params -- API
|
|
8624
8629
|
var key = arguments[1];
|
|
8625
8630
|
if (!(me instanceof IDBObjectStore)) {
|
|
8626
8631
|
throw new TypeError('Illegal invocation');
|
|
@@ -8650,7 +8655,7 @@
|
|
|
8650
8655
|
*/
|
|
8651
8656
|
IDBObjectStore.prototype.put = function (value /* , key */) {
|
|
8652
8657
|
var me = this;
|
|
8653
|
-
// eslint-disable-next-line prefer-rest-params
|
|
8658
|
+
// eslint-disable-next-line prefer-rest-params -- API
|
|
8654
8659
|
var key = arguments[1];
|
|
8655
8660
|
if (!(me instanceof IDBObjectStore)) {
|
|
8656
8661
|
throw new TypeError('Illegal invocation');
|
|
@@ -8707,7 +8712,7 @@
|
|
|
8707
8712
|
* @returns {void}
|
|
8708
8713
|
*/
|
|
8709
8714
|
IDBObjectStore.__storingRecordObjectStore = function (request, store, invalidateCache, value, noOverwrite /* , key */) {
|
|
8710
|
-
// eslint-disable-next-line prefer-rest-params
|
|
8715
|
+
// eslint-disable-next-line prefer-rest-params -- API
|
|
8711
8716
|
var key = arguments[5];
|
|
8712
8717
|
/** @type {import('./IDBTransaction.js').IDBTransactionFull} */
|
|
8713
8718
|
store.transaction.__pushToQueue(request, function (tx, args, success, error) {
|
|
@@ -8852,7 +8857,7 @@
|
|
|
8852
8857
|
*/
|
|
8853
8858
|
IDBObjectStore.prototype.getAll = function /* query, count */
|
|
8854
8859
|
() {
|
|
8855
|
-
// eslint-disable-next-line prefer-rest-params
|
|
8860
|
+
// eslint-disable-next-line prefer-rest-params -- API
|
|
8856
8861
|
var _arguments = Array.prototype.slice.call(arguments),
|
|
8857
8862
|
query = _arguments[0],
|
|
8858
8863
|
count = _arguments[1];
|
|
@@ -8865,7 +8870,7 @@
|
|
|
8865
8870
|
*/
|
|
8866
8871
|
IDBObjectStore.prototype.getAllKeys = function /* query, count */
|
|
8867
8872
|
() {
|
|
8868
|
-
// eslint-disable-next-line prefer-rest-params
|
|
8873
|
+
// eslint-disable-next-line prefer-rest-params -- API
|
|
8869
8874
|
var _arguments2 = Array.prototype.slice.call(arguments),
|
|
8870
8875
|
query = _arguments2[0],
|
|
8871
8876
|
count = _arguments2[1];
|
|
@@ -8952,7 +8957,7 @@
|
|
|
8952
8957
|
IDBObjectStore.prototype.count = function /* query */
|
|
8953
8958
|
() {
|
|
8954
8959
|
var me = this;
|
|
8955
|
-
// eslint-disable-next-line prefer-rest-params
|
|
8960
|
+
// eslint-disable-next-line prefer-rest-params -- API
|
|
8956
8961
|
var query = arguments[0];
|
|
8957
8962
|
if (!(me instanceof IDBObjectStore)) {
|
|
8958
8963
|
throw new TypeError('Illegal invocation');
|
|
@@ -8971,7 +8976,7 @@
|
|
|
8971
8976
|
IDBObjectStore.prototype.openCursor = function /* query, direction */
|
|
8972
8977
|
() {
|
|
8973
8978
|
var me = this;
|
|
8974
|
-
// eslint-disable-next-line prefer-rest-params
|
|
8979
|
+
// eslint-disable-next-line prefer-rest-params -- API
|
|
8975
8980
|
var _arguments3 = Array.prototype.slice.call(arguments),
|
|
8976
8981
|
query = _arguments3[0],
|
|
8977
8982
|
direction = _arguments3[1];
|
|
@@ -8995,7 +9000,7 @@
|
|
|
8995
9000
|
throw new TypeError('Illegal invocation');
|
|
8996
9001
|
}
|
|
8997
9002
|
IDBObjectStore.__invalidStateIfDeleted(me);
|
|
8998
|
-
// eslint-disable-next-line prefer-rest-params
|
|
9003
|
+
// eslint-disable-next-line prefer-rest-params -- API
|
|
8999
9004
|
var _arguments4 = Array.prototype.slice.call(arguments),
|
|
9000
9005
|
query = _arguments4[0],
|
|
9001
9006
|
direction = _arguments4[1];
|
|
@@ -9039,7 +9044,7 @@
|
|
|
9039
9044
|
*/
|
|
9040
9045
|
IDBObjectStore.prototype.createIndex = function (indexName, keyPath /* , optionalParameters */) {
|
|
9041
9046
|
var me = this;
|
|
9042
|
-
// eslint-disable-next-line prefer-rest-params
|
|
9047
|
+
// eslint-disable-next-line prefer-rest-params -- API
|
|
9043
9048
|
var optionalParameters = arguments[2];
|
|
9044
9049
|
if (!(me instanceof IDBObjectStore)) {
|
|
9045
9050
|
throw new TypeError('Illegal invocation');
|
|
@@ -9462,7 +9467,7 @@
|
|
|
9462
9467
|
* @returns {IDBObjectStore}
|
|
9463
9468
|
*/
|
|
9464
9469
|
IDBDatabase.prototype.createObjectStore = function (storeName /* , createOptions */) {
|
|
9465
|
-
// eslint-disable-next-line prefer-rest-params
|
|
9470
|
+
// eslint-disable-next-line prefer-rest-params -- API
|
|
9466
9471
|
var createOptions = arguments[1];
|
|
9467
9472
|
storeName = String(storeName); // W3C test within IDBObjectStore.js seems to accept string conversion
|
|
9468
9473
|
if (!(this instanceof IDBDatabase)) {
|
|
@@ -9552,7 +9557,7 @@
|
|
|
9552
9557
|
if (arguments.length === 0) {
|
|
9553
9558
|
throw new TypeError('You must supply a valid `storeNames` to `IDBDatabase.transaction`');
|
|
9554
9559
|
}
|
|
9555
|
-
// eslint-disable-next-line prefer-rest-params
|
|
9560
|
+
// eslint-disable-next-line prefer-rest-params -- API
|
|
9556
9561
|
var mode = arguments[1];
|
|
9557
9562
|
storeNames = isIterable(storeNames)
|
|
9558
9563
|
// Creating new array also ensures sequence is passed by value: https://heycam.github.io/webidl/#idl-sequence
|
|
@@ -9675,6 +9680,7 @@
|
|
|
9675
9680
|
* @returns {string}
|
|
9676
9681
|
*/
|
|
9677
9682
|
var getOrigin = function getOrigin() {
|
|
9683
|
+
// eslint-disable-next-line no-undef -- If browser/polyfilled
|
|
9678
9684
|
return (typeof location === "undefined" ? "undefined" : _typeof$2(location)) !== 'object' || !location ? 'null' : location.origin;
|
|
9679
9685
|
};
|
|
9680
9686
|
var hasNullOrigin = function hasNullOrigin() {
|
|
@@ -9725,7 +9731,7 @@
|
|
|
9725
9731
|
cb(req);
|
|
9726
9732
|
}
|
|
9727
9733
|
|
|
9728
|
-
/* eslint-disable default-param-last */
|
|
9734
|
+
/* eslint-disable default-param-last -- Keep cb at end */
|
|
9729
9735
|
/**
|
|
9730
9736
|
* @param {import('./IDBRequest.js').IDBOpenDBRequestFull} req
|
|
9731
9737
|
* @param {string} name
|
|
@@ -9736,7 +9742,7 @@
|
|
|
9736
9742
|
function addRequestToConnectionQueue(req, name) {
|
|
9737
9743
|
var origin = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : getOrigin();
|
|
9738
9744
|
var cb = arguments.length > 3 ? arguments[3] : undefined;
|
|
9739
|
-
/* eslint-enable default-param-last */
|
|
9745
|
+
/* eslint-enable default-param-last -- Keep cb at end */
|
|
9740
9746
|
if (!connectionQueue[origin][name]) {
|
|
9741
9747
|
connectionQueue[origin][name] = [];
|
|
9742
9748
|
}
|
|
@@ -9969,7 +9975,7 @@
|
|
|
9969
9975
|
* @returns {void}
|
|
9970
9976
|
*/
|
|
9971
9977
|
function sysDbCreateError(tx, err) {
|
|
9972
|
-
var er = webSQLErrback(
|
|
9978
|
+
var er = webSQLErrback(/** @type {SQLError} */err || tx);
|
|
9973
9979
|
if (CFG.DEBUG) {
|
|
9974
9980
|
console.log('Error in sysdb transaction - when creating dbVersions', err);
|
|
9975
9981
|
}
|
|
@@ -10045,7 +10051,7 @@
|
|
|
10045
10051
|
if (!(me instanceof IDBFactory)) {
|
|
10046
10052
|
throw new TypeError('Illegal invocation');
|
|
10047
10053
|
}
|
|
10048
|
-
// eslint-disable-next-line prefer-rest-params
|
|
10054
|
+
// eslint-disable-next-line prefer-rest-params -- API
|
|
10049
10055
|
var version = arguments[1];
|
|
10050
10056
|
if (arguments.length === 0) {
|
|
10051
10057
|
throw new TypeError('Database name is required');
|
|
@@ -10071,10 +10077,10 @@
|
|
|
10071
10077
|
|
|
10072
10078
|
/** @type {string} */
|
|
10073
10079
|
var escapedDatabaseName;
|
|
10074
|
-
// eslint-disable-next-line no-useless-catch
|
|
10080
|
+
// eslint-disable-next-line no-useless-catch -- Possible refactoring
|
|
10075
10081
|
try {
|
|
10076
10082
|
escapedDatabaseName = escapeDatabaseNameForSQLAndFiles(name);
|
|
10077
|
-
// eslint-disable-next-line sonarjs/no-useless-catch
|
|
10083
|
+
// eslint-disable-next-line sonarjs/no-useless-catch -- Possible refactoring
|
|
10078
10084
|
} catch (err) {
|
|
10079
10085
|
throw err; // new TypeError('You have supplied a database name which does not match the currently supported configuration, possibly due to a length limit enforced for Node compatibility.');
|
|
10080
10086
|
}
|
|
@@ -10089,7 +10095,7 @@
|
|
|
10089
10095
|
if (calledDbCreateError) {
|
|
10090
10096
|
return false;
|
|
10091
10097
|
}
|
|
10092
|
-
var er = err ? webSQLErrback(err) : (
|
|
10098
|
+
var er = err ? webSQLErrback(err) : (/** @type {Error} */tx);
|
|
10093
10099
|
calledDbCreateError = true;
|
|
10094
10100
|
// Re: why bubbling here (and how cancelable is only really relevant for `window.onerror`) see: https://github.com/w3c/IndexedDB/issues/86
|
|
10095
10101
|
var evt = createEvent('error', er, {
|
|
@@ -10139,7 +10145,8 @@
|
|
|
10139
10145
|
if (err) {
|
|
10140
10146
|
try {
|
|
10141
10147
|
systx.executeSql('ROLLBACK', [], cb, cb);
|
|
10142
|
-
|
|
10148
|
+
// eslint-disable-next-line no-unused-vars -- Problem with commonJS rollup
|
|
10149
|
+
} catch (err) {
|
|
10143
10150
|
// Browser may fail with expired transaction above so
|
|
10144
10151
|
// no choice but to manually revert
|
|
10145
10152
|
sysdb.transaction(function (systx) {
|
|
@@ -10157,7 +10164,7 @@
|
|
|
10157
10164
|
if (oldVersion === 0) {
|
|
10158
10165
|
systx.executeSql('DELETE FROM dbVersions WHERE "name" = ?', [sqlSafeName], function () {
|
|
10159
10166
|
// @ts-expect-error Force to work
|
|
10160
|
-
cb(reportError); // eslint-disable-line promise/no-callback-in-promise
|
|
10167
|
+
cb(reportError); // eslint-disable-line promise/no-callback-in-promise -- Convenient
|
|
10161
10168
|
},
|
|
10162
10169
|
// @ts-expect-error Force to work
|
|
10163
10170
|
reportError);
|
|
@@ -10171,7 +10178,7 @@
|
|
|
10171
10178
|
return;
|
|
10172
10179
|
}
|
|
10173
10180
|
// In browser, should auto-commit
|
|
10174
|
-
cb(); // eslint-disable-line promise/no-callback-in-promise
|
|
10181
|
+
cb(); // eslint-disable-line promise/no-callback-in-promise -- Convenient
|
|
10175
10182
|
};
|
|
10176
10183
|
sysdb.transaction(function (systx) {
|
|
10177
10184
|
/**
|
|
@@ -10249,7 +10256,7 @@
|
|
|
10249
10256
|
if (pos > -1) {
|
|
10250
10257
|
connection.__transactions.splice(pos, 1);
|
|
10251
10258
|
}
|
|
10252
|
-
if (
|
|
10259
|
+
if (/** @type {import('./IDBDatabase.js').IDBDatabaseFull} */req.__result.__closePending) {
|
|
10253
10260
|
req.__transaction = null;
|
|
10254
10261
|
var err = createDOMException('AbortError', 'The connection has been closed.');
|
|
10255
10262
|
dbCreateError(err);
|
|
@@ -10404,10 +10411,10 @@
|
|
|
10404
10411
|
|
|
10405
10412
|
/** @type {string} */
|
|
10406
10413
|
var escapedDatabaseName;
|
|
10407
|
-
// eslint-disable-next-line no-useless-catch
|
|
10414
|
+
// eslint-disable-next-line no-useless-catch -- Possible refactoring
|
|
10408
10415
|
try {
|
|
10409
10416
|
escapedDatabaseName = escapeDatabaseNameForSQLAndFiles(name);
|
|
10410
|
-
// eslint-disable-next-line sonarjs/no-useless-catch
|
|
10417
|
+
// eslint-disable-next-line sonarjs/no-useless-catch -- Possible refactoring
|
|
10411
10418
|
} catch (err) {
|
|
10412
10419
|
throw err; // throw new TypeError('You have supplied a database name which does not match the currently supported configuration, possibly due to a length limit enforced for Node compatibility.');
|
|
10413
10420
|
}
|
|
@@ -10440,7 +10447,7 @@
|
|
|
10440
10447
|
if (calledDBError || err === true) {
|
|
10441
10448
|
return false;
|
|
10442
10449
|
}
|
|
10443
|
-
var er = webSQLErrback(
|
|
10450
|
+
var er = webSQLErrback(/** @type {SQLError} */err || tx);
|
|
10444
10451
|
sysdbFinishedCbDelete(true, function () {
|
|
10445
10452
|
req.__done = true;
|
|
10446
10453
|
req.__error = er;
|
|
@@ -10494,7 +10501,7 @@
|
|
|
10494
10501
|
version = _data$rows$item.version;
|
|
10495
10502
|
var openConnections = me.__connections[name] || [];
|
|
10496
10503
|
triggerAnyVersionChangeAndBlockedEvents(openConnections, req, version, null).then(function () {
|
|
10497
|
-
// eslint-disable-line promise/catch-or-return
|
|
10504
|
+
// eslint-disable-line promise/catch-or-return -- Sync promise
|
|
10498
10505
|
// Since we need two databases which can't be in a single transaction, we
|
|
10499
10506
|
// do this deleting from `dbVersions` first since the `__sys__` deleting
|
|
10500
10507
|
// only impacts file memory whereas this one is critical for avoiding it
|
|
@@ -10566,7 +10573,7 @@
|
|
|
10566
10573
|
var me = this;
|
|
10567
10574
|
var calledDbCreateError = false;
|
|
10568
10575
|
return new Promise(function (resolve, reject) {
|
|
10569
|
-
// eslint-disable-line promise/avoid-new
|
|
10576
|
+
// eslint-disable-line promise/avoid-new -- Own polyfill
|
|
10570
10577
|
if (!(me instanceof IDBFactory)) {
|
|
10571
10578
|
throw new TypeError('Illegal invocation');
|
|
10572
10579
|
}
|
|
@@ -10583,7 +10590,7 @@
|
|
|
10583
10590
|
if (calledDbCreateError) {
|
|
10584
10591
|
return false;
|
|
10585
10592
|
}
|
|
10586
|
-
var er = err ? webSQLErrback(
|
|
10593
|
+
var er = err ? webSQLErrback(/** @type {SQLError} */err) : tx;
|
|
10587
10594
|
calledDbCreateError = true;
|
|
10588
10595
|
reject(er);
|
|
10589
10596
|
return false;
|
|
@@ -10718,7 +10725,7 @@
|
|
|
10718
10725
|
}
|
|
10719
10726
|
var IDBCursorAlias = IDBCursor;
|
|
10720
10727
|
|
|
10721
|
-
/* eslint-disable func-name-matching */
|
|
10728
|
+
/* eslint-disable func-name-matching -- API */
|
|
10722
10729
|
/**
|
|
10723
10730
|
* The IndexedDB Cursor Object.
|
|
10724
10731
|
* @see http://dvcs.w3.org/hg/IndexedDB/raw-file/tip/Overview.html#idl-def-IDBCursor
|
|
@@ -10734,14 +10741,14 @@
|
|
|
10734
10741
|
* @returns {void}
|
|
10735
10742
|
*/
|
|
10736
10743
|
IDBCursor.__super = function IDBCursor(query, direction, store, source, keyColumnName, valueColumnName, count) {
|
|
10737
|
-
/* eslint-enable func-name-matching */
|
|
10744
|
+
/* eslint-enable func-name-matching -- API */
|
|
10738
10745
|
// @ts-expect-error Should be ok
|
|
10739
10746
|
this[Symbol.toStringTag] = 'IDBCursor';
|
|
10740
10747
|
defineReadonlyProperties(this, ['key', 'primaryKey', 'request']);
|
|
10741
10748
|
IDBObjectStore.__invalidStateIfDeleted(store);
|
|
10742
10749
|
this.__indexSource = instanceOf(source, IDBIndex);
|
|
10743
10750
|
if (this.__indexSource) {
|
|
10744
|
-
IDBIndex.__invalidStateIfDeleted(
|
|
10751
|
+
IDBIndex.__invalidStateIfDeleted(/** @type {import('./IDBIndex.js').IDBIndexFull} */source);
|
|
10745
10752
|
}
|
|
10746
10753
|
IDBTransaction.__assertActive(store.transaction);
|
|
10747
10754
|
var range = convertValueToKeyRange(query);
|
|
@@ -10870,16 +10877,16 @@
|
|
|
10870
10877
|
if (primaryKey !== undefined) {
|
|
10871
10878
|
sql.push('AND', quotedKey, op + '= ?');
|
|
10872
10879
|
// Key.convertValueToKey(primaryKey); // Already checked by `continuePrimaryKey`
|
|
10873
|
-
sqlValues.push(
|
|
10880
|
+
sqlValues.push(/** @type {string} */_encode(primaryKey));
|
|
10874
10881
|
}
|
|
10875
10882
|
if (key !== undefined) {
|
|
10876
10883
|
sql.push('AND', quotedKeyColumnName, op + '= ?');
|
|
10877
10884
|
// Key.convertValueToKey(key); // Already checked by `continue` or `continuePrimaryKey`
|
|
10878
|
-
sqlValues.push(
|
|
10885
|
+
sqlValues.push(/** @type {string} */_encode(key));
|
|
10879
10886
|
} else if (continueCall && me.__key !== undefined) {
|
|
10880
10887
|
sql.push('AND', quotedKeyColumnName, op + ' ?');
|
|
10881
10888
|
// Key.convertValueToKey(me.__key); // Already checked when stored
|
|
10882
|
-
sqlValues.push(
|
|
10889
|
+
sqlValues.push(/** @type {string} */_encode(me.__key));
|
|
10883
10890
|
}
|
|
10884
10891
|
if (!me.__count) {
|
|
10885
10892
|
// 1. Sort by key
|
|
@@ -10960,7 +10967,7 @@
|
|
|
10960
10967
|
if (me.__range && me.__range.lower !== undefined && Array.isArray(me.__range.upper)) {
|
|
10961
10968
|
if (me.__range.upper.indexOf(me.__range.lower) === 0) {
|
|
10962
10969
|
sql.push('AND', quotedKeyColumnName, "LIKE ? ESCAPE '^'");
|
|
10963
|
-
sqlValues.push('%' + sqlLIKEEscape(
|
|
10970
|
+
sqlValues.push('%' + sqlLIKEEscape(/** @type {string} */me.__range.__lowerCached.slice(0, -1)) + '%');
|
|
10964
10971
|
}
|
|
10965
10972
|
}
|
|
10966
10973
|
|
|
@@ -10971,16 +10978,16 @@
|
|
|
10971
10978
|
if (primaryKey !== undefined) {
|
|
10972
10979
|
sql.push('AND', quotedKey, op + '= ?');
|
|
10973
10980
|
// Key.convertValueToKey(primaryKey); // Already checked by `continuePrimaryKey`
|
|
10974
|
-
sqlValues.push(
|
|
10981
|
+
sqlValues.push(/** @type {string} */_encode(primaryKey));
|
|
10975
10982
|
}
|
|
10976
10983
|
if (key !== undefined) {
|
|
10977
10984
|
sql.push('AND', quotedKeyColumnName, op + '= ?');
|
|
10978
10985
|
// Key.convertValueToKey(key); // Already checked by `continue` or `continuePrimaryKey`
|
|
10979
|
-
sqlValues.push(
|
|
10986
|
+
sqlValues.push(/** @type {string} */_encode(key));
|
|
10980
10987
|
} else if (me.__key !== undefined) {
|
|
10981
10988
|
sql.push('AND', quotedKeyColumnName, op + ' ?');
|
|
10982
10989
|
// Key.convertValueToKey(me.__key); // Already checked when entered
|
|
10983
|
-
sqlValues.push(
|
|
10990
|
+
sqlValues.push(/** @type {string} */_encode(me.__key));
|
|
10984
10991
|
}
|
|
10985
10992
|
if (!me.__count) {
|
|
10986
10993
|
// 1. Sort by key
|
|
@@ -11031,7 +11038,7 @@
|
|
|
11031
11038
|
* @type {RowItemNonNull}
|
|
11032
11039
|
*/
|
|
11033
11040
|
var clone = {
|
|
11034
|
-
matchingKey: (
|
|
11041
|
+
matchingKey: (/** @type {string} */
|
|
11035
11042
|
_encode(matchingKey, true)),
|
|
11036
11043
|
key: _rowItem.key
|
|
11037
11044
|
};
|
|
@@ -11199,7 +11206,7 @@
|
|
|
11199
11206
|
IDBCursor.prototype.__sourceOrEffectiveObjStoreDeleted = function () {
|
|
11200
11207
|
IDBObjectStore.__invalidStateIfDeleted(this.__store, "The cursor's effective object store has been deleted");
|
|
11201
11208
|
if (this.__indexSource) {
|
|
11202
|
-
IDBIndex.__invalidStateIfDeleted(
|
|
11209
|
+
IDBIndex.__invalidStateIfDeleted(/** @type {import('./IDBIndex.js').IDBIndexFull} */this.source, "The cursor's index source has been deleted");
|
|
11203
11210
|
}
|
|
11204
11211
|
};
|
|
11205
11212
|
|
|
@@ -11319,7 +11326,7 @@
|
|
|
11319
11326
|
*/
|
|
11320
11327
|
IDBCursor.prototype["continue"] = function /* key */
|
|
11321
11328
|
() {
|
|
11322
|
-
// eslint-disable-next-line prefer-rest-params
|
|
11329
|
+
// eslint-disable-next-line prefer-rest-params -- API
|
|
11323
11330
|
this.__continue(arguments[0]);
|
|
11324
11331
|
};
|
|
11325
11332
|
|
|
@@ -11465,7 +11472,7 @@
|
|
|
11465
11472
|
console.log(sql, key, primaryKey);
|
|
11466
11473
|
}
|
|
11467
11474
|
// Key.convertValueToKey(primaryKey); // Already checked when entered
|
|
11468
|
-
tx.executeSql(sql, [escapeSQLiteStatement(
|
|
11475
|
+
tx.executeSql(sql, [escapeSQLiteStatement(/** @type {string} */_encode(primaryKey))], function (tx, data) {
|
|
11469
11476
|
if (data.rowsAffected === 1) {
|
|
11470
11477
|
// We don't invalidate the cache (as we don't access it anymore
|
|
11471
11478
|
// and it will set the index off)
|
|
@@ -11560,7 +11567,7 @@
|
|
|
11560
11567
|
var _ref2 = _slicedToArray$1(_ref, 2),
|
|
11561
11568
|
p = _ref2[0],
|
|
11562
11569
|
val = _ref2[1];
|
|
11563
|
-
setConfig(
|
|
11570
|
+
setConfig(/** @type {import('./CFG.js').KeyofConfigValues} */
|
|
11564
11571
|
p, val);
|
|
11565
11572
|
});
|
|
11566
11573
|
return;
|
|
@@ -11674,13 +11681,14 @@
|
|
|
11674
11681
|
}
|
|
11675
11682
|
} else {
|
|
11676
11683
|
var o = _defineAccessor("get", {}, name, function () {
|
|
11677
|
-
return /** @type {AnyFunction} */(
|
|
11684
|
+
return /** @type {AnyFunction} */(/** @type {PropertyDescriptor} */propDesc.get).call(this);
|
|
11678
11685
|
});
|
|
11679
11686
|
desc = /** @type {PropertyDescriptor} */
|
|
11680
11687
|
Object.getOwnPropertyDescriptor(o, name);
|
|
11681
11688
|
}
|
|
11682
11689
|
Object.defineProperty(IDB, name, desc);
|
|
11683
|
-
|
|
11690
|
+
// eslint-disable-next-line no-unused-vars -- Problem with commonJS rollup
|
|
11691
|
+
} catch (err) {
|
|
11684
11692
|
// With `indexedDB`, PhantomJS fails here and below but
|
|
11685
11693
|
// not above, while Chrome is reverse (and Firefox doesn't
|
|
11686
11694
|
// get here since no WebSQL to use for shimming)
|
|
@@ -11849,7 +11857,9 @@
|
|
|
11849
11857
|
// Exclude genuine Safari: http://stackoverflow.com/a/7768006/271577
|
|
11850
11858
|
// Detect iOS: http://stackoverflow.com/questions/9038625/detect-if-device-is-ios/9039885#9039885
|
|
11851
11859
|
// and detect version 9: http://stackoverflow.com/a/26363560/271577
|
|
11852
|
-
/(iPad|iPhone|iPod)(?:[\0-\t\x0B\f\x0E-\u2027\u202A-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])* o[s\u017F] 9_/i.test(navigator.userAgent) &&
|
|
11860
|
+
/(iPad|iPhone|iPod)(?:[\0-\t\x0B\f\x0E-\u2027\u202A-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])* o[s\u017F] 9_/i.test(navigator.userAgent) && typeof window !== 'undefined' &&
|
|
11861
|
+
// eslint-disable-next-line no-undef -- Extra check
|
|
11862
|
+
!('MSStream' in window) // But avoid IE11
|
|
11853
11863
|
)) {
|
|
11854
11864
|
poorIndexedDbSupport = true;
|
|
11855
11865
|
}
|