@temporary-name/zod 1.9.3-alpha.b7ce8fb6e9463a26fd2564cb172dc612ae4de52d → 1.9.3-alpha.c13915862ce0feb161cb37a7c0da5ab7d57bd1bf
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 -12
- package/dist/index.d.ts +24 -12
- package/dist/index.mjs +59 -52
- package/package.json +4 -4
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>;
|
|
@@ -489,7 +497,10 @@ interface _KrustyDate<T extends core.$ZodDateInternals = core.$ZodDateInternals,
|
|
|
489
497
|
interface KrustyDate<K extends KrustyInternals = KrustyInternals> extends _KrustyDate<core.$ZodDateInternals<Date>, K> {
|
|
490
498
|
}
|
|
491
499
|
declare const KrustyDate: core.$constructor<KrustyDate>;
|
|
492
|
-
|
|
500
|
+
type KrustyDateCodec<K extends KrustyInternals = KrustyInternals> = KrustyCodec<KrustyISODate, KrustyDate, K>;
|
|
501
|
+
declare function date<K extends KrustyInternals = KrustyInternals>(params?: string | (core.$ZodDateParams & core.$ZodISODateParams)): KrustyDateCodec<K>;
|
|
502
|
+
type KrustyDateTimeCodec<K extends KrustyInternals = KrustyInternals> = KrustyCodec<KrustyISODateTime, KrustyDate, K>;
|
|
503
|
+
declare function datetime<K extends KrustyInternals = KrustyInternals>(params?: string | (core.$ZodDateParams & core.$ZodISODateTimeParams)): KrustyDateTimeCodec<K>;
|
|
493
504
|
interface KrustyArray<T extends core.SomeType = core.$ZodType, K extends KrustyInternals = KrustyInternals> extends _KrustyType<core.$ZodArrayInternals<T>, K>, core.$ZodArray<T> {
|
|
494
505
|
element: T;
|
|
495
506
|
min(minLength: number, params?: string | core.$ZodCheckMinLengthParams): this;
|
|
@@ -720,7 +731,8 @@ declare class SchemaClass<GateNames extends string = never, K extends KrustyInte
|
|
|
720
731
|
union<const T extends readonly core.SomeType[]>(options: T, params?: string | core.$ZodUnionParams): KrustyUnion<T, K>;
|
|
721
732
|
discriminatedUnion<Types extends readonly [core.$ZodTypeDiscriminable, ...core.$ZodTypeDiscriminable[]], Disc extends string>(discriminator: Disc, options: Types, params?: string | core.$ZodDiscriminatedUnionParams): KrustyDiscriminatedUnion<Types, Disc, K>;
|
|
722
733
|
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):
|
|
734
|
+
date(params?: string | (core.$ZodDateParams & core.$ZodISODateParams)): KrustyDateCodec<K>;
|
|
735
|
+
datetime(params?: string | (core.$ZodDateParams & core.$ZodISODateParams)): KrustyDateTimeCodec<K>;
|
|
724
736
|
any(): KrustyAny<K>;
|
|
725
737
|
unknown(): KrustyUnknown<K>;
|
|
726
738
|
never(params?: string | core.$ZodNeverParams): KrustyNever<K>;
|
|
@@ -728,5 +740,5 @@ declare class SchemaClass<GateNames extends string = never, K extends KrustyInte
|
|
|
728
740
|
json(params?: string | core.$ZodCustomParams): KrustyJSONSchema<K>;
|
|
729
741
|
}
|
|
730
742
|
|
|
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 };
|
|
743
|
+
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 };
|
|
744
|
+
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>;
|
|
@@ -489,7 +497,10 @@ interface _KrustyDate<T extends core.$ZodDateInternals = core.$ZodDateInternals,
|
|
|
489
497
|
interface KrustyDate<K extends KrustyInternals = KrustyInternals> extends _KrustyDate<core.$ZodDateInternals<Date>, K> {
|
|
490
498
|
}
|
|
491
499
|
declare const KrustyDate: core.$constructor<KrustyDate>;
|
|
492
|
-
|
|
500
|
+
type KrustyDateCodec<K extends KrustyInternals = KrustyInternals> = KrustyCodec<KrustyISODate, KrustyDate, K>;
|
|
501
|
+
declare function date<K extends KrustyInternals = KrustyInternals>(params?: string | (core.$ZodDateParams & core.$ZodISODateParams)): KrustyDateCodec<K>;
|
|
502
|
+
type KrustyDateTimeCodec<K extends KrustyInternals = KrustyInternals> = KrustyCodec<KrustyISODateTime, KrustyDate, K>;
|
|
503
|
+
declare function datetime<K extends KrustyInternals = KrustyInternals>(params?: string | (core.$ZodDateParams & core.$ZodISODateTimeParams)): KrustyDateTimeCodec<K>;
|
|
493
504
|
interface KrustyArray<T extends core.SomeType = core.$ZodType, K extends KrustyInternals = KrustyInternals> extends _KrustyType<core.$ZodArrayInternals<T>, K>, core.$ZodArray<T> {
|
|
494
505
|
element: T;
|
|
495
506
|
min(minLength: number, params?: string | core.$ZodCheckMinLengthParams): this;
|
|
@@ -720,7 +731,8 @@ declare class SchemaClass<GateNames extends string = never, K extends KrustyInte
|
|
|
720
731
|
union<const T extends readonly core.SomeType[]>(options: T, params?: string | core.$ZodUnionParams): KrustyUnion<T, K>;
|
|
721
732
|
discriminatedUnion<Types extends readonly [core.$ZodTypeDiscriminable, ...core.$ZodTypeDiscriminable[]], Disc extends string>(discriminator: Disc, options: Types, params?: string | core.$ZodDiscriminatedUnionParams): KrustyDiscriminatedUnion<Types, Disc, K>;
|
|
722
733
|
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):
|
|
734
|
+
date(params?: string | (core.$ZodDateParams & core.$ZodISODateParams)): KrustyDateCodec<K>;
|
|
735
|
+
datetime(params?: string | (core.$ZodDateParams & core.$ZodISODateParams)): KrustyDateTimeCodec<K>;
|
|
724
736
|
any(): KrustyAny<K>;
|
|
725
737
|
unknown(): KrustyUnknown<K>;
|
|
726
738
|
never(params?: string | core.$ZodNeverParams): KrustyNever<K>;
|
|
@@ -728,5 +740,5 @@ declare class SchemaClass<GateNames extends string = never, K extends KrustyInte
|
|
|
728
740
|
json(params?: string | core.$ZodCustomParams): KrustyJSONSchema<K>;
|
|
729
741
|
}
|
|
730
742
|
|
|
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 };
|
|
743
|
+
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 };
|
|
744
|
+
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) {
|
|
@@ -926,7 +919,19 @@ const KrustyDate = /* @__PURE__ */ core.$constructor(
|
|
|
926
919
|
}
|
|
927
920
|
);
|
|
928
921
|
function date(params) {
|
|
929
|
-
return core._date(KrustyDate, params)
|
|
922
|
+
return codec(date$1(params), core._date(KrustyDate, params), {
|
|
923
|
+
encode: (date2) => `${date2.getFullYear()}-${String(date2.getMonth() + 1).padStart(2, "0")}-${String(date2.getDate()).padStart(2, "0")}`,
|
|
924
|
+
decode: (isoString2) => {
|
|
925
|
+
const [y, m, d] = isoString2.split("-");
|
|
926
|
+
return new Date(Number(y), Number(m) - 1, Number(d));
|
|
927
|
+
}
|
|
928
|
+
});
|
|
929
|
+
}
|
|
930
|
+
function datetime(params) {
|
|
931
|
+
return codec(datetime$1(params), core._date(KrustyDate, params), {
|
|
932
|
+
encode: (date2) => date2.toISOString(),
|
|
933
|
+
decode: (isoString2) => new Date(isoString2)
|
|
934
|
+
});
|
|
930
935
|
}
|
|
931
936
|
const KrustyArray = /* @__PURE__ */ core.$constructor(
|
|
932
937
|
"KrustyArray",
|
|
@@ -1511,10 +1516,12 @@ class SchemaClass {
|
|
|
1511
1516
|
object(shape, params) {
|
|
1512
1517
|
return object(shape, params);
|
|
1513
1518
|
}
|
|
1514
|
-
// TODO: make this a codec?
|
|
1515
1519
|
date(params) {
|
|
1516
1520
|
return date(params);
|
|
1517
1521
|
}
|
|
1522
|
+
datetime(params) {
|
|
1523
|
+
return datetime(params);
|
|
1524
|
+
}
|
|
1518
1525
|
any() {
|
|
1519
1526
|
return any();
|
|
1520
1527
|
}
|
|
@@ -1615,4 +1622,4 @@ class SchemaClass {
|
|
|
1615
1622
|
*/
|
|
1616
1623
|
}
|
|
1617
1624
|
|
|
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 };
|
|
1625
|
+
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.c13915862ce0feb161cb37a7c0da5ab7d57bd1bf",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"homepage": "https://www.stainless.com/",
|
|
7
7
|
"repository": {
|
|
@@ -23,12 +23,12 @@
|
|
|
23
23
|
"dist"
|
|
24
24
|
],
|
|
25
25
|
"peerDependencies": {
|
|
26
|
-
"@temporary-name/contract": "1.9.3-alpha.
|
|
27
|
-
"@temporary-name/server": "1.9.3-alpha.
|
|
26
|
+
"@temporary-name/contract": "1.9.3-alpha.c13915862ce0feb161cb37a7c0da5ab7d57bd1bf",
|
|
27
|
+
"@temporary-name/server": "1.9.3-alpha.c13915862ce0feb161cb37a7c0da5ab7d57bd1bf"
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
30
|
"zod": "^4.1.11",
|
|
31
|
-
"@temporary-name/shared": "1.9.3-alpha.
|
|
31
|
+
"@temporary-name/shared": "1.9.3-alpha.c13915862ce0feb161cb37a7c0da5ab7d57bd1bf"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {},
|
|
34
34
|
"scripts": {
|