indexeddbshim 6.6.0 → 9.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -6
- package/badges/coverage-badge.svg +1 -1
- package/badges/licenses-badge-dev.svg +1 -1
- package/badges/tests-badge.svg +1 -1
- package/dist/indexeddbshim-Key.js +34 -47
- 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.js +700 -570
- package/dist/indexeddbshim-UnicodeIdentifiers-node.js.map +1 -1
- package/dist/indexeddbshim-UnicodeIdentifiers.js +735 -631
- package/dist/indexeddbshim-UnicodeIdentifiers.js.map +1 -1
- package/dist/indexeddbshim-UnicodeIdentifiers.min.js +6 -6
- package/dist/indexeddbshim-UnicodeIdentifiers.min.js.map +1 -1
- package/dist/indexeddbshim-node.js +700 -570
- package/dist/indexeddbshim-node.js.map +1 -1
- package/dist/indexeddbshim-noninvasive.js +736 -632
- package/dist/indexeddbshim-noninvasive.js.map +1 -1
- package/dist/indexeddbshim-noninvasive.min.js +6 -6
- package/dist/indexeddbshim-noninvasive.min.js.map +1 -1
- package/dist/indexeddbshim.js +735 -631
- package/dist/indexeddbshim.js.map +1 -1
- package/dist/indexeddbshim.min.js +6 -6
- package/dist/indexeddbshim.min.js.map +1 -1
- package/examples/IDBKeyUtils.html +0 -1
- package/index.html +5 -4
- package/package.json +58 -65
- package/src/DOMStringList.js +3 -3
- package/src/IDBDatabase.js +1 -1
- package/src/IDBObjectStore.js +3 -2
- package/src/IDBRequest.js +2 -2
- package/src/Key.js +9 -8
- package/src/unicode-regex.js +2 -2
- package/src/util.js +13 -18
- package/CHANGES.md +0 -1173
|
@@ -1,75 +1,70 @@
|
|
|
1
|
-
/*! indexeddbshim -
|
|
1
|
+
/*! indexeddbshim - v9.0.0 - 1/5/2022 */
|
|
2
2
|
|
|
3
3
|
'use strict';
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
var path = require('path');
|
|
6
|
+
var customOpenDatabase = require('websql/custom/index.js');
|
|
6
7
|
|
|
7
|
-
|
|
8
|
-
var customOpenDatabase = _interopDefault(require('websql/custom/index.js'));
|
|
8
|
+
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
Object.defineProperty(obj, key, {
|
|
13
|
-
value: value,
|
|
14
|
-
enumerable: true,
|
|
15
|
-
configurable: true,
|
|
16
|
-
writable: true
|
|
17
|
-
});
|
|
18
|
-
} else {
|
|
19
|
-
obj[key] = value;
|
|
20
|
-
}
|
|
10
|
+
var path__default = /*#__PURE__*/_interopDefaultLegacy(path);
|
|
11
|
+
var customOpenDatabase__default = /*#__PURE__*/_interopDefaultLegacy(customOpenDatabase);
|
|
21
12
|
|
|
22
|
-
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
function ownKeys(object, enumerableOnly) {
|
|
13
|
+
function ownKeys$1(object, enumerableOnly) {
|
|
26
14
|
var keys = Object.keys(object);
|
|
27
15
|
|
|
28
16
|
if (Object.getOwnPropertySymbols) {
|
|
29
17
|
var symbols = Object.getOwnPropertySymbols(object);
|
|
30
|
-
|
|
18
|
+
enumerableOnly && (symbols = symbols.filter(function (sym) {
|
|
31
19
|
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
32
|
-
});
|
|
33
|
-
keys.push.apply(keys, symbols);
|
|
20
|
+
})), keys.push.apply(keys, symbols);
|
|
34
21
|
}
|
|
35
22
|
|
|
36
23
|
return keys;
|
|
37
24
|
}
|
|
38
25
|
|
|
39
|
-
function _objectSpread2(target) {
|
|
26
|
+
function _objectSpread2$1(target) {
|
|
40
27
|
for (var i = 1; i < arguments.length; i++) {
|
|
41
|
-
var source = arguments[i]
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
} else if (Object.getOwnPropertyDescriptors) {
|
|
48
|
-
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
|
49
|
-
} else {
|
|
50
|
-
ownKeys(Object(source)).forEach(function (key) {
|
|
51
|
-
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
52
|
-
});
|
|
53
|
-
}
|
|
28
|
+
var source = null != arguments[i] ? arguments[i] : {};
|
|
29
|
+
i % 2 ? ownKeys$1(Object(source), !0).forEach(function (key) {
|
|
30
|
+
_defineProperty$1(target, key, source[key]);
|
|
31
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$1(Object(source)).forEach(function (key) {
|
|
32
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
33
|
+
});
|
|
54
34
|
}
|
|
55
35
|
|
|
56
36
|
return target;
|
|
57
37
|
}
|
|
58
38
|
|
|
59
|
-
function
|
|
39
|
+
function _defineProperty$1(obj, key, value) {
|
|
40
|
+
if (key in obj) {
|
|
41
|
+
Object.defineProperty(obj, key, {
|
|
42
|
+
value: value,
|
|
43
|
+
enumerable: true,
|
|
44
|
+
configurable: true,
|
|
45
|
+
writable: true
|
|
46
|
+
});
|
|
47
|
+
} else {
|
|
48
|
+
obj[key] = value;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
return obj;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
function _typeof$1(obj) {
|
|
60
55
|
"@babel/helpers - typeof";
|
|
61
56
|
|
|
62
57
|
if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
|
|
63
|
-
_typeof = function (obj) {
|
|
58
|
+
_typeof$1 = function (obj) {
|
|
64
59
|
return typeof obj;
|
|
65
60
|
};
|
|
66
61
|
} else {
|
|
67
|
-
_typeof = function (obj) {
|
|
62
|
+
_typeof$1 = function (obj) {
|
|
68
63
|
return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
|
|
69
64
|
};
|
|
70
65
|
}
|
|
71
66
|
|
|
72
|
-
return _typeof(obj);
|
|
67
|
+
return _typeof$1(obj);
|
|
73
68
|
}
|
|
74
69
|
/* eslint-disable no-sync, no-restricted-syntax */
|
|
75
70
|
// Todo: Switch to ES6 classes
|
|
@@ -81,7 +76,7 @@ var phases = {
|
|
|
81
76
|
AT_TARGET: 2,
|
|
82
77
|
BUBBLING_PHASE: 3
|
|
83
78
|
};
|
|
84
|
-
var ShimDOMException = typeof DOMException === 'undefined' // Todo: Better polyfill (if even needed here)
|
|
79
|
+
var ShimDOMException$1 = typeof DOMException === 'undefined' // Todo: Better polyfill (if even needed here)
|
|
85
80
|
// eslint-disable-next-line no-shadow
|
|
86
81
|
? function DOMException(msg, name) {
|
|
87
82
|
// No need for `toString` as same as for `Error`
|
|
@@ -465,7 +460,7 @@ Object.assign(EventTarget.prototype, ['Early', '', 'Late', 'Default'].reduce(fun
|
|
|
465
460
|
if (arguments.length < 2) throw new TypeError('2 or more arguments required');
|
|
466
461
|
|
|
467
462
|
if (typeof type !== 'string') {
|
|
468
|
-
throw new ShimDOMException('UNSPECIFIED_EVENT_TYPE_ERR', 'UNSPECIFIED_EVENT_TYPE_ERR');
|
|
463
|
+
throw new ShimDOMException$1('UNSPECIFIED_EVENT_TYPE_ERR', 'UNSPECIFIED_EVENT_TYPE_ERR');
|
|
469
464
|
}
|
|
470
465
|
|
|
471
466
|
try {
|
|
@@ -526,7 +521,7 @@ Object.assign(EventTarget.prototype, {
|
|
|
526
521
|
var _evCfg = evCfg.get(e);
|
|
527
522
|
|
|
528
523
|
if (_evCfg && setTarget && _evCfg._dispatched) {
|
|
529
|
-
throw new ShimDOMException('The object is in an invalid state.', 'InvalidStateError');
|
|
524
|
+
throw new ShimDOMException$1('The object is in an invalid state.', 'InvalidStateError');
|
|
530
525
|
}
|
|
531
526
|
|
|
532
527
|
var eventCopy;
|
|
@@ -768,7 +763,7 @@ Object.assign(EventTarget.prototype, {
|
|
|
768
763
|
var triggerGlobalErrorEvent;
|
|
769
764
|
var useNodeImpl = false;
|
|
770
765
|
|
|
771
|
-
if (typeof window === 'undefined' || typeof ErrorEvent === 'undefined' || window && (typeof window === "undefined" ? "undefined" : _typeof(window)) === 'object' && !window.dispatchEvent) {
|
|
766
|
+
if (typeof window === 'undefined' || typeof ErrorEvent === 'undefined' || window && (typeof window === "undefined" ? "undefined" : _typeof$1(window)) === 'object' && !window.dispatchEvent) {
|
|
772
767
|
useNodeImpl = true;
|
|
773
768
|
|
|
774
769
|
triggerGlobalErrorEvent = function triggerGlobalErrorEvent() {
|
|
@@ -837,7 +832,7 @@ var EventTargetFactory = {
|
|
|
837
832
|
};
|
|
838
833
|
EventTarget.ShimEvent = ShimEvent;
|
|
839
834
|
EventTarget.ShimCustomEvent = ShimCustomEvent;
|
|
840
|
-
EventTarget.ShimDOMException = ShimDOMException;
|
|
835
|
+
EventTarget.ShimDOMException = ShimDOMException$1;
|
|
841
836
|
EventTarget.ShimEventTarget = EventTarget;
|
|
842
837
|
EventTarget.EventTargetFactory = EventTargetFactory;
|
|
843
838
|
/**
|
|
@@ -850,7 +845,7 @@ function setPrototypeOfCustomEvent() {
|
|
|
850
845
|
Object.setPrototypeOf(ShimCustomEvent.prototype, ShimEvent.prototype);
|
|
851
846
|
} // Todo: Move to own library (but allowing WeakMaps to be passed in for sharing here)
|
|
852
847
|
|
|
853
|
-
const map = {};
|
|
848
|
+
const map$1 = {};
|
|
854
849
|
const CFG = {};
|
|
855
850
|
[// Boolean for verbose reporting
|
|
856
851
|
'DEBUG', // Effectively defaults to false (ignored unless `true`)
|
|
@@ -955,7 +950,7 @@ const CFG = {};
|
|
|
955
950
|
|
|
956
951
|
Object.defineProperty(CFG, prop, {
|
|
957
952
|
get() {
|
|
958
|
-
return map[prop];
|
|
953
|
+
return map$1[prop];
|
|
959
954
|
},
|
|
960
955
|
|
|
961
956
|
set(val) {
|
|
@@ -963,13 +958,13 @@ const CFG = {};
|
|
|
963
958
|
validator(val);
|
|
964
959
|
}
|
|
965
960
|
|
|
966
|
-
map[prop] = val;
|
|
961
|
+
map$1[prop] = val;
|
|
967
962
|
}
|
|
968
963
|
|
|
969
964
|
});
|
|
970
965
|
});
|
|
971
966
|
|
|
972
|
-
var regex = /[\xC0-\xC5\xC7-\xCF\xD1-\xD6\xD9-\xDD\xE0-\xE5\xE7-\xEF\xF1-\xF6\xF9-\xFD\xFF-\u010F\u0112-\u0125\u0128-\u0130\u0134-\u0137\u0139-\u013E\u0143-\u0148\u014C-\u0151\u0154-\u0165\u0168-\u017E\u01A0\u01A1\u01AF\u01B0\u01CD-\u01DC\u01DE-\u01E3\u01E6-\u01F0\u01F4\u01F5\u01F8-\u021B\u021E\u021F\u0226-\u0233\u0344\u0385\u0386\u0388-\u038A\u038C\u038E-\u0390\u03AA-\u03B0\u03CA-\u03CE\u03D3\u03D4\u0400\u0401\u0403\u0407\u040C-\u040E\u0419\u0439\u0450\u0451\u0453\u0457\u045C-\u045E\u0476\u0477\u04C1\u04C2\u04D0-\u04D3\u04D6\u04D7\u04DA-\u04DF\u04E2-\u04E7\u04EA-\u04F5\u04F8\u04F9\u0622-\u0626\u06C0\u06C2\u06D3\u0929\u0931\u0934\u0958-\u095F\u09CB\u09CC\u09DC\u09DD\u09DF\u0A33\u0A36\u0A59-\u0A5B\u0A5E\u0B48\u0B4B\u0B4C\u0B5C\u0B5D\u0B94\u0BCA-\u0BCC\u0C48\u0CC0\u0CC7\u0CC8\u0CCA\u0CCB\u0D4A-\u0D4C\u0DDA\u0DDC-\u0DDE\u0F43\u0F4D\u0F52\u0F57\u0F5C\u0F69\u0F73\u0F75\u0F76\u0F78\u0F81\u0F93\u0F9D\u0FA2\u0FA7\u0FAC\u0FB9\u1026\u1B06\u1B08\u1B0A\u1B0C\u1B0E\u1B12\u1B3B\u1B3D\u1B40\u1B41\u1B43\u1E00-\u1E99\u1E9B\u1EA0-\u1EF9\u1F00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FC1-\u1FC4\u1FC6-\u1FD3\u1FD6-\u1FDB\u1FDD-\u1FEE\u1FF2-\u1FF4\u1FF6-\u1FFC\u212B\u219A\u219B\u21AE\u21CD-\u21CF\u2204\u2209\u220C\u2224\u2226\u2241\u2244\u2247\u2249\u2260\u2262\u226D-\u2271\u2274\u2275\u2278\u2279\u2280\u2281\u2284\u2285\u2288\u2289\u22AC-\u22AF\u22E0-\u22E3\u22EA-\u22ED\u2ADC\u304C\u304E\u3050\u3052\u3054\u3056\u3058\u305A\u305C\u305E\u3060\u3062\u3065\u3067\u3069\u3070\u3071\u3073\u3074\u3076\u3077\u3079\u307A\u307C\u307D\u3094\u309E\u30AC\u30AE\u30B0\u30B2\u30B4\u30B6\u30B8\u30BA\u30BC\u30BE\u30C0\u30C2\u30C5\u30C7\u30C9\u30D0\u30D1\u30D3\u30D4\u30D6\u30D7\u30D9\u30DA\u30DC\u30DD\u30F4\u30F7-\u30FA\u30FE\uAC00-\uD7A3\uFB1D\uFB1F\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFB4E]|\uD804[\uDC9A\uDC9C\uDCAB\uDD2E\uDD2F\uDF4B\uDF4C]|\uD805[\uDCBB\uDCBC\uDCBE\uDDBA\uDDBB]|\uD834[\uDD5E-\uDD64\uDDBB-\uDDC0]/;
|
|
967
|
+
var regex = /[\xC0-\xC5\xC7-\xCF\xD1-\xD6\xD9-\xDD\xE0-\xE5\xE7-\xEF\xF1-\xF6\xF9-\xFD\xFF-\u010F\u0112-\u0125\u0128-\u0130\u0134-\u0137\u0139-\u013E\u0143-\u0148\u014C-\u0151\u0154-\u0165\u0168-\u017E\u01A0\u01A1\u01AF\u01B0\u01CD-\u01DC\u01DE-\u01E3\u01E6-\u01F0\u01F4\u01F5\u01F8-\u021B\u021E\u021F\u0226-\u0233\u0344\u0385\u0386\u0388-\u038A\u038C\u038E-\u0390\u03AA-\u03B0\u03CA-\u03CE\u03D3\u03D4\u0400\u0401\u0403\u0407\u040C-\u040E\u0419\u0439\u0450\u0451\u0453\u0457\u045C-\u045E\u0476\u0477\u04C1\u04C2\u04D0-\u04D3\u04D6\u04D7\u04DA-\u04DF\u04E2-\u04E7\u04EA-\u04F5\u04F8\u04F9\u0622-\u0626\u06C0\u06C2\u06D3\u0929\u0931\u0934\u0958-\u095F\u09CB\u09CC\u09DC\u09DD\u09DF\u0A33\u0A36\u0A59-\u0A5B\u0A5E\u0B48\u0B4B\u0B4C\u0B5C\u0B5D\u0B94\u0BCA-\u0BCC\u0C48\u0CC0\u0CC7\u0CC8\u0CCA\u0CCB\u0D4A-\u0D4C\u0DDA\u0DDC-\u0DDE\u0F43\u0F4D\u0F52\u0F57\u0F5C\u0F69\u0F73\u0F75\u0F76\u0F78\u0F81\u0F93\u0F9D\u0FA2\u0FA7\u0FAC\u0FB9\u1026\u1B06\u1B08\u1B0A\u1B0C\u1B0E\u1B12\u1B3B\u1B3D\u1B40\u1B41\u1B43\u1E00-\u1E99\u1E9B\u1EA0-\u1EF9\u1F00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FC1-\u1FC4\u1FC6-\u1FD3\u1FD6-\u1FDB\u1FDD-\u1FEE\u1FF2-\u1FF4\u1FF6-\u1FFC\u212B\u219A\u219B\u21AE\u21CD-\u21CF\u2204\u2209\u220C\u2224\u2226\u2241\u2244\u2247\u2249\u2260\u2262\u226D-\u2271\u2274\u2275\u2278\u2279\u2280\u2281\u2284\u2285\u2288\u2289\u22AC-\u22AF\u22E0-\u22E3\u22EA-\u22ED\u2ADC\u304C\u304E\u3050\u3052\u3054\u3056\u3058\u305A\u305C\u305E\u3060\u3062\u3065\u3067\u3069\u3070\u3071\u3073\u3074\u3076\u3077\u3079\u307A\u307C\u307D\u3094\u309E\u30AC\u30AE\u30B0\u30B2\u30B4\u30B6\u30B8\u30BA\u30BC\u30BE\u30C0\u30C2\u30C5\u30C7\u30C9\u30D0\u30D1\u30D3\u30D4\u30D6\u30D7\u30D9\u30DA\u30DC\u30DD\u30F4\u30F7-\u30FA\u30FE\uAC00-\uD7A3\uFB1D\uFB1F\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFB4E]|\uD804[\uDC9A\uDC9C\uDCAB\uDD2E\uDD2F\uDF4B\uDF4C]|\uD805[\uDCBB\uDCBC\uDCBE\uDDBA\uDDBB]|\uD806\uDD38|\uD834[\uDD5E-\uDD64\uDDBB-\uDDC0]/;
|
|
973
968
|
|
|
974
969
|
function escapeUnmatchedSurrogates(arg) {
|
|
975
970
|
// http://stackoverflow.com/a/6701665/271577
|
|
@@ -977,10 +972,10 @@ function escapeUnmatchedSurrogates(arg) {
|
|
|
977
972
|
// Could add a corresponding surrogate for compatibility with `node-sqlite3`: http://bugs.python.org/issue12569 and http://stackoverflow.com/a/6701665/271577
|
|
978
973
|
// but Chrome having problems
|
|
979
974
|
if (unmatchedHighSurrogate) {
|
|
980
|
-
return '^2' +
|
|
975
|
+
return '^2' + unmatchedHighSurrogate.codePointAt().toString(16).padStart(4, '0');
|
|
981
976
|
}
|
|
982
977
|
|
|
983
|
-
return (precedingLow || '') + '^3' +
|
|
978
|
+
return (precedingLow || '') + '^3' + unmatchedLowSurrogate.codePointAt().toString(16).padStart(4, '0');
|
|
984
979
|
});
|
|
985
980
|
}
|
|
986
981
|
|
|
@@ -1032,18 +1027,16 @@ function escapeDatabaseNameForSQLAndFiles(db) {
|
|
|
1032
1027
|
|
|
1033
1028
|
if (CFG.escapeNFDForDatabaseNames !== false) {
|
|
1034
1029
|
// ES6 copying of regex with different flags
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
// https://github.com/axemclion/IndexedDBShim/issues/311#issuecomment-316090147 )
|
|
1038
|
-
db = db.replace(new RegExp(regex.source, 'gu'), function (expandable) {
|
|
1039
|
-
return '^4' + padStart(expandable.codePointAt().toString(16), 6, '0');
|
|
1030
|
+
db = db.replace(new RegExp(regex, 'gu'), function (expandable) {
|
|
1031
|
+
return '^4' + expandable.codePointAt().toString(16).padStart(6, '0');
|
|
1040
1032
|
});
|
|
1041
1033
|
}
|
|
1042
1034
|
|
|
1043
1035
|
if (CFG.databaseCharacterEscapeList !== false) {
|
|
1044
1036
|
db = db.replace(CFG.databaseCharacterEscapeList ? new RegExp(CFG.databaseCharacterEscapeList, 'gu') : /[\u0000-\u001F\u007F"*/:<>?\\|]/gu, // eslint-disable-line no-control-regex
|
|
1045
1037
|
function (n0) {
|
|
1046
|
-
|
|
1038
|
+
// eslint-disable-next-line unicorn/prefer-code-point -- Switch to `codePointAt`?
|
|
1039
|
+
return '^1' + n0.charCodeAt().toString(16).padStart(2, '0');
|
|
1047
1040
|
});
|
|
1048
1041
|
}
|
|
1049
1042
|
|
|
@@ -1058,9 +1051,9 @@ function escapeDatabaseNameForSQLAndFiles(db) {
|
|
|
1058
1051
|
|
|
1059
1052
|
function unescapeUnmatchedSurrogates(arg) {
|
|
1060
1053
|
return arg.replace(/(\^+)3(d[0-9a-f]{3})/gu, (_, esc, lowSurr) => {
|
|
1061
|
-
return esc.length % 2 ? esc.slice(1) + String.
|
|
1054
|
+
return esc.length % 2 ? esc.slice(1) + String.fromCodePoint(Number.parseInt(lowSurr, 16)) : _;
|
|
1062
1055
|
}).replace(/(\^+)2(d[0-9a-f]{3})/gu, (_, esc, highSurr) => {
|
|
1063
|
-
return esc.length % 2 ? esc.slice(1) + String.
|
|
1056
|
+
return esc.length % 2 ? esc.slice(1) + String.fromCodePoint(Number.parseInt(highSurr, 16)) : _;
|
|
1064
1057
|
});
|
|
1065
1058
|
} // Not in use internally but supplied for convenience
|
|
1066
1059
|
|
|
@@ -1281,13 +1274,8 @@ function isNullish(v) {
|
|
|
1281
1274
|
return v === null || v === undefined;
|
|
1282
1275
|
}
|
|
1283
1276
|
|
|
1284
|
-
function hasOwn(obj, prop) {
|
|
1285
|
-
return
|
|
1286
|
-
} // Todo: Replace with `String.prototype.padStart` when targeting supporting Node version
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
function padStart(str, ct, fill) {
|
|
1290
|
-
return new Array(ct - String(str).length + 1).join(fill) + str;
|
|
1277
|
+
function hasOwn$2(obj, prop) {
|
|
1278
|
+
return Object.prototype.hasOwnProperty.call(obj, prop);
|
|
1291
1279
|
}
|
|
1292
1280
|
|
|
1293
1281
|
/**
|
|
@@ -1309,7 +1297,7 @@ Object.defineProperty(ShimEvent, Symbol.hasInstance, {
|
|
|
1309
1297
|
value: obj => isObj(obj) && 'target' in obj && typeof obj.bubbles === 'boolean'
|
|
1310
1298
|
});
|
|
1311
1299
|
|
|
1312
|
-
const readonlyProperties = ['oldVersion', 'newVersion']; // Babel apparently having a problem adding `hasInstance` to a class, so we are redefining as a function
|
|
1300
|
+
const readonlyProperties$6 = ['oldVersion', 'newVersion']; // Babel apparently having a problem adding `hasInstance` to a class, so we are redefining as a function
|
|
1313
1301
|
|
|
1314
1302
|
function IDBVersionChangeEvent(type
|
|
1315
1303
|
/* , eventInitDict */
|
|
@@ -1328,7 +1316,7 @@ function IDBVersionChangeEvent(type
|
|
|
1328
1316
|
|
|
1329
1317
|
IDBVersionChangeEvent.prototype = Object.create(ShimEvent.prototype);
|
|
1330
1318
|
IDBVersionChangeEvent.prototype[Symbol.toStringTag] = 'IDBVersionChangeEventPrototype';
|
|
1331
|
-
readonlyProperties.forEach(prop => {
|
|
1319
|
+
readonlyProperties$6.forEach(prop => {
|
|
1332
1320
|
// Ensure for proper interface testing that "get <name>" is the function name
|
|
1333
1321
|
const o = {
|
|
1334
1322
|
get [prop]() {
|
|
@@ -1671,10 +1659,10 @@ const createDOMException = useNativeDOMException ? function (name, message, erro
|
|
|
1671
1659
|
logError(name, message, error);
|
|
1672
1660
|
return createNonNativeDOMException(name, message);
|
|
1673
1661
|
};
|
|
1674
|
-
const ShimDOMException
|
|
1662
|
+
const ShimDOMException = useNativeDOMException ? DOMException : ShimNonNativeDOMException;
|
|
1675
1663
|
|
|
1676
|
-
const listeners = ['onsuccess', 'onerror'];
|
|
1677
|
-
const readonlyProperties$
|
|
1664
|
+
const listeners$2 = ['onsuccess', 'onerror'];
|
|
1665
|
+
const readonlyProperties$5 = ['source', 'transaction', 'readyState'];
|
|
1678
1666
|
const doneFlagGetters = ['result', 'error'];
|
|
1679
1667
|
/**
|
|
1680
1668
|
* The IDBRequest Object that is returns for all async calls.
|
|
@@ -1695,7 +1683,7 @@ IDBRequest.__super = function IDBRequest() {
|
|
|
1695
1683
|
|
|
1696
1684
|
});
|
|
1697
1685
|
|
|
1698
|
-
doneFlagGetters.forEach(
|
|
1686
|
+
doneFlagGetters.forEach(prop => {
|
|
1699
1687
|
Object.defineProperty(this, '__' + prop, {
|
|
1700
1688
|
enumerable: false,
|
|
1701
1689
|
configurable: false,
|
|
@@ -1714,8 +1702,8 @@ IDBRequest.__super = function IDBRequest() {
|
|
|
1714
1702
|
}
|
|
1715
1703
|
|
|
1716
1704
|
});
|
|
1717
|
-
}
|
|
1718
|
-
defineReadonlyProperties(this, readonlyProperties$
|
|
1705
|
+
});
|
|
1706
|
+
defineReadonlyProperties(this, readonlyProperties$5, {
|
|
1719
1707
|
readyState: {
|
|
1720
1708
|
get readyState() {
|
|
1721
1709
|
return this.__done ? 'done' : 'pending';
|
|
@@ -1723,7 +1711,7 @@ IDBRequest.__super = function IDBRequest() {
|
|
|
1723
1711
|
|
|
1724
1712
|
}
|
|
1725
1713
|
});
|
|
1726
|
-
defineListenerProperties(this, listeners);
|
|
1714
|
+
defineListenerProperties(this, listeners$2);
|
|
1727
1715
|
this.__result = undefined;
|
|
1728
1716
|
this.__error = this.__source = this.__transaction = null;
|
|
1729
1717
|
this.__done = false;
|
|
@@ -1747,9 +1735,9 @@ IDBRequest.prototype.__getParent = function () {
|
|
|
1747
1735
|
}; // Illegal invocations
|
|
1748
1736
|
|
|
1749
1737
|
|
|
1750
|
-
defineReadonlyOuterInterface(IDBRequest.prototype, readonlyProperties$
|
|
1738
|
+
defineReadonlyOuterInterface(IDBRequest.prototype, readonlyProperties$5);
|
|
1751
1739
|
defineReadonlyOuterInterface(IDBRequest.prototype, doneFlagGetters);
|
|
1752
|
-
defineOuterInterface(IDBRequest.prototype, listeners);
|
|
1740
|
+
defineOuterInterface(IDBRequest.prototype, listeners$2);
|
|
1753
1741
|
Object.defineProperty(IDBRequest.prototype, 'constructor', {
|
|
1754
1742
|
enumerable: false,
|
|
1755
1743
|
writable: true,
|
|
@@ -1805,9 +1793,9 @@ Object.defineProperty(IDBOpenDBRequest, 'prototype', {
|
|
|
1805
1793
|
writable: false
|
|
1806
1794
|
});
|
|
1807
1795
|
|
|
1808
|
-
// Since [immediate](https://github.com/calvinmetcalf/immediate) is
|
|
1809
1796
|
// not doing the trick for our WebSQL transactions (at least in Node),
|
|
1810
1797
|
// we are forced to make the promises run fully synchronously.
|
|
1798
|
+
|
|
1811
1799
|
function isPromise(p) {
|
|
1812
1800
|
return p && typeof p.then === 'function';
|
|
1813
1801
|
}
|
|
@@ -1982,14 +1970,14 @@ var syncPromiseCommonjs = SyncPromise;
|
|
|
1982
1970
|
*/
|
|
1983
1971
|
|
|
1984
1972
|
function cmp(first, second) {
|
|
1985
|
-
const encodedKey1 = encode(first);
|
|
1986
|
-
const encodedKey2 = encode(second);
|
|
1973
|
+
const encodedKey1 = encode$2(first);
|
|
1974
|
+
const encodedKey2 = encode$2(second);
|
|
1987
1975
|
const result = encodedKey1 > encodedKey2 ? 1 : encodedKey1 === encodedKey2 ? 0 : -1;
|
|
1988
1976
|
|
|
1989
1977
|
if (CFG.DEBUG) {
|
|
1990
1978
|
// verify that the keys encoded correctly
|
|
1991
|
-
let decodedKey1 = decode(encodedKey1);
|
|
1992
|
-
let decodedKey2 = decode(encodedKey2);
|
|
1979
|
+
let decodedKey1 = decode$2(encodedKey1);
|
|
1980
|
+
let decodedKey2 = decode$2(encodedKey2);
|
|
1993
1981
|
|
|
1994
1982
|
if (typeof first === 'object') {
|
|
1995
1983
|
first = JSON.stringify(first);
|
|
@@ -2034,7 +2022,7 @@ const keyTypeToEncodedChar = {
|
|
|
2034
2022
|
};
|
|
2035
2023
|
const keyTypes = Object.keys(keyTypeToEncodedChar);
|
|
2036
2024
|
keyTypes.forEach(k => {
|
|
2037
|
-
keyTypeToEncodedChar[k] = String.
|
|
2025
|
+
keyTypeToEncodedChar[k] = String.fromCodePoint(keyTypeToEncodedChar[k]);
|
|
2038
2026
|
});
|
|
2039
2027
|
const encodedCharToKeyType = keyTypes.reduce((o, k) => {
|
|
2040
2028
|
o[keyTypeToEncodedChar[k]] = k;
|
|
@@ -2135,10 +2123,10 @@ const types = {
|
|
|
2135
2123
|
|
|
2136
2124
|
switch (signValues[sign]) {
|
|
2137
2125
|
case 'negativeInfinity':
|
|
2138
|
-
return
|
|
2126
|
+
return Number.NEGATIVE_INFINITY;
|
|
2139
2127
|
|
|
2140
2128
|
case 'positiveInfinity':
|
|
2141
|
-
return
|
|
2129
|
+
return Number.POSITIVE_INFINITY;
|
|
2142
2130
|
|
|
2143
2131
|
case 'bigPositive':
|
|
2144
2132
|
return pow32(mantissa, exponent);
|
|
@@ -2201,7 +2189,7 @@ const types = {
|
|
|
2201
2189
|
const encoded = [];
|
|
2202
2190
|
|
|
2203
2191
|
for (const [i, item] of key.entries()) {
|
|
2204
|
-
const encodedItem = encode(item, true); // encode the array item
|
|
2192
|
+
const encodedItem = encode$2(item, true); // encode the array item
|
|
2205
2193
|
|
|
2206
2194
|
encoded[i] = encodedItem;
|
|
2207
2195
|
}
|
|
@@ -2217,7 +2205,7 @@ const types = {
|
|
|
2217
2205
|
|
|
2218
2206
|
for (let i = 0; i < decoded.length; i++) {
|
|
2219
2207
|
const item = decoded[i];
|
|
2220
|
-
const decodedItem = decode(item, true); // decode the item
|
|
2208
|
+
const decodedItem = decode$2(item, true); // decode the item
|
|
2221
2209
|
|
|
2222
2210
|
decoded[i] = decodedItem;
|
|
2223
2211
|
}
|
|
@@ -2240,7 +2228,7 @@ const types = {
|
|
|
2240
2228
|
binary: {
|
|
2241
2229
|
// `ArrayBuffer`/Views on buffers (`TypedArray` or `DataView`)
|
|
2242
2230
|
encode(key) {
|
|
2243
|
-
return keyTypeToEncodedChar.binary + '-' + (key.byteLength ? [...getCopyBytesHeldByBufferSource(key)].map(b => padStart(
|
|
2231
|
+
return keyTypeToEncodedChar.binary + '-' + (key.byteLength ? [...getCopyBytesHeldByBufferSource(key)].map(b => String(b).padStart(3, '0')) // e.g., '255,005,254,000,001,033'
|
|
2244
2232
|
: '');
|
|
2245
2233
|
},
|
|
2246
2234
|
|
|
@@ -2326,13 +2314,12 @@ function pow32(mantissa, exponent) {
|
|
|
2326
2314
|
}
|
|
2327
2315
|
/**
|
|
2328
2316
|
* @param {Float} num
|
|
2329
|
-
* @param {Float} precision
|
|
2317
|
+
* @param {Float} [precision=16]
|
|
2330
2318
|
* @returns {Float}
|
|
2331
2319
|
*/
|
|
2332
2320
|
|
|
2333
2321
|
|
|
2334
|
-
function roundToPrecision(num, precision) {
|
|
2335
|
-
precision = precision || 16;
|
|
2322
|
+
function roundToPrecision(num, precision = 16) {
|
|
2336
2323
|
return Number.parseFloat(num.toPrecision(precision));
|
|
2337
2324
|
}
|
|
2338
2325
|
/**
|
|
@@ -2811,9 +2798,9 @@ function checkKeyCouldBeInjectedIntoValue(value, keyPath) {
|
|
|
2811
2798
|
function isKeyInRange(key, range, checkCached) {
|
|
2812
2799
|
let lowerMatch = range.lower === undefined;
|
|
2813
2800
|
let upperMatch = range.upper === undefined;
|
|
2814
|
-
const encodedKey = encode(key, true);
|
|
2815
|
-
const lower = checkCached ? range.__lowerCached : encode(range.lower, true);
|
|
2816
|
-
const upper = checkCached ? range.__upperCached : encode(range.upper, true);
|
|
2801
|
+
const encodedKey = encode$2(key, true);
|
|
2802
|
+
const lower = checkCached ? range.__lowerCached : encode$2(range.lower, true);
|
|
2803
|
+
const upper = checkCached ? range.__upperCached : encode$2(range.upper, true);
|
|
2817
2804
|
|
|
2818
2805
|
if (range.lower !== undefined) {
|
|
2819
2806
|
if (range.lowerOpen && encodedKey > lower) {
|
|
@@ -2963,7 +2950,7 @@ function convertKeyToValue(key) {
|
|
|
2963
2950
|
*/
|
|
2964
2951
|
|
|
2965
2952
|
|
|
2966
|
-
function encode(key, inArray) {
|
|
2953
|
+
function encode$2(key, inArray) {
|
|
2967
2954
|
// Bad keys like `null`, `object`, `boolean`, 'function', 'symbol' should not be passed here due to prior validation
|
|
2968
2955
|
if (key === undefined) {
|
|
2969
2956
|
return null;
|
|
@@ -2981,7 +2968,7 @@ function encode(key, inArray) {
|
|
|
2981
2968
|
*/
|
|
2982
2969
|
|
|
2983
2970
|
|
|
2984
|
-
function decode(key, inArray) {
|
|
2971
|
+
function decode$2(key, inArray) {
|
|
2985
2972
|
if (typeof key !== 'string') {
|
|
2986
2973
|
return undefined;
|
|
2987
2974
|
}
|
|
@@ -2997,7 +2984,7 @@ function decode(key, inArray) {
|
|
|
2997
2984
|
|
|
2998
2985
|
|
|
2999
2986
|
function roundTrip(key, inArray) {
|
|
3000
|
-
return decode(encode(key, inArray), inArray);
|
|
2987
|
+
return decode$2(encode$2(key, inArray), inArray);
|
|
3001
2988
|
}
|
|
3002
2989
|
|
|
3003
2990
|
const MAX_ALLOWED_CURRENT_NUMBER = 9007199254740992; // 2 ^ 53 (Also equal to `Number.MAX_SAFE_INTEGER + 1`)
|
|
@@ -3104,7 +3091,7 @@ function generateKeyForStore(tx, store, cb, sqlFailCb) {
|
|
|
3104
3091
|
getCurrentNumber(tx, store, function (key) {
|
|
3105
3092
|
if (key > MAX_ALLOWED_CURRENT_NUMBER) {
|
|
3106
3093
|
// 2 ^ 53 (See <https://github.com/w3c/IndexedDB/issues/147>)
|
|
3107
|
-
cb('failure'); // eslint-disable-line
|
|
3094
|
+
cb('failure'); // eslint-disable-line node/no-callback-literal
|
|
3108
3095
|
|
|
3109
3096
|
return;
|
|
3110
3097
|
} // Increment current number by 1 (we cannot leverage SQLite's
|
|
@@ -3163,8 +3150,8 @@ function possiblyUpdateKeyGenerator(tx, store, key, successCb, sqlFailCb) {
|
|
|
3163
3150
|
|
|
3164
3151
|
var Key = /*#__PURE__*/Object.freeze({
|
|
3165
3152
|
__proto__: null,
|
|
3166
|
-
encode: encode,
|
|
3167
|
-
decode: decode,
|
|
3153
|
+
encode: encode$2,
|
|
3154
|
+
decode: decode$2,
|
|
3168
3155
|
roundTrip: roundTrip,
|
|
3169
3156
|
convertKeyToValue: convertKeyToValue,
|
|
3170
3157
|
convertValueToKeyValueDecoded: convertValueToKeyValueDecoded,
|
|
@@ -3185,7 +3172,7 @@ var Key = /*#__PURE__*/Object.freeze({
|
|
|
3185
3172
|
possiblyUpdateKeyGenerator: possiblyUpdateKeyGenerator
|
|
3186
3173
|
});
|
|
3187
3174
|
|
|
3188
|
-
const readonlyProperties$
|
|
3175
|
+
const readonlyProperties$4 = ['lower', 'upper', 'lowerOpen', 'upperOpen'];
|
|
3189
3176
|
/* eslint-disable jsdoc/check-param-names */
|
|
3190
3177
|
|
|
3191
3178
|
/**
|
|
@@ -3229,7 +3216,7 @@ IDBKeyRange.__createInstance = function (lower, upper, lowerOpen, upperOpen) {
|
|
|
3229
3216
|
}
|
|
3230
3217
|
|
|
3231
3218
|
if (lower !== undefined && upper !== undefined && lower !== upper) {
|
|
3232
|
-
if (encode(lower) > encode(upper)) {
|
|
3219
|
+
if (encode$2(lower) > encode$2(upper)) {
|
|
3233
3220
|
throw createDOMException('DataError', '`lower` must not be greater than `upper` argument in `bound()` call.');
|
|
3234
3221
|
}
|
|
3235
3222
|
}
|
|
@@ -3300,7 +3287,7 @@ IDBKeyRange.bound = function (lower, upper
|
|
|
3300
3287
|
};
|
|
3301
3288
|
|
|
3302
3289
|
IDBKeyRange.prototype[Symbol.toStringTag] = 'IDBKeyRangePrototype';
|
|
3303
|
-
readonlyProperties$
|
|
3290
|
+
readonlyProperties$4.forEach(prop => {
|
|
3304
3291
|
Object.defineProperty(IDBKeyRange.prototype, '__' + prop, {
|
|
3305
3292
|
enumerable: false,
|
|
3306
3293
|
configurable: false,
|
|
@@ -3338,11 +3325,11 @@ function setSQLForKeyRange(range, quotedKeyColumnName, sql, sqlValues, addAnd, c
|
|
|
3338
3325
|
const hasUpper = range.upper !== undefined;
|
|
3339
3326
|
|
|
3340
3327
|
if (hasLower) {
|
|
3341
|
-
encodedLowerKey = checkCached ? range.__lowerCached : encode(range.lower);
|
|
3328
|
+
encodedLowerKey = checkCached ? range.__lowerCached : encode$2(range.lower);
|
|
3342
3329
|
}
|
|
3343
3330
|
|
|
3344
3331
|
if (hasUpper) {
|
|
3345
|
-
encodedUpperKey = checkCached ? range.__upperCached : encode(range.upper);
|
|
3332
|
+
encodedUpperKey = checkCached ? range.__upperCached : encode$2(range.upper);
|
|
3346
3333
|
}
|
|
3347
3334
|
|
|
3348
3335
|
if (hasLower) {
|
|
@@ -3465,12 +3452,12 @@ DOMStringList.prototype = {
|
|
|
3465
3452
|
},
|
|
3466
3453
|
|
|
3467
3454
|
forEach(cb, thisArg) {
|
|
3468
|
-
// eslint-disable-next-line unicorn/no-
|
|
3455
|
+
// eslint-disable-next-line unicorn/no-array-callback-reference, unicorn/no-array-method-this-argument
|
|
3469
3456
|
this._items.forEach(cb, thisArg);
|
|
3470
3457
|
},
|
|
3471
3458
|
|
|
3472
3459
|
map(cb, thisArg) {
|
|
3473
|
-
// eslint-disable-next-line unicorn/no-
|
|
3460
|
+
// eslint-disable-next-line unicorn/no-array-callback-reference, unicorn/no-array-method-this-argument
|
|
3474
3461
|
return this._items.map(cb, thisArg);
|
|
3475
3462
|
},
|
|
3476
3463
|
|
|
@@ -3519,7 +3506,7 @@ DOMStringList.prototype = {
|
|
|
3519
3506
|
};
|
|
3520
3507
|
Object.defineProperty(DOMStringList, Symbol.hasInstance, {
|
|
3521
3508
|
value(obj) {
|
|
3522
|
-
return
|
|
3509
|
+
return Object.prototype.toString.call(obj) === 'DOMStringListPrototype';
|
|
3523
3510
|
}
|
|
3524
3511
|
|
|
3525
3512
|
});
|
|
@@ -4021,8 +4008,8 @@ IDBTransaction.prototype.__abortTransaction = function (err) {
|
|
|
4021
4008
|
// Store was already created so we restore to name before the rename
|
|
4022
4009
|
if ('__pendingName' in store && me.db.__oldObjectStoreNames.indexOf(store.__pendingName) > -1 // eslint-disable-line unicorn/prefer-includes
|
|
4023
4010
|
) {
|
|
4024
|
-
|
|
4025
|
-
|
|
4011
|
+
store.__name = store.__originalName;
|
|
4012
|
+
}
|
|
4026
4013
|
|
|
4027
4014
|
store.__indexNames = store.__oldIndexNames;
|
|
4028
4015
|
delete store.__pendingDelete;
|
|
@@ -4030,8 +4017,8 @@ IDBTransaction.prototype.__abortTransaction = function (err) {
|
|
|
4030
4017
|
// Index was already created so we restore to name before the rename
|
|
4031
4018
|
if ('__pendingName' in index && store.__oldIndexNames.indexOf(index.__pendingName) > -1 // eslint-disable-line unicorn/prefer-includes
|
|
4032
4019
|
) {
|
|
4033
|
-
|
|
4034
|
-
|
|
4020
|
+
index.__name = index.__originalName;
|
|
4021
|
+
}
|
|
4035
4022
|
|
|
4036
4023
|
delete index.__pendingDelete;
|
|
4037
4024
|
});
|
|
@@ -4211,54 +4198,20 @@ Object.defineProperty(IDBTransaction, 'prototype', {
|
|
|
4211
4198
|
writable: false
|
|
4212
4199
|
});
|
|
4213
4200
|
|
|
4214
|
-
function _typeof
|
|
4201
|
+
function _typeof(obj) {
|
|
4202
|
+
"@babel/helpers - typeof";
|
|
4203
|
+
|
|
4215
4204
|
if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
|
|
4216
|
-
_typeof
|
|
4205
|
+
_typeof = function (obj) {
|
|
4217
4206
|
return typeof obj;
|
|
4218
4207
|
};
|
|
4219
4208
|
} else {
|
|
4220
|
-
_typeof
|
|
4209
|
+
_typeof = function (obj) {
|
|
4221
4210
|
return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
|
|
4222
4211
|
};
|
|
4223
4212
|
}
|
|
4224
4213
|
|
|
4225
|
-
return _typeof
|
|
4226
|
-
}
|
|
4227
|
-
|
|
4228
|
-
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
4229
|
-
try {
|
|
4230
|
-
var info = gen[key](arg);
|
|
4231
|
-
var value = info.value;
|
|
4232
|
-
} catch (error) {
|
|
4233
|
-
reject(error);
|
|
4234
|
-
return;
|
|
4235
|
-
}
|
|
4236
|
-
|
|
4237
|
-
if (info.done) {
|
|
4238
|
-
resolve(value);
|
|
4239
|
-
} else {
|
|
4240
|
-
Promise.resolve(value).then(_next, _throw);
|
|
4241
|
-
}
|
|
4242
|
-
}
|
|
4243
|
-
|
|
4244
|
-
function _asyncToGenerator(fn) {
|
|
4245
|
-
return function () {
|
|
4246
|
-
var self = this,
|
|
4247
|
-
args = arguments;
|
|
4248
|
-
return new Promise(function (resolve, reject) {
|
|
4249
|
-
var gen = fn.apply(self, args);
|
|
4250
|
-
|
|
4251
|
-
function _next(value) {
|
|
4252
|
-
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
|
|
4253
|
-
}
|
|
4254
|
-
|
|
4255
|
-
function _throw(err) {
|
|
4256
|
-
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
|
|
4257
|
-
}
|
|
4258
|
-
|
|
4259
|
-
_next(undefined);
|
|
4260
|
-
});
|
|
4261
|
-
};
|
|
4214
|
+
return _typeof(obj);
|
|
4262
4215
|
}
|
|
4263
4216
|
|
|
4264
4217
|
function _classCallCheck(instance, Constructor) {
|
|
@@ -4283,7 +4236,7 @@ function _createClass(Constructor, protoProps, staticProps) {
|
|
|
4283
4236
|
return Constructor;
|
|
4284
4237
|
}
|
|
4285
4238
|
|
|
4286
|
-
function _defineProperty
|
|
4239
|
+
function _defineProperty(obj, key, value) {
|
|
4287
4240
|
if (key in obj) {
|
|
4288
4241
|
Object.defineProperty(obj, key, {
|
|
4289
4242
|
value: value,
|
|
@@ -4298,7 +4251,7 @@ function _defineProperty$1(obj, key, value) {
|
|
|
4298
4251
|
return obj;
|
|
4299
4252
|
}
|
|
4300
4253
|
|
|
4301
|
-
function ownKeys
|
|
4254
|
+
function ownKeys(object, enumerableOnly) {
|
|
4302
4255
|
var keys = Object.keys(object);
|
|
4303
4256
|
|
|
4304
4257
|
if (Object.getOwnPropertySymbols) {
|
|
@@ -4312,18 +4265,18 @@ function ownKeys$1(object, enumerableOnly) {
|
|
|
4312
4265
|
return keys;
|
|
4313
4266
|
}
|
|
4314
4267
|
|
|
4315
|
-
function _objectSpread2
|
|
4268
|
+
function _objectSpread2(target) {
|
|
4316
4269
|
for (var i = 1; i < arguments.length; i++) {
|
|
4317
4270
|
var source = arguments[i] != null ? arguments[i] : {};
|
|
4318
4271
|
|
|
4319
4272
|
if (i % 2) {
|
|
4320
|
-
ownKeys
|
|
4321
|
-
_defineProperty
|
|
4273
|
+
ownKeys(Object(source), true).forEach(function (key) {
|
|
4274
|
+
_defineProperty(target, key, source[key]);
|
|
4322
4275
|
});
|
|
4323
4276
|
} else if (Object.getOwnPropertyDescriptors) {
|
|
4324
4277
|
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
|
4325
4278
|
} else {
|
|
4326
|
-
ownKeys
|
|
4279
|
+
ownKeys(Object(source)).forEach(function (key) {
|
|
4327
4280
|
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
4328
4281
|
});
|
|
4329
4282
|
}
|
|
@@ -4333,19 +4286,15 @@ function _objectSpread2$1(target) {
|
|
|
4333
4286
|
}
|
|
4334
4287
|
|
|
4335
4288
|
function _slicedToArray(arr, i) {
|
|
4336
|
-
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest();
|
|
4289
|
+
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
|
|
4337
4290
|
}
|
|
4338
4291
|
|
|
4339
4292
|
function _toConsumableArray(arr) {
|
|
4340
|
-
return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread();
|
|
4293
|
+
return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
|
|
4341
4294
|
}
|
|
4342
4295
|
|
|
4343
4296
|
function _arrayWithoutHoles(arr) {
|
|
4344
|
-
if (Array.isArray(arr))
|
|
4345
|
-
for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) arr2[i] = arr[i];
|
|
4346
|
-
|
|
4347
|
-
return arr2;
|
|
4348
|
-
}
|
|
4297
|
+
if (Array.isArray(arr)) return _arrayLikeToArray(arr);
|
|
4349
4298
|
}
|
|
4350
4299
|
|
|
4351
4300
|
function _arrayWithHoles(arr) {
|
|
@@ -4353,14 +4302,11 @@ function _arrayWithHoles(arr) {
|
|
|
4353
4302
|
}
|
|
4354
4303
|
|
|
4355
4304
|
function _iterableToArray(iter) {
|
|
4356
|
-
if (Symbol.iterator in Object(iter)
|
|
4305
|
+
if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter);
|
|
4357
4306
|
}
|
|
4358
4307
|
|
|
4359
4308
|
function _iterableToArrayLimit(arr, i) {
|
|
4360
|
-
if (!(Symbol.iterator in Object(arr)
|
|
4361
|
-
return;
|
|
4362
|
-
}
|
|
4363
|
-
|
|
4309
|
+
if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return;
|
|
4364
4310
|
var _arr = [];
|
|
4365
4311
|
var _n = true;
|
|
4366
4312
|
var _d = false;
|
|
@@ -4386,30 +4332,82 @@ function _iterableToArrayLimit(arr, i) {
|
|
|
4386
4332
|
return _arr;
|
|
4387
4333
|
}
|
|
4388
4334
|
|
|
4335
|
+
function _unsupportedIterableToArray(o, minLen) {
|
|
4336
|
+
if (!o) return;
|
|
4337
|
+
if (typeof o === "string") return _arrayLikeToArray(o, minLen);
|
|
4338
|
+
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
4339
|
+
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
4340
|
+
if (n === "Map" || n === "Set") return Array.from(o);
|
|
4341
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
|
|
4342
|
+
}
|
|
4343
|
+
|
|
4344
|
+
function _arrayLikeToArray(arr, len) {
|
|
4345
|
+
if (len == null || len > arr.length) len = arr.length;
|
|
4346
|
+
|
|
4347
|
+
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
|
4348
|
+
|
|
4349
|
+
return arr2;
|
|
4350
|
+
}
|
|
4351
|
+
|
|
4389
4352
|
function _nonIterableSpread() {
|
|
4390
|
-
throw new TypeError("Invalid attempt to spread non-iterable instance");
|
|
4353
|
+
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
4391
4354
|
}
|
|
4392
4355
|
|
|
4393
4356
|
function _nonIterableRest() {
|
|
4394
|
-
throw new TypeError("Invalid attempt to destructure non-iterable instance");
|
|
4357
|
+
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
4395
4358
|
}
|
|
4359
|
+
/**
|
|
4360
|
+
* @callback TypesonFulfilled
|
|
4361
|
+
* @returns {Promise<any>|any}
|
|
4362
|
+
*/
|
|
4363
|
+
|
|
4364
|
+
/**
|
|
4365
|
+
* @callback TypesonRejected
|
|
4366
|
+
* @returns {Promise<any>|any}
|
|
4367
|
+
*/
|
|
4368
|
+
|
|
4369
|
+
/**
|
|
4370
|
+
* @callback TypesonResolve
|
|
4371
|
+
* @param {any} value
|
|
4372
|
+
* @returns {Promise<any>}
|
|
4373
|
+
*/
|
|
4374
|
+
|
|
4375
|
+
/**
|
|
4376
|
+
* @callback TypesonReject
|
|
4377
|
+
* @param {Error|any} error
|
|
4378
|
+
* @returns {Promise<any>}
|
|
4379
|
+
*/
|
|
4380
|
+
|
|
4381
|
+
/**
|
|
4382
|
+
* @callback TypesonResolveReject
|
|
4383
|
+
* @param {TypesonResolve} typesonResolve
|
|
4384
|
+
* @param {TypesonReject} typesonReject
|
|
4385
|
+
* @returns {Promise<any>}
|
|
4386
|
+
*/
|
|
4387
|
+
|
|
4388
|
+
/* eslint-disable block-spacing, space-before-function-paren,
|
|
4389
|
+
space-before-blocks, space-infix-ops, semi, promise/avoid-new,
|
|
4390
|
+
jsdoc/require-jsdoc */
|
|
4391
|
+
|
|
4396
4392
|
/**
|
|
4397
4393
|
* We keep this function minimized so if using two instances of this
|
|
4398
4394
|
* library, where one is minimized and one is not, it will still work
|
|
4399
4395
|
* with `hasConstructorOf`.
|
|
4400
4396
|
* With ES6 classes, we may be able to simply use `class TypesonPromise
|
|
4401
4397
|
* extends Promise` and add a string tag for detection.
|
|
4402
|
-
* @param {
|
|
4398
|
+
* @param {TypesonResolveReject} f
|
|
4403
4399
|
*/
|
|
4404
|
-
// eslint-disable-next-line max-len
|
|
4405
|
-
// eslint-disable-next-line block-spacing, space-before-function-paren, space-before-blocks, space-infix-ops, semi, promise/avoid-new
|
|
4406
4400
|
|
|
4407
4401
|
|
|
4408
4402
|
var TypesonPromise = function TypesonPromise(f) {
|
|
4409
4403
|
_classCallCheck(this, TypesonPromise);
|
|
4410
4404
|
|
|
4411
4405
|
this.p = new Promise(f);
|
|
4412
|
-
};
|
|
4406
|
+
};
|
|
4407
|
+
/* eslint-enable block-spacing, space-before-function-paren,
|
|
4408
|
+
space-before-blocks, space-infix-ops, semi, promise/avoid-new,
|
|
4409
|
+
jsdoc/require-jsdoc */
|
|
4410
|
+
// eslint-disable-next-line max-len
|
|
4413
4411
|
// class TypesonPromise extends Promise {get[Symbol.toStringTag](){return 'TypesonPromise'};} // eslint-disable-line keyword-spacing, space-before-function-paren, space-before-blocks, block-spacing, semi
|
|
4414
4412
|
|
|
4415
4413
|
|
|
@@ -4423,8 +4421,8 @@ if (typeof Symbol !== 'undefined') {
|
|
|
4423
4421
|
}
|
|
4424
4422
|
/**
|
|
4425
4423
|
*
|
|
4426
|
-
* @param {
|
|
4427
|
-
* @param {
|
|
4424
|
+
* @param {TypesonFulfilled} [onFulfilled]
|
|
4425
|
+
* @param {TypesonRejected} [onRejected]
|
|
4428
4426
|
* @returns {TypesonPromise}
|
|
4429
4427
|
*/
|
|
4430
4428
|
|
|
@@ -4444,7 +4442,7 @@ TypesonPromise.prototype.then = function (onFulfilled, onRejected) {
|
|
|
4444
4442
|
};
|
|
4445
4443
|
/**
|
|
4446
4444
|
*
|
|
4447
|
-
* @param {
|
|
4445
|
+
* @param {TypesonRejected} onRejected
|
|
4448
4446
|
* @returns {TypesonPromise}
|
|
4449
4447
|
*/
|
|
4450
4448
|
|
|
@@ -4454,7 +4452,7 @@ TypesonPromise.prototype["catch"] = function (onRejected) {
|
|
|
4454
4452
|
};
|
|
4455
4453
|
/**
|
|
4456
4454
|
*
|
|
4457
|
-
* @param {
|
|
4455
|
+
* @param {any} v
|
|
4458
4456
|
* @returns {TypesonPromise}
|
|
4459
4457
|
*/
|
|
4460
4458
|
|
|
@@ -4466,7 +4464,7 @@ TypesonPromise.resolve = function (v) {
|
|
|
4466
4464
|
};
|
|
4467
4465
|
/**
|
|
4468
4466
|
*
|
|
4469
|
-
* @param {
|
|
4467
|
+
* @param {any} v
|
|
4470
4468
|
* @returns {TypesonPromise}
|
|
4471
4469
|
*/
|
|
4472
4470
|
|
|
@@ -4477,10 +4475,10 @@ TypesonPromise.reject = function (v) {
|
|
|
4477
4475
|
});
|
|
4478
4476
|
};
|
|
4479
4477
|
|
|
4480
|
-
['all', 'race'].forEach(function (meth) {
|
|
4478
|
+
['all', 'race', 'allSettled'].forEach(function (meth) {
|
|
4481
4479
|
/**
|
|
4482
4480
|
*
|
|
4483
|
-
* @param {Promise[]} promArr
|
|
4481
|
+
* @param {Promise<any>[]} promArr
|
|
4484
4482
|
* @returns {TypesonPromise}
|
|
4485
4483
|
*/
|
|
4486
4484
|
TypesonPromise[meth] = function (promArr) {
|
|
@@ -4499,7 +4497,7 @@ var _ref = {},
|
|
|
4499
4497
|
fnToString = hasOwn$1.toString;
|
|
4500
4498
|
/**
|
|
4501
4499
|
* Second argument not in use internally, but provided for utility.
|
|
4502
|
-
* @param {
|
|
4500
|
+
* @param {any} v
|
|
4503
4501
|
* @param {boolean} catchCheck
|
|
4504
4502
|
* @returns {boolean}
|
|
4505
4503
|
*/
|
|
@@ -4509,7 +4507,7 @@ function isThenable(v, catchCheck) {
|
|
|
4509
4507
|
}
|
|
4510
4508
|
/**
|
|
4511
4509
|
*
|
|
4512
|
-
* @param {
|
|
4510
|
+
* @param {any} val
|
|
4513
4511
|
* @returns {string}
|
|
4514
4512
|
*/
|
|
4515
4513
|
|
|
@@ -4520,14 +4518,14 @@ function toStringTag(val) {
|
|
|
4520
4518
|
/**
|
|
4521
4519
|
* This function is dependent on both constructors
|
|
4522
4520
|
* being identical so any minimization is expected of both.
|
|
4523
|
-
* @param {
|
|
4524
|
-
* @param {
|
|
4521
|
+
* @param {any} a
|
|
4522
|
+
* @param {GenericFunction} b
|
|
4525
4523
|
* @returns {boolean}
|
|
4526
4524
|
*/
|
|
4527
4525
|
|
|
4528
4526
|
|
|
4529
4527
|
function hasConstructorOf(a, b) {
|
|
4530
|
-
if (!a || _typeof
|
|
4528
|
+
if (!a || _typeof(a) !== 'object') {
|
|
4531
4529
|
return false;
|
|
4532
4530
|
}
|
|
4533
4531
|
|
|
@@ -4559,7 +4557,7 @@ function hasConstructorOf(a, b) {
|
|
|
4559
4557
|
}
|
|
4560
4558
|
/**
|
|
4561
4559
|
*
|
|
4562
|
-
* @param {
|
|
4560
|
+
* @param {any} val
|
|
4563
4561
|
* @returns {boolean}
|
|
4564
4562
|
*/
|
|
4565
4563
|
|
|
@@ -4581,7 +4579,7 @@ function isPlainObject(val) {
|
|
|
4581
4579
|
}
|
|
4582
4580
|
/**
|
|
4583
4581
|
*
|
|
4584
|
-
* @param {
|
|
4582
|
+
* @param {any} val
|
|
4585
4583
|
* @returns {boolean}
|
|
4586
4584
|
*/
|
|
4587
4585
|
|
|
@@ -4602,13 +4600,13 @@ function isUserObject(val) {
|
|
|
4602
4600
|
}
|
|
4603
4601
|
/**
|
|
4604
4602
|
*
|
|
4605
|
-
* @param {
|
|
4603
|
+
* @param {any} v
|
|
4606
4604
|
* @returns {boolean}
|
|
4607
4605
|
*/
|
|
4608
4606
|
|
|
4609
4607
|
|
|
4610
4608
|
function isObject(v) {
|
|
4611
|
-
return v && _typeof
|
|
4609
|
+
return v && _typeof(v) === 'object';
|
|
4612
4610
|
}
|
|
4613
4611
|
/**
|
|
4614
4612
|
*
|
|
@@ -4633,7 +4631,7 @@ function unescapeKeyPathComponent(keyPathComponent) {
|
|
|
4633
4631
|
/**
|
|
4634
4632
|
* @param {PlainObject|GenericArray} obj
|
|
4635
4633
|
* @param {string} keyPath
|
|
4636
|
-
* @returns {
|
|
4634
|
+
* @returns {any}
|
|
4637
4635
|
*/
|
|
4638
4636
|
|
|
4639
4637
|
|
|
@@ -4655,8 +4653,8 @@ function getByKeyPath(obj, keyPath) {
|
|
|
4655
4653
|
*
|
|
4656
4654
|
* @param {PlainObject} obj
|
|
4657
4655
|
* @param {string} keyPath
|
|
4658
|
-
* @param {
|
|
4659
|
-
* @returns {
|
|
4656
|
+
* @param {any} value
|
|
4657
|
+
* @returns {any}
|
|
4660
4658
|
*/
|
|
4661
4659
|
|
|
4662
4660
|
|
|
@@ -4684,12 +4682,24 @@ function setAtKeyPath(obj, keyPath, value) {
|
|
|
4684
4682
|
|
|
4685
4683
|
|
|
4686
4684
|
function getJSONType(value) {
|
|
4687
|
-
return value === null ? 'null' : Array.isArray(value) ? 'array' : _typeof
|
|
4685
|
+
return value === null ? 'null' : Array.isArray(value) ? 'array' : _typeof(value);
|
|
4686
|
+
}
|
|
4687
|
+
|
|
4688
|
+
function _await(value, then, direct) {
|
|
4689
|
+
if (direct) {
|
|
4690
|
+
return then ? then(value) : value;
|
|
4691
|
+
}
|
|
4692
|
+
|
|
4693
|
+
if (!value || !value.then) {
|
|
4694
|
+
value = Promise.resolve(value);
|
|
4695
|
+
}
|
|
4696
|
+
|
|
4697
|
+
return then ? value.then(then) : value;
|
|
4688
4698
|
}
|
|
4689
4699
|
|
|
4690
4700
|
var keys = Object.keys,
|
|
4691
4701
|
isArray = Array.isArray,
|
|
4692
|
-
hasOwn
|
|
4702
|
+
hasOwn = {}.hasOwnProperty,
|
|
4693
4703
|
internalStateObjPropsToIgnore = ['type', 'replaced', 'iterateIn', 'iterateUnsetNumeric'];
|
|
4694
4704
|
/**
|
|
4695
4705
|
* Handle plain object revivers first so reference setting can use
|
|
@@ -4700,6 +4710,66 @@ var keys = Object.keys,
|
|
|
4700
4710
|
* @returns {1|-1|boolean}
|
|
4701
4711
|
*/
|
|
4702
4712
|
|
|
4713
|
+
function _async(f) {
|
|
4714
|
+
return function () {
|
|
4715
|
+
for (var args = [], i = 0; i < arguments.length; i++) {
|
|
4716
|
+
args[i] = arguments[i];
|
|
4717
|
+
}
|
|
4718
|
+
|
|
4719
|
+
try {
|
|
4720
|
+
return Promise.resolve(f.apply(this, args));
|
|
4721
|
+
} catch (e) {
|
|
4722
|
+
return Promise.reject(e);
|
|
4723
|
+
}
|
|
4724
|
+
};
|
|
4725
|
+
}
|
|
4726
|
+
/**
|
|
4727
|
+
* @callback Tester
|
|
4728
|
+
* @param {any} value
|
|
4729
|
+
* @param {StateObject} stateobj
|
|
4730
|
+
* @returns {boolean}
|
|
4731
|
+
*/
|
|
4732
|
+
|
|
4733
|
+
/**
|
|
4734
|
+
* @callback Replacer
|
|
4735
|
+
* @param {any} value
|
|
4736
|
+
* @param {StateObject} stateObj
|
|
4737
|
+
* @returns {any} Should be JSON-stringifiable
|
|
4738
|
+
*/
|
|
4739
|
+
|
|
4740
|
+
/**
|
|
4741
|
+
* @callback Reviver
|
|
4742
|
+
* @param {JSON} value
|
|
4743
|
+
* @param {StateObject} stateObj
|
|
4744
|
+
* @returns {any}
|
|
4745
|
+
*/
|
|
4746
|
+
|
|
4747
|
+
/**
|
|
4748
|
+
* @typedef {PlainObject} TypesonOptions
|
|
4749
|
+
* @property {boolean} stringification Auto-set by `stringify`
|
|
4750
|
+
*/
|
|
4751
|
+
|
|
4752
|
+
/**
|
|
4753
|
+
* An instance of this class can be used to call `stringify()` and `parse()`.
|
|
4754
|
+
* Typeson resolves cyclic references by default. Can also be extended to
|
|
4755
|
+
* support custom types using the register() method.
|
|
4756
|
+
*
|
|
4757
|
+
* @class
|
|
4758
|
+
* @param {{cyclic: boolean}} [options] - if cyclic (default true),
|
|
4759
|
+
* cyclic references will be handled gracefully.
|
|
4760
|
+
*/
|
|
4761
|
+
|
|
4762
|
+
|
|
4763
|
+
function _invoke(body, then) {
|
|
4764
|
+
var result = body();
|
|
4765
|
+
|
|
4766
|
+
if (result && result.then) {
|
|
4767
|
+
return result.then(then);
|
|
4768
|
+
}
|
|
4769
|
+
|
|
4770
|
+
return then(result);
|
|
4771
|
+
}
|
|
4772
|
+
|
|
4703
4773
|
function nestedPathsFirst(a, b) {
|
|
4704
4774
|
if (a.keypath === '') {
|
|
4705
4775
|
return -1;
|
|
@@ -4718,18 +4788,11 @@ function nestedPathsFirst(a, b) {
|
|
|
4718
4788
|
|
|
4719
4789
|
return as > bs ? -1 : as < bs ? 1 : a.keypath < b.keypath ? -1 : a.keypath > b.keypath;
|
|
4720
4790
|
}
|
|
4721
|
-
/**
|
|
4722
|
-
* An instance of this class can be used to call `stringify()` and `parse()`.
|
|
4723
|
-
* Typeson resolves cyclic references by default. Can also be extended to
|
|
4724
|
-
* support custom types using the register() method.
|
|
4725
|
-
*
|
|
4726
|
-
* @class
|
|
4727
|
-
* @param {{cyclic: boolean}} [options] - if cyclic (default true),
|
|
4728
|
-
* cyclic references will be handled gracefully.
|
|
4729
|
-
*/
|
|
4730
|
-
|
|
4731
4791
|
|
|
4732
4792
|
var Typeson = /*#__PURE__*/function () {
|
|
4793
|
+
/**
|
|
4794
|
+
* @param {TypesonOptions} options
|
|
4795
|
+
*/
|
|
4733
4796
|
function Typeson(options) {
|
|
4734
4797
|
_classCallCheck(this, Typeson);
|
|
4735
4798
|
|
|
@@ -4761,18 +4824,18 @@ var Typeson = /*#__PURE__*/function () {
|
|
|
4761
4824
|
* Serialize given object to Typeson.
|
|
4762
4825
|
* Initial arguments work identical to those of `JSON.stringify`.
|
|
4763
4826
|
* The `replacer` argument has nothing to do with our replacers.
|
|
4764
|
-
* @param {
|
|
4827
|
+
* @param {any} obj
|
|
4765
4828
|
* @param {JSONReplacer|string[]} replacer
|
|
4766
4829
|
* @param {number|string} space
|
|
4767
|
-
* @param {
|
|
4768
|
-
* @returns {string|Promise} Promise resolves to a string
|
|
4830
|
+
* @param {TypesonOptions} opts
|
|
4831
|
+
* @returns {string|Promise<string>} Promise resolves to a string
|
|
4769
4832
|
*/
|
|
4770
4833
|
|
|
4771
4834
|
|
|
4772
4835
|
_createClass(Typeson, [{
|
|
4773
4836
|
key: "stringify",
|
|
4774
4837
|
value: function stringify(obj, replacer, space, opts) {
|
|
4775
|
-
opts = _objectSpread2
|
|
4838
|
+
opts = _objectSpread2(_objectSpread2(_objectSpread2({}, this.options), opts), {}, {
|
|
4776
4839
|
stringification: true
|
|
4777
4840
|
});
|
|
4778
4841
|
var encapsulated = this.encapsulate(obj, null, opts);
|
|
@@ -4787,54 +4850,61 @@ var Typeson = /*#__PURE__*/function () {
|
|
|
4787
4850
|
}
|
|
4788
4851
|
/**
|
|
4789
4852
|
* Also sync but throws on non-sync result.
|
|
4790
|
-
* @param {
|
|
4853
|
+
* @param {any} obj
|
|
4791
4854
|
* @param {JSONReplacer|string[]} replacer
|
|
4792
4855
|
* @param {number|string} space
|
|
4793
|
-
* @param {
|
|
4856
|
+
* @param {TypesonOptions} opts
|
|
4794
4857
|
* @returns {string}
|
|
4795
4858
|
*/
|
|
4796
4859
|
|
|
4797
4860
|
}, {
|
|
4798
4861
|
key: "stringifySync",
|
|
4799
4862
|
value: function stringifySync(obj, replacer, space, opts) {
|
|
4800
|
-
return this.stringify(obj, replacer, space, _objectSpread2
|
|
4863
|
+
return this.stringify(obj, replacer, space, _objectSpread2(_objectSpread2({
|
|
4801
4864
|
throwOnBadSyncType: true
|
|
4802
|
-
}, opts, {
|
|
4865
|
+
}, opts), {}, {
|
|
4803
4866
|
sync: true
|
|
4804
4867
|
}));
|
|
4805
4868
|
}
|
|
4806
4869
|
/**
|
|
4807
4870
|
*
|
|
4808
|
-
* @param {
|
|
4871
|
+
* @param {any} obj
|
|
4809
4872
|
* @param {JSONReplacer|string[]} replacer
|
|
4810
4873
|
* @param {number|string} space
|
|
4811
|
-
* @param {
|
|
4874
|
+
* @param {TypesonOptions} opts
|
|
4812
4875
|
* @returns {Promise<string>}
|
|
4813
4876
|
*/
|
|
4814
4877
|
|
|
4815
4878
|
}, {
|
|
4816
4879
|
key: "stringifyAsync",
|
|
4817
4880
|
value: function stringifyAsync(obj, replacer, space, opts) {
|
|
4818
|
-
return this.stringify(obj, replacer, space, _objectSpread2
|
|
4881
|
+
return this.stringify(obj, replacer, space, _objectSpread2(_objectSpread2({
|
|
4819
4882
|
throwOnBadSyncType: true
|
|
4820
|
-
}, opts, {
|
|
4883
|
+
}, opts), {}, {
|
|
4821
4884
|
sync: false
|
|
4822
4885
|
}));
|
|
4823
4886
|
}
|
|
4887
|
+
/**
|
|
4888
|
+
* @callback JSONReviver
|
|
4889
|
+
* @param {string} key
|
|
4890
|
+
* @param {JSON} value
|
|
4891
|
+
* @returns {JSON}
|
|
4892
|
+
*/
|
|
4893
|
+
|
|
4824
4894
|
/**
|
|
4825
4895
|
* Parse Typeson back into an obejct.
|
|
4826
4896
|
* Initial arguments works identical to those of `JSON.parse()`.
|
|
4827
4897
|
* @param {string} text
|
|
4828
|
-
* @param {
|
|
4898
|
+
* @param {JSONReviver} reviver This JSON reviver has nothing to do with
|
|
4829
4899
|
* our revivers.
|
|
4830
|
-
* @param {
|
|
4900
|
+
* @param {TypesonOptions} opts
|
|
4831
4901
|
* @returns {external:JSON}
|
|
4832
4902
|
*/
|
|
4833
4903
|
|
|
4834
4904
|
}, {
|
|
4835
4905
|
key: "parse",
|
|
4836
4906
|
value: function parse(text, reviver, opts) {
|
|
4837
|
-
opts = _objectSpread2
|
|
4907
|
+
opts = _objectSpread2(_objectSpread2(_objectSpread2({}, this.options), opts), {}, {
|
|
4838
4908
|
parse: true
|
|
4839
4909
|
});
|
|
4840
4910
|
return this.revive(JSON.parse(text, reviver), opts);
|
|
@@ -4842,43 +4912,47 @@ var Typeson = /*#__PURE__*/function () {
|
|
|
4842
4912
|
/**
|
|
4843
4913
|
* Also sync but throws on non-sync result.
|
|
4844
4914
|
* @param {string} text
|
|
4845
|
-
* @param {
|
|
4915
|
+
* @param {JSONReviver} reviver This JSON reviver has nothing to do with
|
|
4846
4916
|
* our revivers.
|
|
4847
|
-
* @param {
|
|
4917
|
+
* @param {TypesonOptions} opts
|
|
4848
4918
|
* @returns {external:JSON}
|
|
4849
4919
|
*/
|
|
4850
4920
|
|
|
4851
4921
|
}, {
|
|
4852
4922
|
key: "parseSync",
|
|
4853
4923
|
value: function parseSync(text, reviver, opts) {
|
|
4854
|
-
return this.parse(text, reviver, _objectSpread2
|
|
4924
|
+
return this.parse(text, reviver, _objectSpread2(_objectSpread2({
|
|
4855
4925
|
throwOnBadSyncType: true
|
|
4856
|
-
}, opts, {
|
|
4926
|
+
}, opts), {}, {
|
|
4857
4927
|
sync: true
|
|
4858
4928
|
}));
|
|
4859
4929
|
}
|
|
4860
4930
|
/**
|
|
4861
4931
|
* @param {string} text
|
|
4862
|
-
* @param {
|
|
4932
|
+
* @param {JSONReviver} reviver This JSON reviver has nothing to do with
|
|
4863
4933
|
* our revivers.
|
|
4864
|
-
* @param {
|
|
4865
|
-
* @returns {Promise} Resolves to `external:JSON`
|
|
4934
|
+
* @param {TypesonOptions} opts
|
|
4935
|
+
* @returns {Promise<external:JSON>} Resolves to `external:JSON`
|
|
4866
4936
|
*/
|
|
4867
4937
|
|
|
4868
4938
|
}, {
|
|
4869
4939
|
key: "parseAsync",
|
|
4870
4940
|
value: function parseAsync(text, reviver, opts) {
|
|
4871
|
-
return this.parse(text, reviver, _objectSpread2
|
|
4941
|
+
return this.parse(text, reviver, _objectSpread2(_objectSpread2({
|
|
4872
4942
|
throwOnBadSyncType: true
|
|
4873
|
-
}, opts, {
|
|
4943
|
+
}, opts), {}, {
|
|
4874
4944
|
sync: false
|
|
4875
4945
|
}));
|
|
4876
4946
|
}
|
|
4947
|
+
/**
|
|
4948
|
+
* @typedef {} StateObject
|
|
4949
|
+
*/
|
|
4950
|
+
|
|
4877
4951
|
/**
|
|
4878
4952
|
*
|
|
4879
|
-
* @param {
|
|
4880
|
-
* @param {
|
|
4881
|
-
* @param {
|
|
4953
|
+
* @param {any} obj
|
|
4954
|
+
* @param {StateObject} stateObj
|
|
4955
|
+
* @param {TypesonOptions} [opts={}]
|
|
4882
4956
|
* @returns {string[]|false}
|
|
4883
4957
|
*/
|
|
4884
4958
|
|
|
@@ -4891,10 +4965,10 @@ var Typeson = /*#__PURE__*/function () {
|
|
|
4891
4965
|
}
|
|
4892
4966
|
/**
|
|
4893
4967
|
*
|
|
4894
|
-
* @param {
|
|
4968
|
+
* @param {any} obj
|
|
4895
4969
|
* @param {PlainObject} stateObj
|
|
4896
4970
|
* @param {PlainObject} [opts={}]
|
|
4897
|
-
* @returns {Promise
|
|
4971
|
+
* @returns {Promise<any>|GenericArray|PlainObject|string|false}
|
|
4898
4972
|
*/
|
|
4899
4973
|
|
|
4900
4974
|
}, {
|
|
@@ -4909,18 +4983,101 @@ var Typeson = /*#__PURE__*/function () {
|
|
|
4909
4983
|
* registered types with plain objects representing the types data.
|
|
4910
4984
|
*
|
|
4911
4985
|
* This method is used internally by `Typeson.stringify()`.
|
|
4912
|
-
* @param {
|
|
4986
|
+
* @param {any} obj - Object to encapsulate.
|
|
4913
4987
|
* @param {PlainObject} stateObj
|
|
4914
4988
|
* @param {PlainObject} opts
|
|
4915
|
-
* @returns {Promise
|
|
4989
|
+
* @returns {Promise<any>|GenericArray|PlainObject|string|false}
|
|
4916
4990
|
*/
|
|
4917
4991
|
|
|
4918
4992
|
}, {
|
|
4919
4993
|
key: "encapsulate",
|
|
4920
4994
|
value: function encapsulate(obj, stateObj, opts) {
|
|
4921
|
-
|
|
4995
|
+
/**
|
|
4996
|
+
*
|
|
4997
|
+
* @param {any} ret
|
|
4998
|
+
* @param {GenericArray} promisesData
|
|
4999
|
+
* @returns {Promise<any>}
|
|
5000
|
+
*/
|
|
5001
|
+
var checkPromises = _async(function (ret, promisesData) {
|
|
5002
|
+
return _await(Promise.all(promisesData.map(function (pd) {
|
|
5003
|
+
return pd[1].p;
|
|
5004
|
+
})), function (promResults) {
|
|
5005
|
+
return _await(Promise.all(promResults.map(_async(function (promResult) {
|
|
5006
|
+
var _exit = false;
|
|
5007
|
+
var newPromisesData = [];
|
|
5008
|
+
|
|
5009
|
+
var _promisesData$splice = promisesData.splice(0, 1),
|
|
5010
|
+
_promisesData$splice2 = _slicedToArray(_promisesData$splice, 1),
|
|
5011
|
+
prData = _promisesData$splice2[0];
|
|
5012
|
+
|
|
5013
|
+
var _prData = _slicedToArray(prData, 7),
|
|
5014
|
+
keyPath = _prData[0],
|
|
5015
|
+
cyclic = _prData[2],
|
|
5016
|
+
stateObj = _prData[3],
|
|
5017
|
+
parentObj = _prData[4],
|
|
5018
|
+
key = _prData[5],
|
|
5019
|
+
detectedType = _prData[6];
|
|
5020
|
+
|
|
5021
|
+
var encaps = _encapsulate(keyPath, promResult, cyclic, stateObj, newPromisesData, true, detectedType);
|
|
5022
|
+
|
|
5023
|
+
var isTypesonPromise = hasConstructorOf(encaps, TypesonPromise); // Handle case where an embedded custom type itself
|
|
5024
|
+
// returns a `Typeson.Promise`
|
|
5025
|
+
|
|
5026
|
+
return _invoke(function () {
|
|
5027
|
+
if (keyPath && isTypesonPromise) {
|
|
5028
|
+
return _await(encaps.p, function (encaps2) {
|
|
5029
|
+
parentObj[key] = encaps2;
|
|
5030
|
+
_exit = true;
|
|
5031
|
+
return checkPromises(ret, newPromisesData);
|
|
5032
|
+
});
|
|
5033
|
+
}
|
|
5034
|
+
}, function (_result) {
|
|
5035
|
+
if (_exit) return _result;
|
|
5036
|
+
|
|
5037
|
+
if (keyPath) {
|
|
5038
|
+
parentObj[key] = encaps;
|
|
5039
|
+
} else if (isTypesonPromise) {
|
|
5040
|
+
ret = encaps.p;
|
|
5041
|
+
} else {
|
|
5042
|
+
// If this is itself a `Typeson.Promise` (because the
|
|
5043
|
+
// original value supplied was a `Promise` or
|
|
5044
|
+
// because the supplied custom type value resolved
|
|
5045
|
+
// to one), returning it below will be fine since
|
|
5046
|
+
// a `Promise` is expected anyways given current
|
|
5047
|
+
// config (and if not a `Promise`, it will be ready
|
|
5048
|
+
// as the resolve value)
|
|
5049
|
+
ret = encaps;
|
|
5050
|
+
}
|
|
5051
|
+
|
|
5052
|
+
return checkPromises(ret, newPromisesData);
|
|
5053
|
+
});
|
|
5054
|
+
}))), function () {
|
|
5055
|
+
return ret;
|
|
5056
|
+
});
|
|
5057
|
+
});
|
|
5058
|
+
});
|
|
5059
|
+
/**
|
|
5060
|
+
* @typedef {PlainObject} OwnKeysObject
|
|
5061
|
+
* @property {boolean} ownKeys
|
|
5062
|
+
*/
|
|
5063
|
+
|
|
5064
|
+
/**
|
|
5065
|
+
* @callback BuiltinStateObjectPropertiesCallback
|
|
5066
|
+
* @returns {void}
|
|
5067
|
+
*/
|
|
5068
|
+
|
|
5069
|
+
/**
|
|
5070
|
+
*
|
|
5071
|
+
* @param {StateObject} stateObj
|
|
5072
|
+
* @param {OwnKeysObject} ownKeysObj
|
|
5073
|
+
* @param {BuiltinStateObjectPropertiesCallback} cb
|
|
5074
|
+
* @returns {undefined}
|
|
5075
|
+
*/
|
|
5076
|
+
|
|
5077
|
+
|
|
5078
|
+
opts = _objectSpread2(_objectSpread2({
|
|
4922
5079
|
sync: true
|
|
4923
|
-
}, this.options,
|
|
5080
|
+
}, this.options), opts);
|
|
4924
5081
|
var _opts = opts,
|
|
4925
5082
|
sync = _opts.sync;
|
|
4926
5083
|
var that = this,
|
|
@@ -4939,7 +5096,7 @@ var Typeson = /*#__PURE__*/function () {
|
|
|
4939
5096
|
var ret = _encapsulate('', obj, cyclic, stateObj || {}, promisesDataRoot);
|
|
4940
5097
|
/**
|
|
4941
5098
|
*
|
|
4942
|
-
* @param {
|
|
5099
|
+
* @param {any} ret
|
|
4943
5100
|
* @returns {GenericArray|PlainObject|string|false}
|
|
4944
5101
|
*/
|
|
4945
5102
|
|
|
@@ -4966,7 +5123,7 @@ var Typeson = /*#__PURE__*/function () {
|
|
|
4966
5123
|
|
|
4967
5124
|
if (!ret || !isPlainObject(ret) || // Also need to handle if this is an object with its
|
|
4968
5125
|
// own `$types` property (to avoid ambiguity)
|
|
4969
|
-
hasOwn
|
|
5126
|
+
hasOwn.call(ret, '$types')) {
|
|
4970
5127
|
ret = {
|
|
4971
5128
|
$: ret,
|
|
4972
5129
|
$types: {
|
|
@@ -4977,7 +5134,7 @@ var Typeson = /*#__PURE__*/function () {
|
|
|
4977
5134
|
ret.$types = types;
|
|
4978
5135
|
} // No special types
|
|
4979
5136
|
|
|
4980
|
-
} else if (isObject(ret) && hasOwn
|
|
5137
|
+
} else if (isObject(ret) && hasOwn.call(ret, '$types')) {
|
|
4981
5138
|
ret = {
|
|
4982
5139
|
$: ret,
|
|
4983
5140
|
$types: true
|
|
@@ -4990,112 +5147,6 @@ var Typeson = /*#__PURE__*/function () {
|
|
|
4990
5147
|
|
|
4991
5148
|
return ret;
|
|
4992
5149
|
}
|
|
4993
|
-
/**
|
|
4994
|
-
*
|
|
4995
|
-
* @param {Any} ret
|
|
4996
|
-
* @param {GenericArray} promisesData
|
|
4997
|
-
* @returns {Promise<Any>}
|
|
4998
|
-
*/
|
|
4999
|
-
|
|
5000
|
-
|
|
5001
|
-
function checkPromises(_x, _x2) {
|
|
5002
|
-
return _checkPromises.apply(this, arguments);
|
|
5003
|
-
}
|
|
5004
|
-
/**
|
|
5005
|
-
*
|
|
5006
|
-
* @param {object} stateObj
|
|
5007
|
-
* @param {object} ownKeysObj
|
|
5008
|
-
* @param {function} cb
|
|
5009
|
-
* @returns {undefined}
|
|
5010
|
-
*/
|
|
5011
|
-
|
|
5012
|
-
|
|
5013
|
-
function _checkPromises() {
|
|
5014
|
-
_checkPromises = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2(ret, promisesData) {
|
|
5015
|
-
var promResults;
|
|
5016
|
-
return regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
5017
|
-
while (1) {
|
|
5018
|
-
switch (_context2.prev = _context2.next) {
|
|
5019
|
-
case 0:
|
|
5020
|
-
_context2.next = 2;
|
|
5021
|
-
return Promise.all(promisesData.map(function (pd) {
|
|
5022
|
-
return pd[1].p;
|
|
5023
|
-
}));
|
|
5024
|
-
|
|
5025
|
-
case 2:
|
|
5026
|
-
promResults = _context2.sent;
|
|
5027
|
-
_context2.next = 5;
|
|
5028
|
-
return Promise.all(promResults.map( /*#__PURE__*/function () {
|
|
5029
|
-
var _ref = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(promResult) {
|
|
5030
|
-
var newPromisesData, _promisesData$splice, _promisesData$splice2, prData, _prData, keyPath, cyclic, stateObj, parentObj, key, detectedType, encaps, isTypesonPromise, encaps2;
|
|
5031
|
-
|
|
5032
|
-
return regeneratorRuntime.wrap(function _callee$(_context) {
|
|
5033
|
-
while (1) {
|
|
5034
|
-
switch (_context.prev = _context.next) {
|
|
5035
|
-
case 0:
|
|
5036
|
-
newPromisesData = [];
|
|
5037
|
-
_promisesData$splice = promisesData.splice(0, 1), _promisesData$splice2 = _slicedToArray(_promisesData$splice, 1), prData = _promisesData$splice2[0];
|
|
5038
|
-
_prData = _slicedToArray(prData, 7), keyPath = _prData[0], cyclic = _prData[2], stateObj = _prData[3], parentObj = _prData[4], key = _prData[5], detectedType = _prData[6];
|
|
5039
|
-
encaps = _encapsulate(keyPath, promResult, cyclic, stateObj, newPromisesData, true, detectedType);
|
|
5040
|
-
isTypesonPromise = hasConstructorOf(encaps, TypesonPromise); // Handle case where an embedded custom type itself
|
|
5041
|
-
// returns a `Typeson.Promise`
|
|
5042
|
-
|
|
5043
|
-
if (!(keyPath && isTypesonPromise)) {
|
|
5044
|
-
_context.next = 11;
|
|
5045
|
-
break;
|
|
5046
|
-
}
|
|
5047
|
-
|
|
5048
|
-
_context.next = 8;
|
|
5049
|
-
return encaps.p;
|
|
5050
|
-
|
|
5051
|
-
case 8:
|
|
5052
|
-
encaps2 = _context.sent;
|
|
5053
|
-
parentObj[key] = encaps2;
|
|
5054
|
-
return _context.abrupt("return", checkPromises(ret, newPromisesData));
|
|
5055
|
-
|
|
5056
|
-
case 11:
|
|
5057
|
-
if (keyPath) {
|
|
5058
|
-
parentObj[key] = encaps;
|
|
5059
|
-
} else if (isTypesonPromise) {
|
|
5060
|
-
ret = encaps.p;
|
|
5061
|
-
} else {
|
|
5062
|
-
// If this is itself a `Typeson.Promise` (because the
|
|
5063
|
-
// original value supplied was a `Promise` or
|
|
5064
|
-
// because the supplied custom type value resolved
|
|
5065
|
-
// to one), returning it below will be fine since
|
|
5066
|
-
// a `Promise` is expected anyways given current
|
|
5067
|
-
// config (and if not a `Promise`, it will be ready
|
|
5068
|
-
// as the resolve value)
|
|
5069
|
-
ret = encaps;
|
|
5070
|
-
}
|
|
5071
|
-
|
|
5072
|
-
return _context.abrupt("return", checkPromises(ret, newPromisesData));
|
|
5073
|
-
|
|
5074
|
-
case 13:
|
|
5075
|
-
case "end":
|
|
5076
|
-
return _context.stop();
|
|
5077
|
-
}
|
|
5078
|
-
}
|
|
5079
|
-
}, _callee);
|
|
5080
|
-
}));
|
|
5081
|
-
|
|
5082
|
-
return function (_x3) {
|
|
5083
|
-
return _ref.apply(this, arguments);
|
|
5084
|
-
};
|
|
5085
|
-
}()));
|
|
5086
|
-
|
|
5087
|
-
case 5:
|
|
5088
|
-
return _context2.abrupt("return", ret);
|
|
5089
|
-
|
|
5090
|
-
case 6:
|
|
5091
|
-
case "end":
|
|
5092
|
-
return _context2.stop();
|
|
5093
|
-
}
|
|
5094
|
-
}
|
|
5095
|
-
}, _callee2);
|
|
5096
|
-
}));
|
|
5097
|
-
return _checkPromises.apply(this, arguments);
|
|
5098
|
-
}
|
|
5099
5150
|
|
|
5100
5151
|
function _adaptBuiltinStateObjectProperties(stateObj, ownKeysObj, cb) {
|
|
5101
5152
|
Object.assign(stateObj, ownKeysObj);
|
|
@@ -5103,7 +5154,7 @@ var Typeson = /*#__PURE__*/function () {
|
|
|
5103
5154
|
var tmp = stateObj[prop];
|
|
5104
5155
|
delete stateObj[prop];
|
|
5105
5156
|
return tmp;
|
|
5106
|
-
}); // eslint-disable-next-line callback-return
|
|
5157
|
+
}); // eslint-disable-next-line node/callback-return
|
|
5107
5158
|
|
|
5108
5159
|
cb();
|
|
5109
5160
|
internalStateObjPropsToIgnore.forEach(function (prop, i) {
|
|
@@ -5113,13 +5164,13 @@ var Typeson = /*#__PURE__*/function () {
|
|
|
5113
5164
|
/**
|
|
5114
5165
|
*
|
|
5115
5166
|
* @param {string} keypath
|
|
5116
|
-
* @param {
|
|
5167
|
+
* @param {any} value
|
|
5117
5168
|
* @param {boolean} cyclic
|
|
5118
5169
|
* @param {PlainObject} stateObj
|
|
5119
5170
|
* @param {boolean} promisesData
|
|
5120
5171
|
* @param {boolean} resolvingTypesonPromise
|
|
5121
5172
|
* @param {string} detectedType
|
|
5122
|
-
* @returns {
|
|
5173
|
+
* @returns {any}
|
|
5123
5174
|
*/
|
|
5124
5175
|
|
|
5125
5176
|
|
|
@@ -5127,7 +5178,7 @@ var Typeson = /*#__PURE__*/function () {
|
|
|
5127
5178
|
var ret;
|
|
5128
5179
|
var observerData = {};
|
|
5129
5180
|
|
|
5130
|
-
var $typeof = _typeof
|
|
5181
|
+
var $typeof = _typeof(value);
|
|
5131
5182
|
|
|
5132
5183
|
var runObserver = encapsulateObserver ? function (obj) {
|
|
5133
5184
|
var type = detectedType || stateObj.type || Typeson.getJSONType(value);
|
|
@@ -5145,12 +5196,8 @@ var Typeson = /*#__PURE__*/function () {
|
|
|
5145
5196
|
} : null;
|
|
5146
5197
|
|
|
5147
5198
|
if (['string', 'boolean', 'number', 'undefined'].includes($typeof)) {
|
|
5148
|
-
if (value === undefined ||
|
|
5149
|
-
|
|
5150
|
-
ret = value;
|
|
5151
|
-
} else {
|
|
5152
|
-
ret = replace(keypath, value, stateObj, promisesData, false, resolvingTypesonPromise, runObserver);
|
|
5153
|
-
}
|
|
5199
|
+
if (value === undefined || Number.isNaN(value) || value === Number.NEGATIVE_INFINITY || value === Number.POSITIVE_INFINITY) {
|
|
5200
|
+
ret = stateObj.replaced ? value : replace(keypath, value, stateObj, promisesData, false, resolvingTypesonPromise, runObserver);
|
|
5154
5201
|
|
|
5155
5202
|
if (ret !== value) {
|
|
5156
5203
|
observerData = {
|
|
@@ -5176,7 +5223,7 @@ var Typeson = /*#__PURE__*/function () {
|
|
|
5176
5223
|
return value;
|
|
5177
5224
|
}
|
|
5178
5225
|
|
|
5179
|
-
if (cyclic && !stateObj.iterateIn && !stateObj.iterateUnsetNumeric && value && _typeof
|
|
5226
|
+
if (cyclic && !stateObj.iterateIn && !stateObj.iterateUnsetNumeric && value && _typeof(value) === 'object') {
|
|
5180
5227
|
// Options set to detect cyclic references and be able
|
|
5181
5228
|
// to rewrite them.
|
|
5182
5229
|
var refIndex = refObjs.indexOf(value);
|
|
@@ -5219,11 +5266,12 @@ var Typeson = /*#__PURE__*/function () {
|
|
|
5219
5266
|
promisesData.push([keypath, value, cyclic, stateObj, undefined, undefined, stateObj.type]);
|
|
5220
5267
|
ret = value;
|
|
5221
5268
|
} else if (isArr && stateObj.iterateIn !== 'object' || stateObj.iterateIn === 'array') {
|
|
5269
|
+
// eslint-disable-next-line unicorn/no-new-array -- Sparse
|
|
5222
5270
|
clone = new Array(value.length);
|
|
5223
5271
|
observerData = {
|
|
5224
5272
|
clone: clone
|
|
5225
5273
|
};
|
|
5226
|
-
} else if (!['function', 'symbol'].includes(_typeof
|
|
5274
|
+
} else if (!['function', 'symbol'].includes(_typeof(value)) && !('toJSON' in value) && !hasConstructorOf(value, TypesonPromise) && !hasConstructorOf(value, Promise) && !hasConstructorOf(value, ArrayBuffer) || isPlainObj || stateObj.iterateIn === 'object') {
|
|
5227
5275
|
clone = {};
|
|
5228
5276
|
|
|
5229
5277
|
if (stateObj.addLength) {
|
|
@@ -5254,7 +5302,7 @@ var Typeson = /*#__PURE__*/function () {
|
|
|
5254
5302
|
if (stateObj.iterateIn) {
|
|
5255
5303
|
var _loop = function _loop(key) {
|
|
5256
5304
|
var ownKeysObj = {
|
|
5257
|
-
ownKeys: hasOwn
|
|
5305
|
+
ownKeys: hasOwn.call(value, key)
|
|
5258
5306
|
};
|
|
5259
5307
|
|
|
5260
5308
|
_adaptBuiltinStateObjectProperties(stateObj, ownKeysObj, function () {
|
|
@@ -5351,16 +5399,50 @@ var Typeson = /*#__PURE__*/function () {
|
|
|
5351
5399
|
|
|
5352
5400
|
return clone;
|
|
5353
5401
|
}
|
|
5402
|
+
/**
|
|
5403
|
+
* @typedef {PlainObject} KeyPathEvent
|
|
5404
|
+
* @property {string} cyclicKeypath
|
|
5405
|
+
*/
|
|
5406
|
+
|
|
5407
|
+
/**
|
|
5408
|
+
* @typedef {PlainObject} EndIterateInEvent
|
|
5409
|
+
* @property {boolean} endIterateIn
|
|
5410
|
+
* @property {boolean} end
|
|
5411
|
+
*/
|
|
5412
|
+
|
|
5413
|
+
/**
|
|
5414
|
+
* @typedef {PlainObject} EndIterateUnsetNumericEvent
|
|
5415
|
+
* @property {boolean} endIterateUnsetNumeric
|
|
5416
|
+
* @property {boolean} end
|
|
5417
|
+
*/
|
|
5418
|
+
|
|
5419
|
+
/**
|
|
5420
|
+
* @typedef {PlainObject} TypeDetectedEvent
|
|
5421
|
+
* @property {boolean} typeDetected
|
|
5422
|
+
*/
|
|
5423
|
+
|
|
5424
|
+
/**
|
|
5425
|
+
* @typedef {PlainObject} ReplacingEvent
|
|
5426
|
+
* @property {boolean} replacing
|
|
5427
|
+
*/
|
|
5428
|
+
|
|
5429
|
+
/**
|
|
5430
|
+
* @callback Observer
|
|
5431
|
+
* @param {KeyPathEvent|EndIterateInEvent|EndIterateUnsetNumericEvent|
|
|
5432
|
+
* TypeDetectedEvent|ReplacingEvent} [event]
|
|
5433
|
+
* @returns {void}
|
|
5434
|
+
*/
|
|
5435
|
+
|
|
5354
5436
|
/**
|
|
5355
5437
|
*
|
|
5356
5438
|
* @param {string} keypath
|
|
5357
|
-
* @param {
|
|
5439
|
+
* @param {any} value
|
|
5358
5440
|
* @param {PlainObject} stateObj
|
|
5359
5441
|
* @param {GenericArray} promisesData
|
|
5360
5442
|
* @param {boolean} plainObject
|
|
5361
5443
|
* @param {boolean} resolvingTypesonPromise
|
|
5362
|
-
* @param {
|
|
5363
|
-
* @returns {
|
|
5444
|
+
* @param {Observer} [runObserver]
|
|
5445
|
+
* @returns {any}
|
|
5364
5446
|
*/
|
|
5365
5447
|
|
|
5366
5448
|
|
|
@@ -5431,46 +5513,47 @@ var Typeson = /*#__PURE__*/function () {
|
|
|
5431
5513
|
}
|
|
5432
5514
|
/**
|
|
5433
5515
|
* Also sync but throws on non-sync result.
|
|
5434
|
-
* @param {
|
|
5435
|
-
* @param {
|
|
5436
|
-
* @param {
|
|
5437
|
-
* @returns {
|
|
5516
|
+
* @param {any} obj
|
|
5517
|
+
* @param {StateObject} stateObj
|
|
5518
|
+
* @param {TypesonOptions} opts
|
|
5519
|
+
* @returns {any}
|
|
5438
5520
|
*/
|
|
5439
5521
|
|
|
5440
5522
|
}, {
|
|
5441
5523
|
key: "encapsulateSync",
|
|
5442
5524
|
value: function encapsulateSync(obj, stateObj, opts) {
|
|
5443
|
-
return this.encapsulate(obj, stateObj, _objectSpread2
|
|
5525
|
+
return this.encapsulate(obj, stateObj, _objectSpread2(_objectSpread2({
|
|
5444
5526
|
throwOnBadSyncType: true
|
|
5445
|
-
}, opts, {
|
|
5527
|
+
}, opts), {}, {
|
|
5446
5528
|
sync: true
|
|
5447
5529
|
}));
|
|
5448
5530
|
}
|
|
5449
5531
|
/**
|
|
5450
|
-
* @param {
|
|
5451
|
-
* @param {
|
|
5452
|
-
* @param {
|
|
5453
|
-
* @returns {
|
|
5532
|
+
* @param {any} obj
|
|
5533
|
+
* @param {StateObject} stateObj
|
|
5534
|
+
* @param {TypesonOptions} opts
|
|
5535
|
+
* @returns {any}
|
|
5454
5536
|
*/
|
|
5455
5537
|
|
|
5456
5538
|
}, {
|
|
5457
5539
|
key: "encapsulateAsync",
|
|
5458
5540
|
value: function encapsulateAsync(obj, stateObj, opts) {
|
|
5459
|
-
return this.encapsulate(obj, stateObj, _objectSpread2
|
|
5541
|
+
return this.encapsulate(obj, stateObj, _objectSpread2(_objectSpread2({
|
|
5460
5542
|
throwOnBadSyncType: true
|
|
5461
|
-
}, opts, {
|
|
5543
|
+
}, opts), {}, {
|
|
5462
5544
|
sync: false
|
|
5463
5545
|
}));
|
|
5464
5546
|
}
|
|
5465
5547
|
/**
|
|
5466
5548
|
* Revive an encapsulated object.
|
|
5467
5549
|
* This method is used internally by `Typeson.parse()`.
|
|
5468
|
-
* @param {
|
|
5469
|
-
* properties that are listed there will be replaced with its true
|
|
5470
|
-
* instead of just plain objects.
|
|
5471
|
-
* @param {
|
|
5550
|
+
* @param {PlainObject} obj - Object to revive. If it has `$types` member,
|
|
5551
|
+
* the properties that are listed there will be replaced with its true
|
|
5552
|
+
* type instead of just plain objects.
|
|
5553
|
+
* @param {TypesonOptions} opts
|
|
5472
5554
|
* @throws TypeError If mismatch between sync/async type and result
|
|
5473
|
-
* @returns {Promise
|
|
5555
|
+
* @returns {Promise<any>|any} If async, returns a Promise that resolves
|
|
5556
|
+
* to `any`.
|
|
5474
5557
|
*/
|
|
5475
5558
|
|
|
5476
5559
|
}, {
|
|
@@ -5488,9 +5571,9 @@ var Typeson = /*#__PURE__*/function () {
|
|
|
5488
5571
|
return obj.$;
|
|
5489
5572
|
}
|
|
5490
5573
|
|
|
5491
|
-
opts = _objectSpread2
|
|
5574
|
+
opts = _objectSpread2(_objectSpread2({
|
|
5492
5575
|
sync: true
|
|
5493
|
-
}, this.options,
|
|
5576
|
+
}, this.options), opts);
|
|
5494
5577
|
var _opts3 = opts,
|
|
5495
5578
|
sync = _opts3.sync;
|
|
5496
5579
|
var keyPathResolutions = [];
|
|
@@ -5508,22 +5591,23 @@ var Typeson = /*#__PURE__*/function () {
|
|
|
5508
5591
|
var that = this;
|
|
5509
5592
|
/**
|
|
5510
5593
|
* @callback RevivalReducer
|
|
5511
|
-
* @param {
|
|
5594
|
+
* @param {any} value
|
|
5512
5595
|
* @param {string} type
|
|
5513
|
-
* @returns {
|
|
5596
|
+
* @returns {any}
|
|
5514
5597
|
*/
|
|
5515
5598
|
|
|
5516
5599
|
/**
|
|
5517
5600
|
*
|
|
5518
5601
|
* @param {string} type
|
|
5519
|
-
* @param {
|
|
5520
|
-
* @
|
|
5602
|
+
* @param {any} val
|
|
5603
|
+
* @throws {Error}
|
|
5604
|
+
* @returns {any}
|
|
5521
5605
|
*/
|
|
5522
5606
|
|
|
5523
5607
|
function executeReviver(type, val) {
|
|
5524
|
-
var
|
|
5525
|
-
|
|
5526
|
-
reviver =
|
|
5608
|
+
var _ref = that.revivers[type] || [],
|
|
5609
|
+
_ref2 = _slicedToArray(_ref, 1),
|
|
5610
|
+
reviver = _ref2[0];
|
|
5527
5611
|
|
|
5528
5612
|
if (!reviver) {
|
|
5529
5613
|
throw new Error('Unregistered type: ' + type);
|
|
@@ -5550,10 +5634,10 @@ var Typeson = /*#__PURE__*/function () {
|
|
|
5550
5634
|
// const references = [];
|
|
5551
5635
|
// const reviveTypes = [];
|
|
5552
5636
|
var plainObjectTypes = [];
|
|
5553
|
-
Object.entries(types).forEach(function (
|
|
5554
|
-
var
|
|
5555
|
-
keypath =
|
|
5556
|
-
type =
|
|
5637
|
+
Object.entries(types).forEach(function (_ref3) {
|
|
5638
|
+
var _ref4 = _slicedToArray(_ref3, 2),
|
|
5639
|
+
keypath = _ref4[0],
|
|
5640
|
+
type = _ref4[1];
|
|
5557
5641
|
|
|
5558
5642
|
if (type === '#') {
|
|
5559
5643
|
/*
|
|
@@ -5566,9 +5650,9 @@ var Typeson = /*#__PURE__*/function () {
|
|
|
5566
5650
|
}
|
|
5567
5651
|
|
|
5568
5652
|
[].concat(type).forEach(function (type) {
|
|
5569
|
-
var
|
|
5570
|
-
|
|
5571
|
-
plain =
|
|
5653
|
+
var _ref5 = that.revivers[type] || [null, {}],
|
|
5654
|
+
_ref6 = _slicedToArray(_ref5, 2),
|
|
5655
|
+
plain = _ref6[1].plain;
|
|
5572
5656
|
|
|
5573
5657
|
if (!plain) {
|
|
5574
5658
|
// reviveTypes.push({keypath, type});
|
|
@@ -5594,9 +5678,9 @@ var Typeson = /*#__PURE__*/function () {
|
|
|
5594
5678
|
*/
|
|
5595
5679
|
|
|
5596
5680
|
|
|
5597
|
-
return plainObjectTypes.sort(nestedPathsFirst).reduce(function reducer(possibleTypesonPromise,
|
|
5598
|
-
var keypath =
|
|
5599
|
-
type =
|
|
5681
|
+
return plainObjectTypes.sort(nestedPathsFirst).reduce(function reducer(possibleTypesonPromise, _ref7) {
|
|
5682
|
+
var keypath = _ref7.keypath,
|
|
5683
|
+
type = _ref7.type;
|
|
5600
5684
|
|
|
5601
5685
|
if (isThenable(possibleTypesonPromise)) {
|
|
5602
5686
|
return possibleTypesonPromise.then(function (val) {
|
|
@@ -5639,11 +5723,11 @@ var Typeson = /*#__PURE__*/function () {
|
|
|
5639
5723
|
/**
|
|
5640
5724
|
*
|
|
5641
5725
|
* @param {string} keypath
|
|
5642
|
-
* @param {
|
|
5643
|
-
* @param {?(
|
|
5644
|
-
* @param {
|
|
5726
|
+
* @param {any} value
|
|
5727
|
+
* @param {?(GenericArray|PlainObject)} target
|
|
5728
|
+
* @param {GenericArray|PlainObject} [clone]
|
|
5645
5729
|
* @param {string} [key]
|
|
5646
|
-
* @returns {
|
|
5730
|
+
* @returns {any}
|
|
5647
5731
|
*/
|
|
5648
5732
|
|
|
5649
5733
|
function _revive(keypath, value, target, clone, key) {
|
|
@@ -5655,6 +5739,7 @@ var Typeson = /*#__PURE__*/function () {
|
|
|
5655
5739
|
var isArr = isArray(value);
|
|
5656
5740
|
|
|
5657
5741
|
if (isArr || isPlainObject(value)) {
|
|
5742
|
+
// eslint-disable-next-line unicorn/no-new-array -- Sparse
|
|
5658
5743
|
var _clone = isArr ? new Array(value.length) : {}; // Iterate object or array
|
|
5659
5744
|
|
|
5660
5745
|
|
|
@@ -5730,8 +5815,8 @@ var Typeson = /*#__PURE__*/function () {
|
|
|
5730
5815
|
}
|
|
5731
5816
|
/**
|
|
5732
5817
|
*
|
|
5733
|
-
* @param {
|
|
5734
|
-
* @returns {undefined|
|
|
5818
|
+
* @param {any} retrn
|
|
5819
|
+
* @returns {undefined|any}
|
|
5735
5820
|
*/
|
|
5736
5821
|
|
|
5737
5822
|
|
|
@@ -5754,9 +5839,9 @@ var Typeson = /*#__PURE__*/function () {
|
|
|
5754
5839
|
ret = TypesonPromise.resolve(ret).then(function (r) {
|
|
5755
5840
|
return TypesonPromise.all([// May be a TypesonPromise or not
|
|
5756
5841
|
r].concat(revivalPromises));
|
|
5757
|
-
}).then(function (
|
|
5758
|
-
var
|
|
5759
|
-
r =
|
|
5842
|
+
}).then(function (_ref8) {
|
|
5843
|
+
var _ref9 = _slicedToArray(_ref8, 1),
|
|
5844
|
+
r = _ref9[0];
|
|
5760
5845
|
|
|
5761
5846
|
return r;
|
|
5762
5847
|
});
|
|
@@ -5771,42 +5856,46 @@ var Typeson = /*#__PURE__*/function () {
|
|
|
5771
5856
|
}
|
|
5772
5857
|
/**
|
|
5773
5858
|
* Also sync but throws on non-sync result.
|
|
5774
|
-
* @param {
|
|
5775
|
-
* @param {
|
|
5776
|
-
* @returns {
|
|
5859
|
+
* @param {any} obj
|
|
5860
|
+
* @param {TypesonOptions} opts
|
|
5861
|
+
* @returns {any}
|
|
5777
5862
|
*/
|
|
5778
5863
|
|
|
5779
5864
|
}, {
|
|
5780
5865
|
key: "reviveSync",
|
|
5781
5866
|
value: function reviveSync(obj, opts) {
|
|
5782
|
-
return this.revive(obj, _objectSpread2
|
|
5867
|
+
return this.revive(obj, _objectSpread2(_objectSpread2({
|
|
5783
5868
|
throwOnBadSyncType: true
|
|
5784
|
-
}, opts, {
|
|
5869
|
+
}, opts), {}, {
|
|
5785
5870
|
sync: true
|
|
5786
5871
|
}));
|
|
5787
5872
|
}
|
|
5788
5873
|
/**
|
|
5789
|
-
* @param {
|
|
5790
|
-
* @param {
|
|
5791
|
-
* @returns {Promise}
|
|
5874
|
+
* @param {any} obj
|
|
5875
|
+
* @param {TypesonOptions} opts
|
|
5876
|
+
* @returns {Promise<any>}
|
|
5792
5877
|
*/
|
|
5793
5878
|
|
|
5794
5879
|
}, {
|
|
5795
5880
|
key: "reviveAsync",
|
|
5796
5881
|
value: function reviveAsync(obj, opts) {
|
|
5797
|
-
return this.revive(obj, _objectSpread2
|
|
5882
|
+
return this.revive(obj, _objectSpread2(_objectSpread2({
|
|
5798
5883
|
throwOnBadSyncType: true
|
|
5799
|
-
}, opts, {
|
|
5884
|
+
}, opts), {}, {
|
|
5800
5885
|
sync: false
|
|
5801
5886
|
}));
|
|
5802
5887
|
}
|
|
5888
|
+
/**
|
|
5889
|
+
* @typedef {Tester|Replacer|Reviver} Spec
|
|
5890
|
+
*/
|
|
5891
|
+
|
|
5803
5892
|
/**
|
|
5804
5893
|
* Register types.
|
|
5805
5894
|
* For examples on how to use this method, see
|
|
5806
5895
|
* {@link https://github.com/dfahlander/typeson-registry/tree/master/types}.
|
|
5807
|
-
* @param {object
|
|
5808
|
-
*
|
|
5809
|
-
* @param {
|
|
5896
|
+
* @param {object<string,Spec[]>[]} typeSpecSets -
|
|
5897
|
+
* Types and their functions [test, encapsulate, revive];
|
|
5898
|
+
* @param {TypesonOptions} opts
|
|
5810
5899
|
* @returns {Typeson}
|
|
5811
5900
|
*/
|
|
5812
5901
|
|
|
@@ -5852,7 +5941,7 @@ var Typeson = /*#__PURE__*/function () {
|
|
|
5852
5941
|
return x && x.constructor === Class;
|
|
5853
5942
|
},
|
|
5854
5943
|
replace: function replace(x) {
|
|
5855
|
-
return _objectSpread2
|
|
5944
|
+
return _objectSpread2({}, x);
|
|
5856
5945
|
},
|
|
5857
5946
|
revive: function revive(x) {
|
|
5858
5947
|
return Object.assign(Object.create(Class.prototype), x);
|
|
@@ -5889,7 +5978,7 @@ var Typeson = /*#__PURE__*/function () {
|
|
|
5889
5978
|
replacerObj.replaceAsync = spec.replaceAsync.bind(spec);
|
|
5890
5979
|
}
|
|
5891
5980
|
|
|
5892
|
-
var start = typeof opts.fallback === 'number' ? opts.fallback : opts.fallback ? 0 :
|
|
5981
|
+
var start = typeof opts.fallback === 'number' ? opts.fallback : opts.fallback ? 0 : Number.POSITIVE_INFINITY;
|
|
5893
5982
|
|
|
5894
5983
|
if (spec.testPlainObjects) {
|
|
5895
5984
|
this.plainObjectReplacers.splice(start, 0, replacerObj);
|
|
@@ -5956,8 +6045,6 @@ Typeson.getByKeyPath = getByKeyPath;
|
|
|
5956
6045
|
Typeson.getJSONType = getJSONType;
|
|
5957
6046
|
Typeson.JSON_TYPES = ['null', 'boolean', 'number', 'string', 'array', 'object'];
|
|
5958
6047
|
|
|
5959
|
-
/* eslint-disable node/no-unsupported-features/es-syntax */
|
|
5960
|
-
|
|
5961
6048
|
/*
|
|
5962
6049
|
* base64-arraybuffer
|
|
5963
6050
|
* https://github.com/niklasvh/base64-arraybuffer
|
|
@@ -6197,9 +6284,7 @@ const blob = {
|
|
|
6197
6284
|
replace(b) {
|
|
6198
6285
|
// Sync
|
|
6199
6286
|
const req = new XMLHttpRequest();
|
|
6200
|
-
req.overrideMimeType('text/plain; charset=x-user-defined');
|
|
6201
|
-
// eslint-disable-next-line node/no-unsupported-features/node-builtins
|
|
6202
|
-
|
|
6287
|
+
req.overrideMimeType('text/plain; charset=x-user-defined');
|
|
6203
6288
|
req.open('GET', URL.createObjectURL(b), false); // Sync
|
|
6204
6289
|
|
|
6205
6290
|
req.send(); // Seems not feasible to accurately simulate
|
|
@@ -6267,11 +6352,12 @@ function generateUUID() {
|
|
|
6267
6352
|
// Adapted from original: public domain/MIT: http://stackoverflow.com/a/8809472/271577
|
|
6268
6353
|
|
|
6269
6354
|
/* istanbul ignore next */
|
|
6270
|
-
let d =
|
|
6355
|
+
let d = Date.now() + ( // use high-precision timer if available
|
|
6356
|
+
// istanbul ignore next
|
|
6271
6357
|
typeof performance !== 'undefined' && typeof performance.now === 'function' ? performance.now() : 0);
|
|
6272
6358
|
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/gu, function (c) {
|
|
6273
6359
|
/* eslint-disable no-bitwise */
|
|
6274
|
-
const r = (d + Math.random() * 16) % 16
|
|
6360
|
+
const r = Math.trunc((d + Math.random() * 16) % 16);
|
|
6275
6361
|
d = Math.floor(d / 16);
|
|
6276
6362
|
return (c === 'x' ? r : r & 0x3 | 0x8).toString(16);
|
|
6277
6363
|
/* eslint-enable no-bitwise */
|
|
@@ -6305,6 +6391,47 @@ const cloneable = {
|
|
|
6305
6391
|
}
|
|
6306
6392
|
};
|
|
6307
6393
|
|
|
6394
|
+
/* globals crypto */
|
|
6395
|
+
const cryptokey = {
|
|
6396
|
+
cryptokey: {
|
|
6397
|
+
test(x) {
|
|
6398
|
+
return Typeson.toStringTag(x) === 'CryptoKey' && x.extractable;
|
|
6399
|
+
},
|
|
6400
|
+
|
|
6401
|
+
replaceAsync(key) {
|
|
6402
|
+
return new Typeson.Promise((resolve, reject) => {
|
|
6403
|
+
// eslint-disable-next-line promise/catch-or-return
|
|
6404
|
+
crypto.subtle.exportKey('jwk', key).catch(
|
|
6405
|
+
/* eslint-disable promise/prefer-await-to-callbacks */
|
|
6406
|
+
// istanbul ignore next
|
|
6407
|
+
err => {
|
|
6408
|
+
/* eslint-enable promise/prefer-await-to-callbacks */
|
|
6409
|
+
// eslint-disable-next-line max-len
|
|
6410
|
+
// istanbul ignore next -- Our format should be valid and our key extractable
|
|
6411
|
+
reject(err);
|
|
6412
|
+
} // eslint-disable-next-line max-len
|
|
6413
|
+
// eslint-disable-next-line promise/always-return, promise/prefer-await-to-then
|
|
6414
|
+
).then(jwk => {
|
|
6415
|
+
resolve({
|
|
6416
|
+
jwk,
|
|
6417
|
+
algorithm: key.algorithm,
|
|
6418
|
+
usages: key.usages
|
|
6419
|
+
});
|
|
6420
|
+
});
|
|
6421
|
+
});
|
|
6422
|
+
},
|
|
6423
|
+
|
|
6424
|
+
revive({
|
|
6425
|
+
jwk,
|
|
6426
|
+
algorithm,
|
|
6427
|
+
usages
|
|
6428
|
+
}) {
|
|
6429
|
+
return crypto.subtle.importKey('jwk', jwk, algorithm, true, usages);
|
|
6430
|
+
}
|
|
6431
|
+
|
|
6432
|
+
}
|
|
6433
|
+
};
|
|
6434
|
+
|
|
6308
6435
|
const dataview = {
|
|
6309
6436
|
dataview: {
|
|
6310
6437
|
test(x) {
|
|
@@ -6422,13 +6549,13 @@ const error = {
|
|
|
6422
6549
|
/* eslint-env browser, node */
|
|
6423
6550
|
/* istanbul ignore next */
|
|
6424
6551
|
|
|
6425
|
-
const _global = typeof self === 'undefined' ? global : self;
|
|
6552
|
+
const _global$2 = typeof self === 'undefined' ? global : self;
|
|
6426
6553
|
|
|
6427
6554
|
const errors = {}; // Comprises all built-in errors.
|
|
6428
6555
|
|
|
6429
6556
|
['TypeError', 'RangeError', 'SyntaxError', 'ReferenceError', 'EvalError', 'URIError', 'InternalError' // non-standard
|
|
6430
6557
|
].forEach(errName => {
|
|
6431
|
-
const Cnstrctr = _global[errName];
|
|
6558
|
+
const Cnstrctr = _global$2[errName];
|
|
6432
6559
|
|
|
6433
6560
|
if (Cnstrctr) {
|
|
6434
6561
|
errors[errName.toLowerCase()] = {
|
|
@@ -6458,9 +6585,7 @@ const file = {
|
|
|
6458
6585
|
replace(f) {
|
|
6459
6586
|
// Sync
|
|
6460
6587
|
const req = new XMLHttpRequest();
|
|
6461
|
-
req.overrideMimeType('text/plain; charset=x-user-defined');
|
|
6462
|
-
// eslint-disable-next-line node/no-unsupported-features/node-builtins
|
|
6463
|
-
|
|
6588
|
+
req.overrideMimeType('text/plain; charset=x-user-defined');
|
|
6464
6589
|
req.open('GET', URL.createObjectURL(f), false); // Sync
|
|
6465
6590
|
|
|
6466
6591
|
req.send(); // Seems not feasible to accurately simulate
|
|
@@ -6667,7 +6792,7 @@ const imagedata = {
|
|
|
6667
6792
|
const infinity = {
|
|
6668
6793
|
infinity: {
|
|
6669
6794
|
test(x) {
|
|
6670
|
-
return x ===
|
|
6795
|
+
return x === Number.POSITIVE_INFINITY;
|
|
6671
6796
|
},
|
|
6672
6797
|
|
|
6673
6798
|
replace(n) {
|
|
@@ -6675,7 +6800,7 @@ const infinity = {
|
|
|
6675
6800
|
},
|
|
6676
6801
|
|
|
6677
6802
|
revive(s) {
|
|
6678
|
-
return
|
|
6803
|
+
return Number.POSITIVE_INFINITY;
|
|
6679
6804
|
}
|
|
6680
6805
|
|
|
6681
6806
|
}
|
|
@@ -6729,7 +6854,7 @@ const intlTypes = {
|
|
|
6729
6854
|
IntlNumberFormat
|
|
6730
6855
|
};
|
|
6731
6856
|
|
|
6732
|
-
const map
|
|
6857
|
+
const map = {
|
|
6733
6858
|
map: {
|
|
6734
6859
|
test(x) {
|
|
6735
6860
|
return Typeson.toStringTag(x) === 'Map';
|
|
@@ -6766,7 +6891,7 @@ const nan = {
|
|
|
6766
6891
|
const negativeInfinity = {
|
|
6767
6892
|
negativeInfinity: {
|
|
6768
6893
|
test(x) {
|
|
6769
|
-
return x ===
|
|
6894
|
+
return x === Number.NEGATIVE_INFINITY;
|
|
6770
6895
|
},
|
|
6771
6896
|
|
|
6772
6897
|
replace(n) {
|
|
@@ -6774,7 +6899,7 @@ const negativeInfinity = {
|
|
|
6774
6899
|
},
|
|
6775
6900
|
|
|
6776
6901
|
revive(s) {
|
|
6777
|
-
return
|
|
6902
|
+
return Number.NEGATIVE_INFINITY;
|
|
6778
6903
|
}
|
|
6779
6904
|
|
|
6780
6905
|
}
|
|
@@ -6956,12 +7081,12 @@ const typedArraysSocketIO = {};
|
|
|
6956
7081
|
/* eslint-env browser, node */
|
|
6957
7082
|
/* istanbul ignore next */
|
|
6958
7083
|
|
|
6959
|
-
const _global
|
|
7084
|
+
const _global = typeof self === 'undefined' ? global : self;
|
|
6960
7085
|
|
|
6961
7086
|
const typedArrays = {};
|
|
6962
7087
|
['Int8Array', 'Uint8Array', 'Uint8ClampedArray', 'Int16Array', 'Uint16Array', 'Int32Array', 'Uint32Array', 'Float32Array', 'Float64Array'].forEach(function (typeName) {
|
|
6963
7088
|
const arrType = typeName;
|
|
6964
|
-
const TypedArray = _global
|
|
7089
|
+
const TypedArray = _global[arrType];
|
|
6965
7090
|
/* istanbul ignore if */
|
|
6966
7091
|
|
|
6967
7092
|
if (!TypedArray) {
|
|
@@ -7027,7 +7152,7 @@ const typedArrays = {};
|
|
|
7027
7152
|
});
|
|
7028
7153
|
|
|
7029
7154
|
// This does not preserve `undefined` in sparse arrays; see the `undefined`
|
|
7030
|
-
const undef = {
|
|
7155
|
+
const undef$1 = {
|
|
7031
7156
|
undef: {
|
|
7032
7157
|
test(x, stateObj) {
|
|
7033
7158
|
return typeof x === 'undefined' && (stateObj.ownKeys || !('ownKeys' in stateObj));
|
|
@@ -7053,7 +7178,7 @@ const userObject = {
|
|
|
7053
7178
|
},
|
|
7054
7179
|
|
|
7055
7180
|
replace(n) {
|
|
7056
|
-
return _objectSpread2({}, n);
|
|
7181
|
+
return _objectSpread2$1({}, n);
|
|
7057
7182
|
},
|
|
7058
7183
|
|
|
7059
7184
|
revive(s) {
|
|
@@ -7152,11 +7277,11 @@ const specialNumbers = [nan, infinity, negativeInfinity];
|
|
|
7152
7277
|
|
|
7153
7278
|
Symbols are similarly not included.
|
|
7154
7279
|
*/
|
|
7155
|
-
const expObj = [undef, // ES5
|
|
7280
|
+
const expObj$1 = [undef$1, // ES5
|
|
7156
7281
|
arrayNonindexKeys, primitiveObjects, specialNumbers, date, error, errors, regexp].concat( // ES2015 (ES6)
|
|
7157
7282
|
|
|
7158
7283
|
/* istanbul ignore next */
|
|
7159
|
-
typeof Map === 'function' ? map
|
|
7284
|
+
typeof Map === 'function' ? map : [],
|
|
7160
7285
|
/* istanbul ignore next */
|
|
7161
7286
|
typeof Set === 'function' ? set : [],
|
|
7162
7287
|
/* istanbul ignore next */
|
|
@@ -7187,7 +7312,7 @@ custom types after having registered these.
|
|
|
7187
7312
|
*/
|
|
7188
7313
|
const postmessage = [error, errors];
|
|
7189
7314
|
|
|
7190
|
-
const socketio = [expObj, // Leave ArrayBuffer as is, and let socket.io stream it instead.
|
|
7315
|
+
const socketio = [expObj$1, // Leave ArrayBuffer as is, and let socket.io stream it instead.
|
|
7191
7316
|
{
|
|
7192
7317
|
arraybuffer: null
|
|
7193
7318
|
}, // Encapsulate TypedArrays in ArrayBuffers instead of base64 strings.
|
|
@@ -7226,16 +7351,16 @@ const sparseUndefined = [{
|
|
|
7226
7351
|
}];
|
|
7227
7352
|
|
|
7228
7353
|
/* This preset includes types for the Structured Cloning Algorithm. */
|
|
7229
|
-
const expObj
|
|
7354
|
+
const expObj = [// Todo: Might also register synchronous `ImageBitmap` and
|
|
7230
7355
|
// `Blob`/`File`/`FileList`?
|
|
7231
7356
|
// ES5
|
|
7232
7357
|
userObject, // Processed last (non-builtin)
|
|
7233
|
-
undef, arrayNonindexKeys, primitiveObjects, specialNumbers, date, regexp, // Non-built-ins
|
|
7358
|
+
undef$1, arrayNonindexKeys, primitiveObjects, specialNumbers, date, regexp, // Non-built-ins
|
|
7234
7359
|
imagedata, imagebitmap, // Async return
|
|
7235
7360
|
file, filelist, blob].concat( // ES2015 (ES6)
|
|
7236
7361
|
|
|
7237
7362
|
/* istanbul ignore next */
|
|
7238
|
-
typeof Map === 'function' ? map
|
|
7363
|
+
typeof Map === 'function' ? map : [],
|
|
7239
7364
|
/* istanbul ignore next */
|
|
7240
7365
|
typeof Set === 'function' ? set : [],
|
|
7241
7366
|
/* istanbul ignore next */
|
|
@@ -7247,10 +7372,12 @@ typeof DataView === 'function' ? dataview : [],
|
|
|
7247
7372
|
/* istanbul ignore next */
|
|
7248
7373
|
typeof Intl !== 'undefined' ? intlTypes : [],
|
|
7249
7374
|
/* istanbul ignore next */
|
|
7375
|
+
typeof crypto !== 'undefined' ? cryptokey : [],
|
|
7376
|
+
/* istanbul ignore next */
|
|
7250
7377
|
typeof BigInt !== 'undefined' ? [bigint, bigintObject] : []);
|
|
7251
7378
|
|
|
7252
7379
|
/* globals DOMException */
|
|
7253
|
-
var structuredCloningThrowing = expObj
|
|
7380
|
+
var structuredCloningThrowing = expObj.concat({
|
|
7254
7381
|
checkDataCloneException: {
|
|
7255
7382
|
test(val) {
|
|
7256
7383
|
// Should also throw with:
|
|
@@ -7308,9 +7435,9 @@ var structuredCloningThrowing = expObj$1.concat({
|
|
|
7308
7435
|
}
|
|
7309
7436
|
});
|
|
7310
7437
|
|
|
7311
|
-
const undef
|
|
7438
|
+
const undef = [sparseUndefined, undef$1];
|
|
7312
7439
|
|
|
7313
|
-
const universal = [expObj // TODO: Add types that are de-facto universal even though not
|
|
7440
|
+
const universal = [expObj$1 // TODO: Add types that are de-facto universal even though not
|
|
7314
7441
|
// built-in into ecmasript standard.
|
|
7315
7442
|
];
|
|
7316
7443
|
|
|
@@ -7321,6 +7448,7 @@ Typeson.types = {
|
|
|
7321
7448
|
bigint,
|
|
7322
7449
|
blob,
|
|
7323
7450
|
cloneable,
|
|
7451
|
+
cryptokey,
|
|
7324
7452
|
dataview,
|
|
7325
7453
|
date,
|
|
7326
7454
|
error,
|
|
@@ -7331,7 +7459,7 @@ Typeson.types = {
|
|
|
7331
7459
|
imagedata,
|
|
7332
7460
|
infinity,
|
|
7333
7461
|
intlTypes,
|
|
7334
|
-
map
|
|
7462
|
+
map,
|
|
7335
7463
|
nan,
|
|
7336
7464
|
negativeInfinity,
|
|
7337
7465
|
nonbuiltinIgnore,
|
|
@@ -7341,19 +7469,19 @@ Typeson.types = {
|
|
|
7341
7469
|
set,
|
|
7342
7470
|
typedArraysSocketio: typedArraysSocketIO,
|
|
7343
7471
|
typedArrays,
|
|
7344
|
-
undef,
|
|
7472
|
+
undef: undef$1,
|
|
7345
7473
|
userObject
|
|
7346
7474
|
};
|
|
7347
7475
|
Typeson.presets = {
|
|
7348
7476
|
arrayNonindexKeys,
|
|
7349
|
-
builtin: expObj,
|
|
7477
|
+
builtin: expObj$1,
|
|
7350
7478
|
postmessage,
|
|
7351
7479
|
socketio,
|
|
7352
7480
|
sparseUndefined,
|
|
7353
7481
|
specialNumbers,
|
|
7354
7482
|
structuredCloningThrowing,
|
|
7355
|
-
structuredCloning: expObj
|
|
7356
|
-
undef: undef
|
|
7483
|
+
structuredCloning: expObj,
|
|
7484
|
+
undef: undef,
|
|
7357
7485
|
universal
|
|
7358
7486
|
};
|
|
7359
7487
|
|
|
@@ -7366,7 +7494,7 @@ function register(func) {
|
|
|
7366
7494
|
// should probably refactor as a Promise)
|
|
7367
7495
|
|
|
7368
7496
|
|
|
7369
|
-
function encode
|
|
7497
|
+
function encode(obj, func) {
|
|
7370
7498
|
let ret;
|
|
7371
7499
|
|
|
7372
7500
|
try {
|
|
@@ -7378,7 +7506,7 @@ function encode$2(obj, func) {
|
|
|
7378
7506
|
// supporting environment (e.g., the browser) where `ShimDOMException` is
|
|
7379
7507
|
// an alias for `DOMException`; if typeson-registry ever uses our shim
|
|
7380
7508
|
// to throw, we can use this condition alone.
|
|
7381
|
-
Typeson.hasConstructorOf(err, ShimDOMException
|
|
7509
|
+
Typeson.hasConstructorOf(err, ShimDOMException)) {
|
|
7382
7510
|
throw createDOMException('DataCloneError', 'The object cannot be cloned.');
|
|
7383
7511
|
} // We should rethrow non-cloning exceptions like from
|
|
7384
7512
|
// throwing getters (as in the W3C test, key-conversion-exceptions.htm)
|
|
@@ -7391,25 +7519,25 @@ function encode$2(obj, func) {
|
|
|
7391
7519
|
return ret;
|
|
7392
7520
|
}
|
|
7393
7521
|
|
|
7394
|
-
function decode
|
|
7522
|
+
function decode(obj) {
|
|
7395
7523
|
return typeson.parse(obj);
|
|
7396
7524
|
}
|
|
7397
7525
|
|
|
7398
7526
|
function clone(val) {
|
|
7399
7527
|
// We don't return the intermediate `encode` as we'll need to reencode
|
|
7400
7528
|
// the clone as it may differ
|
|
7401
|
-
return decode
|
|
7529
|
+
return decode(encode(val));
|
|
7402
7530
|
}
|
|
7403
7531
|
|
|
7404
7532
|
var Sca = /*#__PURE__*/Object.freeze({
|
|
7405
7533
|
__proto__: null,
|
|
7406
|
-
encode: encode
|
|
7407
|
-
decode: decode
|
|
7534
|
+
encode: encode,
|
|
7535
|
+
decode: decode,
|
|
7408
7536
|
clone: clone,
|
|
7409
7537
|
register: register
|
|
7410
7538
|
});
|
|
7411
7539
|
|
|
7412
|
-
const readonlyProperties$
|
|
7540
|
+
const readonlyProperties$2 = ['objectStore', 'keyPath', 'multiEntry', 'unique'];
|
|
7413
7541
|
/* eslint-disable jsdoc/check-param-names */
|
|
7414
7542
|
|
|
7415
7543
|
/**
|
|
@@ -7431,7 +7559,7 @@ IDBIndex.__createInstance = function (store, indexProperties) {
|
|
|
7431
7559
|
function IDBIndex() {
|
|
7432
7560
|
const me = this;
|
|
7433
7561
|
me[Symbol.toStringTag] = 'IDBIndex';
|
|
7434
|
-
defineReadonlyProperties(me, readonlyProperties$
|
|
7562
|
+
defineReadonlyProperties(me, readonlyProperties$2);
|
|
7435
7563
|
me.__objectStore = store;
|
|
7436
7564
|
me.__name = me.__originalName = indexProperties.columnName;
|
|
7437
7565
|
me.__keyPath = Array.isArray(indexProperties.keyPath) ? indexProperties.keyPath.slice() : indexProperties.keyPath;
|
|
@@ -7586,7 +7714,7 @@ IDBIndex.__createIndex = function (store, index) {
|
|
|
7586
7714
|
function addIndexEntry(i) {
|
|
7587
7715
|
if (i < data.rows.length) {
|
|
7588
7716
|
try {
|
|
7589
|
-
const value = decode
|
|
7717
|
+
const value = decode(unescapeSQLiteResponse(data.rows.item(i).value));
|
|
7590
7718
|
let indexKey = extractKeyValueDecodedFromValueUsingKeyPath(value, index.keyPath, index.multiEntry); // Todo: Do we need this stricter error checking?
|
|
7591
7719
|
|
|
7592
7720
|
if (indexKey.invalid || indexKey.failure) {
|
|
@@ -7594,7 +7722,7 @@ IDBIndex.__createIndex = function (store, index) {
|
|
|
7594
7722
|
throw new Error('Go to catch; ignore bad indexKey');
|
|
7595
7723
|
}
|
|
7596
7724
|
|
|
7597
|
-
indexKey = encode(indexKey.value, index.multiEntry);
|
|
7725
|
+
indexKey = encode$2(indexKey.value, index.multiEntry);
|
|
7598
7726
|
|
|
7599
7727
|
if (index.unique) {
|
|
7600
7728
|
if (indexValues[indexKey]) {
|
|
@@ -7793,9 +7921,9 @@ IDBIndex.prototype.__fetchIndexData = function (range, opType, nullDisallowed, c
|
|
|
7793
7921
|
*/
|
|
7794
7922
|
|
|
7795
7923
|
|
|
7796
|
-
IDBIndex.prototype.openCursor = function
|
|
7797
|
-
/* query, direction */
|
|
7798
|
-
{
|
|
7924
|
+
IDBIndex.prototype.openCursor = function
|
|
7925
|
+
/* query, direction */
|
|
7926
|
+
() {
|
|
7799
7927
|
/* eslint-enable jsdoc/check-param-names */
|
|
7800
7928
|
const me = this; // eslint-disable-next-line prefer-rest-params
|
|
7801
7929
|
|
|
@@ -7817,9 +7945,9 @@ IDBIndex.prototype.openCursor = function ()
|
|
|
7817
7945
|
*/
|
|
7818
7946
|
|
|
7819
7947
|
|
|
7820
|
-
IDBIndex.prototype.openKeyCursor = function
|
|
7821
|
-
/* query, direction */
|
|
7822
|
-
{
|
|
7948
|
+
IDBIndex.prototype.openKeyCursor = function
|
|
7949
|
+
/* query, direction */
|
|
7950
|
+
() {
|
|
7823
7951
|
/* eslint-enable jsdoc/check-param-names */
|
|
7824
7952
|
const me = this; // eslint-disable-next-line prefer-rest-params
|
|
7825
7953
|
|
|
@@ -7850,25 +7978,25 @@ IDBIndex.prototype.getKey = function (query) {
|
|
|
7850
7978
|
return this.__fetchIndexData(query, 'key', true);
|
|
7851
7979
|
};
|
|
7852
7980
|
|
|
7853
|
-
IDBIndex.prototype.getAll = function
|
|
7854
|
-
/* query, count */
|
|
7855
|
-
{
|
|
7981
|
+
IDBIndex.prototype.getAll = function
|
|
7982
|
+
/* query, count */
|
|
7983
|
+
() {
|
|
7856
7984
|
// eslint-disable-next-line prefer-rest-params
|
|
7857
7985
|
const [query, count] = arguments;
|
|
7858
7986
|
return this.__fetchIndexData(query, 'value', false, count);
|
|
7859
7987
|
};
|
|
7860
7988
|
|
|
7861
|
-
IDBIndex.prototype.getAllKeys = function
|
|
7862
|
-
/* query, count */
|
|
7863
|
-
{
|
|
7989
|
+
IDBIndex.prototype.getAllKeys = function
|
|
7990
|
+
/* query, count */
|
|
7991
|
+
() {
|
|
7864
7992
|
// eslint-disable-next-line prefer-rest-params
|
|
7865
7993
|
const [query, count] = arguments;
|
|
7866
7994
|
return this.__fetchIndexData(query, 'key', false, count);
|
|
7867
7995
|
};
|
|
7868
7996
|
|
|
7869
|
-
IDBIndex.prototype.count = function
|
|
7870
|
-
/* query */
|
|
7871
|
-
{
|
|
7997
|
+
IDBIndex.prototype.count = function
|
|
7998
|
+
/* query */
|
|
7999
|
+
() {
|
|
7872
8000
|
const me = this; // eslint-disable-next-line prefer-rest-params
|
|
7873
8001
|
|
|
7874
8002
|
const query = arguments[0]; // With the exception of needing to check whether the index has been
|
|
@@ -7974,7 +8102,7 @@ IDBIndex.prototype.__renameIndex = function (store, oldName, newName, colInfoToP
|
|
|
7974
8102
|
Object.defineProperty(IDBIndex, Symbol.hasInstance, {
|
|
7975
8103
|
value: obj => isObj(obj) && typeof obj.openCursor === 'function' && typeof obj.multiEntry === 'boolean'
|
|
7976
8104
|
});
|
|
7977
|
-
defineReadonlyOuterInterface(IDBIndex.prototype, readonlyProperties$
|
|
8105
|
+
defineReadonlyOuterInterface(IDBIndex.prototype, readonlyProperties$2);
|
|
7978
8106
|
defineOuterInterface(IDBIndex.prototype, ['name']);
|
|
7979
8107
|
IDBIndex.prototype[Symbol.toStringTag] = 'IDBIndexPrototype';
|
|
7980
8108
|
Object.defineProperty(IDBIndex, 'prototype', {
|
|
@@ -7999,19 +8127,19 @@ function executeFetchIndexData(count, unboundedDisallowed, index, hasKey, range,
|
|
|
7999
8127
|
/* */
|
|
8000
8128
|
} : opType === 'key' ? record => {
|
|
8001
8129
|
// Key.convertValueToKey(record.key); // Already validated before storage
|
|
8002
|
-
return decode(unescapeSQLiteResponse(record.key));
|
|
8130
|
+
return decode$2(unescapeSQLiteResponse(record.key));
|
|
8003
8131
|
} : record => {
|
|
8004
8132
|
// when opType is value
|
|
8005
|
-
return decode
|
|
8133
|
+
return decode(unescapeSQLiteResponse(record.value));
|
|
8006
8134
|
};
|
|
8007
8135
|
|
|
8008
8136
|
if (index.multiEntry) {
|
|
8009
8137
|
const escapedIndexNameForKeyCol = escapeIndexNameForSQLKeyColumn(index.name);
|
|
8010
|
-
const encodedKey = encode(range, index.multiEntry);
|
|
8138
|
+
const encodedKey = encode$2(range, index.multiEntry);
|
|
8011
8139
|
|
|
8012
8140
|
for (let i = 0; i < data.rows.length; i++) {
|
|
8013
8141
|
const row = data.rows.item(i);
|
|
8014
|
-
const rowKey = decode(row[escapedIndexNameForKeyCol]);
|
|
8142
|
+
const rowKey = decode$2(row[escapedIndexNameForKeyCol]);
|
|
8015
8143
|
let record;
|
|
8016
8144
|
|
|
8017
8145
|
if (hasKey && (multiChecks && range.some(check => rowKey.includes(check)) || // More precise than our SQL
|
|
@@ -8068,12 +8196,12 @@ function buildFetchIndexDataSQL(nullDisallowed, index, range, opType, multiCheck
|
|
|
8068
8196
|
range.forEach((innerKey, i) => {
|
|
8069
8197
|
if (i > 0) sql.push('OR');
|
|
8070
8198
|
sql.push(escapeIndexNameForSQL(index.name), "LIKE ? ESCAPE '^' ");
|
|
8071
|
-
sqlValues.push('%' + sqlLIKEEscape(encode(innerKey, index.multiEntry)) + '%');
|
|
8199
|
+
sqlValues.push('%' + sqlLIKEEscape(encode$2(innerKey, index.multiEntry)) + '%');
|
|
8072
8200
|
});
|
|
8073
8201
|
sql.push(')');
|
|
8074
8202
|
} else if (index.multiEntry) {
|
|
8075
8203
|
sql.push('AND', escapeIndexNameForSQL(index.name), "LIKE ? ESCAPE '^'");
|
|
8076
|
-
sqlValues.push('%' + sqlLIKEEscape(encode(range, index.multiEntry)) + '%');
|
|
8204
|
+
sqlValues.push('%' + sqlLIKEEscape(encode$2(range, index.multiEntry)) + '%');
|
|
8077
8205
|
} else {
|
|
8078
8206
|
const convertedRange = convertValueToKeyRange(range, nullDisallowed);
|
|
8079
8207
|
setSQLForKeyRange(convertedRange, escapeIndexNameForSQL(index.name), sql, sqlValues, true, false);
|
|
@@ -8083,7 +8211,7 @@ function buildFetchIndexDataSQL(nullDisallowed, index, range, opType, multiCheck
|
|
|
8083
8211
|
return [nullDisallowed, index, hasRange, range, opType, multiChecks, sql, sqlValues];
|
|
8084
8212
|
}
|
|
8085
8213
|
|
|
8086
|
-
const readonlyProperties$
|
|
8214
|
+
const readonlyProperties$1 = ['keyPath', 'indexNames', 'transaction', 'autoIncrement'];
|
|
8087
8215
|
/* eslint-disable jsdoc/check-param-names */
|
|
8088
8216
|
|
|
8089
8217
|
/**
|
|
@@ -8105,7 +8233,7 @@ IDBObjectStore.__createInstance = function (storeProperties, transaction) {
|
|
|
8105
8233
|
function IDBObjectStore() {
|
|
8106
8234
|
const me = this;
|
|
8107
8235
|
me[Symbol.toStringTag] = 'IDBObjectStore';
|
|
8108
|
-
defineReadonlyProperties(this, readonlyProperties$
|
|
8236
|
+
defineReadonlyProperties(this, readonlyProperties$1);
|
|
8109
8237
|
me.__name = me.__originalName = storeProperties.name;
|
|
8110
8238
|
me.__keyPath = Array.isArray(storeProperties.keyPath) ? storeProperties.keyPath.slice() : storeProperties.keyPath;
|
|
8111
8239
|
me.__transaction = transaction;
|
|
@@ -8121,7 +8249,7 @@ IDBObjectStore.__createInstance = function (storeProperties, transaction) {
|
|
|
8121
8249
|
} = storeProperties;
|
|
8122
8250
|
|
|
8123
8251
|
for (const indexName in indexList) {
|
|
8124
|
-
if (hasOwn(indexList, indexName)) {
|
|
8252
|
+
if (hasOwn$2(indexList, indexName)) {
|
|
8125
8253
|
const index = IDBIndex.__createInstance(me, indexList[indexName]);
|
|
8126
8254
|
|
|
8127
8255
|
me.__indexes[index.name] = index;
|
|
@@ -8444,8 +8572,8 @@ IDBObjectStore.prototype.__deriveKey = function (tx, value, key, success, failCb
|
|
|
8444
8572
|
|
|
8445
8573
|
function keyCloneThenSuccess(oldCn) {
|
|
8446
8574
|
// We want to return the original key, so we don't need to accept an argument here
|
|
8447
|
-
encode
|
|
8448
|
-
key = decode
|
|
8575
|
+
encode(key, function (key) {
|
|
8576
|
+
key = decode(key);
|
|
8449
8577
|
success(key, oldCn);
|
|
8450
8578
|
});
|
|
8451
8579
|
}
|
|
@@ -8527,7 +8655,7 @@ IDBObjectStore.prototype.__insertData = function (tx, encoded, value, clonedKeyO
|
|
|
8527
8655
|
return;
|
|
8528
8656
|
}
|
|
8529
8657
|
|
|
8530
|
-
paramMap[index.__currentName] = encode(indexKey, index.multiEntry);
|
|
8658
|
+
paramMap[index.__currentName] = encode$2(indexKey, index.multiEntry);
|
|
8531
8659
|
}
|
|
8532
8660
|
|
|
8533
8661
|
if (index.unique) {
|
|
@@ -8557,7 +8685,7 @@ IDBObjectStore.prototype.__insertData = function (tx, encoded, value, clonedKeyO
|
|
|
8557
8685
|
// Key.convertValueToKey(primaryKey); // Already run
|
|
8558
8686
|
sqlStart.push(sqlQuote('key'), ',');
|
|
8559
8687
|
sqlEnd.push('?,');
|
|
8560
|
-
insertSqlValues.push(escapeSQLiteStatement(encode(clonedKeyOrCurrentNumber)));
|
|
8688
|
+
insertSqlValues.push(escapeSQLiteStatement(encode$2(clonedKeyOrCurrentNumber)));
|
|
8561
8689
|
}
|
|
8562
8690
|
|
|
8563
8691
|
Object.entries(paramMap).forEach(([key, stmt]) => {
|
|
@@ -8580,7 +8708,8 @@ IDBObjectStore.prototype.__insertData = function (tx, encoded, value, clonedKeyO
|
|
|
8580
8708
|
return undefined;
|
|
8581
8709
|
}).catch(function (err) {
|
|
8582
8710
|
function fail() {
|
|
8583
|
-
// Todo: Add a different error object here if `assignCurrentNumber`
|
|
8711
|
+
// Todo: Add a different error object here if `assignCurrentNumber`
|
|
8712
|
+
// fails in reverting?
|
|
8584
8713
|
error(err);
|
|
8585
8714
|
}
|
|
8586
8715
|
|
|
@@ -8658,7 +8787,7 @@ IDBObjectStore.prototype.__overwrite = function (tx, key, cb, error) {
|
|
|
8658
8787
|
// Key.convertValueToKey(key); // Already run
|
|
8659
8788
|
|
|
8660
8789
|
const sql = 'DELETE FROM ' + escapeStoreNameForSQL(me.__currentName) + ' WHERE "key" = ?';
|
|
8661
|
-
const encodedKey = encode(key);
|
|
8790
|
+
const encodedKey = encode$2(key);
|
|
8662
8791
|
tx.executeSql(sql, [escapeSQLiteStatement(encodedKey)], function (tx, data) {
|
|
8663
8792
|
CFG.DEBUG && console.log('Did the row with the', key, 'exist?', data.rowsAffected);
|
|
8664
8793
|
cb(tx);
|
|
@@ -8675,7 +8804,7 @@ IDBObjectStore.__storingRecordObjectStore = function (request, store, invalidate
|
|
|
8675
8804
|
|
|
8676
8805
|
store.transaction.__pushToQueue(request, function (tx, args, success, error) {
|
|
8677
8806
|
store.__deriveKey(tx, value, key, function (clonedKeyOrCurrentNumber, oldCn) {
|
|
8678
|
-
encode
|
|
8807
|
+
encode(value, function (encoded) {
|
|
8679
8808
|
function insert(tx) {
|
|
8680
8809
|
store.__insertData(tx, encoded, value, clonedKeyOrCurrentNumber, oldCn, function (...args) {
|
|
8681
8810
|
if (invalidateCache) {
|
|
@@ -8757,11 +8886,11 @@ IDBObjectStore.prototype.__get = function (query, getKey, getAll, count) {
|
|
|
8757
8886
|
if (getKey) {
|
|
8758
8887
|
for (let i = 0; i < data.rows.length; i++) {
|
|
8759
8888
|
// Key.convertValueToKey(data.rows.item(i).key); // Already validated before storage
|
|
8760
|
-
ret.push(decode(unescapeSQLiteResponse(data.rows.item(i).key), false));
|
|
8889
|
+
ret.push(decode$2(unescapeSQLiteResponse(data.rows.item(i).key), false));
|
|
8761
8890
|
}
|
|
8762
8891
|
} else {
|
|
8763
8892
|
for (let i = 0; i < data.rows.length; i++) {
|
|
8764
|
-
ret.push(decode
|
|
8893
|
+
ret.push(decode(unescapeSQLiteResponse(data.rows.item(i).value)));
|
|
8765
8894
|
}
|
|
8766
8895
|
}
|
|
8767
8896
|
|
|
@@ -8796,17 +8925,17 @@ IDBObjectStore.prototype.getKey = function (query) {
|
|
|
8796
8925
|
return this.__get(query, true);
|
|
8797
8926
|
};
|
|
8798
8927
|
|
|
8799
|
-
IDBObjectStore.prototype.getAll = function
|
|
8800
|
-
/* query, count */
|
|
8801
|
-
{
|
|
8928
|
+
IDBObjectStore.prototype.getAll = function
|
|
8929
|
+
/* query, count */
|
|
8930
|
+
() {
|
|
8802
8931
|
// eslint-disable-next-line prefer-rest-params
|
|
8803
8932
|
const [query, count] = arguments;
|
|
8804
8933
|
return this.__get(query, false, true, count);
|
|
8805
8934
|
};
|
|
8806
8935
|
|
|
8807
|
-
IDBObjectStore.prototype.getAllKeys = function
|
|
8808
|
-
/* query, count */
|
|
8809
|
-
{
|
|
8936
|
+
IDBObjectStore.prototype.getAllKeys = function
|
|
8937
|
+
/* query, count */
|
|
8938
|
+
() {
|
|
8810
8939
|
// eslint-disable-next-line prefer-rest-params
|
|
8811
8940
|
const [query, count] = arguments;
|
|
8812
8941
|
return this.__get(query, true, true, count);
|
|
@@ -8880,9 +9009,9 @@ IDBObjectStore.prototype.clear = function () {
|
|
|
8880
9009
|
}, undefined, me);
|
|
8881
9010
|
};
|
|
8882
9011
|
|
|
8883
|
-
IDBObjectStore.prototype.count = function
|
|
8884
|
-
/* query */
|
|
8885
|
-
{
|
|
9012
|
+
IDBObjectStore.prototype.count = function
|
|
9013
|
+
/* query */
|
|
9014
|
+
() {
|
|
8886
9015
|
const me = this; // eslint-disable-next-line prefer-rest-params
|
|
8887
9016
|
|
|
8888
9017
|
const query = arguments[0];
|
|
@@ -8899,9 +9028,9 @@ IDBObjectStore.prototype.count = function ()
|
|
|
8899
9028
|
return IDBCursorWithValue.__createInstance(query, 'next', me, me, 'key', 'value', true).__request;
|
|
8900
9029
|
};
|
|
8901
9030
|
|
|
8902
|
-
IDBObjectStore.prototype.openCursor = function
|
|
8903
|
-
/* query, direction */
|
|
8904
|
-
{
|
|
9031
|
+
IDBObjectStore.prototype.openCursor = function
|
|
9032
|
+
/* query, direction */
|
|
9033
|
+
() {
|
|
8905
9034
|
const me = this; // eslint-disable-next-line prefer-rest-params
|
|
8906
9035
|
|
|
8907
9036
|
const [query, direction] = arguments;
|
|
@@ -8919,9 +9048,9 @@ IDBObjectStore.prototype.openCursor = function ()
|
|
|
8919
9048
|
return cursor.__request;
|
|
8920
9049
|
};
|
|
8921
9050
|
|
|
8922
|
-
IDBObjectStore.prototype.openKeyCursor = function
|
|
8923
|
-
/* query, direction */
|
|
8924
|
-
{
|
|
9051
|
+
IDBObjectStore.prototype.openKeyCursor = function
|
|
9052
|
+
/* query, direction */
|
|
9053
|
+
() {
|
|
8925
9054
|
const me = this;
|
|
8926
9055
|
|
|
8927
9056
|
if (!(me instanceof IDBObjectStore)) {
|
|
@@ -9021,7 +9150,7 @@ IDBObjectStore.prototype.createIndex = function (indexName, keyPath
|
|
|
9021
9150
|
}
|
|
9022
9151
|
|
|
9023
9152
|
optionalParameters = optionalParameters || {};
|
|
9024
|
-
/** @name IDBIndexProperties
|
|
9153
|
+
/** @name IDBIndexProperties */
|
|
9025
9154
|
|
|
9026
9155
|
const indexProperties = {
|
|
9027
9156
|
columnName: indexName,
|
|
@@ -9065,15 +9194,15 @@ IDBObjectStore.prototype.deleteIndex = function (name) {
|
|
|
9065
9194
|
IDBIndex.__deleteIndex(me, index);
|
|
9066
9195
|
};
|
|
9067
9196
|
|
|
9068
|
-
defineReadonlyOuterInterface(IDBObjectStore.prototype, readonlyProperties$
|
|
9197
|
+
defineReadonlyOuterInterface(IDBObjectStore.prototype, readonlyProperties$1);
|
|
9069
9198
|
defineOuterInterface(IDBObjectStore.prototype, ['name']);
|
|
9070
9199
|
IDBObjectStore.prototype[Symbol.toStringTag] = 'IDBObjectStorePrototype';
|
|
9071
9200
|
Object.defineProperty(IDBObjectStore, 'prototype', {
|
|
9072
9201
|
writable: false
|
|
9073
9202
|
});
|
|
9074
9203
|
|
|
9075
|
-
const listeners
|
|
9076
|
-
const readonlyProperties
|
|
9204
|
+
const listeners = ['onabort', 'onclose', 'onerror', 'onversionchange'];
|
|
9205
|
+
const readonlyProperties = ['name', 'version', 'objectStoreNames'];
|
|
9077
9206
|
/**
|
|
9078
9207
|
* IDB Database Object.
|
|
9079
9208
|
* @see http://dvcs.w3.org/hg/IndexedDB/raw-file/tip/Overview.html#database-interface
|
|
@@ -9089,14 +9218,14 @@ const IDBDatabaseAlias = IDBDatabase;
|
|
|
9089
9218
|
IDBDatabase.__createInstance = function (db, name, oldVersion, version, storeProperties) {
|
|
9090
9219
|
function IDBDatabase() {
|
|
9091
9220
|
this[Symbol.toStringTag] = 'IDBDatabase';
|
|
9092
|
-
defineReadonlyProperties(this, readonlyProperties
|
|
9221
|
+
defineReadonlyProperties(this, readonlyProperties);
|
|
9093
9222
|
this.__db = db;
|
|
9094
9223
|
this.__closePending = false;
|
|
9095
9224
|
this.__oldVersion = oldVersion;
|
|
9096
9225
|
this.__version = version;
|
|
9097
9226
|
this.__name = name;
|
|
9098
9227
|
this.__upgradeTransaction = null;
|
|
9099
|
-
defineListenerProperties(this, listeners
|
|
9228
|
+
defineListenerProperties(this, listeners);
|
|
9100
9229
|
|
|
9101
9230
|
this.__setOptions({
|
|
9102
9231
|
legacyOutputDidListenersThrowFlag: true // Event hook for IndexedB
|
|
@@ -9172,7 +9301,7 @@ IDBDatabase.prototype.createObjectStore = function (storeName
|
|
|
9172
9301
|
|
|
9173
9302
|
IDBTransaction.__assertActive(this.__versionTransaction);
|
|
9174
9303
|
|
|
9175
|
-
createOptions = _objectSpread2({}, createOptions);
|
|
9304
|
+
createOptions = _objectSpread2$1({}, createOptions);
|
|
9176
9305
|
let {
|
|
9177
9306
|
keyPath
|
|
9178
9307
|
} = createOptions;
|
|
@@ -9191,7 +9320,7 @@ IDBDatabase.prototype.createObjectStore = function (storeName
|
|
|
9191
9320
|
if (autoInc && (keyPath === '' || Array.isArray(keyPath))) {
|
|
9192
9321
|
throw createDOMException('InvalidAccessError', 'With autoIncrement set, the keyPath argument must not be an array or empty string.');
|
|
9193
9322
|
}
|
|
9194
|
-
/** @name IDBObjectStoreProperties
|
|
9323
|
+
/** @name IDBObjectStoreProperties */
|
|
9195
9324
|
|
|
9196
9325
|
|
|
9197
9326
|
const storeProperties = {
|
|
@@ -9357,8 +9486,8 @@ IDBDatabase.prototype.__forceClose = function (msg) {
|
|
|
9357
9486
|
});
|
|
9358
9487
|
};
|
|
9359
9488
|
|
|
9360
|
-
defineOuterInterface(IDBDatabase.prototype, listeners
|
|
9361
|
-
defineReadonlyOuterInterface(IDBDatabase.prototype, readonlyProperties
|
|
9489
|
+
defineOuterInterface(IDBDatabase.prototype, listeners);
|
|
9490
|
+
defineReadonlyOuterInterface(IDBDatabase.prototype, readonlyProperties);
|
|
9362
9491
|
Object.defineProperty(IDBDatabase.prototype, 'constructor', {
|
|
9363
9492
|
enumerable: false,
|
|
9364
9493
|
writable: true,
|
|
@@ -9370,10 +9499,10 @@ Object.defineProperty(IDBDatabase, 'prototype', {
|
|
|
9370
9499
|
});
|
|
9371
9500
|
|
|
9372
9501
|
/* globals location */
|
|
9373
|
-
let fs;
|
|
9502
|
+
let fs$1;
|
|
9374
9503
|
|
|
9375
9504
|
const setFS = _fs => {
|
|
9376
|
-
fs = _fs;
|
|
9505
|
+
fs$1 = _fs;
|
|
9377
9506
|
};
|
|
9378
9507
|
|
|
9379
9508
|
const getOrigin = () => {
|
|
@@ -9541,8 +9670,8 @@ function cleanupDatabaseResources(__openDatabase, name, escapedDatabaseName, dat
|
|
|
9541
9670
|
return;
|
|
9542
9671
|
}
|
|
9543
9672
|
|
|
9544
|
-
if (fs && CFG.deleteDatabaseFiles !== false) {
|
|
9545
|
-
fs.unlink(
|
|
9673
|
+
if (fs$1 && CFG.deleteDatabaseFiles !== false) {
|
|
9674
|
+
fs$1.unlink(path__default["default"].join(CFG.databaseBasePath || '', escapedDatabaseName), err => {
|
|
9546
9675
|
if (err && err.code !== 'ENOENT') {
|
|
9547
9676
|
// Ignore if file is already deleted
|
|
9548
9677
|
dbError({
|
|
@@ -9557,7 +9686,7 @@ function cleanupDatabaseResources(__openDatabase, name, escapedDatabaseName, dat
|
|
|
9557
9686
|
return;
|
|
9558
9687
|
}
|
|
9559
9688
|
|
|
9560
|
-
const sqliteDB = __openDatabase(
|
|
9689
|
+
const sqliteDB = __openDatabase(path__default["default"].join(CFG.databaseBasePath || '', escapedDatabaseName), 1, name, CFG.DEFAULT_DB_SIZE);
|
|
9561
9690
|
|
|
9562
9691
|
sqliteDB.transaction(function (tx) {
|
|
9563
9692
|
tx.executeSql('SELECT "name" FROM __sys__', [], function (tx, data) {
|
|
@@ -9609,7 +9738,7 @@ function createSysDB(__openDatabase, success, failure) {
|
|
|
9609
9738
|
if (sysdb) {
|
|
9610
9739
|
success();
|
|
9611
9740
|
} else {
|
|
9612
|
-
sysdb = __openDatabase(typeof CFG.memoryDatabase === 'string' ? CFG.memoryDatabase :
|
|
9741
|
+
sysdb = __openDatabase(typeof CFG.memoryDatabase === 'string' ? CFG.memoryDatabase : path__default["default"].join(typeof CFG.sysDatabaseBasePath === 'string' ? CFG.sysDatabaseBasePath : CFG.databaseBasePath || '', '__sysdb__' + (CFG.addSQLiteExtension !== false ? '.sqlite' : '')), 1, 'System Database', CFG.DEFAULT_DB_SIZE);
|
|
9613
9742
|
sysdb.transaction(function (systx) {
|
|
9614
9743
|
systx.executeSql('CREATE TABLE IF NOT EXISTS dbVersions (name BLOB, version INT);', [], function (systx) {
|
|
9615
9744
|
if (!CFG.useSQLiteIndexes) {
|
|
@@ -9903,7 +10032,7 @@ IDBFactory.prototype.open = function (name
|
|
|
9903
10032
|
if ((useMemoryDatabase || useDatabaseCache) && name in websqlDBCache && websqlDBCache[name][version]) {
|
|
9904
10033
|
db = websqlDBCache[name][version];
|
|
9905
10034
|
} else {
|
|
9906
|
-
db = me.__openDatabase(useMemoryDatabase ? CFG.memoryDatabase :
|
|
10035
|
+
db = me.__openDatabase(useMemoryDatabase ? CFG.memoryDatabase : path__default["default"].join(CFG.databaseBasePath || '', escapedDatabaseName), 1, name, CFG.DEFAULT_DB_SIZE);
|
|
9907
10036
|
|
|
9908
10037
|
if (useDatabaseCache) {
|
|
9909
10038
|
if (!(name in websqlDBCache)) {
|
|
@@ -10310,8 +10439,8 @@ IDBCursor.__super = function IDBCursor(query, direction, store, source, keyColum
|
|
|
10310
10439
|
|
|
10311
10440
|
if (range !== undefined) {
|
|
10312
10441
|
// Encode the key range and cache the encoded values, so we don't have to re-encode them over and over
|
|
10313
|
-
range.__lowerCached = range.lower !== undefined && encode(range.lower, this.__multiEntryIndex);
|
|
10314
|
-
range.__upperCached = range.upper !== undefined && encode(range.upper, this.__multiEntryIndex);
|
|
10442
|
+
range.__lowerCached = range.lower !== undefined && encode$2(range.lower, this.__multiEntryIndex);
|
|
10443
|
+
range.__upperCached = range.upper !== undefined && encode$2(range.upper, this.__multiEntryIndex);
|
|
10315
10444
|
}
|
|
10316
10445
|
|
|
10317
10446
|
this.__gotValue = true;
|
|
@@ -10351,17 +10480,17 @@ IDBCursor.prototype.__findBasic = function (key, primaryKey, tx, success, error,
|
|
|
10351
10480
|
if (primaryKey !== undefined) {
|
|
10352
10481
|
sql.push('AND', quotedKey, op + '= ?'); // Key.convertValueToKey(primaryKey); // Already checked by `continuePrimaryKey`
|
|
10353
10482
|
|
|
10354
|
-
sqlValues.push(encode(primaryKey));
|
|
10483
|
+
sqlValues.push(encode$2(primaryKey));
|
|
10355
10484
|
}
|
|
10356
10485
|
|
|
10357
10486
|
if (key !== undefined) {
|
|
10358
10487
|
sql.push('AND', quotedKeyColumnName, op + '= ?'); // Key.convertValueToKey(key); // Already checked by `continue` or `continuePrimaryKey`
|
|
10359
10488
|
|
|
10360
|
-
sqlValues.push(encode(key));
|
|
10489
|
+
sqlValues.push(encode$2(key));
|
|
10361
10490
|
} else if (continueCall && me.__key !== undefined) {
|
|
10362
10491
|
sql.push('AND', quotedKeyColumnName, op + ' ?'); // Key.convertValueToKey(me.__key); // Already checked when stored
|
|
10363
10492
|
|
|
10364
|
-
sqlValues.push(encode(me.__key));
|
|
10493
|
+
sqlValues.push(encode$2(me.__key));
|
|
10365
10494
|
}
|
|
10366
10495
|
|
|
10367
10496
|
if (!me.__count) {
|
|
@@ -10442,17 +10571,17 @@ IDBCursor.prototype.__findMultiEntry = function (key, primaryKey, tx, success, e
|
|
|
10442
10571
|
if (primaryKey !== undefined) {
|
|
10443
10572
|
sql.push('AND', quotedKey, op + '= ?'); // Key.convertValueToKey(primaryKey); // Already checked by `continuePrimaryKey`
|
|
10444
10573
|
|
|
10445
|
-
sqlValues.push(encode(primaryKey));
|
|
10574
|
+
sqlValues.push(encode$2(primaryKey));
|
|
10446
10575
|
}
|
|
10447
10576
|
|
|
10448
10577
|
if (key !== undefined) {
|
|
10449
10578
|
sql.push('AND', quotedKeyColumnName, op + '= ?'); // Key.convertValueToKey(key); // Already checked by `continue` or `continuePrimaryKey`
|
|
10450
10579
|
|
|
10451
|
-
sqlValues.push(encode(key));
|
|
10580
|
+
sqlValues.push(encode$2(key));
|
|
10452
10581
|
} else if (me.__key !== undefined) {
|
|
10453
10582
|
sql.push('AND', quotedKeyColumnName, op + ' ?'); // Key.convertValueToKey(me.__key); // Already checked when entered
|
|
10454
10583
|
|
|
10455
|
-
sqlValues.push(encode(me.__key));
|
|
10584
|
+
sqlValues.push(encode$2(me.__key));
|
|
10456
10585
|
}
|
|
10457
10586
|
|
|
10458
10587
|
if (!me.__count) {
|
|
@@ -10481,7 +10610,7 @@ IDBCursor.prototype.__findMultiEntry = function (key, primaryKey, tx, success, e
|
|
|
10481
10610
|
|
|
10482
10611
|
for (let i = 0; i < data.rows.length; i++) {
|
|
10483
10612
|
const rowItem = data.rows.item(i);
|
|
10484
|
-
const rowKey = decode(rowItem[me.__keyColumnName], true);
|
|
10613
|
+
const rowKey = decode$2(rowItem[me.__keyColumnName], true);
|
|
10485
10614
|
const matches = findMultiEntryMatches(rowKey, me.__range);
|
|
10486
10615
|
ct += matches.length;
|
|
10487
10616
|
}
|
|
@@ -10494,12 +10623,12 @@ IDBCursor.prototype.__findMultiEntry = function (key, primaryKey, tx, success, e
|
|
|
10494
10623
|
|
|
10495
10624
|
for (let i = 0; i < data.rows.length; i++) {
|
|
10496
10625
|
const rowItem = data.rows.item(i);
|
|
10497
|
-
const rowKey = decode(rowItem[me.__keyColumnName], true);
|
|
10626
|
+
const rowKey = decode$2(rowItem[me.__keyColumnName], true);
|
|
10498
10627
|
const matches = findMultiEntryMatches(rowKey, me.__range);
|
|
10499
10628
|
|
|
10500
10629
|
for (const matchingKey of matches) {
|
|
10501
10630
|
const clone = {
|
|
10502
|
-
matchingKey: encode(matchingKey, true),
|
|
10631
|
+
matchingKey: encode$2(matchingKey, true),
|
|
10503
10632
|
key: rowItem.key
|
|
10504
10633
|
};
|
|
10505
10634
|
clone[me.__keyColumnName] = rowItem[me.__keyColumnName];
|
|
@@ -10621,11 +10750,11 @@ IDBCursor.prototype.__decode = function (rowItem, callback) {
|
|
|
10621
10750
|
const encKey = unescapeSQLiteResponse(me.__multiEntryIndex ? rowItem.matchingKey : rowItem[me.__keyColumnName]);
|
|
10622
10751
|
const encVal = unescapeSQLiteResponse(rowItem[me.__valueColumnName]);
|
|
10623
10752
|
const encPrimaryKey = unescapeSQLiteResponse(rowItem.key);
|
|
10624
|
-
const key = decode(encKey, me.__multiEntryIndex);
|
|
10753
|
+
const key = decode$2(encKey, me.__multiEntryIndex);
|
|
10625
10754
|
|
|
10626
10755
|
const val = me.__valueDecoder.decode(encVal);
|
|
10627
10756
|
|
|
10628
|
-
const primaryKey = decode(encPrimaryKey);
|
|
10757
|
+
const primaryKey = decode$2(encPrimaryKey);
|
|
10629
10758
|
callback(key, val, primaryKey, encKey
|
|
10630
10759
|
/*, encVal, encPrimaryKey */
|
|
10631
10760
|
);
|
|
@@ -10708,7 +10837,7 @@ IDBCursor.prototype.__continueFinish = function (key, primaryKey, advanceState)
|
|
|
10708
10837
|
cursorContinue(tx, args, success, error);
|
|
10709
10838
|
}
|
|
10710
10839
|
|
|
10711
|
-
if (me.__unique && !me.__multiEntryIndex && encKey === encode(me.key, me.__multiEntryIndex)) {
|
|
10840
|
+
if (me.__unique && !me.__multiEntryIndex && encKey === encode$2(me.key, me.__multiEntryIndex)) {
|
|
10712
10841
|
cursorContinue(tx, args, success, error);
|
|
10713
10842
|
return;
|
|
10714
10843
|
}
|
|
@@ -10728,9 +10857,9 @@ IDBCursor.prototype.__continueFinish = function (key, primaryKey, advanceState)
|
|
|
10728
10857
|
});
|
|
10729
10858
|
};
|
|
10730
10859
|
|
|
10731
|
-
IDBCursor.prototype.continue = function
|
|
10732
|
-
/* key */
|
|
10733
|
-
{
|
|
10860
|
+
IDBCursor.prototype.continue = function
|
|
10861
|
+
/* key */
|
|
10862
|
+
() {
|
|
10734
10863
|
// eslint-disable-next-line prefer-rest-params
|
|
10735
10864
|
this.__continue(arguments[0]);
|
|
10736
10865
|
};
|
|
@@ -10767,8 +10896,8 @@ IDBCursor.prototype.continuePrimaryKey = function (key, primaryKey) {
|
|
|
10767
10896
|
}
|
|
10768
10897
|
|
|
10769
10898
|
if (cmpResult === 0) {
|
|
10770
|
-
encode
|
|
10771
|
-
encode
|
|
10899
|
+
encode(primaryKey, function (encPrimaryKey) {
|
|
10900
|
+
encode(me.primaryKey, function (encObjectStorePos) {
|
|
10772
10901
|
if (encPrimaryKey === encObjectStorePos || me.direction === 'next' && encPrimaryKey < encObjectStorePos || me.direction === 'prev' && encPrimaryKey > encObjectStorePos) {
|
|
10773
10902
|
throw createDOMException('DataError', 'Cannot continue the cursor in an unexpected direction');
|
|
10774
10903
|
}
|
|
@@ -10862,7 +10991,7 @@ IDBCursor.prototype.delete = function () {
|
|
|
10862
10991
|
const sql = 'DELETE FROM ' + escapeStoreNameForSQL(me.__store.__currentName) + ' WHERE "key" = ?';
|
|
10863
10992
|
CFG.DEBUG && console.log(sql, key, primaryKey); // Key.convertValueToKey(primaryKey); // Already checked when entered
|
|
10864
10993
|
|
|
10865
|
-
tx.executeSql(sql, [escapeSQLiteStatement(encode(primaryKey))], function (tx, data) {
|
|
10994
|
+
tx.executeSql(sql, [escapeSQLiteStatement(encode$2(primaryKey))], function (tx, data) {
|
|
10866
10995
|
if (data.rowsAffected === 1) {
|
|
10867
10996
|
// We don't invalidate the cache (as we don't access it anymore
|
|
10868
10997
|
// and it will set the index off)
|
|
@@ -10997,7 +11126,7 @@ function setGlobalVars(idb, initialConfig) {
|
|
|
10997
11126
|
if (IDB.shimIndexedDB) {
|
|
10998
11127
|
IDB.shimIndexedDB.__useShim = function () {
|
|
10999
11128
|
function setNonIDBGlobals(prefix = '') {
|
|
11000
|
-
shim(prefix + 'DOMException', ShimDOMException
|
|
11129
|
+
shim(prefix + 'DOMException', ShimDOMException);
|
|
11001
11130
|
shim(prefix + 'DOMStringList', DOMStringList, {
|
|
11002
11131
|
enumerable: false,
|
|
11003
11132
|
configurable: true,
|
|
@@ -11063,8 +11192,8 @@ function setGlobalVars(idb, initialConfig) {
|
|
|
11063
11192
|
Object.setPrototypeOf(IDBRequest, EventTarget);
|
|
11064
11193
|
Object.setPrototypeOf(IDBTransaction, EventTarget);
|
|
11065
11194
|
Object.setPrototypeOf(IDBVersionChangeEvent, ShimEvent);
|
|
11066
|
-
Object.setPrototypeOf(ShimDOMException
|
|
11067
|
-
Object.setPrototypeOf(ShimDOMException
|
|
11195
|
+
Object.setPrototypeOf(ShimDOMException, Error);
|
|
11196
|
+
Object.setPrototypeOf(ShimDOMException.prototype, Error.prototype);
|
|
11068
11197
|
setPrototypeOfCustomEvent();
|
|
11069
11198
|
}
|
|
11070
11199
|
|
|
@@ -11161,17 +11290,18 @@ function setGlobalVars(idb, initialConfig) {
|
|
|
11161
11290
|
return IDB;
|
|
11162
11291
|
} // Expose for ease in simulating such exceptions during testing
|
|
11163
11292
|
|
|
11164
|
-
function SQLiteResult(error, insertId, rowsAffected, rows) {
|
|
11293
|
+
function SQLiteResult$1(error, insertId, rowsAffected, rows) {
|
|
11165
11294
|
this.error = error;
|
|
11166
11295
|
this.insertId = insertId;
|
|
11167
11296
|
this.rowsAffected = rowsAffected;
|
|
11168
11297
|
this.rows = rows;
|
|
11169
11298
|
}
|
|
11170
11299
|
|
|
11171
|
-
var SQLiteResult_1 = SQLiteResult;
|
|
11300
|
+
var SQLiteResult_1 = SQLiteResult$1;
|
|
11172
11301
|
|
|
11173
11302
|
var sqlite3 = require('sqlite3');
|
|
11174
11303
|
|
|
11304
|
+
var SQLiteResult = SQLiteResult_1;
|
|
11175
11305
|
var READ_ONLY_ERROR = new Error('could not prepare statement (23 not authorized)');
|
|
11176
11306
|
|
|
11177
11307
|
function SQLiteDatabase(name, opts) {
|
|
@@ -11195,12 +11325,12 @@ function SQLiteDatabase(name, opts) {
|
|
|
11195
11325
|
function runSelect(db, sql, args, cb) {
|
|
11196
11326
|
db.all(sql, args, function (err, rows) {
|
|
11197
11327
|
if (err) {
|
|
11198
|
-
return cb(new
|
|
11328
|
+
return cb(new SQLiteResult(err));
|
|
11199
11329
|
}
|
|
11200
11330
|
|
|
11201
11331
|
var insertId = void 0;
|
|
11202
11332
|
var rowsAffected = 0;
|
|
11203
|
-
var resultSet = new
|
|
11333
|
+
var resultSet = new SQLiteResult(null, insertId, rowsAffected, rows);
|
|
11204
11334
|
cb(resultSet);
|
|
11205
11335
|
});
|
|
11206
11336
|
}
|
|
@@ -11208,7 +11338,7 @@ function runSelect(db, sql, args, cb) {
|
|
|
11208
11338
|
function runNonSelect(db, sql, args, cb) {
|
|
11209
11339
|
db.run(sql, args, function (err) {
|
|
11210
11340
|
if (err) {
|
|
11211
|
-
return cb(new
|
|
11341
|
+
return cb(new SQLiteResult(err));
|
|
11212
11342
|
}
|
|
11213
11343
|
/* jshint validthis:true */
|
|
11214
11344
|
|
|
@@ -11217,7 +11347,7 @@ function runNonSelect(db, sql, args, cb) {
|
|
|
11217
11347
|
var insertId = executionResult.lastID;
|
|
11218
11348
|
var rowsAffected = executionResult.changes;
|
|
11219
11349
|
var rows = [];
|
|
11220
|
-
var resultSet = new
|
|
11350
|
+
var resultSet = new SQLiteResult(null, insertId, rowsAffected, rows);
|
|
11221
11351
|
cb(resultSet);
|
|
11222
11352
|
});
|
|
11223
11353
|
}
|
|
@@ -11256,7 +11386,7 @@ SQLiteDatabase.prototype.exec = function exec(queries, readOnly, callback) {
|
|
|
11256
11386
|
var isSelect = /^\s*SELECT\b/i.test(sql);
|
|
11257
11387
|
|
|
11258
11388
|
if (readOnly && !isSelect) {
|
|
11259
|
-
onQueryComplete(i)(new
|
|
11389
|
+
onQueryComplete(i)(new SQLiteResult(READ_ONLY_ERROR));
|
|
11260
11390
|
} else if (isSelect) {
|
|
11261
11391
|
runSelect(db, sql, args, onQueryComplete(i));
|
|
11262
11392
|
} else {
|
|
@@ -11288,7 +11418,7 @@ function wrappedSQLiteDatabase(name) {
|
|
|
11288
11418
|
return db;
|
|
11289
11419
|
}
|
|
11290
11420
|
|
|
11291
|
-
const nodeWebSQL =
|
|
11421
|
+
const nodeWebSQL = customOpenDatabase__default["default"](wrappedSQLiteDatabase);
|
|
11292
11422
|
|
|
11293
11423
|
// ID_Start (includes Other_ID_Start)
|
|
11294
11424
|
const UnicodeIDStart = '(?:[$A-Z_a-z\\xAA\\xB5\\xBA\\xC0-\\xD6\\xD8-\\xF6\\xF8-\\u02C1\\u02C6-\\u02D1\\u02E0-\\u02E4\\u02EC\\u02EE\\u0370-\\u0374\\u0376\\u0377\\u037A-\\u037D\\u037F\\u0386\\u0388-\\u038A\\u038C\\u038E-\\u03A1\\u03A3-\\u03F5\\u03F7-\\u0481\\u048A-\\u052F\\u0531-\\u0556\\u0559\\u0561-\\u0587\\u05D0-\\u05EA\\u05F0-\\u05F2\\u0620-\\u064A\\u066E\\u066F\\u0671-\\u06D3\\u06D5\\u06E5\\u06E6\\u06EE\\u06EF\\u06FA-\\u06FC\\u06FF\\u0710\\u0712-\\u072F\\u074D-\\u07A5\\u07B1\\u07CA-\\u07EA\\u07F4\\u07F5\\u07FA\\u0800-\\u0815\\u081A\\u0824\\u0828\\u0840-\\u0858\\u08A0-\\u08B4\\u08B6-\\u08BD\\u0904-\\u0939\\u093D\\u0950\\u0958-\\u0961\\u0971-\\u0980\\u0985-\\u098C\\u098F\\u0990\\u0993-\\u09A8\\u09AA-\\u09B0\\u09B2\\u09B6-\\u09B9\\u09BD\\u09CE\\u09DC\\u09DD\\u09DF-\\u09E1\\u09F0\\u09F1\\u0A05-\\u0A0A\\u0A0F\\u0A10\\u0A13-\\u0A28\\u0A2A-\\u0A30\\u0A32\\u0A33\\u0A35\\u0A36\\u0A38\\u0A39\\u0A59-\\u0A5C\\u0A5E\\u0A72-\\u0A74\\u0A85-\\u0A8D\\u0A8F-\\u0A91\\u0A93-\\u0AA8\\u0AAA-\\u0AB0\\u0AB2\\u0AB3\\u0AB5-\\u0AB9\\u0ABD\\u0AD0\\u0AE0\\u0AE1\\u0AF9\\u0B05-\\u0B0C\\u0B0F\\u0B10\\u0B13-\\u0B28\\u0B2A-\\u0B30\\u0B32\\u0B33\\u0B35-\\u0B39\\u0B3D\\u0B5C\\u0B5D\\u0B5F-\\u0B61\\u0B71\\u0B83\\u0B85-\\u0B8A\\u0B8E-\\u0B90\\u0B92-\\u0B95\\u0B99\\u0B9A\\u0B9C\\u0B9E\\u0B9F\\u0BA3\\u0BA4\\u0BA8-\\u0BAA\\u0BAE-\\u0BB9\\u0BD0\\u0C05-\\u0C0C\\u0C0E-\\u0C10\\u0C12-\\u0C28\\u0C2A-\\u0C39\\u0C3D\\u0C58-\\u0C5A\\u0C60\\u0C61\\u0C80\\u0C85-\\u0C8C\\u0C8E-\\u0C90\\u0C92-\\u0CA8\\u0CAA-\\u0CB3\\u0CB5-\\u0CB9\\u0CBD\\u0CDE\\u0CE0\\u0CE1\\u0CF1\\u0CF2\\u0D05-\\u0D0C\\u0D0E-\\u0D10\\u0D12-\\u0D3A\\u0D3D\\u0D4E\\u0D54-\\u0D56\\u0D5F-\\u0D61\\u0D7A-\\u0D7F\\u0D85-\\u0D96\\u0D9A-\\u0DB1\\u0DB3-\\u0DBB\\u0DBD\\u0DC0-\\u0DC6\\u0E01-\\u0E30\\u0E32\\u0E33\\u0E40-\\u0E46\\u0E81\\u0E82\\u0E84\\u0E87\\u0E88\\u0E8A\\u0E8D\\u0E94-\\u0E97\\u0E99-\\u0E9F\\u0EA1-\\u0EA3\\u0EA5\\u0EA7\\u0EAA\\u0EAB\\u0EAD-\\u0EB0\\u0EB2\\u0EB3\\u0EBD\\u0EC0-\\u0EC4\\u0EC6\\u0EDC-\\u0EDF\\u0F00\\u0F40-\\u0F47\\u0F49-\\u0F6C\\u0F88-\\u0F8C\\u1000-\\u102A\\u103F\\u1050-\\u1055\\u105A-\\u105D\\u1061\\u1065\\u1066\\u106E-\\u1070\\u1075-\\u1081\\u108E\\u10A0-\\u10C5\\u10C7\\u10CD\\u10D0-\\u10FA\\u10FC-\\u1248\\u124A-\\u124D\\u1250-\\u1256\\u1258\\u125A-\\u125D\\u1260-\\u1288\\u128A-\\u128D\\u1290-\\u12B0\\u12B2-\\u12B5\\u12B8-\\u12BE\\u12C0\\u12C2-\\u12C5\\u12C8-\\u12D6\\u12D8-\\u1310\\u1312-\\u1315\\u1318-\\u135A\\u1380-\\u138F\\u13A0-\\u13F5\\u13F8-\\u13FD\\u1401-\\u166C\\u166F-\\u167F\\u1681-\\u169A\\u16A0-\\u16EA\\u16EE-\\u16F8\\u1700-\\u170C\\u170E-\\u1711\\u1720-\\u1731\\u1740-\\u1751\\u1760-\\u176C\\u176E-\\u1770\\u1780-\\u17B3\\u17D7\\u17DC\\u1820-\\u1877\\u1880-\\u18A8\\u18AA\\u18B0-\\u18F5\\u1900-\\u191E\\u1950-\\u196D\\u1970-\\u1974\\u1980-\\u19AB\\u19B0-\\u19C9\\u1A00-\\u1A16\\u1A20-\\u1A54\\u1AA7\\u1B05-\\u1B33\\u1B45-\\u1B4B\\u1B83-\\u1BA0\\u1BAE\\u1BAF\\u1BBA-\\u1BE5\\u1C00-\\u1C23\\u1C4D-\\u1C4F\\u1C5A-\\u1C7D\\u1C80-\\u1C88\\u1CE9-\\u1CEC\\u1CEE-\\u1CF1\\u1CF5\\u1CF6\\u1D00-\\u1DBF\\u1E00-\\u1F15\\u1F18-\\u1F1D\\u1F20-\\u1F45\\u1F48-\\u1F4D\\u1F50-\\u1F57\\u1F59\\u1F5B\\u1F5D\\u1F5F-\\u1F7D\\u1F80-\\u1FB4\\u1FB6-\\u1FBC\\u1FBE\\u1FC2-\\u1FC4\\u1FC6-\\u1FCC\\u1FD0-\\u1FD3\\u1FD6-\\u1FDB\\u1FE0-\\u1FEC\\u1FF2-\\u1FF4\\u1FF6-\\u1FFC\\u2071\\u207F\\u2090-\\u209C\\u2102\\u2107\\u210A-\\u2113\\u2115\\u2118-\\u211D\\u2124\\u2126\\u2128\\u212A-\\u2139\\u213C-\\u213F\\u2145-\\u2149\\u214E\\u2160-\\u2188\\u2C00-\\u2C2E\\u2C30-\\u2C5E\\u2C60-\\u2CE4\\u2CEB-\\u2CEE\\u2CF2\\u2CF3\\u2D00-\\u2D25\\u2D27\\u2D2D\\u2D30-\\u2D67\\u2D6F\\u2D80-\\u2D96\\u2DA0-\\u2DA6\\u2DA8-\\u2DAE\\u2DB0-\\u2DB6\\u2DB8-\\u2DBE\\u2DC0-\\u2DC6\\u2DC8-\\u2DCE\\u2DD0-\\u2DD6\\u2DD8-\\u2DDE\\u3005-\\u3007\\u3021-\\u3029\\u3031-\\u3035\\u3038-\\u303C\\u3041-\\u3096\\u309B-\\u309F\\u30A1-\\u30FA\\u30FC-\\u30FF\\u3105-\\u312D\\u3131-\\u318E\\u31A0-\\u31BA\\u31F0-\\u31FF\\u3400-\\u4DB5\\u4E00-\\u9FD5\\uA000-\\uA48C\\uA4D0-\\uA4FD\\uA500-\\uA60C\\uA610-\\uA61F\\uA62A\\uA62B\\uA640-\\uA66E\\uA67F-\\uA69D\\uA6A0-\\uA6EF\\uA717-\\uA71F\\uA722-\\uA788\\uA78B-\\uA7AE\\uA7B0-\\uA7B7\\uA7F7-\\uA801\\uA803-\\uA805\\uA807-\\uA80A\\uA80C-\\uA822\\uA840-\\uA873\\uA882-\\uA8B3\\uA8F2-\\uA8F7\\uA8FB\\uA8FD\\uA90A-\\uA925\\uA930-\\uA946\\uA960-\\uA97C\\uA984-\\uA9B2\\uA9CF\\uA9E0-\\uA9E4\\uA9E6-\\uA9EF\\uA9FA-\\uA9FE\\uAA00-\\uAA28\\uAA40-\\uAA42\\uAA44-\\uAA4B\\uAA60-\\uAA76\\uAA7A\\uAA7E-\\uAAAF\\uAAB1\\uAAB5\\uAAB6\\uAAB9-\\uAABD\\uAAC0\\uAAC2\\uAADB-\\uAADD\\uAAE0-\\uAAEA\\uAAF2-\\uAAF4\\uAB01-\\uAB06\\uAB09-\\uAB0E\\uAB11-\\uAB16\\uAB20-\\uAB26\\uAB28-\\uAB2E\\uAB30-\\uAB5A\\uAB5C-\\uAB65\\uAB70-\\uABE2\\uAC00-\\uD7A3\\uD7B0-\\uD7C6\\uD7CB-\\uD7FB\\uF900-\\uFA6D\\uFA70-\\uFAD9\\uFB00-\\uFB06\\uFB13-\\uFB17\\uFB1D\\uFB1F-\\uFB28\\uFB2A-\\uFB36\\uFB38-\\uFB3C\\uFB3E\\uFB40\\uFB41\\uFB43\\uFB44\\uFB46-\\uFBB1\\uFBD3-\\uFD3D\\uFD50-\\uFD8F\\uFD92-\\uFDC7\\uFDF0-\\uFDFB\\uFE70-\\uFE74\\uFE76-\\uFEFC\\uFF21-\\uFF3A\\uFF41-\\uFF5A\\uFF66-\\uFFBE\\uFFC2-\\uFFC7\\uFFCA-\\uFFCF\\uFFD2-\\uFFD7\\uFFDA-\\uFFDC]|\\uD800[\\uDC00-\\uDC0B\\uDC0D-\\uDC26\\uDC28-\\uDC3A\\uDC3C\\uDC3D\\uDC3F-\\uDC4D\\uDC50-\\uDC5D\\uDC80-\\uDCFA\\uDD40-\\uDD74\\uDE80-\\uDE9C\\uDEA0-\\uDED0\\uDF00-\\uDF1F\\uDF30-\\uDF4A\\uDF50-\\uDF75\\uDF80-\\uDF9D\\uDFA0-\\uDFC3\\uDFC8-\\uDFCF\\uDFD1-\\uDFD5]|\\uD801[\\uDC00-\\uDC9D\\uDCB0-\\uDCD3\\uDCD8-\\uDCFB\\uDD00-\\uDD27\\uDD30-\\uDD63\\uDE00-\\uDF36\\uDF40-\\uDF55\\uDF60-\\uDF67]|\\uD802[\\uDC00-\\uDC05\\uDC08\\uDC0A-\\uDC35\\uDC37\\uDC38\\uDC3C\\uDC3F-\\uDC55\\uDC60-\\uDC76\\uDC80-\\uDC9E\\uDCE0-\\uDCF2\\uDCF4\\uDCF5\\uDD00-\\uDD15\\uDD20-\\uDD39\\uDD80-\\uDDB7\\uDDBE\\uDDBF\\uDE00\\uDE10-\\uDE13\\uDE15-\\uDE17\\uDE19-\\uDE33\\uDE60-\\uDE7C\\uDE80-\\uDE9C\\uDEC0-\\uDEC7\\uDEC9-\\uDEE4\\uDF00-\\uDF35\\uDF40-\\uDF55\\uDF60-\\uDF72\\uDF80-\\uDF91]|\\uD803[\\uDC00-\\uDC48\\uDC80-\\uDCB2\\uDCC0-\\uDCF2]|\\uD804[\\uDC03-\\uDC37\\uDC83-\\uDCAF\\uDCD0-\\uDCE8\\uDD03-\\uDD26\\uDD50-\\uDD72\\uDD76\\uDD83-\\uDDB2\\uDDC1-\\uDDC4\\uDDDA\\uDDDC\\uDE00-\\uDE11\\uDE13-\\uDE2B\\uDE80-\\uDE86\\uDE88\\uDE8A-\\uDE8D\\uDE8F-\\uDE9D\\uDE9F-\\uDEA8\\uDEB0-\\uDEDE\\uDF05-\\uDF0C\\uDF0F\\uDF10\\uDF13-\\uDF28\\uDF2A-\\uDF30\\uDF32\\uDF33\\uDF35-\\uDF39\\uDF3D\\uDF50\\uDF5D-\\uDF61]|\\uD805[\\uDC00-\\uDC34\\uDC47-\\uDC4A\\uDC80-\\uDCAF\\uDCC4\\uDCC5\\uDCC7\\uDD80-\\uDDAE\\uDDD8-\\uDDDB\\uDE00-\\uDE2F\\uDE44\\uDE80-\\uDEAA\\uDF00-\\uDF19]|\\uD806[\\uDCA0-\\uDCDF\\uDCFF\\uDEC0-\\uDEF8]|\\uD807[\\uDC00-\\uDC08\\uDC0A-\\uDC2E\\uDC40\\uDC72-\\uDC8F]|\\uD808[\\uDC00-\\uDF99]|\\uD809[\\uDC00-\\uDC6E\\uDC80-\\uDD43]|[\\uD80C\\uD81C-\\uD820\\uD840-\\uD868\\uD86A-\\uD86C\\uD86F-\\uD872][\\uDC00-\\uDFFF]|\\uD80D[\\uDC00-\\uDC2E]|\\uD811[\\uDC00-\\uDE46]|\\uD81A[\\uDC00-\\uDE38\\uDE40-\\uDE5E\\uDED0-\\uDEED\\uDF00-\\uDF2F\\uDF40-\\uDF43\\uDF63-\\uDF77\\uDF7D-\\uDF8F]|\\uD81B[\\uDF00-\\uDF44\\uDF50\\uDF93-\\uDF9F\\uDFE0]|\\uD821[\\uDC00-\\uDFEC]|\\uD822[\\uDC00-\\uDEF2]|\\uD82C[\\uDC00\\uDC01]|\\uD82F[\\uDC00-\\uDC6A\\uDC70-\\uDC7C\\uDC80-\\uDC88\\uDC90-\\uDC99]|\\uD835[\\uDC00-\\uDC54\\uDC56-\\uDC9C\\uDC9E\\uDC9F\\uDCA2\\uDCA5\\uDCA6\\uDCA9-\\uDCAC\\uDCAE-\\uDCB9\\uDCBB\\uDCBD-\\uDCC3\\uDCC5-\\uDD05\\uDD07-\\uDD0A\\uDD0D-\\uDD14\\uDD16-\\uDD1C\\uDD1E-\\uDD39\\uDD3B-\\uDD3E\\uDD40-\\uDD44\\uDD46\\uDD4A-\\uDD50\\uDD52-\\uDEA5\\uDEA8-\\uDEC0\\uDEC2-\\uDEDA\\uDEDC-\\uDEFA\\uDEFC-\\uDF14\\uDF16-\\uDF34\\uDF36-\\uDF4E\\uDF50-\\uDF6E\\uDF70-\\uDF88\\uDF8A-\\uDFA8\\uDFAA-\\uDFC2\\uDFC4-\\uDFCB]|\\uD83A[\\uDC00-\\uDCC4\\uDD00-\\uDD43]|\\uD83B[\\uDE00-\\uDE03\\uDE05-\\uDE1F\\uDE21\\uDE22\\uDE24\\uDE27\\uDE29-\\uDE32\\uDE34-\\uDE37\\uDE39\\uDE3B\\uDE42\\uDE47\\uDE49\\uDE4B\\uDE4D-\\uDE4F\\uDE51\\uDE52\\uDE54\\uDE57\\uDE59\\uDE5B\\uDE5D\\uDE5F\\uDE61\\uDE62\\uDE64\\uDE67-\\uDE6A\\uDE6C-\\uDE72\\uDE74-\\uDE77\\uDE79-\\uDE7C\\uDE7E\\uDE80-\\uDE89\\uDE8B-\\uDE9B\\uDEA1-\\uDEA3\\uDEA5-\\uDEA9\\uDEAB-\\uDEBB]|\\uD869[\\uDC00-\\uDED6\\uDF00-\\uDFFF]|\\uD86D[\\uDC00-\\uDF34\\uDF40-\\uDFFF]|\\uD86E[\\uDC00-\\uDC1D\\uDC20-\\uDFFF]|\\uD873[\\uDC00-\\uDEA1]|\\uD87E[\\uDC00-\\uDE1D])'; // ID_Continue (includes Other_ID_Continue)
|
|
@@ -11301,15 +11431,15 @@ var UnicodeIdentifiers = /*#__PURE__*/Object.freeze({
|
|
|
11301
11431
|
UnicodeIDContinue: UnicodeIDContinue
|
|
11302
11432
|
});
|
|
11303
11433
|
|
|
11304
|
-
const fs
|
|
11434
|
+
const fs = require('fs');
|
|
11305
11435
|
|
|
11306
11436
|
CFG.win = {
|
|
11307
11437
|
openDatabase: nodeWebSQL
|
|
11308
11438
|
};
|
|
11309
11439
|
|
|
11310
11440
|
const __setGlobalVars = function (idb, initialConfig = {}) {
|
|
11311
|
-
const obj = setGlobalVars(idb, _objectSpread2({
|
|
11312
|
-
fs
|
|
11441
|
+
const obj = setGlobalVars(idb, _objectSpread2$1({
|
|
11442
|
+
fs
|
|
11313
11443
|
}, initialConfig));
|
|
11314
11444
|
|
|
11315
11445
|
obj.shimIndexedDB.__setUnicodeIdentifiers(UnicodeIdentifiers);
|