bguard 0.1.1 → 0.2.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 (332) hide show
  1. package/README.md +208 -4
  2. package/lib/{CommonSchema-BbGNki0L.d.ts → CommonSchema-9RtxTxdX.d.ts} +3 -2
  3. package/lib/{CommonSchema-CjsYE4dC.d.mts → CommonSchema-DJmQ3F_9.d.mts} +3 -2
  4. package/lib/InferType.d.mts +5 -2
  5. package/lib/InferType.d.ts +5 -2
  6. package/lib/asserts/array/index.d.mts +4 -4
  7. package/lib/asserts/array/index.d.ts +4 -4
  8. package/lib/asserts/array/index.js +10 -5
  9. package/lib/asserts/array/index.js.map +1 -1
  10. package/lib/asserts/array/index.mjs +10 -5
  11. package/lib/asserts/array/index.mjs.map +1 -1
  12. package/lib/asserts/bigint/bigintMax.d.mts +22 -0
  13. package/lib/asserts/bigint/bigintMax.d.ts +22 -0
  14. package/lib/asserts/bigint/bigintMax.js +20 -0
  15. package/lib/asserts/bigint/bigintMax.js.map +1 -0
  16. package/lib/asserts/bigint/bigintMax.mjs +20 -0
  17. package/lib/asserts/bigint/bigintMax.mjs.map +1 -0
  18. package/lib/asserts/bigint/bigintMaxExcluded.d.mts +22 -0
  19. package/lib/asserts/bigint/bigintMaxExcluded.d.ts +22 -0
  20. package/lib/asserts/bigint/bigintMaxExcluded.js +20 -0
  21. package/lib/asserts/bigint/bigintMaxExcluded.js.map +1 -0
  22. package/lib/asserts/bigint/bigintMaxExcluded.mjs +20 -0
  23. package/lib/asserts/bigint/bigintMaxExcluded.mjs.map +1 -0
  24. package/lib/asserts/bigint/bigintMin.d.mts +22 -0
  25. package/lib/asserts/bigint/bigintMin.d.ts +22 -0
  26. package/lib/asserts/bigint/bigintMin.js +20 -0
  27. package/lib/asserts/bigint/bigintMin.js.map +1 -0
  28. package/lib/asserts/bigint/bigintMin.mjs +20 -0
  29. package/lib/asserts/bigint/bigintMin.mjs.map +1 -0
  30. package/lib/asserts/bigint/bigintMinExcluded.d.mts +22 -0
  31. package/lib/asserts/bigint/bigintMinExcluded.d.ts +22 -0
  32. package/lib/asserts/bigint/bigintMinExcluded.js +20 -0
  33. package/lib/asserts/bigint/bigintMinExcluded.js.map +1 -0
  34. package/lib/asserts/bigint/bigintMinExcluded.mjs +20 -0
  35. package/lib/asserts/bigint/bigintMinExcluded.mjs.map +1 -0
  36. package/lib/asserts/bigint/index.d.mts +18 -0
  37. package/lib/asserts/bigint/index.d.ts +18 -0
  38. package/lib/asserts/bigint/index.js +21 -0
  39. package/lib/asserts/bigint/index.js.map +1 -0
  40. package/lib/asserts/bigint/index.mjs +21 -0
  41. package/lib/asserts/bigint/index.mjs.map +1 -0
  42. package/lib/asserts/boolean/index.d.mts +4 -4
  43. package/lib/asserts/boolean/index.d.ts +4 -4
  44. package/lib/asserts/boolean/index.js +11 -6
  45. package/lib/asserts/boolean/index.js.map +1 -1
  46. package/lib/asserts/boolean/index.mjs +11 -6
  47. package/lib/asserts/boolean/index.mjs.map +1 -1
  48. package/lib/asserts/date/dateMax.d.mts +22 -0
  49. package/lib/asserts/date/dateMax.d.ts +22 -0
  50. package/lib/asserts/date/dateMax.js +28 -0
  51. package/lib/asserts/date/dateMax.js.map +1 -0
  52. package/lib/asserts/date/dateMax.mjs +28 -0
  53. package/lib/asserts/date/dateMax.mjs.map +1 -0
  54. package/lib/asserts/date/dateMin.d.mts +22 -0
  55. package/lib/asserts/date/dateMin.d.ts +22 -0
  56. package/lib/asserts/date/dateMin.js +28 -0
  57. package/lib/asserts/date/dateMin.js.map +1 -0
  58. package/lib/asserts/date/dateMin.mjs +28 -0
  59. package/lib/asserts/date/dateMin.mjs.map +1 -0
  60. package/lib/asserts/date/index.d.mts +17 -0
  61. package/lib/asserts/date/index.d.ts +17 -0
  62. package/lib/asserts/date/index.js +16 -0
  63. package/lib/asserts/date/index.js.map +1 -0
  64. package/lib/asserts/date/index.mjs +16 -0
  65. package/lib/asserts/date/index.mjs.map +1 -0
  66. package/lib/asserts/mix/equalTo.d.mts +1 -1
  67. package/lib/asserts/mix/equalTo.d.ts +1 -1
  68. package/lib/asserts/mix/equalTo.js +3 -3
  69. package/lib/asserts/mix/equalTo.mjs +2 -2
  70. package/lib/asserts/mix/index.d.mts +4 -3
  71. package/lib/asserts/mix/index.d.ts +4 -3
  72. package/lib/asserts/mix/index.js +9 -4
  73. package/lib/asserts/mix/index.js.map +1 -1
  74. package/lib/asserts/mix/index.mjs +9 -4
  75. package/lib/asserts/mix/index.mjs.map +1 -1
  76. package/lib/asserts/mix/oneOfValues.d.mts +1 -1
  77. package/lib/asserts/mix/oneOfValues.d.ts +1 -1
  78. package/lib/asserts/mix/oneOfValues.js +3 -3
  79. package/lib/asserts/mix/oneOfValues.mjs +2 -2
  80. package/lib/asserts/number/index.d.mts +4 -4
  81. package/lib/asserts/number/index.d.ts +4 -4
  82. package/lib/asserts/number/index.js +14 -9
  83. package/lib/asserts/number/index.js.map +1 -1
  84. package/lib/asserts/number/index.mjs +14 -9
  85. package/lib/asserts/number/index.mjs.map +1 -1
  86. package/lib/asserts/number/max.js +2 -2
  87. package/lib/asserts/number/max.mjs +1 -1
  88. package/lib/asserts/number/maxExcluded.js +2 -2
  89. package/lib/asserts/number/maxExcluded.mjs +1 -1
  90. package/lib/asserts/number/min.js +2 -2
  91. package/lib/asserts/number/min.mjs +1 -1
  92. package/lib/asserts/number/minExcluded.js +2 -2
  93. package/lib/asserts/number/minExcluded.mjs +1 -1
  94. package/lib/asserts/number/negative.js +2 -2
  95. package/lib/asserts/number/negative.mjs +1 -1
  96. package/lib/asserts/number/positive.js +2 -2
  97. package/lib/asserts/number/positive.mjs +1 -1
  98. package/lib/asserts/object/index.d.mts +4 -4
  99. package/lib/asserts/object/index.d.ts +4 -4
  100. package/lib/asserts/object/index.js +10 -5
  101. package/lib/asserts/object/index.js.map +1 -1
  102. package/lib/asserts/object/index.mjs +10 -5
  103. package/lib/asserts/object/index.mjs.map +1 -1
  104. package/lib/asserts/string/atLeastOneDigit.js +2 -2
  105. package/lib/asserts/string/atLeastOneDigit.mjs +1 -1
  106. package/lib/asserts/string/atLeastOneLowerChar.js +2 -2
  107. package/lib/asserts/string/atLeastOneLowerChar.mjs +1 -1
  108. package/lib/asserts/string/atLeastOneSpecialChar.js +2 -2
  109. package/lib/asserts/string/atLeastOneSpecialChar.mjs +1 -1
  110. package/lib/asserts/string/atLeastOneUpperChar.js +2 -2
  111. package/lib/asserts/string/atLeastOneUpperChar.mjs +1 -1
  112. package/lib/asserts/string/contains.js +2 -2
  113. package/lib/asserts/string/contains.mjs +1 -1
  114. package/lib/asserts/string/email.js +2 -2
  115. package/lib/asserts/string/email.mjs +1 -1
  116. package/lib/asserts/string/endsWith.js +2 -2
  117. package/lib/asserts/string/endsWith.mjs +1 -1
  118. package/lib/asserts/string/index.d.mts +4 -4
  119. package/lib/asserts/string/index.d.ts +4 -4
  120. package/lib/asserts/string/index.js +14 -9
  121. package/lib/asserts/string/index.js.map +1 -1
  122. package/lib/asserts/string/index.mjs +14 -9
  123. package/lib/asserts/string/index.mjs.map +1 -1
  124. package/lib/asserts/string/lowerCase.js +2 -2
  125. package/lib/asserts/string/lowerCase.mjs +1 -1
  126. package/lib/asserts/string/maxLength.js +2 -2
  127. package/lib/asserts/string/maxLength.mjs +1 -1
  128. package/lib/asserts/string/minLength.js +2 -2
  129. package/lib/asserts/string/minLength.mjs +1 -1
  130. package/lib/asserts/string/regExp.js +2 -2
  131. package/lib/asserts/string/regExp.mjs +1 -1
  132. package/lib/asserts/string/startsWith.js +2 -2
  133. package/lib/asserts/string/startsWith.mjs +1 -1
  134. package/lib/asserts/string/upperCase.js +2 -2
  135. package/lib/asserts/string/upperCase.mjs +1 -1
  136. package/lib/asserts/string/uuid.js +2 -2
  137. package/lib/asserts/string/uuid.mjs +1 -1
  138. package/lib/asserts/string/uuidV1.js +2 -2
  139. package/lib/asserts/string/uuidV1.mjs +1 -1
  140. package/lib/asserts/string/uuidV2.js +2 -2
  141. package/lib/asserts/string/uuidV2.mjs +1 -1
  142. package/lib/asserts/string/uuidV3.js +2 -2
  143. package/lib/asserts/string/uuidV3.mjs +1 -1
  144. package/lib/asserts/string/uuidV4.js +2 -2
  145. package/lib/asserts/string/uuidV4.mjs +1 -1
  146. package/lib/asserts/string/uuidV5.js +2 -2
  147. package/lib/asserts/string/uuidV5.mjs +1 -1
  148. package/lib/asserts/string/validUrl.js +2 -2
  149. package/lib/asserts/string/validUrl.mjs +1 -1
  150. package/lib/{chunk-RRQOET3X.js → chunk-2OINKFOA.js} +6 -6
  151. package/lib/{chunk-RRQOET3X.js.map → chunk-2OINKFOA.js.map} +1 -1
  152. package/lib/{chunk-LEQCDD66.js → chunk-32J4WVLE.js} +10 -10
  153. package/lib/{chunk-LEQCDD66.js.map → chunk-32J4WVLE.js.map} +1 -1
  154. package/lib/chunk-356HMXOP.js +12 -0
  155. package/lib/chunk-356HMXOP.js.map +1 -0
  156. package/lib/{chunk-4CYIMDP2.js → chunk-4SPM2CSQ.js} +3 -3
  157. package/lib/chunk-4SPM2CSQ.js.map +1 -0
  158. package/lib/{chunk-WBERBAL4.js → chunk-4SR7J2I4.js} +6 -6
  159. package/lib/{chunk-WBERBAL4.js.map → chunk-4SR7J2I4.js.map} +1 -1
  160. package/lib/{chunk-DPBE7TAQ.mjs → chunk-4UF67IQ2.mjs} +3 -3
  161. package/lib/chunk-4UF67IQ2.mjs.map +1 -0
  162. package/lib/{chunk-RYVUYVEE.mjs → chunk-54RHVQFA.mjs} +2 -2
  163. package/lib/{chunk-YUESB2WV.mjs → chunk-5AO66YV5.mjs} +3 -3
  164. package/lib/{chunk-KQKJASVB.js → chunk-5EIBKBYS.js} +10 -10
  165. package/lib/{chunk-KQKJASVB.js.map → chunk-5EIBKBYS.js.map} +1 -1
  166. package/lib/{chunk-IRG4OQAB.js → chunk-7GIRQ5EA.js} +7 -1
  167. package/lib/chunk-7GIRQ5EA.js.map +1 -0
  168. package/lib/{chunk-5BVJ6YMH.js → chunk-CQWI6YRI.js} +3 -2
  169. package/lib/chunk-CQWI6YRI.js.map +1 -0
  170. package/lib/{chunk-EGEHSELT.js → chunk-EQNVYAKS.js} +7 -7
  171. package/lib/chunk-EQNVYAKS.js.map +1 -0
  172. package/lib/chunk-GDSB7CDN.mjs +12 -0
  173. package/lib/chunk-GDSB7CDN.mjs.map +1 -0
  174. package/lib/chunk-LWAEUS2F.js +14 -0
  175. package/lib/{chunk-JSGZ7DKT.js.map → chunk-LWAEUS2F.js.map} +1 -1
  176. package/lib/{chunk-NNFYXHLU.mjs → chunk-M6OCVAUD.mjs} +2 -2
  177. package/lib/chunk-M6OCVAUD.mjs.map +1 -0
  178. package/lib/{chunk-PG2R7P7G.mjs → chunk-MRWZVTNH.mjs} +3 -3
  179. package/lib/{chunk-DJSLA2ZV.js → chunk-MTJJKWTP.js} +5 -5
  180. package/lib/{chunk-DJSLA2ZV.js.map → chunk-MTJJKWTP.js.map} +1 -1
  181. package/lib/{chunk-6TH3DBDK.js → chunk-N6YMNLXG.js} +8 -8
  182. package/lib/{chunk-6TH3DBDK.js.map → chunk-N6YMNLXG.js.map} +1 -1
  183. package/lib/{chunk-NDQM5OL4.mjs → chunk-PEWNA24X.mjs} +3 -3
  184. package/lib/{chunk-CCBCDJXS.mjs → chunk-PJI3DRGP.mjs} +3 -3
  185. package/lib/{chunk-TCQY2R3U.mjs → chunk-PVOHKGBW.mjs} +3 -3
  186. package/lib/chunk-QLVLZRHT.js +20 -0
  187. package/lib/chunk-QLVLZRHT.js.map +1 -0
  188. package/lib/{chunk-3HTYHE2X.mjs → chunk-QV4JDW3T.mjs} +3 -2
  189. package/lib/chunk-QV4JDW3T.mjs.map +1 -0
  190. package/lib/chunk-SEIKS6G7.js +61 -0
  191. package/lib/chunk-SEIKS6G7.js.map +1 -0
  192. package/lib/{chunk-JPRCULRQ.mjs → chunk-TP5I237J.mjs} +7 -7
  193. package/lib/chunk-UV4I7JZR.mjs +61 -0
  194. package/lib/chunk-UV4I7JZR.mjs.map +1 -0
  195. package/lib/{chunk-H7CPKW53.js → chunk-VGF3Y2EK.js} +5 -5
  196. package/lib/{chunk-H7CPKW53.js.map → chunk-VGF3Y2EK.js.map} +1 -1
  197. package/lib/{chunk-J4VKFJQK.js → chunk-WPHJ4QTB.js} +3 -3
  198. package/lib/chunk-WPHJ4QTB.js.map +1 -0
  199. package/lib/chunk-XFR7Y4XX.mjs +20 -0
  200. package/lib/chunk-XFR7Y4XX.mjs.map +1 -0
  201. package/lib/{chunk-PH2PMUZP.mjs → chunk-XZTZC73V.mjs} +7 -1
  202. package/lib/chunk-XZTZC73V.mjs.map +1 -0
  203. package/lib/{chunk-3O4WCRC2.mjs → chunk-YPAUFM3S.mjs} +2 -2
  204. package/lib/chunk-YPAUFM3S.mjs.map +1 -0
  205. package/lib/{chunk-P7IXNCJG.mjs → chunk-Z7OEFOAD.mjs} +7 -7
  206. package/lib/codeGen.d.mts +1 -1
  207. package/lib/codeGen.d.ts +1 -1
  208. package/lib/codeGen.js +4 -2
  209. package/lib/codeGen.js.map +1 -1
  210. package/lib/codeGen.mjs +3 -1
  211. package/lib/codeGen.mjs.map +1 -1
  212. package/lib/commonTypes.d.mts +1 -0
  213. package/lib/commonTypes.d.ts +1 -0
  214. package/lib/helpers/core.d.mts +1 -1
  215. package/lib/helpers/core.d.ts +1 -1
  216. package/lib/helpers/core.js +3 -2
  217. package/lib/helpers/core.js.map +1 -1
  218. package/lib/helpers/core.mjs +2 -1
  219. package/lib/helpers/isValidDate.d.mts +3 -0
  220. package/lib/helpers/isValidDate.d.ts +3 -0
  221. package/lib/helpers/isValidDate.js +7 -0
  222. package/lib/helpers/isValidDate.js.map +1 -0
  223. package/lib/helpers/isValidDate.mjs +7 -0
  224. package/lib/helpers/isValidDate.mjs.map +1 -0
  225. package/lib/helpers/setStrictType.d.mts +1 -1
  226. package/lib/helpers/setStrictType.d.ts +1 -1
  227. package/lib/helpers/setStrictType.js +4 -3
  228. package/lib/helpers/setStrictType.js.map +1 -1
  229. package/lib/helpers/setStrictType.mjs +3 -2
  230. package/lib/index.d.mts +3 -7
  231. package/lib/index.d.ts +3 -7
  232. package/lib/index.js +6 -39
  233. package/lib/index.js.map +1 -1
  234. package/lib/index.mjs +6 -39
  235. package/lib/parse.d.mts +3 -1
  236. package/lib/parse.d.ts +3 -1
  237. package/lib/parse.js +5 -4
  238. package/lib/parse.js.map +1 -1
  239. package/lib/parse.mjs +4 -3
  240. package/lib/parseOrFail.d.mts +3 -1
  241. package/lib/parseOrFail.d.ts +3 -1
  242. package/lib/parseOrFail.js +5 -4
  243. package/lib/parseOrFail.js.map +1 -1
  244. package/lib/parseOrFail.mjs +4 -3
  245. package/lib/schemas/ArraySchema.d.mts +1 -1
  246. package/lib/schemas/ArraySchema.d.ts +1 -1
  247. package/lib/schemas/ArraySchema.js +5 -4
  248. package/lib/schemas/ArraySchema.js.map +1 -1
  249. package/lib/schemas/ArraySchema.mjs +4 -3
  250. package/lib/schemas/BigIntSchema.d.mts +32 -0
  251. package/lib/schemas/BigIntSchema.d.ts +32 -0
  252. package/lib/schemas/BigIntSchema.js +16 -0
  253. package/lib/schemas/BigIntSchema.js.map +1 -0
  254. package/lib/schemas/BigIntSchema.mjs +16 -0
  255. package/lib/schemas/BigIntSchema.mjs.map +1 -0
  256. package/lib/schemas/BooleanSchema.d.mts +1 -1
  257. package/lib/schemas/BooleanSchema.d.ts +1 -1
  258. package/lib/schemas/BooleanSchema.js +6 -5
  259. package/lib/schemas/BooleanSchema.js.map +1 -1
  260. package/lib/schemas/BooleanSchema.mjs +5 -4
  261. package/lib/schemas/CommonSchema.d.mts +1 -1
  262. package/lib/schemas/CommonSchema.d.ts +1 -1
  263. package/lib/schemas/CommonSchema.js +4 -3
  264. package/lib/schemas/CommonSchema.js.map +1 -1
  265. package/lib/schemas/CommonSchema.mjs +3 -2
  266. package/lib/schemas/DateSchema.d.mts +9 -0
  267. package/lib/schemas/DateSchema.d.ts +9 -0
  268. package/lib/schemas/DateSchema.js +11 -0
  269. package/lib/schemas/DateSchema.js.map +1 -0
  270. package/lib/schemas/DateSchema.mjs +11 -0
  271. package/lib/schemas/DateSchema.mjs.map +1 -0
  272. package/lib/schemas/NumberSchema.d.mts +1 -1
  273. package/lib/schemas/NumberSchema.d.ts +1 -1
  274. package/lib/schemas/NumberSchema.js +9 -8
  275. package/lib/schemas/NumberSchema.js.map +1 -1
  276. package/lib/schemas/NumberSchema.mjs +8 -7
  277. package/lib/schemas/ObjectSchema.d.mts +1 -1
  278. package/lib/schemas/ObjectSchema.d.ts +1 -1
  279. package/lib/schemas/ObjectSchema.js +5 -4
  280. package/lib/schemas/ObjectSchema.js.map +1 -1
  281. package/lib/schemas/ObjectSchema.mjs +4 -3
  282. package/lib/schemas/StringSchema.d.mts +1 -1
  283. package/lib/schemas/StringSchema.d.ts +1 -1
  284. package/lib/schemas/StringSchema.js +9 -8
  285. package/lib/schemas/StringSchema.js.map +1 -1
  286. package/lib/schemas/StringSchema.mjs +8 -7
  287. package/lib/translationMap.js +2 -2
  288. package/lib/translationMap.mjs +1 -1
  289. package/package.json +6 -1
  290. package/lib/chunk-2PM3K3OE.mjs +0 -13
  291. package/lib/chunk-2PM3K3OE.mjs.map +0 -1
  292. package/lib/chunk-32RSTOZ4.mjs +0 -13
  293. package/lib/chunk-32RSTOZ4.mjs.map +0 -1
  294. package/lib/chunk-3HTYHE2X.mjs.map +0 -1
  295. package/lib/chunk-3O4WCRC2.mjs.map +0 -1
  296. package/lib/chunk-4CYIMDP2.js.map +0 -1
  297. package/lib/chunk-5BVJ6YMH.js.map +0 -1
  298. package/lib/chunk-DPBE7TAQ.mjs.map +0 -1
  299. package/lib/chunk-EGEHSELT.js.map +0 -1
  300. package/lib/chunk-HDSGCAHH.js +0 -13
  301. package/lib/chunk-HDSGCAHH.js.map +0 -1
  302. package/lib/chunk-IEUXIOL6.js +0 -13
  303. package/lib/chunk-IEUXIOL6.js.map +0 -1
  304. package/lib/chunk-IRG4OQAB.js.map +0 -1
  305. package/lib/chunk-J4VKFJQK.js.map +0 -1
  306. package/lib/chunk-JDGZCBXF.mjs +0 -13
  307. package/lib/chunk-JDGZCBXF.mjs.map +0 -1
  308. package/lib/chunk-JSGZ7DKT.js +0 -14
  309. package/lib/chunk-MRISXZQ4.mjs +0 -13
  310. package/lib/chunk-MRISXZQ4.mjs.map +0 -1
  311. package/lib/chunk-NNFYXHLU.mjs.map +0 -1
  312. package/lib/chunk-PH2PMUZP.mjs.map +0 -1
  313. package/lib/chunk-PXBAS3GA.mjs +0 -13
  314. package/lib/chunk-PXBAS3GA.mjs.map +0 -1
  315. package/lib/chunk-QQNQ4IDN.js +0 -13
  316. package/lib/chunk-QQNQ4IDN.js.map +0 -1
  317. package/lib/chunk-RD6TBCPQ.js +0 -13
  318. package/lib/chunk-RD6TBCPQ.js.map +0 -1
  319. package/lib/chunk-TKZ6FLLR.js +0 -13
  320. package/lib/chunk-TKZ6FLLR.js.map +0 -1
  321. package/lib/chunk-VHEA4JZ5.js +0 -13
  322. package/lib/chunk-VHEA4JZ5.js.map +0 -1
  323. package/lib/chunk-YML32TPA.mjs +0 -13
  324. package/lib/chunk-YML32TPA.mjs.map +0 -1
  325. /package/lib/{chunk-RYVUYVEE.mjs.map → chunk-54RHVQFA.mjs.map} +0 -0
  326. /package/lib/{chunk-YUESB2WV.mjs.map → chunk-5AO66YV5.mjs.map} +0 -0
  327. /package/lib/{chunk-PG2R7P7G.mjs.map → chunk-MRWZVTNH.mjs.map} +0 -0
  328. /package/lib/{chunk-NDQM5OL4.mjs.map → chunk-PEWNA24X.mjs.map} +0 -0
  329. /package/lib/{chunk-CCBCDJXS.mjs.map → chunk-PJI3DRGP.mjs.map} +0 -0
  330. /package/lib/{chunk-TCQY2R3U.mjs.map → chunk-PVOHKGBW.mjs.map} +0 -0
  331. /package/lib/{chunk-JPRCULRQ.mjs.map → chunk-TP5I237J.mjs.map} +0 -0
  332. /package/lib/{chunk-P7IXNCJG.mjs.map → chunk-Z7OEFOAD.mjs.map} +0 -0
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  setToDefaultLocale
3
- } from "../../chunk-3HTYHE2X.mjs";
3
+ } from "../../chunk-QV4JDW3T.mjs";
4
4
  import {
5
5
  guardException
6
6
  } from "../../chunk-7XFLH6R2.mjs";
