@oxog/vld 2.2.7 → 3.0.1

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.
Files changed (159) hide show
  1. package/CHANGELOG.md +92 -0
  2. package/README.md +113 -1
  3. package/dist/chunks/errors-core-BU14-Dk8.js +1 -0
  4. package/dist/chunks/index-CKPStM3V.js +1 -0
  5. package/dist/cjs/chunks/errors-core-C0mA6tfa.cjs +1 -0
  6. package/dist/cjs/chunks/index-lejEpLfv.cjs +1 -0
  7. package/dist/cjs/cli/bin.cjs +1 -1
  8. package/dist/cjs/codecs/index.cjs +1 -1
  9. package/dist/cjs/coercion/index.cjs +1 -1
  10. package/dist/cjs/compile.cjs +1 -0
  11. package/dist/cjs/errors.cjs +1 -1
  12. package/dist/cjs/index.cjs +1 -1
  13. package/dist/cjs/locales/gu.cjs +1 -0
  14. package/dist/cjs/locales/index.cjs +1 -1
  15. package/dist/cjs/locales/kn.cjs +1 -0
  16. package/dist/cjs/locales/ne.cjs +1 -0
  17. package/dist/cjs/locales/pt-BR-v4.cjs +1 -0
  18. package/dist/cjs/locales/sk.cjs +1 -0
  19. package/dist/cjs/mini.cjs +1 -1
  20. package/dist/cjs/v3/index.cjs +1 -1
  21. package/dist/cjs/v4/core/index.cjs +1 -1
  22. package/dist/cjs/v4/index.cjs +1 -1
  23. package/dist/cjs/v4/locales/index.cjs +1 -1
  24. package/dist/cjs/v4/mini/index.cjs +1 -1
  25. package/dist/cjs/v4-mini/index.cjs +1 -1
  26. package/dist/cjs/validators/any.cjs +1 -1
  27. package/dist/cjs/validators/array-v2.cjs +1 -0
  28. package/dist/cjs/validators/array.cjs +1 -1
  29. package/dist/cjs/validators/base.cjs +1 -1
  30. package/dist/cjs/validators/base64.cjs +1 -1
  31. package/dist/cjs/validators/bigint-v2.cjs +1 -0
  32. package/dist/cjs/validators/bigint.cjs +1 -1
  33. package/dist/cjs/validators/boolean.cjs +1 -1
  34. package/dist/cjs/validators/codec.cjs +1 -1
  35. package/dist/cjs/validators/composite-v2.cjs +1 -0
  36. package/dist/cjs/validators/custom.cjs +1 -1
  37. package/dist/cjs/validators/date-v2.cjs +1 -0
  38. package/dist/cjs/validators/date.cjs +1 -1
  39. package/dist/cjs/validators/discriminated-union.cjs +1 -1
  40. package/dist/cjs/validators/enum.cjs +1 -1
  41. package/dist/cjs/validators/file.cjs +1 -1
  42. package/dist/cjs/validators/function.cjs +1 -1
  43. package/dist/cjs/validators/hex.cjs +1 -1
  44. package/dist/cjs/validators/index.cjs +1 -1
  45. package/dist/cjs/validators/intersection.cjs +1 -1
  46. package/dist/cjs/validators/json.cjs +1 -1
  47. package/dist/cjs/validators/lazy.cjs +1 -1
  48. package/dist/cjs/validators/leaf-v2.cjs +1 -0
  49. package/dist/cjs/validators/literal.cjs +1 -1
  50. package/dist/cjs/validators/map.cjs +1 -1
  51. package/dist/cjs/validators/nan.cjs +1 -1
  52. package/dist/cjs/validators/never.cjs +1 -1
  53. package/dist/cjs/validators/null.cjs +1 -1
  54. package/dist/cjs/validators/number-v2.cjs +1 -0
  55. package/dist/cjs/validators/number.cjs +1 -1
  56. package/dist/cjs/validators/object-v2.cjs +1 -0
  57. package/dist/cjs/validators/object.cjs +1 -1
  58. package/dist/cjs/validators/promise.cjs +1 -1
  59. package/dist/cjs/validators/record.cjs +1 -1
  60. package/dist/cjs/validators/set.cjs +1 -1
  61. package/dist/cjs/validators/string-bool.cjs +1 -1
  62. package/dist/cjs/validators/string-formats.cjs +1 -1
  63. package/dist/cjs/validators/string-v2.cjs +1 -0
  64. package/dist/cjs/validators/string.cjs +1 -1
  65. package/dist/cjs/validators/symbol.cjs +1 -1
  66. package/dist/cjs/validators/template-literal.cjs +1 -1
  67. package/dist/cjs/validators/tuple.cjs +1 -1
  68. package/dist/cjs/validators/uint8array.cjs +1 -1
  69. package/dist/cjs/validators/undefined.cjs +1 -1
  70. package/dist/cjs/validators/union-v2.cjs +1 -0
  71. package/dist/cjs/validators/union.cjs +1 -1
  72. package/dist/cjs/validators/unknown.cjs +1 -1
  73. package/dist/cjs/validators/void.cjs +1 -1
  74. package/dist/cjs/validators/wrapper-v2.cjs +1 -0
  75. package/dist/cjs/validators/xor.cjs +1 -1
  76. package/dist/compile.d.ts +81 -0
  77. package/dist/compile.js +1 -0
  78. package/dist/errors-core.d.ts +3 -0
  79. package/dist/errors.js +1 -1
  80. package/dist/index.d.ts +484 -21
  81. package/dist/index.js +1 -1
  82. package/dist/locales/gu.d.ts +2 -0
  83. package/dist/locales/gu.js +1 -0
  84. package/dist/locales/index.js +1 -1
  85. package/dist/locales/kn.d.ts +2 -0
  86. package/dist/locales/kn.js +1 -0
  87. package/dist/locales/ne.d.ts +2 -0
  88. package/dist/locales/ne.js +1 -0
  89. package/dist/locales/pt-BR-v4.d.ts +2 -0
  90. package/dist/locales/pt-BR-v4.js +1 -0
  91. package/dist/locales/sk.d.ts +2 -0
  92. package/dist/locales/sk.js +1 -0
  93. package/dist/v3/index.js +1 -1
  94. package/dist/v4/core/index.d.ts +13 -0
  95. package/dist/v4/core/index.js +1 -1
  96. package/dist/v4/index.d.ts +1 -0
  97. package/dist/v4/index.js +1 -1
  98. package/dist/v4/locales/index.d.ts +6 -0
  99. package/dist/v4/locales/index.js +1 -1
  100. package/dist/v4/mini/index.js +1 -1
  101. package/dist/v4-mini/index.d.ts +2 -0
  102. package/dist/v4-mini/index.js +1 -1
  103. package/dist/validators/array-v2.d.ts +113 -0
  104. package/dist/validators/array-v2.js +1 -0
  105. package/dist/validators/array.js +1 -1
  106. package/dist/validators/base.js +1 -1
  107. package/dist/validators/base64.js +1 -1
  108. package/dist/validators/bigint-v2.d.ts +105 -0
  109. package/dist/validators/bigint-v2.js +1 -0
  110. package/dist/validators/bigint.js +1 -1
  111. package/dist/validators/boolean.js +1 -1
  112. package/dist/validators/codec.js +1 -1
  113. package/dist/validators/composite-v2.d.ts +59 -0
  114. package/dist/validators/composite-v2.js +1 -0
  115. package/dist/validators/custom.js +1 -1
  116. package/dist/validators/date-v2.d.ts +140 -0
  117. package/dist/validators/date-v2.js +1 -0
  118. package/dist/validators/date.js +1 -1
  119. package/dist/validators/enum.js +1 -1
  120. package/dist/validators/file.js +1 -1
  121. package/dist/validators/function.js +1 -1
  122. package/dist/validators/hex.js +1 -1
  123. package/dist/validators/intersection.js +1 -1
  124. package/dist/validators/leaf-v2.d.ts +138 -0
  125. package/dist/validators/leaf-v2.js +1 -0
  126. package/dist/validators/literal.js +1 -1
  127. package/dist/validators/map.js +1 -1
  128. package/dist/validators/nan.js +1 -1
  129. package/dist/validators/never.js +1 -1
  130. package/dist/validators/null.js +1 -1
  131. package/dist/validators/number-v2.d.ts +252 -0
  132. package/dist/validators/number-v2.js +1 -0
  133. package/dist/validators/number.js +1 -1
  134. package/dist/validators/object-v2.d.ts +40 -0
  135. package/dist/validators/object-v2.js +1 -0
  136. package/dist/validators/object.d.ts +9 -0
  137. package/dist/validators/object.js +1 -1
  138. package/dist/validators/record.js +1 -1
  139. package/dist/validators/set.js +1 -1
  140. package/dist/validators/string-formats.d.ts +1 -0
  141. package/dist/validators/string-formats.js +1 -1
  142. package/dist/validators/string-v2.d.ts +274 -0
  143. package/dist/validators/string-v2.js +1 -0
  144. package/dist/validators/string.js +1 -1
  145. package/dist/validators/symbol.js +1 -1
  146. package/dist/validators/tuple.js +1 -1
  147. package/dist/validators/uint8array.js +1 -1
  148. package/dist/validators/undefined.js +1 -1
  149. package/dist/validators/union-v2.d.ts +28 -0
  150. package/dist/validators/union-v2.js +1 -0
  151. package/dist/validators/void.js +1 -1
  152. package/dist/validators/wrapper-v2.d.ts +74 -0
  153. package/dist/validators/wrapper-v2.js +1 -0
  154. package/dist/zod-error.d.ts +84 -0
  155. package/package.json +7 -2
  156. package/dist/chunks/errors-core-CerMg2rq.js +0 -1
  157. package/dist/chunks/index-yjpbvFgw.js +0 -1
  158. package/dist/cjs/chunks/errors-core-DrydF46s.cjs +0 -1
  159. package/dist/cjs/chunks/index-BEV9nG0N.cjs +0 -1
