@telemetryos/sdk 1.16.1 → 1.17.1
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/CHANGELOG.md +19 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +285 -284
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const Me = "1.
|
|
1
|
+
const Me = "1.17.1", Le = {
|
|
2
2
|
version: Me
|
|
3
3
|
};
|
|
4
4
|
class He {
|
|
@@ -195,7 +195,7 @@ class Ve {
|
|
|
195
195
|
});
|
|
196
196
|
}
|
|
197
197
|
}
|
|
198
|
-
var
|
|
198
|
+
var w;
|
|
199
199
|
(function(a) {
|
|
200
200
|
a.assertEqual = (n) => {
|
|
201
201
|
};
|
|
@@ -231,7 +231,7 @@ var b;
|
|
|
231
231
|
return n.map((i) => typeof i == "string" ? `'${i}'` : i).join(r);
|
|
232
232
|
}
|
|
233
233
|
a.joinValues = s, a.jsonStringifyReplacer = (n, r) => typeof r == "bigint" ? r.toString() : r;
|
|
234
|
-
})(
|
|
234
|
+
})(w || (w = {}));
|
|
235
235
|
var ye;
|
|
236
236
|
(function(a) {
|
|
237
237
|
a.mergeShapes = (e, t) => ({
|
|
@@ -240,7 +240,7 @@ var ye;
|
|
|
240
240
|
// second overwrites first
|
|
241
241
|
});
|
|
242
242
|
})(ye || (ye = {}));
|
|
243
|
-
const h =
|
|
243
|
+
const h = w.arrayToEnum([
|
|
244
244
|
"string",
|
|
245
245
|
"nan",
|
|
246
246
|
"number",
|
|
@@ -261,7 +261,7 @@ const h = b.arrayToEnum([
|
|
|
261
261
|
"never",
|
|
262
262
|
"map",
|
|
263
263
|
"set"
|
|
264
|
-
]),
|
|
264
|
+
]), A = (a) => {
|
|
265
265
|
switch (typeof a) {
|
|
266
266
|
case "undefined":
|
|
267
267
|
return h.undefined;
|
|
@@ -282,7 +282,7 @@ const h = b.arrayToEnum([
|
|
|
282
282
|
default:
|
|
283
283
|
return h.unknown;
|
|
284
284
|
}
|
|
285
|
-
}, d =
|
|
285
|
+
}, d = w.arrayToEnum([
|
|
286
286
|
"invalid_type",
|
|
287
287
|
"invalid_literal",
|
|
288
288
|
"custom",
|
|
@@ -300,7 +300,7 @@ const h = b.arrayToEnum([
|
|
|
300
300
|
"not_multiple_of",
|
|
301
301
|
"not_finite"
|
|
302
302
|
]);
|
|
303
|
-
class
|
|
303
|
+
class Z extends Error {
|
|
304
304
|
get errors() {
|
|
305
305
|
return this.issues;
|
|
306
306
|
}
|
|
@@ -337,14 +337,14 @@ class N extends Error {
|
|
|
337
337
|
return n(this), s;
|
|
338
338
|
}
|
|
339
339
|
static assert(e) {
|
|
340
|
-
if (!(e instanceof
|
|
340
|
+
if (!(e instanceof Z))
|
|
341
341
|
throw new Error(`Not a ZodError: ${e}`);
|
|
342
342
|
}
|
|
343
343
|
toString() {
|
|
344
344
|
return this.message;
|
|
345
345
|
}
|
|
346
346
|
get message() {
|
|
347
|
-
return JSON.stringify(this.issues,
|
|
347
|
+
return JSON.stringify(this.issues, w.jsonStringifyReplacer, 2);
|
|
348
348
|
}
|
|
349
349
|
get isEmpty() {
|
|
350
350
|
return this.issues.length === 0;
|
|
@@ -363,7 +363,7 @@ class N extends Error {
|
|
|
363
363
|
return this.flatten();
|
|
364
364
|
}
|
|
365
365
|
}
|
|
366
|
-
|
|
366
|
+
Z.create = (a) => new Z(a);
|
|
367
367
|
const de = (a, e) => {
|
|
368
368
|
let t;
|
|
369
369
|
switch (a.code) {
|
|
@@ -371,19 +371,19 @@ const de = (a, e) => {
|
|
|
371
371
|
a.received === h.undefined ? t = "Required" : t = `Expected ${a.expected}, received ${a.received}`;
|
|
372
372
|
break;
|
|
373
373
|
case d.invalid_literal:
|
|
374
|
-
t = `Invalid literal value, expected ${JSON.stringify(a.expected,
|
|
374
|
+
t = `Invalid literal value, expected ${JSON.stringify(a.expected, w.jsonStringifyReplacer)}`;
|
|
375
375
|
break;
|
|
376
376
|
case d.unrecognized_keys:
|
|
377
|
-
t = `Unrecognized key(s) in object: ${
|
|
377
|
+
t = `Unrecognized key(s) in object: ${w.joinValues(a.keys, ", ")}`;
|
|
378
378
|
break;
|
|
379
379
|
case d.invalid_union:
|
|
380
380
|
t = "Invalid input";
|
|
381
381
|
break;
|
|
382
382
|
case d.invalid_union_discriminator:
|
|
383
|
-
t = `Invalid discriminator value. Expected ${
|
|
383
|
+
t = `Invalid discriminator value. Expected ${w.joinValues(a.options)}`;
|
|
384
384
|
break;
|
|
385
385
|
case d.invalid_enum_value:
|
|
386
|
-
t = `Invalid enum value. Expected ${
|
|
386
|
+
t = `Invalid enum value. Expected ${w.joinValues(a.options)}, received '${a.received}'`;
|
|
387
387
|
break;
|
|
388
388
|
case d.invalid_arguments:
|
|
389
389
|
t = "Invalid function arguments";
|
|
@@ -395,7 +395,7 @@ const de = (a, e) => {
|
|
|
395
395
|
t = "Invalid date";
|
|
396
396
|
break;
|
|
397
397
|
case d.invalid_string:
|
|
398
|
-
typeof a.validation == "object" ? "includes" in a.validation ? (t = `Invalid input: must include "${a.validation.includes}"`, typeof a.validation.position == "number" && (t = `${t} at one or more positions greater than or equal to ${a.validation.position}`)) : "startsWith" in a.validation ? t = `Invalid input: must start with "${a.validation.startsWith}"` : "endsWith" in a.validation ? t = `Invalid input: must end with "${a.validation.endsWith}"` :
|
|
398
|
+
typeof a.validation == "object" ? "includes" in a.validation ? (t = `Invalid input: must include "${a.validation.includes}"`, typeof a.validation.position == "number" && (t = `${t} at one or more positions greater than or equal to ${a.validation.position}`)) : "startsWith" in a.validation ? t = `Invalid input: must start with "${a.validation.startsWith}"` : "endsWith" in a.validation ? t = `Invalid input: must end with "${a.validation.endsWith}"` : w.assertNever(a.validation) : a.validation !== "regex" ? t = `Invalid ${a.validation}` : t = "Invalid";
|
|
399
399
|
break;
|
|
400
400
|
case d.too_small:
|
|
401
401
|
a.type === "array" ? t = `Array must contain ${a.exact ? "exactly" : a.inclusive ? "at least" : "more than"} ${a.minimum} element(s)` : a.type === "string" ? t = `String must contain ${a.exact ? "exactly" : a.inclusive ? "at least" : "over"} ${a.minimum} character(s)` : a.type === "number" ? t = `Number must be ${a.exact ? "exactly equal to " : a.inclusive ? "greater than or equal to " : "greater than "}${a.minimum}` : a.type === "bigint" ? t = `Number must be ${a.exact ? "exactly equal to " : a.inclusive ? "greater than or equal to " : "greater than "}${a.minimum}` : a.type === "date" ? t = `Date must be ${a.exact ? "exactly equal to " : a.inclusive ? "greater than or equal to " : "greater than "}${new Date(Number(a.minimum))}` : t = "Invalid input";
|
|
@@ -416,7 +416,7 @@ const de = (a, e) => {
|
|
|
416
416
|
t = "Number must be finite";
|
|
417
417
|
break;
|
|
418
418
|
default:
|
|
419
|
-
t = e.defaultError,
|
|
419
|
+
t = e.defaultError, w.assertNever(a);
|
|
420
420
|
}
|
|
421
421
|
return { message: t };
|
|
422
422
|
};
|
|
@@ -463,7 +463,7 @@ function u(a, e) {
|
|
|
463
463
|
});
|
|
464
464
|
a.common.issues.push(s);
|
|
465
465
|
}
|
|
466
|
-
class
|
|
466
|
+
class T {
|
|
467
467
|
constructor() {
|
|
468
468
|
this.value = "valid";
|
|
469
469
|
}
|
|
@@ -491,7 +491,7 @@ class C {
|
|
|
491
491
|
value: i
|
|
492
492
|
});
|
|
493
493
|
}
|
|
494
|
-
return
|
|
494
|
+
return T.mergeObjectSync(e, s);
|
|
495
495
|
}
|
|
496
496
|
static mergeObjectSync(e, t) {
|
|
497
497
|
const s = {};
|
|
@@ -506,12 +506,12 @@ class C {
|
|
|
506
506
|
}
|
|
507
507
|
const g = Object.freeze({
|
|
508
508
|
status: "aborted"
|
|
509
|
-
}), ue = (a) => ({ status: "dirty", value: a }),
|
|
509
|
+
}), ue = (a) => ({ status: "dirty", value: a }), C = (a) => ({ status: "valid", value: a }), ve = (a) => a.status === "aborted", be = (a) => a.status === "dirty", L = (a) => a.status === "valid", te = (a) => typeof Promise < "u" && a instanceof Promise;
|
|
510
510
|
var p;
|
|
511
511
|
(function(a) {
|
|
512
512
|
a.errToObj = (e) => typeof e == "string" ? { message: e } : e || {}, a.toString = (e) => typeof e == "string" ? e : e == null ? void 0 : e.message;
|
|
513
513
|
})(p || (p = {}));
|
|
514
|
-
class
|
|
514
|
+
class j {
|
|
515
515
|
constructor(e, t, s, n) {
|
|
516
516
|
this._cachedPath = [], this.parent = e, this.data = t, this._path = s, this._key = n;
|
|
517
517
|
}
|
|
@@ -529,7 +529,7 @@ const we = (a, e) => {
|
|
|
529
529
|
get error() {
|
|
530
530
|
if (this._error)
|
|
531
531
|
return this._error;
|
|
532
|
-
const t = new
|
|
532
|
+
const t = new Z(a.common.issues);
|
|
533
533
|
return this._error = t, this._error;
|
|
534
534
|
}
|
|
535
535
|
};
|
|
@@ -545,18 +545,18 @@ function y(a) {
|
|
|
545
545
|
return r.code === "invalid_enum_value" ? { message: o ?? i.defaultError } : typeof i.data > "u" ? { message: o ?? s ?? i.defaultError } : r.code !== "invalid_type" ? { message: i.defaultError } : { message: o ?? t ?? i.defaultError };
|
|
546
546
|
}, description: n };
|
|
547
547
|
}
|
|
548
|
-
class
|
|
548
|
+
class b {
|
|
549
549
|
get description() {
|
|
550
550
|
return this._def.description;
|
|
551
551
|
}
|
|
552
552
|
_getType(e) {
|
|
553
|
-
return
|
|
553
|
+
return A(e.data);
|
|
554
554
|
}
|
|
555
555
|
_getOrReturnCtx(e, t) {
|
|
556
556
|
return t || {
|
|
557
557
|
common: e.parent.common,
|
|
558
558
|
data: e.data,
|
|
559
|
-
parsedType:
|
|
559
|
+
parsedType: A(e.data),
|
|
560
560
|
schemaErrorMap: this._def.errorMap,
|
|
561
561
|
path: e.path,
|
|
562
562
|
parent: e.parent
|
|
@@ -564,11 +564,11 @@ class v {
|
|
|
564
564
|
}
|
|
565
565
|
_processInputParams(e) {
|
|
566
566
|
return {
|
|
567
|
-
status: new
|
|
567
|
+
status: new T(),
|
|
568
568
|
ctx: {
|
|
569
569
|
common: e.parent.common,
|
|
570
570
|
data: e.data,
|
|
571
|
-
parsedType:
|
|
571
|
+
parsedType: A(e.data),
|
|
572
572
|
schemaErrorMap: this._def.errorMap,
|
|
573
573
|
path: e.path,
|
|
574
574
|
parent: e.parent
|
|
@@ -602,7 +602,7 @@ class v {
|
|
|
602
602
|
schemaErrorMap: this._def.errorMap,
|
|
603
603
|
parent: null,
|
|
604
604
|
data: e,
|
|
605
|
-
parsedType:
|
|
605
|
+
parsedType: A(e)
|
|
606
606
|
}, n = this._parseSync({ data: e, path: s.path, parent: s });
|
|
607
607
|
return we(s, n);
|
|
608
608
|
}
|
|
@@ -617,7 +617,7 @@ class v {
|
|
|
617
617
|
schemaErrorMap: this._def.errorMap,
|
|
618
618
|
parent: null,
|
|
619
619
|
data: e,
|
|
620
|
-
parsedType:
|
|
620
|
+
parsedType: A(e)
|
|
621
621
|
};
|
|
622
622
|
if (!this["~standard"].async)
|
|
623
623
|
try {
|
|
@@ -656,7 +656,7 @@ class v {
|
|
|
656
656
|
schemaErrorMap: this._def.errorMap,
|
|
657
657
|
parent: null,
|
|
658
658
|
data: e,
|
|
659
|
-
parsedType:
|
|
659
|
+
parsedType: A(e)
|
|
660
660
|
}, n = this._parse({ data: e, path: s.path, parent: s }), r = await (te(n) ? n : Promise.resolve(n));
|
|
661
661
|
return we(s, r);
|
|
662
662
|
}
|
|
@@ -691,7 +691,7 @@ class v {
|
|
|
691
691
|
};
|
|
692
692
|
}
|
|
693
693
|
optional() {
|
|
694
|
-
return
|
|
694
|
+
return $.create(this, this._def);
|
|
695
695
|
}
|
|
696
696
|
nullable() {
|
|
697
697
|
return V.create(this, this._def);
|
|
@@ -800,7 +800,7 @@ function ht(a, e) {
|
|
|
800
800
|
function pt(a, e) {
|
|
801
801
|
return !!((e === "v4" || !e) && nt.test(a) || (e === "v6" || !e) && rt.test(a));
|
|
802
802
|
}
|
|
803
|
-
class
|
|
803
|
+
class E extends b {
|
|
804
804
|
_parse(e) {
|
|
805
805
|
if (this._def.coerce && (e.data = String(e.data)), this._getType(e) !== h.string) {
|
|
806
806
|
const n = this._getOrReturnCtx(e);
|
|
@@ -810,7 +810,7 @@ class A extends v {
|
|
|
810
810
|
received: n.parsedType
|
|
811
811
|
}), g;
|
|
812
812
|
}
|
|
813
|
-
const t = new
|
|
813
|
+
const t = new T();
|
|
814
814
|
let s;
|
|
815
815
|
for (const n of this._def.checks)
|
|
816
816
|
if (n.kind === "min")
|
|
@@ -952,7 +952,7 @@ class A extends v {
|
|
|
952
952
|
validation: "base64url",
|
|
953
953
|
code: d.invalid_string,
|
|
954
954
|
message: n.message
|
|
955
|
-
}), t.dirty()) :
|
|
955
|
+
}), t.dirty()) : w.assertNever(n);
|
|
956
956
|
return { status: t.value, value: e.data };
|
|
957
957
|
}
|
|
958
958
|
_regex(e, t, s) {
|
|
@@ -963,7 +963,7 @@ class A extends v {
|
|
|
963
963
|
});
|
|
964
964
|
}
|
|
965
965
|
_addCheck(e) {
|
|
966
|
-
return new
|
|
966
|
+
return new E({
|
|
967
967
|
...this._def,
|
|
968
968
|
checks: [...this._def.checks, e]
|
|
969
969
|
});
|
|
@@ -1099,19 +1099,19 @@ class A extends v {
|
|
|
1099
1099
|
return this.min(1, p.errToObj(e));
|
|
1100
1100
|
}
|
|
1101
1101
|
trim() {
|
|
1102
|
-
return new
|
|
1102
|
+
return new E({
|
|
1103
1103
|
...this._def,
|
|
1104
1104
|
checks: [...this._def.checks, { kind: "trim" }]
|
|
1105
1105
|
});
|
|
1106
1106
|
}
|
|
1107
1107
|
toLowerCase() {
|
|
1108
|
-
return new
|
|
1108
|
+
return new E({
|
|
1109
1109
|
...this._def,
|
|
1110
1110
|
checks: [...this._def.checks, { kind: "toLowerCase" }]
|
|
1111
1111
|
});
|
|
1112
1112
|
}
|
|
1113
1113
|
toUpperCase() {
|
|
1114
|
-
return new
|
|
1114
|
+
return new E({
|
|
1115
1115
|
...this._def,
|
|
1116
1116
|
checks: [...this._def.checks, { kind: "toUpperCase" }]
|
|
1117
1117
|
});
|
|
@@ -1177,7 +1177,7 @@ class A extends v {
|
|
|
1177
1177
|
return e;
|
|
1178
1178
|
}
|
|
1179
1179
|
}
|
|
1180
|
-
|
|
1180
|
+
E.create = (a) => new E({
|
|
1181
1181
|
checks: [],
|
|
1182
1182
|
typeName: _.ZodString,
|
|
1183
1183
|
coerce: (a == null ? void 0 : a.coerce) ?? !1,
|
|
@@ -1187,7 +1187,7 @@ function ft(a, e) {
|
|
|
1187
1187
|
const t = (a.toString().split(".")[1] || "").length, s = (e.toString().split(".")[1] || "").length, n = t > s ? t : s, r = Number.parseInt(a.toFixed(n).replace(".", "")), i = Number.parseInt(e.toFixed(n).replace(".", ""));
|
|
1188
1188
|
return r % i / 10 ** n;
|
|
1189
1189
|
}
|
|
1190
|
-
class W extends
|
|
1190
|
+
class W extends b {
|
|
1191
1191
|
constructor() {
|
|
1192
1192
|
super(...arguments), this.min = this.gte, this.max = this.lte, this.step = this.multipleOf;
|
|
1193
1193
|
}
|
|
@@ -1201,9 +1201,9 @@ class W extends v {
|
|
|
1201
1201
|
}), g;
|
|
1202
1202
|
}
|
|
1203
1203
|
let t;
|
|
1204
|
-
const s = new
|
|
1204
|
+
const s = new T();
|
|
1205
1205
|
for (const n of this._def.checks)
|
|
1206
|
-
n.kind === "int" ?
|
|
1206
|
+
n.kind === "int" ? w.isInteger(e.data) || (t = this._getOrReturnCtx(e, t), u(t, {
|
|
1207
1207
|
code: d.invalid_type,
|
|
1208
1208
|
expected: "integer",
|
|
1209
1209
|
received: "float",
|
|
@@ -1229,7 +1229,7 @@ class W extends v {
|
|
|
1229
1229
|
}), s.dirty()) : n.kind === "finite" ? Number.isFinite(e.data) || (t = this._getOrReturnCtx(e, t), u(t, {
|
|
1230
1230
|
code: d.not_finite,
|
|
1231
1231
|
message: n.message
|
|
1232
|
-
}), s.dirty()) :
|
|
1232
|
+
}), s.dirty()) : w.assertNever(n);
|
|
1233
1233
|
return { status: s.value, value: e.data };
|
|
1234
1234
|
}
|
|
1235
1235
|
gte(e, t) {
|
|
@@ -1341,7 +1341,7 @@ class W extends v {
|
|
|
1341
1341
|
return e;
|
|
1342
1342
|
}
|
|
1343
1343
|
get isInt() {
|
|
1344
|
-
return !!this._def.checks.find((e) => e.kind === "int" || e.kind === "multipleOf" &&
|
|
1344
|
+
return !!this._def.checks.find((e) => e.kind === "int" || e.kind === "multipleOf" && w.isInteger(e.value));
|
|
1345
1345
|
}
|
|
1346
1346
|
get isFinite() {
|
|
1347
1347
|
let e = null, t = null;
|
|
@@ -1359,7 +1359,7 @@ W.create = (a) => new W({
|
|
|
1359
1359
|
coerce: (a == null ? void 0 : a.coerce) || !1,
|
|
1360
1360
|
...y(a)
|
|
1361
1361
|
});
|
|
1362
|
-
class J extends
|
|
1362
|
+
class J extends b {
|
|
1363
1363
|
constructor() {
|
|
1364
1364
|
super(...arguments), this.min = this.gte, this.max = this.lte;
|
|
1365
1365
|
}
|
|
@@ -1373,7 +1373,7 @@ class J extends v {
|
|
|
1373
1373
|
if (this._getType(e) !== h.bigint)
|
|
1374
1374
|
return this._getInvalidInput(e);
|
|
1375
1375
|
let t;
|
|
1376
|
-
const s = new
|
|
1376
|
+
const s = new T();
|
|
1377
1377
|
for (const n of this._def.checks)
|
|
1378
1378
|
n.kind === "min" ? (n.inclusive ? e.data < n.value : e.data <= n.value) && (t = this._getOrReturnCtx(e, t), u(t, {
|
|
1379
1379
|
code: d.too_small,
|
|
@@ -1391,7 +1391,7 @@ class J extends v {
|
|
|
1391
1391
|
code: d.not_multiple_of,
|
|
1392
1392
|
multipleOf: n.value,
|
|
1393
1393
|
message: n.message
|
|
1394
|
-
}), s.dirty()) :
|
|
1394
|
+
}), s.dirty()) : w.assertNever(n);
|
|
1395
1395
|
return { status: s.value, value: e.data };
|
|
1396
1396
|
}
|
|
1397
1397
|
_getInvalidInput(e) {
|
|
@@ -1492,7 +1492,7 @@ J.create = (a) => new J({
|
|
|
1492
1492
|
coerce: (a == null ? void 0 : a.coerce) ?? !1,
|
|
1493
1493
|
...y(a)
|
|
1494
1494
|
});
|
|
1495
|
-
class ke extends
|
|
1495
|
+
class ke extends b {
|
|
1496
1496
|
_parse(e) {
|
|
1497
1497
|
if (this._def.coerce && (e.data = !!e.data), this._getType(e) !== h.boolean) {
|
|
1498
1498
|
const t = this._getOrReturnCtx(e);
|
|
@@ -1502,7 +1502,7 @@ class ke extends v {
|
|
|
1502
1502
|
received: t.parsedType
|
|
1503
1503
|
}), g;
|
|
1504
1504
|
}
|
|
1505
|
-
return
|
|
1505
|
+
return C(e.data);
|
|
1506
1506
|
}
|
|
1507
1507
|
}
|
|
1508
1508
|
ke.create = (a) => new ke({
|
|
@@ -1510,7 +1510,7 @@ ke.create = (a) => new ke({
|
|
|
1510
1510
|
coerce: (a == null ? void 0 : a.coerce) || !1,
|
|
1511
1511
|
...y(a)
|
|
1512
1512
|
});
|
|
1513
|
-
class se extends
|
|
1513
|
+
class se extends b {
|
|
1514
1514
|
_parse(e) {
|
|
1515
1515
|
if (this._def.coerce && (e.data = new Date(e.data)), this._getType(e) !== h.date) {
|
|
1516
1516
|
const n = this._getOrReturnCtx(e);
|
|
@@ -1526,7 +1526,7 @@ class se extends v {
|
|
|
1526
1526
|
code: d.invalid_date
|
|
1527
1527
|
}), g;
|
|
1528
1528
|
}
|
|
1529
|
-
const t = new
|
|
1529
|
+
const t = new T();
|
|
1530
1530
|
let s;
|
|
1531
1531
|
for (const n of this._def.checks)
|
|
1532
1532
|
n.kind === "min" ? e.data.getTime() < n.value && (s = this._getOrReturnCtx(e, s), u(s, {
|
|
@@ -1543,7 +1543,7 @@ class se extends v {
|
|
|
1543
1543
|
exact: !1,
|
|
1544
1544
|
maximum: n.value,
|
|
1545
1545
|
type: "date"
|
|
1546
|
-
}), t.dirty()) :
|
|
1546
|
+
}), t.dirty()) : w.assertNever(n);
|
|
1547
1547
|
return {
|
|
1548
1548
|
status: t.value,
|
|
1549
1549
|
value: new Date(e.data.getTime())
|
|
@@ -1588,7 +1588,7 @@ se.create = (a) => new se({
|
|
|
1588
1588
|
typeName: _.ZodDate,
|
|
1589
1589
|
...y(a)
|
|
1590
1590
|
});
|
|
1591
|
-
class xe extends
|
|
1591
|
+
class xe extends b {
|
|
1592
1592
|
_parse(e) {
|
|
1593
1593
|
if (this._getType(e) !== h.symbol) {
|
|
1594
1594
|
const t = this._getOrReturnCtx(e);
|
|
@@ -1598,14 +1598,14 @@ class xe extends v {
|
|
|
1598
1598
|
received: t.parsedType
|
|
1599
1599
|
}), g;
|
|
1600
1600
|
}
|
|
1601
|
-
return
|
|
1601
|
+
return C(e.data);
|
|
1602
1602
|
}
|
|
1603
1603
|
}
|
|
1604
1604
|
xe.create = (a) => new xe({
|
|
1605
1605
|
typeName: _.ZodSymbol,
|
|
1606
1606
|
...y(a)
|
|
1607
1607
|
});
|
|
1608
|
-
class Se extends
|
|
1608
|
+
class Se extends b {
|
|
1609
1609
|
_parse(e) {
|
|
1610
1610
|
if (this._getType(e) !== h.undefined) {
|
|
1611
1611
|
const t = this._getOrReturnCtx(e);
|
|
@@ -1615,14 +1615,14 @@ class Se extends v {
|
|
|
1615
1615
|
received: t.parsedType
|
|
1616
1616
|
}), g;
|
|
1617
1617
|
}
|
|
1618
|
-
return
|
|
1618
|
+
return C(e.data);
|
|
1619
1619
|
}
|
|
1620
1620
|
}
|
|
1621
1621
|
Se.create = (a) => new Se({
|
|
1622
1622
|
typeName: _.ZodUndefined,
|
|
1623
1623
|
...y(a)
|
|
1624
1624
|
});
|
|
1625
|
-
class
|
|
1625
|
+
class Te extends b {
|
|
1626
1626
|
_parse(e) {
|
|
1627
1627
|
if (this._getType(e) !== h.null) {
|
|
1628
1628
|
const t = this._getOrReturnCtx(e);
|
|
@@ -1632,38 +1632,38 @@ class Ce extends v {
|
|
|
1632
1632
|
received: t.parsedType
|
|
1633
1633
|
}), g;
|
|
1634
1634
|
}
|
|
1635
|
-
return
|
|
1635
|
+
return C(e.data);
|
|
1636
1636
|
}
|
|
1637
1637
|
}
|
|
1638
|
-
|
|
1638
|
+
Te.create = (a) => new Te({
|
|
1639
1639
|
typeName: _.ZodNull,
|
|
1640
1640
|
...y(a)
|
|
1641
1641
|
});
|
|
1642
|
-
class le extends
|
|
1642
|
+
class le extends b {
|
|
1643
1643
|
constructor() {
|
|
1644
1644
|
super(...arguments), this._any = !0;
|
|
1645
1645
|
}
|
|
1646
1646
|
_parse(e) {
|
|
1647
|
-
return
|
|
1647
|
+
return C(e.data);
|
|
1648
1648
|
}
|
|
1649
1649
|
}
|
|
1650
1650
|
le.create = (a) => new le({
|
|
1651
1651
|
typeName: _.ZodAny,
|
|
1652
1652
|
...y(a)
|
|
1653
1653
|
});
|
|
1654
|
-
class
|
|
1654
|
+
class Ce extends b {
|
|
1655
1655
|
constructor() {
|
|
1656
1656
|
super(...arguments), this._unknown = !0;
|
|
1657
1657
|
}
|
|
1658
1658
|
_parse(e) {
|
|
1659
|
-
return
|
|
1659
|
+
return C(e.data);
|
|
1660
1660
|
}
|
|
1661
1661
|
}
|
|
1662
|
-
|
|
1662
|
+
Ce.create = (a) => new Ce({
|
|
1663
1663
|
typeName: _.ZodUnknown,
|
|
1664
1664
|
...y(a)
|
|
1665
1665
|
});
|
|
1666
|
-
class
|
|
1666
|
+
class P extends b {
|
|
1667
1667
|
_parse(e) {
|
|
1668
1668
|
const t = this._getOrReturnCtx(e);
|
|
1669
1669
|
return u(t, {
|
|
@@ -1673,11 +1673,11 @@ class j extends v {
|
|
|
1673
1673
|
}), g;
|
|
1674
1674
|
}
|
|
1675
1675
|
}
|
|
1676
|
-
|
|
1676
|
+
P.create = (a) => new P({
|
|
1677
1677
|
typeName: _.ZodNever,
|
|
1678
1678
|
...y(a)
|
|
1679
1679
|
});
|
|
1680
|
-
class Ie extends
|
|
1680
|
+
class Ie extends b {
|
|
1681
1681
|
_parse(e) {
|
|
1682
1682
|
if (this._getType(e) !== h.undefined) {
|
|
1683
1683
|
const t = this._getOrReturnCtx(e);
|
|
@@ -1687,14 +1687,14 @@ class Ie extends v {
|
|
|
1687
1687
|
received: t.parsedType
|
|
1688
1688
|
}), g;
|
|
1689
1689
|
}
|
|
1690
|
-
return
|
|
1690
|
+
return C(e.data);
|
|
1691
1691
|
}
|
|
1692
1692
|
}
|
|
1693
1693
|
Ie.create = (a) => new Ie({
|
|
1694
1694
|
typeName: _.ZodVoid,
|
|
1695
1695
|
...y(a)
|
|
1696
1696
|
});
|
|
1697
|
-
class I extends
|
|
1697
|
+
class I extends b {
|
|
1698
1698
|
_parse(e) {
|
|
1699
1699
|
const { ctx: t, status: s } = this._processInputParams(e), n = this._def;
|
|
1700
1700
|
if (t.parsedType !== h.array)
|
|
@@ -1730,9 +1730,9 @@ class I extends v {
|
|
|
1730
1730
|
exact: !1,
|
|
1731
1731
|
message: n.maxLength.message
|
|
1732
1732
|
}), s.dirty()), t.common.async)
|
|
1733
|
-
return Promise.all([...t.data].map((i, o) => n.type._parseAsync(new
|
|
1734
|
-
const r = [...t.data].map((i, o) => n.type._parseSync(new
|
|
1735
|
-
return
|
|
1733
|
+
return Promise.all([...t.data].map((i, o) => n.type._parseAsync(new j(t, i, t.path, o)))).then((i) => T.mergeArray(s, i));
|
|
1734
|
+
const r = [...t.data].map((i, o) => n.type._parseSync(new j(t, i, t.path, o)));
|
|
1735
|
+
return T.mergeArray(s, r);
|
|
1736
1736
|
}
|
|
1737
1737
|
get element() {
|
|
1738
1738
|
return this._def.type;
|
|
@@ -1768,29 +1768,29 @@ I.create = (a, e) => new I({
|
|
|
1768
1768
|
...y(e)
|
|
1769
1769
|
});
|
|
1770
1770
|
function M(a) {
|
|
1771
|
-
if (a instanceof
|
|
1771
|
+
if (a instanceof x) {
|
|
1772
1772
|
const e = {};
|
|
1773
1773
|
for (const t in a.shape) {
|
|
1774
1774
|
const s = a.shape[t];
|
|
1775
|
-
e[t] =
|
|
1775
|
+
e[t] = $.create(M(s));
|
|
1776
1776
|
}
|
|
1777
|
-
return new
|
|
1777
|
+
return new x({
|
|
1778
1778
|
...a._def,
|
|
1779
1779
|
shape: () => e
|
|
1780
1780
|
});
|
|
1781
1781
|
} else return a instanceof I ? new I({
|
|
1782
1782
|
...a._def,
|
|
1783
1783
|
type: M(a.element)
|
|
1784
|
-
}) : a instanceof
|
|
1784
|
+
}) : a instanceof $ ? $.create(M(a.unwrap())) : a instanceof V ? V.create(M(a.unwrap())) : a instanceof q ? q.create(a.items.map((e) => M(e))) : a;
|
|
1785
1785
|
}
|
|
1786
|
-
class
|
|
1786
|
+
class x extends b {
|
|
1787
1787
|
constructor() {
|
|
1788
1788
|
super(...arguments), this._cached = null, this.nonstrict = this.passthrough, this.augment = this.extend;
|
|
1789
1789
|
}
|
|
1790
1790
|
_getCached() {
|
|
1791
1791
|
if (this._cached !== null)
|
|
1792
1792
|
return this._cached;
|
|
1793
|
-
const e = this._def.shape(), t =
|
|
1793
|
+
const e = this._def.shape(), t = w.objectKeys(e);
|
|
1794
1794
|
return this._cached = { shape: e, keys: t }, this._cached;
|
|
1795
1795
|
}
|
|
1796
1796
|
_parse(e) {
|
|
@@ -1803,19 +1803,19 @@ class k extends v {
|
|
|
1803
1803
|
}), g;
|
|
1804
1804
|
}
|
|
1805
1805
|
const { status: t, ctx: s } = this._processInputParams(e), { shape: n, keys: r } = this._getCached(), i = [];
|
|
1806
|
-
if (!(this._def.catchall instanceof
|
|
1806
|
+
if (!(this._def.catchall instanceof P && this._def.unknownKeys === "strip"))
|
|
1807
1807
|
for (const c in s.data)
|
|
1808
1808
|
r.includes(c) || i.push(c);
|
|
1809
1809
|
const o = [];
|
|
1810
1810
|
for (const c of r) {
|
|
1811
|
-
const l = n[c],
|
|
1811
|
+
const l = n[c], f = s.data[c];
|
|
1812
1812
|
o.push({
|
|
1813
1813
|
key: { status: "valid", value: c },
|
|
1814
|
-
value: l._parse(new
|
|
1814
|
+
value: l._parse(new j(s, f, s.path, c)),
|
|
1815
1815
|
alwaysSet: c in s.data
|
|
1816
1816
|
});
|
|
1817
1817
|
}
|
|
1818
|
-
if (this._def.catchall instanceof
|
|
1818
|
+
if (this._def.catchall instanceof P) {
|
|
1819
1819
|
const c = this._def.unknownKeys;
|
|
1820
1820
|
if (c === "passthrough")
|
|
1821
1821
|
for (const l of i)
|
|
@@ -1832,11 +1832,11 @@ class k extends v {
|
|
|
1832
1832
|
} else {
|
|
1833
1833
|
const c = this._def.catchall;
|
|
1834
1834
|
for (const l of i) {
|
|
1835
|
-
const
|
|
1835
|
+
const f = s.data[l];
|
|
1836
1836
|
o.push({
|
|
1837
1837
|
key: { status: "valid", value: l },
|
|
1838
1838
|
value: c._parse(
|
|
1839
|
-
new
|
|
1839
|
+
new j(s, f, s.path, l)
|
|
1840
1840
|
//, ctx.child(key), value, getParsedType(value)
|
|
1841
1841
|
),
|
|
1842
1842
|
alwaysSet: l in s.data
|
|
@@ -1846,21 +1846,21 @@ class k extends v {
|
|
|
1846
1846
|
return s.common.async ? Promise.resolve().then(async () => {
|
|
1847
1847
|
const c = [];
|
|
1848
1848
|
for (const l of o) {
|
|
1849
|
-
const
|
|
1849
|
+
const f = await l.key, v = await l.value;
|
|
1850
1850
|
c.push({
|
|
1851
|
-
key:
|
|
1852
|
-
value:
|
|
1851
|
+
key: f,
|
|
1852
|
+
value: v,
|
|
1853
1853
|
alwaysSet: l.alwaysSet
|
|
1854
1854
|
});
|
|
1855
1855
|
}
|
|
1856
1856
|
return c;
|
|
1857
|
-
}).then((c) =>
|
|
1857
|
+
}).then((c) => T.mergeObjectSync(t, c)) : T.mergeObjectSync(t, o);
|
|
1858
1858
|
}
|
|
1859
1859
|
get shape() {
|
|
1860
1860
|
return this._def.shape();
|
|
1861
1861
|
}
|
|
1862
1862
|
strict(e) {
|
|
1863
|
-
return p.errToObj, new
|
|
1863
|
+
return p.errToObj, new x({
|
|
1864
1864
|
...this._def,
|
|
1865
1865
|
unknownKeys: "strict",
|
|
1866
1866
|
...e !== void 0 ? {
|
|
@@ -1877,13 +1877,13 @@ class k extends v {
|
|
|
1877
1877
|
});
|
|
1878
1878
|
}
|
|
1879
1879
|
strip() {
|
|
1880
|
-
return new
|
|
1880
|
+
return new x({
|
|
1881
1881
|
...this._def,
|
|
1882
1882
|
unknownKeys: "strip"
|
|
1883
1883
|
});
|
|
1884
1884
|
}
|
|
1885
1885
|
passthrough() {
|
|
1886
|
-
return new
|
|
1886
|
+
return new x({
|
|
1887
1887
|
...this._def,
|
|
1888
1888
|
unknownKeys: "passthrough"
|
|
1889
1889
|
});
|
|
@@ -1906,7 +1906,7 @@ class k extends v {
|
|
|
1906
1906
|
// }) as any;
|
|
1907
1907
|
// };
|
|
1908
1908
|
extend(e) {
|
|
1909
|
-
return new
|
|
1909
|
+
return new x({
|
|
1910
1910
|
...this._def,
|
|
1911
1911
|
shape: () => ({
|
|
1912
1912
|
...this._def.shape(),
|
|
@@ -1920,7 +1920,7 @@ class k extends v {
|
|
|
1920
1920
|
* upgrade if you are experiencing issues.
|
|
1921
1921
|
*/
|
|
1922
1922
|
merge(e) {
|
|
1923
|
-
return new
|
|
1923
|
+
return new x({
|
|
1924
1924
|
unknownKeys: e._def.unknownKeys,
|
|
1925
1925
|
catchall: e._def.catchall,
|
|
1926
1926
|
shape: () => ({
|
|
@@ -1990,25 +1990,25 @@ class k extends v {
|
|
|
1990
1990
|
// return merged;
|
|
1991
1991
|
// }
|
|
1992
1992
|
catchall(e) {
|
|
1993
|
-
return new
|
|
1993
|
+
return new x({
|
|
1994
1994
|
...this._def,
|
|
1995
1995
|
catchall: e
|
|
1996
1996
|
});
|
|
1997
1997
|
}
|
|
1998
1998
|
pick(e) {
|
|
1999
1999
|
const t = {};
|
|
2000
|
-
for (const s of
|
|
2000
|
+
for (const s of w.objectKeys(e))
|
|
2001
2001
|
e[s] && this.shape[s] && (t[s] = this.shape[s]);
|
|
2002
|
-
return new
|
|
2002
|
+
return new x({
|
|
2003
2003
|
...this._def,
|
|
2004
2004
|
shape: () => t
|
|
2005
2005
|
});
|
|
2006
2006
|
}
|
|
2007
2007
|
omit(e) {
|
|
2008
2008
|
const t = {};
|
|
2009
|
-
for (const s of
|
|
2009
|
+
for (const s of w.objectKeys(this.shape))
|
|
2010
2010
|
e[s] || (t[s] = this.shape[s]);
|
|
2011
|
-
return new
|
|
2011
|
+
return new x({
|
|
2012
2012
|
...this._def,
|
|
2013
2013
|
shape: () => t
|
|
2014
2014
|
});
|
|
@@ -2021,57 +2021,57 @@ class k extends v {
|
|
|
2021
2021
|
}
|
|
2022
2022
|
partial(e) {
|
|
2023
2023
|
const t = {};
|
|
2024
|
-
for (const s of
|
|
2024
|
+
for (const s of w.objectKeys(this.shape)) {
|
|
2025
2025
|
const n = this.shape[s];
|
|
2026
2026
|
e && !e[s] ? t[s] = n : t[s] = n.optional();
|
|
2027
2027
|
}
|
|
2028
|
-
return new
|
|
2028
|
+
return new x({
|
|
2029
2029
|
...this._def,
|
|
2030
2030
|
shape: () => t
|
|
2031
2031
|
});
|
|
2032
2032
|
}
|
|
2033
2033
|
required(e) {
|
|
2034
2034
|
const t = {};
|
|
2035
|
-
for (const s of
|
|
2035
|
+
for (const s of w.objectKeys(this.shape))
|
|
2036
2036
|
if (e && !e[s])
|
|
2037
2037
|
t[s] = this.shape[s];
|
|
2038
2038
|
else {
|
|
2039
2039
|
let n = this.shape[s];
|
|
2040
|
-
for (; n instanceof
|
|
2040
|
+
for (; n instanceof $; )
|
|
2041
2041
|
n = n._def.innerType;
|
|
2042
2042
|
t[s] = n;
|
|
2043
2043
|
}
|
|
2044
|
-
return new
|
|
2044
|
+
return new x({
|
|
2045
2045
|
...this._def,
|
|
2046
2046
|
shape: () => t
|
|
2047
2047
|
});
|
|
2048
2048
|
}
|
|
2049
2049
|
keyof() {
|
|
2050
|
-
return je(
|
|
2050
|
+
return je(w.objectKeys(this.shape));
|
|
2051
2051
|
}
|
|
2052
2052
|
}
|
|
2053
|
-
|
|
2053
|
+
x.create = (a, e) => new x({
|
|
2054
2054
|
shape: () => a,
|
|
2055
2055
|
unknownKeys: "strip",
|
|
2056
|
-
catchall:
|
|
2056
|
+
catchall: P.create(),
|
|
2057
2057
|
typeName: _.ZodObject,
|
|
2058
2058
|
...y(e)
|
|
2059
2059
|
});
|
|
2060
|
-
|
|
2060
|
+
x.strictCreate = (a, e) => new x({
|
|
2061
2061
|
shape: () => a,
|
|
2062
2062
|
unknownKeys: "strict",
|
|
2063
|
-
catchall:
|
|
2063
|
+
catchall: P.create(),
|
|
2064
2064
|
typeName: _.ZodObject,
|
|
2065
2065
|
...y(e)
|
|
2066
2066
|
});
|
|
2067
|
-
|
|
2067
|
+
x.lazycreate = (a, e) => new x({
|
|
2068
2068
|
shape: a,
|
|
2069
2069
|
unknownKeys: "strip",
|
|
2070
|
-
catchall:
|
|
2070
|
+
catchall: P.create(),
|
|
2071
2071
|
typeName: _.ZodObject,
|
|
2072
2072
|
...y(e)
|
|
2073
2073
|
});
|
|
2074
|
-
class ne extends
|
|
2074
|
+
class ne extends b {
|
|
2075
2075
|
_parse(e) {
|
|
2076
2076
|
const { ctx: t } = this._processInputParams(e), s = this._def.options;
|
|
2077
2077
|
function n(r) {
|
|
@@ -2081,7 +2081,7 @@ class ne extends v {
|
|
|
2081
2081
|
for (const o of r)
|
|
2082
2082
|
if (o.result.status === "dirty")
|
|
2083
2083
|
return t.common.issues.push(...o.ctx.common.issues), o.result;
|
|
2084
|
-
const i = r.map((o) => new
|
|
2084
|
+
const i = r.map((o) => new Z(o.ctx.common.issues));
|
|
2085
2085
|
return u(t, {
|
|
2086
2086
|
code: d.invalid_union,
|
|
2087
2087
|
unionErrors: i
|
|
@@ -2117,18 +2117,18 @@ class ne extends v {
|
|
|
2117
2117
|
issues: []
|
|
2118
2118
|
},
|
|
2119
2119
|
parent: null
|
|
2120
|
-
},
|
|
2120
|
+
}, f = c._parseSync({
|
|
2121
2121
|
data: t.data,
|
|
2122
2122
|
path: t.path,
|
|
2123
2123
|
parent: l
|
|
2124
2124
|
});
|
|
2125
|
-
if (
|
|
2126
|
-
return
|
|
2127
|
-
|
|
2125
|
+
if (f.status === "valid")
|
|
2126
|
+
return f;
|
|
2127
|
+
f.status === "dirty" && !r && (r = { result: f, ctx: l }), l.common.issues.length && i.push(l.common.issues);
|
|
2128
2128
|
}
|
|
2129
2129
|
if (r)
|
|
2130
2130
|
return t.common.issues.push(...r.ctx.common.issues), r.result;
|
|
2131
|
-
const o = i.map((c) => new
|
|
2131
|
+
const o = i.map((c) => new Z(c));
|
|
2132
2132
|
return u(t, {
|
|
2133
2133
|
code: d.invalid_union,
|
|
2134
2134
|
unionErrors: o
|
|
@@ -2145,11 +2145,11 @@ ne.create = (a, e) => new ne({
|
|
|
2145
2145
|
...y(e)
|
|
2146
2146
|
});
|
|
2147
2147
|
function he(a, e) {
|
|
2148
|
-
const t =
|
|
2148
|
+
const t = A(a), s = A(e);
|
|
2149
2149
|
if (a === e)
|
|
2150
2150
|
return { valid: !0, data: a };
|
|
2151
2151
|
if (t === h.object && s === h.object) {
|
|
2152
|
-
const n =
|
|
2152
|
+
const n = w.objectKeys(e), r = w.objectKeys(a).filter((o) => n.indexOf(o) !== -1), i = { ...a, ...e };
|
|
2153
2153
|
for (const o of r) {
|
|
2154
2154
|
const c = he(a[o], e[o]);
|
|
2155
2155
|
if (!c.valid)
|
|
@@ -2170,7 +2170,7 @@ function he(a, e) {
|
|
|
2170
2170
|
return { valid: !0, data: n };
|
|
2171
2171
|
} else return t === h.date && s === h.date && +a == +e ? { valid: !0, data: a } : { valid: !1 };
|
|
2172
2172
|
}
|
|
2173
|
-
class ae extends
|
|
2173
|
+
class ae extends b {
|
|
2174
2174
|
_parse(e) {
|
|
2175
2175
|
const { status: t, ctx: s } = this._processInputParams(e), n = (r, i) => {
|
|
2176
2176
|
if (ve(r) || ve(i))
|
|
@@ -2208,7 +2208,7 @@ ae.create = (a, e, t) => new ae({
|
|
|
2208
2208
|
typeName: _.ZodIntersection,
|
|
2209
2209
|
...y(t)
|
|
2210
2210
|
});
|
|
2211
|
-
class q extends
|
|
2211
|
+
class q extends b {
|
|
2212
2212
|
_parse(e) {
|
|
2213
2213
|
const { status: t, ctx: s } = this._processInputParams(e);
|
|
2214
2214
|
if (s.parsedType !== h.array)
|
|
@@ -2234,9 +2234,9 @@ class q extends v {
|
|
|
2234
2234
|
}), t.dirty());
|
|
2235
2235
|
const n = [...s.data].map((r, i) => {
|
|
2236
2236
|
const o = this._def.items[i] || this._def.rest;
|
|
2237
|
-
return o ? o._parse(new
|
|
2237
|
+
return o ? o._parse(new j(s, r, s.path, i)) : null;
|
|
2238
2238
|
}).filter((r) => !!r);
|
|
2239
|
-
return s.common.async ? Promise.all(n).then((r) =>
|
|
2239
|
+
return s.common.async ? Promise.all(n).then((r) => T.mergeArray(t, r)) : T.mergeArray(t, n);
|
|
2240
2240
|
}
|
|
2241
2241
|
get items() {
|
|
2242
2242
|
return this._def.items;
|
|
@@ -2258,7 +2258,7 @@ q.create = (a, e) => {
|
|
|
2258
2258
|
...y(e)
|
|
2259
2259
|
});
|
|
2260
2260
|
};
|
|
2261
|
-
class Ne extends
|
|
2261
|
+
class Ne extends b {
|
|
2262
2262
|
get keySchema() {
|
|
2263
2263
|
return this._def.keyType;
|
|
2264
2264
|
}
|
|
@@ -2274,27 +2274,27 @@ class Ne extends v {
|
|
|
2274
2274
|
received: s.parsedType
|
|
2275
2275
|
}), g;
|
|
2276
2276
|
const n = this._def.keyType, r = this._def.valueType, i = [...s.data.entries()].map(([o, c], l) => ({
|
|
2277
|
-
key: n._parse(new
|
|
2278
|
-
value: r._parse(new
|
|
2277
|
+
key: n._parse(new j(s, o, s.path, [l, "key"])),
|
|
2278
|
+
value: r._parse(new j(s, c, s.path, [l, "value"]))
|
|
2279
2279
|
}));
|
|
2280
2280
|
if (s.common.async) {
|
|
2281
2281
|
const o = /* @__PURE__ */ new Map();
|
|
2282
2282
|
return Promise.resolve().then(async () => {
|
|
2283
2283
|
for (const c of i) {
|
|
2284
|
-
const l = await c.key,
|
|
2285
|
-
if (l.status === "aborted" ||
|
|
2284
|
+
const l = await c.key, f = await c.value;
|
|
2285
|
+
if (l.status === "aborted" || f.status === "aborted")
|
|
2286
2286
|
return g;
|
|
2287
|
-
(l.status === "dirty" ||
|
|
2287
|
+
(l.status === "dirty" || f.status === "dirty") && t.dirty(), o.set(l.value, f.value);
|
|
2288
2288
|
}
|
|
2289
2289
|
return { status: t.value, value: o };
|
|
2290
2290
|
});
|
|
2291
2291
|
} else {
|
|
2292
2292
|
const o = /* @__PURE__ */ new Map();
|
|
2293
2293
|
for (const c of i) {
|
|
2294
|
-
const l = c.key,
|
|
2295
|
-
if (l.status === "aborted" ||
|
|
2294
|
+
const l = c.key, f = c.value;
|
|
2295
|
+
if (l.status === "aborted" || f.status === "aborted")
|
|
2296
2296
|
return g;
|
|
2297
|
-
(l.status === "dirty" ||
|
|
2297
|
+
(l.status === "dirty" || f.status === "dirty") && t.dirty(), o.set(l.value, f.value);
|
|
2298
2298
|
}
|
|
2299
2299
|
return { status: t.value, value: o };
|
|
2300
2300
|
}
|
|
@@ -2306,7 +2306,7 @@ Ne.create = (a, e, t) => new Ne({
|
|
|
2306
2306
|
typeName: _.ZodMap,
|
|
2307
2307
|
...y(t)
|
|
2308
2308
|
});
|
|
2309
|
-
class Q extends
|
|
2309
|
+
class Q extends b {
|
|
2310
2310
|
_parse(e) {
|
|
2311
2311
|
const { status: t, ctx: s } = this._processInputParams(e);
|
|
2312
2312
|
if (s.parsedType !== h.set)
|
|
@@ -2334,14 +2334,14 @@ class Q extends v {
|
|
|
2334
2334
|
const r = this._def.valueType;
|
|
2335
2335
|
function i(c) {
|
|
2336
2336
|
const l = /* @__PURE__ */ new Set();
|
|
2337
|
-
for (const
|
|
2338
|
-
if (
|
|
2337
|
+
for (const f of c) {
|
|
2338
|
+
if (f.status === "aborted")
|
|
2339
2339
|
return g;
|
|
2340
|
-
|
|
2340
|
+
f.status === "dirty" && t.dirty(), l.add(f.value);
|
|
2341
2341
|
}
|
|
2342
2342
|
return { status: t.value, value: l };
|
|
2343
2343
|
}
|
|
2344
|
-
const o = [...s.data.values()].map((c, l) => r._parse(new
|
|
2344
|
+
const o = [...s.data.values()].map((c, l) => r._parse(new j(s, c, s.path, l)));
|
|
2345
2345
|
return s.common.async ? Promise.all(o).then((c) => i(c)) : i(o);
|
|
2346
2346
|
}
|
|
2347
2347
|
min(e, t) {
|
|
@@ -2370,7 +2370,7 @@ Q.create = (a, e) => new Q({
|
|
|
2370
2370
|
typeName: _.ZodSet,
|
|
2371
2371
|
...y(e)
|
|
2372
2372
|
});
|
|
2373
|
-
class Ze extends
|
|
2373
|
+
class Ze extends b {
|
|
2374
2374
|
get schema() {
|
|
2375
2375
|
return this._def.getter();
|
|
2376
2376
|
}
|
|
@@ -2384,7 +2384,7 @@ Ze.create = (a, e) => new Ze({
|
|
|
2384
2384
|
typeName: _.ZodLazy,
|
|
2385
2385
|
...y(e)
|
|
2386
2386
|
});
|
|
2387
|
-
class pe extends
|
|
2387
|
+
class pe extends b {
|
|
2388
2388
|
_parse(e) {
|
|
2389
2389
|
if (e.data !== this._def.value) {
|
|
2390
2390
|
const t = this._getOrReturnCtx(e);
|
|
@@ -2412,12 +2412,12 @@ function je(a, e) {
|
|
|
2412
2412
|
...y(e)
|
|
2413
2413
|
});
|
|
2414
2414
|
}
|
|
2415
|
-
class H extends
|
|
2415
|
+
class H extends b {
|
|
2416
2416
|
_parse(e) {
|
|
2417
2417
|
if (typeof e.data != "string") {
|
|
2418
2418
|
const t = this._getOrReturnCtx(e), s = this._def.values;
|
|
2419
2419
|
return u(t, {
|
|
2420
|
-
expected:
|
|
2420
|
+
expected: w.joinValues(s),
|
|
2421
2421
|
received: t.parsedType,
|
|
2422
2422
|
code: d.invalid_type
|
|
2423
2423
|
}), g;
|
|
@@ -2430,7 +2430,7 @@ class H extends v {
|
|
|
2430
2430
|
options: s
|
|
2431
2431
|
}), g;
|
|
2432
2432
|
}
|
|
2433
|
-
return
|
|
2433
|
+
return C(e.data);
|
|
2434
2434
|
}
|
|
2435
2435
|
get options() {
|
|
2436
2436
|
return this._def.values;
|
|
@@ -2467,26 +2467,26 @@ class H extends v {
|
|
|
2467
2467
|
}
|
|
2468
2468
|
}
|
|
2469
2469
|
H.create = je;
|
|
2470
|
-
class Oe extends
|
|
2470
|
+
class Oe extends b {
|
|
2471
2471
|
_parse(e) {
|
|
2472
|
-
const t =
|
|
2472
|
+
const t = w.getValidEnumValues(this._def.values), s = this._getOrReturnCtx(e);
|
|
2473
2473
|
if (s.parsedType !== h.string && s.parsedType !== h.number) {
|
|
2474
|
-
const n =
|
|
2474
|
+
const n = w.objectValues(t);
|
|
2475
2475
|
return u(s, {
|
|
2476
|
-
expected:
|
|
2476
|
+
expected: w.joinValues(n),
|
|
2477
2477
|
received: s.parsedType,
|
|
2478
2478
|
code: d.invalid_type
|
|
2479
2479
|
}), g;
|
|
2480
2480
|
}
|
|
2481
|
-
if (this._cache || (this._cache = new Set(
|
|
2482
|
-
const n =
|
|
2481
|
+
if (this._cache || (this._cache = new Set(w.getValidEnumValues(this._def.values))), !this._cache.has(e.data)) {
|
|
2482
|
+
const n = w.objectValues(t);
|
|
2483
2483
|
return u(s, {
|
|
2484
2484
|
received: s.data,
|
|
2485
2485
|
code: d.invalid_enum_value,
|
|
2486
2486
|
options: n
|
|
2487
2487
|
}), g;
|
|
2488
2488
|
}
|
|
2489
|
-
return
|
|
2489
|
+
return C(e.data);
|
|
2490
2490
|
}
|
|
2491
2491
|
get enum() {
|
|
2492
2492
|
return this._def.values;
|
|
@@ -2497,7 +2497,7 @@ Oe.create = (a, e) => new Oe({
|
|
|
2497
2497
|
typeName: _.ZodNativeEnum,
|
|
2498
2498
|
...y(e)
|
|
2499
2499
|
});
|
|
2500
|
-
class re extends
|
|
2500
|
+
class re extends b {
|
|
2501
2501
|
unwrap() {
|
|
2502
2502
|
return this._def.type;
|
|
2503
2503
|
}
|
|
@@ -2510,7 +2510,7 @@ class re extends v {
|
|
|
2510
2510
|
received: t.parsedType
|
|
2511
2511
|
}), g;
|
|
2512
2512
|
const s = t.parsedType === h.promise ? t.data : Promise.resolve(t.data);
|
|
2513
|
-
return
|
|
2513
|
+
return C(s.then((n) => this._def.type.parseAsync(n, {
|
|
2514
2514
|
path: t.path,
|
|
2515
2515
|
errorMap: t.common.contextualErrorMap
|
|
2516
2516
|
})));
|
|
@@ -2521,7 +2521,7 @@ re.create = (a, e) => new re({
|
|
|
2521
2521
|
typeName: _.ZodPromise,
|
|
2522
2522
|
...y(e)
|
|
2523
2523
|
});
|
|
2524
|
-
class D extends
|
|
2524
|
+
class D extends b {
|
|
2525
2525
|
innerType() {
|
|
2526
2526
|
return this._def.schema;
|
|
2527
2527
|
}
|
|
@@ -2598,7 +2598,7 @@ class D extends v {
|
|
|
2598
2598
|
status: t.value,
|
|
2599
2599
|
value: o
|
|
2600
2600
|
})) : g);
|
|
2601
|
-
|
|
2601
|
+
w.assertNever(n);
|
|
2602
2602
|
}
|
|
2603
2603
|
}
|
|
2604
2604
|
D.create = (a, e, t) => new D({
|
|
@@ -2613,22 +2613,22 @@ D.createWithPreprocess = (a, e, t) => new D({
|
|
|
2613
2613
|
typeName: _.ZodEffects,
|
|
2614
2614
|
...y(t)
|
|
2615
2615
|
});
|
|
2616
|
-
class
|
|
2616
|
+
class $ extends b {
|
|
2617
2617
|
_parse(e) {
|
|
2618
|
-
return this._getType(e) === h.undefined ?
|
|
2618
|
+
return this._getType(e) === h.undefined ? C(void 0) : this._def.innerType._parse(e);
|
|
2619
2619
|
}
|
|
2620
2620
|
unwrap() {
|
|
2621
2621
|
return this._def.innerType;
|
|
2622
2622
|
}
|
|
2623
2623
|
}
|
|
2624
|
-
|
|
2624
|
+
$.create = (a, e) => new $({
|
|
2625
2625
|
innerType: a,
|
|
2626
2626
|
typeName: _.ZodOptional,
|
|
2627
2627
|
...y(e)
|
|
2628
2628
|
});
|
|
2629
|
-
class V extends
|
|
2629
|
+
class V extends b {
|
|
2630
2630
|
_parse(e) {
|
|
2631
|
-
return this._getType(e) === h.null ?
|
|
2631
|
+
return this._getType(e) === h.null ? C(null) : this._def.innerType._parse(e);
|
|
2632
2632
|
}
|
|
2633
2633
|
unwrap() {
|
|
2634
2634
|
return this._def.innerType;
|
|
@@ -2639,7 +2639,7 @@ V.create = (a, e) => new V({
|
|
|
2639
2639
|
typeName: _.ZodNullable,
|
|
2640
2640
|
...y(e)
|
|
2641
2641
|
});
|
|
2642
|
-
class fe extends
|
|
2642
|
+
class fe extends b {
|
|
2643
2643
|
_parse(e) {
|
|
2644
2644
|
const { ctx: t } = this._processInputParams(e);
|
|
2645
2645
|
let s = t.data;
|
|
@@ -2659,7 +2659,7 @@ fe.create = (a, e) => new fe({
|
|
|
2659
2659
|
defaultValue: typeof e.default == "function" ? e.default : () => e.default,
|
|
2660
2660
|
...y(e)
|
|
2661
2661
|
});
|
|
2662
|
-
class me extends
|
|
2662
|
+
class me extends b {
|
|
2663
2663
|
_parse(e) {
|
|
2664
2664
|
const { ctx: t } = this._processInputParams(e), s = {
|
|
2665
2665
|
...t,
|
|
@@ -2678,7 +2678,7 @@ class me extends v {
|
|
|
2678
2678
|
status: "valid",
|
|
2679
2679
|
value: r.status === "valid" ? r.value : this._def.catchValue({
|
|
2680
2680
|
get error() {
|
|
2681
|
-
return new
|
|
2681
|
+
return new Z(s.common.issues);
|
|
2682
2682
|
},
|
|
2683
2683
|
input: s.data
|
|
2684
2684
|
})
|
|
@@ -2686,7 +2686,7 @@ class me extends v {
|
|
|
2686
2686
|
status: "valid",
|
|
2687
2687
|
value: n.status === "valid" ? n.value : this._def.catchValue({
|
|
2688
2688
|
get error() {
|
|
2689
|
-
return new
|
|
2689
|
+
return new Z(s.common.issues);
|
|
2690
2690
|
},
|
|
2691
2691
|
input: s.data
|
|
2692
2692
|
})
|
|
@@ -2702,7 +2702,7 @@ me.create = (a, e) => new me({
|
|
|
2702
2702
|
catchValue: typeof e.catch == "function" ? e.catch : () => e.catch,
|
|
2703
2703
|
...y(e)
|
|
2704
2704
|
});
|
|
2705
|
-
class Ae extends
|
|
2705
|
+
class Ae extends b {
|
|
2706
2706
|
_parse(e) {
|
|
2707
2707
|
if (this._getType(e) !== h.nan) {
|
|
2708
2708
|
const t = this._getOrReturnCtx(e);
|
|
@@ -2719,7 +2719,7 @@ Ae.create = (a) => new Ae({
|
|
|
2719
2719
|
typeName: _.ZodNaN,
|
|
2720
2720
|
...y(a)
|
|
2721
2721
|
});
|
|
2722
|
-
class mt extends
|
|
2722
|
+
class mt extends b {
|
|
2723
2723
|
_parse(e) {
|
|
2724
2724
|
const { ctx: t } = this._processInputParams(e), s = t.data;
|
|
2725
2725
|
return this._def.type._parse({
|
|
@@ -2732,7 +2732,7 @@ class mt extends v {
|
|
|
2732
2732
|
return this._def.type;
|
|
2733
2733
|
}
|
|
2734
2734
|
}
|
|
2735
|
-
class ge extends
|
|
2735
|
+
class ge extends b {
|
|
2736
2736
|
_parse(e) {
|
|
2737
2737
|
const { status: t, ctx: s } = this._processInputParams(e);
|
|
2738
2738
|
if (s.common.async)
|
|
@@ -2772,7 +2772,7 @@ class ge extends v {
|
|
|
2772
2772
|
});
|
|
2773
2773
|
}
|
|
2774
2774
|
}
|
|
2775
|
-
class _e extends
|
|
2775
|
+
class _e extends b {
|
|
2776
2776
|
_parse(e) {
|
|
2777
2777
|
const t = this._def.innerType._parse(e), s = (n) => (L(n) && (n.value = Object.freeze(n.value)), n);
|
|
2778
2778
|
return te(t) ? t.then((n) => s(n)) : s(t);
|
|
@@ -2790,20 +2790,20 @@ var _;
|
|
|
2790
2790
|
(function(a) {
|
|
2791
2791
|
a.ZodString = "ZodString", a.ZodNumber = "ZodNumber", a.ZodNaN = "ZodNaN", a.ZodBigInt = "ZodBigInt", a.ZodBoolean = "ZodBoolean", a.ZodDate = "ZodDate", a.ZodSymbol = "ZodSymbol", a.ZodUndefined = "ZodUndefined", a.ZodNull = "ZodNull", a.ZodAny = "ZodAny", a.ZodUnknown = "ZodUnknown", a.ZodNever = "ZodNever", a.ZodVoid = "ZodVoid", a.ZodArray = "ZodArray", a.ZodObject = "ZodObject", a.ZodUnion = "ZodUnion", a.ZodDiscriminatedUnion = "ZodDiscriminatedUnion", a.ZodIntersection = "ZodIntersection", a.ZodTuple = "ZodTuple", a.ZodRecord = "ZodRecord", a.ZodMap = "ZodMap", a.ZodSet = "ZodSet", a.ZodFunction = "ZodFunction", a.ZodLazy = "ZodLazy", a.ZodLiteral = "ZodLiteral", a.ZodEnum = "ZodEnum", a.ZodEffects = "ZodEffects", a.ZodNativeEnum = "ZodNativeEnum", a.ZodOptional = "ZodOptional", a.ZodNullable = "ZodNullable", a.ZodDefault = "ZodDefault", a.ZodCatch = "ZodCatch", a.ZodPromise = "ZodPromise", a.ZodBranded = "ZodBranded", a.ZodPipeline = "ZodPipeline", a.ZodReadonly = "ZodReadonly";
|
|
2792
2792
|
})(_ || (_ = {}));
|
|
2793
|
-
const
|
|
2794
|
-
|
|
2793
|
+
const O = E.create, Pe = le.create;
|
|
2794
|
+
P.create;
|
|
2795
2795
|
I.create;
|
|
2796
|
-
const Re =
|
|
2796
|
+
const Re = x.create;
|
|
2797
2797
|
ne.create;
|
|
2798
2798
|
ae.create;
|
|
2799
2799
|
q.create;
|
|
2800
2800
|
const Fe = pe.create, _t = H.create;
|
|
2801
2801
|
re.create;
|
|
2802
|
-
|
|
2802
|
+
$.create;
|
|
2803
2803
|
V.create;
|
|
2804
2804
|
const gt = Re({
|
|
2805
2805
|
type: Fe("bridge"),
|
|
2806
|
-
name:
|
|
2806
|
+
name: O(),
|
|
2807
2807
|
data: Pe()
|
|
2808
2808
|
});
|
|
2809
2809
|
function Rt(a) {
|
|
@@ -2811,15 +2811,15 @@ function Rt(a) {
|
|
|
2811
2811
|
}
|
|
2812
2812
|
const yt = Re({
|
|
2813
2813
|
type: Fe("client"),
|
|
2814
|
-
telemetrySdkVersion:
|
|
2815
|
-
applicationSpecifier:
|
|
2816
|
-
applicationInstance:
|
|
2814
|
+
telemetrySdkVersion: O(),
|
|
2815
|
+
applicationSpecifier: O(),
|
|
2816
|
+
applicationInstance: O(),
|
|
2817
2817
|
runtime: _t(["window", "worker"]),
|
|
2818
|
-
name:
|
|
2818
|
+
name: O(),
|
|
2819
2819
|
data: Pe(),
|
|
2820
|
-
responseName:
|
|
2821
|
-
subscriptionName:
|
|
2822
|
-
unsubscribeName:
|
|
2820
|
+
responseName: O().optional(),
|
|
2821
|
+
subscriptionName: O().optional(),
|
|
2822
|
+
unsubscribeName: O().optional()
|
|
2823
2823
|
});
|
|
2824
2824
|
function Y(a) {
|
|
2825
2825
|
return { ...a, type: "client" };
|
|
@@ -3076,10 +3076,10 @@ class kt {
|
|
|
3076
3076
|
integrity: e.integrity
|
|
3077
3077
|
}));
|
|
3078
3078
|
let r = {};
|
|
3079
|
-
t != null && t.headers && (t.headers instanceof Headers ? t.headers.forEach((
|
|
3080
|
-
r[
|
|
3081
|
-
}) : Array.isArray(t.headers) ? t.headers.forEach(([
|
|
3082
|
-
r[
|
|
3079
|
+
t != null && t.headers && (t.headers instanceof Headers ? t.headers.forEach((f, v) => {
|
|
3080
|
+
r[v] = f;
|
|
3081
|
+
}) : Array.isArray(t.headers) ? t.headers.forEach(([f, v]) => {
|
|
3082
|
+
r[f] = v;
|
|
3083
3083
|
}) : r = t.headers);
|
|
3084
3084
|
const i = await this._client.request("proxy.fetch", {
|
|
3085
3085
|
url: n,
|
|
@@ -3099,10 +3099,10 @@ class kt {
|
|
|
3099
3099
|
let l = null;
|
|
3100
3100
|
if (i.body !== null && i.body !== void 0)
|
|
3101
3101
|
if (i.bodyType === "binary") {
|
|
3102
|
-
const
|
|
3103
|
-
for (let
|
|
3104
|
-
|
|
3105
|
-
l =
|
|
3102
|
+
const f = atob(i.body), v = new Uint8Array(f.length);
|
|
3103
|
+
for (let k = 0; k < f.length; k++)
|
|
3104
|
+
v[k] = f.charCodeAt(k);
|
|
3105
|
+
l = v;
|
|
3106
3106
|
} else i.bodyType === "text" ? l = i.body : i.bodyType === "json" && (l = JSON.stringify(i.body));
|
|
3107
3107
|
return new Response(l, c);
|
|
3108
3108
|
}
|
|
@@ -3294,7 +3294,7 @@ class St {
|
|
|
3294
3294
|
return t;
|
|
3295
3295
|
}
|
|
3296
3296
|
}
|
|
3297
|
-
class
|
|
3297
|
+
class Tt {
|
|
3298
3298
|
constructor(e) {
|
|
3299
3299
|
this._client = e;
|
|
3300
3300
|
}
|
|
@@ -3341,7 +3341,7 @@ class Ct {
|
|
|
3341
3341
|
return r.rates;
|
|
3342
3342
|
}
|
|
3343
3343
|
}
|
|
3344
|
-
class
|
|
3344
|
+
class Ct {
|
|
3345
3345
|
constructor(e) {
|
|
3346
3346
|
this._client = e;
|
|
3347
3347
|
}
|
|
@@ -3598,7 +3598,7 @@ class Zt {
|
|
|
3598
3598
|
* @returns A Currency instance bound to this client
|
|
3599
3599
|
*/
|
|
3600
3600
|
get currency() {
|
|
3601
|
-
return new
|
|
3601
|
+
return new Tt(this);
|
|
3602
3602
|
}
|
|
3603
3603
|
/**
|
|
3604
3604
|
* Provides access to the environment API for accessing environment settings.
|
|
@@ -3612,7 +3612,7 @@ class Zt {
|
|
|
3612
3612
|
* @returns An Environment instance bound to this client
|
|
3613
3613
|
*/
|
|
3614
3614
|
get environment() {
|
|
3615
|
-
return new
|
|
3615
|
+
return new Ct(this);
|
|
3616
3616
|
}
|
|
3617
3617
|
get mqtt() {
|
|
3618
3618
|
return new It(this);
|
|
@@ -3659,23 +3659,23 @@ class Zt {
|
|
|
3659
3659
|
if (i.data.type === "client") {
|
|
3660
3660
|
const c = yt.safeParse(i.data);
|
|
3661
3661
|
if (!c.success) {
|
|
3662
|
-
const
|
|
3663
|
-
|
|
3662
|
+
const k = i.data;
|
|
3663
|
+
k && typeof k == "object" && k.type === "client" && console.warn("[sdk-client] Received a message that looks like a client message but failed schema validation. This may indicate a version mismatch between the SDK and the host environment.", c.error.issues);
|
|
3664
3664
|
return;
|
|
3665
3665
|
}
|
|
3666
|
-
const l = c.data,
|
|
3667
|
-
if (!
|
|
3666
|
+
const l = c.data, f = this._messageInterceptors.get(l.name);
|
|
3667
|
+
if (!f)
|
|
3668
3668
|
return B(l);
|
|
3669
|
-
let
|
|
3669
|
+
let v;
|
|
3670
3670
|
try {
|
|
3671
|
-
|
|
3672
|
-
} catch (
|
|
3673
|
-
console.error(`Error in interceptor for message ${l.name}:`,
|
|
3671
|
+
v = f(l);
|
|
3672
|
+
} catch (k) {
|
|
3673
|
+
console.error(`Error in interceptor for message ${l.name}:`, k);
|
|
3674
3674
|
}
|
|
3675
|
-
if (!
|
|
3675
|
+
if (!v)
|
|
3676
3676
|
return;
|
|
3677
3677
|
o = {
|
|
3678
|
-
...
|
|
3678
|
+
...v,
|
|
3679
3679
|
type: "bridge",
|
|
3680
3680
|
...i.data.responseName ? { name: i.data.responseName } : {}
|
|
3681
3681
|
};
|
|
@@ -3683,18 +3683,18 @@ class Zt {
|
|
|
3683
3683
|
if (!o) {
|
|
3684
3684
|
const c = gt.safeParse(i.data);
|
|
3685
3685
|
if (!c.success) {
|
|
3686
|
-
const
|
|
3687
|
-
|
|
3686
|
+
const v = i.data;
|
|
3687
|
+
v && typeof v == "object" && v.type === "bridge" && console.warn("[sdk-client] Received a message that looks like a bridge message but failed schema validation. This may indicate a version mismatch between the SDK and the host environment.", c.error.issues);
|
|
3688
3688
|
return;
|
|
3689
3689
|
}
|
|
3690
3690
|
o = c.data;
|
|
3691
|
-
const l = this._onHandlers.get(o.name),
|
|
3691
|
+
const l = this._onHandlers.get(o.name), f = this._onceHandlers.get(o.name);
|
|
3692
3692
|
if (l)
|
|
3693
|
-
for (const
|
|
3694
|
-
|
|
3695
|
-
if (
|
|
3696
|
-
for (const
|
|
3697
|
-
|
|
3693
|
+
for (const v of l)
|
|
3694
|
+
v(o.data);
|
|
3695
|
+
if (f) {
|
|
3696
|
+
for (const v of f)
|
|
3697
|
+
v(o.data);
|
|
3698
3698
|
this._onceHandlers.delete(o.name);
|
|
3699
3699
|
}
|
|
3700
3700
|
}
|
|
@@ -3778,20 +3778,20 @@ class Zt {
|
|
|
3778
3778
|
B(i);
|
|
3779
3779
|
const o = (n = s == null ? void 0 : s.timeout) !== null && n !== void 0 ? n : z;
|
|
3780
3780
|
let c = !1, l;
|
|
3781
|
-
const
|
|
3782
|
-
l = (
|
|
3783
|
-
c ||
|
|
3781
|
+
const f = new Promise((k) => {
|
|
3782
|
+
l = (N) => {
|
|
3783
|
+
c || k(N);
|
|
3784
3784
|
}, this.once(r, l);
|
|
3785
3785
|
});
|
|
3786
3786
|
if (o === 0)
|
|
3787
|
-
return
|
|
3788
|
-
const
|
|
3787
|
+
return f;
|
|
3788
|
+
const v = new Promise((k, N) => {
|
|
3789
3789
|
const R = new Error(`${e} message request with response name of ${r} timed out after ${o}`);
|
|
3790
3790
|
setTimeout(() => {
|
|
3791
|
-
c = !0, this.off(r, l),
|
|
3791
|
+
c = !0, this.off(r, l), N(R);
|
|
3792
3792
|
}, o);
|
|
3793
3793
|
});
|
|
3794
|
-
return Promise.race([
|
|
3794
|
+
return Promise.race([v, f]);
|
|
3795
3795
|
}
|
|
3796
3796
|
async subscribe(e, t, s) {
|
|
3797
3797
|
let n, r;
|
|
@@ -3810,18 +3810,18 @@ class Zt {
|
|
|
3810
3810
|
subscriptionName: i
|
|
3811
3811
|
});
|
|
3812
3812
|
B(l);
|
|
3813
|
-
let
|
|
3814
|
-
const
|
|
3813
|
+
let f = !1, v;
|
|
3814
|
+
const k = new Promise((R, F) => {
|
|
3815
3815
|
const oe = new Error(`${e} subscribe request with subscription name of ${i} and response name of ${o} timed out after ${z}`);
|
|
3816
3816
|
setTimeout(() => {
|
|
3817
|
-
|
|
3817
|
+
f = !0, this.off(o, v), F(oe);
|
|
3818
3818
|
}, z);
|
|
3819
|
-
}),
|
|
3820
|
-
|
|
3821
|
-
|
|
3822
|
-
}, this.once(o,
|
|
3819
|
+
}), N = new Promise((R) => {
|
|
3820
|
+
v = (F) => {
|
|
3821
|
+
f || R(F);
|
|
3822
|
+
}, this.once(o, v);
|
|
3823
3823
|
});
|
|
3824
|
-
return Promise.race([
|
|
3824
|
+
return Promise.race([k, N]);
|
|
3825
3825
|
}
|
|
3826
3826
|
async unsubscribe(e, t, s) {
|
|
3827
3827
|
let n, r;
|
|
@@ -3848,18 +3848,18 @@ class Zt {
|
|
|
3848
3848
|
unsubscribeName: c
|
|
3849
3849
|
});
|
|
3850
3850
|
B(l);
|
|
3851
|
-
let
|
|
3852
|
-
const
|
|
3851
|
+
let f = !1, v;
|
|
3852
|
+
const k = new Promise((R, F) => {
|
|
3853
3853
|
const oe = new Error(`${e} unsubscribe request with unsubscribe name of ${c} and response name of ${i} timed out after ${z}`);
|
|
3854
3854
|
setTimeout(() => {
|
|
3855
|
-
|
|
3855
|
+
f = !0, this.off(i, v), F(oe);
|
|
3856
3856
|
}, z);
|
|
3857
|
-
}),
|
|
3858
|
-
|
|
3859
|
-
|
|
3860
|
-
}, this.once(i,
|
|
3857
|
+
}), N = new Promise((R) => {
|
|
3858
|
+
v = (F) => {
|
|
3859
|
+
f || R(F);
|
|
3860
|
+
}, this.once(i, v);
|
|
3861
3861
|
});
|
|
3862
|
-
if (!(await Promise.race([
|
|
3862
|
+
if (!(await Promise.race([k, N])).success)
|
|
3863
3863
|
return { success: !1 };
|
|
3864
3864
|
}
|
|
3865
3865
|
return { success: !0 };
|
|
@@ -4021,20 +4021,20 @@ class Et {
|
|
|
4021
4021
|
*
|
|
4022
4022
|
* @returns A promise resolving to the iframe element or null
|
|
4023
4023
|
*/
|
|
4024
|
-
async frame() {
|
|
4025
|
-
return new Promise((
|
|
4024
|
+
async frame(e) {
|
|
4025
|
+
return new Promise((t) => {
|
|
4026
4026
|
if (this._iframe)
|
|
4027
|
-
return
|
|
4027
|
+
return t(this._iframe);
|
|
4028
4028
|
if (this._status === "ready")
|
|
4029
|
-
return this._iframe = this._buildIframe(),
|
|
4030
|
-
let
|
|
4031
|
-
const
|
|
4032
|
-
if (
|
|
4033
|
-
return
|
|
4034
|
-
if (
|
|
4035
|
-
return
|
|
4029
|
+
return this._iframe = this._buildIframe(e), t(this._iframe);
|
|
4030
|
+
let s;
|
|
4031
|
+
const n = (r) => {
|
|
4032
|
+
if (r === "ready")
|
|
4033
|
+
return s(), this._iframe = this._buildIframe(e), t(this._iframe);
|
|
4034
|
+
if (r === "unloaded")
|
|
4035
|
+
return s(), t(null);
|
|
4036
4036
|
};
|
|
4037
|
-
|
|
4037
|
+
s = this.onStatus(n);
|
|
4038
4038
|
});
|
|
4039
4039
|
}
|
|
4040
4040
|
/**
|
|
@@ -4048,36 +4048,37 @@ class Et {
|
|
|
4048
4048
|
this._onStatusHandlers.delete(e);
|
|
4049
4049
|
};
|
|
4050
4050
|
}
|
|
4051
|
-
_buildIframe() {
|
|
4052
|
-
var
|
|
4053
|
-
const
|
|
4054
|
-
if (!
|
|
4051
|
+
_buildIframe(e) {
|
|
4052
|
+
var t, s, n, r, i, o;
|
|
4053
|
+
const c = (s = (t = this._application) === null || t === void 0 ? void 0 : t.versions) === null || s === void 0 ? void 0 : s[0], l = c == null ? void 0 : c.baseUrl;
|
|
4054
|
+
if (!l)
|
|
4055
4055
|
return console.error(`No baseUrl for dependency ${this._specifier}:${this._instanceId}`), null;
|
|
4056
|
-
const
|
|
4057
|
-
|
|
4058
|
-
|
|
4059
|
-
|
|
4056
|
+
const f = new URL(l), v = (o = (n = e == null ? void 0 : e.path) !== null && n !== void 0 ? n : (i = (r = c == null ? void 0 : c.mountPoints) === null || r === void 0 ? void 0 : r.find((N) => N.name === (e == null ? void 0 : e.mountPoint))) === null || i === void 0 ? void 0 : i.path) !== null && o !== void 0 ? o : (
|
|
4057
|
+
// TODO: Replace with a blob URL placeholder when no mount point is found
|
|
4058
|
+
"/"
|
|
4059
|
+
);
|
|
4060
|
+
f.pathname = v.startsWith("/") ? v : `/${v}`, f.searchParams.set("applicationSpecifier", this._specifier), f.searchParams.set("applicationInstance", this._instanceId), f.searchParams.set("deviceId", this._store._client.deviceId);
|
|
4061
|
+
const k = document.createElement("iframe");
|
|
4062
|
+
return k.src = f.toString(), k;
|
|
4060
4063
|
}
|
|
4061
4064
|
/**
|
|
4062
|
-
* Resets the iframe by
|
|
4063
|
-
*
|
|
4064
|
-
* iframe is still in the DOM.
|
|
4065
|
+
* Resets the iframe by requesting the host to clean up subscriptions and
|
|
4066
|
+
* state for this instance, then reloading it by reassigning src to itself.
|
|
4065
4067
|
*/
|
|
4066
4068
|
async _resetIframe() {
|
|
4067
4069
|
if (!this._iframe)
|
|
4068
4070
|
return;
|
|
4069
|
-
const e = this._iframe
|
|
4070
|
-
e.src = "about:blank";
|
|
4071
|
+
const e = this._iframe;
|
|
4071
4072
|
try {
|
|
4072
4073
|
await this._store._client.request("applications.reset", {
|
|
4073
4074
|
applicationSpecifier: this._specifier,
|
|
4074
4075
|
applicationInstance: this._instanceId,
|
|
4075
4076
|
cause: "heartbeat-timeout"
|
|
4076
4077
|
});
|
|
4077
|
-
} catch (
|
|
4078
|
-
console.error(`Failed to reset application ${this._specifier}:${this._instanceId}:`,
|
|
4078
|
+
} catch (t) {
|
|
4079
|
+
console.error(`Failed to reset application ${this._specifier}:${this._instanceId}:`, t);
|
|
4079
4080
|
}
|
|
4080
|
-
this._iframe === e && e.
|
|
4081
|
+
this._iframe === e && (e.src = e.src);
|
|
4081
4082
|
}
|
|
4082
4083
|
/**
|
|
4083
4084
|
* Tears down this handle: resets status to 'unloaded', blanks the iframe,
|
|
@@ -4235,87 +4236,87 @@ class Pt extends Zt {
|
|
|
4235
4236
|
return new $t(this);
|
|
4236
4237
|
}
|
|
4237
4238
|
}
|
|
4238
|
-
let
|
|
4239
|
+
let m = null;
|
|
4239
4240
|
function Ft() {
|
|
4240
|
-
return
|
|
4241
|
+
return m;
|
|
4241
4242
|
}
|
|
4242
4243
|
function qt(a) {
|
|
4243
|
-
|
|
4244
|
+
m = new Pt(), m.bind();
|
|
4244
4245
|
}
|
|
4245
4246
|
function Mt() {
|
|
4246
|
-
|
|
4247
|
+
m == null || m.unbind(), m = null;
|
|
4247
4248
|
}
|
|
4248
4249
|
function Lt(...a) {
|
|
4249
|
-
return
|
|
4250
|
+
return S(m), m.on(...a);
|
|
4250
4251
|
}
|
|
4251
4252
|
function Ht(...a) {
|
|
4252
|
-
return
|
|
4253
|
+
return S(m), m.once(...a);
|
|
4253
4254
|
}
|
|
4254
4255
|
function Dt(...a) {
|
|
4255
|
-
return
|
|
4256
|
+
return S(m), m.off(...a);
|
|
4256
4257
|
}
|
|
4257
4258
|
function Vt(...a) {
|
|
4258
|
-
return
|
|
4259
|
+
return S(m), m.send(...a);
|
|
4259
4260
|
}
|
|
4260
4261
|
function zt(...a) {
|
|
4261
|
-
return
|
|
4262
|
+
return S(m), m.request(...a);
|
|
4262
4263
|
}
|
|
4263
4264
|
function Bt(...a) {
|
|
4264
|
-
return
|
|
4265
|
+
return S(m), m.subscribe(...a);
|
|
4265
4266
|
}
|
|
4266
4267
|
function Ut(...a) {
|
|
4267
|
-
return
|
|
4268
|
+
return S(m), m.unsubscribe(...a);
|
|
4268
4269
|
}
|
|
4269
4270
|
function Kt() {
|
|
4270
|
-
return
|
|
4271
|
+
return S(m), m.store;
|
|
4271
4272
|
}
|
|
4272
4273
|
function Wt() {
|
|
4273
|
-
return
|
|
4274
|
+
return S(m), m.applications;
|
|
4274
4275
|
}
|
|
4275
4276
|
function Jt() {
|
|
4276
|
-
return
|
|
4277
|
+
return S(m), m.media;
|
|
4277
4278
|
}
|
|
4278
4279
|
function Qt() {
|
|
4279
|
-
return
|
|
4280
|
+
return S(m), m.accounts;
|
|
4280
4281
|
}
|
|
4281
4282
|
function Yt() {
|
|
4282
|
-
return
|
|
4283
|
+
return S(m), m.users;
|
|
4283
4284
|
}
|
|
4284
4285
|
function Gt() {
|
|
4285
|
-
return
|
|
4286
|
+
return S(m), m.devices;
|
|
4286
4287
|
}
|
|
4287
4288
|
function Xt() {
|
|
4288
|
-
return
|
|
4289
|
+
return S(m), m.proxy;
|
|
4289
4290
|
}
|
|
4290
4291
|
function es() {
|
|
4291
|
-
return
|
|
4292
|
+
return S(m), m.weather;
|
|
4292
4293
|
}
|
|
4293
4294
|
function ts() {
|
|
4294
|
-
return
|
|
4295
|
+
return S(m), m.currency;
|
|
4295
4296
|
}
|
|
4296
4297
|
function ss() {
|
|
4297
|
-
return
|
|
4298
|
+
return S(m), m.environment;
|
|
4298
4299
|
}
|
|
4299
4300
|
function ns() {
|
|
4300
|
-
return
|
|
4301
|
+
return S(m), m.playlist;
|
|
4301
4302
|
}
|
|
4302
4303
|
function as() {
|
|
4303
|
-
return
|
|
4304
|
+
return S(m), m.overrides;
|
|
4304
4305
|
}
|
|
4305
4306
|
function rs() {
|
|
4306
|
-
return
|
|
4307
|
+
return S(m), m.mqtt;
|
|
4307
4308
|
}
|
|
4308
|
-
function
|
|
4309
|
+
function S(a) {
|
|
4309
4310
|
if (!a)
|
|
4310
4311
|
throw new Error("SDK is not configured");
|
|
4311
4312
|
}
|
|
4312
4313
|
export {
|
|
4313
4314
|
He as Accounts,
|
|
4314
4315
|
De as Applications,
|
|
4315
|
-
|
|
4316
|
+
Tt as Currency,
|
|
4316
4317
|
Et as DependencyHandle,
|
|
4317
4318
|
xt as Devices,
|
|
4318
|
-
|
|
4319
|
+
Ct as Environment,
|
|
4319
4320
|
Ve as Media,
|
|
4320
4321
|
It as Mqtt,
|
|
4321
4322
|
Nt as Navigation,
|