@oxog/vld 2.0.2 → 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 (450) hide show
  1. package/CHANGELOG.md +75 -1
  2. package/LICENSE +20 -20
  3. package/README.md +101 -37
  4. package/dist/chunks/errors-core-BeiFUtZM.js +81 -0
  5. package/dist/chunks/{index-CETyGkrv.js → index-0R2ntSud.js} +16 -402
  6. package/dist/chunks/index-BvH403Yy.js +88 -0
  7. package/dist/chunks/security-B0Pd_vSY.js +35 -0
  8. package/dist/chunks/string-BJRQod3t.js +530 -0
  9. package/dist/cjs/chunks/errors-core-DWxLFs2f.cjs +83 -0
  10. package/dist/cjs/chunks/index-BkI37108.cjs +538 -0
  11. package/dist/cjs/chunks/index-Cc3bjUMX.cjs +91 -0
  12. package/dist/cjs/chunks/security-Dc3Jh13T.cjs +37 -0
  13. package/dist/cjs/chunks/string-BKZrc4hs.cjs +533 -0
  14. package/dist/cjs/cli/bin.cjs +506 -0
  15. package/dist/cjs/cli/index.cjs +209 -0
  16. package/dist/cjs/codecs/index.cjs +45 -0
  17. package/dist/{chunks/date-ODue_rtq.js → cjs/coercion/index.cjs} +185 -103
  18. package/dist/cjs/compat/emitter.cjs +184 -0
  19. package/dist/cjs/compat/result.cjs +189 -0
  20. package/dist/cjs/errors.cjs +6 -213
  21. package/dist/cjs/index.cjs +1558 -9647
  22. package/dist/cjs/kernel.cjs +415 -0
  23. package/dist/cjs/locales/af.cjs +108 -0
  24. package/dist/cjs/locales/ar.cjs +108 -0
  25. package/dist/cjs/locales/bn.cjs +108 -0
  26. package/dist/cjs/locales/da.cjs +108 -0
  27. package/dist/cjs/locales/de.cjs +108 -0
  28. package/dist/cjs/locales/en.cjs +108 -0
  29. package/dist/cjs/locales/es-MX.cjs +107 -0
  30. package/dist/cjs/locales/es.cjs +96 -0
  31. package/dist/cjs/locales/fi.cjs +108 -0
  32. package/dist/cjs/locales/fr.cjs +96 -0
  33. package/dist/cjs/locales/hi.cjs +108 -0
  34. package/dist/cjs/locales/id.cjs +108 -0
  35. package/dist/cjs/locales/index.cjs +41 -2875
  36. package/dist/cjs/locales/it.cjs +108 -0
  37. package/dist/cjs/locales/ja.cjs +108 -0
  38. package/dist/cjs/locales/ko.cjs +108 -0
  39. package/dist/cjs/locales/lazy.cjs +42 -3023
  40. package/dist/cjs/locales/nl.cjs +108 -0
  41. package/dist/cjs/locales/no.cjs +108 -0
  42. package/dist/cjs/locales/pl.cjs +108 -0
  43. package/dist/cjs/locales/pt-BR.cjs +108 -0
  44. package/dist/cjs/locales/pt.cjs +108 -0
  45. package/dist/cjs/locales/ru.cjs +108 -0
  46. package/dist/cjs/locales/runtime.cjs +51 -0
  47. package/dist/cjs/locales/sv.cjs +108 -0
  48. package/dist/cjs/locales/sw.cjs +108 -0
  49. package/dist/cjs/locales/th.cjs +108 -0
  50. package/dist/cjs/locales/tr.cjs +108 -0
  51. package/dist/cjs/locales/vi.cjs +108 -0
  52. package/dist/cjs/locales/zh.cjs +108 -0
  53. package/dist/cjs/mini.cjs +121 -7208
  54. package/dist/cjs/pigment.cjs +207 -0
  55. package/dist/cjs/plugins/index.cjs +12 -0
  56. package/dist/cjs/registry.cjs +37 -0
  57. package/dist/cjs/v3/index.cjs +425 -0
  58. package/dist/cjs/v4/core/index.cjs +894 -0
  59. package/dist/cjs/v4/index.cjs +425 -0
  60. package/dist/cjs/v4/locales/index.cjs +130 -0
  61. package/dist/cjs/v4/mini/index.cjs +509 -0
  62. package/dist/cjs/v4-mini/index.cjs +532 -0
  63. package/dist/cjs/validators/any.cjs +40 -0
  64. package/dist/cjs/validators/array.cjs +283 -0
  65. package/dist/cjs/validators/base.cjs +887 -0
  66. package/dist/cjs/validators/base64.cjs +73 -0
  67. package/dist/cjs/validators/bigint.cjs +232 -0
  68. package/dist/cjs/validators/boolean.cjs +146 -0
  69. package/dist/cjs/validators/codec.cjs +205 -0
  70. package/dist/cjs/validators/custom.cjs +71 -0
  71. package/dist/cjs/validators/date.cjs +278 -0
  72. package/dist/cjs/validators/discriminated-union.cjs +130 -0
  73. package/dist/cjs/validators/enum.cjs +154 -0
  74. package/dist/cjs/validators/file.cjs +130 -0
  75. package/dist/cjs/validators/function.cjs +63 -0
  76. package/dist/cjs/validators/hex.cjs +70 -0
  77. package/dist/cjs/validators/index.cjs +123 -0
  78. package/dist/cjs/validators/intersection.cjs +120 -0
  79. package/dist/cjs/validators/json.cjs +70 -0
  80. package/dist/cjs/validators/lazy.cjs +53 -0
  81. package/dist/cjs/validators/literal.cjs +64 -0
  82. package/dist/cjs/validators/map.cjs +218 -0
  83. package/dist/cjs/validators/nan.cjs +41 -0
  84. package/dist/cjs/validators/never.cjs +36 -0
  85. package/dist/cjs/validators/null.cjs +43 -0
  86. package/dist/cjs/validators/number.cjs +427 -0
  87. package/dist/cjs/validators/object.cjs +868 -0
  88. package/dist/cjs/validators/promise.cjs +115 -0
  89. package/dist/cjs/validators/record.cjs +262 -0
  90. package/dist/cjs/validators/set.cjs +203 -0
  91. package/dist/cjs/validators/string-bool.cjs +124 -0
  92. package/dist/cjs/validators/string-formats.cjs +168 -0
  93. package/dist/cjs/validators/string.cjs +12 -0
  94. package/dist/cjs/validators/symbol.cjs +62 -0
  95. package/dist/cjs/validators/template-literal.cjs +108 -0
  96. package/dist/cjs/validators/tuple.cjs +187 -0
  97. package/dist/cjs/validators/uint8array.cjs +106 -0
  98. package/dist/cjs/validators/undefined.cjs +43 -0
  99. package/dist/cjs/validators/union.cjs +191 -0
  100. package/dist/cjs/validators/unknown.cjs +40 -0
  101. package/dist/cjs/validators/void.cjs +48 -0
  102. package/dist/cjs/validators/xor.cjs +69 -0
  103. package/dist/cli/bin.d.ts +0 -1
  104. package/dist/cli/bin.js +407 -0
  105. package/dist/cli/commands/benchmark.d.ts +1 -2
  106. package/dist/cli/commands/validate.d.ts +1 -2
  107. package/dist/cli/index.d.ts +0 -1
  108. package/dist/cli/index.js +205 -0
  109. package/dist/codecs/index.d.ts +21 -4
  110. package/dist/codecs/index.js +11 -4
  111. package/dist/coercion/bigint.d.ts +2 -3
  112. package/dist/coercion/boolean.d.ts +3 -3
  113. package/dist/coercion/date.d.ts +3 -3
  114. package/dist/coercion/index.d.ts +5 -6
  115. package/dist/coercion/index.js +473 -5
  116. package/dist/coercion/number.d.ts +2 -3
  117. package/dist/coercion/string.d.ts +2 -3
  118. package/dist/compat/emitter.d.ts +0 -1
  119. package/dist/compat/emitter.js +0 -1
  120. package/dist/compat/index.d.ts +4 -5
  121. package/dist/compat/result.d.ts +1 -2
  122. package/dist/compat/result.js +0 -1
  123. package/dist/errors-core.d.ts +39 -0
  124. package/dist/errors.d.ts +4 -54
  125. package/dist/errors.js +4 -68
  126. package/dist/events.d.ts +3 -4
  127. package/dist/index.d.ts +1195 -600
  128. package/dist/index.js +1262 -44
  129. package/dist/kernel.d.ts +2 -3
  130. package/dist/kernel.js +10 -6
  131. package/dist/locales/af.d.ts +1 -2
  132. package/dist/locales/af.js +0 -1
  133. package/dist/locales/ar.d.ts +1 -2
  134. package/dist/locales/ar.js +0 -1
  135. package/dist/locales/bn.d.ts +1 -2
  136. package/dist/locales/bn.js +0 -1
  137. package/dist/locales/da.d.ts +1 -2
  138. package/dist/locales/da.js +0 -1
  139. package/dist/locales/de.d.ts +1 -2
  140. package/dist/locales/de.js +0 -1
  141. package/dist/locales/en.d.ts +1 -2
  142. package/dist/locales/en.js +0 -1
  143. package/dist/locales/es-MX.d.ts +1 -2
  144. package/dist/locales/es-MX.js +0 -1
  145. package/dist/locales/es.d.ts +1 -2
  146. package/dist/locales/es.js +0 -1
  147. package/dist/locales/fi.d.ts +1 -2
  148. package/dist/locales/fi.js +0 -1
  149. package/dist/locales/fr.d.ts +1 -2
  150. package/dist/locales/fr.js +0 -1
  151. package/dist/locales/hi.d.ts +1 -2
  152. package/dist/locales/hi.js +0 -1
  153. package/dist/locales/id.d.ts +1 -2
  154. package/dist/locales/id.js +0 -1
  155. package/dist/locales/index.d.ts +10 -15
  156. package/dist/locales/index.js +28 -2
  157. package/dist/locales/it.d.ts +1 -2
  158. package/dist/locales/it.js +0 -1
  159. package/dist/locales/ja.d.ts +1 -2
  160. package/dist/locales/ja.js +0 -1
  161. package/dist/locales/ko.d.ts +1 -2
  162. package/dist/locales/ko.js +0 -1
  163. package/dist/locales/lazy.d.ts +4 -26
  164. package/dist/locales/lazy.js +12 -55
  165. package/dist/locales/nl.d.ts +1 -2
  166. package/dist/locales/nl.js +0 -1
  167. package/dist/locales/no.d.ts +1 -2
  168. package/dist/locales/no.js +0 -1
  169. package/dist/locales/pl.d.ts +1 -2
  170. package/dist/locales/pl.js +0 -1
  171. package/dist/locales/pt-BR.d.ts +1 -2
  172. package/dist/locales/pt-BR.js +0 -1
  173. package/dist/locales/pt.d.ts +1 -2
  174. package/dist/locales/pt.js +0 -1
  175. package/dist/locales/ru.d.ts +1 -2
  176. package/dist/locales/ru.js +0 -1
  177. package/dist/locales/runtime.d.ts +10 -0
  178. package/dist/locales/runtime.js +41 -0
  179. package/dist/locales/sv.d.ts +1 -2
  180. package/dist/locales/sv.js +0 -1
  181. package/dist/locales/sw.d.ts +1 -2
  182. package/dist/locales/sw.js +0 -1
  183. package/dist/locales/th.d.ts +1 -2
  184. package/dist/locales/th.js +0 -1
  185. package/dist/locales/tr.d.ts +1 -2
  186. package/dist/locales/tr.js +0 -1
  187. package/dist/locales/types.d.ts +0 -1
  188. package/dist/locales/vi.d.ts +1 -2
  189. package/dist/locales/vi.js +0 -1
  190. package/dist/locales/zh.d.ts +1 -2
  191. package/dist/locales/zh.js +0 -1
  192. package/dist/logger.d.ts +0 -1
  193. package/dist/mini.d.ts +64 -65
  194. package/dist/mini.js +31 -7
  195. package/dist/pigment.d.ts +0 -1
  196. package/dist/pigment.js +6 -4
  197. package/dist/plugins/index.d.ts +2 -3
  198. package/dist/plugins/index.js +1 -0
  199. package/dist/plugins/types.d.ts +4 -5
  200. package/dist/registry.d.ts +23 -0
  201. package/dist/registry.js +34 -0
  202. package/dist/utils/codec-utils.d.ts +0 -1
  203. package/dist/utils/deep-merge.d.ts +0 -1
  204. package/dist/utils/ip-validation.d.ts +0 -1
  205. package/dist/utils/json-schema.d.ts +77 -0
  206. package/dist/utils/security.d.ts +2 -6
  207. package/dist/v3/index.d.ts +2 -0
  208. package/dist/v3/index.js +46 -0
  209. package/dist/v4/core/index.d.ts +260 -0
  210. package/dist/v4/core/index.js +277 -0
  211. package/dist/v4/index.d.ts +4 -0
  212. package/dist/v4/index.js +50 -0
  213. package/dist/v4/locales/index.d.ts +53 -0
  214. package/dist/v4/locales/index.js +77 -0
  215. package/dist/v4/mini/index.d.ts +2 -0
  216. package/dist/v4/mini/index.js +47 -0
  217. package/dist/v4-mini/index.d.ts +22 -0
  218. package/dist/v4-mini/index.js +75 -0
  219. package/dist/validators/any.d.ts +7 -2
  220. package/dist/validators/any.js +37 -0
  221. package/dist/validators/array.d.ts +9 -2
  222. package/dist/validators/array.js +279 -0
  223. package/dist/validators/base.d.ts +228 -5
  224. package/dist/validators/base.js +868 -0
  225. package/dist/validators/base64.d.ts +1 -2
  226. package/dist/validators/base64.js +68 -0
  227. package/dist/validators/bigint.d.ts +21 -3
  228. package/dist/validators/bigint.js +228 -0
  229. package/dist/validators/boolean.d.ts +13 -4
  230. package/dist/validators/boolean.js +142 -0
  231. package/dist/validators/codec.d.ts +9 -2
  232. package/dist/validators/codec.js +200 -0
  233. package/dist/validators/custom.d.ts +15 -2
  234. package/dist/validators/custom.js +67 -0
  235. package/dist/validators/date.d.ts +19 -3
  236. package/dist/validators/date.js +274 -0
  237. package/dist/validators/discriminated-union.d.ts +4 -3
  238. package/dist/validators/discriminated-union.js +123 -0
  239. package/dist/validators/enum.d.ts +10 -7
  240. package/dist/validators/enum.js +150 -0
  241. package/dist/validators/file.d.ts +7 -2
  242. package/dist/validators/file.js +125 -0
  243. package/dist/validators/function.d.ts +11 -5
  244. package/dist/validators/function.js +58 -0
  245. package/dist/validators/hex.d.ts +1 -2
  246. package/dist/validators/hex.js +65 -0
  247. package/dist/validators/index.d.ts +38 -38
  248. package/dist/validators/index.js +35 -5
  249. package/dist/validators/intersection.d.ts +1 -2
  250. package/dist/validators/intersection.js +116 -0
  251. package/dist/validators/json.d.ts +1 -2
  252. package/dist/validators/json.js +66 -0
  253. package/dist/validators/lazy.d.ts +5 -9
  254. package/dist/validators/lazy.js +50 -0
  255. package/dist/validators/literal.d.ts +2 -2
  256. package/dist/validators/literal.js +60 -0
  257. package/dist/validators/map.d.ts +15 -2
  258. package/dist/validators/map.js +214 -0
  259. package/dist/validators/nan.d.ts +2 -3
  260. package/dist/validators/nan.js +38 -0
  261. package/dist/validators/never.d.ts +1 -2
  262. package/dist/validators/never.js +32 -0
  263. package/dist/validators/null.d.ts +3 -3
  264. package/dist/validators/null.js +40 -0
  265. package/dist/validators/number.d.ts +80 -21
  266. package/dist/validators/number.js +423 -0
  267. package/dist/validators/object.d.ts +30 -9
  268. package/dist/validators/object.js +864 -0
  269. package/dist/validators/promise.d.ts +58 -0
  270. package/dist/validators/promise.js +111 -0
  271. package/dist/validators/record.d.ts +11 -2
  272. package/dist/validators/record.js +258 -0
  273. package/dist/validators/set.d.ts +11 -2
  274. package/dist/validators/set.js +199 -0
  275. package/dist/validators/string-bool.d.ts +7 -10
  276. package/dist/validators/string-bool.js +120 -0
  277. package/dist/validators/string-formats.d.ts +13 -4
  278. package/dist/validators/string-formats.js +135 -0
  279. package/dist/validators/string.d.ts +39 -18
  280. package/dist/validators/string.js +4 -0
  281. package/dist/validators/symbol.d.ts +8 -3
  282. package/dist/validators/symbol.js +58 -0
  283. package/dist/validators/template-literal.d.ts +1 -2
  284. package/dist/validators/template-literal.js +103 -0
  285. package/dist/validators/tuple.d.ts +15 -2
  286. package/dist/validators/tuple.js +183 -0
  287. package/dist/validators/uint8array.d.ts +3 -4
  288. package/dist/validators/uint8array.js +101 -0
  289. package/dist/validators/undefined.d.ts +3 -3
  290. package/dist/validators/undefined.js +40 -0
  291. package/dist/validators/union.d.ts +7 -4
  292. package/dist/validators/union.js +187 -0
  293. package/dist/validators/unknown.d.ts +7 -2
  294. package/dist/{chunks/unknown-SLIH1VCf.js → validators/unknown.js} +12 -3
  295. package/dist/validators/void.d.ts +3 -2
  296. package/dist/validators/void.js +44 -0
  297. package/dist/validators/xor.d.ts +2 -3
  298. package/dist/validators/xor.js +66 -0
  299. package/package.json +116 -31
  300. package/dist/chunks/bigint-DgsCr2dC.js +0 -1709
  301. package/dist/chunks/bigint-DgsCr2dC.js.map +0 -1
  302. package/dist/chunks/date-ODue_rtq.js.map +0 -1
  303. package/dist/chunks/index-BZqWZvVe.js +0 -426
  304. package/dist/chunks/index-BZqWZvVe.js.map +0 -1
  305. package/dist/chunks/index-CETyGkrv.js.map +0 -1
  306. package/dist/chunks/json-o20GFhTh.js +0 -2021
  307. package/dist/chunks/json-o20GFhTh.js.map +0 -1
  308. package/dist/chunks/unknown-SLIH1VCf.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/security.d.ts.map +0 -1
  411. package/dist/validators/any.d.ts.map +0 -1
  412. package/dist/validators/array.d.ts.map +0 -1
  413. package/dist/validators/base.d.ts.map +0 -1
  414. package/dist/validators/base64.d.ts.map +0 -1
  415. package/dist/validators/bigint.d.ts.map +0 -1
  416. package/dist/validators/boolean.d.ts.map +0 -1
  417. package/dist/validators/codec.d.ts.map +0 -1
  418. package/dist/validators/custom.d.ts.map +0 -1
  419. package/dist/validators/date.d.ts.map +0 -1
  420. package/dist/validators/discriminated-union.d.ts.map +0 -1
  421. package/dist/validators/enum.d.ts.map +0 -1
  422. package/dist/validators/file.d.ts.map +0 -1
  423. package/dist/validators/function.d.ts.map +0 -1
  424. package/dist/validators/hex.d.ts.map +0 -1
  425. package/dist/validators/index.d.ts.map +0 -1
  426. package/dist/validators/index.js.map +0 -1
  427. package/dist/validators/intersection.d.ts.map +0 -1
  428. package/dist/validators/json.d.ts.map +0 -1
  429. package/dist/validators/lazy.d.ts.map +0 -1
  430. package/dist/validators/literal.d.ts.map +0 -1
  431. package/dist/validators/map.d.ts.map +0 -1
  432. package/dist/validators/nan.d.ts.map +0 -1
  433. package/dist/validators/never.d.ts.map +0 -1
  434. package/dist/validators/null.d.ts.map +0 -1
  435. package/dist/validators/number.d.ts.map +0 -1
  436. package/dist/validators/object.d.ts.map +0 -1
  437. package/dist/validators/record.d.ts.map +0 -1
  438. package/dist/validators/set.d.ts.map +0 -1
  439. package/dist/validators/string-bool.d.ts.map +0 -1
  440. package/dist/validators/string-formats.d.ts.map +0 -1
  441. package/dist/validators/string.d.ts.map +0 -1
  442. package/dist/validators/symbol.d.ts.map +0 -1
  443. package/dist/validators/template-literal.d.ts.map +0 -1
  444. package/dist/validators/tuple.d.ts.map +0 -1
  445. package/dist/validators/uint8array.d.ts.map +0 -1
  446. package/dist/validators/undefined.d.ts.map +0 -1
  447. package/dist/validators/union.d.ts.map +0 -1
  448. package/dist/validators/unknown.d.ts.map +0 -1
  449. package/dist/validators/void.d.ts.map +0 -1
  450. package/dist/validators/xor.d.ts.map +0 -1
