bguard 0.0.9 → 0.1.1

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 (424) hide show
  1. package/README.md +844 -26
  2. package/lib/{CommonSchema-BIe85W_A.d.mts → CommonSchema-BbGNki0L.d.ts} +7 -4
  3. package/lib/{CommonSchema-BIe85W_A.d.ts → CommonSchema-CjsYE4dC.d.mts} +7 -4
  4. package/lib/InferType.d.mts +2 -1
  5. package/lib/InferType.d.ts +2 -1
  6. package/lib/asserts/array/index.d.mts +4 -3
  7. package/lib/asserts/array/index.d.ts +4 -3
  8. package/lib/asserts/array/index.js +6 -6
  9. package/lib/asserts/array/index.mjs +5 -5
  10. package/lib/asserts/boolean/index.d.mts +4 -3
  11. package/lib/asserts/boolean/index.d.ts +4 -3
  12. package/lib/asserts/boolean/index.js +7 -6
  13. package/lib/asserts/boolean/index.js.map +1 -1
  14. package/lib/asserts/boolean/index.mjs +6 -5
  15. package/lib/asserts/mix/equalTo.d.mts +22 -0
  16. package/lib/asserts/mix/equalTo.d.ts +22 -0
  17. package/lib/asserts/mix/equalTo.js +9 -0
  18. package/lib/asserts/mix/equalTo.js.map +1 -0
  19. package/lib/asserts/mix/equalTo.mjs +9 -0
  20. package/lib/asserts/{common → mix}/index.d.mts +5 -4
  21. package/lib/asserts/{common → mix}/index.d.ts +5 -4
  22. package/lib/asserts/mix/index.js +10 -0
  23. package/lib/asserts/mix/index.js.map +1 -0
  24. package/lib/asserts/mix/index.mjs +10 -0
  25. package/lib/asserts/mix/oneOfValues.d.mts +23 -0
  26. package/lib/asserts/mix/oneOfValues.d.ts +23 -0
  27. package/lib/asserts/mix/oneOfValues.js +9 -0
  28. package/lib/asserts/mix/oneOfValues.js.map +1 -0
  29. package/lib/asserts/mix/oneOfValues.mjs +9 -0
  30. package/lib/asserts/number/index.d.mts +4 -3
  31. package/lib/asserts/number/index.d.ts +4 -3
  32. package/lib/asserts/number/index.js +11 -7
  33. package/lib/asserts/number/index.js.map +1 -1
  34. package/lib/asserts/number/index.mjs +10 -6
  35. package/lib/asserts/number/max.d.mts +15 -10
  36. package/lib/asserts/number/max.d.ts +15 -10
  37. package/lib/asserts/number/max.js +11 -4
  38. package/lib/asserts/number/max.js.map +1 -1
  39. package/lib/asserts/number/max.mjs +12 -5
  40. package/lib/asserts/number/max.mjs.map +1 -1
  41. package/lib/asserts/number/maxExcluded.d.mts +14 -9
  42. package/lib/asserts/number/maxExcluded.d.ts +14 -9
  43. package/lib/asserts/number/maxExcluded.js +11 -4
  44. package/lib/asserts/number/maxExcluded.js.map +1 -1
  45. package/lib/asserts/number/maxExcluded.mjs +12 -5
  46. package/lib/asserts/number/maxExcluded.mjs.map +1 -1
  47. package/lib/asserts/number/min.d.mts +15 -10
  48. package/lib/asserts/number/min.d.ts +15 -10
  49. package/lib/asserts/number/min.js +11 -4
  50. package/lib/asserts/number/min.js.map +1 -1
  51. package/lib/asserts/number/min.mjs +12 -5
  52. package/lib/asserts/number/min.mjs.map +1 -1
  53. package/lib/asserts/number/minExcluded.d.mts +15 -10
  54. package/lib/asserts/number/minExcluded.d.ts +15 -10
  55. package/lib/asserts/number/minExcluded.js +11 -4
  56. package/lib/asserts/number/minExcluded.js.map +1 -1
  57. package/lib/asserts/number/minExcluded.mjs +12 -5
  58. package/lib/asserts/number/minExcluded.mjs.map +1 -1
  59. package/lib/asserts/number/negative.d.mts +14 -9
  60. package/lib/asserts/number/negative.d.ts +14 -9
  61. package/lib/asserts/number/negative.js +11 -3
  62. package/lib/asserts/number/negative.js.map +1 -1
  63. package/lib/asserts/number/negative.mjs +12 -4
  64. package/lib/asserts/number/negative.mjs.map +1 -1
  65. package/lib/asserts/number/positive.d.mts +14 -9
  66. package/lib/asserts/number/positive.d.ts +14 -9
  67. package/lib/asserts/number/positive.js +11 -3
  68. package/lib/asserts/number/positive.js.map +1 -1
  69. package/lib/asserts/number/positive.mjs +12 -4
  70. package/lib/asserts/number/positive.mjs.map +1 -1
  71. package/lib/asserts/object/index.d.mts +4 -3
  72. package/lib/asserts/object/index.d.ts +4 -3
  73. package/lib/asserts/object/index.js +6 -6
  74. package/lib/asserts/object/index.mjs +5 -5
  75. package/lib/asserts/string/atLeastOneDigit.d.mts +20 -0
  76. package/lib/asserts/string/atLeastOneDigit.d.ts +20 -0
  77. package/lib/asserts/string/atLeastOneDigit.js +21 -0
  78. package/lib/asserts/string/atLeastOneDigit.js.map +1 -0
  79. package/lib/asserts/string/atLeastOneDigit.mjs +21 -0
  80. package/lib/asserts/string/atLeastOneDigit.mjs.map +1 -0
  81. package/lib/asserts/string/atLeastOneLowerChar.d.mts +20 -0
  82. package/lib/asserts/string/atLeastOneLowerChar.d.ts +20 -0
  83. package/lib/asserts/string/atLeastOneLowerChar.js +22 -0
  84. package/lib/asserts/string/atLeastOneLowerChar.js.map +1 -0
  85. package/lib/asserts/string/atLeastOneLowerChar.mjs +22 -0
  86. package/lib/asserts/string/atLeastOneLowerChar.mjs.map +1 -0
  87. package/lib/asserts/string/atLeastOneSpecialChar.d.mts +25 -0
  88. package/lib/asserts/string/atLeastOneSpecialChar.d.ts +25 -0
  89. package/lib/asserts/string/atLeastOneSpecialChar.js +26 -0
  90. package/lib/asserts/string/atLeastOneSpecialChar.js.map +1 -0
  91. package/lib/asserts/string/atLeastOneSpecialChar.mjs +26 -0
  92. package/lib/asserts/string/atLeastOneSpecialChar.mjs.map +1 -0
  93. package/lib/asserts/string/atLeastOneUpperChar.d.mts +20 -0
  94. package/lib/asserts/string/atLeastOneUpperChar.d.ts +20 -0
  95. package/lib/asserts/string/atLeastOneUpperChar.js +22 -0
  96. package/lib/asserts/string/atLeastOneUpperChar.js.map +1 -0
  97. package/lib/asserts/string/atLeastOneUpperChar.mjs +22 -0
  98. package/lib/asserts/string/atLeastOneUpperChar.mjs.map +1 -0
  99. package/lib/asserts/string/contains.d.mts +21 -0
  100. package/lib/asserts/string/contains.d.ts +21 -0
  101. package/lib/asserts/string/contains.js +22 -0
  102. package/lib/asserts/string/contains.js.map +1 -0
  103. package/lib/asserts/string/contains.mjs +22 -0
  104. package/lib/asserts/string/contains.mjs.map +1 -0
  105. package/lib/asserts/string/email.d.mts +13 -9
  106. package/lib/asserts/string/email.d.ts +13 -9
  107. package/lib/asserts/string/email.js +11 -4
  108. package/lib/asserts/string/email.js.map +1 -1
  109. package/lib/asserts/string/email.mjs +12 -5
  110. package/lib/asserts/string/email.mjs.map +1 -1
  111. package/lib/asserts/string/endsWith.d.mts +21 -0
  112. package/lib/asserts/string/endsWith.d.ts +21 -0
  113. package/lib/asserts/string/endsWith.js +22 -0
  114. package/lib/asserts/string/endsWith.js.map +1 -0
  115. package/lib/asserts/string/endsWith.mjs +22 -0
  116. package/lib/asserts/string/endsWith.mjs.map +1 -0
  117. package/lib/asserts/string/index.d.mts +4 -3
  118. package/lib/asserts/string/index.d.ts +4 -3
  119. package/lib/asserts/string/index.js +11 -7
  120. package/lib/asserts/string/index.js.map +1 -1
  121. package/lib/asserts/string/index.mjs +10 -6
  122. package/lib/asserts/string/lowerCase.d.mts +20 -0
  123. package/lib/asserts/string/lowerCase.d.ts +20 -0
  124. package/lib/asserts/string/lowerCase.js +20 -0
  125. package/lib/asserts/string/lowerCase.js.map +1 -0
  126. package/lib/asserts/string/lowerCase.mjs +20 -0
  127. package/lib/asserts/string/lowerCase.mjs.map +1 -0
  128. package/lib/asserts/string/maxLength.d.mts +14 -9
  129. package/lib/asserts/string/maxLength.d.ts +14 -9
  130. package/lib/asserts/string/maxLength.js +11 -4
  131. package/lib/asserts/string/maxLength.js.map +1 -1
  132. package/lib/asserts/string/maxLength.mjs +12 -5
  133. package/lib/asserts/string/maxLength.mjs.map +1 -1
  134. package/lib/asserts/string/minLength.d.mts +14 -9
  135. package/lib/asserts/string/minLength.d.ts +14 -9
  136. package/lib/asserts/string/minLength.js +11 -4
  137. package/lib/asserts/string/minLength.js.map +1 -1
  138. package/lib/asserts/string/minLength.mjs +12 -5
  139. package/lib/asserts/string/minLength.mjs.map +1 -1
  140. package/lib/asserts/string/regExp.d.mts +14 -9
  141. package/lib/asserts/string/regExp.d.ts +14 -9
  142. package/lib/asserts/string/regExp.js +11 -4
  143. package/lib/asserts/string/regExp.js.map +1 -1
  144. package/lib/asserts/string/regExp.mjs +12 -5
  145. package/lib/asserts/string/regExp.mjs.map +1 -1
  146. package/lib/asserts/string/startsWith.d.mts +21 -0
  147. package/lib/asserts/string/startsWith.d.ts +21 -0
  148. package/lib/asserts/string/startsWith.js +22 -0
  149. package/lib/asserts/string/startsWith.js.map +1 -0
  150. package/lib/asserts/string/startsWith.mjs +22 -0
  151. package/lib/asserts/string/startsWith.mjs.map +1 -0
  152. package/lib/asserts/string/upperCase.d.mts +21 -0
  153. package/lib/asserts/string/upperCase.d.ts +21 -0
  154. package/lib/asserts/string/upperCase.js +22 -0
  155. package/lib/asserts/string/upperCase.js.map +1 -0
  156. package/lib/asserts/string/upperCase.mjs +22 -0
  157. package/lib/asserts/string/upperCase.mjs.map +1 -0
  158. package/lib/asserts/string/uuid.d.mts +20 -0
  159. package/lib/asserts/string/uuid.d.ts +20 -0
  160. package/lib/asserts/string/uuid.js +23 -0
  161. package/lib/asserts/string/uuid.js.map +1 -0
  162. package/lib/asserts/string/uuid.mjs +23 -0
  163. package/lib/asserts/string/uuid.mjs.map +1 -0
  164. package/lib/asserts/string/uuidV1.d.mts +21 -0
  165. package/lib/asserts/string/uuidV1.d.ts +21 -0
  166. package/lib/asserts/string/uuidV1.js +23 -0
  167. package/lib/asserts/string/uuidV1.js.map +1 -0
  168. package/lib/asserts/string/uuidV1.mjs +23 -0
  169. package/lib/asserts/string/uuidV1.mjs.map +1 -0
  170. package/lib/asserts/string/uuidV2.d.mts +21 -0
  171. package/lib/asserts/string/uuidV2.d.ts +21 -0
  172. package/lib/asserts/string/uuidV2.js +23 -0
  173. package/lib/asserts/string/uuidV2.js.map +1 -0
  174. package/lib/asserts/string/uuidV2.mjs +23 -0
  175. package/lib/asserts/string/uuidV2.mjs.map +1 -0
  176. package/lib/asserts/string/uuidV3.d.mts +21 -0
  177. package/lib/asserts/string/uuidV3.d.ts +21 -0
  178. package/lib/asserts/string/uuidV3.js +23 -0
  179. package/lib/asserts/string/uuidV3.js.map +1 -0
  180. package/lib/asserts/string/uuidV3.mjs +23 -0
  181. package/lib/asserts/string/uuidV3.mjs.map +1 -0
  182. package/lib/asserts/string/uuidV4.d.mts +23 -0
  183. package/lib/asserts/string/uuidV4.d.ts +23 -0
  184. package/lib/asserts/string/uuidV4.js +23 -0
  185. package/lib/asserts/string/uuidV4.js.map +1 -0
  186. package/lib/asserts/string/uuidV4.mjs +23 -0
  187. package/lib/asserts/string/uuidV4.mjs.map +1 -0
  188. package/lib/asserts/string/uuidV5.d.mts +21 -0
  189. package/lib/asserts/string/uuidV5.d.ts +21 -0
  190. package/lib/asserts/string/uuidV5.js +23 -0
  191. package/lib/asserts/string/uuidV5.js.map +1 -0
  192. package/lib/asserts/string/uuidV5.mjs +23 -0
  193. package/lib/asserts/string/uuidV5.mjs.map +1 -0
  194. package/lib/asserts/string/validUrl.d.mts +23 -0
  195. package/lib/asserts/string/validUrl.d.ts +23 -0
  196. package/lib/asserts/string/validUrl.js +32 -0
  197. package/lib/asserts/string/validUrl.js.map +1 -0
  198. package/lib/asserts/string/validUrl.mjs +32 -0
  199. package/lib/asserts/string/validUrl.mjs.map +1 -0
  200. package/lib/{chunk-32IQXZRK.mjs → chunk-2PM3K3OE.mjs} +2 -2
  201. package/lib/{chunk-32IQXZRK.mjs.map → chunk-2PM3K3OE.mjs.map} +1 -1
  202. package/lib/{chunk-KCBOOOTF.mjs → chunk-32RSTOZ4.mjs} +2 -2
  203. package/lib/{chunk-KCBOOOTF.mjs.map → chunk-32RSTOZ4.mjs.map} +1 -1
  204. package/lib/chunk-3HTYHE2X.mjs +54 -0
  205. package/lib/chunk-3HTYHE2X.mjs.map +1 -0
  206. package/lib/chunk-3O4WCRC2.mjs +21 -0
  207. package/lib/chunk-3O4WCRC2.mjs.map +1 -0
  208. package/lib/chunk-42J6CHIO.js +7 -0
  209. package/lib/chunk-42J6CHIO.js.map +1 -0
  210. package/lib/chunk-4CYIMDP2.js +21 -0
  211. package/lib/chunk-4CYIMDP2.js.map +1 -0
  212. package/lib/chunk-5BVJ6YMH.js +54 -0
  213. package/lib/chunk-5BVJ6YMH.js.map +1 -0
  214. package/lib/chunk-6TH3DBDK.js +53 -0
  215. package/lib/chunk-6TH3DBDK.js.map +1 -0
  216. package/lib/chunk-7XFLH6R2.mjs +44 -0
  217. package/lib/chunk-7XFLH6R2.mjs.map +1 -0
  218. package/lib/chunk-ASZW6XRM.mjs +7 -0
  219. package/lib/chunk-ASZW6XRM.mjs.map +1 -0
  220. package/lib/{chunk-GEZME6V2.mjs → chunk-CCBCDJXS.mjs} +11 -6
  221. package/lib/chunk-CCBCDJXS.mjs.map +1 -0
  222. package/lib/chunk-DJSLA2ZV.js +27 -0
  223. package/lib/chunk-DJSLA2ZV.js.map +1 -0
  224. package/lib/{chunk-L7HUXYFV.mjs → chunk-DPBE7TAQ.mjs} +2 -2
  225. package/lib/chunk-DPBE7TAQ.mjs.map +1 -0
  226. package/lib/{chunk-APTTIN2L.js → chunk-EGEHSELT.js} +6 -6
  227. package/lib/chunk-EGEHSELT.js.map +1 -0
  228. package/lib/chunk-H7CPKW53.js +47 -0
  229. package/lib/chunk-H7CPKW53.js.map +1 -0
  230. package/lib/{chunk-A7I2JEQO.js → chunk-HDSGCAHH.js} +3 -3
  231. package/lib/{chunk-A7I2JEQO.js.map → chunk-HDSGCAHH.js.map} +1 -1
  232. package/lib/{chunk-L6A7NXUJ.js → chunk-IEUXIOL6.js} +3 -3
  233. package/lib/{chunk-L6A7NXUJ.js.map → chunk-IEUXIOL6.js.map} +1 -1
  234. package/lib/chunk-IRG4OQAB.js +63 -0
  235. package/lib/chunk-IRG4OQAB.js.map +1 -0
  236. package/lib/chunk-J4VKFJQK.js +21 -0
  237. package/lib/chunk-J4VKFJQK.js.map +1 -0
  238. package/lib/{chunk-A2SAWKJA.mjs → chunk-JDGZCBXF.mjs} +2 -2
  239. package/lib/{chunk-A2SAWKJA.mjs.map → chunk-JDGZCBXF.mjs.map} +1 -1
  240. package/lib/chunk-JPRCULRQ.mjs +61 -0
  241. package/lib/chunk-JPRCULRQ.mjs.map +1 -0
  242. package/lib/chunk-JSGZ7DKT.js +14 -0
  243. package/lib/chunk-JSGZ7DKT.js.map +1 -0
  244. package/lib/chunk-KQKJASVB.js +58 -0
  245. package/lib/chunk-KQKJASVB.js.map +1 -0
  246. package/lib/chunk-LEQCDD66.js +61 -0
  247. package/lib/chunk-LEQCDD66.js.map +1 -0
  248. package/lib/{chunk-AJ4WV5DG.mjs → chunk-MRISXZQ4.mjs} +3 -3
  249. package/lib/chunk-MRISXZQ4.mjs.map +1 -0
  250. package/lib/{chunk-A3UTB4RE.mjs → chunk-NDQM5OL4.mjs} +4 -4
  251. package/lib/chunk-NDQM5OL4.mjs.map +1 -0
  252. package/lib/chunk-NNFYXHLU.mjs +21 -0
  253. package/lib/chunk-NNFYXHLU.mjs.map +1 -0
  254. package/lib/chunk-P7IXNCJG.mjs +58 -0
  255. package/lib/chunk-P7IXNCJG.mjs.map +1 -0
  256. package/lib/chunk-PG2R7P7G.mjs +27 -0
  257. package/lib/chunk-PG2R7P7G.mjs.map +1 -0
  258. package/lib/chunk-PH2PMUZP.mjs +63 -0
  259. package/lib/chunk-PH2PMUZP.mjs.map +1 -0
  260. package/lib/{chunk-BGMR7A6X.mjs → chunk-PXBAS3GA.mjs} +2 -2
  261. package/lib/{chunk-BGMR7A6X.mjs.map → chunk-PXBAS3GA.mjs.map} +1 -1
  262. package/lib/chunk-QQNQ4IDN.js +13 -0
  263. package/lib/chunk-QQNQ4IDN.js.map +1 -0
  264. package/lib/{chunk-QKGQ4XZC.js → chunk-RD6TBCPQ.js} +3 -3
  265. package/lib/{chunk-QKGQ4XZC.js.map → chunk-RD6TBCPQ.js.map} +1 -1
  266. package/lib/chunk-RRQOET3X.js +28 -0
  267. package/lib/chunk-RRQOET3X.js.map +1 -0
  268. package/lib/chunk-RYVUYVEE.mjs +14 -0
  269. package/lib/chunk-RYVUYVEE.mjs.map +1 -0
  270. package/lib/{chunk-QYLH5ZAC.mjs → chunk-TCQY2R3U.mjs} +25 -4
  271. package/lib/chunk-TCQY2R3U.mjs.map +1 -0
  272. package/lib/{chunk-PJP63SJT.js → chunk-TKZ6FLLR.js} +3 -3
  273. package/lib/{chunk-PJP63SJT.js.map → chunk-TKZ6FLLR.js.map} +1 -1
  274. package/lib/{chunk-K2S3FS5K.js → chunk-VHEA4JZ5.js} +3 -3
  275. package/lib/{chunk-K2S3FS5K.js.map → chunk-VHEA4JZ5.js.map} +1 -1
  276. package/lib/{chunk-VPFIIM2X.js → chunk-WBERBAL4.js} +11 -6
  277. package/lib/chunk-WBERBAL4.js.map +1 -0
  278. package/lib/chunk-WK4O3HH4.js +44 -0
  279. package/lib/chunk-WK4O3HH4.js.map +1 -0
  280. package/lib/{chunk-3FEJUC3K.mjs → chunk-YML32TPA.mjs} +2 -2
  281. package/lib/{chunk-3FEJUC3K.mjs.map → chunk-YML32TPA.mjs.map} +1 -1
  282. package/lib/chunk-YUESB2WV.mjs +47 -0
  283. package/lib/chunk-YUESB2WV.mjs.map +1 -0
  284. package/lib/codeGen.d.mts +7 -0
  285. package/lib/codeGen.d.ts +7 -0
  286. package/lib/codeGen.js +51 -0
  287. package/lib/codeGen.js.map +1 -0
  288. package/lib/codeGen.mjs +51 -0
  289. package/lib/codeGen.mjs.map +1 -0
  290. package/lib/commonTypes.d.mts +31 -0
  291. package/lib/commonTypes.d.ts +31 -0
  292. package/lib/commonTypes.js +1 -0
  293. package/lib/commonTypes.js.map +1 -0
  294. package/lib/commonTypes.mjs +1 -0
  295. package/lib/exceptions.d.mts +4 -2
  296. package/lib/exceptions.d.ts +4 -2
  297. package/lib/exceptions.js +2 -2
  298. package/lib/exceptions.mjs +3 -3
  299. package/lib/helpers/constants.d.mts +3 -0
  300. package/lib/helpers/constants.d.ts +3 -0
  301. package/lib/helpers/constants.js +7 -0
  302. package/lib/helpers/constants.js.map +1 -0
  303. package/lib/helpers/constants.mjs +7 -0
  304. package/lib/helpers/constants.mjs.map +1 -0
  305. package/lib/helpers/core.d.mts +2 -0
  306. package/lib/helpers/core.d.ts +2 -0
  307. package/lib/helpers/core.js +10 -0
  308. package/lib/helpers/core.js.map +1 -0
  309. package/lib/helpers/core.mjs +10 -0
  310. package/lib/helpers/core.mjs.map +1 -0
  311. package/lib/helpers/setStrictType.d.mts +6 -0
  312. package/lib/helpers/setStrictType.d.ts +6 -0
  313. package/lib/helpers/setStrictType.js +9 -0
  314. package/lib/helpers/setStrictType.js.map +1 -0
  315. package/lib/helpers/setStrictType.mjs +9 -0
  316. package/lib/helpers/setStrictType.mjs.map +1 -0
  317. package/lib/index.d.mts +7 -4
  318. package/lib/index.d.ts +7 -4
  319. package/lib/index.js +32 -17
  320. package/lib/index.js.map +1 -1
  321. package/lib/index.mjs +37 -22
  322. package/lib/parse.d.mts +66 -0
  323. package/lib/parse.d.ts +66 -0
  324. package/lib/parse.js +10 -0
  325. package/lib/parse.js.map +1 -0
  326. package/lib/parse.mjs +10 -0
  327. package/lib/parse.mjs.map +1 -0
  328. package/lib/{parseSchema.d.mts → parseOrFail.d.mts} +16 -5
  329. package/lib/{parseSchema.d.ts → parseOrFail.d.ts} +16 -5
  330. package/lib/parseOrFail.js +10 -0
  331. package/lib/parseOrFail.js.map +1 -0
  332. package/lib/parseOrFail.mjs +10 -0
  333. package/lib/parseOrFail.mjs.map +1 -0
  334. package/lib/schemas/ArraySchema.d.mts +2 -1
  335. package/lib/schemas/ArraySchema.d.ts +2 -1
  336. package/lib/schemas/ArraySchema.js +5 -5
  337. package/lib/schemas/ArraySchema.mjs +4 -4
  338. package/lib/schemas/BooleanSchema.d.mts +2 -1
  339. package/lib/schemas/BooleanSchema.d.ts +2 -1
  340. package/lib/schemas/BooleanSchema.js +6 -5
  341. package/lib/schemas/BooleanSchema.js.map +1 -1
  342. package/lib/schemas/BooleanSchema.mjs +5 -4
  343. package/lib/schemas/CommonSchema.d.mts +2 -1
  344. package/lib/schemas/CommonSchema.d.ts +2 -1
  345. package/lib/schemas/CommonSchema.js +4 -4
  346. package/lib/schemas/CommonSchema.mjs +3 -3
  347. package/lib/schemas/NumberSchema.d.mts +13 -1
  348. package/lib/schemas/NumberSchema.d.ts +13 -1
  349. package/lib/schemas/NumberSchema.js +10 -6
  350. package/lib/schemas/NumberSchema.js.map +1 -1
  351. package/lib/schemas/NumberSchema.mjs +9 -5
  352. package/lib/schemas/ObjectSchema.d.mts +20 -1
  353. package/lib/schemas/ObjectSchema.d.ts +20 -1
  354. package/lib/schemas/ObjectSchema.js +5 -5
  355. package/lib/schemas/ObjectSchema.mjs +4 -4
  356. package/lib/schemas/StringSchema.d.mts +13 -1
  357. package/lib/schemas/StringSchema.d.ts +13 -1
  358. package/lib/schemas/StringSchema.js +10 -6
  359. package/lib/schemas/StringSchema.js.map +1 -1
  360. package/lib/schemas/StringSchema.mjs +9 -5
  361. package/lib/translationMap.d.mts +12 -0
  362. package/lib/translationMap.d.ts +12 -0
  363. package/lib/translationMap.js +14 -0
  364. package/lib/translationMap.js.map +1 -0
  365. package/lib/translationMap.mjs +14 -0
  366. package/lib/translationMap.mjs.map +1 -0
  367. package/package.json +23 -6
  368. package/lib/asserts/common/equalTo.d.mts +0 -29
  369. package/lib/asserts/common/equalTo.d.ts +0 -29
  370. package/lib/asserts/common/equalTo.js +0 -8
  371. package/lib/asserts/common/equalTo.js.map +0 -1
  372. package/lib/asserts/common/equalTo.mjs +0 -8
  373. package/lib/asserts/common/index.js +0 -10
  374. package/lib/asserts/common/index.js.map +0 -1
  375. package/lib/asserts/common/index.mjs +0 -10
  376. package/lib/chunk-2AP4OQMT.js +0 -26
  377. package/lib/chunk-2AP4OQMT.js.map +0 -1
  378. package/lib/chunk-5NCJN6D2.js +0 -70
  379. package/lib/chunk-5NCJN6D2.js.map +0 -1
  380. package/lib/chunk-5ZMICHV3.js +0 -21
  381. package/lib/chunk-5ZMICHV3.js.map +0 -1
  382. package/lib/chunk-63IQFNFO.mjs +0 -27
  383. package/lib/chunk-63IQFNFO.mjs.map +0 -1
  384. package/lib/chunk-A3UTB4RE.mjs.map +0 -1
  385. package/lib/chunk-AJ4WV5DG.mjs.map +0 -1
  386. package/lib/chunk-APTTIN2L.js.map +0 -1
  387. package/lib/chunk-AXOP6HPJ.js +0 -14
  388. package/lib/chunk-AXOP6HPJ.js.map +0 -1
  389. package/lib/chunk-FCFO5J5Y.mjs +0 -14
  390. package/lib/chunk-FCFO5J5Y.mjs.map +0 -1
  391. package/lib/chunk-GEZME6V2.mjs.map +0 -1
  392. package/lib/chunk-GNBSKTFV.js +0 -27
  393. package/lib/chunk-GNBSKTFV.js.map +0 -1
  394. package/lib/chunk-IQ3QYABE.js +0 -32
  395. package/lib/chunk-IQ3QYABE.js.map +0 -1
  396. package/lib/chunk-L7HUXYFV.mjs.map +0 -1
  397. package/lib/chunk-LHTJHMKJ.mjs +0 -27
  398. package/lib/chunk-LHTJHMKJ.mjs.map +0 -1
  399. package/lib/chunk-NOADI6PO.mjs +0 -21
  400. package/lib/chunk-NOADI6PO.mjs.map +0 -1
  401. package/lib/chunk-NWY33MFU.js +0 -13
  402. package/lib/chunk-NWY33MFU.js.map +0 -1
  403. package/lib/chunk-P3Y6IWFA.mjs +0 -70
  404. package/lib/chunk-P3Y6IWFA.mjs.map +0 -1
  405. package/lib/chunk-PDVXBE27.js +0 -27
  406. package/lib/chunk-PDVXBE27.js.map +0 -1
  407. package/lib/chunk-QJOXKH7A.mjs +0 -26
  408. package/lib/chunk-QJOXKH7A.mjs.map +0 -1
  409. package/lib/chunk-QYLH5ZAC.mjs.map +0 -1
  410. package/lib/chunk-VPFIIM2X.js.map +0 -1
  411. package/lib/chunk-YXHH5BF6.js +0 -28
  412. package/lib/chunk-YXHH5BF6.js.map +0 -1
  413. package/lib/core.d.mts +0 -1
  414. package/lib/core.d.ts +0 -1
  415. package/lib/core.js +0 -10
  416. package/lib/core.js.map +0 -1
  417. package/lib/core.mjs +0 -10
  418. package/lib/parseSchema.js +0 -9
  419. package/lib/parseSchema.js.map +0 -1
  420. package/lib/parseSchema.mjs +0 -9
  421. /package/lib/asserts/{common → mix}/equalTo.mjs.map +0 -0
  422. /package/lib/asserts/{common → mix}/index.mjs.map +0 -0
  423. /package/lib/{core.mjs.map → asserts/mix/oneOfValues.mjs.map} +0 -0
  424. /package/lib/{parseSchema.mjs.map → commonTypes.mjs.map} +0 -0
