@oxog/vld 2.0.3 → 2.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (449) hide show
  1. package/CHANGELOG.md +33 -1
  2. package/README.md +101 -37
  3. package/dist/chunks/errors-core-BeiFUtZM.js +81 -0
  4. package/dist/chunks/{index-DO8CFMxD.js → index-0R2ntSud.js} +16 -402
  5. package/dist/chunks/index-BvH403Yy.js +88 -0
  6. package/dist/chunks/security-B0Pd_vSY.js +35 -0
  7. package/dist/chunks/string-BJRQod3t.js +530 -0
  8. package/dist/cjs/chunks/errors-core-DWxLFs2f.cjs +83 -0
  9. package/dist/cjs/chunks/index-BkI37108.cjs +538 -0
  10. package/dist/cjs/chunks/index-Cc3bjUMX.cjs +91 -0
  11. package/dist/cjs/chunks/security-Dc3Jh13T.cjs +37 -0
  12. package/dist/cjs/chunks/string-BKZrc4hs.cjs +533 -0
  13. package/dist/cjs/cli/bin.cjs +506 -0
  14. package/dist/cjs/cli/index.cjs +209 -0
  15. package/dist/cjs/codecs/index.cjs +45 -0
  16. package/dist/{chunks/date-50JV_Mfj.js → cjs/coercion/index.cjs} +185 -103
  17. package/dist/cjs/compat/emitter.cjs +184 -0
  18. package/dist/cjs/compat/result.cjs +189 -0
  19. package/dist/cjs/errors.cjs +6 -213
  20. package/dist/cjs/index.cjs +1471 -10336
  21. package/dist/cjs/kernel.cjs +415 -0
  22. package/dist/cjs/locales/af.cjs +108 -0
  23. package/dist/cjs/locales/ar.cjs +108 -0
  24. package/dist/cjs/locales/bn.cjs +108 -0
  25. package/dist/cjs/locales/da.cjs +108 -0
  26. package/dist/cjs/locales/de.cjs +108 -0
  27. package/dist/cjs/locales/en.cjs +108 -0
  28. package/dist/cjs/locales/es-MX.cjs +107 -0
  29. package/dist/cjs/locales/es.cjs +96 -0
  30. package/dist/cjs/locales/fi.cjs +108 -0
  31. package/dist/cjs/locales/fr.cjs +96 -0
  32. package/dist/cjs/locales/hi.cjs +108 -0
  33. package/dist/cjs/locales/id.cjs +108 -0
  34. package/dist/cjs/locales/index.cjs +41 -2875
  35. package/dist/cjs/locales/it.cjs +108 -0
  36. package/dist/cjs/locales/ja.cjs +108 -0
  37. package/dist/cjs/locales/ko.cjs +108 -0
  38. package/dist/cjs/locales/lazy.cjs +42 -3023
  39. package/dist/cjs/locales/nl.cjs +108 -0
  40. package/dist/cjs/locales/no.cjs +108 -0
  41. package/dist/cjs/locales/pl.cjs +108 -0
  42. package/dist/cjs/locales/pt-BR.cjs +108 -0
  43. package/dist/cjs/locales/pt.cjs +108 -0
  44. package/dist/cjs/locales/ru.cjs +108 -0
  45. package/dist/cjs/locales/runtime.cjs +51 -0
  46. package/dist/cjs/locales/sv.cjs +108 -0
  47. package/dist/cjs/locales/sw.cjs +108 -0
  48. package/dist/cjs/locales/th.cjs +108 -0
  49. package/dist/cjs/locales/tr.cjs +108 -0
  50. package/dist/cjs/locales/vi.cjs +108 -0
  51. package/dist/cjs/locales/zh.cjs +108 -0
  52. package/dist/cjs/mini.cjs +121 -7353
  53. package/dist/cjs/pigment.cjs +207 -0
  54. package/dist/cjs/plugins/index.cjs +12 -0
  55. package/dist/cjs/registry.cjs +37 -0
  56. package/dist/cjs/v3/index.cjs +425 -0
  57. package/dist/cjs/v4/core/index.cjs +894 -0
  58. package/dist/cjs/v4/index.cjs +425 -0
  59. package/dist/cjs/v4/locales/index.cjs +130 -0
  60. package/dist/cjs/v4/mini/index.cjs +509 -0
  61. package/dist/cjs/v4-mini/index.cjs +532 -0
  62. package/dist/cjs/validators/any.cjs +40 -0
  63. package/dist/cjs/validators/array.cjs +283 -0
  64. package/dist/cjs/validators/base.cjs +887 -0
  65. package/dist/cjs/validators/base64.cjs +73 -0
  66. package/dist/cjs/validators/bigint.cjs +232 -0
  67. package/dist/cjs/validators/boolean.cjs +146 -0
  68. package/dist/cjs/validators/codec.cjs +205 -0
  69. package/dist/cjs/validators/custom.cjs +71 -0
  70. package/dist/cjs/validators/date.cjs +278 -0
  71. package/dist/cjs/validators/discriminated-union.cjs +130 -0
  72. package/dist/cjs/validators/enum.cjs +154 -0
  73. package/dist/cjs/validators/file.cjs +130 -0
  74. package/dist/cjs/validators/function.cjs +63 -0
  75. package/dist/cjs/validators/hex.cjs +70 -0
  76. package/dist/cjs/validators/index.cjs +123 -0
  77. package/dist/cjs/validators/intersection.cjs +120 -0
  78. package/dist/cjs/validators/json.cjs +70 -0
  79. package/dist/cjs/validators/lazy.cjs +53 -0
  80. package/dist/cjs/validators/literal.cjs +64 -0
  81. package/dist/cjs/validators/map.cjs +218 -0
  82. package/dist/cjs/validators/nan.cjs +41 -0
  83. package/dist/cjs/validators/never.cjs +36 -0
  84. package/dist/cjs/validators/null.cjs +43 -0
  85. package/dist/cjs/validators/number.cjs +427 -0
  86. package/dist/cjs/validators/object.cjs +868 -0
  87. package/dist/cjs/validators/promise.cjs +115 -0
  88. package/dist/cjs/validators/record.cjs +262 -0
  89. package/dist/cjs/validators/set.cjs +203 -0
  90. package/dist/cjs/validators/string-bool.cjs +124 -0
  91. package/dist/cjs/validators/string-formats.cjs +168 -0
  92. package/dist/cjs/validators/string.cjs +12 -0
  93. package/dist/cjs/validators/symbol.cjs +62 -0
  94. package/dist/cjs/validators/template-literal.cjs +108 -0
  95. package/dist/cjs/validators/tuple.cjs +187 -0
  96. package/dist/cjs/validators/uint8array.cjs +106 -0
  97. package/dist/cjs/validators/undefined.cjs +43 -0
  98. package/dist/cjs/validators/union.cjs +191 -0
  99. package/dist/cjs/validators/unknown.cjs +40 -0
  100. package/dist/cjs/validators/void.cjs +48 -0
  101. package/dist/cjs/validators/xor.cjs +69 -0
  102. package/dist/cli/bin.d.ts +0 -1
  103. package/dist/cli/bin.js +407 -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 +205 -0
  108. package/dist/codecs/index.d.ts +21 -4
  109. package/dist/codecs/index.js +11 -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 +473 -5
  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 +0 -1
  119. package/dist/compat/index.d.ts +4 -5
  120. package/dist/compat/result.d.ts +1 -2
  121. package/dist/compat/result.js +0 -1
  122. package/dist/errors-core.d.ts +39 -0
  123. package/dist/errors.d.ts +4 -54
  124. package/dist/errors.js +4 -68
  125. package/dist/events.d.ts +3 -4
  126. package/dist/index.d.ts +1186 -835
  127. package/dist/index.js +1046 -367
  128. package/dist/kernel.d.ts +2 -3
  129. package/dist/kernel.js +10 -6
  130. package/dist/locales/af.d.ts +1 -2
  131. package/dist/locales/af.js +0 -1
  132. package/dist/locales/ar.d.ts +1 -2
  133. package/dist/locales/ar.js +0 -1
  134. package/dist/locales/bn.d.ts +1 -2
  135. package/dist/locales/bn.js +0 -1
  136. package/dist/locales/da.d.ts +1 -2
  137. package/dist/locales/da.js +0 -1
  138. package/dist/locales/de.d.ts +1 -2
  139. package/dist/locales/de.js +0 -1
  140. package/dist/locales/en.d.ts +1 -2
  141. package/dist/locales/en.js +0 -1
  142. package/dist/locales/es-MX.d.ts +1 -2
  143. package/dist/locales/es-MX.js +0 -1
  144. package/dist/locales/es.d.ts +1 -2
  145. package/dist/locales/es.js +0 -1
  146. package/dist/locales/fi.d.ts +1 -2
  147. package/dist/locales/fi.js +0 -1
  148. package/dist/locales/fr.d.ts +1 -2
  149. package/dist/locales/fr.js +0 -1
  150. package/dist/locales/hi.d.ts +1 -2
  151. package/dist/locales/hi.js +0 -1
  152. package/dist/locales/id.d.ts +1 -2
  153. package/dist/locales/id.js +0 -1
  154. package/dist/locales/index.d.ts +10 -15
  155. package/dist/locales/index.js +28 -2
  156. package/dist/locales/it.d.ts +1 -2
  157. package/dist/locales/it.js +0 -1
  158. package/dist/locales/ja.d.ts +1 -2
  159. package/dist/locales/ja.js +0 -1
  160. package/dist/locales/ko.d.ts +1 -2
  161. package/dist/locales/ko.js +0 -1
  162. package/dist/locales/lazy.d.ts +4 -26
  163. package/dist/locales/lazy.js +12 -55
  164. package/dist/locales/nl.d.ts +1 -2
  165. package/dist/locales/nl.js +0 -1
  166. package/dist/locales/no.d.ts +1 -2
  167. package/dist/locales/no.js +0 -1
  168. package/dist/locales/pl.d.ts +1 -2
  169. package/dist/locales/pl.js +0 -1
  170. package/dist/locales/pt-BR.d.ts +1 -2
  171. package/dist/locales/pt-BR.js +0 -1
  172. package/dist/locales/pt.d.ts +1 -2
  173. package/dist/locales/pt.js +0 -1
  174. package/dist/locales/ru.d.ts +1 -2
  175. package/dist/locales/ru.js +0 -1
  176. package/dist/locales/runtime.d.ts +10 -0
  177. package/dist/locales/runtime.js +41 -0
  178. package/dist/locales/sv.d.ts +1 -2
  179. package/dist/locales/sv.js +0 -1
  180. package/dist/locales/sw.d.ts +1 -2
  181. package/dist/locales/sw.js +0 -1
  182. package/dist/locales/th.d.ts +1 -2
  183. package/dist/locales/th.js +0 -1
  184. package/dist/locales/tr.d.ts +1 -2
  185. package/dist/locales/tr.js +0 -1
  186. package/dist/locales/types.d.ts +0 -1
  187. package/dist/locales/vi.d.ts +1 -2
  188. package/dist/locales/vi.js +0 -1
  189. package/dist/locales/zh.d.ts +1 -2
  190. package/dist/locales/zh.js +0 -1
  191. package/dist/logger.d.ts +0 -1
  192. package/dist/mini.d.ts +64 -65
  193. package/dist/mini.js +31 -7
  194. package/dist/pigment.d.ts +0 -1
  195. package/dist/pigment.js +6 -4
  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 +34 -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 +16 -6
  205. package/dist/utils/security.d.ts +2 -6
  206. package/dist/v3/index.d.ts +2 -0
  207. package/dist/v3/index.js +46 -0
  208. package/dist/v4/core/index.d.ts +260 -0
  209. package/dist/v4/core/index.js +277 -0
  210. package/dist/v4/index.d.ts +4 -0
  211. package/dist/v4/index.js +50 -0
  212. package/dist/v4/locales/index.d.ts +53 -0
  213. package/dist/v4/locales/index.js +77 -0
  214. package/dist/v4/mini/index.d.ts +2 -0
  215. package/dist/v4/mini/index.js +47 -0
  216. package/dist/v4-mini/index.d.ts +22 -0
  217. package/dist/v4-mini/index.js +75 -0
  218. package/dist/validators/any.d.ts +7 -2
  219. package/dist/validators/any.js +37 -0
  220. package/dist/validators/array.d.ts +9 -2
  221. package/dist/validators/array.js +279 -0
  222. package/dist/validators/base.d.ts +150 -6
  223. package/dist/validators/base.js +868 -0
  224. package/dist/validators/base64.d.ts +1 -2
  225. package/dist/validators/base64.js +68 -0
  226. package/dist/validators/bigint.d.ts +21 -3
  227. package/dist/validators/bigint.js +228 -0
  228. package/dist/validators/boolean.d.ts +13 -4
  229. package/dist/validators/boolean.js +142 -0
  230. package/dist/validators/codec.d.ts +9 -2
  231. package/dist/validators/codec.js +200 -0
  232. package/dist/validators/custom.d.ts +15 -2
  233. package/dist/validators/custom.js +67 -0
  234. package/dist/validators/date.d.ts +19 -3
  235. package/dist/validators/date.js +274 -0
  236. package/dist/validators/discriminated-union.d.ts +4 -3
  237. package/dist/validators/discriminated-union.js +123 -0
  238. package/dist/validators/enum.d.ts +10 -7
  239. package/dist/validators/enum.js +150 -0
  240. package/dist/validators/file.d.ts +7 -2
  241. package/dist/validators/file.js +125 -0
  242. package/dist/validators/function.d.ts +11 -5
  243. package/dist/validators/function.js +58 -0
  244. package/dist/validators/hex.d.ts +1 -2
  245. package/dist/validators/hex.js +65 -0
  246. package/dist/validators/index.d.ts +38 -39
  247. package/dist/validators/index.js +35 -515
  248. package/dist/validators/intersection.d.ts +1 -2
  249. package/dist/validators/intersection.js +116 -0
  250. package/dist/validators/json.d.ts +1 -2
  251. package/dist/validators/json.js +66 -0
  252. package/dist/validators/lazy.d.ts +5 -9
  253. package/dist/validators/lazy.js +50 -0
  254. package/dist/validators/literal.d.ts +2 -2
  255. package/dist/validators/literal.js +60 -0
  256. package/dist/validators/map.d.ts +15 -2
  257. package/dist/validators/map.js +214 -0
  258. package/dist/validators/nan.d.ts +2 -3
  259. package/dist/validators/nan.js +38 -0
  260. package/dist/validators/never.d.ts +1 -2
  261. package/dist/validators/never.js +32 -0
  262. package/dist/validators/null.d.ts +3 -3
  263. package/dist/validators/null.js +40 -0
  264. package/dist/validators/number.d.ts +56 -27
  265. package/dist/validators/number.js +423 -0
  266. package/dist/validators/object.d.ts +30 -9
  267. package/dist/validators/object.js +864 -0
  268. package/dist/validators/promise.d.ts +15 -10
  269. package/dist/validators/promise.js +111 -0
  270. package/dist/validators/record.d.ts +11 -2
  271. package/dist/validators/record.js +258 -0
  272. package/dist/validators/set.d.ts +11 -2
  273. package/dist/validators/set.js +199 -0
  274. package/dist/validators/string-bool.d.ts +7 -10
  275. package/dist/validators/string-bool.js +120 -0
  276. package/dist/validators/string-formats.d.ts +7 -4
  277. package/dist/validators/string-formats.js +135 -0
  278. package/dist/validators/string.d.ts +39 -18
  279. package/dist/validators/string.js +4 -0
  280. package/dist/validators/symbol.d.ts +8 -3
  281. package/dist/validators/symbol.js +58 -0
  282. package/dist/validators/template-literal.d.ts +1 -2
  283. package/dist/validators/template-literal.js +103 -0
  284. package/dist/validators/tuple.d.ts +15 -2
  285. package/dist/validators/tuple.js +183 -0
  286. package/dist/validators/uint8array.d.ts +3 -4
  287. package/dist/validators/uint8array.js +101 -0
  288. package/dist/validators/undefined.d.ts +3 -3
  289. package/dist/validators/undefined.js +40 -0
  290. package/dist/validators/union.d.ts +7 -4
  291. package/dist/validators/union.js +187 -0
  292. package/dist/validators/unknown.d.ts +7 -2
  293. package/dist/{chunks/unknown-Dhzri_T-.js → validators/unknown.js} +12 -3
  294. package/dist/validators/void.d.ts +3 -2
  295. package/dist/validators/void.js +44 -0
  296. package/dist/validators/xor.d.ts +2 -3
  297. package/dist/validators/xor.js +66 -0
  298. package/package.json +114 -30
  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.map +0 -1
  302. package/dist/chunks/index-DO8CFMxD.js.map +0 -1
  303. package/dist/chunks/json-Cp4WO0M9.js +0 -2021
  304. package/dist/chunks/json-Cp4WO0M9.js.map +0 -1
  305. package/dist/chunks/unknown-Dhzri_T-.js.map +0 -1
  306. package/dist/cjs/errors.cjs.map +0 -1
  307. package/dist/cjs/index.cjs.map +0 -1
  308. package/dist/cjs/locales/index.cjs.map +0 -1
  309. package/dist/cjs/locales/lazy.cjs.map +0 -1
  310. package/dist/cjs/mini.cjs.map +0 -1
  311. package/dist/cli/bin.d.ts.map +0 -1
  312. package/dist/cli/commands/benchmark.d.ts.map +0 -1
  313. package/dist/cli/commands/validate.d.ts.map +0 -1
  314. package/dist/cli/index.d.ts.map +0 -1
  315. package/dist/codecs/index.d.ts.map +0 -1
  316. package/dist/codecs/index.js.map +0 -1
  317. package/dist/coercion/bigint.d.ts.map +0 -1
  318. package/dist/coercion/boolean.d.ts.map +0 -1
  319. package/dist/coercion/date.d.ts.map +0 -1
  320. package/dist/coercion/index.d.ts.map +0 -1
  321. package/dist/coercion/index.js.map +0 -1
  322. package/dist/coercion/number.d.ts.map +0 -1
  323. package/dist/coercion/string.d.ts.map +0 -1
  324. package/dist/compat/emitter.d.ts.map +0 -1
  325. package/dist/compat/emitter.js.map +0 -1
  326. package/dist/compat/index.d.ts.map +0 -1
  327. package/dist/compat/result.d.ts.map +0 -1
  328. package/dist/compat/result.js.map +0 -1
  329. package/dist/errors.d.ts.map +0 -1
  330. package/dist/errors.js.map +0 -1
  331. package/dist/events.d.ts.map +0 -1
  332. package/dist/index.d.ts.map +0 -1
  333. package/dist/index.js.map +0 -1
  334. package/dist/kernel.d.ts.map +0 -1
  335. package/dist/kernel.js.map +0 -1
  336. package/dist/locales/af.d.ts.map +0 -1
  337. package/dist/locales/af.js.map +0 -1
  338. package/dist/locales/ar.d.ts.map +0 -1
  339. package/dist/locales/ar.js.map +0 -1
  340. package/dist/locales/backup-en.d.ts +0 -3
  341. package/dist/locales/backup-en.d.ts.map +0 -1
  342. package/dist/locales/bn.d.ts.map +0 -1
  343. package/dist/locales/bn.js.map +0 -1
  344. package/dist/locales/da.d.ts.map +0 -1
  345. package/dist/locales/da.js.map +0 -1
  346. package/dist/locales/de.d.ts.map +0 -1
  347. package/dist/locales/de.js.map +0 -1
  348. package/dist/locales/en.d.ts.map +0 -1
  349. package/dist/locales/en.js.map +0 -1
  350. package/dist/locales/es-MX.d.ts.map +0 -1
  351. package/dist/locales/es-MX.js.map +0 -1
  352. package/dist/locales/es.d.ts.map +0 -1
  353. package/dist/locales/es.js.map +0 -1
  354. package/dist/locales/fi.d.ts.map +0 -1
  355. package/dist/locales/fi.js.map +0 -1
  356. package/dist/locales/fr.d.ts.map +0 -1
  357. package/dist/locales/fr.js.map +0 -1
  358. package/dist/locales/hi.d.ts.map +0 -1
  359. package/dist/locales/hi.js.map +0 -1
  360. package/dist/locales/id.d.ts.map +0 -1
  361. package/dist/locales/id.js.map +0 -1
  362. package/dist/locales/index.d.ts.map +0 -1
  363. package/dist/locales/index.js.map +0 -1
  364. package/dist/locales/it.d.ts.map +0 -1
  365. package/dist/locales/it.js.map +0 -1
  366. package/dist/locales/ja.d.ts.map +0 -1
  367. package/dist/locales/ja.js.map +0 -1
  368. package/dist/locales/ko.d.ts.map +0 -1
  369. package/dist/locales/ko.js.map +0 -1
  370. package/dist/locales/lazy.d.ts.map +0 -1
  371. package/dist/locales/lazy.js.map +0 -1
  372. package/dist/locales/nl.d.ts.map +0 -1
  373. package/dist/locales/nl.js.map +0 -1
  374. package/dist/locales/no.d.ts.map +0 -1
  375. package/dist/locales/no.js.map +0 -1
  376. package/dist/locales/pl.d.ts.map +0 -1
  377. package/dist/locales/pl.js.map +0 -1
  378. package/dist/locales/pt-BR.d.ts.map +0 -1
  379. package/dist/locales/pt-BR.js.map +0 -1
  380. package/dist/locales/pt.d.ts.map +0 -1
  381. package/dist/locales/pt.js.map +0 -1
  382. package/dist/locales/ru.d.ts.map +0 -1
  383. package/dist/locales/ru.js.map +0 -1
  384. package/dist/locales/sv.d.ts.map +0 -1
  385. package/dist/locales/sv.js.map +0 -1
  386. package/dist/locales/sw.d.ts.map +0 -1
  387. package/dist/locales/sw.js.map +0 -1
  388. package/dist/locales/th.d.ts.map +0 -1
  389. package/dist/locales/th.js.map +0 -1
  390. package/dist/locales/tr.d.ts.map +0 -1
  391. package/dist/locales/tr.js.map +0 -1
  392. package/dist/locales/types.d.ts.map +0 -1
  393. package/dist/locales/vi.d.ts.map +0 -1
  394. package/dist/locales/vi.js.map +0 -1
  395. package/dist/locales/zh.d.ts.map +0 -1
  396. package/dist/locales/zh.js.map +0 -1
  397. package/dist/logger.d.ts.map +0 -1
  398. package/dist/mini.d.ts.map +0 -1
  399. package/dist/mini.js.map +0 -1
  400. package/dist/pigment.d.ts.map +0 -1
  401. package/dist/pigment.js.map +0 -1
  402. package/dist/plugins/index.d.ts.map +0 -1
  403. package/dist/plugins/types.d.ts.map +0 -1
  404. package/dist/utils/codec-utils.d.ts.map +0 -1
  405. package/dist/utils/deep-merge.d.ts.map +0 -1
  406. package/dist/utils/ip-validation.d.ts.map +0 -1
  407. package/dist/utils/json-schema.d.ts.map +0 -1
  408. package/dist/utils/security.d.ts.map +0 -1
  409. package/dist/validators/any.d.ts.map +0 -1
  410. package/dist/validators/array.d.ts.map +0 -1
  411. package/dist/validators/base.d.ts.map +0 -1
  412. package/dist/validators/base64.d.ts.map +0 -1
  413. package/dist/validators/bigint.d.ts.map +0 -1
  414. package/dist/validators/boolean.d.ts.map +0 -1
  415. package/dist/validators/codec.d.ts.map +0 -1
  416. package/dist/validators/custom.d.ts.map +0 -1
  417. package/dist/validators/date.d.ts.map +0 -1
  418. package/dist/validators/discriminated-union.d.ts.map +0 -1
  419. package/dist/validators/enum.d.ts.map +0 -1
  420. package/dist/validators/file.d.ts.map +0 -1
  421. package/dist/validators/function.d.ts.map +0 -1
  422. package/dist/validators/hex.d.ts.map +0 -1
  423. package/dist/validators/index.d.ts.map +0 -1
  424. package/dist/validators/index.js.map +0 -1
  425. package/dist/validators/intersection.d.ts.map +0 -1
  426. package/dist/validators/json.d.ts.map +0 -1
  427. package/dist/validators/lazy.d.ts.map +0 -1
  428. package/dist/validators/literal.d.ts.map +0 -1
  429. package/dist/validators/map.d.ts.map +0 -1
  430. package/dist/validators/nan.d.ts.map +0 -1
  431. package/dist/validators/never.d.ts.map +0 -1
  432. package/dist/validators/null.d.ts.map +0 -1
  433. package/dist/validators/number.d.ts.map +0 -1
  434. package/dist/validators/object.d.ts.map +0 -1
  435. package/dist/validators/promise.d.ts.map +0 -1
  436. package/dist/validators/record.d.ts.map +0 -1
  437. package/dist/validators/set.d.ts.map +0 -1
  438. package/dist/validators/string-bool.d.ts.map +0 -1
  439. package/dist/validators/string-formats.d.ts.map +0 -1
  440. package/dist/validators/string.d.ts.map +0 -1
  441. package/dist/validators/symbol.d.ts.map +0 -1
  442. package/dist/validators/template-literal.d.ts.map +0 -1
  443. package/dist/validators/tuple.d.ts.map +0 -1
  444. package/dist/validators/uint8array.d.ts.map +0 -1
  445. package/dist/validators/undefined.d.ts.map +0 -1
  446. package/dist/validators/union.d.ts.map +0 -1
  447. package/dist/validators/unknown.d.ts.map +0 -1
  448. package/dist/validators/void.d.ts.map +0 -1
  449. package/dist/validators/xor.d.ts.map +0 -1
