bguard 0.4.1 → 0.5.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 (436) hide show
  1. package/README.md +19 -7
  2. package/lib/{CommonSchema-wi9MOXGF.d.mts → CommonSchema-BIfYCtcQ.d.mts} +2 -2
  3. package/lib/{CommonSchema-DOh3bsL-.d.ts → CommonSchema-DIDMH9R7.d.ts} +2 -2
  4. package/lib/ExceptionContext.d.mts +16 -0
  5. package/lib/ExceptionContext.d.ts +16 -0
  6. package/lib/ExceptionContext.js +11 -0
  7. package/lib/ExceptionContext.js.map +1 -0
  8. package/lib/ExceptionContext.mjs +11 -0
  9. package/lib/ExceptionContext.mjs.map +1 -0
  10. package/lib/asserts/array/index.d.mts +2 -1
  11. package/lib/asserts/array/index.d.ts +2 -1
  12. package/lib/asserts/array/index.js +7 -7
  13. package/lib/asserts/array/index.mjs +6 -6
  14. package/lib/asserts/array/maxArrayLength.d.mts +2 -1
  15. package/lib/asserts/array/maxArrayLength.d.ts +2 -1
  16. package/lib/asserts/array/maxArrayLength.js +4 -6
  17. package/lib/asserts/array/maxArrayLength.js.map +1 -1
  18. package/lib/asserts/array/maxArrayLength.mjs +3 -5
  19. package/lib/asserts/array/maxArrayLength.mjs.map +1 -1
  20. package/lib/asserts/array/minArrayLength.d.mts +2 -1
  21. package/lib/asserts/array/minArrayLength.d.ts +2 -1
  22. package/lib/asserts/array/minArrayLength.js +4 -6
  23. package/lib/asserts/array/minArrayLength.js.map +1 -1
  24. package/lib/asserts/array/minArrayLength.mjs +3 -5
  25. package/lib/asserts/array/minArrayLength.mjs.map +1 -1
  26. package/lib/asserts/bigint/bigintMax.d.mts +2 -1
  27. package/lib/asserts/bigint/bigintMax.d.ts +2 -1
  28. package/lib/asserts/bigint/bigintMax.js +4 -6
  29. package/lib/asserts/bigint/bigintMax.js.map +1 -1
  30. package/lib/asserts/bigint/bigintMax.mjs +3 -5
  31. package/lib/asserts/bigint/bigintMax.mjs.map +1 -1
  32. package/lib/asserts/bigint/bigintMaxExcluded.d.mts +2 -1
  33. package/lib/asserts/bigint/bigintMaxExcluded.d.ts +2 -1
  34. package/lib/asserts/bigint/bigintMaxExcluded.js +4 -6
  35. package/lib/asserts/bigint/bigintMaxExcluded.js.map +1 -1
  36. package/lib/asserts/bigint/bigintMaxExcluded.mjs +3 -5
  37. package/lib/asserts/bigint/bigintMaxExcluded.mjs.map +1 -1
  38. package/lib/asserts/bigint/bigintMin.d.mts +2 -1
  39. package/lib/asserts/bigint/bigintMin.d.ts +2 -1
  40. package/lib/asserts/bigint/bigintMin.js +4 -6
  41. package/lib/asserts/bigint/bigintMin.js.map +1 -1
  42. package/lib/asserts/bigint/bigintMin.mjs +3 -5
  43. package/lib/asserts/bigint/bigintMin.mjs.map +1 -1
  44. package/lib/asserts/bigint/bigintMinExcluded.d.mts +2 -1
  45. package/lib/asserts/bigint/bigintMinExcluded.d.ts +2 -1
  46. package/lib/asserts/bigint/bigintMinExcluded.js +4 -6
  47. package/lib/asserts/bigint/bigintMinExcluded.js.map +1 -1
  48. package/lib/asserts/bigint/bigintMinExcluded.mjs +3 -5
  49. package/lib/asserts/bigint/bigintMinExcluded.mjs.map +1 -1
  50. package/lib/asserts/bigint/index.d.mts +2 -1
  51. package/lib/asserts/bigint/index.d.ts +2 -1
  52. package/lib/asserts/bigint/index.js +10 -10
  53. package/lib/asserts/bigint/index.mjs +9 -9
  54. package/lib/asserts/boolean/index.d.mts +2 -1
  55. package/lib/asserts/boolean/index.d.ts +2 -1
  56. package/lib/asserts/boolean/index.js +8 -8
  57. package/lib/asserts/boolean/index.mjs +7 -7
  58. package/lib/asserts/date/dateMax.d.mts +2 -1
  59. package/lib/asserts/date/dateMax.d.ts +2 -1
  60. package/lib/asserts/date/dateMax.js +6 -7
  61. package/lib/asserts/date/dateMax.js.map +1 -1
  62. package/lib/asserts/date/dateMax.mjs +6 -7
  63. package/lib/asserts/date/dateMax.mjs.map +1 -1
  64. package/lib/asserts/date/dateMin.d.mts +2 -1
  65. package/lib/asserts/date/dateMin.d.ts +2 -1
  66. package/lib/asserts/date/dateMin.js +6 -7
  67. package/lib/asserts/date/dateMin.js.map +1 -1
  68. package/lib/asserts/date/dateMin.mjs +6 -7
  69. package/lib/asserts/date/dateMin.mjs.map +1 -1
  70. package/lib/asserts/date/index.d.mts +2 -1
  71. package/lib/asserts/date/index.d.ts +2 -1
  72. package/lib/asserts/date/index.js +7 -7
  73. package/lib/asserts/date/index.mjs +6 -6
  74. package/lib/asserts/mix/equalTo.d.mts +2 -1
  75. package/lib/asserts/mix/equalTo.d.ts +2 -1
  76. package/lib/asserts/mix/equalTo.js +4 -4
  77. package/lib/asserts/mix/equalTo.mjs +3 -3
  78. package/lib/asserts/mix/index.d.mts +2 -1
  79. package/lib/asserts/mix/index.d.ts +2 -1
  80. package/lib/asserts/mix/index.js +6 -6
  81. package/lib/asserts/mix/index.mjs +5 -5
  82. package/lib/asserts/mix/oneOfValues.d.mts +2 -1
  83. package/lib/asserts/mix/oneOfValues.d.ts +2 -1
  84. package/lib/asserts/mix/oneOfValues.js +4 -4
  85. package/lib/asserts/mix/oneOfValues.mjs +3 -3
  86. package/lib/asserts/number/index.d.mts +2 -1
  87. package/lib/asserts/number/index.d.ts +2 -1
  88. package/lib/asserts/number/index.js +10 -10
  89. package/lib/asserts/number/index.mjs +9 -9
  90. package/lib/asserts/number/max.d.mts +2 -1
  91. package/lib/asserts/number/max.d.ts +2 -1
  92. package/lib/asserts/number/max.js +4 -6
  93. package/lib/asserts/number/max.js.map +1 -1
  94. package/lib/asserts/number/max.mjs +3 -5
  95. package/lib/asserts/number/max.mjs.map +1 -1
  96. package/lib/asserts/number/maxExcluded.d.mts +2 -1
  97. package/lib/asserts/number/maxExcluded.d.ts +2 -1
  98. package/lib/asserts/number/maxExcluded.js +4 -6
  99. package/lib/asserts/number/maxExcluded.js.map +1 -1
  100. package/lib/asserts/number/maxExcluded.mjs +3 -5
  101. package/lib/asserts/number/maxExcluded.mjs.map +1 -1
  102. package/lib/asserts/number/min.d.mts +2 -1
  103. package/lib/asserts/number/min.d.ts +2 -1
  104. package/lib/asserts/number/min.js +4 -6
  105. package/lib/asserts/number/min.js.map +1 -1
  106. package/lib/asserts/number/min.mjs +3 -5
  107. package/lib/asserts/number/min.mjs.map +1 -1
  108. package/lib/asserts/number/minExcluded.d.mts +2 -1
  109. package/lib/asserts/number/minExcluded.d.ts +2 -1
  110. package/lib/asserts/number/minExcluded.js +4 -6
  111. package/lib/asserts/number/minExcluded.js.map +1 -1
  112. package/lib/asserts/number/minExcluded.mjs +3 -5
  113. package/lib/asserts/number/minExcluded.mjs.map +1 -1
  114. package/lib/asserts/number/negative.d.mts +2 -1
  115. package/lib/asserts/number/negative.d.ts +2 -1
  116. package/lib/asserts/number/negative.js +4 -6
  117. package/lib/asserts/number/negative.js.map +1 -1
  118. package/lib/asserts/number/negative.mjs +3 -5
  119. package/lib/asserts/number/negative.mjs.map +1 -1
  120. package/lib/asserts/number/positive.d.mts +2 -1
  121. package/lib/asserts/number/positive.d.ts +2 -1
  122. package/lib/asserts/number/positive.js +4 -6
  123. package/lib/asserts/number/positive.js.map +1 -1
  124. package/lib/asserts/number/positive.mjs +3 -5
  125. package/lib/asserts/number/positive.mjs.map +1 -1
  126. package/lib/asserts/object/index.d.mts +2 -1
  127. package/lib/asserts/object/index.d.ts +2 -1
  128. package/lib/asserts/object/index.js +7 -7
  129. package/lib/asserts/object/index.mjs +6 -6
  130. package/lib/asserts/object/maxKeys.d.mts +2 -1
  131. package/lib/asserts/object/maxKeys.d.ts +2 -1
  132. package/lib/asserts/object/maxKeys.js +4 -6
  133. package/lib/asserts/object/maxKeys.js.map +1 -1
  134. package/lib/asserts/object/maxKeys.mjs +3 -5
  135. package/lib/asserts/object/maxKeys.mjs.map +1 -1
  136. package/lib/asserts/string/atLeastOneDigit.d.mts +2 -1
  137. package/lib/asserts/string/atLeastOneDigit.d.ts +2 -1
  138. package/lib/asserts/string/atLeastOneDigit.js +4 -6
  139. package/lib/asserts/string/atLeastOneDigit.js.map +1 -1
  140. package/lib/asserts/string/atLeastOneDigit.mjs +3 -5
  141. package/lib/asserts/string/atLeastOneDigit.mjs.map +1 -1
  142. package/lib/asserts/string/atLeastOneLowerChar.d.mts +2 -1
  143. package/lib/asserts/string/atLeastOneLowerChar.d.ts +2 -1
  144. package/lib/asserts/string/atLeastOneLowerChar.js +4 -6
  145. package/lib/asserts/string/atLeastOneLowerChar.js.map +1 -1
  146. package/lib/asserts/string/atLeastOneLowerChar.mjs +3 -5
  147. package/lib/asserts/string/atLeastOneLowerChar.mjs.map +1 -1
  148. package/lib/asserts/string/atLeastOneSpecialChar.d.mts +3 -2
  149. package/lib/asserts/string/atLeastOneSpecialChar.d.ts +3 -2
  150. package/lib/asserts/string/atLeastOneSpecialChar.js +5 -8
  151. package/lib/asserts/string/atLeastOneSpecialChar.js.map +1 -1
  152. package/lib/asserts/string/atLeastOneSpecialChar.mjs +4 -7
  153. package/lib/asserts/string/atLeastOneSpecialChar.mjs.map +1 -1
  154. package/lib/asserts/string/atLeastOneUpperChar.d.mts +2 -1
  155. package/lib/asserts/string/atLeastOneUpperChar.d.ts +2 -1
  156. package/lib/asserts/string/atLeastOneUpperChar.js +4 -6
  157. package/lib/asserts/string/atLeastOneUpperChar.js.map +1 -1
  158. package/lib/asserts/string/atLeastOneUpperChar.mjs +3 -5
  159. package/lib/asserts/string/atLeastOneUpperChar.mjs.map +1 -1
  160. package/lib/asserts/string/contains.d.mts +2 -1
  161. package/lib/asserts/string/contains.d.ts +2 -1
  162. package/lib/asserts/string/contains.js +4 -6
  163. package/lib/asserts/string/contains.js.map +1 -1
  164. package/lib/asserts/string/contains.mjs +3 -5
  165. package/lib/asserts/string/contains.mjs.map +1 -1
  166. package/lib/asserts/string/email.d.mts +2 -1
  167. package/lib/asserts/string/email.d.ts +2 -1
  168. package/lib/asserts/string/email.js +4 -6
  169. package/lib/asserts/string/email.js.map +1 -1
  170. package/lib/asserts/string/email.mjs +3 -5
  171. package/lib/asserts/string/email.mjs.map +1 -1
  172. package/lib/asserts/string/endsWith.d.mts +2 -1
  173. package/lib/asserts/string/endsWith.d.ts +2 -1
  174. package/lib/asserts/string/endsWith.js +4 -6
  175. package/lib/asserts/string/endsWith.js.map +1 -1
  176. package/lib/asserts/string/endsWith.mjs +3 -5
  177. package/lib/asserts/string/endsWith.mjs.map +1 -1
  178. package/lib/asserts/string/index.d.mts +2 -1
  179. package/lib/asserts/string/index.d.ts +2 -1
  180. package/lib/asserts/string/index.js +10 -10
  181. package/lib/asserts/string/index.mjs +9 -9
  182. package/lib/asserts/string/isValidDate.d.mts +2 -1
  183. package/lib/asserts/string/isValidDate.d.ts +2 -1
  184. package/lib/asserts/string/isValidDate.js +6 -8
  185. package/lib/asserts/string/isValidDate.js.map +1 -1
  186. package/lib/asserts/string/isValidDate.mjs +5 -7
  187. package/lib/asserts/string/isValidDate.mjs.map +1 -1
  188. package/lib/asserts/string/isValidDateTime.d.mts +2 -1
  189. package/lib/asserts/string/isValidDateTime.d.ts +2 -1
  190. package/lib/asserts/string/isValidDateTime.js +4 -6
  191. package/lib/asserts/string/isValidDateTime.js.map +1 -1
  192. package/lib/asserts/string/isValidDateTime.mjs +3 -5
  193. package/lib/asserts/string/isValidDateTime.mjs.map +1 -1
  194. package/lib/asserts/string/isValidTime.d.mts +2 -1
  195. package/lib/asserts/string/isValidTime.d.ts +2 -1
  196. package/lib/asserts/string/isValidTime.js +5 -7
  197. package/lib/asserts/string/isValidTime.js.map +1 -1
  198. package/lib/asserts/string/isValidTime.mjs +4 -6
  199. package/lib/asserts/string/isValidTime.mjs.map +1 -1
  200. package/lib/asserts/string/lowerCase.d.mts +2 -1
  201. package/lib/asserts/string/lowerCase.d.ts +2 -1
  202. package/lib/asserts/string/lowerCase.js +4 -6
  203. package/lib/asserts/string/lowerCase.js.map +1 -1
  204. package/lib/asserts/string/lowerCase.mjs +3 -5
  205. package/lib/asserts/string/lowerCase.mjs.map +1 -1
  206. package/lib/asserts/string/maxLength.d.mts +2 -1
  207. package/lib/asserts/string/maxLength.d.ts +2 -1
  208. package/lib/asserts/string/maxLength.js +4 -6
  209. package/lib/asserts/string/maxLength.js.map +1 -1
  210. package/lib/asserts/string/maxLength.mjs +3 -5
  211. package/lib/asserts/string/maxLength.mjs.map +1 -1
  212. package/lib/asserts/string/minLength.d.mts +2 -1
  213. package/lib/asserts/string/minLength.d.ts +2 -1
  214. package/lib/asserts/string/minLength.js +4 -6
  215. package/lib/asserts/string/minLength.js.map +1 -1
  216. package/lib/asserts/string/minLength.mjs +3 -5
  217. package/lib/asserts/string/minLength.mjs.map +1 -1
  218. package/lib/asserts/string/regExp.d.mts +2 -1
  219. package/lib/asserts/string/regExp.d.ts +2 -1
  220. package/lib/asserts/string/regExp.js +4 -6
  221. package/lib/asserts/string/regExp.js.map +1 -1
  222. package/lib/asserts/string/regExp.mjs +3 -5
  223. package/lib/asserts/string/regExp.mjs.map +1 -1
  224. package/lib/asserts/string/startsWith.d.mts +2 -1
  225. package/lib/asserts/string/startsWith.d.ts +2 -1
  226. package/lib/asserts/string/startsWith.js +4 -6
  227. package/lib/asserts/string/startsWith.js.map +1 -1
  228. package/lib/asserts/string/startsWith.mjs +3 -5
  229. package/lib/asserts/string/startsWith.mjs.map +1 -1
  230. package/lib/asserts/string/upperCase.d.mts +2 -1
  231. package/lib/asserts/string/upperCase.d.ts +2 -1
  232. package/lib/asserts/string/upperCase.js +4 -6
  233. package/lib/asserts/string/upperCase.js.map +1 -1
  234. package/lib/asserts/string/upperCase.mjs +3 -5
  235. package/lib/asserts/string/upperCase.mjs.map +1 -1
  236. package/lib/asserts/string/uuid.d.mts +2 -1
  237. package/lib/asserts/string/uuid.d.ts +2 -1
  238. package/lib/asserts/string/uuid.js +4 -6
  239. package/lib/asserts/string/uuid.js.map +1 -1
  240. package/lib/asserts/string/uuid.mjs +3 -5
  241. package/lib/asserts/string/uuid.mjs.map +1 -1
  242. package/lib/asserts/string/uuidV1.d.mts +2 -1
  243. package/lib/asserts/string/uuidV1.d.ts +2 -1
  244. package/lib/asserts/string/uuidV1.js +4 -6
  245. package/lib/asserts/string/uuidV1.js.map +1 -1
  246. package/lib/asserts/string/uuidV1.mjs +3 -5
  247. package/lib/asserts/string/uuidV1.mjs.map +1 -1
  248. package/lib/asserts/string/uuidV2.d.mts +2 -1
  249. package/lib/asserts/string/uuidV2.d.ts +2 -1
  250. package/lib/asserts/string/uuidV2.js +4 -6
  251. package/lib/asserts/string/uuidV2.js.map +1 -1
  252. package/lib/asserts/string/uuidV2.mjs +3 -5
  253. package/lib/asserts/string/uuidV2.mjs.map +1 -1
  254. package/lib/asserts/string/uuidV3.d.mts +2 -1
  255. package/lib/asserts/string/uuidV3.d.ts +2 -1
  256. package/lib/asserts/string/uuidV3.js +4 -6
  257. package/lib/asserts/string/uuidV3.js.map +1 -1
  258. package/lib/asserts/string/uuidV3.mjs +3 -5
  259. package/lib/asserts/string/uuidV3.mjs.map +1 -1
  260. package/lib/asserts/string/uuidV4.d.mts +2 -1
  261. package/lib/asserts/string/uuidV4.d.ts +2 -1
  262. package/lib/asserts/string/uuidV4.js +4 -6
  263. package/lib/asserts/string/uuidV4.js.map +1 -1
  264. package/lib/asserts/string/uuidV4.mjs +3 -5
  265. package/lib/asserts/string/uuidV4.mjs.map +1 -1
  266. package/lib/asserts/string/uuidV5.d.mts +2 -1
  267. package/lib/asserts/string/uuidV5.d.ts +2 -1
  268. package/lib/asserts/string/uuidV5.js +4 -6
  269. package/lib/asserts/string/uuidV5.js.map +1 -1
  270. package/lib/asserts/string/uuidV5.mjs +3 -5
  271. package/lib/asserts/string/uuidV5.mjs.map +1 -1
  272. package/lib/asserts/string/validUrl.d.mts +2 -1
  273. package/lib/asserts/string/validUrl.d.ts +2 -1
  274. package/lib/asserts/string/validUrl.js +4 -11
  275. package/lib/asserts/string/validUrl.js.map +1 -1
  276. package/lib/asserts/string/validUrl.mjs +3 -10
  277. package/lib/asserts/string/validUrl.mjs.map +1 -1
  278. package/lib/{chunk-IZ3CBVEE.js → chunk-32MKEBKR.js} +4 -7
  279. package/lib/chunk-32MKEBKR.js.map +1 -0
  280. package/lib/chunk-3ZQ4ORQH.js +14 -0
  281. package/lib/{chunk-QIDWASOC.js.map → chunk-3ZQ4ORQH.js.map} +1 -1
  282. package/lib/{chunk-U4USIJV3.js → chunk-BURPSYZ3.js} +11 -11
  283. package/lib/{chunk-U4USIJV3.js.map → chunk-BURPSYZ3.js.map} +1 -1
  284. package/lib/{chunk-YUMUCQKL.mjs → chunk-CCNK27CX.mjs} +4 -4
  285. package/lib/{chunk-C3EDEQ3W.mjs → chunk-EMOOEIPZ.mjs} +3 -6
  286. package/lib/chunk-EMOOEIPZ.mjs.map +1 -0
  287. package/lib/{chunk-5YYRBKDP.js → chunk-EXVTHIT5.js} +4 -4
  288. package/lib/chunk-EXVTHIT5.js.map +1 -0
  289. package/lib/chunk-FIDPCCCW.js +24 -0
  290. package/lib/chunk-FIDPCCCW.js.map +1 -0
  291. package/lib/{chunk-ECBOZ3BM.js → chunk-FNBYM254.js} +7 -10
  292. package/lib/chunk-FNBYM254.js.map +1 -0
  293. package/lib/chunk-IFQLPXCZ.mjs +111 -0
  294. package/lib/chunk-IFQLPXCZ.mjs.map +1 -0
  295. package/lib/{chunk-SHJVKSEZ.js → chunk-MMWS3SXR.js} +17 -17
  296. package/lib/chunk-MMWS3SXR.js.map +1 -0
  297. package/lib/{chunk-BNCT7NOR.mjs → chunk-MQRXWXHP.mjs} +16 -24
  298. package/lib/chunk-MQRXWXHP.mjs.map +1 -0
  299. package/lib/{chunk-FP5QAEVQ.mjs → chunk-MRRMV2GM.mjs} +6 -6
  300. package/lib/chunk-P4Q22AZA.js +28 -0
  301. package/lib/{chunk-VW4RMQD4.js.map → chunk-P4Q22AZA.js.map} +1 -1
  302. package/lib/{chunk-K7X6DVM2.mjs → chunk-P54CF5QN.mjs} +3 -6
  303. package/lib/chunk-P54CF5QN.mjs.map +1 -0
  304. package/lib/{chunk-X762EUSZ.js → chunk-PE55R4KH.js} +16 -24
  305. package/lib/chunk-PE55R4KH.js.map +1 -0
  306. package/lib/{chunk-2KQASECD.js → chunk-PGEXAFA5.js} +5 -5
  307. package/lib/{chunk-2KQASECD.js.map → chunk-PGEXAFA5.js.map} +1 -1
  308. package/lib/chunk-PQ4GCO3Q.js +111 -0
  309. package/lib/chunk-PQ4GCO3Q.js.map +1 -0
  310. package/lib/{chunk-H32B3NHW.mjs → chunk-QWPHP26D.mjs} +2 -2
  311. package/lib/chunk-QWPHP26D.mjs.map +1 -0
  312. package/lib/{chunk-Z6QU36MM.js → chunk-RAJF6LMF.js} +12 -12
  313. package/lib/{chunk-Z6QU36MM.js.map → chunk-RAJF6LMF.js.map} +1 -1
  314. package/lib/{chunk-UUY7DPHK.js → chunk-RG5NYH2I.js} +12 -12
  315. package/lib/{chunk-UUY7DPHK.js.map → chunk-RG5NYH2I.js.map} +1 -1
  316. package/lib/{chunk-WK4FJ5GD.mjs → chunk-U3DJ354I.mjs} +6 -6
  317. package/lib/{chunk-7NBOVYSP.mjs → chunk-UEYMBPZN.mjs} +4 -4
  318. package/lib/chunk-UEYMBPZN.mjs.map +1 -0
  319. package/lib/{chunk-HP3DRZWK.js → chunk-UTPG4GZB.js} +4 -7
  320. package/lib/chunk-UTPG4GZB.js.map +1 -0
  321. package/lib/{chunk-MHBY5OIQ.mjs → chunk-VIFJBTQO.mjs} +3 -3
  322. package/lib/{chunk-CHUPE6SJ.mjs → chunk-W2SQHSOS.mjs} +6 -6
  323. package/lib/{chunk-LPR3G5T3.mjs → chunk-XG6K6N3A.mjs} +4 -4
  324. package/lib/{chunk-6D5W7SSQ.mjs → chunk-XT5E3MPI.mjs} +4 -7
  325. package/lib/chunk-XT5E3MPI.mjs.map +1 -0
  326. package/lib/{chunk-H6LHV3EA.mjs → chunk-YSCVE4PJ.mjs} +2 -2
  327. package/lib/{chunk-MLNQZ445.js → chunk-ZG373PNB.js} +13 -13
  328. package/lib/{chunk-MLNQZ445.js.map → chunk-ZG373PNB.js.map} +1 -1
  329. package/lib/chunk-ZTCXXAKD.mjs +24 -0
  330. package/lib/chunk-ZTCXXAKD.mjs.map +1 -0
  331. package/lib/codeGen.d.mts +3 -2
  332. package/lib/codeGen.d.ts +3 -2
  333. package/lib/codeGen.js +2 -3
  334. package/lib/codeGen.js.map +1 -1
  335. package/lib/codeGen.mjs +1 -2
  336. package/lib/codeGen.mjs.map +1 -1
  337. package/lib/commonTypes.d.mts +1 -12
  338. package/lib/commonTypes.d.ts +1 -12
  339. package/lib/exceptions.d.mts +2 -3
  340. package/lib/exceptions.d.ts +2 -3
  341. package/lib/exceptions.js +2 -4
  342. package/lib/exceptions.js.map +1 -1
  343. package/lib/exceptions.mjs +3 -5
  344. package/lib/helpers/core.d.mts +3 -2
  345. package/lib/helpers/core.d.ts +3 -2
  346. package/lib/helpers/core.js +2 -3
  347. package/lib/helpers/core.js.map +1 -1
  348. package/lib/helpers/core.mjs +1 -2
  349. package/lib/helpers/setStrictType.d.mts +3 -2
  350. package/lib/helpers/setStrictType.d.ts +3 -2
  351. package/lib/helpers/setStrictType.js +3 -4
  352. package/lib/helpers/setStrictType.js.map +1 -1
  353. package/lib/helpers/setStrictType.mjs +2 -3
  354. package/lib/index.d.mts +3 -2
  355. package/lib/index.d.ts +3 -2
  356. package/lib/index.js +6 -10
  357. package/lib/index.js.map +1 -1
  358. package/lib/index.mjs +7 -11
  359. package/lib/parse.d.mts +2 -1
  360. package/lib/parse.d.ts +2 -1
  361. package/lib/parse.js +5 -5
  362. package/lib/parse.mjs +4 -4
  363. package/lib/parseOrFail.d.mts +2 -1
  364. package/lib/parseOrFail.d.ts +2 -1
  365. package/lib/parseOrFail.js +5 -5
  366. package/lib/parseOrFail.mjs +4 -4
  367. package/lib/schemas/ArraySchema.d.mts +3 -2
  368. package/lib/schemas/ArraySchema.d.ts +3 -2
  369. package/lib/schemas/ArraySchema.js +7 -7
  370. package/lib/schemas/ArraySchema.mjs +6 -6
  371. package/lib/schemas/BigIntSchema.d.mts +2 -1
  372. package/lib/schemas/BigIntSchema.d.ts +2 -1
  373. package/lib/schemas/BigIntSchema.js +10 -10
  374. package/lib/schemas/BigIntSchema.mjs +9 -9
  375. package/lib/schemas/BooleanSchema.d.mts +2 -1
  376. package/lib/schemas/BooleanSchema.d.ts +2 -1
  377. package/lib/schemas/BooleanSchema.js +8 -8
  378. package/lib/schemas/BooleanSchema.mjs +7 -7
  379. package/lib/schemas/CommonSchema.d.mts +2 -1
  380. package/lib/schemas/CommonSchema.d.ts +2 -1
  381. package/lib/schemas/CommonSchema.js +6 -6
  382. package/lib/schemas/CommonSchema.mjs +5 -5
  383. package/lib/schemas/DateSchema.d.mts +3 -2
  384. package/lib/schemas/DateSchema.d.ts +3 -2
  385. package/lib/schemas/DateSchema.js +7 -7
  386. package/lib/schemas/DateSchema.mjs +6 -6
  387. package/lib/schemas/NumberSchema.d.mts +2 -1
  388. package/lib/schemas/NumberSchema.d.ts +2 -1
  389. package/lib/schemas/NumberSchema.js +10 -10
  390. package/lib/schemas/NumberSchema.mjs +9 -9
  391. package/lib/schemas/ObjectSchema.d.mts +3 -2
  392. package/lib/schemas/ObjectSchema.d.ts +3 -2
  393. package/lib/schemas/ObjectSchema.js +7 -7
  394. package/lib/schemas/ObjectSchema.mjs +6 -6
  395. package/lib/schemas/StringSchema.d.mts +2 -1
  396. package/lib/schemas/StringSchema.d.ts +2 -1
  397. package/lib/schemas/StringSchema.js +10 -10
  398. package/lib/schemas/StringSchema.mjs +9 -9
  399. package/lib/translationMap.d.mts +2 -1
  400. package/lib/translationMap.d.ts +2 -1
  401. package/lib/translationMap.js +3 -3
  402. package/lib/translationMap.mjs +2 -2
  403. package/package.json +9 -9
  404. package/lib/chunk-5P6AZJCN.js +0 -45
  405. package/lib/chunk-5P6AZJCN.js.map +0 -1
  406. package/lib/chunk-5WHCMWXK.js +0 -50
  407. package/lib/chunk-5WHCMWXK.js.map +0 -1
  408. package/lib/chunk-5YYRBKDP.js.map +0 -1
  409. package/lib/chunk-6D5W7SSQ.mjs.map +0 -1
  410. package/lib/chunk-7NBOVYSP.mjs.map +0 -1
  411. package/lib/chunk-BNCT7NOR.mjs.map +0 -1
  412. package/lib/chunk-C3EDEQ3W.mjs.map +0 -1
  413. package/lib/chunk-ECBOZ3BM.js.map +0 -1
  414. package/lib/chunk-FGZKNBDP.mjs +0 -45
  415. package/lib/chunk-FGZKNBDP.mjs.map +0 -1
  416. package/lib/chunk-G55SHHAR.js +0 -29
  417. package/lib/chunk-G55SHHAR.js.map +0 -1
  418. package/lib/chunk-H32B3NHW.mjs.map +0 -1
  419. package/lib/chunk-HP3DRZWK.js.map +0 -1
  420. package/lib/chunk-IZ3CBVEE.js.map +0 -1
  421. package/lib/chunk-K7X6DVM2.mjs.map +0 -1
  422. package/lib/chunk-QIDWASOC.js +0 -14
  423. package/lib/chunk-SHJVKSEZ.js.map +0 -1
  424. package/lib/chunk-TRGMD7LA.mjs +0 -29
  425. package/lib/chunk-TRGMD7LA.mjs.map +0 -1
  426. package/lib/chunk-TV5IZY4L.mjs +0 -50
  427. package/lib/chunk-TV5IZY4L.mjs.map +0 -1
  428. package/lib/chunk-VW4RMQD4.js +0 -28
  429. package/lib/chunk-X762EUSZ.js.map +0 -1
  430. /package/lib/{chunk-YUMUCQKL.mjs.map → chunk-CCNK27CX.mjs.map} +0 -0
  431. /package/lib/{chunk-FP5QAEVQ.mjs.map → chunk-MRRMV2GM.mjs.map} +0 -0
  432. /package/lib/{chunk-WK4FJ5GD.mjs.map → chunk-U3DJ354I.mjs.map} +0 -0
  433. /package/lib/{chunk-MHBY5OIQ.mjs.map → chunk-VIFJBTQO.mjs.map} +0 -0
  434. /package/lib/{chunk-CHUPE6SJ.mjs.map → chunk-W2SQHSOS.mjs.map} +0 -0
  435. /package/lib/{chunk-LPR3G5T3.mjs.map → chunk-XG6K6N3A.mjs.map} +0 -0
  436. /package/lib/{chunk-H6LHV3EA.mjs.map → chunk-YSCVE4PJ.mjs.map} +0 -0
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/translationMap.ts"],"sourcesContent":["import { BuildSchemaError } from './exceptions';\nimport { TranslationErrorMap } from './commonTypes';\nimport type { RequiredValidation } from './ExceptionContext';\n\n// c: stands for common\nconst defaultErrorMap: TranslationErrorMap = {\n //@@start\n 'c:optional': 'The required value is missing',\n 'c:nullable': 'Value should not be null',\n 'c:array': 'Expected an array but received a different type',\n 'c:objectType': 'Expected an object but received a different type',\n 'c:objectTypeAsArray': 'Expected an object but received an array. Invalid type of data',\n 'c:unrecognizedProperty': 'This property is not allowed in the object',\n 'c:requiredProperty': 'Missing required property in the object',\n 'c:invalidType': 'Invalid type of data',\n 'c:isBoolean': 'The received value is not {{e}}',\n 'c:date': 'The received value is not a valid instance of Date',\n //@@end\n};\n\nlet data: Record<string, Record<string, string>> = {\n default: { ...defaultErrorMap },\n};\n\nexport function setToDefaultLocale({\n key,\n message,\n}: {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n (expected: any): RequiredValidation;\n key: string;\n message: string;\n}) {\n const defaultLocale = data.default!;\n if (defaultLocale[key]) throw new BuildSchemaError('Duplicate default message key');\n defaultLocale[key] = message;\n}\n\nexport function setLocale(lng: string, custom: Partial<TranslationErrorMap>) {\n if (lng === 'default') throw new BuildSchemaError('Invalid language');\n if (!data[lng]) data[lng] = { ...defaultErrorMap };\n const locale = data[lng]!;\n Object.entries(custom).forEach(([messageKey, messageValue]) => {\n locale[messageKey] = messageValue!;\n });\n}\n\nexport function clearLocales() {\n data = {\n default: { ...defaultErrorMap },\n };\n}\n\nexport function getTranslationByLocale(lng?: string): TranslationErrorMap {\n if (!lng) return data['default'] as TranslationErrorMap;\n return (data[lng] ?? data['default']) as TranslationErrorMap;\n}\n"],"mappings":";;;;;AAKA,IAAM,kBAAuC;AAAA;AAAA,EAE3C,cAAc;AAAA,EACd,cAAc;AAAA,EACd,WAAW;AAAA,EACX,gBAAgB;AAAA,EAChB,uBAAuB;AAAA,EACvB,0BAA0B;AAAA,EAC1B,sBAAsB;AAAA,EACtB,iBAAiB;AAAA,EACjB,eAAe;AAAA,EACf,UAAU;AAAA;AAEZ;AAEA,IAAI,OAA+C;AAAA,EACjD,SAAS,EAAE,GAAG,gBAAgB;AAChC;AAEO,SAAS,mBAAmB;AAAA,EACjC;AAAA,EACA;AACF,GAKG;AACD,QAAM,gBAAgB,KAAK;AAC3B,MAAI,cAAc,GAAG,EAAG,OAAM,IAAI,iBAAiB,+BAA+B;AAClF,gBAAc,GAAG,IAAI;AACvB;AAEO,SAAS,UAAU,KAAa,QAAsC;AAC3E,MAAI,QAAQ,UAAW,OAAM,IAAI,iBAAiB,kBAAkB;AACpE,MAAI,CAAC,KAAK,GAAG,EAAG,MAAK,GAAG,IAAI,EAAE,GAAG,gBAAgB;AACjD,QAAM,SAAS,KAAK,GAAG;AACvB,SAAO,QAAQ,MAAM,EAAE,QAAQ,CAAC,CAAC,YAAY,YAAY,MAAM;AAC7D,WAAO,UAAU,IAAI;AAAA,EACvB,CAAC;AACH;AAEO,SAAS,eAAe;AAC7B,SAAO;AAAA,IACL,SAAS,EAAE,GAAG,gBAAgB;AAAA,EAChC;AACF;AAEO,SAAS,uBAAuB,KAAmC;AACxE,MAAI,CAAC,IAAK,QAAO,KAAK,SAAS;AAC/B,SAAQ,KAAK,GAAG,KAAK,KAAK,SAAS;AACrC;","names":[]}
@@ -1,24 +1,24 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true}); var _class;
2
2
 
