@oxog/vld 2.1.0 → 2.2.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (228) hide show
  1. package/CHANGELOG.md +113 -0
  2. package/README.md +413 -1235
  3. package/dist/chunks/errors-core-CerMg2rq.js +1 -0
  4. package/dist/chunks/index-CkbfQQ4n.js +1 -0
  5. package/dist/chunks/index-yjpbvFgw.js +1 -0
  6. package/dist/chunks/ip-validation-g5LWgy9t.js +1 -0
  7. package/dist/chunks/security-Dy24T8N7.js +1 -0
  8. package/dist/cjs/chunks/errors-core-DrydF46s.cjs +1 -0
  9. package/dist/cjs/chunks/index-BEV9nG0N.cjs +1 -0
  10. package/dist/cjs/chunks/index-ZjHAxYdA.cjs +1 -0
  11. package/dist/cjs/chunks/ip-validation-BZqPamPC.cjs +1 -0
  12. package/dist/cjs/chunks/security-aXZVI7qW.cjs +1 -0
  13. package/dist/cjs/cli/bin.cjs +1 -505
  14. package/dist/cjs/cli/index.cjs +1 -209
  15. package/dist/cjs/codecs/index.cjs +1 -45
  16. package/dist/cjs/coercion/index.cjs +1 -588
  17. package/dist/cjs/compat/emitter.cjs +1 -184
  18. package/dist/cjs/compat/result.cjs +1 -189
  19. package/dist/cjs/errors.cjs +1 -180
  20. package/dist/cjs/index.cjs +1 -1894
  21. package/dist/cjs/kernel.cjs +1 -415
  22. package/dist/cjs/locales/af.cjs +1 -108
  23. package/dist/cjs/locales/ar.cjs +1 -108
  24. package/dist/cjs/locales/bn.cjs +1 -108
  25. package/dist/cjs/locales/da.cjs +1 -108
  26. package/dist/cjs/locales/de.cjs +1 -108
  27. package/dist/cjs/locales/en.cjs +1 -108
  28. package/dist/cjs/locales/es-MX.cjs +1 -107
  29. package/dist/cjs/locales/es.cjs +1 -96
  30. package/dist/cjs/locales/fi.cjs +1 -108
  31. package/dist/cjs/locales/fr.cjs +1 -96
  32. package/dist/cjs/locales/hi.cjs +1 -108
  33. package/dist/cjs/locales/id.cjs +1 -108
  34. package/dist/cjs/locales/index.cjs +1 -43
  35. package/dist/cjs/locales/it.cjs +1 -108
  36. package/dist/cjs/locales/ja.cjs +1 -108
  37. package/dist/cjs/locales/ko.cjs +1 -108
  38. package/dist/cjs/locales/lazy.cjs +1 -188
  39. package/dist/cjs/locales/nl.cjs +1 -108
  40. package/dist/cjs/locales/no.cjs +1 -108
  41. package/dist/cjs/locales/pl.cjs +1 -108
  42. package/dist/cjs/locales/pt-BR.cjs +1 -108
  43. package/dist/cjs/locales/pt.cjs +1 -108
  44. package/dist/cjs/locales/ru.cjs +1 -108
  45. package/dist/cjs/locales/runtime.cjs +1 -51
  46. package/dist/cjs/locales/sv.cjs +1 -108
  47. package/dist/cjs/locales/sw.cjs +1 -108
  48. package/dist/cjs/locales/th.cjs +1 -108
  49. package/dist/cjs/locales/tr.cjs +1 -108
  50. package/dist/cjs/locales/vi.cjs +1 -108
  51. package/dist/cjs/locales/zh.cjs +1 -108
  52. package/dist/cjs/mini.cjs +1 -242
  53. package/dist/cjs/pigment.cjs +1 -207
  54. package/dist/cjs/plugins/index.cjs +1 -12
  55. package/dist/cjs/registry.cjs +1 -37
  56. package/dist/cjs/v3/index.cjs +1 -425
  57. package/dist/cjs/v4/core/index.cjs +1 -894
  58. package/dist/cjs/v4/index.cjs +1 -425
  59. package/dist/cjs/v4/locales/index.cjs +1 -130
  60. package/dist/cjs/v4/mini/index.cjs +1 -509
  61. package/dist/cjs/v4-mini/index.cjs +1 -532
  62. package/dist/cjs/validators/any.cjs +1 -40
  63. package/dist/cjs/validators/array.cjs +1 -283
  64. package/dist/cjs/validators/base.cjs +1 -887
  65. package/dist/cjs/validators/base64.cjs +1 -73
  66. package/dist/cjs/validators/bigint.cjs +1 -232
  67. package/dist/cjs/validators/boolean.cjs +1 -146
  68. package/dist/cjs/validators/codec.cjs +1 -205
  69. package/dist/cjs/validators/custom.cjs +1 -71
  70. package/dist/cjs/validators/date.cjs +1 -278
  71. package/dist/cjs/validators/discriminated-union.cjs +1 -130
  72. package/dist/cjs/validators/enum.cjs +1 -154
  73. package/dist/cjs/validators/file.cjs +1 -130
  74. package/dist/cjs/validators/function.cjs +1 -63
  75. package/dist/cjs/validators/hex.cjs +1 -70
  76. package/dist/cjs/validators/index.cjs +1 -123
  77. package/dist/cjs/validators/intersection.cjs +1 -120
  78. package/dist/cjs/validators/json.cjs +1 -70
  79. package/dist/cjs/validators/lazy.cjs +1 -53
  80. package/dist/cjs/validators/literal.cjs +1 -64
  81. package/dist/cjs/validators/map.cjs +1 -218
  82. package/dist/cjs/validators/nan.cjs +1 -41
  83. package/dist/cjs/validators/never.cjs +1 -36
  84. package/dist/cjs/validators/null.cjs +1 -43
  85. package/dist/cjs/validators/number.cjs +1 -427
  86. package/dist/cjs/validators/object.cjs +1 -868
  87. package/dist/cjs/validators/promise.cjs +1 -115
  88. package/dist/cjs/validators/record.cjs +1 -262
  89. package/dist/cjs/validators/set.cjs +1 -203
  90. package/dist/cjs/validators/string-bool.cjs +1 -124
  91. package/dist/cjs/validators/string-formats.cjs +1 -168
  92. package/dist/cjs/validators/string.cjs +1 -12
  93. package/dist/cjs/validators/symbol.cjs +1 -62
  94. package/dist/cjs/validators/template-literal.cjs +1 -108
  95. package/dist/cjs/validators/tuple.cjs +1 -187
  96. package/dist/cjs/validators/uint8array.cjs +1 -106
  97. package/dist/cjs/validators/undefined.cjs +1 -43
  98. package/dist/cjs/validators/union.cjs +1 -191
  99. package/dist/cjs/validators/unknown.cjs +1 -40
  100. package/dist/cjs/validators/void.cjs +1 -48
  101. package/dist/cjs/validators/xor.cjs +1 -69
  102. package/dist/cli/bin.js +1 -406
  103. package/dist/cli/index.js +1 -205
  104. package/dist/codecs/index.js +1 -11
  105. package/dist/coercion/index.js +1 -579
  106. package/dist/compat/emitter.js +1 -180
  107. package/dist/compat/result.js +1 -170
  108. package/dist/errors-core.d.ts +32 -2
  109. package/dist/errors.js +1 -171
  110. package/dist/index.d.ts +315 -361
  111. package/dist/index.js +1 -1534
  112. package/dist/kernel.js +1 -409
  113. package/dist/locales/af.js +1 -106
  114. package/dist/locales/ar.js +1 -106
  115. package/dist/locales/bn.js +1 -106
  116. package/dist/locales/da.js +1 -106
  117. package/dist/locales/de.js +1 -106
  118. package/dist/locales/en.js +1 -106
  119. package/dist/locales/es-MX.js +1 -105
  120. package/dist/locales/es.js +1 -94
  121. package/dist/locales/fi.js +1 -106
  122. package/dist/locales/fr.js +1 -94
  123. package/dist/locales/hi.js +1 -106
  124. package/dist/locales/id.js +1 -106
  125. package/dist/locales/index.js +1 -29
  126. package/dist/locales/it.js +1 -106
  127. package/dist/locales/ja.js +1 -106
  128. package/dist/locales/ko.js +1 -106
  129. package/dist/locales/lazy.js +1 -177
  130. package/dist/locales/nl.js +1 -106
  131. package/dist/locales/no.js +1 -106
  132. package/dist/locales/pl.js +1 -106
  133. package/dist/locales/pt-BR.js +1 -106
  134. package/dist/locales/pt.js +1 -106
  135. package/dist/locales/ru.js +1 -106
  136. package/dist/locales/runtime.js +1 -41
  137. package/dist/locales/sv.js +1 -106
  138. package/dist/locales/sw.js +1 -106
  139. package/dist/locales/th.js +1 -106
  140. package/dist/locales/tr.js +1 -106
  141. package/dist/locales/vi.js +1 -106
  142. package/dist/locales/zh.js +1 -106
  143. package/dist/mini.d.ts +3 -3
  144. package/dist/mini.js +1 -156
  145. package/dist/pigment.js +1 -180
  146. package/dist/plugins/index.js +1 -1
  147. package/dist/registry.js +1 -34
  148. package/dist/utils/json-schema.d.ts +10 -1
  149. package/dist/v3/index.js +1 -46
  150. package/dist/v4/core/index.d.ts +28 -16
  151. package/dist/v4/core/index.js +1 -277
  152. package/dist/v4/index.js +1 -50
  153. package/dist/v4/locales/index.d.ts +4 -0
  154. package/dist/v4/locales/index.js +1 -77
  155. package/dist/v4/mini/index.js +1 -47
  156. package/dist/v4-mini/index.d.ts +1 -1
  157. package/dist/v4-mini/index.js +1 -75
  158. package/dist/validators/any.js +1 -37
  159. package/dist/validators/array.d.ts +7 -0
  160. package/dist/validators/array.js +1 -279
  161. package/dist/validators/base.d.ts +210 -17
  162. package/dist/validators/base.js +1 -868
  163. package/dist/validators/base64.js +1 -68
  164. package/dist/validators/bigint.d.ts +7 -0
  165. package/dist/validators/bigint.js +1 -228
  166. package/dist/validators/boolean.js +1 -142
  167. package/dist/validators/codec.js +1 -200
  168. package/dist/validators/custom.d.ts +20 -10
  169. package/dist/validators/custom.js +1 -67
  170. package/dist/validators/date.d.ts +2 -0
  171. package/dist/validators/date.js +1 -274
  172. package/dist/validators/discriminated-union.d.ts +4 -2
  173. package/dist/validators/discriminated-union.js +1 -123
  174. package/dist/validators/enum.d.ts +8 -2
  175. package/dist/validators/enum.js +1 -150
  176. package/dist/validators/file.js +1 -125
  177. package/dist/validators/function.js +1 -58
  178. package/dist/validators/hex.js +1 -65
  179. package/dist/validators/index.d.ts +1 -1
  180. package/dist/validators/index.js +1 -35
  181. package/dist/validators/intersection.js +1 -116
  182. package/dist/validators/json.js +1 -66
  183. package/dist/validators/lazy.js +1 -50
  184. package/dist/validators/literal.d.ts +8 -3
  185. package/dist/validators/literal.js +1 -60
  186. package/dist/validators/map.d.ts +7 -0
  187. package/dist/validators/map.js +1 -214
  188. package/dist/validators/nan.js +1 -38
  189. package/dist/validators/never.js +1 -32
  190. package/dist/validators/null.js +1 -40
  191. package/dist/validators/number.d.ts +25 -1
  192. package/dist/validators/number.js +1 -423
  193. package/dist/validators/object.d.ts +18 -2
  194. package/dist/validators/object.js +1 -864
  195. package/dist/validators/promise.d.ts +6 -7
  196. package/dist/validators/promise.js +1 -111
  197. package/dist/validators/record.d.ts +13 -8
  198. package/dist/validators/record.js +1 -258
  199. package/dist/validators/set.d.ts +5 -0
  200. package/dist/validators/set.js +1 -199
  201. package/dist/validators/string-bool.js +1 -120
  202. package/dist/validators/string-formats.d.ts +58 -62
  203. package/dist/validators/string-formats.js +1 -135
  204. package/dist/validators/string.d.ts +49 -10
  205. package/dist/validators/string.js +1 -4
  206. package/dist/validators/symbol.js +1 -58
  207. package/dist/validators/template-literal.js +1 -103
  208. package/dist/validators/tuple.d.ts +17 -13
  209. package/dist/validators/tuple.js +1 -183
  210. package/dist/validators/uint8array.js +1 -101
  211. package/dist/validators/undefined.js +1 -40
  212. package/dist/validators/union.d.ts +1 -0
  213. package/dist/validators/union.js +1 -187
  214. package/dist/validators/unknown.js +1 -37
  215. package/dist/validators/void.js +1 -44
  216. package/dist/validators/xor.d.ts +2 -2
  217. package/dist/validators/xor.js +1 -66
  218. package/package.json +240 -238
  219. package/dist/chunks/errors-core-BeiFUtZM.js +0 -81
  220. package/dist/chunks/index-0R2ntSud.js +0 -508
  221. package/dist/chunks/index-BvH403Yy.js +0 -88
  222. package/dist/chunks/security-B0Pd_vSY.js +0 -35
  223. package/dist/chunks/string-BJRQod3t.js +0 -530
  224. package/dist/cjs/chunks/errors-core-DWxLFs2f.cjs +0 -83
  225. package/dist/cjs/chunks/index-BkI37108.cjs +0 -538
  226. package/dist/cjs/chunks/index-Cc3bjUMX.cjs +0 -91
  227. package/dist/cjs/chunks/security-Dc3Jh13T.cjs +0 -37
  228. package/dist/cjs/chunks/string-BKZrc4hs.cjs +0 -533
