@intelact/driveup 2.4.4 → 2.4.5

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 (359) hide show
  1. package/package.json +2 -2
  2. package/lib/agent/agent.dto.d.ts +0 -6
  3. package/lib/agent/agent.dto.js +0 -39
  4. package/lib/agent/agent.dto.js.map +0 -1
  5. package/lib/agent/agent.model.d.ts +0 -13
  6. package/lib/agent/agent.model.js +0 -60
  7. package/lib/agent/agent.model.js.map +0 -1
  8. package/lib/agent/client.model.d.ts +0 -8
  9. package/lib/agent/client.model.js +0 -37
  10. package/lib/agent/client.model.js.map +0 -1
  11. package/lib/agent/code.model.d.ts +0 -12
  12. package/lib/agent/code.model.js +0 -43
  13. package/lib/agent/code.model.js.map +0 -1
  14. package/lib/alert/alert.model.d.ts +0 -16
  15. package/lib/alert/alert.model.js +0 -66
  16. package/lib/alert/alert.model.js.map +0 -1
  17. package/lib/auth/signin.dto.d.ts +0 -6
  18. package/lib/auth/signin.dto.js +0 -35
  19. package/lib/auth/signin.dto.js.map +0 -1
  20. package/lib/auth/signup.dto.d.ts +0 -9
  21. package/lib/auth/signup.dto.js +0 -46
  22. package/lib/auth/signup.dto.js.map +0 -1
  23. package/lib/bill/bill-item.model.d.ts +0 -38
  24. package/lib/bill/bill-item.model.js +0 -88
  25. package/lib/bill/bill-item.model.js.map +0 -1
  26. package/lib/bill/bill.model.d.ts +0 -36
  27. package/lib/bill/bill.model.js +0 -101
  28. package/lib/bill/bill.model.js.map +0 -1
  29. package/lib/calendar/appointment.d.ts +0 -92
  30. package/lib/calendar/appointment.js +0 -213
  31. package/lib/calendar/appointment.js.map +0 -1
  32. package/lib/calendar/date.d.ts +0 -23
  33. package/lib/calendar/date.js +0 -87
  34. package/lib/calendar/date.js.map +0 -1
  35. package/lib/calendar/holiday.d.ts +0 -7
  36. package/lib/calendar/holiday.js +0 -28
  37. package/lib/calendar/holiday.js.map +0 -1
  38. package/lib/calendar/token.d.ts +0 -15
  39. package/lib/calendar/token.js +0 -3
  40. package/lib/calendar/token.js.map +0 -1
  41. package/lib/calendar/working.d.ts +0 -9
  42. package/lib/calendar/working.js +0 -41
  43. package/lib/calendar/working.js.map +0 -1
  44. package/lib/common/app-info.d.ts +0 -21
  45. package/lib/common/app-info.js +0 -93
  46. package/lib/common/app-info.js.map +0 -1
  47. package/lib/common/content.d.ts +0 -21
  48. package/lib/common/content.js +0 -78
  49. package/lib/common/content.js.map +0 -1
  50. package/lib/common/email.d.ts +0 -4
  51. package/lib/common/email.js +0 -29
  52. package/lib/common/email.js.map +0 -1
  53. package/lib/common/id.d.ts +0 -3
  54. package/lib/common/id.js +0 -25
  55. package/lib/common/id.js.map +0 -1
  56. package/lib/common/language.d.ts +0 -4
  57. package/lib/common/language.js +0 -22
  58. package/lib/common/language.js.map +0 -1
  59. package/lib/common/phone.d.ts +0 -4
  60. package/lib/common/phone.js +0 -31
  61. package/lib/common/phone.js.map +0 -1
  62. package/lib/common/price.d.ts +0 -3
  63. package/lib/common/price.js +0 -25
  64. package/lib/common/price.js.map +0 -1
  65. package/lib/common/profile.d.ts +0 -5
  66. package/lib/common/profile.js +0 -28
  67. package/lib/common/profile.js.map +0 -1
  68. package/lib/common/promotion.d.ts +0 -3
  69. package/lib/common/promotion.js +0 -24
  70. package/lib/common/promotion.js.map +0 -1
  71. package/lib/common/search.d.ts +0 -3
  72. package/lib/common/search.js +0 -23
  73. package/lib/common/search.js.map +0 -1
  74. package/lib/common/social.d.ts +0 -7
  75. package/lib/common/social.js +0 -40
  76. package/lib/common/social.js.map +0 -1
  77. package/lib/common/sort.d.ts +0 -7
  78. package/lib/common/sort.js +0 -39
  79. package/lib/common/sort.js.map +0 -1
  80. package/lib/common/url.d.ts +0 -3
  81. package/lib/common/url.js +0 -24
  82. package/lib/common/url.js.map +0 -1
  83. package/lib/company/company-widget.model.d.ts +0 -10
  84. package/lib/company/company-widget.model.js +0 -35
  85. package/lib/company/company-widget.model.js.map +0 -1
  86. package/lib/company/company.model.d.ts +0 -75
  87. package/lib/company/company.model.js +0 -227
  88. package/lib/company/company.model.js.map +0 -1
  89. package/lib/company/dependency.model.d.ts +0 -5
  90. package/lib/company/dependency.model.js +0 -30
  91. package/lib/company/dependency.model.js.map +0 -1
  92. package/lib/country/country.dto.d.ts +0 -24
  93. package/lib/country/country.dto.js +0 -132
  94. package/lib/country/country.dto.js.map +0 -1
  95. package/lib/country/country.model.d.ts +0 -19
  96. package/lib/country/country.model.js +0 -80
  97. package/lib/country/country.model.js.map +0 -1
  98. package/lib/course/appointment.model.d.ts +0 -14
  99. package/lib/course/appointment.model.js +0 -47
  100. package/lib/course/appointment.model.js.map +0 -1
  101. package/lib/course/course.model.d.ts +0 -44
  102. package/lib/course/course.model.js +0 -141
  103. package/lib/course/course.model.js.map +0 -1
  104. package/lib/course/definition.model.d.ts +0 -15
  105. package/lib/course/definition.model.js +0 -66
  106. package/lib/course/definition.model.js.map +0 -1
  107. package/lib/course/dto.d.ts +0 -47
  108. package/lib/course/dto.js +0 -191
  109. package/lib/course/dto.js.map +0 -1
  110. package/lib/course/part.model.d.ts +0 -23
  111. package/lib/course/part.model.js +0 -86
  112. package/lib/course/part.model.js.map +0 -1
  113. package/lib/credit/credit.model.d.ts +0 -8
  114. package/lib/credit/credit.model.js +0 -43
  115. package/lib/credit/credit.model.js.map +0 -1
  116. package/lib/currency/currency.dto.d.ts +0 -19
  117. package/lib/currency/currency.dto.js +0 -109
  118. package/lib/currency/currency.dto.js.map +0 -1
  119. package/lib/currency/currency.model.d.ts +0 -11
  120. package/lib/currency/currency.model.js +0 -53
  121. package/lib/currency/currency.model.js.map +0 -1
  122. package/lib/device/device.agent.d.ts +0 -51
  123. package/lib/device/device.agent.js +0 -3
  124. package/lib/device/device.agent.js.map +0 -1
  125. package/lib/device/device.model.d.ts +0 -11
  126. package/lib/device/device.model.js +0 -53
  127. package/lib/device/device.model.js.map +0 -1
  128. package/lib/device/device.signature.d.ts +0 -4
  129. package/lib/device/device.signature.js +0 -30
  130. package/lib/device/device.signature.js.map +0 -1
  131. package/lib/driving/category/category.dto.d.ts +0 -37
  132. package/lib/driving/category/category.dto.js +0 -144
  133. package/lib/driving/category/category.dto.js.map +0 -1
  134. package/lib/driving/category/category.model.d.ts +0 -35
  135. package/lib/driving/category/category.model.js +0 -99
  136. package/lib/driving/category/category.model.js.map +0 -1
  137. package/lib/driving/exam/exam.dto.d.ts +0 -8
  138. package/lib/driving/exam/exam.dto.js +0 -39
  139. package/lib/driving/exam/exam.dto.js.map +0 -1
  140. package/lib/driving/exam/exam.model.d.ts +0 -8
  141. package/lib/driving/exam/exam.model.js +0 -39
  142. package/lib/driving/exam/exam.model.js.map +0 -1
  143. package/lib/driving/lesson/lesson.d.ts +0 -10
  144. package/lib/driving/lesson/lesson.js +0 -48
  145. package/lib/driving/lesson/lesson.js.map +0 -1
  146. package/lib/driving/lesson/skill.d.ts +0 -13
  147. package/lib/driving/lesson/skill.dto.d.ts +0 -7
  148. package/lib/driving/lesson/skill.dto.js +0 -32
  149. package/lib/driving/lesson/skill.dto.js.map +0 -1
  150. package/lib/driving/lesson/skill.js +0 -43
  151. package/lib/driving/lesson/skill.js.map +0 -1
  152. package/lib/driving/lesson/topic.d.ts +0 -20
  153. package/lib/driving/lesson/topic.dto.d.ts +0 -18
  154. package/lib/driving/lesson/topic.dto.js +0 -72
  155. package/lib/driving/lesson/topic.dto.js.map +0 -1
  156. package/lib/driving/lesson/topic.js +0 -72
  157. package/lib/driving/lesson/topic.js.map +0 -1
  158. package/lib/expense/category.model.d.ts +0 -18
  159. package/lib/expense/category.model.js +0 -69
  160. package/lib/expense/category.model.js.map +0 -1
  161. package/lib/expense/expense.dto.d.ts +0 -28
  162. package/lib/expense/expense.dto.js +0 -144
  163. package/lib/expense/expense.dto.js.map +0 -1
  164. package/lib/expense/expense.model.d.ts +0 -19
  165. package/lib/expense/expense.model.js +0 -85
  166. package/lib/expense/expense.model.js.map +0 -1
  167. package/lib/finance/company-payment.model.d.ts +0 -10
  168. package/lib/finance/company-payment.model.js +0 -45
  169. package/lib/finance/company-payment.model.js.map +0 -1
  170. package/lib/finance/discount.dto.d.ts +0 -4
  171. package/lib/finance/discount.dto.js +0 -30
  172. package/lib/finance/discount.dto.js.map +0 -1
  173. package/lib/finance/finance.dto.d.ts +0 -56
  174. package/lib/finance/finance.dto.js +0 -277
  175. package/lib/finance/finance.dto.js.map +0 -1
  176. package/lib/finance/finance.model.d.ts +0 -34
  177. package/lib/finance/finance.model.js +0 -124
  178. package/lib/finance/finance.model.js.map +0 -1
  179. package/lib/finance/payment-method.model.d.ts +0 -20
  180. package/lib/finance/payment-method.model.js +0 -72
  181. package/lib/finance/payment-method.model.js.map +0 -1
  182. package/lib/finance/payment.dto.d.ts +0 -6
  183. package/lib/finance/payment.dto.js +0 -37
  184. package/lib/finance/payment.dto.js.map +0 -1
  185. package/lib/finance/refund.dto.d.ts +0 -4
  186. package/lib/finance/refund.dto.js +0 -30
  187. package/lib/finance/refund.dto.js.map +0 -1
  188. package/lib/free-benefit/free-benefit.model.d.ts +0 -7
  189. package/lib/free-benefit/free-benefit.model.js +0 -31
  190. package/lib/free-benefit/free-benefit.model.js.map +0 -1
  191. package/lib/geo/address.dto.d.ts +0 -19
  192. package/lib/geo/address.dto.js +0 -73
  193. package/lib/geo/address.dto.js.map +0 -1
  194. package/lib/geo/geoinfo.interface.d.ts +0 -17
  195. package/lib/geo/geoinfo.interface.js +0 -3
  196. package/lib/geo/geoinfo.interface.js.map +0 -1
  197. package/lib/geo/pickup.model.d.ts +0 -11
  198. package/lib/geo/pickup.model.js +0 -55
  199. package/lib/geo/pickup.model.js.map +0 -1
  200. package/lib/giftcode/giftcode-group.model.d.ts +0 -13
  201. package/lib/giftcode/giftcode-group.model.js +0 -56
  202. package/lib/giftcode/giftcode-group.model.js.map +0 -1
  203. package/lib/giftcode/giftcode.dto.d.ts +0 -37
  204. package/lib/giftcode/giftcode.dto.js +0 -130
  205. package/lib/giftcode/giftcode.dto.js.map +0 -1
  206. package/lib/giftcode/giftcode.model.d.ts +0 -19
  207. package/lib/giftcode/giftcode.model.js +0 -70
  208. package/lib/giftcode/giftcode.model.js.map +0 -1
  209. package/lib/handover/handover.dto.d.ts +0 -6
  210. package/lib/handover/handover.dto.js +0 -41
  211. package/lib/handover/handover.dto.js.map +0 -1
  212. package/lib/handover/handover.model.d.ts +0 -14
  213. package/lib/handover/handover.model.js +0 -59
  214. package/lib/handover/handover.model.js.map +0 -1
  215. package/lib/index.d.ts +0 -118
  216. package/lib/index.js +0 -309
  217. package/lib/index.js.map +0 -1
  218. package/lib/instructor/instructor.dto.d.ts +0 -19
  219. package/lib/instructor/instructor.dto.js +0 -95
  220. package/lib/instructor/instructor.dto.js.map +0 -1
  221. package/lib/instructor/instructor.model.d.ts +0 -46
  222. package/lib/instructor/instructor.model.js +0 -164
  223. package/lib/instructor/instructor.model.js.map +0 -1
  224. package/lib/invoice/invoice.dto.d.ts +0 -10
  225. package/lib/invoice/invoice.dto.js +0 -60
  226. package/lib/invoice/invoice.dto.js.map +0 -1
  227. package/lib/invoice/invoice.model.d.ts +0 -33
  228. package/lib/invoice/invoice.model.js +0 -137
  229. package/lib/invoice/invoice.model.js.map +0 -1
  230. package/lib/invoice/item.model.d.ts +0 -7
  231. package/lib/invoice/item.model.js +0 -38
  232. package/lib/invoice/item.model.js.map +0 -1
  233. package/lib/item/item.model.d.ts +0 -68
  234. package/lib/item/item.model.js +0 -46
  235. package/lib/item/item.model.js.map +0 -1
  236. package/lib/license/license.model.d.ts +0 -7
  237. package/lib/license/license.model.js +0 -47
  238. package/lib/license/license.model.js.map +0 -1
  239. package/lib/log/log.model.d.ts +0 -8
  240. package/lib/log/log.model.js +0 -38
  241. package/lib/log/log.model.js.map +0 -1
  242. package/lib/metric/metric.model.d.ts +0 -43
  243. package/lib/metric/metric.model.js +0 -113
  244. package/lib/metric/metric.model.js.map +0 -1
  245. package/lib/notification/notification.model.d.ts +0 -13
  246. package/lib/notification/notification.model.js +0 -60
  247. package/lib/notification/notification.model.js.map +0 -1
  248. package/lib/notification/preference.dto.d.ts +0 -5
  249. package/lib/notification/preference.dto.js +0 -33
  250. package/lib/notification/preference.dto.js.map +0 -1
  251. package/lib/notification/preference.model.d.ts +0 -8
  252. package/lib/notification/preference.model.js +0 -42
  253. package/lib/notification/preference.model.js.map +0 -1
  254. package/lib/payout/payout.model.d.ts +0 -12
  255. package/lib/payout/payout.model.js +0 -59
  256. package/lib/payout/payout.model.js.map +0 -1
  257. package/lib/priceplan/plan.dto.d.ts +0 -13
  258. package/lib/priceplan/plan.dto.js +0 -67
  259. package/lib/priceplan/plan.dto.js.map +0 -1
  260. package/lib/priceplan/plan.model.d.ts +0 -38
  261. package/lib/priceplan/plan.model.js +0 -111
  262. package/lib/priceplan/plan.model.js.map +0 -1
  263. package/lib/public/contac-us.dto.d.ts +0 -6
  264. package/lib/public/contac-us.dto.js +0 -43
  265. package/lib/public/contac-us.dto.js.map +0 -1
  266. package/lib/public/contact-sales.dto.d.ts +0 -9
  267. package/lib/public/contact-sales.dto.js +0 -62
  268. package/lib/public/contact-sales.dto.js.map +0 -1
  269. package/lib/public/country-support.dto.d.ts +0 -6
  270. package/lib/public/country-support.dto.js +0 -43
  271. package/lib/public/country-support.dto.js.map +0 -1
  272. package/lib/security/role.dto.d.ts +0 -4
  273. package/lib/security/role.dto.js +0 -23
  274. package/lib/security/role.dto.js.map +0 -1
  275. package/lib/security/token.d.ts +0 -30
  276. package/lib/security/token.js +0 -3
  277. package/lib/security/token.js.map +0 -1
  278. package/lib/session/driving/session.dto.d.ts +0 -13
  279. package/lib/session/driving/session.dto.js +0 -71
  280. package/lib/session/driving/session.dto.js.map +0 -1
  281. package/lib/session/driving/session.model.d.ts +0 -16
  282. package/lib/session/driving/session.model.js +0 -56
  283. package/lib/session/driving/session.model.js.map +0 -1
  284. package/lib/session/driving/session.skill.d.ts +0 -5
  285. package/lib/session/driving/session.skill.js +0 -27
  286. package/lib/session/driving/session.skill.js.map +0 -1
  287. package/lib/session/driving/session.topic.d.ts +0 -13
  288. package/lib/session/driving/session.topic.js +0 -53
  289. package/lib/session/driving/session.topic.js.map +0 -1
  290. package/lib/setting/setting.dto.d.ts +0 -3
  291. package/lib/setting/setting.dto.js +0 -24
  292. package/lib/setting/setting.dto.js.map +0 -1
  293. package/lib/setting/setting.model.d.ts +0 -10
  294. package/lib/setting/setting.model.js +0 -46
  295. package/lib/setting/setting.model.js.map +0 -1
  296. package/lib/signature/signature.model.d.ts +0 -10
  297. package/lib/signature/signature.model.js +0 -43
  298. package/lib/signature/signature.model.js.map +0 -1
  299. package/lib/student/student.dto.d.ts +0 -20
  300. package/lib/student/student.dto.js +0 -115
  301. package/lib/student/student.dto.js.map +0 -1
  302. package/lib/student/student.model.d.ts +0 -27
  303. package/lib/student/student.model.js +0 -107
  304. package/lib/student/student.model.js.map +0 -1
  305. package/lib/task/task.dto.d.ts +0 -24
  306. package/lib/task/task.dto.js +0 -137
  307. package/lib/task/task.dto.js.map +0 -1
  308. package/lib/task/task.model.d.ts +0 -8
  309. package/lib/task/task.model.js +0 -44
  310. package/lib/task/task.model.js.map +0 -1
  311. package/lib/ticket/ticket.dto.d.ts +0 -13
  312. package/lib/ticket/ticket.dto.js +0 -60
  313. package/lib/ticket/ticket.dto.js.map +0 -1
  314. package/lib/ticket/ticket.model.d.ts +0 -11
  315. package/lib/ticket/ticket.model.js +0 -48
  316. package/lib/ticket/ticket.model.js.map +0 -1
  317. package/lib/training/request.dto.d.ts +0 -4
  318. package/lib/training/request.dto.js +0 -23
  319. package/lib/training/request.dto.js.map +0 -1
  320. package/lib/training/request.model.d.ts +0 -25
  321. package/lib/training/request.model.js +0 -88
  322. package/lib/training/request.model.js.map +0 -1
  323. package/lib/training/training-actions.model.d.ts +0 -7
  324. package/lib/training/training-actions.model.js +0 -40
  325. package/lib/training/training-actions.model.js.map +0 -1
  326. package/lib/training/training.dto.d.ts +0 -56
  327. package/lib/training/training.dto.js +0 -255
  328. package/lib/training/training.dto.js.map +0 -1
  329. package/lib/training/training.model.d.ts +0 -137
  330. package/lib/training/training.model.js +0 -308
  331. package/lib/training/training.model.js.map +0 -1
  332. package/lib/tsconfig.tsbuildinfo +0 -1
  333. package/lib/user/agent.interface.d.ts +0 -6
  334. package/lib/user/agent.interface.js +0 -3
  335. package/lib/user/agent.interface.js.map +0 -1
  336. package/lib/user/profile.dto.d.ts +0 -12
  337. package/lib/user/profile.dto.js +0 -52
  338. package/lib/user/profile.dto.js.map +0 -1
  339. package/lib/user/user.model.d.ts +0 -50
  340. package/lib/user/user.model.js +0 -174
  341. package/lib/user/user.model.js.map +0 -1
  342. package/lib/utils/array.helper.d.ts +0 -28
  343. package/lib/utils/array.helper.js +0 -42
  344. package/lib/utils/array.helper.js.map +0 -1
  345. package/lib/utils/compare.validator.d.ts +0 -9
  346. package/lib/utils/compare.validator.js +0 -35
  347. package/lib/utils/compare.validator.js.map +0 -1
  348. package/lib/utils/date.helper.d.ts +0 -127
  349. package/lib/utils/date.helper.js +0 -265
  350. package/lib/utils/date.helper.js.map +0 -1
  351. package/lib/utils/phone.helper.d.ts +0 -9
  352. package/lib/utils/phone.helper.js +0 -17
  353. package/lib/utils/phone.helper.js.map +0 -1
  354. package/lib/utils/required.validator.d.ts +0 -77
  355. package/lib/utils/required.validator.js +0 -151
  356. package/lib/utils/required.validator.js.map +0 -1
  357. package/lib/utils/transformers.helper.d.ts +0 -49
  358. package/lib/utils/transformers.helper.js +0 -203
  359. package/lib/utils/transformers.helper.js.map +0 -1