@@ -0,0 +1,200 @@
1
+ import { VldBase, VLD_VALIDATOR_TYPES } from './base.js';
2
+ import { createIssue } from '../errors.js';
3
+ import { getMessages } from '../locales/runtime.js';
4
+ import { V as VldError } from '../chunks/errors-core-BeiFUtZM.js';
5
+
6
+ /**
7
+ * Codec validator for bidirectional transformations
8
+ * Enables converting between different data representations
9
+ */
10
+ class VldCodec extends VldBase {
11
+ constructor(inputValidator, outputValidator, codecTransform) {
12
+ super(VLD_VALIDATOR_TYPES.CODEC);
13
+ this.inputValidator = inputValidator;
14
+ this.outputValidator = outputValidator;
15
+ this.codecTransform = codecTransform;
16
+ }
17
+ /**
18
+ * Parse (decode) a value from input to output format
19
+ */
20
+ parse(value) {
21
+ const result = this.safeParse(value);
22
+ if (!result.success) {
23
+ throw result.error;
24
+ }
25
+ return result.data;
26
+ }
27
+ /**
28
+ * Safely parse (decode) a value from input to output format
29
+ */
30
+ safeParse(value) {
31
+ // First validate the input
32
+ const inputResult = this.inputValidator.safeParse(value);
33
+ if (!inputResult.success) {
34
+ return { success: false, error: inputResult.error };
35
+ }
36
+ try {
37
+ // Then decode to output
38
+ const decoded = this.codecTransform.decode(inputResult.data);
39
+ // Handle async decode
40
+ if (decoded instanceof Promise) {
41
+ throw new VldError([
42
+ createIssue('custom', [], getMessages().codecAsyncNotSupported)
43
+ ]);
44
+ }
45
+ // Validate the decoded output
46
+ return this.outputValidator.safeParse(decoded);
47
+ }
48
+ catch (error) {
49
+ if (error instanceof VldError) {
50
+ return { success: false, error };
51
+ }
52
+ return {
53
+ success: false,
54
+ error: new VldError([
55
+ createIssue('custom', [], getMessages().codecDecodeFailed)
56
+ ])
57
+ };
58
+ }
59
+ }
60
+ /**
61
+ * Create a new codec with input and output directions swapped.
62
+ */
63
+ invert() {
64
+ return new VldCodec(this.outputValidator, this.inputValidator, {
65
+ decode: this.codecTransform.encode,
66
+ encode: this.codecTransform.decode
67
+ });
68
+ }
69
+ /**
70
+ * Encode a value from output back to input format
71
+ */
72
+ encode(value) {
73
+ const result = this.safeEncode(value);
74
+ if (!result.success) {
75
+ throw result.error;
76
+ }
77
+ return result.data;
78
+ }
79
+ /**
80
+ * Safely encode a value from output back to input format
81
+ */
82
+ safeEncode(value) {
83
+ // First validate the output
84
+ const outputResult = this.outputValidator.safeParse(value);
85
+ if (!outputResult.success) {
86
+ return { success: false, error: outputResult.error };
87
+ }
88
+ try {
89
+ // Then encode to input
90
+ const encoded = this.codecTransform.encode(outputResult.data);
91
+ // Handle async encode
92
+ if (encoded instanceof Promise) {
93
+ throw new VldError([
94
+ createIssue('custom', [], getMessages().codecAsyncNotSupported)
95
+ ]);
96
+ }
97
+ // Validate the encoded input
98
+ return this.inputValidator.safeParse(encoded);
99
+ }
100
+ catch (error) {
101
+ if (error instanceof VldError) {
102
+ return { success: false, error };
103
+ }
104
+ return {
105
+ success: false,
106
+ error: new VldError([
107
+ createIssue('custom', [], getMessages().codecEncodeFailed)
108
+ ])
109
+ };
110
+ }
111
+ }
112
+ /**
113
+ * Async version of parse (decode)
114
+ */
115
+ async parseAsync(value) {
116
+ const result = await this.safeParseAsync(value);
117
+ if (!result.success) {
118
+ throw result.error;
119
+ }
120
+ return result.data;
121
+ }
122
+ /**
123
+ * Async version of safeParse (decode)
124
+ */
125
+ async safeParseAsync(value) {
126
+ // First validate the input
127
+ const inputResult = this.inputValidator.safeParse(value);
128
+ if (!inputResult.success) {
129
+ return { success: false, error: inputResult.error };
130
+ }
131
+ try {
132
+ // Then decode to output (supports async)
133
+ const decoded = await this.codecTransform.decode(inputResult.data);
134
+ // Validate the decoded output
135
+ return this.outputValidator.safeParse(decoded);
136
+ }
137
+ catch (error) {
138
+ if (error instanceof VldError) {
139
+ return { success: false, error };
140
+ }
141
+ return {
142
+ success: false,
143
+ error: new VldError([
144
+ createIssue('custom', [], getMessages().codecDecodeFailed)
145
+ ])
146
+ };
147
+ }
148
+ }
149
+ /**
150
+ * Async version of encode
151
+ */
152
+ async encodeAsync(value) {
153
+ const result = await this.safeEncodeAsync(value);
154
+ if (!result.success) {
155
+ throw result.error;
156
+ }
157
+ return result.data;
158
+ }
159
+ /**
160
+ * Async version of safeEncode
161
+ */
162
+ async safeEncodeAsync(value) {
163
+ // First validate the output
164
+ const outputResult = this.outputValidator.safeParse(value);
165
+ if (!outputResult.success) {
166
+ return { success: false, error: outputResult.error };
167
+ }
168
+ try {
169
+ // Then encode to input (supports async)
170
+ const encoded = await this.codecTransform.encode(outputResult.data);
171
+ // Validate the encoded input
172
+ return this.inputValidator.safeParse(encoded);
173
+ }
174
+ catch (error) {
175
+ if (error instanceof VldError) {
176
+ return { success: false, error };
177
+ }
178
+ return {
179
+ success: false,
180
+ error: new VldError([
181
+ createIssue('custom', [], getMessages().codecEncodeFailed)
182
+ ])
183
+ };
184
+ }
185
+ }
186
+ /**
187
+ * Create a codec validator
188
+ */
189
+ static create(inputValidator, outputValidator, codecTransform) {
190
+ return new VldCodec(inputValidator, outputValidator, codecTransform);
191
+ }
192
+ /**
193
+ * Create a codec with input and output directions swapped.
194
+ */
195
+ static invert(codec) {
196
+ return codec.invert();
197
+ }
198
+ }
199
+
200
+ export { VldCodec };
@@ -1,4 +1,4 @@
1
- import { VldBase, ParseResult } from './base';
1
+ import { VldBase, ParseResult } from './base.js';
2
2
  /**
3
3
  * Type-safe custom validator options
4
4
  */
