@temporary-name/zod 1.9.3-alpha.50b729ba628b987e14f5bd1004e5a04590fd4b4e → 1.9.3-alpha.52ad782be6ff2aac22845e524cd6454f857fb89b
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/dist/index.d.mts +310 -335
- package/dist/index.d.ts +310 -335
- package/dist/index.mjs +471 -480
- package/package.json +4 -11
- package/dist/zod4/index.d.mts +0 -12
- package/dist/zod4/index.d.ts +0 -12
- package/dist/zod4/index.mjs +0 -259
package/dist/index.mjs
CHANGED
|
@@ -3,7 +3,6 @@ import { $ZodError, util, _overwrite, _regex, _includes, _startsWith, _endsWith,
|
|
|
3
3
|
export { core };
|
|
4
4
|
export { _endsWith as endsWith, _gt as gt, _gte as gte, _includes as includes, _length as length, _lowercase as lowercase, _lt as lt, _lte as lte, _maxLength as maxLength, _maxSize as maxSize, _mime as mime, _minLength as minLength, _minSize as minSize, _multipleOf as multipleOf, _negative as negative, _nonnegative as nonnegative, _nonpositive as nonpositive, _normalize as normalize, _overwrite as overwrite, _positive as positive, _property as property, _regex as regex, _size as size, _startsWith as startsWith, _toLowerCase as toLowerCase, _toUpperCase as toUpperCase, _trim as trim, _uppercase as uppercase } from 'zod/v4/core';
|
|
5
5
|
import { AsyncLocalStorage } from 'node:async_hooks';
|
|
6
|
-
import { custom as custom$1 } from 'zod/v3';
|
|
7
6
|
|
|
8
7
|
const initializer = (inst, issues) => {
|
|
9
8
|
$ZodError.init(inst, issues);
|
|
@@ -57,79 +56,82 @@ const safeDecode = /* @__PURE__ */ core._safeDecode(ZodRealError);
|
|
|
57
56
|
const safeEncodeAsync = /* @__PURE__ */ core._safeEncodeAsync(ZodRealError);
|
|
58
57
|
const safeDecodeAsync = /* @__PURE__ */ core._safeDecodeAsync(ZodRealError);
|
|
59
58
|
|
|
60
|
-
const
|
|
61
|
-
"
|
|
59
|
+
const KrustyISODateTime = /* @__PURE__ */ core.$constructor(
|
|
60
|
+
"KrustyISODateTime",
|
|
62
61
|
(inst, def) => {
|
|
63
62
|
const coreInit = core.$ZodISODateTime.init;
|
|
64
63
|
coreInit(inst, def);
|
|
65
|
-
|
|
64
|
+
KrustyStringFormat.init(inst, def);
|
|
66
65
|
}
|
|
67
66
|
);
|
|
68
67
|
function datetime(params) {
|
|
69
|
-
return core._isoDateTime(
|
|
68
|
+
return core._isoDateTime(KrustyISODateTime, params);
|
|
70
69
|
}
|
|
71
|
-
const
|
|
72
|
-
"
|
|
70
|
+
const KrustyISODate = /* @__PURE__ */ core.$constructor(
|
|
71
|
+
"KrustyISODate",
|
|
73
72
|
(inst, def) => {
|
|
74
73
|
const coreInit = core.$ZodISODate.init;
|
|
75
74
|
coreInit(inst, def);
|
|
76
|
-
|
|
75
|
+
KrustyStringFormat.init(inst, def);
|
|
77
76
|
}
|
|
78
77
|
);
|
|
79
78
|
function date$1(params) {
|
|
80
|
-
return core._isoDate(
|
|
79
|
+
return core._isoDate(KrustyISODate, params);
|
|
81
80
|
}
|
|
82
|
-
const
|
|
83
|
-
"
|
|
81
|
+
const KrustyISOTime = /* @__PURE__ */ core.$constructor(
|
|
82
|
+
"KrustyISOTime",
|
|
84
83
|
(inst, def) => {
|
|
85
84
|
const coreInit = core.$ZodISOTime.init;
|
|
86
85
|
coreInit(inst, def);
|
|
87
|
-
|
|
86
|
+
KrustyStringFormat.init(inst, def);
|
|
88
87
|
}
|
|
89
88
|
);
|
|
90
89
|
function time(params) {
|
|
91
|
-
return core._isoTime(
|
|
90
|
+
return core._isoTime(KrustyISOTime, params);
|
|
92
91
|
}
|
|
93
|
-
const
|
|
94
|
-
"
|
|
92
|
+
const KrustyISODuration = /* @__PURE__ */ core.$constructor(
|
|
93
|
+
"KrustyISODuration",
|
|
95
94
|
(inst, def) => {
|
|
96
95
|
const coreInit = core.$ZodISODuration.init;
|
|
97
96
|
coreInit(inst, def);
|
|
98
|
-
|
|
97
|
+
KrustyStringFormat.init(inst, def);
|
|
99
98
|
}
|
|
100
99
|
);
|
|
101
100
|
function duration(params) {
|
|
102
|
-
return core._isoDuration(
|
|
101
|
+
return core._isoDuration(KrustyISODuration, params);
|
|
103
102
|
}
|
|
104
103
|
|
|
105
104
|
const gatingContext = new AsyncLocalStorage();
|
|
106
105
|
function isGateIssueRaw(issue) {
|
|
107
|
-
return issue.code === "invalid_type" && issue.expected === "never" && issue.inst instanceof
|
|
106
|
+
return issue.code === "invalid_type" && issue.expected === "never" && issue.inst instanceof KrustyGate;
|
|
108
107
|
}
|
|
109
108
|
function isGateIssue(issue) {
|
|
110
109
|
return issue.code === "invalid_type" && issue.expected === "never" && issue.path?.length === 0;
|
|
111
110
|
}
|
|
112
|
-
const
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
111
|
+
const KrustyGate = /* @__PURE__ */ core.$constructor(
|
|
112
|
+
"KrustyGate",
|
|
113
|
+
(inst, def) => {
|
|
114
|
+
const coreInit = core.$ZodOptional.init;
|
|
115
|
+
coreInit(inst, def);
|
|
116
|
+
KrustyType.init(inst, def);
|
|
117
|
+
inst._zod.parse = (payload, ctx) => {
|
|
118
|
+
const gateEnabled = gatingContext.getStore()?.(def.gateName);
|
|
119
|
+
if (gateEnabled) {
|
|
120
|
+
return def.innerType._zod.run(payload, ctx);
|
|
121
|
+
} else if (payload.value !== void 0) {
|
|
122
|
+
payload.issues.push({
|
|
123
|
+
expected: "never",
|
|
124
|
+
code: "invalid_type",
|
|
125
|
+
input: payload.value,
|
|
126
|
+
inst
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
return payload;
|
|
130
|
+
};
|
|
131
|
+
}
|
|
132
|
+
);
|
|
131
133
|
function gate(innerType, gateName) {
|
|
132
|
-
return new
|
|
134
|
+
return new KrustyGate({
|
|
133
135
|
type: "optional",
|
|
134
136
|
innerType,
|
|
135
137
|
gateName
|
|
@@ -146,8 +148,8 @@ function handleGating(payload) {
|
|
|
146
148
|
}
|
|
147
149
|
return payload;
|
|
148
150
|
}
|
|
149
|
-
const
|
|
150
|
-
"
|
|
151
|
+
const KrustyUnion = /* @__PURE__ */ core.$constructor(
|
|
152
|
+
"KrustyUnion",
|
|
151
153
|
(inst, def) => {
|
|
152
154
|
const coreInit = core.$ZodUnion.init;
|
|
153
155
|
coreInit(inst, def);
|
|
@@ -165,19 +167,19 @@ const ZodUnion = /* @__PURE__ */ core.$constructor(
|
|
|
165
167
|
}
|
|
166
168
|
);
|
|
167
169
|
function union(options, params) {
|
|
168
|
-
return new
|
|
170
|
+
return new KrustyUnion({
|
|
169
171
|
type: "union",
|
|
170
172
|
options,
|
|
171
173
|
...util.normalizeParams(params)
|
|
172
174
|
});
|
|
173
175
|
}
|
|
174
|
-
const
|
|
175
|
-
|
|
176
|
+
const KrustyDiscriminatedUnion = /* @__PURE__ */ core.$constructor("KrustyDiscriminatedUnion", (inst, def) => {
|
|
177
|
+
KrustyUnion.init(inst, def);
|
|
176
178
|
const coreInit = core.$ZodDiscriminatedUnion.init;
|
|
177
179
|
coreInit(inst, def);
|
|
178
180
|
});
|
|
179
181
|
function discriminatedUnion(discriminator, options, params) {
|
|
180
|
-
return new
|
|
182
|
+
return new KrustyDiscriminatedUnion({
|
|
181
183
|
type: "union",
|
|
182
184
|
options,
|
|
183
185
|
discriminator,
|
|
@@ -197,8 +199,8 @@ function handlePropertyResult(result, final, key, input) {
|
|
|
197
199
|
final.value[key] = result.value;
|
|
198
200
|
}
|
|
199
201
|
}
|
|
200
|
-
const
|
|
201
|
-
"
|
|
202
|
+
const KrustyObject = /* @__PURE__ */ core.$constructor(
|
|
203
|
+
"KrustyObject",
|
|
202
204
|
(inst, def) => {
|
|
203
205
|
const coreInit = core.$ZodObjectJIT.init;
|
|
204
206
|
coreInit(inst, def);
|
|
@@ -221,8 +223,8 @@ const ZodObject = /* @__PURE__ */ core.$constructor(
|
|
|
221
223
|
inst.merge = (other) => util.merge(inst, other);
|
|
222
224
|
inst.pick = (mask) => util.pick(inst, mask);
|
|
223
225
|
inst.omit = (mask) => util.omit(inst, mask);
|
|
224
|
-
inst.partial = (...args) => util.partial(
|
|
225
|
-
inst.required = (...args) => util.required(
|
|
226
|
+
inst.partial = (...args) => util.partial(KrustyOptional, inst, args[0]);
|
|
227
|
+
inst.required = (...args) => util.required(KrustyNonOptional, inst, args[0]);
|
|
226
228
|
function handleGating(input, payload, ctx) {
|
|
227
229
|
const _catchall = def.catchall?._zod;
|
|
228
230
|
const t = _catchall?.def.type;
|
|
@@ -292,10 +294,10 @@ function object(shape, params) {
|
|
|
292
294
|
shape: shape ?? {},
|
|
293
295
|
...util.normalizeParams(params)
|
|
294
296
|
};
|
|
295
|
-
return new
|
|
297
|
+
return new KrustyObject(def);
|
|
296
298
|
}
|
|
297
299
|
function strictObject(shape, params) {
|
|
298
|
-
return new
|
|
300
|
+
return new KrustyObject({
|
|
299
301
|
type: "object",
|
|
300
302
|
shape,
|
|
301
303
|
catchall: never(),
|
|
@@ -303,7 +305,7 @@ function strictObject(shape, params) {
|
|
|
303
305
|
});
|
|
304
306
|
}
|
|
305
307
|
function looseObject(shape, params) {
|
|
306
|
-
return new
|
|
308
|
+
return new KrustyObject({
|
|
307
309
|
type: "object",
|
|
308
310
|
shape,
|
|
309
311
|
catchall: unknown(),
|
|
@@ -311,60 +313,6 @@ function looseObject(shape, params) {
|
|
|
311
313
|
});
|
|
312
314
|
}
|
|
313
315
|
|
|
314
|
-
const CUSTOM_ZOD_DEF_SYMBOL = Symbol("ORPC_CUSTOM_ZOD_DEF");
|
|
315
|
-
function setCustomZodDef(def, custom) {
|
|
316
|
-
Object.assign(def, { [CUSTOM_ZOD_DEF_SYMBOL]: custom });
|
|
317
|
-
}
|
|
318
|
-
function composeParams(defaultMessage, params) {
|
|
319
|
-
return (val) => {
|
|
320
|
-
const message = defaultMessage(val);
|
|
321
|
-
if (!params) {
|
|
322
|
-
return {
|
|
323
|
-
message
|
|
324
|
-
};
|
|
325
|
-
}
|
|
326
|
-
if (typeof params === "function") {
|
|
327
|
-
return {
|
|
328
|
-
message,
|
|
329
|
-
...params(val)
|
|
330
|
-
};
|
|
331
|
-
}
|
|
332
|
-
if (typeof params === "object") {
|
|
333
|
-
return {
|
|
334
|
-
message,
|
|
335
|
-
...params
|
|
336
|
-
};
|
|
337
|
-
}
|
|
338
|
-
return {
|
|
339
|
-
message: params
|
|
340
|
-
};
|
|
341
|
-
};
|
|
342
|
-
}
|
|
343
|
-
|
|
344
|
-
function blob(params) {
|
|
345
|
-
const schema = custom$1(
|
|
346
|
-
(val) => val instanceof Blob,
|
|
347
|
-
composeParams(
|
|
348
|
-
() => "Input is not a blob",
|
|
349
|
-
params
|
|
350
|
-
)
|
|
351
|
-
);
|
|
352
|
-
setCustomZodDef(schema._def, { type: "blob" });
|
|
353
|
-
return schema;
|
|
354
|
-
}
|
|
355
|
-
|
|
356
|
-
function regexp(params) {
|
|
357
|
-
const schema = custom$1(
|
|
358
|
-
(val) => val instanceof RegExp,
|
|
359
|
-
composeParams(
|
|
360
|
-
() => "Input is not a regexp",
|
|
361
|
-
params
|
|
362
|
-
)
|
|
363
|
-
);
|
|
364
|
-
setCustomZodDef(schema._def, { type: "regexp" });
|
|
365
|
-
return schema;
|
|
366
|
-
}
|
|
367
|
-
|
|
368
316
|
const KrustyType = /* @__PURE__ */ core.$constructor(
|
|
369
317
|
"KrustyType",
|
|
370
318
|
(inst, def) => {
|
|
@@ -391,19 +339,6 @@ const KrustyType = /* @__PURE__ */ core.$constructor(
|
|
|
391
339
|
reg.add(inst, meta);
|
|
392
340
|
return inst;
|
|
393
341
|
});
|
|
394
|
-
inst.parse = (data, params) => parse(inst, data, params, { callee: inst.parse });
|
|
395
|
-
inst.safeParse = (data, params) => safeParse(inst, data, params);
|
|
396
|
-
inst.parseAsync = async (data, params) => parseAsync(inst, data, params, { callee: inst.parseAsync });
|
|
397
|
-
inst.safeParseAsync = async (data, params) => safeParseAsync(inst, data, params);
|
|
398
|
-
inst.spa = inst.safeParseAsync;
|
|
399
|
-
inst.encode = (data, params) => encode(inst, data, params);
|
|
400
|
-
inst.decode = (data, params) => decode(inst, data, params);
|
|
401
|
-
inst.encodeAsync = async (data, params) => encodeAsync(inst, data, params);
|
|
402
|
-
inst.decodeAsync = async (data, params) => decodeAsync(inst, data, params);
|
|
403
|
-
inst.safeEncode = (data, params) => safeEncode(inst, data, params);
|
|
404
|
-
inst.safeDecode = (data, params) => safeDecode(inst, data, params);
|
|
405
|
-
inst.safeEncodeAsync = async (data, params) => safeEncodeAsync(inst, data, params);
|
|
406
|
-
inst.safeDecodeAsync = async (data, params) => safeDecodeAsync(inst, data, params);
|
|
407
342
|
inst.refine = (check2, params) => inst.check(refine(check2, params));
|
|
408
343
|
inst.superRefine = (refinement) => inst.check(superRefine(refinement));
|
|
409
344
|
inst.overwrite = (fn) => inst.check(_overwrite(fn));
|
|
@@ -421,8 +356,8 @@ const KrustyType = /* @__PURE__ */ core.$constructor(
|
|
|
421
356
|
return inst;
|
|
422
357
|
}
|
|
423
358
|
);
|
|
424
|
-
const
|
|
425
|
-
"
|
|
359
|
+
const _KrustyString = /* @__PURE__ */ core.$constructor(
|
|
360
|
+
"_KrustyString",
|
|
426
361
|
(inst, def) => {
|
|
427
362
|
const coreInit = core.$ZodString.init;
|
|
428
363
|
coreInit(inst, def);
|
|
@@ -447,35 +382,35 @@ const _ZodString = /* @__PURE__ */ core.$constructor(
|
|
|
447
382
|
inst.toUpperCase = () => inst.check(_toUpperCase());
|
|
448
383
|
}
|
|
449
384
|
);
|
|
450
|
-
const
|
|
451
|
-
"
|
|
385
|
+
const KrustyString = /* @__PURE__ */ core.$constructor(
|
|
386
|
+
"KrustyString",
|
|
452
387
|
(inst, def) => {
|
|
453
388
|
const coreInit = core.$ZodString.init;
|
|
454
389
|
coreInit(inst, def);
|
|
455
|
-
|
|
456
|
-
inst.email = (params) => inst.check(core._email(
|
|
457
|
-
inst.url = (params) => inst.check(core._url(
|
|
458
|
-
inst.jwt = (params) => inst.check(core._jwt(
|
|
459
|
-
inst.emoji = (params) => inst.check(core._emoji(
|
|
460
|
-
inst.guid = (params) => inst.check(core._guid(
|
|
461
|
-
inst.uuid = (params) => inst.check(core._uuid(
|
|
462
|
-
inst.uuidv4 = (params) => inst.check(core._uuidv4(
|
|
463
|
-
inst.uuidv6 = (params) => inst.check(core._uuidv6(
|
|
464
|
-
inst.uuidv7 = (params) => inst.check(core._uuidv7(
|
|
465
|
-
inst.nanoid = (params) => inst.check(core._nanoid(
|
|
466
|
-
inst.guid = (params) => inst.check(core._guid(
|
|
467
|
-
inst.cuid = (params) => inst.check(core._cuid(
|
|
468
|
-
inst.cuid2 = (params) => inst.check(core._cuid2(
|
|
469
|
-
inst.ulid = (params) => inst.check(core._ulid(
|
|
470
|
-
inst.base64 = (params) => inst.check(core._base64(
|
|
471
|
-
inst.base64url = (params) => inst.check(core._base64url(
|
|
472
|
-
inst.xid = (params) => inst.check(core._xid(
|
|
473
|
-
inst.ksuid = (params) => inst.check(core._ksuid(
|
|
474
|
-
inst.ipv4 = (params) => inst.check(core._ipv4(
|
|
475
|
-
inst.ipv6 = (params) => inst.check(core._ipv6(
|
|
476
|
-
inst.cidrv4 = (params) => inst.check(core._cidrv4(
|
|
477
|
-
inst.cidrv6 = (params) => inst.check(core._cidrv6(
|
|
478
|
-
inst.e164 = (params) => inst.check(core._e164(
|
|
390
|
+
_KrustyString.init(inst, def);
|
|
391
|
+
inst.email = (params) => inst.check(core._email(KrustyEmail, params));
|
|
392
|
+
inst.url = (params) => inst.check(core._url(KrustyURL, params));
|
|
393
|
+
inst.jwt = (params) => inst.check(core._jwt(KrustyJWT, params));
|
|
394
|
+
inst.emoji = (params) => inst.check(core._emoji(KrustyEmoji, params));
|
|
395
|
+
inst.guid = (params) => inst.check(core._guid(KrustyGUID, params));
|
|
396
|
+
inst.uuid = (params) => inst.check(core._uuid(KrustyUUID, params));
|
|
397
|
+
inst.uuidv4 = (params) => inst.check(core._uuidv4(KrustyUUID, params));
|
|
398
|
+
inst.uuidv6 = (params) => inst.check(core._uuidv6(KrustyUUID, params));
|
|
399
|
+
inst.uuidv7 = (params) => inst.check(core._uuidv7(KrustyUUID, params));
|
|
400
|
+
inst.nanoid = (params) => inst.check(core._nanoid(KrustyNanoID, params));
|
|
401
|
+
inst.guid = (params) => inst.check(core._guid(KrustyGUID, params));
|
|
402
|
+
inst.cuid = (params) => inst.check(core._cuid(KrustyCUID, params));
|
|
403
|
+
inst.cuid2 = (params) => inst.check(core._cuid2(KrustyCUID2, params));
|
|
404
|
+
inst.ulid = (params) => inst.check(core._ulid(KrustyULID, params));
|
|
405
|
+
inst.base64 = (params) => inst.check(core._base64(KrustyBase64, params));
|
|
406
|
+
inst.base64url = (params) => inst.check(core._base64url(KrustyBase64URL, params));
|
|
407
|
+
inst.xid = (params) => inst.check(core._xid(KrustyXID, params));
|
|
408
|
+
inst.ksuid = (params) => inst.check(core._ksuid(KrustyKSUID, params));
|
|
409
|
+
inst.ipv4 = (params) => inst.check(core._ipv4(KrustyIPv4, params));
|
|
410
|
+
inst.ipv6 = (params) => inst.check(core._ipv6(KrustyIPv6, params));
|
|
411
|
+
inst.cidrv4 = (params) => inst.check(core._cidrv4(KrustyCIDRv4, params));
|
|
412
|
+
inst.cidrv6 = (params) => inst.check(core._cidrv6(KrustyCIDRv6, params));
|
|
413
|
+
inst.e164 = (params) => inst.check(core._e164(KrustyE164, params));
|
|
479
414
|
inst.datetime = (params) => inst.check(datetime(params));
|
|
480
415
|
inst.date = (params) => inst.check(date$1(params));
|
|
481
416
|
inst.time = (params) => inst.check(time(params));
|
|
@@ -483,234 +418,264 @@ const ZodString = /* @__PURE__ */ core.$constructor(
|
|
|
483
418
|
}
|
|
484
419
|
);
|
|
485
420
|
function string(params) {
|
|
486
|
-
return core._string(
|
|
421
|
+
return core._string(KrustyString, params);
|
|
487
422
|
}
|
|
488
|
-
const
|
|
489
|
-
"
|
|
423
|
+
const KrustyStringFormat = /* @__PURE__ */ core.$constructor(
|
|
424
|
+
"KrustyStringFormat",
|
|
490
425
|
(inst, def) => {
|
|
491
426
|
const coreInit = core.$ZodStringFormat.init;
|
|
492
427
|
coreInit(inst, def);
|
|
493
|
-
|
|
428
|
+
_KrustyString.init(inst, def);
|
|
494
429
|
}
|
|
495
430
|
);
|
|
496
|
-
const
|
|
497
|
-
"
|
|
431
|
+
const KrustyEmail = /* @__PURE__ */ core.$constructor(
|
|
432
|
+
"KrustyEmail",
|
|
498
433
|
(inst, def) => {
|
|
499
434
|
const coreInit = core.$ZodEmail.init;
|
|
500
435
|
coreInit(inst, def);
|
|
501
|
-
|
|
436
|
+
KrustyStringFormat.init(inst, def);
|
|
502
437
|
}
|
|
503
438
|
);
|
|
504
439
|
function email(params) {
|
|
505
|
-
return core._email(
|
|
440
|
+
return core._email(KrustyEmail, params);
|
|
506
441
|
}
|
|
507
|
-
const
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
442
|
+
const KrustyGUID = /* @__PURE__ */ core.$constructor(
|
|
443
|
+
"KrustyGUID",
|
|
444
|
+
(inst, def) => {
|
|
445
|
+
const coreInit = core.$ZodGUID.init;
|
|
446
|
+
coreInit(inst, def);
|
|
447
|
+
KrustyStringFormat.init(inst, def);
|
|
448
|
+
}
|
|
449
|
+
);
|
|
512
450
|
function guid(params) {
|
|
513
|
-
return core._guid(
|
|
451
|
+
return core._guid(KrustyGUID, params);
|
|
514
452
|
}
|
|
515
|
-
const
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
453
|
+
const KrustyUUID = /* @__PURE__ */ core.$constructor(
|
|
454
|
+
"KrustyUUID",
|
|
455
|
+
(inst, def) => {
|
|
456
|
+
const coreInit = core.$ZodUUID.init;
|
|
457
|
+
coreInit(inst, def);
|
|
458
|
+
KrustyStringFormat.init(inst, def);
|
|
459
|
+
}
|
|
460
|
+
);
|
|
520
461
|
function uuid(params) {
|
|
521
|
-
return core._uuid(
|
|
462
|
+
return core._uuid(KrustyUUID, params);
|
|
522
463
|
}
|
|
523
464
|
function uuidv4(params) {
|
|
524
|
-
return core._uuidv4(
|
|
465
|
+
return core._uuidv4(KrustyUUID, params);
|
|
525
466
|
}
|
|
526
467
|
function uuidv6(params) {
|
|
527
|
-
return core._uuidv6(
|
|
468
|
+
return core._uuidv6(KrustyUUID, params);
|
|
528
469
|
}
|
|
529
470
|
function uuidv7(params) {
|
|
530
|
-
return core._uuidv7(
|
|
471
|
+
return core._uuidv7(KrustyUUID, params);
|
|
531
472
|
}
|
|
532
|
-
const
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
473
|
+
const KrustyURL = /* @__PURE__ */ core.$constructor(
|
|
474
|
+
"KrustyURL",
|
|
475
|
+
(inst, def) => {
|
|
476
|
+
const coreInit = core.$ZodURL.init;
|
|
477
|
+
coreInit(inst, def);
|
|
478
|
+
KrustyStringFormat.init(inst, def);
|
|
479
|
+
}
|
|
480
|
+
);
|
|
537
481
|
function url(params) {
|
|
538
|
-
return core._url(
|
|
482
|
+
return core._url(KrustyURL, params);
|
|
539
483
|
}
|
|
540
484
|
function httpUrl(params) {
|
|
541
|
-
return core._url(
|
|
485
|
+
return core._url(KrustyURL, {
|
|
542
486
|
protocol: /^https?$/,
|
|
543
487
|
hostname: core.regexes.domain,
|
|
544
488
|
...util.normalizeParams(params)
|
|
545
489
|
});
|
|
546
490
|
}
|
|
547
|
-
const
|
|
548
|
-
"
|
|
491
|
+
const KrustyEmoji = /* @__PURE__ */ core.$constructor(
|
|
492
|
+
"KrustyEmoji",
|
|
549
493
|
(inst, def) => {
|
|
550
494
|
const coreInit = core.$ZodEmoji.init;
|
|
551
495
|
coreInit(inst, def);
|
|
552
|
-
|
|
496
|
+
KrustyStringFormat.init(inst, def);
|
|
553
497
|
}
|
|
554
498
|
);
|
|
555
499
|
function emoji(params) {
|
|
556
|
-
return core._emoji(
|
|
500
|
+
return core._emoji(KrustyEmoji, params);
|
|
557
501
|
}
|
|
558
|
-
const
|
|
559
|
-
"
|
|
502
|
+
const KrustyNanoID = /* @__PURE__ */ core.$constructor(
|
|
503
|
+
"KrustyNanoID",
|
|
560
504
|
(inst, def) => {
|
|
561
505
|
const coreInit = core.$ZodNanoID.init;
|
|
562
506
|
coreInit(inst, def);
|
|
563
|
-
|
|
507
|
+
KrustyStringFormat.init(inst, def);
|
|
564
508
|
}
|
|
565
509
|
);
|
|
566
510
|
function nanoid(params) {
|
|
567
|
-
return core._nanoid(
|
|
511
|
+
return core._nanoid(KrustyNanoID, params);
|
|
568
512
|
}
|
|
569
|
-
const
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
513
|
+
const KrustyCUID = /* @__PURE__ */ core.$constructor(
|
|
514
|
+
"KrustyCUID",
|
|
515
|
+
(inst, def) => {
|
|
516
|
+
const coreInit = core.$ZodCUID.init;
|
|
517
|
+
coreInit(inst, def);
|
|
518
|
+
KrustyStringFormat.init(inst, def);
|
|
519
|
+
}
|
|
520
|
+
);
|
|
574
521
|
function cuid(params) {
|
|
575
|
-
return core._cuid(
|
|
522
|
+
return core._cuid(KrustyCUID, params);
|
|
576
523
|
}
|
|
577
|
-
const
|
|
578
|
-
"
|
|
524
|
+
const KrustyCUID2 = /* @__PURE__ */ core.$constructor(
|
|
525
|
+
"KrustyCUID2",
|
|
579
526
|
(inst, def) => {
|
|
580
527
|
const coreInit = core.$ZodCUID2.init;
|
|
581
528
|
coreInit(inst, def);
|
|
582
|
-
|
|
529
|
+
KrustyStringFormat.init(inst, def);
|
|
583
530
|
}
|
|
584
531
|
);
|
|
585
532
|
function cuid2(params) {
|
|
586
|
-
return core._cuid2(
|
|
533
|
+
return core._cuid2(KrustyCUID2, params);
|
|
587
534
|
}
|
|
588
|
-
const
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
535
|
+
const KrustyULID = /* @__PURE__ */ core.$constructor(
|
|
536
|
+
"KrustyULID",
|
|
537
|
+
(inst, def) => {
|
|
538
|
+
const coreInit = core.$ZodULID.init;
|
|
539
|
+
coreInit(inst, def);
|
|
540
|
+
KrustyStringFormat.init(inst, def);
|
|
541
|
+
}
|
|
542
|
+
);
|
|
593
543
|
function ulid(params) {
|
|
594
|
-
return core._ulid(
|
|
544
|
+
return core._ulid(KrustyULID, params);
|
|
595
545
|
}
|
|
596
|
-
const
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
546
|
+
const KrustyXID = /* @__PURE__ */ core.$constructor(
|
|
547
|
+
"KrustyXID",
|
|
548
|
+
(inst, def) => {
|
|
549
|
+
const coreInit = core.$ZodXID.init;
|
|
550
|
+
coreInit(inst, def);
|
|
551
|
+
KrustyStringFormat.init(inst, def);
|
|
552
|
+
}
|
|
553
|
+
);
|
|
601
554
|
function xid(params) {
|
|
602
|
-
return core._xid(
|
|
555
|
+
return core._xid(KrustyXID, params);
|
|
603
556
|
}
|
|
604
|
-
const
|
|
605
|
-
"
|
|
557
|
+
const KrustyKSUID = /* @__PURE__ */ core.$constructor(
|
|
558
|
+
"KrustyKSUID",
|
|
606
559
|
(inst, def) => {
|
|
607
560
|
const coreInit = core.$ZodKSUID.init;
|
|
608
561
|
coreInit(inst, def);
|
|
609
|
-
|
|
562
|
+
KrustyStringFormat.init(inst, def);
|
|
610
563
|
}
|
|
611
564
|
);
|
|
612
565
|
function ksuid(params) {
|
|
613
|
-
return core._ksuid(
|
|
566
|
+
return core._ksuid(KrustyKSUID, params);
|
|
614
567
|
}
|
|
615
|
-
const
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
568
|
+
const KrustyIPv4 = /* @__PURE__ */ core.$constructor(
|
|
569
|
+
"KrustyIPv4",
|
|
570
|
+
(inst, def) => {
|
|
571
|
+
const coreInit = core.$ZodIPv4.init;
|
|
572
|
+
coreInit(inst, def);
|
|
573
|
+
KrustyStringFormat.init(inst, def);
|
|
574
|
+
}
|
|
575
|
+
);
|
|
620
576
|
function ipv4(params) {
|
|
621
|
-
return core._ipv4(
|
|
577
|
+
return core._ipv4(KrustyIPv4, params);
|
|
622
578
|
}
|
|
623
|
-
const
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
579
|
+
const KrustyIPv6 = /* @__PURE__ */ core.$constructor(
|
|
580
|
+
"KrustyIPv6",
|
|
581
|
+
(inst, def) => {
|
|
582
|
+
const coreInit = core.$ZodIPv6.init;
|
|
583
|
+
coreInit(inst, def);
|
|
584
|
+
KrustyStringFormat.init(inst, def);
|
|
585
|
+
}
|
|
586
|
+
);
|
|
628
587
|
function ipv6(params) {
|
|
629
|
-
return core._ipv6(
|
|
588
|
+
return core._ipv6(KrustyIPv6, params);
|
|
630
589
|
}
|
|
631
|
-
const
|
|
632
|
-
"
|
|
590
|
+
const KrustyCIDRv4 = /* @__PURE__ */ core.$constructor(
|
|
591
|
+
"KrustyCIDRv4",
|
|
633
592
|
(inst, def) => {
|
|
634
593
|
const coreInit = core.$ZodCIDRv4.init;
|
|
635
594
|
coreInit(inst, def);
|
|
636
|
-
|
|
595
|
+
KrustyStringFormat.init(inst, def);
|
|
637
596
|
}
|
|
638
597
|
);
|
|
639
598
|
function cidrv4(params) {
|
|
640
|
-
return core._cidrv4(
|
|
599
|
+
return core._cidrv4(KrustyCIDRv4, params);
|
|
641
600
|
}
|
|
642
|
-
const
|
|
643
|
-
"
|
|
601
|
+
const KrustyCIDRv6 = /* @__PURE__ */ core.$constructor(
|
|
602
|
+
"KrustyCIDRv6",
|
|
644
603
|
(inst, def) => {
|
|
645
604
|
const coreInit = core.$ZodCIDRv6.init;
|
|
646
605
|
coreInit(inst, def);
|
|
647
|
-
|
|
606
|
+
KrustyStringFormat.init(inst, def);
|
|
648
607
|
}
|
|
649
608
|
);
|
|
650
609
|
function cidrv6(params) {
|
|
651
|
-
return core._cidrv6(
|
|
610
|
+
return core._cidrv6(KrustyCIDRv6, params);
|
|
652
611
|
}
|
|
653
|
-
const
|
|
654
|
-
"
|
|
612
|
+
const KrustyBase64 = /* @__PURE__ */ core.$constructor(
|
|
613
|
+
"KrustyBase64",
|
|
655
614
|
(inst, def) => {
|
|
656
615
|
const coreInit = core.$ZodBase64.init;
|
|
657
616
|
coreInit(inst, def);
|
|
658
|
-
|
|
617
|
+
KrustyStringFormat.init(inst, def);
|
|
659
618
|
}
|
|
660
619
|
);
|
|
661
620
|
function base64(params) {
|
|
662
|
-
return core._base64(
|
|
621
|
+
return core._base64(KrustyBase64, params);
|
|
663
622
|
}
|
|
664
|
-
const
|
|
665
|
-
"
|
|
623
|
+
const KrustyBase64URL = /* @__PURE__ */ core.$constructor(
|
|
624
|
+
"KrustyBase64URL",
|
|
666
625
|
(inst, def) => {
|
|
667
626
|
const coreInit = core.$ZodBase64URL.init;
|
|
668
627
|
coreInit(inst, def);
|
|
669
|
-
|
|
628
|
+
KrustyStringFormat.init(inst, def);
|
|
670
629
|
}
|
|
671
630
|
);
|
|
672
631
|
function base64url(params) {
|
|
673
|
-
return core._base64url(
|
|
632
|
+
return core._base64url(KrustyBase64URL, params);
|
|
674
633
|
}
|
|
675
|
-
const
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
634
|
+
const KrustyE164 = /* @__PURE__ */ core.$constructor(
|
|
635
|
+
"KrustyE164",
|
|
636
|
+
(inst, def) => {
|
|
637
|
+
const coreInit = core.$ZodE164.init;
|
|
638
|
+
coreInit(inst, def);
|
|
639
|
+
KrustyStringFormat.init(inst, def);
|
|
640
|
+
}
|
|
641
|
+
);
|
|
680
642
|
function e164(params) {
|
|
681
|
-
return core._e164(
|
|
643
|
+
return core._e164(KrustyE164, params);
|
|
682
644
|
}
|
|
683
|
-
const
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
645
|
+
const KrustyJWT = /* @__PURE__ */ core.$constructor(
|
|
646
|
+
"KrustyJWT",
|
|
647
|
+
(inst, def) => {
|
|
648
|
+
const coreInit = core.$ZodJWT.init;
|
|
649
|
+
coreInit(inst, def);
|
|
650
|
+
KrustyStringFormat.init(inst, def);
|
|
651
|
+
}
|
|
652
|
+
);
|
|
688
653
|
function jwt(params) {
|
|
689
|
-
return core._jwt(
|
|
654
|
+
return core._jwt(KrustyJWT, params);
|
|
690
655
|
}
|
|
691
|
-
const
|
|
656
|
+
const KrustyCustomStringFormat = /* @__PURE__ */ core.$constructor("KrustyCustomStringFormat", (inst, def) => {
|
|
692
657
|
const coreInit = core.$ZodCustomStringFormat.init;
|
|
693
658
|
coreInit(inst, def);
|
|
694
|
-
|
|
659
|
+
KrustyStringFormat.init(inst, def);
|
|
695
660
|
});
|
|
696
661
|
function stringFormat(format, fnOrRegex, _params = {}) {
|
|
697
|
-
return core._stringFormat(
|
|
662
|
+
return core._stringFormat(KrustyCustomStringFormat, format, fnOrRegex, _params);
|
|
698
663
|
}
|
|
699
664
|
function hostname(_params) {
|
|
700
|
-
return core._stringFormat(
|
|
665
|
+
return core._stringFormat(KrustyCustomStringFormat, "hostname", core.regexes.hostname, _params);
|
|
701
666
|
}
|
|
702
667
|
function hex(_params) {
|
|
703
|
-
return core._stringFormat(
|
|
668
|
+
return core._stringFormat(KrustyCustomStringFormat, "hex", core.regexes.hex, _params);
|
|
704
669
|
}
|
|
705
670
|
function hash(alg, params) {
|
|
706
671
|
const enc = params?.enc ?? "hex";
|
|
707
672
|
const format = `${alg}_${enc}`;
|
|
708
673
|
const regex = core.regexes[format];
|
|
709
674
|
if (!regex) throw new Error(`Unrecognized hash format: ${format}`);
|
|
710
|
-
return core._stringFormat(
|
|
675
|
+
return core._stringFormat(KrustyCustomStringFormat, format, regex, params);
|
|
711
676
|
}
|
|
712
|
-
const
|
|
713
|
-
"
|
|
677
|
+
const KrustyNumber = /* @__PURE__ */ core.$constructor(
|
|
678
|
+
"KrustyNumber",
|
|
714
679
|
(inst, def) => {
|
|
715
680
|
const coreInit = core.$ZodNumber.init;
|
|
716
681
|
coreInit(inst, def);
|
|
@@ -739,33 +704,33 @@ const ZodNumber = /* @__PURE__ */ core.$constructor(
|
|
|
739
704
|
}
|
|
740
705
|
);
|
|
741
706
|
function number(params) {
|
|
742
|
-
return core._number(
|
|
707
|
+
return core._number(KrustyNumber, params);
|
|
743
708
|
}
|
|
744
|
-
const
|
|
745
|
-
"
|
|
709
|
+
const KrustyNumberFormat = /* @__PURE__ */ core.$constructor(
|
|
710
|
+
"KrustyNumberFormat",
|
|
746
711
|
(inst, def) => {
|
|
747
712
|
const coreInit = core.$ZodNumberFormat.init;
|
|
748
713
|
coreInit(inst, def);
|
|
749
|
-
|
|
714
|
+
KrustyNumber.init(inst, def);
|
|
750
715
|
}
|
|
751
716
|
);
|
|
752
717
|
function int(params) {
|
|
753
|
-
return core._int(
|
|
718
|
+
return core._int(KrustyNumberFormat, params);
|
|
754
719
|
}
|
|
755
720
|
function float32(params) {
|
|
756
|
-
return core._float32(
|
|
721
|
+
return core._float32(KrustyNumberFormat, params);
|
|
757
722
|
}
|
|
758
723
|
function float64(params) {
|
|
759
|
-
return core._float64(
|
|
724
|
+
return core._float64(KrustyNumberFormat, params);
|
|
760
725
|
}
|
|
761
726
|
function int32(params) {
|
|
762
|
-
return core._int32(
|
|
727
|
+
return core._int32(KrustyNumberFormat, params);
|
|
763
728
|
}
|
|
764
729
|
function uint32(params) {
|
|
765
|
-
return core._uint32(
|
|
730
|
+
return core._uint32(KrustyNumberFormat, params);
|
|
766
731
|
}
|
|
767
|
-
const
|
|
768
|
-
"
|
|
732
|
+
const KrustyBoolean = /* @__PURE__ */ core.$constructor(
|
|
733
|
+
"KrustyBoolean",
|
|
769
734
|
(inst, def) => {
|
|
770
735
|
const coreInit = core.$ZodBoolean.init;
|
|
771
736
|
coreInit(inst, def);
|
|
@@ -773,10 +738,10 @@ const ZodBoolean = /* @__PURE__ */ core.$constructor(
|
|
|
773
738
|
}
|
|
774
739
|
);
|
|
775
740
|
function boolean(params) {
|
|
776
|
-
return core._boolean(
|
|
741
|
+
return core._boolean(KrustyBoolean, params);
|
|
777
742
|
}
|
|
778
|
-
const
|
|
779
|
-
"
|
|
743
|
+
const KrustyBigInt = /* @__PURE__ */ core.$constructor(
|
|
744
|
+
"KrustyBigInt",
|
|
780
745
|
(inst, def) => {
|
|
781
746
|
const coreInit = core.$ZodBigInt.init;
|
|
782
747
|
coreInit(inst, def);
|
|
@@ -801,24 +766,24 @@ const ZodBigInt = /* @__PURE__ */ core.$constructor(
|
|
|
801
766
|
}
|
|
802
767
|
);
|
|
803
768
|
function bigint(params) {
|
|
804
|
-
return core._bigint(
|
|
769
|
+
return core._bigint(KrustyBigInt, params);
|
|
805
770
|
}
|
|
806
|
-
const
|
|
807
|
-
"
|
|
771
|
+
const KrustyBigIntFormat = /* @__PURE__ */ core.$constructor(
|
|
772
|
+
"KrustyBigIntFormat",
|
|
808
773
|
(inst, def) => {
|
|
809
774
|
const coreInit = core.$ZodBigIntFormat.init;
|
|
810
775
|
coreInit(inst, def);
|
|
811
|
-
|
|
776
|
+
KrustyBigInt.init(inst, def);
|
|
812
777
|
}
|
|
813
778
|
);
|
|
814
779
|
function int64(params) {
|
|
815
|
-
return core._int64(
|
|
780
|
+
return core._int64(KrustyBigIntFormat, params);
|
|
816
781
|
}
|
|
817
782
|
function uint64(params) {
|
|
818
|
-
return core._uint64(
|
|
783
|
+
return core._uint64(KrustyBigIntFormat, params);
|
|
819
784
|
}
|
|
820
|
-
const
|
|
821
|
-
"
|
|
785
|
+
const KrustySymbol = /* @__PURE__ */ core.$constructor(
|
|
786
|
+
"KrustySymbol",
|
|
822
787
|
(inst, def) => {
|
|
823
788
|
const coreInit = core.$ZodSymbol.init;
|
|
824
789
|
coreInit(inst, def);
|
|
@@ -826,10 +791,10 @@ const ZodSymbol = /* @__PURE__ */ core.$constructor(
|
|
|
826
791
|
}
|
|
827
792
|
);
|
|
828
793
|
function symbol(params) {
|
|
829
|
-
return core._symbol(
|
|
794
|
+
return core._symbol(KrustySymbol, params);
|
|
830
795
|
}
|
|
831
|
-
const
|
|
832
|
-
"
|
|
796
|
+
const KrustyUndefined = /* @__PURE__ */ core.$constructor(
|
|
797
|
+
"KrustyUndefined",
|
|
833
798
|
(inst, def) => {
|
|
834
799
|
const coreInit = core.$ZodUndefined.init;
|
|
835
800
|
coreInit(inst, def);
|
|
@@ -837,26 +802,32 @@ const ZodUndefined = /* @__PURE__ */ core.$constructor(
|
|
|
837
802
|
}
|
|
838
803
|
);
|
|
839
804
|
function _undefined(params) {
|
|
840
|
-
return core._undefined(
|
|
805
|
+
return core._undefined(KrustyUndefined, params);
|
|
841
806
|
}
|
|
842
|
-
const
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
807
|
+
const KrustyNull = /* @__PURE__ */ core.$constructor(
|
|
808
|
+
"KrustyNull",
|
|
809
|
+
(inst, def) => {
|
|
810
|
+
const coreInit = core.$ZodNull.init;
|
|
811
|
+
coreInit(inst, def);
|
|
812
|
+
KrustyType.init(inst, def);
|
|
813
|
+
}
|
|
814
|
+
);
|
|
847
815
|
function _null(params) {
|
|
848
|
-
return core._null(
|
|
816
|
+
return core._null(KrustyNull, params);
|
|
849
817
|
}
|
|
850
|
-
const
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
818
|
+
const KrustyAny = /* @__PURE__ */ core.$constructor(
|
|
819
|
+
"KrustyAny",
|
|
820
|
+
(inst, def) => {
|
|
821
|
+
const coreInit = core.$ZodAny.init;
|
|
822
|
+
coreInit(inst, def);
|
|
823
|
+
KrustyType.init(inst, def);
|
|
824
|
+
}
|
|
825
|
+
);
|
|
855
826
|
function any() {
|
|
856
|
-
return core._any(
|
|
827
|
+
return core._any(KrustyAny);
|
|
857
828
|
}
|
|
858
|
-
const
|
|
859
|
-
"
|
|
829
|
+
const KrustyUnknown = /* @__PURE__ */ core.$constructor(
|
|
830
|
+
"KrustyUnknown",
|
|
860
831
|
(inst, def) => {
|
|
861
832
|
const coreInit = core.$ZodUnknown.init;
|
|
862
833
|
coreInit(inst, def);
|
|
@@ -864,10 +835,10 @@ const ZodUnknown = /* @__PURE__ */ core.$constructor(
|
|
|
864
835
|
}
|
|
865
836
|
);
|
|
866
837
|
function unknown() {
|
|
867
|
-
return core._unknown(
|
|
838
|
+
return core._unknown(KrustyUnknown);
|
|
868
839
|
}
|
|
869
|
-
const
|
|
870
|
-
"
|
|
840
|
+
const KrustyNever = /* @__PURE__ */ core.$constructor(
|
|
841
|
+
"KrustyNever",
|
|
871
842
|
(inst, def) => {
|
|
872
843
|
const coreInit = core.$ZodNever.init;
|
|
873
844
|
coreInit(inst, def);
|
|
@@ -875,31 +846,37 @@ const ZodNever = /* @__PURE__ */ core.$constructor(
|
|
|
875
846
|
}
|
|
876
847
|
);
|
|
877
848
|
function never(params) {
|
|
878
|
-
return core._never(
|
|
849
|
+
return core._never(KrustyNever, params);
|
|
879
850
|
}
|
|
880
|
-
const
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
851
|
+
const KrustyVoid = /* @__PURE__ */ core.$constructor(
|
|
852
|
+
"KrustyVoid",
|
|
853
|
+
(inst, def) => {
|
|
854
|
+
const coreInit = core.$ZodVoid.init;
|
|
855
|
+
coreInit(inst, def);
|
|
856
|
+
KrustyType.init(inst, def);
|
|
857
|
+
}
|
|
858
|
+
);
|
|
885
859
|
function _void(params) {
|
|
886
|
-
return core._void(
|
|
860
|
+
return core._void(KrustyVoid, params);
|
|
887
861
|
}
|
|
888
|
-
const
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
862
|
+
const KrustyDate = /* @__PURE__ */ core.$constructor(
|
|
863
|
+
"KrustyDate",
|
|
864
|
+
(inst, def) => {
|
|
865
|
+
const coreInit = core.$ZodDate.init;
|
|
866
|
+
coreInit(inst, def);
|
|
867
|
+
KrustyType.init(inst, def);
|
|
868
|
+
inst.min = (value, params) => inst.check(_gte(value, params));
|
|
869
|
+
inst.max = (value, params) => inst.check(_lte(value, params));
|
|
870
|
+
const c = inst._zod.bag;
|
|
871
|
+
inst.minDate = c.minimum ? new Date(c.minimum) : null;
|
|
872
|
+
inst.maxDate = c.maximum ? new Date(c.maximum) : null;
|
|
873
|
+
}
|
|
874
|
+
);
|
|
898
875
|
function date(params) {
|
|
899
|
-
return core._date(
|
|
876
|
+
return core._date(KrustyDate, params);
|
|
900
877
|
}
|
|
901
|
-
const
|
|
902
|
-
"
|
|
878
|
+
const KrustyArray = /* @__PURE__ */ core.$constructor(
|
|
879
|
+
"KrustyArray",
|
|
903
880
|
(inst, def) => {
|
|
904
881
|
const coreInit = core.$ZodArray.init;
|
|
905
882
|
coreInit(inst, def);
|
|
@@ -913,14 +890,14 @@ const ZodArray = /* @__PURE__ */ core.$constructor(
|
|
|
913
890
|
}
|
|
914
891
|
);
|
|
915
892
|
function array(element, params) {
|
|
916
|
-
return core._array(
|
|
893
|
+
return core._array(KrustyArray, element, params);
|
|
917
894
|
}
|
|
918
895
|
function keyof(schema) {
|
|
919
896
|
const shape = schema._zod.def.shape;
|
|
920
897
|
return _enum(Object.keys(shape));
|
|
921
898
|
}
|
|
922
|
-
const
|
|
923
|
-
"
|
|
899
|
+
const KrustyIntersection = /* @__PURE__ */ core.$constructor(
|
|
900
|
+
"KrustyIntersection",
|
|
924
901
|
(inst, def) => {
|
|
925
902
|
const coreInit = core.$ZodIntersection.init;
|
|
926
903
|
coreInit(inst, def);
|
|
@@ -928,14 +905,14 @@ const ZodIntersection = /* @__PURE__ */ core.$constructor(
|
|
|
928
905
|
}
|
|
929
906
|
);
|
|
930
907
|
function intersection(left, right) {
|
|
931
|
-
return new
|
|
908
|
+
return new KrustyIntersection({
|
|
932
909
|
type: "intersection",
|
|
933
910
|
left,
|
|
934
911
|
right
|
|
935
912
|
});
|
|
936
913
|
}
|
|
937
|
-
const
|
|
938
|
-
"
|
|
914
|
+
const KrustyTuple = /* @__PURE__ */ core.$constructor(
|
|
915
|
+
"KrustyTuple",
|
|
939
916
|
(inst, def) => {
|
|
940
917
|
const coreInit = core.$ZodTuple.init;
|
|
941
918
|
coreInit(inst, def);
|
|
@@ -950,15 +927,15 @@ function tuple(items, _paramsOrRest, _params) {
|
|
|
950
927
|
const hasRest = _paramsOrRest instanceof core.$ZodType;
|
|
951
928
|
const params = hasRest ? _params : _paramsOrRest;
|
|
952
929
|
const rest = hasRest ? _paramsOrRest : null;
|
|
953
|
-
return new
|
|
930
|
+
return new KrustyTuple({
|
|
954
931
|
type: "tuple",
|
|
955
932
|
items,
|
|
956
933
|
rest,
|
|
957
934
|
...util.normalizeParams(params)
|
|
958
935
|
});
|
|
959
936
|
}
|
|
960
|
-
const
|
|
961
|
-
"
|
|
937
|
+
const KrustyRecord = /* @__PURE__ */ core.$constructor(
|
|
938
|
+
"KrustyRecord",
|
|
962
939
|
(inst, def) => {
|
|
963
940
|
const coreInit = core.$ZodRecord.init;
|
|
964
941
|
coreInit(inst, def);
|
|
@@ -968,7 +945,7 @@ const ZodRecord = /* @__PURE__ */ core.$constructor(
|
|
|
968
945
|
}
|
|
969
946
|
);
|
|
970
947
|
function record(keyType, valueType, params) {
|
|
971
|
-
return new
|
|
948
|
+
return new KrustyRecord({
|
|
972
949
|
type: "record",
|
|
973
950
|
keyType,
|
|
974
951
|
valueType,
|
|
@@ -978,97 +955,106 @@ function record(keyType, valueType, params) {
|
|
|
978
955
|
function partialRecord(keyType, valueType, params) {
|
|
979
956
|
const k = core.clone(keyType);
|
|
980
957
|
k._zod.values = void 0;
|
|
981
|
-
return new
|
|
958
|
+
return new KrustyRecord({
|
|
982
959
|
type: "record",
|
|
983
960
|
keyType: k,
|
|
984
961
|
valueType,
|
|
985
962
|
...util.normalizeParams(params)
|
|
986
963
|
});
|
|
987
964
|
}
|
|
988
|
-
const
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
965
|
+
const KrustyMap = /* @__PURE__ */ core.$constructor(
|
|
966
|
+
"KrustyMap",
|
|
967
|
+
(inst, def) => {
|
|
968
|
+
const coreInit = core.$ZodMap.init;
|
|
969
|
+
coreInit(inst, def);
|
|
970
|
+
KrustyType.init(inst, def);
|
|
971
|
+
inst.keyType = def.keyType;
|
|
972
|
+
inst.valueType = def.valueType;
|
|
973
|
+
}
|
|
974
|
+
);
|
|
995
975
|
function map(keyType, valueType, params) {
|
|
996
|
-
return new
|
|
976
|
+
return new KrustyMap({
|
|
997
977
|
type: "map",
|
|
998
978
|
keyType,
|
|
999
979
|
valueType,
|
|
1000
980
|
...util.normalizeParams(params)
|
|
1001
981
|
});
|
|
1002
982
|
}
|
|
1003
|
-
const
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
983
|
+
const KrustySet = /* @__PURE__ */ core.$constructor(
|
|
984
|
+
"KrustySet",
|
|
985
|
+
(inst, def) => {
|
|
986
|
+
const coreInit = core.$ZodSet.init;
|
|
987
|
+
coreInit(inst, def);
|
|
988
|
+
KrustyType.init(inst, def);
|
|
989
|
+
inst.min = (...args) => inst.check(core._minSize(...args));
|
|
990
|
+
inst.nonempty = (params) => inst.check(core._minSize(1, params));
|
|
991
|
+
inst.max = (...args) => inst.check(core._maxSize(...args));
|
|
992
|
+
inst.size = (...args) => inst.check(core._size(...args));
|
|
993
|
+
}
|
|
994
|
+
);
|
|
1012
995
|
function set(valueType, params) {
|
|
1013
|
-
return new
|
|
996
|
+
return new KrustySet({
|
|
1014
997
|
type: "set",
|
|
1015
998
|
valueType,
|
|
1016
999
|
...util.normalizeParams(params)
|
|
1017
1000
|
});
|
|
1018
1001
|
}
|
|
1019
|
-
const
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
const
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
});
|
|
1002
|
+
const KrustyEnum = /* @__PURE__ */ core.$constructor(
|
|
1003
|
+
"KrustyEnum",
|
|
1004
|
+
(inst, def) => {
|
|
1005
|
+
const coreInit = core.$ZodEnum.init;
|
|
1006
|
+
coreInit(inst, def);
|
|
1007
|
+
KrustyType.init(inst, def);
|
|
1008
|
+
inst.enum = def.entries;
|
|
1009
|
+
inst.options = Object.values(def.entries);
|
|
1010
|
+
const keys = new Set(Object.keys(def.entries));
|
|
1011
|
+
inst.extract = (values, params) => {
|
|
1012
|
+
const newEntries = {};
|
|
1013
|
+
for (const value of values) {
|
|
1014
|
+
if (keys.has(value)) {
|
|
1015
|
+
newEntries[value] = def.entries[value];
|
|
1016
|
+
} else throw new Error(`Key ${value} not found in enum`);
|
|
1017
|
+
}
|
|
1018
|
+
return new KrustyEnum({
|
|
1019
|
+
...def,
|
|
1020
|
+
checks: [],
|
|
1021
|
+
...util.normalizeParams(params),
|
|
1022
|
+
entries: newEntries
|
|
1023
|
+
});
|
|
1024
|
+
};
|
|
1025
|
+
inst.exclude = (values, params) => {
|
|
1026
|
+
const newEntries = { ...def.entries };
|
|
1027
|
+
for (const value of values) {
|
|
1028
|
+
if (keys.has(value)) {
|
|
1029
|
+
delete newEntries[value];
|
|
1030
|
+
} else throw new Error(`Key ${value} not found in enum`);
|
|
1031
|
+
}
|
|
1032
|
+
return new KrustyEnum({
|
|
1033
|
+
...def,
|
|
1034
|
+
checks: [],
|
|
1035
|
+
...util.normalizeParams(params),
|
|
1036
|
+
entries: newEntries
|
|
1037
|
+
});
|
|
1038
|
+
};
|
|
1039
|
+
}
|
|
1040
|
+
);
|
|
1055
1041
|
function _enum(values, params) {
|
|
1056
1042
|
const entries = Array.isArray(values) ? Object.fromEntries(values.map((v) => [v, v])) : values;
|
|
1057
|
-
return new
|
|
1043
|
+
return new KrustyEnum({
|
|
1058
1044
|
type: "enum",
|
|
1059
1045
|
entries,
|
|
1060
1046
|
...util.normalizeParams(params)
|
|
1061
1047
|
});
|
|
1062
1048
|
}
|
|
1063
1049
|
function nativeEnum(entries, params) {
|
|
1064
|
-
return new
|
|
1050
|
+
return new KrustyEnum({
|
|
1065
1051
|
type: "enum",
|
|
1066
1052
|
entries,
|
|
1067
1053
|
...util.normalizeParams(params)
|
|
1068
1054
|
});
|
|
1069
1055
|
}
|
|
1070
|
-
const
|
|
1071
|
-
"
|
|
1056
|
+
const KrustyLiteral = /* @__PURE__ */ core.$constructor(
|
|
1057
|
+
"KrustyLiteral",
|
|
1072
1058
|
(inst, def) => {
|
|
1073
1059
|
const coreInit = core.$ZodLiteral.init;
|
|
1074
1060
|
coreInit(inst, def);
|
|
@@ -1085,25 +1071,28 @@ const ZodLiteral = /* @__PURE__ */ core.$constructor(
|
|
|
1085
1071
|
}
|
|
1086
1072
|
);
|
|
1087
1073
|
function literal(value, params) {
|
|
1088
|
-
return new
|
|
1074
|
+
return new KrustyLiteral({
|
|
1089
1075
|
type: "literal",
|
|
1090
1076
|
values: Array.isArray(value) ? value : [value],
|
|
1091
1077
|
...util.normalizeParams(params)
|
|
1092
1078
|
});
|
|
1093
1079
|
}
|
|
1094
|
-
const
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1080
|
+
const KrustyFile = /* @__PURE__ */ core.$constructor(
|
|
1081
|
+
"KrustyFile",
|
|
1082
|
+
(inst, def) => {
|
|
1083
|
+
const coreInit = core.$ZodFile.init;
|
|
1084
|
+
coreInit(inst, def);
|
|
1085
|
+
KrustyType.init(inst, def);
|
|
1086
|
+
inst.min = (size, params) => inst.check(core._minSize(size, params));
|
|
1087
|
+
inst.max = (size, params) => inst.check(core._maxSize(size, params));
|
|
1088
|
+
inst.mime = (types, params) => inst.check(core._mime(Array.isArray(types) ? types : [types], params));
|
|
1089
|
+
}
|
|
1090
|
+
);
|
|
1102
1091
|
function file(params) {
|
|
1103
|
-
return core._file(
|
|
1092
|
+
return core._file(KrustyFile, params);
|
|
1104
1093
|
}
|
|
1105
|
-
const
|
|
1106
|
-
"
|
|
1094
|
+
const KrustyTransform = /* @__PURE__ */ core.$constructor(
|
|
1095
|
+
"KrustyTransform",
|
|
1107
1096
|
(inst, def) => {
|
|
1108
1097
|
const coreInit = core.$ZodTransform.init;
|
|
1109
1098
|
coreInit(inst, def);
|
|
@@ -1137,13 +1126,13 @@ const ZodTransform = /* @__PURE__ */ core.$constructor(
|
|
|
1137
1126
|
}
|
|
1138
1127
|
);
|
|
1139
1128
|
function transform(fn) {
|
|
1140
|
-
return new
|
|
1129
|
+
return new KrustyTransform({
|
|
1141
1130
|
type: "transform",
|
|
1142
1131
|
transform: fn
|
|
1143
1132
|
});
|
|
1144
1133
|
}
|
|
1145
|
-
const
|
|
1146
|
-
"
|
|
1134
|
+
const KrustyOptional = /* @__PURE__ */ core.$constructor(
|
|
1135
|
+
"KrustyOptional",
|
|
1147
1136
|
(inst, def) => {
|
|
1148
1137
|
const coreInit = core.$ZodOptional.init;
|
|
1149
1138
|
coreInit(inst, def);
|
|
@@ -1152,13 +1141,13 @@ const ZodOptional = /* @__PURE__ */ core.$constructor(
|
|
|
1152
1141
|
}
|
|
1153
1142
|
);
|
|
1154
1143
|
function optional(innerType) {
|
|
1155
|
-
return new
|
|
1144
|
+
return new KrustyOptional({
|
|
1156
1145
|
type: "optional",
|
|
1157
1146
|
innerType
|
|
1158
1147
|
});
|
|
1159
1148
|
}
|
|
1160
|
-
const
|
|
1161
|
-
"
|
|
1149
|
+
const KrustyNullable = /* @__PURE__ */ core.$constructor(
|
|
1150
|
+
"KrustyNullable",
|
|
1162
1151
|
(inst, def) => {
|
|
1163
1152
|
const coreInit = core.$ZodNullable.init;
|
|
1164
1153
|
coreInit(inst, def);
|
|
@@ -1167,7 +1156,7 @@ const ZodNullable = /* @__PURE__ */ core.$constructor(
|
|
|
1167
1156
|
}
|
|
1168
1157
|
);
|
|
1169
1158
|
function nullable(innerType) {
|
|
1170
|
-
return new
|
|
1159
|
+
return new KrustyNullable({
|
|
1171
1160
|
type: "nullable",
|
|
1172
1161
|
innerType
|
|
1173
1162
|
});
|
|
@@ -1175,8 +1164,8 @@ function nullable(innerType) {
|
|
|
1175
1164
|
function nullish(innerType) {
|
|
1176
1165
|
return optional(nullable(innerType));
|
|
1177
1166
|
}
|
|
1178
|
-
const
|
|
1179
|
-
"
|
|
1167
|
+
const KrustyDefault = /* @__PURE__ */ core.$constructor(
|
|
1168
|
+
"KrustyDefault",
|
|
1180
1169
|
(inst, def) => {
|
|
1181
1170
|
const coreInit = core.$ZodDefault.init;
|
|
1182
1171
|
coreInit(inst, def);
|
|
@@ -1186,7 +1175,7 @@ const ZodDefault = /* @__PURE__ */ core.$constructor(
|
|
|
1186
1175
|
}
|
|
1187
1176
|
);
|
|
1188
1177
|
function _default(innerType, defaultValue) {
|
|
1189
|
-
return new
|
|
1178
|
+
return new KrustyDefault({
|
|
1190
1179
|
type: "default",
|
|
1191
1180
|
innerType,
|
|
1192
1181
|
get defaultValue() {
|
|
@@ -1194,8 +1183,8 @@ function _default(innerType, defaultValue) {
|
|
|
1194
1183
|
}
|
|
1195
1184
|
});
|
|
1196
1185
|
}
|
|
1197
|
-
const
|
|
1198
|
-
"
|
|
1186
|
+
const KrustyPrefault = /* @__PURE__ */ core.$constructor(
|
|
1187
|
+
"KrustyPrefault",
|
|
1199
1188
|
(inst, def) => {
|
|
1200
1189
|
const coreInit = core.$ZodPrefault.init;
|
|
1201
1190
|
coreInit(inst, def);
|
|
@@ -1204,7 +1193,7 @@ const ZodPrefault = /* @__PURE__ */ core.$constructor(
|
|
|
1204
1193
|
}
|
|
1205
1194
|
);
|
|
1206
1195
|
function prefault(innerType, defaultValue) {
|
|
1207
|
-
return new
|
|
1196
|
+
return new KrustyPrefault({
|
|
1208
1197
|
type: "prefault",
|
|
1209
1198
|
innerType,
|
|
1210
1199
|
get defaultValue() {
|
|
@@ -1212,8 +1201,8 @@ function prefault(innerType, defaultValue) {
|
|
|
1212
1201
|
}
|
|
1213
1202
|
});
|
|
1214
1203
|
}
|
|
1215
|
-
const
|
|
1216
|
-
"
|
|
1204
|
+
const KrustyNonOptional = /* @__PURE__ */ core.$constructor(
|
|
1205
|
+
"KrustyNonOptional",
|
|
1217
1206
|
(inst, def) => {
|
|
1218
1207
|
const coreInit = core.$ZodNonOptional.init;
|
|
1219
1208
|
coreInit(inst, def);
|
|
@@ -1222,14 +1211,14 @@ const ZodNonOptional = /* @__PURE__ */ core.$constructor(
|
|
|
1222
1211
|
}
|
|
1223
1212
|
);
|
|
1224
1213
|
function nonoptional(innerType, params) {
|
|
1225
|
-
return new
|
|
1214
|
+
return new KrustyNonOptional({
|
|
1226
1215
|
type: "nonoptional",
|
|
1227
1216
|
innerType,
|
|
1228
1217
|
...util.normalizeParams(params)
|
|
1229
1218
|
});
|
|
1230
1219
|
}
|
|
1231
|
-
const
|
|
1232
|
-
"
|
|
1220
|
+
const KrustySuccess = /* @__PURE__ */ core.$constructor(
|
|
1221
|
+
"KrustySuccess",
|
|
1233
1222
|
(inst, def) => {
|
|
1234
1223
|
const coreInit = core.$ZodSuccess.init;
|
|
1235
1224
|
coreInit(inst, def);
|
|
@@ -1238,13 +1227,13 @@ const ZodSuccess = /* @__PURE__ */ core.$constructor(
|
|
|
1238
1227
|
}
|
|
1239
1228
|
);
|
|
1240
1229
|
function success(innerType) {
|
|
1241
|
-
return new
|
|
1230
|
+
return new KrustySuccess({
|
|
1242
1231
|
type: "success",
|
|
1243
1232
|
innerType
|
|
1244
1233
|
});
|
|
1245
1234
|
}
|
|
1246
|
-
const
|
|
1247
|
-
"
|
|
1235
|
+
const KrustyCatch = /* @__PURE__ */ core.$constructor(
|
|
1236
|
+
"KrustyCatch",
|
|
1248
1237
|
(inst, def) => {
|
|
1249
1238
|
const coreInit = core.$ZodCatch.init;
|
|
1250
1239
|
coreInit(inst, def);
|
|
@@ -1254,45 +1243,51 @@ const ZodCatch = /* @__PURE__ */ core.$constructor(
|
|
|
1254
1243
|
}
|
|
1255
1244
|
);
|
|
1256
1245
|
function _catch(innerType, catchValue) {
|
|
1257
|
-
return new
|
|
1246
|
+
return new KrustyCatch({
|
|
1258
1247
|
type: "catch",
|
|
1259
1248
|
innerType,
|
|
1260
1249
|
catchValue: typeof catchValue === "function" ? catchValue : () => catchValue
|
|
1261
1250
|
});
|
|
1262
1251
|
}
|
|
1263
|
-
const
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1252
|
+
const KrustyNaN = /* @__PURE__ */ core.$constructor(
|
|
1253
|
+
"KrustyNaN",
|
|
1254
|
+
(inst, def) => {
|
|
1255
|
+
const coreInit = core.$ZodNaN.init;
|
|
1256
|
+
coreInit(inst, def);
|
|
1257
|
+
KrustyType.init(inst, def);
|
|
1258
|
+
}
|
|
1259
|
+
);
|
|
1268
1260
|
function nan(params) {
|
|
1269
|
-
return core._nan(
|
|
1261
|
+
return core._nan(KrustyNaN, params);
|
|
1270
1262
|
}
|
|
1271
|
-
const
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1263
|
+
const KrustyPipe = /* @__PURE__ */ core.$constructor(
|
|
1264
|
+
"KrustyPipe",
|
|
1265
|
+
(inst, def) => {
|
|
1266
|
+
const coreInit = core.$ZodPipe.init;
|
|
1267
|
+
coreInit(inst, def);
|
|
1268
|
+
KrustyType.init(inst, def);
|
|
1269
|
+
inst.in = def.in;
|
|
1270
|
+
inst.out = def.out;
|
|
1271
|
+
}
|
|
1272
|
+
);
|
|
1278
1273
|
function pipe(in_, out) {
|
|
1279
|
-
return new
|
|
1274
|
+
return new KrustyPipe({
|
|
1280
1275
|
type: "pipe",
|
|
1281
1276
|
in: in_,
|
|
1282
1277
|
out
|
|
1283
1278
|
// ...util.normalizeParams(params),
|
|
1284
1279
|
});
|
|
1285
1280
|
}
|
|
1286
|
-
const
|
|
1287
|
-
"
|
|
1281
|
+
const KrustyCodec = /* @__PURE__ */ core.$constructor(
|
|
1282
|
+
"KrustyCodec",
|
|
1288
1283
|
(inst, def) => {
|
|
1289
|
-
|
|
1284
|
+
KrustyPipe.init(inst, def);
|
|
1290
1285
|
const coreInit = core.$ZodCodec.init;
|
|
1291
1286
|
coreInit(inst, def);
|
|
1292
1287
|
}
|
|
1293
1288
|
);
|
|
1294
1289
|
function codec(in_, out, params) {
|
|
1295
|
-
return new
|
|
1290
|
+
return new KrustyCodec({
|
|
1296
1291
|
type: "pipe",
|
|
1297
1292
|
in: in_,
|
|
1298
1293
|
out,
|
|
@@ -1300,8 +1295,8 @@ function codec(in_, out, params) {
|
|
|
1300
1295
|
reverseTransform: params.encode
|
|
1301
1296
|
});
|
|
1302
1297
|
}
|
|
1303
|
-
const
|
|
1304
|
-
"
|
|
1298
|
+
const KrustyReadonly = /* @__PURE__ */ core.$constructor(
|
|
1299
|
+
"KrustyReadonly",
|
|
1305
1300
|
(inst, def) => {
|
|
1306
1301
|
const coreInit = core.$ZodReadonly.init;
|
|
1307
1302
|
coreInit(inst, def);
|
|
@@ -1310,40 +1305,40 @@ const ZodReadonly = /* @__PURE__ */ core.$constructor(
|
|
|
1310
1305
|
}
|
|
1311
1306
|
);
|
|
1312
1307
|
function readonly(innerType) {
|
|
1313
|
-
return new
|
|
1308
|
+
return new KrustyReadonly({
|
|
1314
1309
|
type: "readonly",
|
|
1315
1310
|
innerType
|
|
1316
1311
|
});
|
|
1317
1312
|
}
|
|
1318
|
-
const
|
|
1319
|
-
|
|
1320
|
-
(inst, def)
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
KrustyType.init(inst, def);
|
|
1324
|
-
}
|
|
1325
|
-
);
|
|
1313
|
+
const KrustyTemplateLiteral = /* @__PURE__ */ core.$constructor("KrustyTemplateLiteral", (inst, def) => {
|
|
1314
|
+
const coreInit = core.$ZodTemplateLiteral.init;
|
|
1315
|
+
coreInit(inst, def);
|
|
1316
|
+
KrustyType.init(inst, def);
|
|
1317
|
+
});
|
|
1326
1318
|
function templateLiteral(parts, params) {
|
|
1327
|
-
return new
|
|
1319
|
+
return new KrustyTemplateLiteral({
|
|
1328
1320
|
type: "template_literal",
|
|
1329
1321
|
parts,
|
|
1330
1322
|
...util.normalizeParams(params)
|
|
1331
1323
|
});
|
|
1332
1324
|
}
|
|
1333
|
-
const
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1325
|
+
const KrustyLazy = /* @__PURE__ */ core.$constructor(
|
|
1326
|
+
"KrustyLazy",
|
|
1327
|
+
(inst, def) => {
|
|
1328
|
+
const coreInit = core.$ZodLazy.init;
|
|
1329
|
+
coreInit(inst, def);
|
|
1330
|
+
KrustyType.init(inst, def);
|
|
1331
|
+
inst.unwrap = () => inst._zod.def.getter();
|
|
1332
|
+
}
|
|
1333
|
+
);
|
|
1339
1334
|
function lazy(getter) {
|
|
1340
|
-
return new
|
|
1335
|
+
return new KrustyLazy({
|
|
1341
1336
|
type: "lazy",
|
|
1342
1337
|
getter
|
|
1343
1338
|
});
|
|
1344
1339
|
}
|
|
1345
|
-
const
|
|
1346
|
-
"
|
|
1340
|
+
const KrustyPromise = /* @__PURE__ */ core.$constructor(
|
|
1341
|
+
"KrustyPromise",
|
|
1347
1342
|
(inst, def) => {
|
|
1348
1343
|
const coreInit = core.$ZodPromise.init;
|
|
1349
1344
|
coreInit(inst, def);
|
|
@@ -1352,13 +1347,13 @@ const ZodPromise = /* @__PURE__ */ core.$constructor(
|
|
|
1352
1347
|
}
|
|
1353
1348
|
);
|
|
1354
1349
|
function promise(innerType) {
|
|
1355
|
-
return new
|
|
1350
|
+
return new KrustyPromise({
|
|
1356
1351
|
type: "promise",
|
|
1357
1352
|
innerType
|
|
1358
1353
|
});
|
|
1359
1354
|
}
|
|
1360
|
-
const
|
|
1361
|
-
"
|
|
1355
|
+
const KrustyFunction = /* @__PURE__ */ core.$constructor(
|
|
1356
|
+
"KrustyFunction",
|
|
1362
1357
|
(inst, def) => {
|
|
1363
1358
|
const coreInit = core.$ZodFunction.init;
|
|
1364
1359
|
coreInit(inst, def);
|
|
@@ -1366,14 +1361,14 @@ const ZodFunction = /* @__PURE__ */ core.$constructor(
|
|
|
1366
1361
|
}
|
|
1367
1362
|
);
|
|
1368
1363
|
function _function(params) {
|
|
1369
|
-
return new
|
|
1364
|
+
return new KrustyFunction({
|
|
1370
1365
|
type: "function",
|
|
1371
1366
|
input: Array.isArray(params?.input) ? tuple(params?.input) : params?.input ?? array(unknown()),
|
|
1372
1367
|
output: params?.output ?? unknown()
|
|
1373
1368
|
});
|
|
1374
1369
|
}
|
|
1375
|
-
const
|
|
1376
|
-
"
|
|
1370
|
+
const KrustyCustom = /* @__PURE__ */ core.$constructor(
|
|
1371
|
+
"KrustyCustom",
|
|
1377
1372
|
(inst, def) => {
|
|
1378
1373
|
const coreInit = core.$ZodCustom.init;
|
|
1379
1374
|
coreInit(inst, def);
|
|
@@ -1389,10 +1384,10 @@ function check(fn) {
|
|
|
1389
1384
|
return ch;
|
|
1390
1385
|
}
|
|
1391
1386
|
function custom(fn, _params) {
|
|
1392
|
-
return core._custom(
|
|
1387
|
+
return core._custom(KrustyCustom, fn ?? (() => true), _params);
|
|
1393
1388
|
}
|
|
1394
1389
|
function refine(fn, _params = {}) {
|
|
1395
|
-
return core._refine(
|
|
1390
|
+
return core._refine(KrustyCustom, fn, _params);
|
|
1396
1391
|
}
|
|
1397
1392
|
function superRefine(fn) {
|
|
1398
1393
|
return core._superRefine(fn);
|
|
@@ -1400,7 +1395,7 @@ function superRefine(fn) {
|
|
|
1400
1395
|
function _instanceof(cls, params = {
|
|
1401
1396
|
error: `Input not instance of ${cls.name}`
|
|
1402
1397
|
}) {
|
|
1403
|
-
const inst = new
|
|
1398
|
+
const inst = new KrustyCustom({
|
|
1404
1399
|
type: "custom",
|
|
1405
1400
|
check: "custom",
|
|
1406
1401
|
fn: (data) => data instanceof cls,
|
|
@@ -1412,9 +1407,9 @@ function _instanceof(cls, params = {
|
|
|
1412
1407
|
}
|
|
1413
1408
|
const stringbool = (...args) => core._stringbool(
|
|
1414
1409
|
{
|
|
1415
|
-
Codec:
|
|
1416
|
-
Boolean:
|
|
1417
|
-
String:
|
|
1410
|
+
Codec: KrustyCodec,
|
|
1411
|
+
Boolean: KrustyBoolean,
|
|
1412
|
+
String: KrustyString
|
|
1418
1413
|
},
|
|
1419
1414
|
...args
|
|
1420
1415
|
);
|
|
@@ -1431,9 +1426,6 @@ function json(params) {
|
|
|
1431
1426
|
});
|
|
1432
1427
|
return jsonSchema;
|
|
1433
1428
|
}
|
|
1434
|
-
function preprocess(fn, schema) {
|
|
1435
|
-
return pipe(transform(fn), schema);
|
|
1436
|
-
}
|
|
1437
1429
|
|
|
1438
1430
|
class SchemaClass {
|
|
1439
1431
|
string(params) {
|
|
@@ -1553,7 +1545,6 @@ class SchemaClass {
|
|
|
1553
1545
|
*/
|
|
1554
1546
|
/**
|
|
1555
1547
|
* TODO: decide what other helper methods to expose
|
|
1556
|
-
* preprocess
|
|
1557
1548
|
* refine
|
|
1558
1549
|
* superRefine
|
|
1559
1550
|
* custom
|
|
@@ -1571,4 +1562,4 @@ class SchemaClass {
|
|
|
1571
1562
|
*/
|
|
1572
1563
|
}
|
|
1573
1564
|
|
|
1574
|
-
export {
|
|
1565
|
+
export { KrustyAny, KrustyArray, KrustyBase64, KrustyBase64URL, KrustyBigInt, KrustyBigIntFormat, KrustyBoolean, KrustyCIDRv4, KrustyCIDRv6, KrustyCUID, KrustyCUID2, KrustyCatch, KrustyCodec, KrustyCustom, KrustyCustomStringFormat, KrustyDate, KrustyDefault, KrustyDiscriminatedUnion, KrustyE164, KrustyEmail, KrustyEmoji, KrustyEnum, KrustyFile, KrustyFunction, KrustyGUID, KrustyGate, KrustyIPv4, KrustyIPv6, KrustyIntersection, KrustyJWT, KrustyKSUID, KrustyLazy, KrustyLiteral, KrustyMap, KrustyNaN, KrustyNanoID, KrustyNever, KrustyNonOptional, KrustyNull, KrustyNullable, KrustyNumber, KrustyNumberFormat, KrustyObject, KrustyOptional, KrustyPipe, KrustyPrefault, KrustyPromise, KrustyReadonly, KrustyRecord, KrustySet, KrustyString, KrustyStringFormat, KrustySuccess, KrustySymbol, KrustyTemplateLiteral, KrustyTransform, KrustyTuple, KrustyType, KrustyULID, KrustyURL, KrustyUUID, KrustyUndefined, KrustyUnion, KrustyUnknown, KrustyVoid, KrustyXID, SchemaClass, ZodError, ZodRealError, _KrustyString, _default, _function, any, array, base64, base64url, bigint, boolean, _catch as catch, check, cidrv4, cidrv6, codec, cuid, cuid2, custom, date, decode, decodeAsync, discriminatedUnion, e164, email, emoji, encode, encodeAsync, _enum as enum, file, float32, float64, _function as function, gate, gatingContext, guid, hash, hex, hostname, httpUrl, _instanceof as instanceof, int, int32, int64, intersection, ipv4, ipv6, isGateIssue, isGateIssueRaw, json, jwt, keyof, ksuid, lazy, literal, looseObject, map, nan, nanoid, nativeEnum, never, nonoptional, _null as null, nullable, nullish, number, object, optional, parse, parseAsync, partialRecord, pipe, prefault, promise, readonly, record, refine, safeDecode, safeDecodeAsync, safeEncode, safeEncodeAsync, safeParse, safeParseAsync, set, strictObject, string, stringFormat, stringbool, success, superRefine, symbol, templateLiteral, transform, tuple, uint32, uint64, ulid, _undefined as undefined, union, unknown, url, uuid, uuidv4, uuidv6, uuidv7, _void as void, xid };
|