@telemetryos/sdk 1.2.0 → 1.3.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/CHANGELOG.md +14 -0
- package/README.md +16 -13
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +5 -5
- package/dist/index.js +991 -671
- package/dist/overrides.d.ts +39 -0
- package/dist/playlist.d.ts +41 -0
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var
|
|
1
|
+
var w;
|
|
2
2
|
(function(a) {
|
|
3
3
|
a.assertEqual = (n) => n;
|
|
4
4
|
function e(n) {
|
|
@@ -33,16 +33,16 @@ var b;
|
|
|
33
33
|
return n.map((r) => typeof r == "string" ? `'${r}'` : r).join(i);
|
|
34
34
|
}
|
|
35
35
|
a.joinValues = s, a.jsonStringifyReplacer = (n, i) => typeof i == "bigint" ? i.toString() : i;
|
|
36
|
-
})(
|
|
37
|
-
var
|
|
36
|
+
})(w || (w = {}));
|
|
37
|
+
var je;
|
|
38
38
|
(function(a) {
|
|
39
39
|
a.mergeShapes = (e, t) => ({
|
|
40
40
|
...e,
|
|
41
41
|
...t
|
|
42
42
|
// second overwrites first
|
|
43
43
|
});
|
|
44
|
-
})(
|
|
45
|
-
const h =
|
|
44
|
+
})(je || (je = {}));
|
|
45
|
+
const h = w.arrayToEnum([
|
|
46
46
|
"string",
|
|
47
47
|
"nan",
|
|
48
48
|
"number",
|
|
@@ -63,7 +63,7 @@ const h = b.arrayToEnum([
|
|
|
63
63
|
"never",
|
|
64
64
|
"map",
|
|
65
65
|
"set"
|
|
66
|
-
]),
|
|
66
|
+
]), $ = (a) => {
|
|
67
67
|
switch (typeof a) {
|
|
68
68
|
case "undefined":
|
|
69
69
|
return h.undefined;
|
|
@@ -84,7 +84,7 @@ const h = b.arrayToEnum([
|
|
|
84
84
|
default:
|
|
85
85
|
return h.unknown;
|
|
86
86
|
}
|
|
87
|
-
}, d =
|
|
87
|
+
}, d = w.arrayToEnum([
|
|
88
88
|
"invalid_type",
|
|
89
89
|
"invalid_literal",
|
|
90
90
|
"custom",
|
|
@@ -101,8 +101,8 @@ const h = b.arrayToEnum([
|
|
|
101
101
|
"invalid_intersection_types",
|
|
102
102
|
"not_multiple_of",
|
|
103
103
|
"not_finite"
|
|
104
|
-
]),
|
|
105
|
-
let
|
|
104
|
+
]), at = (a) => JSON.stringify(a, null, 2).replace(/"([^"]+)":/g, "$1:");
|
|
105
|
+
let C = class Ve extends Error {
|
|
106
106
|
get errors() {
|
|
107
107
|
return this.issues;
|
|
108
108
|
}
|
|
@@ -139,14 +139,14 @@ let N = class qe extends Error {
|
|
|
139
139
|
return n(this), s;
|
|
140
140
|
}
|
|
141
141
|
static assert(e) {
|
|
142
|
-
if (!(e instanceof
|
|
142
|
+
if (!(e instanceof Ve))
|
|
143
143
|
throw new Error(`Not a ZodError: ${e}`);
|
|
144
144
|
}
|
|
145
145
|
toString() {
|
|
146
146
|
return this.message;
|
|
147
147
|
}
|
|
148
148
|
get message() {
|
|
149
|
-
return JSON.stringify(this.issues,
|
|
149
|
+
return JSON.stringify(this.issues, w.jsonStringifyReplacer, 2);
|
|
150
150
|
}
|
|
151
151
|
get isEmpty() {
|
|
152
152
|
return this.issues.length === 0;
|
|
@@ -161,7 +161,7 @@ let N = class qe extends Error {
|
|
|
161
161
|
return this.flatten();
|
|
162
162
|
}
|
|
163
163
|
};
|
|
164
|
-
|
|
164
|
+
C.create = (a) => new C(a);
|
|
165
165
|
const W = (a, e) => {
|
|
166
166
|
let t;
|
|
167
167
|
switch (a.code) {
|
|
@@ -169,19 +169,19 @@ const W = (a, e) => {
|
|
|
169
169
|
a.received === h.undefined ? t = "Required" : t = `Expected ${a.expected}, received ${a.received}`;
|
|
170
170
|
break;
|
|
171
171
|
case d.invalid_literal:
|
|
172
|
-
t = `Invalid literal value, expected ${JSON.stringify(a.expected,
|
|
172
|
+
t = `Invalid literal value, expected ${JSON.stringify(a.expected, w.jsonStringifyReplacer)}`;
|
|
173
173
|
break;
|
|
174
174
|
case d.unrecognized_keys:
|
|
175
|
-
t = `Unrecognized key(s) in object: ${
|
|
175
|
+
t = `Unrecognized key(s) in object: ${w.joinValues(a.keys, ", ")}`;
|
|
176
176
|
break;
|
|
177
177
|
case d.invalid_union:
|
|
178
178
|
t = "Invalid input";
|
|
179
179
|
break;
|
|
180
180
|
case d.invalid_union_discriminator:
|
|
181
|
-
t = `Invalid discriminator value. Expected ${
|
|
181
|
+
t = `Invalid discriminator value. Expected ${w.joinValues(a.options)}`;
|
|
182
182
|
break;
|
|
183
183
|
case d.invalid_enum_value:
|
|
184
|
-
t = `Invalid enum value. Expected ${
|
|
184
|
+
t = `Invalid enum value. Expected ${w.joinValues(a.options)}, received '${a.received}'`;
|
|
185
185
|
break;
|
|
186
186
|
case d.invalid_arguments:
|
|
187
187
|
t = "Invalid function arguments";
|
|
@@ -193,7 +193,7 @@ const W = (a, e) => {
|
|
|
193
193
|
t = "Invalid date";
|
|
194
194
|
break;
|
|
195
195
|
case d.invalid_string:
|
|
196
|
-
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}"` :
|
|
196
|
+
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";
|
|
197
197
|
break;
|
|
198
198
|
case d.too_small:
|
|
199
199
|
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 === "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";
|
|
@@ -214,15 +214,15 @@ const W = (a, e) => {
|
|
|
214
214
|
t = "Number must be finite";
|
|
215
215
|
break;
|
|
216
216
|
default:
|
|
217
|
-
t = e.defaultError,
|
|
217
|
+
t = e.defaultError, w.assertNever(a);
|
|
218
218
|
}
|
|
219
219
|
return { message: t };
|
|
220
220
|
};
|
|
221
221
|
let Be = W;
|
|
222
|
-
function
|
|
222
|
+
function nt(a) {
|
|
223
223
|
Be = a;
|
|
224
224
|
}
|
|
225
|
-
function
|
|
225
|
+
function we() {
|
|
226
226
|
return Be;
|
|
227
227
|
}
|
|
228
228
|
const be = (a) => {
|
|
@@ -245,9 +245,9 @@ const be = (a) => {
|
|
|
245
245
|
path: i,
|
|
246
246
|
message: o
|
|
247
247
|
};
|
|
248
|
-
},
|
|
248
|
+
}, it = [];
|
|
249
249
|
function l(a, e) {
|
|
250
|
-
const t =
|
|
250
|
+
const t = we(), s = be({
|
|
251
251
|
issueData: e,
|
|
252
252
|
data: a.data,
|
|
253
253
|
path: a.path,
|
|
@@ -264,7 +264,7 @@ function l(a, e) {
|
|
|
264
264
|
});
|
|
265
265
|
a.common.issues.push(s);
|
|
266
266
|
}
|
|
267
|
-
let
|
|
267
|
+
let x = class Ue {
|
|
268
268
|
constructor() {
|
|
269
269
|
this.value = "valid";
|
|
270
270
|
}
|
|
@@ -278,7 +278,7 @@ let Z = class Ve {
|
|
|
278
278
|
const s = [];
|
|
279
279
|
for (const n of t) {
|
|
280
280
|
if (n.status === "aborted")
|
|
281
|
-
return
|
|
281
|
+
return y;
|
|
282
282
|
n.status === "dirty" && e.dirty(), s.push(n.value);
|
|
283
283
|
}
|
|
284
284
|
return { status: e.value, value: s };
|
|
@@ -292,27 +292,27 @@ let Z = class Ve {
|
|
|
292
292
|
value: r
|
|
293
293
|
});
|
|
294
294
|
}
|
|
295
|
-
return
|
|
295
|
+
return Ue.mergeObjectSync(e, s);
|
|
296
296
|
}
|
|
297
297
|
static mergeObjectSync(e, t) {
|
|
298
298
|
const s = {};
|
|
299
299
|
for (const n of t) {
|
|
300
300
|
const { key: i, value: r } = n;
|
|
301
301
|
if (i.status === "aborted" || r.status === "aborted")
|
|
302
|
-
return
|
|
302
|
+
return y;
|
|
303
303
|
i.status === "dirty" && e.dirty(), r.status === "dirty" && e.dirty(), i.value !== "__proto__" && (typeof r.value < "u" || n.alwaysSet) && (s[i.value] = r.value);
|
|
304
304
|
}
|
|
305
305
|
return { status: e.value, value: s };
|
|
306
306
|
}
|
|
307
307
|
};
|
|
308
|
-
const
|
|
308
|
+
const y = Object.freeze({
|
|
309
309
|
status: "aborted"
|
|
310
|
-
}), ke = (a) => ({ status: "dirty", value: a }),
|
|
311
|
-
function
|
|
310
|
+
}), ke = (a) => ({ status: "dirty", value: a }), k = (a) => ({ status: "valid", value: a }), $e = (a) => a.status === "aborted", Pe = (a) => a.status === "dirty", z = (a) => a.status === "valid", X = (a) => typeof Promise < "u" && a instanceof Promise;
|
|
311
|
+
function xe(a, e, t, s) {
|
|
312
312
|
if (typeof e == "function" ? a !== e || !0 : !e.has(a)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
313
313
|
return e.get(a);
|
|
314
314
|
}
|
|
315
|
-
function
|
|
315
|
+
function He(a, e, t, s, n) {
|
|
316
316
|
if (typeof e == "function" ? a !== e || !0 : !e.has(a)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
317
317
|
return e.set(a, t), t;
|
|
318
318
|
}
|
|
@@ -320,8 +320,8 @@ var p;
|
|
|
320
320
|
(function(a) {
|
|
321
321
|
a.errToObj = (e) => typeof e == "string" ? { message: e } : e || {}, a.toString = (e) => typeof e == "string" ? e : e == null ? void 0 : e.message;
|
|
322
322
|
})(p || (p = {}));
|
|
323
|
-
var
|
|
324
|
-
class
|
|
323
|
+
var Y, G;
|
|
324
|
+
class E {
|
|
325
325
|
constructor(e, t, s, n) {
|
|
326
326
|
this._cachedPath = [], this.parent = e, this.data = t, this._path = s, this._key = n;
|
|
327
327
|
}
|
|
@@ -339,7 +339,7 @@ const Le = (a, e) => {
|
|
|
339
339
|
get error() {
|
|
340
340
|
if (this._error)
|
|
341
341
|
return this._error;
|
|
342
|
-
const t = new
|
|
342
|
+
const t = new C(a.common.issues);
|
|
343
343
|
return this._error = t, this._error;
|
|
344
344
|
}
|
|
345
345
|
};
|
|
@@ -356,18 +356,18 @@ function g(a) {
|
|
|
356
356
|
return i.code === "invalid_enum_value" ? { message: u ?? r.defaultError } : typeof r.data > "u" ? { message: (o = u ?? s) !== null && o !== void 0 ? o : r.defaultError } : i.code !== "invalid_type" ? { message: r.defaultError } : { message: (c = u ?? t) !== null && c !== void 0 ? c : r.defaultError };
|
|
357
357
|
}, description: n };
|
|
358
358
|
}
|
|
359
|
-
class
|
|
359
|
+
let _ = class {
|
|
360
360
|
get description() {
|
|
361
361
|
return this._def.description;
|
|
362
362
|
}
|
|
363
363
|
_getType(e) {
|
|
364
|
-
return
|
|
364
|
+
return $(e.data);
|
|
365
365
|
}
|
|
366
366
|
_getOrReturnCtx(e, t) {
|
|
367
367
|
return t || {
|
|
368
368
|
common: e.parent.common,
|
|
369
369
|
data: e.data,
|
|
370
|
-
parsedType:
|
|
370
|
+
parsedType: $(e.data),
|
|
371
371
|
schemaErrorMap: this._def.errorMap,
|
|
372
372
|
path: e.path,
|
|
373
373
|
parent: e.parent
|
|
@@ -375,11 +375,11 @@ class y {
|
|
|
375
375
|
}
|
|
376
376
|
_processInputParams(e) {
|
|
377
377
|
return {
|
|
378
|
-
status: new
|
|
378
|
+
status: new x(),
|
|
379
379
|
ctx: {
|
|
380
380
|
common: e.parent.common,
|
|
381
381
|
data: e.data,
|
|
382
|
-
parsedType:
|
|
382
|
+
parsedType: $(e.data),
|
|
383
383
|
schemaErrorMap: this._def.errorMap,
|
|
384
384
|
path: e.path,
|
|
385
385
|
parent: e.parent
|
|
@@ -388,7 +388,7 @@ class y {
|
|
|
388
388
|
}
|
|
389
389
|
_parseSync(e) {
|
|
390
390
|
const t = this._parse(e);
|
|
391
|
-
if (
|
|
391
|
+
if (X(t))
|
|
392
392
|
throw new Error("Synchronous parse encountered promise.");
|
|
393
393
|
return t;
|
|
394
394
|
}
|
|
@@ -414,7 +414,7 @@ class y {
|
|
|
414
414
|
schemaErrorMap: this._def.errorMap,
|
|
415
415
|
parent: null,
|
|
416
416
|
data: e,
|
|
417
|
-
parsedType:
|
|
417
|
+
parsedType: $(e)
|
|
418
418
|
}, i = this._parseSync({ data: e, path: n.path, parent: n });
|
|
419
419
|
return Le(n, i);
|
|
420
420
|
}
|
|
@@ -429,7 +429,7 @@ class y {
|
|
|
429
429
|
schemaErrorMap: this._def.errorMap,
|
|
430
430
|
parent: null,
|
|
431
431
|
data: e,
|
|
432
|
-
parsedType:
|
|
432
|
+
parsedType: $(e)
|
|
433
433
|
};
|
|
434
434
|
if (!this["~standard"].async)
|
|
435
435
|
try {
|
|
@@ -468,8 +468,8 @@ class y {
|
|
|
468
468
|
schemaErrorMap: this._def.errorMap,
|
|
469
469
|
parent: null,
|
|
470
470
|
data: e,
|
|
471
|
-
parsedType:
|
|
472
|
-
}, n = this._parse({ data: e, path: s.path, parent: s }), i = await (
|
|
471
|
+
parsedType: $(e)
|
|
472
|
+
}, n = this._parse({ data: e, path: s.path, parent: s }), i = await (X(n) ? n : Promise.resolve(n));
|
|
473
473
|
return Le(s, i);
|
|
474
474
|
}
|
|
475
475
|
refine(e, t) {
|
|
@@ -486,9 +486,9 @@ class y {
|
|
|
486
486
|
return this._refinement((s, n) => e(s) ? !0 : (n.addIssue(typeof t == "function" ? t(s, n) : t), !1));
|
|
487
487
|
}
|
|
488
488
|
_refinement(e) {
|
|
489
|
-
return new
|
|
489
|
+
return new A({
|
|
490
490
|
schema: this,
|
|
491
|
-
typeName:
|
|
491
|
+
typeName: m.ZodEffects,
|
|
492
492
|
effect: { type: "refinement", refinement: e }
|
|
493
493
|
});
|
|
494
494
|
}
|
|
@@ -512,10 +512,10 @@ class y {
|
|
|
512
512
|
return this.nullable().optional();
|
|
513
513
|
}
|
|
514
514
|
array() {
|
|
515
|
-
return
|
|
515
|
+
return V.create(this);
|
|
516
516
|
}
|
|
517
517
|
promise() {
|
|
518
|
-
return
|
|
518
|
+
return J.create(this, this._def);
|
|
519
519
|
}
|
|
520
520
|
or(e) {
|
|
521
521
|
return ne.create([this, e], this._def);
|
|
@@ -524,10 +524,10 @@ class y {
|
|
|
524
524
|
return ie.create(this, e, this._def);
|
|
525
525
|
}
|
|
526
526
|
transform(e) {
|
|
527
|
-
return new
|
|
527
|
+
return new A({
|
|
528
528
|
...g(this._def),
|
|
529
529
|
schema: this,
|
|
530
|
-
typeName:
|
|
530
|
+
typeName: m.ZodEffects,
|
|
531
531
|
effect: { type: "transform", transform: e }
|
|
532
532
|
});
|
|
533
533
|
}
|
|
@@ -537,12 +537,12 @@ class y {
|
|
|
537
537
|
...g(this._def),
|
|
538
538
|
innerType: this,
|
|
539
539
|
defaultValue: t,
|
|
540
|
-
typeName:
|
|
540
|
+
typeName: m.ZodDefault
|
|
541
541
|
});
|
|
542
542
|
}
|
|
543
543
|
brand() {
|
|
544
|
-
return new
|
|
545
|
-
typeName:
|
|
544
|
+
return new De({
|
|
545
|
+
typeName: m.ZodBranded,
|
|
546
546
|
type: this,
|
|
547
547
|
...g(this._def)
|
|
548
548
|
});
|
|
@@ -553,7 +553,7 @@ class y {
|
|
|
553
553
|
...g(this._def),
|
|
554
554
|
innerType: this,
|
|
555
555
|
catchValue: t,
|
|
556
|
-
typeName:
|
|
556
|
+
typeName: m.ZodCatch
|
|
557
557
|
});
|
|
558
558
|
}
|
|
559
559
|
describe(e) {
|
|
@@ -564,7 +564,7 @@ class y {
|
|
|
564
564
|
});
|
|
565
565
|
}
|
|
566
566
|
pipe(e) {
|
|
567
|
-
return
|
|
567
|
+
return fe.create(this, e);
|
|
568
568
|
}
|
|
569
569
|
readonly() {
|
|
570
570
|
return he.create(this);
|
|
@@ -575,29 +575,29 @@ class y {
|
|
|
575
575
|
isNullable() {
|
|
576
576
|
return this.safeParse(null).success;
|
|
577
577
|
}
|
|
578
|
-
}
|
|
579
|
-
const
|
|
580
|
-
let
|
|
581
|
-
const
|
|
582
|
-
function
|
|
578
|
+
};
|
|
579
|
+
const rt = /^c[^\s-]{8,}$/i, ot = /^[0-9a-z]+$/, ct = /^[0-9A-HJKMNP-TV-Z]{26}$/i, dt = /^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i, ut = /^[a-z0-9_-]{21}$/i, lt = /^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/, ht = /^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/, pt = /^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i, ft = "^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";
|
|
580
|
+
let Ee;
|
|
581
|
+
const mt = /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/, yt = /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/, gt = /^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/, _t = /^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/, vt = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/, wt = /^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/, We = "((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))", bt = new RegExp(`^${We}$`);
|
|
582
|
+
function Ke(a) {
|
|
583
583
|
let e = "[0-5]\\d";
|
|
584
584
|
a.precision ? e = `${e}\\.\\d{${a.precision}}` : a.precision == null && (e = `${e}(\\.\\d+)?`);
|
|
585
585
|
const t = a.precision ? "+" : "?";
|
|
586
586
|
return `([01]\\d|2[0-3]):[0-5]\\d(:${e})${t}`;
|
|
587
587
|
}
|
|
588
|
-
function
|
|
589
|
-
return new RegExp(`^${
|
|
588
|
+
function kt(a) {
|
|
589
|
+
return new RegExp(`^${Ke(a)}$`);
|
|
590
590
|
}
|
|
591
|
-
function
|
|
592
|
-
let e = `${
|
|
591
|
+
function Je(a) {
|
|
592
|
+
let e = `${We}T${Ke(a)}`;
|
|
593
593
|
const t = [];
|
|
594
594
|
return t.push(a.local ? "Z?" : "Z"), a.offset && t.push("([+-]\\d{2}:?\\d{2})"), e = `${e}(${t.join("|")})`, new RegExp(`^${e}$`);
|
|
595
595
|
}
|
|
596
|
-
function
|
|
597
|
-
return !!((e === "v4" || !e) &&
|
|
596
|
+
function xt(a, e) {
|
|
597
|
+
return !!((e === "v4" || !e) && mt.test(a) || (e === "v6" || !e) && gt.test(a));
|
|
598
598
|
}
|
|
599
|
-
function
|
|
600
|
-
if (!
|
|
599
|
+
function Zt(a, e) {
|
|
600
|
+
if (!lt.test(a))
|
|
601
601
|
return !1;
|
|
602
602
|
try {
|
|
603
603
|
const [t] = a.split("."), s = t.replace(/-/g, "+").replace(/_/g, "/").padEnd(t.length + (4 - t.length % 4) % 4, "="), n = JSON.parse(atob(s));
|
|
@@ -606,10 +606,10 @@ function kt(a, e) {
|
|
|
606
606
|
return !1;
|
|
607
607
|
}
|
|
608
608
|
}
|
|
609
|
-
function
|
|
610
|
-
return !!((e === "v4" || !e) &&
|
|
609
|
+
function St(a, e) {
|
|
610
|
+
return !!((e === "v4" || !e) && yt.test(a) || (e === "v6" || !e) && _t.test(a));
|
|
611
611
|
}
|
|
612
|
-
class
|
|
612
|
+
class N extends _ {
|
|
613
613
|
_parse(e) {
|
|
614
614
|
if (this._def.coerce && (e.data = String(e.data)), this._getType(e) !== h.string) {
|
|
615
615
|
const n = this._getOrReturnCtx(e);
|
|
@@ -617,9 +617,9 @@ class S extends y {
|
|
|
617
617
|
code: d.invalid_type,
|
|
618
618
|
expected: h.string,
|
|
619
619
|
received: n.parsedType
|
|
620
|
-
}),
|
|
620
|
+
}), y;
|
|
621
621
|
}
|
|
622
|
-
const t = new
|
|
622
|
+
const t = new x();
|
|
623
623
|
let s;
|
|
624
624
|
for (const n of this._def.checks)
|
|
625
625
|
if (n.kind === "min")
|
|
@@ -658,43 +658,43 @@ class S extends y {
|
|
|
658
658
|
message: n.message
|
|
659
659
|
}), t.dirty());
|
|
660
660
|
} else if (n.kind === "email")
|
|
661
|
-
|
|
661
|
+
pt.test(e.data) || (s = this._getOrReturnCtx(e, s), l(s, {
|
|
662
662
|
validation: "email",
|
|
663
663
|
code: d.invalid_string,
|
|
664
664
|
message: n.message
|
|
665
665
|
}), t.dirty());
|
|
666
666
|
else if (n.kind === "emoji")
|
|
667
|
-
|
|
667
|
+
Ee || (Ee = new RegExp(ft, "u")), Ee.test(e.data) || (s = this._getOrReturnCtx(e, s), l(s, {
|
|
668
668
|
validation: "emoji",
|
|
669
669
|
code: d.invalid_string,
|
|
670
670
|
message: n.message
|
|
671
671
|
}), t.dirty());
|
|
672
672
|
else if (n.kind === "uuid")
|
|
673
|
-
|
|
673
|
+
dt.test(e.data) || (s = this._getOrReturnCtx(e, s), l(s, {
|
|
674
674
|
validation: "uuid",
|
|
675
675
|
code: d.invalid_string,
|
|
676
676
|
message: n.message
|
|
677
677
|
}), t.dirty());
|
|
678
678
|
else if (n.kind === "nanoid")
|
|
679
|
-
|
|
679
|
+
ut.test(e.data) || (s = this._getOrReturnCtx(e, s), l(s, {
|
|
680
680
|
validation: "nanoid",
|
|
681
681
|
code: d.invalid_string,
|
|
682
682
|
message: n.message
|
|
683
683
|
}), t.dirty());
|
|
684
684
|
else if (n.kind === "cuid")
|
|
685
|
-
|
|
685
|
+
rt.test(e.data) || (s = this._getOrReturnCtx(e, s), l(s, {
|
|
686
686
|
validation: "cuid",
|
|
687
687
|
code: d.invalid_string,
|
|
688
688
|
message: n.message
|
|
689
689
|
}), t.dirty());
|
|
690
690
|
else if (n.kind === "cuid2")
|
|
691
|
-
|
|
691
|
+
ot.test(e.data) || (s = this._getOrReturnCtx(e, s), l(s, {
|
|
692
692
|
validation: "cuid2",
|
|
693
693
|
code: d.invalid_string,
|
|
694
694
|
message: n.message
|
|
695
695
|
}), t.dirty());
|
|
696
696
|
else if (n.kind === "ulid")
|
|
697
|
-
|
|
697
|
+
ct.test(e.data) || (s = this._getOrReturnCtx(e, s), l(s, {
|
|
698
698
|
validation: "ulid",
|
|
699
699
|
code: d.invalid_string,
|
|
700
700
|
message: n.message
|
|
@@ -725,43 +725,43 @@ class S extends y {
|
|
|
725
725
|
code: d.invalid_string,
|
|
726
726
|
validation: { endsWith: n.value },
|
|
727
727
|
message: n.message
|
|
728
|
-
}), t.dirty()) : n.kind === "datetime" ?
|
|
728
|
+
}), t.dirty()) : n.kind === "datetime" ? Je(n).test(e.data) || (s = this._getOrReturnCtx(e, s), l(s, {
|
|
729
729
|
code: d.invalid_string,
|
|
730
730
|
validation: "datetime",
|
|
731
731
|
message: n.message
|
|
732
|
-
}), t.dirty()) : n.kind === "date" ?
|
|
732
|
+
}), t.dirty()) : n.kind === "date" ? bt.test(e.data) || (s = this._getOrReturnCtx(e, s), l(s, {
|
|
733
733
|
code: d.invalid_string,
|
|
734
734
|
validation: "date",
|
|
735
735
|
message: n.message
|
|
736
|
-
}), t.dirty()) : n.kind === "time" ?
|
|
736
|
+
}), t.dirty()) : n.kind === "time" ? kt(n).test(e.data) || (s = this._getOrReturnCtx(e, s), l(s, {
|
|
737
737
|
code: d.invalid_string,
|
|
738
738
|
validation: "time",
|
|
739
739
|
message: n.message
|
|
740
|
-
}), t.dirty()) : n.kind === "duration" ?
|
|
740
|
+
}), t.dirty()) : n.kind === "duration" ? ht.test(e.data) || (s = this._getOrReturnCtx(e, s), l(s, {
|
|
741
741
|
validation: "duration",
|
|
742
742
|
code: d.invalid_string,
|
|
743
743
|
message: n.message
|
|
744
|
-
}), t.dirty()) : n.kind === "ip" ?
|
|
744
|
+
}), t.dirty()) : n.kind === "ip" ? xt(e.data, n.version) || (s = this._getOrReturnCtx(e, s), l(s, {
|
|
745
745
|
validation: "ip",
|
|
746
746
|
code: d.invalid_string,
|
|
747
747
|
message: n.message
|
|
748
|
-
}), t.dirty()) : n.kind === "jwt" ?
|
|
748
|
+
}), t.dirty()) : n.kind === "jwt" ? Zt(e.data, n.alg) || (s = this._getOrReturnCtx(e, s), l(s, {
|
|
749
749
|
validation: "jwt",
|
|
750
750
|
code: d.invalid_string,
|
|
751
751
|
message: n.message
|
|
752
|
-
}), t.dirty()) : n.kind === "cidr" ?
|
|
752
|
+
}), t.dirty()) : n.kind === "cidr" ? St(e.data, n.version) || (s = this._getOrReturnCtx(e, s), l(s, {
|
|
753
753
|
validation: "cidr",
|
|
754
754
|
code: d.invalid_string,
|
|
755
755
|
message: n.message
|
|
756
|
-
}), t.dirty()) : n.kind === "base64" ?
|
|
756
|
+
}), t.dirty()) : n.kind === "base64" ? vt.test(e.data) || (s = this._getOrReturnCtx(e, s), l(s, {
|
|
757
757
|
validation: "base64",
|
|
758
758
|
code: d.invalid_string,
|
|
759
759
|
message: n.message
|
|
760
|
-
}), t.dirty()) : n.kind === "base64url" ?
|
|
760
|
+
}), t.dirty()) : n.kind === "base64url" ? wt.test(e.data) || (s = this._getOrReturnCtx(e, s), l(s, {
|
|
761
761
|
validation: "base64url",
|
|
762
762
|
code: d.invalid_string,
|
|
763
763
|
message: n.message
|
|
764
|
-
}), t.dirty()) :
|
|
764
|
+
}), t.dirty()) : w.assertNever(n);
|
|
765
765
|
return { status: t.value, value: e.data };
|
|
766
766
|
}
|
|
767
767
|
_regex(e, t, s) {
|
|
@@ -772,7 +772,7 @@ class S extends y {
|
|
|
772
772
|
});
|
|
773
773
|
}
|
|
774
774
|
_addCheck(e) {
|
|
775
|
-
return new
|
|
775
|
+
return new N({
|
|
776
776
|
...this._def,
|
|
777
777
|
checks: [...this._def.checks, e]
|
|
778
778
|
});
|
|
@@ -909,19 +909,19 @@ class S extends y {
|
|
|
909
909
|
return this.min(1, p.errToObj(e));
|
|
910
910
|
}
|
|
911
911
|
trim() {
|
|
912
|
-
return new
|
|
912
|
+
return new N({
|
|
913
913
|
...this._def,
|
|
914
914
|
checks: [...this._def.checks, { kind: "trim" }]
|
|
915
915
|
});
|
|
916
916
|
}
|
|
917
917
|
toLowerCase() {
|
|
918
|
-
return new
|
|
918
|
+
return new N({
|
|
919
919
|
...this._def,
|
|
920
920
|
checks: [...this._def.checks, { kind: "toLowerCase" }]
|
|
921
921
|
});
|
|
922
922
|
}
|
|
923
923
|
toUpperCase() {
|
|
924
|
-
return new
|
|
924
|
+
return new N({
|
|
925
925
|
...this._def,
|
|
926
926
|
checks: [...this._def.checks, { kind: "toUpperCase" }]
|
|
927
927
|
});
|
|
@@ -987,20 +987,20 @@ class S extends y {
|
|
|
987
987
|
return e;
|
|
988
988
|
}
|
|
989
989
|
}
|
|
990
|
-
|
|
990
|
+
N.create = (a) => {
|
|
991
991
|
var e;
|
|
992
|
-
return new
|
|
992
|
+
return new N({
|
|
993
993
|
checks: [],
|
|
994
|
-
typeName:
|
|
994
|
+
typeName: m.ZodString,
|
|
995
995
|
coerce: (e = a == null ? void 0 : a.coerce) !== null && e !== void 0 ? e : !1,
|
|
996
996
|
...g(a)
|
|
997
997
|
});
|
|
998
998
|
};
|
|
999
|
-
function
|
|
999
|
+
function Tt(a, e) {
|
|
1000
1000
|
const t = (a.toString().split(".")[1] || "").length, s = (e.toString().split(".")[1] || "").length, n = t > s ? t : s, i = parseInt(a.toFixed(n).replace(".", "")), r = parseInt(e.toFixed(n).replace(".", ""));
|
|
1001
1001
|
return i % r / Math.pow(10, n);
|
|
1002
1002
|
}
|
|
1003
|
-
class
|
|
1003
|
+
class F extends _ {
|
|
1004
1004
|
constructor() {
|
|
1005
1005
|
super(...arguments), this.min = this.gte, this.max = this.lte, this.step = this.multipleOf;
|
|
1006
1006
|
}
|
|
@@ -1011,12 +1011,12 @@ class R extends y {
|
|
|
1011
1011
|
code: d.invalid_type,
|
|
1012
1012
|
expected: h.number,
|
|
1013
1013
|
received: n.parsedType
|
|
1014
|
-
}),
|
|
1014
|
+
}), y;
|
|
1015
1015
|
}
|
|
1016
1016
|
let t;
|
|
1017
|
-
const s = new
|
|
1017
|
+
const s = new x();
|
|
1018
1018
|
for (const n of this._def.checks)
|
|
1019
|
-
n.kind === "int" ?
|
|
1019
|
+
n.kind === "int" ? w.isInteger(e.data) || (t = this._getOrReturnCtx(e, t), l(t, {
|
|
1020
1020
|
code: d.invalid_type,
|
|
1021
1021
|
expected: "integer",
|
|
1022
1022
|
received: "float",
|
|
@@ -1035,14 +1035,14 @@ class R extends y {
|
|
|
1035
1035
|
inclusive: n.inclusive,
|
|
1036
1036
|
exact: !1,
|
|
1037
1037
|
message: n.message
|
|
1038
|
-
}), s.dirty()) : n.kind === "multipleOf" ?
|
|
1038
|
+
}), s.dirty()) : n.kind === "multipleOf" ? Tt(e.data, n.value) !== 0 && (t = this._getOrReturnCtx(e, t), l(t, {
|
|
1039
1039
|
code: d.not_multiple_of,
|
|
1040
1040
|
multipleOf: n.value,
|
|
1041
1041
|
message: n.message
|
|
1042
1042
|
}), s.dirty()) : n.kind === "finite" ? Number.isFinite(e.data) || (t = this._getOrReturnCtx(e, t), l(t, {
|
|
1043
1043
|
code: d.not_finite,
|
|
1044
1044
|
message: n.message
|
|
1045
|
-
}), s.dirty()) :
|
|
1045
|
+
}), s.dirty()) : w.assertNever(n);
|
|
1046
1046
|
return { status: s.value, value: e.data };
|
|
1047
1047
|
}
|
|
1048
1048
|
gte(e, t) {
|
|
@@ -1058,7 +1058,7 @@ class R extends y {
|
|
|
1058
1058
|
return this.setLimit("max", e, !1, p.toString(t));
|
|
1059
1059
|
}
|
|
1060
1060
|
setLimit(e, t, s, n) {
|
|
1061
|
-
return new
|
|
1061
|
+
return new F({
|
|
1062
1062
|
...this._def,
|
|
1063
1063
|
checks: [
|
|
1064
1064
|
...this._def.checks,
|
|
@@ -1072,7 +1072,7 @@ class R extends y {
|
|
|
1072
1072
|
});
|
|
1073
1073
|
}
|
|
1074
1074
|
_addCheck(e) {
|
|
1075
|
-
return new
|
|
1075
|
+
return new F({
|
|
1076
1076
|
...this._def,
|
|
1077
1077
|
checks: [...this._def.checks, e]
|
|
1078
1078
|
});
|
|
@@ -1154,7 +1154,7 @@ class R extends y {
|
|
|
1154
1154
|
return e;
|
|
1155
1155
|
}
|
|
1156
1156
|
get isInt() {
|
|
1157
|
-
return !!this._def.checks.find((e) => e.kind === "int" || e.kind === "multipleOf" &&
|
|
1157
|
+
return !!this._def.checks.find((e) => e.kind === "int" || e.kind === "multipleOf" && w.isInteger(e.value));
|
|
1158
1158
|
}
|
|
1159
1159
|
get isFinite() {
|
|
1160
1160
|
let e = null, t = null;
|
|
@@ -1166,13 +1166,13 @@ class R extends y {
|
|
|
1166
1166
|
return Number.isFinite(t) && Number.isFinite(e);
|
|
1167
1167
|
}
|
|
1168
1168
|
}
|
|
1169
|
-
|
|
1169
|
+
F.create = (a) => new F({
|
|
1170
1170
|
checks: [],
|
|
1171
|
-
typeName:
|
|
1171
|
+
typeName: m.ZodNumber,
|
|
1172
1172
|
coerce: (a == null ? void 0 : a.coerce) || !1,
|
|
1173
1173
|
...g(a)
|
|
1174
1174
|
});
|
|
1175
|
-
let
|
|
1175
|
+
let Q = class Re extends _ {
|
|
1176
1176
|
constructor() {
|
|
1177
1177
|
super(...arguments), this.min = this.gte, this.max = this.lte;
|
|
1178
1178
|
}
|
|
@@ -1186,7 +1186,7 @@ let ee = class Pe extends y {
|
|
|
1186
1186
|
if (this._getType(e) !== h.bigint)
|
|
1187
1187
|
return this._getInvalidInput(e);
|
|
1188
1188
|
let t;
|
|
1189
|
-
const s = new
|
|
1189
|
+
const s = new x();
|
|
1190
1190
|
for (const n of this._def.checks)
|
|
1191
1191
|
n.kind === "min" ? (n.inclusive ? e.data < n.value : e.data <= n.value) && (t = this._getOrReturnCtx(e, t), l(t, {
|
|
1192
1192
|
code: d.too_small,
|
|
@@ -1204,7 +1204,7 @@ let ee = class Pe extends y {
|
|
|
1204
1204
|
code: d.not_multiple_of,
|
|
1205
1205
|
multipleOf: n.value,
|
|
1206
1206
|
message: n.message
|
|
1207
|
-
}), s.dirty()) :
|
|
1207
|
+
}), s.dirty()) : w.assertNever(n);
|
|
1208
1208
|
return { status: s.value, value: e.data };
|
|
1209
1209
|
}
|
|
1210
1210
|
_getInvalidInput(e) {
|
|
@@ -1213,7 +1213,7 @@ let ee = class Pe extends y {
|
|
|
1213
1213
|
code: d.invalid_type,
|
|
1214
1214
|
expected: h.bigint,
|
|
1215
1215
|
received: t.parsedType
|
|
1216
|
-
}),
|
|
1216
|
+
}), y;
|
|
1217
1217
|
}
|
|
1218
1218
|
gte(e, t) {
|
|
1219
1219
|
return this.setLimit("min", e, !0, p.toString(t));
|
|
@@ -1228,7 +1228,7 @@ let ee = class Pe extends y {
|
|
|
1228
1228
|
return this.setLimit("max", e, !1, p.toString(t));
|
|
1229
1229
|
}
|
|
1230
1230
|
setLimit(e, t, s, n) {
|
|
1231
|
-
return new
|
|
1231
|
+
return new Re({
|
|
1232
1232
|
...this._def,
|
|
1233
1233
|
checks: [
|
|
1234
1234
|
...this._def.checks,
|
|
@@ -1242,7 +1242,7 @@ let ee = class Pe extends y {
|
|
|
1242
1242
|
});
|
|
1243
1243
|
}
|
|
1244
1244
|
_addCheck(e) {
|
|
1245
|
-
return new
|
|
1245
|
+
return new Re({
|
|
1246
1246
|
...this._def,
|
|
1247
1247
|
checks: [...this._def.checks, e]
|
|
1248
1248
|
});
|
|
@@ -1299,16 +1299,16 @@ let ee = class Pe extends y {
|
|
|
1299
1299
|
return e;
|
|
1300
1300
|
}
|
|
1301
1301
|
};
|
|
1302
|
-
|
|
1302
|
+
Q.create = (a) => {
|
|
1303
1303
|
var e;
|
|
1304
|
-
return new
|
|
1304
|
+
return new Q({
|
|
1305
1305
|
checks: [],
|
|
1306
|
-
typeName:
|
|
1306
|
+
typeName: m.ZodBigInt,
|
|
1307
1307
|
coerce: (e = a == null ? void 0 : a.coerce) !== null && e !== void 0 ? e : !1,
|
|
1308
1308
|
...g(a)
|
|
1309
1309
|
});
|
|
1310
1310
|
};
|
|
1311
|
-
class
|
|
1311
|
+
class ee extends _ {
|
|
1312
1312
|
_parse(e) {
|
|
1313
1313
|
if (this._def.coerce && (e.data = !!e.data), this._getType(e) !== h.boolean) {
|
|
1314
1314
|
const t = this._getOrReturnCtx(e);
|
|
@@ -1316,17 +1316,17 @@ class te extends y {
|
|
|
1316
1316
|
code: d.invalid_type,
|
|
1317
1317
|
expected: h.boolean,
|
|
1318
1318
|
received: t.parsedType
|
|
1319
|
-
}),
|
|
1319
|
+
}), y;
|
|
1320
1320
|
}
|
|
1321
|
-
return
|
|
1321
|
+
return k(e.data);
|
|
1322
1322
|
}
|
|
1323
1323
|
}
|
|
1324
|
-
|
|
1325
|
-
typeName:
|
|
1324
|
+
ee.create = (a) => new ee({
|
|
1325
|
+
typeName: m.ZodBoolean,
|
|
1326
1326
|
coerce: (a == null ? void 0 : a.coerce) || !1,
|
|
1327
1327
|
...g(a)
|
|
1328
1328
|
});
|
|
1329
|
-
class
|
|
1329
|
+
let te = class Ye extends _ {
|
|
1330
1330
|
_parse(e) {
|
|
1331
1331
|
if (this._def.coerce && (e.data = new Date(e.data)), this._getType(e) !== h.date) {
|
|
1332
1332
|
const n = this._getOrReturnCtx(e);
|
|
@@ -1334,15 +1334,15 @@ class q extends y {
|
|
|
1334
1334
|
code: d.invalid_type,
|
|
1335
1335
|
expected: h.date,
|
|
1336
1336
|
received: n.parsedType
|
|
1337
|
-
}),
|
|
1337
|
+
}), y;
|
|
1338
1338
|
}
|
|
1339
1339
|
if (isNaN(e.data.getTime())) {
|
|
1340
1340
|
const n = this._getOrReturnCtx(e);
|
|
1341
1341
|
return l(n, {
|
|
1342
1342
|
code: d.invalid_date
|
|
1343
|
-
}),
|
|
1343
|
+
}), y;
|
|
1344
1344
|
}
|
|
1345
|
-
const t = new
|
|
1345
|
+
const t = new x();
|
|
1346
1346
|
let s;
|
|
1347
1347
|
for (const n of this._def.checks)
|
|
1348
1348
|
n.kind === "min" ? e.data.getTime() < n.value && (s = this._getOrReturnCtx(e, s), l(s, {
|
|
@@ -1359,14 +1359,14 @@ class q extends y {
|
|
|
1359
1359
|
exact: !1,
|
|
1360
1360
|
maximum: n.value,
|
|
1361
1361
|
type: "date"
|
|
1362
|
-
}), t.dirty()) :
|
|
1362
|
+
}), t.dirty()) : w.assertNever(n);
|
|
1363
1363
|
return {
|
|
1364
1364
|
status: t.value,
|
|
1365
1365
|
value: new Date(e.data.getTime())
|
|
1366
1366
|
};
|
|
1367
1367
|
}
|
|
1368
1368
|
_addCheck(e) {
|
|
1369
|
-
return new
|
|
1369
|
+
return new Ye({
|
|
1370
1370
|
...this._def,
|
|
1371
1371
|
checks: [...this._def.checks, e]
|
|
1372
1372
|
});
|
|
@@ -1397,14 +1397,14 @@ class q extends y {
|
|
|
1397
1397
|
t.kind === "max" && (e === null || t.value < e) && (e = t.value);
|
|
1398
1398
|
return e != null ? new Date(e) : null;
|
|
1399
1399
|
}
|
|
1400
|
-
}
|
|
1401
|
-
|
|
1400
|
+
};
|
|
1401
|
+
te.create = (a) => new te({
|
|
1402
1402
|
checks: [],
|
|
1403
1403
|
coerce: (a == null ? void 0 : a.coerce) || !1,
|
|
1404
|
-
typeName:
|
|
1404
|
+
typeName: m.ZodDate,
|
|
1405
1405
|
...g(a)
|
|
1406
1406
|
});
|
|
1407
|
-
class
|
|
1407
|
+
class Ze extends _ {
|
|
1408
1408
|
_parse(e) {
|
|
1409
1409
|
if (this._getType(e) !== h.symbol) {
|
|
1410
1410
|
const t = this._getOrReturnCtx(e);
|
|
@@ -1412,16 +1412,16 @@ class xe extends y {
|
|
|
1412
1412
|
code: d.invalid_type,
|
|
1413
1413
|
expected: h.symbol,
|
|
1414
1414
|
received: t.parsedType
|
|
1415
|
-
}),
|
|
1415
|
+
}), y;
|
|
1416
1416
|
}
|
|
1417
|
-
return
|
|
1417
|
+
return k(e.data);
|
|
1418
1418
|
}
|
|
1419
1419
|
}
|
|
1420
|
-
|
|
1421
|
-
typeName:
|
|
1420
|
+
Ze.create = (a) => new Ze({
|
|
1421
|
+
typeName: m.ZodSymbol,
|
|
1422
1422
|
...g(a)
|
|
1423
1423
|
});
|
|
1424
|
-
class se extends
|
|
1424
|
+
class se extends _ {
|
|
1425
1425
|
_parse(e) {
|
|
1426
1426
|
if (this._getType(e) !== h.undefined) {
|
|
1427
1427
|
const t = this._getOrReturnCtx(e);
|
|
@@ -1429,16 +1429,16 @@ class se extends y {
|
|
|
1429
1429
|
code: d.invalid_type,
|
|
1430
1430
|
expected: h.undefined,
|
|
1431
1431
|
received: t.parsedType
|
|
1432
|
-
}),
|
|
1432
|
+
}), y;
|
|
1433
1433
|
}
|
|
1434
|
-
return
|
|
1434
|
+
return k(e.data);
|
|
1435
1435
|
}
|
|
1436
1436
|
}
|
|
1437
1437
|
se.create = (a) => new se({
|
|
1438
|
-
typeName:
|
|
1438
|
+
typeName: m.ZodUndefined,
|
|
1439
1439
|
...g(a)
|
|
1440
1440
|
});
|
|
1441
|
-
class ae extends
|
|
1441
|
+
class ae extends _ {
|
|
1442
1442
|
_parse(e) {
|
|
1443
1443
|
if (this._getType(e) !== h.null) {
|
|
1444
1444
|
const t = this._getOrReturnCtx(e);
|
|
@@ -1446,54 +1446,54 @@ class ae extends y {
|
|
|
1446
1446
|
code: d.invalid_type,
|
|
1447
1447
|
expected: h.null,
|
|
1448
1448
|
received: t.parsedType
|
|
1449
|
-
}),
|
|
1449
|
+
}), y;
|
|
1450
1450
|
}
|
|
1451
|
-
return
|
|
1451
|
+
return k(e.data);
|
|
1452
1452
|
}
|
|
1453
1453
|
}
|
|
1454
1454
|
ae.create = (a) => new ae({
|
|
1455
|
-
typeName:
|
|
1455
|
+
typeName: m.ZodNull,
|
|
1456
1456
|
...g(a)
|
|
1457
1457
|
});
|
|
1458
|
-
let
|
|
1458
|
+
let K = class extends _ {
|
|
1459
1459
|
constructor() {
|
|
1460
1460
|
super(...arguments), this._any = !0;
|
|
1461
1461
|
}
|
|
1462
1462
|
_parse(e) {
|
|
1463
|
-
return
|
|
1463
|
+
return k(e.data);
|
|
1464
1464
|
}
|
|
1465
1465
|
};
|
|
1466
|
-
|
|
1467
|
-
typeName:
|
|
1466
|
+
K.create = (a) => new K({
|
|
1467
|
+
typeName: m.ZodAny,
|
|
1468
1468
|
...g(a)
|
|
1469
1469
|
});
|
|
1470
|
-
class
|
|
1470
|
+
class q extends _ {
|
|
1471
1471
|
constructor() {
|
|
1472
1472
|
super(...arguments), this._unknown = !0;
|
|
1473
1473
|
}
|
|
1474
1474
|
_parse(e) {
|
|
1475
|
-
return
|
|
1475
|
+
return k(e.data);
|
|
1476
1476
|
}
|
|
1477
1477
|
}
|
|
1478
|
-
|
|
1479
|
-
typeName:
|
|
1478
|
+
q.create = (a) => new q({
|
|
1479
|
+
typeName: m.ZodUnknown,
|
|
1480
1480
|
...g(a)
|
|
1481
1481
|
});
|
|
1482
|
-
class
|
|
1482
|
+
let P = class extends _ {
|
|
1483
1483
|
_parse(e) {
|
|
1484
1484
|
const t = this._getOrReturnCtx(e);
|
|
1485
1485
|
return l(t, {
|
|
1486
1486
|
code: d.invalid_type,
|
|
1487
1487
|
expected: h.never,
|
|
1488
1488
|
received: t.parsedType
|
|
1489
|
-
}),
|
|
1489
|
+
}), y;
|
|
1490
1490
|
}
|
|
1491
|
-
}
|
|
1492
|
-
|
|
1493
|
-
typeName:
|
|
1491
|
+
};
|
|
1492
|
+
P.create = (a) => new P({
|
|
1493
|
+
typeName: m.ZodNever,
|
|
1494
1494
|
...g(a)
|
|
1495
1495
|
});
|
|
1496
|
-
class
|
|
1496
|
+
class Se extends _ {
|
|
1497
1497
|
_parse(e) {
|
|
1498
1498
|
if (this._getType(e) !== h.undefined) {
|
|
1499
1499
|
const t = this._getOrReturnCtx(e);
|
|
@@ -1501,16 +1501,16 @@ class Ze extends y {
|
|
|
1501
1501
|
code: d.invalid_type,
|
|
1502
1502
|
expected: h.void,
|
|
1503
1503
|
received: t.parsedType
|
|
1504
|
-
}),
|
|
1504
|
+
}), y;
|
|
1505
1505
|
}
|
|
1506
|
-
return
|
|
1506
|
+
return k(e.data);
|
|
1507
1507
|
}
|
|
1508
1508
|
}
|
|
1509
|
-
|
|
1510
|
-
typeName:
|
|
1509
|
+
Se.create = (a) => new Se({
|
|
1510
|
+
typeName: m.ZodVoid,
|
|
1511
1511
|
...g(a)
|
|
1512
1512
|
});
|
|
1513
|
-
let
|
|
1513
|
+
let V = class _e extends _ {
|
|
1514
1514
|
_parse(e) {
|
|
1515
1515
|
const { ctx: t, status: s } = this._processInputParams(e), n = this._def;
|
|
1516
1516
|
if (t.parsedType !== h.array)
|
|
@@ -1518,7 +1518,7 @@ let B = class ye extends y {
|
|
|
1518
1518
|
code: d.invalid_type,
|
|
1519
1519
|
expected: h.array,
|
|
1520
1520
|
received: t.parsedType
|
|
1521
|
-
}),
|
|
1521
|
+
}), y;
|
|
1522
1522
|
if (n.exactLength !== null) {
|
|
1523
1523
|
const r = t.data.length > n.exactLength.value, o = t.data.length < n.exactLength.value;
|
|
1524
1524
|
(r || o) && (l(t, {
|
|
@@ -1546,27 +1546,27 @@ let B = class ye extends y {
|
|
|
1546
1546
|
exact: !1,
|
|
1547
1547
|
message: n.maxLength.message
|
|
1548
1548
|
}), s.dirty()), t.common.async)
|
|
1549
|
-
return Promise.all([...t.data].map((r, o) => n.type._parseAsync(new
|
|
1550
|
-
const i = [...t.data].map((r, o) => n.type._parseSync(new
|
|
1551
|
-
return
|
|
1549
|
+
return Promise.all([...t.data].map((r, o) => n.type._parseAsync(new E(t, r, t.path, o)))).then((r) => x.mergeArray(s, r));
|
|
1550
|
+
const i = [...t.data].map((r, o) => n.type._parseSync(new E(t, r, t.path, o)));
|
|
1551
|
+
return x.mergeArray(s, i);
|
|
1552
1552
|
}
|
|
1553
1553
|
get element() {
|
|
1554
1554
|
return this._def.type;
|
|
1555
1555
|
}
|
|
1556
1556
|
min(e, t) {
|
|
1557
|
-
return new
|
|
1557
|
+
return new _e({
|
|
1558
1558
|
...this._def,
|
|
1559
1559
|
minLength: { value: e, message: p.toString(t) }
|
|
1560
1560
|
});
|
|
1561
1561
|
}
|
|
1562
1562
|
max(e, t) {
|
|
1563
|
-
return new
|
|
1563
|
+
return new _e({
|
|
1564
1564
|
...this._def,
|
|
1565
1565
|
maxLength: { value: e, message: p.toString(t) }
|
|
1566
1566
|
});
|
|
1567
1567
|
}
|
|
1568
1568
|
length(e, t) {
|
|
1569
|
-
return new
|
|
1569
|
+
return new _e({
|
|
1570
1570
|
...this._def,
|
|
1571
1571
|
exactLength: { value: e, message: p.toString(t) }
|
|
1572
1572
|
});
|
|
@@ -1575,38 +1575,38 @@ let B = class ye extends y {
|
|
|
1575
1575
|
return this.min(1, e);
|
|
1576
1576
|
}
|
|
1577
1577
|
};
|
|
1578
|
-
|
|
1578
|
+
V.create = (a, e) => new V({
|
|
1579
1579
|
type: a,
|
|
1580
1580
|
minLength: null,
|
|
1581
1581
|
maxLength: null,
|
|
1582
1582
|
exactLength: null,
|
|
1583
|
-
typeName:
|
|
1583
|
+
typeName: m.ZodArray,
|
|
1584
1584
|
...g(e)
|
|
1585
1585
|
});
|
|
1586
|
-
function
|
|
1587
|
-
if (a instanceof
|
|
1586
|
+
function H(a) {
|
|
1587
|
+
if (a instanceof S) {
|
|
1588
1588
|
const e = {};
|
|
1589
1589
|
for (const t in a.shape) {
|
|
1590
1590
|
const s = a.shape[t];
|
|
1591
|
-
e[t] = O.create(
|
|
1591
|
+
e[t] = O.create(H(s));
|
|
1592
1592
|
}
|
|
1593
|
-
return new
|
|
1593
|
+
return new S({
|
|
1594
1594
|
...a._def,
|
|
1595
1595
|
shape: () => e
|
|
1596
1596
|
});
|
|
1597
|
-
} else return a instanceof
|
|
1597
|
+
} else return a instanceof V ? new V({
|
|
1598
1598
|
...a._def,
|
|
1599
|
-
type:
|
|
1600
|
-
}) : a instanceof O ? O.create(
|
|
1599
|
+
type: H(a.element)
|
|
1600
|
+
}) : a instanceof O ? O.create(H(a.unwrap())) : a instanceof M ? M.create(H(a.unwrap())) : a instanceof I ? I.create(a.items.map((e) => H(e))) : a;
|
|
1601
1601
|
}
|
|
1602
|
-
class
|
|
1602
|
+
let S = class T extends _ {
|
|
1603
1603
|
constructor() {
|
|
1604
1604
|
super(...arguments), this._cached = null, this.nonstrict = this.passthrough, this.augment = this.extend;
|
|
1605
1605
|
}
|
|
1606
1606
|
_getCached() {
|
|
1607
1607
|
if (this._cached !== null)
|
|
1608
1608
|
return this._cached;
|
|
1609
|
-
const e = this._def.shape(), t =
|
|
1609
|
+
const e = this._def.shape(), t = w.objectKeys(e);
|
|
1610
1610
|
return this._cached = { shape: e, keys: t };
|
|
1611
1611
|
}
|
|
1612
1612
|
_parse(e) {
|
|
@@ -1616,22 +1616,22 @@ class k extends y {
|
|
|
1616
1616
|
code: d.invalid_type,
|
|
1617
1617
|
expected: h.object,
|
|
1618
1618
|
received: c.parsedType
|
|
1619
|
-
}),
|
|
1619
|
+
}), y;
|
|
1620
1620
|
}
|
|
1621
1621
|
const { status: t, ctx: s } = this._processInputParams(e), { shape: n, keys: i } = this._getCached(), r = [];
|
|
1622
|
-
if (!(this._def.catchall instanceof
|
|
1622
|
+
if (!(this._def.catchall instanceof P && this._def.unknownKeys === "strip"))
|
|
1623
1623
|
for (const c in s.data)
|
|
1624
1624
|
i.includes(c) || r.push(c);
|
|
1625
1625
|
const o = [];
|
|
1626
1626
|
for (const c of i) {
|
|
1627
|
-
const u = n[c],
|
|
1627
|
+
const u = n[c], f = s.data[c];
|
|
1628
1628
|
o.push({
|
|
1629
1629
|
key: { status: "valid", value: c },
|
|
1630
|
-
value: u._parse(new
|
|
1630
|
+
value: u._parse(new E(s, f, s.path, c)),
|
|
1631
1631
|
alwaysSet: c in s.data
|
|
1632
1632
|
});
|
|
1633
1633
|
}
|
|
1634
|
-
if (this._def.catchall instanceof
|
|
1634
|
+
if (this._def.catchall instanceof P) {
|
|
1635
1635
|
const c = this._def.unknownKeys;
|
|
1636
1636
|
if (c === "passthrough")
|
|
1637
1637
|
for (const u of r)
|
|
@@ -1648,11 +1648,11 @@ class k extends y {
|
|
|
1648
1648
|
} else {
|
|
1649
1649
|
const c = this._def.catchall;
|
|
1650
1650
|
for (const u of r) {
|
|
1651
|
-
const
|
|
1651
|
+
const f = s.data[u];
|
|
1652
1652
|
o.push({
|
|
1653
1653
|
key: { status: "valid", value: u },
|
|
1654
1654
|
value: c._parse(
|
|
1655
|
-
new
|
|
1655
|
+
new E(s, f, s.path, u)
|
|
1656
1656
|
//, ctx.child(key), value, getParsedType(value)
|
|
1657
1657
|
),
|
|
1658
1658
|
alwaysSet: u in s.data
|
|
@@ -1662,21 +1662,21 @@ class k extends y {
|
|
|
1662
1662
|
return s.common.async ? Promise.resolve().then(async () => {
|
|
1663
1663
|
const c = [];
|
|
1664
1664
|
for (const u of o) {
|
|
1665
|
-
const
|
|
1665
|
+
const f = await u.key, b = await u.value;
|
|
1666
1666
|
c.push({
|
|
1667
|
-
key:
|
|
1668
|
-
value:
|
|
1667
|
+
key: f,
|
|
1668
|
+
value: b,
|
|
1669
1669
|
alwaysSet: u.alwaysSet
|
|
1670
1670
|
});
|
|
1671
1671
|
}
|
|
1672
1672
|
return c;
|
|
1673
|
-
}).then((c) =>
|
|
1673
|
+
}).then((c) => x.mergeObjectSync(t, c)) : x.mergeObjectSync(t, o);
|
|
1674
1674
|
}
|
|
1675
1675
|
get shape() {
|
|
1676
1676
|
return this._def.shape();
|
|
1677
1677
|
}
|
|
1678
1678
|
strict(e) {
|
|
1679
|
-
return p.errToObj, new
|
|
1679
|
+
return p.errToObj, new T({
|
|
1680
1680
|
...this._def,
|
|
1681
1681
|
unknownKeys: "strict",
|
|
1682
1682
|
...e !== void 0 ? {
|
|
@@ -1693,13 +1693,13 @@ class k extends y {
|
|
|
1693
1693
|
});
|
|
1694
1694
|
}
|
|
1695
1695
|
strip() {
|
|
1696
|
-
return new
|
|
1696
|
+
return new T({
|
|
1697
1697
|
...this._def,
|
|
1698
1698
|
unknownKeys: "strip"
|
|
1699
1699
|
});
|
|
1700
1700
|
}
|
|
1701
1701
|
passthrough() {
|
|
1702
|
-
return new
|
|
1702
|
+
return new T({
|
|
1703
1703
|
...this._def,
|
|
1704
1704
|
unknownKeys: "passthrough"
|
|
1705
1705
|
});
|
|
@@ -1722,7 +1722,7 @@ class k extends y {
|
|
|
1722
1722
|
// }) as any;
|
|
1723
1723
|
// };
|
|
1724
1724
|
extend(e) {
|
|
1725
|
-
return new
|
|
1725
|
+
return new T({
|
|
1726
1726
|
...this._def,
|
|
1727
1727
|
shape: () => ({
|
|
1728
1728
|
...this._def.shape(),
|
|
@@ -1736,14 +1736,14 @@ class k extends y {
|
|
|
1736
1736
|
* upgrade if you are experiencing issues.
|
|
1737
1737
|
*/
|
|
1738
1738
|
merge(e) {
|
|
1739
|
-
return new
|
|
1739
|
+
return new T({
|
|
1740
1740
|
unknownKeys: e._def.unknownKeys,
|
|
1741
1741
|
catchall: e._def.catchall,
|
|
1742
1742
|
shape: () => ({
|
|
1743
1743
|
...this._def.shape(),
|
|
1744
1744
|
...e._def.shape()
|
|
1745
1745
|
}),
|
|
1746
|
-
typeName:
|
|
1746
|
+
typeName: m.ZodObject
|
|
1747
1747
|
});
|
|
1748
1748
|
}
|
|
1749
1749
|
// merge<
|
|
@@ -1806,25 +1806,25 @@ class k extends y {
|
|
|
1806
1806
|
// return merged;
|
|
1807
1807
|
// }
|
|
1808
1808
|
catchall(e) {
|
|
1809
|
-
return new
|
|
1809
|
+
return new T({
|
|
1810
1810
|
...this._def,
|
|
1811
1811
|
catchall: e
|
|
1812
1812
|
});
|
|
1813
1813
|
}
|
|
1814
1814
|
pick(e) {
|
|
1815
1815
|
const t = {};
|
|
1816
|
-
return
|
|
1816
|
+
return w.objectKeys(e).forEach((s) => {
|
|
1817
1817
|
e[s] && this.shape[s] && (t[s] = this.shape[s]);
|
|
1818
|
-
}), new
|
|
1818
|
+
}), new T({
|
|
1819
1819
|
...this._def,
|
|
1820
1820
|
shape: () => t
|
|
1821
1821
|
});
|
|
1822
1822
|
}
|
|
1823
1823
|
omit(e) {
|
|
1824
1824
|
const t = {};
|
|
1825
|
-
return
|
|
1825
|
+
return w.objectKeys(this.shape).forEach((s) => {
|
|
1826
1826
|
e[s] || (t[s] = this.shape[s]);
|
|
1827
|
-
}), new
|
|
1827
|
+
}), new T({
|
|
1828
1828
|
...this._def,
|
|
1829
1829
|
shape: () => t
|
|
1830
1830
|
});
|
|
@@ -1833,21 +1833,21 @@ class k extends y {
|
|
|
1833
1833
|
* @deprecated
|
|
1834
1834
|
*/
|
|
1835
1835
|
deepPartial() {
|
|
1836
|
-
return
|
|
1836
|
+
return H(this);
|
|
1837
1837
|
}
|
|
1838
1838
|
partial(e) {
|
|
1839
1839
|
const t = {};
|
|
1840
|
-
return
|
|
1840
|
+
return w.objectKeys(this.shape).forEach((s) => {
|
|
1841
1841
|
const n = this.shape[s];
|
|
1842
1842
|
e && !e[s] ? t[s] = n : t[s] = n.optional();
|
|
1843
|
-
}), new
|
|
1843
|
+
}), new T({
|
|
1844
1844
|
...this._def,
|
|
1845
1845
|
shape: () => t
|
|
1846
1846
|
});
|
|
1847
1847
|
}
|
|
1848
1848
|
required(e) {
|
|
1849
1849
|
const t = {};
|
|
1850
|
-
return
|
|
1850
|
+
return w.objectKeys(this.shape).forEach((s) => {
|
|
1851
1851
|
if (e && !e[s])
|
|
1852
1852
|
t[s] = this.shape[s];
|
|
1853
1853
|
else {
|
|
@@ -1856,37 +1856,37 @@ class k extends y {
|
|
|
1856
1856
|
n = n._def.innerType;
|
|
1857
1857
|
t[s] = n;
|
|
1858
1858
|
}
|
|
1859
|
-
}), new
|
|
1859
|
+
}), new T({
|
|
1860
1860
|
...this._def,
|
|
1861
1861
|
shape: () => t
|
|
1862
1862
|
});
|
|
1863
1863
|
}
|
|
1864
1864
|
keyof() {
|
|
1865
|
-
return
|
|
1865
|
+
return Xe(w.objectKeys(this.shape));
|
|
1866
1866
|
}
|
|
1867
|
-
}
|
|
1868
|
-
|
|
1867
|
+
};
|
|
1868
|
+
S.create = (a, e) => new S({
|
|
1869
1869
|
shape: () => a,
|
|
1870
1870
|
unknownKeys: "strip",
|
|
1871
|
-
catchall:
|
|
1872
|
-
typeName:
|
|
1871
|
+
catchall: P.create(),
|
|
1872
|
+
typeName: m.ZodObject,
|
|
1873
1873
|
...g(e)
|
|
1874
1874
|
});
|
|
1875
|
-
|
|
1875
|
+
S.strictCreate = (a, e) => new S({
|
|
1876
1876
|
shape: () => a,
|
|
1877
1877
|
unknownKeys: "strict",
|
|
1878
|
-
catchall:
|
|
1879
|
-
typeName:
|
|
1878
|
+
catchall: P.create(),
|
|
1879
|
+
typeName: m.ZodObject,
|
|
1880
1880
|
...g(e)
|
|
1881
1881
|
});
|
|
1882
|
-
|
|
1882
|
+
S.lazycreate = (a, e) => new S({
|
|
1883
1883
|
shape: a,
|
|
1884
1884
|
unknownKeys: "strip",
|
|
1885
|
-
catchall:
|
|
1886
|
-
typeName:
|
|
1885
|
+
catchall: P.create(),
|
|
1886
|
+
typeName: m.ZodObject,
|
|
1887
1887
|
...g(e)
|
|
1888
1888
|
});
|
|
1889
|
-
class ne extends
|
|
1889
|
+
class ne extends _ {
|
|
1890
1890
|
_parse(e) {
|
|
1891
1891
|
const { ctx: t } = this._processInputParams(e), s = this._def.options;
|
|
1892
1892
|
function n(i) {
|
|
@@ -1896,11 +1896,11 @@ class ne extends y {
|
|
|
1896
1896
|
for (const o of i)
|
|
1897
1897
|
if (o.result.status === "dirty")
|
|
1898
1898
|
return t.common.issues.push(...o.ctx.common.issues), o.result;
|
|
1899
|
-
const r = i.map((o) => new
|
|
1899
|
+
const r = i.map((o) => new C(o.ctx.common.issues));
|
|
1900
1900
|
return l(t, {
|
|
1901
1901
|
code: d.invalid_union,
|
|
1902
1902
|
unionErrors: r
|
|
1903
|
-
}),
|
|
1903
|
+
}), y;
|
|
1904
1904
|
}
|
|
1905
1905
|
if (t.common.async)
|
|
1906
1906
|
return Promise.all(s.map(async (i) => {
|
|
@@ -1932,22 +1932,22 @@ class ne extends y {
|
|
|
1932
1932
|
issues: []
|
|
1933
1933
|
},
|
|
1934
1934
|
parent: null
|
|
1935
|
-
},
|
|
1935
|
+
}, f = c._parseSync({
|
|
1936
1936
|
data: t.data,
|
|
1937
1937
|
path: t.path,
|
|
1938
1938
|
parent: u
|
|
1939
1939
|
});
|
|
1940
|
-
if (
|
|
1941
|
-
return
|
|
1942
|
-
|
|
1940
|
+
if (f.status === "valid")
|
|
1941
|
+
return f;
|
|
1942
|
+
f.status === "dirty" && !i && (i = { result: f, ctx: u }), u.common.issues.length && r.push(u.common.issues);
|
|
1943
1943
|
}
|
|
1944
1944
|
if (i)
|
|
1945
1945
|
return t.common.issues.push(...i.ctx.common.issues), i.result;
|
|
1946
|
-
const o = r.map((c) => new
|
|
1946
|
+
const o = r.map((c) => new C(c));
|
|
1947
1947
|
return l(t, {
|
|
1948
1948
|
code: d.invalid_union,
|
|
1949
1949
|
unionErrors: o
|
|
1950
|
-
}),
|
|
1950
|
+
}), y;
|
|
1951
1951
|
}
|
|
1952
1952
|
}
|
|
1953
1953
|
get options() {
|
|
@@ -1956,11 +1956,11 @@ class ne extends y {
|
|
|
1956
1956
|
}
|
|
1957
1957
|
ne.create = (a, e) => new ne({
|
|
1958
1958
|
options: a,
|
|
1959
|
-
typeName:
|
|
1959
|
+
typeName: m.ZodUnion,
|
|
1960
1960
|
...g(e)
|
|
1961
1961
|
});
|
|
1962
|
-
const
|
|
1963
|
-
class
|
|
1962
|
+
const R = (a) => a instanceof oe ? R(a.schema) : a instanceof A ? R(a.innerType()) : a instanceof ce ? [a.value] : a instanceof pe ? a.options : a instanceof de ? w.objectValues(a.enum) : a instanceof ue ? R(a._def.innerType) : a instanceof se ? [void 0] : a instanceof ae ? [null] : a instanceof O ? [void 0, ...R(a.unwrap())] : a instanceof M ? [null, ...R(a.unwrap())] : a instanceof De || a instanceof he ? R(a.unwrap()) : a instanceof le ? R(a._def.innerType) : [];
|
|
1963
|
+
class Ce extends _ {
|
|
1964
1964
|
_parse(e) {
|
|
1965
1965
|
const { ctx: t } = this._processInputParams(e);
|
|
1966
1966
|
if (t.parsedType !== h.object)
|
|
@@ -1968,7 +1968,7 @@ class Ne extends y {
|
|
|
1968
1968
|
code: d.invalid_type,
|
|
1969
1969
|
expected: h.object,
|
|
1970
1970
|
received: t.parsedType
|
|
1971
|
-
}),
|
|
1971
|
+
}), y;
|
|
1972
1972
|
const s = this.discriminator, n = t.data[s], i = this.optionsMap.get(n);
|
|
1973
1973
|
return i ? t.common.async ? i._parseAsync({
|
|
1974
1974
|
data: t.data,
|
|
@@ -1982,7 +1982,7 @@ class Ne extends y {
|
|
|
1982
1982
|
code: d.invalid_union_discriminator,
|
|
1983
1983
|
options: Array.from(this.optionsMap.keys()),
|
|
1984
1984
|
path: [s]
|
|
1985
|
-
}),
|
|
1985
|
+
}), y);
|
|
1986
1986
|
}
|
|
1987
1987
|
get discriminator() {
|
|
1988
1988
|
return this._def.discriminator;
|
|
@@ -2004,7 +2004,7 @@ class Ne extends y {
|
|
|
2004
2004
|
static create(e, t, s) {
|
|
2005
2005
|
const n = /* @__PURE__ */ new Map();
|
|
2006
2006
|
for (const i of t) {
|
|
2007
|
-
const r =
|
|
2007
|
+
const r = R(i.shape[e]);
|
|
2008
2008
|
if (!r.length)
|
|
2009
2009
|
throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);
|
|
2010
2010
|
for (const o of r) {
|
|
@@ -2013,8 +2013,8 @@ class Ne extends y {
|
|
|
2013
2013
|
n.set(o, i);
|
|
2014
2014
|
}
|
|
2015
2015
|
}
|
|
2016
|
-
return new
|
|
2017
|
-
typeName:
|
|
2016
|
+
return new Ce({
|
|
2017
|
+
typeName: m.ZodDiscriminatedUnion,
|
|
2018
2018
|
discriminator: e,
|
|
2019
2019
|
options: t,
|
|
2020
2020
|
optionsMap: n,
|
|
@@ -2022,14 +2022,14 @@ class Ne extends y {
|
|
|
2022
2022
|
});
|
|
2023
2023
|
}
|
|
2024
2024
|
}
|
|
2025
|
-
function
|
|
2026
|
-
const t =
|
|
2025
|
+
function Fe(a, e) {
|
|
2026
|
+
const t = $(a), s = $(e);
|
|
2027
2027
|
if (a === e)
|
|
2028
2028
|
return { valid: !0, data: a };
|
|
2029
2029
|
if (t === h.object && s === h.object) {
|
|
2030
|
-
const n =
|
|
2030
|
+
const n = w.objectKeys(e), i = w.objectKeys(a).filter((o) => n.indexOf(o) !== -1), r = { ...a, ...e };
|
|
2031
2031
|
for (const o of i) {
|
|
2032
|
-
const c =
|
|
2032
|
+
const c = Fe(a[o], e[o]);
|
|
2033
2033
|
if (!c.valid)
|
|
2034
2034
|
return { valid: !1 };
|
|
2035
2035
|
r[o] = c.data;
|
|
@@ -2040,7 +2040,7 @@ function Re(a, e) {
|
|
|
2040
2040
|
return { valid: !1 };
|
|
2041
2041
|
const n = [];
|
|
2042
2042
|
for (let i = 0; i < a.length; i++) {
|
|
2043
|
-
const r = a[i], o = e[i], c =
|
|
2043
|
+
const r = a[i], o = e[i], c = Fe(r, o);
|
|
2044
2044
|
if (!c.valid)
|
|
2045
2045
|
return { valid: !1 };
|
|
2046
2046
|
n.push(c.data);
|
|
@@ -2048,15 +2048,15 @@ function Re(a, e) {
|
|
|
2048
2048
|
return { valid: !0, data: n };
|
|
2049
2049
|
} else return t === h.date && s === h.date && +a == +e ? { valid: !0, data: a } : { valid: !1 };
|
|
2050
2050
|
}
|
|
2051
|
-
class ie extends
|
|
2051
|
+
class ie extends _ {
|
|
2052
2052
|
_parse(e) {
|
|
2053
2053
|
const { status: t, ctx: s } = this._processInputParams(e), n = (i, r) => {
|
|
2054
|
-
if (
|
|
2055
|
-
return
|
|
2056
|
-
const o =
|
|
2057
|
-
return o.valid ? ((
|
|
2054
|
+
if ($e(i) || $e(r))
|
|
2055
|
+
return y;
|
|
2056
|
+
const o = Fe(i.value, r.value);
|
|
2057
|
+
return o.valid ? ((Pe(i) || Pe(r)) && t.dirty(), { status: t.value, value: o.data }) : (l(s, {
|
|
2058
2058
|
code: d.invalid_intersection_types
|
|
2059
|
-
}),
|
|
2059
|
+
}), y);
|
|
2060
2060
|
};
|
|
2061
2061
|
return s.common.async ? Promise.all([
|
|
2062
2062
|
this._def.left._parseAsync({
|
|
@@ -2083,10 +2083,10 @@ class ie extends y {
|
|
|
2083
2083
|
ie.create = (a, e, t) => new ie({
|
|
2084
2084
|
left: a,
|
|
2085
2085
|
right: e,
|
|
2086
|
-
typeName:
|
|
2086
|
+
typeName: m.ZodIntersection,
|
|
2087
2087
|
...g(t)
|
|
2088
2088
|
});
|
|
2089
|
-
class I extends
|
|
2089
|
+
class I extends _ {
|
|
2090
2090
|
_parse(e) {
|
|
2091
2091
|
const { status: t, ctx: s } = this._processInputParams(e);
|
|
2092
2092
|
if (s.parsedType !== h.array)
|
|
@@ -2094,7 +2094,7 @@ class I extends y {
|
|
|
2094
2094
|
code: d.invalid_type,
|
|
2095
2095
|
expected: h.array,
|
|
2096
2096
|
received: s.parsedType
|
|
2097
|
-
}),
|
|
2097
|
+
}), y;
|
|
2098
2098
|
if (s.data.length < this._def.items.length)
|
|
2099
2099
|
return l(s, {
|
|
2100
2100
|
code: d.too_small,
|
|
@@ -2102,7 +2102,7 @@ class I extends y {
|
|
|
2102
2102
|
inclusive: !0,
|
|
2103
2103
|
exact: !1,
|
|
2104
2104
|
type: "array"
|
|
2105
|
-
}),
|
|
2105
|
+
}), y;
|
|
2106
2106
|
!this._def.rest && s.data.length > this._def.items.length && (l(s, {
|
|
2107
2107
|
code: d.too_big,
|
|
2108
2108
|
maximum: this._def.items.length,
|
|
@@ -2112,9 +2112,9 @@ class I extends y {
|
|
|
2112
2112
|
}), t.dirty());
|
|
2113
2113
|
const n = [...s.data].map((i, r) => {
|
|
2114
2114
|
const o = this._def.items[r] || this._def.rest;
|
|
2115
|
-
return o ? o._parse(new
|
|
2115
|
+
return o ? o._parse(new E(s, i, s.path, r)) : null;
|
|
2116
2116
|
}).filter((i) => !!i);
|
|
2117
|
-
return s.common.async ? Promise.all(n).then((i) =>
|
|
2117
|
+
return s.common.async ? Promise.all(n).then((i) => x.mergeArray(t, i)) : x.mergeArray(t, n);
|
|
2118
2118
|
}
|
|
2119
2119
|
get items() {
|
|
2120
2120
|
return this._def.items;
|
|
@@ -2131,12 +2131,12 @@ I.create = (a, e) => {
|
|
|
2131
2131
|
throw new Error("You must pass an array of schemas to z.tuple([ ... ])");
|
|
2132
2132
|
return new I({
|
|
2133
2133
|
items: a,
|
|
2134
|
-
typeName:
|
|
2134
|
+
typeName: m.ZodTuple,
|
|
2135
2135
|
rest: null,
|
|
2136
2136
|
...g(e)
|
|
2137
2137
|
});
|
|
2138
2138
|
};
|
|
2139
|
-
class re extends
|
|
2139
|
+
class re extends _ {
|
|
2140
2140
|
get keySchema() {
|
|
2141
2141
|
return this._def.keyType;
|
|
2142
2142
|
}
|
|
@@ -2150,34 +2150,34 @@ class re extends y {
|
|
|
2150
2150
|
code: d.invalid_type,
|
|
2151
2151
|
expected: h.object,
|
|
2152
2152
|
received: s.parsedType
|
|
2153
|
-
}),
|
|
2153
|
+
}), y;
|
|
2154
2154
|
const n = [], i = this._def.keyType, r = this._def.valueType;
|
|
2155
2155
|
for (const o in s.data)
|
|
2156
2156
|
n.push({
|
|
2157
|
-
key: i._parse(new
|
|
2158
|
-
value: r._parse(new
|
|
2157
|
+
key: i._parse(new E(s, o, s.path, o)),
|
|
2158
|
+
value: r._parse(new E(s, s.data[o], s.path, o)),
|
|
2159
2159
|
alwaysSet: o in s.data
|
|
2160
2160
|
});
|
|
2161
|
-
return s.common.async ?
|
|
2161
|
+
return s.common.async ? x.mergeObjectAsync(t, n) : x.mergeObjectSync(t, n);
|
|
2162
2162
|
}
|
|
2163
2163
|
get element() {
|
|
2164
2164
|
return this._def.valueType;
|
|
2165
2165
|
}
|
|
2166
2166
|
static create(e, t, s) {
|
|
2167
|
-
return t instanceof
|
|
2167
|
+
return t instanceof _ ? new re({
|
|
2168
2168
|
keyType: e,
|
|
2169
2169
|
valueType: t,
|
|
2170
|
-
typeName:
|
|
2170
|
+
typeName: m.ZodRecord,
|
|
2171
2171
|
...g(s)
|
|
2172
2172
|
}) : new re({
|
|
2173
|
-
keyType:
|
|
2173
|
+
keyType: N.create(),
|
|
2174
2174
|
valueType: e,
|
|
2175
|
-
typeName:
|
|
2175
|
+
typeName: m.ZodRecord,
|
|
2176
2176
|
...g(t)
|
|
2177
2177
|
});
|
|
2178
2178
|
}
|
|
2179
2179
|
}
|
|
2180
|
-
class Te extends
|
|
2180
|
+
class Te extends _ {
|
|
2181
2181
|
get keySchema() {
|
|
2182
2182
|
return this._def.keyType;
|
|
2183
2183
|
}
|
|
@@ -2191,29 +2191,29 @@ class Te extends y {
|
|
|
2191
2191
|
code: d.invalid_type,
|
|
2192
2192
|
expected: h.map,
|
|
2193
2193
|
received: s.parsedType
|
|
2194
|
-
}),
|
|
2194
|
+
}), y;
|
|
2195
2195
|
const n = this._def.keyType, i = this._def.valueType, r = [...s.data.entries()].map(([o, c], u) => ({
|
|
2196
|
-
key: n._parse(new
|
|
2197
|
-
value: i._parse(new
|
|
2196
|
+
key: n._parse(new E(s, o, s.path, [u, "key"])),
|
|
2197
|
+
value: i._parse(new E(s, c, s.path, [u, "value"]))
|
|
2198
2198
|
}));
|
|
2199
2199
|
if (s.common.async) {
|
|
2200
2200
|
const o = /* @__PURE__ */ new Map();
|
|
2201
2201
|
return Promise.resolve().then(async () => {
|
|
2202
2202
|
for (const c of r) {
|
|
2203
|
-
const u = await c.key,
|
|
2204
|
-
if (u.status === "aborted" ||
|
|
2205
|
-
return
|
|
2206
|
-
(u.status === "dirty" ||
|
|
2203
|
+
const u = await c.key, f = await c.value;
|
|
2204
|
+
if (u.status === "aborted" || f.status === "aborted")
|
|
2205
|
+
return y;
|
|
2206
|
+
(u.status === "dirty" || f.status === "dirty") && t.dirty(), o.set(u.value, f.value);
|
|
2207
2207
|
}
|
|
2208
2208
|
return { status: t.value, value: o };
|
|
2209
2209
|
});
|
|
2210
2210
|
} else {
|
|
2211
2211
|
const o = /* @__PURE__ */ new Map();
|
|
2212
2212
|
for (const c of r) {
|
|
2213
|
-
const u = c.key,
|
|
2214
|
-
if (u.status === "aborted" ||
|
|
2215
|
-
return
|
|
2216
|
-
(u.status === "dirty" ||
|
|
2213
|
+
const u = c.key, f = c.value;
|
|
2214
|
+
if (u.status === "aborted" || f.status === "aborted")
|
|
2215
|
+
return y;
|
|
2216
|
+
(u.status === "dirty" || f.status === "dirty") && t.dirty(), o.set(u.value, f.value);
|
|
2217
2217
|
}
|
|
2218
2218
|
return { status: t.value, value: o };
|
|
2219
2219
|
}
|
|
@@ -2222,10 +2222,10 @@ class Te extends y {
|
|
|
2222
2222
|
Te.create = (a, e, t) => new Te({
|
|
2223
2223
|
valueType: e,
|
|
2224
2224
|
keyType: a,
|
|
2225
|
-
typeName:
|
|
2225
|
+
typeName: m.ZodMap,
|
|
2226
2226
|
...g(t)
|
|
2227
2227
|
});
|
|
2228
|
-
class
|
|
2228
|
+
class B extends _ {
|
|
2229
2229
|
_parse(e) {
|
|
2230
2230
|
const { status: t, ctx: s } = this._processInputParams(e);
|
|
2231
2231
|
if (s.parsedType !== h.set)
|
|
@@ -2233,7 +2233,7 @@ class V extends y {
|
|
|
2233
2233
|
code: d.invalid_type,
|
|
2234
2234
|
expected: h.set,
|
|
2235
2235
|
received: s.parsedType
|
|
2236
|
-
}),
|
|
2236
|
+
}), y;
|
|
2237
2237
|
const n = this._def;
|
|
2238
2238
|
n.minSize !== null && s.data.size < n.minSize.value && (l(s, {
|
|
2239
2239
|
code: d.too_small,
|
|
@@ -2253,24 +2253,24 @@ class V extends y {
|
|
|
2253
2253
|
const i = this._def.valueType;
|
|
2254
2254
|
function r(c) {
|
|
2255
2255
|
const u = /* @__PURE__ */ new Set();
|
|
2256
|
-
for (const
|
|
2257
|
-
if (
|
|
2258
|
-
return
|
|
2259
|
-
|
|
2256
|
+
for (const f of c) {
|
|
2257
|
+
if (f.status === "aborted")
|
|
2258
|
+
return y;
|
|
2259
|
+
f.status === "dirty" && t.dirty(), u.add(f.value);
|
|
2260
2260
|
}
|
|
2261
2261
|
return { status: t.value, value: u };
|
|
2262
2262
|
}
|
|
2263
|
-
const o = [...s.data.values()].map((c, u) => i._parse(new
|
|
2263
|
+
const o = [...s.data.values()].map((c, u) => i._parse(new E(s, c, s.path, u)));
|
|
2264
2264
|
return s.common.async ? Promise.all(o).then((c) => r(c)) : r(o);
|
|
2265
2265
|
}
|
|
2266
2266
|
min(e, t) {
|
|
2267
|
-
return new
|
|
2267
|
+
return new B({
|
|
2268
2268
|
...this._def,
|
|
2269
2269
|
minSize: { value: e, message: p.toString(t) }
|
|
2270
2270
|
});
|
|
2271
2271
|
}
|
|
2272
2272
|
max(e, t) {
|
|
2273
|
-
return new
|
|
2273
|
+
return new B({
|
|
2274
2274
|
...this._def,
|
|
2275
2275
|
maxSize: { value: e, message: p.toString(t) }
|
|
2276
2276
|
});
|
|
@@ -2282,14 +2282,14 @@ class V extends y {
|
|
|
2282
2282
|
return this.min(1, e);
|
|
2283
2283
|
}
|
|
2284
2284
|
}
|
|
2285
|
-
|
|
2285
|
+
B.create = (a, e) => new B({
|
|
2286
2286
|
valueType: a,
|
|
2287
2287
|
minSize: null,
|
|
2288
2288
|
maxSize: null,
|
|
2289
|
-
typeName:
|
|
2289
|
+
typeName: m.ZodSet,
|
|
2290
2290
|
...g(e)
|
|
2291
2291
|
});
|
|
2292
|
-
class
|
|
2292
|
+
let Ge = class ve extends _ {
|
|
2293
2293
|
constructor() {
|
|
2294
2294
|
super(...arguments), this.validate = this.implement;
|
|
2295
2295
|
}
|
|
@@ -2300,7 +2300,7 @@ class H extends y {
|
|
|
2300
2300
|
code: d.invalid_type,
|
|
2301
2301
|
expected: h.function,
|
|
2302
2302
|
received: t.parsedType
|
|
2303
|
-
}),
|
|
2303
|
+
}), y;
|
|
2304
2304
|
function s(o, c) {
|
|
2305
2305
|
return be({
|
|
2306
2306
|
data: o,
|
|
@@ -2308,7 +2308,7 @@ class H extends y {
|
|
|
2308
2308
|
errorMaps: [
|
|
2309
2309
|
t.common.contextualErrorMap,
|
|
2310
2310
|
t.schemaErrorMap,
|
|
2311
|
-
|
|
2311
|
+
we(),
|
|
2312
2312
|
W
|
|
2313
2313
|
].filter((u) => !!u),
|
|
2314
2314
|
issueData: {
|
|
@@ -2324,7 +2324,7 @@ class H extends y {
|
|
|
2324
2324
|
errorMaps: [
|
|
2325
2325
|
t.common.contextualErrorMap,
|
|
2326
2326
|
t.schemaErrorMap,
|
|
2327
|
-
|
|
2327
|
+
we(),
|
|
2328
2328
|
W
|
|
2329
2329
|
].filter((u) => !!u),
|
|
2330
2330
|
issueData: {
|
|
@@ -2334,26 +2334,26 @@ class H extends y {
|
|
|
2334
2334
|
});
|
|
2335
2335
|
}
|
|
2336
2336
|
const i = { errorMap: t.common.contextualErrorMap }, r = t.data;
|
|
2337
|
-
if (this._def.returns instanceof
|
|
2337
|
+
if (this._def.returns instanceof J) {
|
|
2338
2338
|
const o = this;
|
|
2339
|
-
return
|
|
2340
|
-
const u = new
|
|
2341
|
-
throw u.addIssue(s(c,
|
|
2342
|
-
}),
|
|
2343
|
-
return await o._def.returns._def.type.parseAsync(
|
|
2344
|
-
throw u.addIssue(n(
|
|
2339
|
+
return k(async function(...c) {
|
|
2340
|
+
const u = new C([]), f = await o._def.args.parseAsync(c, i).catch((j) => {
|
|
2341
|
+
throw u.addIssue(s(c, j)), u;
|
|
2342
|
+
}), b = await Reflect.apply(r, this, f);
|
|
2343
|
+
return await o._def.returns._def.type.parseAsync(b, i).catch((j) => {
|
|
2344
|
+
throw u.addIssue(n(b, j)), u;
|
|
2345
2345
|
});
|
|
2346
2346
|
});
|
|
2347
2347
|
} else {
|
|
2348
2348
|
const o = this;
|
|
2349
|
-
return
|
|
2349
|
+
return k(function(...c) {
|
|
2350
2350
|
const u = o._def.args.safeParse(c, i);
|
|
2351
2351
|
if (!u.success)
|
|
2352
|
-
throw new
|
|
2353
|
-
const
|
|
2354
|
-
if (!
|
|
2355
|
-
throw new
|
|
2356
|
-
return
|
|
2352
|
+
throw new C([s(c, u.error)]);
|
|
2353
|
+
const f = Reflect.apply(r, this, u.data), b = o._def.returns.safeParse(f, i);
|
|
2354
|
+
if (!b.success)
|
|
2355
|
+
throw new C([n(f, b.error)]);
|
|
2356
|
+
return b.data;
|
|
2357
2357
|
});
|
|
2358
2358
|
}
|
|
2359
2359
|
}
|
|
@@ -2364,13 +2364,13 @@ class H extends y {
|
|
|
2364
2364
|
return this._def.returns;
|
|
2365
2365
|
}
|
|
2366
2366
|
args(...e) {
|
|
2367
|
-
return new
|
|
2367
|
+
return new ve({
|
|
2368
2368
|
...this._def,
|
|
2369
|
-
args: I.create(e).rest(
|
|
2369
|
+
args: I.create(e).rest(q.create())
|
|
2370
2370
|
});
|
|
2371
2371
|
}
|
|
2372
2372
|
returns(e) {
|
|
2373
|
-
return new
|
|
2373
|
+
return new ve({
|
|
2374
2374
|
...this._def,
|
|
2375
2375
|
returns: e
|
|
2376
2376
|
});
|
|
@@ -2382,15 +2382,15 @@ class H extends y {
|
|
|
2382
2382
|
return this.parse(e);
|
|
2383
2383
|
}
|
|
2384
2384
|
static create(e, t, s) {
|
|
2385
|
-
return new
|
|
2386
|
-
args: e || I.create([]).rest(
|
|
2387
|
-
returns: t ||
|
|
2388
|
-
typeName:
|
|
2385
|
+
return new ve({
|
|
2386
|
+
args: e || I.create([]).rest(q.create()),
|
|
2387
|
+
returns: t || q.create(),
|
|
2388
|
+
typeName: m.ZodFunction,
|
|
2389
2389
|
...g(s)
|
|
2390
2390
|
});
|
|
2391
2391
|
}
|
|
2392
|
-
}
|
|
2393
|
-
class oe extends
|
|
2392
|
+
};
|
|
2393
|
+
class oe extends _ {
|
|
2394
2394
|
get schema() {
|
|
2395
2395
|
return this._def.getter();
|
|
2396
2396
|
}
|
|
@@ -2401,10 +2401,10 @@ class oe extends y {
|
|
|
2401
2401
|
}
|
|
2402
2402
|
oe.create = (a, e) => new oe({
|
|
2403
2403
|
getter: a,
|
|
2404
|
-
typeName:
|
|
2404
|
+
typeName: m.ZodLazy,
|
|
2405
2405
|
...g(e)
|
|
2406
2406
|
});
|
|
2407
|
-
class ce extends
|
|
2407
|
+
class ce extends _ {
|
|
2408
2408
|
_parse(e) {
|
|
2409
2409
|
if (e.data !== this._def.value) {
|
|
2410
2410
|
const t = this._getOrReturnCtx(e);
|
|
@@ -2412,7 +2412,7 @@ class ce extends y {
|
|
|
2412
2412
|
received: t.data,
|
|
2413
2413
|
code: d.invalid_literal,
|
|
2414
2414
|
expected: this._def.value
|
|
2415
|
-
}),
|
|
2415
|
+
}), y;
|
|
2416
2416
|
}
|
|
2417
2417
|
return { status: "valid", value: e.data };
|
|
2418
2418
|
}
|
|
@@ -2422,38 +2422,38 @@ class ce extends y {
|
|
|
2422
2422
|
}
|
|
2423
2423
|
ce.create = (a, e) => new ce({
|
|
2424
2424
|
value: a,
|
|
2425
|
-
typeName:
|
|
2425
|
+
typeName: m.ZodLiteral,
|
|
2426
2426
|
...g(e)
|
|
2427
2427
|
});
|
|
2428
|
-
function
|
|
2428
|
+
function Xe(a, e) {
|
|
2429
2429
|
return new pe({
|
|
2430
2430
|
values: a,
|
|
2431
|
-
typeName:
|
|
2431
|
+
typeName: m.ZodEnum,
|
|
2432
2432
|
...g(e)
|
|
2433
2433
|
});
|
|
2434
2434
|
}
|
|
2435
|
-
let pe = class Me extends
|
|
2435
|
+
let pe = class Me extends _ {
|
|
2436
2436
|
constructor() {
|
|
2437
|
-
super(...arguments),
|
|
2437
|
+
super(...arguments), Y.set(this, void 0);
|
|
2438
2438
|
}
|
|
2439
2439
|
_parse(e) {
|
|
2440
2440
|
if (typeof e.data != "string") {
|
|
2441
2441
|
const t = this._getOrReturnCtx(e), s = this._def.values;
|
|
2442
2442
|
return l(t, {
|
|
2443
|
-
expected:
|
|
2443
|
+
expected: w.joinValues(s),
|
|
2444
2444
|
received: t.parsedType,
|
|
2445
2445
|
code: d.invalid_type
|
|
2446
|
-
}),
|
|
2446
|
+
}), y;
|
|
2447
2447
|
}
|
|
2448
|
-
if (
|
|
2448
|
+
if (xe(this, Y) || He(this, Y, new Set(this._def.values)), !xe(this, Y).has(e.data)) {
|
|
2449
2449
|
const t = this._getOrReturnCtx(e), s = this._def.values;
|
|
2450
2450
|
return l(t, {
|
|
2451
2451
|
received: t.data,
|
|
2452
2452
|
code: d.invalid_enum_value,
|
|
2453
2453
|
options: s
|
|
2454
|
-
}),
|
|
2454
|
+
}), y;
|
|
2455
2455
|
}
|
|
2456
|
-
return
|
|
2456
|
+
return k(e.data);
|
|
2457
2457
|
}
|
|
2458
2458
|
get options() {
|
|
2459
2459
|
return this._def.values;
|
|
@@ -2489,43 +2489,43 @@ let pe = class Me extends y {
|
|
|
2489
2489
|
});
|
|
2490
2490
|
}
|
|
2491
2491
|
};
|
|
2492
|
-
|
|
2493
|
-
pe.create =
|
|
2494
|
-
class de extends
|
|
2492
|
+
Y = /* @__PURE__ */ new WeakMap();
|
|
2493
|
+
pe.create = Xe;
|
|
2494
|
+
class de extends _ {
|
|
2495
2495
|
constructor() {
|
|
2496
|
-
super(...arguments),
|
|
2496
|
+
super(...arguments), G.set(this, void 0);
|
|
2497
2497
|
}
|
|
2498
2498
|
_parse(e) {
|
|
2499
|
-
const t =
|
|
2499
|
+
const t = w.getValidEnumValues(this._def.values), s = this._getOrReturnCtx(e);
|
|
2500
2500
|
if (s.parsedType !== h.string && s.parsedType !== h.number) {
|
|
2501
|
-
const n =
|
|
2501
|
+
const n = w.objectValues(t);
|
|
2502
2502
|
return l(s, {
|
|
2503
|
-
expected:
|
|
2503
|
+
expected: w.joinValues(n),
|
|
2504
2504
|
received: s.parsedType,
|
|
2505
2505
|
code: d.invalid_type
|
|
2506
|
-
}),
|
|
2506
|
+
}), y;
|
|
2507
2507
|
}
|
|
2508
|
-
if (
|
|
2509
|
-
const n =
|
|
2508
|
+
if (xe(this, G) || He(this, G, new Set(w.getValidEnumValues(this._def.values))), !xe(this, G).has(e.data)) {
|
|
2509
|
+
const n = w.objectValues(t);
|
|
2510
2510
|
return l(s, {
|
|
2511
2511
|
received: s.data,
|
|
2512
2512
|
code: d.invalid_enum_value,
|
|
2513
2513
|
options: n
|
|
2514
|
-
}),
|
|
2514
|
+
}), y;
|
|
2515
2515
|
}
|
|
2516
|
-
return
|
|
2516
|
+
return k(e.data);
|
|
2517
2517
|
}
|
|
2518
2518
|
get enum() {
|
|
2519
2519
|
return this._def.values;
|
|
2520
2520
|
}
|
|
2521
2521
|
}
|
|
2522
|
-
|
|
2522
|
+
G = /* @__PURE__ */ new WeakMap();
|
|
2523
2523
|
de.create = (a, e) => new de({
|
|
2524
2524
|
values: a,
|
|
2525
|
-
typeName:
|
|
2525
|
+
typeName: m.ZodNativeEnum,
|
|
2526
2526
|
...g(e)
|
|
2527
2527
|
});
|
|
2528
|
-
class
|
|
2528
|
+
class J extends _ {
|
|
2529
2529
|
unwrap() {
|
|
2530
2530
|
return this._def.type;
|
|
2531
2531
|
}
|
|
@@ -2536,25 +2536,25 @@ class Y extends y {
|
|
|
2536
2536
|
code: d.invalid_type,
|
|
2537
2537
|
expected: h.promise,
|
|
2538
2538
|
received: t.parsedType
|
|
2539
|
-
}),
|
|
2539
|
+
}), y;
|
|
2540
2540
|
const s = t.parsedType === h.promise ? t.data : Promise.resolve(t.data);
|
|
2541
|
-
return
|
|
2541
|
+
return k(s.then((n) => this._def.type.parseAsync(n, {
|
|
2542
2542
|
path: t.path,
|
|
2543
2543
|
errorMap: t.common.contextualErrorMap
|
|
2544
2544
|
})));
|
|
2545
2545
|
}
|
|
2546
2546
|
}
|
|
2547
|
-
|
|
2547
|
+
J.create = (a, e) => new J({
|
|
2548
2548
|
type: a,
|
|
2549
|
-
typeName:
|
|
2549
|
+
typeName: m.ZodPromise,
|
|
2550
2550
|
...g(e)
|
|
2551
2551
|
});
|
|
2552
|
-
class
|
|
2552
|
+
class A extends _ {
|
|
2553
2553
|
innerType() {
|
|
2554
2554
|
return this._def.schema;
|
|
2555
2555
|
}
|
|
2556
2556
|
sourceType() {
|
|
2557
|
-
return this._def.schema._def.typeName ===
|
|
2557
|
+
return this._def.schema._def.typeName === m.ZodEffects ? this._def.schema.sourceType() : this._def.schema;
|
|
2558
2558
|
}
|
|
2559
2559
|
_parse(e) {
|
|
2560
2560
|
const { status: t, ctx: s } = this._processInputParams(e), n = this._def.effect || null, i = {
|
|
@@ -2570,23 +2570,23 @@ class C extends y {
|
|
|
2570
2570
|
if (s.common.async)
|
|
2571
2571
|
return Promise.resolve(r).then(async (o) => {
|
|
2572
2572
|
if (t.value === "aborted")
|
|
2573
|
-
return
|
|
2573
|
+
return y;
|
|
2574
2574
|
const c = await this._def.schema._parseAsync({
|
|
2575
2575
|
data: o,
|
|
2576
2576
|
path: s.path,
|
|
2577
2577
|
parent: s
|
|
2578
2578
|
});
|
|
2579
|
-
return c.status === "aborted" ?
|
|
2579
|
+
return c.status === "aborted" ? y : c.status === "dirty" || t.value === "dirty" ? ke(c.value) : c;
|
|
2580
2580
|
});
|
|
2581
2581
|
{
|
|
2582
2582
|
if (t.value === "aborted")
|
|
2583
|
-
return
|
|
2583
|
+
return y;
|
|
2584
2584
|
const o = this._def.schema._parseSync({
|
|
2585
2585
|
data: r,
|
|
2586
2586
|
path: s.path,
|
|
2587
2587
|
parent: s
|
|
2588
2588
|
});
|
|
2589
|
-
return o.status === "aborted" ?
|
|
2589
|
+
return o.status === "aborted" ? y : o.status === "dirty" || t.value === "dirty" ? ke(o.value) : o;
|
|
2590
2590
|
}
|
|
2591
2591
|
}
|
|
2592
2592
|
if (n.type === "refinement") {
|
|
@@ -2604,9 +2604,9 @@ class C extends y {
|
|
|
2604
2604
|
path: s.path,
|
|
2605
2605
|
parent: s
|
|
2606
2606
|
});
|
|
2607
|
-
return o.status === "aborted" ?
|
|
2607
|
+
return o.status === "aborted" ? y : (o.status === "dirty" && t.dirty(), r(o.value), { status: t.value, value: o.value });
|
|
2608
2608
|
} else
|
|
2609
|
-
return this._def.schema._parseAsync({ data: s.data, path: s.path, parent: s }).then((o) => o.status === "aborted" ?
|
|
2609
|
+
return this._def.schema._parseAsync({ data: s.data, path: s.path, parent: s }).then((o) => o.status === "aborted" ? y : (o.status === "dirty" && t.dirty(), r(o.value).then(() => ({ status: t.value, value: o.value }))));
|
|
2610
2610
|
}
|
|
2611
2611
|
if (n.type === "transform")
|
|
2612
2612
|
if (s.common.async === !1) {
|
|
@@ -2623,24 +2623,24 @@ class C extends y {
|
|
|
2623
2623
|
return { status: t.value, value: o };
|
|
2624
2624
|
} else
|
|
2625
2625
|
return this._def.schema._parseAsync({ data: s.data, path: s.path, parent: s }).then((r) => z(r) ? Promise.resolve(n.transform(r.value, i)).then((o) => ({ status: t.value, value: o })) : r);
|
|
2626
|
-
|
|
2626
|
+
w.assertNever(n);
|
|
2627
2627
|
}
|
|
2628
2628
|
}
|
|
2629
|
-
|
|
2629
|
+
A.create = (a, e, t) => new A({
|
|
2630
2630
|
schema: a,
|
|
2631
|
-
typeName:
|
|
2631
|
+
typeName: m.ZodEffects,
|
|
2632
2632
|
effect: e,
|
|
2633
2633
|
...g(t)
|
|
2634
2634
|
});
|
|
2635
|
-
|
|
2635
|
+
A.createWithPreprocess = (a, e, t) => new A({
|
|
2636
2636
|
schema: e,
|
|
2637
2637
|
effect: { type: "preprocess", transform: a },
|
|
2638
|
-
typeName:
|
|
2638
|
+
typeName: m.ZodEffects,
|
|
2639
2639
|
...g(t)
|
|
2640
2640
|
});
|
|
2641
|
-
let O = class extends
|
|
2641
|
+
let O = class extends _ {
|
|
2642
2642
|
_parse(e) {
|
|
2643
|
-
return this._getType(e) === h.undefined ?
|
|
2643
|
+
return this._getType(e) === h.undefined ? k(void 0) : this._def.innerType._parse(e);
|
|
2644
2644
|
}
|
|
2645
2645
|
unwrap() {
|
|
2646
2646
|
return this._def.innerType;
|
|
@@ -2648,12 +2648,12 @@ let O = class extends y {
|
|
|
2648
2648
|
};
|
|
2649
2649
|
O.create = (a, e) => new O({
|
|
2650
2650
|
innerType: a,
|
|
2651
|
-
typeName:
|
|
2651
|
+
typeName: m.ZodOptional,
|
|
2652
2652
|
...g(e)
|
|
2653
2653
|
});
|
|
2654
|
-
let M = class extends
|
|
2654
|
+
let M = class extends _ {
|
|
2655
2655
|
_parse(e) {
|
|
2656
|
-
return this._getType(e) === h.null ?
|
|
2656
|
+
return this._getType(e) === h.null ? k(null) : this._def.innerType._parse(e);
|
|
2657
2657
|
}
|
|
2658
2658
|
unwrap() {
|
|
2659
2659
|
return this._def.innerType;
|
|
@@ -2661,10 +2661,10 @@ let M = class extends y {
|
|
|
2661
2661
|
};
|
|
2662
2662
|
M.create = (a, e) => new M({
|
|
2663
2663
|
innerType: a,
|
|
2664
|
-
typeName:
|
|
2664
|
+
typeName: m.ZodNullable,
|
|
2665
2665
|
...g(e)
|
|
2666
2666
|
});
|
|
2667
|
-
class ue extends
|
|
2667
|
+
class ue extends _ {
|
|
2668
2668
|
_parse(e) {
|
|
2669
2669
|
const { ctx: t } = this._processInputParams(e);
|
|
2670
2670
|
let s = t.data;
|
|
@@ -2680,11 +2680,11 @@ class ue extends y {
|
|
|
2680
2680
|
}
|
|
2681
2681
|
ue.create = (a, e) => new ue({
|
|
2682
2682
|
innerType: a,
|
|
2683
|
-
typeName:
|
|
2683
|
+
typeName: m.ZodDefault,
|
|
2684
2684
|
defaultValue: typeof e.default == "function" ? e.default : () => e.default,
|
|
2685
2685
|
...g(e)
|
|
2686
2686
|
});
|
|
2687
|
-
class le extends
|
|
2687
|
+
class le extends _ {
|
|
2688
2688
|
_parse(e) {
|
|
2689
2689
|
const { ctx: t } = this._processInputParams(e), s = {
|
|
2690
2690
|
...t,
|
|
@@ -2699,11 +2699,11 @@ class le extends y {
|
|
|
2699
2699
|
...s
|
|
2700
2700
|
}
|
|
2701
2701
|
});
|
|
2702
|
-
return
|
|
2702
|
+
return X(n) ? n.then((i) => ({
|
|
2703
2703
|
status: "valid",
|
|
2704
2704
|
value: i.status === "valid" ? i.value : this._def.catchValue({
|
|
2705
2705
|
get error() {
|
|
2706
|
-
return new
|
|
2706
|
+
return new C(s.common.issues);
|
|
2707
2707
|
},
|
|
2708
2708
|
input: s.data
|
|
2709
2709
|
})
|
|
@@ -2711,7 +2711,7 @@ class le extends y {
|
|
|
2711
2711
|
status: "valid",
|
|
2712
2712
|
value: n.status === "valid" ? n.value : this._def.catchValue({
|
|
2713
2713
|
get error() {
|
|
2714
|
-
return new
|
|
2714
|
+
return new C(s.common.issues);
|
|
2715
2715
|
},
|
|
2716
2716
|
input: s.data
|
|
2717
2717
|
})
|
|
@@ -2723,11 +2723,11 @@ class le extends y {
|
|
|
2723
2723
|
}
|
|
2724
2724
|
le.create = (a, e) => new le({
|
|
2725
2725
|
innerType: a,
|
|
2726
|
-
typeName:
|
|
2726
|
+
typeName: m.ZodCatch,
|
|
2727
2727
|
catchValue: typeof e.catch == "function" ? e.catch : () => e.catch,
|
|
2728
2728
|
...g(e)
|
|
2729
2729
|
});
|
|
2730
|
-
class
|
|
2730
|
+
class Ne extends _ {
|
|
2731
2731
|
_parse(e) {
|
|
2732
2732
|
if (this._getType(e) !== h.nan) {
|
|
2733
2733
|
const t = this._getOrReturnCtx(e);
|
|
@@ -2735,17 +2735,17 @@ class Se extends y {
|
|
|
2735
2735
|
code: d.invalid_type,
|
|
2736
2736
|
expected: h.nan,
|
|
2737
2737
|
received: t.parsedType
|
|
2738
|
-
}),
|
|
2738
|
+
}), y;
|
|
2739
2739
|
}
|
|
2740
2740
|
return { status: "valid", value: e.data };
|
|
2741
2741
|
}
|
|
2742
2742
|
}
|
|
2743
|
-
|
|
2744
|
-
typeName:
|
|
2743
|
+
Ne.create = (a) => new Ne({
|
|
2744
|
+
typeName: m.ZodNaN,
|
|
2745
2745
|
...g(a)
|
|
2746
2746
|
});
|
|
2747
|
-
const
|
|
2748
|
-
class
|
|
2747
|
+
const Nt = Symbol("zod_brand");
|
|
2748
|
+
class De extends _ {
|
|
2749
2749
|
_parse(e) {
|
|
2750
2750
|
const { ctx: t } = this._processInputParams(e), s = t.data;
|
|
2751
2751
|
return this._def.type._parse({
|
|
@@ -2758,7 +2758,7 @@ class Fe extends y {
|
|
|
2758
2758
|
return this._def.type;
|
|
2759
2759
|
}
|
|
2760
2760
|
}
|
|
2761
|
-
class
|
|
2761
|
+
class fe extends _ {
|
|
2762
2762
|
_parse(e) {
|
|
2763
2763
|
const { status: t, ctx: s } = this._processInputParams(e);
|
|
2764
2764
|
if (s.common.async)
|
|
@@ -2768,7 +2768,7 @@ class me extends y {
|
|
|
2768
2768
|
path: s.path,
|
|
2769
2769
|
parent: s
|
|
2770
2770
|
});
|
|
2771
|
-
return n.status === "aborted" ?
|
|
2771
|
+
return n.status === "aborted" ? y : n.status === "dirty" ? (t.dirty(), ke(n.value)) : this._def.out._parseAsync({
|
|
2772
2772
|
data: n.value,
|
|
2773
2773
|
path: s.path,
|
|
2774
2774
|
parent: s
|
|
@@ -2780,7 +2780,7 @@ class me extends y {
|
|
|
2780
2780
|
path: s.path,
|
|
2781
2781
|
parent: s
|
|
2782
2782
|
});
|
|
2783
|
-
return n.status === "aborted" ?
|
|
2783
|
+
return n.status === "aborted" ? y : n.status === "dirty" ? (t.dirty(), {
|
|
2784
2784
|
status: "dirty",
|
|
2785
2785
|
value: n.value
|
|
2786
2786
|
}) : this._def.out._parseSync({
|
|
@@ -2791,17 +2791,17 @@ class me extends y {
|
|
|
2791
2791
|
}
|
|
2792
2792
|
}
|
|
2793
2793
|
static create(e, t) {
|
|
2794
|
-
return new
|
|
2794
|
+
return new fe({
|
|
2795
2795
|
in: e,
|
|
2796
2796
|
out: t,
|
|
2797
|
-
typeName:
|
|
2797
|
+
typeName: m.ZodPipeline
|
|
2798
2798
|
});
|
|
2799
2799
|
}
|
|
2800
2800
|
}
|
|
2801
|
-
class he extends
|
|
2801
|
+
class he extends _ {
|
|
2802
2802
|
_parse(e) {
|
|
2803
2803
|
const t = this._def.innerType._parse(e), s = (n) => (z(n) && (n.value = Object.freeze(n.value)), n);
|
|
2804
|
-
return
|
|
2804
|
+
return X(t) ? t.then((n) => s(n)) : s(t);
|
|
2805
2805
|
}
|
|
2806
2806
|
unwrap() {
|
|
2807
2807
|
return this._def.innerType;
|
|
@@ -2809,170 +2809,170 @@ class he extends y {
|
|
|
2809
2809
|
}
|
|
2810
2810
|
he.create = (a, e) => new he({
|
|
2811
2811
|
innerType: a,
|
|
2812
|
-
typeName:
|
|
2812
|
+
typeName: m.ZodReadonly,
|
|
2813
2813
|
...g(e)
|
|
2814
2814
|
});
|
|
2815
|
-
function
|
|
2815
|
+
function qe(a, e) {
|
|
2816
2816
|
const t = typeof a == "function" ? a(e) : typeof a == "string" ? { message: a } : a;
|
|
2817
2817
|
return typeof t == "string" ? { message: t } : t;
|
|
2818
2818
|
}
|
|
2819
|
-
function
|
|
2820
|
-
return a ?
|
|
2819
|
+
function Qe(a, e = {}, t) {
|
|
2820
|
+
return a ? K.create().superRefine((s, n) => {
|
|
2821
2821
|
var i, r;
|
|
2822
2822
|
const o = a(s);
|
|
2823
2823
|
if (o instanceof Promise)
|
|
2824
2824
|
return o.then((c) => {
|
|
2825
|
-
var u,
|
|
2825
|
+
var u, f;
|
|
2826
2826
|
if (!c) {
|
|
2827
|
-
const
|
|
2828
|
-
n.addIssue({ code: "custom", ...
|
|
2827
|
+
const b = qe(e, s), j = (f = (u = b.fatal) !== null && u !== void 0 ? u : t) !== null && f !== void 0 ? f : !0;
|
|
2828
|
+
n.addIssue({ code: "custom", ...b, fatal: j });
|
|
2829
2829
|
}
|
|
2830
2830
|
});
|
|
2831
2831
|
if (!o) {
|
|
2832
|
-
const c =
|
|
2832
|
+
const c = qe(e, s), u = (r = (i = c.fatal) !== null && i !== void 0 ? i : t) !== null && r !== void 0 ? r : !0;
|
|
2833
2833
|
n.addIssue({ code: "custom", ...c, fatal: u });
|
|
2834
2834
|
}
|
|
2835
|
-
}) :
|
|
2835
|
+
}) : K.create();
|
|
2836
2836
|
}
|
|
2837
|
-
const
|
|
2838
|
-
object:
|
|
2837
|
+
const Ct = {
|
|
2838
|
+
object: S.lazycreate
|
|
2839
2839
|
};
|
|
2840
|
-
var
|
|
2840
|
+
var m;
|
|
2841
2841
|
(function(a) {
|
|
2842
2842
|
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";
|
|
2843
|
-
})(
|
|
2844
|
-
const
|
|
2843
|
+
})(m || (m = {}));
|
|
2844
|
+
const At = (a, e = {
|
|
2845
2845
|
message: `Input not instance of ${a.name}`
|
|
2846
|
-
}) =>
|
|
2847
|
-
string: (a) =>
|
|
2848
|
-
number: (a) =>
|
|
2849
|
-
boolean: (a) =>
|
|
2846
|
+
}) => Qe((t) => t instanceof a, e), et = N.create, tt = F.create, Ot = Ne.create, Et = Q.create, st = ee.create, It = te.create, jt = Ze.create, $t = se.create, Pt = ae.create, Rt = K.create, Ft = q.create, Mt = P.create, Dt = Se.create, Lt = V.create, qt = S.create, zt = S.strictCreate, Vt = ne.create, Bt = Ce.create, Ut = ie.create, Ht = I.create, Wt = re.create, Kt = Te.create, Jt = B.create, Yt = Ge.create, Gt = oe.create, Xt = ce.create, Qt = pe.create, es = de.create, ts = J.create, ze = A.create, ss = O.create, as = M.create, ns = A.createWithPreprocess, is = fe.create, rs = () => et().optional(), os = () => tt().optional(), cs = () => st().optional(), ds = {
|
|
2847
|
+
string: (a) => N.create({ ...a, coerce: !0 }),
|
|
2848
|
+
number: (a) => F.create({ ...a, coerce: !0 }),
|
|
2849
|
+
boolean: (a) => ee.create({
|
|
2850
2850
|
...a,
|
|
2851
2851
|
coerce: !0
|
|
2852
2852
|
}),
|
|
2853
|
-
bigint: (a) =>
|
|
2854
|
-
date: (a) =>
|
|
2855
|
-
},
|
|
2853
|
+
bigint: (a) => Q.create({ ...a, coerce: !0 }),
|
|
2854
|
+
date: (a) => te.create({ ...a, coerce: !0 })
|
|
2855
|
+
}, us = y;
|
|
2856
2856
|
var Ie = /* @__PURE__ */ Object.freeze({
|
|
2857
2857
|
__proto__: null,
|
|
2858
2858
|
defaultErrorMap: W,
|
|
2859
|
-
setErrorMap:
|
|
2860
|
-
getErrorMap:
|
|
2859
|
+
setErrorMap: nt,
|
|
2860
|
+
getErrorMap: we,
|
|
2861
2861
|
makeIssue: be,
|
|
2862
|
-
EMPTY_PATH:
|
|
2862
|
+
EMPTY_PATH: it,
|
|
2863
2863
|
addIssueToContext: l,
|
|
2864
|
-
ParseStatus:
|
|
2865
|
-
INVALID:
|
|
2864
|
+
ParseStatus: x,
|
|
2865
|
+
INVALID: y,
|
|
2866
2866
|
DIRTY: ke,
|
|
2867
|
-
OK:
|
|
2868
|
-
isAborted:
|
|
2869
|
-
isDirty:
|
|
2867
|
+
OK: k,
|
|
2868
|
+
isAborted: $e,
|
|
2869
|
+
isDirty: Pe,
|
|
2870
2870
|
isValid: z,
|
|
2871
|
-
isAsync:
|
|
2871
|
+
isAsync: X,
|
|
2872
2872
|
get util() {
|
|
2873
|
-
return
|
|
2873
|
+
return w;
|
|
2874
2874
|
},
|
|
2875
2875
|
get objectUtil() {
|
|
2876
|
-
return
|
|
2876
|
+
return je;
|
|
2877
2877
|
},
|
|
2878
2878
|
ZodParsedType: h,
|
|
2879
|
-
getParsedType:
|
|
2880
|
-
ZodType:
|
|
2881
|
-
datetimeRegex:
|
|
2882
|
-
ZodString:
|
|
2883
|
-
ZodNumber:
|
|
2884
|
-
ZodBigInt:
|
|
2885
|
-
ZodBoolean:
|
|
2886
|
-
ZodDate:
|
|
2887
|
-
ZodSymbol:
|
|
2879
|
+
getParsedType: $,
|
|
2880
|
+
ZodType: _,
|
|
2881
|
+
datetimeRegex: Je,
|
|
2882
|
+
ZodString: N,
|
|
2883
|
+
ZodNumber: F,
|
|
2884
|
+
ZodBigInt: Q,
|
|
2885
|
+
ZodBoolean: ee,
|
|
2886
|
+
ZodDate: te,
|
|
2887
|
+
ZodSymbol: Ze,
|
|
2888
2888
|
ZodUndefined: se,
|
|
2889
2889
|
ZodNull: ae,
|
|
2890
|
-
ZodAny:
|
|
2891
|
-
ZodUnknown:
|
|
2892
|
-
ZodNever:
|
|
2893
|
-
ZodVoid:
|
|
2894
|
-
ZodArray:
|
|
2895
|
-
ZodObject:
|
|
2890
|
+
ZodAny: K,
|
|
2891
|
+
ZodUnknown: q,
|
|
2892
|
+
ZodNever: P,
|
|
2893
|
+
ZodVoid: Se,
|
|
2894
|
+
ZodArray: V,
|
|
2895
|
+
ZodObject: S,
|
|
2896
2896
|
ZodUnion: ne,
|
|
2897
|
-
ZodDiscriminatedUnion:
|
|
2897
|
+
ZodDiscriminatedUnion: Ce,
|
|
2898
2898
|
ZodIntersection: ie,
|
|
2899
2899
|
ZodTuple: I,
|
|
2900
2900
|
ZodRecord: re,
|
|
2901
2901
|
ZodMap: Te,
|
|
2902
|
-
ZodSet:
|
|
2903
|
-
ZodFunction:
|
|
2902
|
+
ZodSet: B,
|
|
2903
|
+
ZodFunction: Ge,
|
|
2904
2904
|
ZodLazy: oe,
|
|
2905
2905
|
ZodLiteral: ce,
|
|
2906
2906
|
ZodEnum: pe,
|
|
2907
2907
|
ZodNativeEnum: de,
|
|
2908
|
-
ZodPromise:
|
|
2909
|
-
ZodEffects:
|
|
2910
|
-
ZodTransformer:
|
|
2908
|
+
ZodPromise: J,
|
|
2909
|
+
ZodEffects: A,
|
|
2910
|
+
ZodTransformer: A,
|
|
2911
2911
|
ZodOptional: O,
|
|
2912
2912
|
ZodNullable: M,
|
|
2913
2913
|
ZodDefault: ue,
|
|
2914
2914
|
ZodCatch: le,
|
|
2915
|
-
ZodNaN:
|
|
2916
|
-
BRAND:
|
|
2917
|
-
ZodBranded:
|
|
2918
|
-
ZodPipeline:
|
|
2915
|
+
ZodNaN: Ne,
|
|
2916
|
+
BRAND: Nt,
|
|
2917
|
+
ZodBranded: De,
|
|
2918
|
+
ZodPipeline: fe,
|
|
2919
2919
|
ZodReadonly: he,
|
|
2920
|
-
custom:
|
|
2921
|
-
Schema:
|
|
2922
|
-
ZodSchema:
|
|
2923
|
-
late:
|
|
2920
|
+
custom: Qe,
|
|
2921
|
+
Schema: _,
|
|
2922
|
+
ZodSchema: _,
|
|
2923
|
+
late: Ct,
|
|
2924
2924
|
get ZodFirstPartyTypeKind() {
|
|
2925
|
-
return
|
|
2925
|
+
return m;
|
|
2926
2926
|
},
|
|
2927
|
-
coerce:
|
|
2928
|
-
any:
|
|
2929
|
-
array:
|
|
2930
|
-
bigint:
|
|
2931
|
-
boolean:
|
|
2932
|
-
date:
|
|
2933
|
-
discriminatedUnion:
|
|
2927
|
+
coerce: ds,
|
|
2928
|
+
any: Rt,
|
|
2929
|
+
array: Lt,
|
|
2930
|
+
bigint: Et,
|
|
2931
|
+
boolean: st,
|
|
2932
|
+
date: It,
|
|
2933
|
+
discriminatedUnion: Bt,
|
|
2934
2934
|
effect: ze,
|
|
2935
|
-
enum:
|
|
2936
|
-
function:
|
|
2937
|
-
instanceof:
|
|
2938
|
-
intersection:
|
|
2939
|
-
lazy:
|
|
2940
|
-
literal:
|
|
2941
|
-
map:
|
|
2942
|
-
nan:
|
|
2943
|
-
nativeEnum:
|
|
2944
|
-
never:
|
|
2945
|
-
null:
|
|
2946
|
-
nullable:
|
|
2947
|
-
number:
|
|
2948
|
-
object:
|
|
2949
|
-
oboolean:
|
|
2950
|
-
onumber:
|
|
2951
|
-
optional:
|
|
2952
|
-
ostring:
|
|
2953
|
-
pipeline:
|
|
2954
|
-
preprocess:
|
|
2955
|
-
promise:
|
|
2956
|
-
record:
|
|
2957
|
-
set:
|
|
2958
|
-
strictObject:
|
|
2959
|
-
string:
|
|
2960
|
-
symbol:
|
|
2935
|
+
enum: Qt,
|
|
2936
|
+
function: Yt,
|
|
2937
|
+
instanceof: At,
|
|
2938
|
+
intersection: Ut,
|
|
2939
|
+
lazy: Gt,
|
|
2940
|
+
literal: Xt,
|
|
2941
|
+
map: Kt,
|
|
2942
|
+
nan: Ot,
|
|
2943
|
+
nativeEnum: es,
|
|
2944
|
+
never: Mt,
|
|
2945
|
+
null: Pt,
|
|
2946
|
+
nullable: as,
|
|
2947
|
+
number: tt,
|
|
2948
|
+
object: qt,
|
|
2949
|
+
oboolean: cs,
|
|
2950
|
+
onumber: os,
|
|
2951
|
+
optional: ss,
|
|
2952
|
+
ostring: rs,
|
|
2953
|
+
pipeline: is,
|
|
2954
|
+
preprocess: ns,
|
|
2955
|
+
promise: ts,
|
|
2956
|
+
record: Wt,
|
|
2957
|
+
set: Jt,
|
|
2958
|
+
strictObject: zt,
|
|
2959
|
+
string: et,
|
|
2960
|
+
symbol: jt,
|
|
2961
2961
|
transformer: ze,
|
|
2962
|
-
tuple:
|
|
2963
|
-
undefined:
|
|
2964
|
-
union:
|
|
2965
|
-
unknown:
|
|
2966
|
-
void:
|
|
2967
|
-
NEVER:
|
|
2962
|
+
tuple: Ht,
|
|
2963
|
+
undefined: $t,
|
|
2964
|
+
union: Vt,
|
|
2965
|
+
unknown: Ft,
|
|
2966
|
+
void: Dt,
|
|
2967
|
+
NEVER: us,
|
|
2968
2968
|
ZodIssueCode: d,
|
|
2969
|
-
quotelessJson:
|
|
2970
|
-
ZodError:
|
|
2969
|
+
quotelessJson: at,
|
|
2970
|
+
ZodError: C
|
|
2971
2971
|
});
|
|
2972
|
-
const
|
|
2973
|
-
version:
|
|
2972
|
+
const ls = "1.2.0", hs = {
|
|
2973
|
+
version: ls
|
|
2974
2974
|
};
|
|
2975
|
-
class
|
|
2975
|
+
class ps {
|
|
2976
2976
|
constructor(e) {
|
|
2977
2977
|
this._client = e;
|
|
2978
2978
|
}
|
|
@@ -2985,10 +2985,13 @@ class us {
|
|
|
2985
2985
|
* @returns A promise that resolves to the current account object
|
|
2986
2986
|
*/
|
|
2987
2987
|
async getCurrent() {
|
|
2988
|
-
|
|
2988
|
+
const e = await this._client.request("accounts.getCurrent", {});
|
|
2989
|
+
if (!e.success)
|
|
2990
|
+
throw new Error("Failed to fetch current account");
|
|
2991
|
+
return e.account;
|
|
2989
2992
|
}
|
|
2990
2993
|
}
|
|
2991
|
-
class
|
|
2994
|
+
class fs {
|
|
2992
2995
|
constructor(e) {
|
|
2993
2996
|
this._client = e;
|
|
2994
2997
|
}
|
|
@@ -3006,7 +3009,7 @@ class ls {
|
|
|
3006
3009
|
* @returns A promise that resolves to an array of applications having the specified mount point
|
|
3007
3010
|
*/
|
|
3008
3011
|
async getAllByMountPoint(e) {
|
|
3009
|
-
return (await this._client.request("applications.
|
|
3012
|
+
return (await this._client.request("applications.getAllByMountPoint", {
|
|
3010
3013
|
mountPoint: e
|
|
3011
3014
|
})).applications;
|
|
3012
3015
|
}
|
|
@@ -3026,29 +3029,58 @@ class ls {
|
|
|
3026
3029
|
})).application;
|
|
3027
3030
|
}
|
|
3028
3031
|
/**
|
|
3029
|
-
*
|
|
3032
|
+
* Sets the dependencies for the current application.
|
|
3033
|
+
*
|
|
3034
|
+
* This method allows an application to declare which other applications it depends on.
|
|
3035
|
+
* The player will download and prepare these dependencies before they can be loaded.
|
|
3030
3036
|
*
|
|
3031
|
-
* This method
|
|
3032
|
-
*
|
|
3033
|
-
* understand its context and communicate with the platform.
|
|
3037
|
+
* IMPORTANT: This method must be called and awaited before loading any sub-applications
|
|
3038
|
+
* in iframes. Only applications that return as 'ready' should be loaded.
|
|
3034
3039
|
*
|
|
3035
|
-
*
|
|
3040
|
+
* @param applicationSpecifiers An array of application specifiers that this application depends on
|
|
3041
|
+
* @returns A promise that resolves with arrays of ready and unavailable application specifiers
|
|
3036
3042
|
*
|
|
3037
|
-
* @
|
|
3038
|
-
*
|
|
3039
|
-
*
|
|
3043
|
+
* @example
|
|
3044
|
+
* ```typescript
|
|
3045
|
+
* const result = await client.applications.setDependencies(['app1-hash', 'app2-hash'])
|
|
3046
|
+
* // result.ready: ['app1-hash'] - these can be loaded in iframes
|
|
3047
|
+
* // result.unavailable: ['app2-hash'] - these failed to load
|
|
3048
|
+
* ```
|
|
3040
3049
|
*/
|
|
3041
|
-
async
|
|
3042
|
-
return
|
|
3043
|
-
|
|
3044
|
-
|
|
3045
|
-
})).url;
|
|
3050
|
+
async setDependencies(e) {
|
|
3051
|
+
return await this._client.request("applications.setDependencies", {
|
|
3052
|
+
applicationSpecifiers: e
|
|
3053
|
+
});
|
|
3046
3054
|
}
|
|
3047
3055
|
}
|
|
3048
|
-
|
|
3056
|
+
class ms {
|
|
3057
|
+
constructor(e) {
|
|
3058
|
+
this._client = e;
|
|
3059
|
+
}
|
|
3060
|
+
/**
|
|
3061
|
+
* Retrieves hardware information about the current physical device.
|
|
3062
|
+
*
|
|
3063
|
+
* This method returns details about the device running the application, such as
|
|
3064
|
+
* serial number, model, manufacturer, and platform. This information is only
|
|
3065
|
+
* available when running on a physical device (player), not in the admin UI.
|
|
3066
|
+
*
|
|
3067
|
+
* @returns A promise that resolves to the device hardware information
|
|
3068
|
+
* @example
|
|
3069
|
+
* // Get hardware info of the current device
|
|
3070
|
+
* const info = await devices.getInformation();
|
|
3071
|
+
* console.log(`Device: ${info.deviceManufacturer} ${info.deviceModel}`);
|
|
3072
|
+
*/
|
|
3073
|
+
async getInformation() {
|
|
3074
|
+
const e = await this._client.request("devices.getInformation", {});
|
|
3075
|
+
if (!e.success)
|
|
3076
|
+
throw new Error("Failed to get device information");
|
|
3077
|
+
return e.deviceInformation;
|
|
3078
|
+
}
|
|
3079
|
+
}
|
|
3080
|
+
function ys(a, e = console.error) {
|
|
3049
3081
|
a().catch(e);
|
|
3050
3082
|
}
|
|
3051
|
-
class
|
|
3083
|
+
class js {
|
|
3052
3084
|
constructor(e) {
|
|
3053
3085
|
this._client = e;
|
|
3054
3086
|
}
|
|
@@ -3056,7 +3088,7 @@ class Ts {
|
|
|
3056
3088
|
return (await this._client.request("environment.getColorScheme", {})).colorScheme;
|
|
3057
3089
|
}
|
|
3058
3090
|
subscribeColorScheme(e) {
|
|
3059
|
-
|
|
3091
|
+
ys(async () => {
|
|
3060
3092
|
this._client.on("environment.colorSchemeChanged", e), e(await this.getColorScheme());
|
|
3061
3093
|
});
|
|
3062
3094
|
}
|
|
@@ -3064,70 +3096,53 @@ class Ts {
|
|
|
3064
3096
|
this._client.off("environment.colorSchemeChanged", e);
|
|
3065
3097
|
}
|
|
3066
3098
|
}
|
|
3067
|
-
class
|
|
3099
|
+
class gs {
|
|
3068
3100
|
constructor(e) {
|
|
3069
3101
|
this._client = e;
|
|
3070
3102
|
}
|
|
3071
3103
|
/**
|
|
3072
|
-
*
|
|
3073
|
-
*
|
|
3074
|
-
* This method allows you to search for media folders that match specific criteria,
|
|
3075
|
-
* such as name, ID, or other folder properties.
|
|
3076
|
-
*
|
|
3077
|
-
* @param query An object with partial MediaFolder properties to match against
|
|
3078
|
-
* @returns A promise that resolves to an array of matching media folders
|
|
3079
|
-
*/
|
|
3080
|
-
async queryFolders(e) {
|
|
3081
|
-
return (await this._client.request("media.queryMediaFolders", {
|
|
3082
|
-
query: e
|
|
3083
|
-
})).folders;
|
|
3084
|
-
}
|
|
3085
|
-
/**
|
|
3086
|
-
* Retrieves media folders that have been tagged with a specific tag.
|
|
3104
|
+
* Retrieves all media folders in the account.
|
|
3087
3105
|
*
|
|
3088
|
-
* @
|
|
3089
|
-
* @returns A promise that resolves to an array of media folders with the specified tag
|
|
3106
|
+
* @returns A promise that resolves to an array of all media folders
|
|
3090
3107
|
*/
|
|
3091
|
-
async
|
|
3092
|
-
return (await this._client.request("
|
|
3093
|
-
tagName: e
|
|
3094
|
-
})).folders;
|
|
3108
|
+
async getAllFolders() {
|
|
3109
|
+
return (await this._client.request("mediaFolders.getAll", {})).folders;
|
|
3095
3110
|
}
|
|
3096
3111
|
/**
|
|
3097
|
-
* Retrieves
|
|
3112
|
+
* Retrieves all media content within a specific folder.
|
|
3098
3113
|
*
|
|
3099
|
-
* @param
|
|
3100
|
-
* @returns A promise that resolves to
|
|
3114
|
+
* @param folderId The unique identifier of the folder
|
|
3115
|
+
* @returns A promise that resolves to an array of media content in the folder
|
|
3101
3116
|
*/
|
|
3102
|
-
async
|
|
3103
|
-
return (await this._client.request("media.
|
|
3104
|
-
|
|
3105
|
-
})).
|
|
3117
|
+
async getAllByFolderId(e) {
|
|
3118
|
+
return (await this._client.request("media.getAllByFolderId", {
|
|
3119
|
+
folderId: e
|
|
3120
|
+
})).contents;
|
|
3106
3121
|
}
|
|
3107
3122
|
/**
|
|
3108
|
-
* Retrieves
|
|
3123
|
+
* Retrieves media content that has been tagged with a specific tag.
|
|
3109
3124
|
*
|
|
3110
|
-
* @param
|
|
3111
|
-
* @returns A promise that resolves to an array of media content
|
|
3125
|
+
* @param tagName The name of the tag to search for
|
|
3126
|
+
* @returns A promise that resolves to an array of media content with the specified tag
|
|
3112
3127
|
*/
|
|
3113
|
-
async
|
|
3114
|
-
return (await this._client.request("media.
|
|
3115
|
-
|
|
3116
|
-
})).
|
|
3128
|
+
async getAllByTag(e) {
|
|
3129
|
+
return (await this._client.request("media.getAllByTag", {
|
|
3130
|
+
tagName: e
|
|
3131
|
+
})).contents;
|
|
3117
3132
|
}
|
|
3118
3133
|
/**
|
|
3119
3134
|
* Retrieves a specific media content item by its ID.
|
|
3120
3135
|
*
|
|
3121
3136
|
* @param id The unique identifier of the media content to retrieve
|
|
3122
|
-
* @returns A promise that resolves to the media content
|
|
3137
|
+
* @returns A promise that resolves to the media content with the specified ID
|
|
3123
3138
|
*/
|
|
3124
|
-
async
|
|
3125
|
-
return (await this._client.request("media.
|
|
3139
|
+
async getById(e) {
|
|
3140
|
+
return (await this._client.request("media.getById", {
|
|
3126
3141
|
id: e
|
|
3127
3142
|
})).content;
|
|
3128
3143
|
}
|
|
3129
3144
|
}
|
|
3130
|
-
class
|
|
3145
|
+
class _s {
|
|
3131
3146
|
constructor(e) {
|
|
3132
3147
|
this._client = e;
|
|
3133
3148
|
}
|
|
@@ -3141,7 +3156,7 @@ class ms {
|
|
|
3141
3156
|
* @returns A StoreSlice instance for the application scope
|
|
3142
3157
|
*/
|
|
3143
3158
|
get application() {
|
|
3144
|
-
return new
|
|
3159
|
+
return new me("application", "", this._client);
|
|
3145
3160
|
}
|
|
3146
3161
|
/**
|
|
3147
3162
|
* Provides access to the instance store scope.
|
|
@@ -3155,7 +3170,7 @@ class ms {
|
|
|
3155
3170
|
* @returns A StoreSlice instance for the instance scope
|
|
3156
3171
|
*/
|
|
3157
3172
|
get instance() {
|
|
3158
|
-
return new
|
|
3173
|
+
return new me("instance", this._client.applicationSpecifier, this._client);
|
|
3159
3174
|
}
|
|
3160
3175
|
/**
|
|
3161
3176
|
* Provides access to the device store scope.
|
|
@@ -3170,7 +3185,7 @@ class ms {
|
|
|
3170
3185
|
* @returns A StoreSlice instance for the device scope
|
|
3171
3186
|
*/
|
|
3172
3187
|
get device() {
|
|
3173
|
-
return new
|
|
3188
|
+
return new me("device", this._client.applicationSpecifier, this._client);
|
|
3174
3189
|
}
|
|
3175
3190
|
/**
|
|
3176
3191
|
* Provides access to the shared store scope with a specified namespace.
|
|
@@ -3186,10 +3201,10 @@ class ms {
|
|
|
3186
3201
|
* @returns A StoreSlice instance for the specified shared namespace
|
|
3187
3202
|
*/
|
|
3188
3203
|
shared(e) {
|
|
3189
|
-
return new
|
|
3204
|
+
return new me("shared", e, this._client);
|
|
3190
3205
|
}
|
|
3191
3206
|
}
|
|
3192
|
-
class
|
|
3207
|
+
class me {
|
|
3193
3208
|
constructor(e, t, s) {
|
|
3194
3209
|
this._kind = e, this._namespace = t, this._client = s;
|
|
3195
3210
|
}
|
|
@@ -3283,7 +3298,7 @@ class fe {
|
|
|
3283
3298
|
})).success;
|
|
3284
3299
|
}
|
|
3285
3300
|
}
|
|
3286
|
-
class
|
|
3301
|
+
class vs {
|
|
3287
3302
|
constructor(e) {
|
|
3288
3303
|
this._client = e;
|
|
3289
3304
|
}
|
|
@@ -3300,14 +3315,156 @@ class fs {
|
|
|
3300
3315
|
* console.log(`Current user ID: ${userResult.user.id}`);
|
|
3301
3316
|
*/
|
|
3302
3317
|
async getCurrent() {
|
|
3303
|
-
|
|
3318
|
+
const e = await this._client.request("users.getCurrent", {});
|
|
3319
|
+
if (!e.success)
|
|
3320
|
+
throw new Error("Failed to fetch current user");
|
|
3321
|
+
return e.user;
|
|
3304
3322
|
}
|
|
3305
3323
|
}
|
|
3306
|
-
|
|
3324
|
+
class ws {
|
|
3325
|
+
constructor(e) {
|
|
3326
|
+
this._client = e;
|
|
3327
|
+
}
|
|
3328
|
+
/**
|
|
3329
|
+
* Retrieves current weather conditions for a specified location using WeatherBit.
|
|
3330
|
+
*
|
|
3331
|
+
* @param params - Weather request parameters including location and units
|
|
3332
|
+
* @returns A promise that resolves to the current weather conditions
|
|
3333
|
+
* @throws {Error} If the request fails or location is invalid
|
|
3334
|
+
*
|
|
3335
|
+
* @example
|
|
3336
|
+
* ```typescript
|
|
3337
|
+
* // Get weather by city
|
|
3338
|
+
* const weather = await weather.getConditions({ city: 'New York', units: 'imperial' })
|
|
3339
|
+
*
|
|
3340
|
+
* // Get weather by postal code
|
|
3341
|
+
* const weather = await weather.getConditions({ postalCode: '10001', units: 'metric' })
|
|
3342
|
+
*
|
|
3343
|
+
* // Get weather by coordinates
|
|
3344
|
+
* const weather = await weather.getConditions({ lat: '40.7128', lon: '-74.0060' })
|
|
3345
|
+
* ```
|
|
3346
|
+
*/
|
|
3347
|
+
async getConditions(e) {
|
|
3348
|
+
const t = await this._client.request("weather.getConditions", e);
|
|
3349
|
+
if (!t.success || !t.conditions)
|
|
3350
|
+
throw new Error(t.error || "Failed to fetch weather conditions");
|
|
3351
|
+
return t.conditions;
|
|
3352
|
+
}
|
|
3353
|
+
/**
|
|
3354
|
+
* Retrieves daily weather forecast for a specified location using WeatherBit.
|
|
3355
|
+
*
|
|
3356
|
+
* @param params - Forecast request parameters including location, units, and number of days
|
|
3357
|
+
* @returns A promise that resolves to an array of daily forecast data
|
|
3358
|
+
* @throws {Error} If the request fails or location is invalid
|
|
3359
|
+
*
|
|
3360
|
+
* @example
|
|
3361
|
+
* ```typescript
|
|
3362
|
+
* // Get 5-day forecast
|
|
3363
|
+
* const forecast = await weather.getDailyForecast({
|
|
3364
|
+
* city: 'London',
|
|
3365
|
+
* units: 'metric',
|
|
3366
|
+
* days: 5
|
|
3367
|
+
* })
|
|
3368
|
+
* ```
|
|
3369
|
+
*/
|
|
3370
|
+
async getDailyForecast(e) {
|
|
3371
|
+
const t = await this._client.request("weather.getDailyForecast", e);
|
|
3372
|
+
if (!t.success || !t.forecast)
|
|
3373
|
+
throw new Error(t.error || "Failed to fetch daily forecast");
|
|
3374
|
+
return t.forecast;
|
|
3375
|
+
}
|
|
3376
|
+
/**
|
|
3377
|
+
* Retrieves hourly weather forecast for a specified location using WeatherBit.
|
|
3378
|
+
*
|
|
3379
|
+
* @param params - Forecast request parameters including location, units, and number of hours
|
|
3380
|
+
* @returns A promise that resolves to an array of hourly forecast data
|
|
3381
|
+
* @throws {Error} If the request fails or location is invalid
|
|
3382
|
+
*
|
|
3383
|
+
* @example
|
|
3384
|
+
* ```typescript
|
|
3385
|
+
* // Get 24-hour forecast
|
|
3386
|
+
* const forecast = await weather.getHourlyForecast({
|
|
3387
|
+
* city: 'Tokyo',
|
|
3388
|
+
* units: 'metric',
|
|
3389
|
+
* hours: 24
|
|
3390
|
+
* })
|
|
3391
|
+
* ```
|
|
3392
|
+
*/
|
|
3393
|
+
async getHourlyForecast(e) {
|
|
3394
|
+
const t = await this._client.request("weather.getHourlyForecast", e);
|
|
3395
|
+
if (!t.success || !t.forecast)
|
|
3396
|
+
throw new Error(t.error || "Failed to fetch hourly forecast");
|
|
3397
|
+
return t.forecast;
|
|
3398
|
+
}
|
|
3399
|
+
/**
|
|
3400
|
+
* Retrieves current weather conditions using AccuWeather.
|
|
3401
|
+
*
|
|
3402
|
+
* @param params - Weather request parameters including location and units
|
|
3403
|
+
* @returns A promise that resolves to the AccuWeather conditions data
|
|
3404
|
+
* @throws {Error} If the request fails or location is invalid
|
|
3405
|
+
*
|
|
3406
|
+
* @example
|
|
3407
|
+
* ```typescript
|
|
3408
|
+
* const weather = await weather.getAccuWeatherConditions({
|
|
3409
|
+
* city: 'Paris',
|
|
3410
|
+
* units: 'metric'
|
|
3411
|
+
* })
|
|
3412
|
+
* ```
|
|
3413
|
+
*/
|
|
3414
|
+
async getAccuWeatherConditions(e) {
|
|
3415
|
+
const t = await this._client.request("weather.getAccuWeatherConditions", e);
|
|
3416
|
+
if (!t.success || !t.data)
|
|
3417
|
+
throw new Error(t.error || "Failed to fetch AccuWeather conditions");
|
|
3418
|
+
return t.data;
|
|
3419
|
+
}
|
|
3420
|
+
/**
|
|
3421
|
+
* Retrieves daily forecast using AccuWeather.
|
|
3422
|
+
*
|
|
3423
|
+
* @param params - Forecast request parameters including location and units
|
|
3424
|
+
* @returns A promise that resolves to the AccuWeather daily forecast data
|
|
3425
|
+
* @throws {Error} If the request fails or location is invalid
|
|
3426
|
+
*
|
|
3427
|
+
* @example
|
|
3428
|
+
* ```typescript
|
|
3429
|
+
* const forecast = await weather.getAccuWeatherDailyForecast({
|
|
3430
|
+
* city: 'Sydney',
|
|
3431
|
+
* units: 'metric'
|
|
3432
|
+
* })
|
|
3433
|
+
* ```
|
|
3434
|
+
*/
|
|
3435
|
+
async getAccuWeatherDailyForecast(e) {
|
|
3436
|
+
const t = await this._client.request("weather.getAccuWeatherDailyForecast", e);
|
|
3437
|
+
if (!t.success || !t.data)
|
|
3438
|
+
throw new Error(t.error || "Failed to fetch AccuWeather daily forecast");
|
|
3439
|
+
return t.data;
|
|
3440
|
+
}
|
|
3441
|
+
/**
|
|
3442
|
+
* Retrieves hourly forecast using AccuWeather.
|
|
3443
|
+
*
|
|
3444
|
+
* @param params - Forecast request parameters including location and units
|
|
3445
|
+
* @returns A promise that resolves to the AccuWeather hourly forecast data
|
|
3446
|
+
* @throws {Error} If the request fails or location is invalid
|
|
3447
|
+
*
|
|
3448
|
+
* @example
|
|
3449
|
+
* ```typescript
|
|
3450
|
+
* const forecast = await weather.getAccuWeatherHourlyForecast({
|
|
3451
|
+
* city: 'Berlin',
|
|
3452
|
+
* units: 'metric'
|
|
3453
|
+
* })
|
|
3454
|
+
* ```
|
|
3455
|
+
*/
|
|
3456
|
+
async getAccuWeatherHourlyForecast(e) {
|
|
3457
|
+
const t = await this._client.request("weather.getAccuWeatherHourlyForecast", e);
|
|
3458
|
+
if (!t.success || !t.data)
|
|
3459
|
+
throw new Error(t.error || "Failed to fetch AccuWeather hourly forecast");
|
|
3460
|
+
return t.data;
|
|
3461
|
+
}
|
|
3462
|
+
}
|
|
3463
|
+
const bs = Ie.object({
|
|
3307
3464
|
name: Ie.string(),
|
|
3308
3465
|
data: Ie.any()
|
|
3309
3466
|
});
|
|
3310
|
-
class
|
|
3467
|
+
class ks {
|
|
3311
3468
|
/**
|
|
3312
3469
|
* Creates a new RootSettingsNavigation API instance.
|
|
3313
3470
|
*
|
|
@@ -3315,7 +3472,7 @@ class gs {
|
|
|
3315
3472
|
* @throws {Error} If used by an application not mounted at the 'rootSettingsNavigation' mount point
|
|
3316
3473
|
*/
|
|
3317
3474
|
constructor(e) {
|
|
3318
|
-
if (e._client.
|
|
3475
|
+
if (e._client._applicationSpecifier !== "rootSettingsNavigation")
|
|
3319
3476
|
throw new Error("RootSettingsNavigation can only be used in the rootSettingsNavigation mount point");
|
|
3320
3477
|
this._store = e;
|
|
3321
3478
|
}
|
|
@@ -3330,9 +3487,9 @@ class gs {
|
|
|
3330
3487
|
* @returns A promise that resolves when the navigation has been registered
|
|
3331
3488
|
*/
|
|
3332
3489
|
async setRootSettingsNavigation(e) {
|
|
3333
|
-
const t = this._store.shared("root-settings-navigation"), s = await t.get("navigation"), n = this._store._client.
|
|
3490
|
+
const t = this._store.shared("root-settings-navigation"), s = await t.get("navigation"), n = this._store._client._applicationSpecifier;
|
|
3334
3491
|
s[n] = {
|
|
3335
|
-
|
|
3492
|
+
applicationSpecifier: n,
|
|
3336
3493
|
entries: e.entries
|
|
3337
3494
|
}, t.set("navigation", s);
|
|
3338
3495
|
}
|
|
@@ -3345,7 +3502,7 @@ class gs {
|
|
|
3345
3502
|
* @returns A promise that resolves to the navigation state for this application
|
|
3346
3503
|
*/
|
|
3347
3504
|
async getRootSettingsNavigation() {
|
|
3348
|
-
const e = await this._store.shared("root-settings-navigation").get("navigation"), t = this._store._client.
|
|
3505
|
+
const e = await this._store.shared("root-settings-navigation").get("navigation"), t = this._store._client._applicationSpecifier;
|
|
3349
3506
|
return e[t];
|
|
3350
3507
|
}
|
|
3351
3508
|
/**
|
|
@@ -3361,8 +3518,47 @@ class gs {
|
|
|
3361
3518
|
return this._store.shared("root-settings-navigation").get("navigation");
|
|
3362
3519
|
}
|
|
3363
3520
|
}
|
|
3521
|
+
class xs {
|
|
3522
|
+
constructor(e) {
|
|
3523
|
+
this._client = e;
|
|
3524
|
+
}
|
|
3525
|
+
async fetch(e, t) {
|
|
3526
|
+
let s;
|
|
3527
|
+
typeof e == "string" ? s = e : e instanceof URL ? s = e.toString() : (s = e.url, t || (t = {
|
|
3528
|
+
method: e.method,
|
|
3529
|
+
headers: e.headers,
|
|
3530
|
+
body: e.body,
|
|
3531
|
+
credentials: e.credentials,
|
|
3532
|
+
cache: e.cache,
|
|
3533
|
+
redirect: e.redirect,
|
|
3534
|
+
referrer: e.referrer,
|
|
3535
|
+
integrity: e.integrity
|
|
3536
|
+
}));
|
|
3537
|
+
let n = {};
|
|
3538
|
+
t != null && t.headers && (t.headers instanceof Headers ? t.headers.forEach((u, f) => {
|
|
3539
|
+
n[f] = u;
|
|
3540
|
+
}) : Array.isArray(t.headers) ? t.headers.forEach(([u, f]) => {
|
|
3541
|
+
n[u] = f;
|
|
3542
|
+
}) : n = t.headers);
|
|
3543
|
+
const i = await this._client.request("proxy.fetch", {
|
|
3544
|
+
url: s,
|
|
3545
|
+
method: (t == null ? void 0 : t.method) || "GET",
|
|
3546
|
+
headers: n,
|
|
3547
|
+
body: (t == null ? void 0 : t.body) || null
|
|
3548
|
+
});
|
|
3549
|
+
if (!i.success)
|
|
3550
|
+
throw new Error(`Proxy fetch failed: ${i.statusText}`);
|
|
3551
|
+
const r = new Headers(i.headers), o = {
|
|
3552
|
+
status: i.status,
|
|
3553
|
+
statusText: i.statusText,
|
|
3554
|
+
headers: r
|
|
3555
|
+
};
|
|
3556
|
+
let c = null;
|
|
3557
|
+
return i.body !== null && i.body !== void 0 && (typeof i.body == "string" || i.body instanceof ArrayBuffer ? c = i.body : typeof i.body == "object" && (c = JSON.stringify(i.body))), new Response(c, o);
|
|
3558
|
+
}
|
|
3559
|
+
}
|
|
3364
3560
|
const U = 1e3 * 30;
|
|
3365
|
-
class
|
|
3561
|
+
class Zs {
|
|
3366
3562
|
/**
|
|
3367
3563
|
* Creates a new Client instance for communicating with the TelemetryOS platform.
|
|
3368
3564
|
*
|
|
@@ -3388,7 +3584,7 @@ class ys {
|
|
|
3388
3584
|
* @returns An Accounts instance bound to this client
|
|
3389
3585
|
*/
|
|
3390
3586
|
get accounts() {
|
|
3391
|
-
return new
|
|
3587
|
+
return new ps(this);
|
|
3392
3588
|
}
|
|
3393
3589
|
/**
|
|
3394
3590
|
* Provides access to the users API for retrieving TelemetryOS user information.
|
|
@@ -3402,13 +3598,13 @@ class ys {
|
|
|
3402
3598
|
* @returns A Users instance bound to this client
|
|
3403
3599
|
*/
|
|
3404
3600
|
get users() {
|
|
3405
|
-
return new
|
|
3601
|
+
return new vs(this);
|
|
3406
3602
|
}
|
|
3407
3603
|
/**
|
|
3408
3604
|
* Provides access to the store API for data persistence with multiple storage scopes.
|
|
3409
3605
|
*
|
|
3410
3606
|
* This property returns a new Store instance that allows saving, retrieving, and
|
|
3411
|
-
* subscribing to data changes across different scopes (
|
|
3607
|
+
* subscribing to data changes across different scopes (application, instance, device, shared).
|
|
3412
3608
|
*
|
|
3413
3609
|
* NOTE: Most application developers should use the global store() function
|
|
3414
3610
|
* instead of accessing this property directly.
|
|
@@ -3416,13 +3612,13 @@ class ys {
|
|
|
3416
3612
|
* @returns A Store instance bound to this client
|
|
3417
3613
|
*/
|
|
3418
3614
|
get store() {
|
|
3419
|
-
return new
|
|
3615
|
+
return new _s(this);
|
|
3420
3616
|
}
|
|
3421
3617
|
/**
|
|
3422
|
-
* Provides access to the applications API for discovering
|
|
3618
|
+
* Provides access to the applications API for discovering other TelemetryOS applications.
|
|
3423
3619
|
*
|
|
3424
3620
|
* This property returns a new Applications instance that allows querying for applications
|
|
3425
|
-
* by name or mount point, and
|
|
3621
|
+
* by name or mount point, and setting application dependencies.
|
|
3426
3622
|
*
|
|
3427
3623
|
* NOTE: Most application developers should use the global applications() function
|
|
3428
3624
|
* instead of accessing this property directly.
|
|
@@ -3430,7 +3626,7 @@ class ys {
|
|
|
3430
3626
|
* @returns An Applications instance bound to this client
|
|
3431
3627
|
*/
|
|
3432
3628
|
get applications() {
|
|
3433
|
-
return new
|
|
3629
|
+
return new fs(this);
|
|
3434
3630
|
}
|
|
3435
3631
|
/**
|
|
3436
3632
|
* Provides access to the media API for working with content hosted on the TelemetryOS platform.
|
|
@@ -3445,7 +3641,36 @@ class ys {
|
|
|
3445
3641
|
* @returns A Media instance bound to this client
|
|
3446
3642
|
*/
|
|
3447
3643
|
get media() {
|
|
3448
|
-
return new
|
|
3644
|
+
return new gs(this);
|
|
3645
|
+
}
|
|
3646
|
+
/**
|
|
3647
|
+
* Provides access to the proxy API for fetching third-party content through the TelemetryOS proxy service.
|
|
3648
|
+
*
|
|
3649
|
+
* This property returns a new Proxy instance that allows applications to fetch content from external
|
|
3650
|
+
* URLs through the platform's proxy service, which handles authentication, caching, and CORS issues.
|
|
3651
|
+
*
|
|
3652
|
+
* NOTE: Most application developers should use the global proxy() function
|
|
3653
|
+
* instead of accessing this property directly.
|
|
3654
|
+
*
|
|
3655
|
+
* @returns A Proxy instance bound to this client
|
|
3656
|
+
*/
|
|
3657
|
+
get proxy() {
|
|
3658
|
+
return new xs(this);
|
|
3659
|
+
}
|
|
3660
|
+
/**
|
|
3661
|
+
* Provides access to the devices API for interacting with the current device.
|
|
3662
|
+
*
|
|
3663
|
+
* This property returns a new Devices instance that allows applications to get information
|
|
3664
|
+
* about the specific device the application is running on, subscribe to device changes,
|
|
3665
|
+
* and access device hardware information.
|
|
3666
|
+
*
|
|
3667
|
+
* NOTE: Most application developers should use the global devices() function
|
|
3668
|
+
* instead of accessing this property directly.
|
|
3669
|
+
*
|
|
3670
|
+
* @returns A Devices instance bound to this client
|
|
3671
|
+
*/
|
|
3672
|
+
get devices() {
|
|
3673
|
+
return new ms(this);
|
|
3449
3674
|
}
|
|
3450
3675
|
/**
|
|
3451
3676
|
* Provides access to the root settings navigation API for TelemetryOS administration UI integration.
|
|
@@ -3463,7 +3688,22 @@ class ys {
|
|
|
3463
3688
|
* @throws {Error} If used by an application not mounted at the 'rootSettingsNavigation' mount point
|
|
3464
3689
|
*/
|
|
3465
3690
|
get rootSettingsNavigation() {
|
|
3466
|
-
return new
|
|
3691
|
+
return new ks(this.store);
|
|
3692
|
+
}
|
|
3693
|
+
/**
|
|
3694
|
+
* Provides access to the weather API for retrieving weather data.
|
|
3695
|
+
*
|
|
3696
|
+
* This property returns a new Weather instance that allows applications to fetch
|
|
3697
|
+
* current weather conditions and forecasts from various providers (WeatherBit, AccuWeather)
|
|
3698
|
+
* through the General Integrations Service.
|
|
3699
|
+
*
|
|
3700
|
+
* NOTE: Most application developers should use the global weather() function
|
|
3701
|
+
* instead of accessing this property directly.
|
|
3702
|
+
*
|
|
3703
|
+
* @returns A Weather instance bound to this client
|
|
3704
|
+
*/
|
|
3705
|
+
get weather() {
|
|
3706
|
+
return new ws(this);
|
|
3467
3707
|
}
|
|
3468
3708
|
get applicationName() {
|
|
3469
3709
|
return this._applicationName;
|
|
@@ -3507,18 +3747,18 @@ class ys {
|
|
|
3507
3747
|
this._windowMessageHandler = (i) => {
|
|
3508
3748
|
if (i.source === window)
|
|
3509
3749
|
return;
|
|
3510
|
-
for (let
|
|
3511
|
-
window.frames[
|
|
3512
|
-
const r =
|
|
3750
|
+
for (let f = 0; f < window.frames.length; f += 1)
|
|
3751
|
+
window.frames[f].postMessage(i.data, "*");
|
|
3752
|
+
const r = bs.safeParse(i.data);
|
|
3513
3753
|
if (!r.success)
|
|
3514
3754
|
return;
|
|
3515
3755
|
const o = r.data, c = this._onHandlers.get(o.name), u = this._onceHandlers.get(o.name);
|
|
3516
3756
|
if (c)
|
|
3517
|
-
for (const
|
|
3518
|
-
|
|
3757
|
+
for (const f of c)
|
|
3758
|
+
f(o.data);
|
|
3519
3759
|
if (u) {
|
|
3520
|
-
for (const
|
|
3521
|
-
|
|
3760
|
+
for (const f of u)
|
|
3761
|
+
f(o.data);
|
|
3522
3762
|
this._onceHandlers.delete(o.name);
|
|
3523
3763
|
}
|
|
3524
3764
|
}, window.addEventListener("message", this._windowMessageHandler);
|
|
@@ -3581,7 +3821,7 @@ class ys {
|
|
|
3581
3821
|
* @throws {Error} If the request times out
|
|
3582
3822
|
*/
|
|
3583
3823
|
request(e, t) {
|
|
3584
|
-
const s =
|
|
3824
|
+
const s = ye(), n = {
|
|
3585
3825
|
telemetrySdkVersion: ge,
|
|
3586
3826
|
applicationName: this._applicationName,
|
|
3587
3827
|
applicationSpecifier: this._applicationSpecifier,
|
|
@@ -3592,14 +3832,14 @@ class ys {
|
|
|
3592
3832
|
};
|
|
3593
3833
|
window.parent.postMessage(n, "*");
|
|
3594
3834
|
let i = !1, r;
|
|
3595
|
-
const o = new Promise((u,
|
|
3596
|
-
const
|
|
3835
|
+
const o = new Promise((u, f) => {
|
|
3836
|
+
const b = new Error(`${e} message request with response name of ${s} timed out after ${U}`);
|
|
3597
3837
|
setTimeout(() => {
|
|
3598
|
-
i = !0, this.off(s, r),
|
|
3838
|
+
i = !0, this.off(s, r), f(b);
|
|
3599
3839
|
}, U);
|
|
3600
3840
|
}), c = new Promise((u) => {
|
|
3601
|
-
r = (
|
|
3602
|
-
i || u(
|
|
3841
|
+
r = (f) => {
|
|
3842
|
+
i || u(f);
|
|
3603
3843
|
}, this.once(s, u);
|
|
3604
3844
|
});
|
|
3605
3845
|
return Promise.race([o, c]);
|
|
@@ -3607,7 +3847,7 @@ class ys {
|
|
|
3607
3847
|
async subscribe(e, t, s) {
|
|
3608
3848
|
let n, i;
|
|
3609
3849
|
typeof t == "function" ? i = t : (n = t, i = s);
|
|
3610
|
-
const r =
|
|
3850
|
+
const r = ye(), o = ye();
|
|
3611
3851
|
let c = this._subscriptionNamesBySubjectName.get(e);
|
|
3612
3852
|
c || (c = [], this._subscriptionNamesBySubjectName.set(e, c)), c.push(r), this._subscriptionNamesByHandler.set(i, r), this.on(r, i);
|
|
3613
3853
|
const u = {
|
|
@@ -3621,23 +3861,23 @@ class ys {
|
|
|
3621
3861
|
subscriptionName: r
|
|
3622
3862
|
};
|
|
3623
3863
|
window.parent.postMessage(u, "*");
|
|
3624
|
-
let
|
|
3625
|
-
const
|
|
3864
|
+
let f = !1, b;
|
|
3865
|
+
const j = new Promise((D, L) => {
|
|
3626
3866
|
const Oe = new Error(`${e} subscribe request with subscription name of ${r} and response name of ${o} timed out after ${U}`);
|
|
3627
3867
|
setTimeout(() => {
|
|
3628
|
-
|
|
3868
|
+
f = !0, this.off(o, b), L(Oe);
|
|
3629
3869
|
}, U);
|
|
3630
|
-
}),
|
|
3631
|
-
|
|
3632
|
-
|
|
3633
|
-
}, this.on(o,
|
|
3870
|
+
}), Ae = new Promise((D) => {
|
|
3871
|
+
b = (L) => {
|
|
3872
|
+
f || D(L);
|
|
3873
|
+
}, this.on(o, D);
|
|
3634
3874
|
});
|
|
3635
|
-
return Promise.race([
|
|
3875
|
+
return Promise.race([j, Ae]);
|
|
3636
3876
|
}
|
|
3637
3877
|
async unsubscribe(e, t, s) {
|
|
3638
3878
|
let n, i;
|
|
3639
3879
|
typeof t == "function" ? i = t : (n = t, i = s);
|
|
3640
|
-
const r =
|
|
3880
|
+
const r = ye();
|
|
3641
3881
|
let o = [];
|
|
3642
3882
|
if (i) {
|
|
3643
3883
|
const c = this._subscriptionNamesByHandler.get(i);
|
|
@@ -3659,18 +3899,18 @@ class ys {
|
|
|
3659
3899
|
unsubscribeName: c
|
|
3660
3900
|
};
|
|
3661
3901
|
window.parent.postMessage(u, "*");
|
|
3662
|
-
let
|
|
3663
|
-
const
|
|
3902
|
+
let f = !1, b;
|
|
3903
|
+
const j = new Promise((D, L) => {
|
|
3664
3904
|
const Oe = new Error(`${e} unsubscribe request with unsubscribe name of ${c} and response name of ${r} timed out after ${U}`);
|
|
3665
3905
|
setTimeout(() => {
|
|
3666
|
-
|
|
3906
|
+
f = !0, this.off(r, b), L(Oe);
|
|
3667
3907
|
}, U);
|
|
3668
|
-
}),
|
|
3669
|
-
|
|
3670
|
-
|
|
3671
|
-
}, this.once(r,
|
|
3908
|
+
}), Ae = new Promise((D) => {
|
|
3909
|
+
b = (L) => {
|
|
3910
|
+
f || D(L);
|
|
3911
|
+
}, this.once(r, D);
|
|
3672
3912
|
});
|
|
3673
|
-
if (!(await Promise.race([
|
|
3913
|
+
if (!(await Promise.race([j, Ae])).success)
|
|
3674
3914
|
return { success: !1 };
|
|
3675
3915
|
}
|
|
3676
3916
|
return { success: !0 };
|
|
@@ -3747,122 +3987,202 @@ class ys {
|
|
|
3747
3987
|
}
|
|
3748
3988
|
}
|
|
3749
3989
|
}
|
|
3750
|
-
function
|
|
3990
|
+
function ye() {
|
|
3751
3991
|
return Math.random().toString(36).slice(2, 9);
|
|
3752
3992
|
}
|
|
3753
|
-
const ge =
|
|
3754
|
-
class
|
|
3993
|
+
const ge = hs.version;
|
|
3994
|
+
class Ss {
|
|
3755
3995
|
constructor(e) {
|
|
3756
3996
|
this._client = e;
|
|
3757
3997
|
}
|
|
3998
|
+
/**
|
|
3999
|
+
* Activates a named override on the device.
|
|
4000
|
+
*
|
|
4001
|
+
* Overrides can be used to temporarily change device behavior, such as
|
|
4002
|
+
* displaying special content, triggering alerts, or modifying the playback schedule.
|
|
4003
|
+
*
|
|
4004
|
+
* @param name The name/identifier of the override to activate
|
|
4005
|
+
* @returns A promise that resolves to true if successful
|
|
4006
|
+
* @example
|
|
4007
|
+
* // Activate an emergency alert override
|
|
4008
|
+
* await overrides().setOverride('emergency-alert');
|
|
4009
|
+
*
|
|
4010
|
+
* @example
|
|
4011
|
+
* // Activate a promotional content override
|
|
4012
|
+
* await overrides().setOverride('promo-mode');
|
|
4013
|
+
*/
|
|
3758
4014
|
async setOverride(e) {
|
|
3759
|
-
|
|
4015
|
+
if (!(await this._client.request("overrides.setOverride", { name: e })).success)
|
|
4016
|
+
throw new Error("Failed to set override");
|
|
4017
|
+
return !0;
|
|
3760
4018
|
}
|
|
4019
|
+
/**
|
|
4020
|
+
* Deactivates a named override on the device.
|
|
4021
|
+
*
|
|
4022
|
+
* This removes a previously set override, returning the device to normal operation
|
|
4023
|
+
* or allowing other overrides to take effect.
|
|
4024
|
+
*
|
|
4025
|
+
* @param name The name/identifier of the override to deactivate
|
|
4026
|
+
* @returns A promise that resolves to true if successful
|
|
4027
|
+
* @example
|
|
4028
|
+
* // Clear an emergency alert override
|
|
4029
|
+
* await overrides().clearOverride('emergency-alert');
|
|
4030
|
+
*
|
|
4031
|
+
* @example
|
|
4032
|
+
* // Clear promotional mode when no longer needed
|
|
4033
|
+
* await overrides().clearOverride('promo-mode');
|
|
4034
|
+
*/
|
|
3761
4035
|
async clearOverride(e) {
|
|
3762
|
-
|
|
4036
|
+
if (!(await this._client.request("overrides.clearOverride", {
|
|
4037
|
+
name: e
|
|
4038
|
+
})).success)
|
|
4039
|
+
throw new Error("Failed to clear override");
|
|
4040
|
+
return !0;
|
|
3763
4041
|
}
|
|
3764
4042
|
}
|
|
3765
|
-
class
|
|
4043
|
+
class Ts {
|
|
3766
4044
|
constructor(e) {
|
|
3767
4045
|
this._client = e;
|
|
3768
4046
|
}
|
|
4047
|
+
/**
|
|
4048
|
+
* Advances to the next page in the current playlist.
|
|
4049
|
+
*
|
|
4050
|
+
* @returns A promise that resolves to true if successful
|
|
4051
|
+
* @example
|
|
4052
|
+
* // Move to the next page
|
|
4053
|
+
* await playlist().nextPage();
|
|
4054
|
+
*/
|
|
3769
4055
|
async nextPage() {
|
|
3770
|
-
|
|
4056
|
+
if (!(await this._client.request("playlist.nextPage", {})).success)
|
|
4057
|
+
throw new Error("Failed to advance to next page");
|
|
4058
|
+
return !0;
|
|
3771
4059
|
}
|
|
4060
|
+
/**
|
|
4061
|
+
* Returns to the previous page in the current playlist.
|
|
4062
|
+
*
|
|
4063
|
+
* @returns A promise that resolves to true if successful
|
|
4064
|
+
* @example
|
|
4065
|
+
* // Move to the previous page
|
|
4066
|
+
* await playlist().previousPage();
|
|
4067
|
+
*/
|
|
3772
4068
|
async previousPage() {
|
|
3773
|
-
|
|
4069
|
+
if (!(await this._client.request("playlist.previousPage", {})).success)
|
|
4070
|
+
throw new Error("Failed to return to previous page");
|
|
4071
|
+
return !0;
|
|
3774
4072
|
}
|
|
4073
|
+
/**
|
|
4074
|
+
* Sets the display duration for the current page.
|
|
4075
|
+
*
|
|
4076
|
+
* This allows the embedded application to dynamically adjust how long
|
|
4077
|
+
* the current page is displayed before advancing to the next page.
|
|
4078
|
+
*
|
|
4079
|
+
* @param duration The duration in milliseconds
|
|
4080
|
+
* @returns A promise that resolves to true if successful
|
|
4081
|
+
* @example
|
|
4082
|
+
* // Set page duration to 10 seconds
|
|
4083
|
+
* await playlist().setDuration(10000);
|
|
4084
|
+
*
|
|
4085
|
+
* @example
|
|
4086
|
+
* // Extend duration based on content
|
|
4087
|
+
* if (hasMoreContent) {
|
|
4088
|
+
* await playlist().setDuration(30000); // 30 seconds
|
|
4089
|
+
* }
|
|
4090
|
+
*/
|
|
3775
4091
|
async setDuration(e) {
|
|
3776
|
-
|
|
4092
|
+
if (!(await this._client.request("playlist.setDuration", {
|
|
4093
|
+
duration: e
|
|
4094
|
+
})).success)
|
|
4095
|
+
throw new Error("Failed to set page duration");
|
|
4096
|
+
return !0;
|
|
3777
4097
|
}
|
|
3778
4098
|
}
|
|
3779
|
-
class
|
|
4099
|
+
class Ns extends Zs {
|
|
3780
4100
|
get playlist() {
|
|
3781
|
-
return new
|
|
4101
|
+
return new Ts(this);
|
|
3782
4102
|
}
|
|
3783
4103
|
get overrides() {
|
|
3784
|
-
return new
|
|
4104
|
+
return new Ss(this);
|
|
3785
4105
|
}
|
|
3786
4106
|
}
|
|
3787
4107
|
let v = null;
|
|
3788
|
-
function
|
|
4108
|
+
function $s() {
|
|
3789
4109
|
return v;
|
|
3790
4110
|
}
|
|
3791
|
-
function
|
|
3792
|
-
v = new
|
|
4111
|
+
function Ps(a) {
|
|
4112
|
+
v = new Ns(a), v.bind();
|
|
3793
4113
|
}
|
|
3794
|
-
function
|
|
4114
|
+
function Rs() {
|
|
3795
4115
|
v == null || v.unbind(), v = null;
|
|
3796
4116
|
}
|
|
3797
|
-
function
|
|
3798
|
-
return
|
|
4117
|
+
function Fs(...a) {
|
|
4118
|
+
return Z(v), v.on(...a);
|
|
3799
4119
|
}
|
|
3800
|
-
function
|
|
3801
|
-
return
|
|
4120
|
+
function Ms(...a) {
|
|
4121
|
+
return Z(v), v.once(...a);
|
|
3802
4122
|
}
|
|
3803
|
-
function
|
|
3804
|
-
return
|
|
4123
|
+
function Ds(...a) {
|
|
4124
|
+
return Z(v), v.off(...a);
|
|
3805
4125
|
}
|
|
3806
|
-
function
|
|
3807
|
-
return
|
|
4126
|
+
function Ls(...a) {
|
|
4127
|
+
return Z(v), v.send(...a);
|
|
3808
4128
|
}
|
|
3809
|
-
function
|
|
3810
|
-
return
|
|
4129
|
+
function qs(...a) {
|
|
4130
|
+
return Z(v), v.request(...a);
|
|
3811
4131
|
}
|
|
3812
|
-
function
|
|
3813
|
-
return
|
|
4132
|
+
function zs(...a) {
|
|
4133
|
+
return Z(v), v.subscribe(...a);
|
|
3814
4134
|
}
|
|
3815
|
-
function
|
|
3816
|
-
return
|
|
4135
|
+
function Vs(...a) {
|
|
4136
|
+
return Z(v), v.unsubscribe(...a);
|
|
3817
4137
|
}
|
|
3818
|
-
function
|
|
3819
|
-
return
|
|
4138
|
+
function Bs() {
|
|
4139
|
+
return Z(v), v.store;
|
|
3820
4140
|
}
|
|
3821
|
-
function
|
|
3822
|
-
return
|
|
4141
|
+
function Us() {
|
|
4142
|
+
return Z(v), v.applications;
|
|
3823
4143
|
}
|
|
3824
|
-
function
|
|
3825
|
-
return
|
|
4144
|
+
function Hs() {
|
|
4145
|
+
return Z(v), v.media;
|
|
3826
4146
|
}
|
|
3827
|
-
function
|
|
3828
|
-
return
|
|
4147
|
+
function Ws() {
|
|
4148
|
+
return Z(v), v.playlist;
|
|
3829
4149
|
}
|
|
3830
|
-
function
|
|
3831
|
-
return
|
|
4150
|
+
function Ks() {
|
|
4151
|
+
return Z(v), v.overrides;
|
|
3832
4152
|
}
|
|
3833
|
-
function
|
|
3834
|
-
return
|
|
4153
|
+
function Js() {
|
|
4154
|
+
return Z(v), v.accounts;
|
|
3835
4155
|
}
|
|
3836
|
-
function
|
|
3837
|
-
return
|
|
4156
|
+
function Ys() {
|
|
4157
|
+
return Z(v), v.users;
|
|
3838
4158
|
}
|
|
3839
|
-
function
|
|
4159
|
+
function Z(a) {
|
|
3840
4160
|
if (!a)
|
|
3841
4161
|
throw new Error("SDK is not configured");
|
|
3842
4162
|
}
|
|
3843
4163
|
export {
|
|
3844
|
-
|
|
3845
|
-
|
|
3846
|
-
|
|
3847
|
-
|
|
3848
|
-
|
|
3849
|
-
|
|
3850
|
-
|
|
3851
|
-
|
|
3852
|
-
|
|
3853
|
-
|
|
3854
|
-
|
|
3855
|
-
|
|
3856
|
-
|
|
3857
|
-
|
|
3858
|
-
|
|
3859
|
-
|
|
3860
|
-
|
|
3861
|
-
|
|
3862
|
-
|
|
3863
|
-
|
|
3864
|
-
|
|
4164
|
+
ps as Accounts,
|
|
4165
|
+
fs as Applications,
|
|
4166
|
+
js as Environment,
|
|
4167
|
+
gs as Media,
|
|
4168
|
+
_s as Store,
|
|
4169
|
+
vs as Users,
|
|
4170
|
+
Js as accounts,
|
|
4171
|
+
Us as applications,
|
|
4172
|
+
Ps as configure,
|
|
4173
|
+
Rs as destroy,
|
|
4174
|
+
$s as globalClient,
|
|
4175
|
+
Hs as media,
|
|
4176
|
+
Ds as off,
|
|
4177
|
+
Fs as on,
|
|
4178
|
+
Ms as once,
|
|
4179
|
+
Ks as overrides,
|
|
4180
|
+
Ws as playlist,
|
|
4181
|
+
qs as request,
|
|
4182
|
+
Ls as send,
|
|
4183
|
+
Bs as store,
|
|
4184
|
+
zs as subscribe,
|
|
3865
4185
|
ge as telemetrySdkVersion,
|
|
3866
|
-
|
|
3867
|
-
|
|
4186
|
+
Vs as unsubscribe,
|
|
4187
|
+
Ys as users
|
|
3868
4188
|
};
|