@@ -1,11 +1,19 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
- var _chunk2AP4OQMTjs = require('../../chunk-2AP4OQMT.js');
3
+ var _chunk5BVJ6YMHjs = require('../../chunk-5BVJ6YMH.js');
4
+
5
+
6
+ var _chunkWK4O3HH4js = require('../../chunk-WK4O3HH4.js');
4
7
 
5
8
  // src/asserts/number/negative.ts
6
- var negative = () => (received, pathToError) => {
7
- if (received >= 0) _chunk2AP4OQMTjs.throwException.call(void 0, "negative", received, pathToError, "The received value is not a negative number");
9
+ var negativeErrorMessage = "The received value is not a negative number";
10
+ var negativeErrorKey = "n:negative";
11
+ var negative = () => (received, ctx) => {
12
+ if (received >= 0) _chunkWK4O3HH4js.guardException.call(void 0, "negative", received, ctx, negativeErrorKey);
8
13
  };
14
+ negative.key = negativeErrorKey;
15
+ negative.message = negativeErrorMessage;
16
+ _chunk5BVJ6YMHjs.setToDefaultLocale.call(void 0, negative);
9
17
 
10
18
 
11
19
  exports.negative = negative;
@@ -1 +1 @@
1
- {"version":3,"sources":["/home/runner/work/bguard/bguard/lib/asserts/number/negative.js","../../../src/asserts/number/negative.ts"],"names":[],"mappings":"AAAA;AACE;AACF,0DAAgC;AAChC;AACA;ACUO,IAAM,SAAA,EAAW,CAAA,EAAA,GAA0B,CAAC,QAAA,EAAkB,WAAA,EAAA,GAAwB;AAC3F,EAAA,GAAA,CAAI,SAAA,GAAY,CAAA,EAAG,6CAAA,UAAe,EAAY,QAAA,EAAU,WAAA,EAAa,6CAA6C,CAAA;AACpH,CAAA;ADRA;AACE;AACF,4BAAC","file":"/home/runner/work/bguard/bguard/lib/asserts/number/negative.js","sourcesContent":[null,"import { throwException } from '../../exceptions';\nimport type { RequiredValidation } from '../../schemas/CommonSchema';\n\n/**\n * Asserts that a number value is negative (less than zero).\n *\n * @returns {RequiredValidation} - A validation function that takes a received number and a path to the error message. Throws an error if the received value is not negative.\n *\n * @example\n * const schema = number().custom(negative());\n * parseSchema(schema, -10); // Valid\n * parseSchema(schema, 0); // Throws an error: 'The received value is not a negative number'\n * parseSchema(schema, 5); // Throws an error: 'The received value is not a negative number'\n */\nexport const negative = (): RequiredValidation => (received: number, pathToError: string) => {\n if (received >= 0) throwException('negative', received, pathToError, 'The received value is not a negative number');\n};\n"]}
1
+ {"version":3,"sources":["/home/runner/work/bguard/bguard/lib/asserts/number/negative.js","../../../src/asserts/number/negative.ts"],"names":[],"mappings":"AAAA;AACE;AACF,0DAAgC;AAChC;AACE;AACF,0DAAgC;AAChC;AACA;ACHA,IAAM,qBAAA,EAAuB,6CAAA;AAC7B,IAAM,iBAAA,EAAmB,YAAA;AAclB,IAAM,SAAA,EAAW,CAAA,EAAA,GAA0B,CAAC,QAAA,EAAkB,GAAA,EAAA,GAA0B;AAC7F,EAAA,GAAA,CAAI,SAAA,GAAY,CAAA,EAAG,6CAAA,UAAe,EAAY,QAAA,EAAU,GAAA,EAAK,gBAAgB,CAAA;AAC/E,CAAA;AAEA,QAAA,CAAS,IAAA,EAAM,gBAAA;AACf,QAAA,CAAS,QAAA,EAAU,oBAAA;AACnB,iDAAA,QAA2B,CAAA;ADT3B;AACE;AACF,4BAAC","file":"/home/runner/work/bguard/bguard/lib/asserts/number/negative.js","sourcesContent":[null,"import { setToDefaultLocale } from '../../translationMap';\nimport { guardException } from '../../exceptions';\nimport { ExceptionContext, RequiredValidation } from '../../commonTypes';\n\nconst negativeErrorMessage = 'The received value is not a negative number';\nconst negativeErrorKey = 'n:negative';\n\n/**\n * @description Asserts that a number value is negative (less than zero).\n * @returns {RequiredValidation} A validation function that takes a received number and an exception context.\n * @throws {ValidationError} if the received value is not negative.\n * @example\n * const schema = number().custom(negative());\n * parseOrFail(schema, -10); // Valid\n * parseOrFail(schema, 0); // Throws an error: 'The received value is not a negative number'\n * parseOrFail(schema, 5); // Throws an error: 'The received value is not a negative number'\n *\n * @translation - Error Translation Key = 'n:negative'\n */\nexport const negative = (): RequiredValidation => (received: number, ctx: ExceptionContext) => {\n if (received >= 0) guardException('negative', received, ctx, negativeErrorKey);\n};\n\nnegative.key = negativeErrorKey;\nnegative.message = negativeErrorMessage;\nsetToDefaultLocale(negative);\n"]}
@@ -1,11 +1,19 @@
1
1
  import {
2
- throwException
3
- } from "../../chunk-QJOXKH7A.mjs";
2
+ setToDefaultLocale
3
+ } from "../../chunk-3HTYHE2X.mjs";
4
+ import {
5
+ guardException
6
+ } from "../../chunk-7XFLH6R2.mjs";
4
7
 