3
- var _chunkHP3DRZWKjs = require('./chunk-HP3DRZWK.js');
3
+ var _chunkUTPG4GZBjs = require('./chunk-UTPG4GZB.js');
4
4
 
5
5
 
6
- var _chunkIZ3CBVEEjs = require('./chunk-IZ3CBVEE.js');
6
+ var _chunk32MKEBKRjs = require('./chunk-32MKEBKR.js');
7
7
 
8
8
 
9
9
  var _chunk42J6CHIOjs = require('./chunk-42J6CHIO.js');
10
10
 
11
11
 
12
- var _chunkQIDWASOCjs = require('./chunk-QIDWASOC.js');
12
+ var _chunk3ZQ4ORQHjs = require('./chunk-3ZQ4ORQH.js');
13
13
 
14
14
 
15
- var _chunkSHJVKSEZjs = require('./chunk-SHJVKSEZ.js');
15
+ var _chunkMMWS3SXRjs = require('./chunk-MMWS3SXR.js');
16
16
 
17
17
 
18
- var _chunk5P6AZJCNjs = require('./chunk-5P6AZJCN.js');
18
+ var _chunkFIDPCCCWjs = require('./chunk-FIDPCCCW.js');
19
19
 
20
20
  // src/schemas/StringSchema.ts
