@intelact/driveup 2.4.5 → 2.4.6

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 (358) hide show
  1. package/lib/agent/agent.dto.d.ts +6 -0
  2. package/lib/agent/agent.dto.js +39 -0
  3. package/lib/agent/agent.dto.js.map +1 -0
  4. package/lib/agent/agent.model.d.ts +13 -0
  5. package/lib/agent/agent.model.js +60 -0
  6. package/lib/agent/agent.model.js.map +1 -0
  7. package/lib/agent/client.model.d.ts +8 -0
  8. package/lib/agent/client.model.js +37 -0
  9. package/lib/agent/client.model.js.map +1 -0
  10. package/lib/agent/code.model.d.ts +12 -0
  11. package/lib/agent/code.model.js +43 -0
  12. package/lib/agent/code.model.js.map +1 -0
  13. package/lib/alert/alert.model.d.ts +16 -0
  14. package/lib/alert/alert.model.js +66 -0
  15. package/lib/alert/alert.model.js.map +1 -0
  16. package/lib/auth/signin.dto.d.ts +6 -0
  17. package/lib/auth/signin.dto.js +35 -0
  18. package/lib/auth/signin.dto.js.map +1 -0
  19. package/lib/auth/signup.dto.d.ts +9 -0
  20. package/lib/auth/signup.dto.js +46 -0
  21. package/lib/auth/signup.dto.js.map +1 -0
  22. package/lib/bill/bill-item.model.d.ts +38 -0
  23. package/lib/bill/bill-item.model.js +88 -0
  24. package/lib/bill/bill-item.model.js.map +1 -0
  25. package/lib/bill/bill.model.d.ts +36 -0
  26. package/lib/bill/bill.model.js +101 -0
  27. package/lib/bill/bill.model.js.map +1 -0
  28. package/lib/calendar/appointment.d.ts +92 -0
  29. package/lib/calendar/appointment.js +213 -0
  30. package/lib/calendar/appointment.js.map +1 -0
  31. package/lib/calendar/date.d.ts +23 -0
  32. package/lib/calendar/date.js +87 -0
  33. package/lib/calendar/date.js.map +1 -0
  34. package/lib/calendar/holiday.d.ts +7 -0
  35. package/lib/calendar/holiday.js +28 -0
  36. package/lib/calendar/holiday.js.map +1 -0
  37. package/lib/calendar/token.d.ts +15 -0
  38. package/lib/calendar/token.js +3 -0
  39. package/lib/calendar/token.js.map +1 -0
  40. package/lib/calendar/working.d.ts +9 -0
  41. package/lib/calendar/working.js +41 -0
  42. package/lib/calendar/working.js.map +1 -0
  43. package/lib/common/app-info.d.ts +21 -0
  44. package/lib/common/app-info.js +93 -0
  45. package/lib/common/app-info.js.map +1 -0
  46. package/lib/common/content.d.ts +21 -0
  47. package/lib/common/content.js +78 -0
  48. package/lib/common/content.js.map +1 -0
  49. package/lib/common/email.d.ts +4 -0
  50. package/lib/common/email.js +29 -0
  51. package/lib/common/email.js.map +1 -0
  52. package/lib/common/id.d.ts +3 -0
  53. package/lib/common/id.js +25 -0
  54. package/lib/common/id.js.map +1 -0
  55. package/lib/common/language.d.ts +4 -0
  56. package/lib/common/language.js +22 -0
  57. package/lib/common/language.js.map +1 -0
  58. package/lib/common/phone.d.ts +4 -0
  59. package/lib/common/phone.js +31 -0
  60. package/lib/common/phone.js.map +1 -0
  61. package/lib/common/price.d.ts +3 -0
  62. package/lib/common/price.js +25 -0
  63. package/lib/common/price.js.map +1 -0
  64. package/lib/common/profile.d.ts +5 -0
  65. package/lib/common/profile.js +28 -0
  66. package/lib/common/profile.js.map +1 -0
  67. package/lib/common/promotion.d.ts +3 -0
  68. package/lib/common/promotion.js +24 -0
  69. package/lib/common/promotion.js.map +1 -0
  70. package/lib/common/search.d.ts +3 -0
  71. package/lib/common/search.js +23 -0
  72. package/lib/common/search.js.map +1 -0
  73. package/lib/common/social.d.ts +7 -0
  74. package/lib/common/social.js +40 -0
  75. package/lib/common/social.js.map +1 -0
  76. package/lib/common/sort.d.ts +7 -0
  77. package/lib/common/sort.js +39 -0
  78. package/lib/common/sort.js.map +1 -0
  79. package/lib/common/url.d.ts +3 -0
  80. package/lib/common/url.js +24 -0
  81. package/lib/common/url.js.map +1 -0
  82. package/lib/company/company-widget.model.d.ts +10 -0
  83. package/lib/company/company-widget.model.js +35 -0
  84. package/lib/company/company-widget.model.js.map +1 -0
  85. package/lib/company/company.model.d.ts +81 -0
  86. package/lib/company/company.model.js +232 -0
  87. package/lib/company/company.model.js.map +1 -0
  88. package/lib/company/dependency.model.d.ts +5 -0
  89. package/lib/company/dependency.model.js +30 -0
  90. package/lib/company/dependency.model.js.map +1 -0
  91. package/lib/country/country.dto.d.ts +24 -0
  92. package/lib/country/country.dto.js +132 -0
  93. package/lib/country/country.dto.js.map +1 -0
  94. package/lib/country/country.model.d.ts +19 -0
  95. package/lib/country/country.model.js +80 -0
  96. package/lib/country/country.model.js.map +1 -0
  97. package/lib/course/appointment.model.d.ts +14 -0
  98. package/lib/course/appointment.model.js +47 -0
  99. package/lib/course/appointment.model.js.map +1 -0
  100. package/lib/course/course.model.d.ts +44 -0
  101. package/lib/course/course.model.js +141 -0
  102. package/lib/course/course.model.js.map +1 -0
  103. package/lib/course/definition.model.d.ts +15 -0
  104. package/lib/course/definition.model.js +66 -0
  105. package/lib/course/definition.model.js.map +1 -0
  106. package/lib/course/dto.d.ts +47 -0
  107. package/lib/course/dto.js +191 -0
  108. package/lib/course/dto.js.map +1 -0
  109. package/lib/course/part.model.d.ts +23 -0
  110. package/lib/course/part.model.js +86 -0
  111. package/lib/course/part.model.js.map +1 -0
  112. package/lib/credit/credit.model.d.ts +8 -0
  113. package/lib/credit/credit.model.js +43 -0
  114. package/lib/credit/credit.model.js.map +1 -0
  115. package/lib/currency/currency.dto.d.ts +19 -0
  116. package/lib/currency/currency.dto.js +109 -0
  117. package/lib/currency/currency.dto.js.map +1 -0
  118. package/lib/currency/currency.model.d.ts +11 -0
  119. package/lib/currency/currency.model.js +53 -0
  120. package/lib/currency/currency.model.js.map +1 -0
  121. package/lib/device/device.agent.d.ts +51 -0
  122. package/lib/device/device.agent.js +3 -0
  123. package/lib/device/device.agent.js.map +1 -0
  124. package/lib/device/device.model.d.ts +11 -0
  125. package/lib/device/device.model.js +53 -0
  126. package/lib/device/device.model.js.map +1 -0
  127. package/lib/device/device.signature.d.ts +4 -0
  128. package/lib/device/device.signature.js +30 -0
  129. package/lib/device/device.signature.js.map +1 -0
  130. package/lib/driving/category/category.dto.d.ts +37 -0
  131. package/lib/driving/category/category.dto.js +144 -0
  132. package/lib/driving/category/category.dto.js.map +1 -0
  133. package/lib/driving/category/category.model.d.ts +35 -0
  134. package/lib/driving/category/category.model.js +99 -0
  135. package/lib/driving/category/category.model.js.map +1 -0
  136. package/lib/driving/exam/exam.dto.d.ts +8 -0
  137. package/lib/driving/exam/exam.dto.js +39 -0
  138. package/lib/driving/exam/exam.dto.js.map +1 -0
  139. package/lib/driving/exam/exam.model.d.ts +8 -0
  140. package/lib/driving/exam/exam.model.js +39 -0
  141. package/lib/driving/exam/exam.model.js.map +1 -0
  142. package/lib/driving/lesson/lesson.d.ts +10 -0
  143. package/lib/driving/lesson/lesson.js +48 -0
  144. package/lib/driving/lesson/lesson.js.map +1 -0
  145. package/lib/driving/lesson/skill.d.ts +13 -0
  146. package/lib/driving/lesson/skill.dto.d.ts +7 -0
  147. package/lib/driving/lesson/skill.dto.js +32 -0
  148. package/lib/driving/lesson/skill.dto.js.map +1 -0
  149. package/lib/driving/lesson/skill.js +43 -0
  150. package/lib/driving/lesson/skill.js.map +1 -0
  151. package/lib/driving/lesson/topic.d.ts +20 -0
  152. package/lib/driving/lesson/topic.dto.d.ts +18 -0
  153. package/lib/driving/lesson/topic.dto.js +72 -0
  154. package/lib/driving/lesson/topic.dto.js.map +1 -0
  155. package/lib/driving/lesson/topic.js +72 -0
  156. package/lib/driving/lesson/topic.js.map +1 -0
  157. package/lib/expense/category.model.d.ts +18 -0
  158. package/lib/expense/category.model.js +69 -0
  159. package/lib/expense/category.model.js.map +1 -0
  160. package/lib/expense/expense.dto.d.ts +28 -0
  161. package/lib/expense/expense.dto.js +144 -0
  162. package/lib/expense/expense.dto.js.map +1 -0
  163. package/lib/expense/expense.model.d.ts +19 -0
  164. package/lib/expense/expense.model.js +85 -0
  165. package/lib/expense/expense.model.js.map +1 -0
  166. package/lib/finance/company-payment.model.d.ts +10 -0
  167. package/lib/finance/company-payment.model.js +45 -0
  168. package/lib/finance/company-payment.model.js.map +1 -0
  169. package/lib/finance/discount.dto.d.ts +4 -0
  170. package/lib/finance/discount.dto.js +30 -0
  171. package/lib/finance/discount.dto.js.map +1 -0
  172. package/lib/finance/finance.dto.d.ts +56 -0
  173. package/lib/finance/finance.dto.js +277 -0
  174. package/lib/finance/finance.dto.js.map +1 -0
  175. package/lib/finance/finance.model.d.ts +34 -0
  176. package/lib/finance/finance.model.js +124 -0
  177. package/lib/finance/finance.model.js.map +1 -0
  178. package/lib/finance/payment-method.model.d.ts +20 -0
  179. package/lib/finance/payment-method.model.js +72 -0
  180. package/lib/finance/payment-method.model.js.map +1 -0
  181. package/lib/finance/payment.dto.d.ts +6 -0
  182. package/lib/finance/payment.dto.js +37 -0
  183. package/lib/finance/payment.dto.js.map +1 -0
  184. package/lib/finance/refund.dto.d.ts +4 -0
  185. package/lib/finance/refund.dto.js +30 -0
  186. package/lib/finance/refund.dto.js.map +1 -0
  187. package/lib/free-benefit/free-benefit.model.d.ts +7 -0
  188. package/lib/free-benefit/free-benefit.model.js +31 -0
  189. package/lib/free-benefit/free-benefit.model.js.map +1 -0
  190. package/lib/geo/address.dto.d.ts +19 -0
  191. package/lib/geo/address.dto.js +73 -0
  192. package/lib/geo/address.dto.js.map +1 -0
  193. package/lib/geo/geoinfo.interface.d.ts +17 -0
  194. package/lib/geo/geoinfo.interface.js +3 -0
  195. package/lib/geo/geoinfo.interface.js.map +1 -0
  196. package/lib/geo/pickup.model.d.ts +11 -0
  197. package/lib/geo/pickup.model.js +55 -0
  198. package/lib/geo/pickup.model.js.map +1 -0
  199. package/lib/giftcode/giftcode-group.model.d.ts +13 -0
  200. package/lib/giftcode/giftcode-group.model.js +56 -0
  201. package/lib/giftcode/giftcode-group.model.js.map +1 -0
  202. package/lib/giftcode/giftcode.dto.d.ts +37 -0
  203. package/lib/giftcode/giftcode.dto.js +130 -0
  204. package/lib/giftcode/giftcode.dto.js.map +1 -0
  205. package/lib/giftcode/giftcode.model.d.ts +19 -0
  206. package/lib/giftcode/giftcode.model.js +70 -0
  207. package/lib/giftcode/giftcode.model.js.map +1 -0
  208. package/lib/handover/handover.dto.d.ts +6 -0
  209. package/lib/handover/handover.dto.js +41 -0
  210. package/lib/handover/handover.dto.js.map +1 -0
  211. package/lib/handover/handover.model.d.ts +14 -0
  212. package/lib/handover/handover.model.js +59 -0
  213. package/lib/handover/handover.model.js.map +1 -0
  214. package/lib/index.d.ts +118 -0
  215. package/lib/index.js +309 -0
  216. package/lib/index.js.map +1 -0
  217. package/lib/instructor/instructor.dto.d.ts +19 -0
  218. package/lib/instructor/instructor.dto.js +95 -0
  219. package/lib/instructor/instructor.dto.js.map +1 -0
  220. package/lib/instructor/instructor.model.d.ts +46 -0
  221. package/lib/instructor/instructor.model.js +164 -0
  222. package/lib/instructor/instructor.model.js.map +1 -0
  223. package/lib/invoice/invoice.dto.d.ts +10 -0
  224. package/lib/invoice/invoice.dto.js +60 -0
  225. package/lib/invoice/invoice.dto.js.map +1 -0
  226. package/lib/invoice/invoice.model.d.ts +33 -0
  227. package/lib/invoice/invoice.model.js +137 -0
  228. package/lib/invoice/invoice.model.js.map +1 -0
  229. package/lib/invoice/item.model.d.ts +7 -0
  230. package/lib/invoice/item.model.js +38 -0
  231. package/lib/invoice/item.model.js.map +1 -0
  232. package/lib/item/item.model.d.ts +68 -0
  233. package/lib/item/item.model.js +46 -0
  234. package/lib/item/item.model.js.map +1 -0
  235. package/lib/license/license.model.d.ts +7 -0
  236. package/lib/license/license.model.js +47 -0
  237. package/lib/license/license.model.js.map +1 -0
  238. package/lib/log/log.model.d.ts +8 -0
  239. package/lib/log/log.model.js +38 -0
  240. package/lib/log/log.model.js.map +1 -0
  241. package/lib/metric/metric.model.d.ts +43 -0
  242. package/lib/metric/metric.model.js +113 -0
  243. package/lib/metric/metric.model.js.map +1 -0
  244. package/lib/notification/notification.model.d.ts +13 -0
  245. package/lib/notification/notification.model.js +60 -0
  246. package/lib/notification/notification.model.js.map +1 -0
  247. package/lib/notification/preference.dto.d.ts +5 -0
  248. package/lib/notification/preference.dto.js +33 -0
  249. package/lib/notification/preference.dto.js.map +1 -0
  250. package/lib/notification/preference.model.d.ts +8 -0
  251. package/lib/notification/preference.model.js +42 -0
  252. package/lib/notification/preference.model.js.map +1 -0
  253. package/lib/payout/payout.model.d.ts +12 -0
  254. package/lib/payout/payout.model.js +59 -0
  255. package/lib/payout/payout.model.js.map +1 -0
  256. package/lib/priceplan/plan.dto.d.ts +13 -0
  257. package/lib/priceplan/plan.dto.js +67 -0
  258. package/lib/priceplan/plan.dto.js.map +1 -0
  259. package/lib/priceplan/plan.model.d.ts +38 -0
  260. package/lib/priceplan/plan.model.js +111 -0
  261. package/lib/priceplan/plan.model.js.map +1 -0
  262. package/lib/public/contac-us.dto.d.ts +6 -0
  263. package/lib/public/contac-us.dto.js +43 -0
  264. package/lib/public/contac-us.dto.js.map +1 -0
  265. package/lib/public/contact-sales.dto.d.ts +9 -0
  266. package/lib/public/contact-sales.dto.js +62 -0
  267. package/lib/public/contact-sales.dto.js.map +1 -0
  268. package/lib/public/country-support.dto.d.ts +6 -0
  269. package/lib/public/country-support.dto.js +43 -0
  270. package/lib/public/country-support.dto.js.map +1 -0
  271. package/lib/security/role.dto.d.ts +4 -0
  272. package/lib/security/role.dto.js +23 -0
  273. package/lib/security/role.dto.js.map +1 -0
  274. package/lib/security/token.d.ts +30 -0
  275. package/lib/security/token.js +3 -0
  276. package/lib/security/token.js.map +1 -0
  277. package/lib/session/driving/session.dto.d.ts +13 -0
  278. package/lib/session/driving/session.dto.js +71 -0
  279. package/lib/session/driving/session.dto.js.map +1 -0
  280. package/lib/session/driving/session.model.d.ts +16 -0
  281. package/lib/session/driving/session.model.js +56 -0
  282. package/lib/session/driving/session.model.js.map +1 -0
  283. package/lib/session/driving/session.skill.d.ts +5 -0
  284. package/lib/session/driving/session.skill.js +27 -0
  285. package/lib/session/driving/session.skill.js.map +1 -0
  286. package/lib/session/driving/session.topic.d.ts +13 -0
  287. package/lib/session/driving/session.topic.js +53 -0
  288. package/lib/session/driving/session.topic.js.map +1 -0
  289. package/lib/setting/setting.dto.d.ts +3 -0
  290. package/lib/setting/setting.dto.js +24 -0
  291. package/lib/setting/setting.dto.js.map +1 -0
  292. package/lib/setting/setting.model.d.ts +10 -0
  293. package/lib/setting/setting.model.js +46 -0
  294. package/lib/setting/setting.model.js.map +1 -0
  295. package/lib/signature/signature.model.d.ts +10 -0
  296. package/lib/signature/signature.model.js +43 -0
  297. package/lib/signature/signature.model.js.map +1 -0
  298. package/lib/student/student.dto.d.ts +20 -0
  299. package/lib/student/student.dto.js +115 -0
  300. package/lib/student/student.dto.js.map +1 -0
  301. package/lib/student/student.model.d.ts +27 -0
  302. package/lib/student/student.model.js +107 -0
  303. package/lib/student/student.model.js.map +1 -0
  304. package/lib/task/task.dto.d.ts +24 -0
  305. package/lib/task/task.dto.js +137 -0
  306. package/lib/task/task.dto.js.map +1 -0
  307. package/lib/task/task.model.d.ts +8 -0
  308. package/lib/task/task.model.js +44 -0
  309. package/lib/task/task.model.js.map +1 -0
  310. package/lib/ticket/ticket.dto.d.ts +13 -0
  311. package/lib/ticket/ticket.dto.js +60 -0
  312. package/lib/ticket/ticket.dto.js.map +1 -0
  313. package/lib/ticket/ticket.model.d.ts +11 -0
  314. package/lib/ticket/ticket.model.js +48 -0
  315. package/lib/ticket/ticket.model.js.map +1 -0
  316. package/lib/training/request.dto.d.ts +4 -0
  317. package/lib/training/request.dto.js +23 -0
  318. package/lib/training/request.dto.js.map +1 -0
  319. package/lib/training/request.model.d.ts +25 -0
  320. package/lib/training/request.model.js +88 -0
  321. package/lib/training/request.model.js.map +1 -0
  322. package/lib/training/training-actions.model.d.ts +7 -0
  323. package/lib/training/training-actions.model.js +40 -0
  324. package/lib/training/training-actions.model.js.map +1 -0
  325. package/lib/training/training.dto.d.ts +56 -0
  326. package/lib/training/training.dto.js +255 -0
  327. package/lib/training/training.dto.js.map +1 -0
  328. package/lib/training/training.model.d.ts +137 -0
  329. package/lib/training/training.model.js +308 -0
  330. package/lib/training/training.model.js.map +1 -0
  331. package/lib/user/agent.interface.d.ts +6 -0
  332. package/lib/user/agent.interface.js +3 -0
  333. package/lib/user/agent.interface.js.map +1 -0
  334. package/lib/user/profile.dto.d.ts +12 -0
  335. package/lib/user/profile.dto.js +52 -0
  336. package/lib/user/profile.dto.js.map +1 -0
  337. package/lib/user/user.model.d.ts +50 -0
  338. package/lib/user/user.model.js +174 -0
  339. package/lib/user/user.model.js.map +1 -0
  340. package/lib/utils/array.helper.d.ts +28 -0
  341. package/lib/utils/array.helper.js +42 -0
  342. package/lib/utils/array.helper.js.map +1 -0
  343. package/lib/utils/compare.validator.d.ts +9 -0
  344. package/lib/utils/compare.validator.js +35 -0
  345. package/lib/utils/compare.validator.js.map +1 -0
  346. package/lib/utils/date.helper.d.ts +127 -0
  347. package/lib/utils/date.helper.js +265 -0
  348. package/lib/utils/date.helper.js.map +1 -0
  349. package/lib/utils/phone.helper.d.ts +9 -0
  350. package/lib/utils/phone.helper.js +17 -0
  351. package/lib/utils/phone.helper.js.map +1 -0
  352. package/lib/utils/required.validator.d.ts +77 -0
  353. package/lib/utils/required.validator.js +151 -0
  354. package/lib/utils/required.validator.js.map +1 -0
  355. package/lib/utils/transformers.helper.d.ts +49 -0
  356. package/lib/utils/transformers.helper.js +203 -0
  357. package/lib/utils/transformers.helper.js.map +1 -0
  358. package/package.json +3 -3
