@oxog/vld 2.2.5 → 2.4.0
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 +51 -0
- package/README.md +242 -1125
- package/dist/chunks/errors-core-CerMg2rq.js +1 -0
- package/dist/chunks/index-CKPStM3V.js +1 -0
- package/dist/cjs/chunks/errors-core-DrydF46s.cjs +1 -0
- package/dist/cjs/chunks/index-lejEpLfv.cjs +1 -0
- package/dist/cjs/cli/bin.cjs +1 -1
- package/dist/cjs/codecs/index.cjs +1 -1
- package/dist/cjs/coercion/index.cjs +1 -1
- package/dist/cjs/compile.cjs +1 -0
- package/dist/cjs/errors.cjs +1 -1
- package/dist/cjs/index.cjs +1 -1
- package/dist/cjs/locales/gu.cjs +1 -0
- package/dist/cjs/locales/index.cjs +1 -1
- package/dist/cjs/locales/kn.cjs +1 -0
- package/dist/cjs/locales/ne.cjs +1 -0
- package/dist/cjs/locales/pt-BR-v4.cjs +1 -0
- package/dist/cjs/locales/sk.cjs +1 -0
- package/dist/cjs/mini.cjs +1 -1
- package/dist/cjs/v3/index.cjs +1 -1
- package/dist/cjs/v4/core/index.cjs +1 -1
- package/dist/cjs/v4/index.cjs +1 -1
- package/dist/cjs/v4/locales/index.cjs +1 -1
- package/dist/cjs/v4/mini/index.cjs +1 -1
- package/dist/cjs/v4-mini/index.cjs +1 -1
- package/dist/cjs/validators/any.cjs +1 -1
- package/dist/cjs/validators/array.cjs +1 -1
- package/dist/cjs/validators/base.cjs +1 -1
- package/dist/cjs/validators/base64.cjs +1 -1
- package/dist/cjs/validators/bigint.cjs +1 -1
- package/dist/cjs/validators/boolean.cjs +1 -1
- package/dist/cjs/validators/codec.cjs +1 -1
- package/dist/cjs/validators/custom.cjs +1 -1
- package/dist/cjs/validators/date.cjs +1 -1
- package/dist/cjs/validators/discriminated-union.cjs +1 -1
- package/dist/cjs/validators/enum.cjs +1 -1
- package/dist/cjs/validators/file.cjs +1 -1
- package/dist/cjs/validators/function.cjs +1 -1
- package/dist/cjs/validators/hex.cjs +1 -1
- package/dist/cjs/validators/index.cjs +1 -1
- package/dist/cjs/validators/intersection.cjs +1 -1
- package/dist/cjs/validators/json.cjs +1 -1
- package/dist/cjs/validators/lazy.cjs +1 -1
- package/dist/cjs/validators/literal.cjs +1 -1
- package/dist/cjs/validators/map.cjs +1 -1
- package/dist/cjs/validators/nan.cjs +1 -1
- package/dist/cjs/validators/never.cjs +1 -1
- package/dist/cjs/validators/null.cjs +1 -1
- package/dist/cjs/validators/number.cjs +1 -1
- package/dist/cjs/validators/object.cjs +1 -1
- package/dist/cjs/validators/promise.cjs +1 -1
- package/dist/cjs/validators/record.cjs +1 -1
- package/dist/cjs/validators/set.cjs +1 -1
- package/dist/cjs/validators/string-bool.cjs +1 -1
- package/dist/cjs/validators/string-formats.cjs +1 -1
- package/dist/cjs/validators/string.cjs +1 -1
- package/dist/cjs/validators/symbol.cjs +1 -1
- package/dist/cjs/validators/template-literal.cjs +1 -1
- package/dist/cjs/validators/tuple.cjs +1 -1
- package/dist/cjs/validators/uint8array.cjs +1 -1
- package/dist/cjs/validators/undefined.cjs +1 -1
- package/dist/cjs/validators/union.cjs +1 -1
- package/dist/cjs/validators/unknown.cjs +1 -1
- package/dist/cjs/validators/void.cjs +1 -1
- package/dist/cjs/validators/xor.cjs +1 -1
- package/dist/coercion/index.js +1 -1
- package/dist/compile.d.ts +81 -0
- package/dist/compile.js +1 -0
- package/dist/errors-core.d.ts +12 -1
- package/dist/errors.js +1 -1
- package/dist/index.d.ts +384 -14
- package/dist/index.js +1 -1
- package/dist/locales/gu.d.ts +2 -0
- package/dist/locales/gu.js +1 -0
- package/dist/locales/index.js +1 -1
- package/dist/locales/kn.d.ts +2 -0
- package/dist/locales/kn.js +1 -0
- package/dist/locales/ne.d.ts +2 -0
- package/dist/locales/ne.js +1 -0
- package/dist/locales/pt-BR-v4.d.ts +2 -0
- package/dist/locales/pt-BR-v4.js +1 -0
- package/dist/locales/sk.d.ts +2 -0
- package/dist/locales/sk.js +1 -0
- package/dist/v3/index.js +1 -1
- package/dist/v4/core/index.d.ts +13 -0
- package/dist/v4/core/index.js +1 -1
- package/dist/v4/index.d.ts +1 -0
- package/dist/v4/index.js +1 -1
- package/dist/v4/locales/index.d.ts +6 -0
- package/dist/v4/locales/index.js +1 -1
- package/dist/v4/mini/index.js +1 -1
- package/dist/v4-mini/index.d.ts +2 -0
- package/dist/v4-mini/index.js +1 -1
- package/dist/validators/array.js +1 -1
- package/dist/validators/base.d.ts +147 -9
- package/dist/validators/base.js +1 -1
- package/dist/validators/base64.js +1 -1
- package/dist/validators/bigint.d.ts +7 -0
- package/dist/validators/bigint.js +1 -1
- package/dist/validators/boolean.js +1 -1
- package/dist/validators/codec.js +1 -1
- package/dist/validators/custom.d.ts +20 -10
- package/dist/validators/custom.js +1 -1
- package/dist/validators/date.d.ts +2 -0
- package/dist/validators/date.js +1 -1
- package/dist/validators/discriminated-union.d.ts +2 -0
- package/dist/validators/discriminated-union.js +1 -1
- package/dist/validators/enum.d.ts +8 -2
- package/dist/validators/enum.js +1 -1
- package/dist/validators/file.js +1 -1
- package/dist/validators/function.js +1 -1
- package/dist/validators/hex.js +1 -1
- package/dist/validators/intersection.js +1 -1
- package/dist/validators/json.js +1 -1
- package/dist/validators/literal.d.ts +1 -0
- package/dist/validators/literal.js +1 -1
- package/dist/validators/map.d.ts +7 -0
- package/dist/validators/map.js +1 -1
- package/dist/validators/nan.js +1 -1
- package/dist/validators/never.js +1 -1
- package/dist/validators/null.js +1 -1
- package/dist/validators/number.d.ts +5 -0
- package/dist/validators/number.js +1 -1
- package/dist/validators/object.d.ts +15 -0
- package/dist/validators/object.js +1 -1
- package/dist/validators/promise.d.ts +6 -7
- package/dist/validators/promise.js +1 -1
- package/dist/validators/record.d.ts +2 -0
- package/dist/validators/record.js +1 -1
- package/dist/validators/set.d.ts +5 -0
- package/dist/validators/set.js +1 -1
- package/dist/validators/string-bool.js +1 -1
- package/dist/validators/string-formats.d.ts +1 -0
- package/dist/validators/string-formats.js +1 -1
- package/dist/validators/string.d.ts +2 -0
- package/dist/validators/string.js +1 -1
- package/dist/validators/symbol.js +1 -1
- package/dist/validators/template-literal.js +1 -1
- package/dist/validators/tuple.js +1 -1
- package/dist/validators/uint8array.js +1 -1
- package/dist/validators/undefined.js +1 -1
- package/dist/validators/union.d.ts +1 -0
- package/dist/validators/union.js +1 -1
- package/dist/validators/void.js +1 -1
- package/dist/validators/xor.js +1 -1
- package/package.json +8 -2
- package/dist/chunks/errors-core-Cqi4-9ew.js +0 -1
- package/dist/chunks/index-yjpbvFgw.js +0 -1
- package/dist/cjs/chunks/errors-core-DKPohm9I.cjs +0 -1
- package/dist/cjs/chunks/index-BEV9nG0N.cjs +0 -1
package/dist/index.d.ts
CHANGED
|
@@ -15,6 +15,8 @@
|
|
|
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 { registry } from './registry.js';
|
|
19
|
+
import { VldError, type VldIssue } from './errors-core.js';
|
|
18
20
|
import { VldString } from './validators/string.js';
|
|
19
21
|
import { VldNumber } from './validators/number.js';
|
|
20
22
|
import { VldBoolean } from './validators/boolean.js';
|
|
@@ -44,7 +46,7 @@ import { VldDiscriminatedUnion } from './validators/discriminated-union.js';
|
|
|
44
46
|
import { VldXor } from './validators/xor.js';
|
|
45
47
|
import { VldJson } from './validators/json.js';
|
|
46
48
|
import { VldTemplateLiteral } from './validators/template-literal.js';
|
|
47
|
-
import { VldCustom,
|
|
49
|
+
import { VldCustom, custom as customFn } from './validators/custom.js';
|
|
48
50
|
import { VldFile } from './validators/file.js';
|
|
49
51
|
import { VldFunction } from './validators/function.js';
|
|
50
52
|
import { VldBrand, VldCatch, VldDefault, VldExactOptional, VldMeta, VldNullable, VldNullish, VldOptional, VldPipe, VldPrefault, VldPreprocess, VldReadonly, VldRefine, VldTransform } from './validators/base.js';
|
|
@@ -62,6 +64,7 @@ import { VldCoerceDate } from './coercion/date.js';
|
|
|
62
64
|
import { VldCoerceBigInt } from './coercion/bigint.js';
|
|
63
65
|
import { flattenError as flattenErrorFn, prettifyError as prettifyErrorFn, treeifyError as treeifyErrorFn } from './errors.js';
|
|
64
66
|
import { fromJSONSchema as fromJSONSchemaFn, toJSONSchema as toJSONSchemaFn } from './utils/json-schema.js';
|
|
67
|
+
import { validate as validateFn, validateAsync as validateAsyncFn, properties as propertiesFn, getDiscriminatedOption as getDiscriminatedOptionFn, toZod as toZodFn, ZodCompileError as ZodCompileErrorClass, ZodCompileAsyncError as ZodCompileAsyncErrorClass, ZodCompileUnsupportedError as ZodCompileUnsupportedErrorClass } from './compile.js';
|
|
65
68
|
import * as stringFormats from './validators/string-formats.js';
|
|
66
69
|
type NativeEnumLike = Record<string, string | number>;
|
|
67
70
|
type Constructor<T = unknown> = abstract new (...args: any[]) => T;
|
|
@@ -133,7 +136,8 @@ export declare const core: {
|
|
|
133
136
|
readonly nullish: (value: unknown) => value is null | undefined;
|
|
134
137
|
readonly cached: <T>(getter: () => T) => (() => T);
|
|
135
138
|
};
|
|
136
|
-
readonly regexes: Readonly<Record<"number" | "bigint" | "boolean" | "undefined" | "integer" | "
|
|
139
|
+
readonly regexes: Readonly<Record<"number" | "bigint" | "boolean" | "undefined" | "integer" | "date" | "null" | "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> & {
|
|
140
|
+
nanoidOfLength: (length: number) => RegExp;
|
|
137
141
|
datetime: (options?: stringFormats.ISODateTimeOptions) => RegExp;
|
|
138
142
|
emoji: () => RegExp;
|
|
139
143
|
mac: (delimiter?: string) => RegExp;
|
|
@@ -335,7 +339,8 @@ export declare const v: {
|
|
|
335
339
|
readonly nullish: (value: unknown) => value is null | undefined;
|
|
336
340
|
readonly cached: <T>(getter: () => T) => (() => T);
|
|
337
341
|
};
|
|
338
|
-
readonly regexes: Readonly<Record<"number" | "bigint" | "boolean" | "undefined" | "integer" | "
|
|
342
|
+
readonly regexes: Readonly<Record<"number" | "bigint" | "boolean" | "undefined" | "integer" | "date" | "null" | "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> & {
|
|
343
|
+
nanoidOfLength: (length: number) => RegExp;
|
|
339
344
|
datetime: (options?: stringFormats.ISODateTimeOptions) => RegExp;
|
|
340
345
|
emoji: () => RegExp;
|
|
341
346
|
mac: (delimiter?: string) => RegExp;
|
|
@@ -391,7 +396,7 @@ export declare const v: {
|
|
|
391
396
|
locales: typeof localeNamespace;
|
|
392
397
|
lazy: <T>(schemaGetter: () => VldBase<unknown, T>) => VldLazy<unknown, T>;
|
|
393
398
|
json: <T = unknown>(schema?: VldBase<unknown, T>) => VldJson<T>;
|
|
394
|
-
custom:
|
|
399
|
+
custom: typeof customFn;
|
|
395
400
|
file: () => VldFile;
|
|
396
401
|
function: () => VldFunction;
|
|
397
402
|
preprocess: <TInput, TOutput>(preprocessor: (input: unknown) => unknown, schema: VldBase<TInput, TOutput>) => VldPreprocess<TInput, TOutput>;
|
|
@@ -475,7 +480,8 @@ export declare const v: {
|
|
|
475
480
|
guid: () => stringFormats.VldStringFormat;
|
|
476
481
|
httpUrl: () => stringFormats.VldStringFormat;
|
|
477
482
|
ksuid: () => stringFormats.VldStringFormat;
|
|
478
|
-
regexes: Readonly<Record<"number" | "bigint" | "boolean" | "undefined" | "integer" | "
|
|
483
|
+
regexes: Readonly<Record<"number" | "bigint" | "boolean" | "undefined" | "integer" | "date" | "null" | "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> & {
|
|
484
|
+
nanoidOfLength: (length: number) => RegExp;
|
|
479
485
|
datetime: (options?: stringFormats.ISODateTimeOptions) => RegExp;
|
|
480
486
|
emoji: () => RegExp;
|
|
481
487
|
mac: (delimiter?: string) => RegExp;
|
|
@@ -486,6 +492,15 @@ export declare const v: {
|
|
|
486
492
|
time: (options?: stringFormats.ISOTimeOptions) => RegExp;
|
|
487
493
|
uuid: (version?: number) => RegExp;
|
|
488
494
|
}>;
|
|
495
|
+
compile: <T extends VldBase<any, any>>(schema: T, options?: {
|
|
496
|
+
JITless?: boolean;
|
|
497
|
+
}) => T;
|
|
498
|
+
validate: typeof validateFn;
|
|
499
|
+
validateAsync: typeof validateAsyncFn;
|
|
500
|
+
properties: typeof propertiesFn;
|
|
501
|
+
getDiscriminatedOption: typeof getDiscriminatedOptionFn;
|
|
502
|
+
memoizer: <K extends object, V>(compute: (key: K) => V) => ((key: K) => V);
|
|
503
|
+
toZod: typeof toZodFn;
|
|
489
504
|
templateLiteral: (...components: (VldBase<any, any> | string)[]) => VldTemplateLiteral;
|
|
490
505
|
base64Bytes: () => VldBase64;
|
|
491
506
|
hexBytes: () => VldHex;
|
|
@@ -514,12 +529,163 @@ export declare const v: {
|
|
|
514
529
|
flattenError: typeof flattenErrorFn;
|
|
515
530
|
toJSONSchema: typeof toJSONSchemaFn;
|
|
516
531
|
fromJSONSchema: typeof fromJSONSchemaFn;
|
|
532
|
+
globalRegistry: import("./registry.js").SchemaRegistry<SchemaMetadata>;
|
|
533
|
+
registry: typeof registry;
|
|
534
|
+
_default: <TInput, TOutput>(schema: VldBase<TInput, TOutput>, defaultValue: TOutput | (() => TOutput)) => VldDefault<TInput, TOutput>;
|
|
535
|
+
success: <TOutput = unknown>(_val?: TOutput) => VldCustom<TOutput>;
|
|
536
|
+
_function: () => VldFunction;
|
|
537
|
+
ZodType: typeof VldBase;
|
|
538
|
+
ZodTypeAny: typeof VldBase;
|
|
539
|
+
ZodTypeDef: ObjectConstructor;
|
|
540
|
+
ZodError: typeof VldError;
|
|
541
|
+
ZodRealError: typeof VldError;
|
|
542
|
+
ZodCompileError: typeof ZodCompileErrorClass;
|
|
543
|
+
ZodCompileAsyncError: typeof ZodCompileAsyncErrorClass;
|
|
544
|
+
ZodCompileUnsupportedError: typeof ZodCompileUnsupportedErrorClass;
|
|
545
|
+
_ZodString: typeof VldString;
|
|
546
|
+
ZodString: typeof VldString;
|
|
547
|
+
ZodStringFormat: typeof VldString;
|
|
548
|
+
ZodEmail: typeof VldString;
|
|
549
|
+
ZodGUID: typeof VldString;
|
|
550
|
+
ZodUUID: typeof VldString;
|
|
551
|
+
ZodURL: typeof VldString;
|
|
552
|
+
ZodEmoji: typeof VldString;
|
|
553
|
+
ZodNanoID: typeof VldString;
|
|
554
|
+
ZodCUID: typeof VldString;
|
|
555
|
+
ZodCUID2: typeof VldString;
|
|
556
|
+
ZodULID: typeof VldString;
|
|
557
|
+
ZodXID: typeof VldString;
|
|
558
|
+
ZodKSUID: typeof VldString;
|
|
559
|
+
ZodIPv4: typeof VldString;
|
|
560
|
+
ZodMAC: typeof VldString;
|
|
561
|
+
ZodIPv6: typeof VldString;
|
|
562
|
+
ZodCIDRv4: typeof VldString;
|
|
563
|
+
ZodCIDRv6: typeof VldString;
|
|
564
|
+
ZodBase64: typeof VldString;
|
|
565
|
+
ZodBase64URL: typeof VldString;
|
|
566
|
+
ZodE164: typeof VldString;
|
|
567
|
+
ZodJWT: typeof VldString;
|
|
568
|
+
ZodCustomStringFormat: typeof VldString;
|
|
569
|
+
ZodNumber: typeof VldNumber;
|
|
570
|
+
ZodNumberFormat: typeof VldNumber;
|
|
571
|
+
ZodBoolean: typeof VldBoolean;
|
|
572
|
+
ZodBigInt: typeof VldBigInt;
|
|
573
|
+
ZodBigIntFormat: typeof VldBigInt;
|
|
574
|
+
ZodSymbol: typeof VldSymbol;
|
|
575
|
+
ZodUndefined: typeof VldUndefined;
|
|
576
|
+
ZodNull: typeof VldNull;
|
|
577
|
+
ZodAny: typeof VldAny;
|
|
578
|
+
ZodUnknown: typeof VldUnknown;
|
|
579
|
+
ZodNever: typeof VldNever;
|
|
580
|
+
ZodVoid: typeof VldVoid;
|
|
581
|
+
ZodDate: typeof VldDate;
|
|
582
|
+
ZodArray: typeof VldArray;
|
|
583
|
+
ZodObject: typeof VldObject;
|
|
584
|
+
ZodUnion: typeof VldUnion;
|
|
585
|
+
ZodXor: typeof VldXor;
|
|
586
|
+
ZodDiscriminatedUnion: typeof VldDiscriminatedUnion;
|
|
587
|
+
ZodIntersection: typeof VldIntersection;
|
|
588
|
+
ZodTuple: typeof VldTuple;
|
|
589
|
+
ZodRecord: typeof VldRecord;
|
|
590
|
+
ZodMap: typeof VldMap;
|
|
591
|
+
ZodSet: typeof VldSet;
|
|
592
|
+
ZodEnum: typeof VldEnum;
|
|
593
|
+
ZodLiteral: typeof VldLiteral;
|
|
594
|
+
ZodFile: typeof VldFile;
|
|
595
|
+
ZodTransform: typeof VldBase;
|
|
596
|
+
ZodOptional: typeof VldBase;
|
|
597
|
+
ZodExactOptional: typeof VldBase;
|
|
598
|
+
ZodNullable: typeof VldBase;
|
|
599
|
+
ZodDefault: typeof VldBase;
|
|
600
|
+
ZodPrefault: typeof VldBase;
|
|
601
|
+
ZodNonOptional: typeof VldBase;
|
|
602
|
+
ZodSuccess: typeof VldCustom;
|
|
603
|
+
ZodCatch: typeof VldBase;
|
|
604
|
+
ZodNaN: typeof VldNan;
|
|
605
|
+
ZodPipe: typeof VldBase;
|
|
606
|
+
ZodCodec: typeof VldCodec;
|
|
607
|
+
ZodPreprocess: typeof VldBase;
|
|
608
|
+
ZodReadonly: typeof VldBase;
|
|
609
|
+
ZodTemplateLiteral: typeof VldTemplateLiteral;
|
|
610
|
+
ZodLazy: typeof VldLazy;
|
|
611
|
+
ZodPromise: typeof VldPromise;
|
|
612
|
+
ZodFunction: typeof VldFunction;
|
|
613
|
+
ZodCustom: typeof VldCustom;
|
|
614
|
+
ZodISODateTime: typeof VldString;
|
|
615
|
+
ZodISODate: typeof VldString;
|
|
616
|
+
ZodISOTime: typeof VldString;
|
|
617
|
+
ZodISODuration: typeof VldString;
|
|
618
|
+
$brand: symbol;
|
|
619
|
+
$output: symbol;
|
|
620
|
+
$input: symbol;
|
|
517
621
|
};
|
|
518
622
|
export declare namespace v {
|
|
519
623
|
type infer<T extends VldBase<any, any>> = Infer<T>;
|
|
520
624
|
type input<T extends VldBase<any, any>> = Input<T>;
|
|
521
625
|
type output<T extends VldBase<any, any>> = Output<T>;
|
|
626
|
+
type Schema<Output = any, _Def = any, Input = Output> = VldBase<Input, Output>;
|
|
627
|
+
type ZodSchema<Output = any, _Def = any, Input = Output> = VldBase<Input, Output>;
|
|
628
|
+
type ZodType<Output = any, _Def = any, Input = Output> = VldBase<Input, Output>;
|
|
629
|
+
type ZodTypeAny = VldBase<any, any>;
|
|
630
|
+
type ZodTypeDef = any;
|
|
631
|
+
type ZodError<_T = any> = VldError;
|
|
632
|
+
type ZodIssue = VldIssue;
|
|
633
|
+
type SafeParseSuccess<T> = {
|
|
634
|
+
readonly success: true;
|
|
635
|
+
readonly data: T;
|
|
636
|
+
readonly error?: undefined;
|
|
637
|
+
};
|
|
638
|
+
type SafeParseError<_T = unknown> = {
|
|
639
|
+
readonly success: false;
|
|
640
|
+
readonly error: VldError;
|
|
641
|
+
readonly data?: undefined;
|
|
642
|
+
};
|
|
643
|
+
type SafeParseReturnType<_Input, Output> = ParseResult<Output>;
|
|
644
|
+
type CustomErrorParams = {
|
|
645
|
+
message?: string;
|
|
646
|
+
path?: (string | number)[];
|
|
647
|
+
params?: {
|
|
648
|
+
[k: string]: any;
|
|
649
|
+
};
|
|
650
|
+
fatal?: boolean;
|
|
651
|
+
};
|
|
652
|
+
}
|
|
653
|
+
export declare namespace z {
|
|
654
|
+
type infer<T extends VldBase<any, any>> = Infer<T>;
|
|
655
|
+
type input<T extends VldBase<any, any>> = Input<T>;
|
|
656
|
+
type output<T extends VldBase<any, any>> = Output<T>;
|
|
657
|
+
type Schema<Output = any, _Def = any, Input = Output> = VldBase<Input, Output>;
|
|
658
|
+
type ZodSchema<Output = any, _Def = any, Input = Output> = VldBase<Input, Output>;
|
|
659
|
+
type ZodType<Output = any, _Def = any, Input = Output> = VldBase<Input, Output>;
|
|
660
|
+
type ZodTypeAny = VldBase<any, any>;
|
|
661
|
+
type ZodTypeDef = any;
|
|
662
|
+
type ZodError<_T = any> = VldError;
|
|
663
|
+
type ZodIssue = VldIssue;
|
|
664
|
+
type SafeParseSuccess<T> = {
|
|
665
|
+
readonly success: true;
|
|
666
|
+
readonly data: T;
|
|
667
|
+
readonly error?: undefined;
|
|
668
|
+
};
|
|
669
|
+
type SafeParseError<_T = unknown> = {
|
|
670
|
+
readonly success: false;
|
|
671
|
+
readonly error: VldError;
|
|
672
|
+
readonly data?: undefined;
|
|
673
|
+
};
|
|
674
|
+
type SafeParseReturnType<_Input, Output> = ParseResult<Output>;
|
|
675
|
+
type CustomErrorParams = {
|
|
676
|
+
message?: string;
|
|
677
|
+
path?: (string | number)[];
|
|
678
|
+
params?: {
|
|
679
|
+
[k: string]: any;
|
|
680
|
+
};
|
|
681
|
+
fatal?: boolean;
|
|
682
|
+
};
|
|
522
683
|
}
|
|
684
|
+
export type ZodSchema<Output = any, _Def = any, Input = Output> = VldBase<Input, Output>;
|
|
685
|
+
export type ZodTypeAny = VldBase<any, any>;
|
|
686
|
+
export type ZodTypeDef = any;
|
|
687
|
+
export type { VldIssue as ZodIssue };
|
|
688
|
+
export type { SafeParseSuccess, SafeParseError, SafeParseReturnType, CustomErrorParams } from './validators/base.js';
|
|
523
689
|
/**
|
|
524
690
|
* Zod-compatible namespace alias.
|
|
525
691
|
*/
|
|
@@ -626,7 +792,8 @@ export declare const z: {
|
|
|
626
792
|
readonly nullish: (value: unknown) => value is null | undefined;
|
|
627
793
|
readonly cached: <T>(getter: () => T) => (() => T);
|
|
628
794
|
};
|
|
629
|
-
readonly regexes: Readonly<Record<"number" | "bigint" | "boolean" | "undefined" | "integer" | "
|
|
795
|
+
readonly regexes: Readonly<Record<"number" | "bigint" | "boolean" | "undefined" | "integer" | "date" | "null" | "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> & {
|
|
796
|
+
nanoidOfLength: (length: number) => RegExp;
|
|
630
797
|
datetime: (options?: stringFormats.ISODateTimeOptions) => RegExp;
|
|
631
798
|
emoji: () => RegExp;
|
|
632
799
|
mac: (delimiter?: string) => RegExp;
|
|
@@ -682,7 +849,7 @@ export declare const z: {
|
|
|
682
849
|
locales: typeof localeNamespace;
|
|
683
850
|
lazy: <T>(schemaGetter: () => VldBase<unknown, T>) => VldLazy<unknown, T>;
|
|
684
851
|
json: <T = unknown>(schema?: VldBase<unknown, T>) => VldJson<T>;
|
|
685
|
-
custom:
|
|
852
|
+
custom: typeof customFn;
|
|
686
853
|
file: () => VldFile;
|
|
687
854
|
function: () => VldFunction;
|
|
688
855
|
preprocess: <TInput, TOutput>(preprocessor: (input: unknown) => unknown, schema: VldBase<TInput, TOutput>) => VldPreprocess<TInput, TOutput>;
|
|
@@ -766,7 +933,8 @@ export declare const z: {
|
|
|
766
933
|
guid: () => stringFormats.VldStringFormat;
|
|
767
934
|
httpUrl: () => stringFormats.VldStringFormat;
|
|
768
935
|
ksuid: () => stringFormats.VldStringFormat;
|
|
769
|
-
regexes: Readonly<Record<"number" | "bigint" | "boolean" | "undefined" | "integer" | "
|
|
936
|
+
regexes: Readonly<Record<"number" | "bigint" | "boolean" | "undefined" | "integer" | "date" | "null" | "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> & {
|
|
937
|
+
nanoidOfLength: (length: number) => RegExp;
|
|
770
938
|
datetime: (options?: stringFormats.ISODateTimeOptions) => RegExp;
|
|
771
939
|
emoji: () => RegExp;
|
|
772
940
|
mac: (delimiter?: string) => RegExp;
|
|
@@ -777,6 +945,15 @@ export declare const z: {
|
|
|
777
945
|
time: (options?: stringFormats.ISOTimeOptions) => RegExp;
|
|
778
946
|
uuid: (version?: number) => RegExp;
|
|
779
947
|
}>;
|
|
948
|
+
compile: <T extends VldBase<any, any>>(schema: T, options?: {
|
|
949
|
+
JITless?: boolean;
|
|
950
|
+
}) => T;
|
|
951
|
+
validate: typeof validateFn;
|
|
952
|
+
validateAsync: typeof validateAsyncFn;
|
|
953
|
+
properties: typeof propertiesFn;
|
|
954
|
+
getDiscriminatedOption: typeof getDiscriminatedOptionFn;
|
|
955
|
+
memoizer: <K extends object, V>(compute: (key: K) => V) => ((key: K) => V);
|
|
956
|
+
toZod: typeof toZodFn;
|
|
780
957
|
templateLiteral: (...components: (VldBase<any, any> | string)[]) => VldTemplateLiteral;
|
|
781
958
|
base64Bytes: () => VldBase64;
|
|
782
959
|
hexBytes: () => VldHex;
|
|
@@ -805,6 +982,95 @@ export declare const z: {
|
|
|
805
982
|
flattenError: typeof flattenErrorFn;
|
|
806
983
|
toJSONSchema: typeof toJSONSchemaFn;
|
|
807
984
|
fromJSONSchema: typeof fromJSONSchemaFn;
|
|
985
|
+
globalRegistry: import("./registry.js").SchemaRegistry<SchemaMetadata>;
|
|
986
|
+
registry: typeof registry;
|
|
987
|
+
_default: <TInput, TOutput>(schema: VldBase<TInput, TOutput>, defaultValue: TOutput | (() => TOutput)) => VldDefault<TInput, TOutput>;
|
|
988
|
+
success: <TOutput = unknown>(_val?: TOutput) => VldCustom<TOutput>;
|
|
989
|
+
_function: () => VldFunction;
|
|
990
|
+
ZodType: typeof VldBase;
|
|
991
|
+
ZodTypeAny: typeof VldBase;
|
|
992
|
+
ZodTypeDef: ObjectConstructor;
|
|
993
|
+
ZodError: typeof VldError;
|
|
994
|
+
ZodRealError: typeof VldError;
|
|
995
|
+
ZodCompileError: typeof ZodCompileErrorClass;
|
|
996
|
+
ZodCompileAsyncError: typeof ZodCompileAsyncErrorClass;
|
|
997
|
+
ZodCompileUnsupportedError: typeof ZodCompileUnsupportedErrorClass;
|
|
998
|
+
_ZodString: typeof VldString;
|
|
999
|
+
ZodString: typeof VldString;
|
|
1000
|
+
ZodStringFormat: typeof VldString;
|
|
1001
|
+
ZodEmail: typeof VldString;
|
|
1002
|
+
ZodGUID: typeof VldString;
|
|
1003
|
+
ZodUUID: typeof VldString;
|
|
1004
|
+
ZodURL: typeof VldString;
|
|
1005
|
+
ZodEmoji: typeof VldString;
|
|
1006
|
+
ZodNanoID: typeof VldString;
|
|
1007
|
+
ZodCUID: typeof VldString;
|
|
1008
|
+
ZodCUID2: typeof VldString;
|
|
1009
|
+
ZodULID: typeof VldString;
|
|
1010
|
+
ZodXID: typeof VldString;
|
|
1011
|
+
ZodKSUID: typeof VldString;
|
|
1012
|
+
ZodIPv4: typeof VldString;
|
|
1013
|
+
ZodMAC: typeof VldString;
|
|
1014
|
+
ZodIPv6: typeof VldString;
|
|
1015
|
+
ZodCIDRv4: typeof VldString;
|
|
1016
|
+
ZodCIDRv6: typeof VldString;
|
|
1017
|
+
ZodBase64: typeof VldString;
|
|
1018
|
+
ZodBase64URL: typeof VldString;
|
|
1019
|
+
ZodE164: typeof VldString;
|
|
1020
|
+
ZodJWT: typeof VldString;
|
|
1021
|
+
ZodCustomStringFormat: typeof VldString;
|
|
1022
|
+
ZodNumber: typeof VldNumber;
|
|
1023
|
+
ZodNumberFormat: typeof VldNumber;
|
|
1024
|
+
ZodBoolean: typeof VldBoolean;
|
|
1025
|
+
ZodBigInt: typeof VldBigInt;
|
|
1026
|
+
ZodBigIntFormat: typeof VldBigInt;
|
|
1027
|
+
ZodSymbol: typeof VldSymbol;
|
|
1028
|
+
ZodUndefined: typeof VldUndefined;
|
|
1029
|
+
ZodNull: typeof VldNull;
|
|
1030
|
+
ZodAny: typeof VldAny;
|
|
1031
|
+
ZodUnknown: typeof VldUnknown;
|
|
1032
|
+
ZodNever: typeof VldNever;
|
|
1033
|
+
ZodVoid: typeof VldVoid;
|
|
1034
|
+
ZodDate: typeof VldDate;
|
|
1035
|
+
ZodArray: typeof VldArray;
|
|
1036
|
+
ZodObject: typeof VldObject;
|
|
1037
|
+
ZodUnion: typeof VldUnion;
|
|
1038
|
+
ZodXor: typeof VldXor;
|
|
1039
|
+
ZodDiscriminatedUnion: typeof VldDiscriminatedUnion;
|
|
1040
|
+
ZodIntersection: typeof VldIntersection;
|
|
1041
|
+
ZodTuple: typeof VldTuple;
|
|
1042
|
+
ZodRecord: typeof VldRecord;
|
|
1043
|
+
ZodMap: typeof VldMap;
|
|
1044
|
+
ZodSet: typeof VldSet;
|
|
1045
|
+
ZodEnum: typeof VldEnum;
|
|
1046
|
+
ZodLiteral: typeof VldLiteral;
|
|
1047
|
+
ZodFile: typeof VldFile;
|
|
1048
|
+
ZodTransform: typeof VldBase;
|
|
1049
|
+
ZodOptional: typeof VldBase;
|
|
1050
|
+
ZodExactOptional: typeof VldBase;
|
|
1051
|
+
ZodNullable: typeof VldBase;
|
|
1052
|
+
ZodDefault: typeof VldBase;
|
|
1053
|
+
ZodPrefault: typeof VldBase;
|
|
1054
|
+
ZodNonOptional: typeof VldBase;
|
|
1055
|
+
ZodSuccess: typeof VldCustom;
|
|
1056
|
+
ZodCatch: typeof VldBase;
|
|
1057
|
+
ZodNaN: typeof VldNan;
|
|
1058
|
+
ZodPipe: typeof VldBase;
|
|
1059
|
+
ZodCodec: typeof VldCodec;
|
|
1060
|
+
ZodPreprocess: typeof VldBase;
|
|
1061
|
+
ZodReadonly: typeof VldBase;
|
|
1062
|
+
ZodTemplateLiteral: typeof VldTemplateLiteral;
|
|
1063
|
+
ZodLazy: typeof VldLazy;
|
|
1064
|
+
ZodPromise: typeof VldPromise;
|
|
1065
|
+
ZodFunction: typeof VldFunction;
|
|
1066
|
+
ZodCustom: typeof VldCustom;
|
|
1067
|
+
ZodISODateTime: typeof VldString;
|
|
1068
|
+
ZodISODate: typeof VldString;
|
|
1069
|
+
ZodISOTime: typeof VldString;
|
|
1070
|
+
ZodISODuration: typeof VldString;
|
|
1071
|
+
$brand: symbol;
|
|
1072
|
+
$output: symbol;
|
|
1073
|
+
$input: symbol;
|
|
808
1074
|
};
|
|
809
1075
|
/**
|
|
810
1076
|
* Zod-compatible root-level factory aliases.
|
|
@@ -817,7 +1083,7 @@ export declare const string: () => VldString, number: () => VldNumber, int: () =
|
|
|
817
1083
|
truthy?: readonly string[];
|
|
818
1084
|
falsy?: readonly string[];
|
|
819
1085
|
caseSensitive?: boolean;
|
|
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:
|
|
1086
|
+
}) => 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: {
|
|
821
1087
|
string: () => VldCoerceString;
|
|
822
1088
|
number: () => VldCoerceNumber;
|
|
823
1089
|
boolean: () => VldCoerceBoolean;
|
|
@@ -839,7 +1105,8 @@ export declare const string: () => VldString, number: () => VldNumber, int: () =
|
|
|
839
1105
|
datetime: (options?: stringFormats.ISODateTimeOptions) => stringFormats.VldStringFormat;
|
|
840
1106
|
dateTime: (options?: stringFormats.ISODateTimeOptions) => stringFormats.VldStringFormat;
|
|
841
1107
|
duration: () => stringFormats.VldStringFormat;
|
|
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" | "
|
|
1108
|
+
}, 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" | "date" | "null" | "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
|
+
nanoidOfLength: (length: number) => RegExp;
|
|
843
1110
|
datetime: (options?: stringFormats.ISODateTimeOptions) => RegExp;
|
|
844
1111
|
emoji: () => RegExp;
|
|
845
1112
|
mac: (delimiter?: string) => RegExp;
|
|
@@ -852,7 +1119,9 @@ export declare const string: () => VldString, number: () => VldNumber, int: () =
|
|
|
852
1119
|
}>, 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: {
|
|
853
1120
|
decode: (value: TInput) => TOutput | Promise<TOutput>;
|
|
854
1121
|
encode: (value: TOutput) => TInput | Promise<TInput>;
|
|
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
|
|
1122
|
+
}) => 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, compile: <T extends VldBase<any, any>>(schema: T, options?: {
|
|
1123
|
+
JITless?: boolean;
|
|
1124
|
+
}) => T, validate: typeof validateFn, validateAsync: typeof validateAsyncFn, properties: typeof propertiesFn, getDiscriminatedOption: typeof getDiscriminatedOptionFn, memoizer: <K extends object, V>(compute: (key: K) => V) => ((key: K) => V), toZod: typeof toZodFn;
|
|
856
1125
|
declare const catchFactory: <T>(validator: VldBase<unknown, T>, fallbackValue: T) => VldCatch<unknown, T>;
|
|
857
1126
|
declare const enumFactory: typeof enumFactoryCompat;
|
|
858
1127
|
declare const functionFactory: () => VldFunction;
|
|
@@ -965,7 +1234,8 @@ declare const defaultFactory: {
|
|
|
965
1234
|
readonly nullish: (value: unknown) => value is null | undefined;
|
|
966
1235
|
readonly cached: <T>(getter: () => T) => (() => T);
|
|
967
1236
|
};
|
|
968
|
-
readonly regexes: Readonly<Record<"number" | "bigint" | "boolean" | "undefined" | "integer" | "
|
|
1237
|
+
readonly regexes: Readonly<Record<"number" | "bigint" | "boolean" | "undefined" | "integer" | "date" | "null" | "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> & {
|
|
1238
|
+
nanoidOfLength: (length: number) => RegExp;
|
|
969
1239
|
datetime: (options?: stringFormats.ISODateTimeOptions) => RegExp;
|
|
970
1240
|
emoji: () => RegExp;
|
|
971
1241
|
mac: (delimiter?: string) => RegExp;
|
|
@@ -1021,7 +1291,7 @@ declare const defaultFactory: {
|
|
|
1021
1291
|
locales: typeof localeNamespace;
|
|
1022
1292
|
lazy: <T>(schemaGetter: () => VldBase<unknown, T>) => VldLazy<unknown, T>;
|
|
1023
1293
|
json: <T = unknown>(schema?: VldBase<unknown, T>) => VldJson<T>;
|
|
1024
|
-
custom:
|
|
1294
|
+
custom: typeof customFn;
|
|
1025
1295
|
file: () => VldFile;
|
|
1026
1296
|
function: () => VldFunction;
|
|
1027
1297
|
preprocess: <TInput, TOutput>(preprocessor: (input: unknown) => unknown, schema: VldBase<TInput, TOutput>) => VldPreprocess<TInput, TOutput>;
|
|
@@ -1105,7 +1375,8 @@ declare const defaultFactory: {
|
|
|
1105
1375
|
guid: () => stringFormats.VldStringFormat;
|
|
1106
1376
|
httpUrl: () => stringFormats.VldStringFormat;
|
|
1107
1377
|
ksuid: () => stringFormats.VldStringFormat;
|
|
1108
|
-
regexes: Readonly<Record<"number" | "bigint" | "boolean" | "undefined" | "integer" | "
|
|
1378
|
+
regexes: Readonly<Record<"number" | "bigint" | "boolean" | "undefined" | "integer" | "date" | "null" | "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> & {
|
|
1379
|
+
nanoidOfLength: (length: number) => RegExp;
|
|
1109
1380
|
datetime: (options?: stringFormats.ISODateTimeOptions) => RegExp;
|
|
1110
1381
|
emoji: () => RegExp;
|
|
1111
1382
|
mac: (delimiter?: string) => RegExp;
|
|
@@ -1116,6 +1387,15 @@ declare const defaultFactory: {
|
|
|
1116
1387
|
time: (options?: stringFormats.ISOTimeOptions) => RegExp;
|
|
1117
1388
|
uuid: (version?: number) => RegExp;
|
|
1118
1389
|
}>;
|
|
1390
|
+
compile: <T extends VldBase<any, any>>(schema: T, options?: {
|
|
1391
|
+
JITless?: boolean;
|
|
1392
|
+
}) => T;
|
|
1393
|
+
validate: typeof validateFn;
|
|
1394
|
+
validateAsync: typeof validateAsyncFn;
|
|
1395
|
+
properties: typeof propertiesFn;
|
|
1396
|
+
getDiscriminatedOption: typeof getDiscriminatedOptionFn;
|
|
1397
|
+
memoizer: <K extends object, V>(compute: (key: K) => V) => ((key: K) => V);
|
|
1398
|
+
toZod: typeof toZodFn;
|
|
1119
1399
|
templateLiteral: (...components: (VldBase<any, any> | string)[]) => VldTemplateLiteral;
|
|
1120
1400
|
base64Bytes: () => VldBase64;
|
|
1121
1401
|
hexBytes: () => VldHex;
|
|
@@ -1144,6 +1424,95 @@ declare const defaultFactory: {
|
|
|
1144
1424
|
flattenError: typeof flattenErrorFn;
|
|
1145
1425
|
toJSONSchema: typeof toJSONSchemaFn;
|
|
1146
1426
|
fromJSONSchema: typeof fromJSONSchemaFn;
|
|
1427
|
+
globalRegistry: import("./registry.js").SchemaRegistry<SchemaMetadata>;
|
|
1428
|
+
registry: typeof registry;
|
|
1429
|
+
_default: <TInput, TOutput>(schema: VldBase<TInput, TOutput>, defaultValue: TOutput | (() => TOutput)) => VldDefault<TInput, TOutput>;
|
|
1430
|
+
success: <TOutput = unknown>(_val?: TOutput) => VldCustom<TOutput>;
|
|
1431
|
+
_function: () => VldFunction;
|
|
1432
|
+
ZodType: typeof VldBase;
|
|
1433
|
+
ZodTypeAny: typeof VldBase;
|
|
1434
|
+
ZodTypeDef: ObjectConstructor;
|
|
1435
|
+
ZodError: typeof VldError;
|
|
1436
|
+
ZodRealError: typeof VldError;
|
|
1437
|
+
ZodCompileError: typeof ZodCompileErrorClass;
|
|
1438
|
+
ZodCompileAsyncError: typeof ZodCompileAsyncErrorClass;
|
|
1439
|
+
ZodCompileUnsupportedError: typeof ZodCompileUnsupportedErrorClass;
|
|
1440
|
+
_ZodString: typeof VldString;
|
|
1441
|
+
ZodString: typeof VldString;
|
|
1442
|
+
ZodStringFormat: typeof VldString;
|
|
1443
|
+
ZodEmail: typeof VldString;
|
|
1444
|
+
ZodGUID: typeof VldString;
|
|
1445
|
+
ZodUUID: typeof VldString;
|
|
1446
|
+
ZodURL: typeof VldString;
|
|
1447
|
+
ZodEmoji: typeof VldString;
|
|
1448
|
+
ZodNanoID: typeof VldString;
|
|
1449
|
+
ZodCUID: typeof VldString;
|
|
1450
|
+
ZodCUID2: typeof VldString;
|
|
1451
|
+
ZodULID: typeof VldString;
|
|
1452
|
+
ZodXID: typeof VldString;
|
|
1453
|
+
ZodKSUID: typeof VldString;
|
|
1454
|
+
ZodIPv4: typeof VldString;
|
|
1455
|
+
ZodMAC: typeof VldString;
|
|
1456
|
+
ZodIPv6: typeof VldString;
|
|
1457
|
+
ZodCIDRv4: typeof VldString;
|
|
1458
|
+
ZodCIDRv6: typeof VldString;
|
|
1459
|
+
ZodBase64: typeof VldString;
|
|
1460
|
+
ZodBase64URL: typeof VldString;
|
|
1461
|
+
ZodE164: typeof VldString;
|
|
1462
|
+
ZodJWT: typeof VldString;
|
|
1463
|
+
ZodCustomStringFormat: typeof VldString;
|
|
1464
|
+
ZodNumber: typeof VldNumber;
|
|
1465
|
+
ZodNumberFormat: typeof VldNumber;
|
|
1466
|
+
ZodBoolean: typeof VldBoolean;
|
|
1467
|
+
ZodBigInt: typeof VldBigInt;
|
|
1468
|
+
ZodBigIntFormat: typeof VldBigInt;
|
|
1469
|
+
ZodSymbol: typeof VldSymbol;
|
|
1470
|
+
ZodUndefined: typeof VldUndefined;
|
|
1471
|
+
ZodNull: typeof VldNull;
|
|
1472
|
+
ZodAny: typeof VldAny;
|
|
1473
|
+
ZodUnknown: typeof VldUnknown;
|
|
1474
|
+
ZodNever: typeof VldNever;
|
|
1475
|
+
ZodVoid: typeof VldVoid;
|
|
1476
|
+
ZodDate: typeof VldDate;
|
|
1477
|
+
ZodArray: typeof VldArray;
|
|
1478
|
+
ZodObject: typeof VldObject;
|
|
1479
|
+
ZodUnion: typeof VldUnion;
|
|
1480
|
+
ZodXor: typeof VldXor;
|
|
1481
|
+
ZodDiscriminatedUnion: typeof VldDiscriminatedUnion;
|
|
1482
|
+
ZodIntersection: typeof VldIntersection;
|
|
1483
|
+
ZodTuple: typeof VldTuple;
|
|
1484
|
+
ZodRecord: typeof VldRecord;
|
|
1485
|
+
ZodMap: typeof VldMap;
|
|
1486
|
+
ZodSet: typeof VldSet;
|
|
1487
|
+
ZodEnum: typeof VldEnum;
|
|
1488
|
+
ZodLiteral: typeof VldLiteral;
|
|
1489
|
+
ZodFile: typeof VldFile;
|
|
1490
|
+
ZodTransform: typeof VldBase;
|
|
1491
|
+
ZodOptional: typeof VldBase;
|
|
1492
|
+
ZodExactOptional: typeof VldBase;
|
|
1493
|
+
ZodNullable: typeof VldBase;
|
|
1494
|
+
ZodDefault: typeof VldBase;
|
|
1495
|
+
ZodPrefault: typeof VldBase;
|
|
1496
|
+
ZodNonOptional: typeof VldBase;
|
|
1497
|
+
ZodSuccess: typeof VldCustom;
|
|
1498
|
+
ZodCatch: typeof VldBase;
|
|
1499
|
+
ZodNaN: typeof VldNan;
|
|
1500
|
+
ZodPipe: typeof VldBase;
|
|
1501
|
+
ZodCodec: typeof VldCodec;
|
|
1502
|
+
ZodPreprocess: typeof VldBase;
|
|
1503
|
+
ZodReadonly: typeof VldBase;
|
|
1504
|
+
ZodTemplateLiteral: typeof VldTemplateLiteral;
|
|
1505
|
+
ZodLazy: typeof VldLazy;
|
|
1506
|
+
ZodPromise: typeof VldPromise;
|
|
1507
|
+
ZodFunction: typeof VldFunction;
|
|
1508
|
+
ZodCustom: typeof VldCustom;
|
|
1509
|
+
ZodISODateTime: typeof VldString;
|
|
1510
|
+
ZodISODate: typeof VldString;
|
|
1511
|
+
ZodISOTime: typeof VldString;
|
|
1512
|
+
ZodISODuration: typeof VldString;
|
|
1513
|
+
$brand: symbol;
|
|
1514
|
+
$output: symbol;
|
|
1515
|
+
$input: symbol;
|
|
1147
1516
|
};
|
|
1148
1517
|
declare const zodStringFactory: typeof VldString;
|
|
1149
1518
|
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 };
|
|
@@ -1182,3 +1551,4 @@ export { createLogger, initLogger, getLogger, setLogLevel, enableDebug, disableL
|
|
|
1182
1551
|
export { pigment, supportsColor, bold, dim, italic, underline, red, green, yellow, blue, magenta, cyan, white, gray, grey, strip, vldTheme, createTheme, type Theme } from './pigment.js';
|
|
1183
1552
|
export { toJSONSchema, fromJSONSchema, type JSONSchemaDefinition, type ToJSONSchemaOptions } from './utils/json-schema.js';
|
|
1184
1553
|
export default v;
|
|
1554
|
+
export { compileFn as zodCompileFn, ZodCompileAsyncError, ZodCompileUnsupportedError } from './compile.js';
|