bguard 0.4.1 → 0.6.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 (664) hide show
  1. package/README.md +91 -9
  2. package/lib/InferType.d.mts +1 -1
  3. package/lib/InferType.d.ts +1 -1
  4. package/lib/asserts/array/index.d.mts +7 -2
  5. package/lib/asserts/array/index.d.ts +7 -2
  6. package/lib/asserts/array/index.js +6 -12
  7. package/lib/asserts/array/index.js.map +1 -1
  8. package/lib/asserts/array/index.mjs +6 -12
  9. package/lib/asserts/array/index.mjs.map +1 -1
  10. package/lib/asserts/array/maxArrayLength.d.mts +4 -1
  11. package/lib/asserts/array/maxArrayLength.d.ts +4 -1
  12. package/lib/asserts/array/maxArrayLength.js +4 -15
  13. package/lib/asserts/array/maxArrayLength.js.map +1 -1
  14. package/lib/asserts/array/maxArrayLength.mjs +4 -15
  15. package/lib/asserts/array/maxArrayLength.mjs.map +1 -1
  16. package/lib/asserts/array/minArrayLength.d.mts +4 -1
  17. package/lib/asserts/array/minArrayLength.d.ts +4 -1
  18. package/lib/asserts/array/minArrayLength.js +4 -15
  19. package/lib/asserts/array/minArrayLength.js.map +1 -1
  20. package/lib/asserts/array/minArrayLength.mjs +4 -15
  21. package/lib/asserts/array/minArrayLength.mjs.map +1 -1
  22. package/lib/asserts/bigint/bigintMax.d.mts +4 -1
  23. package/lib/asserts/bigint/bigintMax.d.ts +4 -1
  24. package/lib/asserts/bigint/bigintMax.js +4 -15
  25. package/lib/asserts/bigint/bigintMax.js.map +1 -1
  26. package/lib/asserts/bigint/bigintMax.mjs +4 -15
  27. package/lib/asserts/bigint/bigintMax.mjs.map +1 -1
  28. package/lib/asserts/bigint/bigintMaxExcluded.d.mts +4 -1
  29. package/lib/asserts/bigint/bigintMaxExcluded.d.ts +4 -1
  30. package/lib/asserts/bigint/bigintMaxExcluded.js +4 -15
  31. package/lib/asserts/bigint/bigintMaxExcluded.js.map +1 -1
  32. package/lib/asserts/bigint/bigintMaxExcluded.mjs +4 -15
  33. package/lib/asserts/bigint/bigintMaxExcluded.mjs.map +1 -1
  34. package/lib/asserts/bigint/bigintMin.d.mts +4 -1
  35. package/lib/asserts/bigint/bigintMin.d.ts +4 -1
  36. package/lib/asserts/bigint/bigintMin.js +4 -15
  37. package/lib/asserts/bigint/bigintMin.js.map +1 -1
  38. package/lib/asserts/bigint/bigintMin.mjs +4 -15
  39. package/lib/asserts/bigint/bigintMin.mjs.map +1 -1
  40. package/lib/asserts/bigint/bigintMinExcluded.d.mts +4 -1
  41. package/lib/asserts/bigint/bigintMinExcluded.d.ts +4 -1
  42. package/lib/asserts/bigint/bigintMinExcluded.js +4 -15
  43. package/lib/asserts/bigint/bigintMinExcluded.js.map +1 -1
  44. package/lib/asserts/bigint/bigintMinExcluded.mjs +4 -15
  45. package/lib/asserts/bigint/bigintMinExcluded.mjs.map +1 -1
  46. package/lib/asserts/bigint/index.d.mts +30 -3
  47. package/lib/asserts/bigint/index.d.ts +30 -3
  48. package/lib/asserts/bigint/index.js +9 -16
  49. package/lib/asserts/bigint/index.js.map +1 -1
  50. package/lib/asserts/bigint/index.mjs +9 -16
  51. package/lib/asserts/bigint/index.mjs.map +1 -1
  52. package/lib/asserts/boolean/index.d.mts +25 -2
  53. package/lib/asserts/boolean/index.d.ts +25 -2
  54. package/lib/asserts/boolean/index.js +7 -13
  55. package/lib/asserts/boolean/index.js.map +1 -1
  56. package/lib/asserts/boolean/index.mjs +7 -13
  57. package/lib/asserts/boolean/index.mjs.map +1 -1
  58. package/lib/asserts/date/dateMax.d.mts +4 -1
  59. package/lib/asserts/date/dateMax.d.ts +4 -1
  60. package/lib/asserts/date/dateMax.js +5 -23
  61. package/lib/asserts/date/dateMax.js.map +1 -1
  62. package/lib/asserts/date/dateMax.mjs +5 -23
  63. package/lib/asserts/date/dateMax.mjs.map +1 -1
  64. package/lib/asserts/date/dateMin.d.mts +4 -1
  65. package/lib/asserts/date/dateMin.d.ts +4 -1
  66. package/lib/asserts/date/dateMin.js +5 -23
  67. package/lib/asserts/date/dateMin.js.map +1 -1
  68. package/lib/asserts/date/dateMin.mjs +5 -23
  69. package/lib/asserts/date/dateMin.mjs.map +1 -1
  70. package/lib/asserts/date/index.d.mts +6 -2
  71. package/lib/asserts/date/index.d.ts +6 -2
  72. package/lib/asserts/date/index.js +6 -12
  73. package/lib/asserts/date/index.js.map +1 -1
  74. package/lib/asserts/date/index.mjs +6 -12
  75. package/lib/asserts/date/index.mjs.map +1 -1
  76. package/lib/asserts/mix/equalTo.d.mts +4 -1
  77. package/lib/asserts/mix/equalTo.d.ts +4 -1
  78. package/lib/asserts/mix/equalTo.js +4 -4
  79. package/lib/asserts/mix/equalTo.mjs +3 -3
  80. package/lib/asserts/mix/index.d.mts +3 -3
  81. package/lib/asserts/mix/index.d.ts +3 -3
  82. package/lib/asserts/mix/index.js +6 -11
  83. package/lib/asserts/mix/index.js.map +1 -1
  84. package/lib/asserts/mix/index.mjs +6 -11
  85. package/lib/asserts/mix/index.mjs.map +1 -1
  86. package/lib/asserts/mix/oneOfValues.d.mts +4 -1
  87. package/lib/asserts/mix/oneOfValues.d.ts +4 -1
  88. package/lib/asserts/mix/oneOfValues.js +4 -4
  89. package/lib/asserts/mix/oneOfValues.mjs +3 -3
  90. package/lib/asserts/number/index.d.mts +28 -2
  91. package/lib/asserts/number/index.d.ts +28 -2
  92. package/lib/asserts/number/index.js +9 -16
  93. package/lib/asserts/number/index.js.map +1 -1
  94. package/lib/asserts/number/index.mjs +9 -16
  95. package/lib/asserts/number/index.mjs.map +1 -1
  96. package/lib/asserts/number/max.d.mts +4 -1
  97. package/lib/asserts/number/max.d.ts +4 -1
  98. package/lib/asserts/number/max.js +4 -15
  99. package/lib/asserts/number/max.js.map +1 -1
  100. package/lib/asserts/number/max.mjs +4 -15
  101. package/lib/asserts/number/max.mjs.map +1 -1
  102. package/lib/asserts/number/maxExcluded.d.mts +4 -1
  103. package/lib/asserts/number/maxExcluded.d.ts +4 -1
  104. package/lib/asserts/number/maxExcluded.js +4 -15
  105. package/lib/asserts/number/maxExcluded.js.map +1 -1
  106. package/lib/asserts/number/maxExcluded.mjs +4 -15
  107. package/lib/asserts/number/maxExcluded.mjs.map +1 -1
  108. package/lib/asserts/number/min.d.mts +4 -1
  109. package/lib/asserts/number/min.d.ts +4 -1
  110. package/lib/asserts/number/min.js +4 -15
  111. package/lib/asserts/number/min.js.map +1 -1
  112. package/lib/asserts/number/min.mjs +4 -15
  113. package/lib/asserts/number/min.mjs.map +1 -1
  114. package/lib/asserts/number/minExcluded.d.mts +4 -1
  115. package/lib/asserts/number/minExcluded.d.ts +4 -1
  116. package/lib/asserts/number/minExcluded.js +4 -15
  117. package/lib/asserts/number/minExcluded.js.map +1 -1
  118. package/lib/asserts/number/minExcluded.mjs +4 -15
  119. package/lib/asserts/number/minExcluded.mjs.map +1 -1
  120. package/lib/asserts/number/negative.d.mts +4 -1
  121. package/lib/asserts/number/negative.d.ts +4 -1
  122. package/lib/asserts/number/negative.js +4 -15
  123. package/lib/asserts/number/negative.js.map +1 -1
  124. package/lib/asserts/number/negative.mjs +4 -15
  125. package/lib/asserts/number/negative.mjs.map +1 -1
  126. package/lib/asserts/number/positive.d.mts +4 -1
  127. package/lib/asserts/number/positive.d.ts +4 -1
  128. package/lib/asserts/number/positive.js +4 -15
  129. package/lib/asserts/number/positive.js.map +1 -1
  130. package/lib/asserts/number/positive.mjs +4 -15
  131. package/lib/asserts/number/positive.mjs.map +1 -1
  132. package/lib/asserts/object/index.d.mts +26 -2
  133. package/lib/asserts/object/index.d.ts +26 -2
  134. package/lib/asserts/object/index.js +6 -12
  135. package/lib/asserts/object/index.js.map +1 -1
  136. package/lib/asserts/object/index.mjs +6 -12
  137. package/lib/asserts/object/index.mjs.map +1 -1
  138. package/lib/asserts/object/maxKeys.d.mts +4 -1
  139. package/lib/asserts/object/maxKeys.d.ts +4 -1
  140. package/lib/asserts/object/maxKeys.js +4 -18
  141. package/lib/asserts/object/maxKeys.js.map +1 -1
  142. package/lib/asserts/object/maxKeys.mjs +4 -18
  143. package/lib/asserts/object/maxKeys.mjs.map +1 -1
  144. package/lib/asserts/string/atLeastOneDigit.d.mts +4 -1
  145. package/lib/asserts/string/atLeastOneDigit.d.ts +4 -1
  146. package/lib/asserts/string/atLeastOneDigit.js +4 -16
  147. package/lib/asserts/string/atLeastOneDigit.js.map +1 -1
  148. package/lib/asserts/string/atLeastOneDigit.mjs +4 -16
  149. package/lib/asserts/string/atLeastOneDigit.mjs.map +1 -1
  150. package/lib/asserts/string/atLeastOneLowerChar.d.mts +4 -1
  151. package/lib/asserts/string/atLeastOneLowerChar.d.ts +4 -1
  152. package/lib/asserts/string/atLeastOneLowerChar.js +4 -17
  153. package/lib/asserts/string/atLeastOneLowerChar.js.map +1 -1
  154. package/lib/asserts/string/atLeastOneLowerChar.mjs +4 -17
  155. package/lib/asserts/string/atLeastOneLowerChar.mjs.map +1 -1
  156. package/lib/asserts/string/atLeastOneSpecialChar.d.mts +5 -2
  157. package/lib/asserts/string/atLeastOneSpecialChar.d.ts +5 -2
  158. package/lib/asserts/string/atLeastOneSpecialChar.js +5 -22
  159. package/lib/asserts/string/atLeastOneSpecialChar.js.map +1 -1
  160. package/lib/asserts/string/atLeastOneSpecialChar.mjs +4 -21
  161. package/lib/asserts/string/atLeastOneSpecialChar.mjs.map +1 -1
  162. package/lib/asserts/string/atLeastOneUpperChar.d.mts +4 -1
  163. package/lib/asserts/string/atLeastOneUpperChar.d.ts +4 -1
  164. package/lib/asserts/string/atLeastOneUpperChar.js +4 -17
  165. package/lib/asserts/string/atLeastOneUpperChar.js.map +1 -1
  166. package/lib/asserts/string/atLeastOneUpperChar.mjs +4 -17
  167. package/lib/asserts/string/atLeastOneUpperChar.mjs.map +1 -1
  168. package/lib/asserts/string/contains.d.mts +4 -1
  169. package/lib/asserts/string/contains.d.ts +4 -1
  170. package/lib/asserts/string/contains.js +4 -17
  171. package/lib/asserts/string/contains.js.map +1 -1
  172. package/lib/asserts/string/contains.mjs +4 -17
  173. package/lib/asserts/string/contains.mjs.map +1 -1
  174. package/lib/asserts/string/email.d.mts +4 -1
  175. package/lib/asserts/string/email.d.ts +4 -1
  176. package/lib/asserts/string/email.js +4 -16
  177. package/lib/asserts/string/email.js.map +1 -1
  178. package/lib/asserts/string/email.mjs +4 -16
  179. package/lib/asserts/string/email.mjs.map +1 -1
  180. package/lib/asserts/string/endsWith.d.mts +4 -1
  181. package/lib/asserts/string/endsWith.d.ts +4 -1
  182. package/lib/asserts/string/endsWith.js +4 -17
  183. package/lib/asserts/string/endsWith.js.map +1 -1
  184. package/lib/asserts/string/endsWith.mjs +4 -17
  185. package/lib/asserts/string/endsWith.mjs.map +1 -1
  186. package/lib/asserts/string/index.d.mts +29 -2
  187. package/lib/asserts/string/index.d.ts +29 -2
  188. package/lib/asserts/string/index.js +9 -16
  189. package/lib/asserts/string/index.js.map +1 -1
  190. package/lib/asserts/string/index.mjs +9 -16
  191. package/lib/asserts/string/index.mjs.map +1 -1
  192. package/lib/asserts/string/isValidDate.d.mts +4 -1
  193. package/lib/asserts/string/isValidDate.d.ts +4 -1
  194. package/lib/asserts/string/isValidDate.js +4 -20
  195. package/lib/asserts/string/isValidDate.js.map +1 -1
  196. package/lib/asserts/string/isValidDate.mjs +4 -20
  197. package/lib/asserts/string/isValidDate.mjs.map +1 -1
  198. package/lib/asserts/string/isValidDateTime.d.mts +4 -1
  199. package/lib/asserts/string/isValidDateTime.d.ts +4 -1
  200. package/lib/asserts/string/isValidDateTime.js +4 -27
  201. package/lib/asserts/string/isValidDateTime.js.map +1 -1
  202. package/lib/asserts/string/isValidDateTime.mjs +4 -27
  203. package/lib/asserts/string/isValidDateTime.mjs.map +1 -1
  204. package/lib/asserts/string/isValidTime.d.mts +4 -1
  205. package/lib/asserts/string/isValidTime.d.ts +4 -1
  206. package/lib/asserts/string/isValidTime.js +4 -27
  207. package/lib/asserts/string/isValidTime.js.map +1 -1
  208. package/lib/asserts/string/isValidTime.mjs +4 -27
  209. package/lib/asserts/string/isValidTime.mjs.map +1 -1
  210. package/lib/asserts/string/lowerCase.d.mts +4 -1
  211. package/lib/asserts/string/lowerCase.d.ts +4 -1
  212. package/lib/asserts/string/lowerCase.js +4 -15
  213. package/lib/asserts/string/lowerCase.js.map +1 -1
  214. package/lib/asserts/string/lowerCase.mjs +4 -15
  215. package/lib/asserts/string/lowerCase.mjs.map +1 -1
  216. package/lib/asserts/string/maxLength.d.mts +4 -1
  217. package/lib/asserts/string/maxLength.d.ts +4 -1
  218. package/lib/asserts/string/maxLength.js +4 -15
  219. package/lib/asserts/string/maxLength.js.map +1 -1
  220. package/lib/asserts/string/maxLength.mjs +4 -15
  221. package/lib/asserts/string/maxLength.mjs.map +1 -1
  222. package/lib/asserts/string/minLength.d.mts +4 -1
  223. package/lib/asserts/string/minLength.d.ts +4 -1
  224. package/lib/asserts/string/minLength.js +4 -15
  225. package/lib/asserts/string/minLength.js.map +1 -1
  226. package/lib/asserts/string/minLength.mjs +4 -15
  227. package/lib/asserts/string/minLength.mjs.map +1 -1
  228. package/lib/asserts/string/regExp.d.mts +4 -1
  229. package/lib/asserts/string/regExp.d.ts +4 -1
  230. package/lib/asserts/string/regExp.js +4 -15
  231. package/lib/asserts/string/regExp.js.map +1 -1
  232. package/lib/asserts/string/regExp.mjs +4 -15
  233. package/lib/asserts/string/regExp.mjs.map +1 -1
  234. package/lib/asserts/string/startsWith.d.mts +4 -1
  235. package/lib/asserts/string/startsWith.d.ts +4 -1
  236. package/lib/asserts/string/startsWith.js +4 -17
  237. package/lib/asserts/string/startsWith.js.map +1 -1
  238. package/lib/asserts/string/startsWith.mjs +4 -17
  239. package/lib/asserts/string/startsWith.mjs.map +1 -1
  240. package/lib/asserts/string/upperCase.d.mts +4 -1
  241. package/lib/asserts/string/upperCase.d.ts +4 -1
  242. package/lib/asserts/string/upperCase.js +4 -17
  243. package/lib/asserts/string/upperCase.js.map +1 -1
  244. package/lib/asserts/string/upperCase.mjs +4 -17
  245. package/lib/asserts/string/upperCase.mjs.map +1 -1
  246. package/lib/asserts/string/uuid.d.mts +4 -1
  247. package/lib/asserts/string/uuid.d.ts +4 -1
  248. package/lib/asserts/string/uuid.js +4 -18
  249. package/lib/asserts/string/uuid.js.map +1 -1
  250. package/lib/asserts/string/uuid.mjs +4 -18
  251. package/lib/asserts/string/uuid.mjs.map +1 -1
  252. package/lib/asserts/string/uuidV1.d.mts +4 -1
  253. package/lib/asserts/string/uuidV1.d.ts +4 -1
  254. package/lib/asserts/string/uuidV1.js +4 -18
  255. package/lib/asserts/string/uuidV1.js.map +1 -1
  256. package/lib/asserts/string/uuidV1.mjs +4 -18
  257. package/lib/asserts/string/uuidV1.mjs.map +1 -1
  258. package/lib/asserts/string/uuidV2.d.mts +4 -1
  259. package/lib/asserts/string/uuidV2.d.ts +4 -1
  260. package/lib/asserts/string/uuidV2.js +4 -18
  261. package/lib/asserts/string/uuidV2.js.map +1 -1
  262. package/lib/asserts/string/uuidV2.mjs +4 -18
  263. package/lib/asserts/string/uuidV2.mjs.map +1 -1
  264. package/lib/asserts/string/uuidV3.d.mts +4 -1
  265. package/lib/asserts/string/uuidV3.d.ts +4 -1
  266. package/lib/asserts/string/uuidV3.js +4 -18
  267. package/lib/asserts/string/uuidV3.js.map +1 -1
  268. package/lib/asserts/string/uuidV3.mjs +4 -18
  269. package/lib/asserts/string/uuidV3.mjs.map +1 -1
  270. package/lib/asserts/string/uuidV4.d.mts +4 -1
  271. package/lib/asserts/string/uuidV4.d.ts +4 -1
  272. package/lib/asserts/string/uuidV4.js +4 -18
  273. package/lib/asserts/string/uuidV4.js.map +1 -1
  274. package/lib/asserts/string/uuidV4.mjs +4 -18
  275. package/lib/asserts/string/uuidV4.mjs.map +1 -1
  276. package/lib/asserts/string/uuidV5.d.mts +4 -1
  277. package/lib/asserts/string/uuidV5.d.ts +4 -1
  278. package/lib/asserts/string/uuidV5.js +4 -18
  279. package/lib/asserts/string/uuidV5.js.map +1 -1
  280. package/lib/asserts/string/uuidV5.mjs +4 -18
  281. package/lib/asserts/string/uuidV5.mjs.map +1 -1
  282. package/lib/asserts/string/validUrl.d.mts +4 -1
  283. package/lib/asserts/string/validUrl.d.ts +4 -1
  284. package/lib/asserts/string/validUrl.js +4 -27
  285. package/lib/asserts/string/validUrl.js.map +1 -1
  286. package/lib/asserts/string/validUrl.mjs +4 -27
  287. package/lib/asserts/string/validUrl.mjs.map +1 -1
  288. package/lib/chunk-22254THF.mjs +21 -0
  289. package/lib/chunk-22254THF.mjs.map +1 -0
  290. package/lib/chunk-22VHHJSS.js +28 -0
  291. package/lib/chunk-22VHHJSS.js.map +1 -0
  292. package/lib/chunk-23QTSXPQ.js +18 -0
  293. package/lib/chunk-23QTSXPQ.js.map +1 -0
  294. package/lib/chunk-24LO7MNY.js +18 -0
  295. package/lib/chunk-24LO7MNY.js.map +1 -0
  296. package/lib/{chunk-ASZW6XRM.mjs → chunk-2ANPCB4O.mjs} +4 -2
  297. package/lib/{chunk-ASZW6XRM.mjs.map → chunk-2ANPCB4O.mjs.map} +1 -1
  298. package/lib/chunk-2D3HCTJV.js +18 -0
  299. package/lib/chunk-2D3HCTJV.js.map +1 -0
  300. package/lib/chunk-2ESDKTV4.js +18 -0
  301. package/lib/chunk-2ESDKTV4.js.map +1 -0
  302. package/lib/chunk-2HGS4STD.js +48 -0
  303. package/lib/chunk-2HGS4STD.js.map +1 -0
  304. package/lib/chunk-2IPGGARK.mjs +21 -0
  305. package/lib/chunk-2IPGGARK.mjs.map +1 -0
  306. package/lib/chunk-3W2COCXV.js +18 -0
  307. package/lib/chunk-3W2COCXV.js.map +1 -0
  308. package/lib/chunk-4N5J426R.mjs +20 -0
  309. package/lib/chunk-4N5J426R.mjs.map +1 -0
  310. package/lib/chunk-4UPXP4I3.js +25 -0
  311. package/lib/chunk-4UPXP4I3.js.map +1 -0
  312. package/lib/{chunk-C3EDEQ3W.mjs → chunk-4ZKU4RJL.mjs} +3 -6
  313. package/lib/chunk-4ZKU4RJL.mjs.map +1 -0
  314. package/lib/chunk-5NYVRFG3.mjs +48 -0
  315. package/lib/chunk-5NYVRFG3.mjs.map +1 -0
  316. package/lib/chunk-62EKGBXF.js +21 -0
  317. package/lib/chunk-62EKGBXF.js.map +1 -0
  318. package/lib/chunk-6JPYR2TS.js +23 -0
  319. package/lib/chunk-6JPYR2TS.js.map +1 -0
  320. package/lib/chunk-6LPQRAFN.js +30 -0
  321. package/lib/chunk-6LPQRAFN.js.map +1 -0
  322. package/lib/{chunk-LPR3G5T3.mjs → chunk-6WKSLMJG.mjs} +11 -8
  323. package/lib/chunk-6WKSLMJG.mjs.map +1 -0
  324. package/lib/chunk-7JL66G7G.mjs +20 -0
  325. package/lib/chunk-7JL66G7G.mjs.map +1 -0
  326. package/lib/chunk-AJHBPMZT.mjs +19 -0
  327. package/lib/chunk-AJHBPMZT.mjs.map +1 -0
  328. package/lib/chunk-AQCV7PB4.mjs +28 -0
  329. package/lib/chunk-AQCV7PB4.mjs.map +1 -0
  330. package/lib/chunk-ARIYSQMH.js +20 -0
  331. package/lib/chunk-ARIYSQMH.js.map +1 -0
  332. package/lib/{chunk-42J6CHIO.js → chunk-AXKX5BGH.js} +4 -2
  333. package/lib/chunk-AXKX5BGH.js.map +1 -0
  334. package/lib/chunk-BRFUFNU4.js +18 -0
  335. package/lib/chunk-BRFUFNU4.js.map +1 -0
  336. package/lib/chunk-C2VSTWID.js +18 -0
  337. package/lib/chunk-C2VSTWID.js.map +1 -0
  338. package/lib/chunk-C44KAKMR.js +21 -0
  339. package/lib/chunk-C44KAKMR.js.map +1 -0
  340. package/lib/chunk-D6G32F2K.js +69 -0
  341. package/lib/chunk-D6G32F2K.js.map +1 -0
  342. package/lib/chunk-DCPRPCZ3.js +20 -0
  343. package/lib/chunk-DCPRPCZ3.js.map +1 -0
  344. package/lib/{chunk-U4USIJV3.js → chunk-DED5KDLM.js} +20 -16
  345. package/lib/chunk-DED5KDLM.js.map +1 -0
  346. package/lib/chunk-DFYP4GKE.js +21 -0
  347. package/lib/chunk-DFYP4GKE.js.map +1 -0
  348. package/lib/chunk-ENZ5WDUQ.js +18 -0
  349. package/lib/chunk-ENZ5WDUQ.js.map +1 -0
  350. package/lib/chunk-FI737YZJ.js +19 -0
  351. package/lib/chunk-FI737YZJ.js.map +1 -0
  352. package/lib/chunk-FIDPCCCW.js +24 -0
  353. package/lib/chunk-FIDPCCCW.js.map +1 -0
  354. package/lib/chunk-GFWZQ4XW.mjs +30 -0
  355. package/lib/chunk-GFWZQ4XW.mjs.map +1 -0
  356. package/lib/chunk-GGWJJFXY.mjs +20 -0
  357. package/lib/chunk-GGWJJFXY.mjs.map +1 -0
  358. package/lib/chunk-H2M4FCRZ.mjs +21 -0
  359. package/lib/chunk-H2M4FCRZ.mjs.map +1 -0
  360. package/lib/chunk-H4OW6OUF.js +21 -0
  361. package/lib/chunk-H4OW6OUF.js.map +1 -0
  362. package/lib/chunk-HD37VXPZ.mjs +19 -0
  363. package/lib/chunk-HD37VXPZ.mjs.map +1 -0
  364. package/lib/chunk-HPIF2CMT.js +18 -0
  365. package/lib/chunk-HPIF2CMT.js.map +1 -0
  366. package/lib/chunk-HUWO5UKU.js +64 -0
  367. package/lib/chunk-HUWO5UKU.js.map +1 -0
  368. package/lib/chunk-HWVM4SYU.mjs +18 -0
  369. package/lib/chunk-HWVM4SYU.mjs.map +1 -0
  370. package/lib/chunk-IDDU6B6T.js +20 -0
  371. package/lib/chunk-IDDU6B6T.js.map +1 -0
  372. package/lib/chunk-KRCOKWAB.mjs +18 -0
  373. package/lib/chunk-KRCOKWAB.mjs.map +1 -0
  374. package/lib/chunk-LXZTBF7F.js +18 -0
  375. package/lib/chunk-LXZTBF7F.js.map +1 -0
  376. package/lib/chunk-M2GOQ7TZ.mjs +21 -0
  377. package/lib/chunk-M2GOQ7TZ.mjs.map +1 -0
  378. package/lib/{chunk-YUMUCQKL.mjs → chunk-M3HYPZLE.mjs} +15 -11
  379. package/lib/chunk-M3HYPZLE.mjs.map +1 -0
  380. package/lib/chunk-MCQHWS3E.mjs +18 -0
  381. package/lib/chunk-MCQHWS3E.mjs.map +1 -0
  382. package/lib/chunk-MHWPSQB3.js +20 -0
  383. package/lib/chunk-MHWPSQB3.js.map +1 -0
  384. package/lib/chunk-N3EHGKZV.mjs +25 -0
  385. package/lib/chunk-N3EHGKZV.mjs.map +1 -0
  386. package/lib/chunk-NBR3QGKW.js +23 -0
  387. package/lib/chunk-NBR3QGKW.js.map +1 -0
  388. package/lib/chunk-NFD7D5GZ.mjs +71 -0
  389. package/lib/chunk-NFD7D5GZ.mjs.map +1 -0
  390. package/lib/chunk-NOJB5GBZ.mjs +18 -0
  391. package/lib/chunk-NOJB5GBZ.mjs.map +1 -0
  392. package/lib/chunk-NS4GXUCA.mjs +18 -0
  393. package/lib/chunk-NS4GXUCA.mjs.map +1 -0
  394. package/lib/chunk-NY2TPU6O.mjs +18 -0
  395. package/lib/chunk-NY2TPU6O.mjs.map +1 -0
  396. package/lib/{chunk-H32B3NHW.mjs → chunk-OE3L7EKN.mjs} +3 -3
  397. package/lib/chunk-OE3L7EKN.mjs.map +1 -0
  398. package/lib/chunk-OFZMO7PB.mjs +18 -0
  399. package/lib/chunk-OFZMO7PB.mjs.map +1 -0
  400. package/lib/chunk-OHUOBIHX.mjs +52 -0
  401. package/lib/chunk-OHUOBIHX.mjs.map +1 -0
  402. package/lib/chunk-OMSHZITC.js +20 -0
  403. package/lib/chunk-OMSHZITC.js.map +1 -0
  404. package/lib/chunk-OQYS7JVF.js +28 -0
  405. package/lib/chunk-OQYS7JVF.js.map +1 -0
  406. package/lib/chunk-OSFIPFQ3.mjs +28 -0
  407. package/lib/chunk-OSFIPFQ3.mjs.map +1 -0
  408. package/lib/chunk-OU5BTUDV.mjs +23 -0
  409. package/lib/chunk-OU5BTUDV.mjs.map +1 -0
  410. package/lib/chunk-OZ3BTSSQ.mjs +64 -0
  411. package/lib/chunk-OZ3BTSSQ.mjs.map +1 -0
  412. package/lib/{chunk-IZ3CBVEE.js → chunk-PAV4SQQL.js} +4 -7
  413. package/lib/chunk-PAV4SQQL.js.map +1 -0
  414. package/lib/chunk-PNSDUVRE.mjs +21 -0
  415. package/lib/chunk-PNSDUVRE.mjs.map +1 -0
  416. package/lib/chunk-PVQALO2H.js +23 -0
  417. package/lib/chunk-PVQALO2H.js.map +1 -0
  418. package/lib/chunk-QEG24G7E.mjs +18 -0
  419. package/lib/chunk-QEG24G7E.mjs.map +1 -0
  420. package/lib/chunk-QIFA6S5U.mjs +18 -0
  421. package/lib/chunk-QIFA6S5U.mjs.map +1 -0
  422. package/lib/chunk-QIPGUTIG.mjs +302 -0
  423. package/lib/chunk-QIPGUTIG.mjs.map +1 -0
  424. package/lib/chunk-QMIH3A4D.js +18 -0
  425. package/lib/chunk-QMIH3A4D.js.map +1 -0
  426. package/lib/chunk-R25HSJPH.js +21 -0
  427. package/lib/chunk-R25HSJPH.js.map +1 -0
  428. package/lib/chunk-S4FWDTEW.mjs +20 -0
  429. package/lib/chunk-S4FWDTEW.mjs.map +1 -0
  430. package/lib/chunk-S5D5AFDF.js +18 -0
  431. package/lib/chunk-S5D5AFDF.js.map +1 -0
  432. package/lib/chunk-SBO6OQIX.mjs +23 -0
  433. package/lib/chunk-SBO6OQIX.mjs.map +1 -0
  434. package/lib/chunk-SFIX77W5.js +21 -0
  435. package/lib/chunk-SFIX77W5.js.map +1 -0
  436. package/lib/chunk-T2A3XXQZ.mjs +18 -0
  437. package/lib/chunk-T2A3XXQZ.mjs.map +1 -0
  438. package/lib/chunk-TCDQA2NU.js +31 -0
  439. package/lib/chunk-TCDQA2NU.js.map +1 -0
  440. package/lib/{chunk-H6LHV3EA.mjs → chunk-THU5VBSO.mjs} +2 -2
  441. package/lib/chunk-THU5VBSO.mjs.map +1 -0
  442. package/lib/{chunk-5YYRBKDP.js → chunk-TJQ5NVL4.js} +5 -5
  443. package/lib/chunk-TJQ5NVL4.js.map +1 -0
  444. package/lib/{chunk-HP3DRZWK.js → chunk-TLPVFRWR.js} +4 -7
  445. package/lib/chunk-TLPVFRWR.js.map +1 -0
  446. package/lib/chunk-TLRVQWCI.mjs +30 -0
  447. package/lib/chunk-TLRVQWCI.mjs.map +1 -0
  448. package/lib/chunk-TQDMUHTA.mjs +20 -0
  449. package/lib/chunk-TQDMUHTA.mjs.map +1 -0
  450. package/lib/chunk-TZBAW5OO.mjs +21 -0
  451. package/lib/chunk-TZBAW5OO.mjs.map +1 -0
  452. package/lib/chunk-UHMICS34.mjs +18 -0
  453. package/lib/chunk-UHMICS34.mjs.map +1 -0
  454. package/lib/chunk-UYQFYQQG.mjs +69 -0
  455. package/lib/chunk-UYQFYQQG.mjs.map +1 -0
  456. package/lib/chunk-V2J4TQR5.mjs +20 -0
  457. package/lib/chunk-V2J4TQR5.mjs.map +1 -0
  458. package/lib/chunk-V7C77FML.mjs +18 -0
  459. package/lib/chunk-V7C77FML.mjs.map +1 -0
  460. package/lib/chunk-VN4GLOEN.js +302 -0
  461. package/lib/chunk-VN4GLOEN.js.map +1 -0
  462. package/lib/chunk-VOFKYSJD.js +20 -0
  463. package/lib/chunk-VOFKYSJD.js.map +1 -0
  464. package/lib/chunk-VVXKATDH.js +18 -0
  465. package/lib/chunk-VVXKATDH.js.map +1 -0
  466. package/lib/{chunk-K7X6DVM2.mjs → chunk-W3U7RYLP.mjs} +3 -6
  467. package/lib/chunk-W3U7RYLP.mjs.map +1 -0
  468. package/lib/chunk-WJGXVKZY.js +21 -0
  469. package/lib/chunk-WJGXVKZY.js.map +1 -0
  470. package/lib/chunk-WLPDAJB3.js +52 -0
  471. package/lib/chunk-WLPDAJB3.js.map +1 -0
  472. package/lib/chunk-WYM2TIVW.mjs +23 -0
  473. package/lib/chunk-WYM2TIVW.mjs.map +1 -0
  474. package/lib/chunk-XBE75VFX.js +13 -0
  475. package/lib/chunk-XBE75VFX.js.map +1 -0
  476. package/lib/chunk-XDVSL5B6.js +14 -0
  477. package/lib/chunk-XDVSL5B6.js.map +1 -0
  478. package/lib/chunk-XIOV4SHZ.mjs +13 -0
  479. package/lib/chunk-XIOV4SHZ.mjs.map +1 -0
  480. package/lib/chunk-Y54K6TQO.js +19 -0
  481. package/lib/chunk-Y54K6TQO.js.map +1 -0
  482. package/lib/chunk-Y5MNJGFX.js +30 -0
  483. package/lib/chunk-Y5MNJGFX.js.map +1 -0
  484. package/lib/chunk-YDTQASAY.mjs +18 -0
  485. package/lib/chunk-YDTQASAY.mjs.map +1 -0
  486. package/lib/chunk-YMPRYKNY.js +18 -0
  487. package/lib/chunk-YMPRYKNY.js.map +1 -0
  488. package/lib/chunk-Z2HZXSDA.js +18 -0
  489. package/lib/chunk-Z2HZXSDA.js.map +1 -0
  490. package/lib/chunk-Z3NPFUIA.mjs +18 -0
  491. package/lib/chunk-Z3NPFUIA.mjs.map +1 -0
  492. package/lib/chunk-Z4XOKGU3.js +71 -0
  493. package/lib/chunk-Z4XOKGU3.js.map +1 -0
  494. package/lib/chunk-ZDXO3TGZ.mjs +18 -0
  495. package/lib/chunk-ZDXO3TGZ.mjs.map +1 -0
  496. package/lib/chunk-ZEGRYDE5.mjs +18 -0
  497. package/lib/chunk-ZEGRYDE5.mjs.map +1 -0
  498. package/lib/chunk-ZGUF5ZDP.mjs +21 -0
  499. package/lib/chunk-ZGUF5ZDP.mjs.map +1 -0
  500. package/lib/chunk-ZNQHNLKW.js +18 -0
  501. package/lib/chunk-ZNQHNLKW.js.map +1 -0
  502. package/lib/chunk-ZTCXXAKD.mjs +24 -0
  503. package/lib/chunk-ZTCXXAKD.mjs.map +1 -0
  504. package/lib/codeGen.d.mts +3 -2
  505. package/lib/codeGen.d.ts +3 -2
  506. package/lib/codeGen.js +3 -46
  507. package/lib/codeGen.js.map +1 -1
  508. package/lib/codeGen.mjs +4 -47
  509. package/lib/codeGen.mjs.map +1 -1
  510. package/lib/commonTypes.d.mts +12 -12
  511. package/lib/commonTypes.d.ts +12 -12
  512. package/lib/core.d.mts +200 -0
  513. package/lib/core.d.ts +200 -0
  514. package/lib/core.js +17 -0
  515. package/lib/core.js.map +1 -0
  516. package/lib/core.mjs +17 -0
  517. package/lib/exceptions.d.mts +2 -3
  518. package/lib/exceptions.d.ts +2 -3
  519. package/lib/exceptions.js +2 -4
  520. package/lib/exceptions.js.map +1 -1
  521. package/lib/exceptions.mjs +3 -5
  522. package/lib/helpers/constants.d.mts +2 -1
  523. package/lib/helpers/constants.d.ts +2 -1
  524. package/lib/helpers/constants.js +4 -2
  525. package/lib/helpers/constants.js.map +1 -1
  526. package/lib/helpers/constants.mjs +5 -3
  527. package/lib/helpers/setStrictType.d.mts +3 -2
  528. package/lib/helpers/setStrictType.d.ts +3 -2
  529. package/lib/helpers/setStrictType.js +3 -5
  530. package/lib/helpers/setStrictType.js.map +1 -1
  531. package/lib/helpers/setStrictType.mjs +2 -4
  532. package/lib/index.d.mts +52 -4
  533. package/lib/index.d.ts +52 -4
  534. package/lib/index.js +203 -6
  535. package/lib/index.js.map +1 -1
  536. package/lib/index.mjs +207 -10
  537. package/lib/translationMap.d.mts +4 -1
  538. package/lib/translationMap.d.ts +4 -1
  539. package/lib/translationMap.js +3 -3
  540. package/lib/translationMap.mjs +2 -2
  541. package/package.json +46 -41
  542. package/lib/CommonSchema-DOh3bsL-.d.ts +0 -110
  543. package/lib/CommonSchema-wi9MOXGF.d.mts +0 -110
  544. package/lib/chunk-2KQASECD.js +0 -20
  545. package/lib/chunk-2KQASECD.js.map +0 -1
  546. package/lib/chunk-42J6CHIO.js.map +0 -1
  547. package/lib/chunk-5P6AZJCN.js +0 -45
  548. package/lib/chunk-5P6AZJCN.js.map +0 -1
  549. package/lib/chunk-5WHCMWXK.js +0 -50
  550. package/lib/chunk-5WHCMWXK.js.map +0 -1
  551. package/lib/chunk-5YYRBKDP.js.map +0 -1
  552. package/lib/chunk-6D5W7SSQ.mjs +0 -44
  553. package/lib/chunk-6D5W7SSQ.mjs.map +0 -1
  554. package/lib/chunk-7NBOVYSP.mjs +0 -136
  555. package/lib/chunk-7NBOVYSP.mjs.map +0 -1
  556. package/lib/chunk-BNCT7NOR.mjs +0 -91
  557. package/lib/chunk-BNCT7NOR.mjs.map +0 -1
  558. package/lib/chunk-C3EDEQ3W.mjs.map +0 -1
  559. package/lib/chunk-CHUPE6SJ.mjs +0 -58
  560. package/lib/chunk-CHUPE6SJ.mjs.map +0 -1
  561. package/lib/chunk-ECBOZ3BM.js +0 -44
  562. package/lib/chunk-ECBOZ3BM.js.map +0 -1
  563. package/lib/chunk-FGZKNBDP.mjs +0 -45
  564. package/lib/chunk-FGZKNBDP.mjs.map +0 -1
  565. package/lib/chunk-FP5QAEVQ.mjs +0 -63
  566. package/lib/chunk-FP5QAEVQ.mjs.map +0 -1
  567. package/lib/chunk-G55SHHAR.js +0 -29
  568. package/lib/chunk-G55SHHAR.js.map +0 -1
  569. package/lib/chunk-H32B3NHW.mjs.map +0 -1
  570. package/lib/chunk-H6LHV3EA.mjs.map +0 -1
  571. package/lib/chunk-HP3DRZWK.js.map +0 -1
  572. package/lib/chunk-IZ3CBVEE.js.map +0 -1
  573. package/lib/chunk-K7X6DVM2.mjs.map +0 -1
  574. package/lib/chunk-LPR3G5T3.mjs.map +0 -1
  575. package/lib/chunk-MHBY5OIQ.mjs +0 -20
  576. package/lib/chunk-MHBY5OIQ.mjs.map +0 -1
  577. package/lib/chunk-MLNQZ445.js +0 -58
  578. package/lib/chunk-MLNQZ445.js.map +0 -1
  579. package/lib/chunk-QIDWASOC.js +0 -14
  580. package/lib/chunk-QIDWASOC.js.map +0 -1
  581. package/lib/chunk-SHJVKSEZ.js +0 -136
  582. package/lib/chunk-SHJVKSEZ.js.map +0 -1
  583. package/lib/chunk-TRGMD7LA.mjs +0 -29
  584. package/lib/chunk-TRGMD7LA.mjs.map +0 -1
  585. package/lib/chunk-TV5IZY4L.mjs +0 -50
  586. package/lib/chunk-TV5IZY4L.mjs.map +0 -1
  587. package/lib/chunk-U4USIJV3.js.map +0 -1
  588. package/lib/chunk-UUY7DPHK.js +0 -65
  589. package/lib/chunk-UUY7DPHK.js.map +0 -1
  590. package/lib/chunk-VW4RMQD4.js +0 -28
  591. package/lib/chunk-VW4RMQD4.js.map +0 -1
  592. package/lib/chunk-WK4FJ5GD.mjs +0 -65
  593. package/lib/chunk-WK4FJ5GD.mjs.map +0 -1
  594. package/lib/chunk-X762EUSZ.js +0 -91
  595. package/lib/chunk-X762EUSZ.js.map +0 -1
  596. package/lib/chunk-YUMUCQKL.mjs.map +0 -1
  597. package/lib/chunk-Z6QU36MM.js +0 -63
  598. package/lib/chunk-Z6QU36MM.js.map +0 -1
  599. package/lib/helpers/core.d.mts +0 -3
  600. package/lib/helpers/core.d.ts +0 -3
  601. package/lib/helpers/core.js +0 -11
  602. package/lib/helpers/core.js.map +0 -1
  603. package/lib/helpers/core.mjs +0 -11
  604. package/lib/parse.d.mts +0 -61
  605. package/lib/parse.d.ts +0 -61
  606. package/lib/parse.js +0 -11
  607. package/lib/parse.js.map +0 -1
  608. package/lib/parse.mjs +0 -11
  609. package/lib/parse.mjs.map +0 -1
  610. package/lib/parseOrFail.d.mts +0 -43
  611. package/lib/parseOrFail.d.ts +0 -43
  612. package/lib/parseOrFail.js +0 -11
  613. package/lib/parseOrFail.js.map +0 -1
  614. package/lib/parseOrFail.mjs +0 -11
  615. package/lib/parseOrFail.mjs.map +0 -1
  616. package/lib/schemas/ArraySchema.d.mts +0 -11
  617. package/lib/schemas/ArraySchema.d.ts +0 -11
  618. package/lib/schemas/ArraySchema.js +0 -13
  619. package/lib/schemas/ArraySchema.js.map +0 -1
  620. package/lib/schemas/ArraySchema.mjs +0 -13
  621. package/lib/schemas/ArraySchema.mjs.map +0 -1
  622. package/lib/schemas/BigIntSchema.d.mts +0 -30
  623. package/lib/schemas/BigIntSchema.d.ts +0 -30
  624. package/lib/schemas/BigIntSchema.js +0 -17
  625. package/lib/schemas/BigIntSchema.js.map +0 -1
  626. package/lib/schemas/BigIntSchema.mjs +0 -17
  627. package/lib/schemas/BigIntSchema.mjs.map +0 -1
  628. package/lib/schemas/BooleanSchema.d.mts +0 -25
  629. package/lib/schemas/BooleanSchema.d.ts +0 -25
  630. package/lib/schemas/BooleanSchema.js +0 -14
  631. package/lib/schemas/BooleanSchema.js.map +0 -1
  632. package/lib/schemas/BooleanSchema.mjs +0 -14
  633. package/lib/schemas/BooleanSchema.mjs.map +0 -1
  634. package/lib/schemas/CommonSchema.d.mts +0 -3
  635. package/lib/schemas/CommonSchema.d.ts +0 -3
  636. package/lib/schemas/CommonSchema.js +0 -12
  637. package/lib/schemas/CommonSchema.js.map +0 -1
  638. package/lib/schemas/CommonSchema.mjs +0 -12
  639. package/lib/schemas/CommonSchema.mjs.map +0 -1
  640. package/lib/schemas/DateSchema.d.mts +0 -10
  641. package/lib/schemas/DateSchema.d.ts +0 -10
  642. package/lib/schemas/DateSchema.js +0 -13
  643. package/lib/schemas/DateSchema.js.map +0 -1
  644. package/lib/schemas/DateSchema.mjs +0 -13
  645. package/lib/schemas/DateSchema.mjs.map +0 -1
  646. package/lib/schemas/NumberSchema.d.mts +0 -29
  647. package/lib/schemas/NumberSchema.d.ts +0 -29
  648. package/lib/schemas/NumberSchema.js +0 -17
  649. package/lib/schemas/NumberSchema.js.map +0 -1
  650. package/lib/schemas/NumberSchema.mjs +0 -17
  651. package/lib/schemas/NumberSchema.mjs.map +0 -1
  652. package/lib/schemas/ObjectSchema.d.mts +0 -29
  653. package/lib/schemas/ObjectSchema.d.ts +0 -29
  654. package/lib/schemas/ObjectSchema.js +0 -13
  655. package/lib/schemas/ObjectSchema.js.map +0 -1
  656. package/lib/schemas/ObjectSchema.mjs +0 -13
  657. package/lib/schemas/ObjectSchema.mjs.map +0 -1
  658. package/lib/schemas/StringSchema.d.mts +0 -30
  659. package/lib/schemas/StringSchema.d.ts +0 -30
  660. package/lib/schemas/StringSchema.js +0 -17
  661. package/lib/schemas/StringSchema.js.map +0 -1
  662. package/lib/schemas/StringSchema.mjs +0 -17
  663. package/lib/schemas/StringSchema.mjs.map +0 -1
  664. /package/lib/{helpers/core.mjs.map → core.mjs.map} +0 -0