@@ -1,47 +1 @@
1
- export { _default, catchall, extend, maximum, merge, minimum, omit, partial, pick, required, safeExtend } from '../../v4-mini/index.js';
2
- export { $brand, $input, $output, NEVER, TimePrecision, ZodFirstPartyTypeKind, ZodIssueCode, _ZodString, _function, any, array, base64, base64Bytes, base64url, bigint, boolean, catch, check, cidrv4, cidrv6, clone, codec, coerce, config, core, createLogger, createNoOpLogger, cuid, cuid2, custom, date, decode, decodeAsync, default, describe, disableLogging, discriminatedUnion, e164, email, emoji, enableDebug, encode, encodeAsync, endsWith, enum, exactOptional, file, float32, float64, formatError, fromJSONSchema, _function as function, getErrorMap, getLogger, gt, gte, guid, hash, hex, hexBytes, hostname, httpUrl, includes, initLogger, instanceof, int, int32, int64, intersection, ipv4, ipv6, iso, json, jwt, keyof, ksuid, lazy, length, literal, locales, looseObject, looseRecord, lowercase, lt, lte, mac, map, mapSchema, maxLength, maxSize, meta, mime, minLength, minSize, multipleOf, nan, nanoid, nativeEnum, negative, never, nonnegative, nonoptional, nonpositive, normalize, null, nullable, nullish, number, object, optional, overwrite, parse, parseAsync, partialRecord, pipe, positive, prefault, preprocess, promise, property, readonly, record, refine, regex, regexes, safeDecode, safeDecodeAsync, safeEncode, safeEncodeAsync, safeParse, safeParseAsync, set, setErrorMap, setLogLevel, size, slugify, startsWith, strictObject, string, stringFormat, stringbool, superRefine, symbol, templateLiteral, toJSONSchema, toLowerCase, toUpperCase, transform, trim, tuple, uint32, uint64, uint8Array, ulid, undefined, union, unknown, uppercase, url, util, uuid, uuidv4, uuidv6, uuidv7, default as v, void, xid, xor, z } from '../../index.js';
3
- export { Err, Ok, ResultUtils, all, failure, flatMap, fromNullable, isErr, isOk, isResult, mapErr, match, success, tryCatch, tryCatchAsync, unwrap, unwrapOr } from '../../compat/result.js';
4
- export { VldBase, VldMeta, VldBrand as ZodBranded, VldCatch as ZodCatch, VldDefault as ZodDefault, VldExactOptional as ZodExactOptional, VldMeta as ZodMeta, VldBrand as ZodMiniBrand, VldCatch as ZodMiniCatch, VldDefault as ZodMiniDefault, VldExactOptional as ZodMiniExactOptional, VldRefine as ZodMiniNonOptional, VldNullable as ZodMiniNullable, VldOptional as ZodMiniOptional, VldPipe as ZodMiniPipe, VldPrefault as ZodMiniPrefault, VldReadonly as ZodMiniReadonly, VldTransform as ZodMiniTransform, VldBase as ZodMiniType, VldRefine as ZodNonOptional, VldNullable as ZodNullable, VldOptional as ZodOptional, VldPipe as ZodPipe, VldPrefault as ZodPrefault, VldPreprocess as ZodPreprocess, VldReadonly as ZodReadonly, VldTransform as ZodTransform, VldBase as ZodType } from '../../validators/base.js';
5
- export { V as VldError, V as ZodError, V as ZodRealError } from '../../chunks/errors-core-BeiFUtZM.js';
6
- export { VldIntersection, VldIntersection as ZodIntersection, VldIntersection as ZodMiniIntersection } from '../../validators/intersection.js';
7
- export { VldAny as ZodAny, VldAny as ZodMiniAny } from '../../validators/any.js';
8
- export { VldArray as ZodArray, VldArray as ZodMiniArray } from '../../validators/array.js';
9
- export { VldStringFormat as ZodBase64, VldStringFormat as ZodBase64URL, VldStringFormat as ZodCIDRv4, VldStringFormat as ZodCIDRv6, VldStringFormat as ZodCUID, VldStringFormat as ZodCUID2, VldStringFormat as ZodCustomStringFormat, VldStringFormat as ZodE164, VldStringFormat as ZodEmail, VldStringFormat as ZodEmoji, VldStringFormat as ZodGUID, VldStringFormat as ZodIPv4, VldStringFormat as ZodIPv6, VldStringFormat as ZodISODate, VldStringFormat as ZodISODateTime, VldStringFormat as ZodISODuration, VldStringFormat as ZodISOTime, VldStringFormat as ZodJWT, VldStringFormat as ZodKSUID, VldStringFormat as ZodMAC, VldStringFormat as ZodMiniBase64, VldStringFormat as ZodMiniBase64URL, VldStringFormat as ZodMiniCIDRv4, VldStringFormat as ZodMiniCIDRv6, VldStringFormat as ZodMiniCUID, VldStringFormat as ZodMiniCUID2, VldStringFormat as ZodMiniCustomStringFormat, VldStringFormat as ZodMiniE164, VldStringFormat as ZodMiniEmail, VldStringFormat as ZodMiniEmoji, VldStringFormat as ZodMiniGUID, VldStringFormat as ZodMiniIPv4, VldStringFormat as ZodMiniIPv6, VldStringFormat as ZodMiniISODate, VldStringFormat as ZodMiniISODateTime, VldStringFormat as ZodMiniISODuration, VldStringFormat as ZodMiniISOTime, VldStringFormat as ZodMiniJWT, VldStringFormat as ZodMiniKSUID, VldStringFormat as ZodMiniMAC, VldStringFormat as ZodMiniNanoID, VldStringFormat as ZodMiniStringFormat, VldStringFormat as ZodMiniULID, VldStringFormat as ZodMiniURL, VldStringFormat as ZodMiniUUID, VldStringFormat as ZodMiniXID, VldStringFormat as ZodNanoID, VldStringFormat as ZodStringFormat, VldStringFormat as ZodULID, VldStringFormat as ZodURL, VldStringFormat as ZodUUID, VldStringFormat as ZodXID } from '../../validators/string-formats.js';
10
- export { VldBigInt as ZodBigInt, VldBigInt as ZodBigIntFormat, VldBigInt as ZodMiniBigInt, VldBigInt as ZodMiniBigIntFormat } from '../../validators/bigint.js';
11
- export { VldBoolean as ZodBoolean, VldBoolean as ZodMiniBoolean } from '../../validators/boolean.js';
12
- export { VldCodec as ZodCodec, VldCodec as ZodMiniCodec } from '../../validators/codec.js';
13
- export { VldCustom as ZodCustom, VldCustom as ZodMiniCustom, VldCustom as ZodMiniSuccess, VldCustom as ZodSuccess } from '../../validators/custom.js';
14
- export { VldDate as ZodDate, VldDate as ZodMiniDate } from '../../validators/date.js';
15
- export { VldDiscriminatedUnion as ZodDiscriminatedUnion, VldDiscriminatedUnion as ZodMiniDiscriminatedUnion } from '../../validators/discriminated-union.js';
16
- export { VldEnum as ZodEnum, VldEnum as ZodMiniEnum } from '../../validators/enum.js';
17
- export { VldFile as ZodFile, VldFile as ZodMiniFile } from '../../validators/file.js';
18
- export { VldFunction as ZodFunction, VldFunction as ZodMiniFunction } from '../../validators/function.js';
19
- export { VldJson as ZodJSON } from '../../validators/json.js';
20
- export { VldLazy as ZodLazy, VldLazy as ZodMiniLazy } from '../../validators/lazy.js';
21
- export { VldLiteral as ZodLiteral, VldLiteral as ZodMiniLiteral } from '../../validators/literal.js';
22
- export { VldMap as ZodMap, VldMap as ZodMiniMap } from '../../validators/map.js';
23
- export { VldNan as ZodMiniNaN, VldNan as ZodNaN } from '../../validators/nan.js';
24
- export { VldNever as ZodMiniNever, VldNever as ZodNever } from '../../validators/never.js';
25
- export { VldNull as ZodMiniNull, VldNull as ZodNull } from '../../validators/null.js';
26
- export { VldNumber as ZodMiniNumber, VldNumber as ZodMiniNumberFormat, VldNumber as ZodNumber, VldNumber as ZodNumberFormat } from '../../validators/number.js';
27
- export { VldObject as ZodMiniObject, VldObject as ZodObject } from '../../validators/object.js';
28
- export { VldPromise as ZodMiniPromise, VldPromise as ZodPromise } from '../../validators/promise.js';
29
- export { VldRecord as ZodMiniRecord, VldRecord as ZodRecord } from '../../validators/record.js';
30
- export { VldSet as ZodMiniSet, VldSet as ZodSet } from '../../validators/set.js';
31
- export { V as ZodMiniString, V as ZodString } from '../../chunks/string-BJRQod3t.js';
32
- export { VldSymbol as ZodMiniSymbol, VldSymbol as ZodSymbol } from '../../validators/symbol.js';
33
- export { VldTemplateLiteral as ZodMiniTemplateLiteral, VldTemplateLiteral as ZodTemplateLiteral } from '../../validators/template-literal.js';
34
- export { VldTuple as ZodMiniTuple, VldTuple as ZodTuple } from '../../validators/tuple.js';
35
- export { VldUndefined as ZodMiniUndefined, VldUndefined as ZodUndefined } from '../../validators/undefined.js';
36
- export { VldUnion as ZodMiniUnion, VldUnion as ZodUnion } from '../../validators/union.js';
37
- export { VldUnknown as ZodMiniUnknown, VldUnknown as ZodUnknown } from '../../validators/unknown.js';
38
- export { VldVoid as ZodMiniVoid, VldVoid as ZodVoid } from '../../validators/void.js';
39
- export { VldXor as ZodMiniXor, VldXor as ZodXor } from '../../validators/xor.js';
40
- export { b as base64Json, a as base64ToBytes, c as base64ToUint8Array, d as base64UrlToBytes, e as base64urlToBytes, f as bytesToUtf8, g as epochMillisToDate, h as epochSecondsToDate, i as hexLowerToBytes, j as hexToBytes, k as hexToUint8Array, l as invertCodec, m as isoDatetimeToDate, n as jsonCodec, o as jwtPayload, p as numberToBigInt, s as stringToBigInt, q as stringToBoolean, r as stringToHttpURL, t as stringToInt, u as stringToNumber, v as stringToURL, w as stringToUint8Array, x as uint8ArrayToBase64, y as uint8ArrayToBase64Url, z as uint8ArrayToHex, A as uint8ArrayToString, B as uriComponent, C as utf8ToBytes } from '../../chunks/index-0R2ntSud.js';
41
- export { blue, bold, createTheme, cyan, dim, gray, green, grey, italic, magenta, default as pigment, red, strip, supportsColor, underline, vldTheme, white, yellow } from '../../pigment.js';
42
- export { createEmitter, createEventBus, withEmitter } from '../../compat/emitter.js';
43
- export { createVldKernel, definePlugin, getVldKernel, resetVldKernel, usePlugin } from '../../kernel.js';
44
- export { flattenError, prettifyError, prettifyErrorColored, prettifyErrorPlain, treeifyError } from '../../errors.js';
45
- export { getLocale, getMessages, getSupportedLocales, isLocaleLoaded, isLocaleSupported, registerLocale, setLocale } from '../../locales/runtime.js';
46
- export { globalRegistry, registry } from '../../registry.js';
47
- export { s as setLocaleAsync } from '../../chunks/index-BvH403Yy.js';
1
+ export{_default,catchall,extend,maximum,merge,minimum,omit,partial,pick,required,safeExtend}from"../../v4-mini/index.js";export{$brand,$input,$output,NEVER,TimePrecision,ZodFirstPartyTypeKind,ZodIssueCode,_ZodString,_function,any,array,base64,base64Bytes,base64url,bigint,boolean,catch,check,cidrv4,cidrv6,clone,codec,coerce,config,core,createLogger,createNoOpLogger,creditCard,cuid,cuid2,custom,date,decode,decodeAsync,deepPartial,default,describe,disableLogging,discriminatedUnion,e164,email,emoji,enableDebug,encode,encodeAsync,endsWith,enum,exactOptional,file,float32,float64,formatError,fromJSONSchema,_function as function,getErrorMap,getLogger,gt,gte,guid,hash,hex,hexBytes,hostname,httpUrl,includes,initLogger,input,instanceof,int,int32,int64,intersection,ipv4,ipv6,iso,json,jwt,keyof,ksuid,lazy,length,literal,locales,looseObject,looseRecord,lowercase,lt,lte,mac,map,mapSchema,maxLength,maxSize,meta,mime,minLength,minSize,multipleOf,nan,nanoid,nativeEnum,negative,never,nonnegative,nonoptional,nonpositive,normalize,null,nullable,nullish,number,object,optional,output,overwrite,parse,parseAsync,partialRecord,pipe,positive,prefault,preprocess,promise,property,readonly,record,refine,regex,regexes,safeDecode,safeDecodeAsync,safeEncode,safeEncodeAsync,safeParse,safeParseAsync,set,setErrorMap,setLogLevel,size,slugify,startsWith,strictObject,string,stringFormat,stringbool,superRefine,symbol,templateLiteral,toJSONSchema,toLowerCase,toUpperCase,transform,trim,tuple,uint32,uint64,uint8Array,ulid,undefined,union,unknown,uppercase,url,util,uuid,uuidv4,uuidv6,uuidv7,default as v,void,xid,xor,z}from"../../index.js";export{Err,Ok,ResultUtils,all,failure,flatMap,fromNullable,isErr,isOk,isResult,mapErr,match,success,tryCatch,tryCatchAsync,unwrap,unwrapOr}from"../../compat/result.js";export{VldBase,VldMeta,VldBrand as ZodBranded,VldCatch as ZodCatch,VldDefault as ZodDefault,VldExactOptional as ZodExactOptional,VldMeta as ZodMeta,VldBrand as ZodMiniBrand,VldCatch as ZodMiniCatch,VldDefault as ZodMiniDefault,VldExactOptional as ZodMiniExactOptional,VldRefine as ZodMiniNonOptional,VldNullable as ZodMiniNullable,VldOptional as ZodMiniOptional,VldPipe as ZodMiniPipe,VldPrefault as ZodMiniPrefault,VldReadonly as ZodMiniReadonly,VldTransform as ZodMiniTransform,VldBase as ZodMiniType,VldRefine as ZodNonOptional,VldNullable as ZodNullable,VldOptional as ZodOptional,VldPipe as ZodPipe,VldPrefault as ZodPrefault,VldPreprocess as ZodPreprocess,VldReadonly as ZodReadonly,VldTransform as ZodTransform,VldBase as ZodType}from"../../validators/base.js";export{V as VldError,V as ZodError,V as ZodRealError}from"../../chunks/errors-core-CerMg2rq.js";export{VldIntersection,VldIntersection as ZodIntersection,VldIntersection as ZodMiniIntersection}from"../../validators/intersection.js";export{VldAny as ZodAny,VldAny as ZodMiniAny}from"../../validators/any.js";export{VldArray as ZodArray,VldArray as ZodMiniArray}from"../../validators/array.js";export{VldStringFormat as ZodBase64,VldStringFormat as ZodBase64URL,VldStringFormat as ZodCIDRv4,VldStringFormat as ZodCIDRv6,VldStringFormat as ZodCUID,VldStringFormat as ZodCUID2,VldStringFormat as ZodCreditCard,VldStringFormat as ZodCustomStringFormat,VldStringFormat as ZodE164,VldStringFormat as ZodEmail,VldStringFormat as ZodEmoji,VldStringFormat as ZodGUID,VldStringFormat as ZodIPv4,VldStringFormat as ZodIPv6,VldStringFormat as ZodISODate,VldStringFormat as ZodISODateTime,VldStringFormat as ZodISODuration,VldStringFormat as ZodISOTime,VldStringFormat as ZodJWT,VldStringFormat as ZodKSUID,VldStringFormat as ZodMAC,VldStringFormat as ZodMiniBase64,VldStringFormat as ZodMiniBase64URL,VldStringFormat as ZodMiniCIDRv4,VldStringFormat as ZodMiniCIDRv6,VldStringFormat as ZodMiniCUID,VldStringFormat as ZodMiniCUID2,VldStringFormat as ZodMiniCreditCard,VldStringFormat as ZodMiniCustomStringFormat,VldStringFormat as ZodMiniE164,VldStringFormat as ZodMiniEmail,VldStringFormat as ZodMiniEmoji,VldStringFormat as ZodMiniGUID,VldStringFormat as ZodMiniIPv4,VldStringFormat as ZodMiniIPv6,VldStringFormat as ZodMiniISODate,VldStringFormat as ZodMiniISODateTime,VldStringFormat as ZodMiniISODuration,VldStringFormat as ZodMiniISOTime,VldStringFormat as ZodMiniJWT,VldStringFormat as ZodMiniKSUID,VldStringFormat as ZodMiniMAC,VldStringFormat as ZodMiniNanoID,VldStringFormat as ZodMiniStringFormat,VldStringFormat as ZodMiniULID,VldStringFormat as ZodMiniURL,VldStringFormat as ZodMiniUUID,VldStringFormat as ZodMiniXID,VldStringFormat as ZodNanoID,VldStringFormat as ZodStringFormat,VldStringFormat as ZodULID,VldStringFormat as ZodURL,VldStringFormat as ZodUUID,VldStringFormat as ZodXID}from"../../validators/string-formats.js";export{VldBigInt as ZodBigInt,VldBigInt as ZodBigIntFormat,VldBigInt as ZodMiniBigInt,VldBigInt as ZodMiniBigIntFormat}from"../../validators/bigint.js";export{VldBoolean as ZodBoolean,VldBoolean as ZodMiniBoolean}from"../../validators/boolean.js";export{VldCodec as ZodCodec,VldCodec as ZodMiniCodec}from"../../validators/codec.js";export{VldCustom as ZodCustom,VldCustom as ZodMiniCustom,VldCustom as ZodMiniSuccess,VldCustom as ZodSuccess}from"../../validators/custom.js";export{VldDate as ZodDate,VldDate as ZodMiniDate}from"../../validators/date.js";export{VldDiscriminatedUnion as ZodDiscriminatedUnion,VldDiscriminatedUnion as ZodMiniDiscriminatedUnion}from"../../validators/discriminated-union.js";export{VldEnum as ZodEnum,VldEnum as ZodMiniEnum}from"../../validators/enum.js";export{VldFile as ZodFile,VldFile as ZodMiniFile}from"../../validators/file.js";export{VldFunction as ZodFunction,VldFunction as ZodMiniFunction}from"../../validators/function.js";export{VldJson as ZodJSON}from"../../validators/json.js";export{VldLazy as ZodLazy,VldLazy as ZodMiniLazy}from"../../validators/lazy.js";export{VldLiteral as ZodLiteral,VldLiteral as ZodMiniLiteral}from"../../validators/literal.js";export{VldMap as ZodMap,VldMap as ZodMiniMap}from"../../validators/map.js";export{VldNan as ZodMiniNaN,VldNan as ZodNaN}from"../../validators/nan.js";export{VldNever as ZodMiniNever,VldNever as ZodNever}from"../../validators/never.js";export{VldNull as ZodMiniNull,VldNull as ZodNull}from"../../validators/null.js";export{VldNumber as ZodMiniNumber,VldNumber as ZodMiniNumberFormat,VldNumber as ZodNumber,VldNumber as ZodNumberFormat}from"../../validators/number.js";export{VldObject as ZodMiniObject,VldObject as ZodObject}from"../../validators/object.js";export{VldPromise as ZodMiniPromise,VldPromise as ZodPromise}from"../../validators/promise.js";export{VldRecord as ZodMiniRecord,VldRecord as ZodRecord}from"../../validators/record.js";export{VldSet as ZodMiniSet,VldSet as ZodSet}from"../../validators/set.js";export{VldString as ZodMiniString,VldString as ZodString}from"../../validators/string.js";export{VldSymbol as ZodMiniSymbol,VldSymbol as ZodSymbol}from"../../validators/symbol.js";export{VldTemplateLiteral as ZodMiniTemplateLiteral,VldTemplateLiteral as ZodTemplateLiteral}from"../../validators/template-literal.js";export{VldTuple as ZodMiniTuple,VldTuple as ZodTuple}from"../../validators/tuple.js";export{VldUndefined as ZodMiniUndefined,VldUndefined as ZodUndefined}from"../../validators/undefined.js";export{VldUnion as ZodMiniUnion,VldUnion as ZodUnion}from"../../validators/union.js";export{VldUnknown as ZodMiniUnknown,VldUnknown as ZodUnknown}from"../../validators/unknown.js";export{VldVoid as ZodMiniVoid,VldVoid as ZodVoid}from"../../validators/void.js";export{VldXor as ZodMiniXor,VldXor as ZodXor}from"../../validators/xor.js";export{b as base64Json,a as base64ToBytes,c as base64ToUint8Array,d as base64UrlToBytes,e as base64urlToBytes,f as bytesToUtf8,g as epochMillisToDate,h as epochSecondsToDate,i as hexLowerToBytes,j as hexToBytes,k as hexToUint8Array,l as invertCodec,m as isoDatetimeToDate,n as jsonCodec,o as jwtPayload,p as numberToBigInt,s as stringToBigInt,q as stringToBoolean,r as stringToHttpURL,t as stringToInt,u as stringToNumber,v as stringToURL,w as stringToUint8Array,x as uint8ArrayToBase64,y as uint8ArrayToBase64Url,z as uint8ArrayToHex,A as uint8ArrayToString,B as uriComponent,C as utf8ToBytes}from"../../chunks/index-CkbfQQ4n.js";export{blue,bold,createTheme,cyan,dim,gray,green,grey,italic,magenta,default as pigment,red,strip,supportsColor,underline,vldTheme,white,yellow}from"../../pigment.js";export{createEmitter,createEventBus,withEmitter}from"../../compat/emitter.js";export{createVldKernel,definePlugin,getVldKernel,resetVldKernel,usePlugin}from"../../kernel.js";export{flattenError,prettifyError,prettifyErrorColored,prettifyErrorPlain,treeifyError}from"../../errors.js";export{getLocale,getMessages,getSupportedLocales,isLocaleLoaded,isLocaleSupported,registerLocale,setLocale}from"../../locales/runtime.js";export{globalRegistry,registry}from"../../registry.js";export{s as setLocaleAsync}from"../../chunks/index-yjpbvFgw.js";
@@ -1,6 +1,6 @@
1
1
  export * from '../index.js';
