indexeddbshim 17.0.0 → 17.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +62 -0
- package/badges/licenses-badge-dev.svg +1 -1
- package/badges/licenses-badge.svg +1 -1
- package/dist/CFG.d.ts +1 -0
- package/dist/CFG.d.ts.map +1 -1
- package/dist/DOMException.d.ts.map +1 -1
- package/dist/IDBCursor.d.ts +25 -18
- package/dist/IDBCursor.d.ts.map +1 -1
- package/dist/IDBFactory.d.ts +19 -19
- package/dist/IDBFactory.d.ts.map +1 -1
- package/dist/IDBIndex.d.ts.map +1 -1
- package/dist/IDBKeyRange.d.ts +5 -5
- package/dist/IDBKeyRange.d.ts.map +1 -1
- package/dist/IDBTransaction.d.ts +24 -3
- package/dist/IDBTransaction.d.ts.map +1 -1
- package/dist/Key.d.ts +41 -41
- package/dist/Key.d.ts.map +1 -1
- package/dist/indexeddbshim-Key.js +88 -69
- package/dist/indexeddbshim-Key.js.map +1 -1
- package/dist/indexeddbshim-Key.min.js +2 -2
- package/dist/indexeddbshim-Key.min.js.map +1 -1
- package/dist/indexeddbshim-UnicodeIdentifiers-node.cjs +1682 -1056
- package/dist/indexeddbshim-UnicodeIdentifiers-node.cjs.map +1 -1
- package/dist/indexeddbshim-UnicodeIdentifiers.js +886 -663
- package/dist/indexeddbshim-UnicodeIdentifiers.js.map +1 -1
- package/dist/indexeddbshim-UnicodeIdentifiers.min.js +4 -4
- package/dist/indexeddbshim-UnicodeIdentifiers.min.js.map +1 -1
- package/dist/indexeddbshim-node.cjs +1682 -1056
- package/dist/indexeddbshim-node.cjs.map +1 -1
- package/dist/indexeddbshim-noninvasive.js +886 -663
- package/dist/indexeddbshim-noninvasive.js.map +1 -1
- package/dist/indexeddbshim-noninvasive.min.js +4 -4
- package/dist/indexeddbshim-noninvasive.min.js.map +1 -1
- package/dist/indexeddbshim.js +890 -660
- package/dist/indexeddbshim.js.map +1 -1
- package/dist/indexeddbshim.min.js +4 -4
- package/dist/indexeddbshim.min.js.map +1 -1
- package/dist/node-UnicodeIdentifiers.d.ts.map +1 -1
- package/dist/node.d.ts.map +1 -1
- package/dist/nodeSQLiteDatabase.d.ts +65 -0
- package/dist/nodeSQLiteDatabase.d.ts.map +1 -0
- package/dist/nodeWebSQL.d.ts.map +1 -1
- package/dist/util.d.ts +5 -0
- package/dist/util.d.ts.map +1 -1
- package/package.json +22 -18
- package/src/CFG.js +3 -0
- package/src/DOMException.js +10 -10
- package/src/IDBCursor.js +152 -102
- package/src/IDBFactory.js +30 -26
- package/src/IDBIndex.js +1 -2
- package/src/IDBKeyRange.js +5 -5
- package/src/IDBTransaction.js +35 -5
- package/src/Key.js +63 -55
- package/src/node-UnicodeIdentifiers.js +5 -1
- package/src/node.js +5 -1
- package/src/nodeSQLiteDatabase.js +174 -0
- package/src/nodeWebSQL.js +1 -3
- package/src/util.js +62 -3
package/dist/indexeddbshim.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! indexeddbshim - v17.
|
|
1
|
+
/*! indexeddbshim - v17.2.0 - 8/18/2026 */
|
|
2
2
|
|
|
3
3
|
(function (factory) {
|
|
4
4
|
typeof define === 'function' && define.amd ? define(factory) :
|
|
@@ -58,7 +58,7 @@
|
|
|
58
58
|
}
|
|
59
59
|
}
|
|
60
60
|
function _createClass(e, r, t) {
|
|
61
|
-
return r && _defineProperties(e.prototype, r), Object.defineProperty(e, "prototype", {
|
|
61
|
+
return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", {
|
|
62
62
|
writable: false
|
|
63
63
|
}), e;
|
|
64
64
|
}
|
|
@@ -301,6 +301,13 @@
|
|
|
301
301
|
function _slicedToArray(r, e) {
|
|
302
302
|
return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest();
|
|
303
303
|
}
|
|
304
|
+
function _taggedTemplateLiteral(e, t) {
|
|
305
|
+
return t || (t = e.slice(0)), Object.freeze(Object.defineProperties(e, {
|
|
306
|
+
raw: {
|
|
307
|
+
value: Object.freeze(t)
|
|
308
|
+
}
|
|
309
|
+
}));
|
|
310
|
+
}
|
|
304
311
|
function _toConsumableArray(r) {
|
|
305
312
|
return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread();
|
|
306
313
|
}
|
|
@@ -1307,6 +1314,7 @@
|
|
|
1307
1314
|
* sqlBusyTimeout: number,
|
|
1308
1315
|
* sqlTrace: () => void,
|
|
1309
1316
|
* sqlProfile: () => void,
|
|
1317
|
+
* escapeNULForSQLiteStatements: boolean,
|
|
1310
1318
|
* createIndexes: boolean
|
|
1311
1319
|
* }} ConfigValues
|
|
1312
1320
|
*/
|
|
@@ -1461,8 +1469,8 @@
|
|
|
1461
1469
|
// Callback not used by default
|
|
1462
1470
|
'sqlProfile',
|
|
1463
1471
|
// Callback not used by default
|
|
1464
|
-
|
|
1465
|
-
'createIndexes'].forEach(function (prop) {
|
|
1472
|
+
// Defaults to true except in Node builds where we can preserve literal NUL with better-sqlite3
|
|
1473
|
+
'escapeNULForSQLiteStatements', 'createIndexes'].forEach(function (prop) {
|
|
1466
1474
|
/** @type {(val: any) => void} */
|
|
1467
1475
|
var validator;
|
|
1468
1476
|
if (Array.isArray(prop)) {
|
|
@@ -1543,7 +1551,8 @@
|
|
|
1543
1551
|
* @returns {string}
|
|
1544
1552
|
*/
|
|
1545
1553
|
function escapeSQLiteStatement(arg) {
|
|
1546
|
-
|
|
1554
|
+
var escaped = arg.replaceAll('^', '^^');
|
|
1555
|
+
return escapeUnmatchedSurrogates(CFG.escapeNULForSQLiteStatements === false ? escaped : escaped.replaceAll('\0', '^0'));
|
|
1547
1556
|
}
|
|
1548
1557
|
|
|
1549
1558
|
/**
|
|
@@ -1551,7 +1560,11 @@
|
|
|
1551
1560
|
* @returns {string}
|
|
1552
1561
|
*/
|
|
1553
1562
|
function unescapeSQLiteResponse(arg) {
|
|
1554
|
-
|
|
1563
|
+
var unescaped = unescapeUnmatchedSurrogates(arg);
|
|
1564
|
+
if (CFG.escapeNULForSQLiteStatements === false) {
|
|
1565
|
+
return unescaped.replaceAll('^^', '^');
|
|
1566
|
+
}
|
|
1567
|
+
return unescaped.replaceAll(/(\^+)0/g, function (_, esc) {
|
|
1555
1568
|
return esc.length % 2 ? esc.slice(1) + '\0' : _;
|
|
1556
1569
|
}).replaceAll('^^', '^');
|
|
1557
1570
|
}
|
|
@@ -1952,6 +1965,56 @@
|
|
|
1952
1965
|
return v === null || v === undefined;
|
|
1953
1966
|
}
|
|
1954
1967
|
|
|
1968
|
+
/**
|
|
1969
|
+
* Cursor/request continuation chains can call each other synchronously
|
|
1970
|
+
* (e.g. walking a large prefetched buffer, or advancing many interleaved
|
|
1971
|
+
* cursors in one transaction) which, for large enough record counts, can
|
|
1972
|
+
* exceed the JS engine's call stack ("Maximum call stack size exceeded").
|
|
1973
|
+
*
|
|
1974
|
+
* This can't be fixed by deferring continuations to a microtask/macrotask:
|
|
1975
|
+
* the transaction machinery synchronously checks (once the current call
|
|
1976
|
+
* stack unwinds) whether there are any pending requests left in order to
|
|
1977
|
+
* decide it's safe to commit; deferring a continuation opens a real gap in
|
|
1978
|
+
* which that check runs first and the transaction completes prematurely,
|
|
1979
|
+
* with the deferred continuation then acting on an already-finished
|
|
1980
|
+
* transaction (a hang, since it can never resolve).
|
|
1981
|
+
*
|
|
1982
|
+
* Instead, this implements a true trampoline: the first call starts a
|
|
1983
|
+
* synchronous work queue and drains it in a flat loop; any call made while
|
|
1984
|
+
* already draining (i.e. a continuation triggering another continuation)
|
|
1985
|
+
* is simply appended to that same queue and returns immediately instead of
|
|
1986
|
+
* recursing. This keeps everything synchronous (so no completion-check
|
|
1987
|
+
* race is introduced) while preventing the call stack from growing with
|
|
1988
|
+
* each successive continuation.
|
|
1989
|
+
*/
|
|
1990
|
+
var continuationState = {
|
|
1991
|
+
/** @type {Array<() => void>|null} */
|
|
1992
|
+
queue: null
|
|
1993
|
+
};
|
|
1994
|
+
|
|
1995
|
+
/**
|
|
1996
|
+
* @param {() => void} fn
|
|
1997
|
+
* @returns {void}
|
|
1998
|
+
*/
|
|
1999
|
+
function runContinuationSafely(fn) {
|
|
2000
|
+
if (continuationState.queue) {
|
|
2001
|
+
continuationState.queue.push(fn);
|
|
2002
|
+
return;
|
|
2003
|
+
}
|
|
2004
|
+
var queue = [fn];
|
|
2005
|
+
continuationState.queue = queue;
|
|
2006
|
+
try {
|
|
2007
|
+
while (queue.length) {
|
|
2008
|
+
var next = /** @type {() => void} */queue.shift();
|
|
2009
|
+
next();
|
|
2010
|
+
}
|
|
2011
|
+
} finally {
|
|
2012
|
+
// Ensure a thrown exception can't leave the queue permanently
|
|
2013
|
+
// stuck (which would silently swallow all future continuations).
|
|
2014
|
+
continuationState.queue = null;
|
|
2015
|
+
}
|
|
2016
|
+
}
|
|
2017
|
+
|
|
1955
2018
|
/**
|
|
1956
2019
|
* @typedef {Error} DebuggingError
|
|
1957
2020
|
*/
|
|
@@ -2422,11 +2485,11 @@
|
|
|
2422
2485
|
// eslint-disable-next-line @stylistic/operator-linebreak -- Need JSDoc
|
|
2423
2486
|
?
|
|
2424
2487
|
/**
|
|
2425
|
-
|
|
2426
|
-
|
|
2427
|
-
|
|
2428
|
-
|
|
2429
|
-
|
|
2488
|
+
* @param {string} name
|
|
2489
|
+
* @param {string} message
|
|
2490
|
+
* @param {ErrorLike} [error]
|
|
2491
|
+
* @returns {DOMException}
|
|
2492
|
+
*/
|
|
2430
2493
|
function (name, message, error) {
|
|
2431
2494
|
logError(name, message, error);
|
|
2432
2495
|
return createNativeDOMException(name, message);
|
|
@@ -2434,11 +2497,11 @@
|
|
|
2434
2497
|
// eslint-disable-next-line @stylistic/operator-linebreak -- Need JSDoc
|
|
2435
2498
|
:
|
|
2436
2499
|
/**
|
|
2437
|
-
|
|
2438
|
-
|
|
2439
|
-
|
|
2440
|
-
|
|
2441
|
-
|
|
2500
|
+
* @param {string} name
|
|
2501
|
+
* @param {string} message
|
|
2502
|
+
* @param {ErrorLike} [error]
|
|
2503
|
+
* @returns {Error}
|
|
2504
|
+
*/
|
|
2442
2505
|
function (name, message, error) {
|
|
2443
2506
|
logError(name, message, error);
|
|
2444
2507
|
return createNonNativeDOMException(name, message);
|
|
@@ -2633,16 +2696,15 @@
|
|
|
2633
2696
|
/* eslint-disable promise/prefer-await-to-callbacks -- Needed for API */
|
|
2634
2697
|
/* eslint-disable promise/catch-or-return, n/callback-return,
|
|
2635
2698
|
promise/always-return -- Not needed */
|
|
2636
|
-
/* eslint-disable unicorn/no-this-assignment -- Clarity */
|
|
2637
2699
|
// Since [immediate](https://github.com/calvinmetcalf/immediate) is
|
|
2638
2700
|
// not doing the trick for our WebSQL transactions (at least in Node),
|
|
2639
2701
|
// we are forced to make the promises run fully synchronously.
|
|
2640
2702
|
|
|
2641
|
-
|
|
2642
|
-
|
|
2703
|
+
/* eslint-disable jsdoc/reject-any-type -- Truly arbitrary */
|
|
2643
2704
|
/**
|
|
2644
2705
|
* @typedef {any} ArbitraryValue
|
|
2645
2706
|
*/
|
|
2707
|
+
/* eslint-enable jsdoc/reject-any-type -- Truly arbitrary */
|
|
2646
2708
|
|
|
2647
2709
|
/**
|
|
2648
2710
|
* @callback Resolve
|
|
@@ -2702,209 +2764,235 @@
|
|
|
2702
2764
|
REJECTED = 1;
|
|
2703
2765
|
|
|
2704
2766
|
/**
|
|
2705
|
-
*
|
|
2706
|
-
|
|
2707
|
-
|
|
2708
|
-
* reject: (reason?: any) => void
|
|
2709
|
-
* ) => void} fn
|
|
2710
|
-
*/
|
|
2711
|
-
function SyncPromise(fn) {
|
|
2712
|
-
var that = this;
|
|
2713
|
-
// Value, this will be set to either a resolved value or rejected reason
|
|
2714
|
-
that.v = 0;
|
|
2715
|
-
// State of the promise
|
|
2716
|
-
that.s = PENDING;
|
|
2717
|
-
// Callbacks c[0] is fulfillment and c[1] contains rejection callbacks
|
|
2718
|
-
/** @type {Callbacks|null} */
|
|
2719
|
-
that.c = [[], []];
|
|
2767
|
+
*
|
|
2768
|
+
*/
|
|
2769
|
+
var SyncPromise = /*#__PURE__*/function () {
|
|
2720
2770
|
/**
|
|
2721
|
-
*
|
|
2722
|
-
*
|
|
2723
|
-
*
|
|
2724
|
-
*
|
|
2771
|
+
* @param {(
|
|
2772
|
+
* resolve: (value: ArbitraryValue | PromiseLike<ArbitraryValue>) => void,
|
|
2773
|
+
* reject: (reason?: ArbitraryValue) => void
|
|
2774
|
+
* ) => void} fn
|
|
2725
2775
|
*/
|
|
2726
|
-
function
|
|
2727
|
-
|
|
2728
|
-
|
|
2729
|
-
|
|
2730
|
-
|
|
2731
|
-
|
|
2732
|
-
|
|
2733
|
-
|
|
2734
|
-
}
|
|
2735
|
-
|
|
2736
|
-
|
|
2737
|
-
|
|
2738
|
-
|
|
2739
|
-
|
|
2740
|
-
|
|
2741
|
-
|
|
2742
|
-
|
|
2776
|
+
function SyncPromise(fn) {
|
|
2777
|
+
var _this = this;
|
|
2778
|
+
_classCallCheck(this, SyncPromise);
|
|
2779
|
+
// Value, this will be set to either a resolved value or rejected reason
|
|
2780
|
+
_defineProperty(this, "v", 0);
|
|
2781
|
+
// State of the promise
|
|
2782
|
+
this.s = PENDING;
|
|
2783
|
+
// Callbacks c[0] is fulfillment and c[1] contains rejection callbacks
|
|
2784
|
+
/** @type {Callbacks|null} */
|
|
2785
|
+
this.c = [[], []];
|
|
2786
|
+
/**
|
|
2787
|
+
*
|
|
2788
|
+
* @param {ArbitraryValue} val
|
|
2789
|
+
* @param {0|1} state
|
|
2790
|
+
* @returns {void}
|
|
2791
|
+
*/
|
|
2792
|
+
var transist = function transist(val, state) {
|
|
2793
|
+
_this.v = val;
|
|
2794
|
+
_this.s = state;
|
|
2743
2795
|
|
|
2744
|
-
|
|
2745
|
-
|
|
2746
|
-
|
|
2747
|
-
|
|
2748
|
-
|
|
2749
|
-
|
|
2750
|
-
|
|
2751
|
-
|
|
2796
|
+
// console.log('state', state);
|
|
2797
|
+
/** @type {Callbacks} */
|
|
2798
|
+
_this.c[state].forEach(function (func) {
|
|
2799
|
+
func(val);
|
|
2800
|
+
});
|
|
2801
|
+
// Release memory, but if no handlers have been added, as we
|
|
2802
|
+
// assume that we will resolve/reject (truly) synchronously
|
|
2803
|
+
// and thus we avoid flagging checks about whether we've
|
|
2804
|
+
// already resolved/rejected.
|
|
2805
|
+
if (/** @type {Callbacks} */_this.c[state].length) {
|
|
2806
|
+
_this.c = null;
|
|
2807
|
+
}
|
|
2808
|
+
};
|
|
2752
2809
|
|
|
2753
|
-
|
|
2754
|
-
|
|
2755
|
-
|
|
2756
|
-
|
|
2757
|
-
|
|
2758
|
-
|
|
2810
|
+
/** @type {Resolve} */
|
|
2811
|
+
var _resolve = function resolve(val) {
|
|
2812
|
+
if (!_this.c) ; else if (isPromise(val)) {
|
|
2813
|
+
addReject(val.then(_resolve), _reject);
|
|
2814
|
+
} else {
|
|
2815
|
+
transist(val, FULFILLED);
|
|
2816
|
+
}
|
|
2817
|
+
};
|
|
2818
|
+
|
|
2819
|
+
/** @type {Reject} */
|
|
2820
|
+
var _reject = function reject(reason) {
|
|
2821
|
+
if (!_this.c) ; else if (isPromise(reason)) {
|
|
2822
|
+
addReject(reason.then(_reject), _reject);
|
|
2823
|
+
} else {
|
|
2824
|
+
transist(reason, REJECTED);
|
|
2825
|
+
}
|
|
2826
|
+
};
|
|
2827
|
+
try {
|
|
2828
|
+
fn(_resolve, _reject);
|
|
2829
|
+
} catch (err) {
|
|
2830
|
+
_reject(err);
|
|
2759
2831
|
}
|
|
2760
2832
|
}
|
|
2761
|
-
try {
|
|
2762
|
-
fn(resolve, reject);
|
|
2763
|
-
} catch (err) {
|
|
2764
|
-
reject(err);
|
|
2765
|
-
}
|
|
2766
|
-
}
|
|
2767
2833
|
|
|
2768
|
-
|
|
2769
|
-
|
|
2770
|
-
|
|
2771
|
-
|
|
2772
|
-
|
|
2773
|
-
|
|
2774
|
-
|
|
2775
|
-
|
|
2776
|
-
|
|
2777
|
-
|
|
2778
|
-
|
|
2779
|
-
|
|
2834
|
+
/* eslint-disable unicorn/no-thenable -- Promise API */
|
|
2835
|
+
/**
|
|
2836
|
+
* @param {((value: ArbitraryValue) => ArbitraryValue)|null|undefined} [cb]
|
|
2837
|
+
* @param {(reason: ArbitraryValue) => PromiseLike<never>} [errBack]
|
|
2838
|
+
* @returns {SyncPromise}
|
|
2839
|
+
*/
|
|
2840
|
+
return _createClass(SyncPromise, [{
|
|
2841
|
+
key: "then",
|
|
2842
|
+
value: function then(cb, errBack) {
|
|
2843
|
+
var _this2 = this;
|
|
2844
|
+
/* eslint-enable unicorn/no-thenable -- Promise API */
|
|
2845
|
+
return new SyncPromise(/** @type {ResolveReject} */
|
|
2846
|
+
function (resolve, reject) {
|
|
2847
|
+
var rej = typeof errBack === 'function' ? errBack : reject;
|
|
2780
2848
|
|
|
2781
|
-
|
|
2782
|
-
|
|
2783
|
-
|
|
2784
|
-
|
|
2785
|
-
|
|
2786
|
-
|
|
2787
|
-
|
|
2788
|
-
|
|
2789
|
-
|
|
2790
|
-
|
|
2791
|
-
|
|
2792
|
-
|
|
2793
|
-
|
|
2794
|
-
|
|
2795
|
-
|
|
2796
|
-
|
|
2849
|
+
/** @type {Settle} */
|
|
2850
|
+
var settle = function settle() {
|
|
2851
|
+
try {
|
|
2852
|
+
resolve(cb ? cb(_this2.v) : _this2.v);
|
|
2853
|
+
} catch (e) {
|
|
2854
|
+
rej(e);
|
|
2855
|
+
}
|
|
2856
|
+
};
|
|
2857
|
+
if (_this2.s === FULFILLED) {
|
|
2858
|
+
settle();
|
|
2859
|
+
} else if (_this2.s === REJECTED) {
|
|
2860
|
+
rej(_this2.v);
|
|
2861
|
+
} else {
|
|
2862
|
+
/** @type {Callbacks} */_this2.c[FULFILLED].push(settle);
|
|
2863
|
+
/** @type {Callbacks} */
|
|
2864
|
+
_this2.c[REJECTED].push(rej);
|
|
2865
|
+
}
|
|
2866
|
+
});
|
|
2797
2867
|
}
|
|
2798
|
-
});
|
|
2799
|
-
};
|
|
2800
2868
|
|
|
2801
|
-
/**
|
|
2802
|
-
* @param {(reason: any) => PromiseLike<never>|null|undefined} cb
|
|
2803
|
-
* @returns {SyncPromise}
|
|
2804
|
-
*/
|
|
2805
|
-
SyncPromise.prototype.catch = function (cb) {
|
|
2806
|
-
var that = this;
|
|
2807
|
-
return new SyncPromise(/** @type {ResolveReject} */
|
|
2808
|
-
function (resolve, reject) {
|
|
2809
2869
|
/**
|
|
2810
|
-
* @
|
|
2870
|
+
* @param {(reason: ArbitraryValue) => PromiseLike<never>|null|undefined} cb
|
|
2871
|
+
* @returns {SyncPromise}
|
|
2811
2872
|
*/
|
|
2812
|
-
|
|
2813
|
-
|
|
2814
|
-
|
|
2815
|
-
|
|
2816
|
-
|
|
2817
|
-
|
|
2818
|
-
|
|
2819
|
-
|
|
2820
|
-
|
|
2821
|
-
|
|
2822
|
-
|
|
2823
|
-
|
|
2824
|
-
|
|
2825
|
-
|
|
2826
|
-
|
|
2873
|
+
}, {
|
|
2874
|
+
key: "catch",
|
|
2875
|
+
value: function _catch(cb) {
|
|
2876
|
+
var _this3 = this;
|
|
2877
|
+
return new SyncPromise(/** @type {ResolveReject} */
|
|
2878
|
+
function (resolve, reject) {
|
|
2879
|
+
/**
|
|
2880
|
+
* @returns {void}
|
|
2881
|
+
*/
|
|
2882
|
+
var settle = function settle() {
|
|
2883
|
+
try {
|
|
2884
|
+
resolve(cb(_this3.v));
|
|
2885
|
+
} catch (e) {
|
|
2886
|
+
reject(e);
|
|
2887
|
+
}
|
|
2888
|
+
};
|
|
2889
|
+
if (_this3.s === REJECTED) {
|
|
2890
|
+
settle();
|
|
2891
|
+
} else if (_this3.s === FULFILLED) {
|
|
2892
|
+
resolve(_this3.v);
|
|
2893
|
+
} else {
|
|
2894
|
+
/** @type {Callbacks} */_this3.c[REJECTED].push(settle);
|
|
2895
|
+
/** @type {Callbacks} */
|
|
2896
|
+
_this3.c[FULFILLED].push(resolve);
|
|
2897
|
+
}
|
|
2898
|
+
});
|
|
2827
2899
|
}
|
|
2828
|
-
}
|
|
2829
|
-
|
|
2830
|
-
|
|
2831
|
-
|
|
2832
|
-
|
|
2833
|
-
|
|
2834
|
-
|
|
2835
|
-
|
|
2836
|
-
|
|
2837
|
-
|
|
2838
|
-
|
|
2839
|
-
|
|
2840
|
-
|
|
2841
|
-
|
|
2842
|
-
|
|
2843
|
-
|
|
2900
|
+
}], [{
|
|
2901
|
+
key: "all",
|
|
2902
|
+
value:
|
|
2903
|
+
/**
|
|
2904
|
+
* @param {unknown[]|[]} promises
|
|
2905
|
+
* @returns {SyncPromise}
|
|
2906
|
+
*/
|
|
2907
|
+
function all(promises) {
|
|
2908
|
+
return new SyncPromise(/** @type {ResolveReject} */
|
|
2909
|
+
function (resolve, reject) {
|
|
2910
|
+
var l = promises.length;
|
|
2911
|
+
/** @type {ArbitraryValue[]} */
|
|
2912
|
+
var newPromises = [];
|
|
2913
|
+
if (!l) {
|
|
2914
|
+
resolve(newPromises);
|
|
2915
|
+
return;
|
|
2916
|
+
}
|
|
2917
|
+
promises.forEach(function (p, i) {
|
|
2918
|
+
if (isPromise(/** @type {PromiseLike<ArbitraryValue>} */p)) {
|
|
2919
|
+
addReject(/** @type {PromiseLike<ArbitraryValue>} */p.then(/** @type {OnFulfilled} */
|
|
2920
|
+
function (res) {
|
|
2921
|
+
newPromises[i] = res;
|
|
2922
|
+
--l;
|
|
2923
|
+
if (!l) {
|
|
2924
|
+
resolve(newPromises);
|
|
2925
|
+
}
|
|
2926
|
+
}), reject);
|
|
2927
|
+
} else {
|
|
2928
|
+
newPromises[i] = p;
|
|
2929
|
+
--l;
|
|
2930
|
+
if (!l) {
|
|
2931
|
+
resolve(promises);
|
|
2932
|
+
}
|
|
2933
|
+
}
|
|
2934
|
+
});
|
|
2935
|
+
});
|
|
2844
2936
|
}
|
|
2845
|
-
promises.forEach(function (p, i) {
|
|
2846
|
-
if (isPromise(/** @type {PromiseLike<any>} */p)) {
|
|
2847
|
-
addReject(/** @type {PromiseLike<any>} */p.then(/** @type {OnFulfilled} */
|
|
2848
|
-
function (res) {
|
|
2849
|
-
newPromises[i] = res;
|
|
2850
|
-
--l || resolve(newPromises);
|
|
2851
|
-
}), reject);
|
|
2852
|
-
} else {
|
|
2853
|
-
newPromises[i] = p;
|
|
2854
|
-
--l || resolve(promises);
|
|
2855
|
-
}
|
|
2856
|
-
});
|
|
2857
|
-
});
|
|
2858
|
-
};
|
|
2859
2937
|
|
|
2860
|
-
|
|
2861
|
-
|
|
2862
|
-
|
|
2863
|
-
|
|
2864
|
-
|
|
2865
|
-
|
|
2866
|
-
|
|
2867
|
-
|
|
2868
|
-
|
|
2869
|
-
|
|
2870
|
-
|
|
2871
|
-
|
|
2872
|
-
|
|
2873
|
-
|
|
2938
|
+
/**
|
|
2939
|
+
* @param {unknown[]|[]} promises
|
|
2940
|
+
* @returns {SyncPromise}
|
|
2941
|
+
*/
|
|
2942
|
+
}, {
|
|
2943
|
+
key: "race",
|
|
2944
|
+
value: function race(promises) {
|
|
2945
|
+
var resolved = false;
|
|
2946
|
+
return new SyncPromise(/** @type {ResolveReject} */
|
|
2947
|
+
function (resolve, reject) {
|
|
2948
|
+
// eslint-disable-next-line @stylistic/max-len -- Long
|
|
2949
|
+
// eslint-disable-next-line unicorn/no-unused-array-method-return -- Shortcuts
|
|
2950
|
+
promises.some(function (p) {
|
|
2951
|
+
if (isPromise(/** @type {PromiseLike<ArbitraryValue>} */p)) {
|
|
2952
|
+
addReject(/** @type {PromiseLike<ArbitraryValue>} */p.then(/** @type {OnFulfilled} */
|
|
2953
|
+
function (res) {
|
|
2954
|
+
if (resolved) {
|
|
2955
|
+
return;
|
|
2956
|
+
}
|
|
2957
|
+
resolve(res);
|
|
2958
|
+
resolved = true;
|
|
2959
|
+
}), reject);
|
|
2960
|
+
return false;
|
|
2874
2961
|
}
|
|
2875
|
-
resolve(
|
|
2962
|
+
resolve(p);
|
|
2876
2963
|
resolved = true;
|
|
2877
|
-
|
|
2878
|
-
|
|
2879
|
-
}
|
|
2880
|
-
|
|
2881
|
-
resolved = true;
|
|
2882
|
-
return true;
|
|
2883
|
-
});
|
|
2884
|
-
});
|
|
2885
|
-
};
|
|
2964
|
+
return true;
|
|
2965
|
+
});
|
|
2966
|
+
});
|
|
2967
|
+
}
|
|
2886
2968
|
|
|
2887
|
-
|
|
2888
|
-
|
|
2889
|
-
|
|
2890
|
-
|
|
2891
|
-
|
|
2892
|
-
|
|
2893
|
-
|
|
2894
|
-
|
|
2895
|
-
|
|
2896
|
-
|
|
2969
|
+
/**
|
|
2970
|
+
* @param {ArbitraryValue} val
|
|
2971
|
+
* @returns {SyncPromise}
|
|
2972
|
+
*/
|
|
2973
|
+
}, {
|
|
2974
|
+
key: "resolve",
|
|
2975
|
+
value: function resolve(val) {
|
|
2976
|
+
return new SyncPromise(/** @type {ResolveReject} */
|
|
2977
|
+
function (resolve) {
|
|
2978
|
+
resolve(val);
|
|
2979
|
+
});
|
|
2980
|
+
}
|
|
2897
2981
|
|
|
2898
|
-
|
|
2899
|
-
|
|
2900
|
-
|
|
2901
|
-
|
|
2902
|
-
|
|
2903
|
-
|
|
2904
|
-
|
|
2905
|
-
|
|
2906
|
-
|
|
2907
|
-
|
|
2982
|
+
/**
|
|
2983
|
+
* @param {ArbitraryValue} val
|
|
2984
|
+
* @returns {SyncPromise}
|
|
2985
|
+
*/
|
|
2986
|
+
}, {
|
|
2987
|
+
key: "reject",
|
|
2988
|
+
value: function reject(val) {
|
|
2989
|
+
return new SyncPromise(/** @type {ResolveReject} */
|
|
2990
|
+
function (resolve, reject) {
|
|
2991
|
+
reject(val);
|
|
2992
|
+
});
|
|
2993
|
+
}
|
|
2994
|
+
}]);
|
|
2995
|
+
}();
|
|
2908
2996
|
|
|
2909
2997
|
/**
|
|
2910
2998
|
* Compares two keys.
|
|
@@ -2941,6 +3029,8 @@
|
|
|
2941
3029
|
return result;
|
|
2942
3030
|
}
|
|
2943
3031
|
|
|
3032
|
+
var _templateObject, _templateObject2;
|
|
3033
|
+
|
|
2944
3034
|
/**
|
|
2945
3035
|
* @typedef {NodeJS.TypedArray|DataView} ArrayBufferView
|
|
2946
3036
|
*/
|
|
@@ -2970,14 +3060,14 @@
|
|
|
2970
3060
|
*/
|
|
2971
3061
|
|
|
2972
3062
|
/**
|
|
2973
|
-
|
|
2974
|
-
|
|
2975
|
-
|
|
2976
|
-
|
|
2977
|
-
|
|
2978
|
-
|
|
2979
|
-
|
|
2980
|
-
|
|
3063
|
+
* @typedef {object} KeyValueObject
|
|
3064
|
+
* @property {KeyType|"NaN"|"null"|"undefined"|"boolean"|"object"|"symbol"|
|
|
3065
|
+
* "function"|"bigint"} type If not `KeyType`, indicates invalid value
|
|
3066
|
+
* @property {Value} [value]
|
|
3067
|
+
* @property {boolean} [invalid]
|
|
3068
|
+
* @property {string} [message]
|
|
3069
|
+
* @todo Specify acceptable `value` more precisely
|
|
3070
|
+
*/
|
|
2981
3071
|
|
|
2982
3072
|
/**
|
|
2983
3073
|
* @typedef {number|string|Date|ArrayBuffer} ValueTypePrimitive
|
|
@@ -3216,14 +3306,22 @@
|
|
|
3216
3306
|
_iterator.f();
|
|
3217
3307
|
}
|
|
3218
3308
|
encoded.push(keyTypeToEncodedChar.invalid + '-'); // append an extra item, so empty arrays sort correctly
|
|
3219
|
-
|
|
3309
|
+
var encodedKey = JSON.stringify(encoded);
|
|
3310
|
+
if (CFG.escapeNULForSQLiteStatements === false) {
|
|
3311
|
+
encodedKey = encodedKey.replaceAll(String.raw(_templateObject || (_templateObject = _taggedTemplateLiteral(["\0"], ["\\u0000"]))), '\0');
|
|
3312
|
+
}
|
|
3313
|
+
return keyTypeToEncodedChar.array + '-' + encodedKey;
|
|
3220
3314
|
},
|
|
3221
3315
|
/**
|
|
3222
3316
|
* @param {string} key
|
|
3223
3317
|
* @returns {ValueTypeArray}
|
|
3224
3318
|
*/
|
|
3225
3319
|
decode: function decode(key) {
|
|
3226
|
-
var
|
|
3320
|
+
var decodedKey = key.slice(2);
|
|
3321
|
+
if (CFG.escapeNULForSQLiteStatements === false) {
|
|
3322
|
+
decodedKey = decodedKey.replaceAll('\0', String.raw(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\0"], ["\\u0000"]))));
|
|
3323
|
+
}
|
|
3324
|
+
var decoded = JSON.parse(decodedKey);
|
|
3227
3325
|
decoded.pop(); // remove the extra item
|
|
3228
3326
|
for (var i = 0; i < decoded.length; i++) {
|
|
3229
3327
|
var item = decoded[i];
|
|
@@ -3409,10 +3507,10 @@
|
|
|
3409
3507
|
}
|
|
3410
3508
|
|
|
3411
3509
|
/**
|
|
3412
|
-
|
|
3413
|
-
|
|
3414
|
-
|
|
3415
|
-
|
|
3510
|
+
* Currently not in use.
|
|
3511
|
+
* @param {Value} input
|
|
3512
|
+
* @returns {KeyValueObject}
|
|
3513
|
+
*/
|
|
3416
3514
|
function convertValueToMultiEntryKey(input) {
|
|
3417
3515
|
return convertValueToKeyValueDecoded(input, null, true, true);
|
|
3418
3516
|
}
|
|
@@ -3447,17 +3545,17 @@
|
|
|
3447
3545
|
}
|
|
3448
3546
|
|
|
3449
3547
|
/**
|
|
3450
|
-
|
|
3451
|
-
|
|
3452
|
-
|
|
3453
|
-
|
|
3454
|
-
|
|
3455
|
-
|
|
3456
|
-
|
|
3457
|
-
|
|
3458
|
-
|
|
3459
|
-
|
|
3460
|
-
|
|
3548
|
+
* Shortcut utility to avoid returning full keys from `convertValueToKey`
|
|
3549
|
+
* and subsequent need to process in calling code unless `fullKeys` is
|
|
3550
|
+
* set; may throw.
|
|
3551
|
+
* @param {Value} input
|
|
3552
|
+
* @param {Value[]|null} [seen]
|
|
3553
|
+
* @param {boolean} [multiEntry]
|
|
3554
|
+
* @param {boolean} [fullKeys]
|
|
3555
|
+
* @throws {TypeError} See `getCopyBytesHeldByBufferSource`
|
|
3556
|
+
* @todo Document other allowable `input`
|
|
3557
|
+
* @returns {KeyValueObject}
|
|
3558
|
+
*/
|
|
3461
3559
|
function convertValueToKeyValueDecoded(input, seen, multiEntry, fullKeys) {
|
|
3462
3560
|
seen || (seen = []);
|
|
3463
3561
|
if (seen.includes(input)) {
|
|
@@ -3613,12 +3711,12 @@
|
|
|
3613
3711
|
}
|
|
3614
3712
|
|
|
3615
3713
|
/**
|
|
3616
|
-
|
|
3617
|
-
|
|
3618
|
-
|
|
3619
|
-
|
|
3620
|
-
|
|
3621
|
-
|
|
3714
|
+
* An internal utility.
|
|
3715
|
+
* @param {Value} input
|
|
3716
|
+
* @param {Value[]|null|undefined} [seen]
|
|
3717
|
+
* @throws {DOMException} `DataError`
|
|
3718
|
+
* @returns {KeyValueObject}
|
|
3719
|
+
*/
|
|
3622
3720
|
function convertValueToKeyRethrowingAndIfInvalid(input, seen) {
|
|
3623
3721
|
var key = convertValueToKey(input, seen);
|
|
3624
3722
|
if (key.invalid) {
|
|
@@ -3639,26 +3737,26 @@
|
|
|
3639
3737
|
return extractKeyValueDecodedFromValueUsingKeyPath(value, keyPath, multiEntry, true);
|
|
3640
3738
|
}
|
|
3641
3739
|
/**
|
|
3642
|
-
|
|
3643
|
-
|
|
3644
|
-
|
|
3645
|
-
|
|
3646
|
-
|
|
3647
|
-
|
|
3740
|
+
* Not currently in use.
|
|
3741
|
+
* @param {Value} value
|
|
3742
|
+
* @param {KeyPath} keyPath
|
|
3743
|
+
* @param {boolean} multiEntry
|
|
3744
|
+
* @returns {KeyPathEvaluateValue}
|
|
3745
|
+
*/
|
|
3648
3746
|
function evaluateKeyPathOnValue(value, keyPath, multiEntry) {
|
|
3649
3747
|
return evaluateKeyPathOnValueToDecodedValue(value, keyPath);
|
|
3650
3748
|
}
|
|
3651
3749
|
|
|
3652
3750
|
/**
|
|
3653
|
-
|
|
3654
|
-
|
|
3655
|
-
|
|
3656
|
-
|
|
3657
|
-
|
|
3658
|
-
|
|
3659
|
-
|
|
3660
|
-
|
|
3661
|
-
|
|
3751
|
+
* May throw, return `{failure: true}` (e.g., non-object on keyPath resolution)
|
|
3752
|
+
* or `{invalid: true}` (e.g., `NaN`).
|
|
3753
|
+
* @param {Value} value
|
|
3754
|
+
* @param {KeyPath} keyPath
|
|
3755
|
+
* @param {boolean} [multiEntry]
|
|
3756
|
+
* @param {boolean} [fullKeys]
|
|
3757
|
+
* @returns {KeyValueObject|KeyPathEvaluateValue}
|
|
3758
|
+
* @todo Document other possible return?
|
|
3759
|
+
*/
|
|
3662
3760
|
function extractKeyValueDecodedFromValueUsingKeyPath(value, keyPath, multiEntry, fullKeys) {
|
|
3663
3761
|
var r = evaluateKeyPathOnValueToDecodedValue(value, keyPath);
|
|
3664
3762
|
if (r.failure) {
|
|
@@ -3888,11 +3986,11 @@
|
|
|
3888
3986
|
}
|
|
3889
3987
|
|
|
3890
3988
|
/**
|
|
3891
|
-
|
|
3892
|
-
|
|
3893
|
-
|
|
3894
|
-
|
|
3895
|
-
|
|
3989
|
+
* Not currently in use but keeping for spec parity.
|
|
3990
|
+
* @param {Key} key
|
|
3991
|
+
* @throws {Error} Upon a "bad key"
|
|
3992
|
+
* @returns {ValueType}
|
|
3993
|
+
*/
|
|
3896
3994
|
function convertKeyToValue(key) {
|
|
3897
3995
|
var type = key.type,
|
|
3898
3996
|
value = key.value;
|
|
@@ -3984,10 +4082,10 @@
|
|
|
3984
4082
|
*/
|
|
3985
4083
|
|
|
3986
4084
|
/**
|
|
3987
|
-
|
|
3988
|
-
|
|
3989
|
-
|
|
3990
|
-
|
|
4085
|
+
* @callback SQLFailureCallback
|
|
4086
|
+
* @param {DOMException|Error} exception
|
|
4087
|
+
* @returns {void}
|
|
4088
|
+
*/
|
|
3991
4089
|
|
|
3992
4090
|
/**
|
|
3993
4091
|
*
|
|
@@ -4156,11 +4254,11 @@
|
|
|
4156
4254
|
|
|
4157
4255
|
/**
|
|
4158
4256
|
* @typedef {globalThis.IDBKeyRange & {
|
|
4159
|
-
|
|
4160
|
-
|
|
4161
|
-
|
|
4162
|
-
|
|
4163
|
-
|
|
4257
|
+
* __lowerCached: string|null|false,
|
|
4258
|
+
* __upperCached: string|null|false,
|
|
4259
|
+
* __lowerOpen: boolean,
|
|
4260
|
+
* }} IDBKeyRangeFull
|
|
4261
|
+
*/
|
|
4164
4262
|
|
|
4165
4263
|
/**
|
|
4166
4264
|
* The IndexedDB KeyRange object.
|
|
@@ -4687,6 +4785,7 @@
|
|
|
4687
4785
|
* },
|
|
4688
4786
|
* __requestsFinished: boolean,
|
|
4689
4787
|
* __transFinishedCb: (err: boolean, cb: ((bool?: boolean) => void)) => void,
|
|
4788
|
+
* __callTransFinishedCb: (err: boolean, cb: ((bool?: boolean) => void)) => void,
|
|
4690
4789
|
* __transactionEndCallback: () => void,
|
|
4691
4790
|
* __transactionFinished: boolean,
|
|
4692
4791
|
* __completed: boolean,
|
|
@@ -4796,6 +4895,35 @@
|
|
|
4796
4895
|
IDBTransaction.prototype.__transFinishedCb = function (err, cb) {
|
|
4797
4896
|
cb(Boolean(err));
|
|
4798
4897
|
};
|
|
4898
|
+
|
|
4899
|
+
/**
|
|
4900
|
+
* In Node, the real (SQL-commit-capable) `__transFinishedCb` is only
|
|
4901
|
+
* installed once the underlying WebSQL driver's own SQL-queue-idle check
|
|
4902
|
+
* has fired at least once for this transaction (asynchronously, via the
|
|
4903
|
+
* `nonstandardTransCb` passed to `db.transaction`/`.readTransaction`).
|
|
4904
|
+
* Since our own request processing can now finish synchronously (e.g., a
|
|
4905
|
+
* trivial upgrade using a synchronous SQL driver), it is possible to reach
|
|
4906
|
+
* transaction completion here before that has happened, in which case
|
|
4907
|
+
* `__transFinishedCb` is still the non-committing default above. Calling
|
|
4908
|
+
* that default directly would silently skip the actual SQL commit and
|
|
4909
|
+
* leave the underlying WebSQL transaction "running" forever, hanging any
|
|
4910
|
+
* later transaction on that same database connection. So, if the real
|
|
4911
|
+
* callback isn't installed yet, defer and retry until it is.
|
|
4912
|
+
* @this {IDBTransactionFull}
|
|
4913
|
+
* @param {boolean} err
|
|
4914
|
+
* @param {(bool?: boolean) => void} cb
|
|
4915
|
+
* @returns {void}
|
|
4916
|
+
*/
|
|
4917
|
+
IDBTransaction.prototype.__callTransFinishedCb = function (err, cb) {
|
|
4918
|
+
var me = this;
|
|
4919
|
+
if (me.__transFinishedCb === IDBTransaction.prototype.__transFinishedCb) {
|
|
4920
|
+
setTimeout(function () {
|
|
4921
|
+
me.__callTransFinishedCb(err, cb);
|
|
4922
|
+
}, 0);
|
|
4923
|
+
return;
|
|
4924
|
+
}
|
|
4925
|
+
me.__transFinishedCb(err, cb);
|
|
4926
|
+
};
|
|
4799
4927
|
/**
|
|
4800
4928
|
* @this {IDBTransactionFull}
|
|
4801
4929
|
* @returns {void}
|
|
@@ -4855,7 +4983,7 @@
|
|
|
4855
4983
|
me.__abortTransaction(createDOMException('AbortError', 'A request was aborted (in user handler after success).'));
|
|
4856
4984
|
return;
|
|
4857
4985
|
}
|
|
4858
|
-
executeNextRequest
|
|
4986
|
+
runContinuationSafely(executeNextRequest);
|
|
4859
4987
|
}
|
|
4860
4988
|
|
|
4861
4989
|
/**
|
|
@@ -4930,7 +5058,9 @@
|
|
|
4930
5058
|
try {
|
|
4931
5059
|
q = me.__requests[i];
|
|
4932
5060
|
if (!q.req) {
|
|
4933
|
-
q.op(tx, q.args,
|
|
5061
|
+
q.op(tx, q.args, function () {
|
|
5062
|
+
return runContinuationSafely(executeNextRequest);
|
|
5063
|
+
}, error);
|
|
4934
5064
|
return;
|
|
4935
5065
|
}
|
|
4936
5066
|
if (q.req.__done) {
|
|
@@ -5396,10 +5526,10 @@
|
|
|
5396
5526
|
};
|
|
5397
5527
|
|
|
5398
5528
|
/**
|
|
5399
|
-
|
|
5529
|
+
* Used by our `EventTarget.prototype` library to implement bubbling/capturing.
|
|
5400
5530
|
* @this {IDBTransactionFull}
|
|
5401
|
-
|
|
5402
|
-
|
|
5531
|
+
* @returns {import('./IDBDatabase.js').IDBDatabaseFull}
|
|
5532
|
+
*/
|
|
5403
5533
|
IDBTransaction.prototype.__getParent = function () {
|
|
5404
5534
|
return this.db;
|
|
5405
5535
|
};
|
|
@@ -5435,7 +5565,7 @@
|
|
|
5435
5565
|
}).then(r, n);
|
|
5436
5566
|
});
|
|
5437
5567
|
}, TypesonPromise.prototype.catch = function (e) {
|
|
5438
|
-
return this.then(
|
|
5568
|
+
return this.then(void 0, e);
|
|
5439
5569
|
}, TypesonPromise.resolve = function (e) {
|
|
5440
5570
|
return new TypesonPromise(function (t) {
|
|
5441
5571
|
t(e);
|
|
@@ -5495,26 +5625,31 @@
|
|
|
5495
5625
|
function unescapeKeyPathComponent(e) {
|
|
5496
5626
|
return e.replaceAll("~1", ".").replaceAll("~0", "~").replace(/^''$/, "").replaceAll("''''", "''");
|
|
5497
5627
|
}
|
|
5498
|
-
function getByKeyPath(
|
|
5499
|
-
if ("" ===
|
|
5500
|
-
if (null ===
|
|
5501
|
-
var
|
|
5502
|
-
|
|
5503
|
-
|
|
5504
|
-
|
|
5628
|
+
function getByKeyPath(t, r, n) {
|
|
5629
|
+
if ("" === r) return t;
|
|
5630
|
+
if (null === t || "object" != _typeof$1(t)) throw new TypeError("Unexpected non-object type");
|
|
5631
|
+
var o = r.indexOf("."),
|
|
5632
|
+
s = unescapeKeyPathComponent(-1 === o ? r : r.slice(0, o));
|
|
5633
|
+
if (e(t, s)) {
|
|
5634
|
+
if (-1 !== o) {
|
|
5635
|
+
var _e = t[s];
|
|
5636
|
+
return void 0 === _e ? void 0 : getByKeyPath(_e, r.slice(o + 1));
|
|
5637
|
+
}
|
|
5638
|
+
return t[s];
|
|
5505
5639
|
}
|
|
5506
|
-
return e[unescapeKeyPathComponent(t)];
|
|
5507
5640
|
}
|
|
5508
|
-
function setAtKeyPath(
|
|
5509
|
-
if ("" ===
|
|
5510
|
-
var
|
|
5511
|
-
|
|
5641
|
+
function setAtKeyPath(t, r, n, o) {
|
|
5642
|
+
if ("" === r) return n;
|
|
5643
|
+
var s = t,
|
|
5644
|
+
a = r;
|
|
5512
5645
|
for (;;) {
|
|
5513
|
-
if (!
|
|
5514
|
-
|
|
5515
|
-
|
|
5516
|
-
if (
|
|
5517
|
-
|
|
5646
|
+
if (!s || "object" != _typeof$1(s)) throw new TypeError("Unexpected non-object type");
|
|
5647
|
+
var _r = a.indexOf("."),
|
|
5648
|
+
_i = unescapeKeyPathComponent(-1 === _r ? a : a.slice(0, _r));
|
|
5649
|
+
if ("__proto__" === _i) throw new TypeError("Invalid property");
|
|
5650
|
+
if (-1 === _r) return s[_i] = n, t;
|
|
5651
|
+
if (!e(s, _i)) throw new TypeError("Invalid property");
|
|
5652
|
+
s = s[_i], a = a.slice(_r + 1);
|
|
5518
5653
|
}
|
|
5519
5654
|
}
|
|
5520
5655
|
function getJSONType(e) {
|
|
@@ -5524,11 +5659,19 @@
|
|
|
5524
5659
|
* @file Typeson - JSON with types.
|
|
5525
5660
|
* @license The MIT License (MIT)
|
|
5526
5661
|
* @copyright (c) 2016-2018 David Fahlander, Brett Zamir
|
|
5527
|
-
|
|
5662
|
+
*/
|
|
5528
5663
|
var r = Object.keys,
|
|
5529
5664
|
n = Object.hasOwn,
|
|
5530
5665
|
o = Array.isArray,
|
|
5531
5666
|
s = ["type", "replaced", "iterateIn", "iterateUnsetNumeric", "addLength"];
|
|
5667
|
+
function setOwnEnumerable(e, t, r) {
|
|
5668
|
+
Object.defineProperty(e, t, {
|
|
5669
|
+
configurable: true,
|
|
5670
|
+
enumerable: true,
|
|
5671
|
+
value: r,
|
|
5672
|
+
writable: true
|
|
5673
|
+
});
|
|
5674
|
+
}
|
|
5532
5675
|
function nestedPathsFirst(e, t) {
|
|
5533
5676
|
var _e$keypath$match, _t$keypath$match;
|
|
5534
5677
|
if ("" === e.keypath) return -1;
|
|
@@ -5599,13 +5742,17 @@
|
|
|
5599
5742
|
key: "specialTypeNames",
|
|
5600
5743
|
value: function specialTypeNames(e, t) {
|
|
5601
5744
|
var r = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
5602
|
-
return
|
|
5745
|
+
return this.encapsulate(e, t, _objectSpread2(_objectSpread2({}, r), {}, {
|
|
5746
|
+
returnTypeNames: true
|
|
5747
|
+
}));
|
|
5603
5748
|
}
|
|
5604
5749
|
}, {
|
|
5605
5750
|
key: "rootTypeName",
|
|
5606
5751
|
value: function rootTypeName(e, t) {
|
|
5607
5752
|
var r = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
5608
|
-
return
|
|
5753
|
+
return this.encapsulate(e, t, _objectSpread2(_objectSpread2({}, r), {}, {
|
|
5754
|
+
iterateNone: true
|
|
5755
|
+
}));
|
|
5609
5756
|
}
|
|
5610
5757
|
}, {
|
|
5611
5758
|
key: "encapsulate",
|
|
@@ -5616,11 +5763,12 @@
|
|
|
5616
5763
|
}, this.options), a),
|
|
5617
5764
|
c = i.sync,
|
|
5618
5765
|
y = {},
|
|
5619
|
-
l = [],
|
|
5620
5766
|
u = [],
|
|
5767
|
+
l = [],
|
|
5621
5768
|
p = [],
|
|
5622
5769
|
f = !("cyclic" in i) || i.cyclic,
|
|
5623
5770
|
d = i.encapsulateObserver,
|
|
5771
|
+
m = i.encapsulateError,
|
|
5624
5772
|
finish = function finish(e) {
|
|
5625
5773
|
var t = Object.values(y);
|
|
5626
5774
|
if (i.iterateNone) return t.length ? t[0] : getJSONType(e);
|
|
@@ -5653,22 +5801,29 @@
|
|
|
5653
5801
|
_context2.n = 2;
|
|
5654
5802
|
return Promise.all(r.map(/*#__PURE__*/function () {
|
|
5655
5803
|
var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(r) {
|
|
5656
|
-
var n, _t$splice, _t$splice2, o, _o, s, a, i, c, y,
|
|
5804
|
+
var n, _t$splice, _t$splice2, o, _o, s, a, i, c, y, u, l, p, _t, _t2, _t3, _t4;
|
|
5657
5805
|
return _regenerator().w(function (_context) {
|
|
5658
5806
|
while (1) switch (_context.n) {
|
|
5659
5807
|
case 0:
|
|
5660
|
-
n = [], _t$splice = t.splice(0, 1), _t$splice2 = _slicedToArray(_t$splice, 1), o = _t$splice2[0], _o = _slicedToArray(o, 7), s = _o[0], a = _o[2], i = _o[3], c = _o[4], y = _o[5],
|
|
5808
|
+
n = [], _t$splice = t.splice(0, 1), _t$splice2 = _slicedToArray(_t$splice, 1), o = _t$splice2[0], _o = _slicedToArray(o, 7), s = _o[0], a = _o[2], i = _o[3], c = _o[4], y = _o[5], u = _o[6], l = _encapsulate2(s, r, a, i, n, true, u), p = hasConstructorOf(l, TypesonPromise);
|
|
5661
5809
|
if (!(s && p)) {
|
|
5662
5810
|
_context.n = 2;
|
|
5663
5811
|
break;
|
|
5664
5812
|
}
|
|
5813
|
+
_t2 = setOwnEnumerable;
|
|
5814
|
+
_t3 = c;
|
|
5815
|
+
_t4 = y;
|
|
5665
5816
|
_context.n = 1;
|
|
5666
|
-
return
|
|
5817
|
+
return l.p;
|
|
5667
5818
|
case 1:
|
|
5668
|
-
_t2
|
|
5669
|
-
|
|
5819
|
+
_t2(_t3, _t4, _context.v);
|
|
5820
|
+
_t = _checkPromises(e, n);
|
|
5821
|
+
_context.n = 3;
|
|
5822
|
+
break;
|
|
5670
5823
|
case 2:
|
|
5671
|
-
|
|
5824
|
+
_t = (s ? setOwnEnumerable(c, y, l) : e = p ? l.p : l, _checkPromises(e, n));
|
|
5825
|
+
case 3:
|
|
5826
|
+
return _context.a(2, _t);
|
|
5672
5827
|
}
|
|
5673
5828
|
}, _callee);
|
|
5674
5829
|
}));
|
|
@@ -5697,61 +5852,88 @@
|
|
|
5697
5852
|
});
|
|
5698
5853
|
},
|
|
5699
5854
|
_encapsulate2 = function _encapsulate(e, t, s, a, c, p, f) {
|
|
5700
|
-
var
|
|
5701
|
-
|
|
5702
|
-
var
|
|
5703
|
-
|
|
5704
|
-
|
|
5705
|
-
|
|
5706
|
-
|
|
5707
|
-
|
|
5708
|
-
|
|
5709
|
-
|
|
5710
|
-
|
|
5711
|
-
|
|
5712
|
-
|
|
5713
|
-
|
|
5714
|
-
|
|
5715
|
-
|
|
5716
|
-
|
|
5717
|
-
|
|
5718
|
-
|
|
5719
|
-
|
|
5720
|
-
|
|
5855
|
+
var h,
|
|
5856
|
+
g = {};
|
|
5857
|
+
var b = d ? function (r) {
|
|
5858
|
+
var _ref2;
|
|
5859
|
+
var n = (_ref2 = f !== null && f !== void 0 ? f : a.type) !== null && _ref2 !== void 0 ? _ref2 : getJSONType(t);
|
|
5860
|
+
d(Object.assign(r !== null && r !== void 0 ? r : g, {
|
|
5861
|
+
keypath: e,
|
|
5862
|
+
value: t,
|
|
5863
|
+
cyclic: s,
|
|
5864
|
+
stateObj: a,
|
|
5865
|
+
promisesData: c,
|
|
5866
|
+
resolvingTypesonPromise: p,
|
|
5867
|
+
awaitingTypesonPromise: hasConstructorOf(t, TypesonPromise)
|
|
5868
|
+
}, {
|
|
5869
|
+
type: n
|
|
5870
|
+
}));
|
|
5871
|
+
} : null,
|
|
5872
|
+
getEncapsulatedValue = function getEncapsulatedValue(e, t, r) {
|
|
5873
|
+
try {
|
|
5874
|
+
return {
|
|
5875
|
+
value: _encapsulate2(e, t[r], Boolean(s), a, c, p)
|
|
5876
|
+
};
|
|
5877
|
+
} catch (n) {
|
|
5878
|
+
var _ref3;
|
|
5879
|
+
if (!m) throw n;
|
|
5880
|
+
var _o2 = (_ref3 = f !== null && f !== void 0 ? f : a.type) !== null && _ref3 !== void 0 ? _ref3 : getJSONType(t),
|
|
5881
|
+
_s = m({
|
|
5882
|
+
keypath: e,
|
|
5883
|
+
error: n,
|
|
5884
|
+
parent: t,
|
|
5885
|
+
key: r,
|
|
5886
|
+
stateObj: a,
|
|
5887
|
+
type: _o2
|
|
5888
|
+
});
|
|
5889
|
+
if (!_s) throw n;
|
|
5890
|
+
if ("substitute" in _s) return {
|
|
5891
|
+
value: _s.substitute,
|
|
5892
|
+
substitute: true
|
|
5893
|
+
};
|
|
5894
|
+
if (_s.ignore) return;
|
|
5895
|
+
throw n;
|
|
5896
|
+
}
|
|
5897
|
+
};
|
|
5898
|
+
if (["string", "boolean", "number", "undefined"].includes(_typeof$1(t))) return void 0 === t || t === 1 / 0 || 0 === t || t === -1 / 0 || Number.isNaN(t) ? (h = a.replaced ? t : replace(e, t, a, c, false, p, b), h !== t && (g = {
|
|
5899
|
+
replaced: h
|
|
5900
|
+
})) : h = t, b && b(), h;
|
|
5901
|
+
if (null === t) return b && b(), t;
|
|
5721
5902
|
if (s && t && "object" == _typeof$1(t) && !a.iterateIn && !a.iterateUnsetNumeric) {
|
|
5722
|
-
var
|
|
5723
|
-
if (-1 !==
|
|
5724
|
-
cyclicKeypath:
|
|
5725
|
-
}), "#" +
|
|
5726
|
-
true === s && (
|
|
5903
|
+
var _r2 = u.indexOf(t);
|
|
5904
|
+
if (-1 !== _r2) return y[e] = "#", b && b({
|
|
5905
|
+
cyclicKeypath: l[_r2]
|
|
5906
|
+
}), "#" + l[_r2];
|
|
5907
|
+
true === s && (u.push(t), l.push(e));
|
|
5727
5908
|
}
|
|
5728
|
-
var
|
|
5729
|
-
|
|
5730
|
-
|
|
5731
|
-
var
|
|
5732
|
-
if (
|
|
5733
|
-
replaced:
|
|
5734
|
-
}) : "" === e && hasConstructorOf(t, TypesonPromise) ? (c.push([e, t, s, a, void 0, void 0, a.type]),
|
|
5735
|
-
clone:
|
|
5736
|
-
}) : !
|
|
5737
|
-
clone:
|
|
5738
|
-
}),
|
|
5739
|
-
if (!
|
|
5909
|
+
var v = isPlainObject(t),
|
|
5910
|
+
O = o(t),
|
|
5911
|
+
w = (v || O) && (!_this2.plainObjectReplacers.length || a.replaced) || a.iterateIn ? t : replace(e, t, a, c, v || O, null, b);
|
|
5912
|
+
var T;
|
|
5913
|
+
if (w !== t ? (h = w, g = {
|
|
5914
|
+
replaced: w
|
|
5915
|
+
}) : "" === e && hasConstructorOf(t, TypesonPromise) ? (c.push([e, t, s, a, void 0, void 0, a.type]), h = t) : O && "object" !== a.iterateIn || "array" === a.iterateIn ? (T = new Array(t.length), g = {
|
|
5916
|
+
clone: T
|
|
5917
|
+
}) : !v && ("object" != _typeof$1(t) || "toJSON" in t || hasConstructorOf(t, TypesonPromise) || hasConstructorOf(t, Promise) || hasConstructorOf(t, ArrayBuffer)) && "object" !== a.iterateIn ? h = t : (T = {}, a.addLength && (T.length = t.length), g = {
|
|
5918
|
+
clone: T
|
|
5919
|
+
}), b && b(), i.iterateNone) return T !== null && T !== void 0 ? T : h;
|
|
5920
|
+
if (!T) return h;
|
|
5740
5921
|
if (a.iterateIn) {
|
|
5741
|
-
var _loop = function _loop(
|
|
5922
|
+
var _loop = function _loop(_r3) {
|
|
5742
5923
|
var o = {
|
|
5743
|
-
ownKeys: n(t,
|
|
5924
|
+
ownKeys: n(t, _r3)
|
|
5744
5925
|
};
|
|
5745
5926
|
_adaptBuiltinStateObjectProperties(a, o, function () {
|
|
5746
|
-
var n = e + (e ? "." : "") + escapeKeyPathComponent(
|
|
5747
|
-
o =
|
|
5748
|
-
|
|
5927
|
+
var n = e + (e ? "." : "") + escapeKeyPathComponent(_r3),
|
|
5928
|
+
o = getEncapsulatedValue(n, t, _r3),
|
|
5929
|
+
i = o && o.value;
|
|
5930
|
+
hasConstructorOf(i, TypesonPromise) ? c.push([n, i, Boolean(s), a, T, _r3, a.type]) : o && (void 0 !== i || "substitute" in o) && setOwnEnumerable(T, _r3, i);
|
|
5749
5931
|
});
|
|
5750
5932
|
};
|
|
5751
|
-
for (var
|
|
5752
|
-
_loop(
|
|
5933
|
+
for (var _r3 in t) {
|
|
5934
|
+
_loop(_r3);
|
|
5753
5935
|
}
|
|
5754
|
-
|
|
5936
|
+
b && b({
|
|
5755
5937
|
endIterateIn: true,
|
|
5756
5938
|
end: true
|
|
5757
5939
|
});
|
|
@@ -5760,70 +5942,71 @@
|
|
|
5760
5942
|
_adaptBuiltinStateObjectProperties(a, {
|
|
5761
5943
|
ownKeys: true
|
|
5762
5944
|
}, function () {
|
|
5763
|
-
var e =
|
|
5764
|
-
|
|
5945
|
+
var e = getEncapsulatedValue(n, t, r),
|
|
5946
|
+
o = e && e.value;
|
|
5947
|
+
hasConstructorOf(o, TypesonPromise) ? c.push([n, o, Boolean(s), a, T, r, a.type]) : e && (void 0 !== o || "substitute" in e) && setOwnEnumerable(T, r, o);
|
|
5765
5948
|
});
|
|
5766
|
-
}),
|
|
5949
|
+
}), b && b({
|
|
5767
5950
|
endIterateOwn: true,
|
|
5768
5951
|
end: true
|
|
5769
5952
|
});
|
|
5770
5953
|
if (a.iterateUnsetNumeric) {
|
|
5771
|
-
var
|
|
5772
|
-
var _loop2 = function _loop2(
|
|
5773
|
-
if (
|
|
5774
|
-
var r = "".concat(e).concat(e ? "." : "").concat(String(
|
|
5954
|
+
var _r4 = t.length;
|
|
5955
|
+
var _loop2 = function _loop2(_n) {
|
|
5956
|
+
if (_n in t) return 1; // continue
|
|
5957
|
+
var r = "".concat(e).concat(e ? "." : "").concat(String(_n));
|
|
5775
5958
|
_adaptBuiltinStateObjectProperties(a, {
|
|
5776
5959
|
ownKeys: false
|
|
5777
5960
|
}, function () {
|
|
5778
5961
|
var e = _encapsulate2(r, void 0, Boolean(s), a, c, p);
|
|
5779
|
-
hasConstructorOf(e, TypesonPromise) ? c.push([r, e, Boolean(s), a,
|
|
5962
|
+
hasConstructorOf(e, TypesonPromise) ? c.push([r, e, Boolean(s), a, T, _n, a.type]) : void 0 !== e && setOwnEnumerable(T, _n, e);
|
|
5780
5963
|
});
|
|
5781
5964
|
};
|
|
5782
|
-
for (var
|
|
5783
|
-
if (_loop2(
|
|
5965
|
+
for (var _n = 0; _n < _r4; _n++) {
|
|
5966
|
+
if (_loop2(_n)) continue;
|
|
5784
5967
|
}
|
|
5785
|
-
|
|
5968
|
+
b && b({
|
|
5786
5969
|
endIterateUnsetNumeric: true,
|
|
5787
5970
|
end: true
|
|
5788
5971
|
});
|
|
5789
5972
|
}
|
|
5790
|
-
return
|
|
5973
|
+
return T;
|
|
5791
5974
|
},
|
|
5792
5975
|
replace = function replace(e, t, r, n, o, s, a) {
|
|
5793
5976
|
var i = o ? _this2.plainObjectReplacers : _this2.nonplainObjectReplacers;
|
|
5794
|
-
var
|
|
5795
|
-
for (;
|
|
5796
|
-
var
|
|
5797
|
-
if (
|
|
5798
|
-
var
|
|
5799
|
-
if (Object.hasOwn(_this2.revivers,
|
|
5800
|
-
var
|
|
5801
|
-
y[e] =
|
|
5977
|
+
var u = i.length;
|
|
5978
|
+
for (; u--;) {
|
|
5979
|
+
var _o3 = i[u];
|
|
5980
|
+
if (_o3.test(t, r)) {
|
|
5981
|
+
var _i2 = _o3.type;
|
|
5982
|
+
if (Object.hasOwn(_this2.revivers, _i2)) {
|
|
5983
|
+
var _t5 = y[e];
|
|
5984
|
+
y[e] = _t5 ? [_i2].concat(_t5) : _i2;
|
|
5802
5985
|
}
|
|
5803
5986
|
if (Object.assign(r, {
|
|
5804
|
-
type:
|
|
5987
|
+
type: _i2,
|
|
5805
5988
|
replaced: true
|
|
5806
|
-
}), (c || !
|
|
5989
|
+
}), (c || !_o3.replaceAsync) && !_o3.replace) return a && a({
|
|
5807
5990
|
typeDetected: true
|
|
5808
|
-
}), _encapsulate2(e, t, f && "readonly", r, n, s,
|
|
5809
|
-
var
|
|
5991
|
+
}), _encapsulate2(e, t, f && "readonly", r, n, s, _i2);
|
|
5992
|
+
var _u = void 0;
|
|
5810
5993
|
if (a && a({
|
|
5811
5994
|
replacing: true
|
|
5812
|
-
}), c || !
|
|
5813
|
-
if (void 0 ===
|
|
5814
|
-
|
|
5815
|
-
} else
|
|
5816
|
-
return _encapsulate2(e,
|
|
5995
|
+
}), c || !_o3.replaceAsync) {
|
|
5996
|
+
if (void 0 === _o3.replace) throw new TypeError("Missing replacer");
|
|
5997
|
+
_u = _o3.replace(t, r);
|
|
5998
|
+
} else _u = _o3.replaceAsync(t, r);
|
|
5999
|
+
return _encapsulate2(e, _u, f && "readonly", r, n, s, _i2);
|
|
5817
6000
|
}
|
|
5818
6001
|
}
|
|
5819
6002
|
return t;
|
|
5820
6003
|
},
|
|
5821
|
-
|
|
6004
|
+
h = _encapsulate2("", e, f, t !== null && t !== void 0 ? t : {}, p);
|
|
5822
6005
|
if (p.length) return c && i.throwOnBadSyncType ? function () {
|
|
5823
6006
|
throw new TypeError("Sync method requested but async result obtained");
|
|
5824
|
-
}() : Promise.resolve(_checkPromises(
|
|
6007
|
+
}() : Promise.resolve(_checkPromises(h, p)).then(finish);
|
|
5825
6008
|
if (!c && i.throwOnBadSyncType) throw new TypeError("Async method requested but sync result obtained");
|
|
5826
|
-
return c && i.stringification ? [finish(
|
|
6009
|
+
return c && i.stringification ? [finish(h)] : c ? finish(h) : Promise.resolve(finish(h));
|
|
5827
6010
|
}
|
|
5828
6011
|
}, {
|
|
5829
6012
|
key: "encapsulateSync",
|
|
@@ -5862,18 +6045,18 @@
|
|
|
5862
6045
|
if (!i || "object" != _typeof$1(i) || Array.isArray(i)) return finishRevival(e);
|
|
5863
6046
|
var c = [],
|
|
5864
6047
|
y = Object.create(null),
|
|
5865
|
-
|
|
5866
|
-
var
|
|
5867
|
-
i.$ && isPlainObject(i.$) && (e = e.$, i = i.$,
|
|
6048
|
+
u = {};
|
|
6049
|
+
var l = true;
|
|
6050
|
+
i.$ && isPlainObject(i.$) && (e = e.$, i = i.$, l = false);
|
|
5868
6051
|
var executeReviver = function executeReviver(e, t) {
|
|
5869
6052
|
var _this3$revivers$e;
|
|
5870
|
-
var
|
|
5871
|
-
|
|
5872
|
-
r =
|
|
6053
|
+
var _ref4 = (_this3$revivers$e = _this3.revivers[e]) !== null && _this3$revivers$e !== void 0 ? _this3$revivers$e : [],
|
|
6054
|
+
_ref5 = _slicedToArray(_ref4, 1),
|
|
6055
|
+
r = _ref5[0];
|
|
5873
6056
|
if (!r) throw new Error("Unregistered type: " + e);
|
|
5874
6057
|
if (a && !("revive" in r)) return t;
|
|
5875
|
-
if (!a && r.reviveAsync) return r.reviveAsync(t,
|
|
5876
|
-
if (r.revive) return r.revive(t,
|
|
6058
|
+
if (!a && r.reviveAsync) return r.reviveAsync(t, u);
|
|
6059
|
+
if (r.revive) return r.revive(t, u);
|
|
5877
6060
|
throw new Error("Missing reviver");
|
|
5878
6061
|
},
|
|
5879
6062
|
p = [];
|
|
@@ -5883,23 +6066,23 @@
|
|
|
5883
6066
|
var f = function () {
|
|
5884
6067
|
if (!i) throw new Error("Found bad `types`");
|
|
5885
6068
|
var t = [];
|
|
5886
|
-
if (Object.entries(i).forEach(function (
|
|
5887
|
-
var
|
|
5888
|
-
e =
|
|
5889
|
-
r =
|
|
6069
|
+
if (Object.entries(i).forEach(function (_ref6) {
|
|
6070
|
+
var _ref7 = _slicedToArray(_ref6, 2),
|
|
6071
|
+
e = _ref7[0],
|
|
6072
|
+
r = _ref7[1];
|
|
5890
6073
|
"#" !== r && [].concat(r).forEach(function (r) {
|
|
5891
6074
|
var _this3$revivers$r;
|
|
5892
|
-
var
|
|
5893
|
-
|
|
5894
|
-
n =
|
|
6075
|
+
var _ref8 = (_this3$revivers$r = _this3.revivers[r]) !== null && _this3$revivers$r !== void 0 ? _this3$revivers$r : [null, {}],
|
|
6076
|
+
_ref9 = _slicedToArray(_ref8, 2),
|
|
6077
|
+
n = _ref9[1].plain;
|
|
5895
6078
|
n && (t.push({
|
|
5896
6079
|
keypath: e,
|
|
5897
6080
|
type: r
|
|
5898
6081
|
}), delete i[e]);
|
|
5899
6082
|
});
|
|
5900
|
-
}), t.length) return t.sort(nestedPathsFirst), t.reduce(function reducer(t,
|
|
5901
|
-
var r =
|
|
5902
|
-
n =
|
|
6083
|
+
}), t.length) return t.sort(nestedPathsFirst), t.reduce(function reducer(t, _ref0) {
|
|
6084
|
+
var r = _ref0.keypath,
|
|
6085
|
+
n = _ref0.type;
|
|
5903
6086
|
if (isThenable(t)) return t.then(function (e) {
|
|
5904
6087
|
return reducer(e, {
|
|
5905
6088
|
keypath: r,
|
|
@@ -5918,39 +6101,39 @@
|
|
|
5918
6101
|
var d;
|
|
5919
6102
|
return hasConstructorOf(f, TypesonPromise) ? d = f.then(function () {
|
|
5920
6103
|
return e;
|
|
5921
|
-
}) : (d = function _revive(e, t, s,
|
|
5922
|
-
if (
|
|
6104
|
+
}) : (d = function _revive(e, t, s, u, f) {
|
|
6105
|
+
if (l && "$types" === e) return;
|
|
5923
6106
|
var d = p.length,
|
|
5924
|
-
m = i[e],
|
|
6107
|
+
m = n(i, e) ? i[e] : void 0,
|
|
5925
6108
|
h = o(t);
|
|
5926
6109
|
if (h || isPlainObject(t)) {
|
|
5927
|
-
var
|
|
6110
|
+
var _o4 = h ? new Array(t.length) : {};
|
|
5928
6111
|
for (r(t).forEach(function (r) {
|
|
5929
|
-
var n = _revive(e + (e ? "." : "") + escapeKeyPathComponent(r), t[r], s !== null && s !== void 0 ? s :
|
|
6112
|
+
var n = _revive(e + (e ? "." : "") + escapeKeyPathComponent(r), t[r], s !== null && s !== void 0 ? s : _o4, _o4, r),
|
|
5930
6113
|
set = function set(e) {
|
|
5931
|
-
return hasConstructorOf(e, Undefined) ?
|
|
6114
|
+
return hasConstructorOf(e, Undefined) ? setOwnEnumerable(_o4, r, void 0) : void 0 !== e && setOwnEnumerable(_o4, r, e), e;
|
|
5932
6115
|
};
|
|
5933
6116
|
hasConstructorOf(n, TypesonPromise) ? p.push(n.then(function (e) {
|
|
5934
6117
|
return set(e);
|
|
5935
6118
|
})) : set(n);
|
|
5936
|
-
}), t =
|
|
6119
|
+
}), t = _o4; c.length;) {
|
|
5937
6120
|
var _c$ = _slicedToArray(c[0], 4),
|
|
5938
|
-
|
|
5939
|
-
|
|
5940
|
-
|
|
5941
|
-
|
|
5942
|
-
|
|
5943
|
-
_a =
|
|
5944
|
-
if (!
|
|
5945
|
-
|
|
6121
|
+
_e2 = _c$[0],
|
|
6122
|
+
_t6 = _c$[1],
|
|
6123
|
+
_r5 = _c$[2],
|
|
6124
|
+
_o5 = _c$[3],
|
|
6125
|
+
_s2 = n(y, _t6),
|
|
6126
|
+
_a = _s2 ? y[_t6] : getByKeyPath(_e2, _t6);
|
|
6127
|
+
if (!_s2 && void 0 === _a) break;
|
|
6128
|
+
setOwnEnumerable(_r5, _o5, _a), c.shift();
|
|
5946
6129
|
}
|
|
5947
6130
|
}
|
|
5948
6131
|
if (!m) return y[e] = t, t;
|
|
5949
6132
|
if ("#" === m) {
|
|
5950
|
-
var
|
|
5951
|
-
|
|
5952
|
-
|
|
5953
|
-
return
|
|
6133
|
+
var _e3 = t.slice(1),
|
|
6134
|
+
_r6 = n(y, _e3),
|
|
6135
|
+
_o6 = _r6 ? y[_e3] : getByKeyPath(s, _e3);
|
|
6136
|
+
return _r6 || void 0 !== _o6 || c.push([s, _e3, u, f]), _o6;
|
|
5954
6137
|
}
|
|
5955
6138
|
var applyType = function applyType(t) {
|
|
5956
6139
|
var r = [].concat(m).reduce(function reducer(e, t) {
|
|
@@ -5969,9 +6152,9 @@
|
|
|
5969
6152
|
}) : applyType(t);
|
|
5970
6153
|
}("", e, null), p.length && (d = TypesonPromise.resolve(d).then(function (e) {
|
|
5971
6154
|
return TypesonPromise.all([e].concat(p));
|
|
5972
|
-
}).then(function (
|
|
5973
|
-
var
|
|
5974
|
-
e =
|
|
6155
|
+
}).then(function (_ref1) {
|
|
6156
|
+
var _ref10 = _slicedToArray(_ref1, 1),
|
|
6157
|
+
e = _ref10[0];
|
|
5975
6158
|
return e;
|
|
5976
6159
|
}))), isThenable(d) ? a && s.throwOnBadSyncType ? function () {
|
|
5977
6160
|
throw new TypeError("Sync method requested but async result obtained");
|
|
@@ -6006,49 +6189,50 @@
|
|
|
6006
6189
|
o(e) ? e.forEach(function (e) {
|
|
6007
6190
|
_reg(e);
|
|
6008
6191
|
}) : r(e).forEach(function (t) {
|
|
6009
|
-
var
|
|
6192
|
+
var _r9;
|
|
6010
6193
|
if ("#" === t) throw new TypeError("# cannot be used as a type name as it is reserved for cyclic objects");
|
|
6011
6194
|
if (a.includes(t)) throw new TypeError("Plain JSON object types are reserved as type names");
|
|
6012
6195
|
var r = e[t];
|
|
6013
|
-
|
|
6014
|
-
|
|
6196
|
+
if ([_this4.plainObjectReplacers, _this4.nonplainObjectReplacers].forEach(function (e) {
|
|
6197
|
+
var r = e.findIndex(function (e) {
|
|
6015
6198
|
return e.type === t;
|
|
6016
6199
|
});
|
|
6017
|
-
|
|
6018
|
-
|
|
6200
|
+
-1 !== r && e.splice(r, 1);
|
|
6201
|
+
}), delete _this4.revivers[t], delete _this4.types[t], "function" == typeof r) {
|
|
6202
|
+
var _e4 = r;
|
|
6019
6203
|
r = {
|
|
6020
6204
|
test: function test(t) {
|
|
6021
|
-
return t && t.constructor ===
|
|
6205
|
+
return t && t.constructor === _e4;
|
|
6022
6206
|
},
|
|
6023
6207
|
replace: function replace(e) {
|
|
6024
6208
|
return _objectSpread2({}, e);
|
|
6025
6209
|
},
|
|
6026
6210
|
revive: function revive(t) {
|
|
6027
|
-
return Object.assign(Object.create(
|
|
6211
|
+
return Object.assign(Object.create(_e4.prototype), t);
|
|
6028
6212
|
}
|
|
6029
6213
|
};
|
|
6030
6214
|
} else if (o(r)) {
|
|
6031
|
-
var
|
|
6032
|
-
|
|
6033
|
-
|
|
6034
|
-
|
|
6035
|
-
|
|
6215
|
+
var _r7 = r,
|
|
6216
|
+
_r8 = _slicedToArray(_r7, 3),
|
|
6217
|
+
_e5 = _r8[0],
|
|
6218
|
+
_t7 = _r8[1],
|
|
6219
|
+
_n2 = _r8[2];
|
|
6036
6220
|
r = {
|
|
6037
|
-
test:
|
|
6038
|
-
replace:
|
|
6039
|
-
revive:
|
|
6221
|
+
test: _e5,
|
|
6222
|
+
replace: _t7,
|
|
6223
|
+
revive: _n2
|
|
6040
6224
|
};
|
|
6041
6225
|
}
|
|
6042
|
-
if (!((
|
|
6043
|
-
var
|
|
6226
|
+
if (!((_r9 = r) !== null && _r9 !== void 0 && _r9.test)) return;
|
|
6227
|
+
var s = {
|
|
6044
6228
|
type: t,
|
|
6045
6229
|
test: r.test.bind(r)
|
|
6046
6230
|
};
|
|
6047
|
-
r.replace && (
|
|
6048
|
-
var
|
|
6049
|
-
if (r.testPlainObjects ? _this4.plainObjectReplacers.splice(
|
|
6050
|
-
var
|
|
6051
|
-
r.revive && (
|
|
6231
|
+
r.replace && (s.replace = r.replace.bind(r)), r.replaceAsync && (s.replaceAsync = r.replaceAsync.bind(r));
|
|
6232
|
+
var i = "number" == typeof n.fallback ? n.fallback : n.fallback ? 0 : 1 / 0;
|
|
6233
|
+
if (r.testPlainObjects ? _this4.plainObjectReplacers.splice(i, 0, s) : _this4.nonplainObjectReplacers.splice(i, 0, s), r.revive || r.reviveAsync) {
|
|
6234
|
+
var _e6 = {};
|
|
6235
|
+
r.revive && (_e6.revive = r.revive.bind(r)), r.reviveAsync && (_e6.reviveAsync = r.reviveAsync.bind(r)), _this4.revivers[t] = [_e6, {
|
|
6052
6236
|
plain: r.testPlainObjects
|
|
6053
6237
|
}];
|
|
6054
6238
|
}
|
|
@@ -6067,12 +6251,12 @@
|
|
|
6067
6251
|
Undefined.__typeson__type__ = "TypesonUndefined";
|
|
6068
6252
|
var a = ["null", "boolean", "number", "string", "array", "object"];
|
|
6069
6253
|
for (var i = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", c = new Uint8Array(256), y = 0; y < 64; y++) c[i.codePointAt(y)] = y;
|
|
6070
|
-
var
|
|
6254
|
+
var u = function encode(e, t, r) {
|
|
6071
6255
|
null == r && (r = e.byteLength);
|
|
6072
6256
|
for (var n = new Uint8Array(e, 0, r), o = n.length, s = "", a = 0; a < o; a += 3) s += i[n[a] >> 2], s += i[(3 & n[a]) << 4 | n[a + 1] >> 4], s += i[(15 & n[a + 1]) << 2 | n[a + 2] >> 6], s += i[63 & n[a + 2]];
|
|
6073
6257
|
return o % 3 == 2 ? s = s.slice(0, -1) + "=" : o % 3 == 1 && (s = s.slice(0, -2) + "=="), s;
|
|
6074
6258
|
},
|
|
6075
|
-
|
|
6259
|
+
l = function decode(e, t) {
|
|
6076
6260
|
var r = e.length;
|
|
6077
6261
|
if (r % 4) throw new Error("Bad base64 length: not divisible by four");
|
|
6078
6262
|
var n,
|
|
@@ -6082,8 +6266,8 @@
|
|
|
6082
6266
|
i = .75 * e.length,
|
|
6083
6267
|
y = 0;
|
|
6084
6268
|
"=" === e[e.length - 1] && (i--, "=" === e[e.length - 2] && i--);
|
|
6085
|
-
for (var
|
|
6086
|
-
return
|
|
6269
|
+
for (var u = new ArrayBuffer(i, t), l = new Uint8Array(u), p = 0; p < r; p += 4) n = c[e.codePointAt(p)], o = c[e.codePointAt(p + 1)], s = c[e.codePointAt(p + 2)], a = c[e.codePointAt(p + 3)], l[y++] = n << 2 | o >> 4, l[y++] = (15 & o) << 4 | s >> 2, l[y++] = (3 & s) << 6 | 63 & a;
|
|
6270
|
+
return u;
|
|
6087
6271
|
};
|
|
6088
6272
|
var p = {
|
|
6089
6273
|
arraybuffer: {
|
|
@@ -6096,14 +6280,14 @@
|
|
|
6096
6280
|
return -1 !== r ? {
|
|
6097
6281
|
index: r
|
|
6098
6282
|
} : (t.buffers.push(e), {
|
|
6099
|
-
s:
|
|
6283
|
+
s: u(e),
|
|
6100
6284
|
maxByteLength: e.maxByteLength,
|
|
6101
6285
|
resizable: e.resizable
|
|
6102
6286
|
});
|
|
6103
6287
|
},
|
|
6104
6288
|
revive: function revive(e, t) {
|
|
6105
6289
|
if (t.buffers || (t.buffers = []), Object.hasOwn(e, "index")) return t.buffers[e.index];
|
|
6106
|
-
var r =
|
|
6290
|
+
var r = l(e.s, e.resizable ? {
|
|
6107
6291
|
maxByteLength: e.maxByteLength
|
|
6108
6292
|
} : void 0);
|
|
6109
6293
|
return t.buffers.push(r), r;
|
|
@@ -6139,7 +6323,7 @@
|
|
|
6139
6323
|
}
|
|
6140
6324
|
function string2arraybuffer(e) {
|
|
6141
6325
|
var t = new Uint8Array(e.length);
|
|
6142
|
-
for (var
|
|
6326
|
+
for (var _r0 = 0; _r0 < e.length; _r0++) t[_r0] = e.charCodeAt(_r0);
|
|
6143
6327
|
return t.buffer;
|
|
6144
6328
|
}
|
|
6145
6329
|
var m = {
|
|
@@ -6184,8 +6368,8 @@
|
|
|
6184
6368
|
},
|
|
6185
6369
|
replaceAsync: function replaceAsync(e) {
|
|
6186
6370
|
return new TypesonPromise(/*#__PURE__*/function () {
|
|
6187
|
-
var
|
|
6188
|
-
var n,
|
|
6371
|
+
var _ref11 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3(t, r) {
|
|
6372
|
+
var n, _t8;
|
|
6189
6373
|
return _regenerator().w(function (_context3) {
|
|
6190
6374
|
while (1) switch (_context3.p = _context3.n) {
|
|
6191
6375
|
case 0:
|
|
@@ -6198,8 +6382,8 @@
|
|
|
6198
6382
|
break;
|
|
6199
6383
|
case 2:
|
|
6200
6384
|
_context3.p = 2;
|
|
6201
|
-
|
|
6202
|
-
return _context3.a(2, void r(
|
|
6385
|
+
_t8 = _context3.v;
|
|
6386
|
+
return _context3.a(2, void r(_t8));
|
|
6203
6387
|
case 3:
|
|
6204
6388
|
t({
|
|
6205
6389
|
jwk: n,
|
|
@@ -6212,7 +6396,7 @@
|
|
|
6212
6396
|
}, _callee3, null, [[0, 2]]);
|
|
6213
6397
|
}));
|
|
6214
6398
|
return function (_x4, _x5) {
|
|
6215
|
-
return
|
|
6399
|
+
return _ref11.apply(this, arguments);
|
|
6216
6400
|
};
|
|
6217
6401
|
}());
|
|
6218
6402
|
},
|
|
@@ -6229,10 +6413,10 @@
|
|
|
6229
6413
|
test: function test(e) {
|
|
6230
6414
|
return "DataView" === toStringTag(e);
|
|
6231
6415
|
},
|
|
6232
|
-
replace: function replace(
|
|
6233
|
-
var e =
|
|
6234
|
-
t =
|
|
6235
|
-
r =
|
|
6416
|
+
replace: function replace(_ref12, n) {
|
|
6417
|
+
var e = _ref12.buffer,
|
|
6418
|
+
t = _ref12.byteOffset,
|
|
6419
|
+
r = _ref12.byteLength;
|
|
6236
6420
|
n.buffers || (n.buffers = []);
|
|
6237
6421
|
var o = n.buffers.indexOf(e);
|
|
6238
6422
|
return -1 !== o ? {
|
|
@@ -6240,7 +6424,7 @@
|
|
|
6240
6424
|
byteOffset: t,
|
|
6241
6425
|
byteLength: r
|
|
6242
6426
|
} : (n.buffers.push(e), {
|
|
6243
|
-
encoded:
|
|
6427
|
+
encoded: u(e),
|
|
6244
6428
|
maxByteLength: e.maxByteLength,
|
|
6245
6429
|
resizable: e.resizable,
|
|
6246
6430
|
byteOffset: t,
|
|
@@ -6256,7 +6440,7 @@
|
|
|
6256
6440
|
a = e.maxByteLength,
|
|
6257
6441
|
i = e.resizable;
|
|
6258
6442
|
var c;
|
|
6259
|
-
return "index" in e ? c = t.buffers[s] : (c =
|
|
6443
|
+
return "index" in e ? c = t.buffers[s] : (c = l(o, i ? {
|
|
6260
6444
|
maxByteLength: a
|
|
6261
6445
|
} : a), t.buffers.push(c)), new DataView(c, r, n);
|
|
6262
6446
|
}
|
|
@@ -6287,9 +6471,9 @@
|
|
|
6287
6471
|
message: e.message
|
|
6288
6472
|
};
|
|
6289
6473
|
},
|
|
6290
|
-
revive: function revive(
|
|
6291
|
-
var e =
|
|
6292
|
-
t =
|
|
6474
|
+
revive: function revive(_ref13) {
|
|
6475
|
+
var e = _ref13.message,
|
|
6476
|
+
t = _ref13.name;
|
|
6293
6477
|
return new DOMException(e, t);
|
|
6294
6478
|
}
|
|
6295
6479
|
}
|
|
@@ -6347,11 +6531,11 @@
|
|
|
6347
6531
|
w: e.w
|
|
6348
6532
|
};
|
|
6349
6533
|
},
|
|
6350
|
-
revive: function revive(
|
|
6351
|
-
var t =
|
|
6352
|
-
r =
|
|
6353
|
-
n =
|
|
6354
|
-
o =
|
|
6534
|
+
revive: function revive(_ref14) {
|
|
6535
|
+
var t = _ref14.x,
|
|
6536
|
+
r = _ref14.y,
|
|
6537
|
+
n = _ref14.z,
|
|
6538
|
+
o = _ref14.w;
|
|
6355
6539
|
return new e(t, r, n, o);
|
|
6356
6540
|
}
|
|
6357
6541
|
};
|
|
@@ -6370,11 +6554,11 @@
|
|
|
6370
6554
|
p4: e.p4
|
|
6371
6555
|
};
|
|
6372
6556
|
},
|
|
6373
|
-
revive: function revive(
|
|
6374
|
-
var e =
|
|
6375
|
-
t =
|
|
6376
|
-
r =
|
|
6377
|
-
n =
|
|
6557
|
+
revive: function revive(_ref15) {
|
|
6558
|
+
var e = _ref15.p1,
|
|
6559
|
+
t = _ref15.p2,
|
|
6560
|
+
r = _ref15.p3,
|
|
6561
|
+
n = _ref15.p4;
|
|
6378
6562
|
return new DOMQuad(e, t, r, n);
|
|
6379
6563
|
}
|
|
6380
6564
|
}
|
|
@@ -6393,11 +6577,11 @@
|
|
|
6393
6577
|
height: e.height
|
|
6394
6578
|
};
|
|
6395
6579
|
},
|
|
6396
|
-
revive: function revive(
|
|
6397
|
-
var t =
|
|
6398
|
-
r =
|
|
6399
|
-
n =
|
|
6400
|
-
o =
|
|
6580
|
+
revive: function revive(_ref16) {
|
|
6581
|
+
var t = _ref16.x,
|
|
6582
|
+
r = _ref16.y,
|
|
6583
|
+
n = _ref16.width,
|
|
6584
|
+
o = _ref16.height;
|
|
6401
6585
|
return new e(t, r, n, o);
|
|
6402
6586
|
}
|
|
6403
6587
|
};
|
|
@@ -6408,14 +6592,14 @@
|
|
|
6408
6592
|
test: function test(e) {
|
|
6409
6593
|
return "Error" === toStringTag(e);
|
|
6410
6594
|
},
|
|
6411
|
-
replace: function replace(
|
|
6412
|
-
var e =
|
|
6413
|
-
t =
|
|
6414
|
-
r =
|
|
6415
|
-
n =
|
|
6416
|
-
o =
|
|
6417
|
-
s =
|
|
6418
|
-
a =
|
|
6595
|
+
replace: function replace(_ref17) {
|
|
6596
|
+
var e = _ref17.name,
|
|
6597
|
+
t = _ref17.message,
|
|
6598
|
+
r = _ref17.cause,
|
|
6599
|
+
n = _ref17.stack,
|
|
6600
|
+
o = _ref17.fileName,
|
|
6601
|
+
s = _ref17.lineNumber,
|
|
6602
|
+
a = _ref17.columnNumber;
|
|
6419
6603
|
return {
|
|
6420
6604
|
name: e,
|
|
6421
6605
|
message: t,
|
|
@@ -6438,15 +6622,15 @@
|
|
|
6438
6622
|
test: function test(t) {
|
|
6439
6623
|
return hasConstructorOf(t, e);
|
|
6440
6624
|
},
|
|
6441
|
-
replace: function replace(
|
|
6442
|
-
var e =
|
|
6443
|
-
t =
|
|
6444
|
-
r =
|
|
6445
|
-
n =
|
|
6446
|
-
o =
|
|
6447
|
-
s =
|
|
6448
|
-
a =
|
|
6449
|
-
i =
|
|
6625
|
+
replace: function replace(_ref18) {
|
|
6626
|
+
var e = _ref18.name,
|
|
6627
|
+
t = _ref18.message,
|
|
6628
|
+
r = _ref18.cause,
|
|
6629
|
+
n = _ref18.stack,
|
|
6630
|
+
o = _ref18.fileName,
|
|
6631
|
+
s = _ref18.lineNumber,
|
|
6632
|
+
a = _ref18.columnNumber,
|
|
6633
|
+
i = _ref18.errors;
|
|
6450
6634
|
return {
|
|
6451
6635
|
name: e,
|
|
6452
6636
|
message: t,
|
|
@@ -6467,7 +6651,7 @@
|
|
|
6467
6651
|
[TypeError, RangeError, SyntaxError, ReferenceError, EvalError, URIError].forEach(function (e) {
|
|
6468
6652
|
return create$2(e);
|
|
6469
6653
|
}), "undefined" != typeof AggregateError && create$2(AggregateError), "function" == typeof InternalError && create$2(InternalError);
|
|
6470
|
-
var
|
|
6654
|
+
var E = {
|
|
6471
6655
|
file: {
|
|
6472
6656
|
test: function test(e) {
|
|
6473
6657
|
return "File" === toStringTag(e);
|
|
@@ -6482,11 +6666,11 @@
|
|
|
6482
6666
|
lastModified: e.lastModified
|
|
6483
6667
|
};
|
|
6484
6668
|
},
|
|
6485
|
-
revive: function revive(
|
|
6486
|
-
var e =
|
|
6487
|
-
t =
|
|
6488
|
-
r =
|
|
6489
|
-
n =
|
|
6669
|
+
revive: function revive(_ref19) {
|
|
6670
|
+
var e = _ref19.name,
|
|
6671
|
+
t = _ref19.type,
|
|
6672
|
+
r = _ref19.stringContents,
|
|
6673
|
+
n = _ref19.lastModified;
|
|
6490
6674
|
return new File([string2arraybuffer(r)], e, {
|
|
6491
6675
|
type: t,
|
|
6492
6676
|
lastModified: n
|
|
@@ -6509,15 +6693,15 @@
|
|
|
6509
6693
|
}
|
|
6510
6694
|
}
|
|
6511
6695
|
},
|
|
6512
|
-
|
|
6513
|
-
file:
|
|
6696
|
+
N = {
|
|
6697
|
+
file: E.file,
|
|
6514
6698
|
filelist: {
|
|
6515
6699
|
test: function test(e) {
|
|
6516
6700
|
return "FileList" === toStringTag(e);
|
|
6517
6701
|
},
|
|
6518
6702
|
replace: function replace(e) {
|
|
6519
6703
|
var t = [];
|
|
6520
|
-
for (var
|
|
6704
|
+
for (var _r1 = 0; _r1 < e.length; _r1++) t[_r1] = e.item(_r1);
|
|
6521
6705
|
return t;
|
|
6522
6706
|
},
|
|
6523
6707
|
revive: function revive(e) {
|
|
@@ -6542,7 +6726,7 @@
|
|
|
6542
6726
|
}
|
|
6543
6727
|
}
|
|
6544
6728
|
},
|
|
6545
|
-
|
|
6729
|
+
_ = {
|
|
6546
6730
|
imagebitmap: {
|
|
6547
6731
|
test: function test(e) {
|
|
6548
6732
|
return "ImageBitmap" === toStringTag(e) || e && e.dataset && "ImageBitmap" === e.dataset.toStringTag;
|
|
@@ -6570,36 +6754,36 @@
|
|
|
6570
6754
|
return n.addEventListener("load", function () {
|
|
6571
6755
|
r.drawImage(n, 0, 0);
|
|
6572
6756
|
}), n.src = e.dataURL, new TypesonPromise(/*#__PURE__*/function () {
|
|
6573
|
-
var
|
|
6574
|
-
var
|
|
6757
|
+
var _ref20 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee4(e, r) {
|
|
6758
|
+
var _t9, _t0;
|
|
6575
6759
|
return _regenerator().w(function (_context4) {
|
|
6576
6760
|
while (1) switch (_context4.p = _context4.n) {
|
|
6577
6761
|
case 0:
|
|
6578
6762
|
_context4.p = 0;
|
|
6579
|
-
|
|
6763
|
+
_t9 = e;
|
|
6580
6764
|
_context4.n = 1;
|
|
6581
6765
|
return createImageBitmap(t);
|
|
6582
6766
|
case 1:
|
|
6583
|
-
|
|
6767
|
+
_t9(_context4.v);
|
|
6584
6768
|
_context4.n = 3;
|
|
6585
6769
|
break;
|
|
6586
6770
|
case 2:
|
|
6587
6771
|
_context4.p = 2;
|
|
6588
|
-
|
|
6589
|
-
r(
|
|
6772
|
+
_t0 = _context4.v;
|
|
6773
|
+
r(_t0);
|
|
6590
6774
|
case 3:
|
|
6591
6775
|
return _context4.a(2);
|
|
6592
6776
|
}
|
|
6593
6777
|
}, _callee4, null, [[0, 2]]);
|
|
6594
6778
|
}));
|
|
6595
6779
|
return function (_x6, _x7) {
|
|
6596
|
-
return
|
|
6780
|
+
return _ref20.apply(this, arguments);
|
|
6597
6781
|
};
|
|
6598
6782
|
}());
|
|
6599
6783
|
}
|
|
6600
6784
|
}
|
|
6601
6785
|
},
|
|
6602
|
-
|
|
6786
|
+
B = {
|
|
6603
6787
|
imagedata: {
|
|
6604
6788
|
test: function test(e) {
|
|
6605
6789
|
return "ImageData" === toStringTag(e);
|
|
@@ -6616,7 +6800,7 @@
|
|
|
6616
6800
|
}
|
|
6617
6801
|
}
|
|
6618
6802
|
},
|
|
6619
|
-
|
|
6803
|
+
I = {
|
|
6620
6804
|
infinity: {
|
|
6621
6805
|
test: function test(e) {
|
|
6622
6806
|
return e === 1 / 0;
|
|
@@ -6681,7 +6865,7 @@
|
|
|
6681
6865
|
}
|
|
6682
6866
|
}
|
|
6683
6867
|
},
|
|
6684
|
-
|
|
6868
|
+
R = {
|
|
6685
6869
|
StringObject: {
|
|
6686
6870
|
test: function test(e) {
|
|
6687
6871
|
return "String" === toStringTag(e) && "object" == _typeof$1(e);
|
|
@@ -6712,7 +6896,7 @@
|
|
|
6712
6896
|
}
|
|
6713
6897
|
}
|
|
6714
6898
|
},
|
|
6715
|
-
|
|
6899
|
+
K = {
|
|
6716
6900
|
regexp: {
|
|
6717
6901
|
test: function test(e) {
|
|
6718
6902
|
return "RegExp" === toStringTag(e);
|
|
@@ -6723,14 +6907,14 @@
|
|
|
6723
6907
|
flags: (e.global ? "g" : "") + (e.ignoreCase ? "i" : "") + (e.multiline ? "m" : "") + (e.sticky ? "y" : "") + (e.unicode ? "u" : "") + (e.unicodeSets ? "v" : "") + (e.hasIndices ? "d" : "") + (e.dotAll ? "s" : "")
|
|
6724
6908
|
};
|
|
6725
6909
|
},
|
|
6726
|
-
revive: function revive(
|
|
6727
|
-
var e =
|
|
6728
|
-
t =
|
|
6910
|
+
revive: function revive(_ref22) {
|
|
6911
|
+
var e = _ref22.source,
|
|
6912
|
+
t = _ref22.flags;
|
|
6729
6913
|
return new RegExp(e, t);
|
|
6730
6914
|
}
|
|
6731
6915
|
}
|
|
6732
6916
|
},
|
|
6733
|
-
|
|
6917
|
+
z = {
|
|
6734
6918
|
set: {
|
|
6735
6919
|
test: function test(e) {
|
|
6736
6920
|
return "Set" === toStringTag(e);
|
|
@@ -6768,10 +6952,10 @@
|
|
|
6768
6952
|
test: function test(e) {
|
|
6769
6953
|
return toStringTag(e) === t;
|
|
6770
6954
|
},
|
|
6771
|
-
replace: function replace(
|
|
6772
|
-
var e =
|
|
6773
|
-
t =
|
|
6774
|
-
r =
|
|
6955
|
+
replace: function replace(_ref23, n) {
|
|
6956
|
+
var e = _ref23.buffer,
|
|
6957
|
+
t = _ref23.byteOffset,
|
|
6958
|
+
r = _ref23.length;
|
|
6775
6959
|
n.buffers || (n.buffers = []);
|
|
6776
6960
|
var o = n.buffers.indexOf(e);
|
|
6777
6961
|
return -1 !== o ? {
|
|
@@ -6781,7 +6965,7 @@
|
|
|
6781
6965
|
} : (n.buffers.push(e), {
|
|
6782
6966
|
maxByteLength: e.maxByteLength,
|
|
6783
6967
|
resizable: e.resizable,
|
|
6784
|
-
encoded:
|
|
6968
|
+
encoded: u(e),
|
|
6785
6969
|
byteOffset: t,
|
|
6786
6970
|
length: r
|
|
6787
6971
|
});
|
|
@@ -6795,7 +6979,7 @@
|
|
|
6795
6979
|
i = t.maxByteLength,
|
|
6796
6980
|
c = t.resizable;
|
|
6797
6981
|
var y;
|
|
6798
|
-
return "index" in t ? y = r.buffers[a] : (y =
|
|
6982
|
+
return "index" in t ? y = r.buffers[a] : (y = l(s, c ? {
|
|
6799
6983
|
maxByteLength: i
|
|
6800
6984
|
} : void 0), r.buffers.push(y)), new e(y, n, o);
|
|
6801
6985
|
}
|
|
@@ -6842,10 +7026,10 @@
|
|
|
6842
7026
|
revive: function revive(e) {
|
|
6843
7027
|
if (Array.isArray(e)) return e;
|
|
6844
7028
|
var t = [];
|
|
6845
|
-
return Object.entries(e).forEach(function (
|
|
6846
|
-
var
|
|
6847
|
-
e =
|
|
6848
|
-
r =
|
|
7029
|
+
return Object.entries(e).forEach(function (_ref24) {
|
|
7030
|
+
var _ref25 = _slicedToArray(_ref24, 2),
|
|
7031
|
+
e = _ref25[0],
|
|
7032
|
+
r = _ref25[1];
|
|
6849
7033
|
t[e] = r;
|
|
6850
7034
|
}), t;
|
|
6851
7035
|
}
|
|
@@ -6861,8 +7045,8 @@
|
|
|
6861
7045
|
revive: function revive() {}
|
|
6862
7046
|
}
|
|
6863
7047
|
}],
|
|
6864
|
-
X = [M,
|
|
6865
|
-
re = [G, Q, H,
|
|
7048
|
+
X = [M, I, L, D],
|
|
7049
|
+
re = [G, Q, H, R, X, O, K, B, _, E, N, m, x, j].concat("function" == typeof Map ? U : [], "function" == typeof Set ? z : [], "function" == typeof ArrayBuffer ? p : [], "function" == typeof Uint8Array ? W : [], "function" == typeof DataView ? v : [], "undefined" != typeof crypto ? b : [], "undefined" != typeof BigInt ? [d, f] : [], "undefined" != typeof DOMException ? w : [], "undefined" != typeof DOMRect ? S : [], "undefined" != typeof DOMPoint ? A : [], "undefined" != typeof DOMQuad ? P : [], "undefined" != typeof DOMMatrix ? T : []),
|
|
6866
7050
|
ne = re.concat({
|
|
6867
7051
|
checkDataCloneException: {
|
|
6868
7052
|
test: function test(e) {
|
|
@@ -7626,7 +7810,7 @@
|
|
|
7626
7810
|
reject(err);
|
|
7627
7811
|
});
|
|
7628
7812
|
}));
|
|
7629
|
-
SyncPromise.all(indexCreations).then(finish
|
|
7813
|
+
SyncPromise.all(indexCreations).then(finish).catch(/** @type {(reason: any) => PromiseLike<never>} */
|
|
7630
7814
|
error).catch(function (err) {
|
|
7631
7815
|
console.log('Index rename error');
|
|
7632
7816
|
throw err;
|
|
@@ -9819,7 +10003,7 @@
|
|
|
9819
10003
|
* __connections: {
|
|
9820
10004
|
* [key: string]: import('./IDBDatabase.js').IDBDatabaseFull[]
|
|
9821
10005
|
* }
|
|
9822
|
-
|
|
10006
|
+
* }} IDBFactoryFull
|
|
9823
10007
|
*/
|
|
9824
10008
|
|
|
9825
10009
|
var IDBFactoryAlias = IDBFactory;
|
|
@@ -10010,7 +10194,7 @@
|
|
|
10010
10194
|
/** @type {import('./IDBDatabase.js').IDBDatabaseFull} */
|
|
10011
10195
|
req.__result.__versionTransaction = null;
|
|
10012
10196
|
sysdbFinishedCb(systx, false, function () {
|
|
10013
|
-
req.transaction.
|
|
10197
|
+
req.transaction.__callTransFinishedCb(false, function () {
|
|
10014
10198
|
ev.complete();
|
|
10015
10199
|
req.__transaction = null;
|
|
10016
10200
|
});
|
|
@@ -10121,6 +10305,13 @@
|
|
|
10121
10305
|
function openDB(oldVersion) {
|
|
10122
10306
|
/** @type {DatabaseFull} */
|
|
10123
10307
|
var db;
|
|
10308
|
+
if (version === undefined) {
|
|
10309
|
+
// Resolve before use as a cache key below, or a `open(name)` call
|
|
10310
|
+
// (no explicit version) would cache/look up under `undefined`
|
|
10311
|
+
// instead of the actual version, causing a second, separate
|
|
10312
|
+
// connection to be opened for the same database on reopen.
|
|
10313
|
+
version = oldVersion || 1;
|
|
10314
|
+
}
|
|
10124
10315
|
if ((useMemoryDatabase || useDatabaseCache) && Object.hasOwn(websqlDBCache, name) && Object.hasOwn(websqlDBCache[name], version)) {
|
|
10125
10316
|
db = websqlDBCache[name][version];
|
|
10126
10317
|
} else {
|
|
@@ -10132,9 +10323,6 @@
|
|
|
10132
10323
|
websqlDBCache[name][version] = db;
|
|
10133
10324
|
}
|
|
10134
10325
|
}
|
|
10135
|
-
if (version === undefined) {
|
|
10136
|
-
version = oldVersion || 1;
|
|
10137
|
-
}
|
|
10138
10326
|
if (oldVersion > version) {
|
|
10139
10327
|
var err = createDOMException('VersionError', 'An attempt was made to open a database using a lower version than the existing version.', version);
|
|
10140
10328
|
if (useDatabaseCache) {
|
|
@@ -10302,7 +10490,6 @@
|
|
|
10302
10490
|
version = _data$rows$item.version;
|
|
10303
10491
|
var openConnections = me.__connections[name] || [];
|
|
10304
10492
|
triggerAnyVersionChangeAndBlockedEvents(openConnections, req, version, null).then(function () {
|
|
10305
|
-
// eslint-disable-line promise/catch-or-return -- Sync promise
|
|
10306
10493
|
// Since we need two databases which can't be in a single transaction, we
|
|
10307
10494
|
// do this deleting from `dbVersions` first since the `__sys__` deleting
|
|
10308
10495
|
// only impacts file memory whereas this one is critical for avoiding it
|
|
@@ -10331,7 +10518,7 @@
|
|
|
10331
10518
|
});
|
|
10332
10519
|
return undefined;
|
|
10333
10520
|
// @ts-expect-error It's ok
|
|
10334
|
-
}
|
|
10521
|
+
}).catch(dbError);
|
|
10335
10522
|
return undefined;
|
|
10336
10523
|
}, dbError);
|
|
10337
10524
|
});
|
|
@@ -10362,14 +10549,14 @@
|
|
|
10362
10549
|
};
|
|
10363
10550
|
|
|
10364
10551
|
/**
|
|
10365
|
-
|
|
10366
|
-
|
|
10367
|
-
|
|
10368
|
-
|
|
10369
|
-
|
|
10370
|
-
|
|
10371
|
-
|
|
10372
|
-
|
|
10552
|
+
* May return outdated information if a database has since been deleted.
|
|
10553
|
+
* @see https://github.com/w3c/IndexedDB/pull/240/files
|
|
10554
|
+
* @this {IDBFactoryFull}
|
|
10555
|
+
* @returns {Promise<{
|
|
10556
|
+
* name: string,
|
|
10557
|
+
* version: Integer
|
|
10558
|
+
* }[]>}
|
|
10559
|
+
*/
|
|
10373
10560
|
IDBFactory.prototype.databases = function () {
|
|
10374
10561
|
var me = this;
|
|
10375
10562
|
var calledDbCreateError = false;
|
|
@@ -10417,17 +10604,17 @@
|
|
|
10417
10604
|
};
|
|
10418
10605
|
|
|
10419
10606
|
/**
|
|
10420
|
-
|
|
10421
|
-
|
|
10422
|
-
|
|
10423
|
-
|
|
10424
|
-
|
|
10425
|
-
|
|
10426
|
-
|
|
10427
|
-
|
|
10428
|
-
|
|
10429
|
-
|
|
10430
|
-
|
|
10607
|
+
* @todo forceClose: Test
|
|
10608
|
+
* This is provided to facilitate unit-testing of the
|
|
10609
|
+
* closing of a database connection with a forced flag:
|
|
10610
|
+
* <https://w3c.github.io/IndexedDB/#steps-for-closing-a-database-connection>
|
|
10611
|
+
* @param {string} dbName
|
|
10612
|
+
* @param {Integer} connIdx
|
|
10613
|
+
* @param {string} msg
|
|
10614
|
+
* @throws {TypeError}
|
|
10615
|
+
* @this {IDBFactoryFull}
|
|
10616
|
+
* @returns {void}
|
|
10617
|
+
*/
|
|
10431
10618
|
IDBFactory.prototype.__forceClose = function (dbName, connIdx, msg) {
|
|
10432
10619
|
var me = this;
|
|
10433
10620
|
/**
|
|
@@ -10513,6 +10700,9 @@
|
|
|
10513
10700
|
* __unique: boolean,
|
|
10514
10701
|
* __sqlDirection: "DESC"|"ASC",
|
|
10515
10702
|
* __matchedKeys: {[key: string]: true},
|
|
10703
|
+
* __continuationKey: import('./Key.js').Key|undefined,
|
|
10704
|
+
* __continuationPrimaryKey: import('./Key.js').Key|undefined,
|
|
10705
|
+
* __multiEntryExhausted: boolean,
|
|
10516
10706
|
* __invalidateCache: () => void
|
|
10517
10707
|
* }} IDBCursorFull
|
|
10518
10708
|
*/
|
|
@@ -10586,6 +10776,9 @@
|
|
|
10586
10776
|
this.__valueDecoder = this.__keyOnly ? Key : Sca;
|
|
10587
10777
|
this.__count = count;
|
|
10588
10778
|
this.__prefetchedIndex = -1;
|
|
10779
|
+
this.__continuationKey = undefined;
|
|
10780
|
+
this.__continuationPrimaryKey = undefined;
|
|
10781
|
+
this.__multiEntryExhausted = false;
|
|
10589
10782
|
this.__multiEntryIndex = this.__indexSource ? 'multiEntry' in source && source.multiEntry : false;
|
|
10590
10783
|
this.__unique = this.direction.includes('unique');
|
|
10591
10784
|
this.__sqlDirection = ['prev', 'prevunique'].includes(this.direction) ? 'DESC' : 'ASC';
|
|
@@ -10749,73 +10942,97 @@
|
|
|
10749
10942
|
* @param {SQLTransaction} tx
|
|
10750
10943
|
* @param {KeySuccess} success
|
|
10751
10944
|
* @param {FindError} error
|
|
10752
|
-
* @param {Integer
|
|
10945
|
+
* @param {Integer} [recordsToLoad]
|
|
10753
10946
|
* @this {IDBCursorFull}
|
|
10754
10947
|
* @returns {void}
|
|
10755
10948
|
*/
|
|
10756
|
-
IDBCursor.prototype.__findMultiEntry = function (key, primaryKey, tx, success, error
|
|
10949
|
+
IDBCursor.prototype.__findMultiEntry = function (key, primaryKey, tx, success, error) {
|
|
10950
|
+
var recordsToLoad = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 1;
|
|
10757
10951
|
var me = this;
|
|
10758
|
-
if (me.
|
|
10952
|
+
if (me.__multiEntryExhausted) {
|
|
10759
10953
|
if (CFG.DEBUG) {
|
|
10760
|
-
console.log('Reached end of multiEntry cursor');
|
|
10954
|
+
console.log('[multiEntry] Reached end of multiEntry cursor (already exhausted)');
|
|
10761
10955
|
}
|
|
10762
10956
|
success(undefined, undefined, undefined);
|
|
10763
10957
|
return;
|
|
10764
10958
|
}
|
|
10765
10959
|
var quotedKeyColumnName = sqlQuote(me.__keyColumnName);
|
|
10766
|
-
var
|
|
10767
|
-
/** @type {string[]} */
|
|
10768
|
-
var sqlValues = [];
|
|
10769
|
-
sql.push('WHERE', quotedKeyColumnName, 'NOT NULL');
|
|
10770
|
-
if (me.__range && me.__range.lower !== undefined && Array.isArray(me.__range.upper)) {
|
|
10771
|
-
if (me.__range.upper.indexOf(me.__range.lower) === 0) {
|
|
10772
|
-
sql.push('AND', quotedKeyColumnName, "LIKE ? ESCAPE '^'");
|
|
10773
|
-
sqlValues.push('%' + sqlLIKEEscape(/** @type {string} */me.__range.__lowerCached.slice(0, -1)) + '%');
|
|
10774
|
-
}
|
|
10775
|
-
}
|
|
10960
|
+
var quotedKey = sqlQuote('key');
|
|
10776
10961
|
|
|
10777
10962
|
// Determine the ORDER BY direction based on the cursor.
|
|
10778
10963
|
var direction = me.__sqlDirection;
|
|
10779
10964
|
var op = direction === 'ASC' ? '>' : '<';
|
|
10780
|
-
var quotedKey = sqlQuote('key');
|
|
10781
|
-
if (primaryKey !== undefined) {
|
|
10782
|
-
sql.push('AND', quotedKey, op + '= ?');
|
|
10783
|
-
// Key.convertValueToKey(primaryKey); // Already checked by `continuePrimaryKey`
|
|
10784
|
-
sqlValues.push(/** @type {string} */_encode(primaryKey));
|
|
10785
|
-
}
|
|
10786
|
-
if (key !== undefined) {
|
|
10787
|
-
sql.push('AND', quotedKeyColumnName, op + '= ?');
|
|
10788
|
-
// Key.convertValueToKey(key); // Already checked by `continue` or `continuePrimaryKey`
|
|
10789
|
-
sqlValues.push(/** @type {string} */_encode(key));
|
|
10790
|
-
} else if (me.__key !== undefined) {
|
|
10791
|
-
sql.push('AND', quotedKeyColumnName, op + ' ?');
|
|
10792
|
-
// Key.convertValueToKey(me.__key); // Already checked when entered
|
|
10793
|
-
sqlValues.push(/** @type {string} */_encode(me.__key));
|
|
10794
|
-
}
|
|
10795
|
-
if (!me.__count) {
|
|
10796
|
-
// 1. Sort by key
|
|
10797
|
-
sql.push('ORDER BY', quotedKeyColumnName, direction);
|
|
10798
10965
|
|
|
10799
|
-
|
|
10800
|
-
|
|
10801
|
-
|
|
10802
|
-
|
|
10966
|
+
/**
|
|
10967
|
+
* Runs (and, if a batch of underlying rows produces no matching
|
|
10968
|
+
* multi-entry values, repeatedly re-runs) the query for the next batch
|
|
10969
|
+
* of underlying rows, advancing `me.__continuationKey`/
|
|
10970
|
+
* `me.__continuationPrimaryKey` (tracking the last *physical* row
|
|
10971
|
+
* scanned) each time, until either some matches are found or the
|
|
10972
|
+
* underlying table is exhausted.
|
|
10973
|
+
* @returns {void}
|
|
10974
|
+
*/
|
|
10975
|
+
function runQuery() {
|
|
10976
|
+
var sql = ['SELECT * FROM', escapeStoreNameForSQL(me.__store.__currentName)];
|
|
10977
|
+
/** @type {string[]} */
|
|
10978
|
+
var sqlValues = [];
|
|
10979
|
+
sql.push('WHERE', quotedKeyColumnName, 'NOT NULL');
|
|
10980
|
+
if (me.__range && me.__range.lower !== undefined && Array.isArray(me.__range.upper)) {
|
|
10981
|
+
if (me.__range.upper.indexOf(me.__range.lower) === 0) {
|
|
10982
|
+
sql.push('AND', quotedKeyColumnName, "LIKE ? ESCAPE '^'");
|
|
10983
|
+
sqlValues.push('%' + sqlLIKEEscape(/** @type {string} */me.__range.__lowerCached.slice(0, -1)) + '%');
|
|
10984
|
+
}
|
|
10985
|
+
}
|
|
10986
|
+
if (primaryKey !== undefined) {
|
|
10987
|
+
sql.push('AND', quotedKey, op + '= ?');
|
|
10988
|
+
// Key.convertValueToKey(primaryKey); // Already checked by `continuePrimaryKey`
|
|
10989
|
+
sqlValues.push(/** @type {string} */_encode(primaryKey));
|
|
10803
10990
|
}
|
|
10804
|
-
|
|
10805
|
-
|
|
10806
|
-
|
|
10807
|
-
|
|
10808
|
-
|
|
10809
|
-
|
|
10991
|
+
if (key !== undefined) {
|
|
10992
|
+
sql.push('AND', quotedKeyColumnName, op + '= ?');
|
|
10993
|
+
// Key.convertValueToKey(key); // Already checked by `continue` or `continuePrimaryKey`
|
|
10994
|
+
sqlValues.push(/** @type {string} */_encode(key));
|
|
10995
|
+
} else if (me.__continuationKey !== undefined) {
|
|
10996
|
+
// Resume from the last underlying (physical) row we scanned, not
|
|
10997
|
+
// from the last *matching* multi-entry value (which lives in a
|
|
10998
|
+
// different key-space than the raw index column and cannot be
|
|
10999
|
+
// reliably compared against it, e.g. for array index keys).
|
|
11000
|
+
sql.push('AND (', quotedKeyColumnName, op, '?', 'OR (', quotedKeyColumnName, '= ?', 'AND', quotedKey, op, '?))');
|
|
11001
|
+
var encodedContinuationKey = /** @type {string} */
|
|
11002
|
+
_encode(me.__continuationKey, true);
|
|
11003
|
+
sqlValues.push(encodedContinuationKey, encodedContinuationKey, /** @type {string} */_encode(me.__continuationPrimaryKey));
|
|
11004
|
+
}
|
|
11005
|
+
if (!me.__count) {
|
|
11006
|
+
// 1. Sort by key
|
|
11007
|
+
sql.push('ORDER BY', quotedKeyColumnName, direction);
|
|
11008
|
+
|
|
11009
|
+
// 2. Sort by primaryKey (if defined and not unique)
|
|
11010
|
+
if (!me.__unique && me.__keyColumnName !== 'key') {
|
|
11011
|
+
// Avoid adding 'key' twice
|
|
11012
|
+
sql.push(',', sqlQuote('key'), direction);
|
|
11013
|
+
}
|
|
11014
|
+
|
|
11015
|
+
// 3. Sort by position (if defined)
|
|
11016
|
+
|
|
11017
|
+
if (!me.__unique && me.__indexSource) {
|
|
11018
|
+
// 4. Sort by object store position (if defined and not unique)
|
|
11019
|
+
sql.push(',', sqlQuote(me.__valueColumnName), direction);
|
|
11020
|
+
}
|
|
11021
|
+
sql.push('LIMIT', String(recordsToLoad));
|
|
11022
|
+
}
|
|
11023
|
+
var sqlStr = sql.join(' ');
|
|
11024
|
+
if (CFG.DEBUG) {
|
|
11025
|
+
console.log('[multiEntry] query', sqlStr, sqlValues);
|
|
10810
11026
|
}
|
|
10811
|
-
|
|
10812
|
-
|
|
10813
|
-
|
|
10814
|
-
|
|
10815
|
-
|
|
10816
|
-
|
|
10817
|
-
|
|
10818
|
-
|
|
11027
|
+
tx.executeSql(sqlStr, sqlValues, function (tx, data) {
|
|
11028
|
+
if (data.rows.length === 0) {
|
|
11029
|
+
me.__multiEntryExhausted = true;
|
|
11030
|
+
if (CFG.DEBUG) {
|
|
11031
|
+
console.log('[multiEntry] Reached end of multiEntry cursor (no more rows)');
|
|
11032
|
+
}
|
|
11033
|
+
success(undefined, undefined, undefined);
|
|
11034
|
+
return;
|
|
11035
|
+
}
|
|
10819
11036
|
if (me.__count) {
|
|
10820
11037
|
// Avoid caching and other processing below
|
|
10821
11038
|
var ct = 0;
|
|
@@ -10828,6 +11045,16 @@
|
|
|
10828
11045
|
success(undefined, ct, undefined);
|
|
10829
11046
|
return;
|
|
10830
11047
|
}
|
|
11048
|
+
|
|
11049
|
+
// Track how far we've physically scanned, regardless of whether
|
|
11050
|
+
// this batch produced any matches, so the next batch (if any)
|
|
11051
|
+
// resumes after this one instead of re-scanning or stopping early.
|
|
11052
|
+
var lastRawRow = data.rows.item(data.rows.length - 1);
|
|
11053
|
+
me.__continuationKey = _decode(lastRawRow[me.__keyColumnName], true);
|
|
11054
|
+
me.__continuationPrimaryKey = _decode(lastRawRow.key);
|
|
11055
|
+
if (data.rows.length < recordsToLoad) {
|
|
11056
|
+
me.__multiEntryExhausted = true;
|
|
11057
|
+
}
|
|
10831
11058
|
var rows = [];
|
|
10832
11059
|
for (var _i = 0; _i < data.rows.length; _i++) {
|
|
10833
11060
|
var _rowItem = data.rows.item(_i);
|
|
@@ -10854,6 +11081,20 @@
|
|
|
10854
11081
|
_iterator.f();
|
|
10855
11082
|
}
|
|
10856
11083
|
}
|
|
11084
|
+
if (rows.length === 0) {
|
|
11085
|
+
if (me.__multiEntryExhausted) {
|
|
11086
|
+
if (CFG.DEBUG) {
|
|
11087
|
+
console.log('[multiEntry] Reached end of multiEntry cursor (last batch had no matches)');
|
|
11088
|
+
}
|
|
11089
|
+
success(undefined, undefined, undefined);
|
|
11090
|
+
return;
|
|
11091
|
+
}
|
|
11092
|
+
if (CFG.DEBUG) {
|
|
11093
|
+
console.log('[multiEntry] batch had no matches; fetching next batch');
|
|
11094
|
+
}
|
|
11095
|
+
runQuery();
|
|
11096
|
+
return;
|
|
11097
|
+
}
|
|
10857
11098
|
var reverse = me.direction.indexOf('prev') === 0;
|
|
10858
11099
|
rows.sort(function (a, b) {
|
|
10859
11100
|
if (a.matchingKey.replaceAll(leftBracketRegex, 'z') < b.matchingKey.replaceAll(leftBracketRegex, 'z')) {
|
|
@@ -10870,47 +11111,31 @@
|
|
|
10870
11111
|
}
|
|
10871
11112
|
return 0;
|
|
10872
11113
|
});
|
|
10873
|
-
|
|
10874
|
-
|
|
10875
|
-
|
|
10876
|
-
|
|
10877
|
-
|
|
10878
|
-
|
|
10879
|
-
|
|
10880
|
-
|
|
10881
|
-
|
|
10882
|
-
|
|
10883
|
-
return this.data[index];
|
|
10884
|
-
}
|
|
10885
|
-
};
|
|
10886
|
-
if (CFG.DEBUG) {
|
|
10887
|
-
console.log('Preloaded ' + me.__prefetchedData.length + ' records for multiEntry cursor');
|
|
10888
|
-
}
|
|
10889
|
-
me.__decode(rows[0], success);
|
|
10890
|
-
} else if (rows.length === 1) {
|
|
10891
|
-
if (CFG.DEBUG) {
|
|
10892
|
-
console.log('Reached end of multiEntry cursor');
|
|
10893
|
-
}
|
|
10894
|
-
me.__decode(rows[0], success);
|
|
10895
|
-
} else {
|
|
10896
|
-
if (CFG.DEBUG) {
|
|
10897
|
-
console.log('Reached end of multiEntry cursor');
|
|
11114
|
+
me.__prefetchedIndex = 0;
|
|
11115
|
+
me.__prefetchedData = {
|
|
11116
|
+
data: rows,
|
|
11117
|
+
length: rows.length,
|
|
11118
|
+
/**
|
|
11119
|
+
* @param {Integer} index
|
|
11120
|
+
* @returns {RowItemNonNull}
|
|
11121
|
+
*/
|
|
11122
|
+
item: function item(index) {
|
|
11123
|
+
return this.data[index];
|
|
10898
11124
|
}
|
|
10899
|
-
|
|
11125
|
+
};
|
|
11126
|
+
if (CFG.DEBUG) {
|
|
11127
|
+
console.log('[multiEntry] Preloaded ' + me.__prefetchedData.length + ' records for multiEntry cursor');
|
|
10900
11128
|
}
|
|
10901
|
-
|
|
11129
|
+
me.__decode(rows[0], success);
|
|
11130
|
+
}, function (tx, err) {
|
|
10902
11131
|
if (CFG.DEBUG) {
|
|
10903
|
-
console.log('
|
|
11132
|
+
console.log('[multiEntry] Could not execute Cursor.continue', sqlStr, sqlValues);
|
|
10904
11133
|
}
|
|
10905
|
-
|
|
10906
|
-
|
|
10907
|
-
|
|
10908
|
-
|
|
10909
|
-
|
|
10910
|
-
}
|
|
10911
|
-
error(err);
|
|
10912
|
-
return false;
|
|
10913
|
-
});
|
|
11134
|
+
error(err);
|
|
11135
|
+
return false;
|
|
11136
|
+
});
|
|
11137
|
+
}
|
|
11138
|
+
runQuery();
|
|
10914
11139
|
};
|
|
10915
11140
|
|
|
10916
11141
|
/**
|
|
@@ -10922,19 +11147,19 @@
|
|
|
10922
11147
|
*/
|
|
10923
11148
|
|
|
10924
11149
|
/**
|
|
10925
|
-
|
|
10926
|
-
|
|
10927
|
-
|
|
10928
|
-
|
|
10929
|
-
|
|
11150
|
+
* @callback SuccessArg
|
|
11151
|
+
* @param {StructuredCloneValue} value
|
|
11152
|
+
* @param {import('./IDBRequest.js').IDBRequestFull} req
|
|
11153
|
+
* @returns {void}
|
|
11154
|
+
*/
|
|
10930
11155
|
|
|
10931
11156
|
/**
|
|
10932
|
-
|
|
10933
|
-
|
|
10934
|
-
|
|
10935
|
-
|
|
10936
|
-
|
|
10937
|
-
|
|
11157
|
+
* @callback SuccessCallback
|
|
11158
|
+
* @param {IndexedDBKey} key
|
|
11159
|
+
* @param {StructuredCloneValue} value
|
|
11160
|
+
* @param {IndexedDBKey} primaryKey
|
|
11161
|
+
* @returns {void}
|
|
11162
|
+
*/
|
|
10938
11163
|
|
|
10939
11164
|
/**
|
|
10940
11165
|
* Creates an "onsuccess" callback.
|
|
@@ -10962,11 +11187,11 @@
|
|
|
10962
11187
|
|
|
10963
11188
|
/**
|
|
10964
11189
|
* @typedef {{
|
|
10965
|
-
|
|
10966
|
-
|
|
10967
|
-
|
|
10968
|
-
|
|
10969
|
-
|
|
11190
|
+
* matchingKey: string,
|
|
11191
|
+
* key: string,
|
|
11192
|
+
* [k: string]: string
|
|
11193
|
+
* }} RowItemNonNull
|
|
11194
|
+
*/
|
|
10970
11195
|
|
|
10971
11196
|
/**
|
|
10972
11197
|
*
|
|
@@ -11019,6 +11244,7 @@
|
|
|
11019
11244
|
IDBCursor.prototype.__invalidateCache = function () {
|
|
11020
11245
|
// @ts-expect-error Why is this not being found?
|
|
11021
11246
|
this.__prefetchedData = null;
|
|
11247
|
+
this.__multiEntryExhausted = false;
|
|
11022
11248
|
};
|
|
11023
11249
|
|
|
11024
11250
|
/**
|
|
@@ -11074,8 +11300,8 @@
|
|
|
11074
11300
|
me.__advanceCount--;
|
|
11075
11301
|
me.__key = k;
|
|
11076
11302
|
me.__continue(undefined, true);
|
|
11077
|
-
|
|
11078
|
-
|
|
11303
|
+
// We don't call success yet but do need to advance the transaction queue
|
|
11304
|
+
runContinuationSafely(/** @type {() => void} */executeNextRequest);
|
|
11079
11305
|
return;
|
|
11080
11306
|
}
|
|
11081
11307
|
me.__advanceCount = undefined;
|
|
@@ -11097,11 +11323,15 @@
|
|
|
11097
11323
|
return;
|
|
11098
11324
|
}
|
|
11099
11325
|
// @ts-expect-error Todo: Our bug to fix
|
|
11100
|
-
|
|
11326
|
+
runContinuationSafely(function () {
|
|
11327
|
+
return cursorContinue(tx, args, success, error);
|
|
11328
|
+
});
|
|
11101
11329
|
}
|
|
11102
11330
|
if (me.__unique && !me.__multiEntryIndex && encKey === _encode(me.key, me.__multiEntryIndex)) {
|
|
11103
11331
|
// @ts-expect-error Todo: Our bug to fix
|
|
11104
|
-
|
|
11332
|
+
runContinuationSafely(function () {
|
|
11333
|
+
return cursorContinue(tx, args, success, error);
|
|
11334
|
+
});
|
|
11105
11335
|
return;
|
|
11106
11336
|
}
|
|
11107
11337
|
checkKey();
|