@authhero/adapter-interfaces 0.36.0 → 0.37.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,3210 +1,282 @@
1
- function it(t, e) {
2
- var n = {};
3
- for (var s in t) Object.prototype.hasOwnProperty.call(t, s) && e.indexOf(s) < 0 && (n[s] = t[s]);
4
- if (t != null && typeof Object.getOwnPropertySymbols == "function")
5
- for (var a = 0, s = Object.getOwnPropertySymbols(t); a < s.length; a++)
6
- e.indexOf(s[a]) < 0 && Object.prototype.propertyIsEnumerable.call(t, s[a]) && (n[s[a]] = t[s[a]]);
7
- return n;
8
- }
9
- function ot(t, e) {
10
- var n;
11
- return ((n = t == null ? void 0 : t._def) === null || n === void 0 ? void 0 : n.typeName) === e;
12
- }
13
- function J(t, e) {
14
- const n = t.ZodType.prototype[e];
15
- t.ZodType.prototype[e] = function(...s) {
16
- const a = n.apply(this, s);
17
- return a._def.openapi = this._def.openapi, a;
18
- };
19
- }
20
- function dt(t) {
21
- if (typeof t.ZodType.prototype.openapi < "u")
22
- return;
23
- t.ZodType.prototype.openapi = function(a, i) {
24
- var o, d, u, l, m, x;
25
- const B = typeof a == "string" ? i : a, z = B ?? {}, { param: Me } = z, rt = it(z, ["param"]), Ue = Object.assign(Object.assign({}, (o = this._def.openapi) === null || o === void 0 ? void 0 : o._internal), typeof a == "string" ? { refId: a } : void 0), $e = Object.assign(Object.assign(Object.assign({}, (d = this._def.openapi) === null || d === void 0 ? void 0 : d.metadata), rt), !((l = (u = this._def.openapi) === null || u === void 0 ? void 0 : u.metadata) === null || l === void 0) && l.param || Me ? {
26
- param: Object.assign(Object.assign({}, (x = (m = this._def.openapi) === null || m === void 0 ? void 0 : m.metadata) === null || x === void 0 ? void 0 : x.param), Me)
27
- } : void 0), Ve = new this.constructor(Object.assign(Object.assign({}, this._def), { openapi: Object.assign(Object.assign({}, Object.keys(Ue).length > 0 ? { _internal: Ue } : void 0), Object.keys($e).length > 0 ? { metadata: $e } : void 0) }));
28
- if (ot(this, "ZodObject")) {
29
- const st = this.extend;
30
- Ve.extend = function(...at) {
31
- var we, Se, Te, Ee, Ce, Oe;
32
- const je = st.apply(this, at);
33
- return je._def.openapi = {
34
- _internal: {
35
- extendedFrom: !((Se = (we = this._def.openapi) === null || we === void 0 ? void 0 : we._internal) === null || Se === void 0) && Se.refId ? { refId: (Ee = (Te = this._def.openapi) === null || Te === void 0 ? void 0 : Te._internal) === null || Ee === void 0 ? void 0 : Ee.refId, schema: this } : (Ce = this._def.openapi) === null || Ce === void 0 ? void 0 : Ce._internal.extendedFrom
36
- },
37
- metadata: (Oe = je._def.openapi) === null || Oe === void 0 ? void 0 : Oe.metadata
38
- }, je;
39
- };
40
- }
41
- return Ve;
42
- }, J(t, "optional"), J(t, "nullable"), J(t, "default"), J(t, "transform"), J(t, "refine");
43
- const e = t.ZodObject.prototype.deepPartial;
44
- t.ZodObject.prototype.deepPartial = function() {
45
- const a = this._def.shape(), i = e.apply(this), o = i._def.shape();
46
- return Object.entries(o).forEach(([d, u]) => {
47
- var l, m;
48
- u._def.openapi = (m = (l = a[d]) === null || l === void 0 ? void 0 : l._def) === null || m === void 0 ? void 0 : m.openapi;
49
- }), i._def.openapi = void 0, i;
50
- };
51
- const n = t.ZodObject.prototype.pick;
52
- t.ZodObject.prototype.pick = function(...a) {
53
- const i = n.apply(this, a);
54
- return i._def.openapi = void 0, i;
55
- };
56
- const s = t.ZodObject.prototype.omit;
57
- t.ZodObject.prototype.omit = function(...a) {
58
- const i = s.apply(this, a);
59
- return i._def.openapi = void 0, i;
60
- };
61
- }
62
- new Set(".\\+*[^]$()");
63
- var b;
64
- (function(t) {
65
- t.assertEqual = (a) => a;
66
- function e(a) {
67
- }
68
- t.assertIs = e;
69
- function n(a) {
70
- throw new Error();
71
- }
72
- t.assertNever = n, t.arrayToEnum = (a) => {
73
- const i = {};
74
- for (const o of a)
75
- i[o] = o;
76
- return i;
77
- }, t.getValidEnumValues = (a) => {
78
- const i = t.objectKeys(a).filter((d) => typeof a[a[d]] != "number"), o = {};
79
- for (const d of i)
80
- o[d] = a[d];
81
- return t.objectValues(o);
82
- }, t.objectValues = (a) => t.objectKeys(a).map(function(i) {
83
- return a[i];
84
- }), t.objectKeys = typeof Object.keys == "function" ? (a) => Object.keys(a) : (a) => {
85
- const i = [];
86
- for (const o in a)
87
- Object.prototype.hasOwnProperty.call(a, o) && i.push(o);
88
- return i;
89
- }, t.find = (a, i) => {
90
- for (const o of a)
91
- if (i(o))
92
- return o;
93
- }, t.isInteger = typeof Number.isInteger == "function" ? (a) => Number.isInteger(a) : (a) => typeof a == "number" && isFinite(a) && Math.floor(a) === a;
94
- function s(a, i = " | ") {
95
- return a.map((o) => typeof o == "string" ? `'${o}'` : o).join(i);
96
- }
97
- t.joinValues = s, t.jsonStringifyReplacer = (a, i) => typeof i == "bigint" ? i.toString() : i;
98
- })(b || (b = {}));
99
- var Ne;
100
- (function(t) {
101
- t.mergeShapes = (e, n) => ({
102
- ...e,
103
- ...n
104
- // second overwrites first
105
- });
106
- })(Ne || (Ne = {}));
107
- const f = b.arrayToEnum([
108
- "string",
109
- "nan",
110
- "number",
111
- "integer",
112
- "float",
113
- "boolean",
114
- "date",
115
- "bigint",
116
- "symbol",
117
- "function",
118
- "undefined",
119
- "null",
120
- "array",
121
- "object",
122
- "unknown",
123
- "promise",
124
- "void",
125
- "never",
126
- "map",
127
- "set"
128
- ]), A = (t) => {
129
- switch (typeof t) {
130
- case "undefined":
131
- return f.undefined;
132
- case "string":
133
- return f.string;
134
- case "number":
135
- return isNaN(t) ? f.nan : f.number;
136
- case "boolean":
137
- return f.boolean;
138
- case "function":
139
- return f.function;
140
- case "bigint":
141
- return f.bigint;
142
- case "symbol":
143
- return f.symbol;
144
- case "object":
145
- return Array.isArray(t) ? f.array : t === null ? f.null : t.then && typeof t.then == "function" && t.catch && typeof t.catch == "function" ? f.promise : typeof Map < "u" && t instanceof Map ? f.map : typeof Set < "u" && t instanceof Set ? f.set : typeof Date < "u" && t instanceof Date ? f.date : f.object;
146
- default:
147
- return f.unknown;
148
- }
149
- }, c = b.arrayToEnum([
150
- "invalid_type",
151
- "invalid_literal",
152
- "custom",
153
- "invalid_union",
154
- "invalid_union_discriminator",
155
- "invalid_enum_value",
156
- "unrecognized_keys",
157
- "invalid_arguments",
158
- "invalid_return_type",
159
- "invalid_date",
160
- "invalid_string",
161
- "too_small",
162
- "too_big",
163
- "invalid_intersection_types",
164
- "not_multiple_of",
165
- "not_finite"
166
- ]), ct = (t) => JSON.stringify(t, null, 2).replace(/"([^"]+)":/g, "$1:");
167
- class T extends Error {
168
- constructor(e) {
169
- super(), this.issues = [], this.addIssue = (s) => {
170
- this.issues = [...this.issues, s];
171
- }, this.addIssues = (s = []) => {
172
- this.issues = [...this.issues, ...s];
173
- };
174
- const n = new.target.prototype;
175
- Object.setPrototypeOf ? Object.setPrototypeOf(this, n) : this.__proto__ = n, this.name = "ZodError", this.issues = e;
176
- }
177
- get errors() {
178
- return this.issues;
179
- }
180
- format(e) {
181
- const n = e || function(i) {
182
- return i.message;
183
- }, s = { _errors: [] }, a = (i) => {
184
- for (const o of i.issues)
185
- if (o.code === "invalid_union")
186
- o.unionErrors.map(a);
187
- else if (o.code === "invalid_return_type")
188
- a(o.returnTypeError);
189
- else if (o.code === "invalid_arguments")
190
- a(o.argumentsError);
191
- else if (o.path.length === 0)
192
- s._errors.push(n(o));
193
- else {
194
- let d = s, u = 0;
195
- for (; u < o.path.length; ) {
196
- const l = o.path[u];
197
- u === o.path.length - 1 ? (d[l] = d[l] || { _errors: [] }, d[l]._errors.push(n(o))) : d[l] = d[l] || { _errors: [] }, d = d[l], u++;
198
- }
199
- }
200
- };
201
- return a(this), s;
202
- }
203
- static assert(e) {
204
- if (!(e instanceof T))
205
- throw new Error(`Not a ZodError: ${e}`);
206
- }
207
- toString() {
208
- return this.message;
209
- }
210
- get message() {
211
- return JSON.stringify(this.issues, b.jsonStringifyReplacer, 2);
212
- }
213
- get isEmpty() {
214
- return this.issues.length === 0;
215
- }
216
- flatten(e = (n) => n.message) {
217
- const n = {}, s = [];
218
- for (const a of this.issues)
219
- a.path.length > 0 ? (n[a.path[0]] = n[a.path[0]] || [], n[a.path[0]].push(e(a))) : s.push(e(a));
220
- return { formErrors: s, fieldErrors: n };
221
- }
222
- get formErrors() {
223
- return this.flatten();
224
- }
225
- }
226
- T.create = (t) => new T(t);
227
- const K = (t, e) => {
228
- let n;
229
- switch (t.code) {
230
- case c.invalid_type:
231
- t.received === f.undefined ? n = "Required" : n = `Expected ${t.expected}, received ${t.received}`;
232
- break;
233
- case c.invalid_literal:
234
- n = `Invalid literal value, expected ${JSON.stringify(t.expected, b.jsonStringifyReplacer)}`;
235
- break;
236
- case c.unrecognized_keys:
237
- n = `Unrecognized key(s) in object: ${b.joinValues(t.keys, ", ")}`;
238
- break;
239
- case c.invalid_union:
240
- n = "Invalid input";
241
- break;
242
- case c.invalid_union_discriminator:
243
- n = `Invalid discriminator value. Expected ${b.joinValues(t.options)}`;
244
- break;
245
- case c.invalid_enum_value:
246
- n = `Invalid enum value. Expected ${b.joinValues(t.options)}, received '${t.received}'`;
247
- break;
248
- case c.invalid_arguments:
249
- n = "Invalid function arguments";
250
- break;
251
- case c.invalid_return_type:
252
- n = "Invalid function return type";
253
- break;
254
- case c.invalid_date:
255
- n = "Invalid date";
256
- break;
257
- case c.invalid_string:
258
- typeof t.validation == "object" ? "includes" in t.validation ? (n = `Invalid input: must include "${t.validation.includes}"`, typeof t.validation.position == "number" && (n = `${n} at one or more positions greater than or equal to ${t.validation.position}`)) : "startsWith" in t.validation ? n = `Invalid input: must start with "${t.validation.startsWith}"` : "endsWith" in t.validation ? n = `Invalid input: must end with "${t.validation.endsWith}"` : b.assertNever(t.validation) : t.validation !== "regex" ? n = `Invalid ${t.validation}` : n = "Invalid";
259
- break;
260
- case c.too_small:
261
- t.type === "array" ? n = `Array must contain ${t.exact ? "exactly" : t.inclusive ? "at least" : "more than"} ${t.minimum} element(s)` : t.type === "string" ? n = `String must contain ${t.exact ? "exactly" : t.inclusive ? "at least" : "over"} ${t.minimum} character(s)` : t.type === "number" ? n = `Number must be ${t.exact ? "exactly equal to " : t.inclusive ? "greater than or equal to " : "greater than "}${t.minimum}` : t.type === "date" ? n = `Date must be ${t.exact ? "exactly equal to " : t.inclusive ? "greater than or equal to " : "greater than "}${new Date(Number(t.minimum))}` : n = "Invalid input";
262
- break;
263
- case c.too_big:
264
- t.type === "array" ? n = `Array must contain ${t.exact ? "exactly" : t.inclusive ? "at most" : "less than"} ${t.maximum} element(s)` : t.type === "string" ? n = `String must contain ${t.exact ? "exactly" : t.inclusive ? "at most" : "under"} ${t.maximum} character(s)` : t.type === "number" ? n = `Number must be ${t.exact ? "exactly" : t.inclusive ? "less than or equal to" : "less than"} ${t.maximum}` : t.type === "bigint" ? n = `BigInt must be ${t.exact ? "exactly" : t.inclusive ? "less than or equal to" : "less than"} ${t.maximum}` : t.type === "date" ? n = `Date must be ${t.exact ? "exactly" : t.inclusive ? "smaller than or equal to" : "smaller than"} ${new Date(Number(t.maximum))}` : n = "Invalid input";
265
- break;
266
- case c.custom:
267
- n = "Invalid input";
268
- break;
269
- case c.invalid_intersection_types:
270
- n = "Intersection results could not be merged";
271
- break;
272
- case c.not_multiple_of:
273
- n = `Number must be a multiple of ${t.multipleOf}`;
274
- break;
275
- case c.not_finite:
276
- n = "Number must be finite";
277
- break;
278
- default:
279
- n = e.defaultError, b.assertNever(t);
280
- }
281
- return { message: n };
282
- };
283
- let ze = K;
284
- function lt(t) {
285
- ze = t;
286
- }
287
- function me() {
288
- return ze;
289
- }
290
- const _e = (t) => {
291
- const { data: e, path: n, errorMaps: s, issueData: a } = t, i = [...n, ...a.path || []], o = {
292
- ...a,
293
- path: i
294
- };
295
- if (a.message !== void 0)
296
- return {
297
- ...a,
298
- path: i,
299
- message: a.message
300
- };
301
- let d = "";
302
- const u = s.filter((l) => !!l).slice().reverse();
303
- for (const l of u)
304
- d = l(o, { data: e, defaultError: d }).message;
305
- return {
306
- ...a,
307
- path: i,
308
- message: d
309
- };
310
- }, ut = [];
311
- function p(t, e) {
312
- const n = me(), s = _e({
313
- issueData: e,
314
- data: t.data,
315
- path: t.path,
316
- errorMaps: [
317
- t.common.contextualErrorMap,
318
- t.schemaErrorMap,
319
- n,
320
- n === K ? void 0 : K
321
- // then global default map
322
- ].filter((a) => !!a)
323
- });
324
- t.common.issues.push(s);
325
- }
326
- class w {
327
- constructor() {
328
- this.value = "valid";
329
- }
330
- dirty() {
331
- this.value === "valid" && (this.value = "dirty");
332
- }
333
- abort() {
334
- this.value !== "aborted" && (this.value = "aborted");
335
- }
336
- static mergeArray(e, n) {
337
- const s = [];
338
- for (const a of n) {
339
- if (a.status === "aborted")
340
- return g;
341
- a.status === "dirty" && e.dirty(), s.push(a.value);
342
- }
343
- return { status: e.value, value: s };
344
- }
345
- static async mergeObjectAsync(e, n) {
346
- const s = [];
347
- for (const a of n) {
348
- const i = await a.key, o = await a.value;
349
- s.push({
350
- key: i,
351
- value: o
352
- });
353
- }
354
- return w.mergeObjectSync(e, s);
355
- }
356
- static mergeObjectSync(e, n) {
357
- const s = {};
358
- for (const a of n) {
359
- const { key: i, value: o } = a;
360
- if (i.status === "aborted" || o.status === "aborted")
361
- return g;
362
- i.status === "dirty" && e.dirty(), o.status === "dirty" && e.dirty(), i.value !== "__proto__" && (typeof o.value < "u" || a.alwaysSet) && (s[i.value] = o.value);
363
- }
364
- return { status: e.value, value: s };
365
- }
366
- }
367
- const g = Object.freeze({
368
- status: "aborted"
369
- }), q = (t) => ({ status: "dirty", value: t }), S = (t) => ({ status: "valid", value: t }), Ze = (t) => t.status === "aborted", Re = (t) => t.status === "dirty", ee = (t) => t.status === "valid", te = (t) => typeof Promise < "u" && t instanceof Promise;
370
- function ge(t, e, n, s) {
371
- if (typeof e == "function" ? t !== e || !s : !e.has(t)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
372
- return e.get(t);
373
- }
374
- function We(t, e, n, s, a) {
375
- if (typeof e == "function" ? t !== e || !a : !e.has(t)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
376
- return e.set(t, n), n;
377
- }
378
- var h;
379
- (function(t) {
380
- t.errToObj = (e) => typeof e == "string" ? { message: e } : e || {}, t.toString = (e) => typeof e == "string" ? e : e == null ? void 0 : e.message;
381
- })(h || (h = {}));
382
- var Q, X;
383
- class I {
384
- constructor(e, n, s, a) {
385
- this._cachedPath = [], this.parent = e, this.data = n, this._path = s, this._key = a;
386
- }
387
- get path() {
388
- return this._cachedPath.length || (this._key instanceof Array ? this._cachedPath.push(...this._path, ...this._key) : this._cachedPath.push(...this._path, this._key)), this._cachedPath;
389
- }
390
- }
391
- const Le = (t, e) => {
392
- if (ee(e))
393
- return { success: !0, data: e.value };
394
- if (!t.common.issues.length)
395
- throw new Error("Validation failed but no issues detected.");
396
- return {
397
- success: !1,
398
- get error() {
399
- if (this._error)
400
- return this._error;
401
- const n = new T(t.common.issues);
402
- return this._error = n, this._error;
403
- }
404
- };
405
- };
406
- function y(t) {
407
- if (!t)
408
- return {};
409
- const { errorMap: e, invalid_type_error: n, required_error: s, description: a } = t;
410
- if (e && (n || s))
411
- throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);
412
- return e ? { errorMap: e, description: a } : { errorMap: (o, d) => {
413
- var u, l;
414
- const { message: m } = t;
415
- return o.code === "invalid_enum_value" ? { message: m ?? d.defaultError } : typeof d.data > "u" ? { message: (u = m ?? s) !== null && u !== void 0 ? u : d.defaultError } : o.code !== "invalid_type" ? { message: d.defaultError } : { message: (l = m ?? n) !== null && l !== void 0 ? l : d.defaultError };
416
- }, description: a };
417
- }
418
- class v {
419
- constructor(e) {
420
- this.spa = this.safeParseAsync, this._def = e, this.parse = this.parse.bind(this), this.safeParse = this.safeParse.bind(this), this.parseAsync = this.parseAsync.bind(this), this.safeParseAsync = this.safeParseAsync.bind(this), this.spa = this.spa.bind(this), this.refine = this.refine.bind(this), this.refinement = this.refinement.bind(this), this.superRefine = this.superRefine.bind(this), this.optional = this.optional.bind(this), this.nullable = this.nullable.bind(this), this.nullish = this.nullish.bind(this), this.array = this.array.bind(this), this.promise = this.promise.bind(this), this.or = this.or.bind(this), this.and = this.and.bind(this), this.transform = this.transform.bind(this), this.brand = this.brand.bind(this), this.default = this.default.bind(this), this.catch = this.catch.bind(this), this.describe = this.describe.bind(this), this.pipe = this.pipe.bind(this), this.readonly = this.readonly.bind(this), this.isNullable = this.isNullable.bind(this), this.isOptional = this.isOptional.bind(this);
421
- }
422
- get description() {
423
- return this._def.description;
424
- }
425
- _getType(e) {
426
- return A(e.data);
427
- }
428
- _getOrReturnCtx(e, n) {
429
- return n || {
430
- common: e.parent.common,
431
- data: e.data,
432
- parsedType: A(e.data),
433
- schemaErrorMap: this._def.errorMap,
434
- path: e.path,
435
- parent: e.parent
436
- };
437
- }
438
- _processInputParams(e) {
439
- return {
440
- status: new w(),
441
- ctx: {
442
- common: e.parent.common,
443
- data: e.data,
444
- parsedType: A(e.data),
445
- schemaErrorMap: this._def.errorMap,
446
- path: e.path,
447
- parent: e.parent
448
- }
449
- };
450
- }
451
- _parseSync(e) {
452
- const n = this._parse(e);
453
- if (te(n))
454
- throw new Error("Synchronous parse encountered promise.");
455
- return n;
456
- }
457
- _parseAsync(e) {
458
- const n = this._parse(e);
459
- return Promise.resolve(n);
460
- }
461
- parse(e, n) {
462
- const s = this.safeParse(e, n);
463
- if (s.success)
464
- return s.data;
465
- throw s.error;
466
- }
467
- safeParse(e, n) {
468
- var s;
469
- const a = {
470
- common: {
471
- issues: [],
472
- async: (s = n == null ? void 0 : n.async) !== null && s !== void 0 ? s : !1,
473
- contextualErrorMap: n == null ? void 0 : n.errorMap
474
- },
475
- path: (n == null ? void 0 : n.path) || [],
476
- schemaErrorMap: this._def.errorMap,
477
- parent: null,
478
- data: e,
479
- parsedType: A(e)
480
- }, i = this._parseSync({ data: e, path: a.path, parent: a });
481
- return Le(a, i);
482
- }
483
- async parseAsync(e, n) {
484
- const s = await this.safeParseAsync(e, n);
485
- if (s.success)
486
- return s.data;
487
- throw s.error;
488
- }
489
- async safeParseAsync(e, n) {
490
- const s = {
491
- common: {
492
- issues: [],
493
- contextualErrorMap: n == null ? void 0 : n.errorMap,
494
- async: !0
495
- },
496
- path: (n == null ? void 0 : n.path) || [],
497
- schemaErrorMap: this._def.errorMap,
498
- parent: null,
499
- data: e,
500
- parsedType: A(e)
501
- }, a = this._parse({ data: e, path: s.path, parent: s }), i = await (te(a) ? a : Promise.resolve(a));
502
- return Le(s, i);
503
- }
504
- refine(e, n) {
505
- const s = (a) => typeof n == "string" || typeof n > "u" ? { message: n } : typeof n == "function" ? n(a) : n;
506
- return this._refinement((a, i) => {
507
- const o = e(a), d = () => i.addIssue({
508
- code: c.custom,
509
- ...s(a)
510
- });
511
- return typeof Promise < "u" && o instanceof Promise ? o.then((u) => u ? !0 : (d(), !1)) : o ? !0 : (d(), !1);
512
- });
513
- }
514
- refinement(e, n) {
515
- return this._refinement((s, a) => e(s) ? !0 : (a.addIssue(typeof n == "function" ? n(s, a) : n), !1));
516
- }
517
- _refinement(e) {
518
- return new O({
519
- schema: this,
520
- typeName: _.ZodEffects,
521
- effect: { type: "refinement", refinement: e }
522
- });
523
- }
524
- superRefine(e) {
525
- return this._refinement(e);
526
- }
527
- optional() {
528
- return j.create(this, this._def);
529
- }
530
- nullable() {
531
- return U.create(this, this._def);
532
- }
533
- nullish() {
534
- return this.nullable().optional();
535
- }
536
- array() {
537
- return C.create(this, this._def);
538
- }
539
- promise() {
540
- return Y.create(this, this._def);
541
- }
542
- or(e) {
543
- return ae.create([this, e], this._def);
544
- }
545
- and(e) {
546
- return ie.create(this, e, this._def);
547
- }
548
- transform(e) {
549
- return new O({
550
- ...y(this._def),
551
- schema: this,
552
- typeName: _.ZodEffects,
553
- effect: { type: "transform", transform: e }
554
- });
555
- }
556
- default(e) {
557
- const n = typeof e == "function" ? e : () => e;
558
- return new ue({
559
- ...y(this._def),
560
- innerType: this,
561
- defaultValue: n,
562
- typeName: _.ZodDefault
563
- });
564
- }
565
- brand() {
566
- return new Pe({
567
- typeName: _.ZodBranded,
568
- type: this,
569
- ...y(this._def)
570
- });
571
- }
572
- catch(e) {
573
- const n = typeof e == "function" ? e : () => e;
574
- return new pe({
575
- ...y(this._def),
576
- innerType: this,
577
- catchValue: n,
578
- typeName: _.ZodCatch
579
- });
580
- }
581
- describe(e) {
582
- const n = this.constructor;
583
- return new n({
584
- ...this._def,
585
- description: e
586
- });
587
- }
588
- pipe(e) {
589
- return he.create(this, e);
590
- }
591
- readonly() {
592
- return fe.create(this);
593
- }
594
- isOptional() {
595
- return this.safeParse(void 0).success;
596
- }
597
- isNullable() {
598
- return this.safeParse(null).success;
599
- }
600
- }
601
- const pt = /^c[^\s-]{8,}$/i, ft = /^[0-9a-z]+$/, ht = /^[0-9A-HJKMNP-TV-Z]{26}$/, mt = /^[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, _t = /^[a-z0-9_-]{21}$/i, gt = /^[-+]?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)?)??$/, yt = /^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i, vt = "^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";
602
- let Ie;
603
- const bt = /^(?:(?: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])$/, kt = /^(([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})))$/, xt = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/, He = "((\\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])))", wt = new RegExp(`^${He}$`);
604
- function qe(t) {
605
- let e = "([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";
606
- return t.precision ? e = `${e}\\.\\d{${t.precision}}` : t.precision == null && (e = `${e}(\\.\\d+)?`), e;
607
- }
608
- function St(t) {
609
- return new RegExp(`^${qe(t)}$`);
610
- }
611
- function Ge(t) {
612
- let e = `${He}T${qe(t)}`;
613
- const n = [];
614
- return n.push(t.local ? "Z?" : "Z"), t.offset && n.push("([+-]\\d{2}:?\\d{2})"), e = `${e}(${n.join("|")})`, new RegExp(`^${e}$`);
615
- }
616
- function Tt(t, e) {
617
- return !!((e === "v4" || !e) && bt.test(t) || (e === "v6" || !e) && kt.test(t));
618
- }
619
- class E extends v {
620
- _parse(e) {
621
- if (this._def.coerce && (e.data = String(e.data)), this._getType(e) !== f.string) {
622
- const i = this._getOrReturnCtx(e);
623
- return p(i, {
624
- code: c.invalid_type,
625
- expected: f.string,
626
- received: i.parsedType
627
- }), g;
628
- }
629
- const s = new w();
630
- let a;
631
- for (const i of this._def.checks)
632
- if (i.kind === "min")
633
- e.data.length < i.value && (a = this._getOrReturnCtx(e, a), p(a, {
634
- code: c.too_small,
635
- minimum: i.value,
636
- type: "string",
637
- inclusive: !0,
638
- exact: !1,
639
- message: i.message
640
- }), s.dirty());
641
- else if (i.kind === "max")
642
- e.data.length > i.value && (a = this._getOrReturnCtx(e, a), p(a, {
643
- code: c.too_big,
644
- maximum: i.value,
645
- type: "string",
646
- inclusive: !0,
647
- exact: !1,
648
- message: i.message
649
- }), s.dirty());
650
- else if (i.kind === "length") {
651
- const o = e.data.length > i.value, d = e.data.length < i.value;
652
- (o || d) && (a = this._getOrReturnCtx(e, a), o ? p(a, {
653
- code: c.too_big,
654
- maximum: i.value,
655
- type: "string",
656
- inclusive: !0,
657
- exact: !0,
658
- message: i.message
659
- }) : d && p(a, {
660
- code: c.too_small,
661
- minimum: i.value,
662
- type: "string",
663
- inclusive: !0,
664
- exact: !0,
665
- message: i.message
666
- }), s.dirty());
667
- } else if (i.kind === "email")
668
- yt.test(e.data) || (a = this._getOrReturnCtx(e, a), p(a, {
669
- validation: "email",
670
- code: c.invalid_string,
671
- message: i.message
672
- }), s.dirty());
673
- else if (i.kind === "emoji")
674
- Ie || (Ie = new RegExp(vt, "u")), Ie.test(e.data) || (a = this._getOrReturnCtx(e, a), p(a, {
675
- validation: "emoji",
676
- code: c.invalid_string,
677
- message: i.message
678
- }), s.dirty());
679
- else if (i.kind === "uuid")
680
- mt.test(e.data) || (a = this._getOrReturnCtx(e, a), p(a, {
681
- validation: "uuid",
682
- code: c.invalid_string,
683
- message: i.message
684
- }), s.dirty());
685
- else if (i.kind === "nanoid")
686
- _t.test(e.data) || (a = this._getOrReturnCtx(e, a), p(a, {
687
- validation: "nanoid",
688
- code: c.invalid_string,
689
- message: i.message
690
- }), s.dirty());
691
- else if (i.kind === "cuid")
692
- pt.test(e.data) || (a = this._getOrReturnCtx(e, a), p(a, {
693
- validation: "cuid",
694
- code: c.invalid_string,
695
- message: i.message
696
- }), s.dirty());
697
- else if (i.kind === "cuid2")
698
- ft.test(e.data) || (a = this._getOrReturnCtx(e, a), p(a, {
699
- validation: "cuid2",
700
- code: c.invalid_string,
701
- message: i.message
702
- }), s.dirty());
703
- else if (i.kind === "ulid")
704
- ht.test(e.data) || (a = this._getOrReturnCtx(e, a), p(a, {
705
- validation: "ulid",
706
- code: c.invalid_string,
707
- message: i.message
708
- }), s.dirty());
709
- else if (i.kind === "url")
710
- try {
711
- new URL(e.data);
712
- } catch {
713
- a = this._getOrReturnCtx(e, a), p(a, {
714
- validation: "url",
715
- code: c.invalid_string,
716
- message: i.message
717
- }), s.dirty();
718
- }
719
- else i.kind === "regex" ? (i.regex.lastIndex = 0, i.regex.test(e.data) || (a = this._getOrReturnCtx(e, a), p(a, {
720
- validation: "regex",
721
- code: c.invalid_string,
722
- message: i.message
723
- }), s.dirty())) : i.kind === "trim" ? e.data = e.data.trim() : i.kind === "includes" ? e.data.includes(i.value, i.position) || (a = this._getOrReturnCtx(e, a), p(a, {
724
- code: c.invalid_string,
725
- validation: { includes: i.value, position: i.position },
726
- message: i.message
727
- }), s.dirty()) : i.kind === "toLowerCase" ? e.data = e.data.toLowerCase() : i.kind === "toUpperCase" ? e.data = e.data.toUpperCase() : i.kind === "startsWith" ? e.data.startsWith(i.value) || (a = this._getOrReturnCtx(e, a), p(a, {
728
- code: c.invalid_string,
729
- validation: { startsWith: i.value },
730
- message: i.message
731
- }), s.dirty()) : i.kind === "endsWith" ? e.data.endsWith(i.value) || (a = this._getOrReturnCtx(e, a), p(a, {
732
- code: c.invalid_string,
733
- validation: { endsWith: i.value },
734
- message: i.message
735
- }), s.dirty()) : i.kind === "datetime" ? Ge(i).test(e.data) || (a = this._getOrReturnCtx(e, a), p(a, {
736
- code: c.invalid_string,
737
- validation: "datetime",
738
- message: i.message
739
- }), s.dirty()) : i.kind === "date" ? wt.test(e.data) || (a = this._getOrReturnCtx(e, a), p(a, {
740
- code: c.invalid_string,
741
- validation: "date",
742
- message: i.message
743
- }), s.dirty()) : i.kind === "time" ? St(i).test(e.data) || (a = this._getOrReturnCtx(e, a), p(a, {
744
- code: c.invalid_string,
745
- validation: "time",
746
- message: i.message
747
- }), s.dirty()) : i.kind === "duration" ? gt.test(e.data) || (a = this._getOrReturnCtx(e, a), p(a, {
748
- validation: "duration",
749
- code: c.invalid_string,
750
- message: i.message
751
- }), s.dirty()) : i.kind === "ip" ? Tt(e.data, i.version) || (a = this._getOrReturnCtx(e, a), p(a, {
752
- validation: "ip",
753
- code: c.invalid_string,
754
- message: i.message
755
- }), s.dirty()) : i.kind === "base64" ? xt.test(e.data) || (a = this._getOrReturnCtx(e, a), p(a, {
756
- validation: "base64",
757
- code: c.invalid_string,
758
- message: i.message
759
- }), s.dirty()) : b.assertNever(i);
760
- return { status: s.value, value: e.data };
761
- }
762
- _regex(e, n, s) {
763
- return this.refinement((a) => e.test(a), {
764
- validation: n,
765
- code: c.invalid_string,
766
- ...h.errToObj(s)
767
- });
768
- }
769
- _addCheck(e) {
770
- return new E({
771
- ...this._def,
772
- checks: [...this._def.checks, e]
773
- });
774
- }
775
- email(e) {
776
- return this._addCheck({ kind: "email", ...h.errToObj(e) });
777
- }
778
- url(e) {
779
- return this._addCheck({ kind: "url", ...h.errToObj(e) });
780
- }
781
- emoji(e) {
782
- return this._addCheck({ kind: "emoji", ...h.errToObj(e) });
783
- }
784
- uuid(e) {
785
- return this._addCheck({ kind: "uuid", ...h.errToObj(e) });
786
- }
787
- nanoid(e) {
788
- return this._addCheck({ kind: "nanoid", ...h.errToObj(e) });
789
- }
790
- cuid(e) {
791
- return this._addCheck({ kind: "cuid", ...h.errToObj(e) });
792
- }
793
- cuid2(e) {
794
- return this._addCheck({ kind: "cuid2", ...h.errToObj(e) });
795
- }
796
- ulid(e) {
797
- return this._addCheck({ kind: "ulid", ...h.errToObj(e) });
798
- }
799
- base64(e) {
800
- return this._addCheck({ kind: "base64", ...h.errToObj(e) });
801
- }
802
- ip(e) {
803
- return this._addCheck({ kind: "ip", ...h.errToObj(e) });
804
- }
805
- datetime(e) {
806
- var n, s;
807
- return typeof e == "string" ? this._addCheck({
808
- kind: "datetime",
809
- precision: null,
810
- offset: !1,
811
- local: !1,
812
- message: e
813
- }) : this._addCheck({
814
- kind: "datetime",
815
- precision: typeof (e == null ? void 0 : e.precision) > "u" ? null : e == null ? void 0 : e.precision,
816
- offset: (n = e == null ? void 0 : e.offset) !== null && n !== void 0 ? n : !1,
817
- local: (s = e == null ? void 0 : e.local) !== null && s !== void 0 ? s : !1,
818
- ...h.errToObj(e == null ? void 0 : e.message)
819
- });
820
- }
821
- date(e) {
822
- return this._addCheck({ kind: "date", message: e });
823
- }
824
- time(e) {
825
- return typeof e == "string" ? this._addCheck({
826
- kind: "time",
827
- precision: null,
828
- message: e
829
- }) : this._addCheck({
830
- kind: "time",
831
- precision: typeof (e == null ? void 0 : e.precision) > "u" ? null : e == null ? void 0 : e.precision,
832
- ...h.errToObj(e == null ? void 0 : e.message)
833
- });
834
- }
835
- duration(e) {
836
- return this._addCheck({ kind: "duration", ...h.errToObj(e) });
837
- }
838
- regex(e, n) {
839
- return this._addCheck({
840
- kind: "regex",
841
- regex: e,
842
- ...h.errToObj(n)
843
- });
844
- }
845
- includes(e, n) {
846
- return this._addCheck({
847
- kind: "includes",
848
- value: e,
849
- position: n == null ? void 0 : n.position,
850
- ...h.errToObj(n == null ? void 0 : n.message)
851
- });
852
- }
853
- startsWith(e, n) {
854
- return this._addCheck({
855
- kind: "startsWith",
856
- value: e,
857
- ...h.errToObj(n)
858
- });
859
- }
860
- endsWith(e, n) {
861
- return this._addCheck({
862
- kind: "endsWith",
863
- value: e,
864
- ...h.errToObj(n)
865
- });
866
- }
867
- min(e, n) {
868
- return this._addCheck({
869
- kind: "min",
870
- value: e,
871
- ...h.errToObj(n)
872
- });
873
- }
874
- max(e, n) {
875
- return this._addCheck({
876
- kind: "max",
877
- value: e,
878
- ...h.errToObj(n)
879
- });
880
- }
881
- length(e, n) {
882
- return this._addCheck({
883
- kind: "length",
884
- value: e,
885
- ...h.errToObj(n)
886
- });
887
- }
888
- /**
889
- * @deprecated Use z.string().min(1) instead.
890
- * @see {@link ZodString.min}
891
- */
892
- nonempty(e) {
893
- return this.min(1, h.errToObj(e));
894
- }
895
- trim() {
896
- return new E({
897
- ...this._def,
898
- checks: [...this._def.checks, { kind: "trim" }]
899
- });
900
- }
901
- toLowerCase() {
902
- return new E({
903
- ...this._def,
904
- checks: [...this._def.checks, { kind: "toLowerCase" }]
905
- });
906
- }
907
- toUpperCase() {
908
- return new E({
909
- ...this._def,
910
- checks: [...this._def.checks, { kind: "toUpperCase" }]
911
- });
912
- }
913
- get isDatetime() {
914
- return !!this._def.checks.find((e) => e.kind === "datetime");
915
- }
916
- get isDate() {
917
- return !!this._def.checks.find((e) => e.kind === "date");
918
- }
919
- get isTime() {
920
- return !!this._def.checks.find((e) => e.kind === "time");
921
- }
922
- get isDuration() {
923
- return !!this._def.checks.find((e) => e.kind === "duration");
924
- }
925
- get isEmail() {
926
- return !!this._def.checks.find((e) => e.kind === "email");
927
- }
928
- get isURL() {
929
- return !!this._def.checks.find((e) => e.kind === "url");
930
- }
931
- get isEmoji() {
932
- return !!this._def.checks.find((e) => e.kind === "emoji");
933
- }
934
- get isUUID() {
935
- return !!this._def.checks.find((e) => e.kind === "uuid");
936
- }
937
- get isNANOID() {
938
- return !!this._def.checks.find((e) => e.kind === "nanoid");
939
- }
940
- get isCUID() {
941
- return !!this._def.checks.find((e) => e.kind === "cuid");
942
- }
943
- get isCUID2() {
944
- return !!this._def.checks.find((e) => e.kind === "cuid2");
945
- }
946
- get isULID() {
947
- return !!this._def.checks.find((e) => e.kind === "ulid");
948
- }
949
- get isIP() {
950
- return !!this._def.checks.find((e) => e.kind === "ip");
951
- }
952
- get isBase64() {
953
- return !!this._def.checks.find((e) => e.kind === "base64");
954
- }
955
- get minLength() {
956
- let e = null;
957
- for (const n of this._def.checks)
958
- n.kind === "min" && (e === null || n.value > e) && (e = n.value);
959
- return e;
960
- }
961
- get maxLength() {
962
- let e = null;
963
- for (const n of this._def.checks)
964
- n.kind === "max" && (e === null || n.value < e) && (e = n.value);
965
- return e;
966
- }
967
- }
968
- E.create = (t) => {
969
- var e;
970
- return new E({
971
- checks: [],
972
- typeName: _.ZodString,
973
- coerce: (e = t == null ? void 0 : t.coerce) !== null && e !== void 0 ? e : !1,
974
- ...y(t)
975
- });
976
- };
977
- function Et(t, e) {
978
- const n = (t.toString().split(".")[1] || "").length, s = (e.toString().split(".")[1] || "").length, a = n > s ? n : s, i = parseInt(t.toFixed(a).replace(".", "")), o = parseInt(e.toFixed(a).replace(".", ""));
979
- return i % o / Math.pow(10, a);
980
- }
981
- class P extends v {
982
- constructor() {
983
- super(...arguments), this.min = this.gte, this.max = this.lte, this.step = this.multipleOf;
984
- }
985
- _parse(e) {
986
- if (this._def.coerce && (e.data = Number(e.data)), this._getType(e) !== f.number) {
987
- const i = this._getOrReturnCtx(e);
988
- return p(i, {
989
- code: c.invalid_type,
990
- expected: f.number,
991
- received: i.parsedType
992
- }), g;
993
- }
994
- let s;
995
- const a = new w();
996
- for (const i of this._def.checks)
997
- i.kind === "int" ? b.isInteger(e.data) || (s = this._getOrReturnCtx(e, s), p(s, {
998
- code: c.invalid_type,
999
- expected: "integer",
1000
- received: "float",
1001
- message: i.message
1002
- }), a.dirty()) : i.kind === "min" ? (i.inclusive ? e.data < i.value : e.data <= i.value) && (s = this._getOrReturnCtx(e, s), p(s, {
1003
- code: c.too_small,
1004
- minimum: i.value,
1005
- type: "number",
1006
- inclusive: i.inclusive,
1007
- exact: !1,
1008
- message: i.message
1009
- }), a.dirty()) : i.kind === "max" ? (i.inclusive ? e.data > i.value : e.data >= i.value) && (s = this._getOrReturnCtx(e, s), p(s, {
1010
- code: c.too_big,
1011
- maximum: i.value,
1012
- type: "number",
1013
- inclusive: i.inclusive,
1014
- exact: !1,
1015
- message: i.message
1016
- }), a.dirty()) : i.kind === "multipleOf" ? Et(e.data, i.value) !== 0 && (s = this._getOrReturnCtx(e, s), p(s, {
1017
- code: c.not_multiple_of,
1018
- multipleOf: i.value,
1019
- message: i.message
1020
- }), a.dirty()) : i.kind === "finite" ? Number.isFinite(e.data) || (s = this._getOrReturnCtx(e, s), p(s, {
1021
- code: c.not_finite,
1022
- message: i.message
1023
- }), a.dirty()) : b.assertNever(i);
1024
- return { status: a.value, value: e.data };
1025
- }
1026
- gte(e, n) {
1027
- return this.setLimit("min", e, !0, h.toString(n));
1028
- }
1029
- gt(e, n) {
1030
- return this.setLimit("min", e, !1, h.toString(n));
1031
- }
1032
- lte(e, n) {
1033
- return this.setLimit("max", e, !0, h.toString(n));
1034
- }
1035
- lt(e, n) {
1036
- return this.setLimit("max", e, !1, h.toString(n));
1037
- }
1038
- setLimit(e, n, s, a) {
1039
- return new P({
1040
- ...this._def,
1041
- checks: [
1042
- ...this._def.checks,
1043
- {
1044
- kind: e,
1045
- value: n,
1046
- inclusive: s,
1047
- message: h.toString(a)
1048
- }
1049
- ]
1050
- });
1051
- }
1052
- _addCheck(e) {
1053
- return new P({
1054
- ...this._def,
1055
- checks: [...this._def.checks, e]
1056
- });
1057
- }
1058
- int(e) {
1059
- return this._addCheck({
1060
- kind: "int",
1061
- message: h.toString(e)
1062
- });
1063
- }
1064
- positive(e) {
1065
- return this._addCheck({
1066
- kind: "min",
1067
- value: 0,
1068
- inclusive: !1,
1069
- message: h.toString(e)
1070
- });
1071
- }
1072
- negative(e) {
1073
- return this._addCheck({
1074
- kind: "max",
1075
- value: 0,
1076
- inclusive: !1,
1077
- message: h.toString(e)
1078
- });
1079
- }
1080
- nonpositive(e) {
1081
- return this._addCheck({
1082
- kind: "max",
1083
- value: 0,
1084
- inclusive: !0,
1085
- message: h.toString(e)
1086
- });
1087
- }
1088
- nonnegative(e) {
1089
- return this._addCheck({
1090
- kind: "min",
1091
- value: 0,
1092
- inclusive: !0,
1093
- message: h.toString(e)
1094
- });
1095
- }
1096
- multipleOf(e, n) {
1097
- return this._addCheck({
1098
- kind: "multipleOf",
1099
- value: e,
1100
- message: h.toString(n)
1101
- });
1102
- }
1103
- finite(e) {
1104
- return this._addCheck({
1105
- kind: "finite",
1106
- message: h.toString(e)
1107
- });
1108
- }
1109
- safe(e) {
1110
- return this._addCheck({
1111
- kind: "min",
1112
- inclusive: !0,
1113
- value: Number.MIN_SAFE_INTEGER,
1114
- message: h.toString(e)
1115
- })._addCheck({
1116
- kind: "max",
1117
- inclusive: !0,
1118
- value: Number.MAX_SAFE_INTEGER,
1119
- message: h.toString(e)
1120
- });
1121
- }
1122
- get minValue() {
1123
- let e = null;
1124
- for (const n of this._def.checks)
1125
- n.kind === "min" && (e === null || n.value > e) && (e = n.value);
1126
- return e;
1127
- }
1128
- get maxValue() {
1129
- let e = null;
1130
- for (const n of this._def.checks)
1131
- n.kind === "max" && (e === null || n.value < e) && (e = n.value);
1132
- return e;
1133
- }
1134
- get isInt() {
1135
- return !!this._def.checks.find((e) => e.kind === "int" || e.kind === "multipleOf" && b.isInteger(e.value));
1136
- }
1137
- get isFinite() {
1138
- let e = null, n = null;
1139
- for (const s of this._def.checks) {
1140
- if (s.kind === "finite" || s.kind === "int" || s.kind === "multipleOf")
1141
- return !0;
1142
- s.kind === "min" ? (n === null || s.value > n) && (n = s.value) : s.kind === "max" && (e === null || s.value < e) && (e = s.value);
1143
- }
1144
- return Number.isFinite(n) && Number.isFinite(e);
1145
- }
1146
- }
1147
- P.create = (t) => new P({
1148
- checks: [],
1149
- typeName: _.ZodNumber,
1150
- coerce: (t == null ? void 0 : t.coerce) || !1,
1151
- ...y(t)
1152
- });
1153
- class D extends v {
1154
- constructor() {
1155
- super(...arguments), this.min = this.gte, this.max = this.lte;
1156
- }
1157
- _parse(e) {
1158
- if (this._def.coerce && (e.data = BigInt(e.data)), this._getType(e) !== f.bigint) {
1159
- const i = this._getOrReturnCtx(e);
1160
- return p(i, {
1161
- code: c.invalid_type,
1162
- expected: f.bigint,
1163
- received: i.parsedType
1164
- }), g;
1165
- }
1166
- let s;
1167
- const a = new w();
1168
- for (const i of this._def.checks)
1169
- i.kind === "min" ? (i.inclusive ? e.data < i.value : e.data <= i.value) && (s = this._getOrReturnCtx(e, s), p(s, {
1170
- code: c.too_small,
1171
- type: "bigint",
1172
- minimum: i.value,
1173
- inclusive: i.inclusive,
1174
- message: i.message
1175
- }), a.dirty()) : i.kind === "max" ? (i.inclusive ? e.data > i.value : e.data >= i.value) && (s = this._getOrReturnCtx(e, s), p(s, {
1176
- code: c.too_big,
1177
- type: "bigint",
1178
- maximum: i.value,
1179
- inclusive: i.inclusive,
1180
- message: i.message
1181
- }), a.dirty()) : i.kind === "multipleOf" ? e.data % i.value !== BigInt(0) && (s = this._getOrReturnCtx(e, s), p(s, {
1182
- code: c.not_multiple_of,
1183
- multipleOf: i.value,
1184
- message: i.message
1185
- }), a.dirty()) : b.assertNever(i);
1186
- return { status: a.value, value: e.data };
1187
- }
1188
- gte(e, n) {
1189
- return this.setLimit("min", e, !0, h.toString(n));
1190
- }
1191
- gt(e, n) {
1192
- return this.setLimit("min", e, !1, h.toString(n));
1193
- }
1194
- lte(e, n) {
1195
- return this.setLimit("max", e, !0, h.toString(n));
1196
- }
1197
- lt(e, n) {
1198
- return this.setLimit("max", e, !1, h.toString(n));
1199
- }
1200
- setLimit(e, n, s, a) {
1201
- return new D({
1202
- ...this._def,
1203
- checks: [
1204
- ...this._def.checks,
1205
- {
1206
- kind: e,
1207
- value: n,
1208
- inclusive: s,
1209
- message: h.toString(a)
1210
- }
1211
- ]
1212
- });
1213
- }
1214
- _addCheck(e) {
1215
- return new D({
1216
- ...this._def,
1217
- checks: [...this._def.checks, e]
1218
- });
1219
- }
1220
- positive(e) {
1221
- return this._addCheck({
1222
- kind: "min",
1223
- value: BigInt(0),
1224
- inclusive: !1,
1225
- message: h.toString(e)
1226
- });
1227
- }
1228
- negative(e) {
1229
- return this._addCheck({
1230
- kind: "max",
1231
- value: BigInt(0),
1232
- inclusive: !1,
1233
- message: h.toString(e)
1234
- });
1235
- }
1236
- nonpositive(e) {
1237
- return this._addCheck({
1238
- kind: "max",
1239
- value: BigInt(0),
1240
- inclusive: !0,
1241
- message: h.toString(e)
1242
- });
1243
- }
1244
- nonnegative(e) {
1245
- return this._addCheck({
1246
- kind: "min",
1247
- value: BigInt(0),
1248
- inclusive: !0,
1249
- message: h.toString(e)
1250
- });
1251
- }
1252
- multipleOf(e, n) {
1253
- return this._addCheck({
1254
- kind: "multipleOf",
1255
- value: e,
1256
- message: h.toString(n)
1257
- });
1258
- }
1259
- get minValue() {
1260
- let e = null;
1261
- for (const n of this._def.checks)
1262
- n.kind === "min" && (e === null || n.value > e) && (e = n.value);
1263
- return e;
1264
- }
1265
- get maxValue() {
1266
- let e = null;
1267
- for (const n of this._def.checks)
1268
- n.kind === "max" && (e === null || n.value < e) && (e = n.value);
1269
- return e;
1270
- }
1271
- }
1272
- D.create = (t) => {
1273
- var e;
1274
- return new D({
1275
- checks: [],
1276
- typeName: _.ZodBigInt,
1277
- coerce: (e = t == null ? void 0 : t.coerce) !== null && e !== void 0 ? e : !1,
1278
- ...y(t)
1279
- });
1280
- };
1281
- class ne extends v {
1282
- _parse(e) {
1283
- if (this._def.coerce && (e.data = !!e.data), this._getType(e) !== f.boolean) {
1284
- const s = this._getOrReturnCtx(e);
1285
- return p(s, {
1286
- code: c.invalid_type,
1287
- expected: f.boolean,
1288
- received: s.parsedType
1289
- }), g;
1290
- }
1291
- return S(e.data);
1292
- }
1293
- }
1294
- ne.create = (t) => new ne({
1295
- typeName: _.ZodBoolean,
1296
- coerce: (t == null ? void 0 : t.coerce) || !1,
1297
- ...y(t)
1298
- });
1299
- class V extends v {
1300
- _parse(e) {
1301
- if (this._def.coerce && (e.data = new Date(e.data)), this._getType(e) !== f.date) {
1302
- const i = this._getOrReturnCtx(e);
1303
- return p(i, {
1304
- code: c.invalid_type,
1305
- expected: f.date,
1306
- received: i.parsedType
1307
- }), g;
1308
- }
1309
- if (isNaN(e.data.getTime())) {
1310
- const i = this._getOrReturnCtx(e);
1311
- return p(i, {
1312
- code: c.invalid_date
1313
- }), g;
1314
- }
1315
- const s = new w();
1316
- let a;
1317
- for (const i of this._def.checks)
1318
- i.kind === "min" ? e.data.getTime() < i.value && (a = this._getOrReturnCtx(e, a), p(a, {
1319
- code: c.too_small,
1320
- message: i.message,
1321
- inclusive: !0,
1322
- exact: !1,
1323
- minimum: i.value,
1324
- type: "date"
1325
- }), s.dirty()) : i.kind === "max" ? e.data.getTime() > i.value && (a = this._getOrReturnCtx(e, a), p(a, {
1326
- code: c.too_big,
1327
- message: i.message,
1328
- inclusive: !0,
1329
- exact: !1,
1330
- maximum: i.value,
1331
- type: "date"
1332
- }), s.dirty()) : b.assertNever(i);
1333
- return {
1334
- status: s.value,
1335
- value: new Date(e.data.getTime())
1336
- };
1337
- }
1338
- _addCheck(e) {
1339
- return new V({
1340
- ...this._def,
1341
- checks: [...this._def.checks, e]
1342
- });
1343
- }
1344
- min(e, n) {
1345
- return this._addCheck({
1346
- kind: "min",
1347
- value: e.getTime(),
1348
- message: h.toString(n)
1349
- });
1350
- }
1351
- max(e, n) {
1352
- return this._addCheck({
1353
- kind: "max",
1354
- value: e.getTime(),
1355
- message: h.toString(n)
1356
- });
1357
- }
1358
- get minDate() {
1359
- let e = null;
1360
- for (const n of this._def.checks)
1361
- n.kind === "min" && (e === null || n.value > e) && (e = n.value);
1362
- return e != null ? new Date(e) : null;
1363
- }
1364
- get maxDate() {
1365
- let e = null;
1366
- for (const n of this._def.checks)
1367
- n.kind === "max" && (e === null || n.value < e) && (e = n.value);
1368
- return e != null ? new Date(e) : null;
1369
- }
1370
- }
1371
- V.create = (t) => new V({
1372
- checks: [],
1373
- coerce: (t == null ? void 0 : t.coerce) || !1,
1374
- typeName: _.ZodDate,
1375
- ...y(t)
1376
- });
1377
- class ye extends v {
1378
- _parse(e) {
1379
- if (this._getType(e) !== f.symbol) {
1380
- const s = this._getOrReturnCtx(e);
1381
- return p(s, {
1382
- code: c.invalid_type,
1383
- expected: f.symbol,
1384
- received: s.parsedType
1385
- }), g;
1386
- }
1387
- return S(e.data);
1388
- }
1389
- }
1390
- ye.create = (t) => new ye({
1391
- typeName: _.ZodSymbol,
1392
- ...y(t)
1393
- });
1394
- class re extends v {
1395
- _parse(e) {
1396
- if (this._getType(e) !== f.undefined) {
1397
- const s = this._getOrReturnCtx(e);
1398
- return p(s, {
1399
- code: c.invalid_type,
1400
- expected: f.undefined,
1401
- received: s.parsedType
1402
- }), g;
1403
- }
1404
- return S(e.data);
1405
- }
1406
- }
1407
- re.create = (t) => new re({
1408
- typeName: _.ZodUndefined,
1409
- ...y(t)
1410
- });
1411
- class se extends v {
1412
- _parse(e) {
1413
- if (this._getType(e) !== f.null) {
1414
- const s = this._getOrReturnCtx(e);
1415
- return p(s, {
1416
- code: c.invalid_type,
1417
- expected: f.null,
1418
- received: s.parsedType
1419
- }), g;
1420
- }
1421
- return S(e.data);
1422
- }
1423
- }
1424
- se.create = (t) => new se({
1425
- typeName: _.ZodNull,
1426
- ...y(t)
1427
- });
1428
- class F extends v {
1429
- constructor() {
1430
- super(...arguments), this._any = !0;
1431
- }
1432
- _parse(e) {
1433
- return S(e.data);
1434
- }
1435
- }
1436
- F.create = (t) => new F({
1437
- typeName: _.ZodAny,
1438
- ...y(t)
1439
- });
1440
- class $ extends v {
1441
- constructor() {
1442
- super(...arguments), this._unknown = !0;
1443
- }
1444
- _parse(e) {
1445
- return S(e.data);
1446
- }
1447
- }
1448
- $.create = (t) => new $({
1449
- typeName: _.ZodUnknown,
1450
- ...y(t)
1451
- });
1452
- class R extends v {
1453
- _parse(e) {
1454
- const n = this._getOrReturnCtx(e);
1455
- return p(n, {
1456
- code: c.invalid_type,
1457
- expected: f.never,
1458
- received: n.parsedType
1459
- }), g;
1460
- }
1461
- }
1462
- R.create = (t) => new R({
1463
- typeName: _.ZodNever,
1464
- ...y(t)
1465
- });
1466
- class ve extends v {
1467
- _parse(e) {
1468
- if (this._getType(e) !== f.undefined) {
1469
- const s = this._getOrReturnCtx(e);
1470
- return p(s, {
1471
- code: c.invalid_type,
1472
- expected: f.void,
1473
- received: s.parsedType
1474
- }), g;
1475
- }
1476
- return S(e.data);
1477
- }
1478
- }
1479
- ve.create = (t) => new ve({
1480
- typeName: _.ZodVoid,
1481
- ...y(t)
1482
- });
1483
- class C extends v {
1484
- _parse(e) {
1485
- const { ctx: n, status: s } = this._processInputParams(e), a = this._def;
1486
- if (n.parsedType !== f.array)
1487
- return p(n, {
1488
- code: c.invalid_type,
1489
- expected: f.array,
1490
- received: n.parsedType
1491
- }), g;
1492
- if (a.exactLength !== null) {
1493
- const o = n.data.length > a.exactLength.value, d = n.data.length < a.exactLength.value;
1494
- (o || d) && (p(n, {
1495
- code: o ? c.too_big : c.too_small,
1496
- minimum: d ? a.exactLength.value : void 0,
1497
- maximum: o ? a.exactLength.value : void 0,
1498
- type: "array",
1499
- inclusive: !0,
1500
- exact: !0,
1501
- message: a.exactLength.message
1502
- }), s.dirty());
1503
- }
1504
- if (a.minLength !== null && n.data.length < a.minLength.value && (p(n, {
1505
- code: c.too_small,
1506
- minimum: a.minLength.value,
1507
- type: "array",
1508
- inclusive: !0,
1509
- exact: !1,
1510
- message: a.minLength.message
1511
- }), s.dirty()), a.maxLength !== null && n.data.length > a.maxLength.value && (p(n, {
1512
- code: c.too_big,
1513
- maximum: a.maxLength.value,
1514
- type: "array",
1515
- inclusive: !0,
1516
- exact: !1,
1517
- message: a.maxLength.message
1518
- }), s.dirty()), n.common.async)
1519
- return Promise.all([...n.data].map((o, d) => a.type._parseAsync(new I(n, o, n.path, d)))).then((o) => w.mergeArray(s, o));
1520
- const i = [...n.data].map((o, d) => a.type._parseSync(new I(n, o, n.path, d)));
1521
- return w.mergeArray(s, i);
1522
- }
1523
- get element() {
1524
- return this._def.type;
1525
- }
1526
- min(e, n) {
1527
- return new C({
1528
- ...this._def,
1529
- minLength: { value: e, message: h.toString(n) }
1530
- });
1531
- }
1532
- max(e, n) {
1533
- return new C({
1534
- ...this._def,
1535
- maxLength: { value: e, message: h.toString(n) }
1536
- });
1537
- }
1538
- length(e, n) {
1539
- return new C({
1540
- ...this._def,
1541
- exactLength: { value: e, message: h.toString(n) }
1542
- });
1543
- }
1544
- nonempty(e) {
1545
- return this.min(1, e);
1546
- }
1547
- }
1548
- C.create = (t, e) => new C({
1549
- type: t,
1550
- minLength: null,
1551
- maxLength: null,
1552
- exactLength: null,
1553
- typeName: _.ZodArray,
1554
- ...y(e)
1555
- });
1556
- function H(t) {
1557
- if (t instanceof k) {
1558
- const e = {};
1559
- for (const n in t.shape) {
1560
- const s = t.shape[n];
1561
- e[n] = j.create(H(s));
1562
- }
1563
- return new k({
1564
- ...t._def,
1565
- shape: () => e
1566
- });
1567
- } else return t instanceof C ? new C({
1568
- ...t._def,
1569
- type: H(t.element)
1570
- }) : t instanceof j ? j.create(H(t.unwrap())) : t instanceof U ? U.create(H(t.unwrap())) : t instanceof N ? N.create(t.items.map((e) => H(e))) : t;
1571
- }
1572
- class k extends v {
1573
- constructor() {
1574
- super(...arguments), this._cached = null, this.nonstrict = this.passthrough, this.augment = this.extend;
1575
- }
1576
- _getCached() {
1577
- if (this._cached !== null)
1578
- return this._cached;
1579
- const e = this._def.shape(), n = b.objectKeys(e);
1580
- return this._cached = { shape: e, keys: n };
1581
- }
1582
- _parse(e) {
1583
- if (this._getType(e) !== f.object) {
1584
- const l = this._getOrReturnCtx(e);
1585
- return p(l, {
1586
- code: c.invalid_type,
1587
- expected: f.object,
1588
- received: l.parsedType
1589
- }), g;
1590
- }
1591
- const { status: s, ctx: a } = this._processInputParams(e), { shape: i, keys: o } = this._getCached(), d = [];
1592
- if (!(this._def.catchall instanceof R && this._def.unknownKeys === "strip"))
1593
- for (const l in a.data)
1594
- o.includes(l) || d.push(l);
1595
- const u = [];
1596
- for (const l of o) {
1597
- const m = i[l], x = a.data[l];
1598
- u.push({
1599
- key: { status: "valid", value: l },
1600
- value: m._parse(new I(a, x, a.path, l)),
1601
- alwaysSet: l in a.data
1602
- });
1603
- }
1604
- if (this._def.catchall instanceof R) {
1605
- const l = this._def.unknownKeys;
1606
- if (l === "passthrough")
1607
- for (const m of d)
1608
- u.push({
1609
- key: { status: "valid", value: m },
1610
- value: { status: "valid", value: a.data[m] }
1611
- });
1612
- else if (l === "strict")
1613
- d.length > 0 && (p(a, {
1614
- code: c.unrecognized_keys,
1615
- keys: d
1616
- }), s.dirty());
1617
- else if (l !== "strip") throw new Error("Internal ZodObject error: invalid unknownKeys value.");
1618
- } else {
1619
- const l = this._def.catchall;
1620
- for (const m of d) {
1621
- const x = a.data[m];
1622
- u.push({
1623
- key: { status: "valid", value: m },
1624
- value: l._parse(
1625
- new I(a, x, a.path, m)
1626
- //, ctx.child(key), value, getParsedType(value)
1627
- ),
1628
- alwaysSet: m in a.data
1629
- });
1630
- }
1631
- }
1632
- return a.common.async ? Promise.resolve().then(async () => {
1633
- const l = [];
1634
- for (const m of u) {
1635
- const x = await m.key, B = await m.value;
1636
- l.push({
1637
- key: x,
1638
- value: B,
1639
- alwaysSet: m.alwaysSet
1640
- });
1641
- }
1642
- return l;
1643
- }).then((l) => w.mergeObjectSync(s, l)) : w.mergeObjectSync(s, u);
1644
- }
1645
- get shape() {
1646
- return this._def.shape();
1647
- }
1648
- strict(e) {
1649
- return h.errToObj, new k({
1650
- ...this._def,
1651
- unknownKeys: "strict",
1652
- ...e !== void 0 ? {
1653
- errorMap: (n, s) => {
1654
- var a, i, o, d;
1655
- const u = (o = (i = (a = this._def).errorMap) === null || i === void 0 ? void 0 : i.call(a, n, s).message) !== null && o !== void 0 ? o : s.defaultError;
1656
- return n.code === "unrecognized_keys" ? {
1657
- message: (d = h.errToObj(e).message) !== null && d !== void 0 ? d : u
1658
- } : {
1659
- message: u
1660
- };
1661
- }
1662
- } : {}
1663
- });
1664
- }
1665
- strip() {
1666
- return new k({
1667
- ...this._def,
1668
- unknownKeys: "strip"
1669
- });
1670
- }
1671
- passthrough() {
1672
- return new k({
1673
- ...this._def,
1674
- unknownKeys: "passthrough"
1675
- });
1676
- }
1677
- // const AugmentFactory =
1678
- // <Def extends ZodObjectDef>(def: Def) =>
1679
- // <Augmentation extends ZodRawShape>(
1680
- // augmentation: Augmentation
1681
- // ): ZodObject<
1682
- // extendShape<ReturnType<Def["shape"]>, Augmentation>,
1683
- // Def["unknownKeys"],
1684
- // Def["catchall"]
1685
- // > => {
1686
- // return new ZodObject({
1687
- // ...def,
1688
- // shape: () => ({
1689
- // ...def.shape(),
1690
- // ...augmentation,
1691
- // }),
1692
- // }) as any;
1693
- // };
1694
- extend(e) {
1695
- return new k({
1696
- ...this._def,
1697
- shape: () => ({
1698
- ...this._def.shape(),
1699
- ...e
1700
- })
1701
- });
1702
- }
1703
- /**
1704
- * Prior to zod@1.0.12 there was a bug in the
1705
- * inferred type of merged objects. Please
1706
- * upgrade if you are experiencing issues.
1707
- */
1708
- merge(e) {
1709
- return new k({
1710
- unknownKeys: e._def.unknownKeys,
1711
- catchall: e._def.catchall,
1712
- shape: () => ({
1713
- ...this._def.shape(),
1714
- ...e._def.shape()
1715
- }),
1716
- typeName: _.ZodObject
1717
- });
1718
- }
1719
- // merge<
1720
- // Incoming extends AnyZodObject,
1721
- // Augmentation extends Incoming["shape"],
1722
- // NewOutput extends {
1723
- // [k in keyof Augmentation | keyof Output]: k extends keyof Augmentation
1724
- // ? Augmentation[k]["_output"]
1725
- // : k extends keyof Output
1726
- // ? Output[k]
1727
- // : never;
1728
- // },
1729
- // NewInput extends {
1730
- // [k in keyof Augmentation | keyof Input]: k extends keyof Augmentation
1731
- // ? Augmentation[k]["_input"]
1732
- // : k extends keyof Input
1733
- // ? Input[k]
1734
- // : never;
1735
- // }
1736
- // >(
1737
- // merging: Incoming
1738
- // ): ZodObject<
1739
- // extendShape<T, ReturnType<Incoming["_def"]["shape"]>>,
1740
- // Incoming["_def"]["unknownKeys"],
1741
- // Incoming["_def"]["catchall"],
1742
- // NewOutput,
1743
- // NewInput
1744
- // > {
1745
- // const merged: any = new ZodObject({
1746
- // unknownKeys: merging._def.unknownKeys,
1747
- // catchall: merging._def.catchall,
1748
- // shape: () =>
1749
- // objectUtil.mergeShapes(this._def.shape(), merging._def.shape()),
1750
- // typeName: ZodFirstPartyTypeKind.ZodObject,
1751
- // }) as any;
1752
- // return merged;
1753
- // }
1754
- setKey(e, n) {
1755
- return this.augment({ [e]: n });
1756
- }
1757
- // merge<Incoming extends AnyZodObject>(
1758
- // merging: Incoming
1759
- // ): //ZodObject<T & Incoming["_shape"], UnknownKeys, Catchall> = (merging) => {
1760
- // ZodObject<
1761
- // extendShape<T, ReturnType<Incoming["_def"]["shape"]>>,
1762
- // Incoming["_def"]["unknownKeys"],
1763
- // Incoming["_def"]["catchall"]
1764
- // > {
1765
- // // const mergedShape = objectUtil.mergeShapes(
1766
- // // this._def.shape(),
1767
- // // merging._def.shape()
1768
- // // );
1769
- // const merged: any = new ZodObject({
1770
- // unknownKeys: merging._def.unknownKeys,
1771
- // catchall: merging._def.catchall,
1772
- // shape: () =>
1773
- // objectUtil.mergeShapes(this._def.shape(), merging._def.shape()),
1774
- // typeName: ZodFirstPartyTypeKind.ZodObject,
1775
- // }) as any;
1776
- // return merged;
1777
- // }
1778
- catchall(e) {
1779
- return new k({
1780
- ...this._def,
1781
- catchall: e
1782
- });
1783
- }
1784
- pick(e) {
1785
- const n = {};
1786
- return b.objectKeys(e).forEach((s) => {
1787
- e[s] && this.shape[s] && (n[s] = this.shape[s]);
1788
- }), new k({
1789
- ...this._def,
1790
- shape: () => n
1791
- });
1792
- }
1793
- omit(e) {
1794
- const n = {};
1795
- return b.objectKeys(this.shape).forEach((s) => {
1796
- e[s] || (n[s] = this.shape[s]);
1797
- }), new k({
1798
- ...this._def,
1799
- shape: () => n
1800
- });
1801
- }
1802
- /**
1803
- * @deprecated
1804
- */
1805
- deepPartial() {
1806
- return H(this);
1807
- }
1808
- partial(e) {
1809
- const n = {};
1810
- return b.objectKeys(this.shape).forEach((s) => {
1811
- const a = this.shape[s];
1812
- e && !e[s] ? n[s] = a : n[s] = a.optional();
1813
- }), new k({
1814
- ...this._def,
1815
- shape: () => n
1816
- });
1817
- }
1818
- required(e) {
1819
- const n = {};
1820
- return b.objectKeys(this.shape).forEach((s) => {
1821
- if (e && !e[s])
1822
- n[s] = this.shape[s];
1823
- else {
1824
- let i = this.shape[s];
1825
- for (; i instanceof j; )
1826
- i = i._def.innerType;
1827
- n[s] = i;
1828
- }
1829
- }), new k({
1830
- ...this._def,
1831
- shape: () => n
1832
- });
1833
- }
1834
- keyof() {
1835
- return Ke(b.objectKeys(this.shape));
1836
- }
1837
- }
1838
- k.create = (t, e) => new k({
1839
- shape: () => t,
1840
- unknownKeys: "strip",
1841
- catchall: R.create(),
1842
- typeName: _.ZodObject,
1843
- ...y(e)
1844
- });
1845
- k.strictCreate = (t, e) => new k({
1846
- shape: () => t,
1847
- unknownKeys: "strict",
1848
- catchall: R.create(),
1849
- typeName: _.ZodObject,
1850
- ...y(e)
1851
- });
1852
- k.lazycreate = (t, e) => new k({
1853
- shape: t,
1854
- unknownKeys: "strip",
1855
- catchall: R.create(),
1856
- typeName: _.ZodObject,
1857
- ...y(e)
1858
- });
1859
- class ae extends v {
1860
- _parse(e) {
1861
- const { ctx: n } = this._processInputParams(e), s = this._def.options;
1862
- function a(i) {
1863
- for (const d of i)
1864
- if (d.result.status === "valid")
1865
- return d.result;
1866
- for (const d of i)
1867
- if (d.result.status === "dirty")
1868
- return n.common.issues.push(...d.ctx.common.issues), d.result;
1869
- const o = i.map((d) => new T(d.ctx.common.issues));
1870
- return p(n, {
1871
- code: c.invalid_union,
1872
- unionErrors: o
1873
- }), g;
1874
- }
1875
- if (n.common.async)
1876
- return Promise.all(s.map(async (i) => {
1877
- const o = {
1878
- ...n,
1879
- common: {
1880
- ...n.common,
1881
- issues: []
1882
- },
1883
- parent: null
1884
- };
1885
- return {
1886
- result: await i._parseAsync({
1887
- data: n.data,
1888
- path: n.path,
1889
- parent: o
1890
- }),
1891
- ctx: o
1892
- };
1893
- })).then(a);
1894
- {
1895
- let i;
1896
- const o = [];
1897
- for (const u of s) {
1898
- const l = {
1899
- ...n,
1900
- common: {
1901
- ...n.common,
1902
- issues: []
1903
- },
1904
- parent: null
1905
- }, m = u._parseSync({
1906
- data: n.data,
1907
- path: n.path,
1908
- parent: l
1909
- });
1910
- if (m.status === "valid")
1911
- return m;
1912
- m.status === "dirty" && !i && (i = { result: m, ctx: l }), l.common.issues.length && o.push(l.common.issues);
1913
- }
1914
- if (i)
1915
- return n.common.issues.push(...i.ctx.common.issues), i.result;
1916
- const d = o.map((u) => new T(u));
1917
- return p(n, {
1918
- code: c.invalid_union,
1919
- unionErrors: d
1920
- }), g;
1921
- }
1922
- }
1923
- get options() {
1924
- return this._def.options;
1925
- }
1926
- }
1927
- ae.create = (t, e) => new ae({
1928
- options: t,
1929
- typeName: _.ZodUnion,
1930
- ...y(e)
1931
- });
1932
- const Z = (t) => t instanceof de ? Z(t.schema) : t instanceof O ? Z(t.innerType()) : t instanceof ce ? [t.value] : t instanceof M ? t.options : t instanceof le ? b.objectValues(t.enum) : t instanceof ue ? Z(t._def.innerType) : t instanceof re ? [void 0] : t instanceof se ? [null] : t instanceof j ? [void 0, ...Z(t.unwrap())] : t instanceof U ? [null, ...Z(t.unwrap())] : t instanceof Pe || t instanceof fe ? Z(t.unwrap()) : t instanceof pe ? Z(t._def.innerType) : [];
1933
- class xe extends v {
1934
- _parse(e) {
1935
- const { ctx: n } = this._processInputParams(e);
1936
- if (n.parsedType !== f.object)
1937
- return p(n, {
1938
- code: c.invalid_type,
1939
- expected: f.object,
1940
- received: n.parsedType
1941
- }), g;
1942
- const s = this.discriminator, a = n.data[s], i = this.optionsMap.get(a);
1943
- return i ? n.common.async ? i._parseAsync({
1944
- data: n.data,
1945
- path: n.path,
1946
- parent: n
1947
- }) : i._parseSync({
1948
- data: n.data,
1949
- path: n.path,
1950
- parent: n
1951
- }) : (p(n, {
1952
- code: c.invalid_union_discriminator,
1953
- options: Array.from(this.optionsMap.keys()),
1954
- path: [s]
1955
- }), g);
1956
- }
1957
- get discriminator() {
1958
- return this._def.discriminator;
1959
- }
1960
- get options() {
1961
- return this._def.options;
1962
- }
1963
- get optionsMap() {
1964
- return this._def.optionsMap;
1965
- }
1966
- /**
1967
- * The constructor of the discriminated union schema. Its behaviour is very similar to that of the normal z.union() constructor.
1968
- * However, it only allows a union of objects, all of which need to share a discriminator property. This property must
1969
- * have a different value for each object in the union.
1970
- * @param discriminator the name of the discriminator property
1971
- * @param types an array of object schemas
1972
- * @param params
1973
- */
1974
- static create(e, n, s) {
1975
- const a = /* @__PURE__ */ new Map();
1976
- for (const i of n) {
1977
- const o = Z(i.shape[e]);
1978
- if (!o.length)
1979
- throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);
1980
- for (const d of o) {
1981
- if (a.has(d))
1982
- throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(d)}`);
1983
- a.set(d, i);
1984
- }
1985
- }
1986
- return new xe({
1987
- typeName: _.ZodDiscriminatedUnion,
1988
- discriminator: e,
1989
- options: n,
1990
- optionsMap: a,
1991
- ...y(s)
1992
- });
1993
- }
1994
- }
1995
- function Ae(t, e) {
1996
- const n = A(t), s = A(e);
1997
- if (t === e)
1998
- return { valid: !0, data: t };
1999
- if (n === f.object && s === f.object) {
2000
- const a = b.objectKeys(e), i = b.objectKeys(t).filter((d) => a.indexOf(d) !== -1), o = { ...t, ...e };
2001
- for (const d of i) {
2002
- const u = Ae(t[d], e[d]);
2003
- if (!u.valid)
2004
- return { valid: !1 };
2005
- o[d] = u.data;
2006
- }
2007
- return { valid: !0, data: o };
2008
- } else if (n === f.array && s === f.array) {
2009
- if (t.length !== e.length)
2010
- return { valid: !1 };
2011
- const a = [];
2012
- for (let i = 0; i < t.length; i++) {
2013
- const o = t[i], d = e[i], u = Ae(o, d);
2014
- if (!u.valid)
2015
- return { valid: !1 };
2016
- a.push(u.data);
2017
- }
2018
- return { valid: !0, data: a };
2019
- } else return n === f.date && s === f.date && +t == +e ? { valid: !0, data: t } : { valid: !1 };
2020
- }
2021
- class ie extends v {
2022
- _parse(e) {
2023
- const { status: n, ctx: s } = this._processInputParams(e), a = (i, o) => {
2024
- if (Ze(i) || Ze(o))
2025
- return g;
2026
- const d = Ae(i.value, o.value);
2027
- return d.valid ? ((Re(i) || Re(o)) && n.dirty(), { status: n.value, value: d.data }) : (p(s, {
2028
- code: c.invalid_intersection_types
2029
- }), g);
2030
- };
2031
- return s.common.async ? Promise.all([
2032
- this._def.left._parseAsync({
2033
- data: s.data,
2034
- path: s.path,
2035
- parent: s
2036
- }),
2037
- this._def.right._parseAsync({
2038
- data: s.data,
2039
- path: s.path,
2040
- parent: s
2041
- })
2042
- ]).then(([i, o]) => a(i, o)) : a(this._def.left._parseSync({
2043
- data: s.data,
2044
- path: s.path,
2045
- parent: s
2046
- }), this._def.right._parseSync({
2047
- data: s.data,
2048
- path: s.path,
2049
- parent: s
2050
- }));
2051
- }
2052
- }
2053
- ie.create = (t, e, n) => new ie({
2054
- left: t,
2055
- right: e,
2056
- typeName: _.ZodIntersection,
2057
- ...y(n)
2058
- });
2059
- class N extends v {
2060
- _parse(e) {
2061
- const { status: n, ctx: s } = this._processInputParams(e);
2062
- if (s.parsedType !== f.array)
2063
- return p(s, {
2064
- code: c.invalid_type,
2065
- expected: f.array,
2066
- received: s.parsedType
2067
- }), g;
2068
- if (s.data.length < this._def.items.length)
2069
- return p(s, {
2070
- code: c.too_small,
2071
- minimum: this._def.items.length,
2072
- inclusive: !0,
2073
- exact: !1,
2074
- type: "array"
2075
- }), g;
2076
- !this._def.rest && s.data.length > this._def.items.length && (p(s, {
2077
- code: c.too_big,
2078
- maximum: this._def.items.length,
2079
- inclusive: !0,
2080
- exact: !1,
2081
- type: "array"
2082
- }), n.dirty());
2083
- const i = [...s.data].map((o, d) => {
2084
- const u = this._def.items[d] || this._def.rest;
2085
- return u ? u._parse(new I(s, o, s.path, d)) : null;
2086
- }).filter((o) => !!o);
2087
- return s.common.async ? Promise.all(i).then((o) => w.mergeArray(n, o)) : w.mergeArray(n, i);
2088
- }
2089
- get items() {
2090
- return this._def.items;
2091
- }
2092
- rest(e) {
2093
- return new N({
2094
- ...this._def,
2095
- rest: e
2096
- });
2097
- }
2098
- }
2099
- N.create = (t, e) => {
2100
- if (!Array.isArray(t))
2101
- throw new Error("You must pass an array of schemas to z.tuple([ ... ])");
2102
- return new N({
2103
- items: t,
2104
- typeName: _.ZodTuple,
2105
- rest: null,
2106
- ...y(e)
2107
- });
2108
- };
2109
- class oe extends v {
2110
- get keySchema() {
2111
- return this._def.keyType;
2112
- }
2113
- get valueSchema() {
2114
- return this._def.valueType;
2115
- }
2116
- _parse(e) {
2117
- const { status: n, ctx: s } = this._processInputParams(e);
2118
- if (s.parsedType !== f.object)
2119
- return p(s, {
2120
- code: c.invalid_type,
2121
- expected: f.object,
2122
- received: s.parsedType
2123
- }), g;
2124
- const a = [], i = this._def.keyType, o = this._def.valueType;
2125
- for (const d in s.data)
2126
- a.push({
2127
- key: i._parse(new I(s, d, s.path, d)),
2128
- value: o._parse(new I(s, s.data[d], s.path, d)),
2129
- alwaysSet: d in s.data
2130
- });
2131
- return s.common.async ? w.mergeObjectAsync(n, a) : w.mergeObjectSync(n, a);
2132
- }
2133
- get element() {
2134
- return this._def.valueType;
2135
- }
2136
- static create(e, n, s) {
2137
- return n instanceof v ? new oe({
2138
- keyType: e,
2139
- valueType: n,
2140
- typeName: _.ZodRecord,
2141
- ...y(s)
2142
- }) : new oe({
2143
- keyType: E.create(),
2144
- valueType: e,
2145
- typeName: _.ZodRecord,
2146
- ...y(n)
2147
- });
2148
- }
2149
- }
2150
- class be extends v {
2151
- get keySchema() {
2152
- return this._def.keyType;
2153
- }
2154
- get valueSchema() {
2155
- return this._def.valueType;
2156
- }
2157
- _parse(e) {
2158
- const { status: n, ctx: s } = this._processInputParams(e);
2159
- if (s.parsedType !== f.map)
2160
- return p(s, {
2161
- code: c.invalid_type,
2162
- expected: f.map,
2163
- received: s.parsedType
2164
- }), g;
2165
- const a = this._def.keyType, i = this._def.valueType, o = [...s.data.entries()].map(([d, u], l) => ({
2166
- key: a._parse(new I(s, d, s.path, [l, "key"])),
2167
- value: i._parse(new I(s, u, s.path, [l, "value"]))
2168
- }));
2169
- if (s.common.async) {
2170
- const d = /* @__PURE__ */ new Map();
2171
- return Promise.resolve().then(async () => {
2172
- for (const u of o) {
2173
- const l = await u.key, m = await u.value;
2174
- if (l.status === "aborted" || m.status === "aborted")
2175
- return g;
2176
- (l.status === "dirty" || m.status === "dirty") && n.dirty(), d.set(l.value, m.value);
2177
- }
2178
- return { status: n.value, value: d };
2179
- });
2180
- } else {
2181
- const d = /* @__PURE__ */ new Map();
2182
- for (const u of o) {
2183
- const l = u.key, m = u.value;
2184
- if (l.status === "aborted" || m.status === "aborted")
2185
- return g;
2186
- (l.status === "dirty" || m.status === "dirty") && n.dirty(), d.set(l.value, m.value);
2187
- }
2188
- return { status: n.value, value: d };
2189
- }
2190
- }
2191
- }
2192
- be.create = (t, e, n) => new be({
2193
- valueType: e,
2194
- keyType: t,
2195
- typeName: _.ZodMap,
2196
- ...y(n)
2197
- });
2198
- class L extends v {
2199
- _parse(e) {
2200
- const { status: n, ctx: s } = this._processInputParams(e);
2201
- if (s.parsedType !== f.set)
2202
- return p(s, {
2203
- code: c.invalid_type,
2204
- expected: f.set,
2205
- received: s.parsedType
2206
- }), g;
2207
- const a = this._def;
2208
- a.minSize !== null && s.data.size < a.minSize.value && (p(s, {
2209
- code: c.too_small,
2210
- minimum: a.minSize.value,
2211
- type: "set",
2212
- inclusive: !0,
2213
- exact: !1,
2214
- message: a.minSize.message
2215
- }), n.dirty()), a.maxSize !== null && s.data.size > a.maxSize.value && (p(s, {
2216
- code: c.too_big,
2217
- maximum: a.maxSize.value,
2218
- type: "set",
2219
- inclusive: !0,
2220
- exact: !1,
2221
- message: a.maxSize.message
2222
- }), n.dirty());
2223
- const i = this._def.valueType;
2224
- function o(u) {
2225
- const l = /* @__PURE__ */ new Set();
2226
- for (const m of u) {
2227
- if (m.status === "aborted")
2228
- return g;
2229
- m.status === "dirty" && n.dirty(), l.add(m.value);
2230
- }
2231
- return { status: n.value, value: l };
2232
- }
2233
- const d = [...s.data.values()].map((u, l) => i._parse(new I(s, u, s.path, l)));
2234
- return s.common.async ? Promise.all(d).then((u) => o(u)) : o(d);
2235
- }
2236
- min(e, n) {
2237
- return new L({
2238
- ...this._def,
2239
- minSize: { value: e, message: h.toString(n) }
2240
- });
2241
- }
2242
- max(e, n) {
2243
- return new L({
2244
- ...this._def,
2245
- maxSize: { value: e, message: h.toString(n) }
2246
- });
2247
- }
2248
- size(e, n) {
2249
- return this.min(e, n).max(e, n);
2250
- }
2251
- nonempty(e) {
2252
- return this.min(1, e);
2253
- }
2254
- }
2255
- L.create = (t, e) => new L({
2256
- valueType: t,
2257
- minSize: null,
2258
- maxSize: null,
2259
- typeName: _.ZodSet,
2260
- ...y(e)
2261
- });
2262
- class G extends v {
2263
- constructor() {
2264
- super(...arguments), this.validate = this.implement;
2265
- }
2266
- _parse(e) {
2267
- const { ctx: n } = this._processInputParams(e);
2268
- if (n.parsedType !== f.function)
2269
- return p(n, {
2270
- code: c.invalid_type,
2271
- expected: f.function,
2272
- received: n.parsedType
2273
- }), g;
2274
- function s(d, u) {
2275
- return _e({
2276
- data: d,
2277
- path: n.path,
2278
- errorMaps: [
2279
- n.common.contextualErrorMap,
2280
- n.schemaErrorMap,
2281
- me(),
2282
- K
2283
- ].filter((l) => !!l),
2284
- issueData: {
2285
- code: c.invalid_arguments,
2286
- argumentsError: u
2287
- }
2288
- });
2289
- }
2290
- function a(d, u) {
2291
- return _e({
2292
- data: d,
2293
- path: n.path,
2294
- errorMaps: [
2295
- n.common.contextualErrorMap,
2296
- n.schemaErrorMap,
2297
- me(),
2298
- K
2299
- ].filter((l) => !!l),
2300
- issueData: {
2301
- code: c.invalid_return_type,
2302
- returnTypeError: u
2303
- }
2304
- });
2305
- }
2306
- const i = { errorMap: n.common.contextualErrorMap }, o = n.data;
2307
- if (this._def.returns instanceof Y) {
2308
- const d = this;
2309
- return S(async function(...u) {
2310
- const l = new T([]), m = await d._def.args.parseAsync(u, i).catch((z) => {
2311
- throw l.addIssue(s(u, z)), l;
2312
- }), x = await Reflect.apply(o, this, m);
2313
- return await d._def.returns._def.type.parseAsync(x, i).catch((z) => {
2314
- throw l.addIssue(a(x, z)), l;
2315
- });
2316
- });
2317
- } else {
2318
- const d = this;
2319
- return S(function(...u) {
2320
- const l = d._def.args.safeParse(u, i);
2321
- if (!l.success)
2322
- throw new T([s(u, l.error)]);
2323
- const m = Reflect.apply(o, this, l.data), x = d._def.returns.safeParse(m, i);
2324
- if (!x.success)
2325
- throw new T([a(m, x.error)]);
2326
- return x.data;
2327
- });
2328
- }
2329
- }
2330
- parameters() {
2331
- return this._def.args;
2332
- }
2333
- returnType() {
2334
- return this._def.returns;
2335
- }
2336
- args(...e) {
2337
- return new G({
2338
- ...this._def,
2339
- args: N.create(e).rest($.create())
2340
- });
2341
- }
2342
- returns(e) {
2343
- return new G({
2344
- ...this._def,
2345
- returns: e
2346
- });
2347
- }
2348
- implement(e) {
2349
- return this.parse(e);
2350
- }
2351
- strictImplement(e) {
2352
- return this.parse(e);
2353
- }
2354
- static create(e, n, s) {
2355
- return new G({
2356
- args: e || N.create([]).rest($.create()),
2357
- returns: n || $.create(),
2358
- typeName: _.ZodFunction,
2359
- ...y(s)
2360
- });
2361
- }
2362
- }
2363
- class de extends v {
2364
- get schema() {
2365
- return this._def.getter();
2366
- }
2367
- _parse(e) {
2368
- const { ctx: n } = this._processInputParams(e);
2369
- return this._def.getter()._parse({ data: n.data, path: n.path, parent: n });
2370
- }
2371
- }
2372
- de.create = (t, e) => new de({
2373
- getter: t,
2374
- typeName: _.ZodLazy,
2375
- ...y(e)
2376
- });
2377
- class ce extends v {
2378
- _parse(e) {
2379
- if (e.data !== this._def.value) {
2380
- const n = this._getOrReturnCtx(e);
2381
- return p(n, {
2382
- received: n.data,
2383
- code: c.invalid_literal,
2384
- expected: this._def.value
2385
- }), g;
2386
- }
2387
- return { status: "valid", value: e.data };
2388
- }
2389
- get value() {
2390
- return this._def.value;
2391
- }
2392
- }
2393
- ce.create = (t, e) => new ce({
2394
- value: t,
2395
- typeName: _.ZodLiteral,
2396
- ...y(e)
2397
- });
2398
- function Ke(t, e) {
2399
- return new M({
2400
- values: t,
2401
- typeName: _.ZodEnum,
2402
- ...y(e)
2403
- });
2404
- }
2405
- class M extends v {
2406
- constructor() {
2407
- super(...arguments), Q.set(this, void 0);
2408
- }
2409
- _parse(e) {
2410
- if (typeof e.data != "string") {
2411
- const n = this._getOrReturnCtx(e), s = this._def.values;
2412
- return p(n, {
2413
- expected: b.joinValues(s),
2414
- received: n.parsedType,
2415
- code: c.invalid_type
2416
- }), g;
2417
- }
2418
- if (ge(this, Q) || We(this, Q, new Set(this._def.values)), !ge(this, Q).has(e.data)) {
2419
- const n = this._getOrReturnCtx(e), s = this._def.values;
2420
- return p(n, {
2421
- received: n.data,
2422
- code: c.invalid_enum_value,
2423
- options: s
2424
- }), g;
2425
- }
2426
- return S(e.data);
2427
- }
2428
- get options() {
2429
- return this._def.values;
2430
- }
2431
- get enum() {
2432
- const e = {};
2433
- for (const n of this._def.values)
2434
- e[n] = n;
2435
- return e;
2436
- }
2437
- get Values() {
2438
- const e = {};
2439
- for (const n of this._def.values)
2440
- e[n] = n;
2441
- return e;
2442
- }
2443
- get Enum() {
2444
- const e = {};
2445
- for (const n of this._def.values)
2446
- e[n] = n;
2447
- return e;
2448
- }
2449
- extract(e, n = this._def) {
2450
- return M.create(e, {
2451
- ...this._def,
2452
- ...n
2453
- });
2454
- }
2455
- exclude(e, n = this._def) {
2456
- return M.create(this.options.filter((s) => !e.includes(s)), {
2457
- ...this._def,
2458
- ...n
2459
- });
2460
- }
2461
- }
2462
- Q = /* @__PURE__ */ new WeakMap();
2463
- M.create = Ke;
2464
- class le extends v {
2465
- constructor() {
2466
- super(...arguments), X.set(this, void 0);
2467
- }
2468
- _parse(e) {
2469
- const n = b.getValidEnumValues(this._def.values), s = this._getOrReturnCtx(e);
2470
- if (s.parsedType !== f.string && s.parsedType !== f.number) {
2471
- const a = b.objectValues(n);
2472
- return p(s, {
2473
- expected: b.joinValues(a),
2474
- received: s.parsedType,
2475
- code: c.invalid_type
2476
- }), g;
2477
- }
2478
- if (ge(this, X) || We(this, X, new Set(b.getValidEnumValues(this._def.values))), !ge(this, X).has(e.data)) {
2479
- const a = b.objectValues(n);
2480
- return p(s, {
2481
- received: s.data,
2482
- code: c.invalid_enum_value,
2483
- options: a
2484
- }), g;
2485
- }
2486
- return S(e.data);
2487
- }
2488
- get enum() {
2489
- return this._def.values;
2490
- }
2491
- }
2492
- X = /* @__PURE__ */ new WeakMap();
2493
- le.create = (t, e) => new le({
2494
- values: t,
2495
- typeName: _.ZodNativeEnum,
2496
- ...y(e)
2497
- });
2498
- class Y extends v {
2499
- unwrap() {
2500
- return this._def.type;
2501
- }
2502
- _parse(e) {
2503
- const { ctx: n } = this._processInputParams(e);
2504
- if (n.parsedType !== f.promise && n.common.async === !1)
2505
- return p(n, {
2506
- code: c.invalid_type,
2507
- expected: f.promise,
2508
- received: n.parsedType
2509
- }), g;
2510
- const s = n.parsedType === f.promise ? n.data : Promise.resolve(n.data);
2511
- return S(s.then((a) => this._def.type.parseAsync(a, {
2512
- path: n.path,
2513
- errorMap: n.common.contextualErrorMap
2514
- })));
2515
- }
2516
- }
2517
- Y.create = (t, e) => new Y({
2518
- type: t,
2519
- typeName: _.ZodPromise,
2520
- ...y(e)
2521
- });
2522
- class O extends v {
2523
- innerType() {
2524
- return this._def.schema;
2525
- }
2526
- sourceType() {
2527
- return this._def.schema._def.typeName === _.ZodEffects ? this._def.schema.sourceType() : this._def.schema;
2528
- }
2529
- _parse(e) {
2530
- const { status: n, ctx: s } = this._processInputParams(e), a = this._def.effect || null, i = {
2531
- addIssue: (o) => {
2532
- p(s, o), o.fatal ? n.abort() : n.dirty();
2533
- },
2534
- get path() {
2535
- return s.path;
2536
- }
2537
- };
2538
- if (i.addIssue = i.addIssue.bind(i), a.type === "preprocess") {
2539
- const o = a.transform(s.data, i);
2540
- if (s.common.async)
2541
- return Promise.resolve(o).then(async (d) => {
2542
- if (n.value === "aborted")
2543
- return g;
2544
- const u = await this._def.schema._parseAsync({
2545
- data: d,
2546
- path: s.path,
2547
- parent: s
2548
- });
2549
- return u.status === "aborted" ? g : u.status === "dirty" || n.value === "dirty" ? q(u.value) : u;
2550
- });
2551
- {
2552
- if (n.value === "aborted")
2553
- return g;
2554
- const d = this._def.schema._parseSync({
2555
- data: o,
2556
- path: s.path,
2557
- parent: s
2558
- });
2559
- return d.status === "aborted" ? g : d.status === "dirty" || n.value === "dirty" ? q(d.value) : d;
2560
- }
2561
- }
2562
- if (a.type === "refinement") {
2563
- const o = (d) => {
2564
- const u = a.refinement(d, i);
2565
- if (s.common.async)
2566
- return Promise.resolve(u);
2567
- if (u instanceof Promise)
2568
- throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");
2569
- return d;
2570
- };
2571
- if (s.common.async === !1) {
2572
- const d = this._def.schema._parseSync({
2573
- data: s.data,
2574
- path: s.path,
2575
- parent: s
2576
- });
2577
- return d.status === "aborted" ? g : (d.status === "dirty" && n.dirty(), o(d.value), { status: n.value, value: d.value });
2578
- } else
2579
- return this._def.schema._parseAsync({ data: s.data, path: s.path, parent: s }).then((d) => d.status === "aborted" ? g : (d.status === "dirty" && n.dirty(), o(d.value).then(() => ({ status: n.value, value: d.value }))));
2580
- }
2581
- if (a.type === "transform")
2582
- if (s.common.async === !1) {
2583
- const o = this._def.schema._parseSync({
2584
- data: s.data,
2585
- path: s.path,
2586
- parent: s
2587
- });
2588
- if (!ee(o))
2589
- return o;
2590
- const d = a.transform(o.value, i);
2591
- if (d instanceof Promise)
2592
- throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");
2593
- return { status: n.value, value: d };
2594
- } else
2595
- return this._def.schema._parseAsync({ data: s.data, path: s.path, parent: s }).then((o) => ee(o) ? Promise.resolve(a.transform(o.value, i)).then((d) => ({ status: n.value, value: d })) : o);
2596
- b.assertNever(a);
2597
- }
2598
- }
2599
- O.create = (t, e, n) => new O({
2600
- schema: t,
2601
- typeName: _.ZodEffects,
2602
- effect: e,
2603
- ...y(n)
2604
- });
2605
- O.createWithPreprocess = (t, e, n) => new O({
2606
- schema: e,
2607
- effect: { type: "preprocess", transform: t },
2608
- typeName: _.ZodEffects,
2609
- ...y(n)
2610
- });
2611
- class j extends v {
2612
- _parse(e) {
2613
- return this._getType(e) === f.undefined ? S(void 0) : this._def.innerType._parse(e);
2614
- }
2615
- unwrap() {
2616
- return this._def.innerType;
2617
- }
2618
- }
2619
- j.create = (t, e) => new j({
2620
- innerType: t,
2621
- typeName: _.ZodOptional,
2622
- ...y(e)
2623
- });
2624
- class U extends v {
2625
- _parse(e) {
2626
- return this._getType(e) === f.null ? S(null) : this._def.innerType._parse(e);
2627
- }
2628
- unwrap() {
2629
- return this._def.innerType;
2630
- }
2631
- }
2632
- U.create = (t, e) => new U({
2633
- innerType: t,
2634
- typeName: _.ZodNullable,
2635
- ...y(e)
2636
- });
2637
- class ue extends v {
2638
- _parse(e) {
2639
- const { ctx: n } = this._processInputParams(e);
2640
- let s = n.data;
2641
- return n.parsedType === f.undefined && (s = this._def.defaultValue()), this._def.innerType._parse({
2642
- data: s,
2643
- path: n.path,
2644
- parent: n
2645
- });
2646
- }
2647
- removeDefault() {
2648
- return this._def.innerType;
2649
- }
2650
- }
2651
- ue.create = (t, e) => new ue({
2652
- innerType: t,
2653
- typeName: _.ZodDefault,
2654
- defaultValue: typeof e.default == "function" ? e.default : () => e.default,
2655
- ...y(e)
2656
- });
2657
- class pe extends v {
2658
- _parse(e) {
2659
- const { ctx: n } = this._processInputParams(e), s = {
2660
- ...n,
2661
- common: {
2662
- ...n.common,
2663
- issues: []
2664
- }
2665
- }, a = this._def.innerType._parse({
2666
- data: s.data,
2667
- path: s.path,
2668
- parent: {
2669
- ...s
2670
- }
2671
- });
2672
- return te(a) ? a.then((i) => ({
2673
- status: "valid",
2674
- value: i.status === "valid" ? i.value : this._def.catchValue({
2675
- get error() {
2676
- return new T(s.common.issues);
2677
- },
2678
- input: s.data
2679
- })
2680
- })) : {
2681
- status: "valid",
2682
- value: a.status === "valid" ? a.value : this._def.catchValue({
2683
- get error() {
2684
- return new T(s.common.issues);
2685
- },
2686
- input: s.data
2687
- })
2688
- };
2689
- }
2690
- removeCatch() {
2691
- return this._def.innerType;
2692
- }
2693
- }
2694
- pe.create = (t, e) => new pe({
2695
- innerType: t,
2696
- typeName: _.ZodCatch,
2697
- catchValue: typeof e.catch == "function" ? e.catch : () => e.catch,
2698
- ...y(e)
2699
- });
2700
- class ke extends v {
2701
- _parse(e) {
2702
- if (this._getType(e) !== f.nan) {
2703
- const s = this._getOrReturnCtx(e);
2704
- return p(s, {
2705
- code: c.invalid_type,
2706
- expected: f.nan,
2707
- received: s.parsedType
2708
- }), g;
2709
- }
2710
- return { status: "valid", value: e.data };
2711
- }
2712
- }
2713
- ke.create = (t) => new ke({
2714
- typeName: _.ZodNaN,
2715
- ...y(t)
2716
- });
2717
- const Ct = Symbol("zod_brand");
2718
- class Pe extends v {
2719
- _parse(e) {
2720
- const { ctx: n } = this._processInputParams(e), s = n.data;
2721
- return this._def.type._parse({
2722
- data: s,
2723
- path: n.path,
2724
- parent: n
2725
- });
2726
- }
2727
- unwrap() {
2728
- return this._def.type;
2729
- }
2730
- }
2731
- class he extends v {
2732
- _parse(e) {
2733
- const { status: n, ctx: s } = this._processInputParams(e);
2734
- if (s.common.async)
2735
- return (async () => {
2736
- const i = await this._def.in._parseAsync({
2737
- data: s.data,
2738
- path: s.path,
2739
- parent: s
2740
- });
2741
- return i.status === "aborted" ? g : i.status === "dirty" ? (n.dirty(), q(i.value)) : this._def.out._parseAsync({
2742
- data: i.value,
2743
- path: s.path,
2744
- parent: s
2745
- });
2746
- })();
2747
- {
2748
- const a = this._def.in._parseSync({
2749
- data: s.data,
2750
- path: s.path,
2751
- parent: s
2752
- });
2753
- return a.status === "aborted" ? g : a.status === "dirty" ? (n.dirty(), {
2754
- status: "dirty",
2755
- value: a.value
2756
- }) : this._def.out._parseSync({
2757
- data: a.value,
2758
- path: s.path,
2759
- parent: s
2760
- });
2761
- }
2762
- }
2763
- static create(e, n) {
2764
- return new he({
2765
- in: e,
2766
- out: n,
2767
- typeName: _.ZodPipeline
2768
- });
2769
- }
2770
- }
2771
- class fe extends v {
2772
- _parse(e) {
2773
- const n = this._def.innerType._parse(e), s = (a) => (ee(a) && (a.value = Object.freeze(a.value)), a);
2774
- return te(n) ? n.then((a) => s(a)) : s(n);
2775
- }
2776
- unwrap() {
2777
- return this._def.innerType;
2778
- }
2779
- }
2780
- fe.create = (t, e) => new fe({
2781
- innerType: t,
2782
- typeName: _.ZodReadonly,
2783
- ...y(e)
2784
- });
2785
- function Fe(t, e = {}, n) {
2786
- return t ? F.create().superRefine((s, a) => {
2787
- var i, o;
2788
- if (!t(s)) {
2789
- const d = typeof e == "function" ? e(s) : typeof e == "string" ? { message: e } : e, u = (o = (i = d.fatal) !== null && i !== void 0 ? i : n) !== null && o !== void 0 ? o : !0, l = typeof d == "string" ? { message: d } : d;
2790
- a.addIssue({ code: "custom", ...l, fatal: u });
2791
- }
2792
- }) : F.create();
2793
- }
2794
- const Ot = {
2795
- object: k.lazycreate
2796
- };
2797
- var _;
2798
- (function(t) {
2799
- t.ZodString = "ZodString", t.ZodNumber = "ZodNumber", t.ZodNaN = "ZodNaN", t.ZodBigInt = "ZodBigInt", t.ZodBoolean = "ZodBoolean", t.ZodDate = "ZodDate", t.ZodSymbol = "ZodSymbol", t.ZodUndefined = "ZodUndefined", t.ZodNull = "ZodNull", t.ZodAny = "ZodAny", t.ZodUnknown = "ZodUnknown", t.ZodNever = "ZodNever", t.ZodVoid = "ZodVoid", t.ZodArray = "ZodArray", t.ZodObject = "ZodObject", t.ZodUnion = "ZodUnion", t.ZodDiscriminatedUnion = "ZodDiscriminatedUnion", t.ZodIntersection = "ZodIntersection", t.ZodTuple = "ZodTuple", t.ZodRecord = "ZodRecord", t.ZodMap = "ZodMap", t.ZodSet = "ZodSet", t.ZodFunction = "ZodFunction", t.ZodLazy = "ZodLazy", t.ZodLiteral = "ZodLiteral", t.ZodEnum = "ZodEnum", t.ZodEffects = "ZodEffects", t.ZodNativeEnum = "ZodNativeEnum", t.ZodOptional = "ZodOptional", t.ZodNullable = "ZodNullable", t.ZodDefault = "ZodDefault", t.ZodCatch = "ZodCatch", t.ZodPromise = "ZodPromise", t.ZodBranded = "ZodBranded", t.ZodPipeline = "ZodPipeline", t.ZodReadonly = "ZodReadonly";
2800
- })(_ || (_ = {}));
2801
- const jt = (t, e = {
2802
- message: `Input not instance of ${t.name}`
2803
- }) => Fe((n) => n instanceof t, e), Ye = E.create, Je = P.create, It = ke.create, Nt = D.create, Qe = ne.create, Zt = V.create, Rt = ye.create, At = re.create, Pt = se.create, Dt = F.create, Mt = $.create, Ut = R.create, $t = ve.create, Vt = C.create, Lt = k.create, Bt = k.strictCreate, zt = ae.create, Wt = xe.create, Ht = ie.create, qt = N.create, Gt = oe.create, Kt = be.create, Ft = L.create, Yt = G.create, Jt = de.create, Qt = ce.create, Xt = M.create, en = le.create, tn = Y.create, Be = O.create, nn = j.create, rn = U.create, sn = O.createWithPreprocess, an = he.create, on = () => Ye().optional(), dn = () => Je().optional(), cn = () => Qe().optional(), ln = {
2804
- string: (t) => E.create({ ...t, coerce: !0 }),
2805
- number: (t) => P.create({ ...t, coerce: !0 }),
2806
- boolean: (t) => ne.create({
2807
- ...t,
2808
- coerce: !0
2809
- }),
2810
- bigint: (t) => D.create({ ...t, coerce: !0 }),
2811
- date: (t) => V.create({ ...t, coerce: !0 })
2812
- }, un = g;
2813
- var r = /* @__PURE__ */ Object.freeze({
2814
- __proto__: null,
2815
- defaultErrorMap: K,
2816
- setErrorMap: lt,
2817
- getErrorMap: me,
2818
- makeIssue: _e,
2819
- EMPTY_PATH: ut,
2820
- addIssueToContext: p,
2821
- ParseStatus: w,
2822
- INVALID: g,
2823
- DIRTY: q,
2824
- OK: S,
2825
- isAborted: Ze,
2826
- isDirty: Re,
2827
- isValid: ee,
2828
- isAsync: te,
2829
- get util() {
2830
- return b;
2831
- },
2832
- get objectUtil() {
2833
- return Ne;
2834
- },
2835
- ZodParsedType: f,
2836
- getParsedType: A,
2837
- ZodType: v,
2838
- datetimeRegex: Ge,
2839
- ZodString: E,
2840
- ZodNumber: P,
2841
- ZodBigInt: D,
2842
- ZodBoolean: ne,
2843
- ZodDate: V,
2844
- ZodSymbol: ye,
2845
- ZodUndefined: re,
2846
- ZodNull: se,
2847
- ZodAny: F,
2848
- ZodUnknown: $,
2849
- ZodNever: R,
2850
- ZodVoid: ve,
2851
- ZodArray: C,
2852
- ZodObject: k,
2853
- ZodUnion: ae,
2854
- ZodDiscriminatedUnion: xe,
2855
- ZodIntersection: ie,
2856
- ZodTuple: N,
2857
- ZodRecord: oe,
2858
- ZodMap: be,
2859
- ZodSet: L,
2860
- ZodFunction: G,
2861
- ZodLazy: de,
2862
- ZodLiteral: ce,
2863
- ZodEnum: M,
2864
- ZodNativeEnum: le,
2865
- ZodPromise: Y,
2866
- ZodEffects: O,
2867
- ZodTransformer: O,
2868
- ZodOptional: j,
2869
- ZodNullable: U,
2870
- ZodDefault: ue,
2871
- ZodCatch: pe,
2872
- ZodNaN: ke,
2873
- BRAND: Ct,
2874
- ZodBranded: Pe,
2875
- ZodPipeline: he,
2876
- ZodReadonly: fe,
2877
- custom: Fe,
2878
- Schema: v,
2879
- ZodSchema: v,
2880
- late: Ot,
2881
- get ZodFirstPartyTypeKind() {
2882
- return _;
2883
- },
2884
- coerce: ln,
2885
- any: Dt,
2886
- array: Vt,
2887
- bigint: Nt,
2888
- boolean: Qe,
2889
- date: Zt,
2890
- discriminatedUnion: Wt,
2891
- effect: Be,
2892
- enum: Xt,
2893
- function: Yt,
2894
- instanceof: jt,
2895
- intersection: Ht,
2896
- lazy: Jt,
2897
- literal: Qt,
2898
- map: Kt,
2899
- nan: It,
2900
- nativeEnum: en,
2901
- never: Ut,
2902
- null: Pt,
2903
- nullable: rn,
2904
- number: Je,
2905
- object: Lt,
2906
- oboolean: cn,
2907
- onumber: dn,
2908
- optional: nn,
2909
- ostring: on,
2910
- pipeline: an,
2911
- preprocess: sn,
2912
- promise: tn,
2913
- record: Gt,
2914
- set: Ft,
2915
- strictObject: Bt,
2916
- string: Ye,
2917
- symbol: Rt,
2918
- transformer: Be,
2919
- tuple: qt,
2920
- undefined: At,
2921
- union: zt,
2922
- unknown: Mt,
2923
- void: $t,
2924
- NEVER: un,
2925
- ZodIssueCode: c,
2926
- quotelessJson: ct,
2927
- ZodError: T
2928
- });
2929
- dt(r);
2930
- const Hn = r.object({
2931
- start: r.number(),
2932
- limit: r.number(),
2933
- length: r.number()
2934
- }), De = r.object({
2935
- created_at: r.string(),
2936
- updated_at: r.string()
2937
- }), pn = r.object({
2938
- email: r.string().optional(),
2939
- email_verified: r.boolean().optional(),
2940
- name: r.string().optional(),
2941
- username: r.string().optional(),
2942
- given_name: r.string().optional(),
2943
- phone_number: r.string().optional(),
2944
- phone_verified: r.boolean().optional(),
2945
- family_name: r.string().optional()
2946
- }).catchall(r.any()), fn = r.object({
2947
- connection: r.string(),
2948
- user_id: r.string(),
2949
- provider: r.string(),
2950
- isSocial: r.boolean(),
2951
- access_token: r.string().optional(),
2952
- access_token_secret: r.string().optional(),
2953
- refresh_token: r.string().optional(),
2954
- profileData: pn.optional()
2955
- }), Xe = r.object({
2956
- email: r.string().optional(),
2957
- username: r.string().optional(),
2958
- given_name: r.string().optional(),
2959
- family_name: r.string().optional(),
2960
- nickname: r.string().optional(),
2961
- name: r.string().optional(),
2962
- picture: r.string().optional(),
2963
- locale: r.string().optional(),
2964
- linked_to: r.string().optional(),
2965
- profileData: r.string().optional(),
2966
- user_id: r.string().optional(),
2967
- app_metadata: r.any().default({}).optional(),
2968
- user_metadata: r.any().default({}).optional()
2969
- }), hn = Xe.extend({
2970
- email_verified: r.boolean().default(!1),
2971
- verify_email: r.boolean().optional(),
2972
- last_ip: r.string().optional(),
2973
- last_login: r.string().optional(),
2974
- user_id: r.string().optional(),
2975
- provider: r.string().default("email"),
2976
- connection: r.string().default("email"),
2977
- is_social: r.boolean().optional()
2978
- }), mn = r.object({
2979
- ...hn.shape,
2980
- ...De.shape,
2981
- user_id: r.string(),
2982
- is_social: r.boolean(),
1
+ import { z as t } from "@hono/zod-openapi";
2
+ const W = t.object({
3
+ start: t.number(),
4
+ limit: t.number(),
5
+ length: t.number()
6
+ }), a = t.object({
7
+ created_at: t.string(),
8
+ updated_at: t.string()
9
+ }), p = t.object({
10
+ email: t.string().optional(),
11
+ email_verified: t.boolean().optional(),
12
+ name: t.string().optional(),
13
+ username: t.string().optional(),
14
+ given_name: t.string().optional(),
15
+ phone_number: t.string().optional(),
16
+ phone_verified: t.boolean().optional(),
17
+ family_name: t.string().optional()
18
+ }).catchall(t.any()), d = t.object({
19
+ connection: t.string(),
20
+ user_id: t.string(),
21
+ provider: t.string(),
22
+ isSocial: t.boolean(),
23
+ access_token: t.string().optional(),
24
+ access_token_secret: t.string().optional(),
25
+ refresh_token: t.string().optional(),
26
+ profileData: p.optional()
27
+ }), s = t.object({
28
+ email: t.string().optional(),
29
+ username: t.string().optional(),
30
+ given_name: t.string().optional(),
31
+ family_name: t.string().optional(),
32
+ nickname: t.string().optional(),
33
+ name: t.string().optional(),
34
+ picture: t.string().optional(),
35
+ locale: t.string().optional(),
36
+ linked_to: t.string().optional(),
37
+ profileData: t.string().optional(),
38
+ user_id: t.string().optional(),
39
+ app_metadata: t.any().default({}).optional(),
40
+ user_metadata: t.any().default({}).optional()
41
+ }), g = s.extend({
42
+ email_verified: t.boolean().default(!1),
43
+ verify_email: t.boolean().optional(),
44
+ last_ip: t.string().optional(),
45
+ last_login: t.string().optional(),
46
+ user_id: t.string().optional(),
47
+ provider: t.string().default("email"),
48
+ connection: t.string().default("email"),
49
+ is_social: t.boolean().optional()
50
+ }), _ = t.object({
51
+ ...g.shape,
52
+ ...a.shape,
53
+ user_id: t.string(),
54
+ is_social: t.boolean(),
2983
55
  // TODO: this not might be correct if you use the username
2984
- email: r.string(),
2985
- login_count: r.number(),
2986
- identities: r.array(fn).optional()
2987
- }), qn = mn, Gn = Xe.extend({
2988
- email: r.string(),
2989
- login_count: r.number(),
2990
- multifactor: r.array(r.string()).optional(),
2991
- last_ip: r.string().optional(),
2992
- last_login: r.string().optional(),
2993
- user_id: r.string()
2994
- }).catchall(r.any()), _n = "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";
2995
- let gn = (t = 21) => {
2996
- let e = "", n = crypto.getRandomValues(new Uint8Array(t));
2997
- for (; t--; )
2998
- e += _n[n[t] & 63];
2999
- return e;
56
+ email: t.string(),
57
+ login_count: t.number(),
58
+ identities: t.array(d).optional()
59
+ }), q = _, Q = s.extend({
60
+ email: t.string(),
61
+ login_count: t.number(),
62
+ multifactor: t.array(t.string()).optional(),
63
+ last_ip: t.string().optional(),
64
+ last_login: t.string().optional(),
65
+ user_id: t.string()
66
+ }).catchall(t.any()), u = "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";
67
+ let m = (n = 21) => {
68
+ let i = "", o = crypto.getRandomValues(new Uint8Array(n));
69
+ for (; n--; )
70
+ i += u[o[n] & 63];
71
+ return i;
3000
72
  };
3001
- const yn = r.object({
3002
- audience: r.string().optional(),
3003
- recipient: r.string().optional(),
3004
- createUpnClaim: r.boolean().optional(),
3005
- mapUnknownClaimsAsIs: r.boolean().optional(),
3006
- passthroughClaimsWithNoMapping: r.boolean().optional(),
3007
- mapIdentities: r.boolean().optional(),
3008
- signatureAlgorithm: r.string().optional(),
3009
- digestAlgorithm: r.string().optional(),
3010
- issuer: r.string().optional(),
3011
- destination: r.string().optional(),
3012
- lifetimeInSeconds: r.number().optional(),
3013
- signResponse: r.boolean().optional(),
3014
- nameIdentifierFormat: r.string().optional(),
3015
- nameIdentifierProbes: r.array(r.string()).optional(),
3016
- authnContextClassRef: r.string().optional(),
3017
- mappings: r.record(r.string()).optional()
3018
- }), vn = r.object({
3019
- id: r.string(),
3020
- name: r.string(),
3021
- callbacks: r.array(r.string()).default([]).optional().openapi({
73
+ const h = t.object({
74
+ audience: t.string().optional(),
75
+ recipient: t.string().optional(),
76
+ createUpnClaim: t.boolean().optional(),
77
+ mapUnknownClaimsAsIs: t.boolean().optional(),
78
+ passthroughClaimsWithNoMapping: t.boolean().optional(),
79
+ mapIdentities: t.boolean().optional(),
80
+ signatureAlgorithm: t.string().optional(),
81
+ digestAlgorithm: t.string().optional(),
82
+ issuer: t.string().optional(),
83
+ destination: t.string().optional(),
84
+ lifetimeInSeconds: t.number().optional(),
85
+ signResponse: t.boolean().optional(),
86
+ nameIdentifierFormat: t.string().optional(),
87
+ nameIdentifierProbes: t.array(t.string()).optional(),
88
+ authnContextClassRef: t.string().optional(),
89
+ mappings: t.record(t.string()).optional()
90
+ }), b = t.object({
91
+ id: t.string(),
92
+ name: t.string(),
93
+ callbacks: t.array(t.string()).default([]).optional().openapi({
3022
94
  description: "Comma-separated list of URLs whitelisted to use as a callback to the client after authentication."
3023
95
  }),
3024
- allowed_origins: r.array(r.string()).default([]).optional().openapi({
96
+ allowed_origins: t.array(t.string()).default([]).optional().openapi({
3025
97
  description: "Comma-separated list of URLs allowed to make requests from JavaScript to Auth0 API (typically used with CORS). By default, all your callback URLs will be allowed. This field allows you to enter other origins if necessary. You can also use wildcards at the subdomain level. Query strings and hash information are not taken into account when validating these URLs."
3026
98
  }),
3027
- web_origins: r.array(r.string()).default([]).optional().openapi({
99
+ web_origins: t.array(t.string()).default([]).optional().openapi({
3028
100
  description: "Comma-separated list of allowed origins for use with Cross-Origin Authentication, Device Flow, and web message response mode."
3029
101
  }),
3030
- allowed_logout_urls: r.array(r.string()).default([]).optional().openapi({
102
+ allowed_logout_urls: t.array(t.string()).default([]).optional().openapi({
3031
103
  description: "Comma-separated list of URLs that are valid to redirect to after logout from Auth0. Wildcards are allowed for subdomains."
3032
104
  }),
3033
- allowed_clients: r.array(r.string()).default([]).optional().openapi({
105
+ allowed_clients: t.array(t.string()).default([]).optional().openapi({
3034
106
  description: "Ids of clients that will be allowed to perform delegation requests. Clients that will be allowed to make delegation request. By default, all your clients will be allowed. This field allows you to specify specific clients"
3035
107
  }),
3036
- addons: r.object({
3037
- samlp: yn.optional()
108
+ addons: t.object({
109
+ samlp: h.optional()
3038
110
  }).default({}).optional().openapi({
3039
111
  description: "Addons associated with the client. The key is the addon's package name and the value is an object with the configuration for the addon."
3040
112
  }),
3041
- email_validation: r.enum(["enabled", "disabled", "enforced"]).default("enforced").optional().openapi({
113
+ email_validation: t.enum(["enabled", "disabled", "enforced"]).default("enforced").optional().openapi({
3042
114
  description: "Defines if it possible to sign in with an unverified email and if verification emails will be sent. This is not available in auth0"
3043
115
  }),
3044
- client_secret: r.string().default(() => gn()).optional(),
3045
- disable_sign_ups: r.boolean().optional().default(!1).openapi({
116
+ client_secret: t.string().default(() => m()).optional(),
117
+ disable_sign_ups: t.boolean().optional().default(!1).openapi({
3046
118
  description: "Prevents users from signing up using the hosted login page. This is not available in auth0"
3047
119
  })
3048
- }), bn = r.object({
3049
- created_at: r.string().transform((t) => t === null ? "" : t),
3050
- updated_at: r.string().transform((t) => t === null ? "" : t),
3051
- ...vn.shape
3052
- });
3053
- var et = /* @__PURE__ */ ((t) => (t.TOKEN = "token", t.TOKEN_ID_TOKEN = "token id_token", t.CODE = "code", t))(et || {}), tt = /* @__PURE__ */ ((t) => (t.QUERY = "query", t.FRAGMENT = "fragment", t.FORM_POST = "form_post", t.WEB_MESSAGE = "web_message", t.SAML_POST = "saml_post", t))(tt || {}), nt = /* @__PURE__ */ ((t) => (t.S256 = "S256", t.Plain = "plain", t))(nt || {});
3054
- const kn = r.object({
3055
- client_id: r.string(),
3056
- vendor_id: r.string().optional(),
3057
- act_as: r.string().optional(),
3058
- response_type: r.nativeEnum(et).optional(),
3059
- response_mode: r.nativeEnum(tt).optional(),
3060
- redirect_uri: r.string().optional(),
3061
- audience: r.string().optional(),
3062
- state: r.string().optional(),
3063
- nonce: r.string().optional(),
3064
- scope: r.string().optional(),
3065
- prompt: r.string().optional(),
3066
- code_challenge_method: r.nativeEnum(nt).optional(),
3067
- code_challenge: r.string().optional(),
3068
- username: r.string().optional(),
3069
- ui_locales: r.string().optional()
3070
- }), Kn = r.object({
3071
- colors: r.object({
3072
- primary: r.string(),
3073
- page_background: r.object({
3074
- type: r.string().optional(),
3075
- start: r.string().optional(),
3076
- end: r.string().optional(),
3077
- angle_deg: r.number().optional()
120
+ }), f = t.object({
121
+ created_at: t.string().transform((n) => n === null ? "" : n),
122
+ updated_at: t.string().transform((n) => n === null ? "" : n),
123
+ ...b.shape
124
+ });
125
+ var r = /* @__PURE__ */ ((n) => (n.TOKEN = "token", n.TOKEN_ID_TOKEN = "token id_token", n.CODE = "code", n))(r || {}), l = /* @__PURE__ */ ((n) => (n.QUERY = "query", n.FRAGMENT = "fragment", n.FORM_POST = "form_post", n.WEB_MESSAGE = "web_message", n.SAML_POST = "saml_post", n))(l || {}), c = /* @__PURE__ */ ((n) => (n.S256 = "S256", n.Plain = "plain", n))(c || {});
126
+ const S = t.object({
127
+ client_id: t.string(),
128
+ vendor_id: t.string().optional(),
129
+ act_as: t.string().optional(),
130
+ response_type: t.nativeEnum(r).optional(),
131
+ response_mode: t.nativeEnum(l).optional(),
132
+ redirect_uri: t.string().optional(),
133
+ audience: t.string().optional(),
134
+ state: t.string().optional(),
135
+ nonce: t.string().optional(),
136
+ scope: t.string().optional(),
137
+ prompt: t.string().optional(),
138
+ code_challenge_method: t.nativeEnum(c).optional(),
139
+ code_challenge: t.string().optional(),
140
+ username: t.string().optional(),
141
+ ui_locales: t.string().optional()
142
+ }), V = t.object({
143
+ colors: t.object({
144
+ primary: t.string(),
145
+ page_background: t.object({
146
+ type: t.string().optional(),
147
+ start: t.string().optional(),
148
+ end: t.string().optional(),
149
+ angle_deg: t.number().optional()
3078
150
  }).optional()
3079
151
  }).optional(),
3080
- logo_url: r.string().optional(),
3081
- favicon_url: r.string().optional(),
3082
- font: r.object({
3083
- url: r.string()
152
+ logo_url: t.string().optional(),
153
+ favicon_url: t.string().optional(),
154
+ font: t.object({
155
+ url: t.string()
3084
156
  }).optional()
3085
- }), xn = r.object({
3086
- id: r.string().optional(),
3087
- name: r.string(),
3088
- strategy: r.string(),
3089
- options: r.object({
3090
- kid: r.string().optional(),
3091
- team_id: r.string().optional(),
3092
- realms: r.string().optional(),
3093
- client_id: r.string().optional(),
3094
- client_secret: r.string().optional(),
3095
- app_secret: r.string().optional(),
3096
- scope: r.string().optional(),
3097
- authorization_endpoint: r.string().default("").optional(),
3098
- token_endpoint: r.string().default("").optional(),
3099
- userinfo_endpoint: r.string().default("").optional(),
3100
- jwks_uri: r.string().default("").optional(),
3101
- discovery_url: r.string().default("").optional(),
3102
- issuer: r.string().default("").optional()
157
+ }), k = t.object({
158
+ id: t.string().optional(),
159
+ name: t.string(),
160
+ strategy: t.string(),
161
+ options: t.object({
162
+ kid: t.string().optional(),
163
+ team_id: t.string().optional(),
164
+ realms: t.string().optional(),
165
+ client_id: t.string().optional(),
166
+ client_secret: t.string().optional(),
167
+ app_secret: t.string().optional(),
168
+ scope: t.string().optional(),
169
+ authorization_endpoint: t.string().default("").optional(),
170
+ token_endpoint: t.string().default("").optional(),
171
+ userinfo_endpoint: t.string().default("").optional(),
172
+ jwks_uri: t.string().default("").optional(),
173
+ discovery_url: t.string().default("").optional(),
174
+ issuer: t.string().default("").optional()
3103
175
  }).default({}).optional(),
3104
- enabled_clients: r.array(r.string()).default([]).optional(),
3105
- response_type: r.custom().optional(),
3106
- response_mode: r.custom().optional()
3107
- }), wn = r.object({
3108
- id: r.string(),
3109
- created_at: r.string().transform((t) => t === null ? "" : t),
3110
- updated_at: r.string().transform((t) => t === null ? "" : t)
3111
- }).extend(xn.shape), Sn = r.object({
3112
- name: r.string(),
3113
- audience: r.string(),
3114
- sender_email: r.string().email(),
3115
- sender_name: r.string(),
3116
- support_url: r.string().url().optional(),
3117
- logo: r.string().url().optional(),
3118
- primary_color: r.string().optional(),
3119
- secondary_color: r.string().optional(),
3120
- language: r.string().optional()
3121
- }), Tn = r.object({
3122
- created_at: r.string().transform((t) => t === null ? "" : t),
3123
- updated_at: r.string().transform((t) => t === null ? "" : t),
3124
- id: r.string(),
3125
- ...Sn.shape
3126
- }), Fn = r.object({
3127
- logoUrl: r.string(),
3128
- loginBackgroundImage: r.string().nullish(),
3129
- style: r.object({
3130
- primaryColor: r.string(),
3131
- buttonTextColor: r.string(),
3132
- primaryHoverColor: r.string()
176
+ enabled_clients: t.array(t.string()).default([]).optional(),
177
+ response_type: t.custom().optional(),
178
+ response_mode: t.custom().optional()
179
+ }), y = t.object({
180
+ id: t.string(),
181
+ created_at: t.string().transform((n) => n === null ? "" : n),
182
+ updated_at: t.string().transform((n) => n === null ? "" : n)
183
+ }).extend(k.shape), E = t.object({
184
+ name: t.string(),
185
+ audience: t.string(),
186
+ sender_email: t.string().email(),
187
+ sender_name: t.string(),
188
+ support_url: t.string().url().optional(),
189
+ logo: t.string().url().optional(),
190
+ primary_color: t.string().optional(),
191
+ secondary_color: t.string().optional(),
192
+ language: t.string().optional()
193
+ }), C = t.object({
194
+ created_at: t.string().transform((n) => n === null ? "" : n),
195
+ updated_at: t.string().transform((n) => n === null ? "" : n),
196
+ id: t.string(),
197
+ ...E.shape
198
+ }), Y = t.object({
199
+ logoUrl: t.string(),
200
+ loginBackgroundImage: t.string().nullish(),
201
+ style: t.object({
202
+ primaryColor: t.string(),
203
+ buttonTextColor: t.string(),
204
+ primaryHoverColor: t.string()
3133
205
  }),
3134
- supportEmail: r.string().nullable(),
3135
- supportUrl: r.string().nullable(),
3136
- name: r.string(),
3137
- showGreyishBackground: r.boolean().optional(),
3138
- termsAndConditionsUrl: r.string().nullable(),
3139
- companyName: r.string().optional(),
3140
- checkoutHideSocial: r.boolean().optional(),
3141
- siteUrl: r.string().nullable(),
3142
- manageSubscriptionsUrl: r.string().optional()
3143
- }), En = r.object({
3144
- domain: r.string(),
3145
- dkim_private_key: r.string().optional(),
3146
- dkim_public_key: r.string().optional(),
3147
- email_api_key: r.string().optional(),
3148
- email_service: r.string().optional()
3149
- });
3150
- r.object({
3151
- ...bn.shape,
3152
- domains: r.array(En),
3153
- tenant: Tn,
3154
- connections: r.array(wn)
3155
- });
3156
- const Cn = r.enum([
206
+ supportEmail: t.string().nullable(),
207
+ supportUrl: t.string().nullable(),
208
+ name: t.string(),
209
+ showGreyishBackground: t.boolean().optional(),
210
+ termsAndConditionsUrl: t.string().nullable(),
211
+ companyName: t.string().optional(),
212
+ checkoutHideSocial: t.boolean().optional(),
213
+ siteUrl: t.string().nullable(),
214
+ manageSubscriptionsUrl: t.string().optional()
215
+ }), w = t.object({
216
+ domain: t.string(),
217
+ dkim_private_key: t.string().optional(),
218
+ dkim_public_key: t.string().optional(),
219
+ email_api_key: t.string().optional(),
220
+ email_service: t.string().optional()
221
+ });
222
+ t.object({
223
+ ...f.shape,
224
+ domains: t.array(w),
225
+ tenant: C,
226
+ connections: t.array(y)
227
+ });
228
+ const I = t.enum([
3157
229
  "password_reset",
3158
230
  "email_verification",
3159
231
  "otp",
3160
232
  "authorization_code",
3161
233
  "oauth2_state",
3162
234
  "ticket"
3163
- ]), On = r.object({
3164
- code_id: r.string().openapi({
235
+ ]), j = t.object({
236
+ code_id: t.string().openapi({
3165
237
  description: "The code that will be used in for instance an email verification flow"
3166
238
  }),
3167
- login_id: r.string().openapi({
239
+ login_id: t.string().openapi({
3168
240
  description: "The id of the login session that the code is connected to"
3169
241
  }),
3170
- connection_id: r.string().optional().openapi({
242
+ connection_id: t.string().optional().openapi({
3171
243
  description: "The connection that the code is connected to"
3172
244
  }),
3173
- code_type: Cn,
3174
- code_verifier: r.string().optional().openapi({
245
+ code_type: I,
246
+ code_verifier: t.string().optional().openapi({
3175
247
  description: "The code verifier used in PKCE in outbound flows"
3176
248
  }),
3177
- expires_at: r.string(),
3178
- used_at: r.string().optional(),
3179
- user_id: r.string().optional()
3180
- }), Yn = r.object({
3181
- ...On.shape,
3182
- created_at: r.string()
3183
- }), jn = r.object({
3184
- domain: r.string(),
3185
- dkim_private_key: r.string().optional(),
3186
- dkim_public_key: r.string().optional(),
3187
- email_api_key: r.string().optional(),
3188
- email_service: r.string().optional()
3189
- }), Jn = De.extend({
3190
- ...jn.shape,
3191
- id: r.string()
3192
- }), In = r.object({
3193
- trigger_id: r.enum([
249
+ expires_at: t.string(),
250
+ used_at: t.string().optional(),
251
+ user_id: t.string().optional()
252
+ }), X = t.object({
253
+ ...j.shape,
254
+ created_at: t.string()
255
+ }), v = t.object({
256
+ domain: t.string(),
257
+ dkim_private_key: t.string().optional(),
258
+ dkim_public_key: t.string().optional(),
259
+ email_api_key: t.string().optional(),
260
+ email_service: t.string().optional()
261
+ }), z = a.extend({
262
+ ...v.shape,
263
+ id: t.string()
264
+ }), A = t.object({
265
+ trigger_id: t.enum([
3194
266
  "pre-user-signup",
3195
267
  "post-user-registration",
3196
268
  "post-user-login"
3197
269
  ]),
3198
- enabled: r.boolean().default(!1),
3199
- url: r.string(),
3200
- hook_id: r.string().optional(),
3201
- synchronous: r.boolean().default(!1),
3202
- priority: r.number().optional()
3203
- }), Qn = In.extend({
3204
- ...De.shape,
3205
- hook_id: r.string()
3206
- }), Nn = r.object({
3207
- alg: r.enum([
270
+ enabled: t.boolean().default(!1),
271
+ url: t.string(),
272
+ hook_id: t.string().optional(),
273
+ synchronous: t.boolean().default(!1),
274
+ priority: t.number().optional()
275
+ }), J = A.extend({
276
+ ...a.shape,
277
+ hook_id: t.string()
278
+ }), O = t.object({
279
+ alg: t.enum([
3208
280
  "RS256",
3209
281
  "RS384",
3210
282
  "RS512",
@@ -3215,55 +287,55 @@ const Cn = r.enum([
3215
287
  "HS384",
3216
288
  "HS512"
3217
289
  ]),
3218
- e: r.string(),
3219
- kid: r.string(),
3220
- kty: r.enum(["RSA", "EC", "oct"]),
3221
- n: r.string(),
3222
- x5t: r.string().optional(),
3223
- x5c: r.array(r.string()).optional(),
3224
- use: r.enum(["sig", "enc"]).optional()
3225
- }), Xn = r.object({
3226
- keys: r.array(Nn)
3227
- }), er = r.object({
3228
- issuer: r.string(),
3229
- authorization_endpoint: r.string(),
3230
- token_endpoint: r.string(),
3231
- device_authorization_endpoint: r.string(),
3232
- userinfo_endpoint: r.string(),
3233
- mfa_challenge_endpoint: r.string(),
3234
- jwks_uri: r.string(),
3235
- registration_endpoint: r.string(),
3236
- revocation_endpoint: r.string(),
3237
- scopes_supported: r.array(r.string()),
3238
- response_types_supported: r.array(r.string()),
3239
- code_challenge_methods_supported: r.array(r.string()),
3240
- response_modes_supported: r.array(r.string()),
3241
- subject_types_supported: r.array(r.string()),
3242
- id_token_signing_alg_values_supported: r.array(r.string()),
3243
- token_endpoint_auth_methods_supported: r.array(r.string()),
3244
- claims_supported: r.array(r.string()),
3245
- request_uri_parameter_supported: r.boolean(),
3246
- request_parameter_supported: r.boolean(),
3247
- token_endpoint_auth_signing_alg_values_supported: r.array(r.string())
3248
- }), Zn = r.object({
3249
- auth0Client: r.string().optional(),
3250
- authParams: kn,
3251
- expires_at: r.string(),
3252
- deleted_at: r.string().optional(),
3253
- ip: r.string().optional(),
3254
- useragent: r.string().optional()
290
+ e: t.string(),
291
+ kid: t.string(),
292
+ kty: t.enum(["RSA", "EC", "oct"]),
293
+ n: t.string(),
294
+ x5t: t.string().optional(),
295
+ x5c: t.array(t.string()).optional(),
296
+ use: t.enum(["sig", "enc"]).optional()
297
+ }), Z = t.object({
298
+ keys: t.array(O)
299
+ }), $ = t.object({
300
+ issuer: t.string(),
301
+ authorization_endpoint: t.string(),
302
+ token_endpoint: t.string(),
303
+ device_authorization_endpoint: t.string(),
304
+ userinfo_endpoint: t.string(),
305
+ mfa_challenge_endpoint: t.string(),
306
+ jwks_uri: t.string(),
307
+ registration_endpoint: t.string(),
308
+ revocation_endpoint: t.string(),
309
+ scopes_supported: t.array(t.string()),
310
+ response_types_supported: t.array(t.string()),
311
+ code_challenge_methods_supported: t.array(t.string()),
312
+ response_modes_supported: t.array(t.string()),
313
+ subject_types_supported: t.array(t.string()),
314
+ id_token_signing_alg_values_supported: t.array(t.string()),
315
+ token_endpoint_auth_methods_supported: t.array(t.string()),
316
+ claims_supported: t.array(t.string()),
317
+ request_uri_parameter_supported: t.boolean(),
318
+ request_parameter_supported: t.boolean(),
319
+ token_endpoint_auth_signing_alg_values_supported: t.array(t.string())
320
+ }), N = t.object({
321
+ auth0Client: t.string().optional(),
322
+ authParams: S,
323
+ expires_at: t.string(),
324
+ deleted_at: t.string().optional(),
325
+ ip: t.string().optional(),
326
+ useragent: t.string().optional()
3255
327
  }).openapi({
3256
328
  description: "This represents a login sesion"
3257
- }), tr = r.object({
3258
- ...Zn.shape,
3259
- login_id: r.string().openapi({
329
+ }), tt = t.object({
330
+ ...N.shape,
331
+ login_id: t.string().openapi({
3260
332
  description: "This is is used as the state in the universal login"
3261
333
  }),
3262
- created_at: r.string(),
3263
- updated_at: r.string()
334
+ created_at: t.string(),
335
+ updated_at: t.string()
3264
336
  });
3265
- var Rn = /* @__PURE__ */ ((t) => (t.FAILED_SILENT_AUTH = "fsa", t.FAILED_SIGNUP = "fs", t.FAILED_LOGIN = "f", t.FAILED_LOGIN_INCORRECT_PASSWORD = "fp", t.FAILED_CHANGE_PASSWORD = "fcp", t.FAILED_BY_CONNECTOR = "fc", t.FAILED_LOGIN_INVALID_EMAIL_USERNAME = "fu", t.FAILED_HOOK = "fh", t.FAILED_CROSS_ORIGIN_AUTHENTICATION = "fcoa", t.SUCCESS_API_OPERATION = "sapi", t.SUCCESS_CHANGE_PASSWORD = "scp", t.SUCCESS_CHANGE_PASSWORD_REQUEST = "scpr", t.SUCCESS_CHANGE_USERNAME = "scu", t.SUCCESS_CROSS_ORIGIN_AUTHENTICATION = "scoa", t.SUCCESS_EXCHANGE_AUTHORIZATION_CODE_FOR_ACCESS_TOKEN = "seacft", t.SUCCESS_EXCHANGE_REFRESH_TOKEN_FOR_ACCESS_TOKEN = "serft", t.SUCCESS_LOGIN = "s", t.SUCCESS_LOGOUT = "slo", t.SUCCESS_SIGNUP = "ss", t.SUCCESS_SILENT_AUTH = "ssa", t.SUCCESS_VERIFICATION_EMAIL = "sv", t.SUCCESS_VERIFICATION_EMAIL_REQUEST = "svr", t.CODE_LINK_SENT = "cls", t.BLOCKED_ACCOUNT_EMAIL = "limit_wc", t.BLOCKED_ACCOUNT_IP = "limit_sul", t.BLOCKED_IP_ADDRESS = "limit_mu", t))(Rn || {});
3266
- const An = r.enum([
337
+ var U = /* @__PURE__ */ ((n) => (n.FAILED_SILENT_AUTH = "fsa", n.FAILED_SIGNUP = "fs", n.FAILED_LOGIN = "f", n.FAILED_LOGIN_INCORRECT_PASSWORD = "fp", n.FAILED_CHANGE_PASSWORD = "fcp", n.FAILED_BY_CONNECTOR = "fc", n.FAILED_LOGIN_INVALID_EMAIL_USERNAME = "fu", n.FAILED_HOOK = "fh", n.FAILED_CROSS_ORIGIN_AUTHENTICATION = "fcoa", n.SUCCESS_API_OPERATION = "sapi", n.SUCCESS_CHANGE_PASSWORD = "scp", n.SUCCESS_CHANGE_PASSWORD_REQUEST = "scpr", n.SUCCESS_CHANGE_USERNAME = "scu", n.SUCCESS_CROSS_ORIGIN_AUTHENTICATION = "scoa", n.SUCCESS_EXCHANGE_AUTHORIZATION_CODE_FOR_ACCESS_TOKEN = "seacft", n.SUCCESS_EXCHANGE_REFRESH_TOKEN_FOR_ACCESS_TOKEN = "serft", n.SUCCESS_LOGIN = "s", n.SUCCESS_LOGOUT = "slo", n.SUCCESS_SIGNUP = "ss", n.SUCCESS_SILENT_AUTH = "ssa", n.SUCCESS_VERIFICATION_EMAIL = "sv", n.SUCCESS_VERIFICATION_EMAIL_REQUEST = "svr", n.CODE_LINK_SENT = "cls", n.BLOCKED_ACCOUNT_EMAIL = "limit_wc", n.BLOCKED_ACCOUNT_IP = "limit_sul", n.BLOCKED_IP_ADDRESS = "limit_mu", n))(U || {});
338
+ const R = t.enum([
3267
339
  "cls",
3268
340
  // CODE_LINK_SENT
3269
341
  "fsa",
@@ -3312,243 +384,243 @@ const An = r.enum([
3312
384
  // SUCCESS_VERIFICATION_EMAIL
3313
385
  "svr"
3314
386
  // SUCCESS_VERIFICATION_EMAIL_REQUEST
3315
- ]), Pn = r.object({
3316
- name: r.string(),
3317
- version: r.string(),
3318
- env: r.object({
3319
- node: r.string().optional()
387
+ ]), D = t.object({
388
+ name: t.string(),
389
+ version: t.string(),
390
+ env: t.object({
391
+ node: t.string().optional()
3320
392
  }).optional()
3321
- }), nr = r.object({
3322
- type: An,
3323
- date: r.string(),
3324
- description: r.string().optional(),
3325
- log_id: r.string().optional(),
3326
- _id: r.string().optional(),
3327
- ip: r.string(),
3328
- user_agent: r.string(),
3329
- details: r.any().optional(),
393
+ }), nt = t.object({
394
+ type: R,
395
+ date: t.string(),
396
+ description: t.string().optional(),
397
+ log_id: t.string().optional(),
398
+ _id: t.string().optional(),
399
+ ip: t.string(),
400
+ user_agent: t.string(),
401
+ details: t.any().optional(),
3330
402
  // Using z.any() as a placeholder for "details" type
3331
- isMobile: r.boolean(),
3332
- user_id: r.string().optional(),
3333
- user_name: r.string().optional(),
3334
- connection: r.string().optional(),
3335
- connection_id: r.string().optional(),
3336
- client_id: r.string().optional(),
3337
- client_name: r.string().optional(),
3338
- audience: r.string().optional(),
3339
- scope: r.array(r.string()).optional(),
3340
- strategy: r.string().optional(),
3341
- strategy_type: r.string().optional(),
3342
- hostname: r.string().optional(),
3343
- auth0_client: Pn.optional()
3344
- }), Dn = r.object({
3345
- user_id: r.string(),
3346
- password: r.string(),
3347
- algorithm: r.enum(["bcrypt", "argon2id"]).default("argon2id")
3348
- }), rr = r.object({
3349
- ...Dn.shape,
3350
- created_at: r.string(),
3351
- updated_at: r.string()
3352
- }), Mn = r.object({
3353
- session_id: r.string(),
3354
- client_id: r.string(),
3355
- expires_at: r.string(),
3356
- used_at: r.string(),
3357
- deleted_at: r.string().optional(),
3358
- user_id: r.string()
3359
- }), sr = r.object({
3360
- created_at: r.string(),
3361
- ...Mn.shape
3362
- }), ar = r.object({
3363
- kid: r.string().openapi({ description: "The key id of the signing key" }),
3364
- cert: r.string().openapi({ description: "The public certificate of the signing key" }),
3365
- fingerprint: r.string().openapi({ description: "The cert fingerprint" }),
3366
- thumbprint: r.string().openapi({ description: "The cert thumbprint" }),
3367
- pkcs7: r.string().optional().openapi({
403
+ isMobile: t.boolean(),
404
+ user_id: t.string().optional(),
405
+ user_name: t.string().optional(),
406
+ connection: t.string().optional(),
407
+ connection_id: t.string().optional(),
408
+ client_id: t.string().optional(),
409
+ client_name: t.string().optional(),
410
+ audience: t.string().optional(),
411
+ scope: t.array(t.string()).optional(),
412
+ strategy: t.string().optional(),
413
+ strategy_type: t.string().optional(),
414
+ hostname: t.string().optional(),
415
+ auth0_client: D.optional()
416
+ }), T = t.object({
417
+ user_id: t.string(),
418
+ password: t.string(),
419
+ algorithm: t.enum(["bcrypt", "argon2id"]).default("argon2id")
420
+ }), et = t.object({
421
+ ...T.shape,
422
+ created_at: t.string(),
423
+ updated_at: t.string()
424
+ }), x = t.object({
425
+ session_id: t.string(),
426
+ client_id: t.string(),
427
+ expires_at: t.string(),
428
+ used_at: t.string(),
429
+ deleted_at: t.string().optional(),
430
+ user_id: t.string()
431
+ }), it = t.object({
432
+ created_at: t.string(),
433
+ ...x.shape
434
+ }), ot = t.object({
435
+ kid: t.string().openapi({ description: "The key id of the signing key" }),
436
+ cert: t.string().openapi({ description: "The public certificate of the signing key" }),
437
+ fingerprint: t.string().openapi({ description: "The cert fingerprint" }),
438
+ thumbprint: t.string().openapi({ description: "The cert thumbprint" }),
439
+ pkcs7: t.string().optional().openapi({
3368
440
  description: "The private key in pkcs7 format"
3369
441
  }),
3370
- current: r.boolean().optional().openapi({ description: "True if the key is the current key" }),
3371
- next: r.boolean().optional().openapi({ description: "True if the key is the next key" }),
3372
- previous: r.boolean().optional().openapi({ description: "True if the key is the previous key" }),
3373
- current_since: r.string().optional().openapi({
442
+ current: t.boolean().optional().openapi({ description: "True if the key is the current key" }),
443
+ next: t.boolean().optional().openapi({ description: "True if the key is the next key" }),
444
+ previous: t.boolean().optional().openapi({ description: "True if the key is the previous key" }),
445
+ current_since: t.string().optional().openapi({
3374
446
  description: "The date and time when the key became the current key"
3375
447
  }),
3376
- current_until: r.string().optional().openapi({
448
+ current_until: t.string().optional().openapi({
3377
449
  description: "The date and time when the current key was rotated"
3378
450
  }),
3379
- revoked: r.boolean().optional().openapi({ description: "True if the key is revoked" }),
3380
- revoked_at: r.string().optional().openapi({ description: "The date and time when the key was revoked" })
3381
- });
3382
- var Un = /* @__PURE__ */ ((t) => (t.RefreshToken = "refresh_token", t.AuthorizationCode = "authorization_code", t.ClientCredential = "client_credentials", t.Passwordless = "passwordless", t.Password = "password", t))(Un || {});
3383
- r.object({
3384
- access_token: r.string(),
3385
- id_token: r.string().optional(),
3386
- scope: r.string().optional(),
3387
- state: r.string().optional(),
3388
- refresh_token: r.string().optional(),
3389
- token_type: r.string(),
3390
- expires_in: r.number()
3391
- });
3392
- r.object({
3393
- code: r.string(),
3394
- state: r.string().optional()
3395
- });
3396
- const $n = r.object({
3397
- button_border_radius: r.number(),
3398
- button_border_weight: r.number(),
3399
- buttons_style: r.enum(["pill"]),
3400
- input_border_radius: r.number(),
3401
- input_border_weight: r.number(),
3402
- inputs_style: r.enum(["pill"]),
3403
- show_widget_shadow: r.boolean(),
3404
- widget_border_weight: r.number(),
3405
- widget_corner_radius: r.number()
3406
- }), Vn = r.object({
3407
- base_focus_color: r.string(),
3408
- base_hover_color: r.string(),
3409
- body_text: r.string(),
3410
- captcha_widget_theme: r.enum(["auto"]),
3411
- error: r.string(),
3412
- header: r.string(),
3413
- icons: r.string(),
3414
- input_background: r.string(),
3415
- input_border: r.string(),
3416
- input_filled_text: r.string(),
3417
- input_labels_placeholders: r.string(),
3418
- links_focused_components: r.string(),
3419
- primary_button: r.string(),
3420
- primary_button_label: r.string(),
3421
- secondary_button_border: r.string(),
3422
- secondary_button_label: r.string(),
3423
- success: r.string(),
3424
- widget_background: r.string(),
3425
- widget_border: r.string()
3426
- }), W = r.object({
3427
- bold: r.boolean(),
3428
- size: r.number()
3429
- }), Ln = r.object({
3430
- body_text: W,
3431
- buttons_text: W,
3432
- font_url: r.string(),
3433
- input_labels: W,
3434
- links: W,
3435
- links_style: r.enum(["normal"]),
3436
- reference_text_size: r.number(),
3437
- subtitle: W,
3438
- title: W
3439
- }), Bn = r.object({
3440
- background_color: r.string(),
3441
- background_image_url: r.string(),
3442
- page_layout: r.enum(["center"])
3443
- }), zn = r.object({
3444
- header_text_alignment: r.enum(["center"]),
3445
- logo_height: r.number(),
3446
- logo_position: r.enum(["center"]),
3447
- logo_url: r.string(),
3448
- social_buttons_layout: r.enum(["bottom"])
3449
- }), Wn = r.object({
3450
- borders: $n,
3451
- colors: Vn,
3452
- displayName: r.string(),
3453
- fonts: Ln,
3454
- page_background: Bn,
3455
- widget: zn
3456
- }), ir = Wn.extend({
3457
- themeId: r.string()
3458
- }), or = r.object({
3459
- universal_login_experience: r.enum(["new", "classic"]).default("new"),
3460
- identifier_first: r.boolean().default(!0),
3461
- password_first: r.boolean().default(!1),
3462
- webauthn_platform_first_factor: r.boolean()
3463
- }), dr = r.object({
3464
- name: r.string(),
3465
- enabled: r.boolean().optional().default(!0),
3466
- default_from_address: r.string().optional(),
3467
- credentials: r.union([
3468
- r.object({
3469
- accessKeyId: r.string(),
3470
- secretAccessKey: r.string(),
3471
- region: r.string()
451
+ revoked: t.boolean().optional().openapi({ description: "True if the key is revoked" }),
452
+ revoked_at: t.string().optional().openapi({ description: "The date and time when the key was revoked" })
453
+ });
454
+ var P = /* @__PURE__ */ ((n) => (n.RefreshToken = "refresh_token", n.AuthorizationCode = "authorization_code", n.ClientCredential = "client_credentials", n.Passwordless = "passwordless", n.Password = "password", n))(P || {});
455
+ t.object({
456
+ access_token: t.string(),
457
+ id_token: t.string().optional(),
458
+ scope: t.string().optional(),
459
+ state: t.string().optional(),
460
+ refresh_token: t.string().optional(),
461
+ token_type: t.string(),
462
+ expires_in: t.number()
463
+ });
464
+ t.object({
465
+ code: t.string(),
466
+ state: t.string().optional()
467
+ });
468
+ const F = t.object({
469
+ button_border_radius: t.number(),
470
+ button_border_weight: t.number(),
471
+ buttons_style: t.enum(["pill"]),
472
+ input_border_radius: t.number(),
473
+ input_border_weight: t.number(),
474
+ inputs_style: t.enum(["pill"]),
475
+ show_widget_shadow: t.boolean(),
476
+ widget_border_weight: t.number(),
477
+ widget_corner_radius: t.number()
478
+ }), H = t.object({
479
+ base_focus_color: t.string(),
480
+ base_hover_color: t.string(),
481
+ body_text: t.string(),
482
+ captcha_widget_theme: t.enum(["auto"]),
483
+ error: t.string(),
484
+ header: t.string(),
485
+ icons: t.string(),
486
+ input_background: t.string(),
487
+ input_border: t.string(),
488
+ input_filled_text: t.string(),
489
+ input_labels_placeholders: t.string(),
490
+ links_focused_components: t.string(),
491
+ primary_button: t.string(),
492
+ primary_button_label: t.string(),
493
+ secondary_button_border: t.string(),
494
+ secondary_button_label: t.string(),
495
+ success: t.string(),
496
+ widget_background: t.string(),
497
+ widget_border: t.string()
498
+ }), e = t.object({
499
+ bold: t.boolean(),
500
+ size: t.number()
501
+ }), K = t.object({
502
+ body_text: e,
503
+ buttons_text: e,
504
+ font_url: t.string(),
505
+ input_labels: e,
506
+ links: e,
507
+ links_style: t.enum(["normal"]),
508
+ reference_text_size: t.number(),
509
+ subtitle: e,
510
+ title: e
511
+ }), G = t.object({
512
+ background_color: t.string(),
513
+ background_image_url: t.string(),
514
+ page_layout: t.enum(["center"])
515
+ }), B = t.object({
516
+ header_text_alignment: t.enum(["center"]),
517
+ logo_height: t.number(),
518
+ logo_position: t.enum(["center"]),
519
+ logo_url: t.string(),
520
+ social_buttons_layout: t.enum(["bottom"])
521
+ }), L = t.object({
522
+ borders: F,
523
+ colors: H,
524
+ displayName: t.string(),
525
+ fonts: K,
526
+ page_background: G,
527
+ widget: B
528
+ }), at = L.extend({
529
+ themeId: t.string()
530
+ }), st = t.object({
531
+ universal_login_experience: t.enum(["new", "classic"]).default("new"),
532
+ identifier_first: t.boolean().default(!0),
533
+ password_first: t.boolean().default(!1),
534
+ webauthn_platform_first_factor: t.boolean()
535
+ }), rt = t.object({
536
+ name: t.string(),
537
+ enabled: t.boolean().optional().default(!0),
538
+ default_from_address: t.string().optional(),
539
+ credentials: t.union([
540
+ t.object({
541
+ accessKeyId: t.string(),
542
+ secretAccessKey: t.string(),
543
+ region: t.string()
3472
544
  }),
3473
- r.object({
3474
- smtp_host: r.array(r.string()),
3475
- smtp_port: r.number(),
3476
- smtp_user: r.string(),
3477
- smtp_pass: r.string()
545
+ t.object({
546
+ smtp_host: t.array(t.string()),
547
+ smtp_port: t.number(),
548
+ smtp_user: t.string(),
549
+ smtp_pass: t.string()
3478
550
  }),
3479
- r.object({
3480
- api_key: r.string(),
3481
- domain: r.string().optional()
551
+ t.object({
552
+ api_key: t.string(),
553
+ domain: t.string().optional()
3482
554
  }),
3483
- r.object({
3484
- connectionString: r.string()
555
+ t.object({
556
+ connectionString: t.string()
3485
557
  }),
3486
- r.object({
3487
- tenantId: r.string(),
3488
- clientId: r.string(),
3489
- clientSecret: r.string()
558
+ t.object({
559
+ tenantId: t.string(),
560
+ clientId: t.string(),
561
+ clientSecret: t.string()
3490
562
  })
3491
563
  ]),
3492
- settings: r.object({}).optional()
564
+ settings: t.object({}).optional()
3493
565
  });
3494
- function cr(t) {
3495
- const [e, n] = t.split("|");
3496
- if (!e || !n)
3497
- throw new Error(`Invalid user_id: ${t}`);
3498
- return { connection: e, id: n };
566
+ function lt(n) {
567
+ const [i, o] = n.split("|");
568
+ if (!i || !o)
569
+ throw new Error(`Invalid user_id: ${n}`);
570
+ return { connection: i, id: o };
3499
571
  }
3500
572
  export {
3501
- Pn as Auth0Client,
3502
- tt as AuthorizationResponseMode,
3503
- et as AuthorizationResponseType,
3504
- nt as CodeChallengeMethod,
3505
- Un as GrantType,
3506
- Rn as LogTypes,
3507
- vn as applicationInsertSchema,
3508
- bn as applicationSchema,
3509
- qn as auth0UserResponseSchema,
3510
- kn as authParamsSchema,
3511
- Xe as baseUserSchema,
3512
- $n as bordersSchema,
3513
- Kn as brandingSchema,
3514
- On as codeInsertSchema,
3515
- Yn as codeSchema,
3516
- Cn as codeTypeSchema,
3517
- Vn as colorsSchema,
3518
- xn as connectionInsertSchema,
3519
- wn as connectionSchema,
3520
- jn as domainInsertSchema,
3521
- Jn as domainSchema,
3522
- dr as emailProviderSchema,
3523
- W as fontDetailsSchema,
3524
- Ln as fontsSchema,
3525
- In as hookInsertSchema,
3526
- Qn as hookSchema,
3527
- fn as identitySchema,
3528
- Xn as jwksKeySchema,
3529
- Nn as jwksSchema,
3530
- nr as logSchema,
3531
- Zn as loginInsertSchema,
3532
- tr as loginSchema,
3533
- er as openIDConfigurationSchema,
3534
- Bn as pageBackgroundSchema,
3535
- cr as parseUserId,
3536
- Dn as passwordInsertSchema,
3537
- rr as passwordSchema,
3538
- pn as profileDataSchema,
3539
- or as promptSettingSchema,
3540
- yn as samlpAddon,
3541
- Mn as sessionInsertSchema,
3542
- sr as sessionSchema,
3543
- ar as signingKeySchema,
3544
- Sn as tenantInsertSchema,
3545
- Tn as tenantSchema,
3546
- Wn as themeInsertSchema,
3547
- ir as themeSchema,
3548
- Hn as totalsSchema,
3549
- hn as userInsertSchema,
3550
- Gn as userResponseSchema,
3551
- mn as userSchema,
3552
- Fn as vendorSettingsSchema,
3553
- zn as widgetSchema
573
+ D as Auth0Client,
574
+ l as AuthorizationResponseMode,
575
+ r as AuthorizationResponseType,
576
+ c as CodeChallengeMethod,
577
+ P as GrantType,
578
+ U as LogTypes,
579
+ b as applicationInsertSchema,
580
+ f as applicationSchema,
581
+ q as auth0UserResponseSchema,
582
+ S as authParamsSchema,
583
+ s as baseUserSchema,
584
+ F as bordersSchema,
585
+ V as brandingSchema,
586
+ j as codeInsertSchema,
587
+ X as codeSchema,
588
+ I as codeTypeSchema,
589
+ H as colorsSchema,
590
+ k as connectionInsertSchema,
591
+ y as connectionSchema,
592
+ v as domainInsertSchema,
593
+ z as domainSchema,
594
+ rt as emailProviderSchema,
595
+ e as fontDetailsSchema,
596
+ K as fontsSchema,
597
+ A as hookInsertSchema,
598
+ J as hookSchema,
599
+ d as identitySchema,
600
+ Z as jwksKeySchema,
601
+ O as jwksSchema,
602
+ nt as logSchema,
603
+ N as loginInsertSchema,
604
+ tt as loginSchema,
605
+ $ as openIDConfigurationSchema,
606
+ G as pageBackgroundSchema,
607
+ lt as parseUserId,
608
+ T as passwordInsertSchema,
609
+ et as passwordSchema,
610
+ p as profileDataSchema,
611
+ st as promptSettingSchema,
612
+ h as samlpAddon,
613
+ x as sessionInsertSchema,
614
+ it as sessionSchema,
615
+ ot as signingKeySchema,
616
+ E as tenantInsertSchema,
617
+ C as tenantSchema,
618
+ L as themeInsertSchema,
619
+ at as themeSchema,
620
+ W as totalsSchema,
621
+ g as userInsertSchema,
622
+ Q as userResponseSchema,
623
+ _ as userSchema,
624
+ Y as vendorSettingsSchema,
625
+ B as widgetSchema
3554
626
  };