@@ -0,0 +1,184 @@
1
+ 'use strict';
2
+
3
+ /**
4
+ * Event Emitter Implementation
5
+ *
6
+ * This module provides a type-safe event emitter,
7
+ * compatible with @oxog/emitter when available.
8
+ */
9
+ /**
10
+ * Create a type-safe event emitter
11
+ */
12
+ function createEmitter() {
13
+ const listeners = new Map();
14
+ const getListeners = (event) => {
15
+ if (!listeners.has(event)) {
16
+ listeners.set(event, []);
17
+ }
18
+ return listeners.get(event);
19
+ };
20
+ const sortListeners = (event) => {
21
+ const eventListeners = getListeners(event);
22
+ eventListeners.sort((a, b) => b.priority - a.priority);
23
+ };
24
+ const on = (event, handler, options = {}) => {
25
+ const entry = {
26
+ handler,
27
+ once: options.once ?? false,
28
+ priority: options.priority ?? 0
29
+ };
30
+ getListeners(event).push(entry);
31
+ sortListeners(event);
32
+ // Return unsubscribe function
33
+ return () => off(event, handler);
34
+ };
35
+ const once = (event, handler) => {
36
+ return on(event, handler, { once: true });
37
+ };
38
+ const off = (event, handler) => {
39
+ const eventListeners = listeners.get(event);
40
+ if (!eventListeners)
41
+ return;
42
+ const index = eventListeners.findIndex((entry) => entry.handler === handler);
43
+ if (index !== -1) {
44
+ eventListeners.splice(index, 1);
45
+ }
46
+ };
47
+ const emit = (event, payload) => {
48
+ const eventListeners = listeners.get(event);
49
+ if (!eventListeners || eventListeners.length === 0)
50
+ return;
51
+ // Create a copy to allow modifications during iteration
52
+ const listenersToCall = [...eventListeners];
53
+ for (const entry of listenersToCall) {
54
+ if (entry.once) {
55
+ off(event, entry.handler);
56
+ }
57
+ try {
58
+ entry.handler(payload);
59
+ }
60
+ catch (error) {
61
+ // Log error but don't stop other handlers
62
+ console.error(`Error in event handler for "${String(event)}":`, error);
63
+ }
64
+ }
65
+ };
66
+ const emitAsync = async (event, payload) => {
67
+ const eventListeners = listeners.get(event);
68
+ if (!eventListeners || eventListeners.length === 0)
69
+ return;
70
+ // Create a copy to allow modifications during iteration
71
+ const listenersToCall = [...eventListeners];
72
+ for (const entry of listenersToCall) {
73
+ if (entry.once) {
74
+ off(event, entry.handler);
75
+ }
76
+ try {
77
+ await entry.handler(payload);
78
+ }
79
+ catch (error) {
80
+ // Log error but don't stop other handlers
81
+ console.error(`Error in async event handler for "${String(event)}":`, error);
82
+ }
83
+ }
84
+ };
85
+ const removeAllListeners = (event) => {
86
+ if (event !== undefined) {
87
+ listeners.delete(event);
88
+ }
89
+ else {
90
+ listeners.clear();
91
+ }
92
+ };
93
+ const listenerCount = (event) => {
94
+ return listeners.get(event)?.length ?? 0;
95
+ };
96
+ const eventNames = () => {
97
+ return Array.from(listeners.keys()).filter((key) => {
98
+ const eventListeners = listeners.get(key);
99
+ return eventListeners !== undefined && eventListeners.length > 0;
100
+ });
101
+ };
102
+ return {
103
+ on,
104
+ once,
105
+ off,
106
+ emit,
107
+ emitAsync,
108
+ removeAllListeners,
109
+ listenerCount,
110
+ eventNames
111
+ };
112
+ }
113
+ /**
114
+ * Mixin to add event emitter capabilities to a class
115
+ */
116
+ function withEmitter() {
117
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
118
+ return function (Base) {
119
+ return class extends Base {
120
+ constructor() {
121
+ super(...arguments);
122
+ /** @internal */
123
+ this._emitter = createEmitter();
124
+ }
125
+ on(event, handler, options) {
126
+ return this._emitter.on(event, handler, options);
127
+ }
128
+ once(event, handler) {
129
+ return this._emitter.once(event, handler);
130
+ }
131
+ off(event, handler) {
132
+ this._emitter.off(event, handler);
133
+ }
134
+ emit(event, payload) {
135
+ this._emitter.emit(event, payload);
136
+ }
137
+ async emitAsync(event, payload) {
138
+ await this._emitter.emitAsync(event, payload);
139
+ }
140
+ };
141
+ };
142
+ }
143
+ /**
144
+ * Create an event bus for global event handling
145
+ */
146
+ function createEventBus() {
147
+ const emitter = createEmitter();
148
+ const createScope = () => {
149
+ const unsubscribers = [];
150
+ const scopedEmitter = {
151
+ on: (event, handler, options) => {
152
+ const unsubscribe = emitter.on(event, handler, options);
153
+ unsubscribers.push(unsubscribe);
154
+ return unsubscribe;
155
+ },
156
+ once: (event, handler) => {
157
+ const unsubscribe = emitter.once(event, handler);
158
+ unsubscribers.push(unsubscribe);
159
+ return unsubscribe;
160
+ },
161
+ off: emitter.off,
162
+ emit: emitter.emit,
163
+ emitAsync: emitter.emitAsync,
164
+ removeAllListeners: emitter.removeAllListeners,
165
+ listenerCount: emitter.listenerCount,
166
+ eventNames: emitter.eventNames,
167
+ dispose: () => {
168
+ for (const unsubscribe of unsubscribers) {
169
+ unsubscribe();
170
+ }
171
+ unsubscribers.length = 0;
172
+ }
173
+ };
174
+ return scopedEmitter;
175
+ };
176
+ return {
177
+ ...emitter,
178
+ createScope
179
+ };
180
+ }
181
+
182
+ exports.createEmitter = createEmitter;
183
+ exports.createEventBus = createEventBus;
184
+ exports.withEmitter = withEmitter;
@@ -0,0 +1,189 @@
1
+ 'use strict';
2
+
3
+ /**
4
+ * Result Pattern Implementation
5
+ *
6
+ * This module provides a Result type for functional error handling,
7
+ * compatible with @oxog/types when available.
8
+ */
9
+ /**
10
+ * Create a success result
11
+ */
12
+ function Ok(data) {
13
+ return { success: true, data, value: data };
14
+ }
15
+ /**
16
+ * Create an error result
17
+ */
18
+ function Err(error) {
19
+ return { success: false, error };
20
+ }
21
+ /**
22
+ * Create a success result (alias)
23
+ */
24
+ const success = Ok;
25
+ /**
26
+ * Create a failure result (alias)
27
+ */
28
+ const failure = Err;
29
+ /**
30
+ * Check if result is Ok
31
+ */
32
+ function isOk(result) {
33
+ return result.success === true;
34
+ }
35
+ /**
36
+ * Check if result is Err
37
+ */
38
+ function isErr(result) {
39
+ return result.success === false;
40
+ }
41
+ /**
42
+ * Check if value is a Result
43
+ */
44
+ function isResult(value) {
45
+ return (typeof value === 'object' &&
46
+ value !== null &&
47
+ 'success' in value &&
48
+ typeof value.success === 'boolean');
49
+ }
50
+ /**
51
+ * Unwrap a result, throwing the error if it's an Err
52
+ */
53
+ function unwrap(result) {
54
+ if (isOk(result)) {
55
+ return result.data;
56
+ }
57
+ throw result.error;
58
+ }
59
+ /**
60
+ * Unwrap a result with a default value
61
+ */
62
+ function unwrapOr(result, defaultValue) {
63
+ if (isOk(result)) {
64
+ return result.data;
65
+ }
66
+ return defaultValue;
67
+ }
68
+ /**
69
+ * Map over a successful result
70
+ */
71
+ function map(result, fn) {
72
+ if (isOk(result)) {
73
+ return Ok(fn(result.data));
74
+ }
75
+ return result;
76
+ }
77
+ /**
78
+ * Map over an error result
79
+ */
80
+ function mapErr(result, fn) {
81
+ if (isErr(result)) {
82
+ return Err(fn(result.error));
83
+ }
84
+ return result;
85
+ }
86
+ /**
87
+ * Chain results (flatMap)
88
+ */
89
+ function flatMap(result, fn) {
90
+ if (isOk(result)) {
91
+ return fn(result.data);
92
+ }
93
+ return result;
94
+ }
95
+ /**
96
+ * Pattern match on a result
97
+ */
98
+ function match(result, handlers) {
99
+ if (isOk(result)) {
100
+ return handlers.ok(result.data);
101
+ }
102
+ return handlers.err(result.error);
103
+ }
104
+ /**
105
+ * Try to execute a function and wrap the result
106
+ */
107
+ function tryCatch(fn) {
108
+ try {
109
+ return Ok(fn());
110
+ }
111
+ catch (error) {
112
+ return Err(error instanceof Error ? error : new Error(String(error)));
113
+ }
114
+ }
115
+ /**
116
+ * Try to execute an async function and wrap the result
117
+ */
118
+ async function tryCatchAsync(fn) {
119
+ try {
120
+ return Ok(await fn());
121
+ }
122
+ catch (error) {
123
+ return Err(error instanceof Error ? error : new Error(String(error)));
124
+ }
125
+ }
126
+ /**
127
+ * Combine multiple results into a single result
128
+ * Returns Ok with array of values if all succeed, Err with first error otherwise
129
+ */
130
+ function all(results) {
131
+ const values = [];
132
+ for (const result of results) {
133
+ if (isErr(result)) {
134
+ return result;
135
+ }
136
+ values.push(result.data);
137
+ }
138
+ return Ok(values);
139
+ }
140
+ /**
141
+ * Convert a nullable value to a Result
142
+ */
143
+ function fromNullable(value, error = new Error('Value is null or undefined')) {
144
+ if (value === null || value === undefined) {
145
+ return Err(error);
146
+ }
147
+ return Ok(value);
148
+ }
149
+ /**
150
+ * Result utilities namespace
151
+ */
152
+ const ResultUtils = {
153
+ Ok,
154
+ Err,
155
+ success,
156
+ failure,
157
+ isOk,
158
+ isErr,
159
+ isResult,
160
+ unwrap,
161
+ unwrapOr,
162
+ map,
163
+ mapErr,
164
+ flatMap,
165
+ match,
166
+ tryCatch,
167
+ tryCatchAsync,
168
+ all,
169
+ fromNullable
170
+ };
171
+
172
+ exports.Err = Err;
173
+ exports.Ok = Ok;
174
+ exports.ResultUtils = ResultUtils;
175
+ exports.all = all;
176
+ exports.failure = failure;
177
+ exports.flatMap = flatMap;
178
+ exports.fromNullable = fromNullable;
179
+ exports.isErr = isErr;
180
+ exports.isOk = isOk;
181
+ exports.isResult = isResult;
182
+ exports.map = map;
183
+ exports.mapErr = mapErr;
184
+ exports.match = match;
185
+ exports.success = success;
186
+ exports.tryCatch = tryCatch;
187
+ exports.tryCatchAsync = tryCatchAsync;
188
+ exports.unwrap = unwrap;
189
+ exports.unwrapOr = unwrapOr;
@@ -1,216 +1,9 @@
1
1
  'use strict';
