@skyapp-labs/blueprint-backend-core 1.0.9
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/CHANGELOG.md +6 -0
- package/README.md +954 -0
- package/dist/common/base/base.entity.d.ts +12 -0
- package/dist/common/base/base.entity.d.ts.map +1 -0
- package/dist/common/base/base.entity.js +48 -0
- package/dist/common/base/base.entity.js.map +1 -0
- package/dist/common/base/base.repository.d.ts +26 -0
- package/dist/common/base/base.repository.d.ts.map +1 -0
- package/dist/common/base/base.repository.js +61 -0
- package/dist/common/base/base.repository.js.map +1 -0
- package/dist/common/constants/index.d.ts +9 -0
- package/dist/common/constants/index.d.ts.map +1 -0
- package/dist/common/constants/index.js +13 -0
- package/dist/common/constants/index.js.map +1 -0
- package/dist/common/decorators/auth-method-aware.decorator.d.ts +3 -0
- package/dist/common/decorators/auth-method-aware.decorator.d.ts.map +1 -0
- package/dist/common/decorators/auth-method-aware.decorator.js +8 -0
- package/dist/common/decorators/auth-method-aware.decorator.js.map +1 -0
- package/dist/common/decorators/index.d.ts +8 -0
- package/dist/common/decorators/index.d.ts.map +1 -0
- package/dist/common/decorators/index.js +24 -0
- package/dist/common/decorators/index.js.map +1 -0
- package/dist/common/dto/index.d.ts +2 -0
- package/dist/common/dto/index.d.ts.map +1 -0
- package/dist/common/dto/index.js +18 -0
- package/dist/common/dto/index.js.map +1 -0
- package/dist/common/dto/pagination.dto.d.ts +6 -0
- package/dist/common/dto/pagination.dto.d.ts.map +1 -0
- package/dist/common/dto/pagination.dto.js +45 -0
- package/dist/common/dto/pagination.dto.js.map +1 -0
- package/dist/common/filters/http-exception.filter.d.ts +9 -0
- package/dist/common/filters/http-exception.filter.d.ts.map +1 -0
- package/dist/common/filters/http-exception.filter.js +71 -0
- package/dist/common/filters/http-exception.filter.js.map +1 -0
- package/dist/common/filters/index.d.ts +2 -0
- package/dist/common/filters/index.d.ts.map +1 -0
- package/dist/common/filters/index.js +18 -0
- package/dist/common/filters/index.js.map +1 -0
- package/dist/common/guards/auth.guard.d.ts +11 -0
- package/dist/common/guards/auth.guard.d.ts.map +1 -0
- package/dist/common/guards/auth.guard.js +42 -0
- package/dist/common/guards/auth.guard.js.map +1 -0
- package/dist/common/guards/index.d.ts +5 -0
- package/dist/common/guards/index.d.ts.map +1 -0
- package/dist/common/guards/index.js +21 -0
- package/dist/common/guards/index.js.map +1 -0
- package/dist/common/guards/login-ip-rate-limit.guard.d.ts +12 -0
- package/dist/common/guards/login-ip-rate-limit.guard.d.ts.map +1 -0
- package/dist/common/guards/login-ip-rate-limit.guard.js +70 -0
- package/dist/common/guards/login-ip-rate-limit.guard.js.map +1 -0
- package/dist/common/guards/otp-ip-rate-limit.guard.d.ts +12 -0
- package/dist/common/guards/otp-ip-rate-limit.guard.d.ts.map +1 -0
- package/dist/common/guards/otp-ip-rate-limit.guard.js +70 -0
- package/dist/common/guards/otp-ip-rate-limit.guard.js.map +1 -0
- package/dist/common/guards/permissions.guard.d.ts +8 -0
- package/dist/common/guards/permissions.guard.d.ts.map +1 -0
- package/dist/common/guards/permissions.guard.js +41 -0
- package/dist/common/guards/permissions.guard.js.map +1 -0
- package/dist/common/index.d.ts +13 -0
- package/dist/common/index.d.ts.map +1 -0
- package/dist/common/index.js +33 -0
- package/dist/common/index.js.map +1 -0
- package/dist/common/interceptors/index.d.ts +2 -0
- package/dist/common/interceptors/index.d.ts.map +1 -0
- package/dist/common/interceptors/index.js +18 -0
- package/dist/common/interceptors/index.js.map +1 -0
- package/dist/common/interceptors/logging.interceptor.d.ts +10 -0
- package/dist/common/interceptors/logging.interceptor.d.ts.map +1 -0
- package/dist/common/interceptors/logging.interceptor.js +50 -0
- package/dist/common/interceptors/logging.interceptor.js.map +1 -0
- package/dist/common/interfaces/index.d.ts +2 -0
- package/dist/common/interfaces/index.d.ts.map +1 -0
- package/dist/common/interfaces/index.js +18 -0
- package/dist/common/interfaces/index.js.map +1 -0
- package/dist/common/interfaces/request-user.interface.d.ts +5 -0
- package/dist/common/interfaces/request-user.interface.d.ts.map +1 -0
- package/dist/common/interfaces/request-user.interface.js +3 -0
- package/dist/common/interfaces/request-user.interface.js.map +1 -0
- package/dist/common/middlewares/index.d.ts +6 -0
- package/dist/common/middlewares/index.d.ts.map +1 -0
- package/dist/common/middlewares/index.js +23 -0
- package/dist/common/middlewares/index.js.map +1 -0
- package/dist/common/pipes/config-aware-validation.pipe.d.ts +9 -0
- package/dist/common/pipes/config-aware-validation.pipe.d.ts.map +1 -0
- package/dist/common/pipes/config-aware-validation.pipe.js +38 -0
- package/dist/common/pipes/config-aware-validation.pipe.js.map +1 -0
- package/dist/common/pipes/index.d.ts +14 -0
- package/dist/common/pipes/index.d.ts.map +1 -0
- package/dist/common/pipes/index.js +62 -0
- package/dist/common/pipes/index.js.map +1 -0
- package/dist/common/utils/index.d.ts +8 -0
- package/dist/common/utils/index.d.ts.map +1 -0
- package/dist/common/utils/index.js +33 -0
- package/dist/common/utils/index.js.map +1 -0
- package/dist/common/utils/request.utils.d.ts +7 -0
- package/dist/common/utils/request.utils.d.ts.map +1 -0
- package/dist/common/utils/request.utils.js +12 -0
- package/dist/common/utils/request.utils.js.map +1 -0
- package/dist/config/app.config.d.ts +66 -0
- package/dist/config/app.config.d.ts.map +1 -0
- package/dist/config/app.config.js +43 -0
- package/dist/config/app.config.js.map +1 -0
- package/dist/config/database.config.d.ts +16 -0
- package/dist/config/database.config.d.ts.map +1 -0
- package/dist/config/database.config.js +13 -0
- package/dist/config/database.config.js.map +1 -0
- package/dist/config/env.validation.d.ts +34 -0
- package/dist/config/env.validation.d.ts.map +1 -0
- package/dist/config/env.validation.js +172 -0
- package/dist/config/env.validation.js.map +1 -0
- package/dist/config/firebase.module.d.ts +5 -0
- package/dist/config/firebase.module.d.ts.map +1 -0
- package/dist/config/firebase.module.js +21 -0
- package/dist/config/firebase.module.js.map +1 -0
- package/dist/config/index.d.ts +7 -0
- package/dist/config/index.d.ts.map +1 -0
- package/dist/config/index.js +17 -0
- package/dist/config/index.js.map +1 -0
- package/dist/config/keycloak.module.d.ts +6 -0
- package/dist/config/keycloak.module.d.ts.map +1 -0
- package/dist/config/keycloak.module.js +92 -0
- package/dist/config/keycloak.module.js.map +1 -0
- package/dist/config/redis.module.d.ts +10 -0
- package/dist/config/redis.module.d.ts.map +1 -0
- package/dist/config/redis.module.js +111 -0
- package/dist/config/redis.module.js.map +1 -0
- package/dist/core.module.d.ts +12 -0
- package/dist/core.module.d.ts.map +1 -0
- package/dist/core.module.js +53 -0
- package/dist/core.module.js.map +1 -0
- package/dist/database/data-source.d.ts +5 -0
- package/dist/database/data-source.d.ts.map +1 -0
- package/dist/database/data-source.js +56 -0
- package/dist/database/data-source.js.map +1 -0
- package/dist/database/migrations/1775258543167-full-schema.d.ts +7 -0
- package/dist/database/migrations/1775258543167-full-schema.d.ts.map +1 -0
- package/dist/database/migrations/1775258543167-full-schema.js +100 -0
- package/dist/database/migrations/1775258543167-full-schema.js.map +1 -0
- package/dist/database/seeds/roles.seed.d.ts +11 -0
- package/dist/database/seeds/roles.seed.d.ts.map +1 -0
- package/dist/database/seeds/roles.seed.js +66 -0
- package/dist/database/seeds/roles.seed.js.map +1 -0
- package/dist/database/seeds/run-seed.d.ts +2 -0
- package/dist/database/seeds/run-seed.d.ts.map +1 -0
- package/dist/database/seeds/run-seed.js +32 -0
- package/dist/database/seeds/run-seed.js.map +1 -0
- package/dist/database/seeds/settings.seed.d.ts +9 -0
- package/dist/database/seeds/settings.seed.d.ts.map +1 -0
- package/dist/database/seeds/settings.seed.js +450 -0
- package/dist/database/seeds/settings.seed.js.map +1 -0
- package/dist/database/seeds/user.seed.d.ts +9 -0
- package/dist/database/seeds/user.seed.d.ts.map +1 -0
- package/dist/database/seeds/user.seed.js +90 -0
- package/dist/database/seeds/user.seed.js.map +1 -0
- package/dist/database/typeorm.service.d.ts +13 -0
- package/dist/database/typeorm.service.d.ts.map +1 -0
- package/dist/database/typeorm.service.js +52 -0
- package/dist/database/typeorm.service.js.map +1 -0
- package/dist/health/health.controller.d.ts +29 -0
- package/dist/health/health.controller.d.ts.map +1 -0
- package/dist/health/health.controller.js +182 -0
- package/dist/health/health.controller.js.map +1 -0
- package/dist/health/health.module.d.ts +3 -0
- package/dist/health/health.module.d.ts.map +1 -0
- package/dist/health/health.module.js +50 -0
- package/dist/health/health.module.js.map +1 -0
- package/dist/index.d.ts +40 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +79 -0
- package/dist/index.js.map +1 -0
- package/dist/jobs/index.d.ts +6 -0
- package/dist/jobs/index.d.ts.map +1 -0
- package/dist/jobs/index.js +10 -0
- package/dist/jobs/index.js.map +1 -0
- package/dist/jobs/jobs.module.d.ts +6 -0
- package/dist/jobs/jobs.module.d.ts.map +1 -0
- package/dist/jobs/jobs.module.js +63 -0
- package/dist/jobs/jobs.module.js.map +1 -0
- package/dist/jobs/processors/jobs.processor.d.ts +24 -0
- package/dist/jobs/processors/jobs.processor.d.ts.map +1 -0
- package/dist/jobs/processors/jobs.processor.js +164 -0
- package/dist/jobs/processors/jobs.processor.js.map +1 -0
- package/dist/jobs/queues/jobs.queue.d.ts +25 -0
- package/dist/jobs/queues/jobs.queue.d.ts.map +1 -0
- package/dist/jobs/queues/jobs.queue.js +55 -0
- package/dist/jobs/queues/jobs.queue.js.map +1 -0
- package/dist/jobs/queues/queue-names.d.ts +5 -0
- package/dist/jobs/queues/queue-names.d.ts.map +1 -0
- package/dist/jobs/queues/queue-names.js +7 -0
- package/dist/jobs/queues/queue-names.js.map +1 -0
- package/dist/modules/admin/admin.module.d.ts +3 -0
- package/dist/modules/admin/admin.module.d.ts.map +1 -0
- package/dist/modules/admin/admin.module.js +24 -0
- package/dist/modules/admin/admin.module.js.map +1 -0
- package/dist/modules/admin/controllers/admin.controller.d.ts +27 -0
- package/dist/modules/admin/controllers/admin.controller.d.ts.map +1 -0
- package/dist/modules/admin/controllers/admin.controller.js +110 -0
- package/dist/modules/admin/controllers/admin.controller.js.map +1 -0
- package/dist/modules/admin/dto/admin-log.dto.d.ts +17 -0
- package/dist/modules/admin/dto/admin-log.dto.d.ts.map +1 -0
- package/dist/modules/admin/dto/admin-log.dto.js +57 -0
- package/dist/modules/admin/dto/admin-log.dto.js.map +1 -0
- package/dist/modules/admin/entities/admin-log.entity.d.ts +12 -0
- package/dist/modules/admin/entities/admin-log.entity.d.ts.map +1 -0
- package/dist/modules/admin/entities/admin-log.entity.js +53 -0
- package/dist/modules/admin/entities/admin-log.entity.js.map +1 -0
- package/dist/modules/admin/services/admin-log.service.d.ts +11 -0
- package/dist/modules/admin/services/admin-log.service.d.ts.map +1 -0
- package/dist/modules/admin/services/admin-log.service.js +60 -0
- package/dist/modules/admin/services/admin-log.service.js.map +1 -0
- package/dist/modules/auth/auth-core/auth-core.module.d.ts +3 -0
- package/dist/modules/auth/auth-core/auth-core.module.d.ts.map +1 -0
- package/dist/modules/auth/auth-core/auth-core.module.js +40 -0
- package/dist/modules/auth/auth-core/auth-core.module.js.map +1 -0
- package/dist/modules/auth/auth-core/strategies/jwt.strategy.d.ts +18 -0
- package/dist/modules/auth/auth-core/strategies/jwt.strategy.d.ts.map +1 -0
- package/dist/modules/auth/auth-core/strategies/jwt.strategy.js +45 -0
- package/dist/modules/auth/auth-core/strategies/jwt.strategy.js.map +1 -0
- package/dist/modules/auth/auth.manifest.d.ts +9 -0
- package/dist/modules/auth/auth.manifest.d.ts.map +1 -0
- package/dist/modules/auth/auth.manifest.js +29 -0
- package/dist/modules/auth/auth.manifest.js.map +1 -0
- package/dist/modules/auth/auth.module.d.ts +3 -0
- package/dist/modules/auth/auth.module.d.ts.map +1 -0
- package/dist/modules/auth/auth.module.js +67 -0
- package/dist/modules/auth/auth.module.js.map +1 -0
- package/dist/modules/auth/controllers/account.controller.d.ts +42 -0
- package/dist/modules/auth/controllers/account.controller.d.ts.map +1 -0
- package/dist/modules/auth/controllers/account.controller.js +206 -0
- package/dist/modules/auth/controllers/account.controller.js.map +1 -0
- package/dist/modules/auth/controllers/auth.controller.d.ts +32 -0
- package/dist/modules/auth/controllers/auth.controller.d.ts.map +1 -0
- package/dist/modules/auth/controllers/auth.controller.js +206 -0
- package/dist/modules/auth/controllers/auth.controller.js.map +1 -0
- package/dist/modules/auth/controllers/otp.controller.d.ts +10 -0
- package/dist/modules/auth/controllers/otp.controller.d.ts.map +1 -0
- package/dist/modules/auth/controllers/otp.controller.js +156 -0
- package/dist/modules/auth/controllers/otp.controller.js.map +1 -0
- package/dist/modules/auth/dto/index.d.ts +7 -0
- package/dist/modules/auth/dto/index.d.ts.map +1 -0
- package/dist/modules/auth/dto/index.js +23 -0
- package/dist/modules/auth/dto/index.js.map +1 -0
- package/dist/modules/auth/dto/invite.dto.d.ts +7 -0
- package/dist/modules/auth/dto/invite.dto.d.ts.map +1 -0
- package/dist/modules/auth/dto/invite.dto.js +39 -0
- package/dist/modules/auth/dto/invite.dto.js.map +1 -0
- package/dist/modules/auth/dto/login.dto.d.ts +7 -0
- package/dist/modules/auth/dto/login.dto.d.ts.map +1 -0
- package/dist/modules/auth/dto/login.dto.js +48 -0
- package/dist/modules/auth/dto/login.dto.js.map +1 -0
- package/dist/modules/auth/dto/otp.dto.d.ts +15 -0
- package/dist/modules/auth/dto/otp.dto.d.ts.map +1 -0
- package/dist/modules/auth/dto/otp.dto.js +83 -0
- package/dist/modules/auth/dto/otp.dto.js.map +1 -0
- package/dist/modules/auth/dto/password.dto.d.ts +25 -0
- package/dist/modules/auth/dto/password.dto.d.ts.map +1 -0
- package/dist/modules/auth/dto/password.dto.js +122 -0
- package/dist/modules/auth/dto/password.dto.js.map +1 -0
- package/dist/modules/auth/dto/register.dto.d.ts +19 -0
- package/dist/modules/auth/dto/register.dto.d.ts.map +1 -0
- package/dist/modules/auth/dto/register.dto.js +132 -0
- package/dist/modules/auth/dto/register.dto.js.map +1 -0
- package/dist/modules/auth/dto/token.dto.d.ts +15 -0
- package/dist/modules/auth/dto/token.dto.d.ts.map +1 -0
- package/dist/modules/auth/dto/token.dto.js +24 -0
- package/dist/modules/auth/dto/token.dto.js.map +1 -0
- package/dist/modules/auth/entities/index.d.ts +2 -0
- package/dist/modules/auth/entities/index.d.ts.map +1 -0
- package/dist/modules/auth/entities/index.js +18 -0
- package/dist/modules/auth/entities/index.js.map +1 -0
- package/dist/modules/auth/entities/password-reset-token.entity.d.ts +9 -0
- package/dist/modules/auth/entities/password-reset-token.entity.d.ts.map +1 -0
- package/dist/modules/auth/entities/password-reset-token.entity.js +40 -0
- package/dist/modules/auth/entities/password-reset-token.entity.js.map +1 -0
- package/dist/modules/auth/index.d.ts +5 -0
- package/dist/modules/auth/index.d.ts.map +1 -0
- package/dist/modules/auth/index.js +21 -0
- package/dist/modules/auth/index.js.map +1 -0
- package/dist/modules/auth/providers/index.d.ts +5 -0
- package/dist/modules/auth/providers/index.d.ts.map +1 -0
- package/dist/modules/auth/providers/index.js +21 -0
- package/dist/modules/auth/providers/index.js.map +1 -0
- package/dist/modules/auth/providers/interfaces/auth-provider.interface.d.ts +37 -0
- package/dist/modules/auth/providers/interfaces/auth-provider.interface.d.ts.map +1 -0
- package/dist/modules/auth/providers/interfaces/auth-provider.interface.js +3 -0
- package/dist/modules/auth/providers/interfaces/auth-provider.interface.js.map +1 -0
- package/dist/modules/auth/providers/interfaces/index.d.ts +2 -0
- package/dist/modules/auth/providers/interfaces/index.d.ts.map +1 -0
- package/dist/modules/auth/providers/interfaces/index.js +18 -0
- package/dist/modules/auth/providers/interfaces/index.js.map +1 -0
- package/dist/modules/auth/providers/keycloak/index.d.ts +3 -0
- package/dist/modules/auth/providers/keycloak/index.d.ts.map +1 -0
- package/dist/modules/auth/providers/keycloak/index.js +19 -0
- package/dist/modules/auth/providers/keycloak/index.js.map +1 -0
- package/dist/modules/auth/providers/keycloak/keycloak-auth-provider.module.d.ts +3 -0
- package/dist/modules/auth/providers/keycloak/keycloak-auth-provider.module.d.ts.map +1 -0
- package/dist/modules/auth/providers/keycloak/keycloak-auth-provider.module.js +80 -0
- package/dist/modules/auth/providers/keycloak/keycloak-auth-provider.module.js.map +1 -0
- package/dist/modules/auth/providers/keycloak/keycloak-verify-email.strategy.d.ts +7 -0
- package/dist/modules/auth/providers/keycloak/keycloak-verify-email.strategy.d.ts.map +1 -0
- package/dist/modules/auth/providers/keycloak/keycloak-verify-email.strategy.js +54 -0
- package/dist/modules/auth/providers/keycloak/keycloak-verify-email.strategy.js.map +1 -0
- package/dist/modules/auth/providers/keycloak/keycloak.auth-provider.d.ts +36 -0
- package/dist/modules/auth/providers/keycloak/keycloak.auth-provider.d.ts.map +1 -0
- package/dist/modules/auth/providers/keycloak/keycloak.auth-provider.js +188 -0
- package/dist/modules/auth/providers/keycloak/keycloak.auth-provider.js.map +1 -0
- package/dist/modules/auth/providers/native/index.d.ts +3 -0
- package/dist/modules/auth/providers/native/index.d.ts.map +1 -0
- package/dist/modules/auth/providers/native/index.js +19 -0
- package/dist/modules/auth/providers/native/index.js.map +1 -0
- package/dist/modules/auth/providers/native/native.auth-provider.d.ts +19 -0
- package/dist/modules/auth/providers/native/native.auth-provider.d.ts.map +1 -0
- package/dist/modules/auth/providers/native/native.auth-provider.js +159 -0
- package/dist/modules/auth/providers/native/native.auth-provider.js.map +1 -0
- package/dist/modules/auth/providers/native/native.auth-provider.module.d.ts +3 -0
- package/dist/modules/auth/providers/native/native.auth-provider.module.d.ts.map +1 -0
- package/dist/modules/auth/providers/native/native.auth-provider.module.js +24 -0
- package/dist/modules/auth/providers/native/native.auth-provider.module.js.map +1 -0
- package/dist/modules/auth/providers/provider.registry.d.ts +14 -0
- package/dist/modules/auth/providers/provider.registry.d.ts.map +1 -0
- package/dist/modules/auth/providers/provider.registry.js +49 -0
- package/dist/modules/auth/providers/provider.registry.js.map +1 -0
- package/dist/modules/auth/services/account.service.d.ts +40 -0
- package/dist/modules/auth/services/account.service.d.ts.map +1 -0
- package/dist/modules/auth/services/account.service.js +165 -0
- package/dist/modules/auth/services/account.service.js.map +1 -0
- package/dist/modules/auth/services/index.d.ts +6 -0
- package/dist/modules/auth/services/index.d.ts.map +1 -0
- package/dist/modules/auth/services/index.js +22 -0
- package/dist/modules/auth/services/index.js.map +1 -0
- package/dist/modules/auth/services/login.service.d.ts +28 -0
- package/dist/modules/auth/services/login.service.d.ts.map +1 -0
- package/dist/modules/auth/services/login.service.js +210 -0
- package/dist/modules/auth/services/login.service.js.map +1 -0
- package/dist/modules/auth/services/otp-auth.service.d.ts +16 -0
- package/dist/modules/auth/services/otp-auth.service.d.ts.map +1 -0
- package/dist/modules/auth/services/otp-auth.service.js +75 -0
- package/dist/modules/auth/services/otp-auth.service.js.map +1 -0
- package/dist/modules/auth/services/password.service.d.ts +39 -0
- package/dist/modules/auth/services/password.service.d.ts.map +1 -0
- package/dist/modules/auth/services/password.service.js +213 -0
- package/dist/modules/auth/services/password.service.js.map +1 -0
- package/dist/modules/auth/services/registration.service.d.ts +30 -0
- package/dist/modules/auth/services/registration.service.d.ts.map +1 -0
- package/dist/modules/auth/services/registration.service.js +217 -0
- package/dist/modules/auth/services/registration.service.js.map +1 -0
- package/dist/modules/notifications/controllers/index.d.ts +2 -0
- package/dist/modules/notifications/controllers/index.d.ts.map +1 -0
- package/dist/modules/notifications/controllers/index.js +18 -0
- package/dist/modules/notifications/controllers/index.js.map +1 -0
- package/dist/modules/notifications/controllers/notifications.controller.d.ts +38 -0
- package/dist/modules/notifications/controllers/notifications.controller.d.ts.map +1 -0
- package/dist/modules/notifications/controllers/notifications.controller.js +140 -0
- package/dist/modules/notifications/controllers/notifications.controller.js.map +1 -0
- package/dist/modules/notifications/dto/device.dto.d.ts +10 -0
- package/dist/modules/notifications/dto/device.dto.d.ts.map +1 -0
- package/dist/modules/notifications/dto/device.dto.js +38 -0
- package/dist/modules/notifications/dto/device.dto.js.map +1 -0
- package/dist/modules/notifications/dto/event-types.dto.d.ts +6 -0
- package/dist/modules/notifications/dto/event-types.dto.d.ts.map +1 -0
- package/dist/modules/notifications/dto/event-types.dto.js +10 -0
- package/dist/modules/notifications/dto/event-types.dto.js.map +1 -0
- package/dist/modules/notifications/dto/fcm.dto.d.ts +14 -0
- package/dist/modules/notifications/dto/fcm.dto.d.ts.map +1 -0
- package/dist/modules/notifications/dto/fcm.dto.js +3 -0
- package/dist/modules/notifications/dto/fcm.dto.js.map +1 -0
- package/dist/modules/notifications/dto/index.d.ts +6 -0
- package/dist/modules/notifications/dto/index.d.ts.map +1 -0
- package/dist/modules/notifications/dto/index.js +22 -0
- package/dist/modules/notifications/dto/index.js.map +1 -0
- package/dist/modules/notifications/dto/notification-query.dto.d.ts +8 -0
- package/dist/modules/notifications/dto/notification-query.dto.d.ts.map +1 -0
- package/dist/modules/notifications/dto/notification-query.dto.js +44 -0
- package/dist/modules/notifications/dto/notification-query.dto.js.map +1 -0
- package/dist/modules/notifications/dto/user-device-token.dto.d.ts +9 -0
- package/dist/modules/notifications/dto/user-device-token.dto.d.ts.map +1 -0
- package/dist/modules/notifications/dto/user-device-token.dto.js +3 -0
- package/dist/modules/notifications/dto/user-device-token.dto.js.map +1 -0
- package/dist/modules/notifications/entities/device-token.entity.d.ts +17 -0
- package/dist/modules/notifications/entities/device-token.entity.d.ts.map +1 -0
- package/dist/modules/notifications/entities/device-token.entity.js +62 -0
- package/dist/modules/notifications/entities/device-token.entity.js.map +1 -0
- package/dist/modules/notifications/entities/index.d.ts +3 -0
- package/dist/modules/notifications/entities/index.d.ts.map +1 -0
- package/dist/modules/notifications/entities/index.js +19 -0
- package/dist/modules/notifications/entities/index.js.map +1 -0
- package/dist/modules/notifications/entities/notification.entity.d.ts +21 -0
- package/dist/modules/notifications/entities/notification.entity.d.ts.map +1 -0
- package/dist/modules/notifications/entities/notification.entity.js +70 -0
- package/dist/modules/notifications/entities/notification.entity.js.map +1 -0
- package/dist/modules/notifications/firebase.module.d.ts +3 -0
- package/dist/modules/notifications/firebase.module.d.ts.map +1 -0
- package/dist/modules/notifications/firebase.module.js +25 -0
- package/dist/modules/notifications/firebase.module.js.map +1 -0
- package/dist/modules/notifications/notifications.manifest.d.ts +9 -0
- package/dist/modules/notifications/notifications.manifest.d.ts.map +1 -0
- package/dist/modules/notifications/notifications.manifest.js +37 -0
- package/dist/modules/notifications/notifications.manifest.js.map +1 -0
- package/dist/modules/notifications/notifications.module.d.ts +3 -0
- package/dist/modules/notifications/notifications.module.d.ts.map +1 -0
- package/dist/modules/notifications/notifications.module.js +32 -0
- package/dist/modules/notifications/notifications.module.js.map +1 -0
- package/dist/modules/notifications/services/fcm.service.d.ts +17 -0
- package/dist/modules/notifications/services/fcm.service.d.ts.map +1 -0
- package/dist/modules/notifications/services/fcm.service.js +150 -0
- package/dist/modules/notifications/services/fcm.service.js.map +1 -0
- package/dist/modules/notifications/services/firebase.service.d.ts +19 -0
- package/dist/modules/notifications/services/firebase.service.d.ts.map +1 -0
- package/dist/modules/notifications/services/firebase.service.js +73 -0
- package/dist/modules/notifications/services/firebase.service.js.map +1 -0
- package/dist/modules/notifications/services/index.d.ts +4 -0
- package/dist/modules/notifications/services/index.d.ts.map +1 -0
- package/dist/modules/notifications/services/index.js +20 -0
- package/dist/modules/notifications/services/index.js.map +1 -0
- package/dist/modules/notifications/services/notifications.service.d.ts +19 -0
- package/dist/modules/notifications/services/notifications.service.d.ts.map +1 -0
- package/dist/modules/notifications/services/notifications.service.js +97 -0
- package/dist/modules/notifications/services/notifications.service.js.map +1 -0
- package/dist/modules/otp/constants/otp.constants.d.ts +4 -0
- package/dist/modules/otp/constants/otp.constants.d.ts.map +1 -0
- package/dist/modules/otp/constants/otp.constants.js +10 -0
- package/dist/modules/otp/constants/otp.constants.js.map +1 -0
- package/dist/modules/otp/email/email-provider.interface.d.ts +14 -0
- package/dist/modules/otp/email/email-provider.interface.d.ts.map +1 -0
- package/dist/modules/otp/email/email-provider.interface.js +15 -0
- package/dist/modules/otp/email/email-provider.interface.js.map +1 -0
- package/dist/modules/otp/email/email-proxy.service.d.ts +21 -0
- package/dist/modules/otp/email/email-proxy.service.d.ts.map +1 -0
- package/dist/modules/otp/email/email-proxy.service.js +67 -0
- package/dist/modules/otp/email/email-proxy.service.js.map +1 -0
- package/dist/modules/otp/email/email.module.d.ts +3 -0
- package/dist/modules/otp/email/email.module.d.ts.map +1 -0
- package/dist/modules/otp/email/email.module.js +33 -0
- package/dist/modules/otp/email/email.module.js.map +1 -0
- package/dist/modules/otp/email/index.d.ts +4 -0
- package/dist/modules/otp/email/index.d.ts.map +1 -0
- package/dist/modules/otp/email/index.js +20 -0
- package/dist/modules/otp/email/index.js.map +1 -0
- package/dist/modules/otp/email/providers/index.d.ts +5 -0
- package/dist/modules/otp/email/providers/index.d.ts.map +1 -0
- package/dist/modules/otp/email/providers/index.js +21 -0
- package/dist/modules/otp/email/providers/index.js.map +1 -0
- package/dist/modules/otp/email/providers/mailgun.provider.d.ts +10 -0
- package/dist/modules/otp/email/providers/mailgun.provider.d.ts.map +1 -0
- package/dist/modules/otp/email/providers/mailgun.provider.js +59 -0
- package/dist/modules/otp/email/providers/mailgun.provider.js.map +1 -0
- package/dist/modules/otp/email/providers/resend.provider.d.ts +10 -0
- package/dist/modules/otp/email/providers/resend.provider.d.ts.map +1 -0
- package/dist/modules/otp/email/providers/resend.provider.js +57 -0
- package/dist/modules/otp/email/providers/resend.provider.js.map +1 -0
- package/dist/modules/otp/email/providers/sendgrid.provider.d.ts +10 -0
- package/dist/modules/otp/email/providers/sendgrid.provider.d.ts.map +1 -0
- package/dist/modules/otp/email/providers/sendgrid.provider.js +58 -0
- package/dist/modules/otp/email/providers/sendgrid.provider.js.map +1 -0
- package/dist/modules/otp/email/providers/smtp.provider.d.ts +15 -0
- package/dist/modules/otp/email/providers/smtp.provider.d.ts.map +1 -0
- package/dist/modules/otp/email/providers/smtp.provider.js +115 -0
- package/dist/modules/otp/email/providers/smtp.provider.js.map +1 -0
- package/dist/modules/otp/index.d.ts +5 -0
- package/dist/modules/otp/index.d.ts.map +1 -0
- package/dist/modules/otp/index.js +21 -0
- package/dist/modules/otp/index.js.map +1 -0
- package/dist/modules/otp/interfaces/otp.service.interface.d.ts +26 -0
- package/dist/modules/otp/interfaces/otp.service.interface.d.ts.map +1 -0
- package/dist/modules/otp/interfaces/otp.service.interface.js +7 -0
- package/dist/modules/otp/interfaces/otp.service.interface.js.map +1 -0
- package/dist/modules/otp/otp.module.d.ts +3 -0
- package/dist/modules/otp/otp.module.d.ts.map +1 -0
- package/dist/modules/otp/otp.module.js +36 -0
- package/dist/modules/otp/otp.module.js.map +1 -0
- package/dist/modules/otp/otp.service.d.ts +25 -0
- package/dist/modules/otp/otp.service.d.ts.map +1 -0
- package/dist/modules/otp/otp.service.js +146 -0
- package/dist/modules/otp/otp.service.js.map +1 -0
- package/dist/modules/otp/services/otp.rate-limiter.d.ts +13 -0
- package/dist/modules/otp/services/otp.rate-limiter.d.ts.map +1 -0
- package/dist/modules/otp/services/otp.rate-limiter.js +70 -0
- package/dist/modules/otp/services/otp.rate-limiter.js.map +1 -0
- package/dist/modules/otp/services/otp.session.store.d.ts +28 -0
- package/dist/modules/otp/services/otp.session.store.d.ts.map +1 -0
- package/dist/modules/otp/services/otp.session.store.js +226 -0
- package/dist/modules/otp/services/otp.session.store.js.map +1 -0
- package/dist/modules/otp/sms/index.d.ts +4 -0
- package/dist/modules/otp/sms/index.d.ts.map +1 -0
- package/dist/modules/otp/sms/index.js +20 -0
- package/dist/modules/otp/sms/index.js.map +1 -0
- package/dist/modules/otp/sms/providers/index.d.ts +5 -0
- package/dist/modules/otp/sms/providers/index.d.ts.map +1 -0
- package/dist/modules/otp/sms/providers/index.js +21 -0
- package/dist/modules/otp/sms/providers/index.js.map +1 -0
- package/dist/modules/otp/sms/providers/infobip.provider.d.ts +10 -0
- package/dist/modules/otp/sms/providers/infobip.provider.d.ts.map +1 -0
- package/dist/modules/otp/sms/providers/infobip.provider.js +61 -0
- package/dist/modules/otp/sms/providers/infobip.provider.js.map +1 -0
- package/dist/modules/otp/sms/providers/smart-sms.provider.d.ts +11 -0
- package/dist/modules/otp/sms/providers/smart-sms.provider.d.ts.map +1 -0
- package/dist/modules/otp/sms/providers/smart-sms.provider.js +56 -0
- package/dist/modules/otp/sms/providers/smart-sms.provider.js.map +1 -0
- package/dist/modules/otp/sms/providers/termii.provider.d.ts +11 -0
- package/dist/modules/otp/sms/providers/termii.provider.d.ts.map +1 -0
- package/dist/modules/otp/sms/providers/termii.provider.js +56 -0
- package/dist/modules/otp/sms/providers/termii.provider.js.map +1 -0
- package/dist/modules/otp/sms/providers/twilio.provider.d.ts +10 -0
- package/dist/modules/otp/sms/providers/twilio.provider.d.ts.map +1 -0
- package/dist/modules/otp/sms/providers/twilio.provider.js +59 -0
- package/dist/modules/otp/sms/providers/twilio.provider.js.map +1 -0
- package/dist/modules/otp/sms/sms-provider.interface.d.ts +12 -0
- package/dist/modules/otp/sms/sms-provider.interface.d.ts.map +1 -0
- package/dist/modules/otp/sms/sms-provider.interface.js +15 -0
- package/dist/modules/otp/sms/sms-provider.interface.js.map +1 -0
- package/dist/modules/otp/sms/sms-proxy.service.d.ts +21 -0
- package/dist/modules/otp/sms/sms-proxy.service.d.ts.map +1 -0
- package/dist/modules/otp/sms/sms-proxy.service.js +67 -0
- package/dist/modules/otp/sms/sms-proxy.service.js.map +1 -0
- package/dist/modules/otp/sms/sms.module.d.ts +3 -0
- package/dist/modules/otp/sms/sms.module.d.ts.map +1 -0
- package/dist/modules/otp/sms/sms.module.js +33 -0
- package/dist/modules/otp/sms/sms.module.js.map +1 -0
- package/dist/modules/otp/utils/otp.utils.d.ts +13 -0
- package/dist/modules/otp/utils/otp.utils.d.ts.map +1 -0
- package/dist/modules/otp/utils/otp.utils.js +57 -0
- package/dist/modules/otp/utils/otp.utils.js.map +1 -0
- package/dist/modules/profile/controllers/profile.controller.d.ts +14 -0
- package/dist/modules/profile/controllers/profile.controller.d.ts.map +1 -0
- package/dist/modules/profile/controllers/profile.controller.js +81 -0
- package/dist/modules/profile/controllers/profile.controller.js.map +1 -0
- package/dist/modules/profile/dto/profile.dto.d.ts +11 -0
- package/dist/modules/profile/dto/profile.dto.d.ts.map +1 -0
- package/dist/modules/profile/dto/profile.dto.js +50 -0
- package/dist/modules/profile/dto/profile.dto.js.map +1 -0
- package/dist/modules/profile/index.d.ts +3 -0
- package/dist/modules/profile/index.d.ts.map +1 -0
- package/dist/modules/profile/index.js +19 -0
- package/dist/modules/profile/index.js.map +1 -0
- package/dist/modules/profile/profile.module.d.ts +3 -0
- package/dist/modules/profile/profile.module.d.ts.map +1 -0
- package/dist/modules/profile/profile.module.js +26 -0
- package/dist/modules/profile/profile.module.js.map +1 -0
- package/dist/modules/profile/services/profile.service.d.ts +16 -0
- package/dist/modules/profile/services/profile.service.d.ts.map +1 -0
- package/dist/modules/profile/services/profile.service.js +64 -0
- package/dist/modules/profile/services/profile.service.js.map +1 -0
- package/dist/modules/roles/controllers/index.d.ts +5 -0
- package/dist/modules/roles/controllers/index.d.ts.map +1 -0
- package/dist/modules/roles/controllers/index.js +12 -0
- package/dist/modules/roles/controllers/index.js.map +1 -0
- package/dist/modules/roles/controllers/modules.controller.d.ts +14 -0
- package/dist/modules/roles/controllers/modules.controller.d.ts.map +1 -0
- package/dist/modules/roles/controllers/modules.controller.js +82 -0
- package/dist/modules/roles/controllers/modules.controller.js.map +1 -0
- package/dist/modules/roles/controllers/permissions.controller.d.ts +14 -0
- package/dist/modules/roles/controllers/permissions.controller.d.ts.map +1 -0
- package/dist/modules/roles/controllers/permissions.controller.js +83 -0
- package/dist/modules/roles/controllers/permissions.controller.js.map +1 -0
- package/dist/modules/roles/controllers/roles.controller.d.ts +17 -0
- package/dist/modules/roles/controllers/roles.controller.d.ts.map +1 -0
- package/dist/modules/roles/controllers/roles.controller.js +93 -0
- package/dist/modules/roles/controllers/roles.controller.js.map +1 -0
- package/dist/modules/roles/controllers/user-roles.controller.d.ts +11 -0
- package/dist/modules/roles/controllers/user-roles.controller.d.ts.map +1 -0
- package/dist/modules/roles/controllers/user-roles.controller.js +94 -0
- package/dist/modules/roles/controllers/user-roles.controller.js.map +1 -0
- package/dist/modules/roles/dto/index.d.ts +4 -0
- package/dist/modules/roles/dto/index.d.ts.map +1 -0
- package/dist/modules/roles/dto/index.js +20 -0
- package/dist/modules/roles/dto/index.js.map +1 -0
- package/dist/modules/roles/dto/module.dto.d.ts +10 -0
- package/dist/modules/roles/dto/module.dto.d.ts.map +1 -0
- package/dist/modules/roles/dto/module.dto.js +48 -0
- package/dist/modules/roles/dto/module.dto.js.map +1 -0
- package/dist/modules/roles/dto/permission.dto.d.ts +14 -0
- package/dist/modules/roles/dto/permission.dto.d.ts.map +1 -0
- package/dist/modules/roles/dto/permission.dto.js +60 -0
- package/dist/modules/roles/dto/permission.dto.js.map +1 -0
- package/dist/modules/roles/dto/role.dto.d.ts +15 -0
- package/dist/modules/roles/dto/role.dto.d.ts.map +1 -0
- package/dist/modules/roles/dto/role.dto.js +65 -0
- package/dist/modules/roles/dto/role.dto.js.map +1 -0
- package/dist/modules/roles/entities/index.d.ts +4 -0
- package/dist/modules/roles/entities/index.d.ts.map +1 -0
- package/dist/modules/roles/entities/index.js +10 -0
- package/dist/modules/roles/entities/index.js.map +1 -0
- package/dist/modules/roles/entities/module.entity.d.ts +9 -0
- package/dist/modules/roles/entities/module.entity.d.ts.map +1 -0
- package/dist/modules/roles/entities/module.entity.js +39 -0
- package/dist/modules/roles/entities/module.entity.js.map +1 -0
- package/dist/modules/roles/entities/permission.entity.d.ts +12 -0
- package/dist/modules/roles/entities/permission.entity.d.ts.map +1 -0
- package/dist/modules/roles/entities/permission.entity.js +49 -0
- package/dist/modules/roles/entities/permission.entity.js.map +1 -0
- package/dist/modules/roles/entities/role.entity.d.ts +11 -0
- package/dist/modules/roles/entities/role.entity.d.ts.map +1 -0
- package/dist/modules/roles/entities/role.entity.js +49 -0
- package/dist/modules/roles/entities/role.entity.js.map +1 -0
- package/dist/modules/roles/index.d.ts +7 -0
- package/dist/modules/roles/index.d.ts.map +1 -0
- package/dist/modules/roles/index.js +25 -0
- package/dist/modules/roles/index.js.map +1 -0
- package/dist/modules/roles/registry/discover-manifests.d.ts +3 -0
- package/dist/modules/roles/registry/discover-manifests.d.ts.map +1 -0
- package/dist/modules/roles/registry/discover-manifests.js +83 -0
- package/dist/modules/roles/registry/discover-manifests.js.map +1 -0
- package/dist/modules/roles/registry/index.d.ts +3 -0
- package/dist/modules/roles/registry/index.d.ts.map +1 -0
- package/dist/modules/roles/registry/index.js +8 -0
- package/dist/modules/roles/registry/index.js.map +1 -0
- package/dist/modules/roles/registry/sync-manifests-to-db.d.ts +7 -0
- package/dist/modules/roles/registry/sync-manifests-to-db.d.ts.map +1 -0
- package/dist/modules/roles/registry/sync-manifests-to-db.js +52 -0
- package/dist/modules/roles/registry/sync-manifests-to-db.js.map +1 -0
- package/dist/modules/roles/roles.manifest.d.ts +12 -0
- package/dist/modules/roles/roles.manifest.d.ts.map +1 -0
- package/dist/modules/roles/roles.manifest.js +51 -0
- package/dist/modules/roles/roles.manifest.js.map +1 -0
- package/dist/modules/roles/roles.module.d.ts +8 -0
- package/dist/modules/roles/roles.module.d.ts.map +1 -0
- package/dist/modules/roles/roles.module.js +43 -0
- package/dist/modules/roles/roles.module.js.map +1 -0
- package/dist/modules/roles/services/index.d.ts +6 -0
- package/dist/modules/roles/services/index.d.ts.map +1 -0
- package/dist/modules/roles/services/index.js +14 -0
- package/dist/modules/roles/services/index.js.map +1 -0
- package/dist/modules/roles/services/manifest-sync.service.d.ts +11 -0
- package/dist/modules/roles/services/manifest-sync.service.d.ts.map +1 -0
- package/dist/modules/roles/services/manifest-sync.service.js +38 -0
- package/dist/modules/roles/services/manifest-sync.service.js.map +1 -0
- package/dist/modules/roles/services/modules.service.d.ts +14 -0
- package/dist/modules/roles/services/modules.service.d.ts.map +1 -0
- package/dist/modules/roles/services/modules.service.js +69 -0
- package/dist/modules/roles/services/modules.service.js.map +1 -0
- package/dist/modules/roles/services/permissions.service.d.ts +14 -0
- package/dist/modules/roles/services/permissions.service.d.ts.map +1 -0
- package/dist/modules/roles/services/permissions.service.js +72 -0
- package/dist/modules/roles/services/permissions.service.js.map +1 -0
- package/dist/modules/roles/services/roles.service.d.ts +17 -0
- package/dist/modules/roles/services/roles.service.d.ts.map +1 -0
- package/dist/modules/roles/services/roles.service.js +100 -0
- package/dist/modules/roles/services/roles.service.js.map +1 -0
- package/dist/modules/roles/services/user-roles.service.d.ts +15 -0
- package/dist/modules/roles/services/user-roles.service.d.ts.map +1 -0
- package/dist/modules/roles/services/user-roles.service.js +88 -0
- package/dist/modules/roles/services/user-roles.service.js.map +1 -0
- package/dist/modules/roles/types/manifest.types.d.ts +12 -0
- package/dist/modules/roles/types/manifest.types.d.ts.map +1 -0
- package/dist/modules/roles/types/manifest.types.js +3 -0
- package/dist/modules/roles/types/manifest.types.js.map +1 -0
- package/dist/modules/sessions/controllers/session.controller.d.ts +17 -0
- package/dist/modules/sessions/controllers/session.controller.d.ts.map +1 -0
- package/dist/modules/sessions/controllers/session.controller.js +95 -0
- package/dist/modules/sessions/controllers/session.controller.js.map +1 -0
- package/dist/modules/sessions/entities/refresh-token.entity.d.ts +21 -0
- package/dist/modules/sessions/entities/refresh-token.entity.d.ts.map +1 -0
- package/dist/modules/sessions/entities/refresh-token.entity.js +77 -0
- package/dist/modules/sessions/entities/refresh-token.entity.js.map +1 -0
- package/dist/modules/sessions/index.d.ts +4 -0
- package/dist/modules/sessions/index.d.ts.map +1 -0
- package/dist/modules/sessions/index.js +20 -0
- package/dist/modules/sessions/index.js.map +1 -0
- package/dist/modules/sessions/services/token.service.d.ts +42 -0
- package/dist/modules/sessions/services/token.service.d.ts.map +1 -0
- package/dist/modules/sessions/services/token.service.js +253 -0
- package/dist/modules/sessions/services/token.service.js.map +1 -0
- package/dist/modules/sessions/sessions.module.d.ts +3 -0
- package/dist/modules/sessions/sessions.module.d.ts.map +1 -0
- package/dist/modules/sessions/sessions.module.js +28 -0
- package/dist/modules/sessions/sessions.module.js.map +1 -0
- package/dist/modules/settings/constants/settings.defaults.d.ts +60 -0
- package/dist/modules/settings/constants/settings.defaults.d.ts.map +1 -0
- package/dist/modules/settings/constants/settings.defaults.js +78 -0
- package/dist/modules/settings/constants/settings.defaults.js.map +1 -0
- package/dist/modules/settings/constants/settings.keys.d.ts +56 -0
- package/dist/modules/settings/constants/settings.keys.d.ts.map +1 -0
- package/dist/modules/settings/constants/settings.keys.js +58 -0
- package/dist/modules/settings/constants/settings.keys.js.map +1 -0
- package/dist/modules/settings/controllers/settings.controller.d.ts +13 -0
- package/dist/modules/settings/controllers/settings.controller.d.ts.map +1 -0
- package/dist/modules/settings/controllers/settings.controller.js +91 -0
- package/dist/modules/settings/controllers/settings.controller.js.map +1 -0
- package/dist/modules/settings/dto/settings.dto.d.ts +4 -0
- package/dist/modules/settings/dto/settings.dto.d.ts.map +1 -0
- package/dist/modules/settings/dto/settings.dto.js +24 -0
- package/dist/modules/settings/dto/settings.dto.js.map +1 -0
- package/dist/modules/settings/entities/app-setting.entity.d.ts +13 -0
- package/dist/modules/settings/entities/app-setting.entity.d.ts.map +1 -0
- package/dist/modules/settings/entities/app-setting.entity.js +56 -0
- package/dist/modules/settings/entities/app-setting.entity.js.map +1 -0
- package/dist/modules/settings/index.d.ts +8 -0
- package/dist/modules/settings/index.d.ts.map +1 -0
- package/dist/modules/settings/index.js +24 -0
- package/dist/modules/settings/index.js.map +1 -0
- package/dist/modules/settings/services/settings.service.d.ts +23 -0
- package/dist/modules/settings/services/settings.service.d.ts.map +1 -0
- package/dist/modules/settings/services/settings.service.js +116 -0
- package/dist/modules/settings/services/settings.service.js.map +1 -0
- package/dist/modules/settings/settings.manifest.d.ts +7 -0
- package/dist/modules/settings/settings.manifest.d.ts.map +1 -0
- package/dist/modules/settings/settings.manifest.js +25 -0
- package/dist/modules/settings/settings.manifest.js.map +1 -0
- package/dist/modules/settings/settings.module.d.ts +3 -0
- package/dist/modules/settings/settings.module.d.ts.map +1 -0
- package/dist/modules/settings/settings.module.js +27 -0
- package/dist/modules/settings/settings.module.js.map +1 -0
- package/dist/modules/users/controllers/users.controller.d.ts +41 -0
- package/dist/modules/users/controllers/users.controller.d.ts.map +1 -0
- package/dist/modules/users/controllers/users.controller.js +273 -0
- package/dist/modules/users/controllers/users.controller.js.map +1 -0
- package/dist/modules/users/dto/user.dto.d.ts +52 -0
- package/dist/modules/users/dto/user.dto.d.ts.map +1 -0
- package/dist/modules/users/dto/user.dto.js +139 -0
- package/dist/modules/users/dto/user.dto.js.map +1 -0
- package/dist/modules/users/entities/user.entity.d.ts +33 -0
- package/dist/modules/users/entities/user.entity.d.ts.map +1 -0
- package/dist/modules/users/entities/user.entity.js +130 -0
- package/dist/modules/users/entities/user.entity.js.map +1 -0
- package/dist/modules/users/index.d.ts +7 -0
- package/dist/modules/users/index.d.ts.map +1 -0
- package/dist/modules/users/index.js +23 -0
- package/dist/modules/users/index.js.map +1 -0
- package/dist/modules/users/services/invite.service.d.ts +35 -0
- package/dist/modules/users/services/invite.service.d.ts.map +1 -0
- package/dist/modules/users/services/invite.service.js +236 -0
- package/dist/modules/users/services/invite.service.js.map +1 -0
- package/dist/modules/users/services/users.service.d.ts +40 -0
- package/dist/modules/users/services/users.service.d.ts.map +1 -0
- package/dist/modules/users/services/users.service.js +239 -0
- package/dist/modules/users/services/users.service.js.map +1 -0
- package/dist/modules/users/users.manifest.d.ts +12 -0
- package/dist/modules/users/users.manifest.d.ts.map +1 -0
- package/dist/modules/users/users.manifest.js +43 -0
- package/dist/modules/users/users.manifest.js.map +1 -0
- package/dist/modules/users/users.module.d.ts +3 -0
- package/dist/modules/users/users.module.d.ts.map +1 -0
- package/dist/modules/users/users.module.js +36 -0
- package/dist/modules/users/users.module.js.map +1 -0
- package/dist/tsconfig.build.tsbuildinfo +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/package.json +140 -0
|
@@ -0,0 +1,210 @@
|
|
|
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
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
12
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
13
|
+
};
|
|
14
|
+
var LoginService_1;
|
|
15
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
+
exports.LoginService = void 0;
|
|
17
|
+
const common_1 = require("@nestjs/common");
|
|
18
|
+
const token_service_1 = require("../../sessions/services/token.service");
|
|
19
|
+
const users_service_1 = require("../../users/services/users.service");
|
|
20
|
+
const provider_registry_1 = require("../providers/provider.registry");
|
|
21
|
+
const user_entity_1 = require("../../users/entities/user.entity");
|
|
22
|
+
const crypto_1 = require("crypto");
|
|
23
|
+
const redis_module_1 = require("../../../config/redis.module");
|
|
24
|
+
const settings_service_1 = require("../../settings/services/settings.service");
|
|
25
|
+
const settings_keys_1 = require("../../settings/constants/settings.keys");
|
|
26
|
+
let LoginService = LoginService_1 = class LoginService {
|
|
27
|
+
constructor(usersService, tokenService, providerRegistry, redis, settingsService) {
|
|
28
|
+
this.usersService = usersService;
|
|
29
|
+
this.tokenService = tokenService;
|
|
30
|
+
this.providerRegistry = providerRegistry;
|
|
31
|
+
this.redis = redis;
|
|
32
|
+
this.settingsService = settingsService;
|
|
33
|
+
this.logger = new common_1.Logger(LoginService_1.name);
|
|
34
|
+
}
|
|
35
|
+
async login(dto, deviceInfo, ipAddress) {
|
|
36
|
+
if (dto._authMethod === 'phone') {
|
|
37
|
+
return this.loginWithPhone(dto.verificationToken, deviceInfo, ipAddress);
|
|
38
|
+
}
|
|
39
|
+
return this.loginWithEmailViaProvider(dto.email, dto.password, deviceInfo, ipAddress);
|
|
40
|
+
}
|
|
41
|
+
async loginWithPhone(token, deviceInfo, ipAddress) {
|
|
42
|
+
const userId = await this.tokenService.verifyTemporaryToken(token).catch(() => {
|
|
43
|
+
this.logFailure({
|
|
44
|
+
method: 'phone',
|
|
45
|
+
reason: 'invalid_credentials',
|
|
46
|
+
ipAddress,
|
|
47
|
+
deviceInfo,
|
|
48
|
+
});
|
|
49
|
+
throw new common_1.UnauthorizedException('Invalid or expired token');
|
|
50
|
+
});
|
|
51
|
+
const user = await this.usersService.findById(userId);
|
|
52
|
+
if (!user) {
|
|
53
|
+
this.logFailure({
|
|
54
|
+
method: 'phone',
|
|
55
|
+
reason: 'user_not_found',
|
|
56
|
+
identity: userId,
|
|
57
|
+
ipAddress,
|
|
58
|
+
deviceInfo,
|
|
59
|
+
});
|
|
60
|
+
throw new common_1.UnauthorizedException('User not found');
|
|
61
|
+
}
|
|
62
|
+
this.assertAccountActive(user, 'phone', ipAddress, deviceInfo);
|
|
63
|
+
await this.usersService.updateLastLogin(user.id);
|
|
64
|
+
const tokens = await this.tokenService.generateTokens({ user, ipAddress, deviceInfo });
|
|
65
|
+
this.logSuccess({ userId: user.id, method: 'phone', ipAddress, deviceInfo });
|
|
66
|
+
return tokens;
|
|
67
|
+
}
|
|
68
|
+
async loginWithEmailViaProvider(email, password, deviceInfo, ipAddress) {
|
|
69
|
+
await this.checkIdentifierLockout(email);
|
|
70
|
+
const provider = this.providerRegistry.getActiveProvider();
|
|
71
|
+
const { identity, providerRefreshToken } = await provider
|
|
72
|
+
.verifyEmailCredentials(email, password)
|
|
73
|
+
.catch(async (err) => {
|
|
74
|
+
await this.recordFailedAttempt(email);
|
|
75
|
+
this.logFailure({
|
|
76
|
+
method: 'email',
|
|
77
|
+
reason: 'invalid_credentials',
|
|
78
|
+
identity: email,
|
|
79
|
+
provider: provider.name,
|
|
80
|
+
ipAddress,
|
|
81
|
+
deviceInfo,
|
|
82
|
+
});
|
|
83
|
+
throw err;
|
|
84
|
+
});
|
|
85
|
+
const user = (identity.externalUid
|
|
86
|
+
? ((await this.usersService.findBy({ uid: identity.externalUid })) ??
|
|
87
|
+
(await this.usersService.findBy({ email: identity.email })))
|
|
88
|
+
: await this.usersService.findBy({ email: identity.email })) ?? null;
|
|
89
|
+
if (!user) {
|
|
90
|
+
this.logFailure({
|
|
91
|
+
method: 'email',
|
|
92
|
+
reason: 'user_not_found',
|
|
93
|
+
identity: email,
|
|
94
|
+
provider: provider.name,
|
|
95
|
+
ipAddress,
|
|
96
|
+
deviceInfo,
|
|
97
|
+
});
|
|
98
|
+
throw new common_1.UnauthorizedException('No account found. Please register first.');
|
|
99
|
+
}
|
|
100
|
+
this.assertAccountActive(user, 'email', ipAddress, deviceInfo);
|
|
101
|
+
await this.usersService.updateLastLogin(user.id);
|
|
102
|
+
await this.resetFailedAttempts(email);
|
|
103
|
+
const tokens = await this.tokenService.generateTokens({
|
|
104
|
+
user,
|
|
105
|
+
providerRefreshToken,
|
|
106
|
+
ipAddress,
|
|
107
|
+
deviceInfo,
|
|
108
|
+
});
|
|
109
|
+
this.logSuccess({
|
|
110
|
+
userId: user.id,
|
|
111
|
+
method: 'email',
|
|
112
|
+
provider: provider.name,
|
|
113
|
+
ipAddress,
|
|
114
|
+
deviceInfo,
|
|
115
|
+
});
|
|
116
|
+
return tokens;
|
|
117
|
+
}
|
|
118
|
+
assertAccountActive(user, method, ipAddress, deviceInfo) {
|
|
119
|
+
if (!user.isActive ||
|
|
120
|
+
user.status === user_entity_1.UserStatus.SUSPENDED ||
|
|
121
|
+
user.status === user_entity_1.UserStatus.REVOKED) {
|
|
122
|
+
this.logFailure({
|
|
123
|
+
method,
|
|
124
|
+
reason: 'account_deactivated',
|
|
125
|
+
identity: user.id,
|
|
126
|
+
ipAddress,
|
|
127
|
+
deviceInfo,
|
|
128
|
+
});
|
|
129
|
+
throw new common_1.UnauthorizedException('Your account has been deactivated.');
|
|
130
|
+
}
|
|
131
|
+
if (user.status === user_entity_1.UserStatus.INVITED) {
|
|
132
|
+
this.logFailure({
|
|
133
|
+
method,
|
|
134
|
+
reason: 'account_deactivated',
|
|
135
|
+
identity: user.id,
|
|
136
|
+
ipAddress,
|
|
137
|
+
deviceInfo,
|
|
138
|
+
});
|
|
139
|
+
throw new common_1.UnauthorizedException('Your account registration is incomplete. Please accept your invitation first.');
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
logSuccess(args) {
|
|
143
|
+
this.logger.log({
|
|
144
|
+
event: 'LOGIN_SUCCESS',
|
|
145
|
+
userId: args.userId,
|
|
146
|
+
method: args.method,
|
|
147
|
+
provider: args.provider ?? 'native',
|
|
148
|
+
ipAddress: args.ipAddress,
|
|
149
|
+
deviceInfo: args.deviceInfo,
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
logFailure(args) {
|
|
153
|
+
this.logger.warn({
|
|
154
|
+
event: 'LOGIN_FAILED',
|
|
155
|
+
reason: args.reason,
|
|
156
|
+
identity: args.identity ? this.hashIdentity(args.identity) : undefined,
|
|
157
|
+
method: args.method,
|
|
158
|
+
provider: args.provider ?? 'native',
|
|
159
|
+
ipAddress: args.ipAddress,
|
|
160
|
+
deviceInfo: args.deviceInfo,
|
|
161
|
+
timestamp: new Date().toISOString(),
|
|
162
|
+
});
|
|
163
|
+
}
|
|
164
|
+
hashIdentity(value) {
|
|
165
|
+
return (0, crypto_1.createHash)('sha256').update(value).digest('hex').slice(0, 16);
|
|
166
|
+
}
|
|
167
|
+
lockoutKey(identifier) {
|
|
168
|
+
return `login:lockout:${(0, crypto_1.createHash)('sha256').update(identifier).digest('hex')}`;
|
|
169
|
+
}
|
|
170
|
+
async checkIdentifierLockout(identifier) {
|
|
171
|
+
if (!this.redis)
|
|
172
|
+
return;
|
|
173
|
+
const key = this.lockoutKey(identifier);
|
|
174
|
+
const count = await this.redis.get(key);
|
|
175
|
+
if (!count)
|
|
176
|
+
return;
|
|
177
|
+
const max = this.settingsService.get(settings_keys_1.SETTING_KEYS.LOGIN_LOCKOUT_MAX_ATTEMPTS);
|
|
178
|
+
if (parseInt(count, 10) >= max) {
|
|
179
|
+
const ttl = await this.redis.ttl(key);
|
|
180
|
+
throw new common_1.HttpException({
|
|
181
|
+
message: `Too many failed login attempts. Please try again in ${ttl}s.`,
|
|
182
|
+
retryAfter: ttl,
|
|
183
|
+
}, common_1.HttpStatus.TOO_MANY_REQUESTS);
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
async recordFailedAttempt(identifier) {
|
|
187
|
+
if (!this.redis)
|
|
188
|
+
return;
|
|
189
|
+
const duration = this.settingsService.get(settings_keys_1.SETTING_KEYS.LOGIN_LOCKOUT_DURATION_SECONDS);
|
|
190
|
+
const key = this.lockoutKey(identifier);
|
|
191
|
+
await this.redis.eval(`local n = redis.call('INCR', KEYS[1])
|
|
192
|
+
if n == 1 then redis.call('EXPIRE', KEYS[1], ARGV[1]) end
|
|
193
|
+
return n`, 1, key, String(duration));
|
|
194
|
+
}
|
|
195
|
+
async resetFailedAttempts(identifier) {
|
|
196
|
+
if (!this.redis)
|
|
197
|
+
return;
|
|
198
|
+
await this.redis.del(this.lockoutKey(identifier));
|
|
199
|
+
}
|
|
200
|
+
};
|
|
201
|
+
exports.LoginService = LoginService;
|
|
202
|
+
exports.LoginService = LoginService = LoginService_1 = __decorate([
|
|
203
|
+
(0, common_1.Injectable)(),
|
|
204
|
+
__param(3, (0, common_1.Optional)()),
|
|
205
|
+
__param(3, (0, common_1.Inject)(redis_module_1.REDIS_CLIENT)),
|
|
206
|
+
__metadata("design:paramtypes", [users_service_1.UsersService,
|
|
207
|
+
token_service_1.TokenService,
|
|
208
|
+
provider_registry_1.AuthProviderRegistry, Object, settings_service_1.SettingsService])
|
|
209
|
+
], LoginService);
|
|
210
|
+
//# sourceMappingURL=login.service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"login.service.js","sourceRoot":"","sources":["../../../../modules/auth/services/login.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CAQwB;AAExB,yEAAqE;AACrE,sEAAkE;AAGlE,sEAAsE;AACtE,kEAAoE;AACpE,mCAAoC;AACpC,+DAA4D;AAC5D,+EAA2E;AAC3E,0EAAsE;AAG/D,IAAM,YAAY,oBAAlB,MAAM,YAAY;IAGxB,YACkB,YAA0B,EAC1B,YAA0B,EAC1B,gBAAsC,EAGvD,KAAsC,EACrB,eAAgC;QANhC,iBAAY,GAAZ,YAAY,CAAc;QAC1B,iBAAY,GAAZ,YAAY,CAAc;QAC1B,qBAAgB,GAAhB,gBAAgB,CAAsB;QAGtC,UAAK,GAAL,KAAK,CAAgB;QACrB,oBAAe,GAAf,eAAe,CAAiB;QATjC,WAAM,GAAG,IAAI,eAAM,CAAC,cAAY,CAAC,IAAI,CAAC,CAAC;IAUrD,CAAC;IAEJ,KAAK,CAAC,KAAK,CAAC,GAAa,EAAE,UAAmB,EAAE,SAAkB;QACjE,IAAI,GAAG,CAAC,WAAW,KAAK,OAAO,EAAE,CAAC;YACjC,OAAO,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,iBAAiB,EAAE,UAAU,EAAE,SAAS,CAAC,CAAC;QAC1E,CAAC;QACD,OAAO,IAAI,CAAC,yBAAyB,CAAC,GAAG,CAAC,KAAK,EAAE,GAAG,CAAC,QAAQ,EAAE,UAAU,EAAE,SAAS,CAAC,CAAC;IACvF,CAAC;IAIO,KAAK,CAAC,cAAc,CAC3B,KAAa,EACb,UAAmB,EACnB,SAAkB;QAElB,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,YAAY,CAAC,oBAAoB,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE;YAC7E,IAAI,CAAC,UAAU,CAAC;gBACf,MAAM,EAAE,OAAO;gB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AC,CAAA;qCAJU,4BAAY;QACZ,4BAAY;QACR,wCAAoB,UAIrB,kCAAe;GAVtC,YAAY,CAgSxB"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { IOtpService, OtpGenerateResult, OtpVerifyResult } from '../../otp/interfaces/otp.service.interface';
|
|
2
|
+
import { TokenService } from '../../sessions/services/token.service';
|
|
3
|
+
import { UsersService } from '../../users/services/users.service';
|
|
4
|
+
import { SettingsService } from '../../settings/services/settings.service';
|
|
5
|
+
export declare class OtpAuthService {
|
|
6
|
+
private readonly otpService;
|
|
7
|
+
private readonly usersService;
|
|
8
|
+
private readonly tokenService;
|
|
9
|
+
private readonly settingsService;
|
|
10
|
+
constructor(otpService: IOtpService, usersService: UsersService, tokenService: TokenService, settingsService: SettingsService);
|
|
11
|
+
sendOtp(identifier: string, channel: 'sms' | 'email'): Promise<OtpGenerateResult>;
|
|
12
|
+
resendOtp(verificationId: string): Promise<OtpGenerateResult>;
|
|
13
|
+
verifyOtp(verificationId: string, otp: string): Promise<OtpVerifyResult>;
|
|
14
|
+
verifyOtpChallenge(verificationId: string, otp: string): Promise<void>;
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=otp-auth.service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"otp-auth.service.d.ts","sourceRoot":"","sources":["../../../../modules/auth/services/otp-auth.service.ts"],"names":[],"mappings":"AACA,OAAO,EACN,WAAW,EACX,iBAAiB,EACjB,eAAe,EACf,MAAM,4CAA4C,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,uCAAuC,CAAC;AACrE,OAAO,EAAE,YAAY,EAAE,MAAM,oCAAoC,CAAC;AAClE,OAAO,EAAE,eAAe,EAAE,MAAM,0CAA0C,CAAC;AAG3E,qBACa,cAAc;IAGzB,OAAO,CAAC,QAAQ,CAAC,UAAU;IAC3B,OAAO,CAAC,QAAQ,CAAC,YAAY;IAC7B,OAAO,CAAC,QAAQ,CAAC,YAAY;IAC7B,OAAO,CAAC,QAAQ,CAAC,eAAe;gBAHf,UAAU,EAAE,WAAW,EACvB,YAAY,EAAE,YAAY,EAC1B,YAAY,EAAE,YAAY,EAC1B,eAAe,EAAE,eAAe;IAGlD,OAAO,CAAC,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,KAAK,GAAG,OAAO,GAAG,OAAO,CAAC,iBAAiB,CAAC;IAIjF,SAAS,CAAC,cAAc,EAAE,MAAM,GAAG,OAAO,CAAC,iBAAiB,CAAC;IAIvD,SAAS,CAAC,cAAc,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,CAAC;IAwCxE,kBAAkB,CAAC,cAAc,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAK5E"}
|
|
@@ -0,0 +1,75 @@
|
|
|
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
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
12
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.OtpAuthService = void 0;
|
|
16
|
+
const common_1 = require("@nestjs/common");
|
|
17
|
+
const otp_service_interface_1 = require("../../otp/interfaces/otp.service.interface");
|
|
18
|
+
const token_service_1 = require("../../sessions/services/token.service");
|
|
19
|
+
const users_service_1 = require("../../users/services/users.service");
|
|
20
|
+
const settings_service_1 = require("../../settings/services/settings.service");
|
|
21
|
+
const settings_keys_1 = require("../../settings/constants/settings.keys");
|
|
22
|
+
let OtpAuthService = class OtpAuthService {
|
|
23
|
+
constructor(otpService, usersService, tokenService, settingsService) {
|
|
24
|
+
this.otpService = otpService;
|
|
25
|
+
this.usersService = usersService;
|
|
26
|
+
this.tokenService = tokenService;
|
|
27
|
+
this.settingsService = settingsService;
|
|
28
|
+
}
|
|
29
|
+
sendOtp(identifier, channel) {
|
|
30
|
+
return this.otpService.generateOtp(identifier, channel);
|
|
31
|
+
}
|
|
32
|
+
resendOtp(verificationId) {
|
|
33
|
+
return this.otpService.resendOtp(verificationId);
|
|
34
|
+
}
|
|
35
|
+
async verifyOtp(verificationId, otp) {
|
|
36
|
+
const verifyResult = await this.otpService.verifyOtp(verificationId, otp);
|
|
37
|
+
const { subject: identifier, channel } = verifyResult.data;
|
|
38
|
+
const user = await (channel === 'sms'
|
|
39
|
+
? this.usersService.findBy({ phoneNumber: identifier })
|
|
40
|
+
: this.usersService.findBy({ email: identifier }));
|
|
41
|
+
const ttl = this.settingsService.get(settings_keys_1.SETTING_KEYS.TOKENS_TEMPORARY_TTL_SECONDS);
|
|
42
|
+
verifyResult.data.expiresAt = Date.now() + ttl * 1000;
|
|
43
|
+
if (user) {
|
|
44
|
+
verifyResult.data.verificationToken =
|
|
45
|
+
channel === 'email'
|
|
46
|
+
?
|
|
47
|
+
await this.tokenService.createEmailVerifiedToken(identifier)
|
|
48
|
+
:
|
|
49
|
+
await this.tokenService.createTemporaryToken(user.id);
|
|
50
|
+
verifyResult.data.hasAccount = true;
|
|
51
|
+
return verifyResult;
|
|
52
|
+
}
|
|
53
|
+
verifyResult.data.verificationToken =
|
|
54
|
+
channel === 'email'
|
|
55
|
+
? await this.tokenService.createEmailVerifiedToken(identifier)
|
|
56
|
+
: await this.tokenService.createPhoneVerifiedToken(identifier);
|
|
57
|
+
verifyResult.data.hasAccount = false;
|
|
58
|
+
return verifyResult;
|
|
59
|
+
}
|
|
60
|
+
async verifyOtpChallenge(verificationId, otp) {
|
|
61
|
+
await this.otpService.verifyOtp(verificationId, otp).catch(() => {
|
|
62
|
+
throw new common_1.UnauthorizedException('Invalid or expired OTP code.');
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
exports.OtpAuthService = OtpAuthService;
|
|
67
|
+
exports.OtpAuthService = OtpAuthService = __decorate([
|
|
68
|
+
(0, common_1.Injectable)(),
|
|
69
|
+
__param(0, (0, common_1.Inject)(otp_service_interface_1.IOtpService)),
|
|
70
|
+
__metadata("design:paramtypes", [otp_service_interface_1.IOtpService,
|
|
71
|
+
users_service_1.UsersService,
|
|
72
|
+
token_service_1.TokenService,
|
|
73
|
+
settings_service_1.SettingsService])
|
|
74
|
+
], OtpAuthService);
|
|
75
|
+
//# sourceMappingURL=otp-auth.service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"otp-auth.service.js","sourceRoot":"","sources":["../../../../modules/auth/services/otp-auth.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAA2E;AAC3E,sFAIoD;AACpD,yEAAqE;AACrE,sEAAkE;AAClE,+EAA2E;AAC3E,0EAAsE;AAG/D,IAAM,cAAc,GAApB,MAAM,cAAc;IAC1B,YAEkB,UAAuB,EACvB,YAA0B,EAC1B,YAA0B,EAC1B,eAAgC;QAHhC,eAAU,GAAV,UAAU,CAAa;QACvB,iBAAY,GAAZ,YAAY,CAAc;QAC1B,iBAAY,GAAZ,YAAY,CAAc;QAC1B,oBAAe,GAAf,eAAe,CAAiB;IAC/C,CAAC;IAEJ,OAAO,CAAC,UAAkB,EAAE,OAAwB;QACnD,OAAO,IA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,iBAAiB;YAClC,OAAO,KAAK,OAAO;gBAClB,CAAC,CAAC,MAAM,IAAI,CAAC,YAAY,CAAC,wBAAwB,CAAC,UAAU,CAAC;gBAC9D,CAAC,CAAC,MAAM,IAAI,CAAC,YAAY,CAAC,wBAAwB,CAAC,UAAU,CAAC,CAAC;QACjE,YAAY,CAAC,IAAI,CAAC,UAAU,GAAG,KAAK,CAAC;QAErC,OAAO,YAAY,CAAC;IACrB,CAAC;IAOD,KAAK,CAAC,kBAAkB,CAAC,cAAsB,EAAE,GAAW;QAC3D,MAAM,IAAI,CAAC,UAAU,CAAC,SAAS,CAAC,cAAc,EAAE,GAAG,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE;YAC/D,MAAM,IAAI,8BAAqB,CAAC,8BAA8B,CAAC,CAAC;QACjE,CAAC,CAAC,CAAC;IACJ,CAAC;CACD,CAAA;AA9DY,wCAAc;yBAAd,cAAc;IAD1B,IAAA,mBAAU,GAAE;IAGV,WAAA,IAAA,eAAM,EAAC,mCAAW,CAAC,CAAA;qCACS,mCAAW;QACT,4BAAY;QACZ,4BAAY;QACT,kCAAe;GANtC,cAAc,CA8D1B"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { Repository } from 'typeorm';
|
|
2
|
+
import IORedis from 'ioredis';
|
|
3
|
+
import { ConfigService } from '@nestjs/config';
|
|
4
|
+
import { UsersService } from '../../users/services/users.service';
|
|
5
|
+
import { TokenService } from '../../sessions/services/token.service';
|
|
6
|
+
import { AuthProviderRegistry } from '../providers/provider.registry';
|
|
7
|
+
import { PasswordResetToken } from '../entities/password-reset-token.entity';
|
|
8
|
+
import { SettingsService } from '../../settings/services/settings.service';
|
|
9
|
+
import { JobsQueue } from '../../../jobs';
|
|
10
|
+
import { ForgotPasswordDto, ResetPasswordDto, ResetPasswordWithPhoneDto, ChangePasswordDto } from '../dto/password.dto';
|
|
11
|
+
export declare class PasswordService {
|
|
12
|
+
private readonly usersService;
|
|
13
|
+
private readonly tokenService;
|
|
14
|
+
private readonly providerRegistry;
|
|
15
|
+
private readonly resetAuditRepo;
|
|
16
|
+
private readonly redis;
|
|
17
|
+
private readonly settingsService;
|
|
18
|
+
private readonly configService;
|
|
19
|
+
private readonly jobsQueue;
|
|
20
|
+
private readonly logger;
|
|
21
|
+
constructor(usersService: UsersService, tokenService: TokenService, providerRegistry: AuthProviderRegistry, resetAuditRepo: Repository<PasswordResetToken>, redis: IORedis | null, settingsService: SettingsService, configService: ConfigService, jobsQueue: JobsQueue | null);
|
|
22
|
+
forgotPassword(dto: ForgotPasswordDto): Promise<{
|
|
23
|
+
message: string;
|
|
24
|
+
}>;
|
|
25
|
+
resetPassword(dto: ResetPasswordDto, ipAddress?: string): Promise<{
|
|
26
|
+
message: string;
|
|
27
|
+
}>;
|
|
28
|
+
resetPasswordWithPhone(dto: ResetPasswordWithPhoneDto, _ipAddress?: string): Promise<{
|
|
29
|
+
message: string;
|
|
30
|
+
}>;
|
|
31
|
+
changePassword(userId: string, dto: ChangePasswordDto): Promise<{
|
|
32
|
+
message: string;
|
|
33
|
+
}>;
|
|
34
|
+
private storeNativeResetToken;
|
|
35
|
+
private consumeNativeResetToken;
|
|
36
|
+
private assertRedis;
|
|
37
|
+
private hashIdentity;
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=password.service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"password.service.d.ts","sourceRoot":"","sources":["../../../../modules/auth/services/password.service.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAGrC,OAAO,OAAO,MAAM,SAAS,CAAC;AAC9B,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,EAAE,YAAY,EAAE,MAAM,oCAAoC,CAAC;AAClE,OAAO,EAAE,YAAY,EAAE,MAAM,uCAAuC,CAAC;AACrE,OAAO,EAAE,oBAAoB,EAAE,MAAM,gCAAgC,CAAC;AACtE,O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IA6BzB,cAAc,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,iBAAiB,GAAG,OAAO,CAAC;QAAE,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC;YAoB5E,qBAAqB;YA0DrB,uBAAuB;IAYrC,OAAO,CAAC,WAAW;IAQnB,OAAO,CAAC,YAAY;CAGpB"}
|
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
19
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
20
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
21
|
+
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;
|
|
22
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
23
|
+
};
|
|
24
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
25
|
+
var ownKeys = function(o) {
|
|
26
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
27
|
+
var ar = [];
|
|
28
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
29
|
+
return ar;
|
|
30
|
+
};
|
|
31
|
+
return ownKeys(o);
|
|
32
|
+
};
|
|
33
|
+
return function (mod) {
|
|
34
|
+
if (mod && mod.__esModule) return mod;
|
|
35
|
+
var result = {};
|
|
36
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
37
|
+
__setModuleDefault(result, mod);
|
|
38
|
+
return result;
|
|
39
|
+
};
|
|
40
|
+
})();
|
|
41
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
42
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
43
|
+
};
|
|
44
|
+
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
45
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
46
|
+
};
|
|
47
|
+
var PasswordService_1;
|
|
48
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
49
|
+
exports.PasswordService = void 0;
|
|
50
|
+
const crypto_1 = require("crypto");
|
|
51
|
+
const common_1 = require("@nestjs/common");
|
|
52
|
+
const typeorm_1 = require("@nestjs/typeorm");
|
|
53
|
+
const typeorm_2 = require("typeorm");
|
|
54
|
+
const crypto_2 = require("crypto");
|
|
55
|
+
const argon2 = __importStar(require("argon2"));
|
|
56
|
+
const config_1 = require("@nestjs/config");
|
|
57
|
+
const users_service_1 = require("../../users/services/users.service");
|
|
58
|
+
const token_service_1 = require("../../sessions/services/token.service");
|
|
59
|
+
const provider_registry_1 = require("../providers/provider.registry");
|
|
60
|
+
const password_reset_token_entity_1 = require("../entities/password-reset-token.entity");
|
|
61
|
+
const redis_module_1 = require("../../../config/redis.module");
|
|
62
|
+
const settings_service_1 = require("../../settings/services/settings.service");
|
|
63
|
+
const settings_keys_1 = require("../../settings/constants/settings.keys");
|
|
64
|
+
const jobs_1 = require("../../../jobs");
|
|
65
|
+
const KEY_PWD_RESET = 'pwd_reset:';
|
|
66
|
+
let PasswordService = PasswordService_1 = class PasswordService {
|
|
67
|
+
constructor(usersService, tokenService, providerRegistry, resetAuditRepo, redis, settingsService, configService, jobsQueue) {
|
|
68
|
+
this.usersService = usersService;
|
|
69
|
+
this.tokenService = tokenService;
|
|
70
|
+
this.providerRegistry = providerRegistry;
|
|
71
|
+
this.resetAuditRepo = resetAuditRepo;
|
|
72
|
+
this.redis = redis;
|
|
73
|
+
this.settingsService = settingsService;
|
|
74
|
+
this.configService = configService;
|
|
75
|
+
this.jobsQueue = jobsQueue;
|
|
76
|
+
this.logger = new common_1.Logger(PasswordService_1.name);
|
|
77
|
+
}
|
|
78
|
+
async forgotPassword(dto) {
|
|
79
|
+
const SAFE_RESPONSE = {
|
|
80
|
+
message: 'If this email is registered, a reset link has been sent.',
|
|
81
|
+
};
|
|
82
|
+
const user = await this.usersService.findBy({ email: dto.email });
|
|
83
|
+
if (!user) {
|
|
84
|
+
this.logger.log({
|
|
85
|
+
event: 'FORGOT_PASSWORD_UNKNOWN_EMAIL',
|
|
86
|
+
email: this.hashIdentity(dto.email),
|
|
87
|
+
});
|
|
88
|
+
return SAFE_RESPONSE;
|
|
89
|
+
}
|
|
90
|
+
const provider = this.providerRegistry.getActiveProvider();
|
|
91
|
+
await provider.initiatePasswordReset(dto.email).catch((err) => {
|
|
92
|
+
this.logger.error({
|
|
93
|
+
event: 'FORGOT_PASSWORD_PROVIDER_ERROR',
|
|
94
|
+
userId: user.id,
|
|
95
|
+
provider: provider.name,
|
|
96
|
+
error: err?.message,
|
|
97
|
+
});
|
|
98
|
+
});
|
|
99
|
+
if (provider.name === 'native') {
|
|
100
|
+
await this.storeNativeResetToken(user.id, dto.email);
|
|
101
|
+
}
|
|
102
|
+
this.logger.log({
|
|
103
|
+
event: 'FORGOT_PASSWORD_INITIATED',
|
|
104
|
+
userId: user.id,
|
|
105
|
+
provider: provider.name,
|
|
106
|
+
});
|
|
107
|
+
return SAFE_RESPONSE;
|
|
108
|
+
}
|
|
109
|
+
async resetPassword(dto, ipAddress) {
|
|
110
|
+
const provider = this.providerRegistry.getActiveProvider();
|
|
111
|
+
await provider.resetPassword(dto.token, dto.newPassword);
|
|
112
|
+
const userId = await this.consumeNativeResetToken(dto.token);
|
|
113
|
+
const user = await this.usersService.findById(userId);
|
|
114
|
+
if (!user)
|
|
115
|
+
throw new common_1.NotFoundException('User not found.');
|
|
116
|
+
await this.usersService.setPasswordHash(userId, await argon2.hash(dto.newPassword));
|
|
117
|
+
await this.resetAuditRepo.save(this.resetAuditRepo.create({ userId, usedAt: new Date(), ipAddress }));
|
|
118
|
+
this.logger.log({ event: 'PASSWORD_RESET_SUCCESS', userId, method: 'email_token' });
|
|
119
|
+
return { message: 'Password reset successfully.' };
|
|
120
|
+
}
|
|
121
|
+
async resetPasswordWithPhone(dto, _ipAddress) {
|
|
122
|
+
const phoneNumber = await this.tokenService.verifyPhoneVerifiedToken(dto.verificationToken);
|
|
123
|
+
const user = await this.usersService.findBy({ phoneNumber });
|
|
124
|
+
if (!user)
|
|
125
|
+
throw new common_1.NotFoundException('No account found for this phone number.');
|
|
126
|
+
const provider = this.providerRegistry.getActiveProvider();
|
|
127
|
+
await provider.changePassword(user.id, undefined, dto.newPassword);
|
|
128
|
+
this.logger.log({
|
|
129
|
+
event: 'PASSWORD_RESET_SUCCESS',
|
|
130
|
+
userId: user.id,
|
|
131
|
+
method: 'phone_otp',
|
|
132
|
+
provider: provider.name,
|
|
133
|
+
});
|
|
134
|
+
return { message: 'Password reset successfully.' };
|
|
135
|
+
}
|
|
136
|
+
async changePassword(userId, dto) {
|
|
137
|
+
const user = await this.usersService.findById(userId);
|
|
138
|
+
if (!user)
|
|
139
|
+
throw new common_1.NotFoundException('User not found.');
|
|
140
|
+
const provider = this.providerRegistry.getActiveProvider();
|
|
141
|
+
await provider.changePassword(userId, dto.currentPassword, dto.newPassword);
|
|
142
|
+
this.logger.log({ event: 'PASSWORD_CHANGED', userId, provider: provider.name });
|
|
143
|
+
return { message: 'Password changed successfully.' };
|
|
144
|
+
}
|
|
145
|
+
async storeNativeResetToken(userId, email) {
|
|
146
|
+
this.assertRedis('storeNativeResetToken');
|
|
147
|
+
const rawToken = (0, crypto_2.randomUUID)();
|
|
148
|
+
const ttl = this.settingsService.get(settings_keys_1.SETTING_KEYS.TOKENS_PASSWORD_RESET_TTL_SECONDS);
|
|
149
|
+
const result = await this.redis.set(`${KEY_PWD_RESET}${rawToken}`, userId, 'EX', ttl, 'NX');
|
|
150
|
+
if (result !== 'OK') {
|
|
151
|
+
this.logger.error({ event: 'PASSWORD_RESET_REDIS_FAILED', userId });
|
|
152
|
+
throw new common_1.ServiceUnavailableException('Failed to generate reset token. Please try again.');
|
|
153
|
+
}
|
|
154
|
+
if (this.jobsQueue) {
|
|
155
|
+
const appUrl = this.configService.get('app.url') ?? '';
|
|
156
|
+
const resetUrl = `${appUrl}/auth/reset-password?token=${rawToken}`;
|
|
157
|
+
const ttlMinutes = Math.round(ttl / 60);
|
|
158
|
+
await this.jobsQueue.addSendEmail({
|
|
159
|
+
to: email,
|
|
160
|
+
subject: 'Reset your password',
|
|
161
|
+
template: 'password-reset',
|
|
162
|
+
data: {
|
|
163
|
+
html: `
|
|
164
|
+
<p>Hi,</p>
|
|
165
|
+
<p>We received a request to reset your password. Click the link below to choose a new password:</p>
|
|
166
|
+
<p><a href="${resetUrl}" style="font-weight:bold">Reset Password</a></p>
|
|
167
|
+
<p>This link expires in ${ttlMinutes} minutes. If you did not request a password reset, you can safely ignore this email.</p>
|
|
168
|
+
`.trim(),
|
|
169
|
+
text: `Reset your password: ${resetUrl}\n\nThis link expires in ${ttlMinutes} minutes.\n\nIf you did not request this, ignore this email.`,
|
|
170
|
+
},
|
|
171
|
+
});
|
|
172
|
+
}
|
|
173
|
+
else {
|
|
174
|
+
this.logger.warn({
|
|
175
|
+
event: 'PASSWORD_RESET_EMAIL_SKIPPED',
|
|
176
|
+
userId,
|
|
177
|
+
reason: 'JobsQueue unavailable',
|
|
178
|
+
});
|
|
179
|
+
}
|
|
180
|
+
this.logger.log({ event: 'PASSWORD_RESET_TOKEN_CREATED', userId });
|
|
181
|
+
}
|
|
182
|
+
async consumeNativeResetToken(rawToken) {
|
|
183
|
+
this.assertRedis('consumeNativeResetToken');
|
|
184
|
+
const userId = await this.redis.getdel(`${KEY_PWD_RESET}${rawToken}`);
|
|
185
|
+
if (!userId) {
|
|
186
|
+
throw new common_1.UnauthorizedException('Invalid or expired password reset token');
|
|
187
|
+
}
|
|
188
|
+
return userId;
|
|
189
|
+
}
|
|
190
|
+
assertRedis(method) {
|
|
191
|
+
if (!this.redis) {
|
|
192
|
+
throw new common_1.ServiceUnavailableException(`PasswordService.${method} requires Redis. Set REDIS_ENABLED=true in your environment.`);
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
hashIdentity(value) {
|
|
196
|
+
return (0, crypto_1.createHash)('sha256').update(value).digest('hex').slice(0, 16);
|
|
197
|
+
}
|
|
198
|
+
};
|
|
199
|
+
exports.PasswordService = PasswordService;
|
|
200
|
+
exports.PasswordService = PasswordService = PasswordService_1 = __decorate([
|
|
201
|
+
(0, common_1.Injectable)(),
|
|
202
|
+
__param(3, (0, typeorm_1.InjectRepository)(password_reset_token_entity_1.PasswordResetToken)),
|
|
203
|
+
__param(4, (0, common_1.Optional)()),
|
|
204
|
+
__param(4, (0, common_1.Inject)(redis_module_1.REDIS_CLIENT)),
|
|
205
|
+
__param(7, (0, common_1.Optional)()),
|
|
206
|
+
__param(7, (0, common_1.Inject)(jobs_1.JobsQueue)),
|
|
207
|
+
__metadata("design:paramtypes", [users_service_1.UsersService,
|
|
208
|
+
token_service_1.TokenService,
|
|
209
|
+
provider_registry_1.AuthProviderRegistry,
|
|
210
|
+
typeorm_2.Repository, Object, settings_service_1.SettingsService,
|
|
211
|
+
config_1.ConfigService, Object])
|
|
212
|
+
], PasswordService);
|
|
213
|
+
//# sourceMappingURL=password.service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"password.service.js","sourceRoot":"","sources":["../../../../modules/auth/services/password.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,mCAAoC;AACpC,2CAQwB;AACxB,6CAAmD;AACnD,qCAAqC;AACrC,mCAAoC;AACpC,+CAAiC;AAEjC,2CAA+C;AAC/C,sEAAkE;AAClE,yEAAqE;AACrE,sEAAsE;AACtE,yFAA6E;AAC7E,+DAA4D;AAC5D,+EAA2E;AAC3E,0EAAsE;AACtE,wCAA0C;AAQ1C,MAAM,aAAa,GAAG,YAAY,CAAC;AAG5B,IAAM,eAAe,uBAArB,MAAM,eAAe;IAG3B,YACkB,YAA0B,EAC1B,YAA0B,EAC1B,gBAAsC,EAEvD,cAA+D,EAG/D,KAAsC,EACrB,eAAgC,EAChC,aAA4B,EAG7C,SAA4C;QAZ3B,iBAAY,GAAZ,YAAY,CAAc;QAC1B,iBAAY,GAAZ,YAAY,CAAc;QAC1B,qBAAgB,GAAhB,gBAAgB,CAAsB;QAEtC,mBAAc,GAAd,cAAc,CAAgC;QAG9C,UAAK,GAAL,KAAK,CAAgB;QACrB,oBAAe,GAAf,eAAe,CAAiB;QAChC,kBAAa,GAAb,aAAa,CAAe;QAG5B,cAAS,GAAT,SAAS,CAAkB;QAf5B,WAAM,GAAG,IAAI,eAAM,CAAC,iBAAe,CAAC,IAAI,CAAC,CAAC;IAgBxD,CAAC;IAYJ,KAAK,CAAC,cAAc,CAAC,GAAsB;QAC1C,MAAM,aAAa,GAAG;YACrB,OAAO,EAAE,0DAA0D;SACnE,CAAC;QAEF,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,YAAY,CAAC,MAAM,CAAC,EAAE,KAAK,EAAE,GAAG,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M,CAAC,GAAG,aAAa,GAAG,QAAQ,EAAE,CAAC,CAAC;QAEvE,IAAI,CAAC,MAAM,EAAE,CAAC;YACb,MAAM,IAAI,8BAAqB,CAAC,yCAAyC,CAAC,CAAC;QAC5E,CAAC;QAED,OAAO,MAAM,CAAC;IACf,CAAC;IAEO,WAAW,CAAC,MAAc;QACjC,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC;YACjB,MAAM,IAAI,oCAA2B,CACpC,mBAAmB,MAAM,8DAA8D,CACvF,CAAC;QACH,CAAC;IACF,CAAC;IAEO,YAAY,CAAC,KAAa;QACjC,OAAO,IAAA,mBAAU,EAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;IACtE,CAAC;CACD,CAAA;AArPY,0CAAe;0BAAf,eAAe;IAD3B,IAAA,mBAAU,GAAE;IAQV,WAAA,IAAA,0BAAgB,EAAC,gDAAkB,CAAC,CAAA;IAEpC,WAAA,IAAA,iBAAQ,GAAE,CAAA;IACV,WAAA,IAAA,eAAM,EAAC,2BAAY,CAAC,CAAA;IAIpB,WAAA,IAAA,iBAAQ,GAAE,CAAA;IACV,WAAA,IAAA,eAAM,EAAC,gBAAS,CAAC,CAAA;qCAXa,4BAAY;QACZ,4BAAY;QACR,wCAAoB;QAEtB,oBAAU,UAIT,kCAAe;QACjB,sBAAa;GAblC,eAAe,CAqP3B"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { UsersService } from '../../users/services/users.service';
|
|
2
|
+
import { TokenService } from '../../sessions/services/token.service';
|
|
3
|
+
import { TokenResponse } from '../dto/token.dto';
|
|
4
|
+
import { RegisterDto, AcceptInviteDto } from '../dto/register.dto';
|
|
5
|
+
import { InviteService } from '../../users/services/invite.service';
|
|
6
|
+
import { AuthProviderRegistry } from '../providers';
|
|
7
|
+
import { RolesService } from '../../roles/services/roles.service';
|
|
8
|
+
import { UserRolesService } from '../../roles/services/user-roles.service';
|
|
9
|
+
import { SettingsService } from '../../settings/services/settings.service';
|
|
10
|
+
export declare class RegistrationService {
|
|
11
|
+
private readonly usersService;
|
|
12
|
+
private readonly tokenService;
|
|
13
|
+
private readonly inviteService;
|
|
14
|
+
private readonly providerRegistry;
|
|
15
|
+
private readonly rolesService;
|
|
16
|
+
private readonly userRolesService;
|
|
17
|
+
private readonly settingsService;
|
|
18
|
+
private readonly logger;
|
|
19
|
+
constructor(usersService: UsersService, tokenService: TokenService, inviteService: InviteService, providerRegistry: AuthProviderRegistry, rolesService: RolesService, userRolesService: UserRolesService, settingsService: SettingsService);
|
|
20
|
+
register(dto: RegisterDto, deviceInfo?: string, ipAddress?: string): Promise<TokenResponse>;
|
|
21
|
+
acceptInvite(dto: AcceptInviteDto, deviceInfo?: string, ipAddress?: string): Promise<TokenResponse>;
|
|
22
|
+
private registerWithPhone;
|
|
23
|
+
private registerWithEmail;
|
|
24
|
+
private assertEmailUnique;
|
|
25
|
+
private assertPhoneUnique;
|
|
26
|
+
private extractCountryCode;
|
|
27
|
+
private assignDefaultRole;
|
|
28
|
+
private logRegistration;
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=registration.service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registration.service.d.ts","sourceRoot":"","sources":["../../../../modules/auth/services/registration.service.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,oCAAoC,CAAC;AAClE,OAAO,EAAE,YAAY,EAAE,MAAM,uCAAuC,CAAC;AACrE,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACnE,OAAO,EAAE,aAAa,EAAE,MAAM,qCAAqC,CAAC;AACpE,OAAO,EAAgB,oBAAoB,EAAE,MAAM,cAAc,CAAC;AAElE,OAAO,EAAE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