@authhero/cloudflare-adapter 0.3.0 → 0.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.
|
@@ -1,53 +1,72 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
var ot = Object.defineProperty;
|
|
2
|
+
var dt = (r, e, t) => e in r ? ot(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t;
|
|
3
|
+
var De = (r, e, t) => dt(r, typeof e != "symbol" ? e + "" : e, t);
|
|
4
|
+
import ct from "wretch";
|
|
5
|
+
var be = class extends Error {
|
|
6
|
+
constructor(e = 500, t) {
|
|
7
|
+
super(t == null ? void 0 : t.message, { cause: t == null ? void 0 : t.cause });
|
|
8
|
+
De(this, "res");
|
|
9
|
+
De(this, "status");
|
|
10
|
+
this.res = t == null ? void 0 : t.res, this.status = e;
|
|
11
|
+
}
|
|
12
|
+
getResponse() {
|
|
13
|
+
return this.res ? new Response(this.res.body, {
|
|
14
|
+
status: this.status,
|
|
15
|
+
headers: this.res.headers
|
|
16
|
+
}) : new Response(this.message, {
|
|
17
|
+
status: this.status
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
const ut = (r, e) => e.skipDedupe || e.method !== "GET", lt = (r, e) => e.method + "@" + r, ft = (r) => r.clone(), ht = ({ skip: r = ut, key: e = lt, resolver: t = ft } = {}) => {
|
|
3
22
|
const n = /* @__PURE__ */ new Map();
|
|
4
|
-
return (s) => (a,
|
|
5
|
-
if (r(a,
|
|
6
|
-
return s(a,
|
|
7
|
-
const
|
|
8
|
-
if (!n.has(
|
|
9
|
-
n.set(
|
|
23
|
+
return (s) => (a, i) => {
|
|
24
|
+
if (r(a, i))
|
|
25
|
+
return s(a, i);
|
|
26
|
+
const o = e(a, i);
|
|
27
|
+
if (!n.has(o))
|
|
28
|
+
n.set(o, []);
|
|
10
29
|
else
|
|
11
30
|
return new Promise((u, d) => {
|
|
12
|
-
n.get(
|
|
31
|
+
n.get(o).push([u, d]);
|
|
13
32
|
});
|
|
14
33
|
try {
|
|
15
|
-
return s(a,
|
|
16
|
-
throw n.get(
|
|
34
|
+
return s(a, i).then((u) => (n.get(o).forEach(([d]) => d(t(u))), n.delete(o), u)).catch((u) => {
|
|
35
|
+
throw n.get(o).forEach(([, d]) => d(u)), n.delete(o), u;
|
|
17
36
|
});
|
|
18
37
|
} catch (u) {
|
|
19
|
-
return n.delete(
|
|
38
|
+
return n.delete(o), Promise.reject(u);
|
|
20
39
|
}
|
|
21
40
|
};
|
|
22
|
-
},
|
|
41
|
+
}, pt = (r, e) => r * e, mt = (r) => r && r.ok, _t = ({ delayTimer: r = 500, delayRamp: e = pt, maxAttempts: t = 10, until: n = mt, onRetry: s = null, retryOnNetworkError: a = !1, resolveWithLatestResponse: i = !1, skip: o } = {}) => (u) => (d, p) => {
|
|
23
42
|
let k = 0;
|
|
24
|
-
if (
|
|
25
|
-
return u(d,
|
|
26
|
-
const O = (w, P) => Promise.resolve(n(w, P)).then((
|
|
27
|
-
const
|
|
43
|
+
if (o && o(d, p))
|
|
44
|
+
return u(d, p);
|
|
45
|
+
const O = (w, P) => Promise.resolve(n(w, P)).then((Ne) => Ne ? w && i ? w : P ? Promise.reject(P) : w : (k++, !t || k <= t ? new Promise(($) => {
|
|
46
|
+
const xe = e(r, k);
|
|
28
47
|
setTimeout(() => {
|
|
29
48
|
typeof s == "function" ? Promise.resolve(s({
|
|
30
49
|
response: w,
|
|
31
50
|
error: P,
|
|
32
51
|
url: d,
|
|
33
|
-
options:
|
|
52
|
+
options: p
|
|
34
53
|
})).then((B = {}) => {
|
|
35
54
|
var F, ee;
|
|
36
|
-
$(u((F = B && B.url) !== null && F !== void 0 ? F : d, (ee = B && B.options) !== null && ee !== void 0 ? ee :
|
|
37
|
-
}) : $(u(d,
|
|
38
|
-
},
|
|
55
|
+
$(u((F = B && B.url) !== null && F !== void 0 ? F : d, (ee = B && B.options) !== null && ee !== void 0 ? ee : p));
|
|
56
|
+
}) : $(u(d, p));
|
|
57
|
+
}, xe);
|
|
39
58
|
}).then(O).catch(($) => {
|
|
40
59
|
if (!a)
|
|
41
60
|
throw $;
|
|
42
61
|
return O(null, $);
|
|
43
|
-
}) : w &&
|
|
44
|
-
return u(d,
|
|
62
|
+
}) : w && i ? w : Promise.reject(P || new Error("Number of attempts exceeded."))));
|
|
63
|
+
return u(d, p).then(O).catch((w) => {
|
|
45
64
|
if (!a)
|
|
46
65
|
throw w;
|
|
47
66
|
return O(null, w);
|
|
48
67
|
});
|
|
49
68
|
};
|
|
50
|
-
function
|
|
69
|
+
function yt(r, e) {
|
|
51
70
|
var t = {};
|
|
52
71
|
for (var n in r) Object.prototype.hasOwnProperty.call(r, n) && e.indexOf(n) < 0 && (t[n] = r[n]);
|
|
53
72
|
if (r != null && typeof Object.getOwnPropertySymbols == "function")
|
|
@@ -55,7 +74,7 @@ function ct(r, e) {
|
|
|
55
74
|
e.indexOf(n[s]) < 0 && Object.prototype.propertyIsEnumerable.call(r, n[s]) && (t[n[s]] = r[n[s]]);
|
|
56
75
|
return t;
|
|
57
76
|
}
|
|
58
|
-
function
|
|
77
|
+
function vt(r, e) {
|
|
59
78
|
var t;
|
|
60
79
|
return ((t = r == null ? void 0 : r._def) === null || t === void 0 ? void 0 : t.typeName) === e;
|
|
61
80
|
}
|
|
@@ -66,35 +85,35 @@ function te(r, e) {
|
|
|
66
85
|
return s._def.openapi = this._def.openapi, s;
|
|
67
86
|
};
|
|
68
87
|
}
|
|
69
|
-
function
|
|
88
|
+
function gt(r) {
|
|
70
89
|
if (typeof r.ZodType.prototype.openapi < "u")
|
|
71
90
|
return;
|
|
72
91
|
r.ZodType.prototype.openapi = function(s, a) {
|
|
73
|
-
var
|
|
74
|
-
const O = typeof s == "string" ? a : s, w = O ?? {}, { param: P } = w,
|
|
75
|
-
param: Object.assign(Object.assign({}, (k = (
|
|
76
|
-
} : void 0), B = new this.constructor(Object.assign(Object.assign({}, this._def), { openapi: Object.assign(Object.assign({}, Object.keys($).length > 0 ? { _internal: $ } : void 0), Object.keys(
|
|
77
|
-
if (
|
|
92
|
+
var i, o, u, d, p, k;
|
|
93
|
+
const O = typeof s == "string" ? a : s, w = O ?? {}, { param: P } = w, Ne = yt(w, ["param"]), $ = Object.assign(Object.assign({}, (i = this._def.openapi) === null || i === void 0 ? void 0 : i._internal), typeof s == "string" ? { refId: s } : void 0), xe = Object.assign(Object.assign(Object.assign({}, (o = this._def.openapi) === null || o === void 0 ? void 0 : o.metadata), Ne), !((d = (u = this._def.openapi) === null || u === void 0 ? void 0 : u.metadata) === null || d === void 0) && d.param || P ? {
|
|
94
|
+
param: Object.assign(Object.assign({}, (k = (p = this._def.openapi) === null || p === void 0 ? void 0 : p.metadata) === null || k === void 0 ? void 0 : k.param), P)
|
|
95
|
+
} : void 0), B = new this.constructor(Object.assign(Object.assign({}, this._def), { openapi: Object.assign(Object.assign({}, Object.keys($).length > 0 ? { _internal: $ } : void 0), Object.keys(xe).length > 0 ? { metadata: xe } : void 0) }));
|
|
96
|
+
if (vt(this, "ZodObject")) {
|
|
78
97
|
const F = this.extend;
|
|
79
98
|
B.extend = function(...ee) {
|
|
80
|
-
var
|
|
81
|
-
const
|
|
82
|
-
return
|
|
99
|
+
var Re, Ie, Ae, Me, Pe, $e;
|
|
100
|
+
const Ve = F.apply(this, ee);
|
|
101
|
+
return Ve._def.openapi = {
|
|
83
102
|
_internal: {
|
|
84
|
-
extendedFrom: !((
|
|
103
|
+
extendedFrom: !((Ie = (Re = this._def.openapi) === null || Re === void 0 ? void 0 : Re._internal) === null || Ie === void 0) && Ie.refId ? { refId: (Me = (Ae = this._def.openapi) === null || Ae === void 0 ? void 0 : Ae._internal) === null || Me === void 0 ? void 0 : Me.refId, schema: this } : (Pe = this._def.openapi) === null || Pe === void 0 ? void 0 : Pe._internal.extendedFrom
|
|
85
104
|
},
|
|
86
|
-
metadata: (
|
|
87
|
-
},
|
|
105
|
+
metadata: ($e = Ve._def.openapi) === null || $e === void 0 ? void 0 : $e.metadata
|
|
106
|
+
}, Ve;
|
|
88
107
|
};
|
|
89
108
|
}
|
|
90
109
|
return B;
|
|
91
110
|
}, te(r, "optional"), te(r, "nullable"), te(r, "default"), te(r, "transform"), te(r, "refine");
|
|
92
111
|
const e = r.ZodObject.prototype.deepPartial;
|
|
93
112
|
r.ZodObject.prototype.deepPartial = function() {
|
|
94
|
-
const s = this._def.shape(), a = e.apply(this),
|
|
95
|
-
return Object.entries(
|
|
96
|
-
var d,
|
|
97
|
-
u._def.openapi = (
|
|
113
|
+
const s = this._def.shape(), a = e.apply(this), i = a._def.shape();
|
|
114
|
+
return Object.entries(i).forEach(([o, u]) => {
|
|
115
|
+
var d, p;
|
|
116
|
+
u._def.openapi = (p = (d = s[o]) === null || d === void 0 ? void 0 : d._def) === null || p === void 0 ? void 0 : p.openapi;
|
|
98
117
|
}), a._def.openapi = void 0, a;
|
|
99
118
|
};
|
|
100
119
|
const t = r.ZodObject.prototype.pick;
|
|
@@ -120,39 +139,39 @@ var x;
|
|
|
120
139
|
}
|
|
121
140
|
r.assertNever = t, r.arrayToEnum = (s) => {
|
|
122
141
|
const a = {};
|
|
123
|
-
for (const
|
|
124
|
-
a[
|
|
142
|
+
for (const i of s)
|
|
143
|
+
a[i] = i;
|
|
125
144
|
return a;
|
|
126
145
|
}, r.getValidEnumValues = (s) => {
|
|
127
|
-
const a = r.objectKeys(s).filter((
|
|
128
|
-
for (const
|
|
129
|
-
o
|
|
130
|
-
return r.objectValues(
|
|
146
|
+
const a = r.objectKeys(s).filter((o) => typeof s[s[o]] != "number"), i = {};
|
|
147
|
+
for (const o of a)
|
|
148
|
+
i[o] = s[o];
|
|
149
|
+
return r.objectValues(i);
|
|
131
150
|
}, r.objectValues = (s) => r.objectKeys(s).map(function(a) {
|
|
132
151
|
return s[a];
|
|
133
152
|
}), r.objectKeys = typeof Object.keys == "function" ? (s) => Object.keys(s) : (s) => {
|
|
134
153
|
const a = [];
|
|
135
|
-
for (const
|
|
136
|
-
Object.prototype.hasOwnProperty.call(s,
|
|
154
|
+
for (const i in s)
|
|
155
|
+
Object.prototype.hasOwnProperty.call(s, i) && a.push(i);
|
|
137
156
|
return a;
|
|
138
157
|
}, r.find = (s, a) => {
|
|
139
|
-
for (const
|
|
140
|
-
if (a(
|
|
141
|
-
return
|
|
158
|
+
for (const i of s)
|
|
159
|
+
if (a(i))
|
|
160
|
+
return i;
|
|
142
161
|
}, r.isInteger = typeof Number.isInteger == "function" ? (s) => Number.isInteger(s) : (s) => typeof s == "number" && isFinite(s) && Math.floor(s) === s;
|
|
143
162
|
function n(s, a = " | ") {
|
|
144
|
-
return s.map((
|
|
163
|
+
return s.map((i) => typeof i == "string" ? `'${i}'` : i).join(a);
|
|
145
164
|
}
|
|
146
165
|
r.joinValues = n, r.jsonStringifyReplacer = (s, a) => typeof a == "bigint" ? a.toString() : a;
|
|
147
166
|
})(x || (x = {}));
|
|
148
|
-
var
|
|
167
|
+
var Be;
|
|
149
168
|
(function(r) {
|
|
150
169
|
r.mergeShapes = (e, t) => ({
|
|
151
170
|
...e,
|
|
152
171
|
...t
|
|
153
172
|
// second overwrites first
|
|
154
173
|
});
|
|
155
|
-
})(
|
|
174
|
+
})(Be || (Be = {}));
|
|
156
175
|
const f = x.arrayToEnum([
|
|
157
176
|
"string",
|
|
158
177
|
"nan",
|
|
@@ -212,7 +231,7 @@ const f = x.arrayToEnum([
|
|
|
212
231
|
"invalid_intersection_types",
|
|
213
232
|
"not_multiple_of",
|
|
214
233
|
"not_finite"
|
|
215
|
-
]),
|
|
234
|
+
]), xt = (r) => JSON.stringify(r, null, 2).replace(/"([^"]+)":/g, "$1:");
|
|
216
235
|
class S extends Error {
|
|
217
236
|
constructor(e) {
|
|
218
237
|
super(), this.issues = [], this.addIssue = (n) => {
|
|
@@ -230,20 +249,20 @@ class S extends Error {
|
|
|
230
249
|
const t = e || function(a) {
|
|
231
250
|
return a.message;
|
|
232
251
|
}, n = { _errors: [] }, s = (a) => {
|
|
233
|
-
for (const
|
|
234
|
-
if (
|
|
235
|
-
|
|
236
|
-
else if (
|
|
237
|
-
s(
|
|
238
|
-
else if (
|
|
239
|
-
s(
|
|
240
|
-
else if (
|
|
241
|
-
n._errors.push(t(
|
|
252
|
+
for (const i of a.issues)
|
|
253
|
+
if (i.code === "invalid_union")
|
|
254
|
+
i.unionErrors.map(s);
|
|
255
|
+
else if (i.code === "invalid_return_type")
|
|
256
|
+
s(i.returnTypeError);
|
|
257
|
+
else if (i.code === "invalid_arguments")
|
|
258
|
+
s(i.argumentsError);
|
|
259
|
+
else if (i.path.length === 0)
|
|
260
|
+
n._errors.push(t(i));
|
|
242
261
|
else {
|
|
243
|
-
let
|
|
244
|
-
for (; u <
|
|
245
|
-
const d =
|
|
246
|
-
u ===
|
|
262
|
+
let o = n, u = 0;
|
|
263
|
+
for (; u < i.path.length; ) {
|
|
264
|
+
const d = i.path[u];
|
|
265
|
+
u === i.path.length - 1 ? (o[d] = o[d] || { _errors: [] }, o[d]._errors.push(t(i))) : o[d] = o[d] || { _errors: [] }, o = o[d], u++;
|
|
247
266
|
}
|
|
248
267
|
}
|
|
249
268
|
};
|
|
@@ -329,15 +348,15 @@ const X = (r, e) => {
|
|
|
329
348
|
}
|
|
330
349
|
return { message: t };
|
|
331
350
|
};
|
|
332
|
-
let
|
|
333
|
-
function
|
|
334
|
-
|
|
351
|
+
let Xe = X;
|
|
352
|
+
function bt(r) {
|
|
353
|
+
Xe = r;
|
|
335
354
|
}
|
|
336
|
-
function
|
|
337
|
-
return
|
|
355
|
+
function ke() {
|
|
356
|
+
return Xe;
|
|
338
357
|
}
|
|
339
|
-
const
|
|
340
|
-
const { data: e, path: t, errorMaps: n, issueData: s } = r, a = [...t, ...s.path || []],
|
|
358
|
+
const we = (r) => {
|
|
359
|
+
const { data: e, path: t, errorMaps: n, issueData: s } = r, a = [...t, ...s.path || []], i = {
|
|
341
360
|
...s,
|
|
342
361
|
path: a
|
|
343
362
|
};
|
|
@@ -347,18 +366,18 @@ const be = (r) => {
|
|
|
347
366
|
path: a,
|
|
348
367
|
message: s.message
|
|
349
368
|
};
|
|
350
|
-
let
|
|
369
|
+
let o = "";
|
|
351
370
|
const u = n.filter((d) => !!d).slice().reverse();
|
|
352
371
|
for (const d of u)
|
|
353
|
-
|
|
372
|
+
o = d(i, { data: e, defaultError: o }).message;
|
|
354
373
|
return {
|
|
355
374
|
...s,
|
|
356
375
|
path: a,
|
|
357
|
-
message:
|
|
376
|
+
message: o
|
|
358
377
|
};
|
|
359
|
-
},
|
|
378
|
+
}, kt = [];
|
|
360
379
|
function l(r, e) {
|
|
361
|
-
const t =
|
|
380
|
+
const t = ke(), n = we({
|
|
362
381
|
issueData: e,
|
|
363
382
|
data: r.data,
|
|
364
383
|
path: r.path,
|
|
@@ -394,10 +413,10 @@ class T {
|
|
|
394
413
|
static async mergeObjectAsync(e, t) {
|
|
395
414
|
const n = [];
|
|
396
415
|
for (const s of t) {
|
|
397
|
-
const a = await s.key,
|
|
416
|
+
const a = await s.key, i = await s.value;
|
|
398
417
|
n.push({
|
|
399
418
|
key: a,
|
|
400
|
-
value:
|
|
419
|
+
value: i
|
|
401
420
|
});
|
|
402
421
|
}
|
|
403
422
|
return T.mergeObjectSync(e, n);
|
|
@@ -405,22 +424,22 @@ class T {
|
|
|
405
424
|
static mergeObjectSync(e, t) {
|
|
406
425
|
const n = {};
|
|
407
426
|
for (const s of t) {
|
|
408
|
-
const { key: a, value:
|
|
409
|
-
if (a.status === "aborted" ||
|
|
427
|
+
const { key: a, value: i } = s;
|
|
428
|
+
if (a.status === "aborted" || i.status === "aborted")
|
|
410
429
|
return y;
|
|
411
|
-
a.status === "dirty" && e.dirty(),
|
|
430
|
+
a.status === "dirty" && e.dirty(), i.status === "dirty" && e.dirty(), a.value !== "__proto__" && (typeof i.value < "u" || s.alwaysSet) && (n[a.value] = i.value);
|
|
412
431
|
}
|
|
413
432
|
return { status: e.value, value: n };
|
|
414
433
|
}
|
|
415
434
|
}
|
|
416
435
|
const y = Object.freeze({
|
|
417
436
|
status: "aborted"
|
|
418
|
-
}),
|
|
419
|
-
function
|
|
437
|
+
}), Y = (r) => ({ status: "dirty", value: r }), Z = (r) => ({ status: "valid", value: r }), We = (r) => r.status === "aborted", qe = (r) => r.status === "dirty", ae = (r) => r.status === "valid", ie = (r) => typeof Promise < "u" && r instanceof Promise;
|
|
438
|
+
function Te(r, e, t, n) {
|
|
420
439
|
if (typeof e == "function" ? r !== e || !n : !e.has(r)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
421
440
|
return e.get(r);
|
|
422
441
|
}
|
|
423
|
-
function
|
|
442
|
+
function Ke(r, e, t, n, s) {
|
|
424
443
|
if (typeof e == "function" ? r !== e || !s : !e.has(r)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
425
444
|
return e.set(r, t), t;
|
|
426
445
|
}
|
|
@@ -428,7 +447,7 @@ var m;
|
|
|
428
447
|
(function(r) {
|
|
429
448
|
r.errToObj = (e) => typeof e == "string" ? { message: e } : e || {}, r.toString = (e) => typeof e == "string" ? e : e == null ? void 0 : e.message;
|
|
430
449
|
})(m || (m = {}));
|
|
431
|
-
var
|
|
450
|
+
var ne, se;
|
|
432
451
|
class R {
|
|
433
452
|
constructor(e, t, n, s) {
|
|
434
453
|
this._cachedPath = [], this.parent = e, this.data = t, this._path = n, this._key = s;
|
|
@@ -437,8 +456,8 @@ class R {
|
|
|
437
456
|
return this._cachedPath.length || (this._key instanceof Array ? this._cachedPath.push(...this._path, ...this._key) : this._cachedPath.push(...this._path, this._key)), this._cachedPath;
|
|
438
457
|
}
|
|
439
458
|
}
|
|
440
|
-
const
|
|
441
|
-
if (
|
|
459
|
+
const Ye = (r, e) => {
|
|
460
|
+
if (ae(e))
|
|
442
461
|
return { success: !0, data: e.value };
|
|
443
462
|
if (!r.common.issues.length)
|
|
444
463
|
throw new Error("Validation failed but no issues detected.");
|
|
@@ -458,10 +477,10 @@ function v(r) {
|
|
|
458
477
|
const { errorMap: e, invalid_type_error: t, required_error: n, description: s } = r;
|
|
459
478
|
if (e && (t || n))
|
|
460
479
|
throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);
|
|
461
|
-
return e ? { errorMap: e, description: s } : { errorMap: (
|
|
480
|
+
return e ? { errorMap: e, description: s } : { errorMap: (i, o) => {
|
|
462
481
|
var u, d;
|
|
463
|
-
const { message:
|
|
464
|
-
return
|
|
482
|
+
const { message: p } = r;
|
|
483
|
+
return i.code === "invalid_enum_value" ? { message: p ?? o.defaultError } : typeof o.data > "u" ? { message: (u = p ?? n) !== null && u !== void 0 ? u : o.defaultError } : i.code !== "invalid_type" ? { message: o.defaultError } : { message: (d = p ?? t) !== null && d !== void 0 ? d : o.defaultError };
|
|
465
484
|
}, description: s };
|
|
466
485
|
}
|
|
467
486
|
class g {
|
|
@@ -499,7 +518,7 @@ class g {
|
|
|
499
518
|
}
|
|
500
519
|
_parseSync(e) {
|
|
501
520
|
const t = this._parse(e);
|
|
502
|
-
if (
|
|
521
|
+
if (ie(t))
|
|
503
522
|
throw new Error("Synchronous parse encountered promise.");
|
|
504
523
|
return t;
|
|
505
524
|
}
|
|
@@ -527,7 +546,7 @@ class g {
|
|
|
527
546
|
data: e,
|
|
528
547
|
parsedType: V(e)
|
|
529
548
|
}, a = this._parseSync({ data: e, path: s.path, parent: s });
|
|
530
|
-
return
|
|
549
|
+
return Ye(s, a);
|
|
531
550
|
}
|
|
532
551
|
async parseAsync(e, t) {
|
|
533
552
|
const n = await this.safeParseAsync(e, t);
|
|
@@ -547,17 +566,17 @@ class g {
|
|
|
547
566
|
parent: null,
|
|
548
567
|
data: e,
|
|
549
568
|
parsedType: V(e)
|
|
550
|
-
}, s = this._parse({ data: e, path: n.path, parent: n }), a = await (
|
|
551
|
-
return
|
|
569
|
+
}, s = this._parse({ data: e, path: n.path, parent: n }), a = await (ie(s) ? s : Promise.resolve(s));
|
|
570
|
+
return Ye(n, a);
|
|
552
571
|
}
|
|
553
572
|
refine(e, t) {
|
|
554
573
|
const n = (s) => typeof t == "string" || typeof t > "u" ? { message: t } : typeof t == "function" ? t(s) : t;
|
|
555
574
|
return this._refinement((s, a) => {
|
|
556
|
-
const
|
|
575
|
+
const i = e(s), o = () => a.addIssue({
|
|
557
576
|
code: c.custom,
|
|
558
577
|
...n(s)
|
|
559
578
|
});
|
|
560
|
-
return typeof Promise < "u" &&
|
|
579
|
+
return typeof Promise < "u" && i instanceof Promise ? i.then((u) => u ? !0 : (o(), !1)) : i ? !0 : (o(), !1);
|
|
561
580
|
});
|
|
562
581
|
}
|
|
563
582
|
refinement(e, t) {
|
|
@@ -583,16 +602,16 @@ class g {
|
|
|
583
602
|
return this.nullable().optional();
|
|
584
603
|
}
|
|
585
604
|
array() {
|
|
586
|
-
return
|
|
605
|
+
return E.create(this, this._def);
|
|
587
606
|
}
|
|
588
607
|
promise() {
|
|
589
608
|
return Q.create(this, this._def);
|
|
590
609
|
}
|
|
591
610
|
or(e) {
|
|
592
|
-
return
|
|
611
|
+
return ue.create([this, e], this._def);
|
|
593
612
|
}
|
|
594
613
|
and(e) {
|
|
595
|
-
return
|
|
614
|
+
return le.create(this, e, this._def);
|
|
596
615
|
}
|
|
597
616
|
transform(e) {
|
|
598
617
|
return new C({
|
|
@@ -604,7 +623,7 @@ class g {
|
|
|
604
623
|
}
|
|
605
624
|
default(e) {
|
|
606
625
|
const t = typeof e == "function" ? e : () => e;
|
|
607
|
-
return new
|
|
626
|
+
return new _e({
|
|
608
627
|
...v(this._def),
|
|
609
628
|
innerType: this,
|
|
610
629
|
defaultValue: t,
|
|
@@ -612,7 +631,7 @@ class g {
|
|
|
612
631
|
});
|
|
613
632
|
}
|
|
614
633
|
brand() {
|
|
615
|
-
return new
|
|
634
|
+
return new He({
|
|
616
635
|
typeName: _.ZodBranded,
|
|
617
636
|
type: this,
|
|
618
637
|
...v(this._def)
|
|
@@ -620,7 +639,7 @@ class g {
|
|
|
620
639
|
}
|
|
621
640
|
catch(e) {
|
|
622
641
|
const t = typeof e == "function" ? e : () => e;
|
|
623
|
-
return new
|
|
642
|
+
return new ye({
|
|
624
643
|
...v(this._def),
|
|
625
644
|
innerType: this,
|
|
626
645
|
catchValue: t,
|
|
@@ -635,10 +654,10 @@ class g {
|
|
|
635
654
|
});
|
|
636
655
|
}
|
|
637
656
|
pipe(e) {
|
|
638
|
-
return
|
|
657
|
+
return ge.create(this, e);
|
|
639
658
|
}
|
|
640
659
|
readonly() {
|
|
641
|
-
return
|
|
660
|
+
return ve.create(this);
|
|
642
661
|
}
|
|
643
662
|
isOptional() {
|
|
644
663
|
return this.safeParse(void 0).success;
|
|
@@ -647,25 +666,25 @@ class g {
|
|
|
647
666
|
return this.safeParse(null).success;
|
|
648
667
|
}
|
|
649
668
|
}
|
|
650
|
-
const
|
|
651
|
-
let
|
|
652
|
-
const
|
|
653
|
-
function
|
|
669
|
+
const wt = /^c[^\s-]{8,}$/i, Tt = /^[0-9a-z]+$/, Zt = /^[0-9A-HJKMNP-TV-Z]{26}$/, St = /^[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, Ot = /^[a-z0-9_-]{21}$/i, jt = /^[-+]?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)?)??$/, Et = /^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i, Ct = "^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";
|
|
670
|
+
let Le;
|
|
671
|
+
const Nt = /^(?:(?: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])$/, Rt = /^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/, It = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/, Qe = "((\\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])))", At = new RegExp(`^${Qe}$`);
|
|
672
|
+
function Fe(r) {
|
|
654
673
|
let e = "([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";
|
|
655
674
|
return r.precision ? e = `${e}\\.\\d{${r.precision}}` : r.precision == null && (e = `${e}(\\.\\d+)?`), e;
|
|
656
675
|
}
|
|
657
|
-
function
|
|
658
|
-
return new RegExp(`^${
|
|
676
|
+
function Mt(r) {
|
|
677
|
+
return new RegExp(`^${Fe(r)}$`);
|
|
659
678
|
}
|
|
660
|
-
function
|
|
661
|
-
let e = `${
|
|
679
|
+
function et(r) {
|
|
680
|
+
let e = `${Qe}T${Fe(r)}`;
|
|
662
681
|
const t = [];
|
|
663
682
|
return t.push(r.local ? "Z?" : "Z"), r.offset && t.push("([+-]\\d{2}:?\\d{2})"), e = `${e}(${t.join("|")})`, new RegExp(`^${e}$`);
|
|
664
683
|
}
|
|
665
|
-
function
|
|
666
|
-
return !!((e === "v4" || !e) &&
|
|
684
|
+
function Pt(r, e) {
|
|
685
|
+
return !!((e === "v4" || !e) && Nt.test(r) || (e === "v6" || !e) && Rt.test(r));
|
|
667
686
|
}
|
|
668
|
-
class
|
|
687
|
+
class j extends g {
|
|
669
688
|
_parse(e) {
|
|
670
689
|
if (this._def.coerce && (e.data = String(e.data)), this._getType(e) !== f.string) {
|
|
671
690
|
const a = this._getOrReturnCtx(e);
|
|
@@ -697,15 +716,15 @@ class E extends g {
|
|
|
697
716
|
message: a.message
|
|
698
717
|
}), n.dirty());
|
|
699
718
|
else if (a.kind === "length") {
|
|
700
|
-
const
|
|
701
|
-
(
|
|
719
|
+
const i = e.data.length > a.value, o = e.data.length < a.value;
|
|
720
|
+
(i || o) && (s = this._getOrReturnCtx(e, s), i ? l(s, {
|
|
702
721
|
code: c.too_big,
|
|
703
722
|
maximum: a.value,
|
|
704
723
|
type: "string",
|
|
705
724
|
inclusive: !0,
|
|
706
725
|
exact: !0,
|
|
707
726
|
message: a.message
|
|
708
|
-
}) :
|
|
727
|
+
}) : o && l(s, {
|
|
709
728
|
code: c.too_small,
|
|
710
729
|
minimum: a.value,
|
|
711
730
|
type: "string",
|
|
@@ -714,43 +733,43 @@ class E extends g {
|
|
|
714
733
|
message: a.message
|
|
715
734
|
}), n.dirty());
|
|
716
735
|
} else if (a.kind === "email")
|
|
717
|
-
|
|
736
|
+
Et.test(e.data) || (s = this._getOrReturnCtx(e, s), l(s, {
|
|
718
737
|
validation: "email",
|
|
719
738
|
code: c.invalid_string,
|
|
720
739
|
message: a.message
|
|
721
740
|
}), n.dirty());
|
|
722
741
|
else if (a.kind === "emoji")
|
|
723
|
-
|
|
742
|
+
Le || (Le = new RegExp(Ct, "u")), Le.test(e.data) || (s = this._getOrReturnCtx(e, s), l(s, {
|
|
724
743
|
validation: "emoji",
|
|
725
744
|
code: c.invalid_string,
|
|
726
745
|
message: a.message
|
|
727
746
|
}), n.dirty());
|
|
728
747
|
else if (a.kind === "uuid")
|
|
729
|
-
|
|
748
|
+
St.test(e.data) || (s = this._getOrReturnCtx(e, s), l(s, {
|
|
730
749
|
validation: "uuid",
|
|
731
750
|
code: c.invalid_string,
|
|
732
751
|
message: a.message
|
|
733
752
|
}), n.dirty());
|
|
734
753
|
else if (a.kind === "nanoid")
|
|
735
|
-
|
|
754
|
+
Ot.test(e.data) || (s = this._getOrReturnCtx(e, s), l(s, {
|
|
736
755
|
validation: "nanoid",
|
|
737
756
|
code: c.invalid_string,
|
|
738
757
|
message: a.message
|
|
739
758
|
}), n.dirty());
|
|
740
759
|
else if (a.kind === "cuid")
|
|
741
|
-
|
|
760
|
+
wt.test(e.data) || (s = this._getOrReturnCtx(e, s), l(s, {
|
|
742
761
|
validation: "cuid",
|
|
743
762
|
code: c.invalid_string,
|
|
744
763
|
message: a.message
|
|
745
764
|
}), n.dirty());
|
|
746
765
|
else if (a.kind === "cuid2")
|
|
747
|
-
|
|
766
|
+
Tt.test(e.data) || (s = this._getOrReturnCtx(e, s), l(s, {
|
|
748
767
|
validation: "cuid2",
|
|
749
768
|
code: c.invalid_string,
|
|
750
769
|
message: a.message
|
|
751
770
|
}), n.dirty());
|
|
752
771
|
else if (a.kind === "ulid")
|
|
753
|
-
|
|
772
|
+
Zt.test(e.data) || (s = this._getOrReturnCtx(e, s), l(s, {
|
|
754
773
|
validation: "ulid",
|
|
755
774
|
code: c.invalid_string,
|
|
756
775
|
message: a.message
|
|
@@ -781,27 +800,27 @@ class E extends g {
|
|
|
781
800
|
code: c.invalid_string,
|
|
782
801
|
validation: { endsWith: a.value },
|
|
783
802
|
message: a.message
|
|
784
|
-
}), n.dirty()) : a.kind === "datetime" ?
|
|
803
|
+
}), n.dirty()) : a.kind === "datetime" ? et(a).test(e.data) || (s = this._getOrReturnCtx(e, s), l(s, {
|
|
785
804
|
code: c.invalid_string,
|
|
786
805
|
validation: "datetime",
|
|
787
806
|
message: a.message
|
|
788
|
-
}), n.dirty()) : a.kind === "date" ?
|
|
807
|
+
}), n.dirty()) : a.kind === "date" ? At.test(e.data) || (s = this._getOrReturnCtx(e, s), l(s, {
|
|
789
808
|
code: c.invalid_string,
|
|
790
809
|
validation: "date",
|
|
791
810
|
message: a.message
|
|
792
|
-
}), n.dirty()) : a.kind === "time" ?
|
|
811
|
+
}), n.dirty()) : a.kind === "time" ? Mt(a).test(e.data) || (s = this._getOrReturnCtx(e, s), l(s, {
|
|
793
812
|
code: c.invalid_string,
|
|
794
813
|
validation: "time",
|
|
795
814
|
message: a.message
|
|
796
|
-
}), n.dirty()) : a.kind === "duration" ?
|
|
815
|
+
}), n.dirty()) : a.kind === "duration" ? jt.test(e.data) || (s = this._getOrReturnCtx(e, s), l(s, {
|
|
797
816
|
validation: "duration",
|
|
798
817
|
code: c.invalid_string,
|
|
799
818
|
message: a.message
|
|
800
|
-
}), n.dirty()) : a.kind === "ip" ?
|
|
819
|
+
}), n.dirty()) : a.kind === "ip" ? Pt(e.data, a.version) || (s = this._getOrReturnCtx(e, s), l(s, {
|
|
801
820
|
validation: "ip",
|
|
802
821
|
code: c.invalid_string,
|
|
803
822
|
message: a.message
|
|
804
|
-
}), n.dirty()) : a.kind === "base64" ?
|
|
823
|
+
}), n.dirty()) : a.kind === "base64" ? It.test(e.data) || (s = this._getOrReturnCtx(e, s), l(s, {
|
|
805
824
|
validation: "base64",
|
|
806
825
|
code: c.invalid_string,
|
|
807
826
|
message: a.message
|
|
@@ -816,7 +835,7 @@ class E extends g {
|
|
|
816
835
|
});
|
|
817
836
|
}
|
|
818
837
|
_addCheck(e) {
|
|
819
|
-
return new
|
|
838
|
+
return new j({
|
|
820
839
|
...this._def,
|
|
821
840
|
checks: [...this._def.checks, e]
|
|
822
841
|
});
|
|
@@ -942,19 +961,19 @@ class E extends g {
|
|
|
942
961
|
return this.min(1, m.errToObj(e));
|
|
943
962
|
}
|
|
944
963
|
trim() {
|
|
945
|
-
return new
|
|
964
|
+
return new j({
|
|
946
965
|
...this._def,
|
|
947
966
|
checks: [...this._def.checks, { kind: "trim" }]
|
|
948
967
|
});
|
|
949
968
|
}
|
|
950
969
|
toLowerCase() {
|
|
951
|
-
return new
|
|
970
|
+
return new j({
|
|
952
971
|
...this._def,
|
|
953
972
|
checks: [...this._def.checks, { kind: "toLowerCase" }]
|
|
954
973
|
});
|
|
955
974
|
}
|
|
956
975
|
toUpperCase() {
|
|
957
|
-
return new
|
|
976
|
+
return new j({
|
|
958
977
|
...this._def,
|
|
959
978
|
checks: [...this._def.checks, { kind: "toUpperCase" }]
|
|
960
979
|
});
|
|
@@ -1014,18 +1033,18 @@ class E extends g {
|
|
|
1014
1033
|
return e;
|
|
1015
1034
|
}
|
|
1016
1035
|
}
|
|
1017
|
-
|
|
1036
|
+
j.create = (r) => {
|
|
1018
1037
|
var e;
|
|
1019
|
-
return new
|
|
1038
|
+
return new j({
|
|
1020
1039
|
checks: [],
|
|
1021
1040
|
typeName: _.ZodString,
|
|
1022
1041
|
coerce: (e = r == null ? void 0 : r.coerce) !== null && e !== void 0 ? e : !1,
|
|
1023
1042
|
...v(r)
|
|
1024
1043
|
});
|
|
1025
1044
|
};
|
|
1026
|
-
function
|
|
1027
|
-
const t = (r.toString().split(".")[1] || "").length, n = (e.toString().split(".")[1] || "").length, s = t > n ? t : n, a = parseInt(r.toFixed(s).replace(".", "")),
|
|
1028
|
-
return a %
|
|
1045
|
+
function $t(r, e) {
|
|
1046
|
+
const t = (r.toString().split(".")[1] || "").length, n = (e.toString().split(".")[1] || "").length, s = t > n ? t : n, a = parseInt(r.toFixed(s).replace(".", "")), i = parseInt(e.toFixed(s).replace(".", ""));
|
|
1047
|
+
return a % i / Math.pow(10, s);
|
|
1029
1048
|
}
|
|
1030
1049
|
class D extends g {
|
|
1031
1050
|
constructor() {
|
|
@@ -1062,7 +1081,7 @@ class D extends g {
|
|
|
1062
1081
|
inclusive: a.inclusive,
|
|
1063
1082
|
exact: !1,
|
|
1064
1083
|
message: a.message
|
|
1065
|
-
}), s.dirty()) : a.kind === "multipleOf" ?
|
|
1084
|
+
}), s.dirty()) : a.kind === "multipleOf" ? $t(e.data, a.value) !== 0 && (n = this._getOrReturnCtx(e, n), l(n, {
|
|
1066
1085
|
code: c.not_multiple_of,
|
|
1067
1086
|
multipleOf: a.value,
|
|
1068
1087
|
message: a.message
|
|
@@ -1327,7 +1346,7 @@ L.create = (r) => {
|
|
|
1327
1346
|
...v(r)
|
|
1328
1347
|
});
|
|
1329
1348
|
};
|
|
1330
|
-
class
|
|
1349
|
+
class oe extends g {
|
|
1331
1350
|
_parse(e) {
|
|
1332
1351
|
if (this._def.coerce && (e.data = !!e.data), this._getType(e) !== f.boolean) {
|
|
1333
1352
|
const n = this._getOrReturnCtx(e);
|
|
@@ -1340,7 +1359,7 @@ class ie extends g {
|
|
|
1340
1359
|
return Z(e.data);
|
|
1341
1360
|
}
|
|
1342
1361
|
}
|
|
1343
|
-
|
|
1362
|
+
oe.create = (r) => new oe({
|
|
1344
1363
|
typeName: _.ZodBoolean,
|
|
1345
1364
|
coerce: (r == null ? void 0 : r.coerce) || !1,
|
|
1346
1365
|
...v(r)
|
|
@@ -1423,7 +1442,7 @@ q.create = (r) => new q({
|
|
|
1423
1442
|
typeName: _.ZodDate,
|
|
1424
1443
|
...v(r)
|
|
1425
1444
|
});
|
|
1426
|
-
class
|
|
1445
|
+
class Ze extends g {
|
|
1427
1446
|
_parse(e) {
|
|
1428
1447
|
if (this._getType(e) !== f.symbol) {
|
|
1429
1448
|
const n = this._getOrReturnCtx(e);
|
|
@@ -1436,11 +1455,11 @@ class we extends g {
|
|
|
1436
1455
|
return Z(e.data);
|
|
1437
1456
|
}
|
|
1438
1457
|
}
|
|
1439
|
-
|
|
1458
|
+
Ze.create = (r) => new Ze({
|
|
1440
1459
|
typeName: _.ZodSymbol,
|
|
1441
1460
|
...v(r)
|
|
1442
1461
|
});
|
|
1443
|
-
class
|
|
1462
|
+
class de extends g {
|
|
1444
1463
|
_parse(e) {
|
|
1445
1464
|
if (this._getType(e) !== f.undefined) {
|
|
1446
1465
|
const n = this._getOrReturnCtx(e);
|
|
@@ -1453,11 +1472,11 @@ class oe extends g {
|
|
|
1453
1472
|
return Z(e.data);
|
|
1454
1473
|
}
|
|
1455
1474
|
}
|
|
1456
|
-
|
|
1475
|
+
de.create = (r) => new de({
|
|
1457
1476
|
typeName: _.ZodUndefined,
|
|
1458
1477
|
...v(r)
|
|
1459
1478
|
});
|
|
1460
|
-
class
|
|
1479
|
+
class ce extends g {
|
|
1461
1480
|
_parse(e) {
|
|
1462
1481
|
if (this._getType(e) !== f.null) {
|
|
1463
1482
|
const n = this._getOrReturnCtx(e);
|
|
@@ -1470,7 +1489,7 @@ class de extends g {
|
|
|
1470
1489
|
return Z(e.data);
|
|
1471
1490
|
}
|
|
1472
1491
|
}
|
|
1473
|
-
|
|
1492
|
+
ce.create = (r) => new ce({
|
|
1474
1493
|
typeName: _.ZodNull,
|
|
1475
1494
|
...v(r)
|
|
1476
1495
|
});
|
|
@@ -1512,7 +1531,7 @@ M.create = (r) => new M({
|
|
|
1512
1531
|
typeName: _.ZodNever,
|
|
1513
1532
|
...v(r)
|
|
1514
1533
|
});
|
|
1515
|
-
class
|
|
1534
|
+
class Se extends g {
|
|
1516
1535
|
_parse(e) {
|
|
1517
1536
|
if (this._getType(e) !== f.undefined) {
|
|
1518
1537
|
const n = this._getOrReturnCtx(e);
|
|
@@ -1525,11 +1544,11 @@ class Te extends g {
|
|
|
1525
1544
|
return Z(e.data);
|
|
1526
1545
|
}
|
|
1527
1546
|
}
|
|
1528
|
-
|
|
1547
|
+
Se.create = (r) => new Se({
|
|
1529
1548
|
typeName: _.ZodVoid,
|
|
1530
1549
|
...v(r)
|
|
1531
1550
|
});
|
|
1532
|
-
class
|
|
1551
|
+
class E extends g {
|
|
1533
1552
|
_parse(e) {
|
|
1534
1553
|
const { ctx: t, status: n } = this._processInputParams(e), s = this._def;
|
|
1535
1554
|
if (t.parsedType !== f.array)
|
|
@@ -1539,11 +1558,11 @@ class j extends g {
|
|
|
1539
1558
|
received: t.parsedType
|
|
1540
1559
|
}), y;
|
|
1541
1560
|
if (s.exactLength !== null) {
|
|
1542
|
-
const
|
|
1543
|
-
(
|
|
1544
|
-
code:
|
|
1545
|
-
minimum:
|
|
1546
|
-
maximum:
|
|
1561
|
+
const i = t.data.length > s.exactLength.value, o = t.data.length < s.exactLength.value;
|
|
1562
|
+
(i || o) && (l(t, {
|
|
1563
|
+
code: i ? c.too_big : c.too_small,
|
|
1564
|
+
minimum: o ? s.exactLength.value : void 0,
|
|
1565
|
+
maximum: i ? s.exactLength.value : void 0,
|
|
1547
1566
|
type: "array",
|
|
1548
1567
|
inclusive: !0,
|
|
1549
1568
|
exact: !0,
|
|
@@ -1565,27 +1584,27 @@ class j extends g {
|
|
|
1565
1584
|
exact: !1,
|
|
1566
1585
|
message: s.maxLength.message
|
|
1567
1586
|
}), n.dirty()), t.common.async)
|
|
1568
|
-
return Promise.all([...t.data].map((
|
|
1569
|
-
const a = [...t.data].map((
|
|
1587
|
+
return Promise.all([...t.data].map((i, o) => s.type._parseAsync(new R(t, i, t.path, o)))).then((i) => T.mergeArray(n, i));
|
|
1588
|
+
const a = [...t.data].map((i, o) => s.type._parseSync(new R(t, i, t.path, o)));
|
|
1570
1589
|
return T.mergeArray(n, a);
|
|
1571
1590
|
}
|
|
1572
1591
|
get element() {
|
|
1573
1592
|
return this._def.type;
|
|
1574
1593
|
}
|
|
1575
1594
|
min(e, t) {
|
|
1576
|
-
return new
|
|
1595
|
+
return new E({
|
|
1577
1596
|
...this._def,
|
|
1578
1597
|
minLength: { value: e, message: m.toString(t) }
|
|
1579
1598
|
});
|
|
1580
1599
|
}
|
|
1581
1600
|
max(e, t) {
|
|
1582
|
-
return new
|
|
1601
|
+
return new E({
|
|
1583
1602
|
...this._def,
|
|
1584
1603
|
maxLength: { value: e, message: m.toString(t) }
|
|
1585
1604
|
});
|
|
1586
1605
|
}
|
|
1587
1606
|
length(e, t) {
|
|
1588
|
-
return new
|
|
1607
|
+
return new E({
|
|
1589
1608
|
...this._def,
|
|
1590
1609
|
exactLength: { value: e, message: m.toString(t) }
|
|
1591
1610
|
});
|
|
@@ -1594,7 +1613,7 @@ class j extends g {
|
|
|
1594
1613
|
return this.min(1, e);
|
|
1595
1614
|
}
|
|
1596
1615
|
}
|
|
1597
|
-
|
|
1616
|
+
E.create = (r, e) => new E({
|
|
1598
1617
|
type: r,
|
|
1599
1618
|
minLength: null,
|
|
1600
1619
|
maxLength: null,
|
|
@@ -1602,21 +1621,21 @@ j.create = (r, e) => new j({
|
|
|
1602
1621
|
typeName: _.ZodArray,
|
|
1603
1622
|
...v(e)
|
|
1604
1623
|
});
|
|
1605
|
-
function
|
|
1624
|
+
function H(r) {
|
|
1606
1625
|
if (r instanceof b) {
|
|
1607
1626
|
const e = {};
|
|
1608
1627
|
for (const t in r.shape) {
|
|
1609
1628
|
const n = r.shape[t];
|
|
1610
|
-
e[t] = N.create(
|
|
1629
|
+
e[t] = N.create(H(n));
|
|
1611
1630
|
}
|
|
1612
1631
|
return new b({
|
|
1613
1632
|
...r._def,
|
|
1614
1633
|
shape: () => e
|
|
1615
1634
|
});
|
|
1616
|
-
} else return r instanceof
|
|
1635
|
+
} else return r instanceof E ? new E({
|
|
1617
1636
|
...r._def,
|
|
1618
|
-
type:
|
|
1619
|
-
}) : r instanceof N ? N.create(
|
|
1637
|
+
type: H(r.element)
|
|
1638
|
+
}) : r instanceof N ? N.create(H(r.unwrap())) : r instanceof z ? z.create(H(r.unwrap())) : r instanceof I ? I.create(r.items.map((e) => H(e))) : r;
|
|
1620
1639
|
}
|
|
1621
1640
|
class b extends g {
|
|
1622
1641
|
constructor() {
|
|
@@ -1637,55 +1656,55 @@ class b extends g {
|
|
|
1637
1656
|
received: d.parsedType
|
|
1638
1657
|
}), y;
|
|
1639
1658
|
}
|
|
1640
|
-
const { status: n, ctx: s } = this._processInputParams(e), { shape: a, keys:
|
|
1659
|
+
const { status: n, ctx: s } = this._processInputParams(e), { shape: a, keys: i } = this._getCached(), o = [];
|
|
1641
1660
|
if (!(this._def.catchall instanceof M && this._def.unknownKeys === "strip"))
|
|
1642
1661
|
for (const d in s.data)
|
|
1643
|
-
|
|
1662
|
+
i.includes(d) || o.push(d);
|
|
1644
1663
|
const u = [];
|
|
1645
|
-
for (const d of
|
|
1646
|
-
const
|
|
1664
|
+
for (const d of i) {
|
|
1665
|
+
const p = a[d], k = s.data[d];
|
|
1647
1666
|
u.push({
|
|
1648
1667
|
key: { status: "valid", value: d },
|
|
1649
|
-
value:
|
|
1668
|
+
value: p._parse(new R(s, k, s.path, d)),
|
|
1650
1669
|
alwaysSet: d in s.data
|
|
1651
1670
|
});
|
|
1652
1671
|
}
|
|
1653
1672
|
if (this._def.catchall instanceof M) {
|
|
1654
1673
|
const d = this._def.unknownKeys;
|
|
1655
1674
|
if (d === "passthrough")
|
|
1656
|
-
for (const
|
|
1675
|
+
for (const p of o)
|
|
1657
1676
|
u.push({
|
|
1658
|
-
key: { status: "valid", value:
|
|
1659
|
-
value: { status: "valid", value: s.data[
|
|
1677
|
+
key: { status: "valid", value: p },
|
|
1678
|
+
value: { status: "valid", value: s.data[p] }
|
|
1660
1679
|
});
|
|
1661
1680
|
else if (d === "strict")
|
|
1662
|
-
|
|
1681
|
+
o.length > 0 && (l(s, {
|
|
1663
1682
|
code: c.unrecognized_keys,
|
|
1664
|
-
keys:
|
|
1683
|
+
keys: o
|
|
1665
1684
|
}), n.dirty());
|
|
1666
1685
|
else if (d !== "strip") throw new Error("Internal ZodObject error: invalid unknownKeys value.");
|
|
1667
1686
|
} else {
|
|
1668
1687
|
const d = this._def.catchall;
|
|
1669
|
-
for (const
|
|
1670
|
-
const k = s.data[
|
|
1688
|
+
for (const p of o) {
|
|
1689
|
+
const k = s.data[p];
|
|
1671
1690
|
u.push({
|
|
1672
|
-
key: { status: "valid", value:
|
|
1691
|
+
key: { status: "valid", value: p },
|
|
1673
1692
|
value: d._parse(
|
|
1674
|
-
new R(s, k, s.path,
|
|
1693
|
+
new R(s, k, s.path, p)
|
|
1675
1694
|
//, ctx.child(key), value, getParsedType(value)
|
|
1676
1695
|
),
|
|
1677
|
-
alwaysSet:
|
|
1696
|
+
alwaysSet: p in s.data
|
|
1678
1697
|
});
|
|
1679
1698
|
}
|
|
1680
1699
|
}
|
|
1681
1700
|
return s.common.async ? Promise.resolve().then(async () => {
|
|
1682
1701
|
const d = [];
|
|
1683
|
-
for (const
|
|
1684
|
-
const k = await
|
|
1702
|
+
for (const p of u) {
|
|
1703
|
+
const k = await p.key, O = await p.value;
|
|
1685
1704
|
d.push({
|
|
1686
1705
|
key: k,
|
|
1687
1706
|
value: O,
|
|
1688
|
-
alwaysSet:
|
|
1707
|
+
alwaysSet: p.alwaysSet
|
|
1689
1708
|
});
|
|
1690
1709
|
}
|
|
1691
1710
|
return d;
|
|
@@ -1700,10 +1719,10 @@ class b extends g {
|
|
|
1700
1719
|
unknownKeys: "strict",
|
|
1701
1720
|
...e !== void 0 ? {
|
|
1702
1721
|
errorMap: (t, n) => {
|
|
1703
|
-
var s, a,
|
|
1704
|
-
const u = (
|
|
1722
|
+
var s, a, i, o;
|
|
1723
|
+
const u = (i = (a = (s = this._def).errorMap) === null || a === void 0 ? void 0 : a.call(s, t, n).message) !== null && i !== void 0 ? i : n.defaultError;
|
|
1705
1724
|
return t.code === "unrecognized_keys" ? {
|
|
1706
|
-
message: (
|
|
1725
|
+
message: (o = m.errToObj(e).message) !== null && o !== void 0 ? o : u
|
|
1707
1726
|
} : {
|
|
1708
1727
|
message: u
|
|
1709
1728
|
};
|
|
@@ -1852,7 +1871,7 @@ class b extends g {
|
|
|
1852
1871
|
* @deprecated
|
|
1853
1872
|
*/
|
|
1854
1873
|
deepPartial() {
|
|
1855
|
-
return
|
|
1874
|
+
return H(this);
|
|
1856
1875
|
}
|
|
1857
1876
|
partial(e) {
|
|
1858
1877
|
const t = {};
|
|
@@ -1881,7 +1900,7 @@ class b extends g {
|
|
|
1881
1900
|
});
|
|
1882
1901
|
}
|
|
1883
1902
|
keyof() {
|
|
1884
|
-
return
|
|
1903
|
+
return tt(x.objectKeys(this.shape));
|
|
1885
1904
|
}
|
|
1886
1905
|
}
|
|
1887
1906
|
b.create = (r, e) => new b({
|
|
@@ -1905,25 +1924,25 @@ b.lazycreate = (r, e) => new b({
|
|
|
1905
1924
|
typeName: _.ZodObject,
|
|
1906
1925
|
...v(e)
|
|
1907
1926
|
});
|
|
1908
|
-
class
|
|
1927
|
+
class ue extends g {
|
|
1909
1928
|
_parse(e) {
|
|
1910
1929
|
const { ctx: t } = this._processInputParams(e), n = this._def.options;
|
|
1911
1930
|
function s(a) {
|
|
1912
|
-
for (const
|
|
1913
|
-
if (
|
|
1914
|
-
return
|
|
1915
|
-
for (const
|
|
1916
|
-
if (
|
|
1917
|
-
return t.common.issues.push(...
|
|
1918
|
-
const
|
|
1931
|
+
for (const o of a)
|
|
1932
|
+
if (o.result.status === "valid")
|
|
1933
|
+
return o.result;
|
|
1934
|
+
for (const o of a)
|
|
1935
|
+
if (o.result.status === "dirty")
|
|
1936
|
+
return t.common.issues.push(...o.ctx.common.issues), o.result;
|
|
1937
|
+
const i = a.map((o) => new S(o.ctx.common.issues));
|
|
1919
1938
|
return l(t, {
|
|
1920
1939
|
code: c.invalid_union,
|
|
1921
|
-
unionErrors:
|
|
1940
|
+
unionErrors: i
|
|
1922
1941
|
}), y;
|
|
1923
1942
|
}
|
|
1924
1943
|
if (t.common.async)
|
|
1925
1944
|
return Promise.all(n.map(async (a) => {
|
|
1926
|
-
const
|
|
1945
|
+
const i = {
|
|
1927
1946
|
...t,
|
|
1928
1947
|
common: {
|
|
1929
1948
|
...t.common,
|
|
@@ -1935,14 +1954,14 @@ class ce extends g {
|
|
|
1935
1954
|
result: await a._parseAsync({
|
|
1936
1955
|
data: t.data,
|
|
1937
1956
|
path: t.path,
|
|
1938
|
-
parent:
|
|
1957
|
+
parent: i
|
|
1939
1958
|
}),
|
|
1940
|
-
ctx:
|
|
1959
|
+
ctx: i
|
|
1941
1960
|
};
|
|
1942
1961
|
})).then(s);
|
|
1943
1962
|
{
|
|
1944
1963
|
let a;
|
|
1945
|
-
const
|
|
1964
|
+
const i = [];
|
|
1946
1965
|
for (const u of n) {
|
|
1947
1966
|
const d = {
|
|
1948
1967
|
...t,
|
|
@@ -1951,21 +1970,21 @@ class ce extends g {
|
|
|
1951
1970
|
issues: []
|
|
1952
1971
|
},
|
|
1953
1972
|
parent: null
|
|
1954
|
-
},
|
|
1973
|
+
}, p = u._parseSync({
|
|
1955
1974
|
data: t.data,
|
|
1956
1975
|
path: t.path,
|
|
1957
1976
|
parent: d
|
|
1958
1977
|
});
|
|
1959
|
-
if (
|
|
1960
|
-
return
|
|
1961
|
-
|
|
1978
|
+
if (p.status === "valid")
|
|
1979
|
+
return p;
|
|
1980
|
+
p.status === "dirty" && !a && (a = { result: p, ctx: d }), d.common.issues.length && i.push(d.common.issues);
|
|
1962
1981
|
}
|
|
1963
1982
|
if (a)
|
|
1964
1983
|
return t.common.issues.push(...a.ctx.common.issues), a.result;
|
|
1965
|
-
const
|
|
1984
|
+
const o = i.map((u) => new S(u));
|
|
1966
1985
|
return l(t, {
|
|
1967
1986
|
code: c.invalid_union,
|
|
1968
|
-
unionErrors:
|
|
1987
|
+
unionErrors: o
|
|
1969
1988
|
}), y;
|
|
1970
1989
|
}
|
|
1971
1990
|
}
|
|
@@ -1973,13 +1992,13 @@ class ce extends g {
|
|
|
1973
1992
|
return this._def.options;
|
|
1974
1993
|
}
|
|
1975
1994
|
}
|
|
1976
|
-
|
|
1995
|
+
ue.create = (r, e) => new ue({
|
|
1977
1996
|
options: r,
|
|
1978
1997
|
typeName: _.ZodUnion,
|
|
1979
1998
|
...v(e)
|
|
1980
1999
|
});
|
|
1981
|
-
const A = (r) => r instanceof
|
|
1982
|
-
class
|
|
2000
|
+
const A = (r) => r instanceof he ? A(r.schema) : r instanceof C ? A(r.innerType()) : r instanceof pe ? [r.value] : r instanceof U ? r.options : r instanceof me ? x.objectValues(r.enum) : r instanceof _e ? A(r._def.innerType) : r instanceof de ? [void 0] : r instanceof ce ? [null] : r instanceof N ? [void 0, ...A(r.unwrap())] : r instanceof z ? [null, ...A(r.unwrap())] : r instanceof He || r instanceof ve ? A(r.unwrap()) : r instanceof ye ? A(r._def.innerType) : [];
|
|
2001
|
+
class Ce extends g {
|
|
1983
2002
|
_parse(e) {
|
|
1984
2003
|
const { ctx: t } = this._processInputParams(e);
|
|
1985
2004
|
if (t.parsedType !== f.object)
|
|
@@ -2023,16 +2042,16 @@ class Oe extends g {
|
|
|
2023
2042
|
static create(e, t, n) {
|
|
2024
2043
|
const s = /* @__PURE__ */ new Map();
|
|
2025
2044
|
for (const a of t) {
|
|
2026
|
-
const
|
|
2027
|
-
if (!
|
|
2045
|
+
const i = A(a.shape[e]);
|
|
2046
|
+
if (!i.length)
|
|
2028
2047
|
throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);
|
|
2029
|
-
for (const
|
|
2030
|
-
if (s.has(
|
|
2031
|
-
throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(
|
|
2032
|
-
s.set(
|
|
2048
|
+
for (const o of i) {
|
|
2049
|
+
if (s.has(o))
|
|
2050
|
+
throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(o)}`);
|
|
2051
|
+
s.set(o, a);
|
|
2033
2052
|
}
|
|
2034
2053
|
}
|
|
2035
|
-
return new
|
|
2054
|
+
return new Ce({
|
|
2036
2055
|
typeName: _.ZodDiscriminatedUnion,
|
|
2037
2056
|
discriminator: e,
|
|
2038
2057
|
options: t,
|
|
@@ -2041,25 +2060,25 @@ class Oe extends g {
|
|
|
2041
2060
|
});
|
|
2042
2061
|
}
|
|
2043
2062
|
}
|
|
2044
|
-
function
|
|
2063
|
+
function Je(r, e) {
|
|
2045
2064
|
const t = V(r), n = V(e);
|
|
2046
2065
|
if (r === e)
|
|
2047
2066
|
return { valid: !0, data: r };
|
|
2048
2067
|
if (t === f.object && n === f.object) {
|
|
2049
|
-
const s = x.objectKeys(e), a = x.objectKeys(r).filter((
|
|
2050
|
-
for (const
|
|
2051
|
-
const u =
|
|
2068
|
+
const s = x.objectKeys(e), a = x.objectKeys(r).filter((o) => s.indexOf(o) !== -1), i = { ...r, ...e };
|
|
2069
|
+
for (const o of a) {
|
|
2070
|
+
const u = Je(r[o], e[o]);
|
|
2052
2071
|
if (!u.valid)
|
|
2053
2072
|
return { valid: !1 };
|
|
2054
|
-
o
|
|
2073
|
+
i[o] = u.data;
|
|
2055
2074
|
}
|
|
2056
|
-
return { valid: !0, data:
|
|
2075
|
+
return { valid: !0, data: i };
|
|
2057
2076
|
} else if (t === f.array && n === f.array) {
|
|
2058
2077
|
if (r.length !== e.length)
|
|
2059
2078
|
return { valid: !1 };
|
|
2060
2079
|
const s = [];
|
|
2061
2080
|
for (let a = 0; a < r.length; a++) {
|
|
2062
|
-
const
|
|
2081
|
+
const i = r[a], o = e[a], u = Je(i, o);
|
|
2063
2082
|
if (!u.valid)
|
|
2064
2083
|
return { valid: !1 };
|
|
2065
2084
|
s.push(u.data);
|
|
@@ -2067,13 +2086,13 @@ function Le(r, e) {
|
|
|
2067
2086
|
return { valid: !0, data: s };
|
|
2068
2087
|
} else return t === f.date && n === f.date && +r == +e ? { valid: !0, data: r } : { valid: !1 };
|
|
2069
2088
|
}
|
|
2070
|
-
class
|
|
2089
|
+
class le extends g {
|
|
2071
2090
|
_parse(e) {
|
|
2072
|
-
const { status: t, ctx: n } = this._processInputParams(e), s = (a,
|
|
2073
|
-
if (
|
|
2091
|
+
const { status: t, ctx: n } = this._processInputParams(e), s = (a, i) => {
|
|
2092
|
+
if (We(a) || We(i))
|
|
2074
2093
|
return y;
|
|
2075
|
-
const
|
|
2076
|
-
return
|
|
2094
|
+
const o = Je(a.value, i.value);
|
|
2095
|
+
return o.valid ? ((qe(a) || qe(i)) && t.dirty(), { status: t.value, value: o.data }) : (l(n, {
|
|
2077
2096
|
code: c.invalid_intersection_types
|
|
2078
2097
|
}), y);
|
|
2079
2098
|
};
|
|
@@ -2088,7 +2107,7 @@ class ue extends g {
|
|
|
2088
2107
|
path: n.path,
|
|
2089
2108
|
parent: n
|
|
2090
2109
|
})
|
|
2091
|
-
]).then(([a,
|
|
2110
|
+
]).then(([a, i]) => s(a, i)) : s(this._def.left._parseSync({
|
|
2092
2111
|
data: n.data,
|
|
2093
2112
|
path: n.path,
|
|
2094
2113
|
parent: n
|
|
@@ -2099,7 +2118,7 @@ class ue extends g {
|
|
|
2099
2118
|
}));
|
|
2100
2119
|
}
|
|
2101
2120
|
}
|
|
2102
|
-
|
|
2121
|
+
le.create = (r, e, t) => new le({
|
|
2103
2122
|
left: r,
|
|
2104
2123
|
right: e,
|
|
2105
2124
|
typeName: _.ZodIntersection,
|
|
@@ -2129,11 +2148,11 @@ class I extends g {
|
|
|
2129
2148
|
exact: !1,
|
|
2130
2149
|
type: "array"
|
|
2131
2150
|
}), t.dirty());
|
|
2132
|
-
const a = [...n.data].map((
|
|
2133
|
-
const u = this._def.items[
|
|
2134
|
-
return u ? u._parse(new R(n,
|
|
2135
|
-
}).filter((
|
|
2136
|
-
return n.common.async ? Promise.all(a).then((
|
|
2151
|
+
const a = [...n.data].map((i, o) => {
|
|
2152
|
+
const u = this._def.items[o] || this._def.rest;
|
|
2153
|
+
return u ? u._parse(new R(n, i, n.path, o)) : null;
|
|
2154
|
+
}).filter((i) => !!i);
|
|
2155
|
+
return n.common.async ? Promise.all(a).then((i) => T.mergeArray(t, i)) : T.mergeArray(t, a);
|
|
2137
2156
|
}
|
|
2138
2157
|
get items() {
|
|
2139
2158
|
return this._def.items;
|
|
@@ -2155,7 +2174,7 @@ I.create = (r, e) => {
|
|
|
2155
2174
|
...v(e)
|
|
2156
2175
|
});
|
|
2157
2176
|
};
|
|
2158
|
-
class
|
|
2177
|
+
class fe extends g {
|
|
2159
2178
|
get keySchema() {
|
|
2160
2179
|
return this._def.keyType;
|
|
2161
2180
|
}
|
|
@@ -2170,12 +2189,12 @@ class le extends g {
|
|
|
2170
2189
|
expected: f.object,
|
|
2171
2190
|
received: n.parsedType
|
|
2172
2191
|
}), y;
|
|
2173
|
-
const s = [], a = this._def.keyType,
|
|
2174
|
-
for (const
|
|
2192
|
+
const s = [], a = this._def.keyType, i = this._def.valueType;
|
|
2193
|
+
for (const o in n.data)
|
|
2175
2194
|
s.push({
|
|
2176
|
-
key: a._parse(new R(n,
|
|
2177
|
-
value:
|
|
2178
|
-
alwaysSet:
|
|
2195
|
+
key: a._parse(new R(n, o, n.path, o)),
|
|
2196
|
+
value: i._parse(new R(n, n.data[o], n.path, o)),
|
|
2197
|
+
alwaysSet: o in n.data
|
|
2179
2198
|
});
|
|
2180
2199
|
return n.common.async ? T.mergeObjectAsync(t, s) : T.mergeObjectSync(t, s);
|
|
2181
2200
|
}
|
|
@@ -2183,20 +2202,20 @@ class le extends g {
|
|
|
2183
2202
|
return this._def.valueType;
|
|
2184
2203
|
}
|
|
2185
2204
|
static create(e, t, n) {
|
|
2186
|
-
return t instanceof g ? new
|
|
2205
|
+
return t instanceof g ? new fe({
|
|
2187
2206
|
keyType: e,
|
|
2188
2207
|
valueType: t,
|
|
2189
2208
|
typeName: _.ZodRecord,
|
|
2190
2209
|
...v(n)
|
|
2191
|
-
}) : new
|
|
2192
|
-
keyType:
|
|
2210
|
+
}) : new fe({
|
|
2211
|
+
keyType: j.create(),
|
|
2193
2212
|
valueType: e,
|
|
2194
2213
|
typeName: _.ZodRecord,
|
|
2195
2214
|
...v(t)
|
|
2196
2215
|
});
|
|
2197
2216
|
}
|
|
2198
2217
|
}
|
|
2199
|
-
class
|
|
2218
|
+
class Oe extends g {
|
|
2200
2219
|
get keySchema() {
|
|
2201
2220
|
return this._def.keyType;
|
|
2202
2221
|
}
|
|
@@ -2211,34 +2230,34 @@ class Ze extends g {
|
|
|
2211
2230
|
expected: f.map,
|
|
2212
2231
|
received: n.parsedType
|
|
2213
2232
|
}), y;
|
|
2214
|
-
const s = this._def.keyType, a = this._def.valueType,
|
|
2215
|
-
key: s._parse(new R(n,
|
|
2233
|
+
const s = this._def.keyType, a = this._def.valueType, i = [...n.data.entries()].map(([o, u], d) => ({
|
|
2234
|
+
key: s._parse(new R(n, o, n.path, [d, "key"])),
|
|
2216
2235
|
value: a._parse(new R(n, u, n.path, [d, "value"]))
|
|
2217
2236
|
}));
|
|
2218
2237
|
if (n.common.async) {
|
|
2219
|
-
const
|
|
2238
|
+
const o = /* @__PURE__ */ new Map();
|
|
2220
2239
|
return Promise.resolve().then(async () => {
|
|
2221
|
-
for (const u of
|
|
2222
|
-
const d = await u.key,
|
|
2223
|
-
if (d.status === "aborted" ||
|
|
2240
|
+
for (const u of i) {
|
|
2241
|
+
const d = await u.key, p = await u.value;
|
|
2242
|
+
if (d.status === "aborted" || p.status === "aborted")
|
|
2224
2243
|
return y;
|
|
2225
|
-
(d.status === "dirty" ||
|
|
2244
|
+
(d.status === "dirty" || p.status === "dirty") && t.dirty(), o.set(d.value, p.value);
|
|
2226
2245
|
}
|
|
2227
|
-
return { status: t.value, value:
|
|
2246
|
+
return { status: t.value, value: o };
|
|
2228
2247
|
});
|
|
2229
2248
|
} else {
|
|
2230
|
-
const
|
|
2231
|
-
for (const u of
|
|
2232
|
-
const d = u.key,
|
|
2233
|
-
if (d.status === "aborted" ||
|
|
2249
|
+
const o = /* @__PURE__ */ new Map();
|
|
2250
|
+
for (const u of i) {
|
|
2251
|
+
const d = u.key, p = u.value;
|
|
2252
|
+
if (d.status === "aborted" || p.status === "aborted")
|
|
2234
2253
|
return y;
|
|
2235
|
-
(d.status === "dirty" ||
|
|
2254
|
+
(d.status === "dirty" || p.status === "dirty") && t.dirty(), o.set(d.value, p.value);
|
|
2236
2255
|
}
|
|
2237
|
-
return { status: t.value, value:
|
|
2256
|
+
return { status: t.value, value: o };
|
|
2238
2257
|
}
|
|
2239
2258
|
}
|
|
2240
2259
|
}
|
|
2241
|
-
|
|
2260
|
+
Oe.create = (r, e, t) => new Oe({
|
|
2242
2261
|
valueType: e,
|
|
2243
2262
|
keyType: r,
|
|
2244
2263
|
typeName: _.ZodMap,
|
|
@@ -2270,17 +2289,17 @@ class J extends g {
|
|
|
2270
2289
|
message: s.maxSize.message
|
|
2271
2290
|
}), t.dirty());
|
|
2272
2291
|
const a = this._def.valueType;
|
|
2273
|
-
function
|
|
2292
|
+
function i(u) {
|
|
2274
2293
|
const d = /* @__PURE__ */ new Set();
|
|
2275
|
-
for (const
|
|
2276
|
-
if (
|
|
2294
|
+
for (const p of u) {
|
|
2295
|
+
if (p.status === "aborted")
|
|
2277
2296
|
return y;
|
|
2278
|
-
|
|
2297
|
+
p.status === "dirty" && t.dirty(), d.add(p.value);
|
|
2279
2298
|
}
|
|
2280
2299
|
return { status: t.value, value: d };
|
|
2281
2300
|
}
|
|
2282
|
-
const
|
|
2283
|
-
return n.common.async ? Promise.all(
|
|
2301
|
+
const o = [...n.data.values()].map((u, d) => a._parse(new R(n, u, n.path, d)));
|
|
2302
|
+
return n.common.async ? Promise.all(o).then((u) => i(u)) : i(o);
|
|
2284
2303
|
}
|
|
2285
2304
|
min(e, t) {
|
|
2286
2305
|
return new J({
|
|
@@ -2320,14 +2339,14 @@ class G extends g {
|
|
|
2320
2339
|
expected: f.function,
|
|
2321
2340
|
received: t.parsedType
|
|
2322
2341
|
}), y;
|
|
2323
|
-
function n(
|
|
2324
|
-
return
|
|
2325
|
-
data:
|
|
2342
|
+
function n(o, u) {
|
|
2343
|
+
return we({
|
|
2344
|
+
data: o,
|
|
2326
2345
|
path: t.path,
|
|
2327
2346
|
errorMaps: [
|
|
2328
2347
|
t.common.contextualErrorMap,
|
|
2329
2348
|
t.schemaErrorMap,
|
|
2330
|
-
|
|
2349
|
+
ke(),
|
|
2331
2350
|
X
|
|
2332
2351
|
].filter((d) => !!d),
|
|
2333
2352
|
issueData: {
|
|
@@ -2336,14 +2355,14 @@ class G extends g {
|
|
|
2336
2355
|
}
|
|
2337
2356
|
});
|
|
2338
2357
|
}
|
|
2339
|
-
function s(
|
|
2340
|
-
return
|
|
2341
|
-
data:
|
|
2358
|
+
function s(o, u) {
|
|
2359
|
+
return we({
|
|
2360
|
+
data: o,
|
|
2342
2361
|
path: t.path,
|
|
2343
2362
|
errorMaps: [
|
|
2344
2363
|
t.common.contextualErrorMap,
|
|
2345
2364
|
t.schemaErrorMap,
|
|
2346
|
-
|
|
2365
|
+
ke(),
|
|
2347
2366
|
X
|
|
2348
2367
|
].filter((d) => !!d),
|
|
2349
2368
|
issueData: {
|
|
@@ -2352,26 +2371,26 @@ class G extends g {
|
|
|
2352
2371
|
}
|
|
2353
2372
|
});
|
|
2354
2373
|
}
|
|
2355
|
-
const a = { errorMap: t.common.contextualErrorMap },
|
|
2374
|
+
const a = { errorMap: t.common.contextualErrorMap }, i = t.data;
|
|
2356
2375
|
if (this._def.returns instanceof Q) {
|
|
2357
|
-
const
|
|
2376
|
+
const o = this;
|
|
2358
2377
|
return Z(async function(...u) {
|
|
2359
|
-
const d = new S([]),
|
|
2378
|
+
const d = new S([]), p = await o._def.args.parseAsync(u, a).catch((w) => {
|
|
2360
2379
|
throw d.addIssue(n(u, w)), d;
|
|
2361
|
-
}), k = await Reflect.apply(
|
|
2362
|
-
return await
|
|
2380
|
+
}), k = await Reflect.apply(i, this, p);
|
|
2381
|
+
return await o._def.returns._def.type.parseAsync(k, a).catch((w) => {
|
|
2363
2382
|
throw d.addIssue(s(k, w)), d;
|
|
2364
2383
|
});
|
|
2365
2384
|
});
|
|
2366
2385
|
} else {
|
|
2367
|
-
const
|
|
2386
|
+
const o = this;
|
|
2368
2387
|
return Z(function(...u) {
|
|
2369
|
-
const d =
|
|
2388
|
+
const d = o._def.args.safeParse(u, a);
|
|
2370
2389
|
if (!d.success)
|
|
2371
2390
|
throw new S([n(u, d.error)]);
|
|
2372
|
-
const
|
|
2391
|
+
const p = Reflect.apply(i, this, d.data), k = o._def.returns.safeParse(p, a);
|
|
2373
2392
|
if (!k.success)
|
|
2374
|
-
throw new S([s(
|
|
2393
|
+
throw new S([s(p, k.error)]);
|
|
2375
2394
|
return k.data;
|
|
2376
2395
|
});
|
|
2377
2396
|
}
|
|
@@ -2409,7 +2428,7 @@ class G extends g {
|
|
|
2409
2428
|
});
|
|
2410
2429
|
}
|
|
2411
2430
|
}
|
|
2412
|
-
class
|
|
2431
|
+
class he extends g {
|
|
2413
2432
|
get schema() {
|
|
2414
2433
|
return this._def.getter();
|
|
2415
2434
|
}
|
|
@@ -2418,12 +2437,12 @@ class fe extends g {
|
|
|
2418
2437
|
return this._def.getter()._parse({ data: t.data, path: t.path, parent: t });
|
|
2419
2438
|
}
|
|
2420
2439
|
}
|
|
2421
|
-
|
|
2440
|
+
he.create = (r, e) => new he({
|
|
2422
2441
|
getter: r,
|
|
2423
2442
|
typeName: _.ZodLazy,
|
|
2424
2443
|
...v(e)
|
|
2425
2444
|
});
|
|
2426
|
-
class
|
|
2445
|
+
class pe extends g {
|
|
2427
2446
|
_parse(e) {
|
|
2428
2447
|
if (e.data !== this._def.value) {
|
|
2429
2448
|
const t = this._getOrReturnCtx(e);
|
|
@@ -2439,12 +2458,12 @@ class he extends g {
|
|
|
2439
2458
|
return this._def.value;
|
|
2440
2459
|
}
|
|
2441
2460
|
}
|
|
2442
|
-
|
|
2461
|
+
pe.create = (r, e) => new pe({
|
|
2443
2462
|
value: r,
|
|
2444
2463
|
typeName: _.ZodLiteral,
|
|
2445
2464
|
...v(e)
|
|
2446
2465
|
});
|
|
2447
|
-
function
|
|
2466
|
+
function tt(r, e) {
|
|
2448
2467
|
return new U({
|
|
2449
2468
|
values: r,
|
|
2450
2469
|
typeName: _.ZodEnum,
|
|
@@ -2453,7 +2472,7 @@ function Xe(r, e) {
|
|
|
2453
2472
|
}
|
|
2454
2473
|
class U extends g {
|
|
2455
2474
|
constructor() {
|
|
2456
|
-
super(...arguments),
|
|
2475
|
+
super(...arguments), ne.set(this, void 0);
|
|
2457
2476
|
}
|
|
2458
2477
|
_parse(e) {
|
|
2459
2478
|
if (typeof e.data != "string") {
|
|
@@ -2464,7 +2483,7 @@ class U extends g {
|
|
|
2464
2483
|
code: c.invalid_type
|
|
2465
2484
|
}), y;
|
|
2466
2485
|
}
|
|
2467
|
-
if (
|
|
2486
|
+
if (Te(this, ne) || Ke(this, ne, new Set(this._def.values)), !Te(this, ne).has(e.data)) {
|
|
2468
2487
|
const t = this._getOrReturnCtx(e), n = this._def.values;
|
|
2469
2488
|
return l(t, {
|
|
2470
2489
|
received: t.data,
|
|
@@ -2508,11 +2527,11 @@ class U extends g {
|
|
|
2508
2527
|
});
|
|
2509
2528
|
}
|
|
2510
2529
|
}
|
|
2511
|
-
|
|
2512
|
-
U.create =
|
|
2513
|
-
class
|
|
2530
|
+
ne = /* @__PURE__ */ new WeakMap();
|
|
2531
|
+
U.create = tt;
|
|
2532
|
+
class me extends g {
|
|
2514
2533
|
constructor() {
|
|
2515
|
-
super(...arguments),
|
|
2534
|
+
super(...arguments), se.set(this, void 0);
|
|
2516
2535
|
}
|
|
2517
2536
|
_parse(e) {
|
|
2518
2537
|
const t = x.getValidEnumValues(this._def.values), n = this._getOrReturnCtx(e);
|
|
@@ -2524,7 +2543,7 @@ class pe extends g {
|
|
|
2524
2543
|
code: c.invalid_type
|
|
2525
2544
|
}), y;
|
|
2526
2545
|
}
|
|
2527
|
-
if (
|
|
2546
|
+
if (Te(this, se) || Ke(this, se, new Set(x.getValidEnumValues(this._def.values))), !Te(this, se).has(e.data)) {
|
|
2528
2547
|
const s = x.objectValues(t);
|
|
2529
2548
|
return l(n, {
|
|
2530
2549
|
received: n.data,
|
|
@@ -2538,8 +2557,8 @@ class pe extends g {
|
|
|
2538
2557
|
return this._def.values;
|
|
2539
2558
|
}
|
|
2540
2559
|
}
|
|
2541
|
-
|
|
2542
|
-
|
|
2560
|
+
se = /* @__PURE__ */ new WeakMap();
|
|
2561
|
+
me.create = (r, e) => new me({
|
|
2543
2562
|
values: r,
|
|
2544
2563
|
typeName: _.ZodNativeEnum,
|
|
2545
2564
|
...v(e)
|
|
@@ -2577,71 +2596,71 @@ class C extends g {
|
|
|
2577
2596
|
}
|
|
2578
2597
|
_parse(e) {
|
|
2579
2598
|
const { status: t, ctx: n } = this._processInputParams(e), s = this._def.effect || null, a = {
|
|
2580
|
-
addIssue: (
|
|
2581
|
-
l(n,
|
|
2599
|
+
addIssue: (i) => {
|
|
2600
|
+
l(n, i), i.fatal ? t.abort() : t.dirty();
|
|
2582
2601
|
},
|
|
2583
2602
|
get path() {
|
|
2584
2603
|
return n.path;
|
|
2585
2604
|
}
|
|
2586
2605
|
};
|
|
2587
2606
|
if (a.addIssue = a.addIssue.bind(a), s.type === "preprocess") {
|
|
2588
|
-
const
|
|
2607
|
+
const i = s.transform(n.data, a);
|
|
2589
2608
|
if (n.common.async)
|
|
2590
|
-
return Promise.resolve(
|
|
2609
|
+
return Promise.resolve(i).then(async (o) => {
|
|
2591
2610
|
if (t.value === "aborted")
|
|
2592
2611
|
return y;
|
|
2593
2612
|
const u = await this._def.schema._parseAsync({
|
|
2594
|
-
data:
|
|
2613
|
+
data: o,
|
|
2595
2614
|
path: n.path,
|
|
2596
2615
|
parent: n
|
|
2597
2616
|
});
|
|
2598
|
-
return u.status === "aborted" ? y : u.status === "dirty" || t.value === "dirty" ?
|
|
2617
|
+
return u.status === "aborted" ? y : u.status === "dirty" || t.value === "dirty" ? Y(u.value) : u;
|
|
2599
2618
|
});
|
|
2600
2619
|
{
|
|
2601
2620
|
if (t.value === "aborted")
|
|
2602
2621
|
return y;
|
|
2603
|
-
const
|
|
2604
|
-
data:
|
|
2622
|
+
const o = this._def.schema._parseSync({
|
|
2623
|
+
data: i,
|
|
2605
2624
|
path: n.path,
|
|
2606
2625
|
parent: n
|
|
2607
2626
|
});
|
|
2608
|
-
return
|
|
2627
|
+
return o.status === "aborted" ? y : o.status === "dirty" || t.value === "dirty" ? Y(o.value) : o;
|
|
2609
2628
|
}
|
|
2610
2629
|
}
|
|
2611
2630
|
if (s.type === "refinement") {
|
|
2612
|
-
const
|
|
2613
|
-
const u = s.refinement(
|
|
2631
|
+
const i = (o) => {
|
|
2632
|
+
const u = s.refinement(o, a);
|
|
2614
2633
|
if (n.common.async)
|
|
2615
2634
|
return Promise.resolve(u);
|
|
2616
2635
|
if (u instanceof Promise)
|
|
2617
2636
|
throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");
|
|
2618
|
-
return
|
|
2637
|
+
return o;
|
|
2619
2638
|
};
|
|
2620
2639
|
if (n.common.async === !1) {
|
|
2621
|
-
const
|
|
2640
|
+
const o = this._def.schema._parseSync({
|
|
2622
2641
|
data: n.data,
|
|
2623
2642
|
path: n.path,
|
|
2624
2643
|
parent: n
|
|
2625
2644
|
});
|
|
2626
|
-
return
|
|
2645
|
+
return o.status === "aborted" ? y : (o.status === "dirty" && t.dirty(), i(o.value), { status: t.value, value: o.value });
|
|
2627
2646
|
} else
|
|
2628
|
-
return this._def.schema._parseAsync({ data: n.data, path: n.path, parent: n }).then((
|
|
2647
|
+
return this._def.schema._parseAsync({ data: n.data, path: n.path, parent: n }).then((o) => o.status === "aborted" ? y : (o.status === "dirty" && t.dirty(), i(o.value).then(() => ({ status: t.value, value: o.value }))));
|
|
2629
2648
|
}
|
|
2630
2649
|
if (s.type === "transform")
|
|
2631
2650
|
if (n.common.async === !1) {
|
|
2632
|
-
const
|
|
2651
|
+
const i = this._def.schema._parseSync({
|
|
2633
2652
|
data: n.data,
|
|
2634
2653
|
path: n.path,
|
|
2635
2654
|
parent: n
|
|
2636
2655
|
});
|
|
2637
|
-
if (!
|
|
2638
|
-
return
|
|
2639
|
-
const
|
|
2640
|
-
if (
|
|
2656
|
+
if (!ae(i))
|
|
2657
|
+
return i;
|
|
2658
|
+
const o = s.transform(i.value, a);
|
|
2659
|
+
if (o instanceof Promise)
|
|
2641
2660
|
throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");
|
|
2642
|
-
return { status: t.value, value:
|
|
2661
|
+
return { status: t.value, value: o };
|
|
2643
2662
|
} else
|
|
2644
|
-
return this._def.schema._parseAsync({ data: n.data, path: n.path, parent: n }).then((
|
|
2663
|
+
return this._def.schema._parseAsync({ data: n.data, path: n.path, parent: n }).then((i) => ae(i) ? Promise.resolve(s.transform(i.value, a)).then((o) => ({ status: t.value, value: o })) : i);
|
|
2645
2664
|
x.assertNever(s);
|
|
2646
2665
|
}
|
|
2647
2666
|
}
|
|
@@ -2683,7 +2702,7 @@ z.create = (r, e) => new z({
|
|
|
2683
2702
|
typeName: _.ZodNullable,
|
|
2684
2703
|
...v(e)
|
|
2685
2704
|
});
|
|
2686
|
-
class
|
|
2705
|
+
class _e extends g {
|
|
2687
2706
|
_parse(e) {
|
|
2688
2707
|
const { ctx: t } = this._processInputParams(e);
|
|
2689
2708
|
let n = t.data;
|
|
@@ -2697,13 +2716,13 @@ class me extends g {
|
|
|
2697
2716
|
return this._def.innerType;
|
|
2698
2717
|
}
|
|
2699
2718
|
}
|
|
2700
|
-
|
|
2719
|
+
_e.create = (r, e) => new _e({
|
|
2701
2720
|
innerType: r,
|
|
2702
2721
|
typeName: _.ZodDefault,
|
|
2703
2722
|
defaultValue: typeof e.default == "function" ? e.default : () => e.default,
|
|
2704
2723
|
...v(e)
|
|
2705
2724
|
});
|
|
2706
|
-
class
|
|
2725
|
+
class ye extends g {
|
|
2707
2726
|
_parse(e) {
|
|
2708
2727
|
const { ctx: t } = this._processInputParams(e), n = {
|
|
2709
2728
|
...t,
|
|
@@ -2718,7 +2737,7 @@ class _e extends g {
|
|
|
2718
2737
|
...n
|
|
2719
2738
|
}
|
|
2720
2739
|
});
|
|
2721
|
-
return
|
|
2740
|
+
return ie(s) ? s.then((a) => ({
|
|
2722
2741
|
status: "valid",
|
|
2723
2742
|
value: a.status === "valid" ? a.value : this._def.catchValue({
|
|
2724
2743
|
get error() {
|
|
@@ -2740,13 +2759,13 @@ class _e extends g {
|
|
|
2740
2759
|
return this._def.innerType;
|
|
2741
2760
|
}
|
|
2742
2761
|
}
|
|
2743
|
-
|
|
2762
|
+
ye.create = (r, e) => new ye({
|
|
2744
2763
|
innerType: r,
|
|
2745
2764
|
typeName: _.ZodCatch,
|
|
2746
2765
|
catchValue: typeof e.catch == "function" ? e.catch : () => e.catch,
|
|
2747
2766
|
...v(e)
|
|
2748
2767
|
});
|
|
2749
|
-
class
|
|
2768
|
+
class je extends g {
|
|
2750
2769
|
_parse(e) {
|
|
2751
2770
|
if (this._getType(e) !== f.nan) {
|
|
2752
2771
|
const n = this._getOrReturnCtx(e);
|
|
@@ -2759,12 +2778,12 @@ class Se extends g {
|
|
|
2759
2778
|
return { status: "valid", value: e.data };
|
|
2760
2779
|
}
|
|
2761
2780
|
}
|
|
2762
|
-
|
|
2781
|
+
je.create = (r) => new je({
|
|
2763
2782
|
typeName: _.ZodNaN,
|
|
2764
2783
|
...v(r)
|
|
2765
2784
|
});
|
|
2766
|
-
const
|
|
2767
|
-
class
|
|
2785
|
+
const Vt = Symbol("zod_brand");
|
|
2786
|
+
class He extends g {
|
|
2768
2787
|
_parse(e) {
|
|
2769
2788
|
const { ctx: t } = this._processInputParams(e), n = t.data;
|
|
2770
2789
|
return this._def.type._parse({
|
|
@@ -2777,7 +2796,7 @@ class Ue extends g {
|
|
|
2777
2796
|
return this._def.type;
|
|
2778
2797
|
}
|
|
2779
2798
|
}
|
|
2780
|
-
class
|
|
2799
|
+
class ge extends g {
|
|
2781
2800
|
_parse(e) {
|
|
2782
2801
|
const { status: t, ctx: n } = this._processInputParams(e);
|
|
2783
2802
|
if (n.common.async)
|
|
@@ -2787,7 +2806,7 @@ class ve extends g {
|
|
|
2787
2806
|
path: n.path,
|
|
2788
2807
|
parent: n
|
|
2789
2808
|
});
|
|
2790
|
-
return a.status === "aborted" ? y : a.status === "dirty" ? (t.dirty(),
|
|
2809
|
+
return a.status === "aborted" ? y : a.status === "dirty" ? (t.dirty(), Y(a.value)) : this._def.out._parseAsync({
|
|
2791
2810
|
data: a.value,
|
|
2792
2811
|
path: n.path,
|
|
2793
2812
|
parent: n
|
|
@@ -2810,283 +2829,325 @@ class ve extends g {
|
|
|
2810
2829
|
}
|
|
2811
2830
|
}
|
|
2812
2831
|
static create(e, t) {
|
|
2813
|
-
return new
|
|
2832
|
+
return new ge({
|
|
2814
2833
|
in: e,
|
|
2815
2834
|
out: t,
|
|
2816
2835
|
typeName: _.ZodPipeline
|
|
2817
2836
|
});
|
|
2818
2837
|
}
|
|
2819
2838
|
}
|
|
2820
|
-
class
|
|
2839
|
+
class ve extends g {
|
|
2821
2840
|
_parse(e) {
|
|
2822
|
-
const t = this._def.innerType._parse(e), n = (s) => (
|
|
2823
|
-
return
|
|
2841
|
+
const t = this._def.innerType._parse(e), n = (s) => (ae(s) && (s.value = Object.freeze(s.value)), s);
|
|
2842
|
+
return ie(t) ? t.then((s) => n(s)) : n(t);
|
|
2824
2843
|
}
|
|
2825
2844
|
unwrap() {
|
|
2826
2845
|
return this._def.innerType;
|
|
2827
2846
|
}
|
|
2828
2847
|
}
|
|
2829
|
-
|
|
2848
|
+
ve.create = (r, e) => new ve({
|
|
2830
2849
|
innerType: r,
|
|
2831
2850
|
typeName: _.ZodReadonly,
|
|
2832
2851
|
...v(e)
|
|
2833
2852
|
});
|
|
2834
|
-
function
|
|
2853
|
+
function rt(r, e = {}, t) {
|
|
2835
2854
|
return r ? K.create().superRefine((n, s) => {
|
|
2836
|
-
var a,
|
|
2855
|
+
var a, i;
|
|
2837
2856
|
if (!r(n)) {
|
|
2838
|
-
const
|
|
2857
|
+
const o = typeof e == "function" ? e(n) : typeof e == "string" ? { message: e } : e, u = (i = (a = o.fatal) !== null && a !== void 0 ? a : t) !== null && i !== void 0 ? i : !0, d = typeof o == "string" ? { message: o } : o;
|
|
2839
2858
|
s.addIssue({ code: "custom", ...d, fatal: u });
|
|
2840
2859
|
}
|
|
2841
2860
|
}) : K.create();
|
|
2842
2861
|
}
|
|
2843
|
-
const
|
|
2862
|
+
const Dt = {
|
|
2844
2863
|
object: b.lazycreate
|
|
2845
2864
|
};
|
|
2846
2865
|
var _;
|
|
2847
2866
|
(function(r) {
|
|
2848
2867
|
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";
|
|
2849
2868
|
})(_ || (_ = {}));
|
|
2850
|
-
const
|
|
2869
|
+
const Lt = (r, e = {
|
|
2851
2870
|
message: `Input not instance of ${r.name}`
|
|
2852
|
-
}) =>
|
|
2853
|
-
string: (r) =>
|
|
2871
|
+
}) => rt((t) => t instanceof r, e), nt = j.create, st = D.create, Ut = je.create, zt = L.create, at = oe.create, Bt = q.create, Wt = Ze.create, qt = de.create, Jt = ce.create, Ht = K.create, Yt = W.create, Gt = M.create, Xt = Se.create, Kt = E.create, Qt = b.create, Ft = b.strictCreate, er = ue.create, tr = Ce.create, rr = le.create, nr = I.create, sr = fe.create, ar = Oe.create, ir = J.create, or = G.create, dr = he.create, cr = pe.create, ur = U.create, lr = me.create, fr = Q.create, Ge = C.create, hr = N.create, pr = z.create, mr = C.createWithPreprocess, _r = ge.create, yr = () => nt().optional(), vr = () => st().optional(), gr = () => at().optional(), xr = {
|
|
2872
|
+
string: (r) => j.create({ ...r, coerce: !0 }),
|
|
2854
2873
|
number: (r) => D.create({ ...r, coerce: !0 }),
|
|
2855
|
-
boolean: (r) =>
|
|
2874
|
+
boolean: (r) => oe.create({
|
|
2856
2875
|
...r,
|
|
2857
2876
|
coerce: !0
|
|
2858
2877
|
}),
|
|
2859
2878
|
bigint: (r) => L.create({ ...r, coerce: !0 }),
|
|
2860
2879
|
date: (r) => q.create({ ...r, coerce: !0 })
|
|
2861
|
-
},
|
|
2862
|
-
var
|
|
2880
|
+
}, br = y;
|
|
2881
|
+
var h = /* @__PURE__ */ Object.freeze({
|
|
2863
2882
|
__proto__: null,
|
|
2864
2883
|
defaultErrorMap: X,
|
|
2865
|
-
setErrorMap:
|
|
2866
|
-
getErrorMap:
|
|
2867
|
-
makeIssue:
|
|
2868
|
-
EMPTY_PATH:
|
|
2884
|
+
setErrorMap: bt,
|
|
2885
|
+
getErrorMap: ke,
|
|
2886
|
+
makeIssue: we,
|
|
2887
|
+
EMPTY_PATH: kt,
|
|
2869
2888
|
addIssueToContext: l,
|
|
2870
2889
|
ParseStatus: T,
|
|
2871
2890
|
INVALID: y,
|
|
2872
|
-
DIRTY:
|
|
2891
|
+
DIRTY: Y,
|
|
2873
2892
|
OK: Z,
|
|
2874
|
-
isAborted:
|
|
2875
|
-
isDirty:
|
|
2876
|
-
isValid:
|
|
2877
|
-
isAsync:
|
|
2893
|
+
isAborted: We,
|
|
2894
|
+
isDirty: qe,
|
|
2895
|
+
isValid: ae,
|
|
2896
|
+
isAsync: ie,
|
|
2878
2897
|
get util() {
|
|
2879
2898
|
return x;
|
|
2880
2899
|
},
|
|
2881
2900
|
get objectUtil() {
|
|
2882
|
-
return
|
|
2901
|
+
return Be;
|
|
2883
2902
|
},
|
|
2884
2903
|
ZodParsedType: f,
|
|
2885
2904
|
getParsedType: V,
|
|
2886
2905
|
ZodType: g,
|
|
2887
|
-
datetimeRegex:
|
|
2888
|
-
ZodString:
|
|
2906
|
+
datetimeRegex: et,
|
|
2907
|
+
ZodString: j,
|
|
2889
2908
|
ZodNumber: D,
|
|
2890
2909
|
ZodBigInt: L,
|
|
2891
|
-
ZodBoolean:
|
|
2910
|
+
ZodBoolean: oe,
|
|
2892
2911
|
ZodDate: q,
|
|
2893
|
-
ZodSymbol:
|
|
2894
|
-
ZodUndefined:
|
|
2895
|
-
ZodNull:
|
|
2912
|
+
ZodSymbol: Ze,
|
|
2913
|
+
ZodUndefined: de,
|
|
2914
|
+
ZodNull: ce,
|
|
2896
2915
|
ZodAny: K,
|
|
2897
2916
|
ZodUnknown: W,
|
|
2898
2917
|
ZodNever: M,
|
|
2899
|
-
ZodVoid:
|
|
2900
|
-
ZodArray:
|
|
2918
|
+
ZodVoid: Se,
|
|
2919
|
+
ZodArray: E,
|
|
2901
2920
|
ZodObject: b,
|
|
2902
|
-
ZodUnion:
|
|
2903
|
-
ZodDiscriminatedUnion:
|
|
2904
|
-
ZodIntersection:
|
|
2921
|
+
ZodUnion: ue,
|
|
2922
|
+
ZodDiscriminatedUnion: Ce,
|
|
2923
|
+
ZodIntersection: le,
|
|
2905
2924
|
ZodTuple: I,
|
|
2906
|
-
ZodRecord:
|
|
2907
|
-
ZodMap:
|
|
2925
|
+
ZodRecord: fe,
|
|
2926
|
+
ZodMap: Oe,
|
|
2908
2927
|
ZodSet: J,
|
|
2909
2928
|
ZodFunction: G,
|
|
2910
|
-
ZodLazy:
|
|
2911
|
-
ZodLiteral:
|
|
2929
|
+
ZodLazy: he,
|
|
2930
|
+
ZodLiteral: pe,
|
|
2912
2931
|
ZodEnum: U,
|
|
2913
|
-
ZodNativeEnum:
|
|
2932
|
+
ZodNativeEnum: me,
|
|
2914
2933
|
ZodPromise: Q,
|
|
2915
2934
|
ZodEffects: C,
|
|
2916
2935
|
ZodTransformer: C,
|
|
2917
2936
|
ZodOptional: N,
|
|
2918
2937
|
ZodNullable: z,
|
|
2919
|
-
ZodDefault:
|
|
2920
|
-
ZodCatch:
|
|
2921
|
-
ZodNaN:
|
|
2922
|
-
BRAND:
|
|
2923
|
-
ZodBranded:
|
|
2924
|
-
ZodPipeline:
|
|
2925
|
-
ZodReadonly:
|
|
2926
|
-
custom:
|
|
2938
|
+
ZodDefault: _e,
|
|
2939
|
+
ZodCatch: ye,
|
|
2940
|
+
ZodNaN: je,
|
|
2941
|
+
BRAND: Vt,
|
|
2942
|
+
ZodBranded: He,
|
|
2943
|
+
ZodPipeline: ge,
|
|
2944
|
+
ZodReadonly: ve,
|
|
2945
|
+
custom: rt,
|
|
2927
2946
|
Schema: g,
|
|
2928
2947
|
ZodSchema: g,
|
|
2929
|
-
late:
|
|
2948
|
+
late: Dt,
|
|
2930
2949
|
get ZodFirstPartyTypeKind() {
|
|
2931
2950
|
return _;
|
|
2932
2951
|
},
|
|
2933
|
-
coerce:
|
|
2934
|
-
any:
|
|
2935
|
-
array:
|
|
2936
|
-
bigint:
|
|
2937
|
-
boolean:
|
|
2938
|
-
date:
|
|
2939
|
-
discriminatedUnion:
|
|
2940
|
-
effect:
|
|
2941
|
-
enum:
|
|
2942
|
-
function:
|
|
2943
|
-
instanceof:
|
|
2944
|
-
intersection:
|
|
2945
|
-
lazy:
|
|
2946
|
-
literal:
|
|
2947
|
-
map:
|
|
2948
|
-
nan:
|
|
2949
|
-
nativeEnum:
|
|
2950
|
-
never:
|
|
2951
|
-
null:
|
|
2952
|
-
nullable:
|
|
2953
|
-
number:
|
|
2954
|
-
object:
|
|
2955
|
-
oboolean:
|
|
2956
|
-
onumber:
|
|
2957
|
-
optional:
|
|
2958
|
-
ostring:
|
|
2959
|
-
pipeline:
|
|
2960
|
-
preprocess:
|
|
2961
|
-
promise:
|
|
2962
|
-
record:
|
|
2963
|
-
set:
|
|
2964
|
-
strictObject:
|
|
2965
|
-
string:
|
|
2966
|
-
symbol:
|
|
2967
|
-
transformer:
|
|
2968
|
-
tuple:
|
|
2969
|
-
undefined:
|
|
2970
|
-
union:
|
|
2971
|
-
unknown:
|
|
2972
|
-
void:
|
|
2973
|
-
NEVER:
|
|
2952
|
+
coerce: xr,
|
|
2953
|
+
any: Ht,
|
|
2954
|
+
array: Kt,
|
|
2955
|
+
bigint: zt,
|
|
2956
|
+
boolean: at,
|
|
2957
|
+
date: Bt,
|
|
2958
|
+
discriminatedUnion: tr,
|
|
2959
|
+
effect: Ge,
|
|
2960
|
+
enum: ur,
|
|
2961
|
+
function: or,
|
|
2962
|
+
instanceof: Lt,
|
|
2963
|
+
intersection: rr,
|
|
2964
|
+
lazy: dr,
|
|
2965
|
+
literal: cr,
|
|
2966
|
+
map: ar,
|
|
2967
|
+
nan: Ut,
|
|
2968
|
+
nativeEnum: lr,
|
|
2969
|
+
never: Gt,
|
|
2970
|
+
null: Jt,
|
|
2971
|
+
nullable: pr,
|
|
2972
|
+
number: st,
|
|
2973
|
+
object: Qt,
|
|
2974
|
+
oboolean: gr,
|
|
2975
|
+
onumber: vr,
|
|
2976
|
+
optional: hr,
|
|
2977
|
+
ostring: yr,
|
|
2978
|
+
pipeline: _r,
|
|
2979
|
+
preprocess: mr,
|
|
2980
|
+
promise: fr,
|
|
2981
|
+
record: sr,
|
|
2982
|
+
set: ir,
|
|
2983
|
+
strictObject: Ft,
|
|
2984
|
+
string: nt,
|
|
2985
|
+
symbol: Wt,
|
|
2986
|
+
transformer: Ge,
|
|
2987
|
+
tuple: nr,
|
|
2988
|
+
undefined: qt,
|
|
2989
|
+
union: er,
|
|
2990
|
+
unknown: Yt,
|
|
2991
|
+
void: Xt,
|
|
2992
|
+
NEVER: br,
|
|
2974
2993
|
ZodIssueCode: c,
|
|
2975
|
-
quotelessJson:
|
|
2994
|
+
quotelessJson: xt,
|
|
2976
2995
|
ZodError: S
|
|
2977
2996
|
});
|
|
2978
|
-
|
|
2979
|
-
const
|
|
2980
|
-
code:
|
|
2981
|
-
message:
|
|
2982
|
-
}),
|
|
2983
|
-
message:
|
|
2984
|
-
}),
|
|
2985
|
-
emails:
|
|
2986
|
-
http_body:
|
|
2987
|
-
http_url:
|
|
2988
|
-
txt_name:
|
|
2989
|
-
txt_value:
|
|
2990
|
-
}),
|
|
2991
|
-
ciphers:
|
|
2992
|
-
early_hints:
|
|
2993
|
-
http2:
|
|
2994
|
-
min_tls_version:
|
|
2995
|
-
tls_1_3:
|
|
2996
|
-
}),
|
|
2997
|
-
id:
|
|
2998
|
-
bundle_method:
|
|
2999
|
-
certificate_authority:
|
|
3000
|
-
custom_certificate:
|
|
3001
|
-
custom_csr_id:
|
|
3002
|
-
custom_key:
|
|
3003
|
-
expires_on:
|
|
3004
|
-
hosts:
|
|
3005
|
-
issuer:
|
|
3006
|
-
method:
|
|
3007
|
-
serial_number:
|
|
3008
|
-
settings:
|
|
3009
|
-
signature:
|
|
3010
|
-
type:
|
|
3011
|
-
uploaded_on:
|
|
3012
|
-
validation_errors:
|
|
3013
|
-
validation_records:
|
|
3014
|
-
wildcard:
|
|
3015
|
-
}),
|
|
3016
|
-
name:
|
|
3017
|
-
type:
|
|
3018
|
-
value:
|
|
3019
|
-
}),
|
|
3020
|
-
http_body:
|
|
3021
|
-
http_url:
|
|
3022
|
-
}),
|
|
3023
|
-
id:
|
|
3024
|
-
ssl:
|
|
3025
|
-
|
|
3026
|
-
|
|
3027
|
-
|
|
3028
|
-
|
|
3029
|
-
|
|
3030
|
-
|
|
3031
|
-
|
|
3032
|
-
|
|
3033
|
-
|
|
3034
|
-
|
|
3035
|
-
|
|
3036
|
-
|
|
2997
|
+
gt(h);
|
|
2998
|
+
const Ee = h.object({
|
|
2999
|
+
code: h.number(),
|
|
3000
|
+
message: h.string()
|
|
3001
|
+
}), kr = h.object({
|
|
3002
|
+
message: h.string()
|
|
3003
|
+
}), wr = h.object({
|
|
3004
|
+
emails: h.array(h.string()).optional(),
|
|
3005
|
+
http_body: h.string(),
|
|
3006
|
+
http_url: h.string(),
|
|
3007
|
+
txt_name: h.string().optional(),
|
|
3008
|
+
txt_value: h.string().optional()
|
|
3009
|
+
}), Tr = h.object({
|
|
3010
|
+
ciphers: h.array(h.string()),
|
|
3011
|
+
early_hints: h.string(),
|
|
3012
|
+
http2: h.string(),
|
|
3013
|
+
min_tls_version: h.string(),
|
|
3014
|
+
tls_1_3: h.string()
|
|
3015
|
+
}), Zr = h.object({
|
|
3016
|
+
id: h.string(),
|
|
3017
|
+
bundle_method: h.string().optional(),
|
|
3018
|
+
certificate_authority: h.string(),
|
|
3019
|
+
custom_certificate: h.string().optional(),
|
|
3020
|
+
custom_csr_id: h.string().optional(),
|
|
3021
|
+
custom_key: h.string().optional(),
|
|
3022
|
+
expires_on: h.string().optional(),
|
|
3023
|
+
hosts: h.array(h.string()).optional(),
|
|
3024
|
+
issuer: h.string().optional(),
|
|
3025
|
+
method: h.string(),
|
|
3026
|
+
serial_number: h.string().optional(),
|
|
3027
|
+
settings: Tr.optional(),
|
|
3028
|
+
signature: h.string().optional(),
|
|
3029
|
+
type: h.string(),
|
|
3030
|
+
uploaded_on: h.string().optional(),
|
|
3031
|
+
validation_errors: h.array(kr).optional(),
|
|
3032
|
+
validation_records: h.array(wr).optional(),
|
|
3033
|
+
wildcard: h.boolean()
|
|
3034
|
+
}), Sr = h.object({
|
|
3035
|
+
name: h.string(),
|
|
3036
|
+
type: h.string(),
|
|
3037
|
+
value: h.string()
|
|
3038
|
+
}), Or = h.object({
|
|
3039
|
+
http_body: h.string(),
|
|
3040
|
+
http_url: h.string()
|
|
3041
|
+
}), it = h.object({
|
|
3042
|
+
id: h.string(),
|
|
3043
|
+
ssl: Zr,
|
|
3044
|
+
hostname: h.string(),
|
|
3045
|
+
custom_metadata: h.record(h.string()).optional(),
|
|
3046
|
+
custom_origin_server: h.string().optional(),
|
|
3047
|
+
custom_origin_sni: h.string().optional(),
|
|
3048
|
+
ownership_verification: Sr,
|
|
3049
|
+
ownership_verification_http: Or,
|
|
3050
|
+
status: h.string(),
|
|
3051
|
+
verification_errors: h.array(h.string()).optional(),
|
|
3052
|
+
created_at: h.string()
|
|
3053
|
+
}), Ue = h.object({
|
|
3054
|
+
errors: h.array(Ee),
|
|
3055
|
+
messages: h.array(Ee),
|
|
3056
|
+
success: h.boolean(),
|
|
3057
|
+
result: it
|
|
3058
|
+
}), jr = h.object({
|
|
3059
|
+
errors: h.array(Ee),
|
|
3060
|
+
messages: h.array(Ee),
|
|
3061
|
+
success: h.boolean(),
|
|
3062
|
+
result: h.array(it)
|
|
3037
3063
|
});
|
|
3038
|
-
function
|
|
3039
|
-
return
|
|
3064
|
+
function re(r) {
|
|
3065
|
+
return ct(`https://api.cloudflare.com/client/v4/zones/${r.zoneId}`).headers({
|
|
3040
3066
|
"X-Auth-Email": r.authEmail,
|
|
3041
3067
|
"X-Auth-Key": r.authKey,
|
|
3042
3068
|
"Content-Type": "application/json"
|
|
3043
|
-
}).middlewares([
|
|
3069
|
+
}).middlewares([_t(), ht()]);
|
|
3070
|
+
}
|
|
3071
|
+
function ze(r) {
|
|
3072
|
+
return {
|
|
3073
|
+
custom_domain_id: r.id,
|
|
3074
|
+
domain: r.hostname,
|
|
3075
|
+
primary: !1,
|
|
3076
|
+
status: r.status === "active" ? "ready" : "pending",
|
|
3077
|
+
type: "auth0_managed_certs"
|
|
3078
|
+
};
|
|
3044
3079
|
}
|
|
3045
|
-
function
|
|
3080
|
+
function Er(r) {
|
|
3046
3081
|
return {
|
|
3047
3082
|
create: async (e, t) => {
|
|
3048
|
-
const { result: n, errors: s, success: a } =
|
|
3049
|
-
await
|
|
3083
|
+
const { result: n, errors: s, success: a } = Ue.parse(
|
|
3084
|
+
await re(r).post(
|
|
3050
3085
|
{
|
|
3051
3086
|
hostname: t.domain,
|
|
3052
3087
|
ssl: {
|
|
3053
3088
|
method: "http",
|
|
3054
3089
|
type: "dv"
|
|
3055
|
-
}
|
|
3090
|
+
},
|
|
3091
|
+
custom_metadata: r.enterprise ? {
|
|
3092
|
+
tenant_id: e
|
|
3093
|
+
} : void 0
|
|
3056
3094
|
},
|
|
3057
3095
|
"/custom_hostnames"
|
|
3058
3096
|
).json()
|
|
3059
3097
|
);
|
|
3060
3098
|
if (!a)
|
|
3061
3099
|
throw new Error(JSON.stringify(s));
|
|
3062
|
-
return
|
|
3063
|
-
custom_domain_id: n.id,
|
|
3064
|
-
tenant_id: e,
|
|
3065
|
-
domain: n.ssl.hosts[0],
|
|
3066
|
-
primary: !1,
|
|
3067
|
-
status: n.status === "active" ? "ready" : "pending",
|
|
3068
|
-
type: "auth0_managed_certs"
|
|
3069
|
-
};
|
|
3100
|
+
return ze(n);
|
|
3070
3101
|
},
|
|
3071
3102
|
get: async (e, t) => {
|
|
3072
|
-
|
|
3103
|
+
var i;
|
|
3104
|
+
const { result: n, errors: s, success: a } = Ue.parse(
|
|
3105
|
+
await re(r).get(`/custom_hostnames/${encodeURIComponent(t)}`).json()
|
|
3106
|
+
);
|
|
3107
|
+
if (!a)
|
|
3108
|
+
throw new be(503, {
|
|
3109
|
+
message: JSON.stringify(s)
|
|
3110
|
+
});
|
|
3111
|
+
if (r.enterprise && ((i = n.custom_metadata) == null ? void 0 : i.tenant_id) !== e)
|
|
3112
|
+
throw new be(404);
|
|
3113
|
+
return ze(n);
|
|
3073
3114
|
},
|
|
3074
3115
|
list: async (e) => {
|
|
3075
|
-
|
|
3116
|
+
const { result: t, errors: n, success: s } = jr.parse(
|
|
3117
|
+
await re(r).get("/custom_hostnames").json()
|
|
3118
|
+
);
|
|
3119
|
+
if (!s)
|
|
3120
|
+
throw new be(503, {
|
|
3121
|
+
message: JSON.stringify(n)
|
|
3122
|
+
});
|
|
3123
|
+
return t.filter(
|
|
3124
|
+
(a) => {
|
|
3125
|
+
var i;
|
|
3126
|
+
return !(r.enterprise && ((i = a.custom_metadata) == null ? void 0 : i.tenant_id) !== e);
|
|
3127
|
+
}
|
|
3128
|
+
).map(ze);
|
|
3076
3129
|
},
|
|
3077
3130
|
remove: async (e, t) => {
|
|
3078
|
-
|
|
3131
|
+
var s;
|
|
3132
|
+
if (r.enterprise) {
|
|
3133
|
+
const { result: a, success: i } = Ue.parse(
|
|
3134
|
+
await re(r).get(`/custom_hostnames/${encodeURIComponent(t)}`).json()
|
|
3135
|
+
);
|
|
3136
|
+
if (!i || ((s = a.custom_metadata) == null ? void 0 : s.tenant_id) !== e)
|
|
3137
|
+
throw new be(404);
|
|
3138
|
+
}
|
|
3139
|
+
return (await re(r).delete(`/custom_hostnames/${encodeURIComponent(t)}`).res()).ok;
|
|
3079
3140
|
},
|
|
3080
3141
|
update: async (e, t) => {
|
|
3081
3142
|
throw console.log("update", e, t), new Error("Not implemented");
|
|
3082
3143
|
}
|
|
3083
3144
|
};
|
|
3084
3145
|
}
|
|
3085
|
-
function
|
|
3146
|
+
function Rr(r) {
|
|
3086
3147
|
return {
|
|
3087
|
-
customDomains:
|
|
3148
|
+
customDomains: Er(r)
|
|
3088
3149
|
};
|
|
3089
3150
|
}
|
|
3090
3151
|
export {
|
|
3091
|
-
|
|
3152
|
+
Rr as default
|
|
3092
3153
|
};
|