@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,538 @@
1
+ 'use strict';
2
+
3
+ var validators_codec = require('../validators/codec.cjs');
4
+ var validators_base64 = require('../validators/base64.cjs');
5
+ var validators_hex = require('../validators/hex.cjs');
6
+ var validators_uint8array = require('../validators/uint8array.cjs');
7
+ var validators_string = require('./string-BKZrc4hs.cjs');
8
+ var validators_number = require('../validators/number.cjs');
9
+ var validators_bigint = require('../validators/bigint.cjs');
10
+ var validators_boolean = require('../validators/boolean.cjs');
11
+ var validators_date = require('../validators/date.cjs');
12
+ var validators_unknown = require('../validators/unknown.cjs');
13
+
14
+ /**
15
+ * Utility functions for codec transformations
16
+ */
17
+ /**
18
+ * Convert a base64 string to Uint8Array
19
+ */
20
+ function base64ToUint8Array(base64) {
21
+ // Handle URL-safe base64
22
+ const base64Clean = base64.replace(/-/g, '+').replace(/_/g, '/');
23
+ // Add padding if necessary
24
+ const padded = base64Clean.padEnd(base64Clean.length + (4 - base64Clean.length % 4) % 4, '=');
25
+ // Decode base64 to binary string
26
+ const binaryString = safeAtob(padded);
27
+ // Convert binary string to Uint8Array
28
+ const bytes = new Uint8Array(binaryString.length);
29
+ for (let i = 0; i < binaryString.length; i++) {
30
+ bytes[i] = binaryString.charCodeAt(i);
31
+ }
32
+ return bytes;
33
+ }
34
+ /**
35
+ * Convert Uint8Array to base64 string
36
+ */
37
+ function uint8ArrayToBase64(bytes) {
38
+ // Convert Uint8Array to binary string
39
+ let binaryString = '';
40
+ for (let i = 0; i < bytes.length; i++) {
41
+ binaryString += String.fromCharCode(bytes[i]);
42
+ }
43
+ // Encode to base64
44
+ return safeBtoa(binaryString);
45
+ }
46
+ /**
47
+ * Convert Uint8Array to URL-safe base64 string
48
+ */
49
+ function uint8ArrayToBase64Url(bytes) {
50
+ const base64 = uint8ArrayToBase64(bytes);
51
+ // Make URL-safe and remove padding
52
+ return base64
53
+ .replace(/\+/g, '-')
54
+ .replace(/\//g, '_')
55
+ .replace(/=/g, '');
56
+ }
57
+ /**
58
+ * Convert hex string to Uint8Array
59
+ */
60
+ function hexToUint8Array(hex) {
61
+ // BUG-010 FIX: Add length validation to prevent memory exhaustion
62
+ // 20 million characters = 10MB of data (consistent with base64 limits)
63
+ if (hex.length > 20000000) {
64
+ throw new Error('Hex string is too large (max 10MB)');
65
+ }
66
+ // Remove any 0x prefix if present
67
+ const cleanHex = hex.startsWith('0x') ? hex.slice(2) : hex;
68
+ // BUG-NPM-006 FIX: Validate hex characters to prevent silent data corruption
69
+ // parseInt silently returns NaN for invalid hex, which becomes 0 in Uint8Array
70
+ const hexPattern = /^[0-9a-fA-F]*$/;
71
+ if (!hexPattern.test(cleanHex)) {
72
+ throw new Error('Invalid hex string: contains non-hexadecimal characters');
73
+ }
74
+ // Ensure even length
75
+ const paddedHex = cleanHex.length % 2 === 0 ? cleanHex : '0' + cleanHex;
76
+ const bytes = new Uint8Array(paddedHex.length / 2);
77
+ for (let i = 0; i < paddedHex.length; i += 2) {
78
+ bytes[i / 2] = parseInt(paddedHex.substring(i, i + 2), 16);
79
+ }
80
+ return bytes;
81
+ }
82
+ /**
83
+ * Convert Uint8Array to hex string
84
+ */
85
+ function uint8ArrayToHex(bytes) {
86
+ let hex = '';
87
+ for (let i = 0; i < bytes.length; i++) {
88
+ const byte = bytes[i].toString(16);
89
+ hex += byte.length === 1 ? '0' + byte : byte;
90
+ }
91
+ return hex;
92
+ }
93
+ /**
94
+ * Convert string to Uint8Array using UTF-8 encoding
95
+ * BUG-NEW-011 FIX: Add DoS protection with 10MB limit
96
+ */
97
+ function stringToUint8Array(str) {
98
+ // Add DoS protection - limit to 10MB (consistent with base64 limit)
99
+ const MAX_STRING_LENGTH = 10000000; // 10 million characters (~10MB)
100
+ if (str.length > MAX_STRING_LENGTH) {
101
+ throw new Error(`String is too large for UTF-8 encoding (max ${MAX_STRING_LENGTH} characters)`);
102
+ }
103
+ const encoder = new TextEncoder();
104
+ return encoder.encode(str);
105
+ }
106
+ /**
107
+ * Convert Uint8Array to string using UTF-8 decoding
108
+ * BUG-NEW-012 FIX: Add DoS protection with 10MB limit
109
+ */
110
+ function uint8ArrayToString(bytes) {
111
+ // Add DoS protection - limit to 10MB
112
+ const MAX_BYTES_LENGTH = 10000000; // 10 million bytes
113
+ if (bytes.length > MAX_BYTES_LENGTH) {
114
+ throw new Error(`Byte array is too large for UTF-8 decoding (max ${MAX_BYTES_LENGTH} bytes)`);
115
+ }
116
+ const decoder = new TextDecoder();
117
+ return decoder.decode(bytes);
118
+ }
119
+ /**
120
+ * Check if running in Node.js environment
121
+ */
122
+ function isNodeEnvironment() {
123
+ return typeof globalThis !== 'undefined' &&
124
+ typeof globalThis.process !== 'undefined' &&
125
+ globalThis.process.versions != null &&
126
+ globalThis.process.versions.node != null;
127
+ }
128
+ /**
129
+ * Validate and sanitize base64 input to prevent prototype pollution
130
+ */
131
+ function validateBase64Input(encoded) {
132
+ // Check for null/undefined
133
+ if (encoded == null) {
134
+ throw new Error('Base64 input cannot be null or undefined');
135
+ }
136
+ // Ensure it's a string
137
+ if (typeof encoded !== 'string') {
138
+ throw new Error('Base64 input must be a string');
139
+ }
140
+ // Length validation - base64 strings should be reasonable length
141
+ if (encoded.length > 10000000) { // 10MB limit
142
+ throw new Error('Base64 input is too large');
143
+ }
144
+ // Base64 character validation - only allow valid base64 characters
145
+ const base64Regex = /^[A-Za-z0-9+/]*={0,2}$/;
146
+ if (!base64Regex.test(encoded)) {
147
+ throw new Error('Invalid base64 format');
148
+ }
149
+ // BUG-NEW-004 FIX: Correct base64 padding validation per RFC 4648
150
+ // Base64 only uses '=' or '==' as padding, never '==='
151
+ const paddingIndex = encoded.indexOf('=');
152
+ if (paddingIndex !== -1) {
153
+ const padding = encoded.substring(paddingIndex);
154
+ // Only allow '=' or '==' as valid padding (RFC 4648 compliant)
155
+ if (!/^={1,2}$/.test(padding)) {
156
+ throw new Error('Invalid base64 padding');
157
+ }
158
+ // Padding should only be at the end
159
+ if (paddingIndex < encoded.length - 2) {
160
+ throw new Error('Base64 padding must be at the end');
161
+ }
162
+ }
163
+ // Additional security check: prevent potential encoded JavaScript
164
+ // by looking for suspicious patterns that might indicate malicious content
165
+ const suspiciousPatterns = [
166
+ /eval/i,
167
+ /function/i,
168
+ /javascript:/i,
169
+ /<script/i,
170
+ /on\w+\s*=/i,
171
+ /__proto__/i,
172
+ /constructor/i,
173
+ /prototype/i
174
+ ];
175
+ // Decode a small portion to check for suspicious content
176
+ try {
177
+ const sampleSize = Math.min(100, encoded.length);
178
+ const sample = encoded.substring(0, sampleSize);
179
+ const sampleDecoded = typeof atob !== 'undefined'
180
+ ? atob(sample)
181
+ : Buffer.from(sample, 'base64').toString('utf8', 0, 50); // Only decode first 50 chars
182
+ for (const pattern of suspiciousPatterns) {
183
+ if (pattern.test(sampleDecoded)) {
184
+ throw new Error('Suspicious content detected in base64 input');
185
+ }
186
+ }
187
+ }
188
+ catch (error) {
189
+ if (error instanceof Error && error.message.includes('Suspicious content')) {
190
+ throw error;
191
+ }
192
+ // If decoding fails, continue - it might be invalid base64 which will be caught later
193
+ }
194
+ }
195
+ /**
196
+ * Polyfill for atob in Node.js with proper input validation
197
+ */
198
+ function safeAtob(encoded) {
199
+ // Input validation and sanitization
200
+ validateBase64Input(encoded);
201
+ if (typeof atob !== 'undefined') {
202
+ try {
203
+ return atob(encoded);
204
+ }
205
+ catch {
206
+ throw new Error('Failed to decode base64 data');
207
+ }
208
+ }
209
+ // Node.js fallback with additional validation
210
+ if (isNodeEnvironment()) {
211
+ try {
212
+ // Use Buffer with explicit error handling
213
+ const buffer = Buffer.from(encoded, 'base64');
214
+ // Additional validation: ensure the decoded data is reasonable size
215
+ if (buffer.length > 5000000) { // 5MB limit for decoded data
216
+ throw new Error('Decoded base64 data is too large');
217
+ }
218
+ return buffer.toString('binary');
219
+ }
220
+ catch (error) {
221
+ if (error instanceof Error && error.message.includes('Invalid base64')) {
222
+ throw new Error('Invalid base64 format');
223
+ }
224
+ throw new Error('Failed to decode base64 data in Node.js environment');
225
+ }
226
+ }
227
+ throw new Error('Base64 decoding not supported in this environment');
228
+ }
229
+ /**
230
+ * Polyfill for btoa in Node.js
231
+ */
232
+ function safeBtoa(str) {
233
+ if (typeof btoa !== 'undefined') {
234
+ return btoa(str);
235
+ }
236
+ // Node.js fallback
237
+ if (isNodeEnvironment()) {
238
+ return Buffer.from(str, 'binary').toString('base64');
239
+ }
240
+ throw new Error('Base64 encoding not supported in this environment');
241
+ }
242
+
243
+ /**
244
+ * Invert a codec, swapping encode and decode directions.
245
+ */
246
+ function invertCodec(codec) {
247
+ return codec.invert();
248
+ }
249
+ // ===== STRING TO NUMBER CODECS =====
250
+ /**
251
+ * String to number codec
252
+ */
253
+ const stringToNumber = validators_codec.VldCodec.create(validators_string.VldString.create(), validators_number.VldNumber.create(), {
254
+ decode: (str) => {
255
+ const num = Number(str);
256
+ if (isNaN(num))
257
+ throw new Error('Invalid number');
258
+ return num;
259
+ },
260
+ encode: (num) => num.toString()
261
+ });
262
+ /**
263
+ * String to integer codec
264
+ */
265
+ const stringToInt = validators_codec.VldCodec.create(validators_string.VldString.create(), validators_number.VldNumber.create().int(), {
266
+ decode: (str) => {
267
+ const num = parseInt(str, 10);
268
+ if (isNaN(num))
269
+ throw new Error('Invalid integer');
270
+ return num;
271
+ },
272
+ encode: (num) => Math.floor(num).toString()
273
+ });
274
+ /**
275
+ * String to BigInt codec
276
+ */
277
+ const stringToBigInt = validators_codec.VldCodec.create(validators_string.VldString.create(), validators_bigint.VldBigInt.create(), {
278
+ decode: (str) => {
279
+ try {
280
+ return BigInt(str);
281
+ }
282
+ catch {
283
+ throw new Error('Invalid BigInt');
284
+ }
285
+ },
286
+ encode: (bigint) => bigint.toString()
287
+ });
288
+ /**
289
+ * Number to BigInt codec
290
+ */
291
+ const numberToBigInt = validators_codec.VldCodec.create(validators_number.VldNumber.create().int(), validators_bigint.VldBigInt.create(), {
292
+ decode: (num) => BigInt(Math.floor(num)),
293
+ encode: (bigint) => Number(bigint)
294
+ });
295
+ // ===== DATE CODECS =====
296
+ /**
297
+ * ISO datetime string to Date codec
298
+ */
299
+ const isoDatetimeToDate = validators_codec.VldCodec.create(validators_string.VldString.create().regex(/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\.\d{3})?Z?$/, 'Invalid ISO datetime format'), validators_date.VldDate.create(), {
300
+ decode: (isoString) => {
301
+ const date = new Date(isoString);
302
+ if (isNaN(date.getTime()))
303
+ throw new Error('Invalid date');
304
+ return date;
305
+ },
306
+ encode: (date) => date.toISOString()
307
+ });
308
+ /**
309
+ * Epoch seconds to Date codec
310
+ */
311
+ const epochSecondsToDate = validators_codec.VldCodec.create(validators_number.VldNumber.create(), validators_date.VldDate.create(), {
312
+ decode: (seconds) => new Date(seconds * 1000),
313
+ encode: (date) => Math.floor(date.getTime() / 1000)
314
+ });
315
+ /**
316
+ * Epoch milliseconds to Date codec
317
+ */
318
+ const epochMillisToDate = validators_codec.VldCodec.create(validators_number.VldNumber.create(), validators_date.VldDate.create(), {
319
+ decode: (millis) => new Date(millis),
320
+ encode: (date) => date.getTime()
321
+ });
322
+ // ===== JSON CODEC =====
323
+ /**
324
+ * JSON string codec for any type
325
+ */
326
+ const jsonCodec = (schema) => {
327
+ const outputSchema = schema || validators_unknown.VldUnknown.create();
328
+ return validators_codec.VldCodec.create(validators_string.VldString.create(), outputSchema, {
329
+ decode: (jsonString) => {
330
+ try {
331
+ return JSON.parse(jsonString);
332
+ }
333
+ catch {
334
+ throw new Error('Invalid JSON');
335
+ }
336
+ },
337
+ encode: (data) => JSON.stringify(data)
338
+ });
339
+ };
340
+ // ===== URL CODECS =====
341
+ /**
342
+ * String to URL codec
343
+ */
344
+ const stringToURL = validators_codec.VldCodec.create(validators_string.VldString.create().url(), validators_unknown.VldUnknown.create(), // URL object
345
+ {
346
+ decode: (urlString) => {
347
+ try {
348
+ return new URL(urlString);
349
+ }
350
+ catch {
351
+ throw new Error('Invalid URL');
352
+ }
353
+ },
354
+ encode: (url) => url.toString()
355
+ });
356
+ /**
357
+ * String to HTTP/HTTPS URL codec
358
+ */
359
+ const stringToHttpURL = validators_codec.VldCodec.create(validators_string.VldString.create().regex(/^https?:\/\//, 'Must be HTTP or HTTPS URL'), validators_unknown.VldUnknown.create(), // URL object
360
+ {
361
+ decode: (urlString) => {
362
+ try {
363
+ const url = new URL(urlString);
364
+ if (!['http:', 'https:'].includes(url.protocol)) {
365
+ throw new Error('Must be HTTP or HTTPS');
366
+ }
367
+ return url;
368
+ }
369
+ catch {
370
+ throw new Error('Invalid HTTP URL');
371
+ }
372
+ },
373
+ encode: (url) => url.toString()
374
+ });
375
+ /**
376
+ * URI component encode/decode codec
377
+ */
378
+ const uriComponent = validators_codec.VldCodec.create(validators_string.VldString.create(), validators_string.VldString.create(), {
379
+ decode: (encoded) => {
380
+ try {
381
+ return decodeURIComponent(encoded);
382
+ }
383
+ catch {
384
+ throw new Error('Invalid URI component');
385
+ }
386
+ },
387
+ encode: (decoded) => encodeURIComponent(decoded)
388
+ });
389
+ /**
390
+ * String to boolean codec
391
+ */
392
+ const stringToBoolean = validators_codec.VldCodec.create(validators_string.VldString.create(), validators_boolean.VldBoolean.create(), {
393
+ decode: (str) => {
394
+ const lower = str.toLowerCase();
395
+ if (lower === 'true' || lower === '1' || lower === 'yes' || lower === 'on')
396
+ return true;
397
+ if (lower === 'false' || lower === '0' || lower === 'no' || lower === 'off')
398
+ return false;
399
+ throw new Error('Invalid boolean string');
400
+ },
401
+ encode: (bool) => bool.toString()
402
+ });
403
+ // ===== EXISTING BYTE CODECS (updated) =====
404
+ /**
405
+ * Base64 to Uint8Array codec
406
+ */
407
+ const base64ToBytes = validators_codec.VldCodec.create(validators_base64.VldBase64.create(), validators_uint8array.VldUint8Array.create(), {
408
+ decode: base64ToUint8Array,
409
+ encode: uint8ArrayToBase64
410
+ });
411
+ /**
412
+ * URL-safe Base64 to Uint8Array codec
413
+ */
414
+ const base64UrlToBytes = validators_codec.VldCodec.create(validators_base64.VldBase64.create().urlSafeMode(), validators_uint8array.VldUint8Array.create(), {
415
+ decode: base64ToUint8Array,
416
+ encode: uint8ArrayToBase64Url
417
+ });
418
+ /**
419
+ * Hexadecimal to Uint8Array codec
420
+ */
421
+ const hexToBytes = validators_codec.VldCodec.create(validators_hex.VldHex.create(), validators_uint8array.VldUint8Array.create(), {
422
+ decode: hexToUint8Array,
423
+ encode: uint8ArrayToHex
424
+ });
425
+ /**
426
+ * Lowercase hexadecimal to Uint8Array codec
427
+ */
428
+ const hexLowerToBytes = validators_codec.VldCodec.create(validators_hex.VldHex.create().lowercaseMode(), validators_uint8array.VldUint8Array.create(), {
429
+ decode: hexToUint8Array,
430
+ encode: (bytes) => uint8ArrayToHex(bytes).toLowerCase()
431
+ });
432
+ /**
433
+ * UTF-8 string to Uint8Array codec
434
+ */
435
+ const utf8ToBytes = validators_codec.VldCodec.create(validators_string.VldString.create(), validators_uint8array.VldUint8Array.create(), {
436
+ decode: stringToUint8Array,
437
+ encode: uint8ArrayToString
438
+ });
439
+ /**
440
+ * Uint8Array to UTF-8 string codec (reverse of utf8ToBytes)
441
+ */
442
+ const bytesToUtf8 = validators_codec.VldCodec.create(validators_uint8array.VldUint8Array.create(), validators_string.VldString.create(), {
443
+ decode: uint8ArrayToString,
444
+ encode: stringToUint8Array
445
+ });
446
+ /**
447
+ * Base64URL to Uint8Array codec (updated)
448
+ */
449
+ const base64urlToBytes = validators_codec.VldCodec.create(validators_base64.VldBase64.create().urlSafeMode(), validators_uint8array.VldUint8Array.create(), {
450
+ decode: base64ToUint8Array,
451
+ encode: uint8ArrayToBase64Url
452
+ });
453
+ /**
454
+ * Base64 encoded JSON codec (updated)
455
+ */
456
+ const base64Json = (schema) => {
457
+ const outputSchema = schema || validators_unknown.VldUnknown.create();
458
+ return validators_codec.VldCodec.create(validators_base64.VldBase64.create(), outputSchema, {
459
+ decode: (base64) => {
460
+ // BUG-NPM-005 FIX: Add error handling for JSON parsing
461
+ try {
462
+ const jsonString = uint8ArrayToString(base64ToUint8Array(base64));
463
+ return JSON.parse(jsonString);
464
+ }
465
+ catch (error) {
466
+ throw new Error(`Failed to parse base64 JSON: ${error.message}`);
467
+ }
468
+ },
469
+ encode: (data) => {
470
+ const jsonString = JSON.stringify(data);
471
+ return uint8ArrayToBase64(stringToUint8Array(jsonString));
472
+ }
473
+ });
474
+ };
475
+ /**
476
+ * JWT payload decoder (base64url encoded JSON) - updated
477
+ */
478
+ const jwtPayload = (schema) => {
479
+ const outputSchema = schema || validators_unknown.VldUnknown.create();
480
+ return validators_codec.VldCodec.create(validators_string.VldString.create().refine(s => s.split('.').length === 3, 'Invalid JWT format'), outputSchema, {
481
+ decode: (jwt) => {
482
+ // BUG-NPM-004 FIX: Add comprehensive error handling for JWT parsing
483
+ try {
484
+ const parts = jwt.split('.');
485
+ if (parts.length !== 3) {
486
+ throw new Error('JWT must have exactly 3 parts');
487
+ }
488
+ const payloadBase64 = parts[1];
489
+ if (!payloadBase64) {
490
+ throw new Error('JWT payload is empty');
491
+ }
492
+ // Convert base64url to base64
493
+ const base64 = payloadBase64
494
+ .replace(/-/g, '+')
495
+ .replace(/_/g, '/')
496
+ .padEnd(payloadBase64.length + (4 - payloadBase64.length % 4) % 4, '=');
497
+ const jsonString = uint8ArrayToString(base64ToUint8Array(base64));
498
+ return JSON.parse(jsonString);
499
+ }
500
+ catch (error) {
501
+ throw new Error(`Failed to decode JWT payload: ${error.message}`);
502
+ }
503
+ },
504
+ encode: () => {
505
+ throw new Error('JWT encoding not supported - use a proper JWT library');
506
+ }
507
+ });
508
+ };
509
+
510
+ exports.base64Json = base64Json;
511
+ exports.base64ToBytes = base64ToBytes;
512
+ exports.base64ToUint8Array = base64ToUint8Array;
513
+ exports.base64UrlToBytes = base64UrlToBytes;
514
+ exports.base64urlToBytes = base64urlToBytes;
515
+ exports.bytesToUtf8 = bytesToUtf8;
516
+ exports.epochMillisToDate = epochMillisToDate;
517
+ exports.epochSecondsToDate = epochSecondsToDate;
518
+ exports.hexLowerToBytes = hexLowerToBytes;
519
+ exports.hexToBytes = hexToBytes;
520
+ exports.hexToUint8Array = hexToUint8Array;
521
+ exports.invertCodec = invertCodec;
522
+ exports.isoDatetimeToDate = isoDatetimeToDate;
523
+ exports.jsonCodec = jsonCodec;
524
+ exports.jwtPayload = jwtPayload;
525
+ exports.numberToBigInt = numberToBigInt;
526
+ exports.stringToBigInt = stringToBigInt;
527
+ exports.stringToBoolean = stringToBoolean;
528
+ exports.stringToHttpURL = stringToHttpURL;
529
+ exports.stringToInt = stringToInt;
530
+ exports.stringToNumber = stringToNumber;
531
+ exports.stringToURL = stringToURL;
532
+ exports.stringToUint8Array = stringToUint8Array;
533
+ exports.uint8ArrayToBase64 = uint8ArrayToBase64;
534
+ exports.uint8ArrayToBase64Url = uint8ArrayToBase64Url;
535
+ exports.uint8ArrayToHex = uint8ArrayToHex;
536
+ exports.uint8ArrayToString = uint8ArrayToString;
537
+ exports.uriComponent = uriComponent;
538
+ exports.utf8ToBytes = utf8ToBytes;
@@ -0,0 +1,91 @@
1
+ 'use strict';
2
+
3
+ var locales_runtime = require('../locales/runtime.cjs');
4
+ var locales_en = require('../locales/en.cjs');
5
+ var locales_tr = require('../locales/tr.cjs');
6
+ var locales_es = require('../locales/es.cjs');
7
+ var locales_fr = require('../locales/fr.cjs');
8
+ var locales_de = require('../locales/de.cjs');
9
+ var locales_it = require('../locales/it.cjs');
10
+ var locales_pt = require('../locales/pt.cjs');
11
+ var locales_ru = require('../locales/ru.cjs');
12
+ var locales_ja = require('../locales/ja.cjs');
13
+ var locales_ko = require('../locales/ko.cjs');
14
+ var locales_zh = require('../locales/zh.cjs');
15
+ var locales_ar = require('../locales/ar.cjs');
16
+ var locales_hi = require('../locales/hi.cjs');
17
+ var locales_nl = require('../locales/nl.cjs');
18
+ var locales_pl = require('../locales/pl.cjs');
19
+ var locales_da = require('../locales/da.cjs');
20
+ var locales_sv = require('../locales/sv.cjs');
21
+ var locales_no = require('../locales/no.cjs');
22
+ var locales_fi = require('../locales/fi.cjs');
23
+ var locales_th = require('../locales/th.cjs');
24
+ var locales_vi = require('../locales/vi.cjs');
25
+ var locales_id = require('../locales/id.cjs');
26
+ var locales_bn = require('../locales/bn.cjs');
27
+ var locales_sw = require('../locales/sw.cjs');
28
+ var locales_af = require('../locales/af.cjs');
29
+ var locales_ptBR = require('../locales/pt-BR.cjs');
30
+ var locales_esMX = require('../locales/es-MX.cjs');
31
+
32
+ const translatedLocaleCodes = [
33
+ 'en', 'tr', 'es', 'fr', 'de', 'it', 'pt', 'ru', 'ja', 'ko', 'zh', 'ar', 'hi', 'nl', 'pl',
34
+ 'da', 'sv', 'no', 'fi',
35
+ 'th', 'vi', 'id', 'bn',
36
+ 'sw', 'af',
37
+ 'pt-BR', 'es-MX'
38
+ ];
39
+ const fallbackLocaleCodes = [
40
+ 'is', 'cs', 'sk', 'hu', 'ro', 'bg', 'hr', 'sl', 'lv', 'lt', 'et',
41
+ 'el', 'mk', 'sq', 'sr', 'bs', 'me', 'mt', 'ga', 'cy', 'eu', 'ca',
42
+ 'ms', 'tl', 'ur', 'fa', 'he', 'ka', 'am', 'hy', 'az', 'kk', 'ky',
43
+ 'uz', 'tg', 'mn', 'my', 'km', 'lo', 'si', 'ta', 'te', 'ml', 'kn',
44
+ 'gu', 'pa', 'or', 'as', 'ne', 'mr', 'sd', 'dv',
45
+ 'ha', 'yo', 'ig', 'zu', 'xh', 'st', 'tn', 'ts', 've', 'nr', 'ss',
46
+ 'es-AR', 'fr-CA', 'qu', 'gn', 'ay'
47
+ ];
48
+ const translatedLocales = {
49
+ // Base languages
50
+ en: locales_en.en, tr: locales_tr.tr, es: locales_es.es, fr: locales_fr.fr, de: locales_de.de, it: locales_it.it, pt: locales_pt.pt, ru: locales_ru.ru, ja: locales_ja.ja, ko: locales_ko.ko, zh: locales_zh.zh, ar: locales_ar.ar, hi: locales_hi.hi, nl: locales_nl.nl, pl: locales_pl.pl,
51
+ // Major European Languages
52
+ da: locales_da.da, sv: locales_sv.sv, no: locales_no.no, fi: locales_fi.fi,
53
+ // Major Asian Languages
54
+ th: locales_th.th, vi: locales_vi.vi, id: locales_id.id, bn: locales_bn.bn,
55
+ // African Languages
56
+ sw: locales_sw.sw, af: locales_af.af,
57
+ // American Languages
58
+ 'pt-BR': locales_ptBR.ptBR,
59
+ 'es-MX': locales_esMX.esMX,
60
+ };
61
+ for (const locale of translatedLocaleCodes) {
62
+ locales_runtime.registerLocale(locale, translatedLocales[locale]);
63
+ }
64
+ for (const locale of fallbackLocaleCodes) {
65
+ locales_runtime.registerFallbackLocale(locale);
66
+ }
67
+ /**
68
+ * Set the current locale asynchronously.
69
+ *
70
+ * The eager locale entrypoint already bundles translated locales and English
71
+ * fallbacks, so this mirrors setLocale() while preserving async API parity.
72
+ */
73
+ async function setLocaleAsync(locale) {
74
+ locales_runtime.setLocale(locale);
75
+ }
76
+
77
+ var localeNamespace = /*#__PURE__*/Object.freeze({
78
+ __proto__: null,
79
+ getLocale: locales_runtime.getLocale,
80
+ getMessages: locales_runtime.getMessages,
81
+ getMessagesForLocale: locales_runtime.getMessagesForLocale,
82
+ getSupportedLocales: locales_runtime.getSupportedLocales,
83
+ isLocaleLoaded: locales_runtime.isLocaleLoaded,
84
+ isLocaleSupported: locales_runtime.isLocaleSupported,
85
+ registerLocale: locales_runtime.registerLocale,
86
+ setLocale: locales_runtime.setLocale,
87
+ setLocaleAsync: setLocaleAsync
88
+ });
89
+
90
+ exports.localeNamespace = localeNamespace;
91
+ exports.setLocaleAsync = setLocaleAsync;
@@ -0,0 +1,37 @@
1
+ 'use strict';
2
+
3
+ /**
4
+ * Security utilities for prototype pollution protection
5
+ */
6
+ /**
7
+ * Keys that, when written via `obj[key] = ...`, can mutate Object.prototype
8
+ * or alter property accessor behavior across the program.
9
+ *
10
+ * `__proto__`, `constructor`, `prototype` are the canonical prototype-pollution
11
+ * sinks. The `__define*Getter__` / `__lookup*Getter__` family installs accessors
12
+ * on the prototype chain in legacy engines.
13
+ *
14
+ * Note: keys such as `toString`, `valueOf`, or `hasOwnProperty` are NOT
15
+ * blocked. Those are legitimate property names that appear in real payloads
16
+ * (localization tables, custom widget config, generic key/value stores).
17
+ * Silently dropping them causes data loss; a validation library must not do
18
+ * that.
19
+ */
20
+ const DANGEROUS_KEYS = new Set([
21
+ '__proto__',
22
+ 'constructor',
23
+ 'prototype',
24
+ '__defineGetter__',
25
+ '__defineSetter__',
26
+ '__lookupGetter__',
27
+ '__lookupSetter__',
28
+ ]);
29
+ /**
30
+ * Return true if a property key would, if assigned, mutate the prototype
31
+ * chain or accessor behavior of the target object.
32
+ */
33
+ function isDangerousKey(key) {
34
+ return DANGEROUS_KEYS.has(key);
35
+ }
36
+
37
+ exports.isDangerousKey = isDangerousKey;