@@ -0,0 +1,42 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ArrayHelper = void 0;
4
+ class ArrayHelper {
5
+ /**
6
+ * Get a random item from an array
7
+ * @param val Given T type array
8
+ * @returns Given T type
9
+ */
10
+ static getRandom(val) {
11
+ const randomIndex = Math.floor(Math.random() * val.length);
12
+ return val[randomIndex];
13
+ }
14
+ /**
15
+ * Get the last item from an array
16
+ * @param val Given T type array
17
+ * @returns Given T type
18
+ */
19
+ static getLastItem(val) {
20
+ return val?.length ? val[val.length - 1] : undefined;
21
+ }
22
+ /**
23
+ * Sum all numbers in a number array
24
+ * @param val Number[]
25
+ * @param toFixed (2)
26
+ * @returns Sum number
27
+ */
28
+ static getSum(val, toFixed = 2) {
29
+ return +val.reduce((acc, curr) => +acc + +curr, 0).toFixed(toFixed);
30
+ }
31
+ /**
32
+ * Get the average number in a number array
33
+ * @param val Number[]
34
+ * @param toFixed (2)
35
+ * @returns Average number
36
+ */
37
+ static getAvg(val, toFixed = 2) {
38
+ return +(ArrayHelper.getSum(val) / val.length).toFixed(toFixed);
39
+ }
40
+ }
41
+ exports.ArrayHelper = ArrayHelper;
42
+ //# sourceMappingURL=array.helper.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"array.helper.js","sourceRoot":"","sources":["../../src/utils/array.helper.ts"],"names":[],"mappings":";;;AAAA,MAAa,WAAW;IAEvB;;;;OAIG;IACH,MAAM,CAAC,SAAS,CAAI,GAAQ;QAC3B,MAAM,WAAW,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,GAAG,CAAC,MAAM,CAAC,CAAC;QAC3D,OAAO,GAAG,CAAC,WAAW,CAAC,CAAC;IACzB,CAAC;IAED;;;;OAIG;IACH,MAAM,CAAC,WAAW,CAAI,GAAQ;QAC7B,OAAO,GAAG,EAAE,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;IACtD,CAAC;IAED;;;;;OAKG;IACH,MAAM,CAAC,MAAM,CAAC,GAAa,EAAE,OAAO,GAAC,CAAC;QACrC,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,IAAI,EAAE,EAAE,CAAC,CAAC,GAAG,GAAG,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;IACrE,CAAC;IAED;;;;;OAKG;IACH,MAAM,CAAC,MAAM,CAAC,GAAa,EAAE,OAAO,GAAC,CAAC;QACrC,OAAO,CAAC,CAAC,WAAW,CAAC,MAAM,CAAC,GAAG,CAAC,GAAG,GAAG,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;IACjE,CAAC;CACD;AAxCD,kCAwCC"}
@@ -0,0 +1,9 @@
1
+ import { ValidationArguments, ValidatorConstraintInterface } from "class-validator";
2
+ /**
3
+ * Checks if the start date is less than or equal to the end date
4
+ * If one of the does not have a valid value, returns true
5
+ */
6
+ export declare class CompareWithEndDate implements ValidatorConstraintInterface {
7
+ validate(startDate: Date, args: ValidationArguments): boolean;
8
+ defaultMessage(args?: ValidationArguments): string;
9
+ }
@@ -0,0 +1,35 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.CompareWithEndDate = void 0;
10
+ const class_validator_1 = require("class-validator");
11
+ const luxon_1 = require("luxon");
12
+ /**
13
+ * Checks if the start date is less than or equal to the end date
14
+ * If one of the does not have a valid value, returns true
15
+ */
16
+ let CompareWithEndDate = class CompareWithEndDate {
17
+ // startDate must be there before the args param,
18
+ // if it's not there the args will be treated as the startDate and we won't have access to the object
19
+ validate(startDate, args) {
20
+ const dto = args.object;
21
+ // no validation is performed if either is not provided
22
+ if (!luxon_1.DateTime.fromJSDate(dto.startDate).isValid ||
23
+ !luxon_1.DateTime.fromJSDate(dto.endDate).isValid)
24
+ return true;
25
+ return dto.startDate < dto.endDate;
26
+ }
27
+ defaultMessage(args) {
28
+ return 'start date cannot be greater than end date';
29
+ }
30
+ };
31
+ exports.CompareWithEndDate = CompareWithEndDate;
32
+ exports.CompareWithEndDate = CompareWithEndDate = __decorate([
33
+ (0, class_validator_1.ValidatorConstraint)({ name: 'CompareWithEndDate', async: false })
34
+ ], CompareWithEndDate);
35
+ //# sourceMappingURL=compare.validator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"compare.validator.js","sourceRoot":"","sources":["../../src/utils/compare.validator.ts"],"names":[],"mappings":";;;;;;;;;AAAA,qDAAyG;AACzG,iCAAiC;AAEjC;;;GAGG;AAEI,IAAM,kBAAkB,GAAxB,MAAM,kBAAkB;IAC9B,kDAAkD;IAClD,qGAAqG;IACrG,QAAQ,CAAC,SAAe,EAAE,IAAyB;QAClD,MAAM,GAAG,GAAG,IAAI,CAAC,MAAgB,CAAC;QAElC,uDAAuD;QACvD,IACC,CAAC,gBAAQ,CAAC,UAAU,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,OAAO;YAC3C,CAAC,gBAAQ,CAAC,UAAU,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,OAAO;YAEzC,OAAO,IAAI,CAAC;QAEb,OAAO,GAAG,CAAC,SAAS,GAAG,GAAG,CAAC,OAAO,CAAC;IACpC,CAAC;IAED,cAAc,CAAC,IAA0B;QACxC,OAAO,4CAA4C,CAAC;IACrD,CAAC;CACD,CAAA;AAnBY,gDAAkB;6BAAlB,kBAAkB;IAD9B,IAAA,qCAAmB,EAAC,EAAE,IAAI,EAAE,oBAAoB,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC;GACrD,kBAAkB,CAmB9B"}
@@ -0,0 +1,127 @@
1
+ import { WeekDay } from '@driveup/shared';
2
+ import { DateTime, WeekdayNumbers } from 'luxon';
3
+ import { Appointment } from "../calendar/appointment";
4
+ import { Period } from "../calendar/date";
5
+ export declare class DateHelper {
6
+ /**
7
+ * Set timezone to date
8
+ * @param date Date
9
+ * @param timezone string
10
+ * @returns Date
11
+ */
12
+ static setTimezone(date: Date, timezone: string): Date;
13
+ /**
14
+ * Format like 'October 14, 1983'
15
+ * @param date Date
16
+ * @param timezone string
17
+ * @returns string
18
+ */
19
+ static toLocalDate(date: Date, timezone?: string): string;
20
+ /**
21
+ * Format like 'Oct 14, 1983, 9:30 AM'. Only 12-hour if the locale is.
22
+ * @param date Date
23
+ * @param timezone string
24
+ * @returns string
25
+ */
26
+ static toLocalDateTime(date: Date, timezone?: string): string;
27
+ /**
28
+ * Format like 'Fri, 14 Oct 1983, 9:30 AM'. Only 12-hour if the locale is.
29
+ * @param date Date
30
+ * @param timezone string
31
+ * @returns string
32
+ */
33
+ static toLocalWeekDayAndDateTime(date: Date, timezone?: string): string;
34
+ /**
35
+ * Is date between start and end dates
36
+ * @param date Date
37
+ * @param start Date
38
+ * @param end Date
39
+ * @returns
40
+ */
41
+ static isBetween(date: Date, start: Date, end: Date): boolean;
42
+ /**
43
+ * Converts a Date to a date-only string in the format "YYYY-MM-DD".
44
+ * @param date Given date
45
+ * @returns Date string
46
+ */
47
+ static toDateOnly(date: Date): string;
48
+ /**
49
+ * Converts a Date to a time-only string in the format "HH:MM:SS.sssZ".
50
+ * @param date Given date
51
+ * @returns Time string
52
+ */
53
+ static toTimeOnly(date: Date): string;
54
+ /**
55
+ * Get DateTime instance from Date
56
+ * @param date
57
+ * @returns DateTime
58
+ */
59
+ static toDateTimeInstance(date: Date): DateTime;
60
+ /**
61
+ * Check if date is start of day
62
+ * @param date Given date
63
+ * @returns True if date is start of day
64
+ */
65
+ static isStartOfDay(date: Date): boolean;
66
+ /**
67
+ * Check if date is end of day
68
+ * @param date Given date
69
+ * @returns True if date is end of day
70
+ */
71
+ static isEndOfDay(date: Date): boolean;
72
+ /**
73
+ * Converts a number to a WeekdayNumbers enum from luxon.
74
+ * @param val
75
+ * @returns
76
+ */
77
+ static toWeekdayNumber(val: number): WeekdayNumbers;
78
+ /**
79
+ * Converts a WeekDay enum from intelact/driveup to a WeekdayNumbers enum from luxon.
80
+ * @param Weekday - The weekday to convert
81
+ * @returns WeekdayNumbers from luxon - 1 to 7
82
+ */
83
+ static getWeekdayNumber(weekday: WeekDay): WeekdayNumbers;
84
+ /**
85
+ * Get WeekDay from DateTime
86
+ * @param date
87
+ * @returns WeekDay
88
+ */
89
+ static getWeekday(date: DateTime): WeekDay;
90
+ /**
91
+ * Converts a WeekDay enum from intelact/driveup to a MySQL weekday number.
92
+ * @param Weekday - The weekday to convert
93
+ * @returns number - MySQL weekday number (0 = Monday, 6 = Sunday)
94
+ */
95
+ static getMySqlWeekday(weekday: WeekDay): number;
96
+ /**
97
+ * Merge periods
98
+ * @param Period[]
99
+ * @returns Period[] - Returns an array of merged periods
100
+ */
101
+ static mergePeriods(periods: Period[]): Period[];
102
+ /**
103
+ * Merge appointment periods
104
+ * @param Appointment[]
105
+ * @returns Appointment[] - Returns an array of merged appointments
106
+ */
107
+ static mergeAppointmentPeriods(appointments: Appointment[]): Appointment[];
108
+ /**
109
+ * Get a formatted date string in "DD MMM YYYY" format,
110
+ * or an empty string if the given date is invalid.
111
+ * Example: "23 Oct 2025"
112
+ * @param date string | number | Date
113
+ * @param local Default de
114
+ * @returns Formatted date string
115
+ */
116
+ static formatDate(date: string | number | Date, local?: string): string;
117
+ /**
118
+ * Get a formatted date and time string in "DD MMM YYYY - HH:MM" format,
119
+ * or an empty string if the given date is invalid.
120
+ * Example: "23 Oct 2025 - 14:30"
121
+ * @param date string | number | Date
122
+ * @param seperator Default '-'
123
+ * @param local Default de
124
+ * @returns Formatted date and time string
125
+ */
126
+ static formatDateAndTime(date: string | number | Date, seperator?: string, local?: string): string;
127
+ }
@@ -0,0 +1,265 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DateHelper = void 0;
4
+ const shared_1 = require("@driveup/shared");
5
+ const luxon_1 = require("luxon");
6
+ class DateHelper {
7
+ /**
8
+ * Set timezone to date
9
+ * @param date Date
10
+ * @param timezone string
11
+ * @returns Date
12
+ */
13
+ static setTimezone(date, timezone) {
14
+ return date = luxon_1.DateTime.fromJSDate(date, { zone: timezone }).toJSDate();
15
+ }
16
+ /**
17
+ * Format like 'October 14, 1983'
18
+ * @param date Date
19
+ * @param timezone string
20
+ * @returns string
21
+ */
22
+ static toLocalDate(date, timezone) {
23
+ date = timezone ? DateHelper.setTimezone(date, timezone) : date;
24
+ return date ? luxon_1.DateTime.fromJSDate(date).toLocaleString(luxon_1.DateTime.DATE_FULL) : '';
25
+ }
26
+ /**
27
+ * Format like 'Oct 14, 1983, 9:30 AM'. Only 12-hour if the locale is.
28
+ * @param date Date
29
+ * @param timezone string
30
+ * @returns string
31
+ */
32
+ static toLocalDateTime(date, timezone) {
33
+ date = timezone ? DateHelper.setTimezone(date, timezone) : date;
34
+ return date ? luxon_1.DateTime.fromJSDate(date).toLocaleString(luxon_1.DateTime.DATETIME_MED) : '';
35
+ }
36
+ /**
37
+ * Format like 'Fri, 14 Oct 1983, 9:30 AM'. Only 12-hour if the locale is.
38
+ * @param date Date
39
+ * @param timezone string
40
+ * @returns string
41
+ */
42
+ static toLocalWeekDayAndDateTime(date, timezone) {
43
+ date = timezone ? DateHelper.setTimezone(date, timezone) : date;
44
+ return date ? luxon_1.DateTime.fromJSDate(date).toLocaleString(luxon_1.DateTime.DATETIME_MED_WITH_WEEKDAY) : '';
45
+ }
46
+ /**
47
+ * Is date between start and end dates
48
+ * @param date Date
49
+ * @param start Date
50
+ * @param end Date
51
+ * @returns
52
+ */
53
+ static isBetween(date, start, end) {
54
+ return date.getTime() >= start.getTime() && date.getTime() <= end.getTime();
55
+ }
56
+ /**
57
+ * Converts a Date to a date-only string in the format "YYYY-MM-DD".
58
+ * @param date Given date
59
+ * @returns Date string
60
+ */
61
+ static toDateOnly(date) {
62
+ return date.toISOString().split('T')[0];
63
+ }
64
+ ;
65
+ /**
66
+ * Converts a Date to a time-only string in the format "HH:MM:SS.sssZ".
67
+ * @param date Given date
68
+ * @returns Time string
69
+ */
70
+ static toTimeOnly(date) {
71
+ return date.toISOString().split('T')[1];
72
+ }
73
+ ;
74
+ /**
75
+ * Get DateTime instance from Date
76
+ * @param date
77
+ * @returns DateTime
78
+ */
79
+ static toDateTimeInstance(date) {
80
+ const dt = luxon_1.DateTime.fromJSDate(date);
81
+ return dt.isValid ? dt : null;
82
+ }
83
+ /**
84
+ * Check if date is start of day
85
+ * @param date Given date
86
+ * @returns True if date is start of day
87
+ */
88
+ static isStartOfDay(date) {
89
+ return (date.getHours() === 0 &&
90
+ date.getMinutes() === 0 &&
91
+ date.getSeconds() === 0 &&
92
+ date.getMilliseconds() === 0);
93
+ }
94
+ /**
95
+ * Check if date is end of day
96
+ * @param date Given date
97
+ * @returns True if date is end of day
98
+ */
99
+ static isEndOfDay(date) {
100
+ return (date.getHours() === 23 &&
101
+ date.getMinutes() === 59 &&
102
+ date.getSeconds() === 59 &&
103
+ date.getMilliseconds() === 999);
104
+ }
105
+ /**
106
+ * Converts a number to a WeekdayNumbers enum from luxon.
107
+ * @param val
108
+ * @returns
109
+ */
110
+ static toWeekdayNumber(val) {
111
+ return (val === 1 ? 1
112
+ : val === 2 ? 2
113
+ : val === 3 ? 3
114
+ : val === 4 ? 4
115
+ : val === 5 ? 5
116
+ : val === 6 ? 6
117
+ : val === 7 ? 7
118
+ : undefined);
119
+ }
120
+ ;
121
+ /**
122
+ * Converts a WeekDay enum from intelact/driveup to a WeekdayNumbers enum from luxon.
123
+ * @param Weekday - The weekday to convert
124
+ * @returns WeekdayNumbers from luxon - 1 to 7
125
+ */
126
+ static getWeekdayNumber(weekday) {
127
+ return (weekday === shared_1.WeekDay.Monday ? 1
128
+ : weekday === shared_1.WeekDay.Tuesday ? 2
129
+ : weekday === shared_1.WeekDay.Wednesday ? 3
130
+ : weekday === shared_1.WeekDay.Thursday ? 4
131
+ : weekday === shared_1.WeekDay.Friday ? 5
132
+ : weekday === shared_1.WeekDay.Saturday ? 6
133
+ : 7 // Sunday
134
+ );
135
+ }
136
+ /**
137
+ * Get WeekDay from DateTime
138
+ * @param date
139
+ * @returns WeekDay
140
+ */
141
+ static getWeekday(date) {
142
+ const number = date.weekday;
143
+ return (number === 1 ? shared_1.WeekDay.Monday
144
+ : number === 2 ? shared_1.WeekDay.Tuesday
145
+ : number === 3 ? shared_1.WeekDay.Wednesday
146
+ : number === 4 ? shared_1.WeekDay.Thursday
147
+ : number === 5 ? shared_1.WeekDay.Friday
148
+ : number === 6 ? shared_1.WeekDay.Saturday
149
+ : shared_1.WeekDay.Sunday);
150
+ }
151
+ /**
152
+ * Converts a WeekDay enum from intelact/driveup to a MySQL weekday number.
153
+ * @param Weekday - The weekday to convert
154
+ * @returns number - MySQL weekday number (0 = Monday, 6 = Sunday)
155
+ */
156
+ static getMySqlWeekday(weekday) {
157
+ return (weekday === shared_1.WeekDay.Monday ? 0
158
+ : weekday === shared_1.WeekDay.Tuesday ? 1
159
+ : weekday === shared_1.WeekDay.Wednesday ? 2
160
+ : weekday === shared_1.WeekDay.Thursday ? 3
161
+ : weekday === shared_1.WeekDay.Friday ? 4
162
+ : weekday === shared_1.WeekDay.Saturday ? 5
163
+ : 6 // Sunday
164
+ );
165
+ }
166
+ /**
167
+ * Merge periods
168
+ * @param Period[]
169
+ * @returns Period[] - Returns an array of merged periods
170
+ */
171
+ static mergePeriods(periods) {
172
+ if (!periods?.length)
173
+ return [];
174
+ periods.sort((a, b) => a.startDate.getTime() - b.startDate.getTime());
175
+ const merged = [];
176
+ for (const period of periods) {
177
+ // if this is the first itteration of the loop, add the period to the reslult array
178
+ if (!merged.length) {
179
+ merged.push(period);
180
+ continue;
181
+ }
182
+ const last = merged[merged.length - 1];
183
+ // if the period overlaps with the last one, merge them
184
+ if (period.startDate <= last.endDate) {
185
+ last.endDate = last.endDate > period.endDate ? last.endDate : period.endDate;
186
+ }
187
+ else {
188
+ merged.push(period);
189
+ }
190
+ }
191
+ return merged;
192
+ }
193
+ /**
194
+ * Merge appointment periods
195
+ * @param Appointment[]
196
+ * @returns Appointment[] - Returns an array of merged appointments
197
+ */
198
+ static mergeAppointmentPeriods(appointments) {
199
+ if (!appointments?.length)
200
+ return [];
201
+ appointments.sort((a, b) => new Date(a.startDate).getTime() - new Date(b.startDate).getTime());
202
+ const merged = [];
203
+ for (const appointment of appointments) {
204
+ // if this is the first itteration of the loop, add the period to the reslult array
205
+ if (!merged.length) {
206
+ merged.push(appointment);
207
+ continue;
208
+ }
209
+ // if the period overlaps with the last period in the array, merge them
210
+ const last = merged[merged.length - 1];
211
+ if (new Date(appointment.startDate) <= new Date(last.endDate)) {
212
+ last.endDate =
213
+ last.endDate > appointment.endDate ? last.endDate : appointment.endDate;
214
+ }
215
+ else {
216
+ merged.push(appointment);
217
+ }
218
+ }
219
+ return merged;
220
+ }
221
+ /**
222
+ * Get a formatted date string in "DD MMM YYYY" format,
223
+ * or an empty string if the given date is invalid.
224
+ * Example: "23 Oct 2025"
225
+ * @param date string | number | Date
226
+ * @param local Default de
227
+ * @returns Formatted date string
228
+ */
229
+ static formatDate(date, local = shared_1.Language.De) {
230
+ if (!date)
231
+ return '';
232
+ return new Date(date).toLocaleDateString(local, {
233
+ day: 'numeric',
234
+ month: 'short',
235
+ year: 'numeric'
236
+ });
237
+ }
238
+ /**
239
+ * Get a formatted date and time string in "DD MMM YYYY - HH:MM" format,
240
+ * or an empty string if the given date is invalid.
241
+ * Example: "23 Oct 2025 - 14:30"
242
+ * @param date string | number | Date
243
+ * @param seperator Default '-'
244
+ * @param local Default de
245
+ * @returns Formatted date and time string
246
+ */
247
+ static formatDateAndTime(date, seperator = '-', local = shared_1.Language.De) {
248
+ if (!date)
249
+ return '';
250
+ const dateObj = new Date(date);
251
+ const datePart = dateObj.toLocaleDateString(local, {
252
+ day: 'numeric',
253
+ month: 'short',
254
+ year: 'numeric'
255
+ });
256
+ const timePart = dateObj.toLocaleTimeString(local, {
257
+ hour: '2-digit',
258
+ minute: '2-digit',
259
+ hour12: false
260
+ });
261
+ return `${datePart} ${seperator} ${timePart}`;
262
+ }
263
+ }
264
+ exports.DateHelper = DateHelper;
265
+ //# sourceMappingURL=date.helper.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"date.helper.js","sourceRoot":"","sources":["../../src/utils/date.helper.ts"],"names":[],"mappings":";;;AAAA,4CAAoD;AACpD,iCAAiD;AAIjD,MAAa,UAAU;IAEtB;;;;;OAKG;IACH,MAAM,CAAC,WAAW,CAAC,IAAU,EAAE,QAAgB;QAC9C,OAAO,IAAI,GAAG,gBAAQ,CAAC,UAAU,CAAC,IAAI,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC,CAAC,QAAQ,EAAE,CAAC;IACxE,CAAC;IAED;;;;;OAKG;IACH,MAAM,CAAC,WAAW,CAAC,IAAU,EAAE,QAAiB;QAC/C,IAAI,GAAG,QAAQ,CAAC,CAAC,CAAC,UAAU,CAAC,WAAW,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;QAChE,OAAO,IAAI,CAAC,CAAC,CAAC,gBAAQ,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,cAAc,CAAC,gBAAQ,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;IACjF,CAAC;IAED;;;;;OAKG;IACH,MAAM,CAAC,eAAe,CAAC,IAAU,EAAE,QAAiB;QACnD,IAAI,GAAG,QAAQ,CAAC,CAAC,CAAC,UAAU,CAAC,WAAW,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;QAChE,OAAO,IAAI,CAAC,CAAC,CAAC,gBAAQ,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,cAAc,CAAC,gBAAQ,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;IACpF,CAAC;IAED;;;;;OAKG;IACH,MAAM,CAAC,yBAAyB,CAAC,IAAU,EAAE,QAAiB;QAC7D,IAAI,GAAG,QAA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AAG,EAAE,QAAgB,iBAAQ,CAAC,EAAE;QAC1G,IAAI,CAAC,IAAI;YAAE,OAAO,EAAE,CAAC;QACrB,MAAM,OAAO,GAAG,IAAI,IAAI,CAAC,IAAI,CAAC,CAAC;QAE/B,MAAM,QAAQ,GAAG,OAAO,CAAC,kBAAkB,CAAC,KAAK,EAAE;YAClD,GAAG,EAAE,SAAS;YACd,KAAK,EAAE,OAAO;YACd,IAAI,EAAE,SAAS;SACf,CAAC,CAAC;QAEH,MAAM,QAAQ,GAAG,OAAO,CAAC,kBAAkB,CAAC,KAAK,EAAE;YAClD,IAAI,EAAE,SAAS;YACf,MAAM,EAAE,SAAS;YACjB,MAAM,EAAE,KAAK;SACb,CAAC,CAAC;QAEH,OAAO,GAAG,QAAQ,IAAI,SAAS,IAAI,QAAQ,EAAE,CAAC;IAC/C,CAAC;CACD;AAlSD,gCAkSC"}
@@ -0,0 +1,9 @@
1
+ export declare class PhoneHelper {
2
+ /**
3
+ * Extracts the country code from a given phone number string.
4
+ * @param phoneNumber - The phone number string to extract the country code from.
5
+ * @param prefix - The prefix to prepend to the extracted country code. Default is '+'.
6
+ * @returns The extracted country code with the specified prefix, or null if not found.
7
+ */
8
+ static extractCountryCode(phoneNumber: string, prefix?: string): string;
9
+ }
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PhoneHelper = void 0;
4
+ class PhoneHelper {
5
+ /**
6
+ * Extracts the country code from a given phone number string.
7
+ * @param phoneNumber - The phone number string to extract the country code from.
8
+ * @param prefix - The prefix to prepend to the extracted country code. Default is '+'.
9
+ * @returns The extracted country code with the specified prefix, or null if not found.
10
+ */
11
+ static extractCountryCode(phoneNumber, prefix = '+') {
12
+ const match = /^\+(\d{1,4})/.exec(phoneNumber);
13
+ return match ? prefix + match[1] : null;
14
+ }
15
+ }
16
+ exports.PhoneHelper = PhoneHelper;
17
+ //# sourceMappingURL=phone.helper.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"phone.helper.js","sourceRoot":"","sources":["../../src/utils/phone.helper.ts"],"names":[],"mappings":";;;AACA,MAAa,WAAW;IAEvB;;;;;OAKG;IACH,MAAM,CAAC,kBAAkB,CAAC,WAAmB,EAAE,MAAM,GAAG,GAAG;QAC1D,MAAM,KAAK,GAAG,cAAc,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;QAC/C,OAAO,KAAK,CAAC,CAAC,CAAC,MAAM,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;IACzC,CAAC;CACD;AAZD,kCAYC"}
@@ -0,0 +1,77 @@
1
+ import { ValidationArguments, ValidationOptions, ValidatorConstraintInterface } from "class-validator";
2
+ /**
3
+ * Validator constraint that ensures two fields are both empty or both filled
4
+ * Used for mutually dependent fields that should be set together
5
+ */
6
+ export declare class MutuallyRequiredConstraint implements ValidatorConstraintInterface {
7
+ /**
8
+ * Validates that both fields are either empty or both have values
9
+ * @param value - The value of the decorated field
10
+ * @param args - Validation arguments containing the related field name
11
+ * @returns True if both fields are empty or both have values, false otherwise
12
+ */
13
+ validate(value: any, args: ValidationArguments): boolean;
14
+ /**
15
+ * Returns the default error message when validation fails
16
+ * @param args - Validation arguments
17
+ * @returns Error message string
18
+ */
19
+ defaultMessage(args: ValidationArguments): string;
20
+ }
21
+ /**
22
+ * Decorator that checks if two fields are mutually empty or both with value
23
+ * Both fields must be either empty or filled together
24
+ *
25
+ * @param relatedField - The field name that needs to be checked with the decorated field
26
+ * @param validationOptions - Optional class-validator validation options
27
+ * @returns Property decorator function
28
+ *
29
+ * @example
30
+ * ```typescript
31
+ * class MyDto {
32
+ * @MutuallyRequired('endDate')
33
+ * startDate: Date;
34
+ *
35
+ * endDate: Date;
36
+ * }
37
+ * ```
38
+ */
39
+ export declare function MutuallyRequired(relatedField: string, validationOptions?: ValidationOptions): (object: Object, propertyName: string) => void;
40
+ /**
41
+ * Validator constraint that ensures at least one of two fields has a value
42
+ * Used for fields where at least one must be provided
43
+ */
44
+ export declare class EitherRequiredConstraint implements ValidatorConstraintInterface {
45
+ /**
46
+ * Validates that at least one of the two fields has a value
47
+ * @param value - The value of the decorated field
48
+ * @param args - Validation arguments containing the related field name
49
+ * @returns True if at least one field has a value, false if both are empty
50
+ */
51
+ validate(value: any, args: ValidationArguments): boolean;
52
+ /**
53
+ * Returns the default error message when validation fails
54
+ * @param args - Validation arguments
55
+ * @returns Error message string
56
+ */
57
+ defaultMessage(args: ValidationArguments): string;
58
+ }
59
+ /**
60
+ * Decorator that checks if at least one of two fields has a value
61
+ * At least one field must be provided
62
+ *
63
+ * @param relatedField - The field name that needs to be checked with the decorated field
64
+ * @param validationOptions - Optional class-validator validation options
65
+ * @returns Property decorator function
66
+ *
67
+ * @example
68
+ * ```typescript
69
+ * class MyDto {
70
+ * @EitherRequired('email')
71
+ * phone: string;
72
+ *
73
+ * email: string;
74
+ * }
75
+ * ```
76
+ */
77
+ export declare function EitherRequired(relatedField: string, validationOptions?: ValidationOptions): (object: Object, propertyName: string) => void;