litecms 0.1.2 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +746 -7
- package/dist/admin/CmsAdminLanding.d.ts +89 -0
- package/dist/admin/CmsAdminLanding.d.ts.map +1 -0
- package/dist/admin/CmsAdminLayout.d.ts +26 -3
- package/dist/admin/CmsAdminLayout.d.ts.map +1 -1
- package/dist/admin/CmsAdminPage.d.ts.map +1 -1
- package/dist/admin/CmsBlogAdmin.d.ts +37 -0
- package/dist/admin/CmsBlogAdmin.d.ts.map +1 -0
- package/dist/admin/config.d.ts +32 -0
- package/dist/admin/config.d.ts.map +1 -1
- package/dist/admin/config.js +16 -0
- package/dist/admin/exports.d.ts +5 -2
- package/dist/admin/exports.d.ts.map +1 -1
- package/dist/admin/exports.js +1467 -30
- package/dist/admin/language.d.ts +53 -0
- package/dist/admin/language.d.ts.map +1 -0
- package/dist/components/CmsAutoForm.d.ts.map +1 -1
- package/dist/components/CmsForm.d.ts.map +1 -1
- package/dist/components/CmsImageField.d.ts +2 -1
- package/dist/components/CmsImageField.d.ts.map +1 -1
- package/dist/components/CmsImagePickerModal.d.ts +21 -0
- package/dist/components/CmsImagePickerModal.d.ts.map +1 -0
- package/dist/components/CmsSimpleForm.d.ts.map +1 -1
- package/dist/components/index.d.ts +1 -0
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/index.js +51 -190
- package/dist/index-c9btr14k.js +4422 -0
- package/dist/index-szreq4v9.js +12 -0
- package/dist/index-wmd953zf.js +11423 -0
- package/dist/index.js +6 -2
- package/dist/schema/index.js +2 -0
- package/dist/server/index.d.ts +301 -0
- package/dist/server/index.d.ts.map +1 -1
- package/dist/server/index.js +2585 -1
- package/dist/storage/index.js +2 -0
- package/package.json +14 -7
- package/dist/domain/index.d.ts +0 -1
- package/dist/domain/index.d.ts.map +0 -1
- package/dist/stores/index.d.ts +0 -1
- package/dist/stores/index.d.ts.map +0 -1
package/dist/server/index.js
CHANGED
|
@@ -1,3 +1,2370 @@
|
|
|
1
|
+
import {
|
|
2
|
+
$ZodAny,
|
|
3
|
+
$ZodArray,
|
|
4
|
+
$ZodBase64,
|
|
5
|
+
$ZodBase64URL,
|
|
6
|
+
$ZodBigInt,
|
|
7
|
+
$ZodBigIntFormat,
|
|
8
|
+
$ZodBoolean,
|
|
9
|
+
$ZodCIDRv4,
|
|
10
|
+
$ZodCIDRv6,
|
|
11
|
+
$ZodCUID,
|
|
12
|
+
$ZodCUID2,
|
|
13
|
+
$ZodCatch,
|
|
14
|
+
$ZodCheck,
|
|
15
|
+
$ZodCodec,
|
|
16
|
+
$ZodCustom,
|
|
17
|
+
$ZodCustomStringFormat,
|
|
18
|
+
$ZodDate,
|
|
19
|
+
$ZodDefault,
|
|
20
|
+
$ZodDiscriminatedUnion,
|
|
21
|
+
$ZodE164,
|
|
22
|
+
$ZodEmail,
|
|
23
|
+
$ZodEmoji,
|
|
24
|
+
$ZodEncodeError,
|
|
25
|
+
$ZodEnum,
|
|
26
|
+
$ZodError,
|
|
27
|
+
$ZodExactOptional,
|
|
28
|
+
$ZodFile,
|
|
29
|
+
$ZodFunction,
|
|
30
|
+
$ZodGUID,
|
|
31
|
+
$ZodIPv4,
|
|
32
|
+
$ZodIPv6,
|
|
33
|
+
$ZodISODate,
|
|
34
|
+
$ZodISODateTime,
|
|
35
|
+
$ZodISODuration,
|
|
36
|
+
$ZodISOTime,
|
|
37
|
+
$ZodIntersection,
|
|
38
|
+
$ZodJWT,
|
|
39
|
+
$ZodKSUID,
|
|
40
|
+
$ZodLazy,
|
|
41
|
+
$ZodLiteral,
|
|
42
|
+
$ZodMAC,
|
|
43
|
+
$ZodMap,
|
|
44
|
+
$ZodNaN,
|
|
45
|
+
$ZodNanoID,
|
|
46
|
+
$ZodNever,
|
|
47
|
+
$ZodNonOptional,
|
|
48
|
+
$ZodNull,
|
|
49
|
+
$ZodNullable,
|
|
50
|
+
$ZodNumber,
|
|
51
|
+
$ZodNumberFormat,
|
|
52
|
+
$ZodObjectJIT,
|
|
53
|
+
$ZodOptional,
|
|
54
|
+
$ZodPipe,
|
|
55
|
+
$ZodPrefault,
|
|
56
|
+
$ZodPromise,
|
|
57
|
+
$ZodReadonly,
|
|
58
|
+
$ZodRecord,
|
|
59
|
+
$ZodSet,
|
|
60
|
+
$ZodString,
|
|
61
|
+
$ZodStringFormat,
|
|
62
|
+
$ZodSuccess,
|
|
63
|
+
$ZodSymbol,
|
|
64
|
+
$ZodTemplateLiteral,
|
|
65
|
+
$ZodTransform,
|
|
66
|
+
$ZodTuple,
|
|
67
|
+
$ZodType,
|
|
68
|
+
$ZodULID,
|
|
69
|
+
$ZodURL,
|
|
70
|
+
$ZodUUID,
|
|
71
|
+
$ZodUndefined,
|
|
72
|
+
$ZodUnion,
|
|
73
|
+
$ZodUnknown,
|
|
74
|
+
$ZodVoid,
|
|
75
|
+
$ZodXID,
|
|
76
|
+
$ZodXor,
|
|
77
|
+
$brand,
|
|
78
|
+
$constructor,
|
|
79
|
+
$input,
|
|
80
|
+
$output,
|
|
81
|
+
NEVER,
|
|
82
|
+
TimePrecision,
|
|
83
|
+
_any,
|
|
84
|
+
_array,
|
|
85
|
+
_base64,
|
|
86
|
+
_base64url,
|
|
87
|
+
_bigint,
|
|
88
|
+
_boolean,
|
|
89
|
+
_cidrv4,
|
|
90
|
+
_cidrv6,
|
|
91
|
+
_coercedBigint,
|
|
92
|
+
_coercedBoolean,
|
|
93
|
+
_coercedDate,
|
|
94
|
+
_coercedNumber,
|
|
95
|
+
_coercedString,
|
|
96
|
+
_cuid,
|
|
97
|
+
_cuid2,
|
|
98
|
+
_custom,
|
|
99
|
+
_date,
|
|
100
|
+
_decode,
|
|
101
|
+
_decodeAsync,
|
|
102
|
+
_e164,
|
|
103
|
+
_email,
|
|
104
|
+
_emoji,
|
|
105
|
+
_encode,
|
|
106
|
+
_encodeAsync,
|
|
107
|
+
_endsWith,
|
|
108
|
+
_file,
|
|
109
|
+
_float32,
|
|
110
|
+
_float64,
|
|
111
|
+
_gt,
|
|
112
|
+
_gte,
|
|
113
|
+
_guid,
|
|
114
|
+
_includes,
|
|
115
|
+
_int,
|
|
116
|
+
_int32,
|
|
117
|
+
_int64,
|
|
118
|
+
_ipv4,
|
|
119
|
+
_ipv6,
|
|
120
|
+
_isoDate,
|
|
121
|
+
_isoDateTime,
|
|
122
|
+
_isoDuration,
|
|
123
|
+
_isoTime,
|
|
124
|
+
_jwt,
|
|
125
|
+
_ksuid,
|
|
126
|
+
_length,
|
|
127
|
+
_lowercase,
|
|
128
|
+
_lt,
|
|
129
|
+
_lte,
|
|
130
|
+
_mac,
|
|
131
|
+
_maxLength,
|
|
132
|
+
_maxSize,
|
|
133
|
+
_mime,
|
|
134
|
+
_minLength,
|
|
135
|
+
_minSize,
|
|
136
|
+
_multipleOf,
|
|
137
|
+
_nan,
|
|
138
|
+
_nanoid,
|
|
139
|
+
_negative,
|
|
140
|
+
_never,
|
|
141
|
+
_nonnegative,
|
|
142
|
+
_nonpositive,
|
|
143
|
+
_normalize,
|
|
144
|
+
_null,
|
|
145
|
+
_number,
|
|
146
|
+
_overwrite,
|
|
147
|
+
_parse,
|
|
148
|
+
_parseAsync,
|
|
149
|
+
_positive,
|
|
150
|
+
_property,
|
|
151
|
+
_refine,
|
|
152
|
+
_regex,
|
|
153
|
+
_safeDecode,
|
|
154
|
+
_safeDecodeAsync,
|
|
155
|
+
_safeEncode,
|
|
156
|
+
_safeEncodeAsync,
|
|
157
|
+
_safeParse,
|
|
158
|
+
_safeParseAsync,
|
|
159
|
+
_size,
|
|
160
|
+
_slugify,
|
|
161
|
+
_startsWith,
|
|
162
|
+
_string,
|
|
163
|
+
_stringFormat,
|
|
164
|
+
_stringbool,
|
|
165
|
+
_superRefine,
|
|
166
|
+
_symbol,
|
|
167
|
+
_toLowerCase,
|
|
168
|
+
_toUpperCase,
|
|
169
|
+
_trim,
|
|
170
|
+
_uint32,
|
|
171
|
+
_uint64,
|
|
172
|
+
_ulid,
|
|
173
|
+
_undefined,
|
|
174
|
+
_unknown,
|
|
175
|
+
_uppercase,
|
|
176
|
+
_url,
|
|
177
|
+
_uuid,
|
|
178
|
+
_uuidv4,
|
|
179
|
+
_uuidv6,
|
|
180
|
+
_uuidv7,
|
|
181
|
+
_void,
|
|
182
|
+
_xid,
|
|
183
|
+
anyProcessor,
|
|
184
|
+
arrayProcessor,
|
|
185
|
+
bigintProcessor,
|
|
186
|
+
booleanProcessor,
|
|
187
|
+
catchProcessor,
|
|
188
|
+
clone,
|
|
189
|
+
config,
|
|
190
|
+
createStandardJSONSchemaMethod,
|
|
191
|
+
createToJSONSchemaMethod,
|
|
192
|
+
customProcessor,
|
|
193
|
+
dateProcessor,
|
|
194
|
+
defaultProcessor,
|
|
195
|
+
describe,
|
|
196
|
+
en_default,
|
|
197
|
+
enumProcessor,
|
|
198
|
+
exports_core,
|
|
199
|
+
exports_locales,
|
|
200
|
+
exports_regexes,
|
|
201
|
+
exports_util,
|
|
202
|
+
fileProcessor,
|
|
203
|
+
flattenError,
|
|
204
|
+
formatError,
|
|
205
|
+
functionProcessor,
|
|
206
|
+
globalRegistry,
|
|
207
|
+
intersectionProcessor,
|
|
208
|
+
jsonStringifyReplacer,
|
|
209
|
+
lazyProcessor,
|
|
210
|
+
literalProcessor,
|
|
211
|
+
mapProcessor,
|
|
212
|
+
meta,
|
|
213
|
+
nanProcessor,
|
|
214
|
+
neverProcessor,
|
|
215
|
+
nonoptionalProcessor,
|
|
216
|
+
nullProcessor,
|
|
217
|
+
nullableProcessor,
|
|
218
|
+
numberProcessor,
|
|
219
|
+
objectProcessor,
|
|
220
|
+
optionalProcessor,
|
|
221
|
+
pipeProcessor,
|
|
222
|
+
prefaultProcessor,
|
|
223
|
+
prettifyError,
|
|
224
|
+
promiseProcessor,
|
|
225
|
+
readonlyProcessor,
|
|
226
|
+
recordProcessor,
|
|
227
|
+
registry,
|
|
228
|
+
setProcessor,
|
|
229
|
+
stringProcessor,
|
|
230
|
+
successProcessor,
|
|
231
|
+
symbolProcessor,
|
|
232
|
+
templateLiteralProcessor,
|
|
233
|
+
toJSONSchema,
|
|
234
|
+
transformProcessor,
|
|
235
|
+
treeifyError,
|
|
236
|
+
tupleProcessor,
|
|
237
|
+
undefinedProcessor,
|
|
238
|
+
unionProcessor,
|
|
239
|
+
unknownProcessor,
|
|
240
|
+
voidProcessor
|
|
241
|
+
} from "../index-wmd953zf.js";
|
|
242
|
+
import {
|
|
243
|
+
__export
|
|
244
|
+
} from "../index-szreq4v9.js";
|
|
245
|
+
|
|
246
|
+
// node_modules/zod/v4/classic/external.js
|
|
247
|
+
var exports_external = {};
|
|
248
|
+
__export(exports_external, {
|
|
249
|
+
xor: () => xor,
|
|
250
|
+
xid: () => xid,
|
|
251
|
+
void: () => _void2,
|
|
252
|
+
uuidv7: () => uuidv7,
|
|
253
|
+
uuidv6: () => uuidv6,
|
|
254
|
+
uuidv4: () => uuidv4,
|
|
255
|
+
uuid: () => uuid,
|
|
256
|
+
util: () => exports_util,
|
|
257
|
+
url: () => url,
|
|
258
|
+
uppercase: () => _uppercase,
|
|
259
|
+
unknown: () => unknown,
|
|
260
|
+
union: () => union,
|
|
261
|
+
undefined: () => _undefined2,
|
|
262
|
+
ulid: () => ulid,
|
|
263
|
+
uint64: () => uint64,
|
|
264
|
+
uint32: () => uint32,
|
|
265
|
+
tuple: () => tuple,
|
|
266
|
+
trim: () => _trim,
|
|
267
|
+
treeifyError: () => treeifyError,
|
|
268
|
+
transform: () => transform,
|
|
269
|
+
toUpperCase: () => _toUpperCase,
|
|
270
|
+
toLowerCase: () => _toLowerCase,
|
|
271
|
+
toJSONSchema: () => toJSONSchema,
|
|
272
|
+
templateLiteral: () => templateLiteral,
|
|
273
|
+
symbol: () => symbol,
|
|
274
|
+
superRefine: () => superRefine,
|
|
275
|
+
success: () => success,
|
|
276
|
+
stringbool: () => stringbool,
|
|
277
|
+
stringFormat: () => stringFormat,
|
|
278
|
+
string: () => string,
|
|
279
|
+
strictObject: () => strictObject,
|
|
280
|
+
startsWith: () => _startsWith,
|
|
281
|
+
slugify: () => _slugify,
|
|
282
|
+
size: () => _size,
|
|
283
|
+
setErrorMap: () => setErrorMap,
|
|
284
|
+
set: () => set,
|
|
285
|
+
safeParseAsync: () => safeParseAsync,
|
|
286
|
+
safeParse: () => safeParse,
|
|
287
|
+
safeEncodeAsync: () => safeEncodeAsync,
|
|
288
|
+
safeEncode: () => safeEncode,
|
|
289
|
+
safeDecodeAsync: () => safeDecodeAsync,
|
|
290
|
+
safeDecode: () => safeDecode,
|
|
291
|
+
registry: () => registry,
|
|
292
|
+
regexes: () => exports_regexes,
|
|
293
|
+
regex: () => _regex,
|
|
294
|
+
refine: () => refine,
|
|
295
|
+
record: () => record,
|
|
296
|
+
readonly: () => readonly,
|
|
297
|
+
property: () => _property,
|
|
298
|
+
promise: () => promise,
|
|
299
|
+
prettifyError: () => prettifyError,
|
|
300
|
+
preprocess: () => preprocess,
|
|
301
|
+
prefault: () => prefault,
|
|
302
|
+
positive: () => _positive,
|
|
303
|
+
pipe: () => pipe,
|
|
304
|
+
partialRecord: () => partialRecord,
|
|
305
|
+
parseAsync: () => parseAsync,
|
|
306
|
+
parse: () => parse,
|
|
307
|
+
overwrite: () => _overwrite,
|
|
308
|
+
optional: () => optional,
|
|
309
|
+
object: () => object,
|
|
310
|
+
number: () => number,
|
|
311
|
+
nullish: () => nullish,
|
|
312
|
+
nullable: () => nullable,
|
|
313
|
+
null: () => _null2,
|
|
314
|
+
normalize: () => _normalize,
|
|
315
|
+
nonpositive: () => _nonpositive,
|
|
316
|
+
nonoptional: () => nonoptional,
|
|
317
|
+
nonnegative: () => _nonnegative,
|
|
318
|
+
never: () => never,
|
|
319
|
+
negative: () => _negative,
|
|
320
|
+
nativeEnum: () => nativeEnum,
|
|
321
|
+
nanoid: () => nanoid,
|
|
322
|
+
nan: () => nan,
|
|
323
|
+
multipleOf: () => _multipleOf,
|
|
324
|
+
minSize: () => _minSize,
|
|
325
|
+
minLength: () => _minLength,
|
|
326
|
+
mime: () => _mime,
|
|
327
|
+
meta: () => meta2,
|
|
328
|
+
maxSize: () => _maxSize,
|
|
329
|
+
maxLength: () => _maxLength,
|
|
330
|
+
map: () => map,
|
|
331
|
+
mac: () => mac,
|
|
332
|
+
lte: () => _lte,
|
|
333
|
+
lt: () => _lt,
|
|
334
|
+
lowercase: () => _lowercase,
|
|
335
|
+
looseRecord: () => looseRecord,
|
|
336
|
+
looseObject: () => looseObject,
|
|
337
|
+
locales: () => exports_locales,
|
|
338
|
+
literal: () => literal,
|
|
339
|
+
length: () => _length,
|
|
340
|
+
lazy: () => lazy,
|
|
341
|
+
ksuid: () => ksuid,
|
|
342
|
+
keyof: () => keyof,
|
|
343
|
+
jwt: () => jwt,
|
|
344
|
+
json: () => json,
|
|
345
|
+
iso: () => exports_iso,
|
|
346
|
+
ipv6: () => ipv6,
|
|
347
|
+
ipv4: () => ipv4,
|
|
348
|
+
intersection: () => intersection,
|
|
349
|
+
int64: () => int64,
|
|
350
|
+
int32: () => int32,
|
|
351
|
+
int: () => int,
|
|
352
|
+
instanceof: () => _instanceof,
|
|
353
|
+
includes: () => _includes,
|
|
354
|
+
httpUrl: () => httpUrl,
|
|
355
|
+
hostname: () => hostname,
|
|
356
|
+
hex: () => hex,
|
|
357
|
+
hash: () => hash,
|
|
358
|
+
guid: () => guid,
|
|
359
|
+
gte: () => _gte,
|
|
360
|
+
gt: () => _gt,
|
|
361
|
+
globalRegistry: () => globalRegistry,
|
|
362
|
+
getErrorMap: () => getErrorMap,
|
|
363
|
+
function: () => _function,
|
|
364
|
+
fromJSONSchema: () => fromJSONSchema,
|
|
365
|
+
formatError: () => formatError,
|
|
366
|
+
float64: () => float64,
|
|
367
|
+
float32: () => float32,
|
|
368
|
+
flattenError: () => flattenError,
|
|
369
|
+
file: () => file,
|
|
370
|
+
exactOptional: () => exactOptional,
|
|
371
|
+
enum: () => _enum,
|
|
372
|
+
endsWith: () => _endsWith,
|
|
373
|
+
encodeAsync: () => encodeAsync,
|
|
374
|
+
encode: () => encode,
|
|
375
|
+
emoji: () => emoji,
|
|
376
|
+
email: () => email,
|
|
377
|
+
e164: () => e164,
|
|
378
|
+
discriminatedUnion: () => discriminatedUnion,
|
|
379
|
+
describe: () => describe2,
|
|
380
|
+
decodeAsync: () => decodeAsync,
|
|
381
|
+
decode: () => decode,
|
|
382
|
+
date: () => date2,
|
|
383
|
+
custom: () => custom,
|
|
384
|
+
cuid2: () => cuid2,
|
|
385
|
+
cuid: () => cuid,
|
|
386
|
+
core: () => exports_core,
|
|
387
|
+
config: () => config,
|
|
388
|
+
coerce: () => exports_coerce,
|
|
389
|
+
codec: () => codec,
|
|
390
|
+
clone: () => clone,
|
|
391
|
+
cidrv6: () => cidrv6,
|
|
392
|
+
cidrv4: () => cidrv4,
|
|
393
|
+
check: () => check,
|
|
394
|
+
catch: () => _catch,
|
|
395
|
+
boolean: () => boolean,
|
|
396
|
+
bigint: () => bigint,
|
|
397
|
+
base64url: () => base64url,
|
|
398
|
+
base64: () => base64,
|
|
399
|
+
array: () => array,
|
|
400
|
+
any: () => any,
|
|
401
|
+
_function: () => _function,
|
|
402
|
+
_default: () => _default,
|
|
403
|
+
_ZodString: () => _ZodString,
|
|
404
|
+
ZodXor: () => ZodXor,
|
|
405
|
+
ZodXID: () => ZodXID,
|
|
406
|
+
ZodVoid: () => ZodVoid,
|
|
407
|
+
ZodUnknown: () => ZodUnknown,
|
|
408
|
+
ZodUnion: () => ZodUnion,
|
|
409
|
+
ZodUndefined: () => ZodUndefined,
|
|
410
|
+
ZodUUID: () => ZodUUID,
|
|
411
|
+
ZodURL: () => ZodURL,
|
|
412
|
+
ZodULID: () => ZodULID,
|
|
413
|
+
ZodType: () => ZodType,
|
|
414
|
+
ZodTuple: () => ZodTuple,
|
|
415
|
+
ZodTransform: () => ZodTransform,
|
|
416
|
+
ZodTemplateLiteral: () => ZodTemplateLiteral,
|
|
417
|
+
ZodSymbol: () => ZodSymbol,
|
|
418
|
+
ZodSuccess: () => ZodSuccess,
|
|
419
|
+
ZodStringFormat: () => ZodStringFormat,
|
|
420
|
+
ZodString: () => ZodString,
|
|
421
|
+
ZodSet: () => ZodSet,
|
|
422
|
+
ZodRecord: () => ZodRecord,
|
|
423
|
+
ZodRealError: () => ZodRealError,
|
|
424
|
+
ZodReadonly: () => ZodReadonly,
|
|
425
|
+
ZodPromise: () => ZodPromise,
|
|
426
|
+
ZodPrefault: () => ZodPrefault,
|
|
427
|
+
ZodPipe: () => ZodPipe,
|
|
428
|
+
ZodOptional: () => ZodOptional,
|
|
429
|
+
ZodObject: () => ZodObject,
|
|
430
|
+
ZodNumberFormat: () => ZodNumberFormat,
|
|
431
|
+
ZodNumber: () => ZodNumber,
|
|
432
|
+
ZodNullable: () => ZodNullable,
|
|
433
|
+
ZodNull: () => ZodNull,
|
|
434
|
+
ZodNonOptional: () => ZodNonOptional,
|
|
435
|
+
ZodNever: () => ZodNever,
|
|
436
|
+
ZodNanoID: () => ZodNanoID,
|
|
437
|
+
ZodNaN: () => ZodNaN,
|
|
438
|
+
ZodMap: () => ZodMap,
|
|
439
|
+
ZodMAC: () => ZodMAC,
|
|
440
|
+
ZodLiteral: () => ZodLiteral,
|
|
441
|
+
ZodLazy: () => ZodLazy,
|
|
442
|
+
ZodKSUID: () => ZodKSUID,
|
|
443
|
+
ZodJWT: () => ZodJWT,
|
|
444
|
+
ZodIssueCode: () => ZodIssueCode,
|
|
445
|
+
ZodIntersection: () => ZodIntersection,
|
|
446
|
+
ZodISOTime: () => ZodISOTime,
|
|
447
|
+
ZodISODuration: () => ZodISODuration,
|
|
448
|
+
ZodISODateTime: () => ZodISODateTime,
|
|
449
|
+
ZodISODate: () => ZodISODate,
|
|
450
|
+
ZodIPv6: () => ZodIPv6,
|
|
451
|
+
ZodIPv4: () => ZodIPv4,
|
|
452
|
+
ZodGUID: () => ZodGUID,
|
|
453
|
+
ZodFunction: () => ZodFunction,
|
|
454
|
+
ZodFirstPartyTypeKind: () => ZodFirstPartyTypeKind,
|
|
455
|
+
ZodFile: () => ZodFile,
|
|
456
|
+
ZodExactOptional: () => ZodExactOptional,
|
|
457
|
+
ZodError: () => ZodError,
|
|
458
|
+
ZodEnum: () => ZodEnum,
|
|
459
|
+
ZodEmoji: () => ZodEmoji,
|
|
460
|
+
ZodEmail: () => ZodEmail,
|
|
461
|
+
ZodE164: () => ZodE164,
|
|
462
|
+
ZodDiscriminatedUnion: () => ZodDiscriminatedUnion,
|
|
463
|
+
ZodDefault: () => ZodDefault,
|
|
464
|
+
ZodDate: () => ZodDate,
|
|
465
|
+
ZodCustomStringFormat: () => ZodCustomStringFormat,
|
|
466
|
+
ZodCustom: () => ZodCustom,
|
|
467
|
+
ZodCodec: () => ZodCodec,
|
|
468
|
+
ZodCatch: () => ZodCatch,
|
|
469
|
+
ZodCUID2: () => ZodCUID2,
|
|
470
|
+
ZodCUID: () => ZodCUID,
|
|
471
|
+
ZodCIDRv6: () => ZodCIDRv6,
|
|
472
|
+
ZodCIDRv4: () => ZodCIDRv4,
|
|
473
|
+
ZodBoolean: () => ZodBoolean,
|
|
474
|
+
ZodBigIntFormat: () => ZodBigIntFormat,
|
|
475
|
+
ZodBigInt: () => ZodBigInt,
|
|
476
|
+
ZodBase64URL: () => ZodBase64URL,
|
|
477
|
+
ZodBase64: () => ZodBase64,
|
|
478
|
+
ZodArray: () => ZodArray,
|
|
479
|
+
ZodAny: () => ZodAny,
|
|
480
|
+
TimePrecision: () => TimePrecision,
|
|
481
|
+
NEVER: () => NEVER,
|
|
482
|
+
$output: () => $output,
|
|
483
|
+
$input: () => $input,
|
|
484
|
+
$brand: () => $brand
|
|
485
|
+
});
|
|
486
|
+
|
|
487
|
+
// node_modules/zod/v4/classic/schemas.js
|
|
488
|
+
var exports_schemas = {};
|
|
489
|
+
__export(exports_schemas, {
|
|
490
|
+
xor: () => xor,
|
|
491
|
+
xid: () => xid,
|
|
492
|
+
void: () => _void2,
|
|
493
|
+
uuidv7: () => uuidv7,
|
|
494
|
+
uuidv6: () => uuidv6,
|
|
495
|
+
uuidv4: () => uuidv4,
|
|
496
|
+
uuid: () => uuid,
|
|
497
|
+
url: () => url,
|
|
498
|
+
unknown: () => unknown,
|
|
499
|
+
union: () => union,
|
|
500
|
+
undefined: () => _undefined2,
|
|
501
|
+
ulid: () => ulid,
|
|
502
|
+
uint64: () => uint64,
|
|
503
|
+
uint32: () => uint32,
|
|
504
|
+
tuple: () => tuple,
|
|
505
|
+
transform: () => transform,
|
|
506
|
+
templateLiteral: () => templateLiteral,
|
|
507
|
+
symbol: () => symbol,
|
|
508
|
+
superRefine: () => superRefine,
|
|
509
|
+
success: () => success,
|
|
510
|
+
stringbool: () => stringbool,
|
|
511
|
+
stringFormat: () => stringFormat,
|
|
512
|
+
string: () => string,
|
|
513
|
+
strictObject: () => strictObject,
|
|
514
|
+
set: () => set,
|
|
515
|
+
refine: () => refine,
|
|
516
|
+
record: () => record,
|
|
517
|
+
readonly: () => readonly,
|
|
518
|
+
promise: () => promise,
|
|
519
|
+
preprocess: () => preprocess,
|
|
520
|
+
prefault: () => prefault,
|
|
521
|
+
pipe: () => pipe,
|
|
522
|
+
partialRecord: () => partialRecord,
|
|
523
|
+
optional: () => optional,
|
|
524
|
+
object: () => object,
|
|
525
|
+
number: () => number,
|
|
526
|
+
nullish: () => nullish,
|
|
527
|
+
nullable: () => nullable,
|
|
528
|
+
null: () => _null2,
|
|
529
|
+
nonoptional: () => nonoptional,
|
|
530
|
+
never: () => never,
|
|
531
|
+
nativeEnum: () => nativeEnum,
|
|
532
|
+
nanoid: () => nanoid,
|
|
533
|
+
nan: () => nan,
|
|
534
|
+
meta: () => meta2,
|
|
535
|
+
map: () => map,
|
|
536
|
+
mac: () => mac,
|
|
537
|
+
looseRecord: () => looseRecord,
|
|
538
|
+
looseObject: () => looseObject,
|
|
539
|
+
literal: () => literal,
|
|
540
|
+
lazy: () => lazy,
|
|
541
|
+
ksuid: () => ksuid,
|
|
542
|
+
keyof: () => keyof,
|
|
543
|
+
jwt: () => jwt,
|
|
544
|
+
json: () => json,
|
|
545
|
+
ipv6: () => ipv6,
|
|
546
|
+
ipv4: () => ipv4,
|
|
547
|
+
intersection: () => intersection,
|
|
548
|
+
int64: () => int64,
|
|
549
|
+
int32: () => int32,
|
|
550
|
+
int: () => int,
|
|
551
|
+
instanceof: () => _instanceof,
|
|
552
|
+
httpUrl: () => httpUrl,
|
|
553
|
+
hostname: () => hostname,
|
|
554
|
+
hex: () => hex,
|
|
555
|
+
hash: () => hash,
|
|
556
|
+
guid: () => guid,
|
|
557
|
+
function: () => _function,
|
|
558
|
+
float64: () => float64,
|
|
559
|
+
float32: () => float32,
|
|
560
|
+
file: () => file,
|
|
561
|
+
exactOptional: () => exactOptional,
|
|
562
|
+
enum: () => _enum,
|
|
563
|
+
emoji: () => emoji,
|
|
564
|
+
email: () => email,
|
|
565
|
+
e164: () => e164,
|
|
566
|
+
discriminatedUnion: () => discriminatedUnion,
|
|
567
|
+
describe: () => describe2,
|
|
568
|
+
date: () => date2,
|
|
569
|
+
custom: () => custom,
|
|
570
|
+
cuid2: () => cuid2,
|
|
571
|
+
cuid: () => cuid,
|
|
572
|
+
codec: () => codec,
|
|
573
|
+
cidrv6: () => cidrv6,
|
|
574
|
+
cidrv4: () => cidrv4,
|
|
575
|
+
check: () => check,
|
|
576
|
+
catch: () => _catch,
|
|
577
|
+
boolean: () => boolean,
|
|
578
|
+
bigint: () => bigint,
|
|
579
|
+
base64url: () => base64url,
|
|
580
|
+
base64: () => base64,
|
|
581
|
+
array: () => array,
|
|
582
|
+
any: () => any,
|
|
583
|
+
_function: () => _function,
|
|
584
|
+
_default: () => _default,
|
|
585
|
+
_ZodString: () => _ZodString,
|
|
586
|
+
ZodXor: () => ZodXor,
|
|
587
|
+
ZodXID: () => ZodXID,
|
|
588
|
+
ZodVoid: () => ZodVoid,
|
|
589
|
+
ZodUnknown: () => ZodUnknown,
|
|
590
|
+
ZodUnion: () => ZodUnion,
|
|
591
|
+
ZodUndefined: () => ZodUndefined,
|
|
592
|
+
ZodUUID: () => ZodUUID,
|
|
593
|
+
ZodURL: () => ZodURL,
|
|
594
|
+
ZodULID: () => ZodULID,
|
|
595
|
+
ZodType: () => ZodType,
|
|
596
|
+
ZodTuple: () => ZodTuple,
|
|
597
|
+
ZodTransform: () => ZodTransform,
|
|
598
|
+
ZodTemplateLiteral: () => ZodTemplateLiteral,
|
|
599
|
+
ZodSymbol: () => ZodSymbol,
|
|
600
|
+
ZodSuccess: () => ZodSuccess,
|
|
601
|
+
ZodStringFormat: () => ZodStringFormat,
|
|
602
|
+
ZodString: () => ZodString,
|
|
603
|
+
ZodSet: () => ZodSet,
|
|
604
|
+
ZodRecord: () => ZodRecord,
|
|
605
|
+
ZodReadonly: () => ZodReadonly,
|
|
606
|
+
ZodPromise: () => ZodPromise,
|
|
607
|
+
ZodPrefault: () => ZodPrefault,
|
|
608
|
+
ZodPipe: () => ZodPipe,
|
|
609
|
+
ZodOptional: () => ZodOptional,
|
|
610
|
+
ZodObject: () => ZodObject,
|
|
611
|
+
ZodNumberFormat: () => ZodNumberFormat,
|
|
612
|
+
ZodNumber: () => ZodNumber,
|
|
613
|
+
ZodNullable: () => ZodNullable,
|
|
614
|
+
ZodNull: () => ZodNull,
|
|
615
|
+
ZodNonOptional: () => ZodNonOptional,
|
|
616
|
+
ZodNever: () => ZodNever,
|
|
617
|
+
ZodNanoID: () => ZodNanoID,
|
|
618
|
+
ZodNaN: () => ZodNaN,
|
|
619
|
+
ZodMap: () => ZodMap,
|
|
620
|
+
ZodMAC: () => ZodMAC,
|
|
621
|
+
ZodLiteral: () => ZodLiteral,
|
|
622
|
+
ZodLazy: () => ZodLazy,
|
|
623
|
+
ZodKSUID: () => ZodKSUID,
|
|
624
|
+
ZodJWT: () => ZodJWT,
|
|
625
|
+
ZodIntersection: () => ZodIntersection,
|
|
626
|
+
ZodIPv6: () => ZodIPv6,
|
|
627
|
+
ZodIPv4: () => ZodIPv4,
|
|
628
|
+
ZodGUID: () => ZodGUID,
|
|
629
|
+
ZodFunction: () => ZodFunction,
|
|
630
|
+
ZodFile: () => ZodFile,
|
|
631
|
+
ZodExactOptional: () => ZodExactOptional,
|
|
632
|
+
ZodEnum: () => ZodEnum,
|
|
633
|
+
ZodEmoji: () => ZodEmoji,
|
|
634
|
+
ZodEmail: () => ZodEmail,
|
|
635
|
+
ZodE164: () => ZodE164,
|
|
636
|
+
ZodDiscriminatedUnion: () => ZodDiscriminatedUnion,
|
|
637
|
+
ZodDefault: () => ZodDefault,
|
|
638
|
+
ZodDate: () => ZodDate,
|
|
639
|
+
ZodCustomStringFormat: () => ZodCustomStringFormat,
|
|
640
|
+
ZodCustom: () => ZodCustom,
|
|
641
|
+
ZodCodec: () => ZodCodec,
|
|
642
|
+
ZodCatch: () => ZodCatch,
|
|
643
|
+
ZodCUID2: () => ZodCUID2,
|
|
644
|
+
ZodCUID: () => ZodCUID,
|
|
645
|
+
ZodCIDRv6: () => ZodCIDRv6,
|
|
646
|
+
ZodCIDRv4: () => ZodCIDRv4,
|
|
647
|
+
ZodBoolean: () => ZodBoolean,
|
|
648
|
+
ZodBigIntFormat: () => ZodBigIntFormat,
|
|
649
|
+
ZodBigInt: () => ZodBigInt,
|
|
650
|
+
ZodBase64URL: () => ZodBase64URL,
|
|
651
|
+
ZodBase64: () => ZodBase64,
|
|
652
|
+
ZodArray: () => ZodArray,
|
|
653
|
+
ZodAny: () => ZodAny
|
|
654
|
+
});
|
|
655
|
+
|
|
656
|
+
// node_modules/zod/v4/classic/checks.js
|
|
657
|
+
var exports_checks = {};
|
|
658
|
+
__export(exports_checks, {
|
|
659
|
+
uppercase: () => _uppercase,
|
|
660
|
+
trim: () => _trim,
|
|
661
|
+
toUpperCase: () => _toUpperCase,
|
|
662
|
+
toLowerCase: () => _toLowerCase,
|
|
663
|
+
startsWith: () => _startsWith,
|
|
664
|
+
slugify: () => _slugify,
|
|
665
|
+
size: () => _size,
|
|
666
|
+
regex: () => _regex,
|
|
667
|
+
property: () => _property,
|
|
668
|
+
positive: () => _positive,
|
|
669
|
+
overwrite: () => _overwrite,
|
|
670
|
+
normalize: () => _normalize,
|
|
671
|
+
nonpositive: () => _nonpositive,
|
|
672
|
+
nonnegative: () => _nonnegative,
|
|
673
|
+
negative: () => _negative,
|
|
674
|
+
multipleOf: () => _multipleOf,
|
|
675
|
+
minSize: () => _minSize,
|
|
676
|
+
minLength: () => _minLength,
|
|
677
|
+
mime: () => _mime,
|
|
678
|
+
maxSize: () => _maxSize,
|
|
679
|
+
maxLength: () => _maxLength,
|
|
680
|
+
lte: () => _lte,
|
|
681
|
+
lt: () => _lt,
|
|
682
|
+
lowercase: () => _lowercase,
|
|
683
|
+
length: () => _length,
|
|
684
|
+
includes: () => _includes,
|
|
685
|
+
gte: () => _gte,
|
|
686
|
+
gt: () => _gt,
|
|
687
|
+
endsWith: () => _endsWith
|
|
688
|
+
});
|
|
689
|
+
|
|
690
|
+
// node_modules/zod/v4/classic/iso.js
|
|
691
|
+
var exports_iso = {};
|
|
692
|
+
__export(exports_iso, {
|
|
693
|
+
time: () => time,
|
|
694
|
+
duration: () => duration,
|
|
695
|
+
datetime: () => datetime,
|
|
696
|
+
date: () => date,
|
|
697
|
+
ZodISOTime: () => ZodISOTime,
|
|
698
|
+
ZodISODuration: () => ZodISODuration,
|
|
699
|
+
ZodISODateTime: () => ZodISODateTime,
|
|
700
|
+
ZodISODate: () => ZodISODate
|
|
701
|
+
});
|
|
702
|
+
var ZodISODateTime = /* @__PURE__ */ $constructor("ZodISODateTime", (inst, def) => {
|
|
703
|
+
$ZodISODateTime.init(inst, def);
|
|
704
|
+
ZodStringFormat.init(inst, def);
|
|
705
|
+
});
|
|
706
|
+
function datetime(params) {
|
|
707
|
+
return _isoDateTime(ZodISODateTime, params);
|
|
708
|
+
}
|
|
709
|
+
var ZodISODate = /* @__PURE__ */ $constructor("ZodISODate", (inst, def) => {
|
|
710
|
+
$ZodISODate.init(inst, def);
|
|
711
|
+
ZodStringFormat.init(inst, def);
|
|
712
|
+
});
|
|
713
|
+
function date(params) {
|
|
714
|
+
return _isoDate(ZodISODate, params);
|
|
715
|
+
}
|
|
716
|
+
var ZodISOTime = /* @__PURE__ */ $constructor("ZodISOTime", (inst, def) => {
|
|
717
|
+
$ZodISOTime.init(inst, def);
|
|
718
|
+
ZodStringFormat.init(inst, def);
|
|
719
|
+
});
|
|
720
|
+
function time(params) {
|
|
721
|
+
return _isoTime(ZodISOTime, params);
|
|
722
|
+
}
|
|
723
|
+
var ZodISODuration = /* @__PURE__ */ $constructor("ZodISODuration", (inst, def) => {
|
|
724
|
+
$ZodISODuration.init(inst, def);
|
|
725
|
+
ZodStringFormat.init(inst, def);
|
|
726
|
+
});
|
|
727
|
+
function duration(params) {
|
|
728
|
+
return _isoDuration(ZodISODuration, params);
|
|
729
|
+
}
|
|
730
|
+
|
|
731
|
+
// node_modules/zod/v4/classic/errors.js
|
|
732
|
+
var initializer = (inst, issues) => {
|
|
733
|
+
$ZodError.init(inst, issues);
|
|
734
|
+
inst.name = "ZodError";
|
|
735
|
+
Object.defineProperties(inst, {
|
|
736
|
+
format: {
|
|
737
|
+
value: (mapper) => formatError(inst, mapper)
|
|
738
|
+
},
|
|
739
|
+
flatten: {
|
|
740
|
+
value: (mapper) => flattenError(inst, mapper)
|
|
741
|
+
},
|
|
742
|
+
addIssue: {
|
|
743
|
+
value: (issue) => {
|
|
744
|
+
inst.issues.push(issue);
|
|
745
|
+
inst.message = JSON.stringify(inst.issues, jsonStringifyReplacer, 2);
|
|
746
|
+
}
|
|
747
|
+
},
|
|
748
|
+
addIssues: {
|
|
749
|
+
value: (issues2) => {
|
|
750
|
+
inst.issues.push(...issues2);
|
|
751
|
+
inst.message = JSON.stringify(inst.issues, jsonStringifyReplacer, 2);
|
|
752
|
+
}
|
|
753
|
+
},
|
|
754
|
+
isEmpty: {
|
|
755
|
+
get() {
|
|
756
|
+
return inst.issues.length === 0;
|
|
757
|
+
}
|
|
758
|
+
}
|
|
759
|
+
});
|
|
760
|
+
};
|
|
761
|
+
var ZodError = $constructor("ZodError", initializer);
|
|
762
|
+
var ZodRealError = $constructor("ZodError", initializer, {
|
|
763
|
+
Parent: Error
|
|
764
|
+
});
|
|
765
|
+
|
|
766
|
+
// node_modules/zod/v4/classic/parse.js
|
|
767
|
+
var parse = /* @__PURE__ */ _parse(ZodRealError);
|
|
768
|
+
var parseAsync = /* @__PURE__ */ _parseAsync(ZodRealError);
|
|
769
|
+
var safeParse = /* @__PURE__ */ _safeParse(ZodRealError);
|
|
770
|
+
var safeParseAsync = /* @__PURE__ */ _safeParseAsync(ZodRealError);
|
|
771
|
+
var encode = /* @__PURE__ */ _encode(ZodRealError);
|
|
772
|
+
var decode = /* @__PURE__ */ _decode(ZodRealError);
|
|
773
|
+
var encodeAsync = /* @__PURE__ */ _encodeAsync(ZodRealError);
|
|
774
|
+
var decodeAsync = /* @__PURE__ */ _decodeAsync(ZodRealError);
|
|
775
|
+
var safeEncode = /* @__PURE__ */ _safeEncode(ZodRealError);
|
|
776
|
+
var safeDecode = /* @__PURE__ */ _safeDecode(ZodRealError);
|
|
777
|
+
var safeEncodeAsync = /* @__PURE__ */ _safeEncodeAsync(ZodRealError);
|
|
778
|
+
var safeDecodeAsync = /* @__PURE__ */ _safeDecodeAsync(ZodRealError);
|
|
779
|
+
|
|
780
|
+
// node_modules/zod/v4/classic/schemas.js
|
|
781
|
+
var ZodType = /* @__PURE__ */ $constructor("ZodType", (inst, def) => {
|
|
782
|
+
$ZodType.init(inst, def);
|
|
783
|
+
Object.assign(inst["~standard"], {
|
|
784
|
+
jsonSchema: {
|
|
785
|
+
input: createStandardJSONSchemaMethod(inst, "input"),
|
|
786
|
+
output: createStandardJSONSchemaMethod(inst, "output")
|
|
787
|
+
}
|
|
788
|
+
});
|
|
789
|
+
inst.toJSONSchema = createToJSONSchemaMethod(inst, {});
|
|
790
|
+
inst.def = def;
|
|
791
|
+
inst.type = def.type;
|
|
792
|
+
Object.defineProperty(inst, "_def", { value: def });
|
|
793
|
+
inst.check = (...checks) => {
|
|
794
|
+
return inst.clone(exports_util.mergeDefs(def, {
|
|
795
|
+
checks: [
|
|
796
|
+
...def.checks ?? [],
|
|
797
|
+
...checks.map((ch) => typeof ch === "function" ? { _zod: { check: ch, def: { check: "custom" }, onattach: [] } } : ch)
|
|
798
|
+
]
|
|
799
|
+
}), {
|
|
800
|
+
parent: true
|
|
801
|
+
});
|
|
802
|
+
};
|
|
803
|
+
inst.with = inst.check;
|
|
804
|
+
inst.clone = (def2, params) => clone(inst, def2, params);
|
|
805
|
+
inst.brand = () => inst;
|
|
806
|
+
inst.register = (reg, meta2) => {
|
|
807
|
+
reg.add(inst, meta2);
|
|
808
|
+
return inst;
|
|
809
|
+
};
|
|
810
|
+
inst.parse = (data, params) => parse(inst, data, params, { callee: inst.parse });
|
|
811
|
+
inst.safeParse = (data, params) => safeParse(inst, data, params);
|
|
812
|
+
inst.parseAsync = async (data, params) => parseAsync(inst, data, params, { callee: inst.parseAsync });
|
|
813
|
+
inst.safeParseAsync = async (data, params) => safeParseAsync(inst, data, params);
|
|
814
|
+
inst.spa = inst.safeParseAsync;
|
|
815
|
+
inst.encode = (data, params) => encode(inst, data, params);
|
|
816
|
+
inst.decode = (data, params) => decode(inst, data, params);
|
|
817
|
+
inst.encodeAsync = async (data, params) => encodeAsync(inst, data, params);
|
|
818
|
+
inst.decodeAsync = async (data, params) => decodeAsync(inst, data, params);
|
|
819
|
+
inst.safeEncode = (data, params) => safeEncode(inst, data, params);
|
|
820
|
+
inst.safeDecode = (data, params) => safeDecode(inst, data, params);
|
|
821
|
+
inst.safeEncodeAsync = async (data, params) => safeEncodeAsync(inst, data, params);
|
|
822
|
+
inst.safeDecodeAsync = async (data, params) => safeDecodeAsync(inst, data, params);
|
|
823
|
+
inst.refine = (check, params) => inst.check(refine(check, params));
|
|
824
|
+
inst.superRefine = (refinement) => inst.check(superRefine(refinement));
|
|
825
|
+
inst.overwrite = (fn) => inst.check(_overwrite(fn));
|
|
826
|
+
inst.optional = () => optional(inst);
|
|
827
|
+
inst.exactOptional = () => exactOptional(inst);
|
|
828
|
+
inst.nullable = () => nullable(inst);
|
|
829
|
+
inst.nullish = () => optional(nullable(inst));
|
|
830
|
+
inst.nonoptional = (params) => nonoptional(inst, params);
|
|
831
|
+
inst.array = () => array(inst);
|
|
832
|
+
inst.or = (arg) => union([inst, arg]);
|
|
833
|
+
inst.and = (arg) => intersection(inst, arg);
|
|
834
|
+
inst.transform = (tx) => pipe(inst, transform(tx));
|
|
835
|
+
inst.default = (def2) => _default(inst, def2);
|
|
836
|
+
inst.prefault = (def2) => prefault(inst, def2);
|
|
837
|
+
inst.catch = (params) => _catch(inst, params);
|
|
838
|
+
inst.pipe = (target) => pipe(inst, target);
|
|
839
|
+
inst.readonly = () => readonly(inst);
|
|
840
|
+
inst.describe = (description) => {
|
|
841
|
+
const cl = inst.clone();
|
|
842
|
+
globalRegistry.add(cl, { description });
|
|
843
|
+
return cl;
|
|
844
|
+
};
|
|
845
|
+
Object.defineProperty(inst, "description", {
|
|
846
|
+
get() {
|
|
847
|
+
return globalRegistry.get(inst)?.description;
|
|
848
|
+
},
|
|
849
|
+
configurable: true
|
|
850
|
+
});
|
|
851
|
+
inst.meta = (...args) => {
|
|
852
|
+
if (args.length === 0) {
|
|
853
|
+
return globalRegistry.get(inst);
|
|
854
|
+
}
|
|
855
|
+
const cl = inst.clone();
|
|
856
|
+
globalRegistry.add(cl, args[0]);
|
|
857
|
+
return cl;
|
|
858
|
+
};
|
|
859
|
+
inst.isOptional = () => inst.safeParse(undefined).success;
|
|
860
|
+
inst.isNullable = () => inst.safeParse(null).success;
|
|
861
|
+
inst.apply = (fn) => fn(inst);
|
|
862
|
+
return inst;
|
|
863
|
+
});
|
|
864
|
+
var _ZodString = /* @__PURE__ */ $constructor("_ZodString", (inst, def) => {
|
|
865
|
+
$ZodString.init(inst, def);
|
|
866
|
+
ZodType.init(inst, def);
|
|
867
|
+
inst._zod.processJSONSchema = (ctx, json, params) => stringProcessor(inst, ctx, json, params);
|
|
868
|
+
const bag = inst._zod.bag;
|
|
869
|
+
inst.format = bag.format ?? null;
|
|
870
|
+
inst.minLength = bag.minimum ?? null;
|
|
871
|
+
inst.maxLength = bag.maximum ?? null;
|
|
872
|
+
inst.regex = (...args) => inst.check(_regex(...args));
|
|
873
|
+
inst.includes = (...args) => inst.check(_includes(...args));
|
|
874
|
+
inst.startsWith = (...args) => inst.check(_startsWith(...args));
|
|
875
|
+
inst.endsWith = (...args) => inst.check(_endsWith(...args));
|
|
876
|
+
inst.min = (...args) => inst.check(_minLength(...args));
|
|
877
|
+
inst.max = (...args) => inst.check(_maxLength(...args));
|
|
878
|
+
inst.length = (...args) => inst.check(_length(...args));
|
|
879
|
+
inst.nonempty = (...args) => inst.check(_minLength(1, ...args));
|
|
880
|
+
inst.lowercase = (params) => inst.check(_lowercase(params));
|
|
881
|
+
inst.uppercase = (params) => inst.check(_uppercase(params));
|
|
882
|
+
inst.trim = () => inst.check(_trim());
|
|
883
|
+
inst.normalize = (...args) => inst.check(_normalize(...args));
|
|
884
|
+
inst.toLowerCase = () => inst.check(_toLowerCase());
|
|
885
|
+
inst.toUpperCase = () => inst.check(_toUpperCase());
|
|
886
|
+
inst.slugify = () => inst.check(_slugify());
|
|
887
|
+
});
|
|
888
|
+
var ZodString = /* @__PURE__ */ $constructor("ZodString", (inst, def) => {
|
|
889
|
+
$ZodString.init(inst, def);
|
|
890
|
+
_ZodString.init(inst, def);
|
|
891
|
+
inst.email = (params) => inst.check(_email(ZodEmail, params));
|
|
892
|
+
inst.url = (params) => inst.check(_url(ZodURL, params));
|
|
893
|
+
inst.jwt = (params) => inst.check(_jwt(ZodJWT, params));
|
|
894
|
+
inst.emoji = (params) => inst.check(_emoji(ZodEmoji, params));
|
|
895
|
+
inst.guid = (params) => inst.check(_guid(ZodGUID, params));
|
|
896
|
+
inst.uuid = (params) => inst.check(_uuid(ZodUUID, params));
|
|
897
|
+
inst.uuidv4 = (params) => inst.check(_uuidv4(ZodUUID, params));
|
|
898
|
+
inst.uuidv6 = (params) => inst.check(_uuidv6(ZodUUID, params));
|
|
899
|
+
inst.uuidv7 = (params) => inst.check(_uuidv7(ZodUUID, params));
|
|
900
|
+
inst.nanoid = (params) => inst.check(_nanoid(ZodNanoID, params));
|
|
901
|
+
inst.guid = (params) => inst.check(_guid(ZodGUID, params));
|
|
902
|
+
inst.cuid = (params) => inst.check(_cuid(ZodCUID, params));
|
|
903
|
+
inst.cuid2 = (params) => inst.check(_cuid2(ZodCUID2, params));
|
|
904
|
+
inst.ulid = (params) => inst.check(_ulid(ZodULID, params));
|
|
905
|
+
inst.base64 = (params) => inst.check(_base64(ZodBase64, params));
|
|
906
|
+
inst.base64url = (params) => inst.check(_base64url(ZodBase64URL, params));
|
|
907
|
+
inst.xid = (params) => inst.check(_xid(ZodXID, params));
|
|
908
|
+
inst.ksuid = (params) => inst.check(_ksuid(ZodKSUID, params));
|
|
909
|
+
inst.ipv4 = (params) => inst.check(_ipv4(ZodIPv4, params));
|
|
910
|
+
inst.ipv6 = (params) => inst.check(_ipv6(ZodIPv6, params));
|
|
911
|
+
inst.cidrv4 = (params) => inst.check(_cidrv4(ZodCIDRv4, params));
|
|
912
|
+
inst.cidrv6 = (params) => inst.check(_cidrv6(ZodCIDRv6, params));
|
|
913
|
+
inst.e164 = (params) => inst.check(_e164(ZodE164, params));
|
|
914
|
+
inst.datetime = (params) => inst.check(datetime(params));
|
|
915
|
+
inst.date = (params) => inst.check(date(params));
|
|
916
|
+
inst.time = (params) => inst.check(time(params));
|
|
917
|
+
inst.duration = (params) => inst.check(duration(params));
|
|
918
|
+
});
|
|
919
|
+
function string(params) {
|
|
920
|
+
return _string(ZodString, params);
|
|
921
|
+
}
|
|
922
|
+
var ZodStringFormat = /* @__PURE__ */ $constructor("ZodStringFormat", (inst, def) => {
|
|
923
|
+
$ZodStringFormat.init(inst, def);
|
|
924
|
+
_ZodString.init(inst, def);
|
|
925
|
+
});
|
|
926
|
+
var ZodEmail = /* @__PURE__ */ $constructor("ZodEmail", (inst, def) => {
|
|
927
|
+
$ZodEmail.init(inst, def);
|
|
928
|
+
ZodStringFormat.init(inst, def);
|
|
929
|
+
});
|
|
930
|
+
function email(params) {
|
|
931
|
+
return _email(ZodEmail, params);
|
|
932
|
+
}
|
|
933
|
+
var ZodGUID = /* @__PURE__ */ $constructor("ZodGUID", (inst, def) => {
|
|
934
|
+
$ZodGUID.init(inst, def);
|
|
935
|
+
ZodStringFormat.init(inst, def);
|
|
936
|
+
});
|
|
937
|
+
function guid(params) {
|
|
938
|
+
return _guid(ZodGUID, params);
|
|
939
|
+
}
|
|
940
|
+
var ZodUUID = /* @__PURE__ */ $constructor("ZodUUID", (inst, def) => {
|
|
941
|
+
$ZodUUID.init(inst, def);
|
|
942
|
+
ZodStringFormat.init(inst, def);
|
|
943
|
+
});
|
|
944
|
+
function uuid(params) {
|
|
945
|
+
return _uuid(ZodUUID, params);
|
|
946
|
+
}
|
|
947
|
+
function uuidv4(params) {
|
|
948
|
+
return _uuidv4(ZodUUID, params);
|
|
949
|
+
}
|
|
950
|
+
function uuidv6(params) {
|
|
951
|
+
return _uuidv6(ZodUUID, params);
|
|
952
|
+
}
|
|
953
|
+
function uuidv7(params) {
|
|
954
|
+
return _uuidv7(ZodUUID, params);
|
|
955
|
+
}
|
|
956
|
+
var ZodURL = /* @__PURE__ */ $constructor("ZodURL", (inst, def) => {
|
|
957
|
+
$ZodURL.init(inst, def);
|
|
958
|
+
ZodStringFormat.init(inst, def);
|
|
959
|
+
});
|
|
960
|
+
function url(params) {
|
|
961
|
+
return _url(ZodURL, params);
|
|
962
|
+
}
|
|
963
|
+
function httpUrl(params) {
|
|
964
|
+
return _url(ZodURL, {
|
|
965
|
+
protocol: /^https?$/,
|
|
966
|
+
hostname: exports_regexes.domain,
|
|
967
|
+
...exports_util.normalizeParams(params)
|
|
968
|
+
});
|
|
969
|
+
}
|
|
970
|
+
var ZodEmoji = /* @__PURE__ */ $constructor("ZodEmoji", (inst, def) => {
|
|
971
|
+
$ZodEmoji.init(inst, def);
|
|
972
|
+
ZodStringFormat.init(inst, def);
|
|
973
|
+
});
|
|
974
|
+
function emoji(params) {
|
|
975
|
+
return _emoji(ZodEmoji, params);
|
|
976
|
+
}
|
|
977
|
+
var ZodNanoID = /* @__PURE__ */ $constructor("ZodNanoID", (inst, def) => {
|
|
978
|
+
$ZodNanoID.init(inst, def);
|
|
979
|
+
ZodStringFormat.init(inst, def);
|
|
980
|
+
});
|
|
981
|
+
function nanoid(params) {
|
|
982
|
+
return _nanoid(ZodNanoID, params);
|
|
983
|
+
}
|
|
984
|
+
var ZodCUID = /* @__PURE__ */ $constructor("ZodCUID", (inst, def) => {
|
|
985
|
+
$ZodCUID.init(inst, def);
|
|
986
|
+
ZodStringFormat.init(inst, def);
|
|
987
|
+
});
|
|
988
|
+
function cuid(params) {
|
|
989
|
+
return _cuid(ZodCUID, params);
|
|
990
|
+
}
|
|
991
|
+
var ZodCUID2 = /* @__PURE__ */ $constructor("ZodCUID2", (inst, def) => {
|
|
992
|
+
$ZodCUID2.init(inst, def);
|
|
993
|
+
ZodStringFormat.init(inst, def);
|
|
994
|
+
});
|
|
995
|
+
function cuid2(params) {
|
|
996
|
+
return _cuid2(ZodCUID2, params);
|
|
997
|
+
}
|
|
998
|
+
var ZodULID = /* @__PURE__ */ $constructor("ZodULID", (inst, def) => {
|
|
999
|
+
$ZodULID.init(inst, def);
|
|
1000
|
+
ZodStringFormat.init(inst, def);
|
|
1001
|
+
});
|
|
1002
|
+
function ulid(params) {
|
|
1003
|
+
return _ulid(ZodULID, params);
|
|
1004
|
+
}
|
|
1005
|
+
var ZodXID = /* @__PURE__ */ $constructor("ZodXID", (inst, def) => {
|
|
1006
|
+
$ZodXID.init(inst, def);
|
|
1007
|
+
ZodStringFormat.init(inst, def);
|
|
1008
|
+
});
|
|
1009
|
+
function xid(params) {
|
|
1010
|
+
return _xid(ZodXID, params);
|
|
1011
|
+
}
|
|
1012
|
+
var ZodKSUID = /* @__PURE__ */ $constructor("ZodKSUID", (inst, def) => {
|
|
1013
|
+
$ZodKSUID.init(inst, def);
|
|
1014
|
+
ZodStringFormat.init(inst, def);
|
|
1015
|
+
});
|
|
1016
|
+
function ksuid(params) {
|
|
1017
|
+
return _ksuid(ZodKSUID, params);
|
|
1018
|
+
}
|
|
1019
|
+
var ZodIPv4 = /* @__PURE__ */ $constructor("ZodIPv4", (inst, def) => {
|
|
1020
|
+
$ZodIPv4.init(inst, def);
|
|
1021
|
+
ZodStringFormat.init(inst, def);
|
|
1022
|
+
});
|
|
1023
|
+
function ipv4(params) {
|
|
1024
|
+
return _ipv4(ZodIPv4, params);
|
|
1025
|
+
}
|
|
1026
|
+
var ZodMAC = /* @__PURE__ */ $constructor("ZodMAC", (inst, def) => {
|
|
1027
|
+
$ZodMAC.init(inst, def);
|
|
1028
|
+
ZodStringFormat.init(inst, def);
|
|
1029
|
+
});
|
|
1030
|
+
function mac(params) {
|
|
1031
|
+
return _mac(ZodMAC, params);
|
|
1032
|
+
}
|
|
1033
|
+
var ZodIPv6 = /* @__PURE__ */ $constructor("ZodIPv6", (inst, def) => {
|
|
1034
|
+
$ZodIPv6.init(inst, def);
|
|
1035
|
+
ZodStringFormat.init(inst, def);
|
|
1036
|
+
});
|
|
1037
|
+
function ipv6(params) {
|
|
1038
|
+
return _ipv6(ZodIPv6, params);
|
|
1039
|
+
}
|
|
1040
|
+
var ZodCIDRv4 = /* @__PURE__ */ $constructor("ZodCIDRv4", (inst, def) => {
|
|
1041
|
+
$ZodCIDRv4.init(inst, def);
|
|
1042
|
+
ZodStringFormat.init(inst, def);
|
|
1043
|
+
});
|
|
1044
|
+
function cidrv4(params) {
|
|
1045
|
+
return _cidrv4(ZodCIDRv4, params);
|
|
1046
|
+
}
|
|
1047
|
+
var ZodCIDRv6 = /* @__PURE__ */ $constructor("ZodCIDRv6", (inst, def) => {
|
|
1048
|
+
$ZodCIDRv6.init(inst, def);
|
|
1049
|
+
ZodStringFormat.init(inst, def);
|
|
1050
|
+
});
|
|
1051
|
+
function cidrv6(params) {
|
|
1052
|
+
return _cidrv6(ZodCIDRv6, params);
|
|
1053
|
+
}
|
|
1054
|
+
var ZodBase64 = /* @__PURE__ */ $constructor("ZodBase64", (inst, def) => {
|
|
1055
|
+
$ZodBase64.init(inst, def);
|
|
1056
|
+
ZodStringFormat.init(inst, def);
|
|
1057
|
+
});
|
|
1058
|
+
function base64(params) {
|
|
1059
|
+
return _base64(ZodBase64, params);
|
|
1060
|
+
}
|
|
1061
|
+
var ZodBase64URL = /* @__PURE__ */ $constructor("ZodBase64URL", (inst, def) => {
|
|
1062
|
+
$ZodBase64URL.init(inst, def);
|
|
1063
|
+
ZodStringFormat.init(inst, def);
|
|
1064
|
+
});
|
|
1065
|
+
function base64url(params) {
|
|
1066
|
+
return _base64url(ZodBase64URL, params);
|
|
1067
|
+
}
|
|
1068
|
+
var ZodE164 = /* @__PURE__ */ $constructor("ZodE164", (inst, def) => {
|
|
1069
|
+
$ZodE164.init(inst, def);
|
|
1070
|
+
ZodStringFormat.init(inst, def);
|
|
1071
|
+
});
|
|
1072
|
+
function e164(params) {
|
|
1073
|
+
return _e164(ZodE164, params);
|
|
1074
|
+
}
|
|
1075
|
+
var ZodJWT = /* @__PURE__ */ $constructor("ZodJWT", (inst, def) => {
|
|
1076
|
+
$ZodJWT.init(inst, def);
|
|
1077
|
+
ZodStringFormat.init(inst, def);
|
|
1078
|
+
});
|
|
1079
|
+
function jwt(params) {
|
|
1080
|
+
return _jwt(ZodJWT, params);
|
|
1081
|
+
}
|
|
1082
|
+
var ZodCustomStringFormat = /* @__PURE__ */ $constructor("ZodCustomStringFormat", (inst, def) => {
|
|
1083
|
+
$ZodCustomStringFormat.init(inst, def);
|
|
1084
|
+
ZodStringFormat.init(inst, def);
|
|
1085
|
+
});
|
|
1086
|
+
function stringFormat(format, fnOrRegex, _params = {}) {
|
|
1087
|
+
return _stringFormat(ZodCustomStringFormat, format, fnOrRegex, _params);
|
|
1088
|
+
}
|
|
1089
|
+
function hostname(_params) {
|
|
1090
|
+
return _stringFormat(ZodCustomStringFormat, "hostname", exports_regexes.hostname, _params);
|
|
1091
|
+
}
|
|
1092
|
+
function hex(_params) {
|
|
1093
|
+
return _stringFormat(ZodCustomStringFormat, "hex", exports_regexes.hex, _params);
|
|
1094
|
+
}
|
|
1095
|
+
function hash(alg, params) {
|
|
1096
|
+
const enc = params?.enc ?? "hex";
|
|
1097
|
+
const format = `${alg}_${enc}`;
|
|
1098
|
+
const regex = exports_regexes[format];
|
|
1099
|
+
if (!regex)
|
|
1100
|
+
throw new Error(`Unrecognized hash format: ${format}`);
|
|
1101
|
+
return _stringFormat(ZodCustomStringFormat, format, regex, params);
|
|
1102
|
+
}
|
|
1103
|
+
var ZodNumber = /* @__PURE__ */ $constructor("ZodNumber", (inst, def) => {
|
|
1104
|
+
$ZodNumber.init(inst, def);
|
|
1105
|
+
ZodType.init(inst, def);
|
|
1106
|
+
inst._zod.processJSONSchema = (ctx, json, params) => numberProcessor(inst, ctx, json, params);
|
|
1107
|
+
inst.gt = (value, params) => inst.check(_gt(value, params));
|
|
1108
|
+
inst.gte = (value, params) => inst.check(_gte(value, params));
|
|
1109
|
+
inst.min = (value, params) => inst.check(_gte(value, params));
|
|
1110
|
+
inst.lt = (value, params) => inst.check(_lt(value, params));
|
|
1111
|
+
inst.lte = (value, params) => inst.check(_lte(value, params));
|
|
1112
|
+
inst.max = (value, params) => inst.check(_lte(value, params));
|
|
1113
|
+
inst.int = (params) => inst.check(int(params));
|
|
1114
|
+
inst.safe = (params) => inst.check(int(params));
|
|
1115
|
+
inst.positive = (params) => inst.check(_gt(0, params));
|
|
1116
|
+
inst.nonnegative = (params) => inst.check(_gte(0, params));
|
|
1117
|
+
inst.negative = (params) => inst.check(_lt(0, params));
|
|
1118
|
+
inst.nonpositive = (params) => inst.check(_lte(0, params));
|
|
1119
|
+
inst.multipleOf = (value, params) => inst.check(_multipleOf(value, params));
|
|
1120
|
+
inst.step = (value, params) => inst.check(_multipleOf(value, params));
|
|
1121
|
+
inst.finite = () => inst;
|
|
1122
|
+
const bag = inst._zod.bag;
|
|
1123
|
+
inst.minValue = Math.max(bag.minimum ?? Number.NEGATIVE_INFINITY, bag.exclusiveMinimum ?? Number.NEGATIVE_INFINITY) ?? null;
|
|
1124
|
+
inst.maxValue = Math.min(bag.maximum ?? Number.POSITIVE_INFINITY, bag.exclusiveMaximum ?? Number.POSITIVE_INFINITY) ?? null;
|
|
1125
|
+
inst.isInt = (bag.format ?? "").includes("int") || Number.isSafeInteger(bag.multipleOf ?? 0.5);
|
|
1126
|
+
inst.isFinite = true;
|
|
1127
|
+
inst.format = bag.format ?? null;
|
|
1128
|
+
});
|
|
1129
|
+
function number(params) {
|
|
1130
|
+
return _number(ZodNumber, params);
|
|
1131
|
+
}
|
|
1132
|
+
var ZodNumberFormat = /* @__PURE__ */ $constructor("ZodNumberFormat", (inst, def) => {
|
|
1133
|
+
$ZodNumberFormat.init(inst, def);
|
|
1134
|
+
ZodNumber.init(inst, def);
|
|
1135
|
+
});
|
|
1136
|
+
function int(params) {
|
|
1137
|
+
return _int(ZodNumberFormat, params);
|
|
1138
|
+
}
|
|
1139
|
+
function float32(params) {
|
|
1140
|
+
return _float32(ZodNumberFormat, params);
|
|
1141
|
+
}
|
|
1142
|
+
function float64(params) {
|
|
1143
|
+
return _float64(ZodNumberFormat, params);
|
|
1144
|
+
}
|
|
1145
|
+
function int32(params) {
|
|
1146
|
+
return _int32(ZodNumberFormat, params);
|
|
1147
|
+
}
|
|
1148
|
+
function uint32(params) {
|
|
1149
|
+
return _uint32(ZodNumberFormat, params);
|
|
1150
|
+
}
|
|
1151
|
+
var ZodBoolean = /* @__PURE__ */ $constructor("ZodBoolean", (inst, def) => {
|
|
1152
|
+
$ZodBoolean.init(inst, def);
|
|
1153
|
+
ZodType.init(inst, def);
|
|
1154
|
+
inst._zod.processJSONSchema = (ctx, json, params) => booleanProcessor(inst, ctx, json, params);
|
|
1155
|
+
});
|
|
1156
|
+
function boolean(params) {
|
|
1157
|
+
return _boolean(ZodBoolean, params);
|
|
1158
|
+
}
|
|
1159
|
+
var ZodBigInt = /* @__PURE__ */ $constructor("ZodBigInt", (inst, def) => {
|
|
1160
|
+
$ZodBigInt.init(inst, def);
|
|
1161
|
+
ZodType.init(inst, def);
|
|
1162
|
+
inst._zod.processJSONSchema = (ctx, json, params) => bigintProcessor(inst, ctx, json, params);
|
|
1163
|
+
inst.gte = (value, params) => inst.check(_gte(value, params));
|
|
1164
|
+
inst.min = (value, params) => inst.check(_gte(value, params));
|
|
1165
|
+
inst.gt = (value, params) => inst.check(_gt(value, params));
|
|
1166
|
+
inst.gte = (value, params) => inst.check(_gte(value, params));
|
|
1167
|
+
inst.min = (value, params) => inst.check(_gte(value, params));
|
|
1168
|
+
inst.lt = (value, params) => inst.check(_lt(value, params));
|
|
1169
|
+
inst.lte = (value, params) => inst.check(_lte(value, params));
|
|
1170
|
+
inst.max = (value, params) => inst.check(_lte(value, params));
|
|
1171
|
+
inst.positive = (params) => inst.check(_gt(BigInt(0), params));
|
|
1172
|
+
inst.negative = (params) => inst.check(_lt(BigInt(0), params));
|
|
1173
|
+
inst.nonpositive = (params) => inst.check(_lte(BigInt(0), params));
|
|
1174
|
+
inst.nonnegative = (params) => inst.check(_gte(BigInt(0), params));
|
|
1175
|
+
inst.multipleOf = (value, params) => inst.check(_multipleOf(value, params));
|
|
1176
|
+
const bag = inst._zod.bag;
|
|
1177
|
+
inst.minValue = bag.minimum ?? null;
|
|
1178
|
+
inst.maxValue = bag.maximum ?? null;
|
|
1179
|
+
inst.format = bag.format ?? null;
|
|
1180
|
+
});
|
|
1181
|
+
function bigint(params) {
|
|
1182
|
+
return _bigint(ZodBigInt, params);
|
|
1183
|
+
}
|
|
1184
|
+
var ZodBigIntFormat = /* @__PURE__ */ $constructor("ZodBigIntFormat", (inst, def) => {
|
|
1185
|
+
$ZodBigIntFormat.init(inst, def);
|
|
1186
|
+
ZodBigInt.init(inst, def);
|
|
1187
|
+
});
|
|
1188
|
+
function int64(params) {
|
|
1189
|
+
return _int64(ZodBigIntFormat, params);
|
|
1190
|
+
}
|
|
1191
|
+
function uint64(params) {
|
|
1192
|
+
return _uint64(ZodBigIntFormat, params);
|
|
1193
|
+
}
|
|
1194
|
+
var ZodSymbol = /* @__PURE__ */ $constructor("ZodSymbol", (inst, def) => {
|
|
1195
|
+
$ZodSymbol.init(inst, def);
|
|
1196
|
+
ZodType.init(inst, def);
|
|
1197
|
+
inst._zod.processJSONSchema = (ctx, json, params) => symbolProcessor(inst, ctx, json, params);
|
|
1198
|
+
});
|
|
1199
|
+
function symbol(params) {
|
|
1200
|
+
return _symbol(ZodSymbol, params);
|
|
1201
|
+
}
|
|
1202
|
+
var ZodUndefined = /* @__PURE__ */ $constructor("ZodUndefined", (inst, def) => {
|
|
1203
|
+
$ZodUndefined.init(inst, def);
|
|
1204
|
+
ZodType.init(inst, def);
|
|
1205
|
+
inst._zod.processJSONSchema = (ctx, json, params) => undefinedProcessor(inst, ctx, json, params);
|
|
1206
|
+
});
|
|
1207
|
+
function _undefined2(params) {
|
|
1208
|
+
return _undefined(ZodUndefined, params);
|
|
1209
|
+
}
|
|
1210
|
+
var ZodNull = /* @__PURE__ */ $constructor("ZodNull", (inst, def) => {
|
|
1211
|
+
$ZodNull.init(inst, def);
|
|
1212
|
+
ZodType.init(inst, def);
|
|
1213
|
+
inst._zod.processJSONSchema = (ctx, json, params) => nullProcessor(inst, ctx, json, params);
|
|
1214
|
+
});
|
|
1215
|
+
function _null2(params) {
|
|
1216
|
+
return _null(ZodNull, params);
|
|
1217
|
+
}
|
|
1218
|
+
var ZodAny = /* @__PURE__ */ $constructor("ZodAny", (inst, def) => {
|
|
1219
|
+
$ZodAny.init(inst, def);
|
|
1220
|
+
ZodType.init(inst, def);
|
|
1221
|
+
inst._zod.processJSONSchema = (ctx, json, params) => anyProcessor(inst, ctx, json, params);
|
|
1222
|
+
});
|
|
1223
|
+
function any() {
|
|
1224
|
+
return _any(ZodAny);
|
|
1225
|
+
}
|
|
1226
|
+
var ZodUnknown = /* @__PURE__ */ $constructor("ZodUnknown", (inst, def) => {
|
|
1227
|
+
$ZodUnknown.init(inst, def);
|
|
1228
|
+
ZodType.init(inst, def);
|
|
1229
|
+
inst._zod.processJSONSchema = (ctx, json, params) => unknownProcessor(inst, ctx, json, params);
|
|
1230
|
+
});
|
|
1231
|
+
function unknown() {
|
|
1232
|
+
return _unknown(ZodUnknown);
|
|
1233
|
+
}
|
|
1234
|
+
var ZodNever = /* @__PURE__ */ $constructor("ZodNever", (inst, def) => {
|
|
1235
|
+
$ZodNever.init(inst, def);
|
|
1236
|
+
ZodType.init(inst, def);
|
|
1237
|
+
inst._zod.processJSONSchema = (ctx, json, params) => neverProcessor(inst, ctx, json, params);
|
|
1238
|
+
});
|
|
1239
|
+
function never(params) {
|
|
1240
|
+
return _never(ZodNever, params);
|
|
1241
|
+
}
|
|
1242
|
+
var ZodVoid = /* @__PURE__ */ $constructor("ZodVoid", (inst, def) => {
|
|
1243
|
+
$ZodVoid.init(inst, def);
|
|
1244
|
+
ZodType.init(inst, def);
|
|
1245
|
+
inst._zod.processJSONSchema = (ctx, json, params) => voidProcessor(inst, ctx, json, params);
|
|
1246
|
+
});
|
|
1247
|
+
function _void2(params) {
|
|
1248
|
+
return _void(ZodVoid, params);
|
|
1249
|
+
}
|
|
1250
|
+
var ZodDate = /* @__PURE__ */ $constructor("ZodDate", (inst, def) => {
|
|
1251
|
+
$ZodDate.init(inst, def);
|
|
1252
|
+
ZodType.init(inst, def);
|
|
1253
|
+
inst._zod.processJSONSchema = (ctx, json, params) => dateProcessor(inst, ctx, json, params);
|
|
1254
|
+
inst.min = (value, params) => inst.check(_gte(value, params));
|
|
1255
|
+
inst.max = (value, params) => inst.check(_lte(value, params));
|
|
1256
|
+
const c = inst._zod.bag;
|
|
1257
|
+
inst.minDate = c.minimum ? new Date(c.minimum) : null;
|
|
1258
|
+
inst.maxDate = c.maximum ? new Date(c.maximum) : null;
|
|
1259
|
+
});
|
|
1260
|
+
function date2(params) {
|
|
1261
|
+
return _date(ZodDate, params);
|
|
1262
|
+
}
|
|
1263
|
+
var ZodArray = /* @__PURE__ */ $constructor("ZodArray", (inst, def) => {
|
|
1264
|
+
$ZodArray.init(inst, def);
|
|
1265
|
+
ZodType.init(inst, def);
|
|
1266
|
+
inst._zod.processJSONSchema = (ctx, json, params) => arrayProcessor(inst, ctx, json, params);
|
|
1267
|
+
inst.element = def.element;
|
|
1268
|
+
inst.min = (minLength, params) => inst.check(_minLength(minLength, params));
|
|
1269
|
+
inst.nonempty = (params) => inst.check(_minLength(1, params));
|
|
1270
|
+
inst.max = (maxLength, params) => inst.check(_maxLength(maxLength, params));
|
|
1271
|
+
inst.length = (len, params) => inst.check(_length(len, params));
|
|
1272
|
+
inst.unwrap = () => inst.element;
|
|
1273
|
+
});
|
|
1274
|
+
function array(element, params) {
|
|
1275
|
+
return _array(ZodArray, element, params);
|
|
1276
|
+
}
|
|
1277
|
+
function keyof(schema) {
|
|
1278
|
+
const shape = schema._zod.def.shape;
|
|
1279
|
+
return _enum(Object.keys(shape));
|
|
1280
|
+
}
|
|
1281
|
+
var ZodObject = /* @__PURE__ */ $constructor("ZodObject", (inst, def) => {
|
|
1282
|
+
$ZodObjectJIT.init(inst, def);
|
|
1283
|
+
ZodType.init(inst, def);
|
|
1284
|
+
inst._zod.processJSONSchema = (ctx, json, params) => objectProcessor(inst, ctx, json, params);
|
|
1285
|
+
exports_util.defineLazy(inst, "shape", () => {
|
|
1286
|
+
return def.shape;
|
|
1287
|
+
});
|
|
1288
|
+
inst.keyof = () => _enum(Object.keys(inst._zod.def.shape));
|
|
1289
|
+
inst.catchall = (catchall) => inst.clone({ ...inst._zod.def, catchall });
|
|
1290
|
+
inst.passthrough = () => inst.clone({ ...inst._zod.def, catchall: unknown() });
|
|
1291
|
+
inst.loose = () => inst.clone({ ...inst._zod.def, catchall: unknown() });
|
|
1292
|
+
inst.strict = () => inst.clone({ ...inst._zod.def, catchall: never() });
|
|
1293
|
+
inst.strip = () => inst.clone({ ...inst._zod.def, catchall: undefined });
|
|
1294
|
+
inst.extend = (incoming) => {
|
|
1295
|
+
return exports_util.extend(inst, incoming);
|
|
1296
|
+
};
|
|
1297
|
+
inst.safeExtend = (incoming) => {
|
|
1298
|
+
return exports_util.safeExtend(inst, incoming);
|
|
1299
|
+
};
|
|
1300
|
+
inst.merge = (other) => exports_util.merge(inst, other);
|
|
1301
|
+
inst.pick = (mask) => exports_util.pick(inst, mask);
|
|
1302
|
+
inst.omit = (mask) => exports_util.omit(inst, mask);
|
|
1303
|
+
inst.partial = (...args) => exports_util.partial(ZodOptional, inst, args[0]);
|
|
1304
|
+
inst.required = (...args) => exports_util.required(ZodNonOptional, inst, args[0]);
|
|
1305
|
+
});
|
|
1306
|
+
function object(shape, params) {
|
|
1307
|
+
const def = {
|
|
1308
|
+
type: "object",
|
|
1309
|
+
shape: shape ?? {},
|
|
1310
|
+
...exports_util.normalizeParams(params)
|
|
1311
|
+
};
|
|
1312
|
+
return new ZodObject(def);
|
|
1313
|
+
}
|
|
1314
|
+
function strictObject(shape, params) {
|
|
1315
|
+
return new ZodObject({
|
|
1316
|
+
type: "object",
|
|
1317
|
+
shape,
|
|
1318
|
+
catchall: never(),
|
|
1319
|
+
...exports_util.normalizeParams(params)
|
|
1320
|
+
});
|
|
1321
|
+
}
|
|
1322
|
+
function looseObject(shape, params) {
|
|
1323
|
+
return new ZodObject({
|
|
1324
|
+
type: "object",
|
|
1325
|
+
shape,
|
|
1326
|
+
catchall: unknown(),
|
|
1327
|
+
...exports_util.normalizeParams(params)
|
|
1328
|
+
});
|
|
1329
|
+
}
|
|
1330
|
+
var ZodUnion = /* @__PURE__ */ $constructor("ZodUnion", (inst, def) => {
|
|
1331
|
+
$ZodUnion.init(inst, def);
|
|
1332
|
+
ZodType.init(inst, def);
|
|
1333
|
+
inst._zod.processJSONSchema = (ctx, json, params) => unionProcessor(inst, ctx, json, params);
|
|
1334
|
+
inst.options = def.options;
|
|
1335
|
+
});
|
|
1336
|
+
function union(options, params) {
|
|
1337
|
+
return new ZodUnion({
|
|
1338
|
+
type: "union",
|
|
1339
|
+
options,
|
|
1340
|
+
...exports_util.normalizeParams(params)
|
|
1341
|
+
});
|
|
1342
|
+
}
|
|
1343
|
+
var ZodXor = /* @__PURE__ */ $constructor("ZodXor", (inst, def) => {
|
|
1344
|
+
ZodUnion.init(inst, def);
|
|
1345
|
+
$ZodXor.init(inst, def);
|
|
1346
|
+
inst._zod.processJSONSchema = (ctx, json, params) => unionProcessor(inst, ctx, json, params);
|
|
1347
|
+
inst.options = def.options;
|
|
1348
|
+
});
|
|
1349
|
+
function xor(options, params) {
|
|
1350
|
+
return new ZodXor({
|
|
1351
|
+
type: "union",
|
|
1352
|
+
options,
|
|
1353
|
+
inclusive: false,
|
|
1354
|
+
...exports_util.normalizeParams(params)
|
|
1355
|
+
});
|
|
1356
|
+
}
|
|
1357
|
+
var ZodDiscriminatedUnion = /* @__PURE__ */ $constructor("ZodDiscriminatedUnion", (inst, def) => {
|
|
1358
|
+
ZodUnion.init(inst, def);
|
|
1359
|
+
$ZodDiscriminatedUnion.init(inst, def);
|
|
1360
|
+
});
|
|
1361
|
+
function discriminatedUnion(discriminator, options, params) {
|
|
1362
|
+
return new ZodDiscriminatedUnion({
|
|
1363
|
+
type: "union",
|
|
1364
|
+
options,
|
|
1365
|
+
discriminator,
|
|
1366
|
+
...exports_util.normalizeParams(params)
|
|
1367
|
+
});
|
|
1368
|
+
}
|
|
1369
|
+
var ZodIntersection = /* @__PURE__ */ $constructor("ZodIntersection", (inst, def) => {
|
|
1370
|
+
$ZodIntersection.init(inst, def);
|
|
1371
|
+
ZodType.init(inst, def);
|
|
1372
|
+
inst._zod.processJSONSchema = (ctx, json, params) => intersectionProcessor(inst, ctx, json, params);
|
|
1373
|
+
});
|
|
1374
|
+
function intersection(left, right) {
|
|
1375
|
+
return new ZodIntersection({
|
|
1376
|
+
type: "intersection",
|
|
1377
|
+
left,
|
|
1378
|
+
right
|
|
1379
|
+
});
|
|
1380
|
+
}
|
|
1381
|
+
var ZodTuple = /* @__PURE__ */ $constructor("ZodTuple", (inst, def) => {
|
|
1382
|
+
$ZodTuple.init(inst, def);
|
|
1383
|
+
ZodType.init(inst, def);
|
|
1384
|
+
inst._zod.processJSONSchema = (ctx, json, params) => tupleProcessor(inst, ctx, json, params);
|
|
1385
|
+
inst.rest = (rest) => inst.clone({
|
|
1386
|
+
...inst._zod.def,
|
|
1387
|
+
rest
|
|
1388
|
+
});
|
|
1389
|
+
});
|
|
1390
|
+
function tuple(items, _paramsOrRest, _params) {
|
|
1391
|
+
const hasRest = _paramsOrRest instanceof $ZodType;
|
|
1392
|
+
const params = hasRest ? _params : _paramsOrRest;
|
|
1393
|
+
const rest = hasRest ? _paramsOrRest : null;
|
|
1394
|
+
return new ZodTuple({
|
|
1395
|
+
type: "tuple",
|
|
1396
|
+
items,
|
|
1397
|
+
rest,
|
|
1398
|
+
...exports_util.normalizeParams(params)
|
|
1399
|
+
});
|
|
1400
|
+
}
|
|
1401
|
+
var ZodRecord = /* @__PURE__ */ $constructor("ZodRecord", (inst, def) => {
|
|
1402
|
+
$ZodRecord.init(inst, def);
|
|
1403
|
+
ZodType.init(inst, def);
|
|
1404
|
+
inst._zod.processJSONSchema = (ctx, json, params) => recordProcessor(inst, ctx, json, params);
|
|
1405
|
+
inst.keyType = def.keyType;
|
|
1406
|
+
inst.valueType = def.valueType;
|
|
1407
|
+
});
|
|
1408
|
+
function record(keyType, valueType, params) {
|
|
1409
|
+
return new ZodRecord({
|
|
1410
|
+
type: "record",
|
|
1411
|
+
keyType,
|
|
1412
|
+
valueType,
|
|
1413
|
+
...exports_util.normalizeParams(params)
|
|
1414
|
+
});
|
|
1415
|
+
}
|
|
1416
|
+
function partialRecord(keyType, valueType, params) {
|
|
1417
|
+
const k = clone(keyType);
|
|
1418
|
+
k._zod.values = undefined;
|
|
1419
|
+
return new ZodRecord({
|
|
1420
|
+
type: "record",
|
|
1421
|
+
keyType: k,
|
|
1422
|
+
valueType,
|
|
1423
|
+
...exports_util.normalizeParams(params)
|
|
1424
|
+
});
|
|
1425
|
+
}
|
|
1426
|
+
function looseRecord(keyType, valueType, params) {
|
|
1427
|
+
return new ZodRecord({
|
|
1428
|
+
type: "record",
|
|
1429
|
+
keyType,
|
|
1430
|
+
valueType,
|
|
1431
|
+
mode: "loose",
|
|
1432
|
+
...exports_util.normalizeParams(params)
|
|
1433
|
+
});
|
|
1434
|
+
}
|
|
1435
|
+
var ZodMap = /* @__PURE__ */ $constructor("ZodMap", (inst, def) => {
|
|
1436
|
+
$ZodMap.init(inst, def);
|
|
1437
|
+
ZodType.init(inst, def);
|
|
1438
|
+
inst._zod.processJSONSchema = (ctx, json, params) => mapProcessor(inst, ctx, json, params);
|
|
1439
|
+
inst.keyType = def.keyType;
|
|
1440
|
+
inst.valueType = def.valueType;
|
|
1441
|
+
inst.min = (...args) => inst.check(_minSize(...args));
|
|
1442
|
+
inst.nonempty = (params) => inst.check(_minSize(1, params));
|
|
1443
|
+
inst.max = (...args) => inst.check(_maxSize(...args));
|
|
1444
|
+
inst.size = (...args) => inst.check(_size(...args));
|
|
1445
|
+
});
|
|
1446
|
+
function map(keyType, valueType, params) {
|
|
1447
|
+
return new ZodMap({
|
|
1448
|
+
type: "map",
|
|
1449
|
+
keyType,
|
|
1450
|
+
valueType,
|
|
1451
|
+
...exports_util.normalizeParams(params)
|
|
1452
|
+
});
|
|
1453
|
+
}
|
|
1454
|
+
var ZodSet = /* @__PURE__ */ $constructor("ZodSet", (inst, def) => {
|
|
1455
|
+
$ZodSet.init(inst, def);
|
|
1456
|
+
ZodType.init(inst, def);
|
|
1457
|
+
inst._zod.processJSONSchema = (ctx, json, params) => setProcessor(inst, ctx, json, params);
|
|
1458
|
+
inst.min = (...args) => inst.check(_minSize(...args));
|
|
1459
|
+
inst.nonempty = (params) => inst.check(_minSize(1, params));
|
|
1460
|
+
inst.max = (...args) => inst.check(_maxSize(...args));
|
|
1461
|
+
inst.size = (...args) => inst.check(_size(...args));
|
|
1462
|
+
});
|
|
1463
|
+
function set(valueType, params) {
|
|
1464
|
+
return new ZodSet({
|
|
1465
|
+
type: "set",
|
|
1466
|
+
valueType,
|
|
1467
|
+
...exports_util.normalizeParams(params)
|
|
1468
|
+
});
|
|
1469
|
+
}
|
|
1470
|
+
var ZodEnum = /* @__PURE__ */ $constructor("ZodEnum", (inst, def) => {
|
|
1471
|
+
$ZodEnum.init(inst, def);
|
|
1472
|
+
ZodType.init(inst, def);
|
|
1473
|
+
inst._zod.processJSONSchema = (ctx, json, params) => enumProcessor(inst, ctx, json, params);
|
|
1474
|
+
inst.enum = def.entries;
|
|
1475
|
+
inst.options = Object.values(def.entries);
|
|
1476
|
+
const keys = new Set(Object.keys(def.entries));
|
|
1477
|
+
inst.extract = (values, params) => {
|
|
1478
|
+
const newEntries = {};
|
|
1479
|
+
for (const value of values) {
|
|
1480
|
+
if (keys.has(value)) {
|
|
1481
|
+
newEntries[value] = def.entries[value];
|
|
1482
|
+
} else
|
|
1483
|
+
throw new Error(`Key ${value} not found in enum`);
|
|
1484
|
+
}
|
|
1485
|
+
return new ZodEnum({
|
|
1486
|
+
...def,
|
|
1487
|
+
checks: [],
|
|
1488
|
+
...exports_util.normalizeParams(params),
|
|
1489
|
+
entries: newEntries
|
|
1490
|
+
});
|
|
1491
|
+
};
|
|
1492
|
+
inst.exclude = (values, params) => {
|
|
1493
|
+
const newEntries = { ...def.entries };
|
|
1494
|
+
for (const value of values) {
|
|
1495
|
+
if (keys.has(value)) {
|
|
1496
|
+
delete newEntries[value];
|
|
1497
|
+
} else
|
|
1498
|
+
throw new Error(`Key ${value} not found in enum`);
|
|
1499
|
+
}
|
|
1500
|
+
return new ZodEnum({
|
|
1501
|
+
...def,
|
|
1502
|
+
checks: [],
|
|
1503
|
+
...exports_util.normalizeParams(params),
|
|
1504
|
+
entries: newEntries
|
|
1505
|
+
});
|
|
1506
|
+
};
|
|
1507
|
+
});
|
|
1508
|
+
function _enum(values, params) {
|
|
1509
|
+
const entries = Array.isArray(values) ? Object.fromEntries(values.map((v) => [v, v])) : values;
|
|
1510
|
+
return new ZodEnum({
|
|
1511
|
+
type: "enum",
|
|
1512
|
+
entries,
|
|
1513
|
+
...exports_util.normalizeParams(params)
|
|
1514
|
+
});
|
|
1515
|
+
}
|
|
1516
|
+
function nativeEnum(entries, params) {
|
|
1517
|
+
return new ZodEnum({
|
|
1518
|
+
type: "enum",
|
|
1519
|
+
entries,
|
|
1520
|
+
...exports_util.normalizeParams(params)
|
|
1521
|
+
});
|
|
1522
|
+
}
|
|
1523
|
+
var ZodLiteral = /* @__PURE__ */ $constructor("ZodLiteral", (inst, def) => {
|
|
1524
|
+
$ZodLiteral.init(inst, def);
|
|
1525
|
+
ZodType.init(inst, def);
|
|
1526
|
+
inst._zod.processJSONSchema = (ctx, json, params) => literalProcessor(inst, ctx, json, params);
|
|
1527
|
+
inst.values = new Set(def.values);
|
|
1528
|
+
Object.defineProperty(inst, "value", {
|
|
1529
|
+
get() {
|
|
1530
|
+
if (def.values.length > 1) {
|
|
1531
|
+
throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");
|
|
1532
|
+
}
|
|
1533
|
+
return def.values[0];
|
|
1534
|
+
}
|
|
1535
|
+
});
|
|
1536
|
+
});
|
|
1537
|
+
function literal(value, params) {
|
|
1538
|
+
return new ZodLiteral({
|
|
1539
|
+
type: "literal",
|
|
1540
|
+
values: Array.isArray(value) ? value : [value],
|
|
1541
|
+
...exports_util.normalizeParams(params)
|
|
1542
|
+
});
|
|
1543
|
+
}
|
|
1544
|
+
var ZodFile = /* @__PURE__ */ $constructor("ZodFile", (inst, def) => {
|
|
1545
|
+
$ZodFile.init(inst, def);
|
|
1546
|
+
ZodType.init(inst, def);
|
|
1547
|
+
inst._zod.processJSONSchema = (ctx, json, params) => fileProcessor(inst, ctx, json, params);
|
|
1548
|
+
inst.min = (size, params) => inst.check(_minSize(size, params));
|
|
1549
|
+
inst.max = (size, params) => inst.check(_maxSize(size, params));
|
|
1550
|
+
inst.mime = (types, params) => inst.check(_mime(Array.isArray(types) ? types : [types], params));
|
|
1551
|
+
});
|
|
1552
|
+
function file(params) {
|
|
1553
|
+
return _file(ZodFile, params);
|
|
1554
|
+
}
|
|
1555
|
+
var ZodTransform = /* @__PURE__ */ $constructor("ZodTransform", (inst, def) => {
|
|
1556
|
+
$ZodTransform.init(inst, def);
|
|
1557
|
+
ZodType.init(inst, def);
|
|
1558
|
+
inst._zod.processJSONSchema = (ctx, json, params) => transformProcessor(inst, ctx, json, params);
|
|
1559
|
+
inst._zod.parse = (payload, _ctx) => {
|
|
1560
|
+
if (_ctx.direction === "backward") {
|
|
1561
|
+
throw new $ZodEncodeError(inst.constructor.name);
|
|
1562
|
+
}
|
|
1563
|
+
payload.addIssue = (issue) => {
|
|
1564
|
+
if (typeof issue === "string") {
|
|
1565
|
+
payload.issues.push(exports_util.issue(issue, payload.value, def));
|
|
1566
|
+
} else {
|
|
1567
|
+
const _issue = issue;
|
|
1568
|
+
if (_issue.fatal)
|
|
1569
|
+
_issue.continue = false;
|
|
1570
|
+
_issue.code ?? (_issue.code = "custom");
|
|
1571
|
+
_issue.input ?? (_issue.input = payload.value);
|
|
1572
|
+
_issue.inst ?? (_issue.inst = inst);
|
|
1573
|
+
payload.issues.push(exports_util.issue(_issue));
|
|
1574
|
+
}
|
|
1575
|
+
};
|
|
1576
|
+
const output = def.transform(payload.value, payload);
|
|
1577
|
+
if (output instanceof Promise) {
|
|
1578
|
+
return output.then((output2) => {
|
|
1579
|
+
payload.value = output2;
|
|
1580
|
+
return payload;
|
|
1581
|
+
});
|
|
1582
|
+
}
|
|
1583
|
+
payload.value = output;
|
|
1584
|
+
return payload;
|
|
1585
|
+
};
|
|
1586
|
+
});
|
|
1587
|
+
function transform(fn) {
|
|
1588
|
+
return new ZodTransform({
|
|
1589
|
+
type: "transform",
|
|
1590
|
+
transform: fn
|
|
1591
|
+
});
|
|
1592
|
+
}
|
|
1593
|
+
var ZodOptional = /* @__PURE__ */ $constructor("ZodOptional", (inst, def) => {
|
|
1594
|
+
$ZodOptional.init(inst, def);
|
|
1595
|
+
ZodType.init(inst, def);
|
|
1596
|
+
inst._zod.processJSONSchema = (ctx, json, params) => optionalProcessor(inst, ctx, json, params);
|
|
1597
|
+
inst.unwrap = () => inst._zod.def.innerType;
|
|
1598
|
+
});
|
|
1599
|
+
function optional(innerType) {
|
|
1600
|
+
return new ZodOptional({
|
|
1601
|
+
type: "optional",
|
|
1602
|
+
innerType
|
|
1603
|
+
});
|
|
1604
|
+
}
|
|
1605
|
+
var ZodExactOptional = /* @__PURE__ */ $constructor("ZodExactOptional", (inst, def) => {
|
|
1606
|
+
$ZodExactOptional.init(inst, def);
|
|
1607
|
+
ZodType.init(inst, def);
|
|
1608
|
+
inst._zod.processJSONSchema = (ctx, json, params) => optionalProcessor(inst, ctx, json, params);
|
|
1609
|
+
inst.unwrap = () => inst._zod.def.innerType;
|
|
1610
|
+
});
|
|
1611
|
+
function exactOptional(innerType) {
|
|
1612
|
+
return new ZodExactOptional({
|
|
1613
|
+
type: "optional",
|
|
1614
|
+
innerType
|
|
1615
|
+
});
|
|
1616
|
+
}
|
|
1617
|
+
var ZodNullable = /* @__PURE__ */ $constructor("ZodNullable", (inst, def) => {
|
|
1618
|
+
$ZodNullable.init(inst, def);
|
|
1619
|
+
ZodType.init(inst, def);
|
|
1620
|
+
inst._zod.processJSONSchema = (ctx, json, params) => nullableProcessor(inst, ctx, json, params);
|
|
1621
|
+
inst.unwrap = () => inst._zod.def.innerType;
|
|
1622
|
+
});
|
|
1623
|
+
function nullable(innerType) {
|
|
1624
|
+
return new ZodNullable({
|
|
1625
|
+
type: "nullable",
|
|
1626
|
+
innerType
|
|
1627
|
+
});
|
|
1628
|
+
}
|
|
1629
|
+
function nullish(innerType) {
|
|
1630
|
+
return optional(nullable(innerType));
|
|
1631
|
+
}
|
|
1632
|
+
var ZodDefault = /* @__PURE__ */ $constructor("ZodDefault", (inst, def) => {
|
|
1633
|
+
$ZodDefault.init(inst, def);
|
|
1634
|
+
ZodType.init(inst, def);
|
|
1635
|
+
inst._zod.processJSONSchema = (ctx, json, params) => defaultProcessor(inst, ctx, json, params);
|
|
1636
|
+
inst.unwrap = () => inst._zod.def.innerType;
|
|
1637
|
+
inst.removeDefault = inst.unwrap;
|
|
1638
|
+
});
|
|
1639
|
+
function _default(innerType, defaultValue) {
|
|
1640
|
+
return new ZodDefault({
|
|
1641
|
+
type: "default",
|
|
1642
|
+
innerType,
|
|
1643
|
+
get defaultValue() {
|
|
1644
|
+
return typeof defaultValue === "function" ? defaultValue() : exports_util.shallowClone(defaultValue);
|
|
1645
|
+
}
|
|
1646
|
+
});
|
|
1647
|
+
}
|
|
1648
|
+
var ZodPrefault = /* @__PURE__ */ $constructor("ZodPrefault", (inst, def) => {
|
|
1649
|
+
$ZodPrefault.init(inst, def);
|
|
1650
|
+
ZodType.init(inst, def);
|
|
1651
|
+
inst._zod.processJSONSchema = (ctx, json, params) => prefaultProcessor(inst, ctx, json, params);
|
|
1652
|
+
inst.unwrap = () => inst._zod.def.innerType;
|
|
1653
|
+
});
|
|
1654
|
+
function prefault(innerType, defaultValue) {
|
|
1655
|
+
return new ZodPrefault({
|
|
1656
|
+
type: "prefault",
|
|
1657
|
+
innerType,
|
|
1658
|
+
get defaultValue() {
|
|
1659
|
+
return typeof defaultValue === "function" ? defaultValue() : exports_util.shallowClone(defaultValue);
|
|
1660
|
+
}
|
|
1661
|
+
});
|
|
1662
|
+
}
|
|
1663
|
+
var ZodNonOptional = /* @__PURE__ */ $constructor("ZodNonOptional", (inst, def) => {
|
|
1664
|
+
$ZodNonOptional.init(inst, def);
|
|
1665
|
+
ZodType.init(inst, def);
|
|
1666
|
+
inst._zod.processJSONSchema = (ctx, json, params) => nonoptionalProcessor(inst, ctx, json, params);
|
|
1667
|
+
inst.unwrap = () => inst._zod.def.innerType;
|
|
1668
|
+
});
|
|
1669
|
+
function nonoptional(innerType, params) {
|
|
1670
|
+
return new ZodNonOptional({
|
|
1671
|
+
type: "nonoptional",
|
|
1672
|
+
innerType,
|
|
1673
|
+
...exports_util.normalizeParams(params)
|
|
1674
|
+
});
|
|
1675
|
+
}
|
|
1676
|
+
var ZodSuccess = /* @__PURE__ */ $constructor("ZodSuccess", (inst, def) => {
|
|
1677
|
+
$ZodSuccess.init(inst, def);
|
|
1678
|
+
ZodType.init(inst, def);
|
|
1679
|
+
inst._zod.processJSONSchema = (ctx, json, params) => successProcessor(inst, ctx, json, params);
|
|
1680
|
+
inst.unwrap = () => inst._zod.def.innerType;
|
|
1681
|
+
});
|
|
1682
|
+
function success(innerType) {
|
|
1683
|
+
return new ZodSuccess({
|
|
1684
|
+
type: "success",
|
|
1685
|
+
innerType
|
|
1686
|
+
});
|
|
1687
|
+
}
|
|
1688
|
+
var ZodCatch = /* @__PURE__ */ $constructor("ZodCatch", (inst, def) => {
|
|
1689
|
+
$ZodCatch.init(inst, def);
|
|
1690
|
+
ZodType.init(inst, def);
|
|
1691
|
+
inst._zod.processJSONSchema = (ctx, json, params) => catchProcessor(inst, ctx, json, params);
|
|
1692
|
+
inst.unwrap = () => inst._zod.def.innerType;
|
|
1693
|
+
inst.removeCatch = inst.unwrap;
|
|
1694
|
+
});
|
|
1695
|
+
function _catch(innerType, catchValue) {
|
|
1696
|
+
return new ZodCatch({
|
|
1697
|
+
type: "catch",
|
|
1698
|
+
innerType,
|
|
1699
|
+
catchValue: typeof catchValue === "function" ? catchValue : () => catchValue
|
|
1700
|
+
});
|
|
1701
|
+
}
|
|
1702
|
+
var ZodNaN = /* @__PURE__ */ $constructor("ZodNaN", (inst, def) => {
|
|
1703
|
+
$ZodNaN.init(inst, def);
|
|
1704
|
+
ZodType.init(inst, def);
|
|
1705
|
+
inst._zod.processJSONSchema = (ctx, json, params) => nanProcessor(inst, ctx, json, params);
|
|
1706
|
+
});
|
|
1707
|
+
function nan(params) {
|
|
1708
|
+
return _nan(ZodNaN, params);
|
|
1709
|
+
}
|
|
1710
|
+
var ZodPipe = /* @__PURE__ */ $constructor("ZodPipe", (inst, def) => {
|
|
1711
|
+
$ZodPipe.init(inst, def);
|
|
1712
|
+
ZodType.init(inst, def);
|
|
1713
|
+
inst._zod.processJSONSchema = (ctx, json, params) => pipeProcessor(inst, ctx, json, params);
|
|
1714
|
+
inst.in = def.in;
|
|
1715
|
+
inst.out = def.out;
|
|
1716
|
+
});
|
|
1717
|
+
function pipe(in_, out) {
|
|
1718
|
+
return new ZodPipe({
|
|
1719
|
+
type: "pipe",
|
|
1720
|
+
in: in_,
|
|
1721
|
+
out
|
|
1722
|
+
});
|
|
1723
|
+
}
|
|
1724
|
+
var ZodCodec = /* @__PURE__ */ $constructor("ZodCodec", (inst, def) => {
|
|
1725
|
+
ZodPipe.init(inst, def);
|
|
1726
|
+
$ZodCodec.init(inst, def);
|
|
1727
|
+
});
|
|
1728
|
+
function codec(in_, out, params) {
|
|
1729
|
+
return new ZodCodec({
|
|
1730
|
+
type: "pipe",
|
|
1731
|
+
in: in_,
|
|
1732
|
+
out,
|
|
1733
|
+
transform: params.decode,
|
|
1734
|
+
reverseTransform: params.encode
|
|
1735
|
+
});
|
|
1736
|
+
}
|
|
1737
|
+
var ZodReadonly = /* @__PURE__ */ $constructor("ZodReadonly", (inst, def) => {
|
|
1738
|
+
$ZodReadonly.init(inst, def);
|
|
1739
|
+
ZodType.init(inst, def);
|
|
1740
|
+
inst._zod.processJSONSchema = (ctx, json, params) => readonlyProcessor(inst, ctx, json, params);
|
|
1741
|
+
inst.unwrap = () => inst._zod.def.innerType;
|
|
1742
|
+
});
|
|
1743
|
+
function readonly(innerType) {
|
|
1744
|
+
return new ZodReadonly({
|
|
1745
|
+
type: "readonly",
|
|
1746
|
+
innerType
|
|
1747
|
+
});
|
|
1748
|
+
}
|
|
1749
|
+
var ZodTemplateLiteral = /* @__PURE__ */ $constructor("ZodTemplateLiteral", (inst, def) => {
|
|
1750
|
+
$ZodTemplateLiteral.init(inst, def);
|
|
1751
|
+
ZodType.init(inst, def);
|
|
1752
|
+
inst._zod.processJSONSchema = (ctx, json, params) => templateLiteralProcessor(inst, ctx, json, params);
|
|
1753
|
+
});
|
|
1754
|
+
function templateLiteral(parts, params) {
|
|
1755
|
+
return new ZodTemplateLiteral({
|
|
1756
|
+
type: "template_literal",
|
|
1757
|
+
parts,
|
|
1758
|
+
...exports_util.normalizeParams(params)
|
|
1759
|
+
});
|
|
1760
|
+
}
|
|
1761
|
+
var ZodLazy = /* @__PURE__ */ $constructor("ZodLazy", (inst, def) => {
|
|
1762
|
+
$ZodLazy.init(inst, def);
|
|
1763
|
+
ZodType.init(inst, def);
|
|
1764
|
+
inst._zod.processJSONSchema = (ctx, json, params) => lazyProcessor(inst, ctx, json, params);
|
|
1765
|
+
inst.unwrap = () => inst._zod.def.getter();
|
|
1766
|
+
});
|
|
1767
|
+
function lazy(getter) {
|
|
1768
|
+
return new ZodLazy({
|
|
1769
|
+
type: "lazy",
|
|
1770
|
+
getter
|
|
1771
|
+
});
|
|
1772
|
+
}
|
|
1773
|
+
var ZodPromise = /* @__PURE__ */ $constructor("ZodPromise", (inst, def) => {
|
|
1774
|
+
$ZodPromise.init(inst, def);
|
|
1775
|
+
ZodType.init(inst, def);
|
|
1776
|
+
inst._zod.processJSONSchema = (ctx, json, params) => promiseProcessor(inst, ctx, json, params);
|
|
1777
|
+
inst.unwrap = () => inst._zod.def.innerType;
|
|
1778
|
+
});
|
|
1779
|
+
function promise(innerType) {
|
|
1780
|
+
return new ZodPromise({
|
|
1781
|
+
type: "promise",
|
|
1782
|
+
innerType
|
|
1783
|
+
});
|
|
1784
|
+
}
|
|
1785
|
+
var ZodFunction = /* @__PURE__ */ $constructor("ZodFunction", (inst, def) => {
|
|
1786
|
+
$ZodFunction.init(inst, def);
|
|
1787
|
+
ZodType.init(inst, def);
|
|
1788
|
+
inst._zod.processJSONSchema = (ctx, json, params) => functionProcessor(inst, ctx, json, params);
|
|
1789
|
+
});
|
|
1790
|
+
function _function(params) {
|
|
1791
|
+
return new ZodFunction({
|
|
1792
|
+
type: "function",
|
|
1793
|
+
input: Array.isArray(params?.input) ? tuple(params?.input) : params?.input ?? array(unknown()),
|
|
1794
|
+
output: params?.output ?? unknown()
|
|
1795
|
+
});
|
|
1796
|
+
}
|
|
1797
|
+
var ZodCustom = /* @__PURE__ */ $constructor("ZodCustom", (inst, def) => {
|
|
1798
|
+
$ZodCustom.init(inst, def);
|
|
1799
|
+
ZodType.init(inst, def);
|
|
1800
|
+
inst._zod.processJSONSchema = (ctx, json, params) => customProcessor(inst, ctx, json, params);
|
|
1801
|
+
});
|
|
1802
|
+
function check(fn) {
|
|
1803
|
+
const ch = new $ZodCheck({
|
|
1804
|
+
check: "custom"
|
|
1805
|
+
});
|
|
1806
|
+
ch._zod.check = fn;
|
|
1807
|
+
return ch;
|
|
1808
|
+
}
|
|
1809
|
+
function custom(fn, _params) {
|
|
1810
|
+
return _custom(ZodCustom, fn ?? (() => true), _params);
|
|
1811
|
+
}
|
|
1812
|
+
function refine(fn, _params = {}) {
|
|
1813
|
+
return _refine(ZodCustom, fn, _params);
|
|
1814
|
+
}
|
|
1815
|
+
function superRefine(fn) {
|
|
1816
|
+
return _superRefine(fn);
|
|
1817
|
+
}
|
|
1818
|
+
var describe2 = describe;
|
|
1819
|
+
var meta2 = meta;
|
|
1820
|
+
function _instanceof(cls, params = {}) {
|
|
1821
|
+
const inst = new ZodCustom({
|
|
1822
|
+
type: "custom",
|
|
1823
|
+
check: "custom",
|
|
1824
|
+
fn: (data) => data instanceof cls,
|
|
1825
|
+
abort: true,
|
|
1826
|
+
...exports_util.normalizeParams(params)
|
|
1827
|
+
});
|
|
1828
|
+
inst._zod.bag.Class = cls;
|
|
1829
|
+
inst._zod.check = (payload) => {
|
|
1830
|
+
if (!(payload.value instanceof cls)) {
|
|
1831
|
+
payload.issues.push({
|
|
1832
|
+
code: "invalid_type",
|
|
1833
|
+
expected: cls.name,
|
|
1834
|
+
input: payload.value,
|
|
1835
|
+
inst,
|
|
1836
|
+
path: [...inst._zod.def.path ?? []]
|
|
1837
|
+
});
|
|
1838
|
+
}
|
|
1839
|
+
};
|
|
1840
|
+
return inst;
|
|
1841
|
+
}
|
|
1842
|
+
var stringbool = (...args) => _stringbool({
|
|
1843
|
+
Codec: ZodCodec,
|
|
1844
|
+
Boolean: ZodBoolean,
|
|
1845
|
+
String: ZodString
|
|
1846
|
+
}, ...args);
|
|
1847
|
+
function json(params) {
|
|
1848
|
+
const jsonSchema = lazy(() => {
|
|
1849
|
+
return union([string(params), number(), boolean(), _null2(), array(jsonSchema), record(string(), jsonSchema)]);
|
|
1850
|
+
});
|
|
1851
|
+
return jsonSchema;
|
|
1852
|
+
}
|
|
1853
|
+
function preprocess(fn, schema) {
|
|
1854
|
+
return pipe(transform(fn), schema);
|
|
1855
|
+
}
|
|
1856
|
+
// node_modules/zod/v4/classic/compat.js
|
|
1857
|
+
var ZodIssueCode = {
|
|
1858
|
+
invalid_type: "invalid_type",
|
|
1859
|
+
too_big: "too_big",
|
|
1860
|
+
too_small: "too_small",
|
|
1861
|
+
invalid_format: "invalid_format",
|
|
1862
|
+
not_multiple_of: "not_multiple_of",
|
|
1863
|
+
unrecognized_keys: "unrecognized_keys",
|
|
1864
|
+
invalid_union: "invalid_union",
|
|
1865
|
+
invalid_key: "invalid_key",
|
|
1866
|
+
invalid_element: "invalid_element",
|
|
1867
|
+
invalid_value: "invalid_value",
|
|
1868
|
+
custom: "custom"
|
|
1869
|
+
};
|
|
1870
|
+
function setErrorMap(map2) {
|
|
1871
|
+
config({
|
|
1872
|
+
customError: map2
|
|
1873
|
+
});
|
|
1874
|
+
}
|
|
1875
|
+
function getErrorMap() {
|
|
1876
|
+
return config().customError;
|
|
1877
|
+
}
|
|
1878
|
+
var ZodFirstPartyTypeKind;
|
|
1879
|
+
(function(ZodFirstPartyTypeKind2) {})(ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {}));
|
|
1880
|
+
// node_modules/zod/v4/classic/from-json-schema.js
|
|
1881
|
+
var z = {
|
|
1882
|
+
...exports_schemas,
|
|
1883
|
+
...exports_checks,
|
|
1884
|
+
iso: exports_iso
|
|
1885
|
+
};
|
|
1886
|
+
var RECOGNIZED_KEYS = new Set([
|
|
1887
|
+
"$schema",
|
|
1888
|
+
"$ref",
|
|
1889
|
+
"$defs",
|
|
1890
|
+
"definitions",
|
|
1891
|
+
"$id",
|
|
1892
|
+
"id",
|
|
1893
|
+
"$comment",
|
|
1894
|
+
"$anchor",
|
|
1895
|
+
"$vocabulary",
|
|
1896
|
+
"$dynamicRef",
|
|
1897
|
+
"$dynamicAnchor",
|
|
1898
|
+
"type",
|
|
1899
|
+
"enum",
|
|
1900
|
+
"const",
|
|
1901
|
+
"anyOf",
|
|
1902
|
+
"oneOf",
|
|
1903
|
+
"allOf",
|
|
1904
|
+
"not",
|
|
1905
|
+
"properties",
|
|
1906
|
+
"required",
|
|
1907
|
+
"additionalProperties",
|
|
1908
|
+
"patternProperties",
|
|
1909
|
+
"propertyNames",
|
|
1910
|
+
"minProperties",
|
|
1911
|
+
"maxProperties",
|
|
1912
|
+
"items",
|
|
1913
|
+
"prefixItems",
|
|
1914
|
+
"additionalItems",
|
|
1915
|
+
"minItems",
|
|
1916
|
+
"maxItems",
|
|
1917
|
+
"uniqueItems",
|
|
1918
|
+
"contains",
|
|
1919
|
+
"minContains",
|
|
1920
|
+
"maxContains",
|
|
1921
|
+
"minLength",
|
|
1922
|
+
"maxLength",
|
|
1923
|
+
"pattern",
|
|
1924
|
+
"format",
|
|
1925
|
+
"minimum",
|
|
1926
|
+
"maximum",
|
|
1927
|
+
"exclusiveMinimum",
|
|
1928
|
+
"exclusiveMaximum",
|
|
1929
|
+
"multipleOf",
|
|
1930
|
+
"description",
|
|
1931
|
+
"default",
|
|
1932
|
+
"contentEncoding",
|
|
1933
|
+
"contentMediaType",
|
|
1934
|
+
"contentSchema",
|
|
1935
|
+
"unevaluatedItems",
|
|
1936
|
+
"unevaluatedProperties",
|
|
1937
|
+
"if",
|
|
1938
|
+
"then",
|
|
1939
|
+
"else",
|
|
1940
|
+
"dependentSchemas",
|
|
1941
|
+
"dependentRequired",
|
|
1942
|
+
"nullable",
|
|
1943
|
+
"readOnly"
|
|
1944
|
+
]);
|
|
1945
|
+
function detectVersion(schema, defaultTarget) {
|
|
1946
|
+
const $schema = schema.$schema;
|
|
1947
|
+
if ($schema === "https://json-schema.org/draft/2020-12/schema") {
|
|
1948
|
+
return "draft-2020-12";
|
|
1949
|
+
}
|
|
1950
|
+
if ($schema === "http://json-schema.org/draft-07/schema#") {
|
|
1951
|
+
return "draft-7";
|
|
1952
|
+
}
|
|
1953
|
+
if ($schema === "http://json-schema.org/draft-04/schema#") {
|
|
1954
|
+
return "draft-4";
|
|
1955
|
+
}
|
|
1956
|
+
return defaultTarget ?? "draft-2020-12";
|
|
1957
|
+
}
|
|
1958
|
+
function resolveRef(ref, ctx) {
|
|
1959
|
+
if (!ref.startsWith("#")) {
|
|
1960
|
+
throw new Error("External $ref is not supported, only local refs (#/...) are allowed");
|
|
1961
|
+
}
|
|
1962
|
+
const path = ref.slice(1).split("/").filter(Boolean);
|
|
1963
|
+
if (path.length === 0) {
|
|
1964
|
+
return ctx.rootSchema;
|
|
1965
|
+
}
|
|
1966
|
+
const defsKey = ctx.version === "draft-2020-12" ? "$defs" : "definitions";
|
|
1967
|
+
if (path[0] === defsKey) {
|
|
1968
|
+
const key = path[1];
|
|
1969
|
+
if (!key || !ctx.defs[key]) {
|
|
1970
|
+
throw new Error(`Reference not found: ${ref}`);
|
|
1971
|
+
}
|
|
1972
|
+
return ctx.defs[key];
|
|
1973
|
+
}
|
|
1974
|
+
throw new Error(`Reference not found: ${ref}`);
|
|
1975
|
+
}
|
|
1976
|
+
function convertBaseSchema(schema, ctx) {
|
|
1977
|
+
if (schema.not !== undefined) {
|
|
1978
|
+
if (typeof schema.not === "object" && Object.keys(schema.not).length === 0) {
|
|
1979
|
+
return z.never();
|
|
1980
|
+
}
|
|
1981
|
+
throw new Error("not is not supported in Zod (except { not: {} } for never)");
|
|
1982
|
+
}
|
|
1983
|
+
if (schema.unevaluatedItems !== undefined) {
|
|
1984
|
+
throw new Error("unevaluatedItems is not supported");
|
|
1985
|
+
}
|
|
1986
|
+
if (schema.unevaluatedProperties !== undefined) {
|
|
1987
|
+
throw new Error("unevaluatedProperties is not supported");
|
|
1988
|
+
}
|
|
1989
|
+
if (schema.if !== undefined || schema.then !== undefined || schema.else !== undefined) {
|
|
1990
|
+
throw new Error("Conditional schemas (if/then/else) are not supported");
|
|
1991
|
+
}
|
|
1992
|
+
if (schema.dependentSchemas !== undefined || schema.dependentRequired !== undefined) {
|
|
1993
|
+
throw new Error("dependentSchemas and dependentRequired are not supported");
|
|
1994
|
+
}
|
|
1995
|
+
if (schema.$ref) {
|
|
1996
|
+
const refPath = schema.$ref;
|
|
1997
|
+
if (ctx.refs.has(refPath)) {
|
|
1998
|
+
return ctx.refs.get(refPath);
|
|
1999
|
+
}
|
|
2000
|
+
if (ctx.processing.has(refPath)) {
|
|
2001
|
+
return z.lazy(() => {
|
|
2002
|
+
if (!ctx.refs.has(refPath)) {
|
|
2003
|
+
throw new Error(`Circular reference not resolved: ${refPath}`);
|
|
2004
|
+
}
|
|
2005
|
+
return ctx.refs.get(refPath);
|
|
2006
|
+
});
|
|
2007
|
+
}
|
|
2008
|
+
ctx.processing.add(refPath);
|
|
2009
|
+
const resolved = resolveRef(refPath, ctx);
|
|
2010
|
+
const zodSchema2 = convertSchema(resolved, ctx);
|
|
2011
|
+
ctx.refs.set(refPath, zodSchema2);
|
|
2012
|
+
ctx.processing.delete(refPath);
|
|
2013
|
+
return zodSchema2;
|
|
2014
|
+
}
|
|
2015
|
+
if (schema.enum !== undefined) {
|
|
2016
|
+
const enumValues = schema.enum;
|
|
2017
|
+
if (ctx.version === "openapi-3.0" && schema.nullable === true && enumValues.length === 1 && enumValues[0] === null) {
|
|
2018
|
+
return z.null();
|
|
2019
|
+
}
|
|
2020
|
+
if (enumValues.length === 0) {
|
|
2021
|
+
return z.never();
|
|
2022
|
+
}
|
|
2023
|
+
if (enumValues.length === 1) {
|
|
2024
|
+
return z.literal(enumValues[0]);
|
|
2025
|
+
}
|
|
2026
|
+
if (enumValues.every((v) => typeof v === "string")) {
|
|
2027
|
+
return z.enum(enumValues);
|
|
2028
|
+
}
|
|
2029
|
+
const literalSchemas = enumValues.map((v) => z.literal(v));
|
|
2030
|
+
if (literalSchemas.length < 2) {
|
|
2031
|
+
return literalSchemas[0];
|
|
2032
|
+
}
|
|
2033
|
+
return z.union([literalSchemas[0], literalSchemas[1], ...literalSchemas.slice(2)]);
|
|
2034
|
+
}
|
|
2035
|
+
if (schema.const !== undefined) {
|
|
2036
|
+
return z.literal(schema.const);
|
|
2037
|
+
}
|
|
2038
|
+
const type = schema.type;
|
|
2039
|
+
if (Array.isArray(type)) {
|
|
2040
|
+
const typeSchemas = type.map((t) => {
|
|
2041
|
+
const typeSchema = { ...schema, type: t };
|
|
2042
|
+
return convertBaseSchema(typeSchema, ctx);
|
|
2043
|
+
});
|
|
2044
|
+
if (typeSchemas.length === 0) {
|
|
2045
|
+
return z.never();
|
|
2046
|
+
}
|
|
2047
|
+
if (typeSchemas.length === 1) {
|
|
2048
|
+
return typeSchemas[0];
|
|
2049
|
+
}
|
|
2050
|
+
return z.union(typeSchemas);
|
|
2051
|
+
}
|
|
2052
|
+
if (!type) {
|
|
2053
|
+
return z.any();
|
|
2054
|
+
}
|
|
2055
|
+
let zodSchema;
|
|
2056
|
+
switch (type) {
|
|
2057
|
+
case "string": {
|
|
2058
|
+
let stringSchema = z.string();
|
|
2059
|
+
if (schema.format) {
|
|
2060
|
+
const format = schema.format;
|
|
2061
|
+
if (format === "email") {
|
|
2062
|
+
stringSchema = stringSchema.check(z.email());
|
|
2063
|
+
} else if (format === "uri" || format === "uri-reference") {
|
|
2064
|
+
stringSchema = stringSchema.check(z.url());
|
|
2065
|
+
} else if (format === "uuid" || format === "guid") {
|
|
2066
|
+
stringSchema = stringSchema.check(z.uuid());
|
|
2067
|
+
} else if (format === "date-time") {
|
|
2068
|
+
stringSchema = stringSchema.check(z.iso.datetime());
|
|
2069
|
+
} else if (format === "date") {
|
|
2070
|
+
stringSchema = stringSchema.check(z.iso.date());
|
|
2071
|
+
} else if (format === "time") {
|
|
2072
|
+
stringSchema = stringSchema.check(z.iso.time());
|
|
2073
|
+
} else if (format === "duration") {
|
|
2074
|
+
stringSchema = stringSchema.check(z.iso.duration());
|
|
2075
|
+
} else if (format === "ipv4") {
|
|
2076
|
+
stringSchema = stringSchema.check(z.ipv4());
|
|
2077
|
+
} else if (format === "ipv6") {
|
|
2078
|
+
stringSchema = stringSchema.check(z.ipv6());
|
|
2079
|
+
} else if (format === "mac") {
|
|
2080
|
+
stringSchema = stringSchema.check(z.mac());
|
|
2081
|
+
} else if (format === "cidr") {
|
|
2082
|
+
stringSchema = stringSchema.check(z.cidrv4());
|
|
2083
|
+
} else if (format === "cidr-v6") {
|
|
2084
|
+
stringSchema = stringSchema.check(z.cidrv6());
|
|
2085
|
+
} else if (format === "base64") {
|
|
2086
|
+
stringSchema = stringSchema.check(z.base64());
|
|
2087
|
+
} else if (format === "base64url") {
|
|
2088
|
+
stringSchema = stringSchema.check(z.base64url());
|
|
2089
|
+
} else if (format === "e164") {
|
|
2090
|
+
stringSchema = stringSchema.check(z.e164());
|
|
2091
|
+
} else if (format === "jwt") {
|
|
2092
|
+
stringSchema = stringSchema.check(z.jwt());
|
|
2093
|
+
} else if (format === "emoji") {
|
|
2094
|
+
stringSchema = stringSchema.check(z.emoji());
|
|
2095
|
+
} else if (format === "nanoid") {
|
|
2096
|
+
stringSchema = stringSchema.check(z.nanoid());
|
|
2097
|
+
} else if (format === "cuid") {
|
|
2098
|
+
stringSchema = stringSchema.check(z.cuid());
|
|
2099
|
+
} else if (format === "cuid2") {
|
|
2100
|
+
stringSchema = stringSchema.check(z.cuid2());
|
|
2101
|
+
} else if (format === "ulid") {
|
|
2102
|
+
stringSchema = stringSchema.check(z.ulid());
|
|
2103
|
+
} else if (format === "xid") {
|
|
2104
|
+
stringSchema = stringSchema.check(z.xid());
|
|
2105
|
+
} else if (format === "ksuid") {
|
|
2106
|
+
stringSchema = stringSchema.check(z.ksuid());
|
|
2107
|
+
}
|
|
2108
|
+
}
|
|
2109
|
+
if (typeof schema.minLength === "number") {
|
|
2110
|
+
stringSchema = stringSchema.min(schema.minLength);
|
|
2111
|
+
}
|
|
2112
|
+
if (typeof schema.maxLength === "number") {
|
|
2113
|
+
stringSchema = stringSchema.max(schema.maxLength);
|
|
2114
|
+
}
|
|
2115
|
+
if (schema.pattern) {
|
|
2116
|
+
stringSchema = stringSchema.regex(new RegExp(schema.pattern));
|
|
2117
|
+
}
|
|
2118
|
+
zodSchema = stringSchema;
|
|
2119
|
+
break;
|
|
2120
|
+
}
|
|
2121
|
+
case "number":
|
|
2122
|
+
case "integer": {
|
|
2123
|
+
let numberSchema = type === "integer" ? z.number().int() : z.number();
|
|
2124
|
+
if (typeof schema.minimum === "number") {
|
|
2125
|
+
numberSchema = numberSchema.min(schema.minimum);
|
|
2126
|
+
}
|
|
2127
|
+
if (typeof schema.maximum === "number") {
|
|
2128
|
+
numberSchema = numberSchema.max(schema.maximum);
|
|
2129
|
+
}
|
|
2130
|
+
if (typeof schema.exclusiveMinimum === "number") {
|
|
2131
|
+
numberSchema = numberSchema.gt(schema.exclusiveMinimum);
|
|
2132
|
+
} else if (schema.exclusiveMinimum === true && typeof schema.minimum === "number") {
|
|
2133
|
+
numberSchema = numberSchema.gt(schema.minimum);
|
|
2134
|
+
}
|
|
2135
|
+
if (typeof schema.exclusiveMaximum === "number") {
|
|
2136
|
+
numberSchema = numberSchema.lt(schema.exclusiveMaximum);
|
|
2137
|
+
} else if (schema.exclusiveMaximum === true && typeof schema.maximum === "number") {
|
|
2138
|
+
numberSchema = numberSchema.lt(schema.maximum);
|
|
2139
|
+
}
|
|
2140
|
+
if (typeof schema.multipleOf === "number") {
|
|
2141
|
+
numberSchema = numberSchema.multipleOf(schema.multipleOf);
|
|
2142
|
+
}
|
|
2143
|
+
zodSchema = numberSchema;
|
|
2144
|
+
break;
|
|
2145
|
+
}
|
|
2146
|
+
case "boolean": {
|
|
2147
|
+
zodSchema = z.boolean();
|
|
2148
|
+
break;
|
|
2149
|
+
}
|
|
2150
|
+
case "null": {
|
|
2151
|
+
zodSchema = z.null();
|
|
2152
|
+
break;
|
|
2153
|
+
}
|
|
2154
|
+
case "object": {
|
|
2155
|
+
const shape = {};
|
|
2156
|
+
const properties = schema.properties || {};
|
|
2157
|
+
const requiredSet = new Set(schema.required || []);
|
|
2158
|
+
for (const [key, propSchema] of Object.entries(properties)) {
|
|
2159
|
+
const propZodSchema = convertSchema(propSchema, ctx);
|
|
2160
|
+
shape[key] = requiredSet.has(key) ? propZodSchema : propZodSchema.optional();
|
|
2161
|
+
}
|
|
2162
|
+
if (schema.propertyNames) {
|
|
2163
|
+
const keySchema = convertSchema(schema.propertyNames, ctx);
|
|
2164
|
+
const valueSchema = schema.additionalProperties && typeof schema.additionalProperties === "object" ? convertSchema(schema.additionalProperties, ctx) : z.any();
|
|
2165
|
+
if (Object.keys(shape).length === 0) {
|
|
2166
|
+
zodSchema = z.record(keySchema, valueSchema);
|
|
2167
|
+
break;
|
|
2168
|
+
}
|
|
2169
|
+
const objectSchema2 = z.object(shape).passthrough();
|
|
2170
|
+
const recordSchema = z.looseRecord(keySchema, valueSchema);
|
|
2171
|
+
zodSchema = z.intersection(objectSchema2, recordSchema);
|
|
2172
|
+
break;
|
|
2173
|
+
}
|
|
2174
|
+
if (schema.patternProperties) {
|
|
2175
|
+
const patternProps = schema.patternProperties;
|
|
2176
|
+
const patternKeys = Object.keys(patternProps);
|
|
2177
|
+
const looseRecords = [];
|
|
2178
|
+
for (const pattern of patternKeys) {
|
|
2179
|
+
const patternValue = convertSchema(patternProps[pattern], ctx);
|
|
2180
|
+
const keySchema = z.string().regex(new RegExp(pattern));
|
|
2181
|
+
looseRecords.push(z.looseRecord(keySchema, patternValue));
|
|
2182
|
+
}
|
|
2183
|
+
const schemasToIntersect = [];
|
|
2184
|
+
if (Object.keys(shape).length > 0) {
|
|
2185
|
+
schemasToIntersect.push(z.object(shape).passthrough());
|
|
2186
|
+
}
|
|
2187
|
+
schemasToIntersect.push(...looseRecords);
|
|
2188
|
+
if (schemasToIntersect.length === 0) {
|
|
2189
|
+
zodSchema = z.object({}).passthrough();
|
|
2190
|
+
} else if (schemasToIntersect.length === 1) {
|
|
2191
|
+
zodSchema = schemasToIntersect[0];
|
|
2192
|
+
} else {
|
|
2193
|
+
let result = z.intersection(schemasToIntersect[0], schemasToIntersect[1]);
|
|
2194
|
+
for (let i = 2;i < schemasToIntersect.length; i++) {
|
|
2195
|
+
result = z.intersection(result, schemasToIntersect[i]);
|
|
2196
|
+
}
|
|
2197
|
+
zodSchema = result;
|
|
2198
|
+
}
|
|
2199
|
+
break;
|
|
2200
|
+
}
|
|
2201
|
+
const objectSchema = z.object(shape);
|
|
2202
|
+
if (schema.additionalProperties === false) {
|
|
2203
|
+
zodSchema = objectSchema.strict();
|
|
2204
|
+
} else if (typeof schema.additionalProperties === "object") {
|
|
2205
|
+
zodSchema = objectSchema.catchall(convertSchema(schema.additionalProperties, ctx));
|
|
2206
|
+
} else {
|
|
2207
|
+
zodSchema = objectSchema.passthrough();
|
|
2208
|
+
}
|
|
2209
|
+
break;
|
|
2210
|
+
}
|
|
2211
|
+
case "array": {
|
|
2212
|
+
const prefixItems = schema.prefixItems;
|
|
2213
|
+
const items = schema.items;
|
|
2214
|
+
if (prefixItems && Array.isArray(prefixItems)) {
|
|
2215
|
+
const tupleItems = prefixItems.map((item) => convertSchema(item, ctx));
|
|
2216
|
+
const rest = items && typeof items === "object" && !Array.isArray(items) ? convertSchema(items, ctx) : undefined;
|
|
2217
|
+
if (rest) {
|
|
2218
|
+
zodSchema = z.tuple(tupleItems).rest(rest);
|
|
2219
|
+
} else {
|
|
2220
|
+
zodSchema = z.tuple(tupleItems);
|
|
2221
|
+
}
|
|
2222
|
+
if (typeof schema.minItems === "number") {
|
|
2223
|
+
zodSchema = zodSchema.check(z.minLength(schema.minItems));
|
|
2224
|
+
}
|
|
2225
|
+
if (typeof schema.maxItems === "number") {
|
|
2226
|
+
zodSchema = zodSchema.check(z.maxLength(schema.maxItems));
|
|
2227
|
+
}
|
|
2228
|
+
} else if (Array.isArray(items)) {
|
|
2229
|
+
const tupleItems = items.map((item) => convertSchema(item, ctx));
|
|
2230
|
+
const rest = schema.additionalItems && typeof schema.additionalItems === "object" ? convertSchema(schema.additionalItems, ctx) : undefined;
|
|
2231
|
+
if (rest) {
|
|
2232
|
+
zodSchema = z.tuple(tupleItems).rest(rest);
|
|
2233
|
+
} else {
|
|
2234
|
+
zodSchema = z.tuple(tupleItems);
|
|
2235
|
+
}
|
|
2236
|
+
if (typeof schema.minItems === "number") {
|
|
2237
|
+
zodSchema = zodSchema.check(z.minLength(schema.minItems));
|
|
2238
|
+
}
|
|
2239
|
+
if (typeof schema.maxItems === "number") {
|
|
2240
|
+
zodSchema = zodSchema.check(z.maxLength(schema.maxItems));
|
|
2241
|
+
}
|
|
2242
|
+
} else if (items !== undefined) {
|
|
2243
|
+
const element = convertSchema(items, ctx);
|
|
2244
|
+
let arraySchema = z.array(element);
|
|
2245
|
+
if (typeof schema.minItems === "number") {
|
|
2246
|
+
arraySchema = arraySchema.min(schema.minItems);
|
|
2247
|
+
}
|
|
2248
|
+
if (typeof schema.maxItems === "number") {
|
|
2249
|
+
arraySchema = arraySchema.max(schema.maxItems);
|
|
2250
|
+
}
|
|
2251
|
+
zodSchema = arraySchema;
|
|
2252
|
+
} else {
|
|
2253
|
+
zodSchema = z.array(z.any());
|
|
2254
|
+
}
|
|
2255
|
+
break;
|
|
2256
|
+
}
|
|
2257
|
+
default:
|
|
2258
|
+
throw new Error(`Unsupported type: ${type}`);
|
|
2259
|
+
}
|
|
2260
|
+
if (schema.description) {
|
|
2261
|
+
zodSchema = zodSchema.describe(schema.description);
|
|
2262
|
+
}
|
|
2263
|
+
if (schema.default !== undefined) {
|
|
2264
|
+
zodSchema = zodSchema.default(schema.default);
|
|
2265
|
+
}
|
|
2266
|
+
return zodSchema;
|
|
2267
|
+
}
|
|
2268
|
+
function convertSchema(schema, ctx) {
|
|
2269
|
+
if (typeof schema === "boolean") {
|
|
2270
|
+
return schema ? z.any() : z.never();
|
|
2271
|
+
}
|
|
2272
|
+
let baseSchema = convertBaseSchema(schema, ctx);
|
|
2273
|
+
const hasExplicitType = schema.type || schema.enum !== undefined || schema.const !== undefined;
|
|
2274
|
+
if (schema.anyOf && Array.isArray(schema.anyOf)) {
|
|
2275
|
+
const options = schema.anyOf.map((s) => convertSchema(s, ctx));
|
|
2276
|
+
const anyOfUnion = z.union(options);
|
|
2277
|
+
baseSchema = hasExplicitType ? z.intersection(baseSchema, anyOfUnion) : anyOfUnion;
|
|
2278
|
+
}
|
|
2279
|
+
if (schema.oneOf && Array.isArray(schema.oneOf)) {
|
|
2280
|
+
const options = schema.oneOf.map((s) => convertSchema(s, ctx));
|
|
2281
|
+
const oneOfUnion = z.xor(options);
|
|
2282
|
+
baseSchema = hasExplicitType ? z.intersection(baseSchema, oneOfUnion) : oneOfUnion;
|
|
2283
|
+
}
|
|
2284
|
+
if (schema.allOf && Array.isArray(schema.allOf)) {
|
|
2285
|
+
if (schema.allOf.length === 0) {
|
|
2286
|
+
baseSchema = hasExplicitType ? baseSchema : z.any();
|
|
2287
|
+
} else {
|
|
2288
|
+
let result = hasExplicitType ? baseSchema : convertSchema(schema.allOf[0], ctx);
|
|
2289
|
+
const startIdx = hasExplicitType ? 0 : 1;
|
|
2290
|
+
for (let i = startIdx;i < schema.allOf.length; i++) {
|
|
2291
|
+
result = z.intersection(result, convertSchema(schema.allOf[i], ctx));
|
|
2292
|
+
}
|
|
2293
|
+
baseSchema = result;
|
|
2294
|
+
}
|
|
2295
|
+
}
|
|
2296
|
+
if (schema.nullable === true && ctx.version === "openapi-3.0") {
|
|
2297
|
+
baseSchema = z.nullable(baseSchema);
|
|
2298
|
+
}
|
|
2299
|
+
if (schema.readOnly === true) {
|
|
2300
|
+
baseSchema = z.readonly(baseSchema);
|
|
2301
|
+
}
|
|
2302
|
+
const extraMeta = {};
|
|
2303
|
+
const coreMetadataKeys = ["$id", "id", "$comment", "$anchor", "$vocabulary", "$dynamicRef", "$dynamicAnchor"];
|
|
2304
|
+
for (const key of coreMetadataKeys) {
|
|
2305
|
+
if (key in schema) {
|
|
2306
|
+
extraMeta[key] = schema[key];
|
|
2307
|
+
}
|
|
2308
|
+
}
|
|
2309
|
+
const contentMetadataKeys = ["contentEncoding", "contentMediaType", "contentSchema"];
|
|
2310
|
+
for (const key of contentMetadataKeys) {
|
|
2311
|
+
if (key in schema) {
|
|
2312
|
+
extraMeta[key] = schema[key];
|
|
2313
|
+
}
|
|
2314
|
+
}
|
|
2315
|
+
for (const key of Object.keys(schema)) {
|
|
2316
|
+
if (!RECOGNIZED_KEYS.has(key)) {
|
|
2317
|
+
extraMeta[key] = schema[key];
|
|
2318
|
+
}
|
|
2319
|
+
}
|
|
2320
|
+
if (Object.keys(extraMeta).length > 0) {
|
|
2321
|
+
ctx.registry.add(baseSchema, extraMeta);
|
|
2322
|
+
}
|
|
2323
|
+
return baseSchema;
|
|
2324
|
+
}
|
|
2325
|
+
function fromJSONSchema(schema, params) {
|
|
2326
|
+
if (typeof schema === "boolean") {
|
|
2327
|
+
return schema ? z.any() : z.never();
|
|
2328
|
+
}
|
|
2329
|
+
const version = detectVersion(schema, params?.defaultTarget);
|
|
2330
|
+
const defs = schema.$defs || schema.definitions || {};
|
|
2331
|
+
const ctx = {
|
|
2332
|
+
version,
|
|
2333
|
+
defs,
|
|
2334
|
+
refs: new Map,
|
|
2335
|
+
processing: new Set,
|
|
2336
|
+
rootSchema: schema,
|
|
2337
|
+
registry: params?.registry ?? globalRegistry
|
|
2338
|
+
};
|
|
2339
|
+
return convertSchema(schema, ctx);
|
|
2340
|
+
}
|
|
2341
|
+
// node_modules/zod/v4/classic/coerce.js
|
|
2342
|
+
var exports_coerce = {};
|
|
2343
|
+
__export(exports_coerce, {
|
|
2344
|
+
string: () => string2,
|
|
2345
|
+
number: () => number2,
|
|
2346
|
+
date: () => date3,
|
|
2347
|
+
boolean: () => boolean2,
|
|
2348
|
+
bigint: () => bigint2
|
|
2349
|
+
});
|
|
2350
|
+
function string2(params) {
|
|
2351
|
+
return _coercedString(ZodString, params);
|
|
2352
|
+
}
|
|
2353
|
+
function number2(params) {
|
|
2354
|
+
return _coercedNumber(ZodNumber, params);
|
|
2355
|
+
}
|
|
2356
|
+
function boolean2(params) {
|
|
2357
|
+
return _coercedBoolean(ZodBoolean, params);
|
|
2358
|
+
}
|
|
2359
|
+
function bigint2(params) {
|
|
2360
|
+
return _coercedBigint(ZodBigInt, params);
|
|
2361
|
+
}
|
|
2362
|
+
function date3(params) {
|
|
2363
|
+
return _coercedDate(ZodDate, params);
|
|
2364
|
+
}
|
|
2365
|
+
|
|
2366
|
+
// node_modules/zod/v4/classic/external.js
|
|
2367
|
+
config(en_default());
|
|
1
2368
|
// src/server/index.ts
|
|
2
2369
|
var isDevelopmentEnv = typeof globalThis !== "undefined" && "process" in globalThis && globalThis.process?.env?.NODE_ENV === "development";
|
|
3
2370
|
function createSaveAction(schema, options) {
|
|
@@ -109,9 +2476,226 @@ function parseFormData(schema, formData) {
|
|
|
109
2476
|
const result = schema.safeParse(rawData);
|
|
110
2477
|
return result.success ? result.data : null;
|
|
111
2478
|
}
|
|
2479
|
+
function createLanguageRoutes(deps, NextResponse) {
|
|
2480
|
+
const jsonResponse = NextResponse ?? {
|
|
2481
|
+
json: (data, init) => {
|
|
2482
|
+
return new Response(JSON.stringify(data), {
|
|
2483
|
+
status: init?.status ?? 200,
|
|
2484
|
+
headers: { "Content-Type": "application/json" }
|
|
2485
|
+
});
|
|
2486
|
+
}
|
|
2487
|
+
};
|
|
2488
|
+
const GET = async () => {
|
|
2489
|
+
try {
|
|
2490
|
+
const userId = await deps.getUserId();
|
|
2491
|
+
if (!userId) {
|
|
2492
|
+
return jsonResponse.json({ error: "Unauthorized" }, { status: 401 });
|
|
2493
|
+
}
|
|
2494
|
+
const settings = await deps.getUserSettings(userId);
|
|
2495
|
+
const language = settings?.language ?? null;
|
|
2496
|
+
return jsonResponse.json({ language });
|
|
2497
|
+
} catch (error) {
|
|
2498
|
+
console.error("[litecms] Language GET error:", error);
|
|
2499
|
+
return jsonResponse.json({ error: "Failed to get language preference" }, { status: 500 });
|
|
2500
|
+
}
|
|
2501
|
+
};
|
|
2502
|
+
const POST = async (request) => {
|
|
2503
|
+
try {
|
|
2504
|
+
const userId = await deps.getUserId();
|
|
2505
|
+
if (!userId) {
|
|
2506
|
+
return jsonResponse.json({ error: "Unauthorized" }, { status: 401 });
|
|
2507
|
+
}
|
|
2508
|
+
const body = await request.json();
|
|
2509
|
+
const { language } = body;
|
|
2510
|
+
if (language !== "en" && language !== "de") {
|
|
2511
|
+
return jsonResponse.json({ error: 'Invalid language. Must be "en" or "de".' }, { status: 400 });
|
|
2512
|
+
}
|
|
2513
|
+
const currentSettings = await deps.getUserSettings(userId) ?? {};
|
|
2514
|
+
const newSettings = {
|
|
2515
|
+
...currentSettings,
|
|
2516
|
+
language
|
|
2517
|
+
};
|
|
2518
|
+
await deps.updateUserSettings(userId, newSettings);
|
|
2519
|
+
return jsonResponse.json({
|
|
2520
|
+
success: true,
|
|
2521
|
+
language
|
|
2522
|
+
});
|
|
2523
|
+
} catch (error) {
|
|
2524
|
+
console.error("[litecms] Language POST error:", error);
|
|
2525
|
+
return jsonResponse.json({ error: "Failed to save language preference" }, { status: 500 });
|
|
2526
|
+
}
|
|
2527
|
+
};
|
|
2528
|
+
return { GET, POST };
|
|
2529
|
+
}
|
|
2530
|
+
var createPostSchema = exports_external.object({
|
|
2531
|
+
id: exports_external.string().uuid(),
|
|
2532
|
+
slug: exports_external.string().min(1).max(200).regex(/^[a-z0-9-]+$/, "Slug must be lowercase alphanumeric with hyphens"),
|
|
2533
|
+
title: exports_external.string().min(1).max(500),
|
|
2534
|
+
excerpt: exports_external.string().max(1000).optional(),
|
|
2535
|
+
coverImage: exports_external.string().url().optional().or(exports_external.literal("")),
|
|
2536
|
+
content: exports_external.string(),
|
|
2537
|
+
tags: exports_external.array(exports_external.string()).default([]),
|
|
2538
|
+
authorName: exports_external.string().min(1).max(200),
|
|
2539
|
+
status: exports_external.enum(["draft", "published"]).default("draft")
|
|
2540
|
+
});
|
|
2541
|
+
var updatePostSchema = exports_external.object({
|
|
2542
|
+
slug: exports_external.string().min(1).max(200).regex(/^[a-z0-9-]+$/, "Slug must be lowercase alphanumeric with hyphens").optional(),
|
|
2543
|
+
title: exports_external.string().min(1).max(500).optional(),
|
|
2544
|
+
excerpt: exports_external.string().max(1000).optional().nullable(),
|
|
2545
|
+
coverImage: exports_external.string().url().optional().nullable().or(exports_external.literal("")),
|
|
2546
|
+
content: exports_external.string().optional(),
|
|
2547
|
+
tags: exports_external.array(exports_external.string()).optional(),
|
|
2548
|
+
authorName: exports_external.string().min(1).max(200).optional(),
|
|
2549
|
+
status: exports_external.enum(["draft", "published"]).optional()
|
|
2550
|
+
});
|
|
2551
|
+
function serializePost(post) {
|
|
2552
|
+
return {
|
|
2553
|
+
...post,
|
|
2554
|
+
publishedAt: post.publishedAt?.toISOString() ?? null,
|
|
2555
|
+
createdAt: post.createdAt.toISOString(),
|
|
2556
|
+
updatedAt: post.updatedAt.toISOString()
|
|
2557
|
+
};
|
|
2558
|
+
}
|
|
2559
|
+
function createBlogPostsRoutes(deps, NextResponse) {
|
|
2560
|
+
const jsonResponse = NextResponse ?? {
|
|
2561
|
+
json: (data, init) => {
|
|
2562
|
+
return new Response(JSON.stringify(data), {
|
|
2563
|
+
status: init?.status ?? 200,
|
|
2564
|
+
headers: { "Content-Type": "application/json" }
|
|
2565
|
+
});
|
|
2566
|
+
}
|
|
2567
|
+
};
|
|
2568
|
+
const GET = async (request) => {
|
|
2569
|
+
try {
|
|
2570
|
+
const isAuthorized = await deps.checkAuth();
|
|
2571
|
+
if (!isAuthorized) {
|
|
2572
|
+
return jsonResponse.json({ error: "Unauthorized" }, { status: 401 });
|
|
2573
|
+
}
|
|
2574
|
+
const url2 = new URL(request.url);
|
|
2575
|
+
const statusFilter = url2.searchParams.get("status");
|
|
2576
|
+
const filter = statusFilter ? { status: statusFilter } : undefined;
|
|
2577
|
+
const posts = await deps.getPosts(filter);
|
|
2578
|
+
return jsonResponse.json({
|
|
2579
|
+
posts: posts.map(serializePost)
|
|
2580
|
+
});
|
|
2581
|
+
} catch (error) {
|
|
2582
|
+
console.error("[litecms] Blog posts GET error:", error);
|
|
2583
|
+
return jsonResponse.json({ error: "Failed to get blog posts" }, { status: 500 });
|
|
2584
|
+
}
|
|
2585
|
+
};
|
|
2586
|
+
const POST = async (request) => {
|
|
2587
|
+
try {
|
|
2588
|
+
const isAuthorized = await deps.checkAuth();
|
|
2589
|
+
if (!isAuthorized) {
|
|
2590
|
+
return jsonResponse.json({ error: "Unauthorized" }, { status: 401 });
|
|
2591
|
+
}
|
|
2592
|
+
const body = await request.json();
|
|
2593
|
+
const result = createPostSchema.safeParse(body);
|
|
2594
|
+
if (!result.success) {
|
|
2595
|
+
return jsonResponse.json({ error: "Validation failed", details: result.error.flatten() }, { status: 400 });
|
|
2596
|
+
}
|
|
2597
|
+
const slugTaken = await deps.slugExists(result.data.slug);
|
|
2598
|
+
if (slugTaken) {
|
|
2599
|
+
return jsonResponse.json({ error: "Slug already exists" }, { status: 409 });
|
|
2600
|
+
}
|
|
2601
|
+
const post = await deps.createPost({
|
|
2602
|
+
...result.data,
|
|
2603
|
+
coverImage: result.data.coverImage || undefined,
|
|
2604
|
+
excerpt: result.data.excerpt || undefined
|
|
2605
|
+
});
|
|
2606
|
+
return jsonResponse.json({ post: serializePost(post) }, { status: 201 });
|
|
2607
|
+
} catch (error) {
|
|
2608
|
+
console.error("[litecms] Blog post POST error:", error);
|
|
2609
|
+
return jsonResponse.json({ error: "Failed to create blog post" }, { status: 500 });
|
|
2610
|
+
}
|
|
2611
|
+
};
|
|
2612
|
+
return { GET, POST };
|
|
2613
|
+
}
|
|
2614
|
+
function createBlogPostRoutes(deps, NextResponse) {
|
|
2615
|
+
const jsonResponse = NextResponse ?? {
|
|
2616
|
+
json: (data, init) => {
|
|
2617
|
+
return new Response(JSON.stringify(data), {
|
|
2618
|
+
status: init?.status ?? 200,
|
|
2619
|
+
headers: { "Content-Type": "application/json" }
|
|
2620
|
+
});
|
|
2621
|
+
}
|
|
2622
|
+
};
|
|
2623
|
+
const GET = async (_request, { params }) => {
|
|
2624
|
+
try {
|
|
2625
|
+
const isAuthorized = await deps.checkAuth();
|
|
2626
|
+
if (!isAuthorized) {
|
|
2627
|
+
return jsonResponse.json({ error: "Unauthorized" }, { status: 401 });
|
|
2628
|
+
}
|
|
2629
|
+
const resolvedParams = await Promise.resolve(params);
|
|
2630
|
+
const post = await deps.getPost(resolvedParams.id);
|
|
2631
|
+
if (!post) {
|
|
2632
|
+
return jsonResponse.json({ error: "Post not found" }, { status: 404 });
|
|
2633
|
+
}
|
|
2634
|
+
return jsonResponse.json({ post: serializePost(post) });
|
|
2635
|
+
} catch (error) {
|
|
2636
|
+
console.error("[litecms] Blog post GET error:", error);
|
|
2637
|
+
return jsonResponse.json({ error: "Failed to get blog post" }, { status: 500 });
|
|
2638
|
+
}
|
|
2639
|
+
};
|
|
2640
|
+
const PATCH = async (request, { params }) => {
|
|
2641
|
+
try {
|
|
2642
|
+
const isAuthorized = await deps.checkAuth();
|
|
2643
|
+
if (!isAuthorized) {
|
|
2644
|
+
return jsonResponse.json({ error: "Unauthorized" }, { status: 401 });
|
|
2645
|
+
}
|
|
2646
|
+
const resolvedParams = await Promise.resolve(params);
|
|
2647
|
+
const existingPost = await deps.getPost(resolvedParams.id);
|
|
2648
|
+
if (!existingPost) {
|
|
2649
|
+
return jsonResponse.json({ error: "Post not found" }, { status: 404 });
|
|
2650
|
+
}
|
|
2651
|
+
const body = await request.json();
|
|
2652
|
+
const result = updatePostSchema.safeParse(body);
|
|
2653
|
+
if (!result.success) {
|
|
2654
|
+
return jsonResponse.json({ error: "Validation failed", details: result.error.flatten() }, { status: 400 });
|
|
2655
|
+
}
|
|
2656
|
+
if (result.data.slug && result.data.slug !== existingPost.slug) {
|
|
2657
|
+
const slugTaken = await deps.slugExistsExcluding(result.data.slug, resolvedParams.id);
|
|
2658
|
+
if (slugTaken) {
|
|
2659
|
+
return jsonResponse.json({ error: "Slug already exists" }, { status: 409 });
|
|
2660
|
+
}
|
|
2661
|
+
}
|
|
2662
|
+
const post = await deps.updatePost(resolvedParams.id, {
|
|
2663
|
+
...result.data,
|
|
2664
|
+
coverImage: result.data.coverImage === "" ? null : result.data.coverImage,
|
|
2665
|
+
excerpt: result.data.excerpt === "" ? null : result.data.excerpt
|
|
2666
|
+
});
|
|
2667
|
+
return jsonResponse.json({ post: serializePost(post) });
|
|
2668
|
+
} catch (error) {
|
|
2669
|
+
console.error("[litecms] Blog post PATCH error:", error);
|
|
2670
|
+
return jsonResponse.json({ error: "Failed to update blog post" }, { status: 500 });
|
|
2671
|
+
}
|
|
2672
|
+
};
|
|
2673
|
+
const DELETE = async (_request, { params }) => {
|
|
2674
|
+
try {
|
|
2675
|
+
const isAuthorized = await deps.checkAuth();
|
|
2676
|
+
if (!isAuthorized) {
|
|
2677
|
+
return jsonResponse.json({ error: "Unauthorized" }, { status: 401 });
|
|
2678
|
+
}
|
|
2679
|
+
const resolvedParams = await Promise.resolve(params);
|
|
2680
|
+
const existingPost = await deps.getPost(resolvedParams.id);
|
|
2681
|
+
if (!existingPost) {
|
|
2682
|
+
return jsonResponse.json({ error: "Post not found" }, { status: 404 });
|
|
2683
|
+
}
|
|
2684
|
+
await deps.deletePost(resolvedParams.id);
|
|
2685
|
+
return jsonResponse.json({ success: true });
|
|
2686
|
+
} catch (error) {
|
|
2687
|
+
console.error("[litecms] Blog post DELETE error:", error);
|
|
2688
|
+
return jsonResponse.json({ error: "Failed to delete blog post" }, { status: 500 });
|
|
2689
|
+
}
|
|
2690
|
+
};
|
|
2691
|
+
return { GET, PATCH, DELETE };
|
|
2692
|
+
}
|
|
112
2693
|
export {
|
|
113
2694
|
parseFormDataToObject,
|
|
114
2695
|
parseFormData,
|
|
115
2696
|
isDevelopmentEnv,
|
|
116
|
-
createSaveAction
|
|
2697
|
+
createSaveAction,
|
|
2698
|
+
createLanguageRoutes,
|
|
2699
|
+
createBlogPostsRoutes,
|
|
2700
|
+
createBlogPostRoutes
|
|
117
2701
|
};
|