@@ -7,11 +7,21 @@ export interface CustomValidatorOptions<TOutput> {
7
7
  * Parse function that validates and transforms input
8
8
  */
9
9
  parse: (value: unknown) => TOutput;
10
+ /**
11
+ * Optional async parse implementation
12
+ * If not provided, async parsing delegates to parse()
13
+ */
14
+ parseAsync?: (value: unknown) => Promise<TOutput>;
10
15
  /**
11
16
  * Optional safeParse implementation
12
17
  * If not provided, will use try-catch around parse()
13
18
  */
14
19
  safeParse?: (value: unknown) => ParseResult<TOutput>;
20
+ /**
21
+ * Optional async safeParse implementation
22
+ * If not provided, will use try-catch around parseAsync()
23
+ */
24
+ safeParseAsync?: (value: unknown) => Promise<ParseResult<TOutput>>;
15
25
  }
16
26
  /**
17
27
  * Immutable custom validator for user-defined validation logic
@@ -19,7 +29,9 @@ export interface CustomValidatorOptions<TOutput> {
19
29
  */
20
30
  export declare class VldCustom<TOutput = unknown> extends VldBase<unknown, TOutput> {
21
31
  private readonly _parseFn;
32
+ private readonly _parseAsyncFn;
22
33
  private readonly _safeParseFn;
34
+ private readonly _safeParseAsyncFn;
23
35
  private constructor();
24
36
  /**
25
37
  * Create a new custom validator
@@ -33,6 +45,8 @@ export declare class VldCustom<TOutput = unknown> extends VldBase<unknown, TOutp
33
45
  * Safely parse using the custom safeParse function or default implementation
34
46
  */
35
47
  safeParse(value: unknown): ParseResult<TOutput>;
48
+ parseAsync(value: unknown): Promise<TOutput>;
49
+ safeParseAsync(value: unknown): Promise<ParseResult<TOutput>>;
36
50
  }