5
8
  // src/asserts/number/negative.ts
6
- var negative = () => (received, pathToError) => {
7
- if (received >= 0) throwException("negative", received, pathToError, "The received value is not a negative number");
9
+ var negativeErrorMessage = "The received value is not a negative number";
10
+ var negativeErrorKey = "n:negative";
11
+ var negative = () => (received, ctx) => {
12
+ if (received >= 0) guardException("negative", received, ctx, negativeErrorKey);
8
13
  };
14
+ negative.key = negativeErrorKey;
15
+ negative.message = negativeErrorMessage;
16
+ setToDefaultLocale(negative);
9
17
  export {
10
18
  negative
11
19
  };
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/asserts/number/negative.ts"],"sourcesContent":["import { throwException } from '../../exceptions';\nimport type { RequiredValidation } from '../../schemas/CommonSchema';\n\n/**\n * Asserts that a number value is negative (less than zero).\n *\n * @returns {RequiredValidation} - A validation function that takes a received number and a path to the error message. Throws an error if the received value is not negative.\n *\n * @example\n * const schema = number().custom(negative());\n * parseSchema(schema, -10); // Valid\n * parseSchema(schema, 0); // Throws an error: 'The received value is not a negative number'\n * parseSchema(schema, 5); // Throws an error: 'The received value is not a negative number'\n */\nexport const negative = (): RequiredValidation => (received: number, pathToError: string) => {\n if (received >= 0) throwException('negative', received, pathToError, 'The received value is not a negative number');\n};\n"],"mappings":";;;;;AAcO,IAAM,WAAW,MAA0B,CAAC,UAAkB,gBAAwB;AAC3F,MAAI,YAAY,EAAG,gBAAe,YAAY,UAAU,aAAa,6CAA6C;AACpH;","names":[]}
1
+ {"version":3,"sources":["../../../src/asserts/number/negative.ts"],"sourcesContent":["import { setToDefaultLocale } from '../../translationMap';\nimport { guardException } from '../../exceptions';\nimport { ExceptionContext, RequiredValidation } from '../../commonTypes';\n\nconst negativeErrorMessage = 'The received value is not a negative number';\nconst negativeErrorKey = 'n:negative';\n\n/**\n * @description Asserts that a number value is negative (less than zero).\n * @returns {RequiredValidation} A validation function that takes a received number and an exception context.\n * @throws {ValidationError} if the received value is not negative.\n * @example\n * const schema = number().custom(negative());\n * parseOrFail(schema, -10); // Valid\n * parseOrFail(schema, 0); // Throws an error: 'The received value is not a negative number'\n * parseOrFail(schema, 5); // Throws an error: 'The received value is not a negative number'\n *\n * @translation - Error Translation Key = 'n:negative'\n */\nexport const negative = (): RequiredValidation => (received: number, ctx: ExceptionContext) => {\n if (received >= 0) guardException('negative', received, ctx, negativeErrorKey);\n};\n\nnegative.key = negativeErrorKey;\nnegative.message = negativeErrorMessage;\nsetToDefaultLocale(negative);\n"],"mappings":";;;;;;;;AAIA,IAAM,uBAAuB;AAC7B,IAAM,mBAAmB;AAclB,IAAM,WAAW,MAA0B,CAAC,UAAkB,QAA0B;AAC7F,MAAI,YAAY,EAAG,gBAAe,YAAY,UAAU,KAAK,gBAAgB;AAC/E;AAEA,SAAS,MAAM;AACf,SAAS,UAAU;AACnB,mBAAmB,QAAQ;","names":[]}
@@ -1,16 +1,21 @@
1
- import { R as RequiredValidation } from '../../CommonSchema-BIe85W_A.mjs';
1
+ import { RequiredValidation } from '../../commonTypes.mjs';
2
2
 
3
3
  /**
4
- * Asserts that a number value is positive (greater than zero).
5
- *
6
- * @returns {RequiredValidation} - A validation function that takes a received number and a path to the error message. Throws an error if the received value is not positive.
7
- *
4
+ * @description Asserts that a number value is positive (greater than zero).
5
+ * @returns {RequiredValidation} A validation function that takes a received number and an exception context.
6
+ * @throws {ValidationError} if the received value is not positive.
8
7
  * @example
9
8
  * const schema = number().custom(positive());
10
- * parseSchema(schema, 10); // Valid
11
- * parseSchema(schema, 0); // Throws an error: 'The received value is not a positive number'
12
- * parseSchema(schema, -5); // Throws an error: 'The received value is not a positive number'
9
+ * parseOrFail(schema, 10); // Valid
10
+ * parseOrFail(schema, 0); // Throws an error: 'The received value is not a positive number'
11
+ * parseOrFail(schema, -5); // Throws an error: 'The received value is not a positive number'
12
+ *
13
+ * @translation Error Translation Key = 'n:positive'
13
14
  */
14
- declare const positive: () => RequiredValidation;
15
+ declare const positive: {
16
+ (): RequiredValidation;
17
+ key: string;
18
+ message: string;
19
+ };
15
20
 
16
21
  export { positive };
@@ -1,16 +1,21 @@
1
- import { R as RequiredValidation } from '../../CommonSchema-BIe85W_A.js';
1
+ import { RequiredValidation } from '../../commonTypes.js';
2
2
 
3
3
  /**
4
- * Asserts that a number value is positive (greater than zero).
5
- *
6
- * @returns {RequiredValidation} - A validation function that takes a received number and a path to the error message. Throws an error if the received value is not positive.
7
- *
4
+ * @description Asserts that a number value is positive (greater than zero).
5
+ * @returns {RequiredValidation} A validation function that takes a received number and an exception context.
6
+ * @throws {ValidationError} if the received value is not positive.
8
7
  * @example
9
8
  * const schema = number().custom(positive());
10
- * parseSchema(schema, 10); // Valid
11
- * parseSchema(schema, 0); // Throws an error: 'The received value is not a positive number'
12
- * parseSchema(schema, -5); // Throws an error: 'The received value is not a positive number'
9
+ * parseOrFail(schema, 10); // Valid
10
+ * parseOrFail(schema, 0); // Throws an error: 'The received value is not a positive number'
11
+ * parseOrFail(schema, -5); // Throws an error: 'The received value is not a positive number'
12
+ *
13
+ * @translation Error Translation Key = 'n:positive'
13
14
  */
14
- declare const positive: () => RequiredValidation;
15
+ declare const positive: {
16
+ (): RequiredValidation;
17
+ key: string;
18
+ message: string;
19
+ };
15
20
 
16
21
  export { positive };
@@ -1,11 +1,19 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
- var _chunk2AP4OQMTjs = require('../../chunk-2AP4OQMT.js');
3
+ var _chunk5BVJ6YMHjs = require('../../chunk-5BVJ6YMH.js');
4
+
5
+
6
+ var _chunkWK4O3HH4js = require('../../chunk-WK4O3HH4.js');
4
7
 
5
8
  // src/asserts/number/positive.ts
6
- var positive = () => (received, pathToError) => {
7
- if (received <= 0) _chunk2AP4OQMTjs.throwException.call(void 0, "positive", received, pathToError, "The received value is not a positive number");
9
+ var positiveErrorMessage = "The received value is not a positive number";
10
+ var positiveErrorKey = "n:positive";
11
+ var positive = () => (received, ctx) => {
12
+ if (received <= 0) _chunkWK4O3HH4js.guardException.call(void 0, "positive", received, ctx, positiveErrorMessage);
8
13
  };
14
+ positive.key = positiveErrorKey;
15
+ positive.message = positiveErrorMessage;
16
+ _chunk5BVJ6YMHjs.setToDefaultLocale.call(void 0, positive);
9
17
 
10
18
 
11
19
  exports.positive = positive;
@@ -1 +1 @@
1
- {"version":3,"sources":["/home/runner/work/bguard/bguard/lib/asserts/number/positive.js","../../../src/asserts/number/positive.ts"],"names":[],"mappings":"AAAA;AACE;AACF,0DAAgC;AAChC;AACA;ACUO,IAAM,SAAA,EAAW,CAAA,EAAA,GAA0B,CAAC,QAAA,EAAkB,WAAA,EAAA,GAAwB;AAC3F,EAAA,GAAA,CAAI,SAAA,GAAY,CAAA,EAAG,6CAAA,UAAe,EAAY,QAAA,EAAU,WAAA,EAAa,6CAA6C,CAAA;AACpH,CAAA;ADRA;AACE;AACF,4BAAC","file":"/home/runner/work/bguard/bguard/lib/asserts/number/positive.js","sourcesContent":[null,"import { throwException } from '../../exceptions';\nimport type { RequiredValidation } from '../../schemas/CommonSchema';\n\n/**\n * Asserts that a number value is positive (greater than zero).\n *\n * @returns {RequiredValidation} - A validation function that takes a received number and a path to the error message. Throws an error if the received value is not positive.\n *\n * @example\n * const schema = number().custom(positive());\n * parseSchema(schema, 10); // Valid\n * parseSchema(schema, 0); // Throws an error: 'The received value is not a positive number'\n * parseSchema(schema, -5); // Throws an error: 'The received value is not a positive number'\n */\nexport const positive = (): RequiredValidation => (received: number, pathToError: string) => {\n if (received <= 0) throwException('positive', received, pathToError, 'The received value is not a positive number');\n};\n"]}
1
+ {"version":3,"sources":["/home/runner/work/bguard/bguard/lib/asserts/number/positive.js","../../../src/asserts/number/positive.ts"],"names":[],"mappings":"AAAA;AACE;AACF,0DAAgC;AAChC;AACE;AACF,0DAAgC;AAChC;AACA;ACHA,IAAM,qBAAA,EAAuB,6CAAA;AAC7B,IAAM,iBAAA,EAAmB,YAAA;AAclB,IAAM,SAAA,EAAW,CAAA,EAAA,GAA0B,CAAC,QAAA,EAAkB,GAAA,EAAA,GAA0B;AAC7F,EAAA,GAAA,CAAI,SAAA,GAAY,CAAA,EAAG,6CAAA,UAAe,EAAY,QAAA,EAAU,GAAA,EAAK,oBAAoB,CAAA;AACnF,CAAA;AAEA,QAAA,CAAS,IAAA,EAAM,gBAAA;AACf,QAAA,CAAS,QAAA,EAAU,oBAAA;AACnB,iDAAA,QAA2B,CAAA;ADT3B;AACE;AACF,4BAAC","file":"/home/runner/work/bguard/bguard/lib/asserts/number/positive.js","sourcesContent":[null,"import { setToDefaultLocale } from '../../translationMap';\nimport { guardException } from '../../exceptions';\nimport { ExceptionContext, RequiredValidation } from '../../commonTypes';\n\nconst positiveErrorMessage = 'The received value is not a positive number';\nconst positiveErrorKey = 'n:positive';\n\n/**\n * @description Asserts that a number value is positive (greater than zero).\n * @returns {RequiredValidation} A validation function that takes a received number and an exception context.\n * @throws {ValidationError} if the received value is not positive.\n * @example\n * const schema = number().custom(positive());\n * parseOrFail(schema, 10); // Valid\n * parseOrFail(schema, 0); // Throws an error: 'The received value is not a positive number'\n * parseOrFail(schema, -5); // Throws an error: 'The received value is not a positive number'\n *\n * @translation Error Translation Key = 'n:positive'\n */\nexport const positive = (): RequiredValidation => (received: number, ctx: ExceptionContext) => {\n if (received <= 0) guardException('positive', received, ctx, positiveErrorMessage);\n};\n\npositive.key = positiveErrorKey;\npositive.message = positiveErrorMessage;\nsetToDefaultLocale(positive);\n"]}
@@ -1,11 +1,19 @@
1
1
  import {
2
- throwException
3
- } from "../../chunk-QJOXKH7A.mjs";
2
+ setToDefaultLocale
3
+ } from "../../chunk-3HTYHE2X.mjs";
4
+ import {
5
+ guardException
6
+ } from "../../chunk-7XFLH6R2.mjs";
4
7
 
5
8
  // src/asserts/number/positive.ts
6
- var positive = () => (received, pathToError) => {
7
- if (received <= 0) throwException("positive", received, pathToError, "The received value is not a positive number");
9
+ var positiveErrorMessage = "The received value is not a positive number";
10
+ var positiveErrorKey = "n:positive";
11
+ var positive = () => (received, ctx) => {
12
+ if (received <= 0) guardException("positive", received, ctx, positiveErrorMessage);
8
13
  };
14
+ positive.key = positiveErrorKey;
15
+ positive.message = positiveErrorMessage;
16
+ setToDefaultLocale(positive);
9
17
  export {
10
18
  positive
11
19
  };
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/asserts/number/positive.ts"],"sourcesContent":["import { throwException } from '../../exceptions';\nimport type { RequiredValidation } from '../../schemas/CommonSchema';\n\n/**\n * Asserts that a number value is positive (greater than zero).\n *\n * @returns {RequiredValidation} - A validation function that takes a received number and a path to the error message. Throws an error if the received value is not positive.\n *\n * @example\n * const schema = number().custom(positive());\n * parseSchema(schema, 10); // Valid\n * parseSchema(schema, 0); // Throws an error: 'The received value is not a positive number'\n * parseSchema(schema, -5); // Throws an error: 'The received value is not a positive number'\n */\nexport const positive = (): RequiredValidation => (received: number, pathToError: string) => {\n if (received <= 0) throwException('positive', received, pathToError, 'The received value is not a positive number');\n};\n"],"mappings":";;;;;AAcO,IAAM,WAAW,MAA0B,CAAC,UAAkB,gBAAwB;AAC3F,MAAI,YAAY,EAAG,gBAAe,YAAY,UAAU,aAAa,6CAA6C;AACpH;","names":[]}
1
+ {"version":3,"sources":["../../../src/asserts/number/positive.ts"],"sourcesContent":["import { setToDefaultLocale } from '../../translationMap';\nimport { guardException } from '../../exceptions';\nimport { ExceptionContext, RequiredValidation } from '../../commonTypes';\n\nconst positiveErrorMessage = 'The received value is not a positive number';\nconst positiveErrorKey = 'n:positive';\n\n/**\n * @description Asserts that a number value is positive (greater than zero).\n * @returns {RequiredValidation} A validation function that takes a received number and an exception context.\n * @throws {ValidationError} if the received value is not positive.\n * @example\n * const schema = number().custom(positive());\n * parseOrFail(schema, 10); // Valid\n * parseOrFail(schema, 0); // Throws an error: 'The received value is not a positive number'\n * parseOrFail(schema, -5); // Throws an error: 'The received value is not a positive number'\n *\n * @translation Error Translation Key = 'n:positive'\n */\nexport const positive = (): RequiredValidation => (received: number, ctx: ExceptionContext) => {\n if (received <= 0) guardException('positive', received, ctx, positiveErrorMessage);\n};\n\npositive.key = positiveErrorKey;\npositive.message = positiveErrorMessage;\nsetToDefaultLocale(positive);\n"],"mappings":";;;;;;;;AAIA,IAAM,uBAAuB;AAC7B,IAAM,mBAAmB;AAclB,IAAM,WAAW,MAA0B,CAAC,UAAkB,QAA0B;AAC7F,MAAI,YAAY,EAAG,gBAAe,YAAY,UAAU,KAAK,oBAAoB;AACnF;AAEA,SAAS,MAAM;AACf,SAAS,UAAU;AACnB,mBAAmB,QAAQ;","names":[]}
@@ -1,5 +1,6 @@
1
- import { O as ObjectShapeSchemaType } from '../../CommonSchema-BIe85W_A.mjs';
1
+ import { O as ObjectShapeSchemaType } from '../../CommonSchema-CjsYE4dC.mjs';
2
2
  import { WithObject } from '../../schemas/ObjectSchema.mjs';
3
+ import '../../commonTypes.mjs';
3
4
 
4
5
  /**
5
6
  * Creates a new schema for validating objects where each property must match the specified schema.
@@ -13,8 +14,8 @@ import { WithObject } from '../../schemas/ObjectSchema.mjs';
13
14
  * name: string(),
14
15
  * age: number()
15
16
  * });
16
- * parseSchema(schema, { name: 'John', age: 30 }); // Validates successfully
17
- * parseSchema(schema, { name: 'John', age: '30' }); // Throws a validation error
17
+ * parseOrFail(schema, { name: 'John', age: 30 }); // Validates successfully
18
+ * parseOrFail(schema, { name: 'John', age: '30' }); // Throws a validation error
18
19
  */
19
20
  declare function object<T extends ObjectShapeSchemaType>(shapeSchema: T): WithObject<T>;
20
21
 
@@ -1,5 +1,6 @@
1
- import { O as ObjectShapeSchemaType } from '../../CommonSchema-BIe85W_A.js';
1
+ import { O as ObjectShapeSchemaType } from '../../CommonSchema-BbGNki0L.js';
2
2
  import { WithObject } from '../../schemas/ObjectSchema.js';
3
+ import '../../commonTypes.js';
3
4
 
4
5
  /**
5
6
  * Creates a new schema for validating objects where each property must match the specified schema.
@@ -13,8 +14,8 @@ import { WithObject } from '../../schemas/ObjectSchema.js';
13
14
  * name: string(),
14
15
  * age: number()
15
16
  * });
16
- * parseSchema(schema, { name: 'John', age: 30 }); // Validates successfully
17
- * parseSchema(schema, { name: 'John', age: '30' }); // Throws a validation error
17
+ * parseOrFail(schema, { name: 'John', age: 30 }); // Validates successfully
18
+ * parseOrFail(schema, { name: 'John', age: '30' }); // Throws a validation error
18
19
  */
19
20
  declare function object<T extends ObjectShapeSchemaType>(shapeSchema: T): WithObject<T>;
20
21
 
@@ -1,11 +1,11 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
- var _chunkK2S3FS5Kjs = require('../../chunk-K2S3FS5K.js');
4
- require('../../chunk-IQ3QYABE.js');
5
- require('../../chunk-APTTIN2L.js');
6
- require('../../chunk-5NCJN6D2.js');
7
- require('../../chunk-2AP4OQMT.js');
3
+ var _chunkVHEA4JZ5js = require('../../chunk-VHEA4JZ5.js');
4
+ require('../../chunk-6TH3DBDK.js');
5
+ require('../../chunk-EGEHSELT.js');
6
+ require('../../chunk-IRG4OQAB.js');
7
+ require('../../chunk-WK4O3HH4.js');
8
8
 
9
9
 
10
- exports.object = _chunkK2S3FS5Kjs.object;
10
+ exports.object = _chunkVHEA4JZ5js.object;
11
11
  //# sourceMappingURL=index.js.map
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  object
3
- } from "../../chunk-32IQXZRK.mjs";
4
- import "../../chunk-QYLH5ZAC.mjs";
5
- import "../../chunk-L7HUXYFV.mjs";
6
- import "../../chunk-P3Y6IWFA.mjs";
7
- import "../../chunk-QJOXKH7A.mjs";
3
+ } from "../../chunk-2PM3K3OE.mjs";
4
+ import "../../chunk-TCQY2R3U.mjs";
5
+ import "../../chunk-DPBE7TAQ.mjs";
6
+ import "../../chunk-PH2PMUZP.mjs";
7
+ import "../../chunk-7XFLH6R2.mjs";
8
8
  export {
9
9
  object
10
10
  };