@@ -1,6 +1,6 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
- var _chunk5BVJ6YMHjs = require('../../chunk-5BVJ6YMH.js');
3
+ var _chunkCQWI6YRIjs = require('../../chunk-CQWI6YRI.js');
4
4
 
5
5
 
6
6
  var _chunkWK4O3HH4js = require('../../chunk-WK4O3HH4.js');
@@ -16,7 +16,7 @@ var uuidV2 = () => (received, ctx) => {
16
16
  };
17
17
  uuidV2.key = uuidV2ErrorKey;
18
18
  uuidV2.message = uuidV2ErrorMessage;
19
- _chunk5BVJ6YMHjs.setToDefaultLocale.call(void 0, uuidV2);
19
+ _chunkCQWI6YRIjs.setToDefaultLocale.call(void 0, uuidV2);
20
20
 
21
21
 
22
22
  exports.uuidV2 = uuidV2;
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  setToDefaultLocale
3
- } from "../../chunk-3HTYHE2X.mjs";
3
+ } from "../../chunk-QV4JDW3T.mjs";
4
4
  import {
5
5
  guardException
6
6
  } from "../../chunk-7XFLH6R2.mjs";
@@ -1,6 +1,6 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
- var _chunk5BVJ6YMHjs = require('../../chunk-5BVJ6YMH.js');
3
+ var _chunkCQWI6YRIjs = require('../../chunk-CQWI6YRI.js');
4
4
 