2
2
 
3
- /**
4
- * VLD Pigment - Colored Console Output
5
- *
6
- * This module provides ANSI color utilities for terminal output,
7
- * compatible with @oxog/pigment when available.
8
- */
9
- /* eslint-enable @typescript-eslint/no-explicit-any */
10
- /**
11
- * Check if colors are supported in the current environment
12
- */
13
- function supportsColor() {
14
- // Check for NO_COLOR environment variable
15
- if (typeof process !== 'undefined' && process.env?.NO_COLOR) {
16
- return false;
17
- }
18
- // Check for FORCE_COLOR environment variable
19
- if (typeof process !== 'undefined' && process.env?.FORCE_COLOR) {
20
- return true;
21
- }
22
- // Check for TTY
23
- if (typeof process !== 'undefined' && process.stdout?.isTTY) {
24
- return true;
25
- }
26
- // Browser environment - no ANSI colors
27
- if (typeof window !== 'undefined') {
28
- return false;
29
- }
30
- return false;
31
- }
32
- /**
33
- * ANSI escape codes
34
- */
35
- const ANSI = {
36
- // Reset
37
- reset: '\x1b[0m',
38
- // Styles
39
- bold: '\x1b[1m',
40
- dim: '\x1b[2m',
41
- italic: '\x1b[3m',
42
- underline: '\x1b[4m',
43
- inverse: '\x1b[7m',
44
- hidden: '\x1b[8m',
45
- strikethrough: '\x1b[9m',
46
- // Foreground colors
47
- black: '\x1b[30m',
48
- red: '\x1b[31m',
49
- green: '\x1b[32m',
50
- yellow: '\x1b[33m',
51
- blue: '\x1b[34m',
52
- magenta: '\x1b[35m',
53
- cyan: '\x1b[36m',
54
- white: '\x1b[37m',
55
- gray: '\x1b[90m',
56
- grey: '\x1b[90m',
57
- // Bright foreground colors
58
- brightRed: '\x1b[91m',
59
- brightGreen: '\x1b[92m',
60
- brightYellow: '\x1b[93m',
61
- brightBlue: '\x1b[94m',
62
- brightMagenta: '\x1b[95m',
63
- brightCyan: '\x1b[96m',
64
- brightWhite: '\x1b[97m',
65
- // Background colors
66
- bgBlack: '\x1b[40m',
67
- bgRed: '\x1b[41m',
68
- bgGreen: '\x1b[42m',
69
- bgYellow: '\x1b[43m',
70
- bgBlue: '\x1b[44m',
71
- bgMagenta: '\x1b[45m',
72
- bgCyan: '\x1b[46m',
73
- bgWhite: '\x1b[47m'};
74
- /**
75
- * Create a color function
76
- */
77
- function createColorFn(code) {
78
- const enabled = supportsColor();
79
- return (text) => {
80
- if (!enabled || text === '')
81
- return text;
82
- return `${code}${text}${ANSI.reset}`;
83
- };
84
- }
85
- /**
86
- * Pigment - Color utilities for terminal output
87
- */
88
- const pigment = {
89
- // Styles
90
- bold: createColorFn(ANSI.bold),
91
- dim: createColorFn(ANSI.dim),
92
- italic: createColorFn(ANSI.italic),
93
- underline: createColorFn(ANSI.underline),
94
- inverse: createColorFn(ANSI.inverse),
95
- hidden: createColorFn(ANSI.hidden),
96
- strikethrough: createColorFn(ANSI.strikethrough),
97
- // Foreground colors
98
- black: createColorFn(ANSI.black),
99
- red: createColorFn(ANSI.red),
100
- green: createColorFn(ANSI.green),
101
- yellow: createColorFn(ANSI.yellow),
102
- blue: createColorFn(ANSI.blue),
103
- magenta: createColorFn(ANSI.magenta),
104
- cyan: createColorFn(ANSI.cyan),
105
- white: createColorFn(ANSI.white),
106
- gray: createColorFn(ANSI.gray),
107
- grey: createColorFn(ANSI.grey),
108
- // Bright colors
109
- brightRed: createColorFn(ANSI.brightRed),
110
- brightGreen: createColorFn(ANSI.brightGreen),
111
- brightYellow: createColorFn(ANSI.brightYellow),
112
- brightBlue: createColorFn(ANSI.brightBlue),
113
- brightMagenta: createColorFn(ANSI.brightMagenta),
114
- brightCyan: createColorFn(ANSI.brightCyan),
115
- brightWhite: createColorFn(ANSI.brightWhite),
116
- // Background colors
117
- bgBlack: createColorFn(ANSI.bgBlack),
118
- bgRed: createColorFn(ANSI.bgRed),
119
- bgGreen: createColorFn(ANSI.bgGreen),
120
- bgYellow: createColorFn(ANSI.bgYellow),
121
- bgBlue: createColorFn(ANSI.bgBlue),
122
- bgMagenta: createColorFn(ANSI.bgMagenta),
123
- bgCyan: createColorFn(ANSI.bgCyan),
124
- bgWhite: createColorFn(ANSI.bgWhite),
125
- // Semantic colors
126
- success: createColorFn(ANSI.green),
127
- error: createColorFn(ANSI.red),
128
- warning: createColorFn(ANSI.yellow),
129
- info: createColorFn(ANSI.blue),
130
- muted: createColorFn(ANSI.gray)};
131
- // Aliases for convenience
132
- const { bold, dim, red, green, yellow, blue, cyan} = pigment;
133
- /**
134
- * Default VLD theme for error formatting
135
- */
136
- const vldTheme = {
137
- error: red,
138
- success: green,
139
- warning: yellow,
140
- info: blue,
141
- muted: dim,
142
- path: cyan,
143
- value: yellow,
144
- key: bold,
145
- symbol: red
146
- };
3
+ var pigment = require('./pigment.cjs');
4
+ var errorsCore = require('./chunks/errors-core-DWxLFs2f.cjs');
147
5
 
