@oxog/vld 2.1.0 → 2.2.7
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/CHANGELOG.md +113 -0
- package/README.md +413 -1235
- package/dist/chunks/errors-core-CerMg2rq.js +1 -0
- package/dist/chunks/index-CkbfQQ4n.js +1 -0
- package/dist/chunks/index-yjpbvFgw.js +1 -0
- package/dist/chunks/ip-validation-g5LWgy9t.js +1 -0
- package/dist/chunks/security-Dy24T8N7.js +1 -0
- package/dist/cjs/chunks/errors-core-DrydF46s.cjs +1 -0
- package/dist/cjs/chunks/index-BEV9nG0N.cjs +1 -0
- package/dist/cjs/chunks/index-ZjHAxYdA.cjs +1 -0
- package/dist/cjs/chunks/ip-validation-BZqPamPC.cjs +1 -0
- package/dist/cjs/chunks/security-aXZVI7qW.cjs +1 -0
- package/dist/cjs/cli/bin.cjs +1 -505
- package/dist/cjs/cli/index.cjs +1 -209
- package/dist/cjs/codecs/index.cjs +1 -45
- package/dist/cjs/coercion/index.cjs +1 -588
- package/dist/cjs/compat/emitter.cjs +1 -184
- package/dist/cjs/compat/result.cjs +1 -189
- package/dist/cjs/errors.cjs +1 -180
- package/dist/cjs/index.cjs +1 -1894
- package/dist/cjs/kernel.cjs +1 -415
- package/dist/cjs/locales/af.cjs +1 -108
- package/dist/cjs/locales/ar.cjs +1 -108
- package/dist/cjs/locales/bn.cjs +1 -108
- package/dist/cjs/locales/da.cjs +1 -108
- package/dist/cjs/locales/de.cjs +1 -108
- package/dist/cjs/locales/en.cjs +1 -108
- package/dist/cjs/locales/es-MX.cjs +1 -107
- package/dist/cjs/locales/es.cjs +1 -96
- package/dist/cjs/locales/fi.cjs +1 -108
- package/dist/cjs/locales/fr.cjs +1 -96
- package/dist/cjs/locales/hi.cjs +1 -108
- package/dist/cjs/locales/id.cjs +1 -108
- package/dist/cjs/locales/index.cjs +1 -43
- package/dist/cjs/locales/it.cjs +1 -108
- package/dist/cjs/locales/ja.cjs +1 -108
- package/dist/cjs/locales/ko.cjs +1 -108
- package/dist/cjs/locales/lazy.cjs +1 -188
- package/dist/cjs/locales/nl.cjs +1 -108
- package/dist/cjs/locales/no.cjs +1 -108
- package/dist/cjs/locales/pl.cjs +1 -108
- package/dist/cjs/locales/pt-BR.cjs +1 -108
- package/dist/cjs/locales/pt.cjs +1 -108
- package/dist/cjs/locales/ru.cjs +1 -108
- package/dist/cjs/locales/runtime.cjs +1 -51
- package/dist/cjs/locales/sv.cjs +1 -108
- package/dist/cjs/locales/sw.cjs +1 -108
- package/dist/cjs/locales/th.cjs +1 -108
- package/dist/cjs/locales/tr.cjs +1 -108
- package/dist/cjs/locales/vi.cjs +1 -108
- package/dist/cjs/locales/zh.cjs +1 -108
- package/dist/cjs/mini.cjs +1 -242
- package/dist/cjs/pigment.cjs +1 -207
- package/dist/cjs/plugins/index.cjs +1 -12
- package/dist/cjs/registry.cjs +1 -37
- package/dist/cjs/v3/index.cjs +1 -425
- package/dist/cjs/v4/core/index.cjs +1 -894
- package/dist/cjs/v4/index.cjs +1 -425
- package/dist/cjs/v4/locales/index.cjs +1 -130
- package/dist/cjs/v4/mini/index.cjs +1 -509
- package/dist/cjs/v4-mini/index.cjs +1 -532
- package/dist/cjs/validators/any.cjs +1 -40
- package/dist/cjs/validators/array.cjs +1 -283
- package/dist/cjs/validators/base.cjs +1 -887
- package/dist/cjs/validators/base64.cjs +1 -73
- package/dist/cjs/validators/bigint.cjs +1 -232
- package/dist/cjs/validators/boolean.cjs +1 -146
- package/dist/cjs/validators/codec.cjs +1 -205
- package/dist/cjs/validators/custom.cjs +1 -71
- package/dist/cjs/validators/date.cjs +1 -278
- package/dist/cjs/validators/discriminated-union.cjs +1 -130
- package/dist/cjs/validators/enum.cjs +1 -154
- package/dist/cjs/validators/file.cjs +1 -130
- package/dist/cjs/validators/function.cjs +1 -63
- package/dist/cjs/validators/hex.cjs +1 -70
- package/dist/cjs/validators/index.cjs +1 -123
- package/dist/cjs/validators/intersection.cjs +1 -120
- package/dist/cjs/validators/json.cjs +1 -70
- package/dist/cjs/validators/lazy.cjs +1 -53
- package/dist/cjs/validators/literal.cjs +1 -64
- package/dist/cjs/validators/map.cjs +1 -218
- package/dist/cjs/validators/nan.cjs +1 -41
- package/dist/cjs/validators/never.cjs +1 -36
- package/dist/cjs/validators/null.cjs +1 -43
- package/dist/cjs/validators/number.cjs +1 -427
- package/dist/cjs/validators/object.cjs +1 -868
- package/dist/cjs/validators/promise.cjs +1 -115
- package/dist/cjs/validators/record.cjs +1 -262
- package/dist/cjs/validators/set.cjs +1 -203
- package/dist/cjs/validators/string-bool.cjs +1 -124
- package/dist/cjs/validators/string-formats.cjs +1 -168
- package/dist/cjs/validators/string.cjs +1 -12
- package/dist/cjs/validators/symbol.cjs +1 -62
- package/dist/cjs/validators/template-literal.cjs +1 -108
- package/dist/cjs/validators/tuple.cjs +1 -187
- package/dist/cjs/validators/uint8array.cjs +1 -106
- package/dist/cjs/validators/undefined.cjs +1 -43
- package/dist/cjs/validators/union.cjs +1 -191
- package/dist/cjs/validators/unknown.cjs +1 -40
- package/dist/cjs/validators/void.cjs +1 -48
- package/dist/cjs/validators/xor.cjs +1 -69
- package/dist/cli/bin.js +1 -406
- package/dist/cli/index.js +1 -205
- package/dist/codecs/index.js +1 -11
- package/dist/coercion/index.js +1 -579
- package/dist/compat/emitter.js +1 -180
- package/dist/compat/result.js +1 -170
- package/dist/errors-core.d.ts +32 -2
- package/dist/errors.js +1 -171
- package/dist/index.d.ts +315 -361
- package/dist/index.js +1 -1534
- package/dist/kernel.js +1 -409
- package/dist/locales/af.js +1 -106
- package/dist/locales/ar.js +1 -106
- package/dist/locales/bn.js +1 -106
- package/dist/locales/da.js +1 -106
- package/dist/locales/de.js +1 -106
- package/dist/locales/en.js +1 -106
- package/dist/locales/es-MX.js +1 -105
- package/dist/locales/es.js +1 -94
- package/dist/locales/fi.js +1 -106
- package/dist/locales/fr.js +1 -94
- package/dist/locales/hi.js +1 -106
- package/dist/locales/id.js +1 -106
- package/dist/locales/index.js +1 -29
- package/dist/locales/it.js +1 -106
- package/dist/locales/ja.js +1 -106
- package/dist/locales/ko.js +1 -106
- package/dist/locales/lazy.js +1 -177
- package/dist/locales/nl.js +1 -106
- package/dist/locales/no.js +1 -106
- package/dist/locales/pl.js +1 -106
- package/dist/locales/pt-BR.js +1 -106
- package/dist/locales/pt.js +1 -106
- package/dist/locales/ru.js +1 -106
- package/dist/locales/runtime.js +1 -41
- package/dist/locales/sv.js +1 -106
- package/dist/locales/sw.js +1 -106
- package/dist/locales/th.js +1 -106
- package/dist/locales/tr.js +1 -106
- package/dist/locales/vi.js +1 -106
- package/dist/locales/zh.js +1 -106
- package/dist/mini.d.ts +3 -3
- package/dist/mini.js +1 -156
- package/dist/pigment.js +1 -180
- package/dist/plugins/index.js +1 -1
- package/dist/registry.js +1 -34
- package/dist/utils/json-schema.d.ts +10 -1
- package/dist/v3/index.js +1 -46
- package/dist/v4/core/index.d.ts +28 -16
- package/dist/v4/core/index.js +1 -277
- package/dist/v4/index.js +1 -50
- package/dist/v4/locales/index.d.ts +4 -0
- package/dist/v4/locales/index.js +1 -77
- package/dist/v4/mini/index.js +1 -47
- package/dist/v4-mini/index.d.ts +1 -1
- package/dist/v4-mini/index.js +1 -75
- package/dist/validators/any.js +1 -37
- package/dist/validators/array.d.ts +7 -0
- package/dist/validators/array.js +1 -279
- package/dist/validators/base.d.ts +210 -17
- package/dist/validators/base.js +1 -868
- package/dist/validators/base64.js +1 -68
- package/dist/validators/bigint.d.ts +7 -0
- package/dist/validators/bigint.js +1 -228
- package/dist/validators/boolean.js +1 -142
- package/dist/validators/codec.js +1 -200
- package/dist/validators/custom.d.ts +20 -10
- package/dist/validators/custom.js +1 -67
- package/dist/validators/date.d.ts +2 -0
- package/dist/validators/date.js +1 -274
- package/dist/validators/discriminated-union.d.ts +4 -2
- package/dist/validators/discriminated-union.js +1 -123
- package/dist/validators/enum.d.ts +8 -2
- package/dist/validators/enum.js +1 -150
- package/dist/validators/file.js +1 -125
- package/dist/validators/function.js +1 -58
- package/dist/validators/hex.js +1 -65
- package/dist/validators/index.d.ts +1 -1
- package/dist/validators/index.js +1 -35
- package/dist/validators/intersection.js +1 -116
- package/dist/validators/json.js +1 -66
- package/dist/validators/lazy.js +1 -50
- package/dist/validators/literal.d.ts +8 -3
- package/dist/validators/literal.js +1 -60
- package/dist/validators/map.d.ts +7 -0
- package/dist/validators/map.js +1 -214
- package/dist/validators/nan.js +1 -38
- package/dist/validators/never.js +1 -32
- package/dist/validators/null.js +1 -40
- package/dist/validators/number.d.ts +25 -1
- package/dist/validators/number.js +1 -423
- package/dist/validators/object.d.ts +18 -2
- package/dist/validators/object.js +1 -864
- package/dist/validators/promise.d.ts +6 -7
- package/dist/validators/promise.js +1 -111
- package/dist/validators/record.d.ts +13 -8
- package/dist/validators/record.js +1 -258
- package/dist/validators/set.d.ts +5 -0
- package/dist/validators/set.js +1 -199
- package/dist/validators/string-bool.js +1 -120
- package/dist/validators/string-formats.d.ts +58 -62
- package/dist/validators/string-formats.js +1 -135
- package/dist/validators/string.d.ts +49 -10
- package/dist/validators/string.js +1 -4
- package/dist/validators/symbol.js +1 -58
- package/dist/validators/template-literal.js +1 -103
- package/dist/validators/tuple.d.ts +17 -13
- package/dist/validators/tuple.js +1 -183
- package/dist/validators/uint8array.js +1 -101
- package/dist/validators/undefined.js +1 -40
- package/dist/validators/union.d.ts +1 -0
- package/dist/validators/union.js +1 -187
- package/dist/validators/unknown.js +1 -37
- package/dist/validators/void.js +1 -44
- package/dist/validators/xor.d.ts +2 -2
- package/dist/validators/xor.js +1 -66
- package/package.json +240 -238
- package/dist/chunks/errors-core-BeiFUtZM.js +0 -81
- package/dist/chunks/index-0R2ntSud.js +0 -508
- package/dist/chunks/index-BvH403Yy.js +0 -88
- package/dist/chunks/security-B0Pd_vSY.js +0 -35
- package/dist/chunks/string-BJRQod3t.js +0 -530
- package/dist/cjs/chunks/errors-core-DWxLFs2f.cjs +0 -83
- package/dist/cjs/chunks/index-BkI37108.cjs +0 -538
- package/dist/cjs/chunks/index-Cc3bjUMX.cjs +0 -91
- package/dist/cjs/chunks/security-Dc3Jh13T.cjs +0 -37
- package/dist/cjs/chunks/string-BKZrc4hs.cjs +0 -533
package/dist/index.d.ts
CHANGED
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
*/
|
|
16
16
|
import { VldBase, type ErrorParam, type ParseResult, type SchemaMetadata, type SuperRefineContext } from './validators/base.js';
|
|
17
17
|
import type { Infer, Input, Output } from './validators/index.js';
|
|
18
|
+
import { VldError, type VldIssue } from './errors-core.js';
|
|
18
19
|
import { VldString } from './validators/string.js';
|
|
19
20
|
import { VldNumber } from './validators/number.js';
|
|
20
21
|
import { VldBoolean } from './validators/boolean.js';
|
|
@@ -23,7 +24,7 @@ import { VldStringBool } from './validators/string-bool.js';
|
|
|
23
24
|
import { VldArray } from './validators/array.js';
|
|
24
25
|
import { VldObject } from './validators/object.js';
|
|
25
26
|
import { VldUnion } from './validators/union.js';
|
|
26
|
-
import { VldLiteral } from './validators/literal.js';
|
|
27
|
+
import { VldLiteral, type LiteralValue } from './validators/literal.js';
|
|
27
28
|
import { VldBigInt } from './validators/bigint.js';
|
|
28
29
|
import { VldSymbol } from './validators/symbol.js';
|
|
29
30
|
import { VldTuple } from './validators/tuple.js';
|
|
@@ -44,7 +45,7 @@ import { VldDiscriminatedUnion } from './validators/discriminated-union.js';
|
|
|
44
45
|
import { VldXor } from './validators/xor.js';
|
|
45
46
|
import { VldJson } from './validators/json.js';
|
|
46
47
|
import { VldTemplateLiteral } from './validators/template-literal.js';
|
|
47
|
-
import { VldCustom,
|
|
48
|
+
import { VldCustom, custom as customFn } from './validators/custom.js';
|
|
48
49
|
import { VldFile } from './validators/file.js';
|
|
49
50
|
import { VldFunction } from './validators/function.js';
|
|
50
51
|
import { VldBrand, VldCatch, VldDefault, VldExactOptional, VldMeta, VldNullable, VldNullish, VldOptional, VldPipe, VldPrefault, VldPreprocess, VldReadonly, VldRefine, VldTransform } from './validators/base.js';
|
|
@@ -61,7 +62,7 @@ import { VldCoerceBoolean } from './coercion/boolean.js';
|
|
|
61
62
|
import { VldCoerceDate } from './coercion/date.js';
|
|
62
63
|
import { VldCoerceBigInt } from './coercion/bigint.js';
|
|
63
64
|
import { flattenError as flattenErrorFn, prettifyError as prettifyErrorFn, treeifyError as treeifyErrorFn } from './errors.js';
|
|
64
|
-
import { toJSONSchema as toJSONSchemaFn } from './utils/json-schema.js';
|
|
65
|
+
import { fromJSONSchema as fromJSONSchemaFn, toJSONSchema as toJSONSchemaFn } from './utils/json-schema.js';
|
|
65
66
|
import * as stringFormats from './validators/string-formats.js';
|
|
66
67
|
type NativeEnumLike = Record<string, string | number>;
|
|
67
68
|
type Constructor<T = unknown> = abstract new (...args: any[]) => T;
|
|
@@ -133,41 +134,17 @@ export declare const core: {
|
|
|
133
134
|
readonly nullish: (value: unknown) => value is null | undefined;
|
|
134
135
|
readonly cached: <T>(getter: () => T) => (() => T);
|
|
135
136
|
};
|
|
136
|
-
readonly regexes: {
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
readonly jwt: RegExp;
|
|
148
|
-
readonly nanoid: RegExp;
|
|
149
|
-
readonly cuid: RegExp;
|
|
150
|
-
readonly cuid2: RegExp;
|
|
151
|
-
readonly ulid: RegExp;
|
|
152
|
-
readonly ipv4: RegExp;
|
|
153
|
-
readonly ipv6: RegExp;
|
|
154
|
-
readonly mac: RegExp;
|
|
155
|
-
readonly cidrv4: RegExp;
|
|
156
|
-
readonly cidrv6: RegExp;
|
|
157
|
-
readonly e164: RegExp;
|
|
158
|
-
readonly isoDate: RegExp;
|
|
159
|
-
readonly isoTime: RegExp;
|
|
160
|
-
readonly isoDateTime: RegExp;
|
|
161
|
-
readonly md5: RegExp;
|
|
162
|
-
readonly sha1: RegExp;
|
|
163
|
-
readonly sha256: RegExp;
|
|
164
|
-
readonly sha384: RegExp;
|
|
165
|
-
readonly sha512: RegExp;
|
|
166
|
-
readonly xid: RegExp;
|
|
167
|
-
readonly guid: RegExp;
|
|
168
|
-
readonly httpUrl: RegExp;
|
|
169
|
-
readonly ksuid: RegExp;
|
|
170
|
-
};
|
|
137
|
+
readonly regexes: Readonly<Record<"number" | "bigint" | "boolean" | "undefined" | "integer" | "null" | "date" | "hex" | "base64" | "email" | "base64url" | "jwt" | "nanoid" | "cuid" | "cuid2" | "ulid" | "cidrv4" | "cidrv6" | "e164" | "xid" | "guid" | "ksuid" | "duration" | "ipv4" | "ipv6" | "browserEmail" | "creditCard" | "domain" | "extendedDuration" | "hostname" | "html5Email" | "httpProtocol" | "httpUrl" | "idnEmail" | "lowercase" | "md5" | "md5_base64" | "md5_base64url" | "md5_hex" | "rfc5322Email" | "sha1" | "sha1_base64" | "sha1_base64url" | "sha1_hex" | "sha256" | "sha256_base64" | "sha256_base64url" | "sha256_hex" | "sha384" | "sha384_base64" | "sha384_base64url" | "sha384_hex" | "sha512" | "sha512_base64" | "sha512_base64url" | "sha512_hex" | "unicodeEmail" | "uppercase" | "uuid4" | "uuid6" | "uuid7", RegExp> & {
|
|
138
|
+
datetime: (options?: stringFormats.ISODateTimeOptions) => RegExp;
|
|
139
|
+
emoji: () => RegExp;
|
|
140
|
+
mac: (delimiter?: string) => RegExp;
|
|
141
|
+
string: (options?: {
|
|
142
|
+
minimum?: number;
|
|
143
|
+
maximum?: number;
|
|
144
|
+
}) => RegExp;
|
|
145
|
+
time: (options?: stringFormats.ISOTimeOptions) => RegExp;
|
|
146
|
+
uuid: (version?: number) => RegExp;
|
|
147
|
+
}>;
|
|
171
148
|
readonly locales: typeof localeNamespace;
|
|
172
149
|
readonly NEVER: VldNever;
|
|
173
150
|
readonly TimePrecision: {
|
|
@@ -205,7 +182,7 @@ export { VldBase } from './validators/base.js';
|
|
|
205
182
|
export { VldIntersection } from './validators/intersection.js';
|
|
206
183
|
export { VldMeta, type SchemaMetadata } from './validators/base.js';
|
|
207
184
|
export { VldBase as ZodType, VldAny as ZodAny, VldArray as ZodArray, VldBigInt as ZodBigInt, VldBigInt as ZodBigIntFormat, VldBoolean as ZodBoolean, VldBrand as ZodBranded, VldCatch as ZodCatch, VldCodec as ZodCodec, VldCustom as ZodCustom, VldCustom as ZodSuccess, VldDate as ZodDate, VldDefault as ZodDefault, VldDiscriminatedUnion as ZodDiscriminatedUnion, VldEnum as ZodEnum, VldExactOptional as ZodExactOptional, VldFile as ZodFile, VldFunction as ZodFunction, VldIntersection as ZodIntersection, VldJson as ZodJSON, VldLazy as ZodLazy, VldLiteral as ZodLiteral, VldMap as ZodMap, VldMeta as ZodMeta, VldNan as ZodNaN, VldNever as ZodNever, VldNull as ZodNull, VldNullable as ZodNullable, VldNumber as ZodNumber, VldNumber as ZodNumberFormat, VldObject as ZodObject, VldOptional as ZodOptional, VldPipe as ZodPipe, VldPrefault as ZodPrefault, VldPreprocess as ZodPreprocess, VldPromise as ZodPromise, VldReadonly as ZodReadonly, VldRecord as ZodRecord, VldRefine as ZodNonOptional, VldSet as ZodSet, VldString as ZodString, VldSymbol as ZodSymbol, VldTemplateLiteral as ZodTemplateLiteral, VldTuple as ZodTuple, VldTransform as ZodTransform, VldUndefined as ZodUndefined, VldUnion as ZodUnion, VldUnknown as ZodUnknown, VldVoid as ZodVoid, VldXor as ZodXor };
|
|
208
|
-
export { VldStringFormat as ZodBase64, VldStringFormat as ZodBase64URL, VldStringFormat as ZodCIDRv4, VldStringFormat as ZodCIDRv6, VldStringFormat as ZodCUID, VldStringFormat as ZodCUID2, VldStringFormat as ZodCustomStringFormat, VldStringFormat as ZodE164, VldStringFormat as ZodEmail, VldStringFormat as ZodEmoji, VldStringFormat as ZodGUID, VldStringFormat as ZodIPv4, VldStringFormat as ZodIPv6, VldStringFormat as ZodISODate, VldStringFormat as ZodISODateTime, VldStringFormat as ZodISODuration, VldStringFormat as ZodISOTime, VldStringFormat as ZodJWT, VldStringFormat as ZodKSUID, VldStringFormat as ZodMAC, VldStringFormat as ZodNanoID, VldStringFormat as ZodStringFormat, VldStringFormat as ZodULID, VldStringFormat as ZodURL, VldStringFormat as ZodUUID, VldStringFormat as ZodXID } from './validators/string-formats.js';
|
|
185
|
+
export { VldStringFormat as ZodBase64, VldStringFormat as ZodBase64URL, VldStringFormat as ZodCIDRv4, VldStringFormat as ZodCIDRv6, VldStringFormat as ZodCUID, VldStringFormat as ZodCUID2, VldStringFormat as ZodCreditCard, VldStringFormat as ZodCustomStringFormat, VldStringFormat as ZodE164, VldStringFormat as ZodEmail, VldStringFormat as ZodEmoji, VldStringFormat as ZodGUID, VldStringFormat as ZodIPv4, VldStringFormat as ZodIPv6, VldStringFormat as ZodISODate, VldStringFormat as ZodISODateTime, VldStringFormat as ZodISODuration, VldStringFormat as ZodISOTime, VldStringFormat as ZodJWT, VldStringFormat as ZodKSUID, VldStringFormat as ZodMAC, VldStringFormat as ZodNanoID, VldStringFormat as ZodStringFormat, VldStringFormat as ZodULID, VldStringFormat as ZodURL, VldStringFormat as ZodUUID, VldStringFormat as ZodXID } from './validators/string-formats.js';
|
|
209
186
|
export { VldError as ZodError, VldError as ZodRealError } from './errors.js';
|
|
210
187
|
export { registry, globalRegistry, type SchemaRegistry } from './registry.js';
|
|
211
188
|
export { setLocale, setLocaleAsync, registerLocale, getLocale, getMessages, isLocaleLoaded, getSupportedLocales, isLocaleSupported, type Locale } from './locales/index.js';
|
|
@@ -213,6 +190,46 @@ export { VldError, VldIssue, VldErrorCode, VldErrorTree, VldFlattenedError, VldE
|
|
|
213
190
|
export { base64ToUint8Array, uint8ArrayToBase64, uint8ArrayToBase64Url, hexToUint8Array, uint8ArrayToHex, stringToUint8Array, uint8ArrayToString } from './utils/codec-utils.js';
|
|
214
191
|
export type { CodecTransform } from './validators/codec.js';
|
|
215
192
|
export { invertCodec, stringToNumber, stringToInt, stringToBigInt, numberToBigInt, stringToBoolean, isoDatetimeToDate, epochSecondsToDate, epochMillisToDate, jsonCodec, stringToURL, stringToHttpURL, uriComponent, base64ToBytes, base64UrlToBytes, base64urlToBytes, hexToBytes, hexLowerToBytes, utf8ToBytes, bytesToUtf8, base64Json, jwtPayload } from './codecs/index.js';
|
|
193
|
+
type AnySchema = VldBase<any, any>;
|
|
194
|
+
type EnumValue = string | number;
|
|
195
|
+
type ShapeSchema = {
|
|
196
|
+
parse(value: unknown): any;
|
|
197
|
+
};
|
|
198
|
+
type SchemaOutput<T extends ShapeSchema> = ReturnType<T['parse']>;
|
|
199
|
+
type ObjectOutput<T extends Record<string, ShapeSchema>> = {
|
|
200
|
+
[K in keyof T as undefined extends SchemaOutput<T[K]> ? never : K]: SchemaOutput<T[K]>;
|
|
201
|
+
} & {
|
|
202
|
+
[K in keyof T as undefined extends SchemaOutput<T[K]> ? K : never]?: SchemaOutput<T[K]>;
|
|
203
|
+
};
|
|
204
|
+
declare function objectFactory<const T extends Record<string, ShapeSchema> = Record<never, never>>(shape?: T): VldObject<ObjectOutput<T>>;
|
|
205
|
+
declare function strictObjectFactory<const T extends Record<string, ShapeSchema>>(shape: T): VldObject<ObjectOutput<T>>;
|
|
206
|
+
declare function looseObjectFactory<const T extends Record<string, ShapeSchema>>(shape: T): VldObject<ObjectOutput<T>>;
|
|
207
|
+
declare function tupleFactory<const T extends readonly AnySchema[], TRest extends AnySchema>(items: T, rest: TRest, params?: unknown): VldTuple<T, TRest>;
|
|
208
|
+
declare function tupleFactory<const T extends readonly AnySchema[]>(items: T, params?: string | Record<string, unknown>): VldTuple<T>;
|
|
209
|
+
declare function tupleFactory<const T extends readonly AnySchema[]>(...items: T): VldTuple<T>;
|
|
210
|
+
declare function unionFactory<const T extends readonly AnySchema[]>(options: T, params?: unknown): VldUnion<T>;
|
|
211
|
+
declare function unionFactory<const T extends readonly AnySchema[]>(...options: T): VldUnion<T>;
|
|
212
|
+
declare function xorFactory<const T extends readonly AnySchema[]>(options: T, params?: unknown): VldXor<T>;
|
|
213
|
+
declare function xorFactory<const T extends readonly AnySchema[]>(...options: T): VldXor<T>;
|
|
214
|
+
declare function discriminatedUnionFactory<K extends string, const T extends readonly AnySchema[]>(discriminator: K, options: T, params?: unknown): VldDiscriminatedUnion<K, T>;
|
|
215
|
+
declare function discriminatedUnionFactory<K extends string, const T extends readonly AnySchema[]>(discriminator: K, ...options: T): VldDiscriminatedUnion<K, T>;
|
|
216
|
+
declare function recordFactory<V>(value: VldBase<unknown, V>): VldRecord<V>;
|
|
217
|
+
declare function recordFactory<K extends PropertyKey, V>(key: VldBase<unknown, K>, value: VldBase<unknown, V>, params?: unknown): VldRecord<V, K>;
|
|
218
|
+
declare function partialRecordFactory<V>(value: VldBase<unknown, V>): VldRecord<V | undefined>;
|
|
219
|
+
declare function partialRecordFactory<K extends PropertyKey, V>(key: VldBase<unknown, K>, value: VldBase<unknown, V>, params?: unknown): VldRecord<V | undefined, K>;
|
|
220
|
+
declare function looseRecordFactory<V>(value: VldBase<unknown, V>): VldBase<unknown, Record<string, V>>;
|
|
221
|
+
declare function looseRecordFactory<K extends PropertyKey, V>(key: VldBase<unknown, K>, value: VldBase<unknown, V>, params?: unknown): VldBase<unknown, Record<K, V>>;
|
|
222
|
+
declare function literalFactory<const T extends readonly LiteralValue[]>(values: T, params?: unknown): VldLiteral<T[number]>;
|
|
223
|
+
declare function literalFactory<const T extends LiteralValue>(value: T, params?: unknown): VldLiteral<T>;
|
|
224
|
+
declare function enumFactoryCompat<const T extends readonly [EnumValue, ...EnumValue[]]>(values: T, params?: unknown): VldEnum<T>;
|
|
225
|
+
declare function enumFactoryCompat<const T extends readonly [EnumValue, ...EnumValue[]]>(...values: T): VldEnum<T>;
|
|
226
|
+
declare function enumFactoryCompat<T extends NativeEnumLike>(entries: T, params?: unknown): VldEnum<any>;
|
|
227
|
+
/** Returns a copy of the schema with every nested object's properties made optional. */
|
|
228
|
+
export declare function deepPartial<T extends AnySchema>(schema: T): T;
|
|
229
|
+
/** Returns a copy of the schema with every pipe replaced by its input side. */
|
|
230
|
+
export declare function input<T extends AnySchema>(schema: T): T;
|
|
231
|
+
/** Returns a copy of the schema with every pipe replaced by its output side. */
|
|
232
|
+
export declare function output<T extends AnySchema>(schema: T): T;
|
|
216
233
|
/**
|
|
217
234
|
* Main API object with factory methods for all validators
|
|
218
235
|
*/
|
|
@@ -236,22 +253,25 @@ export declare const v: {
|
|
|
236
253
|
caseSensitive?: boolean;
|
|
237
254
|
}) => VldStringBool;
|
|
238
255
|
array: <T>(item: VldBase<unknown, T>) => VldArray<T>;
|
|
239
|
-
object:
|
|
240
|
-
strictObject:
|
|
241
|
-
looseObject:
|
|
242
|
-
tuple:
|
|
243
|
-
record:
|
|
244
|
-
partialRecord:
|
|
245
|
-
looseRecord:
|
|
256
|
+
object: typeof objectFactory;
|
|
257
|
+
strictObject: typeof strictObjectFactory;
|
|
258
|
+
looseObject: typeof looseObjectFactory;
|
|
259
|
+
tuple: typeof tupleFactory;
|
|
260
|
+
record: typeof recordFactory;
|
|
261
|
+
partialRecord: typeof partialRecordFactory;
|
|
262
|
+
looseRecord: typeof looseRecordFactory;
|
|
246
263
|
set: <T>(item: VldBase<unknown, T>) => VldSet<T>;
|
|
247
264
|
map: <K, V>(key: VldBase<unknown, K>, value: VldBase<unknown, V>) => VldMap<K, V>;
|
|
248
|
-
union:
|
|
265
|
+
union: typeof unionFactory;
|
|
249
266
|
intersection: <A, B>(first: VldBase<unknown, A>, second: VldBase<unknown, B>) => VldIntersection<A, B>;
|
|
250
|
-
discriminatedUnion:
|
|
251
|
-
xor:
|
|
267
|
+
discriminatedUnion: typeof discriminatedUnionFactory;
|
|
268
|
+
xor: typeof xorFactory;
|
|
252
269
|
keyof: <T extends Record<string, any>>(schema: VldObject<T>) => VldEnum<[string, ...string[]]>;
|
|
253
|
-
|
|
254
|
-
|
|
270
|
+
deepPartial: typeof deepPartial;
|
|
271
|
+
input: typeof input;
|
|
272
|
+
output: typeof output;
|
|
273
|
+
literal: typeof literalFactory;
|
|
274
|
+
enum: typeof enumFactoryCompat;
|
|
255
275
|
nativeEnum: <T extends NativeEnumLike>(enumObject: T) => VldEnum<any>;
|
|
256
276
|
any: () => VldAny;
|
|
257
277
|
unknown: () => VldUnknown;
|
|
@@ -288,9 +308,9 @@ export declare const v: {
|
|
|
288
308
|
exactOptional: <T>(validator: VldBase<unknown, T>) => VldExactOptional<unknown, T>;
|
|
289
309
|
nonoptional: <T>(validator: VldBase<unknown, T | undefined>, message?: RefinementMessage) => VldRefine<unknown, T | undefined, Exclude<T, undefined>>;
|
|
290
310
|
catch: <T>(validator: VldBase<unknown, T>, fallbackValue: T) => VldCatch<unknown, T>;
|
|
291
|
-
prefault: <
|
|
311
|
+
prefault: <TInput, TOutput>(validator: VldBase<TInput, TOutput>, defaultValue: TInput | (() => TInput)) => VldPrefault<TInput, TOutput>;
|
|
292
312
|
readonly: <T>(validator: VldBase<unknown, T>) => VldReadonly<unknown, T>;
|
|
293
|
-
pipe: <TInput, TIntermediate, TOutput>(first: VldBase<TInput, TIntermediate>, second: VldBase<
|
|
313
|
+
pipe: <TInput, TIntermediate, TOutput>(first: VldBase<TInput, TIntermediate>, second: VldBase<any, TOutput>) => VldPipe<TInput, TIntermediate, TOutput>;
|
|
294
314
|
clone: <T extends VldBase<any, any>>(schema: T) => T;
|
|
295
315
|
describe: <TInput, TOutput>(schemaOrDescription: VldBase<TInput, TOutput> | string, description?: string) => VldMeta<unknown, unknown>;
|
|
296
316
|
meta: <TInput, TOutput>(schemaOrMetadata: VldBase<TInput, TOutput> | Partial<SchemaMetadata>, metadata?: Partial<SchemaMetadata>) => VldMeta<unknown, unknown>;
|
|
@@ -316,41 +336,17 @@ export declare const v: {
|
|
|
316
336
|
readonly nullish: (value: unknown) => value is null | undefined;
|
|
317
337
|
readonly cached: <T>(getter: () => T) => (() => T);
|
|
318
338
|
};
|
|
319
|
-
readonly regexes: {
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
readonly jwt: RegExp;
|
|
331
|
-
readonly nanoid: RegExp;
|
|
332
|
-
readonly cuid: RegExp;
|
|
333
|
-
readonly cuid2: RegExp;
|
|
334
|
-
readonly ulid: RegExp;
|
|
335
|
-
readonly ipv4: RegExp;
|
|
336
|
-
readonly ipv6: RegExp;
|
|
337
|
-
readonly mac: RegExp;
|
|
338
|
-
readonly cidrv4: RegExp;
|
|
339
|
-
readonly cidrv6: RegExp;
|
|
340
|
-
readonly e164: RegExp;
|
|
341
|
-
readonly isoDate: RegExp;
|
|
342
|
-
readonly isoTime: RegExp;
|
|
343
|
-
readonly isoDateTime: RegExp;
|
|
344
|
-
readonly md5: RegExp;
|
|
345
|
-
readonly sha1: RegExp;
|
|
346
|
-
readonly sha256: RegExp;
|
|
347
|
-
readonly sha384: RegExp;
|
|
348
|
-
readonly sha512: RegExp;
|
|
349
|
-
readonly xid: RegExp;
|
|
350
|
-
readonly guid: RegExp;
|
|
351
|
-
readonly httpUrl: RegExp;
|
|
352
|
-
readonly ksuid: RegExp;
|
|
353
|
-
};
|
|
339
|
+
readonly regexes: Readonly<Record<"number" | "bigint" | "boolean" | "undefined" | "integer" | "null" | "date" | "hex" | "base64" | "email" | "base64url" | "jwt" | "nanoid" | "cuid" | "cuid2" | "ulid" | "cidrv4" | "cidrv6" | "e164" | "xid" | "guid" | "ksuid" | "duration" | "ipv4" | "ipv6" | "browserEmail" | "creditCard" | "domain" | "extendedDuration" | "hostname" | "html5Email" | "httpProtocol" | "httpUrl" | "idnEmail" | "lowercase" | "md5" | "md5_base64" | "md5_base64url" | "md5_hex" | "rfc5322Email" | "sha1" | "sha1_base64" | "sha1_base64url" | "sha1_hex" | "sha256" | "sha256_base64" | "sha256_base64url" | "sha256_hex" | "sha384" | "sha384_base64" | "sha384_base64url" | "sha384_hex" | "sha512" | "sha512_base64" | "sha512_base64url" | "sha512_hex" | "unicodeEmail" | "uppercase" | "uuid4" | "uuid6" | "uuid7", RegExp> & {
|
|
340
|
+
datetime: (options?: stringFormats.ISODateTimeOptions) => RegExp;
|
|
341
|
+
emoji: () => RegExp;
|
|
342
|
+
mac: (delimiter?: string) => RegExp;
|
|
343
|
+
string: (options?: {
|
|
344
|
+
minimum?: number;
|
|
345
|
+
maximum?: number;
|
|
346
|
+
}) => RegExp;
|
|
347
|
+
time: (options?: stringFormats.ISOTimeOptions) => RegExp;
|
|
348
|
+
uuid: (version?: number) => RegExp;
|
|
349
|
+
}>;
|
|
354
350
|
readonly locales: typeof localeNamespace;
|
|
355
351
|
readonly NEVER: VldNever;
|
|
356
352
|
readonly TimePrecision: {
|
|
@@ -396,7 +392,7 @@ export declare const v: {
|
|
|
396
392
|
locales: typeof localeNamespace;
|
|
397
393
|
lazy: <T>(schemaGetter: () => VldBase<unknown, T>) => VldLazy<unknown, T>;
|
|
398
394
|
json: <T = unknown>(schema?: VldBase<unknown, T>) => VldJson<T>;
|
|
399
|
-
custom:
|
|
395
|
+
custom: typeof customFn;
|
|
400
396
|
file: () => VldFile;
|
|
401
397
|
function: () => VldFunction;
|
|
402
398
|
preprocess: <TInput, TOutput>(preprocessor: (input: unknown) => unknown, schema: VldBase<TInput, TOutput>) => VldPreprocess<TInput, TOutput>;
|
|
@@ -410,9 +406,9 @@ export declare const v: {
|
|
|
410
406
|
email: (options?: {
|
|
411
407
|
pattern?: RegExp;
|
|
412
408
|
}) => stringFormats.VldStringFormat;
|
|
413
|
-
url: () =>
|
|
409
|
+
url: (options?: stringFormats.URLFormatOptions) => stringFormats.VldStringFormat;
|
|
414
410
|
uuid: (options?: {
|
|
415
|
-
version?:
|
|
411
|
+
version?: stringFormats.UUIDVersion;
|
|
416
412
|
}) => stringFormats.VldStringFormat;
|
|
417
413
|
uuidv4: () => stringFormats.VldStringFormat;
|
|
418
414
|
uuidv6: () => stringFormats.VldStringFormat;
|
|
@@ -432,12 +428,20 @@ export declare const v: {
|
|
|
432
428
|
mac: () => stringFormats.VldStringFormat;
|
|
433
429
|
cidrv4: () => stringFormats.VldStringFormat;
|
|
434
430
|
cidrv6: () => stringFormats.VldStringFormat;
|
|
431
|
+
creditCard: (params?: {
|
|
432
|
+
message?: string;
|
|
433
|
+
}) => stringFormats.VldStringFormat;
|
|
435
434
|
e164: () => stringFormats.VldStringFormat;
|
|
436
435
|
hash: (algorithm: "md5" | "sha1" | "sha256" | "sha384" | "sha512") => stringFormats.VldStringFormat;
|
|
437
436
|
iso: {
|
|
437
|
+
ZodISODate: typeof stringFormats.VldStringFormat;
|
|
438
|
+
ZodISODateTime: typeof stringFormats.VldStringFormat;
|
|
439
|
+
ZodISODuration: typeof stringFormats.VldStringFormat;
|
|
440
|
+
ZodISOTime: typeof stringFormats.VldStringFormat;
|
|
438
441
|
date: () => stringFormats.VldStringFormat;
|
|
439
|
-
time: () => stringFormats.VldStringFormat;
|
|
440
|
-
|
|
442
|
+
time: (options?: stringFormats.ISOTimeOptions) => stringFormats.VldStringFormat;
|
|
443
|
+
datetime: (options?: stringFormats.ISODateTimeOptions) => stringFormats.VldStringFormat;
|
|
444
|
+
dateTime: (options?: stringFormats.ISODateTimeOptions) => stringFormats.VldStringFormat;
|
|
441
445
|
duration: () => stringFormats.VldStringFormat;
|
|
442
446
|
};
|
|
443
447
|
stringFormat: (name: string, validator: ((val: string) => boolean) | RegExp) => stringFormats.VldStringFormat;
|
|
@@ -472,41 +476,17 @@ export declare const v: {
|
|
|
472
476
|
guid: () => stringFormats.VldStringFormat;
|
|
473
477
|
httpUrl: () => stringFormats.VldStringFormat;
|
|
474
478
|
ksuid: () => stringFormats.VldStringFormat;
|
|
475
|
-
regexes: {
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
readonly jwt: RegExp;
|
|
487
|
-
readonly nanoid: RegExp;
|
|
488
|
-
readonly cuid: RegExp;
|
|
489
|
-
readonly cuid2: RegExp;
|
|
490
|
-
readonly ulid: RegExp;
|
|
491
|
-
readonly ipv4: RegExp;
|
|
492
|
-
readonly ipv6: RegExp;
|
|
493
|
-
readonly mac: RegExp;
|
|
494
|
-
readonly cidrv4: RegExp;
|
|
495
|
-
readonly cidrv6: RegExp;
|
|
496
|
-
readonly e164: RegExp;
|
|
497
|
-
readonly isoDate: RegExp;
|
|
498
|
-
readonly isoTime: RegExp;
|
|
499
|
-
readonly isoDateTime: RegExp;
|
|
500
|
-
readonly md5: RegExp;
|
|
501
|
-
readonly sha1: RegExp;
|
|
502
|
-
readonly sha256: RegExp;
|
|
503
|
-
readonly sha384: RegExp;
|
|
504
|
-
readonly sha512: RegExp;
|
|
505
|
-
readonly xid: RegExp;
|
|
506
|
-
readonly guid: RegExp;
|
|
507
|
-
readonly httpUrl: RegExp;
|
|
508
|
-
readonly ksuid: RegExp;
|
|
509
|
-
};
|
|
479
|
+
regexes: Readonly<Record<"number" | "bigint" | "boolean" | "undefined" | "integer" | "null" | "date" | "hex" | "base64" | "email" | "base64url" | "jwt" | "nanoid" | "cuid" | "cuid2" | "ulid" | "cidrv4" | "cidrv6" | "e164" | "xid" | "guid" | "ksuid" | "duration" | "ipv4" | "ipv6" | "browserEmail" | "creditCard" | "domain" | "extendedDuration" | "hostname" | "html5Email" | "httpProtocol" | "httpUrl" | "idnEmail" | "lowercase" | "md5" | "md5_base64" | "md5_base64url" | "md5_hex" | "rfc5322Email" | "sha1" | "sha1_base64" | "sha1_base64url" | "sha1_hex" | "sha256" | "sha256_base64" | "sha256_base64url" | "sha256_hex" | "sha384" | "sha384_base64" | "sha384_base64url" | "sha384_hex" | "sha512" | "sha512_base64" | "sha512_base64url" | "sha512_hex" | "unicodeEmail" | "uppercase" | "uuid4" | "uuid6" | "uuid7", RegExp> & {
|
|
480
|
+
datetime: (options?: stringFormats.ISODateTimeOptions) => RegExp;
|
|
481
|
+
emoji: () => RegExp;
|
|
482
|
+
mac: (delimiter?: string) => RegExp;
|
|
483
|
+
string: (options?: {
|
|
484
|
+
minimum?: number;
|
|
485
|
+
maximum?: number;
|
|
486
|
+
}) => RegExp;
|
|
487
|
+
time: (options?: stringFormats.ISOTimeOptions) => RegExp;
|
|
488
|
+
uuid: (version?: number) => RegExp;
|
|
489
|
+
}>;
|
|
510
490
|
templateLiteral: (...components: (VldBase<any, any> | string)[]) => VldTemplateLiteral;
|
|
511
491
|
base64Bytes: () => VldBase64;
|
|
512
492
|
hexBytes: () => VldHex;
|
|
@@ -525,21 +505,84 @@ export declare const v: {
|
|
|
525
505
|
safeDecode: <T>(schema: VldBase<unknown, T>, value: unknown) => ParseResult<T>;
|
|
526
506
|
decodeAsync: <T>(schema: VldBase<unknown, T>, value: unknown) => Promise<T>;
|
|
527
507
|
safeDecodeAsync: <T>(schema: VldBase<unknown, T>, value: unknown) => Promise<ParseResult<T>>;
|
|
528
|
-
encode: <TInput, TOutput>(schema: VldBase<TInput, TOutput>, value:
|
|
529
|
-
safeEncode: <TInput, TOutput>(schema: VldBase<TInput, TOutput>, value:
|
|
530
|
-
encodeAsync: <TInput, TOutput>(schema: VldBase<TInput, TOutput>, value:
|
|
531
|
-
safeEncodeAsync: <TInput, TOutput>(schema: VldBase<TInput, TOutput>, value:
|
|
508
|
+
encode: <TInput, TOutput>(schema: VldBase<TInput, TOutput>, value: TOutput) => TInput;
|
|
509
|
+
safeEncode: <TInput, TOutput>(schema: VldBase<TInput, TOutput>, value: TOutput) => ParseResult<TInput>;
|
|
510
|
+
encodeAsync: <TInput, TOutput>(schema: VldBase<TInput, TOutput>, value: TOutput) => Promise<TInput>;
|
|
511
|
+
safeEncodeAsync: <TInput, TOutput>(schema: VldBase<TInput, TOutput>, value: TOutput) => Promise<ParseResult<TInput>>;
|
|
532
512
|
formatError: (error: Error) => FormattedError;
|
|
533
513
|
treeifyError: typeof treeifyErrorFn;
|
|
534
514
|
prettifyError: typeof prettifyErrorFn;
|
|
535
515
|
flattenError: typeof flattenErrorFn;
|
|
536
516
|
toJSONSchema: typeof toJSONSchemaFn;
|
|
517
|
+
fromJSONSchema: typeof fromJSONSchemaFn;
|
|
537
518
|
};
|
|
538
519
|
export declare namespace v {
|
|
539
520
|
type infer<T extends VldBase<any, any>> = Infer<T>;
|
|
540
521
|
type input<T extends VldBase<any, any>> = Input<T>;
|
|
541
522
|
type output<T extends VldBase<any, any>> = Output<T>;
|
|
523
|
+
type Schema<Output = any, _Def = any, Input = Output> = VldBase<Input, Output>;
|
|
524
|
+
type ZodSchema<Output = any, _Def = any, Input = Output> = VldBase<Input, Output>;
|
|
525
|
+
type ZodType<Output = any, _Def = any, Input = Output> = VldBase<Input, Output>;
|
|
526
|
+
type ZodTypeAny = VldBase<any, any>;
|
|
527
|
+
type ZodTypeDef = any;
|
|
528
|
+
type ZodError<_T = any> = VldError;
|
|
529
|
+
type ZodIssue = VldIssue;
|
|
530
|
+
type SafeParseSuccess<T> = {
|
|
531
|
+
readonly success: true;
|
|
532
|
+
readonly data: T;
|
|
533
|
+
readonly error?: undefined;
|
|
534
|
+
};
|
|
535
|
+
type SafeParseError<_T = unknown> = {
|
|
536
|
+
readonly success: false;
|
|
537
|
+
readonly error: VldError;
|
|
538
|
+
readonly data?: undefined;
|
|
539
|
+
};
|
|
540
|
+
type SafeParseReturnType<_Input, Output> = ParseResult<Output>;
|
|
541
|
+
type CustomErrorParams = {
|
|
542
|
+
message?: string;
|
|
543
|
+
path?: (string | number)[];
|
|
544
|
+
params?: {
|
|
545
|
+
[k: string]: any;
|
|
546
|
+
};
|
|
547
|
+
fatal?: boolean;
|
|
548
|
+
};
|
|
542
549
|
}
|
|
550
|
+
export declare namespace z {
|
|
551
|
+
type infer<T extends VldBase<any, any>> = Infer<T>;
|
|
552
|
+
type input<T extends VldBase<any, any>> = Input<T>;
|
|
553
|
+
type output<T extends VldBase<any, any>> = Output<T>;
|
|
554
|
+
type Schema<Output = any, _Def = any, Input = Output> = VldBase<Input, Output>;
|
|
555
|
+
type ZodSchema<Output = any, _Def = any, Input = Output> = VldBase<Input, Output>;
|
|
556
|
+
type ZodType<Output = any, _Def = any, Input = Output> = VldBase<Input, Output>;
|
|
557
|
+
type ZodTypeAny = VldBase<any, any>;
|
|
558
|
+
type ZodTypeDef = any;
|
|
559
|
+
type ZodError<_T = any> = VldError;
|
|
560
|
+
type ZodIssue = VldIssue;
|
|
561
|
+
type SafeParseSuccess<T> = {
|
|
562
|
+
readonly success: true;
|
|
563
|
+
readonly data: T;
|
|
564
|
+
readonly error?: undefined;
|
|
565
|
+
};
|
|
566
|
+
type SafeParseError<_T = unknown> = {
|
|
567
|
+
readonly success: false;
|
|
568
|
+
readonly error: VldError;
|
|
569
|
+
readonly data?: undefined;
|
|
570
|
+
};
|
|
571
|
+
type SafeParseReturnType<_Input, Output> = ParseResult<Output>;
|
|
572
|
+
type CustomErrorParams = {
|
|
573
|
+
message?: string;
|
|
574
|
+
path?: (string | number)[];
|
|
575
|
+
params?: {
|
|
576
|
+
[k: string]: any;
|
|
577
|
+
};
|
|
578
|
+
fatal?: boolean;
|
|
579
|
+
};
|
|
580
|
+
}
|
|
581
|
+
export type ZodSchema<Output = any, _Def = any, Input = Output> = VldBase<Input, Output>;
|
|
582
|
+
export type ZodTypeAny = VldBase<any, any>;
|
|
583
|
+
export type ZodTypeDef = any;
|
|
584
|
+
export type { VldIssue as ZodIssue };
|
|
585
|
+
export type { SafeParseSuccess, SafeParseError, SafeParseReturnType, CustomErrorParams } from './validators/base.js';
|
|
543
586
|
/**
|
|
544
587
|
* Zod-compatible namespace alias.
|
|
545
588
|
*/
|
|
@@ -563,22 +606,25 @@ export declare const z: {
|
|
|
563
606
|
caseSensitive?: boolean;
|
|
564
607
|
}) => VldStringBool;
|
|
565
608
|
array: <T>(item: VldBase<unknown, T>) => VldArray<T>;
|
|
566
|
-
object:
|
|
567
|
-
strictObject:
|
|
568
|
-
looseObject:
|
|
569
|
-
tuple:
|
|
570
|
-
record:
|
|
571
|
-
partialRecord:
|
|
572
|
-
looseRecord:
|
|
609
|
+
object: typeof objectFactory;
|
|
610
|
+
strictObject: typeof strictObjectFactory;
|
|
611
|
+
looseObject: typeof looseObjectFactory;
|
|
612
|
+
tuple: typeof tupleFactory;
|
|
613
|
+
record: typeof recordFactory;
|
|
614
|
+
partialRecord: typeof partialRecordFactory;
|
|
615
|
+
looseRecord: typeof looseRecordFactory;
|
|
573
616
|
set: <T>(item: VldBase<unknown, T>) => VldSet<T>;
|
|
574
617
|
map: <K, V>(key: VldBase<unknown, K>, value: VldBase<unknown, V>) => VldMap<K, V>;
|
|
575
|
-
union:
|
|
618
|
+
union: typeof unionFactory;
|
|
576
619
|
intersection: <A, B>(first: VldBase<unknown, A>, second: VldBase<unknown, B>) => VldIntersection<A, B>;
|
|
577
|
-
discriminatedUnion:
|
|
578
|
-
xor:
|
|
620
|
+
discriminatedUnion: typeof discriminatedUnionFactory;
|
|
621
|
+
xor: typeof xorFactory;
|
|
579
622
|
keyof: <T extends Record<string, any>>(schema: VldObject<T>) => VldEnum<[string, ...string[]]>;
|
|
580
|
-
|
|
581
|
-
|
|
623
|
+
deepPartial: typeof deepPartial;
|
|
624
|
+
input: typeof input;
|
|
625
|
+
output: typeof output;
|
|
626
|
+
literal: typeof literalFactory;
|
|
627
|
+
enum: typeof enumFactoryCompat;
|
|
582
628
|
nativeEnum: <T extends NativeEnumLike>(enumObject: T) => VldEnum<any>;
|
|
583
629
|
any: () => VldAny;
|
|
584
630
|
unknown: () => VldUnknown;
|
|
@@ -615,9 +661,9 @@ export declare const z: {
|
|
|
615
661
|
exactOptional: <T>(validator: VldBase<unknown, T>) => VldExactOptional<unknown, T>;
|
|
616
662
|
nonoptional: <T>(validator: VldBase<unknown, T | undefined>, message?: RefinementMessage) => VldRefine<unknown, T | undefined, Exclude<T, undefined>>;
|
|
617
663
|
catch: <T>(validator: VldBase<unknown, T>, fallbackValue: T) => VldCatch<unknown, T>;
|
|
618
|
-
prefault: <
|
|
664
|
+
prefault: <TInput, TOutput>(validator: VldBase<TInput, TOutput>, defaultValue: TInput | (() => TInput)) => VldPrefault<TInput, TOutput>;
|
|
619
665
|
readonly: <T>(validator: VldBase<unknown, T>) => VldReadonly<unknown, T>;
|
|
620
|
-
pipe: <TInput, TIntermediate, TOutput>(first: VldBase<TInput, TIntermediate>, second: VldBase<
|
|
666
|
+
pipe: <TInput, TIntermediate, TOutput>(first: VldBase<TInput, TIntermediate>, second: VldBase<any, TOutput>) => VldPipe<TInput, TIntermediate, TOutput>;
|
|
621
667
|
clone: <T extends VldBase<any, any>>(schema: T) => T;
|
|
622
668
|
describe: <TInput, TOutput>(schemaOrDescription: VldBase<TInput, TOutput> | string, description?: string) => VldMeta<unknown, unknown>;
|
|
623
669
|
meta: <TInput, TOutput>(schemaOrMetadata: VldBase<TInput, TOutput> | Partial<SchemaMetadata>, metadata?: Partial<SchemaMetadata>) => VldMeta<unknown, unknown>;
|
|
@@ -643,41 +689,17 @@ export declare const z: {
|
|
|
643
689
|
readonly nullish: (value: unknown) => value is null | undefined;
|
|
644
690
|
readonly cached: <T>(getter: () => T) => (() => T);
|
|
645
691
|
};
|
|
646
|
-
readonly regexes: {
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
readonly jwt: RegExp;
|
|
658
|
-
readonly nanoid: RegExp;
|
|
659
|
-
readonly cuid: RegExp;
|
|
660
|
-
readonly cuid2: RegExp;
|
|
661
|
-
readonly ulid: RegExp;
|
|
662
|
-
readonly ipv4: RegExp;
|
|
663
|
-
readonly ipv6: RegExp;
|
|
664
|
-
readonly mac: RegExp;
|
|
665
|
-
readonly cidrv4: RegExp;
|
|
666
|
-
readonly cidrv6: RegExp;
|
|
667
|
-
readonly e164: RegExp;
|
|
668
|
-
readonly isoDate: RegExp;
|
|
669
|
-
readonly isoTime: RegExp;
|
|
670
|
-
readonly isoDateTime: RegExp;
|
|
671
|
-
readonly md5: RegExp;
|
|
672
|
-
readonly sha1: RegExp;
|
|
673
|
-
readonly sha256: RegExp;
|
|
674
|
-
readonly sha384: RegExp;
|
|
675
|
-
readonly sha512: RegExp;
|
|
676
|
-
readonly xid: RegExp;
|
|
677
|
-
readonly guid: RegExp;
|
|
678
|
-
readonly httpUrl: RegExp;
|
|
679
|
-
readonly ksuid: RegExp;
|
|
680
|
-
};
|
|
692
|
+
readonly regexes: Readonly<Record<"number" | "bigint" | "boolean" | "undefined" | "integer" | "null" | "date" | "hex" | "base64" | "email" | "base64url" | "jwt" | "nanoid" | "cuid" | "cuid2" | "ulid" | "cidrv4" | "cidrv6" | "e164" | "xid" | "guid" | "ksuid" | "duration" | "ipv4" | "ipv6" | "browserEmail" | "creditCard" | "domain" | "extendedDuration" | "hostname" | "html5Email" | "httpProtocol" | "httpUrl" | "idnEmail" | "lowercase" | "md5" | "md5_base64" | "md5_base64url" | "md5_hex" | "rfc5322Email" | "sha1" | "sha1_base64" | "sha1_base64url" | "sha1_hex" | "sha256" | "sha256_base64" | "sha256_base64url" | "sha256_hex" | "sha384" | "sha384_base64" | "sha384_base64url" | "sha384_hex" | "sha512" | "sha512_base64" | "sha512_base64url" | "sha512_hex" | "unicodeEmail" | "uppercase" | "uuid4" | "uuid6" | "uuid7", RegExp> & {
|
|
693
|
+
datetime: (options?: stringFormats.ISODateTimeOptions) => RegExp;
|
|
694
|
+
emoji: () => RegExp;
|
|
695
|
+
mac: (delimiter?: string) => RegExp;
|
|
696
|
+
string: (options?: {
|
|
697
|
+
minimum?: number;
|
|
698
|
+
maximum?: number;
|
|
699
|
+
}) => RegExp;
|
|
700
|
+
time: (options?: stringFormats.ISOTimeOptions) => RegExp;
|
|
701
|
+
uuid: (version?: number) => RegExp;
|
|
702
|
+
}>;
|
|
681
703
|
readonly locales: typeof localeNamespace;
|
|
682
704
|
readonly NEVER: VldNever;
|
|
683
705
|
readonly TimePrecision: {
|
|
@@ -723,7 +745,7 @@ export declare const z: {
|
|
|
723
745
|
locales: typeof localeNamespace;
|
|
724
746
|
lazy: <T>(schemaGetter: () => VldBase<unknown, T>) => VldLazy<unknown, T>;
|
|
725
747
|
json: <T = unknown>(schema?: VldBase<unknown, T>) => VldJson<T>;
|
|
726
|
-
custom:
|
|
748
|
+
custom: typeof customFn;
|
|
727
749
|
file: () => VldFile;
|
|
728
750
|
function: () => VldFunction;
|
|
729
751
|
preprocess: <TInput, TOutput>(preprocessor: (input: unknown) => unknown, schema: VldBase<TInput, TOutput>) => VldPreprocess<TInput, TOutput>;
|
|
@@ -737,9 +759,9 @@ export declare const z: {
|
|
|
737
759
|
email: (options?: {
|
|
738
760
|
pattern?: RegExp;
|
|
739
761
|
}) => stringFormats.VldStringFormat;
|
|
740
|
-
url: () =>
|
|
762
|
+
url: (options?: stringFormats.URLFormatOptions) => stringFormats.VldStringFormat;
|
|
741
763
|
uuid: (options?: {
|
|
742
|
-
version?:
|
|
764
|
+
version?: stringFormats.UUIDVersion;
|
|
743
765
|
}) => stringFormats.VldStringFormat;
|
|
744
766
|
uuidv4: () => stringFormats.VldStringFormat;
|
|
745
767
|
uuidv6: () => stringFormats.VldStringFormat;
|
|
@@ -759,12 +781,20 @@ export declare const z: {
|
|
|
759
781
|
mac: () => stringFormats.VldStringFormat;
|
|
760
782
|
cidrv4: () => stringFormats.VldStringFormat;
|
|
761
783
|
cidrv6: () => stringFormats.VldStringFormat;
|
|
784
|
+
creditCard: (params?: {
|
|
785
|
+
message?: string;
|
|
786
|
+
}) => stringFormats.VldStringFormat;
|
|
762
787
|
e164: () => stringFormats.VldStringFormat;
|
|
763
788
|
hash: (algorithm: "md5" | "sha1" | "sha256" | "sha384" | "sha512") => stringFormats.VldStringFormat;
|
|
764
789
|
iso: {
|
|
790
|
+
ZodISODate: typeof stringFormats.VldStringFormat;
|
|
791
|
+
ZodISODateTime: typeof stringFormats.VldStringFormat;
|
|
792
|
+
ZodISODuration: typeof stringFormats.VldStringFormat;
|
|
793
|
+
ZodISOTime: typeof stringFormats.VldStringFormat;
|
|
765
794
|
date: () => stringFormats.VldStringFormat;
|
|
766
|
-
time: () => stringFormats.VldStringFormat;
|
|
767
|
-
|
|
795
|
+
time: (options?: stringFormats.ISOTimeOptions) => stringFormats.VldStringFormat;
|
|
796
|
+
datetime: (options?: stringFormats.ISODateTimeOptions) => stringFormats.VldStringFormat;
|
|
797
|
+
dateTime: (options?: stringFormats.ISODateTimeOptions) => stringFormats.VldStringFormat;
|
|
768
798
|
duration: () => stringFormats.VldStringFormat;
|
|
769
799
|
};
|
|
770
800
|
stringFormat: (name: string, validator: ((val: string) => boolean) | RegExp) => stringFormats.VldStringFormat;
|
|
@@ -799,41 +829,17 @@ export declare const z: {
|
|
|
799
829
|
guid: () => stringFormats.VldStringFormat;
|
|
800
830
|
httpUrl: () => stringFormats.VldStringFormat;
|
|
801
831
|
ksuid: () => stringFormats.VldStringFormat;
|
|
802
|
-
regexes: {
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
readonly jwt: RegExp;
|
|
814
|
-
readonly nanoid: RegExp;
|
|
815
|
-
readonly cuid: RegExp;
|
|
816
|
-
readonly cuid2: RegExp;
|
|
817
|
-
readonly ulid: RegExp;
|
|
818
|
-
readonly ipv4: RegExp;
|
|
819
|
-
readonly ipv6: RegExp;
|
|
820
|
-
readonly mac: RegExp;
|
|
821
|
-
readonly cidrv4: RegExp;
|
|
822
|
-
readonly cidrv6: RegExp;
|
|
823
|
-
readonly e164: RegExp;
|
|
824
|
-
readonly isoDate: RegExp;
|
|
825
|
-
readonly isoTime: RegExp;
|
|
826
|
-
readonly isoDateTime: RegExp;
|
|
827
|
-
readonly md5: RegExp;
|
|
828
|
-
readonly sha1: RegExp;
|
|
829
|
-
readonly sha256: RegExp;
|
|
830
|
-
readonly sha384: RegExp;
|
|
831
|
-
readonly sha512: RegExp;
|
|
832
|
-
readonly xid: RegExp;
|
|
833
|
-
readonly guid: RegExp;
|
|
834
|
-
readonly httpUrl: RegExp;
|
|
835
|
-
readonly ksuid: RegExp;
|
|
836
|
-
};
|
|
832
|
+
regexes: Readonly<Record<"number" | "bigint" | "boolean" | "undefined" | "integer" | "null" | "date" | "hex" | "base64" | "email" | "base64url" | "jwt" | "nanoid" | "cuid" | "cuid2" | "ulid" | "cidrv4" | "cidrv6" | "e164" | "xid" | "guid" | "ksuid" | "duration" | "ipv4" | "ipv6" | "browserEmail" | "creditCard" | "domain" | "extendedDuration" | "hostname" | "html5Email" | "httpProtocol" | "httpUrl" | "idnEmail" | "lowercase" | "md5" | "md5_base64" | "md5_base64url" | "md5_hex" | "rfc5322Email" | "sha1" | "sha1_base64" | "sha1_base64url" | "sha1_hex" | "sha256" | "sha256_base64" | "sha256_base64url" | "sha256_hex" | "sha384" | "sha384_base64" | "sha384_base64url" | "sha384_hex" | "sha512" | "sha512_base64" | "sha512_base64url" | "sha512_hex" | "unicodeEmail" | "uppercase" | "uuid4" | "uuid6" | "uuid7", RegExp> & {
|
|
833
|
+
datetime: (options?: stringFormats.ISODateTimeOptions) => RegExp;
|
|
834
|
+
emoji: () => RegExp;
|
|
835
|
+
mac: (delimiter?: string) => RegExp;
|
|
836
|
+
string: (options?: {
|
|
837
|
+
minimum?: number;
|
|
838
|
+
maximum?: number;
|
|
839
|
+
}) => RegExp;
|
|
840
|
+
time: (options?: stringFormats.ISOTimeOptions) => RegExp;
|
|
841
|
+
uuid: (version?: number) => RegExp;
|
|
842
|
+
}>;
|
|
837
843
|
templateLiteral: (...components: (VldBase<any, any> | string)[]) => VldTemplateLiteral;
|
|
838
844
|
base64Bytes: () => VldBase64;
|
|
839
845
|
hexBytes: () => VldHex;
|
|
@@ -852,15 +858,16 @@ export declare const z: {
|
|
|
852
858
|
safeDecode: <T>(schema: VldBase<unknown, T>, value: unknown) => ParseResult<T>;
|
|
853
859
|
decodeAsync: <T>(schema: VldBase<unknown, T>, value: unknown) => Promise<T>;
|
|
854
860
|
safeDecodeAsync: <T>(schema: VldBase<unknown, T>, value: unknown) => Promise<ParseResult<T>>;
|
|
855
|
-
encode: <TInput, TOutput>(schema: VldBase<TInput, TOutput>, value:
|
|
856
|
-
safeEncode: <TInput, TOutput>(schema: VldBase<TInput, TOutput>, value:
|
|
857
|
-
encodeAsync: <TInput, TOutput>(schema: VldBase<TInput, TOutput>, value:
|
|
858
|
-
safeEncodeAsync: <TInput, TOutput>(schema: VldBase<TInput, TOutput>, value:
|
|
861
|
+
encode: <TInput, TOutput>(schema: VldBase<TInput, TOutput>, value: TOutput) => TInput;
|
|
862
|
+
safeEncode: <TInput, TOutput>(schema: VldBase<TInput, TOutput>, value: TOutput) => ParseResult<TInput>;
|
|
863
|
+
encodeAsync: <TInput, TOutput>(schema: VldBase<TInput, TOutput>, value: TOutput) => Promise<TInput>;
|
|
864
|
+
safeEncodeAsync: <TInput, TOutput>(schema: VldBase<TInput, TOutput>, value: TOutput) => Promise<ParseResult<TInput>>;
|
|
859
865
|
formatError: (error: Error) => FormattedError;
|
|
860
866
|
treeifyError: typeof treeifyErrorFn;
|
|
861
867
|
prettifyError: typeof prettifyErrorFn;
|
|
862
868
|
flattenError: typeof flattenErrorFn;
|
|
863
869
|
toJSONSchema: typeof toJSONSchemaFn;
|
|
870
|
+
fromJSONSchema: typeof fromJSONSchemaFn;
|
|
864
871
|
};
|
|
865
872
|
/**
|
|
866
873
|
* Zod-compatible root-level factory aliases.
|
|
@@ -873,7 +880,7 @@ export declare const string: () => VldString, number: () => VldNumber, int: () =
|
|
|
873
880
|
truthy?: readonly string[];
|
|
874
881
|
falsy?: readonly string[];
|
|
875
882
|
caseSensitive?: boolean;
|
|
876
|
-
}) => VldStringBool, array: <T>(item: VldBase<unknown, T>) => VldArray<T>, object:
|
|
883
|
+
}) => VldStringBool, array: <T>(item: VldBase<unknown, T>) => VldArray<T>, object: typeof objectFactory, strictObject: typeof strictObjectFactory, looseObject: typeof looseObjectFactory, tuple: typeof tupleFactory, record: typeof recordFactory, partialRecord: typeof partialRecordFactory, looseRecord: typeof looseRecordFactory, set: <T>(item: VldBase<unknown, T>) => VldSet<T>, union: typeof unionFactory, intersection: <A, B>(first: VldBase<unknown, A>, second: VldBase<unknown, B>) => VldIntersection<A, B>, discriminatedUnion: typeof discriminatedUnionFactory, xor: typeof xorFactory, keyof: <T extends Record<string, any>>(schema: VldObject<T>) => VldEnum<[string, ...string[]]>, literal: typeof literalFactory, nativeEnum: <T extends NativeEnumLike>(enumObject: T) => VldEnum<any>, any: () => VldAny, unknown: () => VldUnknown, nan: () => VldNan, optional: <T>(validator: VldBase<unknown, T>) => VldOptional<unknown, T>, nullable: <T>(validator: VldBase<unknown, T>) => VldNullable<unknown, T>, nullish: <T>(validator: VldBase<unknown, T>) => VldNullish<unknown, T>, exactOptional: <T>(validator: VldBase<unknown, T>) => VldExactOptional<unknown, T>, nonoptional: <T>(validator: VldBase<unknown, T | undefined>, message?: RefinementMessage) => VldRefine<unknown, T | undefined, Exclude<T, undefined>>, readonly: <T>(validator: VldBase<unknown, T>) => VldReadonly<unknown, T>, pipe: <TInput, TIntermediate, TOutput>(first: VldBase<TInput, TIntermediate>, second: VldBase<any, TOutput>) => VldPipe<TInput, TIntermediate, TOutput>, clone: <T extends VldBase<any, any>>(schema: T) => T, describe: <TInput, TOutput>(schemaOrDescription: VldBase<TInput, TOutput> | string, description?: string) => VldMeta<unknown, unknown>, meta: <TInput, TOutput>(schemaOrMetadata: VldBase<TInput, TOutput> | Partial<SchemaMetadata>, metadata?: Partial<SchemaMetadata>) => VldMeta<unknown, unknown>, transform: <TInput = unknown, TOutput = TInput>(schemaOrTransformer: VldBase<unknown, TInput> | ((value: TInput, ctx?: SuperRefineContext) => TOutput | Promise<TOutput>), transformer?: (value: TInput) => TOutput | Promise<TOutput>) => VldTransform<unknown, TInput, TOutput> | VldBase<TInput, Awaited<TOutput>>, overwrite: <T>(transformer: (value: T) => T) => VldBase<T, Awaited<T>>, refine: <T = unknown>(schemaOrPredicate: VldBase<unknown, T> | ((value: T) => boolean | Promise<boolean>), predicateOrMessage?: ((value: T) => boolean | Promise<boolean>) | RefinementMessage, message?: RefinementMessage) => VldBase<unknown, T>, check: <T = unknown>(schemaOrPredicate: VldBase<unknown, T> | ((value: T) => boolean | Promise<boolean>), predicateOrMessage?: ((value: T) => boolean | Promise<boolean>) | RefinementMessage, message?: RefinementMessage) => VldBase<unknown, T>, superRefine: <T = unknown>(schemaOrRefinement: VldBase<unknown, T> | ((value: T, ctx: SuperRefineContext) => void | Promise<void>), refinement?: (value: T, ctx: SuperRefineContext) => void | Promise<void>) => VldBase<unknown, T>, property: typeof propertyCheck, config: typeof configure, setErrorMap: typeof setGlobalErrorMap, getErrorMap: typeof getGlobalErrorMap, locales: typeof localeNamespace, lazy: <T>(schemaGetter: () => VldBase<unknown, T>) => VldLazy<unknown, T>, json: <T = unknown>(schema?: VldBase<unknown, T>) => VldJson<T>, custom: typeof customFn, file: () => VldFile, preprocess: <TInput, TOutput>(preprocessor: (input: unknown) => unknown, schema: VldBase<TInput, TOutput>) => VldPreprocess<TInput, TOutput>, coerce: {
|
|
877
884
|
string: () => VldCoerceString;
|
|
878
885
|
number: () => VldCoerceNumber;
|
|
879
886
|
boolean: () => VldCoerceBoolean;
|
|
@@ -881,53 +888,36 @@ export declare const string: () => VldString, number: () => VldNumber, int: () =
|
|
|
881
888
|
bigint: () => VldCoerceBigInt;
|
|
882
889
|
}, email: (options?: {
|
|
883
890
|
pattern?: RegExp;
|
|
884
|
-
}) => stringFormats.VldStringFormat, url: () =>
|
|
885
|
-
version?:
|
|
886
|
-
}) => stringFormats.VldStringFormat, uuidv4: () => stringFormats.VldStringFormat, uuidv6: () => stringFormats.VldStringFormat, uuidv7: () => stringFormats.VldStringFormat, hostname: () => stringFormats.VldStringFormat, emoji: () => stringFormats.VldStringFormat, base64: () => stringFormats.VldStringFormat, base64url: () => stringFormats.VldStringFormat, hex: () => stringFormats.VldStringFormat, jwt: () => stringFormats.VldStringFormat, nanoid: () => stringFormats.VldStringFormat, cuid: () => stringFormats.VldStringFormat, cuid2: () => stringFormats.VldStringFormat, ulid: () => stringFormats.VldStringFormat, ipv4: () => stringFormats.VldStringFormat, ipv6: () => stringFormats.VldStringFormat, mac: () => stringFormats.VldStringFormat, cidrv4: () => stringFormats.VldStringFormat, cidrv6: () => stringFormats.VldStringFormat,
|
|
891
|
+
}) => stringFormats.VldStringFormat, url: (options?: stringFormats.URLFormatOptions) => stringFormats.VldStringFormat, uuid: (options?: {
|
|
892
|
+
version?: stringFormats.UUIDVersion;
|
|
893
|
+
}) => stringFormats.VldStringFormat, uuidv4: () => stringFormats.VldStringFormat, uuidv6: () => stringFormats.VldStringFormat, uuidv7: () => stringFormats.VldStringFormat, hostname: () => stringFormats.VldStringFormat, emoji: () => stringFormats.VldStringFormat, base64: () => stringFormats.VldStringFormat, base64url: () => stringFormats.VldStringFormat, hex: () => stringFormats.VldStringFormat, jwt: () => stringFormats.VldStringFormat, nanoid: () => stringFormats.VldStringFormat, cuid: () => stringFormats.VldStringFormat, cuid2: () => stringFormats.VldStringFormat, ulid: () => stringFormats.VldStringFormat, ipv4: () => stringFormats.VldStringFormat, ipv6: () => stringFormats.VldStringFormat, mac: () => stringFormats.VldStringFormat, cidrv4: () => stringFormats.VldStringFormat, cidrv6: () => stringFormats.VldStringFormat, creditCard: (params?: {
|
|
894
|
+
message?: string;
|
|
895
|
+
}) => stringFormats.VldStringFormat, e164: () => stringFormats.VldStringFormat, hash: (algorithm: "md5" | "sha1" | "sha256" | "sha384" | "sha512") => stringFormats.VldStringFormat, iso: {
|
|
896
|
+
ZodISODate: typeof stringFormats.VldStringFormat;
|
|
897
|
+
ZodISODateTime: typeof stringFormats.VldStringFormat;
|
|
898
|
+
ZodISODuration: typeof stringFormats.VldStringFormat;
|
|
899
|
+
ZodISOTime: typeof stringFormats.VldStringFormat;
|
|
887
900
|
date: () => stringFormats.VldStringFormat;
|
|
888
|
-
time: () => stringFormats.VldStringFormat;
|
|
889
|
-
|
|
901
|
+
time: (options?: stringFormats.ISOTimeOptions) => stringFormats.VldStringFormat;
|
|
902
|
+
datetime: (options?: stringFormats.ISODateTimeOptions) => stringFormats.VldStringFormat;
|
|
903
|
+
dateTime: (options?: stringFormats.ISODateTimeOptions) => stringFormats.VldStringFormat;
|
|
890
904
|
duration: () => stringFormats.VldStringFormat;
|
|
891
|
-
}, stringFormat: (name: string, validator: ((val: string) => boolean) | RegExp) => stringFormats.VldStringFormat, normalize: (form?: "NFC" | "NFD" | "NFKC" | "NFKD" | (string & {})) => VldTransform<string, string, string>, slugify: () => VldTransform<string, string, string>, mime: (types: string | string[], message?: string) => VldFile, xid: () => stringFormats.VldStringFormat, guid: () => stringFormats.VldStringFormat, httpUrl: () => stringFormats.VldStringFormat, ksuid: () => stringFormats.VldStringFormat, regexes: {
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
readonly jwt: RegExp;
|
|
903
|
-
readonly nanoid: RegExp;
|
|
904
|
-
readonly cuid: RegExp;
|
|
905
|
-
readonly cuid2: RegExp;
|
|
906
|
-
readonly ulid: RegExp;
|
|
907
|
-
readonly ipv4: RegExp;
|
|
908
|
-
readonly ipv6: RegExp;
|
|
909
|
-
readonly mac: RegExp;
|
|
910
|
-
readonly cidrv4: RegExp;
|
|
911
|
-
readonly cidrv6: RegExp;
|
|
912
|
-
readonly e164: RegExp;
|
|
913
|
-
readonly isoDate: RegExp;
|
|
914
|
-
readonly isoTime: RegExp;
|
|
915
|
-
readonly isoDateTime: RegExp;
|
|
916
|
-
readonly md5: RegExp;
|
|
917
|
-
readonly sha1: RegExp;
|
|
918
|
-
readonly sha256: RegExp;
|
|
919
|
-
readonly sha384: RegExp;
|
|
920
|
-
readonly sha512: RegExp;
|
|
921
|
-
readonly xid: RegExp;
|
|
922
|
-
readonly guid: RegExp;
|
|
923
|
-
readonly httpUrl: RegExp;
|
|
924
|
-
readonly ksuid: RegExp;
|
|
925
|
-
}, templateLiteral: (...components: (VldBase<any, any> | string)[]) => VldTemplateLiteral, base64Bytes: () => VldBase64, hexBytes: () => VldHex, uint8Array: () => VldUint8Array, codec: <TInput, TOutput>(inputValidator: VldBase<unknown, TInput>, outputValidator: VldBase<unknown, TOutput>, transform: {
|
|
905
|
+
}, stringFormat: (name: string, validator: ((val: string) => boolean) | RegExp) => stringFormats.VldStringFormat, normalize: (form?: "NFC" | "NFD" | "NFKC" | "NFKD" | (string & {})) => VldTransform<string, string, string>, slugify: () => VldTransform<string, string, string>, mime: (types: string | string[], message?: string) => VldFile, xid: () => stringFormats.VldStringFormat, guid: () => stringFormats.VldStringFormat, httpUrl: () => stringFormats.VldStringFormat, ksuid: () => stringFormats.VldStringFormat, regexes: Readonly<Record<"number" | "bigint" | "boolean" | "undefined" | "integer" | "null" | "date" | "hex" | "base64" | "email" | "base64url" | "jwt" | "nanoid" | "cuid" | "cuid2" | "ulid" | "cidrv4" | "cidrv6" | "e164" | "xid" | "guid" | "ksuid" | "duration" | "ipv4" | "ipv6" | "browserEmail" | "creditCard" | "domain" | "extendedDuration" | "hostname" | "html5Email" | "httpProtocol" | "httpUrl" | "idnEmail" | "lowercase" | "md5" | "md5_base64" | "md5_base64url" | "md5_hex" | "rfc5322Email" | "sha1" | "sha1_base64" | "sha1_base64url" | "sha1_hex" | "sha256" | "sha256_base64" | "sha256_base64url" | "sha256_hex" | "sha384" | "sha384_base64" | "sha384_base64url" | "sha384_hex" | "sha512" | "sha512_base64" | "sha512_base64url" | "sha512_hex" | "unicodeEmail" | "uppercase" | "uuid4" | "uuid6" | "uuid7", RegExp> & {
|
|
906
|
+
datetime: (options?: stringFormats.ISODateTimeOptions) => RegExp;
|
|
907
|
+
emoji: () => RegExp;
|
|
908
|
+
mac: (delimiter?: string) => RegExp;
|
|
909
|
+
string: (options?: {
|
|
910
|
+
minimum?: number;
|
|
911
|
+
maximum?: number;
|
|
912
|
+
}) => RegExp;
|
|
913
|
+
time: (options?: stringFormats.ISOTimeOptions) => RegExp;
|
|
914
|
+
uuid: (version?: number) => RegExp;
|
|
915
|
+
}>, templateLiteral: (...components: (VldBase<any, any> | string)[]) => VldTemplateLiteral, base64Bytes: () => VldBase64, hexBytes: () => VldHex, uint8Array: () => VldUint8Array, codec: <TInput, TOutput>(inputValidator: VldBase<unknown, TInput>, outputValidator: VldBase<unknown, TOutput>, transform: {
|
|
926
916
|
decode: (value: TInput) => TOutput | Promise<TOutput>;
|
|
927
917
|
encode: (value: TOutput) => TInput | Promise<TInput>;
|
|
928
|
-
}) => VldCodec<TInput, TOutput>, promise: <T>(inner: VldBase<unknown, T>) => VldPromise<T>, prefault: <
|
|
918
|
+
}) => VldCodec<TInput, TOutput>, promise: <T>(inner: VldBase<unknown, T>) => VldPromise<T>, prefault: <TInput, TOutput>(validator: VldBase<TInput, TOutput>, defaultValue: TInput | (() => TInput)) => VldPrefault<TInput, TOutput>, parse: <T>(schema: VldBase<unknown, T>, value: unknown) => T, safeParse: <T>(schema: VldBase<unknown, T>, value: unknown) => ParseResult<T>, parseAsync: <T>(schema: VldBase<unknown, T>, value: unknown) => Promise<T>, safeParseAsync: <T>(schema: VldBase<unknown, T>, value: unknown) => Promise<ParseResult<T>>, decode: <T>(schema: VldBase<unknown, T>, value: unknown) => T, safeDecode: <T>(schema: VldBase<unknown, T>, value: unknown) => ParseResult<T>, decodeAsync: <T>(schema: VldBase<unknown, T>, value: unknown) => Promise<T>, safeDecodeAsync: <T>(schema: VldBase<unknown, T>, value: unknown) => Promise<ParseResult<T>>, encode: <TInput, TOutput>(schema: VldBase<TInput, TOutput>, value: TOutput) => TInput, safeEncode: <TInput, TOutput>(schema: VldBase<TInput, TOutput>, value: TOutput) => ParseResult<TInput>, encodeAsync: <TInput, TOutput>(schema: VldBase<TInput, TOutput>, value: TOutput) => Promise<TInput>, safeEncodeAsync: <TInput, TOutput>(schema: VldBase<TInput, TOutput>, value: TOutput) => Promise<ParseResult<TInput>>, formatError: (error: Error) => FormattedError, NEVER: VldNever;
|
|
929
919
|
declare const catchFactory: <T>(validator: VldBase<unknown, T>, fallbackValue: T) => VldCatch<unknown, T>;
|
|
930
|
-
declare const enumFactory:
|
|
920
|
+
declare const enumFactory: typeof enumFactoryCompat;
|
|
931
921
|
declare const functionFactory: () => VldFunction;
|
|
932
922
|
declare const instanceOfFactory: <T>(constructor: Constructor<T>, message?: RefinementMessage) => VldCustom<T>;
|
|
933
923
|
declare const mapFactory: <K, V>(key: VldBase<unknown, K>, value: VldBase<unknown, V>) => VldMap<K, V>;
|
|
@@ -955,22 +945,25 @@ declare const defaultFactory: {
|
|
|
955
945
|
caseSensitive?: boolean;
|
|
956
946
|
}) => VldStringBool;
|
|
957
947
|
array: <T>(item: VldBase<unknown, T>) => VldArray<T>;
|
|
958
|
-
object:
|
|
959
|
-
strictObject:
|
|
960
|
-
looseObject:
|
|
961
|
-
tuple:
|
|
962
|
-
record:
|
|
963
|
-
partialRecord:
|
|
964
|
-
looseRecord:
|
|
948
|
+
object: typeof objectFactory;
|
|
949
|
+
strictObject: typeof strictObjectFactory;
|
|
950
|
+
looseObject: typeof looseObjectFactory;
|
|
951
|
+
tuple: typeof tupleFactory;
|
|
952
|
+
record: typeof recordFactory;
|
|
953
|
+
partialRecord: typeof partialRecordFactory;
|
|
954
|
+
looseRecord: typeof looseRecordFactory;
|
|
965
955
|
set: <T>(item: VldBase<unknown, T>) => VldSet<T>;
|
|
966
956
|
map: <K, V>(key: VldBase<unknown, K>, value: VldBase<unknown, V>) => VldMap<K, V>;
|
|
967
|
-
union:
|
|
957
|
+
union: typeof unionFactory;
|
|
968
958
|
intersection: <A, B>(first: VldBase<unknown, A>, second: VldBase<unknown, B>) => VldIntersection<A, B>;
|
|
969
|
-
discriminatedUnion:
|
|
970
|
-
xor:
|
|
959
|
+
discriminatedUnion: typeof discriminatedUnionFactory;
|
|
960
|
+
xor: typeof xorFactory;
|
|
971
961
|
keyof: <T extends Record<string, any>>(schema: VldObject<T>) => VldEnum<[string, ...string[]]>;
|
|
972
|
-
|
|
973
|
-
|
|
962
|
+
deepPartial: typeof deepPartial;
|
|
963
|
+
input: typeof input;
|
|
964
|
+
output: typeof output;
|
|
965
|
+
literal: typeof literalFactory;
|
|
966
|
+
enum: typeof enumFactoryCompat;
|
|
974
967
|
nativeEnum: <T extends NativeEnumLike>(enumObject: T) => VldEnum<any>;
|
|
975
968
|
any: () => VldAny;
|
|
976
969
|
unknown: () => VldUnknown;
|
|
@@ -1007,9 +1000,9 @@ declare const defaultFactory: {
|
|
|
1007
1000
|
exactOptional: <T>(validator: VldBase<unknown, T>) => VldExactOptional<unknown, T>;
|
|
1008
1001
|
nonoptional: <T>(validator: VldBase<unknown, T | undefined>, message?: RefinementMessage) => VldRefine<unknown, T | undefined, Exclude<T, undefined>>;
|
|
1009
1002
|
catch: <T>(validator: VldBase<unknown, T>, fallbackValue: T) => VldCatch<unknown, T>;
|
|
1010
|
-
prefault: <
|
|
1003
|
+
prefault: <TInput, TOutput>(validator: VldBase<TInput, TOutput>, defaultValue: TInput | (() => TInput)) => VldPrefault<TInput, TOutput>;
|
|
1011
1004
|
readonly: <T>(validator: VldBase<unknown, T>) => VldReadonly<unknown, T>;
|
|
1012
|
-
pipe: <TInput, TIntermediate, TOutput>(first: VldBase<TInput, TIntermediate>, second: VldBase<
|
|
1005
|
+
pipe: <TInput, TIntermediate, TOutput>(first: VldBase<TInput, TIntermediate>, second: VldBase<any, TOutput>) => VldPipe<TInput, TIntermediate, TOutput>;
|
|
1013
1006
|
clone: <T extends VldBase<any, any>>(schema: T) => T;
|
|
1014
1007
|
describe: <TInput, TOutput>(schemaOrDescription: VldBase<TInput, TOutput> | string, description?: string) => VldMeta<unknown, unknown>;
|
|
1015
1008
|
meta: <TInput, TOutput>(schemaOrMetadata: VldBase<TInput, TOutput> | Partial<SchemaMetadata>, metadata?: Partial<SchemaMetadata>) => VldMeta<unknown, unknown>;
|
|
@@ -1035,41 +1028,17 @@ declare const defaultFactory: {
|
|
|
1035
1028
|
readonly nullish: (value: unknown) => value is null | undefined;
|
|
1036
1029
|
readonly cached: <T>(getter: () => T) => (() => T);
|
|
1037
1030
|
};
|
|
1038
|
-
readonly regexes: {
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
readonly jwt: RegExp;
|
|
1050
|
-
readonly nanoid: RegExp;
|
|
1051
|
-
readonly cuid: RegExp;
|
|
1052
|
-
readonly cuid2: RegExp;
|
|
1053
|
-
readonly ulid: RegExp;
|
|
1054
|
-
readonly ipv4: RegExp;
|
|
1055
|
-
readonly ipv6: RegExp;
|
|
1056
|
-
readonly mac: RegExp;
|
|
1057
|
-
readonly cidrv4: RegExp;
|
|
1058
|
-
readonly cidrv6: RegExp;
|
|
1059
|
-
readonly e164: RegExp;
|
|
1060
|
-
readonly isoDate: RegExp;
|
|
1061
|
-
readonly isoTime: RegExp;
|
|
1062
|
-
readonly isoDateTime: RegExp;
|
|
1063
|
-
readonly md5: RegExp;
|
|
1064
|
-
readonly sha1: RegExp;
|
|
1065
|
-
readonly sha256: RegExp;
|
|
1066
|
-
readonly sha384: RegExp;
|
|
1067
|
-
readonly sha512: RegExp;
|
|
1068
|
-
readonly xid: RegExp;
|
|
1069
|
-
readonly guid: RegExp;
|
|
1070
|
-
readonly httpUrl: RegExp;
|
|
1071
|
-
readonly ksuid: RegExp;
|
|
1072
|
-
};
|
|
1031
|
+
readonly regexes: Readonly<Record<"number" | "bigint" | "boolean" | "undefined" | "integer" | "null" | "date" | "hex" | "base64" | "email" | "base64url" | "jwt" | "nanoid" | "cuid" | "cuid2" | "ulid" | "cidrv4" | "cidrv6" | "e164" | "xid" | "guid" | "ksuid" | "duration" | "ipv4" | "ipv6" | "browserEmail" | "creditCard" | "domain" | "extendedDuration" | "hostname" | "html5Email" | "httpProtocol" | "httpUrl" | "idnEmail" | "lowercase" | "md5" | "md5_base64" | "md5_base64url" | "md5_hex" | "rfc5322Email" | "sha1" | "sha1_base64" | "sha1_base64url" | "sha1_hex" | "sha256" | "sha256_base64" | "sha256_base64url" | "sha256_hex" | "sha384" | "sha384_base64" | "sha384_base64url" | "sha384_hex" | "sha512" | "sha512_base64" | "sha512_base64url" | "sha512_hex" | "unicodeEmail" | "uppercase" | "uuid4" | "uuid6" | "uuid7", RegExp> & {
|
|
1032
|
+
datetime: (options?: stringFormats.ISODateTimeOptions) => RegExp;
|
|
1033
|
+
emoji: () => RegExp;
|
|
1034
|
+
mac: (delimiter?: string) => RegExp;
|
|
1035
|
+
string: (options?: {
|
|
1036
|
+
minimum?: number;
|
|
1037
|
+
maximum?: number;
|
|
1038
|
+
}) => RegExp;
|
|
1039
|
+
time: (options?: stringFormats.ISOTimeOptions) => RegExp;
|
|
1040
|
+
uuid: (version?: number) => RegExp;
|
|
1041
|
+
}>;
|
|
1073
1042
|
readonly locales: typeof localeNamespace;
|
|
1074
1043
|
readonly NEVER: VldNever;
|
|
1075
1044
|
readonly TimePrecision: {
|
|
@@ -1115,7 +1084,7 @@ declare const defaultFactory: {
|
|
|
1115
1084
|
locales: typeof localeNamespace;
|
|
1116
1085
|
lazy: <T>(schemaGetter: () => VldBase<unknown, T>) => VldLazy<unknown, T>;
|
|
1117
1086
|
json: <T = unknown>(schema?: VldBase<unknown, T>) => VldJson<T>;
|
|
1118
|
-
custom:
|
|
1087
|
+
custom: typeof customFn;
|
|
1119
1088
|
file: () => VldFile;
|
|
1120
1089
|
function: () => VldFunction;
|
|
1121
1090
|
preprocess: <TInput, TOutput>(preprocessor: (input: unknown) => unknown, schema: VldBase<TInput, TOutput>) => VldPreprocess<TInput, TOutput>;
|
|
@@ -1129,9 +1098,9 @@ declare const defaultFactory: {
|
|
|
1129
1098
|
email: (options?: {
|
|
1130
1099
|
pattern?: RegExp;
|
|
1131
1100
|
}) => stringFormats.VldStringFormat;
|
|
1132
|
-
url: () =>
|
|
1101
|
+
url: (options?: stringFormats.URLFormatOptions) => stringFormats.VldStringFormat;
|
|
1133
1102
|
uuid: (options?: {
|
|
1134
|
-
version?:
|
|
1103
|
+
version?: stringFormats.UUIDVersion;
|
|
1135
1104
|
}) => stringFormats.VldStringFormat;
|
|
1136
1105
|
uuidv4: () => stringFormats.VldStringFormat;
|
|
1137
1106
|
uuidv6: () => stringFormats.VldStringFormat;
|
|
@@ -1151,12 +1120,20 @@ declare const defaultFactory: {
|
|
|
1151
1120
|
mac: () => stringFormats.VldStringFormat;
|
|
1152
1121
|
cidrv4: () => stringFormats.VldStringFormat;
|
|
1153
1122
|
cidrv6: () => stringFormats.VldStringFormat;
|
|
1123
|
+
creditCard: (params?: {
|
|
1124
|
+
message?: string;
|
|
1125
|
+
}) => stringFormats.VldStringFormat;
|
|
1154
1126
|
e164: () => stringFormats.VldStringFormat;
|
|
1155
1127
|
hash: (algorithm: "md5" | "sha1" | "sha256" | "sha384" | "sha512") => stringFormats.VldStringFormat;
|
|
1156
1128
|
iso: {
|
|
1129
|
+
ZodISODate: typeof stringFormats.VldStringFormat;
|
|
1130
|
+
ZodISODateTime: typeof stringFormats.VldStringFormat;
|
|
1131
|
+
ZodISODuration: typeof stringFormats.VldStringFormat;
|
|
1132
|
+
ZodISOTime: typeof stringFormats.VldStringFormat;
|
|
1157
1133
|
date: () => stringFormats.VldStringFormat;
|
|
1158
|
-
time: () => stringFormats.VldStringFormat;
|
|
1159
|
-
|
|
1134
|
+
time: (options?: stringFormats.ISOTimeOptions) => stringFormats.VldStringFormat;
|
|
1135
|
+
datetime: (options?: stringFormats.ISODateTimeOptions) => stringFormats.VldStringFormat;
|
|
1136
|
+
dateTime: (options?: stringFormats.ISODateTimeOptions) => stringFormats.VldStringFormat;
|
|
1160
1137
|
duration: () => stringFormats.VldStringFormat;
|
|
1161
1138
|
};
|
|
1162
1139
|
stringFormat: (name: string, validator: ((val: string) => boolean) | RegExp) => stringFormats.VldStringFormat;
|
|
@@ -1191,41 +1168,17 @@ declare const defaultFactory: {
|
|
|
1191
1168
|
guid: () => stringFormats.VldStringFormat;
|
|
1192
1169
|
httpUrl: () => stringFormats.VldStringFormat;
|
|
1193
1170
|
ksuid: () => stringFormats.VldStringFormat;
|
|
1194
|
-
regexes: {
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
readonly jwt: RegExp;
|
|
1206
|
-
readonly nanoid: RegExp;
|
|
1207
|
-
readonly cuid: RegExp;
|
|
1208
|
-
readonly cuid2: RegExp;
|
|
1209
|
-
readonly ulid: RegExp;
|
|
1210
|
-
readonly ipv4: RegExp;
|
|
1211
|
-
readonly ipv6: RegExp;
|
|
1212
|
-
readonly mac: RegExp;
|
|
1213
|
-
readonly cidrv4: RegExp;
|
|
1214
|
-
readonly cidrv6: RegExp;
|
|
1215
|
-
readonly e164: RegExp;
|
|
1216
|
-
readonly isoDate: RegExp;
|
|
1217
|
-
readonly isoTime: RegExp;
|
|
1218
|
-
readonly isoDateTime: RegExp;
|
|
1219
|
-
readonly md5: RegExp;
|
|
1220
|
-
readonly sha1: RegExp;
|
|
1221
|
-
readonly sha256: RegExp;
|
|
1222
|
-
readonly sha384: RegExp;
|
|
1223
|
-
readonly sha512: RegExp;
|
|
1224
|
-
readonly xid: RegExp;
|
|
1225
|
-
readonly guid: RegExp;
|
|
1226
|
-
readonly httpUrl: RegExp;
|
|
1227
|
-
readonly ksuid: RegExp;
|
|
1228
|
-
};
|
|
1171
|
+
regexes: Readonly<Record<"number" | "bigint" | "boolean" | "undefined" | "integer" | "null" | "date" | "hex" | "base64" | "email" | "base64url" | "jwt" | "nanoid" | "cuid" | "cuid2" | "ulid" | "cidrv4" | "cidrv6" | "e164" | "xid" | "guid" | "ksuid" | "duration" | "ipv4" | "ipv6" | "browserEmail" | "creditCard" | "domain" | "extendedDuration" | "hostname" | "html5Email" | "httpProtocol" | "httpUrl" | "idnEmail" | "lowercase" | "md5" | "md5_base64" | "md5_base64url" | "md5_hex" | "rfc5322Email" | "sha1" | "sha1_base64" | "sha1_base64url" | "sha1_hex" | "sha256" | "sha256_base64" | "sha256_base64url" | "sha256_hex" | "sha384" | "sha384_base64" | "sha384_base64url" | "sha384_hex" | "sha512" | "sha512_base64" | "sha512_base64url" | "sha512_hex" | "unicodeEmail" | "uppercase" | "uuid4" | "uuid6" | "uuid7", RegExp> & {
|
|
1172
|
+
datetime: (options?: stringFormats.ISODateTimeOptions) => RegExp;
|
|
1173
|
+
emoji: () => RegExp;
|
|
1174
|
+
mac: (delimiter?: string) => RegExp;
|
|
1175
|
+
string: (options?: {
|
|
1176
|
+
minimum?: number;
|
|
1177
|
+
maximum?: number;
|
|
1178
|
+
}) => RegExp;
|
|
1179
|
+
time: (options?: stringFormats.ISOTimeOptions) => RegExp;
|
|
1180
|
+
uuid: (version?: number) => RegExp;
|
|
1181
|
+
}>;
|
|
1229
1182
|
templateLiteral: (...components: (VldBase<any, any> | string)[]) => VldTemplateLiteral;
|
|
1230
1183
|
base64Bytes: () => VldBase64;
|
|
1231
1184
|
hexBytes: () => VldHex;
|
|
@@ -1244,15 +1197,16 @@ declare const defaultFactory: {
|
|
|
1244
1197
|
safeDecode: <T>(schema: VldBase<unknown, T>, value: unknown) => ParseResult<T>;
|
|
1245
1198
|
decodeAsync: <T>(schema: VldBase<unknown, T>, value: unknown) => Promise<T>;
|
|
1246
1199
|
safeDecodeAsync: <T>(schema: VldBase<unknown, T>, value: unknown) => Promise<ParseResult<T>>;
|
|
1247
|
-
encode: <TInput, TOutput>(schema: VldBase<TInput, TOutput>, value:
|
|
1248
|
-
safeEncode: <TInput, TOutput>(schema: VldBase<TInput, TOutput>, value:
|
|
1249
|
-
encodeAsync: <TInput, TOutput>(schema: VldBase<TInput, TOutput>, value:
|
|
1250
|
-
safeEncodeAsync: <TInput, TOutput>(schema: VldBase<TInput, TOutput>, value:
|
|
1200
|
+
encode: <TInput, TOutput>(schema: VldBase<TInput, TOutput>, value: TOutput) => TInput;
|
|
1201
|
+
safeEncode: <TInput, TOutput>(schema: VldBase<TInput, TOutput>, value: TOutput) => ParseResult<TInput>;
|
|
1202
|
+
encodeAsync: <TInput, TOutput>(schema: VldBase<TInput, TOutput>, value: TOutput) => Promise<TInput>;
|
|
1203
|
+
safeEncodeAsync: <TInput, TOutput>(schema: VldBase<TInput, TOutput>, value: TOutput) => Promise<ParseResult<TInput>>;
|
|
1251
1204
|
formatError: (error: Error) => FormattedError;
|
|
1252
1205
|
treeifyError: typeof treeifyErrorFn;
|
|
1253
1206
|
prettifyError: typeof prettifyErrorFn;
|
|
1254
1207
|
flattenError: typeof flattenErrorFn;
|
|
1255
1208
|
toJSONSchema: typeof toJSONSchemaFn;
|
|
1209
|
+
fromJSONSchema: typeof fromJSONSchemaFn;
|
|
1256
1210
|
};
|
|
1257
1211
|
declare const zodStringFactory: typeof VldString;
|
|
1258
1212
|
export { catchFactory as catch, defaultFactory as _default, enumFactory as enum, functionFactory as function, functionFactory as _function, instanceOfFactory as instanceof, mapFactory as mapSchema, neverFactory as never, nullFactory as null, undefinedFactory as undefined, voidFactory as void, zodStringFactory as _ZodString };
|