5
5
 
6
6
  var _chunkWK4O3HH4js = require('../../chunk-WK4O3HH4.js');
@@ -16,7 +16,7 @@ var uuidV3 = () => (received, ctx) => {
16
16
  };
17
17
  uuidV3.key = uuidV3ErrorKey;
18
18
  uuidV3.message = uuidV3ErrorMessage;
19
- _chunk5BVJ6YMHjs.setToDefaultLocale.call(void 0, uuidV3);
19
+ _chunkCQWI6YRIjs.setToDefaultLocale.call(void 0, uuidV3);
20
20
 
21
21
 
22
22
  exports.uuidV3 = uuidV3;
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  setToDefaultLocale
3
- } from "../../chunk-3HTYHE2X.mjs";
3
+ } from "../../chunk-QV4JDW3T.mjs";
4
4
  import {
5
5
  guardException
6
6
  } from "../../chunk-7XFLH6R2.mjs";
@@ -1,6 +1,6 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
- var _chunk5BVJ6YMHjs = require('../../chunk-5BVJ6YMH.js');
3
+ var _chunkCQWI6YRIjs = require('../../chunk-CQWI6YRI.js');
4
4
 
5
5
 
6
6
  var _chunkWK4O3HH4js = require('../../chunk-WK4O3HH4.js');
@@ -16,7 +16,7 @@ var uuidV4 = () => (received, ctx) => {
16
16
  };
17
17
  uuidV4.key = uuidV4ErrorKey;
18
18
  uuidV4.message = uuidV4ErrorMessage;
19
- _chunk5BVJ6YMHjs.setToDefaultLocale.call(void 0, uuidV4);
19
+ _chunkCQWI6YRIjs.setToDefaultLocale.call(void 0, uuidV4);
20
20
 
21
21
 
22
22
  exports.uuidV4 = uuidV4;
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  setToDefaultLocale
3
- } from "../../chunk-3HTYHE2X.mjs";
3
+ } from "../../chunk-QV4JDW3T.mjs";
4
4
  import {
5
5
  guardException
6
6
  } from "../../chunk-7XFLH6R2.mjs";
@@ -1,6 +1,6 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
- var _chunk5BVJ6YMHjs = require('../../chunk-5BVJ6YMH.js');
3
+ var _chunkCQWI6YRIjs = require('../../chunk-CQWI6YRI.js');
4
4
 
5
5
 
6
6
  var _chunkWK4O3HH4js = require('../../chunk-WK4O3HH4.js');
@@ -16,7 +16,7 @@ var uuidV5 = () => (received, ctx) => {
16
16
  };
17
17
  uuidV5.key = uuidV5ErrorKey;
18
18
  uuidV5.message = uuidV5ErrorMessage;
19
- _chunk5BVJ6YMHjs.setToDefaultLocale.call(void 0, uuidV5);
19
+ _chunkCQWI6YRIjs.setToDefaultLocale.call(void 0, uuidV5);
20
20
 
21
21
 
22
22
  exports.uuidV5 = uuidV5;
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  setToDefaultLocale
3
- } from "../../chunk-3HTYHE2X.mjs";
3
+ } from "../../chunk-QV4JDW3T.mjs";
4
4
  import {
5
5
  guardException
6
6
  } from "../../chunk-7XFLH6R2.mjs";
@@ -1,6 +1,6 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
- var _chunk5BVJ6YMHjs = require('../../chunk-5BVJ6YMH.js');
3
+ var _chunkCQWI6YRIjs = require('../../chunk-CQWI6YRI.js');
4
4
 
5
5
 
6
6
  var _chunkWK4O3HH4js = require('../../chunk-WK4O3HH4.js');
@@ -25,7 +25,7 @@ var validUrl = (protocol) => (received, ctx) => {
25
25
  };
26
26
  validUrl.key = validUrlErrorKey;
27
27
  validUrl.message = validUrlErrorMessage;
28
- _chunk5BVJ6YMHjs.setToDefaultLocale.call(void 0, validUrl);
28
+ _chunkCQWI6YRIjs.setToDefaultLocale.call(void 0, validUrl);
29
29
 
30
30
 
31
31
  exports.validUrl = validUrl;
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  setToDefaultLocale
3
- } from "../../chunk-3HTYHE2X.mjs";
3
+ } from "../../chunk-QV4JDW3T.mjs";
4
4
  import {
5
5
  guardException
6
6
  } from "../../chunk-7XFLH6R2.mjs";
