@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,181 +1 @@
1
- /**
2
- * Event Emitter Implementation
3
- *
4
- * This module provides a type-safe event emitter,
5
- * compatible with @oxog/emitter when available.
6
- */
7
- /**
8
- * Create a type-safe event emitter
9
- */
10
- function createEmitter() {
11
- const listeners = new Map();
12
- const getListeners = (event) => {
13
- if (!listeners.has(event)) {
14
- listeners.set(event, []);
15
- }
16
- return listeners.get(event);
17
- };
18
- const sortListeners = (event) => {
19
- const eventListeners = getListeners(event);
20
- eventListeners.sort((a, b) => b.priority - a.priority);
21
- };
22
- const on = (event, handler, options = {}) => {
23
- const entry = {
24
- handler,
25
- once: options.once ?? false,
26
- priority: options.priority ?? 0
27
- };
28
- getListeners(event).push(entry);
29
- sortListeners(event);
30
- // Return unsubscribe function
31
- return () => off(event, handler);
32
- };
33
- const once = (event, handler) => {
34
- return on(event, handler, { once: true });
35
- };
36
- const off = (event, handler) => {
37
- const eventListeners = listeners.get(event);
38
- if (!eventListeners)
39
- return;
40
- const index = eventListeners.findIndex((entry) => entry.handler === handler);
41
- if (index !== -1) {
42
- eventListeners.splice(index, 1);
43
- }
44
- };
45
- const emit = (event, payload) => {
46
- const eventListeners = listeners.get(event);
47
- if (!eventListeners || eventListeners.length === 0)
48
- return;
49
- // Create a copy to allow modifications during iteration
50
- const listenersToCall = [...eventListeners];
51
- for (const entry of listenersToCall) {
52
- if (entry.once) {
53
- off(event, entry.handler);
54
- }
55
- try {
56
- entry.handler(payload);
57
- }
58
- catch (error) {
59
- // Log error but don't stop other handlers
60
- console.error(`Error in event handler for "${String(event)}":`, error);
61
- }
62
- }
63
- };
64
- const emitAsync = async (event, payload) => {
65
- const eventListeners = listeners.get(event);
66
- if (!eventListeners || eventListeners.length === 0)
67
- return;
68
- // Create a copy to allow modifications during iteration
69
- const listenersToCall = [...eventListeners];
70
- for (const entry of listenersToCall) {
71
- if (entry.once) {
72
- off(event, entry.handler);
73
- }
74
- try {
75
- await entry.handler(payload);
76
- }
77
- catch (error) {
78
- // Log error but don't stop other handlers
79
- console.error(`Error in async event handler for "${String(event)}":`, error);
80
- }
81
- }
82
- };
83
- const removeAllListeners = (event) => {
84
- if (event !== undefined) {
85
- listeners.delete(event);
86
- }
87
- else {
88
- listeners.clear();
89
- }
90
- };
91
- const listenerCount = (event) => {
92
- return listeners.get(event)?.length ?? 0;
93
- };
94
- const eventNames = () => {
95
- return Array.from(listeners.keys()).filter((key) => {
96
- const eventListeners = listeners.get(key);
97
- return eventListeners !== undefined && eventListeners.length > 0;
98
- });
99
- };
100
- return {
101
- on,
102
- once,
103
- off,
104
- emit,
105
- emitAsync,
106
- removeAllListeners,
107
- listenerCount,
108
- eventNames
109
- };
110
- }
111
- /**
112
- * Mixin to add event emitter capabilities to a class
113
- */
114
- function withEmitter() {
115
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
116
- return function (Base) {
117
- return class extends Base {
118
- constructor() {
119
- super(...arguments);
120
- /** @internal */
121
- this._emitter = createEmitter();
122
- }
123
- on(event, handler, options) {
124
- return this._emitter.on(event, handler, options);
125
- }
126
- once(event, handler) {
127
- return this._emitter.once(event, handler);
128
- }
129
- off(event, handler) {
130
- this._emitter.off(event, handler);
131
- }
132
- emit(event, payload) {
133
- this._emitter.emit(event, payload);
134
- }
135
- async emitAsync(event, payload) {
136
- await this._emitter.emitAsync(event, payload);
137
- }
138
- };
139
- };
140
- }
141
- /**
142
- * Create an event bus for global event handling
143
- */
144
- function createEventBus() {
145
- const emitter = createEmitter();
146
- const createScope = () => {
147
- const unsubscribers = [];
148
- const scopedEmitter = {
149
- on: (event, handler, options) => {
150
- const unsubscribe = emitter.on(event, handler, options);
151
- unsubscribers.push(unsubscribe);
152
- return unsubscribe;
153
- },
154
- once: (event, handler) => {
155
- const unsubscribe = emitter.once(event, handler);
156
- unsubscribers.push(unsubscribe);
157
- return unsubscribe;
158
- },
159
- off: emitter.off,
160
- emit: emitter.emit,
161
- emitAsync: emitter.emitAsync,
162
- removeAllListeners: emitter.removeAllListeners,
163
- listenerCount: emitter.listenerCount,
164
- eventNames: emitter.eventNames,
165
- dispose: () => {
166
- for (const unsubscribe of unsubscribers) {
167
- unsubscribe();
168
- }
169
- unsubscribers.length = 0;
170
- }
171
- };
172
- return scopedEmitter;
173
- };
174
- return {
175
- ...emitter,
176
- createScope
177
- };
178
- }
179
-
180
- export { createEmitter, createEventBus, withEmitter };
181
- //# sourceMappingURL=emitter.js.map
1
+ function e(){const e=new Map,t=t=>(e.has(t)||e.set(t,[]),e.get(t)),n=(e,n,o={})=>{const s={handler:n,once:o.once??!1,priority:o.priority??0};return t(e).push(s),(e=>{t(e).sort((e,t)=>t.priority-e.priority)})(e),()=>r(e,n)},r=(t,n)=>{const r=e.get(t);if(!r)return;const o=r.findIndex(e=>e.handler===n);-1!==o&&r.splice(o,1)};return{on:n,once:(e,t)=>n(e,t,{once:!0}),off:r,emit:(t,n)=>{const o=e.get(t);if(!o||0===o.length)return;const s=[...o];for(const e of s){e.once&&r(t,e.handler);try{e.handler(n)}catch(e){console.error(`Error in event handler for "${String(t)}":`,e)}}},emitAsync:async(t,n)=>{const o=e.get(t);if(!o||0===o.length)return;const s=[...o];for(const e of s){e.once&&r(t,e.handler);try{await e.handler(n)}catch(e){console.error(`Error in async event handler for "${String(t)}":`,e)}}},removeAllListeners:t=>{void 0!==t?e.delete(t):e.clear()},listenerCount:t=>e.get(t)?.length??0,eventNames:()=>Array.from(e.keys()).filter(t=>{const n=e.get(t);return void 0!==n&&n.length>0})}}function t(){return function(t){return class extends t{constructor(){super(...arguments),this._emitter=e()}on(e,t,n){return this._emitter.on(e,t,n)}once(e,t){return this._emitter.once(e,t)}off(e,t){this._emitter.off(e,t)}emit(e,t){this._emitter.emit(e,t)}async emitAsync(e,t){await this._emitter.emitAsync(e,t)}}}}function n(){const t=e();return{...t,createScope:()=>{const e=[];return{on:(n,r,o)=>{const s=t.on(n,r,o);return e.push(s),s},once:(n,r)=>{const o=t.once(n,r);return e.push(o),o},off:t.off,emit:t.emit,emitAsync:t.emitAsync,removeAllListeners:t.removeAllListeners,listenerCount:t.listenerCount,eventNames:t.eventNames,dispose:()=>{for(const t of e)t();e.length=0}}}}}export{e as createEmitter,n as createEventBus,t as withEmitter};
@@ -8,8 +8,7 @@
8
8
  * - Result pattern (@oxog/types compatibility)
