@temporary-name/zod 1.9.3-alpha.b7ce8fb6e9463a26fd2564cb172dc612ae4de52d → 1.9.3-alpha.beffd198e2d5853e3d12fa1517c8c9c06bbe6cee
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 +24 -14
- package/dist/index.d.ts +24 -14
- package/dist/index.mjs +59 -53
- package/package.json +4 -7
package/dist/index.d.mts
CHANGED
|
@@ -79,6 +79,15 @@ interface KrustyGate<T extends core.SomeType = core.$ZodType, K extends KrustyIn
|
|
|
79
79
|
declare const KrustyGate: core.$constructor<KrustyGate>;
|
|
80
80
|
declare function gate<T extends core.SomeType, K extends KrustyInternals>(innerType: T, gateName: K['gateNames']): KrustyGate<T, K>;
|
|
81
81
|
|
|
82
|
+
interface KrustyISODateTime extends KrustyStringFormat {
|
|
83
|
+
_zod: core.$ZodISODateTimeInternals;
|
|
84
|
+
}
|
|
85
|
+
declare const KrustyISODateTime: core.$constructor<KrustyISODateTime>;
|
|
86
|
+
interface KrustyISODate extends KrustyStringFormat {
|
|
87
|
+
_zod: core.$ZodISODateInternals;
|
|
88
|
+
}
|
|
89
|
+
declare const KrustyISODate: core.$constructor<KrustyISODate>;
|
|
90
|
+
|
|
82
91
|
type SafeExtendShape<Base extends core.$ZodShape, Ext extends core.$ZodLooseShape> = {
|
|
83
92
|
[K in keyof Ext]: K extends keyof Base ? core.output<Ext[K]> extends core.output<Base[K]> ? core.input<Ext[K]> extends core.input<Base[K]> ? Ext[K] : never : never : Ext[K];
|
|
84
93
|
};
|
|
@@ -167,6 +176,13 @@ interface KrustyType<out Output = unknown, out Input = unknown, out Internals ex
|
|
|
167
176
|
or<T extends core.SomeType>(option: T): KrustyUnion<[this, T], KInternals>;
|
|
168
177
|
and<T extends core.SomeType>(incoming: T): KrustyIntersection<this, T, KInternals>;
|
|
169
178
|
transform<NewOut>(transform: (arg: core.output<this>, ctx: core.$RefinementCtx<core.output<this>>) => NewOut | Promise<NewOut>): KrustyPipe<this, KrustyTransform<Awaited<NewOut>, core.output<this>>, KInternals>;
|
|
179
|
+
/** Returns a new instance that has been registered in `z.globalRegistry` with the specified description */
|
|
180
|
+
describe(description: string): this;
|
|
181
|
+
description?: string;
|
|
182
|
+
/** Returns the metadata associated with this instance in `z.globalRegistry` */
|
|
183
|
+
meta(): core.$replace<core.GlobalMeta, this> | undefined;
|
|
184
|
+
/** Returns a new instance that has been registered in `z.globalRegistry` with the specified metadata */
|
|
185
|
+
meta(data: core.$replace<core.GlobalMeta, this>): this;
|
|
170
186
|
}
|
|
171
187
|
declare const KrustyType: core.$constructor<_KrustyType>;
|
|
172
188
|
interface _KrustyString<T extends core.$ZodStringInternals<unknown> = core.$ZodStringInternals<unknown>, K extends KrustyInternals = KrustyInternals> extends _KrustyType<T, K> {
|
|
@@ -237,14 +253,6 @@ interface KrustyString<K extends KrustyInternals = KrustyInternals> extends _Kru
|
|
|
237
253
|
cidrv6(params?: string | core.$ZodCheckCIDRv6Params): this;
|
|
238
254
|
/** @deprecated Use `z.e164()` instead. */
|
|
239
255
|
e164(params?: string | core.$ZodCheckE164Params): this;
|
|
240
|
-
/** @deprecated Use `z.iso.datetime()` instead. */
|
|
241
|
-
datetime(params?: string | core.$ZodCheckISODateTimeParams): this;
|
|
242
|
-
/** @deprecated Use `z.iso.date()` instead. */
|
|
243
|
-
date(params?: string | core.$ZodCheckISODateParams): this;
|
|
244
|
-
/** @deprecated Use `z.iso.time()` instead. */
|
|
245
|
-
time(params?: string | core.$ZodCheckISOTimeParams): this;
|
|
246
|
-
/** @deprecated Use `z.iso.duration()` instead. */
|
|
247
|
-
duration(params?: string | core.$ZodCheckISODurationParams): this;
|
|
248
256
|
}
|
|
249
257
|
declare const KrustyString: core.$constructor<KrustyString>;
|
|
250
258
|
declare function string<K extends KrustyInternals = KrustyInternals>(params?: string | core.$ZodStringParams): KrustyString<K>;
|
|
@@ -371,8 +379,6 @@ interface _KrustyNumber<Internals extends core.$ZodNumberInternals = core.$ZodNu
|
|
|
371
379
|
max(value: number, params?: string | core.$ZodCheckLessThanParams): this;
|
|
372
380
|
/** Consider `z.int()` instead. This API is considered *legacy*; it will never be removed but a better alternative exists. */
|
|
373
381
|
int(params?: string | core.$ZodCheckNumberFormatParams): this;
|
|
374
|
-
/** @deprecated This is now identical to `.int()`. Only numbers in the safe integer range are accepted. */
|
|
375
|
-
safe(params?: string | core.$ZodCheckNumberFormatParams): this;
|
|
376
382
|
positive(params?: string | core.$ZodCheckGreaterThanParams): this;
|
|
377
383
|
nonnegative(params?: string | core.$ZodCheckGreaterThanParams): this;
|
|
378
384
|
negative(params?: string | core.$ZodCheckLessThanParams): this;
|
|
@@ -489,7 +495,10 @@ interface _KrustyDate<T extends core.$ZodDateInternals = core.$ZodDateInternals,
|
|
|
489
495
|
interface KrustyDate<K extends KrustyInternals = KrustyInternals> extends _KrustyDate<core.$ZodDateInternals<Date>, K> {
|
|
490
496
|
}
|
|
491
497
|
declare const KrustyDate: core.$constructor<KrustyDate>;
|
|
492
|
-
|
|
498
|
+
type KrustyDateCodec<K extends KrustyInternals = KrustyInternals> = KrustyCodec<KrustyISODate, KrustyDate, K>;
|
|
499
|
+
declare function date<K extends KrustyInternals = KrustyInternals>(params?: string | (core.$ZodDateParams & core.$ZodISODateParams)): KrustyDateCodec<K>;
|
|
500
|
+
type KrustyDateTimeCodec<K extends KrustyInternals = KrustyInternals> = KrustyCodec<KrustyISODateTime, KrustyDate, K>;
|
|
501
|
+
declare function datetime<K extends KrustyInternals = KrustyInternals>(params?: string | (core.$ZodDateParams & core.$ZodISODateTimeParams)): KrustyDateTimeCodec<K>;
|
|
493
502
|
interface KrustyArray<T extends core.SomeType = core.$ZodType, K extends KrustyInternals = KrustyInternals> extends _KrustyType<core.$ZodArrayInternals<T>, K>, core.$ZodArray<T> {
|
|
494
503
|
element: T;
|
|
495
504
|
min(minLength: number, params?: string | core.$ZodCheckMinLengthParams): this;
|
|
@@ -720,7 +729,8 @@ declare class SchemaClass<GateNames extends string = never, K extends KrustyInte
|
|
|
720
729
|
union<const T extends readonly core.SomeType[]>(options: T, params?: string | core.$ZodUnionParams): KrustyUnion<T, K>;
|
|
721
730
|
discriminatedUnion<Types extends readonly [core.$ZodTypeDiscriminable, ...core.$ZodTypeDiscriminable[]], Disc extends string>(discriminator: Disc, options: Types, params?: string | core.$ZodDiscriminatedUnionParams): KrustyDiscriminatedUnion<Types, Disc, K>;
|
|
722
731
|
object<T extends core.$ZodLooseShape = Partial<Record<never, core.SomeType>>>(shape?: T, params?: string | core.$ZodObjectParams): KrustyObject<core.util.Writeable<T>, core.$strip, K>;
|
|
723
|
-
date(params?: string | core.$ZodDateParams):
|
|
732
|
+
date(params?: string | (core.$ZodDateParams & core.$ZodISODateParams)): KrustyDateCodec<K>;
|
|
733
|
+
datetime(params?: string | (core.$ZodDateParams & core.$ZodISODateParams)): KrustyDateTimeCodec<K>;
|
|
724
734
|
any(): KrustyAny<K>;
|
|
725
735
|
unknown(): KrustyUnknown<K>;
|
|
726
736
|
never(params?: string | core.$ZodNeverParams): KrustyNever<K>;
|
|
@@ -728,5 +738,5 @@ declare class SchemaClass<GateNames extends string = never, K extends KrustyInte
|
|
|
728
738
|
json(params?: string | core.$ZodCustomParams): KrustyJSONSchema<K>;
|
|
729
739
|
}
|
|
730
740
|
|
|
731
|
-
export { $ZodGate, 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 };
|
|
732
|
-
export type { $ZodGateDef, $ZodGateInternals, IsGateEnabled, IssueData, KrustyFloat32, KrustyFloat64, KrustyInt, KrustyInt32, KrustyInternals, KrustyJSONSchema, KrustyJSONSchemaInternals, KrustyUInt32, ParseContext, SafeExtendShape, ZodIssue, ZodSafeParseError, ZodSafeParseResult, ZodSafeParseSuccess, _KrustyBigInt, _KrustyBoolean, _KrustyDate, _KrustyNumber, _KrustyType };
|
|
741
|
+
export { $ZodGate, 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, datetime, 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 };
|
|
742
|
+
export type { $ZodGateDef, $ZodGateInternals, IsGateEnabled, IssueData, KrustyDateCodec, KrustyDateTimeCodec, KrustyFloat32, KrustyFloat64, KrustyInt, KrustyInt32, KrustyInternals, KrustyJSONSchema, KrustyJSONSchemaInternals, KrustyUInt32, ParseContext, SafeExtendShape, ZodIssue, ZodSafeParseError, ZodSafeParseResult, ZodSafeParseSuccess, _KrustyBigInt, _KrustyBoolean, _KrustyDate, _KrustyNumber, _KrustyType };
|
package/dist/index.d.ts
CHANGED
|
@@ -79,6 +79,15 @@ interface KrustyGate<T extends core.SomeType = core.$ZodType, K extends KrustyIn
|
|
|
79
79
|
declare const KrustyGate: core.$constructor<KrustyGate>;
|
|
80
80
|
declare function gate<T extends core.SomeType, K extends KrustyInternals>(innerType: T, gateName: K['gateNames']): KrustyGate<T, K>;
|
|
81
81
|
|
|
82
|
+
interface KrustyISODateTime extends KrustyStringFormat {
|
|
83
|
+
_zod: core.$ZodISODateTimeInternals;
|
|
84
|
+
}
|
|
85
|
+
declare const KrustyISODateTime: core.$constructor<KrustyISODateTime>;
|
|
86
|
+
interface KrustyISODate extends KrustyStringFormat {
|
|
87
|
+
_zod: core.$ZodISODateInternals;
|
|
88
|
+
}
|
|
89
|
+
declare const KrustyISODate: core.$constructor<KrustyISODate>;
|
|
90
|
+
|
|
82
91
|
type SafeExtendShape<Base extends core.$ZodShape, Ext extends core.$ZodLooseShape> = {
|
|
83
92
|
[K in keyof Ext]: K extends keyof Base ? core.output<Ext[K]> extends core.output<Base[K]> ? core.input<Ext[K]> extends core.input<Base[K]> ? Ext[K] : never : never : Ext[K];
|
|
84
93
|
};
|
|
@@ -167,6 +176,13 @@ interface KrustyType<out Output = unknown, out Input = unknown, out Internals ex
|
|
|
167
176
|
or<T extends core.SomeType>(option: T): KrustyUnion<[this, T], KInternals>;
|
|
168
177
|
and<T extends core.SomeType>(incoming: T): KrustyIntersection<this, T, KInternals>;
|
|
169
178
|
transform<NewOut>(transform: (arg: core.output<this>, ctx: core.$RefinementCtx<core.output<this>>) => NewOut | Promise<NewOut>): KrustyPipe<this, KrustyTransform<Awaited<NewOut>, core.output<this>>, KInternals>;
|
|
179
|
+
/** Returns a new instance that has been registered in `z.globalRegistry` with the specified description */
|
|
180
|
+
describe(description: string): this;
|
|
181
|
+
description?: string;
|
|
182
|
+
/** Returns the metadata associated with this instance in `z.globalRegistry` */
|
|
183
|
+
meta(): core.$replace<core.GlobalMeta, this> | undefined;
|
|
184
|
+
/** Returns a new instance that has been registered in `z.globalRegistry` with the specified metadata */
|
|
185
|
+
meta(data: core.$replace<core.GlobalMeta, this>): this;
|
|
170
186
|
}
|
|
171
187
|
declare const KrustyType: core.$constructor<_KrustyType>;
|
|
172
188
|
interface _KrustyString<T extends core.$ZodStringInternals<unknown> = core.$ZodStringInternals<unknown>, K extends KrustyInternals = KrustyInternals> extends _KrustyType<T, K> {
|
|
@@ -237,14 +253,6 @@ interface KrustyString<K extends KrustyInternals = KrustyInternals> extends _Kru
|
|
|
237
253
|
cidrv6(params?: string | core.$ZodCheckCIDRv6Params): this;
|
|
238
254
|
/** @deprecated Use `z.e164()` instead. */
|
|
239
255
|
e164(params?: string | core.$ZodCheckE164Params): this;
|
|
240
|
-
/** @deprecated Use `z.iso.datetime()` instead. */
|
|
241
|
-
datetime(params?: string | core.$ZodCheckISODateTimeParams): this;
|
|
242
|
-
/** @deprecated Use `z.iso.date()` instead. */
|
|
243
|
-
date(params?: string | core.$ZodCheckISODateParams): this;
|
|
244
|
-
/** @deprecated Use `z.iso.time()` instead. */
|
|
245
|
-
time(params?: string | core.$ZodCheckISOTimeParams): this;
|
|
246
|
-
/** @deprecated Use `z.iso.duration()` instead. */
|
|
247
|
-
duration(params?: string | core.$ZodCheckISODurationParams): this;
|
|
248
256
|
}
|
|
249
257
|
declare const KrustyString: core.$constructor<KrustyString>;
|
|
250
258
|
declare function string<K extends KrustyInternals = KrustyInternals>(params?: string | core.$ZodStringParams): KrustyString<K>;
|
|
@@ -371,8 +379,6 @@ interface _KrustyNumber<Internals extends core.$ZodNumberInternals = core.$ZodNu
|
|
|
371
379
|
max(value: number, params?: string | core.$ZodCheckLessThanParams): this;
|
|
372
380
|
/** Consider `z.int()` instead. This API is considered *legacy*; it will never be removed but a better alternative exists. */
|
|
373
381
|
int(params?: string | core.$ZodCheckNumberFormatParams): this;
|
|
374
|
-
/** @deprecated This is now identical to `.int()`. Only numbers in the safe integer range are accepted. */
|
|
375
|
-
safe(params?: string | core.$ZodCheckNumberFormatParams): this;
|
|
376
382
|
positive(params?: string | core.$ZodCheckGreaterThanParams): this;
|
|
377
383
|
nonnegative(params?: string | core.$ZodCheckGreaterThanParams): this;
|
|
378
384
|
negative(params?: string | core.$ZodCheckLessThanParams): this;
|
|
@@ -489,7 +495,10 @@ interface _KrustyDate<T extends core.$ZodDateInternals = core.$ZodDateInternals,
|
|
|
489
495
|
interface KrustyDate<K extends KrustyInternals = KrustyInternals> extends _KrustyDate<core.$ZodDateInternals<Date>, K> {
|
|
490
496
|
}
|
|
491
497
|
declare const KrustyDate: core.$constructor<KrustyDate>;
|
|
492
|
-
|
|
498
|
+
type KrustyDateCodec<K extends KrustyInternals = KrustyInternals> = KrustyCodec<KrustyISODate, KrustyDate, K>;
|
|
499
|
+
declare function date<K extends KrustyInternals = KrustyInternals>(params?: string | (core.$ZodDateParams & core.$ZodISODateParams)): KrustyDateCodec<K>;
|
|
500
|
+
type KrustyDateTimeCodec<K extends KrustyInternals = KrustyInternals> = KrustyCodec<KrustyISODateTime, KrustyDate, K>;
|
|
501
|
+
declare function datetime<K extends KrustyInternals = KrustyInternals>(params?: string | (core.$ZodDateParams & core.$ZodISODateTimeParams)): KrustyDateTimeCodec<K>;
|
|
493
502
|
interface KrustyArray<T extends core.SomeType = core.$ZodType, K extends KrustyInternals = KrustyInternals> extends _KrustyType<core.$ZodArrayInternals<T>, K>, core.$ZodArray<T> {
|
|
494
503
|
element: T;
|
|
495
504
|
min(minLength: number, params?: string | core.$ZodCheckMinLengthParams): this;
|
|
@@ -720,7 +729,8 @@ declare class SchemaClass<GateNames extends string = never, K extends KrustyInte
|
|
|
720
729
|
union<const T extends readonly core.SomeType[]>(options: T, params?: string | core.$ZodUnionParams): KrustyUnion<T, K>;
|
|
721
730
|
discriminatedUnion<Types extends readonly [core.$ZodTypeDiscriminable, ...core.$ZodTypeDiscriminable[]], Disc extends string>(discriminator: Disc, options: Types, params?: string | core.$ZodDiscriminatedUnionParams): KrustyDiscriminatedUnion<Types, Disc, K>;
|
|
722
731
|
object<T extends core.$ZodLooseShape = Partial<Record<never, core.SomeType>>>(shape?: T, params?: string | core.$ZodObjectParams): KrustyObject<core.util.Writeable<T>, core.$strip, K>;
|
|
723
|
-
date(params?: string | core.$ZodDateParams):
|
|
732
|
+
date(params?: string | (core.$ZodDateParams & core.$ZodISODateParams)): KrustyDateCodec<K>;
|
|
733
|
+
datetime(params?: string | (core.$ZodDateParams & core.$ZodISODateParams)): KrustyDateTimeCodec<K>;
|
|
724
734
|
any(): KrustyAny<K>;
|
|
725
735
|
unknown(): KrustyUnknown<K>;
|
|
726
736
|
never(params?: string | core.$ZodNeverParams): KrustyNever<K>;
|
|
@@ -728,5 +738,5 @@ declare class SchemaClass<GateNames extends string = never, K extends KrustyInte
|
|
|
728
738
|
json(params?: string | core.$ZodCustomParams): KrustyJSONSchema<K>;
|
|
729
739
|
}
|
|
730
740
|
|
|
731
|
-
export { $ZodGate, 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 };
|
|
732
|
-
export type { $ZodGateDef, $ZodGateInternals, IsGateEnabled, IssueData, KrustyFloat32, KrustyFloat64, KrustyInt, KrustyInt32, KrustyInternals, KrustyJSONSchema, KrustyJSONSchemaInternals, KrustyUInt32, ParseContext, SafeExtendShape, ZodIssue, ZodSafeParseError, ZodSafeParseResult, ZodSafeParseSuccess, _KrustyBigInt, _KrustyBoolean, _KrustyDate, _KrustyNumber, _KrustyType };
|
|
741
|
+
export { $ZodGate, 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, datetime, 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 };
|
|
742
|
+
export type { $ZodGateDef, $ZodGateInternals, IsGateEnabled, IssueData, KrustyDateCodec, KrustyDateTimeCodec, KrustyFloat32, KrustyFloat64, KrustyInt, KrustyInt32, KrustyInternals, KrustyJSONSchema, KrustyJSONSchemaInternals, KrustyUInt32, ParseContext, SafeExtendShape, ZodIssue, ZodSafeParseError, ZodSafeParseResult, ZodSafeParseSuccess, _KrustyBigInt, _KrustyBoolean, _KrustyDate, _KrustyNumber, _KrustyType };
|
package/dist/index.mjs
CHANGED
|
@@ -56,51 +56,6 @@ const safeDecode = /* @__PURE__ */ core._safeDecode(ZodRealError);
|
|
|
56
56
|
const safeEncodeAsync = /* @__PURE__ */ core._safeEncodeAsync(ZodRealError);
|
|
57
57
|
const safeDecodeAsync = /* @__PURE__ */ core._safeDecodeAsync(ZodRealError);
|
|
58
58
|
|
|
59
|
-
const KrustyISODateTime = /* @__PURE__ */ core.$constructor(
|
|
60
|
-
"KrustyISODateTime",
|
|
61
|
-
(inst, def) => {
|
|
62
|
-
const coreInit = core.$ZodISODateTime.init;
|
|
63
|
-
coreInit(inst, def);
|
|
64
|
-
KrustyStringFormat.init(inst, def);
|
|
65
|
-
}
|
|
66
|
-
);
|
|
67
|
-
function datetime(params) {
|
|
68
|
-
return core._isoDateTime(KrustyISODateTime, params);
|
|
69
|
-
}
|
|
70
|
-
const KrustyISODate = /* @__PURE__ */ core.$constructor(
|
|
71
|
-
"KrustyISODate",
|
|
72
|
-
(inst, def) => {
|
|
73
|
-
const coreInit = core.$ZodISODate.init;
|
|
74
|
-
coreInit(inst, def);
|
|
75
|
-
KrustyStringFormat.init(inst, def);
|
|
76
|
-
}
|
|
77
|
-
);
|
|
78
|
-
function date$1(params) {
|
|
79
|
-
return core._isoDate(KrustyISODate, params);
|
|
80
|
-
}
|
|
81
|
-
const KrustyISOTime = /* @__PURE__ */ core.$constructor(
|
|
82
|
-
"KrustyISOTime",
|
|
83
|
-
(inst, def) => {
|
|
84
|
-
const coreInit = core.$ZodISOTime.init;
|
|
85
|
-
coreInit(inst, def);
|
|
86
|
-
KrustyStringFormat.init(inst, def);
|
|
87
|
-
}
|
|
88
|
-
);
|
|
89
|
-
function time(params) {
|
|
90
|
-
return core._isoTime(KrustyISOTime, params);
|
|
91
|
-
}
|
|
92
|
-
const KrustyISODuration = /* @__PURE__ */ core.$constructor(
|
|
93
|
-
"KrustyISODuration",
|
|
94
|
-
(inst, def) => {
|
|
95
|
-
const coreInit = core.$ZodISODuration.init;
|
|
96
|
-
coreInit(inst, def);
|
|
97
|
-
KrustyStringFormat.init(inst, def);
|
|
98
|
-
}
|
|
99
|
-
);
|
|
100
|
-
function duration(params) {
|
|
101
|
-
return core._isoDuration(KrustyISODuration, params);
|
|
102
|
-
}
|
|
103
|
-
|
|
104
59
|
const gatingContext = new AsyncLocalStorage();
|
|
105
60
|
function isGateIssueRaw(issue) {
|
|
106
61
|
return issue.code === "invalid_type" && issue.expected === "never" && issue.inst instanceof KrustyGate;
|
|
@@ -138,6 +93,29 @@ function gate(innerType, gateName) {
|
|
|
138
93
|
});
|
|
139
94
|
}
|
|
140
95
|
|
|
96
|
+
const KrustyISODateTime = /* @__PURE__ */ core.$constructor(
|
|
97
|
+
"KrustyISODateTime",
|
|
98
|
+
(inst, def) => {
|
|
99
|
+
const coreInit = core.$ZodISODateTime.init;
|
|
100
|
+
coreInit(inst, def);
|
|
101
|
+
KrustyStringFormat.init(inst, def);
|
|
102
|
+
}
|
|
103
|
+
);
|
|
104
|
+
function datetime$1(params) {
|
|
105
|
+
return core._isoDateTime(KrustyISODateTime, params);
|
|
106
|
+
}
|
|
107
|
+
const KrustyISODate = /* @__PURE__ */ core.$constructor(
|
|
108
|
+
"KrustyISODate",
|
|
109
|
+
(inst, def) => {
|
|
110
|
+
const coreInit = core.$ZodISODate.init;
|
|
111
|
+
coreInit(inst, def);
|
|
112
|
+
KrustyStringFormat.init(inst, def);
|
|
113
|
+
}
|
|
114
|
+
);
|
|
115
|
+
function date$1(params) {
|
|
116
|
+
return core._isoDate(KrustyISODate, params);
|
|
117
|
+
}
|
|
118
|
+
|
|
141
119
|
function handleGating(payload) {
|
|
142
120
|
for (let i = 0; i < payload.issues.length; i++) {
|
|
143
121
|
const issue = payload.issues[i];
|
|
@@ -373,6 +351,25 @@ const KrustyType = /* @__PURE__ */ core.$constructor(
|
|
|
373
351
|
inst.transform = (tx) => pipe(inst, transform(tx));
|
|
374
352
|
inst.default = (def2) => _default(inst, def2);
|
|
375
353
|
inst.prefault = (def2) => prefault(inst, def2);
|
|
354
|
+
inst.describe = (description) => {
|
|
355
|
+
const cl = inst.clone();
|
|
356
|
+
core.globalRegistry.add(cl, { description });
|
|
357
|
+
return cl;
|
|
358
|
+
};
|
|
359
|
+
Object.defineProperty(inst, "description", {
|
|
360
|
+
get() {
|
|
361
|
+
return core.globalRegistry.get(inst)?.description;
|
|
362
|
+
},
|
|
363
|
+
configurable: true
|
|
364
|
+
});
|
|
365
|
+
inst.meta = (...args) => {
|
|
366
|
+
if (args.length === 0) {
|
|
367
|
+
return core.globalRegistry.get(inst);
|
|
368
|
+
}
|
|
369
|
+
const cl = inst.clone();
|
|
370
|
+
core.globalRegistry.add(cl, args[0]);
|
|
371
|
+
return cl;
|
|
372
|
+
};
|
|
376
373
|
return inst;
|
|
377
374
|
}
|
|
378
375
|
);
|
|
@@ -431,10 +428,6 @@ const KrustyString = /* @__PURE__ */ core.$constructor(
|
|
|
431
428
|
inst.cidrv4 = (params) => inst.check(core._cidrv4(KrustyCIDRv4, params));
|
|
432
429
|
inst.cidrv6 = (params) => inst.check(core._cidrv6(KrustyCIDRv6, params));
|
|
433
430
|
inst.e164 = (params) => inst.check(core._e164(KrustyE164, params));
|
|
434
|
-
inst.datetime = (params) => inst.check(datetime(params));
|
|
435
|
-
inst.date = (params) => inst.check(date$1(params));
|
|
436
|
-
inst.time = (params) => inst.check(time(params));
|
|
437
|
-
inst.duration = (params) => inst.check(duration(params));
|
|
438
431
|
}
|
|
439
432
|
);
|
|
440
433
|
function string(params) {
|
|
@@ -707,7 +700,6 @@ const KrustyNumber = /* @__PURE__ */ core.$constructor(
|
|
|
707
700
|
inst.lte = (value, params) => inst.check(_lte(value, params));
|
|
708
701
|
inst.max = (value, params) => inst.check(_lte(value, params));
|
|
709
702
|
inst.int = (params) => inst.check(int(params));
|
|
710
|
-
inst.safe = (params) => inst.check(int(params));
|
|
711
703
|
inst.positive = (params) => inst.check(_gt(0, params));
|
|
712
704
|
inst.nonnegative = (params) => inst.check(_gte(0, params));
|
|
713
705
|
inst.negative = (params) => inst.check(_lt(0, params));
|
|
@@ -926,7 +918,19 @@ const KrustyDate = /* @__PURE__ */ core.$constructor(
|
|
|
926
918
|
}
|
|
927
919
|
);
|
|
928
920
|
function date(params) {
|
|
929
|
-
return core._date(KrustyDate, params)
|
|
921
|
+
return codec(date$1(params), core._date(KrustyDate, params), {
|
|
922
|
+
encode: (date2) => `${date2.getFullYear()}-${String(date2.getMonth() + 1).padStart(2, "0")}-${String(date2.getDate()).padStart(2, "0")}`,
|
|
923
|
+
decode: (isoString2) => {
|
|
924
|
+
const [y, m, d] = isoString2.split("-");
|
|
925
|
+
return new Date(Number(y), Number(m) - 1, Number(d));
|
|
926
|
+
}
|
|
927
|
+
});
|
|
928
|
+
}
|
|
929
|
+
function datetime(params) {
|
|
930
|
+
return codec(datetime$1(params), core._date(KrustyDate, params), {
|
|
931
|
+
encode: (date2) => date2.toISOString(),
|
|
932
|
+
decode: (isoString2) => new Date(isoString2)
|
|
933
|
+
});
|
|
930
934
|
}
|
|
931
935
|
const KrustyArray = /* @__PURE__ */ core.$constructor(
|
|
932
936
|
"KrustyArray",
|
|
@@ -1511,10 +1515,12 @@ class SchemaClass {
|
|
|
1511
1515
|
object(shape, params) {
|
|
1512
1516
|
return object(shape, params);
|
|
1513
1517
|
}
|
|
1514
|
-
// TODO: make this a codec?
|
|
1515
1518
|
date(params) {
|
|
1516
1519
|
return date(params);
|
|
1517
1520
|
}
|
|
1521
|
+
datetime(params) {
|
|
1522
|
+
return datetime(params);
|
|
1523
|
+
}
|
|
1518
1524
|
any() {
|
|
1519
1525
|
return any();
|
|
1520
1526
|
}
|
|
@@ -1615,4 +1621,4 @@ class SchemaClass {
|
|
|
1615
1621
|
*/
|
|
1616
1622
|
}
|
|
1617
1623
|
|
|
1618
|
-
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 };
|
|
1624
|
+
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, datetime, 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 };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@temporary-name/zod",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.9.3-alpha.
|
|
4
|
+
"version": "1.9.3-alpha.beffd198e2d5853e3d12fa1517c8c9c06bbe6cee",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"homepage": "https://www.stainless.com/",
|
|
7
7
|
"repository": {
|
|
@@ -22,18 +22,15 @@
|
|
|
22
22
|
"files": [
|
|
23
23
|
"dist"
|
|
24
24
|
],
|
|
25
|
-
"peerDependencies": {
|
|
26
|
-
"@temporary-name/contract": "1.9.3-alpha.b7ce8fb6e9463a26fd2564cb172dc612ae4de52d",
|
|
27
|
-
"@temporary-name/server": "1.9.3-alpha.b7ce8fb6e9463a26fd2564cb172dc612ae4de52d"
|
|
28
|
-
},
|
|
29
25
|
"dependencies": {
|
|
30
26
|
"zod": "^4.1.11",
|
|
31
|
-
"@temporary-name/shared": "1.9.3-alpha.
|
|
27
|
+
"@temporary-name/shared": "1.9.3-alpha.beffd198e2d5853e3d12fa1517c8c9c06bbe6cee"
|
|
32
28
|
},
|
|
33
29
|
"devDependencies": {},
|
|
34
30
|
"scripts": {
|
|
35
31
|
"build": "unbuild",
|
|
36
32
|
"build:watch": "pnpm run build --watch",
|
|
37
|
-
"
|
|
33
|
+
"clean": "tsc -b --clean",
|
|
34
|
+
"lint:tsc": "tsc -b"
|
|
38
35
|
}
|
|
39
36
|
}
|