21
- var StringSchema = (_class = class extends _chunkSHJVKSEZjs.CommonSchema {constructor(...args) { super(...args); _class.prototype.__init.call(this); }
21
+ var StringSchema = (_class = class extends _chunkMMWS3SXRjs.CommonSchema {constructor(...args) { super(...args); _class.prototype.__init.call(this); }
22
22
  __init() {this._string = 1}
23
23
 
24
24
  /**
@@ -31,8 +31,8 @@ var StringSchema = (_class = class extends _chunkSHJVKSEZjs.CommonSchema {constr
31
31
  */
32
32
  equalTo(expectedValue) {
33
33
  this.limitCheck();
34
- _chunkQIDWASOCjs._setStrictType.call(void 0, this, `'${expectedValue}'`);
35
- return this.custom(_chunkHP3DRZWKjs.equalTo.call(void 0, expectedValue));
34
+ _chunk3ZQ4ORQHjs._setStrictType.call(void 0, this, `'${expectedValue}'`);
35
+ return this.custom(_chunkUTPG4GZBjs.equalTo.call(void 0, expectedValue));
36
36
  }
37
37
  /**
38
38
  * Restricts the schema to match one of the specified values and infers the union of those values as the TypeScript type.
@@ -45,14 +45,14 @@ var StringSchema = (_class = class extends _chunkSHJVKSEZjs.CommonSchema {constr
45
45
  */
46
46
  oneOfValues(expectedValue) {
47
47
  this.limitCheck();
48
- _chunkQIDWASOCjs._setStrictType.call(void 0,
48
+ _chunk3ZQ4ORQHjs._setStrictType.call(void 0,
49
49
  this,
50
50
  expectedValue.map((el) => `'${el}'`)
51
51
  );
52
- return this.custom(_chunkIZ3CBVEEjs.oneOfValues.call(void 0, expectedValue));
52
+ return this.custom(_chunk32MKEBKRjs.oneOfValues.call(void 0, expectedValue));
53
53
  }
54
54
  limitCheck() {
55
- if (this.limit) throw new (0, _chunk5P6AZJCNjs.BuildSchemaError)(_chunk42J6CHIOjs.ONLY_ONCE);
55
+ if (this.limit) throw new (0, _chunkFIDPCCCWjs.BuildSchemaError)(_chunk42J6CHIOjs.ONLY_ONCE);
56
56
  this.limit = true;
57
57
  }
58
58
  }, _class);
@@ -60,4 +60,4 @@ var StringSchema = (_class = class extends _chunkSHJVKSEZjs.CommonSchema {constr
60
60
 
61
61
 
62
62
  exports.StringSchema = StringSchema;
63
- //# sourceMappingURL=chunk-Z6QU36MM.js.map
63
+ //# sourceMappingURL=chunk-RAJF6LMF.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["/home/runner/work/bguard/bguard/lib/chunk-Z6QU36MM.js","../src/schemas/StringSchema.ts"],"names":[],"mappings":"AAAA;AACE;AACF,sDAA4B;AAC5B;AACE;AACF,sDAA4B;AAC5B;AACE;AACF,sDAA4B;AAC5B;AACE;AACF,sDAA4B;AAC5B;AACE;AACF,sDAA4B;AAC5B;AACE;AACF,sDAA4B;AAC5B;AACA;ACXO,IAAM,aAAA,YAAN,MAAA,QAA2B,8BAAa;AAAA,iBACnC,QAAA,EAAU,EAAA;AAAA,EACZ;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAUD,OAAA,CAA0B,aAAA,EAA2C;AAC1E,IAAA,IAAA,CAAK,UAAA,CAAW,CAAA;AAChB,IAAA,6CAAA,IAAe,EAAM,CAAA,CAAA,EAAI,aAAa,CAAA,CAAA,CAAG,CAAA;AAEzC,IAAA,OAAO,IAAA,CAAK,MAAA,CAAO,sCAAA,aAAqB,CAAC,CAAA;AAAA,EAC3C;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAWO,WAAA,CAA8B,aAAA,EAA6C;AAChF,IAAA,IAAA,CAAK,UAAA,CAAW,CAAA;AAChB,IAAA,6CAAA;AAAA,MACE,IAAA;AAAA,MACA,aAAA,CAAc,GAAA,CAAI,CAAC,EAAA,EAAA,GAAO,CAAA,CAAA,EAAI,EAAE,CAAA,CAAA,CAAG;AAAA,IACrC,CAAA;AACA,IAAA,OAAO,IAAA,CAAK,MAAA,CAAO,0CAAA,aAAyB,CAAC,CAAA;AAAA,EAC/C;AAAA,EAEQ,UAAA,CAAA,EAAa;AACnB,IAAA,GAAA,CAAI,IAAA,CAAK,KAAA,EAAO,MAAM,IAAI,sCAAA,CAAiB,0BAAS,CAAA;AACpD,IAAA,IAAA,CAAK,MAAA,EAAQ,IAAA;AAAA,EACf;AACF,UAAA;ADSA;AACA;AACE;AACF,oCAAC","file":"/home/runner/work/bguard/bguard/lib/chunk-Z6QU36MM.js","sourcesContent":[null,"import { equalTo } from '../asserts/mix/equalTo';\nimport { oneOfValues } from '../asserts/mix/oneOfValues';\nimport { WithBGuardType } from '../commonTypes';\nimport { BuildSchemaError } from '../exceptions';\nimport { ONLY_ONCE } from '../helpers/constants';\nimport { _setStrictType } from '../helpers/setStrictType';\nimport { CommonSchema } from './CommonSchema';\n\nexport class StringSchema extends CommonSchema {\n protected _string = 1;\n private limit: boolean | undefined;\n\n /**\n * Restricts the schema to exactly match the specified value and infers the literal value as the TypeScript type.\n *\n * @param expectedValue - The value that the schema must exactly match.\n * @returns - The schema instance restricted to the specified value, with the literal value inferred as the TypeScript type\n *\n * @example - string().equalTo('hello'); // Infers the type 'hello'\n */\n public equalTo<Y extends string>(expectedValue: Y): WithBGuardType<this, Y> {\n this.limitCheck();\n _setStrictType(this, `'${expectedValue}'`);\n\n return this.custom(equalTo(expectedValue)) as WithBGuardType<this, Y>;\n }\n\n /**\n * Restricts the schema to match one of the specified values and infers the union of those values as the TypeScript type.\n *\n * @param expectedValues - An array of values that the schema can match.\n * @returns - The schema instance restricted to one of the specified values, with the union of those values inferred as the TypeScript type.\n *\n * @example\n * string().oneOfValues(['foo', 'bar']); // Infers the type 'foo' | 'bar'\n */\n public oneOfValues<Y extends string>(expectedValue: Y[]): WithBGuardType<this, Y> {\n this.limitCheck();\n _setStrictType(\n this,\n expectedValue.map((el) => `'${el}'`),\n );\n return this.custom(oneOfValues(expectedValue)) as WithBGuardType<this, Y>;\n }\n\n private limitCheck() {\n if (this.limit) throw new BuildSchemaError(ONLY_ONCE);\n this.limit = true;\n }\n}\n"]}
1
+ {"version":3,"sources":["/home/runner/work/bguard/bguard/lib/chunk-RAJF6LMF.js","../src/schemas/StringSchema.ts"],"names":[],"mappings":"AAAA;AACE;AACF,sDAA4B;AAC5B;AACE;AACF,sDAA4B;AAC5B;AACE;AACF,sDAA4B;AAC5B;AACE;AACF,sDAA4B;AAC5B;AACE;AACF,sDAA4B;AAC5B;AACE;AACF,sDAA4B;AAC5B;AACA;ACXO,IAAM,aAAA,YAAN,MAAA,QAA2B,8BAAa;AAAA,iBACnC,QAAA,EAAU,EAAA;AAAA,EACZ;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAUD,OAAA,CAA0B,aAAA,EAA2C;AAC1E,IAAA,IAAA,CAAK,UAAA,CAAW,CAAA;AAChB,IAAA,6CAAA,IAAe,EAAM,CAAA,CAAA,EAAI,aAAa,CAAA,CAAA,CAAG,CAAA;AAEzC,IAAA,OAAO,IAAA,CAAK,MAAA,CAAO,sCAAA,aAAqB,CAAC,CAAA;AAAA,EAC3C;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAWO,WAAA,CAA8B,aAAA,EAA6C;AAChF,IAAA,IAAA,CAAK,UAAA,CAAW,CAAA;AAChB,IAAA,6CAAA;AAAA,MACE,IAAA;AAAA,MACA,aAAA,CAAc,GAAA,CAAI,CAAC,EAAA,EAAA,GAAO,CAAA,CAAA,EAAI,EAAE,CAAA,CAAA,CAAG;AAAA,IACrC,CAAA;AACA,IAAA,OAAO,IAAA,CAAK,MAAA,CAAO,0CAAA,aAAyB,CAAC,CAAA;AAAA,EAC/C;AAAA,EAEQ,UAAA,CAAA,EAAa;AACnB,IAAA,GAAA,CAAI,IAAA,CAAK,KAAA,EAAO,MAAM,IAAI,sCAAA,CAAiB,0BAAS,CAAA;AACpD,IAAA,IAAA,CAAK,MAAA,EAAQ,IAAA;AAAA,EACf;AACF,UAAA;ADSA;AACA;AACE;AACF,oCAAC","file":"/home/runner/work/bguard/bguard/lib/chunk-RAJF6LMF.js","sourcesContent":[null,"import { equalTo } from '../asserts/mix/equalTo';\nimport { oneOfValues } from '../asserts/mix/oneOfValues';\nimport { WithBGuardType } from '../commonTypes';\nimport { BuildSchemaError } from '../exceptions';\nimport { ONLY_ONCE } from '../helpers/constants';\nimport { _setStrictType } from '../helpers/setStrictType';\nimport { CommonSchema } from './CommonSchema';\n\nexport class StringSchema extends CommonSchema {\n protected _string = 1;\n private limit: boolean | undefined;\n\n /**\n * Restricts the schema to exactly match the specified value and infers the literal value as the TypeScript type.\n *\n * @param expectedValue - The value that the schema must exactly match.\n * @returns - The schema instance restricted to the specified value, with the literal value inferred as the TypeScript type\n *\n * @example - string().equalTo('hello'); // Infers the type 'hello'\n */\n public equalTo<Y extends string>(expectedValue: Y): WithBGuardType<this, Y> {\n this.limitCheck();\n _setStrictType(this, `'${expectedValue}'`);\n\n return this.custom(equalTo(expectedValue)) as WithBGuardType<this, Y>;\n }\n\n /**\n * Restricts the schema to match one of the specified values and infers the union of those values as the TypeScript type.\n *\n * @param expectedValues - An array of values that the schema can match.\n * @returns - The schema instance restricted to one of the specified values, with the union of those values inferred as the TypeScript type.\n *\n * @example\n * string().oneOfValues(['foo', 'bar']); // Infers the type 'foo' | 'bar'\n */\n public oneOfValues<Y extends string>(expectedValue: Y[]): WithBGuardType<this, Y> {\n this.limitCheck();\n _setStrictType(\n this,\n expectedValue.map((el) => `'${el}'`),\n );\n return this.custom(oneOfValues(expectedValue)) as WithBGuardType<this, Y>;\n }\n\n private limitCheck() {\n if (this.limit) throw new BuildSchemaError(ONLY_ONCE);\n this.limit = true;\n }\n}\n"]}
@@ -1,24 +1,24 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true}); var _class;
2
2
 
3
- var _chunkHP3DRZWKjs = require('./chunk-HP3DRZWK.js');
3
+ var _chunkUTPG4GZBjs = require('./chunk-UTPG4GZB.js');
4
4
 
5
5
 
6
- var _chunkIZ3CBVEEjs = require('./chunk-IZ3CBVEE.js');
6
+ var _chunk32MKEBKRjs = require('./chunk-32MKEBKR.js');
7
7
 
8
8
 
9
9
  var _chunk42J6CHIOjs = require('./chunk-42J6CHIO.js');
10
10
 
11
11
 
12
- var _chunkQIDWASOCjs = require('./chunk-QIDWASOC.js');
12
+ var _chunk3ZQ4ORQHjs = require('./chunk-3ZQ4ORQH.js');
13
13
 
14
14
 
15
- var _chunkSHJVKSEZjs = require('./chunk-SHJVKSEZ.js');
15
+ var _chunkMMWS3SXRjs = require('./chunk-MMWS3SXR.js');
16
16
 
17
17
 
18
- var _chunk5P6AZJCNjs = require('./chunk-5P6AZJCN.js');
18
+ var _chunkFIDPCCCWjs = require('./chunk-FIDPCCCW.js');
19
19
 
20
20
  // src/schemas/BigIntSchema.ts
21
- var BigIntSchema = (_class = class extends _chunkSHJVKSEZjs.CommonSchema {constructor(...args) { super(...args); _class.prototype.__init.call(this); }
21
+ var BigIntSchema = (_class = class extends _chunkMMWS3SXRjs.CommonSchema {constructor(...args) { super(...args); _class.prototype.__init.call(this); }
22
22
  __init() {this._bigint = 1}
23
23
 
24
24
  /**
@@ -32,8 +32,8 @@ var BigIntSchema = (_class = class extends _chunkSHJVKSEZjs.CommonSchema {constr
32
32
  equalTo(expectedValue) {
33
33
  this.defaultValueCheck();
34
34
  this.limitCheck();
35
- _chunkQIDWASOCjs._setStrictType.call(void 0, this, `${expectedValue}n`);
36
- return this.custom(_chunkHP3DRZWKjs.equalTo.call(void 0, expectedValue));
35
+ _chunk3ZQ4ORQHjs._setStrictType.call(void 0, this, `${expectedValue}n`);
36
+ return this.custom(_chunkUTPG4GZBjs.equalTo.call(void 0, expectedValue));
37
37
  }
38
38
  /**
39
39
  * Restricts the schema to match one of the specified values and infers the union of those values as the TypeScript type.
@@ -47,14 +47,14 @@ var BigIntSchema = (_class = class extends _chunkSHJVKSEZjs.CommonSchema {constr
47
47
  oneOfValues(expectedValue) {
48
48
  this.defaultValueCheck();
49
49
  this.limitCheck();
50
- _chunkQIDWASOCjs._setStrictType.call(void 0,
50
+ _chunk3ZQ4ORQHjs._setStrictType.call(void 0,
51
51
  this,
52
52
  expectedValue.map((el) => `${el}n`)
53
53
  );
54
- return this.custom(_chunkIZ3CBVEEjs.oneOfValues.call(void 0, expectedValue));
54
+ return this.custom(_chunk32MKEBKRjs.oneOfValues.call(void 0, expectedValue));
55
55
  }
56
56
  limitCheck() {
57
- if (this.limit) throw new (0, _chunk5P6AZJCNjs.BuildSchemaError)(_chunk42J6CHIOjs.ONLY_ONCE);
57
+ if (this.limit) throw new (0, _chunkFIDPCCCWjs.BuildSchemaError)(_chunk42J6CHIOjs.ONLY_ONCE);
58
58
  this.limit = true;
59
59
  }
60
60
  }, _class);
@@ -62,4 +62,4 @@ var BigIntSchema = (_class = class extends _chunkSHJVKSEZjs.CommonSchema {constr
62
62
 
63
63
 
64
64
  exports.BigIntSchema = BigIntSchema;
65
- //# sourceMappingURL=chunk-UUY7DPHK.js.map
65
+ //# sourceMappingURL=chunk-RG5NYH2I.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["/home/runner/work/bguard/bguard/lib/chunk-UUY7DPHK.js","../src/schemas/BigIntSchema.ts"],"names":[],"mappings":"AAAA;AACE;AACF,sDAA4B;AAC5B;AACE;AACF,sDAA4B;AAC5B;AACE;AACF,sDAA4B;AAC5B;AACE;AACF,sDAA4B;AAC5B;AACE;AACF,sDAA4B;AAC5B;AACE;AACF,sDAA4B;AAC5B;AACA;ACXO,IAAM,aAAA,YAAN,MAAA,QAA2B,8BAAa;AAAA,iBACnC,QAAA,EAAU,EAAA;AAAA,EACZ;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAUD,OAAA,CAA0B,aAAA,EAA2C;AAC1E,IAAA,IAAA,CAAK,iBAAA,CAAkB,CAAA;AACvB,IAAA,IAAA,CAAK,UAAA,CAAW,CAAA;AAChB,IAAA,6CAAA,IAAe,EAAM,CAAA,EAAA;AACF,IAAA;AACrB,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAWqC,EAAA;AAC9B,IAAA;AACW,IAAA;AAChB,IAAA;AACE,MAAA;AACmB,MAAA;AACrB,IAAA;AACmB,IAAA;AACrB,EAAA;AAEqB,EAAA;AACG,IAAA;AACT,IAAA;AACf,EAAA;AACF;ADU0B;AACA;AACA;AACA","file":"/home/runner/work/bguard/bguard/lib/chunk-UUY7DPHK.js","sourcesContent":[null,"import { equalTo } from '../asserts/mix/equalTo';\nimport { oneOfValues } from '../asserts/mix/oneOfValues';\nimport { WithBGuardType } from '../commonTypes';\nimport { BuildSchemaError } from '../exceptions';\nimport { ONLY_ONCE } from '../helpers/constants';\nimport { _setStrictType } from '../helpers/setStrictType';\nimport { CommonSchema } from './CommonSchema';\n\nexport class BigIntSchema extends CommonSchema {\n protected _bigint = 1;\n private limit: boolean | undefined;\n\n /**\n * Restricts the schema to exactly match the specified value and infers the literal value as the TypeScript type.\n *\n * @param expectedValue - The value that the schema must exactly match.\n * @returns - The schema instance restricted to the specified value, with the literal value inferred as the TypeScript type\n *\n * @example - bigint().equalTo(42n); // Infers the type 42n\n */\n public equalTo<Y extends bigint>(expectedValue: Y): WithBGuardType<this, Y> {\n this.defaultValueCheck();\n this.limitCheck();\n _setStrictType(this, `${expectedValue}n`);\n return this.custom(equalTo(expectedValue)) as WithBGuardType<this, Y>;\n }\n\n /**\n * Restricts the schema to match one of the specified values and infers the union of those values as the TypeScript type.\n *\n * @param expectedValues - An array of values that the schema can match.\n * @returns - The schema instance restricted to one of the specified values, with the union of those values inferred as the TypeScript type.\n *\n * @example\n * bigint().oneOfValues([5n, 7n]); // Infers the type 5n | 7n\n */\n public oneOfValues<Y extends bigint>(expectedValue: Y[]): WithBGuardType<this, Y> {\n this.defaultValueCheck();\n this.limitCheck();\n _setStrictType(\n this,\n expectedValue.map((el) => `${el}n`),\n );\n return this.custom(oneOfValues(expectedValue)) as WithBGuardType<this, Y>;\n }\n\n private limitCheck() {\n if (this.limit) throw new BuildSchemaError(ONLY_ONCE);\n this.limit = true;\n }\n}\n"]}
1
+ {"version":3,"sources":["/home/runner/work/bguard/bguard/lib/chunk-RG5NYH2I.js","../src/schemas/BigIntSchema.ts"],"names":[],"mappings":"AAAA;AACE;AACF,sDAA4B;AAC5B;AACE;AACF,sDAA4B;AAC5B;AACE;AACF,sDAA4B;AAC5B;AACE;AACF,sDAA4B;AAC5B;AACE;AACF,sDAA4B;AAC5B;AACE;AACF,sDAA4B;AAC5B;AACA;ACXO,IAAM,aAAA,YAAN,MAAA,QAA2B,8BAAa;AAAA,iBACnC,QAAA,EAAU,EAAA;AAAA,EACZ;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAUD,OAAA,CAA0B,aAAA,EAA2C;AAC1E,IAAA,IAAA,CAAK,iBAAA,CAAkB,CAAA;AACvB,IAAA,IAAA,CAAK,UAAA,CAAW,CAAA;AAChB,IAAA,6CAAA,IAAe,EAAM,CAAA,EAAA;AACF,IAAA;AACrB,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAWqC,EAAA;AAC9B,IAAA;AACW,IAAA;AAChB,IAAA;AACE,MAAA;AACmB,MAAA;AACrB,IAAA;AACmB,IAAA;AACrB,EAAA;AAEqB,EAAA;AACG,IAAA;AACT,IAAA;AACf,EAAA;AACF;ADU0B;AACA;AACA;AACA","file":"/home/runner/work/bguard/bguard/lib/chunk-RG5NYH2I.js","sourcesContent":[null,"import { equalTo } from '../asserts/mix/equalTo';\nimport { oneOfValues } from '../asserts/mix/oneOfValues';\nimport { WithBGuardType } from '../commonTypes';\nimport { BuildSchemaError } from '../exceptions';\nimport { ONLY_ONCE } from '../helpers/constants';\nimport { _setStrictType } from '../helpers/setStrictType';\nimport { CommonSchema } from './CommonSchema';\n\nexport class BigIntSchema extends CommonSchema {\n protected _bigint = 1;\n private limit: boolean | undefined;\n\n /**\n * Restricts the schema to exactly match the specified value and infers the literal value as the TypeScript type.\n *\n * @param expectedValue - The value that the schema must exactly match.\n * @returns - The schema instance restricted to the specified value, with the literal value inferred as the TypeScript type\n *\n * @example - bigint().equalTo(42n); // Infers the type 42n\n */\n public equalTo<Y extends bigint>(expectedValue: Y): WithBGuardType<this, Y> {\n this.defaultValueCheck();\n this.limitCheck();\n _setStrictType(this, `${expectedValue}n`);\n return this.custom(equalTo(expectedValue)) as WithBGuardType<this, Y>;\n }\n\n /**\n * Restricts the schema to match one of the specified values and infers the union of those values as the TypeScript type.\n *\n * @param expectedValues - An array of values that the schema can match.\n * @returns - The schema instance restricted to one of the specified values, with the union of those values inferred as the TypeScript type.\n *\n * @example\n * bigint().oneOfValues([5n, 7n]); // Infers the type 5n | 7n\n */\n public oneOfValues<Y extends bigint>(expectedValue: Y[]): WithBGuardType<this, Y> {\n this.defaultValueCheck();\n this.limitCheck();\n _setStrictType(\n this,\n expectedValue.map((el) => `${el}n`),\n );\n return this.custom(oneOfValues(expectedValue)) as WithBGuardType<this, Y>;\n }\n\n private limitCheck() {\n if (this.limit) throw new BuildSchemaError(ONLY_ONCE);\n this.limit = true;\n }\n}\n"]}
@@ -1,21 +1,21 @@
1
1
  import {
2
2
  equalTo
3
- } from "./chunk-C3EDEQ3W.mjs";
3
+ } from "./chunk-EMOOEIPZ.mjs";
4
4
  import {
5
5
  oneOfValues
6
- } from "./chunk-K7X6DVM2.mjs";
6
+ } from "./chunk-P54CF5QN.mjs";
7
7
  import {
8
8
  ONLY_ONCE
9
9
  } from "./chunk-ASZW6XRM.mjs";
10
10
  import {
11
11
  _setStrictType
12
- } from "./chunk-H6LHV3EA.mjs";
12
+ } from "./chunk-YSCVE4PJ.mjs";
13
13
  import {
14
14
  CommonSchema
15
- } from "./chunk-7NBOVYSP.mjs";
15
+ } from "./chunk-UEYMBPZN.mjs";
16
16
  import {
17
17
  BuildSchemaError
18
- } from "./chunk-FGZKNBDP.mjs";
18
+ } from "./chunk-ZTCXXAKD.mjs";
19
19
 
20
20
  // src/schemas/BigIntSchema.ts
21
21
  var BigIntSchema = class extends CommonSchema {
@@ -62,4 +62,4 @@ var BigIntSchema = class extends CommonSchema {
62
62
  export {
63
63
  BigIntSchema
64
64
  };
65
- //# sourceMappingURL=chunk-WK4FJ5GD.mjs.map
65
+ //# sourceMappingURL=chunk-U3DJ354I.mjs.map
@@ -1,12 +1,12 @@
1
1
  import {
2
2
  parseOrFail
3
- } from "./chunk-TRGMD7LA.mjs";
3
+ } from "./chunk-IFQLPXCZ.mjs";
4
4
  import {
5
5
  ctxSymbol
6
- } from "./chunk-BNCT7NOR.mjs";
6
+ } from "./chunk-MQRXWXHP.mjs";
7
7
  import {
8
8
  BuildSchemaError
9
- } from "./chunk-FGZKNBDP.mjs";
9
+ } from "./chunk-ZTCXXAKD.mjs";
10
10
 
