@oxog/vld 2.1.0 → 2.2.5
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 +87 -0
- package/README.md +1296 -1235
- package/dist/chunks/errors-core-Cqi4-9ew.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-DKPohm9I.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 +20 -1
- package/dist/errors.js +1 -171
- package/dist/index.d.ts +248 -357
- 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 +63 -8
- package/dist/validators/base.js +1 -868
- package/dist/validators/base64.js +1 -68
- 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.js +1 -67
- package/dist/validators/date.js +1 -274
- package/dist/validators/discriminated-union.d.ts +2 -2
- package/dist/validators/discriminated-union.js +1 -123
- 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 +7 -3
- package/dist/validators/literal.js +1 -60
- 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 +20 -1
- package/dist/validators/number.js +1 -423
- package/dist/validators/object.d.ts +12 -2
- package/dist/validators/object.js +1 -864
- package/dist/validators/promise.js +1 -111
- package/dist/validators/record.d.ts +11 -8
- package/dist/validators/record.js +1 -258
- 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 +47 -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.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 +239 -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
|
@@ -23,7 +23,7 @@ import { VldStringBool } from './validators/string-bool.js';
|
|
|
23
23
|
import { VldArray } from './validators/array.js';
|
|
24
24
|
import { VldObject } from './validators/object.js';
|
|
25
25
|
import { VldUnion } from './validators/union.js';
|
|
26
|
-
import { VldLiteral } from './validators/literal.js';
|
|
26
|
+
import { VldLiteral, type LiteralValue } from './validators/literal.js';
|
|
27
27
|
import { VldBigInt } from './validators/bigint.js';
|
|
28
28
|
import { VldSymbol } from './validators/symbol.js';
|
|
29
29
|
import { VldTuple } from './validators/tuple.js';
|
|
@@ -61,7 +61,7 @@ import { VldCoerceBoolean } from './coercion/boolean.js';
|
|
|
61
61
|
import { VldCoerceDate } from './coercion/date.js';
|
|
62
62
|
import { VldCoerceBigInt } from './coercion/bigint.js';
|
|
63
63
|
import { flattenError as flattenErrorFn, prettifyError as prettifyErrorFn, treeifyError as treeifyErrorFn } from './errors.js';
|
|
64
|
-
import { toJSONSchema as toJSONSchemaFn } from './utils/json-schema.js';
|
|
64
|
+
import { fromJSONSchema as fromJSONSchemaFn, toJSONSchema as toJSONSchemaFn } from './utils/json-schema.js';
|
|
65
65
|
import * as stringFormats from './validators/string-formats.js';
|
|
66
66
|
type NativeEnumLike = Record<string, string | number>;
|
|
67
67
|
type Constructor<T = unknown> = abstract new (...args: any[]) => T;
|
|
@@ -133,41 +133,17 @@ export declare const core: {
|
|
|
133
133
|
readonly nullish: (value: unknown) => value is null | undefined;
|
|
134
134
|
readonly cached: <T>(getter: () => T) => (() => T);
|
|
135
135
|
};
|
|
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
|
-
};
|
|
136
|
+
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> & {
|
|
137
|
+
datetime: (options?: stringFormats.ISODateTimeOptions) => RegExp;
|
|
138
|
+
emoji: () => RegExp;
|
|
139
|
+
mac: (delimiter?: string) => RegExp;
|
|
140
|
+
string: (options?: {
|
|
141
|
+
minimum?: number;
|
|
142
|
+
maximum?: number;
|
|
143
|
+
}) => RegExp;
|
|
144
|
+
time: (options?: stringFormats.ISOTimeOptions) => RegExp;
|
|
145
|
+
uuid: (version?: number) => RegExp;
|
|
146
|
+
}>;
|
|
171
147
|
readonly locales: typeof localeNamespace;
|
|
172
148
|
readonly NEVER: VldNever;
|
|
173
149
|
readonly TimePrecision: {
|
|
@@ -205,7 +181,7 @@ export { VldBase } from './validators/base.js';
|
|
|
205
181
|
export { VldIntersection } from './validators/intersection.js';
|
|
206
182
|
export { VldMeta, type SchemaMetadata } from './validators/base.js';
|
|
207
183
|
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';
|
|
184
|
+
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
185
|
export { VldError as ZodError, VldError as ZodRealError } from './errors.js';
|
|
210
186
|
export { registry, globalRegistry, type SchemaRegistry } from './registry.js';
|
|
211
187
|
export { setLocale, setLocaleAsync, registerLocale, getLocale, getMessages, isLocaleLoaded, getSupportedLocales, isLocaleSupported, type Locale } from './locales/index.js';
|
|
@@ -213,6 +189,46 @@ export { VldError, VldIssue, VldErrorCode, VldErrorTree, VldFlattenedError, VldE
|
|
|
213
189
|
export { base64ToUint8Array, uint8ArrayToBase64, uint8ArrayToBase64Url, hexToUint8Array, uint8ArrayToHex, stringToUint8Array, uint8ArrayToString } from './utils/codec-utils.js';
|
|
214
190
|
export type { CodecTransform } from './validators/codec.js';
|
|
215
191
|
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';
|
|
192
|
+
type AnySchema = VldBase<any, any>;
|
|
193
|
+
type EnumValue = string | number;
|
|
194
|
+
type ShapeSchema = {
|
|
195
|
+
parse(value: unknown): any;
|
|
196
|
+
};
|
|
197
|
+
type SchemaOutput<T extends ShapeSchema> = ReturnType<T['parse']>;
|
|
198
|
+
type ObjectOutput<T extends Record<string, ShapeSchema>> = {
|
|
199
|
+
[K in keyof T as undefined extends SchemaOutput<T[K]> ? never : K]: SchemaOutput<T[K]>;
|
|
200
|
+
} & {
|
|
201
|
+
[K in keyof T as undefined extends SchemaOutput<T[K]> ? K : never]?: SchemaOutput<T[K]>;
|
|
202
|
+
};
|
|
203
|
+
declare function objectFactory<const T extends Record<string, ShapeSchema> = Record<never, never>>(shape?: T): VldObject<ObjectOutput<T>>;
|
|
204
|
+
declare function strictObjectFactory<const T extends Record<string, ShapeSchema>>(shape: T): VldObject<ObjectOutput<T>>;
|
|
205
|
+
declare function looseObjectFactory<const T extends Record<string, ShapeSchema>>(shape: T): VldObject<ObjectOutput<T>>;
|
|
206
|
+
declare function tupleFactory<const T extends readonly AnySchema[], TRest extends AnySchema>(items: T, rest: TRest, params?: unknown): VldTuple<T, TRest>;
|
|
207
|
+
declare function tupleFactory<const T extends readonly AnySchema[]>(items: T, params?: string | Record<string, unknown>): VldTuple<T>;
|
|
208
|
+
declare function tupleFactory<const T extends readonly AnySchema[]>(...items: T): VldTuple<T>;
|
|
209
|
+
declare function unionFactory<const T extends readonly AnySchema[]>(options: T, params?: unknown): VldUnion<T>;
|
|
210
|
+
declare function unionFactory<const T extends readonly AnySchema[]>(...options: T): VldUnion<T>;
|
|
211
|
+
declare function xorFactory<const T extends readonly AnySchema[]>(options: T, params?: unknown): VldXor<T>;
|
|
212
|
+
declare function xorFactory<const T extends readonly AnySchema[]>(...options: T): VldXor<T>;
|
|
213
|
+
declare function discriminatedUnionFactory<K extends string, const T extends readonly AnySchema[]>(discriminator: K, options: T, params?: unknown): VldDiscriminatedUnion<K, T>;
|
|
214
|
+
declare function discriminatedUnionFactory<K extends string, const T extends readonly AnySchema[]>(discriminator: K, ...options: T): VldDiscriminatedUnion<K, T>;
|
|
215
|
+
declare function recordFactory<V>(value: VldBase<unknown, V>): VldRecord<V>;
|
|
216
|
+
declare function recordFactory<K extends PropertyKey, V>(key: VldBase<unknown, K>, value: VldBase<unknown, V>, params?: unknown): VldRecord<V, K>;
|
|
217
|
+
declare function partialRecordFactory<V>(value: VldBase<unknown, V>): VldRecord<V | undefined>;
|
|
218
|
+
declare function partialRecordFactory<K extends PropertyKey, V>(key: VldBase<unknown, K>, value: VldBase<unknown, V>, params?: unknown): VldRecord<V | undefined, K>;
|
|
219
|
+
declare function looseRecordFactory<V>(value: VldBase<unknown, V>): VldBase<unknown, Record<string, V>>;
|
|
220
|
+
declare function looseRecordFactory<K extends PropertyKey, V>(key: VldBase<unknown, K>, value: VldBase<unknown, V>, params?: unknown): VldBase<unknown, Record<K, V>>;
|
|
221
|
+
declare function literalFactory<const T extends readonly LiteralValue[]>(values: T, params?: unknown): VldLiteral<T[number]>;
|
|
222
|
+
declare function literalFactory<const T extends LiteralValue>(value: T, params?: unknown): VldLiteral<T>;
|
|
223
|
+
declare function enumFactoryCompat<const T extends readonly [EnumValue, ...EnumValue[]]>(values: T, params?: unknown): VldEnum<T>;
|
|
224
|
+
declare function enumFactoryCompat<const T extends readonly [EnumValue, ...EnumValue[]]>(...values: T): VldEnum<T>;
|
|
225
|
+
declare function enumFactoryCompat<T extends NativeEnumLike>(entries: T, params?: unknown): VldEnum<any>;
|
|
226
|
+
/** Returns a copy of the schema with every nested object's properties made optional. */
|
|
227
|
+
export declare function deepPartial<T extends AnySchema>(schema: T): T;
|
|
228
|
+
/** Returns a copy of the schema with every pipe replaced by its input side. */
|
|
229
|
+
export declare function input<T extends AnySchema>(schema: T): T;
|
|
230
|
+
/** Returns a copy of the schema with every pipe replaced by its output side. */
|
|
231
|
+
export declare function output<T extends AnySchema>(schema: T): T;
|
|
216
232
|
/**
|
|
217
233
|
* Main API object with factory methods for all validators
|
|
218
234
|
*/
|
|
@@ -236,22 +252,25 @@ export declare const v: {
|
|
|
236
252
|
caseSensitive?: boolean;
|
|
237
253
|
}) => VldStringBool;
|
|
238
254
|
array: <T>(item: VldBase<unknown, T>) => VldArray<T>;
|
|
239
|
-
object:
|
|
240
|
-
strictObject:
|
|
241
|
-
looseObject:
|
|
242
|
-
tuple:
|
|
243
|
-
record:
|
|
244
|
-
partialRecord:
|
|
245
|
-
looseRecord:
|
|
255
|
+
object: typeof objectFactory;
|
|
256
|
+
strictObject: typeof strictObjectFactory;
|
|
257
|
+
looseObject: typeof looseObjectFactory;
|
|
258
|
+
tuple: typeof tupleFactory;
|
|
259
|
+
record: typeof recordFactory;
|
|
260
|
+
partialRecord: typeof partialRecordFactory;
|
|
261
|
+
looseRecord: typeof looseRecordFactory;
|
|
246
262
|
set: <T>(item: VldBase<unknown, T>) => VldSet<T>;
|
|
247
263
|
map: <K, V>(key: VldBase<unknown, K>, value: VldBase<unknown, V>) => VldMap<K, V>;
|
|
248
|
-
union:
|
|
264
|
+
union: typeof unionFactory;
|
|
249
265
|
intersection: <A, B>(first: VldBase<unknown, A>, second: VldBase<unknown, B>) => VldIntersection<A, B>;
|
|
250
|
-
discriminatedUnion:
|
|
251
|
-
xor:
|
|
266
|
+
discriminatedUnion: typeof discriminatedUnionFactory;
|
|
267
|
+
xor: typeof xorFactory;
|
|
252
268
|
keyof: <T extends Record<string, any>>(schema: VldObject<T>) => VldEnum<[string, ...string[]]>;
|
|
253
|
-
|
|
254
|
-
|
|
269
|
+
deepPartial: typeof deepPartial;
|
|
270
|
+
input: typeof input;
|
|
271
|
+
output: typeof output;
|
|
272
|
+
literal: typeof literalFactory;
|
|
273
|
+
enum: typeof enumFactoryCompat;
|
|
255
274
|
nativeEnum: <T extends NativeEnumLike>(enumObject: T) => VldEnum<any>;
|
|
256
275
|
any: () => VldAny;
|
|
257
276
|
unknown: () => VldUnknown;
|
|
@@ -288,9 +307,9 @@ export declare const v: {
|
|
|
288
307
|
exactOptional: <T>(validator: VldBase<unknown, T>) => VldExactOptional<unknown, T>;
|
|
289
308
|
nonoptional: <T>(validator: VldBase<unknown, T | undefined>, message?: RefinementMessage) => VldRefine<unknown, T | undefined, Exclude<T, undefined>>;
|
|
290
309
|
catch: <T>(validator: VldBase<unknown, T>, fallbackValue: T) => VldCatch<unknown, T>;
|
|
291
|
-
prefault: <
|
|
310
|
+
prefault: <TInput, TOutput>(validator: VldBase<TInput, TOutput>, defaultValue: TInput | (() => TInput)) => VldPrefault<TInput, TOutput>;
|
|
292
311
|
readonly: <T>(validator: VldBase<unknown, T>) => VldReadonly<unknown, T>;
|
|
293
|
-
pipe: <TInput, TIntermediate, TOutput>(first: VldBase<TInput, TIntermediate>, second: VldBase<
|
|
312
|
+
pipe: <TInput, TIntermediate, TOutput>(first: VldBase<TInput, TIntermediate>, second: VldBase<any, TOutput>) => VldPipe<TInput, TIntermediate, TOutput>;
|
|
294
313
|
clone: <T extends VldBase<any, any>>(schema: T) => T;
|
|
295
314
|
describe: <TInput, TOutput>(schemaOrDescription: VldBase<TInput, TOutput> | string, description?: string) => VldMeta<unknown, unknown>;
|
|
296
315
|
meta: <TInput, TOutput>(schemaOrMetadata: VldBase<TInput, TOutput> | Partial<SchemaMetadata>, metadata?: Partial<SchemaMetadata>) => VldMeta<unknown, unknown>;
|
|
@@ -316,41 +335,17 @@ export declare const v: {
|
|
|
316
335
|
readonly nullish: (value: unknown) => value is null | undefined;
|
|
317
336
|
readonly cached: <T>(getter: () => T) => (() => T);
|
|
318
337
|
};
|
|
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
|
-
};
|
|
338
|
+
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> & {
|
|
339
|
+
datetime: (options?: stringFormats.ISODateTimeOptions) => RegExp;
|
|
340
|
+
emoji: () => RegExp;
|
|
341
|
+
mac: (delimiter?: string) => RegExp;
|
|
342
|
+
string: (options?: {
|
|
343
|
+
minimum?: number;
|
|
344
|
+
maximum?: number;
|
|
345
|
+
}) => RegExp;
|
|
346
|
+
time: (options?: stringFormats.ISOTimeOptions) => RegExp;
|
|
347
|
+
uuid: (version?: number) => RegExp;
|
|
348
|
+
}>;
|
|
354
349
|
readonly locales: typeof localeNamespace;
|
|
355
350
|
readonly NEVER: VldNever;
|
|
356
351
|
readonly TimePrecision: {
|
|
@@ -410,9 +405,9 @@ export declare const v: {
|
|
|
410
405
|
email: (options?: {
|
|
411
406
|
pattern?: RegExp;
|
|
412
407
|
}) => stringFormats.VldStringFormat;
|
|
413
|
-
url: () =>
|
|
408
|
+
url: (options?: stringFormats.URLFormatOptions) => stringFormats.VldStringFormat;
|
|
414
409
|
uuid: (options?: {
|
|
415
|
-
version?:
|
|
410
|
+
version?: stringFormats.UUIDVersion;
|
|
416
411
|
}) => stringFormats.VldStringFormat;
|
|
417
412
|
uuidv4: () => stringFormats.VldStringFormat;
|
|
418
413
|
uuidv6: () => stringFormats.VldStringFormat;
|
|
@@ -432,12 +427,20 @@ export declare const v: {
|
|
|
432
427
|
mac: () => stringFormats.VldStringFormat;
|
|
433
428
|
cidrv4: () => stringFormats.VldStringFormat;
|
|
434
429
|
cidrv6: () => stringFormats.VldStringFormat;
|
|
430
|
+
creditCard: (params?: {
|
|
431
|
+
message?: string;
|
|
432
|
+
}) => stringFormats.VldStringFormat;
|
|
435
433
|
e164: () => stringFormats.VldStringFormat;
|
|
436
434
|
hash: (algorithm: "md5" | "sha1" | "sha256" | "sha384" | "sha512") => stringFormats.VldStringFormat;
|
|
437
435
|
iso: {
|
|
436
|
+
ZodISODate: typeof stringFormats.VldStringFormat;
|
|
437
|
+
ZodISODateTime: typeof stringFormats.VldStringFormat;
|
|
438
|
+
ZodISODuration: typeof stringFormats.VldStringFormat;
|
|
439
|
+
ZodISOTime: typeof stringFormats.VldStringFormat;
|
|
438
440
|
date: () => stringFormats.VldStringFormat;
|
|
439
|
-
time: () => stringFormats.VldStringFormat;
|
|
440
|
-
|
|
441
|
+
time: (options?: stringFormats.ISOTimeOptions) => stringFormats.VldStringFormat;
|
|
442
|
+
datetime: (options?: stringFormats.ISODateTimeOptions) => stringFormats.VldStringFormat;
|
|
443
|
+
dateTime: (options?: stringFormats.ISODateTimeOptions) => stringFormats.VldStringFormat;
|
|
441
444
|
duration: () => stringFormats.VldStringFormat;
|
|
442
445
|
};
|
|
443
446
|
stringFormat: (name: string, validator: ((val: string) => boolean) | RegExp) => stringFormats.VldStringFormat;
|
|
@@ -472,41 +475,17 @@ export declare const v: {
|
|
|
472
475
|
guid: () => stringFormats.VldStringFormat;
|
|
473
476
|
httpUrl: () => stringFormats.VldStringFormat;
|
|
474
477
|
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
|
-
};
|
|
478
|
+
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> & {
|
|
479
|
+
datetime: (options?: stringFormats.ISODateTimeOptions) => RegExp;
|
|
480
|
+
emoji: () => RegExp;
|
|
481
|
+
mac: (delimiter?: string) => RegExp;
|
|
482
|
+
string: (options?: {
|
|
483
|
+
minimum?: number;
|
|
484
|
+
maximum?: number;
|
|
485
|
+
}) => RegExp;
|
|
486
|
+
time: (options?: stringFormats.ISOTimeOptions) => RegExp;
|
|
487
|
+
uuid: (version?: number) => RegExp;
|
|
488
|
+
}>;
|
|
510
489
|
templateLiteral: (...components: (VldBase<any, any> | string)[]) => VldTemplateLiteral;
|
|
511
490
|
base64Bytes: () => VldBase64;
|
|
512
491
|
hexBytes: () => VldHex;
|
|
@@ -525,15 +504,16 @@ export declare const v: {
|
|
|
525
504
|
safeDecode: <T>(schema: VldBase<unknown, T>, value: unknown) => ParseResult<T>;
|
|
526
505
|
decodeAsync: <T>(schema: VldBase<unknown, T>, value: unknown) => Promise<T>;
|
|
527
506
|
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:
|
|
507
|
+
encode: <TInput, TOutput>(schema: VldBase<TInput, TOutput>, value: TOutput) => TInput;
|
|
508
|
+
safeEncode: <TInput, TOutput>(schema: VldBase<TInput, TOutput>, value: TOutput) => ParseResult<TInput>;
|
|
509
|
+
encodeAsync: <TInput, TOutput>(schema: VldBase<TInput, TOutput>, value: TOutput) => Promise<TInput>;
|
|
510
|
+
safeEncodeAsync: <TInput, TOutput>(schema: VldBase<TInput, TOutput>, value: TOutput) => Promise<ParseResult<TInput>>;
|
|
532
511
|
formatError: (error: Error) => FormattedError;
|
|
533
512
|
treeifyError: typeof treeifyErrorFn;
|
|
534
513
|
prettifyError: typeof prettifyErrorFn;
|
|
535
514
|
flattenError: typeof flattenErrorFn;
|
|
536
515
|
toJSONSchema: typeof toJSONSchemaFn;
|
|
516
|
+
fromJSONSchema: typeof fromJSONSchemaFn;
|
|
537
517
|
};
|
|
538
518
|
export declare namespace v {
|
|
539
519
|
type infer<T extends VldBase<any, any>> = Infer<T>;
|
|
@@ -563,22 +543,25 @@ export declare const z: {
|
|
|
563
543
|
caseSensitive?: boolean;
|
|
564
544
|
}) => VldStringBool;
|
|
565
545
|
array: <T>(item: VldBase<unknown, T>) => VldArray<T>;
|
|
566
|
-
object:
|
|
567
|
-
strictObject:
|
|
568
|
-
looseObject:
|
|
569
|
-
tuple:
|
|
570
|
-
record:
|
|
571
|
-
partialRecord:
|
|
572
|
-
looseRecord:
|
|
546
|
+
object: typeof objectFactory;
|
|
547
|
+
strictObject: typeof strictObjectFactory;
|
|
548
|
+
looseObject: typeof looseObjectFactory;
|
|
549
|
+
tuple: typeof tupleFactory;
|
|
550
|
+
record: typeof recordFactory;
|
|
551
|
+
partialRecord: typeof partialRecordFactory;
|
|
552
|
+
looseRecord: typeof looseRecordFactory;
|
|
573
553
|
set: <T>(item: VldBase<unknown, T>) => VldSet<T>;
|
|
574
554
|
map: <K, V>(key: VldBase<unknown, K>, value: VldBase<unknown, V>) => VldMap<K, V>;
|
|
575
|
-
union:
|
|
555
|
+
union: typeof unionFactory;
|
|
576
556
|
intersection: <A, B>(first: VldBase<unknown, A>, second: VldBase<unknown, B>) => VldIntersection<A, B>;
|
|
577
|
-
discriminatedUnion:
|
|
578
|
-
xor:
|
|
557
|
+
discriminatedUnion: typeof discriminatedUnionFactory;
|
|
558
|
+
xor: typeof xorFactory;
|
|
579
559
|
keyof: <T extends Record<string, any>>(schema: VldObject<T>) => VldEnum<[string, ...string[]]>;
|
|
580
|
-
|
|
581
|
-
|
|
560
|
+
deepPartial: typeof deepPartial;
|
|
561
|
+
input: typeof input;
|
|
562
|
+
output: typeof output;
|
|
563
|
+
literal: typeof literalFactory;
|
|
564
|
+
enum: typeof enumFactoryCompat;
|
|
582
565
|
nativeEnum: <T extends NativeEnumLike>(enumObject: T) => VldEnum<any>;
|
|
583
566
|
any: () => VldAny;
|
|
584
567
|
unknown: () => VldUnknown;
|
|
@@ -615,9 +598,9 @@ export declare const z: {
|
|
|
615
598
|
exactOptional: <T>(validator: VldBase<unknown, T>) => VldExactOptional<unknown, T>;
|
|
616
599
|
nonoptional: <T>(validator: VldBase<unknown, T | undefined>, message?: RefinementMessage) => VldRefine<unknown, T | undefined, Exclude<T, undefined>>;
|
|
617
600
|
catch: <T>(validator: VldBase<unknown, T>, fallbackValue: T) => VldCatch<unknown, T>;
|
|
618
|
-
prefault: <
|
|
601
|
+
prefault: <TInput, TOutput>(validator: VldBase<TInput, TOutput>, defaultValue: TInput | (() => TInput)) => VldPrefault<TInput, TOutput>;
|
|
619
602
|
readonly: <T>(validator: VldBase<unknown, T>) => VldReadonly<unknown, T>;
|
|
620
|
-
pipe: <TInput, TIntermediate, TOutput>(first: VldBase<TInput, TIntermediate>, second: VldBase<
|
|
603
|
+
pipe: <TInput, TIntermediate, TOutput>(first: VldBase<TInput, TIntermediate>, second: VldBase<any, TOutput>) => VldPipe<TInput, TIntermediate, TOutput>;
|
|
621
604
|
clone: <T extends VldBase<any, any>>(schema: T) => T;
|
|
622
605
|
describe: <TInput, TOutput>(schemaOrDescription: VldBase<TInput, TOutput> | string, description?: string) => VldMeta<unknown, unknown>;
|
|
623
606
|
meta: <TInput, TOutput>(schemaOrMetadata: VldBase<TInput, TOutput> | Partial<SchemaMetadata>, metadata?: Partial<SchemaMetadata>) => VldMeta<unknown, unknown>;
|
|
@@ -643,41 +626,17 @@ export declare const z: {
|
|
|
643
626
|
readonly nullish: (value: unknown) => value is null | undefined;
|
|
644
627
|
readonly cached: <T>(getter: () => T) => (() => T);
|
|
645
628
|
};
|
|
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
|
-
};
|
|
629
|
+
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> & {
|
|
630
|
+
datetime: (options?: stringFormats.ISODateTimeOptions) => RegExp;
|
|
631
|
+
emoji: () => RegExp;
|
|
632
|
+
mac: (delimiter?: string) => RegExp;
|
|
633
|
+
string: (options?: {
|
|
634
|
+
minimum?: number;
|
|
635
|
+
maximum?: number;
|
|
636
|
+
}) => RegExp;
|
|
637
|
+
time: (options?: stringFormats.ISOTimeOptions) => RegExp;
|
|
638
|
+
uuid: (version?: number) => RegExp;
|
|
639
|
+
}>;
|
|
681
640
|
readonly locales: typeof localeNamespace;
|
|
682
641
|
readonly NEVER: VldNever;
|
|
683
642
|
readonly TimePrecision: {
|
|
@@ -737,9 +696,9 @@ export declare const z: {
|
|
|
737
696
|
email: (options?: {
|
|
738
697
|
pattern?: RegExp;
|
|
739
698
|
}) => stringFormats.VldStringFormat;
|
|
740
|
-
url: () =>
|
|
699
|
+
url: (options?: stringFormats.URLFormatOptions) => stringFormats.VldStringFormat;
|
|
741
700
|
uuid: (options?: {
|
|
742
|
-
version?:
|
|
701
|
+
version?: stringFormats.UUIDVersion;
|
|
743
702
|
}) => stringFormats.VldStringFormat;
|
|
744
703
|
uuidv4: () => stringFormats.VldStringFormat;
|
|
745
704
|
uuidv6: () => stringFormats.VldStringFormat;
|
|
@@ -759,12 +718,20 @@ export declare const z: {
|
|
|
759
718
|
mac: () => stringFormats.VldStringFormat;
|
|
760
719
|
cidrv4: () => stringFormats.VldStringFormat;
|
|
761
720
|
cidrv6: () => stringFormats.VldStringFormat;
|
|
721
|
+
creditCard: (params?: {
|
|
722
|
+
message?: string;
|
|
723
|
+
}) => stringFormats.VldStringFormat;
|
|
762
724
|
e164: () => stringFormats.VldStringFormat;
|
|
763
725
|
hash: (algorithm: "md5" | "sha1" | "sha256" | "sha384" | "sha512") => stringFormats.VldStringFormat;
|
|
764
726
|
iso: {
|
|
727
|
+
ZodISODate: typeof stringFormats.VldStringFormat;
|
|
728
|
+
ZodISODateTime: typeof stringFormats.VldStringFormat;
|
|
729
|
+
ZodISODuration: typeof stringFormats.VldStringFormat;
|
|
730
|
+
ZodISOTime: typeof stringFormats.VldStringFormat;
|
|
765
731
|
date: () => stringFormats.VldStringFormat;
|
|
766
|
-
time: () => stringFormats.VldStringFormat;
|
|
767
|
-
|
|
732
|
+
time: (options?: stringFormats.ISOTimeOptions) => stringFormats.VldStringFormat;
|
|
733
|
+
datetime: (options?: stringFormats.ISODateTimeOptions) => stringFormats.VldStringFormat;
|
|
734
|
+
dateTime: (options?: stringFormats.ISODateTimeOptions) => stringFormats.VldStringFormat;
|
|
768
735
|
duration: () => stringFormats.VldStringFormat;
|
|
769
736
|
};
|
|
770
737
|
stringFormat: (name: string, validator: ((val: string) => boolean) | RegExp) => stringFormats.VldStringFormat;
|
|
@@ -799,41 +766,17 @@ export declare const z: {
|
|
|
799
766
|
guid: () => stringFormats.VldStringFormat;
|
|
800
767
|
httpUrl: () => stringFormats.VldStringFormat;
|
|
801
768
|
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
|
-
};
|
|
769
|
+
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> & {
|
|
770
|
+
datetime: (options?: stringFormats.ISODateTimeOptions) => RegExp;
|
|
771
|
+
emoji: () => RegExp;
|
|
772
|
+
mac: (delimiter?: string) => RegExp;
|
|
773
|
+
string: (options?: {
|
|
774
|
+
minimum?: number;
|
|
775
|
+
maximum?: number;
|
|
776
|
+
}) => RegExp;
|
|
777
|
+
time: (options?: stringFormats.ISOTimeOptions) => RegExp;
|
|
778
|
+
uuid: (version?: number) => RegExp;
|
|
779
|
+
}>;
|
|
837
780
|
templateLiteral: (...components: (VldBase<any, any> | string)[]) => VldTemplateLiteral;
|
|
838
781
|
base64Bytes: () => VldBase64;
|
|
839
782
|
hexBytes: () => VldHex;
|
|
@@ -852,15 +795,16 @@ export declare const z: {
|
|
|
852
795
|
safeDecode: <T>(schema: VldBase<unknown, T>, value: unknown) => ParseResult<T>;
|
|
853
796
|
decodeAsync: <T>(schema: VldBase<unknown, T>, value: unknown) => Promise<T>;
|
|
854
797
|
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:
|
|
798
|
+
encode: <TInput, TOutput>(schema: VldBase<TInput, TOutput>, value: TOutput) => TInput;
|
|
799
|
+
safeEncode: <TInput, TOutput>(schema: VldBase<TInput, TOutput>, value: TOutput) => ParseResult<TInput>;
|
|
800
|
+
encodeAsync: <TInput, TOutput>(schema: VldBase<TInput, TOutput>, value: TOutput) => Promise<TInput>;
|
|
801
|
+
safeEncodeAsync: <TInput, TOutput>(schema: VldBase<TInput, TOutput>, value: TOutput) => Promise<ParseResult<TInput>>;
|
|
859
802
|
formatError: (error: Error) => FormattedError;
|
|
860
803
|
treeifyError: typeof treeifyErrorFn;
|
|
861
804
|
prettifyError: typeof prettifyErrorFn;
|
|
862
805
|
flattenError: typeof flattenErrorFn;
|
|
863
806
|
toJSONSchema: typeof toJSONSchemaFn;
|
|
807
|
+
fromJSONSchema: typeof fromJSONSchemaFn;
|
|
864
808
|
};
|
|
865
809
|
/**
|
|
866
810
|
* Zod-compatible root-level factory aliases.
|
|
@@ -873,7 +817,7 @@ export declare const string: () => VldString, number: () => VldNumber, int: () =
|
|
|
873
817
|
truthy?: readonly string[];
|
|
874
818
|
falsy?: readonly string[];
|
|
875
819
|
caseSensitive?: boolean;
|
|
876
|
-
}) => VldStringBool, array: <T>(item: VldBase<unknown, T>) => VldArray<T>, object:
|
|
820
|
+
}) => 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: <TOutput = unknown>(options: CustomValidatorOptions<TOutput>) => VldCustom<TOutput>, file: () => VldFile, preprocess: <TInput, TOutput>(preprocessor: (input: unknown) => unknown, schema: VldBase<TInput, TOutput>) => VldPreprocess<TInput, TOutput>, coerce: {
|
|
877
821
|
string: () => VldCoerceString;
|
|
878
822
|
number: () => VldCoerceNumber;
|
|
879
823
|
boolean: () => VldCoerceBoolean;
|
|
@@ -881,53 +825,36 @@ export declare const string: () => VldString, number: () => VldNumber, int: () =
|
|
|
881
825
|
bigint: () => VldCoerceBigInt;
|
|
882
826
|
}, email: (options?: {
|
|
883
827
|
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,
|
|
828
|
+
}) => stringFormats.VldStringFormat, url: (options?: stringFormats.URLFormatOptions) => stringFormats.VldStringFormat, uuid: (options?: {
|
|
829
|
+
version?: stringFormats.UUIDVersion;
|
|
830
|
+
}) => 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?: {
|
|
831
|
+
message?: string;
|
|
832
|
+
}) => stringFormats.VldStringFormat, e164: () => stringFormats.VldStringFormat, hash: (algorithm: "md5" | "sha1" | "sha256" | "sha384" | "sha512") => stringFormats.VldStringFormat, iso: {
|
|
833
|
+
ZodISODate: typeof stringFormats.VldStringFormat;
|
|
834
|
+
ZodISODateTime: typeof stringFormats.VldStringFormat;
|
|
835
|
+
ZodISODuration: typeof stringFormats.VldStringFormat;
|
|
836
|
+
ZodISOTime: typeof stringFormats.VldStringFormat;
|
|
887
837
|
date: () => stringFormats.VldStringFormat;
|
|
888
|
-
time: () => stringFormats.VldStringFormat;
|
|
889
|
-
|
|
838
|
+
time: (options?: stringFormats.ISOTimeOptions) => stringFormats.VldStringFormat;
|
|
839
|
+
datetime: (options?: stringFormats.ISODateTimeOptions) => stringFormats.VldStringFormat;
|
|
840
|
+
dateTime: (options?: stringFormats.ISODateTimeOptions) => stringFormats.VldStringFormat;
|
|
890
841
|
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: {
|
|
842
|
+
}, 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> & {
|
|
843
|
+
datetime: (options?: stringFormats.ISODateTimeOptions) => RegExp;
|
|
844
|
+
emoji: () => RegExp;
|
|
845
|
+
mac: (delimiter?: string) => RegExp;
|
|
846
|
+
string: (options?: {
|
|
847
|
+
minimum?: number;
|
|
848
|
+
maximum?: number;
|
|
849
|
+
}) => RegExp;
|
|
850
|
+
time: (options?: stringFormats.ISOTimeOptions) => RegExp;
|
|
851
|
+
uuid: (version?: number) => RegExp;
|
|
852
|
+
}>, 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
853
|
decode: (value: TInput) => TOutput | Promise<TOutput>;
|
|
927
854
|
encode: (value: TOutput) => TInput | Promise<TInput>;
|
|
928
|
-
}) => VldCodec<TInput, TOutput>, promise: <T>(inner: VldBase<unknown, T>) => VldPromise<T>, prefault: <
|
|
855
|
+
}) => 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
856
|
declare const catchFactory: <T>(validator: VldBase<unknown, T>, fallbackValue: T) => VldCatch<unknown, T>;
|
|
930
|
-
declare const enumFactory:
|
|
857
|
+
declare const enumFactory: typeof enumFactoryCompat;
|
|
931
858
|
declare const functionFactory: () => VldFunction;
|
|
932
859
|
declare const instanceOfFactory: <T>(constructor: Constructor<T>, message?: RefinementMessage) => VldCustom<T>;
|
|
933
860
|
declare const mapFactory: <K, V>(key: VldBase<unknown, K>, value: VldBase<unknown, V>) => VldMap<K, V>;
|
|
@@ -955,22 +882,25 @@ declare const defaultFactory: {
|
|
|
955
882
|
caseSensitive?: boolean;
|
|
956
883
|
}) => VldStringBool;
|
|
957
884
|
array: <T>(item: VldBase<unknown, T>) => VldArray<T>;
|
|
958
|
-
object:
|
|
959
|
-
strictObject:
|
|
960
|
-
looseObject:
|
|
961
|
-
tuple:
|
|
962
|
-
record:
|
|
963
|
-
partialRecord:
|
|
964
|
-
looseRecord:
|
|
885
|
+
object: typeof objectFactory;
|
|
886
|
+
strictObject: typeof strictObjectFactory;
|
|
887
|
+
looseObject: typeof looseObjectFactory;
|
|
888
|
+
tuple: typeof tupleFactory;
|
|
889
|
+
record: typeof recordFactory;
|
|
890
|
+
partialRecord: typeof partialRecordFactory;
|
|
891
|
+
looseRecord: typeof looseRecordFactory;
|
|
965
892
|
set: <T>(item: VldBase<unknown, T>) => VldSet<T>;
|
|
966
893
|
map: <K, V>(key: VldBase<unknown, K>, value: VldBase<unknown, V>) => VldMap<K, V>;
|
|
967
|
-
union:
|
|
894
|
+
union: typeof unionFactory;
|
|
968
895
|
intersection: <A, B>(first: VldBase<unknown, A>, second: VldBase<unknown, B>) => VldIntersection<A, B>;
|
|
969
|
-
discriminatedUnion:
|
|
970
|
-
xor:
|
|
896
|
+
discriminatedUnion: typeof discriminatedUnionFactory;
|
|
897
|
+
xor: typeof xorFactory;
|
|
971
898
|
keyof: <T extends Record<string, any>>(schema: VldObject<T>) => VldEnum<[string, ...string[]]>;
|
|
972
|
-
|
|
973
|
-
|
|
899
|
+
deepPartial: typeof deepPartial;
|
|
900
|
+
input: typeof input;
|
|
901
|
+
output: typeof output;
|
|
902
|
+
literal: typeof literalFactory;
|
|
903
|
+
enum: typeof enumFactoryCompat;
|
|
974
904
|
nativeEnum: <T extends NativeEnumLike>(enumObject: T) => VldEnum<any>;
|
|
975
905
|
any: () => VldAny;
|
|
976
906
|
unknown: () => VldUnknown;
|
|
@@ -1007,9 +937,9 @@ declare const defaultFactory: {
|
|
|
1007
937
|
exactOptional: <T>(validator: VldBase<unknown, T>) => VldExactOptional<unknown, T>;
|
|
1008
938
|
nonoptional: <T>(validator: VldBase<unknown, T | undefined>, message?: RefinementMessage) => VldRefine<unknown, T | undefined, Exclude<T, undefined>>;
|
|
1009
939
|
catch: <T>(validator: VldBase<unknown, T>, fallbackValue: T) => VldCatch<unknown, T>;
|
|
1010
|
-
prefault: <
|
|
940
|
+
prefault: <TInput, TOutput>(validator: VldBase<TInput, TOutput>, defaultValue: TInput | (() => TInput)) => VldPrefault<TInput, TOutput>;
|
|
1011
941
|
readonly: <T>(validator: VldBase<unknown, T>) => VldReadonly<unknown, T>;
|
|
1012
|
-
pipe: <TInput, TIntermediate, TOutput>(first: VldBase<TInput, TIntermediate>, second: VldBase<
|
|
942
|
+
pipe: <TInput, TIntermediate, TOutput>(first: VldBase<TInput, TIntermediate>, second: VldBase<any, TOutput>) => VldPipe<TInput, TIntermediate, TOutput>;
|
|
1013
943
|
clone: <T extends VldBase<any, any>>(schema: T) => T;
|
|
1014
944
|
describe: <TInput, TOutput>(schemaOrDescription: VldBase<TInput, TOutput> | string, description?: string) => VldMeta<unknown, unknown>;
|
|
1015
945
|
meta: <TInput, TOutput>(schemaOrMetadata: VldBase<TInput, TOutput> | Partial<SchemaMetadata>, metadata?: Partial<SchemaMetadata>) => VldMeta<unknown, unknown>;
|
|
@@ -1035,41 +965,17 @@ declare const defaultFactory: {
|
|
|
1035
965
|
readonly nullish: (value: unknown) => value is null | undefined;
|
|
1036
966
|
readonly cached: <T>(getter: () => T) => (() => T);
|
|
1037
967
|
};
|
|
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
|
-
};
|
|
968
|
+
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> & {
|
|
969
|
+
datetime: (options?: stringFormats.ISODateTimeOptions) => RegExp;
|
|
970
|
+
emoji: () => RegExp;
|
|
971
|
+
mac: (delimiter?: string) => RegExp;
|
|
972
|
+
string: (options?: {
|
|
973
|
+
minimum?: number;
|
|
974
|
+
maximum?: number;
|
|
975
|
+
}) => RegExp;
|
|
976
|
+
time: (options?: stringFormats.ISOTimeOptions) => RegExp;
|
|
977
|
+
uuid: (version?: number) => RegExp;
|
|
978
|
+
}>;
|
|
1073
979
|
readonly locales: typeof localeNamespace;
|
|
1074
980
|
readonly NEVER: VldNever;
|
|
1075
981
|
readonly TimePrecision: {
|
|
@@ -1129,9 +1035,9 @@ declare const defaultFactory: {
|
|
|
1129
1035
|
email: (options?: {
|
|
1130
1036
|
pattern?: RegExp;
|
|
1131
1037
|
}) => stringFormats.VldStringFormat;
|
|
1132
|
-
url: () =>
|
|
1038
|
+
url: (options?: stringFormats.URLFormatOptions) => stringFormats.VldStringFormat;
|
|
1133
1039
|
uuid: (options?: {
|
|
1134
|
-
version?:
|
|
1040
|
+
version?: stringFormats.UUIDVersion;
|
|
1135
1041
|
}) => stringFormats.VldStringFormat;
|
|
1136
1042
|
uuidv4: () => stringFormats.VldStringFormat;
|
|
1137
1043
|
uuidv6: () => stringFormats.VldStringFormat;
|
|
@@ -1151,12 +1057,20 @@ declare const defaultFactory: {
|
|
|
1151
1057
|
mac: () => stringFormats.VldStringFormat;
|
|
1152
1058
|
cidrv4: () => stringFormats.VldStringFormat;
|
|
1153
1059
|
cidrv6: () => stringFormats.VldStringFormat;
|
|
1060
|
+
creditCard: (params?: {
|
|
1061
|
+
message?: string;
|
|
1062
|
+
}) => stringFormats.VldStringFormat;
|
|
1154
1063
|
e164: () => stringFormats.VldStringFormat;
|
|
1155
1064
|
hash: (algorithm: "md5" | "sha1" | "sha256" | "sha384" | "sha512") => stringFormats.VldStringFormat;
|
|
1156
1065
|
iso: {
|
|
1066
|
+
ZodISODate: typeof stringFormats.VldStringFormat;
|
|
1067
|
+
ZodISODateTime: typeof stringFormats.VldStringFormat;
|
|
1068
|
+
ZodISODuration: typeof stringFormats.VldStringFormat;
|
|
1069
|
+
ZodISOTime: typeof stringFormats.VldStringFormat;
|
|
1157
1070
|
date: () => stringFormats.VldStringFormat;
|
|
1158
|
-
time: () => stringFormats.VldStringFormat;
|
|
1159
|
-
|
|
1071
|
+
time: (options?: stringFormats.ISOTimeOptions) => stringFormats.VldStringFormat;
|
|
1072
|
+
datetime: (options?: stringFormats.ISODateTimeOptions) => stringFormats.VldStringFormat;
|
|
1073
|
+
dateTime: (options?: stringFormats.ISODateTimeOptions) => stringFormats.VldStringFormat;
|
|
1160
1074
|
duration: () => stringFormats.VldStringFormat;
|
|
1161
1075
|
};
|
|
1162
1076
|
stringFormat: (name: string, validator: ((val: string) => boolean) | RegExp) => stringFormats.VldStringFormat;
|
|
@@ -1191,41 +1105,17 @@ declare const defaultFactory: {
|
|
|
1191
1105
|
guid: () => stringFormats.VldStringFormat;
|
|
1192
1106
|
httpUrl: () => stringFormats.VldStringFormat;
|
|
1193
1107
|
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
|
-
};
|
|
1108
|
+
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> & {
|
|
1109
|
+
datetime: (options?: stringFormats.ISODateTimeOptions) => RegExp;
|
|
1110
|
+
emoji: () => RegExp;
|
|
1111
|
+
mac: (delimiter?: string) => RegExp;
|
|
1112
|
+
string: (options?: {
|
|
1113
|
+
minimum?: number;
|
|
1114
|
+
maximum?: number;
|
|
1115
|
+
}) => RegExp;
|
|
1116
|
+
time: (options?: stringFormats.ISOTimeOptions) => RegExp;
|
|
1117
|
+
uuid: (version?: number) => RegExp;
|
|
1118
|
+
}>;
|
|
1229
1119
|
templateLiteral: (...components: (VldBase<any, any> | string)[]) => VldTemplateLiteral;
|
|
1230
1120
|
base64Bytes: () => VldBase64;
|
|
1231
1121
|
hexBytes: () => VldHex;
|
|
@@ -1244,15 +1134,16 @@ declare const defaultFactory: {
|
|
|
1244
1134
|
safeDecode: <T>(schema: VldBase<unknown, T>, value: unknown) => ParseResult<T>;
|
|
1245
1135
|
decodeAsync: <T>(schema: VldBase<unknown, T>, value: unknown) => Promise<T>;
|
|
1246
1136
|
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:
|
|
1137
|
+
encode: <TInput, TOutput>(schema: VldBase<TInput, TOutput>, value: TOutput) => TInput;
|
|
1138
|
+
safeEncode: <TInput, TOutput>(schema: VldBase<TInput, TOutput>, value: TOutput) => ParseResult<TInput>;
|
|
1139
|
+
encodeAsync: <TInput, TOutput>(schema: VldBase<TInput, TOutput>, value: TOutput) => Promise<TInput>;
|
|
1140
|
+
safeEncodeAsync: <TInput, TOutput>(schema: VldBase<TInput, TOutput>, value: TOutput) => Promise<ParseResult<TInput>>;
|
|
1251
1141
|
formatError: (error: Error) => FormattedError;
|
|
1252
1142
|
treeifyError: typeof treeifyErrorFn;
|
|
1253
1143
|
prettifyError: typeof prettifyErrorFn;
|
|
1254
1144
|
flattenError: typeof flattenErrorFn;
|
|
1255
1145
|
toJSONSchema: typeof toJSONSchemaFn;
|
|
1146
|
+
fromJSONSchema: typeof fromJSONSchemaFn;
|
|
1256
1147
|
};
|
|
1257
1148
|
declare const zodStringFactory: typeof VldString;
|
|
1258
1149
|
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 };
|