37
51
  /**
38
52
  * Helper function to create custom validators
@@ -44,4 +58,3 @@ export declare class VldCustom<TOutput = unknown> extends VldBase<unknown, TOutp
44
58
  * })
45
59
  */
46
60
  export declare function custom<TOutput = unknown>(options: CustomValidatorOptions<TOutput>): VldCustom<TOutput>;
47
- //# sourceMappingURL=custom.d.ts.map
@@ -0,0 +1,67 @@
1
+ import { VldBase, VLD_VALIDATOR_TYPES } from './base.js';
2
+
3
+ /**
4
+ * Immutable custom validator for user-defined validation logic
5
+ * Provides type safety while allowing complete control over validation
6
+ */
7
+ class VldCustom extends VldBase {
8
+ constructor(options) {
9
+ super(VLD_VALIDATOR_TYPES.CUSTOM);
10
+ this._parseFn = options.parse;
11
+ this._parseAsyncFn = options.parseAsync || ((value) => Promise.resolve(this._parseFn(value)));
12
+ this._safeParseFn = options.safeParse || ((value) => {
13
+ try {
14
+ return { success: true, data: this._parseFn(value) };
15
+ }
16
+ catch (error) {
17
+ return { success: false, error: error };
18
+ }
19
+ });
20
+ this._safeParseAsyncFn = options.safeParseAsync || (async (value) => {
21
+ try {
22
+ return { success: true, data: await this._parseAsyncFn(value) };
23
+ }
24
+ catch (error) {
25
+ return { success: false, error: error };
26
+ }
27
+ });
28
+ }
29
+ /**
30
+ * Create a new custom validator
31
+ */
32
+ static create(options) {
33
+ return new VldCustom(options);
34
+ }
35
+ /**
36
+ * Parse and validate using the custom parse function
37
+ */
38
+ parse(value) {
39
+ return this._parseFn(value);
40
+ }
41
+ /**
42
+ * Safely parse using the custom safeParse function or default implementation
43
+ */
44
+ safeParse(value) {
45
+ return this._safeParseFn(value);
46
+ }
47
+ async parseAsync(value) {
48
+ return this._parseAsyncFn(value);
49
+ }
50
+ async safeParseAsync(value) {
51
+ return this._safeParseAsyncFn(value);
52
+ }
53
+ }
54
+ /**
55
+ * Helper function to create custom validators
56
+ * Usage: v.custom<number>({
57
+ * parse: (value) => {
58
+ * if (typeof value !== 'string') throw new Error('Expected string');
59
+ * return parseInt(value, 10);
60
+ * }
61
+ * })
62
+ */
63
+ function custom(options) {
64
+ return VldCustom.create(options);
65
+ }
66
+
67
+ export { VldCustom, custom };
@@ -1,4 +1,4 @@
1
- import { VldBase, ParseResult } from './base';
1
+ import { VldBase, ParseResult, ValidatorType } from './base.js';
2
2
  /**
3
3
  * Type for date validation check functions
4
4
  */
