@colveor/core 1.0.1 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +23 -0
- package/README.md +6 -0
- package/dist/bootstrap/bootstrap-colveor-app.d.ts.map +1 -1
- package/dist/bootstrap/bootstrap-colveor-app.js +22 -3
- package/dist/bootstrap/bootstrap-colveor-app.js.map +1 -1
- package/dist/common/decorators/index.d.ts +6 -0
- package/dist/common/decorators/index.d.ts.map +1 -1
- package/dist/common/decorators/index.js +8 -1
- package/dist/common/decorators/index.js.map +1 -1
- package/dist/common/decorators/ip-rate-limit-bucket.decorator.d.ts +9 -0
- package/dist/common/decorators/ip-rate-limit-bucket.decorator.d.ts.map +1 -0
- package/dist/common/decorators/ip-rate-limit-bucket.decorator.js +12 -0
- package/dist/common/decorators/ip-rate-limit-bucket.decorator.js.map +1 -0
- package/dist/common/guards/login-ip-rate-limit.guard.d.ts +12 -6
- package/dist/common/guards/login-ip-rate-limit.guard.d.ts.map +1 -1
- package/dist/common/guards/login-ip-rate-limit.guard.js +65 -21
- package/dist/common/guards/login-ip-rate-limit.guard.js.map +1 -1
- package/dist/common/guards/otp-ip-rate-limit.guard.d.ts +3 -2
- package/dist/common/guards/otp-ip-rate-limit.guard.d.ts.map +1 -1
- package/dist/common/guards/otp-ip-rate-limit.guard.js +17 -15
- package/dist/common/guards/otp-ip-rate-limit.guard.js.map +1 -1
- package/dist/common/guards/permissions.guard.d.ts.map +1 -1
- package/dist/common/guards/permissions.guard.js +12 -2
- package/dist/common/guards/permissions.guard.js.map +1 -1
- package/dist/common/interceptors/timeout.interceptor.d.ts +1 -1
- package/dist/common/interceptors/timeout.interceptor.d.ts.map +1 -1
- package/dist/common/interceptors/timeout.interceptor.js +5 -1
- package/dist/common/interceptors/timeout.interceptor.js.map +1 -1
- package/dist/common/interfaces/request-user.d.ts +4 -3
- package/dist/common/interfaces/request-user.d.ts.map +1 -1
- package/dist/common/utils/cache-version.util.d.ts +12 -0
- package/dist/common/utils/cache-version.util.d.ts.map +1 -0
- package/dist/common/utils/cache-version.util.js +34 -0
- package/dist/common/utils/cache-version.util.js.map +1 -0
- package/dist/common/utils/postgres-error.util.d.ts +5 -0
- package/dist/common/utils/postgres-error.util.d.ts.map +1 -0
- package/dist/common/utils/postgres-error.util.js +13 -0
- package/dist/common/utils/postgres-error.util.js.map +1 -0
- package/dist/common/utils/singleflight.util.d.ts +6 -0
- package/dist/common/utils/singleflight.util.d.ts.map +1 -0
- package/dist/common/utils/singleflight.util.js +21 -0
- package/dist/common/utils/singleflight.util.js.map +1 -0
- package/dist/common/validators/is-exclusive-auth-params.validator.js +1 -1
- package/dist/common/validators/is-exclusive-auth-params.validator.js.map +1 -1
- package/dist/common/validators/is-exclusive-delete-confirm-params.validator.js +1 -1
- package/dist/common/validators/is-exclusive-delete-confirm-params.validator.js.map +1 -1
- package/dist/config/app.config.d.ts +38 -0
- package/dist/config/app.config.d.ts.map +1 -1
- package/dist/config/app.config.js +24 -0
- package/dist/config/app.config.js.map +1 -1
- package/dist/config/database.config.d.ts +6 -0
- package/dist/config/database.config.d.ts.map +1 -1
- package/dist/config/database.config.js +3 -0
- package/dist/config/database.config.js.map +1 -1
- package/dist/config/env-flags.util.d.ts +4 -0
- package/dist/config/env-flags.util.d.ts.map +1 -1
- package/dist/config/env-flags.util.js +7 -0
- package/dist/config/env-flags.util.js.map +1 -1
- package/dist/config/env.validation.d.ts +24 -1
- package/dist/config/env.validation.d.ts.map +1 -1
- package/dist/config/env.validation.js +92 -2
- package/dist/config/env.validation.js.map +1 -1
- package/dist/config/in-memory-redis.client.d.ts +23 -4
- package/dist/config/in-memory-redis.client.d.ts.map +1 -1
- package/dist/config/in-memory-redis.client.js +148 -4
- package/dist/config/in-memory-redis.client.js.map +1 -1
- package/dist/config/redis.module.d.ts.map +1 -1
- package/dist/config/redis.module.js +5 -0
- package/dist/config/redis.module.js.map +1 -1
- package/dist/core.module.d.ts +5 -0
- package/dist/core.module.d.ts.map +1 -1
- package/dist/core.module.js +5 -0
- package/dist/core.module.js.map +1 -1
- package/dist/database/migrations/1785006199371-auth-mfa-oauth.d.ts +7 -0
- package/dist/database/migrations/1785006199371-auth-mfa-oauth.d.ts.map +1 -0
- package/dist/database/migrations/1785006199371-auth-mfa-oauth.js +24 -0
- package/dist/database/migrations/1785006199371-auth-mfa-oauth.js.map +1 -0
- package/dist/database/migrations/1785006199372-auth-mfa-backup-codes.d.ts +7 -0
- package/dist/database/migrations/1785006199372-auth-mfa-backup-codes.d.ts.map +1 -0
- package/dist/database/migrations/1785006199372-auth-mfa-backup-codes.js +16 -0
- package/dist/database/migrations/1785006199372-auth-mfa-backup-codes.js.map +1 -0
- package/dist/database/migrations/1785006199373-auth-gap-fixes.d.ts +7 -0
- package/dist/database/migrations/1785006199373-auth-gap-fixes.d.ts.map +1 -0
- package/dist/database/migrations/1785006199373-auth-gap-fixes.js +14 -0
- package/dist/database/migrations/1785006199373-auth-gap-fixes.js.map +1 -0
- package/dist/database/migrations/1785006199374-auth-sessions-indexes.d.ts +13 -0
- package/dist/database/migrations/1785006199374-auth-sessions-indexes.d.ts.map +1 -0
- package/dist/database/migrations/1785006199374-auth-sessions-indexes.js +35 -0
- package/dist/database/migrations/1785006199374-auth-sessions-indexes.js.map +1 -0
- package/dist/database/migrations/1785006199375-auth-identity-and-audit.d.ts +11 -0
- package/dist/database/migrations/1785006199375-auth-identity-and-audit.d.ts.map +1 -0
- package/dist/database/migrations/1785006199375-auth-identity-and-audit.js +60 -0
- package/dist/database/migrations/1785006199375-auth-identity-and-audit.js.map +1 -0
- package/dist/database/migrations/1785006199376-auth-settings-security-defaults.d.ts +14 -0
- package/dist/database/migrations/1785006199376-auth-settings-security-defaults.d.ts.map +1 -0
- package/dist/database/migrations/1785006199376-auth-settings-security-defaults.js +39 -0
- package/dist/database/migrations/1785006199376-auth-settings-security-defaults.js.map +1 -0
- package/dist/database/migrations/1785006199377-auth-security-hardening.d.ts +13 -0
- package/dist/database/migrations/1785006199377-auth-security-hardening.d.ts.map +1 -0
- package/dist/database/migrations/1785006199377-auth-security-hardening.js +69 -0
- package/dist/database/migrations/1785006199377-auth-security-hardening.js.map +1 -0
- package/dist/database/migrations/1785006199378-auth-family-denylist-and-hardening.d.ts +11 -0
- package/dist/database/migrations/1785006199378-auth-family-denylist-and-hardening.d.ts.map +1 -0
- package/dist/database/migrations/1785006199378-auth-family-denylist-and-hardening.js +51 -0
- package/dist/database/migrations/1785006199378-auth-family-denylist-and-hardening.js.map +1 -0
- package/dist/database/migrations/1785006199379-authz-lifecycle-hardening.d.ts +12 -0
- package/dist/database/migrations/1785006199379-authz-lifecycle-hardening.d.ts.map +1 -0
- package/dist/database/migrations/1785006199379-authz-lifecycle-hardening.js +37 -0
- package/dist/database/migrations/1785006199379-authz-lifecycle-hardening.js.map +1 -0
- package/dist/database/migrations/1785006199380-auth-remaining-gaps.d.ts +12 -0
- package/dist/database/migrations/1785006199380-auth-remaining-gaps.d.ts.map +1 -0
- package/dist/database/migrations/1785006199380-auth-remaining-gaps.js +74 -0
- package/dist/database/migrations/1785006199380-auth-remaining-gaps.js.map +1 -0
- package/dist/database/migrations/1785006199381-settings-blast-radius.d.ts +12 -0
- package/dist/database/migrations/1785006199381-settings-blast-radius.d.ts.map +1 -0
- package/dist/database/migrations/1785006199381-settings-blast-radius.js +52 -0
- package/dist/database/migrations/1785006199381-settings-blast-radius.js.map +1 -0
- package/dist/database/migrations/1785006199382-oauth-client-ids-lock.d.ts +11 -0
- package/dist/database/migrations/1785006199382-oauth-client-ids-lock.d.ts.map +1 -0
- package/dist/database/migrations/1785006199382-oauth-client-ids-lock.js +36 -0
- package/dist/database/migrations/1785006199382-oauth-client-ids-lock.js.map +1 -0
- package/dist/database/migrations/1785006199383-settings-role-and-verified-lock.d.ts +12 -0
- package/dist/database/migrations/1785006199383-settings-role-and-verified-lock.d.ts.map +1 -0
- package/dist/database/migrations/1785006199383-settings-role-and-verified-lock.js +39 -0
- package/dist/database/migrations/1785006199383-settings-role-and-verified-lock.js.map +1 -0
- package/dist/database/migrations/1785006199384-settings-providers-and-test-otp-lock.d.ts +12 -0
- package/dist/database/migrations/1785006199384-settings-providers-and-test-otp-lock.d.ts.map +1 -0
- package/dist/database/migrations/1785006199384-settings-providers-and-test-otp-lock.js +39 -0
- package/dist/database/migrations/1785006199384-settings-providers-and-test-otp-lock.js.map +1 -0
- package/dist/database/migrations/1785006199385-settings-auth-surface-lock.d.ts +13 -0
- package/dist/database/migrations/1785006199385-settings-auth-surface-lock.d.ts.map +1 -0
- package/dist/database/migrations/1785006199385-settings-auth-surface-lock.js +72 -0
- package/dist/database/migrations/1785006199385-settings-auth-surface-lock.js.map +1 -0
- package/dist/database/migrations/1785006199386-audit-events.d.ts +10 -0
- package/dist/database/migrations/1785006199386-audit-events.d.ts.map +1 -0
- package/dist/database/migrations/1785006199386-audit-events.js +60 -0
- package/dist/database/migrations/1785006199386-audit-events.js.map +1 -0
- package/dist/database/migrations/1785006199387-audit-resource-id-varchar.d.ts +10 -0
- package/dist/database/migrations/1785006199387-audit-resource-id-varchar.d.ts.map +1 -0
- package/dist/database/migrations/1785006199387-audit-resource-id-varchar.js +25 -0
- package/dist/database/migrations/1785006199387-audit-resource-id-varchar.js.map +1 -0
- package/dist/database/migrations/1785006199388-audit-enterprise.d.ts +11 -0
- package/dist/database/migrations/1785006199388-audit-enterprise.d.ts.map +1 -0
- package/dist/database/migrations/1785006199388-audit-enterprise.js +157 -0
- package/dist/database/migrations/1785006199388-audit-enterprise.js.map +1 -0
- package/dist/database/migrations/1785006199389-drop-admin-logs.d.ts +10 -0
- package/dist/database/migrations/1785006199389-drop-admin-logs.d.ts.map +1 -0
- package/dist/database/migrations/1785006199389-drop-admin-logs.js +38 -0
- package/dist/database/migrations/1785006199389-drop-admin-logs.js.map +1 -0
- package/dist/database/migrations/1785006199390-audit-hardening.d.ts +14 -0
- package/dist/database/migrations/1785006199390-audit-hardening.d.ts.map +1 -0
- package/dist/database/migrations/1785006199390-audit-hardening.js +345 -0
- package/dist/database/migrations/1785006199390-audit-hardening.js.map +1 -0
- package/dist/database/migrations/1785006199391-audit-owner-schema-create.d.ts +10 -0
- package/dist/database/migrations/1785006199391-audit-owner-schema-create.d.ts.map +1 -0
- package/dist/database/migrations/1785006199391-audit-owner-schema-create.js +39 -0
- package/dist/database/migrations/1785006199391-audit-owner-schema-create.js.map +1 -0
- package/dist/database/migrations/1785006199392-profile-photo-url.d.ts +11 -0
- package/dist/database/migrations/1785006199392-profile-photo-url.d.ts.map +1 -0
- package/dist/database/migrations/1785006199392-profile-photo-url.js +33 -0
- package/dist/database/migrations/1785006199392-profile-photo-url.js.map +1 -0
- package/dist/database/migrations/1785006199393-profile-cover-url.d.ts +11 -0
- package/dist/database/migrations/1785006199393-profile-cover-url.d.ts.map +1 -0
- package/dist/database/migrations/1785006199393-profile-cover-url.js +33 -0
- package/dist/database/migrations/1785006199393-profile-cover-url.js.map +1 -0
- package/dist/database/migrations/1785006199394-profile-is-public-default-false.d.ts +11 -0
- package/dist/database/migrations/1785006199394-profile-is-public-default-false.d.ts.map +1 -0
- package/dist/database/migrations/1785006199394-profile-is-public-default-false.js +24 -0
- package/dist/database/migrations/1785006199394-profile-is-public-default-false.js.map +1 -0
- package/dist/database/migrations/1785006199395-delivery-scale-indexes.d.ts +10 -0
- package/dist/database/migrations/1785006199395-delivery-scale-indexes.d.ts.map +1 -0
- package/dist/database/migrations/1785006199395-delivery-scale-indexes.js +35 -0
- package/dist/database/migrations/1785006199395-delivery-scale-indexes.js.map +1 -0
- package/dist/database/migrations/1785006199396-delivery-recipient-index.d.ts +11 -0
- package/dist/database/migrations/1785006199396-delivery-recipient-index.d.ts.map +1 -0
- package/dist/database/migrations/1785006199396-delivery-recipient-index.js +23 -0
- package/dist/database/migrations/1785006199396-delivery-recipient-index.js.map +1 -0
- package/dist/database/seeds/roles.seed.d.ts +6 -0
- package/dist/database/seeds/roles.seed.d.ts.map +1 -1
- package/dist/database/seeds/roles.seed.js +22 -5
- package/dist/database/seeds/roles.seed.js.map +1 -1
- package/dist/database/seeds/settings.seed.d.ts +5 -0
- package/dist/database/seeds/settings.seed.d.ts.map +1 -1
- package/dist/database/seeds/settings.seed.js +500 -25
- package/dist/database/seeds/settings.seed.js.map +1 -1
- package/dist/database/seeds/templates/html-template.reader.d.ts +1 -0
- package/dist/database/seeds/templates/html-template.reader.d.ts.map +1 -1
- package/dist/database/seeds/templates/html-template.reader.js +3 -1
- package/dist/database/seeds/templates/html-template.reader.js.map +1 -1
- package/dist/database/seeds/templates/html-template.reader.ts +5 -1
- package/dist/database/typeorm.util.d.ts.map +1 -1
- package/dist/database/typeorm.util.js +6 -0
- package/dist/database/typeorm.util.js.map +1 -1
- package/dist/index.d.ts +8 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +39 -4
- package/dist/index.js.map +1 -1
- package/dist/modules/admin/controllers/admin.controller.d.ts +15 -7
- package/dist/modules/admin/controllers/admin.controller.d.ts.map +1 -1
- package/dist/modules/admin/controllers/admin.controller.js +74 -17
- package/dist/modules/admin/controllers/admin.controller.js.map +1 -1
- package/dist/modules/admin/services/admin-log.service.d.ts +14 -7
- package/dist/modules/admin/services/admin-log.service.d.ts.map +1 -1
- package/dist/modules/admin/services/admin-log.service.js +41 -38
- package/dist/modules/admin/services/admin-log.service.js.map +1 -1
- package/dist/modules/audit/audit.manifest.d.ts +8 -0
- package/dist/modules/audit/audit.manifest.d.ts.map +1 -0
- package/dist/modules/audit/audit.manifest.js +31 -0
- package/dist/modules/audit/audit.manifest.js.map +1 -0
- package/dist/modules/audit/audit.module.d.ts +8 -0
- package/dist/modules/audit/audit.module.d.ts.map +1 -0
- package/dist/modules/audit/audit.module.js +57 -0
- package/dist/modules/audit/audit.module.js.map +1 -0
- package/dist/modules/audit/constants/audit-actions.d.ts +79 -0
- package/dist/modules/audit/constants/audit-actions.d.ts.map +1 -0
- package/dist/modules/audit/constants/audit-actions.js +89 -0
- package/dist/modules/audit/constants/audit-actions.js.map +1 -0
- package/dist/modules/audit/constants/audit-mutation.d.ts +10 -0
- package/dist/modules/audit/constants/audit-mutation.d.ts.map +1 -0
- package/dist/modules/audit/constants/audit-mutation.js +13 -0
- package/dist/modules/audit/constants/audit-mutation.js.map +1 -0
- package/dist/modules/audit/controllers/audit.controller.d.ts +13 -0
- package/dist/modules/audit/controllers/audit.controller.d.ts.map +1 -0
- package/dist/modules/audit/controllers/audit.controller.js +149 -0
- package/dist/modules/audit/controllers/audit.controller.js.map +1 -0
- package/dist/modules/audit/decorators/audit.decorator.d.ts +27 -0
- package/dist/modules/audit/decorators/audit.decorator.d.ts.map +1 -0
- package/dist/modules/audit/decorators/audit.decorator.js +18 -0
- package/dist/modules/audit/decorators/audit.decorator.js.map +1 -0
- package/dist/modules/audit/dto/audit.dto.d.ts +54 -0
- package/dist/modules/audit/dto/audit.dto.d.ts.map +1 -0
- package/dist/modules/audit/dto/audit.dto.js +129 -0
- package/dist/modules/audit/dto/audit.dto.js.map +1 -0
- package/dist/modules/audit/entities/audit-event.entity.d.ts +33 -0
- package/dist/modules/audit/entities/audit-event.entity.d.ts.map +1 -0
- package/dist/modules/audit/entities/audit-event.entity.js +125 -0
- package/dist/modules/audit/entities/audit-event.entity.js.map +1 -0
- package/dist/modules/audit/entities/audit-outbox.entity.d.ts +16 -0
- package/dist/modules/audit/entities/audit-outbox.entity.d.ts.map +1 -0
- package/dist/modules/audit/entities/audit-outbox.entity.js +65 -0
- package/dist/modules/audit/entities/audit-outbox.entity.js.map +1 -0
- package/dist/modules/audit/index.d.ts +13 -0
- package/dist/modules/audit/index.d.ts.map +1 -0
- package/dist/modules/audit/index.js +23 -0
- package/dist/modules/audit/index.js.map +1 -0
- package/dist/modules/audit/interceptors/audit.interceptor.d.ts +11 -0
- package/dist/modules/audit/interceptors/audit.interceptor.d.ts.map +1 -0
- package/dist/modules/audit/interceptors/audit.interceptor.js +75 -0
- package/dist/modules/audit/interceptors/audit.interceptor.js.map +1 -0
- package/dist/modules/audit/listeners/auth-audit.listener.d.ts +31 -0
- package/dist/modules/audit/listeners/auth-audit.listener.d.ts.map +1 -0
- package/dist/modules/audit/listeners/auth-audit.listener.js +338 -0
- package/dist/modules/audit/listeners/auth-audit.listener.js.map +1 -0
- package/dist/modules/audit/services/audit-archive.service.d.ts +28 -0
- package/dist/modules/audit/services/audit-archive.service.d.ts.map +1 -0
- package/dist/modules/audit/services/audit-archive.service.js +132 -0
- package/dist/modules/audit/services/audit-archive.service.js.map +1 -0
- package/dist/modules/audit/services/audit-hash-backfill.service.d.ts +22 -0
- package/dist/modules/audit/services/audit-hash-backfill.service.d.ts.map +1 -0
- package/dist/modules/audit/services/audit-hash-backfill.service.js +79 -0
- package/dist/modules/audit/services/audit-hash-backfill.service.js.map +1 -0
- package/dist/modules/audit/services/audit-leader.service.d.ts +28 -0
- package/dist/modules/audit/services/audit-leader.service.d.ts.map +1 -0
- package/dist/modules/audit/services/audit-leader.service.js +99 -0
- package/dist/modules/audit/services/audit-leader.service.js.map +1 -0
- package/dist/modules/audit/services/audit-outbox.worker.d.ts +29 -0
- package/dist/modules/audit/services/audit-outbox.worker.d.ts.map +1 -0
- package/dist/modules/audit/services/audit-outbox.worker.js +144 -0
- package/dist/modules/audit/services/audit-outbox.worker.js.map +1 -0
- package/dist/modules/audit/services/audit-partition.service.d.ts +18 -0
- package/dist/modules/audit/services/audit-partition.service.d.ts.map +1 -0
- package/dist/modules/audit/services/audit-partition.service.js +70 -0
- package/dist/modules/audit/services/audit-partition.service.js.map +1 -0
- package/dist/modules/audit/services/audit-write.service.d.ts +60 -0
- package/dist/modules/audit/services/audit-write.service.d.ts.map +1 -0
- package/dist/modules/audit/services/audit-write.service.js +463 -0
- package/dist/modules/audit/services/audit-write.service.js.map +1 -0
- package/dist/modules/audit/services/audit.service.d.ts +60 -0
- package/dist/modules/audit/services/audit.service.d.ts.map +1 -0
- package/dist/modules/audit/services/audit.service.js +373 -0
- package/dist/modules/audit/services/audit.service.js.map +1 -0
- package/dist/modules/audit/utils/audit-hash.util.d.ts +20 -0
- package/dist/modules/audit/utils/audit-hash.util.d.ts.map +1 -0
- package/dist/modules/audit/utils/audit-hash.util.js +44 -0
- package/dist/modules/audit/utils/audit-hash.util.js.map +1 -0
- package/dist/modules/auth/auth-core/auth-core.module.d.ts.map +1 -1
- package/dist/modules/auth/auth-core/auth-core.module.js +16 -4
- package/dist/modules/auth/auth-core/auth-core.module.js.map +1 -1
- package/dist/modules/auth/auth-core/constants/jwt-redis.keys.d.ts +22 -0
- package/dist/modules/auth/auth-core/constants/jwt-redis.keys.d.ts.map +1 -0
- package/dist/modules/auth/auth-core/constants/jwt-redis.keys.js +25 -0
- package/dist/modules/auth/auth-core/constants/jwt-redis.keys.js.map +1 -0
- package/dist/modules/auth/auth-core/services/access-token.validator.d.ts +19 -0
- package/dist/modules/auth/auth-core/services/access-token.validator.d.ts.map +1 -0
- package/dist/modules/auth/auth-core/services/access-token.validator.js +110 -0
- package/dist/modules/auth/auth-core/services/access-token.validator.js.map +1 -0
- package/dist/modules/auth/auth-core/services/family-denylist.reader.d.ts +10 -0
- package/dist/modules/auth/auth-core/services/family-denylist.reader.d.ts.map +1 -0
- package/dist/modules/auth/auth-core/services/family-denylist.reader.js +44 -0
- package/dist/modules/auth/auth-core/services/family-denylist.reader.js.map +1 -0
- package/dist/modules/auth/auth-core/services/session-epoch.reader.d.ts +10 -0
- package/dist/modules/auth/auth-core/services/session-epoch.reader.d.ts.map +1 -0
- package/dist/modules/auth/auth-core/services/session-epoch.reader.js +44 -0
- package/dist/modules/auth/auth-core/services/session-epoch.reader.js.map +1 -0
- package/dist/modules/auth/auth-core/strategies/jwt.strategy.d.ts +7 -8
- package/dist/modules/auth/auth-core/strategies/jwt.strategy.d.ts.map +1 -1
- package/dist/modules/auth/auth-core/strategies/jwt.strategy.js +34 -34
- package/dist/modules/auth/auth-core/strategies/jwt.strategy.js.map +1 -1
- package/dist/modules/auth/auth.manifest.d.ts +6 -0
- package/dist/modules/auth/auth.manifest.d.ts.map +1 -1
- package/dist/modules/auth/auth.manifest.js +38 -2
- package/dist/modules/auth/auth.manifest.js.map +1 -1
- package/dist/modules/auth/auth.module.d.ts.map +1 -1
- package/dist/modules/auth/auth.module.js +39 -4
- package/dist/modules/auth/auth.module.js.map +1 -1
- package/dist/modules/auth/controllers/account.controller.d.ts +15 -1
- package/dist/modules/auth/controllers/account.controller.d.ts.map +1 -1
- package/dist/modules/auth/controllers/account.controller.js +65 -7
- package/dist/modules/auth/controllers/account.controller.js.map +1 -1
- package/dist/modules/auth/controllers/auth.controller.d.ts +7 -3
- package/dist/modules/auth/controllers/auth.controller.d.ts.map +1 -1
- package/dist/modules/auth/controllers/auth.controller.js +76 -16
- package/dist/modules/auth/controllers/auth.controller.js.map +1 -1
- package/dist/modules/auth/controllers/forgot-password.controller.d.ts +4 -2
- package/dist/modules/auth/controllers/forgot-password.controller.d.ts.map +1 -1
- package/dist/modules/auth/controllers/forgot-password.controller.js +32 -11
- package/dist/modules/auth/controllers/forgot-password.controller.js.map +1 -1
- package/dist/modules/auth/controllers/mfa.controller.d.ts +18 -0
- package/dist/modules/auth/controllers/mfa.controller.d.ts.map +1 -0
- package/dist/modules/auth/controllers/mfa.controller.js +192 -0
- package/dist/modules/auth/controllers/mfa.controller.js.map +1 -0
- package/dist/modules/auth/controllers/oauth.controller.d.ts +22 -0
- package/dist/modules/auth/controllers/oauth.controller.d.ts.map +1 -0
- package/dist/modules/auth/controllers/oauth.controller.js +192 -0
- package/dist/modules/auth/controllers/oauth.controller.js.map +1 -0
- package/dist/modules/auth/controllers/otp.controller.d.ts +6 -3
- package/dist/modules/auth/controllers/otp.controller.d.ts.map +1 -1
- package/dist/modules/auth/controllers/otp.controller.js +32 -33
- package/dist/modules/auth/controllers/otp.controller.js.map +1 -1
- package/dist/modules/auth/controllers/pin.controller.d.ts.map +1 -1
- package/dist/modules/auth/controllers/pin.controller.js +10 -2
- package/dist/modules/auth/controllers/pin.controller.js.map +1 -1
- package/dist/modules/auth/controllers/session.controller.d.ts +12 -4
- package/dist/modules/auth/controllers/session.controller.d.ts.map +1 -1
- package/dist/modules/auth/controllers/session.controller.js +130 -31
- package/dist/modules/auth/controllers/session.controller.js.map +1 -1
- package/dist/modules/auth/dto/auth-config.dto.d.ts +11 -2
- package/dist/modules/auth/dto/auth-config.dto.d.ts.map +1 -1
- package/dist/modules/auth/dto/auth-config.dto.js +78 -3
- package/dist/modules/auth/dto/auth-config.dto.js.map +1 -1
- package/dist/modules/auth/dto/index.d.ts +2 -0
- package/dist/modules/auth/dto/index.d.ts.map +1 -1
- package/dist/modules/auth/dto/index.js +2 -0
- package/dist/modules/auth/dto/index.js.map +1 -1
- package/dist/modules/auth/dto/login.dto.d.ts +8 -1
- package/dist/modules/auth/dto/login.dto.d.ts.map +1 -1
- package/dist/modules/auth/dto/login.dto.js +48 -3
- package/dist/modules/auth/dto/login.dto.js.map +1 -1
- package/dist/modules/auth/dto/mfa.dto.d.ts +61 -0
- package/dist/modules/auth/dto/mfa.dto.d.ts.map +1 -0
- package/dist/modules/auth/dto/mfa.dto.js +326 -0
- package/dist/modules/auth/dto/mfa.dto.js.map +1 -0
- package/dist/modules/auth/dto/oauth.dto.d.ts +45 -0
- package/dist/modules/auth/dto/oauth.dto.d.ts.map +1 -0
- package/dist/modules/auth/dto/oauth.dto.js +249 -0
- package/dist/modules/auth/dto/oauth.dto.js.map +1 -0
- package/dist/modules/auth/dto/otp.dto.d.ts +3 -1
- package/dist/modules/auth/dto/otp.dto.d.ts.map +1 -1
- package/dist/modules/auth/dto/otp.dto.js +19 -0
- package/dist/modules/auth/dto/otp.dto.js.map +1 -1
- package/dist/modules/auth/dto/password.dto.d.ts +28 -0
- package/dist/modules/auth/dto/password.dto.d.ts.map +1 -1
- package/dist/modules/auth/dto/password.dto.js +191 -5
- package/dist/modules/auth/dto/password.dto.js.map +1 -1
- package/dist/modules/auth/dto/register.dto.d.ts +1 -0
- package/dist/modules/auth/dto/register.dto.d.ts.map +1 -1
- package/dist/modules/auth/dto/register.dto.js +1 -0
- package/dist/modules/auth/dto/register.dto.js.map +1 -1
- package/dist/modules/auth/dto/session.dto.d.ts +20 -0
- package/dist/modules/auth/dto/session.dto.d.ts.map +1 -0
- package/dist/modules/auth/dto/session.dto.js +98 -0
- package/dist/modules/auth/dto/session.dto.js.map +1 -0
- package/dist/modules/auth/dto/token.dto.d.ts +38 -1
- package/dist/modules/auth/dto/token.dto.d.ts.map +1 -1
- package/dist/modules/auth/dto/token.dto.js +21 -1
- package/dist/modules/auth/dto/token.dto.js.map +1 -1
- package/dist/modules/auth/entities/index.d.ts +2 -0
- package/dist/modules/auth/entities/index.d.ts.map +1 -1
- package/dist/modules/auth/entities/index.js +2 -0
- package/dist/modules/auth/entities/index.js.map +1 -1
- package/dist/modules/auth/entities/password-reset-token.entity.d.ts +2 -0
- package/dist/modules/auth/entities/password-reset-token.entity.d.ts.map +1 -1
- package/dist/modules/auth/entities/password-reset-token.entity.js +6 -0
- package/dist/modules/auth/entities/password-reset-token.entity.js.map +1 -1
- package/dist/modules/auth/entities/user-mfa.entity.d.ts +19 -0
- package/dist/modules/auth/entities/user-mfa.entity.d.ts.map +1 -0
- package/dist/modules/auth/entities/user-mfa.entity.js +73 -0
- package/dist/modules/auth/entities/user-mfa.entity.js.map +1 -0
- package/dist/modules/auth/entities/user-oauth-identity.entity.d.ts +24 -0
- package/dist/modules/auth/entities/user-oauth-identity.entity.d.ts.map +1 -0
- package/dist/modules/auth/entities/user-oauth-identity.entity.js +84 -0
- package/dist/modules/auth/entities/user-oauth-identity.entity.js.map +1 -0
- package/dist/modules/auth/events/auth.events.d.ts +84 -19
- package/dist/modules/auth/events/auth.events.d.ts.map +1 -1
- package/dist/modules/auth/events/auth.events.js +17 -9
- package/dist/modules/auth/events/auth.events.js.map +1 -1
- package/dist/modules/auth/services/account.service.d.ts +74 -14
- package/dist/modules/auth/services/account.service.d.ts.map +1 -1
- package/dist/modules/auth/services/account.service.js +247 -31
- package/dist/modules/auth/services/account.service.js.map +1 -1
- package/dist/modules/auth/services/dpop.service.d.ts +41 -0
- package/dist/modules/auth/services/dpop.service.d.ts.map +1 -0
- package/dist/modules/auth/services/dpop.service.js +159 -0
- package/dist/modules/auth/services/dpop.service.js.map +1 -0
- package/dist/modules/auth/services/index.d.ts +2 -0
- package/dist/modules/auth/services/index.d.ts.map +1 -1
- package/dist/modules/auth/services/index.js +2 -0
- package/dist/modules/auth/services/index.js.map +1 -1
- package/dist/modules/auth/services/legacy-hash-cleanup.service.d.ts +28 -0
- package/dist/modules/auth/services/legacy-hash-cleanup.service.d.ts.map +1 -0
- package/dist/modules/auth/services/legacy-hash-cleanup.service.js +163 -0
- package/dist/modules/auth/services/legacy-hash-cleanup.service.js.map +1 -0
- package/dist/modules/auth/services/login.service.d.ts +29 -34
- package/dist/modules/auth/services/login.service.d.ts.map +1 -1
- package/dist/modules/auth/services/login.service.js +173 -61
- package/dist/modules/auth/services/login.service.js.map +1 -1
- package/dist/modules/auth/services/mfa.service.d.ts +111 -0
- package/dist/modules/auth/services/mfa.service.d.ts.map +1 -0
- package/dist/modules/auth/services/mfa.service.js +662 -0
- package/dist/modules/auth/services/mfa.service.js.map +1 -0
- package/dist/modules/auth/services/oauth/apple-id-token.verifier.d.ts +11 -0
- package/dist/modules/auth/services/oauth/apple-id-token.verifier.d.ts.map +1 -0
- package/dist/modules/auth/services/oauth/apple-id-token.verifier.js +56 -0
- package/dist/modules/auth/services/oauth/apple-id-token.verifier.js.map +1 -0
- package/dist/modules/auth/services/oauth/google-id-token.verifier.d.ts +12 -0
- package/dist/modules/auth/services/oauth/google-id-token.verifier.d.ts.map +1 -0
- package/dist/modules/auth/services/oauth/google-id-token.verifier.js +64 -0
- package/dist/modules/auth/services/oauth/google-id-token.verifier.js.map +1 -0
- package/dist/modules/auth/services/oauth/microsoft-id-token.verifier.d.ts +11 -0
- package/dist/modules/auth/services/oauth/microsoft-id-token.verifier.d.ts.map +1 -0
- package/dist/modules/auth/services/oauth/microsoft-id-token.verifier.js +76 -0
- package/dist/modules/auth/services/oauth/microsoft-id-token.verifier.js.map +1 -0
- package/dist/modules/auth/services/oauth/oidc-id-token.verifier.d.ts +16 -0
- package/dist/modules/auth/services/oauth/oidc-id-token.verifier.d.ts.map +1 -0
- package/dist/modules/auth/services/oauth/oidc-id-token.verifier.js +92 -0
- package/dist/modules/auth/services/oauth/oidc-id-token.verifier.js.map +1 -0
- package/dist/modules/auth/services/oauth/verified-oauth-identity.d.ts +9 -0
- package/dist/modules/auth/services/oauth/verified-oauth-identity.d.ts.map +1 -0
- package/dist/modules/auth/services/oauth/verified-oauth-identity.js +3 -0
- package/dist/modules/auth/services/oauth/verified-oauth-identity.js.map +1 -0
- package/dist/modules/auth/services/oauth.service.d.ts +83 -0
- package/dist/modules/auth/services/oauth.service.d.ts.map +1 -0
- package/dist/modules/auth/services/oauth.service.js +471 -0
- package/dist/modules/auth/services/oauth.service.js.map +1 -0
- package/dist/modules/auth/services/otp-auth.service.d.ts +13 -3
- package/dist/modules/auth/services/otp-auth.service.d.ts.map +1 -1
- package/dist/modules/auth/services/otp-auth.service.js +41 -7
- package/dist/modules/auth/services/otp-auth.service.js.map +1 -1
- package/dist/modules/auth/services/password-reset-audit-retention.service.d.ts +22 -0
- package/dist/modules/auth/services/password-reset-audit-retention.service.d.ts.map +1 -0
- package/dist/modules/auth/services/password-reset-audit-retention.service.js +117 -0
- package/dist/modules/auth/services/password-reset-audit-retention.service.js.map +1 -0
- package/dist/modules/auth/services/password.service.d.ts +25 -5
- package/dist/modules/auth/services/password.service.d.ts.map +1 -1
- package/dist/modules/auth/services/password.service.js +154 -20
- package/dist/modules/auth/services/password.service.js.map +1 -1
- package/dist/modules/auth/services/pin-auth.service.d.ts +10 -3
- package/dist/modules/auth/services/pin-auth.service.d.ts.map +1 -1
- package/dist/modules/auth/services/pin-auth.service.js +110 -13
- package/dist/modules/auth/services/pin-auth.service.js.map +1 -1
- package/dist/modules/auth/services/registration.service.d.ts +10 -2
- package/dist/modules/auth/services/registration.service.d.ts.map +1 -1
- package/dist/modules/auth/services/registration.service.js +113 -25
- package/dist/modules/auth/services/registration.service.js.map +1 -1
- package/dist/modules/auth/services/turnstile.service.d.ts +17 -0
- package/dist/modules/auth/services/turnstile.service.d.ts.map +1 -0
- package/dist/modules/auth/services/turnstile.service.js +94 -0
- package/dist/modules/auth/services/turnstile.service.js.map +1 -0
- package/dist/modules/auth/utils/auth-params.util.d.ts +13 -6
- package/dist/modules/auth/utils/auth-params.util.d.ts.map +1 -1
- package/dist/modules/auth/utils/auth-params.util.js +27 -4
- package/dist/modules/auth/utils/auth-params.util.js.map +1 -1
- package/dist/modules/auth/utils/auth-supported.util.d.ts +12 -1
- package/dist/modules/auth/utils/auth-supported.util.d.ts.map +1 -1
- package/dist/modules/auth/utils/auth-supported.util.js +36 -4
- package/dist/modules/auth/utils/auth-supported.util.js.map +1 -1
- package/dist/modules/auth/utils/backup-code-hash.util.d.ts +10 -0
- package/dist/modules/auth/utils/backup-code-hash.util.d.ts.map +1 -0
- package/dist/modules/auth/utils/backup-code-hash.util.js +31 -0
- package/dist/modules/auth/utils/backup-code-hash.util.js.map +1 -0
- package/dist/modules/auth/utils/backup-codes.util.d.ts +5 -0
- package/dist/modules/auth/utils/backup-codes.util.d.ts.map +1 -0
- package/dist/modules/auth/utils/backup-codes.util.js +22 -0
- package/dist/modules/auth/utils/backup-codes.util.js.map +1 -0
- package/dist/modules/auth/utils/dpop.util.d.ts +22 -0
- package/dist/modules/auth/utils/dpop.util.d.ts.map +1 -0
- package/dist/modules/auth/utils/dpop.util.js +73 -0
- package/dist/modules/auth/utils/dpop.util.js.map +1 -0
- package/dist/modules/auth/utils/mfa-secret.util.d.ts +22 -0
- package/dist/modules/auth/utils/mfa-secret.util.d.ts.map +1 -0
- package/dist/modules/auth/utils/mfa-secret.util.js +59 -0
- package/dist/modules/auth/utils/mfa-secret.util.js.map +1 -0
- package/dist/modules/auth/utils/mfa-verify-params.util.d.ts +26 -0
- package/dist/modules/auth/utils/mfa-verify-params.util.d.ts.map +1 -0
- package/dist/modules/auth/utils/mfa-verify-params.util.js +49 -0
- package/dist/modules/auth/utils/mfa-verify-params.util.js.map +1 -0
- package/dist/modules/auth/utils/step-up-purpose.util.d.ts +5 -0
- package/dist/modules/auth/utils/step-up-purpose.util.d.ts.map +1 -0
- package/dist/modules/auth/utils/step-up-purpose.util.js +18 -0
- package/dist/modules/auth/utils/step-up-purpose.util.js.map +1 -0
- package/dist/modules/auth/utils/totp.util.d.ts +16 -0
- package/dist/modules/auth/utils/totp.util.d.ts.map +1 -0
- package/dist/modules/auth/utils/totp.util.js +88 -0
- package/dist/modules/auth/utils/totp.util.js.map +1 -0
- package/dist/modules/delivery/composers/otp-delivery.composer.d.ts +28 -1
- package/dist/modules/delivery/composers/otp-delivery.composer.d.ts.map +1 -1
- package/dist/modules/delivery/composers/otp-delivery.composer.js +48 -2
- package/dist/modules/delivery/composers/otp-delivery.composer.js.map +1 -1
- package/dist/modules/delivery/constants/delivery-worker.constants.d.ts +29 -0
- package/dist/modules/delivery/constants/delivery-worker.constants.d.ts.map +1 -0
- package/dist/modules/delivery/constants/delivery-worker.constants.js +51 -0
- package/dist/modules/delivery/constants/delivery-worker.constants.js.map +1 -0
- package/dist/modules/delivery/delivery.module.d.ts.map +1 -1
- package/dist/modules/delivery/delivery.module.js +1 -15
- package/dist/modules/delivery/delivery.module.js.map +1 -1
- package/dist/modules/delivery/entities/notification-delivery-log.entity.d.ts.map +1 -1
- package/dist/modules/delivery/entities/notification-delivery-log.entity.js +3 -1
- package/dist/modules/delivery/entities/notification-delivery-log.entity.js.map +1 -1
- package/dist/modules/delivery/notification-delivery.service.d.ts +12 -1
- package/dist/modules/delivery/notification-delivery.service.d.ts.map +1 -1
- package/dist/modules/delivery/notification-delivery.service.js +121 -40
- package/dist/modules/delivery/notification-delivery.service.js.map +1 -1
- package/dist/modules/delivery/processors/delivery-job.runner.d.ts +22 -1
- package/dist/modules/delivery/processors/delivery-job.runner.d.ts.map +1 -1
- package/dist/modules/delivery/processors/delivery-job.runner.js +144 -42
- package/dist/modules/delivery/processors/delivery-job.runner.js.map +1 -1
- package/dist/modules/delivery/processors/delivery.processor.d.ts.map +1 -1
- package/dist/modules/delivery/processors/delivery.processor.js +6 -1
- package/dist/modules/delivery/processors/delivery.processor.js.map +1 -1
- package/dist/modules/delivery/processors/otp-delivery-job.runner.d.ts +11 -0
- package/dist/modules/delivery/processors/otp-delivery-job.runner.d.ts.map +1 -1
- package/dist/modules/delivery/processors/otp-delivery-job.runner.js +90 -16
- package/dist/modules/delivery/processors/otp-delivery-job.runner.js.map +1 -1
- package/dist/modules/delivery/processors/otp-delivery.processor.d.ts.map +1 -1
- package/dist/modules/delivery/processors/otp-delivery.processor.js +6 -1
- package/dist/modules/delivery/processors/otp-delivery.processor.js.map +1 -1
- package/dist/modules/delivery/queues/sync-jobs.queue.d.ts +7 -1
- package/dist/modules/delivery/queues/sync-jobs.queue.d.ts.map +1 -1
- package/dist/modules/delivery/queues/sync-jobs.queue.js +11 -2
- package/dist/modules/delivery/queues/sync-jobs.queue.js.map +1 -1
- package/dist/modules/delivery/services/delivery-audit-retention.service.d.ts +7 -3
- package/dist/modules/delivery/services/delivery-audit-retention.service.d.ts.map +1 -1
- package/dist/modules/delivery/services/delivery-audit-retention.service.js +33 -10
- package/dist/modules/delivery/services/delivery-audit-retention.service.js.map +1 -1
- package/dist/modules/delivery/services/notification-audit.service.d.ts +7 -4
- package/dist/modules/delivery/services/notification-audit.service.d.ts.map +1 -1
- package/dist/modules/delivery/services/notification-audit.service.js +83 -26
- package/dist/modules/delivery/services/notification-audit.service.js.map +1 -1
- package/dist/modules/delivery/utils/payload-snapshot.util.d.ts +2 -0
- package/dist/modules/delivery/utils/payload-snapshot.util.d.ts.map +1 -1
- package/dist/modules/delivery/utils/payload-snapshot.util.js +22 -3
- package/dist/modules/delivery/utils/payload-snapshot.util.js.map +1 -1
- package/dist/modules/file-upload/controllers/file-upload.controller.d.ts +7 -1
- package/dist/modules/file-upload/controllers/file-upload.controller.d.ts.map +1 -1
- package/dist/modules/file-upload/controllers/file-upload.controller.js +5 -7
- package/dist/modules/file-upload/controllers/file-upload.controller.js.map +1 -1
- package/dist/modules/file-upload/dto/file-upload.dto.d.ts +2 -0
- package/dist/modules/file-upload/dto/file-upload.dto.d.ts.map +1 -1
- package/dist/modules/file-upload/dto/file-upload.dto.js +20 -0
- package/dist/modules/file-upload/dto/file-upload.dto.js.map +1 -1
- package/dist/modules/file-upload/file-upload.module.d.ts.map +1 -1
- package/dist/modules/file-upload/file-upload.module.js +12 -2
- package/dist/modules/file-upload/file-upload.module.js.map +1 -1
- package/dist/modules/file-upload/services/file-upload.service.d.ts +24 -6
- package/dist/modules/file-upload/services/file-upload.service.d.ts.map +1 -1
- package/dist/modules/file-upload/services/file-upload.service.js +164 -36
- package/dist/modules/file-upload/services/file-upload.service.js.map +1 -1
- package/dist/modules/file-upload/services/upload-orphan-cleanup.service.d.ts +4 -2
- package/dist/modules/file-upload/services/upload-orphan-cleanup.service.d.ts.map +1 -1
- package/dist/modules/file-upload/services/upload-orphan-cleanup.service.js +30 -5
- package/dist/modules/file-upload/services/upload-orphan-cleanup.service.js.map +1 -1
- package/dist/modules/file-upload/utils/image-optimize.util.d.ts.map +1 -1
- package/dist/modules/file-upload/utils/image-optimize.util.js +7 -1
- package/dist/modules/file-upload/utils/image-optimize.util.js.map +1 -1
- package/dist/modules/health/health.controller.d.ts +5 -1
- package/dist/modules/health/health.controller.d.ts.map +1 -1
- package/dist/modules/health/health.controller.js +57 -3
- package/dist/modules/health/health.controller.js.map +1 -1
- package/dist/modules/invitations/controllers/invitations.controller.d.ts +19 -4
- package/dist/modules/invitations/controllers/invitations.controller.d.ts.map +1 -1
- package/dist/modules/invitations/controllers/invitations.controller.js +19 -10
- package/dist/modules/invitations/controllers/invitations.controller.js.map +1 -1
- package/dist/modules/invitations/dto/invitation.dto.d.ts +13 -0
- package/dist/modules/invitations/dto/invitation.dto.d.ts.map +1 -1
- package/dist/modules/invitations/dto/invitation.dto.js +69 -2
- package/dist/modules/invitations/dto/invitation.dto.js.map +1 -1
- package/dist/modules/invitations/services/invitations.service.d.ts +24 -6
- package/dist/modules/invitations/services/invitations.service.d.ts.map +1 -1
- package/dist/modules/invitations/services/invitations.service.js +96 -20
- package/dist/modules/invitations/services/invitations.service.js.map +1 -1
- package/dist/modules/jobs/queues/jobs.queue.d.ts +7 -2
- package/dist/modules/jobs/queues/jobs.queue.d.ts.map +1 -1
- package/dist/modules/jobs/queues/jobs.queue.js +25 -10
- package/dist/modules/jobs/queues/jobs.queue.js.map +1 -1
- package/dist/modules/notifications/controllers/notifications.controller.d.ts +3 -1
- package/dist/modules/notifications/controllers/notifications.controller.d.ts.map +1 -1
- package/dist/modules/notifications/controllers/notifications.controller.js +25 -2
- package/dist/modules/notifications/controllers/notifications.controller.js.map +1 -1
- package/dist/modules/notifications/dto/notification-query.dto.d.ts.map +1 -1
- package/dist/modules/notifications/dto/notification-query.dto.js +1 -0
- package/dist/modules/notifications/dto/notification-query.dto.js.map +1 -1
- package/dist/modules/notifications/entities/device-token.entity.d.ts.map +1 -1
- package/dist/modules/notifications/entities/device-token.entity.js +3 -1
- package/dist/modules/notifications/entities/device-token.entity.js.map +1 -1
- package/dist/modules/notifications/services/fcm.service.d.ts +2 -0
- package/dist/modules/notifications/services/fcm.service.d.ts.map +1 -1
- package/dist/modules/notifications/services/fcm.service.js +28 -7
- package/dist/modules/notifications/services/fcm.service.js.map +1 -1
- package/dist/modules/notifications/services/notifications.service.d.ts +16 -3
- package/dist/modules/notifications/services/notifications.service.d.ts.map +1 -1
- package/dist/modules/notifications/services/notifications.service.js +95 -24
- package/dist/modules/notifications/services/notifications.service.js.map +1 -1
- package/dist/modules/observability/metrics/metrics.service.d.ts +2 -0
- package/dist/modules/observability/metrics/metrics.service.d.ts.map +1 -1
- package/dist/modules/observability/metrics/metrics.service.js +11 -0
- package/dist/modules/observability/metrics/metrics.service.js.map +1 -1
- package/dist/modules/otp/constants/otp.constants.d.ts +7 -5
- package/dist/modules/otp/constants/otp.constants.d.ts.map +1 -1
- package/dist/modules/otp/constants/otp.constants.js +11 -8
- package/dist/modules/otp/constants/otp.constants.js.map +1 -1
- package/dist/modules/otp/interfaces/otp.service.interface.d.ts +1 -1
- package/dist/modules/otp/interfaces/otp.service.interface.d.ts.map +1 -1
- package/dist/modules/otp/otp.service.d.ts +10 -2
- package/dist/modules/otp/otp.service.d.ts.map +1 -1
- package/dist/modules/otp/otp.service.js +48 -4
- package/dist/modules/otp/otp.service.js.map +1 -1
- package/dist/modules/otp/services/otp.rate-limiter.d.ts +2 -0
- package/dist/modules/otp/services/otp.rate-limiter.d.ts.map +1 -1
- package/dist/modules/otp/services/otp.rate-limiter.js +19 -0
- package/dist/modules/otp/services/otp.rate-limiter.js.map +1 -1
- package/dist/modules/otp/services/otp.session.store.d.ts +9 -3
- package/dist/modules/otp/services/otp.session.store.d.ts.map +1 -1
- package/dist/modules/otp/services/otp.session.store.js +34 -42
- package/dist/modules/otp/services/otp.session.store.js.map +1 -1
- package/dist/modules/otp/utils/otp-code-hash.util.d.ts +11 -0
- package/dist/modules/otp/utils/otp-code-hash.util.d.ts.map +1 -0
- package/dist/modules/otp/utils/otp-code-hash.util.js +68 -0
- package/dist/modules/otp/utils/otp-code-hash.util.js.map +1 -0
- package/dist/modules/profile/controllers/profile.controller.d.ts +9 -3
- package/dist/modules/profile/controllers/profile.controller.d.ts.map +1 -1
- package/dist/modules/profile/controllers/profile.controller.js +140 -8
- package/dist/modules/profile/controllers/profile.controller.js.map +1 -1
- package/dist/modules/profile/dto/create-user-profile.dto.d.ts +10 -0
- package/dist/modules/profile/dto/create-user-profile.dto.d.ts.map +1 -1
- package/dist/modules/profile/dto/create-user-profile.dto.js +43 -1
- package/dist/modules/profile/dto/create-user-profile.dto.js.map +1 -1
- package/dist/modules/profile/dto/public-user-profile.dto.d.ts +24 -0
- package/dist/modules/profile/dto/public-user-profile.dto.d.ts.map +1 -0
- package/dist/modules/profile/dto/public-user-profile.dto.js +115 -0
- package/dist/modules/profile/dto/public-user-profile.dto.js.map +1 -0
- package/dist/modules/profile/dto/user-profile-response.dto.d.ts +4 -0
- package/dist/modules/profile/dto/user-profile-response.dto.d.ts.map +1 -1
- package/dist/modules/profile/dto/user-profile-response.dto.js +4 -0
- package/dist/modules/profile/dto/user-profile-response.dto.js.map +1 -1
- package/dist/modules/profile/dto/username-available.dto.d.ts +6 -0
- package/dist/modules/profile/dto/username-available.dto.d.ts.map +1 -0
- package/dist/modules/profile/dto/username-available.dto.js +31 -0
- package/dist/modules/profile/dto/username-available.dto.js.map +1 -0
- package/dist/modules/profile/entities/user-profiles.entity.d.ts +10 -0
- package/dist/modules/profile/entities/user-profiles.entity.d.ts.map +1 -1
- package/dist/modules/profile/entities/user-profiles.entity.js +29 -1
- package/dist/modules/profile/entities/user-profiles.entity.js.map +1 -1
- package/dist/modules/profile/index.d.ts +1 -0
- package/dist/modules/profile/index.d.ts.map +1 -1
- package/dist/modules/profile/index.js +1 -0
- package/dist/modules/profile/index.js.map +1 -1
- package/dist/modules/profile/profile.manifest.d.ts +2 -2
- package/dist/modules/profile/profile.manifest.js +2 -2
- package/dist/modules/profile/profile.manifest.js.map +1 -1
- package/dist/modules/profile/profile.module.d.ts.map +1 -1
- package/dist/modules/profile/profile.module.js +7 -2
- package/dist/modules/profile/profile.module.js.map +1 -1
- package/dist/modules/profile/services/profile.service.d.ts +56 -4
- package/dist/modules/profile/services/profile.service.d.ts.map +1 -1
- package/dist/modules/profile/services/profile.service.js +247 -20
- package/dist/modules/profile/services/profile.service.js.map +1 -1
- package/dist/modules/realtime/adapters/redis-io.adapter.d.ts +26 -0
- package/dist/modules/realtime/adapters/redis-io.adapter.d.ts.map +1 -0
- package/dist/modules/realtime/adapters/redis-io.adapter.js +124 -0
- package/dist/modules/realtime/adapters/redis-io.adapter.js.map +1 -0
- package/dist/modules/realtime/constants/realtime.constants.d.ts +36 -0
- package/dist/modules/realtime/constants/realtime.constants.d.ts.map +1 -0
- package/dist/modules/realtime/constants/realtime.constants.js +42 -0
- package/dist/modules/realtime/constants/realtime.constants.js.map +1 -0
- package/dist/modules/realtime/controllers/realtime.controller.d.ts +21 -0
- package/dist/modules/realtime/controllers/realtime.controller.d.ts.map +1 -0
- package/dist/modules/realtime/controllers/realtime.controller.js +113 -0
- package/dist/modules/realtime/controllers/realtime.controller.js.map +1 -0
- package/dist/modules/realtime/gateway/realtime.gateway.d.ts +42 -0
- package/dist/modules/realtime/gateway/realtime.gateway.d.ts.map +1 -0
- package/dist/modules/realtime/gateway/realtime.gateway.js +289 -0
- package/dist/modules/realtime/gateway/realtime.gateway.js.map +1 -0
- package/dist/modules/realtime/index.d.ts +12 -0
- package/dist/modules/realtime/index.d.ts.map +1 -0
- package/dist/modules/realtime/index.js +35 -0
- package/dist/modules/realtime/index.js.map +1 -0
- package/dist/modules/realtime/realtime.manifest.d.ts +8 -0
- package/dist/modules/realtime/realtime.manifest.d.ts.map +1 -0
- package/dist/modules/realtime/realtime.manifest.js +31 -0
- package/dist/modules/realtime/realtime.manifest.js.map +1 -0
- package/dist/modules/realtime/realtime.module.d.ts +14 -0
- package/dist/modules/realtime/realtime.module.d.ts.map +1 -0
- package/dist/modules/realtime/realtime.module.js +126 -0
- package/dist/modules/realtime/realtime.module.js.map +1 -0
- package/dist/modules/realtime/services/realtime-handler.registry.d.ts +16 -0
- package/dist/modules/realtime/services/realtime-handler.registry.d.ts.map +1 -0
- package/dist/modules/realtime/services/realtime-handler.registry.js +55 -0
- package/dist/modules/realtime/services/realtime-handler.registry.js.map +1 -0
- package/dist/modules/realtime/services/realtime-presence.service.d.ts +15 -0
- package/dist/modules/realtime/services/realtime-presence.service.d.ts.map +1 -0
- package/dist/modules/realtime/services/realtime-presence.service.js +86 -0
- package/dist/modules/realtime/services/realtime-presence.service.js.map +1 -0
- package/dist/modules/realtime/services/realtime-rate-limiter.service.d.ts +12 -0
- package/dist/modules/realtime/services/realtime-rate-limiter.service.d.ts.map +1 -0
- package/dist/modules/realtime/services/realtime-rate-limiter.service.js +63 -0
- package/dist/modules/realtime/services/realtime-rate-limiter.service.js.map +1 -0
- package/dist/modules/realtime/services/realtime.service.d.ts +88 -0
- package/dist/modules/realtime/services/realtime.service.d.ts.map +1 -0
- package/dist/modules/realtime/services/realtime.service.js +343 -0
- package/dist/modules/realtime/services/realtime.service.js.map +1 -0
- package/dist/modules/realtime/types/realtime.types.d.ts +50 -0
- package/dist/modules/realtime/types/realtime.types.d.ts.map +1 -0
- package/dist/modules/realtime/types/realtime.types.js +14 -0
- package/dist/modules/realtime/types/realtime.types.js.map +1 -0
- package/dist/modules/realtime/utils/handshake-error.util.d.ts +5 -0
- package/dist/modules/realtime/utils/handshake-error.util.d.ts.map +1 -0
- package/dist/modules/realtime/utils/handshake-error.util.js +45 -0
- package/dist/modules/realtime/utils/handshake-error.util.js.map +1 -0
- package/dist/modules/roles/controllers/modules.controller.d.ts +4 -3
- package/dist/modules/roles/controllers/modules.controller.d.ts.map +1 -1
- package/dist/modules/roles/controllers/modules.controller.js +21 -10
- package/dist/modules/roles/controllers/modules.controller.js.map +1 -1
- package/dist/modules/roles/controllers/permissions.controller.d.ts +4 -3
- package/dist/modules/roles/controllers/permissions.controller.d.ts.map +1 -1
- package/dist/modules/roles/controllers/permissions.controller.js +21 -10
- package/dist/modules/roles/controllers/permissions.controller.js.map +1 -1
- package/dist/modules/roles/controllers/roles.controller.d.ts +5 -4
- package/dist/modules/roles/controllers/roles.controller.d.ts.map +1 -1
- package/dist/modules/roles/controllers/roles.controller.js +26 -13
- package/dist/modules/roles/controllers/roles.controller.js.map +1 -1
- package/dist/modules/roles/controllers/user-roles.controller.d.ts +3 -2
- package/dist/modules/roles/controllers/user-roles.controller.d.ts.map +1 -1
- package/dist/modules/roles/controllers/user-roles.controller.js +14 -6
- package/dist/modules/roles/controllers/user-roles.controller.js.map +1 -1
- package/dist/modules/roles/services/modules.service.d.ts +8 -5
- package/dist/modules/roles/services/modules.service.d.ts.map +1 -1
- package/dist/modules/roles/services/modules.service.js +58 -12
- package/dist/modules/roles/services/modules.service.js.map +1 -1
- package/dist/modules/roles/services/permissions.service.d.ts +8 -5
- package/dist/modules/roles/services/permissions.service.d.ts.map +1 -1
- package/dist/modules/roles/services/permissions.service.js +61 -12
- package/dist/modules/roles/services/permissions.service.js.map +1 -1
- package/dist/modules/roles/services/roles.service.d.ts +19 -9
- package/dist/modules/roles/services/roles.service.d.ts.map +1 -1
- package/dist/modules/roles/services/roles.service.js +137 -47
- package/dist/modules/roles/services/roles.service.js.map +1 -1
- package/dist/modules/roles/services/user-roles.service.d.ts +12 -4
- package/dist/modules/roles/services/user-roles.service.d.ts.map +1 -1
- package/dist/modules/roles/services/user-roles.service.js +58 -26
- package/dist/modules/roles/services/user-roles.service.js.map +1 -1
- package/dist/modules/sessions/entities/refresh-token.entity.d.ts +7 -1
- package/dist/modules/sessions/entities/refresh-token.entity.d.ts.map +1 -1
- package/dist/modules/sessions/entities/refresh-token.entity.js +10 -0
- package/dist/modules/sessions/entities/refresh-token.entity.js.map +1 -1
- package/dist/modules/sessions/entities/revoked-refresh-family.entity.d.ts +12 -0
- package/dist/modules/sessions/entities/revoked-refresh-family.entity.d.ts.map +1 -0
- package/dist/modules/sessions/entities/revoked-refresh-family.entity.js +46 -0
- package/dist/modules/sessions/entities/revoked-refresh-family.entity.js.map +1 -0
- package/dist/modules/sessions/services/refresh-token-retention.service.d.ts +20 -0
- package/dist/modules/sessions/services/refresh-token-retention.service.d.ts.map +1 -0
- package/dist/modules/sessions/services/refresh-token-retention.service.js +97 -0
- package/dist/modules/sessions/services/refresh-token-retention.service.js.map +1 -0
- package/dist/modules/sessions/services/token.service.d.ts +150 -16
- package/dist/modules/sessions/services/token.service.d.ts.map +1 -1
- package/dist/modules/sessions/services/token.service.js +505 -74
- package/dist/modules/sessions/services/token.service.js.map +1 -1
- package/dist/modules/sessions/sessions.module.d.ts.map +1 -1
- package/dist/modules/sessions/sessions.module.js +4 -2
- package/dist/modules/sessions/sessions.module.js.map +1 -1
- package/dist/modules/sessions/utils/refresh-token-hash.util.d.ts +13 -0
- package/dist/modules/sessions/utils/refresh-token-hash.util.d.ts.map +1 -0
- package/dist/modules/sessions/utils/refresh-token-hash.util.js +37 -0
- package/dist/modules/sessions/utils/refresh-token-hash.util.js.map +1 -0
- package/dist/modules/settings/constants/settings.defaults.d.ts +57 -3
- package/dist/modules/settings/constants/settings.defaults.d.ts.map +1 -1
- package/dist/modules/settings/constants/settings.defaults.js +58 -3
- package/dist/modules/settings/constants/settings.defaults.js.map +1 -1
- package/dist/modules/settings/constants/settings.keys.d.ts +138 -2
- package/dist/modules/settings/constants/settings.keys.d.ts.map +1 -1
- package/dist/modules/settings/constants/settings.keys.js +140 -2
- package/dist/modules/settings/constants/settings.keys.js.map +1 -1
- package/dist/modules/settings/controllers/settings.controller.d.ts +5 -1
- package/dist/modules/settings/controllers/settings.controller.d.ts.map +1 -1
- package/dist/modules/settings/controllers/settings.controller.js +134 -5
- package/dist/modules/settings/controllers/settings.controller.js.map +1 -1
- package/dist/modules/settings/services/settings.service.d.ts +17 -7
- package/dist/modules/settings/services/settings.service.d.ts.map +1 -1
- package/dist/modules/settings/services/settings.service.js +80 -14
- package/dist/modules/settings/services/settings.service.js.map +1 -1
- package/dist/modules/settings/utils/settings-secret.util.d.ts +13 -0
- package/dist/modules/settings/utils/settings-secret.util.d.ts.map +1 -0
- package/dist/modules/settings/utils/settings-secret.util.js +80 -0
- package/dist/modules/settings/utils/settings-secret.util.js.map +1 -0
- package/dist/modules/users/controllers/users.controller.d.ts +4 -2
- package/dist/modules/users/controllers/users.controller.d.ts.map +1 -1
- package/dist/modules/users/controllers/users.controller.js +89 -10
- package/dist/modules/users/controllers/users.controller.js.map +1 -1
- package/dist/modules/users/dto/user.dto.d.ts +5 -0
- package/dist/modules/users/dto/user.dto.d.ts.map +1 -1
- package/dist/modules/users/dto/user.dto.js +46 -5
- package/dist/modules/users/dto/user.dto.js.map +1 -1
- package/dist/modules/users/entities/user.entity.d.ts +7 -1
- package/dist/modules/users/entities/user.entity.d.ts.map +1 -1
- package/dist/modules/users/entities/user.entity.js +10 -0
- package/dist/modules/users/entities/user.entity.js.map +1 -1
- package/dist/modules/users/services/users.service.d.ts +15 -2
- package/dist/modules/users/services/users.service.d.ts.map +1 -1
- package/dist/modules/users/services/users.service.js +152 -37
- package/dist/modules/users/services/users.service.js.map +1 -1
- package/dist/modules/users/users.module.d.ts.map +1 -1
- package/dist/modules/users/users.module.js +1 -2
- package/dist/modules/users/users.module.js.map +1 -1
- package/package.json +19 -7
- package/dist/modules/admin/entities/admin-log.entity.d.ts +0 -20
- package/dist/modules/admin/entities/admin-log.entity.d.ts.map +0 -1
- package/dist/modules/admin/entities/admin-log.entity.js +0 -65
- package/dist/modules/admin/entities/admin-log.entity.js.map +0 -1
|
@@ -15,14 +15,19 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
15
15
|
exports.DeliveryJobRunner = void 0;
|
|
16
16
|
const common_1 = require("@nestjs/common");
|
|
17
17
|
const bullmq_1 = require("bullmq");
|
|
18
|
+
const redis_module_1 = require("../../../config/redis.module");
|
|
18
19
|
const smtp_email_service_1 = require("../../jobs/email/smtp-email.service");
|
|
19
20
|
const queue_names_1 = require("../../jobs/queues/queue-names");
|
|
20
21
|
const sms_provider_interface_1 = require("../../jobs/sms/sms-provider.interface");
|
|
21
22
|
const structured_logger_service_1 = require("../../observability/logging/structured-logger.service");
|
|
22
23
|
const job_observability_runner_1 = require("../../observability/metrics/job-observability.runner");
|
|
23
24
|
const metrics_service_1 = require("../../observability/metrics/metrics.service");
|
|
25
|
+
const delivery_worker_constants_1 = require("../constants/delivery-worker.constants");
|
|
26
|
+
const notification_delivery_log_entity_1 = require("../entities/notification-delivery-log.entity");
|
|
24
27
|
const notification_audit_service_1 = require("../services/notification-audit.service");
|
|
25
28
|
const delivery_errors_util_1 = require("./delivery-errors.util");
|
|
29
|
+
const DELIVERY_RECEIPT_PREFIX = 'delivery:receipt:';
|
|
30
|
+
const DELIVERY_RECEIPT_TTL_SEC = 86_400;
|
|
26
31
|
/** Shared delivery job logic for BullMQ workers and inline sync execution. */
|
|
27
32
|
let DeliveryJobRunner = class DeliveryJobRunner {
|
|
28
33
|
smsProvider;
|
|
@@ -31,14 +36,16 @@ let DeliveryJobRunner = class DeliveryJobRunner {
|
|
|
31
36
|
logger;
|
|
32
37
|
jobRunner;
|
|
33
38
|
metrics;
|
|
39
|
+
redis;
|
|
34
40
|
fcmService;
|
|
35
|
-
constructor(smsProvider, emailService, audit, logger, jobRunner, metrics, fcmService) {
|
|
41
|
+
constructor(smsProvider, emailService, audit, logger, jobRunner, metrics, redis, fcmService) {
|
|
36
42
|
this.smsProvider = smsProvider;
|
|
37
43
|
this.emailService = emailService;
|
|
38
44
|
this.audit = audit;
|
|
39
45
|
this.logger = logger;
|
|
40
46
|
this.jobRunner = jobRunner;
|
|
41
47
|
this.metrics = metrics;
|
|
48
|
+
this.redis = redis;
|
|
42
49
|
this.fcmService = fcmService;
|
|
43
50
|
}
|
|
44
51
|
async run(job) {
|
|
@@ -63,48 +70,63 @@ let DeliveryJobRunner = class DeliveryJobRunner {
|
|
|
63
70
|
});
|
|
64
71
|
}
|
|
65
72
|
async deliverEmail(data) {
|
|
73
|
+
if (!(await this.beginDelivery(data.auditId, 'email'))) {
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
66
76
|
const start = Date.now();
|
|
67
77
|
try {
|
|
78
|
+
const { html, text } = await this.resolveEmailBody(data);
|
|
68
79
|
await this.emailService.send({
|
|
69
80
|
to: data.to,
|
|
70
81
|
subject: data.subject,
|
|
71
|
-
html
|
|
72
|
-
text
|
|
73
|
-
});
|
|
74
|
-
await this.audit.markSent(data.auditId);
|
|
75
|
-
this.metrics.recordExternalRequest('smtp', 'success', Date.now() - start);
|
|
76
|
-
this.metrics.recordNotificationDelivery('email', 'sent');
|
|
77
|
-
this.logger.info('Email delivered', {
|
|
78
|
-
event: 'delivery.email.sent',
|
|
79
|
-
metadata: { auditId: data.auditId },
|
|
82
|
+
html,
|
|
83
|
+
text,
|
|
80
84
|
});
|
|
81
85
|
}
|
|
82
86
|
catch (err) {
|
|
87
|
+
await this.releaseClaim(data.auditId);
|
|
83
88
|
this.metrics.recordExternalRequest('smtp', 'failed', Date.now() - start);
|
|
84
89
|
this.metrics.recordNotificationDelivery('email', (0, delivery_errors_util_1.isPermanentDeliveryError)(err) ? 'permanent_failure' : 'failed');
|
|
85
90
|
await (0, delivery_errors_util_1.handleEmailDeliveryError)(this.audit, data.auditId, err, this.logger);
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
await this.finalizeSuccessfulDelivery(data.auditId, 'email', start);
|
|
94
|
+
}
|
|
95
|
+
/** Prefer audit snapshot (scale); fall back to inline job fields for legacy jobs. */
|
|
96
|
+
async resolveEmailBody(data) {
|
|
97
|
+
if (data.html != null && data.html.length > 0) {
|
|
98
|
+
return { html: data.html, text: data.text };
|
|
99
|
+
}
|
|
100
|
+
const log = await this.audit.findById(data.auditId);
|
|
101
|
+
const snap = log?.payloadSnapshot;
|
|
102
|
+
if (snap?.type === 'email' && snap.html) {
|
|
103
|
+
return { html: snap.html, text: snap.text };
|
|
86
104
|
}
|
|
105
|
+
throw new bullmq_1.UnrecoverableError(`Email delivery ${data.auditId} has no HTML body in job or audit snapshot`);
|
|
87
106
|
}
|
|
88
107
|
async deliverSms(data) {
|
|
108
|
+
if (!(await this.beginDelivery(data.auditId, 'sms'))) {
|
|
109
|
+
return;
|
|
110
|
+
}
|
|
89
111
|
const start = Date.now();
|
|
90
112
|
try {
|
|
91
113
|
await this.smsProvider.send({ to: data.to, body: data.body });
|
|
92
|
-
await this.audit.markSent(data.auditId);
|
|
93
|
-
this.metrics.recordExternalRequest('sms', 'success', Date.now() - start);
|
|
94
|
-
this.metrics.recordNotificationDelivery('sms', 'sent');
|
|
95
|
-
this.logger.info('SMS delivered', {
|
|
96
|
-
event: 'delivery.sms.sent',
|
|
97
|
-
metadata: { auditId: data.auditId },
|
|
98
|
-
});
|
|
99
114
|
}
|
|
100
115
|
catch (err) {
|
|
116
|
+
await this.releaseClaim(data.auditId);
|
|
101
117
|
this.metrics.recordExternalRequest('sms', 'failed', Date.now() - start);
|
|
102
118
|
this.metrics.recordNotificationDelivery('sms', (0, delivery_errors_util_1.isPermanentDeliveryError)(err) ? 'permanent_failure' : 'failed');
|
|
103
119
|
await (0, delivery_errors_util_1.handleSmsDeliveryError)(this.audit, data.auditId, err, this.logger);
|
|
120
|
+
return;
|
|
104
121
|
}
|
|
122
|
+
await this.finalizeSuccessfulDelivery(data.auditId, 'sms', start);
|
|
105
123
|
}
|
|
106
124
|
async deliverPush(data) {
|
|
125
|
+
if (!(await this.beginDelivery(data.auditId, 'push'))) {
|
|
126
|
+
return;
|
|
127
|
+
}
|
|
107
128
|
if (!this.fcmService) {
|
|
129
|
+
await this.releaseClaim(data.auditId);
|
|
108
130
|
const message = 'FCM service unavailable';
|
|
109
131
|
this.logger.warn('Push delivery skipped — FCM unavailable', {
|
|
110
132
|
event: 'delivery.push.skipped',
|
|
@@ -115,53 +137,133 @@ let DeliveryJobRunner = class DeliveryJobRunner {
|
|
|
115
137
|
throw new bullmq_1.UnrecoverableError(message);
|
|
116
138
|
}
|
|
117
139
|
const start = Date.now();
|
|
140
|
+
let sent;
|
|
118
141
|
try {
|
|
119
|
-
|
|
142
|
+
sent = await this.fcmService.sendToUser(data.userId, {
|
|
120
143
|
title: data.title,
|
|
121
144
|
body: data.body,
|
|
122
145
|
data: data.data,
|
|
123
146
|
});
|
|
124
|
-
if (sent === 0) {
|
|
125
|
-
const message = 'No active device tokens or Firebase not configured';
|
|
126
|
-
await this.audit.markFailed(data.auditId, message, true);
|
|
127
|
-
this.metrics.recordExternalRequest('fcm', 'failed', Date.now() - start);
|
|
128
|
-
this.metrics.recordNotificationDelivery('push', 'permanent_failure');
|
|
129
|
-
this.logger.warn('Push delivery reached no devices', {
|
|
130
|
-
event: 'delivery.push.no_devices',
|
|
131
|
-
metadata: { auditId: data.auditId, userId: data.userId },
|
|
132
|
-
});
|
|
133
|
-
throw new bullmq_1.UnrecoverableError(message);
|
|
134
|
-
}
|
|
135
|
-
await this.audit.markSent(data.auditId);
|
|
136
|
-
this.metrics.recordExternalRequest('fcm', 'success', Date.now() - start);
|
|
137
|
-
this.metrics.recordNotificationDelivery('push', 'sent');
|
|
138
|
-
this.logger.info('Push delivered', {
|
|
139
|
-
event: 'delivery.push.sent',
|
|
140
|
-
metadata: { auditId: data.auditId, deviceCount: sent },
|
|
141
|
-
});
|
|
142
147
|
}
|
|
143
148
|
catch (err) {
|
|
144
|
-
|
|
145
|
-
throw err;
|
|
146
|
-
}
|
|
149
|
+
await this.releaseClaim(data.auditId);
|
|
147
150
|
const message = err instanceof Error ? err.message : 'Push delivery failed';
|
|
148
151
|
await this.audit.markFailed(data.auditId, message, false);
|
|
149
|
-
this.metrics.recordExternalRequest('fcm', 'failed', Date.now() - start);
|
|
150
152
|
this.metrics.recordNotificationDelivery('push', 'failed');
|
|
151
153
|
throw err;
|
|
152
154
|
}
|
|
155
|
+
if (sent === 0) {
|
|
156
|
+
await this.releaseClaim(data.auditId);
|
|
157
|
+
const message = 'No active device tokens or Firebase not configured';
|
|
158
|
+
await this.audit.markFailed(data.auditId, message, true);
|
|
159
|
+
this.metrics.recordNotificationDelivery('push', 'permanent_failure');
|
|
160
|
+
this.logger.warn('Push delivery reached no devices', {
|
|
161
|
+
event: 'delivery.push.no_devices',
|
|
162
|
+
metadata: { auditId: data.auditId, userId: data.userId },
|
|
163
|
+
});
|
|
164
|
+
throw new bullmq_1.UnrecoverableError(message);
|
|
165
|
+
}
|
|
166
|
+
await this.finalizeSuccessfulDelivery(data.auditId, 'push', start, { deviceCount: sent });
|
|
167
|
+
}
|
|
168
|
+
/**
|
|
169
|
+
* Returns false when delivery is already complete (caller should exit).
|
|
170
|
+
* Returns true when this worker holds the send claim and should contact the provider.
|
|
171
|
+
* Throws when another worker holds a fresh pending claim (Bull will retry).
|
|
172
|
+
*/
|
|
173
|
+
async beginDelivery(auditId, channel) {
|
|
174
|
+
if (await this.finalizeIfAlreadyDelivered(auditId, channel)) {
|
|
175
|
+
return false;
|
|
176
|
+
}
|
|
177
|
+
const key = `${DELIVERY_RECEIPT_PREFIX}${auditId}`;
|
|
178
|
+
const claimed = await this.redis.set(key, (0, delivery_worker_constants_1.encodePendingClaim)(), 'EX', DELIVERY_RECEIPT_TTL_SEC, 'NX');
|
|
179
|
+
if (claimed === 'OK') {
|
|
180
|
+
return true;
|
|
181
|
+
}
|
|
182
|
+
// Claim lost — re-check delivered / stale pending (e.g. post-stall, attemptsMade may still be 0).
|
|
183
|
+
if (await this.finalizeIfAlreadyDelivered(auditId, channel)) {
|
|
184
|
+
return false;
|
|
185
|
+
}
|
|
186
|
+
throw new Error('Delivery claim in progress');
|
|
187
|
+
}
|
|
188
|
+
/**
|
|
189
|
+
* Completes a prior successful send after crash/retry without contacting the provider again.
|
|
190
|
+
* - SENT / receipt=1 → done
|
|
191
|
+
* - stale pending (age ≥ lockDuration) → at-most-once (prior worker lost the Bull lock)
|
|
192
|
+
* Fresh pending throws via beginDelivery ("claim in progress") so in-flight sends are not skipped.
|
|
193
|
+
* Redis errors propagate (fail-closed).
|
|
194
|
+
*/
|
|
195
|
+
async finalizeIfAlreadyDelivered(auditId, channel) {
|
|
196
|
+
const log = await this.audit.findById(auditId);
|
|
197
|
+
const alreadySent = log?.status === notification_delivery_log_entity_1.NotificationDeliveryStatus.SENT;
|
|
198
|
+
if (alreadySent) {
|
|
199
|
+
this.logger.info('Delivery finalized without re-send', {
|
|
200
|
+
event: `delivery.${channel}.already_delivered`,
|
|
201
|
+
metadata: { auditId, receipt: false, alreadySent: true },
|
|
202
|
+
});
|
|
203
|
+
return true;
|
|
204
|
+
}
|
|
205
|
+
const receipt = await this.redis.get(`${DELIVERY_RECEIPT_PREFIX}${auditId}`);
|
|
206
|
+
if ((0, delivery_worker_constants_1.isDeliveredReceipt)(receipt)) {
|
|
207
|
+
await this.audit.markSent(auditId);
|
|
208
|
+
this.logger.info('Delivery finalized without re-send', {
|
|
209
|
+
event: `delivery.${channel}.already_delivered`,
|
|
210
|
+
metadata: { auditId, receipt: true, alreadySent: false },
|
|
211
|
+
});
|
|
212
|
+
return true;
|
|
213
|
+
}
|
|
214
|
+
const pendingAge = (0, delivery_worker_constants_1.pendingClaimAgeMs)(receipt);
|
|
215
|
+
if (pendingAge != null && pendingAge >= delivery_worker_constants_1.DELIVERY_PENDING_STALE_MS) {
|
|
216
|
+
await this.redis.set(`${DELIVERY_RECEIPT_PREFIX}${auditId}`, delivery_worker_constants_1.DELIVERY_RECEIPT_DELIVERED, 'EX', DELIVERY_RECEIPT_TTL_SEC);
|
|
217
|
+
await this.audit.markSent(auditId);
|
|
218
|
+
this.logger.info('Delivery finalized without re-send after stale pending claim', {
|
|
219
|
+
event: `delivery.${channel}.already_delivered`,
|
|
220
|
+
metadata: { auditId, receipt: 'pending', pendingAgeMs: pendingAge },
|
|
221
|
+
});
|
|
222
|
+
return true;
|
|
223
|
+
}
|
|
224
|
+
return false;
|
|
225
|
+
}
|
|
226
|
+
async releaseClaim(auditId) {
|
|
227
|
+
// Fail-closed: if DEL fails, propagate so we do not leave a pending claim that
|
|
228
|
+
// a later retry could age-out into a false SENT.
|
|
229
|
+
await this.redis.del(`${DELIVERY_RECEIPT_PREFIX}${auditId}`);
|
|
230
|
+
}
|
|
231
|
+
/** After provider success: durable receipt then markSent. */
|
|
232
|
+
async finalizeSuccessfulDelivery(auditId, channel, start, extra) {
|
|
233
|
+
await this.redis.set(`${DELIVERY_RECEIPT_PREFIX}${auditId}`, delivery_worker_constants_1.DELIVERY_RECEIPT_DELIVERED, 'EX', DELIVERY_RECEIPT_TTL_SEC);
|
|
234
|
+
await this.audit.markSent(auditId);
|
|
235
|
+
if (channel === 'email') {
|
|
236
|
+
this.metrics.recordExternalRequest('smtp', 'success', Date.now() - start);
|
|
237
|
+
}
|
|
238
|
+
else if (channel === 'sms') {
|
|
239
|
+
this.metrics.recordExternalRequest('sms', 'success', Date.now() - start);
|
|
240
|
+
}
|
|
241
|
+
this.metrics.recordNotificationDelivery(channel, 'sent');
|
|
242
|
+
this.logger.info(channel === 'email'
|
|
243
|
+
? 'Email delivered'
|
|
244
|
+
: channel === 'sms'
|
|
245
|
+
? 'SMS delivered'
|
|
246
|
+
: 'Push delivered', {
|
|
247
|
+
event: `delivery.${channel}.sent`,
|
|
248
|
+
metadata: {
|
|
249
|
+
auditId,
|
|
250
|
+
...(extra?.deviceCount != null && { deviceCount: extra.deviceCount }),
|
|
251
|
+
...(channel === 'push' && { durationMs: Date.now() - start }),
|
|
252
|
+
},
|
|
253
|
+
});
|
|
153
254
|
}
|
|
154
255
|
};
|
|
155
256
|
exports.DeliveryJobRunner = DeliveryJobRunner;
|
|
156
257
|
exports.DeliveryJobRunner = DeliveryJobRunner = __decorate([
|
|
157
258
|
(0, common_1.Injectable)(),
|
|
158
259
|
__param(0, (0, common_1.Inject)(sms_provider_interface_1.ISmsProvider)),
|
|
159
|
-
__param(6, (0, common_1.
|
|
260
|
+
__param(6, (0, common_1.Inject)(redis_module_1.REDIS_CLIENT)),
|
|
261
|
+
__param(7, (0, common_1.Optional)()),
|
|
160
262
|
__metadata("design:paramtypes", [sms_provider_interface_1.ISmsProvider,
|
|
161
263
|
smtp_email_service_1.SmtpEmailService,
|
|
162
264
|
notification_audit_service_1.NotificationAuditService,
|
|
163
265
|
structured_logger_service_1.StructuredLoggerService,
|
|
164
266
|
job_observability_runner_1.JobObservabilityRunner,
|
|
165
|
-
metrics_service_1.MetricsService, Object])
|
|
267
|
+
metrics_service_1.MetricsService, Function, Object])
|
|
166
268
|
], DeliveryJobRunner);
|
|
167
269
|
//# sourceMappingURL=delivery-job.runner.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"delivery-job.runner.js","sourceRoot":"","sources":["../../../../src/modules/delivery/processors/delivery-job.runner.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAA8D;AAC9D,mCAAiD;
|
|
1
|
+
{"version":3,"file":"delivery-job.runner.js","sourceRoot":"","sources":["../../../../src/modules/delivery/processors/delivery-job.runner.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAA8D;AAC9D,mCAAiD;AAGjD,+DAA4D;AAC5D,4EAAuE;AAOvE,+DAA4D;AAC5D,kFAAqE;AAErE,qGAAgG;AAChG,mGAA8F;AAC9F,iFAA6E;AAC7E,sFAMgD;AAChD,mGAA0F;AAC1F,uFAAkF;AAClF,iEAIgC;AAEhC,MAAM,uBAAuB,GAAG,mBAAmB,CAAC;AACpD,MAAM,wBAAwB,GAAG,MAAM,CAAC;AAExC,8EAA8E;AAEvE,IAAM,iBAAiB,GAAvB,MAAM,iBAAiB;IAGX;IACA;IACA;IACA;IACA;IACA;IAEA;IAEA;IAXlB,YAEkB,WAAyB,EACzB,YAA8B,EAC9B,KAA+B,EAC/B,MAA+B,EAC/B,SAAiC,EACjC,OAAuB,EAEvB,KAAc,EAEd,UAA6B;QAT7B,gBAAW,GAAX,WAAW,CAAc;QACzB,iBAAY,GAAZ,YAAY,CAAkB;QAC9B,UAAK,GAAL,KAAK,CAA0B;QAC/B,WAAM,GAAN,MAAM,CAAyB;QAC/B,cAAS,GAAT,SAAS,CAAwB;QACjC,YAAO,GAAP,OAAO,CAAgB;QAEvB,UAAK,GAAL,KAAK,CAAS;QAEd,eAAU,GAAV,UAAU,CAAmB;IAC5C,CAAC;IAEJ,KAAK,CAAC,GAAG,CAAC,GAAyB;QAClC,MAAM,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,GAAG,EAAE,yBAAW,CAAC,QAAQ,EAAE,KAAK,IAAI,EAAE;YAC9D,QAAQ,GAAG,CAAC,IAAI,EAAE,CAAC;gBAClB,KAAK,eAAe;oBACnB,MAAM,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,IAA2B,CAAC,CAAC;oB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AC,OAAO,CAAC,0BAA0B,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;QACzD,IAAI,CAAC,MAAM,CAAC,IAAI,CACf,OAAO,KAAK,OAAO;YAClB,CAAC,CAAC,iBAAiB;YACnB,CAAC,CAAC,OAAO,KAAK,KAAK;gBAClB,CAAC,CAAC,eAAe;gBACjB,CAAC,CAAC,gBAAgB,EACpB;YACC,KAAK,EAAE,YAAY,OAAO,OAAO;YACjC,QAAQ,EAAE;gBACT,OAAO;gBACP,GAAG,CAAC,KAAK,EAAE,WAAW,IAAI,IAAI,IAAI,EAAE,WAAW,EAAE,KAAK,CAAC,WAAW,EAAE,CAAC;gBACrE,GAAG,CAAC,OAAO,KAAK,MAAM,IAAI,EAAE,UAAU,EAAE,IAAI,CAAC,GAAG,EAAE,GAAG,KAAK,EAAE,CAAC;aAC7D;SACD,CACD,CAAC;IACH,CAAC;CACD,CAAA;AArRY,8CAAiB;4BAAjB,iBAAiB;IAD7B,IAAA,mBAAU,GAAE;IAGV,WAAA,IAAA,eAAM,EAAC,qCAAY,CAAC,CAAA;IAOpB,WAAA,IAAA,eAAM,EAAC,2BAAY,CAAC,CAAA;IAEpB,WAAA,IAAA,iBAAQ,GAAE,CAAA;qCARmB,qCAAY;QACX,qCAAgB;QACvB,qDAAwB;QACvB,mDAAuB;QACpB,iDAAsB;QACxB,gCAAc;GAR7B,iBAAiB,CAqR7B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"delivery.processor.d.ts","sourceRoot":"","sources":["../../../../src/modules/delivery/processors/delivery.processor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,UAAU,EAAE,MAAM,gBAAgB,CAAC;AACvD,OAAO,EAAE,GAAG,EAAE,MAAM,QAAQ,CAAC;AAE7B,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;
|
|
1
|
+
{"version":3,"file":"delivery.processor.d.ts","sourceRoot":"","sources":["../../../../src/modules/delivery/processors/delivery.processor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,UAAU,EAAE,MAAM,gBAAgB,CAAC;AACvD,OAAO,EAAE,GAAG,EAAE,MAAM,QAAQ,CAAC;AAE7B,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAMpE,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAE1D,qBAKa,iBAAkB,SAAQ,UAAU;IACpC,OAAO,CAAC,QAAQ,CAAC,MAAM;gBAAN,MAAM,EAAE,iBAAiB;IAIhD,OAAO,CAAC,GAAG,EAAE,GAAG,CAAC,eAAe,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;CAGvD"}
|
|
@@ -12,6 +12,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
12
12
|
exports.DeliveryProcessor = void 0;
|
|
13
13
|
const bullmq_1 = require("@nestjs/bullmq");
|
|
14
14
|
const queue_names_1 = require("../../jobs/queues/queue-names");
|
|
15
|
+
const delivery_worker_constants_1 = require("../constants/delivery-worker.constants");
|
|
15
16
|
const delivery_job_runner_1 = require("./delivery-job.runner");
|
|
16
17
|
let DeliveryProcessor = class DeliveryProcessor extends bullmq_1.WorkerHost {
|
|
17
18
|
runner;
|
|
@@ -25,7 +26,11 @@ let DeliveryProcessor = class DeliveryProcessor extends bullmq_1.WorkerHost {
|
|
|
25
26
|
};
|
|
26
27
|
exports.DeliveryProcessor = DeliveryProcessor;
|
|
27
28
|
exports.DeliveryProcessor = DeliveryProcessor = __decorate([
|
|
28
|
-
(0, bullmq_1.Processor)(queue_names_1.QUEUE_NAMES.DELIVERY
|
|
29
|
+
(0, bullmq_1.Processor)(queue_names_1.QUEUE_NAMES.DELIVERY, {
|
|
30
|
+
concurrency: 5,
|
|
31
|
+
lockDuration: delivery_worker_constants_1.DELIVERY_LOCK_DURATION_MS,
|
|
32
|
+
stalledInterval: delivery_worker_constants_1.DELIVERY_STALLED_INTERVAL_MS,
|
|
33
|
+
}),
|
|
29
34
|
__metadata("design:paramtypes", [delivery_job_runner_1.DeliveryJobRunner])
|
|
30
35
|
], DeliveryProcessor);
|
|
31
36
|
//# sourceMappingURL=delivery.processor.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"delivery.processor.js","sourceRoot":"","sources":["../../../../src/modules/delivery/processors/delivery.processor.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAAuD;AAIvD,+DAA4D;AAC5D,+DAA0D;
|
|
1
|
+
{"version":3,"file":"delivery.processor.js","sourceRoot":"","sources":["../../../../src/modules/delivery/processors/delivery.processor.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAAuD;AAIvD,+DAA4D;AAC5D,sFAGgD;AAChD,+DAA0D;AAOnD,IAAM,iBAAiB,GAAvB,MAAM,iBAAkB,SAAQ,mBAAU;IACnB;IAA7B,YAA6B,MAAyB;QACrD,KAAK,EAAE,CAAC;QADoB,WAAM,GAAN,MAAM,CAAmB;IAEtD,CAAC;IAED,KAAK,CAAC,OAAO,CAAC,GAAyB;QACtC,MAAM,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IAC5B,CAAC;CACD,CAAA;AARY,8CAAiB;4BAAjB,iBAAiB;IAL7B,IAAA,kBAAS,EAAC,yBAAW,CAAC,QAAQ,EAAE;QAChC,WAAW,EAAE,CAAC;QACd,YAAY,EAAE,qDAAyB;QACvC,eAAe,EAAE,wDAA4B;KAC7C,CAAC;qCAEoC,uCAAiB;GAD1C,iBAAiB,CAQ7B"}
|
|
@@ -20,5 +20,16 @@ export declare class OtpDeliveryJobRunner {
|
|
|
20
20
|
run(job: Job<OtpDeliveryJobData>): Promise<void>;
|
|
21
21
|
private deliverOtpSms;
|
|
22
22
|
private deliverOtpEmail;
|
|
23
|
+
private beginOtpDelivery;
|
|
24
|
+
/**
|
|
25
|
+
* Completes a prior successful send after crash/retry without contacting the provider again.
|
|
26
|
+
* Stale pending (age ≥ lockDuration) is at-most-once — works even when Bull stall keeps attemptsMade at 0.
|
|
27
|
+
*/
|
|
28
|
+
private finalizeIfAlreadyDelivered;
|
|
29
|
+
/**
|
|
30
|
+
* After provider success: durable receipt, consume code, then markSent.
|
|
31
|
+
* Separated from the provider try so Redis finalize errors do not look like send failures.
|
|
32
|
+
*/
|
|
33
|
+
private finalizeSuccessfulOtpDelivery;
|
|
23
34
|
}
|
|
24
35
|
//# sourceMappingURL=otp-delivery-job.runner.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"otp-delivery-job.runner.d.ts","sourceRoot":"","sources":["../../../../src/modules/delivery/processors/otp-delivery-job.runner.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,GAAG,EAAsB,MAAM,QAAQ,CAAC;AAEjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,qCAAqC,CAAC;AACvE,OAAO,KAAK,EACX,kBAAkB,EAGlB,MAAM,8BAA8B,CAAC;AAEtC,OAAO,EAAE,YAAY,EAAE,MAAM,uCAAuC,CAAC;AACrE,OAAO,EAAE,uBAAuB,EAAE,MAAM,uDAAuD,CAAC;AAChG,OAAO,EAAE,sBAAsB,EAAE,MAAM,sDAAsD,CAAC;AAC9F,OAAO,EAAE,cAAc,EAAE,MAAM,6CAA6C,CAAC;AAC7E,OAAO,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;
|
|
1
|
+
{"version":3,"file":"otp-delivery-job.runner.d.ts","sourceRoot":"","sources":["../../../../src/modules/delivery/processors/otp-delivery-job.runner.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,GAAG,EAAsB,MAAM,QAAQ,CAAC;AAEjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,qCAAqC,CAAC;AACvE,OAAO,KAAK,EACX,kBAAkB,EAGlB,MAAM,8BAA8B,CAAC;AAEtC,OAAO,EAAE,YAAY,EAAE,MAAM,uCAAuC,CAAC;AACrE,OAAO,EAAE,uBAAuB,EAAE,MAAM,uDAAuD,CAAC;AAChG,OAAO,EAAE,sBAAsB,EAAE,MAAM,sDAAsD,CAAC;AAC9F,OAAO,EAAE,cAAc,EAAE,MAAM,6CAA6C,CAAC;AAC7E,OAAO,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;AAGzE,OAAO,EAAE,wBAAwB,EAAE,MAAM,wCAAwC,CAAC;AAOlF,kFAAkF;AAClF,qBACa,oBAAoB;IAG/B,OAAO,CAAC,QAAQ,CAAC,WAAW;IAC5B,OAAO,CAAC,QAAQ,CAAC,YAAY;IAC7B,OAAO,CAAC,QAAQ,CAAC,WAAW;IAC5B,OAAO,CAAC,QAAQ,CAAC,KAAK;IACtB,OAAO,CAAC,QAAQ,CAAC,MAAM;IACvB,OAAO,CAAC,QAAQ,CAAC,SAAS;IAC1B,OAAO,CAAC,QAAQ,CAAC,OAAO;gBANP,WAAW,EAAE,YAAY,EACzB,YAAY,EAAE,gBAAgB,EAC9B,WAAW,EAAE,mBAAmB,EAChC,KAAK,EAAE,wBAAwB,EAC/B,MAAM,EAAE,uBAAuB,EAC/B,SAAS,EAAE,sBAAsB,EACjC,OAAO,EAAE,cAAc;IAGnC,GAAG,CAAC,GAAG,EAAE,GAAG,CAAC,kBAAkB,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;YAmBxC,aAAa;YAqCb,eAAe;YA0Cf,gBAAgB;IAqB9B;;;OAGG;YACW,0BAA0B;IAmDxC;;;OAGG;YACW,6BAA6B;CAoB3C"}
|
|
@@ -22,6 +22,8 @@ const structured_logger_service_1 = require("../../observability/logging/structu
|
|
|
22
22
|
const job_observability_runner_1 = require("../../observability/metrics/job-observability.runner");
|
|
23
23
|
const metrics_service_1 = require("../../observability/metrics/metrics.service");
|
|
24
24
|
const otp_delivery_composer_1 = require("../composers/otp-delivery.composer");
|
|
25
|
+
const delivery_worker_constants_1 = require("../constants/delivery-worker.constants");
|
|
26
|
+
const notification_delivery_log_entity_1 = require("../entities/notification-delivery-log.entity");
|
|
25
27
|
const notification_audit_service_1 = require("../services/notification-audit.service");
|
|
26
28
|
const delivery_errors_util_1 = require("./delivery-errors.util");
|
|
27
29
|
/** Shared OTP delivery job logic for BullMQ workers and inline sync execution. */
|
|
@@ -61,8 +63,12 @@ let OtpDeliveryJobRunner = class OtpDeliveryJobRunner {
|
|
|
61
63
|
});
|
|
62
64
|
}
|
|
63
65
|
async deliverOtpSms(data) {
|
|
64
|
-
|
|
66
|
+
if (!(await this.beginOtpDelivery(data.auditId, data.correlationId, 'sms'))) {
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
const code = await this.otpComposer.peekCorrelationCode(data.correlationId);
|
|
65
70
|
if (!code) {
|
|
71
|
+
await this.otpComposer.releaseClaim(data.correlationId);
|
|
66
72
|
const message = 'OTP correlation key expired. The user should request a new OTP.';
|
|
67
73
|
await this.audit.markFailed(data.auditId, message, true);
|
|
68
74
|
this.metrics.recordNotificationDelivery('sms', 'permanent_failure');
|
|
@@ -76,23 +82,23 @@ let OtpDeliveryJobRunner = class OtpDeliveryJobRunner {
|
|
|
76
82
|
const start = Date.now();
|
|
77
83
|
try {
|
|
78
84
|
await this.smsProvider.send({ to: data.to, body });
|
|
79
|
-
await this.audit.markSent(data.auditId);
|
|
80
|
-
this.metrics.recordExternalRequest('sms', 'success', Date.now() - start);
|
|
81
|
-
this.metrics.recordNotificationDelivery('sms', 'sent');
|
|
82
|
-
this.logger.info('OTP SMS delivered', {
|
|
83
|
-
event: 'delivery.otp_sms.sent',
|
|
84
|
-
metadata: { auditId: data.auditId },
|
|
85
|
-
});
|
|
86
85
|
}
|
|
87
86
|
catch (err) {
|
|
87
|
+
await this.otpComposer.releaseClaim(data.correlationId);
|
|
88
88
|
this.metrics.recordExternalRequest('sms', 'failed', Date.now() - start);
|
|
89
89
|
this.metrics.recordNotificationDelivery('sms', (0, delivery_errors_util_1.isPermanentDeliveryError)(err) ? 'permanent_failure' : 'failed');
|
|
90
90
|
await (0, delivery_errors_util_1.handleSmsDeliveryError)(this.audit, data.auditId, err, this.logger);
|
|
91
|
+
return;
|
|
91
92
|
}
|
|
93
|
+
await this.finalizeSuccessfulOtpDelivery(data.auditId, data.correlationId, 'sms', start);
|
|
92
94
|
}
|
|
93
95
|
async deliverOtpEmail(data) {
|
|
94
|
-
|
|
96
|
+
if (!(await this.beginOtpDelivery(data.auditId, data.correlationId, 'email'))) {
|
|
97
|
+
return;
|
|
98
|
+
}
|
|
99
|
+
const code = await this.otpComposer.peekCorrelationCode(data.correlationId);
|
|
95
100
|
if (!code) {
|
|
101
|
+
await this.otpComposer.releaseClaim(data.correlationId);
|
|
96
102
|
const message = 'OTP correlation key expired. The user should request a new OTP.';
|
|
97
103
|
await this.audit.markFailed(data.auditId, message, true);
|
|
98
104
|
this.metrics.recordNotificationDelivery('email', 'permanent_failure');
|
|
@@ -111,19 +117,87 @@ let OtpDeliveryJobRunner = class OtpDeliveryJobRunner {
|
|
|
111
117
|
html: composed.html,
|
|
112
118
|
text: composed.text,
|
|
113
119
|
});
|
|
114
|
-
await this.audit.markSent(data.auditId);
|
|
115
|
-
this.metrics.recordExternalRequest('smtp', 'success', Date.now() - start);
|
|
116
|
-
this.metrics.recordNotificationDelivery('email', 'sent');
|
|
117
|
-
this.logger.info('OTP email delivered', {
|
|
118
|
-
event: 'delivery.otp_email.sent',
|
|
119
|
-
metadata: { auditId: data.auditId },
|
|
120
|
-
});
|
|
121
120
|
}
|
|
122
121
|
catch (err) {
|
|
122
|
+
await this.otpComposer.releaseClaim(data.correlationId);
|
|
123
123
|
this.metrics.recordExternalRequest('smtp', 'failed', Date.now() - start);
|
|
124
124
|
this.metrics.recordNotificationDelivery('email', (0, delivery_errors_util_1.isPermanentDeliveryError)(err) ? 'permanent_failure' : 'failed');
|
|
125
125
|
await (0, delivery_errors_util_1.handleEmailDeliveryError)(this.audit, data.auditId, err, this.logger);
|
|
126
|
+
return;
|
|
127
|
+
}
|
|
128
|
+
await this.finalizeSuccessfulOtpDelivery(data.auditId, data.correlationId, 'email', start);
|
|
129
|
+
}
|
|
130
|
+
async beginOtpDelivery(auditId, correlationId, channel) {
|
|
131
|
+
if (await this.finalizeIfAlreadyDelivered(auditId, correlationId, channel)) {
|
|
132
|
+
return false;
|
|
133
|
+
}
|
|
134
|
+
const claimed = await this.otpComposer.claimForSend(correlationId);
|
|
135
|
+
if (claimed) {
|
|
136
|
+
return true;
|
|
137
|
+
}
|
|
138
|
+
if (await this.finalizeIfAlreadyDelivered(auditId, correlationId, channel)) {
|
|
139
|
+
return false;
|
|
126
140
|
}
|
|
141
|
+
throw new Error('OTP delivery claim in progress');
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* Completes a prior successful send after crash/retry without contacting the provider again.
|
|
145
|
+
* Stale pending (age ≥ lockDuration) is at-most-once — works even when Bull stall keeps attemptsMade at 0.
|
|
146
|
+
*/
|
|
147
|
+
async finalizeIfAlreadyDelivered(auditId, correlationId, channel) {
|
|
148
|
+
const log = await this.audit.findById(auditId);
|
|
149
|
+
const alreadySent = log?.status === notification_delivery_log_entity_1.NotificationDeliveryStatus.SENT;
|
|
150
|
+
if (alreadySent) {
|
|
151
|
+
await this.otpComposer.consumeCorrelationCode(correlationId);
|
|
152
|
+
this.logger.info('OTP delivery finalized without re-send', {
|
|
153
|
+
event: channel === 'sms'
|
|
154
|
+
? 'delivery.otp_sms.already_delivered'
|
|
155
|
+
: 'delivery.otp_email.already_delivered',
|
|
156
|
+
metadata: { auditId, correlationId, receipt: false, alreadySent: true },
|
|
157
|
+
});
|
|
158
|
+
return true;
|
|
159
|
+
}
|
|
160
|
+
// Fail-closed: Redis errors propagate so we do not risk a duplicate send.
|
|
161
|
+
if (await this.otpComposer.wasDelivered(correlationId)) {
|
|
162
|
+
await this.otpComposer.consumeCorrelationCode(correlationId);
|
|
163
|
+
await this.audit.markSent(auditId);
|
|
164
|
+
this.logger.info('OTP delivery finalized without re-send', {
|
|
165
|
+
event: channel === 'sms'
|
|
166
|
+
? 'delivery.otp_sms.already_delivered'
|
|
167
|
+
: 'delivery.otp_email.already_delivered',
|
|
168
|
+
metadata: { auditId, correlationId, receipt: true, alreadySent: false },
|
|
169
|
+
});
|
|
170
|
+
return true;
|
|
171
|
+
}
|
|
172
|
+
const pendingAge = await this.otpComposer.pendingClaimAgeMs(correlationId);
|
|
173
|
+
if (pendingAge != null && pendingAge >= delivery_worker_constants_1.DELIVERY_PENDING_STALE_MS) {
|
|
174
|
+
await this.otpComposer.markDelivered(correlationId);
|
|
175
|
+
await this.otpComposer.consumeCorrelationCode(correlationId);
|
|
176
|
+
await this.audit.markSent(auditId);
|
|
177
|
+
this.logger.info('OTP delivery finalized without re-send after stale pending claim', {
|
|
178
|
+
event: channel === 'sms'
|
|
179
|
+
? 'delivery.otp_sms.already_delivered'
|
|
180
|
+
: 'delivery.otp_email.already_delivered',
|
|
181
|
+
metadata: { auditId, correlationId, receipt: 'pending', pendingAgeMs: pendingAge },
|
|
182
|
+
});
|
|
183
|
+
return true;
|
|
184
|
+
}
|
|
185
|
+
return false;
|
|
186
|
+
}
|
|
187
|
+
/**
|
|
188
|
+
* After provider success: durable receipt, consume code, then markSent.
|
|
189
|
+
* Separated from the provider try so Redis finalize errors do not look like send failures.
|
|
190
|
+
*/
|
|
191
|
+
async finalizeSuccessfulOtpDelivery(auditId, correlationId, channel, start) {
|
|
192
|
+
await this.otpComposer.markDelivered(correlationId);
|
|
193
|
+
await this.otpComposer.consumeCorrelationCode(correlationId);
|
|
194
|
+
await this.audit.markSent(auditId);
|
|
195
|
+
this.metrics.recordExternalRequest(channel === 'sms' ? 'sms' : 'smtp', 'success', Date.now() - start);
|
|
196
|
+
this.metrics.recordNotificationDelivery(channel, 'sent');
|
|
197
|
+
this.logger.info(channel === 'sms' ? 'OTP SMS delivered' : 'OTP email delivered', {
|
|
198
|
+
event: channel === 'sms' ? 'delivery.otp_sms.sent' : 'delivery.otp_email.sent',
|
|
199
|
+
metadata: { auditId },
|
|
200
|
+
});
|
|
127
201
|
}
|
|
128
202
|
};
|
|
129
203
|
exports.OtpDeliveryJobRunner = OtpDeliveryJobRunner;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"otp-delivery-job.runner.js","sourceRoot":"","sources":["../../../../src/modules/delivery/processors/otp-delivery-job.runner.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAAoD;AACpD,mCAAiD;AAEjD,4EAAuE;AAMvE,+DAA4D;AAC5D,kFAAqE;AACrE,qGAAgG;AAChG,mGAA8F;AAC9F,iFAA6E;AAC7E,8EAAyE;AACzE,uFAAkF;AAClF,iEAIgC;AAEhC,kFAAkF;AAE3E,IAAM,oBAAoB,GAA1B,MAAM,oBAAoB;IAGd;IACA;IACA;IACA;IACA;IACA;IACA;IARlB,YAEkB,WAAyB,EACzB,YAA8B,EAC9B,WAAgC,EAChC,KAA+B,EAC/B,MAA+B,EAC/B,SAAiC,EACjC,OAAuB;QANvB,gBAAW,GAAX,WAAW,CAAc;QACzB,iBAAY,GAAZ,YAAY,CAAkB;QAC9B,gBAAW,GAAX,WAAW,CAAqB;QAChC,UAAK,GAAL,KAAK,CAA0B;QAC/B,WAAM,GAAN,MAAM,CAAyB;QAC/B,cAAS,GAAT,SAAS,CAAwB;QACjC,YAAO,GAAP,OAAO,CAAgB;IACtC,CAAC;IAEJ,KAAK,CAAC,GAAG,CAAC,GAA4B;QACrC,MAAM,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,GAAG,EAAE,yBAAW,CAAC,YAAY,EAAE,KAAK,IAAI,EAAE;YAClE,QAAQ,GAAG,CAAC,IAAI,EAAE,CAAC;gBAClB,KAAK,SAAS;oBACb,MAAM,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;oBACnC,MAAM;gBACP,KAAK,WAAW;oBACf,MAAM,IAAI,CAAC,eAAe,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;oBACrC,MAAM;gBACP;oBACC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,0BAA0B,EAAE;wBAC5C,KAAK,EAAE,aAAa;wBACpB,QAAQ,EAAE,EAAE,OAAO,EAAE,GAAG,CAAC,IAAI,EAAE,KAAK,EAAE,yBAAW,CAAC,YAAY,EAAE;qBAChE,CAAC,CAAC;oBACH,MAAM,IAAI,2BAAkB,CAAC,6BAA6B,GAAG,CAAC,IAAI,EAAE,CAAC,CAAC;YACxE,CAAC;QACF,CAAC,CAAC,CAAC;IACJ,CAAC;IAEO,KAAK,CAAC,aAAa,CAAC,IAA2B;QACtD,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,WAAW,CAAC,
|
|
1
|
+
{"version":3,"file":"otp-delivery-job.runner.js","sourceRoot":"","sources":["../../../../src/modules/delivery/processors/otp-delivery-job.runner.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAAoD;AACpD,mCAAiD;AAEjD,4EAAuE;AAMvE,+DAA4D;AAC5D,kFAAqE;AACrE,qGAAgG;AAChG,mGAA8F;AAC9F,iFAA6E;AAC7E,8EAAyE;AACzE,sFAAmF;AACnF,mGAA0F;AAC1F,uFAAkF;AAClF,iEAIgC;AAEhC,kFAAkF;AAE3E,IAAM,oBAAoB,GAA1B,MAAM,oBAAoB;IAGd;IACA;IACA;IACA;IACA;IACA;IACA;IARlB,YAEkB,WAAyB,EACzB,YAA8B,EAC9B,WAAgC,EAChC,KAA+B,EAC/B,MAA+B,EAC/B,SAAiC,EACjC,OAAuB;QANvB,gBAAW,GAAX,WAAW,CAAc;QACzB,iBAAY,GAAZ,YAAY,CAAkB;QAC9B,gBAAW,GAAX,WAAW,CAAqB;QAChC,UAAK,GAAL,KAAK,CAA0B;QAC/B,WAAM,GAAN,MAAM,CAAyB;QAC/B,cAAS,GAAT,SAAS,CAAwB;QACjC,YAAO,GAAP,OAAO,CAAgB;IACtC,CAAC;IAEJ,KAAK,CAAC,GAAG,CAAC,GAA4B;QACrC,MAAM,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,GAAG,EAAE,yBAAW,CAAC,YAAY,EAA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AAK,KAAK,CAAC,CAAC,CAAC,uBAAuB,CAAC,CAAC,CAAC,yBAAyB;YAC9E,QAAQ,EAAE,EAAE,OAAO,EAAE;SACrB,CAAC,CAAC;IACJ,CAAC;CACD,CAAA;AAlNY,oDAAoB;+BAApB,oBAAoB;IADhC,IAAA,mBAAU,GAAE;IAGV,WAAA,IAAA,eAAM,EAAC,qCAAY,CAAC,CAAA;qCACS,qCAAY;QACX,qCAAgB;QACjB,2CAAmB;QACzB,qDAAwB;QACvB,mDAAuB;QACpB,iDAAsB;QACxB,gCAAc;GAT7B,oBAAoB,CAkNhC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"otp-delivery.processor.d.ts","sourceRoot":"","sources":["../../../../src/modules/delivery/processors/otp-delivery.processor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,UAAU,EAAE,MAAM,gBAAgB,CAAC;AACvD,OAAO,EAAE,GAAG,EAAE,MAAM,QAAQ,CAAC;AAE7B,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;
|
|
1
|
+
{"version":3,"file":"otp-delivery.processor.d.ts","sourceRoot":"","sources":["../../../../src/modules/delivery/processors/otp-delivery.processor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,UAAU,EAAE,MAAM,gBAAgB,CAAC;AACvD,OAAO,EAAE,GAAG,EAAE,MAAM,QAAQ,CAAC;AAE7B,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AAMvE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AAEjE,qBAKa,oBAAqB,SAAQ,UAAU;IACvC,OAAO,CAAC,QAAQ,CAAC,MAAM;gBAAN,MAAM,EAAE,oBAAoB;IAInD,OAAO,CAAC,GAAG,EAAE,GAAG,CAAC,kBAAkB,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;CAG1D"}
|
|
@@ -12,6 +12,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
12
12
|
exports.OtpDeliveryProcessor = void 0;
|
|
13
13
|
const bullmq_1 = require("@nestjs/bullmq");
|
|
14
14
|
const queue_names_1 = require("../../jobs/queues/queue-names");
|
|
15
|
+
const delivery_worker_constants_1 = require("../constants/delivery-worker.constants");
|
|
15
16
|
const otp_delivery_job_runner_1 = require("./otp-delivery-job.runner");
|
|
16
17
|
let OtpDeliveryProcessor = class OtpDeliveryProcessor extends bullmq_1.WorkerHost {
|
|
17
18
|
runner;
|
|
@@ -25,7 +26,11 @@ let OtpDeliveryProcessor = class OtpDeliveryProcessor extends bullmq_1.WorkerHos
|
|
|
25
26
|
};
|
|
26
27
|
exports.OtpDeliveryProcessor = OtpDeliveryProcessor;
|
|
27
28
|
exports.OtpDeliveryProcessor = OtpDeliveryProcessor = __decorate([
|
|
28
|
-
(0, bullmq_1.Processor)(queue_names_1.QUEUE_NAMES.OTP_DELIVERY
|
|
29
|
+
(0, bullmq_1.Processor)(queue_names_1.QUEUE_NAMES.OTP_DELIVERY, {
|
|
30
|
+
concurrency: 5,
|
|
31
|
+
lockDuration: delivery_worker_constants_1.DELIVERY_LOCK_DURATION_MS,
|
|
32
|
+
stalledInterval: delivery_worker_constants_1.DELIVERY_STALLED_INTERVAL_MS,
|
|
33
|
+
}),
|
|
29
34
|
__metadata("design:paramtypes", [otp_delivery_job_runner_1.OtpDeliveryJobRunner])
|
|
30
35
|
], OtpDeliveryProcessor);
|
|
31
36
|
//# sourceMappingURL=otp-delivery.processor.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"otp-delivery.processor.js","sourceRoot":"","sources":["../../../../src/modules/delivery/processors/otp-delivery.processor.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAAuD;AAIvD,+DAA4D;AAC5D,uEAAiE;
|
|
1
|
+
{"version":3,"file":"otp-delivery.processor.js","sourceRoot":"","sources":["../../../../src/modules/delivery/processors/otp-delivery.processor.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAAuD;AAIvD,+DAA4D;AAC5D,sFAGgD;AAChD,uEAAiE;AAO1D,IAAM,oBAAoB,GAA1B,MAAM,oBAAqB,SAAQ,mBAAU;IACtB;IAA7B,YAA6B,MAA4B;QACxD,KAAK,EAAE,CAAC;QADoB,WAAM,GAAN,MAAM,CAAsB;IAEzD,CAAC;IAED,KAAK,CAAC,OAAO,CAAC,GAA4B;QACzC,MAAM,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IAC5B,CAAC;CACD,CAAA;AARY,oDAAoB;+BAApB,oBAAoB;IALhC,IAAA,kBAAS,EAAC,yBAAW,CAAC,YAAY,EAAE;QACpC,WAAW,EAAE,CAAC;QACd,YAAY,EAAE,qDAAyB;QACvC,eAAe,EAAE,wDAA4B;KAC7C,CAAC;qCAEoC,8CAAoB;GAD7C,oBAAoB,CAQhC"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { OnModuleInit } from '@nestjs/common';
|
|
1
2
|
import type { DeliverEmailJobData, DeliverPushJobData, DeliverSmsJobData, JobsQueue, OtpEmailDeliveryJobData, OtpSmsDeliveryJobData } from '../../jobs/queues/jobs.queue';
|
|
2
3
|
import { ObservabilityContextStore } from '../../observability/context/observability-context.store';
|
|
3
4
|
import { DeliveryJobRunner } from '../processors/delivery-job.runner';
|
|
@@ -5,12 +6,17 @@ import { OtpDeliveryJobRunner } from '../processors/otp-delivery-job.runner';
|
|
|
5
6
|
/**
|
|
6
7
|
* Runs delivery jobs inline when BullMQ is unavailable (REDIS_ENABLED=false).
|
|
7
8
|
* Preserves the same JobsQueue API so NotificationDeliveryService stays unchanged.
|
|
9
|
+
*
|
|
10
|
+
* Dev-only: awaited enqueue blocks the HTTP request on SMTP/SMS/FCM.
|
|
11
|
+
* Production must set REDIS_ENABLED=true.
|
|
8
12
|
*/
|
|
9
|
-
export declare class SyncJobsQueue implements Pick<JobsQueue, 'addDeliverEmail' | 'addDeliverSms' | 'addDeliverPush' | 'addOtpSmsDelivery' | 'addOtpEmailDelivery'
|
|
13
|
+
export declare class SyncJobsQueue implements Pick<JobsQueue, 'addDeliverEmail' | 'addDeliverSms' | 'addDeliverPush' | 'addOtpSmsDelivery' | 'addOtpEmailDelivery'>, OnModuleInit {
|
|
10
14
|
private readonly deliveryRunner;
|
|
11
15
|
private readonly otpRunner;
|
|
12
16
|
private readonly contextStore;
|
|
17
|
+
private readonly nestLogger;
|
|
13
18
|
constructor(deliveryRunner: DeliveryJobRunner, otpRunner: OtpDeliveryJobRunner, contextStore: ObservabilityContextStore | null);
|
|
19
|
+
onModuleInit(): void;
|
|
14
20
|
addDeliverEmail(data: DeliverEmailJobData): Promise<string | undefined>;
|
|
15
21
|
addDeliverSms(data: DeliverSmsJobData): Promise<string | undefined>;
|
|
16
22
|
addDeliverPush(data: DeliverPushJobData): Promise<string | undefined>;
|