148
6
  // VLD Error System - Advanced error formatting and utilities
149
- class VldError extends Error {
150
- constructor(issues) {
151
- const message = issues.length === 1 ? issues[0].message : `${issues.length} validation errors`;
152
- super(message);
153
- this.name = 'VldError';
154
- this.issues = issues;
155
- // Maintain proper stack trace
156
- if (Error.captureStackTrace) {
157
- Error.captureStackTrace(this, VldError);
158
- }
159
- }
160
- get firstError() {
161
- return this.issues[0];
162
- }
163
- get formattedErrors() {
164
- return this.issues.map((issue) => issue.message);
165
- }
166
- /**
167
- * Convert error to JSON representation
168
- * Compatible with @oxog/types OxogError
169
- */
170
- toJSON() {
171
- return {
172
- name: this.name,
173
- message: this.message,
174
- code: 'VLD_VALIDATION_ERROR',
175
- issues: this.issues.map((issue) => ({
176
- code: issue.code,
177
- path: issue.path,
178
- message: issue.message,
179
- expected: issue.expected,
180
- received: issue.received,
181
- keys: issue.keys,
182
- minimum: issue.minimum,
183
- maximum: issue.maximum,
184
- exact: issue.exact,
185
- inclusive: issue.inclusive
186
- }))
187
- };
188
- }
189
- /**
190
- * Create VldError from JSON representation
191
- */
192
- static fromJSON(json) {
193
- const issues = json.issues.map((issue) => ({
194
- code: issue.code,
195
- path: issue.path,
196
- message: issue.message,
197
- expected: issue.expected,
198
- received: issue.received,
199
- keys: issue.keys,
200
- minimum: issue.minimum,
201
- maximum: issue.maximum,
202
- exact: issue.exact,
203
- inclusive: issue.inclusive
204
- }));
205
- return new VldError(issues);
206
- }
207
- /**
208
- * Check if a value is a VldError
209
- */
210
- static isVldError(value) {
211
- return value instanceof VldError;
212
- }
213
- }
214
7
  /**
215
8
  * Convert VldError to a nested tree structure
216
9
  */