9
9
  * - Event emitter (@oxog/emitter compatibility)
10
10
  */
11
- export type { Result, VldResult } from './result';
12
- export { Ok, Err, success, failure, isOk, isErr, isResult, unwrap, unwrapOr, map, mapErr, flatMap, match, tryCatch, tryCatchAsync, all, fromNullable, ResultUtils } from './result';
13
- export type { EventMap, EventHandler, ListenerOptions, Emitter, VldEventHandler } from './emitter';
14
- export { createEmitter, createEventBus, withEmitter } from './emitter';
15
- //# sourceMappingURL=index.d.ts.map
11
+ export type { Result, VldResult } from './result.js';
12
+ export { Ok, Err, success, failure, isOk, isErr, isResult, unwrap, unwrapOr, map, mapErr, flatMap, match, tryCatch, tryCatchAsync, all, fromNullable, ResultUtils } from './result.js';
13
+ export type { EventMap, EventHandler, ListenerOptions, Emitter, VldEventHandler } from './emitter.js';
14
+ export { createEmitter, createEventBus, withEmitter } from './emitter.js';
@@ -4,7 +4,7 @@
4
4
  * This module provides a Result type for functional error handling,
5
5
  * compatible with @oxog/types when available.
6
6
  */
7
- import type { VldError } from '../errors';
7
+ import type { VldError } from '../errors.js';
8
8
  /**
9
9
  * Success result type
10
10
  */