11
11
  // src/schemas/CommonSchema.ts
12
12
  var CommonSchema = class {
@@ -133,4 +133,4 @@ var CommonSchema = class {
133
133
  export {
134
134
  CommonSchema
135
135
  };
136
- //# sourceMappingURL=chunk-7NBOVYSP.mjs.map
136
+ //# sourceMappingURL=chunk-UEYMBPZN.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/schemas/CommonSchema.ts"],"sourcesContent":["import type { RequiredValidation } from '../ExceptionContext';\nimport { InferType } from '../InferType';\nimport { MetaContext, BaseType, WithNull, WithUndefined, TransformCallback } from '../commonTypes';\nimport { BuildSchemaError } from '../exceptions';\nimport { ctxSymbol } from '../helpers/core';\nimport { parseOrFail } from '../parseOrFail';\n\nexport type ObjectShapeSchemaType = Record<string, CommonSchema>;\n\nexport interface ValidatorContext {\n type: BaseType[];\n isNullable?: boolean;\n isOptional?: boolean;\n requiredValidations: RequiredValidation[];\n array?: CommonSchema;\n object?: ObjectShapeSchemaType;\n allowUnrecognizedObjectProps?: boolean;\n strictType?: boolean;\n strictTypeValue?: unknown;\n date?: boolean;\n defaultValue?: unknown;\n meta?: MetaContext;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n transformListBefore?: TransformCallback<any, any>[];\n}\n\nexport class CommonSchema {\n [ctxSymbol]: ValidatorContext;\n constructor(ctx: ValidatorContext) {\n this[ctxSymbol] = ctx;\n }\n\n /**\n * @param validators - One or more custom validation functions.\n * @returns {this} The schema instance with the added custom validation.\n */\n public custom(...validators: RequiredValidation[]): this {\n this.defaultValueCheck();\n this[ctxSymbol].requiredValidations.push(...validators);\n return this;\n }\n\n /**\n * Marks the schema as nullable, allowing the value to be `null`.\n *\n * @returns {WithNull<this>} The schema instance marked as nullable.\n */\n public nullable(): WithNull<this> {\n this.defaultValueCheck();\n this[ctxSymbol].isNullable = true;\n return this as WithNull<this>;\n }\n\n /**\n * Marks the schema as optional, allowing the value to be `undefined`.\n *\n * @returns {WithUndefined<this>} The schema instance marked as optional.\n */\n public optional(): WithUndefined<this> {\n this.defaultValueCheck();\n this[ctxSymbol].isOptional = true;\n return this as WithUndefined<this>;\n }\n\n /**\n * Marks the schema as optional, allowing the value to be `undefined`.\n *\n * @returns {this} The schema instance. This method should be used as a last one because it does the check of previous methods and\n */\n public default(defaultValue: InferType<this>): this {\n const ctx = this[ctxSymbol];\n if (ctx.isOptional) {\n throw new BuildSchemaError(`Cannot call method 'default' after method 'optional'`);\n }\n\n try {\n parseOrFail(this, defaultValue);\n } catch (e) {\n throw new BuildSchemaError((e as Error).message);\n }\n\n this[ctxSymbol].defaultValue = defaultValue;\n return this;\n }\n\n /**\n * Applies a transformation to the input value before any validation occurs.\n * The transformation should return a value of the same type as the inferred type of the schema,\n * ensuring that the overall type is not altered.\n *\n * @template In - The type of the input value before transformation (defaults to `unknown`).\n * @param {TransformCallback<In, InferType<this>>} cb - The callback function that performs the transformation.\n * @returns {this} The updated schema with the applied transformation.\n *\n * @example\n * const schema = string()\n * .nullable()\n * .transformBeforeValidation((val) => val + '') // Ensure the value is a string\n * .transformBeforeValidation((val: string) => (val === '' ? null : val)); // Convert empty strings to null\n *\n * // Parse 'test' will pass as 'test' is a valid string longer than 3 characters.\n * parseOrFail(schema, 'test');\n *\n * // Parsing '' will be transformed to null and will pass due to .nullable().\n * parseOrFail(schema, '');\n */\n public transformBeforeValidation<In>(cb: TransformCallback<In, InferType<this>>): this {\n const ctx = this[ctxSymbol];\n if (ctx.transformListBefore) {\n ctx.transformListBefore.push(cb);\n } else {\n ctx.transformListBefore = [cb];\n }\n\n return this;\n }\n\n /**\n * Assigns a unique identifier to the schema.\n * This ID can be used to track or map validation errors back to specific fields\n * in a form or other structures.\n *\n * @param {string} value - The unique identifier for the schema.\n * @returns {this} The updated schema with the assigned ID.\n *\n * @example\n * const schema = string().id('username');\n */\n public id(value: string): this {\n return this.meta('id', value);\n }\n\n /**\n * Provides a description for the schema, offering additional context or information.\n * The description can be used when displaying validation errors or for documentation purposes.\n *\n * @param {string} value - The description for the schema.\n * @returns {this} The updated schema with the added description.\n *\n * @example\n * const schema = string().description('The username of the account holder.');\n */\n public description(value: string): this {\n return this.meta('description', value);\n }\n\n private meta(key: string, value: string): this {\n const ctx = this[ctxSymbol];\n ctx.meta = { ...ctx.meta, [key]: value };\n return this;\n }\n\n protected defaultValueCheck() {\n if (this[ctxSymbol].defaultValue !== undefined) {\n throw new BuildSchemaError('Default value must be the last method called in schema');\n }\n }\n}\n\ntype TypeMapping = {\n number: number;\n string: string;\n boolean: boolean;\n undefined: undefined;\n object: object;\n // eslint-disable-next-line @typescript-eslint/no-unsafe-function-type\n function: Function;\n symbol: symbol;\n bigint: bigint;\n};\n\nexport type MapMixTypes<T extends BaseType[]> = T extends (infer U)[]\n ? U extends keyof TypeMapping\n ? TypeMapping[U]\n : never\n : never;\n"],"mappings":";;;;;;;;;;;AA0BO,IAAM,eAAN,MAAmB;AAAA,EACxB,CAAC,SAAS;AAAA,EACV,YAAY,KAAuB;AACjC,SAAK,SAAS,IAAI;AAAA,EACpB;AAAA;AAAA;AAAA;AAAA;AAAA,EAMO,UAAU,YAAwC;AACvD,SAAK,kBAAkB;AACvB,SAAK,SAAS,EAAE,oBAAoB,KAAK,GAAG,UAAU;AACtD,WAAO;AAAA,EACT;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOO,WAA2B;AAChC,SAAK,kBAAkB;AACvB,SAAK,SAAS,EAAE,aAAa;AAC7B,WAAO;AAAA,EACT;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOO,WAAgC;AACrC,SAAK,kBAAkB;AACvB,SAAK,SAAS,EAAE,aAAa;AAC7B,WAAO;AAAA,EACT;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOO,QAAQ,cAAqC;AAClD,UAAM,MAAM,KAAK,SAAS;AAC1B,QAAI,IAAI,YAAY;AAClB,YAAM,IAAI,iBAAiB,sDAAsD;AAAA,IACnF;AAEA,QAAI;AACF,kBAAY,MAAM,YAAY;AAAA,IAChC,SAAS,GAAG;AACV,YAAM,IAAI,iBAAkB,EAAY,OAAO;AAAA,IACjD;AAEA,SAAK,SAAS,EAAE,eAAe;AAC/B,WAAO;AAAA,EACT;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAuBO,0BAA8B,IAAkD;AACrF,UAAM,MAAM,KAAK,SAAS;AAC1B,QAAI,IAAI,qBAAqB;AAC3B,UAAI,oBAAoB,KAAK,EAAE;AAAA,IACjC,OAAO;AACL,UAAI,sBAAsB,CAAC,EAAE;AAAA,IAC/B;AAEA,WAAO;AAAA,EACT;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAaO,GAAG,OAAqB;AAC7B,WAAO,KAAK,KAAK,MAAM,KAAK;AAAA,EAC9B;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAYO,YAAY,OAAqB;AACtC,WAAO,KAAK,KAAK,eAAe,KAAK;AAAA,EACvC;AAAA,EAEQ,KAAK,KAAa,OAAqB;AAC7C,UAAM,MAAM,KAAK,SAAS;AAC1B,QAAI,OAAO,EAAE,GAAG,IAAI,MAAM,CAAC,GAAG,GAAG,MAAM;AACvC,WAAO;AAAA,EACT;AAAA,EAEU,oBAAoB;AAC5B,QAAI,KAAK,SAAS,EAAE,iBAAiB,QAAW;AAC9C,YAAM,IAAI,iBAAiB,wDAAwD;AAAA,IACrF;AAAA,EACF;AACF;","names":[]}
@@ -1,21 +1,18 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
- var _chunk5YYRBKDPjs = require('./chunk-5YYRBKDP.js');
4
-
5
-
6
- var _chunk5P6AZJCNjs = require('./chunk-5P6AZJCN.js');
3
+ var _chunkEXVTHIT5js = require('./chunk-EXVTHIT5.js');
7
4
 
8
5
  // src/asserts/mix/equalTo.ts
9
6
  var equalToErrorMessage = "The received value is not equal to expected";
10
7
  var equalToErrorKey = "m:equalTo";
11
8
  var equalTo = (expected) => (received, ctx) => {
12
- if (expected !== received) _chunk5P6AZJCNjs.guardException.call(void 0, expected, received, ctx, equalToErrorKey);
9
+ if (expected !== received) ctx.addIssue(expected, received, equalToErrorKey);
13
10
  };
14
11
  equalTo.key = equalToErrorKey;
15
12
  equalTo.message = equalToErrorMessage;
16
- _chunk5YYRBKDPjs.setToDefaultLocale.call(void 0, equalTo);
13
+ _chunkEXVTHIT5js.setToDefaultLocale.call(void 0, equalTo);
17
14
 
18
15
 
19
16
 
20
17
  exports.equalTo = equalTo;
21
- //# sourceMappingURL=chunk-HP3DRZWK.js.map
18
+ //# sourceMappingURL=chunk-UTPG4GZB.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["/home/runner/work/bguard/bguard/lib/chunk-UTPG4GZB.js","../src/asserts/mix/equalTo.ts"],"names":[],"mappings":"AAAA;AACE;AACF,sDAA4B;AAC5B;AACA;ACDA,IAAM,oBAAA,EAAsB,6CAAA;AAC5B,IAAM,gBAAA,EAAkB,WAAA;AAejB,IAAM,QAAA,EACX,CAAC,QAAA,EAAA,GACD,CAAC,QAAA,EAAmB,GAAA,EAAA,GAA0B;AAC5C,EAAA,GAAA,CAAI,SAAA,IAAa,QAAA,EAAU,GAAA,CAAI,QAAA,CAAS,QAAA,EAAU,QAAA,EAAU,eAAe,CAAA;AAC7E,CAAA;AAEF,OAAA,CAAQ,IAAA,EAAM,eAAA;AACd,OAAA,CAAQ,QAAA,EAAU,mBAAA;AAClB,iDAAA,OAA0B,CAAA;ADd1B;AACA;AACE;AACF,0BAAC","file":"/home/runner/work/bguard/bguard/lib/chunk-UTPG4GZB.js","sourcesContent":[null,"import { ExceptionContext, RequiredValidation } from '../../ExceptionContext';\nimport { setToDefaultLocale } from '../../translationMap';\n\nconst equalToErrorMessage = 'The received value is not equal to expected';\nconst equalToErrorKey = 'm:equalTo';\n\n/**\n * @description Creates a custom assertion that checks if a value is equal to the expected value.\n * @notice It has already been implemented in the number, bigint and string schema. There is no need to use it as a custom assert.\n * @param {unknown} expected The value that the received value is expected to match.\n * @returns {RequiredValidation} A validation function that takes a received value and an exception context.\n * @throws {ValidationError} If the received value does not match the expected value.\n * @example\n * const schema = number().custom(equalTo(5)); // Define a schema with a custom assertion\n * parseOrFail(schema, 5); // Valid\n * parseOrFail(schema, 3); // Throws an error: 'The received value is not equal to expected'\n *\n * @translation Error Translation Key = 'm:equalTo'\n */\nexport const equalTo =\n (expected: unknown): RequiredValidation =>\n (received: unknown, ctx: ExceptionContext) => {\n if (expected !== received) ctx.addIssue(expected, received, equalToErrorKey);\n };\n\nequalTo.key = equalToErrorKey;\nequalTo.message = equalToErrorMessage;\nsetToDefaultLocale(equalTo);\n"]}
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  CommonSchema
3
- } from "./chunk-7NBOVYSP.mjs";
3
+ } from "./chunk-UEYMBPZN.mjs";
4
4
  import {
5
5
  ctxSymbol
6
- } from "./chunk-BNCT7NOR.mjs";
6
+ } from "./chunk-MQRXWXHP.mjs";
7
7
 