@@ -7,22 +7,33 @@ interface DateCheck {
7
7
  fn: DateCheckFn;
8
8
  message: string;
9
9
  }
10
+ interface DateJSONSchemaHints {
11
+ readonly formatMinimum?: string;
12
+ readonly formatMaximum?: string;
13
+ readonly formatExclusiveMinimum?: string;
14
+ readonly formatExclusiveMaximum?: string;
15
+ }
10
16
  /**
11
17
  * Configuration for date validator
12
18
  */
13
19
  interface DateValidatorConfig {
14
20
  readonly checks: ReadonlyArray<DateCheck>;
15
- readonly errorMessage?: string;
21
+ readonly errorMessage: string | undefined;
22
+ readonly validatorType?: ValidatorType;
23
+ readonly jsonSchema: DateJSONSchemaHints | undefined;
16
24
  }
17
25
  /**
18
26
  * Immutable date validator with chainable methods
19
27
  */
20
28
  export declare class VldDate extends VldBase<Date, Date> {
21
29
  private readonly config;
30
+ private readonly _checks;
31
+ private readonly _isSimple;
22
32
  /**
23
33
  * Protected constructor to allow extension while maintaining immutability
24
34
  */
25
35
  protected constructor(config?: Partial<DateValidatorConfig>);
36
+ get jsonSchema(): DateJSONSchemaHints | undefined;
26
37
  /**
27
38
  * Create a new date validator
28
39
  */
@@ -31,6 +42,12 @@ export declare class VldDate extends VldBase<Date, Date> {
31
42
  * Parse and validate a date value
32
43
  */
33
44
  parse(value: unknown): Date;
45
+ /**
46
+ * Parse a Date instance that has already passed the Date validity check.
47
+ * @internal Used by object validators to avoid duplicate hot-path checks.
48
+ */
49
+ parseKnownDate(value: Date): Date;
50
+ private parseValidDate;
34
51
  /**
35
52
  * Safely parse and validate a date value
36
53
  */
@@ -85,4 +102,3 @@ export declare class VldDate extends VldBase<Date, Date> {
85
102
  lt(value: Date | number, message?: string): VldDate;
86
103
  }
87
104
  export {};
88
- //# sourceMappingURL=date.d.ts.map
@@ -0,0 +1,274 @@
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 createDateError(message) {
6
+ return new VldError([{ code: 'invalid_date', path: [], message }]);
7
+ }
8
+ /**
9
+ * Immutable date validator with chainable methods
10
+ */
11
+ class VldDate extends VldBase {
12
+ /**
13
+ * Protected constructor to allow extension while maintaining immutability
14
+ */
15
+ constructor(config) {
16
+ super(config?.validatorType || VLD_VALIDATOR_TYPES.DATE);
17
+ this.config = {
18
+ checks: config?.checks || [],
19
+ errorMessage: config?.errorMessage,
20
+ jsonSchema: config?.jsonSchema
21
+ };
22
+ this._checks = this.config.checks;
23
+ this._isSimple = this._checks.length === 0;
24
+ }
25
+ get jsonSchema() {
26
+ return this.config.jsonSchema;
27
+ }
28
+ /**
29
+ * Create a new date validator
30
+ */
31
+ static create() {
32
+ return new VldDate();
33
+ }
34
+ /**
35
+ * Parse and validate a date value
36
+ */
37
+ parse(value) {
38
+ let date;
39
+ if (value instanceof Date) {
40
+ date = value;
41
+ }
42
+ else if (typeof value === 'string' || typeof value === 'number') {
43
+ date = new Date(value);
44
+ }
45
+ else {
46
+ throw new Error(this.config.errorMessage || getMessages().invalidDate);
47
+ }
48
+ // Check if the date is valid
49
+ if (isNaN(date.getTime())) {
50
+ throw new Error(this.config.errorMessage || getMessages().invalidDate);
51
+ }
52
+ return this.parseValidDate(date);
53
+ }
54
+ /**
55
+ * Parse a Date instance that has already passed the Date validity check.
56
+ * @internal Used by object validators to avoid duplicate hot-path checks.
57
+ */
58
+ parseKnownDate(value) {
59
+ if (isNaN(value.getTime())) {
60
+ throw new Error(this.config.errorMessage || getMessages().invalidDate);
61
+ }
62
+ return this.parseValidDate(value);
63
+ }
64
+ parseValidDate(date) {
65
+ if (this._isSimple) {
66
+ return date;
67
+ }
68
+ // Apply all checks
69
+ for (const check of this._checks) {
70
+ if (!check.fn(date)) {
71
+ throw new Error(check.message);
72
+ }
73
+ }
74
+ return date;
75
+ }
76
+ /**
77
+ * Safely parse and validate a date value
78
+ */
79
+ safeParse(value) {
80
+ if (value instanceof Date) {
81
+ try {
82
+ return { success: true, data: this.parseKnownDate(value) };
83
+ }
84
+ catch (error) {
85
+ return { success: false, error: createDateError(error.message) };
86
+ }
87
+ }
88
+ try {
89
+ return { success: true, data: this.parse(value) };
90
+ }
91
+ catch (error) {
92
+ return { success: false, error: createDateError(error.message) };
93
+ }
94
+ }
95
+ /**
96
+ * Create a new validator with minimum date constraint
97
+ * BUG-NEW-009 FIX: Validate that min date is valid before creating validator
98
+ */
99
+ min(date, message) {
100
+ const minDate = date instanceof Date ? date : new Date(date);
101
+ // Validate that minDate is valid
102
+ if (isNaN(minDate.getTime())) {
103
+ throw new Error(`Invalid date provided to min(): ${date}`);
104
+ }
105
+ return new VldDate({
106
+ ...this.config,
107
+ checks: [...this.config.checks, {
108
+ fn: (v) => v >= minDate,
109
+ message: message || getMessages().dateMin(minDate)
110
+ }],
111
+ jsonSchema: { ...this.config.jsonSchema, formatMinimum: minDate.toISOString() }
112
+ });
113
+ }
114
+ /**
115
+ * Create a new validator with maximum date constraint
116
+ * BUG-NEW-009 FIX: Validate that max date is valid before creating validator
117
+ */
118
+ max(date, message) {
119
+ const maxDate = date instanceof Date ? date : new Date(date);
120
+ // Validate that maxDate is valid
121
+ if (isNaN(maxDate.getTime())) {
122
+ throw new Error(`Invalid date provided to max(): ${date}`);
123
+ }
124
+ return new VldDate({
125
+ ...this.config,
126
+ checks: [...this.config.checks, {
127
+ fn: (v) => v <= maxDate,
128
+ message: message || getMessages().dateMax(maxDate)
129
+ }],
130
+ jsonSchema: { ...this.config.jsonSchema, formatMaximum: maxDate.toISOString() }
131
+ });
132
+ }
133
+ /**
134
+ * Create a new validator with a range constraint
135
+ * BUG-NEW-019 FIX: Validate that min/max dates are valid before creating validator
136
+ */
137
+ between(min, max, message) {
138
+ const minDate = min instanceof Date ? min : new Date(min);
139
+ const maxDate = max instanceof Date ? max : new Date(max);
140
+ // Validate that both dates are valid
141
+ if (isNaN(minDate.getTime())) {
142
+ throw new Error(`Invalid min date provided to between(): ${min}`);
143
+ }
144
+ if (isNaN(maxDate.getTime())) {
145
+ throw new Error(`Invalid max date provided to between(): ${max}`);
146
+ }
147
+ return new VldDate({
148
+ ...this.config,
149
+ checks: [...this.config.checks, {
150
+ fn: (v) => v >= minDate && v <= maxDate,
151
+ message: message || `Date must be between ${minDate.toISOString()} and ${maxDate.toISOString()}`
152
+ }],
153
+ jsonSchema: {
154
+ ...this.config.jsonSchema,
155
+ formatMinimum: minDate.toISOString(),
156
+ formatMaximum: maxDate.toISOString()
157
+ }
158
+ });
159
+ }
160
+ /**
161
+ * Create a new validator that checks if date is in the past
162
+ * BUG-NEW-006 FIX: Capture reference date at validator creation time for deterministic behavior
163
+ */
164
+ past(message) {
165
+ const referenceDate = new Date(); // Capture NOW at validator creation time
166
+ return new VldDate({
167
+ ...this.config,
168
+ checks: [...this.config.checks, {
169
+ fn: (v) => v < referenceDate,
170
+ message: message || 'Date must be in the past'
171
+ }],
172
+ jsonSchema: { ...this.config.jsonSchema, formatExclusiveMaximum: referenceDate.toISOString() }
173
+ });
174
+ }
175
+ /**
176
+ * Create a new validator that checks if date is in the future
177
+ * BUG-NEW-006 FIX: Capture reference date at validator creation time for deterministic behavior
178
+ */
179
+ future(message) {
180
+ const referenceDate = new Date(); // Capture NOW at validator creation time
181
+ return new VldDate({
182
+ ...this.config,
183
+ checks: [...this.config.checks, {
184
+ fn: (v) => v > referenceDate,
185
+ message: message || 'Date must be in the future'
186
+ }],
187
+ jsonSchema: { ...this.config.jsonSchema, formatExclusiveMinimum: referenceDate.toISOString() }
188
+ });
189
+ }
190
+ /**
191
+ * Create a new validator that checks if date is today
192
+ * BUG-NEW-008 FIX: Capture reference date at validator creation time for deterministic behavior
193
+ */
194
+ today(message) {
195
+ // Capture the reference date (today) at validator creation time
196
+ const referenceDate = new Date();
197
+ const refYear = referenceDate.getFullYear();
198
+ const refMonth = referenceDate.getMonth();
199
+ const refDate = referenceDate.getDate();
200
+ return new VldDate({
201
+ ...this.config,
202
+ checks: [...this.config.checks, {
203
+ fn: (v) => {
204
+ return v.getFullYear() === refYear &&
205
+ v.getMonth() === refMonth &&
206
+ v.getDate() === refDate;
207
+ },
208
+ message: message || 'Date must be today'
209
+ }]
210
+ });
211
+ }
212
+ /**
213
+ * Create a new validator that checks if date is a weekday
214
+ */
215
+ weekday(message) {
216
+ return new VldDate({
217
+ ...this.config,
218
+ checks: [...this.config.checks, {
219
+ fn: (v) => {
220
+ const day = v.getDay();
221
+ return day >= 1 && day <= 5;
222
+ },
223
+ message: message || 'Date must be a weekday'
224
+ }]
225
+ });
226
+ }
227
+ /**
228
+ * Create a new validator that checks if date is a weekend
229
+ */
230
+ weekend(message) {
231
+ return new VldDate({
232
+ ...this.config,
233
+ checks: [...this.config.checks, {
234
+ fn: (v) => {
235
+ const day = v.getDay();
236
+ return day === 0 || day === 6;
237
+ },
238
+ message: message || 'Date must be a weekend'
239
+ }]
240
+ });
241
+ }
242
+ /**
243
+ * Create a new validator with strict greater than constraint
244
+ * Zod 4 API parity - strictly greater than (not equal to)
245
+ */
246
+ gt(value, message) {
247
+ const compareDate = value instanceof Date ? value : new Date(value);
248
+ return new VldDate({
249
+ ...this.config,
250
+ checks: [...this.config.checks, {
251
+ fn: (v) => v.getTime() > compareDate.getTime(),
252
+ message: message || `Date must be greater than ${compareDate.toISOString()}`
253
+ }],
254
+ jsonSchema: { ...this.config.jsonSchema, formatExclusiveMinimum: compareDate.toISOString() }
255
+ });
256
+ }
257
+ /**
258
+ * Create a new validator with strict less than constraint
259
+ * Zod 4 API parity - strictly less than (not equal to)
260
+ */
261
+ lt(value, message) {
262
+ const compareDate = value instanceof Date ? value : new Date(value);
263
+ return new VldDate({
264
+ ...this.config,
265
+ checks: [...this.config.checks, {
266
+ fn: (v) => v.getTime() < compareDate.getTime(),
267
+ message: message || `Date must be less than ${compareDate.toISOString()}`
268
+ }],
269
+ jsonSchema: { ...this.config.jsonSchema, formatExclusiveMaximum: compareDate.toISOString() }
270
+ });
271
+ }
272
+ }
273
+
274
+ export { VldDate };
@@ -3,8 +3,8 @@
3
3
  * Part of Zod 4 API parity implementation
4
4
  * Provides O(1) lookup performance by using a discriminator key
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
  * Discriminated union validator - validates union based on discriminator key
10
10
  * Much faster than regular union when you have a discriminator field
@@ -13,6 +13,8 @@ export declare class VldDiscriminatedUnion<K extends string, Options extends Vld
13
13
  private readonly _discriminator;
14
14
  private readonly _options;
15
15
  private readonly _discriminatorMap;
16
+ private readonly _stringDiscriminatorMap;
17
+ private readonly _validValues;
16
18
  constructor(_discriminator: K, _options: Options);
17
19
  static create<K extends string, Options extends VldBase<any, any>[]>(discriminator: K, options: Options): VldDiscriminatedUnion<K, Options>;
18
20
  parse(value: unknown): Options[number] extends VldBase<any, infer T> ? T : never;
@@ -26,4 +28,3 @@ export declare class VldDiscriminatedUnion<K extends string, Options extends Vld
26
28
  */
27
29
  getOptions(): Options;
28
30
  }
29
- //# sourceMappingURL=discriminated-union.d.ts.map