@xyo-network/hash 5.1.18 → 5.1.20
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.
|
@@ -49,6 +49,500 @@
|
|
|
49
49
|
}
|
|
50
50
|
});
|
|
51
51
|
|
|
52
|
+
// ../../../../../../node_modules/.store/zod-npm-4.1.12-8e1ffc4d68/package/v4/classic/external.js
|
|
53
|
+
var external_exports = {};
|
|
54
|
+
__export(external_exports, {
|
|
55
|
+
$brand: () => $brand,
|
|
56
|
+
$input: () => $input,
|
|
57
|
+
$output: () => $output,
|
|
58
|
+
NEVER: () => NEVER,
|
|
59
|
+
TimePrecision: () => TimePrecision,
|
|
60
|
+
ZodAny: () => ZodAny,
|
|
61
|
+
ZodArray: () => ZodArray,
|
|
62
|
+
ZodBase64: () => ZodBase64,
|
|
63
|
+
ZodBase64URL: () => ZodBase64URL,
|
|
64
|
+
ZodBigInt: () => ZodBigInt,
|
|
65
|
+
ZodBigIntFormat: () => ZodBigIntFormat,
|
|
66
|
+
ZodBoolean: () => ZodBoolean,
|
|
67
|
+
ZodCIDRv4: () => ZodCIDRv4,
|
|
68
|
+
ZodCIDRv6: () => ZodCIDRv6,
|
|
69
|
+
ZodCUID: () => ZodCUID,
|
|
70
|
+
ZodCUID2: () => ZodCUID2,
|
|
71
|
+
ZodCatch: () => ZodCatch,
|
|
72
|
+
ZodCodec: () => ZodCodec,
|
|
73
|
+
ZodCustom: () => ZodCustom,
|
|
74
|
+
ZodCustomStringFormat: () => ZodCustomStringFormat,
|
|
75
|
+
ZodDate: () => ZodDate,
|
|
76
|
+
ZodDefault: () => ZodDefault,
|
|
77
|
+
ZodDiscriminatedUnion: () => ZodDiscriminatedUnion,
|
|
78
|
+
ZodE164: () => ZodE164,
|
|
79
|
+
ZodEmail: () => ZodEmail,
|
|
80
|
+
ZodEmoji: () => ZodEmoji,
|
|
81
|
+
ZodEnum: () => ZodEnum,
|
|
82
|
+
ZodError: () => ZodError,
|
|
83
|
+
ZodFile: () => ZodFile,
|
|
84
|
+
ZodFirstPartyTypeKind: () => ZodFirstPartyTypeKind,
|
|
85
|
+
ZodFunction: () => ZodFunction,
|
|
86
|
+
ZodGUID: () => ZodGUID,
|
|
87
|
+
ZodIPv4: () => ZodIPv4,
|
|
88
|
+
ZodIPv6: () => ZodIPv6,
|
|
89
|
+
ZodISODate: () => ZodISODate,
|
|
90
|
+
ZodISODateTime: () => ZodISODateTime,
|
|
91
|
+
ZodISODuration: () => ZodISODuration,
|
|
92
|
+
ZodISOTime: () => ZodISOTime,
|
|
93
|
+
ZodIntersection: () => ZodIntersection,
|
|
94
|
+
ZodIssueCode: () => ZodIssueCode,
|
|
95
|
+
ZodJWT: () => ZodJWT,
|
|
96
|
+
ZodKSUID: () => ZodKSUID,
|
|
97
|
+
ZodLazy: () => ZodLazy,
|
|
98
|
+
ZodLiteral: () => ZodLiteral,
|
|
99
|
+
ZodMap: () => ZodMap,
|
|
100
|
+
ZodNaN: () => ZodNaN,
|
|
101
|
+
ZodNanoID: () => ZodNanoID,
|
|
102
|
+
ZodNever: () => ZodNever,
|
|
103
|
+
ZodNonOptional: () => ZodNonOptional,
|
|
104
|
+
ZodNull: () => ZodNull,
|
|
105
|
+
ZodNullable: () => ZodNullable,
|
|
106
|
+
ZodNumber: () => ZodNumber,
|
|
107
|
+
ZodNumberFormat: () => ZodNumberFormat,
|
|
108
|
+
ZodObject: () => ZodObject,
|
|
109
|
+
ZodOptional: () => ZodOptional,
|
|
110
|
+
ZodPipe: () => ZodPipe,
|
|
111
|
+
ZodPrefault: () => ZodPrefault,
|
|
112
|
+
ZodPromise: () => ZodPromise,
|
|
113
|
+
ZodReadonly: () => ZodReadonly,
|
|
114
|
+
ZodRealError: () => ZodRealError,
|
|
115
|
+
ZodRecord: () => ZodRecord,
|
|
116
|
+
ZodSet: () => ZodSet,
|
|
117
|
+
ZodString: () => ZodString,
|
|
118
|
+
ZodStringFormat: () => ZodStringFormat,
|
|
119
|
+
ZodSuccess: () => ZodSuccess,
|
|
120
|
+
ZodSymbol: () => ZodSymbol,
|
|
121
|
+
ZodTemplateLiteral: () => ZodTemplateLiteral,
|
|
122
|
+
ZodTransform: () => ZodTransform,
|
|
123
|
+
ZodTuple: () => ZodTuple,
|
|
124
|
+
ZodType: () => ZodType,
|
|
125
|
+
ZodULID: () => ZodULID,
|
|
126
|
+
ZodURL: () => ZodURL,
|
|
127
|
+
ZodUUID: () => ZodUUID,
|
|
128
|
+
ZodUndefined: () => ZodUndefined,
|
|
129
|
+
ZodUnion: () => ZodUnion,
|
|
130
|
+
ZodUnknown: () => ZodUnknown,
|
|
131
|
+
ZodVoid: () => ZodVoid,
|
|
132
|
+
ZodXID: () => ZodXID,
|
|
133
|
+
_ZodString: () => _ZodString,
|
|
134
|
+
_default: () => _default2,
|
|
135
|
+
_function: () => _function,
|
|
136
|
+
any: () => any,
|
|
137
|
+
array: () => array,
|
|
138
|
+
base64: () => base642,
|
|
139
|
+
base64url: () => base64url2,
|
|
140
|
+
bigint: () => bigint2,
|
|
141
|
+
boolean: () => boolean2,
|
|
142
|
+
catch: () => _catch2,
|
|
143
|
+
check: () => check,
|
|
144
|
+
cidrv4: () => cidrv42,
|
|
145
|
+
cidrv6: () => cidrv62,
|
|
146
|
+
clone: () => clone,
|
|
147
|
+
codec: () => codec,
|
|
148
|
+
coerce: () => coerce_exports,
|
|
149
|
+
config: () => config,
|
|
150
|
+
core: () => core_exports2,
|
|
151
|
+
cuid: () => cuid3,
|
|
152
|
+
cuid2: () => cuid22,
|
|
153
|
+
custom: () => custom,
|
|
154
|
+
date: () => date3,
|
|
155
|
+
decode: () => decode2,
|
|
156
|
+
decodeAsync: () => decodeAsync2,
|
|
157
|
+
discriminatedUnion: () => discriminatedUnion,
|
|
158
|
+
e164: () => e1642,
|
|
159
|
+
email: () => email2,
|
|
160
|
+
emoji: () => emoji2,
|
|
161
|
+
encode: () => encode2,
|
|
162
|
+
encodeAsync: () => encodeAsync2,
|
|
163
|
+
endsWith: () => _endsWith,
|
|
164
|
+
enum: () => _enum2,
|
|
165
|
+
file: () => file,
|
|
166
|
+
flattenError: () => flattenError,
|
|
167
|
+
float32: () => float32,
|
|
168
|
+
float64: () => float64,
|
|
169
|
+
formatError: () => formatError,
|
|
170
|
+
function: () => _function,
|
|
171
|
+
getErrorMap: () => getErrorMap,
|
|
172
|
+
globalRegistry: () => globalRegistry,
|
|
173
|
+
gt: () => _gt,
|
|
174
|
+
gte: () => _gte,
|
|
175
|
+
guid: () => guid2,
|
|
176
|
+
hash: () => hash,
|
|
177
|
+
hex: () => hex2,
|
|
178
|
+
hostname: () => hostname2,
|
|
179
|
+
httpUrl: () => httpUrl,
|
|
180
|
+
includes: () => _includes,
|
|
181
|
+
instanceof: () => _instanceof,
|
|
182
|
+
int: () => int,
|
|
183
|
+
int32: () => int32,
|
|
184
|
+
int64: () => int64,
|
|
185
|
+
intersection: () => intersection,
|
|
186
|
+
ipv4: () => ipv42,
|
|
187
|
+
ipv6: () => ipv62,
|
|
188
|
+
iso: () => iso_exports,
|
|
189
|
+
json: () => json,
|
|
190
|
+
jwt: () => jwt,
|
|
191
|
+
keyof: () => keyof,
|
|
192
|
+
ksuid: () => ksuid2,
|
|
193
|
+
lazy: () => lazy,
|
|
194
|
+
length: () => _length,
|
|
195
|
+
literal: () => literal,
|
|
196
|
+
locales: () => locales_exports,
|
|
197
|
+
looseObject: () => looseObject,
|
|
198
|
+
lowercase: () => _lowercase,
|
|
199
|
+
lt: () => _lt,
|
|
200
|
+
lte: () => _lte,
|
|
201
|
+
map: () => map,
|
|
202
|
+
maxLength: () => _maxLength,
|
|
203
|
+
maxSize: () => _maxSize,
|
|
204
|
+
mime: () => _mime,
|
|
205
|
+
minLength: () => _minLength,
|
|
206
|
+
minSize: () => _minSize,
|
|
207
|
+
multipleOf: () => _multipleOf,
|
|
208
|
+
nan: () => nan,
|
|
209
|
+
nanoid: () => nanoid2,
|
|
210
|
+
nativeEnum: () => nativeEnum,
|
|
211
|
+
negative: () => _negative,
|
|
212
|
+
never: () => never,
|
|
213
|
+
nonnegative: () => _nonnegative,
|
|
214
|
+
nonoptional: () => nonoptional,
|
|
215
|
+
nonpositive: () => _nonpositive,
|
|
216
|
+
normalize: () => _normalize,
|
|
217
|
+
null: () => _null3,
|
|
218
|
+
nullable: () => nullable,
|
|
219
|
+
nullish: () => nullish2,
|
|
220
|
+
number: () => number2,
|
|
221
|
+
object: () => object,
|
|
222
|
+
optional: () => optional,
|
|
223
|
+
overwrite: () => _overwrite,
|
|
224
|
+
parse: () => parse2,
|
|
225
|
+
parseAsync: () => parseAsync2,
|
|
226
|
+
partialRecord: () => partialRecord,
|
|
227
|
+
pipe: () => pipe,
|
|
228
|
+
positive: () => _positive,
|
|
229
|
+
prefault: () => prefault,
|
|
230
|
+
preprocess: () => preprocess,
|
|
231
|
+
prettifyError: () => prettifyError,
|
|
232
|
+
promise: () => promise,
|
|
233
|
+
property: () => _property,
|
|
234
|
+
readonly: () => readonly,
|
|
235
|
+
record: () => record,
|
|
236
|
+
refine: () => refine,
|
|
237
|
+
regex: () => _regex,
|
|
238
|
+
regexes: () => regexes_exports,
|
|
239
|
+
registry: () => registry,
|
|
240
|
+
safeDecode: () => safeDecode2,
|
|
241
|
+
safeDecodeAsync: () => safeDecodeAsync2,
|
|
242
|
+
safeEncode: () => safeEncode2,
|
|
243
|
+
safeEncodeAsync: () => safeEncodeAsync2,
|
|
244
|
+
safeParse: () => safeParse2,
|
|
245
|
+
safeParseAsync: () => safeParseAsync2,
|
|
246
|
+
set: () => set,
|
|
247
|
+
setErrorMap: () => setErrorMap,
|
|
248
|
+
size: () => _size,
|
|
249
|
+
startsWith: () => _startsWith,
|
|
250
|
+
strictObject: () => strictObject,
|
|
251
|
+
string: () => string2,
|
|
252
|
+
stringFormat: () => stringFormat,
|
|
253
|
+
stringbool: () => stringbool,
|
|
254
|
+
success: () => success,
|
|
255
|
+
superRefine: () => superRefine,
|
|
256
|
+
symbol: () => symbol,
|
|
257
|
+
templateLiteral: () => templateLiteral,
|
|
258
|
+
toJSONSchema: () => toJSONSchema,
|
|
259
|
+
toLowerCase: () => _toLowerCase,
|
|
260
|
+
toUpperCase: () => _toUpperCase,
|
|
261
|
+
transform: () => transform,
|
|
262
|
+
treeifyError: () => treeifyError,
|
|
263
|
+
trim: () => _trim,
|
|
264
|
+
tuple: () => tuple,
|
|
265
|
+
uint32: () => uint32,
|
|
266
|
+
uint64: () => uint64,
|
|
267
|
+
ulid: () => ulid2,
|
|
268
|
+
undefined: () => _undefined3,
|
|
269
|
+
union: () => union,
|
|
270
|
+
unknown: () => unknown,
|
|
271
|
+
uppercase: () => _uppercase,
|
|
272
|
+
url: () => url,
|
|
273
|
+
util: () => util_exports,
|
|
274
|
+
uuid: () => uuid2,
|
|
275
|
+
uuidv4: () => uuidv4,
|
|
276
|
+
uuidv6: () => uuidv6,
|
|
277
|
+
uuidv7: () => uuidv7,
|
|
278
|
+
void: () => _void2,
|
|
279
|
+
xid: () => xid2
|
|
280
|
+
});
|
|
281
|
+
|
|
282
|
+
// ../../../../../../node_modules/.store/zod-npm-4.1.12-8e1ffc4d68/package/v4/core/index.js
|
|
283
|
+
var core_exports2 = {};
|
|
284
|
+
__export(core_exports2, {
|
|
285
|
+
$ZodAny: () => $ZodAny,
|
|
286
|
+
$ZodArray: () => $ZodArray,
|
|
287
|
+
$ZodAsyncError: () => $ZodAsyncError,
|
|
288
|
+
$ZodBase64: () => $ZodBase64,
|
|
289
|
+
$ZodBase64URL: () => $ZodBase64URL,
|
|
290
|
+
$ZodBigInt: () => $ZodBigInt,
|
|
291
|
+
$ZodBigIntFormat: () => $ZodBigIntFormat,
|
|
292
|
+
$ZodBoolean: () => $ZodBoolean,
|
|
293
|
+
$ZodCIDRv4: () => $ZodCIDRv4,
|
|
294
|
+
$ZodCIDRv6: () => $ZodCIDRv6,
|
|
295
|
+
$ZodCUID: () => $ZodCUID,
|
|
296
|
+
$ZodCUID2: () => $ZodCUID2,
|
|
297
|
+
$ZodCatch: () => $ZodCatch,
|
|
298
|
+
$ZodCheck: () => $ZodCheck,
|
|
299
|
+
$ZodCheckBigIntFormat: () => $ZodCheckBigIntFormat,
|
|
300
|
+
$ZodCheckEndsWith: () => $ZodCheckEndsWith,
|
|
301
|
+
$ZodCheckGreaterThan: () => $ZodCheckGreaterThan,
|
|
302
|
+
$ZodCheckIncludes: () => $ZodCheckIncludes,
|
|
303
|
+
$ZodCheckLengthEquals: () => $ZodCheckLengthEquals,
|
|
304
|
+
$ZodCheckLessThan: () => $ZodCheckLessThan,
|
|
305
|
+
$ZodCheckLowerCase: () => $ZodCheckLowerCase,
|
|
306
|
+
$ZodCheckMaxLength: () => $ZodCheckMaxLength,
|
|
307
|
+
$ZodCheckMaxSize: () => $ZodCheckMaxSize,
|
|
308
|
+
$ZodCheckMimeType: () => $ZodCheckMimeType,
|
|
309
|
+
$ZodCheckMinLength: () => $ZodCheckMinLength,
|
|
310
|
+
$ZodCheckMinSize: () => $ZodCheckMinSize,
|
|
311
|
+
$ZodCheckMultipleOf: () => $ZodCheckMultipleOf,
|
|
312
|
+
$ZodCheckNumberFormat: () => $ZodCheckNumberFormat,
|
|
313
|
+
$ZodCheckOverwrite: () => $ZodCheckOverwrite,
|
|
314
|
+
$ZodCheckProperty: () => $ZodCheckProperty,
|
|
315
|
+
$ZodCheckRegex: () => $ZodCheckRegex,
|
|
316
|
+
$ZodCheckSizeEquals: () => $ZodCheckSizeEquals,
|
|
317
|
+
$ZodCheckStartsWith: () => $ZodCheckStartsWith,
|
|
318
|
+
$ZodCheckStringFormat: () => $ZodCheckStringFormat,
|
|
319
|
+
$ZodCheckUpperCase: () => $ZodCheckUpperCase,
|
|
320
|
+
$ZodCodec: () => $ZodCodec,
|
|
321
|
+
$ZodCustom: () => $ZodCustom,
|
|
322
|
+
$ZodCustomStringFormat: () => $ZodCustomStringFormat,
|
|
323
|
+
$ZodDate: () => $ZodDate,
|
|
324
|
+
$ZodDefault: () => $ZodDefault,
|
|
325
|
+
$ZodDiscriminatedUnion: () => $ZodDiscriminatedUnion,
|
|
326
|
+
$ZodE164: () => $ZodE164,
|
|
327
|
+
$ZodEmail: () => $ZodEmail,
|
|
328
|
+
$ZodEmoji: () => $ZodEmoji,
|
|
329
|
+
$ZodEncodeError: () => $ZodEncodeError,
|
|
330
|
+
$ZodEnum: () => $ZodEnum,
|
|
331
|
+
$ZodError: () => $ZodError,
|
|
332
|
+
$ZodFile: () => $ZodFile,
|
|
333
|
+
$ZodFunction: () => $ZodFunction,
|
|
334
|
+
$ZodGUID: () => $ZodGUID,
|
|
335
|
+
$ZodIPv4: () => $ZodIPv4,
|
|
336
|
+
$ZodIPv6: () => $ZodIPv6,
|
|
337
|
+
$ZodISODate: () => $ZodISODate,
|
|
338
|
+
$ZodISODateTime: () => $ZodISODateTime,
|
|
339
|
+
$ZodISODuration: () => $ZodISODuration,
|
|
340
|
+
$ZodISOTime: () => $ZodISOTime,
|
|
341
|
+
$ZodIntersection: () => $ZodIntersection,
|
|
342
|
+
$ZodJWT: () => $ZodJWT,
|
|
343
|
+
$ZodKSUID: () => $ZodKSUID,
|
|
344
|
+
$ZodLazy: () => $ZodLazy,
|
|
345
|
+
$ZodLiteral: () => $ZodLiteral,
|
|
346
|
+
$ZodMap: () => $ZodMap,
|
|
347
|
+
$ZodNaN: () => $ZodNaN,
|
|
348
|
+
$ZodNanoID: () => $ZodNanoID,
|
|
349
|
+
$ZodNever: () => $ZodNever,
|
|
350
|
+
$ZodNonOptional: () => $ZodNonOptional,
|
|
351
|
+
$ZodNull: () => $ZodNull,
|
|
352
|
+
$ZodNullable: () => $ZodNullable,
|
|
353
|
+
$ZodNumber: () => $ZodNumber,
|
|
354
|
+
$ZodNumberFormat: () => $ZodNumberFormat,
|
|
355
|
+
$ZodObject: () => $ZodObject,
|
|
356
|
+
$ZodObjectJIT: () => $ZodObjectJIT,
|
|
357
|
+
$ZodOptional: () => $ZodOptional,
|
|
358
|
+
$ZodPipe: () => $ZodPipe,
|
|
359
|
+
$ZodPrefault: () => $ZodPrefault,
|
|
360
|
+
$ZodPromise: () => $ZodPromise,
|
|
361
|
+
$ZodReadonly: () => $ZodReadonly,
|
|
362
|
+
$ZodRealError: () => $ZodRealError,
|
|
363
|
+
$ZodRecord: () => $ZodRecord,
|
|
364
|
+
$ZodRegistry: () => $ZodRegistry,
|
|
365
|
+
$ZodSet: () => $ZodSet,
|
|
366
|
+
$ZodString: () => $ZodString,
|
|
367
|
+
$ZodStringFormat: () => $ZodStringFormat,
|
|
368
|
+
$ZodSuccess: () => $ZodSuccess,
|
|
369
|
+
$ZodSymbol: () => $ZodSymbol,
|
|
370
|
+
$ZodTemplateLiteral: () => $ZodTemplateLiteral,
|
|
371
|
+
$ZodTransform: () => $ZodTransform,
|
|
372
|
+
$ZodTuple: () => $ZodTuple,
|
|
373
|
+
$ZodType: () => $ZodType,
|
|
374
|
+
$ZodULID: () => $ZodULID,
|
|
375
|
+
$ZodURL: () => $ZodURL,
|
|
376
|
+
$ZodUUID: () => $ZodUUID,
|
|
377
|
+
$ZodUndefined: () => $ZodUndefined,
|
|
378
|
+
$ZodUnion: () => $ZodUnion,
|
|
379
|
+
$ZodUnknown: () => $ZodUnknown,
|
|
380
|
+
$ZodVoid: () => $ZodVoid,
|
|
381
|
+
$ZodXID: () => $ZodXID,
|
|
382
|
+
$brand: () => $brand,
|
|
383
|
+
$constructor: () => $constructor,
|
|
384
|
+
$input: () => $input,
|
|
385
|
+
$output: () => $output,
|
|
386
|
+
Doc: () => Doc,
|
|
387
|
+
JSONSchema: () => json_schema_exports,
|
|
388
|
+
JSONSchemaGenerator: () => JSONSchemaGenerator,
|
|
389
|
+
NEVER: () => NEVER,
|
|
390
|
+
TimePrecision: () => TimePrecision,
|
|
391
|
+
_any: () => _any,
|
|
392
|
+
_array: () => _array,
|
|
393
|
+
_base64: () => _base64,
|
|
394
|
+
_base64url: () => _base64url,
|
|
395
|
+
_bigint: () => _bigint,
|
|
396
|
+
_boolean: () => _boolean,
|
|
397
|
+
_catch: () => _catch,
|
|
398
|
+
_check: () => _check,
|
|
399
|
+
_cidrv4: () => _cidrv4,
|
|
400
|
+
_cidrv6: () => _cidrv6,
|
|
401
|
+
_coercedBigint: () => _coercedBigint,
|
|
402
|
+
_coercedBoolean: () => _coercedBoolean,
|
|
403
|
+
_coercedDate: () => _coercedDate,
|
|
404
|
+
_coercedNumber: () => _coercedNumber,
|
|
405
|
+
_coercedString: () => _coercedString,
|
|
406
|
+
_cuid: () => _cuid,
|
|
407
|
+
_cuid2: () => _cuid2,
|
|
408
|
+
_custom: () => _custom,
|
|
409
|
+
_date: () => _date,
|
|
410
|
+
_decode: () => _decode,
|
|
411
|
+
_decodeAsync: () => _decodeAsync,
|
|
412
|
+
_default: () => _default,
|
|
413
|
+
_discriminatedUnion: () => _discriminatedUnion,
|
|
414
|
+
_e164: () => _e164,
|
|
415
|
+
_email: () => _email,
|
|
416
|
+
_emoji: () => _emoji2,
|
|
417
|
+
_encode: () => _encode,
|
|
418
|
+
_encodeAsync: () => _encodeAsync,
|
|
419
|
+
_endsWith: () => _endsWith,
|
|
420
|
+
_enum: () => _enum,
|
|
421
|
+
_file: () => _file,
|
|
422
|
+
_float32: () => _float32,
|
|
423
|
+
_float64: () => _float64,
|
|
424
|
+
_gt: () => _gt,
|
|
425
|
+
_gte: () => _gte,
|
|
426
|
+
_guid: () => _guid,
|
|
427
|
+
_includes: () => _includes,
|
|
428
|
+
_int: () => _int,
|
|
429
|
+
_int32: () => _int32,
|
|
430
|
+
_int64: () => _int64,
|
|
431
|
+
_intersection: () => _intersection,
|
|
432
|
+
_ipv4: () => _ipv4,
|
|
433
|
+
_ipv6: () => _ipv6,
|
|
434
|
+
_isoDate: () => _isoDate,
|
|
435
|
+
_isoDateTime: () => _isoDateTime,
|
|
436
|
+
_isoDuration: () => _isoDuration,
|
|
437
|
+
_isoTime: () => _isoTime,
|
|
438
|
+
_jwt: () => _jwt,
|
|
439
|
+
_ksuid: () => _ksuid,
|
|
440
|
+
_lazy: () => _lazy,
|
|
441
|
+
_length: () => _length,
|
|
442
|
+
_literal: () => _literal,
|
|
443
|
+
_lowercase: () => _lowercase,
|
|
444
|
+
_lt: () => _lt,
|
|
445
|
+
_lte: () => _lte,
|
|
446
|
+
_map: () => _map,
|
|
447
|
+
_max: () => _lte,
|
|
448
|
+
_maxLength: () => _maxLength,
|
|
449
|
+
_maxSize: () => _maxSize,
|
|
450
|
+
_mime: () => _mime,
|
|
451
|
+
_min: () => _gte,
|
|
452
|
+
_minLength: () => _minLength,
|
|
453
|
+
_minSize: () => _minSize,
|
|
454
|
+
_multipleOf: () => _multipleOf,
|
|
455
|
+
_nan: () => _nan,
|
|
456
|
+
_nanoid: () => _nanoid,
|
|
457
|
+
_nativeEnum: () => _nativeEnum,
|
|
458
|
+
_negative: () => _negative,
|
|
459
|
+
_never: () => _never,
|
|
460
|
+
_nonnegative: () => _nonnegative,
|
|
461
|
+
_nonoptional: () => _nonoptional,
|
|
462
|
+
_nonpositive: () => _nonpositive,
|
|
463
|
+
_normalize: () => _normalize,
|
|
464
|
+
_null: () => _null2,
|
|
465
|
+
_nullable: () => _nullable,
|
|
466
|
+
_number: () => _number,
|
|
467
|
+
_optional: () => _optional,
|
|
468
|
+
_overwrite: () => _overwrite,
|
|
469
|
+
_parse: () => _parse,
|
|
470
|
+
_parseAsync: () => _parseAsync,
|
|
471
|
+
_pipe: () => _pipe,
|
|
472
|
+
_positive: () => _positive,
|
|
473
|
+
_promise: () => _promise,
|
|
474
|
+
_property: () => _property,
|
|
475
|
+
_readonly: () => _readonly,
|
|
476
|
+
_record: () => _record,
|
|
477
|
+
_refine: () => _refine,
|
|
478
|
+
_regex: () => _regex,
|
|
479
|
+
_safeDecode: () => _safeDecode,
|
|
480
|
+
_safeDecodeAsync: () => _safeDecodeAsync,
|
|
481
|
+
_safeEncode: () => _safeEncode,
|
|
482
|
+
_safeEncodeAsync: () => _safeEncodeAsync,
|
|
483
|
+
_safeParse: () => _safeParse,
|
|
484
|
+
_safeParseAsync: () => _safeParseAsync,
|
|
485
|
+
_set: () => _set,
|
|
486
|
+
_size: () => _size,
|
|
487
|
+
_startsWith: () => _startsWith,
|
|
488
|
+
_string: () => _string,
|
|
489
|
+
_stringFormat: () => _stringFormat,
|
|
490
|
+
_stringbool: () => _stringbool,
|
|
491
|
+
_success: () => _success,
|
|
492
|
+
_superRefine: () => _superRefine,
|
|
493
|
+
_symbol: () => _symbol,
|
|
494
|
+
_templateLiteral: () => _templateLiteral,
|
|
495
|
+
_toLowerCase: () => _toLowerCase,
|
|
496
|
+
_toUpperCase: () => _toUpperCase,
|
|
497
|
+
_transform: () => _transform,
|
|
498
|
+
_trim: () => _trim,
|
|
499
|
+
_tuple: () => _tuple,
|
|
500
|
+
_uint32: () => _uint32,
|
|
501
|
+
_uint64: () => _uint64,
|
|
502
|
+
_ulid: () => _ulid,
|
|
503
|
+
_undefined: () => _undefined2,
|
|
504
|
+
_union: () => _union,
|
|
505
|
+
_unknown: () => _unknown,
|
|
506
|
+
_uppercase: () => _uppercase,
|
|
507
|
+
_url: () => _url,
|
|
508
|
+
_uuid: () => _uuid,
|
|
509
|
+
_uuidv4: () => _uuidv4,
|
|
510
|
+
_uuidv6: () => _uuidv6,
|
|
511
|
+
_uuidv7: () => _uuidv7,
|
|
512
|
+
_void: () => _void,
|
|
513
|
+
_xid: () => _xid,
|
|
514
|
+
clone: () => clone,
|
|
515
|
+
config: () => config,
|
|
516
|
+
decode: () => decode,
|
|
517
|
+
decodeAsync: () => decodeAsync,
|
|
518
|
+
encode: () => encode,
|
|
519
|
+
encodeAsync: () => encodeAsync,
|
|
520
|
+
flattenError: () => flattenError,
|
|
521
|
+
formatError: () => formatError,
|
|
522
|
+
globalConfig: () => globalConfig,
|
|
523
|
+
globalRegistry: () => globalRegistry,
|
|
524
|
+
isValidBase64: () => isValidBase64,
|
|
525
|
+
isValidBase64URL: () => isValidBase64URL,
|
|
526
|
+
isValidJWT: () => isValidJWT,
|
|
527
|
+
locales: () => locales_exports,
|
|
528
|
+
parse: () => parse,
|
|
529
|
+
parseAsync: () => parseAsync,
|
|
530
|
+
prettifyError: () => prettifyError,
|
|
531
|
+
regexes: () => regexes_exports,
|
|
532
|
+
registry: () => registry,
|
|
533
|
+
safeDecode: () => safeDecode,
|
|
534
|
+
safeDecodeAsync: () => safeDecodeAsync,
|
|
535
|
+
safeEncode: () => safeEncode,
|
|
536
|
+
safeEncodeAsync: () => safeEncodeAsync,
|
|
537
|
+
safeParse: () => safeParse,
|
|
538
|
+
safeParseAsync: () => safeParseAsync,
|
|
539
|
+
toDotPath: () => toDotPath,
|
|
540
|
+
toJSONSchema: () => toJSONSchema,
|
|
541
|
+
treeifyError: () => treeifyError,
|
|
542
|
+
util: () => util_exports,
|
|
543
|
+
version: () => version
|
|
544
|
+
});
|
|
545
|
+
|
|
52
546
|
// ../../../../../../node_modules/.store/zod-npm-4.1.12-8e1ffc4d68/package/v4/core/core.js
|
|
53
547
|
var NEVER = Object.freeze({
|
|
54
548
|
status: "aborted"
|
|
@@ -206,10 +700,10 @@
|
|
|
206
700
|
return value;
|
|
207
701
|
}
|
|
208
702
|
function cached(getter) {
|
|
209
|
-
const
|
|
703
|
+
const set2 = false;
|
|
210
704
|
return {
|
|
211
705
|
get value() {
|
|
212
|
-
if (!
|
|
706
|
+
if (!set2) {
|
|
213
707
|
const value = getter();
|
|
214
708
|
Object.defineProperty(this, "value", { value });
|
|
215
709
|
return value;
|
|
@@ -242,9 +736,9 @@
|
|
|
242
736
|
return valInt % stepInt / 10 ** decCount;
|
|
243
737
|
}
|
|
244
738
|
var EVALUATING = Symbol("evaluating");
|
|
245
|
-
function defineLazy(
|
|
739
|
+
function defineLazy(object2, key, getter) {
|
|
246
740
|
let value = void 0;
|
|
247
|
-
Object.defineProperty(
|
|
741
|
+
Object.defineProperty(object2, key, {
|
|
248
742
|
get() {
|
|
249
743
|
if (value === EVALUATING) {
|
|
250
744
|
return void 0;
|
|
@@ -256,7 +750,7 @@
|
|
|
256
750
|
return value;
|
|
257
751
|
},
|
|
258
752
|
set(v) {
|
|
259
|
-
Object.defineProperty(
|
|
753
|
+
Object.defineProperty(object2, key, {
|
|
260
754
|
value: v
|
|
261
755
|
// configurable: true,
|
|
262
756
|
});
|
|
@@ -707,8 +1201,8 @@
|
|
|
707
1201
|
return Number.isNaN(Number.parseInt(k, 10));
|
|
708
1202
|
}).map((el) => el[1]);
|
|
709
1203
|
}
|
|
710
|
-
function base64ToUint8Array(
|
|
711
|
-
const binaryString = atob(
|
|
1204
|
+
function base64ToUint8Array(base643) {
|
|
1205
|
+
const binaryString = atob(base643);
|
|
712
1206
|
const bytes = new Uint8Array(binaryString.length);
|
|
713
1207
|
for (let i = 0; i < binaryString.length; i++) {
|
|
714
1208
|
bytes[i] = binaryString.charCodeAt(i);
|
|
@@ -722,16 +1216,16 @@
|
|
|
722
1216
|
}
|
|
723
1217
|
return btoa(binaryString);
|
|
724
1218
|
}
|
|
725
|
-
function base64urlToUint8Array(
|
|
726
|
-
const
|
|
727
|
-
const padding = "=".repeat((4 -
|
|
728
|
-
return base64ToUint8Array(
|
|
1219
|
+
function base64urlToUint8Array(base64url3) {
|
|
1220
|
+
const base643 = base64url3.replace(/-/g, "+").replace(/_/g, "/");
|
|
1221
|
+
const padding = "=".repeat((4 - base643.length % 4) % 4);
|
|
1222
|
+
return base64ToUint8Array(base643 + padding);
|
|
729
1223
|
}
|
|
730
1224
|
function uint8ArrayToBase64url(bytes) {
|
|
731
1225
|
return uint8ArrayToBase64(bytes).replace(/\+/g, "-").replace(/\//g, "_").replace(/=/g, "");
|
|
732
1226
|
}
|
|
733
|
-
function hexToUint8Array(
|
|
734
|
-
const cleanHex =
|
|
1227
|
+
function hexToUint8Array(hex3) {
|
|
1228
|
+
const cleanHex = hex3.replace(/^0x/, "");
|
|
735
1229
|
if (cleanHex.length % 2 !== 0) {
|
|
736
1230
|
throw new Error("Invalid hex string length");
|
|
737
1231
|
}
|
|
@@ -814,6 +1308,76 @@
|
|
|
814
1308
|
processError(error46);
|
|
815
1309
|
return fieldErrors;
|
|
816
1310
|
}
|
|
1311
|
+
function treeifyError(error46, mapper = (issue2) => issue2.message) {
|
|
1312
|
+
const result = { errors: [] };
|
|
1313
|
+
const processError = (error47, path = []) => {
|
|
1314
|
+
var _a2, _b;
|
|
1315
|
+
for (const issue2 of error47.issues) {
|
|
1316
|
+
if (issue2.code === "invalid_union" && issue2.errors.length) {
|
|
1317
|
+
issue2.errors.map((issues) => processError({ issues }, issue2.path));
|
|
1318
|
+
} else if (issue2.code === "invalid_key") {
|
|
1319
|
+
processError({ issues: issue2.issues }, issue2.path);
|
|
1320
|
+
} else if (issue2.code === "invalid_element") {
|
|
1321
|
+
processError({ issues: issue2.issues }, issue2.path);
|
|
1322
|
+
} else {
|
|
1323
|
+
const fullpath = [...path, ...issue2.path];
|
|
1324
|
+
if (fullpath.length === 0) {
|
|
1325
|
+
result.errors.push(mapper(issue2));
|
|
1326
|
+
continue;
|
|
1327
|
+
}
|
|
1328
|
+
let curr = result;
|
|
1329
|
+
let i = 0;
|
|
1330
|
+
while (i < fullpath.length) {
|
|
1331
|
+
const el = fullpath[i];
|
|
1332
|
+
const terminal = i === fullpath.length - 1;
|
|
1333
|
+
if (typeof el === "string") {
|
|
1334
|
+
curr.properties ?? (curr.properties = {});
|
|
1335
|
+
(_a2 = curr.properties)[el] ?? (_a2[el] = { errors: [] });
|
|
1336
|
+
curr = curr.properties[el];
|
|
1337
|
+
} else {
|
|
1338
|
+
curr.items ?? (curr.items = []);
|
|
1339
|
+
(_b = curr.items)[el] ?? (_b[el] = { errors: [] });
|
|
1340
|
+
curr = curr.items[el];
|
|
1341
|
+
}
|
|
1342
|
+
if (terminal) {
|
|
1343
|
+
curr.errors.push(mapper(issue2));
|
|
1344
|
+
}
|
|
1345
|
+
i++;
|
|
1346
|
+
}
|
|
1347
|
+
}
|
|
1348
|
+
}
|
|
1349
|
+
};
|
|
1350
|
+
processError(error46);
|
|
1351
|
+
return result;
|
|
1352
|
+
}
|
|
1353
|
+
function toDotPath(_path) {
|
|
1354
|
+
const segs = [];
|
|
1355
|
+
const path = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
|
|
1356
|
+
for (const seg of path) {
|
|
1357
|
+
if (typeof seg === "number")
|
|
1358
|
+
segs.push(`[${seg}]`);
|
|
1359
|
+
else if (typeof seg === "symbol")
|
|
1360
|
+
segs.push(`[${JSON.stringify(String(seg))}]`);
|
|
1361
|
+
else if (/[^\w$]/.test(seg))
|
|
1362
|
+
segs.push(`[${JSON.stringify(seg)}]`);
|
|
1363
|
+
else {
|
|
1364
|
+
if (segs.length)
|
|
1365
|
+
segs.push(".");
|
|
1366
|
+
segs.push(seg);
|
|
1367
|
+
}
|
|
1368
|
+
}
|
|
1369
|
+
return segs.join("");
|
|
1370
|
+
}
|
|
1371
|
+
function prettifyError(error46) {
|
|
1372
|
+
const lines = [];
|
|
1373
|
+
const issues = [...error46.issues].sort((a, b) => (a.path ?? []).length - (b.path ?? []).length);
|
|
1374
|
+
for (const issue2 of issues) {
|
|
1375
|
+
lines.push(`\u2716 ${issue2.message}`);
|
|
1376
|
+
if (issue2.path?.length)
|
|
1377
|
+
lines.push(` \u2192 at ${toDotPath(issue2.path)}`);
|
|
1378
|
+
}
|
|
1379
|
+
return lines.join("\n");
|
|
1380
|
+
}
|
|
817
1381
|
|
|
818
1382
|
// ../../../../../../node_modules/.store/zod-npm-4.1.12-8e1ffc4d68/package/v4/core/parse.js
|
|
819
1383
|
var _parse = (_Err) => (schema, value, _ctx, _params) => {
|
|
@@ -829,6 +1393,7 @@
|
|
|
829
1393
|
}
|
|
830
1394
|
return result.value;
|
|
831
1395
|
};
|
|
1396
|
+
var parse = /* @__PURE__ */ _parse($ZodRealError);
|
|
832
1397
|
var _parseAsync = (_Err) => async (schema, value, _ctx, params) => {
|
|
833
1398
|
const ctx = _ctx ? Object.assign(_ctx, { async: true }) : { async: true };
|
|
834
1399
|
let result = schema._zod.run({ value, issues: [] }, ctx);
|
|
@@ -841,6 +1406,7 @@
|
|
|
841
1406
|
}
|
|
842
1407
|
return result.value;
|
|
843
1408
|
};
|
|
1409
|
+
var parseAsync = /* @__PURE__ */ _parseAsync($ZodRealError);
|
|
844
1410
|
var _safeParse = (_Err) => (schema, value, _ctx) => {
|
|
845
1411
|
const ctx = _ctx ? { ..._ctx, async: false } : { async: false };
|
|
846
1412
|
const result = schema._zod.run({ value, issues: [] }, ctx);
|
|
@@ -868,30 +1434,38 @@
|
|
|
868
1434
|
const ctx = _ctx ? Object.assign(_ctx, { direction: "backward" }) : { direction: "backward" };
|
|
869
1435
|
return _parse(_Err)(schema, value, ctx);
|
|
870
1436
|
};
|
|
1437
|
+
var encode = /* @__PURE__ */ _encode($ZodRealError);
|
|
871
1438
|
var _decode = (_Err) => (schema, value, _ctx) => {
|
|
872
1439
|
return _parse(_Err)(schema, value, _ctx);
|
|
873
1440
|
};
|
|
1441
|
+
var decode = /* @__PURE__ */ _decode($ZodRealError);
|
|
874
1442
|
var _encodeAsync = (_Err) => async (schema, value, _ctx) => {
|
|
875
1443
|
const ctx = _ctx ? Object.assign(_ctx, { direction: "backward" }) : { direction: "backward" };
|
|
876
1444
|
return _parseAsync(_Err)(schema, value, ctx);
|
|
877
1445
|
};
|
|
1446
|
+
var encodeAsync = /* @__PURE__ */ _encodeAsync($ZodRealError);
|
|
878
1447
|
var _decodeAsync = (_Err) => async (schema, value, _ctx) => {
|
|
879
1448
|
return _parseAsync(_Err)(schema, value, _ctx);
|
|
880
1449
|
};
|
|
1450
|
+
var decodeAsync = /* @__PURE__ */ _decodeAsync($ZodRealError);
|
|
881
1451
|
var _safeEncode = (_Err) => (schema, value, _ctx) => {
|
|
882
1452
|
const ctx = _ctx ? Object.assign(_ctx, { direction: "backward" }) : { direction: "backward" };
|
|
883
1453
|
return _safeParse(_Err)(schema, value, ctx);
|
|
884
1454
|
};
|
|
1455
|
+
var safeEncode = /* @__PURE__ */ _safeEncode($ZodRealError);
|
|
885
1456
|
var _safeDecode = (_Err) => (schema, value, _ctx) => {
|
|
886
1457
|
return _safeParse(_Err)(schema, value, _ctx);
|
|
887
1458
|
};
|
|
1459
|
+
var safeDecode = /* @__PURE__ */ _safeDecode($ZodRealError);
|
|
888
1460
|
var _safeEncodeAsync = (_Err) => async (schema, value, _ctx) => {
|
|
889
1461
|
const ctx = _ctx ? Object.assign(_ctx, { direction: "backward" }) : { direction: "backward" };
|
|
890
1462
|
return _safeParseAsync(_Err)(schema, value, ctx);
|
|
891
1463
|
};
|
|
1464
|
+
var safeEncodeAsync = /* @__PURE__ */ _safeEncodeAsync($ZodRealError);
|
|
892
1465
|
var _safeDecodeAsync = (_Err) => async (schema, value, _ctx) => {
|
|
893
1466
|
return _safeParseAsync(_Err)(schema, value, _ctx);
|
|
894
1467
|
};
|
|
1468
|
+
var safeDecodeAsync = /* @__PURE__ */ _safeDecodeAsync($ZodRealError);
|
|
895
1469
|
|
|
896
1470
|
// ../../../../../../node_modules/.store/zod-npm-4.1.12-8e1ffc4d68/package/v4/core/regexes.js
|
|
897
1471
|
var regexes_exports = {};
|
|
@@ -1210,6 +1784,125 @@
|
|
|
1210
1784
|
}
|
|
1211
1785
|
};
|
|
1212
1786
|
});
|
|
1787
|
+
var $ZodCheckBigIntFormat = /* @__PURE__ */ $constructor("$ZodCheckBigIntFormat", (inst, def) => {
|
|
1788
|
+
$ZodCheck.init(inst, def);
|
|
1789
|
+
const [minimum, maximum] = BIGINT_FORMAT_RANGES[def.format];
|
|
1790
|
+
inst._zod.onattach.push((inst2) => {
|
|
1791
|
+
const bag = inst2._zod.bag;
|
|
1792
|
+
bag.format = def.format;
|
|
1793
|
+
bag.minimum = minimum;
|
|
1794
|
+
bag.maximum = maximum;
|
|
1795
|
+
});
|
|
1796
|
+
inst._zod.check = (payload) => {
|
|
1797
|
+
const input = payload.value;
|
|
1798
|
+
if (input < minimum) {
|
|
1799
|
+
payload.issues.push({
|
|
1800
|
+
origin: "bigint",
|
|
1801
|
+
input,
|
|
1802
|
+
code: "too_small",
|
|
1803
|
+
minimum,
|
|
1804
|
+
inclusive: true,
|
|
1805
|
+
inst,
|
|
1806
|
+
continue: !def.abort
|
|
1807
|
+
});
|
|
1808
|
+
}
|
|
1809
|
+
if (input > maximum) {
|
|
1810
|
+
payload.issues.push({
|
|
1811
|
+
origin: "bigint",
|
|
1812
|
+
input,
|
|
1813
|
+
code: "too_big",
|
|
1814
|
+
maximum,
|
|
1815
|
+
inst
|
|
1816
|
+
});
|
|
1817
|
+
}
|
|
1818
|
+
};
|
|
1819
|
+
});
|
|
1820
|
+
var $ZodCheckMaxSize = /* @__PURE__ */ $constructor("$ZodCheckMaxSize", (inst, def) => {
|
|
1821
|
+
var _a2;
|
|
1822
|
+
$ZodCheck.init(inst, def);
|
|
1823
|
+
(_a2 = inst._zod.def).when ?? (_a2.when = (payload) => {
|
|
1824
|
+
const val = payload.value;
|
|
1825
|
+
return !nullish(val) && val.size !== void 0;
|
|
1826
|
+
});
|
|
1827
|
+
inst._zod.onattach.push((inst2) => {
|
|
1828
|
+
const curr = inst2._zod.bag.maximum ?? Number.POSITIVE_INFINITY;
|
|
1829
|
+
if (def.maximum < curr)
|
|
1830
|
+
inst2._zod.bag.maximum = def.maximum;
|
|
1831
|
+
});
|
|
1832
|
+
inst._zod.check = (payload) => {
|
|
1833
|
+
const input = payload.value;
|
|
1834
|
+
const size = input.size;
|
|
1835
|
+
if (size <= def.maximum)
|
|
1836
|
+
return;
|
|
1837
|
+
payload.issues.push({
|
|
1838
|
+
origin: getSizableOrigin(input),
|
|
1839
|
+
code: "too_big",
|
|
1840
|
+
maximum: def.maximum,
|
|
1841
|
+
inclusive: true,
|
|
1842
|
+
input,
|
|
1843
|
+
inst,
|
|
1844
|
+
continue: !def.abort
|
|
1845
|
+
});
|
|
1846
|
+
};
|
|
1847
|
+
});
|
|
1848
|
+
var $ZodCheckMinSize = /* @__PURE__ */ $constructor("$ZodCheckMinSize", (inst, def) => {
|
|
1849
|
+
var _a2;
|
|
1850
|
+
$ZodCheck.init(inst, def);
|
|
1851
|
+
(_a2 = inst._zod.def).when ?? (_a2.when = (payload) => {
|
|
1852
|
+
const val = payload.value;
|
|
1853
|
+
return !nullish(val) && val.size !== void 0;
|
|
1854
|
+
});
|
|
1855
|
+
inst._zod.onattach.push((inst2) => {
|
|
1856
|
+
const curr = inst2._zod.bag.minimum ?? Number.NEGATIVE_INFINITY;
|
|
1857
|
+
if (def.minimum > curr)
|
|
1858
|
+
inst2._zod.bag.minimum = def.minimum;
|
|
1859
|
+
});
|
|
1860
|
+
inst._zod.check = (payload) => {
|
|
1861
|
+
const input = payload.value;
|
|
1862
|
+
const size = input.size;
|
|
1863
|
+
if (size >= def.minimum)
|
|
1864
|
+
return;
|
|
1865
|
+
payload.issues.push({
|
|
1866
|
+
origin: getSizableOrigin(input),
|
|
1867
|
+
code: "too_small",
|
|
1868
|
+
minimum: def.minimum,
|
|
1869
|
+
inclusive: true,
|
|
1870
|
+
input,
|
|
1871
|
+
inst,
|
|
1872
|
+
continue: !def.abort
|
|
1873
|
+
});
|
|
1874
|
+
};
|
|
1875
|
+
});
|
|
1876
|
+
var $ZodCheckSizeEquals = /* @__PURE__ */ $constructor("$ZodCheckSizeEquals", (inst, def) => {
|
|
1877
|
+
var _a2;
|
|
1878
|
+
$ZodCheck.init(inst, def);
|
|
1879
|
+
(_a2 = inst._zod.def).when ?? (_a2.when = (payload) => {
|
|
1880
|
+
const val = payload.value;
|
|
1881
|
+
return !nullish(val) && val.size !== void 0;
|
|
1882
|
+
});
|
|
1883
|
+
inst._zod.onattach.push((inst2) => {
|
|
1884
|
+
const bag = inst2._zod.bag;
|
|
1885
|
+
bag.minimum = def.size;
|
|
1886
|
+
bag.maximum = def.size;
|
|
1887
|
+
bag.size = def.size;
|
|
1888
|
+
});
|
|
1889
|
+
inst._zod.check = (payload) => {
|
|
1890
|
+
const input = payload.value;
|
|
1891
|
+
const size = input.size;
|
|
1892
|
+
if (size === def.size)
|
|
1893
|
+
return;
|
|
1894
|
+
const tooBig = size > def.size;
|
|
1895
|
+
payload.issues.push({
|
|
1896
|
+
origin: getSizableOrigin(input),
|
|
1897
|
+
...tooBig ? { code: "too_big", maximum: def.size } : { code: "too_small", minimum: def.size },
|
|
1898
|
+
inclusive: true,
|
|
1899
|
+
exact: true,
|
|
1900
|
+
input: payload.value,
|
|
1901
|
+
inst,
|
|
1902
|
+
continue: !def.abort
|
|
1903
|
+
});
|
|
1904
|
+
};
|
|
1905
|
+
});
|
|
1213
1906
|
var $ZodCheckMaxLength = /* @__PURE__ */ $constructor("$ZodCheckMaxLength", (inst, def) => {
|
|
1214
1907
|
var _a2;
|
|
1215
1908
|
$ZodCheck.init(inst, def);
|
|
@@ -1424,6 +2117,43 @@
|
|
|
1424
2117
|
});
|
|
1425
2118
|
};
|
|
1426
2119
|
});
|
|
2120
|
+
function handleCheckPropertyResult(result, payload, property) {
|
|
2121
|
+
if (result.issues.length) {
|
|
2122
|
+
payload.issues.push(...prefixIssues(property, result.issues));
|
|
2123
|
+
}
|
|
2124
|
+
}
|
|
2125
|
+
var $ZodCheckProperty = /* @__PURE__ */ $constructor("$ZodCheckProperty", (inst, def) => {
|
|
2126
|
+
$ZodCheck.init(inst, def);
|
|
2127
|
+
inst._zod.check = (payload) => {
|
|
2128
|
+
const result = def.schema._zod.run({
|
|
2129
|
+
value: payload.value[def.property],
|
|
2130
|
+
issues: []
|
|
2131
|
+
}, {});
|
|
2132
|
+
if (result instanceof Promise) {
|
|
2133
|
+
return result.then((result2) => handleCheckPropertyResult(result2, payload, def.property));
|
|
2134
|
+
}
|
|
2135
|
+
handleCheckPropertyResult(result, payload, def.property);
|
|
2136
|
+
return;
|
|
2137
|
+
};
|
|
2138
|
+
});
|
|
2139
|
+
var $ZodCheckMimeType = /* @__PURE__ */ $constructor("$ZodCheckMimeType", (inst, def) => {
|
|
2140
|
+
$ZodCheck.init(inst, def);
|
|
2141
|
+
const mimeSet = new Set(def.mime);
|
|
2142
|
+
inst._zod.onattach.push((inst2) => {
|
|
2143
|
+
inst2._zod.bag.mime = def.mime;
|
|
2144
|
+
});
|
|
2145
|
+
inst._zod.check = (payload) => {
|
|
2146
|
+
if (mimeSet.has(payload.value.type))
|
|
2147
|
+
return;
|
|
2148
|
+
payload.issues.push({
|
|
2149
|
+
code: "invalid_value",
|
|
2150
|
+
values: def.mime,
|
|
2151
|
+
input: payload.value.type,
|
|
2152
|
+
inst,
|
|
2153
|
+
continue: !def.abort
|
|
2154
|
+
});
|
|
2155
|
+
};
|
|
2156
|
+
});
|
|
1427
2157
|
var $ZodCheckOverwrite = /* @__PURE__ */ $constructor("$ZodCheckOverwrite", (inst, def) => {
|
|
1428
2158
|
$ZodCheck.init(inst, def);
|
|
1429
2159
|
inst._zod.check = (payload) => {
|
|
@@ -1431,6 +2161,42 @@
|
|
|
1431
2161
|
};
|
|
1432
2162
|
});
|
|
1433
2163
|
|
|
2164
|
+
// ../../../../../../node_modules/.store/zod-npm-4.1.12-8e1ffc4d68/package/v4/core/doc.js
|
|
2165
|
+
var Doc = class {
|
|
2166
|
+
constructor(args = []) {
|
|
2167
|
+
this.content = [];
|
|
2168
|
+
this.indent = 0;
|
|
2169
|
+
if (this)
|
|
2170
|
+
this.args = args;
|
|
2171
|
+
}
|
|
2172
|
+
indented(fn) {
|
|
2173
|
+
this.indent += 1;
|
|
2174
|
+
fn(this);
|
|
2175
|
+
this.indent -= 1;
|
|
2176
|
+
}
|
|
2177
|
+
write(arg) {
|
|
2178
|
+
if (typeof arg === "function") {
|
|
2179
|
+
arg(this, { execution: "sync" });
|
|
2180
|
+
arg(this, { execution: "async" });
|
|
2181
|
+
return;
|
|
2182
|
+
}
|
|
2183
|
+
const content = arg;
|
|
2184
|
+
const lines = content.split("\n").filter((x) => x);
|
|
2185
|
+
const minIndent = Math.min(...lines.map((x) => x.length - x.trimStart().length));
|
|
2186
|
+
const dedented = lines.map((x) => x.slice(minIndent)).map((x) => " ".repeat(this.indent * 2) + x);
|
|
2187
|
+
for (const line of dedented) {
|
|
2188
|
+
this.content.push(line);
|
|
2189
|
+
}
|
|
2190
|
+
}
|
|
2191
|
+
compile() {
|
|
2192
|
+
const F = Function;
|
|
2193
|
+
const args = this?.args;
|
|
2194
|
+
const content = this?.content ?? [``];
|
|
2195
|
+
const lines = [...content.map((x) => ` ${x}`)];
|
|
2196
|
+
return new F(...args, lines.join("\n"));
|
|
2197
|
+
}
|
|
2198
|
+
};
|
|
2199
|
+
|
|
1434
2200
|
// ../../../../../../node_modules/.store/zod-npm-4.1.12-8e1ffc4d68/package/v4/core/versions.js
|
|
1435
2201
|
var version = {
|
|
1436
2202
|
major: 4,
|
|
@@ -1605,10 +2371,10 @@
|
|
|
1605
2371
|
inst._zod.check = (payload) => {
|
|
1606
2372
|
try {
|
|
1607
2373
|
const trimmed = payload.value.trim();
|
|
1608
|
-
const
|
|
2374
|
+
const url2 = new URL(trimmed);
|
|
1609
2375
|
if (def.hostname) {
|
|
1610
2376
|
def.hostname.lastIndex = 0;
|
|
1611
|
-
if (!def.hostname.test(
|
|
2377
|
+
if (!def.hostname.test(url2.hostname)) {
|
|
1612
2378
|
payload.issues.push({
|
|
1613
2379
|
code: "invalid_format",
|
|
1614
2380
|
format: "url",
|
|
@@ -1622,7 +2388,7 @@
|
|
|
1622
2388
|
}
|
|
1623
2389
|
if (def.protocol) {
|
|
1624
2390
|
def.protocol.lastIndex = 0;
|
|
1625
|
-
if (!def.protocol.test(
|
|
2391
|
+
if (!def.protocol.test(url2.protocol.endsWith(":") ? url2.protocol.slice(0, -1) : url2.protocol)) {
|
|
1626
2392
|
payload.issues.push({
|
|
1627
2393
|
code: "invalid_format",
|
|
1628
2394
|
format: "url",
|
|
@@ -1635,7 +2401,7 @@
|
|
|
1635
2401
|
}
|
|
1636
2402
|
}
|
|
1637
2403
|
if (def.normalize) {
|
|
1638
|
-
payload.value =
|
|
2404
|
+
payload.value = url2.href;
|
|
1639
2405
|
} else {
|
|
1640
2406
|
payload.value = trimmed;
|
|
1641
2407
|
}
|
|
@@ -1789,8 +2555,8 @@
|
|
|
1789
2555
|
function isValidBase64URL(data) {
|
|
1790
2556
|
if (!base64url.test(data))
|
|
1791
2557
|
return false;
|
|
1792
|
-
const
|
|
1793
|
-
const padded =
|
|
2558
|
+
const base643 = data.replace(/[-_]/g, (c) => c === "-" ? "+" : "/");
|
|
2559
|
+
const padded = base643.padEnd(Math.ceil(base643.length / 4) * 4, "=");
|
|
1794
2560
|
return isValidBase64(padded);
|
|
1795
2561
|
}
|
|
1796
2562
|
var $ZodBase64URL = /* @__PURE__ */ $constructor("$ZodBase64URL", (inst, def) => {
|
|
@@ -1849,6 +2615,20 @@
|
|
|
1849
2615
|
});
|
|
1850
2616
|
};
|
|
1851
2617
|
});
|
|
2618
|
+
var $ZodCustomStringFormat = /* @__PURE__ */ $constructor("$ZodCustomStringFormat", (inst, def) => {
|
|
2619
|
+
$ZodStringFormat.init(inst, def);
|
|
2620
|
+
inst._zod.check = (payload) => {
|
|
2621
|
+
if (def.fn(payload.value))
|
|
2622
|
+
return;
|
|
2623
|
+
payload.issues.push({
|
|
2624
|
+
code: "invalid_format",
|
|
2625
|
+
format: def.format,
|
|
2626
|
+
input: payload.value,
|
|
2627
|
+
inst,
|
|
2628
|
+
continue: !def.abort
|
|
2629
|
+
});
|
|
2630
|
+
};
|
|
2631
|
+
});
|
|
1852
2632
|
var $ZodNumber = /* @__PURE__ */ $constructor("$ZodNumber", (inst, def) => {
|
|
1853
2633
|
$ZodType.init(inst, def);
|
|
1854
2634
|
inst._zod.pattern = inst._zod.bag.pattern ?? number;
|
|
@@ -1877,6 +2657,27 @@
|
|
|
1877
2657
|
$ZodCheckNumberFormat.init(inst, def);
|
|
1878
2658
|
$ZodNumber.init(inst, def);
|
|
1879
2659
|
});
|
|
2660
|
+
var $ZodBoolean = /* @__PURE__ */ $constructor("$ZodBoolean", (inst, def) => {
|
|
2661
|
+
$ZodType.init(inst, def);
|
|
2662
|
+
inst._zod.pattern = boolean;
|
|
2663
|
+
inst._zod.parse = (payload, _ctx) => {
|
|
2664
|
+
if (def.coerce)
|
|
2665
|
+
try {
|
|
2666
|
+
payload.value = Boolean(payload.value);
|
|
2667
|
+
} catch (_) {
|
|
2668
|
+
}
|
|
2669
|
+
const input = payload.value;
|
|
2670
|
+
if (typeof input === "boolean")
|
|
2671
|
+
return payload;
|
|
2672
|
+
payload.issues.push({
|
|
2673
|
+
expected: "boolean",
|
|
2674
|
+
code: "invalid_type",
|
|
2675
|
+
input,
|
|
2676
|
+
inst
|
|
2677
|
+
});
|
|
2678
|
+
return payload;
|
|
2679
|
+
};
|
|
2680
|
+
});
|
|
1880
2681
|
var $ZodBigInt = /* @__PURE__ */ $constructor("$ZodBigInt", (inst, def) => {
|
|
1881
2682
|
$ZodType.init(inst, def);
|
|
1882
2683
|
inst._zod.pattern = bigint;
|
|
@@ -1897,84 +2698,397 @@
|
|
|
1897
2698
|
return payload;
|
|
1898
2699
|
};
|
|
1899
2700
|
});
|
|
1900
|
-
|
|
1901
|
-
|
|
1902
|
-
|
|
1903
|
-
|
|
1904
|
-
|
|
1905
|
-
}
|
|
1906
|
-
var $ZodArray = /* @__PURE__ */ $constructor("$ZodArray", (inst, def) => {
|
|
2701
|
+
var $ZodBigIntFormat = /* @__PURE__ */ $constructor("$ZodBigInt", (inst, def) => {
|
|
2702
|
+
$ZodCheckBigIntFormat.init(inst, def);
|
|
2703
|
+
$ZodBigInt.init(inst, def);
|
|
2704
|
+
});
|
|
2705
|
+
var $ZodSymbol = /* @__PURE__ */ $constructor("$ZodSymbol", (inst, def) => {
|
|
1907
2706
|
$ZodType.init(inst, def);
|
|
1908
|
-
inst._zod.parse = (payload,
|
|
2707
|
+
inst._zod.parse = (payload, _ctx) => {
|
|
1909
2708
|
const input = payload.value;
|
|
1910
|
-
if (
|
|
1911
|
-
payload.issues.push({
|
|
1912
|
-
expected: "array",
|
|
1913
|
-
code: "invalid_type",
|
|
1914
|
-
input,
|
|
1915
|
-
inst
|
|
1916
|
-
});
|
|
2709
|
+
if (typeof input === "symbol")
|
|
1917
2710
|
return payload;
|
|
1918
|
-
|
|
1919
|
-
|
|
1920
|
-
|
|
1921
|
-
|
|
1922
|
-
|
|
1923
|
-
|
|
1924
|
-
value: item,
|
|
1925
|
-
issues: []
|
|
1926
|
-
}, ctx);
|
|
1927
|
-
if (result instanceof Promise) {
|
|
1928
|
-
proms.push(result.then((result2) => handleArrayResult(result2, payload, i)));
|
|
1929
|
-
} else {
|
|
1930
|
-
handleArrayResult(result, payload, i);
|
|
1931
|
-
}
|
|
1932
|
-
}
|
|
1933
|
-
if (proms.length) {
|
|
1934
|
-
return Promise.all(proms).then(() => payload);
|
|
1935
|
-
}
|
|
2711
|
+
payload.issues.push({
|
|
2712
|
+
expected: "symbol",
|
|
2713
|
+
code: "invalid_type",
|
|
2714
|
+
input,
|
|
2715
|
+
inst
|
|
2716
|
+
});
|
|
1936
2717
|
return payload;
|
|
1937
2718
|
};
|
|
1938
2719
|
});
|
|
1939
|
-
|
|
1940
|
-
|
|
1941
|
-
|
|
1942
|
-
|
|
1943
|
-
|
|
1944
|
-
|
|
1945
|
-
|
|
1946
|
-
|
|
1947
|
-
|
|
1948
|
-
|
|
1949
|
-
|
|
1950
|
-
|
|
1951
|
-
|
|
1952
|
-
|
|
1953
|
-
|
|
1954
|
-
|
|
1955
|
-
|
|
1956
|
-
}
|
|
1957
|
-
|
|
1958
|
-
|
|
1959
|
-
|
|
2720
|
+
var $ZodUndefined = /* @__PURE__ */ $constructor("$ZodUndefined", (inst, def) => {
|
|
2721
|
+
$ZodType.init(inst, def);
|
|
2722
|
+
inst._zod.pattern = _undefined;
|
|
2723
|
+
inst._zod.values = /* @__PURE__ */ new Set([void 0]);
|
|
2724
|
+
inst._zod.optin = "optional";
|
|
2725
|
+
inst._zod.optout = "optional";
|
|
2726
|
+
inst._zod.parse = (payload, _ctx) => {
|
|
2727
|
+
const input = payload.value;
|
|
2728
|
+
if (typeof input === "undefined")
|
|
2729
|
+
return payload;
|
|
2730
|
+
payload.issues.push({
|
|
2731
|
+
expected: "undefined",
|
|
2732
|
+
code: "invalid_type",
|
|
2733
|
+
input,
|
|
2734
|
+
inst
|
|
2735
|
+
});
|
|
2736
|
+
return payload;
|
|
2737
|
+
};
|
|
2738
|
+
});
|
|
2739
|
+
var $ZodNull = /* @__PURE__ */ $constructor("$ZodNull", (inst, def) => {
|
|
2740
|
+
$ZodType.init(inst, def);
|
|
2741
|
+
inst._zod.pattern = _null;
|
|
2742
|
+
inst._zod.values = /* @__PURE__ */ new Set([null]);
|
|
2743
|
+
inst._zod.parse = (payload, _ctx) => {
|
|
2744
|
+
const input = payload.value;
|
|
2745
|
+
if (input === null)
|
|
2746
|
+
return payload;
|
|
2747
|
+
payload.issues.push({
|
|
2748
|
+
expected: "null",
|
|
2749
|
+
code: "invalid_type",
|
|
2750
|
+
input,
|
|
2751
|
+
inst
|
|
2752
|
+
});
|
|
2753
|
+
return payload;
|
|
2754
|
+
};
|
|
2755
|
+
});
|
|
2756
|
+
var $ZodAny = /* @__PURE__ */ $constructor("$ZodAny", (inst, def) => {
|
|
2757
|
+
$ZodType.init(inst, def);
|
|
2758
|
+
inst._zod.parse = (payload) => payload;
|
|
2759
|
+
});
|
|
2760
|
+
var $ZodUnknown = /* @__PURE__ */ $constructor("$ZodUnknown", (inst, def) => {
|
|
2761
|
+
$ZodType.init(inst, def);
|
|
2762
|
+
inst._zod.parse = (payload) => payload;
|
|
2763
|
+
});
|
|
2764
|
+
var $ZodNever = /* @__PURE__ */ $constructor("$ZodNever", (inst, def) => {
|
|
2765
|
+
$ZodType.init(inst, def);
|
|
2766
|
+
inst._zod.parse = (payload, _ctx) => {
|
|
2767
|
+
payload.issues.push({
|
|
2768
|
+
expected: "never",
|
|
2769
|
+
code: "invalid_type",
|
|
2770
|
+
input: payload.value,
|
|
2771
|
+
inst
|
|
2772
|
+
});
|
|
2773
|
+
return payload;
|
|
2774
|
+
};
|
|
2775
|
+
});
|
|
2776
|
+
var $ZodVoid = /* @__PURE__ */ $constructor("$ZodVoid", (inst, def) => {
|
|
2777
|
+
$ZodType.init(inst, def);
|
|
2778
|
+
inst._zod.parse = (payload, _ctx) => {
|
|
2779
|
+
const input = payload.value;
|
|
2780
|
+
if (typeof input === "undefined")
|
|
2781
|
+
return payload;
|
|
2782
|
+
payload.issues.push({
|
|
2783
|
+
expected: "void",
|
|
2784
|
+
code: "invalid_type",
|
|
2785
|
+
input,
|
|
2786
|
+
inst
|
|
2787
|
+
});
|
|
2788
|
+
return payload;
|
|
2789
|
+
};
|
|
2790
|
+
});
|
|
2791
|
+
var $ZodDate = /* @__PURE__ */ $constructor("$ZodDate", (inst, def) => {
|
|
2792
|
+
$ZodType.init(inst, def);
|
|
2793
|
+
inst._zod.parse = (payload, _ctx) => {
|
|
2794
|
+
if (def.coerce) {
|
|
2795
|
+
try {
|
|
2796
|
+
payload.value = new Date(payload.value);
|
|
2797
|
+
} catch (_err) {
|
|
2798
|
+
}
|
|
2799
|
+
}
|
|
2800
|
+
const input = payload.value;
|
|
2801
|
+
const isDate = input instanceof Date;
|
|
2802
|
+
const isValidDate = isDate && !Number.isNaN(input.getTime());
|
|
2803
|
+
if (isValidDate)
|
|
2804
|
+
return payload;
|
|
2805
|
+
payload.issues.push({
|
|
2806
|
+
expected: "date",
|
|
2807
|
+
code: "invalid_type",
|
|
2808
|
+
input,
|
|
2809
|
+
...isDate ? { received: "Invalid Date" } : {},
|
|
2810
|
+
inst
|
|
2811
|
+
});
|
|
2812
|
+
return payload;
|
|
2813
|
+
};
|
|
2814
|
+
});
|
|
2815
|
+
function handleArrayResult(result, final, index) {
|
|
2816
|
+
if (result.issues.length) {
|
|
2817
|
+
final.issues.push(...prefixIssues(index, result.issues));
|
|
2818
|
+
}
|
|
2819
|
+
final.value[index] = result.value;
|
|
2820
|
+
}
|
|
2821
|
+
var $ZodArray = /* @__PURE__ */ $constructor("$ZodArray", (inst, def) => {
|
|
1960
2822
|
$ZodType.init(inst, def);
|
|
1961
|
-
|
|
1962
|
-
|
|
1963
|
-
|
|
1964
|
-
|
|
1965
|
-
|
|
1966
|
-
|
|
1967
|
-
|
|
1968
|
-
|
|
1969
|
-
|
|
1970
|
-
|
|
1971
|
-
|
|
1972
|
-
|
|
1973
|
-
|
|
1974
|
-
|
|
1975
|
-
|
|
1976
|
-
|
|
1977
|
-
|
|
2823
|
+
inst._zod.parse = (payload, ctx) => {
|
|
2824
|
+
const input = payload.value;
|
|
2825
|
+
if (!Array.isArray(input)) {
|
|
2826
|
+
payload.issues.push({
|
|
2827
|
+
expected: "array",
|
|
2828
|
+
code: "invalid_type",
|
|
2829
|
+
input,
|
|
2830
|
+
inst
|
|
2831
|
+
});
|
|
2832
|
+
return payload;
|
|
2833
|
+
}
|
|
2834
|
+
payload.value = Array(input.length);
|
|
2835
|
+
const proms = [];
|
|
2836
|
+
for (let i = 0; i < input.length; i++) {
|
|
2837
|
+
const item = input[i];
|
|
2838
|
+
const result = def.element._zod.run({
|
|
2839
|
+
value: item,
|
|
2840
|
+
issues: []
|
|
2841
|
+
}, ctx);
|
|
2842
|
+
if (result instanceof Promise) {
|
|
2843
|
+
proms.push(result.then((result2) => handleArrayResult(result2, payload, i)));
|
|
2844
|
+
} else {
|
|
2845
|
+
handleArrayResult(result, payload, i);
|
|
2846
|
+
}
|
|
2847
|
+
}
|
|
2848
|
+
if (proms.length) {
|
|
2849
|
+
return Promise.all(proms).then(() => payload);
|
|
2850
|
+
}
|
|
2851
|
+
return payload;
|
|
2852
|
+
};
|
|
2853
|
+
});
|
|
2854
|
+
function handlePropertyResult(result, final, key, input) {
|
|
2855
|
+
if (result.issues.length) {
|
|
2856
|
+
final.issues.push(...prefixIssues(key, result.issues));
|
|
2857
|
+
}
|
|
2858
|
+
if (result.value === void 0) {
|
|
2859
|
+
if (key in input) {
|
|
2860
|
+
final.value[key] = void 0;
|
|
2861
|
+
}
|
|
2862
|
+
} else {
|
|
2863
|
+
final.value[key] = result.value;
|
|
2864
|
+
}
|
|
2865
|
+
}
|
|
2866
|
+
function normalizeDef(def) {
|
|
2867
|
+
const keys = Object.keys(def.shape);
|
|
2868
|
+
for (const k of keys) {
|
|
2869
|
+
if (!def.shape?.[k]?._zod?.traits?.has("$ZodType")) {
|
|
2870
|
+
throw new Error(`Invalid element at key "${k}": expected a Zod schema`);
|
|
2871
|
+
}
|
|
2872
|
+
}
|
|
2873
|
+
const okeys = optionalKeys(def.shape);
|
|
2874
|
+
return {
|
|
2875
|
+
...def,
|
|
2876
|
+
keys,
|
|
2877
|
+
keySet: new Set(keys),
|
|
2878
|
+
numKeys: keys.length,
|
|
2879
|
+
optionalKeys: new Set(okeys)
|
|
2880
|
+
};
|
|
2881
|
+
}
|
|
2882
|
+
function handleCatchall(proms, input, payload, ctx, def, inst) {
|
|
2883
|
+
const unrecognized = [];
|
|
2884
|
+
const keySet = def.keySet;
|
|
2885
|
+
const _catchall = def.catchall._zod;
|
|
2886
|
+
const t = _catchall.def.type;
|
|
2887
|
+
for (const key of Object.keys(input)) {
|
|
2888
|
+
if (keySet.has(key))
|
|
2889
|
+
continue;
|
|
2890
|
+
if (t === "never") {
|
|
2891
|
+
unrecognized.push(key);
|
|
2892
|
+
continue;
|
|
2893
|
+
}
|
|
2894
|
+
const r = _catchall.run({ value: input[key], issues: [] }, ctx);
|
|
2895
|
+
if (r instanceof Promise) {
|
|
2896
|
+
proms.push(r.then((r2) => handlePropertyResult(r2, payload, key, input)));
|
|
2897
|
+
} else {
|
|
2898
|
+
handlePropertyResult(r, payload, key, input);
|
|
2899
|
+
}
|
|
2900
|
+
}
|
|
2901
|
+
if (unrecognized.length) {
|
|
2902
|
+
payload.issues.push({
|
|
2903
|
+
code: "unrecognized_keys",
|
|
2904
|
+
keys: unrecognized,
|
|
2905
|
+
input,
|
|
2906
|
+
inst
|
|
2907
|
+
});
|
|
2908
|
+
}
|
|
2909
|
+
if (!proms.length)
|
|
2910
|
+
return payload;
|
|
2911
|
+
return Promise.all(proms).then(() => {
|
|
2912
|
+
return payload;
|
|
2913
|
+
});
|
|
2914
|
+
}
|
|
2915
|
+
var $ZodObject = /* @__PURE__ */ $constructor("$ZodObject", (inst, def) => {
|
|
2916
|
+
$ZodType.init(inst, def);
|
|
2917
|
+
const desc = Object.getOwnPropertyDescriptor(def, "shape");
|
|
2918
|
+
if (!desc?.get) {
|
|
2919
|
+
const sh = def.shape;
|
|
2920
|
+
Object.defineProperty(def, "shape", {
|
|
2921
|
+
get: () => {
|
|
2922
|
+
const newSh = { ...sh };
|
|
2923
|
+
Object.defineProperty(def, "shape", {
|
|
2924
|
+
value: newSh
|
|
2925
|
+
});
|
|
2926
|
+
return newSh;
|
|
2927
|
+
}
|
|
2928
|
+
});
|
|
2929
|
+
}
|
|
2930
|
+
const _normalized = cached(() => normalizeDef(def));
|
|
2931
|
+
defineLazy(inst._zod, "propValues", () => {
|
|
2932
|
+
const shape = def.shape;
|
|
2933
|
+
const propValues = {};
|
|
2934
|
+
for (const key in shape) {
|
|
2935
|
+
const field = shape[key]._zod;
|
|
2936
|
+
if (field.values) {
|
|
2937
|
+
propValues[key] ?? (propValues[key] = /* @__PURE__ */ new Set());
|
|
2938
|
+
for (const v of field.values)
|
|
2939
|
+
propValues[key].add(v);
|
|
2940
|
+
}
|
|
2941
|
+
}
|
|
2942
|
+
return propValues;
|
|
2943
|
+
});
|
|
2944
|
+
const isObject2 = isObject;
|
|
2945
|
+
const catchall = def.catchall;
|
|
2946
|
+
let value;
|
|
2947
|
+
inst._zod.parse = (payload, ctx) => {
|
|
2948
|
+
value ?? (value = _normalized.value);
|
|
2949
|
+
const input = payload.value;
|
|
2950
|
+
if (!isObject2(input)) {
|
|
2951
|
+
payload.issues.push({
|
|
2952
|
+
expected: "object",
|
|
2953
|
+
code: "invalid_type",
|
|
2954
|
+
input,
|
|
2955
|
+
inst
|
|
2956
|
+
});
|
|
2957
|
+
return payload;
|
|
2958
|
+
}
|
|
2959
|
+
payload.value = {};
|
|
2960
|
+
const proms = [];
|
|
2961
|
+
const shape = value.shape;
|
|
2962
|
+
for (const key of value.keys) {
|
|
2963
|
+
const el = shape[key];
|
|
2964
|
+
const r = el._zod.run({ value: input[key], issues: [] }, ctx);
|
|
2965
|
+
if (r instanceof Promise) {
|
|
2966
|
+
proms.push(r.then((r2) => handlePropertyResult(r2, payload, key, input)));
|
|
2967
|
+
} else {
|
|
2968
|
+
handlePropertyResult(r, payload, key, input);
|
|
2969
|
+
}
|
|
2970
|
+
}
|
|
2971
|
+
if (!catchall) {
|
|
2972
|
+
return proms.length ? Promise.all(proms).then(() => payload) : payload;
|
|
2973
|
+
}
|
|
2974
|
+
return handleCatchall(proms, input, payload, ctx, _normalized.value, inst);
|
|
2975
|
+
};
|
|
2976
|
+
});
|
|
2977
|
+
var $ZodObjectJIT = /* @__PURE__ */ $constructor("$ZodObjectJIT", (inst, def) => {
|
|
2978
|
+
$ZodObject.init(inst, def);
|
|
2979
|
+
const superParse = inst._zod.parse;
|
|
2980
|
+
const _normalized = cached(() => normalizeDef(def));
|
|
2981
|
+
const generateFastpass = (shape) => {
|
|
2982
|
+
const doc = new Doc(["shape", "payload", "ctx"]);
|
|
2983
|
+
const normalized = _normalized.value;
|
|
2984
|
+
const parseStr = (key) => {
|
|
2985
|
+
const k = esc(key);
|
|
2986
|
+
return `shape[${k}]._zod.run({ value: input[${k}], issues: [] }, ctx)`;
|
|
2987
|
+
};
|
|
2988
|
+
doc.write(`const input = payload.value;`);
|
|
2989
|
+
const ids = /* @__PURE__ */ Object.create(null);
|
|
2990
|
+
let counter = 0;
|
|
2991
|
+
for (const key of normalized.keys) {
|
|
2992
|
+
ids[key] = `key_${counter++}`;
|
|
2993
|
+
}
|
|
2994
|
+
doc.write(`const newResult = {};`);
|
|
2995
|
+
for (const key of normalized.keys) {
|
|
2996
|
+
const id = ids[key];
|
|
2997
|
+
const k = esc(key);
|
|
2998
|
+
doc.write(`const ${id} = ${parseStr(key)};`);
|
|
2999
|
+
doc.write(`
|
|
3000
|
+
if (${id}.issues.length) {
|
|
3001
|
+
payload.issues = payload.issues.concat(${id}.issues.map(iss => ({
|
|
3002
|
+
...iss,
|
|
3003
|
+
path: iss.path ? [${k}, ...iss.path] : [${k}]
|
|
3004
|
+
})));
|
|
3005
|
+
}
|
|
3006
|
+
|
|
3007
|
+
|
|
3008
|
+
if (${id}.value === undefined) {
|
|
3009
|
+
if (${k} in input) {
|
|
3010
|
+
newResult[${k}] = undefined;
|
|
3011
|
+
}
|
|
3012
|
+
} else {
|
|
3013
|
+
newResult[${k}] = ${id}.value;
|
|
3014
|
+
}
|
|
3015
|
+
|
|
3016
|
+
`);
|
|
3017
|
+
}
|
|
3018
|
+
doc.write(`payload.value = newResult;`);
|
|
3019
|
+
doc.write(`return payload;`);
|
|
3020
|
+
const fn = doc.compile();
|
|
3021
|
+
return (payload, ctx) => fn(shape, payload, ctx);
|
|
3022
|
+
};
|
|
3023
|
+
let fastpass;
|
|
3024
|
+
const isObject2 = isObject;
|
|
3025
|
+
const jit = !globalConfig.jitless;
|
|
3026
|
+
const allowsEval2 = allowsEval;
|
|
3027
|
+
const fastEnabled = jit && allowsEval2.value;
|
|
3028
|
+
const catchall = def.catchall;
|
|
3029
|
+
let value;
|
|
3030
|
+
inst._zod.parse = (payload, ctx) => {
|
|
3031
|
+
value ?? (value = _normalized.value);
|
|
3032
|
+
const input = payload.value;
|
|
3033
|
+
if (!isObject2(input)) {
|
|
3034
|
+
payload.issues.push({
|
|
3035
|
+
expected: "object",
|
|
3036
|
+
code: "invalid_type",
|
|
3037
|
+
input,
|
|
3038
|
+
inst
|
|
3039
|
+
});
|
|
3040
|
+
return payload;
|
|
3041
|
+
}
|
|
3042
|
+
if (jit && fastEnabled && ctx?.async === false && ctx.jitless !== true) {
|
|
3043
|
+
if (!fastpass)
|
|
3044
|
+
fastpass = generateFastpass(def.shape);
|
|
3045
|
+
payload = fastpass(payload, ctx);
|
|
3046
|
+
if (!catchall)
|
|
3047
|
+
return payload;
|
|
3048
|
+
return handleCatchall([], input, payload, ctx, value, inst);
|
|
3049
|
+
}
|
|
3050
|
+
return superParse(payload, ctx);
|
|
3051
|
+
};
|
|
3052
|
+
});
|
|
3053
|
+
function handleUnionResults(results, final, inst, ctx) {
|
|
3054
|
+
for (const result of results) {
|
|
3055
|
+
if (result.issues.length === 0) {
|
|
3056
|
+
final.value = result.value;
|
|
3057
|
+
return final;
|
|
3058
|
+
}
|
|
3059
|
+
}
|
|
3060
|
+
const nonaborted = results.filter((r) => !aborted(r));
|
|
3061
|
+
if (nonaborted.length === 1) {
|
|
3062
|
+
final.value = nonaborted[0].value;
|
|
3063
|
+
return nonaborted[0];
|
|
3064
|
+
}
|
|
3065
|
+
final.issues.push({
|
|
3066
|
+
code: "invalid_union",
|
|
3067
|
+
input: final.value,
|
|
3068
|
+
inst,
|
|
3069
|
+
errors: results.map((result) => result.issues.map((iss) => finalizeIssue(iss, ctx, config())))
|
|
3070
|
+
});
|
|
3071
|
+
return final;
|
|
3072
|
+
}
|
|
3073
|
+
var $ZodUnion = /* @__PURE__ */ $constructor("$ZodUnion", (inst, def) => {
|
|
3074
|
+
$ZodType.init(inst, def);
|
|
3075
|
+
defineLazy(inst._zod, "optin", () => def.options.some((o) => o._zod.optin === "optional") ? "optional" : void 0);
|
|
3076
|
+
defineLazy(inst._zod, "optout", () => def.options.some((o) => o._zod.optout === "optional") ? "optional" : void 0);
|
|
3077
|
+
defineLazy(inst._zod, "values", () => {
|
|
3078
|
+
if (def.options.every((o) => o._zod.values)) {
|
|
3079
|
+
return new Set(def.options.flatMap((option) => Array.from(option._zod.values)));
|
|
3080
|
+
}
|
|
3081
|
+
return void 0;
|
|
3082
|
+
});
|
|
3083
|
+
defineLazy(inst._zod, "pattern", () => {
|
|
3084
|
+
if (def.options.every((o) => o._zod.pattern)) {
|
|
3085
|
+
const patterns = def.options.map((o) => o._zod.pattern);
|
|
3086
|
+
return new RegExp(`^(${patterns.map((p) => cleanRegex(p.source)).join("|")})$`);
|
|
3087
|
+
}
|
|
3088
|
+
return void 0;
|
|
3089
|
+
});
|
|
3090
|
+
const single = def.options.length === 1;
|
|
3091
|
+
const first = def.options[0]._zod.run;
|
|
1978
3092
|
inst._zod.parse = (payload, ctx) => {
|
|
1979
3093
|
if (single) {
|
|
1980
3094
|
return first(payload, ctx);
|
|
@@ -2002,6 +3116,71 @@
|
|
|
2002
3116
|
});
|
|
2003
3117
|
};
|
|
2004
3118
|
});
|
|
3119
|
+
var $ZodDiscriminatedUnion = /* @__PURE__ */ $constructor("$ZodDiscriminatedUnion", (inst, def) => {
|
|
3120
|
+
$ZodUnion.init(inst, def);
|
|
3121
|
+
const _super = inst._zod.parse;
|
|
3122
|
+
defineLazy(inst._zod, "propValues", () => {
|
|
3123
|
+
const propValues = {};
|
|
3124
|
+
for (const option of def.options) {
|
|
3125
|
+
const pv = option._zod.propValues;
|
|
3126
|
+
if (!pv || Object.keys(pv).length === 0)
|
|
3127
|
+
throw new Error(`Invalid discriminated union option at index "${def.options.indexOf(option)}"`);
|
|
3128
|
+
for (const [k, v] of Object.entries(pv)) {
|
|
3129
|
+
if (!propValues[k])
|
|
3130
|
+
propValues[k] = /* @__PURE__ */ new Set();
|
|
3131
|
+
for (const val of v) {
|
|
3132
|
+
propValues[k].add(val);
|
|
3133
|
+
}
|
|
3134
|
+
}
|
|
3135
|
+
}
|
|
3136
|
+
return propValues;
|
|
3137
|
+
});
|
|
3138
|
+
const disc = cached(() => {
|
|
3139
|
+
const opts = def.options;
|
|
3140
|
+
const map2 = /* @__PURE__ */ new Map();
|
|
3141
|
+
for (const o of opts) {
|
|
3142
|
+
const values = o._zod.propValues?.[def.discriminator];
|
|
3143
|
+
if (!values || values.size === 0)
|
|
3144
|
+
throw new Error(`Invalid discriminated union option at index "${def.options.indexOf(o)}"`);
|
|
3145
|
+
for (const v of values) {
|
|
3146
|
+
if (map2.has(v)) {
|
|
3147
|
+
throw new Error(`Duplicate discriminator value "${String(v)}"`);
|
|
3148
|
+
}
|
|
3149
|
+
map2.set(v, o);
|
|
3150
|
+
}
|
|
3151
|
+
}
|
|
3152
|
+
return map2;
|
|
3153
|
+
});
|
|
3154
|
+
inst._zod.parse = (payload, ctx) => {
|
|
3155
|
+
const input = payload.value;
|
|
3156
|
+
if (!isObject(input)) {
|
|
3157
|
+
payload.issues.push({
|
|
3158
|
+
code: "invalid_type",
|
|
3159
|
+
expected: "object",
|
|
3160
|
+
input,
|
|
3161
|
+
inst
|
|
3162
|
+
});
|
|
3163
|
+
return payload;
|
|
3164
|
+
}
|
|
3165
|
+
const opt = disc.value.get(input?.[def.discriminator]);
|
|
3166
|
+
if (opt) {
|
|
3167
|
+
return opt._zod.run(payload, ctx);
|
|
3168
|
+
}
|
|
3169
|
+
if (def.unionFallback) {
|
|
3170
|
+
return _super(payload, ctx);
|
|
3171
|
+
}
|
|
3172
|
+
payload.issues.push({
|
|
3173
|
+
code: "invalid_union",
|
|
3174
|
+
errors: [],
|
|
3175
|
+
note: "No matching discriminator",
|
|
3176
|
+
discriminator: def.discriminator,
|
|
3177
|
+
input,
|
|
3178
|
+
path: [def.discriminator],
|
|
3179
|
+
inst
|
|
3180
|
+
});
|
|
3181
|
+
return payload;
|
|
3182
|
+
};
|
|
3183
|
+
});
|
|
2005
3184
|
var $ZodIntersection = /* @__PURE__ */ $constructor("$ZodIntersection", (inst, def) => {
|
|
2006
3185
|
$ZodType.init(inst, def);
|
|
2007
3186
|
inst._zod.parse = (payload, ctx) => {
|
|
@@ -2077,6 +3256,322 @@
|
|
|
2077
3256
|
result.value = merged.data;
|
|
2078
3257
|
return result;
|
|
2079
3258
|
}
|
|
3259
|
+
var $ZodTuple = /* @__PURE__ */ $constructor("$ZodTuple", (inst, def) => {
|
|
3260
|
+
$ZodType.init(inst, def);
|
|
3261
|
+
const items = def.items;
|
|
3262
|
+
const optStart = items.length - [...items].reverse().findIndex((item) => item._zod.optin !== "optional");
|
|
3263
|
+
inst._zod.parse = (payload, ctx) => {
|
|
3264
|
+
const input = payload.value;
|
|
3265
|
+
if (!Array.isArray(input)) {
|
|
3266
|
+
payload.issues.push({
|
|
3267
|
+
input,
|
|
3268
|
+
inst,
|
|
3269
|
+
expected: "tuple",
|
|
3270
|
+
code: "invalid_type"
|
|
3271
|
+
});
|
|
3272
|
+
return payload;
|
|
3273
|
+
}
|
|
3274
|
+
payload.value = [];
|
|
3275
|
+
const proms = [];
|
|
3276
|
+
if (!def.rest) {
|
|
3277
|
+
const tooBig = input.length > items.length;
|
|
3278
|
+
const tooSmall = input.length < optStart - 1;
|
|
3279
|
+
if (tooBig || tooSmall) {
|
|
3280
|
+
payload.issues.push({
|
|
3281
|
+
...tooBig ? { code: "too_big", maximum: items.length } : { code: "too_small", minimum: items.length },
|
|
3282
|
+
input,
|
|
3283
|
+
inst,
|
|
3284
|
+
origin: "array"
|
|
3285
|
+
});
|
|
3286
|
+
return payload;
|
|
3287
|
+
}
|
|
3288
|
+
}
|
|
3289
|
+
let i = -1;
|
|
3290
|
+
for (const item of items) {
|
|
3291
|
+
i++;
|
|
3292
|
+
if (i >= input.length) {
|
|
3293
|
+
if (i >= optStart)
|
|
3294
|
+
continue;
|
|
3295
|
+
}
|
|
3296
|
+
const result = item._zod.run({
|
|
3297
|
+
value: input[i],
|
|
3298
|
+
issues: []
|
|
3299
|
+
}, ctx);
|
|
3300
|
+
if (result instanceof Promise) {
|
|
3301
|
+
proms.push(result.then((result2) => handleTupleResult(result2, payload, i)));
|
|
3302
|
+
} else {
|
|
3303
|
+
handleTupleResult(result, payload, i);
|
|
3304
|
+
}
|
|
3305
|
+
}
|
|
3306
|
+
if (def.rest) {
|
|
3307
|
+
const rest = input.slice(items.length);
|
|
3308
|
+
for (const el of rest) {
|
|
3309
|
+
i++;
|
|
3310
|
+
const result = def.rest._zod.run({
|
|
3311
|
+
value: el,
|
|
3312
|
+
issues: []
|
|
3313
|
+
}, ctx);
|
|
3314
|
+
if (result instanceof Promise) {
|
|
3315
|
+
proms.push(result.then((result2) => handleTupleResult(result2, payload, i)));
|
|
3316
|
+
} else {
|
|
3317
|
+
handleTupleResult(result, payload, i);
|
|
3318
|
+
}
|
|
3319
|
+
}
|
|
3320
|
+
}
|
|
3321
|
+
if (proms.length)
|
|
3322
|
+
return Promise.all(proms).then(() => payload);
|
|
3323
|
+
return payload;
|
|
3324
|
+
};
|
|
3325
|
+
});
|
|
3326
|
+
function handleTupleResult(result, final, index) {
|
|
3327
|
+
if (result.issues.length) {
|
|
3328
|
+
final.issues.push(...prefixIssues(index, result.issues));
|
|
3329
|
+
}
|
|
3330
|
+
final.value[index] = result.value;
|
|
3331
|
+
}
|
|
3332
|
+
var $ZodRecord = /* @__PURE__ */ $constructor("$ZodRecord", (inst, def) => {
|
|
3333
|
+
$ZodType.init(inst, def);
|
|
3334
|
+
inst._zod.parse = (payload, ctx) => {
|
|
3335
|
+
const input = payload.value;
|
|
3336
|
+
if (!isPlainObject(input)) {
|
|
3337
|
+
payload.issues.push({
|
|
3338
|
+
expected: "record",
|
|
3339
|
+
code: "invalid_type",
|
|
3340
|
+
input,
|
|
3341
|
+
inst
|
|
3342
|
+
});
|
|
3343
|
+
return payload;
|
|
3344
|
+
}
|
|
3345
|
+
const proms = [];
|
|
3346
|
+
if (def.keyType._zod.values) {
|
|
3347
|
+
const values = def.keyType._zod.values;
|
|
3348
|
+
payload.value = {};
|
|
3349
|
+
for (const key of values) {
|
|
3350
|
+
if (typeof key === "string" || typeof key === "number" || typeof key === "symbol") {
|
|
3351
|
+
const result = def.valueType._zod.run({ value: input[key], issues: [] }, ctx);
|
|
3352
|
+
if (result instanceof Promise) {
|
|
3353
|
+
proms.push(result.then((result2) => {
|
|
3354
|
+
if (result2.issues.length) {
|
|
3355
|
+
payload.issues.push(...prefixIssues(key, result2.issues));
|
|
3356
|
+
}
|
|
3357
|
+
payload.value[key] = result2.value;
|
|
3358
|
+
}));
|
|
3359
|
+
} else {
|
|
3360
|
+
if (result.issues.length) {
|
|
3361
|
+
payload.issues.push(...prefixIssues(key, result.issues));
|
|
3362
|
+
}
|
|
3363
|
+
payload.value[key] = result.value;
|
|
3364
|
+
}
|
|
3365
|
+
}
|
|
3366
|
+
}
|
|
3367
|
+
let unrecognized;
|
|
3368
|
+
for (const key in input) {
|
|
3369
|
+
if (!values.has(key)) {
|
|
3370
|
+
unrecognized = unrecognized ?? [];
|
|
3371
|
+
unrecognized.push(key);
|
|
3372
|
+
}
|
|
3373
|
+
}
|
|
3374
|
+
if (unrecognized && unrecognized.length > 0) {
|
|
3375
|
+
payload.issues.push({
|
|
3376
|
+
code: "unrecognized_keys",
|
|
3377
|
+
input,
|
|
3378
|
+
inst,
|
|
3379
|
+
keys: unrecognized
|
|
3380
|
+
});
|
|
3381
|
+
}
|
|
3382
|
+
} else {
|
|
3383
|
+
payload.value = {};
|
|
3384
|
+
for (const key of Reflect.ownKeys(input)) {
|
|
3385
|
+
if (key === "__proto__")
|
|
3386
|
+
continue;
|
|
3387
|
+
const keyResult = def.keyType._zod.run({ value: key, issues: [] }, ctx);
|
|
3388
|
+
if (keyResult instanceof Promise) {
|
|
3389
|
+
throw new Error("Async schemas not supported in object keys currently");
|
|
3390
|
+
}
|
|
3391
|
+
if (keyResult.issues.length) {
|
|
3392
|
+
payload.issues.push({
|
|
3393
|
+
code: "invalid_key",
|
|
3394
|
+
origin: "record",
|
|
3395
|
+
issues: keyResult.issues.map((iss) => finalizeIssue(iss, ctx, config())),
|
|
3396
|
+
input: key,
|
|
3397
|
+
path: [key],
|
|
3398
|
+
inst
|
|
3399
|
+
});
|
|
3400
|
+
payload.value[keyResult.value] = keyResult.value;
|
|
3401
|
+
continue;
|
|
3402
|
+
}
|
|
3403
|
+
const result = def.valueType._zod.run({ value: input[key], issues: [] }, ctx);
|
|
3404
|
+
if (result instanceof Promise) {
|
|
3405
|
+
proms.push(result.then((result2) => {
|
|
3406
|
+
if (result2.issues.length) {
|
|
3407
|
+
payload.issues.push(...prefixIssues(key, result2.issues));
|
|
3408
|
+
}
|
|
3409
|
+
payload.value[keyResult.value] = result2.value;
|
|
3410
|
+
}));
|
|
3411
|
+
} else {
|
|
3412
|
+
if (result.issues.length) {
|
|
3413
|
+
payload.issues.push(...prefixIssues(key, result.issues));
|
|
3414
|
+
}
|
|
3415
|
+
payload.value[keyResult.value] = result.value;
|
|
3416
|
+
}
|
|
3417
|
+
}
|
|
3418
|
+
}
|
|
3419
|
+
if (proms.length) {
|
|
3420
|
+
return Promise.all(proms).then(() => payload);
|
|
3421
|
+
}
|
|
3422
|
+
return payload;
|
|
3423
|
+
};
|
|
3424
|
+
});
|
|
3425
|
+
var $ZodMap = /* @__PURE__ */ $constructor("$ZodMap", (inst, def) => {
|
|
3426
|
+
$ZodType.init(inst, def);
|
|
3427
|
+
inst._zod.parse = (payload, ctx) => {
|
|
3428
|
+
const input = payload.value;
|
|
3429
|
+
if (!(input instanceof Map)) {
|
|
3430
|
+
payload.issues.push({
|
|
3431
|
+
expected: "map",
|
|
3432
|
+
code: "invalid_type",
|
|
3433
|
+
input,
|
|
3434
|
+
inst
|
|
3435
|
+
});
|
|
3436
|
+
return payload;
|
|
3437
|
+
}
|
|
3438
|
+
const proms = [];
|
|
3439
|
+
payload.value = /* @__PURE__ */ new Map();
|
|
3440
|
+
for (const [key, value] of input) {
|
|
3441
|
+
const keyResult = def.keyType._zod.run({ value: key, issues: [] }, ctx);
|
|
3442
|
+
const valueResult = def.valueType._zod.run({ value, issues: [] }, ctx);
|
|
3443
|
+
if (keyResult instanceof Promise || valueResult instanceof Promise) {
|
|
3444
|
+
proms.push(Promise.all([keyResult, valueResult]).then(([keyResult2, valueResult2]) => {
|
|
3445
|
+
handleMapResult(keyResult2, valueResult2, payload, key, input, inst, ctx);
|
|
3446
|
+
}));
|
|
3447
|
+
} else {
|
|
3448
|
+
handleMapResult(keyResult, valueResult, payload, key, input, inst, ctx);
|
|
3449
|
+
}
|
|
3450
|
+
}
|
|
3451
|
+
if (proms.length)
|
|
3452
|
+
return Promise.all(proms).then(() => payload);
|
|
3453
|
+
return payload;
|
|
3454
|
+
};
|
|
3455
|
+
});
|
|
3456
|
+
function handleMapResult(keyResult, valueResult, final, key, input, inst, ctx) {
|
|
3457
|
+
if (keyResult.issues.length) {
|
|
3458
|
+
if (propertyKeyTypes.has(typeof key)) {
|
|
3459
|
+
final.issues.push(...prefixIssues(key, keyResult.issues));
|
|
3460
|
+
} else {
|
|
3461
|
+
final.issues.push({
|
|
3462
|
+
code: "invalid_key",
|
|
3463
|
+
origin: "map",
|
|
3464
|
+
input,
|
|
3465
|
+
inst,
|
|
3466
|
+
issues: keyResult.issues.map((iss) => finalizeIssue(iss, ctx, config()))
|
|
3467
|
+
});
|
|
3468
|
+
}
|
|
3469
|
+
}
|
|
3470
|
+
if (valueResult.issues.length) {
|
|
3471
|
+
if (propertyKeyTypes.has(typeof key)) {
|
|
3472
|
+
final.issues.push(...prefixIssues(key, valueResult.issues));
|
|
3473
|
+
} else {
|
|
3474
|
+
final.issues.push({
|
|
3475
|
+
origin: "map",
|
|
3476
|
+
code: "invalid_element",
|
|
3477
|
+
input,
|
|
3478
|
+
inst,
|
|
3479
|
+
key,
|
|
3480
|
+
issues: valueResult.issues.map((iss) => finalizeIssue(iss, ctx, config()))
|
|
3481
|
+
});
|
|
3482
|
+
}
|
|
3483
|
+
}
|
|
3484
|
+
final.value.set(keyResult.value, valueResult.value);
|
|
3485
|
+
}
|
|
3486
|
+
var $ZodSet = /* @__PURE__ */ $constructor("$ZodSet", (inst, def) => {
|
|
3487
|
+
$ZodType.init(inst, def);
|
|
3488
|
+
inst._zod.parse = (payload, ctx) => {
|
|
3489
|
+
const input = payload.value;
|
|
3490
|
+
if (!(input instanceof Set)) {
|
|
3491
|
+
payload.issues.push({
|
|
3492
|
+
input,
|
|
3493
|
+
inst,
|
|
3494
|
+
expected: "set",
|
|
3495
|
+
code: "invalid_type"
|
|
3496
|
+
});
|
|
3497
|
+
return payload;
|
|
3498
|
+
}
|
|
3499
|
+
const proms = [];
|
|
3500
|
+
payload.value = /* @__PURE__ */ new Set();
|
|
3501
|
+
for (const item of input) {
|
|
3502
|
+
const result = def.valueType._zod.run({ value: item, issues: [] }, ctx);
|
|
3503
|
+
if (result instanceof Promise) {
|
|
3504
|
+
proms.push(result.then((result2) => handleSetResult(result2, payload)));
|
|
3505
|
+
} else
|
|
3506
|
+
handleSetResult(result, payload);
|
|
3507
|
+
}
|
|
3508
|
+
if (proms.length)
|
|
3509
|
+
return Promise.all(proms).then(() => payload);
|
|
3510
|
+
return payload;
|
|
3511
|
+
};
|
|
3512
|
+
});
|
|
3513
|
+
function handleSetResult(result, final) {
|
|
3514
|
+
if (result.issues.length) {
|
|
3515
|
+
final.issues.push(...result.issues);
|
|
3516
|
+
}
|
|
3517
|
+
final.value.add(result.value);
|
|
3518
|
+
}
|
|
3519
|
+
var $ZodEnum = /* @__PURE__ */ $constructor("$ZodEnum", (inst, def) => {
|
|
3520
|
+
$ZodType.init(inst, def);
|
|
3521
|
+
const values = getEnumValues(def.entries);
|
|
3522
|
+
const valuesSet = new Set(values);
|
|
3523
|
+
inst._zod.values = valuesSet;
|
|
3524
|
+
inst._zod.pattern = new RegExp(`^(${values.filter((k) => propertyKeyTypes.has(typeof k)).map((o) => typeof o === "string" ? escapeRegex(o) : o.toString()).join("|")})$`);
|
|
3525
|
+
inst._zod.parse = (payload, _ctx) => {
|
|
3526
|
+
const input = payload.value;
|
|
3527
|
+
if (valuesSet.has(input)) {
|
|
3528
|
+
return payload;
|
|
3529
|
+
}
|
|
3530
|
+
payload.issues.push({
|
|
3531
|
+
code: "invalid_value",
|
|
3532
|
+
values,
|
|
3533
|
+
input,
|
|
3534
|
+
inst
|
|
3535
|
+
});
|
|
3536
|
+
return payload;
|
|
3537
|
+
};
|
|
3538
|
+
});
|
|
3539
|
+
var $ZodLiteral = /* @__PURE__ */ $constructor("$ZodLiteral", (inst, def) => {
|
|
3540
|
+
$ZodType.init(inst, def);
|
|
3541
|
+
if (def.values.length === 0) {
|
|
3542
|
+
throw new Error("Cannot create literal schema with no valid values");
|
|
3543
|
+
}
|
|
3544
|
+
inst._zod.values = new Set(def.values);
|
|
3545
|
+
inst._zod.pattern = new RegExp(`^(${def.values.map((o) => typeof o === "string" ? escapeRegex(o) : o ? escapeRegex(o.toString()) : String(o)).join("|")})$`);
|
|
3546
|
+
inst._zod.parse = (payload, _ctx) => {
|
|
3547
|
+
const input = payload.value;
|
|
3548
|
+
if (inst._zod.values.has(input)) {
|
|
3549
|
+
return payload;
|
|
3550
|
+
}
|
|
3551
|
+
payload.issues.push({
|
|
3552
|
+
code: "invalid_value",
|
|
3553
|
+
values: def.values,
|
|
3554
|
+
input,
|
|
3555
|
+
inst
|
|
3556
|
+
});
|
|
3557
|
+
return payload;
|
|
3558
|
+
};
|
|
3559
|
+
});
|
|
3560
|
+
var $ZodFile = /* @__PURE__ */ $constructor("$ZodFile", (inst, def) => {
|
|
3561
|
+
$ZodType.init(inst, def);
|
|
3562
|
+
inst._zod.parse = (payload, _ctx) => {
|
|
3563
|
+
const input = payload.value;
|
|
3564
|
+
if (input instanceof File)
|
|
3565
|
+
return payload;
|
|
3566
|
+
payload.issues.push({
|
|
3567
|
+
expected: "file",
|
|
3568
|
+
code: "invalid_type",
|
|
3569
|
+
input,
|
|
3570
|
+
inst
|
|
3571
|
+
});
|
|
3572
|
+
return payload;
|
|
3573
|
+
};
|
|
3574
|
+
});
|
|
2080
3575
|
var $ZodTransform = /* @__PURE__ */ $constructor("$ZodTransform", (inst, def) => {
|
|
2081
3576
|
$ZodType.init(inst, def);
|
|
2082
3577
|
inst._zod.parse = (payload, ctx) => {
|
|
@@ -2209,6 +3704,23 @@
|
|
|
2209
3704
|
}
|
|
2210
3705
|
return payload;
|
|
2211
3706
|
}
|
|
3707
|
+
var $ZodSuccess = /* @__PURE__ */ $constructor("$ZodSuccess", (inst, def) => {
|
|
3708
|
+
$ZodType.init(inst, def);
|
|
3709
|
+
inst._zod.parse = (payload, ctx) => {
|
|
3710
|
+
if (ctx.direction === "backward") {
|
|
3711
|
+
throw new $ZodEncodeError("ZodSuccess");
|
|
3712
|
+
}
|
|
3713
|
+
const result = def.innerType._zod.run(payload, ctx);
|
|
3714
|
+
if (result instanceof Promise) {
|
|
3715
|
+
return result.then((result2) => {
|
|
3716
|
+
payload.value = result2.issues.length === 0;
|
|
3717
|
+
return payload;
|
|
3718
|
+
});
|
|
3719
|
+
}
|
|
3720
|
+
payload.value = result.issues.length === 0;
|
|
3721
|
+
return payload;
|
|
3722
|
+
};
|
|
3723
|
+
});
|
|
2212
3724
|
var $ZodCatch = /* @__PURE__ */ $constructor("$ZodCatch", (inst, def) => {
|
|
2213
3725
|
$ZodType.init(inst, def);
|
|
2214
3726
|
defineLazy(inst._zod, "optin", () => def.innerType._zod.optin);
|
|
@@ -2249,6 +3761,21 @@
|
|
|
2249
3761
|
return payload;
|
|
2250
3762
|
};
|
|
2251
3763
|
});
|
|
3764
|
+
var $ZodNaN = /* @__PURE__ */ $constructor("$ZodNaN", (inst, def) => {
|
|
3765
|
+
$ZodType.init(inst, def);
|
|
3766
|
+
inst._zod.parse = (payload, _ctx) => {
|
|
3767
|
+
if (typeof payload.value !== "number" || !Number.isNaN(payload.value)) {
|
|
3768
|
+
payload.issues.push({
|
|
3769
|
+
input: payload.value,
|
|
3770
|
+
inst,
|
|
3771
|
+
expected: "nan",
|
|
3772
|
+
code: "invalid_type"
|
|
3773
|
+
});
|
|
3774
|
+
return payload;
|
|
3775
|
+
}
|
|
3776
|
+
return payload;
|
|
3777
|
+
};
|
|
3778
|
+
});
|
|
2252
3779
|
var $ZodPipe = /* @__PURE__ */ $constructor("$ZodPipe", (inst, def) => {
|
|
2253
3780
|
$ZodType.init(inst, def);
|
|
2254
3781
|
defineLazy(inst._zod, "values", () => def.in._zod.values);
|
|
@@ -2277,6 +3804,56 @@
|
|
|
2277
3804
|
}
|
|
2278
3805
|
return next._zod.run({ value: left.value, issues: left.issues }, ctx);
|
|
2279
3806
|
}
|
|
3807
|
+
var $ZodCodec = /* @__PURE__ */ $constructor("$ZodCodec", (inst, def) => {
|
|
3808
|
+
$ZodType.init(inst, def);
|
|
3809
|
+
defineLazy(inst._zod, "values", () => def.in._zod.values);
|
|
3810
|
+
defineLazy(inst._zod, "optin", () => def.in._zod.optin);
|
|
3811
|
+
defineLazy(inst._zod, "optout", () => def.out._zod.optout);
|
|
3812
|
+
defineLazy(inst._zod, "propValues", () => def.in._zod.propValues);
|
|
3813
|
+
inst._zod.parse = (payload, ctx) => {
|
|
3814
|
+
const direction = ctx.direction || "forward";
|
|
3815
|
+
if (direction === "forward") {
|
|
3816
|
+
const left = def.in._zod.run(payload, ctx);
|
|
3817
|
+
if (left instanceof Promise) {
|
|
3818
|
+
return left.then((left2) => handleCodecAResult(left2, def, ctx));
|
|
3819
|
+
}
|
|
3820
|
+
return handleCodecAResult(left, def, ctx);
|
|
3821
|
+
} else {
|
|
3822
|
+
const right = def.out._zod.run(payload, ctx);
|
|
3823
|
+
if (right instanceof Promise) {
|
|
3824
|
+
return right.then((right2) => handleCodecAResult(right2, def, ctx));
|
|
3825
|
+
}
|
|
3826
|
+
return handleCodecAResult(right, def, ctx);
|
|
3827
|
+
}
|
|
3828
|
+
};
|
|
3829
|
+
});
|
|
3830
|
+
function handleCodecAResult(result, def, ctx) {
|
|
3831
|
+
if (result.issues.length) {
|
|
3832
|
+
result.aborted = true;
|
|
3833
|
+
return result;
|
|
3834
|
+
}
|
|
3835
|
+
const direction = ctx.direction || "forward";
|
|
3836
|
+
if (direction === "forward") {
|
|
3837
|
+
const transformed = def.transform(result.value, result);
|
|
3838
|
+
if (transformed instanceof Promise) {
|
|
3839
|
+
return transformed.then((value) => handleCodecTxResult(result, value, def.out, ctx));
|
|
3840
|
+
}
|
|
3841
|
+
return handleCodecTxResult(result, transformed, def.out, ctx);
|
|
3842
|
+
} else {
|
|
3843
|
+
const transformed = def.reverseTransform(result.value, result);
|
|
3844
|
+
if (transformed instanceof Promise) {
|
|
3845
|
+
return transformed.then((value) => handleCodecTxResult(result, value, def.in, ctx));
|
|
3846
|
+
}
|
|
3847
|
+
return handleCodecTxResult(result, transformed, def.in, ctx);
|
|
3848
|
+
}
|
|
3849
|
+
}
|
|
3850
|
+
function handleCodecTxResult(left, value, nextSchema, ctx) {
|
|
3851
|
+
if (left.issues.length) {
|
|
3852
|
+
left.aborted = true;
|
|
3853
|
+
return left;
|
|
3854
|
+
}
|
|
3855
|
+
return nextSchema._zod.run({ value, issues: left.issues }, ctx);
|
|
3856
|
+
}
|
|
2280
3857
|
var $ZodReadonly = /* @__PURE__ */ $constructor("$ZodReadonly", (inst, def) => {
|
|
2281
3858
|
$ZodType.init(inst, def);
|
|
2282
3859
|
defineLazy(inst._zod, "propValues", () => def.innerType._zod.propValues);
|
|
@@ -2298,6 +3875,146 @@
|
|
|
2298
3875
|
payload.value = Object.freeze(payload.value);
|
|
2299
3876
|
return payload;
|
|
2300
3877
|
}
|
|
3878
|
+
var $ZodTemplateLiteral = /* @__PURE__ */ $constructor("$ZodTemplateLiteral", (inst, def) => {
|
|
3879
|
+
$ZodType.init(inst, def);
|
|
3880
|
+
const regexParts = [];
|
|
3881
|
+
for (const part of def.parts) {
|
|
3882
|
+
if (typeof part === "object" && part !== null) {
|
|
3883
|
+
if (!part._zod.pattern) {
|
|
3884
|
+
throw new Error(`Invalid template literal part, no pattern found: ${[...part._zod.traits].shift()}`);
|
|
3885
|
+
}
|
|
3886
|
+
const source = part._zod.pattern instanceof RegExp ? part._zod.pattern.source : part._zod.pattern;
|
|
3887
|
+
if (!source)
|
|
3888
|
+
throw new Error(`Invalid template literal part: ${part._zod.traits}`);
|
|
3889
|
+
const start = source.startsWith("^") ? 1 : 0;
|
|
3890
|
+
const end = source.endsWith("$") ? source.length - 1 : source.length;
|
|
3891
|
+
regexParts.push(source.slice(start, end));
|
|
3892
|
+
} else if (part === null || primitiveTypes.has(typeof part)) {
|
|
3893
|
+
regexParts.push(escapeRegex(`${part}`));
|
|
3894
|
+
} else {
|
|
3895
|
+
throw new Error(`Invalid template literal part: ${part}`);
|
|
3896
|
+
}
|
|
3897
|
+
}
|
|
3898
|
+
inst._zod.pattern = new RegExp(`^${regexParts.join("")}$`);
|
|
3899
|
+
inst._zod.parse = (payload, _ctx) => {
|
|
3900
|
+
if (typeof payload.value !== "string") {
|
|
3901
|
+
payload.issues.push({
|
|
3902
|
+
input: payload.value,
|
|
3903
|
+
inst,
|
|
3904
|
+
expected: "template_literal",
|
|
3905
|
+
code: "invalid_type"
|
|
3906
|
+
});
|
|
3907
|
+
return payload;
|
|
3908
|
+
}
|
|
3909
|
+
inst._zod.pattern.lastIndex = 0;
|
|
3910
|
+
if (!inst._zod.pattern.test(payload.value)) {
|
|
3911
|
+
payload.issues.push({
|
|
3912
|
+
input: payload.value,
|
|
3913
|
+
inst,
|
|
3914
|
+
code: "invalid_format",
|
|
3915
|
+
format: def.format ?? "template_literal",
|
|
3916
|
+
pattern: inst._zod.pattern.source
|
|
3917
|
+
});
|
|
3918
|
+
return payload;
|
|
3919
|
+
}
|
|
3920
|
+
return payload;
|
|
3921
|
+
};
|
|
3922
|
+
});
|
|
3923
|
+
var $ZodFunction = /* @__PURE__ */ $constructor("$ZodFunction", (inst, def) => {
|
|
3924
|
+
$ZodType.init(inst, def);
|
|
3925
|
+
inst._def = def;
|
|
3926
|
+
inst._zod.def = def;
|
|
3927
|
+
inst.implement = (func) => {
|
|
3928
|
+
if (typeof func !== "function") {
|
|
3929
|
+
throw new Error("implement() must be called with a function");
|
|
3930
|
+
}
|
|
3931
|
+
return function(...args) {
|
|
3932
|
+
const parsedArgs = inst._def.input ? parse(inst._def.input, args) : args;
|
|
3933
|
+
const result = Reflect.apply(func, this, parsedArgs);
|
|
3934
|
+
if (inst._def.output) {
|
|
3935
|
+
return parse(inst._def.output, result);
|
|
3936
|
+
}
|
|
3937
|
+
return result;
|
|
3938
|
+
};
|
|
3939
|
+
};
|
|
3940
|
+
inst.implementAsync = (func) => {
|
|
3941
|
+
if (typeof func !== "function") {
|
|
3942
|
+
throw new Error("implementAsync() must be called with a function");
|
|
3943
|
+
}
|
|
3944
|
+
return async function(...args) {
|
|
3945
|
+
const parsedArgs = inst._def.input ? await parseAsync(inst._def.input, args) : args;
|
|
3946
|
+
const result = await Reflect.apply(func, this, parsedArgs);
|
|
3947
|
+
if (inst._def.output) {
|
|
3948
|
+
return await parseAsync(inst._def.output, result);
|
|
3949
|
+
}
|
|
3950
|
+
return result;
|
|
3951
|
+
};
|
|
3952
|
+
};
|
|
3953
|
+
inst._zod.parse = (payload, _ctx) => {
|
|
3954
|
+
if (typeof payload.value !== "function") {
|
|
3955
|
+
payload.issues.push({
|
|
3956
|
+
code: "invalid_type",
|
|
3957
|
+
expected: "function",
|
|
3958
|
+
input: payload.value,
|
|
3959
|
+
inst
|
|
3960
|
+
});
|
|
3961
|
+
return payload;
|
|
3962
|
+
}
|
|
3963
|
+
const hasPromiseOutput = inst._def.output && inst._def.output._zod.def.type === "promise";
|
|
3964
|
+
if (hasPromiseOutput) {
|
|
3965
|
+
payload.value = inst.implementAsync(payload.value);
|
|
3966
|
+
} else {
|
|
3967
|
+
payload.value = inst.implement(payload.value);
|
|
3968
|
+
}
|
|
3969
|
+
return payload;
|
|
3970
|
+
};
|
|
3971
|
+
inst.input = (...args) => {
|
|
3972
|
+
const F = inst.constructor;
|
|
3973
|
+
if (Array.isArray(args[0])) {
|
|
3974
|
+
return new F({
|
|
3975
|
+
type: "function",
|
|
3976
|
+
input: new $ZodTuple({
|
|
3977
|
+
type: "tuple",
|
|
3978
|
+
items: args[0],
|
|
3979
|
+
rest: args[1]
|
|
3980
|
+
}),
|
|
3981
|
+
output: inst._def.output
|
|
3982
|
+
});
|
|
3983
|
+
}
|
|
3984
|
+
return new F({
|
|
3985
|
+
type: "function",
|
|
3986
|
+
input: args[0],
|
|
3987
|
+
output: inst._def.output
|
|
3988
|
+
});
|
|
3989
|
+
};
|
|
3990
|
+
inst.output = (output) => {
|
|
3991
|
+
const F = inst.constructor;
|
|
3992
|
+
return new F({
|
|
3993
|
+
type: "function",
|
|
3994
|
+
input: inst._def.input,
|
|
3995
|
+
output
|
|
3996
|
+
});
|
|
3997
|
+
};
|
|
3998
|
+
return inst;
|
|
3999
|
+
});
|
|
4000
|
+
var $ZodPromise = /* @__PURE__ */ $constructor("$ZodPromise", (inst, def) => {
|
|
4001
|
+
$ZodType.init(inst, def);
|
|
4002
|
+
inst._zod.parse = (payload, ctx) => {
|
|
4003
|
+
return Promise.resolve(payload.value).then((inner) => def.innerType._zod.run({ value: inner, issues: [] }, ctx));
|
|
4004
|
+
};
|
|
4005
|
+
});
|
|
4006
|
+
var $ZodLazy = /* @__PURE__ */ $constructor("$ZodLazy", (inst, def) => {
|
|
4007
|
+
$ZodType.init(inst, def);
|
|
4008
|
+
defineLazy(inst._zod, "innerType", () => def.getter());
|
|
4009
|
+
defineLazy(inst._zod, "pattern", () => inst._zod.innerType._zod.pattern);
|
|
4010
|
+
defineLazy(inst._zod, "propValues", () => inst._zod.innerType._zod.propValues);
|
|
4011
|
+
defineLazy(inst._zod, "optin", () => inst._zod.innerType._zod.optin ?? void 0);
|
|
4012
|
+
defineLazy(inst._zod, "optout", () => inst._zod.innerType._zod.optout ?? void 0);
|
|
4013
|
+
inst._zod.parse = (payload, ctx) => {
|
|
4014
|
+
const inner = inst._zod.innerType;
|
|
4015
|
+
return inner._zod.run(payload, ctx);
|
|
4016
|
+
};
|
|
4017
|
+
});
|
|
2301
4018
|
var $ZodCustom = /* @__PURE__ */ $constructor("$ZodCustom", (inst, def) => {
|
|
2302
4019
|
$ZodCheck.init(inst, def);
|
|
2303
4020
|
$ZodType.init(inst, def);
|
|
@@ -5409,8 +7126,8 @@
|
|
|
5409
7126
|
var capitalizeFirstCharacter = (text) => {
|
|
5410
7127
|
return text.charAt(0).toUpperCase() + text.slice(1);
|
|
5411
7128
|
};
|
|
5412
|
-
function getUnitTypeFromNumber(
|
|
5413
|
-
const abs = Math.abs(
|
|
7129
|
+
function getUnitTypeFromNumber(number4) {
|
|
7130
|
+
const abs = Math.abs(number4);
|
|
5414
7131
|
const last = abs % 10;
|
|
5415
7132
|
const last2 = abs % 100;
|
|
5416
7133
|
if (last2 >= 11 && last2 <= 19 || last === 0)
|
|
@@ -8057,6 +9774,13 @@
|
|
|
8057
9774
|
...normalizeParams(params)
|
|
8058
9775
|
});
|
|
8059
9776
|
}
|
|
9777
|
+
function _coercedString(Class2, params) {
|
|
9778
|
+
return new Class2({
|
|
9779
|
+
type: "string",
|
|
9780
|
+
coerce: true,
|
|
9781
|
+
...normalizeParams(params)
|
|
9782
|
+
});
|
|
9783
|
+
}
|
|
8060
9784
|
function _email(Class2, params) {
|
|
8061
9785
|
return new Class2({
|
|
8062
9786
|
type: "string",
|
|
@@ -8258,6 +9982,13 @@
|
|
|
8258
9982
|
...normalizeParams(params)
|
|
8259
9983
|
});
|
|
8260
9984
|
}
|
|
9985
|
+
var TimePrecision = {
|
|
9986
|
+
Any: null,
|
|
9987
|
+
Minute: -1,
|
|
9988
|
+
Second: 0,
|
|
9989
|
+
Millisecond: 3,
|
|
9990
|
+
Microsecond: 6
|
|
9991
|
+
};
|
|
8261
9992
|
function _isoDateTime(Class2, params) {
|
|
8262
9993
|
return new Class2({
|
|
8263
9994
|
type: "string",
|
|
@@ -8301,6 +10032,14 @@
|
|
|
8301
10032
|
...normalizeParams(params)
|
|
8302
10033
|
});
|
|
8303
10034
|
}
|
|
10035
|
+
function _coercedNumber(Class2, params) {
|
|
10036
|
+
return new Class2({
|
|
10037
|
+
type: "number",
|
|
10038
|
+
coerce: true,
|
|
10039
|
+
checks: [],
|
|
10040
|
+
...normalizeParams(params)
|
|
10041
|
+
});
|
|
10042
|
+
}
|
|
8304
10043
|
function _int(Class2, params) {
|
|
8305
10044
|
return new Class2({
|
|
8306
10045
|
type: "number",
|
|
@@ -8310,12 +10049,145 @@
|
|
|
8310
10049
|
...normalizeParams(params)
|
|
8311
10050
|
});
|
|
8312
10051
|
}
|
|
10052
|
+
function _float32(Class2, params) {
|
|
10053
|
+
return new Class2({
|
|
10054
|
+
type: "number",
|
|
10055
|
+
check: "number_format",
|
|
10056
|
+
abort: false,
|
|
10057
|
+
format: "float32",
|
|
10058
|
+
...normalizeParams(params)
|
|
10059
|
+
});
|
|
10060
|
+
}
|
|
10061
|
+
function _float64(Class2, params) {
|
|
10062
|
+
return new Class2({
|
|
10063
|
+
type: "number",
|
|
10064
|
+
check: "number_format",
|
|
10065
|
+
abort: false,
|
|
10066
|
+
format: "float64",
|
|
10067
|
+
...normalizeParams(params)
|
|
10068
|
+
});
|
|
10069
|
+
}
|
|
10070
|
+
function _int32(Class2, params) {
|
|
10071
|
+
return new Class2({
|
|
10072
|
+
type: "number",
|
|
10073
|
+
check: "number_format",
|
|
10074
|
+
abort: false,
|
|
10075
|
+
format: "int32",
|
|
10076
|
+
...normalizeParams(params)
|
|
10077
|
+
});
|
|
10078
|
+
}
|
|
10079
|
+
function _uint32(Class2, params) {
|
|
10080
|
+
return new Class2({
|
|
10081
|
+
type: "number",
|
|
10082
|
+
check: "number_format",
|
|
10083
|
+
abort: false,
|
|
10084
|
+
format: "uint32",
|
|
10085
|
+
...normalizeParams(params)
|
|
10086
|
+
});
|
|
10087
|
+
}
|
|
10088
|
+
function _boolean(Class2, params) {
|
|
10089
|
+
return new Class2({
|
|
10090
|
+
type: "boolean",
|
|
10091
|
+
...normalizeParams(params)
|
|
10092
|
+
});
|
|
10093
|
+
}
|
|
10094
|
+
function _coercedBoolean(Class2, params) {
|
|
10095
|
+
return new Class2({
|
|
10096
|
+
type: "boolean",
|
|
10097
|
+
coerce: true,
|
|
10098
|
+
...normalizeParams(params)
|
|
10099
|
+
});
|
|
10100
|
+
}
|
|
8313
10101
|
function _bigint(Class2, params) {
|
|
8314
10102
|
return new Class2({
|
|
8315
10103
|
type: "bigint",
|
|
8316
10104
|
...normalizeParams(params)
|
|
8317
10105
|
});
|
|
8318
10106
|
}
|
|
10107
|
+
function _coercedBigint(Class2, params) {
|
|
10108
|
+
return new Class2({
|
|
10109
|
+
type: "bigint",
|
|
10110
|
+
coerce: true,
|
|
10111
|
+
...normalizeParams(params)
|
|
10112
|
+
});
|
|
10113
|
+
}
|
|
10114
|
+
function _int64(Class2, params) {
|
|
10115
|
+
return new Class2({
|
|
10116
|
+
type: "bigint",
|
|
10117
|
+
check: "bigint_format",
|
|
10118
|
+
abort: false,
|
|
10119
|
+
format: "int64",
|
|
10120
|
+
...normalizeParams(params)
|
|
10121
|
+
});
|
|
10122
|
+
}
|
|
10123
|
+
function _uint64(Class2, params) {
|
|
10124
|
+
return new Class2({
|
|
10125
|
+
type: "bigint",
|
|
10126
|
+
check: "bigint_format",
|
|
10127
|
+
abort: false,
|
|
10128
|
+
format: "uint64",
|
|
10129
|
+
...normalizeParams(params)
|
|
10130
|
+
});
|
|
10131
|
+
}
|
|
10132
|
+
function _symbol(Class2, params) {
|
|
10133
|
+
return new Class2({
|
|
10134
|
+
type: "symbol",
|
|
10135
|
+
...normalizeParams(params)
|
|
10136
|
+
});
|
|
10137
|
+
}
|
|
10138
|
+
function _undefined2(Class2, params) {
|
|
10139
|
+
return new Class2({
|
|
10140
|
+
type: "undefined",
|
|
10141
|
+
...normalizeParams(params)
|
|
10142
|
+
});
|
|
10143
|
+
}
|
|
10144
|
+
function _null2(Class2, params) {
|
|
10145
|
+
return new Class2({
|
|
10146
|
+
type: "null",
|
|
10147
|
+
...normalizeParams(params)
|
|
10148
|
+
});
|
|
10149
|
+
}
|
|
10150
|
+
function _any(Class2) {
|
|
10151
|
+
return new Class2({
|
|
10152
|
+
type: "any"
|
|
10153
|
+
});
|
|
10154
|
+
}
|
|
10155
|
+
function _unknown(Class2) {
|
|
10156
|
+
return new Class2({
|
|
10157
|
+
type: "unknown"
|
|
10158
|
+
});
|
|
10159
|
+
}
|
|
10160
|
+
function _never(Class2, params) {
|
|
10161
|
+
return new Class2({
|
|
10162
|
+
type: "never",
|
|
10163
|
+
...normalizeParams(params)
|
|
10164
|
+
});
|
|
10165
|
+
}
|
|
10166
|
+
function _void(Class2, params) {
|
|
10167
|
+
return new Class2({
|
|
10168
|
+
type: "void",
|
|
10169
|
+
...normalizeParams(params)
|
|
10170
|
+
});
|
|
10171
|
+
}
|
|
10172
|
+
function _date(Class2, params) {
|
|
10173
|
+
return new Class2({
|
|
10174
|
+
type: "date",
|
|
10175
|
+
...normalizeParams(params)
|
|
10176
|
+
});
|
|
10177
|
+
}
|
|
10178
|
+
function _coercedDate(Class2, params) {
|
|
10179
|
+
return new Class2({
|
|
10180
|
+
type: "date",
|
|
10181
|
+
coerce: true,
|
|
10182
|
+
...normalizeParams(params)
|
|
10183
|
+
});
|
|
10184
|
+
}
|
|
10185
|
+
function _nan(Class2, params) {
|
|
10186
|
+
return new Class2({
|
|
10187
|
+
type: "nan",
|
|
10188
|
+
...normalizeParams(params)
|
|
10189
|
+
});
|
|
10190
|
+
}
|
|
8319
10191
|
function _lt(value, params) {
|
|
8320
10192
|
return new $ZodCheckLessThan({
|
|
8321
10193
|
check: "less_than",
|
|
@@ -8344,15 +10216,48 @@
|
|
|
8344
10216
|
return new $ZodCheckGreaterThan({
|
|
8345
10217
|
check: "greater_than",
|
|
8346
10218
|
...normalizeParams(params),
|
|
8347
|
-
value,
|
|
8348
|
-
inclusive: true
|
|
10219
|
+
value,
|
|
10220
|
+
inclusive: true
|
|
10221
|
+
});
|
|
10222
|
+
}
|
|
10223
|
+
function _positive(params) {
|
|
10224
|
+
return _gt(0, params);
|
|
10225
|
+
}
|
|
10226
|
+
function _negative(params) {
|
|
10227
|
+
return _lt(0, params);
|
|
10228
|
+
}
|
|
10229
|
+
function _nonpositive(params) {
|
|
10230
|
+
return _lte(0, params);
|
|
10231
|
+
}
|
|
10232
|
+
function _nonnegative(params) {
|
|
10233
|
+
return _gte(0, params);
|
|
10234
|
+
}
|
|
10235
|
+
function _multipleOf(value, params) {
|
|
10236
|
+
return new $ZodCheckMultipleOf({
|
|
10237
|
+
check: "multiple_of",
|
|
10238
|
+
...normalizeParams(params),
|
|
10239
|
+
value
|
|
10240
|
+
});
|
|
10241
|
+
}
|
|
10242
|
+
function _maxSize(maximum, params) {
|
|
10243
|
+
return new $ZodCheckMaxSize({
|
|
10244
|
+
check: "max_size",
|
|
10245
|
+
...normalizeParams(params),
|
|
10246
|
+
maximum
|
|
10247
|
+
});
|
|
10248
|
+
}
|
|
10249
|
+
function _minSize(minimum, params) {
|
|
10250
|
+
return new $ZodCheckMinSize({
|
|
10251
|
+
check: "min_size",
|
|
10252
|
+
...normalizeParams(params),
|
|
10253
|
+
minimum
|
|
8349
10254
|
});
|
|
8350
10255
|
}
|
|
8351
|
-
function
|
|
8352
|
-
return new $
|
|
8353
|
-
check: "
|
|
10256
|
+
function _size(size, params) {
|
|
10257
|
+
return new $ZodCheckSizeEquals({
|
|
10258
|
+
check: "size_equals",
|
|
8354
10259
|
...normalizeParams(params),
|
|
8355
|
-
|
|
10260
|
+
size
|
|
8356
10261
|
});
|
|
8357
10262
|
}
|
|
8358
10263
|
function _maxLength(maximum, params) {
|
|
@@ -8423,6 +10328,21 @@
|
|
|
8423
10328
|
suffix
|
|
8424
10329
|
});
|
|
8425
10330
|
}
|
|
10331
|
+
function _property(property, schema, params) {
|
|
10332
|
+
return new $ZodCheckProperty({
|
|
10333
|
+
check: "property",
|
|
10334
|
+
property,
|
|
10335
|
+
schema,
|
|
10336
|
+
...normalizeParams(params)
|
|
10337
|
+
});
|
|
10338
|
+
}
|
|
10339
|
+
function _mime(types, params) {
|
|
10340
|
+
return new $ZodCheckMimeType({
|
|
10341
|
+
check: "mime_type",
|
|
10342
|
+
mime: types,
|
|
10343
|
+
...normalizeParams(params)
|
|
10344
|
+
});
|
|
10345
|
+
}
|
|
8426
10346
|
function _overwrite(tx) {
|
|
8427
10347
|
return new $ZodCheckOverwrite({
|
|
8428
10348
|
check: "overwrite",
|
|
@@ -8451,6 +10371,180 @@
|
|
|
8451
10371
|
...normalizeParams(params)
|
|
8452
10372
|
});
|
|
8453
10373
|
}
|
|
10374
|
+
function _union(Class2, options, params) {
|
|
10375
|
+
return new Class2({
|
|
10376
|
+
type: "union",
|
|
10377
|
+
options,
|
|
10378
|
+
...normalizeParams(params)
|
|
10379
|
+
});
|
|
10380
|
+
}
|
|
10381
|
+
function _discriminatedUnion(Class2, discriminator, options, params) {
|
|
10382
|
+
return new Class2({
|
|
10383
|
+
type: "union",
|
|
10384
|
+
options,
|
|
10385
|
+
discriminator,
|
|
10386
|
+
...normalizeParams(params)
|
|
10387
|
+
});
|
|
10388
|
+
}
|
|
10389
|
+
function _intersection(Class2, left, right) {
|
|
10390
|
+
return new Class2({
|
|
10391
|
+
type: "intersection",
|
|
10392
|
+
left,
|
|
10393
|
+
right
|
|
10394
|
+
});
|
|
10395
|
+
}
|
|
10396
|
+
function _tuple(Class2, items, _paramsOrRest, _params) {
|
|
10397
|
+
const hasRest = _paramsOrRest instanceof $ZodType;
|
|
10398
|
+
const params = hasRest ? _params : _paramsOrRest;
|
|
10399
|
+
const rest = hasRest ? _paramsOrRest : null;
|
|
10400
|
+
return new Class2({
|
|
10401
|
+
type: "tuple",
|
|
10402
|
+
items,
|
|
10403
|
+
rest,
|
|
10404
|
+
...normalizeParams(params)
|
|
10405
|
+
});
|
|
10406
|
+
}
|
|
10407
|
+
function _record(Class2, keyType, valueType, params) {
|
|
10408
|
+
return new Class2({
|
|
10409
|
+
type: "record",
|
|
10410
|
+
keyType,
|
|
10411
|
+
valueType,
|
|
10412
|
+
...normalizeParams(params)
|
|
10413
|
+
});
|
|
10414
|
+
}
|
|
10415
|
+
function _map(Class2, keyType, valueType, params) {
|
|
10416
|
+
return new Class2({
|
|
10417
|
+
type: "map",
|
|
10418
|
+
keyType,
|
|
10419
|
+
valueType,
|
|
10420
|
+
...normalizeParams(params)
|
|
10421
|
+
});
|
|
10422
|
+
}
|
|
10423
|
+
function _set(Class2, valueType, params) {
|
|
10424
|
+
return new Class2({
|
|
10425
|
+
type: "set",
|
|
10426
|
+
valueType,
|
|
10427
|
+
...normalizeParams(params)
|
|
10428
|
+
});
|
|
10429
|
+
}
|
|
10430
|
+
function _enum(Class2, values, params) {
|
|
10431
|
+
const entries = Array.isArray(values) ? Object.fromEntries(values.map((v) => [v, v])) : values;
|
|
10432
|
+
return new Class2({
|
|
10433
|
+
type: "enum",
|
|
10434
|
+
entries,
|
|
10435
|
+
...normalizeParams(params)
|
|
10436
|
+
});
|
|
10437
|
+
}
|
|
10438
|
+
function _nativeEnum(Class2, entries, params) {
|
|
10439
|
+
return new Class2({
|
|
10440
|
+
type: "enum",
|
|
10441
|
+
entries,
|
|
10442
|
+
...normalizeParams(params)
|
|
10443
|
+
});
|
|
10444
|
+
}
|
|
10445
|
+
function _literal(Class2, value, params) {
|
|
10446
|
+
return new Class2({
|
|
10447
|
+
type: "literal",
|
|
10448
|
+
values: Array.isArray(value) ? value : [value],
|
|
10449
|
+
...normalizeParams(params)
|
|
10450
|
+
});
|
|
10451
|
+
}
|
|
10452
|
+
function _file(Class2, params) {
|
|
10453
|
+
return new Class2({
|
|
10454
|
+
type: "file",
|
|
10455
|
+
...normalizeParams(params)
|
|
10456
|
+
});
|
|
10457
|
+
}
|
|
10458
|
+
function _transform(Class2, fn) {
|
|
10459
|
+
return new Class2({
|
|
10460
|
+
type: "transform",
|
|
10461
|
+
transform: fn
|
|
10462
|
+
});
|
|
10463
|
+
}
|
|
10464
|
+
function _optional(Class2, innerType) {
|
|
10465
|
+
return new Class2({
|
|
10466
|
+
type: "optional",
|
|
10467
|
+
innerType
|
|
10468
|
+
});
|
|
10469
|
+
}
|
|
10470
|
+
function _nullable(Class2, innerType) {
|
|
10471
|
+
return new Class2({
|
|
10472
|
+
type: "nullable",
|
|
10473
|
+
innerType
|
|
10474
|
+
});
|
|
10475
|
+
}
|
|
10476
|
+
function _default(Class2, innerType, defaultValue) {
|
|
10477
|
+
return new Class2({
|
|
10478
|
+
type: "default",
|
|
10479
|
+
innerType,
|
|
10480
|
+
get defaultValue() {
|
|
10481
|
+
return typeof defaultValue === "function" ? defaultValue() : shallowClone(defaultValue);
|
|
10482
|
+
}
|
|
10483
|
+
});
|
|
10484
|
+
}
|
|
10485
|
+
function _nonoptional(Class2, innerType, params) {
|
|
10486
|
+
return new Class2({
|
|
10487
|
+
type: "nonoptional",
|
|
10488
|
+
innerType,
|
|
10489
|
+
...normalizeParams(params)
|
|
10490
|
+
});
|
|
10491
|
+
}
|
|
10492
|
+
function _success(Class2, innerType) {
|
|
10493
|
+
return new Class2({
|
|
10494
|
+
type: "success",
|
|
10495
|
+
innerType
|
|
10496
|
+
});
|
|
10497
|
+
}
|
|
10498
|
+
function _catch(Class2, innerType, catchValue) {
|
|
10499
|
+
return new Class2({
|
|
10500
|
+
type: "catch",
|
|
10501
|
+
innerType,
|
|
10502
|
+
catchValue: typeof catchValue === "function" ? catchValue : () => catchValue
|
|
10503
|
+
});
|
|
10504
|
+
}
|
|
10505
|
+
function _pipe(Class2, in_, out) {
|
|
10506
|
+
return new Class2({
|
|
10507
|
+
type: "pipe",
|
|
10508
|
+
in: in_,
|
|
10509
|
+
out
|
|
10510
|
+
});
|
|
10511
|
+
}
|
|
10512
|
+
function _readonly(Class2, innerType) {
|
|
10513
|
+
return new Class2({
|
|
10514
|
+
type: "readonly",
|
|
10515
|
+
innerType
|
|
10516
|
+
});
|
|
10517
|
+
}
|
|
10518
|
+
function _templateLiteral(Class2, parts, params) {
|
|
10519
|
+
return new Class2({
|
|
10520
|
+
type: "template_literal",
|
|
10521
|
+
parts,
|
|
10522
|
+
...normalizeParams(params)
|
|
10523
|
+
});
|
|
10524
|
+
}
|
|
10525
|
+
function _lazy(Class2, getter) {
|
|
10526
|
+
return new Class2({
|
|
10527
|
+
type: "lazy",
|
|
10528
|
+
getter
|
|
10529
|
+
});
|
|
10530
|
+
}
|
|
10531
|
+
function _promise(Class2, innerType) {
|
|
10532
|
+
return new Class2({
|
|
10533
|
+
type: "promise",
|
|
10534
|
+
innerType
|
|
10535
|
+
});
|
|
10536
|
+
}
|
|
10537
|
+
function _custom(Class2, fn, _params) {
|
|
10538
|
+
const norm = normalizeParams(_params);
|
|
10539
|
+
norm.abort ?? (norm.abort = true);
|
|
10540
|
+
const schema = new Class2({
|
|
10541
|
+
type: "custom",
|
|
10542
|
+
check: "custom",
|
|
10543
|
+
fn,
|
|
10544
|
+
...norm
|
|
10545
|
+
});
|
|
10546
|
+
return schema;
|
|
10547
|
+
}
|
|
8454
10548
|
function _refine(Class2, fn, _params) {
|
|
8455
10549
|
const schema = new Class2({
|
|
8456
10550
|
type: "custom",
|
|
@@ -8476,23 +10570,920 @@
|
|
|
8476
10570
|
payload.issues.push(issue(_issue));
|
|
8477
10571
|
}
|
|
8478
10572
|
};
|
|
8479
|
-
return fn(payload.value, payload);
|
|
8480
|
-
});
|
|
8481
|
-
return ch;
|
|
10573
|
+
return fn(payload.value, payload);
|
|
10574
|
+
});
|
|
10575
|
+
return ch;
|
|
10576
|
+
}
|
|
10577
|
+
function _check(fn, params) {
|
|
10578
|
+
const ch = new $ZodCheck({
|
|
10579
|
+
check: "custom",
|
|
10580
|
+
...normalizeParams(params)
|
|
10581
|
+
});
|
|
10582
|
+
ch._zod.check = fn;
|
|
10583
|
+
return ch;
|
|
10584
|
+
}
|
|
10585
|
+
function _stringbool(Classes, _params) {
|
|
10586
|
+
const params = normalizeParams(_params);
|
|
10587
|
+
let truthyArray = params.truthy ?? ["true", "1", "yes", "on", "y", "enabled"];
|
|
10588
|
+
let falsyArray = params.falsy ?? ["false", "0", "no", "off", "n", "disabled"];
|
|
10589
|
+
if (params.case !== "sensitive") {
|
|
10590
|
+
truthyArray = truthyArray.map((v) => typeof v === "string" ? v.toLowerCase() : v);
|
|
10591
|
+
falsyArray = falsyArray.map((v) => typeof v === "string" ? v.toLowerCase() : v);
|
|
10592
|
+
}
|
|
10593
|
+
const truthySet = new Set(truthyArray);
|
|
10594
|
+
const falsySet = new Set(falsyArray);
|
|
10595
|
+
const _Codec = Classes.Codec ?? $ZodCodec;
|
|
10596
|
+
const _Boolean = Classes.Boolean ?? $ZodBoolean;
|
|
10597
|
+
const _String = Classes.String ?? $ZodString;
|
|
10598
|
+
const stringSchema = new _String({ type: "string", error: params.error });
|
|
10599
|
+
const booleanSchema = new _Boolean({ type: "boolean", error: params.error });
|
|
10600
|
+
const codec2 = new _Codec({
|
|
10601
|
+
type: "pipe",
|
|
10602
|
+
in: stringSchema,
|
|
10603
|
+
out: booleanSchema,
|
|
10604
|
+
transform: ((input, payload) => {
|
|
10605
|
+
let data = input;
|
|
10606
|
+
if (params.case !== "sensitive")
|
|
10607
|
+
data = data.toLowerCase();
|
|
10608
|
+
if (truthySet.has(data)) {
|
|
10609
|
+
return true;
|
|
10610
|
+
} else if (falsySet.has(data)) {
|
|
10611
|
+
return false;
|
|
10612
|
+
} else {
|
|
10613
|
+
payload.issues.push({
|
|
10614
|
+
code: "invalid_value",
|
|
10615
|
+
expected: "stringbool",
|
|
10616
|
+
values: [...truthySet, ...falsySet],
|
|
10617
|
+
input: payload.value,
|
|
10618
|
+
inst: codec2,
|
|
10619
|
+
continue: false
|
|
10620
|
+
});
|
|
10621
|
+
return {};
|
|
10622
|
+
}
|
|
10623
|
+
}),
|
|
10624
|
+
reverseTransform: ((input, _payload) => {
|
|
10625
|
+
if (input === true) {
|
|
10626
|
+
return truthyArray[0] || "true";
|
|
10627
|
+
} else {
|
|
10628
|
+
return falsyArray[0] || "false";
|
|
10629
|
+
}
|
|
10630
|
+
}),
|
|
10631
|
+
error: params.error
|
|
10632
|
+
});
|
|
10633
|
+
return codec2;
|
|
10634
|
+
}
|
|
10635
|
+
function _stringFormat(Class2, format, fnOrRegex, _params = {}) {
|
|
10636
|
+
const params = normalizeParams(_params);
|
|
10637
|
+
const def = {
|
|
10638
|
+
...normalizeParams(_params),
|
|
10639
|
+
check: "string_format",
|
|
10640
|
+
type: "string",
|
|
10641
|
+
format,
|
|
10642
|
+
fn: typeof fnOrRegex === "function" ? fnOrRegex : (val) => fnOrRegex.test(val),
|
|
10643
|
+
...params
|
|
10644
|
+
};
|
|
10645
|
+
if (fnOrRegex instanceof RegExp) {
|
|
10646
|
+
def.pattern = fnOrRegex;
|
|
10647
|
+
}
|
|
10648
|
+
const inst = new Class2(def);
|
|
10649
|
+
return inst;
|
|
10650
|
+
}
|
|
10651
|
+
|
|
10652
|
+
// ../../../../../../node_modules/.store/zod-npm-4.1.12-8e1ffc4d68/package/v4/core/to-json-schema.js
|
|
10653
|
+
var JSONSchemaGenerator = class {
|
|
10654
|
+
constructor(params) {
|
|
10655
|
+
this.counter = 0;
|
|
10656
|
+
this.metadataRegistry = params?.metadata ?? globalRegistry;
|
|
10657
|
+
this.target = params?.target ?? "draft-2020-12";
|
|
10658
|
+
this.unrepresentable = params?.unrepresentable ?? "throw";
|
|
10659
|
+
this.override = params?.override ?? (() => {
|
|
10660
|
+
});
|
|
10661
|
+
this.io = params?.io ?? "output";
|
|
10662
|
+
this.seen = /* @__PURE__ */ new Map();
|
|
10663
|
+
}
|
|
10664
|
+
process(schema, _params = { path: [], schemaPath: [] }) {
|
|
10665
|
+
var _a2;
|
|
10666
|
+
const def = schema._zod.def;
|
|
10667
|
+
const formatMap = {
|
|
10668
|
+
guid: "uuid",
|
|
10669
|
+
url: "uri",
|
|
10670
|
+
datetime: "date-time",
|
|
10671
|
+
json_string: "json-string",
|
|
10672
|
+
regex: ""
|
|
10673
|
+
// do not set
|
|
10674
|
+
};
|
|
10675
|
+
const seen = this.seen.get(schema);
|
|
10676
|
+
if (seen) {
|
|
10677
|
+
seen.count++;
|
|
10678
|
+
const isCycle = _params.schemaPath.includes(schema);
|
|
10679
|
+
if (isCycle) {
|
|
10680
|
+
seen.cycle = _params.path;
|
|
10681
|
+
}
|
|
10682
|
+
return seen.schema;
|
|
10683
|
+
}
|
|
10684
|
+
const result = { schema: {}, count: 1, cycle: void 0, path: _params.path };
|
|
10685
|
+
this.seen.set(schema, result);
|
|
10686
|
+
const overrideSchema = schema._zod.toJSONSchema?.();
|
|
10687
|
+
if (overrideSchema) {
|
|
10688
|
+
result.schema = overrideSchema;
|
|
10689
|
+
} else {
|
|
10690
|
+
const params = {
|
|
10691
|
+
..._params,
|
|
10692
|
+
schemaPath: [..._params.schemaPath, schema],
|
|
10693
|
+
path: _params.path
|
|
10694
|
+
};
|
|
10695
|
+
const parent = schema._zod.parent;
|
|
10696
|
+
if (parent) {
|
|
10697
|
+
result.ref = parent;
|
|
10698
|
+
this.process(parent, params);
|
|
10699
|
+
this.seen.get(parent).isParent = true;
|
|
10700
|
+
} else {
|
|
10701
|
+
const _json = result.schema;
|
|
10702
|
+
switch (def.type) {
|
|
10703
|
+
case "string": {
|
|
10704
|
+
const json2 = _json;
|
|
10705
|
+
json2.type = "string";
|
|
10706
|
+
const { minimum, maximum, format, patterns, contentEncoding } = schema._zod.bag;
|
|
10707
|
+
if (typeof minimum === "number")
|
|
10708
|
+
json2.minLength = minimum;
|
|
10709
|
+
if (typeof maximum === "number")
|
|
10710
|
+
json2.maxLength = maximum;
|
|
10711
|
+
if (format) {
|
|
10712
|
+
json2.format = formatMap[format] ?? format;
|
|
10713
|
+
if (json2.format === "")
|
|
10714
|
+
delete json2.format;
|
|
10715
|
+
}
|
|
10716
|
+
if (contentEncoding)
|
|
10717
|
+
json2.contentEncoding = contentEncoding;
|
|
10718
|
+
if (patterns && patterns.size > 0) {
|
|
10719
|
+
const regexes = [...patterns];
|
|
10720
|
+
if (regexes.length === 1)
|
|
10721
|
+
json2.pattern = regexes[0].source;
|
|
10722
|
+
else if (regexes.length > 1) {
|
|
10723
|
+
result.schema.allOf = [
|
|
10724
|
+
...regexes.map((regex) => ({
|
|
10725
|
+
...this.target === "draft-7" || this.target === "draft-4" || this.target === "openapi-3.0" ? { type: "string" } : {},
|
|
10726
|
+
pattern: regex.source
|
|
10727
|
+
}))
|
|
10728
|
+
];
|
|
10729
|
+
}
|
|
10730
|
+
}
|
|
10731
|
+
break;
|
|
10732
|
+
}
|
|
10733
|
+
case "number": {
|
|
10734
|
+
const json2 = _json;
|
|
10735
|
+
const { minimum, maximum, format, multipleOf, exclusiveMaximum, exclusiveMinimum } = schema._zod.bag;
|
|
10736
|
+
if (typeof format === "string" && format.includes("int"))
|
|
10737
|
+
json2.type = "integer";
|
|
10738
|
+
else
|
|
10739
|
+
json2.type = "number";
|
|
10740
|
+
if (typeof exclusiveMinimum === "number") {
|
|
10741
|
+
if (this.target === "draft-4" || this.target === "openapi-3.0") {
|
|
10742
|
+
json2.minimum = exclusiveMinimum;
|
|
10743
|
+
json2.exclusiveMinimum = true;
|
|
10744
|
+
} else {
|
|
10745
|
+
json2.exclusiveMinimum = exclusiveMinimum;
|
|
10746
|
+
}
|
|
10747
|
+
}
|
|
10748
|
+
if (typeof minimum === "number") {
|
|
10749
|
+
json2.minimum = minimum;
|
|
10750
|
+
if (typeof exclusiveMinimum === "number" && this.target !== "draft-4") {
|
|
10751
|
+
if (exclusiveMinimum >= minimum)
|
|
10752
|
+
delete json2.minimum;
|
|
10753
|
+
else
|
|
10754
|
+
delete json2.exclusiveMinimum;
|
|
10755
|
+
}
|
|
10756
|
+
}
|
|
10757
|
+
if (typeof exclusiveMaximum === "number") {
|
|
10758
|
+
if (this.target === "draft-4" || this.target === "openapi-3.0") {
|
|
10759
|
+
json2.maximum = exclusiveMaximum;
|
|
10760
|
+
json2.exclusiveMaximum = true;
|
|
10761
|
+
} else {
|
|
10762
|
+
json2.exclusiveMaximum = exclusiveMaximum;
|
|
10763
|
+
}
|
|
10764
|
+
}
|
|
10765
|
+
if (typeof maximum === "number") {
|
|
10766
|
+
json2.maximum = maximum;
|
|
10767
|
+
if (typeof exclusiveMaximum === "number" && this.target !== "draft-4") {
|
|
10768
|
+
if (exclusiveMaximum <= maximum)
|
|
10769
|
+
delete json2.maximum;
|
|
10770
|
+
else
|
|
10771
|
+
delete json2.exclusiveMaximum;
|
|
10772
|
+
}
|
|
10773
|
+
}
|
|
10774
|
+
if (typeof multipleOf === "number")
|
|
10775
|
+
json2.multipleOf = multipleOf;
|
|
10776
|
+
break;
|
|
10777
|
+
}
|
|
10778
|
+
case "boolean": {
|
|
10779
|
+
const json2 = _json;
|
|
10780
|
+
json2.type = "boolean";
|
|
10781
|
+
break;
|
|
10782
|
+
}
|
|
10783
|
+
case "bigint": {
|
|
10784
|
+
if (this.unrepresentable === "throw") {
|
|
10785
|
+
throw new Error("BigInt cannot be represented in JSON Schema");
|
|
10786
|
+
}
|
|
10787
|
+
break;
|
|
10788
|
+
}
|
|
10789
|
+
case "symbol": {
|
|
10790
|
+
if (this.unrepresentable === "throw") {
|
|
10791
|
+
throw new Error("Symbols cannot be represented in JSON Schema");
|
|
10792
|
+
}
|
|
10793
|
+
break;
|
|
10794
|
+
}
|
|
10795
|
+
case "null": {
|
|
10796
|
+
if (this.target === "openapi-3.0") {
|
|
10797
|
+
_json.type = "string";
|
|
10798
|
+
_json.nullable = true;
|
|
10799
|
+
_json.enum = [null];
|
|
10800
|
+
} else
|
|
10801
|
+
_json.type = "null";
|
|
10802
|
+
break;
|
|
10803
|
+
}
|
|
10804
|
+
case "any": {
|
|
10805
|
+
break;
|
|
10806
|
+
}
|
|
10807
|
+
case "unknown": {
|
|
10808
|
+
break;
|
|
10809
|
+
}
|
|
10810
|
+
case "undefined": {
|
|
10811
|
+
if (this.unrepresentable === "throw") {
|
|
10812
|
+
throw new Error("Undefined cannot be represented in JSON Schema");
|
|
10813
|
+
}
|
|
10814
|
+
break;
|
|
10815
|
+
}
|
|
10816
|
+
case "void": {
|
|
10817
|
+
if (this.unrepresentable === "throw") {
|
|
10818
|
+
throw new Error("Void cannot be represented in JSON Schema");
|
|
10819
|
+
}
|
|
10820
|
+
break;
|
|
10821
|
+
}
|
|
10822
|
+
case "never": {
|
|
10823
|
+
_json.not = {};
|
|
10824
|
+
break;
|
|
10825
|
+
}
|
|
10826
|
+
case "date": {
|
|
10827
|
+
if (this.unrepresentable === "throw") {
|
|
10828
|
+
throw new Error("Date cannot be represented in JSON Schema");
|
|
10829
|
+
}
|
|
10830
|
+
break;
|
|
10831
|
+
}
|
|
10832
|
+
case "array": {
|
|
10833
|
+
const json2 = _json;
|
|
10834
|
+
const { minimum, maximum } = schema._zod.bag;
|
|
10835
|
+
if (typeof minimum === "number")
|
|
10836
|
+
json2.minItems = minimum;
|
|
10837
|
+
if (typeof maximum === "number")
|
|
10838
|
+
json2.maxItems = maximum;
|
|
10839
|
+
json2.type = "array";
|
|
10840
|
+
json2.items = this.process(def.element, { ...params, path: [...params.path, "items"] });
|
|
10841
|
+
break;
|
|
10842
|
+
}
|
|
10843
|
+
case "object": {
|
|
10844
|
+
const json2 = _json;
|
|
10845
|
+
json2.type = "object";
|
|
10846
|
+
json2.properties = {};
|
|
10847
|
+
const shape = def.shape;
|
|
10848
|
+
for (const key in shape) {
|
|
10849
|
+
json2.properties[key] = this.process(shape[key], {
|
|
10850
|
+
...params,
|
|
10851
|
+
path: [...params.path, "properties", key]
|
|
10852
|
+
});
|
|
10853
|
+
}
|
|
10854
|
+
const allKeys = new Set(Object.keys(shape));
|
|
10855
|
+
const requiredKeys = new Set([...allKeys].filter((key) => {
|
|
10856
|
+
const v = def.shape[key]._zod;
|
|
10857
|
+
if (this.io === "input") {
|
|
10858
|
+
return v.optin === void 0;
|
|
10859
|
+
} else {
|
|
10860
|
+
return v.optout === void 0;
|
|
10861
|
+
}
|
|
10862
|
+
}));
|
|
10863
|
+
if (requiredKeys.size > 0) {
|
|
10864
|
+
json2.required = Array.from(requiredKeys);
|
|
10865
|
+
}
|
|
10866
|
+
if (def.catchall?._zod.def.type === "never") {
|
|
10867
|
+
json2.additionalProperties = false;
|
|
10868
|
+
} else if (!def.catchall) {
|
|
10869
|
+
if (this.io === "output")
|
|
10870
|
+
json2.additionalProperties = false;
|
|
10871
|
+
} else if (def.catchall) {
|
|
10872
|
+
json2.additionalProperties = this.process(def.catchall, {
|
|
10873
|
+
...params,
|
|
10874
|
+
path: [...params.path, "additionalProperties"]
|
|
10875
|
+
});
|
|
10876
|
+
}
|
|
10877
|
+
break;
|
|
10878
|
+
}
|
|
10879
|
+
case "union": {
|
|
10880
|
+
const json2 = _json;
|
|
10881
|
+
const options = def.options.map((x, i) => this.process(x, {
|
|
10882
|
+
...params,
|
|
10883
|
+
path: [...params.path, "anyOf", i]
|
|
10884
|
+
}));
|
|
10885
|
+
json2.anyOf = options;
|
|
10886
|
+
break;
|
|
10887
|
+
}
|
|
10888
|
+
case "intersection": {
|
|
10889
|
+
const json2 = _json;
|
|
10890
|
+
const a = this.process(def.left, {
|
|
10891
|
+
...params,
|
|
10892
|
+
path: [...params.path, "allOf", 0]
|
|
10893
|
+
});
|
|
10894
|
+
const b = this.process(def.right, {
|
|
10895
|
+
...params,
|
|
10896
|
+
path: [...params.path, "allOf", 1]
|
|
10897
|
+
});
|
|
10898
|
+
const isSimpleIntersection = (val) => "allOf" in val && Object.keys(val).length === 1;
|
|
10899
|
+
const allOf = [
|
|
10900
|
+
...isSimpleIntersection(a) ? a.allOf : [a],
|
|
10901
|
+
...isSimpleIntersection(b) ? b.allOf : [b]
|
|
10902
|
+
];
|
|
10903
|
+
json2.allOf = allOf;
|
|
10904
|
+
break;
|
|
10905
|
+
}
|
|
10906
|
+
case "tuple": {
|
|
10907
|
+
const json2 = _json;
|
|
10908
|
+
json2.type = "array";
|
|
10909
|
+
const prefixPath = this.target === "draft-2020-12" ? "prefixItems" : "items";
|
|
10910
|
+
const restPath = this.target === "draft-2020-12" ? "items" : this.target === "openapi-3.0" ? "items" : "additionalItems";
|
|
10911
|
+
const prefixItems = def.items.map((x, i) => this.process(x, {
|
|
10912
|
+
...params,
|
|
10913
|
+
path: [...params.path, prefixPath, i]
|
|
10914
|
+
}));
|
|
10915
|
+
const rest = def.rest ? this.process(def.rest, {
|
|
10916
|
+
...params,
|
|
10917
|
+
path: [...params.path, restPath, ...this.target === "openapi-3.0" ? [def.items.length] : []]
|
|
10918
|
+
}) : null;
|
|
10919
|
+
if (this.target === "draft-2020-12") {
|
|
10920
|
+
json2.prefixItems = prefixItems;
|
|
10921
|
+
if (rest) {
|
|
10922
|
+
json2.items = rest;
|
|
10923
|
+
}
|
|
10924
|
+
} else if (this.target === "openapi-3.0") {
|
|
10925
|
+
json2.items = {
|
|
10926
|
+
anyOf: prefixItems
|
|
10927
|
+
};
|
|
10928
|
+
if (rest) {
|
|
10929
|
+
json2.items.anyOf.push(rest);
|
|
10930
|
+
}
|
|
10931
|
+
json2.minItems = prefixItems.length;
|
|
10932
|
+
if (!rest) {
|
|
10933
|
+
json2.maxItems = prefixItems.length;
|
|
10934
|
+
}
|
|
10935
|
+
} else {
|
|
10936
|
+
json2.items = prefixItems;
|
|
10937
|
+
if (rest) {
|
|
10938
|
+
json2.additionalItems = rest;
|
|
10939
|
+
}
|
|
10940
|
+
}
|
|
10941
|
+
const { minimum, maximum } = schema._zod.bag;
|
|
10942
|
+
if (typeof minimum === "number")
|
|
10943
|
+
json2.minItems = minimum;
|
|
10944
|
+
if (typeof maximum === "number")
|
|
10945
|
+
json2.maxItems = maximum;
|
|
10946
|
+
break;
|
|
10947
|
+
}
|
|
10948
|
+
case "record": {
|
|
10949
|
+
const json2 = _json;
|
|
10950
|
+
json2.type = "object";
|
|
10951
|
+
if (this.target === "draft-7" || this.target === "draft-2020-12") {
|
|
10952
|
+
json2.propertyNames = this.process(def.keyType, {
|
|
10953
|
+
...params,
|
|
10954
|
+
path: [...params.path, "propertyNames"]
|
|
10955
|
+
});
|
|
10956
|
+
}
|
|
10957
|
+
json2.additionalProperties = this.process(def.valueType, {
|
|
10958
|
+
...params,
|
|
10959
|
+
path: [...params.path, "additionalProperties"]
|
|
10960
|
+
});
|
|
10961
|
+
break;
|
|
10962
|
+
}
|
|
10963
|
+
case "map": {
|
|
10964
|
+
if (this.unrepresentable === "throw") {
|
|
10965
|
+
throw new Error("Map cannot be represented in JSON Schema");
|
|
10966
|
+
}
|
|
10967
|
+
break;
|
|
10968
|
+
}
|
|
10969
|
+
case "set": {
|
|
10970
|
+
if (this.unrepresentable === "throw") {
|
|
10971
|
+
throw new Error("Set cannot be represented in JSON Schema");
|
|
10972
|
+
}
|
|
10973
|
+
break;
|
|
10974
|
+
}
|
|
10975
|
+
case "enum": {
|
|
10976
|
+
const json2 = _json;
|
|
10977
|
+
const values = getEnumValues(def.entries);
|
|
10978
|
+
if (values.every((v) => typeof v === "number"))
|
|
10979
|
+
json2.type = "number";
|
|
10980
|
+
if (values.every((v) => typeof v === "string"))
|
|
10981
|
+
json2.type = "string";
|
|
10982
|
+
json2.enum = values;
|
|
10983
|
+
break;
|
|
10984
|
+
}
|
|
10985
|
+
case "literal": {
|
|
10986
|
+
const json2 = _json;
|
|
10987
|
+
const vals = [];
|
|
10988
|
+
for (const val of def.values) {
|
|
10989
|
+
if (val === void 0) {
|
|
10990
|
+
if (this.unrepresentable === "throw") {
|
|
10991
|
+
throw new Error("Literal `undefined` cannot be represented in JSON Schema");
|
|
10992
|
+
} else {
|
|
10993
|
+
}
|
|
10994
|
+
} else if (typeof val === "bigint") {
|
|
10995
|
+
if (this.unrepresentable === "throw") {
|
|
10996
|
+
throw new Error("BigInt literals cannot be represented in JSON Schema");
|
|
10997
|
+
} else {
|
|
10998
|
+
vals.push(Number(val));
|
|
10999
|
+
}
|
|
11000
|
+
} else {
|
|
11001
|
+
vals.push(val);
|
|
11002
|
+
}
|
|
11003
|
+
}
|
|
11004
|
+
if (vals.length === 0) {
|
|
11005
|
+
} else if (vals.length === 1) {
|
|
11006
|
+
const val = vals[0];
|
|
11007
|
+
json2.type = val === null ? "null" : typeof val;
|
|
11008
|
+
if (this.target === "draft-4" || this.target === "openapi-3.0") {
|
|
11009
|
+
json2.enum = [val];
|
|
11010
|
+
} else {
|
|
11011
|
+
json2.const = val;
|
|
11012
|
+
}
|
|
11013
|
+
} else {
|
|
11014
|
+
if (vals.every((v) => typeof v === "number"))
|
|
11015
|
+
json2.type = "number";
|
|
11016
|
+
if (vals.every((v) => typeof v === "string"))
|
|
11017
|
+
json2.type = "string";
|
|
11018
|
+
if (vals.every((v) => typeof v === "boolean"))
|
|
11019
|
+
json2.type = "string";
|
|
11020
|
+
if (vals.every((v) => v === null))
|
|
11021
|
+
json2.type = "null";
|
|
11022
|
+
json2.enum = vals;
|
|
11023
|
+
}
|
|
11024
|
+
break;
|
|
11025
|
+
}
|
|
11026
|
+
case "file": {
|
|
11027
|
+
const json2 = _json;
|
|
11028
|
+
const file2 = {
|
|
11029
|
+
type: "string",
|
|
11030
|
+
format: "binary",
|
|
11031
|
+
contentEncoding: "binary"
|
|
11032
|
+
};
|
|
11033
|
+
const { minimum, maximum, mime } = schema._zod.bag;
|
|
11034
|
+
if (minimum !== void 0)
|
|
11035
|
+
file2.minLength = minimum;
|
|
11036
|
+
if (maximum !== void 0)
|
|
11037
|
+
file2.maxLength = maximum;
|
|
11038
|
+
if (mime) {
|
|
11039
|
+
if (mime.length === 1) {
|
|
11040
|
+
file2.contentMediaType = mime[0];
|
|
11041
|
+
Object.assign(json2, file2);
|
|
11042
|
+
} else {
|
|
11043
|
+
json2.anyOf = mime.map((m) => {
|
|
11044
|
+
const mFile = { ...file2, contentMediaType: m };
|
|
11045
|
+
return mFile;
|
|
11046
|
+
});
|
|
11047
|
+
}
|
|
11048
|
+
} else {
|
|
11049
|
+
Object.assign(json2, file2);
|
|
11050
|
+
}
|
|
11051
|
+
break;
|
|
11052
|
+
}
|
|
11053
|
+
case "transform": {
|
|
11054
|
+
if (this.unrepresentable === "throw") {
|
|
11055
|
+
throw new Error("Transforms cannot be represented in JSON Schema");
|
|
11056
|
+
}
|
|
11057
|
+
break;
|
|
11058
|
+
}
|
|
11059
|
+
case "nullable": {
|
|
11060
|
+
const inner = this.process(def.innerType, params);
|
|
11061
|
+
if (this.target === "openapi-3.0") {
|
|
11062
|
+
result.ref = def.innerType;
|
|
11063
|
+
_json.nullable = true;
|
|
11064
|
+
} else {
|
|
11065
|
+
_json.anyOf = [inner, { type: "null" }];
|
|
11066
|
+
}
|
|
11067
|
+
break;
|
|
11068
|
+
}
|
|
11069
|
+
case "nonoptional": {
|
|
11070
|
+
this.process(def.innerType, params);
|
|
11071
|
+
result.ref = def.innerType;
|
|
11072
|
+
break;
|
|
11073
|
+
}
|
|
11074
|
+
case "success": {
|
|
11075
|
+
const json2 = _json;
|
|
11076
|
+
json2.type = "boolean";
|
|
11077
|
+
break;
|
|
11078
|
+
}
|
|
11079
|
+
case "default": {
|
|
11080
|
+
this.process(def.innerType, params);
|
|
11081
|
+
result.ref = def.innerType;
|
|
11082
|
+
_json.default = JSON.parse(JSON.stringify(def.defaultValue));
|
|
11083
|
+
break;
|
|
11084
|
+
}
|
|
11085
|
+
case "prefault": {
|
|
11086
|
+
this.process(def.innerType, params);
|
|
11087
|
+
result.ref = def.innerType;
|
|
11088
|
+
if (this.io === "input")
|
|
11089
|
+
_json._prefault = JSON.parse(JSON.stringify(def.defaultValue));
|
|
11090
|
+
break;
|
|
11091
|
+
}
|
|
11092
|
+
case "catch": {
|
|
11093
|
+
this.process(def.innerType, params);
|
|
11094
|
+
result.ref = def.innerType;
|
|
11095
|
+
let catchValue;
|
|
11096
|
+
try {
|
|
11097
|
+
catchValue = def.catchValue(void 0);
|
|
11098
|
+
} catch {
|
|
11099
|
+
throw new Error("Dynamic catch values are not supported in JSON Schema");
|
|
11100
|
+
}
|
|
11101
|
+
_json.default = catchValue;
|
|
11102
|
+
break;
|
|
11103
|
+
}
|
|
11104
|
+
case "nan": {
|
|
11105
|
+
if (this.unrepresentable === "throw") {
|
|
11106
|
+
throw new Error("NaN cannot be represented in JSON Schema");
|
|
11107
|
+
}
|
|
11108
|
+
break;
|
|
11109
|
+
}
|
|
11110
|
+
case "template_literal": {
|
|
11111
|
+
const json2 = _json;
|
|
11112
|
+
const pattern = schema._zod.pattern;
|
|
11113
|
+
if (!pattern)
|
|
11114
|
+
throw new Error("Pattern not found in template literal");
|
|
11115
|
+
json2.type = "string";
|
|
11116
|
+
json2.pattern = pattern.source;
|
|
11117
|
+
break;
|
|
11118
|
+
}
|
|
11119
|
+
case "pipe": {
|
|
11120
|
+
const innerType = this.io === "input" ? def.in._zod.def.type === "transform" ? def.out : def.in : def.out;
|
|
11121
|
+
this.process(innerType, params);
|
|
11122
|
+
result.ref = innerType;
|
|
11123
|
+
break;
|
|
11124
|
+
}
|
|
11125
|
+
case "readonly": {
|
|
11126
|
+
this.process(def.innerType, params);
|
|
11127
|
+
result.ref = def.innerType;
|
|
11128
|
+
_json.readOnly = true;
|
|
11129
|
+
break;
|
|
11130
|
+
}
|
|
11131
|
+
// passthrough types
|
|
11132
|
+
case "promise": {
|
|
11133
|
+
this.process(def.innerType, params);
|
|
11134
|
+
result.ref = def.innerType;
|
|
11135
|
+
break;
|
|
11136
|
+
}
|
|
11137
|
+
case "optional": {
|
|
11138
|
+
this.process(def.innerType, params);
|
|
11139
|
+
result.ref = def.innerType;
|
|
11140
|
+
break;
|
|
11141
|
+
}
|
|
11142
|
+
case "lazy": {
|
|
11143
|
+
const innerType = schema._zod.innerType;
|
|
11144
|
+
this.process(innerType, params);
|
|
11145
|
+
result.ref = innerType;
|
|
11146
|
+
break;
|
|
11147
|
+
}
|
|
11148
|
+
case "custom": {
|
|
11149
|
+
if (this.unrepresentable === "throw") {
|
|
11150
|
+
throw new Error("Custom types cannot be represented in JSON Schema");
|
|
11151
|
+
}
|
|
11152
|
+
break;
|
|
11153
|
+
}
|
|
11154
|
+
case "function": {
|
|
11155
|
+
if (this.unrepresentable === "throw") {
|
|
11156
|
+
throw new Error("Function types cannot be represented in JSON Schema");
|
|
11157
|
+
}
|
|
11158
|
+
break;
|
|
11159
|
+
}
|
|
11160
|
+
default: {
|
|
11161
|
+
def;
|
|
11162
|
+
}
|
|
11163
|
+
}
|
|
11164
|
+
}
|
|
11165
|
+
}
|
|
11166
|
+
const meta = this.metadataRegistry.get(schema);
|
|
11167
|
+
if (meta)
|
|
11168
|
+
Object.assign(result.schema, meta);
|
|
11169
|
+
if (this.io === "input" && isTransforming(schema)) {
|
|
11170
|
+
delete result.schema.examples;
|
|
11171
|
+
delete result.schema.default;
|
|
11172
|
+
}
|
|
11173
|
+
if (this.io === "input" && result.schema._prefault)
|
|
11174
|
+
(_a2 = result.schema).default ?? (_a2.default = result.schema._prefault);
|
|
11175
|
+
delete result.schema._prefault;
|
|
11176
|
+
const _result = this.seen.get(schema);
|
|
11177
|
+
return _result.schema;
|
|
11178
|
+
}
|
|
11179
|
+
emit(schema, _params) {
|
|
11180
|
+
const params = {
|
|
11181
|
+
cycles: _params?.cycles ?? "ref",
|
|
11182
|
+
reused: _params?.reused ?? "inline",
|
|
11183
|
+
// unrepresentable: _params?.unrepresentable ?? "throw",
|
|
11184
|
+
// uri: _params?.uri ?? ((id) => `${id}`),
|
|
11185
|
+
external: _params?.external ?? void 0
|
|
11186
|
+
};
|
|
11187
|
+
const root = this.seen.get(schema);
|
|
11188
|
+
if (!root)
|
|
11189
|
+
throw new Error("Unprocessed schema. This is a bug in Zod.");
|
|
11190
|
+
const makeURI = (entry) => {
|
|
11191
|
+
const defsSegment = this.target === "draft-2020-12" ? "$defs" : "definitions";
|
|
11192
|
+
if (params.external) {
|
|
11193
|
+
const externalId = params.external.registry.get(entry[0])?.id;
|
|
11194
|
+
const uriGenerator = params.external.uri ?? ((id2) => id2);
|
|
11195
|
+
if (externalId) {
|
|
11196
|
+
return { ref: uriGenerator(externalId) };
|
|
11197
|
+
}
|
|
11198
|
+
const id = entry[1].defId ?? entry[1].schema.id ?? `schema${this.counter++}`;
|
|
11199
|
+
entry[1].defId = id;
|
|
11200
|
+
return { defId: id, ref: `${uriGenerator("__shared")}#/${defsSegment}/${id}` };
|
|
11201
|
+
}
|
|
11202
|
+
if (entry[1] === root) {
|
|
11203
|
+
return { ref: "#" };
|
|
11204
|
+
}
|
|
11205
|
+
const uriPrefix = `#`;
|
|
11206
|
+
const defUriPrefix = `${uriPrefix}/${defsSegment}/`;
|
|
11207
|
+
const defId = entry[1].schema.id ?? `__schema${this.counter++}`;
|
|
11208
|
+
return { defId, ref: defUriPrefix + defId };
|
|
11209
|
+
};
|
|
11210
|
+
const extractToDef = (entry) => {
|
|
11211
|
+
if (entry[1].schema.$ref) {
|
|
11212
|
+
return;
|
|
11213
|
+
}
|
|
11214
|
+
const seen = entry[1];
|
|
11215
|
+
const { ref, defId } = makeURI(entry);
|
|
11216
|
+
seen.def = { ...seen.schema };
|
|
11217
|
+
if (defId)
|
|
11218
|
+
seen.defId = defId;
|
|
11219
|
+
const schema2 = seen.schema;
|
|
11220
|
+
for (const key in schema2) {
|
|
11221
|
+
delete schema2[key];
|
|
11222
|
+
}
|
|
11223
|
+
schema2.$ref = ref;
|
|
11224
|
+
};
|
|
11225
|
+
if (params.cycles === "throw") {
|
|
11226
|
+
for (const entry of this.seen.entries()) {
|
|
11227
|
+
const seen = entry[1];
|
|
11228
|
+
if (seen.cycle) {
|
|
11229
|
+
throw new Error(`Cycle detected: #/${seen.cycle?.join("/")}/<root>
|
|
11230
|
+
|
|
11231
|
+
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`);
|
|
11232
|
+
}
|
|
11233
|
+
}
|
|
11234
|
+
}
|
|
11235
|
+
for (const entry of this.seen.entries()) {
|
|
11236
|
+
const seen = entry[1];
|
|
11237
|
+
if (schema === entry[0]) {
|
|
11238
|
+
extractToDef(entry);
|
|
11239
|
+
continue;
|
|
11240
|
+
}
|
|
11241
|
+
if (params.external) {
|
|
11242
|
+
const ext = params.external.registry.get(entry[0])?.id;
|
|
11243
|
+
if (schema !== entry[0] && ext) {
|
|
11244
|
+
extractToDef(entry);
|
|
11245
|
+
continue;
|
|
11246
|
+
}
|
|
11247
|
+
}
|
|
11248
|
+
const id = this.metadataRegistry.get(entry[0])?.id;
|
|
11249
|
+
if (id) {
|
|
11250
|
+
extractToDef(entry);
|
|
11251
|
+
continue;
|
|
11252
|
+
}
|
|
11253
|
+
if (seen.cycle) {
|
|
11254
|
+
extractToDef(entry);
|
|
11255
|
+
continue;
|
|
11256
|
+
}
|
|
11257
|
+
if (seen.count > 1) {
|
|
11258
|
+
if (params.reused === "ref") {
|
|
11259
|
+
extractToDef(entry);
|
|
11260
|
+
continue;
|
|
11261
|
+
}
|
|
11262
|
+
}
|
|
11263
|
+
}
|
|
11264
|
+
const flattenRef = (zodSchema, params2) => {
|
|
11265
|
+
const seen = this.seen.get(zodSchema);
|
|
11266
|
+
const schema2 = seen.def ?? seen.schema;
|
|
11267
|
+
const _cached = { ...schema2 };
|
|
11268
|
+
if (seen.ref === null) {
|
|
11269
|
+
return;
|
|
11270
|
+
}
|
|
11271
|
+
const ref = seen.ref;
|
|
11272
|
+
seen.ref = null;
|
|
11273
|
+
if (ref) {
|
|
11274
|
+
flattenRef(ref, params2);
|
|
11275
|
+
const refSchema = this.seen.get(ref).schema;
|
|
11276
|
+
if (refSchema.$ref && (params2.target === "draft-7" || params2.target === "draft-4" || params2.target === "openapi-3.0")) {
|
|
11277
|
+
schema2.allOf = schema2.allOf ?? [];
|
|
11278
|
+
schema2.allOf.push(refSchema);
|
|
11279
|
+
} else {
|
|
11280
|
+
Object.assign(schema2, refSchema);
|
|
11281
|
+
Object.assign(schema2, _cached);
|
|
11282
|
+
}
|
|
11283
|
+
}
|
|
11284
|
+
if (!seen.isParent)
|
|
11285
|
+
this.override({
|
|
11286
|
+
zodSchema,
|
|
11287
|
+
jsonSchema: schema2,
|
|
11288
|
+
path: seen.path ?? []
|
|
11289
|
+
});
|
|
11290
|
+
};
|
|
11291
|
+
for (const entry of [...this.seen.entries()].reverse()) {
|
|
11292
|
+
flattenRef(entry[0], { target: this.target });
|
|
11293
|
+
}
|
|
11294
|
+
const result = {};
|
|
11295
|
+
if (this.target === "draft-2020-12") {
|
|
11296
|
+
result.$schema = "https://json-schema.org/draft/2020-12/schema";
|
|
11297
|
+
} else if (this.target === "draft-7") {
|
|
11298
|
+
result.$schema = "http://json-schema.org/draft-07/schema#";
|
|
11299
|
+
} else if (this.target === "draft-4") {
|
|
11300
|
+
result.$schema = "http://json-schema.org/draft-04/schema#";
|
|
11301
|
+
} else if (this.target === "openapi-3.0") {
|
|
11302
|
+
} else {
|
|
11303
|
+
console.warn(`Invalid target: ${this.target}`);
|
|
11304
|
+
}
|
|
11305
|
+
if (params.external?.uri) {
|
|
11306
|
+
const id = params.external.registry.get(schema)?.id;
|
|
11307
|
+
if (!id)
|
|
11308
|
+
throw new Error("Schema is missing an `id` property");
|
|
11309
|
+
result.$id = params.external.uri(id);
|
|
11310
|
+
}
|
|
11311
|
+
Object.assign(result, root.def);
|
|
11312
|
+
const defs = params.external?.defs ?? {};
|
|
11313
|
+
for (const entry of this.seen.entries()) {
|
|
11314
|
+
const seen = entry[1];
|
|
11315
|
+
if (seen.def && seen.defId) {
|
|
11316
|
+
defs[seen.defId] = seen.def;
|
|
11317
|
+
}
|
|
11318
|
+
}
|
|
11319
|
+
if (params.external) {
|
|
11320
|
+
} else {
|
|
11321
|
+
if (Object.keys(defs).length > 0) {
|
|
11322
|
+
if (this.target === "draft-2020-12") {
|
|
11323
|
+
result.$defs = defs;
|
|
11324
|
+
} else {
|
|
11325
|
+
result.definitions = defs;
|
|
11326
|
+
}
|
|
11327
|
+
}
|
|
11328
|
+
}
|
|
11329
|
+
try {
|
|
11330
|
+
return JSON.parse(JSON.stringify(result));
|
|
11331
|
+
} catch (_err) {
|
|
11332
|
+
throw new Error("Error converting schema to JSON.");
|
|
11333
|
+
}
|
|
11334
|
+
}
|
|
11335
|
+
};
|
|
11336
|
+
function toJSONSchema(input, _params) {
|
|
11337
|
+
if (input instanceof $ZodRegistry) {
|
|
11338
|
+
const gen2 = new JSONSchemaGenerator(_params);
|
|
11339
|
+
const defs = {};
|
|
11340
|
+
for (const entry of input._idmap.entries()) {
|
|
11341
|
+
const [_, schema] = entry;
|
|
11342
|
+
gen2.process(schema);
|
|
11343
|
+
}
|
|
11344
|
+
const schemas = {};
|
|
11345
|
+
const external = {
|
|
11346
|
+
registry: input,
|
|
11347
|
+
uri: _params?.uri,
|
|
11348
|
+
defs
|
|
11349
|
+
};
|
|
11350
|
+
for (const entry of input._idmap.entries()) {
|
|
11351
|
+
const [key, schema] = entry;
|
|
11352
|
+
schemas[key] = gen2.emit(schema, {
|
|
11353
|
+
..._params,
|
|
11354
|
+
external
|
|
11355
|
+
});
|
|
11356
|
+
}
|
|
11357
|
+
if (Object.keys(defs).length > 0) {
|
|
11358
|
+
const defsSegment = gen2.target === "draft-2020-12" ? "$defs" : "definitions";
|
|
11359
|
+
schemas.__shared = {
|
|
11360
|
+
[defsSegment]: defs
|
|
11361
|
+
};
|
|
11362
|
+
}
|
|
11363
|
+
return { schemas };
|
|
11364
|
+
}
|
|
11365
|
+
const gen = new JSONSchemaGenerator(_params);
|
|
11366
|
+
gen.process(input);
|
|
11367
|
+
return gen.emit(input, _params);
|
|
8482
11368
|
}
|
|
8483
|
-
function
|
|
8484
|
-
const
|
|
8485
|
-
|
|
8486
|
-
|
|
8487
|
-
|
|
8488
|
-
|
|
8489
|
-
|
|
11369
|
+
function isTransforming(_schema, _ctx) {
|
|
11370
|
+
const ctx = _ctx ?? { seen: /* @__PURE__ */ new Set() };
|
|
11371
|
+
if (ctx.seen.has(_schema))
|
|
11372
|
+
return false;
|
|
11373
|
+
ctx.seen.add(_schema);
|
|
11374
|
+
const schema = _schema;
|
|
11375
|
+
const def = schema._zod.def;
|
|
11376
|
+
switch (def.type) {
|
|
11377
|
+
case "string":
|
|
11378
|
+
case "number":
|
|
11379
|
+
case "bigint":
|
|
11380
|
+
case "boolean":
|
|
11381
|
+
case "date":
|
|
11382
|
+
case "symbol":
|
|
11383
|
+
case "undefined":
|
|
11384
|
+
case "null":
|
|
11385
|
+
case "any":
|
|
11386
|
+
case "unknown":
|
|
11387
|
+
case "never":
|
|
11388
|
+
case "void":
|
|
11389
|
+
case "literal":
|
|
11390
|
+
case "enum":
|
|
11391
|
+
case "nan":
|
|
11392
|
+
case "file":
|
|
11393
|
+
case "template_literal":
|
|
11394
|
+
return false;
|
|
11395
|
+
case "array": {
|
|
11396
|
+
return isTransforming(def.element, ctx);
|
|
11397
|
+
}
|
|
11398
|
+
case "object": {
|
|
11399
|
+
for (const key in def.shape) {
|
|
11400
|
+
if (isTransforming(def.shape[key], ctx))
|
|
11401
|
+
return true;
|
|
11402
|
+
}
|
|
11403
|
+
return false;
|
|
11404
|
+
}
|
|
11405
|
+
case "union": {
|
|
11406
|
+
for (const option of def.options) {
|
|
11407
|
+
if (isTransforming(option, ctx))
|
|
11408
|
+
return true;
|
|
11409
|
+
}
|
|
11410
|
+
return false;
|
|
11411
|
+
}
|
|
11412
|
+
case "intersection": {
|
|
11413
|
+
return isTransforming(def.left, ctx) || isTransforming(def.right, ctx);
|
|
11414
|
+
}
|
|
11415
|
+
case "tuple": {
|
|
11416
|
+
for (const item of def.items) {
|
|
11417
|
+
if (isTransforming(item, ctx))
|
|
11418
|
+
return true;
|
|
11419
|
+
}
|
|
11420
|
+
if (def.rest && isTransforming(def.rest, ctx))
|
|
11421
|
+
return true;
|
|
11422
|
+
return false;
|
|
11423
|
+
}
|
|
11424
|
+
case "record": {
|
|
11425
|
+
return isTransforming(def.keyType, ctx) || isTransforming(def.valueType, ctx);
|
|
11426
|
+
}
|
|
11427
|
+
case "map": {
|
|
11428
|
+
return isTransforming(def.keyType, ctx) || isTransforming(def.valueType, ctx);
|
|
11429
|
+
}
|
|
11430
|
+
case "set": {
|
|
11431
|
+
return isTransforming(def.valueType, ctx);
|
|
11432
|
+
}
|
|
11433
|
+
// inner types
|
|
11434
|
+
case "promise":
|
|
11435
|
+
case "optional":
|
|
11436
|
+
case "nonoptional":
|
|
11437
|
+
case "nullable":
|
|
11438
|
+
case "readonly":
|
|
11439
|
+
return isTransforming(def.innerType, ctx);
|
|
11440
|
+
case "lazy":
|
|
11441
|
+
return isTransforming(def.getter(), ctx);
|
|
11442
|
+
case "default": {
|
|
11443
|
+
return isTransforming(def.innerType, ctx);
|
|
11444
|
+
}
|
|
11445
|
+
case "prefault": {
|
|
11446
|
+
return isTransforming(def.innerType, ctx);
|
|
11447
|
+
}
|
|
11448
|
+
case "custom": {
|
|
11449
|
+
return false;
|
|
11450
|
+
}
|
|
11451
|
+
case "transform": {
|
|
11452
|
+
return true;
|
|
11453
|
+
}
|
|
11454
|
+
case "pipe": {
|
|
11455
|
+
return isTransforming(def.in, ctx) || isTransforming(def.out, ctx);
|
|
11456
|
+
}
|
|
11457
|
+
case "success": {
|
|
11458
|
+
return false;
|
|
11459
|
+
}
|
|
11460
|
+
case "catch": {
|
|
11461
|
+
return false;
|
|
11462
|
+
}
|
|
11463
|
+
case "function": {
|
|
11464
|
+
return false;
|
|
11465
|
+
}
|
|
11466
|
+
default:
|
|
11467
|
+
def;
|
|
11468
|
+
}
|
|
11469
|
+
throw new Error(`Unknown schema type: ${def.type}`);
|
|
8490
11470
|
}
|
|
8491
11471
|
|
|
8492
11472
|
// ../../../../../../node_modules/.store/zod-npm-4.1.12-8e1ffc4d68/package/v4/core/json-schema.js
|
|
8493
11473
|
var json_schema_exports = {};
|
|
8494
11474
|
|
|
8495
11475
|
// ../../../../../../node_modules/.store/zod-npm-4.1.12-8e1ffc4d68/package/v4/classic/iso.js
|
|
11476
|
+
var iso_exports = {};
|
|
11477
|
+
__export(iso_exports, {
|
|
11478
|
+
ZodISODate: () => ZodISODate,
|
|
11479
|
+
ZodISODateTime: () => ZodISODateTime,
|
|
11480
|
+
ZodISODuration: () => ZodISODuration,
|
|
11481
|
+
ZodISOTime: () => ZodISOTime,
|
|
11482
|
+
date: () => date2,
|
|
11483
|
+
datetime: () => datetime2,
|
|
11484
|
+
duration: () => duration2,
|
|
11485
|
+
time: () => time2
|
|
11486
|
+
});
|
|
8496
11487
|
var ZodISODateTime = /* @__PURE__ */ $constructor("ZodISODateTime", (inst, def) => {
|
|
8497
11488
|
$ZodISODateTime.init(inst, def);
|
|
8498
11489
|
ZodStringFormat.init(inst, def);
|
|
@@ -8567,14 +11558,14 @@
|
|
|
8567
11558
|
var parseAsync2 = /* @__PURE__ */ _parseAsync(ZodRealError);
|
|
8568
11559
|
var safeParse2 = /* @__PURE__ */ _safeParse(ZodRealError);
|
|
8569
11560
|
var safeParseAsync2 = /* @__PURE__ */ _safeParseAsync(ZodRealError);
|
|
8570
|
-
var
|
|
8571
|
-
var
|
|
8572
|
-
var
|
|
8573
|
-
var
|
|
8574
|
-
var
|
|
8575
|
-
var
|
|
8576
|
-
var
|
|
8577
|
-
var
|
|
11561
|
+
var encode2 = /* @__PURE__ */ _encode(ZodRealError);
|
|
11562
|
+
var decode2 = /* @__PURE__ */ _decode(ZodRealError);
|
|
11563
|
+
var encodeAsync2 = /* @__PURE__ */ _encodeAsync(ZodRealError);
|
|
11564
|
+
var decodeAsync2 = /* @__PURE__ */ _decodeAsync(ZodRealError);
|
|
11565
|
+
var safeEncode2 = /* @__PURE__ */ _safeEncode(ZodRealError);
|
|
11566
|
+
var safeDecode2 = /* @__PURE__ */ _safeDecode(ZodRealError);
|
|
11567
|
+
var safeEncodeAsync2 = /* @__PURE__ */ _safeEncodeAsync(ZodRealError);
|
|
11568
|
+
var safeDecodeAsync2 = /* @__PURE__ */ _safeDecodeAsync(ZodRealError);
|
|
8578
11569
|
|
|
8579
11570
|
// ../../../../../../node_modules/.store/zod-npm-4.1.12-8e1ffc4d68/package/v4/classic/schemas.js
|
|
8580
11571
|
var ZodType = /* @__PURE__ */ $constructor("ZodType", (inst, def) => {
|
|
@@ -8601,15 +11592,15 @@
|
|
|
8601
11592
|
inst.parseAsync = async (data, params) => parseAsync2(inst, data, params, { callee: inst.parseAsync });
|
|
8602
11593
|
inst.safeParseAsync = async (data, params) => safeParseAsync2(inst, data, params);
|
|
8603
11594
|
inst.spa = inst.safeParseAsync;
|
|
8604
|
-
inst.encode = (data, params) =>
|
|
8605
|
-
inst.decode = (data, params) =>
|
|
8606
|
-
inst.encodeAsync = async (data, params) =>
|
|
8607
|
-
inst.decodeAsync = async (data, params) =>
|
|
8608
|
-
inst.safeEncode = (data, params) =>
|
|
8609
|
-
inst.safeDecode = (data, params) =>
|
|
8610
|
-
inst.safeEncodeAsync = async (data, params) =>
|
|
8611
|
-
inst.safeDecodeAsync = async (data, params) =>
|
|
8612
|
-
inst.refine = (
|
|
11595
|
+
inst.encode = (data, params) => encode2(inst, data, params);
|
|
11596
|
+
inst.decode = (data, params) => decode2(inst, data, params);
|
|
11597
|
+
inst.encodeAsync = async (data, params) => encodeAsync2(inst, data, params);
|
|
11598
|
+
inst.decodeAsync = async (data, params) => decodeAsync2(inst, data, params);
|
|
11599
|
+
inst.safeEncode = (data, params) => safeEncode2(inst, data, params);
|
|
11600
|
+
inst.safeDecode = (data, params) => safeDecode2(inst, data, params);
|
|
11601
|
+
inst.safeEncodeAsync = async (data, params) => safeEncodeAsync2(inst, data, params);
|
|
11602
|
+
inst.safeDecodeAsync = async (data, params) => safeDecodeAsync2(inst, data, params);
|
|
11603
|
+
inst.refine = (check2, params) => inst.check(refine(check2, params));
|
|
8613
11604
|
inst.superRefine = (refinement) => inst.check(superRefine(refinement));
|
|
8614
11605
|
inst.overwrite = (fn) => inst.check(_overwrite(fn));
|
|
8615
11606
|
inst.optional = () => optional(inst);
|
|
@@ -8620,9 +11611,9 @@
|
|
|
8620
11611
|
inst.or = (arg) => union([inst, arg]);
|
|
8621
11612
|
inst.and = (arg) => intersection(inst, arg);
|
|
8622
11613
|
inst.transform = (tx) => pipe(inst, transform(tx));
|
|
8623
|
-
inst.default = (def2) =>
|
|
11614
|
+
inst.default = (def2) => _default2(inst, def2);
|
|
8624
11615
|
inst.prefault = (def2) => prefault(inst, def2);
|
|
8625
|
-
inst.catch = (params) =>
|
|
11616
|
+
inst.catch = (params) => _catch2(inst, params);
|
|
8626
11617
|
inst.pipe = (target) => pipe(inst, target);
|
|
8627
11618
|
inst.readonly = () => readonly(inst);
|
|
8628
11619
|
inst.describe = (description) => {
|
|
@@ -8712,78 +11703,172 @@
|
|
|
8712
11703
|
$ZodEmail.init(inst, def);
|
|
8713
11704
|
ZodStringFormat.init(inst, def);
|
|
8714
11705
|
});
|
|
11706
|
+
function email2(params) {
|
|
11707
|
+
return _email(ZodEmail, params);
|
|
11708
|
+
}
|
|
8715
11709
|
var ZodGUID = /* @__PURE__ */ $constructor("ZodGUID", (inst, def) => {
|
|
8716
11710
|
$ZodGUID.init(inst, def);
|
|
8717
11711
|
ZodStringFormat.init(inst, def);
|
|
8718
11712
|
});
|
|
11713
|
+
function guid2(params) {
|
|
11714
|
+
return _guid(ZodGUID, params);
|
|
11715
|
+
}
|
|
8719
11716
|
var ZodUUID = /* @__PURE__ */ $constructor("ZodUUID", (inst, def) => {
|
|
8720
11717
|
$ZodUUID.init(inst, def);
|
|
8721
11718
|
ZodStringFormat.init(inst, def);
|
|
8722
11719
|
});
|
|
11720
|
+
function uuid2(params) {
|
|
11721
|
+
return _uuid(ZodUUID, params);
|
|
11722
|
+
}
|
|
11723
|
+
function uuidv4(params) {
|
|
11724
|
+
return _uuidv4(ZodUUID, params);
|
|
11725
|
+
}
|
|
11726
|
+
function uuidv6(params) {
|
|
11727
|
+
return _uuidv6(ZodUUID, params);
|
|
11728
|
+
}
|
|
11729
|
+
function uuidv7(params) {
|
|
11730
|
+
return _uuidv7(ZodUUID, params);
|
|
11731
|
+
}
|
|
8723
11732
|
var ZodURL = /* @__PURE__ */ $constructor("ZodURL", (inst, def) => {
|
|
8724
11733
|
$ZodURL.init(inst, def);
|
|
8725
11734
|
ZodStringFormat.init(inst, def);
|
|
8726
11735
|
});
|
|
11736
|
+
function url(params) {
|
|
11737
|
+
return _url(ZodURL, params);
|
|
11738
|
+
}
|
|
11739
|
+
function httpUrl(params) {
|
|
11740
|
+
return _url(ZodURL, {
|
|
11741
|
+
protocol: /^https?$/,
|
|
11742
|
+
hostname: regexes_exports.domain,
|
|
11743
|
+
...util_exports.normalizeParams(params)
|
|
11744
|
+
});
|
|
11745
|
+
}
|
|
8727
11746
|
var ZodEmoji = /* @__PURE__ */ $constructor("ZodEmoji", (inst, def) => {
|
|
8728
11747
|
$ZodEmoji.init(inst, def);
|
|
8729
11748
|
ZodStringFormat.init(inst, def);
|
|
8730
11749
|
});
|
|
11750
|
+
function emoji2(params) {
|
|
11751
|
+
return _emoji2(ZodEmoji, params);
|
|
11752
|
+
}
|
|
8731
11753
|
var ZodNanoID = /* @__PURE__ */ $constructor("ZodNanoID", (inst, def) => {
|
|
8732
11754
|
$ZodNanoID.init(inst, def);
|
|
8733
11755
|
ZodStringFormat.init(inst, def);
|
|
8734
11756
|
});
|
|
11757
|
+
function nanoid2(params) {
|
|
11758
|
+
return _nanoid(ZodNanoID, params);
|
|
11759
|
+
}
|
|
8735
11760
|
var ZodCUID = /* @__PURE__ */ $constructor("ZodCUID", (inst, def) => {
|
|
8736
11761
|
$ZodCUID.init(inst, def);
|
|
8737
11762
|
ZodStringFormat.init(inst, def);
|
|
8738
11763
|
});
|
|
11764
|
+
function cuid3(params) {
|
|
11765
|
+
return _cuid(ZodCUID, params);
|
|
11766
|
+
}
|
|
8739
11767
|
var ZodCUID2 = /* @__PURE__ */ $constructor("ZodCUID2", (inst, def) => {
|
|
8740
11768
|
$ZodCUID2.init(inst, def);
|
|
8741
11769
|
ZodStringFormat.init(inst, def);
|
|
8742
11770
|
});
|
|
11771
|
+
function cuid22(params) {
|
|
11772
|
+
return _cuid2(ZodCUID2, params);
|
|
11773
|
+
}
|
|
8743
11774
|
var ZodULID = /* @__PURE__ */ $constructor("ZodULID", (inst, def) => {
|
|
8744
11775
|
$ZodULID.init(inst, def);
|
|
8745
11776
|
ZodStringFormat.init(inst, def);
|
|
8746
11777
|
});
|
|
11778
|
+
function ulid2(params) {
|
|
11779
|
+
return _ulid(ZodULID, params);
|
|
11780
|
+
}
|
|
8747
11781
|
var ZodXID = /* @__PURE__ */ $constructor("ZodXID", (inst, def) => {
|
|
8748
11782
|
$ZodXID.init(inst, def);
|
|
8749
11783
|
ZodStringFormat.init(inst, def);
|
|
8750
11784
|
});
|
|
11785
|
+
function xid2(params) {
|
|
11786
|
+
return _xid(ZodXID, params);
|
|
11787
|
+
}
|
|
8751
11788
|
var ZodKSUID = /* @__PURE__ */ $constructor("ZodKSUID", (inst, def) => {
|
|
8752
11789
|
$ZodKSUID.init(inst, def);
|
|
8753
11790
|
ZodStringFormat.init(inst, def);
|
|
8754
11791
|
});
|
|
11792
|
+
function ksuid2(params) {
|
|
11793
|
+
return _ksuid(ZodKSUID, params);
|
|
11794
|
+
}
|
|
8755
11795
|
var ZodIPv4 = /* @__PURE__ */ $constructor("ZodIPv4", (inst, def) => {
|
|
8756
11796
|
$ZodIPv4.init(inst, def);
|
|
8757
11797
|
ZodStringFormat.init(inst, def);
|
|
8758
11798
|
});
|
|
11799
|
+
function ipv42(params) {
|
|
11800
|
+
return _ipv4(ZodIPv4, params);
|
|
11801
|
+
}
|
|
8759
11802
|
var ZodIPv6 = /* @__PURE__ */ $constructor("ZodIPv6", (inst, def) => {
|
|
8760
11803
|
$ZodIPv6.init(inst, def);
|
|
8761
11804
|
ZodStringFormat.init(inst, def);
|
|
8762
11805
|
});
|
|
11806
|
+
function ipv62(params) {
|
|
11807
|
+
return _ipv6(ZodIPv6, params);
|
|
11808
|
+
}
|
|
8763
11809
|
var ZodCIDRv4 = /* @__PURE__ */ $constructor("ZodCIDRv4", (inst, def) => {
|
|
8764
11810
|
$ZodCIDRv4.init(inst, def);
|
|
8765
11811
|
ZodStringFormat.init(inst, def);
|
|
8766
11812
|
});
|
|
11813
|
+
function cidrv42(params) {
|
|
11814
|
+
return _cidrv4(ZodCIDRv4, params);
|
|
11815
|
+
}
|
|
8767
11816
|
var ZodCIDRv6 = /* @__PURE__ */ $constructor("ZodCIDRv6", (inst, def) => {
|
|
8768
11817
|
$ZodCIDRv6.init(inst, def);
|
|
8769
11818
|
ZodStringFormat.init(inst, def);
|
|
8770
11819
|
});
|
|
11820
|
+
function cidrv62(params) {
|
|
11821
|
+
return _cidrv6(ZodCIDRv6, params);
|
|
11822
|
+
}
|
|
8771
11823
|
var ZodBase64 = /* @__PURE__ */ $constructor("ZodBase64", (inst, def) => {
|
|
8772
11824
|
$ZodBase64.init(inst, def);
|
|
8773
11825
|
ZodStringFormat.init(inst, def);
|
|
8774
11826
|
});
|
|
11827
|
+
function base642(params) {
|
|
11828
|
+
return _base64(ZodBase64, params);
|
|
11829
|
+
}
|
|
8775
11830
|
var ZodBase64URL = /* @__PURE__ */ $constructor("ZodBase64URL", (inst, def) => {
|
|
8776
11831
|
$ZodBase64URL.init(inst, def);
|
|
8777
11832
|
ZodStringFormat.init(inst, def);
|
|
8778
11833
|
});
|
|
11834
|
+
function base64url2(params) {
|
|
11835
|
+
return _base64url(ZodBase64URL, params);
|
|
11836
|
+
}
|
|
8779
11837
|
var ZodE164 = /* @__PURE__ */ $constructor("ZodE164", (inst, def) => {
|
|
8780
11838
|
$ZodE164.init(inst, def);
|
|
8781
11839
|
ZodStringFormat.init(inst, def);
|
|
8782
11840
|
});
|
|
11841
|
+
function e1642(params) {
|
|
11842
|
+
return _e164(ZodE164, params);
|
|
11843
|
+
}
|
|
8783
11844
|
var ZodJWT = /* @__PURE__ */ $constructor("ZodJWT", (inst, def) => {
|
|
8784
11845
|
$ZodJWT.init(inst, def);
|
|
8785
11846
|
ZodStringFormat.init(inst, def);
|
|
8786
11847
|
});
|
|
11848
|
+
function jwt(params) {
|
|
11849
|
+
return _jwt(ZodJWT, params);
|
|
11850
|
+
}
|
|
11851
|
+
var ZodCustomStringFormat = /* @__PURE__ */ $constructor("ZodCustomStringFormat", (inst, def) => {
|
|
11852
|
+
$ZodCustomStringFormat.init(inst, def);
|
|
11853
|
+
ZodStringFormat.init(inst, def);
|
|
11854
|
+
});
|
|
11855
|
+
function stringFormat(format, fnOrRegex, _params = {}) {
|
|
11856
|
+
return _stringFormat(ZodCustomStringFormat, format, fnOrRegex, _params);
|
|
11857
|
+
}
|
|
11858
|
+
function hostname2(_params) {
|
|
11859
|
+
return _stringFormat(ZodCustomStringFormat, "hostname", regexes_exports.hostname, _params);
|
|
11860
|
+
}
|
|
11861
|
+
function hex2(_params) {
|
|
11862
|
+
return _stringFormat(ZodCustomStringFormat, "hex", regexes_exports.hex, _params);
|
|
11863
|
+
}
|
|
11864
|
+
function hash(alg, params) {
|
|
11865
|
+
const enc = params?.enc ?? "hex";
|
|
11866
|
+
const format = `${alg}_${enc}`;
|
|
11867
|
+
const regex = regexes_exports[format];
|
|
11868
|
+
if (!regex)
|
|
11869
|
+
throw new Error(`Unrecognized hash format: ${format}`);
|
|
11870
|
+
return _stringFormat(ZodCustomStringFormat, format, regex, params);
|
|
11871
|
+
}
|
|
8787
11872
|
var ZodNumber = /* @__PURE__ */ $constructor("ZodNumber", (inst, def) => {
|
|
8788
11873
|
$ZodNumber.init(inst, def);
|
|
8789
11874
|
ZodType.init(inst, def);
|
|
@@ -8819,6 +11904,25 @@
|
|
|
8819
11904
|
function int(params) {
|
|
8820
11905
|
return _int(ZodNumberFormat, params);
|
|
8821
11906
|
}
|
|
11907
|
+
function float32(params) {
|
|
11908
|
+
return _float32(ZodNumberFormat, params);
|
|
11909
|
+
}
|
|
11910
|
+
function float64(params) {
|
|
11911
|
+
return _float64(ZodNumberFormat, params);
|
|
11912
|
+
}
|
|
11913
|
+
function int32(params) {
|
|
11914
|
+
return _int32(ZodNumberFormat, params);
|
|
11915
|
+
}
|
|
11916
|
+
function uint32(params) {
|
|
11917
|
+
return _uint32(ZodNumberFormat, params);
|
|
11918
|
+
}
|
|
11919
|
+
var ZodBoolean = /* @__PURE__ */ $constructor("ZodBoolean", (inst, def) => {
|
|
11920
|
+
$ZodBoolean.init(inst, def);
|
|
11921
|
+
ZodType.init(inst, def);
|
|
11922
|
+
});
|
|
11923
|
+
function boolean2(params) {
|
|
11924
|
+
return _boolean(ZodBoolean, params);
|
|
11925
|
+
}
|
|
8822
11926
|
var ZodBigInt = /* @__PURE__ */ $constructor("ZodBigInt", (inst, def) => {
|
|
8823
11927
|
$ZodBigInt.init(inst, def);
|
|
8824
11928
|
ZodType.init(inst, def);
|
|
@@ -8843,6 +11947,77 @@
|
|
|
8843
11947
|
function bigint2(params) {
|
|
8844
11948
|
return _bigint(ZodBigInt, params);
|
|
8845
11949
|
}
|
|
11950
|
+
var ZodBigIntFormat = /* @__PURE__ */ $constructor("ZodBigIntFormat", (inst, def) => {
|
|
11951
|
+
$ZodBigIntFormat.init(inst, def);
|
|
11952
|
+
ZodBigInt.init(inst, def);
|
|
11953
|
+
});
|
|
11954
|
+
function int64(params) {
|
|
11955
|
+
return _int64(ZodBigIntFormat, params);
|
|
11956
|
+
}
|
|
11957
|
+
function uint64(params) {
|
|
11958
|
+
return _uint64(ZodBigIntFormat, params);
|
|
11959
|
+
}
|
|
11960
|
+
var ZodSymbol = /* @__PURE__ */ $constructor("ZodSymbol", (inst, def) => {
|
|
11961
|
+
$ZodSymbol.init(inst, def);
|
|
11962
|
+
ZodType.init(inst, def);
|
|
11963
|
+
});
|
|
11964
|
+
function symbol(params) {
|
|
11965
|
+
return _symbol(ZodSymbol, params);
|
|
11966
|
+
}
|
|
11967
|
+
var ZodUndefined = /* @__PURE__ */ $constructor("ZodUndefined", (inst, def) => {
|
|
11968
|
+
$ZodUndefined.init(inst, def);
|
|
11969
|
+
ZodType.init(inst, def);
|
|
11970
|
+
});
|
|
11971
|
+
function _undefined3(params) {
|
|
11972
|
+
return _undefined2(ZodUndefined, params);
|
|
11973
|
+
}
|
|
11974
|
+
var ZodNull = /* @__PURE__ */ $constructor("ZodNull", (inst, def) => {
|
|
11975
|
+
$ZodNull.init(inst, def);
|
|
11976
|
+
ZodType.init(inst, def);
|
|
11977
|
+
});
|
|
11978
|
+
function _null3(params) {
|
|
11979
|
+
return _null2(ZodNull, params);
|
|
11980
|
+
}
|
|
11981
|
+
var ZodAny = /* @__PURE__ */ $constructor("ZodAny", (inst, def) => {
|
|
11982
|
+
$ZodAny.init(inst, def);
|
|
11983
|
+
ZodType.init(inst, def);
|
|
11984
|
+
});
|
|
11985
|
+
function any() {
|
|
11986
|
+
return _any(ZodAny);
|
|
11987
|
+
}
|
|
11988
|
+
var ZodUnknown = /* @__PURE__ */ $constructor("ZodUnknown", (inst, def) => {
|
|
11989
|
+
$ZodUnknown.init(inst, def);
|
|
11990
|
+
ZodType.init(inst, def);
|
|
11991
|
+
});
|
|
11992
|
+
function unknown() {
|
|
11993
|
+
return _unknown(ZodUnknown);
|
|
11994
|
+
}
|
|
11995
|
+
var ZodNever = /* @__PURE__ */ $constructor("ZodNever", (inst, def) => {
|
|
11996
|
+
$ZodNever.init(inst, def);
|
|
11997
|
+
ZodType.init(inst, def);
|
|
11998
|
+
});
|
|
11999
|
+
function never(params) {
|
|
12000
|
+
return _never(ZodNever, params);
|
|
12001
|
+
}
|
|
12002
|
+
var ZodVoid = /* @__PURE__ */ $constructor("ZodVoid", (inst, def) => {
|
|
12003
|
+
$ZodVoid.init(inst, def);
|
|
12004
|
+
ZodType.init(inst, def);
|
|
12005
|
+
});
|
|
12006
|
+
function _void2(params) {
|
|
12007
|
+
return _void(ZodVoid, params);
|
|
12008
|
+
}
|
|
12009
|
+
var ZodDate = /* @__PURE__ */ $constructor("ZodDate", (inst, def) => {
|
|
12010
|
+
$ZodDate.init(inst, def);
|
|
12011
|
+
ZodType.init(inst, def);
|
|
12012
|
+
inst.min = (value, params) => inst.check(_gte(value, params));
|
|
12013
|
+
inst.max = (value, params) => inst.check(_lte(value, params));
|
|
12014
|
+
const c = inst._zod.bag;
|
|
12015
|
+
inst.minDate = c.minimum ? new Date(c.minimum) : null;
|
|
12016
|
+
inst.maxDate = c.maximum ? new Date(c.maximum) : null;
|
|
12017
|
+
});
|
|
12018
|
+
function date3(params) {
|
|
12019
|
+
return _date(ZodDate, params);
|
|
12020
|
+
}
|
|
8846
12021
|
var ZodArray = /* @__PURE__ */ $constructor("ZodArray", (inst, def) => {
|
|
8847
12022
|
$ZodArray.init(inst, def);
|
|
8848
12023
|
ZodType.init(inst, def);
|
|
@@ -8856,6 +12031,58 @@
|
|
|
8856
12031
|
function array(element, params) {
|
|
8857
12032
|
return _array(ZodArray, element, params);
|
|
8858
12033
|
}
|
|
12034
|
+
function keyof(schema) {
|
|
12035
|
+
const shape = schema._zod.def.shape;
|
|
12036
|
+
return _enum2(Object.keys(shape));
|
|
12037
|
+
}
|
|
12038
|
+
var ZodObject = /* @__PURE__ */ $constructor("ZodObject", (inst, def) => {
|
|
12039
|
+
$ZodObjectJIT.init(inst, def);
|
|
12040
|
+
ZodType.init(inst, def);
|
|
12041
|
+
util_exports.defineLazy(inst, "shape", () => {
|
|
12042
|
+
return def.shape;
|
|
12043
|
+
});
|
|
12044
|
+
inst.keyof = () => _enum2(Object.keys(inst._zod.def.shape));
|
|
12045
|
+
inst.catchall = (catchall) => inst.clone({ ...inst._zod.def, catchall });
|
|
12046
|
+
inst.passthrough = () => inst.clone({ ...inst._zod.def, catchall: unknown() });
|
|
12047
|
+
inst.loose = () => inst.clone({ ...inst._zod.def, catchall: unknown() });
|
|
12048
|
+
inst.strict = () => inst.clone({ ...inst._zod.def, catchall: never() });
|
|
12049
|
+
inst.strip = () => inst.clone({ ...inst._zod.def, catchall: void 0 });
|
|
12050
|
+
inst.extend = (incoming) => {
|
|
12051
|
+
return util_exports.extend(inst, incoming);
|
|
12052
|
+
};
|
|
12053
|
+
inst.safeExtend = (incoming) => {
|
|
12054
|
+
return util_exports.safeExtend(inst, incoming);
|
|
12055
|
+
};
|
|
12056
|
+
inst.merge = (other) => util_exports.merge(inst, other);
|
|
12057
|
+
inst.pick = (mask) => util_exports.pick(inst, mask);
|
|
12058
|
+
inst.omit = (mask) => util_exports.omit(inst, mask);
|
|
12059
|
+
inst.partial = (...args) => util_exports.partial(ZodOptional, inst, args[0]);
|
|
12060
|
+
inst.required = (...args) => util_exports.required(ZodNonOptional, inst, args[0]);
|
|
12061
|
+
});
|
|
12062
|
+
function object(shape, params) {
|
|
12063
|
+
const def = {
|
|
12064
|
+
type: "object",
|
|
12065
|
+
shape: shape ?? {},
|
|
12066
|
+
...util_exports.normalizeParams(params)
|
|
12067
|
+
};
|
|
12068
|
+
return new ZodObject(def);
|
|
12069
|
+
}
|
|
12070
|
+
function strictObject(shape, params) {
|
|
12071
|
+
return new ZodObject({
|
|
12072
|
+
type: "object",
|
|
12073
|
+
shape,
|
|
12074
|
+
catchall: never(),
|
|
12075
|
+
...util_exports.normalizeParams(params)
|
|
12076
|
+
});
|
|
12077
|
+
}
|
|
12078
|
+
function looseObject(shape, params) {
|
|
12079
|
+
return new ZodObject({
|
|
12080
|
+
type: "object",
|
|
12081
|
+
shape,
|
|
12082
|
+
catchall: unknown(),
|
|
12083
|
+
...util_exports.normalizeParams(params)
|
|
12084
|
+
});
|
|
12085
|
+
}
|
|
8859
12086
|
var ZodUnion = /* @__PURE__ */ $constructor("ZodUnion", (inst, def) => {
|
|
8860
12087
|
$ZodUnion.init(inst, def);
|
|
8861
12088
|
ZodType.init(inst, def);
|
|
@@ -8868,6 +12095,18 @@
|
|
|
8868
12095
|
...util_exports.normalizeParams(params)
|
|
8869
12096
|
});
|
|
8870
12097
|
}
|
|
12098
|
+
var ZodDiscriminatedUnion = /* @__PURE__ */ $constructor("ZodDiscriminatedUnion", (inst, def) => {
|
|
12099
|
+
ZodUnion.init(inst, def);
|
|
12100
|
+
$ZodDiscriminatedUnion.init(inst, def);
|
|
12101
|
+
});
|
|
12102
|
+
function discriminatedUnion(discriminator, options, params) {
|
|
12103
|
+
return new ZodDiscriminatedUnion({
|
|
12104
|
+
type: "union",
|
|
12105
|
+
options,
|
|
12106
|
+
discriminator,
|
|
12107
|
+
...util_exports.normalizeParams(params)
|
|
12108
|
+
});
|
|
12109
|
+
}
|
|
8871
12110
|
var ZodIntersection = /* @__PURE__ */ $constructor("ZodIntersection", (inst, def) => {
|
|
8872
12111
|
$ZodIntersection.init(inst, def);
|
|
8873
12112
|
ZodType.init(inst, def);
|
|
@@ -8879,6 +12118,160 @@
|
|
|
8879
12118
|
right
|
|
8880
12119
|
});
|
|
8881
12120
|
}
|
|
12121
|
+
var ZodTuple = /* @__PURE__ */ $constructor("ZodTuple", (inst, def) => {
|
|
12122
|
+
$ZodTuple.init(inst, def);
|
|
12123
|
+
ZodType.init(inst, def);
|
|
12124
|
+
inst.rest = (rest) => inst.clone({
|
|
12125
|
+
...inst._zod.def,
|
|
12126
|
+
rest
|
|
12127
|
+
});
|
|
12128
|
+
});
|
|
12129
|
+
function tuple(items, _paramsOrRest, _params) {
|
|
12130
|
+
const hasRest = _paramsOrRest instanceof $ZodType;
|
|
12131
|
+
const params = hasRest ? _params : _paramsOrRest;
|
|
12132
|
+
const rest = hasRest ? _paramsOrRest : null;
|
|
12133
|
+
return new ZodTuple({
|
|
12134
|
+
type: "tuple",
|
|
12135
|
+
items,
|
|
12136
|
+
rest,
|
|
12137
|
+
...util_exports.normalizeParams(params)
|
|
12138
|
+
});
|
|
12139
|
+
}
|
|
12140
|
+
var ZodRecord = /* @__PURE__ */ $constructor("ZodRecord", (inst, def) => {
|
|
12141
|
+
$ZodRecord.init(inst, def);
|
|
12142
|
+
ZodType.init(inst, def);
|
|
12143
|
+
inst.keyType = def.keyType;
|
|
12144
|
+
inst.valueType = def.valueType;
|
|
12145
|
+
});
|
|
12146
|
+
function record(keyType, valueType, params) {
|
|
12147
|
+
return new ZodRecord({
|
|
12148
|
+
type: "record",
|
|
12149
|
+
keyType,
|
|
12150
|
+
valueType,
|
|
12151
|
+
...util_exports.normalizeParams(params)
|
|
12152
|
+
});
|
|
12153
|
+
}
|
|
12154
|
+
function partialRecord(keyType, valueType, params) {
|
|
12155
|
+
const k = clone(keyType);
|
|
12156
|
+
k._zod.values = void 0;
|
|
12157
|
+
return new ZodRecord({
|
|
12158
|
+
type: "record",
|
|
12159
|
+
keyType: k,
|
|
12160
|
+
valueType,
|
|
12161
|
+
...util_exports.normalizeParams(params)
|
|
12162
|
+
});
|
|
12163
|
+
}
|
|
12164
|
+
var ZodMap = /* @__PURE__ */ $constructor("ZodMap", (inst, def) => {
|
|
12165
|
+
$ZodMap.init(inst, def);
|
|
12166
|
+
ZodType.init(inst, def);
|
|
12167
|
+
inst.keyType = def.keyType;
|
|
12168
|
+
inst.valueType = def.valueType;
|
|
12169
|
+
});
|
|
12170
|
+
function map(keyType, valueType, params) {
|
|
12171
|
+
return new ZodMap({
|
|
12172
|
+
type: "map",
|
|
12173
|
+
keyType,
|
|
12174
|
+
valueType,
|
|
12175
|
+
...util_exports.normalizeParams(params)
|
|
12176
|
+
});
|
|
12177
|
+
}
|
|
12178
|
+
var ZodSet = /* @__PURE__ */ $constructor("ZodSet", (inst, def) => {
|
|
12179
|
+
$ZodSet.init(inst, def);
|
|
12180
|
+
ZodType.init(inst, def);
|
|
12181
|
+
inst.min = (...args) => inst.check(_minSize(...args));
|
|
12182
|
+
inst.nonempty = (params) => inst.check(_minSize(1, params));
|
|
12183
|
+
inst.max = (...args) => inst.check(_maxSize(...args));
|
|
12184
|
+
inst.size = (...args) => inst.check(_size(...args));
|
|
12185
|
+
});
|
|
12186
|
+
function set(valueType, params) {
|
|
12187
|
+
return new ZodSet({
|
|
12188
|
+
type: "set",
|
|
12189
|
+
valueType,
|
|
12190
|
+
...util_exports.normalizeParams(params)
|
|
12191
|
+
});
|
|
12192
|
+
}
|
|
12193
|
+
var ZodEnum = /* @__PURE__ */ $constructor("ZodEnum", (inst, def) => {
|
|
12194
|
+
$ZodEnum.init(inst, def);
|
|
12195
|
+
ZodType.init(inst, def);
|
|
12196
|
+
inst.enum = def.entries;
|
|
12197
|
+
inst.options = Object.values(def.entries);
|
|
12198
|
+
const keys = new Set(Object.keys(def.entries));
|
|
12199
|
+
inst.extract = (values, params) => {
|
|
12200
|
+
const newEntries = {};
|
|
12201
|
+
for (const value of values) {
|
|
12202
|
+
if (keys.has(value)) {
|
|
12203
|
+
newEntries[value] = def.entries[value];
|
|
12204
|
+
} else
|
|
12205
|
+
throw new Error(`Key ${value} not found in enum`);
|
|
12206
|
+
}
|
|
12207
|
+
return new ZodEnum({
|
|
12208
|
+
...def,
|
|
12209
|
+
checks: [],
|
|
12210
|
+
...util_exports.normalizeParams(params),
|
|
12211
|
+
entries: newEntries
|
|
12212
|
+
});
|
|
12213
|
+
};
|
|
12214
|
+
inst.exclude = (values, params) => {
|
|
12215
|
+
const newEntries = { ...def.entries };
|
|
12216
|
+
for (const value of values) {
|
|
12217
|
+
if (keys.has(value)) {
|
|
12218
|
+
delete newEntries[value];
|
|
12219
|
+
} else
|
|
12220
|
+
throw new Error(`Key ${value} not found in enum`);
|
|
12221
|
+
}
|
|
12222
|
+
return new ZodEnum({
|
|
12223
|
+
...def,
|
|
12224
|
+
checks: [],
|
|
12225
|
+
...util_exports.normalizeParams(params),
|
|
12226
|
+
entries: newEntries
|
|
12227
|
+
});
|
|
12228
|
+
};
|
|
12229
|
+
});
|
|
12230
|
+
function _enum2(values, params) {
|
|
12231
|
+
const entries = Array.isArray(values) ? Object.fromEntries(values.map((v) => [v, v])) : values;
|
|
12232
|
+
return new ZodEnum({
|
|
12233
|
+
type: "enum",
|
|
12234
|
+
entries,
|
|
12235
|
+
...util_exports.normalizeParams(params)
|
|
12236
|
+
});
|
|
12237
|
+
}
|
|
12238
|
+
function nativeEnum(entries, params) {
|
|
12239
|
+
return new ZodEnum({
|
|
12240
|
+
type: "enum",
|
|
12241
|
+
entries,
|
|
12242
|
+
...util_exports.normalizeParams(params)
|
|
12243
|
+
});
|
|
12244
|
+
}
|
|
12245
|
+
var ZodLiteral = /* @__PURE__ */ $constructor("ZodLiteral", (inst, def) => {
|
|
12246
|
+
$ZodLiteral.init(inst, def);
|
|
12247
|
+
ZodType.init(inst, def);
|
|
12248
|
+
inst.values = new Set(def.values);
|
|
12249
|
+
Object.defineProperty(inst, "value", {
|
|
12250
|
+
get() {
|
|
12251
|
+
if (def.values.length > 1) {
|
|
12252
|
+
throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");
|
|
12253
|
+
}
|
|
12254
|
+
return def.values[0];
|
|
12255
|
+
}
|
|
12256
|
+
});
|
|
12257
|
+
});
|
|
12258
|
+
function literal(value, params) {
|
|
12259
|
+
return new ZodLiteral({
|
|
12260
|
+
type: "literal",
|
|
12261
|
+
values: Array.isArray(value) ? value : [value],
|
|
12262
|
+
...util_exports.normalizeParams(params)
|
|
12263
|
+
});
|
|
12264
|
+
}
|
|
12265
|
+
var ZodFile = /* @__PURE__ */ $constructor("ZodFile", (inst, def) => {
|
|
12266
|
+
$ZodFile.init(inst, def);
|
|
12267
|
+
ZodType.init(inst, def);
|
|
12268
|
+
inst.min = (size, params) => inst.check(_minSize(size, params));
|
|
12269
|
+
inst.max = (size, params) => inst.check(_maxSize(size, params));
|
|
12270
|
+
inst.mime = (types, params) => inst.check(_mime(Array.isArray(types) ? types : [types], params));
|
|
12271
|
+
});
|
|
12272
|
+
function file(params) {
|
|
12273
|
+
return _file(ZodFile, params);
|
|
12274
|
+
}
|
|
8882
12275
|
var ZodTransform = /* @__PURE__ */ $constructor("ZodTransform", (inst, def) => {
|
|
8883
12276
|
$ZodTransform.init(inst, def);
|
|
8884
12277
|
ZodType.init(inst, def);
|
|
@@ -8938,13 +12331,16 @@
|
|
|
8938
12331
|
innerType
|
|
8939
12332
|
});
|
|
8940
12333
|
}
|
|
12334
|
+
function nullish2(innerType) {
|
|
12335
|
+
return optional(nullable(innerType));
|
|
12336
|
+
}
|
|
8941
12337
|
var ZodDefault = /* @__PURE__ */ $constructor("ZodDefault", (inst, def) => {
|
|
8942
12338
|
$ZodDefault.init(inst, def);
|
|
8943
12339
|
ZodType.init(inst, def);
|
|
8944
12340
|
inst.unwrap = () => inst._zod.def.innerType;
|
|
8945
12341
|
inst.removeDefault = inst.unwrap;
|
|
8946
12342
|
});
|
|
8947
|
-
function
|
|
12343
|
+
function _default2(innerType, defaultValue) {
|
|
8948
12344
|
return new ZodDefault({
|
|
8949
12345
|
type: "default",
|
|
8950
12346
|
innerType,
|
|
@@ -8979,19 +12375,37 @@
|
|
|
8979
12375
|
...util_exports.normalizeParams(params)
|
|
8980
12376
|
});
|
|
8981
12377
|
}
|
|
12378
|
+
var ZodSuccess = /* @__PURE__ */ $constructor("ZodSuccess", (inst, def) => {
|
|
12379
|
+
$ZodSuccess.init(inst, def);
|
|
12380
|
+
ZodType.init(inst, def);
|
|
12381
|
+
inst.unwrap = () => inst._zod.def.innerType;
|
|
12382
|
+
});
|
|
12383
|
+
function success(innerType) {
|
|
12384
|
+
return new ZodSuccess({
|
|
12385
|
+
type: "success",
|
|
12386
|
+
innerType
|
|
12387
|
+
});
|
|
12388
|
+
}
|
|
8982
12389
|
var ZodCatch = /* @__PURE__ */ $constructor("ZodCatch", (inst, def) => {
|
|
8983
12390
|
$ZodCatch.init(inst, def);
|
|
8984
12391
|
ZodType.init(inst, def);
|
|
8985
12392
|
inst.unwrap = () => inst._zod.def.innerType;
|
|
8986
12393
|
inst.removeCatch = inst.unwrap;
|
|
8987
12394
|
});
|
|
8988
|
-
function
|
|
12395
|
+
function _catch2(innerType, catchValue) {
|
|
8989
12396
|
return new ZodCatch({
|
|
8990
12397
|
type: "catch",
|
|
8991
12398
|
innerType,
|
|
8992
12399
|
catchValue: typeof catchValue === "function" ? catchValue : () => catchValue
|
|
8993
12400
|
});
|
|
8994
12401
|
}
|
|
12402
|
+
var ZodNaN = /* @__PURE__ */ $constructor("ZodNaN", (inst, def) => {
|
|
12403
|
+
$ZodNaN.init(inst, def);
|
|
12404
|
+
ZodType.init(inst, def);
|
|
12405
|
+
});
|
|
12406
|
+
function nan(params) {
|
|
12407
|
+
return _nan(ZodNaN, params);
|
|
12408
|
+
}
|
|
8995
12409
|
var ZodPipe = /* @__PURE__ */ $constructor("ZodPipe", (inst, def) => {
|
|
8996
12410
|
$ZodPipe.init(inst, def);
|
|
8997
12411
|
ZodType.init(inst, def);
|
|
@@ -9006,6 +12420,19 @@
|
|
|
9006
12420
|
// ...util.normalizeParams(params),
|
|
9007
12421
|
});
|
|
9008
12422
|
}
|
|
12423
|
+
var ZodCodec = /* @__PURE__ */ $constructor("ZodCodec", (inst, def) => {
|
|
12424
|
+
ZodPipe.init(inst, def);
|
|
12425
|
+
$ZodCodec.init(inst, def);
|
|
12426
|
+
});
|
|
12427
|
+
function codec(in_, out, params) {
|
|
12428
|
+
return new ZodCodec({
|
|
12429
|
+
type: "pipe",
|
|
12430
|
+
in: in_,
|
|
12431
|
+
out,
|
|
12432
|
+
transform: params.decode,
|
|
12433
|
+
reverseTransform: params.encode
|
|
12434
|
+
});
|
|
12435
|
+
}
|
|
9009
12436
|
var ZodReadonly = /* @__PURE__ */ $constructor("ZodReadonly", (inst, def) => {
|
|
9010
12437
|
$ZodReadonly.init(inst, def);
|
|
9011
12438
|
ZodType.init(inst, def);
|
|
@@ -9017,18 +12444,157 @@
|
|
|
9017
12444
|
innerType
|
|
9018
12445
|
});
|
|
9019
12446
|
}
|
|
12447
|
+
var ZodTemplateLiteral = /* @__PURE__ */ $constructor("ZodTemplateLiteral", (inst, def) => {
|
|
12448
|
+
$ZodTemplateLiteral.init(inst, def);
|
|
12449
|
+
ZodType.init(inst, def);
|
|
12450
|
+
});
|
|
12451
|
+
function templateLiteral(parts, params) {
|
|
12452
|
+
return new ZodTemplateLiteral({
|
|
12453
|
+
type: "template_literal",
|
|
12454
|
+
parts,
|
|
12455
|
+
...util_exports.normalizeParams(params)
|
|
12456
|
+
});
|
|
12457
|
+
}
|
|
12458
|
+
var ZodLazy = /* @__PURE__ */ $constructor("ZodLazy", (inst, def) => {
|
|
12459
|
+
$ZodLazy.init(inst, def);
|
|
12460
|
+
ZodType.init(inst, def);
|
|
12461
|
+
inst.unwrap = () => inst._zod.def.getter();
|
|
12462
|
+
});
|
|
12463
|
+
function lazy(getter) {
|
|
12464
|
+
return new ZodLazy({
|
|
12465
|
+
type: "lazy",
|
|
12466
|
+
getter
|
|
12467
|
+
});
|
|
12468
|
+
}
|
|
12469
|
+
var ZodPromise = /* @__PURE__ */ $constructor("ZodPromise", (inst, def) => {
|
|
12470
|
+
$ZodPromise.init(inst, def);
|
|
12471
|
+
ZodType.init(inst, def);
|
|
12472
|
+
inst.unwrap = () => inst._zod.def.innerType;
|
|
12473
|
+
});
|
|
12474
|
+
function promise(innerType) {
|
|
12475
|
+
return new ZodPromise({
|
|
12476
|
+
type: "promise",
|
|
12477
|
+
innerType
|
|
12478
|
+
});
|
|
12479
|
+
}
|
|
12480
|
+
var ZodFunction = /* @__PURE__ */ $constructor("ZodFunction", (inst, def) => {
|
|
12481
|
+
$ZodFunction.init(inst, def);
|
|
12482
|
+
ZodType.init(inst, def);
|
|
12483
|
+
});
|
|
12484
|
+
function _function(params) {
|
|
12485
|
+
return new ZodFunction({
|
|
12486
|
+
type: "function",
|
|
12487
|
+
input: Array.isArray(params?.input) ? tuple(params?.input) : params?.input ?? array(unknown()),
|
|
12488
|
+
output: params?.output ?? unknown()
|
|
12489
|
+
});
|
|
12490
|
+
}
|
|
9020
12491
|
var ZodCustom = /* @__PURE__ */ $constructor("ZodCustom", (inst, def) => {
|
|
9021
12492
|
$ZodCustom.init(inst, def);
|
|
9022
12493
|
ZodType.init(inst, def);
|
|
9023
12494
|
});
|
|
12495
|
+
function check(fn) {
|
|
12496
|
+
const ch = new $ZodCheck({
|
|
12497
|
+
check: "custom"
|
|
12498
|
+
// ...util.normalizeParams(params),
|
|
12499
|
+
});
|
|
12500
|
+
ch._zod.check = fn;
|
|
12501
|
+
return ch;
|
|
12502
|
+
}
|
|
12503
|
+
function custom(fn, _params) {
|
|
12504
|
+
return _custom(ZodCustom, fn ?? (() => true), _params);
|
|
12505
|
+
}
|
|
9024
12506
|
function refine(fn, _params = {}) {
|
|
9025
12507
|
return _refine(ZodCustom, fn, _params);
|
|
9026
12508
|
}
|
|
9027
12509
|
function superRefine(fn) {
|
|
9028
12510
|
return _superRefine(fn);
|
|
9029
12511
|
}
|
|
12512
|
+
function _instanceof(cls, params = {
|
|
12513
|
+
error: `Input not instance of ${cls.name}`
|
|
12514
|
+
}) {
|
|
12515
|
+
const inst = new ZodCustom({
|
|
12516
|
+
type: "custom",
|
|
12517
|
+
check: "custom",
|
|
12518
|
+
fn: (data) => data instanceof cls,
|
|
12519
|
+
abort: true,
|
|
12520
|
+
...util_exports.normalizeParams(params)
|
|
12521
|
+
});
|
|
12522
|
+
inst._zod.bag.Class = cls;
|
|
12523
|
+
return inst;
|
|
12524
|
+
}
|
|
12525
|
+
var stringbool = (...args) => _stringbool({
|
|
12526
|
+
Codec: ZodCodec,
|
|
12527
|
+
Boolean: ZodBoolean,
|
|
12528
|
+
String: ZodString
|
|
12529
|
+
}, ...args);
|
|
12530
|
+
function json(params) {
|
|
12531
|
+
const jsonSchema = lazy(() => {
|
|
12532
|
+
return union([string2(params), number2(), boolean2(), _null3(), array(jsonSchema), record(string2(), jsonSchema)]);
|
|
12533
|
+
});
|
|
12534
|
+
return jsonSchema;
|
|
12535
|
+
}
|
|
12536
|
+
function preprocess(fn, schema) {
|
|
12537
|
+
return pipe(transform(fn), schema);
|
|
12538
|
+
}
|
|
12539
|
+
|
|
12540
|
+
// ../../../../../../node_modules/.store/zod-npm-4.1.12-8e1ffc4d68/package/v4/classic/compat.js
|
|
12541
|
+
var ZodIssueCode = {
|
|
12542
|
+
invalid_type: "invalid_type",
|
|
12543
|
+
too_big: "too_big",
|
|
12544
|
+
too_small: "too_small",
|
|
12545
|
+
invalid_format: "invalid_format",
|
|
12546
|
+
not_multiple_of: "not_multiple_of",
|
|
12547
|
+
unrecognized_keys: "unrecognized_keys",
|
|
12548
|
+
invalid_union: "invalid_union",
|
|
12549
|
+
invalid_key: "invalid_key",
|
|
12550
|
+
invalid_element: "invalid_element",
|
|
12551
|
+
invalid_value: "invalid_value",
|
|
12552
|
+
custom: "custom"
|
|
12553
|
+
};
|
|
12554
|
+
function setErrorMap(map2) {
|
|
12555
|
+
config({
|
|
12556
|
+
customError: map2
|
|
12557
|
+
});
|
|
12558
|
+
}
|
|
12559
|
+
function getErrorMap() {
|
|
12560
|
+
return config().customError;
|
|
12561
|
+
}
|
|
12562
|
+
var ZodFirstPartyTypeKind;
|
|
12563
|
+
/* @__PURE__ */ (function(ZodFirstPartyTypeKind2) {
|
|
12564
|
+
})(ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {}));
|
|
12565
|
+
|
|
12566
|
+
// ../../../../../../node_modules/.store/zod-npm-4.1.12-8e1ffc4d68/package/v4/classic/coerce.js
|
|
12567
|
+
var coerce_exports = {};
|
|
12568
|
+
__export(coerce_exports, {
|
|
12569
|
+
bigint: () => bigint3,
|
|
12570
|
+
boolean: () => boolean3,
|
|
12571
|
+
date: () => date4,
|
|
12572
|
+
number: () => number3,
|
|
12573
|
+
string: () => string3
|
|
12574
|
+
});
|
|
12575
|
+
function string3(params) {
|
|
12576
|
+
return _coercedString(ZodString, params);
|
|
12577
|
+
}
|
|
12578
|
+
function number3(params) {
|
|
12579
|
+
return _coercedNumber(ZodNumber, params);
|
|
12580
|
+
}
|
|
12581
|
+
function boolean3(params) {
|
|
12582
|
+
return _coercedBoolean(ZodBoolean, params);
|
|
12583
|
+
}
|
|
12584
|
+
function bigint3(params) {
|
|
12585
|
+
return _coercedBigint(ZodBigInt, params);
|
|
12586
|
+
}
|
|
12587
|
+
function date4(params) {
|
|
12588
|
+
return _coercedDate(ZodDate, params);
|
|
12589
|
+
}
|
|
12590
|
+
|
|
12591
|
+
// ../../../../../../node_modules/.store/zod-npm-4.1.12-8e1ffc4d68/package/v4/classic/external.js
|
|
12592
|
+
config(en_default());
|
|
12593
|
+
|
|
12594
|
+
// ../../../../../../node_modules/.store/zod-npm-4.1.12-8e1ffc4d68/package/index.js
|
|
12595
|
+
var package_default = external_exports;
|
|
9030
12596
|
|
|
9031
|
-
// ../../../../../../node_modules/.store/@xylabs-typeof-npm-5.0.
|
|
12597
|
+
// ../../../../../../node_modules/.store/@xylabs-typeof-npm-5.0.24-d111798ee6/package/dist/neutral/index.mjs
|
|
9032
12598
|
function isUndefined(value) {
|
|
9033
12599
|
return value === void 0;
|
|
9034
12600
|
}
|
|
@@ -9039,7 +12605,7 @@
|
|
|
9039
12605
|
return typeof value === "number";
|
|
9040
12606
|
}
|
|
9041
12607
|
|
|
9042
|
-
// ../../../../../../node_modules/.store/@xylabs-hex-npm-5.0.
|
|
12608
|
+
// ../../../../../../node_modules/.store/@xylabs-hex-npm-5.0.24-96a0124165/package/dist/neutral/index.mjs
|
|
9043
12609
|
var HexRegExMinMax = (minBytes = 0, maxBytes = Number.MAX_SAFE_INTEGER / 2) => {
|
|
9044
12610
|
return new RegExp(`^[a-f0-9]{${minBytes * 2},${maxBytes * 2}}$`);
|
|
9045
12611
|
};
|
|
@@ -9117,7 +12683,7 @@
|
|
|
9117
12683
|
}
|
|
9118
12684
|
}
|
|
9119
12685
|
};
|
|
9120
|
-
var HexZod =
|
|
12686
|
+
var HexZod = package_default.string().regex(HexRegEx, { message: "Invalid hex format" }).transform((val) => val);
|
|
9121
12687
|
var toHex = (value, config2 = {}) => {
|
|
9122
12688
|
const { prefix = false } = config2;
|
|
9123
12689
|
return hexFrom(value, { prefix, ...config2 });
|
|
@@ -9162,7 +12728,8 @@
|
|
|
9162
12728
|
};
|
|
9163
12729
|
var isEthAddress = (value, config2 = {}) => {
|
|
9164
12730
|
const { bitLength = 160, prefix = true } = config2;
|
|
9165
|
-
|
|
12731
|
+
const loweredValue = typeof value === "string" ? value.toLowerCase() : value;
|
|
12732
|
+
return isHex(loweredValue, { bitLength, prefix });
|
|
9166
12733
|
};
|
|
9167
12734
|
var EthAddressZod = string2().regex(EthAddressRegEx, { message: "Invalid address format" }).refine(
|
|
9168
12735
|
isEthAddress
|
|
@@ -9185,16 +12752,16 @@
|
|
|
9185
12752
|
}
|
|
9186
12753
|
var HASH_LENGTH = 32;
|
|
9187
12754
|
var HashRegEx = HexRegExMinMax(HASH_LENGTH, HASH_LENGTH);
|
|
9188
|
-
var HashZod = string2().regex(HashRegEx, { message: "Invalid hex format" });
|
|
12755
|
+
var HashZod = string2().regex(HashRegEx, { message: "Invalid hex format" }).transform((val) => val);
|
|
9189
12756
|
var HashToJsonZod = HashZod.transform((v) => v);
|
|
9190
12757
|
var JsonToHashZod = string2().transform((v) => asHash(v, true));
|
|
9191
|
-
function hexToBigInt(
|
|
9192
|
-
return BigInt(hexFromHexString(
|
|
12758
|
+
function hexToBigInt(hex3) {
|
|
12759
|
+
return BigInt(hexFromHexString(hex3, { prefix: true }));
|
|
9193
12760
|
}
|
|
9194
12761
|
var BigIntToJsonZod = bigint2().nonnegative().transform((x) => toHex(x));
|
|
9195
12762
|
var JsonToBigIntZod = string2().transform((x) => toHex(x)).transform((x) => hexToBigInt(x));
|
|
9196
12763
|
|
|
9197
|
-
// ../../../../../../node_modules/.store/@xylabs-threads-npm-5.0.
|
|
12764
|
+
// ../../../../../../node_modules/.store/@xylabs-threads-npm-5.0.24-8d65a89667/package/dist/browser/worker/worker.browser.mjs
|
|
9198
12765
|
var import_is_observable_2_1_0 = __toESM(require_package(), 1);
|
|
9199
12766
|
var DefaultErrorSerializer = {
|
|
9200
12767
|
deserialize(message) {
|
|
@@ -9619,8 +13186,8 @@
|
|
|
9619
13186
|
const loadWASMPromise = wasmMutex.dispatch(() => __awaiter(this, void 0, void 0, function* () {
|
|
9620
13187
|
if (!wasmModuleCache.has(binary.name)) {
|
|
9621
13188
|
const asm = decodeBase64(binary.data);
|
|
9622
|
-
const
|
|
9623
|
-
wasmModuleCache.set(binary.name,
|
|
13189
|
+
const promise2 = WebAssembly.compile(asm);
|
|
13190
|
+
wasmModuleCache.set(binary.name, promise2);
|
|
9624
13191
|
}
|
|
9625
13192
|
const module = yield wasmModuleCache.get(binary.name);
|
|
9626
13193
|
wasmInstance = yield WebAssembly.instantiate(module, {
|
|
@@ -9803,8 +13370,8 @@
|
|
|
9803
13370
|
});
|
|
9804
13371
|
}
|
|
9805
13372
|
try {
|
|
9806
|
-
const
|
|
9807
|
-
return Promise.resolve(
|
|
13373
|
+
const hash2 = wasmCache$9.calculate(data, 256);
|
|
13374
|
+
return Promise.resolve(hash2);
|
|
9808
13375
|
} catch (err) {
|
|
9809
13376
|
return Promise.reject(err);
|
|
9810
13377
|
}
|