@@ -0,0 +1,20 @@
1
+ import { RequiredValidation } from '../../commonTypes.mjs';
2
+
3
+ /**
4
+ * @description Asserts that a string value contains at least one digit.
5
+ * @returns {RequiredValidation} A validation function that takes a received string and an exception context.
6
+ * @throws {ValidationError} if the received value does not contain at least one digit.
7
+ * @example
8
+ * const schema = string().custom(atLeastOneDigit());
9
+ * parseOrFail(schema, 'abc123'); // Valid
10
+ * parseOrFail(schema, 'abcdef'); // Throws an error: 'The received value does not contain at least one digit'
11
+ *
12
+ * @translation Error Translation Key = 's:atLeastOneDigit'
13
+ */
14
+ declare const atLeastOneDigit: {
15
+ (): RequiredValidation;
16
+ key: string;
17
+ message: string;
18
+ };
19
+
20
+ export { atLeastOneDigit };
@@ -0,0 +1,20 @@
1
+ import { RequiredValidation } from '../../commonTypes.js';
2
+
3
+ /**
4
+ * @description Asserts that a string value contains at least one digit.
5
+ * @returns {RequiredValidation} A validation function that takes a received string and an exception context.
6
+ * @throws {ValidationError} if the received value does not contain at least one digit.
7
+ * @example
8
+ * const schema = string().custom(atLeastOneDigit());
9
+ * parseOrFail(schema, 'abc123'); // Valid
10
+ * parseOrFail(schema, 'abcdef'); // Throws an error: 'The received value does not contain at least one digit'
11
+ *
12
+ * @translation Error Translation Key = 's:atLeastOneDigit'
13
+ */
14
+ declare const atLeastOneDigit: {
15
+ (): RequiredValidation;
16
+ key: string;
17
+ message: string;
18
+ };
19
+
20
+ export { atLeastOneDigit };
@@ -0,0 +1,21 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
+
3
+ var _chunk5BVJ6YMHjs = require('../../chunk-5BVJ6YMH.js');
4
+
5
+
6
+ var _chunkWK4O3HH4js = require('../../chunk-WK4O3HH4.js');
7
+
8
+ // src/asserts/string/atLeastOneDigit.ts
9
+ var digitRegExp = /\d/;
10
+ var atLeastOneDigitErrorMessage = "The received value does not contain at least one digit";
11
+ var atLeastOneDigitErrorKey = "s:atLeastOneDigit";
12
+ var atLeastOneDigit = () => (received, ctx) => {
13
+ if (!digitRegExp.test(received)) _chunkWK4O3HH4js.guardException.call(void 0, "at least one digit", received, ctx, atLeastOneDigitErrorKey);
14
+ };
15
+ atLeastOneDigit.key = atLeastOneDigitErrorKey;
16
+ atLeastOneDigit.message = atLeastOneDigitErrorMessage;
17
+ _chunk5BVJ6YMHjs.setToDefaultLocale.call(void 0, atLeastOneDigit);
18
+
19
+
20
+ exports.atLeastOneDigit = atLeastOneDigit;
21
+ //# sourceMappingURL=atLeastOneDigit.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["/home/runner/work/bguard/bguard/lib/asserts/string/atLeastOneDigit.js","../../../src/asserts/string/atLeastOneDigit.ts"],"names":[],"mappings":"AAAA;AACE;AACF,0DAAgC;AAChC;AACE;AACF,0DAAgC;AAChC;AACA;ACHA,IAAM,YAAA,EAAc,IAAA;AACpB,IAAM,4BAAA,EAA8B,wDAAA;AACpC,IAAM,wBAAA,EAA0B,mBAAA;AAazB,IAAM,gBAAA,EAAkB,CAAA,EAAA,GAA0B,CAAC,QAAA,EAAkB,GAAA,EAAA,GAA0B;AACpG,EAAA,GAAA,CAAI,CAAC,WAAA,CAAY,IAAA,CAAK,QAAQ,CAAA,EAAG,6CAAA,oBAAe,EAAsB,QAAA,EAAU,GAAA,EAAK,uBAAuB,CAAA;AAC9G,CAAA;AAEA,eAAA,CAAgB,IAAA,EAAM,uBAAA;AACtB,eAAA,CAAgB,QAAA,EAAU,2BAAA;AAC1B,iDAAA,eAAkC,CAAA;ADRlC;AACE;AACF,0CAAC","file":"/home/runner/work/bguard/bguard/lib/asserts/string/atLeastOneDigit.js","sourcesContent":[null,"import { ExceptionContext, RequiredValidation } from '../../commonTypes';\nimport { guardException } from '../../exceptions';\nimport { setToDefaultLocale } from '../../translationMap';\n\nconst digitRegExp = /\\d/;\nconst atLeastOneDigitErrorMessage = 'The received value does not contain at least one digit';\nconst atLeastOneDigitErrorKey = 's:atLeastOneDigit';\n\n/**\n * @description Asserts that a string value contains at least one digit.\n * @returns {RequiredValidation} A validation function that takes a received string and an exception context.\n * @throws {ValidationError} if the received value does not contain at least one digit.\n * @example\n * const schema = string().custom(atLeastOneDigit());\n * parseOrFail(schema, 'abc123'); // Valid\n * parseOrFail(schema, 'abcdef'); // Throws an error: 'The received value does not contain at least one digit'\n *\n * @translation Error Translation Key = 's:atLeastOneDigit'\n */\nexport const atLeastOneDigit = (): RequiredValidation => (received: string, ctx: ExceptionContext) => {\n if (!digitRegExp.test(received)) guardException('at least one digit', received, ctx, atLeastOneDigitErrorKey);\n};\n\natLeastOneDigit.key = atLeastOneDigitErrorKey;\natLeastOneDigit.message = atLeastOneDigitErrorMessage;\nsetToDefaultLocale(atLeastOneDigit);\n"]}
@@ -0,0 +1,21 @@
1
+ import {
2
+ setToDefaultLocale
3
+ } from "../../chunk-3HTYHE2X.mjs";
4
+ import {
5
+ guardException
6
+ } from "../../chunk-7XFLH6R2.mjs";
7
+
8
+ // src/asserts/string/atLeastOneDigit.ts
9
+ var digitRegExp = /\d/;
10
+ var atLeastOneDigitErrorMessage = "The received value does not contain at least one digit";
11
+ var atLeastOneDigitErrorKey = "s:atLeastOneDigit";
12
+ var atLeastOneDigit = () => (received, ctx) => {
13
+ if (!digitRegExp.test(received)) guardException("at least one digit", received, ctx, atLeastOneDigitErrorKey);
14
+ };
15
+ atLeastOneDigit.key = atLeastOneDigitErrorKey;
16
+ atLeastOneDigit.message = atLeastOneDigitErrorMessage;
17
+ setToDefaultLocale(atLeastOneDigit);
18
+ export {
19
+ atLeastOneDigit
20
+ };
21
+ //# sourceMappingURL=atLeastOneDigit.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/asserts/string/atLeastOneDigit.ts"],"sourcesContent":["import { ExceptionContext, RequiredValidation } from '../../commonTypes';\nimport { guardException } from '../../exceptions';\nimport { setToDefaultLocale } from '../../translationMap';\n\nconst digitRegExp = /\\d/;\nconst atLeastOneDigitErrorMessage = 'The received value does not contain at least one digit';\nconst atLeastOneDigitErrorKey = 's:atLeastOneDigit';\n\n/**\n * @description Asserts that a string value contains at least one digit.\n * @returns {RequiredValidation} A validation function that takes a received string and an exception context.\n * @throws {ValidationError} if the received value does not contain at least one digit.\n * @example\n * const schema = string().custom(atLeastOneDigit());\n * parseOrFail(schema, 'abc123'); // Valid\n * parseOrFail(schema, 'abcdef'); // Throws an error: 'The received value does not contain at least one digit'\n *\n * @translation Error Translation Key = 's:atLeastOneDigit'\n */\nexport const atLeastOneDigit = (): RequiredValidation => (received: string, ctx: ExceptionContext) => {\n if (!digitRegExp.test(received)) guardException('at least one digit', received, ctx, atLeastOneDigitErrorKey);\n};\n\natLeastOneDigit.key = atLeastOneDigitErrorKey;\natLeastOneDigit.message = atLeastOneDigitErrorMessage;\nsetToDefaultLocale(atLeastOneDigit);\n"],"mappings":";;;;;;;;AAIA,IAAM,cAAc;AACpB,IAAM,8BAA8B;AACpC,IAAM,0BAA0B;AAazB,IAAM,kBAAkB,MAA0B,CAAC,UAAkB,QAA0B;AACpG,MAAI,CAAC,YAAY,KAAK,QAAQ,EAAG,gBAAe,sBAAsB,UAAU,KAAK,uBAAuB;AAC9G;AAEA,gBAAgB,MAAM;AACtB,gBAAgB,UAAU;AAC1B,mBAAmB,eAAe;","names":[]}
@@ -0,0 +1,20 @@
1
+ import { RequiredValidation } from '../../commonTypes.mjs';
2
+
3
+ /**
4
+ * @description Asserts that a string value contains at least one lowercase character.
5
+ * @returns {RequiredValidation} A validation function that takes a received string and an exception context.
6
+ * @throws {ValidationError} if the received value does not contain at least one lowercase character.
7
+ * @example
8
+ * const schema = string().custom(atLeastOneLowerChar());
9
+ * parseOrFail(schema, 'abcDEF'); // Valid
10
+ * parseOrFail(schema, 'ABCDEF'); // Throws an error: 'The received value does not contain at least one lowercase character'
11
+ *
12
+ * @translation Error Translation Key = 's:atLeastOneLowerChar'
13
+ */
14
+ declare const atLeastOneLowerChar: {
15
+ (): RequiredValidation;
16
+ key: string;
17
+ message: string;
18
+ };
19
+
20
+ export { atLeastOneLowerChar };
@@ -0,0 +1,20 @@
1
+ import { RequiredValidation } from '../../commonTypes.js';
2
+
3
+ /**
4
+ * @description Asserts that a string value contains at least one lowercase character.
5
+ * @returns {RequiredValidation} A validation function that takes a received string and an exception context.
6
+ * @throws {ValidationError} if the received value does not contain at least one lowercase character.
7
+ * @example
8
+ * const schema = string().custom(atLeastOneLowerChar());
9
+ * parseOrFail(schema, 'abcDEF'); // Valid
10
+ * parseOrFail(schema, 'ABCDEF'); // Throws an error: 'The received value does not contain at least one lowercase character'
11
+ *
12
+ * @translation Error Translation Key = 's:atLeastOneLowerChar'
13
+ */
14
+ declare const atLeastOneLowerChar: {
15
+ (): RequiredValidation;
16
+ key: string;
17
+ message: string;
18
+ };
19
+
20
+ export { atLeastOneLowerChar };
@@ -0,0 +1,22 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
+
3
+ var _chunk5BVJ6YMHjs = require('../../chunk-5BVJ6YMH.js');
4
+
5
+
6
+ var _chunkWK4O3HH4js = require('../../chunk-WK4O3HH4.js');
7
+
8
+ // src/asserts/string/atLeastOneLowerChar.ts
9
+ var atLeastOneLowerCharErrorMessage = "The received value does not contain at least one lowercase character";
10
+ var atLeastOneLowerCharErrorKey = "s:atLeastOneLowerChar";
11
+ var atLeastOneLowerChar = () => (received, ctx) => {
12
+ const lowerCharRegExp = /[a-z]/;
13
+ if (!lowerCharRegExp.test(received))
14
+ _chunkWK4O3HH4js.guardException.call(void 0, "at least one lowercase character", received, ctx, atLeastOneLowerCharErrorKey);
15
+ };
16
+ atLeastOneLowerChar.key = atLeastOneLowerCharErrorKey;
17
+ atLeastOneLowerChar.message = atLeastOneLowerCharErrorMessage;
18
+ _chunk5BVJ6YMHjs.setToDefaultLocale.call(void 0, atLeastOneLowerChar);
19
+
20
+
21
+ exports.atLeastOneLowerChar = atLeastOneLowerChar;
22
+ //# sourceMappingURL=atLeastOneLowerChar.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["/home/runner/work/bguard/bguard/lib/asserts/string/atLeastOneLowerChar.js","../../../src/asserts/string/atLeastOneLowerChar.ts"],"names":[],"mappings":"AAAA;AACE;AACF,0DAAgC;AAChC;AACE;AACF,0DAAgC;AAChC;AACA;ACHA,IAAM,gCAAA,EAAkC,sEAAA;AACxC,IAAM,4BAAA,EAA8B,uBAAA;AAa7B,IAAM,oBAAA,EAAsB,CAAA,EAAA,GAA0B,CAAC,QAAA,EAAkB,GAAA,EAAA,GAA0B;AACxG,EAAA,MAAM,gBAAA,EAAkB,OAAA;AACxB,EAAA,GAAA,CAAI,CAAC,eAAA,CAAgB,IAAA,CAAK,QAAQ,CAAA;AAChC,IAAA,6CAAA,kCAAe,EAAoC,QAAA,EAAU,GAAA,EAAK,2BAA2B,CAAA;AACjG,CAAA;AAEA,mBAAA,CAAoB,IAAA,EAAM,2BAAA;AAC1B,mBAAA,CAAoB,QAAA,EAAU,+BAAA;AAC9B,iDAAA,mBAAsC,CAAA;ADRtC;AACE;AACF,kDAAC","file":"/home/runner/work/bguard/bguard/lib/asserts/string/atLeastOneLowerChar.js","sourcesContent":[null,"import { ExceptionContext, RequiredValidation } from '../../commonTypes';\nimport { guardException } from '../../exceptions';\nimport { setToDefaultLocale } from '../../translationMap';\n\nconst atLeastOneLowerCharErrorMessage = 'The received value does not contain at least one lowercase character';\nconst atLeastOneLowerCharErrorKey = 's:atLeastOneLowerChar';\n\n/**\n * @description Asserts that a string value contains at least one lowercase character.\n * @returns {RequiredValidation} A validation function that takes a received string and an exception context.\n * @throws {ValidationError} if the received value does not contain at least one lowercase character.\n * @example\n * const schema = string().custom(atLeastOneLowerChar());\n * parseOrFail(schema, 'abcDEF'); // Valid\n * parseOrFail(schema, 'ABCDEF'); // Throws an error: 'The received value does not contain at least one lowercase character'\n *\n * @translation Error Translation Key = 's:atLeastOneLowerChar'\n */\nexport const atLeastOneLowerChar = (): RequiredValidation => (received: string, ctx: ExceptionContext) => {\n const lowerCharRegExp = /[a-z]/;\n if (!lowerCharRegExp.test(received))\n guardException('at least one lowercase character', received, ctx, atLeastOneLowerCharErrorKey);\n};\n\natLeastOneLowerChar.key = atLeastOneLowerCharErrorKey;\natLeastOneLowerChar.message = atLeastOneLowerCharErrorMessage;\nsetToDefaultLocale(atLeastOneLowerChar);\n"]}
@@ -0,0 +1,22 @@
1
+ import {
2
+ setToDefaultLocale
3
+ } from "../../chunk-3HTYHE2X.mjs";
4
+ import {
5
+ guardException
6
+ } from "../../chunk-7XFLH6R2.mjs";
7
+
8
+ // src/asserts/string/atLeastOneLowerChar.ts
9
+ var atLeastOneLowerCharErrorMessage = "The received value does not contain at least one lowercase character";
10
+ var atLeastOneLowerCharErrorKey = "s:atLeastOneLowerChar";
11
+ var atLeastOneLowerChar = () => (received, ctx) => {
12
+ const lowerCharRegExp = /[a-z]/;
13
+ if (!lowerCharRegExp.test(received))
14
+ guardException("at least one lowercase character", received, ctx, atLeastOneLowerCharErrorKey);
15
+ };
16
+ atLeastOneLowerChar.key = atLeastOneLowerCharErrorKey;
17
+ atLeastOneLowerChar.message = atLeastOneLowerCharErrorMessage;
18
+ setToDefaultLocale(atLeastOneLowerChar);
19
+ export {
20
+ atLeastOneLowerChar
21
+ };
22
+ //# sourceMappingURL=atLeastOneLowerChar.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/asserts/string/atLeastOneLowerChar.ts"],"sourcesContent":["import { ExceptionContext, RequiredValidation } from '../../commonTypes';\nimport { guardException } from '../../exceptions';\nimport { setToDefaultLocale } from '../../translationMap';\n\nconst atLeastOneLowerCharErrorMessage = 'The received value does not contain at least one lowercase character';\nconst atLeastOneLowerCharErrorKey = 's:atLeastOneLowerChar';\n\n/**\n * @description Asserts that a string value contains at least one lowercase character.\n * @returns {RequiredValidation} A validation function that takes a received string and an exception context.\n * @throws {ValidationError} if the received value does not contain at least one lowercase character.\n * @example\n * const schema = string().custom(atLeastOneLowerChar());\n * parseOrFail(schema, 'abcDEF'); // Valid\n * parseOrFail(schema, 'ABCDEF'); // Throws an error: 'The received value does not contain at least one lowercase character'\n *\n * @translation Error Translation Key = 's:atLeastOneLowerChar'\n */\nexport const atLeastOneLowerChar = (): RequiredValidation => (received: string, ctx: ExceptionContext) => {\n const lowerCharRegExp = /[a-z]/;\n if (!lowerCharRegExp.test(received))\n guardException('at least one lowercase character', received, ctx, atLeastOneLowerCharErrorKey);\n};\n\natLeastOneLowerChar.key = atLeastOneLowerCharErrorKey;\natLeastOneLowerChar.message = atLeastOneLowerCharErrorMessage;\nsetToDefaultLocale(atLeastOneLowerChar);\n"],"mappings":";;;;;;;;AAIA,IAAM,kCAAkC;AACxC,IAAM,8BAA8B;AAa7B,IAAM,sBAAsB,MAA0B,CAAC,UAAkB,QAA0B;AACxG,QAAM,kBAAkB;AACxB,MAAI,CAAC,gBAAgB,KAAK,QAAQ;AAChC,mBAAe,oCAAoC,UAAU,KAAK,2BAA2B;AACjG;AAEA,oBAAoB,MAAM;AAC1B,oBAAoB,UAAU;AAC9B,mBAAmB,mBAAmB;","names":[]}
@@ -0,0 +1,25 @@
1
+ import { RequiredValidation } from '../../commonTypes.mjs';
2
+
3
+ /**
4
+ * @description Asserts that a string value contains at least one special character.
5
+ * @param {string} [allowedSpecialChars=* '@!#%&()^~{}'] The string containing allowed special characters. Defaults to '*@!#%&()^~{}'.
6
+ * @returns {RequiredValidation} A validation function that takes a received string and an exception context.
7
+ * @throws {ValidationError} if the received value does not contain at least one of the allowed special characters.
8
+ * @example
9
+ * const schema = string().custom(atLeastOneSpecialChar()); // Default special characters
10
+ * parseOrFail(schema, 'abc!def'); // Valid
11
+ * parseOrFail(schema, 'abcdef'); // Throws an error: 'The received value does not contain at least one special character'
12
+ *
13
+ * const customSchema = string().custom(atLeastOneSpecialChar('@$')); // Custom special characters
14
+ * parseOrFail(customSchema, 'abc@def'); // Valid
15
+ * parseOrFail(customSchema, 'abcdef'); // Throws an error: 'The received value does not contain at least one special character'
16
+ *
17
+ * @translation Error Translation Key = 's:atLeastOneSpecialChar'
18
+ */
19
+ declare const atLeastOneSpecialChar: {
20
+ (allowedSpecialChars?: string): RequiredValidation;
21
+ key: string;
22
+ message: string;
23
+ };
24
+
25
+ export { atLeastOneSpecialChar };
@@ -0,0 +1,25 @@
1
+ import { RequiredValidation } from '../../commonTypes.js';
2
+
3
+ /**
4
+ * @description Asserts that a string value contains at least one special character.
5
+ * @param {string} [allowedSpecialChars=* '@!#%&()^~{}'] The string containing allowed special characters. Defaults to '*@!#%&()^~{}'.
6
+ * @returns {RequiredValidation} A validation function that takes a received string and an exception context.
7
+ * @throws {ValidationError} if the received value does not contain at least one of the allowed special characters.
8
+ * @example
9
+ * const schema = string().custom(atLeastOneSpecialChar()); // Default special characters
10
+ * parseOrFail(schema, 'abc!def'); // Valid
11
+ * parseOrFail(schema, 'abcdef'); // Throws an error: 'The received value does not contain at least one special character'
12
+ *
13
+ * const customSchema = string().custom(atLeastOneSpecialChar('@$')); // Custom special characters
14
+ * parseOrFail(customSchema, 'abc@def'); // Valid
15
+ * parseOrFail(customSchema, 'abcdef'); // Throws an error: 'The received value does not contain at least one special character'
16
+ *
17
+ * @translation Error Translation Key = 's:atLeastOneSpecialChar'
18
+ */
19
+ declare const atLeastOneSpecialChar: {
20
+ (allowedSpecialChars?: string): RequiredValidation;
21
+ key: string;
22
+ message: string;
23
+ };
24
+
25
+ export { atLeastOneSpecialChar };
@@ -0,0 +1,26 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } }
2
+
3
+ var _chunk5BVJ6YMHjs = require('../../chunk-5BVJ6YMH.js');
4
+
5
+
6
+ var _chunkWK4O3HH4js = require('../../chunk-WK4O3HH4.js');
7
+
8
+ // src/asserts/string/atLeastOneSpecialChar.ts
9
+ var atLeastOneSpecialCharErrorMessage = "The received value does not contain at least one special character";
10
+ var atLeastOneSpecialCharErrorKey = "s:atLeastOneSpecialChar";
11
+ var atLeastOneSpecialChar = (allowedSpecialChars) => {
12
+ const specialCharRegExp = new RegExp(
13
+ `[${(_nullishCoalesce(allowedSpecialChars, () => ( "*@!#%&()^~{}"))).replace(/[-/\\^$*+?.()|[\]{}]/g, "\\$&")}]`
14
+ );
15
+ return (received, ctx) => {
16
+ if (!specialCharRegExp.test(received))
17
+ _chunkWK4O3HH4js.guardException.call(void 0, "special character", received, ctx, atLeastOneSpecialCharErrorKey);
18
+ };
19
+ };
20
+ atLeastOneSpecialChar.key = atLeastOneSpecialCharErrorKey;
21
+ atLeastOneSpecialChar.message = atLeastOneSpecialCharErrorMessage;
22
+ _chunk5BVJ6YMHjs.setToDefaultLocale.call(void 0, atLeastOneSpecialChar);
23
+
24
+
25
+ exports.atLeastOneSpecialChar = atLeastOneSpecialChar;
26
+ //# sourceMappingURL=atLeastOneSpecialChar.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["/home/runner/work/bguard/bguard/lib/asserts/string/atLeastOneSpecialChar.js","../../../src/asserts/string/atLeastOneSpecialChar.ts"],"names":[],"mappings":"AAAA;AACE;AACF,0DAAgC;AAChC;AACE;AACF,0DAAgC;AAChC;AACA;ACHA,IAAM,kCAAA,EAAoC,oEAAA;AAC1C,IAAM,8BAAA,EAAgC,yBAAA;AAkB/B,IAAM,sBAAA,EAAwB,CAAC,mBAAA,EAAA,GAAqD;AACzF,EAAA,MAAM,kBAAA,EAAoB,IAAI,MAAA;AAAA,IAC5B,CAAA,CAAA,EAAA,kBAAK,mBAAA,UAAuB,gBAAA,CAAA,CAAgB,OAAA,CAAQ,uBAAA,EAAyB,MAAM,CAAC,CAAA,CAAA;AAAA,EACtF,CAAA;AACA,EAAA,OAAO,CAAC,QAAA,EAAkB,GAAA,EAAA,GAA0B;AAClD,IAAA,GAAA,CAAI,CAAC,iBAAA,CAAkB,IAAA,CAAK,QAAQ,CAAA;AAClC,MAAA,6CAAA,mBAAe,EAAqB,QAAA,EAAU,GAAA,EAAK,6BAA6B,CAAA;AAAA,EACpF,CAAA;AACF,CAAA;AAEA,qBAAA,CAAsB,IAAA,EAAM,6BAAA;AAC5B,qBAAA,CAAsB,QAAA,EAAU,iCAAA;AAChC,iDAAA,qBAAwC,CAAA;ADbxC;AACE;AACF,sDAAC","file":"/home/runner/work/bguard/bguard/lib/asserts/string/atLeastOneSpecialChar.js","sourcesContent":[null,"import { ExceptionContext, RequiredValidation } from '../../commonTypes';\nimport { guardException } from '../../exceptions';\nimport { setToDefaultLocale } from '../../translationMap';\n\nconst atLeastOneSpecialCharErrorMessage = 'The received value does not contain at least one special character';\nconst atLeastOneSpecialCharErrorKey = 's:atLeastOneSpecialChar';\n\n/**\n * @description Asserts that a string value contains at least one special character.\n * @param {string} [allowedSpecialChars=* '@!#%&()^~{}'] The string containing allowed special characters. Defaults to '*@!#%&()^~{}'.\n * @returns {RequiredValidation} A validation function that takes a received string and an exception context.\n * @throws {ValidationError} if the received value does not contain at least one of the allowed special characters.\n * @example\n * const schema = string().custom(atLeastOneSpecialChar()); // Default special characters\n * parseOrFail(schema, 'abc!def'); // Valid\n * parseOrFail(schema, 'abcdef'); // Throws an error: 'The received value does not contain at least one special character'\n *\n * const customSchema = string().custom(atLeastOneSpecialChar('@$')); // Custom special characters\n * parseOrFail(customSchema, 'abc@def'); // Valid\n * parseOrFail(customSchema, 'abcdef'); // Throws an error: 'The received value does not contain at least one special character'\n *\n * @translation Error Translation Key = 's:atLeastOneSpecialChar'\n */\nexport const atLeastOneSpecialChar = (allowedSpecialChars?: string): RequiredValidation => {\n const specialCharRegExp = new RegExp(\n `[${(allowedSpecialChars ?? '*@!#%&()^~{}').replace(/[-/\\\\^$*+?.()|[\\]{}]/g, '\\\\$&')}]`,\n );\n return (received: string, ctx: ExceptionContext) => {\n if (!specialCharRegExp.test(received))\n guardException('special character', received, ctx, atLeastOneSpecialCharErrorKey);\n };\n};\n\natLeastOneSpecialChar.key = atLeastOneSpecialCharErrorKey;\natLeastOneSpecialChar.message = atLeastOneSpecialCharErrorMessage;\nsetToDefaultLocale(atLeastOneSpecialChar);\n"]}
@@ -0,0 +1,26 @@
1
+ import {
2
+ setToDefaultLocale
3
+ } from "../../chunk-3HTYHE2X.mjs";
4
+ import {
5
+ guardException
6
+ } from "../../chunk-7XFLH6R2.mjs";
7
+
8
+ // src/asserts/string/atLeastOneSpecialChar.ts
9
+ var atLeastOneSpecialCharErrorMessage = "The received value does not contain at least one special character";
10
+ var atLeastOneSpecialCharErrorKey = "s:atLeastOneSpecialChar";
11
+ var atLeastOneSpecialChar = (allowedSpecialChars) => {
12
+ const specialCharRegExp = new RegExp(
13
+ `[${(allowedSpecialChars ?? "*@!#%&()^~{}").replace(/[-/\\^$*+?.()|[\]{}]/g, "\\$&")}]`
14
+ );
15
+ return (received, ctx) => {
16
+ if (!specialCharRegExp.test(received))
17
+ guardException("special character", received, ctx, atLeastOneSpecialCharErrorKey);
18
+ };
19
+ };
20
+ atLeastOneSpecialChar.key = atLeastOneSpecialCharErrorKey;
21
+ atLeastOneSpecialChar.message = atLeastOneSpecialCharErrorMessage;
22
+ setToDefaultLocale(atLeastOneSpecialChar);
23
+ export {
24
+ atLeastOneSpecialChar
25
+ };
26
+ //# sourceMappingURL=atLeastOneSpecialChar.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/asserts/string/atLeastOneSpecialChar.ts"],"sourcesContent":["import { ExceptionContext, RequiredValidation } from '../../commonTypes';\nimport { guardException } from '../../exceptions';\nimport { setToDefaultLocale } from '../../translationMap';\n\nconst atLeastOneSpecialCharErrorMessage = 'The received value does not contain at least one special character';\nconst atLeastOneSpecialCharErrorKey = 's:atLeastOneSpecialChar';\n\n/**\n * @description Asserts that a string value contains at least one special character.\n * @param {string} [allowedSpecialChars=* '@!#%&()^~{}'] The string containing allowed special characters. Defaults to '*@!#%&()^~{}'.\n * @returns {RequiredValidation} A validation function that takes a received string and an exception context.\n * @throws {ValidationError} if the received value does not contain at least one of the allowed special characters.\n * @example\n * const schema = string().custom(atLeastOneSpecialChar()); // Default special characters\n * parseOrFail(schema, 'abc!def'); // Valid\n * parseOrFail(schema, 'abcdef'); // Throws an error: 'The received value does not contain at least one special character'\n *\n * const customSchema = string().custom(atLeastOneSpecialChar('@$')); // Custom special characters\n * parseOrFail(customSchema, 'abc@def'); // Valid\n * parseOrFail(customSchema, 'abcdef'); // Throws an error: 'The received value does not contain at least one special character'\n *\n * @translation Error Translation Key = 's:atLeastOneSpecialChar'\n */\nexport const atLeastOneSpecialChar = (allowedSpecialChars?: string): RequiredValidation => {\n const specialCharRegExp = new RegExp(\n `[${(allowedSpecialChars ?? '*@!#%&()^~{}').replace(/[-/\\\\^$*+?.()|[\\]{}]/g, '\\\\$&')}]`,\n );\n return (received: string, ctx: ExceptionContext) => {\n if (!specialCharRegExp.test(received))\n guardException('special character', received, ctx, atLeastOneSpecialCharErrorKey);\n };\n};\n\natLeastOneSpecialChar.key = atLeastOneSpecialCharErrorKey;\natLeastOneSpecialChar.message = atLeastOneSpecialCharErrorMessage;\nsetToDefaultLocale(atLeastOneSpecialChar);\n"],"mappings":";;;;;;;;AAIA,IAAM,oCAAoC;AAC1C,IAAM,gCAAgC;AAkB/B,IAAM,wBAAwB,CAAC,wBAAqD;AACzF,QAAM,oBAAoB,IAAI;AAAA,IAC5B,KAAK,uBAAuB,gBAAgB,QAAQ,yBAAyB,MAAM,CAAC;AAAA,EACtF;AACA,SAAO,CAAC,UAAkB,QAA0B;AAClD,QAAI,CAAC,kBAAkB,KAAK,QAAQ;AAClC,qBAAe,qBAAqB,UAAU,KAAK,6BAA6B;AAAA,EACpF;AACF;AAEA,sBAAsB,MAAM;AAC5B,sBAAsB,UAAU;AAChC,mBAAmB,qBAAqB;","names":[]}