@@ -1,28 +1,28 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true}); var _class;
2
2
 
3
- var _chunkEGEHSELTjs = require('./chunk-EGEHSELT.js');
3
+ var _chunkEQNVYAKSjs = require('./chunk-EQNVYAKS.js');
4
4
 
5
5
 
6
- var _chunkIRG4OQABjs = require('./chunk-IRG4OQAB.js');
6
+ var _chunk7GIRQ5EAjs = require('./chunk-7GIRQ5EA.js');
7
7
 
8
8
 
9
9
  var _chunkWK4O3HH4js = require('./chunk-WK4O3HH4.js');
10
10
 
11
11
  // src/schemas/ArraySchema.ts
12
- var ArraySchema = (_class = class extends _chunkEGEHSELTjs.CommonSchema {
12
+ var ArraySchema = (_class = class extends _chunkEQNVYAKSjs.CommonSchema {
13
13
  __init() {this._array = 1}
14
14
  constructor(ctx, arraySchema) {
15
15
  super(ctx);_class.prototype.__init.call(this);;
16
16
  this.validateArrayEntry(arraySchema);
17
- this[_chunkIRG4OQABjs.ctxSymbol].array = arraySchema;
17
+ this[_chunk7GIRQ5EAjs.ctxSymbol].array = arraySchema;
18
18
  }
19
19
  validateArrayEntry(arraySchema) {
20
20
  if (!arraySchema) throw new (0, _chunkWK4O3HH4js.BuildSchemaError)("Missing schema in array method");
21
- if (!(arraySchema instanceof _chunkEGEHSELTjs.CommonSchema)) throw new (0, _chunkWK4O3HH4js.BuildSchemaError)("Invalid schema in array method");
21
+ if (!(arraySchema instanceof _chunkEQNVYAKSjs.CommonSchema)) throw new (0, _chunkWK4O3HH4js.BuildSchemaError)("Invalid schema in array method");
22
22
  }
23
23
  }, _class);
24
24
 
25
25
 
26
26
 
27
27
  exports.ArraySchema = ArraySchema;
28
- //# sourceMappingURL=chunk-RRQOET3X.js.map
28
+ //# sourceMappingURL=chunk-2OINKFOA.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["/home/runner/work/bguard/bguard/lib/chunk-RRQOET3X.js","../src/schemas/ArraySchema.ts"],"names":[],"mappings":"AAAA;AACE;AACF,sDAA4B;AAC5B;AACE;AACF,sDAA4B;AAC5B;AACE;AACF,sDAA4B;AAC5B;AACA;ACNO,IAAM,YAAA,YAAN,MAAA,QAA0B,8BAAa;AAAA,iBAC5C,OAAA,EAAS,EAAA;AAAA,EACT,WAAA,CAAY,GAAA,EAAuB,WAAA,EAA2B;AAC5D,IAAA,KAAA,CAAM,GAAG,qCAAA;AACT,IAAA,IAAA,CAAK,kBAAA,CAAmB,WAAW,CAAA;AACnC,IAAA,IAAA,CAAK,0BAAS,CAAA,CAAE,MAAA,EAAQ,WAAA;AAAA,EAC1B;AAAA,EAEQ,kBAAA,CAAmB,WAAA,EAA2B;AACpD,IAAA,GAAA,CAAI,CAAC,WAAA,EAAa,MAAM,IAAI,sCAAA,CAAiB,gCAAgC,CAAA;AAC7E,IAAA,GAAA,CAAI,CAAA,CAAE,YAAA,WAAuB,6BAAA,CAAA,EAAe,MAAM,IAAI,sCAAA,CAAiB,gCAAgC,CAAA;AAAA,EACzG;AACF,UAAA;ADOA;AACA;AACE;AACF,kCAAC","file":"/home/runner/work/bguard/bguard/lib/chunk-RRQOET3X.js","sourcesContent":[null,"import { ctxSymbol } from '../helpers/core';\nimport { BuildSchemaError } from '../exceptions';\nimport { CommonSchema, ValidatorContext } from './CommonSchema';\n\nexport class ArraySchema extends CommonSchema {\n _array = 1;\n constructor(ctx: ValidatorContext, arraySchema: CommonSchema) {\n super(ctx);\n this.validateArrayEntry(arraySchema);\n this[ctxSymbol].array = arraySchema;\n }\n\n private validateArrayEntry(arraySchema: CommonSchema) {\n if (!arraySchema) throw new BuildSchemaError('Missing schema in array method');\n if (!(arraySchema instanceof CommonSchema)) throw new BuildSchemaError('Invalid schema in array method');\n }\n}\n\nexport type WithArray<Y extends CommonSchema> = ArraySchema & { validation_array: Y };\nexport type ExtractFromArray<T> = T extends WithArray<infer X> ? X : never;\n"]}
1
+ {"version":3,"sources":["/home/runner/work/bguard/bguard/lib/chunk-2OINKFOA.js","../src/schemas/ArraySchema.ts"],"names":[],"mappings":"AAAA;AACE;AACF,sDAA4B;AAC5B;AACE;AACF,sDAA4B;AAC5B;AACE;AACF,sDAA4B;AAC5B;AACA;ACNO,IAAM,YAAA,YAAN,MAAA,QAA0B,8BAAa;AAAA,iBAC5C,OAAA,EAAS,EAAA;AAAA,EACT,WAAA,CAAY,GAAA,EAAuB,WAAA,EAA2B;AAC5D,IAAA,KAAA,CAAM,GAAG,qCAAA;AACT,IAAA,IAAA,CAAK,kBAAA,CAAmB,WAAW,CAAA;AACnC,IAAA,IAAA,CAAK,0BAAS,CAAA,CAAE,MAAA,EAAQ,WAAA;AAAA,EAC1B;AAAA,EAEQ,kBAAA,CAAmB,WAAA,EAA2B;AACpD,IAAA,GAAA,CAAI,CAAC,WAAA,EAAa,MAAM,IAAI,sCAAA,CAAiB,gCAAgC,CAAA;AAC7E,IAAA,GAAA,CAAI,CAAA,CAAE,YAAA,WAAuB,6BAAA,CAAA,EAAe,MAAM,IAAI,sCAAA,CAAiB,gCAAgC,CAAA;AAAA,EACzG;AACF,UAAA;ADOA;AACA;AACE;AACF,kCAAC","file":"/home/runner/work/bguard/bguard/lib/chunk-2OINKFOA.js","sourcesContent":[null,"import { ctxSymbol } from '../helpers/core';\nimport { BuildSchemaError } from '../exceptions';\nimport { CommonSchema, ValidatorContext } from './CommonSchema';\n\nexport class ArraySchema extends CommonSchema {\n _array = 1;\n constructor(ctx: ValidatorContext, arraySchema: CommonSchema) {\n super(ctx);\n this.validateArrayEntry(arraySchema);\n this[ctxSymbol].array = arraySchema;\n }\n\n private validateArrayEntry(arraySchema: CommonSchema) {\n if (!arraySchema) throw new BuildSchemaError('Missing schema in array method');\n if (!(arraySchema instanceof CommonSchema)) throw new BuildSchemaError('Invalid schema in array method');\n }\n}\n\nexport type WithArray<Y extends CommonSchema> = ArraySchema & { validation_array: Y };\nexport type ExtractFromArray<T> = T extends WithArray<infer X> ? X : never;\n"]}
@@ -1,24 +1,24 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true}); var _class;
2
2
 
3
- var _chunkJ4VKFJQKjs = require('./chunk-J4VKFJQK.js');
3
+ var _chunk4SPM2CSQjs = require('./chunk-4SPM2CSQ.js');
4
4
 
5
5
 
6
- var _chunk4CYIMDP2js = require('./chunk-4CYIMDP2.js');
6
+ var _chunkWPHJ4QTBjs = require('./chunk-WPHJ4QTB.js');
7
7
 
8
8
 
9
9
  var _chunk42J6CHIOjs = require('./chunk-42J6CHIO.js');
10
10
 
11
11
 
12
- var _chunkJSGZ7DKTjs = require('./chunk-JSGZ7DKT.js');
12
+ var _chunkLWAEUS2Fjs = require('./chunk-LWAEUS2F.js');
13
13
 
14
14
 
15
- var _chunkEGEHSELTjs = require('./chunk-EGEHSELT.js');
15
+ var _chunkEQNVYAKSjs = require('./chunk-EQNVYAKS.js');
16
16
 
17
17
 
18
18
  var _chunkWK4O3HH4js = require('./chunk-WK4O3HH4.js');
19
19
 
20
20
  // src/schemas/StringSchema.ts
