@temporary-name/zod 1.9.3-alpha.021f5c8fe9793dff332b025dce560e804c45a7b1 → 1.9.3-alpha.03f5d40e5b399f85012c2fb4e98167e26d551d36
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 +741 -78
- package/dist/index.d.ts +741 -78
- package/dist/index.mjs +1479 -860
- package/dist/zod4/index.d.mts +1 -303
- package/dist/zod4/index.d.ts +1 -303
- package/dist/zod4/index.mjs +2 -486
- package/package.json +6 -10
package/dist/index.d.mts
CHANGED
|
@@ -1,91 +1,754 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
declare function getCustomJsonSchema(def: ZodTypeDef, options: {
|
|
8
|
-
strategy: 'input' | 'output' | 'both';
|
|
9
|
-
}): Exclude<JSONSchema, boolean> | undefined;
|
|
10
|
-
declare function customJsonSchema<T extends ZodTypeAny, TStrategy extends 'input' | 'output' | 'both' = 'both'>(schema: T, custom: Exclude<JSONSchema<TStrategy extends 'input' ? input<T> : TStrategy extends 'output' ? output<T> : input<T> & output<T>>, boolean>, options?: {
|
|
11
|
-
strategy?: TStrategy;
|
|
12
|
-
}): T;
|
|
1
|
+
import * as core from 'zod/v4/core';
|
|
2
|
+
import { $ZodError, util, $ZodType } from 'zod/v4/core';
|
|
3
|
+
export { core };
|
|
4
|
+
export { $RefinementCtx as RefinementCtx, _endsWith as endsWith, _gt as gt, _gte as gte, _includes as includes, infer, input, _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, output, _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
|
+
import { AsyncLocalStorage } from 'node:async_hooks';
|
|
6
|
+
import { CustomErrorParams, ZodType, ZodTypeDef } from 'zod/v3';
|
|
13
7
|
|
|
14
|
-
|
|
15
|
-
|
|
8
|
+
/** @deprecated Use `z.core.$ZodIssue` from `@zod/core` instead, especially if you are building a library on top of Zod. */
|
|
9
|
+
type ZodIssue = core.$ZodIssue;
|
|
10
|
+
/** An Error-like class used to store Zod validation issues. */
|
|
11
|
+
interface ZodError<T = unknown> extends $ZodError<T> {
|
|
12
|
+
/** @deprecated Use the `z.treeifyError(err)` function instead. */
|
|
13
|
+
format(): core.$ZodFormattedError<T>;
|
|
14
|
+
format<U>(mapper: (issue: core.$ZodIssue) => U): core.$ZodFormattedError<T, U>;
|
|
15
|
+
/** @deprecated Use the `z.treeifyError(err)` function instead. */
|
|
16
|
+
flatten(): core.$ZodFlattenedError<T>;
|
|
17
|
+
flatten<U>(mapper: (issue: core.$ZodIssue) => U): core.$ZodFlattenedError<T, U>;
|
|
18
|
+
/** @deprecated Push directly to `.issues` instead. */
|
|
19
|
+
addIssue(issue: core.$ZodIssue): void;
|
|
20
|
+
/** @deprecated Push directly to `.issues` instead. */
|
|
21
|
+
addIssues(issues: core.$ZodIssue[]): void;
|
|
22
|
+
/** @deprecated Check `err.issues.length === 0` instead. */
|
|
23
|
+
isEmpty: boolean;
|
|
24
|
+
}
|
|
25
|
+
declare const ZodError: core.$constructor<ZodError>;
|
|
26
|
+
declare const ZodRealError: core.$constructor<ZodError>;
|
|
27
|
+
/** @deprecated Use `z.core.$ZodRawIssue` instead. */
|
|
28
|
+
type IssueData = core.$ZodRawIssue;
|
|
29
|
+
|
|
30
|
+
type ZodSafeParseResult<T> = ZodSafeParseSuccess<T> | ZodSafeParseError<T>;
|
|
31
|
+
type ZodSafeParseSuccess<T> = {
|
|
32
|
+
success: true;
|
|
33
|
+
data: T;
|
|
34
|
+
error?: never;
|
|
16
35
|
};
|
|
17
|
-
type
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
mimeType?: string;
|
|
36
|
+
type ZodSafeParseError<T> = {
|
|
37
|
+
success: false;
|
|
38
|
+
data?: never;
|
|
39
|
+
error: ZodError<T>;
|
|
22
40
|
};
|
|
23
|
-
declare
|
|
24
|
-
|
|
25
|
-
|
|
41
|
+
declare const parse: <T extends core.$ZodType>(schema: T, value: unknown, _ctx?: core.ParseContext<core.$ZodIssue>, _params?: {
|
|
42
|
+
callee?: core.util.AnyFunc;
|
|
43
|
+
Err?: core.$ZodErrorClass;
|
|
44
|
+
}) => core.output<T>;
|
|
45
|
+
declare const parseAsync: <T extends core.$ZodType>(schema: T, value: unknown, _ctx?: core.ParseContext<core.$ZodIssue>, _params?: {
|
|
46
|
+
callee?: core.util.AnyFunc;
|
|
47
|
+
Err?: core.$ZodErrorClass;
|
|
48
|
+
}) => Promise<core.output<T>>;
|
|
49
|
+
declare const safeParse: <T extends core.$ZodType>(schema: T, value: unknown, _ctx?: core.ParseContext<core.$ZodIssue>) => ZodSafeParseResult<core.output<T>>;
|
|
50
|
+
declare const safeParseAsync: <T extends core.$ZodType>(schema: T, value: unknown, _ctx?: core.ParseContext<core.$ZodIssue>) => Promise<ZodSafeParseResult<core.output<T>>>;
|
|
51
|
+
declare const encode: <T extends core.$ZodType>(schema: T, value: core.output<T>, _ctx?: core.ParseContext<core.$ZodIssue>) => core.input<T>;
|
|
52
|
+
declare const decode: <T extends core.$ZodType>(schema: T, value: core.input<T>, _ctx?: core.ParseContext<core.$ZodIssue>) => core.output<T>;
|
|
53
|
+
declare const encodeAsync: <T extends core.$ZodType>(schema: T, value: core.output<T>, _ctx?: core.ParseContext<core.$ZodIssue>) => Promise<core.input<T>>;
|
|
54
|
+
declare const decodeAsync: <T extends core.$ZodType>(schema: T, value: core.input<T>, _ctx?: core.ParseContext<core.$ZodIssue>) => Promise<core.output<T>>;
|
|
55
|
+
declare const safeEncode: <T extends core.$ZodType>(schema: T, value: core.output<T>, _ctx?: core.ParseContext<core.$ZodIssue>) => ZodSafeParseResult<core.input<T>>;
|
|
56
|
+
declare const safeDecode: <T extends core.$ZodType>(schema: T, value: core.input<T>, _ctx?: core.ParseContext<core.$ZodIssue>) => ZodSafeParseResult<core.output<T>>;
|
|
57
|
+
declare const safeEncodeAsync: <T extends core.$ZodType>(schema: T, value: core.output<T>, _ctx?: core.ParseContext<core.$ZodIssue>) => Promise<ZodSafeParseResult<core.input<T>>>;
|
|
58
|
+
declare const safeDecodeAsync: <T extends core.$ZodType>(schema: T, value: core.input<T>, _ctx?: core.ParseContext<core.$ZodIssue>) => Promise<ZodSafeParseResult<core.output<T>>>;
|
|
26
59
|
|
|
27
|
-
|
|
60
|
+
type IsGateEnabled = (gate: string) => boolean;
|
|
61
|
+
declare const gatingContext: AsyncLocalStorage<IsGateEnabled>;
|
|
62
|
+
declare function isGateIssueRaw(issue: core.$ZodRawIssue): boolean;
|
|
63
|
+
declare function isGateIssue(issue: core.$ZodIssue): boolean;
|
|
64
|
+
interface $ZodGateDef<T extends core.SomeType = core.$ZodType> extends core.$ZodOptionalDef<T> {
|
|
65
|
+
gateName: string;
|
|
66
|
+
}
|
|
67
|
+
interface $ZodGateInternals<T extends core.SomeType = core.$ZodType> extends core.$ZodOptionalInternals<T> {
|
|
68
|
+
def: $ZodGateDef<T>;
|
|
69
|
+
}
|
|
70
|
+
interface $ZodGate<T extends core.SomeType = core.$ZodType> extends core.$ZodType {
|
|
71
|
+
_zod: $ZodGateInternals<T>;
|
|
72
|
+
}
|
|
73
|
+
declare const $ZodGate: core.$constructor<$ZodGate>;
|
|
74
|
+
interface ZodGate<T extends core.SomeType = core.$ZodType, K extends KrustyInternals = KrustyInternals> extends _KrustyType<$ZodGateInternals<T>, K>, $ZodGate<T> {
|
|
75
|
+
unwrap(): T;
|
|
76
|
+
}
|
|
77
|
+
declare const ZodGate: core.$constructor<ZodGate>;
|
|
78
|
+
declare function gate<T extends core.SomeType, K extends KrustyInternals>(innerType: T, gateName: K['gateNames']): ZodGate<T, K>;
|
|
28
79
|
|
|
29
|
-
|
|
30
|
-
|
|
80
|
+
type SafeExtendShape<Base extends core.$ZodShape, Ext extends core.$ZodLooseShape> = {
|
|
81
|
+
[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];
|
|
31
82
|
};
|
|
83
|
+
interface ZodObject<
|
|
84
|
+
/** @ts-expect-error Cast variance */
|
|
85
|
+
out Shape extends core.$ZodShape = core.$ZodLooseShape, out Config extends core.$ZodObjectConfig = core.$strip, K extends KrustyInternals = KrustyInternals> extends _KrustyType<core.$ZodObjectInternals<Shape, Config>, K>, core.$ZodObject<Shape, Config> {
|
|
86
|
+
shape: Shape;
|
|
87
|
+
keyof(): ZodEnum<util.ToEnum<keyof Shape & string>, K>;
|
|
88
|
+
/** Define a schema to validate all unrecognized keys. This overrides the existing strict/loose behavior. */
|
|
89
|
+
catchall<T extends core.SomeType>(schema: T): ZodObject<Shape, core.$catchall<T>, K>;
|
|
90
|
+
/** @deprecated Use `z.looseObject()` or `.loose()` instead. */
|
|
91
|
+
passthrough(): ZodObject<Shape, core.$loose, K>;
|
|
92
|
+
/** Consider `z.looseObject(A.shape)` instead */
|
|
93
|
+
loose(): ZodObject<Shape, core.$loose, K>;
|
|
94
|
+
/** Consider `z.strictObject(A.shape)` instead */
|
|
95
|
+
strict(): ZodObject<Shape, core.$strict, K>;
|
|
96
|
+
/** This is the default behavior. This method call is likely unnecessary. */
|
|
97
|
+
strip(): ZodObject<Shape, core.$strip, K>;
|
|
98
|
+
extend<U extends core.$ZodLooseShape>(shape: U): ZodObject<util.Extend<Shape, U>, Config, K>;
|
|
99
|
+
safeExtend<U extends core.$ZodLooseShape>(shape: SafeExtendShape<Shape, U> & Partial<Record<keyof Shape, core.SomeType>>): ZodObject<util.Extend<Shape, U>, Config, K>;
|
|
100
|
+
/**
|
|
101
|
+
* @deprecated Use [`A.extend(B.shape)`](https://zod.dev/api?id=extend) instead.
|
|
102
|
+
*/
|
|
103
|
+
merge<U extends ZodObject>(other: U): ZodObject<util.Extend<Shape, U['shape']>, U['_zod']['config'], K>;
|
|
104
|
+
pick<M extends util.Mask<keyof Shape>>(mask: M): ZodObject<util.Flatten<Pick<Shape, Extract<keyof Shape, keyof M>>>, Config, K>;
|
|
105
|
+
omit<M extends util.Mask<keyof Shape>>(mask: M): ZodObject<util.Flatten<Omit<Shape, Extract<keyof Shape, keyof M>>>, Config, K>;
|
|
106
|
+
partial(): ZodObject<{
|
|
107
|
+
[k in keyof Shape]: ZodOptional<Shape[k], K>;
|
|
108
|
+
}, Config, K>;
|
|
109
|
+
partial<M extends util.Mask<keyof Shape>>(mask: M): ZodObject<{
|
|
110
|
+
[k in keyof Shape]: k extends keyof M ? ZodOptional<Shape[k], K> : Shape[k];
|
|
111
|
+
}, Config, K>;
|
|
112
|
+
required(): ZodObject<{
|
|
113
|
+
[k in keyof Shape]: ZodNonOptional<Shape[k], K>;
|
|
114
|
+
}, Config, K>;
|
|
115
|
+
required<M extends util.Mask<keyof Shape>>(mask: M): ZodObject<{
|
|
116
|
+
[k in keyof Shape]: k extends keyof M ? ZodNonOptional<Shape[k], K> : Shape[k];
|
|
117
|
+
}, Config, K>;
|
|
118
|
+
}
|
|
119
|
+
declare const ZodObject: core.$constructor<ZodObject>;
|
|
120
|
+
declare function object<T extends core.$ZodLooseShape = Partial<Record<never, core.SomeType>>, K extends KrustyInternals = KrustyInternals>(shape?: T, params?: string | core.$ZodObjectParams): ZodObject<util.Writeable<T>, core.$strip, K>;
|
|
121
|
+
declare function strictObject<T extends core.$ZodLooseShape, K extends KrustyInternals>(shape: T, params?: string | core.$ZodObjectParams): ZodObject<T, core.$strict, K>;
|
|
122
|
+
declare function looseObject<T extends core.$ZodLooseShape, K extends KrustyInternals>(shape: T, params?: string | core.$ZodObjectParams): ZodObject<T, core.$loose, K>;
|
|
123
|
+
|
|
124
|
+
interface ZodUnion<T extends readonly core.SomeType[] = readonly core.$ZodType[], K extends KrustyInternals = KrustyInternals> extends _KrustyType<core.$ZodUnionInternals<T>, K>, core.$ZodUnion<T> {
|
|
125
|
+
options: T;
|
|
126
|
+
}
|
|
127
|
+
declare const ZodUnion: core.$constructor<ZodUnion>;
|
|
128
|
+
declare function union<const T extends readonly core.SomeType[], K extends KrustyInternals>(options: T, params?: string | core.$ZodUnionParams): ZodUnion<T, K>;
|
|
129
|
+
interface ZodDiscriminatedUnion<Options extends readonly core.SomeType[] = readonly core.$ZodType[], Disc extends string = string, K extends KrustyInternals = KrustyInternals> extends ZodUnion<Options, K>, core.$ZodDiscriminatedUnion<Options, Disc> {
|
|
130
|
+
_zod: core.$ZodDiscriminatedUnionInternals<Options, Disc>;
|
|
131
|
+
def: core.$ZodDiscriminatedUnionDef<Options, Disc>;
|
|
132
|
+
}
|
|
133
|
+
declare const ZodDiscriminatedUnion: core.$constructor<ZodDiscriminatedUnion>;
|
|
134
|
+
declare function discriminatedUnion<Types extends readonly [core.$ZodTypeDiscriminable, ...core.$ZodTypeDiscriminable[]], Disc extends string, K extends KrustyInternals = KrustyInternals>(discriminator: Disc, options: Types, params?: string | core.$ZodDiscriminatedUnionParams): ZodDiscriminatedUnion<Types, Disc, K>;
|
|
135
|
+
|
|
136
|
+
type CustomParams = CustomErrorParams & {
|
|
137
|
+
fatal?: boolean;
|
|
138
|
+
};
|
|
139
|
+
|
|
140
|
+
declare function blob(params?: string | CustomParams | ((input: unknown) => CustomParams)): ZodType<Blob, ZodTypeDef, Blob>;
|
|
32
141
|
|
|
33
142
|
declare function regexp(params?: string | CustomParams | ((input: unknown) => CustomParams)): ZodType<RegExp, ZodTypeDef, RegExp>;
|
|
34
143
|
|
|
35
|
-
|
|
144
|
+
interface KrustyInternals<GateNames extends string = string> {
|
|
145
|
+
gateNames: GateNames;
|
|
146
|
+
}
|
|
147
|
+
interface _KrustyType<out Internals extends core.$ZodTypeInternals = core.$ZodTypeInternals, out KInternals extends KrustyInternals = KrustyInternals> extends KrustyType<any, any, Internals, KInternals> {
|
|
148
|
+
}
|
|
149
|
+
interface KrustyType<out Output = unknown, out Input = unknown, out Internals extends core.$ZodTypeInternals<Output, Input> = core.$ZodTypeInternals<Output, Input>, KInternals extends KrustyInternals = KrustyInternals> extends core.$ZodType<Output, Input, Internals> {
|
|
150
|
+
def: Internals['def'];
|
|
151
|
+
type: Internals['def']['type'];
|
|
152
|
+
check(...checks: (core.CheckFn<core.output<this>> | core.$ZodCheck<core.output<this>>)[]): this;
|
|
153
|
+
clone(def?: Internals['def'], params?: {
|
|
154
|
+
parent: boolean;
|
|
155
|
+
}): this;
|
|
156
|
+
register<R extends core.$ZodRegistry>(registry: R, ...meta: this extends R['_schema'] ? undefined extends R['_meta'] ? [
|
|
157
|
+
core.$replace<R['_meta'], this>?
|
|
158
|
+
] : [core.$replace<R['_meta'], this>] : ['Incompatible schema']): this;
|
|
159
|
+
brand<T extends PropertyKey = PropertyKey>(value?: T): PropertyKey extends T ? this : core.$ZodBranded<this, T>;
|
|
160
|
+
parse(data: unknown, params?: core.ParseContext<core.$ZodIssue>): core.output<this>;
|
|
161
|
+
safeParse(data: unknown, params?: core.ParseContext<core.$ZodIssue>): ZodSafeParseResult<core.output<this>>;
|
|
162
|
+
parseAsync(data: unknown, params?: core.ParseContext<core.$ZodIssue>): Promise<core.output<this>>;
|
|
163
|
+
safeParseAsync(data: unknown, params?: core.ParseContext<core.$ZodIssue>): Promise<ZodSafeParseResult<core.output<this>>>;
|
|
164
|
+
spa: (data: unknown, params?: core.ParseContext<core.$ZodIssue>) => Promise<ZodSafeParseResult<core.output<this>>>;
|
|
165
|
+
encode(data: core.output<this>, params?: core.ParseContext<core.$ZodIssue>): core.input<this>;
|
|
166
|
+
decode(data: core.input<this>, params?: core.ParseContext<core.$ZodIssue>): core.output<this>;
|
|
167
|
+
encodeAsync(data: core.output<this>, params?: core.ParseContext<core.$ZodIssue>): Promise<core.input<this>>;
|
|
168
|
+
decodeAsync(data: core.input<this>, params?: core.ParseContext<core.$ZodIssue>): Promise<core.output<this>>;
|
|
169
|
+
safeEncode(data: core.output<this>, params?: core.ParseContext<core.$ZodIssue>): ZodSafeParseResult<core.input<this>>;
|
|
170
|
+
safeDecode(data: core.input<this>, params?: core.ParseContext<core.$ZodIssue>): ZodSafeParseResult<core.output<this>>;
|
|
171
|
+
safeEncodeAsync(data: core.output<this>, params?: core.ParseContext<core.$ZodIssue>): Promise<ZodSafeParseResult<core.input<this>>>;
|
|
172
|
+
safeDecodeAsync(data: core.input<this>, params?: core.ParseContext<core.$ZodIssue>): Promise<ZodSafeParseResult<core.output<this>>>;
|
|
173
|
+
refine(check: (arg: core.output<this>) => unknown | Promise<unknown>, params?: string | core.$ZodCustomParams): this;
|
|
174
|
+
superRefine(refinement: (arg: core.output<this>, ctx: core.$RefinementCtx<core.output<this>>) => void | Promise<void>): this;
|
|
175
|
+
overwrite(fn: (x: core.output<this>) => core.output<this>): this;
|
|
176
|
+
gate(gateName: KInternals['gateNames']): ZodGate<this, KInternals>;
|
|
177
|
+
optional(): ZodOptional<this, KInternals>;
|
|
178
|
+
nonoptional(params?: string | core.$ZodNonOptionalParams): ZodNonOptional<this, KInternals>;
|
|
179
|
+
nullable(): ZodNullable<this, KInternals>;
|
|
180
|
+
nullish(): ZodOptional<ZodNullable<this, KInternals>, KInternals>;
|
|
181
|
+
default(def: util.NoUndefined<core.output<this>>): ZodDefault<this, KInternals>;
|
|
182
|
+
default(def: () => util.NoUndefined<core.output<this>>): ZodDefault<this, KInternals>;
|
|
183
|
+
prefault(def: () => core.input<this>): ZodPrefault<this, KInternals>;
|
|
184
|
+
prefault(def: core.input<this>): ZodPrefault<this, KInternals>;
|
|
185
|
+
array(): ZodArray<this, KInternals>;
|
|
186
|
+
or<T extends core.SomeType>(option: T): ZodUnion<[this, T], KInternals>;
|
|
187
|
+
and<T extends core.SomeType>(incoming: T): ZodIntersection<this, T, KInternals>;
|
|
188
|
+
transform<NewOut>(transform: (arg: core.output<this>, ctx: core.$RefinementCtx<core.output<this>>) => NewOut | Promise<NewOut>): ZodPipe<this, ZodTransform<Awaited<NewOut>, core.output<this>>, KInternals>;
|
|
189
|
+
}
|
|
190
|
+
declare const KrustyType: core.$constructor<KrustyType>;
|
|
191
|
+
interface _ZodString<T extends core.$ZodStringInternals<unknown> = core.$ZodStringInternals<unknown>, K extends KrustyInternals = KrustyInternals> extends _KrustyType<T, K> {
|
|
192
|
+
format: string | null;
|
|
193
|
+
minLength: number | null;
|
|
194
|
+
maxLength: number | null;
|
|
195
|
+
regex(regex: RegExp, params?: string | core.$ZodCheckRegexParams): this;
|
|
196
|
+
includes(value: string, params?: core.$ZodCheckIncludesParams): this;
|
|
197
|
+
startsWith(value: string, params?: string | core.$ZodCheckStartsWithParams): this;
|
|
198
|
+
endsWith(value: string, params?: string | core.$ZodCheckEndsWithParams): this;
|
|
199
|
+
min(minLength: number, params?: string | core.$ZodCheckMinLengthParams): this;
|
|
200
|
+
max(maxLength: number, params?: string | core.$ZodCheckMaxLengthParams): this;
|
|
201
|
+
length(len: number, params?: string | core.$ZodCheckLengthEqualsParams): this;
|
|
202
|
+
nonempty(params?: string | core.$ZodCheckMinLengthParams): this;
|
|
203
|
+
lowercase(params?: string | core.$ZodCheckLowerCaseParams): this;
|
|
204
|
+
uppercase(params?: string | core.$ZodCheckUpperCaseParams): this;
|
|
205
|
+
trim(): this;
|
|
206
|
+
normalize(form?: 'NFC' | 'NFD' | 'NFKC' | 'NFKD' | (string & {})): this;
|
|
207
|
+
toLowerCase(): this;
|
|
208
|
+
toUpperCase(): this;
|
|
209
|
+
}
|
|
210
|
+
/** @internal */
|
|
211
|
+
declare const _ZodString: core.$constructor<_ZodString>;
|
|
212
|
+
interface ZodString<K extends KrustyInternals = KrustyInternals> extends _ZodString<core.$ZodStringInternals<string>, K> {
|
|
213
|
+
/** @deprecated Use `z.email()` instead. */
|
|
214
|
+
email(params?: string | core.$ZodCheckEmailParams): this;
|
|
215
|
+
/** @deprecated Use `z.url()` instead. */
|
|
216
|
+
url(params?: string | core.$ZodCheckURLParams): this;
|
|
217
|
+
/** @deprecated Use `z.jwt()` instead. */
|
|
218
|
+
jwt(params?: string | core.$ZodCheckJWTParams): this;
|
|
219
|
+
/** @deprecated Use `z.emoji()` instead. */
|
|
220
|
+
emoji(params?: string | core.$ZodCheckEmojiParams): this;
|
|
221
|
+
/** @deprecated Use `z.guid()` instead. */
|
|
222
|
+
guid(params?: string | core.$ZodCheckGUIDParams): this;
|
|
223
|
+
/** @deprecated Use `z.uuid()` instead. */
|
|
224
|
+
uuid(params?: string | core.$ZodCheckUUIDParams): this;
|
|
225
|
+
/** @deprecated Use `z.uuid()` instead. */
|
|
226
|
+
uuidv4(params?: string | core.$ZodCheckUUIDParams): this;
|
|
227
|
+
/** @deprecated Use `z.uuid()` instead. */
|
|
228
|
+
uuidv6(params?: string | core.$ZodCheckUUIDParams): this;
|
|
229
|
+
/** @deprecated Use `z.uuid()` instead. */
|
|
230
|
+
uuidv7(params?: string | core.$ZodCheckUUIDParams): this;
|
|
231
|
+
/** @deprecated Use `z.nanoid()` instead. */
|
|
232
|
+
nanoid(params?: string | core.$ZodCheckNanoIDParams): this;
|
|
233
|
+
/** @deprecated Use `z.guid()` instead. */
|
|
234
|
+
guid(params?: string | core.$ZodCheckGUIDParams): this;
|
|
235
|
+
/** @deprecated Use `z.cuid()` instead. */
|
|
236
|
+
cuid(params?: string | core.$ZodCheckCUIDParams): this;
|
|
237
|
+
/** @deprecated Use `z.cuid2()` instead. */
|
|
238
|
+
cuid2(params?: string | core.$ZodCheckCUID2Params): this;
|
|
239
|
+
/** @deprecated Use `z.ulid()` instead. */
|
|
240
|
+
ulid(params?: string | core.$ZodCheckULIDParams): this;
|
|
241
|
+
/** @deprecated Use `z.base64()` instead. */
|
|
242
|
+
base64(params?: string | core.$ZodCheckBase64Params): this;
|
|
243
|
+
/** @deprecated Use `z.base64url()` instead. */
|
|
244
|
+
base64url(params?: string | core.$ZodCheckBase64URLParams): this;
|
|
245
|
+
/** @deprecated Use `z.xid()` instead. */
|
|
246
|
+
xid(params?: string | core.$ZodCheckXIDParams): this;
|
|
247
|
+
/** @deprecated Use `z.ksuid()` instead. */
|
|
248
|
+
ksuid(params?: string | core.$ZodCheckKSUIDParams): this;
|
|
249
|
+
/** @deprecated Use `z.ipv4()` instead. */
|
|
250
|
+
ipv4(params?: string | core.$ZodCheckIPv4Params): this;
|
|
251
|
+
/** @deprecated Use `z.ipv6()` instead. */
|
|
252
|
+
ipv6(params?: string | core.$ZodCheckIPv6Params): this;
|
|
253
|
+
/** @deprecated Use `z.cidrv4()` instead. */
|
|
254
|
+
cidrv4(params?: string | core.$ZodCheckCIDRv4Params): this;
|
|
255
|
+
/** @deprecated Use `z.cidrv6()` instead. */
|
|
256
|
+
cidrv6(params?: string | core.$ZodCheckCIDRv6Params): this;
|
|
257
|
+
/** @deprecated Use `z.e164()` instead. */
|
|
258
|
+
e164(params?: string | core.$ZodCheckE164Params): this;
|
|
259
|
+
/** @deprecated Use `z.iso.datetime()` instead. */
|
|
260
|
+
datetime(params?: string | core.$ZodCheckISODateTimeParams): this;
|
|
261
|
+
/** @deprecated Use `z.iso.date()` instead. */
|
|
262
|
+
date(params?: string | core.$ZodCheckISODateParams): this;
|
|
263
|
+
/** @deprecated Use `z.iso.time()` instead. */
|
|
264
|
+
time(params?: string | core.$ZodCheckISOTimeParams): this;
|
|
265
|
+
/** @deprecated Use `z.iso.duration()` instead. */
|
|
266
|
+
duration(params?: string | core.$ZodCheckISODurationParams): this;
|
|
267
|
+
}
|
|
268
|
+
declare const ZodString: core.$constructor<ZodString>;
|
|
269
|
+
declare function string<K extends KrustyInternals = KrustyInternals>(params?: string | core.$ZodStringParams): ZodString<K>;
|
|
270
|
+
interface ZodStringFormat<Format extends string = string, K extends KrustyInternals = KrustyInternals> extends _ZodString<core.$ZodStringFormatInternals<Format>, K> {
|
|
271
|
+
}
|
|
272
|
+
declare const ZodStringFormat: core.$constructor<ZodStringFormat>;
|
|
273
|
+
interface ZodEmail<K extends KrustyInternals = KrustyInternals> extends ZodStringFormat<'email', K> {
|
|
274
|
+
_zod: core.$ZodEmailInternals;
|
|
275
|
+
}
|
|
276
|
+
declare const ZodEmail: core.$constructor<ZodEmail>;
|
|
277
|
+
declare function email(params?: string | core.$ZodEmailParams): ZodEmail;
|
|
278
|
+
interface ZodGUID<K extends KrustyInternals = KrustyInternals> extends ZodStringFormat<'guid', K> {
|
|
279
|
+
_zod: core.$ZodGUIDInternals;
|
|
280
|
+
}
|
|
281
|
+
declare const ZodGUID: core.$constructor<ZodGUID>;
|
|
282
|
+
declare function guid(params?: string | core.$ZodGUIDParams): ZodGUID;
|
|
283
|
+
interface ZodUUID<K extends KrustyInternals = KrustyInternals> extends ZodStringFormat<'uuid', K> {
|
|
284
|
+
_zod: core.$ZodUUIDInternals;
|
|
285
|
+
}
|
|
286
|
+
declare const ZodUUID: core.$constructor<ZodUUID>;
|
|
287
|
+
declare function uuid(params?: string | core.$ZodUUIDParams): ZodUUID;
|
|
288
|
+
declare function uuidv4(params?: string | core.$ZodUUIDv4Params): ZodUUID;
|
|
289
|
+
declare function uuidv6(params?: string | core.$ZodUUIDv6Params): ZodUUID;
|
|
290
|
+
declare function uuidv7(params?: string | core.$ZodUUIDv7Params): ZodUUID;
|
|
291
|
+
interface ZodURL extends ZodStringFormat<'url'> {
|
|
292
|
+
_zod: core.$ZodURLInternals;
|
|
293
|
+
}
|
|
294
|
+
declare const ZodURL: core.$constructor<ZodURL>;
|
|
295
|
+
declare function url(params?: string | core.$ZodURLParams): ZodURL;
|
|
296
|
+
declare function httpUrl(params?: string | Omit<core.$ZodURLParams, 'protocol' | 'hostname'>): ZodURL;
|
|
297
|
+
interface ZodEmoji extends ZodStringFormat<'emoji'> {
|
|
298
|
+
_zod: core.$ZodEmojiInternals;
|
|
299
|
+
}
|
|
300
|
+
declare const ZodEmoji: core.$constructor<ZodEmoji>;
|
|
301
|
+
declare function emoji(params?: string | core.$ZodEmojiParams): ZodEmoji;
|
|
302
|
+
interface ZodNanoID extends ZodStringFormat<'nanoid'> {
|
|
303
|
+
_zod: core.$ZodNanoIDInternals;
|
|
304
|
+
}
|
|
305
|
+
declare const ZodNanoID: core.$constructor<ZodNanoID>;
|
|
306
|
+
declare function nanoid(params?: string | core.$ZodNanoIDParams): ZodNanoID;
|
|
307
|
+
interface ZodCUID extends ZodStringFormat<'cuid'> {
|
|
308
|
+
_zod: core.$ZodCUIDInternals;
|
|
309
|
+
}
|
|
310
|
+
declare const ZodCUID: core.$constructor<ZodCUID>;
|
|
311
|
+
declare function cuid(params?: string | core.$ZodCUIDParams): ZodCUID;
|
|
312
|
+
interface ZodCUID2 extends ZodStringFormat<'cuid2'> {
|
|
313
|
+
_zod: core.$ZodCUID2Internals;
|
|
314
|
+
}
|
|
315
|
+
declare const ZodCUID2: core.$constructor<ZodCUID2>;
|
|
316
|
+
declare function cuid2(params?: string | core.$ZodCUID2Params): ZodCUID2;
|
|
317
|
+
interface ZodULID extends ZodStringFormat<'ulid'> {
|
|
318
|
+
_zod: core.$ZodULIDInternals;
|
|
319
|
+
}
|
|
320
|
+
declare const ZodULID: core.$constructor<ZodULID>;
|
|
321
|
+
declare function ulid(params?: string | core.$ZodULIDParams): ZodULID;
|
|
322
|
+
interface ZodXID extends ZodStringFormat<'xid'> {
|
|
323
|
+
_zod: core.$ZodXIDInternals;
|
|
324
|
+
}
|
|
325
|
+
declare const ZodXID: core.$constructor<ZodXID>;
|
|
326
|
+
declare function xid(params?: string | core.$ZodXIDParams): ZodXID;
|
|
327
|
+
interface ZodKSUID extends ZodStringFormat<'ksuid'> {
|
|
328
|
+
_zod: core.$ZodKSUIDInternals;
|
|
329
|
+
}
|
|
330
|
+
declare const ZodKSUID: core.$constructor<ZodKSUID>;
|
|
331
|
+
declare function ksuid(params?: string | core.$ZodKSUIDParams): ZodKSUID;
|
|
332
|
+
interface ZodIPv4 extends ZodStringFormat<'ipv4'> {
|
|
333
|
+
_zod: core.$ZodIPv4Internals;
|
|
334
|
+
}
|
|
335
|
+
declare const ZodIPv4: core.$constructor<ZodIPv4>;
|
|
336
|
+
declare function ipv4(params?: string | core.$ZodIPv4Params): ZodIPv4;
|
|
337
|
+
interface ZodIPv6 extends ZodStringFormat<'ipv6'> {
|
|
338
|
+
_zod: core.$ZodIPv6Internals;
|
|
339
|
+
}
|
|
340
|
+
declare const ZodIPv6: core.$constructor<ZodIPv6>;
|
|
341
|
+
declare function ipv6(params?: string | core.$ZodIPv6Params): ZodIPv6;
|
|
342
|
+
interface ZodCIDRv4 extends ZodStringFormat<'cidrv4'> {
|
|
343
|
+
_zod: core.$ZodCIDRv4Internals;
|
|
344
|
+
}
|
|
345
|
+
declare const ZodCIDRv4: core.$constructor<ZodCIDRv4>;
|
|
346
|
+
declare function cidrv4(params?: string | core.$ZodCIDRv4Params): ZodCIDRv4;
|
|
347
|
+
interface ZodCIDRv6 extends ZodStringFormat<'cidrv6'> {
|
|
348
|
+
_zod: core.$ZodCIDRv6Internals;
|
|
349
|
+
}
|
|
350
|
+
declare const ZodCIDRv6: core.$constructor<ZodCIDRv6>;
|
|
351
|
+
declare function cidrv6(params?: string | core.$ZodCIDRv6Params): ZodCIDRv6;
|
|
352
|
+
interface ZodBase64 extends ZodStringFormat<'base64'> {
|
|
353
|
+
_zod: core.$ZodBase64Internals;
|
|
354
|
+
}
|
|
355
|
+
declare const ZodBase64: core.$constructor<ZodBase64>;
|
|
356
|
+
declare function base64(params?: string | core.$ZodBase64Params): ZodBase64;
|
|
357
|
+
interface ZodBase64URL extends ZodStringFormat<'base64url'> {
|
|
358
|
+
_zod: core.$ZodBase64URLInternals;
|
|
359
|
+
}
|
|
360
|
+
declare const ZodBase64URL: core.$constructor<ZodBase64URL>;
|
|
361
|
+
declare function base64url(params?: string | core.$ZodBase64URLParams): ZodBase64URL;
|
|
362
|
+
interface ZodE164 extends ZodStringFormat<'e164'> {
|
|
363
|
+
_zod: core.$ZodE164Internals;
|
|
364
|
+
}
|
|
365
|
+
declare const ZodE164: core.$constructor<ZodE164>;
|
|
366
|
+
declare function e164(params?: string | core.$ZodE164Params): ZodE164;
|
|
367
|
+
interface ZodJWT extends ZodStringFormat<'jwt'> {
|
|
368
|
+
_zod: core.$ZodJWTInternals;
|
|
369
|
+
}
|
|
370
|
+
declare const ZodJWT: core.$constructor<ZodJWT>;
|
|
371
|
+
declare function jwt(params?: string | core.$ZodJWTParams): ZodJWT;
|
|
372
|
+
interface ZodCustomStringFormat<Format extends string = string> extends ZodStringFormat<Format>, core.$ZodCustomStringFormat<Format> {
|
|
373
|
+
_zod: core.$ZodCustomStringFormatInternals<Format>;
|
|
374
|
+
}
|
|
375
|
+
declare const ZodCustomStringFormat: core.$constructor<ZodCustomStringFormat>;
|
|
376
|
+
declare function stringFormat<Format extends string>(format: Format, fnOrRegex: ((arg: string) => util.MaybeAsync<unknown>) | RegExp, _params?: string | core.$ZodStringFormatParams): ZodCustomStringFormat<Format>;
|
|
377
|
+
declare function hostname(_params?: string | core.$ZodStringFormatParams): ZodCustomStringFormat<'hostname'>;
|
|
378
|
+
declare function hex(_params?: string | core.$ZodStringFormatParams): ZodCustomStringFormat<'hex'>;
|
|
379
|
+
declare function hash<Alg extends util.HashAlgorithm, Enc extends util.HashEncoding = 'hex'>(alg: Alg, params?: {
|
|
380
|
+
enc?: Enc;
|
|
381
|
+
} & core.$ZodStringFormatParams): ZodCustomStringFormat<`${Alg}_${Enc}`>;
|
|
382
|
+
interface _ZodNumber<Internals extends core.$ZodNumberInternals = core.$ZodNumberInternals, K extends KrustyInternals = KrustyInternals> extends _KrustyType<Internals, K> {
|
|
383
|
+
gt(value: number, params?: string | core.$ZodCheckGreaterThanParams): this;
|
|
384
|
+
/** Identical to .min() */
|
|
385
|
+
gte(value: number, params?: string | core.$ZodCheckGreaterThanParams): this;
|
|
386
|
+
min(value: number, params?: string | core.$ZodCheckGreaterThanParams): this;
|
|
387
|
+
lt(value: number, params?: string | core.$ZodCheckLessThanParams): this;
|
|
388
|
+
/** Identical to .max() */
|
|
389
|
+
lte(value: number, params?: string | core.$ZodCheckLessThanParams): this;
|
|
390
|
+
max(value: number, params?: string | core.$ZodCheckLessThanParams): this;
|
|
391
|
+
/** Consider `z.int()` instead. This API is considered *legacy*; it will never be removed but a better alternative exists. */
|
|
392
|
+
int(params?: string | core.$ZodCheckNumberFormatParams): this;
|
|
393
|
+
/** @deprecated This is now identical to `.int()`. Only numbers in the safe integer range are accepted. */
|
|
394
|
+
safe(params?: string | core.$ZodCheckNumberFormatParams): this;
|
|
395
|
+
positive(params?: string | core.$ZodCheckGreaterThanParams): this;
|
|
396
|
+
nonnegative(params?: string | core.$ZodCheckGreaterThanParams): this;
|
|
397
|
+
negative(params?: string | core.$ZodCheckLessThanParams): this;
|
|
398
|
+
nonpositive(params?: string | core.$ZodCheckLessThanParams): this;
|
|
399
|
+
multipleOf(value: number, params?: string | core.$ZodCheckMultipleOfParams): this;
|
|
400
|
+
/** @deprecated Use `.multipleOf()` instead. */
|
|
401
|
+
step(value: number, params?: string | core.$ZodCheckMultipleOfParams): this;
|
|
402
|
+
/** @deprecated In v4 and later, z.number() does not allow infinite values by default. This is a no-op. */
|
|
403
|
+
finite(params?: unknown): this;
|
|
404
|
+
minValue: number | null;
|
|
405
|
+
maxValue: number | null;
|
|
406
|
+
/** @deprecated Check the `format` property instead. */
|
|
407
|
+
isInt: boolean;
|
|
408
|
+
/** @deprecated Number schemas no longer accept infinite values, so this always returns `true`. */
|
|
409
|
+
isFinite: boolean;
|
|
410
|
+
format: string | null;
|
|
411
|
+
}
|
|
412
|
+
interface ZodNumber<K extends KrustyInternals = KrustyInternals> extends _ZodNumber<core.$ZodNumberInternals<number>, K> {
|
|
413
|
+
}
|
|
414
|
+
declare const ZodNumber: core.$constructor<ZodNumber>;
|
|
415
|
+
declare function number(params?: string | core.$ZodNumberParams): ZodNumber;
|
|
416
|
+
interface ZodNumberFormat extends ZodNumber {
|
|
417
|
+
_zod: core.$ZodNumberFormatInternals;
|
|
418
|
+
}
|
|
419
|
+
declare const ZodNumberFormat: core.$constructor<ZodNumberFormat>;
|
|
420
|
+
interface ZodInt extends ZodNumberFormat {
|
|
421
|
+
}
|
|
422
|
+
declare function int(params?: string | core.$ZodCheckNumberFormatParams): ZodInt;
|
|
423
|
+
interface ZodFloat32 extends ZodNumberFormat {
|
|
424
|
+
}
|
|
425
|
+
declare function float32(params?: string | core.$ZodCheckNumberFormatParams): ZodFloat32;
|
|
426
|
+
interface ZodFloat64 extends ZodNumberFormat {
|
|
427
|
+
}
|
|
428
|
+
declare function float64(params?: string | core.$ZodCheckNumberFormatParams): ZodFloat64;
|
|
429
|
+
interface ZodInt32 extends ZodNumberFormat {
|
|
430
|
+
}
|
|
431
|
+
declare function int32(params?: string | core.$ZodCheckNumberFormatParams): ZodInt32;
|
|
432
|
+
interface ZodUInt32 extends ZodNumberFormat {
|
|
433
|
+
}
|
|
434
|
+
declare function uint32(params?: string | core.$ZodCheckNumberFormatParams): ZodUInt32;
|
|
435
|
+
interface _ZodBoolean<T extends core.$ZodBooleanInternals = core.$ZodBooleanInternals, K extends KrustyInternals = KrustyInternals> extends _KrustyType<T, K> {
|
|
436
|
+
}
|
|
437
|
+
interface ZodBoolean<K extends KrustyInternals = KrustyInternals> extends _ZodBoolean<core.$ZodBooleanInternals<boolean>, K> {
|
|
438
|
+
}
|
|
439
|
+
declare const ZodBoolean: core.$constructor<ZodBoolean>;
|
|
440
|
+
declare function boolean(params?: string | core.$ZodBooleanParams): ZodBoolean;
|
|
441
|
+
interface _ZodBigInt<T extends core.$ZodBigIntInternals = core.$ZodBigIntInternals, K extends KrustyInternals = KrustyInternals> extends _KrustyType<T, K> {
|
|
442
|
+
gte(value: bigint, params?: string | core.$ZodCheckGreaterThanParams): this;
|
|
443
|
+
/** Alias of `.gte()` */
|
|
444
|
+
min(value: bigint, params?: string | core.$ZodCheckGreaterThanParams): this;
|
|
445
|
+
gt(value: bigint, params?: string | core.$ZodCheckGreaterThanParams): this;
|
|
446
|
+
/** Alias of `.lte()` */
|
|
447
|
+
lte(value: bigint, params?: string | core.$ZodCheckLessThanParams): this;
|
|
448
|
+
max(value: bigint, params?: string | core.$ZodCheckLessThanParams): this;
|
|
449
|
+
lt(value: bigint, params?: string | core.$ZodCheckLessThanParams): this;
|
|
450
|
+
positive(params?: string | core.$ZodCheckGreaterThanParams): this;
|
|
451
|
+
negative(params?: string | core.$ZodCheckLessThanParams): this;
|
|
452
|
+
nonpositive(params?: string | core.$ZodCheckLessThanParams): this;
|
|
453
|
+
nonnegative(params?: string | core.$ZodCheckGreaterThanParams): this;
|
|
454
|
+
multipleOf(value: bigint, params?: string | core.$ZodCheckMultipleOfParams): this;
|
|
455
|
+
minValue: bigint | null;
|
|
456
|
+
maxValue: bigint | null;
|
|
457
|
+
format: string | null;
|
|
458
|
+
}
|
|
459
|
+
interface ZodBigInt<K extends KrustyInternals = KrustyInternals> extends _ZodBigInt<core.$ZodBigIntInternals<bigint>, K> {
|
|
460
|
+
}
|
|
461
|
+
declare const ZodBigInt: core.$constructor<ZodBigInt>;
|
|
462
|
+
declare function bigint(params?: string | core.$ZodBigIntParams): ZodBigInt;
|
|
463
|
+
interface ZodBigIntFormat extends ZodBigInt {
|
|
464
|
+
_zod: core.$ZodBigIntFormatInternals;
|
|
465
|
+
}
|
|
466
|
+
declare const ZodBigIntFormat: core.$constructor<ZodBigIntFormat>;
|
|
467
|
+
declare function int64(params?: string | core.$ZodBigIntFormatParams): ZodBigIntFormat;
|
|
468
|
+
declare function uint64(params?: string | core.$ZodBigIntFormatParams): ZodBigIntFormat;
|
|
469
|
+
interface ZodSymbol<K extends KrustyInternals = KrustyInternals> extends _KrustyType<core.$ZodSymbolInternals, K> {
|
|
470
|
+
}
|
|
471
|
+
declare const ZodSymbol: core.$constructor<ZodSymbol>;
|
|
472
|
+
declare function symbol(params?: string | core.$ZodSymbolParams): ZodSymbol;
|
|
473
|
+
interface ZodUndefined<K extends KrustyInternals = KrustyInternals> extends _KrustyType<core.$ZodUndefinedInternals, K> {
|
|
474
|
+
}
|
|
475
|
+
declare const ZodUndefined: core.$constructor<ZodUndefined>;
|
|
476
|
+
declare function _undefined(params?: string | core.$ZodUndefinedParams): ZodUndefined;
|
|
36
477
|
|
|
37
|
-
|
|
38
|
-
init(options: StandardHandlerOptions<TContext>): void;
|
|
478
|
+
interface ZodNull<K extends KrustyInternals = KrustyInternals> extends _KrustyType<core.$ZodNullInternals, K> {
|
|
39
479
|
}
|
|
480
|
+
declare const ZodNull: core.$constructor<ZodNull>;
|
|
481
|
+
declare function _null(params?: string | core.$ZodNullParams): ZodNull;
|
|
40
482
|
|
|
41
|
-
interface
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
483
|
+
interface ZodAny<K extends KrustyInternals = KrustyInternals> extends _KrustyType<core.$ZodAnyInternals, K> {
|
|
484
|
+
}
|
|
485
|
+
declare const ZodAny: core.$constructor<ZodAny>;
|
|
486
|
+
declare function any(): ZodAny;
|
|
487
|
+
interface ZodUnknown<K extends KrustyInternals = KrustyInternals> extends _KrustyType<core.$ZodUnknownInternals, K> {
|
|
488
|
+
}
|
|
489
|
+
declare const ZodUnknown: core.$constructor<ZodUnknown>;
|
|
490
|
+
declare function unknown(): ZodUnknown;
|
|
491
|
+
interface ZodNever<K extends KrustyInternals = KrustyInternals> extends _KrustyType<core.$ZodNeverInternals, K> {
|
|
492
|
+
}
|
|
493
|
+
declare const ZodNever: core.$constructor<ZodNever>;
|
|
494
|
+
declare function never(params?: string | core.$ZodNeverParams): ZodNever;
|
|
495
|
+
interface ZodVoid<K extends KrustyInternals = KrustyInternals> extends _KrustyType<core.$ZodVoidInternals, K> {
|
|
496
|
+
}
|
|
497
|
+
declare const ZodVoid: core.$constructor<ZodVoid>;
|
|
498
|
+
declare function _void(params?: string | core.$ZodVoidParams): ZodVoid;
|
|
499
|
+
|
|
500
|
+
interface _ZodDate<T extends core.$ZodDateInternals = core.$ZodDateInternals, K extends KrustyInternals = KrustyInternals> extends _KrustyType<T, K> {
|
|
501
|
+
min(value: number | Date, params?: string | core.$ZodCheckGreaterThanParams): this;
|
|
502
|
+
max(value: number | Date, params?: string | core.$ZodCheckLessThanParams): this;
|
|
503
|
+
/** @deprecated Not recommended. */
|
|
504
|
+
minDate: Date | null;
|
|
505
|
+
/** @deprecated Not recommended. */
|
|
506
|
+
maxDate: Date | null;
|
|
507
|
+
}
|
|
508
|
+
interface ZodDate<K extends KrustyInternals = KrustyInternals> extends _ZodDate<core.$ZodDateInternals<Date>, K> {
|
|
509
|
+
}
|
|
510
|
+
declare const ZodDate: core.$constructor<ZodDate>;
|
|
511
|
+
declare function date(params?: string | core.$ZodDateParams): ZodDate;
|
|
512
|
+
interface ZodArray<T extends core.SomeType = core.$ZodType, K extends KrustyInternals = KrustyInternals> extends _KrustyType<core.$ZodArrayInternals<T>, K>, core.$ZodArray<T> {
|
|
513
|
+
element: T;
|
|
514
|
+
min(minLength: number, params?: string | core.$ZodCheckMinLengthParams): this;
|
|
515
|
+
nonempty(params?: string | core.$ZodCheckMinLengthParams): this;
|
|
516
|
+
max(maxLength: number, params?: string | core.$ZodCheckMaxLengthParams): this;
|
|
517
|
+
length(len: number, params?: string | core.$ZodCheckLengthEqualsParams): this;
|
|
518
|
+
unwrap(): T;
|
|
519
|
+
}
|
|
520
|
+
declare const ZodArray: core.$constructor<ZodArray>;
|
|
521
|
+
declare function array<T extends core.SomeType, K extends KrustyInternals>(element: T, params?: string | core.$ZodArrayParams): ZodArray<T, K>;
|
|
522
|
+
declare function keyof<T extends ZodObject, K extends KrustyInternals>(schema: T): ZodEnum<util.KeysEnum<T['_zod']['output']>, K>;
|
|
523
|
+
interface ZodIntersection<A extends core.SomeType = core.$ZodType, B extends core.SomeType = core.$ZodType, K extends KrustyInternals = KrustyInternals> extends _KrustyType<core.$ZodIntersectionInternals<A, B>, K>, core.$ZodIntersection<A, B> {
|
|
524
|
+
}
|
|
525
|
+
declare const ZodIntersection: core.$constructor<ZodIntersection>;
|
|
526
|
+
declare function intersection<T extends core.SomeType, U extends core.SomeType, K extends KrustyInternals>(left: T, right: U): ZodIntersection<T, U, K>;
|
|
527
|
+
interface ZodTuple<T extends util.TupleItems = readonly core.$ZodType[], Rest extends core.SomeType | null = core.$ZodType | null, K extends KrustyInternals = KrustyInternals> extends _KrustyType<core.$ZodTupleInternals<T, Rest>, K>, core.$ZodTuple<T, Rest> {
|
|
528
|
+
rest<Rest extends core.SomeType = core.$ZodType>(rest: Rest): ZodTuple<T, Rest, K>;
|
|
529
|
+
}
|
|
530
|
+
declare const ZodTuple: core.$constructor<ZodTuple>;
|
|
531
|
+
declare function tuple<T extends readonly [core.SomeType, ...core.SomeType[]], K extends KrustyInternals>(items: T, params?: string | core.$ZodTupleParams): ZodTuple<T, null, K>;
|
|
532
|
+
declare function tuple<T extends readonly [core.SomeType, ...core.SomeType[]], Rest extends core.SomeType, K extends KrustyInternals>(items: T, rest: Rest, params?: string | core.$ZodTupleParams): ZodTuple<T, Rest, K>;
|
|
533
|
+
declare function tuple(items: [], params?: string | core.$ZodTupleParams): ZodTuple<[], null, KrustyInternals>;
|
|
534
|
+
interface ZodRecord<Key extends core.$ZodRecordKey = core.$ZodRecordKey, Value extends core.SomeType = core.$ZodType, K extends KrustyInternals = KrustyInternals> extends _KrustyType<core.$ZodRecordInternals<Key, Value>, K>, core.$ZodRecord<Key, Value> {
|
|
535
|
+
keyType: Key;
|
|
536
|
+
valueType: Value;
|
|
537
|
+
}
|
|
538
|
+
declare const ZodRecord: core.$constructor<ZodRecord>;
|
|
539
|
+
declare function record<Key extends core.$ZodRecordKey, Value extends core.SomeType, K extends KrustyInternals>(keyType: Key, valueType: Value, params?: string | core.$ZodRecordParams): ZodRecord<Key, Value, K>;
|
|
540
|
+
declare function partialRecord<Key extends core.$ZodRecordKey, Value extends core.SomeType>(keyType: Key, valueType: Value, params?: string | core.$ZodRecordParams): ZodRecord<Key & core.$partial, Value>;
|
|
541
|
+
interface ZodMap<Key extends core.SomeType = core.$ZodType, Value extends core.SomeType = core.$ZodType, K extends KrustyInternals = KrustyInternals> extends _KrustyType<core.$ZodMapInternals<Key, Value>, K>, core.$ZodMap<Key, Value> {
|
|
542
|
+
keyType: Key;
|
|
543
|
+
valueType: Value;
|
|
544
|
+
}
|
|
545
|
+
declare const ZodMap: core.$constructor<ZodMap>;
|
|
546
|
+
declare function map<Key extends core.SomeType, Value extends core.SomeType, K extends KrustyInternals>(keyType: Key, valueType: Value, params?: string | core.$ZodMapParams): ZodMap<Key, Value, K>;
|
|
547
|
+
interface ZodSet<T extends core.SomeType = core.$ZodType, K extends KrustyInternals = KrustyInternals> extends _KrustyType<core.$ZodSetInternals<T>, K>, core.$ZodSet<T> {
|
|
548
|
+
min(minSize: number, params?: string | core.$ZodCheckMinSizeParams): this;
|
|
549
|
+
nonempty(params?: string | core.$ZodCheckMinSizeParams): this;
|
|
550
|
+
max(maxSize: number, params?: string | core.$ZodCheckMaxSizeParams): this;
|
|
551
|
+
size(size: number, params?: string | core.$ZodCheckSizeEqualsParams): this;
|
|
552
|
+
}
|
|
553
|
+
declare const ZodSet: core.$constructor<ZodSet>;
|
|
554
|
+
declare function set<Value extends core.SomeType, K extends KrustyInternals>(valueType: Value, params?: string | core.$ZodSetParams): ZodSet<Value, K>;
|
|
555
|
+
interface ZodEnum<
|
|
556
|
+
/** @ts-expect-error Cast variance */
|
|
557
|
+
out T extends util.EnumLike = util.EnumLike, K extends KrustyInternals = KrustyInternals> extends _KrustyType<core.$ZodEnumInternals<T>, K>, core.$ZodEnum<T> {
|
|
558
|
+
enum: T;
|
|
559
|
+
options: Array<T[keyof T]>;
|
|
560
|
+
extract<const U extends readonly (keyof T)[]>(values: U, params?: string | core.$ZodEnumParams): ZodEnum<util.Flatten<Pick<T, U[number]>>, K>;
|
|
561
|
+
exclude<const U extends readonly (keyof T)[]>(values: U, params?: string | core.$ZodEnumParams): ZodEnum<util.Flatten<Omit<T, U[number]>>, K>;
|
|
562
|
+
}
|
|
563
|
+
declare const ZodEnum: core.$constructor<ZodEnum>;
|
|
564
|
+
declare function _enum<const T extends readonly string[], K extends KrustyInternals>(values: T, params?: string | core.$ZodEnumParams): ZodEnum<util.ToEnum<T[number]>, K>;
|
|
565
|
+
declare function _enum<const T extends util.EnumLike, K extends KrustyInternals>(entries: T, params?: string | core.$ZodEnumParams): ZodEnum<T, K>;
|
|
566
|
+
|
|
567
|
+
/** @deprecated This API has been merged into `z.enum()`. Use `z.enum()` instead.
|
|
568
|
+
*
|
|
569
|
+
* ```ts
|
|
570
|
+
* enum Colors { red, green, blue }
|
|
571
|
+
* z.enum(Colors);
|
|
572
|
+
* ```
|
|
573
|
+
*/
|
|
574
|
+
declare function nativeEnum<T extends util.EnumLike, K extends KrustyInternals>(entries: T, params?: string | core.$ZodEnumParams): ZodEnum<T, K>;
|
|
575
|
+
interface ZodLiteral<T extends util.Literal = util.Literal, K extends KrustyInternals = KrustyInternals> extends _KrustyType<core.$ZodLiteralInternals<T>, K>, core.$ZodLiteral<T> {
|
|
576
|
+
values: Set<T>;
|
|
577
|
+
/** @legacy Use `.values` instead. Accessing this property will throw an error if the literal accepts multiple values. */
|
|
578
|
+
value: T;
|
|
579
|
+
}
|
|
580
|
+
declare const ZodLiteral: core.$constructor<ZodLiteral>;
|
|
581
|
+
declare function literal<const T extends ReadonlyArray<util.Literal>, K extends KrustyInternals>(value: T, params?: string | core.$ZodLiteralParams): ZodLiteral<T[number], K>;
|
|
582
|
+
declare function literal<const T extends util.Literal, K extends KrustyInternals>(value: T, params?: string | core.$ZodLiteralParams): ZodLiteral<T, K>;
|
|
583
|
+
interface ZodFile<K extends KrustyInternals = KrustyInternals> extends _KrustyType<core.$ZodFileInternals, K>, core.$ZodFile {
|
|
584
|
+
min(size: number, params?: string | core.$ZodCheckMinSizeParams): this;
|
|
585
|
+
max(size: number, params?: string | core.$ZodCheckMaxSizeParams): this;
|
|
586
|
+
mime(types: util.MimeTypes | Array<util.MimeTypes>, params?: string | core.$ZodCheckMimeTypeParams): this;
|
|
587
|
+
}
|
|
588
|
+
declare const ZodFile: core.$constructor<ZodFile>;
|
|
589
|
+
declare function file(params?: string | core.$ZodFileParams): ZodFile;
|
|
590
|
+
interface ZodTransform<O = unknown, I = unknown, K extends KrustyInternals = KrustyInternals> extends _KrustyType<core.$ZodTransformInternals<O, I>, K>, core.$ZodTransform<O, I> {
|
|
591
|
+
}
|
|
592
|
+
declare const ZodTransform: core.$constructor<ZodTransform>;
|
|
593
|
+
declare function transform<I = unknown, O = I>(fn: (input: I, ctx: core.ParsePayload) => O): ZodTransform<Awaited<O>, I>;
|
|
594
|
+
interface ZodOptional<T extends core.SomeType = core.$ZodType, K extends KrustyInternals = KrustyInternals> extends _KrustyType<core.$ZodOptionalInternals<T>, K>, core.$ZodOptional<T> {
|
|
595
|
+
unwrap(): T;
|
|
596
|
+
}
|
|
597
|
+
declare const ZodOptional: core.$constructor<ZodOptional>;
|
|
598
|
+
declare function optional<T extends core.SomeType, K extends KrustyInternals>(innerType: T): ZodOptional<T, K>;
|
|
599
|
+
interface ZodNullable<T extends core.SomeType = core.$ZodType, K extends KrustyInternals = KrustyInternals> extends _KrustyType<core.$ZodNullableInternals<T>, K>, core.$ZodNullable<T> {
|
|
600
|
+
unwrap(): T;
|
|
601
|
+
}
|
|
602
|
+
declare const ZodNullable: core.$constructor<ZodNullable>;
|
|
603
|
+
declare function nullable<T extends core.SomeType, K extends KrustyInternals>(innerType: T): ZodNullable<T, K>;
|
|
604
|
+
declare function nullish<T extends core.SomeType, K extends KrustyInternals>(innerType: T): ZodOptional<ZodNullable<T, K>, K>;
|
|
605
|
+
interface ZodDefault<T extends core.SomeType = core.$ZodType, K extends KrustyInternals = KrustyInternals> extends _KrustyType<core.$ZodDefaultInternals<T>, K>, core.$ZodDefault<T> {
|
|
606
|
+
unwrap(): T;
|
|
607
|
+
/** @deprecated Use `.unwrap()` instead. */
|
|
608
|
+
removeDefault(): T;
|
|
609
|
+
}
|
|
610
|
+
declare const ZodDefault: core.$constructor<ZodDefault>;
|
|
611
|
+
declare function _default<T extends core.SomeType, K extends KrustyInternals>(innerType: T, defaultValue: util.NoUndefined<core.output<T>> | (() => util.NoUndefined<core.output<T>>)): ZodDefault<T, K>;
|
|
612
|
+
interface ZodPrefault<T extends core.SomeType = core.$ZodType, K extends KrustyInternals = KrustyInternals> extends _KrustyType<core.$ZodPrefaultInternals<T>, K>, core.$ZodPrefault<T> {
|
|
613
|
+
unwrap(): T;
|
|
614
|
+
}
|
|
615
|
+
declare const ZodPrefault: core.$constructor<ZodPrefault>;
|
|
616
|
+
declare function prefault<T extends core.SomeType, K extends KrustyInternals>(innerType: T, defaultValue: core.input<T> | (() => core.input<T>)): ZodPrefault<T, K>;
|
|
617
|
+
interface ZodNonOptional<T extends core.SomeType = core.$ZodType, K extends KrustyInternals = KrustyInternals> extends _KrustyType<core.$ZodNonOptionalInternals<T>, K>, core.$ZodNonOptional<T> {
|
|
618
|
+
unwrap(): T;
|
|
619
|
+
}
|
|
620
|
+
declare const ZodNonOptional: core.$constructor<ZodNonOptional>;
|
|
621
|
+
declare function nonoptional<T extends core.SomeType, K extends KrustyInternals>(innerType: T, params?: string | core.$ZodNonOptionalParams): ZodNonOptional<T, K>;
|
|
622
|
+
interface ZodSuccess<T extends core.SomeType = core.$ZodType, K extends KrustyInternals = KrustyInternals> extends _KrustyType<core.$ZodSuccessInternals<T>, K>, core.$ZodSuccess<T> {
|
|
623
|
+
unwrap(): T;
|
|
624
|
+
}
|
|
625
|
+
declare const ZodSuccess: core.$constructor<ZodSuccess>;
|
|
626
|
+
declare function success<T extends core.SomeType, K extends KrustyInternals>(innerType: T): ZodSuccess<T, K>;
|
|
627
|
+
interface ZodCatch<T extends core.SomeType = core.$ZodType, K extends KrustyInternals = KrustyInternals> extends _KrustyType<core.$ZodCatchInternals<T>, K>, core.$ZodCatch<T> {
|
|
628
|
+
unwrap(): T;
|
|
629
|
+
/** @deprecated Use `.unwrap()` instead. */
|
|
630
|
+
removeCatch(): T;
|
|
631
|
+
}
|
|
632
|
+
declare const ZodCatch: core.$constructor<ZodCatch>;
|
|
633
|
+
declare function _catch<T extends core.SomeType, K extends KrustyInternals>(innerType: T, catchValue: core.output<T> | ((ctx: core.$ZodCatchCtx) => core.output<T>)): ZodCatch<T, K>;
|
|
634
|
+
|
|
635
|
+
interface ZodNaN<K extends KrustyInternals = KrustyInternals> extends _KrustyType<core.$ZodNaNInternals, K>, core.$ZodNaN {
|
|
636
|
+
}
|
|
637
|
+
declare const ZodNaN: core.$constructor<ZodNaN>;
|
|
638
|
+
declare function nan(params?: string | core.$ZodNaNParams): ZodNaN;
|
|
639
|
+
interface ZodPipe<A extends core.SomeType = core.$ZodType, B extends core.SomeType = core.$ZodType, K extends KrustyInternals = KrustyInternals> extends _KrustyType<core.$ZodPipeInternals<A, B>, K>, core.$ZodPipe<A, B> {
|
|
640
|
+
in: A;
|
|
641
|
+
out: B;
|
|
642
|
+
}
|
|
643
|
+
declare const ZodPipe: core.$constructor<ZodPipe>;
|
|
644
|
+
declare function pipe<const A extends core.SomeType, B extends core.$ZodType<unknown, core.output<A>> = core.$ZodType<unknown, core.output<A>>, K extends KrustyInternals = KrustyInternals>(in_: A, out: B | core.$ZodType<unknown, core.output<A>>): ZodPipe<A, B, K>;
|
|
645
|
+
interface ZodCodec<A extends core.SomeType = core.$ZodType, B extends core.SomeType = core.$ZodType, K extends KrustyInternals = KrustyInternals> extends ZodPipe<A, B, K>, core.$ZodCodec<A, B> {
|
|
646
|
+
_zod: core.$ZodCodecInternals<A, B>;
|
|
647
|
+
def: core.$ZodCodecDef<A, B>;
|
|
648
|
+
}
|
|
649
|
+
declare const ZodCodec: core.$constructor<ZodCodec>;
|
|
650
|
+
declare function codec<const A extends core.SomeType, B extends core.SomeType = core.$ZodType, K extends KrustyInternals = KrustyInternals>(in_: A, out: B, params: {
|
|
651
|
+
decode: (value: core.output<A>, payload: core.ParsePayload<core.output<A>>) => core.util.MaybeAsync<core.input<B>>;
|
|
652
|
+
encode: (value: core.input<B>, payload: core.ParsePayload<core.input<B>>) => core.util.MaybeAsync<core.output<A>>;
|
|
653
|
+
}): ZodCodec<A, B, K>;
|
|
654
|
+
interface ZodReadonly<T extends core.SomeType = core.$ZodType, K extends KrustyInternals = KrustyInternals> extends _KrustyType<core.$ZodReadonlyInternals<T>, K>, core.$ZodReadonly<T> {
|
|
655
|
+
unwrap(): T;
|
|
656
|
+
}
|
|
657
|
+
declare const ZodReadonly: core.$constructor<ZodReadonly>;
|
|
658
|
+
declare function readonly<T extends core.SomeType, K extends KrustyInternals>(innerType: T): ZodReadonly<T, K>;
|
|
659
|
+
interface ZodTemplateLiteral<Template extends string = string, K extends KrustyInternals = KrustyInternals> extends _KrustyType<core.$ZodTemplateLiteralInternals<Template>, K>, core.$ZodTemplateLiteral<Template> {
|
|
660
|
+
}
|
|
661
|
+
declare const ZodTemplateLiteral: core.$constructor<ZodTemplateLiteral>;
|
|
662
|
+
declare function templateLiteral<const Parts extends core.$ZodTemplateLiteralPart[], K extends KrustyInternals>(parts: Parts, params?: string | core.$ZodTemplateLiteralParams): ZodTemplateLiteral<core.$PartsToTemplateLiteral<Parts>, K>;
|
|
663
|
+
interface ZodLazy<T extends core.SomeType = core.$ZodType, K extends KrustyInternals = KrustyInternals> extends _KrustyType<core.$ZodLazyInternals<T>, K>, core.$ZodLazy<T> {
|
|
664
|
+
unwrap(): T;
|
|
665
|
+
}
|
|
666
|
+
declare const ZodLazy: core.$constructor<ZodLazy>;
|
|
667
|
+
declare function lazy<T extends core.SomeType, K extends KrustyInternals>(getter: () => T): ZodLazy<T, K>;
|
|
668
|
+
interface ZodPromise<T extends core.SomeType = core.$ZodType, K extends KrustyInternals = KrustyInternals> extends _KrustyType<core.$ZodPromiseInternals<T>, K>, core.$ZodPromise<T> {
|
|
669
|
+
unwrap(): T;
|
|
670
|
+
}
|
|
671
|
+
declare const ZodPromise: core.$constructor<ZodPromise>;
|
|
672
|
+
declare function promise<T extends core.SomeType, K extends KrustyInternals>(innerType: T): ZodPromise<T, K>;
|
|
673
|
+
interface ZodFunction<Args extends core.$ZodFunctionIn = core.$ZodFunctionIn, Returns extends core.$ZodFunctionOut = core.$ZodFunctionOut, K extends KrustyInternals = KrustyInternals> extends _KrustyType<core.$ZodFunctionInternals<Args, Returns>, K>, core.$ZodFunction<Args, Returns> {
|
|
674
|
+
_def: core.$ZodFunctionDef<Args, Returns>;
|
|
675
|
+
_input: core.$InferInnerFunctionType<Args, Returns>;
|
|
676
|
+
_output: core.$InferOuterFunctionType<Args, Returns>;
|
|
677
|
+
input<const Items extends util.TupleItems, const Rest extends core.$ZodFunctionOut = core.$ZodFunctionOut>(args: Items, rest?: Rest): ZodFunction<core.$ZodTuple<Items, Rest>, Returns, K>;
|
|
678
|
+
input<NewArgs extends core.$ZodFunctionIn>(args: NewArgs): ZodFunction<NewArgs, Returns, K>;
|
|
679
|
+
input(...args: any[]): ZodFunction<any, Returns, K>;
|
|
680
|
+
output<NewReturns extends core.$ZodType>(output: NewReturns): ZodFunction<Args, NewReturns, K>;
|
|
681
|
+
}
|
|
682
|
+
declare const ZodFunction: core.$constructor<ZodFunction>;
|
|
683
|
+
declare function _function(): ZodFunction;
|
|
684
|
+
declare function _function<const In extends ReadonlyArray<core.$ZodType>, K extends KrustyInternals>(params: {
|
|
685
|
+
input: In;
|
|
686
|
+
}): ZodFunction<ZodTuple<In, null, K>, core.$ZodFunctionOut, K>;
|
|
687
|
+
declare function _function<const In extends ReadonlyArray<core.$ZodType>, const Out extends core.$ZodFunctionOut = core.$ZodFunctionOut, K extends KrustyInternals = KrustyInternals>(params: {
|
|
688
|
+
input: In;
|
|
689
|
+
output: Out;
|
|
690
|
+
}): ZodFunction<ZodTuple<In, null, K>, Out, K>;
|
|
691
|
+
declare function _function<const In extends core.$ZodFunctionIn = core.$ZodFunctionIn, K extends KrustyInternals = KrustyInternals>(params: {
|
|
692
|
+
input: In;
|
|
693
|
+
}): ZodFunction<In, core.$ZodFunctionOut, K>;
|
|
694
|
+
declare function _function<const Out extends core.$ZodFunctionOut = core.$ZodFunctionOut, K extends KrustyInternals = KrustyInternals>(params: {
|
|
695
|
+
output: Out;
|
|
696
|
+
}): ZodFunction<core.$ZodFunctionIn, Out, K>;
|
|
697
|
+
declare function _function<In extends core.$ZodFunctionIn = core.$ZodFunctionIn, Out extends core.$ZodType = core.$ZodType, K extends KrustyInternals = KrustyInternals>(params?: {
|
|
698
|
+
input: In;
|
|
699
|
+
output: Out;
|
|
700
|
+
}): ZodFunction<In, Out, K>;
|
|
701
|
+
|
|
702
|
+
interface ZodCustom<O = unknown, I = unknown, K extends KrustyInternals = KrustyInternals> extends _KrustyType<core.$ZodCustomInternals<O, I>, K>, core.$ZodCustom<O, I> {
|
|
703
|
+
}
|
|
704
|
+
declare const ZodCustom: core.$constructor<ZodCustom>;
|
|
705
|
+
declare function check<O = unknown>(fn: core.CheckFn<O>): core.$ZodCheck<O>;
|
|
706
|
+
declare function custom<O, K extends KrustyInternals>(fn?: (data: unknown) => unknown, _params?: string | core.$ZodCustomParams | undefined): ZodCustom<O, O, K>;
|
|
707
|
+
declare function refine<T>(fn: (arg: NoInfer<T>) => util.MaybeAsync<unknown>, _params?: string | core.$ZodCustomParams): core.$ZodCheck<T>;
|
|
708
|
+
declare function superRefine<T>(fn: (arg: T, payload: core.$RefinementCtx<T>) => void | Promise<void>): core.$ZodCheck<T>;
|
|
709
|
+
type ZodInstanceOfParams = core.Params<ZodCustom, core.$ZodIssueCustom, 'type' | 'check' | 'checks' | 'fn' | 'abort' | 'error' | 'params' | 'path'>;
|
|
710
|
+
declare function _instanceof<T extends typeof util.Class, K extends KrustyInternals>(cls: T, params?: ZodInstanceOfParams): ZodCustom<InstanceType<T>, InstanceType<T>, K>;
|
|
711
|
+
|
|
712
|
+
declare const stringbool: <K extends KrustyInternals = KrustyInternals>(_params?: string | core.$ZodStringBoolParams) => ZodCodec<ZodString, ZodBoolean, K>;
|
|
713
|
+
type _ZodJSONSchema<K extends KrustyInternals = KrustyInternals> = ZodUnion<[
|
|
714
|
+
ZodString,
|
|
715
|
+
ZodNumber,
|
|
716
|
+
ZodBoolean,
|
|
717
|
+
ZodNull,
|
|
718
|
+
ZodArray<ZodJSONSchema, K>,
|
|
719
|
+
ZodRecord<ZodString, ZodJSONSchema, K>
|
|
720
|
+
], K>;
|
|
721
|
+
type _ZodJSONSchemaInternals = _ZodJSONSchema['_zod'];
|
|
722
|
+
interface ZodJSONSchemaInternals extends _ZodJSONSchemaInternals {
|
|
723
|
+
output: util.JSONType;
|
|
724
|
+
input: util.JSONType;
|
|
725
|
+
}
|
|
726
|
+
interface ZodJSONSchema<K extends KrustyInternals = KrustyInternals> extends _ZodJSONSchema<K> {
|
|
727
|
+
_zod: ZodJSONSchemaInternals;
|
|
728
|
+
}
|
|
729
|
+
declare function json<K extends KrustyInternals = KrustyInternals>(params?: string | core.$ZodCustomParams): ZodJSONSchema<K>;
|
|
730
|
+
declare function preprocess<A, U extends core.SomeType, B = unknown, K extends KrustyInternals = KrustyInternals>(fn: (arg: B, ctx: core.$RefinementCtx) => A, schema: U): ZodPipe<ZodTransform<A, B>, U, K>;
|
|
731
|
+
|
|
732
|
+
declare class SchemaClass<GateNames extends string = string, K extends KrustyInternals = KrustyInternals<GateNames>> {
|
|
733
|
+
string(params?: string | core.$ZodStringParams): ZodString<K>;
|
|
734
|
+
number(params?: string | core.$ZodNumberParams): ZodNumber<K>;
|
|
735
|
+
int(params?: string | core.$ZodCheckNumberFormatParams): ZodNumber<K>;
|
|
736
|
+
boolean(params?: string | core.$ZodBooleanParams): ZodBoolean<K>;
|
|
737
|
+
null(params?: string | core.$ZodNullParams): ZodNull<K>;
|
|
738
|
+
array<T extends core.SomeType>(element: T, params?: string | core.$ZodArrayParams): ZodArray<T, K>;
|
|
739
|
+
record<Key extends core.$ZodRecordKey, Value extends core.SomeType>(keyType: Key, valueType: Value, params?: string | core.$ZodRecordParams): ZodRecord<Key, Value, K>;
|
|
740
|
+
union<const T extends readonly core.SomeType[]>(options: T, params?: string | core.$ZodUnionParams): ZodUnion<T, K>;
|
|
741
|
+
discriminatedUnion<Types extends readonly [core.$ZodTypeDiscriminable, ...core.$ZodTypeDiscriminable[]], Disc extends string>(discriminator: Disc, options: Types, params?: string | core.$ZodDiscriminatedUnionParams): ZodDiscriminatedUnion<Types, Disc, K>;
|
|
742
|
+
object<T extends core.$ZodLooseShape = Partial<Record<never, core.SomeType>>>(shape?: T, params?: string | core.$ZodObjectParams): ZodObject<core.util.Writeable<T>, core.$strip, K>;
|
|
743
|
+
date(params?: string | core.$ZodDateParams): ZodDate<K>;
|
|
744
|
+
any(): ZodAny<K>;
|
|
745
|
+
unknown(): ZodUnknown<K>;
|
|
746
|
+
never(params?: string | core.$ZodNeverParams): ZodNever<K>;
|
|
747
|
+
lazy<T extends core.SomeType>(getter: () => T): ZodLazy<T, K>;
|
|
748
|
+
json(params?: string | core.$ZodCustomParams): ZodJSONSchema<K>;
|
|
749
|
+
}
|
|
750
|
+
|
|
751
|
+
type AnySchema = $ZodType<any, any>;
|
|
89
752
|
|
|
90
|
-
export {
|
|
91
|
-
export type {
|
|
753
|
+
export { $ZodGate, KrustyType, SchemaClass, ZodAny, ZodArray, ZodBase64, ZodBase64URL, ZodBigInt, ZodBigIntFormat, ZodBoolean, ZodCIDRv4, ZodCIDRv6, ZodCUID, ZodCUID2, ZodCatch, ZodCodec, ZodCustom, ZodCustomStringFormat, ZodDate, ZodDefault, ZodDiscriminatedUnion, ZodE164, ZodEmail, ZodEmoji, ZodEnum, ZodError, ZodFile, ZodFunction, ZodGUID, ZodGate, ZodIPv4, ZodIPv6, ZodIntersection, ZodJWT, ZodKSUID, ZodLazy, ZodLiteral, ZodMap, ZodNaN, ZodNanoID, ZodNever, ZodNonOptional, ZodNull, ZodNullable, ZodNumber, ZodNumberFormat, ZodObject, ZodOptional, ZodPipe, ZodPrefault, ZodPromise, ZodReadonly, ZodRealError, ZodRecord, ZodSet, ZodString, ZodStringFormat, ZodSuccess, ZodSymbol, ZodTemplateLiteral, ZodTransform, ZodTuple, ZodULID, ZodURL, ZodUUID, ZodUndefined, ZodUnion, ZodUnknown, ZodVoid, ZodXID, _ZodString, _default, _function, any, array, base64, base64url, bigint, blob, 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, preprocess, promise, readonly, record, refine, regexp, 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 };
|
|
754
|
+
export type { $ZodGateDef, $ZodGateInternals, AnySchema, IsGateEnabled, IssueData, KrustyInternals, SafeExtendShape, ZodFloat32, ZodFloat64, ZodInt, ZodInt32, ZodIssue, ZodJSONSchema, ZodJSONSchemaInternals, ZodSafeParseError, ZodSafeParseResult, ZodSafeParseSuccess, ZodUInt32, _KrustyType, _ZodBigInt, _ZodBoolean, _ZodDate, _ZodNumber };
|