2
2
  export { default } from '../index.js';
3
- export { ZodAny as ZodMiniAny, ZodArray as ZodMiniArray, ZodBase64 as ZodMiniBase64, ZodBase64URL as ZodMiniBase64URL, ZodBigInt as ZodMiniBigInt, ZodBigIntFormat as ZodMiniBigIntFormat, ZodBoolean as ZodMiniBoolean, ZodBranded as ZodMiniBrand, ZodCIDRv4 as ZodMiniCIDRv4, ZodCIDRv6 as ZodMiniCIDRv6, ZodCUID as ZodMiniCUID, ZodCUID2 as ZodMiniCUID2, ZodCatch as ZodMiniCatch, ZodCodec as ZodMiniCodec, ZodCustom as ZodMiniCustom, ZodCustomStringFormat as ZodMiniCustomStringFormat, ZodDate as ZodMiniDate, ZodDefault as ZodMiniDefault, ZodDiscriminatedUnion as ZodMiniDiscriminatedUnion, ZodE164 as ZodMiniE164, ZodEmail as ZodMiniEmail, ZodEmoji as ZodMiniEmoji, ZodEnum as ZodMiniEnum, ZodExactOptional as ZodMiniExactOptional, ZodFile as ZodMiniFile, ZodFunction as ZodMiniFunction, ZodGUID as ZodMiniGUID, ZodIPv4 as ZodMiniIPv4, ZodIPv6 as ZodMiniIPv6, ZodISODate as ZodMiniISODate, ZodISODateTime as ZodMiniISODateTime, ZodISODuration as ZodMiniISODuration, ZodISOTime as ZodMiniISOTime, ZodIntersection as ZodMiniIntersection, ZodJWT as ZodMiniJWT, ZodKSUID as ZodMiniKSUID, ZodLazy as ZodMiniLazy, ZodLiteral as ZodMiniLiteral, ZodMAC as ZodMiniMAC, ZodMap as ZodMiniMap, ZodNaN as ZodMiniNaN, ZodNanoID as ZodMiniNanoID, ZodNever as ZodMiniNever, ZodNonOptional as ZodMiniNonOptional, ZodNull as ZodMiniNull, ZodNullable as ZodMiniNullable, ZodNumber as ZodMiniNumber, ZodNumberFormat as ZodMiniNumberFormat, ZodObject as ZodMiniObject, ZodOptional as ZodMiniOptional, ZodPipe as ZodMiniPipe, ZodPrefault as ZodMiniPrefault, ZodPromise as ZodMiniPromise, ZodReadonly as ZodMiniReadonly, ZodRecord as ZodMiniRecord, ZodSet as ZodMiniSet, ZodString as ZodMiniString, ZodStringFormat as ZodMiniStringFormat, ZodSuccess as ZodMiniSuccess, ZodSymbol as ZodMiniSymbol, ZodTemplateLiteral as ZodMiniTemplateLiteral, ZodTransform as ZodMiniTransform, ZodTuple as ZodMiniTuple, ZodType as ZodMiniType, ZodULID as ZodMiniULID, ZodURL as ZodMiniURL, ZodUUID as ZodMiniUUID, ZodUndefined as ZodMiniUndefined, ZodUnion as ZodMiniUnion, ZodUnknown as ZodMiniUnknown, ZodVoid as ZodMiniVoid, ZodXID as ZodMiniXID, ZodXor as ZodMiniXor } from '../index.js';
3
+ export { ZodAny as ZodMiniAny, ZodArray as ZodMiniArray, ZodBase64 as ZodMiniBase64, ZodBase64URL as ZodMiniBase64URL, ZodBigInt as ZodMiniBigInt, ZodBigIntFormat as ZodMiniBigIntFormat, ZodBoolean as ZodMiniBoolean, ZodBranded as ZodMiniBrand, ZodCIDRv4 as ZodMiniCIDRv4, ZodCIDRv6 as ZodMiniCIDRv6, ZodCUID as ZodMiniCUID, ZodCUID2 as ZodMiniCUID2, ZodCatch as ZodMiniCatch, ZodCodec as ZodMiniCodec, ZodCreditCard as ZodMiniCreditCard, ZodCustom as ZodMiniCustom, ZodCustomStringFormat as ZodMiniCustomStringFormat, ZodDate as ZodMiniDate, ZodDefault as ZodMiniDefault, ZodDiscriminatedUnion as ZodMiniDiscriminatedUnion, ZodE164 as ZodMiniE164, ZodEmail as ZodMiniEmail, ZodEmoji as ZodMiniEmoji, ZodEnum as ZodMiniEnum, ZodExactOptional as ZodMiniExactOptional, ZodFile as ZodMiniFile, ZodFunction as ZodMiniFunction, ZodGUID as ZodMiniGUID, ZodIPv4 as ZodMiniIPv4, ZodIPv6 as ZodMiniIPv6, ZodISODate as ZodMiniISODate, ZodISODateTime as ZodMiniISODateTime, ZodISODuration as ZodMiniISODuration, ZodISOTime as ZodMiniISOTime, ZodIntersection as ZodMiniIntersection, ZodJWT as ZodMiniJWT, ZodKSUID as ZodMiniKSUID, ZodLazy as ZodMiniLazy, ZodLiteral as ZodMiniLiteral, ZodMAC as ZodMiniMAC, ZodMap as ZodMiniMap, ZodNaN as ZodMiniNaN, ZodNanoID as ZodMiniNanoID, ZodNever as ZodMiniNever, ZodNonOptional as ZodMiniNonOptional, ZodNull as ZodMiniNull, ZodNullable as ZodMiniNullable, ZodNumber as ZodMiniNumber, ZodNumberFormat as ZodMiniNumberFormat, ZodObject as ZodMiniObject, ZodOptional as ZodMiniOptional, ZodPipe as ZodMiniPipe, ZodPrefault as ZodMiniPrefault, ZodPromise as ZodMiniPromise, ZodReadonly as ZodMiniReadonly, ZodRecord as ZodMiniRecord, ZodSet as ZodMiniSet, ZodString as ZodMiniString, ZodStringFormat as ZodMiniStringFormat, ZodSuccess as ZodMiniSuccess, ZodSymbol as ZodMiniSymbol, ZodTemplateLiteral as ZodMiniTemplateLiteral, ZodTransform as ZodMiniTransform, ZodTuple as ZodMiniTuple, ZodType as ZodMiniType, ZodULID as ZodMiniULID, ZodURL as ZodMiniURL, ZodUUID as ZodMiniUUID, ZodUndefined as ZodMiniUndefined, ZodUnion as ZodMiniUnion, ZodUnknown as ZodMiniUnknown, ZodVoid as ZodMiniVoid, ZodXID as ZodMiniXID, ZodXor as ZodMiniXor } from '../index.js';
4
4
  import type { VldBase } from '../validators/base.js';
