@oxog/vld 2.0.3 → 2.2.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (452) hide show
  1. package/CHANGELOG.md +120 -1
  2. package/README.md +1296 -1171
  3. package/dist/chunks/errors-core-Cqi4-9ew.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-DKPohm9I.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 +2 -0
  14. package/dist/cjs/cli/index.cjs +1 -0
  15. package/dist/cjs/codecs/index.cjs +1 -0
  16. package/dist/cjs/coercion/index.cjs +1 -0
  17. package/dist/cjs/compat/emitter.cjs +1 -0
  18. package/dist/cjs/compat/result.cjs +1 -0
  19. package/dist/cjs/errors.cjs +1 -387
  20. package/dist/cjs/index.cjs +1 -10759
  21. package/dist/cjs/kernel.cjs +1 -0
  22. package/dist/cjs/locales/af.cjs +1 -0
  23. package/dist/cjs/locales/ar.cjs +1 -0
  24. package/dist/cjs/locales/bn.cjs +1 -0
  25. package/dist/cjs/locales/da.cjs +1 -0
  26. package/dist/cjs/locales/de.cjs +1 -0
  27. package/dist/cjs/locales/en.cjs +1 -0
  28. package/dist/cjs/locales/es-MX.cjs +1 -0
  29. package/dist/cjs/locales/es.cjs +1 -0
  30. package/dist/cjs/locales/fi.cjs +1 -0
  31. package/dist/cjs/locales/fr.cjs +1 -0
  32. package/dist/cjs/locales/hi.cjs +1 -0
  33. package/dist/cjs/locales/id.cjs +1 -0
  34. package/dist/cjs/locales/index.cjs +1 -2877
  35. package/dist/cjs/locales/it.cjs +1 -0
  36. package/dist/cjs/locales/ja.cjs +1 -0
  37. package/dist/cjs/locales/ko.cjs +1 -0
  38. package/dist/cjs/locales/lazy.cjs +1 -3169
  39. package/dist/cjs/locales/nl.cjs +1 -0
  40. package/dist/cjs/locales/no.cjs +1 -0
  41. package/dist/cjs/locales/pl.cjs +1 -0
  42. package/dist/cjs/locales/pt-BR.cjs +1 -0
  43. package/dist/cjs/locales/pt.cjs +1 -0
  44. package/dist/cjs/locales/ru.cjs +1 -0
  45. package/dist/cjs/locales/runtime.cjs +1 -0
  46. package/dist/cjs/locales/sv.cjs +1 -0
  47. package/dist/cjs/locales/sw.cjs +1 -0
  48. package/dist/cjs/locales/th.cjs +1 -0
  49. package/dist/cjs/locales/tr.cjs +1 -0
  50. package/dist/cjs/locales/vi.cjs +1 -0
  51. package/dist/cjs/locales/zh.cjs +1 -0
  52. package/dist/cjs/mini.cjs +1 -7474
  53. package/dist/cjs/pigment.cjs +1 -0
  54. package/dist/cjs/plugins/index.cjs +1 -0
  55. package/dist/cjs/registry.cjs +1 -0
  56. package/dist/cjs/v3/index.cjs +1 -0
  57. package/dist/cjs/v4/core/index.cjs +1 -0
  58. package/dist/cjs/v4/index.cjs +1 -0
  59. package/dist/cjs/v4/locales/index.cjs +1 -0
  60. package/dist/cjs/v4/mini/index.cjs +1 -0
  61. package/dist/cjs/v4-mini/index.cjs +1 -0
  62. package/dist/cjs/validators/any.cjs +1 -0
  63. package/dist/cjs/validators/array.cjs +1 -0
  64. package/dist/cjs/validators/base.cjs +1 -0
  65. package/dist/cjs/validators/base64.cjs +1 -0
  66. package/dist/cjs/validators/bigint.cjs +1 -0
  67. package/dist/cjs/validators/boolean.cjs +1 -0
  68. package/dist/cjs/validators/codec.cjs +1 -0
  69. package/dist/cjs/validators/custom.cjs +1 -0
  70. package/dist/cjs/validators/date.cjs +1 -0
  71. package/dist/cjs/validators/discriminated-union.cjs +1 -0
  72. package/dist/cjs/validators/enum.cjs +1 -0
  73. package/dist/cjs/validators/file.cjs +1 -0
  74. package/dist/cjs/validators/function.cjs +1 -0
  75. package/dist/cjs/validators/hex.cjs +1 -0
  76. package/dist/cjs/validators/index.cjs +1 -0
  77. package/dist/cjs/validators/intersection.cjs +1 -0
  78. package/dist/cjs/validators/json.cjs +1 -0
  79. package/dist/cjs/validators/lazy.cjs +1 -0
  80. package/dist/cjs/validators/literal.cjs +1 -0
  81. package/dist/cjs/validators/map.cjs +1 -0
  82. package/dist/cjs/validators/nan.cjs +1 -0
  83. package/dist/cjs/validators/never.cjs +1 -0
  84. package/dist/cjs/validators/null.cjs +1 -0
  85. package/dist/cjs/validators/number.cjs +1 -0
  86. package/dist/cjs/validators/object.cjs +1 -0
  87. package/dist/cjs/validators/promise.cjs +1 -0
  88. package/dist/cjs/validators/record.cjs +1 -0
  89. package/dist/cjs/validators/set.cjs +1 -0
  90. package/dist/cjs/validators/string-bool.cjs +1 -0
  91. package/dist/cjs/validators/string-formats.cjs +1 -0
  92. package/dist/cjs/validators/string.cjs +1 -0
  93. package/dist/cjs/validators/symbol.cjs +1 -0
  94. package/dist/cjs/validators/template-literal.cjs +1 -0
  95. package/dist/cjs/validators/tuple.cjs +1 -0
  96. package/dist/cjs/validators/uint8array.cjs +1 -0
  97. package/dist/cjs/validators/undefined.cjs +1 -0
  98. package/dist/cjs/validators/union.cjs +1 -0
  99. package/dist/cjs/validators/unknown.cjs +1 -0
  100. package/dist/cjs/validators/void.cjs +1 -0
  101. package/dist/cjs/validators/xor.cjs +1 -0
  102. package/dist/cli/bin.d.ts +0 -1
  103. package/dist/cli/bin.js +2 -0
  104. package/dist/cli/commands/benchmark.d.ts +1 -2
  105. package/dist/cli/commands/validate.d.ts +1 -2
  106. package/dist/cli/index.d.ts +0 -1
  107. package/dist/cli/index.js +1 -0
  108. package/dist/codecs/index.d.ts +21 -4
  109. package/dist/codecs/index.js +1 -4
  110. package/dist/coercion/bigint.d.ts +2 -3
  111. package/dist/coercion/boolean.d.ts +3 -3
  112. package/dist/coercion/date.d.ts +3 -3
  113. package/dist/coercion/index.d.ts +5 -6
  114. package/dist/coercion/index.js +1 -111
  115. package/dist/coercion/number.d.ts +2 -3
  116. package/dist/coercion/string.d.ts +2 -3
  117. package/dist/compat/emitter.d.ts +0 -1
  118. package/dist/compat/emitter.js +1 -181
  119. package/dist/compat/index.d.ts +4 -5
  120. package/dist/compat/result.d.ts +1 -2
  121. package/dist/compat/result.js +1 -171
  122. package/dist/errors-core.d.ts +58 -0
  123. package/dist/errors.d.ts +4 -54
  124. package/dist/errors.js +1 -235
  125. package/dist/events.d.ts +3 -4
  126. package/dist/index.d.ts +1093 -851
  127. package/dist/index.js +1 -855
  128. package/dist/kernel.d.ts +2 -3
  129. package/dist/kernel.js +1 -405
  130. package/dist/locales/af.d.ts +1 -2
  131. package/dist/locales/af.js +1 -107
  132. package/dist/locales/ar.d.ts +1 -2
  133. package/dist/locales/ar.js +1 -107
  134. package/dist/locales/bn.d.ts +1 -2
  135. package/dist/locales/bn.js +1 -107
  136. package/dist/locales/da.d.ts +1 -2
  137. package/dist/locales/da.js +1 -107
  138. package/dist/locales/de.d.ts +1 -2
  139. package/dist/locales/de.js +1 -107
  140. package/dist/locales/en.d.ts +1 -2
  141. package/dist/locales/en.js +1 -107
  142. package/dist/locales/es-MX.d.ts +1 -2
  143. package/dist/locales/es-MX.js +1 -106
  144. package/dist/locales/es.d.ts +1 -2
  145. package/dist/locales/es.js +1 -95
  146. package/dist/locales/fi.d.ts +1 -2
  147. package/dist/locales/fi.js +1 -107
  148. package/dist/locales/fr.d.ts +1 -2
  149. package/dist/locales/fr.js +1 -95
  150. package/dist/locales/hi.d.ts +1 -2
  151. package/dist/locales/hi.js +1 -107
  152. package/dist/locales/id.d.ts +1 -2
  153. package/dist/locales/id.js +1 -107
  154. package/dist/locales/index.d.ts +10 -15
  155. package/dist/locales/index.js +1 -3
  156. package/dist/locales/it.d.ts +1 -2
  157. package/dist/locales/it.js +1 -107
  158. package/dist/locales/ja.d.ts +1 -2
  159. package/dist/locales/ja.js +1 -107
  160. package/dist/locales/ko.d.ts +1 -2
  161. package/dist/locales/ko.js +1 -107
  162. package/dist/locales/lazy.d.ts +4 -26
  163. package/dist/locales/lazy.js +1 -220
  164. package/dist/locales/nl.d.ts +1 -2
  165. package/dist/locales/nl.js +1 -107
  166. package/dist/locales/no.d.ts +1 -2
  167. package/dist/locales/no.js +1 -107
  168. package/dist/locales/pl.d.ts +1 -2
  169. package/dist/locales/pl.js +1 -107
  170. package/dist/locales/pt-BR.d.ts +1 -2
  171. package/dist/locales/pt-BR.js +1 -107
  172. package/dist/locales/pt.d.ts +1 -2
  173. package/dist/locales/pt.js +1 -107
  174. package/dist/locales/ru.d.ts +1 -2
  175. package/dist/locales/ru.js +1 -107
  176. package/dist/locales/runtime.d.ts +10 -0
  177. package/dist/locales/runtime.js +1 -0
  178. package/dist/locales/sv.d.ts +1 -2
  179. package/dist/locales/sv.js +1 -107
  180. package/dist/locales/sw.d.ts +1 -2
  181. package/dist/locales/sw.js +1 -107
  182. package/dist/locales/th.d.ts +1 -2
  183. package/dist/locales/th.js +1 -107
  184. package/dist/locales/tr.d.ts +1 -2
  185. package/dist/locales/tr.js +1 -107
  186. package/dist/locales/types.d.ts +0 -1
  187. package/dist/locales/vi.d.ts +1 -2
  188. package/dist/locales/vi.js +1 -107
  189. package/dist/locales/zh.d.ts +1 -2
  190. package/dist/locales/zh.js +1 -107
  191. package/dist/logger.d.ts +0 -1
  192. package/dist/mini.d.ts +67 -68
  193. package/dist/mini.js +1 -132
  194. package/dist/pigment.d.ts +0 -1
  195. package/dist/pigment.js +1 -178
  196. package/dist/plugins/index.d.ts +2 -3
  197. package/dist/plugins/index.js +1 -0
  198. package/dist/plugins/types.d.ts +4 -5
  199. package/dist/registry.d.ts +23 -0
  200. package/dist/registry.js +1 -0
  201. package/dist/utils/codec-utils.d.ts +0 -1
  202. package/dist/utils/deep-merge.d.ts +0 -1
  203. package/dist/utils/ip-validation.d.ts +0 -1
  204. package/dist/utils/json-schema.d.ts +26 -7
  205. package/dist/utils/security.d.ts +2 -6
  206. package/dist/v3/index.d.ts +2 -0
  207. package/dist/v3/index.js +1 -0
  208. package/dist/v4/core/index.d.ts +272 -0
  209. package/dist/v4/core/index.js +1 -0
  210. package/dist/v4/index.d.ts +4 -0
  211. package/dist/v4/index.js +1 -0
  212. package/dist/v4/locales/index.d.ts +57 -0
  213. package/dist/v4/locales/index.js +1 -0
  214. package/dist/v4/mini/index.d.ts +2 -0
  215. package/dist/v4/mini/index.js +1 -0
  216. package/dist/v4-mini/index.d.ts +22 -0
  217. package/dist/v4-mini/index.js +1 -0
  218. package/dist/validators/any.d.ts +7 -2
  219. package/dist/validators/any.js +1 -0
  220. package/dist/validators/array.d.ts +16 -2
  221. package/dist/validators/array.js +1 -0
  222. package/dist/validators/base.d.ts +213 -14
  223. package/dist/validators/base.js +1 -0
  224. package/dist/validators/base64.d.ts +1 -2
  225. package/dist/validators/base64.js +1 -0
  226. package/dist/validators/bigint.d.ts +21 -3
  227. package/dist/validators/bigint.js +1 -0
  228. package/dist/validators/boolean.d.ts +13 -4
  229. package/dist/validators/boolean.js +1 -0
  230. package/dist/validators/codec.d.ts +9 -2
  231. package/dist/validators/codec.js +1 -0
  232. package/dist/validators/custom.d.ts +15 -2
  233. package/dist/validators/custom.js +1 -0
  234. package/dist/validators/date.d.ts +19 -3
  235. package/dist/validators/date.js +1 -0
  236. package/dist/validators/discriminated-union.d.ts +6 -5
  237. package/dist/validators/discriminated-union.js +1 -0
  238. package/dist/validators/enum.d.ts +10 -7
  239. package/dist/validators/enum.js +1 -0
  240. package/dist/validators/file.d.ts +7 -2
  241. package/dist/validators/file.js +1 -0
  242. package/dist/validators/function.d.ts +11 -5
  243. package/dist/validators/function.js +1 -0
  244. package/dist/validators/hex.d.ts +1 -2
  245. package/dist/validators/hex.js +1 -0
  246. package/dist/validators/index.d.ts +38 -39
  247. package/dist/validators/index.js +1 -515
  248. package/dist/validators/intersection.d.ts +1 -2
  249. package/dist/validators/intersection.js +1 -0
  250. package/dist/validators/json.d.ts +1 -2
  251. package/dist/validators/json.js +1 -0
  252. package/dist/validators/lazy.d.ts +5 -9
  253. package/dist/validators/lazy.js +1 -0
  254. package/dist/validators/literal.d.ts +9 -5
  255. package/dist/validators/literal.js +1 -0
  256. package/dist/validators/map.d.ts +15 -2
  257. package/dist/validators/map.js +1 -0
  258. package/dist/validators/nan.d.ts +2 -3
  259. package/dist/validators/nan.js +1 -0
  260. package/dist/validators/never.d.ts +1 -2
  261. package/dist/validators/never.js +1 -0
  262. package/dist/validators/null.d.ts +3 -3
  263. package/dist/validators/null.js +1 -0
  264. package/dist/validators/number.d.ts +75 -27
  265. package/dist/validators/number.js +1 -0
  266. package/dist/validators/object.d.ts +42 -11
  267. package/dist/validators/object.js +1 -0
  268. package/dist/validators/promise.d.ts +15 -10
  269. package/dist/validators/promise.js +1 -0
  270. package/dist/validators/record.d.ts +21 -9
  271. package/dist/validators/record.js +1 -0
  272. package/dist/validators/set.d.ts +11 -2
  273. package/dist/validators/set.js +1 -0
  274. package/dist/validators/string-bool.d.ts +7 -10
  275. package/dist/validators/string-bool.js +1 -0
  276. package/dist/validators/string-formats.d.ts +64 -65
  277. package/dist/validators/string-formats.js +1 -0
  278. package/dist/validators/string.d.ts +84 -26
  279. package/dist/validators/string.js +1 -0
  280. package/dist/validators/symbol.d.ts +8 -3
  281. package/dist/validators/symbol.js +1 -0
  282. package/dist/validators/template-literal.d.ts +1 -2
  283. package/dist/validators/template-literal.js +1 -0
  284. package/dist/validators/tuple.d.ts +29 -12
  285. package/dist/validators/tuple.js +1 -0
  286. package/dist/validators/uint8array.d.ts +3 -4
  287. package/dist/validators/uint8array.js +1 -0
  288. package/dist/validators/undefined.d.ts +3 -3
  289. package/dist/validators/undefined.js +1 -0
  290. package/dist/validators/union.d.ts +7 -4
  291. package/dist/validators/union.js +1 -0
  292. package/dist/validators/unknown.d.ts +7 -2
  293. package/dist/validators/unknown.js +1 -0
  294. package/dist/validators/void.d.ts +3 -2
  295. package/dist/validators/void.js +1 -0
  296. package/dist/validators/xor.d.ts +4 -5
  297. package/dist/validators/xor.js +1 -0
  298. package/package.json +239 -154
  299. package/dist/chunks/bigint-CRS0QVsy.js +0 -1854
  300. package/dist/chunks/bigint-CRS0QVsy.js.map +0 -1
  301. package/dist/chunks/date-50JV_Mfj.js +0 -506
  302. package/dist/chunks/date-50JV_Mfj.js.map +0 -1
  303. package/dist/chunks/index-DO8CFMxD.js +0 -894
  304. package/dist/chunks/index-DO8CFMxD.js.map +0 -1
  305. package/dist/chunks/json-Cp4WO0M9.js +0 -2021
  306. package/dist/chunks/json-Cp4WO0M9.js.map +0 -1
  307. package/dist/chunks/unknown-Dhzri_T-.js +0 -28
  308. package/dist/chunks/unknown-Dhzri_T-.js.map +0 -1
  309. package/dist/cjs/errors.cjs.map +0 -1
  310. package/dist/cjs/index.cjs.map +0 -1
  311. package/dist/cjs/locales/index.cjs.map +0 -1
  312. package/dist/cjs/locales/lazy.cjs.map +0 -1
  313. package/dist/cjs/mini.cjs.map +0 -1
  314. package/dist/cli/bin.d.ts.map +0 -1
  315. package/dist/cli/commands/benchmark.d.ts.map +0 -1
  316. package/dist/cli/commands/validate.d.ts.map +0 -1
  317. package/dist/cli/index.d.ts.map +0 -1
  318. package/dist/codecs/index.d.ts.map +0 -1
  319. package/dist/codecs/index.js.map +0 -1
  320. package/dist/coercion/bigint.d.ts.map +0 -1
  321. package/dist/coercion/boolean.d.ts.map +0 -1
  322. package/dist/coercion/date.d.ts.map +0 -1
  323. package/dist/coercion/index.d.ts.map +0 -1
  324. package/dist/coercion/index.js.map +0 -1
  325. package/dist/coercion/number.d.ts.map +0 -1
  326. package/dist/coercion/string.d.ts.map +0 -1
  327. package/dist/compat/emitter.d.ts.map +0 -1
  328. package/dist/compat/emitter.js.map +0 -1
  329. package/dist/compat/index.d.ts.map +0 -1
  330. package/dist/compat/result.d.ts.map +0 -1
  331. package/dist/compat/result.js.map +0 -1
  332. package/dist/errors.d.ts.map +0 -1
  333. package/dist/errors.js.map +0 -1
  334. package/dist/events.d.ts.map +0 -1
  335. package/dist/index.d.ts.map +0 -1
  336. package/dist/index.js.map +0 -1
  337. package/dist/kernel.d.ts.map +0 -1
  338. package/dist/kernel.js.map +0 -1
  339. package/dist/locales/af.d.ts.map +0 -1
  340. package/dist/locales/af.js.map +0 -1
  341. package/dist/locales/ar.d.ts.map +0 -1
  342. package/dist/locales/ar.js.map +0 -1
  343. package/dist/locales/backup-en.d.ts +0 -3
  344. package/dist/locales/backup-en.d.ts.map +0 -1
  345. package/dist/locales/bn.d.ts.map +0 -1
  346. package/dist/locales/bn.js.map +0 -1
  347. package/dist/locales/da.d.ts.map +0 -1
  348. package/dist/locales/da.js.map +0 -1
  349. package/dist/locales/de.d.ts.map +0 -1
  350. package/dist/locales/de.js.map +0 -1
  351. package/dist/locales/en.d.ts.map +0 -1
  352. package/dist/locales/en.js.map +0 -1
  353. package/dist/locales/es-MX.d.ts.map +0 -1
  354. package/dist/locales/es-MX.js.map +0 -1
  355. package/dist/locales/es.d.ts.map +0 -1
  356. package/dist/locales/es.js.map +0 -1
  357. package/dist/locales/fi.d.ts.map +0 -1
  358. package/dist/locales/fi.js.map +0 -1
  359. package/dist/locales/fr.d.ts.map +0 -1
  360. package/dist/locales/fr.js.map +0 -1
  361. package/dist/locales/hi.d.ts.map +0 -1
  362. package/dist/locales/hi.js.map +0 -1
  363. package/dist/locales/id.d.ts.map +0 -1
  364. package/dist/locales/id.js.map +0 -1
  365. package/dist/locales/index.d.ts.map +0 -1
  366. package/dist/locales/index.js.map +0 -1
  367. package/dist/locales/it.d.ts.map +0 -1
  368. package/dist/locales/it.js.map +0 -1
  369. package/dist/locales/ja.d.ts.map +0 -1
  370. package/dist/locales/ja.js.map +0 -1
  371. package/dist/locales/ko.d.ts.map +0 -1
  372. package/dist/locales/ko.js.map +0 -1
  373. package/dist/locales/lazy.d.ts.map +0 -1
  374. package/dist/locales/lazy.js.map +0 -1
  375. package/dist/locales/nl.d.ts.map +0 -1
  376. package/dist/locales/nl.js.map +0 -1
  377. package/dist/locales/no.d.ts.map +0 -1
  378. package/dist/locales/no.js.map +0 -1
  379. package/dist/locales/pl.d.ts.map +0 -1
  380. package/dist/locales/pl.js.map +0 -1
  381. package/dist/locales/pt-BR.d.ts.map +0 -1
  382. package/dist/locales/pt-BR.js.map +0 -1
  383. package/dist/locales/pt.d.ts.map +0 -1
  384. package/dist/locales/pt.js.map +0 -1
  385. package/dist/locales/ru.d.ts.map +0 -1
  386. package/dist/locales/ru.js.map +0 -1
  387. package/dist/locales/sv.d.ts.map +0 -1
  388. package/dist/locales/sv.js.map +0 -1
  389. package/dist/locales/sw.d.ts.map +0 -1
  390. package/dist/locales/sw.js.map +0 -1
  391. package/dist/locales/th.d.ts.map +0 -1
  392. package/dist/locales/th.js.map +0 -1
  393. package/dist/locales/tr.d.ts.map +0 -1
  394. package/dist/locales/tr.js.map +0 -1
  395. package/dist/locales/types.d.ts.map +0 -1
  396. package/dist/locales/vi.d.ts.map +0 -1
  397. package/dist/locales/vi.js.map +0 -1
  398. package/dist/locales/zh.d.ts.map +0 -1
  399. package/dist/locales/zh.js.map +0 -1
  400. package/dist/logger.d.ts.map +0 -1
  401. package/dist/mini.d.ts.map +0 -1
  402. package/dist/mini.js.map +0 -1
  403. package/dist/pigment.d.ts.map +0 -1
  404. package/dist/pigment.js.map +0 -1
  405. package/dist/plugins/index.d.ts.map +0 -1
  406. package/dist/plugins/types.d.ts.map +0 -1
  407. package/dist/utils/codec-utils.d.ts.map +0 -1
  408. package/dist/utils/deep-merge.d.ts.map +0 -1
  409. package/dist/utils/ip-validation.d.ts.map +0 -1
  410. package/dist/utils/json-schema.d.ts.map +0 -1
  411. package/dist/utils/security.d.ts.map +0 -1
  412. package/dist/validators/any.d.ts.map +0 -1
  413. package/dist/validators/array.d.ts.map +0 -1
  414. package/dist/validators/base.d.ts.map +0 -1
  415. package/dist/validators/base64.d.ts.map +0 -1
  416. package/dist/validators/bigint.d.ts.map +0 -1
  417. package/dist/validators/boolean.d.ts.map +0 -1
  418. package/dist/validators/codec.d.ts.map +0 -1
  419. package/dist/validators/custom.d.ts.map +0 -1
  420. package/dist/validators/date.d.ts.map +0 -1
  421. package/dist/validators/discriminated-union.d.ts.map +0 -1
  422. package/dist/validators/enum.d.ts.map +0 -1
  423. package/dist/validators/file.d.ts.map +0 -1
  424. package/dist/validators/function.d.ts.map +0 -1
  425. package/dist/validators/hex.d.ts.map +0 -1
  426. package/dist/validators/index.d.ts.map +0 -1
  427. package/dist/validators/index.js.map +0 -1
  428. package/dist/validators/intersection.d.ts.map +0 -1
  429. package/dist/validators/json.d.ts.map +0 -1
  430. package/dist/validators/lazy.d.ts.map +0 -1
  431. package/dist/validators/literal.d.ts.map +0 -1
  432. package/dist/validators/map.d.ts.map +0 -1
  433. package/dist/validators/nan.d.ts.map +0 -1
  434. package/dist/validators/never.d.ts.map +0 -1
  435. package/dist/validators/null.d.ts.map +0 -1
  436. package/dist/validators/number.d.ts.map +0 -1
  437. package/dist/validators/object.d.ts.map +0 -1
  438. package/dist/validators/promise.d.ts.map +0 -1
  439. package/dist/validators/record.d.ts.map +0 -1
  440. package/dist/validators/set.d.ts.map +0 -1
  441. package/dist/validators/string-bool.d.ts.map +0 -1
  442. package/dist/validators/string-formats.d.ts.map +0 -1
  443. package/dist/validators/string.d.ts.map +0 -1
  444. package/dist/validators/symbol.d.ts.map +0 -1
  445. package/dist/validators/template-literal.d.ts.map +0 -1
  446. package/dist/validators/tuple.d.ts.map +0 -1
  447. package/dist/validators/uint8array.d.ts.map +0 -1
  448. package/dist/validators/undefined.d.ts.map +0 -1
  449. package/dist/validators/union.d.ts.map +0 -1
  450. package/dist/validators/unknown.d.ts.map +0 -1
  451. package/dist/validators/void.d.ts.map +0 -1
  452. package/dist/validators/xor.d.ts.map +0 -1