package/dist/index.d.ts CHANGED
@@ -15,8 +15,18 @@
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';
18
19
  import { VldError, type VldIssue } from './errors-core.js';
19
20
  import { VldString } from './validators/string.js';
21
+ import { VldStringV2, VldCoerceStringV2 } from './validators/string-v2.js';
22
+ import { VldNumberV2, VldCoerceNumberV2 } from './validators/number-v2.js';
23
+ import { VldDateV2 } from './validators/date-v2.js';
24
+ import { VldBigIntV2 } from './validators/bigint-v2.js';
25
+ import { VldArrayV2 } from './validators/array-v2.js';
26
+ import { VldUnionV2 } from './validators/union-v2.js';
27
+ import { VldRefineV2, VldTransformV2, VldOptionalV2, VldNullableV2, VldNullishV2 } from './validators/wrapper-v2.js';
28
+ import { VldLiteralV2, VldBooleanV2, VldEnumV2, VldRecordV2, VldAnyV2, VldUnknownV2, VldVoidV2, VldNeverV2, VldNullV2, VldUndefinedV2, VldSymbolV2, VldFunctionV2 } from './validators/leaf-v2.js';
29
+ import { VldTupleV2, VldSetV2, VldMapV2, VldIntersectionV2 } from './validators/composite-v2.js';
20
30
  import { VldNumber } from './validators/number.js';
21
31
  import { VldBoolean } from './validators/boolean.js';
22
32
  import { VldDate } from './validators/date.js';
@@ -63,6 +73,7 @@ import { VldCoerceDate } from './coercion/date.js';
63
73
  import { VldCoerceBigInt } from './coercion/bigint.js';
64
74
  import { flattenError as flattenErrorFn, prettifyError as prettifyErrorFn, treeifyError as treeifyErrorFn } from './errors.js';
65
75
  import { fromJSONSchema as fromJSONSchemaFn, toJSONSchema as toJSONSchemaFn } from './utils/json-schema.js';
76
+ 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';
66
77
  import * as stringFormats from './validators/string-formats.js';
67
78
  type NativeEnumLike = Record<string, string | number>;
68
79
  type Constructor<T = unknown> = abstract new (...args: any[]) => T;
@@ -134,7 +145,8 @@ export declare const core: {
134
145
  readonly nullish: (value: unknown) => value is null | undefined;
135
146
  readonly cached: <T>(getter: () => T) => (() => T);
136
147
  };