8
8
  // src/schemas/DateSchema.ts
9
9
  var DateSchema = class extends CommonSchema {
@@ -17,4 +17,4 @@ var DateSchema = class extends CommonSchema {
17
17
  export {
18
18
  DateSchema
19
19
  };
20
- //# sourceMappingURL=chunk-MHBY5OIQ.mjs.map
20
+ //# sourceMappingURL=chunk-VIFJBTQO.mjs.map
@@ -1,21 +1,21 @@
1
1
  import {
2
2
  equalTo
3
- } from "./chunk-C3EDEQ3W.mjs";
3
+ } from "./chunk-EMOOEIPZ.mjs";
4
4
  import {
5
5
  oneOfValues
6
- } from "./chunk-K7X6DVM2.mjs";
6
+ } from "./chunk-P54CF5QN.mjs";
7
7
  import {
8
8
  ONLY_ONCE
9
9
  } from "./chunk-ASZW6XRM.mjs";
10
10
  import {
11
11
  _setStrictType
12
- } from "./chunk-H6LHV3EA.mjs";
12
+ } from "./chunk-YSCVE4PJ.mjs";
13
13
  import {
14
14
  CommonSchema
15
- } from "./chunk-7NBOVYSP.mjs";
15
+ } from "./chunk-UEYMBPZN.mjs";
16
16
  import {
17
17
  BuildSchemaError
18
- } from "./chunk-FGZKNBDP.mjs";
18
+ } from "./chunk-ZTCXXAKD.mjs";
19
19
 