@@ -1,515 +1 @@
1
- import { i as VldBase, u as getMessages, h as VldString } from '../chunks/bigint-CRS0QVsy.js';
2
- export { V as VldBigInt, a as VldBoolean, j as VldBrand, k as VldCatch, b as VldDate, l as VldDefault, r as VldExactOptional, d as VldNullable, e as VldNullish, c as VldNumber, f as VldOptional, m as VldPipe, g as VldPreprocess, n as VldReadonly, o as VldRefine, p as VldSuperRefine, q as VldTransform } from '../chunks/bigint-CRS0QVsy.js';
3
- export { a as VldAny, b as VldArray, c as VldDiscriminatedUnion, d as VldEnum, e as VldIntersection, f as VldJson, g as VldLazy, h as VldLiteral, k as VldMap, l as VldNan, V as VldNever, m as VldNull, i as VldObject, j as VldRecord, n as VldSet, o as VldStringBool, p as VldSymbol, q as VldTuple, r as VldUndefined, s as VldUnion, t as VldVoid, u as VldXor } from '../chunks/json-Cp4WO0M9.js';
4
- export { V as VldUnknown } from '../chunks/unknown-Dhzri_T-.js';
5
-
6
- /**
7
- * Immutable template literal validator
8
- * Validates strings matching a template pattern
9
- */
10
- class VldTemplateLiteral extends VldBase {
11
- constructor(pattern) {
12
- super();
13
- this.pattern = pattern;
14
- }
15
- /**
16
- * Create a template literal validator from components
17
- */
18
- static create(...components) {
19
- // Build regex pattern from components
20
- let pattern = '^';
21
- for (const comp of components) {
22
- if (typeof comp === 'string') {
23
- // Escape special regex characters
24
- pattern += comp.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
25
- }
26
- else {
27
- // Add appropriate pattern based on validator type
28
- pattern += getPatternForValidator(comp);
29
- }
30
- }
31
- pattern += '$';
32
- return new VldTemplateLiteral(new RegExp(pattern));
33
- }
34
- /**
35
- * Parse and validate a template literal string
36
- */
37
- parse(value) {
38
- if (typeof value !== 'string') {
39
- throw new Error(getMessages().invalidString);
40
- }
41
- if (!this.pattern.test(value)) {
42
- throw new Error(getMessages().stringPatternInvalid);
43
- }
44
- return value;
45
- }
46
- /**
47
- * Safely parse and validate a template literal string
48
- */
49
- safeParse(value) {
50
- try {
51
- return { success: true, data: this.parse(value) };
52
- }
53
- catch (error) {
54
- return {
55
- success: false,
56
- error: error
57
- };
58
- }
59
- }
60
- }
61
- /**
62
- * Get regex pattern for a validator type
63
- */
64
- function getPatternForValidator(validator) {
65
- // For template literals, we need to identify the validator type
66
- // and return an appropriate capture group pattern
67
- const className = validator.constructor.name;
68
- // Check for specific validator types
69
- if (className === 'VldString') {
70
- return '(.+)';
71
- }
72
- if (className === 'VldNumber' || className === 'VldInt') {
73
- return '(-?\\d+(?:\\.\\d+)?)';
74
- }
75
- if (className === 'VldBigInt') {
76
- return '(-?\\d+)';
77
- }
78
- if (className === 'VldBoolean') {
79
- return '(true|false)';
80
- }
81
- if (className === 'VldNull') {
82
- return '(null)';
83
- }
84
- if (className === 'VldUndefined' || className === 'VldVoid') {
85
- return '(undefined)';
86
- }
87
- if (className === 'VldLiteral') {
88
- // Extract literal value - access private literal property via any
89
- const literalValidator = validator;
90
- if (literalValidator.literal !== undefined) {
91
- const valueStr = String(literalValidator.literal);
92
- return '(' + valueStr.replace(/[.*+?^${}()|[\]\\]/g, '\\$&') + ')';
93
- }
94
- }
95
- // Default: match any string
96
- return '(.+)';
97
- }
98
- /**
99
- * Helper function to create template literal validators
100
- * Usage: v.templateLiteral(v.string(), '-', v.number())
101
- */
102
- function templateLiteral(...components) {
103
- return VldTemplateLiteral.create(...components);
104
- }
105
-
106
- /**
107
- * Immutable custom validator for user-defined validation logic
108
- * Provides type safety while allowing complete control over validation
109
- */
110
- class VldCustom extends VldBase {
111
- constructor(options) {
112
- super();
113
- this._parseFn = options.parse;
114
- this._safeParseFn = options.safeParse || ((value) => {
115
- try {
116
- return { success: true, data: this._parseFn(value) };
117
- }
118
- catch (error) {
119
- return { success: false, error: error };
120
- }
121
- });
122
- }
123
- /**
124
- * Create a new custom validator
125
- */
126
- static create(options) {
127
- return new VldCustom(options);
128
- }
129
- /**
130
- * Parse and validate using the custom parse function
131
- */
132
- parse(value) {
133
- return this._parseFn(value);
134
- }
135
- /**
136
- * Safely parse using the custom safeParse function or default implementation
137
- */
138
- safeParse(value) {
139
- return this._safeParseFn(value);
140
- }
141
- }
142
- /**
143
- * Helper function to create custom validators
144
- * Usage: v.custom<number>({
145
- * parse: (value) => {
146
- * if (typeof value !== 'string') throw new Error('Expected string');
147
- * return parseInt(value, 10);
148
- * }
149
- * })
150
- */
151
- function custom(options) {
152
- return VldCustom.create(options);
153
- }
154
-
155
- /**
156
- * Immutable file validator for file uploads
157
- * Supports size and MIME type validation
158
- */
159
- class VldFile extends VldBase {
160
- constructor(checks = []) {
161
- super();
162
- this.checks = checks;
163
- }
164
- /**
165
- * Create a new file validator
166
- */
167
- static create() {
168
- return new VldFile();
169
- }
170
- /**
171
- * Parse and validate a file value
172
- */
173
- parse(value) {
174
- // Check if File API is supported
175
- const FileSupported = typeof File !== 'undefined';
176
- if (!FileSupported) {
177
- throw new Error(getMessages().fileNotSupported || 'File API not supported in this environment');
178
- }
179
- // Check if value is a File object
180
- if (!(value instanceof File)) {
181
- // Allow plain object with size and type for Node.js compatibility
182
- if (typeof value === 'object' &&
183
- value !== null &&
184
- 'size' in value &&
185
- 'type' in value) {
186
- const fileObj = value;
187
- return this.runChecks(fileObj);
188
- }
189
- throw new Error(getMessages().invalidFile || 'Expected a File object');
190
- }
191
- return this.runChecks(value);
192
- }
193
- /**
194
- * Run all validation checks on the file
195
- */
196
- runChecks(file) {
197
- const msgs = getMessages();
198
- for (const check of this.checks) {
199
- switch (check.type) {
200
- case 'min':
201
- if (file.size < check.value) {
202
- throw new Error(check.message ||
203
- (msgs.fileMinSize?.(check.value) || `File size must be at least ${check.value} bytes`));
204
- }
205
- break;
206
- case 'max':
207
- if (file.size > check.value) {
208
- throw new Error(check.message ||
209
- (msgs.fileMaxSize?.(check.value) || `File size must not exceed ${check.value} bytes`));
210
- }
211
- break;
212
- case 'mime':
213
- if (!check.value.includes(file.type)) {
214
- throw new Error(check.message ||
215
- (msgs.fileMimeType?.(check.value) || `Invalid file type. Expected: ${check.value.join(', ')}`));
216
- }
217
- break;
218
- }
219
- }
220
- return file;
221
- }
222
- /**
223
- * Safely parse and validate a file value
224
- */
225
- safeParse(value) {
226
- try {
227
- return { success: true, data: this.parse(value) };
228
- }
229
- catch (error) {
230
- return { success: false, error: error };
231
- }
232
- }
233
- /**
234
- * Set minimum file size in bytes
235
- */
236
- min(bytes, message) {
237
- return new VldFile([...this.checks, { type: 'min', value: bytes, message }]);
238
- }
239
- /**
240
- * Set maximum file size in bytes
241
- */
242
- max(bytes, message) {
243
- return new VldFile([...this.checks, { type: 'max', value: bytes, message }]);
244
- }
245
- /**
246
- * Set allowed MIME types
247
- */
248
- mime(types, message) {
249
- const typeArray = Array.isArray(types) ? types : [types];
250
- return new VldFile([...this.checks, { type: 'mime', value: typeArray, message }]);
251
- }
252
- /**
253
- * Set both minimum and maximum file size
254
- */
255
- size(min, max, message) {
256
- return this.min(min, message).max(max, message);
257
- }
258
- }
259
- /**
260
- * Helper function to create file validators
261
- * Usage: v.file().min(1024).max(10485760).mime(['image/jpeg', 'image/png'])
262
- */
263
- function file() {
264
- return VldFile.create();
265
- }
266
-
267
- /**
268
- * Immutable function validator
269
- * Validates that a value is a function
270
- */
271
- class VldFunction extends VldBase {
272
- constructor() {
273
- super();
274
- }
275
- /**
276
- * Create a new function validator
277
- */
278
- static create() {
279
- return new VldFunction();
280
- }
281
- /**
282
- * Parse and validate a function value
283
- */
284
- parse(value) {
285
- if (typeof value !== 'function') {
286
- throw new Error(getMessages().invalidFunction || 'Expected a function');
287
- }
288
- return value;
289
- }
290
- /**
291
- * Safely parse and validate a function value
292
- */
293
- safeParse(value) {
294
- try {
295
- return { success: true, data: this.parse(value) };
296
- }
297
- catch (error) {
298
- return { success: false, error: error };
299
- }
300
- }
301
- }
302
- /**
303
- * Helper function to create function validators
304
- * Usage: v.function()
305
- */
306
- function functionValidator() {
307
- return VldFunction.create();
308
- }
309
-
310
- /**
311
- * Promise validator - validates Promise values
312
- * Validates that the resolved value matches the inner schema
313
- */
314
- /**
315
- * Promise validator - validates Promise<T> where T matches inner schema
316
- * Zod 4 API parity - allows async validation with proper type inference
317
- *
318
- * Validates that the input is a Promise, and validates the resolved value
319
- * against the inner schema when parsed.
320
- *
321
- * Use parseAsync() or safeParseAsync() for proper async handling.
322
- */
323
- class VldPromise {
324
- constructor(inner) {
325
- this.inner = inner;
326
- }
327
- /**
328
- * Check if value is thenable (Promise-like)
329
- * Must be called BEFORE wrapping in Promise.resolve
330
- */
331
- _isThenable(value) {
332
- return value !== null && typeof value.then === 'function';
333
- }
334
- /**
335
- * Parse and validate a Promise value asynchronously
336
- * @param value The Promise to validate
337
- * @returns The validated value
338
- * @throws {Error} If validation fails when Promise resolves
339
- */
340
- async parse(value) {
341
- // Check if value is thenable BEFORE wrapping in Promise.resolve
342
- if (!this._isThenable(value)) {
343
- throw new Error('Expected a Promise value');
344
- }
345
- // Now we can safely await it
346
- const resolved = await Promise.resolve(value);
347
- return this.inner.parse(resolved);
348
- }
349
- /**
350
- * Safely parse and validate a Promise value asynchronously
351
- * @param value The Promise to validate
352
- * @returns A Promise resolving to ParseResult containing the validated value
353
- */
354
- async safeParse(value) {
355
- // Check if value is thenable BEFORE wrapping in Promise.resolve
356
- if (!this._isThenable(value)) {
357
- return {
358
- success: false,
359
- error: new Error('Expected a Promise value')
360
- };
361
- }
362
- try {
363
- const resolved = await Promise.resolve(value);
364
- const validated = this.inner.parse(resolved);
365
- return {
366
- success: true,
367
- data: validated
368
- };
369
- }
370
- catch (err) {
371
- return {
372
- success: false,
373
- error: err instanceof Error ? err : new Error(String(err))
374
- };
375
- }
376
- }
377
- }
378
- /**
379
- * Create a Promise validator
380
- * @param inner The schema to validate the resolved value against
381
- * @returns A new Promise validator
382
- * @example
383
- * const promiseSchema = v.promise(v.string());
384
- * const result = await promiseSchema.parse(Promise.resolve("hello"));
385
- * // result is string
386
- */
387
- function promise(inner) {
388
- return new VldPromise(inner);
389
- }
390
-
391
- /**
392
- * Top-level string format validators
393
- * Part of Zod 4 API parity implementation
394
- * Provides convenient validators for common string formats
395
- */
396
- /**
397
- * Pre-compiled regex patterns for performance
398
- */
399
- const REGEXES = {
400
- email: /^[^\s@]+@[^\s@]+\.[^\s@]+$/,
401
- uuid: /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,
402
- uuidv4: /^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i,
403
- uuidv6: /^[0-9a-f]{8}-[0-9a-f]{4}-6[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i,
404
- uuidv7: /^[0-9a-f]{8}-[0-9a-f]{4}-7[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i,
405
- hostname: /^(?=.{1,253}$)(?:(?!-)[a-zA-Z0-9-]{1,63}(?<!-)\.)+[a-zA-Z]{2,63}$/,
406
- emoji: /^(?:\p{Emoji_Presentation}|\p{Emoji}\uFE0F)(?:\u200D(?:\p{Emoji_Presentation}|\p{Emoji}\uFE0F))*$/u,
407
- base64: /^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/,
408
- base64url: /^[A-Za-z0-9_-]*$/,
409
- hex: /^[0-9a-fA-F]*$/,
410
- jwt: /^[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+\.[A-Za-z0-9_-]*$/,
411
- nanoid: /^[A-Za-z0-9_-]{21}$/,
412
- cuid: /^c[^\s-]{8,}$/i,
413
- cuid2: /^[0-9a-z]+$/,
414
- ulid: /^[0-9A-HJKMNP-TV-Z]{26}$/,
415
- ipv4: /^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/,
416
- ipv6: /^(?:[0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}$/,
417
- mac: /^([0-9A-Fa-f]{2}:){5}[0-9A-Fa-f]{2}$/,
418
- cidrv4: /^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\/(?:3[0-2]|[12]?[0-9])$/,
419
- cidrv6: /^(?:[0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}\/(?:12[0-8]|1[01][0-9]|[1-9]?[0-9])$|^::(?:[0-9a-fA-F]{1,4}:){0,6}[0-9a-fA-F]{1,4}\/(?:12[0-8]|1[01][0-9]|[1-9]?[0-9])$|^(?:[0-9a-fA-F]{1,4}:){1,7}:\/(?:12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,
420
- e164: /^\+[1-9]\d{1,14}$/,
421
- isoDate: /^\d{4}-(?:0[1-9]|1[0-2])-(?:0[1-9]|[12]\d|3[01])$/,
422
- isoTime: /^(?:[01]\d|2[0-3]):[0-5]\d(?::[0-5]\d(?:\.\d+)?)?$/,
423
- isoDateTime: /^\d{4}-(?:0[1-9]|1[0-2])-(?:0[1-9]|[12]\d|3[01])T(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?Z?$/,
424
- md5: /^[a-f0-9]{32}$/i,
425
- sha1: /^[a-f0-9]{40}$/i,
426
- sha256: /^[a-f0-9]{64}$/i,
427
- sha384: /^[a-f0-9]{96}$/i,
428
- sha512: /^[a-f0-9]{128}$/i,
429
- // Additional formats (Zod v4 parity)
430
- xid: /^[A-HJKMNP-TV-Z0-9]{20}$/, // ksort's XID format
431
- guid: /^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/i, // Alias for UUID
432
- httpUrl: /^https?:\/\/[^\s/$.?#].[^\s]*$/, // HTTP/HTTPS URL
433
- };
434
- /**
435
- * Generic string format validator
436
- */
437
- class VldStringFormat extends VldBase {
438
- constructor(_format, _validator, _errorMessage) {
439
- super();
440
- this._format = _format;
441
- this._validator = _validator;
442
- this._errorMessage = _errorMessage;
443
- }
444
- static create(format, validator, errorMessage) {
445
- return new VldStringFormat(format, validator, errorMessage);
446
- }
447
- parse(value) {
448
- const result = VldString.create().parse(value);
449
- if (!this._validator(result)) {
450
- throw new Error(this._errorMessage || `Invalid ${this._format} format`);
451
- }
452
- return result;
453
- }
454
- safeParse(value) {
455
- const stringResult = VldString.create().safeParse(value);
456
- if (!stringResult.success) {
457
- return stringResult;
458
- }
459
- if (!this._validator(stringResult.data)) {
460
- return {
461
- success: false,
462
- error: new Error(this._errorMessage || `Invalid ${this._format} format`)
463
- };
464
- }
465
- return { success: true, data: stringResult.data };
466
- }
467
- }
468
- /**
469
- * Top-level string format validators
470
- */
471
- const email = (options) => VldStringFormat.create('email', (val) => (options?.pattern ?? REGEXES.email).test(val));
472
- const uuid = (options) => {
473
- const pattern = options?.version ? REGEXES[`uuid${options.version}`] : REGEXES.uuid;
474
- return VldStringFormat.create('uuid', (val) => pattern.test(val));
475
- };
476
- const uuidv4 = () => VldStringFormat.create('uuid', (val) => REGEXES.uuidv4.test(val));
477
- const hostname = () => VldStringFormat.create('hostname', (val) => REGEXES.hostname.test(val));
478
- const emoji = () => VldStringFormat.create('emoji', (val) => REGEXES.emoji.test(val));
479
- const base64 = () => VldStringFormat.create('base64', (val) => REGEXES.base64.test(val));
480
- const base64url = () => VldStringFormat.create('base64url', (val) => REGEXES.base64url.test(val));
481
- const hex = () => VldStringFormat.create('hex', (val) => REGEXES.hex.test(val));
482
- const jwt = () => VldStringFormat.create('jwt', (val) => REGEXES.jwt.test(val));
483
- const nanoid = () => VldStringFormat.create('nanoid', (val) => REGEXES.nanoid.test(val));
484
- const cuid = () => VldStringFormat.create('cuid', (val) => REGEXES.cuid.test(val));
485
- const cuid2 = () => VldStringFormat.create('cuid2', (val) => REGEXES.cuid2.test(val));
486
- const ulid = () => VldStringFormat.create('ulid', (val) => REGEXES.ulid.test(val));
487
- const ipv4 = () => VldStringFormat.create('ipv4', (val) => REGEXES.ipv4.test(val));
488
- const ipv6 = () => VldStringFormat.create('ipv6', (val) => REGEXES.ipv6.test(val));
489
- const mac = () => VldStringFormat.create('mac', (val) => REGEXES.mac.test(val));
490
- const cidrv4 = () => VldStringFormat.create('cidrv4', (val) => REGEXES.cidrv4.test(val));
491
- const cidrv6 = () => VldStringFormat.create('cidrv6', (val) => REGEXES.cidrv6.test(val));
492
- const e164 = () => VldStringFormat.create('e164', (val) => REGEXES.e164.test(val));
493
- const xid = () => VldStringFormat.create('xid', (val) => REGEXES.xid.test(val));
494
- const guid = () => VldStringFormat.create('guid', (val) => REGEXES.guid.test(val));
495
- const httpUrl = () => VldStringFormat.create('httpUrl', (val) => REGEXES.httpUrl.test(val));
496
- const hash = (algorithm) => VldStringFormat.create('hash', (val) => REGEXES[algorithm]?.test(val) ?? false, `Invalid ${algorithm} hash`);
497
- /**
498
- * ISO date/time validators
499
- */
500
- const iso = {
501
- date: () => VldStringFormat.create('date', (val) => REGEXES.isoDate.test(val)),
502
- time: () => VldStringFormat.create('time', (val) => REGEXES.isoTime.test(val)),
503
- dateTime: (_options) => VldStringFormat.create('datetime', (val) => REGEXES.isoDateTime.test(val)),
504
- duration: () => VldStringFormat.create('duration', (val) => /^P/.test(val)),
505
- };
506
- /**
507
- * Custom format validator
508
- */
509
- const stringFormat = (name, validator) => {
510
- const fn = validator instanceof RegExp ? (val) => validator.test(val) : validator;
511
- return VldStringFormat.create(name, fn);
512
- };
513
-
514
- export { VldBase, VldCustom, VldFile, VldFunction, VldPromise, VldString, VldTemplateLiteral, base64, base64url, cidrv4, cidrv6, cuid, cuid2, custom, e164, email, emoji, file, functionValidator, guid, hash, hex, hostname, httpUrl, ipv4, ipv6, iso, jwt, mac, nanoid, promise, REGEXES as regexes, stringFormat, templateLiteral, ulid, uuid, uuidv4, xid };
515
- //# sourceMappingURL=index.js.map
1
+ export{VldBase,VldBrand,VldCatch,VldDefault,VldExactOptional,VldNullable,VldNullish,VldOptional,VldPipe,VldPreprocess,VldReadonly,VldRefine,VldSuperRefine,VldTransform}from"./base.js";export{VldString}from"./string.js";export{VldNumber}from"./number.js";export{VldBoolean}from"./boolean.js";export{VldDate}from"./date.js";export{VldStringBool}from"./string-bool.js";export{VldArray}from"./array.js";export{VldObject}from"./object.js";export{VldUnion}from"./union.js";export{VldIntersection}from"./intersection.js";export{VldLiteral}from"./literal.js";export{VldEnum}from"./enum.js";export{VldTuple}from"./tuple.js";export{VldRecord}from"./record.js";export{VldSet}from"./set.js";export{VldMap}from"./map.js";export{VldBigInt}from"./bigint.js";export{VldSymbol}from"./symbol.js";export{VldAny}from"./any.js";export{VldUnknown}from"./unknown.js";export{VldVoid}from"./void.js";export{VldNever}from"./never.js";export{VldNull}from"./null.js";export{VldUndefined}from"./undefined.js";export{VldNan}from"./nan.js";export{VldLazy}from"./lazy.js";export{VldDiscriminatedUnion}from"./discriminated-union.js";export{VldXor}from"./xor.js";export{VldJson}from"./json.js";export{VldTemplateLiteral,templateLiteral}from"./template-literal.js";export{VldCustom,custom}from"./custom.js";export{VldFile,file}from"./file.js";export{VldFunction,functionValidator}from"./function.js";export{VldPromise,promise}from"./promise.js";export{base64,base64url,cidrv4,cidrv6,cuid,cuid2,e164,email,emoji,guid,hash,hex,hostname,httpUrl,ipv4,ipv6,iso,jwt,ksuid,mac,nanoid,regexes,stringFormat,ulid,url,uuid,uuidv4,uuidv6,uuidv7,xid}from"./string-formats.js";
@@ -1,4 +1,4 @@
1
- import { VldBase, ParseResult } from './base';
1
+ import { VldBase, ParseResult } from './base.js';
2
2
  /**
3
3
  * Immutable intersection validator for combining validators
4
4
  */
@@ -22,4 +22,3 @@ export declare class VldIntersection<A, B> extends VldBase<unknown, A & B> {
22
22
  */
23
23
  safeParse(value: unknown): ParseResult<A & B>;
24
24
  }
25
- //# sourceMappingURL=intersection.d.ts.map
@@ -0,0 +1 @@
1
+ import{VldBase as t,VLD_VALIDATOR_TYPES as e}from"./base.js";import{i as r}from"../chunks/security-Dy24T8N7.js";import{getMessages as o}from"../locales/runtime.js";import{V as s}from"../chunks/errors-core-Cqi4-9ew.js";function n(t){return null!==t&&"object"==typeof t&&t.constructor===Object&&"[object Object]"===Object.prototype.toString.call(t)}function c(t,e){const o={...t},s=Object.keys(e);for(let i=0;i<s.length;i++){const a=s[i];if(r(a))continue;if(!Object.prototype.hasOwnProperty.call(e,a))continue;const u=e[a],p=t[a];n(u)&&n(p)?o[a]=c(p,u):o[a]=u}return o}class VldIntersection extends t{constructor(t,r){super(e.INTERSECTION),this.validatorA=t,this.validatorB=r}static create(t,e){return new VldIntersection(t,e)}parse(t){try{const e=this.validatorA.parse(t),r=this.validatorB.parse(t),o=n(e),s=n(r);if(o&&s)return c(e,r);if(!o&&!s){if(e===r)return e;throw new Error("Values must be identical for intersection of primitive types")}throw new Error("Cannot create intersection of object and primitive types. Both validators must produce the same type category.")}catch(t){throw new Error(o().intersectionError(t.message))}}safeParse(t){try{return{success:!0,data:this.parse(t)}}catch(t){return{success:!1,error:(e=t.message,new s([{code:"invalid_type",path:[],message:e}]))}}var e}}export{VldIntersection};
@@ -1,4 +1,4 @@
1
- import { VldBase, ParseResult } from './base';
1
+ import { VldBase, ParseResult } from './base.js';
2
2
  /**
3
3
  * Immutable JSON validator that validates and parses JSON strings
4
4
  * Accepts both strings (which are parsed) and already-parsed objects
@@ -23,4 +23,3 @@ export declare class VldJson<T = unknown> extends VldBase<unknown, T> {
23
23
  */
24
24
  withSchema<U>(schema: VldBase<unknown, U>): VldJson<U>;
25
25
  }
26
- //# sourceMappingURL=json.d.ts.map
@@ -0,0 +1 @@
1
+ import{VldBase as s,VLD_VALIDATOR_TYPES as r}from"./base.js";import{getMessages as e}from"../locales/runtime.js";class VldJson extends s{constructor(s){super(r.JSON),this.schema=s}static create(s){return new VldJson(s)}parse(s){let r;if("string"==typeof s)try{r=JSON.parse(s)}catch{throw new Error(e().invalidJson)}else r=s;return this.schema?this.schema.parse(r):r}safeParse(s){try{return{success:!0,data:this.parse(s)}}catch(s){return{success:!1,error:s}}}withSchema(s){return new VldJson(s)}}export{VldJson};
@@ -3,25 +3,22 @@
3
3
  * Part of Zod 4 API parity implementation
4
4
  * Allows schemas that reference themselves (e.g., tree structures, nested categories)
5
5
  */
6
- import { VldBase } from './base';
7
- import type { ParseResult } from './base';
6
+ import { VldBase } from './base.js';
7
+ import type { ParseResult } from './base.js';
8
8
  /**
9
9
  * Lazy validator - defers schema evaluation until runtime
10
10
  * Essential for recursive and self-referencing types
11
11
  *
12
- * MEMORY OPTIMIZATION: Uses WeakRef for the cached schema to allow garbage collection
13
- * when the validator is no longer in use. This prevents memory leaks in long-running
14
- * applications with dynamically created schemas.
12
+ * Caches the resolved schema after first use. This keeps recursive schemas stable
13
+ * and avoids re-running the schema getter on hot parse paths.
15
14
  */
16
15
  export declare class VldLazy<TInput, TOutput> extends VldBase<TInput, TOutput> {
17
16
  private readonly _schemaGetter;
18
- private _cachedSchemaRef;
19
- private _strongRef;
17
+ private _cachedSchema;
20
18
  private constructor();
21
19
  static create<TInput, TOutput>(schemaGetter: () => VldBase<TInput, TOutput>): VldLazy<TInput, TOutput>;
22
20
  /**
23
21
  * Get the actual schema, caching it after first retrieval
24
- * Uses WeakRef to allow garbage collection when validator is not in use
25
22
  */
26
23
  private _getSchema;
27
24
  /**
@@ -32,4 +29,3 @@ export declare class VldLazy<TInput, TOutput> extends VldBase<TInput, TOutput> {
32
29
  parse(value: unknown): TOutput;
33
30
  safeParse(value: unknown): ParseResult<TOutput>;
34
31
  }
35
- //# sourceMappingURL=lazy.d.ts.map
@@ -0,0 +1 @@
1
+ import{VldBase as e,VLD_VALIDATOR_TYPES as t}from"./base.js";class VldLazy extends e{constructor(e){super(t.LAZY),this._schemaGetter=e,this._cachedSchema=null}static create(e){return new VldLazy(e)}_getSchema(){if(this._cachedSchema)return this._cachedSchema;const e=this._schemaGetter();return this._cachedSchema=e,e}unwrap(){return this._getSchema()}parse(e){return this._getSchema().parse(e)}safeParse(e){return this._getSchema().safeParse(e)}}export{VldLazy};
@@ -1,9 +1,10 @@
1
- import { VldBase, ParseResult } from './base';
1
+ import { VldBase, ParseResult } from './base.js';
2
2
  /**
3
3
  * Immutable literal validator for exact value matching
4
4
  */
5
- export declare class VldLiteral<T extends string | number | boolean | null | undefined> extends VldBase<T, T> {
6
- private readonly _literal;
5
+ export type LiteralValue = string | number | bigint | boolean | null | undefined;
6
+ export declare class VldLiteral<T extends LiteralValue> extends VldBase<T, T> {
7
+ private readonly _values;
7
8
  private readonly errorMessage?;
8
9
  /**
9
10
  * Private constructor to enforce immutability
@@ -13,17 +14,20 @@ export declare class VldLiteral<T extends string | number | boolean | null | und
13
14
  * Get the literal value
14
15
  */
15
16
  get literal(): T;
17
+ get values(): readonly T[];
18
+ get isSimple(): boolean;
19
+ private get expectedDisplay();
16
20
  /**
17
21
  * Create a new literal validator
18
22
  */
19
- static create<T extends string | number | boolean | null | undefined>(literal: T): VldLiteral<T>;
23
+ static create<T extends LiteralValue>(literal: T | readonly T[]): VldLiteral<T>;
20
24
  /**
21
25
  * Parse and validate a literal value
22
26
  */
23
27
  parse(value: unknown): T;
28
+ private _createLiteralError;
24
29
  /**
25
30
  * Safely parse and validate a literal value
26
31
  */
27
32
  safeParse(value: unknown): ParseResult<T>;
28
33
  }
29
- //# sourceMappingURL=literal.d.ts.map
@@ -0,0 +1 @@
1
+ import{VldBase as e,VLD_VALIDATOR_TYPES as r}from"./base.js";import{getMessages as t}from"../locales/runtime.js";import{V as s}from"../chunks/errors-core-Cqi4-9ew.js";function a(e){const r=JSON.stringify(e,(e,r)=>"bigint"==typeof r?r.toString():r);return void 0===r?String(e):r}class VldLiteral extends e{constructor(e,t){super(r.LITERAL),this._values=e,this.errorMessage=t}get literal(){return this._values[0]}get values(){return this._values}get isSimple(){return 1===this._values.length}get expectedDisplay(){return a(1===this._values.length?this._values[0]:this._values)}static create(e){const r=Array.isArray(e)?e:[e];if(0===r.length)throw new Error("Cannot create literal schema with no valid values");return new VldLiteral(r)}parse(e){if(!this._values.includes(e))throw this._createLiteralError(e);return e}_createLiteralError(e){const r={code:"invalid_value",path:[],values:[...this._values],message:this.errorMessage||t().literalExpected(this.expectedDisplay,a(e))};return new s([r])}safeParse(e){return this._values.includes(e)?{success:!0,data:e}:{success:!1,error:this._createLiteralError(e)}}}export{VldLiteral};
@@ -1,4 +1,4 @@
1
- import { VldBase, ParseResult } from './base';
1
+ import { VldBase, ParseResult } from './base.js';
2
2
  /**
3
3
  * Immutable Map validator
4
4
  */
@@ -10,17 +10,30 @@ export declare class VldMap<K, V> extends VldBase<unknown, Map<K, V>> {
10
10
  * Private constructor to enforce immutability
11
11
  */
12
12
  private constructor();
13
+ private readonly _simpleKeyMode;
14
+ private readonly _simpleValueMode;
15
+ private readonly _simpleKeyValue;
16
+ private readonly _simpleValueValue;
17
+ get keySchema(): VldBase<unknown, K>;
18
+ get valueSchema(): VldBase<unknown, V>;
13
19
  /**
14
20
  * Create a new Map validator
15
21
  */
16
22
  static create<K, V>(keyValidator: VldBase<unknown, K>, valueValidator: VldBase<unknown, V>): VldMap<K, V>;
23
+ private getSimpleItemMode;
24
+ private getSimpleItemError;
25
+ private parseSimpleItem;
17
26
  /**
18
27
  * Parse and validate a Map value
19
28
  */
20
29
  parse(value: unknown): Map<K, V>;
30
+ /**
31
+ * Parse a value that has already passed the Map instance guard.
32
+ * @internal Used by object validators to avoid duplicate hot-path checks.
33
+ */
34
+ parseKnownMap(value: Map<unknown, unknown>): Map<K, V>;
21
35
  /**
22
36
  * Safely parse and validate a Map value
23
37
  */
24
38
  safeParse(value: unknown): ParseResult<Map<K, V>>;
25
39
  }
26
- //# sourceMappingURL=map.d.ts.map