137
- readonly regexes: Readonly<Record<"number" | "bigint" | "boolean" | "undefined" | "integer" | "null" | "date" | "hex" | "base64" | "email" | "base64url" | "jwt" | "nanoid" | "cuid" | "cuid2" | "ulid" | "cidrv4" | "cidrv6" | "e164" | "xid" | "guid" | "ksuid" | "duration" | "ipv4" | "ipv6" | "browserEmail" | "creditCard" | "domain" | "extendedDuration" | "hostname" | "html5Email" | "httpProtocol" | "httpUrl" | "idnEmail" | "lowercase" | "md5" | "md5_base64" | "md5_base64url" | "md5_hex" | "rfc5322Email" | "sha1" | "sha1_base64" | "sha1_base64url" | "sha1_hex" | "sha256" | "sha256_base64" | "sha256_base64url" | "sha256_hex" | "sha384" | "sha384_base64" | "sha384_base64url" | "sha384_hex" | "sha512" | "sha512_base64" | "sha512_base64url" | "sha512_hex" | "unicodeEmail" | "uppercase" | "uuid4" | "uuid6" | "uuid7", RegExp> & {
148
+ 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> & {
149
+ nanoidOfLength: (length: number) => RegExp;
138
150
  datetime: (options?: stringFormats.ISODateTimeOptions) => RegExp;
139
151
  emoji: () => RegExp;
140
152
  mac: (delimiter?: string) => RegExp;
@@ -235,7 +247,11 @@ export declare function output<T extends AnySchema>(schema: T): T;
235
247
  */
236
248
  export declare const v: {
237
249
  string: () => VldString;
250
+ stringLegacy: () => VldString;
251
+ stringV2: () => VldStringV2;
238
252
  number: () => VldNumber;
253
+ numberLegacy: () => VldNumber;
254
+ numberV2: () => VldNumberV2;
239
255
  int: () => VldNumber;
240
256
  int32: () => VldNumber;
241
257
  uint32: () => VldNumber;
@@ -244,8 +260,13 @@ export declare const v: {
244
260
  float32: () => VldNumber;
245
261
  float64: () => VldNumber;
246
262
  boolean: () => VldBoolean;
263
+ booleanV2: () => VldBooleanV2;
247
264
  date: () => VldDate;
265
+ dateLegacy: () => VldDate;
266
+ dateV2: () => VldDateV2;
248
267
  bigint: () => VldBigInt;
268
+ bigintLegacy: () => VldBigInt;
269
+ bigintV2: () => VldBigIntV2;
249
270
  symbol: () => VldSymbol;
250
271
  stringbool: (options?: {
251
272
  truthy?: readonly string[];
@@ -253,17 +274,24 @@ export declare const v: {
253
274
  caseSensitive?: boolean;
254
275
  }) => VldStringBool;
255
276
  array: <T>(item: VldBase<unknown, T>) => VldArray<T>;
277
+ arrayV2: <T>(item: VldBase<unknown, T>) => VldArrayV2<T>;
278
+ tuple: typeof tupleFactory;
279
+ tupleV2: <T extends readonly VldBase<any, any>[]>(...items: T) => VldTupleV2<[...T]>;
280
+ set: <T>(item: VldBase<unknown, T>) => VldSet<T>;
281
+ setV2: <T>(item: VldBase<unknown, T>) => VldSetV2<T>;
282
+ map: <K, V>(key: VldBase<unknown, K>, value: VldBase<unknown, V>) => VldMap<K, V>;
283
+ mapV2: <K, V>(key: VldBase<unknown, K>, value: VldBase<unknown, V>) => VldMapV2<K, V>;
284
+ record: typeof recordFactory;
285
+ recordV2: <T>(value: VldBase<unknown, T>) => VldRecordV2<T>;
256
286
  object: typeof objectFactory;
257
287
  strictObject: typeof strictObjectFactory;
258
288
  looseObject: typeof looseObjectFactory;
259
- tuple: typeof tupleFactory;
260
- record: typeof recordFactory;
261
289
  partialRecord: typeof partialRecordFactory;
262
290
  looseRecord: typeof looseRecordFactory;
263
- set: <T>(item: VldBase<unknown, T>) => VldSet<T>;
264
- map: <K, V>(key: VldBase<unknown, K>, value: VldBase<unknown, V>) => VldMap<K, V>;
265
291
  union: typeof unionFactory;
292
+ unionV2: <T extends readonly VldBase<any, any>[]>(...validators: T) => VldUnionV2<[...T]>;
266
293
  intersection: <A, B>(first: VldBase<unknown, A>, second: VldBase<unknown, B>) => VldIntersection<A, B>;
294
+ intersectionV2: <A, B>(left: VldBase<any, A>, right: VldBase<any, B>) => VldIntersectionV2<A, B>;
267
295
  discriminatedUnion: typeof discriminatedUnionFactory;
268
296
  xor: typeof xorFactory;
269
297
  keyof: <T extends Record<string, any>>(schema: VldObject<T>) => VldEnum<[string, ...string[]]>;
@@ -271,7 +299,9 @@ export declare const v: {
271
299
  input: typeof input;
272
300
  output: typeof output;
273
301
  literal: typeof literalFactory;
302
+ literalV2: <T extends string | number | boolean | null | undefined>(value: T) => VldLiteralV2<T>;
274
303
  enum: typeof enumFactoryCompat;
304
+ enumV2: <T extends readonly (string | number)[]>(values: T) => VldEnumV2<T>;
275
305
  nativeEnum: <T extends NativeEnumLike>(enumObject: T) => VldEnum<any>;
276
306
  any: () => VldAny;
277
307
  unknown: () => VldUnknown;
@@ -303,20 +333,26 @@ export declare const v: {
303
333
  };
304
334
  ZodFirstPartyTypeKind: {};
305
335
  optional: <T>(validator: VldBase<unknown, T>) => VldOptional<unknown, T>;
336
+ optionalV2: <T>(validator: VldBase<unknown, T>) => VldOptionalV2<unknown, T>;
306
337
  nullable: <T>(validator: VldBase<unknown, T>) => VldNullable<unknown, T>;
338
+ nullableV2: <T>(validator: VldBase<unknown, T>) => VldNullableV2<unknown, T>;
307
339
  nullish: <T>(validator: VldBase<unknown, T>) => VldNullish<unknown, T>;
340
+ nullishV2: <T>(validator: VldBase<unknown, T>) => VldNullishV2<unknown, T>;
308
341
  exactOptional: <T>(validator: VldBase<unknown, T>) => VldExactOptional<unknown, T>;
309
342
  nonoptional: <T>(validator: VldBase<unknown, T | undefined>, message?: RefinementMessage) => VldRefine<unknown, T | undefined, Exclude<T, undefined>>;
310
343
  catch: <T>(validator: VldBase<unknown, T>, fallbackValue: T) => VldCatch<unknown, T>;
311
344
  prefault: <TInput, TOutput>(validator: VldBase<TInput, TOutput>, defaultValue: TInput | (() => TInput)) => VldPrefault<TInput, TOutput>;
312
345
  readonly: <T>(validator: VldBase<unknown, T>) => VldReadonly<unknown, T>;
313
346
  pipe: <TInput, TIntermediate, TOutput>(first: VldBase<TInput, TIntermediate>, second: VldBase<any, TOutput>) => VldPipe<TInput, TIntermediate, TOutput>;
347
+ pipeline: <TInput, TIntermediate, TOutput>(first: VldBase<TInput, TIntermediate>, second: VldBase<any, TOutput>) => VldPipe<TInput, TIntermediate, TOutput>;
314
348
  clone: <T extends VldBase<any, any>>(schema: T) => T;
315
349
  describe: <TInput, TOutput>(schemaOrDescription: VldBase<TInput, TOutput> | string, description?: string) => VldMeta<unknown, unknown>;
316
350
  meta: <TInput, TOutput>(schemaOrMetadata: VldBase<TInput, TOutput> | Partial<SchemaMetadata>, metadata?: Partial<SchemaMetadata>) => VldMeta<unknown, unknown>;
317
351
  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>>;
352
+ transformV2: <TInput, TBase>(inner: VldBase<TInput, TBase>, transformer: (value: TBase) => TBase | Promise<TBase>) => VldTransformV2<TInput, TBase, TBase>;
318
353
  overwrite: <T>(transformer: (value: T) => T) => VldBase<T, Awaited<T>>;
319
354
  refine: <T = unknown>(schemaOrPredicate: VldBase<unknown, T> | ((value: T) => boolean | Promise<boolean>), predicateOrMessage?: ((value: T) => boolean | Promise<boolean>) | RefinementMessage, message?: RefinementMessage) => VldBase<unknown, T>;
355
+ refineV2: <TInput, TBase>(inner: VldBase<TInput, TBase>, predicate: (value: TBase) => boolean | Promise<boolean>, message?: string) => VldRefineV2<TInput, TBase, TBase>;
320
356
  check: <T = unknown>(schemaOrPredicate: VldBase<unknown, T> | ((value: T) => boolean | Promise<boolean>), predicateOrMessage?: ((value: T) => boolean | Promise<boolean>) | RefinementMessage, message?: RefinementMessage) => VldBase<unknown, T>;
321
357
  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>;
322
358
  property: typeof propertyCheck;
@@ -336,7 +372,8 @@ export declare const v: {
336
372
  readonly nullish: (value: unknown) => value is null | undefined;
337
373
  readonly cached: <T>(getter: () => T) => (() => T);
338
374
  };
339
- readonly regexes: Readonly<Record<"number" | "bigint" | "boolean" | "undefined" | "integer" | "null" | "date" | "hex" | "base64" | "email" | "base64url" | "jwt" | "nanoid" | "cuid" | "cuid2" | "ulid" | "cidrv4" | "cidrv6" | "e164" | "xid" | "guid" | "ksuid" | "duration" | "ipv4" | "ipv6" | "browserEmail" | "creditCard" | "domain" | "extendedDuration" | "hostname" | "html5Email" | "httpProtocol" | "httpUrl" | "idnEmail" | "lowercase" | "md5" | "md5_base64" | "md5_base64url" | "md5_hex" | "rfc5322Email" | "sha1" | "sha1_base64" | "sha1_base64url" | "sha1_hex" | "sha256" | "sha256_base64" | "sha256_base64url" | "sha256_hex" | "sha384" | "sha384_base64" | "sha384_base64url" | "sha384_hex" | "sha512" | "sha512_base64" | "sha512_base64url" | "sha512_hex" | "unicodeEmail" | "uppercase" | "uuid4" | "uuid6" | "uuid7", RegExp> & {
375
+ 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> & {
376
+ nanoidOfLength: (length: number) => RegExp;
340
377
  datetime: (options?: stringFormats.ISODateTimeOptions) => RegExp;
341
378
  emoji: () => RegExp;
342
379
  mac: (delimiter?: string) => RegExp;
@@ -395,13 +432,19 @@ export declare const v: {
395
432
  custom: typeof customFn;
396
433
  file: () => VldFile;
397
434
  function: () => VldFunction;
435
+ useV2: boolean;
436
+ setV2Mode: (enabled: boolean) => void;
398
437
  preprocess: <TInput, TOutput>(preprocessor: (input: unknown) => unknown, schema: VldBase<TInput, TOutput>) => VldPreprocess<TInput, TOutput>;
399
438
  coerce: {
400
439
  string: () => VldCoerceString;
440
+ stringLegacy: () => VldCoerceString;
401
441
  number: () => VldCoerceNumber;
442
+ numberLegacy: () => VldCoerceNumber;
402
443
  boolean: () => VldCoerceBoolean;
403
444
  date: () => VldCoerceDate;
404
445
  bigint: () => VldCoerceBigInt;
446
+ stringV2: () => VldCoerceStringV2;
447
+ numberV2: () => VldCoerceNumberV2;
405
448
  };
406
449
  email: (options?: {
407
450
  pattern?: RegExp;
@@ -476,7 +519,8 @@ export declare const v: {
476
519
  guid: () => stringFormats.VldStringFormat;
477
520
  httpUrl: () => stringFormats.VldStringFormat;
478
521
  ksuid: () => stringFormats.VldStringFormat;
479
- regexes: Readonly<Record<"number" | "bigint" | "boolean" | "undefined" | "integer" | "null" | "date" | "hex" | "base64" | "email" | "base64url" | "jwt" | "nanoid" | "cuid" | "cuid2" | "ulid" | "cidrv4" | "cidrv6" | "e164" | "xid" | "guid" | "ksuid" | "duration" | "ipv4" | "ipv6" | "browserEmail" | "creditCard" | "domain" | "extendedDuration" | "hostname" | "html5Email" | "httpProtocol" | "httpUrl" | "idnEmail" | "lowercase" | "md5" | "md5_base64" | "md5_base64url" | "md5_hex" | "rfc5322Email" | "sha1" | "sha1_base64" | "sha1_base64url" | "sha1_hex" | "sha256" | "sha256_base64" | "sha256_base64url" | "sha256_hex" | "sha384" | "sha384_base64" | "sha384_base64url" | "sha384_hex" | "sha512" | "sha512_base64" | "sha512_base64url" | "sha512_hex" | "unicodeEmail" | "uppercase" | "uuid4" | "uuid6" | "uuid7", RegExp> & {
522
+ 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> & {
523
+ nanoidOfLength: (length: number) => RegExp;
480
524
  datetime: (options?: stringFormats.ISODateTimeOptions) => RegExp;
481
525
  emoji: () => RegExp;
482
526
  mac: (delimiter?: string) => RegExp;
@@ -487,6 +531,15 @@ export declare const v: {
487
531
  time: (options?: stringFormats.ISOTimeOptions) => RegExp;
488
532
  uuid: (version?: number) => RegExp;
489
533
  }>;
534
+ compile: <T extends VldBase<any, any>>(schema: T, options?: {
535
+ JITless?: boolean;
536
+ }) => T;
537
+ validate: typeof validateFn;
538
+ validateAsync: typeof validateAsyncFn;
539
+ properties: typeof propertiesFn;
540
+ getDiscriminatedOption: typeof getDiscriminatedOptionFn;
541
+ memoizer: <K extends object, V>(compute: (key: K) => V) => ((key: K) => V);
542
+ toZod: typeof toZodFn;
490
543
  templateLiteral: (...components: (VldBase<any, any> | string)[]) => VldTemplateLiteral;
491
544
  base64Bytes: () => VldBase64;
492
545
  hexBytes: () => VldHex;
@@ -515,6 +568,146 @@ export declare const v: {
515
568
  flattenError: typeof flattenErrorFn;
516
569
  toJSONSchema: typeof toJSONSchemaFn;
517
570
  fromJSONSchema: typeof fromJSONSchemaFn;
571
+ globalRegistry: import("./registry.js").SchemaRegistry<SchemaMetadata>;
572
+ registry: typeof registry;
573
+ _default: <TInput, TOutput>(schema: VldBase<TInput, TOutput>, defaultValue: TOutput | (() => TOutput)) => VldDefault<TInput, TOutput>;
574
+ success: <TOutput = unknown>(_val?: TOutput) => VldCustom<TOutput>;
575
+ _function: () => VldFunction;
576
+ ZodType: typeof VldBase;
577
+ ZodTypeAny: typeof VldBase;
578
+ ZodTypeDef: ObjectConstructor;
579
+ ZodError: typeof VldError;
580
+ ZodRealError: typeof VldError;
581
+ ZodCompileError: typeof ZodCompileErrorClass;
582
+ ZodCompileAsyncError: typeof ZodCompileAsyncErrorClass;
583
+ ZodCompileUnsupportedError: typeof ZodCompileUnsupportedErrorClass;
584
+ _ZodString: typeof VldString;
585
+ ZodString: typeof VldString;
586
+ ZodStringFormat: typeof VldString;
587
+ ZodEmail: typeof VldString;
588
+ ZodGUID: typeof VldString;
589
+ ZodUUID: typeof VldString;
590
+ ZodURL: typeof VldString;
591
+ ZodEmoji: typeof VldString;
592
+ ZodNanoID: typeof VldString;
593
+ ZodCUID: typeof VldString;
594
+ ZodCUID2: typeof VldString;
595
+ ZodULID: typeof VldString;
596
+ ZodXID: typeof VldString;
597
+ ZodKSUID: typeof VldString;
598
+ ZodIPv4: typeof VldString;
599
+ ZodMAC: typeof VldString;
600
+ ZodIPv6: typeof VldString;
601
+ ZodCIDRv4: typeof VldString;
602
+ ZodCIDRv6: typeof VldString;
603
+ ZodBase64: typeof VldString;
604
+ ZodBase64URL: typeof VldString;
605
+ ZodE164: typeof VldString;
606
+ ZodJWT: typeof VldString;
607
+ ZodCustomStringFormat: typeof VldString;
608
+ ZodNumber: typeof VldNumber;
609
+ ZodNumberFormat: typeof VldNumber;
610
+ ZodBoolean: typeof VldBoolean;
611
+ ZodBigInt: typeof VldBigInt;
612
+ ZodBigIntFormat: typeof VldBigInt;
613
+ ZodSymbol: typeof VldSymbol;
614
+ ZodUndefined: typeof VldUndefined;
615
+ ZodNull: typeof VldNull;
616
+ ZodAny: typeof VldAny;
617
+ ZodUnknown: typeof VldUnknown;
618
+ ZodNever: typeof VldNever;
619
+ ZodVoid: typeof VldVoid;
620
+ ZodDate: typeof VldDate;
621
+ ZodArray: typeof VldArray;
622
+ ZodObject: typeof VldObject;
623
+ ZodUnion: typeof VldUnion;
624
+ ZodXor: typeof VldXor;
625
+ ZodDiscriminatedUnion: typeof VldDiscriminatedUnion;
626
+ ZodIntersection: typeof VldIntersection;
627
+ ZodTuple: typeof VldTuple;
628
+ ZodRecord: typeof VldRecord;
629
+ ZodMap: typeof VldMap;
630
+ ZodSet: typeof VldSet;
631
+ ZodEnum: typeof VldEnum;
632
+ ZodLiteral: typeof VldLiteral;
633
+ ZodFile: typeof VldFile;
634
+ ZodTransform: typeof VldBase;
635
+ ZodOptional: typeof VldBase;
636
+ ZodExactOptional: typeof VldBase;
637
+ ZodNullable: typeof VldBase;
638
+ ZodDefault: typeof VldBase;
639
+ ZodPrefault: typeof VldBase;
640
+ ZodNonOptional: typeof VldBase;
641
+ ZodSuccess: typeof VldCustom;
642
+ ZodCatch: typeof VldBase;
643
+ ZodNaN: typeof VldNan;
644
+ ZodPipe: typeof VldBase;
645
+ ZodCodec: typeof VldCodec;
646
+ ZodPreprocess: typeof VldBase;
647
+ ZodReadonly: typeof VldBase;
648
+ ZodTemplateLiteral: typeof VldTemplateLiteral;
649
+ ZodLazy: typeof VldLazy;
650
+ ZodPromise: typeof VldPromise;
651
+ ZodFunction: typeof VldFunction;
652
+ ZodCustom: typeof VldCustom;
653
+ ZodISODateTime: typeof VldString;
654
+ ZodISODate: typeof VldString;
655
+ ZodISOTime: typeof VldString;
656
+ ZodISODuration: typeof VldString;
657
+ $brand: symbol;
658
+ $output: symbol;
659
+ $input: symbol;
660
+ };
661
+ /**
662
+ * v3.0: vV2 — drop-in factory that uses V2 validators everywhere.
663
+ * Recommended for new code and migrations from Zod 4.5.
664
+ *
665
+ * import { vV2 as v } from '@oxog/vld';
666
+ * const schema = v.object({ email: v.string().email() });
667
+ *
668
+ * Identical API to `v` but every factory returns the V2 implementation,
669
+ * giving 2-6x faster parse and 1.6-10x smaller memory on hot paths.
670
+ */
671
+ export declare const vV2: {
672
+ string: () => VldStringV2;
673
+ number: () => VldNumberV2;
674
+ boolean: () => VldBooleanV2;
675
+ date: () => VldDateV2;
676
+ bigint: () => VldBigIntV2;
677
+ int: () => VldNumberV2;
678
+ int32: () => VldNumberV2;
679
+ uint32: () => VldNumberV2;
680
+ uint64: () => VldNumberV2;
681
+ int64: () => VldNumberV2;
682
+ float32: () => VldNumberV2;
683
+ float64: () => VldNumberV2;
684
+ array: <T>(item: VldBase<unknown, T>) => VldArrayV2<T>;
685
+ tuple: <T extends readonly VldBase<any, any>[]>(...items: T) => VldTupleV2<[...T]>;
686
+ set: <T>(item: VldBase<unknown, T>) => VldSetV2<T>;
687
+ map: <K, V>(key: VldBase<unknown, K>, value: VldBase<unknown, V>) => VldMapV2<K, V>;
688
+ record: <T>(value: VldBase<unknown, T>) => VldRecordV2<T>;
689
+ union: <T extends readonly VldBase<any, any>[]>(...validators: T) => VldUnionV2<[...T]>;
690
+ intersection: <A, B>(left: VldBase<any, A>, right: VldBase<any, B>) => VldIntersectionV2<A, B>;
691
+ literal: <T extends string | number | boolean | null | undefined>(value: T) => VldLiteralV2<T>;
692
+ enum: <T extends readonly (string | number)[]>(values: T) => VldEnumV2<T>;
693
+ optional: <T>(validator: VldBase<unknown, T>) => VldOptionalV2<unknown, T>;
694
+ nullable: <T>(validator: VldBase<unknown, T>) => VldNullableV2<unknown, T>;
695
+ nullish: <T>(validator: VldBase<unknown, T>) => VldNullishV2<unknown, T>;
696
+ object: typeof objectFactory;
697
+ any: () => VldAnyV2;
698
+ unknown: () => VldUnknownV2;
699
+ void: () => VldVoidV2;
700
+ never: () => VldNeverV2;
701
+ null: () => VldNullV2;
702
+ undefined: () => VldUndefinedV2;
703
+ symbol: () => VldSymbolV2;
704
+ function: () => VldFunctionV2;
705
+ coerce: {
706
+ string: () => VldCoerceStringV2;
707
+ number: () => VldCoerceNumberV2;
708
+ };
709
+ transformV2: <TInput, TBase>(inner: VldBase<TInput, TBase>, transformer: (value: TBase) => TBase | Promise<TBase>) => VldTransformV2<TInput, TBase, TBase>;
710
+ refineV2: <TInput, TBase>(inner: VldBase<TInput, TBase>, predicate: (value: TBase) => boolean | Promise<boolean>, message?: string) => VldRefineV2<TInput, TBase, TBase>;
518
711
  };
519
712
  export declare namespace v {
520
713
  type infer<T extends VldBase<any, any>> = Infer<T>;
@@ -588,7 +781,11 @@ export type { SafeParseSuccess, SafeParseError, SafeParseReturnType, CustomError
588
781
  */
589
782
  export declare const z: {
590
783
  string: () => VldString;
784
+ stringLegacy: () => VldString;
785
+ stringV2: () => VldStringV2;
591
786
  number: () => VldNumber;
787
+ numberLegacy: () => VldNumber;
788
+ numberV2: () => VldNumberV2;
592
789
  int: () => VldNumber;
593
790
  int32: () => VldNumber;
594
791
  uint32: () => VldNumber;
@@ -597,8 +794,13 @@ export declare const z: {
597
794
  float32: () => VldNumber;
598
795
  float64: () => VldNumber;
599
796
  boolean: () => VldBoolean;
797
+ booleanV2: () => VldBooleanV2;
600
798
  date: () => VldDate;
799
+ dateLegacy: () => VldDate;
800
+ dateV2: () => VldDateV2;
601
801
  bigint: () => VldBigInt;
802
+ bigintLegacy: () => VldBigInt;
803
+ bigintV2: () => VldBigIntV2;
602
804
  symbol: () => VldSymbol;
603
805
  stringbool: (options?: {
604
806
  truthy?: readonly string[];
@@ -606,17 +808,24 @@ export declare const z: {
606
808
  caseSensitive?: boolean;
607
809
  }) => VldStringBool;
608
810
  array: <T>(item: VldBase<unknown, T>) => VldArray<T>;
811
+ arrayV2: <T>(item: VldBase<unknown, T>) => VldArrayV2<T>;
812
+ tuple: typeof tupleFactory;
813
+ tupleV2: <T extends readonly VldBase<any, any>[]>(...items: T) => VldTupleV2<[...T]>;
814
+ set: <T>(item: VldBase<unknown, T>) => VldSet<T>;
815
+ setV2: <T>(item: VldBase<unknown, T>) => VldSetV2<T>;
816
+ map: <K, V>(key: VldBase<unknown, K>, value: VldBase<unknown, V>) => VldMap<K, V>;
817
+ mapV2: <K, V>(key: VldBase<unknown, K>, value: VldBase<unknown, V>) => VldMapV2<K, V>;
818
+ record: typeof recordFactory;
819
+ recordV2: <T>(value: VldBase<unknown, T>) => VldRecordV2<T>;
609
820
  object: typeof objectFactory;
610
821
  strictObject: typeof strictObjectFactory;
611
822
  looseObject: typeof looseObjectFactory;
612
- tuple: typeof tupleFactory;
613
- record: typeof recordFactory;
614
823
  partialRecord: typeof partialRecordFactory;
615
824
  looseRecord: typeof looseRecordFactory;
616
- set: <T>(item: VldBase<unknown, T>) => VldSet<T>;
617
- map: <K, V>(key: VldBase<unknown, K>, value: VldBase<unknown, V>) => VldMap<K, V>;
618
825
  union: typeof unionFactory;
826
+ unionV2: <T extends readonly VldBase<any, any>[]>(...validators: T) => VldUnionV2<[...T]>;
619
827
  intersection: <A, B>(first: VldBase<unknown, A>, second: VldBase<unknown, B>) => VldIntersection<A, B>;
828
+ intersectionV2: <A, B>(left: VldBase<any, A>, right: VldBase<any, B>) => VldIntersectionV2<A, B>;
620
829
  discriminatedUnion: typeof discriminatedUnionFactory;
621
830
  xor: typeof xorFactory;
622
831
  keyof: <T extends Record<string, any>>(schema: VldObject<T>) => VldEnum<[string, ...string[]]>;
@@ -624,7 +833,9 @@ export declare const z: {
624
833
  input: typeof input;
625
834
  output: typeof output;
626
835
  literal: typeof literalFactory;
836
+ literalV2: <T extends string | number | boolean | null | undefined>(value: T) => VldLiteralV2<T>;
627
837
  enum: typeof enumFactoryCompat;
838
+ enumV2: <T extends readonly (string | number)[]>(values: T) => VldEnumV2<T>;
628
839
  nativeEnum: <T extends NativeEnumLike>(enumObject: T) => VldEnum<any>;
629
840
  any: () => VldAny;
630
841
  unknown: () => VldUnknown;
@@ -656,20 +867,26 @@ export declare const z: {
656
867
  };
657
868
  ZodFirstPartyTypeKind: {};
658
869
  optional: <T>(validator: VldBase<unknown, T>) => VldOptional<unknown, T>;
870
+ optionalV2: <T>(validator: VldBase<unknown, T>) => VldOptionalV2<unknown, T>;
659
871
  nullable: <T>(validator: VldBase<unknown, T>) => VldNullable<unknown, T>;
872
+ nullableV2: <T>(validator: VldBase<unknown, T>) => VldNullableV2<unknown, T>;
660
873
  nullish: <T>(validator: VldBase<unknown, T>) => VldNullish<unknown, T>;
874
+ nullishV2: <T>(validator: VldBase<unknown, T>) => VldNullishV2<unknown, T>;
661
875
  exactOptional: <T>(validator: VldBase<unknown, T>) => VldExactOptional<unknown, T>;
662
876
  nonoptional: <T>(validator: VldBase<unknown, T | undefined>, message?: RefinementMessage) => VldRefine<unknown, T | undefined, Exclude<T, undefined>>;
663
877
  catch: <T>(validator: VldBase<unknown, T>, fallbackValue: T) => VldCatch<unknown, T>;
664
878
  prefault: <TInput, TOutput>(validator: VldBase<TInput, TOutput>, defaultValue: TInput | (() => TInput)) => VldPrefault<TInput, TOutput>;
665
879
  readonly: <T>(validator: VldBase<unknown, T>) => VldReadonly<unknown, T>;
666
880
  pipe: <TInput, TIntermediate, TOutput>(first: VldBase<TInput, TIntermediate>, second: VldBase<any, TOutput>) => VldPipe<TInput, TIntermediate, TOutput>;
881
+ pipeline: <TInput, TIntermediate, TOutput>(first: VldBase<TInput, TIntermediate>, second: VldBase<any, TOutput>) => VldPipe<TInput, TIntermediate, TOutput>;
667
882
  clone: <T extends VldBase<any, any>>(schema: T) => T;
668
883
  describe: <TInput, TOutput>(schemaOrDescription: VldBase<TInput, TOutput> | string, description?: string) => VldMeta<unknown, unknown>;
669
884
  meta: <TInput, TOutput>(schemaOrMetadata: VldBase<TInput, TOutput> | Partial<SchemaMetadata>, metadata?: Partial<SchemaMetadata>) => VldMeta<unknown, unknown>;
670
885
  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>>;
886
+ transformV2: <TInput, TBase>(inner: VldBase<TInput, TBase>, transformer: (value: TBase) => TBase | Promise<TBase>) => VldTransformV2<TInput, TBase, TBase>;
671
887
  overwrite: <T>(transformer: (value: T) => T) => VldBase<T, Awaited<T>>;
672
888
  refine: <T = unknown>(schemaOrPredicate: VldBase<unknown, T> | ((value: T) => boolean | Promise<boolean>), predicateOrMessage?: ((value: T) => boolean | Promise<boolean>) | RefinementMessage, message?: RefinementMessage) => VldBase<unknown, T>;
889
+ refineV2: <TInput, TBase>(inner: VldBase<TInput, TBase>, predicate: (value: TBase) => boolean | Promise<boolean>, message?: string) => VldRefineV2<TInput, TBase, TBase>;
673
890
  check: <T = unknown>(schemaOrPredicate: VldBase<unknown, T> | ((value: T) => boolean | Promise<boolean>), predicateOrMessage?: ((value: T) => boolean | Promise<boolean>) | RefinementMessage, message?: RefinementMessage) => VldBase<unknown, T>;
674
891
  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>;
675
892
  property: typeof propertyCheck;
@@ -689,7 +906,8 @@ export declare const z: {
689
906
  readonly nullish: (value: unknown) => value is null | undefined;
690
907
  readonly cached: <T>(getter: () => T) => (() => T);
691
908
  };
692
- readonly regexes: Readonly<Record<"number" | "bigint" | "boolean" | "undefined" | "integer" | "null" | "date" | "hex" | "base64" | "email" | "base64url" | "jwt" | "nanoid" | "cuid" | "cuid2" | "ulid" | "cidrv4" | "cidrv6" | "e164" | "xid" | "guid" | "ksuid" | "duration" | "ipv4" | "ipv6" | "browserEmail" | "creditCard" | "domain" | "extendedDuration" | "hostname" | "html5Email" | "httpProtocol" | "httpUrl" | "idnEmail" | "lowercase" | "md5" | "md5_base64" | "md5_base64url" | "md5_hex" | "rfc5322Email" | "sha1" | "sha1_base64" | "sha1_base64url" | "sha1_hex" | "sha256" | "sha256_base64" | "sha256_base64url" | "sha256_hex" | "sha384" | "sha384_base64" | "sha384_base64url" | "sha384_hex" | "sha512" | "sha512_base64" | "sha512_base64url" | "sha512_hex" | "unicodeEmail" | "uppercase" | "uuid4" | "uuid6" | "uuid7", RegExp> & {
909
+ 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> & {
910
+ nanoidOfLength: (length: number) => RegExp;
693
911
  datetime: (options?: stringFormats.ISODateTimeOptions) => RegExp;
694
912
  emoji: () => RegExp;
695
913
  mac: (delimiter?: string) => RegExp;
@@ -748,13 +966,19 @@ export declare const z: {
748
966
  custom: typeof customFn;
749
967
  file: () => VldFile;
750
968
  function: () => VldFunction;
969
+ useV2: boolean;
970
+ setV2Mode: (enabled: boolean) => void;
751
971
  preprocess: <TInput, TOutput>(preprocessor: (input: unknown) => unknown, schema: VldBase<TInput, TOutput>) => VldPreprocess<TInput, TOutput>;
752
972
  coerce: {
753
973
  string: () => VldCoerceString;
974
+ stringLegacy: () => VldCoerceString;
754
975
  number: () => VldCoerceNumber;
976
+ numberLegacy: () => VldCoerceNumber;
755
977
  boolean: () => VldCoerceBoolean;
756
978
  date: () => VldCoerceDate;
757
979
  bigint: () => VldCoerceBigInt;
980
+ stringV2: () => VldCoerceStringV2;
981
+ numberV2: () => VldCoerceNumberV2;
758
982
  };
759
983
  email: (options?: {
760
984
  pattern?: RegExp;
@@ -829,7 +1053,8 @@ export declare const z: {
829
1053
  guid: () => stringFormats.VldStringFormat;
830
1054
  httpUrl: () => stringFormats.VldStringFormat;
831
1055
  ksuid: () => stringFormats.VldStringFormat;
832
- regexes: Readonly<Record<"number" | "bigint" | "boolean" | "undefined" | "integer" | "null" | "date" | "hex" | "base64" | "email" | "base64url" | "jwt" | "nanoid" | "cuid" | "cuid2" | "ulid" | "cidrv4" | "cidrv6" | "e164" | "xid" | "guid" | "ksuid" | "duration" | "ipv4" | "ipv6" | "browserEmail" | "creditCard" | "domain" | "extendedDuration" | "hostname" | "html5Email" | "httpProtocol" | "httpUrl" | "idnEmail" | "lowercase" | "md5" | "md5_base64" | "md5_base64url" | "md5_hex" | "rfc5322Email" | "sha1" | "sha1_base64" | "sha1_base64url" | "sha1_hex" | "sha256" | "sha256_base64" | "sha256_base64url" | "sha256_hex" | "sha384" | "sha384_base64" | "sha384_base64url" | "sha384_hex" | "sha512" | "sha512_base64" | "sha512_base64url" | "sha512_hex" | "unicodeEmail" | "uppercase" | "uuid4" | "uuid6" | "uuid7", RegExp> & {
1056
+ 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> & {
1057
+ nanoidOfLength: (length: number) => RegExp;
833
1058
  datetime: (options?: stringFormats.ISODateTimeOptions) => RegExp;
834
1059
  emoji: () => RegExp;
835
1060
  mac: (delimiter?: string) => RegExp;
@@ -840,6 +1065,15 @@ export declare const z: {
840
1065
  time: (options?: stringFormats.ISOTimeOptions) => RegExp;
841
1066
  uuid: (version?: number) => RegExp;
842
1067
  }>;
1068
+ compile: <T extends VldBase<any, any>>(schema: T, options?: {
1069
+ JITless?: boolean;
1070
+ }) => T;
1071
+ validate: typeof validateFn;
1072
+ validateAsync: typeof validateAsyncFn;
1073
+ properties: typeof propertiesFn;
1074
+ getDiscriminatedOption: typeof getDiscriminatedOptionFn;
1075
+ memoizer: <K extends object, V>(compute: (key: K) => V) => ((key: K) => V);
1076
+ toZod: typeof toZodFn;
843
1077
  templateLiteral: (...components: (VldBase<any, any> | string)[]) => VldTemplateLiteral;
844
1078
  base64Bytes: () => VldBase64;
845
1079
  hexBytes: () => VldHex;
@@ -868,7 +1102,98 @@ export declare const z: {
868
1102
  flattenError: typeof flattenErrorFn;
869
1103
  toJSONSchema: typeof toJSONSchemaFn;
870
1104
  fromJSONSchema: typeof fromJSONSchemaFn;
1105
+ globalRegistry: import("./registry.js").SchemaRegistry<SchemaMetadata>;
1106
+ registry: typeof registry;
1107
+ _default: <TInput, TOutput>(schema: VldBase<TInput, TOutput>, defaultValue: TOutput | (() => TOutput)) => VldDefault<TInput, TOutput>;
1108
+ success: <TOutput = unknown>(_val?: TOutput) => VldCustom<TOutput>;
1109
+ _function: () => VldFunction;
1110
+ ZodType: typeof VldBase;
1111
+ ZodTypeAny: typeof VldBase;
1112
+ ZodTypeDef: ObjectConstructor;
1113
+ ZodError: typeof VldError;
1114
+ ZodRealError: typeof VldError;
1115
+ ZodCompileError: typeof ZodCompileErrorClass;
1116
+ ZodCompileAsyncError: typeof ZodCompileAsyncErrorClass;
1117
+ ZodCompileUnsupportedError: typeof ZodCompileUnsupportedErrorClass;
1118
+ _ZodString: typeof VldString;
1119
+ ZodString: typeof VldString;
1120
+ ZodStringFormat: typeof VldString;
1121
+ ZodEmail: typeof VldString;
1122
+ ZodGUID: typeof VldString;
1123
+ ZodUUID: typeof VldString;
1124
+ ZodURL: typeof VldString;
1125
+ ZodEmoji: typeof VldString;
1126
+ ZodNanoID: typeof VldString;
1127
+ ZodCUID: typeof VldString;
1128
+ ZodCUID2: typeof VldString;
1129
+ ZodULID: typeof VldString;
1130
+ ZodXID: typeof VldString;
1131
+ ZodKSUID: typeof VldString;
1132
+ ZodIPv4: typeof VldString;
1133
+ ZodMAC: typeof VldString;
1134
+ ZodIPv6: typeof VldString;
1135
+ ZodCIDRv4: typeof VldString;
1136
+ ZodCIDRv6: typeof VldString;
1137
+ ZodBase64: typeof VldString;
1138
+ ZodBase64URL: typeof VldString;
1139
+ ZodE164: typeof VldString;
1140
+ ZodJWT: typeof VldString;
1141
+ ZodCustomStringFormat: typeof VldString;
1142
+ ZodNumber: typeof VldNumber;
1143
+ ZodNumberFormat: typeof VldNumber;
1144
+ ZodBoolean: typeof VldBoolean;
1145
+ ZodBigInt: typeof VldBigInt;
1146
+ ZodBigIntFormat: typeof VldBigInt;
1147
+ ZodSymbol: typeof VldSymbol;
1148
+ ZodUndefined: typeof VldUndefined;
1149
+ ZodNull: typeof VldNull;
1150
+ ZodAny: typeof VldAny;
1151
+ ZodUnknown: typeof VldUnknown;
1152
+ ZodNever: typeof VldNever;
1153
+ ZodVoid: typeof VldVoid;
1154
+ ZodDate: typeof VldDate;
1155
+ ZodArray: typeof VldArray;
1156
+ ZodObject: typeof VldObject;
1157
+ ZodUnion: typeof VldUnion;
1158
+ ZodXor: typeof VldXor;
1159
+ ZodDiscriminatedUnion: typeof VldDiscriminatedUnion;
1160
+ ZodIntersection: typeof VldIntersection;
1161
+ ZodTuple: typeof VldTuple;
1162
+ ZodRecord: typeof VldRecord;
1163
+ ZodMap: typeof VldMap;
1164
+ ZodSet: typeof VldSet;
1165
+ ZodEnum: typeof VldEnum;
1166
+ ZodLiteral: typeof VldLiteral;
1167
+ ZodFile: typeof VldFile;
1168
+ ZodTransform: typeof VldBase;
1169
+ ZodOptional: typeof VldBase;
1170
+ ZodExactOptional: typeof VldBase;
1171
+ ZodNullable: typeof VldBase;
1172
+ ZodDefault: typeof VldBase;
1173
+ ZodPrefault: typeof VldBase;
1174
+ ZodNonOptional: typeof VldBase;
1175
+ ZodSuccess: typeof VldCustom;
1176
+ ZodCatch: typeof VldBase;
1177
+ ZodNaN: typeof VldNan;
1178
+ ZodPipe: typeof VldBase;
1179
+ ZodCodec: typeof VldCodec;
1180
+ ZodPreprocess: typeof VldBase;
1181
+ ZodReadonly: typeof VldBase;
1182
+ ZodTemplateLiteral: typeof VldTemplateLiteral;
1183
+ ZodLazy: typeof VldLazy;
1184
+ ZodPromise: typeof VldPromise;
1185
+ ZodFunction: typeof VldFunction;
1186
+ ZodCustom: typeof VldCustom;
1187
+ ZodISODateTime: typeof VldString;
1188
+ ZodISODate: typeof VldString;
1189
+ ZodISOTime: typeof VldString;
1190
+ ZodISODuration: typeof VldString;
1191
+ $brand: symbol;
1192
+ $output: symbol;
1193
+ $input: symbol;
871
1194
  };
1195
+ export { toZodError, toZodSafeResult, ZodLikeError } from './zod-error.js';
1196
+ export type { ZodLikeIssue } from './zod-error.js';
872
1197
  /**
873
1198
  * Zod-compatible root-level factory aliases.
874
1199
  *
@@ -882,10 +1207,14 @@ export declare const string: () => VldString, number: () => VldNumber, int: () =
882
1207
  caseSensitive?: boolean;
883
1208
  }) => 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: {
884
1209
  string: () => VldCoerceString;
1210
+ stringLegacy: () => VldCoerceString;
885
1211
  number: () => VldCoerceNumber;
1212
+ numberLegacy: () => VldCoerceNumber;
886
1213
  boolean: () => VldCoerceBoolean;
887
1214
  date: () => VldCoerceDate;
888
1215
  bigint: () => VldCoerceBigInt;
1216
+ stringV2: () => VldCoerceStringV2;
1217
+ numberV2: () => VldCoerceNumberV2;
889
1218
  }, email: (options?: {
890
1219
  pattern?: RegExp;
891
1220
  }) => stringFormats.VldStringFormat, url: (options?: stringFormats.URLFormatOptions) => stringFormats.VldStringFormat, uuid: (options?: {
@@ -902,7 +1231,8 @@ export declare const string: () => VldString, number: () => VldNumber, int: () =
902
1231
  datetime: (options?: stringFormats.ISODateTimeOptions) => stringFormats.VldStringFormat;
903
1232
  dateTime: (options?: stringFormats.ISODateTimeOptions) => stringFormats.VldStringFormat;
904
1233
  duration: () => stringFormats.VldStringFormat;
905
- }, stringFormat: (name: string, validator: ((val: string) => boolean) | RegExp) => stringFormats.VldStringFormat, normalize: (form?: "NFC" | "NFD" | "NFKC" | "NFKD" | (string & {})) => VldTransform<string, string, string>, slugify: () => VldTransform<string, string, string>, mime: (types: string | string[], message?: string) => VldFile, xid: () => stringFormats.VldStringFormat, guid: () => stringFormats.VldStringFormat, httpUrl: () => stringFormats.VldStringFormat, ksuid: () => stringFormats.VldStringFormat, regexes: Readonly<Record<"number" | "bigint" | "boolean" | "undefined" | "integer" | "null" | "date" | "hex" | "base64" | "email" | "base64url" | "jwt" | "nanoid" | "cuid" | "cuid2" | "ulid" | "cidrv4" | "cidrv6" | "e164" | "xid" | "guid" | "ksuid" | "duration" | "ipv4" | "ipv6" | "browserEmail" | "creditCard" | "domain" | "extendedDuration" | "hostname" | "html5Email" | "httpProtocol" | "httpUrl" | "idnEmail" | "lowercase" | "md5" | "md5_base64" | "md5_base64url" | "md5_hex" | "rfc5322Email" | "sha1" | "sha1_base64" | "sha1_base64url" | "sha1_hex" | "sha256" | "sha256_base64" | "sha256_base64url" | "sha256_hex" | "sha384" | "sha384_base64" | "sha384_base64url" | "sha384_hex" | "sha512" | "sha512_base64" | "sha512_base64url" | "sha512_hex" | "unicodeEmail" | "uppercase" | "uuid4" | "uuid6" | "uuid7", RegExp> & {
1234
+ }, 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> & {
1235
+ nanoidOfLength: (length: number) => RegExp;
906
1236
  datetime: (options?: stringFormats.ISODateTimeOptions) => RegExp;
907
1237
  emoji: () => RegExp;
908
1238
  mac: (delimiter?: string) => RegExp;
@@ -915,7 +1245,9 @@ export declare const string: () => VldString, number: () => VldNumber, int: () =
915
1245
  }>, 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: {
916
1246
  decode: (value: TInput) => TOutput | Promise<TOutput>;
917
1247
  encode: (value: TOutput) => TInput | Promise<TInput>;
918
- }) => VldCodec<TInput, TOutput>, promise: <T>(inner: VldBase<unknown, T>) => VldPromise<T>, prefault: <TInput, TOutput>(validator: VldBase<TInput, TOutput>, defaultValue: TInput | (() => TInput)) => VldPrefault<TInput, TOutput>, parse: <T>(schema: VldBase<unknown, T>, value: unknown) => T, safeParse: <T>(schema: VldBase<unknown, T>, value: unknown) => ParseResult<T>, parseAsync: <T>(schema: VldBase<unknown, T>, value: unknown) => Promise<T>, safeParseAsync: <T>(schema: VldBase<unknown, T>, value: unknown) => Promise<ParseResult<T>>, decode: <T>(schema: VldBase<unknown, T>, value: unknown) => T, safeDecode: <T>(schema: VldBase<unknown, T>, value: unknown) => ParseResult<T>, decodeAsync: <T>(schema: VldBase<unknown, T>, value: unknown) => Promise<T>, safeDecodeAsync: <T>(schema: VldBase<unknown, T>, value: unknown) => Promise<ParseResult<T>>, encode: <TInput, TOutput>(schema: VldBase<TInput, TOutput>, value: TOutput) => TInput, safeEncode: <TInput, TOutput>(schema: VldBase<TInput, TOutput>, value: TOutput) => ParseResult<TInput>, encodeAsync: <TInput, TOutput>(schema: VldBase<TInput, TOutput>, value: TOutput) => Promise<TInput>, safeEncodeAsync: <TInput, TOutput>(schema: VldBase<TInput, TOutput>, value: TOutput) => Promise<ParseResult<TInput>>, formatError: (error: Error) => FormattedError, NEVER: VldNever;
1248
+ }) => 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?: {
1249
+ JITless?: boolean;
1250
+ }) => 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;
919
1251
  declare const catchFactory: <T>(validator: VldBase<unknown, T>, fallbackValue: T) => VldCatch<unknown, T>;
920
1252
  declare const enumFactory: typeof enumFactoryCompat;
921
1253
  declare const functionFactory: () => VldFunction;
@@ -927,7 +1259,11 @@ declare const undefinedFactory: () => VldUndefined;
927
1259
  declare const voidFactory: () => VldVoid;
928
1260
  declare const defaultFactory: {
929
1261
  string: () => VldString;
1262
+ stringLegacy: () => VldString;
1263
+ stringV2: () => VldStringV2;
930
1264
  number: () => VldNumber;
1265
+ numberLegacy: () => VldNumber;
1266
+ numberV2: () => VldNumberV2;
931
1267
  int: () => VldNumber;
932
1268
  int32: () => VldNumber;
933
1269
  uint32: () => VldNumber;
@@ -936,8 +1272,13 @@ declare const defaultFactory: {
936
1272
  float32: () => VldNumber;
937
1273
  float64: () => VldNumber;
938
1274
  boolean: () => VldBoolean;
1275
+ booleanV2: () => VldBooleanV2;
939
1276
  date: () => VldDate;
1277
+ dateLegacy: () => VldDate;
1278
+ dateV2: () => VldDateV2;
940
1279
  bigint: () => VldBigInt;
1280
+ bigintLegacy: () => VldBigInt;
1281
+ bigintV2: () => VldBigIntV2;
941
1282
  symbol: () => VldSymbol;
942
1283
  stringbool: (options?: {
943
1284
  truthy?: readonly string[];
@@ -945,17 +1286,24 @@ declare const defaultFactory: {
945
1286
  caseSensitive?: boolean;
946
1287
  }) => VldStringBool;
947
1288
  array: <T>(item: VldBase<unknown, T>) => VldArray<T>;
1289
+ arrayV2: <T>(item: VldBase<unknown, T>) => VldArrayV2<T>;
1290
+ tuple: typeof tupleFactory;
1291
+ tupleV2: <T extends readonly VldBase<any, any>[]>(...items: T) => VldTupleV2<[...T]>;
1292
+ set: <T>(item: VldBase<unknown, T>) => VldSet<T>;
1293
+ setV2: <T>(item: VldBase<unknown, T>) => VldSetV2<T>;
1294
+ map: <K, V>(key: VldBase<unknown, K>, value: VldBase<unknown, V>) => VldMap<K, V>;
1295
+ mapV2: <K, V>(key: VldBase<unknown, K>, value: VldBase<unknown, V>) => VldMapV2<K, V>;
1296
+ record: typeof recordFactory;
1297
+ recordV2: <T>(value: VldBase<unknown, T>) => VldRecordV2<T>;
948
1298
  object: typeof objectFactory;
949
1299
  strictObject: typeof strictObjectFactory;
950
1300
  looseObject: typeof looseObjectFactory;
951
- tuple: typeof tupleFactory;
952
- record: typeof recordFactory;
953
1301
  partialRecord: typeof partialRecordFactory;
954
1302
  looseRecord: typeof looseRecordFactory;
955
- set: <T>(item: VldBase<unknown, T>) => VldSet<T>;
956
- map: <K, V>(key: VldBase<unknown, K>, value: VldBase<unknown, V>) => VldMap<K, V>;
957
1303
  union: typeof unionFactory;
1304
+ unionV2: <T extends readonly VldBase<any, any>[]>(...validators: T) => VldUnionV2<[...T]>;
958
1305
  intersection: <A, B>(first: VldBase<unknown, A>, second: VldBase<unknown, B>) => VldIntersection<A, B>;
1306
+ intersectionV2: <A, B>(left: VldBase<any, A>, right: VldBase<any, B>) => VldIntersectionV2<A, B>;
959
1307
  discriminatedUnion: typeof discriminatedUnionFactory;
960
1308
  xor: typeof xorFactory;
961
1309
  keyof: <T extends Record<string, any>>(schema: VldObject<T>) => VldEnum<[string, ...string[]]>;
@@ -963,7 +1311,9 @@ declare const defaultFactory: {
963
1311
  input: typeof input;
964
1312
  output: typeof output;
965
1313
  literal: typeof literalFactory;
1314
+ literalV2: <T extends string | number | boolean | null | undefined>(value: T) => VldLiteralV2<T>;
966
1315
  enum: typeof enumFactoryCompat;
1316
+ enumV2: <T extends readonly (string | number)[]>(values: T) => VldEnumV2<T>;
967
1317
  nativeEnum: <T extends NativeEnumLike>(enumObject: T) => VldEnum<any>;
968
1318
  any: () => VldAny;
969
1319
  unknown: () => VldUnknown;
@@ -995,20 +1345,26 @@ declare const defaultFactory: {
995
1345
  };
996
1346
  ZodFirstPartyTypeKind: {};
997
1347
  optional: <T>(validator: VldBase<unknown, T>) => VldOptional<unknown, T>;
1348
+ optionalV2: <T>(validator: VldBase<unknown, T>) => VldOptionalV2<unknown, T>;
998
1349
  nullable: <T>(validator: VldBase<unknown, T>) => VldNullable<unknown, T>;
1350
+ nullableV2: <T>(validator: VldBase<unknown, T>) => VldNullableV2<unknown, T>;
999
1351
  nullish: <T>(validator: VldBase<unknown, T>) => VldNullish<unknown, T>;
1352
+ nullishV2: <T>(validator: VldBase<unknown, T>) => VldNullishV2<unknown, T>;
1000
1353
  exactOptional: <T>(validator: VldBase<unknown, T>) => VldExactOptional<unknown, T>;
1001
1354
  nonoptional: <T>(validator: VldBase<unknown, T | undefined>, message?: RefinementMessage) => VldRefine<unknown, T | undefined, Exclude<T, undefined>>;
1002
1355
  catch: <T>(validator: VldBase<unknown, T>, fallbackValue: T) => VldCatch<unknown, T>;
1003
1356
  prefault: <TInput, TOutput>(validator: VldBase<TInput, TOutput>, defaultValue: TInput | (() => TInput)) => VldPrefault<TInput, TOutput>;
1004
1357
  readonly: <T>(validator: VldBase<unknown, T>) => VldReadonly<unknown, T>;
1005
1358
  pipe: <TInput, TIntermediate, TOutput>(first: VldBase<TInput, TIntermediate>, second: VldBase<any, TOutput>) => VldPipe<TInput, TIntermediate, TOutput>;
1359
+ pipeline: <TInput, TIntermediate, TOutput>(first: VldBase<TInput, TIntermediate>, second: VldBase<any, TOutput>) => VldPipe<TInput, TIntermediate, TOutput>;
1006
1360
  clone: <T extends VldBase<any, any>>(schema: T) => T;
1007
1361
  describe: <TInput, TOutput>(schemaOrDescription: VldBase<TInput, TOutput> | string, description?: string) => VldMeta<unknown, unknown>;
1008
1362
  meta: <TInput, TOutput>(schemaOrMetadata: VldBase<TInput, TOutput> | Partial<SchemaMetadata>, metadata?: Partial<SchemaMetadata>) => VldMeta<unknown, unknown>;
1009
1363
  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>>;
1364
+ transformV2: <TInput, TBase>(inner: VldBase<TInput, TBase>, transformer: (value: TBase) => TBase | Promise<TBase>) => VldTransformV2<TInput, TBase, TBase>;
1010
1365
  overwrite: <T>(transformer: (value: T) => T) => VldBase<T, Awaited<T>>;
1011
1366
  refine: <T = unknown>(schemaOrPredicate: VldBase<unknown, T> | ((value: T) => boolean | Promise<boolean>), predicateOrMessage?: ((value: T) => boolean | Promise<boolean>) | RefinementMessage, message?: RefinementMessage) => VldBase<unknown, T>;
1367
+ refineV2: <TInput, TBase>(inner: VldBase<TInput, TBase>, predicate: (value: TBase) => boolean | Promise<boolean>, message?: string) => VldRefineV2<TInput, TBase, TBase>;
1012
1368
  check: <T = unknown>(schemaOrPredicate: VldBase<unknown, T> | ((value: T) => boolean | Promise<boolean>), predicateOrMessage?: ((value: T) => boolean | Promise<boolean>) | RefinementMessage, message?: RefinementMessage) => VldBase<unknown, T>;
1013
1369
  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>;
1014
1370
  property: typeof propertyCheck;
@@ -1028,7 +1384,8 @@ declare const defaultFactory: {
1028
1384
  readonly nullish: (value: unknown) => value is null | undefined;
1029
1385
  readonly cached: <T>(getter: () => T) => (() => T);
1030
1386
  };
1031
- readonly regexes: Readonly<Record<"number" | "bigint" | "boolean" | "undefined" | "integer" | "null" | "date" | "hex" | "base64" | "email" | "base64url" | "jwt" | "nanoid" | "cuid" | "cuid2" | "ulid" | "cidrv4" | "cidrv6" | "e164" | "xid" | "guid" | "ksuid" | "duration" | "ipv4" | "ipv6" | "browserEmail" | "creditCard" | "domain" | "extendedDuration" | "hostname" | "html5Email" | "httpProtocol" | "httpUrl" | "idnEmail" | "lowercase" | "md5" | "md5_base64" | "md5_base64url" | "md5_hex" | "rfc5322Email" | "sha1" | "sha1_base64" | "sha1_base64url" | "sha1_hex" | "sha256" | "sha256_base64" | "sha256_base64url" | "sha256_hex" | "sha384" | "sha384_base64" | "sha384_base64url" | "sha384_hex" | "sha512" | "sha512_base64" | "sha512_base64url" | "sha512_hex" | "unicodeEmail" | "uppercase" | "uuid4" | "uuid6" | "uuid7", RegExp> & {
1387
+ 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> & {
1388
+ nanoidOfLength: (length: number) => RegExp;
1032
1389
  datetime: (options?: stringFormats.ISODateTimeOptions) => RegExp;
1033
1390
  emoji: () => RegExp;
1034
1391
  mac: (delimiter?: string) => RegExp;
@@ -1087,13 +1444,19 @@ declare const defaultFactory: {
1087
1444
  custom: typeof customFn;
1088
1445
  file: () => VldFile;
1089
1446
  function: () => VldFunction;
1447
+ useV2: boolean;
1448
+ setV2Mode: (enabled: boolean) => void;
1090
1449
  preprocess: <TInput, TOutput>(preprocessor: (input: unknown) => unknown, schema: VldBase<TInput, TOutput>) => VldPreprocess<TInput, TOutput>;
1091
1450
  coerce: {
1092
1451
  string: () => VldCoerceString;
1452
+ stringLegacy: () => VldCoerceString;
1093
1453
  number: () => VldCoerceNumber;
1454
+ numberLegacy: () => VldCoerceNumber;
1094
1455
  boolean: () => VldCoerceBoolean;
1095
1456
  date: () => VldCoerceDate;
1096
1457
  bigint: () => VldCoerceBigInt;
1458
+ stringV2: () => VldCoerceStringV2;
1459
+ numberV2: () => VldCoerceNumberV2;
1097
1460
  };
1098
1461
  email: (options?: {
1099
1462
  pattern?: RegExp;
@@ -1168,7 +1531,8 @@ declare const defaultFactory: {
1168
1531
  guid: () => stringFormats.VldStringFormat;
1169
1532
  httpUrl: () => stringFormats.VldStringFormat;
1170
1533
  ksuid: () => stringFormats.VldStringFormat;
1171
- regexes: Readonly<Record<"number" | "bigint" | "boolean" | "undefined" | "integer" | "null" | "date" | "hex" | "base64" | "email" | "base64url" | "jwt" | "nanoid" | "cuid" | "cuid2" | "ulid" | "cidrv4" | "cidrv6" | "e164" | "xid" | "guid" | "ksuid" | "duration" | "ipv4" | "ipv6" | "browserEmail" | "creditCard" | "domain" | "extendedDuration" | "hostname" | "html5Email" | "httpProtocol" | "httpUrl" | "idnEmail" | "lowercase" | "md5" | "md5_base64" | "md5_base64url" | "md5_hex" | "rfc5322Email" | "sha1" | "sha1_base64" | "sha1_base64url" | "sha1_hex" | "sha256" | "sha256_base64" | "sha256_base64url" | "sha256_hex" | "sha384" | "sha384_base64" | "sha384_base64url" | "sha384_hex" | "sha512" | "sha512_base64" | "sha512_base64url" | "sha512_hex" | "unicodeEmail" | "uppercase" | "uuid4" | "uuid6" | "uuid7", RegExp> & {
1534
+ 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> & {
1535
+ nanoidOfLength: (length: number) => RegExp;
1172
1536
  datetime: (options?: stringFormats.ISODateTimeOptions) => RegExp;
1173
1537
  emoji: () => RegExp;
1174
1538
  mac: (delimiter?: string) => RegExp;
@@ -1179,6 +1543,15 @@ declare const defaultFactory: {
1179
1543
  time: (options?: stringFormats.ISOTimeOptions) => RegExp;
1180
1544
  uuid: (version?: number) => RegExp;
1181
1545
  }>;
1546
+ compile: <T extends VldBase<any, any>>(schema: T, options?: {
1547
+ JITless?: boolean;
1548
+ }) => T;
1549
+ validate: typeof validateFn;
1550
+ validateAsync: typeof validateAsyncFn;
1551
+ properties: typeof propertiesFn;
1552
+ getDiscriminatedOption: typeof getDiscriminatedOptionFn;
1553
+ memoizer: <K extends object, V>(compute: (key: K) => V) => ((key: K) => V);
1554
+ toZod: typeof toZodFn;
1182
1555
  templateLiteral: (...components: (VldBase<any, any> | string)[]) => VldTemplateLiteral;
1183
1556
  base64Bytes: () => VldBase64;
1184
1557
  hexBytes: () => VldHex;
@@ -1207,6 +1580,95 @@ declare const defaultFactory: {
1207
1580
  flattenError: typeof flattenErrorFn;
1208
1581
  toJSONSchema: typeof toJSONSchemaFn;
1209
1582
  fromJSONSchema: typeof fromJSONSchemaFn;
1583
+ globalRegistry: import("./registry.js").SchemaRegistry<SchemaMetadata>;
1584
+ registry: typeof registry;
1585
+ _default: <TInput, TOutput>(schema: VldBase<TInput, TOutput>, defaultValue: TOutput | (() => TOutput)) => VldDefault<TInput, TOutput>;
1586
+ success: <TOutput = unknown>(_val?: TOutput) => VldCustom<TOutput>;
1587
+ _function: () => VldFunction;
1588
+ ZodType: typeof VldBase;
1589
+ ZodTypeAny: typeof VldBase;
1590
+ ZodTypeDef: ObjectConstructor;
1591
+ ZodError: typeof VldError;
1592
+ ZodRealError: typeof VldError;
1593
+ ZodCompileError: typeof ZodCompileErrorClass;
1594
+ ZodCompileAsyncError: typeof ZodCompileAsyncErrorClass;
1595
+ ZodCompileUnsupportedError: typeof ZodCompileUnsupportedErrorClass;
1596
+ _ZodString: typeof VldString;
1597
+ ZodString: typeof VldString;
1598
+ ZodStringFormat: typeof VldString;
1599
+ ZodEmail: typeof VldString;
1600
+ ZodGUID: typeof VldString;
1601
+ ZodUUID: typeof VldString;
1602
+ ZodURL: typeof VldString;
1603
+ ZodEmoji: typeof VldString;
1604
+ ZodNanoID: typeof VldString;
1605
+ ZodCUID: typeof VldString;
1606
+ ZodCUID2: typeof VldString;
1607
+ ZodULID: typeof VldString;
1608
+ ZodXID: typeof VldString;
1609
+ ZodKSUID: typeof VldString;
1610
+ ZodIPv4: typeof VldString;
1611
+ ZodMAC: typeof VldString;
1612
+ ZodIPv6: typeof VldString;
1613
+ ZodCIDRv4: typeof VldString;
1614
+ ZodCIDRv6: typeof VldString;
1615
+ ZodBase64: typeof VldString;
1616
+ ZodBase64URL: typeof VldString;
1617
+ ZodE164: typeof VldString;
1618
+ ZodJWT: typeof VldString;
1619
+ ZodCustomStringFormat: typeof VldString;
1620
+ ZodNumber: typeof VldNumber;
1621
+ ZodNumberFormat: typeof VldNumber;
1622
+ ZodBoolean: typeof VldBoolean;
1623
+ ZodBigInt: typeof VldBigInt;
1624
+ ZodBigIntFormat: typeof VldBigInt;
1625
+ ZodSymbol: typeof VldSymbol;
1626
+ ZodUndefined: typeof VldUndefined;
1627
+ ZodNull: typeof VldNull;
1628
+ ZodAny: typeof VldAny;
1629
+ ZodUnknown: typeof VldUnknown;
1630
+ ZodNever: typeof VldNever;
1631
+ ZodVoid: typeof VldVoid;
1632
+ ZodDate: typeof VldDate;
1633
+ ZodArray: typeof VldArray;
1634
+ ZodObject: typeof VldObject;
1635
+ ZodUnion: typeof VldUnion;
1636
+ ZodXor: typeof VldXor;
1637
+ ZodDiscriminatedUnion: typeof VldDiscriminatedUnion;
1638
+ ZodIntersection: typeof VldIntersection;
1639
+ ZodTuple: typeof VldTuple;
1640
+ ZodRecord: typeof VldRecord;
1641
+ ZodMap: typeof VldMap;
1642
+ ZodSet: typeof VldSet;
1643
+ ZodEnum: typeof VldEnum;
1644
+ ZodLiteral: typeof VldLiteral;
1645
+ ZodFile: typeof VldFile;
1646
+ ZodTransform: typeof VldBase;
1647
+ ZodOptional: typeof VldBase;
1648
+ ZodExactOptional: typeof VldBase;
1649
+ ZodNullable: typeof VldBase;
1650
+ ZodDefault: typeof VldBase;
1651
+ ZodPrefault: typeof VldBase;
1652
+ ZodNonOptional: typeof VldBase;
1653
+ ZodSuccess: typeof VldCustom;
1654
+ ZodCatch: typeof VldBase;
1655
+ ZodNaN: typeof VldNan;
1656
+ ZodPipe: typeof VldBase;
1657
+ ZodCodec: typeof VldCodec;
1658
+ ZodPreprocess: typeof VldBase;
1659
+ ZodReadonly: typeof VldBase;
1660
+ ZodTemplateLiteral: typeof VldTemplateLiteral;
1661
+ ZodLazy: typeof VldLazy;
1662
+ ZodPromise: typeof VldPromise;
1663
+ ZodFunction: typeof VldFunction;
1664
+ ZodCustom: typeof VldCustom;
1665
+ ZodISODateTime: typeof VldString;
1666
+ ZodISODate: typeof VldString;
1667
+ ZodISOTime: typeof VldString;
1668
+ ZodISODuration: typeof VldString;
1669
+ $brand: symbol;
1670
+ $output: symbol;
1671
+ $input: symbol;
1210
1672
  };
1211
1673
  declare const zodStringFactory: typeof VldString;
1212
1674
  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 };
@@ -1245,3 +1707,4 @@ export { createLogger, initLogger, getLogger, setLogLevel, enableDebug, disableL
1245
1707
  export { pigment, supportsColor, bold, dim, italic, underline, red, green, yellow, blue, magenta, cyan, white, gray, grey, strip, vldTheme, createTheme, type Theme } from './pigment.js';
1246
1708
  export { toJSONSchema, fromJSONSchema, type JSONSchemaDefinition, type ToJSONSchemaOptions } from './utils/json-schema.js';
1247
1709
  export default v;
1710
+ export { compileFn as zodCompileFn, ZodCompileAsyncError, ZodCompileUnsupportedError } from './compile.js';