indexeddbshim 17.6.0 → 18.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 +13 -3
- package/dist/DOMException.d.ts +2 -2
- package/dist/DOMException.d.ts.map +1 -1
- package/dist/IDBCursor.d.ts +8 -2
- package/dist/IDBCursor.d.ts.map +1 -1
- package/dist/IDBFactory.d.ts.map +1 -1
- package/dist/IDBTransaction.d.ts +12 -12
- package/dist/IDBTransaction.d.ts.map +1 -1
- package/dist/indexeddbshim-Key.js +2 -2
- package/dist/indexeddbshim-Key.js.map +1 -1
- package/dist/indexeddbshim-Key.min.js +1 -1
- package/dist/indexeddbshim-Key.min.js.map +1 -1
- package/dist/indexeddbshim-UnicodeIdentifiers-node.cjs +506 -379
- package/dist/indexeddbshim-UnicodeIdentifiers-node.cjs.map +1 -1
- package/dist/indexeddbshim-UnicodeIdentifiers.js +633 -710
- package/dist/indexeddbshim-UnicodeIdentifiers.js.map +1 -1
- package/dist/indexeddbshim-UnicodeIdentifiers.min.js +4 -4
- package/dist/indexeddbshim-UnicodeIdentifiers.min.js.map +1 -1
- package/dist/indexeddbshim-node.cjs +506 -379
- package/dist/indexeddbshim-node.cjs.map +1 -1
- package/dist/indexeddbshim-noninvasive.js +633 -710
- package/dist/indexeddbshim-noninvasive.js.map +1 -1
- package/dist/indexeddbshim-noninvasive.min.js +4 -4
- package/dist/indexeddbshim-noninvasive.min.js.map +1 -1
- package/dist/indexeddbshim.js +633 -710
- package/dist/indexeddbshim.js.map +1 -1
- package/dist/indexeddbshim.min.js +4 -4
- package/dist/indexeddbshim.min.js.map +1 -1
- package/dist/util.d.ts +15 -0
- package/dist/util.d.ts.map +1 -1
- package/package.json +6 -9
- package/src/DOMException.js +1 -1
- package/src/IDBCursor.js +4 -1
- package/src/IDBFactory.js +5 -7
- package/src/IDBTransaction.js +8 -8
- package/src/util.js +23 -1
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
/*! indexeddbshim -
|
|
1
|
+
/*! indexeddbshim - v18.0.0 - 9/3/2026 */
|
|
2
2
|
|
|
3
3
|
'use strict';
|
|
4
4
|
|
|
5
5
|
var fs$1 = require('node:fs');
|
|
6
|
-
var path = require('node:path');
|
|
7
6
|
var customOpenDatabase = require('websql-configurable/custom/index.js');
|
|
8
7
|
var SQLiteDatabase = require('websql-configurable/lib/sqlite/SQLiteDatabase.js');
|
|
9
8
|
|
|
@@ -1744,6 +1743,28 @@ function sqlLIKEEscape(str) {
|
|
|
1744
1743
|
return str.replaceAll('^', '^^');
|
|
1745
1744
|
}
|
|
1746
1745
|
|
|
1746
|
+
/**
|
|
1747
|
+
* Minimal replacement for `path.join(base, name)` covering our only use case:
|
|
1748
|
+
* `name` is always a bare file name (no separators and no `.`/`..`), and
|
|
1749
|
+
* `base` is a directory path expected to be absolute and normalized (an
|
|
1750
|
+
* empty string means the current working directory). Unlike `path.join`,
|
|
1751
|
+
* this performs no `.`/`..` resolution. It reuses the separator style of
|
|
1752
|
+
* `base` (backslash only when `base` uses backslashes and no forward
|
|
1753
|
+
* slashes, i.e. a Windows path), otherwise `/`; Node's `fs`, SQLite, and
|
|
1754
|
+
* `websql-configurable` accept either separator on Windows regardless.
|
|
1755
|
+
* Avoiding `node:path` keeps browser bundles free of a path polyfill.
|
|
1756
|
+
* @param {string} base
|
|
1757
|
+
* @param {string} name
|
|
1758
|
+
* @returns {string}
|
|
1759
|
+
*/
|
|
1760
|
+
function joinPath(base, name) {
|
|
1761
|
+
if (!base) {
|
|
1762
|
+
return name;
|
|
1763
|
+
}
|
|
1764
|
+
const sep = base.includes('\\') && !base.includes('/') ? '\\' : '/';
|
|
1765
|
+
return base.replace(/[/\\]+$/u, '') + sep + name;
|
|
1766
|
+
}
|
|
1767
|
+
|
|
1747
1768
|
/**
|
|
1748
1769
|
* @typedef {Function} AnyClass
|
|
1749
1770
|
*/
|
|
@@ -2495,7 +2516,7 @@ function createNonNativeDOMException(name, message) {
|
|
|
2495
2516
|
|
|
2496
2517
|
/**
|
|
2497
2518
|
* @typedef {{
|
|
2498
|
-
* message: string
|
|
2519
|
+
* message: string
|
|
2499
2520
|
* }} ErrorLike
|
|
2500
2521
|
*/
|
|
2501
2522
|
|
|
@@ -4910,7 +4931,7 @@ const readonlyProperties$4 = ['objectStoreNames', 'mode', 'durability', 'db', 'e
|
|
|
4910
4931
|
/**
|
|
4911
4932
|
* @typedef {{
|
|
4912
4933
|
* op: SQLCallback,
|
|
4913
|
-
* args:
|
|
4934
|
+
* args: any[],
|
|
4914
4935
|
* req: import('./IDBRequest.js').IDBRequestFull|null
|
|
4915
4936
|
* }} RequestInfo
|
|
4916
4937
|
*/
|
|
@@ -4962,17 +4983,17 @@ const readonlyProperties$4 = ['objectStoreNames', 'mode', 'durability', 'db', 'e
|
|
|
4962
4983
|
* __pushToQueue: (
|
|
4963
4984
|
* request: import('./IDBRequest.js').IDBRequestFull|null,
|
|
4964
4985
|
* callback: SQLCallback,
|
|
4965
|
-
* args?:
|
|
4986
|
+
* args?: any[]
|
|
4966
4987
|
* ) => void,
|
|
4967
4988
|
* __assertActive: () => void,
|
|
4968
4989
|
* commit: () => void,
|
|
4969
4990
|
* __addNonRequestToTransactionQueue: (
|
|
4970
4991
|
* callback: SQLCallback,
|
|
4971
|
-
* args?:
|
|
4992
|
+
* args?: any[]
|
|
4972
4993
|
* ) => void
|
|
4973
4994
|
* __addToTransactionQueue: (
|
|
4974
4995
|
* callback: SQLCallback,
|
|
4975
|
-
* args:
|
|
4996
|
+
* args: any[]|undefined,
|
|
4976
4997
|
* source: import('./IDBDatabase.js').IDBDatabaseFull|
|
|
4977
4998
|
* import('./IDBObjectStore.js').IDBObjectStoreFull|
|
|
4978
4999
|
* import('./IDBIndex.js').IDBIndexFull|
|
|
@@ -5603,7 +5624,7 @@ IDBTransaction.prototype.__createRequest = function (source) {
|
|
|
5603
5624
|
/**
|
|
5604
5625
|
* @typedef {(
|
|
5605
5626
|
* tx: import('websql-configurable/lib/websql/WebSQLTransaction.js').default,
|
|
5606
|
-
* args:
|
|
5627
|
+
* args: any[],
|
|
5607
5628
|
* success: (result?: any, req?: import('./IDBRequest.js').IDBRequestFull) => void,
|
|
5608
5629
|
* error: (
|
|
5609
5630
|
* tx: import('websql-configurable/lib/websql/WebSQLTransaction.js').default|Error|DOMException,
|
|
@@ -5616,7 +5637,7 @@ IDBTransaction.prototype.__createRequest = function (source) {
|
|
|
5616
5637
|
/**
|
|
5617
5638
|
* Adds a callback function to the transaction queue.
|
|
5618
5639
|
* @param {SQLCallback} callback
|
|
5619
|
-
* @param {
|
|
5640
|
+
* @param {any[]} args
|
|
5620
5641
|
* @param {import('./IDBDatabase.js').IDBDatabaseFull|
|
|
5621
5642
|
* import('./IDBObjectStore.js').IDBObjectStoreFull|
|
|
5622
5643
|
* import('./IDBIndex.js').IDBIndexFull} source
|
|
@@ -5633,7 +5654,7 @@ IDBTransaction.prototype.__addToTransactionQueue = function (callback, args, sou
|
|
|
5633
5654
|
* Adds a callback function to the transaction queue without generating a
|
|
5634
5655
|
* request.
|
|
5635
5656
|
* @param {SQLCallback} callback
|
|
5636
|
-
* @param {
|
|
5657
|
+
* @param {any[]} args
|
|
5637
5658
|
* @this {IDBTransactionFull}
|
|
5638
5659
|
* @returns {void}
|
|
5639
5660
|
*/
|
|
@@ -5645,7 +5666,7 @@ IDBTransaction.prototype.__addNonRequestToTransactionQueue = function (callback,
|
|
|
5645
5666
|
* Adds an IDBRequest to the transaction queue.
|
|
5646
5667
|
* @param {import('./IDBRequest.js').IDBRequestFull|null} request
|
|
5647
5668
|
* @param {SQLCallback} callback
|
|
5648
|
-
* @param {
|
|
5669
|
+
* @param {any[]} args
|
|
5649
5670
|
* @this {IDBTransactionFull}
|
|
5650
5671
|
* @returns {void}
|
|
5651
5672
|
*/
|
|
@@ -6059,10 +6080,10 @@ function toStringTag(e) {
|
|
|
6059
6080
|
}
|
|
6060
6081
|
function hasConstructorOf(r, n) {
|
|
6061
6082
|
if (!r || "object" != typeof r) return false;
|
|
6062
|
-
const
|
|
6063
|
-
if (!
|
|
6064
|
-
const
|
|
6065
|
-
return "function" != typeof
|
|
6083
|
+
const o = t(r);
|
|
6084
|
+
if (!o) return null === n;
|
|
6085
|
+
const a = e(o, "constructor") && o.constructor;
|
|
6086
|
+
return "function" != typeof a ? null === n : n === a || null !== n && Function.prototype.toString.call(a) === Function.prototype.toString.call(n) || "function" == typeof n && "string" == typeof a.__typeson__type__ && a.__typeson__type__ === n.__typeson__type__;
|
|
6066
6087
|
}
|
|
6067
6088
|
function isPlainObject(e) {
|
|
6068
6089
|
return !(!e || "Object" !== toStringTag(e)) && (!t(e) || hasConstructorOf(e, Object));
|
|
@@ -6084,28 +6105,28 @@ function unescapeKeyPathComponent(e) {
|
|
|
6084
6105
|
function getByKeyPath(t, r, n) {
|
|
6085
6106
|
if ("" === r) return t;
|
|
6086
6107
|
if (null === t || "object" != typeof t) throw new TypeError("Unexpected non-object type");
|
|
6087
|
-
const
|
|
6088
|
-
|
|
6089
|
-
if (e(t,
|
|
6090
|
-
if (-1 !==
|
|
6091
|
-
const e = t[
|
|
6092
|
-
return void 0 === e ? void 0 : getByKeyPath(e, r.slice(
|
|
6108
|
+
const o = r.indexOf("."),
|
|
6109
|
+
a = unescapeKeyPathComponent(-1 === o ? r : r.slice(0, o));
|
|
6110
|
+
if (e(t, a)) {
|
|
6111
|
+
if (-1 !== o) {
|
|
6112
|
+
const e = t[a];
|
|
6113
|
+
return void 0 === e ? void 0 : getByKeyPath(e, r.slice(o + 1));
|
|
6093
6114
|
}
|
|
6094
|
-
return t[
|
|
6115
|
+
return t[a];
|
|
6095
6116
|
}
|
|
6096
6117
|
}
|
|
6097
|
-
function setAtKeyPath(t, r, n,
|
|
6118
|
+
function setAtKeyPath(t, r, n, o) {
|
|
6098
6119
|
if ("" === r) return n;
|
|
6099
|
-
let
|
|
6120
|
+
let a = t,
|
|
6100
6121
|
s = r;
|
|
6101
6122
|
for (;;) {
|
|
6102
|
-
if (!
|
|
6123
|
+
if (!a || "object" != typeof a) throw new TypeError("Unexpected non-object type");
|
|
6103
6124
|
const r = s.indexOf("."),
|
|
6104
6125
|
i = unescapeKeyPathComponent(-1 === r ? s : s.slice(0, r));
|
|
6105
6126
|
if ("__proto__" === i) throw new TypeError("Invalid property");
|
|
6106
|
-
if (-1 === r) return
|
|
6107
|
-
if (!e(
|
|
6108
|
-
|
|
6127
|
+
if (-1 === r) return a[i] = n, t;
|
|
6128
|
+
if (!e(a, i)) throw new TypeError("Invalid property");
|
|
6129
|
+
a = a[i], s = s.slice(r + 1);
|
|
6109
6130
|
}
|
|
6110
6131
|
}
|
|
6111
6132
|
function getJSONType(e) {
|
|
@@ -6121,9 +6142,9 @@ const {
|
|
|
6121
6142
|
hasOwn: n
|
|
6122
6143
|
} = Object,
|
|
6123
6144
|
{
|
|
6124
|
-
isArray:
|
|
6145
|
+
isArray: o
|
|
6125
6146
|
} = Array,
|
|
6126
|
-
|
|
6147
|
+
a = ["type", "replaced", "iterateIn", "iterateUnsetNumeric", "iterateSymbols", "addLength"];
|
|
6127
6148
|
function setOwnEnumerable(e, t, r) {
|
|
6128
6149
|
Object.defineProperty(e, t, {
|
|
6129
6150
|
configurable: true,
|
|
@@ -6132,6 +6153,7 @@ function setOwnEnumerable(e, t, r) {
|
|
|
6132
6153
|
writable: true
|
|
6133
6154
|
});
|
|
6134
6155
|
}
|
|
6156
|
+
const s = ["asyncIterator", "hasInstance", "isConcatSpreadable", "iterator", "match", "matchAll", "replace", "search", "species", "split", "toPrimitive", "toStringTag", "unscopables"];
|
|
6135
6157
|
function nestedPathsFirst(e, t) {
|
|
6136
6158
|
if ("" === e.keypath) return -1;
|
|
6137
6159
|
let r = e.keypath.match(/\./gu) ?? 0,
|
|
@@ -6140,7 +6162,12 @@ function nestedPathsFirst(e, t) {
|
|
|
6140
6162
|
}
|
|
6141
6163
|
class Typeson {
|
|
6142
6164
|
constructor(e) {
|
|
6143
|
-
this.options = e, this.plainObjectReplacers = [], this.nonplainObjectReplacers = [], this.revivers = {}, this.types = {};
|
|
6165
|
+
this.options = e, this.plainObjectReplacers = [], this.nonplainObjectReplacers = [], this.revivers = {}, this.types = {}, this.symbolsByName = Object.create(null), this.symbolsByValue = new Map();
|
|
6166
|
+
const t = e?.symbols;
|
|
6167
|
+
t && Object.entries(t).forEach(([e, t]) => {
|
|
6168
|
+
if ("symbol" != typeof t) throw new TypeError("Non-symbol value supplied for `symbols` entry: " + e);
|
|
6169
|
+
this.symbolsByName[e] = t, this.symbolsByValue.set(t, e);
|
|
6170
|
+
});
|
|
6144
6171
|
}
|
|
6145
6172
|
stringify(e, t, r, n) {
|
|
6146
6173
|
n = {
|
|
@@ -6148,8 +6175,8 @@ class Typeson {
|
|
|
6148
6175
|
...n,
|
|
6149
6176
|
stringification: true
|
|
6150
6177
|
};
|
|
6151
|
-
const
|
|
6152
|
-
return a
|
|
6178
|
+
const a = this.encapsulate(e, null, n);
|
|
6179
|
+
return o(a) ? JSON.stringify(a[0], t, r) : a.then(e => JSON.stringify(e, t, r));
|
|
6153
6180
|
}
|
|
6154
6181
|
stringifySync(e, t, r, n) {
|
|
6155
6182
|
return this.stringify(e, t, r, {
|
|
@@ -6198,74 +6225,74 @@ class Typeson {
|
|
|
6198
6225
|
iterateNone: true
|
|
6199
6226
|
});
|
|
6200
6227
|
}
|
|
6201
|
-
encapsulate(e, t,
|
|
6202
|
-
const
|
|
6228
|
+
encapsulate(e, t, i) {
|
|
6229
|
+
const c = {
|
|
6203
6230
|
sync: true,
|
|
6204
6231
|
...this.options,
|
|
6205
|
-
...
|
|
6232
|
+
...i
|
|
6206
6233
|
},
|
|
6207
6234
|
{
|
|
6208
|
-
sync:
|
|
6209
|
-
} =
|
|
6235
|
+
sync: l
|
|
6236
|
+
} = c,
|
|
6237
|
+
y = {},
|
|
6210
6238
|
u = {},
|
|
6211
|
-
y = [],
|
|
6212
|
-
l = [],
|
|
6213
6239
|
p = [],
|
|
6214
|
-
f =
|
|
6240
|
+
f = [],
|
|
6241
|
+
d = [],
|
|
6242
|
+
m = !("cyclic" in c) || c.cyclic,
|
|
6215
6243
|
{
|
|
6216
|
-
encapsulateObserver:
|
|
6217
|
-
encapsulateError:
|
|
6218
|
-
} =
|
|
6244
|
+
encapsulateObserver: h,
|
|
6245
|
+
encapsulateError: b
|
|
6246
|
+
} = c,
|
|
6219
6247
|
finish = e => {
|
|
6220
|
-
const t = Object.values(
|
|
6221
|
-
if (
|
|
6222
|
-
if (t.length)
|
|
6223
|
-
|
|
6224
|
-
|
|
6225
|
-
|
|
6226
|
-
|
|
6227
|
-
|
|
6228
|
-
|
|
6229
|
-
}
|
|
6230
|
-
}
|
|
6248
|
+
const t = Object.values(y);
|
|
6249
|
+
if (c.iterateNone) return t.length ? t[0] : getJSONType(e);
|
|
6250
|
+
if (c.returnTypeNames) return !!t.length && [...new Set(t)];
|
|
6251
|
+
const r = Object.keys(u).length > 0,
|
|
6252
|
+
o = isObject(e) && (n(e, "$types") || n(e, "$symbolKeys"));
|
|
6253
|
+
return r || t.length ? (!o && e && isPlainObject(e) ? t.length && (e.$types = y) : e = {
|
|
6254
|
+
$: e,
|
|
6255
|
+
$types: {
|
|
6256
|
+
$: y
|
|
6257
|
+
}
|
|
6258
|
+
}, r && (e.$symbolKeys = u)) : o && (e = {
|
|
6231
6259
|
$: e,
|
|
6232
6260
|
$types: true
|
|
6233
|
-
});
|
|
6234
|
-
return !i.returnTypeNames && e;
|
|
6261
|
+
}), e;
|
|
6235
6262
|
},
|
|
6236
6263
|
checkPromises = async (e, t) => {
|
|
6237
6264
|
const r = await Promise.all(t.map(e => e[1].p));
|
|
6238
6265
|
return await Promise.all(r.map(async function (r) {
|
|
6239
6266
|
const n = [],
|
|
6240
|
-
[
|
|
6241
|
-
[
|
|
6242
|
-
|
|
6243
|
-
p = hasConstructorOf(
|
|
6244
|
-
return
|
|
6267
|
+
[o] = t.splice(0, 1),
|
|
6268
|
+
[a,, s, i, c, l, y] = o,
|
|
6269
|
+
u = _encapsulate(a, r, s, i, n, true, y),
|
|
6270
|
+
p = hasConstructorOf(u, TypesonPromise);
|
|
6271
|
+
return a && p ? (setOwnEnumerable(c, l, await u.p), checkPromises(e, n)) : (a ? setOwnEnumerable(c, l, u) : e = p ? u.p : u, checkPromises(e, n));
|
|
6245
6272
|
})), e;
|
|
6246
6273
|
},
|
|
6247
6274
|
_adaptBuiltinStateObjectProperties = (e, t, r) => {
|
|
6248
6275
|
Object.assign(e, t);
|
|
6249
|
-
const n =
|
|
6276
|
+
const n = a.map(t => {
|
|
6250
6277
|
const r = e[t];
|
|
6251
6278
|
return delete e[t], r;
|
|
6252
6279
|
});
|
|
6253
|
-
r(),
|
|
6280
|
+
r(), a.forEach((t, r) => {
|
|
6254
6281
|
e[t] = n[r];
|
|
6255
6282
|
});
|
|
6256
6283
|
},
|
|
6257
|
-
_encapsulate = (e, t,
|
|
6258
|
-
let
|
|
6259
|
-
|
|
6260
|
-
const
|
|
6261
|
-
const n =
|
|
6262
|
-
|
|
6284
|
+
_encapsulate = (e, t, a, i, l, d, m) => {
|
|
6285
|
+
let g,
|
|
6286
|
+
v = {};
|
|
6287
|
+
const w = h ? function (r) {
|
|
6288
|
+
const n = m ?? i.type ?? getJSONType(t);
|
|
6289
|
+
h(Object.assign(r ?? v, {
|
|
6263
6290
|
keypath: e,
|
|
6264
6291
|
value: t,
|
|
6265
|
-
cyclic:
|
|
6266
|
-
stateObj:
|
|
6267
|
-
promisesData:
|
|
6268
|
-
resolvingTypesonPromise:
|
|
6292
|
+
cyclic: a,
|
|
6293
|
+
stateObj: i,
|
|
6294
|
+
promisesData: l,
|
|
6295
|
+
resolvingTypesonPromise: d,
|
|
6269
6296
|
awaitingTypesonPromise: hasConstructorOf(t, TypesonPromise)
|
|
6270
6297
|
}, {
|
|
6271
6298
|
type: n
|
|
@@ -6274,136 +6301,175 @@ class Typeson {
|
|
|
6274
6301
|
getEncapsulatedValue = (e, t, r) => {
|
|
6275
6302
|
try {
|
|
6276
6303
|
return {
|
|
6277
|
-
value: _encapsulate(e, t[r], Boolean(
|
|
6304
|
+
value: _encapsulate(e, t[r], Boolean(a), i, l, d)
|
|
6278
6305
|
};
|
|
6279
6306
|
} catch (n) {
|
|
6280
|
-
if (!
|
|
6281
|
-
const
|
|
6282
|
-
|
|
6307
|
+
if (!b) throw n;
|
|
6308
|
+
const o = m ?? i.type ?? getJSONType(t),
|
|
6309
|
+
a = b({
|
|
6283
6310
|
keypath: e,
|
|
6284
6311
|
error: n,
|
|
6285
6312
|
parent: t,
|
|
6286
6313
|
key: r,
|
|
6287
|
-
stateObj:
|
|
6288
|
-
type:
|
|
6314
|
+
stateObj: i,
|
|
6315
|
+
type: o
|
|
6289
6316
|
});
|
|
6290
|
-
if (!
|
|
6291
|
-
if ("substitute" in
|
|
6292
|
-
value:
|
|
6317
|
+
if (!a) throw n;
|
|
6318
|
+
if ("substitute" in a) return {
|
|
6319
|
+
value: a.substitute,
|
|
6293
6320
|
substitute: true
|
|
6294
6321
|
};
|
|
6295
|
-
if (
|
|
6322
|
+
if (a.ignore) return;
|
|
6296
6323
|
throw n;
|
|
6297
6324
|
}
|
|
6298
6325
|
};
|
|
6299
|
-
if (["string", "boolean", "number", "undefined"].includes(typeof t)) return void 0 === t || t === 1 / 0 || 0 === t || t === -1 / 0 || Number.isNaN(t) ? (
|
|
6300
|
-
replaced:
|
|
6301
|
-
})) :
|
|
6302
|
-
if (null === t) return
|
|
6303
|
-
if (
|
|
6304
|
-
const r =
|
|
6305
|
-
if (-1 !== r) return
|
|
6306
|
-
cyclicKeypath:
|
|
6307
|
-
}), "#" +
|
|
6308
|
-
true ===
|
|
6326
|
+
if (["string", "boolean", "number", "undefined"].includes(typeof t)) return void 0 === t || t === 1 / 0 || 0 === t || t === -1 / 0 || Number.isNaN(t) ? (g = i.replaced ? t : replace(e, t, i, l, false, d, w), g !== t && (v = {
|
|
6327
|
+
replaced: g
|
|
6328
|
+
})) : g = t, w && w(), g;
|
|
6329
|
+
if (null === t) return w && w(), t;
|
|
6330
|
+
if (a && t && "object" == typeof t && !i.iterateIn && !i.iterateUnsetNumeric) {
|
|
6331
|
+
const r = p.indexOf(t);
|
|
6332
|
+
if (-1 !== r) return y[e] = "#", w && w({
|
|
6333
|
+
cyclicKeypath: f[r]
|
|
6334
|
+
}), "#" + f[r];
|
|
6335
|
+
true === a && (p.push(t), f.push(e));
|
|
6309
6336
|
}
|
|
6310
|
-
const
|
|
6311
|
-
|
|
6312
|
-
|
|
6313
|
-
let
|
|
6314
|
-
if (
|
|
6315
|
-
replaced:
|
|
6316
|
-
}) : "" === e && hasConstructorOf(t, TypesonPromise) ? (
|
|
6317
|
-
clone:
|
|
6318
|
-
}) : !
|
|
6319
|
-
clone:
|
|
6320
|
-
}),
|
|
6321
|
-
if (!
|
|
6322
|
-
if (
|
|
6337
|
+
const O = isPlainObject(t),
|
|
6338
|
+
A = o(t),
|
|
6339
|
+
T = (O || A) && (!this.plainObjectReplacers.length || i.replaced) || i.iterateIn ? t : replace(e, t, i, l, O || A, null, w);
|
|
6340
|
+
let S;
|
|
6341
|
+
if (T !== t ? (g = T, v = {
|
|
6342
|
+
replaced: T
|
|
6343
|
+
}) : "" === e && hasConstructorOf(t, TypesonPromise) ? (l.push([e, t, a, i, void 0, void 0, i.type]), g = t) : A && "object" !== i.iterateIn || "array" === i.iterateIn ? (S = new Array(t.length), v = {
|
|
6344
|
+
clone: S
|
|
6345
|
+
}) : !O && ("object" != typeof t || "toJSON" in t || hasConstructorOf(t, TypesonPromise) || hasConstructorOf(t, Promise) || hasConstructorOf(t, ArrayBuffer)) && "object" !== i.iterateIn ? g = t : (S = {}, i.addLength && (S.length = t.length), v = {
|
|
6346
|
+
clone: S
|
|
6347
|
+
}), w && w(), c.iterateNone) return S ?? g;
|
|
6348
|
+
if (!S) return g;
|
|
6349
|
+
if (i.iterateIn) {
|
|
6323
6350
|
for (const r in t) {
|
|
6324
|
-
const
|
|
6351
|
+
const o = {
|
|
6325
6352
|
ownKeys: n(t, r)
|
|
6326
6353
|
};
|
|
6327
|
-
_adaptBuiltinStateObjectProperties(
|
|
6354
|
+
_adaptBuiltinStateObjectProperties(i, o, () => {
|
|
6328
6355
|
const n = e + (e ? "." : "") + escapeKeyPathComponent(r),
|
|
6329
|
-
|
|
6330
|
-
|
|
6331
|
-
hasConstructorOf(
|
|
6356
|
+
o = getEncapsulatedValue(n, t, r),
|
|
6357
|
+
s = o && o.value;
|
|
6358
|
+
hasConstructorOf(s, TypesonPromise) ? l.push([n, s, Boolean(a), i, S, r, i.type]) : o && (void 0 !== s || "substitute" in o) && setOwnEnumerable(S, r, s);
|
|
6332
6359
|
});
|
|
6333
6360
|
}
|
|
6334
|
-
|
|
6361
|
+
w && w({
|
|
6335
6362
|
endIterateIn: true,
|
|
6336
6363
|
end: true
|
|
6337
6364
|
});
|
|
6338
6365
|
} else r(t).forEach(function (r) {
|
|
6339
6366
|
const n = e + (e ? "." : "") + escapeKeyPathComponent(r);
|
|
6340
|
-
_adaptBuiltinStateObjectProperties(
|
|
6367
|
+
_adaptBuiltinStateObjectProperties(i, {
|
|
6341
6368
|
ownKeys: true
|
|
6342
6369
|
}, () => {
|
|
6343
6370
|
const e = getEncapsulatedValue(n, t, r),
|
|
6344
|
-
|
|
6345
|
-
hasConstructorOf(
|
|
6371
|
+
o = e && e.value;
|
|
6372
|
+
hasConstructorOf(o, TypesonPromise) ? l.push([n, o, Boolean(a), i, S, r, i.type]) : e && (void 0 !== o || "substitute" in e) && setOwnEnumerable(S, r, o);
|
|
6346
6373
|
});
|
|
6347
|
-
}),
|
|
6374
|
+
}), w && w({
|
|
6348
6375
|
endIterateOwn: true,
|
|
6349
6376
|
end: true
|
|
6350
|
-
})
|
|
6351
|
-
|
|
6377
|
+
}), (i.iterateSymbols || c.iterateSymbols) && (Object.getOwnPropertySymbols(t).filter(e => Object.prototype.propertyIsEnumerable.call(t, e)).forEach(r => {
|
|
6378
|
+
const n = function resolveSymbolIdentity(e, t) {
|
|
6379
|
+
const r = Symbol.keyFor(e);
|
|
6380
|
+
if (void 0 !== r) return {
|
|
6381
|
+
for: r
|
|
6382
|
+
};
|
|
6383
|
+
const n = s.find(t => Symbol[t] === e);
|
|
6384
|
+
if (n) return {
|
|
6385
|
+
wellKnown: n
|
|
6386
|
+
};
|
|
6387
|
+
const o = t.get(e);
|
|
6388
|
+
return void 0 !== o ? {
|
|
6389
|
+
registered: o
|
|
6390
|
+
} : null;
|
|
6391
|
+
}(r, this.symbolsByValue);
|
|
6392
|
+
if (!n) {
|
|
6393
|
+
if (c.throwOnUnregisteredSymbol) throw new TypeError("Cannot serialize a Symbol-keyed property whose Symbol has no portable identity (not global, not well-known, and not in the `symbols` option): " + String(r));
|
|
6394
|
+
return;
|
|
6395
|
+
}
|
|
6396
|
+
const o = u[e] ??= [],
|
|
6397
|
+
y = {
|
|
6398
|
+
key: n
|
|
6399
|
+
};
|
|
6400
|
+
o.push(y);
|
|
6401
|
+
const p = o.length - 1,
|
|
6402
|
+
f = `$symbolKeys.${escapeKeyPathComponent(e)}.${String(p)}.value`,
|
|
6403
|
+
d = {
|
|
6404
|
+
value: t[r]
|
|
6405
|
+
};
|
|
6406
|
+
_adaptBuiltinStateObjectProperties(i, {
|
|
6407
|
+
ownKeys: true
|
|
6408
|
+
}, () => {
|
|
6409
|
+
const e = getEncapsulatedValue(f, d, "value"),
|
|
6410
|
+
t = e && e.value;
|
|
6411
|
+
hasConstructorOf(t, TypesonPromise) ? l.push([f, t, Boolean(a), i, y, "value", i.type]) : e && (void 0 !== t || "substitute" in e) && setOwnEnumerable(y, "value", t);
|
|
6412
|
+
});
|
|
6413
|
+
}), w && w({
|
|
6414
|
+
endIterateSymbols: true,
|
|
6415
|
+
end: true
|
|
6416
|
+
}));
|
|
6417
|
+
if (i.iterateUnsetNumeric) {
|
|
6352
6418
|
const r = t.length;
|
|
6353
6419
|
for (let n = 0; n < r; n++) {
|
|
6354
6420
|
if (n in t) continue;
|
|
6355
6421
|
const r = `${e}${e ? "." : ""}${String(n)}`;
|
|
6356
|
-
_adaptBuiltinStateObjectProperties(
|
|
6422
|
+
_adaptBuiltinStateObjectProperties(i, {
|
|
6357
6423
|
ownKeys: false
|
|
6358
6424
|
}, () => {
|
|
6359
|
-
const e = _encapsulate(r, void 0, Boolean(
|
|
6360
|
-
hasConstructorOf(e, TypesonPromise) ?
|
|
6425
|
+
const e = _encapsulate(r, void 0, Boolean(a), i, l, d);
|
|
6426
|
+
hasConstructorOf(e, TypesonPromise) ? l.push([r, e, Boolean(a), i, S, n, i.type]) : void 0 !== e && setOwnEnumerable(S, n, e);
|
|
6361
6427
|
});
|
|
6362
6428
|
}
|
|
6363
|
-
|
|
6429
|
+
w && w({
|
|
6364
6430
|
endIterateUnsetNumeric: true,
|
|
6365
6431
|
end: true
|
|
6366
6432
|
});
|
|
6367
6433
|
}
|
|
6368
|
-
return
|
|
6434
|
+
return S;
|
|
6369
6435
|
},
|
|
6370
|
-
replace = (e, t, r, n,
|
|
6371
|
-
const i =
|
|
6372
|
-
let
|
|
6373
|
-
for (;
|
|
6374
|
-
const
|
|
6375
|
-
if (
|
|
6436
|
+
replace = (e, t, r, n, o, a, s) => {
|
|
6437
|
+
const i = o ? this.plainObjectReplacers : this.nonplainObjectReplacers;
|
|
6438
|
+
let c = i.length;
|
|
6439
|
+
for (; c--;) {
|
|
6440
|
+
const o = i[c];
|
|
6441
|
+
if (o.test(t, r)) {
|
|
6376
6442
|
const {
|
|
6377
6443
|
type: i
|
|
6378
|
-
} =
|
|
6444
|
+
} = o;
|
|
6379
6445
|
if (Object.hasOwn(this.revivers, i)) {
|
|
6380
|
-
const t =
|
|
6381
|
-
|
|
6446
|
+
const t = y[e];
|
|
6447
|
+
y[e] = t ? [i].concat(t) : i;
|
|
6382
6448
|
}
|
|
6383
6449
|
if (Object.assign(r, {
|
|
6384
6450
|
type: i,
|
|
6385
6451
|
replaced: true
|
|
6386
|
-
}), (
|
|
6452
|
+
}), (l || !o.replaceAsync) && !o.replace) return s && s({
|
|
6387
6453
|
typeDetected: true
|
|
6388
|
-
}), _encapsulate(e, t,
|
|
6389
|
-
let
|
|
6454
|
+
}), _encapsulate(e, t, m && "readonly", r, n, a, i);
|
|
6455
|
+
let c;
|
|
6390
6456
|
if (s && s({
|
|
6391
6457
|
replacing: true
|
|
6392
|
-
}),
|
|
6393
|
-
if (void 0 ===
|
|
6394
|
-
|
|
6395
|
-
} else
|
|
6396
|
-
return _encapsulate(e,
|
|
6458
|
+
}), l || !o.replaceAsync) {
|
|
6459
|
+
if (void 0 === o.replace) throw new TypeError("Missing replacer");
|
|
6460
|
+
c = o.replace(t, r);
|
|
6461
|
+
} else c = o.replaceAsync(t, r);
|
|
6462
|
+
return _encapsulate(e, c, m && "readonly", r, n, a, i);
|
|
6397
6463
|
}
|
|
6398
6464
|
}
|
|
6399
6465
|
return t;
|
|
6400
6466
|
},
|
|
6401
|
-
|
|
6402
|
-
if (
|
|
6467
|
+
g = _encapsulate("", e, m, t ?? {}, d);
|
|
6468
|
+
if (d.length) return l && c.throwOnBadSyncType ? (() => {
|
|
6403
6469
|
throw new TypeError("Sync method requested but async result obtained");
|
|
6404
|
-
})() : Promise.resolve(checkPromises(
|
|
6405
|
-
if (!
|
|
6406
|
-
return
|
|
6470
|
+
})() : Promise.resolve(checkPromises(g, d)).then(finish);
|
|
6471
|
+
if (!l && c.throwOnBadSyncType) throw new TypeError("Async method requested but sync result obtained");
|
|
6472
|
+
return l && c.stringification ? [finish(g)] : l ? finish(g) : Promise.resolve(finish(g));
|
|
6407
6473
|
}
|
|
6408
6474
|
encapsulateSync(e, t, r) {
|
|
6409
6475
|
return this.encapsulate(e, t, {
|
|
@@ -6420,111 +6486,144 @@ class Typeson {
|
|
|
6420
6486
|
});
|
|
6421
6487
|
}
|
|
6422
6488
|
revive(e, t) {
|
|
6423
|
-
const
|
|
6489
|
+
const a = {
|
|
6424
6490
|
sync: true,
|
|
6425
6491
|
...this.options,
|
|
6426
6492
|
...t
|
|
6427
6493
|
},
|
|
6428
6494
|
{
|
|
6429
|
-
sync:
|
|
6430
|
-
} =
|
|
6495
|
+
sync: i
|
|
6496
|
+
} = a;
|
|
6431
6497
|
function finishRevival(e) {
|
|
6432
|
-
if (
|
|
6433
|
-
if (
|
|
6498
|
+
if (i) return e;
|
|
6499
|
+
if (a.throwOnBadSyncType) throw new TypeError("Async method requested but sync result obtained");
|
|
6434
6500
|
return Promise.resolve(e);
|
|
6435
6501
|
}
|
|
6436
6502
|
if (!e || "object" != typeof e || Array.isArray(e)) return finishRevival(e);
|
|
6437
|
-
let
|
|
6438
|
-
if (true ===
|
|
6439
|
-
|
|
6440
|
-
|
|
6441
|
-
|
|
6442
|
-
|
|
6443
|
-
|
|
6444
|
-
|
|
6503
|
+
let c = e.$types;
|
|
6504
|
+
if (true === c) return finishRevival(e.$);
|
|
6505
|
+
const l = e.$symbolKeys;
|
|
6506
|
+
let y = void 0 !== l;
|
|
6507
|
+
if (!c || "object" != typeof c || Array.isArray(c)) {
|
|
6508
|
+
if (!l) return finishRevival(e);
|
|
6509
|
+
c = {};
|
|
6510
|
+
}
|
|
6511
|
+
const u = [],
|
|
6512
|
+
p = Object.create(null),
|
|
6513
|
+
f = {};
|
|
6514
|
+
let d = true;
|
|
6515
|
+
c.$ && isPlainObject(c.$) && (e = e.$, c = c.$, d = false, y = false, void 0 !== l && isObject(e) && !n(e, "$symbolKeys") && (e.$symbolKeys = l, y = true));
|
|
6445
6516
|
const executeReviver = (e, t) => {
|
|
6446
6517
|
const [r] = this.revivers[e] ?? [];
|
|
6447
6518
|
if (!r) throw new Error("Unregistered type: " + e);
|
|
6448
|
-
if (
|
|
6449
|
-
if (!
|
|
6450
|
-
if (r.revive) return r.revive(t,
|
|
6519
|
+
if (i && !("revive" in r)) return t;
|
|
6520
|
+
if (!i && r.reviveAsync) return r.reviveAsync(t, f);
|
|
6521
|
+
if (r.revive) return r.revive(t, f);
|
|
6451
6522
|
throw new Error("Missing reviver");
|
|
6452
6523
|
},
|
|
6453
|
-
|
|
6524
|
+
m = [];
|
|
6454
6525
|
function checkUndefined(e) {
|
|
6455
6526
|
return hasConstructorOf(e, Undefined) ? void 0 : e;
|
|
6456
6527
|
}
|
|
6457
|
-
const
|
|
6458
|
-
|
|
6459
|
-
|
|
6460
|
-
|
|
6461
|
-
|
|
6462
|
-
|
|
6463
|
-
|
|
6464
|
-
|
|
6465
|
-
|
|
6466
|
-
|
|
6467
|
-
|
|
6468
|
-
|
|
6469
|
-
|
|
6470
|
-
|
|
6471
|
-
|
|
6472
|
-
|
|
6473
|
-
|
|
6474
|
-
|
|
6528
|
+
const reHomeSymbolKeys = e => {
|
|
6529
|
+
if (!isObject(e)) return;
|
|
6530
|
+
const t = y ? e.$symbolKeys : l;
|
|
6531
|
+
t && (Object.entries(t).forEach(([t, r]) => {
|
|
6532
|
+
const o = getByKeyPath(e, t);
|
|
6533
|
+
isObject(o) && r.forEach(e => {
|
|
6534
|
+
if (!n(e, "value")) return;
|
|
6535
|
+
const t = function resolveSymbolFromIdentity(e, t) {
|
|
6536
|
+
if ("for" in e) return Symbol.for(e.for);
|
|
6537
|
+
if ("wellKnown" in e) {
|
|
6538
|
+
const t = s.find(t => t === e.wellKnown);
|
|
6539
|
+
if (!t) throw new Error("Unknown well-known Symbol: " + e.wellKnown);
|
|
6540
|
+
return Symbol[t];
|
|
6541
|
+
}
|
|
6542
|
+
if (!n(t, e.registered)) throw new Error("Unregistered symbol: " + e.registered);
|
|
6543
|
+
return t[e.registered];
|
|
6544
|
+
}(e.key, this.symbolsByName),
|
|
6545
|
+
r = checkUndefined(e.value);
|
|
6546
|
+
e.descriptor ? Object.defineProperty(o, t, {
|
|
6547
|
+
configurable: true,
|
|
6548
|
+
enumerable: true,
|
|
6549
|
+
writable: true,
|
|
6550
|
+
...e.descriptor,
|
|
6551
|
+
value: r
|
|
6552
|
+
}) : o[t] = r;
|
|
6553
|
+
});
|
|
6554
|
+
}), y && delete e.$symbolKeys);
|
|
6555
|
+
},
|
|
6556
|
+
h = (() => {
|
|
6557
|
+
if (!c) throw new Error("Found bad `types`");
|
|
6558
|
+
const t = [];
|
|
6559
|
+
if (Object.entries(c).forEach(([e, r]) => {
|
|
6560
|
+
"#" !== r && [].concat(r).forEach(r => {
|
|
6561
|
+
const [, {
|
|
6562
|
+
plain: n
|
|
6563
|
+
}] = this.revivers[r] ?? [null, {}];
|
|
6564
|
+
n && (t.push({
|
|
6565
|
+
keypath: e,
|
|
6566
|
+
type: r
|
|
6567
|
+
}), delete c[e]);
|
|
6568
|
+
});
|
|
6569
|
+
}), t.length) return t.sort(nestedPathsFirst), t.reduce(function reducer(t, {
|
|
6475
6570
|
keypath: r,
|
|
6476
6571
|
type: n
|
|
6477
|
-
})
|
|
6478
|
-
|
|
6479
|
-
|
|
6480
|
-
|
|
6481
|
-
|
|
6482
|
-
|
|
6483
|
-
|
|
6484
|
-
|
|
6485
|
-
|
|
6486
|
-
|
|
6487
|
-
|
|
6488
|
-
|
|
6489
|
-
|
|
6490
|
-
|
|
6491
|
-
|
|
6492
|
-
|
|
6572
|
+
}) {
|
|
6573
|
+
if (isThenable(t)) return t.then(e => reducer(e, {
|
|
6574
|
+
keypath: r,
|
|
6575
|
+
type: n
|
|
6576
|
+
}));
|
|
6577
|
+
let o = getByKeyPath(e, r);
|
|
6578
|
+
if (o = executeReviver(n, o), hasConstructorOf(o, TypesonPromise)) return o.then(t => {
|
|
6579
|
+
const n = setAtKeyPath(e, r, t);
|
|
6580
|
+
n === t && (e = n);
|
|
6581
|
+
});
|
|
6582
|
+
const a = setAtKeyPath(e, r, o);
|
|
6583
|
+
a === o && (e = a);
|
|
6584
|
+
}, void 0);
|
|
6585
|
+
})();
|
|
6586
|
+
let b;
|
|
6587
|
+
return hasConstructorOf(h, TypesonPromise) ? b = h.then(() => e) : (b = function _revive(e, t, a, s, l) {
|
|
6588
|
+
if (d && "$types" === e) return;
|
|
6589
|
+
const y = m.length,
|
|
6590
|
+
f = n(c, e) ? c[e] : void 0,
|
|
6591
|
+
h = o(t);
|
|
6493
6592
|
if (h || isPlainObject(t)) {
|
|
6494
|
-
const
|
|
6593
|
+
const o = h ? new Array(t.length) : {};
|
|
6495
6594
|
for (r(t).forEach(r => {
|
|
6496
|
-
const n = _revive(e + (e ? "." : "") + escapeKeyPathComponent(r), t[r],
|
|
6497
|
-
set = e => (hasConstructorOf(e, Undefined) ? setOwnEnumerable(
|
|
6498
|
-
hasConstructorOf(n, TypesonPromise) ?
|
|
6499
|
-
}), t =
|
|
6500
|
-
const [[e, t, r,
|
|
6501
|
-
|
|
6502
|
-
s =
|
|
6503
|
-
if (!
|
|
6504
|
-
setOwnEnumerable(r,
|
|
6595
|
+
const n = _revive(e + (e ? "." : "") + escapeKeyPathComponent(r), t[r], a ?? o, o, r),
|
|
6596
|
+
set = e => (hasConstructorOf(e, Undefined) ? setOwnEnumerable(o, r, void 0) : void 0 !== e && setOwnEnumerable(o, r, e), e);
|
|
6597
|
+
hasConstructorOf(n, TypesonPromise) ? m.push(n.then(e => set(e))) : set(n);
|
|
6598
|
+
}), t = o; u.length;) {
|
|
6599
|
+
const [[e, t, r, o]] = u,
|
|
6600
|
+
a = n(p, t),
|
|
6601
|
+
s = a ? p[t] : getByKeyPath(e, t);
|
|
6602
|
+
if (!a && void 0 === s) break;
|
|
6603
|
+
setOwnEnumerable(r, o, s), u.shift();
|
|
6505
6604
|
}
|
|
6506
6605
|
}
|
|
6507
|
-
if (!
|
|
6508
|
-
if ("#" ===
|
|
6606
|
+
if (!f) return p[e] = t, t;
|
|
6607
|
+
if ("#" === f) {
|
|
6509
6608
|
const e = t.slice(1),
|
|
6510
|
-
r = n(
|
|
6511
|
-
|
|
6512
|
-
return r || void 0 !==
|
|
6609
|
+
r = n(p, e),
|
|
6610
|
+
o = r ? p[e] : getByKeyPath(a, e);
|
|
6611
|
+
return r || void 0 !== o || u.push([a, e, s, l]), o;
|
|
6513
6612
|
}
|
|
6514
6613
|
const applyType = t => {
|
|
6515
|
-
const r = [].concat(
|
|
6614
|
+
const r = [].concat(f).reduce(function reducer(e, t) {
|
|
6516
6615
|
if (hasConstructorOf(e, TypesonPromise)) return e.then(e => reducer(e, t));
|
|
6517
6616
|
if ("string" != typeof t) throw new TypeError("Bad type JSON");
|
|
6518
6617
|
return executeReviver(t, e);
|
|
6519
6618
|
}, t);
|
|
6520
|
-
return hasConstructorOf(r, TypesonPromise) ? r.then(t => (
|
|
6619
|
+
return hasConstructorOf(r, TypesonPromise) ? r.then(t => (p[e] = t, t)) : (p[e] = r, r);
|
|
6521
6620
|
};
|
|
6522
|
-
return !
|
|
6523
|
-
}("", e, null),
|
|
6621
|
+
return !i && m.length > y ? TypesonPromise.all(m.slice(y)).then(() => applyType(t)) : applyType(t);
|
|
6622
|
+
}("", e, null), m.length && (b = TypesonPromise.resolve(b).then(e => TypesonPromise.all([e, ...m])).then(([e]) => e))), l && (isThenable(b) ? b = b.then(e => (reHomeSymbolKeys(e), e)) : reHomeSymbolKeys(b)), isThenable(b) ? i && a.throwOnBadSyncType ? (() => {
|
|
6524
6623
|
throw new TypeError("Sync method requested but async result obtained");
|
|
6525
|
-
})() : hasConstructorOf(
|
|
6624
|
+
})() : hasConstructorOf(b, TypesonPromise) ? b.p.then(checkUndefined) : b : !i && a.throwOnBadSyncType ? (() => {
|
|
6526
6625
|
throw new TypeError("Async method requested but sync result obtained");
|
|
6527
|
-
})() :
|
|
6626
|
+
})() : i ? checkUndefined(b) : Promise.resolve(checkUndefined(b));
|
|
6528
6627
|
}
|
|
6529
6628
|
reviveSync(e, t) {
|
|
6530
6629
|
return this.revive(e, {
|
|
@@ -6543,11 +6642,11 @@ class Typeson {
|
|
|
6543
6642
|
register(e, t) {
|
|
6544
6643
|
const n = t ?? {},
|
|
6545
6644
|
reg = e => {
|
|
6546
|
-
|
|
6645
|
+
o(e) ? e.forEach(e => {
|
|
6547
6646
|
reg(e);
|
|
6548
6647
|
}) : r(e).forEach(t => {
|
|
6549
6648
|
if ("#" === t) throw new TypeError("# cannot be used as a type name as it is reserved for cyclic objects");
|
|
6550
|
-
if (
|
|
6649
|
+
if (i.includes(t)) throw new TypeError("Plain JSON object types are reserved as type names");
|
|
6551
6650
|
let r = e[t];
|
|
6552
6651
|
if ([this.plainObjectReplacers, this.nonplainObjectReplacers].forEach(e => {
|
|
6553
6652
|
const r = e.findIndex(e => e.type === t);
|
|
@@ -6561,7 +6660,7 @@ class Typeson {
|
|
|
6561
6660
|
}),
|
|
6562
6661
|
revive: t => Object.assign(Object.create(e.prototype), t)
|
|
6563
6662
|
};
|
|
6564
|
-
} else if (
|
|
6663
|
+
} else if (o(r)) {
|
|
6565
6664
|
const [e, t, n] = r;
|
|
6566
6665
|
r = {
|
|
6567
6666
|
test: e,
|
|
@@ -6570,13 +6669,13 @@ class Typeson {
|
|
|
6570
6669
|
};
|
|
6571
6670
|
}
|
|
6572
6671
|
if (!r?.test) return;
|
|
6573
|
-
const
|
|
6672
|
+
const a = {
|
|
6574
6673
|
type: t,
|
|
6575
6674
|
test: r.test.bind(r)
|
|
6576
6675
|
};
|
|
6577
|
-
r.replace && (
|
|
6578
|
-
const
|
|
6579
|
-
if (r.testPlainObjects ? this.plainObjectReplacers.splice(
|
|
6676
|
+
r.replace && (a.replace = r.replace.bind(r)), r.replaceAsync && (a.replaceAsync = r.replaceAsync.bind(r));
|
|
6677
|
+
const s = "number" == typeof n.fallback ? n.fallback : n.fallback ? 0 : 1 / 0;
|
|
6678
|
+
if (r.testPlainObjects ? this.plainObjectReplacers.splice(s, 0, a) : this.nonplainObjectReplacers.splice(s, 0, a), r.revive || r.reviveAsync) {
|
|
6580
6679
|
const e = {};
|
|
6581
6680
|
r.revive && (e.revive = r.revive.bind(r)), r.reviveAsync && (e.reviveAsync = r.reviveAsync.bind(r)), this.revivers[t] = [e, {
|
|
6582
6681
|
plain: r.testPlainObjects
|
|
@@ -6592,27 +6691,27 @@ class Typeson {
|
|
|
6592
6691
|
}
|
|
6593
6692
|
class Undefined {}
|
|
6594
6693
|
Undefined.__typeson__type__ = "TypesonUndefined";
|
|
6595
|
-
const
|
|
6596
|
-
for (var
|
|
6597
|
-
var
|
|
6694
|
+
const i = ["null", "boolean", "number", "string", "array", "object"];
|
|
6695
|
+
for (var c = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", l = new Uint8Array(256), y = 0; y < 64; y++) l[c.codePointAt(y)] = y;
|
|
6696
|
+
var u = function encode(e, t, r) {
|
|
6598
6697
|
null == r && (r = e.byteLength);
|
|
6599
|
-
for (var n = new Uint8Array(e, 0, r),
|
|
6600
|
-
return
|
|
6698
|
+
for (var n = new Uint8Array(e, 0, r), o = n.length, a = "", s = 0; s < o; s += 3) a += c[n[s] >> 2], a += c[(3 & n[s]) << 4 | n[s + 1] >> 4], a += c[(15 & n[s + 1]) << 2 | n[s + 2] >> 6], a += c[63 & n[s + 2]];
|
|
6699
|
+
return o % 3 == 2 ? a = a.slice(0, -1) + "=" : o % 3 == 1 && (a = a.slice(0, -2) + "=="), a;
|
|
6601
6700
|
},
|
|
6602
|
-
|
|
6701
|
+
p = function decode(e, t) {
|
|
6603
6702
|
var r = e.length;
|
|
6604
6703
|
if (r % 4) throw new Error("Bad base64 length: not divisible by four");
|
|
6605
6704
|
var n,
|
|
6606
|
-
a,
|
|
6607
6705
|
o,
|
|
6706
|
+
a,
|
|
6608
6707
|
s,
|
|
6609
6708
|
i = .75 * e.length,
|
|
6610
|
-
|
|
6709
|
+
c = 0;
|
|
6611
6710
|
"=" === e[e.length - 1] && (i--, "=" === e[e.length - 2] && i--);
|
|
6612
|
-
for (var y = new ArrayBuffer(i, t),
|
|
6711
|
+
for (var y = new ArrayBuffer(i, t), u = new Uint8Array(y), p = 0; p < r; p += 4) n = l[e.codePointAt(p)], o = l[e.codePointAt(p + 1)], a = l[e.codePointAt(p + 2)], s = l[e.codePointAt(p + 3)], u[c++] = n << 2 | o >> 4, u[c++] = (15 & o) << 4 | a >> 2, u[c++] = (3 & a) << 6 | 63 & s;
|
|
6613
6712
|
return y;
|
|
6614
6713
|
};
|
|
6615
|
-
const
|
|
6714
|
+
const f = {
|
|
6616
6715
|
arraybuffer: {
|
|
6617
6716
|
test: e => "ArrayBuffer" === toStringTag(e),
|
|
6618
6717
|
replace(e, t) {
|
|
@@ -6621,21 +6720,21 @@ const p = {
|
|
|
6621
6720
|
return -1 !== r ? {
|
|
6622
6721
|
index: r
|
|
6623
6722
|
} : (t.buffers.push(e), {
|
|
6624
|
-
s:
|
|
6723
|
+
s: u(e),
|
|
6625
6724
|
maxByteLength: e.maxByteLength,
|
|
6626
6725
|
resizable: e.resizable
|
|
6627
6726
|
});
|
|
6628
6727
|
},
|
|
6629
6728
|
revive(e, t) {
|
|
6630
6729
|
if (t.buffers || (t.buffers = []), Object.hasOwn(e, "index")) return t.buffers[e.index];
|
|
6631
|
-
const r =
|
|
6730
|
+
const r = p(e.s, e.resizable ? {
|
|
6632
6731
|
maxByteLength: e.maxByteLength
|
|
6633
6732
|
} : void 0);
|
|
6634
6733
|
return t.buffers.push(r), r;
|
|
6635
6734
|
}
|
|
6636
6735
|
}
|
|
6637
6736
|
},
|
|
6638
|
-
|
|
6737
|
+
d = {
|
|
6639
6738
|
audiodata: {
|
|
6640
6739
|
test: e => "AudioData" === toStringTag(e),
|
|
6641
6740
|
replace(e) {
|
|
@@ -6643,10 +6742,10 @@ const p = {
|
|
|
6643
6742
|
format: t,
|
|
6644
6743
|
sampleRate: r,
|
|
6645
6744
|
numberOfFrames: n,
|
|
6646
|
-
numberOfChannels:
|
|
6647
|
-
timestamp:
|
|
6745
|
+
numberOfChannels: o,
|
|
6746
|
+
timestamp: a
|
|
6648
6747
|
} = e,
|
|
6649
|
-
s = t.endsWith("-planar") ?
|
|
6748
|
+
s = t.endsWith("-planar") ? o : 1,
|
|
6650
6749
|
i = [];
|
|
6651
6750
|
let c = 0;
|
|
6652
6751
|
for (let t = 0; t < s; t++) {
|
|
@@ -6655,10 +6754,10 @@ const p = {
|
|
|
6655
6754
|
});
|
|
6656
6755
|
i.push(r), c += r;
|
|
6657
6756
|
}
|
|
6658
|
-
const
|
|
6757
|
+
const l = new ArrayBuffer(c);
|
|
6659
6758
|
let y = 0;
|
|
6660
6759
|
for (let t = 0; t < s; t++) {
|
|
6661
|
-
const r = new Uint8Array(
|
|
6760
|
+
const r = new Uint8Array(l, y, i[t]);
|
|
6662
6761
|
e.copyTo(r, {
|
|
6663
6762
|
planeIndex: t
|
|
6664
6763
|
}), y += i[t];
|
|
@@ -6667,9 +6766,9 @@ const p = {
|
|
|
6667
6766
|
format: t,
|
|
6668
6767
|
sampleRate: r,
|
|
6669
6768
|
numberOfFrames: n,
|
|
6670
|
-
numberOfChannels:
|
|
6671
|
-
timestamp:
|
|
6672
|
-
data:
|
|
6769
|
+
numberOfChannels: o,
|
|
6770
|
+
timestamp: a,
|
|
6771
|
+
data: l
|
|
6673
6772
|
};
|
|
6674
6773
|
},
|
|
6675
6774
|
revive: ({
|
|
@@ -6677,26 +6776,26 @@ const p = {
|
|
|
6677
6776
|
sampleRate: t,
|
|
6678
6777
|
numberOfFrames: r,
|
|
6679
6778
|
numberOfChannels: n,
|
|
6680
|
-
timestamp:
|
|
6681
|
-
data:
|
|
6779
|
+
timestamp: o,
|
|
6780
|
+
data: a
|
|
6682
6781
|
}) => new AudioData({
|
|
6683
6782
|
format: e,
|
|
6684
6783
|
sampleRate: t,
|
|
6685
6784
|
numberOfFrames: r,
|
|
6686
6785
|
numberOfChannels: n,
|
|
6687
|
-
timestamp:
|
|
6688
|
-
data: new Uint8Array(
|
|
6786
|
+
timestamp: o,
|
|
6787
|
+
data: new Uint8Array(a)
|
|
6689
6788
|
})
|
|
6690
6789
|
}
|
|
6691
6790
|
},
|
|
6692
|
-
|
|
6791
|
+
m = {
|
|
6693
6792
|
bigintObject: {
|
|
6694
6793
|
test: e => "object" == typeof e && hasConstructorOf(e, BigInt),
|
|
6695
6794
|
replace: String,
|
|
6696
6795
|
revive: e => new Object(BigInt(e))
|
|
6697
6796
|
}
|
|
6698
6797
|
},
|
|
6699
|
-
|
|
6798
|
+
h = {
|
|
6700
6799
|
bigint: {
|
|
6701
6800
|
test: e => "bigint" == typeof e,
|
|
6702
6801
|
replace: String,
|
|
@@ -6711,7 +6810,7 @@ function string2arraybuffer(e) {
|
|
|
6711
6810
|
for (let r = 0; r < e.length; r++) t[r] = e.charCodeAt(r);
|
|
6712
6811
|
return t.buffer;
|
|
6713
6812
|
}
|
|
6714
|
-
const
|
|
6813
|
+
const b = {
|
|
6715
6814
|
blob: {
|
|
6716
6815
|
test: e => "Blob" === toStringTag(e),
|
|
6717
6816
|
replace(e) {
|
|
@@ -6744,7 +6843,7 @@ const h = {
|
|
|
6744
6843
|
})
|
|
6745
6844
|
}
|
|
6746
6845
|
};
|
|
6747
|
-
const
|
|
6846
|
+
const w = {
|
|
6748
6847
|
cryptokey: {
|
|
6749
6848
|
test: e => "CryptoKey" === toStringTag(e) && e.extractable,
|
|
6750
6849
|
replaceAsync: e => new TypesonPromise(async (t, r) => {
|
|
@@ -6770,7 +6869,7 @@ const v = {
|
|
|
6770
6869
|
}
|
|
6771
6870
|
}
|
|
6772
6871
|
},
|
|
6773
|
-
|
|
6872
|
+
O = {
|
|
6774
6873
|
dataview: {
|
|
6775
6874
|
test: e => "DataView" === toStringTag(e),
|
|
6776
6875
|
replace({
|
|
@@ -6779,13 +6878,13 @@ const v = {
|
|
|
6779
6878
|
byteLength: r
|
|
6780
6879
|
}, n) {
|
|
6781
6880
|
n.buffers || (n.buffers = []);
|
|
6782
|
-
const
|
|
6783
|
-
return -1 !==
|
|
6784
|
-
index:
|
|
6881
|
+
const o = n.buffers.indexOf(e);
|
|
6882
|
+
return -1 !== o ? {
|
|
6883
|
+
index: o,
|
|
6785
6884
|
byteOffset: t,
|
|
6786
6885
|
byteLength: r
|
|
6787
6886
|
} : (n.buffers.push(e), {
|
|
6788
|
-
encoded:
|
|
6887
|
+
encoded: u(e),
|
|
6789
6888
|
maxByteLength: e.maxByteLength,
|
|
6790
6889
|
resizable: e.resizable,
|
|
6791
6890
|
byteOffset: t,
|
|
@@ -6797,19 +6896,19 @@ const v = {
|
|
|
6797
6896
|
const {
|
|
6798
6897
|
byteOffset: r,
|
|
6799
6898
|
byteLength: n,
|
|
6800
|
-
encoded:
|
|
6801
|
-
index:
|
|
6899
|
+
encoded: o,
|
|
6900
|
+
index: a,
|
|
6802
6901
|
maxByteLength: s,
|
|
6803
6902
|
resizable: i
|
|
6804
6903
|
} = e;
|
|
6805
6904
|
let c;
|
|
6806
|
-
return "index" in e ? c = t.buffers[
|
|
6905
|
+
return "index" in e ? c = t.buffers[a] : (c = p(o, i ? {
|
|
6807
6906
|
maxByteLength: s
|
|
6808
6907
|
} : s), t.buffers.push(c)), new DataView(c, r, n);
|
|
6809
6908
|
}
|
|
6810
6909
|
}
|
|
6811
6910
|
},
|
|
6812
|
-
|
|
6911
|
+
A = {
|
|
6813
6912
|
date: {
|
|
6814
6913
|
test: e => "Date" === toStringTag(e),
|
|
6815
6914
|
replace(e) {
|
|
@@ -6819,7 +6918,7 @@ const v = {
|
|
|
6819
6918
|
revive: e => "NaN" === e ? new Date(NaN) : new Date(e)
|
|
6820
6919
|
}
|
|
6821
6920
|
},
|
|
6822
|
-
|
|
6921
|
+
T = {
|
|
6823
6922
|
domexception: {
|
|
6824
6923
|
test: e => "DOMException" === toStringTag(e),
|
|
6825
6924
|
replace: e => ({
|
|
@@ -6832,9 +6931,9 @@ const v = {
|
|
|
6832
6931
|
}) => new DOMException(e, t)
|
|
6833
6932
|
}
|
|
6834
6933
|
},
|
|
6835
|
-
|
|
6934
|
+
S = {};
|
|
6836
6935
|
function create$5(e) {
|
|
6837
|
-
|
|
6936
|
+
S[e.name.toLowerCase()] = {
|
|
6838
6937
|
test: t => toStringTag(t) === e.name,
|
|
6839
6938
|
replace: e => e.is2D ? {
|
|
6840
6939
|
a: e.a,
|
|
@@ -6865,9 +6964,9 @@ function create$5(e) {
|
|
|
6865
6964
|
};
|
|
6866
6965
|
}
|
|
6867
6966
|
"undefined" != typeof DOMMatrix && create$5(DOMMatrix), "undefined" != typeof DOMMatrixReadOnly && create$5(DOMMatrixReadOnly);
|
|
6868
|
-
const
|
|
6967
|
+
const P = {};
|
|
6869
6968
|
function create$4(e) {
|
|
6870
|
-
|
|
6969
|
+
P[e.name.toLowerCase()] = {
|
|
6871
6970
|
test: t => toStringTag(t) === e.name,
|
|
6872
6971
|
replace: e => ({
|
|
6873
6972
|
x: e.x,
|
|
@@ -6879,12 +6978,12 @@ function create$4(e) {
|
|
|
6879
6978
|
x: t,
|
|
6880
6979
|
y: r,
|
|
6881
6980
|
z: n,
|
|
6882
|
-
w:
|
|
6883
|
-
}) => new e(t, r, n,
|
|
6981
|
+
w: o
|
|
6982
|
+
}) => new e(t, r, n, o)
|
|
6884
6983
|
};
|
|
6885
6984
|
}
|
|
6886
6985
|
"undefined" != typeof DOMPoint && create$4(DOMPoint), "undefined" != typeof DOMPointReadOnly && create$4(DOMPointReadOnly);
|
|
6887
|
-
const
|
|
6986
|
+
const E = {
|
|
6888
6987
|
domquad: {
|
|
6889
6988
|
test: e => "DOMQuad" === toStringTag(e),
|
|
6890
6989
|
replace: e => ({
|
|
@@ -6915,12 +7014,12 @@ function create$3(e) {
|
|
|
6915
7014
|
x: t,
|
|
6916
7015
|
y: r,
|
|
6917
7016
|
width: n,
|
|
6918
|
-
height:
|
|
6919
|
-
}) => new e(t, r, n,
|
|
7017
|
+
height: o
|
|
7018
|
+
}) => new e(t, r, n, o)
|
|
6920
7019
|
};
|
|
6921
7020
|
}
|
|
6922
7021
|
"undefined" != typeof DOMRect && create$3(DOMRect), "undefined" != typeof DOMRectReadOnly && create$3(DOMRectReadOnly);
|
|
6923
|
-
const
|
|
7022
|
+
const j = {
|
|
6924
7023
|
encodedaudiochunk: {
|
|
6925
7024
|
test: e => "EncodedAudioChunk" === toStringTag(e),
|
|
6926
7025
|
replace(e) {
|
|
@@ -6928,30 +7027,32 @@ const E = {
|
|
|
6928
7027
|
type: t,
|
|
6929
7028
|
timestamp: r,
|
|
6930
7029
|
duration: n,
|
|
6931
|
-
byteLength:
|
|
7030
|
+
byteLength: o
|
|
6932
7031
|
} = e,
|
|
6933
|
-
|
|
6934
|
-
return e.copyTo(
|
|
7032
|
+
a = new ArrayBuffer(o);
|
|
7033
|
+
return e.copyTo(a), {
|
|
6935
7034
|
type: t,
|
|
6936
7035
|
timestamp: r,
|
|
6937
7036
|
duration: n,
|
|
6938
|
-
data:
|
|
7037
|
+
data: a
|
|
6939
7038
|
};
|
|
6940
7039
|
},
|
|
6941
|
-
revive
|
|
7040
|
+
revive({
|
|
6942
7041
|
type: e,
|
|
6943
7042
|
timestamp: t,
|
|
6944
7043
|
duration: r,
|
|
6945
7044
|
data: n
|
|
6946
|
-
})
|
|
6947
|
-
|
|
6948
|
-
|
|
6949
|
-
|
|
6950
|
-
|
|
6951
|
-
|
|
7045
|
+
}) {
|
|
7046
|
+
const o = {
|
|
7047
|
+
type: e,
|
|
7048
|
+
timestamp: t,
|
|
7049
|
+
data: new Uint8Array(n)
|
|
7050
|
+
};
|
|
7051
|
+
return null != r && (o.duration = r), new EncodedAudioChunk(o);
|
|
7052
|
+
}
|
|
6952
7053
|
}
|
|
6953
7054
|
},
|
|
6954
|
-
|
|
7055
|
+
B = {
|
|
6955
7056
|
encodedvideochunk: {
|
|
6956
7057
|
test: e => "EncodedVideoChunk" === toStringTag(e),
|
|
6957
7058
|
replace(e) {
|
|
@@ -6959,27 +7060,29 @@ const E = {
|
|
|
6959
7060
|
type: t,
|
|
6960
7061
|
timestamp: r,
|
|
6961
7062
|
duration: n,
|
|
6962
|
-
byteLength:
|
|
7063
|
+
byteLength: o
|
|
6963
7064
|
} = e,
|
|
6964
|
-
|
|
6965
|
-
return e.copyTo(
|
|
7065
|
+
a = new ArrayBuffer(o);
|
|
7066
|
+
return e.copyTo(a), {
|
|
6966
7067
|
type: t,
|
|
6967
7068
|
timestamp: r,
|
|
6968
7069
|
duration: n,
|
|
6969
|
-
data:
|
|
7070
|
+
data: a
|
|
6970
7071
|
};
|
|
6971
7072
|
},
|
|
6972
|
-
revive
|
|
7073
|
+
revive({
|
|
6973
7074
|
type: e,
|
|
6974
7075
|
timestamp: t,
|
|
6975
7076
|
duration: r,
|
|
6976
7077
|
data: n
|
|
6977
|
-
})
|
|
6978
|
-
|
|
6979
|
-
|
|
6980
|
-
|
|
6981
|
-
|
|
6982
|
-
|
|
7078
|
+
}) {
|
|
7079
|
+
const o = {
|
|
7080
|
+
type: e,
|
|
7081
|
+
timestamp: t,
|
|
7082
|
+
data: new Uint8Array(n)
|
|
7083
|
+
};
|
|
7084
|
+
return null != r && (o.duration = r), new EncodedVideoChunk(o);
|
|
7085
|
+
}
|
|
6983
7086
|
}
|
|
6984
7087
|
},
|
|
6985
7088
|
N = {
|
|
@@ -6990,16 +7093,16 @@ const E = {
|
|
|
6990
7093
|
message: t,
|
|
6991
7094
|
cause: r,
|
|
6992
7095
|
stack: n,
|
|
6993
|
-
fileName:
|
|
6994
|
-
lineNumber:
|
|
7096
|
+
fileName: o,
|
|
7097
|
+
lineNumber: a,
|
|
6995
7098
|
columnNumber: s
|
|
6996
7099
|
}) => ({
|
|
6997
7100
|
name: e,
|
|
6998
7101
|
message: t,
|
|
6999
7102
|
cause: r,
|
|
7000
7103
|
stack: n,
|
|
7001
|
-
fileName:
|
|
7002
|
-
lineNumber:
|
|
7104
|
+
fileName: o,
|
|
7105
|
+
lineNumber: a,
|
|
7003
7106
|
columnNumber: s
|
|
7004
7107
|
}),
|
|
7005
7108
|
revive(e) {
|
|
@@ -7017,8 +7120,8 @@ function create$2(e) {
|
|
|
7017
7120
|
message: t,
|
|
7018
7121
|
cause: r,
|
|
7019
7122
|
stack: n,
|
|
7020
|
-
fileName:
|
|
7021
|
-
lineNumber:
|
|
7123
|
+
fileName: o,
|
|
7124
|
+
lineNumber: a,
|
|
7022
7125
|
columnNumber: s,
|
|
7023
7126
|
errors: i
|
|
7024
7127
|
}) => ({
|
|
@@ -7026,8 +7129,8 @@ function create$2(e) {
|
|
|
7026
7129
|
message: t,
|
|
7027
7130
|
cause: r,
|
|
7028
7131
|
stack: n,
|
|
7029
|
-
fileName:
|
|
7030
|
-
lineNumber:
|
|
7132
|
+
fileName: o,
|
|
7133
|
+
lineNumber: a,
|
|
7031
7134
|
columnNumber: s,
|
|
7032
7135
|
errors: i
|
|
7033
7136
|
}),
|
|
@@ -7038,7 +7141,7 @@ function create$2(e) {
|
|
|
7038
7141
|
};
|
|
7039
7142
|
}
|
|
7040
7143
|
[TypeError, RangeError, SyntaxError, ReferenceError, EvalError, URIError].forEach(e => create$2(e)), "undefined" != typeof AggregateError && create$2(AggregateError), "function" == typeof InternalError && create$2(InternalError);
|
|
7041
|
-
const
|
|
7144
|
+
const I = {
|
|
7042
7145
|
file: {
|
|
7043
7146
|
test: e => "File" === toStringTag(e),
|
|
7044
7147
|
replace(e) {
|
|
@@ -7075,8 +7178,8 @@ const B = {
|
|
|
7075
7178
|
})
|
|
7076
7179
|
}
|
|
7077
7180
|
},
|
|
7078
|
-
|
|
7079
|
-
file:
|
|
7181
|
+
U = {
|
|
7182
|
+
file: I.file,
|
|
7080
7183
|
filelist: {
|
|
7081
7184
|
test: e => "FileList" === toStringTag(e),
|
|
7082
7185
|
replace(e) {
|
|
@@ -7135,15 +7238,35 @@ const B = {
|
|
|
7135
7238
|
}
|
|
7136
7239
|
}
|
|
7137
7240
|
},
|
|
7138
|
-
|
|
7241
|
+
k = {
|
|
7139
7242
|
imagedata: {
|
|
7140
7243
|
test: e => "ImageData" === toStringTag(e),
|
|
7141
|
-
replace
|
|
7142
|
-
|
|
7143
|
-
|
|
7144
|
-
|
|
7145
|
-
|
|
7146
|
-
|
|
7244
|
+
replace(e) {
|
|
7245
|
+
const t = "Float16Array" === toStringTag(e.data) ? "rgba-float16" : "rgba-unorm8";
|
|
7246
|
+
return {
|
|
7247
|
+
array: [...e.data],
|
|
7248
|
+
width: e.width,
|
|
7249
|
+
height: e.height,
|
|
7250
|
+
pixelFormat: t,
|
|
7251
|
+
colorSpace: e.colorSpace
|
|
7252
|
+
};
|
|
7253
|
+
},
|
|
7254
|
+
revive(e) {
|
|
7255
|
+
const {
|
|
7256
|
+
array: t,
|
|
7257
|
+
width: r,
|
|
7258
|
+
height: n,
|
|
7259
|
+
colorSpace: o,
|
|
7260
|
+
pixelFormat: a
|
|
7261
|
+
} = e;
|
|
7262
|
+
return "rgba-float16" === a ? new ImageData(new Float16Array(t), r, n, {
|
|
7263
|
+
colorSpace: o,
|
|
7264
|
+
pixelFormat: a
|
|
7265
|
+
}) : new ImageData(new Uint8ClampedArray(t), r, n, {
|
|
7266
|
+
colorSpace: o,
|
|
7267
|
+
pixelFormat: a
|
|
7268
|
+
});
|
|
7269
|
+
}
|
|
7147
7270
|
}
|
|
7148
7271
|
},
|
|
7149
7272
|
M = {
|
|
@@ -7153,35 +7276,35 @@ const B = {
|
|
|
7153
7276
|
revive: () => 1 / 0
|
|
7154
7277
|
}
|
|
7155
7278
|
},
|
|
7156
|
-
|
|
7279
|
+
L = {
|
|
7157
7280
|
map: {
|
|
7158
7281
|
test: e => "Map" === toStringTag(e),
|
|
7159
7282
|
replace: e => e.entries().toArray(),
|
|
7160
7283
|
revive: e => new Map(e)
|
|
7161
7284
|
}
|
|
7162
7285
|
},
|
|
7163
|
-
|
|
7286
|
+
F = {
|
|
7164
7287
|
nan: {
|
|
7165
7288
|
test: e => Number.isNaN(e),
|
|
7166
7289
|
replace: () => "NaN",
|
|
7167
7290
|
revive: () => NaN
|
|
7168
7291
|
}
|
|
7169
7292
|
},
|
|
7170
|
-
|
|
7293
|
+
K = {
|
|
7171
7294
|
negativeInfinity: {
|
|
7172
7295
|
test: e => e === -1 / 0,
|
|
7173
7296
|
replace: () => "-Infinity",
|
|
7174
7297
|
revive: () => -1 / 0
|
|
7175
7298
|
}
|
|
7176
7299
|
},
|
|
7177
|
-
|
|
7300
|
+
$ = {
|
|
7178
7301
|
negativeZero: {
|
|
7179
7302
|
test: e => Object.is(e, -0),
|
|
7180
7303
|
replace: () => 0,
|
|
7181
7304
|
revive: () => -0
|
|
7182
7305
|
}
|
|
7183
7306
|
},
|
|
7184
|
-
|
|
7307
|
+
W = {
|
|
7185
7308
|
StringObject: {
|
|
7186
7309
|
test: e => "String" === toStringTag(e) && "object" == typeof e,
|
|
7187
7310
|
replace: String,
|
|
@@ -7201,7 +7324,7 @@ const B = {
|
|
|
7201
7324
|
revive: e => new Number("NaN" === e ? NaN : "Infinity" === e ? 1 / 0 : "-Infinity" === e ? -1 / 0 : "-0" === e ? -0 : e)
|
|
7202
7325
|
}
|
|
7203
7326
|
},
|
|
7204
|
-
|
|
7327
|
+
V = {
|
|
7205
7328
|
quotaexceedederror: {
|
|
7206
7329
|
test: e => "QuotaExceededError" === toStringTag(e),
|
|
7207
7330
|
replace: ({
|
|
@@ -7223,7 +7346,7 @@ const B = {
|
|
|
7223
7346
|
}
|
|
7224
7347
|
}
|
|
7225
7348
|
},
|
|
7226
|
-
|
|
7349
|
+
J = {
|
|
7227
7350
|
regexp: {
|
|
7228
7351
|
test: e => "RegExp" === toStringTag(e),
|
|
7229
7352
|
replace: e => ({
|
|
@@ -7236,26 +7359,26 @@ const B = {
|
|
|
7236
7359
|
}) => new RegExp(e, t)
|
|
7237
7360
|
}
|
|
7238
7361
|
},
|
|
7239
|
-
|
|
7362
|
+
G = {
|
|
7240
7363
|
set: {
|
|
7241
7364
|
test: e => "Set" === toStringTag(e),
|
|
7242
7365
|
replace: e => e.values().toArray(),
|
|
7243
7366
|
revive: e => new Set(e)
|
|
7244
7367
|
}
|
|
7245
7368
|
},
|
|
7246
|
-
|
|
7369
|
+
Y = {};
|
|
7247
7370
|
"function" == typeof Int8Array && [Int8Array, Uint8Array, Uint8ClampedArray, Int16Array, Uint16Array, Int32Array, Uint32Array, Float32Array, Float64Array, ...("function" == typeof BigInt64Array ? [BigInt64Array, BigUint64Array] : []), ...("function" == typeof Float16Array ? [Float16Array] : [])].forEach(e => function create$1(e) {
|
|
7248
7371
|
const t = e.name;
|
|
7249
|
-
|
|
7372
|
+
Y[t.toLowerCase()] = {
|
|
7250
7373
|
test: e => toStringTag(e) === t,
|
|
7251
7374
|
replace: e => (0 === e.byteOffset && e.byteLength === e.buffer.byteLength ? e : e.slice(0)).buffer,
|
|
7252
7375
|
revive: t => "ArrayBuffer" === toStringTag(t) ? new e(t) : t
|
|
7253
7376
|
};
|
|
7254
7377
|
}(e));
|
|
7255
|
-
const
|
|
7378
|
+
const Z = {};
|
|
7256
7379
|
"function" == typeof Int8Array && [Int8Array, Uint8Array, Uint8ClampedArray, Int16Array, Uint16Array, Int32Array, Uint32Array, Float32Array, Float64Array, ...("function" == typeof BigInt64Array ? [BigInt64Array, BigUint64Array] : []), ...("function" == typeof Float16Array ? [Float16Array] : [])].forEach(e => function create(e) {
|
|
7257
7380
|
const t = e.name;
|
|
7258
|
-
|
|
7381
|
+
Z[t.toLowerCase()] = {
|
|
7259
7382
|
test: e => toStringTag(e) === t,
|
|
7260
7383
|
replace({
|
|
7261
7384
|
buffer: e,
|
|
@@ -7263,15 +7386,15 @@ const X = {};
|
|
|
7263
7386
|
length: r
|
|
7264
7387
|
}, n) {
|
|
7265
7388
|
n.buffers || (n.buffers = []);
|
|
7266
|
-
const
|
|
7267
|
-
return -1 !==
|
|
7268
|
-
index:
|
|
7389
|
+
const o = n.buffers.indexOf(e);
|
|
7390
|
+
return -1 !== o ? {
|
|
7391
|
+
index: o,
|
|
7269
7392
|
byteOffset: t,
|
|
7270
7393
|
length: r
|
|
7271
7394
|
} : (n.buffers.push(e), {
|
|
7272
7395
|
maxByteLength: e.maxByteLength,
|
|
7273
7396
|
resizable: e.resizable,
|
|
7274
|
-
encoded:
|
|
7397
|
+
encoded: u(e),
|
|
7275
7398
|
byteOffset: t,
|
|
7276
7399
|
length: r
|
|
7277
7400
|
});
|
|
@@ -7280,27 +7403,27 @@ const X = {};
|
|
|
7280
7403
|
r.buffers || (r.buffers = []);
|
|
7281
7404
|
const {
|
|
7282
7405
|
byteOffset: n,
|
|
7283
|
-
length:
|
|
7284
|
-
encoded:
|
|
7406
|
+
length: o,
|
|
7407
|
+
encoded: a,
|
|
7285
7408
|
index: s,
|
|
7286
7409
|
maxByteLength: i,
|
|
7287
7410
|
resizable: c
|
|
7288
7411
|
} = t;
|
|
7289
|
-
let
|
|
7290
|
-
return "index" in t ?
|
|
7412
|
+
let l;
|
|
7413
|
+
return "index" in t ? l = r.buffers[s] : (l = p(a, c ? {
|
|
7291
7414
|
maxByteLength: i
|
|
7292
|
-
} : void 0), r.buffers.push(
|
|
7415
|
+
} : void 0), r.buffers.push(l)), new e(l, n, o);
|
|
7293
7416
|
}
|
|
7294
7417
|
};
|
|
7295
7418
|
}(e));
|
|
7296
|
-
const
|
|
7419
|
+
const ee = {
|
|
7297
7420
|
undef: {
|
|
7298
7421
|
test: (e, t) => void 0 === e && (t.ownKeys || !("ownKeys" in t)),
|
|
7299
7422
|
replace: () => 0,
|
|
7300
7423
|
revive: () => new Undefined()
|
|
7301
7424
|
}
|
|
7302
7425
|
},
|
|
7303
|
-
|
|
7426
|
+
te = {
|
|
7304
7427
|
userObject: {
|
|
7305
7428
|
test: e => isUserObject(e),
|
|
7306
7429
|
replace: e => ({
|
|
@@ -7309,7 +7432,7 @@ const Y = {
|
|
|
7309
7432
|
revive: e => e
|
|
7310
7433
|
}
|
|
7311
7434
|
},
|
|
7312
|
-
|
|
7435
|
+
re = {
|
|
7313
7436
|
videoframe: {
|
|
7314
7437
|
test: e => "VideoFrame" === toStringTag(e),
|
|
7315
7438
|
replaceAsync: e => new TypesonPromise(async (t, r) => {
|
|
@@ -7317,20 +7440,20 @@ const Y = {
|
|
|
7317
7440
|
const {
|
|
7318
7441
|
format: r,
|
|
7319
7442
|
codedWidth: n,
|
|
7320
|
-
codedHeight:
|
|
7321
|
-
timestamp:
|
|
7443
|
+
codedHeight: o,
|
|
7444
|
+
timestamp: a,
|
|
7322
7445
|
duration: s,
|
|
7323
7446
|
visibleRect: i,
|
|
7324
7447
|
displayWidth: c,
|
|
7325
|
-
displayHeight:
|
|
7448
|
+
displayHeight: l,
|
|
7326
7449
|
colorSpace: y
|
|
7327
7450
|
} = e,
|
|
7328
|
-
|
|
7329
|
-
await e.copyTo(
|
|
7451
|
+
u = new ArrayBuffer(e.allocationSize());
|
|
7452
|
+
await e.copyTo(u), t({
|
|
7330
7453
|
format: r,
|
|
7331
7454
|
codedWidth: n,
|
|
7332
|
-
codedHeight:
|
|
7333
|
-
timestamp:
|
|
7455
|
+
codedHeight: o,
|
|
7456
|
+
timestamp: a,
|
|
7334
7457
|
duration: s,
|
|
7335
7458
|
visibleRect: {
|
|
7336
7459
|
x: i.x,
|
|
@@ -7339,44 +7462,46 @@ const Y = {
|
|
|
7339
7462
|
height: i.height
|
|
7340
7463
|
},
|
|
7341
7464
|
displayWidth: c,
|
|
7342
|
-
displayHeight:
|
|
7465
|
+
displayHeight: l,
|
|
7343
7466
|
colorSpace: {
|
|
7344
7467
|
primaries: y.primaries,
|
|
7345
7468
|
transfer: y.transfer,
|
|
7346
7469
|
matrix: y.matrix,
|
|
7347
7470
|
fullRange: y.fullRange
|
|
7348
7471
|
},
|
|
7349
|
-
data:
|
|
7472
|
+
data: u
|
|
7350
7473
|
});
|
|
7351
7474
|
} catch (e) {
|
|
7352
7475
|
r(e);
|
|
7353
7476
|
}
|
|
7354
7477
|
}),
|
|
7355
|
-
revive
|
|
7478
|
+
revive({
|
|
7356
7479
|
format: e,
|
|
7357
7480
|
codedWidth: t,
|
|
7358
7481
|
codedHeight: r,
|
|
7359
7482
|
timestamp: n,
|
|
7360
|
-
duration:
|
|
7361
|
-
visibleRect:
|
|
7483
|
+
duration: o,
|
|
7484
|
+
visibleRect: a,
|
|
7362
7485
|
displayWidth: s,
|
|
7363
7486
|
displayHeight: i,
|
|
7364
7487
|
colorSpace: c,
|
|
7365
|
-
data:
|
|
7366
|
-
})
|
|
7367
|
-
|
|
7368
|
-
|
|
7369
|
-
|
|
7370
|
-
|
|
7371
|
-
|
|
7372
|
-
|
|
7373
|
-
|
|
7374
|
-
|
|
7375
|
-
|
|
7376
|
-
|
|
7488
|
+
data: l
|
|
7489
|
+
}) {
|
|
7490
|
+
const y = {
|
|
7491
|
+
format: e,
|
|
7492
|
+
codedWidth: t,
|
|
7493
|
+
codedHeight: r,
|
|
7494
|
+
timestamp: n,
|
|
7495
|
+
visibleRect: a,
|
|
7496
|
+
displayWidth: s,
|
|
7497
|
+
displayHeight: i,
|
|
7498
|
+
colorSpace: c
|
|
7499
|
+
};
|
|
7500
|
+
return null != o && (y.duration = o), new VideoFrame(new Uint8Array(l), y);
|
|
7501
|
+
}
|
|
7377
7502
|
}
|
|
7378
7503
|
},
|
|
7379
|
-
|
|
7504
|
+
ne = {
|
|
7380
7505
|
webtransporterror: {
|
|
7381
7506
|
test: e => "WebTransportError" === toStringTag(e),
|
|
7382
7507
|
replace: ({
|
|
@@ -7395,7 +7520,7 @@ const Y = {
|
|
|
7395
7520
|
})
|
|
7396
7521
|
}
|
|
7397
7522
|
},
|
|
7398
|
-
|
|
7523
|
+
oe = [{
|
|
7399
7524
|
arrayNonindexKeys: {
|
|
7400
7525
|
testPlainObjects: true,
|
|
7401
7526
|
test: (e, t) => !!Array.isArray(e) && (Object.keys(e).some(e => String(Number(e)) !== e) && (t.iterateIn = "object", t.addLength = true), true),
|
|
@@ -7415,9 +7540,9 @@ const Y = {
|
|
|
7415
7540
|
revive() {}
|
|
7416
7541
|
}
|
|
7417
7542
|
}],
|
|
7418
|
-
|
|
7419
|
-
|
|
7420
|
-
const ue =
|
|
7543
|
+
ae = [F, M, K, $],
|
|
7544
|
+
ye = [te, ee, oe, W, ae, A, J, k, _, I, U, b, N, C].concat("function" == typeof Map ? L : [], "function" == typeof Set ? G : [], "function" == typeof ArrayBuffer ? f : [], "function" == typeof Uint8Array ? Z : [], "function" == typeof DataView ? O : [], "undefined" != typeof crypto ? w : [], "undefined" != typeof BigInt ? [h, m] : [], "undefined" != typeof DOMException ? T : [], "undefined" != typeof QuotaExceededError ? V : [], "undefined" != typeof WebTransportError ? ne : [], "undefined" != typeof DOMRect ? x : [], "undefined" != typeof DOMPoint ? P : [], "undefined" != typeof DOMQuad ? E : [], "undefined" != typeof DOMMatrix ? S : [], "undefined" != typeof AudioData ? d : [], "undefined" != typeof EncodedAudioChunk ? j : [], "undefined" != typeof EncodedVideoChunk ? B : [], "undefined" != typeof VideoFrame ? re : []);
|
|
7545
|
+
const ue = ye.concat({
|
|
7421
7546
|
checkDataCloneException: {
|
|
7422
7547
|
test(e) {
|
|
7423
7548
|
const t = {}.toString.call(e).slice(8, -1);
|
|
@@ -7434,7 +7559,7 @@ const ue = ce.concat({
|
|
|
7434
7559
|
}
|
|
7435
7560
|
}
|
|
7436
7561
|
}),
|
|
7437
|
-
|
|
7562
|
+
pe = ue.concat({
|
|
7438
7563
|
checkSharedArrayBufferException: {
|
|
7439
7564
|
test(e) {
|
|
7440
7565
|
if ("SharedArrayBuffer" === {}.toString.call(e).slice(8, -1)) throw new DOMException("The object cannot be cloned.", "DataCloneError");
|
|
@@ -7448,7 +7573,7 @@ const ue = ce.concat({
|
|
|
7448
7573
|
// Although typeson-registry already has a FileList type in its structured cloning presets,
|
|
7449
7574
|
// we need to override it so it works with our tests
|
|
7450
7575
|
|
|
7451
|
-
const specSet =
|
|
7576
|
+
const specSet = pe.flatMap(preset => Array.isArray(preset) ? preset : [preset]).find(preset => preset && !Array.isArray(preset) && 'filelist' in preset);
|
|
7452
7577
|
const origFileList = specSet && !Array.isArray(specSet) && 'filelist' in specSet ? specSet.filelist : undefined;
|
|
7453
7578
|
const origTest = origFileList && typeof origFileList === 'object' && 'test' in origFileList && typeof origFileList.test === 'function' ? origFileList.test : undefined;
|
|
7454
7579
|
const origRevive = origFileList && typeof origFileList === 'object' && 'revive' in origFileList && typeof origFileList.revive === 'function' ? origFileList.revive : undefined;
|
|
@@ -7477,7 +7602,7 @@ const customFileList = origFileList ? {
|
|
|
7477
7602
|
return typeof origRevive === 'function' ? origRevive(x, state) : undefined;
|
|
7478
7603
|
}
|
|
7479
7604
|
} : undefined;
|
|
7480
|
-
let typeson = new Typeson().register([
|
|
7605
|
+
let typeson = new Typeson().register([pe, customFileList ? {
|
|
7481
7606
|
filelist: customFileList
|
|
7482
7607
|
} : {}]);
|
|
7483
7608
|
|
|
@@ -7488,7 +7613,7 @@ let typeson = new Typeson().register([ye, customFileList ? {
|
|
|
7488
7613
|
*/
|
|
7489
7614
|
function register(func) {
|
|
7490
7615
|
// eslint-disable-next-line unicorn/no-top-level-assignment-in-function -- Should be one-time cache
|
|
7491
|
-
typeson = new Typeson().register(func(
|
|
7616
|
+
typeson = new Typeson().register(func(pe));
|
|
7492
7617
|
}
|
|
7493
7618
|
|
|
7494
7619
|
/**
|
|
@@ -10024,7 +10149,6 @@ Object.defineProperty(IDBDatabase, 'prototype', {
|
|
|
10024
10149
|
});
|
|
10025
10150
|
|
|
10026
10151
|
/* eslint-disable sonarjs/no-invariant-returns -- Convenient here */
|
|
10027
|
-
// eslint-disable-next-line no-restricted-imports -- Can be polyfilled
|
|
10028
10152
|
|
|
10029
10153
|
/**
|
|
10030
10154
|
* @typedef {number} Integer
|
|
@@ -10384,7 +10508,7 @@ function cleanupDatabaseResources(__openDatabase, name, escapedDatabaseName, dat
|
|
|
10384
10508
|
}
|
|
10385
10509
|
if (fs && CFG.deleteDatabaseFiles !== false) {
|
|
10386
10510
|
closeCachedWebSQLConnections(name, () => {
|
|
10387
|
-
fs.unlink(
|
|
10511
|
+
fs.unlink(joinPath(CFG.databaseBasePath || '', escapedDatabaseName), err => {
|
|
10388
10512
|
if (err && err.code !== 'ENOENT') {
|
|
10389
10513
|
// Ignore if file is already deleted
|
|
10390
10514
|
const removalError = /** @type {Error & {code?: number}} */
|
|
@@ -10398,7 +10522,7 @@ function cleanupDatabaseResources(__openDatabase, name, escapedDatabaseName, dat
|
|
|
10398
10522
|
});
|
|
10399
10523
|
return;
|
|
10400
10524
|
}
|
|
10401
|
-
const sqliteDB = __openDatabase(
|
|
10525
|
+
const sqliteDB = __openDatabase(joinPath(CFG.databaseBasePath || '', escapedDatabaseName), '1', name, CFG.DEFAULT_DB_SIZE);
|
|
10402
10526
|
sqliteDB.transaction(function (tx) {
|
|
10403
10527
|
tx.executeSql('SELECT "name" FROM __sys__', [], function (tx, data) {
|
|
10404
10528
|
const tables = data.rows;
|
|
@@ -10459,7 +10583,7 @@ function createSysDB(__openDatabase, success, failure) {
|
|
|
10459
10583
|
success();
|
|
10460
10584
|
} else {
|
|
10461
10585
|
// eslint-disable-next-line unicorn/no-top-level-assignment-in-function -- Necessary?
|
|
10462
|
-
sysdb = __openDatabase(typeof CFG.memoryDatabase === 'string' ? CFG.memoryDatabase :
|
|
10586
|
+
sysdb = __openDatabase(typeof CFG.memoryDatabase === 'string' ? CFG.memoryDatabase : joinPath(typeof CFG.sysDatabaseBasePath === 'string' ? CFG.sysDatabaseBasePath : CFG.databaseBasePath || '', '__sysdb__' + (CFG.addSQLiteExtension !== false ? '.sqlite' : '')), '1', 'System Database', CFG.DEFAULT_DB_SIZE);
|
|
10463
10587
|
sysdb.transaction(function (systx) {
|
|
10464
10588
|
systx.executeSql('CREATE TABLE IF NOT EXISTS dbVersions (name BLOB, version INT);', [], function (systx) {
|
|
10465
10589
|
if (!CFG.useSQLiteIndexes) {
|
|
@@ -10701,7 +10825,7 @@ IDBFactory.prototype.open = function (name /* , version */) {
|
|
|
10701
10825
|
req.transaction.__addNonRequestToTransactionQueue(
|
|
10702
10826
|
/**
|
|
10703
10827
|
* @param {import('websql-configurable/lib/websql/WebSQLTransaction.js').default} tx
|
|
10704
|
-
* @param {
|
|
10828
|
+
* @param {any[]} args
|
|
10705
10829
|
* @param {(result?: any, req?: import('./IDBRequest.js').IDBRequestFull) => void} finished
|
|
10706
10830
|
* @returns {void}
|
|
10707
10831
|
*/
|
|
@@ -10915,7 +11039,7 @@ IDBFactory.prototype.open = function (name /* , version */) {
|
|
|
10915
11039
|
if ((useMemoryDatabase || useDatabaseCache) && Object.hasOwn(websqlDBCache, name) && Object.hasOwn(websqlDBCache[name], version)) {
|
|
10916
11040
|
db = websqlDBCache[name][version];
|
|
10917
11041
|
} else {
|
|
10918
|
-
db = /** @type {DatabaseFull} */me.__openDatabase(useMemoryDatabase ? CFG.memoryDatabase :
|
|
11042
|
+
db = /** @type {DatabaseFull} */me.__openDatabase(useMemoryDatabase ? CFG.memoryDatabase : joinPath(CFG.databaseBasePath || '', escapedDatabaseName), '1', name, CFG.DEFAULT_DB_SIZE);
|
|
10919
11043
|
if (useDatabaseCache) {
|
|
10920
11044
|
if (!Object.hasOwn(websqlDBCache, name)) {
|
|
10921
11045
|
websqlDBCache[name] = {};
|
|
@@ -11430,7 +11554,10 @@ const cursorDirections = ['next', 'prev', 'nextunique', 'prevunique'];
|
|
|
11430
11554
|
* },
|
|
11431
11555
|
* __count: boolean,
|
|
11432
11556
|
* __prefetchedIndex: Integer,
|
|
11433
|
-
* __prefetchedData: null|
|
|
11557
|
+
* __prefetchedData: null|{
|
|
11558
|
+
* length: number;
|
|
11559
|
+
* item(index: number): any;
|
|
11560
|
+
* }|{
|
|
11434
11561
|
* data: RowItemNonNull[],
|
|
11435
11562
|
* length: Integer,
|
|
11436
11563
|
* item: (index: Integer) => RowItemNonNull
|