@bgord/tools 1.3.24 → 1.4.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 (504) hide show
  1. package/dist/src/age-years.vo.d.ts +11 -0
  2. package/dist/src/age-years.vo.js +6 -0
  3. package/dist/{age.vo.js → src/age.vo.js} +2 -1
  4. package/dist/src/api-key.vo.d.ts +7 -0
  5. package/dist/src/api-key.vo.js +7 -0
  6. package/dist/src/basename.vo.d.ts +12 -0
  7. package/dist/src/basename.vo.js +22 -0
  8. package/dist/src/day-iso-id.vo.d.ts +9 -0
  9. package/dist/{day-iso-id.vo.js → src/day-iso-id.vo.js} +4 -8
  10. package/dist/{day.vo.js → src/day.vo.js} +7 -6
  11. package/dist/src/directory-path-absolute.vo.d.ts +12 -0
  12. package/dist/{directory-path-absolute.vo.js → src/directory-path-absolute.vo.js} +5 -12
  13. package/dist/src/directory-path-relative.vo.d.ts +12 -0
  14. package/dist/{directory-path-relative.vo.js → src/directory-path-relative.vo.js} +5 -12
  15. package/dist/src/distance-value.vo.d.ts +7 -0
  16. package/dist/src/distance-value.vo.js +5 -0
  17. package/dist/{distance.vo.js → src/distance.vo.js} +7 -6
  18. package/dist/src/division-factor.vo.d.ts +7 -0
  19. package/dist/src/division-factor.vo.js +5 -0
  20. package/dist/src/duration-ms.vo.d.ts +6 -0
  21. package/dist/src/duration-ms.vo.js +5 -0
  22. package/dist/{duration.service.js → src/duration.service.js} +2 -1
  23. package/dist/src/email.vo.d.ts +6 -0
  24. package/dist/src/email.vo.js +4 -0
  25. package/dist/{etags.vo.js → src/etags.vo.js} +3 -2
  26. package/dist/src/extension.vo.d.ts +9 -0
  27. package/dist/src/extension.vo.js +15 -0
  28. package/dist/src/feature-flag-value.vo.d.ts +10 -0
  29. package/dist/{feature-flag-value.vo.js → src/feature-flag-value.vo.js} +2 -2
  30. package/dist/src/file-path-absolute-schema.vo.d.ts +17 -0
  31. package/dist/{file-path-absolute-schema.vo.js → src/file-path-absolute-schema.vo.js} +6 -13
  32. package/dist/src/file-path-relative-schema.vo.d.ts +17 -0
  33. package/dist/{file-path-relative-schema.vo.js → src/file-path-relative-schema.vo.js} +6 -13
  34. package/dist/{file-path.vo.js → src/file-path.vo.js} +5 -4
  35. package/dist/src/filename-affix.vo.d.ts +13 -0
  36. package/dist/{filename-affix.vo.js → src/filename-affix.vo.js} +4 -9
  37. package/dist/src/filename-from-string.vo.d.ts +10 -0
  38. package/dist/{filename-from-string.vo.js → src/filename-from-string.vo.js} +5 -8
  39. package/dist/{filename.vo.js → src/filename.vo.js} +8 -7
  40. package/dist/src/height-milimiters.vo.d.ts +7 -0
  41. package/dist/src/height-milimiters.vo.js +8 -0
  42. package/dist/{height.vo.js → src/height.vo.js} +4 -3
  43. package/dist/src/hour-value.vo.d.ts +7 -0
  44. package/dist/src/hour-value.vo.js +5 -0
  45. package/dist/{hour.vo.js → src/hour.vo.js} +3 -2
  46. package/dist/src/iban-schema.vo.d.ts +7 -0
  47. package/dist/src/iban-schema.vo.js +7 -0
  48. package/dist/{iban.vo.js → src/iban.vo.js} +2 -1
  49. package/dist/src/image.vo.d.ts +13 -0
  50. package/dist/src/image.vo.js +10 -0
  51. package/dist/src/integer-non-negative.vo.d.ts +7 -0
  52. package/dist/src/integer-non-negative.vo.js +8 -0
  53. package/dist/src/integer-positive.vo.d.ts +7 -0
  54. package/dist/src/integer-positive.vo.js +5 -0
  55. package/dist/src/integer.vo.d.ts +6 -0
  56. package/dist/src/integer.vo.js +4 -0
  57. package/dist/src/language.vo.d.ts +7 -0
  58. package/dist/{language.vo.js → src/language.vo.js} +2 -2
  59. package/dist/src/mime-value.vo.d.ts +7 -0
  60. package/dist/{mime-value.vo.js → src/mime-value.vo.js} +4 -7
  61. package/dist/{mime.vo.js → src/mime.vo.js} +2 -1
  62. package/dist/src/mimes.js +19 -0
  63. package/dist/src/minute-value.vo.d.ts +7 -0
  64. package/dist/src/minute-value.vo.js +5 -0
  65. package/dist/{minute.vo.js → src/minute.vo.js} +3 -2
  66. package/dist/src/money-amount.vo.d.ts +7 -0
  67. package/dist/src/money-amount.vo.js +5 -0
  68. package/dist/{money.vo.js → src/money.vo.js} +7 -6
  69. package/dist/src/month-iso-id.vo.d.ts +8 -0
  70. package/dist/{month-iso-id.vo.js → src/month-iso-id.vo.js} +5 -9
  71. package/dist/{month.vo.js → src/month.vo.js} +5 -4
  72. package/dist/src/multiplication-factor.vo.d.ts +7 -0
  73. package/dist/src/multiplication-factor.vo.js +8 -0
  74. package/dist/src/object-key.vo.d.ts +11 -0
  75. package/dist/src/object-key.vo.js +19 -0
  76. package/dist/src/package-version-schema.vo.d.ts +8 -0
  77. package/dist/{package-version-schema.vo.js → src/package-version-schema.vo.js} +4 -7
  78. package/dist/{package-version.vo.js → src/package-version.vo.js} +3 -4
  79. package/dist/src/pagination-page.vo.d.ts +6 -0
  80. package/dist/src/pagination-page.vo.js +3 -0
  81. package/dist/src/pagination-skip.vo.d.ts +7 -0
  82. package/dist/src/pagination-skip.vo.js +3 -0
  83. package/dist/src/pagination-take.vo.d.ts +7 -0
  84. package/dist/src/pagination-take.vo.js +3 -0
  85. package/dist/{pagination.service.js → src/pagination.service.js} +8 -7
  86. package/dist/src/quarter-iso-id.vo.d.ts +8 -0
  87. package/dist/src/quarter-iso-id.vo.js +7 -0
  88. package/dist/{quarter.vo.js → src/quarter.vo.js} +3 -2
  89. package/dist/src/reordering-item-position-value.vo.d.ts +6 -0
  90. package/dist/src/reordering-item-position-value.vo.js +3 -0
  91. package/dist/{reordering.service.d.ts → src/reordering.service.d.ts} +9 -9
  92. package/dist/{reordering.service.js → src/reordering.service.js} +7 -7
  93. package/dist/src/revision-value.vo.d.ts +7 -0
  94. package/dist/src/revision-value.vo.js +3 -0
  95. package/dist/{revision.vo.js → src/revision.vo.js} +3 -2
  96. package/dist/{rounding-decimal.strategy.d.ts → src/rounding-decimal.strategy.d.ts} +2 -2
  97. package/dist/src/rounding-decimal.strategy.js +14 -0
  98. package/dist/src/size-bytes.vo.d.ts +6 -0
  99. package/dist/src/size-bytes.vo.js +5 -0
  100. package/dist/{size.vo.js → src/size.vo.js} +5 -4
  101. package/dist/src/time-zone-offset-value.vo.d.ts +8 -0
  102. package/dist/src/time-zone-offset-value.vo.js +13 -0
  103. package/dist/src/timestamp-value.vo.d.ts +6 -0
  104. package/dist/src/timestamp-value.vo.js +5 -0
  105. package/dist/{timestamp.vo.js → src/timestamp.vo.js} +2 -1
  106. package/dist/src/timezone.vo.d.ts +9 -0
  107. package/dist/{timezone.vo.js → src/timezone.vo.js} +7 -10
  108. package/dist/src/url-with-slash.vo.d.ts +6 -0
  109. package/dist/src/url-with-slash.vo.js +5 -0
  110. package/dist/src/url-without-slash.vo.d.ts +6 -0
  111. package/dist/src/url-without-slash.vo.js +5 -0
  112. package/dist/src/week-iso-id.vo.d.ts +8 -0
  113. package/dist/{week-iso-id.vo.js → src/week-iso-id.vo.js} +5 -9
  114. package/dist/{week.vo.js → src/week.vo.js} +5 -4
  115. package/dist/src/weekday-iso-id.vo.d.ts +7 -0
  116. package/dist/src/weekday-iso-id.vo.js +5 -0
  117. package/dist/{weekday.vo.js → src/weekday.vo.js} +9 -8
  118. package/dist/src/weight-grams.vo.d.ts +7 -0
  119. package/dist/src/weight-grams.vo.js +5 -0
  120. package/dist/{weight.vo.js → src/weight.vo.js} +8 -7
  121. package/dist/src/year-iso-id.vo.d.ts +7 -0
  122. package/dist/src/year-iso-id.vo.js +7 -0
  123. package/dist/{year.vo.js → src/year.vo.js} +6 -5
  124. package/dist/tests/age-years.vo.test.d.ts +1 -0
  125. package/dist/tests/age-years.vo.test.js +24 -0
  126. package/dist/tests/age.vo.test.d.ts +1 -0
  127. package/dist/tests/age.vo.test.js +106 -0
  128. package/dist/tests/api-key.vo.test.d.ts +1 -0
  129. package/dist/tests/api-key.vo.test.js +24 -0
  130. package/dist/tests/basename.vo.test.d.ts +1 -0
  131. package/dist/tests/basename.vo.test.js +53 -0
  132. package/dist/tests/batch.test.d.ts +1 -0
  133. package/dist/tests/batch.test.js +24 -0
  134. package/dist/tests/date-calculator.service.test.d.ts +1 -0
  135. package/dist/tests/date-calculator.service.test.js +32 -0
  136. package/dist/tests/date-formatter.service.test.d.ts +1 -0
  137. package/dist/tests/date-formatter.service.test.js +22 -0
  138. package/dist/tests/date-range.vo.test.d.ts +1 -0
  139. package/dist/tests/date-range.vo.test.js +49 -0
  140. package/dist/tests/day-iso-id.vo.test.d.ts +1 -0
  141. package/dist/tests/day-iso-id.vo.test.js +36 -0
  142. package/dist/tests/day.vo.test.d.ts +1 -0
  143. package/dist/tests/day.vo.test.js +68 -0
  144. package/dist/tests/directory-path-absolute.vo.test.d.ts +1 -0
  145. package/dist/tests/directory-path-absolute.vo.test.js +47 -0
  146. package/dist/tests/directory-path-relative.vo.test.d.ts +1 -0
  147. package/dist/tests/directory-path-relative.vo.test.js +44 -0
  148. package/dist/tests/distance-value.vo.test.d.ts +1 -0
  149. package/dist/tests/distance-value.vo.test.js +21 -0
  150. package/dist/tests/distance.vo.test.d.ts +1 -0
  151. package/dist/tests/distance.vo.test.js +74 -0
  152. package/dist/tests/division-factor.vo.test.d.ts +1 -0
  153. package/dist/tests/division-factor.vo.test.js +21 -0
  154. package/dist/tests/dll.service.test.d.ts +1 -0
  155. package/dist/tests/dll.service.test.js +381 -0
  156. package/dist/tests/duration-ms.vo.test.d.ts +1 -0
  157. package/dist/tests/duration-ms.vo.test.js +18 -0
  158. package/dist/tests/duration.service.test.d.ts +1 -0
  159. package/dist/tests/duration.service.test.js +126 -0
  160. package/dist/tests/email-mask.service.test.d.ts +1 -0
  161. package/dist/tests/email-mask.service.test.js +15 -0
  162. package/dist/tests/email.vo.test.d.ts +1 -0
  163. package/dist/tests/email.vo.test.js +17 -0
  164. package/dist/tests/etags.vo.test.d.ts +1 -0
  165. package/dist/tests/etags.vo.test.js +54 -0
  166. package/dist/tests/extension.vo.test.d.ts +1 -0
  167. package/dist/tests/extension.vo.test.js +51 -0
  168. package/dist/tests/feature-flag-value.vo.test.d.ts +1 -0
  169. package/dist/tests/feature-flag-value.vo.test.js +12 -0
  170. package/dist/tests/feature-flag.vo.test.d.ts +1 -0
  171. package/dist/tests/feature-flag.vo.test.js +13 -0
  172. package/dist/tests/file-path-absolute-schema.vo.test.d.ts +1 -0
  173. package/dist/tests/file-path-absolute-schema.vo.test.js +53 -0
  174. package/dist/tests/file-path-relative-schema.vo.test.d.ts +1 -0
  175. package/dist/tests/file-path-relative-schema.vo.test.js +52 -0
  176. package/dist/tests/file-path.vo.test.d.ts +1 -0
  177. package/dist/tests/file-path.vo.test.js +74 -0
  178. package/dist/tests/filename-affix.vo.test.d.ts +1 -0
  179. package/dist/tests/filename-affix.vo.test.js +30 -0
  180. package/dist/tests/filename-from-string.vo.test.d.ts +1 -0
  181. package/dist/tests/filename-from-string.vo.test.js +37 -0
  182. package/dist/tests/filename.vo.test.d.ts +1 -0
  183. package/dist/tests/filename.vo.test.js +93 -0
  184. package/dist/tests/height-milimiters.vo.test.d.ts +1 -0
  185. package/dist/tests/height-milimiters.vo.test.js +21 -0
  186. package/dist/tests/height.vo.test.d.ts +1 -0
  187. package/dist/tests/height.vo.test.js +64 -0
  188. package/dist/tests/hour-value.vo.test.d.ts +1 -0
  189. package/dist/tests/hour-value.vo.test.js +24 -0
  190. package/dist/tests/hour.vo.test.d.ts +1 -0
  191. package/dist/tests/hour.vo.test.js +64 -0
  192. package/dist/tests/iban-mask.service.test.d.ts +1 -0
  193. package/dist/tests/iban-mask.service.test.js +13 -0
  194. package/dist/tests/iban-schema.vo.test.d.ts +1 -0
  195. package/dist/tests/iban-schema.vo.test.js +43 -0
  196. package/dist/tests/iban.vo.test.d.ts +1 -0
  197. package/dist/tests/iban.vo.test.js +46 -0
  198. package/dist/tests/image.vo.test.d.ts +1 -0
  199. package/dist/tests/image.vo.test.js +41 -0
  200. package/dist/tests/integer-non-negative.vo.test.d.ts +1 -0
  201. package/dist/tests/integer-non-negative.vo.test.js +22 -0
  202. package/dist/tests/integer-positive.vo.test.d.ts +1 -0
  203. package/dist/tests/integer-positive.vo.test.js +21 -0
  204. package/dist/tests/integer.vo.test.d.ts +1 -0
  205. package/dist/tests/integer.vo.test.js +21 -0
  206. package/dist/tests/language.vo.test.d.ts +1 -0
  207. package/dist/tests/language.vo.test.js +28 -0
  208. package/dist/tests/linear-regression.service.test.d.ts +1 -0
  209. package/dist/tests/linear-regression.service.test.js +111 -0
  210. package/dist/tests/mean.service.test.d.ts +1 -0
  211. package/dist/tests/mean.service.test.js +23 -0
  212. package/dist/tests/mime-registry-entry.vo.test.d.ts +1 -0
  213. package/dist/tests/mime-registry-entry.vo.test.js +15 -0
  214. package/dist/tests/mime-registry.service.test.d.ts +1 -0
  215. package/dist/tests/mime-registry.service.test.js +45 -0
  216. package/dist/tests/mime-value.vo.test.d.ts +1 -0
  217. package/dist/tests/mime-value.vo.test.js +49 -0
  218. package/dist/tests/mime.vo.test.d.ts +1 -0
  219. package/dist/tests/mime.vo.test.js +53 -0
  220. package/dist/tests/mimes.test.d.ts +1 -0
  221. package/dist/tests/mimes.test.js +28 -0
  222. package/dist/tests/min-max-scaler.service.test.d.ts +1 -0
  223. package/dist/tests/min-max-scaler.service.test.js +116 -0
  224. package/dist/tests/minute-value.vo.test.d.ts +1 -0
  225. package/dist/tests/minute-value.vo.test.js +24 -0
  226. package/dist/tests/minute.vo.test.d.ts +1 -0
  227. package/dist/tests/minute.vo.test.js +64 -0
  228. package/dist/tests/mocks.d.ts +6 -0
  229. package/dist/tests/mocks.js +7 -0
  230. package/dist/tests/money-amount.vo.test.d.ts +1 -0
  231. package/dist/tests/money-amount.vo.test.js +21 -0
  232. package/dist/tests/money.vo.test.d.ts +1 -0
  233. package/dist/tests/money.vo.test.js +90 -0
  234. package/dist/tests/month-iso-id.vo.test.d.ts +1 -0
  235. package/dist/tests/month-iso-id.vo.test.js +36 -0
  236. package/dist/tests/month.vo.test.d.ts +1 -0
  237. package/dist/tests/month.vo.test.js +65 -0
  238. package/dist/tests/multiplication-factor.vo.test.d.ts +1 -0
  239. package/dist/tests/multiplication-factor.vo.test.js +19 -0
  240. package/dist/tests/noop.test.d.ts +1 -0
  241. package/dist/tests/noop.test.js +12 -0
  242. package/dist/tests/object-key.vo.test.d.ts +1 -0
  243. package/dist/tests/object-key.vo.test.js +56 -0
  244. package/dist/tests/outlier-detector.service.test.d.ts +1 -0
  245. package/dist/tests/outlier-detector.service.test.js +35 -0
  246. package/dist/tests/package-version-schema.vo.test.d.ts +1 -0
  247. package/dist/tests/package-version-schema.vo.test.js +32 -0
  248. package/dist/tests/package-version.vo.test.d.ts +1 -0
  249. package/dist/tests/package-version.vo.test.js +138 -0
  250. package/dist/tests/pagination-page.vo.test.d.ts +1 -0
  251. package/dist/tests/pagination-page.vo.test.js +26 -0
  252. package/dist/tests/pagination-skip.vo.test.d.ts +1 -0
  253. package/dist/tests/pagination-skip.vo.test.js +23 -0
  254. package/dist/tests/pagination-take.vo.test.d.ts +1 -0
  255. package/dist/tests/pagination-take.vo.test.js +25 -0
  256. package/dist/tests/pagination.service.test.d.ts +1 -0
  257. package/dist/tests/pagination.service.test.js +92 -0
  258. package/dist/tests/percentage.service.test.d.ts +1 -0
  259. package/dist/tests/percentage.service.test.js +16 -0
  260. package/dist/tests/population-standard-deviation.service.test.d.ts +1 -0
  261. package/dist/tests/population-standard-deviation.service.test.js +20 -0
  262. package/dist/tests/quarter-iso-id.vo.test.d.ts +1 -0
  263. package/dist/tests/quarter-iso-id.vo.test.js +30 -0
  264. package/dist/tests/quarter.vo.test.d.ts +1 -0
  265. package/dist/tests/quarter.vo.test.js +54 -0
  266. package/dist/tests/random.service.test.d.ts +1 -0
  267. package/dist/tests/random.service.test.js +93 -0
  268. package/dist/tests/rate-limiter.service.test.d.ts +1 -0
  269. package/dist/tests/rate-limiter.service.test.js +39 -0
  270. package/dist/tests/relative-date.vo.test.d.ts +1 -0
  271. package/dist/tests/relative-date.vo.test.js +22 -0
  272. package/dist/tests/reordering-item-position-value.vo.test.d.ts +1 -0
  273. package/dist/tests/reordering-item-position-value.vo.test.js +21 -0
  274. package/dist/tests/reordering.service.test.d.ts +1 -0
  275. package/dist/tests/reordering.service.test.js +76 -0
  276. package/dist/tests/repeat.test.d.ts +1 -0
  277. package/dist/tests/repeat.test.js +8 -0
  278. package/dist/tests/revision-value.vo.test.d.ts +1 -0
  279. package/dist/tests/revision-value.vo.test.js +21 -0
  280. package/dist/tests/revision.vo.test.d.ts +1 -0
  281. package/dist/tests/revision.vo.test.js +52 -0
  282. package/dist/tests/rounding-decimal.strategy.test.d.ts +1 -0
  283. package/dist/tests/rounding-decimal.strategy.test.js +17 -0
  284. package/dist/tests/rounding-down.strategy.test.d.ts +1 -0
  285. package/dist/tests/rounding-down.strategy.test.js +9 -0
  286. package/dist/tests/rounding-to-nearest.strategy.test.d.ts +1 -0
  287. package/dist/tests/rounding-to-nearest.strategy.test.js +9 -0
  288. package/dist/tests/rounding-up.strategy.test.d.ts +1 -0
  289. package/dist/tests/rounding-up.strategy.test.js +9 -0
  290. package/dist/tests/size-bytes.vo.test.d.ts +1 -0
  291. package/dist/tests/size-bytes.vo.test.js +21 -0
  292. package/dist/tests/size.vo.test.d.ts +1 -0
  293. package/dist/tests/size.vo.test.js +93 -0
  294. package/dist/tests/slug.service.test.d.ts +1 -0
  295. package/dist/tests/slug.service.test.js +45 -0
  296. package/dist/tests/sum.service.test.d.ts +1 -0
  297. package/dist/tests/sum.service.test.js +22 -0
  298. package/dist/tests/thousands-separator.service.test.d.ts +1 -0
  299. package/dist/tests/thousands-separator.service.test.js +27 -0
  300. package/dist/tests/time-zone-offset-value.test.d.ts +1 -0
  301. package/dist/tests/time-zone-offset-value.test.js +27 -0
  302. package/dist/tests/timestamp-value.vo.test.d.ts +1 -0
  303. package/dist/tests/timestamp-value.vo.test.js +21 -0
  304. package/dist/tests/timestamp.vo.test.d.ts +1 -0
  305. package/dist/tests/timestamp.vo.test.js +73 -0
  306. package/dist/tests/timezone.vo.test.d.ts +1 -0
  307. package/dist/tests/timezone.vo.test.js +29 -0
  308. package/dist/tests/url-with-slash.vo.test.d.ts +1 -0
  309. package/dist/tests/url-with-slash.vo.test.js +24 -0
  310. package/dist/tests/url-without-slash.vo.test.d.ts +1 -0
  311. package/dist/tests/url-without-slash.vo.test.js +25 -0
  312. package/dist/tests/visually-unambiguous-characters-generator.service.test.d.ts +1 -0
  313. package/dist/tests/visually-unambiguous-characters-generator.service.test.js +89 -0
  314. package/dist/tests/week-iso-id.vo.test.d.ts +1 -0
  315. package/dist/tests/week-iso-id.vo.test.js +37 -0
  316. package/dist/tests/week.vo.test.d.ts +1 -0
  317. package/dist/tests/week.vo.test.js +64 -0
  318. package/dist/tests/weekday-iso-id.vo.test.d.ts +1 -0
  319. package/dist/tests/weekday-iso-id.vo.test.js +24 -0
  320. package/dist/tests/weekday.vo.test.d.ts +1 -0
  321. package/dist/tests/weekday.vo.test.js +51 -0
  322. package/dist/tests/weight-grams.vo.test.d.ts +1 -0
  323. package/dist/tests/weight-grams.vo.test.js +21 -0
  324. package/dist/tests/weight.vo.test.d.ts +1 -0
  325. package/dist/tests/weight.vo.test.js +66 -0
  326. package/dist/tests/year-iso-id.vo.test.d.ts +1 -0
  327. package/dist/tests/year-iso-id.vo.test.js +23 -0
  328. package/dist/tests/year.vo.test.d.ts +1 -0
  329. package/dist/tests/year.vo.test.js +79 -0
  330. package/dist/tests/z-score.service.test.d.ts +1 -0
  331. package/dist/tests/z-score.service.test.js +26 -0
  332. package/dist/tsconfig.tsbuildinfo +1 -1
  333. package/package.json +9 -12
  334. package/dist/age-years.vo.d.ts +0 -11
  335. package/dist/age-years.vo.js +0 -11
  336. package/dist/api-key.vo.d.ts +0 -8
  337. package/dist/api-key.vo.js +0 -11
  338. package/dist/basename.vo.d.ts +0 -12
  339. package/dist/basename.vo.js +0 -27
  340. package/dist/day-iso-id.vo.d.ts +0 -9
  341. package/dist/directory-path-absolute.vo.d.ts +0 -12
  342. package/dist/directory-path-relative.vo.d.ts +0 -12
  343. package/dist/distance-value.vo.d.ts +0 -7
  344. package/dist/distance-value.vo.js +0 -9
  345. package/dist/division-factor.vo.d.ts +0 -7
  346. package/dist/division-factor.vo.js +0 -8
  347. package/dist/duration-ms.vo.d.ts +0 -6
  348. package/dist/duration-ms.vo.js +0 -4
  349. package/dist/email.vo.d.ts +0 -6
  350. package/dist/email.vo.js +0 -4
  351. package/dist/extension.vo.d.ts +0 -9
  352. package/dist/extension.vo.js +0 -21
  353. package/dist/feature-flag-value.vo.d.ts +0 -10
  354. package/dist/file-path-absolute-schema.vo.d.ts +0 -14
  355. package/dist/file-path-relative-schema.vo.d.ts +0 -14
  356. package/dist/filename-affix.vo.d.ts +0 -13
  357. package/dist/filename-from-string.vo.d.ts +0 -10
  358. package/dist/height-milimiters.vo.d.ts +0 -7
  359. package/dist/height-milimiters.vo.js +0 -12
  360. package/dist/hour-value.vo.d.ts +0 -7
  361. package/dist/hour-value.vo.js +0 -10
  362. package/dist/iban-schema.vo.d.ts +0 -7
  363. package/dist/iban-schema.vo.js +0 -12
  364. package/dist/image.vo.d.ts +0 -13
  365. package/dist/image.vo.js +0 -20
  366. package/dist/integer-non-negative.vo.d.ts +0 -7
  367. package/dist/integer-non-negative.vo.js +0 -12
  368. package/dist/integer-positive.vo.d.ts +0 -7
  369. package/dist/integer-positive.vo.js +0 -9
  370. package/dist/integer.vo.d.ts +0 -6
  371. package/dist/integer.vo.js +0 -4
  372. package/dist/language.vo.d.ts +0 -7
  373. package/dist/mime-value.vo.d.ts +0 -6
  374. package/dist/mimes.js +0 -18
  375. package/dist/minute-value.vo.d.ts +0 -7
  376. package/dist/minute-value.vo.js +0 -10
  377. package/dist/money-amount.vo.d.ts +0 -7
  378. package/dist/money-amount.vo.js +0 -9
  379. package/dist/month-iso-id.vo.d.ts +0 -8
  380. package/dist/multiplication-factor.vo.d.ts +0 -7
  381. package/dist/multiplication-factor.vo.js +0 -11
  382. package/dist/object-key.vo.d.ts +0 -11
  383. package/dist/object-key.vo.js +0 -24
  384. package/dist/package-version-schema.vo.d.ts +0 -8
  385. package/dist/pagination-page.vo.d.ts +0 -6
  386. package/dist/pagination-page.vo.js +0 -7
  387. package/dist/pagination-skip.vo.d.ts +0 -7
  388. package/dist/pagination-skip.vo.js +0 -6
  389. package/dist/pagination-take.vo.d.ts +0 -7
  390. package/dist/pagination-take.vo.js +0 -6
  391. package/dist/quarter-iso-id.vo.d.ts +0 -7
  392. package/dist/quarter-iso-id.vo.js +0 -11
  393. package/dist/reordering-item-position-value.vo.d.ts +0 -6
  394. package/dist/reordering-item-position-value.vo.js +0 -6
  395. package/dist/revision-value.vo.d.ts +0 -7
  396. package/dist/revision-value.vo.js +0 -6
  397. package/dist/rounding-decimal.strategy.js +0 -19
  398. package/dist/size-bytes.vo.d.ts +0 -6
  399. package/dist/size-bytes.vo.js +0 -9
  400. package/dist/time-zone-offset-value.vo.d.ts +0 -8
  401. package/dist/time-zone-offset-value.vo.js +0 -17
  402. package/dist/timestamp-value.vo.d.ts +0 -6
  403. package/dist/timestamp-value.vo.js +0 -9
  404. package/dist/timezone.vo.d.ts +0 -9
  405. package/dist/url-with-slash.vo.d.ts +0 -6
  406. package/dist/url-with-slash.vo.js +0 -8
  407. package/dist/url-without-slash.vo.d.ts +0 -6
  408. package/dist/url-without-slash.vo.js +0 -8
  409. package/dist/week-iso-id.vo.d.ts +0 -8
  410. package/dist/weekday-iso-id.vo.d.ts +0 -7
  411. package/dist/weekday-iso-id.vo.js +0 -10
  412. package/dist/weight-grams.vo.d.ts +0 -7
  413. package/dist/weight-grams.vo.js +0 -9
  414. package/dist/year-iso-id.vo.d.ts +0 -7
  415. package/dist/year-iso-id.vo.js +0 -10
  416. package/dist/{age.vo.d.ts → src/age.vo.d.ts} +0 -0
  417. package/dist/{batch.d.ts → src/batch.d.ts} +0 -0
  418. package/dist/{batch.js → src/batch.js} +0 -0
  419. package/dist/{date-calculator.service.d.ts → src/date-calculator.service.d.ts} +0 -0
  420. package/dist/{date-calculator.service.js → src/date-calculator.service.js} +0 -0
  421. package/dist/{date-formatter.service.d.ts → src/date-formatter.service.d.ts} +0 -0
  422. package/dist/{date-formatter.service.js → src/date-formatter.service.js} +0 -0
  423. package/dist/{date-range.vo.d.ts → src/date-range.vo.d.ts} +0 -0
  424. package/dist/{date-range.vo.js → src/date-range.vo.js} +0 -0
  425. package/dist/{day.vo.d.ts → src/day.vo.d.ts} +1 -1
  426. /package/dist/{distance.vo.d.ts → src/distance.vo.d.ts} +0 -0
  427. /package/dist/{dll.service.d.ts → src/dll.service.d.ts} +0 -0
  428. /package/dist/{dll.service.js → src/dll.service.js} +0 -0
  429. /package/dist/{duration.service.d.ts → src/duration.service.d.ts} +0 -0
  430. /package/dist/{email-mask.service.d.ts → src/email-mask.service.d.ts} +0 -0
  431. /package/dist/{email-mask.service.js → src/email-mask.service.js} +0 -0
  432. /package/dist/{etags.vo.d.ts → src/etags.vo.d.ts} +0 -0
  433. /package/dist/{feature-flag.vo.d.ts → src/feature-flag.vo.d.ts} +0 -0
  434. /package/dist/{feature-flag.vo.js → src/feature-flag.vo.js} +0 -0
  435. /package/dist/{file-path.vo.d.ts → src/file-path.vo.d.ts} +0 -0
  436. /package/dist/{filename.vo.d.ts → src/filename.vo.d.ts} +0 -0
  437. /package/dist/{height.vo.d.ts → src/height.vo.d.ts} +0 -0
  438. /package/dist/{hour.vo.d.ts → src/hour.vo.d.ts} +0 -0
  439. /package/dist/{iban-mask.service.d.ts → src/iban-mask.service.d.ts} +0 -0
  440. /package/dist/{iban-mask.service.js → src/iban-mask.service.js} +0 -0
  441. /package/dist/{iban.vo.d.ts → src/iban.vo.d.ts} +0 -0
  442. /package/dist/{index.d.ts → src/index.d.ts} +0 -0
  443. /package/dist/{index.js → src/index.js} +0 -0
  444. /package/dist/{linear-regression.service.d.ts → src/linear-regression.service.d.ts} +0 -0
  445. /package/dist/{linear-regression.service.js → src/linear-regression.service.js} +0 -0
  446. /package/dist/{mean.service.d.ts → src/mean.service.d.ts} +0 -0
  447. /package/dist/{mean.service.js → src/mean.service.js} +0 -0
  448. /package/dist/{mime-registry-entry.vo.d.ts → src/mime-registry-entry.vo.d.ts} +0 -0
  449. /package/dist/{mime-registry-entry.vo.js → src/mime-registry-entry.vo.js} +0 -0
  450. /package/dist/{mime-registry.service.d.ts → src/mime-registry.service.d.ts} +0 -0
  451. /package/dist/{mime-registry.service.js → src/mime-registry.service.js} +0 -0
  452. /package/dist/{mime.vo.d.ts → src/mime.vo.d.ts} +0 -0
  453. /package/dist/{mimes.d.ts → src/mimes.d.ts} +0 -0
  454. /package/dist/{min-max-scaler.service.d.ts → src/min-max-scaler.service.d.ts} +0 -0
  455. /package/dist/{min-max-scaler.service.js → src/min-max-scaler.service.js} +0 -0
  456. /package/dist/{minute.vo.d.ts → src/minute.vo.d.ts} +0 -0
  457. /package/dist/{money.vo.d.ts → src/money.vo.d.ts} +0 -0
  458. /package/dist/{month.vo.d.ts → src/month.vo.d.ts} +0 -0
  459. /package/dist/{noop.service.d.ts → src/noop.service.d.ts} +0 -0
  460. /package/dist/{noop.service.js → src/noop.service.js} +0 -0
  461. /package/dist/{outlier-detector.service.d.ts → src/outlier-detector.service.d.ts} +0 -0
  462. /package/dist/{outlier-detector.service.js → src/outlier-detector.service.js} +0 -0
  463. /package/dist/{package-version.vo.d.ts → src/package-version.vo.d.ts} +0 -0
  464. /package/dist/{pagination.service.d.ts → src/pagination.service.d.ts} +0 -0
  465. /package/dist/{percentage.service.d.ts → src/percentage.service.d.ts} +0 -0
  466. /package/dist/{percentage.service.js → src/percentage.service.js} +0 -0
  467. /package/dist/{population-standard-deviation.service.d.ts → src/population-standard-deviation.service.d.ts} +0 -0
  468. /package/dist/{population-standard-deviation.service.js → src/population-standard-deviation.service.js} +0 -0
  469. /package/dist/{quarter.vo.d.ts → src/quarter.vo.d.ts} +0 -0
  470. /package/dist/{random.service.d.ts → src/random.service.d.ts} +0 -0
  471. /package/dist/{random.service.js → src/random.service.js} +0 -0
  472. /package/dist/{rate-limiter.service.d.ts → src/rate-limiter.service.d.ts} +0 -0
  473. /package/dist/{rate-limiter.service.js → src/rate-limiter.service.js} +0 -0
  474. /package/dist/{relative-date.vo.d.ts → src/relative-date.vo.d.ts} +0 -0
  475. /package/dist/{relative-date.vo.js → src/relative-date.vo.js} +0 -0
  476. /package/dist/{repeat.d.ts → src/repeat.d.ts} +0 -0
  477. /package/dist/{repeat.js → src/repeat.js} +0 -0
  478. /package/dist/{revision.vo.d.ts → src/revision.vo.d.ts} +0 -0
  479. /package/dist/{rounding-down.strategy.d.ts → src/rounding-down.strategy.d.ts} +0 -0
  480. /package/dist/{rounding-down.strategy.js → src/rounding-down.strategy.js} +0 -0
  481. /package/dist/{rounding-to-nearest.strategy.d.ts → src/rounding-to-nearest.strategy.d.ts} +0 -0
  482. /package/dist/{rounding-to-nearest.strategy.js → src/rounding-to-nearest.strategy.js} +0 -0
  483. /package/dist/{rounding-up.strategy.d.ts → src/rounding-up.strategy.d.ts} +0 -0
  484. /package/dist/{rounding-up.strategy.js → src/rounding-up.strategy.js} +0 -0
  485. /package/dist/{rounding.strategy.d.ts → src/rounding.strategy.d.ts} +0 -0
  486. /package/dist/{rounding.strategy.js → src/rounding.strategy.js} +0 -0
  487. /package/dist/{size.vo.d.ts → src/size.vo.d.ts} +0 -0
  488. /package/dist/{slug.service.d.ts → src/slug.service.d.ts} +0 -0
  489. /package/dist/{slug.service.js → src/slug.service.js} +0 -0
  490. /package/dist/{sum.service.d.ts → src/sum.service.d.ts} +0 -0
  491. /package/dist/{sum.service.js → src/sum.service.js} +0 -0
  492. /package/dist/{thousands-separator.service.d.ts → src/thousands-separator.service.d.ts} +0 -0
  493. /package/dist/{thousands-separator.service.js → src/thousands-separator.service.js} +0 -0
  494. /package/dist/{timestamp.vo.d.ts → src/timestamp.vo.d.ts} +0 -0
  495. /package/dist/{ts-utils.d.ts → src/ts-utils.d.ts} +0 -0
  496. /package/dist/{ts-utils.js → src/ts-utils.js} +0 -0
  497. /package/dist/{visually-unambiguous-characters-generator.service.d.ts → src/visually-unambiguous-characters-generator.service.d.ts} +0 -0
  498. /package/dist/{visually-unambiguous-characters-generator.service.js → src/visually-unambiguous-characters-generator.service.js} +0 -0
  499. /package/dist/{week.vo.d.ts → src/week.vo.d.ts} +0 -0
  500. /package/dist/{weekday.vo.d.ts → src/weekday.vo.d.ts} +0 -0
  501. /package/dist/{weight.vo.d.ts → src/weight.vo.d.ts} +0 -0
  502. /package/dist/{year.vo.d.ts → src/year.vo.d.ts} +0 -0
  503. /package/dist/{z-score.service.d.ts → src/z-score.service.d.ts} +0 -0
  504. /package/dist/{z-score.service.js → src/z-score.service.js} +0 -0