@@ -125,4 +125,3 @@ export declare const ResultUtils: {
125
125
  all: typeof all;
126
126
  fromNullable: typeof fromNullable;
127
127
  };
128
- //# sourceMappingURL=result.d.ts.map
@@ -1,171 +1 @@
1
- /**
2
- * Result Pattern Implementation
3
- *
4
- * This module provides a Result type for functional error handling,
5
- * compatible with @oxog/types when available.
6
- */
7
- /**
8
- * Create a success result
9
- */
10
- function Ok(data) {
11
- return { success: true, data, value: data };
12
- }
13
- /**
14
- * Create an error result
15
- */
16
- function Err(error) {
17
- return { success: false, error };
18
- }
19
- /**
20
- * Create a success result (alias)
21
- */
22
- const success = Ok;
23
- /**
24
- * Create a failure result (alias)
25
- */
26
- const failure = Err;
27
- /**
28
- * Check if result is Ok
29
- */
30
- function isOk(result) {
31
- return result.success === true;
32
- }
33
- /**
34
- * Check if result is Err
35
- */
36
- function isErr(result) {
37
- return result.success === false;
38
- }
39
- /**
40
- * Check if value is a Result
41
- */
42
- function isResult(value) {
43
- return (typeof value === 'object' &&
44
- value !== null &&
45
- 'success' in value &&
46
- typeof value.success === 'boolean');
47
- }
48
- /**
49
- * Unwrap a result, throwing the error if it's an Err
50
- */
51
- function unwrap(result) {
52
- if (isOk(result)) {
53
- return result.data;
54
- }
55
- throw result.error;
56
- }
57
- /**
58
- * Unwrap a result with a default value
59
- */
60
- function unwrapOr(result, defaultValue) {
61
- if (isOk(result)) {
62
- return result.data;
63
- }
64
- return defaultValue;
65
- }
66
- /**
67
- * Map over a successful result
68
- */
69
- function map(result, fn) {
70
- if (isOk(result)) {
71
- return Ok(fn(result.data));
72
- }
73
- return result;
74
- }
75
- /**
76
- * Map over an error result
77
- */
78
- function mapErr(result, fn) {
79
- if (isErr(result)) {
80
- return Err(fn(result.error));
81
- }
82
- return result;
83
- }
84
- /**
85
- * Chain results (flatMap)
86
- */
87
- function flatMap(result, fn) {
88
- if (isOk(result)) {
89
- return fn(result.data);
90
- }
91
- return result;
92
- }
93
- /**
94
- * Pattern match on a result
95
- */
96
- function match(result, handlers) {
97
- if (isOk(result)) {
98
- return handlers.ok(result.data);
99
- }
100
- return handlers.err(result.error);
101
- }
102
- /**
103
- * Try to execute a function and wrap the result
104
- */
105
- function tryCatch(fn) {
106
- try {
107
- return Ok(fn());
108
- }
109
- catch (error) {
110
- return Err(error instanceof Error ? error : new Error(String(error)));
111
- }
112
- }
113
- /**
114
- * Try to execute an async function and wrap the result
115
- */
116
- async function tryCatchAsync(fn) {
117
- try {
118
- return Ok(await fn());
119
- }
120
- catch (error) {
121
- return Err(error instanceof Error ? error : new Error(String(error)));
122
- }
123
- }
124
- /**
125
- * Combine multiple results into a single result
126
- * Returns Ok with array of values if all succeed, Err with first error otherwise
127
- */
128
- function all(results) {
129
- const values = [];
130
- for (const result of results) {
131
- if (isErr(result)) {
132
- return result;
133
- }
134
- values.push(result.data);
135
- }
136
- return Ok(values);
137
- }
138
- /**
139
- * Convert a nullable value to a Result
140
- */
141
- function fromNullable(value, error = new Error('Value is null or undefined')) {
142
- if (value === null || value === undefined) {
143
- return Err(error);
144
- }
145
- return Ok(value);
146
- }
147
- /**
148
- * Result utilities namespace
149
- */
150
- const ResultUtils = {
151
- Ok,
152
- Err,
153
- success,
154
- failure,
155
- isOk,
156
- isErr,
157
- isResult,
158
- unwrap,
159
- unwrapOr,
160
- map,
161
- mapErr,
162
- flatMap,
163
- match,
164
- tryCatch,
165
- tryCatchAsync,
166
- all,
167
- fromNullable
168
- };
169
-
170
- export { Err, Ok, ResultUtils, all, failure, flatMap, fromNullable, isErr, isOk, isResult, map, mapErr, match, success, tryCatch, tryCatchAsync, unwrap, unwrapOr };
171
- //# sourceMappingURL=result.js.map
1
+ function r(r){return{success:!0,data:r,value:r}}function n(r){return{success:!1,error:r}}const t=r,u=n;function e(r){return!0===r.success}function c(r){return!1===r.success}function o(r){return"object"==typeof r&&null!==r&&"success"in r&&"boolean"==typeof r.success}function a(r){if(e(r))return r.data;throw r.error}function s(r,n){return e(r)?r.data:n}function i(n,t){return e(n)?r(t(n.data)):n}function f(r,t){return c(r)?n(t(r.error)):r}function l(r,n){return e(r)?n(r.data):r}function d(r,n){return e(r)?n.ok(r.data):n.err(r.error)}function p(t){try{return r(t())}catch(r){return n(r instanceof Error?r:new Error(String(r)))}}async function y(t){try{return r(await t())}catch(r){return n(r instanceof Error?r:new Error(String(r)))}}function E(n){const t=[];for(const r of n){if(c(r))return r;t.push(r.data)}return r(t)}function h(t,u=new Error("Value is null or undefined")){return null==t?n(u):r(t)}const w={Ok:r,Err:n,success:t,failure:u,isOk:e,isErr:c,isResult:o,unwrap:a,unwrapOr:s,map:i,mapErr:f,flatMap:l,match:d,tryCatch:p,tryCatchAsync:y,all:E,fromNullable:h};export{n as Err,r as Ok,w as ResultUtils,E as all,u as failure,l as flatMap,h as fromNullable,c as isErr,e as isOk,o as isResult,i as map,f as mapErr,d as match,t as success,p as tryCatch,y as tryCatchAsync,a as unwrap,s as unwrapOr};
@@ -0,0 +1,58 @@
1
+ export type VldErrorCode = 'invalid_type' | 'invalid_string' | 'string_too_small' | 'string_too_big' | 'invalid_email' | 'invalid_url' | 'invalid_uuid' | 'invalid_regex' | 'invalid_format' | 'invalid_number' | 'too_small' | 'too_big' | 'not_integer' | 'not_finite' | 'not_safe' | 'not_multiple_of' | 'invalid_boolean' | 'invalid_date' | 'invalid_array' | 'invalid_object' | 'unrecognized_keys' | 'invalid_union' | 'invalid_key' | 'invalid_element' | 'invalid_literal' | 'invalid_value' | 'invalid_enum' | 'custom';
2
+ export interface VldIssue {
3
+ code: VldErrorCode;
4
+ path: (string | number)[];
5
+ message: string;
6
+ expected?: string;
7
+ received?: string;
8
+ keys?: string[];
9
+ minimum?: number;
10
+ maximum?: number;
11
+ exact?: number;
12
+ inclusive?: boolean;
13
+ origin?: string;
14
+ format?: string;
15
+ values?: unknown[];
16
+ pattern?: string;
17
+ }
18
+ /**
19
+ * Map a JavaScript value to Zod 4's type name for `invalid_type` issues.
20
+ * Produces strings like 'string', 'number', 'boolean', 'undefined', 'null',
21
+ * 'array', 'bigint', 'symbol', 'date', 'map', 'set', 'function', 'nan',
22
+ * 'Infinity', '-Infinity', 'object'.
23
+ */
24
+ export declare function getTypeName(value: unknown): string;
25
+ /**
26
+ * Build a Zod 4-compatible `invalid_type` issue.
27
+ */
28
+ export declare function createInvalidTypeIssue(expected: string, received: string, message?: string): VldIssue;
29
+ export interface VldErrorJSON {
30
+ name: string;
31
+ message: string;
32
+ code: string;
33
+ issues: Array<{
34
+ code: string;
35
+ path: (string | number)[];
36
+ message: string;
37
+ expected?: string;
38
+ received?: string;
39
+ keys?: string[];
40
+ minimum?: number;
41
+ maximum?: number;
42
+ exact?: number;
43
+ inclusive?: boolean;
44
+ origin?: string;
45
+ format?: string;
46
+ values?: unknown[];
47
+ pattern?: string;
48
+ }>;
49
+ }
50
+ export declare class VldError extends Error {
51
+ readonly issues: VldIssue[];
52
+ constructor(issues: VldIssue[]);
53
+ get firstError(): VldIssue | undefined;
54
+ get formattedErrors(): string[];
55
+ toJSON(): VldErrorJSON;
56
+ static fromJSON(json: VldErrorJSON): VldError;
57
+ static isVldError(value: unknown): value is VldError;
58
+ }
package/dist/errors.d.ts CHANGED
@@ -1,56 +1,7 @@
1
- import { type Theme } from './pigment';
2
- export type VldErrorCode = 'invalid_type' | 'invalid_string' | 'string_too_small' | 'string_too_big' | 'invalid_email' | 'invalid_url' | 'invalid_uuid' | 'invalid_regex' | 'invalid_number' | 'too_small' | 'too_big' | 'not_integer' | 'not_finite' | 'not_safe' | 'invalid_boolean' | 'invalid_date' | 'invalid_array' | 'invalid_object' | 'unrecognized_keys' | 'invalid_union' | 'invalid_literal' | 'invalid_enum' | 'custom';
3
- export interface VldIssue {
4
- code: VldErrorCode;
5
- path: (string | number)[];
6
- message: string;
7
- expected?: string;
8
- received?: string;
9
- keys?: string[];
10
- minimum?: number;
11
- maximum?: number;
12
- exact?: number;
13
- inclusive?: boolean;
14
- }
15
- export declare class VldError extends Error {
16
- readonly issues: VldIssue[];
17
- constructor(issues: VldIssue[]);
18
- get firstError(): VldIssue | undefined;
19
- get formattedErrors(): string[];
20
- /**
21
- * Convert error to JSON representation
22
- * Compatible with @oxog/types OxogError
23
- */
24
- toJSON(): VldErrorJSON;
25
- /**
26
- * Create VldError from JSON representation
27
- */
28
- static fromJSON(json: VldErrorJSON): VldError;
29
- /**
30
- * Check if a value is a VldError
31
- */
32
- static isVldError(value: unknown): value is VldError;
33
- }
34
- /**
35
- * JSON representation of VldError
36
- */
37
- export interface VldErrorJSON {
38
- name: string;
39
- message: string;
40
- code: string;
41
- issues: Array<{
42
- code: string;
43
- path: (string | number)[];
44
- message: string;
45
- expected?: string;
46
- received?: string;
47
- keys?: string[];
48
- minimum?: number;
49
- maximum?: number;
50
- exact?: number;
51
- inclusive?: boolean;
52
- }>;
53
- }
1
+ import { type Theme } from './pigment.js';
2
+ export { VldError } from './errors-core.js';
3
+ export type { VldErrorCode, VldErrorJSON, VldIssue } from './errors-core.js';
4
+ import { VldError, type VldErrorCode, type VldIssue } from './errors-core.js';
54
5
  export interface VldErrorTree {
55
6
  errors: string[];
56
7
  properties?: Record<string, VldErrorTree>;
@@ -103,4 +54,3 @@ export declare function createIssue(code: VldErrorCode, path: (string | number)[
103
54
  * Helper to determine the type of a value for error messages
104
55
  */
105
56
  export declare function getValueType(value: unknown): string;
106
- //# sourceMappingURL=errors.d.ts.map