@intelact/driveup 1.4.44 → 1.5.2
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.
- package/lib/agent/agent.dto.js +2 -10
- package/lib/agent/agent.dto.js.map +1 -1
- package/lib/agent/agent.model.d.ts +1 -1
- package/lib/agent/agent.model.js +1 -1
- package/lib/agent/agent.model.js.map +1 -1
- package/lib/agent/index.d.ts +0 -2
- package/lib/agent/index.js +0 -2
- package/lib/agent/index.js.map +1 -1
- package/lib/alert/alert.model.d.ts +3 -5
- package/lib/alert/alert.model.js +1 -3
- package/lib/alert/alert.model.js.map +1 -1
- package/lib/alert/index.d.ts +0 -1
- package/lib/alert/index.js +0 -1
- package/lib/alert/index.js.map +1 -1
- package/lib/auth/signin.dto.js +3 -3
- package/lib/auth/signin.dto.js.map +1 -1
- package/lib/auth/signup.dto.js +3 -3
- package/lib/auth/signup.dto.js.map +1 -1
- package/lib/bank/account.model.js +6 -4
- package/lib/bank/account.model.js.map +1 -1
- package/lib/bill/bill.model.d.ts +1 -1
- package/lib/bill/bill.model.js +1 -1
- package/lib/bill/bill.model.js.map +1 -1
- package/lib/bill/index.d.ts +0 -2
- package/lib/bill/index.js +0 -2
- package/lib/bill/index.js.map +1 -1
- package/lib/calendar/appointment.d.ts +4 -4
- package/lib/calendar/appointment.js +20 -9
- package/lib/calendar/appointment.js.map +1 -1
- package/lib/calendar/date.js +6 -6
- package/lib/calendar/date.js.map +1 -1
- package/lib/calendar/index.d.ts +0 -1
- package/lib/calendar/index.js +0 -1
- package/lib/calendar/index.js.map +1 -1
- package/lib/calendar/token.d.ts +1 -1
- package/lib/calendar/working.d.ts +1 -1
- package/lib/calendar/working.js +1 -1
- package/lib/calendar/working.js.map +1 -1
- package/lib/common/content.d.ts +1 -1
- package/lib/common/content.js +10 -9
- package/lib/common/content.js.map +1 -1
- package/lib/common/email.js +3 -3
- package/lib/common/email.js.map +1 -1
- package/lib/common/id.js +2 -6
- package/lib/common/id.js.map +1 -1
- package/lib/common/index.d.ts +1 -1
- package/lib/common/index.js +1 -1
- package/lib/common/index.js.map +1 -1
- package/lib/common/language.d.ts +1 -6
- package/lib/common/language.js +3 -9
- package/lib/common/language.js.map +1 -1
- package/lib/common/person.d.ts +16 -0
- package/lib/common/person.js +60 -0
- package/lib/common/person.js.map +1 -0
- package/lib/common/phone.js +3 -3
- package/lib/common/phone.js.map +1 -1
- package/lib/common/price.js +2 -4
- package/lib/common/price.js.map +1 -1
- package/lib/common/promotion.js +2 -0
- package/lib/common/promotion.js.map +1 -1
- package/lib/common/search.js +2 -2
- package/lib/common/search.js.map +1 -1
- package/lib/common/social.js +2 -1
- package/lib/common/social.js.map +1 -1
- package/lib/common/sort.js +2 -6
- package/lib/common/sort.js.map +1 -1
- package/lib/common/url.js +2 -2
- package/lib/common/url.js.map +1 -1
- package/lib/company/company.model.d.ts +1 -2
- package/lib/company/company.model.js +1 -2
- package/lib/company/company.model.js.map +1 -1
- package/lib/country/country.dto.d.ts +1 -1
- package/lib/country/country.dto.js +14 -16
- package/lib/country/country.dto.js.map +1 -1
- package/lib/country/country.model.d.ts +1 -1
- package/lib/course/appointment.model.d.ts +1 -1
- package/lib/course/appointment.model.js +1 -1
- package/lib/course/appointment.model.js.map +1 -1
- package/lib/course/course.model.d.ts +2 -2
- package/lib/course/course.model.js +1 -1
- package/lib/course/course.model.js.map +1 -1
- package/lib/course/definition.model.d.ts +1 -1
- package/lib/course/dto.d.ts +2 -3
- package/lib/course/dto.js +11 -34
- package/lib/course/dto.js.map +1 -1
- package/lib/course/index.d.ts +0 -1
- package/lib/course/index.js +0 -1
- package/lib/course/index.js.map +1 -1
- package/lib/currency/currency.dto.js +11 -13
- package/lib/currency/currency.dto.js.map +1 -1
- package/lib/discount/discount.dto.js +2 -2
- package/lib/discount/discount.dto.js.map +1 -1
- package/lib/discount/discount.model.d.ts +2 -3
- package/lib/discount/discount.model.js +1 -2
- package/lib/discount/discount.model.js.map +1 -1
- package/lib/driving/category/category.dto.d.ts +1 -1
- package/lib/driving/category/category.dto.js +7 -7
- package/lib/driving/category/category.dto.js.map +1 -1
- package/lib/driving/category/category.model.d.ts +1 -1
- package/lib/driving/exam/exam.dto.d.ts +2 -2
- package/lib/driving/exam/exam.dto.js +4 -4
- package/lib/driving/exam/exam.dto.js.map +1 -1
- package/lib/driving/exam/exam.model.d.ts +2 -2
- package/lib/driving/exam/exam.model.js +1 -1
- package/lib/driving/exam/exam.model.js.map +1 -1
- package/lib/driving/index.d.ts +0 -1
- package/lib/driving/index.js +0 -1
- package/lib/driving/index.js.map +1 -1
- package/lib/driving/lesson/index.d.ts +0 -1
- package/lib/driving/lesson/index.js +0 -1
- package/lib/driving/lesson/index.js.map +1 -1
- package/lib/driving/lesson/skill.d.ts +2 -3
- package/lib/driving/lesson/skill.dto.d.ts +2 -2
- package/lib/driving/lesson/skill.dto.js +4 -4
- package/lib/driving/lesson/skill.dto.js.map +1 -1
- package/lib/driving/lesson/skill.js +1 -1
- package/lib/driving/lesson/skill.js.map +1 -1
- package/lib/driving/lesson/topic.d.ts +1 -1
- package/lib/driving/lesson/topic.dto.d.ts +2 -2
- package/lib/driving/lesson/topic.dto.js +7 -8
- package/lib/driving/lesson/topic.dto.js.map +1 -1
- package/lib/event/event.dto.js +9 -13
- package/lib/event/event.dto.js.map +1 -1
- package/lib/events/agent/account.events.d.ts +27 -0
- package/lib/events/agent/account.events.js +32 -0
- package/lib/events/agent/account.events.js.map +1 -0
- package/lib/events/agent/payout.events.d.ts +29 -0
- package/lib/events/agent/payout.events.js +34 -0
- package/lib/events/agent/payout.events.js.map +1 -0
- package/lib/events/agent/profile.events.d.ts +18 -0
- package/lib/events/agent/profile.events.js +23 -0
- package/lib/events/agent/profile.events.js.map +1 -0
- package/lib/events/agent/promotion.events.d.ts +42 -0
- package/lib/events/agent/promotion.events.js +47 -0
- package/lib/events/agent/promotion.events.js.map +1 -0
- package/lib/events/auth/auth.events.d.ts +16 -0
- package/lib/events/auth/auth.events.js +21 -0
- package/lib/events/auth/auth.events.js.map +1 -0
- package/lib/events/auth/token.events.d.ts +23 -0
- package/lib/events/auth/token.events.js +28 -0
- package/lib/events/auth/token.events.js.map +1 -0
- package/lib/events/auth/verify.events.d.ts +17 -0
- package/lib/events/auth/verify.events.js +22 -0
- package/lib/events/auth/verify.events.js.map +1 -0
- package/lib/events/company/account/account.events.d.ts +64 -0
- package/lib/events/company/account/account.events.js +69 -0
- package/lib/events/company/account/account.events.js.map +1 -0
- package/lib/events/company/account/profile.events.d.ts +169 -0
- package/lib/events/company/account/profile.events.js +174 -0
- package/lib/events/company/account/profile.events.js.map +1 -0
- package/lib/events/company/course/appointment.events.d.ts +56 -0
- package/lib/events/company/course/appointment.events.js +61 -0
- package/lib/events/company/course/appointment.events.js.map +1 -0
- package/lib/events/company/course/course.events.d.ts +118 -0
- package/lib/events/company/course/course.events.js +123 -0
- package/lib/events/company/course/course.events.js.map +1 -0
- package/lib/events/company/course/lesson.events.d.ts +56 -0
- package/lib/events/company/course/lesson.events.js +61 -0
- package/lib/events/company/course/lesson.events.js.map +1 -0
- package/lib/events/company/course/topic.events.d.ts +76 -0
- package/lib/events/company/course/topic.events.js +81 -0
- package/lib/events/company/course/topic.events.js.map +1 -0
- package/lib/events/company/product/addon.events.d.ts +34 -0
- package/lib/events/company/product/addon.events.js +39 -0
- package/lib/events/company/product/addon.events.js.map +1 -0
- package/lib/events/company/product/campaign.events.d.ts +13 -0
- package/lib/events/company/product/campaign.events.js +18 -0
- package/lib/events/company/product/campaign.events.js.map +1 -0
- package/lib/events/company/product/product.events.d.ts +54 -0
- package/lib/events/company/product/product.events.js +59 -0
- package/lib/events/company/product/product.events.js.map +1 -0
- package/lib/events/index.d.ts +25 -0
- package/lib/events/index.js +42 -0
- package/lib/events/index.js.map +1 -0
- package/lib/events/instructor/account/account.events.d.ts +123 -0
- package/lib/events/instructor/account/account.events.js +128 -0
- package/lib/events/instructor/account/account.events.js.map +1 -0
- package/lib/events/instructor/account/profile.events.d.ts +31 -0
- package/lib/events/instructor/account/profile.events.js +36 -0
- package/lib/events/instructor/account/profile.events.js.map +1 -0
- package/lib/events/instructor/task/task.events.d.ts +24 -0
- package/lib/events/instructor/task/task.events.js +29 -0
- package/lib/events/instructor/task/task.events.js.map +1 -0
- package/lib/events/student/account/account.events.d.ts +36 -0
- package/lib/events/student/account/account.events.js +41 -0
- package/lib/events/student/account/account.events.js.map +1 -0
- package/lib/events/user/account.events.d.ts +84 -0
- package/lib/events/user/account.events.js +89 -0
- package/lib/events/user/account.events.js.map +1 -0
- package/lib/events/user/alert.events.d.ts +16 -0
- package/lib/events/user/alert.events.js +21 -0
- package/lib/events/user/alert.events.js.map +1 -0
- package/lib/events/user/device.events.d.ts +30 -0
- package/lib/events/user/device.events.js +35 -0
- package/lib/events/user/device.events.js.map +1 -0
- package/lib/events/user/notification.events.d.ts +30 -0
- package/lib/events/user/notification.events.js +35 -0
- package/lib/events/user/notification.events.js.map +1 -0
- package/lib/events/user/profile.events.d.ts +60 -0
- package/lib/events/user/profile.events.js +65 -0
- package/lib/events/user/profile.events.js.map +1 -0
- package/lib/expense/category.model.d.ts +1 -1
- package/lib/expense/category.model.js +1 -1
- package/lib/expense/category.model.js.map +1 -1
- package/lib/expense/expense.dto.d.ts +2 -3
- package/lib/expense/expense.dto.js +14 -29
- package/lib/expense/expense.dto.js.map +1 -1
- package/lib/expense/expense.model.d.ts +2 -2
- package/lib/expense/expense.model.js +1 -1
- package/lib/expense/expense.model.js.map +1 -1
- package/lib/expense/index.d.ts +0 -1
- package/lib/expense/index.js +0 -1
- package/lib/expense/index.js.map +1 -1
- package/lib/finance/finance.dto.d.ts +7 -9
- package/lib/finance/finance.dto.js +38 -131
- package/lib/finance/finance.dto.js.map +1 -1
- package/lib/finance/finance.model.d.ts +3 -5
- package/lib/finance/finance.model.js +1 -3
- package/lib/finance/finance.model.js.map +1 -1
- package/lib/finance/index.d.ts +0 -1
- package/lib/finance/index.js +0 -1
- package/lib/finance/index.js.map +1 -1
- package/lib/free-benefit/free-benefit.model.d.ts +1 -1
- package/lib/free-benefit/free-benefit.model.js +1 -1
- package/lib/free-benefit/free-benefit.model.js.map +1 -1
- package/lib/free-benefit/index.d.ts +0 -1
- package/lib/free-benefit/index.js +0 -1
- package/lib/free-benefit/index.js.map +1 -1
- package/lib/geo/address.dto.js +7 -7
- package/lib/geo/address.dto.js.map +1 -1
- package/lib/geo/coordinate.model.js +3 -3
- package/lib/geo/coordinate.model.js.map +1 -1
- package/lib/giftcode/giftcode.dto.js +7 -7
- package/lib/giftcode/giftcode.dto.js.map +1 -1
- package/lib/handover/index.d.ts +0 -1
- package/lib/handover/index.js +0 -1
- package/lib/handover/index.js.map +1 -1
- package/lib/index.d.ts +4 -3
- package/lib/index.js +4 -3
- package/lib/index.js.map +1 -1
- package/lib/instructor/instructor.dto.d.ts +2 -4
- package/lib/instructor/instructor.dto.js +12 -32
- package/lib/instructor/instructor.dto.js.map +1 -1
- package/lib/instructor/instructor.model.d.ts +3 -6
- package/lib/instructor/instructor.model.js +2 -8
- package/lib/instructor/instructor.model.js.map +1 -1
- package/lib/invoice/index.d.ts +0 -1
- package/lib/invoice/index.js +0 -1
- package/lib/invoice/index.js.map +1 -1
- package/lib/invoice/invoice.dto.d.ts +2 -2
- package/lib/invoice/invoice.dto.js +7 -9
- package/lib/invoice/invoice.dto.js.map +1 -1
- package/lib/invoice/invoice.model.d.ts +2 -3
- package/lib/invoice/invoice.model.js +1 -2
- package/lib/invoice/invoice.model.js.map +1 -1
- package/lib/link/link.model.d.ts +2 -2
- package/lib/link/link.model.js +1 -1
- package/lib/link/link.model.js.map +1 -1
- package/lib/log/index.d.ts +0 -1
- package/lib/log/index.js +0 -1
- package/lib/log/index.js.map +1 -1
- package/lib/log/log.model.d.ts +1 -1
- package/lib/log/log.model.js +1 -1
- package/lib/log/log.model.js.map +1 -1
- package/lib/notification/index.d.ts +0 -1
- package/lib/notification/index.js +0 -1
- package/lib/notification/index.js.map +1 -1
- package/lib/notification/notification.model.d.ts +2 -2
- package/lib/notification/notification.model.js +1 -1
- package/lib/notification/notification.model.js.map +1 -1
- package/lib/payment/company-payment.model.d.ts +3 -3
- package/lib/payment/company-payment.model.js +1 -1
- package/lib/payment/company-payment.model.js.map +1 -1
- package/lib/payment/index.d.ts +0 -1
- package/lib/payment/index.js +0 -1
- package/lib/payment/index.js.map +1 -1
- package/lib/payment/payment.dto.d.ts +1 -1
- package/lib/payment/payment.dto.js +5 -5
- package/lib/payment/payment.dto.js.map +1 -1
- package/lib/payment/payment.model.d.ts +2 -4
- package/lib/payment/payment.model.js +1 -3
- package/lib/payment/payment.model.js.map +1 -1
- package/lib/payout/index.d.ts +0 -1
- package/lib/payout/index.js +0 -1
- package/lib/payout/index.js.map +1 -1
- package/lib/payout/payout.model.d.ts +2 -2
- package/lib/payout/payout.model.js +1 -1
- package/lib/payout/payout.model.js.map +1 -1
- package/lib/priceplan/index.d.ts +0 -1
- package/lib/priceplan/index.js +0 -1
- package/lib/priceplan/index.js.map +1 -1
- package/lib/priceplan/plan.dto.d.ts +1 -1
- package/lib/priceplan/plan.dto.js +6 -6
- package/lib/priceplan/plan.dto.js.map +1 -1
- package/lib/priceplan/plan.model.d.ts +1 -1
- package/lib/priceplan/plan.model.js +1 -1
- package/lib/priceplan/plan.model.js.map +1 -1
- package/lib/refund/refund.dto.js +2 -2
- package/lib/refund/refund.dto.js.map +1 -1
- package/lib/refund/refund.model.d.ts +2 -3
- package/lib/refund/refund.model.js +1 -2
- package/lib/refund/refund.model.js.map +1 -1
- package/lib/security/index.d.ts +0 -4
- package/lib/security/index.js +0 -4
- package/lib/security/index.js.map +1 -1
- package/lib/security/role.dto.d.ts +2 -2
- package/lib/security/role.dto.js +2 -2
- package/lib/security/role.dto.js.map +1 -1
- package/lib/session/driving/session.topic.d.ts +2 -2
- package/lib/session/driving/session.topic.js +1 -1
- package/lib/session/driving/session.topic.js.map +1 -1
- package/lib/setting/index.d.ts +0 -1
- package/lib/setting/index.js +0 -1
- package/lib/setting/index.js.map +1 -1
- package/lib/setting/setting.dto.js +2 -2
- package/lib/setting/setting.dto.js.map +1 -1
- package/lib/setting/setting.model.d.ts +2 -2
- package/lib/setting/setting.model.js +1 -1
- package/lib/setting/setting.model.js.map +1 -1
- package/lib/student/student.dto.js +6 -8
- package/lib/student/student.dto.js.map +1 -1
- package/lib/student/student.model.d.ts +2 -3
- package/lib/student/student.model.js +1 -2
- package/lib/student/student.model.js.map +1 -1
- package/lib/task/index.d.ts +2 -0
- package/lib/task/index.js +19 -0
- package/lib/task/index.js.map +1 -0
- package/lib/task/task.dto.d.ts +24 -0
- package/lib/task/task.dto.js +142 -0
- package/lib/task/task.dto.js.map +1 -0
- package/lib/task/task.model.d.ts +8 -0
- package/lib/task/task.model.js +49 -0
- package/lib/task/task.model.js.map +1 -0
- package/lib/ticket/index.d.ts +0 -1
- package/lib/ticket/index.js +0 -1
- package/lib/ticket/index.js.map +1 -1
- package/lib/ticket/ticket.dto.d.ts +1 -1
- package/lib/ticket/ticket.dto.js +7 -7
- package/lib/ticket/ticket.dto.js.map +1 -1
- package/lib/ticket/ticket.model.d.ts +1 -1
- package/lib/ticket/ticket.model.js +1 -1
- package/lib/ticket/ticket.model.js.map +1 -1
- package/lib/training/driving.model.d.ts +1 -1
- package/lib/training/driving.model.js +1 -1
- package/lib/training/driving.model.js.map +1 -1
- package/lib/training/index.d.ts +0 -1
- package/lib/training/index.js +0 -1
- package/lib/training/index.js.map +1 -1
- package/lib/training/request.dto.d.ts +2 -2
- package/lib/training/request.dto.js +2 -2
- package/lib/training/request.dto.js.map +1 -1
- package/lib/training/request.model.d.ts +2 -3
- package/lib/training/request.model.js +1 -2
- package/lib/training/request.model.js.map +1 -1
- package/lib/training/training.dto.d.ts +5 -6
- package/lib/training/training.dto.js +25 -80
- package/lib/training/training.dto.js.map +1 -1
- package/lib/training/training.model.d.ts +2 -3
- package/lib/training/training.model.js +6 -7
- package/lib/training/training.model.js.map +1 -1
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/lib/types/activity.type.d.ts +46 -0
- package/lib/types/activity.type.js +51 -0
- package/lib/types/activity.type.js.map +1 -0
- package/lib/types/addon.type.d.ts +66 -0
- package/lib/types/addon.type.js +71 -0
- package/lib/types/addon.type.js.map +1 -0
- package/lib/types/calendar.type.d.ts +24 -0
- package/lib/types/calendar.type.js +31 -0
- package/lib/types/calendar.type.js.map +1 -0
- package/lib/types/driving.type.d.ts +12 -0
- package/lib/types/driving.type.js +18 -0
- package/lib/types/driving.type.js.map +1 -0
- package/lib/types/earning.type.d.ts +6 -0
- package/lib/types/earning.type.js +3 -0
- package/lib/types/earning.type.js.map +1 -0
- package/lib/types/finance.type.d.ts +67 -0
- package/lib/types/finance.type.js +77 -0
- package/lib/types/finance.type.js.map +1 -0
- package/lib/types/index.d.ts +15 -0
- package/lib/types/index.js +32 -0
- package/lib/types/index.js.map +1 -0
- package/lib/types/interface.d.ts +79 -0
- package/lib/types/interface.js +4 -0
- package/lib/types/interface.js.map +1 -0
- package/lib/types/metric.type.d.ts +34 -0
- package/lib/types/metric.type.js +39 -0
- package/lib/types/metric.type.js.map +1 -0
- package/lib/types/policy.type.d.ts +27 -0
- package/lib/types/policy.type.js +32 -0
- package/lib/types/policy.type.js.map +1 -0
- package/lib/types/priceplan.type.d.ts +39 -0
- package/lib/types/priceplan.type.js +48 -0
- package/lib/types/priceplan.type.js.map +1 -0
- package/lib/types/product.type.d.ts +202 -0
- package/lib/types/product.type.js +209 -0
- package/lib/types/product.type.js.map +1 -0
- package/lib/types/program.type.d.ts +23 -0
- package/lib/types/program.type.js +28 -0
- package/lib/types/program.type.js.map +1 -0
- package/lib/types/security.type.d.ts +54 -0
- package/lib/types/security.type.js +60 -0
- package/lib/types/security.type.js.map +1 -0
- package/lib/types/support.type.d.ts +127 -0
- package/lib/types/support.type.js +144 -0
- package/lib/types/support.type.js.map +1 -0
- package/lib/types/training.type.d.ts +16 -0
- package/lib/types/training.type.js +22 -0
- package/lib/types/training.type.js.map +1 -0
- package/lib/user/index.d.ts +0 -1
- package/lib/user/index.js +0 -1
- package/lib/user/index.js.map +1 -1
- package/lib/user/profile.dto.d.ts +1 -2
- package/lib/user/profile.dto.js +8 -5
- package/lib/user/profile.dto.js.map +1 -1
- package/lib/user/user.model.d.ts +1 -3
- package/lib/user/user.model.js +2 -4
- package/lib/user/user.model.js.map +1 -1
- package/lib/utils/array.helper.js +2 -2
- package/lib/utils/array.helper.js.map +1 -1
- package/lib/utils/compare.validator.d.ts +9 -0
- package/lib/utils/compare.validator.js +35 -0
- package/lib/utils/compare.validator.js.map +1 -0
- package/lib/utils/date.helper.d.ts +30 -1
- package/lib/utils/date.helper.js +59 -20
- package/lib/utils/date.helper.js.map +1 -1
- package/lib/utils/index.d.ts +3 -0
- package/lib/utils/index.js +3 -0
- package/lib/utils/index.js.map +1 -1
- package/lib/utils/required.validator.d.ts +77 -0
- package/lib/utils/required.validator.js +151 -0
- package/lib/utils/required.validator.js.map +1 -0
- package/lib/utils/transformers.helper.d.ts +48 -0
- package/lib/utils/transformers.helper.js +184 -0
- package/lib/utils/transformers.helper.js.map +1 -0
- package/package.json +1 -1
|
@@ -8,7 +8,7 @@ class ArrayHelper {
|
|
|
8
8
|
* @returns Given T type
|
|
9
9
|
*/
|
|
10
10
|
static getRandom(val) {
|
|
11
|
-
const randomIndex = Math.floor(Math.random() *
|
|
11
|
+
const randomIndex = Math.floor(Math.random() * val.length);
|
|
12
12
|
return val[randomIndex];
|
|
13
13
|
}
|
|
14
14
|
/**
|
|
@@ -17,7 +17,7 @@ class ArrayHelper {
|
|
|
17
17
|
* @returns Given T type
|
|
18
18
|
*/
|
|
19
19
|
static getLastItem(val) {
|
|
20
|
-
return val?.length ? val[
|
|
20
|
+
return val?.length ? val[val.length - 1] : undefined;
|
|
21
21
|
}
|
|
22
22
|
/**
|
|
23
23
|
* Sum all numbers in a number array
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"array.helper.js","sourceRoot":"","sources":["../../src/utils/array.helper.ts"],"names":[],"mappings":";;;
|
|
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;CACD;AA9BD,kCA8BC"}
|
|
@@ -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;AAGjC;;;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"}
|
|
@@ -1,6 +1,35 @@
|
|
|
1
1
|
import { DateTime, WeekdayNumbers } from 'luxon';
|
|
2
|
-
import {
|
|
2
|
+
import { WeekDay } from '../types';
|
|
3
|
+
import { Appointment, Period } from '../calendar';
|
|
3
4
|
export declare class DateHelper {
|
|
5
|
+
/**
|
|
6
|
+
* Set timezone to date
|
|
7
|
+
* @param date Date
|
|
8
|
+
* @param timezone string
|
|
9
|
+
* @returns Date
|
|
10
|
+
*/
|
|
11
|
+
static setTimezone(date: Date, timezone: string): Date;
|
|
12
|
+
/**
|
|
13
|
+
* Format like 'October 14, 1983'
|
|
14
|
+
* @param date Date
|
|
15
|
+
* @param timezone string
|
|
16
|
+
* @returns string
|
|
17
|
+
*/
|
|
18
|
+
static toLocalDate(date: Date, timezone?: string): string;
|
|
19
|
+
/**
|
|
20
|
+
* Format like 'Oct 14, 1983, 9:30 AM'. Only 12-hour if the locale is.
|
|
21
|
+
* @param date Date
|
|
22
|
+
* @param timezone string
|
|
23
|
+
* @returns string
|
|
24
|
+
*/
|
|
25
|
+
static toLocalDateTime(date: Date, timezone?: string): string;
|
|
26
|
+
/**
|
|
27
|
+
* Format like 'Fri, 14 Oct 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 toLocalWeekDayAndDateTime(date: Date, timezone?: string): string;
|
|
4
33
|
/**
|
|
5
34
|
* Is date between start and end dates
|
|
6
35
|
* @param date Date
|
package/lib/utils/date.helper.js
CHANGED
|
@@ -2,8 +2,47 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.DateHelper = void 0;
|
|
4
4
|
const luxon_1 = require("luxon");
|
|
5
|
-
const
|
|
5
|
+
const types_1 = require("../types");
|
|
6
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
|
+
}
|
|
7
46
|
/**
|
|
8
47
|
* Is date between start and end dates
|
|
9
48
|
* @param date Date
|
|
@@ -85,12 +124,12 @@ class DateHelper {
|
|
|
85
124
|
* @returns WeekdayNumbers from luxon - 1 to 7
|
|
86
125
|
*/
|
|
87
126
|
static getWeekdayNumber(weekday) {
|
|
88
|
-
return (weekday ===
|
|
89
|
-
: weekday ===
|
|
90
|
-
: weekday ===
|
|
91
|
-
: weekday ===
|
|
92
|
-
: weekday ===
|
|
93
|
-
: weekday ===
|
|
127
|
+
return (weekday === types_1.WeekDay.Monday ? 1
|
|
128
|
+
: weekday === types_1.WeekDay.Tuesday ? 2
|
|
129
|
+
: weekday === types_1.WeekDay.Wednesday ? 3
|
|
130
|
+
: weekday === types_1.WeekDay.Thursday ? 4
|
|
131
|
+
: weekday === types_1.WeekDay.Friday ? 5
|
|
132
|
+
: weekday === types_1.WeekDay.Saturday ? 6
|
|
94
133
|
: 7 // Sunday
|
|
95
134
|
);
|
|
96
135
|
}
|
|
@@ -101,13 +140,13 @@ class DateHelper {
|
|
|
101
140
|
*/
|
|
102
141
|
static getWeekday(date) {
|
|
103
142
|
const number = date.weekday;
|
|
104
|
-
return (number === 1 ?
|
|
105
|
-
: number === 2 ?
|
|
106
|
-
: number === 3 ?
|
|
107
|
-
: number === 4 ?
|
|
108
|
-
: number === 5 ?
|
|
109
|
-
: number === 6 ?
|
|
110
|
-
:
|
|
143
|
+
return (number === 1 ? types_1.WeekDay.Monday
|
|
144
|
+
: number === 2 ? types_1.WeekDay.Tuesday
|
|
145
|
+
: number === 3 ? types_1.WeekDay.Wednesday
|
|
146
|
+
: number === 4 ? types_1.WeekDay.Thursday
|
|
147
|
+
: number === 5 ? types_1.WeekDay.Friday
|
|
148
|
+
: number === 6 ? types_1.WeekDay.Saturday
|
|
149
|
+
: types_1.WeekDay.Sunday);
|
|
111
150
|
}
|
|
112
151
|
/**
|
|
113
152
|
* Converts a WeekDay enum from intelact/driveup to a MySQL weekday number.
|
|
@@ -115,12 +154,12 @@ class DateHelper {
|
|
|
115
154
|
* @returns number - MySQL weekday number (0 = Monday, 6 = Sunday)
|
|
116
155
|
*/
|
|
117
156
|
static getMySqlWeekday(weekday) {
|
|
118
|
-
return (weekday ===
|
|
119
|
-
: weekday ===
|
|
120
|
-
: weekday ===
|
|
121
|
-
: weekday ===
|
|
122
|
-
: weekday ===
|
|
123
|
-
: weekday ===
|
|
157
|
+
return (weekday === types_1.WeekDay.Monday ? 0
|
|
158
|
+
: weekday === types_1.WeekDay.Tuesday ? 1
|
|
159
|
+
: weekday === types_1.WeekDay.Wednesday ? 2
|
|
160
|
+
: weekday === types_1.WeekDay.Thursday ? 3
|
|
161
|
+
: weekday === types_1.WeekDay.Friday ? 4
|
|
162
|
+
: weekday === types_1.WeekDay.Saturday ? 5
|
|
124
163
|
: 6 // Sunday
|
|
125
164
|
);
|
|
126
165
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"date.helper.js","sourceRoot":"","sources":["../../src/utils/date.helper.ts"],"names":[],"mappings":";;;AAAA,iCAAiD;AACjD,
|
|
1
|
+
{"version":3,"file":"date.helper.js","sourceRoot":"","sources":["../../src/utils/date.helper.ts"],"names":[],"mappings":";;;AAAA,iCAAiD;AACjD,oCAAmC;AAGnC,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,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,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"}
|
package/lib/utils/index.d.ts
CHANGED
package/lib/utils/index.js
CHANGED
|
@@ -15,6 +15,9 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./array.helper"), exports);
|
|
18
|
+
__exportStar(require("./compare.validator"), exports);
|
|
18
19
|
__exportStar(require("./date.helper"), exports);
|
|
19
20
|
__exportStar(require("./phone.helper"), exports);
|
|
21
|
+
__exportStar(require("./required.validator"), exports);
|
|
22
|
+
__exportStar(require("./transformers.helper"), exports);
|
|
20
23
|
//# sourceMappingURL=index.js.map
|
package/lib/utils/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,iDAA+B;AAC/B,gDAA8B;AAC9B,iDAA+B"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,iDAA+B;AAC/B,sDAAoC;AACpC,gDAA8B;AAC9B,iDAA+B;AAC/B,uDAAqC;AACrC,wDAAsC"}
|
|
@@ -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;
|
|
@@ -0,0 +1,151 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
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,GAAG,IAAI,CAAC,QAAQ,sBAAsB,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,cAAc,CAAC;IAChF,CAAC;CACD,CAAA;AAlCY,gEAA0B;qCAA1B,0BAA0B;IAJtC,IAAA,qCAAmB,EAAC;QACpB,IAAI,EAAE,kBAAkB;QACxB,KAAK,EAAE,KAAK;KACZ,CAAC;GACW,0BAA0B,CAkCtC;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,SAAgB,gBAAgB,CAC/B,YAAoB,EACpB,iBAAqC;IAErC,OAAO,UAAU,MAAc,EAAE,Y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EAAE,CAAC,YAAY,CAAC,EAAE,yBAAyB;YACtD,SAAS,EAAE,wBAAwB;SACnC,CAAC,CAAC;IACJ,CAAC,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,48 @@
|
|
|
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
|
+
/**
|
|
9
|
+
* Transforms a value to an array of strings
|
|
10
|
+
* Handles comma-separated strings, single values, and arrays
|
|
11
|
+
* Trims and filters out empty strings
|
|
12
|
+
* @returns A class-transformer decorator
|
|
13
|
+
*/
|
|
14
|
+
export declare function ToStringArray(): PropertyDecorator;
|
|
15
|
+
/**
|
|
16
|
+
* Transforms a value to an enum type
|
|
17
|
+
* Matches by value or key (case-insensitive)
|
|
18
|
+
* @template E - The enum type
|
|
19
|
+
* @param enumType - The enum object to transform to
|
|
20
|
+
* @returns A class-transformer decorator
|
|
21
|
+
*/
|
|
22
|
+
export declare function ToEnum<E extends object>(enumType: E): PropertyDecorator;
|
|
23
|
+
/**
|
|
24
|
+
* Transforms a value to an array of enum values
|
|
25
|
+
* Matches by value or key (case-insensitive)
|
|
26
|
+
* @template E - The enum type
|
|
27
|
+
* @param enumType - The enum object to transform to
|
|
28
|
+
* @returns A class-transformer decorator
|
|
29
|
+
*/
|
|
30
|
+
export declare function ToEnumArray<E extends object>(enumType: E): PropertyDecorator;
|
|
31
|
+
/**
|
|
32
|
+
* Transforms a value to a number
|
|
33
|
+
* Returns original value if conversion results in NaN
|
|
34
|
+
* @returns A class-transformer decorator
|
|
35
|
+
*/
|
|
36
|
+
export declare function ToNumber(): PropertyDecorator;
|
|
37
|
+
/**
|
|
38
|
+
* Trims whitespace from string values
|
|
39
|
+
* Returns non-string values unchanged
|
|
40
|
+
* @returns A class-transformer decorator
|
|
41
|
+
*/
|
|
42
|
+
export declare function Trim(): PropertyDecorator;
|
|
43
|
+
/**
|
|
44
|
+
* Transforms a value to a boolean
|
|
45
|
+
* Handles string values ('true', 'false', '1', '0') and numeric values (1, 0)
|
|
46
|
+
* @returns A class-transformer decorator
|
|
47
|
+
*/
|
|
48
|
+
export declare function ToBoolean(): PropertyDecorator;
|