5
5
  import type { VldObject } from '../validators/object.js';
6
6
  type ObjectShape = Record<string, VldBase<any, any>>;
@@ -1,75 +1 @@
1
- import { number } from '../index.js';
2
- export { $brand, $input, $output, NEVER, TimePrecision, ZodFirstPartyTypeKind, ZodIssueCode, _ZodString, _function, any, array, base64, base64Bytes, base64url, bigint, boolean, catch, check, cidrv4, cidrv6, clone, codec, coerce, config, core, createLogger, createNoOpLogger, cuid, cuid2, custom, date, decode, decodeAsync, default, describe, disableLogging, discriminatedUnion, e164, email, emoji, enableDebug, encode, encodeAsync, endsWith, enum, exactOptional, file, float32, float64, formatError, fromJSONSchema, _function as function, getErrorMap, getLogger, gt, gte, guid, hash, hex, hexBytes, hostname, httpUrl, includes, initLogger, instanceof, int, int32, int64, intersection, ipv4, ipv6, iso, json, jwt, keyof, ksuid, lazy, length, literal, locales, looseObject, looseRecord, lowercase, lt, lte, mac, map, mapSchema, maxLength, maxSize, meta, mime, minLength, minSize, multipleOf, nan, nanoid, nativeEnum, negative, never, nonnegative, nonoptional, nonpositive, normalize, null, nullable, nullish, object, optional, overwrite, parse, parseAsync, partialRecord, pipe, positive, prefault, preprocess, promise, property, readonly, record, refine, regex, regexes, safeDecode, safeDecodeAsync, safeEncode, safeEncodeAsync, safeParse, safeParseAsync, set, setErrorMap, setLogLevel, size, slugify, startsWith, strictObject, string, stringFormat, stringbool, superRefine, symbol, templateLiteral, toJSONSchema, toLowerCase, toUpperCase, transform, trim, tuple, uint32, uint64, uint8Array, ulid, undefined, union, unknown, uppercase, url, util, uuid, uuidv4, uuidv6, uuidv7, default as v, void, xid, xor, z } from '../index.js';
3
- export { Err, Ok, ResultUtils, all, failure, flatMap, fromNullable, isErr, isOk, isResult, mapErr, match, success, tryCatch, tryCatchAsync, unwrap, unwrapOr } from '../compat/result.js';
4
- export { VldBase, VldMeta, VldBrand as ZodBranded, VldCatch as ZodCatch, VldDefault as ZodDefault, VldExactOptional as ZodExactOptional, VldMeta as ZodMeta, VldBrand as ZodMiniBrand, VldCatch as ZodMiniCatch, VldDefault as ZodMiniDefault, VldExactOptional as ZodMiniExactOptional, VldRefine as ZodMiniNonOptional, VldNullable as ZodMiniNullable, VldOptional as ZodMiniOptional, VldPipe as ZodMiniPipe, VldPrefault as ZodMiniPrefault, VldReadonly as ZodMiniReadonly, VldTransform as ZodMiniTransform, VldBase as ZodMiniType, VldRefine as ZodNonOptional, VldNullable as ZodNullable, VldOptional as ZodOptional, VldPipe as ZodPipe, VldPrefault as ZodPrefault, VldPreprocess as ZodPreprocess, VldReadonly as ZodReadonly, VldTransform as ZodTransform, VldBase as ZodType } from '../validators/base.js';
5
- export { V as VldError, V as ZodError, V as ZodRealError } from '../chunks/errors-core-BeiFUtZM.js';
6
- export { VldIntersection, VldIntersection as ZodIntersection, VldIntersection as ZodMiniIntersection } from '../validators/intersection.js';
7
- export { VldAny as ZodAny, VldAny as ZodMiniAny } from '../validators/any.js';
8
- export { VldArray as ZodArray, VldArray as ZodMiniArray } from '../validators/array.js';
9
- export { VldStringFormat as ZodBase64, VldStringFormat as ZodBase64URL, VldStringFormat as ZodCIDRv4, VldStringFormat as ZodCIDRv6, VldStringFormat as ZodCUID, VldStringFormat as ZodCUID2, VldStringFormat as ZodCustomStringFormat, VldStringFormat as ZodE164, VldStringFormat as ZodEmail, VldStringFormat as ZodEmoji, VldStringFormat as ZodGUID, VldStringFormat as ZodIPv4, VldStringFormat as ZodIPv6, VldStringFormat as ZodISODate, VldStringFormat as ZodISODateTime, VldStringFormat as ZodISODuration, VldStringFormat as ZodISOTime, VldStringFormat as ZodJWT, VldStringFormat as ZodKSUID, VldStringFormat as ZodMAC, VldStringFormat as ZodMiniBase64, VldStringFormat as ZodMiniBase64URL, VldStringFormat as ZodMiniCIDRv4, VldStringFormat as ZodMiniCIDRv6, VldStringFormat as ZodMiniCUID, VldStringFormat as ZodMiniCUID2, VldStringFormat as ZodMiniCustomStringFormat, VldStringFormat as ZodMiniE164, VldStringFormat as ZodMiniEmail, VldStringFormat as ZodMiniEmoji, VldStringFormat as ZodMiniGUID, VldStringFormat as ZodMiniIPv4, VldStringFormat as ZodMiniIPv6, VldStringFormat as ZodMiniISODate, VldStringFormat as ZodMiniISODateTime, VldStringFormat as ZodMiniISODuration, VldStringFormat as ZodMiniISOTime, VldStringFormat as ZodMiniJWT, VldStringFormat as ZodMiniKSUID, VldStringFormat as ZodMiniMAC, VldStringFormat as ZodMiniNanoID, VldStringFormat as ZodMiniStringFormat, VldStringFormat as ZodMiniULID, VldStringFormat as ZodMiniURL, VldStringFormat as ZodMiniUUID, VldStringFormat as ZodMiniXID, VldStringFormat as ZodNanoID, VldStringFormat as ZodStringFormat, VldStringFormat as ZodULID, VldStringFormat as ZodURL, VldStringFormat as ZodUUID, VldStringFormat as ZodXID } from '../validators/string-formats.js';
10
- export { VldBigInt as ZodBigInt, VldBigInt as ZodBigIntFormat, VldBigInt as ZodMiniBigInt, VldBigInt as ZodMiniBigIntFormat } from '../validators/bigint.js';
11
- export { VldBoolean as ZodBoolean, VldBoolean as ZodMiniBoolean } from '../validators/boolean.js';
12
- export { VldCodec as ZodCodec, VldCodec as ZodMiniCodec } from '../validators/codec.js';
13
- export { VldCustom as ZodCustom, VldCustom as ZodMiniCustom, VldCustom as ZodMiniSuccess, VldCustom as ZodSuccess } from '../validators/custom.js';
14
- export { VldDate as ZodDate, VldDate as ZodMiniDate } from '../validators/date.js';
15
- export { VldDiscriminatedUnion as ZodDiscriminatedUnion, VldDiscriminatedUnion as ZodMiniDiscriminatedUnion } from '../validators/discriminated-union.js';
16
- export { VldEnum as ZodEnum, VldEnum as ZodMiniEnum } from '../validators/enum.js';
17
- export { VldFile as ZodFile, VldFile as ZodMiniFile } from '../validators/file.js';
18
- export { VldFunction as ZodFunction, VldFunction as ZodMiniFunction } from '../validators/function.js';
19
- export { VldJson as ZodJSON } from '../validators/json.js';
20
- export { VldLazy as ZodLazy, VldLazy as ZodMiniLazy } from '../validators/lazy.js';
21
- export { VldLiteral as ZodLiteral, VldLiteral as ZodMiniLiteral } from '../validators/literal.js';
22
- export { VldMap as ZodMap, VldMap as ZodMiniMap } from '../validators/map.js';
23
- export { VldNan as ZodMiniNaN, VldNan as ZodNaN } from '../validators/nan.js';
24
- export { VldNever as ZodMiniNever, VldNever as ZodNever } from '../validators/never.js';
25
- export { VldNull as ZodMiniNull, VldNull as ZodNull } from '../validators/null.js';
26
- export { VldNumber as ZodMiniNumber, VldNumber as ZodMiniNumberFormat, VldNumber as ZodNumber, VldNumber as ZodNumberFormat } from '../validators/number.js';
27
- export { VldObject as ZodMiniObject, VldObject as ZodObject } from '../validators/object.js';
28
- export { VldPromise as ZodMiniPromise, VldPromise as ZodPromise } from '../validators/promise.js';
29
- export { VldRecord as ZodMiniRecord, VldRecord as ZodRecord } from '../validators/record.js';
30
- export { VldSet as ZodMiniSet, VldSet as ZodSet } from '../validators/set.js';
31
- export { V as ZodMiniString, V as ZodString } from '../chunks/string-BJRQod3t.js';
32
- export { VldSymbol as ZodMiniSymbol, VldSymbol as ZodSymbol } from '../validators/symbol.js';
33
- export { VldTemplateLiteral as ZodMiniTemplateLiteral, VldTemplateLiteral as ZodTemplateLiteral } from '../validators/template-literal.js';
34
- export { VldTuple as ZodMiniTuple, VldTuple as ZodTuple } from '../validators/tuple.js';
35
- export { VldUndefined as ZodMiniUndefined, VldUndefined as ZodUndefined } from '../validators/undefined.js';
36
- export { VldUnion as ZodMiniUnion, VldUnion as ZodUnion } from '../validators/union.js';
37
- export { VldUnknown as ZodMiniUnknown, VldUnknown as ZodUnknown } from '../validators/unknown.js';
38
- export { VldVoid as ZodMiniVoid, VldVoid as ZodVoid } from '../validators/void.js';
39
- export { VldXor as ZodMiniXor, VldXor as ZodXor } from '../validators/xor.js';
40
- export { b as base64Json, a as base64ToBytes, c as base64ToUint8Array, d as base64UrlToBytes, e as base64urlToBytes, f as bytesToUtf8, g as epochMillisToDate, h as epochSecondsToDate, i as hexLowerToBytes, j as hexToBytes, k as hexToUint8Array, l as invertCodec, m as isoDatetimeToDate, n as jsonCodec, o as jwtPayload, p as numberToBigInt, s as stringToBigInt, q as stringToBoolean, r as stringToHttpURL, t as stringToInt, u as stringToNumber, v as stringToURL, w as stringToUint8Array, x as uint8ArrayToBase64, y as uint8ArrayToBase64Url, z as uint8ArrayToHex, A as uint8ArrayToString, B as uriComponent, C as utf8ToBytes } from '../chunks/index-0R2ntSud.js';
41
- export { blue, bold, createTheme, cyan, dim, gray, green, grey, italic, magenta, default as pigment, red, strip, supportsColor, underline, vldTheme, white, yellow } from '../pigment.js';
42
- export { createEmitter, createEventBus, withEmitter } from '../compat/emitter.js';
43
- export { createVldKernel, definePlugin, getVldKernel, resetVldKernel, usePlugin } from '../kernel.js';
44
- export { flattenError, prettifyError, prettifyErrorColored, prettifyErrorPlain, treeifyError } from '../errors.js';
45
- export { getLocale, getMessages, getSupportedLocales, isLocaleLoaded, isLocaleSupported, registerLocale, setLocale } from '../locales/runtime.js';
46
- export { globalRegistry, registry } from '../registry.js';
47
- export { s as setLocaleAsync } from '../chunks/index-BvH403Yy.js';
48
-
49
- function maskKeys(mask) {
50
- return Object.keys(mask).filter((key) => mask[key]);
51
- }
52
- function constraintMessage(params) {
53
- return typeof params === 'string' ? params : params?.message || params?.error;
54
- }
55
- const pick = (schema, mask) => schema.pick(...maskKeys(mask));
56
- const omit = (schema, mask) => schema.omit(...maskKeys(mask));
57
- const partial = (schema) => schema.partial();
58
- const required = (schema) => schema.required();
59
- const extend = (schema, shape) => schema.extend(shape);
60
- const safeExtend = (schema, shape) => schema.safeExtend(shape);
61
- const merge = (schema, other) => other && typeof other.parse === 'function'
62
- ? schema.merge(other)
63
- : schema.extend(other);
64
- const catchall = (schema, catchallSchema) => schema.catchall(catchallSchema);
65
- const _default = (schema, defaultValue) => schema.default(typeof defaultValue === 'function' ? defaultValue() : defaultValue);
66
- const minimum = (value, params) => {
67
- const message = constraintMessage(params);
68
- return number().min(value, message);
69
- };
70
- const maximum = (value, params) => {
71
- const message = constraintMessage(params);
72
- return number().max(value, message);
73
- };
74
-
75
- export { _default, catchall, extend, maximum, merge, minimum, number, omit, partial, pick, required, safeExtend };
1
+ import{number as Z}from"../index.js";export{$brand,$input,$output,NEVER,TimePrecision,ZodFirstPartyTypeKind,ZodIssueCode,_ZodString,_function,any,array,base64,base64Bytes,base64url,bigint,boolean,catch,check,cidrv4,cidrv6,clone,codec,coerce,config,core,createLogger,createNoOpLogger,creditCard,cuid,cuid2,custom,date,decode,decodeAsync,deepPartial,default,describe,disableLogging,discriminatedUnion,e164,email,emoji,enableDebug,encode,encodeAsync,endsWith,enum,exactOptional,file,float32,float64,formatError,fromJSONSchema,_function as function,getErrorMap,getLogger,gt,gte,guid,hash,hex,hexBytes,hostname,httpUrl,includes,initLogger,input,instanceof,int,int32,int64,intersection,ipv4,ipv6,iso,json,jwt,keyof,ksuid,lazy,length,literal,locales,looseObject,looseRecord,lowercase,lt,lte,mac,map,mapSchema,maxLength,maxSize,meta,mime,minLength,minSize,multipleOf,nan,nanoid,nativeEnum,negative,never,nonnegative,nonoptional,nonpositive,normalize,null,nullable,nullish,object,optional,output,overwrite,parse,parseAsync,partialRecord,pipe,positive,prefault,preprocess,promise,property,readonly,record,refine,regex,regexes,safeDecode,safeDecodeAsync,safeEncode,safeEncodeAsync,safeParse,safeParseAsync,set,setErrorMap,setLogLevel,size,slugify,startsWith,strictObject,string,stringFormat,stringbool,superRefine,symbol,templateLiteral,toJSONSchema,toLowerCase,toUpperCase,transform,trim,tuple,uint32,uint64,uint8Array,ulid,undefined,union,unknown,uppercase,url,util,uuid,uuidv4,uuidv6,uuidv7,default as v,void,xid,xor,z}from"../index.js";export{Err,Ok,ResultUtils,all,failure,flatMap,fromNullable,isErr,isOk,isResult,mapErr,match,success,tryCatch,tryCatchAsync,unwrap,unwrapOr}from"../compat/result.js";export{VldBase,VldMeta,VldBrand as ZodBranded,VldCatch as ZodCatch,VldDefault as ZodDefault,VldExactOptional as ZodExactOptional,VldMeta as ZodMeta,VldBrand as ZodMiniBrand,VldCatch as ZodMiniCatch,VldDefault as ZodMiniDefault,VldExactOptional as ZodMiniExactOptional,VldRefine as ZodMiniNonOptional,VldNullable as ZodMiniNullable,VldOptional as ZodMiniOptional,VldPipe as ZodMiniPipe,VldPrefault as ZodMiniPrefault,VldReadonly as ZodMiniReadonly,VldTransform as ZodMiniTransform,VldBase as ZodMiniType,VldRefine as ZodNonOptional,VldNullable as ZodNullable,VldOptional as ZodOptional,VldPipe as ZodPipe,VldPrefault as ZodPrefault,VldPreprocess as ZodPreprocess,VldReadonly as ZodReadonly,VldTransform as ZodTransform,VldBase as ZodType}from"../validators/base.js";export{V as VldError,V as ZodError,V as ZodRealError}from"../chunks/errors-core-CerMg2rq.js";export{VldIntersection,VldIntersection as ZodIntersection,VldIntersection as ZodMiniIntersection}from"../validators/intersection.js";export{VldAny as ZodAny,VldAny as ZodMiniAny}from"../validators/any.js";export{VldArray as ZodArray,VldArray as ZodMiniArray}from"../validators/array.js";export{VldStringFormat as ZodBase64,VldStringFormat as ZodBase64URL,VldStringFormat as ZodCIDRv4,VldStringFormat as ZodCIDRv6,VldStringFormat as ZodCUID,VldStringFormat as ZodCUID2,VldStringFormat as ZodCreditCard,VldStringFormat as ZodCustomStringFormat,VldStringFormat as ZodE164,VldStringFormat as ZodEmail,VldStringFormat as ZodEmoji,VldStringFormat as ZodGUID,VldStringFormat as ZodIPv4,VldStringFormat as ZodIPv6,VldStringFormat as ZodISODate,VldStringFormat as ZodISODateTime,VldStringFormat as ZodISODuration,VldStringFormat as ZodISOTime,VldStringFormat as ZodJWT,VldStringFormat as ZodKSUID,VldStringFormat as ZodMAC,VldStringFormat as ZodMiniBase64,VldStringFormat as ZodMiniBase64URL,VldStringFormat as ZodMiniCIDRv4,VldStringFormat as ZodMiniCIDRv6,VldStringFormat as ZodMiniCUID,VldStringFormat as ZodMiniCUID2,VldStringFormat as ZodMiniCreditCard,VldStringFormat as ZodMiniCustomStringFormat,VldStringFormat as ZodMiniE164,VldStringFormat as ZodMiniEmail,VldStringFormat as ZodMiniEmoji,VldStringFormat as ZodMiniGUID,VldStringFormat as ZodMiniIPv4,VldStringFormat as ZodMiniIPv6,VldStringFormat as ZodMiniISODate,VldStringFormat as ZodMiniISODateTime,VldStringFormat as ZodMiniISODuration,VldStringFormat as ZodMiniISOTime,VldStringFormat as ZodMiniJWT,VldStringFormat as ZodMiniKSUID,VldStringFormat as ZodMiniMAC,VldStringFormat as ZodMiniNanoID,VldStringFormat as ZodMiniStringFormat,VldStringFormat as ZodMiniULID,VldStringFormat as ZodMiniURL,VldStringFormat as ZodMiniUUID,VldStringFormat as ZodMiniXID,VldStringFormat as ZodNanoID,VldStringFormat as ZodStringFormat,VldStringFormat as ZodULID,VldStringFormat as ZodURL,VldStringFormat as ZodUUID,VldStringFormat as ZodXID}from"../validators/string-formats.js";export{VldBigInt as ZodBigInt,VldBigInt as ZodBigIntFormat,VldBigInt as ZodMiniBigInt,VldBigInt as ZodMiniBigIntFormat}from"../validators/bigint.js";export{VldBoolean as ZodBoolean,VldBoolean as ZodMiniBoolean}from"../validators/boolean.js";export{VldCodec as ZodCodec,VldCodec as ZodMiniCodec}from"../validators/codec.js";export{VldCustom as ZodCustom,VldCustom as ZodMiniCustom,VldCustom as ZodMiniSuccess,VldCustom as ZodSuccess}from"../validators/custom.js";export{VldDate as ZodDate,VldDate as ZodMiniDate}from"../validators/date.js";export{VldDiscriminatedUnion as ZodDiscriminatedUnion,VldDiscriminatedUnion as ZodMiniDiscriminatedUnion}from"../validators/discriminated-union.js";export{VldEnum as ZodEnum,VldEnum as ZodMiniEnum}from"../validators/enum.js";export{VldFile as ZodFile,VldFile as ZodMiniFile}from"../validators/file.js";export{VldFunction as ZodFunction,VldFunction as ZodMiniFunction}from"../validators/function.js";export{VldJson as ZodJSON}from"../validators/json.js";export{VldLazy as ZodLazy,VldLazy as ZodMiniLazy}from"../validators/lazy.js";export{VldLiteral as ZodLiteral,VldLiteral as ZodMiniLiteral}from"../validators/literal.js";export{VldMap as ZodMap,VldMap as ZodMiniMap}from"../validators/map.js";export{VldNan as ZodMiniNaN,VldNan as ZodNaN}from"../validators/nan.js";export{VldNever as ZodMiniNever,VldNever as ZodNever}from"../validators/never.js";export{VldNull as ZodMiniNull,VldNull as ZodNull}from"../validators/null.js";export{VldNumber as ZodMiniNumber,VldNumber as ZodMiniNumberFormat,VldNumber as ZodNumber,VldNumber as ZodNumberFormat}from"../validators/number.js";export{VldObject as ZodMiniObject,VldObject as ZodObject}from"../validators/object.js";export{VldPromise as ZodMiniPromise,VldPromise as ZodPromise}from"../validators/promise.js";export{VldRecord as ZodMiniRecord,VldRecord as ZodRecord}from"../validators/record.js";export{VldSet as ZodMiniSet,VldSet as ZodSet}from"../validators/set.js";export{VldString as ZodMiniString,VldString as ZodString}from"../validators/string.js";export{VldSymbol as ZodMiniSymbol,VldSymbol as ZodSymbol}from"../validators/symbol.js";export{VldTemplateLiteral as ZodMiniTemplateLiteral,VldTemplateLiteral as ZodTemplateLiteral}from"../validators/template-literal.js";export{VldTuple as ZodMiniTuple,VldTuple as ZodTuple}from"../validators/tuple.js";export{VldUndefined as ZodMiniUndefined,VldUndefined as ZodUndefined}from"../validators/undefined.js";export{VldUnion as ZodMiniUnion,VldUnion as ZodUnion}from"../validators/union.js";export{VldUnknown as ZodMiniUnknown,VldUnknown as ZodUnknown}from"../validators/unknown.js";export{VldVoid as ZodMiniVoid,VldVoid as ZodVoid}from"../validators/void.js";export{VldXor as ZodMiniXor,VldXor as ZodXor}from"../validators/xor.js";export{b as base64Json,a as base64ToBytes,c as base64ToUint8Array,d as base64UrlToBytes,e as base64urlToBytes,f as bytesToUtf8,g as epochMillisToDate,h as epochSecondsToDate,i as hexLowerToBytes,j as hexToBytes,k as hexToUint8Array,l as invertCodec,m as isoDatetimeToDate,n as jsonCodec,o as jwtPayload,p as numberToBigInt,s as stringToBigInt,q as stringToBoolean,r as stringToHttpURL,t as stringToInt,u as stringToNumber,v as stringToURL,w as stringToUint8Array,x as uint8ArrayToBase64,y as uint8ArrayToBase64Url,z as uint8ArrayToHex,A as uint8ArrayToString,B as uriComponent,C as utf8ToBytes}from"../chunks/index-CkbfQQ4n.js";export{blue,bold,createTheme,cyan,dim,gray,green,grey,italic,magenta,default as pigment,red,strip,supportsColor,underline,vldTheme,white,yellow}from"../pigment.js";export{createEmitter,createEventBus,withEmitter}from"../compat/emitter.js";export{createVldKernel,definePlugin,getVldKernel,resetVldKernel,usePlugin}from"../kernel.js";export{flattenError,prettifyError,prettifyErrorColored,prettifyErrorPlain,treeifyError}from"../errors.js";export{getLocale,getMessages,getSupportedLocales,isLocaleLoaded,isLocaleSupported,registerLocale,setLocale}from"../locales/runtime.js";export{globalRegistry,registry}from"../registry.js";export{s as setLocaleAsync}from"../chunks/index-yjpbvFgw.js";function S(o){return Object.keys(o).filter(a=>o[a])}function M(o){return"string"==typeof o?o:o?.message||o?.error}const F=(o,a)=>o.pick(...S(a)),I=(o,a)=>o.omit(...S(a)),T=o=>o.partial(),U=o=>o.required(),D=(o,a)=>o.extend(a),L=(o,a)=>o.safeExtend(a),E=(o,a)=>a&&"function"==typeof a.parse?o.merge(a):o.extend(a),N=(o,a)=>o.catchall(a),O=(o,a)=>o.default("function"==typeof a?a():a),R=(o,a)=>{const r=M(a);return Z().min(o,r)},P=(o,a)=>{const r=M(a);return Z().max(o,r)};export{O as _default,N as catchall,D as extend,P as maximum,E as merge,R as minimum,Z as number,I as omit,T as partial,F as pick,U as required,L as safeExtend};
@@ -1,37 +1 @@
1
- import { VldBase, VLD_VALIDATOR_TYPES } from './base.js';
2
-
3
- /**
4
- * Validator that accepts any value
5
- */
6
- class VldAny extends VldBase {
7
- constructor() {
8
- super(VLD_VALIDATOR_TYPES.ANY);
9
- }
10
- /**
11
- * Create a new any validator
12
- */
13
- static create() {
14
- return new VldAny();
15
- }
16
- /**
17
- * Returns true because any accepts every input without checks.
18
- * Used by composite validators for passthrough fast paths.
19
- */
20
- get isSimple() {
21
- return true;
22
- }
23
- /**
24
- * Parse any value (always succeeds)
25
- */
26
- parse(value) {
27
- return value;
28
- }
29
- /**
30
- * Safely parse any value (always succeeds)
31
- */
32
- safeParse(value) {
33
- return { success: true, data: value };
34
- }
35
- }
36
-
37
- export { VldAny };
1
+ import{VldBase as e,VLD_VALIDATOR_TYPES as r}from"./base.js";class VldAny extends e{constructor(){super(r.ANY)}static create(){return new VldAny}get isSimple(){return!0}parse(e){return e}safeParse(e){return{success:!0,data:e}}}export{VldAny};
@@ -14,6 +14,8 @@ export declare class VldArray<T> extends VldBase<unknown[], T[]> {
14
14
  * Create a new array validator
15
15
  */
16
16
  static create<T>(itemValidator: VldBase<unknown, T>): VldArray<T>;
17
+ get element(): VldBase<unknown, T>;
18
+ unwrap(): VldBase<unknown, T>;
17
19
  /**
18
20
  * Parse and validate an array value
19
21
  */
@@ -28,6 +30,11 @@ export declare class VldArray<T> extends VldBase<unknown[], T[]> {
28
30
  * Safely parse and validate an array value
29
31
  */
30
32
  safeParse(value: unknown): ParseResult<T[]>;
33
+ encode(value: T[]): unknown[];
34
+ safeEncode(value: T[]): ParseResult<unknown[]>;
35
+ encodeAsync(value: T[]): Promise<unknown[]>;
36
+ safeEncodeAsync(value: T[]): Promise<ParseResult<unknown[]>>;
37
+ private validateEncodedArray;
31
38
  /**
32
39
  * Optimized uniqueness check using Map-based approach
33
40
  * Avoids repeated stableStringify calls by caching serialized values
@@ -1,279 +1 @@
1
- import { VldBase, VLD_VALIDATOR_TYPES } from './base.js';
2
- import { getMessages } from '../locales/runtime.js';
3
- import { V as VldError } from '../chunks/errors-core-BeiFUtZM.js';
4
-
5
- function createArrayError(message) {
6
- return new VldError([{ code: 'invalid_array', path: [], message }]);
7
- }
8
- /**
9
- * Immutable array validator with chainable methods
10
- */
11
- class VldArray extends VldBase {
12
- /**
13
- * Private constructor to enforce immutability
14
- */
15
- constructor(config) {
16
- super(VLD_VALIDATOR_TYPES.ARRAY);
17
- this.config = config;
18
- this._simpleItemMode = this.getSimpleItemMode(config.itemValidator);
19
- }
20
- getSimpleItemMode(itemValidator) {
21
- if (itemValidator.isSimple !== true) {
22
- return undefined;
23
- }
24
- switch (itemValidator.validatorType) {
25
- case VLD_VALIDATOR_TYPES.STRING:
26
- return 'string';
27
- case VLD_VALIDATOR_TYPES.NUMBER:
28
- return 'number';
29
- case VLD_VALIDATOR_TYPES.BOOLEAN:
30
- return 'boolean';
31
- default:
32
- return undefined;
33
- }
34
- }
35
- /**
36
- * Create a new array validator
37
- */
38
- static create(itemValidator) {
39
- return new VldArray({ itemValidator });
40
- }
41
- /**
42
- * Parse and validate an array value
43
- */
44
- parse(value) {
45
- if (!Array.isArray(value)) {
46
- throw new Error(this.config.errorMessage || getMessages().invalidArray);
47
- }
48
- return this.parseArrayValue(value);
49
- }
50
- /**
51
- * Parse a value that has already passed the array type guard.
52
- * @internal Used by object validators to avoid duplicate hot-path checks.
53
- */
54
- parseKnownArray(value) {
55
- return this.parseArrayValue(value);
56
- }
57
- parseArrayValue(value) {
58
- // Validate length constraints
59
- if (this.config.exactLength !== undefined && value.length !== this.config.exactLength) {
60
- throw new Error(this.config.errorMessage || getMessages().arrayLength(this.config.exactLength));
61
- }
62
- if (this.config.minLength !== undefined && value.length < this.config.minLength) {
63
- throw new Error(this.config.errorMessage || getMessages().arrayMin(this.config.minLength));
64
- }
65
- if (this.config.maxLength !== undefined && value.length > this.config.maxLength) {
66
- throw new Error(this.config.errorMessage || getMessages().arrayMax(this.config.maxLength));
67
- }
68
- const length = value.length;
69
- const result = new Array(length);
70
- const simpleItemMode = this._simpleItemMode;
71
- if (simpleItemMode !== undefined) {
72
- for (let i = 0; i < length; i++) {
73
- const item = value[i];
74
- switch (simpleItemMode) {
75
- case 'string':
76
- if (typeof item !== 'string') {
77
- throw new Error(getMessages().arrayItem(i, getMessages().invalidString));
78
- }
79
- result[i] = item;
80
- break;
81
- case 'number':
82
- if (typeof item !== 'number' || isNaN(item)) {
83
- throw new Error(getMessages().arrayItem(i, getMessages().invalidNumber));
84
- }
85
- result[i] = item;
86
- break;
87
- case 'boolean':
88
- if (typeof item !== 'boolean') {
89
- throw new Error(getMessages().arrayItem(i, getMessages().invalidBoolean));
90
- }
91
- result[i] = item;
92
- break;
93
- }
94
- }
95
- if (this.config.unique) {
96
- this.checkUnique(result);
97
- }
98
- return result;
99
- }
100
- // Validate each item without allocating a ParseResult object per element.
101
- for (let i = 0; i < length; i++) {
102
- try {
103
- result[i] = this.config.itemValidator.parse(value[i]);
104
- }
105
- catch (error) {
106
- const message = error instanceof Error ? error.message : String(error);
107
- throw new Error(getMessages().arrayItem(i, message));
108
- }
109
- }
110
- // Check uniqueness if required - optimized with Map-based approach
111
- if (this.config.unique) {
112
- this.checkUnique(result);
113
- }
114
- return result;
115
- }
116
- /**
117
- * Safely parse and validate an array value
118
- */
119
- safeParse(value) {
120
- try {
121
- return { success: true, data: this.parse(value) };
122
- }
123
- catch (error) {
124
- return { success: false, error: createArrayError(error.message) };
125
- }
126
- }
127
- /**
128
- * Optimized uniqueness check using Map-based approach
129
- * Avoids repeated stableStringify calls by caching serialized values
130
- */
131
- checkUnique(items) {
132
- const seen = new Set(); // Set of seen keys
133
- const objectKeys = new WeakMap(); // Cache for object->string mappings
134
- for (const item of items) {
135
- let key;
136
- if (typeof item === 'object' && item !== null) {
137
- // Check if we've already serialized this object reference
138
- const cached = objectKeys.get(item);
139
- if (cached !== undefined) {
140
- key = cached;
141
- }
142
- else {
143
- // Serialize and cache
144
- const serialized = this.stableStringify(item);
145
- key = serialized;
146
- objectKeys.set(item, serialized);
147
- }
148
- }
149
- else {
150
- // Primitives can be used directly as keys
151
- key = item;
152
- }
153
- if (seen.has(key)) {
154
- throw new Error('Array must contain unique items');
155
- }
156
- seen.add(key);
157
- }
158
- }
159
- /**
160
- * Create a stable string representation of an object for hashing
161
- * Handles circular references and deep nesting gracefully
162
- * BUG-006 FIX: Added depth limit to prevent stack overflow
163
- * BUG-NEW-003 FIX: Fixed depth tracking to properly track recursion depth
164
- */
165
- stableStringify(obj) {
166
- const seen = new WeakSet();
167
- const MAX_DEPTH = 100; // Reasonable depth limit to prevent stack overflow
168
- // Helper function to sort keys and create stable representation
169
- const sortedStringify = (value, depth = 0) => {
170
- // Check depth limit
171
- if (depth > MAX_DEPTH) {
172
- return '"[Max Depth Exceeded]"';
173
- }
174
- // Handle primitives
175
- if (value === null)
176
- return 'null';
177
- if (value === undefined)
178
- return 'undefined';
179
- if (typeof value !== 'object')
180
- return JSON.stringify(value);
181
- // Handle circular references
182
- if (seen.has(value)) {
183
- return '"[Circular]"';
184
- }
185
- seen.add(value);
186
- try {
187
- // Handle arrays
188
- if (Array.isArray(value)) {
189
- const items = value.map(item => sortedStringify(item, depth + 1));
190
- return `[${items.join(',')}]`;
191
- }
192
- // Handle objects - sort keys for stability
193
- const keys = Object.keys(value).sort();
194
- const pairs = keys.map(key => {
195
- const serializedKey = JSON.stringify(key);
196
- const serializedValue = sortedStringify(value[key], depth + 1);
197
- return `${serializedKey}:${serializedValue}`;
198
- });
199
- return `{${pairs.join(',')}}`;
200
- }
201
- finally {
202
- // Clean up seen set for this branch
203
- seen.delete(value);
204
- }
205
- };
206
- try {
207
- return sortedStringify(obj);
208
- }
209
- catch {
210
- // Fallback to safe representation if stringify fails
211
- return String(obj);
212
- }
213
- }
214
- /**
215
- * Create a new validator with minimum length constraint
216
- */
217
- min(length, message) {
218
- return new VldArray({
219
- ...this.config,
220
- minLength: length,
221
- errorMessage: message || getMessages().arrayMin(length)
222
- });
223
- }
224
- /**
225
- * Create a new validator with maximum length constraint
226
- */
227
- max(length, message) {
228
- return new VldArray({
229
- ...this.config,
230
- maxLength: length,
231
- errorMessage: message || getMessages().arrayMax(length)
232
- });
233
- }
234
- /**
235
- * Create a new validator with exact length constraint
236
- */
237
- length(length, message) {
238
- return new VldArray({
239
- ...this.config,
240
- exactLength: length,
241
- minLength: undefined,
242
- maxLength: undefined,
243
- errorMessage: message || getMessages().arrayLength(length)
244
- });
245
- }
246
- /**
247
- * Create a new validator that ensures array is not empty
248
- */
249
- nonempty(message) {
250
- return new VldArray({
251
- ...this.config,
252
- minLength: 1,
253
- errorMessage: message || getMessages().arrayEmpty
254
- });
255
- }
256
- /**
257
- * Create a new validator that ensures array contains unique items
258
- */
259
- unique(message) {
260
- return new VldArray({
261
- ...this.config,
262
- unique: true,
263
- errorMessage: message || 'Array must contain unique items'
264
- });
265
- }
266
- /**
267
- * Create a new validator with a range constraint for length
268
- */
269
- between(min, max, message) {
270
- return new VldArray({
271
- ...this.config,
272
- minLength: min,
273
- maxLength: max,
274
- errorMessage: message || `Array length must be between ${min} and ${max}`
275
- });
276
- }
277
- }
278
-
279
- export { VldArray };
1
+ import{VldBase as e,VLD_VALIDATOR_TYPES as r}from"./base.js";import{getMessages as t}from"../locales/runtime.js";import{V as n,c as i,g as a}from"../chunks/errors-core-CerMg2rq.js";function s(e){return new n([{code:"invalid_array",path:[],message:e}])}function o(e,r){return new n([{code:"too_small",path:[],origin:"array",minimum:e,inclusive:!0,message:r}])}class VldArray extends e{constructor(e){super(r.ARRAY),this.config=e,this._simpleItemMode=this.getSimpleItemMode(e.itemValidator)}getSimpleItemMode(e){if(!0===e.isSimple)switch(e.validatorType){case r.STRING:return"string";case r.NUMBER:return"number";case r.BOOLEAN:return"boolean";default:return}}static create(e){return new VldArray({itemValidator:e})}get element(){return this.config.itemValidator}unwrap(){return this.config.itemValidator}parse(e){if(!Array.isArray(e)){const r=this.config.errorMessage||t().invalidArray;throw new n([i("array",a(e),r)])}return this.parseArrayValue(e)}parseKnownArray(e){return this.parseArrayValue(e)}parseArrayValue(e){if(void 0!==this.config.exactLength&&e.length!==this.config.exactLength)throw o(this.config.exactLength,this.config.errorMessage||t().arrayLength(this.config.exactLength));if(void 0!==this.config.minLength&&e.length<this.config.minLength)throw o(this.config.minLength,this.config.errorMessage||t().arrayMin(this.config.minLength));if(void 0!==this.config.maxLength&&e.length>this.config.maxLength)throw r=this.config.maxLength,i=this.config.errorMessage||t().arrayMax(this.config.maxLength),new n([{code:"too_big",path:[],origin:"array",maximum:r,inclusive:!0,message:i}]);var r,i;const a=e.length,s=new Array(a),c=this._simpleItemMode;if(void 0!==c){for(let r=0;r<a;r++){const n=e[r];switch(c){case"string":if("string"!=typeof n)throw new Error(t().arrayItem(r,t().invalidString));s[r]=n;break;case"number":if("number"!=typeof n||isNaN(n))throw new Error(t().arrayItem(r,t().invalidNumber));s[r]=n;break;case"boolean":if("boolean"!=typeof n)throw new Error(t().arrayItem(r,t().invalidBoolean));s[r]=n}}return this.config.unique&&this.checkUnique(s),s}for(let r=0;r<a;r++)try{s[r]=this.config.itemValidator.parse(e[r])}catch(e){const n=e instanceof Error?e.message:String(e);throw new Error(t().arrayItem(r,n))}return this.config.unique&&this.checkUnique(s),s}safeParse(e){try{return{success:!0,data:this.parse(e)}}catch(e){return e instanceof n?{success:!1,error:e}:{success:!1,error:s(e.message)}}}encode(e){this.validateEncodedArray(e);const r=new Array(e.length);for(let t=0;t<e.length;t++)r[t]=this.config.itemValidator.encode(e[t]);return r}safeEncode(e){try{return{success:!0,data:this.encode(e)}}catch(e){return{success:!1,error:s(e.message)}}}async encodeAsync(e){this.validateEncodedArray(e);const r=new Array(e.length);for(let t=0;t<e.length;t++)r[t]=await this.config.itemValidator.encodeAsync(e[t]);return r}async safeEncodeAsync(e){try{return{success:!0,data:await this.encodeAsync(e)}}catch(e){return{success:!1,error:s(e.message)}}}validateEncodedArray(e){if(!Array.isArray(e))throw new Error(this.config.errorMessage||t().invalidArray);if(void 0!==this.config.exactLength&&e.length!==this.config.exactLength)throw new Error(this.config.errorMessage);if(void 0!==this.config.minLength&&e.length<this.config.minLength)throw new Error(this.config.errorMessage);if(void 0!==this.config.maxLength&&e.length>this.config.maxLength)throw new Error(this.config.errorMessage);this.config.unique&&this.checkUnique(e)}checkUnique(e){const r=new Set,t=new WeakMap;for(const n of e){let e;if("object"==typeof n&&null!==n){const r=t.get(n);if(void 0!==r)e=r;else{const r=this.stableStringify(n);e=r,t.set(n,r)}}else e=n;if(r.has(e))throw new Error("Array must contain unique items");r.add(e)}}stableStringify(e){const r=new WeakSet,t=(e,n=0)=>{if(n>100)return'"[Max Depth Exceeded]"';if(null===e)return"null";if(void 0===e)return"undefined";if("object"!=typeof e)return JSON.stringify(e);if(r.has(e))return'"[Circular]"';r.add(e);try{if(Array.isArray(e)){return`[${e.map(e=>t(e,n+1)).join(",")}]`}const r=Object.keys(e).sort();return`{${r.map(r=>`${JSON.stringify(r)}:${t(e[r],n+1)}`).join(",")}}`}finally{r.delete(e)}};try{return t(e)}catch{return String(e)}}min(e,r){return new VldArray({...this.config,minLength:e,errorMessage:r||t().arrayMin(e)})}max(e,r){return new VldArray({...this.config,maxLength:e,errorMessage:r||t().arrayMax(e)})}length(e,r){return new VldArray({...this.config,exactLength:e,minLength:void 0,maxLength:void 0,errorMessage:r||t().arrayLength(e)})}nonempty(e){return new VldArray({...this.config,minLength:1,errorMessage:e||t().arrayEmpty})}unique(e){return new VldArray({...this.config,unique:!0,errorMessage:e||"Array must contain unique items"})}between(e,r,t){return new VldArray({...this.config,minLength:e,maxLength:r,errorMessage:t||`Array length must be between ${e} and ${r}`})}}export{VldArray};