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
package/dist/indexeddbshim.js
CHANGED
|
@@ -1,24 +1,44 @@
|
|
|
1
|
-
/*! indexeddbshim -
|
|
1
|
+
/*! indexeddbshim - v9.0.0 - 1/5/2022 */
|
|
2
2
|
|
|
3
3
|
(function (factory) {
|
|
4
4
|
typeof define === 'function' && define.amd ? define(factory) :
|
|
5
5
|
factory();
|
|
6
|
-
}((function () { 'use strict';
|
|
6
|
+
})((function () { 'use strict';
|
|
7
7
|
|
|
8
|
-
function
|
|
9
|
-
|
|
8
|
+
function ownKeys(object, enumerableOnly) {
|
|
9
|
+
var keys = Object.keys(object);
|
|
10
10
|
|
|
11
|
-
if (
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
_typeof = function (obj) {
|
|
17
|
-
return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
|
|
18
|
-
};
|
|
11
|
+
if (Object.getOwnPropertySymbols) {
|
|
12
|
+
var symbols = Object.getOwnPropertySymbols(object);
|
|
13
|
+
enumerableOnly && (symbols = symbols.filter(function (sym) {
|
|
14
|
+
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
15
|
+
})), keys.push.apply(keys, symbols);
|
|
19
16
|
}
|
|
20
17
|
|
|
21
|
-
return
|
|
18
|
+
return keys;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
function _objectSpread2(target) {
|
|
22
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
23
|
+
var source = null != arguments[i] ? arguments[i] : {};
|
|
24
|
+
i % 2 ? ownKeys(Object(source), !0).forEach(function (key) {
|
|
25
|
+
_defineProperty(target, key, source[key]);
|
|
26
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) {
|
|
27
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
return target;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
function _typeof$1(obj) {
|
|
35
|
+
"@babel/helpers - typeof";
|
|
36
|
+
|
|
37
|
+
return _typeof$1 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
|
|
38
|
+
return typeof obj;
|
|
39
|
+
} : function (obj) {
|
|
40
|
+
return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
|
|
41
|
+
}, _typeof$1(obj);
|
|
22
42
|
}
|
|
23
43
|
|
|
24
44
|
function _classCallCheck(instance, Constructor) {
|
|
@@ -40,6 +60,9 @@
|
|
|
40
60
|
function _createClass(Constructor, protoProps, staticProps) {
|
|
41
61
|
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
|
42
62
|
if (staticProps) _defineProperties(Constructor, staticProps);
|
|
63
|
+
Object.defineProperty(Constructor, "prototype", {
|
|
64
|
+
writable: false
|
|
65
|
+
});
|
|
43
66
|
return Constructor;
|
|
44
67
|
}
|
|
45
68
|
|
|
@@ -81,40 +104,6 @@
|
|
|
81
104
|
return obj;
|
|
82
105
|
}
|
|
83
106
|
|
|
84
|
-
function ownKeys(object, enumerableOnly) {
|
|
85
|
-
var keys = Object.keys(object);
|
|
86
|
-
|
|
87
|
-
if (Object.getOwnPropertySymbols) {
|
|
88
|
-
var symbols = Object.getOwnPropertySymbols(object);
|
|
89
|
-
if (enumerableOnly) symbols = symbols.filter(function (sym) {
|
|
90
|
-
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
91
|
-
});
|
|
92
|
-
keys.push.apply(keys, symbols);
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
return keys;
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
function _objectSpread2(target) {
|
|
99
|
-
for (var i = 1; i < arguments.length; i++) {
|
|
100
|
-
var source = arguments[i] != null ? arguments[i] : {};
|
|
101
|
-
|
|
102
|
-
if (i % 2) {
|
|
103
|
-
ownKeys(Object(source), true).forEach(function (key) {
|
|
104
|
-
_defineProperty(target, key, source[key]);
|
|
105
|
-
});
|
|
106
|
-
} else if (Object.getOwnPropertyDescriptors) {
|
|
107
|
-
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
|
108
|
-
} else {
|
|
109
|
-
ownKeys(Object(source)).forEach(function (key) {
|
|
110
|
-
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
111
|
-
});
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
return target;
|
|
116
|
-
}
|
|
117
|
-
|
|
118
107
|
function _setPrototypeOf(o, p) {
|
|
119
108
|
_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
|
|
120
109
|
o.__proto__ = p;
|
|
@@ -130,7 +119,7 @@
|
|
|
130
119
|
if (typeof Proxy === "function") return true;
|
|
131
120
|
|
|
132
121
|
try {
|
|
133
|
-
|
|
122
|
+
Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
|
|
134
123
|
return true;
|
|
135
124
|
} catch (e) {
|
|
136
125
|
return false;
|
|
@@ -171,18 +160,21 @@
|
|
|
171
160
|
}
|
|
172
161
|
|
|
173
162
|
function _iterableToArray(iter) {
|
|
174
|
-
if (typeof Symbol !== "undefined" && Symbol.iterator
|
|
163
|
+
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
175
164
|
}
|
|
176
165
|
|
|
177
166
|
function _iterableToArrayLimit(arr, i) {
|
|
178
|
-
|
|
167
|
+
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
|
|
168
|
+
|
|
169
|
+
if (_i == null) return;
|
|
179
170
|
var _arr = [];
|
|
180
171
|
var _n = true;
|
|
181
172
|
var _d = false;
|
|
182
|
-
|
|
173
|
+
|
|
174
|
+
var _s, _e;
|
|
183
175
|
|
|
184
176
|
try {
|
|
185
|
-
for (
|
|
177
|
+
for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) {
|
|
186
178
|
_arr.push(_s.value);
|
|
187
179
|
|
|
188
180
|
if (i && _arr.length === i) break;
|
|
@@ -227,9 +219,9 @@
|
|
|
227
219
|
}
|
|
228
220
|
|
|
229
221
|
function _createForOfIteratorHelper(o, allowArrayLike) {
|
|
230
|
-
var it;
|
|
222
|
+
var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
|
|
231
223
|
|
|
232
|
-
if (
|
|
224
|
+
if (!it) {
|
|
233
225
|
if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") {
|
|
234
226
|
if (it) o = it;
|
|
235
227
|
var i = 0;
|
|
@@ -262,7 +254,7 @@
|
|
|
262
254
|
err;
|
|
263
255
|
return {
|
|
264
256
|
s: function () {
|
|
265
|
-
it =
|
|
257
|
+
it = it.call(o);
|
|
266
258
|
},
|
|
267
259
|
n: function () {
|
|
268
260
|
var step = it.next();
|
|
@@ -283,24 +275,24 @@
|
|
|
283
275
|
};
|
|
284
276
|
}
|
|
285
277
|
|
|
286
|
-
var global$1 = typeof global$2 !== "undefined" ? global$2 : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {};
|
|
287
|
-
|
|
288
278
|
var global$2 = typeof global$1 !== "undefined" ? global$1 : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {};
|
|
289
279
|
|
|
290
|
-
|
|
280
|
+
var global$1 = typeof global$2 !== "undefined" ? global$2 : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {};
|
|
281
|
+
|
|
282
|
+
function _typeof(obj) {
|
|
291
283
|
"@babel/helpers - typeof";
|
|
292
284
|
|
|
293
285
|
if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
|
|
294
|
-
_typeof
|
|
286
|
+
_typeof = function _typeof(obj) {
|
|
295
287
|
return typeof obj;
|
|
296
288
|
};
|
|
297
289
|
} else {
|
|
298
|
-
_typeof
|
|
290
|
+
_typeof = function _typeof(obj) {
|
|
299
291
|
return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
|
|
300
292
|
};
|
|
301
293
|
}
|
|
302
294
|
|
|
303
|
-
return _typeof
|
|
295
|
+
return _typeof(obj);
|
|
304
296
|
}
|
|
305
297
|
/* eslint-disable no-sync, no-restricted-syntax */
|
|
306
298
|
// Todo: Switch to ES6 classes
|
|
@@ -312,7 +304,7 @@
|
|
|
312
304
|
AT_TARGET: 2,
|
|
313
305
|
BUBBLING_PHASE: 3
|
|
314
306
|
};
|
|
315
|
-
var ShimDOMException = typeof DOMException === 'undefined' // Todo: Better polyfill (if even needed here)
|
|
307
|
+
var ShimDOMException$1 = typeof DOMException === 'undefined' // Todo: Better polyfill (if even needed here)
|
|
316
308
|
// eslint-disable-next-line no-shadow
|
|
317
309
|
? function DOMException(msg, name) {
|
|
318
310
|
// No need for `toString` as same as for `Error`
|
|
@@ -696,7 +688,7 @@
|
|
|
696
688
|
if (arguments.length < 2) throw new TypeError('2 or more arguments required');
|
|
697
689
|
|
|
698
690
|
if (typeof type !== 'string') {
|
|
699
|
-
throw new ShimDOMException('UNSPECIFIED_EVENT_TYPE_ERR', 'UNSPECIFIED_EVENT_TYPE_ERR');
|
|
691
|
+
throw new ShimDOMException$1('UNSPECIFIED_EVENT_TYPE_ERR', 'UNSPECIFIED_EVENT_TYPE_ERR');
|
|
700
692
|
}
|
|
701
693
|
|
|
702
694
|
try {
|
|
@@ -757,7 +749,7 @@
|
|
|
757
749
|
var _evCfg = evCfg.get(e);
|
|
758
750
|
|
|
759
751
|
if (_evCfg && setTarget && _evCfg._dispatched) {
|
|
760
|
-
throw new ShimDOMException('The object is in an invalid state.', 'InvalidStateError');
|
|
752
|
+
throw new ShimDOMException$1('The object is in an invalid state.', 'InvalidStateError');
|
|
761
753
|
}
|
|
762
754
|
|
|
763
755
|
var eventCopy;
|
|
@@ -999,7 +991,7 @@
|
|
|
999
991
|
var triggerGlobalErrorEvent;
|
|
1000
992
|
var useNodeImpl = false;
|
|
1001
993
|
|
|
1002
|
-
if (typeof window === 'undefined' || typeof ErrorEvent === 'undefined' || window && (typeof window === "undefined" ? "undefined" : _typeof
|
|
994
|
+
if (typeof window === 'undefined' || typeof ErrorEvent === 'undefined' || window && (typeof window === "undefined" ? "undefined" : _typeof(window)) === 'object' && !window.dispatchEvent) {
|
|
1003
995
|
useNodeImpl = true;
|
|
1004
996
|
|
|
1005
997
|
triggerGlobalErrorEvent = function triggerGlobalErrorEvent() {
|
|
@@ -1068,7 +1060,7 @@
|
|
|
1068
1060
|
};
|
|
1069
1061
|
EventTarget.ShimEvent = ShimEvent;
|
|
1070
1062
|
EventTarget.ShimCustomEvent = ShimCustomEvent;
|
|
1071
|
-
EventTarget.ShimDOMException = ShimDOMException;
|
|
1063
|
+
EventTarget.ShimDOMException = ShimDOMException$1;
|
|
1072
1064
|
EventTarget.ShimEventTarget = EventTarget;
|
|
1073
1065
|
EventTarget.EventTargetFactory = EventTargetFactory;
|
|
1074
1066
|
/**
|
|
@@ -1081,7 +1073,7 @@
|
|
|
1081
1073
|
Object.setPrototypeOf(ShimCustomEvent.prototype, ShimEvent.prototype);
|
|
1082
1074
|
} // Todo: Move to own library (but allowing WeakMaps to be passed in for sharing here)
|
|
1083
1075
|
|
|
1084
|
-
var map = {};
|
|
1076
|
+
var map$1 = {};
|
|
1085
1077
|
var CFG = {};
|
|
1086
1078
|
[// Boolean for verbose reporting
|
|
1087
1079
|
'DEBUG', // Effectively defaults to false (ignored unless `true`)
|
|
@@ -1167,7 +1159,7 @@
|
|
|
1167
1159
|
// defaults to `true`
|
|
1168
1160
|
'addSQLiteExtension', // Various types of in-memory databases that can auto-delete
|
|
1169
1161
|
['memoryDatabase', function (val) {
|
|
1170
|
-
if (!/^(?::memory:|file::memory:(\?(?:
|
|
1162
|
+
if (!/^(?::memory:|file::memory:(\?(?:(?!#)[\s\S])*)?(#(?:[\0-\t\x0B\f\x0E-\u2027\u202A-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*)?)?$/.test(val)) {
|
|
1171
1163
|
throw new TypeError('`memoryDatabase` must be the empty string, ":memory:", or a ' + '"file::memory:[?queryString][#hash] URL".');
|
|
1172
1164
|
}
|
|
1173
1165
|
}], // NODE-SPECIFIC CONFIG
|
|
@@ -1191,30 +1183,30 @@
|
|
|
1191
1183
|
|
|
1192
1184
|
Object.defineProperty(CFG, prop, {
|
|
1193
1185
|
get: function get() {
|
|
1194
|
-
return map[prop];
|
|
1186
|
+
return map$1[prop];
|
|
1195
1187
|
},
|
|
1196
1188
|
set: function set(val) {
|
|
1197
1189
|
if (validator) {
|
|
1198
1190
|
validator(val);
|
|
1199
1191
|
}
|
|
1200
1192
|
|
|
1201
|
-
map[prop] = val;
|
|
1193
|
+
map$1[prop] = val;
|
|
1202
1194
|
}
|
|
1203
1195
|
});
|
|
1204
1196
|
});
|
|
1205
1197
|
|
|
1206
|
-
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]/;
|
|
1198
|
+
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]/;
|
|
1207
1199
|
|
|
1208
1200
|
function escapeUnmatchedSurrogates(arg) {
|
|
1209
1201
|
// http://stackoverflow.com/a/6701665/271577
|
|
1210
|
-
return arg.replace(/((?:[\uD800-\uDBFF](?![\uDC00-\uDFFF])))(?!(?:(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]))|(^|(?:[\
|
|
1202
|
+
return arg.replace(/((?:[\uD800-\uDBFF](?![\uDC00-\uDFFF])))(?!(?:(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]))|(^|(?:(?)[\s\S]))((?:(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]))/g, function (_, unmatchedHighSurrogate, precedingLow, unmatchedLowSurrogate) {
|
|
1211
1203
|
// Could add a corresponding surrogate for compatibility with `node-sqlite3`: http://bugs.python.org/issue12569 and http://stackoverflow.com/a/6701665/271577
|
|
1212
1204
|
// but Chrome having problems
|
|
1213
1205
|
if (unmatchedHighSurrogate) {
|
|
1214
|
-
return '^2' +
|
|
1206
|
+
return '^2' + unmatchedHighSurrogate.codePointAt().toString(16).padStart(4, '0');
|
|
1215
1207
|
}
|
|
1216
1208
|
|
|
1217
|
-
return (precedingLow || '') + '^3' +
|
|
1209
|
+
return (precedingLow || '') + '^3' + unmatchedLowSurrogate.codePointAt().toString(16).padStart(4, '0');
|
|
1218
1210
|
});
|
|
1219
1211
|
}
|
|
1220
1212
|
|
|
@@ -1266,18 +1258,16 @@
|
|
|
1266
1258
|
|
|
1267
1259
|
if (CFG.escapeNFDForDatabaseNames !== false) {
|
|
1268
1260
|
// ES6 copying of regex with different flags
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
// https://github.com/axemclion/IndexedDBShim/issues/311#issuecomment-316090147 )
|
|
1272
|
-
db = db.replace(new RegExp(regex.source, 'gu'), function (expandable) {
|
|
1273
|
-
return '^4' + padStart(expandable.codePointAt().toString(16), 6, '0');
|
|
1261
|
+
db = db.replace(new RegExp(regex, 'gu'), function (expandable) {
|
|
1262
|
+
return '^4' + expandable.codePointAt().toString(16).padStart(6, '0');
|
|
1274
1263
|
});
|
|
1275
1264
|
}
|
|
1276
1265
|
|
|
1277
1266
|
if (CFG.databaseCharacterEscapeList !== false) {
|
|
1278
1267
|
db = db.replace(CFG.databaseCharacterEscapeList ? new RegExp(CFG.databaseCharacterEscapeList, 'gu') : /[\0-\x1F"\*\/:<>\?\\\|\x7F]/g, // eslint-disable-line no-control-regex
|
|
1279
1268
|
function (n0) {
|
|
1280
|
-
|
|
1269
|
+
// eslint-disable-next-line unicorn/prefer-code-point -- Switch to `codePointAt`?
|
|
1270
|
+
return '^1' + n0.charCodeAt().toString(16).padStart(2, '0');
|
|
1281
1271
|
});
|
|
1282
1272
|
}
|
|
1283
1273
|
|
|
@@ -1292,9 +1282,9 @@
|
|
|
1292
1282
|
|
|
1293
1283
|
function unescapeUnmatchedSurrogates(arg) {
|
|
1294
1284
|
return arg.replace(/(\^+)3(d[0-9a-f]{3})/g, function (_, esc, lowSurr) {
|
|
1295
|
-
return esc.length % 2 ? esc.slice(1) + String.
|
|
1285
|
+
return esc.length % 2 ? esc.slice(1) + String.fromCodePoint(Number.parseInt(lowSurr, 16)) : _;
|
|
1296
1286
|
}).replace(/(\^+)2(d[0-9a-f]{3})/g, function (_, esc, highSurr) {
|
|
1297
|
-
return esc.length % 2 ? esc.slice(1) + String.
|
|
1287
|
+
return esc.length % 2 ? esc.slice(1) + String.fromCodePoint(Number.parseInt(highSurr, 16)) : _;
|
|
1298
1288
|
});
|
|
1299
1289
|
} // Not in use internally but supplied for convenience
|
|
1300
1290
|
|
|
@@ -1321,7 +1311,7 @@
|
|
|
1321
1311
|
}
|
|
1322
1312
|
|
|
1323
1313
|
function isObj(obj) {
|
|
1324
|
-
return obj && _typeof(obj) === 'object';
|
|
1314
|
+
return obj && _typeof$1(obj) === 'object';
|
|
1325
1315
|
}
|
|
1326
1316
|
|
|
1327
1317
|
function isDate(obj) {
|
|
@@ -1509,12 +1499,7 @@
|
|
|
1509
1499
|
}
|
|
1510
1500
|
|
|
1511
1501
|
function hasOwn(obj, prop) {
|
|
1512
|
-
return
|
|
1513
|
-
} // Todo: Replace with `String.prototype.padStart` when targeting supporting Node version
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
function padStart(str, ct, fill) {
|
|
1517
|
-
return new Array(ct - String(str).length + 1).join(fill) + str;
|
|
1502
|
+
return Object.prototype.hasOwnProperty.call(obj, prop);
|
|
1518
1503
|
}
|
|
1519
1504
|
|
|
1520
1505
|
/**
|
|
@@ -1538,7 +1523,7 @@
|
|
|
1538
1523
|
}
|
|
1539
1524
|
});
|
|
1540
1525
|
|
|
1541
|
-
var readonlyProperties = ['oldVersion', 'newVersion']; // Babel apparently having a problem adding `hasInstance` to a class, so we are redefining as a function
|
|
1526
|
+
var readonlyProperties$6 = ['oldVersion', 'newVersion']; // Babel apparently having a problem adding `hasInstance` to a class, so we are redefining as a function
|
|
1542
1527
|
|
|
1543
1528
|
function IDBVersionChangeEvent(type
|
|
1544
1529
|
/* , eventInitDict */
|
|
@@ -1557,7 +1542,7 @@
|
|
|
1557
1542
|
|
|
1558
1543
|
IDBVersionChangeEvent.prototype = Object.create(ShimEvent.prototype);
|
|
1559
1544
|
IDBVersionChangeEvent.prototype[Symbol.toStringTag] = 'IDBVersionChangeEventPrototype';
|
|
1560
|
-
readonlyProperties.forEach(function (prop) {
|
|
1545
|
+
readonlyProperties$6.forEach(function (prop) {
|
|
1561
1546
|
var _o, _mutatorMap;
|
|
1562
1547
|
|
|
1563
1548
|
// Ensure for proper interface testing that "get <name>" is the function name
|
|
@@ -1801,7 +1786,7 @@
|
|
|
1801
1786
|
}
|
|
1802
1787
|
|
|
1803
1788
|
function isErrorOrDOMErrorOrDOMException(obj) {
|
|
1804
|
-
return obj && _typeof(obj) === 'object' && // We don't use util.isObj here as mutual dependency causing problems in Babel with browser
|
|
1789
|
+
return obj && _typeof$1(obj) === 'object' && // We don't use util.isObj here as mutual dependency causing problems in Babel with browser
|
|
1805
1790
|
typeof obj.name === 'string';
|
|
1806
1791
|
}
|
|
1807
1792
|
/**
|
|
@@ -1907,10 +1892,10 @@
|
|
|
1907
1892
|
logError(name, message, error);
|
|
1908
1893
|
return createNonNativeDOMException(name, message);
|
|
1909
1894
|
};
|
|
1910
|
-
var ShimDOMException
|
|
1895
|
+
var ShimDOMException = useNativeDOMException ? DOMException : ShimNonNativeDOMException;
|
|
1911
1896
|
|
|
1912
|
-
var listeners = ['onsuccess', 'onerror'];
|
|
1913
|
-
var readonlyProperties$
|
|
1897
|
+
var listeners$2 = ['onsuccess', 'onerror'];
|
|
1898
|
+
var readonlyProperties$5 = ['source', 'transaction', 'readyState'];
|
|
1914
1899
|
var doneFlagGetters = ['result', 'error'];
|
|
1915
1900
|
/**
|
|
1916
1901
|
* The IDBRequest Object that is returns for all async calls.
|
|
@@ -1924,6 +1909,8 @@
|
|
|
1924
1909
|
|
|
1925
1910
|
|
|
1926
1911
|
IDBRequest.__super = function IDBRequest() {
|
|
1912
|
+
var _this = this;
|
|
1913
|
+
|
|
1927
1914
|
this[Symbol.toStringTag] = 'IDBRequest';
|
|
1928
1915
|
|
|
1929
1916
|
this.__setOptions({
|
|
@@ -1932,12 +1919,12 @@
|
|
|
1932
1919
|
});
|
|
1933
1920
|
|
|
1934
1921
|
doneFlagGetters.forEach(function (prop) {
|
|
1935
|
-
Object.defineProperty(
|
|
1922
|
+
Object.defineProperty(_this, '__' + prop, {
|
|
1936
1923
|
enumerable: false,
|
|
1937
1924
|
configurable: false,
|
|
1938
1925
|
writable: true
|
|
1939
1926
|
});
|
|
1940
|
-
Object.defineProperty(
|
|
1927
|
+
Object.defineProperty(_this, prop, {
|
|
1941
1928
|
enumerable: true,
|
|
1942
1929
|
configurable: true,
|
|
1943
1930
|
get: function get() {
|
|
@@ -1948,8 +1935,8 @@
|
|
|
1948
1935
|
return this['__' + prop];
|
|
1949
1936
|
}
|
|
1950
1937
|
});
|
|
1951
|
-
}
|
|
1952
|
-
defineReadonlyProperties(this, readonlyProperties$
|
|
1938
|
+
});
|
|
1939
|
+
defineReadonlyProperties(this, readonlyProperties$5, {
|
|
1953
1940
|
readyState: {
|
|
1954
1941
|
get readyState() {
|
|
1955
1942
|
return this.__done ? 'done' : 'pending';
|
|
@@ -1957,7 +1944,7 @@
|
|
|
1957
1944
|
|
|
1958
1945
|
}
|
|
1959
1946
|
});
|
|
1960
|
-
defineListenerProperties(this, listeners);
|
|
1947
|
+
defineListenerProperties(this, listeners$2);
|
|
1961
1948
|
this.__result = undefined;
|
|
1962
1949
|
this.__error = this.__source = this.__transaction = null;
|
|
1963
1950
|
this.__done = false;
|
|
@@ -1981,9 +1968,9 @@
|
|
|
1981
1968
|
}; // Illegal invocations
|
|
1982
1969
|
|
|
1983
1970
|
|
|
1984
|
-
defineReadonlyOuterInterface(IDBRequest.prototype, readonlyProperties$
|
|
1971
|
+
defineReadonlyOuterInterface(IDBRequest.prototype, readonlyProperties$5);
|
|
1985
1972
|
defineReadonlyOuterInterface(IDBRequest.prototype, doneFlagGetters);
|
|
1986
|
-
defineOuterInterface(IDBRequest.prototype, listeners);
|
|
1973
|
+
defineOuterInterface(IDBRequest.prototype, listeners$2);
|
|
1987
1974
|
Object.defineProperty(IDBRequest.prototype, 'constructor', {
|
|
1988
1975
|
enumerable: false,
|
|
1989
1976
|
writable: true,
|
|
@@ -2039,9 +2026,11 @@
|
|
|
2039
2026
|
writable: false
|
|
2040
2027
|
});
|
|
2041
2028
|
|
|
2042
|
-
|
|
2029
|
+
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
2030
|
+
|
|
2043
2031
|
// not doing the trick for our WebSQL transactions (at least in Node),
|
|
2044
2032
|
// we are forced to make the promises run fully synchronously.
|
|
2033
|
+
|
|
2045
2034
|
function isPromise(p) {
|
|
2046
2035
|
return p && typeof p.then === 'function';
|
|
2047
2036
|
}
|
|
@@ -2225,12 +2214,12 @@
|
|
|
2225
2214
|
var decodedKey1 = _decode(encodedKey1);
|
|
2226
2215
|
var decodedKey2 = _decode(encodedKey2);
|
|
2227
2216
|
|
|
2228
|
-
if (_typeof(first) === 'object') {
|
|
2217
|
+
if (_typeof$1(first) === 'object') {
|
|
2229
2218
|
first = JSON.stringify(first);
|
|
2230
2219
|
decodedKey1 = JSON.stringify(decodedKey1);
|
|
2231
2220
|
}
|
|
2232
2221
|
|
|
2233
|
-
if (_typeof(second) === 'object') {
|
|
2222
|
+
if (_typeof$1(second) === 'object') {
|
|
2234
2223
|
second = JSON.stringify(second);
|
|
2235
2224
|
decodedKey2 = JSON.stringify(decodedKey2);
|
|
2236
2225
|
} // Encoding/decoding mismatches are usually due to a loss of
|
|
@@ -2268,7 +2257,7 @@
|
|
|
2268
2257
|
};
|
|
2269
2258
|
var keyTypes = Object.keys(keyTypeToEncodedChar);
|
|
2270
2259
|
keyTypes.forEach(function (k) {
|
|
2271
|
-
keyTypeToEncodedChar[k] = String.
|
|
2260
|
+
keyTypeToEncodedChar[k] = String.fromCodePoint(keyTypeToEncodedChar[k]);
|
|
2272
2261
|
});
|
|
2273
2262
|
var encodedCharToKeyType = keyTypes.reduce(function (o, k) {
|
|
2274
2263
|
o[keyTypeToEncodedChar[k]] = k;
|
|
@@ -2318,7 +2307,7 @@
|
|
|
2318
2307
|
|
|
2319
2308
|
key32 = decimalIndex !== -1 ? key32.replace('.', '') : key32; // Get the index of the first significant digit.
|
|
2320
2309
|
|
|
2321
|
-
var significantDigitIndex = key32.search(/(?:
|
|
2310
|
+
var significantDigitIndex = key32.search(/(?:(?!0)[\s\S])/); // Truncate leading zeros.
|
|
2322
2311
|
|
|
2323
2312
|
key32 = key32.slice(significantDigitIndex);
|
|
2324
2313
|
var sign, exponent, mantissa; // Finite cases:
|
|
@@ -2366,10 +2355,10 @@
|
|
|
2366
2355
|
|
|
2367
2356
|
switch (signValues[sign]) {
|
|
2368
2357
|
case 'negativeInfinity':
|
|
2369
|
-
return
|
|
2358
|
+
return Number.NEGATIVE_INFINITY;
|
|
2370
2359
|
|
|
2371
2360
|
case 'positiveInfinity':
|
|
2372
|
-
return
|
|
2361
|
+
return Number.POSITIVE_INFINITY;
|
|
2373
2362
|
|
|
2374
2363
|
case 'bigPositive':
|
|
2375
2364
|
return pow32(mantissa, exponent);
|
|
@@ -2481,7 +2470,7 @@
|
|
|
2481
2470
|
// `ArrayBuffer`/Views on buffers (`TypedArray` or `DataView`)
|
|
2482
2471
|
encode: function encode(key) {
|
|
2483
2472
|
return keyTypeToEncodedChar.binary + '-' + (key.byteLength ? _toConsumableArray(getCopyBytesHeldByBufferSource(key)).map(function (b) {
|
|
2484
|
-
return padStart(
|
|
2473
|
+
return String(b).padStart(3, '0');
|
|
2485
2474
|
}) // e.g., '255,005,254,000,001,033'
|
|
2486
2475
|
: '');
|
|
2487
2476
|
},
|
|
@@ -2578,13 +2567,13 @@
|
|
|
2578
2567
|
}
|
|
2579
2568
|
/**
|
|
2580
2569
|
* @param {Float} num
|
|
2581
|
-
* @param {Float} precision
|
|
2570
|
+
* @param {Float} [precision=16]
|
|
2582
2571
|
* @returns {Float}
|
|
2583
2572
|
*/
|
|
2584
2573
|
|
|
2585
2574
|
|
|
2586
|
-
function roundToPrecision(num
|
|
2587
|
-
precision =
|
|
2575
|
+
function roundToPrecision(num) {
|
|
2576
|
+
var precision = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 16;
|
|
2588
2577
|
return Number.parseFloat(num.toPrecision(precision));
|
|
2589
2578
|
}
|
|
2590
2579
|
/**
|
|
@@ -2622,7 +2611,7 @@
|
|
|
2622
2611
|
if (isDate(key)) return 'date';
|
|
2623
2612
|
if (isBinary(key)) return 'binary';
|
|
2624
2613
|
|
|
2625
|
-
var keyType = _typeof(key);
|
|
2614
|
+
var keyType = _typeof$1(key);
|
|
2626
2615
|
|
|
2627
2616
|
return ['string', 'number'].includes(keyType) ? keyType : 'invalid';
|
|
2628
2617
|
}
|
|
@@ -2796,13 +2785,8 @@
|
|
|
2796
2785
|
}
|
|
2797
2786
|
}();
|
|
2798
2787
|
|
|
2799
|
-
|
|
2800
|
-
|
|
2801
|
-
continue;
|
|
2802
|
-
|
|
2803
|
-
default:
|
|
2804
|
-
if (_typeof(_ret) === "object") return _ret.v;
|
|
2805
|
-
}
|
|
2788
|
+
if (_ret === "continue") continue;
|
|
2789
|
+
if (_typeof$1(_ret) === "object") return _ret.v;
|
|
2806
2790
|
} catch (err) {
|
|
2807
2791
|
if (!multiEntry) {
|
|
2808
2792
|
throw err;
|
|
@@ -2840,7 +2824,7 @@
|
|
|
2840
2824
|
{
|
|
2841
2825
|
// Other `typeof` types which are not valid keys:
|
|
2842
2826
|
// 'undefined', 'boolean', 'object' (including `null`), 'symbol', 'function
|
|
2843
|
-
var _type = input === null ? 'null' : _typeof(input); // Convert `null` for convenience of consumers in reporting errors
|
|
2827
|
+
var _type = input === null ? 'null' : _typeof$1(input); // Convert `null` for convenience of consumers in reporting errors
|
|
2844
2828
|
|
|
2845
2829
|
|
|
2846
2830
|
return {
|
|
@@ -3397,7 +3381,7 @@
|
|
|
3397
3381
|
getCurrentNumber(tx, store, function (key) {
|
|
3398
3382
|
if (key > MAX_ALLOWED_CURRENT_NUMBER) {
|
|
3399
3383
|
// 2 ^ 53 (See <https://github.com/w3c/IndexedDB/issues/147>)
|
|
3400
|
-
cb('failure'); // eslint-disable-line
|
|
3384
|
+
cb('failure'); // eslint-disable-line node/no-callback-literal
|
|
3401
3385
|
|
|
3402
3386
|
return;
|
|
3403
3387
|
} // Increment current number by 1 (we cannot leverage SQLite's
|
|
@@ -3478,7 +3462,7 @@
|
|
|
3478
3462
|
possiblyUpdateKeyGenerator: possiblyUpdateKeyGenerator
|
|
3479
3463
|
});
|
|
3480
3464
|
|
|
3481
|
-
var readonlyProperties$
|
|
3465
|
+
var readonlyProperties$4 = ['lower', 'upper', 'lowerOpen', 'upperOpen'];
|
|
3482
3466
|
/* eslint-disable jsdoc/check-param-names */
|
|
3483
3467
|
|
|
3484
3468
|
/**
|
|
@@ -3593,7 +3577,7 @@
|
|
|
3593
3577
|
};
|
|
3594
3578
|
|
|
3595
3579
|
IDBKeyRange.prototype[Symbol.toStringTag] = 'IDBKeyRangePrototype';
|
|
3596
|
-
readonlyProperties$
|
|
3580
|
+
readonlyProperties$4.forEach(function (prop) {
|
|
3597
3581
|
var _o, _mutatorMap;
|
|
3598
3582
|
|
|
3599
3583
|
Object.defineProperty(IDBKeyRange.prototype, '__' + prop, {
|
|
@@ -3755,11 +3739,11 @@
|
|
|
3755
3739
|
return this._items;
|
|
3756
3740
|
},
|
|
3757
3741
|
forEach: function forEach(cb, thisArg) {
|
|
3758
|
-
// eslint-disable-next-line unicorn/no-
|
|
3742
|
+
// eslint-disable-next-line unicorn/no-array-callback-reference, unicorn/no-array-method-this-argument
|
|
3759
3743
|
this._items.forEach(cb, thisArg);
|
|
3760
3744
|
},
|
|
3761
3745
|
map: function map(cb, thisArg) {
|
|
3762
|
-
// eslint-disable-next-line unicorn/no-
|
|
3746
|
+
// eslint-disable-next-line unicorn/no-array-callback-reference, unicorn/no-array-method-this-argument
|
|
3763
3747
|
return this._items.map(cb, thisArg);
|
|
3764
3748
|
},
|
|
3765
3749
|
indexOf: function indexOf(str) {
|
|
@@ -3771,9 +3755,7 @@
|
|
|
3771
3755
|
this._length++;
|
|
3772
3756
|
this.sortList();
|
|
3773
3757
|
},
|
|
3774
|
-
splice: function splice()
|
|
3775
|
-
/* index, howmany, item1, ..., itemX */
|
|
3776
|
-
{
|
|
3758
|
+
splice: function splice() {
|
|
3777
3759
|
var _this$_items;
|
|
3778
3760
|
|
|
3779
3761
|
(_this$_items = this._items).splice.apply(_this$_items, arguments);
|
|
@@ -3818,7 +3800,7 @@
|
|
|
3818
3800
|
})), _DOMStringList$protot);
|
|
3819
3801
|
Object.defineProperty(DOMStringList, Symbol.hasInstance, {
|
|
3820
3802
|
value: function value(obj) {
|
|
3821
|
-
return
|
|
3803
|
+
return Object.prototype.toString.call(obj) === 'DOMStringListPrototype';
|
|
3822
3804
|
}
|
|
3823
3805
|
});
|
|
3824
3806
|
var DOMStringListAlias = DOMStringList;
|
|
@@ -3992,9 +3974,7 @@
|
|
|
3992
3974
|
executeNextRequest();
|
|
3993
3975
|
}
|
|
3994
3976
|
|
|
3995
|
-
function error()
|
|
3996
|
-
/* tx, err */
|
|
3997
|
-
{
|
|
3977
|
+
function error() {
|
|
3998
3978
|
if (me.__errored || me.__requestsFinished) {
|
|
3999
3979
|
// We've already called "onerror", "onabort", or thrown within
|
|
4000
3980
|
// the transaction, so don't do it again.
|
|
@@ -4320,8 +4300,8 @@
|
|
|
4320
4300
|
// Store was already created so we restore to name before the rename
|
|
4321
4301
|
if ('__pendingName' in store && me.db.__oldObjectStoreNames.indexOf(store.__pendingName) > -1 // eslint-disable-line unicorn/prefer-includes
|
|
4322
4302
|
) {
|
|
4323
|
-
|
|
4324
|
-
|
|
4303
|
+
store.__name = store.__originalName;
|
|
4304
|
+
}
|
|
4325
4305
|
|
|
4326
4306
|
store.__indexNames = store.__oldIndexNames;
|
|
4327
4307
|
delete store.__pendingDelete;
|
|
@@ -4329,8 +4309,8 @@
|
|
|
4329
4309
|
// Index was already created so we restore to name before the rename
|
|
4330
4310
|
if ('__pendingName' in index && store.__oldIndexNames.indexOf(index.__pendingName) > -1 // eslint-disable-line unicorn/prefer-includes
|
|
4331
4311
|
) {
|
|
4332
|
-
|
|
4333
|
-
|
|
4312
|
+
index.__name = index.__originalName;
|
|
4313
|
+
}
|
|
4334
4314
|
|
|
4335
4315
|
delete index.__pendingDelete;
|
|
4336
4316
|
});
|
|
@@ -4512,75 +4492,27 @@
|
|
|
4512
4492
|
writable: false
|
|
4513
4493
|
});
|
|
4514
4494
|
|
|
4515
|
-
var
|
|
4516
|
-
|
|
4517
|
-
function createCommonjsModule(fn, basedir, module) {
|
|
4518
|
-
return module = {
|
|
4519
|
-
path: basedir,
|
|
4520
|
-
exports: {},
|
|
4521
|
-
require: function (path, base) {
|
|
4522
|
-
return commonjsRequire(path, (base === undefined || base === null) ? module.path : base);
|
|
4523
|
-
}
|
|
4524
|
-
}, fn(module, module.exports), module.exports;
|
|
4525
|
-
}
|
|
4526
|
-
|
|
4527
|
-
function commonjsRequire () {
|
|
4528
|
-
throw new Error('Dynamic requires are not currently supported by @rollup/plugin-commonjs');
|
|
4529
|
-
}
|
|
4495
|
+
var typeson$1 = {exports: {}};
|
|
4530
4496
|
|
|
4531
|
-
|
|
4497
|
+
(function (module, exports) {
|
|
4532
4498
|
(function (global, factory) {
|
|
4533
|
-
|
|
4499
|
+
module.exports = factory() ;
|
|
4534
4500
|
})(commonjsGlobal, function () {
|
|
4535
4501
|
|
|
4536
|
-
function _typeof
|
|
4537
|
-
|
|
4538
|
-
|
|
4539
|
-
|
|
4502
|
+
function _typeof(obj) {
|
|
4503
|
+
"@babel/helpers - typeof";
|
|
4504
|
+
|
|
4505
|
+
if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
|
|
4506
|
+
_typeof = function _typeof(obj) {
|
|
4507
|
+
return typeof obj;
|
|
4540
4508
|
};
|
|
4541
4509
|
} else {
|
|
4542
|
-
_typeof
|
|
4543
|
-
return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" :
|
|
4510
|
+
_typeof = function _typeof(obj) {
|
|
4511
|
+
return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
|
|
4544
4512
|
};
|
|
4545
4513
|
}
|
|
4546
4514
|
|
|
4547
|
-
return _typeof
|
|
4548
|
-
}
|
|
4549
|
-
|
|
4550
|
-
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
4551
|
-
try {
|
|
4552
|
-
var info = gen[key](arg);
|
|
4553
|
-
var value = info.value;
|
|
4554
|
-
} catch (error) {
|
|
4555
|
-
reject(error);
|
|
4556
|
-
return;
|
|
4557
|
-
}
|
|
4558
|
-
|
|
4559
|
-
if (info.done) {
|
|
4560
|
-
resolve(value);
|
|
4561
|
-
} else {
|
|
4562
|
-
Promise.resolve(value).then(_next, _throw);
|
|
4563
|
-
}
|
|
4564
|
-
}
|
|
4565
|
-
|
|
4566
|
-
function _asyncToGenerator(fn) {
|
|
4567
|
-
return function () {
|
|
4568
|
-
var self = this,
|
|
4569
|
-
args = arguments;
|
|
4570
|
-
return new Promise(function (resolve, reject) {
|
|
4571
|
-
var gen = fn.apply(self, args);
|
|
4572
|
-
|
|
4573
|
-
function _next(value) {
|
|
4574
|
-
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
|
|
4575
|
-
}
|
|
4576
|
-
|
|
4577
|
-
function _throw(err) {
|
|
4578
|
-
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
|
|
4579
|
-
}
|
|
4580
|
-
|
|
4581
|
-
_next(undefined);
|
|
4582
|
-
});
|
|
4583
|
-
};
|
|
4515
|
+
return _typeof(obj);
|
|
4584
4516
|
}
|
|
4585
4517
|
|
|
4586
4518
|
function _classCallCheck(instance, Constructor) {
|
|
@@ -4655,21 +4587,15 @@
|
|
|
4655
4587
|
}
|
|
4656
4588
|
|
|
4657
4589
|
function _slicedToArray(arr, i) {
|
|
4658
|
-
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest();
|
|
4590
|
+
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
|
|
4659
4591
|
}
|
|
4660
4592
|
|
|
4661
4593
|
function _toConsumableArray(arr) {
|
|
4662
|
-
return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread();
|
|
4594
|
+
return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
|
|
4663
4595
|
}
|
|
4664
4596
|
|
|
4665
4597
|
function _arrayWithoutHoles(arr) {
|
|
4666
|
-
if (Array.isArray(arr))
|
|
4667
|
-
for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) {
|
|
4668
|
-
arr2[i] = arr[i];
|
|
4669
|
-
}
|
|
4670
|
-
|
|
4671
|
-
return arr2;
|
|
4672
|
-
}
|
|
4598
|
+
if (Array.isArray(arr)) return _arrayLikeToArray(arr);
|
|
4673
4599
|
}
|
|
4674
4600
|
|
|
4675
4601
|
function _arrayWithHoles(arr) {
|
|
@@ -4677,14 +4603,11 @@
|
|
|
4677
4603
|
}
|
|
4678
4604
|
|
|
4679
4605
|
function _iterableToArray(iter) {
|
|
4680
|
-
if (Symbol.iterator in Object(iter)
|
|
4606
|
+
if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter);
|
|
4681
4607
|
}
|
|
4682
4608
|
|
|
4683
4609
|
function _iterableToArrayLimit(arr, i) {
|
|
4684
|
-
if (!(Symbol.iterator in Object(arr)
|
|
4685
|
-
return;
|
|
4686
|
-
}
|
|
4687
|
-
|
|
4610
|
+
if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return;
|
|
4688
4611
|
var _arr = [];
|
|
4689
4612
|
var _n = true;
|
|
4690
4613
|
var _d = false;
|
|
@@ -4710,30 +4633,84 @@
|
|
|
4710
4633
|
return _arr;
|
|
4711
4634
|
}
|
|
4712
4635
|
|
|
4636
|
+
function _unsupportedIterableToArray(o, minLen) {
|
|
4637
|
+
if (!o) return;
|
|
4638
|
+
if (typeof o === "string") return _arrayLikeToArray(o, minLen);
|
|
4639
|
+
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
4640
|
+
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
4641
|
+
if (n === "Map" || n === "Set") return Array.from(o);
|
|
4642
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
|
|
4643
|
+
}
|
|
4644
|
+
|
|
4645
|
+
function _arrayLikeToArray(arr, len) {
|
|
4646
|
+
if (len == null || len > arr.length) len = arr.length;
|
|
4647
|
+
|
|
4648
|
+
for (var i = 0, arr2 = new Array(len); i < len; i++) {
|
|
4649
|
+
arr2[i] = arr[i];
|
|
4650
|
+
}
|
|
4651
|
+
|
|
4652
|
+
return arr2;
|
|
4653
|
+
}
|
|
4654
|
+
|
|
4713
4655
|
function _nonIterableSpread() {
|
|
4714
|
-
throw new TypeError("Invalid attempt to spread non-iterable instance");
|
|
4656
|
+
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
4715
4657
|
}
|
|
4716
4658
|
|
|
4717
4659
|
function _nonIterableRest() {
|
|
4718
|
-
throw new TypeError("Invalid attempt to destructure non-iterable instance");
|
|
4660
|
+
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
4719
4661
|
}
|
|
4662
|
+
/**
|
|
4663
|
+
* @callback TypesonFulfilled
|
|
4664
|
+
* @returns {Promise<any>|any}
|
|
4665
|
+
*/
|
|
4666
|
+
|
|
4667
|
+
/**
|
|
4668
|
+
* @callback TypesonRejected
|
|
4669
|
+
* @returns {Promise<any>|any}
|
|
4670
|
+
*/
|
|
4671
|
+
|
|
4672
|
+
/**
|
|
4673
|
+
* @callback TypesonResolve
|
|
4674
|
+
* @param {any} value
|
|
4675
|
+
* @returns {Promise<any>}
|
|
4676
|
+
*/
|
|
4677
|
+
|
|
4678
|
+
/**
|
|
4679
|
+
* @callback TypesonReject
|
|
4680
|
+
* @param {Error|any} error
|
|
4681
|
+
* @returns {Promise<any>}
|
|
4682
|
+
*/
|
|
4683
|
+
|
|
4684
|
+
/**
|
|
4685
|
+
* @callback TypesonResolveReject
|
|
4686
|
+
* @param {TypesonResolve} typesonResolve
|
|
4687
|
+
* @param {TypesonReject} typesonReject
|
|
4688
|
+
* @returns {Promise<any>}
|
|
4689
|
+
*/
|
|
4690
|
+
|
|
4691
|
+
/* eslint-disable block-spacing, space-before-function-paren,
|
|
4692
|
+
space-before-blocks, space-infix-ops, semi, promise/avoid-new,
|
|
4693
|
+
jsdoc/require-jsdoc */
|
|
4694
|
+
|
|
4720
4695
|
/**
|
|
4721
4696
|
* We keep this function minimized so if using two instances of this
|
|
4722
4697
|
* library, where one is minimized and one is not, it will still work
|
|
4723
4698
|
* with `hasConstructorOf`.
|
|
4724
4699
|
* With ES6 classes, we may be able to simply use `class TypesonPromise
|
|
4725
4700
|
* extends Promise` and add a string tag for detection.
|
|
4726
|
-
* @param {
|
|
4701
|
+
* @param {TypesonResolveReject} f
|
|
4727
4702
|
*/
|
|
4728
|
-
// eslint-disable-next-line max-len
|
|
4729
|
-
// eslint-disable-next-line block-spacing, space-before-function-paren, space-before-blocks, space-infix-ops, semi, promise/avoid-new
|
|
4730
4703
|
|
|
4731
4704
|
|
|
4732
4705
|
var TypesonPromise = function TypesonPromise(f) {
|
|
4733
4706
|
_classCallCheck(this, TypesonPromise);
|
|
4734
4707
|
|
|
4735
4708
|
this.p = new Promise(f);
|
|
4736
|
-
};
|
|
4709
|
+
};
|
|
4710
|
+
/* eslint-enable block-spacing, space-before-function-paren,
|
|
4711
|
+
space-before-blocks, space-infix-ops, semi, promise/avoid-new,
|
|
4712
|
+
jsdoc/require-jsdoc */
|
|
4713
|
+
// eslint-disable-next-line max-len
|
|
4737
4714
|
// class TypesonPromise extends Promise {get[Symbol.toStringTag](){return 'TypesonPromise'};} // eslint-disable-line keyword-spacing, space-before-function-paren, space-before-blocks, block-spacing, semi
|
|
4738
4715
|
|
|
4739
4716
|
|
|
@@ -4747,8 +4724,8 @@
|
|
|
4747
4724
|
}
|
|
4748
4725
|
/**
|
|
4749
4726
|
*
|
|
4750
|
-
* @param {
|
|
4751
|
-
* @param {
|
|
4727
|
+
* @param {TypesonFulfilled} [onFulfilled]
|
|
4728
|
+
* @param {TypesonRejected} [onRejected]
|
|
4752
4729
|
* @returns {TypesonPromise}
|
|
4753
4730
|
*/
|
|
4754
4731
|
|
|
@@ -4768,7 +4745,7 @@
|
|
|
4768
4745
|
};
|
|
4769
4746
|
/**
|
|
4770
4747
|
*
|
|
4771
|
-
* @param {
|
|
4748
|
+
* @param {TypesonRejected} onRejected
|
|
4772
4749
|
* @returns {TypesonPromise}
|
|
4773
4750
|
*/
|
|
4774
4751
|
|
|
@@ -4778,7 +4755,7 @@
|
|
|
4778
4755
|
};
|
|
4779
4756
|
/**
|
|
4780
4757
|
*
|
|
4781
|
-
* @param {
|
|
4758
|
+
* @param {any} v
|
|
4782
4759
|
* @returns {TypesonPromise}
|
|
4783
4760
|
*/
|
|
4784
4761
|
|
|
@@ -4790,7 +4767,7 @@
|
|
|
4790
4767
|
};
|
|
4791
4768
|
/**
|
|
4792
4769
|
*
|
|
4793
|
-
* @param {
|
|
4770
|
+
* @param {any} v
|
|
4794
4771
|
* @returns {TypesonPromise}
|
|
4795
4772
|
*/
|
|
4796
4773
|
|
|
@@ -4801,10 +4778,10 @@
|
|
|
4801
4778
|
});
|
|
4802
4779
|
};
|
|
4803
4780
|
|
|
4804
|
-
['all', 'race'].forEach(function (meth) {
|
|
4781
|
+
['all', 'race', 'allSettled'].forEach(function (meth) {
|
|
4805
4782
|
/**
|
|
4806
4783
|
*
|
|
4807
|
-
* @param {Promise[]} promArr
|
|
4784
|
+
* @param {Promise<any>[]} promArr
|
|
4808
4785
|
* @returns {TypesonPromise}
|
|
4809
4786
|
*/
|
|
4810
4787
|
TypesonPromise[meth] = function (promArr) {
|
|
@@ -4818,12 +4795,12 @@
|
|
|
4818
4795
|
});
|
|
4819
4796
|
var _ref = {},
|
|
4820
4797
|
toStr = _ref.toString,
|
|
4821
|
-
hasOwn = {}.hasOwnProperty,
|
|
4798
|
+
hasOwn$1 = {}.hasOwnProperty,
|
|
4822
4799
|
getProto = Object.getPrototypeOf,
|
|
4823
|
-
fnToString = hasOwn.toString;
|
|
4800
|
+
fnToString = hasOwn$1.toString;
|
|
4824
4801
|
/**
|
|
4825
4802
|
* Second argument not in use internally, but provided for utility.
|
|
4826
|
-
* @param {
|
|
4803
|
+
* @param {any} v
|
|
4827
4804
|
* @param {boolean} catchCheck
|
|
4828
4805
|
* @returns {boolean}
|
|
4829
4806
|
*/
|
|
@@ -4833,7 +4810,7 @@
|
|
|
4833
4810
|
}
|
|
4834
4811
|
/**
|
|
4835
4812
|
*
|
|
4836
|
-
* @param {
|
|
4813
|
+
* @param {any} val
|
|
4837
4814
|
* @returns {string}
|
|
4838
4815
|
*/
|
|
4839
4816
|
|
|
@@ -4844,14 +4821,14 @@
|
|
|
4844
4821
|
/**
|
|
4845
4822
|
* This function is dependent on both constructors
|
|
4846
4823
|
* being identical so any minimization is expected of both.
|
|
4847
|
-
* @param {
|
|
4848
|
-
* @param {
|
|
4824
|
+
* @param {any} a
|
|
4825
|
+
* @param {GenericFunction} b
|
|
4849
4826
|
* @returns {boolean}
|
|
4850
4827
|
*/
|
|
4851
4828
|
|
|
4852
4829
|
|
|
4853
4830
|
function hasConstructorOf(a, b) {
|
|
4854
|
-
if (!a || _typeof
|
|
4831
|
+
if (!a || _typeof(a) !== 'object') {
|
|
4855
4832
|
return false;
|
|
4856
4833
|
}
|
|
4857
4834
|
|
|
@@ -4861,7 +4838,7 @@
|
|
|
4861
4838
|
return b === null;
|
|
4862
4839
|
}
|
|
4863
4840
|
|
|
4864
|
-
var Ctor = hasOwn.call(proto, 'constructor') && proto.constructor;
|
|
4841
|
+
var Ctor = hasOwn$1.call(proto, 'constructor') && proto.constructor;
|
|
4865
4842
|
|
|
4866
4843
|
if (typeof Ctor !== 'function') {
|
|
4867
4844
|
return b === null;
|
|
@@ -4883,7 +4860,7 @@
|
|
|
4883
4860
|
}
|
|
4884
4861
|
/**
|
|
4885
4862
|
*
|
|
4886
|
-
* @param {
|
|
4863
|
+
* @param {any} val
|
|
4887
4864
|
* @returns {boolean}
|
|
4888
4865
|
*/
|
|
4889
4866
|
|
|
@@ -4905,7 +4882,7 @@
|
|
|
4905
4882
|
}
|
|
4906
4883
|
/**
|
|
4907
4884
|
*
|
|
4908
|
-
* @param {
|
|
4885
|
+
* @param {any} val
|
|
4909
4886
|
* @returns {boolean}
|
|
4910
4887
|
*/
|
|
4911
4888
|
|
|
@@ -4926,13 +4903,13 @@
|
|
|
4926
4903
|
}
|
|
4927
4904
|
/**
|
|
4928
4905
|
*
|
|
4929
|
-
* @param {
|
|
4906
|
+
* @param {any} v
|
|
4930
4907
|
* @returns {boolean}
|
|
4931
4908
|
*/
|
|
4932
4909
|
|
|
4933
4910
|
|
|
4934
4911
|
function isObject(v) {
|
|
4935
|
-
return v && _typeof
|
|
4912
|
+
return v && _typeof(v) === 'object';
|
|
4936
4913
|
}
|
|
4937
4914
|
/**
|
|
4938
4915
|
*
|
|
@@ -4957,7 +4934,7 @@
|
|
|
4957
4934
|
/**
|
|
4958
4935
|
* @param {PlainObject|GenericArray} obj
|
|
4959
4936
|
* @param {string} keyPath
|
|
4960
|
-
* @returns {
|
|
4937
|
+
* @returns {any}
|
|
4961
4938
|
*/
|
|
4962
4939
|
|
|
4963
4940
|
|
|
@@ -4979,8 +4956,8 @@
|
|
|
4979
4956
|
*
|
|
4980
4957
|
* @param {PlainObject} obj
|
|
4981
4958
|
* @param {string} keyPath
|
|
4982
|
-
* @param {
|
|
4983
|
-
* @returns {
|
|
4959
|
+
* @param {any} value
|
|
4960
|
+
* @returns {any}
|
|
4984
4961
|
*/
|
|
4985
4962
|
|
|
4986
4963
|
|
|
@@ -5008,12 +4985,24 @@
|
|
|
5008
4985
|
|
|
5009
4986
|
|
|
5010
4987
|
function getJSONType(value) {
|
|
5011
|
-
return value === null ? 'null' : Array.isArray(value) ? 'array' : _typeof
|
|
4988
|
+
return value === null ? 'null' : Array.isArray(value) ? 'array' : _typeof(value);
|
|
4989
|
+
}
|
|
4990
|
+
|
|
4991
|
+
function _await(value, then, direct) {
|
|
4992
|
+
if (direct) {
|
|
4993
|
+
return then ? then(value) : value;
|
|
4994
|
+
}
|
|
4995
|
+
|
|
4996
|
+
if (!value || !value.then) {
|
|
4997
|
+
value = Promise.resolve(value);
|
|
4998
|
+
}
|
|
4999
|
+
|
|
5000
|
+
return then ? value.then(then) : value;
|
|
5012
5001
|
}
|
|
5013
5002
|
|
|
5014
5003
|
var keys = Object.keys,
|
|
5015
5004
|
isArray = Array.isArray,
|
|
5016
|
-
hasOwn
|
|
5005
|
+
hasOwn = {}.hasOwnProperty,
|
|
5017
5006
|
internalStateObjPropsToIgnore = ['type', 'replaced', 'iterateIn', 'iterateUnsetNumeric'];
|
|
5018
5007
|
/**
|
|
5019
5008
|
* Handle plain object revivers first so reference setting can use
|
|
@@ -5024,6 +5013,66 @@
|
|
|
5024
5013
|
* @returns {1|-1|boolean}
|
|
5025
5014
|
*/
|
|
5026
5015
|
|
|
5016
|
+
function _async(f) {
|
|
5017
|
+
return function () {
|
|
5018
|
+
for (var args = [], i = 0; i < arguments.length; i++) {
|
|
5019
|
+
args[i] = arguments[i];
|
|
5020
|
+
}
|
|
5021
|
+
|
|
5022
|
+
try {
|
|
5023
|
+
return Promise.resolve(f.apply(this, args));
|
|
5024
|
+
} catch (e) {
|
|
5025
|
+
return Promise.reject(e);
|
|
5026
|
+
}
|
|
5027
|
+
};
|
|
5028
|
+
}
|
|
5029
|
+
/**
|
|
5030
|
+
* @callback Tester
|
|
5031
|
+
* @param {any} value
|
|
5032
|
+
* @param {StateObject} stateobj
|
|
5033
|
+
* @returns {boolean}
|
|
5034
|
+
*/
|
|
5035
|
+
|
|
5036
|
+
/**
|
|
5037
|
+
* @callback Replacer
|
|
5038
|
+
* @param {any} value
|
|
5039
|
+
* @param {StateObject} stateObj
|
|
5040
|
+
* @returns {any} Should be JSON-stringifiable
|
|
5041
|
+
*/
|
|
5042
|
+
|
|
5043
|
+
/**
|
|
5044
|
+
* @callback Reviver
|
|
5045
|
+
* @param {JSON} value
|
|
5046
|
+
* @param {StateObject} stateObj
|
|
5047
|
+
* @returns {any}
|
|
5048
|
+
*/
|
|
5049
|
+
|
|
5050
|
+
/**
|
|
5051
|
+
* @typedef {PlainObject} TypesonOptions
|
|
5052
|
+
* @property {boolean} stringification Auto-set by `stringify`
|
|
5053
|
+
*/
|
|
5054
|
+
|
|
5055
|
+
/**
|
|
5056
|
+
* An instance of this class can be used to call `stringify()` and `parse()`.
|
|
5057
|
+
* Typeson resolves cyclic references by default. Can also be extended to
|
|
5058
|
+
* support custom types using the register() method.
|
|
5059
|
+
*
|
|
5060
|
+
* @class
|
|
5061
|
+
* @param {{cyclic: boolean}} [options] - if cyclic (default true),
|
|
5062
|
+
* cyclic references will be handled gracefully.
|
|
5063
|
+
*/
|
|
5064
|
+
|
|
5065
|
+
|
|
5066
|
+
function _invoke(body, then) {
|
|
5067
|
+
var result = body();
|
|
5068
|
+
|
|
5069
|
+
if (result && result.then) {
|
|
5070
|
+
return result.then(then);
|
|
5071
|
+
}
|
|
5072
|
+
|
|
5073
|
+
return then(result);
|
|
5074
|
+
}
|
|
5075
|
+
|
|
5027
5076
|
function nestedPathsFirst(a, b) {
|
|
5028
5077
|
if (a.keypath === '') {
|
|
5029
5078
|
return -1;
|
|
@@ -5042,18 +5091,11 @@
|
|
|
5042
5091
|
|
|
5043
5092
|
return as > bs ? -1 : as < bs ? 1 : a.keypath < b.keypath ? -1 : a.keypath > b.keypath;
|
|
5044
5093
|
}
|
|
5045
|
-
/**
|
|
5046
|
-
* An instance of this class can be used to call `stringify()` and `parse()`.
|
|
5047
|
-
* Typeson resolves cyclic references by default. Can also be extended to
|
|
5048
|
-
* support custom types using the register() method.
|
|
5049
|
-
*
|
|
5050
|
-
* @class
|
|
5051
|
-
* @param {{cyclic: boolean}} [options] - if cyclic (default true),
|
|
5052
|
-
* cyclic references will be handled gracefully.
|
|
5053
|
-
*/
|
|
5054
|
-
|
|
5055
5094
|
|
|
5056
5095
|
var Typeson = /*#__PURE__*/function () {
|
|
5096
|
+
/**
|
|
5097
|
+
* @param {TypesonOptions} options
|
|
5098
|
+
*/
|
|
5057
5099
|
function Typeson(options) {
|
|
5058
5100
|
_classCallCheck(this, Typeson);
|
|
5059
5101
|
|
|
@@ -5085,18 +5127,18 @@
|
|
|
5085
5127
|
* Serialize given object to Typeson.
|
|
5086
5128
|
* Initial arguments work identical to those of `JSON.stringify`.
|
|
5087
5129
|
* The `replacer` argument has nothing to do with our replacers.
|
|
5088
|
-
* @param {
|
|
5130
|
+
* @param {any} obj
|
|
5089
5131
|
* @param {JSONReplacer|string[]} replacer
|
|
5090
5132
|
* @param {number|string} space
|
|
5091
|
-
* @param {
|
|
5092
|
-
* @returns {string|Promise} Promise resolves to a string
|
|
5133
|
+
* @param {TypesonOptions} opts
|
|
5134
|
+
* @returns {string|Promise<string>} Promise resolves to a string
|
|
5093
5135
|
*/
|
|
5094
5136
|
|
|
5095
5137
|
|
|
5096
5138
|
_createClass(Typeson, [{
|
|
5097
5139
|
key: "stringify",
|
|
5098
5140
|
value: function stringify(obj, replacer, space, opts) {
|
|
5099
|
-
opts = _objectSpread2({}, this.options, {},
|
|
5141
|
+
opts = _objectSpread2(_objectSpread2(_objectSpread2({}, this.options), opts), {}, {
|
|
5100
5142
|
stringification: true
|
|
5101
5143
|
});
|
|
5102
5144
|
var encapsulated = this.encapsulate(obj, null, opts);
|
|
@@ -5111,54 +5153,61 @@
|
|
|
5111
5153
|
}
|
|
5112
5154
|
/**
|
|
5113
5155
|
* Also sync but throws on non-sync result.
|
|
5114
|
-
* @param {
|
|
5156
|
+
* @param {any} obj
|
|
5115
5157
|
* @param {JSONReplacer|string[]} replacer
|
|
5116
5158
|
* @param {number|string} space
|
|
5117
|
-
* @param {
|
|
5159
|
+
* @param {TypesonOptions} opts
|
|
5118
5160
|
* @returns {string}
|
|
5119
5161
|
*/
|
|
5120
5162
|
|
|
5121
5163
|
}, {
|
|
5122
5164
|
key: "stringifySync",
|
|
5123
5165
|
value: function stringifySync(obj, replacer, space, opts) {
|
|
5124
|
-
return this.stringify(obj, replacer, space, _objectSpread2({
|
|
5166
|
+
return this.stringify(obj, replacer, space, _objectSpread2(_objectSpread2({
|
|
5125
5167
|
throwOnBadSyncType: true
|
|
5126
|
-
}, opts, {
|
|
5168
|
+
}, opts), {}, {
|
|
5127
5169
|
sync: true
|
|
5128
5170
|
}));
|
|
5129
5171
|
}
|
|
5130
5172
|
/**
|
|
5131
5173
|
*
|
|
5132
|
-
* @param {
|
|
5174
|
+
* @param {any} obj
|
|
5133
5175
|
* @param {JSONReplacer|string[]} replacer
|
|
5134
5176
|
* @param {number|string} space
|
|
5135
|
-
* @param {
|
|
5177
|
+
* @param {TypesonOptions} opts
|
|
5136
5178
|
* @returns {Promise<string>}
|
|
5137
5179
|
*/
|
|
5138
5180
|
|
|
5139
5181
|
}, {
|
|
5140
5182
|
key: "stringifyAsync",
|
|
5141
5183
|
value: function stringifyAsync(obj, replacer, space, opts) {
|
|
5142
|
-
return this.stringify(obj, replacer, space, _objectSpread2({
|
|
5184
|
+
return this.stringify(obj, replacer, space, _objectSpread2(_objectSpread2({
|
|
5143
5185
|
throwOnBadSyncType: true
|
|
5144
|
-
}, opts, {
|
|
5186
|
+
}, opts), {}, {
|
|
5145
5187
|
sync: false
|
|
5146
5188
|
}));
|
|
5147
5189
|
}
|
|
5190
|
+
/**
|
|
5191
|
+
* @callback JSONReviver
|
|
5192
|
+
* @param {string} key
|
|
5193
|
+
* @param {JSON} value
|
|
5194
|
+
* @returns {JSON}
|
|
5195
|
+
*/
|
|
5196
|
+
|
|
5148
5197
|
/**
|
|
5149
5198
|
* Parse Typeson back into an obejct.
|
|
5150
5199
|
* Initial arguments works identical to those of `JSON.parse()`.
|
|
5151
5200
|
* @param {string} text
|
|
5152
|
-
* @param {
|
|
5201
|
+
* @param {JSONReviver} reviver This JSON reviver has nothing to do with
|
|
5153
5202
|
* our revivers.
|
|
5154
|
-
* @param {
|
|
5203
|
+
* @param {TypesonOptions} opts
|
|
5155
5204
|
* @returns {external:JSON}
|
|
5156
5205
|
*/
|
|
5157
5206
|
|
|
5158
5207
|
}, {
|
|
5159
5208
|
key: "parse",
|
|
5160
5209
|
value: function parse(text, reviver, opts) {
|
|
5161
|
-
opts = _objectSpread2({}, this.options, {},
|
|
5210
|
+
opts = _objectSpread2(_objectSpread2(_objectSpread2({}, this.options), opts), {}, {
|
|
5162
5211
|
parse: true
|
|
5163
5212
|
});
|
|
5164
5213
|
return this.revive(JSON.parse(text, reviver), opts);
|
|
@@ -5166,43 +5215,47 @@
|
|
|
5166
5215
|
/**
|
|
5167
5216
|
* Also sync but throws on non-sync result.
|
|
5168
5217
|
* @param {string} text
|
|
5169
|
-
* @param {
|
|
5218
|
+
* @param {JSONReviver} reviver This JSON reviver has nothing to do with
|
|
5170
5219
|
* our revivers.
|
|
5171
|
-
* @param {
|
|
5220
|
+
* @param {TypesonOptions} opts
|
|
5172
5221
|
* @returns {external:JSON}
|
|
5173
5222
|
*/
|
|
5174
5223
|
|
|
5175
5224
|
}, {
|
|
5176
5225
|
key: "parseSync",
|
|
5177
5226
|
value: function parseSync(text, reviver, opts) {
|
|
5178
|
-
return this.parse(text, reviver, _objectSpread2({
|
|
5227
|
+
return this.parse(text, reviver, _objectSpread2(_objectSpread2({
|
|
5179
5228
|
throwOnBadSyncType: true
|
|
5180
|
-
}, opts, {
|
|
5229
|
+
}, opts), {}, {
|
|
5181
5230
|
sync: true
|
|
5182
5231
|
}));
|
|
5183
5232
|
}
|
|
5184
5233
|
/**
|
|
5185
5234
|
* @param {string} text
|
|
5186
|
-
* @param {
|
|
5235
|
+
* @param {JSONReviver} reviver This JSON reviver has nothing to do with
|
|
5187
5236
|
* our revivers.
|
|
5188
|
-
* @param {
|
|
5189
|
-
* @returns {Promise} Resolves to `external:JSON`
|
|
5237
|
+
* @param {TypesonOptions} opts
|
|
5238
|
+
* @returns {Promise<external:JSON>} Resolves to `external:JSON`
|
|
5190
5239
|
*/
|
|
5191
5240
|
|
|
5192
5241
|
}, {
|
|
5193
5242
|
key: "parseAsync",
|
|
5194
5243
|
value: function parseAsync(text, reviver, opts) {
|
|
5195
|
-
return this.parse(text, reviver, _objectSpread2({
|
|
5244
|
+
return this.parse(text, reviver, _objectSpread2(_objectSpread2({
|
|
5196
5245
|
throwOnBadSyncType: true
|
|
5197
|
-
}, opts, {
|
|
5246
|
+
}, opts), {}, {
|
|
5198
5247
|
sync: false
|
|
5199
5248
|
}));
|
|
5200
5249
|
}
|
|
5250
|
+
/**
|
|
5251
|
+
* @typedef {} StateObject
|
|
5252
|
+
*/
|
|
5253
|
+
|
|
5201
5254
|
/**
|
|
5202
5255
|
*
|
|
5203
|
-
* @param {
|
|
5204
|
-
* @param {
|
|
5205
|
-
* @param {
|
|
5256
|
+
* @param {any} obj
|
|
5257
|
+
* @param {StateObject} stateObj
|
|
5258
|
+
* @param {TypesonOptions} [opts={}]
|
|
5206
5259
|
* @returns {string[]|false}
|
|
5207
5260
|
*/
|
|
5208
5261
|
|
|
@@ -5215,10 +5268,10 @@
|
|
|
5215
5268
|
}
|
|
5216
5269
|
/**
|
|
5217
5270
|
*
|
|
5218
|
-
* @param {
|
|
5271
|
+
* @param {any} obj
|
|
5219
5272
|
* @param {PlainObject} stateObj
|
|
5220
5273
|
* @param {PlainObject} [opts={}]
|
|
5221
|
-
* @returns {Promise
|
|
5274
|
+
* @returns {Promise<any>|GenericArray|PlainObject|string|false}
|
|
5222
5275
|
*/
|
|
5223
5276
|
|
|
5224
5277
|
}, {
|
|
@@ -5233,18 +5286,101 @@
|
|
|
5233
5286
|
* registered types with plain objects representing the types data.
|
|
5234
5287
|
*
|
|
5235
5288
|
* This method is used internally by `Typeson.stringify()`.
|
|
5236
|
-
* @param {
|
|
5289
|
+
* @param {any} obj - Object to encapsulate.
|
|
5237
5290
|
* @param {PlainObject} stateObj
|
|
5238
5291
|
* @param {PlainObject} opts
|
|
5239
|
-
* @returns {Promise
|
|
5292
|
+
* @returns {Promise<any>|GenericArray|PlainObject|string|false}
|
|
5240
5293
|
*/
|
|
5241
5294
|
|
|
5242
5295
|
}, {
|
|
5243
5296
|
key: "encapsulate",
|
|
5244
5297
|
value: function encapsulate(obj, stateObj, opts) {
|
|
5245
|
-
|
|
5298
|
+
/**
|
|
5299
|
+
*
|
|
5300
|
+
* @param {any} ret
|
|
5301
|
+
* @param {GenericArray} promisesData
|
|
5302
|
+
* @returns {Promise<any>}
|
|
5303
|
+
*/
|
|
5304
|
+
var checkPromises = _async(function (ret, promisesData) {
|
|
5305
|
+
return _await(Promise.all(promisesData.map(function (pd) {
|
|
5306
|
+
return pd[1].p;
|
|
5307
|
+
})), function (promResults) {
|
|
5308
|
+
return _await(Promise.all(promResults.map(_async(function (promResult) {
|
|
5309
|
+
var _exit = false;
|
|
5310
|
+
var newPromisesData = [];
|
|
5311
|
+
|
|
5312
|
+
var _promisesData$splice = promisesData.splice(0, 1),
|
|
5313
|
+
_promisesData$splice2 = _slicedToArray(_promisesData$splice, 1),
|
|
5314
|
+
prData = _promisesData$splice2[0];
|
|
5315
|
+
|
|
5316
|
+
var _prData = _slicedToArray(prData, 7),
|
|
5317
|
+
keyPath = _prData[0],
|
|
5318
|
+
cyclic = _prData[2],
|
|
5319
|
+
stateObj = _prData[3],
|
|
5320
|
+
parentObj = _prData[4],
|
|
5321
|
+
key = _prData[5],
|
|
5322
|
+
detectedType = _prData[6];
|
|
5323
|
+
|
|
5324
|
+
var encaps = _encapsulate(keyPath, promResult, cyclic, stateObj, newPromisesData, true, detectedType);
|
|
5325
|
+
|
|
5326
|
+
var isTypesonPromise = hasConstructorOf(encaps, TypesonPromise); // Handle case where an embedded custom type itself
|
|
5327
|
+
// returns a `Typeson.Promise`
|
|
5328
|
+
|
|
5329
|
+
return _invoke(function () {
|
|
5330
|
+
if (keyPath && isTypesonPromise) {
|
|
5331
|
+
return _await(encaps.p, function (encaps2) {
|
|
5332
|
+
parentObj[key] = encaps2;
|
|
5333
|
+
_exit = true;
|
|
5334
|
+
return checkPromises(ret, newPromisesData);
|
|
5335
|
+
});
|
|
5336
|
+
}
|
|
5337
|
+
}, function (_result) {
|
|
5338
|
+
if (_exit) return _result;
|
|
5339
|
+
|
|
5340
|
+
if (keyPath) {
|
|
5341
|
+
parentObj[key] = encaps;
|
|
5342
|
+
} else if (isTypesonPromise) {
|
|
5343
|
+
ret = encaps.p;
|
|
5344
|
+
} else {
|
|
5345
|
+
// If this is itself a `Typeson.Promise` (because the
|
|
5346
|
+
// original value supplied was a `Promise` or
|
|
5347
|
+
// because the supplied custom type value resolved
|
|
5348
|
+
// to one), returning it below will be fine since
|
|
5349
|
+
// a `Promise` is expected anyways given current
|
|
5350
|
+
// config (and if not a `Promise`, it will be ready
|
|
5351
|
+
// as the resolve value)
|
|
5352
|
+
ret = encaps;
|
|
5353
|
+
}
|
|
5354
|
+
|
|
5355
|
+
return checkPromises(ret, newPromisesData);
|
|
5356
|
+
});
|
|
5357
|
+
}))), function () {
|
|
5358
|
+
return ret;
|
|
5359
|
+
});
|
|
5360
|
+
});
|
|
5361
|
+
});
|
|
5362
|
+
/**
|
|
5363
|
+
* @typedef {PlainObject} OwnKeysObject
|
|
5364
|
+
* @property {boolean} ownKeys
|
|
5365
|
+
*/
|
|
5366
|
+
|
|
5367
|
+
/**
|
|
5368
|
+
* @callback BuiltinStateObjectPropertiesCallback
|
|
5369
|
+
* @returns {void}
|
|
5370
|
+
*/
|
|
5371
|
+
|
|
5372
|
+
/**
|
|
5373
|
+
*
|
|
5374
|
+
* @param {StateObject} stateObj
|
|
5375
|
+
* @param {OwnKeysObject} ownKeysObj
|
|
5376
|
+
* @param {BuiltinStateObjectPropertiesCallback} cb
|
|
5377
|
+
* @returns {undefined}
|
|
5378
|
+
*/
|
|
5379
|
+
|
|
5380
|
+
|
|
5381
|
+
opts = _objectSpread2(_objectSpread2({
|
|
5246
5382
|
sync: true
|
|
5247
|
-
}, this.options,
|
|
5383
|
+
}, this.options), opts);
|
|
5248
5384
|
var _opts = opts,
|
|
5249
5385
|
sync = _opts.sync;
|
|
5250
5386
|
var that = this,
|
|
@@ -5263,7 +5399,7 @@
|
|
|
5263
5399
|
var ret = _encapsulate('', obj, cyclic, stateObj || {}, promisesDataRoot);
|
|
5264
5400
|
/**
|
|
5265
5401
|
*
|
|
5266
|
-
* @param {
|
|
5402
|
+
* @param {any} ret
|
|
5267
5403
|
* @returns {GenericArray|PlainObject|string|false}
|
|
5268
5404
|
*/
|
|
5269
5405
|
|
|
@@ -5290,7 +5426,7 @@
|
|
|
5290
5426
|
|
|
5291
5427
|
if (!ret || !isPlainObject(ret) || // Also need to handle if this is an object with its
|
|
5292
5428
|
// own `$types` property (to avoid ambiguity)
|
|
5293
|
-
hasOwn
|
|
5429
|
+
hasOwn.call(ret, '$types')) {
|
|
5294
5430
|
ret = {
|
|
5295
5431
|
$: ret,
|
|
5296
5432
|
$types: {
|
|
@@ -5301,7 +5437,7 @@
|
|
|
5301
5437
|
ret.$types = types;
|
|
5302
5438
|
} // No special types
|
|
5303
5439
|
|
|
5304
|
-
} else if (isObject(ret) && hasOwn
|
|
5440
|
+
} else if (isObject(ret) && hasOwn.call(ret, '$types')) {
|
|
5305
5441
|
ret = {
|
|
5306
5442
|
$: ret,
|
|
5307
5443
|
$types: true
|
|
@@ -5314,112 +5450,6 @@
|
|
|
5314
5450
|
|
|
5315
5451
|
return ret;
|
|
5316
5452
|
}
|
|
5317
|
-
/**
|
|
5318
|
-
*
|
|
5319
|
-
* @param {Any} ret
|
|
5320
|
-
* @param {GenericArray} promisesData
|
|
5321
|
-
* @returns {Promise<Any>}
|
|
5322
|
-
*/
|
|
5323
|
-
|
|
5324
|
-
|
|
5325
|
-
function checkPromises(_x, _x2) {
|
|
5326
|
-
return _checkPromises.apply(this, arguments);
|
|
5327
|
-
}
|
|
5328
|
-
/**
|
|
5329
|
-
*
|
|
5330
|
-
* @param {object} stateObj
|
|
5331
|
-
* @param {object} ownKeysObj
|
|
5332
|
-
* @param {function} cb
|
|
5333
|
-
* @returns {undefined}
|
|
5334
|
-
*/
|
|
5335
|
-
|
|
5336
|
-
|
|
5337
|
-
function _checkPromises() {
|
|
5338
|
-
_checkPromises = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2(ret, promisesData) {
|
|
5339
|
-
var promResults;
|
|
5340
|
-
return regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
5341
|
-
while (1) {
|
|
5342
|
-
switch (_context2.prev = _context2.next) {
|
|
5343
|
-
case 0:
|
|
5344
|
-
_context2.next = 2;
|
|
5345
|
-
return Promise.all(promisesData.map(function (pd) {
|
|
5346
|
-
return pd[1].p;
|
|
5347
|
-
}));
|
|
5348
|
-
|
|
5349
|
-
case 2:
|
|
5350
|
-
promResults = _context2.sent;
|
|
5351
|
-
_context2.next = 5;
|
|
5352
|
-
return Promise.all(promResults.map( /*#__PURE__*/function () {
|
|
5353
|
-
var _ref = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(promResult) {
|
|
5354
|
-
var newPromisesData, _promisesData$splice, _promisesData$splice2, prData, _prData, keyPath, cyclic, stateObj, parentObj, key, detectedType, encaps, isTypesonPromise, encaps2;
|
|
5355
|
-
|
|
5356
|
-
return regeneratorRuntime.wrap(function _callee$(_context) {
|
|
5357
|
-
while (1) {
|
|
5358
|
-
switch (_context.prev = _context.next) {
|
|
5359
|
-
case 0:
|
|
5360
|
-
newPromisesData = [];
|
|
5361
|
-
_promisesData$splice = promisesData.splice(0, 1), _promisesData$splice2 = _slicedToArray(_promisesData$splice, 1), prData = _promisesData$splice2[0];
|
|
5362
|
-
_prData = _slicedToArray(prData, 7), keyPath = _prData[0], cyclic = _prData[2], stateObj = _prData[3], parentObj = _prData[4], key = _prData[5], detectedType = _prData[6];
|
|
5363
|
-
encaps = _encapsulate(keyPath, promResult, cyclic, stateObj, newPromisesData, true, detectedType);
|
|
5364
|
-
isTypesonPromise = hasConstructorOf(encaps, TypesonPromise); // Handle case where an embedded custom type itself
|
|
5365
|
-
// returns a `Typeson.Promise`
|
|
5366
|
-
|
|
5367
|
-
if (!(keyPath && isTypesonPromise)) {
|
|
5368
|
-
_context.next = 11;
|
|
5369
|
-
break;
|
|
5370
|
-
}
|
|
5371
|
-
|
|
5372
|
-
_context.next = 8;
|
|
5373
|
-
return encaps.p;
|
|
5374
|
-
|
|
5375
|
-
case 8:
|
|
5376
|
-
encaps2 = _context.sent;
|
|
5377
|
-
parentObj[key] = encaps2;
|
|
5378
|
-
return _context.abrupt("return", checkPromises(ret, newPromisesData));
|
|
5379
|
-
|
|
5380
|
-
case 11:
|
|
5381
|
-
if (keyPath) {
|
|
5382
|
-
parentObj[key] = encaps;
|
|
5383
|
-
} else if (isTypesonPromise) {
|
|
5384
|
-
ret = encaps.p;
|
|
5385
|
-
} else {
|
|
5386
|
-
// If this is itself a `Typeson.Promise` (because the
|
|
5387
|
-
// original value supplied was a `Promise` or
|
|
5388
|
-
// because the supplied custom type value resolved
|
|
5389
|
-
// to one), returning it below will be fine since
|
|
5390
|
-
// a `Promise` is expected anyways given current
|
|
5391
|
-
// config (and if not a `Promise`, it will be ready
|
|
5392
|
-
// as the resolve value)
|
|
5393
|
-
ret = encaps;
|
|
5394
|
-
}
|
|
5395
|
-
|
|
5396
|
-
return _context.abrupt("return", checkPromises(ret, newPromisesData));
|
|
5397
|
-
|
|
5398
|
-
case 13:
|
|
5399
|
-
case "end":
|
|
5400
|
-
return _context.stop();
|
|
5401
|
-
}
|
|
5402
|
-
}
|
|
5403
|
-
}, _callee);
|
|
5404
|
-
}));
|
|
5405
|
-
|
|
5406
|
-
return function (_x3) {
|
|
5407
|
-
return _ref.apply(this, arguments);
|
|
5408
|
-
};
|
|
5409
|
-
}()));
|
|
5410
|
-
|
|
5411
|
-
case 5:
|
|
5412
|
-
return _context2.abrupt("return", ret);
|
|
5413
|
-
|
|
5414
|
-
case 6:
|
|
5415
|
-
case "end":
|
|
5416
|
-
return _context2.stop();
|
|
5417
|
-
}
|
|
5418
|
-
}
|
|
5419
|
-
}, _callee2);
|
|
5420
|
-
}));
|
|
5421
|
-
return _checkPromises.apply(this, arguments);
|
|
5422
|
-
}
|
|
5423
5453
|
|
|
5424
5454
|
function _adaptBuiltinStateObjectProperties(stateObj, ownKeysObj, cb) {
|
|
5425
5455
|
Object.assign(stateObj, ownKeysObj);
|
|
@@ -5427,7 +5457,7 @@
|
|
|
5427
5457
|
var tmp = stateObj[prop];
|
|
5428
5458
|
delete stateObj[prop];
|
|
5429
5459
|
return tmp;
|
|
5430
|
-
}); // eslint-disable-next-line callback-return
|
|
5460
|
+
}); // eslint-disable-next-line node/callback-return
|
|
5431
5461
|
|
|
5432
5462
|
cb();
|
|
5433
5463
|
internalStateObjPropsToIgnore.forEach(function (prop, i) {
|
|
@@ -5437,13 +5467,13 @@
|
|
|
5437
5467
|
/**
|
|
5438
5468
|
*
|
|
5439
5469
|
* @param {string} keypath
|
|
5440
|
-
* @param {
|
|
5470
|
+
* @param {any} value
|
|
5441
5471
|
* @param {boolean} cyclic
|
|
5442
5472
|
* @param {PlainObject} stateObj
|
|
5443
5473
|
* @param {boolean} promisesData
|
|
5444
5474
|
* @param {boolean} resolvingTypesonPromise
|
|
5445
5475
|
* @param {string} detectedType
|
|
5446
|
-
* @returns {
|
|
5476
|
+
* @returns {any}
|
|
5447
5477
|
*/
|
|
5448
5478
|
|
|
5449
5479
|
|
|
@@ -5451,7 +5481,7 @@
|
|
|
5451
5481
|
var ret;
|
|
5452
5482
|
var observerData = {};
|
|
5453
5483
|
|
|
5454
|
-
var $typeof = _typeof
|
|
5484
|
+
var $typeof = _typeof(value);
|
|
5455
5485
|
|
|
5456
5486
|
var runObserver = encapsulateObserver ? function (obj) {
|
|
5457
5487
|
var type = detectedType || stateObj.type || Typeson.getJSONType(value);
|
|
@@ -5469,12 +5499,8 @@
|
|
|
5469
5499
|
} : null;
|
|
5470
5500
|
|
|
5471
5501
|
if (['string', 'boolean', 'number', 'undefined'].includes($typeof)) {
|
|
5472
|
-
if (value === undefined ||
|
|
5473
|
-
|
|
5474
|
-
ret = value;
|
|
5475
|
-
} else {
|
|
5476
|
-
ret = replace(keypath, value, stateObj, promisesData, false, resolvingTypesonPromise, runObserver);
|
|
5477
|
-
}
|
|
5502
|
+
if (value === undefined || Number.isNaN(value) || value === Number.NEGATIVE_INFINITY || value === Number.POSITIVE_INFINITY) {
|
|
5503
|
+
ret = stateObj.replaced ? value : replace(keypath, value, stateObj, promisesData, false, resolvingTypesonPromise, runObserver);
|
|
5478
5504
|
|
|
5479
5505
|
if (ret !== value) {
|
|
5480
5506
|
observerData = {
|
|
@@ -5500,7 +5526,7 @@
|
|
|
5500
5526
|
return value;
|
|
5501
5527
|
}
|
|
5502
5528
|
|
|
5503
|
-
if (cyclic && !stateObj.iterateIn && !stateObj.iterateUnsetNumeric && value && _typeof
|
|
5529
|
+
if (cyclic && !stateObj.iterateIn && !stateObj.iterateUnsetNumeric && value && _typeof(value) === 'object') {
|
|
5504
5530
|
// Options set to detect cyclic references and be able
|
|
5505
5531
|
// to rewrite them.
|
|
5506
5532
|
var refIndex = refObjs.indexOf(value);
|
|
@@ -5543,11 +5569,12 @@
|
|
|
5543
5569
|
promisesData.push([keypath, value, cyclic, stateObj, undefined, undefined, stateObj.type]);
|
|
5544
5570
|
ret = value;
|
|
5545
5571
|
} else if (isArr && stateObj.iterateIn !== 'object' || stateObj.iterateIn === 'array') {
|
|
5572
|
+
// eslint-disable-next-line unicorn/no-new-array -- Sparse
|
|
5546
5573
|
clone = new Array(value.length);
|
|
5547
5574
|
observerData = {
|
|
5548
5575
|
clone: clone
|
|
5549
5576
|
};
|
|
5550
|
-
} else if (!['function', 'symbol'].includes(_typeof
|
|
5577
|
+
} else if (!['function', 'symbol'].includes(_typeof(value)) && !('toJSON' in value) && !hasConstructorOf(value, TypesonPromise) && !hasConstructorOf(value, Promise) && !hasConstructorOf(value, ArrayBuffer) || isPlainObj || stateObj.iterateIn === 'object') {
|
|
5551
5578
|
clone = {};
|
|
5552
5579
|
|
|
5553
5580
|
if (stateObj.addLength) {
|
|
@@ -5578,7 +5605,7 @@
|
|
|
5578
5605
|
if (stateObj.iterateIn) {
|
|
5579
5606
|
var _loop = function _loop(key) {
|
|
5580
5607
|
var ownKeysObj = {
|
|
5581
|
-
ownKeys: hasOwn
|
|
5608
|
+
ownKeys: hasOwn.call(value, key)
|
|
5582
5609
|
};
|
|
5583
5610
|
|
|
5584
5611
|
_adaptBuiltinStateObjectProperties(stateObj, ownKeysObj, function () {
|
|
@@ -5675,16 +5702,50 @@
|
|
|
5675
5702
|
|
|
5676
5703
|
return clone;
|
|
5677
5704
|
}
|
|
5705
|
+
/**
|
|
5706
|
+
* @typedef {PlainObject} KeyPathEvent
|
|
5707
|
+
* @property {string} cyclicKeypath
|
|
5708
|
+
*/
|
|
5709
|
+
|
|
5710
|
+
/**
|
|
5711
|
+
* @typedef {PlainObject} EndIterateInEvent
|
|
5712
|
+
* @property {boolean} endIterateIn
|
|
5713
|
+
* @property {boolean} end
|
|
5714
|
+
*/
|
|
5715
|
+
|
|
5716
|
+
/**
|
|
5717
|
+
* @typedef {PlainObject} EndIterateUnsetNumericEvent
|
|
5718
|
+
* @property {boolean} endIterateUnsetNumeric
|
|
5719
|
+
* @property {boolean} end
|
|
5720
|
+
*/
|
|
5721
|
+
|
|
5722
|
+
/**
|
|
5723
|
+
* @typedef {PlainObject} TypeDetectedEvent
|
|
5724
|
+
* @property {boolean} typeDetected
|
|
5725
|
+
*/
|
|
5726
|
+
|
|
5727
|
+
/**
|
|
5728
|
+
* @typedef {PlainObject} ReplacingEvent
|
|
5729
|
+
* @property {boolean} replacing
|
|
5730
|
+
*/
|
|
5731
|
+
|
|
5732
|
+
/**
|
|
5733
|
+
* @callback Observer
|
|
5734
|
+
* @param {KeyPathEvent|EndIterateInEvent|EndIterateUnsetNumericEvent|
|
|
5735
|
+
* TypeDetectedEvent|ReplacingEvent} [event]
|
|
5736
|
+
* @returns {void}
|
|
5737
|
+
*/
|
|
5738
|
+
|
|
5678
5739
|
/**
|
|
5679
5740
|
*
|
|
5680
5741
|
* @param {string} keypath
|
|
5681
|
-
* @param {
|
|
5742
|
+
* @param {any} value
|
|
5682
5743
|
* @param {PlainObject} stateObj
|
|
5683
5744
|
* @param {GenericArray} promisesData
|
|
5684
5745
|
* @param {boolean} plainObject
|
|
5685
5746
|
* @param {boolean} resolvingTypesonPromise
|
|
5686
|
-
* @param {
|
|
5687
|
-
* @returns {
|
|
5747
|
+
* @param {Observer} [runObserver]
|
|
5748
|
+
* @returns {any}
|
|
5688
5749
|
*/
|
|
5689
5750
|
|
|
5690
5751
|
|
|
@@ -5755,46 +5816,47 @@
|
|
|
5755
5816
|
}
|
|
5756
5817
|
/**
|
|
5757
5818
|
* Also sync but throws on non-sync result.
|
|
5758
|
-
* @param {
|
|
5759
|
-
* @param {
|
|
5760
|
-
* @param {
|
|
5761
|
-
* @returns {
|
|
5819
|
+
* @param {any} obj
|
|
5820
|
+
* @param {StateObject} stateObj
|
|
5821
|
+
* @param {TypesonOptions} opts
|
|
5822
|
+
* @returns {any}
|
|
5762
5823
|
*/
|
|
5763
5824
|
|
|
5764
5825
|
}, {
|
|
5765
5826
|
key: "encapsulateSync",
|
|
5766
5827
|
value: function encapsulateSync(obj, stateObj, opts) {
|
|
5767
|
-
return this.encapsulate(obj, stateObj, _objectSpread2({
|
|
5828
|
+
return this.encapsulate(obj, stateObj, _objectSpread2(_objectSpread2({
|
|
5768
5829
|
throwOnBadSyncType: true
|
|
5769
|
-
}, opts, {
|
|
5830
|
+
}, opts), {}, {
|
|
5770
5831
|
sync: true
|
|
5771
5832
|
}));
|
|
5772
5833
|
}
|
|
5773
5834
|
/**
|
|
5774
|
-
* @param {
|
|
5775
|
-
* @param {
|
|
5776
|
-
* @param {
|
|
5777
|
-
* @returns {
|
|
5835
|
+
* @param {any} obj
|
|
5836
|
+
* @param {StateObject} stateObj
|
|
5837
|
+
* @param {TypesonOptions} opts
|
|
5838
|
+
* @returns {any}
|
|
5778
5839
|
*/
|
|
5779
5840
|
|
|
5780
5841
|
}, {
|
|
5781
5842
|
key: "encapsulateAsync",
|
|
5782
5843
|
value: function encapsulateAsync(obj, stateObj, opts) {
|
|
5783
|
-
return this.encapsulate(obj, stateObj, _objectSpread2({
|
|
5844
|
+
return this.encapsulate(obj, stateObj, _objectSpread2(_objectSpread2({
|
|
5784
5845
|
throwOnBadSyncType: true
|
|
5785
|
-
}, opts, {
|
|
5846
|
+
}, opts), {}, {
|
|
5786
5847
|
sync: false
|
|
5787
5848
|
}));
|
|
5788
5849
|
}
|
|
5789
5850
|
/**
|
|
5790
5851
|
* Revive an encapsulated object.
|
|
5791
5852
|
* This method is used internally by `Typeson.parse()`.
|
|
5792
|
-
* @param {
|
|
5793
|
-
* properties that are listed there will be replaced with its true
|
|
5794
|
-
* instead of just plain objects.
|
|
5795
|
-
* @param {
|
|
5853
|
+
* @param {PlainObject} obj - Object to revive. If it has `$types` member,
|
|
5854
|
+
* the properties that are listed there will be replaced with its true
|
|
5855
|
+
* type instead of just plain objects.
|
|
5856
|
+
* @param {TypesonOptions} opts
|
|
5796
5857
|
* @throws TypeError If mismatch between sync/async type and result
|
|
5797
|
-
* @returns {Promise
|
|
5858
|
+
* @returns {Promise<any>|any} If async, returns a Promise that resolves
|
|
5859
|
+
* to `any`.
|
|
5798
5860
|
*/
|
|
5799
5861
|
|
|
5800
5862
|
}, {
|
|
@@ -5812,9 +5874,9 @@
|
|
|
5812
5874
|
return obj.$;
|
|
5813
5875
|
}
|
|
5814
5876
|
|
|
5815
|
-
opts = _objectSpread2({
|
|
5877
|
+
opts = _objectSpread2(_objectSpread2({
|
|
5816
5878
|
sync: true
|
|
5817
|
-
}, this.options,
|
|
5879
|
+
}, this.options), opts);
|
|
5818
5880
|
var _opts3 = opts,
|
|
5819
5881
|
sync = _opts3.sync;
|
|
5820
5882
|
var keyPathResolutions = [];
|
|
@@ -5832,22 +5894,23 @@
|
|
|
5832
5894
|
var that = this;
|
|
5833
5895
|
/**
|
|
5834
5896
|
* @callback RevivalReducer
|
|
5835
|
-
* @param {
|
|
5897
|
+
* @param {any} value
|
|
5836
5898
|
* @param {string} type
|
|
5837
|
-
* @returns {
|
|
5899
|
+
* @returns {any}
|
|
5838
5900
|
*/
|
|
5839
5901
|
|
|
5840
5902
|
/**
|
|
5841
5903
|
*
|
|
5842
5904
|
* @param {string} type
|
|
5843
|
-
* @param {
|
|
5844
|
-
* @
|
|
5905
|
+
* @param {any} val
|
|
5906
|
+
* @throws {Error}
|
|
5907
|
+
* @returns {any}
|
|
5845
5908
|
*/
|
|
5846
5909
|
|
|
5847
5910
|
function executeReviver(type, val) {
|
|
5848
|
-
var
|
|
5849
|
-
|
|
5850
|
-
reviver =
|
|
5911
|
+
var _ref = that.revivers[type] || [],
|
|
5912
|
+
_ref2 = _slicedToArray(_ref, 1),
|
|
5913
|
+
reviver = _ref2[0];
|
|
5851
5914
|
|
|
5852
5915
|
if (!reviver) {
|
|
5853
5916
|
throw new Error('Unregistered type: ' + type);
|
|
@@ -5874,10 +5937,10 @@
|
|
|
5874
5937
|
// const references = [];
|
|
5875
5938
|
// const reviveTypes = [];
|
|
5876
5939
|
var plainObjectTypes = [];
|
|
5877
|
-
Object.entries(types).forEach(function (
|
|
5878
|
-
var
|
|
5879
|
-
keypath =
|
|
5880
|
-
type =
|
|
5940
|
+
Object.entries(types).forEach(function (_ref3) {
|
|
5941
|
+
var _ref4 = _slicedToArray(_ref3, 2),
|
|
5942
|
+
keypath = _ref4[0],
|
|
5943
|
+
type = _ref4[1];
|
|
5881
5944
|
|
|
5882
5945
|
if (type === '#') {
|
|
5883
5946
|
/*
|
|
@@ -5890,9 +5953,9 @@
|
|
|
5890
5953
|
}
|
|
5891
5954
|
|
|
5892
5955
|
[].concat(type).forEach(function (type) {
|
|
5893
|
-
var
|
|
5894
|
-
|
|
5895
|
-
plain =
|
|
5956
|
+
var _ref5 = that.revivers[type] || [null, {}],
|
|
5957
|
+
_ref6 = _slicedToArray(_ref5, 2),
|
|
5958
|
+
plain = _ref6[1].plain;
|
|
5896
5959
|
|
|
5897
5960
|
if (!plain) {
|
|
5898
5961
|
// reviveTypes.push({keypath, type});
|
|
@@ -5918,9 +5981,9 @@
|
|
|
5918
5981
|
*/
|
|
5919
5982
|
|
|
5920
5983
|
|
|
5921
|
-
return plainObjectTypes.sort(nestedPathsFirst).reduce(function reducer(possibleTypesonPromise,
|
|
5922
|
-
var keypath =
|
|
5923
|
-
type =
|
|
5984
|
+
return plainObjectTypes.sort(nestedPathsFirst).reduce(function reducer(possibleTypesonPromise, _ref7) {
|
|
5985
|
+
var keypath = _ref7.keypath,
|
|
5986
|
+
type = _ref7.type;
|
|
5924
5987
|
|
|
5925
5988
|
if (isThenable(possibleTypesonPromise)) {
|
|
5926
5989
|
return possibleTypesonPromise.then(function (val) {
|
|
@@ -5963,11 +6026,11 @@
|
|
|
5963
6026
|
/**
|
|
5964
6027
|
*
|
|
5965
6028
|
* @param {string} keypath
|
|
5966
|
-
* @param {
|
|
5967
|
-
* @param {?(
|
|
5968
|
-
* @param {
|
|
6029
|
+
* @param {any} value
|
|
6030
|
+
* @param {?(GenericArray|PlainObject)} target
|
|
6031
|
+
* @param {GenericArray|PlainObject} [clone]
|
|
5969
6032
|
* @param {string} [key]
|
|
5970
|
-
* @returns {
|
|
6033
|
+
* @returns {any}
|
|
5971
6034
|
*/
|
|
5972
6035
|
|
|
5973
6036
|
function _revive(keypath, value, target, clone, key) {
|
|
@@ -5979,6 +6042,7 @@
|
|
|
5979
6042
|
var isArr = isArray(value);
|
|
5980
6043
|
|
|
5981
6044
|
if (isArr || isPlainObject(value)) {
|
|
6045
|
+
// eslint-disable-next-line unicorn/no-new-array -- Sparse
|
|
5982
6046
|
var _clone = isArr ? new Array(value.length) : {}; // Iterate object or array
|
|
5983
6047
|
|
|
5984
6048
|
|
|
@@ -6054,8 +6118,8 @@
|
|
|
6054
6118
|
}
|
|
6055
6119
|
/**
|
|
6056
6120
|
*
|
|
6057
|
-
* @param {
|
|
6058
|
-
* @returns {undefined|
|
|
6121
|
+
* @param {any} retrn
|
|
6122
|
+
* @returns {undefined|any}
|
|
6059
6123
|
*/
|
|
6060
6124
|
|
|
6061
6125
|
|
|
@@ -6078,9 +6142,9 @@
|
|
|
6078
6142
|
ret = TypesonPromise.resolve(ret).then(function (r) {
|
|
6079
6143
|
return TypesonPromise.all([// May be a TypesonPromise or not
|
|
6080
6144
|
r].concat(revivalPromises));
|
|
6081
|
-
}).then(function (
|
|
6082
|
-
var
|
|
6083
|
-
r =
|
|
6145
|
+
}).then(function (_ref8) {
|
|
6146
|
+
var _ref9 = _slicedToArray(_ref8, 1),
|
|
6147
|
+
r = _ref9[0];
|
|
6084
6148
|
|
|
6085
6149
|
return r;
|
|
6086
6150
|
});
|
|
@@ -6095,42 +6159,46 @@
|
|
|
6095
6159
|
}
|
|
6096
6160
|
/**
|
|
6097
6161
|
* Also sync but throws on non-sync result.
|
|
6098
|
-
* @param {
|
|
6099
|
-
* @param {
|
|
6100
|
-
* @returns {
|
|
6162
|
+
* @param {any} obj
|
|
6163
|
+
* @param {TypesonOptions} opts
|
|
6164
|
+
* @returns {any}
|
|
6101
6165
|
*/
|
|
6102
6166
|
|
|
6103
6167
|
}, {
|
|
6104
6168
|
key: "reviveSync",
|
|
6105
6169
|
value: function reviveSync(obj, opts) {
|
|
6106
|
-
return this.revive(obj, _objectSpread2({
|
|
6170
|
+
return this.revive(obj, _objectSpread2(_objectSpread2({
|
|
6107
6171
|
throwOnBadSyncType: true
|
|
6108
|
-
}, opts, {
|
|
6172
|
+
}, opts), {}, {
|
|
6109
6173
|
sync: true
|
|
6110
6174
|
}));
|
|
6111
6175
|
}
|
|
6112
6176
|
/**
|
|
6113
|
-
* @param {
|
|
6114
|
-
* @param {
|
|
6115
|
-
* @returns {Promise}
|
|
6177
|
+
* @param {any} obj
|
|
6178
|
+
* @param {TypesonOptions} opts
|
|
6179
|
+
* @returns {Promise<any>}
|
|
6116
6180
|
*/
|
|
6117
6181
|
|
|
6118
6182
|
}, {
|
|
6119
6183
|
key: "reviveAsync",
|
|
6120
6184
|
value: function reviveAsync(obj, opts) {
|
|
6121
|
-
return this.revive(obj, _objectSpread2({
|
|
6185
|
+
return this.revive(obj, _objectSpread2(_objectSpread2({
|
|
6122
6186
|
throwOnBadSyncType: true
|
|
6123
|
-
}, opts, {
|
|
6187
|
+
}, opts), {}, {
|
|
6124
6188
|
sync: false
|
|
6125
6189
|
}));
|
|
6126
6190
|
}
|
|
6191
|
+
/**
|
|
6192
|
+
* @typedef {Tester|Replacer|Reviver} Spec
|
|
6193
|
+
*/
|
|
6194
|
+
|
|
6127
6195
|
/**
|
|
6128
6196
|
* Register types.
|
|
6129
6197
|
* For examples on how to use this method, see
|
|
6130
6198
|
* {@link https://github.com/dfahlander/typeson-registry/tree/master/types}.
|
|
6131
|
-
* @param {object
|
|
6132
|
-
*
|
|
6133
|
-
* @param {
|
|
6199
|
+
* @param {object<string,Spec[]>[]} typeSpecSets -
|
|
6200
|
+
* Types and their functions [test, encapsulate, revive];
|
|
6201
|
+
* @param {TypesonOptions} opts
|
|
6134
6202
|
* @returns {Typeson}
|
|
6135
6203
|
*/
|
|
6136
6204
|
|
|
@@ -6213,7 +6281,7 @@
|
|
|
6213
6281
|
replacerObj.replaceAsync = spec.replaceAsync.bind(spec);
|
|
6214
6282
|
}
|
|
6215
6283
|
|
|
6216
|
-
var start = typeof opts.fallback === 'number' ? opts.fallback : opts.fallback ? 0 :
|
|
6284
|
+
var start = typeof opts.fallback === 'number' ? opts.fallback : opts.fallback ? 0 : Number.POSITIVE_INFINITY;
|
|
6217
6285
|
|
|
6218
6286
|
if (spec.testPlainObjects) {
|
|
6219
6287
|
this.plainObjectReplacers.splice(start, 0, replacerObj);
|
|
@@ -6281,9 +6349,9 @@
|
|
|
6281
6349
|
Typeson.JSON_TYPES = ['null', 'boolean', 'number', 'string', 'array', 'object'];
|
|
6282
6350
|
return Typeson;
|
|
6283
6351
|
});
|
|
6284
|
-
});
|
|
6352
|
+
})(typeson$1);
|
|
6285
6353
|
|
|
6286
|
-
|
|
6354
|
+
var Typeson = typeson$1.exports;
|
|
6287
6355
|
|
|
6288
6356
|
/*
|
|
6289
6357
|
* base64-arraybuffer
|
|
@@ -6307,7 +6375,7 @@
|
|
|
6307
6375
|
*/
|
|
6308
6376
|
|
|
6309
6377
|
|
|
6310
|
-
var encode = function encode(arraybuffer, byteOffset, lngth) {
|
|
6378
|
+
var encode$1 = function encode(arraybuffer, byteOffset, lngth) {
|
|
6311
6379
|
if (lngth === null || lngth === undefined) {
|
|
6312
6380
|
lngth = arraybuffer.byteLength; // Needed for Safari
|
|
6313
6381
|
}
|
|
@@ -6338,7 +6406,7 @@
|
|
|
6338
6406
|
*/
|
|
6339
6407
|
|
|
6340
6408
|
|
|
6341
|
-
var decode = function decode(base64) {
|
|
6409
|
+
var decode$1 = function decode(base64) {
|
|
6342
6410
|
var len = base64.length;
|
|
6343
6411
|
var bufferLength = base64.length * 0.75;
|
|
6344
6412
|
var p = 0;
|
|
@@ -6371,7 +6439,7 @@
|
|
|
6371
6439
|
var arraybuffer = {
|
|
6372
6440
|
arraybuffer: {
|
|
6373
6441
|
test: function test(x) {
|
|
6374
|
-
return
|
|
6442
|
+
return Typeson.toStringTag(x) === 'ArrayBuffer';
|
|
6375
6443
|
},
|
|
6376
6444
|
replace: function replace(b, stateObj) {
|
|
6377
6445
|
if (!stateObj.buffers) {
|
|
@@ -6387,18 +6455,18 @@
|
|
|
6387
6455
|
}
|
|
6388
6456
|
|
|
6389
6457
|
stateObj.buffers.push(b);
|
|
6390
|
-
return encode(b);
|
|
6458
|
+
return encode$1(b);
|
|
6391
6459
|
},
|
|
6392
6460
|
revive: function revive(b64, stateObj) {
|
|
6393
6461
|
if (!stateObj.buffers) {
|
|
6394
6462
|
stateObj.buffers = [];
|
|
6395
6463
|
}
|
|
6396
6464
|
|
|
6397
|
-
if (_typeof(b64) === 'object') {
|
|
6465
|
+
if (_typeof$1(b64) === 'object') {
|
|
6398
6466
|
return stateObj.buffers[b64.index];
|
|
6399
6467
|
}
|
|
6400
6468
|
|
|
6401
|
-
var buffer = decode(b64);
|
|
6469
|
+
var buffer = decode$1(b64);
|
|
6402
6470
|
stateObj.buffers.push(buffer);
|
|
6403
6471
|
return buffer;
|
|
6404
6472
|
}
|
|
@@ -6409,7 +6477,7 @@
|
|
|
6409
6477
|
var bigintObject = {
|
|
6410
6478
|
bigintObject: {
|
|
6411
6479
|
test: function test(x) {
|
|
6412
|
-
return _typeof(x) === 'object' &&
|
|
6480
|
+
return _typeof$1(x) === 'object' && Typeson.hasConstructorOf(x, BigInt);
|
|
6413
6481
|
},
|
|
6414
6482
|
replace: function replace(n) {
|
|
6415
6483
|
return String(n);
|
|
@@ -6508,14 +6576,12 @@
|
|
|
6508
6576
|
var blob = {
|
|
6509
6577
|
blob: {
|
|
6510
6578
|
test: function test(x) {
|
|
6511
|
-
return
|
|
6579
|
+
return Typeson.toStringTag(x) === 'Blob';
|
|
6512
6580
|
},
|
|
6513
6581
|
replace: function replace(b) {
|
|
6514
6582
|
// Sync
|
|
6515
6583
|
var req = new XMLHttpRequest();
|
|
6516
|
-
req.overrideMimeType('text/plain; charset=x-user-defined');
|
|
6517
|
-
// eslint-disable-next-line node/no-unsupported-features/node-builtins
|
|
6518
|
-
|
|
6584
|
+
req.overrideMimeType('text/plain; charset=x-user-defined');
|
|
6519
6585
|
req.open('GET', URL.createObjectURL(b), false); // Sync
|
|
6520
6586
|
|
|
6521
6587
|
req.send(); // Seems not feasible to accurately simulate
|
|
@@ -6539,7 +6605,7 @@
|
|
|
6539
6605
|
});
|
|
6540
6606
|
},
|
|
6541
6607
|
replaceAsync: function replaceAsync(b) {
|
|
6542
|
-
return new
|
|
6608
|
+
return new Typeson.Promise(function (resolve, reject) {
|
|
6543
6609
|
/*
|
|
6544
6610
|
if (b.isClosed) { // On MDN, but not in https://w3c.github.io/FileAPI/#dfn-Blob
|
|
6545
6611
|
reject(new Error('The Blob is closed'));
|
|
@@ -6579,11 +6645,12 @@
|
|
|
6579
6645
|
// Adapted from original: public domain/MIT: http://stackoverflow.com/a/8809472/271577
|
|
6580
6646
|
|
|
6581
6647
|
/* istanbul ignore next */
|
|
6582
|
-
var d =
|
|
6648
|
+
var d = Date.now() + ( // use high-precision timer if available
|
|
6649
|
+
// istanbul ignore next
|
|
6583
6650
|
typeof performance !== 'undefined' && typeof performance.now === 'function' ? performance.now() : 0);
|
|
6584
6651
|
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
|
|
6585
6652
|
/* eslint-disable no-bitwise */
|
|
6586
|
-
var r = (d + Math.random() * 16) % 16
|
|
6653
|
+
var r = Math.trunc((d + Math.random() * 16) % 16);
|
|
6587
6654
|
d = Math.floor(d / 16);
|
|
6588
6655
|
return (c === 'x' ? r : r & 0x3 | 0x8).toString(16);
|
|
6589
6656
|
/* eslint-enable no-bitwise */
|
|
@@ -6594,7 +6661,7 @@
|
|
|
6594
6661
|
var cloneable = {
|
|
6595
6662
|
cloneable: {
|
|
6596
6663
|
test: function test(x) {
|
|
6597
|
-
return x && _typeof(x) === 'object' && typeof x[Symbol["for"]('cloneEncapsulate')] === 'function';
|
|
6664
|
+
return x && _typeof$1(x) === 'object' && typeof x[Symbol["for"]('cloneEncapsulate')] === 'function';
|
|
6598
6665
|
},
|
|
6599
6666
|
replace: function replace(clonable) {
|
|
6600
6667
|
var encapsulated = clonable[Symbol["for"]('cloneEncapsulate')]();
|
|
@@ -6613,10 +6680,47 @@
|
|
|
6613
6680
|
}
|
|
6614
6681
|
};
|
|
6615
6682
|
|
|
6683
|
+
/* globals crypto */
|
|
6684
|
+
var cryptokey = {
|
|
6685
|
+
cryptokey: {
|
|
6686
|
+
test: function test(x) {
|
|
6687
|
+
return Typeson.toStringTag(x) === 'CryptoKey' && x.extractable;
|
|
6688
|
+
},
|
|
6689
|
+
replaceAsync: function replaceAsync(key) {
|
|
6690
|
+
return new Typeson.Promise(function (resolve, reject) {
|
|
6691
|
+
// eslint-disable-next-line promise/catch-or-return
|
|
6692
|
+
crypto.subtle.exportKey('jwk', key)["catch"](
|
|
6693
|
+
/* eslint-disable promise/prefer-await-to-callbacks */
|
|
6694
|
+
// istanbul ignore next
|
|
6695
|
+
function (err) {
|
|
6696
|
+
/* eslint-enable promise/prefer-await-to-callbacks */
|
|
6697
|
+
// eslint-disable-next-line max-len
|
|
6698
|
+
// istanbul ignore next -- Our format should be valid and our key extractable
|
|
6699
|
+
reject(err);
|
|
6700
|
+
} // eslint-disable-next-line max-len
|
|
6701
|
+
// eslint-disable-next-line promise/always-return, promise/prefer-await-to-then
|
|
6702
|
+
).then(function (jwk) {
|
|
6703
|
+
resolve({
|
|
6704
|
+
jwk: jwk,
|
|
6705
|
+
algorithm: key.algorithm,
|
|
6706
|
+
usages: key.usages
|
|
6707
|
+
});
|
|
6708
|
+
});
|
|
6709
|
+
});
|
|
6710
|
+
},
|
|
6711
|
+
revive: function revive(_ref) {
|
|
6712
|
+
var jwk = _ref.jwk,
|
|
6713
|
+
algorithm = _ref.algorithm,
|
|
6714
|
+
usages = _ref.usages;
|
|
6715
|
+
return crypto.subtle.importKey('jwk', jwk, algorithm, true, usages);
|
|
6716
|
+
}
|
|
6717
|
+
}
|
|
6718
|
+
};
|
|
6719
|
+
|
|
6616
6720
|
var dataview = {
|
|
6617
6721
|
dataview: {
|
|
6618
6722
|
test: function test(x) {
|
|
6619
|
-
return
|
|
6723
|
+
return Typeson.toStringTag(x) === 'DataView';
|
|
6620
6724
|
},
|
|
6621
6725
|
replace: function replace(_ref, stateObj) {
|
|
6622
6726
|
var buffer = _ref.buffer,
|
|
@@ -6639,7 +6743,7 @@
|
|
|
6639
6743
|
|
|
6640
6744
|
stateObj.buffers.push(buffer);
|
|
6641
6745
|
return {
|
|
6642
|
-
encoded: encode(buffer),
|
|
6746
|
+
encoded: encode$1(buffer),
|
|
6643
6747
|
byteOffset: byteOffset,
|
|
6644
6748
|
byteLength: byteLength
|
|
6645
6749
|
};
|
|
@@ -6658,7 +6762,7 @@
|
|
|
6658
6762
|
if ('index' in b64Obj) {
|
|
6659
6763
|
buffer = stateObj.buffers[index];
|
|
6660
6764
|
} else {
|
|
6661
|
-
buffer = decode(encoded);
|
|
6765
|
+
buffer = decode$1(encoded);
|
|
6662
6766
|
stateObj.buffers.push(buffer);
|
|
6663
6767
|
}
|
|
6664
6768
|
|
|
@@ -6670,7 +6774,7 @@
|
|
|
6670
6774
|
var date = {
|
|
6671
6775
|
date: {
|
|
6672
6776
|
test: function test(x) {
|
|
6673
|
-
return
|
|
6777
|
+
return Typeson.toStringTag(x) === 'Date';
|
|
6674
6778
|
},
|
|
6675
6779
|
replace: function replace(dt) {
|
|
6676
6780
|
var time = dt.getTime();
|
|
@@ -6694,7 +6798,7 @@
|
|
|
6694
6798
|
var error = {
|
|
6695
6799
|
error: {
|
|
6696
6800
|
test: function test(x) {
|
|
6697
|
-
return
|
|
6801
|
+
return Typeson.toStringTag(x) === 'Error';
|
|
6698
6802
|
},
|
|
6699
6803
|
replace: function replace(_ref) {
|
|
6700
6804
|
var name = _ref.name,
|
|
@@ -6716,18 +6820,18 @@
|
|
|
6716
6820
|
|
|
6717
6821
|
/* istanbul ignore next */
|
|
6718
6822
|
|
|
6719
|
-
var _global = typeof self === 'undefined' ? global$
|
|
6823
|
+
var _global$2 = typeof self === 'undefined' ? global$1 : self;
|
|
6720
6824
|
|
|
6721
6825
|
var errors = {}; // Comprises all built-in errors.
|
|
6722
6826
|
|
|
6723
6827
|
['TypeError', 'RangeError', 'SyntaxError', 'ReferenceError', 'EvalError', 'URIError', 'InternalError' // non-standard
|
|
6724
6828
|
].forEach(function (errName) {
|
|
6725
|
-
var Cnstrctr = _global[errName];
|
|
6829
|
+
var Cnstrctr = _global$2[errName];
|
|
6726
6830
|
|
|
6727
6831
|
if (Cnstrctr) {
|
|
6728
6832
|
errors[errName.toLowerCase()] = {
|
|
6729
6833
|
test: function test(x) {
|
|
6730
|
-
return
|
|
6834
|
+
return Typeson.hasConstructorOf(x, Cnstrctr);
|
|
6731
6835
|
},
|
|
6732
6836
|
replace: function replace(e) {
|
|
6733
6837
|
return e.message;
|
|
@@ -6743,14 +6847,12 @@
|
|
|
6743
6847
|
var file = {
|
|
6744
6848
|
file: {
|
|
6745
6849
|
test: function test(x) {
|
|
6746
|
-
return
|
|
6850
|
+
return Typeson.toStringTag(x) === 'File';
|
|
6747
6851
|
},
|
|
6748
6852
|
replace: function replace(f) {
|
|
6749
6853
|
// Sync
|
|
6750
6854
|
var req = new XMLHttpRequest();
|
|
6751
|
-
req.overrideMimeType('text/plain; charset=x-user-defined');
|
|
6752
|
-
// eslint-disable-next-line node/no-unsupported-features/node-builtins
|
|
6753
|
-
|
|
6855
|
+
req.overrideMimeType('text/plain; charset=x-user-defined');
|
|
6754
6856
|
req.open('GET', URL.createObjectURL(f), false); // Sync
|
|
6755
6857
|
|
|
6756
6858
|
req.send(); // Seems not feasible to accurately simulate
|
|
@@ -6779,7 +6881,7 @@
|
|
|
6779
6881
|
});
|
|
6780
6882
|
},
|
|
6781
6883
|
replaceAsync: function replaceAsync(f) {
|
|
6782
|
-
return new
|
|
6884
|
+
return new Typeson.Promise(function (resolve, reject) {
|
|
6783
6885
|
/*
|
|
6784
6886
|
if (f.isClosed) { // On MDN, but not in https://w3c.github.io/FileAPI/#dfn-Blob
|
|
6785
6887
|
reject(new Error('The File is closed'));
|
|
@@ -6811,7 +6913,7 @@
|
|
|
6811
6913
|
file: file.file,
|
|
6812
6914
|
filelist: {
|
|
6813
6915
|
test: function test(x) {
|
|
6814
|
-
return
|
|
6916
|
+
return Typeson.toStringTag(x) === 'FileList';
|
|
6815
6917
|
},
|
|
6816
6918
|
replace: function replace(fl) {
|
|
6817
6919
|
var arr = [];
|
|
@@ -6826,7 +6928,7 @@
|
|
|
6826
6928
|
/**
|
|
6827
6929
|
* `FileList` polyfill.
|
|
6828
6930
|
*/
|
|
6829
|
-
var FileList = /*#__PURE__*/function () {
|
|
6931
|
+
var FileList = /*#__PURE__*/function (_Symbol$toStringTag) {
|
|
6830
6932
|
/**
|
|
6831
6933
|
* Set private properties and length.
|
|
6832
6934
|
*/
|
|
@@ -6855,7 +6957,7 @@
|
|
|
6855
6957
|
*/
|
|
6856
6958
|
|
|
6857
6959
|
}, {
|
|
6858
|
-
key:
|
|
6960
|
+
key: _Symbol$toStringTag,
|
|
6859
6961
|
get: function get() {
|
|
6860
6962
|
/* eslint-enable class-methods-use-this */
|
|
6861
6963
|
return 'FileList';
|
|
@@ -6863,7 +6965,7 @@
|
|
|
6863
6965
|
}]);
|
|
6864
6966
|
|
|
6865
6967
|
return FileList;
|
|
6866
|
-
}();
|
|
6968
|
+
}(Symbol.toStringTag);
|
|
6867
6969
|
|
|
6868
6970
|
return new FileList(o);
|
|
6869
6971
|
}
|
|
@@ -6874,7 +6976,7 @@
|
|
|
6874
6976
|
var imagebitmap = {
|
|
6875
6977
|
imagebitmap: {
|
|
6876
6978
|
test: function test(x) {
|
|
6877
|
-
return
|
|
6979
|
+
return Typeson.toStringTag(x) === 'ImageBitmap' || // In Node, our polyfill sets the dataset on a canvas
|
|
6878
6980
|
// element as JSDom no longer allows overriding toStringTag
|
|
6879
6981
|
x && x.dataset && x.dataset.toStringTag === 'ImageBitmap';
|
|
6880
6982
|
},
|
|
@@ -6930,7 +7032,7 @@
|
|
|
6930
7032
|
var imagedata = {
|
|
6931
7033
|
imagedata: {
|
|
6932
7034
|
test: function test(x) {
|
|
6933
|
-
return
|
|
7035
|
+
return Typeson.toStringTag(x) === 'ImageData';
|
|
6934
7036
|
},
|
|
6935
7037
|
replace: function replace(d) {
|
|
6936
7038
|
return {
|
|
@@ -6949,20 +7051,20 @@
|
|
|
6949
7051
|
var infinity = {
|
|
6950
7052
|
infinity: {
|
|
6951
7053
|
test: function test(x) {
|
|
6952
|
-
return x ===
|
|
7054
|
+
return x === Number.POSITIVE_INFINITY;
|
|
6953
7055
|
},
|
|
6954
7056
|
replace: function replace(n) {
|
|
6955
7057
|
return 'Infinity';
|
|
6956
7058
|
},
|
|
6957
7059
|
revive: function revive(s) {
|
|
6958
|
-
return
|
|
7060
|
+
return Number.POSITIVE_INFINITY;
|
|
6959
7061
|
}
|
|
6960
7062
|
}
|
|
6961
7063
|
};
|
|
6962
7064
|
|
|
6963
7065
|
var IntlCollator = {
|
|
6964
7066
|
test: function test(x) {
|
|
6965
|
-
return
|
|
7067
|
+
return Typeson.hasConstructorOf(x, Intl.Collator);
|
|
6966
7068
|
},
|
|
6967
7069
|
replace: function replace(c) {
|
|
6968
7070
|
return c.resolvedOptions();
|
|
@@ -6973,7 +7075,7 @@
|
|
|
6973
7075
|
};
|
|
6974
7076
|
var IntlDateTimeFormat = {
|
|
6975
7077
|
test: function test(x) {
|
|
6976
|
-
return
|
|
7078
|
+
return Typeson.hasConstructorOf(x, Intl.DateTimeFormat);
|
|
6977
7079
|
},
|
|
6978
7080
|
replace: function replace(dtf) {
|
|
6979
7081
|
return dtf.resolvedOptions();
|
|
@@ -6984,7 +7086,7 @@
|
|
|
6984
7086
|
};
|
|
6985
7087
|
var IntlNumberFormat = {
|
|
6986
7088
|
test: function test(x) {
|
|
6987
|
-
return
|
|
7089
|
+
return Typeson.hasConstructorOf(x, Intl.NumberFormat);
|
|
6988
7090
|
},
|
|
6989
7091
|
replace: function replace(nf) {
|
|
6990
7092
|
return nf.resolvedOptions();
|
|
@@ -6999,10 +7101,10 @@
|
|
|
6999
7101
|
IntlNumberFormat: IntlNumberFormat
|
|
7000
7102
|
};
|
|
7001
7103
|
|
|
7002
|
-
var map
|
|
7104
|
+
var map = {
|
|
7003
7105
|
map: {
|
|
7004
7106
|
test: function test(x) {
|
|
7005
|
-
return
|
|
7107
|
+
return Typeson.toStringTag(x) === 'Map';
|
|
7006
7108
|
},
|
|
7007
7109
|
replace: function replace(mp) {
|
|
7008
7110
|
return _toConsumableArray(mp.entries());
|
|
@@ -7030,13 +7132,13 @@
|
|
|
7030
7132
|
var negativeInfinity = {
|
|
7031
7133
|
negativeInfinity: {
|
|
7032
7134
|
test: function test(x) {
|
|
7033
|
-
return x ===
|
|
7135
|
+
return x === Number.NEGATIVE_INFINITY;
|
|
7034
7136
|
},
|
|
7035
7137
|
replace: function replace(n) {
|
|
7036
7138
|
return '-Infinity';
|
|
7037
7139
|
},
|
|
7038
7140
|
revive: function revive(s) {
|
|
7039
|
-
return
|
|
7141
|
+
return Number.NEGATIVE_INFINITY;
|
|
7040
7142
|
}
|
|
7041
7143
|
}
|
|
7042
7144
|
};
|
|
@@ -7044,10 +7146,10 @@
|
|
|
7044
7146
|
var nonbuiltinIgnore = {
|
|
7045
7147
|
nonbuiltinIgnore: {
|
|
7046
7148
|
test: function test(x) {
|
|
7047
|
-
return x && _typeof(x) === 'object' && !Array.isArray(x) && !['Object', // `Proxy` and `Reflect`, two other built-in objects, will also
|
|
7149
|
+
return x && _typeof$1(x) === 'object' && !Array.isArray(x) && !['Object', // `Proxy` and `Reflect`, two other built-in objects, will also
|
|
7048
7150
|
// have a `toStringTag` of `Object`; we don't want built-in
|
|
7049
7151
|
// function objects, however
|
|
7050
|
-
'Boolean', 'Number', 'String', 'Error', 'RegExp', 'Math', 'Date', 'Map', 'Set', 'JSON', 'ArrayBuffer', 'SharedArrayBuffer', 'DataView', 'Int8Array', 'Uint8Array', 'Uint8ClampedArray', 'Int16Array', 'Uint16Array', 'Int32Array', 'Uint32Array', 'Float32Array', 'Float64Array', 'Promise', 'String Iterator', 'Array Iterator', 'Map Iterator', 'Set Iterator', 'WeakMap', 'WeakSet', 'Atomics', 'Module'].includes(
|
|
7152
|
+
'Boolean', 'Number', 'String', 'Error', 'RegExp', 'Math', 'Date', 'Map', 'Set', 'JSON', 'ArrayBuffer', 'SharedArrayBuffer', 'DataView', 'Int8Array', 'Uint8Array', 'Uint8ClampedArray', 'Int16Array', 'Uint16Array', 'Int32Array', 'Uint32Array', 'Float32Array', 'Float64Array', 'Promise', 'String Iterator', 'Array Iterator', 'Map Iterator', 'Set Iterator', 'WeakMap', 'WeakSet', 'Atomics', 'Module'].includes(Typeson.toStringTag(x));
|
|
7051
7153
|
},
|
|
7052
7154
|
replace: function replace(rexp) {// Not in use
|
|
7053
7155
|
}
|
|
@@ -7058,7 +7160,7 @@
|
|
|
7058
7160
|
// String Object (not primitive string which need no type spec)
|
|
7059
7161
|
StringObject: {
|
|
7060
7162
|
test: function test(x) {
|
|
7061
|
-
return
|
|
7163
|
+
return Typeson.toStringTag(x) === 'String' && _typeof$1(x) === 'object';
|
|
7062
7164
|
},
|
|
7063
7165
|
replace: function replace(s) {
|
|
7064
7166
|
return String(s);
|
|
@@ -7072,7 +7174,7 @@
|
|
|
7072
7174
|
// Boolean Object (not primitive boolean which need no type spec)
|
|
7073
7175
|
BooleanObject: {
|
|
7074
7176
|
test: function test(x) {
|
|
7075
|
-
return
|
|
7177
|
+
return Typeson.toStringTag(x) === 'Boolean' && _typeof$1(x) === 'object';
|
|
7076
7178
|
},
|
|
7077
7179
|
replace: function replace(b) {
|
|
7078
7180
|
return Boolean(b);
|
|
@@ -7086,7 +7188,7 @@
|
|
|
7086
7188
|
// Number Object (not primitive number which need no type spec)
|
|
7087
7189
|
NumberObject: {
|
|
7088
7190
|
test: function test(x) {
|
|
7089
|
-
return
|
|
7191
|
+
return Typeson.toStringTag(x) === 'Number' && _typeof$1(x) === 'object';
|
|
7090
7192
|
},
|
|
7091
7193
|
replace: function replace(n) {
|
|
7092
7194
|
return Number(n);
|
|
@@ -7102,7 +7204,7 @@
|
|
|
7102
7204
|
var regexp = {
|
|
7103
7205
|
regexp: {
|
|
7104
7206
|
test: function test(x) {
|
|
7105
|
-
return
|
|
7207
|
+
return Typeson.toStringTag(x) === 'RegExp';
|
|
7106
7208
|
},
|
|
7107
7209
|
replace: function replace(rexp) {
|
|
7108
7210
|
return {
|
|
@@ -7122,7 +7224,7 @@
|
|
|
7122
7224
|
var resurrectable = {
|
|
7123
7225
|
resurrectable: {
|
|
7124
7226
|
test: function test(x) {
|
|
7125
|
-
return x && !Array.isArray(x) && ['object', 'function', 'symbol'].includes(_typeof(x));
|
|
7227
|
+
return x && !Array.isArray(x) && ['object', 'function', 'symbol'].includes(_typeof$1(x));
|
|
7126
7228
|
},
|
|
7127
7229
|
replace: function replace(rsrrctble) {
|
|
7128
7230
|
var uuid = generateUUID();
|
|
@@ -7138,7 +7240,7 @@
|
|
|
7138
7240
|
var set = {
|
|
7139
7241
|
set: {
|
|
7140
7242
|
test: function test(x) {
|
|
7141
|
-
return
|
|
7243
|
+
return Typeson.toStringTag(x) === 'Set';
|
|
7142
7244
|
},
|
|
7143
7245
|
replace: function replace(st) {
|
|
7144
7246
|
return _toConsumableArray(st.values());
|
|
@@ -7151,7 +7253,7 @@
|
|
|
7151
7253
|
|
|
7152
7254
|
/* istanbul ignore next */
|
|
7153
7255
|
|
|
7154
|
-
var _global$1 = typeof self === 'undefined' ? global$
|
|
7256
|
+
var _global$1 = typeof self === 'undefined' ? global$1 : self; // Support all kinds of typed arrays (views of ArrayBuffers)
|
|
7155
7257
|
|
|
7156
7258
|
|
|
7157
7259
|
var typedArraysSocketIO = {};
|
|
@@ -7166,7 +7268,7 @@
|
|
|
7166
7268
|
|
|
7167
7269
|
typedArraysSocketIO[typeName.toLowerCase()] = {
|
|
7168
7270
|
test: function test(x) {
|
|
7169
|
-
return
|
|
7271
|
+
return Typeson.toStringTag(x) === arrType;
|
|
7170
7272
|
},
|
|
7171
7273
|
replace: function replace(a) {
|
|
7172
7274
|
return (a.byteOffset === 0 && a.byteLength === a.buffer.byteLength ? a // socket.io supports streaming ArrayBuffers.
|
|
@@ -7182,19 +7284,19 @@
|
|
|
7182
7284
|
// get here is an ArrayBuffer
|
|
7183
7285
|
// If not, let's assume user wants to receive it as
|
|
7184
7286
|
// configured with socket.io.
|
|
7185
|
-
return
|
|
7287
|
+
return Typeson.toStringTag(buf) === 'ArrayBuffer' ? new TypedArray(buf) : buf;
|
|
7186
7288
|
}
|
|
7187
7289
|
};
|
|
7188
7290
|
});
|
|
7189
7291
|
|
|
7190
7292
|
/* istanbul ignore next */
|
|
7191
7293
|
|
|
7192
|
-
var _global
|
|
7294
|
+
var _global = typeof self === 'undefined' ? global$1 : self;
|
|
7193
7295
|
|
|
7194
7296
|
var typedArrays = {};
|
|
7195
7297
|
['Int8Array', 'Uint8Array', 'Uint8ClampedArray', 'Int16Array', 'Uint16Array', 'Int32Array', 'Uint32Array', 'Float32Array', 'Float64Array'].forEach(function (typeName) {
|
|
7196
7298
|
var arrType = typeName;
|
|
7197
|
-
var TypedArray = _global
|
|
7299
|
+
var TypedArray = _global[arrType];
|
|
7198
7300
|
/* istanbul ignore if */
|
|
7199
7301
|
|
|
7200
7302
|
if (!TypedArray) {
|
|
@@ -7203,7 +7305,7 @@
|
|
|
7203
7305
|
|
|
7204
7306
|
typedArrays[typeName.toLowerCase()] = {
|
|
7205
7307
|
test: function test(x) {
|
|
7206
|
-
return
|
|
7308
|
+
return Typeson.toStringTag(x) === arrType;
|
|
7207
7309
|
},
|
|
7208
7310
|
replace: function replace(_ref, stateObj) {
|
|
7209
7311
|
var buffer = _ref.buffer,
|
|
@@ -7226,7 +7328,7 @@
|
|
|
7226
7328
|
|
|
7227
7329
|
stateObj.buffers.push(buffer);
|
|
7228
7330
|
return {
|
|
7229
|
-
encoded: encode(buffer),
|
|
7331
|
+
encoded: encode$1(buffer),
|
|
7230
7332
|
byteOffset: byteOffset,
|
|
7231
7333
|
length: l
|
|
7232
7334
|
};
|
|
@@ -7245,7 +7347,7 @@
|
|
|
7245
7347
|
if ('index' in b64Obj) {
|
|
7246
7348
|
buffer = stateObj.buffers[index];
|
|
7247
7349
|
} else {
|
|
7248
|
-
buffer = decode(encoded);
|
|
7350
|
+
buffer = decode$1(encoded);
|
|
7249
7351
|
stateObj.buffers.push(buffer);
|
|
7250
7352
|
}
|
|
7251
7353
|
|
|
@@ -7255,7 +7357,7 @@
|
|
|
7255
7357
|
});
|
|
7256
7358
|
|
|
7257
7359
|
// This does not preserve `undefined` in sparse arrays; see the `undefined`
|
|
7258
|
-
var undef = {
|
|
7360
|
+
var undef$1 = {
|
|
7259
7361
|
undef: {
|
|
7260
7362
|
test: function test(x, stateObj) {
|
|
7261
7363
|
return typeof x === 'undefined' && (stateObj.ownKeys || !('ownKeys' in stateObj));
|
|
@@ -7266,7 +7368,7 @@
|
|
|
7266
7368
|
revive: function revive(s) {
|
|
7267
7369
|
// Will add `undefined` (returning `undefined` would instead
|
|
7268
7370
|
// avoid explicitly setting)
|
|
7269
|
-
return new
|
|
7371
|
+
return new Typeson.Undefined();
|
|
7270
7372
|
}
|
|
7271
7373
|
}
|
|
7272
7374
|
};
|
|
@@ -7274,7 +7376,7 @@
|
|
|
7274
7376
|
var userObject = {
|
|
7275
7377
|
userObject: {
|
|
7276
7378
|
test: function test(x, stateObj) {
|
|
7277
|
-
return
|
|
7379
|
+
return Typeson.isUserObject(x);
|
|
7278
7380
|
},
|
|
7279
7381
|
replace: function replace(n) {
|
|
7280
7382
|
return _objectSpread2({}, n);
|
|
@@ -7367,11 +7469,11 @@
|
|
|
7367
7469
|
|
|
7368
7470
|
Symbols are similarly not included.
|
|
7369
7471
|
*/
|
|
7370
|
-
var expObj = [undef, // ES5
|
|
7472
|
+
var expObj$1 = [undef$1, // ES5
|
|
7371
7473
|
arrayNonindexKeys, primitiveObjects, specialNumbers, date, error, errors, regexp].concat( // ES2015 (ES6)
|
|
7372
7474
|
|
|
7373
7475
|
/* istanbul ignore next */
|
|
7374
|
-
typeof Map === 'function' ? map
|
|
7476
|
+
typeof Map === 'function' ? map : [],
|
|
7375
7477
|
/* istanbul ignore next */
|
|
7376
7478
|
typeof Set === 'function' ? set : [],
|
|
7377
7479
|
/* istanbul ignore next */
|
|
@@ -7402,7 +7504,7 @@
|
|
|
7402
7504
|
*/
|
|
7403
7505
|
var postmessage = [error, errors];
|
|
7404
7506
|
|
|
7405
|
-
var socketio = [expObj, // Leave ArrayBuffer as is, and let socket.io stream it instead.
|
|
7507
|
+
var socketio = [expObj$1, // Leave ArrayBuffer as is, and let socket.io stream it instead.
|
|
7406
7508
|
{
|
|
7407
7509
|
arraybuffer: null
|
|
7408
7510
|
}, // Encapsulate TypedArrays in ArrayBuffers instead of base64 strings.
|
|
@@ -7435,16 +7537,16 @@
|
|
|
7435
7537
|
}];
|
|
7436
7538
|
|
|
7437
7539
|
/* This preset includes types for the Structured Cloning Algorithm. */
|
|
7438
|
-
var expObj
|
|
7540
|
+
var expObj = [// Todo: Might also register synchronous `ImageBitmap` and
|
|
7439
7541
|
// `Blob`/`File`/`FileList`?
|
|
7440
7542
|
// ES5
|
|
7441
7543
|
userObject, // Processed last (non-builtin)
|
|
7442
|
-
undef, arrayNonindexKeys, primitiveObjects, specialNumbers, date, regexp, // Non-built-ins
|
|
7544
|
+
undef$1, arrayNonindexKeys, primitiveObjects, specialNumbers, date, regexp, // Non-built-ins
|
|
7443
7545
|
imagedata, imagebitmap, // Async return
|
|
7444
7546
|
file, filelist, blob].concat( // ES2015 (ES6)
|
|
7445
7547
|
|
|
7446
7548
|
/* istanbul ignore next */
|
|
7447
|
-
typeof Map === 'function' ? map
|
|
7549
|
+
typeof Map === 'function' ? map : [],
|
|
7448
7550
|
/* istanbul ignore next */
|
|
7449
7551
|
typeof Set === 'function' ? set : [],
|
|
7450
7552
|
/* istanbul ignore next */
|
|
@@ -7456,9 +7558,11 @@
|
|
|
7456
7558
|
/* istanbul ignore next */
|
|
7457
7559
|
typeof Intl !== 'undefined' ? intlTypes : [],
|
|
7458
7560
|
/* istanbul ignore next */
|
|
7561
|
+
typeof crypto !== 'undefined' ? cryptokey : [],
|
|
7562
|
+
/* istanbul ignore next */
|
|
7459
7563
|
typeof BigInt !== 'undefined' ? [bigint, bigintObject] : []);
|
|
7460
7564
|
|
|
7461
|
-
var structuredCloningThrowing = expObj
|
|
7565
|
+
var structuredCloningThrowing = expObj.concat({
|
|
7462
7566
|
checkDataCloneException: {
|
|
7463
7567
|
test: function test(val) {
|
|
7464
7568
|
// Should also throw with:
|
|
@@ -7486,7 +7590,7 @@
|
|
|
7486
7590
|
if ([// Symbol's `toStringTag` is only "Symbol" for its initial
|
|
7487
7591
|
// value, so we check `typeof`
|
|
7488
7592
|
'symbol', // All functions including bound function exotic objects
|
|
7489
|
-
'function'].includes(_typeof(val)) || [// A non-array exotic object
|
|
7593
|
+
'function'].includes(_typeof$1(val)) || [// A non-array exotic object
|
|
7490
7594
|
'Arguments', // A non-array exotic object
|
|
7491
7595
|
'Module', // `Error` and other errors have the [[ErrorData]] internal
|
|
7492
7596
|
// slot and give "Error"
|
|
@@ -7504,7 +7608,7 @@
|
|
|
7504
7608
|
((stringTag === 'Blob' || stringTag === 'File') &&
|
|
7505
7609
|
val.isClosed) ||
|
|
7506
7610
|
*/
|
|
7507
|
-
val && _typeof(val) === 'object' && // Duck-type DOM node objects (non-array exotic?
|
|
7611
|
+
val && _typeof$1(val) === 'object' && // Duck-type DOM node objects (non-array exotic?
|
|
7508
7612
|
// objects which cannot be cloned by the SCA)
|
|
7509
7613
|
typeof val.nodeType === 'number' && typeof val.insertBefore === 'function') {
|
|
7510
7614
|
throw new DOMException('The object cannot be cloned.', 'DataCloneError');
|
|
@@ -7515,19 +7619,20 @@
|
|
|
7515
7619
|
}
|
|
7516
7620
|
});
|
|
7517
7621
|
|
|
7518
|
-
var undef
|
|
7622
|
+
var undef = [sparseUndefined, undef$1];
|
|
7519
7623
|
|
|
7520
|
-
var universal = [expObj // TODO: Add types that are de-facto universal even though not
|
|
7624
|
+
var universal = [expObj$1 // TODO: Add types that are de-facto universal even though not
|
|
7521
7625
|
// built-in into ecmasript standard.
|
|
7522
7626
|
];
|
|
7523
7627
|
|
|
7524
7628
|
// This file is auto-generated from `build.js`
|
|
7525
|
-
|
|
7629
|
+
Typeson.types = {
|
|
7526
7630
|
arraybuffer: arraybuffer,
|
|
7527
7631
|
bigintObject: bigintObject,
|
|
7528
7632
|
bigint: bigint,
|
|
7529
7633
|
blob: blob,
|
|
7530
7634
|
cloneable: cloneable,
|
|
7635
|
+
cryptokey: cryptokey,
|
|
7531
7636
|
dataview: dataview,
|
|
7532
7637
|
date: date,
|
|
7533
7638
|
error: error,
|
|
@@ -7538,7 +7643,7 @@
|
|
|
7538
7643
|
imagedata: imagedata,
|
|
7539
7644
|
infinity: infinity,
|
|
7540
7645
|
intlTypes: intlTypes,
|
|
7541
|
-
map: map
|
|
7646
|
+
map: map,
|
|
7542
7647
|
nan: nan,
|
|
7543
7648
|
negativeInfinity: negativeInfinity,
|
|
7544
7649
|
nonbuiltinIgnore: nonbuiltinIgnore,
|
|
@@ -7548,44 +7653,44 @@
|
|
|
7548
7653
|
set: set,
|
|
7549
7654
|
typedArraysSocketio: typedArraysSocketIO,
|
|
7550
7655
|
typedArrays: typedArrays,
|
|
7551
|
-
undef: undef,
|
|
7656
|
+
undef: undef$1,
|
|
7552
7657
|
userObject: userObject
|
|
7553
7658
|
};
|
|
7554
|
-
|
|
7659
|
+
Typeson.presets = {
|
|
7555
7660
|
arrayNonindexKeys: arrayNonindexKeys,
|
|
7556
|
-
builtin: expObj,
|
|
7661
|
+
builtin: expObj$1,
|
|
7557
7662
|
postmessage: postmessage,
|
|
7558
7663
|
socketio: socketio,
|
|
7559
7664
|
sparseUndefined: sparseUndefined,
|
|
7560
7665
|
specialNumbers: specialNumbers,
|
|
7561
7666
|
structuredCloningThrowing: structuredCloningThrowing,
|
|
7562
|
-
structuredCloning: expObj
|
|
7563
|
-
undef: undef
|
|
7667
|
+
structuredCloning: expObj,
|
|
7668
|
+
undef: undef,
|
|
7564
7669
|
universal: universal
|
|
7565
7670
|
};
|
|
7566
7671
|
|
|
7567
|
-
var typeson
|
|
7672
|
+
var typeson = new Typeson().register(Typeson.presets.structuredCloningThrowing);
|
|
7568
7673
|
|
|
7569
7674
|
function register(func) {
|
|
7570
|
-
typeson
|
|
7675
|
+
typeson = new Typeson().register(func(Typeson.presets.structuredCloningThrowing));
|
|
7571
7676
|
} // We are keeping the callback approach for now in case we wish to reexpose
|
|
7572
7677
|
// `Blob`, `File`, `FileList` asynchronously (though in such a case, we
|
|
7573
7678
|
// should probably refactor as a Promise)
|
|
7574
7679
|
|
|
7575
7680
|
|
|
7576
|
-
function encode
|
|
7681
|
+
function encode(obj, func) {
|
|
7577
7682
|
var ret;
|
|
7578
7683
|
|
|
7579
7684
|
try {
|
|
7580
7685
|
// eslint-disable-next-line node/no-sync
|
|
7581
|
-
ret = typeson
|
|
7686
|
+
ret = typeson.stringifySync(obj);
|
|
7582
7687
|
} catch (err) {
|
|
7583
7688
|
// SCA in typeson-registry using `DOMException` which is not defined (e.g., in Node)
|
|
7584
|
-
if (
|
|
7689
|
+
if (Typeson.hasConstructorOf(err, ReferenceError) || // SCA in typeson-registry threw a cloning error and we are in a
|
|
7585
7690
|
// supporting environment (e.g., the browser) where `ShimDOMException` is
|
|
7586
7691
|
// an alias for `DOMException`; if typeson-registry ever uses our shim
|
|
7587
7692
|
// to throw, we can use this condition alone.
|
|
7588
|
-
|
|
7693
|
+
Typeson.hasConstructorOf(err, ShimDOMException)) {
|
|
7589
7694
|
throw createDOMException('DataCloneError', 'The object cannot be cloned.');
|
|
7590
7695
|
} // We should rethrow non-cloning exceptions like from
|
|
7591
7696
|
// throwing getters (as in the W3C test, key-conversion-exceptions.htm)
|
|
@@ -7598,25 +7703,25 @@
|
|
|
7598
7703
|
return ret;
|
|
7599
7704
|
}
|
|
7600
7705
|
|
|
7601
|
-
function decode
|
|
7602
|
-
return typeson
|
|
7706
|
+
function decode(obj) {
|
|
7707
|
+
return typeson.parse(obj);
|
|
7603
7708
|
}
|
|
7604
7709
|
|
|
7605
7710
|
function clone(val) {
|
|
7606
7711
|
// We don't return the intermediate `encode` as we'll need to reencode
|
|
7607
7712
|
// the clone as it may differ
|
|
7608
|
-
return decode
|
|
7713
|
+
return decode(encode(val));
|
|
7609
7714
|
}
|
|
7610
7715
|
|
|
7611
7716
|
var Sca = /*#__PURE__*/Object.freeze({
|
|
7612
7717
|
__proto__: null,
|
|
7613
|
-
encode: encode
|
|
7614
|
-
decode: decode
|
|
7718
|
+
encode: encode,
|
|
7719
|
+
decode: decode,
|
|
7615
7720
|
clone: clone,
|
|
7616
7721
|
register: register
|
|
7617
7722
|
});
|
|
7618
7723
|
|
|
7619
|
-
var readonlyProperties$
|
|
7724
|
+
var readonlyProperties$2 = ['objectStore', 'keyPath', 'multiEntry', 'unique'];
|
|
7620
7725
|
/* eslint-disable jsdoc/check-param-names */
|
|
7621
7726
|
|
|
7622
7727
|
/**
|
|
@@ -7638,7 +7743,7 @@
|
|
|
7638
7743
|
function IDBIndex() {
|
|
7639
7744
|
var me = this;
|
|
7640
7745
|
me[Symbol.toStringTag] = 'IDBIndex';
|
|
7641
|
-
defineReadonlyProperties(me, readonlyProperties$
|
|
7746
|
+
defineReadonlyProperties(me, readonlyProperties$2);
|
|
7642
7747
|
me.__objectStore = store;
|
|
7643
7748
|
me.__name = me.__originalName = indexProperties.columnName;
|
|
7644
7749
|
me.__keyPath = Array.isArray(indexProperties.keyPath) ? indexProperties.keyPath.slice() : indexProperties.keyPath;
|
|
@@ -7787,7 +7892,7 @@
|
|
|
7787
7892
|
function addIndexEntry(i) {
|
|
7788
7893
|
if (i < data.rows.length) {
|
|
7789
7894
|
try {
|
|
7790
|
-
var value = decode
|
|
7895
|
+
var value = decode(unescapeSQLiteResponse(data.rows.item(i).value));
|
|
7791
7896
|
var indexKey = extractKeyValueDecodedFromValueUsingKeyPath(value, index.keyPath, index.multiEntry); // Todo: Do we need this stricter error checking?
|
|
7792
7897
|
|
|
7793
7898
|
if (indexKey.invalid || indexKey.failure) {
|
|
@@ -7996,9 +8101,9 @@
|
|
|
7996
8101
|
*/
|
|
7997
8102
|
|
|
7998
8103
|
|
|
7999
|
-
IDBIndex.prototype.openCursor = function
|
|
8000
|
-
|
|
8001
|
-
{
|
|
8104
|
+
IDBIndex.prototype.openCursor = function
|
|
8105
|
+
/* query, direction */
|
|
8106
|
+
() {
|
|
8002
8107
|
/* eslint-enable jsdoc/check-param-names */
|
|
8003
8108
|
var me = this; // eslint-disable-next-line prefer-rest-params
|
|
8004
8109
|
|
|
@@ -8022,9 +8127,9 @@
|
|
|
8022
8127
|
*/
|
|
8023
8128
|
|
|
8024
8129
|
|
|
8025
|
-
IDBIndex.prototype.openKeyCursor = function
|
|
8026
|
-
|
|
8027
|
-
{
|
|
8130
|
+
IDBIndex.prototype.openKeyCursor = function
|
|
8131
|
+
/* query, direction */
|
|
8132
|
+
() {
|
|
8028
8133
|
/* eslint-enable jsdoc/check-param-names */
|
|
8029
8134
|
var me = this; // eslint-disable-next-line prefer-rest-params
|
|
8030
8135
|
|
|
@@ -8057,9 +8162,9 @@
|
|
|
8057
8162
|
return this.__fetchIndexData(query, 'key', true);
|
|
8058
8163
|
};
|
|
8059
8164
|
|
|
8060
|
-
IDBIndex.prototype.getAll = function
|
|
8061
|
-
|
|
8062
|
-
{
|
|
8165
|
+
IDBIndex.prototype.getAll = function
|
|
8166
|
+
/* query, count */
|
|
8167
|
+
() {
|
|
8063
8168
|
// eslint-disable-next-line prefer-rest-params
|
|
8064
8169
|
var _arguments3 = Array.prototype.slice.call(arguments),
|
|
8065
8170
|
query = _arguments3[0],
|
|
@@ -8068,9 +8173,9 @@
|
|
|
8068
8173
|
return this.__fetchIndexData(query, 'value', false, count);
|
|
8069
8174
|
};
|
|
8070
8175
|
|
|
8071
|
-
IDBIndex.prototype.getAllKeys = function
|
|
8072
|
-
|
|
8073
|
-
{
|
|
8176
|
+
IDBIndex.prototype.getAllKeys = function
|
|
8177
|
+
/* query, count */
|
|
8178
|
+
() {
|
|
8074
8179
|
// eslint-disable-next-line prefer-rest-params
|
|
8075
8180
|
var _arguments4 = Array.prototype.slice.call(arguments),
|
|
8076
8181
|
query = _arguments4[0],
|
|
@@ -8079,9 +8184,9 @@
|
|
|
8079
8184
|
return this.__fetchIndexData(query, 'key', false, count);
|
|
8080
8185
|
};
|
|
8081
8186
|
|
|
8082
|
-
IDBIndex.prototype.count = function
|
|
8083
|
-
|
|
8084
|
-
{
|
|
8187
|
+
IDBIndex.prototype.count = function
|
|
8188
|
+
/* query */
|
|
8189
|
+
() {
|
|
8085
8190
|
var me = this; // eslint-disable-next-line prefer-rest-params
|
|
8086
8191
|
|
|
8087
8192
|
var query = arguments[0]; // With the exception of needing to check whether the index has been
|
|
@@ -8197,7 +8302,7 @@
|
|
|
8197
8302
|
return isObj(obj) && typeof obj.openCursor === 'function' && typeof obj.multiEntry === 'boolean';
|
|
8198
8303
|
}
|
|
8199
8304
|
});
|
|
8200
|
-
defineReadonlyOuterInterface(IDBIndex.prototype, readonlyProperties$
|
|
8305
|
+
defineReadonlyOuterInterface(IDBIndex.prototype, readonlyProperties$2);
|
|
8201
8306
|
defineOuterInterface(IDBIndex.prototype, ['name']);
|
|
8202
8307
|
IDBIndex.prototype[Symbol.toStringTag] = 'IDBIndexPrototype';
|
|
8203
8308
|
Object.defineProperty(IDBIndex, 'prototype', {
|
|
@@ -8218,14 +8323,14 @@
|
|
|
8218
8323
|
tx.executeSql(sql.join(' '), sqlValues, function (tx, data) {
|
|
8219
8324
|
var records = [];
|
|
8220
8325
|
var recordCount = 0;
|
|
8221
|
-
var decode = isCount ? function () {
|
|
8326
|
+
var decode$1 = isCount ? function () {
|
|
8222
8327
|
/* */
|
|
8223
8328
|
} : opType === 'key' ? function (record) {
|
|
8224
8329
|
// Key.convertValueToKey(record.key); // Already validated before storage
|
|
8225
8330
|
return _decode(unescapeSQLiteResponse(record.key));
|
|
8226
8331
|
} : function (record) {
|
|
8227
8332
|
// when opType is value
|
|
8228
|
-
return decode
|
|
8333
|
+
return decode(unescapeSQLiteResponse(record.value));
|
|
8229
8334
|
};
|
|
8230
8335
|
|
|
8231
8336
|
if (index.multiEntry) {
|
|
@@ -8251,7 +8356,7 @@
|
|
|
8251
8356
|
}
|
|
8252
8357
|
|
|
8253
8358
|
if (record) {
|
|
8254
|
-
records.push(decode(record));
|
|
8359
|
+
records.push(decode$1(record));
|
|
8255
8360
|
|
|
8256
8361
|
if (unboundedDisallowed) {
|
|
8257
8362
|
return "break";
|
|
@@ -8269,7 +8374,7 @@
|
|
|
8269
8374
|
var record = data.rows.item(_i);
|
|
8270
8375
|
|
|
8271
8376
|
if (record) {
|
|
8272
|
-
records.push(decode(record));
|
|
8377
|
+
records.push(decode$1(record));
|
|
8273
8378
|
}
|
|
8274
8379
|
}
|
|
8275
8380
|
|
|
@@ -8314,7 +8419,7 @@
|
|
|
8314
8419
|
return [nullDisallowed, index, hasRange, range, opType, multiChecks, sql, sqlValues];
|
|
8315
8420
|
}
|
|
8316
8421
|
|
|
8317
|
-
var readonlyProperties$
|
|
8422
|
+
var readonlyProperties$1 = ['keyPath', 'indexNames', 'transaction', 'autoIncrement'];
|
|
8318
8423
|
/* eslint-disable jsdoc/check-param-names */
|
|
8319
8424
|
|
|
8320
8425
|
/**
|
|
@@ -8336,7 +8441,7 @@
|
|
|
8336
8441
|
function IDBObjectStore() {
|
|
8337
8442
|
var me = this;
|
|
8338
8443
|
me[Symbol.toStringTag] = 'IDBObjectStore';
|
|
8339
|
-
defineReadonlyProperties(this, readonlyProperties$
|
|
8444
|
+
defineReadonlyProperties(this, readonlyProperties$1);
|
|
8340
8445
|
me.__name = me.__originalName = storeProperties.name;
|
|
8341
8446
|
me.__keyPath = Array.isArray(storeProperties.keyPath) ? storeProperties.keyPath.slice() : storeProperties.keyPath;
|
|
8342
8447
|
me.__transaction = transaction;
|
|
@@ -8670,8 +8775,8 @@
|
|
|
8670
8775
|
|
|
8671
8776
|
function keyCloneThenSuccess(oldCn) {
|
|
8672
8777
|
// We want to return the original key, so we don't need to accept an argument here
|
|
8673
|
-
encode
|
|
8674
|
-
key = decode
|
|
8778
|
+
encode(key, function (key) {
|
|
8779
|
+
key = decode(key);
|
|
8675
8780
|
success(key, oldCn);
|
|
8676
8781
|
});
|
|
8677
8782
|
}
|
|
@@ -8810,7 +8915,8 @@
|
|
|
8810
8915
|
return undefined;
|
|
8811
8916
|
})["catch"](function (err) {
|
|
8812
8917
|
function fail() {
|
|
8813
|
-
// Todo: Add a different error object here if `assignCurrentNumber`
|
|
8918
|
+
// Todo: Add a different error object here if `assignCurrentNumber`
|
|
8919
|
+
// fails in reverting?
|
|
8814
8920
|
error(err);
|
|
8815
8921
|
}
|
|
8816
8922
|
|
|
@@ -8911,7 +9017,7 @@
|
|
|
8911
9017
|
|
|
8912
9018
|
store.transaction.__pushToQueue(request, function (tx, args, success, error) {
|
|
8913
9019
|
store.__deriveKey(tx, value, key, function (clonedKeyOrCurrentNumber, oldCn) {
|
|
8914
|
-
encode
|
|
9020
|
+
encode(value, function (encoded) {
|
|
8915
9021
|
function insert(tx) {
|
|
8916
9022
|
store.__insertData(tx, encoded, value, clonedKeyOrCurrentNumber, oldCn, function () {
|
|
8917
9023
|
if (invalidateCache) {
|
|
@@ -8997,7 +9103,7 @@
|
|
|
8997
9103
|
}
|
|
8998
9104
|
} else {
|
|
8999
9105
|
for (var _i = 0; _i < data.rows.length; _i++) {
|
|
9000
|
-
ret.push(decode
|
|
9106
|
+
ret.push(decode(unescapeSQLiteResponse(data.rows.item(_i).value)));
|
|
9001
9107
|
}
|
|
9002
9108
|
}
|
|
9003
9109
|
|
|
@@ -9032,9 +9138,9 @@
|
|
|
9032
9138
|
return this.__get(query, true);
|
|
9033
9139
|
};
|
|
9034
9140
|
|
|
9035
|
-
IDBObjectStore.prototype.getAll = function
|
|
9036
|
-
|
|
9037
|
-
{
|
|
9141
|
+
IDBObjectStore.prototype.getAll = function
|
|
9142
|
+
/* query, count */
|
|
9143
|
+
() {
|
|
9038
9144
|
// eslint-disable-next-line prefer-rest-params
|
|
9039
9145
|
var _arguments = Array.prototype.slice.call(arguments),
|
|
9040
9146
|
query = _arguments[0],
|
|
@@ -9043,9 +9149,9 @@
|
|
|
9043
9149
|
return this.__get(query, false, true, count);
|
|
9044
9150
|
};
|
|
9045
9151
|
|
|
9046
|
-
IDBObjectStore.prototype.getAllKeys = function
|
|
9047
|
-
|
|
9048
|
-
{
|
|
9152
|
+
IDBObjectStore.prototype.getAllKeys = function
|
|
9153
|
+
/* query, count */
|
|
9154
|
+
() {
|
|
9049
9155
|
// eslint-disable-next-line prefer-rest-params
|
|
9050
9156
|
var _arguments2 = Array.prototype.slice.call(arguments),
|
|
9051
9157
|
query = _arguments2[0],
|
|
@@ -9122,9 +9228,9 @@
|
|
|
9122
9228
|
}, undefined, me);
|
|
9123
9229
|
};
|
|
9124
9230
|
|
|
9125
|
-
IDBObjectStore.prototype.count = function
|
|
9126
|
-
|
|
9127
|
-
{
|
|
9231
|
+
IDBObjectStore.prototype.count = function
|
|
9232
|
+
/* query */
|
|
9233
|
+
() {
|
|
9128
9234
|
var me = this; // eslint-disable-next-line prefer-rest-params
|
|
9129
9235
|
|
|
9130
9236
|
var query = arguments[0];
|
|
@@ -9141,9 +9247,9 @@
|
|
|
9141
9247
|
return IDBCursorWithValue.__createInstance(query, 'next', me, me, 'key', 'value', true).__request;
|
|
9142
9248
|
};
|
|
9143
9249
|
|
|
9144
|
-
IDBObjectStore.prototype.openCursor = function
|
|
9145
|
-
|
|
9146
|
-
{
|
|
9250
|
+
IDBObjectStore.prototype.openCursor = function
|
|
9251
|
+
/* query, direction */
|
|
9252
|
+
() {
|
|
9147
9253
|
var me = this; // eslint-disable-next-line prefer-rest-params
|
|
9148
9254
|
|
|
9149
9255
|
var _arguments3 = Array.prototype.slice.call(arguments),
|
|
@@ -9163,9 +9269,9 @@
|
|
|
9163
9269
|
return cursor.__request;
|
|
9164
9270
|
};
|
|
9165
9271
|
|
|
9166
|
-
IDBObjectStore.prototype.openKeyCursor = function
|
|
9167
|
-
|
|
9168
|
-
{
|
|
9272
|
+
IDBObjectStore.prototype.openKeyCursor = function
|
|
9273
|
+
/* query, direction */
|
|
9274
|
+
() {
|
|
9169
9275
|
var me = this;
|
|
9170
9276
|
|
|
9171
9277
|
if (!(me instanceof IDBObjectStore)) {
|
|
@@ -9267,7 +9373,7 @@
|
|
|
9267
9373
|
}
|
|
9268
9374
|
|
|
9269
9375
|
optionalParameters = optionalParameters || {};
|
|
9270
|
-
/** @name IDBIndexProperties
|
|
9376
|
+
/** @name IDBIndexProperties */
|
|
9271
9377
|
|
|
9272
9378
|
var indexProperties = {
|
|
9273
9379
|
columnName: indexName,
|
|
@@ -9311,7 +9417,7 @@
|
|
|
9311
9417
|
IDBIndex.__deleteIndex(me, index);
|
|
9312
9418
|
};
|
|
9313
9419
|
|
|
9314
|
-
defineReadonlyOuterInterface(IDBObjectStore.prototype, readonlyProperties$
|
|
9420
|
+
defineReadonlyOuterInterface(IDBObjectStore.prototype, readonlyProperties$1);
|
|
9315
9421
|
defineOuterInterface(IDBObjectStore.prototype, ['name']);
|
|
9316
9422
|
IDBObjectStore.prototype[Symbol.toStringTag] = 'IDBObjectStorePrototype';
|
|
9317
9423
|
Object.defineProperty(IDBObjectStore, 'prototype', {
|
|
@@ -9547,8 +9653,8 @@
|
|
|
9547
9653
|
return str.substr(start, len);
|
|
9548
9654
|
};
|
|
9549
9655
|
|
|
9550
|
-
var listeners
|
|
9551
|
-
var readonlyProperties
|
|
9656
|
+
var listeners = ['onabort', 'onclose', 'onerror', 'onversionchange'];
|
|
9657
|
+
var readonlyProperties = ['name', 'version', 'objectStoreNames'];
|
|
9552
9658
|
/**
|
|
9553
9659
|
* IDB Database Object.
|
|
9554
9660
|
* @see http://dvcs.w3.org/hg/IndexedDB/raw-file/tip/Overview.html#database-interface
|
|
@@ -9566,14 +9672,14 @@
|
|
|
9566
9672
|
var _this = this;
|
|
9567
9673
|
|
|
9568
9674
|
this[Symbol.toStringTag] = 'IDBDatabase';
|
|
9569
|
-
defineReadonlyProperties(this, readonlyProperties
|
|
9675
|
+
defineReadonlyProperties(this, readonlyProperties);
|
|
9570
9676
|
this.__db = db;
|
|
9571
9677
|
this.__closePending = false;
|
|
9572
9678
|
this.__oldVersion = oldVersion;
|
|
9573
9679
|
this.__version = version;
|
|
9574
9680
|
this.__name = name;
|
|
9575
9681
|
this.__upgradeTransaction = null;
|
|
9576
|
-
defineListenerProperties(this, listeners
|
|
9682
|
+
defineListenerProperties(this, listeners);
|
|
9577
9683
|
|
|
9578
9684
|
this.__setOptions({
|
|
9579
9685
|
legacyOutputDidListenersThrowFlag: true // Event hook for IndexedB
|
|
@@ -9672,7 +9778,7 @@
|
|
|
9672
9778
|
if (autoInc && (keyPath === '' || Array.isArray(keyPath))) {
|
|
9673
9779
|
throw createDOMException('InvalidAccessError', 'With autoIncrement set, the keyPath argument must not be an array or empty string.');
|
|
9674
9780
|
}
|
|
9675
|
-
/** @name IDBObjectStoreProperties
|
|
9781
|
+
/** @name IDBObjectStoreProperties */
|
|
9676
9782
|
|
|
9677
9783
|
|
|
9678
9784
|
var storeProperties = {
|
|
@@ -9840,8 +9946,8 @@
|
|
|
9840
9946
|
});
|
|
9841
9947
|
};
|
|
9842
9948
|
|
|
9843
|
-
defineOuterInterface(IDBDatabase.prototype, listeners
|
|
9844
|
-
defineReadonlyOuterInterface(IDBDatabase.prototype, readonlyProperties
|
|
9949
|
+
defineOuterInterface(IDBDatabase.prototype, listeners);
|
|
9950
|
+
defineReadonlyOuterInterface(IDBDatabase.prototype, readonlyProperties);
|
|
9845
9951
|
Object.defineProperty(IDBDatabase.prototype, 'constructor', {
|
|
9846
9952
|
enumerable: false,
|
|
9847
9953
|
writable: true,
|
|
@@ -9859,7 +9965,7 @@
|
|
|
9859
9965
|
};
|
|
9860
9966
|
|
|
9861
9967
|
var getOrigin = function getOrigin() {
|
|
9862
|
-
return (typeof location === "undefined" ? "undefined" : _typeof(location)) !== 'object' || !location ? 'null' : location.origin;
|
|
9968
|
+
return (typeof location === "undefined" ? "undefined" : _typeof$1(location)) !== 'object' || !location ? 'null' : location.origin;
|
|
9863
9969
|
};
|
|
9864
9970
|
|
|
9865
9971
|
var hasNullOrigin = function hasNullOrigin() {
|
|
@@ -10821,9 +10927,7 @@
|
|
|
10821
10927
|
return _construct(IDBCursor, args);
|
|
10822
10928
|
};
|
|
10823
10929
|
|
|
10824
|
-
IDBCursor.prototype.__find = function ()
|
|
10825
|
-
/* key, tx, success, error, recordsToLoad */
|
|
10826
|
-
{
|
|
10930
|
+
IDBCursor.prototype.__find = function () {
|
|
10827
10931
|
if (this.__multiEntryIndex) {
|
|
10828
10932
|
this.__findMultiEntry.apply(this, arguments);
|
|
10829
10933
|
} else {
|
|
@@ -11235,9 +11339,9 @@
|
|
|
11235
11339
|
});
|
|
11236
11340
|
};
|
|
11237
11341
|
|
|
11238
|
-
IDBCursor.prototype["continue"] = function
|
|
11239
|
-
|
|
11240
|
-
{
|
|
11342
|
+
IDBCursor.prototype["continue"] = function
|
|
11343
|
+
/* key */
|
|
11344
|
+
() {
|
|
11241
11345
|
// eslint-disable-next-line prefer-rest-params
|
|
11242
11346
|
this.__continue(arguments[0]);
|
|
11243
11347
|
};
|
|
@@ -11274,8 +11378,8 @@
|
|
|
11274
11378
|
}
|
|
11275
11379
|
|
|
11276
11380
|
if (cmpResult === 0) {
|
|
11277
|
-
encode
|
|
11278
|
-
encode
|
|
11381
|
+
encode(primaryKey, function (encPrimaryKey) {
|
|
11382
|
+
encode(me.primaryKey, function (encObjectStorePos) {
|
|
11279
11383
|
if (encPrimaryKey === encObjectStorePos || me.direction === 'next' && encPrimaryKey < encObjectStorePos || me.direction === 'prev' && encPrimaryKey > encObjectStorePos) {
|
|
11280
11384
|
throw createDOMException('DataError', 'Cannot continue the cursor in an unexpected direction');
|
|
11281
11385
|
}
|
|
@@ -11432,7 +11536,7 @@
|
|
|
11432
11536
|
});
|
|
11433
11537
|
|
|
11434
11538
|
function setConfig(prop, val) {
|
|
11435
|
-
if (prop && _typeof(prop) === 'object') {
|
|
11539
|
+
if (prop && _typeof$1(prop) === 'object') {
|
|
11436
11540
|
Object.entries(prop).forEach(function (_ref) {
|
|
11437
11541
|
var _ref2 = _slicedToArray(_ref, 2),
|
|
11438
11542
|
p = _ref2[0],
|
|
@@ -11459,7 +11563,7 @@
|
|
|
11459
11563
|
setConfig(initialConfig);
|
|
11460
11564
|
}
|
|
11461
11565
|
|
|
11462
|
-
var IDB = idb || (typeof window !== 'undefined' ? window : typeof self !== 'undefined' ? self : typeof global$
|
|
11566
|
+
var IDB = idb || (typeof window !== 'undefined' ? window : typeof self !== 'undefined' ? self : typeof global$1 !== 'undefined' ? global$1 : {});
|
|
11463
11567
|
|
|
11464
11568
|
function shim(name, value, propDesc) {
|
|
11465
11569
|
if (!propDesc || !Object.defineProperty) {
|
|
@@ -11516,7 +11620,7 @@
|
|
|
11516
11620
|
IDB.shimIndexedDB.__useShim = function () {
|
|
11517
11621
|
function setNonIDBGlobals() {
|
|
11518
11622
|
var prefix = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
|
11519
|
-
shim(prefix + 'DOMException', ShimDOMException
|
|
11623
|
+
shim(prefix + 'DOMException', ShimDOMException);
|
|
11520
11624
|
shim(prefix + 'DOMStringList', DOMStringList, {
|
|
11521
11625
|
enumerable: false,
|
|
11522
11626
|
configurable: true,
|
|
@@ -11584,8 +11688,8 @@
|
|
|
11584
11688
|
Object.setPrototypeOf(IDBRequest, EventTarget);
|
|
11585
11689
|
Object.setPrototypeOf(IDBTransaction, EventTarget);
|
|
11586
11690
|
Object.setPrototypeOf(IDBVersionChangeEvent, ShimEvent);
|
|
11587
|
-
Object.setPrototypeOf(ShimDOMException
|
|
11588
|
-
Object.setPrototypeOf(ShimDOMException
|
|
11691
|
+
Object.setPrototypeOf(ShimDOMException, Error);
|
|
11692
|
+
Object.setPrototypeOf(ShimDOMException.prototype, Error.prototype);
|
|
11589
11693
|
setPrototypeOfCustomEvent();
|
|
11590
11694
|
}
|
|
11591
11695
|
|
|
@@ -11686,5 +11790,5 @@
|
|
|
11686
11790
|
|
|
11687
11791
|
setGlobalVars();
|
|
11688
11792
|
|
|
11689
|
-
}))
|
|
11793
|
+
}));
|
|
11690
11794
|
//# sourceMappingURL=indexeddbshim.js.map
|