@@ -1,136 +0,0 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
-
3
- var _chunkG55SHHARjs = require('./chunk-G55SHHAR.js');
4
-
5
-
6
- var _chunkX762EUSZjs = require('./chunk-X762EUSZ.js');
7
-
8
-
9
- var _chunk5P6AZJCNjs = require('./chunk-5P6AZJCN.js');
10
-
11
- // src/schemas/CommonSchema.ts
12
- var CommonSchema = class {
13
-
14
- constructor(ctx) {
15
- this[_chunkX762EUSZjs.ctxSymbol] = ctx;
16
- }
17
- /**
18
- * @param validators - One or more custom validation functions.
19
- * @returns {this} The schema instance with the added custom validation.
20
- */
21
- custom(...validators) {
22
- this.defaultValueCheck();
23
- this[_chunkX762EUSZjs.ctxSymbol].requiredValidations.push(...validators);
24
- return this;
25
- }
26
- /**
27
- * Marks the schema as nullable, allowing the value to be `null`.
28
- *
29
- * @returns {WithNull<this>} The schema instance marked as nullable.
30
- */
31
- nullable() {
32
- this.defaultValueCheck();
33
- this[_chunkX762EUSZjs.ctxSymbol].isNullable = true;
34
- return this;
35
- }
36
- /**
37
- * Marks the schema as optional, allowing the value to be `undefined`.
38
- *
39
- * @returns {WithUndefined<this>} The schema instance marked as optional.
40
- */
41
- optional() {
42
- this.defaultValueCheck();
43
- this[_chunkX762EUSZjs.ctxSymbol].isOptional = true;
44
- return this;
45
- }
46
- /**
47
- * Marks the schema as optional, allowing the value to be `undefined`.
48
- *
49
- * @returns {this} The schema instance. This method should be used as a last one because it does the check of previous methods and
50
- */
51
- default(defaultValue) {
52
- const ctx = this[_chunkX762EUSZjs.ctxSymbol];
53
- if (ctx.isOptional) {
54
- throw new (0, _chunk5P6AZJCNjs.BuildSchemaError)(`Cannot call method 'default' after method 'optional'`);
55
- }
56
- try {
57
- _chunkG55SHHARjs.parseOrFail.call(void 0, this, defaultValue);
58
- } catch (e) {
59
- throw new (0, _chunk5P6AZJCNjs.BuildSchemaError)(e.message);
60
- }
61
- this[_chunkX762EUSZjs.ctxSymbol].defaultValue = defaultValue;
62
- return this;
63
- }
64
- /**
65
- * Applies a transformation to the input value before any validation occurs.
66
- * The transformation should return a value of the same type as the inferred type of the schema,
67
- * ensuring that the overall type is not altered.
68
- *
69
- * @template In - The type of the input value before transformation (defaults to `unknown`).
70
- * @param {TransformCallback<In, InferType<this>>} cb - The callback function that performs the transformation.
71
- * @returns {this} The updated schema with the applied transformation.
72
- *
73
- * @example
74
- * const schema = string()
75
- * .nullable()
76
- * .transformBeforeValidation((val) => val + '') // Ensure the value is a string
77
- * .transformBeforeValidation((val: string) => (val === '' ? null : val)); // Convert empty strings to null
78
- *
79
- * // Parse 'test' will pass as 'test' is a valid string longer than 3 characters.
80
- * parseOrFail(schema, 'test');
81
- *
82
- * // Parsing '' will be transformed to null and will pass due to .nullable().
83
- * parseOrFail(schema, '');
84
- */
85
- transformBeforeValidation(cb) {
86
- const ctx = this[_chunkX762EUSZjs.ctxSymbol];
87
- if (ctx.transformListBefore) {
88
- ctx.transformListBefore.push(cb);
89
- } else {
90
- ctx.transformListBefore = [cb];
91
- }
92
- return this;
93
- }
94
- /**
95
- * Assigns a unique identifier to the schema.
96
- * This ID can be used to track or map validation errors back to specific fields
97
- * in a form or other structures.
98
- *
99
- * @param {string} value - The unique identifier for the schema.
100
- * @returns {this} The updated schema with the assigned ID.
101
- *
102
- * @example
103
- * const schema = string().id('username');
104
- */
105
- id(value) {
106
- return this.meta("id", value);
107
- }
108
- /**
109
- * Provides a description for the schema, offering additional context or information.
110
- * The description can be used when displaying validation errors or for documentation purposes.
111
- *
112
- * @param {string} value - The description for the schema.
113
- * @returns {this} The updated schema with the added description.
114
- *
115
- * @example
116
- * const schema = string().description('The username of the account holder.');
117
- */
118
- description(value) {
119
- return this.meta("description", value);
120
- }
121
- meta(key, value) {
122
- const ctx = this[_chunkX762EUSZjs.ctxSymbol];
123
- ctx.meta = { ...ctx.meta, [key]: value };
124
- return this;
125
- }
126
- defaultValueCheck() {
127
- if (this[_chunkX762EUSZjs.ctxSymbol].defaultValue !== void 0) {
128
- throw new (0, _chunk5P6AZJCNjs.BuildSchemaError)("Default value must be the last method called in schema");
129
- }
130
- }
131
- };
132
-
133
-
134
-
135
- exports.CommonSchema = CommonSchema;
136
- //# sourceMappingURL=chunk-SHJVKSEZ.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["/home/runner/work/bguard/bguard/lib/chunk-SHJVKSEZ.js","../src/schemas/CommonSchema.ts"],"names":[],"mappings":"AAAA;AACE;AACF,sDAA4B;AAC5B;AACE;AACF,sDAA4B;AAC5B;AACE;AACF,sDAA4B;AAC5B;AACA;ACeO,IAAM,aAAA,EAAN,MAAmB;AAAA,EACxB;AAAU,EACV,WAAA,CAAY,GAAA,EAAuB;AACjC,IAAA,IAAA,CAAK,0BAAS,EAAA,EAAI,GAAA;AAAA,EACpB;AAAA;AAAA;AAAA;AAAA;AAAA,EAMO,MAAA,CAAA,GAAU,UAAA,EAAwC;AACvD,IAAA,IAAA,CAAK,iBAAA,CAAkB,CAAA;AACvB,IAAA,IAAA,CAAK,0BAAS,CAAA,CAAE,mBAAA,CAAoB,IAAA,CAAK,GAAG,UAAU,CAAA;AACtD,IAAA,OAAO,IAAA;AAAA,EACT;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOO,QAAA,CAAA,EAA2B;AAChC,IAAA,IAAA,CAAK,iBAAA,CAAkB,CAAA;AACvB,IAAA,IAAA,CAAK,0BAAS,CAAA,CAAE,WAAA,EAAa,IAAA;AAC7B,IAAA,OAAO,IAAA;AAAA,EACT;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOO,QAAA,CAAA,EAAgC;AACrC,IAAA,IAAA,CAAK,iBAAA,CAAkB,CAAA;AACvB,IAAA,IAAA,CAAK,0BAAS,CAAA,CAAE,WAAA,EAAa,IAAA;AAC7B,IAAA,OAAO,IAAA;AAAA,EACT;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOO,OAAA,CAAQ,YAAA,EAAqC;AAClD,IAAA,MAAM,IAAA,EAAM,IAAA,CAAK,0BAAS,CAAA;AAC1B,IAAA,GAAA,CAAI,GAAA,CAAI,UAAA,EAAY;AAClB,MAAA,MAAM,IAAI,sCAAA,CAAiB,CAAA,oDAAA,CAAsD,CAAA;AAAA,IACnF;AAEA,IAAA,IAAI;AACF,MAAA,0CAAA,IAAY,EAAM,YAAY,CAAA;AAAA,IAChC,EAAA,MAAA,CAAS,CAAA,EAAG;AACV,MAAA,MAAM,IAAI,sCAAA,CAAkB,CAAA,CAAY,OAAO,CAAA;AAAA,IACjD;AAEA,IAAA,IAAA,CAAK,0BAAS,CAAA,CAAE,aAAA,EAAe,YAAA;AAC/B,IAAA,OAAO,IAAA;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,yBAAA,CAA8B,EAAA,EAAkD;AACrF,IAAA,MAAM,IAAA,EAAM,IAAA,CAAK,0BAAS,CAAA;AAC1B,IAAA,GAAA,CAAI,GAAA,CAAI,mBAAA,EAAqB;AAC3B,MAAA,GAAA,CAAI,mBAAA,CAAoB,IAAA,CAAK,EAAE,CAAA;AAAA,IACjC,EAAA,KAAO;AACL,MAAA,GAAA,CAAI,oBAAA,EAAsB,CAAC,EAAE,CAAA;AAAA,IAC/B;AAEA,IAAA,OAAO,IAAA;AAAA,EACT;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAaO,EAAA,CAAG,KAAA,EAAqB;AAC7B,IAAA,OAAO,IAAA,CAAK,IAAA,CAAK,IAAA,EAAM,KAAK,CAAA;AAAA,EAC9B;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAYO,WAAA,CAAY,KAAA,EAAqB;AACtC,IAAA,OAAO,IAAA,CAAK,IAAA,CAAK,aAAA,EAAe,KAAK,CAAA;AAAA,EACvC;AAAA,EAEQ,IAAA,CAAK,GAAA,EAAa,KAAA,EAAqB;AAC7C,IAAA,MAAM,IAAA,EAAM,IAAA,CAAK,0BAAS,CAAA;AAC1B,IAAA,GAAA,CAAI,KAAA,EAAO,EAAE,GAAG,GAAA,CAAI,IAAA,EAAM,CAAC,GAAG,CAAA,EAAG,MAAM,CAAA;AACvC,IAAA,OAAO,IAAA;AAAA,EACT;AAAA,EAEU,iBAAA,CAAA,EAAoB;AAC5B,IAAA,GAAA,CAAI,IAAA,CAAK,0BAAS,CAAA,CAAE,aAAA,IAAiB,KAAA,CAAA,EAAW;AAC9C,MAAA,MAAM,IAAI,sCAAA,CAAiB,wDAAwD,CAAA;AAAA,IACrF;AAAA,EACF;AACF,CAAA;ADzBA;AACA;AACE;AACF,oCAAC","file":"/home/runner/work/bguard/bguard/lib/chunk-SHJVKSEZ.js","sourcesContent":[null,"import { InferType } from '../InferType';\nimport { MetaContext, BaseType, RequiredValidation, 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"]}
@@ -1,29 +0,0 @@
1
- import {
2
- ctxSymbol,
3
- innerCheck
4
- } from "./chunk-BNCT7NOR.mjs";
5
- import {
6
- getTranslationByLocale
7
- } from "./chunk-H32B3NHW.mjs";
8
- import {
9
- ValidationError
10
- } from "./chunk-FGZKNBDP.mjs";
11
-
12
- // src/parseOrFail.ts
13
- function parseOrFail(schema, receivedValue, options) {
14
- try {
15
- return innerCheck(schema, receivedValue, {
16
- t: getTranslationByLocale(options?.lng),
17
- pathToError: "",
18
- meta: schema[ctxSymbol].meta
19
- });
20
- } catch (e) {
21
- if (e instanceof ValidationError) throw e;
22
- throw new Error("Something unexpected happened");
23
- }
24
- }
25
-
26
- export {
27
- parseOrFail
28
- };
29
- //# sourceMappingURL=chunk-TRGMD7LA.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/parseOrFail.ts"],"sourcesContent":["import type { InferType } from './InferType';\nimport type { CommonSchema } from './schemas/CommonSchema';\nimport { ctxSymbol, innerCheck } from './helpers/core';\nimport { getTranslationByLocale } from './translationMap';\nimport { ValidationError } from './exceptions';\ninterface ParseOptions {\n /**\n * Set language keyword to map error messages.\n * @default 'default'\n * @example 'sr' or 'Serbia' or any string to identify language\n */\n lng?: string;\n}\n\n/**\n * Parses and validates a value against the provided schema, returning a type-safe result.\n *\n * This function will throw a `ValidationError` if the value does not conform to the schema.\n * The inferred TypeScript type of the returned value will match the structure defined by the schema.\n *\n * @template T\n * @param {T} schema - The schema to validate the received value against. This schema dictates the expected structure and type of the value.\n * @param {unknown} receivedValue - The value to be validated and parsed according to the schema.\n * @param {ParseOptions} options - Options\n * @param {ParseOptions.lng} options.lng - Set language keyword to map Error message\n * @returns {InferType<T>} The validated value, with its TypeScript type inferred from the schema.\n *\n * @throws {ValidationError} If the received value does not match the schema, a `ValidationError` will be thrown.\n * @throws {Error} If an unexpected error occurs during validation, an error will be thrown with a generic message.\n *\n * @example\n * const schema = object({\n * name: string(),\n * age: number(),\n * });\n *\n * const result = parseOrFail(schema, { name: 'Alice', age: 30 });\n * // result will be inferred as { name: string; age: number }\n *\n * parseOrFail(schema, { name: 'Alice', age: '30' });\n * // Throws ValidationError because 'age' should be a number, not a string.\n */\nexport function parseOrFail<T extends CommonSchema>(\n schema: T,\n receivedValue: unknown,\n options?: ParseOptions,\n): InferType<T> {\n try {\n return innerCheck(schema, receivedValue, {\n t: getTranslationByLocale(options?.lng),\n pathToError: '',\n meta: schema[ctxSymbol].meta,\n }) as InferType<T>;\n } catch (e) {\n if (e instanceof ValidationError) throw e;\n /* istanbul ignore next */\n throw new Error('Something unexpected happened');\n }\n}\n"],"mappings":";;;;;;;;;;;;AA0CO,SAAS,YACd,QACA,eACA,SACc;AACd,MAAI;AACF,WAAO,WAAW,QAAQ,eAAe;AAAA,MACvC,GAAG,uBAAuB,SAAS,GAAG;AAAA,MACtC,aAAa;AAAA,MACb,MAAM,OAAO,SAAS,EAAE;AAAA,IAC1B,CAAC;AAAA,EACH,SAAS,GAAG;AACV,QAAI,aAAa,gBAAiB,OAAM;AAExC,UAAM,IAAI,MAAM,+BAA+B;AAAA,EACjD;AACF;","names":[]}
@@ -1,50 +0,0 @@
1
- import {
2
- ctxSymbol,
3
- innerCheck
4
- } from "./chunk-BNCT7NOR.mjs";
5
- import {
6
- getTranslationByLocale
7
- } from "./chunk-H32B3NHW.mjs";
8
- import {
9
- ValidationError
10
- } from "./chunk-FGZKNBDP.mjs";
11
-
12
- // src/parse.ts
13
- function parse(schema, receivedValue, options) {
14
- try {
15
- const ctx = {
16
- t: getTranslationByLocale(options?.lng),
17
- pathToError: "",
18
- getAllErrors: options?.getAllErrors,
19
- errors: [],
20
- meta: schema[ctxSymbol].meta
21
- };
22
- const parsedValue = innerCheck(schema, receivedValue, ctx);
23
- if (ctx.getAllErrors && ctx.errors.length) {
24
- return [ctx.errors, void 0];
25
- }
26
- return [void 0, parsedValue];
27
- } catch (e) {
28
- if (e instanceof ValidationError) {
29
- delete e.stack;
30
- return [[e], void 0];
31
- }
32
- return [
33
- [
34
- {
35
- message: "Something unexpected happened",
36
- expected: "",
37
- received: "",
38
- pathToError: "",
39
- meta: void 0
40
- }
41
- ],
42
- void 0
43
- ];
44
- }
45
- }
46
-
47
- export {
48
- parse
49
- };
50
- //# sourceMappingURL=chunk-TV5IZY4L.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/parse.ts"],"sourcesContent":["import { InferType } from './InferType';\nimport { ctxSymbol, innerCheck } from './helpers/core';\nimport { getTranslationByLocale } from './translationMap';\nimport { ValidationError } from './exceptions';\nimport { CommonSchema } from './schemas/CommonSchema';\nimport { ExceptionContext, ValidationErrorData } from './commonTypes';\n\ninterface ParseOptions {\n /**\n * Set language keyword to map error messages.\n * @default 'default'\n * @example 'sr' or 'Serbia' or any string to identify language\n */\n lng?: string;\n\n /**\n * If true, collects all validation errors and returns them.\n * If false or undefined, returns the first validation error it can find and stops looking,\n * which provides a small runtime optimization.\n * @default undefined\n */\n getAllErrors?: boolean;\n}\n\n/**\n * Parses and validates a value against the provided schema, returning a type-safe parsedValue.\n *\n * This function will throw a `ValidationError` if the value does not conform to the schema.\n * The inferred TypeScript type of the returned value will match the structure defined by the schema.\n *\n * @template T\n * @param {T} schema - The schema to validate the received value against. This schema dictates the expected structure and type of the value.\n * @param {unknown} receivedValue - The value to be validated and parsed according to the schema.\n * @param {ParseOptions} options - Options\n * @param {ParseOptions.lng} options.lng - Set language keyword to map Error messages\n * @param {ParseOptions.lng} options.getAllErrors - If `false` or `undefined` - returns the first validation error it can find and stops looking, which provides a small runtime optimization.\n * @returns {[undefined, InferType<T>]} A tuple of [undefined, InferType<T>] if parsing is successful.\n * @returns {[ValidationErrorData[], undefined]} A tuple of [ValidationErrorData[], undefined]] if errors occur.\n *\n * @example\n * const schema = object({\n * name: string(),\n * age: number(),\n * });\n *\n * const [errors, parsedValue] = parse(schema, { name: 'Alice', age: 30 });\n * // parsedValue will be inferred as { name: string; age: number }\n *\n *\n * const [errors, parsedValue] = parse(schema, { name: 'Alice', age: '30' });\n * // First element in array \"errors\" will have an error because 'age' should be a number, not a string.\n * // Array 'errors' returns only one element.\n *\n *\n * const [errors, parsedValue] = parse(schema, { name: true, age: '30' }, { getAllErrors: true});\n * // Returns array \"errors\" with multiple errors because 'age' should be a number and 'name' a string.\n * // With provided options { getAllErrors: true}, we can expecte more than one error in 'errors' array.\n *\n *\n * const [errors, parsedValue] = parse(schema, { name: true, age: '30' }, { lng: 'SR'});\n * // First element in array \"errors\" will have an error because 'age' should be a number, not a string.\n * // With provided options { lng: 'SR'}, errors will be translated to a language mapped with keyword 'SR'\n */\nexport function parse<T extends CommonSchema>(\n schema: T,\n receivedValue: unknown,\n options?: ParseOptions,\n): [ValidationErrorData[], undefined] | [undefined, InferType<T>] {\n try {\n const ctx: ExceptionContext = {\n t: getTranslationByLocale(options?.lng),\n pathToError: '',\n getAllErrors: options?.getAllErrors,\n errors: [],\n meta: schema[ctxSymbol].meta,\n };\n\n const parsedValue = innerCheck(schema, receivedValue, ctx) as InferType<T>;\n\n if (ctx.getAllErrors && ctx.errors.length) {\n return [ctx.errors, undefined];\n }\n\n return [undefined, parsedValue];\n } catch (e) {\n if (e instanceof ValidationError) {\n delete e.stack;\n return [[e], undefined];\n }\n /* istanbul ignore next */\n return [\n [\n {\n message: 'Something unexpected happened',\n expected: '',\n received: '',\n pathToError: '',\n meta: undefined,\n },\n ],\n undefined,\n ];\n }\n}\n"],"mappings":";;;;;;;;;;;;AA+DO,SAAS,MACd,QACA,eACA,SACgE;AAChE,MAAI;AACF,UAAM,MAAwB;AAAA,MAC5B,GAAG,uBAAuB,SAAS,GAAG;AAAA,MACtC,aAAa;AAAA,MACb,cAAc,SAAS;AAAA,MACvB,QAAQ,CAAC;AAAA,MACT,MAAM,OAAO,SAAS,EAAE;AAAA,IAC1B;AAEA,UAAM,cAAc,WAAW,QAAQ,eAAe,GAAG;AAEzD,QAAI,IAAI,gBAAgB,IAAI,OAAO,QAAQ;AACzC,aAAO,CAAC,IAAI,QAAQ,MAAS;AAAA,IAC/B;AAEA,WAAO,CAAC,QAAW,WAAW;AAAA,EAChC,SAAS,GAAG;AACV,QAAI,aAAa,iBAAiB;AAChC,aAAO,EAAE;AACT,aAAO,CAAC,CAAC,CAAC,GAAG,MAAS;AAAA,IACxB;AAEA,WAAO;AAAA,MACL;AAAA,QACE;AAAA,UACE,SAAS;AAAA,UACT,UAAU;AAAA,UACV,UAAU;AAAA,UACV,aAAa;AAAA,UACb,MAAM;AAAA,QACR;AAAA,MACF;AAAA,MACA;AAAA,IACF;AAAA,EACF;AACF;","names":[]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["/home/runner/work/bguard/bguard/lib/chunk-U4USIJV3.js","../src/schemas/ObjectSchema.ts"],"names":[],"mappings":"AAAA;AACE;AACF,sDAA4B;AAC5B;AACE;AACF,sDAA4B;AAC5B;AACE;AACF,sDAA4B;AAC5B;AACA;ACNO,IAAM,aAAA,YAAN,MAAA,QAA2B,8BAAa;AAAA,iBACnC,QAAA,EAAU,EAAA;AAAA,EACpB,WAAA,CAAY,GAAA,EAAuB,WAAA,EAAoC;AACrE,IAAA,KAAA,CAAM,GAAG,qCAAA;AACT,IAAA,IAAA,CAAK,mBAAA,CAAoB,WAAW,CAAA;AACpC,IAAA,IAAA,CAAK,0BAAS,CAAA,CAAE,OAAA,EAAS,WAAA;AAAA,EAC3B;AAAA,EAEQ,mBAAA,CAAoB,WAAA,EAAoC;AAC9D,IAAA,GAAA,CAAI,CAAC,WAAA,EAAa,MAAM,IAAI,sCAAA,CAAiB,iCAAiC,CAAA;AAC9E,IAAA,GAAA,CAAI,YAAA,WAAuB,6BAAA,EAAc,MAAM,IAAI,sCAAA,CAAiB,0BAA0B,CAAA;AAC9F,IAAA,IAAA,CAAA,MAAW,CAAC,GAAA,EAAK,KAAK,EAAA,GAAK,MAAA,CAAO,OAAA,CAAQ,WAAW,CAAA,EAAG;AACtD,MAAA,GAAA,CAAI,CAAA,CAAE,MAAA,WAAiB,6BAAA,CAAA;AACrB,QAAA,MAAM,IAAI,sCAAA,CAAiB,CAAA,8CAAA,EAAiD,GAAG,CAAA,CAAA,CAAG,CAAA;AAAA,IACtF;AAAA,EACF;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAmBO,iBAAA,CAAA,EAA0B;AAC/B,IAAA,IAAA,CAAK,0BAAS,CAAA,CAAE,6BAAA,EAA+B,IAAA;AAC/C,IAAA,OAAO,IAAA;AAAA,EACT;AACF,UAAA;ADMA;AACA;AACE;AACF,oCAAC","file":"/home/runner/work/bguard/bguard/lib/chunk-U4USIJV3.js","sourcesContent":[null,"import { ctxSymbol } from '../helpers/core';\nimport { BuildSchemaError } from '../exceptions';\nimport { CommonSchema, ObjectShapeSchemaType, ValidatorContext } from './CommonSchema';\n\nexport class ObjectSchema extends CommonSchema {\n protected _object = 1;\n constructor(ctx: ValidatorContext, shapeSchema: ObjectShapeSchemaType) {\n super(ctx);\n this.validateObjectEntry(shapeSchema);\n this[ctxSymbol].object = shapeSchema;\n }\n\n private validateObjectEntry(shapeSchema: ObjectShapeSchemaType) {\n if (!shapeSchema) throw new BuildSchemaError('Missing schema in object method');\n if (shapeSchema instanceof CommonSchema) throw new BuildSchemaError('Invalid schema in object');\n for (const [key, value] of Object.entries(shapeSchema)) {\n if (!(value instanceof CommonSchema))\n throw new BuildSchemaError(`Invalid schema in object method for property '${key}'`);\n }\n }\n\n /**\n * Allows unrecognized properties in the validated object.\n * When this method is called, the validation will not fail\n * if the received object contains properties not specified\n * in the validation schema.\n *\n * @returns {this} The current ObjectSchema instance.\n *\n * @example\n * const userSchema = object({\n * name: string(),\n * age: number(),\n * }).allowUnrecognized();\n *\n * parseOrFail(userSchema, ({ name: 'John', age: 30, extra: 'value' }););\n * // No error thrown\n */\n public allowUnrecognized(): this {\n this[ctxSymbol].allowUnrecognizedObjectProps = true;\n return this;\n }\n}\n"]}
@@ -1,65 +0,0 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); var _class;
2
-
3
- var _chunkHP3DRZWKjs = require('./chunk-HP3DRZWK.js');
4
-
5
-
6
- var _chunkIZ3CBVEEjs = require('./chunk-IZ3CBVEE.js');
7
-
8
-
9
- var _chunk42J6CHIOjs = require('./chunk-42J6CHIO.js');
10
-
11
-
12
- var _chunkQIDWASOCjs = require('./chunk-QIDWASOC.js');
13
-
14
-
15
- var _chunkSHJVKSEZjs = require('./chunk-SHJVKSEZ.js');
16
-
17
-
18
- var _chunk5P6AZJCNjs = require('./chunk-5P6AZJCN.js');
19
-
20
- // src/schemas/BigIntSchema.ts
21
- var BigIntSchema = (_class = class extends _chunkSHJVKSEZjs.CommonSchema {constructor(...args) { super(...args); _class.prototype.__init.call(this); }
22
- __init() {this._bigint = 1}
23
-
24
- /**
25
- * Restricts the schema to exactly match the specified value and infers the literal value as the TypeScript type.
26
- *
27
- * @param expectedValue - The value that the schema must exactly match.
28
- * @returns - The schema instance restricted to the specified value, with the literal value inferred as the TypeScript type
29
- *
30
- * @example - bigint().equalTo(42n); // Infers the type 42n
31
- */
32
- equalTo(expectedValue) {
33
- this.defaultValueCheck();
34
- this.limitCheck();
35
- _chunkQIDWASOCjs._setStrictType.call(void 0, this, `${expectedValue}n`);
36
- return this.custom(_chunkHP3DRZWKjs.equalTo.call(void 0, expectedValue));
37
- }
38
- /**
39
- * Restricts the schema to match one of the specified values and infers the union of those values as the TypeScript type.
40
- *
41
- * @param expectedValues - An array of values that the schema can match.
42
- * @returns - The schema instance restricted to one of the specified values, with the union of those values inferred as the TypeScript type.
43
- *
44
- * @example
45
- * bigint().oneOfValues([5n, 7n]); // Infers the type 5n | 7n
46
- */
47
- oneOfValues(expectedValue) {
48
- this.defaultValueCheck();
49
- this.limitCheck();
50
- _chunkQIDWASOCjs._setStrictType.call(void 0,
51
- this,
52
- expectedValue.map((el) => `${el}n`)
53
- );
54
- return this.custom(_chunkIZ3CBVEEjs.oneOfValues.call(void 0, expectedValue));
55
- }
56
- limitCheck() {
57
- if (this.limit) throw new (0, _chunk5P6AZJCNjs.BuildSchemaError)(_chunk42J6CHIOjs.ONLY_ONCE);
58
- this.limit = true;
59
- }
60
- }, _class);
61
-
62
-
63
-
64
- exports.BigIntSchema = BigIntSchema;
65
- //# sourceMappingURL=chunk-UUY7DPHK.js.map
@@ -1 +0,0 @@
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,28 +0,0 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); var _class;
2
-
3
- var _chunkSHJVKSEZjs = require('./chunk-SHJVKSEZ.js');
4
-
5
-
6
- var _chunkX762EUSZjs = require('./chunk-X762EUSZ.js');
7
-
8
-
9
- var _chunk5P6AZJCNjs = require('./chunk-5P6AZJCN.js');
10
-
11
- // src/schemas/ArraySchema.ts
12
- var ArraySchema = (_class = class extends _chunkSHJVKSEZjs.CommonSchema {
13
- __init() {this._array = 1}
14
- constructor(ctx, arraySchema) {
15
- super(ctx);_class.prototype.__init.call(this);;
16
- this.validateArrayEntry(arraySchema);
17
- this[_chunkX762EUSZjs.ctxSymbol].array = arraySchema;
18
- }
19
- validateArrayEntry(arraySchema) {
20
- if (!arraySchema) throw new (0, _chunk5P6AZJCNjs.BuildSchemaError)("Missing schema in array method");
21
- if (!(arraySchema instanceof _chunkSHJVKSEZjs.CommonSchema)) throw new (0, _chunk5P6AZJCNjs.BuildSchemaError)("Invalid schema in array method");
22
- }
23
- }, _class);
24
-
25
-
26
-
27
- exports.ArraySchema = ArraySchema;
28
- //# sourceMappingURL=chunk-VW4RMQD4.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["/home/runner/work/bguard/bguard/lib/chunk-VW4RMQD4.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,iBAClC,OAAA,EAAS,EAAA;AAAA,EACnB,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-VW4RMQD4.js","sourcesContent":[null,"import { ctxSymbol } from '../helpers/core';\nimport { BuildSchemaError } from '../exceptions';\nimport { CommonSchema, ValidatorContext } from './CommonSchema';\n\nexport class ArraySchema extends CommonSchema {\n protected _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"]}
@@ -1,65 +0,0 @@
1
- import {
2
- equalTo
3
- } from "./chunk-C3EDEQ3W.mjs";
4
- import {
5
- oneOfValues
6
- } from "./chunk-K7X6DVM2.mjs";
7
- import {
8
- ONLY_ONCE
9
- } from "./chunk-ASZW6XRM.mjs";
10
- import {
11
- _setStrictType
12
- } from "./chunk-H6LHV3EA.mjs";
13
- import {
14
- CommonSchema
15
- } from "./chunk-7NBOVYSP.mjs";
16
- import {
17
- BuildSchemaError
18
- } from "./chunk-FGZKNBDP.mjs";
19
-
20
- // src/schemas/BigIntSchema.ts
21
- var BigIntSchema = class extends CommonSchema {
22
- _bigint = 1;
23
- limit;
24
- /**
25
- * Restricts the schema to exactly match the specified value and infers the literal value as the TypeScript type.
26
- *
27
- * @param expectedValue - The value that the schema must exactly match.
28
- * @returns - The schema instance restricted to the specified value, with the literal value inferred as the TypeScript type
29
- *
30
- * @example - bigint().equalTo(42n); // Infers the type 42n
31
- */
32
- equalTo(expectedValue) {
33
- this.defaultValueCheck();
34
- this.limitCheck();
35
- _setStrictType(this, `${expectedValue}n`);
36
- return this.custom(equalTo(expectedValue));
37
- }
38
- /**
39
- * Restricts the schema to match one of the specified values and infers the union of those values as the TypeScript type.
40
- *
41
- * @param expectedValues - An array of values that the schema can match.
42
- * @returns - The schema instance restricted to one of the specified values, with the union of those values inferred as the TypeScript type.
43
- *
44
- * @example
45
- * bigint().oneOfValues([5n, 7n]); // Infers the type 5n | 7n
46
- */
47
- oneOfValues(expectedValue) {
48
- this.defaultValueCheck();
49
- this.limitCheck();
50
- _setStrictType(
51
- this,
52
- expectedValue.map((el) => `${el}n`)
53
- );
54
- return this.custom(oneOfValues(expectedValue));
55
- }
56
- limitCheck() {
57
- if (this.limit) throw new BuildSchemaError(ONLY_ONCE);
58
- this.limit = true;
59
- }
60
- };
61
-
62
- export {
63
- BigIntSchema
64
- };
65
- //# sourceMappingURL=chunk-WK4FJ5GD.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/schemas/BigIntSchema.ts"],"sourcesContent":["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"],"mappings":";;;;;;;;;;;;;;;;;;;;AAQO,IAAM,eAAN,cAA2B,aAAa;AAAA,EACnC,UAAU;AAAA,EACZ;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAUD,QAA0B,eAA2C;AAC1E,SAAK,kBAAkB;AACvB,SAAK,WAAW;AAChB,mBAAe,MAAM,GAAG,aAAa,GAAG;AACxC,WAAO,KAAK,OAAO,QAAQ,aAAa,CAAC;AAAA,EAC3C;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAWO,YAA8B,eAA6C;AAChF,SAAK,kBAAkB;AACvB,SAAK,WAAW;AAChB;AAAA,MACE;AAAA,MACA,cAAc,IAAI,CAAC,OAAO,GAAG,EAAE,GAAG;AAAA,IACpC;AACA,WAAO,KAAK,OAAO,YAAY,aAAa,CAAC;AAAA,EAC/C;AAAA,EAEQ,aAAa;AACnB,QAAI,KAAK,MAAO,OAAM,IAAI,iBAAiB,SAAS;AACpD,SAAK,QAAQ;AAAA,EACf;AACF;","names":[]}
@@ -1,91 +0,0 @@
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; }
2
-
3
- var _chunkVBTWYDEMjs = require('./chunk-VBTWYDEM.js');
4
-
5
-
6
- var _chunk5P6AZJCNjs = require('./chunk-5P6AZJCN.js');
7
-
8
- // src/helpers/core.ts
9
- var ctxSymbol = Symbol("contextSymbol");
10
- function innerCheck(schema, receivedValue, exCtx) {
11
- const commonTmap = exCtx.t;
12
- const schemaData = schema[ctxSymbol];
13
- _optionalChain([schemaData, 'access', _ => _.transformListBefore, 'optionalAccess', _2 => _2.forEach, 'call', _3 => _3((transformCallback) => {
14
- receivedValue = transformCallback(receivedValue);
15
- })]);
16
- if (receivedValue === void 0) {
17
- if (schemaData.defaultValue !== void 0) return schemaData.defaultValue;
18
- if (!schemaData.isOptional) _chunk5P6AZJCNjs.guardException.call(void 0, "Required", receivedValue, exCtx, commonTmap["c:optional"]);
19
- return receivedValue;
20
- }
21
- if (receivedValue === null) {
22
- if (!schemaData.isNullable) _chunk5P6AZJCNjs.guardException.call(void 0, "Not null", receivedValue, exCtx, commonTmap["c:nullable"]);
23
- return receivedValue;
24
- }
25
- if (schemaData.date) {
26
- if (!_chunkVBTWYDEMjs.isValidDateInner.call(void 0, receivedValue)) _chunk5P6AZJCNjs.guardException.call(void 0, "Date", receivedValue, exCtx, commonTmap["c:date"]);
27
- }
28
- const typeOfVal = typeof receivedValue;
29
- if (schemaData.type.length) {
30
- if (!schemaData.type.includes(typeOfVal))
31
- _chunk5P6AZJCNjs.guardException.call(void 0, schemaData.type, typeOfVal, exCtx, commonTmap["c:invalidType"]);
32
- }
33
- if (schemaData.array) {
34
- if (!Array.isArray(receivedValue)) return _chunk5P6AZJCNjs.guardException.call(void 0, "Array", receivedValue, exCtx, commonTmap["c:array"]);
35
- schemaData.requiredValidations.forEach((requiredValidation) => {
36
- requiredValidation(receivedValue, exCtx);
37
- });
38
- const schema2 = schemaData.array;
39
- const pathToError = exCtx.pathToError;
40
- const parsedReceivedValue = [];
41
- receivedValue.forEach((elem, i) => {
42
- const parsedElement = innerCheck(schema2, elem, {
43
- ...exCtx,
44
- pathToError: `${pathToError}[${i}]`,
45
- meta: schemaData.meta
46
- });
47
- parsedReceivedValue.push(parsedElement);
48
- });
49
- return parsedReceivedValue;
50
- }
51
- if (schemaData.object) {
52
- if (typeOfVal !== "object") _chunk5P6AZJCNjs.guardException.call(void 0, "Object", receivedValue, exCtx, commonTmap["c:objectType"]);
53
- if (Array.isArray(receivedValue)) _chunk5P6AZJCNjs.guardException.call(void 0, "Object", receivedValue, exCtx, commonTmap["c:objectTypeAsArray"]);
54
- schemaData.requiredValidations.forEach((requiredValidation) => {
55
- requiredValidation(receivedValue, exCtx);
56
- });
57
- const shapeSchema = schemaData.object;
58
- const parsedReceivedValue = {};
59
- if (!schemaData.allowUnrecognizedObjectProps) {
60
- for (const keyPerReceivedValue of Object.keys(receivedValue)) {
61
- if (shapeSchema[keyPerReceivedValue] === void 0)
62
- _chunk5P6AZJCNjs.guardException.call(void 0, "Unrecognized property", keyPerReceivedValue, exCtx, commonTmap["c:unrecognizedProperty"]);
63
- }
64
- }
65
- const pathToError = exCtx.pathToError;
66
- for (const [keyOfSchema, valueOfSchema] of Object.entries(shapeSchema)) {
67
- const receivedObjectValuePropery = receivedValue[keyOfSchema];
68
- if (receivedObjectValuePropery === void 0) {
69
- if (!valueOfSchema[ctxSymbol].isOptional)
70
- _chunk5P6AZJCNjs.guardException.call(void 0, "Required", receivedObjectValuePropery, exCtx, commonTmap["c:requiredProperty"]);
71
- }
72
- const parsedReceivedObjectValuePropery = innerCheck(valueOfSchema, receivedObjectValuePropery, {
73
- ...exCtx,
74
- pathToError: `${pathToError}.${keyOfSchema}`,
75
- meta: schemaData.meta
76
- });
77
- parsedReceivedValue[keyOfSchema] = parsedReceivedObjectValuePropery;
78
- }
79
- return parsedReceivedValue;
80
- }
81
- schemaData.requiredValidations.forEach((requiredValidation) => {
82
- requiredValidation(receivedValue, exCtx);
83
- });
84
- return receivedValue;
85
- }
86
-
87
-
88
-
89
-
90
- exports.ctxSymbol = ctxSymbol; exports.innerCheck = innerCheck;
91
- //# sourceMappingURL=chunk-X762EUSZ.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["/home/runner/work/bguard/bguard/lib/chunk-X762EUSZ.js","../src/helpers/core.ts"],"names":["schema"],"mappings":"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","file":"/home/runner/work/bguard/bguard/lib/chunk-X762EUSZ.js","sourcesContent":[null,"export const ctxSymbol = Symbol('contextSymbol');\n\nimport { ExceptionContext } from '../commonTypes';\nimport { guardException } from '../exceptions';\nimport type { CommonSchema } from '../schemas/CommonSchema';\nimport { isValidDateInner } from './isValidDateInner';\n\nexport function innerCheck(schema: CommonSchema, receivedValue: unknown, exCtx: ExceptionContext): unknown {\n const commonTmap = exCtx.t;\n const schemaData = schema[ctxSymbol];\n\n schemaData.transformListBefore?.forEach((transformCallback) => {\n receivedValue = transformCallback(receivedValue);\n });\n\n if (receivedValue === undefined) {\n if (schemaData.defaultValue !== undefined) return schemaData.defaultValue;\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 (!isValidDateInner(receivedValue)) guardException('Date', receivedValue, exCtx, commonTmap['c:date']);\n }\n\n const typeOfVal = typeof receivedValue;\n\n if (schemaData.type.length) {\n if (!schemaData.type.includes(typeOfVal))\n guardException(schemaData.type, typeOfVal, exCtx, commonTmap['c:invalidType']);\n }\n\n if (schemaData.array) {\n if (!Array.isArray(receivedValue)) return guardException('Array', receivedValue, exCtx, commonTmap['c:array']);\n\n schemaData.requiredValidations.forEach((requiredValidation) => {\n requiredValidation(receivedValue, exCtx);\n });\n\n const schema = schemaData.array;\n const pathToError = exCtx.pathToError;\n const parsedReceivedValue: unknown[] = [];\n receivedValue.forEach((elem, i) => {\n const parsedElement = innerCheck(schema, elem, {\n ...exCtx,\n pathToError: `${pathToError}[${i}]`,\n meta: schemaData.meta,\n });\n parsedReceivedValue.push(parsedElement);\n });\n\n return parsedReceivedValue;\n }\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\n schemaData.requiredValidations.forEach((requiredValidation) => {\n requiredValidation(receivedValue, exCtx);\n });\n\n const shapeSchema = schemaData.object;\n const parsedReceivedValue: Record<string, unknown> = {};\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 const parsedReceivedObjectValuePropery = innerCheck(valueOfSchema, receivedObjectValuePropery, {\n ...exCtx,\n pathToError: `${pathToError}.${keyOfSchema}`,\n meta: schemaData.meta,\n });\n\n parsedReceivedValue[keyOfSchema] = parsedReceivedObjectValuePropery;\n }\n\n return parsedReceivedValue;\n }\n\n schemaData.requiredValidations.forEach((requiredValidation) => {\n requiredValidation(receivedValue, exCtx);\n });\n\n return receivedValue;\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/schemas/ObjectSchema.ts"],"sourcesContent":["import { ctxSymbol } from '../helpers/core';\nimport { BuildSchemaError } from '../exceptions';\nimport { CommonSchema, ObjectShapeSchemaType, ValidatorContext } from './CommonSchema';\n\nexport class ObjectSchema extends CommonSchema {\n protected _object = 1;\n constructor(ctx: ValidatorContext, shapeSchema: ObjectShapeSchemaType) {\n super(ctx);\n this.validateObjectEntry(shapeSchema);\n this[ctxSymbol].object = shapeSchema;\n }\n\n private validateObjectEntry(shapeSchema: ObjectShapeSchemaType) {\n if (!shapeSchema) throw new BuildSchemaError('Missing schema in object method');\n if (shapeSchema instanceof CommonSchema) throw new BuildSchemaError('Invalid schema in object');\n for (const [key, value] of Object.entries(shapeSchema)) {\n if (!(value instanceof CommonSchema))\n throw new BuildSchemaError(`Invalid schema in object method for property '${key}'`);\n }\n }\n\n /**\n * Allows unrecognized properties in the validated object.\n * When this method is called, the validation will not fail\n * if the received object contains properties not specified\n * in the validation schema.\n *\n * @returns {this} The current ObjectSchema instance.\n *\n * @example\n * const userSchema = object({\n * name: string(),\n * age: number(),\n * }).allowUnrecognized();\n *\n * parseOrFail(userSchema, ({ name: 'John', age: 30, extra: 'value' }););\n * // No error thrown\n */\n public allowUnrecognized(): this {\n this[ctxSymbol].allowUnrecognizedObjectProps = true;\n return this;\n }\n}\n"],"mappings":";;;;;;;;;;;AAIO,IAAM,eAAN,cAA2B,aAAa;AAAA,EACnC,UAAU;AAAA,EACpB,YAAY,KAAuB,aAAoC;AACrE,UAAM,GAAG;AACT,SAAK,oBAAoB,WAAW;AACpC,SAAK,SAAS,EAAE,SAAS;AAAA,EAC3B;AAAA,EAEQ,oBAAoB,aAAoC;AAC9D,QAAI,CAAC,YAAa,OAAM,IAAI,iBAAiB,iCAAiC;AAC9E,QAAI,uBAAuB,aAAc,OAAM,IAAI,iBAAiB,0BAA0B;AAC9F,eAAW,CAAC,KAAK,KAAK,KAAK,OAAO,QAAQ,WAAW,GAAG;AACtD,UAAI,EAAE,iBAAiB;AACrB,cAAM,IAAI,iBAAiB,iDAAiD,GAAG,GAAG;AAAA,IACtF;AAAA,EACF;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAmBO,oBAA0B;AAC/B,SAAK,SAAS,EAAE,+BAA+B;AAC/C,WAAO;AAAA,EACT;AACF;","names":[]}
@@ -1,63 +0,0 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); var _class;
2
-
3
- var _chunkHP3DRZWKjs = require('./chunk-HP3DRZWK.js');
4
-
5
-
6
- var _chunkIZ3CBVEEjs = require('./chunk-IZ3CBVEE.js');
7
-
8
-
9
- var _chunk42J6CHIOjs = require('./chunk-42J6CHIO.js');
10
-
11
-
12
- var _chunkQIDWASOCjs = require('./chunk-QIDWASOC.js');
13
-
14
-
15
- var _chunkSHJVKSEZjs = require('./chunk-SHJVKSEZ.js');
16
-
17
-
18
- var _chunk5P6AZJCNjs = require('./chunk-5P6AZJCN.js');
19
-
20
- // src/schemas/StringSchema.ts
21
- var StringSchema = (_class = class extends _chunkSHJVKSEZjs.CommonSchema {constructor(...args) { super(...args); _class.prototype.__init.call(this); }
22
- __init() {this._string = 1}
23
-
24
- /**
25
- * Restricts the schema to exactly match the specified value and infers the literal value as the TypeScript type.
26
- *
27
- * @param expectedValue - The value that the schema must exactly match.
28
- * @returns - The schema instance restricted to the specified value, with the literal value inferred as the TypeScript type
29
- *
30
- * @example - string().equalTo('hello'); // Infers the type 'hello'
31
- */
32
- equalTo(expectedValue) {
33
- this.limitCheck();
34
- _chunkQIDWASOCjs._setStrictType.call(void 0, this, `'${expectedValue}'`);
35
- return this.custom(_chunkHP3DRZWKjs.equalTo.call(void 0, expectedValue));
36
- }
37
- /**
38
- * Restricts the schema to match one of the specified values and infers the union of those values as the TypeScript type.
39
- *
40
- * @param expectedValues - An array of values that the schema can match.
41
- * @returns - The schema instance restricted to one of the specified values, with the union of those values inferred as the TypeScript type.
42
- *
43
- * @example
44
- * string().oneOfValues(['foo', 'bar']); // Infers the type 'foo' | 'bar'
45
- */
46
- oneOfValues(expectedValue) {
47
- this.limitCheck();
48
- _chunkQIDWASOCjs._setStrictType.call(void 0,
49
- this,
50
- expectedValue.map((el) => `'${el}'`)
51
- );
52
- return this.custom(_chunkIZ3CBVEEjs.oneOfValues.call(void 0, expectedValue));
53
- }
54
- limitCheck() {
55
- if (this.limit) throw new (0, _chunk5P6AZJCNjs.BuildSchemaError)(_chunk42J6CHIOjs.ONLY_ONCE);
56
- this.limit = true;
57
- }
58
- }, _class);
59
-
60
-
61
-
62
- exports.StringSchema = StringSchema;
63
- //# sourceMappingURL=chunk-Z6QU36MM.js.map
@@ -1 +0,0 @@
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,3 +0,0 @@
1
- import '../commonTypes.mjs';
2
- export { c as ctxSymbol, i as innerCheck } from '../CommonSchema-wi9MOXGF.mjs';
3
- import '../InferType.mjs';
@@ -1,3 +0,0 @@
1
- import '../commonTypes.js';
2
- export { c as ctxSymbol, i as innerCheck } from '../CommonSchema-DOh3bsL-.js';
3
- import '../InferType.js';