21
- var StringSchema = (_class = class extends _chunkEGEHSELTjs.CommonSchema {constructor(...args) { super(...args); _class.prototype.__init.call(this); }
21
+ var StringSchema = (_class = class extends _chunkEQNVYAKSjs.CommonSchema {constructor(...args) { super(...args); _class.prototype.__init.call(this); }
22
22
  __init() {this._string = 1}
23
23
 
24
24
  /**
@@ -32,8 +32,8 @@ var StringSchema = (_class = class extends _chunkEGEHSELTjs.CommonSchema {constr
32
32
  equalTo(expectedValue) {
33
33
  if (this.limit) throw new (0, _chunkWK4O3HH4js.BuildSchemaError)(_chunk42J6CHIOjs.ONLY_ONCE);
34
34
  this.limit = true;
35
- _chunkJSGZ7DKTjs._setStrictType.call(void 0, this, `'${expectedValue}'`);
36
- return this.custom(_chunkJ4VKFJQKjs.equalTo.call(void 0, expectedValue));
35
+ _chunkLWAEUS2Fjs._setStrictType.call(void 0, this, `'${expectedValue}'`);
36
+ return this.custom(_chunkWPHJ4QTBjs.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,15 +47,15 @@ var StringSchema = (_class = class extends _chunkEGEHSELTjs.CommonSchema {constr
47
47
  oneOfValues(expectedValue) {
48
48
  if (this.limit) throw new (0, _chunkWK4O3HH4js.BuildSchemaError)(_chunk42J6CHIOjs.ONLY_ONCE);
49
49
  this.limit = true;
50
- _chunkJSGZ7DKTjs._setStrictType.call(void 0,
50
+ _chunkLWAEUS2Fjs._setStrictType.call(void 0,
51
51
  this,
52
52
  expectedValue.map((el) => `'${el}'`)
53
53
  );
54
- return this.custom(_chunk4CYIMDP2js.oneOfValues.call(void 0, expectedValue));
54
+ return this.custom(_chunk4SPM2CSQjs.oneOfValues.call(void 0, expectedValue));
55
55
  }
56
56
  }, _class);
57
57
 
58
58
 
59
59
 
60
60
  exports.StringSchema = StringSchema;
61
- //# sourceMappingURL=chunk-LEQCDD66.js.map
61
+ //# sourceMappingURL=chunk-32J4WVLE.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["/home/runner/work/bguard/bguard/lib/chunk-LEQCDD66.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;ACZO,IAAM,aAAA,YAAN,MAAA,QAA2B,8BAAa;AAAA,iBAC7C,QAAA,EAAU,EAAA;AAAA,EACF;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAUR,OAAA,CAA0B,aAAA,EAAuC;AAC/D,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,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,EAWA,WAAA,CAA8B,aAAA,EAAyC;AACrE,IAAA,GAAA,CAAI,IAAA,CAAK,KAAA,EAAO,MAAM,IAAI,sCAAA,CAAiB,0BAAS,CAAA;AACpD,IAAA,IAAA,CAAK,MAAA,EAAQ,IAAA;AACb,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;AACF,UAAA;ADWA;AACA;AACE;AACF,oCAAC","file":"/home/runner/work/bguard/bguard/lib/chunk-LEQCDD66.js","sourcesContent":[null,"import { equalTo } from '../asserts/mix/equalTo';\nimport { oneOfValues } from '../asserts/mix/oneOfValues';\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 _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 equalTo<Y extends string>(expectedValue: Y): WithString<this, Y> {\n if (this.limit) throw new BuildSchemaError(ONLY_ONCE);\n this.limit = true;\n _setStrictType(this, `'${expectedValue}'`);\n\n return this.custom(equalTo(expectedValue)) as WithString<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 oneOfValues<Y extends string>(expectedValue: Y[]): WithString<this, Y> {\n if (this.limit) throw new BuildSchemaError(ONLY_ONCE);\n this.limit = true;\n _setStrictType(\n this,\n expectedValue.map((el) => `'${el}'`),\n );\n return this.custom(oneOfValues(expectedValue)) as WithString<this, Y>;\n }\n}\n\nexport type WithString<T extends StringSchema, Y = string> = T & { validation_string: Y };\nexport type ExtractFromString<T> = T extends WithString<StringSchema, infer Y> ? Y : never;\n"]}
1
+ {"version":3,"sources":["/home/runner/work/bguard/bguard/lib/chunk-32J4WVLE.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;ACZO,IAAM,aAAA,YAAN,MAAA,QAA2B,8BAAa;AAAA,iBAC7C,QAAA,EAAU,EAAA;AAAA,EACF;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAUR,OAAA,CAA0B,aAAA,EAAuC;AAC/D,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,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,EAWA,WAAA,CAA8B,aAAA,EAAyC;AACrE,IAAA,GAAA,CAAI,IAAA,CAAK,KAAA,EAAO,MAAM,IAAI,sCAAA,CAAiB,0BAAS,CAAA;AACpD,IAAA,IAAA,CAAK,MAAA,EAAQ,IAAA;AACb,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;AACF,UAAA;ADWA;AACA;AACE;AACF,oCAAC","file":"/home/runner/work/bguard/bguard/lib/chunk-32J4WVLE.js","sourcesContent":[null,"import { equalTo } from '../asserts/mix/equalTo';\nimport { oneOfValues } from '../asserts/mix/oneOfValues';\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 _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 equalTo<Y extends string>(expectedValue: Y): WithString<this, Y> {\n if (this.limit) throw new BuildSchemaError(ONLY_ONCE);\n this.limit = true;\n _setStrictType(this, `'${expectedValue}'`);\n\n return this.custom(equalTo(expectedValue)) as WithString<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 oneOfValues<Y extends string>(expectedValue: Y[]): WithString<this, Y> {\n if (this.limit) throw new BuildSchemaError(ONLY_ONCE);\n this.limit = true;\n _setStrictType(\n this,\n expectedValue.map((el) => `'${el}'`),\n );\n return this.custom(oneOfValues(expectedValue)) as WithString<this, Y>;\n }\n}\n\nexport type WithString<T extends StringSchema, Y = string> = T & { validation_string: Y };\nexport type ExtractFromString<T> = T extends WithString<StringSchema, infer Y> ? Y : never;\n"]}
@@ -0,0 +1,12 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }// src/helpers/isValidDate.ts
2
+ function isValidDate(d) {
3
+ return (
4
+ // @ts-expect-error we expect d to have getTime method
5
+ Object.prototype.toString.call(d) === "[object Date]" && !isNaN(typeof _optionalChain([d, 'optionalAccess', _ => _.getTime]) === "function" && d.getTime())
6
+ );
7
+ }
8
+
9
+
10
+
11
+ exports.isValidDate = isValidDate;
12
+ //# sourceMappingURL=chunk-356HMXOP.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["/home/runner/work/bguard/bguard/lib/chunk-356HMXOP.js","../src/helpers/isValidDate.ts"],"names":[],"mappings":"AAAA;ACAO,SAAS,WAAA,CAAY,CAAA,EAAY;AACtC,EAAA,OAAA;AAAA;AAAA,IAEE,MAAA,CAAO,SAAA,CAAU,QAAA,CAAS,IAAA,CAAK,CAAC,EAAA,IAAM,gBAAA,GAAmB,CAAC,KAAA,CAAM,uBAAO,CAAA,2BAAG,UAAA,IAAY,WAAA,GAAc,CAAA,CAAE,OAAA,CAAQ,CAAC;AAAA,EAAA,CAAA;AAEnH;ADEA;AACA;AACE;AACF,kCAAC","file":"/home/runner/work/bguard/bguard/lib/chunk-356HMXOP.js","sourcesContent":[null,"export function isValidDate(d: unknown) {\n return (\n // @ts-expect-error we expect d to have getTime method\n Object.prototype.toString.call(d) === '[object Date]' && !isNaN(typeof d?.getTime === 'function' && d.getTime())\n );\n}\n"]}
@@ -1,6 +1,6 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
- var _chunk5BVJ6YMHjs = require('./chunk-5BVJ6YMH.js');
3
+ var _chunkCQWI6YRIjs = require('./chunk-CQWI6YRI.js');
4
4
 
5
5
 
6
6
  var _chunkWK4O3HH4js = require('./chunk-WK4O3HH4.js');
@@ -13,9 +13,9 @@ var oneOfValues = (expected) => (received, ctx) => {
13
13
  };
14
14
  oneOfValues.key = oneOfValuesErrorKey;
15
15
  oneOfValues.message = oneOfValuesErrorMessage;
16
- _chunk5BVJ6YMHjs.setToDefaultLocale.call(void 0, oneOfValues);
16
+ _chunkCQWI6YRIjs.setToDefaultLocale.call(void 0, oneOfValues);
17
17
 
18
18
 
19
19
 
20
20
  exports.oneOfValues = oneOfValues;
21
- //# sourceMappingURL=chunk-4CYIMDP2.js.map
21
+ //# sourceMappingURL=chunk-4SPM2CSQ.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["/home/runner/work/bguard/bguard/lib/chunk-4SPM2CSQ.js","../src/asserts/mix/oneOfValues.ts"],"names":[],"mappings":"AAAA;AACE;AACF,sDAA4B;AAC5B;AACE;AACF,sDAA4B;AAC5B;AACA;ACHA,IAAM,wBAAA,EAA0B,6CAAA;AAChC,IAAM,oBAAA,EAAsB,eAAA;AAgBrB,IAAM,YAAA,EACX,CAAC,QAAA,EAAA,GACD,CAAC,QAAA,EAAmB,GAAA,EAAA,GAA0B;AAC5C,EAAA,GAAA,CAAI,CAAC,QAAA,CAAS,QAAA,CAAS,QAAQ,CAAA,EAAG,6CAAA,QAAe,EAAU,QAAA,EAAU,GAAA,EAAK,mBAAmB,CAAA;AAC/F,CAAA;AAEF,WAAA,CAAY,IAAA,EAAM,mBAAA;AAClB,WAAA,CAAY,QAAA,EAAU,uBAAA;AACtB,iDAAA,WAA8B,CAAA;ADb9B;AACA;AACE;AACF,kCAAC","file":"/home/runner/work/bguard/bguard/lib/chunk-4SPM2CSQ.js","sourcesContent":[null,"import { guardException } from '../../exceptions';\nimport { ExceptionContext, RequiredValidation } from '../../commonTypes';\nimport { setToDefaultLocale } from '../../translationMap';\n\nconst oneOfValuesErrorMessage = 'The received value is not equal to expected';\nconst oneOfValuesErrorKey = 'm:oneOfValues';\n\n/**\n * @description Creates a custom assertion that checks if a value is equal to the one of expected values.\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 at least one of the expected values.\n * @example\n * const schema = number().custom(oneOfValues([5, 4])); // Define a schema with a custom assertion\n * parseOrFail(schema, 5); // Valid\n * parseOrFail(schema, 4); // Valid\n * parseOrFail(schema, 3); // Throws an error: 'The received value is not equal to expected'\n *\n * @translation Error Translation Key = 'm:oneOfValues'\n */\nexport const oneOfValues =\n (expected: unknown[]): RequiredValidation =>\n (received: unknown, ctx: ExceptionContext) => {\n if (!expected.includes(received)) guardException(expected, received, ctx, oneOfValuesErrorKey);\n };\n\noneOfValues.key = oneOfValuesErrorKey;\noneOfValues.message = oneOfValuesErrorMessage;\nsetToDefaultLocale(oneOfValues);\n"]}
@@ -1,9 +1,9 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true}); var _class;
2
2
 
3
- var _chunkJSGZ7DKTjs = require('./chunk-JSGZ7DKT.js');
3
+ var _chunkLWAEUS2Fjs = require('./chunk-LWAEUS2F.js');
4
4
 
5
5
 
6
- var _chunkEGEHSELTjs = require('./chunk-EGEHSELT.js');
6
+ var _chunkEQNVYAKSjs = require('./chunk-EQNVYAKS.js');
7
7
 
8
8
 
9
9
  var _chunkWK4O3HH4js = require('./chunk-WK4O3HH4.js');
@@ -12,7 +12,7 @@ var _chunkWK4O3HH4js = require('./chunk-WK4O3HH4.js');
12
12
  var isBoolean = (expected) => (received, ctx) => {
13
13
  if (received !== expected) _chunkWK4O3HH4js.guardException.call(void 0, expected, received, ctx, "c:isBoolean");
14
14
  };
15
- var BooleanSchema = (_class = class extends _chunkEGEHSELTjs.CommonSchema {constructor(...args) { super(...args); _class.prototype.__init.call(this); }
15
+ var BooleanSchema = (_class = class extends _chunkEQNVYAKSjs.CommonSchema {constructor(...args) { super(...args); _class.prototype.__init.call(this); }
16
16
  __init() {this._boolean = 1}
17
17
  /**
18
18
  * Restricts the schema to exactly match the boolean value true and infers the true value as the TypeScript type.
@@ -22,7 +22,7 @@ var BooleanSchema = (_class = class extends _chunkEGEHSELTjs.CommonSchema {const
22
22
  * @example - boolean().onlyTrue(); // Infers the type true
23
23
  */
24
24
  onlyTrue() {
25
- _chunkJSGZ7DKTjs._setStrictType.call(void 0, this, true);
25
+ _chunkLWAEUS2Fjs._setStrictType.call(void 0, this, true);
26
26
  return this.custom(isBoolean(true));
27
27
  }
28
28
  /**
@@ -33,7 +33,7 @@ var BooleanSchema = (_class = class extends _chunkEGEHSELTjs.CommonSchema {const
33
33
  * @example - boolean().onlyFalse(); // Infers the type false
34
34
  */
35
35
  onlyFalse() {
36
- _chunkJSGZ7DKTjs._setStrictType.call(void 0, this, false);
36
+ _chunkLWAEUS2Fjs._setStrictType.call(void 0, this, false);
37
37
  return this.custom(isBoolean(false));
38
38
  }
39
39
  }, _class);
@@ -41,4 +41,4 @@ var BooleanSchema = (_class = class extends _chunkEGEHSELTjs.CommonSchema {const
41
41
 
42
42
 
43
43
  exports.BooleanSchema = BooleanSchema;
44
- //# sourceMappingURL=chunk-WBERBAL4.js.map
44
+ //# sourceMappingURL=chunk-4SR7J2I4.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["/home/runner/work/bguard/bguard/lib/chunk-WBERBAL4.js","../src/schemas/BooleanSchema.ts"],"names":[],"mappings":"AAAA;AACE;AACF,sDAA4B;AAC5B;AACE;AACF,sDAA4B;AAC5B;AACE;AACF,sDAA4B;AAC5B;AACA;ACLA,IAAM,UAAA,EAAY,CAAC,QAAA,EAAA,GAAsB,CAAC,QAAA,EAAmB,GAAA,EAAA,GAA0B;AACrF,EAAA,GAAA,CAAI,SAAA,IAAa,QAAA,EAAU,6CAAA,QAAe,EAAU,QAAA,EAAU,GAAA,EAAK,aAAa,CAAA;AAClF,CAAA;AAEO,IAAM,cAAA,YAAN,MAAA,QAA4B,8BAAa;AAAA,iBAC9C,SAAA,EAAW,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASX,QAAA,CAAA,EAAoC;AAClC,IAAA,6CAAA,IAAe,EAAM,IAAI,CAAA;AACzB,IAAA,OAAO,IAAA,CAAK,MAAA,CAAO,SAAA,CAAU,IAAI,CAAC,CAAA;AAAA,EACpC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASA,SAAA,CAAA,EAAsC;AACpC,IAAA,6CAAA,IAAe,EAAM,KAAK,CAAA;AAC1B,IAAA,OAAO,IAAA,CAAK,MAAA,CAAO,SAAA,CAAU,KAAK,CAAC,CAAA;AAAA,EACrC;AACF,UAAA;ADIA;AACA;AACE;AACF,sCAAC","file":"/home/runner/work/bguard/bguard/lib/chunk-WBERBAL4.js","sourcesContent":[null,"import { CommonSchema } from './CommonSchema';\nimport { guardException } from '../exceptions';\nimport { ExceptionContext } from '../commonTypes';\nimport { _setStrictType } from '../helpers/setStrictType';\n\nconst isBoolean = (expected: boolean) => (received: boolean, ctx: ExceptionContext) => {\n if (received !== expected) guardException(expected, received, ctx, 'c:isBoolean');\n};\n\nexport class BooleanSchema extends CommonSchema {\n _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 onlyTrue(): WithBoolean<this, true> {\n _setStrictType(this, true);\n return this.custom(isBoolean(true)) as WithBoolean<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 onlyFalse(): WithBoolean<this, false> {\n _setStrictType(this, false);\n return this.custom(isBoolean(false)) as WithBoolean<this, false>;\n }\n}\n\nexport type WithBoolean<T extends BooleanSchema, Y = boolean> = T & { validation_boolean: Y };\nexport type ExtractFromBoolean<T> = T extends WithBoolean<BooleanSchema, infer Y> ? Y : never;\n"]}
1
+ {"version":3,"sources":["/home/runner/work/bguard/bguard/lib/chunk-4SR7J2I4.js","../src/schemas/BooleanSchema.ts"],"names":[],"mappings":"AAAA;AACE;AACF,sDAA4B;AAC5B;AACE;AACF,sDAA4B;AAC5B;AACE;AACF,sDAA4B;AAC5B;AACA;ACLA,IAAM,UAAA,EAAY,CAAC,QAAA,EAAA,GAAsB,CAAC,QAAA,EAAmB,GAAA,EAAA,GAA0B;AACrF,EAAA,GAAA,CAAI,SAAA,IAAa,QAAA,EAAU,6CAAA,QAAe,EAAU,QAAA,EAAU,GAAA,EAAK,aAAa,CAAA;AAClF,CAAA;AAEO,IAAM,cAAA,YAAN,MAAA,QAA4B,8BAAa;AAAA,iBAC9C,SAAA,EAAW,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASX,QAAA,CAAA,EAAoC;AAClC,IAAA,6CAAA,IAAe,EAAM,IAAI,CAAA;AACzB,IAAA,OAAO,IAAA,CAAK,MAAA,CAAO,SAAA,CAAU,IAAI,CAAC,CAAA;AAAA,EACpC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASA,SAAA,CAAA,EAAsC;AACpC,IAAA,6CAAA,IAAe,EAAM,KAAK,CAAA;AAC1B,IAAA,OAAO,IAAA,CAAK,MAAA,CAAO,SAAA,CAAU,KAAK,CAAC,CAAA;AAAA,EACrC;AACF,UAAA;ADIA;AACA;AACE;AACF,sCAAC","file":"/home/runner/work/bguard/bguard/lib/chunk-4SR7J2I4.js","sourcesContent":[null,"import { CommonSchema } from './CommonSchema';\nimport { guardException } from '../exceptions';\nimport { ExceptionContext } from '../commonTypes';\nimport { _setStrictType } from '../helpers/setStrictType';\n\nconst isBoolean = (expected: boolean) => (received: boolean, ctx: ExceptionContext) => {\n if (received !== expected) guardException(expected, received, ctx, 'c:isBoolean');\n};\n\nexport class BooleanSchema extends CommonSchema {\n _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 onlyTrue(): WithBoolean<this, true> {\n _setStrictType(this, true);\n return this.custom(isBoolean(true)) as WithBoolean<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 onlyFalse(): WithBoolean<this, false> {\n _setStrictType(this, false);\n return this.custom(isBoolean(false)) as WithBoolean<this, false>;\n }\n}\n\nexport type WithBoolean<T extends BooleanSchema, Y = boolean> = T & { validation_boolean: Y };\nexport type ExtractFromBoolean<T> = T extends WithBoolean<BooleanSchema, infer Y> ? Y : never;\n"]}
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  ctxSymbol
3
- } from "./chunk-PH2PMUZP.mjs";
3
+ } from "./chunk-XZTZC73V.mjs";
4
4
 
5
5
  // src/schemas/CommonSchema.ts
6
6
  var CommonSchema = class {
@@ -28,7 +28,7 @@ var CommonSchema = class {
28
28
  /**
29
29
  * Marks the schema as optional, allowing the value to be `undefined`.
30
30
  *
31
- * @returns {WithUndefined<this>}} The schema instance marked as optional.
31
+ * @returns {WithUndefined<this>} The schema instance marked as optional.
32
32
  */
33
33
  optional() {
34
34
  this[ctxSymbol].isOptional = true;
@@ -39,4 +39,4 @@ var CommonSchema = class {
39
39
  export {
40
40
  CommonSchema
41
41
  };
42
- //# sourceMappingURL=chunk-DPBE7TAQ.mjs.map
42
+ //# sourceMappingURL=chunk-4UF67IQ2.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/schemas/CommonSchema.ts"],"sourcesContent":["import { PrimitiveType, RequiredValidation } from '../commonTypes';\nimport { ctxSymbol } from '../helpers/core';\n\nexport type ObjectShapeSchemaType = Record<string, CommonSchema>;\n\nexport interface ValidatorContext {\n type: PrimitiveType[];\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}\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 custom(...validators: RequiredValidation[]): this {\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 nullable(): WithNull<this> {\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 optional(): WithUndefined<this> {\n this[ctxSymbol].isOptional = true;\n return this as WithUndefined<this>;\n }\n}\n\nexport type WithNull<T extends CommonSchema> = T & { validation_null: true };\nexport type WithUndefined<T extends CommonSchema> = T & { validation_undefined: true };\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 WithMix<Y = unknown> = CommonSchema & { validation_mix: Y };\nexport type ExtractFromMix<T> = T extends WithMix<infer X> ? X : never;\n\nexport type MapMixTypes<T extends PrimitiveType[]> = T extends (infer U)[]\n ? U extends keyof TypeMapping\n ? TypeMapping[U]\n : never\n : never;\n"],"mappings":";;;;;AAkBO,IAAM,eAAN,MAAmB;AAAA,EACxB,CAAC,SAAS;AAAA,EACV,YAAY,KAAuB;AACjC,SAAK,SAAS,IAAI;AAAA,EACpB;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,UAAU,YAAwC;AAChD,SAAK,SAAS,EAAE,oBAAoB,KAAK,GAAG,UAAU;AACtD,WAAO;AAAA,EACT;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,WAA2B;AACzB,SAAK,SAAS,EAAE,aAAa;AAC7B,WAAO;AAAA,EACT;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,WAAgC;AAC9B,SAAK,SAAS,EAAE,aAAa;AAC7B,WAAO;AAAA,EACT;AACF;","names":[]}
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  ctxSymbol
3
- } from "./chunk-PH2PMUZP.mjs";
3
+ } from "./chunk-XZTZC73V.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-RYVUYVEE.mjs.map
14
+ //# sourceMappingURL=chunk-54RHVQFA.mjs.map
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  innerCheck
3
- } from "./chunk-PH2PMUZP.mjs";
3
+ } from "./chunk-XZTZC73V.mjs";
4
4
  import {
5
5
  getTranslationByLocale
6
- } from "./chunk-3HTYHE2X.mjs";
6
+ } from "./chunk-QV4JDW3T.mjs";
7
7
  import {
8
8
  ValidationError
9
9
  } from "./chunk-7XFLH6R2.mjs";
@@ -44,4 +44,4 @@ function parse(schema, receivedValue, options) {
44
44
  export {
45
45
  parse
46
46
  };
47
- //# sourceMappingURL=chunk-YUESB2WV.mjs.map
47
+ //# sourceMappingURL=chunk-5AO66YV5.mjs.map
@@ -1,24 +1,24 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true}); var _class;
2
2
 
3
- var _chunkJ4VKFJQKjs = require('./chunk-J4VKFJQK.js');
3
+ var _chunk4SPM2CSQjs = require('./chunk-4SPM2CSQ.js');
4
4
 
5
5
 
6
- var _chunk4CYIMDP2js = require('./chunk-4CYIMDP2.js');
6
+ var _chunkWPHJ4QTBjs = require('./chunk-WPHJ4QTB.js');
7
7
 
8
8
 
9
9
  var _chunk42J6CHIOjs = require('./chunk-42J6CHIO.js');
10
10
 
11
11
 
12
- var _chunkJSGZ7DKTjs = require('./chunk-JSGZ7DKT.js');
12
+ var _chunkLWAEUS2Fjs = require('./chunk-LWAEUS2F.js');
13
13
 
14
14
 
15
- var _chunkEGEHSELTjs = require('./chunk-EGEHSELT.js');
15
+ var _chunkEQNVYAKSjs = require('./chunk-EQNVYAKS.js');
16
16
 
17
17
 
18
18
  var _chunkWK4O3HH4js = require('./chunk-WK4O3HH4.js');
19
19
 
20
20
  // src/schemas/NumberSchema.ts
21
- var NumberSchema = (_class = class extends _chunkEGEHSELTjs.CommonSchema {constructor(...args) { super(...args); _class.prototype.__init.call(this); }
21
+ var NumberSchema = (_class = class extends _chunkEQNVYAKSjs.CommonSchema {constructor(...args) { super(...args); _class.prototype.__init.call(this); }
22
22
  __init() {this._number = 1}
23
23
 
24
24
  /**
@@ -32,8 +32,8 @@ var NumberSchema = (_class = class extends _chunkEGEHSELTjs.CommonSchema {constr
32
32
  equalTo(expectedValue) {
33
33
  if (this.limit) throw new (0, _chunkWK4O3HH4js.BuildSchemaError)(_chunk42J6CHIOjs.ONLY_ONCE);
34
34
  this.limit = true;
35
- _chunkJSGZ7DKTjs._setStrictType.call(void 0, this, expectedValue);
36
- return this.custom(_chunkJ4VKFJQKjs.equalTo.call(void 0, expectedValue));
35
+ _chunkLWAEUS2Fjs._setStrictType.call(void 0, this, expectedValue);
36
+ return this.custom(_chunkWPHJ4QTBjs.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,12 +47,12 @@ var NumberSchema = (_class = class extends _chunkEGEHSELTjs.CommonSchema {constr
47
47
  oneOfValues(expectedValue) {
48
48
  if (this.limit) throw new (0, _chunkWK4O3HH4js.BuildSchemaError)(_chunk42J6CHIOjs.ONLY_ONCE);
49
49
  this.limit = true;
50
- _chunkJSGZ7DKTjs._setStrictType.call(void 0, this, expectedValue);
51
- return this.custom(_chunk4CYIMDP2js.oneOfValues.call(void 0, expectedValue));
50
+ _chunkLWAEUS2Fjs._setStrictType.call(void 0, this, expectedValue);
51
+ return this.custom(_chunk4SPM2CSQjs.oneOfValues.call(void 0, expectedValue));
52
52
  }
53
53
  }, _class);
54
54
 
55
55
 
56
56
 
57
57
  exports.NumberSchema = NumberSchema;
58
- //# sourceMappingURL=chunk-KQKJASVB.js.map
58
+ //# sourceMappingURL=chunk-5EIBKBYS.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["/home/runner/work/bguard/bguard/lib/chunk-KQKJASVB.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;ACZO,IAAM,aAAA,YAAN,MAAA,QAA2B,8BAAa;AAAA,iBAC7C,QAAA,EAAU,EAAA;AAAA,EACF;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAUR,OAAA,CAA0B,aAAA,EAAuC;AAC/D,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,EAWA,WAAA,CAA8B,aAAA,EAAyC;AACrE,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;ADYA;AACA;AACE;AACF,oCAAC","file":"/home/runner/work/bguard/bguard/lib/chunk-KQKJASVB.js","sourcesContent":[null,"import { equalTo } from '../asserts/mix/equalTo';\nimport { oneOfValues } from '../asserts/mix/oneOfValues';\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 _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 equalTo<Y extends number>(expectedValue: Y): WithNumber<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 WithNumber<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 oneOfValues<Y extends number>(expectedValue: Y[]): WithNumber<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 WithNumber<this, Y>;\n }\n}\n\nexport type WithNumber<T extends NumberSchema, Y = number> = T & { validation_number: Y };\nexport type ExtractFromNumber<T> = T extends WithNumber<NumberSchema, infer Y> ? Y : never;\n"]}
1
+ {"version":3,"sources":["/home/runner/work/bguard/bguard/lib/chunk-5EIBKBYS.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;ACZO,IAAM,aAAA,YAAN,MAAA,QAA2B,8BAAa;AAAA,iBAC7C,QAAA,EAAU,EAAA;AAAA,EACF;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAUR,OAAA,CAA0B,aAAA,EAAuC;AAC/D,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,EAWA,WAAA,CAA8B,aAAA,EAAyC;AACrE,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;ADYA;AACA;AACE;AACF,oCAAC","file":"/home/runner/work/bguard/bguard/lib/chunk-5EIBKBYS.js","sourcesContent":[null,"import { equalTo } from '../asserts/mix/equalTo';\nimport { oneOfValues } from '../asserts/mix/oneOfValues';\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 _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 equalTo<Y extends number>(expectedValue: Y): WithNumber<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 WithNumber<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 oneOfValues<Y extends number>(expectedValue: Y[]): WithNumber<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 WithNumber<this, Y>;\n }\n}\n\nexport type WithNumber<T extends NumberSchema, Y = number> = T & { validation_number: Y };\nexport type ExtractFromNumber<T> = T extends WithNumber<NumberSchema, infer Y> ? Y : never;\n"]}
@@ -1,5 +1,8 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
+ var _chunk356HMXOPjs = require('./chunk-356HMXOP.js');
4
+
5
+
3
6
  var _chunkWK4O3HH4js = require('./chunk-WK4O3HH4.js');
4
7
 
5
8
  // src/helpers/core.ts
@@ -15,6 +18,9 @@ function innerCheck(schema, receivedValue, exCtx) {
15
18
  if (!schemaData.isNullable) _chunkWK4O3HH4js.guardException.call(void 0, "Not null", receivedValue, exCtx, commonTmap["c:nullable"]);
16
19
  return receivedValue;
17
20
  }
21
+ if (schemaData.date) {
22
+ if (!_chunk356HMXOPjs.isValidDate.call(void 0, receivedValue)) _chunkWK4O3HH4js.guardException.call(void 0, "Date", receivedValue, exCtx, commonTmap["c:date"]);
23
+ }
18
24
  if (schemaData.array) {
19
25
  if (!Array.isArray(receivedValue)) return _chunkWK4O3HH4js.guardException.call(void 0, "Array", receivedValue, exCtx, commonTmap["c:array"]);
20
26
  const schema2 = schemaData.array;
@@ -60,4 +66,4 @@ function innerCheck(schema, receivedValue, exCtx) {
60
66
 
61
67
 
62
68
  exports.ctxSymbol = ctxSymbol; exports.innerCheck = innerCheck;
63
- //# sourceMappingURL=chunk-IRG4OQAB.js.map
69
+ //# sourceMappingURL=chunk-7GIRQ5EA.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["/home/runner/work/bguard/bguard/lib/chunk-7GIRQ5EA.js","../src/helpers/core.ts"],"names":["schema"],"mappings":"AAAA;AACE;AACF,sDAA4B;AAC5B;AACE;AACF,sDAA4B;AAC5B;AACA;ACPO,IAAM,UAAA,EAAY,MAAA,CAAO,eAAe,CAAA;AAOxC,SAAS,UAAA,CAAW,MAAA,EAAsB,aAAA,EAAwB,KAAA,EAAyB;AAChG,EAAA,MAAM,WAAA,EAAa,KAAA,CAAM,CAAA;AACzB,EAAA,MAAM,WAAA,EAAa,MAAA,CAAO,SAAS,CAAA;AACnC,EAAA,GAAA,CAAI,cAAA,IAAkB,KAAA,CAAA,EAAW;AAC/B,IAAA,GAAA,CAAI,CAAC,UAAA,CAAW,UAAA,EAAY,6CAAA,UAAe,EAAY,aAAA,EAAe,KAAA,EAAO,UAAA,CAAW,YAAY,CAAC,CAAA;AACrG,IAAA,OAAO,aAAA;AAAA,EACT;AAEA,EAAA,GAAA,CAAI,cAAA,IAAkB,IAAA,EAAM;AAC1B,IAAA,GAAA,CAAI,CAAC,UAAA,CAAW,UAAA,EAAY,6CAAA,UAAe,EAAY,aAAA,EAAe,KAAA,EAAO,UAAA,CAAW,YAAY,CAAC,CAAA;AACrG,IAAA,OAAO,aAAA;AAAA,EACT;AAEA,EAAA,GAAA,CAAI,UAAA,CAAW,IAAA,EAAM;AACnB,IAAA,GAAA,CAAI,CAAC,0CAAA,aAAyB,CAAA,EAAG,6CAAA,MAAe,EAAQ,aAAA,EAAe,KAAA,EAAO,UAAA,CAAW,QAAQ,CAAC,CAAA;AAAA,EACpG;AAEA,EAAA,GAAA,CAAI,UAAA,CAAW,KAAA,EAAO;AACpB,IAAA,GAAA,CAAI,CAAC,KAAA,CAAM,OAAA,CAAQ,aAAa,CAAA,EAAG,OAAO,6CAAA,OAAe,EAAS,aAAA,EAAe,KAAA,EAAO,UAAA,CAAW,SAAS,CAAC,CAAA;AAC7G,IAAA,MAAMA,QAAAA,EAAS,UAAA,CAAW,KAAA;AAC1B,IAAA,MAAM,YAAA,EAAc,KAAA,CAAM,WAAA;AAC1B,IAAA,aAAA,CAAc,OAAA,CAAQ,CAAC,IAAA,EAAM,CAAA,EAAA,GAAM;AACjC,MAAA,UAAA,CAAWA,OAAAA,EAAQ,IAAA,EAAM,EAAE,GAAG,KAAA,EAAO,WAAA,EAAa,CAAA,EAAA;AACnD,IAAA;AAEM,IAAA;AACT,EAAA;AAEyB,EAAA;AAEF,EAAA;AACgC,IAAA;AACJ,IAAA;AAClB,IAAA;AAEe,IAAA;AACE,MAAA;AACH,QAAA;AACC,UAAA;AAC5C,MAAA;AACF,IAAA;AAE0B,IAAA;AACwB,IAAA;AAC8B,MAAA;AAChC,MAAA;AACd,QAAA;AACD,UAAA;AAC/B,MAAA;AAE0B,MAAA;AAC5B,IAAA;AAEO,IAAA;AACT,EAAA;AAE4B,EAAA;AACa,IAAA;AACa,MAAA;AACtD,EAAA;AAEwC,EAAA;AACC,IAAA;AACxC,EAAA;AAEM,EAAA;AACT;ADV0D;AACA;AACA;AACA;AACA","file":"/home/runner/work/bguard/bguard/lib/chunk-7GIRQ5EA.js","sourcesContent":[null,"export const ctxSymbol = Symbol('contextSymbol');\n\nimport { ExceptionContext } from '../commonTypes';\nimport { guardException } from '../exceptions';\nimport type { CommonSchema } from '../schemas/CommonSchema';\nimport { isValidDate } from './isValidDate';\n\nexport function innerCheck(schema: CommonSchema, receivedValue: unknown, exCtx: ExceptionContext) {\n const commonTmap = exCtx.t;\n const schemaData = schema[ctxSymbol];\n if (receivedValue === undefined) {\n if (!schemaData.isOptional) guardException('Required', receivedValue, exCtx, commonTmap['c:optional']);\n return receivedValue;\n }\n\n if (receivedValue === null) {\n if (!schemaData.isNullable) guardException('Not null', receivedValue, exCtx, commonTmap['c:nullable']);\n return receivedValue;\n }\n\n if (schemaData.date) {\n if (!isValidDate(receivedValue)) guardException('Date', receivedValue, exCtx, commonTmap['c:date']);\n }\n\n if (schemaData.array) {\n if (!Array.isArray(receivedValue)) return guardException('Array', receivedValue, exCtx, commonTmap['c:array']);\n const schema = schemaData.array;\n const pathToError = exCtx.pathToError;\n receivedValue.forEach((elem, i) => {\n innerCheck(schema, elem, { ...exCtx, pathToError: `${pathToError}[${i}]` });\n });\n\n return receivedValue;\n }\n\n const typeOfVal = typeof receivedValue;\n\n if (schemaData.object) {\n if (typeOfVal !== 'object') guardException('Object', receivedValue, exCtx, commonTmap['c:objectType']);\n if (Array.isArray(receivedValue)) guardException('Object', receivedValue, exCtx, commonTmap['c:objectTypeAsArray']);\n const shapeSchema = schemaData.object;\n\n if (!schemaData.allowUnrecognizedObjectProps) {\n for (const keyPerReceivedValue of Object.keys(receivedValue)) {\n if (shapeSchema[keyPerReceivedValue] === undefined)\n guardException('Unrecognized property', keyPerReceivedValue, exCtx, commonTmap['c:unrecognizedProperty']);\n }\n }\n\n const pathToError = exCtx.pathToError;\n for (const [keyOfSchema, valueOfSchema] of Object.entries(shapeSchema)) {\n const receivedObjectValuePropery = (receivedValue as Record<string, unknown>)[keyOfSchema];\n if (receivedObjectValuePropery === undefined) {\n if (!valueOfSchema[ctxSymbol].isOptional)\n guardException('Required', receivedObjectValuePropery, exCtx, commonTmap['c:requiredProperty']);\n }\n\n innerCheck(valueOfSchema, receivedObjectValuePropery, { ...exCtx, pathToError: `${pathToError}.${keyOfSchema}` });\n }\n\n return receivedValue;\n }\n\n if (schemaData.type.length) {\n if (!schemaData.type.includes(typeOfVal))\n guardException(schemaData.type, typeOfVal, exCtx, commonTmap['c:invalidType']);\n }\n\n schemaData.requiredValidations.forEach((requiredValidation) => {\n requiredValidation(receivedValue, exCtx);\n });\n\n return receivedValue;\n}\n"]}
@@ -13,7 +13,8 @@ var defaultErrorMap = {
13
13
  "c:unrecognizedProperty": "This property is not allowed in the object",
14
14
  "c:requiredProperty": "Missing required property in the object",
15
15
  "c:invalidType": "Invalid type of data",
16
- "c:isBoolean": "The received value is not {{e}}"
16
+ "c:isBoolean": "The received value is not {{e}}",
17
+ "c:date": "The received value is not a valid instance of Date"
17
18
  //@@end
18
19
  };
19
20
  var data = {
@@ -51,4 +52,4 @@ function getTranslationByLocale(lng) {
51
52
 
52
53
 
53
54
  exports.setToDefaultLocale = setToDefaultLocale; exports.setLocale = setLocale; exports.clearLocales = clearLocales; exports.getTranslationByLocale = getTranslationByLocale;
54
- //# sourceMappingURL=chunk-5BVJ6YMH.js.map
55
+ //# sourceMappingURL=chunk-CQWI6YRI.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["/home/runner/work/bguard/bguard/lib/chunk-CQWI6YRI.js","../src/translationMap.ts"],"names":[],"mappings":"AAAA;AACE;AACF,sDAA4B;AAC5B;AACA;ACAA,IAAM,gBAAA,EAAuC;AAAA;AAAA,EAE3C,YAAA,EAAc,+BAAA;AAAA,EACd,YAAA,EAAc,0BAAA;AAAA,EACd,SAAA,EAAW,iDAAA;AAAA,EACX,cAAA,EAAgB,kDAAA;AAAA,EAChB,qBAAA,EAAuB,gEAAA;AAAA,EACvB,wBAAA,EAA0B,4CAAA;AAAA,EAC1B,oBAAA,EAAsB,yCAAA;AAAA,EACtB,eAAA,EAAiB,sBAAA;AAAA,EACjB,aAAA,EAAe,iCAAA;AAAA,EACf,QAAA,EAAU;AAAA;AAEZ,CAAA;AAEA,IAAI,KAAA,EAA+C;AAAA,EACjD,OAAA,EAAS,EAAE,GAAG,gBAAgB;AAChC,CAAA;AAEO,SAAS,kBAAA,CAAmB;AAAA,EACjC,GAAA;AAAA,EACA;AACF,CAAA,EAKG;AACD,EAAA,MAAM,cAAA,EAAgB,IAAA,CAAK,OAAA;AAC3B,EAAA,GAAA,CAAI,aAAA,CAAc,GAAG,CAAA,EAAG,MAAM,IAAI,sCAAA,CAAiB,+BAA+B,CAAA;AAClF,EAAA,aAAA,CAAc,GAAG,EAAA,EAAI,OAAA;AACvB;AAEO,SAAS,SAAA,CAAU,GAAA,EAAa,MAAA,EAAsC;AAC3E,EAAA,GAAA,CAAI,IAAA,IAAQ,SAAA,EAAW,MAAM,IAAI,sCAAA,CAAiB,kBAAkB,CAAA;AACpE,EAAA,GAAA,CAAI,CAAC,IAAA,CAAK,GAAG,CAAA,EAAG,IAAA,CAAK,GAAG,EAAA,EAAI,EAAE,GAAG,gBAAgB,CAAA;AACjD,EAAA,MAAM,OAAA,EAAS,IAAA,CAAK,GAAG,CAAA;AACvB,EAAA,MAAA,CAAO,OAAA,CAAQ,MAAM,CAAA,CAAE,OAAA,CAAQ,CAAC,CAAC,UAAA,EAAY,YAAY,CAAA,EAAA,GAAM;AAC7D,IAAA,MAAA,CAAO,UAAU,EAAA,EAAI,YAAA;AAAA,EACvB,CAAC,CAAA;AACH;AAEO,SAAS,YAAA,CAAA,EAAe;AAC7B,EAAA,KAAA,EAAO;AAAA,IACL,OAAA,EAAS,EAAE,GAAG,gBAAgB;AAAA,EAChC,CAAA;AACF;AAEO,SAAS,sBAAA,CAAuB,GAAA,EAAmC;AACxE,EAAA,GAAA,CAAI,CAAC,GAAA,EAAK,OAAO,IAAA,CAAK,SAAS,CAAA;AAC/B,EAAA,wBAAQ,IAAA,CAAK,GAAG,CAAA,UAAK,IAAA,CAAK,SAAS,GAAA;AACrC;ADRA;AACA;AACE;AACA;AACA;AACA;AACF,6KAAC","file":"/home/runner/work/bguard/bguard/lib/chunk-CQWI6YRI.js","sourcesContent":[null,"import { BuildSchemaError } from './exceptions';\nimport { RequiredValidation, TranslationErrorMap } from './commonTypes';\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"]}