@@ -0,0 +1,53 @@
1
+ import { describe, expect, test } from "bun:test";
2
+ import { Mime } from "../src/mime.vo";
3
+ describe("Mime", () => {
4
+ test("fromString", () => {
5
+ const mime = Mime.fromString("text/plain");
6
+ expect(mime.type).toEqual("text");
7
+ expect(mime.subtype).toEqual("plain");
8
+ });
9
+ test("fromString - trimmed", () => {
10
+ const mime = Mime.fromString("text/plain ");
11
+ expect(mime.type).toEqual("text");
12
+ expect(mime.subtype).toEqual("plain");
13
+ });
14
+ test("strips semicolon separated mime metadata", () => {
15
+ expect(Mime.fromString("text/plain; charset=UTF-8").toString()).toEqual("text/plain");
16
+ });
17
+ test("throws InvalidMimeError for invalid input", () => {
18
+ expect(() => Mime.fromString("")).toThrow("mime.value.invalid");
19
+ expect(() => Mime.fromString("/subtype")).toThrow("mime.value.invalid");
20
+ expect(() => Mime.fromString("type/")).toThrow("mime.value.invalid");
21
+ expect(() => Mime.fromString("no-slash")).toThrow("mime.value.invalid");
22
+ });
23
+ test("isSatisfiedBy - happy path", () => {
24
+ const textPlain = Mime.fromString("text/plain");
25
+ const textHtml = Mime.fromString("text/html");
26
+ const applicationJson = Mime.fromString("application/json");
27
+ const textWildcard = Mime.fromString("text/*");
28
+ const anyWildcard = Mime.fromString("*/*");
29
+ expect(textPlain.isSatisfiedBy(textHtml)).toEqual(false);
30
+ expect(textPlain.isSatisfiedBy(applicationJson)).toEqual(false);
31
+ expect(textPlain.isSatisfiedBy(textPlain)).toEqual(true);
32
+ expect(textWildcard.isSatisfiedBy(textPlain)).toEqual(true);
33
+ expect(anyWildcard.isSatisfiedBy(textPlain)).toEqual(true);
34
+ });
35
+ test("isSatisfiedBy - failures", () => {
36
+ const textPlain = Mime.fromString("text/plain");
37
+ const imageWildcard = Mime.fromString("image/*");
38
+ const wildcardPlain = Mime.fromString("*/plain");
39
+ const anyWildcard = Mime.fromString("*/*");
40
+ expect(textPlain.isSatisfiedBy(imageWildcard)).toEqual(false);
41
+ expect(textPlain.isSatisfiedBy(wildcardPlain)).toEqual(false);
42
+ expect(textPlain.isSatisfiedBy(anyWildcard)).toEqual(false);
43
+ expect(imageWildcard.isSatisfiedBy(wildcardPlain)).toEqual(false);
44
+ expect(imageWildcard.isSatisfiedBy(anyWildcard)).toEqual(false);
45
+ expect(wildcardPlain.isSatisfiedBy(anyWildcard)).toEqual(false);
46
+ });
47
+ test("toString", () => {
48
+ expect(Mime.fromString("text/plain").toString()).toEqual("text/plain");
49
+ });
50
+ test("toJSON", () => {
51
+ expect(Mime.fromString("text/plain").toJSON()).toEqual({ type: "text", subtype: "plain" });
52
+ });
53
+ });
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,28 @@
1
+ import { describe, expect, test } from "bun:test";
2
+ import * as v from "valibot";
3
+ import { Extension } from "../src/extension.vo";
4
+ import { Mimes } from "../src/mimes";
5
+ describe("Mimes", () => {
6
+ test("map", () => {
7
+ expect(Mimes.csv.mime.toString()).toEqual("text/csv");
8
+ expect(Mimes.csv.extensions).toEqual([v.parse(Extension, "csv")]);
9
+ expect(Mimes.jpg.mime.toString()).toEqual("image/jpeg");
10
+ expect(Mimes.jpg.extensions).toEqual([v.parse(Extension, "jpg"), v.parse(Extension, "jpeg")]);
11
+ expect(Mimes.markdown.mime.toString()).toEqual("text/markdown");
12
+ expect(Mimes.markdown.extensions).toEqual([v.parse(Extension, "md")]);
13
+ expect(Mimes.mp4.mime.toString()).toEqual("video/mp4");
14
+ expect(Mimes.mp4.extensions).toEqual([v.parse(Extension, "mp4")]);
15
+ expect(Mimes.pdf.mime.toString()).toEqual("application/pdf");
16
+ expect(Mimes.pdf.extensions).toEqual([v.parse(Extension, "pdf")]);
17
+ expect(Mimes.png.mime.toString()).toEqual("image/png");
18
+ expect(Mimes.png.extensions).toEqual([v.parse(Extension, "png")]);
19
+ expect(Mimes.text.mime.toString()).toEqual("text/plain");
20
+ expect(Mimes.text.extensions).toEqual([v.parse(Extension, "txt")]);
21
+ expect(Mimes.webp.mime.toString()).toEqual("image/webp");
22
+ expect(Mimes.webp.extensions).toEqual([v.parse(Extension, "webp")]);
23
+ expect(Mimes.wav.mime.toString()).toEqual("audio/wav");
24
+ expect(Mimes.wav.extensions).toEqual([v.parse(Extension, "wav")]);
25
+ expect(Mimes.zip.mime.toString()).toEqual("application/zip");
26
+ expect(Mimes.zip.extensions).toEqual([v.parse(Extension, "zip")]);
27
+ });
28
+ });
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,116 @@
1
+ import { describe, expect, test } from "bun:test";
2
+ import { MinMaxScaler } from "../src/min-max-scaler.service";
3
+ describe("MinMaxScaler", () => {
4
+ test("scale - default bound", () => {
5
+ const scaler = new MinMaxScaler({ min: 0, max: 100 });
6
+ const original = 50;
7
+ const scaled = 0.5;
8
+ const result = scaler.scale(original);
9
+ expect(result).toEqual({ scaled, original, isMin: false, isMax: false });
10
+ expect(scaler.descale(result.scaled)).toEqual({
11
+ isLowerBound: false,
12
+ isUpperBound: false,
13
+ original,
14
+ scaled,
15
+ });
16
+ });
17
+ test("scale - custom bound", () => {
18
+ const scaler = new MinMaxScaler({ min: 0, max: 100, bound: { lower: 10, upper: 20 } });
19
+ const original = 50;
20
+ const scaled = 15;
21
+ const result = scaler.scale(original);
22
+ expect(result).toEqual({ original, scaled, isMin: false, isMax: false });
23
+ expect(scaler.descale(result.scaled)).toEqual({
24
+ isLowerBound: false,
25
+ isUpperBound: false,
26
+ original,
27
+ scaled,
28
+ });
29
+ });
30
+ test("scale - custom bound - 2 decimals rounding", () => {
31
+ const scaler = new MinMaxScaler({ min: 0, max: 27, bound: { lower: 0, upper: 9 } });
32
+ const original = 5;
33
+ const scaled = 1.67;
34
+ const result = scaler.scale(original);
35
+ expect(result).toEqual({ scaled, original, isMin: false, isMax: false });
36
+ expect(scaler.descale(result.scaled)).toEqual({
37
+ isLowerBound: false,
38
+ isUpperBound: false,
39
+ original: 5.01,
40
+ scaled,
41
+ });
42
+ });
43
+ test("scale - minimum value", () => {
44
+ const scaler = new MinMaxScaler({ min: 0, max: 100, bound: { lower: 10, upper: 20 } });
45
+ const original = 0;
46
+ const scaled = 10;
47
+ const result = scaler.scale(original);
48
+ expect(result).toEqual({ scaled, original, isMin: true, isMax: false });
49
+ expect(scaler.descale(result.scaled)).toEqual({
50
+ isLowerBound: true,
51
+ isUpperBound: false,
52
+ original,
53
+ scaled,
54
+ });
55
+ });
56
+ test("scale - maximum value", () => {
57
+ const scaler = new MinMaxScaler({ min: 0, max: 100, bound: { lower: 10, upper: 20 } });
58
+ const original = 100;
59
+ const scaled = 20;
60
+ const result = scaler.scale(original);
61
+ expect(result).toEqual({ scaled, original, isMin: false, isMax: true });
62
+ expect(scaler.descale(result.scaled)).toEqual({
63
+ isLowerBound: false,
64
+ isUpperBound: true,
65
+ original,
66
+ scaled,
67
+ });
68
+ });
69
+ test("scale - min equals to max", () => {
70
+ const scaler = new MinMaxScaler({ min: 100, max: 100, bound: { lower: 10, upper: 20 } });
71
+ const original = 100;
72
+ const scaled = 15;
73
+ const result = scaler.scale(original);
74
+ expect(result).toEqual({ scaled, original, isMin: true, isMax: true });
75
+ expect(scaler.descale(result.scaled)).toEqual({
76
+ isLowerBound: false,
77
+ isUpperBound: false,
78
+ original,
79
+ scaled,
80
+ });
81
+ });
82
+ test("scale - non-zero min value", () => {
83
+ const scaler = new MinMaxScaler({ min: 50, max: 100, bound: { lower: 0, upper: 10 } });
84
+ const result = scaler.scale(75);
85
+ expect(result.scaled).toBe(5);
86
+ expect(result.original).toBe(75);
87
+ });
88
+ test("scale - throws for invalid min/max config", () => {
89
+ expect(() => new MinMaxScaler({ min: 100, max: 0, bound: { lower: 0, upper: 10 } })).toThrow("min.max.scaler.invalid.min.max");
90
+ });
91
+ test("scale - throws for invalid bound config", () => {
92
+ expect(() => new MinMaxScaler({ min: 0, max: 10, bound: { lower: 20, upper: 10 } })).toThrow("min.max.scaler.invalid.bound");
93
+ expect(() => new MinMaxScaler({ min: 0, max: 10, bound: { lower: 10, upper: 10 } })).toThrow("min.max.scaler.invalid.bound");
94
+ });
95
+ test("scale - throws when value is bigger than configured range", () => {
96
+ expect(() => new MinMaxScaler({ min: 0, max: 10 }).scale(15)).toThrow("min.max.scaler.value.out.of.range");
97
+ });
98
+ test("scale - throws when value is less than configured range", () => {
99
+ const scaler = new MinMaxScaler({ min: 10, max: 20 });
100
+ expect(() => scaler.scale(5)).toThrow("min.max.scaler.value.out.of.range");
101
+ });
102
+ test("descale - throws when scaled value is out of bounds", () => {
103
+ const scaler = new MinMaxScaler({ min: 0, max: 100, bound: { lower: 10, upper: 20 } });
104
+ expect(() => scaler.descale(5)).toThrow("min.max.scaler.scaled.out.of.bounds");
105
+ expect(() => scaler.descale(25)).toThrow("min.max.scaler.scaled.out.of.bounds");
106
+ });
107
+ test("getMinMax - happy path", () => {
108
+ expect(MinMaxScaler.getMinMax([10, 5, 20, 15, 30])).toEqual({ min: 5, max: 30 });
109
+ });
110
+ test("getMinMax - empty array", () => {
111
+ expect(() => MinMaxScaler.getMinMax([])).toThrow("min.max.scaler.empty.array");
112
+ });
113
+ test("getMinMax - single-value arrays", () => {
114
+ expect(MinMaxScaler.getMinMax([10])).toEqual({ min: 10, max: 10 });
115
+ });
116
+ });
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,24 @@
1
+ import { describe, expect, test } from "bun:test";
2
+ import * as v from "valibot";
3
+ import { MinuteValue } from "../src/minute-value.vo";
4
+ describe("MinuteValue", () => {
5
+ test("happy path", () => {
6
+ expect(v.safeParse(MinuteValue, 0).success).toEqual(true);
7
+ expect(v.safeParse(MinuteValue, 59).success).toEqual(true);
8
+ });
9
+ test("rejects non-number - null", () => {
10
+ expect(() => v.parse(MinuteValue, null)).toThrow("minute.value.type");
11
+ });
12
+ test("rejects non-number - string", () => {
13
+ expect(() => v.parse(MinuteValue, "123")).toThrow("minute.value.type");
14
+ });
15
+ test("rejects fractions", () => {
16
+ expect(() => v.parse(MinuteValue, 1.5)).toThrow("minute.value.type");
17
+ });
18
+ test("rejects negative numbers", () => {
19
+ expect(() => v.parse(MinuteValue, -1)).toThrow("minute.value.invalid");
20
+ });
21
+ test("rejects 60", () => {
22
+ expect(() => v.parse(MinuteValue, 60)).toThrow("minute.value.invalid");
23
+ });
24
+ });
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,64 @@
1
+ import { describe, expect, test } from "bun:test";
2
+ import * as v from "valibot";
3
+ import { Minute } from "../src/minute.vo";
4
+ import { MinuteValue } from "../src/minute-value.vo";
5
+ import * as mocks from "./mocks";
6
+ const FIVE = Minute.fromValue(5);
7
+ const TEN = Minute.fromValue(10);
8
+ const thirteenth = v.parse(MinuteValue, 13);
9
+ describe("Minute", () => {
10
+ test("happy path", () => {
11
+ expect(FIVE.get()).toEqual(v.parse(MinuteValue, 5));
12
+ });
13
+ test("throws for invalid minute values", () => {
14
+ expect(() => Minute.fromValue(12.5)).toThrow("minute.value.type");
15
+ expect(() => Minute.fromValue(-1)).toThrow("minute.value.invalid");
16
+ expect(() => Minute.fromValue(60)).toThrow("minute.value.invalid");
17
+ });
18
+ test("fromValueSafe", () => {
19
+ expect(Minute.fromValueSafe(thirteenth).get()).toEqual(thirteenth);
20
+ });
21
+ test("fromTimestamp", () => {
22
+ expect(Minute.fromTimestamp(mocks.TIME_ZERO).get()).toEqual(thirteenth);
23
+ });
24
+ test("fromTimestampValue", () => {
25
+ expect(Minute.fromTimestampValue(mocks.TIME_ZERO.ms).get()).toEqual(thirteenth);
26
+ });
27
+ test("zero", () => {
28
+ expect(Minute.zero().get()).toEqual(v.parse(MinuteValue, 0));
29
+ });
30
+ test("max", () => {
31
+ expect(Minute.max().get()).toEqual(v.parse(MinuteValue, 59));
32
+ });
33
+ test("get", () => {
34
+ expect(FIVE.get()).toEqual(v.parse(MinuteValue, 5));
35
+ });
36
+ test("equals", () => {
37
+ expect(FIVE.equals(FIVE)).toEqual(true);
38
+ expect(FIVE.equals(TEN)).toEqual(false);
39
+ });
40
+ test("isBefore", () => {
41
+ expect(FIVE.isBefore(TEN)).toEqual(true);
42
+ expect(TEN.isBefore(FIVE)).toEqual(false);
43
+ expect(TEN.isBefore(TEN)).toEqual(false);
44
+ });
45
+ test("isAfter", () => {
46
+ expect(TEN.isAfter(FIVE)).toEqual(true);
47
+ expect(FIVE.isAfter(TEN)).toEqual(false);
48
+ expect(FIVE.isAfter(FIVE)).toEqual(false);
49
+ });
50
+ test("list", () => {
51
+ const list = Minute.list();
52
+ expect(list.length).toEqual(60);
53
+ expect(list[0].get()).toEqual(v.parse(MinuteValue, 0));
54
+ expect(list[59].get()).toEqual(v.parse(MinuteValue, 59));
55
+ });
56
+ test("toString", () => {
57
+ expect(FIVE.toString()).toEqual("05");
58
+ expect(TEN.toString()).toEqual("10");
59
+ });
60
+ test("toJSON", () => {
61
+ expect(FIVE.toJSON()).toEqual(v.parse(MinuteValue, 5));
62
+ expect(TEN.toJSON()).toEqual(v.parse(MinuteValue, 10));
63
+ });
64
+ });
@@ -0,0 +1,6 @@
1
+ import { Duration } from "../src/duration.service";
2
+ import { Timestamp } from "../src/timestamp.vo";
3
+ export declare const TIME_ZERO: Timestamp;
4
+ export declare const TIME_ZERO_DATE_LIKE = "2023-11-14";
5
+ export declare const TIME_ZERO_DATE: Date;
6
+ export declare const epsilon: Duration;
@@ -0,0 +1,7 @@
1
+ import { Duration } from "../src/duration.service";
2
+ import { Timestamp } from "../src/timestamp.vo";
3
+ // Tue Nov 14 2023 22:13:20 GMT+0000
4
+ export const TIME_ZERO = Timestamp.fromNumber(1700000000000);
5
+ export const TIME_ZERO_DATE_LIKE = "2023-11-14";
6
+ export const TIME_ZERO_DATE = new Date(TIME_ZERO_DATE_LIKE);
7
+ export const epsilon = Duration.Ms(1);
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,21 @@
1
+ import { describe, expect, test } from "bun:test";
2
+ import * as v from "valibot";
3
+ import { MoneyAmount } from "../src/money-amount.vo";
4
+ describe("MoneyAmount", () => {
5
+ test("happy path", () => {
6
+ expect(v.safeParse(MoneyAmount, 0).success).toEqual(true);
7
+ expect(v.safeParse(MoneyAmount, 1_000).success).toEqual(true);
8
+ });
9
+ test("rejects non-number - null", () => {
10
+ expect(() => v.parse(MoneyAmount, null)).toThrow("money.amount.type");
11
+ });
12
+ test("rejects non-number - string", () => {
13
+ expect(() => v.parse(MoneyAmount, "123")).toThrow("money.amount.type");
14
+ });
15
+ test("rejects fractions", () => {
16
+ expect(() => v.parse(MoneyAmount, 1.5)).toThrow("money.amount.type");
17
+ });
18
+ test("rejects negative numbers", () => {
19
+ expect(() => v.parse(MoneyAmount, -1)).toThrow("money.amount.invalid");
20
+ });
21
+ });
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,90 @@
1
+ import { describe, expect, test } from "bun:test";
2
+ import * as v from "valibot";
3
+ import { DivisionFactor } from "../src/division-factor.vo";
4
+ import { Money } from "../src/money.vo";
5
+ import { MoneyAmount } from "../src/money-amount.vo";
6
+ import { MultiplicationFactor } from "../src/multiplication-factor.vo";
7
+ import { RoundingDownStrategy } from "../src/rounding-down.strategy";
8
+ import { RoundingUpStrategy } from "../src/rounding-up.strategy";
9
+ const roundUp = new RoundingUpStrategy();
10
+ const roundDown = new RoundingDownStrategy();
11
+ const divisor = v.parse(DivisionFactor, 2.5);
12
+ const multiplier = v.parse(MultiplicationFactor, 1.5);
13
+ describe("Money", () => {
14
+ test("fromAmount", () => {
15
+ expect(Money.fromAmount(0).getAmount()).toEqual(v.parse(MoneyAmount, 0));
16
+ expect(Money.fromAmount(100).getAmount()).toEqual(v.parse(MoneyAmount, 100));
17
+ });
18
+ test("fromAmount - invalid input", () => {
19
+ expect(() => Money.fromAmount(100.5)).toThrow("money.amount.type");
20
+ });
21
+ test("fromAmountSafe", () => {
22
+ expect(Money.fromAmountSafe(v.parse(MoneyAmount, 0)).getAmount()).toEqual(v.parse(MoneyAmount, 0));
23
+ expect(Money.fromAmountSafe(v.parse(MoneyAmount, 100)).getAmount()).toEqual(v.parse(MoneyAmount, 100));
24
+ });
25
+ test("add", () => {
26
+ expect(Money.fromAmount(100).add(Money.fromAmount(0)).getAmount()).toEqual(v.parse(MoneyAmount, 100));
27
+ expect(Money.fromAmount(15).add(Money.fromAmount(10)).getAmount()).toEqual(v.parse(MoneyAmount, 25));
28
+ });
29
+ test("multiply - integer factor", () => {
30
+ expect(Money.fromAmount(100).multiply(v.parse(MultiplicationFactor, 5)).getAmount()).toEqual(v.parse(MoneyAmount, 500));
31
+ });
32
+ test("multiply - float factor - default round-to-nearest", () => {
33
+ expect(Money.fromAmount(99).multiply(multiplier).getAmount()).toEqual(v.parse(MoneyAmount, 149));
34
+ });
35
+ test("multiply - float factor - round-up", () => {
36
+ expect(Money.fromAmount(99).multiply(multiplier, roundUp).getAmount()).toEqual(v.parse(MoneyAmount, 149));
37
+ });
38
+ test("multiply - float factor - round-down", () => {
39
+ expect(Money.fromAmount(99).multiply(multiplier, roundDown).getAmount()).toEqual(v.parse(MoneyAmount, 148));
40
+ });
41
+ test("subtract - result more than zero", () => {
42
+ expect(Money.fromAmount(100).subtract(Money.fromAmount(20)).getAmount()).toEqual(v.parse(MoneyAmount, 80));
43
+ });
44
+ test("subtract - result zero", () => {
45
+ expect(Money.fromAmount(100).subtract(Money.fromAmount(100)).isZero()).toEqual(true);
46
+ });
47
+ test("subtract - result less than zero", () => {
48
+ expect(() => Money.fromAmount(100).subtract(Money.fromAmount(120)).getAmount()).toThrow("money.subtract.result.less.than.zero");
49
+ });
50
+ test("divide - float factor - default round-to-nearest", () => {
51
+ expect(Money.fromAmount(98).divide(divisor).getAmount()).toEqual(v.parse(MoneyAmount, 39));
52
+ });
53
+ test("divide - float factor - round-up", () => {
54
+ expect(Money.fromAmount(98).divide(divisor, roundUp).getAmount()).toEqual(v.parse(MoneyAmount, 40));
55
+ });
56
+ test("divide - float factor - round-down", () => {
57
+ expect(Money.fromAmount(98).divide(divisor, roundDown).getAmount()).toEqual(v.parse(MoneyAmount, 39));
58
+ });
59
+ test("equals", () => {
60
+ const oneHundred = Money.fromAmount(100);
61
+ const twoHundred = Money.fromAmount(200);
62
+ expect(oneHundred.equals(oneHundred)).toEqual(true);
63
+ expect(oneHundred.equals(twoHundred)).toEqual(false);
64
+ });
65
+ test("isGreaterThan", () => {
66
+ const oneHundred = Money.fromAmount(100);
67
+ const twoHundred = Money.fromAmount(200);
68
+ expect(oneHundred.isGreaterThan(oneHundred)).toEqual(false);
69
+ expect(twoHundred.isGreaterThan(oneHundred)).toEqual(true);
70
+ });
71
+ test("isLessThan", () => {
72
+ const oneHundred = Money.fromAmount(100);
73
+ const twoHundred = Money.fromAmount(200);
74
+ expect(oneHundred.isLessThan(oneHundred)).toEqual(false);
75
+ expect(oneHundred.isLessThan(twoHundred)).toEqual(true);
76
+ });
77
+ test("isZero", () => {
78
+ expect(Money.fromAmount(0).isZero()).toEqual(true);
79
+ expect(Money.fromAmount(1).isZero()).toEqual(false);
80
+ });
81
+ test("zero", () => {
82
+ expect(Money.zero()).toEqual(Money.fromAmountSafe(v.parse(MoneyAmount, 0)));
83
+ });
84
+ test("toString", () => {
85
+ expect(Money.fromAmount(5).toString()).toEqual("5");
86
+ });
87
+ test("toJSON", () => {
88
+ expect(Money.fromAmount(5).toJSON()).toEqual(5);
89
+ });
90
+ });
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,36 @@
1
+ import { describe, expect, test } from "bun:test";
2
+ import * as v from "valibot";
3
+ import { MonthIsoId } from "../src/month-iso-id.vo";
4
+ describe("MonthIsoId", () => {
5
+ test("happy path", () => {
6
+ const valid = ["0000-01", "1970-01", "1999-12", "2024-02", "2025-10", "9999-12"];
7
+ for (const value of valid) {
8
+ expect(v.safeParse(MonthIsoId, value).success).toEqual(true);
9
+ }
10
+ });
11
+ test("rejects prefix", () => {
12
+ expect(() => v.parse(MonthIsoId, "prefix2000-01")).toThrow("month.iso.id.bad.chars");
13
+ });
14
+ test("rejects suffix", () => {
15
+ expect(() => v.parse(MonthIsoId, "2000-01suffix")).toThrow("month.iso.id.bad.chars");
16
+ });
17
+ test("rejects empty", () => {
18
+ expect(() => v.parse(MonthIsoId, "")).toThrow("month.iso.id.bad.chars");
19
+ });
20
+ test("rejects non-string - null", () => {
21
+ expect(() => v.parse(MonthIsoId, null)).toThrow("month.iso.id.type");
22
+ });
23
+ test("rejects non-string - number", () => {
24
+ expect(() => v.parse(MonthIsoId, 123)).toThrow("month.iso.id.type");
25
+ });
26
+ test("rejects months < 1 and > 12", () => {
27
+ expect(() => v.parse(MonthIsoId, "2023-00")).toThrow("month.iso.id.invalid");
28
+ expect(() => v.parse(MonthIsoId, "2023-13")).toThrow("month.iso.id.invalid");
29
+ });
30
+ test("rejects structurally invalid strings", () => {
31
+ const invalid = ["2023-1", "2023/01", "23-01"];
32
+ for (const value of invalid) {
33
+ expect(() => v.parse(MonthIsoId, value)).toThrow("month.iso.id.bad.chars");
34
+ }
35
+ });
36
+ });
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,65 @@
1
+ import { describe, expect, test } from "bun:test";
2
+ import { endOfMonth, startOfMonth } from "date-fns";
3
+ import * as v from "valibot";
4
+ import { Duration } from "../src/duration.service";
5
+ import { Integer } from "../src/integer.vo";
6
+ import { Month } from "../src/month.vo";
7
+ import { MonthIsoId } from "../src/month-iso-id.vo";
8
+ import { Timestamp } from "../src/timestamp.vo";
9
+ import * as mocks from "./mocks";
10
+ const november = v.parse(MonthIsoId, "2023-11");
11
+ describe("Month", () => {
12
+ test("happy path", () => {
13
+ const month = Month.fromTimestamp(mocks.TIME_ZERO);
14
+ expect(month.getStart()).toEqual(Timestamp.fromNumber(startOfMonth(mocks.TIME_ZERO.ms).getTime()));
15
+ expect(month.getEnd()).toEqual(Timestamp.fromNumber(endOfMonth(mocks.TIME_ZERO.ms).getTime()));
16
+ expect(month.toIsoId()).toEqual(november);
17
+ expect(month.contains(mocks.TIME_ZERO)).toEqual(true);
18
+ });
19
+ test("happy path - near year boundary", () => {
20
+ const timestamp = Timestamp.fromDateLike("2025-12-31");
21
+ const month = Month.fromTimestamp(timestamp);
22
+ expect(month.getStart()).toEqual(Timestamp.fromNumber(startOfMonth(timestamp.ms).getTime()));
23
+ expect(month.getEnd()).toEqual(Timestamp.fromNumber(endOfMonth(timestamp.ms).getTime()));
24
+ expect(month.toIsoId()).toEqual(v.parse(MonthIsoId, "2025-12"));
25
+ });
26
+ test("fromNow", () => {
27
+ expect(Month.fromNow(mocks.TIME_ZERO).toIsoId()).toEqual(november);
28
+ });
29
+ test("fromTimestamp", () => {
30
+ expect(Month.fromTimestamp(mocks.TIME_ZERO).toIsoId()).toEqual(november);
31
+ });
32
+ test("fromTimestampValue", () => {
33
+ expect(Month.fromTimestampValue(mocks.TIME_ZERO.ms).toIsoId()).toEqual(november);
34
+ });
35
+ test("fromIsoId", () => {
36
+ expect(Month.fromIsoId(november).toIsoId()).toEqual(november);
37
+ });
38
+ test("next", () => {
39
+ expect(Month.fromTimestamp(mocks.TIME_ZERO).next().toIsoId()).toEqual(v.parse(MonthIsoId, "2023-12"));
40
+ });
41
+ test("previous", () => {
42
+ expect(Month.fromTimestamp(mocks.TIME_ZERO).previous().toIsoId()).toEqual(v.parse(MonthIsoId, "2023-10"));
43
+ });
44
+ test("shift", () => {
45
+ expect(Month.fromTimestamp(mocks.TIME_ZERO).shift(v.parse(Integer, 2)).toIsoId()).toEqual(v.parse(MonthIsoId, "2024-01"));
46
+ expect(Month.fromTimestamp(mocks.TIME_ZERO).shift(v.parse(Integer, -2)).toIsoId()).toEqual(v.parse(MonthIsoId, "2023-09"));
47
+ });
48
+ test("round-trips", () => {
49
+ const months = ["1970-01", "1999-12", "2024-02", "2025-12", "2026-01"].map((value) => v.parse(MonthIsoId, value));
50
+ for (const value of months) {
51
+ expect(Month.fromIsoId(v.parse(MonthIsoId, value)).toIsoId()).toEqual(value);
52
+ }
53
+ });
54
+ test("contains", () => {
55
+ const month = Month.fromTimestamp(mocks.TIME_ZERO);
56
+ expect(month.contains(month.getStart().subtract(Duration.Ms(1)))).toEqual(false);
57
+ expect(month.contains(month.getEnd().add(Duration.Ms(1)))).toEqual(false);
58
+ });
59
+ test("toString", () => {
60
+ expect(Month.fromIsoId(november).toString()).toEqual(november);
61
+ });
62
+ test("toJSON", () => {
63
+ expect(Month.fromIsoId(november).toJSON()).toEqual({ start: 1698796800000, end: 1701388799999 });
64
+ });
65
+ });
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,19 @@
1
+ import { describe, expect, test } from "bun:test";
2
+ import * as v from "valibot";
3
+ import { MultiplicationFactor } from "../src/multiplication-factor.vo";
4
+ describe("MultiplicationFactor", () => {
5
+ test("happy path", () => {
6
+ expect(v.safeParse(MultiplicationFactor, 10).success).toEqual(true);
7
+ expect(v.safeParse(MultiplicationFactor, 1.5).success).toEqual(true);
8
+ expect(v.safeParse(MultiplicationFactor, 0).success).toEqual(true);
9
+ });
10
+ test("rejects non-number - null", () => {
11
+ expect(() => v.parse(MultiplicationFactor, null)).toThrow("multiplication.factor.type");
12
+ });
13
+ test("rejects non-number - string", () => {
14
+ expect(() => v.parse(MultiplicationFactor, "123")).toThrow("multiplication.factor.type");
15
+ });
16
+ test("rejects negative numbers", () => {
17
+ expect(() => v.parse(MultiplicationFactor, -1)).toThrow("multiplication.factor.invalid");
18
+ });
19
+ });
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,12 @@
1
+ import { describe, expect, test } from "bun:test";
2
+ import { anoop, noop } from "../src/noop.service";
3
+ describe("noop", () => {
4
+ test("does nothing", () => {
5
+ expect(noop()).toEqual(undefined);
6
+ });
7
+ });
8
+ describe("anoop", () => {
9
+ test("does nothing", async () => {
10
+ expect(await anoop()).toEqual(undefined);
11
+ });
12
+ });
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,56 @@
1
+ import { describe, expect, test } from "bun:test";
2
+ import * as v from "valibot";
3
+ import { ObjectKey } from "../src/object-key.vo";
4
+ describe("ObjectKey", () => {
5
+ test("happy path", () => {
6
+ const valid = [
7
+ "avatar.webp",
8
+ "users/123/avatar.webp",
9
+ "users/u-1/avatar.webp",
10
+ "users/abc_def/avatar-1.2_3.webp",
11
+ "env.prod/users/a_b-c/avatar.webp",
12
+ ];
13
+ for (const key of valid) {
14
+ expect(v.safeParse(ObjectKey, key).success).toEqual(true);
15
+ }
16
+ });
17
+ test("rejects empty", () => {
18
+ expect(() => v.parse(ObjectKey, "")).toThrow("object.key.empty");
19
+ });
20
+ test("rejects non-string - null", () => {
21
+ expect(() => v.parse(ObjectKey, null)).toThrow("object.key.type");
22
+ });
23
+ test("rejects non-string - number", () => {
24
+ expect(() => v.parse(ObjectKey, 123)).toThrow("object.key.type");
25
+ });
26
+ test("rejects too long", () => {
27
+ expect(() => v.parse(ObjectKey, "a".repeat(257))).toThrow("object.key.too.long");
28
+ });
29
+ test("rejects leading slash", () => {
30
+ expect(() => v.parse(ObjectKey, "/users/u/avatar.webp")).toThrow("object.key.leading.slash");
31
+ });
32
+ test("rejects backslashes", () => {
33
+ expect(() => v.parse(ObjectKey, "users\\u\\avatar.webP")).toThrow("object.key.bad.chars");
34
+ });
35
+ test("rejects control characters", () => {
36
+ expect(() => v.parse(ObjectKey, "users/\u0000/avatar.webp")).toThrow("object.key.bad.chars");
37
+ });
38
+ test("rejects trailing slash", () => {
39
+ expect(() => v.parse(ObjectKey, "users/u/")).toThrow("object.key.bad.chars");
40
+ });
41
+ test("rejects single dot segments", () => {
42
+ expect(() => v.parse(ObjectKey, "users/./avatar.webp")).toThrow("object.key.dot.segments");
43
+ });
44
+ test("rejects double dot segments", () => {
45
+ expect(() => v.parse(ObjectKey, "users/../avatar.webp")).toThrow("object.key.dot.segments");
46
+ });
47
+ test("rejects uppercase letters", () => {
48
+ expect(() => v.parse(ObjectKey, "Users/u/avatar.webp")).toThrow("object.key.bad.chars");
49
+ });
50
+ test("rejects empty segments", () => {
51
+ expect(() => v.parse(ObjectKey, "users//avatar.webp")).toThrow("object.key.bad.chars");
52
+ });
53
+ test("rejects spaces in segments", () => {
54
+ expect(() => v.parse(ObjectKey, "users/user id/avatar.webp")).toThrow("object.key.bad.chars");
55
+ });
56
+ });
@@ -0,0 +1 @@
1
+ export {};