20
20
  // src/schemas/NumberSchema.ts
21
21
  var NumberSchema = class extends CommonSchema {
@@ -55,4 +55,4 @@ var NumberSchema = class extends CommonSchema {
55
55
  export {
56
56
  NumberSchema
57
57
  };
58
- //# sourceMappingURL=chunk-CHUPE6SJ.mjs.map
58
+ //# sourceMappingURL=chunk-W2SQHSOS.mjs.map
@@ -1,12 +1,12 @@
1
1
  import {
2
2
  CommonSchema
3
- } from "./chunk-7NBOVYSP.mjs";
3
+ } from "./chunk-UEYMBPZN.mjs";
4
4
  import {
5
5
  ctxSymbol
6
- } from "./chunk-BNCT7NOR.mjs";
6
+ } from "./chunk-MQRXWXHP.mjs";
7
7
  import {
8
8
  BuildSchemaError
9
- } from "./chunk-FGZKNBDP.mjs";
9
+ } from "./chunk-ZTCXXAKD.mjs";
10
10
 
11
11
  // src/schemas/ArraySchema.ts
12
12
  var ArraySchema = class extends CommonSchema {
@@ -25,4 +25,4 @@ var ArraySchema = class extends CommonSchema {
25
25
  export {
26
26
  ArraySchema
27
27
  };
28
- //# sourceMappingURL=chunk-LPR3G5T3.mjs.map
28
+ //# sourceMappingURL=chunk-XG6K6N3A.mjs.map
@@ -1,16 +1,13 @@
1
1
  import {
2
2
  _setStrictType
3
- } from "./chunk-H6LHV3EA.mjs";
3
+ } from "./chunk-YSCVE4PJ.mjs";
4
4
  import {
5
5
  CommonSchema
6
- } from "./chunk-7NBOVYSP.mjs";
7
- import {
8
- guardException
9
- } from "./chunk-FGZKNBDP.mjs";
6
+ } from "./chunk-UEYMBPZN.mjs";
10
7
 
11
8
  // src/schemas/BooleanSchema.ts
12
9
  var isBoolean = (expected) => (received, ctx) => {
13
- if (received !== expected) guardException(expected, received, ctx, "c:isBoolean");
10
+ if (received !== expected) ctx.addIssue(expected, received, "c:isBoolean");
14
11
  };
15
12
  var BooleanSchema = class extends CommonSchema {
16
13
  _boolean = 1;
@@ -41,4 +38,4 @@ var BooleanSchema = class extends CommonSchema {
41
38
  export {
42
39
  BooleanSchema
43
40
  };
44
- //# sourceMappingURL=chunk-6D5W7SSQ.mjs.map
41
+ //# sourceMappingURL=chunk-XT5E3MPI.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/schemas/BooleanSchema.ts"],"sourcesContent":["import { CommonSchema } from './CommonSchema';\nimport { WithBGuardType } from '../commonTypes';\nimport { _setStrictType } from '../helpers/setStrictType';\nimport { ExceptionContext } from '../ExceptionContext';\n\nconst isBoolean = (expected: boolean) => (received: boolean, ctx: ExceptionContext) => {\n if (received !== expected) ctx.addIssue(expected, received, 'c:isBoolean');\n};\n\nexport class BooleanSchema extends CommonSchema {\n protected _boolean = 1;\n\n /**\n * Restricts the schema to exactly match the boolean value true and infers the true value as the TypeScript type.\n *\n * @returns - The schema instance restricted to the value true, with the true value inferred as the TypeScript type\n *\n * @example - boolean().onlyTrue(); // Infers the type true\n */\n public onlyTrue(): WithBGuardType<this, true> {\n _setStrictType(this, true);\n return this.custom(isBoolean(true)) as WithBGuardType<this, true>;\n }\n\n /**\n * Restricts the schema to exactly match the boolean value false and infers the false value as the TypeScript type.\n *\n * @returns - The schema instance restricted to the value false, with the false value inferred as the TypeScript type\n *\n * @example - boolean().onlyFalse(); // Infers the type false\n */\n public onlyFalse(): WithBGuardType<this, false> {\n _setStrictType(this, false);\n return this.custom(isBoolean(false)) as WithBGuardType<this, false>;\n }\n}\n"],"mappings":";;;;;;;;AAKA,IAAM,YAAY,CAAC,aAAsB,CAAC,UAAmB,QAA0B;AACrF,MAAI,aAAa,SAAU,KAAI,SAAS,UAAU,UAAU,aAAa;AAC3E;AAEO,IAAM,gBAAN,cAA4B,aAAa;AAAA,EACpC,WAAW;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASd,WAAuC;AAC5C,mBAAe,MAAM,IAAI;AACzB,WAAO,KAAK,OAAO,UAAU,IAAI,CAAC;AAAA,EACpC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASO,YAAyC;AAC9C,mBAAe,MAAM,KAAK;AAC1B,WAAO,KAAK,OAAO,UAAU,KAAK,CAAC;AAAA,EACrC;AACF;","names":[]}
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  ctxSymbol
3
- } from "./chunk-BNCT7NOR.mjs";
3
+ } from "./chunk-MQRXWXHP.mjs";
4
4
 
5
5
  // src/helpers/setStrictType.ts
6
6
  function _setStrictType(that, val) {
@@ -11,4 +11,4 @@ function _setStrictType(that, val) {
11
11
  export {
12
12
  _setStrictType
13
13
  };
14
- //# sourceMappingURL=chunk-H6LHV3EA.mjs.map
14
+ //# sourceMappingURL=chunk-YSCVE4PJ.mjs.map
@@ -1,24 +1,24 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true}); var _class;
2
2
 
3
- var _chunkHP3DRZWKjs = require('./chunk-HP3DRZWK.js');
3
+ var _chunkUTPG4GZBjs = require('./chunk-UTPG4GZB.js');
4
4
 
5
5
 
6
- var _chunkIZ3CBVEEjs = require('./chunk-IZ3CBVEE.js');
6
+ var _chunk32MKEBKRjs = require('./chunk-32MKEBKR.js');
7
7
 
8
8
 
9
9
  var _chunk42J6CHIOjs = require('./chunk-42J6CHIO.js');
10
10
 
11
11
 
12
- var _chunkQIDWASOCjs = require('./chunk-QIDWASOC.js');
12
+ var _chunk3ZQ4ORQHjs = require('./chunk-3ZQ4ORQH.js');
13
13
 
14
14
 
15
- var _chunkSHJVKSEZjs = require('./chunk-SHJVKSEZ.js');
15
+ var _chunkMMWS3SXRjs = require('./chunk-MMWS3SXR.js');
16
16
 
17
17
 
18
- var _chunk5P6AZJCNjs = require('./chunk-5P6AZJCN.js');
18
+ var _chunkFIDPCCCWjs = require('./chunk-FIDPCCCW.js');
19
19
 
20
20
  // src/schemas/NumberSchema.ts
