@mettlelabs/mettle 0.0.0-beta.2-linux-arm64 → 0.0.0-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/mettle.js +53 -0
- package/bin/postinstall.js +28 -0
- package/package.json +19 -13
- package/THIRD_PARTY_NOTICES.md +0 -11974
- package/bin/mettle +0 -4
- package/harness/audit-investigation.mjs +0 -203
- package/harness/chunk-1sygmp11.mjs +0 -18142
- package/harness/chunk-1ykxpmaz.mjs +0 -7887
- package/harness/chunk-2pm2sayw.mjs +0 -248
- package/harness/chunk-3m7jn5ac.mjs +0 -16242
- package/harness/chunk-3wt8a8fq.mjs +0 -1716
- package/harness/chunk-3wvjs93w.mjs +0 -538
- package/harness/chunk-49ytr8d5.mjs +0 -33761
- package/harness/chunk-4bepyxmq.mjs +0 -113
- package/harness/chunk-4vx34w5h.mjs +0 -2357
- package/harness/chunk-50sbrf09.mjs +0 -18972
- package/harness/chunk-56csr8sw.mjs +0 -322
- package/harness/chunk-5wgmv4np.mjs +0 -585
- package/harness/chunk-65eyq32y.mjs +0 -225
- package/harness/chunk-6fnh6qhk.mjs +0 -195
- package/harness/chunk-6kgqw9ny.mjs +0 -32303
- package/harness/chunk-7b242j0n.mjs +0 -14
- package/harness/chunk-9dg1btk1.mjs +0 -2818
- package/harness/chunk-ageqxj9v.mjs +0 -63008
- package/harness/chunk-b0qbt5jd.mjs +0 -14
- package/harness/chunk-b5g1r3fz.mjs +0 -4785
- package/harness/chunk-b71gpkxg.mjs +0 -1514
- package/harness/chunk-bdv1rx4a.mjs +0 -20364
- package/harness/chunk-c1631s2x.mjs +0 -12241
- package/harness/chunk-c7dx5mdd.mjs +0 -10807
- package/harness/chunk-d5xgxsnp.mjs +0 -74
- package/harness/chunk-erg1fbh0.mjs +0 -0
- package/harness/chunk-fh78v9vn.mjs +0 -19366
- package/harness/chunk-fjx29qvp.mjs +0 -50
- package/harness/chunk-gryka6kg.mjs +0 -39
- package/harness/chunk-h1td5kq9.mjs +0 -422
- package/harness/chunk-jb0r19et.mjs +0 -180
- package/harness/chunk-jp69h6sj.mjs +0 -95
- package/harness/chunk-mfn574ss.mjs +0 -179
- package/harness/chunk-nz5sv9as.mjs +0 -1642
- package/harness/chunk-p9d3cgvq.mjs +0 -452
- package/harness/chunk-pq6wvwxr.mjs +0 -12
- package/harness/chunk-qcm9arf8.mjs +0 -7736
- package/harness/chunk-qr8zfqjd.mjs +0 -24
- package/harness/chunk-rd80vvc5.mjs +0 -22047
- package/harness/chunk-rz2tz6jp.mjs +0 -26
- package/harness/chunk-sbkgc3kn.mjs +0 -8
- package/harness/chunk-v66qvpnb.mjs +0 -169
- package/harness/chunk-vjaxzab3.mjs +0 -136
- package/harness/chunk-vr1n5nza.mjs +0 -1045
- package/harness/chunk-vsf2zajv.mjs +0 -3867
- package/harness/chunk-w0qwc5z2.mjs +0 -41
- package/harness/chunk-wq253fj4.mjs +0 -19041
- package/harness/chunk-wyv7ceq4.mjs +0 -0
- package/harness/chunk-xnqknk2r.mjs +0 -198
- package/harness/chunk-z6n9thea.mjs +0 -45146
- package/harness/chunk-zty0d3bw.mjs +0 -0
- package/harness/chunk-zvkxtj82.mjs +0 -42
- package/harness/issue-api-token.mjs +0 -35
- package/harness/launcher.mjs +0 -459
- package/harness/sandbox.mjs +0 -133
- package/harness/server.mjs +0 -87314
|
@@ -1,1514 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
toZod,
|
|
3
|
-
assignProp,
|
|
4
|
-
mergeDefs,
|
|
5
|
-
isPlainObject,
|
|
6
|
-
clone,
|
|
7
|
-
exports_util,
|
|
8
|
-
NEVER,
|
|
9
|
-
$brand,
|
|
10
|
-
config,
|
|
11
|
-
flattenError,
|
|
12
|
-
formatError,
|
|
13
|
-
treeifyError,
|
|
14
|
-
prettifyError,
|
|
15
|
-
validate,
|
|
16
|
-
validateAsync,
|
|
17
|
-
exports_regexes,
|
|
18
|
-
getDiscriminatedOption,
|
|
19
|
-
$ZodLazy,
|
|
20
|
-
memoizer,
|
|
21
|
-
exports_locales,
|
|
22
|
-
$output,
|
|
23
|
-
$input,
|
|
24
|
-
registry,
|
|
25
|
-
globalRegistry,
|
|
26
|
-
INVALID,
|
|
27
|
-
ZodCompileAsyncError,
|
|
28
|
-
ZodCompileUnsupportedError,
|
|
29
|
-
compile,
|
|
30
|
-
withParser,
|
|
31
|
-
_coercedString,
|
|
32
|
-
TimePrecision,
|
|
33
|
-
_isoDateTime,
|
|
34
|
-
_isoDate,
|
|
35
|
-
_isoTime,
|
|
36
|
-
_isoDuration,
|
|
37
|
-
_coercedNumber,
|
|
38
|
-
_coercedBoolean,
|
|
39
|
-
_coercedBigint,
|
|
40
|
-
_coercedDate,
|
|
41
|
-
_lt,
|
|
42
|
-
_lte,
|
|
43
|
-
_gt,
|
|
44
|
-
_gte,
|
|
45
|
-
_positive,
|
|
46
|
-
_negative,
|
|
47
|
-
_nonpositive,
|
|
48
|
-
_nonnegative,
|
|
49
|
-
_multipleOf,
|
|
50
|
-
_maxSize,
|
|
51
|
-
_minSize,
|
|
52
|
-
_size,
|
|
53
|
-
_maxLength,
|
|
54
|
-
_minLength,
|
|
55
|
-
_length,
|
|
56
|
-
_regex,
|
|
57
|
-
_lowercase,
|
|
58
|
-
_uppercase,
|
|
59
|
-
_includes,
|
|
60
|
-
_startsWith,
|
|
61
|
-
_endsWith,
|
|
62
|
-
_property,
|
|
63
|
-
_properties,
|
|
64
|
-
_mime,
|
|
65
|
-
_overwrite,
|
|
66
|
-
_normalize,
|
|
67
|
-
_trim,
|
|
68
|
-
_toLowerCase,
|
|
69
|
-
_toUpperCase,
|
|
70
|
-
_slugify,
|
|
71
|
-
toJSONSchema,
|
|
72
|
-
exports_core,
|
|
73
|
-
exports_checks,
|
|
74
|
-
ZodError,
|
|
75
|
-
ZodRealError,
|
|
76
|
-
parse2,
|
|
77
|
-
parseAsync,
|
|
78
|
-
safeParse,
|
|
79
|
-
safeParseAsync,
|
|
80
|
-
encode,
|
|
81
|
-
decode,
|
|
82
|
-
encodeAsync,
|
|
83
|
-
decodeAsync,
|
|
84
|
-
safeEncode,
|
|
85
|
-
safeDecode,
|
|
86
|
-
safeEncodeAsync,
|
|
87
|
-
safeDecodeAsync,
|
|
88
|
-
ZodType2,
|
|
89
|
-
_ZodString,
|
|
90
|
-
ZodString2,
|
|
91
|
-
string,
|
|
92
|
-
ZodStringFormat,
|
|
93
|
-
ZodISODateTime,
|
|
94
|
-
ZodISODate,
|
|
95
|
-
ZodISOTime,
|
|
96
|
-
ZodISODuration,
|
|
97
|
-
ZodEmail,
|
|
98
|
-
email,
|
|
99
|
-
ZodGUID,
|
|
100
|
-
guid,
|
|
101
|
-
ZodUUID,
|
|
102
|
-
uuid,
|
|
103
|
-
uuidv4,
|
|
104
|
-
uuidv6,
|
|
105
|
-
uuidv7,
|
|
106
|
-
ZodURL,
|
|
107
|
-
url,
|
|
108
|
-
httpUrl,
|
|
109
|
-
ZodEmoji,
|
|
110
|
-
emoji2,
|
|
111
|
-
ZodNanoID,
|
|
112
|
-
nanoid,
|
|
113
|
-
ZodCUID,
|
|
114
|
-
cuid,
|
|
115
|
-
ZodCUID2,
|
|
116
|
-
cuid2,
|
|
117
|
-
ZodULID,
|
|
118
|
-
ulid,
|
|
119
|
-
ZodXID,
|
|
120
|
-
xid,
|
|
121
|
-
ZodKSUID,
|
|
122
|
-
ksuid,
|
|
123
|
-
ZodIPv4,
|
|
124
|
-
ipv4,
|
|
125
|
-
ZodMAC,
|
|
126
|
-
mac,
|
|
127
|
-
ZodIPv6,
|
|
128
|
-
ipv6,
|
|
129
|
-
ZodCIDRv4,
|
|
130
|
-
cidrv4,
|
|
131
|
-
ZodCIDRv6,
|
|
132
|
-
cidrv6,
|
|
133
|
-
ZodBase64,
|
|
134
|
-
base64,
|
|
135
|
-
ZodBase64URL,
|
|
136
|
-
base64url,
|
|
137
|
-
ZodE164,
|
|
138
|
-
e164,
|
|
139
|
-
ZodCreditCard,
|
|
140
|
-
creditCard,
|
|
141
|
-
ZodIBAN,
|
|
142
|
-
iban,
|
|
143
|
-
ZodJWT,
|
|
144
|
-
jwt,
|
|
145
|
-
ZodCustomStringFormat,
|
|
146
|
-
stringFormat,
|
|
147
|
-
hostname,
|
|
148
|
-
hex,
|
|
149
|
-
currencyCode,
|
|
150
|
-
hash,
|
|
151
|
-
ZodNumber2,
|
|
152
|
-
number,
|
|
153
|
-
ZodNumberFormat,
|
|
154
|
-
int,
|
|
155
|
-
float32,
|
|
156
|
-
float64,
|
|
157
|
-
int32,
|
|
158
|
-
uint32,
|
|
159
|
-
ZodBoolean,
|
|
160
|
-
boolean,
|
|
161
|
-
ZodBigInt,
|
|
162
|
-
bigint,
|
|
163
|
-
ZodBigIntFormat,
|
|
164
|
-
int64,
|
|
165
|
-
uint64,
|
|
166
|
-
ZodSymbol,
|
|
167
|
-
symbol,
|
|
168
|
-
ZodUndefined,
|
|
169
|
-
_undefined,
|
|
170
|
-
ZodNull2,
|
|
171
|
-
_null,
|
|
172
|
-
ZodAny,
|
|
173
|
-
any,
|
|
174
|
-
ZodUnknown,
|
|
175
|
-
unknown,
|
|
176
|
-
ZodNever2,
|
|
177
|
-
never,
|
|
178
|
-
ZodVoid,
|
|
179
|
-
_void,
|
|
180
|
-
ZodDate2,
|
|
181
|
-
date,
|
|
182
|
-
ZodArray2,
|
|
183
|
-
array,
|
|
184
|
-
keyof,
|
|
185
|
-
ZodObject2,
|
|
186
|
-
object,
|
|
187
|
-
strictObject,
|
|
188
|
-
looseObject,
|
|
189
|
-
ZodUnion2,
|
|
190
|
-
union,
|
|
191
|
-
ZodXor,
|
|
192
|
-
xor,
|
|
193
|
-
ZodDiscriminatedUnion,
|
|
194
|
-
discriminatedUnion,
|
|
195
|
-
ZodIntersection2,
|
|
196
|
-
intersection,
|
|
197
|
-
ZodTuple,
|
|
198
|
-
tuple,
|
|
199
|
-
ZodRecord,
|
|
200
|
-
record,
|
|
201
|
-
partialRecord,
|
|
202
|
-
looseRecord,
|
|
203
|
-
ZodMap,
|
|
204
|
-
map,
|
|
205
|
-
ZodSet,
|
|
206
|
-
set,
|
|
207
|
-
ZodEnum,
|
|
208
|
-
_enum,
|
|
209
|
-
nativeEnum,
|
|
210
|
-
ZodLiteral,
|
|
211
|
-
literal,
|
|
212
|
-
ZodFile,
|
|
213
|
-
file,
|
|
214
|
-
ZodTransform,
|
|
215
|
-
transform,
|
|
216
|
-
ZodOptional2,
|
|
217
|
-
optional,
|
|
218
|
-
ZodExactOptional,
|
|
219
|
-
exactOptional,
|
|
220
|
-
ZodNullable2,
|
|
221
|
-
nullable,
|
|
222
|
-
nullish,
|
|
223
|
-
ZodDefault2,
|
|
224
|
-
_default,
|
|
225
|
-
ZodPrefault,
|
|
226
|
-
prefault,
|
|
227
|
-
ZodNonOptional,
|
|
228
|
-
nonoptional,
|
|
229
|
-
ZodSuccess,
|
|
230
|
-
success,
|
|
231
|
-
ZodCatch,
|
|
232
|
-
_catch,
|
|
233
|
-
ZodNaN,
|
|
234
|
-
nan,
|
|
235
|
-
ZodPipe,
|
|
236
|
-
pipe,
|
|
237
|
-
ZodCodec,
|
|
238
|
-
codec,
|
|
239
|
-
invertCodec,
|
|
240
|
-
ZodPreprocess,
|
|
241
|
-
ZodReadonly,
|
|
242
|
-
readonly,
|
|
243
|
-
ZodTemplateLiteral,
|
|
244
|
-
templateLiteral,
|
|
245
|
-
ZodLazy,
|
|
246
|
-
lazy,
|
|
247
|
-
ZodPromise,
|
|
248
|
-
promise,
|
|
249
|
-
ZodFunction,
|
|
250
|
-
_function,
|
|
251
|
-
ZodCustom,
|
|
252
|
-
check,
|
|
253
|
-
custom,
|
|
254
|
-
refine,
|
|
255
|
-
superRefine,
|
|
256
|
-
describe,
|
|
257
|
-
meta,
|
|
258
|
-
ZodInstanceOf,
|
|
259
|
-
_instanceof,
|
|
260
|
-
stringbool,
|
|
261
|
-
json,
|
|
262
|
-
preprocess,
|
|
263
|
-
exports_schemas
|
|
264
|
-
} from "./chunk-1sygmp11.mjs";
|
|
265
|
-
import {
|
|
266
|
-
__export
|
|
267
|
-
} from "./chunk-fjx29qvp.mjs";
|
|
268
|
-
|
|
269
|
-
// node_modules/.bun/zod@4.6.5/node_modules/zod/v4/classic/coerce.js
|
|
270
|
-
var exports_coerce = {};
|
|
271
|
-
__export(exports_coerce, {
|
|
272
|
-
bigint: () => bigint2,
|
|
273
|
-
boolean: () => boolean2,
|
|
274
|
-
date: () => date2,
|
|
275
|
-
number: () => number2,
|
|
276
|
-
string: () => string2
|
|
277
|
-
});
|
|
278
|
-
function string2(params) {
|
|
279
|
-
return _coercedString(ZodString2, params);
|
|
280
|
-
}
|
|
281
|
-
function number2(params) {
|
|
282
|
-
return _coercedNumber(ZodNumber2, params);
|
|
283
|
-
}
|
|
284
|
-
function boolean2(params) {
|
|
285
|
-
return _coercedBoolean(ZodBoolean, params);
|
|
286
|
-
}
|
|
287
|
-
function bigint2(params) {
|
|
288
|
-
return _coercedBigint(ZodBigInt, params);
|
|
289
|
-
}
|
|
290
|
-
function date2(params) {
|
|
291
|
-
return _coercedDate(ZodDate2, params);
|
|
292
|
-
}
|
|
293
|
-
|
|
294
|
-
// node_modules/.bun/zod@4.6.5/node_modules/zod/v4/classic/external.js
|
|
295
|
-
var exports_external = {};
|
|
296
|
-
__export(exports_external, {
|
|
297
|
-
$brand: () => $brand,
|
|
298
|
-
$input: () => $input,
|
|
299
|
-
$output: () => $output,
|
|
300
|
-
INVALID: () => INVALID,
|
|
301
|
-
NEVER: () => NEVER,
|
|
302
|
-
TimePrecision: () => TimePrecision,
|
|
303
|
-
ZodAny: () => ZodAny,
|
|
304
|
-
ZodArray: () => ZodArray2,
|
|
305
|
-
ZodBase64: () => ZodBase64,
|
|
306
|
-
ZodBase64URL: () => ZodBase64URL,
|
|
307
|
-
ZodBigInt: () => ZodBigInt,
|
|
308
|
-
ZodBigIntFormat: () => ZodBigIntFormat,
|
|
309
|
-
ZodBoolean: () => ZodBoolean,
|
|
310
|
-
ZodCIDRv4: () => ZodCIDRv4,
|
|
311
|
-
ZodCIDRv6: () => ZodCIDRv6,
|
|
312
|
-
ZodCUID: () => ZodCUID,
|
|
313
|
-
ZodCUID2: () => ZodCUID2,
|
|
314
|
-
ZodCatch: () => ZodCatch,
|
|
315
|
-
ZodCodec: () => ZodCodec,
|
|
316
|
-
ZodCompileAsyncError: () => ZodCompileAsyncError,
|
|
317
|
-
ZodCompileUnsupportedError: () => ZodCompileUnsupportedError,
|
|
318
|
-
ZodCreditCard: () => ZodCreditCard,
|
|
319
|
-
ZodCustom: () => ZodCustom,
|
|
320
|
-
ZodCustomStringFormat: () => ZodCustomStringFormat,
|
|
321
|
-
ZodDate: () => ZodDate2,
|
|
322
|
-
ZodDefault: () => ZodDefault2,
|
|
323
|
-
ZodDiscriminatedUnion: () => ZodDiscriminatedUnion,
|
|
324
|
-
ZodE164: () => ZodE164,
|
|
325
|
-
ZodEmail: () => ZodEmail,
|
|
326
|
-
ZodEmoji: () => ZodEmoji,
|
|
327
|
-
ZodEnum: () => ZodEnum,
|
|
328
|
-
ZodError: () => ZodError,
|
|
329
|
-
ZodExactOptional: () => ZodExactOptional,
|
|
330
|
-
ZodFile: () => ZodFile,
|
|
331
|
-
ZodFirstPartyTypeKind: () => ZodFirstPartyTypeKind,
|
|
332
|
-
ZodFunction: () => ZodFunction,
|
|
333
|
-
ZodGUID: () => ZodGUID,
|
|
334
|
-
ZodIBAN: () => ZodIBAN,
|
|
335
|
-
ZodIPv4: () => ZodIPv4,
|
|
336
|
-
ZodIPv6: () => ZodIPv6,
|
|
337
|
-
ZodISODate: () => ZodISODate,
|
|
338
|
-
ZodISODateTime: () => ZodISODateTime,
|
|
339
|
-
ZodISODuration: () => ZodISODuration,
|
|
340
|
-
ZodISOTime: () => ZodISOTime,
|
|
341
|
-
ZodInstanceOf: () => ZodInstanceOf,
|
|
342
|
-
ZodIntersection: () => ZodIntersection2,
|
|
343
|
-
ZodIssueCode: () => ZodIssueCode,
|
|
344
|
-
ZodJWT: () => ZodJWT,
|
|
345
|
-
ZodKSUID: () => ZodKSUID,
|
|
346
|
-
ZodLazy: () => ZodLazy,
|
|
347
|
-
ZodLiteral: () => ZodLiteral,
|
|
348
|
-
ZodMAC: () => ZodMAC,
|
|
349
|
-
ZodMap: () => ZodMap,
|
|
350
|
-
ZodNaN: () => ZodNaN,
|
|
351
|
-
ZodNanoID: () => ZodNanoID,
|
|
352
|
-
ZodNever: () => ZodNever2,
|
|
353
|
-
ZodNonOptional: () => ZodNonOptional,
|
|
354
|
-
ZodNull: () => ZodNull2,
|
|
355
|
-
ZodNullable: () => ZodNullable2,
|
|
356
|
-
ZodNumber: () => ZodNumber2,
|
|
357
|
-
ZodNumberFormat: () => ZodNumberFormat,
|
|
358
|
-
ZodObject: () => ZodObject2,
|
|
359
|
-
ZodOptional: () => ZodOptional2,
|
|
360
|
-
ZodPipe: () => ZodPipe,
|
|
361
|
-
ZodPrefault: () => ZodPrefault,
|
|
362
|
-
ZodPreprocess: () => ZodPreprocess,
|
|
363
|
-
ZodPromise: () => ZodPromise,
|
|
364
|
-
ZodReadonly: () => ZodReadonly,
|
|
365
|
-
ZodRealError: () => ZodRealError,
|
|
366
|
-
ZodRecord: () => ZodRecord,
|
|
367
|
-
ZodSet: () => ZodSet,
|
|
368
|
-
ZodString: () => ZodString2,
|
|
369
|
-
ZodStringFormat: () => ZodStringFormat,
|
|
370
|
-
ZodSuccess: () => ZodSuccess,
|
|
371
|
-
ZodSymbol: () => ZodSymbol,
|
|
372
|
-
ZodTemplateLiteral: () => ZodTemplateLiteral,
|
|
373
|
-
ZodTransform: () => ZodTransform,
|
|
374
|
-
ZodTuple: () => ZodTuple,
|
|
375
|
-
ZodType: () => ZodType2,
|
|
376
|
-
ZodULID: () => ZodULID,
|
|
377
|
-
ZodURL: () => ZodURL,
|
|
378
|
-
ZodUUID: () => ZodUUID,
|
|
379
|
-
ZodUndefined: () => ZodUndefined,
|
|
380
|
-
ZodUnion: () => ZodUnion2,
|
|
381
|
-
ZodUnknown: () => ZodUnknown,
|
|
382
|
-
ZodVoid: () => ZodVoid,
|
|
383
|
-
ZodXID: () => ZodXID,
|
|
384
|
-
ZodXor: () => ZodXor,
|
|
385
|
-
_ZodString: () => _ZodString,
|
|
386
|
-
_default: () => _default,
|
|
387
|
-
_function: () => _function,
|
|
388
|
-
any: () => any,
|
|
389
|
-
array: () => array,
|
|
390
|
-
base64: () => base64,
|
|
391
|
-
base64url: () => base64url,
|
|
392
|
-
bigint: () => bigint,
|
|
393
|
-
boolean: () => boolean,
|
|
394
|
-
catch: () => _catch,
|
|
395
|
-
check: () => check,
|
|
396
|
-
cidrv4: () => cidrv4,
|
|
397
|
-
cidrv6: () => cidrv6,
|
|
398
|
-
clone: () => clone,
|
|
399
|
-
codec: () => codec,
|
|
400
|
-
coerce: () => exports_coerce,
|
|
401
|
-
compile: () => compile,
|
|
402
|
-
config: () => config,
|
|
403
|
-
core: () => exports_core,
|
|
404
|
-
creditCard: () => creditCard,
|
|
405
|
-
cuid: () => cuid,
|
|
406
|
-
cuid2: () => cuid2,
|
|
407
|
-
currencyCode: () => currencyCode,
|
|
408
|
-
custom: () => custom,
|
|
409
|
-
date: () => date,
|
|
410
|
-
decode: () => decode,
|
|
411
|
-
decodeAsync: () => decodeAsync,
|
|
412
|
-
deepPartial: () => deepPartial,
|
|
413
|
-
describe: () => describe,
|
|
414
|
-
discriminatedUnion: () => discriminatedUnion,
|
|
415
|
-
e164: () => e164,
|
|
416
|
-
email: () => email,
|
|
417
|
-
emoji: () => emoji2,
|
|
418
|
-
encode: () => encode,
|
|
419
|
-
encodeAsync: () => encodeAsync,
|
|
420
|
-
endsWith: () => _endsWith,
|
|
421
|
-
enum: () => _enum,
|
|
422
|
-
exactOptional: () => exactOptional,
|
|
423
|
-
file: () => file,
|
|
424
|
-
flattenError: () => flattenError,
|
|
425
|
-
float32: () => float32,
|
|
426
|
-
float64: () => float64,
|
|
427
|
-
formatError: () => formatError,
|
|
428
|
-
fromJSONSchema: () => fromJSONSchema,
|
|
429
|
-
function: () => _function,
|
|
430
|
-
getDiscriminatedOption: () => getDiscriminatedOption,
|
|
431
|
-
getErrorMap: () => getErrorMap,
|
|
432
|
-
globalRegistry: () => globalRegistry,
|
|
433
|
-
gt: () => _gt,
|
|
434
|
-
gte: () => _gte,
|
|
435
|
-
guid: () => guid,
|
|
436
|
-
hash: () => hash,
|
|
437
|
-
hex: () => hex,
|
|
438
|
-
hostname: () => hostname,
|
|
439
|
-
httpUrl: () => httpUrl,
|
|
440
|
-
iban: () => iban,
|
|
441
|
-
includes: () => _includes,
|
|
442
|
-
input: () => input,
|
|
443
|
-
instanceof: () => _instanceof,
|
|
444
|
-
int: () => int,
|
|
445
|
-
int32: () => int32,
|
|
446
|
-
int64: () => int64,
|
|
447
|
-
intersection: () => intersection,
|
|
448
|
-
invertCodec: () => invertCodec,
|
|
449
|
-
ipv4: () => ipv4,
|
|
450
|
-
ipv6: () => ipv6,
|
|
451
|
-
iso: () => exports_iso,
|
|
452
|
-
json: () => json,
|
|
453
|
-
jwt: () => jwt,
|
|
454
|
-
keyof: () => keyof,
|
|
455
|
-
ksuid: () => ksuid,
|
|
456
|
-
lazy: () => lazy,
|
|
457
|
-
length: () => _length,
|
|
458
|
-
literal: () => literal,
|
|
459
|
-
locales: () => exports_locales,
|
|
460
|
-
looseObject: () => looseObject,
|
|
461
|
-
looseRecord: () => looseRecord,
|
|
462
|
-
lowercase: () => _lowercase,
|
|
463
|
-
lt: () => _lt,
|
|
464
|
-
lte: () => _lte,
|
|
465
|
-
mac: () => mac,
|
|
466
|
-
map: () => map,
|
|
467
|
-
maxLength: () => _maxLength,
|
|
468
|
-
maxSize: () => _maxSize,
|
|
469
|
-
memoizer: () => memoizer,
|
|
470
|
-
meta: () => meta,
|
|
471
|
-
mime: () => _mime,
|
|
472
|
-
minLength: () => _minLength,
|
|
473
|
-
minSize: () => _minSize,
|
|
474
|
-
multipleOf: () => _multipleOf,
|
|
475
|
-
nan: () => nan,
|
|
476
|
-
nanoid: () => nanoid,
|
|
477
|
-
nativeEnum: () => nativeEnum,
|
|
478
|
-
negative: () => _negative,
|
|
479
|
-
never: () => never,
|
|
480
|
-
nonnegative: () => _nonnegative,
|
|
481
|
-
nonoptional: () => nonoptional,
|
|
482
|
-
nonpositive: () => _nonpositive,
|
|
483
|
-
normalize: () => _normalize,
|
|
484
|
-
null: () => _null,
|
|
485
|
-
nullable: () => nullable,
|
|
486
|
-
nullish: () => nullish,
|
|
487
|
-
number: () => number,
|
|
488
|
-
object: () => object,
|
|
489
|
-
optional: () => optional,
|
|
490
|
-
output: () => output,
|
|
491
|
-
overwrite: () => _overwrite,
|
|
492
|
-
parse: () => parse2,
|
|
493
|
-
parseAsync: () => parseAsync,
|
|
494
|
-
partialRecord: () => partialRecord,
|
|
495
|
-
pipe: () => pipe,
|
|
496
|
-
positive: () => _positive,
|
|
497
|
-
prefault: () => prefault,
|
|
498
|
-
preprocess: () => preprocess,
|
|
499
|
-
prettifyError: () => prettifyError,
|
|
500
|
-
promise: () => promise,
|
|
501
|
-
properties: () => _properties,
|
|
502
|
-
property: () => _property,
|
|
503
|
-
readonly: () => readonly,
|
|
504
|
-
record: () => record,
|
|
505
|
-
refine: () => refine,
|
|
506
|
-
regex: () => _regex,
|
|
507
|
-
regexes: () => exports_regexes,
|
|
508
|
-
registry: () => registry,
|
|
509
|
-
safeDecode: () => safeDecode,
|
|
510
|
-
safeDecodeAsync: () => safeDecodeAsync,
|
|
511
|
-
safeEncode: () => safeEncode,
|
|
512
|
-
safeEncodeAsync: () => safeEncodeAsync,
|
|
513
|
-
safeParse: () => safeParse,
|
|
514
|
-
safeParseAsync: () => safeParseAsync,
|
|
515
|
-
set: () => set,
|
|
516
|
-
setErrorMap: () => setErrorMap,
|
|
517
|
-
size: () => _size,
|
|
518
|
-
slugify: () => _slugify,
|
|
519
|
-
startsWith: () => _startsWith,
|
|
520
|
-
strictObject: () => strictObject,
|
|
521
|
-
string: () => string,
|
|
522
|
-
stringFormat: () => stringFormat,
|
|
523
|
-
stringbool: () => stringbool,
|
|
524
|
-
success: () => success,
|
|
525
|
-
superRefine: () => superRefine,
|
|
526
|
-
symbol: () => symbol,
|
|
527
|
-
templateLiteral: () => templateLiteral,
|
|
528
|
-
toJSONSchema: () => toJSONSchema,
|
|
529
|
-
toLowerCase: () => _toLowerCase,
|
|
530
|
-
toUpperCase: () => _toUpperCase,
|
|
531
|
-
toZod: () => toZod,
|
|
532
|
-
transform: () => transform,
|
|
533
|
-
treeifyError: () => treeifyError,
|
|
534
|
-
trim: () => _trim,
|
|
535
|
-
tuple: () => tuple,
|
|
536
|
-
uint32: () => uint32,
|
|
537
|
-
uint64: () => uint64,
|
|
538
|
-
ulid: () => ulid,
|
|
539
|
-
undefined: () => _undefined,
|
|
540
|
-
union: () => union,
|
|
541
|
-
unknown: () => unknown,
|
|
542
|
-
uppercase: () => _uppercase,
|
|
543
|
-
url: () => url,
|
|
544
|
-
util: () => exports_util,
|
|
545
|
-
uuid: () => uuid,
|
|
546
|
-
uuidv4: () => uuidv4,
|
|
547
|
-
uuidv6: () => uuidv6,
|
|
548
|
-
uuidv7: () => uuidv7,
|
|
549
|
-
validate: () => validate,
|
|
550
|
-
validateAsync: () => validateAsync,
|
|
551
|
-
void: () => _void,
|
|
552
|
-
withParser: () => withParser,
|
|
553
|
-
xid: () => xid,
|
|
554
|
-
xor: () => xor
|
|
555
|
-
});
|
|
556
|
-
|
|
557
|
-
// node_modules/.bun/zod@4.6.5/node_modules/zod/v4/classic/compat.js
|
|
558
|
-
var ZodIssueCode = {
|
|
559
|
-
invalid_type: "invalid_type",
|
|
560
|
-
too_big: "too_big",
|
|
561
|
-
too_small: "too_small",
|
|
562
|
-
invalid_format: "invalid_format",
|
|
563
|
-
not_multiple_of: "not_multiple_of",
|
|
564
|
-
unrecognized_keys: "unrecognized_keys",
|
|
565
|
-
invalid_union: "invalid_union",
|
|
566
|
-
invalid_key: "invalid_key",
|
|
567
|
-
invalid_element: "invalid_element",
|
|
568
|
-
invalid_value: "invalid_value",
|
|
569
|
-
custom: "custom"
|
|
570
|
-
};
|
|
571
|
-
function setErrorMap(map) {
|
|
572
|
-
config({
|
|
573
|
-
customError: map
|
|
574
|
-
});
|
|
575
|
-
}
|
|
576
|
-
function getErrorMap() {
|
|
577
|
-
return config().customError;
|
|
578
|
-
}
|
|
579
|
-
var ZodFirstPartyTypeKind;
|
|
580
|
-
(function(ZodFirstPartyTypeKind) {})(ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {}));
|
|
581
|
-
// node_modules/.bun/zod@4.6.5/node_modules/zod/v4/classic/iso.js
|
|
582
|
-
var exports_iso = {};
|
|
583
|
-
__export(exports_iso, {
|
|
584
|
-
ZodISODate: () => ZodISODate,
|
|
585
|
-
ZodISODateTime: () => ZodISODateTime,
|
|
586
|
-
ZodISODuration: () => ZodISODuration,
|
|
587
|
-
ZodISOTime: () => ZodISOTime,
|
|
588
|
-
date: () => date3,
|
|
589
|
-
datetime: () => datetime,
|
|
590
|
-
duration: () => duration,
|
|
591
|
-
time: () => time
|
|
592
|
-
});
|
|
593
|
-
function datetime(params) {
|
|
594
|
-
return _isoDateTime(ZodISODateTime, params);
|
|
595
|
-
}
|
|
596
|
-
function date3(params) {
|
|
597
|
-
return _isoDate(ZodISODate, params);
|
|
598
|
-
}
|
|
599
|
-
function time(params) {
|
|
600
|
-
return _isoTime(ZodISOTime, params);
|
|
601
|
-
}
|
|
602
|
-
function duration(params) {
|
|
603
|
-
return _isoDuration(ZodISODuration, params);
|
|
604
|
-
}
|
|
605
|
-
|
|
606
|
-
// node_modules/.bun/zod@4.6.5/node_modules/zod/v4/classic/from-json-schema.js
|
|
607
|
-
var z = {
|
|
608
|
-
...exports_schemas,
|
|
609
|
-
...exports_checks,
|
|
610
|
-
iso: exports_iso
|
|
611
|
-
};
|
|
612
|
-
var RECOGNIZED_KEYS = /* @__PURE__ */ new Set([
|
|
613
|
-
"$schema",
|
|
614
|
-
"$ref",
|
|
615
|
-
"$defs",
|
|
616
|
-
"definitions",
|
|
617
|
-
"$id",
|
|
618
|
-
"id",
|
|
619
|
-
"$comment",
|
|
620
|
-
"$anchor",
|
|
621
|
-
"$vocabulary",
|
|
622
|
-
"$dynamicRef",
|
|
623
|
-
"$dynamicAnchor",
|
|
624
|
-
"type",
|
|
625
|
-
"enum",
|
|
626
|
-
"const",
|
|
627
|
-
"anyOf",
|
|
628
|
-
"oneOf",
|
|
629
|
-
"allOf",
|
|
630
|
-
"not",
|
|
631
|
-
"properties",
|
|
632
|
-
"required",
|
|
633
|
-
"additionalProperties",
|
|
634
|
-
"patternProperties",
|
|
635
|
-
"propertyNames",
|
|
636
|
-
"minProperties",
|
|
637
|
-
"maxProperties",
|
|
638
|
-
"items",
|
|
639
|
-
"prefixItems",
|
|
640
|
-
"additionalItems",
|
|
641
|
-
"minItems",
|
|
642
|
-
"maxItems",
|
|
643
|
-
"uniqueItems",
|
|
644
|
-
"contains",
|
|
645
|
-
"minContains",
|
|
646
|
-
"maxContains",
|
|
647
|
-
"minLength",
|
|
648
|
-
"maxLength",
|
|
649
|
-
"pattern",
|
|
650
|
-
"format",
|
|
651
|
-
"minimum",
|
|
652
|
-
"maximum",
|
|
653
|
-
"exclusiveMinimum",
|
|
654
|
-
"exclusiveMaximum",
|
|
655
|
-
"multipleOf",
|
|
656
|
-
"description",
|
|
657
|
-
"default",
|
|
658
|
-
"contentEncoding",
|
|
659
|
-
"contentMediaType",
|
|
660
|
-
"contentSchema",
|
|
661
|
-
"unevaluatedItems",
|
|
662
|
-
"unevaluatedProperties",
|
|
663
|
-
"if",
|
|
664
|
-
"then",
|
|
665
|
-
"else",
|
|
666
|
-
"dependentSchemas",
|
|
667
|
-
"dependentRequired",
|
|
668
|
-
"nullable",
|
|
669
|
-
"readOnly"
|
|
670
|
-
]);
|
|
671
|
-
function detectVersion(schema, defaultTarget) {
|
|
672
|
-
const $schema = schema.$schema;
|
|
673
|
-
if ($schema === "https://json-schema.org/draft/2020-12/schema") {
|
|
674
|
-
return "draft-2020-12";
|
|
675
|
-
}
|
|
676
|
-
if ($schema === "http://json-schema.org/draft-07/schema#") {
|
|
677
|
-
return "draft-7";
|
|
678
|
-
}
|
|
679
|
-
if ($schema === "http://json-schema.org/draft-04/schema#") {
|
|
680
|
-
return "draft-4";
|
|
681
|
-
}
|
|
682
|
-
return defaultTarget ?? "draft-2020-12";
|
|
683
|
-
}
|
|
684
|
-
function applyMinItems(items, minItems) {
|
|
685
|
-
return items.map((item, index) => index < minItems ? item : item.optional());
|
|
686
|
-
}
|
|
687
|
-
function decodeJSONPointerSegment(segment) {
|
|
688
|
-
return segment.replace(/~1/g, "/").replace(/~0/g, "~");
|
|
689
|
-
}
|
|
690
|
-
function resolveRef(ref, ctx) {
|
|
691
|
-
if (!ref.startsWith("#")) {
|
|
692
|
-
throw new Error("External $ref is not supported, only local refs (#/...) are allowed");
|
|
693
|
-
}
|
|
694
|
-
const path = ref.slice(1).split("/").filter(Boolean);
|
|
695
|
-
if (path.length === 0) {
|
|
696
|
-
return ctx.rootSchema;
|
|
697
|
-
}
|
|
698
|
-
const defsKey = ctx.version === "draft-2020-12" ? "$defs" : "definitions";
|
|
699
|
-
if (path[0] === defsKey) {
|
|
700
|
-
const key = path[1] === undefined ? undefined : decodeJSONPointerSegment(path[1]);
|
|
701
|
-
if (!key || !ctx.defs[key]) {
|
|
702
|
-
throw new Error(`Reference not found: ${ref}`);
|
|
703
|
-
}
|
|
704
|
-
return ctx.defs[key];
|
|
705
|
-
}
|
|
706
|
-
throw new Error(`Reference not found: ${ref}`);
|
|
707
|
-
}
|
|
708
|
-
function checkObjectGuards(objectSchema, guards) {
|
|
709
|
-
const guard = z.transform((value) => value).check((payload) => {
|
|
710
|
-
const value = payload.value;
|
|
711
|
-
if (typeof value !== "object" || value === null || Array.isArray(value))
|
|
712
|
-
return;
|
|
713
|
-
const keys = Object.getOwnPropertyNames(value);
|
|
714
|
-
if (guards.minProperties !== undefined && keys.length < guards.minProperties) {
|
|
715
|
-
payload.issues.push({
|
|
716
|
-
origin: "object",
|
|
717
|
-
code: "too_small",
|
|
718
|
-
minimum: guards.minProperties,
|
|
719
|
-
inclusive: true,
|
|
720
|
-
message: `Too small: expected object to have >=${guards.minProperties} properties`,
|
|
721
|
-
input: value,
|
|
722
|
-
inst: objectSchema,
|
|
723
|
-
continue: true
|
|
724
|
-
});
|
|
725
|
-
}
|
|
726
|
-
if (guards.maxProperties !== undefined && keys.length > guards.maxProperties) {
|
|
727
|
-
payload.issues.push({
|
|
728
|
-
origin: "object",
|
|
729
|
-
code: "too_big",
|
|
730
|
-
maximum: guards.maxProperties,
|
|
731
|
-
inclusive: true,
|
|
732
|
-
message: `Too big: expected object to have <=${guards.maxProperties} properties`,
|
|
733
|
-
input: value,
|
|
734
|
-
inst: objectSchema,
|
|
735
|
-
continue: true
|
|
736
|
-
});
|
|
737
|
-
}
|
|
738
|
-
if (guards.keySchema) {
|
|
739
|
-
for (const key of keys) {
|
|
740
|
-
const result = guards.keySchema.safeParse(key);
|
|
741
|
-
if (result.success)
|
|
742
|
-
continue;
|
|
743
|
-
payload.issues.push({
|
|
744
|
-
code: "invalid_key",
|
|
745
|
-
origin: "record",
|
|
746
|
-
issues: result.error.issues,
|
|
747
|
-
input: key,
|
|
748
|
-
path: [key],
|
|
749
|
-
continue: true
|
|
750
|
-
});
|
|
751
|
-
}
|
|
752
|
-
}
|
|
753
|
-
});
|
|
754
|
-
return guard.pipe(objectSchema);
|
|
755
|
-
}
|
|
756
|
-
function canonicalKey(value, seen) {
|
|
757
|
-
if (value === null)
|
|
758
|
-
return "z";
|
|
759
|
-
const type = typeof value;
|
|
760
|
-
if (type !== "object") {
|
|
761
|
-
if (type === "number" && Number.isNaN(value))
|
|
762
|
-
return null;
|
|
763
|
-
const raw = String(value);
|
|
764
|
-
return `${type[0]}${raw.length}:${raw}`;
|
|
765
|
-
}
|
|
766
|
-
if (seen.has(value))
|
|
767
|
-
return null;
|
|
768
|
-
seen.add(value);
|
|
769
|
-
try {
|
|
770
|
-
if (Array.isArray(value)) {
|
|
771
|
-
const parts = [];
|
|
772
|
-
for (const item of value) {
|
|
773
|
-
const key = canonicalKey(item, seen);
|
|
774
|
-
if (key === null)
|
|
775
|
-
return null;
|
|
776
|
-
parts.push(key);
|
|
777
|
-
}
|
|
778
|
-
return `a${parts.length}:[${parts.join(",")}]`;
|
|
779
|
-
}
|
|
780
|
-
const keys = Object.keys(value).sort();
|
|
781
|
-
const parts = [];
|
|
782
|
-
for (const k of keys) {
|
|
783
|
-
const key = canonicalKey(value[k], seen);
|
|
784
|
-
if (key === null)
|
|
785
|
-
return null;
|
|
786
|
-
parts.push(`${k.length}:${k}=${key}`);
|
|
787
|
-
}
|
|
788
|
-
return `o${parts.length}:{${parts.join(",")}}`;
|
|
789
|
-
} finally {
|
|
790
|
-
seen.delete(value);
|
|
791
|
-
}
|
|
792
|
-
}
|
|
793
|
-
var SCHEMA_KEYWORDS = /* @__PURE__ */ new Set([
|
|
794
|
-
"items",
|
|
795
|
-
"prefixItems",
|
|
796
|
-
"additionalItems",
|
|
797
|
-
"additionalProperties",
|
|
798
|
-
"contains",
|
|
799
|
-
"propertyNames",
|
|
800
|
-
"not",
|
|
801
|
-
"if",
|
|
802
|
-
"then",
|
|
803
|
-
"else",
|
|
804
|
-
"allOf",
|
|
805
|
-
"anyOf",
|
|
806
|
-
"oneOf",
|
|
807
|
-
"unevaluatedItems",
|
|
808
|
-
"unevaluatedProperties",
|
|
809
|
-
"contentSchema"
|
|
810
|
-
]);
|
|
811
|
-
var SCHEMA_MAP_KEYWORDS = /* @__PURE__ */ new Set([
|
|
812
|
-
"properties",
|
|
813
|
-
"patternProperties",
|
|
814
|
-
"dependentSchemas",
|
|
815
|
-
"dependencies",
|
|
816
|
-
"$defs",
|
|
817
|
-
"definitions"
|
|
818
|
-
]);
|
|
819
|
-
function containsRef(value) {
|
|
820
|
-
if (typeof value !== "object" || value === null)
|
|
821
|
-
return false;
|
|
822
|
-
if (Array.isArray(value))
|
|
823
|
-
return value.some(containsRef);
|
|
824
|
-
if (typeof value.$ref === "string")
|
|
825
|
-
return true;
|
|
826
|
-
return Object.entries(value).some(([key, sub]) => {
|
|
827
|
-
if (SCHEMA_KEYWORDS.has(key))
|
|
828
|
-
return containsRef(sub);
|
|
829
|
-
if (!SCHEMA_MAP_KEYWORDS.has(key) || typeof sub !== "object" || sub === null)
|
|
830
|
-
return false;
|
|
831
|
-
return Object.values(sub).some(containsRef);
|
|
832
|
-
});
|
|
833
|
-
}
|
|
834
|
-
function plural(n) {
|
|
835
|
-
return n === 1 ? "element" : "elements";
|
|
836
|
-
}
|
|
837
|
-
function checkArrayGuards(arraySchema, guards) {
|
|
838
|
-
const guard = z.transform((value) => value).check((payload) => {
|
|
839
|
-
const items = payload.value;
|
|
840
|
-
if (!Array.isArray(items))
|
|
841
|
-
return;
|
|
842
|
-
if (guards.uniqueItems === true) {
|
|
843
|
-
const firstSeen = new Map;
|
|
844
|
-
for (let i = 0;i < items.length; i++) {
|
|
845
|
-
const key = canonicalKey(items[i], new Set);
|
|
846
|
-
if (key === null)
|
|
847
|
-
continue;
|
|
848
|
-
const first = firstSeen.get(key);
|
|
849
|
-
if (first === undefined) {
|
|
850
|
-
firstSeen.set(key, i);
|
|
851
|
-
continue;
|
|
852
|
-
}
|
|
853
|
-
payload.issues.push({
|
|
854
|
-
code: "custom",
|
|
855
|
-
message: `Array items must be unique: element at index ${i} duplicates the one at index ${first}`,
|
|
856
|
-
input: items,
|
|
857
|
-
path: [i],
|
|
858
|
-
continue: true
|
|
859
|
-
});
|
|
860
|
-
}
|
|
861
|
-
}
|
|
862
|
-
if (guards.containsSchema) {
|
|
863
|
-
const minContains = guards.minContains ?? 1;
|
|
864
|
-
const ceiling = guards.maxContains !== undefined ? guards.maxContains + 1 : Number.POSITIVE_INFINITY;
|
|
865
|
-
let matches = 0;
|
|
866
|
-
for (const item of items) {
|
|
867
|
-
if (guards.containsSchema.safeParse(item).success && ++matches >= ceiling)
|
|
868
|
-
break;
|
|
869
|
-
}
|
|
870
|
-
if (matches < minContains) {
|
|
871
|
-
payload.issues.push({
|
|
872
|
-
code: "custom",
|
|
873
|
-
message: `Array must contain at least ${minContains} matching ${plural(minContains)}; found ${matches}`,
|
|
874
|
-
input: items,
|
|
875
|
-
continue: true
|
|
876
|
-
});
|
|
877
|
-
}
|
|
878
|
-
if (guards.maxContains !== undefined && matches > guards.maxContains) {
|
|
879
|
-
payload.issues.push({
|
|
880
|
-
code: "custom",
|
|
881
|
-
message: `Array must contain at most ${guards.maxContains} matching ${plural(guards.maxContains)}`,
|
|
882
|
-
input: items,
|
|
883
|
-
continue: true
|
|
884
|
-
});
|
|
885
|
-
}
|
|
886
|
-
}
|
|
887
|
-
});
|
|
888
|
-
return guard.pipe(arraySchema);
|
|
889
|
-
}
|
|
890
|
-
function getTupleRest(restSchema, ctx) {
|
|
891
|
-
if (restSchema === false) {
|
|
892
|
-
return;
|
|
893
|
-
}
|
|
894
|
-
if (restSchema === undefined || restSchema === true) {
|
|
895
|
-
return z.any();
|
|
896
|
-
}
|
|
897
|
-
return convertSchema(restSchema, ctx);
|
|
898
|
-
}
|
|
899
|
-
var fullTime = /^(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|[+-](?:[01]\d|2[0-3]):[0-5]\d)$/;
|
|
900
|
-
function convertBaseSchema(schema, ctx) {
|
|
901
|
-
if (schema.not !== undefined) {
|
|
902
|
-
if (typeof schema.not === "object" && Object.keys(schema.not).length === 0) {
|
|
903
|
-
return z.never();
|
|
904
|
-
}
|
|
905
|
-
throw new Error("not is not supported in Zod (except { not: {} } for never)");
|
|
906
|
-
}
|
|
907
|
-
if (schema.unevaluatedItems !== undefined) {
|
|
908
|
-
throw new Error("unevaluatedItems is not supported");
|
|
909
|
-
}
|
|
910
|
-
if (schema.unevaluatedProperties !== undefined) {
|
|
911
|
-
throw new Error("unevaluatedProperties is not supported");
|
|
912
|
-
}
|
|
913
|
-
if (schema.if !== undefined || schema.then !== undefined || schema.else !== undefined) {
|
|
914
|
-
throw new Error("Conditional schemas (if/then/else) are not supported");
|
|
915
|
-
}
|
|
916
|
-
if (schema.dependentSchemas !== undefined || schema.dependentRequired !== undefined) {
|
|
917
|
-
throw new Error("dependentSchemas and dependentRequired are not supported");
|
|
918
|
-
}
|
|
919
|
-
if (schema.$ref) {
|
|
920
|
-
const refPath = schema.$ref;
|
|
921
|
-
if (ctx.refs.has(refPath)) {
|
|
922
|
-
return ctx.refs.get(refPath);
|
|
923
|
-
}
|
|
924
|
-
if (ctx.processing.has(refPath)) {
|
|
925
|
-
return z.lazy(() => {
|
|
926
|
-
if (!ctx.refs.has(refPath)) {
|
|
927
|
-
throw new Error(`Circular reference not resolved: ${refPath}`);
|
|
928
|
-
}
|
|
929
|
-
return ctx.refs.get(refPath);
|
|
930
|
-
});
|
|
931
|
-
}
|
|
932
|
-
ctx.processing.add(refPath);
|
|
933
|
-
const resolved = resolveRef(refPath, ctx);
|
|
934
|
-
const zodSchema = convertSchema(resolved, ctx);
|
|
935
|
-
ctx.refs.set(refPath, zodSchema);
|
|
936
|
-
ctx.processing.delete(refPath);
|
|
937
|
-
return zodSchema;
|
|
938
|
-
}
|
|
939
|
-
if (schema.enum !== undefined) {
|
|
940
|
-
const enumValues = schema.enum;
|
|
941
|
-
if (ctx.version === "openapi-3.0" && schema.nullable === true && enumValues.length === 1 && enumValues[0] === null) {
|
|
942
|
-
return z.null();
|
|
943
|
-
}
|
|
944
|
-
if (enumValues.length === 0) {
|
|
945
|
-
return z.never();
|
|
946
|
-
}
|
|
947
|
-
if (enumValues.length === 1) {
|
|
948
|
-
return z.literal(enumValues[0]);
|
|
949
|
-
}
|
|
950
|
-
if (enumValues.every((v) => typeof v === "string")) {
|
|
951
|
-
return z.enum(enumValues);
|
|
952
|
-
}
|
|
953
|
-
const literalSchemas = enumValues.map((v) => z.literal(v));
|
|
954
|
-
if (literalSchemas.length < 2) {
|
|
955
|
-
return literalSchemas[0];
|
|
956
|
-
}
|
|
957
|
-
return z.union([literalSchemas[0], literalSchemas[1], ...literalSchemas.slice(2)]);
|
|
958
|
-
}
|
|
959
|
-
if (schema.const !== undefined) {
|
|
960
|
-
return z.literal(schema.const);
|
|
961
|
-
}
|
|
962
|
-
const type = schema.type;
|
|
963
|
-
if (Array.isArray(type)) {
|
|
964
|
-
const typeSchemas = type.map((t) => {
|
|
965
|
-
const typeSchema = { ...schema, type: t };
|
|
966
|
-
return convertBaseSchema(typeSchema, ctx);
|
|
967
|
-
});
|
|
968
|
-
if (typeSchemas.length === 0) {
|
|
969
|
-
return z.never();
|
|
970
|
-
}
|
|
971
|
-
if (typeSchemas.length === 1) {
|
|
972
|
-
return typeSchemas[0];
|
|
973
|
-
}
|
|
974
|
-
return z.union(typeSchemas);
|
|
975
|
-
}
|
|
976
|
-
if (!type) {
|
|
977
|
-
return z.any();
|
|
978
|
-
}
|
|
979
|
-
let zodSchema;
|
|
980
|
-
switch (type) {
|
|
981
|
-
case "string": {
|
|
982
|
-
let stringSchema = z.string();
|
|
983
|
-
if (schema.format) {
|
|
984
|
-
const format = schema.format;
|
|
985
|
-
if (format === "email") {
|
|
986
|
-
stringSchema = stringSchema.check(z.email());
|
|
987
|
-
} else if (format === "uri" || format === "uri-reference") {
|
|
988
|
-
stringSchema = stringSchema.check(z.url());
|
|
989
|
-
} else if (format === "uuid" || format === "guid") {
|
|
990
|
-
stringSchema = stringSchema.check(z.uuid());
|
|
991
|
-
} else if (format === "date-time") {
|
|
992
|
-
stringSchema = stringSchema.check(z.iso.datetime({ offset: true }));
|
|
993
|
-
} else if (format === "date") {
|
|
994
|
-
stringSchema = stringSchema.check(z.iso.date());
|
|
995
|
-
} else if (format === "time") {
|
|
996
|
-
stringSchema = stringSchema.check(z.regex(fullTime));
|
|
997
|
-
} else if (format === "duration") {
|
|
998
|
-
stringSchema = stringSchema.check(z.iso.duration());
|
|
999
|
-
} else if (format === "hostname") {
|
|
1000
|
-
stringSchema = stringSchema.check(z.hostname());
|
|
1001
|
-
} else if (format === "ipv4") {
|
|
1002
|
-
stringSchema = stringSchema.check(z.ipv4());
|
|
1003
|
-
} else if (format === "ipv6") {
|
|
1004
|
-
stringSchema = stringSchema.check(z.ipv6());
|
|
1005
|
-
} else if (format === "mac") {
|
|
1006
|
-
stringSchema = stringSchema.check(z.mac());
|
|
1007
|
-
} else if (format === "cidr") {
|
|
1008
|
-
stringSchema = stringSchema.check(z.cidrv4());
|
|
1009
|
-
} else if (format === "cidr-v6") {
|
|
1010
|
-
stringSchema = stringSchema.check(z.cidrv6());
|
|
1011
|
-
} else if (format === "base64") {
|
|
1012
|
-
stringSchema = stringSchema.check(z.base64());
|
|
1013
|
-
} else if (format === "base64url") {
|
|
1014
|
-
stringSchema = stringSchema.check(z.base64url());
|
|
1015
|
-
} else if (format === "e164") {
|
|
1016
|
-
stringSchema = stringSchema.check(z.e164());
|
|
1017
|
-
} else if (format === "credit_card") {
|
|
1018
|
-
stringSchema = stringSchema.check(z.creditCard());
|
|
1019
|
-
} else if (format === "iban") {
|
|
1020
|
-
stringSchema = stringSchema.check(z.iban());
|
|
1021
|
-
} else if (format === "jwt") {
|
|
1022
|
-
stringSchema = stringSchema.check(z.jwt());
|
|
1023
|
-
} else if (format === "emoji") {
|
|
1024
|
-
stringSchema = stringSchema.check(z.emoji());
|
|
1025
|
-
} else if (format === "nanoid") {
|
|
1026
|
-
stringSchema = stringSchema.check(z.nanoid());
|
|
1027
|
-
} else if (format === "cuid") {
|
|
1028
|
-
stringSchema = stringSchema.check(z.cuid());
|
|
1029
|
-
} else if (format === "cuid2") {
|
|
1030
|
-
stringSchema = stringSchema.check(z.cuid2());
|
|
1031
|
-
} else if (format === "ulid") {
|
|
1032
|
-
stringSchema = stringSchema.check(z.ulid());
|
|
1033
|
-
} else if (format === "xid") {
|
|
1034
|
-
stringSchema = stringSchema.check(z.xid());
|
|
1035
|
-
} else if (format === "ksuid") {
|
|
1036
|
-
stringSchema = stringSchema.check(z.ksuid());
|
|
1037
|
-
}
|
|
1038
|
-
}
|
|
1039
|
-
if (typeof schema.minLength === "number") {
|
|
1040
|
-
stringSchema = stringSchema.min(schema.minLength);
|
|
1041
|
-
}
|
|
1042
|
-
if (typeof schema.maxLength === "number") {
|
|
1043
|
-
stringSchema = stringSchema.max(schema.maxLength);
|
|
1044
|
-
}
|
|
1045
|
-
if (schema.pattern) {
|
|
1046
|
-
stringSchema = stringSchema.regex(new RegExp(schema.pattern));
|
|
1047
|
-
}
|
|
1048
|
-
zodSchema = stringSchema;
|
|
1049
|
-
break;
|
|
1050
|
-
}
|
|
1051
|
-
case "number":
|
|
1052
|
-
case "integer": {
|
|
1053
|
-
let numberSchema = type === "integer" ? z.number().int() : z.number();
|
|
1054
|
-
if (typeof schema.minimum === "number" && schema.exclusiveMinimum !== true) {
|
|
1055
|
-
numberSchema = numberSchema.min(schema.minimum);
|
|
1056
|
-
}
|
|
1057
|
-
if (typeof schema.maximum === "number" && schema.exclusiveMaximum !== true) {
|
|
1058
|
-
numberSchema = numberSchema.max(schema.maximum);
|
|
1059
|
-
}
|
|
1060
|
-
if (typeof schema.exclusiveMinimum === "number") {
|
|
1061
|
-
numberSchema = numberSchema.gt(schema.exclusiveMinimum);
|
|
1062
|
-
} else if (schema.exclusiveMinimum === true && typeof schema.minimum === "number") {
|
|
1063
|
-
numberSchema = numberSchema.gt(schema.minimum);
|
|
1064
|
-
}
|
|
1065
|
-
if (typeof schema.exclusiveMaximum === "number") {
|
|
1066
|
-
numberSchema = numberSchema.lt(schema.exclusiveMaximum);
|
|
1067
|
-
} else if (schema.exclusiveMaximum === true && typeof schema.maximum === "number") {
|
|
1068
|
-
numberSchema = numberSchema.lt(schema.maximum);
|
|
1069
|
-
}
|
|
1070
|
-
if (typeof schema.multipleOf === "number") {
|
|
1071
|
-
numberSchema = numberSchema.multipleOf(schema.multipleOf);
|
|
1072
|
-
}
|
|
1073
|
-
zodSchema = numberSchema;
|
|
1074
|
-
break;
|
|
1075
|
-
}
|
|
1076
|
-
case "boolean": {
|
|
1077
|
-
zodSchema = z.boolean();
|
|
1078
|
-
break;
|
|
1079
|
-
}
|
|
1080
|
-
case "null": {
|
|
1081
|
-
zodSchema = z.null();
|
|
1082
|
-
break;
|
|
1083
|
-
}
|
|
1084
|
-
case "object": {
|
|
1085
|
-
const shape = {};
|
|
1086
|
-
const properties = schema.properties || {};
|
|
1087
|
-
const requiredSet = new Set(schema.required || []);
|
|
1088
|
-
const additionalSchema = typeof schema.additionalProperties === "object" ? convertSchema(schema.additionalProperties, ctx) : undefined;
|
|
1089
|
-
for (const [key, propSchema] of Object.entries(properties)) {
|
|
1090
|
-
const propZodSchema = convertSchema(propSchema, ctx);
|
|
1091
|
-
assignProp(shape, key, requiredSet.has(key) ? propZodSchema : propZodSchema.optional());
|
|
1092
|
-
}
|
|
1093
|
-
if (schema.patternProperties) {
|
|
1094
|
-
const patternProps = schema.patternProperties;
|
|
1095
|
-
const patternKeys = Object.keys(patternProps);
|
|
1096
|
-
const looseRecords = [];
|
|
1097
|
-
for (const pattern of patternKeys) {
|
|
1098
|
-
const patternValue = convertSchema(patternProps[pattern], ctx);
|
|
1099
|
-
const keySchema = z.string().regex(new RegExp(pattern));
|
|
1100
|
-
looseRecords.push(z.looseRecord(keySchema, patternValue));
|
|
1101
|
-
}
|
|
1102
|
-
const schemasToIntersect = [];
|
|
1103
|
-
if (Object.keys(shape).length > 0) {
|
|
1104
|
-
schemasToIntersect.push(z.object(shape).passthrough());
|
|
1105
|
-
}
|
|
1106
|
-
schemasToIntersect.push(...looseRecords);
|
|
1107
|
-
if (schemasToIntersect.length === 0) {
|
|
1108
|
-
zodSchema = z.object({}).passthrough();
|
|
1109
|
-
} else if (schemasToIntersect.length === 1) {
|
|
1110
|
-
zodSchema = schemasToIntersect[0];
|
|
1111
|
-
} else {
|
|
1112
|
-
let result = z.intersection(schemasToIntersect[0], schemasToIntersect[1]);
|
|
1113
|
-
for (let i = 2;i < schemasToIntersect.length; i++) {
|
|
1114
|
-
result = z.intersection(result, schemasToIntersect[i]);
|
|
1115
|
-
}
|
|
1116
|
-
zodSchema = result;
|
|
1117
|
-
}
|
|
1118
|
-
if (schema.additionalProperties === false) {
|
|
1119
|
-
const propertyKeys = Object.keys(shape);
|
|
1120
|
-
const patterns = patternKeys.map((p) => new RegExp(p));
|
|
1121
|
-
const basePatternSchema = zodSchema;
|
|
1122
|
-
zodSchema = zodSchema.check((payload) => {
|
|
1123
|
-
if (!isPlainObject(payload.value))
|
|
1124
|
-
return;
|
|
1125
|
-
const unrecognized = [];
|
|
1126
|
-
for (const key of Object.keys(payload.value)) {
|
|
1127
|
-
if (propertyKeys.includes(key))
|
|
1128
|
-
continue;
|
|
1129
|
-
if (patterns.some((regex) => regex.test(key)))
|
|
1130
|
-
continue;
|
|
1131
|
-
unrecognized.push(key);
|
|
1132
|
-
}
|
|
1133
|
-
if (unrecognized.length) {
|
|
1134
|
-
payload.issues.push({
|
|
1135
|
-
code: "unrecognized_keys",
|
|
1136
|
-
keys: unrecognized,
|
|
1137
|
-
input: payload.value,
|
|
1138
|
-
inst: basePatternSchema
|
|
1139
|
-
});
|
|
1140
|
-
}
|
|
1141
|
-
});
|
|
1142
|
-
}
|
|
1143
|
-
} else {
|
|
1144
|
-
const objectSchema = z.object(shape);
|
|
1145
|
-
if (schema.additionalProperties === false) {
|
|
1146
|
-
zodSchema = objectSchema.strict();
|
|
1147
|
-
} else if (additionalSchema) {
|
|
1148
|
-
zodSchema = objectSchema.catchall(additionalSchema);
|
|
1149
|
-
} else {
|
|
1150
|
-
zodSchema = objectSchema.passthrough();
|
|
1151
|
-
}
|
|
1152
|
-
}
|
|
1153
|
-
const hasKeyGuard = schema.propertyNames !== undefined && schema.propertyNames !== true;
|
|
1154
|
-
const minProperties = typeof schema.minProperties === "number" ? schema.minProperties : undefined;
|
|
1155
|
-
const maxProperties = typeof schema.maxProperties === "number" ? schema.maxProperties : undefined;
|
|
1156
|
-
if (hasKeyGuard || minProperties !== undefined || maxProperties !== undefined) {
|
|
1157
|
-
let keySchema;
|
|
1158
|
-
if (hasKeyGuard) {
|
|
1159
|
-
const keyJSONSchema = typeof schema.propertyNames === "object" && schema.propertyNames.type === undefined ? { type: "string", ...schema.propertyNames } : schema.propertyNames;
|
|
1160
|
-
keySchema = convertSchema(keyJSONSchema, ctx);
|
|
1161
|
-
}
|
|
1162
|
-
zodSchema = checkObjectGuards(zodSchema, { keySchema, minProperties, maxProperties });
|
|
1163
|
-
}
|
|
1164
|
-
break;
|
|
1165
|
-
}
|
|
1166
|
-
case "array": {
|
|
1167
|
-
const prefixItems = schema.prefixItems;
|
|
1168
|
-
const items = schema.items;
|
|
1169
|
-
if (prefixItems && Array.isArray(prefixItems)) {
|
|
1170
|
-
const minItems = typeof schema.minItems === "number" ? schema.minItems : 0;
|
|
1171
|
-
const tupleItems = prefixItems.map((item) => convertSchema(item, ctx));
|
|
1172
|
-
const positionalItems = applyMinItems(tupleItems, minItems);
|
|
1173
|
-
const rest = !Array.isArray(items) ? getTupleRest(items, ctx) : undefined;
|
|
1174
|
-
const tupleSchema = z.tuple(positionalItems);
|
|
1175
|
-
zodSchema = rest ? tupleSchema.rest(rest) : tupleSchema;
|
|
1176
|
-
if (typeof schema.minItems === "number") {
|
|
1177
|
-
zodSchema = zodSchema.check(z.minLength(schema.minItems));
|
|
1178
|
-
}
|
|
1179
|
-
if (typeof schema.maxItems === "number") {
|
|
1180
|
-
zodSchema = zodSchema.check(z.maxLength(schema.maxItems));
|
|
1181
|
-
}
|
|
1182
|
-
} else if (Array.isArray(items)) {
|
|
1183
|
-
const minItems = typeof schema.minItems === "number" ? schema.minItems : 0;
|
|
1184
|
-
const tupleItems = items.map((item) => convertSchema(item, ctx));
|
|
1185
|
-
const positionalItems = applyMinItems(tupleItems, minItems);
|
|
1186
|
-
const rest = getTupleRest(schema.additionalItems, ctx);
|
|
1187
|
-
const tupleSchema = z.tuple(positionalItems);
|
|
1188
|
-
zodSchema = rest ? tupleSchema.rest(rest) : tupleSchema;
|
|
1189
|
-
if (typeof schema.minItems === "number") {
|
|
1190
|
-
zodSchema = zodSchema.check(z.minLength(schema.minItems));
|
|
1191
|
-
}
|
|
1192
|
-
if (typeof schema.maxItems === "number") {
|
|
1193
|
-
zodSchema = zodSchema.check(z.maxLength(schema.maxItems));
|
|
1194
|
-
}
|
|
1195
|
-
} else if (items !== undefined) {
|
|
1196
|
-
const element = convertSchema(items, ctx);
|
|
1197
|
-
let arraySchema = z.array(element);
|
|
1198
|
-
if (typeof schema.minItems === "number") {
|
|
1199
|
-
arraySchema = arraySchema.min(schema.minItems);
|
|
1200
|
-
}
|
|
1201
|
-
if (typeof schema.maxItems === "number") {
|
|
1202
|
-
arraySchema = arraySchema.max(schema.maxItems);
|
|
1203
|
-
}
|
|
1204
|
-
zodSchema = arraySchema;
|
|
1205
|
-
} else {
|
|
1206
|
-
zodSchema = z.array(z.any());
|
|
1207
|
-
}
|
|
1208
|
-
if (schema.uniqueItems === true || schema.contains !== undefined) {
|
|
1209
|
-
zodSchema = checkArrayGuards(zodSchema, {
|
|
1210
|
-
uniqueItems: schema.uniqueItems === true,
|
|
1211
|
-
containsSchema: schema.contains !== undefined ? convertSchema(schema.contains, ctx) : undefined,
|
|
1212
|
-
minContains: typeof schema.minContains === "number" ? schema.minContains : undefined,
|
|
1213
|
-
maxContains: typeof schema.maxContains === "number" ? schema.maxContains : undefined
|
|
1214
|
-
});
|
|
1215
|
-
}
|
|
1216
|
-
break;
|
|
1217
|
-
}
|
|
1218
|
-
default:
|
|
1219
|
-
throw new Error(`Unsupported type: ${type}`);
|
|
1220
|
-
}
|
|
1221
|
-
return zodSchema;
|
|
1222
|
-
}
|
|
1223
|
-
function convertSchema(schema, ctx) {
|
|
1224
|
-
if (typeof schema === "boolean") {
|
|
1225
|
-
return schema ? z.any() : z.never();
|
|
1226
|
-
}
|
|
1227
|
-
let baseSchema = convertBaseSchema(schema, ctx);
|
|
1228
|
-
const hasExplicitType = schema.type || schema.enum !== undefined || schema.const !== undefined;
|
|
1229
|
-
if (schema.anyOf && Array.isArray(schema.anyOf)) {
|
|
1230
|
-
const options = schema.anyOf.map((s) => convertSchema(s, ctx));
|
|
1231
|
-
const anyOfUnion = z.union(options);
|
|
1232
|
-
baseSchema = hasExplicitType ? z.intersection(baseSchema, anyOfUnion) : anyOfUnion;
|
|
1233
|
-
}
|
|
1234
|
-
if (schema.oneOf && Array.isArray(schema.oneOf)) {
|
|
1235
|
-
const options = schema.oneOf.map((s) => convertSchema(s, ctx));
|
|
1236
|
-
const oneOfUnion = z.xor(options);
|
|
1237
|
-
baseSchema = hasExplicitType ? z.intersection(baseSchema, oneOfUnion) : oneOfUnion;
|
|
1238
|
-
}
|
|
1239
|
-
if (schema.allOf && Array.isArray(schema.allOf)) {
|
|
1240
|
-
if (schema.allOf.length === 0) {
|
|
1241
|
-
baseSchema = hasExplicitType ? baseSchema : z.any();
|
|
1242
|
-
} else {
|
|
1243
|
-
let result = hasExplicitType ? baseSchema : convertSchema(schema.allOf[0], ctx);
|
|
1244
|
-
const startIdx = hasExplicitType ? 0 : 1;
|
|
1245
|
-
for (let i = startIdx;i < schema.allOf.length; i++) {
|
|
1246
|
-
result = z.intersection(result, convertSchema(schema.allOf[i], ctx));
|
|
1247
|
-
}
|
|
1248
|
-
baseSchema = result;
|
|
1249
|
-
}
|
|
1250
|
-
}
|
|
1251
|
-
if (schema.nullable === true && ctx.version === "openapi-3.0") {
|
|
1252
|
-
baseSchema = z.nullable(baseSchema);
|
|
1253
|
-
}
|
|
1254
|
-
if (schema.readOnly === true) {
|
|
1255
|
-
baseSchema = z.readonly(baseSchema);
|
|
1256
|
-
}
|
|
1257
|
-
if (schema.default !== undefined) {
|
|
1258
|
-
baseSchema = baseSchema.default(schema.default);
|
|
1259
|
-
}
|
|
1260
|
-
const extraMeta = {};
|
|
1261
|
-
const coreMetadataKeys = ["$id", "id", "$comment", "$anchor", "$vocabulary", "$dynamicRef", "$dynamicAnchor"];
|
|
1262
|
-
for (const key of coreMetadataKeys) {
|
|
1263
|
-
if (key in schema) {
|
|
1264
|
-
extraMeta[key] = schema[key];
|
|
1265
|
-
}
|
|
1266
|
-
}
|
|
1267
|
-
const contentMetadataKeys = ["contentEncoding", "contentMediaType", "contentSchema"];
|
|
1268
|
-
for (const key of contentMetadataKeys) {
|
|
1269
|
-
if (key in schema) {
|
|
1270
|
-
extraMeta[key] = schema[key];
|
|
1271
|
-
}
|
|
1272
|
-
}
|
|
1273
|
-
if (schema.type === "object" && schema.$ref === undefined) {
|
|
1274
|
-
if (schema.propertyNames !== undefined && !containsRef(schema.propertyNames)) {
|
|
1275
|
-
extraMeta.propertyNames = schema.propertyNames;
|
|
1276
|
-
}
|
|
1277
|
-
for (const key of ["minProperties", "maxProperties"]) {
|
|
1278
|
-
if (schema[key] !== undefined)
|
|
1279
|
-
extraMeta[key] = schema[key];
|
|
1280
|
-
}
|
|
1281
|
-
}
|
|
1282
|
-
if (schema.type === "array" && schema.$ref === undefined) {
|
|
1283
|
-
if (schema.contains !== undefined && !containsRef(schema.contains)) {
|
|
1284
|
-
extraMeta.contains = schema.contains;
|
|
1285
|
-
}
|
|
1286
|
-
for (const key of ["uniqueItems", "minContains", "maxContains"]) {
|
|
1287
|
-
if (schema[key] !== undefined)
|
|
1288
|
-
extraMeta[key] = schema[key];
|
|
1289
|
-
}
|
|
1290
|
-
}
|
|
1291
|
-
for (const key of Object.keys(schema)) {
|
|
1292
|
-
if (!RECOGNIZED_KEYS.has(key)) {
|
|
1293
|
-
assignProp(extraMeta, key, schema[key]);
|
|
1294
|
-
}
|
|
1295
|
-
}
|
|
1296
|
-
if (Object.keys(extraMeta).length > 0) {
|
|
1297
|
-
ctx.registry.add(baseSchema, extraMeta);
|
|
1298
|
-
}
|
|
1299
|
-
if (schema.description) {
|
|
1300
|
-
baseSchema = baseSchema.describe(schema.description);
|
|
1301
|
-
}
|
|
1302
|
-
return baseSchema;
|
|
1303
|
-
}
|
|
1304
|
-
function fromJSONSchema(schema, params) {
|
|
1305
|
-
if (typeof schema === "boolean") {
|
|
1306
|
-
return schema ? z.any() : z.never();
|
|
1307
|
-
}
|
|
1308
|
-
let normalized;
|
|
1309
|
-
try {
|
|
1310
|
-
normalized = JSON.parse(JSON.stringify(schema));
|
|
1311
|
-
} catch {
|
|
1312
|
-
throw new Error("fromJSONSchema input is not valid JSON (possibly cyclic); use $defs/$ref for recursive schemas");
|
|
1313
|
-
}
|
|
1314
|
-
const version = detectVersion(normalized, params?.defaultTarget);
|
|
1315
|
-
const defs = normalized.$defs || normalized.definitions || {};
|
|
1316
|
-
const ctx = {
|
|
1317
|
-
version,
|
|
1318
|
-
defs,
|
|
1319
|
-
refs: new Map,
|
|
1320
|
-
processing: new Set,
|
|
1321
|
-
rootSchema: normalized,
|
|
1322
|
-
registry: params?.registry ?? globalRegistry
|
|
1323
|
-
};
|
|
1324
|
-
return convertSchema(normalized, ctx);
|
|
1325
|
-
}
|
|
1326
|
-
// node_modules/.bun/zod@4.6.5/node_modules/zod/v4/core/visit.js
|
|
1327
|
-
var RESOLVING = Symbol("z.visit/resolving");
|
|
1328
|
-
function visit(schema, fnOrHandlers) {
|
|
1329
|
-
const fn = typeof fnOrHandlers === "function" ? fnOrHandlers : (node, rewritten) => {
|
|
1330
|
-
const h = fnOrHandlers[node._zod.def.type];
|
|
1331
|
-
return h ? h(node, rewritten) : node;
|
|
1332
|
-
};
|
|
1333
|
-
const cache = new Map;
|
|
1334
|
-
function run(s) {
|
|
1335
|
-
const cached = cache.get(s);
|
|
1336
|
-
if (cached === RESOLVING) {
|
|
1337
|
-
return new $ZodLazy({
|
|
1338
|
-
type: "lazy",
|
|
1339
|
-
getter: () => cache.get(s)
|
|
1340
|
-
});
|
|
1341
|
-
}
|
|
1342
|
-
if (cached !== undefined)
|
|
1343
|
-
return cached;
|
|
1344
|
-
cache.set(s, RESOLVING);
|
|
1345
|
-
const inner = mapInner(s);
|
|
1346
|
-
const mapped = fn(inner, inner !== s);
|
|
1347
|
-
cache.set(s, mapped);
|
|
1348
|
-
return mapped;
|
|
1349
|
-
}
|
|
1350
|
-
function mapInner(s) {
|
|
1351
|
-
const def = s._zod.def;
|
|
1352
|
-
const kind = def.type;
|
|
1353
|
-
switch (kind) {
|
|
1354
|
-
case "object": {
|
|
1355
|
-
const oldShape = def.shape;
|
|
1356
|
-
const keys = Object.keys(oldShape);
|
|
1357
|
-
let changed = false;
|
|
1358
|
-
const newShape = {};
|
|
1359
|
-
for (const k of keys) {
|
|
1360
|
-
const mapped = run(oldShape[k]);
|
|
1361
|
-
if (mapped !== oldShape[k])
|
|
1362
|
-
changed = true;
|
|
1363
|
-
newShape[k] = mapped;
|
|
1364
|
-
}
|
|
1365
|
-
let newCatchall = def.catchall;
|
|
1366
|
-
if (def.catchall) {
|
|
1367
|
-
newCatchall = run(def.catchall);
|
|
1368
|
-
if (newCatchall !== def.catchall)
|
|
1369
|
-
changed = true;
|
|
1370
|
-
}
|
|
1371
|
-
return changed ? clone(s, { ...def, shape: newShape, catchall: newCatchall }) : s;
|
|
1372
|
-
}
|
|
1373
|
-
case "array": {
|
|
1374
|
-
const mapped = run(def.element);
|
|
1375
|
-
return mapped === def.element ? s : clone(s, { ...def, element: mapped });
|
|
1376
|
-
}
|
|
1377
|
-
case "tuple": {
|
|
1378
|
-
const oldItems = def.items;
|
|
1379
|
-
let changed = false;
|
|
1380
|
-
const newItems = [];
|
|
1381
|
-
for (const item of oldItems) {
|
|
1382
|
-
const mapped = run(item);
|
|
1383
|
-
if (mapped !== item)
|
|
1384
|
-
changed = true;
|
|
1385
|
-
newItems.push(mapped);
|
|
1386
|
-
}
|
|
1387
|
-
let newRest = def.rest;
|
|
1388
|
-
if (def.rest) {
|
|
1389
|
-
newRest = run(def.rest);
|
|
1390
|
-
if (newRest !== def.rest)
|
|
1391
|
-
changed = true;
|
|
1392
|
-
}
|
|
1393
|
-
return changed ? clone(s, { ...def, items: newItems, rest: newRest }) : s;
|
|
1394
|
-
}
|
|
1395
|
-
case "record":
|
|
1396
|
-
case "map": {
|
|
1397
|
-
const newKey = run(def.keyType);
|
|
1398
|
-
const newVal = run(def.valueType);
|
|
1399
|
-
return newKey === def.keyType && newVal === def.valueType ? s : clone(s, { ...def, keyType: newKey, valueType: newVal });
|
|
1400
|
-
}
|
|
1401
|
-
case "set": {
|
|
1402
|
-
const newVal = run(def.valueType);
|
|
1403
|
-
return newVal === def.valueType ? s : clone(s, { ...def, valueType: newVal });
|
|
1404
|
-
}
|
|
1405
|
-
case "union": {
|
|
1406
|
-
const oldOptions = def.options;
|
|
1407
|
-
let changed = false;
|
|
1408
|
-
const newOptions = [];
|
|
1409
|
-
for (const opt of oldOptions) {
|
|
1410
|
-
const mapped = run(opt);
|
|
1411
|
-
if (mapped !== opt)
|
|
1412
|
-
changed = true;
|
|
1413
|
-
newOptions.push(mapped);
|
|
1414
|
-
}
|
|
1415
|
-
return changed ? clone(s, { ...def, options: newOptions }) : s;
|
|
1416
|
-
}
|
|
1417
|
-
case "intersection": {
|
|
1418
|
-
const newLeft = run(def.left);
|
|
1419
|
-
const newRight = run(def.right);
|
|
1420
|
-
return newLeft === def.left && newRight === def.right ? s : clone(s, { ...def, left: newLeft, right: newRight });
|
|
1421
|
-
}
|
|
1422
|
-
case "optional":
|
|
1423
|
-
case "nullable":
|
|
1424
|
-
case "default":
|
|
1425
|
-
case "prefault":
|
|
1426
|
-
case "catch":
|
|
1427
|
-
case "readonly":
|
|
1428
|
-
case "nonoptional":
|
|
1429
|
-
case "promise":
|
|
1430
|
-
case "success": {
|
|
1431
|
-
const newInner = run(def.innerType);
|
|
1432
|
-
return newInner === def.innerType ? s : clone(s, { ...def, innerType: newInner });
|
|
1433
|
-
}
|
|
1434
|
-
case "pipe": {
|
|
1435
|
-
const newIn = run(def.in);
|
|
1436
|
-
const newOut = run(def.out);
|
|
1437
|
-
return newIn === def.in && newOut === def.out ? s : clone(s, { ...def, in: newIn, out: newOut });
|
|
1438
|
-
}
|
|
1439
|
-
case "function": {
|
|
1440
|
-
const newInput = run(def.input);
|
|
1441
|
-
const newOutput = run(def.output);
|
|
1442
|
-
return newInput === def.input && newOutput === def.output ? s : clone(s, { ...def, input: newInput, output: newOutput });
|
|
1443
|
-
}
|
|
1444
|
-
case "lazy": {
|
|
1445
|
-
const original = def.getter;
|
|
1446
|
-
const { _cachedInner, ...rest } = def;
|
|
1447
|
-
return clone(s, { ...rest, getter: () => run(original()) });
|
|
1448
|
-
}
|
|
1449
|
-
case "template_literal":
|
|
1450
|
-
case "string":
|
|
1451
|
-
case "number":
|
|
1452
|
-
case "int":
|
|
1453
|
-
case "boolean":
|
|
1454
|
-
case "bigint":
|
|
1455
|
-
case "symbol":
|
|
1456
|
-
case "undefined":
|
|
1457
|
-
case "null":
|
|
1458
|
-
case "void":
|
|
1459
|
-
case "never":
|
|
1460
|
-
case "any":
|
|
1461
|
-
case "unknown":
|
|
1462
|
-
case "date":
|
|
1463
|
-
case "nan":
|
|
1464
|
-
case "enum":
|
|
1465
|
-
case "literal":
|
|
1466
|
-
case "file":
|
|
1467
|
-
case "transform":
|
|
1468
|
-
case "custom":
|
|
1469
|
-
return s;
|
|
1470
|
-
default: {
|
|
1471
|
-
return s;
|
|
1472
|
-
}
|
|
1473
|
-
}
|
|
1474
|
-
}
|
|
1475
|
-
return run(schema);
|
|
1476
|
-
}
|
|
1477
|
-
|
|
1478
|
-
// node_modules/.bun/zod@4.6.5/node_modules/zod/v4/classic/deep-partial.js
|
|
1479
|
-
function deepPartial(schema) {
|
|
1480
|
-
return visit(schema, {
|
|
1481
|
-
object: (s) => s.partial(),
|
|
1482
|
-
union: (s) => {
|
|
1483
|
-
const def = s._zod.def;
|
|
1484
|
-
return def.discriminator === undefined ? s : union(def.options);
|
|
1485
|
-
}
|
|
1486
|
-
});
|
|
1487
|
-
}
|
|
1488
|
-
// node_modules/.bun/zod@4.6.5/node_modules/zod/v4/classic/in-out.js
|
|
1489
|
-
function withChecks(side, checks) {
|
|
1490
|
-
if (!checks?.length)
|
|
1491
|
-
return side;
|
|
1492
|
-
const def = side._zod.def;
|
|
1493
|
-
return clone(side, mergeDefs(def, { checks: [...def.checks ?? [], ...checks] }), { parent: true });
|
|
1494
|
-
}
|
|
1495
|
-
function outSide(def) {
|
|
1496
|
-
return withChecks(def.out, def.checks);
|
|
1497
|
-
}
|
|
1498
|
-
function inSide(def) {
|
|
1499
|
-
return def.in._zod.traits.has("$ZodTransform") ? outSide(def) : def.in;
|
|
1500
|
-
}
|
|
1501
|
-
function input(schema) {
|
|
1502
|
-
return visit(schema, {
|
|
1503
|
-
pipe: (s) => inSide(s._zod.def),
|
|
1504
|
-
default: (s, rewritten) => rewritten ? optional(s._zod.def.innerType) : s,
|
|
1505
|
-
catch: (s, rewritten) => rewritten ? s._zod.def.innerType : s
|
|
1506
|
-
});
|
|
1507
|
-
}
|
|
1508
|
-
function output(schema) {
|
|
1509
|
-
return visit(schema, {
|
|
1510
|
-
pipe: (s) => outSide(s._zod.def),
|
|
1511
|
-
prefault: (s, rewritten) => rewritten ? s._zod.def.innerType : s
|
|
1512
|
-
});
|
|
1513
|
-
}
|
|
1514
|
-
export { ZodIssueCode, exports_iso, exports_coerce, exports_external };
|