@@ -268,7 +61,7 @@ function treeifyError(error) {
268
61
  * Convert VldError to human-readable string
269
62
  */
270
63
  function prettifyError(error, options = {}) {
271
- const { colored = true, theme = vldTheme, includeCode = false, includeDetails = false } = options;
64
+ const { colored = true, theme = pigment.vldTheme, includeCode = false, includeDetails = false } = options;
272
65
  const lines = [];
273
66
  for (const issue of error.issues) {
274
67
  // Symbol and message
@@ -341,7 +134,8 @@ function flattenError(error) {
341
134
  formErrors.push(issue.message);
342
135
  }
343
136
  else {
344
- const fieldName = issue.path[0].toString();
137
+ const firstPathSegment = issue.path[0];
138
+ const fieldName = firstPathSegment.toString();
345
139
  if (!fieldErrors[fieldName]) {
346
140
  fieldErrors[fieldName] = [];
347
141
  }
@@ -376,7 +170,7 @@ function getValueType(value) {
376
170
  return typeof value;
377
171
  }
378
172
 
379
- exports.VldError = VldError;
173
+ exports.VldError = errorsCore.VldError;
380
174
  exports.createIssue = createIssue;
381
175
  exports.flattenError = flattenError;
382
176
  exports.getValueType = getValueType;
@@ -384,4 +178,3 @@ exports.prettifyError = prettifyError;
384
178
  exports.prettifyErrorColored = prettifyErrorColored;
385
179
  exports.prettifyErrorPlain = prettifyErrorPlain;
386
180
  exports.treeifyError = treeifyError;
387
- //# sourceMappingURL=errors.cjs.map