21
- var NumberSchema = (_class = class extends _chunkSHJVKSEZjs.CommonSchema {constructor(...args) { super(...args); _class.prototype.__init.call(this); }
21
+ var NumberSchema = (_class = class extends _chunkMMWS3SXRjs.CommonSchema {constructor(...args) { super(...args); _class.prototype.__init.call(this); }
22
22
  __init() {this._number = 1}
23
23
 
24
24
  /**
@@ -30,10 +30,10 @@ var NumberSchema = (_class = class extends _chunkSHJVKSEZjs.CommonSchema {constr
30
30
  * @example - number().equalTo(42); // Infers the type 42
31
31
  */
32
32
  equalTo(expectedValue) {
33
- if (this.limit) throw new (0, _chunk5P6AZJCNjs.BuildSchemaError)(_chunk42J6CHIOjs.ONLY_ONCE);
33
+ if (this.limit) throw new (0, _chunkFIDPCCCWjs.BuildSchemaError)(_chunk42J6CHIOjs.ONLY_ONCE);
34
34
  this.limit = true;
35
- _chunkQIDWASOCjs._setStrictType.call(void 0, this, expectedValue);
36
- return this.custom(_chunkHP3DRZWKjs.equalTo.call(void 0, expectedValue));
35
+ _chunk3ZQ4ORQHjs._setStrictType.call(void 0, this, expectedValue);
36
+ return this.custom(_chunkUTPG4GZBjs.equalTo.call(void 0, expectedValue));
37
37
  }
38
38
  /**
39
39
  * Restricts the schema to match one of the specified values and infers the union of those values as the TypeScript type.
@@ -45,14 +45,14 @@ var NumberSchema = (_class = class extends _chunkSHJVKSEZjs.CommonSchema {constr
45
45
  * number().oneOfValues([5, 7]); // Infers the type 5 | 7
46
46
  */
47
47
  oneOfValues(expectedValue) {
48
- if (this.limit) throw new (0, _chunk5P6AZJCNjs.BuildSchemaError)(_chunk42J6CHIOjs.ONLY_ONCE);
48
+ if (this.limit) throw new (0, _chunkFIDPCCCWjs.BuildSchemaError)(_chunk42J6CHIOjs.ONLY_ONCE);
49
49
  this.limit = true;
50
- _chunkQIDWASOCjs._setStrictType.call(void 0, this, expectedValue);
51
- return this.custom(_chunkIZ3CBVEEjs.oneOfValues.call(void 0, expectedValue));
50
+ _chunk3ZQ4ORQHjs._setStrictType.call(void 0, this, expectedValue);
51
+ return this.custom(_chunk32MKEBKRjs.oneOfValues.call(void 0, expectedValue));
52
52
  }
53
53
  }, _class);
54
54
 
55
55
 
56
56
 
57
57
  exports.NumberSchema = NumberSchema;
58
- //# sourceMappingURL=chunk-MLNQZ445.js.map
58
+ //# sourceMappingURL=chunk-ZG373PNB.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["/home/runner/work/bguard/bguard/lib/chunk-MLNQZ445.js","../src/schemas/NumberSchema.ts"],"names":[],"mappings":"AAAA;AACE;AACF,sDAA4B;AAC5B;AACE;AACF,sDAA4B;AAC5B;AACE;AACF,sDAA4B;AAC5B;AACE;AACF,sDAA4B;AAC5B;AACE;AACF,sDAA4B;AAC5B;AACE;AACF,sDAA4B;AAC5B;AACA;ACXO,IAAM,aAAA,YAAN,MAAA,QAA2B,8BAAa;AAAA,iBACnC,QAAA,EAAU,EAAA;AAAA,EACZ;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAUD,OAAA,CAA0B,aAAA,EAA2C;AAC1E,IAAA,GAAA,CAAI,IAAA,CAAK,KAAA,EAAO,MAAM,IAAI,sCAAA,CAAiB,0BAAS,CAAA;AACpD,IAAA,IAAA,CAAK,MAAA,EAAQ,IAAA;AACb,IAAA,6CAAA,IAAe,EAAM,aAAa,CAAA;AAClC,IAAA,OAAO,IAAA,CAAK,MAAA,CAAO,sCAAA,aAAqB,CAAC,CAAA;AAAA,EAC3C;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAWO,WAAA,CAA8B,aAAA,EAA6C;AAChF,IAAA,GAAA,CAAI,IAAA,CAAK,KAAA,EAAO,MAAM,IAAI,sCAAA,CAAiB,0BAAS,CAAA;AACpD,IAAA,IAAA,CAAK,MAAA,EAAQ,IAAA;AACb,IAAA,6CAAA,IAAe,EAAM,aAAa,CAAA;AAClC,IAAA,OAAO,IAAA,CAAK,MAAA,CAAO,0CAAA,aAAyB,CAAC,CAAA;AAAA,EAC/C;AACF,UAAA;ADWA;AACA;AACE;AACF,oCAAC","file":"/home/runner/work/bguard/bguard/lib/chunk-MLNQZ445.js","sourcesContent":[null,"import { equalTo } from '../asserts/mix/equalTo';\nimport { oneOfValues } from '../asserts/mix/oneOfValues';\nimport { WithBGuardType } from '../commonTypes';\nimport { BuildSchemaError } from '../exceptions';\nimport { ONLY_ONCE } from '../helpers/constants';\nimport { _setStrictType } from '../helpers/setStrictType';\nimport { CommonSchema } from './CommonSchema';\n\nexport class NumberSchema extends CommonSchema {\n protected _number = 1;\n private limit: boolean | undefined;\n\n /**\n * Restricts the schema to exactly match the specified value and infers the literal value as the TypeScript type.\n *\n * @param expectedValue - The value that the schema must exactly match.\n * @returns - The schema instance restricted to the specified value, with the literal value inferred as the TypeScript type\n *\n * @example - number().equalTo(42); // Infers the type 42\n */\n public equalTo<Y extends number>(expectedValue: Y): WithBGuardType<this, Y> {\n if (this.limit) throw new BuildSchemaError(ONLY_ONCE);\n this.limit = true;\n _setStrictType(this, expectedValue);\n return this.custom(equalTo(expectedValue)) as WithBGuardType<this, Y>;\n }\n\n /**\n * Restricts the schema to match one of the specified values and infers the union of those values as the TypeScript type.\n *\n * @param expectedValues - An array of values that the schema can match.\n * @returns - The schema instance restricted to one of the specified values, with the union of those values inferred as the TypeScript type.\n *\n * @example\n * number().oneOfValues([5, 7]); // Infers the type 5 | 7\n */\n public oneOfValues<Y extends number>(expectedValue: Y[]): WithBGuardType<this, Y> {\n if (this.limit) throw new BuildSchemaError(ONLY_ONCE);\n this.limit = true;\n _setStrictType(this, expectedValue);\n return this.custom(oneOfValues(expectedValue)) as WithBGuardType<this, Y>;\n }\n}\n"]}
1
+ {"version":3,"sources":["/home/runner/work/bguard/bguard/lib/chunk-ZG373PNB.js","../src/schemas/NumberSchema.ts"],"names":[],"mappings":"AAAA;AACE;AACF,sDAA4B;AAC5B;AACE;AACF,sDAA4B;AAC5B;AACE;AACF,sDAA4B;AAC5B;AACE;AACF,sDAA4B;AAC5B;AACE;AACF,sDAA4B;AAC5B;AACE;AACF,sDAA4B;AAC5B;AACA;ACXO,IAAM,aAAA,YAAN,MAAA,QAA2B,8BAAa;AAAA,iBACnC,QAAA,EAAU,EAAA;AAAA,EACZ;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAUD,OAAA,CAA0B,aAAA,EAA2C;AAC1E,IAAA,GAAA,CAAI,IAAA,CAAK,KAAA,EAAO,MAAM,IAAI,sCAAA,CAAiB,0BAAS,CAAA;AACpD,IAAA,IAAA,CAAK,MAAA,EAAQ,IAAA;AACb,IAAA,6CAAA,IAAe,EAAM,aAAa,CAAA;AAClC,IAAA,OAAO,IAAA,CAAK,MAAA,CAAO,sCAAA,aAAqB,CAAC,CAAA;AAAA,EAC3C;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAWO,WAAA,CAA8B,aAAA,EAA6C;AAChF,IAAA,GAAA,CAAI,IAAA,CAAK,KAAA,EAAO,MAAM,IAAI,sCAAA,CAAiB,0BAAS,CAAA;AACpD,IAAA,IAAA,CAAK,MAAA,EAAQ,IAAA;AACb,IAAA,6CAAA,IAAe,EAAM,aAAa,CAAA;AAClC,IAAA,OAAO,IAAA,CAAK,MAAA,CAAO,0CAAA,aAAyB,CAAC,CAAA;AAAA,EAC/C;AACF,UAAA;ADWA;AACA;AACE;AACF,oCAAC","file":"/home/runner/work/bguard/bguard/lib/chunk-ZG373PNB.js","sourcesContent":[null,"import { equalTo } from '../asserts/mix/equalTo';\nimport { oneOfValues } from '../asserts/mix/oneOfValues';\nimport { WithBGuardType } from '../commonTypes';\nimport { BuildSchemaError } from '../exceptions';\nimport { ONLY_ONCE } from '../helpers/constants';\nimport { _setStrictType } from '../helpers/setStrictType';\nimport { CommonSchema } from './CommonSchema';\n\nexport class NumberSchema extends CommonSchema {\n protected _number = 1;\n private limit: boolean | undefined;\n\n /**\n * Restricts the schema to exactly match the specified value and infers the literal value as the TypeScript type.\n *\n * @param expectedValue - The value that the schema must exactly match.\n * @returns - The schema instance restricted to the specified value, with the literal value inferred as the TypeScript type\n *\n * @example - number().equalTo(42); // Infers the type 42\n */\n public equalTo<Y extends number>(expectedValue: Y): WithBGuardType<this, Y> {\n if (this.limit) throw new BuildSchemaError(ONLY_ONCE);\n this.limit = true;\n _setStrictType(this, expectedValue);\n return this.custom(equalTo(expectedValue)) as WithBGuardType<this, Y>;\n }\n\n /**\n * Restricts the schema to match one of the specified values and infers the union of those values as the TypeScript type.\n *\n * @param expectedValues - An array of values that the schema can match.\n * @returns - The schema instance restricted to one of the specified values, with the union of those values inferred as the TypeScript type.\n *\n * @example\n * number().oneOfValues([5, 7]); // Infers the type 5 | 7\n */\n public oneOfValues<Y extends number>(expectedValue: Y[]): WithBGuardType<this, Y> {\n if (this.limit) throw new BuildSchemaError(ONLY_ONCE);\n this.limit = true;\n _setStrictType(this, expectedValue);\n return this.custom(oneOfValues(expectedValue)) as WithBGuardType<this, Y>;\n }\n}\n"]}
@@ -0,0 +1,24 @@
1
+ // src/exceptions.ts
2
+ var ValidationError = class extends Error {
3
+ expected;
4
+ received;
5
+ pathToError;
6
+ message;
7
+ meta;
8
+ constructor(expected, received, pathToError, message, meta) {
9
+ super();
10
+ this.expected = expected;
11
+ this.received = received;
12
+ this.pathToError = pathToError;
13
+ this.message = message;
14
+ this.meta = meta;
15
+ }
16
+ };
17
+ var BuildSchemaError = class extends Error {
18
+ };
19
+
20
+ export {
21
+ ValidationError,
22
+ BuildSchemaError
23
+ };
24
+ //# sourceMappingURL=chunk-ZTCXXAKD.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/exceptions.ts"],"sourcesContent":["import type { MetaContext } from './commonTypes';\n\nexport class ValidationError extends Error {\n expected: unknown;\n received: unknown;\n pathToError: string;\n message: string;\n meta?: MetaContext;\n constructor(expected: unknown, received: unknown, pathToError: string, message: string, meta?: MetaContext) {\n super();\n this.expected = expected;\n this.received = received;\n this.pathToError = pathToError;\n this.message = message;\n this.meta = meta;\n }\n}\n\nexport class BuildSchemaError extends Error {}\n"],"mappings":";AAEO,IAAM,kBAAN,cAA8B,MAAM;AAAA,EACzC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,YAAY,UAAmB,UAAmB,aAAqB,SAAiB,MAAoB;AAC1G,UAAM;AACN,SAAK,WAAW;AAChB,SAAK,WAAW;AAChB,SAAK,cAAc;AACnB,SAAK,UAAU;AACf,SAAK,OAAO;AAAA,EACd;AACF;AAEO,IAAM,mBAAN,cAA+B,MAAM;AAAC;","names":[]}
package/lib/codeGen.d.mts CHANGED
@@ -1,6 +1,7 @@
1
- import { C as CommonSchema } from './CommonSchema-wi9MOXGF.mjs';
2
- import './InferType.mjs';
1
+ import { C as CommonSchema } from './CommonSchema-BIfYCtcQ.mjs';
2
+ import './ExceptionContext.mjs';
3
3
  import './commonTypes.mjs';
4
+ import './InferType.mjs';
4
5
 
5
6
  declare function codeGen(schema: CommonSchema): string;
6
7
  declare function codeGenWithName(typeName: string, schema: CommonSchema): string;
package/lib/codeGen.d.ts CHANGED
@@ -1,6 +1,7 @@
1
- import { C as CommonSchema } from './CommonSchema-DOh3bsL-.js';
2
- import './InferType.js';
1
+ import { C as CommonSchema } from './CommonSchema-DIDMH9R7.js';
2
+ import './ExceptionContext.js';
3
3
  import './commonTypes.js';
4
+ import './InferType.js';
4
5
 
5
6
  declare function codeGen(schema: CommonSchema): string;
6
7
  declare function codeGenWithName(typeName: string, schema: CommonSchema): string;
package/lib/codeGen.js CHANGED
@@ -1,8 +1,7 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
- var _chunkX762EUSZjs = require('./chunk-X762EUSZ.js');
3
+ var _chunkPE55R4KHjs = require('./chunk-PE55R4KH.js');
4
4
  require('./chunk-VBTWYDEM.js');
5
- require('./chunk-5P6AZJCN.js');
6
5
 
7
6
  // src/codeGen.ts
8
7
  function generateBaseType(schemaData) {
@@ -17,7 +16,7 @@ function generateBaseType(schemaData) {
17
16
  }
18
17
  var INDENT_DEFAULT = ` `;
19
18
  function innerGenerator(schema, isProperty, indent = INDENT_DEFAULT) {
20
- const schemaData = schema[_chunkX762EUSZjs.ctxSymbol];
19
+ const schemaData = schema[_chunkPE55R4KHjs.ctxSymbol];
21
20
  let code = "";
22
21
  if (isProperty) {
23
22
  code = code + (schemaData.isOptional ? "?: " : ": ");
@@ -1 +1 @@
1
- {"version":3,"sources":["/home/runner/work/bguard/bguard/lib/codeGen.js","../src/codeGen.ts"],"names":[],"mappings":"AAAA;AACE;AACF,sDAA4B;AAC5B,+BAA4B;AAC5B,+BAA4B;AAC5B;AACA;ACHA,SAAS,gBAAA,CAAiB,UAAA,EAA8B;AACtD,EAAA,GAAA,CAAI,UAAA,CAAW,IAAA,EAAM,OAAO,MAAA;AAE5B,EAAA,GAAA,CAAI,UAAA,CAAW,UAAA,EAAY;AACzB,IAAA,GAAA,CAAI,KAAA,CAAM,OAAA,CAAQ,UAAA,CAAW,eAAe,CAAA,EAAG,OAAO,UAAA,CAAW,eAAA,CAAgB,IAAA,CAAK,KAAK,CAAA;AAC3F,IAAA,OAAO,UAAA,CAAW,eAAA;AAAA,EACpB;AACA,EAAA,GAAA,CAAI,CAAC,UAAA,CAAW,IAAA,CAAK,MAAA,EAAQ,OAAO,EAAA;AACpC,EAAA,MAAM,OAAA,EAAS,UAAA,CAAW,IAAA,CAAK,IAAA,CAAK,KAAK,CAAA;AACzC,EAAA,OAAO,MAAA;AACT;AAEA,IAAM,eAAA,EAAiB,CAAA,EAAA,CAAA;AAEvB,SAAS,cAAA,CAAe,MAAA,EAAsB,UAAA,EAAqB,OAAA,EAAS,cAAA,EAAwB;AAClG,EAAA,MAAM,WAAA,EAAa,MAAA,CAAO,0BAAS,CAAA;AACnC,EAAA,IAAI,KAAA,EAAO,EAAA;AAEX,EAAA,GAAA,CAAI,UAAA,EAAY;AACd,IAAA,KAAA,EAAO,KAAA,EAAA,CAAQ,UAAA,CAAW,WAAA,EAAa,MAAA,EAAQ,IAAA,CAAA;AAAA,EACjD;AAEA,EAAA,GAAA,CAAI,UAAA,CAAW,KAAA,EAAO;AACpB,IAAA,MAAM,eAAA,EAAiB,cAAA,CAAe,UAAA,CAAW,KAAA,EAAO,KAAA,EAAO,OAAA,EAAS,cAAc,CAAA;AACtF,IAAA,KAAA,EAAO,KAAA,EAAA,CAAQ,cAAA,CAAe,QAAA,CAAS,GAAG,EAAA,EAAI,CAAA,CAAA,EAAI,cAAc,CAAA,GAAA,EAAA,EAAQ,CAAA,EAAA;AAC1E,EAAA;AAEuB,EAAA;AACP,IAAA;AACuD,IAAA;AACA,MAAA;AACrE,IAAA;AACwD,IAAA;AAC1D,EAAA;AAEyC,EAAA;AACU,EAAA;AACK,EAAA;AAEjD,EAAA;AACT;AAEsD;AACL,EAAA;AACxC,EAAA;AACT;AAEgF;AAChB,EAAA;AACvD,EAAA;AACT;ADL6E;AACA;AACA;AACA","file":"/home/runner/work/bguard/bguard/lib/codeGen.js","sourcesContent":[null,"import { ctxSymbol } from './helpers/core';\nimport type { CommonSchema, ValidatorContext } from './schemas/CommonSchema';\n\nfunction generateBaseType(schemaData: ValidatorContext) {\n if (schemaData.date) return 'Date';\n\n if (schemaData.strictType) {\n if (Array.isArray(schemaData.strictTypeValue)) return schemaData.strictTypeValue.join(' | ');\n return schemaData.strictTypeValue;\n }\n if (!schemaData.type.length) return '';\n const joined = schemaData.type.join(' | ');\n return joined;\n}\n\nconst INDENT_DEFAULT = ` `;\n\nfunction innerGenerator(schema: CommonSchema, isProperty: boolean, indent = INDENT_DEFAULT): string {\n const schemaData = schema[ctxSymbol];\n let code = '';\n\n if (isProperty) {\n code = code + (schemaData.isOptional ? '?: ' : ': ');\n }\n\n if (schemaData.array) {\n const innerArrayCode = innerGenerator(schemaData.array, false, indent + INDENT_DEFAULT);\n code = code + (innerArrayCode.includes('|') ? `(${innerArrayCode})[]` : `${innerArrayCode}[]`);\n }\n\n if (schemaData.object) {\n code = code + '{\\n';\n for (const [keyOfSchema, valueOfSchema] of Object.entries(schemaData.object)) {\n code = code + indent + keyOfSchema + innerGenerator(valueOfSchema, true, indent + INDENT_DEFAULT) + ';\\n';\n }\n code = code + indent.slice(0, -INDENT_DEFAULT.length) + '}';\n }\n\n code = code + generateBaseType(schemaData);\n code = code + (schemaData.isNullable ? ' | null' : '');\n code = code + (schemaData.isOptional ? ' | undefined' : '');\n\n return code;\n}\n\nexport function codeGen(schema: CommonSchema): string {\n const result = innerGenerator(schema, false) + ';';\n return result;\n}\n\nexport function codeGenWithName(typeName: string, schema: CommonSchema): string {\n const result = 'type ' + typeName + ' = ' + codeGen(schema) + '\\n';\n return result;\n}\n"]}
1
+ {"version":3,"sources":["/home/runner/work/bguard/bguard/lib/codeGen.js","../src/codeGen.ts"],"names":[],"mappings":"AAAA;AACE;AACF,sDAA4B;AAC5B,+BAA4B;AAC5B;AACA;ACFA,SAAS,gBAAA,CAAiB,UAAA,EAA8B;AACtD,EAAA,GAAA,CAAI,UAAA,CAAW,IAAA,EAAM,OAAO,MAAA;AAE5B,EAAA,GAAA,CAAI,UAAA,CAAW,UAAA,EAAY;AACzB,IAAA,GAAA,CAAI,KAAA,CAAM,OAAA,CAAQ,UAAA,CAAW,eAAe,CAAA,EAAG,OAAO,UAAA,CAAW,eAAA,CAAgB,IAAA,CAAK,KAAK,CAAA;AAC3F,IAAA,OAAO,UAAA,CAAW,eAAA;AAAA,EACpB;AACA,EAAA,GAAA,CAAI,CAAC,UAAA,CAAW,IAAA,CAAK,MAAA,EAAQ,OAAO,EAAA;AACpC,EAAA,MAAM,OAAA,EAAS,UAAA,CAAW,IAAA,CAAK,IAAA,CAAK,KAAK,CAAA;AACzC,EAAA,OAAO,MAAA;AACT;AAEA,IAAM,eAAA,EAAiB,CAAA,EAAA,CAAA;AAEvB,SAAS,cAAA,CAAe,MAAA,EAAsB,UAAA,EAAqB,OAAA,EAAS,cAAA,EAAwB;AAClG,EAAA,MAAM,WAAA,EAAa,MAAA,CAAO,0BAAS,CAAA;AACnC,EAAA,IAAI,KAAA,EAAO,EAAA;AAEX,EAAA,GAAA,CAAI,UAAA,EAAY;AACd,IAAA,KAAA,EAAO,KAAA,EAAA,CAAQ,UAAA,CAAW,WAAA,EAAa,MAAA,EAAQ,IAAA,CAAA;AAAA,EACjD;AAEA,EAAA,GAAA,CAAI,UAAA,CAAW,KAAA,EAAO;AACpB,IAAA,MAAM,eAAA,EAAiB,cAAA,CAAe,UAAA,CAAW,KAAA,EAAO,KAAA,EAAO,OAAA,EAAS,cAAc,CAAA;AACtF,IAAA,KAAA,EAAO,KAAA,EAAA,CAAQ,cAAA,CAAe,QAAA,CAAS,GAAG,EAAA,EAAI,CAAA,CAAA,EAAI,cAAc,CAAA,GAAA,EAAA,EAAQ,CAAA,EAAA;AAC1E,EAAA;AAEuB,EAAA;AACP,IAAA;AACuD,IAAA;AACA,MAAA;AACrE,IAAA;AACwD,IAAA;AAC1D,EAAA;AAEyC,EAAA;AACU,EAAA;AACK,EAAA;AAEjD,EAAA;AACT;AAEsD;AACL,EAAA;AACxC,EAAA;AACT;AAEgF;AAChB,EAAA;AACvD,EAAA;AACT;ADN6E;AACA;AACA;AACA","file":"/home/runner/work/bguard/bguard/lib/codeGen.js","sourcesContent":[null,"import { ctxSymbol } from './helpers/core';\nimport type { CommonSchema, ValidatorContext } from './schemas/CommonSchema';\n\nfunction generateBaseType(schemaData: ValidatorContext) {\n if (schemaData.date) return 'Date';\n\n if (schemaData.strictType) {\n if (Array.isArray(schemaData.strictTypeValue)) return schemaData.strictTypeValue.join(' | ');\n return schemaData.strictTypeValue;\n }\n if (!schemaData.type.length) return '';\n const joined = schemaData.type.join(' | ');\n return joined;\n}\n\nconst INDENT_DEFAULT = ` `;\n\nfunction innerGenerator(schema: CommonSchema, isProperty: boolean, indent = INDENT_DEFAULT): string {\n const schemaData = schema[ctxSymbol];\n let code = '';\n\n if (isProperty) {\n code = code + (schemaData.isOptional ? '?: ' : ': ');\n }\n\n if (schemaData.array) {\n const innerArrayCode = innerGenerator(schemaData.array, false, indent + INDENT_DEFAULT);\n code = code + (innerArrayCode.includes('|') ? `(${innerArrayCode})[]` : `${innerArrayCode}[]`);\n }\n\n if (schemaData.object) {\n code = code + '{\\n';\n for (const [keyOfSchema, valueOfSchema] of Object.entries(schemaData.object)) {\n code = code + indent + keyOfSchema + innerGenerator(valueOfSchema, true, indent + INDENT_DEFAULT) + ';\\n';\n }\n code = code + indent.slice(0, -INDENT_DEFAULT.length) + '}';\n }\n\n code = code + generateBaseType(schemaData);\n code = code + (schemaData.isNullable ? ' | null' : '');\n code = code + (schemaData.isOptional ? ' | undefined' : '');\n\n return code;\n}\n\nexport function codeGen(schema: CommonSchema): string {\n const result = innerGenerator(schema, false) + ';';\n return result;\n}\n\nexport function codeGenWithName(typeName: string, schema: CommonSchema): string {\n const result = 'type ' + typeName + ' = ' + codeGen(schema) + '\\n';\n return result;\n}\n"]}
package/lib/codeGen.mjs CHANGED
@@ -1,8 +1,7 @@
1
1
  import {
2
2
  ctxSymbol
3
- } from "./chunk-BNCT7NOR.mjs";
3
+ } from "./chunk-MQRXWXHP.mjs";
4
4
  import "./chunk-YBVMP4EI.mjs";
5
- import "./chunk-FGZKNBDP.mjs";
6
5
 
7
6
  // src/codeGen.ts
8
7
  function generateBaseType(schemaData) {
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/codeGen.ts"],"sourcesContent":["import { ctxSymbol } from './helpers/core';\nimport type { CommonSchema, ValidatorContext } from './schemas/CommonSchema';\n\nfunction generateBaseType(schemaData: ValidatorContext) {\n if (schemaData.date) return 'Date';\n\n if (schemaData.strictType) {\n if (Array.isArray(schemaData.strictTypeValue)) return schemaData.strictTypeValue.join(' | ');\n return schemaData.strictTypeValue;\n }\n if (!schemaData.type.length) return '';\n const joined = schemaData.type.join(' | ');\n return joined;\n}\n\nconst INDENT_DEFAULT = ` `;\n\nfunction innerGenerator(schema: CommonSchema, isProperty: boolean, indent = INDENT_DEFAULT): string {\n const schemaData = schema[ctxSymbol];\n let code = '';\n\n if (isProperty) {\n code = code + (schemaData.isOptional ? '?: ' : ': ');\n }\n\n if (schemaData.array) {\n const innerArrayCode = innerGenerator(schemaData.array, false, indent + INDENT_DEFAULT);\n code = code + (innerArrayCode.includes('|') ? `(${innerArrayCode})[]` : `${innerArrayCode}[]`);\n }\n\n if (schemaData.object) {\n code = code + '{\\n';\n for (const [keyOfSchema, valueOfSchema] of Object.entries(schemaData.object)) {\n code = code + indent + keyOfSchema + innerGenerator(valueOfSchema, true, indent + INDENT_DEFAULT) + ';\\n';\n }\n code = code + indent.slice(0, -INDENT_DEFAULT.length) + '}';\n }\n\n code = code + generateBaseType(schemaData);\n code = code + (schemaData.isNullable ? ' | null' : '');\n code = code + (schemaData.isOptional ? ' | undefined' : '');\n\n return code;\n}\n\nexport function codeGen(schema: CommonSchema): string {\n const result = innerGenerator(schema, false) + ';';\n return result;\n}\n\nexport function codeGenWithName(typeName: string, schema: CommonSchema): string {\n const result = 'type ' + typeName + ' = ' + codeGen(schema) + '\\n';\n return result;\n}\n"],"mappings":";;;;;;;AAGA,SAAS,iBAAiB,YAA8B;AACtD,MAAI,WAAW,KAAM,QAAO;AAE5B,MAAI,WAAW,YAAY;AACzB,QAAI,MAAM,QAAQ,WAAW,eAAe,EAAG,QAAO,WAAW,gBAAgB,KAAK,KAAK;AAC3F,WAAO,WAAW;AAAA,EACpB;AACA,MAAI,CAAC,WAAW,KAAK,OAAQ,QAAO;AACpC,QAAM,SAAS,WAAW,KAAK,KAAK,KAAK;AACzC,SAAO;AACT;AAEA,IAAM,iBAAiB;AAEvB,SAAS,eAAe,QAAsB,YAAqB,SAAS,gBAAwB;AAClG,QAAM,aAAa,OAAO,SAAS;AACnC,MAAI,OAAO;AAEX,MAAI,YAAY;AACd,WAAO,QAAQ,WAAW,aAAa,QAAQ;AAAA,EACjD;AAEA,MAAI,WAAW,OAAO;AACpB,UAAM,iBAAiB,eAAe,WAAW,OAAO,OAAO,SAAS,cAAc;AACtF,WAAO,QAAQ,eAAe,SAAS,GAAG,IAAI,IAAI,cAAc,QAAQ,GAAG,cAAc;AAAA,EAC3F;AAEA,MAAI,WAAW,QAAQ;AACrB,WAAO,OAAO;AACd,eAAW,CAAC,aAAa,aAAa,KAAK,OAAO,QAAQ,WAAW,MAAM,GAAG;AAC5E,aAAO,OAAO,SAAS,cAAc,eAAe,eAAe,MAAM,SAAS,cAAc,IAAI;AAAA,IACtG;AACA,WAAO,OAAO,OAAO,MAAM,GAAG,CAAC,eAAe,MAAM,IAAI;AAAA,EAC1D;AAEA,SAAO,OAAO,iBAAiB,UAAU;AACzC,SAAO,QAAQ,WAAW,aAAa,YAAY;AACnD,SAAO,QAAQ,WAAW,aAAa,iBAAiB;AAExD,SAAO;AACT;AAEO,SAAS,QAAQ,QAA8B;AACpD,QAAM,SAAS,eAAe,QAAQ,KAAK,IAAI;AAC/C,SAAO;AACT;AAEO,SAAS,gBAAgB,UAAkB,QAA8B;AAC9E,QAAM,SAAS,UAAU,WAAW,QAAQ,QAAQ,MAAM,IAAI;AAC9D,SAAO;AACT;","names":[]}
1
+ {"version":3,"sources":["../src/codeGen.ts"],"sourcesContent":["import { ctxSymbol } from './helpers/core';\nimport type { CommonSchema, ValidatorContext } from './schemas/CommonSchema';\n\nfunction generateBaseType(schemaData: ValidatorContext) {\n if (schemaData.date) return 'Date';\n\n if (schemaData.strictType) {\n if (Array.isArray(schemaData.strictTypeValue)) return schemaData.strictTypeValue.join(' | ');\n return schemaData.strictTypeValue;\n }\n if (!schemaData.type.length) return '';\n const joined = schemaData.type.join(' | ');\n return joined;\n}\n\nconst INDENT_DEFAULT = ` `;\n\nfunction innerGenerator(schema: CommonSchema, isProperty: boolean, indent = INDENT_DEFAULT): string {\n const schemaData = schema[ctxSymbol];\n let code = '';\n\n if (isProperty) {\n code = code + (schemaData.isOptional ? '?: ' : ': ');\n }\n\n if (schemaData.array) {\n const innerArrayCode = innerGenerator(schemaData.array, false, indent + INDENT_DEFAULT);\n code = code + (innerArrayCode.includes('|') ? `(${innerArrayCode})[]` : `${innerArrayCode}[]`);\n }\n\n if (schemaData.object) {\n code = code + '{\\n';\n for (const [keyOfSchema, valueOfSchema] of Object.entries(schemaData.object)) {\n code = code + indent + keyOfSchema + innerGenerator(valueOfSchema, true, indent + INDENT_DEFAULT) + ';\\n';\n }\n code = code + indent.slice(0, -INDENT_DEFAULT.length) + '}';\n }\n\n code = code + generateBaseType(schemaData);\n code = code + (schemaData.isNullable ? ' | null' : '');\n code = code + (schemaData.isOptional ? ' | undefined' : '');\n\n return code;\n}\n\nexport function codeGen(schema: CommonSchema): string {\n const result = innerGenerator(schema, false) + ';';\n return result;\n}\n\nexport function codeGenWithName(typeName: string, schema: CommonSchema): string {\n const result = 'type ' + typeName + ' = ' + codeGen(schema) + '\\n';\n return result;\n}\n"],"mappings":";;;;;;AAGA,SAAS,iBAAiB,YAA8B;AACtD,MAAI,WAAW,KAAM,QAAO;AAE5B,MAAI,WAAW,YAAY;AACzB,QAAI,MAAM,QAAQ,WAAW,eAAe,EAAG,QAAO,WAAW,gBAAgB,KAAK,KAAK;AAC3F,WAAO,WAAW;AAAA,EACpB;AACA,MAAI,CAAC,WAAW,KAAK,OAAQ,QAAO;AACpC,QAAM,SAAS,WAAW,KAAK,KAAK,KAAK;AACzC,SAAO;AACT;AAEA,IAAM,iBAAiB;AAEvB,SAAS,eAAe,QAAsB,YAAqB,SAAS,gBAAwB;AAClG,QAAM,aAAa,OAAO,SAAS;AACnC,MAAI,OAAO;AAEX,MAAI,YAAY;AACd,WAAO,QAAQ,WAAW,aAAa,QAAQ;AAAA,EACjD;AAEA,MAAI,WAAW,OAAO;AACpB,UAAM,iBAAiB,eAAe,WAAW,OAAO,OAAO,SAAS,cAAc;AACtF,WAAO,QAAQ,eAAe,SAAS,GAAG,IAAI,IAAI,cAAc,QAAQ,GAAG,cAAc;AAAA,EAC3F;AAEA,MAAI,WAAW,QAAQ;AACrB,WAAO,OAAO;AACd,eAAW,CAAC,aAAa,aAAa,KAAK,OAAO,QAAQ,WAAW,MAAM,GAAG;AAC5E,aAAO,OAAO,SAAS,cAAc,eAAe,eAAe,MAAM,SAAS,cAAc,IAAI;AAAA,IACtG;AACA,WAAO,OAAO,OAAO,MAAM,GAAG,CAAC,eAAe,MAAM,IAAI;AAAA,EAC1D;AAEA,SAAO,OAAO,iBAAiB,UAAU;AACzC,SAAO,QAAQ,WAAW,aAAa,YAAY;AACnD,SAAO,QAAQ,WAAW,aAAa,iBAAiB;AAExD,SAAO;AACT;AAEO,SAAS,QAAQ,QAA8B;AACpD,QAAM,SAAS,eAAe,QAAQ,KAAK,IAAI;AAC/C,SAAO;AACT;AAEO,SAAS,gBAAgB,UAAkB,QAA8B;AAC9E,QAAM,SAAS,UAAU,WAAW,QAAQ,QAAQ,MAAM,IAAI;AAC9D,SAAO;AACT;","names":[]}