@@ -1,265 +0,0 @@
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
@@ -1 +0,0 @@
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;IACx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,CAAC,CAAC;QAEH,OAAO,GAAG,QAAQ,IAAI,SAAS,IAAI,QAAQ,EAAE,CAAC;IAC/C,CAAC;CACD;AAlSD,gCAkSC"}
@@ -1,9 +0,0 @@
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
- }
@@ -1,17 +0,0 @@
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
@@ -1 +0,0 @@
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"}
@@ -1,77 +0,0 @@
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;
@@ -1,151 +0,0 @@
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.EitherRequiredConstraint = exports.MutuallyRequiredConstraint = void 0;
10
- exports.MutuallyRequired = MutuallyRequired;
11
- exports.EitherRequired = EitherRequired;
12
- const class_validator_1 = require("class-validator");
13
- /**
14
- * Validator constraint that ensures two fields are both empty or both filled
15
- * Used for mutually dependent fields that should be set together
16
- */
17
- let MutuallyRequiredConstraint = class MutuallyRequiredConstraint {
18
- /**
19
- * Validates that both fields are either empty or both have values
20
- * @param value - The value of the decorated field
21
- * @param args - Validation arguments containing the related field name
22
- * @returns True if both fields are empty or both have values, false otherwise
23
- */
24
- validate(value, args) {
25
- const dto = args.object;
26
- const relatedField = args.constraints[0]; // field name passed in the decorator
27
- const relatedValue = dto[relatedField];
28
- if (!value && !relatedValue) {
29
- // Both are empty: validation passes
30
- return true;
31
- }
32
- if (value && relatedValue) {
33
- // Both fields set: validation passes
34
- return true;
35
- }
36
- // One field has a value but the other does not. validation fails
37
- return false;
38
- }
39
- /**
40
- * Returns the default error message when validation fails
41
- * @param args - Validation arguments
42
- * @returns Error message string
43
- */
44
- defaultMessage(args) {
45
- return `${args.property} cannot be null if ${args.constraints[0]} is provided`;
46
- }
47
- };
48
- exports.MutuallyRequiredConstraint = MutuallyRequiredConstraint;
49
- exports.MutuallyRequiredConstraint = MutuallyRequiredConstraint = __decorate([
50
- (0, class_validator_1.ValidatorConstraint)({
51
- name: 'MutuallyRequired',
52
- async: false
53
- })
54
- ], MutuallyRequiredConstraint);
55
- /**
56
- * Decorator that checks if two fields are mutually empty or both with value
57
- * Both fields must be either empty or filled together
58
- *
59
- * @param relatedField - The field name that needs to be checked with the decorated field
60
- * @param validationOptions - Optional class-validator validation options
61
- * @returns Property decorator function
62
- *
63
- * @example
64
- * ```typescript
65
- * class MyDto {
66
- * @MutuallyRequired('endDate')
67
- * startDate: Date;
68
- *
69
- * endDate: Date;
70
- * }
71
- * ```
72
- */
73
- function MutuallyRequired(relatedField, validationOptions) {
74
- return function (object, propertyName) {
75
- (0, class_validator_1.registerDecorator)({
76
- target: object.constructor,
77
- propertyName: propertyName,
78
- options: validationOptions,
79
- constraints: [relatedField], // This should be dynamic
80
- validator: MutuallyRequiredConstraint
81
- });
82
- };
83
- }
84
- /**
85
- * Validator constraint that ensures at least one of two fields has a value
86
- * Used for fields where at least one must be provided
87
- */
88
- let EitherRequiredConstraint = class EitherRequiredConstraint {
89
- /**
90
- * Validates that at least one of the two fields has a value
91
- * @param value - The value of the decorated field
92
- * @param args - Validation arguments containing the related field name
93
- * @returns True if at least one field has a value, false if both are empty
94
- */
95
- validate(value, args) {
96
- const dto = args.object;
97
- const relatedField = args.constraints[0]; // field name passed in the decorator
98
- const relatedValue = dto[relatedField];
99
- if (value || relatedValue) {
100
- // One has value: validation passes
101
- return true;
102
- }
103
- // Neither has value: validation fails
104
- return false;
105
- }
106
- /**
107
- * Returns the default error message when validation fails
108
- * @param args - Validation arguments
109
- * @returns Error message string
110
- */
111
- defaultMessage(args) {
112
- return `${args.property} cannot be empty if ${args.constraints[0]} is also empty`;
113
- }
114
- };
115
- exports.EitherRequiredConstraint = EitherRequiredConstraint;
116
- exports.EitherRequiredConstraint = EitherRequiredConstraint = __decorate([
117
- (0, class_validator_1.ValidatorConstraint)({
118
- name: 'EitherRequired',
119
- async: false
120
- })
121
- ], EitherRequiredConstraint);
122
- /**
123
- * Decorator that checks if at least one of two fields has a value
124
- * At least one field must be provided
125
- *
126
- * @param relatedField - The field name that needs to be checked with the decorated field
127
- * @param validationOptions - Optional class-validator validation options
128
- * @returns Property decorator function
129
- *
130
- * @example
131
- * ```typescript
132
- * class MyDto {
133
- * @EitherRequired('email')
134
- * phone: string;
135
- *
136
- * email: string;
137
- * }
138
- * ```
139
- */
140
- function EitherRequired(relatedField, validationOptions) {
141
- return function (object, propertyName) {
142
- (0, class_validator_1.registerDecorator)({
143
- target: object.constructor,
144
- propertyName: propertyName,
145
- options: validationOptions,
146
- constraints: [relatedField], // This should be dynamic
147
- validator: EitherRequiredConstraint
148
- });
149
- };
150
- }
151
- //# sourceMappingURL=required.validator.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"required.validator.js","sourceRoot":"","sources":["../../src/utils/required.validator.ts"],"names":[],"mappings":";;;;;;;;;AAsEA,4CAaC;AA2DD,wCAaC;AA3JD,qDAMyB;AAEzB;;;GAGG;AAKI,IAAM,0BAA0B,GAAhC,MAAM,0BAA0B;IACtC;;;;;OAKG;IACH,QAAQ,CAAC,KAAU,EAAE,IAAyB;QAC7C,MAAM,GAAG,GAAG,IAAI,CAAC,MAA6B,CAAC;QAC/C,MAAM,YAAY,GAAG,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC,qCAAqC;QAC/E,MAAM,YAAY,GAAG,GAAG,CAAC,YAAY,CAAC,CAAC;QAEvC,IAAI,CAAC,KAAK,IAAI,CAAC,YAAY,EAAE,CAAC;YAC7B,oCAAoC;YACpC,OAAO,IAAI,CAAC;QACb,CAAC;QAED,IAAI,KAAK,IAAI,YAAY,EAAE,CAAC;YAC3B,qCAAqC;YACrC,OAAO,IAAI,CAAC;QACb,CAAC;QAED,iEAAiE;QACjE,OAAO,KAAK,CAAC;IACd,CAAC;IAED;;;;OAIG;IACH,cAAc,CAAC,IAAyB;QACvC,OAAO,G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wB;IAJpC,IAAA,qCAAmB,EAAC;QACpB,IAAI,EAAE,gBAAgB;QACtB,KAAK,EAAE,KAAK;KACZ,CAAC;GACW,wBAAwB,CA6BpC;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,SAAgB,cAAc,CAC7B,YAAoB,EACpB,iBAAqC;IAErC,OAAO,UAAU,MAAc,EAAE,YAAoB;QACpD,IAAA,mCAAiB,EAAC;YACjB,MAAM,EAAE,MAAM,CAAC,WAAW;YAC1B,YAAY,EAAE,YAAY;YAC1B,OAAO,EAAE,iBAAiB;YAC1B,WAAW,EAAE,CAAC,YAAY,CAAC,EAAE,yBAAyB;YACtD,SAAS,EAAE,wBAAwB;SACnC,CAAC,CAAC;IACJ,CAAC,CAAC;AACH,CAAC"}
@@ -1,49 +0,0 @@
1
- /**
2
- * Transforms a value to an array of numbers
3
- * Handles comma-separated strings, single values, and arrays
4
- * Filters out NaN values
5
- * @returns A class-transformer decorator
6
- */
7
- export declare function ToNumberArray(): PropertyDecorator;
8
- export declare function RemoveSpaces(): PropertyDecorator;
9
- /**
10
- * Transforms a value to an array of strings
11
- * Handles comma-separated strings, single values, and arrays
12
- * Trims and filters out empty strings
13
- * @returns A class-transformer decorator
14
- */
15
- export declare function ToStringArray(): PropertyDecorator;
16
- /**
17
- * Transforms a value to an enum type
18
- * Matches by value or key (case-insensitive)
19
- * @template E - The enum type
20
- * @param enumType - The enum object to transform to
21
- * @returns A class-transformer decorator
22
- */
23
- export declare function ToEnum<E extends object>(enumType: E): PropertyDecorator;
24
- /**
25
- * Transforms a value to an array of enum values
26
- * Matches by value or key (case-insensitive)
27
- * @template E - The enum type
28
- * @param enumType - The enum object to transform to
29
- * @returns A class-transformer decorator
30
- */
31
- export declare function ToEnumArray<E extends object>(enumType: E): PropertyDecorator;
32
- /**
33
- * Transforms a value to a number
34
- * Returns original value if conversion results in NaN
35
- * @returns A class-transformer decorator
36
- */
37
- export declare function ToNumber(): PropertyDecorator;
38
- /**
39
- * Trims whitespace from string values
40
- * Returns non-string values unchanged
41
- * @returns A class-transformer decorator
42
- */
43
- export declare function Trim(): PropertyDecorator;
44
- /**
45
- * Transforms a value to a boolean
46
- * Handles string values ('true', 'false', '1', '0') and numeric values (1, 0)
47
- * @returns A class-transformer decorator
48
- */
49
- export declare function ToBoolean(): PropertyDecorator;