@nuclearplayer/plugin-sdk 2.3.0 → 2.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -1
- package/dist/index.d.ts +163 -3
- package/dist/index.js +493 -423
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -27,6 +27,21 @@ class Ne {
|
|
|
27
27
|
}
|
|
28
28
|
}
|
|
29
29
|
class Oe {
|
|
30
|
+
#t;
|
|
31
|
+
constructor(e) {
|
|
32
|
+
this.#t = e;
|
|
33
|
+
}
|
|
34
|
+
#e(e) {
|
|
35
|
+
const t = this.#t;
|
|
36
|
+
if (!t)
|
|
37
|
+
throw new Error("Events host not available");
|
|
38
|
+
return e(t);
|
|
39
|
+
}
|
|
40
|
+
on(e, t) {
|
|
41
|
+
return this.#e((s) => s.on(e, t));
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
class Re {
|
|
30
45
|
#t;
|
|
31
46
|
constructor(e) {
|
|
32
47
|
this.#t = e;
|
|
@@ -77,7 +92,7 @@ class Oe {
|
|
|
77
92
|
return this.#e((t) => t.subscribe(e));
|
|
78
93
|
}
|
|
79
94
|
}
|
|
80
|
-
const
|
|
95
|
+
const Ee = (r) => {
|
|
81
96
|
if (r instanceof Headers) {
|
|
82
97
|
const e = {};
|
|
83
98
|
return r.forEach((t, s) => {
|
|
@@ -86,9 +101,9 @@ const Re = (r) => {
|
|
|
86
101
|
}
|
|
87
102
|
return Array.isArray(r) ? Object.fromEntries(r) : r;
|
|
88
103
|
};
|
|
89
|
-
function
|
|
104
|
+
function Ze(r) {
|
|
90
105
|
return async (e, t) => {
|
|
91
|
-
const s = String(e instanceof Request ? e.url : e), a = t?.headers ?
|
|
106
|
+
const s = String(e instanceof Request ? e.url : e), a = t?.headers ? Ee(t.headers) : void 0, n = typeof t?.body == "string" ? t.body : void 0, i = await r.fetch(s, {
|
|
92
107
|
method: t?.method,
|
|
93
108
|
headers: a,
|
|
94
109
|
body: n
|
|
@@ -99,7 +114,7 @@ function Ee(r) {
|
|
|
99
114
|
});
|
|
100
115
|
};
|
|
101
116
|
}
|
|
102
|
-
const
|
|
117
|
+
const Pe = {
|
|
103
118
|
fetch: async () => ({
|
|
104
119
|
status: 501,
|
|
105
120
|
headers: {},
|
|
@@ -109,17 +124,17 @@ const Ze = {
|
|
|
109
124
|
class je {
|
|
110
125
|
fetch;
|
|
111
126
|
constructor(e) {
|
|
112
|
-
this.fetch =
|
|
127
|
+
this.fetch = Ze(e ?? Pe);
|
|
113
128
|
}
|
|
114
129
|
}
|
|
115
|
-
const
|
|
130
|
+
const $e = {
|
|
116
131
|
log: () => {
|
|
117
132
|
}
|
|
118
133
|
};
|
|
119
|
-
class
|
|
134
|
+
class Me {
|
|
120
135
|
host;
|
|
121
136
|
constructor(e) {
|
|
122
|
-
this.host = e ??
|
|
137
|
+
this.host = e ?? $e;
|
|
123
138
|
}
|
|
124
139
|
trace(e) {
|
|
125
140
|
this.host.log("trace", e);
|
|
@@ -140,7 +155,7 @@ class $e {
|
|
|
140
155
|
this.host.log(e, t);
|
|
141
156
|
}
|
|
142
157
|
}
|
|
143
|
-
class
|
|
158
|
+
class Ve {
|
|
144
159
|
#t;
|
|
145
160
|
constructor(e) {
|
|
146
161
|
this.#t = e;
|
|
@@ -180,7 +195,7 @@ class Me {
|
|
|
180
195
|
return this.#e((s) => s.fetchAlbumDetails(e, t));
|
|
181
196
|
}
|
|
182
197
|
}
|
|
183
|
-
class
|
|
198
|
+
class Le {
|
|
184
199
|
#t;
|
|
185
200
|
constructor(e) {
|
|
186
201
|
this.#t = e;
|
|
@@ -213,7 +228,7 @@ class Ve {
|
|
|
213
228
|
return this.#e((t) => t.subscribe(e));
|
|
214
229
|
}
|
|
215
230
|
}
|
|
216
|
-
class
|
|
231
|
+
class ze {
|
|
217
232
|
#t;
|
|
218
233
|
constructor(e) {
|
|
219
234
|
this.#t = e;
|
|
@@ -255,7 +270,7 @@ class Le {
|
|
|
255
270
|
return this.#e((t) => t.subscribe(e));
|
|
256
271
|
}
|
|
257
272
|
}
|
|
258
|
-
class
|
|
273
|
+
class De {
|
|
259
274
|
#t;
|
|
260
275
|
constructor(e) {
|
|
261
276
|
this.#t = e;
|
|
@@ -279,7 +294,7 @@ class ze {
|
|
|
279
294
|
return this.#e((s) => s.get(e, t));
|
|
280
295
|
}
|
|
281
296
|
}
|
|
282
|
-
class
|
|
297
|
+
class Fe {
|
|
283
298
|
#t;
|
|
284
299
|
constructor(e) {
|
|
285
300
|
this.#t = e;
|
|
@@ -345,31 +360,58 @@ class De {
|
|
|
345
360
|
return this.#e((t) => t.subscribeToCurrentItem(e));
|
|
346
361
|
}
|
|
347
362
|
}
|
|
348
|
-
class
|
|
363
|
+
class He {
|
|
349
364
|
#t;
|
|
350
|
-
|
|
351
|
-
|
|
365
|
+
#e;
|
|
366
|
+
#s;
|
|
367
|
+
constructor(e, t, s) {
|
|
368
|
+
this.#t = e, this.#e = t, this.#s = s;
|
|
352
369
|
}
|
|
353
|
-
#
|
|
370
|
+
#r(e) {
|
|
354
371
|
const t = this.#t;
|
|
355
372
|
if (!t)
|
|
356
373
|
throw new Error("Settings host not available");
|
|
357
374
|
return e(t);
|
|
358
375
|
}
|
|
359
376
|
register(e) {
|
|
360
|
-
return this.#
|
|
377
|
+
return this.#r((t) => t.register(e));
|
|
361
378
|
}
|
|
362
379
|
get(e) {
|
|
363
|
-
return this.#
|
|
380
|
+
return this.#r((t) => t.get(e));
|
|
364
381
|
}
|
|
365
382
|
set(e, t) {
|
|
366
|
-
return this.#
|
|
383
|
+
return this.#r((s) => s.set(e, t));
|
|
367
384
|
}
|
|
368
385
|
subscribe(e, t) {
|
|
369
|
-
return this.#
|
|
386
|
+
return this.#r((s) => s.subscribe(e, t));
|
|
387
|
+
}
|
|
388
|
+
registerWidget(e, t) {
|
|
389
|
+
if (!this.#e || !this.#s)
|
|
390
|
+
throw new Error("Widget registry not available");
|
|
391
|
+
this.#e.register(this.#s, e, t);
|
|
392
|
+
}
|
|
393
|
+
unregisterWidget(e) {
|
|
394
|
+
if (!this.#e || !this.#s)
|
|
395
|
+
throw new Error("Widget registry not available");
|
|
396
|
+
this.#e.unregister(this.#s, e);
|
|
370
397
|
}
|
|
371
398
|
}
|
|
372
399
|
class Be {
|
|
400
|
+
#t;
|
|
401
|
+
constructor(e) {
|
|
402
|
+
this.#t = e;
|
|
403
|
+
}
|
|
404
|
+
#e(e) {
|
|
405
|
+
const t = this.#t;
|
|
406
|
+
if (!t)
|
|
407
|
+
throw new Error("Shell host not available");
|
|
408
|
+
return e(t);
|
|
409
|
+
}
|
|
410
|
+
openExternal(e) {
|
|
411
|
+
return this.#e((t) => t.openExternal(e));
|
|
412
|
+
}
|
|
413
|
+
}
|
|
414
|
+
class Ue {
|
|
373
415
|
#t;
|
|
374
416
|
constructor(e) {
|
|
375
417
|
this.#t = e;
|
|
@@ -387,7 +429,7 @@ class Be {
|
|
|
387
429
|
return this.#e((t) => t.resolveStreamForCandidate(e));
|
|
388
430
|
}
|
|
389
431
|
}
|
|
390
|
-
class
|
|
432
|
+
class We {
|
|
391
433
|
host;
|
|
392
434
|
constructor(e) {
|
|
393
435
|
this.host = e;
|
|
@@ -406,7 +448,7 @@ class He {
|
|
|
406
448
|
return this.host.getStream(e);
|
|
407
449
|
}
|
|
408
450
|
}
|
|
409
|
-
class
|
|
451
|
+
class qe {
|
|
410
452
|
Settings;
|
|
411
453
|
Providers;
|
|
412
454
|
Queue;
|
|
@@ -419,20 +461,26 @@ class Ue {
|
|
|
419
461
|
Dashboard;
|
|
420
462
|
Playback;
|
|
421
463
|
Playlists;
|
|
464
|
+
Events;
|
|
465
|
+
Shell;
|
|
422
466
|
constructor(e) {
|
|
423
|
-
this.Settings = new
|
|
467
|
+
this.Settings = new He(
|
|
468
|
+
e?.settingsHost,
|
|
469
|
+
e?.widgetRegistry,
|
|
470
|
+
e?.pluginId
|
|
471
|
+
), this.Providers = new De(e?.providersHost), this.Queue = new Fe(e?.queueHost), this.Streaming = new Ue(e?.streamingHost), this.Metadata = new Ve(e?.metadataHost), this.Http = new je(e?.httpHost), this.Ytdlp = new We(e?.ytdlpHost), this.Favorites = new Re(e?.favoritesHost), this.Logger = new Me(e?.loggerHost), this.Dashboard = new Ne(e?.dashboardHost), this.Playback = new Le(e?.playbackHost), this.Playlists = new ze(e?.playlistsHost), this.Events = new Oe(e?.eventsHost), this.Shell = new Be(e?.shellHost);
|
|
424
472
|
}
|
|
425
473
|
}
|
|
426
|
-
class
|
|
474
|
+
class Et extends qe {
|
|
427
475
|
}
|
|
428
|
-
class
|
|
476
|
+
class Zt extends Error {
|
|
429
477
|
constructor(e, t) {
|
|
430
478
|
super(
|
|
431
479
|
`Missing capability: Provider "${t}" declared capability "${e}" but does not implement it`
|
|
432
480
|
), this.name = "MissingCapabilityError";
|
|
433
481
|
}
|
|
434
482
|
}
|
|
435
|
-
const
|
|
483
|
+
const Pt = (r, e) => {
|
|
436
484
|
const [t, s] = Se(void 0);
|
|
437
485
|
Ce(() => {
|
|
438
486
|
if (!r)
|
|
@@ -455,7 +503,7 @@ const It = (r, e) => {
|
|
|
455
503
|
);
|
|
456
504
|
return [t, a];
|
|
457
505
|
};
|
|
458
|
-
function
|
|
506
|
+
function jt(r, e, t) {
|
|
459
507
|
if (!r?.items?.length)
|
|
460
508
|
return;
|
|
461
509
|
const s = r.items.filter((o) => !(o.purpose && o.purpose !== e || !o.url));
|
|
@@ -475,10 +523,10 @@ function Nt(r, e, t) {
|
|
|
475
523
|
}
|
|
476
524
|
})(e);
|
|
477
525
|
return s.map((o) => {
|
|
478
|
-
const u = Math.min(o.width || 0, o.height || 0), f = Math.abs(a(o) - i), y = Math.abs(u - t),
|
|
526
|
+
const u = Math.min(o.width || 0, o.height || 0), f = Math.abs(a(o) - i), y = Math.abs(u - t), Z = u < t ? t / u : 1;
|
|
479
527
|
return {
|
|
480
528
|
artwork: o,
|
|
481
|
-
score: (
|
|
529
|
+
score: (Z > 1.5 ? -1e3 : 0) + -f * 50 + -y * 0.1
|
|
482
530
|
};
|
|
483
531
|
}).sort((o, u) => u.score - o.score)[0]?.artwork;
|
|
484
532
|
}
|
|
@@ -519,14 +567,14 @@ var _;
|
|
|
519
567
|
}
|
|
520
568
|
r.joinValues = s, r.jsonStringifyReplacer = (a, n) => typeof n == "bigint" ? n.toString() : n;
|
|
521
569
|
})(_ || (_ = {}));
|
|
522
|
-
var
|
|
570
|
+
var ie;
|
|
523
571
|
(function(r) {
|
|
524
572
|
r.mergeShapes = (e, t) => ({
|
|
525
573
|
...e,
|
|
526
574
|
...t
|
|
527
575
|
// second overwrites first
|
|
528
576
|
});
|
|
529
|
-
})(
|
|
577
|
+
})(ie || (ie = {}));
|
|
530
578
|
const l = _.arrayToEnum([
|
|
531
579
|
"string",
|
|
532
580
|
"nan",
|
|
@@ -548,7 +596,7 @@ const l = _.arrayToEnum([
|
|
|
548
596
|
"never",
|
|
549
597
|
"map",
|
|
550
598
|
"set"
|
|
551
|
-
]),
|
|
599
|
+
]), I = (r) => {
|
|
552
600
|
switch (typeof r) {
|
|
553
601
|
case "undefined":
|
|
554
602
|
return l.undefined;
|
|
@@ -569,7 +617,7 @@ const l = _.arrayToEnum([
|
|
|
569
617
|
default:
|
|
570
618
|
return l.unknown;
|
|
571
619
|
}
|
|
572
|
-
},
|
|
620
|
+
}, c = _.arrayToEnum([
|
|
573
621
|
"invalid_type",
|
|
574
622
|
"invalid_literal",
|
|
575
623
|
"custom",
|
|
@@ -587,7 +635,7 @@ const l = _.arrayToEnum([
|
|
|
587
635
|
"not_multiple_of",
|
|
588
636
|
"not_finite"
|
|
589
637
|
]);
|
|
590
|
-
class
|
|
638
|
+
class S extends Error {
|
|
591
639
|
get errors() {
|
|
592
640
|
return this.issues;
|
|
593
641
|
}
|
|
@@ -624,7 +672,7 @@ class T extends Error {
|
|
|
624
672
|
return a(this), s;
|
|
625
673
|
}
|
|
626
674
|
static assert(e) {
|
|
627
|
-
if (!(e instanceof
|
|
675
|
+
if (!(e instanceof S))
|
|
628
676
|
throw new Error(`Not a ZodError: ${e}`);
|
|
629
677
|
}
|
|
630
678
|
toString() {
|
|
@@ -650,56 +698,56 @@ class T extends Error {
|
|
|
650
698
|
return this.flatten();
|
|
651
699
|
}
|
|
652
700
|
}
|
|
653
|
-
|
|
701
|
+
S.create = (r) => new S(r);
|
|
654
702
|
const X = (r, e) => {
|
|
655
703
|
let t;
|
|
656
704
|
switch (r.code) {
|
|
657
|
-
case
|
|
705
|
+
case c.invalid_type:
|
|
658
706
|
r.received === l.undefined ? t = "Required" : t = `Expected ${r.expected}, received ${r.received}`;
|
|
659
707
|
break;
|
|
660
|
-
case
|
|
708
|
+
case c.invalid_literal:
|
|
661
709
|
t = `Invalid literal value, expected ${JSON.stringify(r.expected, _.jsonStringifyReplacer)}`;
|
|
662
710
|
break;
|
|
663
|
-
case
|
|
711
|
+
case c.unrecognized_keys:
|
|
664
712
|
t = `Unrecognized key(s) in object: ${_.joinValues(r.keys, ", ")}`;
|
|
665
713
|
break;
|
|
666
|
-
case
|
|
714
|
+
case c.invalid_union:
|
|
667
715
|
t = "Invalid input";
|
|
668
716
|
break;
|
|
669
|
-
case
|
|
717
|
+
case c.invalid_union_discriminator:
|
|
670
718
|
t = `Invalid discriminator value. Expected ${_.joinValues(r.options)}`;
|
|
671
719
|
break;
|
|
672
|
-
case
|
|
720
|
+
case c.invalid_enum_value:
|
|
673
721
|
t = `Invalid enum value. Expected ${_.joinValues(r.options)}, received '${r.received}'`;
|
|
674
722
|
break;
|
|
675
|
-
case
|
|
723
|
+
case c.invalid_arguments:
|
|
676
724
|
t = "Invalid function arguments";
|
|
677
725
|
break;
|
|
678
|
-
case
|
|
726
|
+
case c.invalid_return_type:
|
|
679
727
|
t = "Invalid function return type";
|
|
680
728
|
break;
|
|
681
|
-
case
|
|
729
|
+
case c.invalid_date:
|
|
682
730
|
t = "Invalid date";
|
|
683
731
|
break;
|
|
684
|
-
case
|
|
732
|
+
case c.invalid_string:
|
|
685
733
|
typeof r.validation == "object" ? "includes" in r.validation ? (t = `Invalid input: must include "${r.validation.includes}"`, typeof r.validation.position == "number" && (t = `${t} at one or more positions greater than or equal to ${r.validation.position}`)) : "startsWith" in r.validation ? t = `Invalid input: must start with "${r.validation.startsWith}"` : "endsWith" in r.validation ? t = `Invalid input: must end with "${r.validation.endsWith}"` : _.assertNever(r.validation) : r.validation !== "regex" ? t = `Invalid ${r.validation}` : t = "Invalid";
|
|
686
734
|
break;
|
|
687
|
-
case
|
|
735
|
+
case c.too_small:
|
|
688
736
|
r.type === "array" ? t = `Array must contain ${r.exact ? "exactly" : r.inclusive ? "at least" : "more than"} ${r.minimum} element(s)` : r.type === "string" ? t = `String must contain ${r.exact ? "exactly" : r.inclusive ? "at least" : "over"} ${r.minimum} character(s)` : r.type === "number" ? t = `Number must be ${r.exact ? "exactly equal to " : r.inclusive ? "greater than or equal to " : "greater than "}${r.minimum}` : r.type === "bigint" ? t = `Number must be ${r.exact ? "exactly equal to " : r.inclusive ? "greater than or equal to " : "greater than "}${r.minimum}` : r.type === "date" ? t = `Date must be ${r.exact ? "exactly equal to " : r.inclusive ? "greater than or equal to " : "greater than "}${new Date(Number(r.minimum))}` : t = "Invalid input";
|
|
689
737
|
break;
|
|
690
|
-
case
|
|
738
|
+
case c.too_big:
|
|
691
739
|
r.type === "array" ? t = `Array must contain ${r.exact ? "exactly" : r.inclusive ? "at most" : "less than"} ${r.maximum} element(s)` : r.type === "string" ? t = `String must contain ${r.exact ? "exactly" : r.inclusive ? "at most" : "under"} ${r.maximum} character(s)` : r.type === "number" ? t = `Number must be ${r.exact ? "exactly" : r.inclusive ? "less than or equal to" : "less than"} ${r.maximum}` : r.type === "bigint" ? t = `BigInt must be ${r.exact ? "exactly" : r.inclusive ? "less than or equal to" : "less than"} ${r.maximum}` : r.type === "date" ? t = `Date must be ${r.exact ? "exactly" : r.inclusive ? "smaller than or equal to" : "smaller than"} ${new Date(Number(r.maximum))}` : t = "Invalid input";
|
|
692
740
|
break;
|
|
693
|
-
case
|
|
741
|
+
case c.custom:
|
|
694
742
|
t = "Invalid input";
|
|
695
743
|
break;
|
|
696
|
-
case
|
|
744
|
+
case c.invalid_intersection_types:
|
|
697
745
|
t = "Intersection results could not be merged";
|
|
698
746
|
break;
|
|
699
|
-
case
|
|
747
|
+
case c.not_multiple_of:
|
|
700
748
|
t = `Number must be a multiple of ${r.multipleOf}`;
|
|
701
749
|
break;
|
|
702
|
-
case
|
|
750
|
+
case c.not_finite:
|
|
703
751
|
t = "Number must be finite";
|
|
704
752
|
break;
|
|
705
753
|
default:
|
|
@@ -707,11 +755,11 @@ const X = (r, e) => {
|
|
|
707
755
|
}
|
|
708
756
|
return { message: t };
|
|
709
757
|
};
|
|
710
|
-
let
|
|
711
|
-
function
|
|
712
|
-
return
|
|
758
|
+
let Qe = X;
|
|
759
|
+
function Ye() {
|
|
760
|
+
return Qe;
|
|
713
761
|
}
|
|
714
|
-
const
|
|
762
|
+
const Je = (r) => {
|
|
715
763
|
const { data: e, path: t, errorMaps: s, issueData: a } = r, n = [...t, ...a.path || []], i = {
|
|
716
764
|
...a,
|
|
717
765
|
path: n
|
|
@@ -732,8 +780,8 @@ const Qe = (r) => {
|
|
|
732
780
|
message: o
|
|
733
781
|
};
|
|
734
782
|
};
|
|
735
|
-
function
|
|
736
|
-
const t =
|
|
783
|
+
function d(r, e) {
|
|
784
|
+
const t = Ye(), s = Je({
|
|
737
785
|
issueData: e,
|
|
738
786
|
data: r.data,
|
|
739
787
|
path: r.path,
|
|
@@ -750,7 +798,7 @@ function c(r, e) {
|
|
|
750
798
|
});
|
|
751
799
|
r.common.issues.push(s);
|
|
752
800
|
}
|
|
753
|
-
class
|
|
801
|
+
class x {
|
|
754
802
|
constructor() {
|
|
755
803
|
this.value = "valid";
|
|
756
804
|
}
|
|
@@ -778,7 +826,7 @@ class b {
|
|
|
778
826
|
value: i
|
|
779
827
|
});
|
|
780
828
|
}
|
|
781
|
-
return
|
|
829
|
+
return x.mergeObjectSync(e, s);
|
|
782
830
|
}
|
|
783
831
|
static mergeObjectSync(e, t) {
|
|
784
832
|
const s = {};
|
|
@@ -793,12 +841,12 @@ class b {
|
|
|
793
841
|
}
|
|
794
842
|
const m = Object.freeze({
|
|
795
843
|
status: "aborted"
|
|
796
|
-
}), F = (r) => ({ status: "dirty", value: r }), w = (r) => ({ status: "valid", value: r }),
|
|
844
|
+
}), F = (r) => ({ status: "dirty", value: r }), w = (r) => ({ status: "valid", value: r }), oe = (r) => r.status === "aborted", ce = (r) => r.status === "dirty", M = (r) => r.status === "valid", U = (r) => typeof Promise < "u" && r instanceof Promise;
|
|
797
845
|
var h;
|
|
798
846
|
(function(r) {
|
|
799
847
|
r.errToObj = (e) => typeof e == "string" ? { message: e } : e || {}, r.toString = (e) => typeof e == "string" ? e : e?.message;
|
|
800
848
|
})(h || (h = {}));
|
|
801
|
-
class
|
|
849
|
+
class R {
|
|
802
850
|
constructor(e, t, s, a) {
|
|
803
851
|
this._cachedPath = [], this.parent = e, this.data = t, this._path = s, this._key = a;
|
|
804
852
|
}
|
|
@@ -807,7 +855,7 @@ class O {
|
|
|
807
855
|
}
|
|
808
856
|
}
|
|
809
857
|
const de = (r, e) => {
|
|
810
|
-
if (
|
|
858
|
+
if (M(e))
|
|
811
859
|
return { success: !0, data: e.value };
|
|
812
860
|
if (!r.common.issues.length)
|
|
813
861
|
throw new Error("Validation failed but no issues detected.");
|
|
@@ -816,7 +864,7 @@ const de = (r, e) => {
|
|
|
816
864
|
get error() {
|
|
817
865
|
if (this._error)
|
|
818
866
|
return this._error;
|
|
819
|
-
const t = new
|
|
867
|
+
const t = new S(r.common.issues);
|
|
820
868
|
return this._error = t, this._error;
|
|
821
869
|
}
|
|
822
870
|
};
|
|
@@ -837,13 +885,13 @@ class v {
|
|
|
837
885
|
return this._def.description;
|
|
838
886
|
}
|
|
839
887
|
_getType(e) {
|
|
840
|
-
return
|
|
888
|
+
return I(e.data);
|
|
841
889
|
}
|
|
842
890
|
_getOrReturnCtx(e, t) {
|
|
843
891
|
return t || {
|
|
844
892
|
common: e.parent.common,
|
|
845
893
|
data: e.data,
|
|
846
|
-
parsedType:
|
|
894
|
+
parsedType: I(e.data),
|
|
847
895
|
schemaErrorMap: this._def.errorMap,
|
|
848
896
|
path: e.path,
|
|
849
897
|
parent: e.parent
|
|
@@ -851,11 +899,11 @@ class v {
|
|
|
851
899
|
}
|
|
852
900
|
_processInputParams(e) {
|
|
853
901
|
return {
|
|
854
|
-
status: new
|
|
902
|
+
status: new x(),
|
|
855
903
|
ctx: {
|
|
856
904
|
common: e.parent.common,
|
|
857
905
|
data: e.data,
|
|
858
|
-
parsedType:
|
|
906
|
+
parsedType: I(e.data),
|
|
859
907
|
schemaErrorMap: this._def.errorMap,
|
|
860
908
|
path: e.path,
|
|
861
909
|
parent: e.parent
|
|
@@ -889,7 +937,7 @@ class v {
|
|
|
889
937
|
schemaErrorMap: this._def.errorMap,
|
|
890
938
|
parent: null,
|
|
891
939
|
data: e,
|
|
892
|
-
parsedType:
|
|
940
|
+
parsedType: I(e)
|
|
893
941
|
}, a = this._parseSync({ data: e, path: s.path, parent: s });
|
|
894
942
|
return de(s, a);
|
|
895
943
|
}
|
|
@@ -903,12 +951,12 @@ class v {
|
|
|
903
951
|
schemaErrorMap: this._def.errorMap,
|
|
904
952
|
parent: null,
|
|
905
953
|
data: e,
|
|
906
|
-
parsedType:
|
|
954
|
+
parsedType: I(e)
|
|
907
955
|
};
|
|
908
956
|
if (!this["~standard"].async)
|
|
909
957
|
try {
|
|
910
958
|
const s = this._parseSync({ data: e, path: [], parent: t });
|
|
911
|
-
return
|
|
959
|
+
return M(s) ? {
|
|
912
960
|
value: s.value
|
|
913
961
|
} : {
|
|
914
962
|
issues: t.common.issues
|
|
@@ -919,7 +967,7 @@ class v {
|
|
|
919
967
|
async: !0
|
|
920
968
|
};
|
|
921
969
|
}
|
|
922
|
-
return this._parseAsync({ data: e, path: [], parent: t }).then((s) =>
|
|
970
|
+
return this._parseAsync({ data: e, path: [], parent: t }).then((s) => M(s) ? {
|
|
923
971
|
value: s.value
|
|
924
972
|
} : {
|
|
925
973
|
issues: t.common.issues
|
|
@@ -942,7 +990,7 @@ class v {
|
|
|
942
990
|
schemaErrorMap: this._def.errorMap,
|
|
943
991
|
parent: null,
|
|
944
992
|
data: e,
|
|
945
|
-
parsedType:
|
|
993
|
+
parsedType: I(e)
|
|
946
994
|
}, a = this._parse({ data: e, path: s.path, parent: s }), n = await (U(a) ? a : Promise.resolve(a));
|
|
947
995
|
return de(s, n);
|
|
948
996
|
}
|
|
@@ -950,7 +998,7 @@ class v {
|
|
|
950
998
|
const s = (a) => typeof t == "string" || typeof t > "u" ? { message: t } : typeof t == "function" ? t(a) : t;
|
|
951
999
|
return this._refinement((a, n) => {
|
|
952
1000
|
const i = e(a), o = () => n.addIssue({
|
|
953
|
-
code:
|
|
1001
|
+
code: c.custom,
|
|
954
1002
|
...s(a)
|
|
955
1003
|
});
|
|
956
1004
|
return typeof Promise < "u" && i instanceof Promise ? i.then((u) => u ? !0 : (o(), !1)) : i ? !0 : (o(), !1);
|
|
@@ -960,7 +1008,7 @@ class v {
|
|
|
960
1008
|
return this._refinement((s, a) => e(s) ? !0 : (a.addIssue(typeof t == "function" ? t(s, a) : t), !1));
|
|
961
1009
|
}
|
|
962
1010
|
_refinement(e) {
|
|
963
|
-
return new
|
|
1011
|
+
return new z({
|
|
964
1012
|
schema: this,
|
|
965
1013
|
typeName: p.ZodEffects,
|
|
966
1014
|
effect: { type: "refinement", refinement: e }
|
|
@@ -977,10 +1025,10 @@ class v {
|
|
|
977
1025
|
};
|
|
978
1026
|
}
|
|
979
1027
|
optional() {
|
|
980
|
-
return
|
|
1028
|
+
return O.create(this, this._def);
|
|
981
1029
|
}
|
|
982
1030
|
nullable() {
|
|
983
|
-
return
|
|
1031
|
+
return D.create(this, this._def);
|
|
984
1032
|
}
|
|
985
1033
|
nullish() {
|
|
986
1034
|
return this.nullable().optional();
|
|
@@ -998,7 +1046,7 @@ class v {
|
|
|
998
1046
|
return Q.create(this, e, this._def);
|
|
999
1047
|
}
|
|
1000
1048
|
transform(e) {
|
|
1001
|
-
return new
|
|
1049
|
+
return new z({
|
|
1002
1050
|
...g(this._def),
|
|
1003
1051
|
schema: this,
|
|
1004
1052
|
typeName: p.ZodEffects,
|
|
@@ -1007,7 +1055,7 @@ class v {
|
|
|
1007
1055
|
}
|
|
1008
1056
|
default(e) {
|
|
1009
1057
|
const t = typeof e == "function" ? e : () => e;
|
|
1010
|
-
return new
|
|
1058
|
+
return new se({
|
|
1011
1059
|
...g(this._def),
|
|
1012
1060
|
innerType: this,
|
|
1013
1061
|
defaultValue: t,
|
|
@@ -1015,7 +1063,7 @@ class v {
|
|
|
1015
1063
|
});
|
|
1016
1064
|
}
|
|
1017
1065
|
brand() {
|
|
1018
|
-
return new
|
|
1066
|
+
return new _t({
|
|
1019
1067
|
typeName: p.ZodBranded,
|
|
1020
1068
|
type: this,
|
|
1021
1069
|
...g(this._def)
|
|
@@ -1023,7 +1071,7 @@ class v {
|
|
|
1023
1071
|
}
|
|
1024
1072
|
catch(e) {
|
|
1025
1073
|
const t = typeof e == "function" ? e : () => e;
|
|
1026
|
-
return new
|
|
1074
|
+
return new re({
|
|
1027
1075
|
...g(this._def),
|
|
1028
1076
|
innerType: this,
|
|
1029
1077
|
catchValue: t,
|
|
@@ -1038,10 +1086,10 @@ class v {
|
|
|
1038
1086
|
});
|
|
1039
1087
|
}
|
|
1040
1088
|
pipe(e) {
|
|
1041
|
-
return
|
|
1089
|
+
return ne.create(this, e);
|
|
1042
1090
|
}
|
|
1043
1091
|
readonly() {
|
|
1044
|
-
return
|
|
1092
|
+
return ae.create(this);
|
|
1045
1093
|
}
|
|
1046
1094
|
isOptional() {
|
|
1047
1095
|
return this.safeParse(void 0).success;
|
|
@@ -1050,28 +1098,28 @@ class v {
|
|
|
1050
1098
|
return this.safeParse(null).success;
|
|
1051
1099
|
}
|
|
1052
1100
|
}
|
|
1053
|
-
const
|
|
1101
|
+
const Ge = /^c[^\s-]{8,}$/i, Xe = /^[0-9a-z]+$/, Ke = /^[0-9A-HJKMNP-TV-Z]{26}$/i, et = /^[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, tt = /^[a-z0-9_-]{21}$/i, st = /^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/, rt = /^[-+]?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)?)??$/, at = /^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i, nt = "^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";
|
|
1054
1102
|
let G;
|
|
1055
|
-
const
|
|
1056
|
-
function
|
|
1103
|
+
const it = /^(?:(?: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])$/, ot = /^(?:(?: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])$/, ct = /^(([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]))$/, dt = /^(([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])$/, ut = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/, lt = /^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/, be = "((\\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])))", ht = new RegExp(`^${be}$`);
|
|
1104
|
+
function ke(r) {
|
|
1057
1105
|
let e = "[0-5]\\d";
|
|
1058
1106
|
r.precision ? e = `${e}\\.\\d{${r.precision}}` : r.precision == null && (e = `${e}(\\.\\d+)?`);
|
|
1059
1107
|
const t = r.precision ? "+" : "?";
|
|
1060
1108
|
return `([01]\\d|2[0-3]):[0-5]\\d(:${e})${t}`;
|
|
1061
1109
|
}
|
|
1062
|
-
function
|
|
1063
|
-
return new RegExp(`^${
|
|
1110
|
+
function ft(r) {
|
|
1111
|
+
return new RegExp(`^${ke(r)}$`);
|
|
1064
1112
|
}
|
|
1065
|
-
function
|
|
1066
|
-
let e = `${
|
|
1113
|
+
function mt(r) {
|
|
1114
|
+
let e = `${be}T${ke(r)}`;
|
|
1067
1115
|
const t = [];
|
|
1068
1116
|
return t.push(r.local ? "Z?" : "Z"), r.offset && t.push("([+-]\\d{2}:?\\d{2})"), e = `${e}(${t.join("|")})`, new RegExp(`^${e}$`);
|
|
1069
1117
|
}
|
|
1070
|
-
function
|
|
1071
|
-
return !!((e === "v4" || !e) &&
|
|
1118
|
+
function pt(r, e) {
|
|
1119
|
+
return !!((e === "v4" || !e) && it.test(r) || (e === "v6" || !e) && ct.test(r));
|
|
1072
1120
|
}
|
|
1073
|
-
function
|
|
1074
|
-
if (!
|
|
1121
|
+
function gt(r, e) {
|
|
1122
|
+
if (!st.test(r))
|
|
1075
1123
|
return !1;
|
|
1076
1124
|
try {
|
|
1077
1125
|
const [t] = r.split(".");
|
|
@@ -1083,25 +1131,25 @@ function mt(r, e) {
|
|
|
1083
1131
|
return !1;
|
|
1084
1132
|
}
|
|
1085
1133
|
}
|
|
1086
|
-
function
|
|
1087
|
-
return !!((e === "v4" || !e) &&
|
|
1134
|
+
function yt(r, e) {
|
|
1135
|
+
return !!((e === "v4" || !e) && ot.test(r) || (e === "v6" || !e) && dt.test(r));
|
|
1088
1136
|
}
|
|
1089
|
-
class
|
|
1137
|
+
class N extends v {
|
|
1090
1138
|
_parse(e) {
|
|
1091
1139
|
if (this._def.coerce && (e.data = String(e.data)), this._getType(e) !== l.string) {
|
|
1092
1140
|
const n = this._getOrReturnCtx(e);
|
|
1093
|
-
return
|
|
1094
|
-
code:
|
|
1141
|
+
return d(n, {
|
|
1142
|
+
code: c.invalid_type,
|
|
1095
1143
|
expected: l.string,
|
|
1096
1144
|
received: n.parsedType
|
|
1097
1145
|
}), m;
|
|
1098
1146
|
}
|
|
1099
|
-
const s = new
|
|
1147
|
+
const s = new x();
|
|
1100
1148
|
let a;
|
|
1101
1149
|
for (const n of this._def.checks)
|
|
1102
1150
|
if (n.kind === "min")
|
|
1103
|
-
e.data.length < n.value && (a = this._getOrReturnCtx(e, a),
|
|
1104
|
-
code:
|
|
1151
|
+
e.data.length < n.value && (a = this._getOrReturnCtx(e, a), d(a, {
|
|
1152
|
+
code: c.too_small,
|
|
1105
1153
|
minimum: n.value,
|
|
1106
1154
|
type: "string",
|
|
1107
1155
|
inclusive: !0,
|
|
@@ -1109,8 +1157,8 @@ class I extends v {
|
|
|
1109
1157
|
message: n.message
|
|
1110
1158
|
}), s.dirty());
|
|
1111
1159
|
else if (n.kind === "max")
|
|
1112
|
-
e.data.length > n.value && (a = this._getOrReturnCtx(e, a),
|
|
1113
|
-
code:
|
|
1160
|
+
e.data.length > n.value && (a = this._getOrReturnCtx(e, a), d(a, {
|
|
1161
|
+
code: c.too_big,
|
|
1114
1162
|
maximum: n.value,
|
|
1115
1163
|
type: "string",
|
|
1116
1164
|
inclusive: !0,
|
|
@@ -1119,15 +1167,15 @@ class I extends v {
|
|
|
1119
1167
|
}), s.dirty());
|
|
1120
1168
|
else if (n.kind === "length") {
|
|
1121
1169
|
const i = e.data.length > n.value, o = e.data.length < n.value;
|
|
1122
|
-
(i || o) && (a = this._getOrReturnCtx(e, a), i ?
|
|
1123
|
-
code:
|
|
1170
|
+
(i || o) && (a = this._getOrReturnCtx(e, a), i ? d(a, {
|
|
1171
|
+
code: c.too_big,
|
|
1124
1172
|
maximum: n.value,
|
|
1125
1173
|
type: "string",
|
|
1126
1174
|
inclusive: !0,
|
|
1127
1175
|
exact: !0,
|
|
1128
1176
|
message: n.message
|
|
1129
|
-
}) : o &&
|
|
1130
|
-
code:
|
|
1177
|
+
}) : o && d(a, {
|
|
1178
|
+
code: c.too_small,
|
|
1131
1179
|
minimum: n.value,
|
|
1132
1180
|
type: "string",
|
|
1133
1181
|
inclusive: !0,
|
|
@@ -1135,108 +1183,108 @@ class I extends v {
|
|
|
1135
1183
|
message: n.message
|
|
1136
1184
|
}), s.dirty());
|
|
1137
1185
|
} else if (n.kind === "email")
|
|
1138
|
-
|
|
1186
|
+
at.test(e.data) || (a = this._getOrReturnCtx(e, a), d(a, {
|
|
1139
1187
|
validation: "email",
|
|
1140
|
-
code:
|
|
1188
|
+
code: c.invalid_string,
|
|
1141
1189
|
message: n.message
|
|
1142
1190
|
}), s.dirty());
|
|
1143
1191
|
else if (n.kind === "emoji")
|
|
1144
|
-
G || (G = new RegExp(
|
|
1192
|
+
G || (G = new RegExp(nt, "u")), G.test(e.data) || (a = this._getOrReturnCtx(e, a), d(a, {
|
|
1145
1193
|
validation: "emoji",
|
|
1146
|
-
code:
|
|
1194
|
+
code: c.invalid_string,
|
|
1147
1195
|
message: n.message
|
|
1148
1196
|
}), s.dirty());
|
|
1149
1197
|
else if (n.kind === "uuid")
|
|
1150
|
-
|
|
1198
|
+
et.test(e.data) || (a = this._getOrReturnCtx(e, a), d(a, {
|
|
1151
1199
|
validation: "uuid",
|
|
1152
|
-
code:
|
|
1200
|
+
code: c.invalid_string,
|
|
1153
1201
|
message: n.message
|
|
1154
1202
|
}), s.dirty());
|
|
1155
1203
|
else if (n.kind === "nanoid")
|
|
1156
|
-
|
|
1204
|
+
tt.test(e.data) || (a = this._getOrReturnCtx(e, a), d(a, {
|
|
1157
1205
|
validation: "nanoid",
|
|
1158
|
-
code:
|
|
1206
|
+
code: c.invalid_string,
|
|
1159
1207
|
message: n.message
|
|
1160
1208
|
}), s.dirty());
|
|
1161
1209
|
else if (n.kind === "cuid")
|
|
1162
|
-
|
|
1210
|
+
Ge.test(e.data) || (a = this._getOrReturnCtx(e, a), d(a, {
|
|
1163
1211
|
validation: "cuid",
|
|
1164
|
-
code:
|
|
1212
|
+
code: c.invalid_string,
|
|
1165
1213
|
message: n.message
|
|
1166
1214
|
}), s.dirty());
|
|
1167
1215
|
else if (n.kind === "cuid2")
|
|
1168
|
-
|
|
1216
|
+
Xe.test(e.data) || (a = this._getOrReturnCtx(e, a), d(a, {
|
|
1169
1217
|
validation: "cuid2",
|
|
1170
|
-
code:
|
|
1218
|
+
code: c.invalid_string,
|
|
1171
1219
|
message: n.message
|
|
1172
1220
|
}), s.dirty());
|
|
1173
1221
|
else if (n.kind === "ulid")
|
|
1174
|
-
|
|
1222
|
+
Ke.test(e.data) || (a = this._getOrReturnCtx(e, a), d(a, {
|
|
1175
1223
|
validation: "ulid",
|
|
1176
|
-
code:
|
|
1224
|
+
code: c.invalid_string,
|
|
1177
1225
|
message: n.message
|
|
1178
1226
|
}), s.dirty());
|
|
1179
1227
|
else if (n.kind === "url")
|
|
1180
1228
|
try {
|
|
1181
1229
|
new URL(e.data);
|
|
1182
1230
|
} catch {
|
|
1183
|
-
a = this._getOrReturnCtx(e, a),
|
|
1231
|
+
a = this._getOrReturnCtx(e, a), d(a, {
|
|
1184
1232
|
validation: "url",
|
|
1185
|
-
code:
|
|
1233
|
+
code: c.invalid_string,
|
|
1186
1234
|
message: n.message
|
|
1187
1235
|
}), s.dirty();
|
|
1188
1236
|
}
|
|
1189
|
-
else n.kind === "regex" ? (n.regex.lastIndex = 0, n.regex.test(e.data) || (a = this._getOrReturnCtx(e, a),
|
|
1237
|
+
else n.kind === "regex" ? (n.regex.lastIndex = 0, n.regex.test(e.data) || (a = this._getOrReturnCtx(e, a), d(a, {
|
|
1190
1238
|
validation: "regex",
|
|
1191
|
-
code:
|
|
1239
|
+
code: c.invalid_string,
|
|
1192
1240
|
message: n.message
|
|
1193
|
-
}), s.dirty())) : n.kind === "trim" ? e.data = e.data.trim() : n.kind === "includes" ? e.data.includes(n.value, n.position) || (a = this._getOrReturnCtx(e, a),
|
|
1194
|
-
code:
|
|
1241
|
+
}), s.dirty())) : n.kind === "trim" ? e.data = e.data.trim() : n.kind === "includes" ? e.data.includes(n.value, n.position) || (a = this._getOrReturnCtx(e, a), d(a, {
|
|
1242
|
+
code: c.invalid_string,
|
|
1195
1243
|
validation: { includes: n.value, position: n.position },
|
|
1196
1244
|
message: n.message
|
|
1197
|
-
}), s.dirty()) : n.kind === "toLowerCase" ? e.data = e.data.toLowerCase() : n.kind === "toUpperCase" ? e.data = e.data.toUpperCase() : n.kind === "startsWith" ? e.data.startsWith(n.value) || (a = this._getOrReturnCtx(e, a),
|
|
1198
|
-
code:
|
|
1245
|
+
}), s.dirty()) : n.kind === "toLowerCase" ? e.data = e.data.toLowerCase() : n.kind === "toUpperCase" ? e.data = e.data.toUpperCase() : n.kind === "startsWith" ? e.data.startsWith(n.value) || (a = this._getOrReturnCtx(e, a), d(a, {
|
|
1246
|
+
code: c.invalid_string,
|
|
1199
1247
|
validation: { startsWith: n.value },
|
|
1200
1248
|
message: n.message
|
|
1201
|
-
}), s.dirty()) : n.kind === "endsWith" ? e.data.endsWith(n.value) || (a = this._getOrReturnCtx(e, a),
|
|
1202
|
-
code:
|
|
1249
|
+
}), s.dirty()) : n.kind === "endsWith" ? e.data.endsWith(n.value) || (a = this._getOrReturnCtx(e, a), d(a, {
|
|
1250
|
+
code: c.invalid_string,
|
|
1203
1251
|
validation: { endsWith: n.value },
|
|
1204
1252
|
message: n.message
|
|
1205
|
-
}), s.dirty()) : n.kind === "datetime" ?
|
|
1206
|
-
code:
|
|
1253
|
+
}), s.dirty()) : n.kind === "datetime" ? mt(n).test(e.data) || (a = this._getOrReturnCtx(e, a), d(a, {
|
|
1254
|
+
code: c.invalid_string,
|
|
1207
1255
|
validation: "datetime",
|
|
1208
1256
|
message: n.message
|
|
1209
|
-
}), s.dirty()) : n.kind === "date" ?
|
|
1210
|
-
code:
|
|
1257
|
+
}), s.dirty()) : n.kind === "date" ? ht.test(e.data) || (a = this._getOrReturnCtx(e, a), d(a, {
|
|
1258
|
+
code: c.invalid_string,
|
|
1211
1259
|
validation: "date",
|
|
1212
1260
|
message: n.message
|
|
1213
|
-
}), s.dirty()) : n.kind === "time" ?
|
|
1214
|
-
code:
|
|
1261
|
+
}), s.dirty()) : n.kind === "time" ? ft(n).test(e.data) || (a = this._getOrReturnCtx(e, a), d(a, {
|
|
1262
|
+
code: c.invalid_string,
|
|
1215
1263
|
validation: "time",
|
|
1216
1264
|
message: n.message
|
|
1217
|
-
}), s.dirty()) : n.kind === "duration" ?
|
|
1265
|
+
}), s.dirty()) : n.kind === "duration" ? rt.test(e.data) || (a = this._getOrReturnCtx(e, a), d(a, {
|
|
1218
1266
|
validation: "duration",
|
|
1219
|
-
code:
|
|
1267
|
+
code: c.invalid_string,
|
|
1220
1268
|
message: n.message
|
|
1221
|
-
}), s.dirty()) : n.kind === "ip" ?
|
|
1269
|
+
}), s.dirty()) : n.kind === "ip" ? pt(e.data, n.version) || (a = this._getOrReturnCtx(e, a), d(a, {
|
|
1222
1270
|
validation: "ip",
|
|
1223
|
-
code:
|
|
1271
|
+
code: c.invalid_string,
|
|
1224
1272
|
message: n.message
|
|
1225
|
-
}), s.dirty()) : n.kind === "jwt" ?
|
|
1273
|
+
}), s.dirty()) : n.kind === "jwt" ? gt(e.data, n.alg) || (a = this._getOrReturnCtx(e, a), d(a, {
|
|
1226
1274
|
validation: "jwt",
|
|
1227
|
-
code:
|
|
1275
|
+
code: c.invalid_string,
|
|
1228
1276
|
message: n.message
|
|
1229
|
-
}), s.dirty()) : n.kind === "cidr" ?
|
|
1277
|
+
}), s.dirty()) : n.kind === "cidr" ? yt(e.data, n.version) || (a = this._getOrReturnCtx(e, a), d(a, {
|
|
1230
1278
|
validation: "cidr",
|
|
1231
|
-
code:
|
|
1279
|
+
code: c.invalid_string,
|
|
1232
1280
|
message: n.message
|
|
1233
|
-
}), s.dirty()) : n.kind === "base64" ?
|
|
1281
|
+
}), s.dirty()) : n.kind === "base64" ? ut.test(e.data) || (a = this._getOrReturnCtx(e, a), d(a, {
|
|
1234
1282
|
validation: "base64",
|
|
1235
|
-
code:
|
|
1283
|
+
code: c.invalid_string,
|
|
1236
1284
|
message: n.message
|
|
1237
|
-
}), s.dirty()) : n.kind === "base64url" ?
|
|
1285
|
+
}), s.dirty()) : n.kind === "base64url" ? lt.test(e.data) || (a = this._getOrReturnCtx(e, a), d(a, {
|
|
1238
1286
|
validation: "base64url",
|
|
1239
|
-
code:
|
|
1287
|
+
code: c.invalid_string,
|
|
1240
1288
|
message: n.message
|
|
1241
1289
|
}), s.dirty()) : _.assertNever(n);
|
|
1242
1290
|
return { status: s.value, value: e.data };
|
|
@@ -1244,12 +1292,12 @@ class I extends v {
|
|
|
1244
1292
|
_regex(e, t, s) {
|
|
1245
1293
|
return this.refinement((a) => e.test(a), {
|
|
1246
1294
|
validation: t,
|
|
1247
|
-
code:
|
|
1295
|
+
code: c.invalid_string,
|
|
1248
1296
|
...h.errToObj(s)
|
|
1249
1297
|
});
|
|
1250
1298
|
}
|
|
1251
1299
|
_addCheck(e) {
|
|
1252
|
-
return new
|
|
1300
|
+
return new N({
|
|
1253
1301
|
...this._def,
|
|
1254
1302
|
checks: [...this._def.checks, e]
|
|
1255
1303
|
});
|
|
@@ -1385,19 +1433,19 @@ class I extends v {
|
|
|
1385
1433
|
return this.min(1, h.errToObj(e));
|
|
1386
1434
|
}
|
|
1387
1435
|
trim() {
|
|
1388
|
-
return new
|
|
1436
|
+
return new N({
|
|
1389
1437
|
...this._def,
|
|
1390
1438
|
checks: [...this._def.checks, { kind: "trim" }]
|
|
1391
1439
|
});
|
|
1392
1440
|
}
|
|
1393
1441
|
toLowerCase() {
|
|
1394
|
-
return new
|
|
1442
|
+
return new N({
|
|
1395
1443
|
...this._def,
|
|
1396
1444
|
checks: [...this._def.checks, { kind: "toLowerCase" }]
|
|
1397
1445
|
});
|
|
1398
1446
|
}
|
|
1399
1447
|
toUpperCase() {
|
|
1400
|
-
return new
|
|
1448
|
+
return new N({
|
|
1401
1449
|
...this._def,
|
|
1402
1450
|
checks: [...this._def.checks, { kind: "toUpperCase" }]
|
|
1403
1451
|
});
|
|
@@ -1463,57 +1511,57 @@ class I extends v {
|
|
|
1463
1511
|
return e;
|
|
1464
1512
|
}
|
|
1465
1513
|
}
|
|
1466
|
-
|
|
1514
|
+
N.create = (r) => new N({
|
|
1467
1515
|
checks: [],
|
|
1468
1516
|
typeName: p.ZodString,
|
|
1469
1517
|
coerce: r?.coerce ?? !1,
|
|
1470
1518
|
...g(r)
|
|
1471
1519
|
});
|
|
1472
|
-
function
|
|
1520
|
+
function vt(r, e) {
|
|
1473
1521
|
const t = (r.toString().split(".")[1] || "").length, s = (e.toString().split(".")[1] || "").length, a = t > s ? t : s, n = Number.parseInt(r.toFixed(a).replace(".", "")), i = Number.parseInt(e.toFixed(a).replace(".", ""));
|
|
1474
1522
|
return n % i / 10 ** a;
|
|
1475
1523
|
}
|
|
1476
|
-
class
|
|
1524
|
+
class V extends v {
|
|
1477
1525
|
constructor() {
|
|
1478
1526
|
super(...arguments), this.min = this.gte, this.max = this.lte, this.step = this.multipleOf;
|
|
1479
1527
|
}
|
|
1480
1528
|
_parse(e) {
|
|
1481
1529
|
if (this._def.coerce && (e.data = Number(e.data)), this._getType(e) !== l.number) {
|
|
1482
1530
|
const n = this._getOrReturnCtx(e);
|
|
1483
|
-
return
|
|
1484
|
-
code:
|
|
1531
|
+
return d(n, {
|
|
1532
|
+
code: c.invalid_type,
|
|
1485
1533
|
expected: l.number,
|
|
1486
1534
|
received: n.parsedType
|
|
1487
1535
|
}), m;
|
|
1488
1536
|
}
|
|
1489
1537
|
let s;
|
|
1490
|
-
const a = new
|
|
1538
|
+
const a = new x();
|
|
1491
1539
|
for (const n of this._def.checks)
|
|
1492
|
-
n.kind === "int" ? _.isInteger(e.data) || (s = this._getOrReturnCtx(e, s),
|
|
1493
|
-
code:
|
|
1540
|
+
n.kind === "int" ? _.isInteger(e.data) || (s = this._getOrReturnCtx(e, s), d(s, {
|
|
1541
|
+
code: c.invalid_type,
|
|
1494
1542
|
expected: "integer",
|
|
1495
1543
|
received: "float",
|
|
1496
1544
|
message: n.message
|
|
1497
|
-
}), a.dirty()) : n.kind === "min" ? (n.inclusive ? e.data < n.value : e.data <= n.value) && (s = this._getOrReturnCtx(e, s),
|
|
1498
|
-
code:
|
|
1545
|
+
}), a.dirty()) : n.kind === "min" ? (n.inclusive ? e.data < n.value : e.data <= n.value) && (s = this._getOrReturnCtx(e, s), d(s, {
|
|
1546
|
+
code: c.too_small,
|
|
1499
1547
|
minimum: n.value,
|
|
1500
1548
|
type: "number",
|
|
1501
1549
|
inclusive: n.inclusive,
|
|
1502
1550
|
exact: !1,
|
|
1503
1551
|
message: n.message
|
|
1504
|
-
}), a.dirty()) : n.kind === "max" ? (n.inclusive ? e.data > n.value : e.data >= n.value) && (s = this._getOrReturnCtx(e, s),
|
|
1505
|
-
code:
|
|
1552
|
+
}), a.dirty()) : n.kind === "max" ? (n.inclusive ? e.data > n.value : e.data >= n.value) && (s = this._getOrReturnCtx(e, s), d(s, {
|
|
1553
|
+
code: c.too_big,
|
|
1506
1554
|
maximum: n.value,
|
|
1507
1555
|
type: "number",
|
|
1508
1556
|
inclusive: n.inclusive,
|
|
1509
1557
|
exact: !1,
|
|
1510
1558
|
message: n.message
|
|
1511
|
-
}), a.dirty()) : n.kind === "multipleOf" ?
|
|
1512
|
-
code:
|
|
1559
|
+
}), a.dirty()) : n.kind === "multipleOf" ? vt(e.data, n.value) !== 0 && (s = this._getOrReturnCtx(e, s), d(s, {
|
|
1560
|
+
code: c.not_multiple_of,
|
|
1513
1561
|
multipleOf: n.value,
|
|
1514
1562
|
message: n.message
|
|
1515
|
-
}), a.dirty()) : n.kind === "finite" ? Number.isFinite(e.data) || (s = this._getOrReturnCtx(e, s),
|
|
1516
|
-
code:
|
|
1563
|
+
}), a.dirty()) : n.kind === "finite" ? Number.isFinite(e.data) || (s = this._getOrReturnCtx(e, s), d(s, {
|
|
1564
|
+
code: c.not_finite,
|
|
1517
1565
|
message: n.message
|
|
1518
1566
|
}), a.dirty()) : _.assertNever(n);
|
|
1519
1567
|
return { status: a.value, value: e.data };
|
|
@@ -1531,7 +1579,7 @@ class $ extends v {
|
|
|
1531
1579
|
return this.setLimit("max", e, !1, h.toString(t));
|
|
1532
1580
|
}
|
|
1533
1581
|
setLimit(e, t, s, a) {
|
|
1534
|
-
return new
|
|
1582
|
+
return new V({
|
|
1535
1583
|
...this._def,
|
|
1536
1584
|
checks: [
|
|
1537
1585
|
...this._def.checks,
|
|
@@ -1545,7 +1593,7 @@ class $ extends v {
|
|
|
1545
1593
|
});
|
|
1546
1594
|
}
|
|
1547
1595
|
_addCheck(e) {
|
|
1548
|
-
return new
|
|
1596
|
+
return new V({
|
|
1549
1597
|
...this._def,
|
|
1550
1598
|
checks: [...this._def.checks, e]
|
|
1551
1599
|
});
|
|
@@ -1639,13 +1687,13 @@ class $ extends v {
|
|
|
1639
1687
|
return Number.isFinite(t) && Number.isFinite(e);
|
|
1640
1688
|
}
|
|
1641
1689
|
}
|
|
1642
|
-
|
|
1690
|
+
V.create = (r) => new V({
|
|
1643
1691
|
checks: [],
|
|
1644
1692
|
typeName: p.ZodNumber,
|
|
1645
1693
|
coerce: r?.coerce || !1,
|
|
1646
1694
|
...g(r)
|
|
1647
1695
|
});
|
|
1648
|
-
class
|
|
1696
|
+
class H extends v {
|
|
1649
1697
|
constructor() {
|
|
1650
1698
|
super(...arguments), this.min = this.gte, this.max = this.lte;
|
|
1651
1699
|
}
|
|
@@ -1659,22 +1707,22 @@ class B extends v {
|
|
|
1659
1707
|
if (this._getType(e) !== l.bigint)
|
|
1660
1708
|
return this._getInvalidInput(e);
|
|
1661
1709
|
let s;
|
|
1662
|
-
const a = new
|
|
1710
|
+
const a = new x();
|
|
1663
1711
|
for (const n of this._def.checks)
|
|
1664
|
-
n.kind === "min" ? (n.inclusive ? e.data < n.value : e.data <= n.value) && (s = this._getOrReturnCtx(e, s),
|
|
1665
|
-
code:
|
|
1712
|
+
n.kind === "min" ? (n.inclusive ? e.data < n.value : e.data <= n.value) && (s = this._getOrReturnCtx(e, s), d(s, {
|
|
1713
|
+
code: c.too_small,
|
|
1666
1714
|
type: "bigint",
|
|
1667
1715
|
minimum: n.value,
|
|
1668
1716
|
inclusive: n.inclusive,
|
|
1669
1717
|
message: n.message
|
|
1670
|
-
}), a.dirty()) : n.kind === "max" ? (n.inclusive ? e.data > n.value : e.data >= n.value) && (s = this._getOrReturnCtx(e, s),
|
|
1671
|
-
code:
|
|
1718
|
+
}), a.dirty()) : n.kind === "max" ? (n.inclusive ? e.data > n.value : e.data >= n.value) && (s = this._getOrReturnCtx(e, s), d(s, {
|
|
1719
|
+
code: c.too_big,
|
|
1672
1720
|
type: "bigint",
|
|
1673
1721
|
maximum: n.value,
|
|
1674
1722
|
inclusive: n.inclusive,
|
|
1675
1723
|
message: n.message
|
|
1676
|
-
}), a.dirty()) : n.kind === "multipleOf" ? e.data % n.value !== BigInt(0) && (s = this._getOrReturnCtx(e, s),
|
|
1677
|
-
code:
|
|
1724
|
+
}), a.dirty()) : n.kind === "multipleOf" ? e.data % n.value !== BigInt(0) && (s = this._getOrReturnCtx(e, s), d(s, {
|
|
1725
|
+
code: c.not_multiple_of,
|
|
1678
1726
|
multipleOf: n.value,
|
|
1679
1727
|
message: n.message
|
|
1680
1728
|
}), a.dirty()) : _.assertNever(n);
|
|
@@ -1682,8 +1730,8 @@ class B extends v {
|
|
|
1682
1730
|
}
|
|
1683
1731
|
_getInvalidInput(e) {
|
|
1684
1732
|
const t = this._getOrReturnCtx(e);
|
|
1685
|
-
return
|
|
1686
|
-
code:
|
|
1733
|
+
return d(t, {
|
|
1734
|
+
code: c.invalid_type,
|
|
1687
1735
|
expected: l.bigint,
|
|
1688
1736
|
received: t.parsedType
|
|
1689
1737
|
}), m;
|
|
@@ -1701,7 +1749,7 @@ class B extends v {
|
|
|
1701
1749
|
return this.setLimit("max", e, !1, h.toString(t));
|
|
1702
1750
|
}
|
|
1703
1751
|
setLimit(e, t, s, a) {
|
|
1704
|
-
return new
|
|
1752
|
+
return new H({
|
|
1705
1753
|
...this._def,
|
|
1706
1754
|
checks: [
|
|
1707
1755
|
...this._def.checks,
|
|
@@ -1715,7 +1763,7 @@ class B extends v {
|
|
|
1715
1763
|
});
|
|
1716
1764
|
}
|
|
1717
1765
|
_addCheck(e) {
|
|
1718
|
-
return new
|
|
1766
|
+
return new H({
|
|
1719
1767
|
...this._def,
|
|
1720
1768
|
checks: [...this._def.checks, e]
|
|
1721
1769
|
});
|
|
@@ -1772,7 +1820,7 @@ class B extends v {
|
|
|
1772
1820
|
return e;
|
|
1773
1821
|
}
|
|
1774
1822
|
}
|
|
1775
|
-
|
|
1823
|
+
H.create = (r) => new H({
|
|
1776
1824
|
checks: [],
|
|
1777
1825
|
typeName: p.ZodBigInt,
|
|
1778
1826
|
coerce: r?.coerce ?? !1,
|
|
@@ -1782,8 +1830,8 @@ class K extends v {
|
|
|
1782
1830
|
_parse(e) {
|
|
1783
1831
|
if (this._def.coerce && (e.data = !!e.data), this._getType(e) !== l.boolean) {
|
|
1784
1832
|
const s = this._getOrReturnCtx(e);
|
|
1785
|
-
return
|
|
1786
|
-
code:
|
|
1833
|
+
return d(s, {
|
|
1834
|
+
code: c.invalid_type,
|
|
1787
1835
|
expected: l.boolean,
|
|
1788
1836
|
received: s.parsedType
|
|
1789
1837
|
}), m;
|
|
@@ -1800,30 +1848,30 @@ class W extends v {
|
|
|
1800
1848
|
_parse(e) {
|
|
1801
1849
|
if (this._def.coerce && (e.data = new Date(e.data)), this._getType(e) !== l.date) {
|
|
1802
1850
|
const n = this._getOrReturnCtx(e);
|
|
1803
|
-
return
|
|
1804
|
-
code:
|
|
1851
|
+
return d(n, {
|
|
1852
|
+
code: c.invalid_type,
|
|
1805
1853
|
expected: l.date,
|
|
1806
1854
|
received: n.parsedType
|
|
1807
1855
|
}), m;
|
|
1808
1856
|
}
|
|
1809
1857
|
if (Number.isNaN(e.data.getTime())) {
|
|
1810
1858
|
const n = this._getOrReturnCtx(e);
|
|
1811
|
-
return
|
|
1812
|
-
code:
|
|
1859
|
+
return d(n, {
|
|
1860
|
+
code: c.invalid_date
|
|
1813
1861
|
}), m;
|
|
1814
1862
|
}
|
|
1815
|
-
const s = new
|
|
1863
|
+
const s = new x();
|
|
1816
1864
|
let a;
|
|
1817
1865
|
for (const n of this._def.checks)
|
|
1818
|
-
n.kind === "min" ? e.data.getTime() < n.value && (a = this._getOrReturnCtx(e, a),
|
|
1819
|
-
code:
|
|
1866
|
+
n.kind === "min" ? e.data.getTime() < n.value && (a = this._getOrReturnCtx(e, a), d(a, {
|
|
1867
|
+
code: c.too_small,
|
|
1820
1868
|
message: n.message,
|
|
1821
1869
|
inclusive: !0,
|
|
1822
1870
|
exact: !1,
|
|
1823
1871
|
minimum: n.value,
|
|
1824
1872
|
type: "date"
|
|
1825
|
-
}), s.dirty()) : n.kind === "max" ? e.data.getTime() > n.value && (a = this._getOrReturnCtx(e, a),
|
|
1826
|
-
code:
|
|
1873
|
+
}), s.dirty()) : n.kind === "max" ? e.data.getTime() > n.value && (a = this._getOrReturnCtx(e, a), d(a, {
|
|
1874
|
+
code: c.too_big,
|
|
1827
1875
|
message: n.message,
|
|
1828
1876
|
inclusive: !0,
|
|
1829
1877
|
exact: !1,
|
|
@@ -1874,12 +1922,12 @@ W.create = (r) => new W({
|
|
|
1874
1922
|
typeName: p.ZodDate,
|
|
1875
1923
|
...g(r)
|
|
1876
1924
|
});
|
|
1877
|
-
class
|
|
1925
|
+
class ue extends v {
|
|
1878
1926
|
_parse(e) {
|
|
1879
1927
|
if (this._getType(e) !== l.symbol) {
|
|
1880
1928
|
const s = this._getOrReturnCtx(e);
|
|
1881
|
-
return
|
|
1882
|
-
code:
|
|
1929
|
+
return d(s, {
|
|
1930
|
+
code: c.invalid_type,
|
|
1883
1931
|
expected: l.symbol,
|
|
1884
1932
|
received: s.parsedType
|
|
1885
1933
|
}), m;
|
|
@@ -1887,16 +1935,16 @@ class ce extends v {
|
|
|
1887
1935
|
return w(e.data);
|
|
1888
1936
|
}
|
|
1889
1937
|
}
|
|
1890
|
-
|
|
1938
|
+
ue.create = (r) => new ue({
|
|
1891
1939
|
typeName: p.ZodSymbol,
|
|
1892
1940
|
...g(r)
|
|
1893
1941
|
});
|
|
1894
|
-
class
|
|
1942
|
+
class le extends v {
|
|
1895
1943
|
_parse(e) {
|
|
1896
1944
|
if (this._getType(e) !== l.undefined) {
|
|
1897
1945
|
const s = this._getOrReturnCtx(e);
|
|
1898
|
-
return
|
|
1899
|
-
code:
|
|
1946
|
+
return d(s, {
|
|
1947
|
+
code: c.invalid_type,
|
|
1900
1948
|
expected: l.undefined,
|
|
1901
1949
|
received: s.parsedType
|
|
1902
1950
|
}), m;
|
|
@@ -1904,16 +1952,16 @@ class ue extends v {
|
|
|
1904
1952
|
return w(e.data);
|
|
1905
1953
|
}
|
|
1906
1954
|
}
|
|
1907
|
-
|
|
1955
|
+
le.create = (r) => new le({
|
|
1908
1956
|
typeName: p.ZodUndefined,
|
|
1909
1957
|
...g(r)
|
|
1910
1958
|
});
|
|
1911
|
-
class
|
|
1959
|
+
class he extends v {
|
|
1912
1960
|
_parse(e) {
|
|
1913
1961
|
if (this._getType(e) !== l.null) {
|
|
1914
1962
|
const s = this._getOrReturnCtx(e);
|
|
1915
|
-
return
|
|
1916
|
-
code:
|
|
1963
|
+
return d(s, {
|
|
1964
|
+
code: c.invalid_type,
|
|
1917
1965
|
expected: l.null,
|
|
1918
1966
|
received: s.parsedType
|
|
1919
1967
|
}), m;
|
|
@@ -1921,11 +1969,11 @@ class le extends v {
|
|
|
1921
1969
|
return w(e.data);
|
|
1922
1970
|
}
|
|
1923
1971
|
}
|
|
1924
|
-
|
|
1972
|
+
he.create = (r) => new he({
|
|
1925
1973
|
typeName: p.ZodNull,
|
|
1926
1974
|
...g(r)
|
|
1927
1975
|
});
|
|
1928
|
-
class
|
|
1976
|
+
class fe extends v {
|
|
1929
1977
|
constructor() {
|
|
1930
1978
|
super(...arguments), this._any = !0;
|
|
1931
1979
|
}
|
|
@@ -1933,11 +1981,11 @@ class he extends v {
|
|
|
1933
1981
|
return w(e.data);
|
|
1934
1982
|
}
|
|
1935
1983
|
}
|
|
1936
|
-
|
|
1984
|
+
fe.create = (r) => new fe({
|
|
1937
1985
|
typeName: p.ZodAny,
|
|
1938
1986
|
...g(r)
|
|
1939
1987
|
});
|
|
1940
|
-
class
|
|
1988
|
+
class ee extends v {
|
|
1941
1989
|
constructor() {
|
|
1942
1990
|
super(...arguments), this._unknown = !0;
|
|
1943
1991
|
}
|
|
@@ -1945,21 +1993,21 @@ class fe extends v {
|
|
|
1945
1993
|
return w(e.data);
|
|
1946
1994
|
}
|
|
1947
1995
|
}
|
|
1948
|
-
|
|
1996
|
+
ee.create = (r) => new ee({
|
|
1949
1997
|
typeName: p.ZodUnknown,
|
|
1950
1998
|
...g(r)
|
|
1951
1999
|
});
|
|
1952
|
-
class
|
|
2000
|
+
class E extends v {
|
|
1953
2001
|
_parse(e) {
|
|
1954
2002
|
const t = this._getOrReturnCtx(e);
|
|
1955
|
-
return
|
|
1956
|
-
code:
|
|
2003
|
+
return d(t, {
|
|
2004
|
+
code: c.invalid_type,
|
|
1957
2005
|
expected: l.never,
|
|
1958
2006
|
received: t.parsedType
|
|
1959
2007
|
}), m;
|
|
1960
2008
|
}
|
|
1961
2009
|
}
|
|
1962
|
-
|
|
2010
|
+
E.create = (r) => new E({
|
|
1963
2011
|
typeName: p.ZodNever,
|
|
1964
2012
|
...g(r)
|
|
1965
2013
|
});
|
|
@@ -1967,8 +2015,8 @@ class me extends v {
|
|
|
1967
2015
|
_parse(e) {
|
|
1968
2016
|
if (this._getType(e) !== l.undefined) {
|
|
1969
2017
|
const s = this._getOrReturnCtx(e);
|
|
1970
|
-
return
|
|
1971
|
-
code:
|
|
2018
|
+
return d(s, {
|
|
2019
|
+
code: c.invalid_type,
|
|
1972
2020
|
expected: l.void,
|
|
1973
2021
|
received: s.parsedType
|
|
1974
2022
|
}), m;
|
|
@@ -1984,15 +2032,15 @@ class A extends v {
|
|
|
1984
2032
|
_parse(e) {
|
|
1985
2033
|
const { ctx: t, status: s } = this._processInputParams(e), a = this._def;
|
|
1986
2034
|
if (t.parsedType !== l.array)
|
|
1987
|
-
return
|
|
1988
|
-
code:
|
|
2035
|
+
return d(t, {
|
|
2036
|
+
code: c.invalid_type,
|
|
1989
2037
|
expected: l.array,
|
|
1990
2038
|
received: t.parsedType
|
|
1991
2039
|
}), m;
|
|
1992
2040
|
if (a.exactLength !== null) {
|
|
1993
2041
|
const i = t.data.length > a.exactLength.value, o = t.data.length < a.exactLength.value;
|
|
1994
|
-
(i || o) && (
|
|
1995
|
-
code: i ?
|
|
2042
|
+
(i || o) && (d(t, {
|
|
2043
|
+
code: i ? c.too_big : c.too_small,
|
|
1996
2044
|
minimum: o ? a.exactLength.value : void 0,
|
|
1997
2045
|
maximum: i ? a.exactLength.value : void 0,
|
|
1998
2046
|
type: "array",
|
|
@@ -2001,24 +2049,24 @@ class A extends v {
|
|
|
2001
2049
|
message: a.exactLength.message
|
|
2002
2050
|
}), s.dirty());
|
|
2003
2051
|
}
|
|
2004
|
-
if (a.minLength !== null && t.data.length < a.minLength.value && (
|
|
2005
|
-
code:
|
|
2052
|
+
if (a.minLength !== null && t.data.length < a.minLength.value && (d(t, {
|
|
2053
|
+
code: c.too_small,
|
|
2006
2054
|
minimum: a.minLength.value,
|
|
2007
2055
|
type: "array",
|
|
2008
2056
|
inclusive: !0,
|
|
2009
2057
|
exact: !1,
|
|
2010
2058
|
message: a.minLength.message
|
|
2011
|
-
}), s.dirty()), a.maxLength !== null && t.data.length > a.maxLength.value && (
|
|
2012
|
-
code:
|
|
2059
|
+
}), s.dirty()), a.maxLength !== null && t.data.length > a.maxLength.value && (d(t, {
|
|
2060
|
+
code: c.too_big,
|
|
2013
2061
|
maximum: a.maxLength.value,
|
|
2014
2062
|
type: "array",
|
|
2015
2063
|
inclusive: !0,
|
|
2016
2064
|
exact: !1,
|
|
2017
2065
|
message: a.maxLength.message
|
|
2018
2066
|
}), s.dirty()), t.common.async)
|
|
2019
|
-
return Promise.all([...t.data].map((i, o) => a.type._parseAsync(new
|
|
2020
|
-
const n = [...t.data].map((i, o) => a.type._parseSync(new
|
|
2021
|
-
return
|
|
2067
|
+
return Promise.all([...t.data].map((i, o) => a.type._parseAsync(new R(t, i, t.path, o)))).then((i) => x.mergeArray(s, i));
|
|
2068
|
+
const n = [...t.data].map((i, o) => a.type._parseSync(new R(t, i, t.path, o)));
|
|
2069
|
+
return x.mergeArray(s, n);
|
|
2022
2070
|
}
|
|
2023
2071
|
get element() {
|
|
2024
2072
|
return this._def.type;
|
|
@@ -2053,23 +2101,23 @@ A.create = (r, e) => new A({
|
|
|
2053
2101
|
typeName: p.ZodArray,
|
|
2054
2102
|
...g(e)
|
|
2055
2103
|
});
|
|
2056
|
-
function
|
|
2057
|
-
if (r instanceof
|
|
2104
|
+
function $(r) {
|
|
2105
|
+
if (r instanceof k) {
|
|
2058
2106
|
const e = {};
|
|
2059
2107
|
for (const t in r.shape) {
|
|
2060
2108
|
const s = r.shape[t];
|
|
2061
|
-
e[t] =
|
|
2109
|
+
e[t] = O.create($(s));
|
|
2062
2110
|
}
|
|
2063
|
-
return new
|
|
2111
|
+
return new k({
|
|
2064
2112
|
...r._def,
|
|
2065
2113
|
shape: () => e
|
|
2066
2114
|
});
|
|
2067
2115
|
} else return r instanceof A ? new A({
|
|
2068
2116
|
...r._def,
|
|
2069
|
-
type:
|
|
2070
|
-
}) : r instanceof
|
|
2117
|
+
type: $(r.element)
|
|
2118
|
+
}) : r instanceof O ? O.create($(r.unwrap())) : r instanceof D ? D.create($(r.unwrap())) : r instanceof P ? P.create(r.items.map((e) => $(e))) : r;
|
|
2071
2119
|
}
|
|
2072
|
-
class
|
|
2120
|
+
class k extends v {
|
|
2073
2121
|
constructor() {
|
|
2074
2122
|
super(...arguments), this._cached = null, this.nonstrict = this.passthrough, this.augment = this.extend;
|
|
2075
2123
|
}
|
|
@@ -2082,26 +2130,26 @@ class x extends v {
|
|
|
2082
2130
|
_parse(e) {
|
|
2083
2131
|
if (this._getType(e) !== l.object) {
|
|
2084
2132
|
const f = this._getOrReturnCtx(e);
|
|
2085
|
-
return
|
|
2086
|
-
code:
|
|
2133
|
+
return d(f, {
|
|
2134
|
+
code: c.invalid_type,
|
|
2087
2135
|
expected: l.object,
|
|
2088
2136
|
received: f.parsedType
|
|
2089
2137
|
}), m;
|
|
2090
2138
|
}
|
|
2091
2139
|
const { status: s, ctx: a } = this._processInputParams(e), { shape: n, keys: i } = this._getCached(), o = [];
|
|
2092
|
-
if (!(this._def.catchall instanceof
|
|
2140
|
+
if (!(this._def.catchall instanceof E && this._def.unknownKeys === "strip"))
|
|
2093
2141
|
for (const f in a.data)
|
|
2094
2142
|
i.includes(f) || o.push(f);
|
|
2095
2143
|
const u = [];
|
|
2096
2144
|
for (const f of i) {
|
|
2097
|
-
const y = n[f],
|
|
2145
|
+
const y = n[f], Z = a.data[f];
|
|
2098
2146
|
u.push({
|
|
2099
2147
|
key: { status: "valid", value: f },
|
|
2100
|
-
value: y._parse(new
|
|
2148
|
+
value: y._parse(new R(a, Z, a.path, f)),
|
|
2101
2149
|
alwaysSet: f in a.data
|
|
2102
2150
|
});
|
|
2103
2151
|
}
|
|
2104
|
-
if (this._def.catchall instanceof
|
|
2152
|
+
if (this._def.catchall instanceof E) {
|
|
2105
2153
|
const f = this._def.unknownKeys;
|
|
2106
2154
|
if (f === "passthrough")
|
|
2107
2155
|
for (const y of o)
|
|
@@ -2110,19 +2158,19 @@ class x extends v {
|
|
|
2110
2158
|
value: { status: "valid", value: a.data[y] }
|
|
2111
2159
|
});
|
|
2112
2160
|
else if (f === "strict")
|
|
2113
|
-
o.length > 0 && (
|
|
2114
|
-
code:
|
|
2161
|
+
o.length > 0 && (d(a, {
|
|
2162
|
+
code: c.unrecognized_keys,
|
|
2115
2163
|
keys: o
|
|
2116
2164
|
}), s.dirty());
|
|
2117
2165
|
else if (f !== "strip") throw new Error("Internal ZodObject error: invalid unknownKeys value.");
|
|
2118
2166
|
} else {
|
|
2119
2167
|
const f = this._def.catchall;
|
|
2120
2168
|
for (const y of o) {
|
|
2121
|
-
const
|
|
2169
|
+
const Z = a.data[y];
|
|
2122
2170
|
u.push({
|
|
2123
2171
|
key: { status: "valid", value: y },
|
|
2124
2172
|
value: f._parse(
|
|
2125
|
-
new
|
|
2173
|
+
new R(a, Z, a.path, y)
|
|
2126
2174
|
//, ctx.child(key), value, getParsedType(value)
|
|
2127
2175
|
),
|
|
2128
2176
|
alwaysSet: y in a.data
|
|
@@ -2132,21 +2180,21 @@ class x extends v {
|
|
|
2132
2180
|
return a.common.async ? Promise.resolve().then(async () => {
|
|
2133
2181
|
const f = [];
|
|
2134
2182
|
for (const y of u) {
|
|
2135
|
-
const
|
|
2183
|
+
const Z = await y.key, Ae = await y.value;
|
|
2136
2184
|
f.push({
|
|
2137
|
-
key:
|
|
2138
|
-
value:
|
|
2185
|
+
key: Z,
|
|
2186
|
+
value: Ae,
|
|
2139
2187
|
alwaysSet: y.alwaysSet
|
|
2140
2188
|
});
|
|
2141
2189
|
}
|
|
2142
2190
|
return f;
|
|
2143
|
-
}).then((f) =>
|
|
2191
|
+
}).then((f) => x.mergeObjectSync(s, f)) : x.mergeObjectSync(s, u);
|
|
2144
2192
|
}
|
|
2145
2193
|
get shape() {
|
|
2146
2194
|
return this._def.shape();
|
|
2147
2195
|
}
|
|
2148
2196
|
strict(e) {
|
|
2149
|
-
return h.errToObj, new
|
|
2197
|
+
return h.errToObj, new k({
|
|
2150
2198
|
...this._def,
|
|
2151
2199
|
unknownKeys: "strict",
|
|
2152
2200
|
...e !== void 0 ? {
|
|
@@ -2162,13 +2210,13 @@ class x extends v {
|
|
|
2162
2210
|
});
|
|
2163
2211
|
}
|
|
2164
2212
|
strip() {
|
|
2165
|
-
return new
|
|
2213
|
+
return new k({
|
|
2166
2214
|
...this._def,
|
|
2167
2215
|
unknownKeys: "strip"
|
|
2168
2216
|
});
|
|
2169
2217
|
}
|
|
2170
2218
|
passthrough() {
|
|
2171
|
-
return new
|
|
2219
|
+
return new k({
|
|
2172
2220
|
...this._def,
|
|
2173
2221
|
unknownKeys: "passthrough"
|
|
2174
2222
|
});
|
|
@@ -2191,7 +2239,7 @@ class x extends v {
|
|
|
2191
2239
|
// }) as any;
|
|
2192
2240
|
// };
|
|
2193
2241
|
extend(e) {
|
|
2194
|
-
return new
|
|
2242
|
+
return new k({
|
|
2195
2243
|
...this._def,
|
|
2196
2244
|
shape: () => ({
|
|
2197
2245
|
...this._def.shape(),
|
|
@@ -2205,7 +2253,7 @@ class x extends v {
|
|
|
2205
2253
|
* upgrade if you are experiencing issues.
|
|
2206
2254
|
*/
|
|
2207
2255
|
merge(e) {
|
|
2208
|
-
return new
|
|
2256
|
+
return new k({
|
|
2209
2257
|
unknownKeys: e._def.unknownKeys,
|
|
2210
2258
|
catchall: e._def.catchall,
|
|
2211
2259
|
shape: () => ({
|
|
@@ -2275,7 +2323,7 @@ class x extends v {
|
|
|
2275
2323
|
// return merged;
|
|
2276
2324
|
// }
|
|
2277
2325
|
catchall(e) {
|
|
2278
|
-
return new
|
|
2326
|
+
return new k({
|
|
2279
2327
|
...this._def,
|
|
2280
2328
|
catchall: e
|
|
2281
2329
|
});
|
|
@@ -2284,7 +2332,7 @@ class x extends v {
|
|
|
2284
2332
|
const t = {};
|
|
2285
2333
|
for (const s of _.objectKeys(e))
|
|
2286
2334
|
e[s] && this.shape[s] && (t[s] = this.shape[s]);
|
|
2287
|
-
return new
|
|
2335
|
+
return new k({
|
|
2288
2336
|
...this._def,
|
|
2289
2337
|
shape: () => t
|
|
2290
2338
|
});
|
|
@@ -2293,7 +2341,7 @@ class x extends v {
|
|
|
2293
2341
|
const t = {};
|
|
2294
2342
|
for (const s of _.objectKeys(this.shape))
|
|
2295
2343
|
e[s] || (t[s] = this.shape[s]);
|
|
2296
|
-
return new
|
|
2344
|
+
return new k({
|
|
2297
2345
|
...this._def,
|
|
2298
2346
|
shape: () => t
|
|
2299
2347
|
});
|
|
@@ -2302,7 +2350,7 @@ class x extends v {
|
|
|
2302
2350
|
* @deprecated
|
|
2303
2351
|
*/
|
|
2304
2352
|
deepPartial() {
|
|
2305
|
-
return
|
|
2353
|
+
return $(this);
|
|
2306
2354
|
}
|
|
2307
2355
|
partial(e) {
|
|
2308
2356
|
const t = {};
|
|
@@ -2310,7 +2358,7 @@ class x extends v {
|
|
|
2310
2358
|
const a = this.shape[s];
|
|
2311
2359
|
e && !e[s] ? t[s] = a : t[s] = a.optional();
|
|
2312
2360
|
}
|
|
2313
|
-
return new
|
|
2361
|
+
return new k({
|
|
2314
2362
|
...this._def,
|
|
2315
2363
|
shape: () => t
|
|
2316
2364
|
});
|
|
@@ -2322,37 +2370,37 @@ class x extends v {
|
|
|
2322
2370
|
t[s] = this.shape[s];
|
|
2323
2371
|
else {
|
|
2324
2372
|
let n = this.shape[s];
|
|
2325
|
-
for (; n instanceof
|
|
2373
|
+
for (; n instanceof O; )
|
|
2326
2374
|
n = n._def.innerType;
|
|
2327
2375
|
t[s] = n;
|
|
2328
2376
|
}
|
|
2329
|
-
return new
|
|
2377
|
+
return new k({
|
|
2330
2378
|
...this._def,
|
|
2331
2379
|
shape: () => t
|
|
2332
2380
|
});
|
|
2333
2381
|
}
|
|
2334
2382
|
keyof() {
|
|
2335
|
-
return
|
|
2383
|
+
return xe(_.objectKeys(this.shape));
|
|
2336
2384
|
}
|
|
2337
2385
|
}
|
|
2338
|
-
|
|
2386
|
+
k.create = (r, e) => new k({
|
|
2339
2387
|
shape: () => r,
|
|
2340
2388
|
unknownKeys: "strip",
|
|
2341
|
-
catchall:
|
|
2389
|
+
catchall: E.create(),
|
|
2342
2390
|
typeName: p.ZodObject,
|
|
2343
2391
|
...g(e)
|
|
2344
2392
|
});
|
|
2345
|
-
|
|
2393
|
+
k.strictCreate = (r, e) => new k({
|
|
2346
2394
|
shape: () => r,
|
|
2347
2395
|
unknownKeys: "strict",
|
|
2348
|
-
catchall:
|
|
2396
|
+
catchall: E.create(),
|
|
2349
2397
|
typeName: p.ZodObject,
|
|
2350
2398
|
...g(e)
|
|
2351
2399
|
});
|
|
2352
|
-
|
|
2400
|
+
k.lazycreate = (r, e) => new k({
|
|
2353
2401
|
shape: r,
|
|
2354
2402
|
unknownKeys: "strip",
|
|
2355
|
-
catchall:
|
|
2403
|
+
catchall: E.create(),
|
|
2356
2404
|
typeName: p.ZodObject,
|
|
2357
2405
|
...g(e)
|
|
2358
2406
|
});
|
|
@@ -2366,9 +2414,9 @@ class q extends v {
|
|
|
2366
2414
|
for (const o of n)
|
|
2367
2415
|
if (o.result.status === "dirty")
|
|
2368
2416
|
return t.common.issues.push(...o.ctx.common.issues), o.result;
|
|
2369
|
-
const i = n.map((o) => new
|
|
2370
|
-
return
|
|
2371
|
-
code:
|
|
2417
|
+
const i = n.map((o) => new S(o.ctx.common.issues));
|
|
2418
|
+
return d(t, {
|
|
2419
|
+
code: c.invalid_union,
|
|
2372
2420
|
unionErrors: i
|
|
2373
2421
|
}), m;
|
|
2374
2422
|
}
|
|
@@ -2413,9 +2461,9 @@ class q extends v {
|
|
|
2413
2461
|
}
|
|
2414
2462
|
if (n)
|
|
2415
2463
|
return t.common.issues.push(...n.ctx.common.issues), n.result;
|
|
2416
|
-
const o = i.map((u) => new
|
|
2417
|
-
return
|
|
2418
|
-
code:
|
|
2464
|
+
const o = i.map((u) => new S(u));
|
|
2465
|
+
return d(t, {
|
|
2466
|
+
code: c.invalid_union,
|
|
2419
2467
|
unionErrors: o
|
|
2420
2468
|
}), m;
|
|
2421
2469
|
}
|
|
@@ -2429,14 +2477,14 @@ q.create = (r, e) => new q({
|
|
|
2429
2477
|
typeName: p.ZodUnion,
|
|
2430
2478
|
...g(e)
|
|
2431
2479
|
});
|
|
2432
|
-
function
|
|
2433
|
-
const t =
|
|
2480
|
+
function te(r, e) {
|
|
2481
|
+
const t = I(r), s = I(e);
|
|
2434
2482
|
if (r === e)
|
|
2435
2483
|
return { valid: !0, data: r };
|
|
2436
2484
|
if (t === l.object && s === l.object) {
|
|
2437
2485
|
const a = _.objectKeys(e), n = _.objectKeys(r).filter((o) => a.indexOf(o) !== -1), i = { ...r, ...e };
|
|
2438
2486
|
for (const o of n) {
|
|
2439
|
-
const u =
|
|
2487
|
+
const u = te(r[o], e[o]);
|
|
2440
2488
|
if (!u.valid)
|
|
2441
2489
|
return { valid: !1 };
|
|
2442
2490
|
i[o] = u.data;
|
|
@@ -2447,7 +2495,7 @@ function ee(r, e) {
|
|
|
2447
2495
|
return { valid: !1 };
|
|
2448
2496
|
const a = [];
|
|
2449
2497
|
for (let n = 0; n < r.length; n++) {
|
|
2450
|
-
const i = r[n], o = e[n], u =
|
|
2498
|
+
const i = r[n], o = e[n], u = te(i, o);
|
|
2451
2499
|
if (!u.valid)
|
|
2452
2500
|
return { valid: !1 };
|
|
2453
2501
|
a.push(u.data);
|
|
@@ -2458,11 +2506,11 @@ function ee(r, e) {
|
|
|
2458
2506
|
class Q extends v {
|
|
2459
2507
|
_parse(e) {
|
|
2460
2508
|
const { status: t, ctx: s } = this._processInputParams(e), a = (n, i) => {
|
|
2461
|
-
if (
|
|
2509
|
+
if (oe(n) || oe(i))
|
|
2462
2510
|
return m;
|
|
2463
|
-
const o =
|
|
2464
|
-
return o.valid ? ((
|
|
2465
|
-
code:
|
|
2511
|
+
const o = te(n.value, i.value);
|
|
2512
|
+
return o.valid ? ((ce(n) || ce(i)) && t.dirty(), { status: t.value, value: o.data }) : (d(s, {
|
|
2513
|
+
code: c.invalid_intersection_types
|
|
2466
2514
|
}), m);
|
|
2467
2515
|
};
|
|
2468
2516
|
return s.common.async ? Promise.all([
|
|
@@ -2493,25 +2541,25 @@ Q.create = (r, e, t) => new Q({
|
|
|
2493
2541
|
typeName: p.ZodIntersection,
|
|
2494
2542
|
...g(t)
|
|
2495
2543
|
});
|
|
2496
|
-
class
|
|
2544
|
+
class P extends v {
|
|
2497
2545
|
_parse(e) {
|
|
2498
2546
|
const { status: t, ctx: s } = this._processInputParams(e);
|
|
2499
2547
|
if (s.parsedType !== l.array)
|
|
2500
|
-
return
|
|
2501
|
-
code:
|
|
2548
|
+
return d(s, {
|
|
2549
|
+
code: c.invalid_type,
|
|
2502
2550
|
expected: l.array,
|
|
2503
2551
|
received: s.parsedType
|
|
2504
2552
|
}), m;
|
|
2505
2553
|
if (s.data.length < this._def.items.length)
|
|
2506
|
-
return
|
|
2507
|
-
code:
|
|
2554
|
+
return d(s, {
|
|
2555
|
+
code: c.too_small,
|
|
2508
2556
|
minimum: this._def.items.length,
|
|
2509
2557
|
inclusive: !0,
|
|
2510
2558
|
exact: !1,
|
|
2511
2559
|
type: "array"
|
|
2512
2560
|
}), m;
|
|
2513
|
-
!this._def.rest && s.data.length > this._def.items.length && (
|
|
2514
|
-
code:
|
|
2561
|
+
!this._def.rest && s.data.length > this._def.items.length && (d(s, {
|
|
2562
|
+
code: c.too_big,
|
|
2515
2563
|
maximum: this._def.items.length,
|
|
2516
2564
|
inclusive: !0,
|
|
2517
2565
|
exact: !1,
|
|
@@ -2519,24 +2567,24 @@ class Z extends v {
|
|
|
2519
2567
|
}), t.dirty());
|
|
2520
2568
|
const n = [...s.data].map((i, o) => {
|
|
2521
2569
|
const u = this._def.items[o] || this._def.rest;
|
|
2522
|
-
return u ? u._parse(new
|
|
2570
|
+
return u ? u._parse(new R(s, i, s.path, o)) : null;
|
|
2523
2571
|
}).filter((i) => !!i);
|
|
2524
|
-
return s.common.async ? Promise.all(n).then((i) =>
|
|
2572
|
+
return s.common.async ? Promise.all(n).then((i) => x.mergeArray(t, i)) : x.mergeArray(t, n);
|
|
2525
2573
|
}
|
|
2526
2574
|
get items() {
|
|
2527
2575
|
return this._def.items;
|
|
2528
2576
|
}
|
|
2529
2577
|
rest(e) {
|
|
2530
|
-
return new
|
|
2578
|
+
return new P({
|
|
2531
2579
|
...this._def,
|
|
2532
2580
|
rest: e
|
|
2533
2581
|
});
|
|
2534
2582
|
}
|
|
2535
2583
|
}
|
|
2536
|
-
|
|
2584
|
+
P.create = (r, e) => {
|
|
2537
2585
|
if (!Array.isArray(r))
|
|
2538
2586
|
throw new Error("You must pass an array of schemas to z.tuple([ ... ])");
|
|
2539
|
-
return new
|
|
2587
|
+
return new P({
|
|
2540
2588
|
items: r,
|
|
2541
2589
|
typeName: p.ZodTuple,
|
|
2542
2590
|
rest: null,
|
|
@@ -2553,14 +2601,14 @@ class pe extends v {
|
|
|
2553
2601
|
_parse(e) {
|
|
2554
2602
|
const { status: t, ctx: s } = this._processInputParams(e);
|
|
2555
2603
|
if (s.parsedType !== l.map)
|
|
2556
|
-
return
|
|
2557
|
-
code:
|
|
2604
|
+
return d(s, {
|
|
2605
|
+
code: c.invalid_type,
|
|
2558
2606
|
expected: l.map,
|
|
2559
2607
|
received: s.parsedType
|
|
2560
2608
|
}), m;
|
|
2561
2609
|
const a = this._def.keyType, n = this._def.valueType, i = [...s.data.entries()].map(([o, u], f) => ({
|
|
2562
|
-
key: a._parse(new
|
|
2563
|
-
value: n._parse(new
|
|
2610
|
+
key: a._parse(new R(s, o, s.path, [f, "key"])),
|
|
2611
|
+
value: n._parse(new R(s, u, s.path, [f, "value"]))
|
|
2564
2612
|
}));
|
|
2565
2613
|
if (s.common.async) {
|
|
2566
2614
|
const o = /* @__PURE__ */ new Map();
|
|
@@ -2591,25 +2639,25 @@ pe.create = (r, e, t) => new pe({
|
|
|
2591
2639
|
typeName: p.ZodMap,
|
|
2592
2640
|
...g(t)
|
|
2593
2641
|
});
|
|
2594
|
-
class
|
|
2642
|
+
class B extends v {
|
|
2595
2643
|
_parse(e) {
|
|
2596
2644
|
const { status: t, ctx: s } = this._processInputParams(e);
|
|
2597
2645
|
if (s.parsedType !== l.set)
|
|
2598
|
-
return
|
|
2599
|
-
code:
|
|
2646
|
+
return d(s, {
|
|
2647
|
+
code: c.invalid_type,
|
|
2600
2648
|
expected: l.set,
|
|
2601
2649
|
received: s.parsedType
|
|
2602
2650
|
}), m;
|
|
2603
2651
|
const a = this._def;
|
|
2604
|
-
a.minSize !== null && s.data.size < a.minSize.value && (
|
|
2605
|
-
code:
|
|
2652
|
+
a.minSize !== null && s.data.size < a.minSize.value && (d(s, {
|
|
2653
|
+
code: c.too_small,
|
|
2606
2654
|
minimum: a.minSize.value,
|
|
2607
2655
|
type: "set",
|
|
2608
2656
|
inclusive: !0,
|
|
2609
2657
|
exact: !1,
|
|
2610
2658
|
message: a.minSize.message
|
|
2611
|
-
}), t.dirty()), a.maxSize !== null && s.data.size > a.maxSize.value && (
|
|
2612
|
-
code:
|
|
2659
|
+
}), t.dirty()), a.maxSize !== null && s.data.size > a.maxSize.value && (d(s, {
|
|
2660
|
+
code: c.too_big,
|
|
2613
2661
|
maximum: a.maxSize.value,
|
|
2614
2662
|
type: "set",
|
|
2615
2663
|
inclusive: !0,
|
|
@@ -2626,17 +2674,17 @@ class H extends v {
|
|
|
2626
2674
|
}
|
|
2627
2675
|
return { status: t.value, value: f };
|
|
2628
2676
|
}
|
|
2629
|
-
const o = [...s.data.values()].map((u, f) => n._parse(new
|
|
2677
|
+
const o = [...s.data.values()].map((u, f) => n._parse(new R(s, u, s.path, f)));
|
|
2630
2678
|
return s.common.async ? Promise.all(o).then((u) => i(u)) : i(o);
|
|
2631
2679
|
}
|
|
2632
2680
|
min(e, t) {
|
|
2633
|
-
return new
|
|
2681
|
+
return new B({
|
|
2634
2682
|
...this._def,
|
|
2635
2683
|
minSize: { value: e, message: h.toString(t) }
|
|
2636
2684
|
});
|
|
2637
2685
|
}
|
|
2638
2686
|
max(e, t) {
|
|
2639
|
-
return new
|
|
2687
|
+
return new B({
|
|
2640
2688
|
...this._def,
|
|
2641
2689
|
maxSize: { value: e, message: h.toString(t) }
|
|
2642
2690
|
});
|
|
@@ -2648,7 +2696,7 @@ class H extends v {
|
|
|
2648
2696
|
return this.min(1, e);
|
|
2649
2697
|
}
|
|
2650
2698
|
}
|
|
2651
|
-
|
|
2699
|
+
B.create = (r, e) => new B({
|
|
2652
2700
|
valueType: r,
|
|
2653
2701
|
minSize: null,
|
|
2654
2702
|
maxSize: null,
|
|
@@ -2673,9 +2721,9 @@ class ye extends v {
|
|
|
2673
2721
|
_parse(e) {
|
|
2674
2722
|
if (e.data !== this._def.value) {
|
|
2675
2723
|
const t = this._getOrReturnCtx(e);
|
|
2676
|
-
return
|
|
2724
|
+
return d(t, {
|
|
2677
2725
|
received: t.data,
|
|
2678
|
-
code:
|
|
2726
|
+
code: c.invalid_literal,
|
|
2679
2727
|
expected: this._def.value
|
|
2680
2728
|
}), m;
|
|
2681
2729
|
}
|
|
@@ -2690,28 +2738,28 @@ ye.create = (r, e) => new ye({
|
|
|
2690
2738
|
typeName: p.ZodLiteral,
|
|
2691
2739
|
...g(e)
|
|
2692
2740
|
});
|
|
2693
|
-
function
|
|
2694
|
-
return new
|
|
2741
|
+
function xe(r, e) {
|
|
2742
|
+
return new L({
|
|
2695
2743
|
values: r,
|
|
2696
2744
|
typeName: p.ZodEnum,
|
|
2697
2745
|
...g(e)
|
|
2698
2746
|
});
|
|
2699
2747
|
}
|
|
2700
|
-
class
|
|
2748
|
+
class L extends v {
|
|
2701
2749
|
_parse(e) {
|
|
2702
2750
|
if (typeof e.data != "string") {
|
|
2703
2751
|
const t = this._getOrReturnCtx(e), s = this._def.values;
|
|
2704
|
-
return
|
|
2752
|
+
return d(t, {
|
|
2705
2753
|
expected: _.joinValues(s),
|
|
2706
2754
|
received: t.parsedType,
|
|
2707
|
-
code:
|
|
2755
|
+
code: c.invalid_type
|
|
2708
2756
|
}), m;
|
|
2709
2757
|
}
|
|
2710
2758
|
if (this._cache || (this._cache = new Set(this._def.values)), !this._cache.has(e.data)) {
|
|
2711
2759
|
const t = this._getOrReturnCtx(e), s = this._def.values;
|
|
2712
|
-
return
|
|
2760
|
+
return d(t, {
|
|
2713
2761
|
received: t.data,
|
|
2714
|
-
code:
|
|
2762
|
+
code: c.invalid_enum_value,
|
|
2715
2763
|
options: s
|
|
2716
2764
|
}), m;
|
|
2717
2765
|
}
|
|
@@ -2739,35 +2787,35 @@ class M extends v {
|
|
|
2739
2787
|
return e;
|
|
2740
2788
|
}
|
|
2741
2789
|
extract(e, t = this._def) {
|
|
2742
|
-
return
|
|
2790
|
+
return L.create(e, {
|
|
2743
2791
|
...this._def,
|
|
2744
2792
|
...t
|
|
2745
2793
|
});
|
|
2746
2794
|
}
|
|
2747
2795
|
exclude(e, t = this._def) {
|
|
2748
|
-
return
|
|
2796
|
+
return L.create(this.options.filter((s) => !e.includes(s)), {
|
|
2749
2797
|
...this._def,
|
|
2750
2798
|
...t
|
|
2751
2799
|
});
|
|
2752
2800
|
}
|
|
2753
2801
|
}
|
|
2754
|
-
|
|
2802
|
+
L.create = xe;
|
|
2755
2803
|
class ve extends v {
|
|
2756
2804
|
_parse(e) {
|
|
2757
2805
|
const t = _.getValidEnumValues(this._def.values), s = this._getOrReturnCtx(e);
|
|
2758
2806
|
if (s.parsedType !== l.string && s.parsedType !== l.number) {
|
|
2759
2807
|
const a = _.objectValues(t);
|
|
2760
|
-
return
|
|
2808
|
+
return d(s, {
|
|
2761
2809
|
expected: _.joinValues(a),
|
|
2762
2810
|
received: s.parsedType,
|
|
2763
|
-
code:
|
|
2811
|
+
code: c.invalid_type
|
|
2764
2812
|
}), m;
|
|
2765
2813
|
}
|
|
2766
2814
|
if (this._cache || (this._cache = new Set(_.getValidEnumValues(this._def.values))), !this._cache.has(e.data)) {
|
|
2767
2815
|
const a = _.objectValues(t);
|
|
2768
|
-
return
|
|
2816
|
+
return d(s, {
|
|
2769
2817
|
received: s.data,
|
|
2770
|
-
code:
|
|
2818
|
+
code: c.invalid_enum_value,
|
|
2771
2819
|
options: a
|
|
2772
2820
|
}), m;
|
|
2773
2821
|
}
|
|
@@ -2789,8 +2837,8 @@ class Y extends v {
|
|
|
2789
2837
|
_parse(e) {
|
|
2790
2838
|
const { ctx: t } = this._processInputParams(e);
|
|
2791
2839
|
if (t.parsedType !== l.promise && t.common.async === !1)
|
|
2792
|
-
return
|
|
2793
|
-
code:
|
|
2840
|
+
return d(t, {
|
|
2841
|
+
code: c.invalid_type,
|
|
2794
2842
|
expected: l.promise,
|
|
2795
2843
|
received: t.parsedType
|
|
2796
2844
|
}), m;
|
|
@@ -2806,7 +2854,7 @@ Y.create = (r, e) => new Y({
|
|
|
2806
2854
|
typeName: p.ZodPromise,
|
|
2807
2855
|
...g(e)
|
|
2808
2856
|
});
|
|
2809
|
-
class
|
|
2857
|
+
class z extends v {
|
|
2810
2858
|
innerType() {
|
|
2811
2859
|
return this._def.schema;
|
|
2812
2860
|
}
|
|
@@ -2816,7 +2864,7 @@ class V extends v {
|
|
|
2816
2864
|
_parse(e) {
|
|
2817
2865
|
const { status: t, ctx: s } = this._processInputParams(e), a = this._def.effect || null, n = {
|
|
2818
2866
|
addIssue: (i) => {
|
|
2819
|
-
|
|
2867
|
+
d(s, i), i.fatal ? t.abort() : t.dirty();
|
|
2820
2868
|
},
|
|
2821
2869
|
get path() {
|
|
2822
2870
|
return s.path;
|
|
@@ -2872,33 +2920,33 @@ class V extends v {
|
|
|
2872
2920
|
path: s.path,
|
|
2873
2921
|
parent: s
|
|
2874
2922
|
});
|
|
2875
|
-
if (!
|
|
2923
|
+
if (!M(i))
|
|
2876
2924
|
return m;
|
|
2877
2925
|
const o = a.transform(i.value, n);
|
|
2878
2926
|
if (o instanceof Promise)
|
|
2879
2927
|
throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");
|
|
2880
2928
|
return { status: t.value, value: o };
|
|
2881
2929
|
} else
|
|
2882
|
-
return this._def.schema._parseAsync({ data: s.data, path: s.path, parent: s }).then((i) =>
|
|
2930
|
+
return this._def.schema._parseAsync({ data: s.data, path: s.path, parent: s }).then((i) => M(i) ? Promise.resolve(a.transform(i.value, n)).then((o) => ({
|
|
2883
2931
|
status: t.value,
|
|
2884
2932
|
value: o
|
|
2885
2933
|
})) : m);
|
|
2886
2934
|
_.assertNever(a);
|
|
2887
2935
|
}
|
|
2888
2936
|
}
|
|
2889
|
-
|
|
2937
|
+
z.create = (r, e, t) => new z({
|
|
2890
2938
|
schema: r,
|
|
2891
2939
|
typeName: p.ZodEffects,
|
|
2892
2940
|
effect: e,
|
|
2893
2941
|
...g(t)
|
|
2894
2942
|
});
|
|
2895
|
-
|
|
2943
|
+
z.createWithPreprocess = (r, e, t) => new z({
|
|
2896
2944
|
schema: e,
|
|
2897
2945
|
effect: { type: "preprocess", transform: r },
|
|
2898
2946
|
typeName: p.ZodEffects,
|
|
2899
2947
|
...g(t)
|
|
2900
2948
|
});
|
|
2901
|
-
class
|
|
2949
|
+
class O extends v {
|
|
2902
2950
|
_parse(e) {
|
|
2903
2951
|
return this._getType(e) === l.undefined ? w(void 0) : this._def.innerType._parse(e);
|
|
2904
2952
|
}
|
|
@@ -2906,12 +2954,12 @@ class N extends v {
|
|
|
2906
2954
|
return this._def.innerType;
|
|
2907
2955
|
}
|
|
2908
2956
|
}
|
|
2909
|
-
|
|
2957
|
+
O.create = (r, e) => new O({
|
|
2910
2958
|
innerType: r,
|
|
2911
2959
|
typeName: p.ZodOptional,
|
|
2912
2960
|
...g(e)
|
|
2913
2961
|
});
|
|
2914
|
-
class
|
|
2962
|
+
class D extends v {
|
|
2915
2963
|
_parse(e) {
|
|
2916
2964
|
return this._getType(e) === l.null ? w(null) : this._def.innerType._parse(e);
|
|
2917
2965
|
}
|
|
@@ -2919,12 +2967,12 @@ class L extends v {
|
|
|
2919
2967
|
return this._def.innerType;
|
|
2920
2968
|
}
|
|
2921
2969
|
}
|
|
2922
|
-
|
|
2970
|
+
D.create = (r, e) => new D({
|
|
2923
2971
|
innerType: r,
|
|
2924
2972
|
typeName: p.ZodNullable,
|
|
2925
2973
|
...g(e)
|
|
2926
2974
|
});
|
|
2927
|
-
class
|
|
2975
|
+
class se extends v {
|
|
2928
2976
|
_parse(e) {
|
|
2929
2977
|
const { ctx: t } = this._processInputParams(e);
|
|
2930
2978
|
let s = t.data;
|
|
@@ -2938,13 +2986,13 @@ class te extends v {
|
|
|
2938
2986
|
return this._def.innerType;
|
|
2939
2987
|
}
|
|
2940
2988
|
}
|
|
2941
|
-
|
|
2989
|
+
se.create = (r, e) => new se({
|
|
2942
2990
|
innerType: r,
|
|
2943
2991
|
typeName: p.ZodDefault,
|
|
2944
2992
|
defaultValue: typeof e.default == "function" ? e.default : () => e.default,
|
|
2945
2993
|
...g(e)
|
|
2946
2994
|
});
|
|
2947
|
-
class
|
|
2995
|
+
class re extends v {
|
|
2948
2996
|
_parse(e) {
|
|
2949
2997
|
const { ctx: t } = this._processInputParams(e), s = {
|
|
2950
2998
|
...t,
|
|
@@ -2963,7 +3011,7 @@ class se extends v {
|
|
|
2963
3011
|
status: "valid",
|
|
2964
3012
|
value: n.status === "valid" ? n.value : this._def.catchValue({
|
|
2965
3013
|
get error() {
|
|
2966
|
-
return new
|
|
3014
|
+
return new S(s.common.issues);
|
|
2967
3015
|
},
|
|
2968
3016
|
input: s.data
|
|
2969
3017
|
})
|
|
@@ -2971,7 +3019,7 @@ class se extends v {
|
|
|
2971
3019
|
status: "valid",
|
|
2972
3020
|
value: a.status === "valid" ? a.value : this._def.catchValue({
|
|
2973
3021
|
get error() {
|
|
2974
|
-
return new
|
|
3022
|
+
return new S(s.common.issues);
|
|
2975
3023
|
},
|
|
2976
3024
|
input: s.data
|
|
2977
3025
|
})
|
|
@@ -2981,7 +3029,7 @@ class se extends v {
|
|
|
2981
3029
|
return this._def.innerType;
|
|
2982
3030
|
}
|
|
2983
3031
|
}
|
|
2984
|
-
|
|
3032
|
+
re.create = (r, e) => new re({
|
|
2985
3033
|
innerType: r,
|
|
2986
3034
|
typeName: p.ZodCatch,
|
|
2987
3035
|
catchValue: typeof e.catch == "function" ? e.catch : () => e.catch,
|
|
@@ -2991,8 +3039,8 @@ class _e extends v {
|
|
|
2991
3039
|
_parse(e) {
|
|
2992
3040
|
if (this._getType(e) !== l.nan) {
|
|
2993
3041
|
const s = this._getOrReturnCtx(e);
|
|
2994
|
-
return
|
|
2995
|
-
code:
|
|
3042
|
+
return d(s, {
|
|
3043
|
+
code: c.invalid_type,
|
|
2996
3044
|
expected: l.nan,
|
|
2997
3045
|
received: s.parsedType
|
|
2998
3046
|
}), m;
|
|
@@ -3004,7 +3052,7 @@ _e.create = (r) => new _e({
|
|
|
3004
3052
|
typeName: p.ZodNaN,
|
|
3005
3053
|
...g(r)
|
|
3006
3054
|
});
|
|
3007
|
-
class
|
|
3055
|
+
class _t extends v {
|
|
3008
3056
|
_parse(e) {
|
|
3009
3057
|
const { ctx: t } = this._processInputParams(e), s = t.data;
|
|
3010
3058
|
return this._def.type._parse({
|
|
@@ -3017,7 +3065,7 @@ class yt extends v {
|
|
|
3017
3065
|
return this._def.type;
|
|
3018
3066
|
}
|
|
3019
3067
|
}
|
|
3020
|
-
class
|
|
3068
|
+
class ne extends v {
|
|
3021
3069
|
_parse(e) {
|
|
3022
3070
|
const { status: t, ctx: s } = this._processInputParams(e);
|
|
3023
3071
|
if (s.common.async)
|
|
@@ -3050,23 +3098,23 @@ class ae extends v {
|
|
|
3050
3098
|
}
|
|
3051
3099
|
}
|
|
3052
3100
|
static create(e, t) {
|
|
3053
|
-
return new
|
|
3101
|
+
return new ne({
|
|
3054
3102
|
in: e,
|
|
3055
3103
|
out: t,
|
|
3056
3104
|
typeName: p.ZodPipeline
|
|
3057
3105
|
});
|
|
3058
3106
|
}
|
|
3059
3107
|
}
|
|
3060
|
-
class
|
|
3108
|
+
class ae extends v {
|
|
3061
3109
|
_parse(e) {
|
|
3062
|
-
const t = this._def.innerType._parse(e), s = (a) => (
|
|
3110
|
+
const t = this._def.innerType._parse(e), s = (a) => (M(a) && (a.value = Object.freeze(a.value)), a);
|
|
3063
3111
|
return U(t) ? t.then((a) => s(a)) : s(t);
|
|
3064
3112
|
}
|
|
3065
3113
|
unwrap() {
|
|
3066
3114
|
return this._def.innerType;
|
|
3067
3115
|
}
|
|
3068
3116
|
}
|
|
3069
|
-
|
|
3117
|
+
ae.create = (r, e) => new ae({
|
|
3070
3118
|
innerType: r,
|
|
3071
3119
|
typeName: p.ZodReadonly,
|
|
3072
3120
|
...g(e)
|
|
@@ -3075,83 +3123,105 @@ var p;
|
|
|
3075
3123
|
(function(r) {
|
|
3076
3124
|
r.ZodString = "ZodString", r.ZodNumber = "ZodNumber", r.ZodNaN = "ZodNaN", r.ZodBigInt = "ZodBigInt", r.ZodBoolean = "ZodBoolean", r.ZodDate = "ZodDate", r.ZodSymbol = "ZodSymbol", r.ZodUndefined = "ZodUndefined", r.ZodNull = "ZodNull", r.ZodAny = "ZodAny", r.ZodUnknown = "ZodUnknown", r.ZodNever = "ZodNever", r.ZodVoid = "ZodVoid", r.ZodArray = "ZodArray", r.ZodObject = "ZodObject", r.ZodUnion = "ZodUnion", r.ZodDiscriminatedUnion = "ZodDiscriminatedUnion", r.ZodIntersection = "ZodIntersection", r.ZodTuple = "ZodTuple", r.ZodRecord = "ZodRecord", r.ZodMap = "ZodMap", r.ZodSet = "ZodSet", r.ZodFunction = "ZodFunction", r.ZodLazy = "ZodLazy", r.ZodLiteral = "ZodLiteral", r.ZodEnum = "ZodEnum", r.ZodEffects = "ZodEffects", r.ZodNativeEnum = "ZodNativeEnum", r.ZodOptional = "ZodOptional", r.ZodNullable = "ZodNullable", r.ZodDefault = "ZodDefault", r.ZodCatch = "ZodCatch", r.ZodPromise = "ZodPromise", r.ZodBranded = "ZodBranded", r.ZodPipeline = "ZodPipeline", r.ZodReadonly = "ZodReadonly";
|
|
3077
3125
|
})(p || (p = {}));
|
|
3078
|
-
const
|
|
3079
|
-
|
|
3080
|
-
const
|
|
3081
|
-
q.create;
|
|
3126
|
+
const b = N.create, j = V.create, we = K.create, bt = ee.create;
|
|
3127
|
+
E.create;
|
|
3128
|
+
const C = A.create, T = k.create, kt = q.create;
|
|
3082
3129
|
Q.create;
|
|
3083
|
-
|
|
3084
|
-
const
|
|
3130
|
+
P.create;
|
|
3131
|
+
const xt = L.create;
|
|
3085
3132
|
Y.create;
|
|
3086
|
-
|
|
3087
|
-
|
|
3088
|
-
const J =
|
|
3089
|
-
provider:
|
|
3090
|
-
id:
|
|
3091
|
-
url:
|
|
3092
|
-
}),
|
|
3093
|
-
url:
|
|
3094
|
-
width:
|
|
3095
|
-
height:
|
|
3096
|
-
purpose:
|
|
3133
|
+
O.create;
|
|
3134
|
+
D.create;
|
|
3135
|
+
const J = T({
|
|
3136
|
+
provider: b(),
|
|
3137
|
+
id: b(),
|
|
3138
|
+
url: b().optional()
|
|
3139
|
+
}), wt = T({
|
|
3140
|
+
url: b(),
|
|
3141
|
+
width: j().optional(),
|
|
3142
|
+
height: j().optional(),
|
|
3143
|
+
purpose: xt(["avatar", "cover", "background", "thumbnail"]).optional(),
|
|
3097
3144
|
source: J.optional()
|
|
3098
|
-
}),
|
|
3099
|
-
items:
|
|
3100
|
-
}),
|
|
3101
|
-
name:
|
|
3102
|
-
roles:
|
|
3145
|
+
}), Te = T({
|
|
3146
|
+
items: C(wt)
|
|
3147
|
+
}), Tt = T({
|
|
3148
|
+
name: b(),
|
|
3149
|
+
roles: C(b()),
|
|
3103
3150
|
source: J.optional()
|
|
3104
|
-
}),
|
|
3105
|
-
title:
|
|
3106
|
-
artists:
|
|
3107
|
-
durationMs:
|
|
3151
|
+
}), At = T({
|
|
3152
|
+
title: b(),
|
|
3153
|
+
artists: C(Tt),
|
|
3154
|
+
durationMs: j().optional(),
|
|
3108
3155
|
source: J
|
|
3109
|
-
}).passthrough(),
|
|
3110
|
-
id:
|
|
3111
|
-
track:
|
|
3112
|
-
note:
|
|
3113
|
-
addedAtIso:
|
|
3114
|
-
}),
|
|
3115
|
-
id:
|
|
3116
|
-
name:
|
|
3117
|
-
description:
|
|
3118
|
-
artwork:
|
|
3119
|
-
tags:
|
|
3120
|
-
createdAtIso:
|
|
3121
|
-
lastModifiedIso:
|
|
3156
|
+
}).passthrough(), St = T({
|
|
3157
|
+
id: b(),
|
|
3158
|
+
track: At,
|
|
3159
|
+
note: b().optional(),
|
|
3160
|
+
addedAtIso: b()
|
|
3161
|
+
}), $t = 1, Ct = T({
|
|
3162
|
+
id: b(),
|
|
3163
|
+
name: b(),
|
|
3164
|
+
description: b().optional(),
|
|
3165
|
+
artwork: Te.optional(),
|
|
3166
|
+
tags: C(b()).optional(),
|
|
3167
|
+
createdAtIso: b(),
|
|
3168
|
+
lastModifiedIso: b(),
|
|
3122
3169
|
origin: J.optional(),
|
|
3123
3170
|
isReadOnly: we(),
|
|
3124
|
-
parentId:
|
|
3125
|
-
items:
|
|
3126
|
-
}),
|
|
3127
|
-
version:
|
|
3128
|
-
playlist:
|
|
3129
|
-
}),
|
|
3130
|
-
id:
|
|
3131
|
-
name:
|
|
3132
|
-
createdAtIso:
|
|
3133
|
-
lastModifiedIso:
|
|
3171
|
+
parentId: b().optional(),
|
|
3172
|
+
items: C(St)
|
|
3173
|
+
}), Mt = T({
|
|
3174
|
+
version: j(),
|
|
3175
|
+
playlist: Ct
|
|
3176
|
+
}), It = T({
|
|
3177
|
+
id: b(),
|
|
3178
|
+
name: b(),
|
|
3179
|
+
createdAtIso: b(),
|
|
3180
|
+
lastModifiedIso: b(),
|
|
3134
3181
|
isReadOnly: we(),
|
|
3135
|
-
artwork:
|
|
3136
|
-
itemCount:
|
|
3137
|
-
totalDurationMs:
|
|
3138
|
-
|
|
3182
|
+
artwork: Te.optional(),
|
|
3183
|
+
itemCount: j(),
|
|
3184
|
+
totalDurationMs: j(),
|
|
3185
|
+
thumbnails: C(b()).default([])
|
|
3186
|
+
}), Vt = C(It), Nt = T({
|
|
3187
|
+
uuid: b().optional(),
|
|
3188
|
+
artist: b().optional(),
|
|
3189
|
+
name: b().optional(),
|
|
3190
|
+
album: b().optional(),
|
|
3191
|
+
thumbnail: b().optional(),
|
|
3192
|
+
duration: kt([j(), b().transform(Number)]).refine((r) => Number.isFinite(r), { message: "Invalid duration" }).optional()
|
|
3193
|
+
}), Ot = T({
|
|
3194
|
+
name: b(),
|
|
3195
|
+
tracks: C(Nt)
|
|
3196
|
+
}), Lt = T({
|
|
3197
|
+
playlists: C(bt())
|
|
3198
|
+
}).refine(
|
|
3199
|
+
(r) => r.playlists.some(
|
|
3200
|
+
(e) => Ot.safeParse(e).success
|
|
3201
|
+
),
|
|
3202
|
+
{ message: "No valid legacy playlists found" }
|
|
3203
|
+
);
|
|
3139
3204
|
export {
|
|
3140
3205
|
Ne as DashboardAPI,
|
|
3141
|
-
Oe as
|
|
3206
|
+
Oe as EventsAPI,
|
|
3207
|
+
Re as FavoritesAPI,
|
|
3142
3208
|
je as HttpAPI,
|
|
3143
|
-
|
|
3144
|
-
|
|
3145
|
-
|
|
3146
|
-
|
|
3147
|
-
|
|
3148
|
-
|
|
3149
|
-
|
|
3150
|
-
|
|
3151
|
-
|
|
3152
|
-
|
|
3153
|
-
|
|
3154
|
-
|
|
3155
|
-
|
|
3156
|
-
|
|
3209
|
+
Me as LoggerAPI,
|
|
3210
|
+
Zt as MissingCapabilityError,
|
|
3211
|
+
qe as NuclearAPI,
|
|
3212
|
+
Et as NuclearPluginAPI,
|
|
3213
|
+
$t as PLAYLIST_EXPORT_VERSION,
|
|
3214
|
+
Le as PlaybackAPI,
|
|
3215
|
+
ze as PlaylistsAPI,
|
|
3216
|
+
Be as ShellAPI,
|
|
3217
|
+
We as YtdlpAPI,
|
|
3218
|
+
Lt as legacyConfigSchema,
|
|
3219
|
+
Ot as legacyPlaylistSchema,
|
|
3220
|
+
Nt as legacyTrackSchema,
|
|
3221
|
+
jt as pickArtwork,
|
|
3222
|
+
Mt as playlistExportSchema,
|
|
3223
|
+
It as playlistIndexEntrySchema,
|
|
3224
|
+
Vt as playlistIndexSchema,
|
|
3225
|
+
Ct as playlistSchema,
|
|
3226
|
+
Pt as useSetting
|
|
3157
3227
|
};
|