@colveor/core 1.1.0 → 1.2.1
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 +24 -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/1784284557959-full-schema.d.ts.map +1 -1
- package/dist/database/migrations/1784284557959-full-schema.js +48 -14
- package/dist/database/migrations/1784284557959-full-schema.js.map +1 -1
- package/dist/database/migrations/1784284557960-audit-partitioning.d.ts +17 -0
- package/dist/database/migrations/1784284557960-audit-partitioning.d.ts.map +1 -0
- package/dist/database/migrations/1784284557960-audit-partitioning.js +384 -0
- package/dist/database/migrations/1784284557960-audit-partitioning.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 +3 -0
- package/dist/modules/users/dto/user.dto.d.ts.map +1 -1
- package/dist/modules/users/dto/user.dto.js +27 -4
- 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
|
@@ -17,6 +17,8 @@ const common_1 = require("@nestjs/common");
|
|
|
17
17
|
const decorators_1 = require("../../../common/decorators");
|
|
18
18
|
const auth_guard_1 = require("../../../common/guards/auth.guard");
|
|
19
19
|
const permissions_guard_1 = require("../../../common/guards/permissions.guard");
|
|
20
|
+
const audit_actions_1 = require("../../audit/constants/audit-actions");
|
|
21
|
+
const audit_service_1 = require("../../audit/services/audit.service");
|
|
20
22
|
const dto_1 = require("../dto");
|
|
21
23
|
const notifications_manifest_1 = require("../notifications.manifest");
|
|
22
24
|
const fcm_service_1 = require("../services/fcm.service");
|
|
@@ -24,15 +26,28 @@ const notifications_service_1 = require("../services/notifications.service");
|
|
|
24
26
|
let NotificationsController = class NotificationsController {
|
|
25
27
|
fcmService;
|
|
26
28
|
notificationsService;
|
|
27
|
-
|
|
29
|
+
audit;
|
|
30
|
+
constructor(fcmService, notificationsService, audit) {
|
|
28
31
|
this.fcmService = fcmService;
|
|
29
32
|
this.notificationsService = notificationsService;
|
|
33
|
+
this.audit = audit;
|
|
30
34
|
}
|
|
31
35
|
/**
|
|
32
36
|
* Register device for push notifications
|
|
33
37
|
*/
|
|
34
38
|
async registerDevice(user, dto) {
|
|
35
39
|
const device = await this.fcmService.registerDeviceToken(user.id, dto.fcmToken, dto.deviceType, dto.deviceName);
|
|
40
|
+
this.audit.record({
|
|
41
|
+
action: audit_actions_1.AUDIT_ACTIONS.DEVICE_REGISTERED,
|
|
42
|
+
actorType: 'USER',
|
|
43
|
+
actorId: user.id,
|
|
44
|
+
resourceType: 'device_token',
|
|
45
|
+
resourceId: device.id,
|
|
46
|
+
metadata: {
|
|
47
|
+
deviceType: dto.deviceType,
|
|
48
|
+
hasDeviceName: Boolean(dto.deviceName),
|
|
49
|
+
},
|
|
50
|
+
});
|
|
36
51
|
return {
|
|
37
52
|
message: 'Device registered successfully',
|
|
38
53
|
deviceId: device.id,
|
|
@@ -43,6 +58,13 @@ let NotificationsController = class NotificationsController {
|
|
|
43
58
|
*/
|
|
44
59
|
async removeDevice(user, dto) {
|
|
45
60
|
await this.fcmService.removeDeviceTokenForUser(user.id, dto.fcmToken);
|
|
61
|
+
this.audit.record({
|
|
62
|
+
action: audit_actions_1.AUDIT_ACTIONS.DEVICE_REMOVED,
|
|
63
|
+
actorType: 'USER',
|
|
64
|
+
actorId: user.id,
|
|
65
|
+
resourceType: 'user',
|
|
66
|
+
resourceId: user.id,
|
|
67
|
+
});
|
|
46
68
|
return { message: 'Device removed successfully' };
|
|
47
69
|
}
|
|
48
70
|
/**
|
|
@@ -174,6 +196,7 @@ exports.NotificationsController = NotificationsController = __decorate([
|
|
|
174
196
|
(0, common_1.Controller)('notifications'),
|
|
175
197
|
(0, common_1.UseGuards)(auth_guard_1.JwtAuthGuard, permissions_guard_1.PermissionsGuard),
|
|
176
198
|
__metadata("design:paramtypes", [fcm_service_1.FcmService,
|
|
177
|
-
notifications_service_1.NotificationsService
|
|
199
|
+
notifications_service_1.NotificationsService,
|
|
200
|
+
audit_service_1.AuditService])
|
|
178
201
|
], NotificationsController);
|
|
179
202
|
//# sourceMappingURL=notifications.controller.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"notifications.controller.js","sourceRoot":"","sources":["../../../../src/modules/notifications/controllers/notifications.controller.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAYwB;AAExB,2DAA4E;AAC5E,kEAAiE;AACjE,gFAA4E;AAE5E,gCAAkF;AAClF,sEAAsE;AACtE,yDAAqD;AACrD,6EAAyE;AAIlE,IAAM,uBAAuB,GAA7B,MAAM,uBAAuB;IAEjB;IACA;
|
|
1
|
+
{"version":3,"file":"notifications.controller.js","sourceRoot":"","sources":["../../../../src/modules/notifications/controllers/notifications.controller.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAYwB;AAExB,2DAA4E;AAC5E,kEAAiE;AACjE,gFAA4E;AAE5E,uEAAoE;AACpE,sEAAkE;AAClE,gCAAkF;AAClF,sEAAsE;AACtE,yDAAqD;AACrD,6EAAyE;AAIlE,IAAM,uBAAuB,GAA7B,MAAM,uBAAuB;IAEjB;IACA;IACA;IAHlB,YACkB,UAAsB,EACtB,oBAA0C,EAC1C,KAAmB;QAFnB,eAAU,GAAV,UAAU,CAAY;QACtB,yBAAoB,GAApB,oBAAoB,CAAsB;QAC1C,UAAK,GAAL,KAAK,CAAc;IAClC,CAAC;IAEJ;;OAE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CAAC,EAAE,CAAC;IACvB,IAAA,8BAAiB,EAAC,kDAAyB,CAAC,IAAI,CAAC;IAChC,WAAA,IAAA,wBAAW,GAAE,CAAA;IAAqB,WAAA,IAAA,cAAK,EAAC,IAAI,CAAC,CAAA;;;;yDAG9D;AAQK;IAHL,IAAA,cAAK,EAAC,UAAU,CAAC;IACjB,IAAA,iBAAQ,EAAC,mBAAU,CAAC,EAAE,CAAC;IACvB,IAAA,8BAAiB,EAAC,kDAAyB,CAAC,IAAI,CAAC;IAC7B,WAAA,IAAA,wBAAW,GAAE,CAAA;;;;4DAGjC;AAQK;IAHL,IAAA,eAAM,EAAC,KAAK,CAAC;IACb,IAAA,iBAAQ,EAAC,mBAAU,CAAC,EAAE,CAAC;IACvB,IAAA,8BAAiB,EAAC,kDAAyB,CAAC,IAAI,CAAC;IACxB,WAAA,IAAA,wBAAW,GAAE,CAAA;IAAqB,WAAA,IAAA,cAAK,EAAC,IAAI,CAAC,CAAA;;;;iEAGtE;kCA9HW,uBAAuB;IAFnC,IAAA,mBAAU,EAAC,eAAe,CAAC;IAC3B,IAAA,kBAAS,EAAC,yBAAY,EAAE,oCAAgB,CAAC;qCAGX,wBAAU;QACA,4CAAoB;QACnC,4BAAY;GAJzB,uBAAuB,CA+HnC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"notification-query.dto.d.ts","sourceRoot":"","sources":["../../../../src/modules/notifications/dto/notification-query.dto.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AAEnE,qBAAa,oBAAoB;IAKhC,IAAI,CAAC,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"notification-query.dto.d.ts","sourceRoot":"","sources":["../../../../src/modules/notifications/dto/notification-query.dto.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AAEnE,qBAAa,oBAAoB;IAKhC,IAAI,CAAC,EAAE,MAAM,CAAC;IAOd,KAAK,CAAC,EAAE,MAAM,CAAC;IAKf,MAAM,CAAC,EAAE,OAAO,CAAC;IAIjB,IAAI,CAAC,EAAE,gBAAgB,CAAC;CACxB"}
|
|
@@ -32,6 +32,7 @@ __decorate([
|
|
|
32
32
|
(0, class_transformer_1.Type)(() => Number),
|
|
33
33
|
(0, class_validator_1.IsInt)(),
|
|
34
34
|
(0, class_validator_1.Min)(1),
|
|
35
|
+
(0, class_validator_1.Max)(100),
|
|
35
36
|
__metadata("design:type", Number)
|
|
36
37
|
], NotificationQueryDto.prototype, "limit", void 0);
|
|
37
38
|
__decorate([
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"notification-query.dto.js","sourceRoot":"","sources":["../../../../src/modules/notifications/dto/notification-query.dto.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,yDAAoD;AACpD,
|
|
1
|
+
{"version":3,"file":"notification-query.dto.js","sourceRoot":"","sources":["../../../../src/modules/notifications/dto/notification-query.dto.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,yDAAoD;AACpD,qDAAiF;AAEjF,yEAAmE;AAEnE,MAAa,oBAAoB;IAKhC,IAAI,CAAU;IAOd,KAAK,CAAU;IAKf,MAAM,CAAW;IAIjB,IAAI,CAAoB;CACxB;AAtBD,oDAsBC;AAjBA;IAJC,IAAA,4BAAU,GAAE;IACZ,IAAA,wBAAI,EAAC,GAAG,EAAE,CAAC,MAAM,CAAC;IAClB,IAAA,uBAAK,GAAE;IACP,IAAA,qBAAG,EAAC,CAAC,CAAC;;kDACO;AAOd;IALC,IAAA,4BAAU,GAAE;IACZ,IAAA,wBAAI,EAAC,GAAG,EAAE,CAAC,MAAM,CAAC;IAClB,IAAA,uBAAK,GAAE;IACP,IAAA,qBAAG,EAAC,CAAC,CAAC;IACN,IAAA,qBAAG,EAAC,GAAG,CAAC;;mDACM;AAKf;IAHC,IAAA,4BAAU,GAAE;IACZ,IAAA,6BAAS,EAAC,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,KAAK,KAAK,MAAM,IAAI,KAAK,KAAK,IAAI,CAAC;IAC5D,IAAA,2BAAS,GAAE;;oDACK;AAIjB;IAFC,IAAA,4BAAU,GAAE;IACZ,IAAA,wBAAM,EAAC,sCAAgB,CAAC;;kDACD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"device-token.entity.d.ts","sourceRoot":"","sources":["../../../../src/modules/notifications/entities/device-token.entity.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,kCAAkC,CAAC;AAC9D,OAAO,EAAE,IAAI,EAAE,MAAM,kCAAkC,CAAC;AAExD,oBAAY,UAAU;IACrB,GAAG,QAAQ;IACX,OAAO,YAAY;IACnB,GAAG,QAAQ;CACX;AAED,
|
|
1
|
+
{"version":3,"file":"device-token.entity.d.ts","sourceRoot":"","sources":["../../../../src/modules/notifications/entities/device-token.entity.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,kCAAkC,CAAC;AAC9D,OAAO,EAAE,IAAI,EAAE,MAAM,kCAAkC,CAAC;AAExD,oBAAY,UAAU;IACrB,GAAG,QAAQ;IACX,OAAO,YAAY;IACnB,GAAG,QAAQ;CACX;AAED,qBAIa,WAAY,SAAQ,UAAU;IAE1C,MAAM,EAAG,MAAM,CAAC;IAIhB,IAAI,EAAG,IAAI,CAAC;IAGZ,QAAQ,EAAG,MAAM,CAAC;IAOlB,UAAU,EAAG,UAAU,CAAC;IAGxB,UAAU,CAAC,EAAE,MAAM,CAAC;IAGpB,QAAQ,EAAG,OAAO,CAAC;IAGnB,UAAU,CAAC,EAAE,IAAI,CAAC;CAClB"}
|
|
@@ -64,6 +64,8 @@ __decorate([
|
|
|
64
64
|
], DeviceToken.prototype, "lastUsedAt", void 0);
|
|
65
65
|
exports.DeviceToken = DeviceToken = __decorate([
|
|
66
66
|
(0, typeorm_1.Entity)('device_tokens'),
|
|
67
|
-
(0, typeorm_1.Index)(['userId', 'fcmToken'], { unique: true })
|
|
67
|
+
(0, typeorm_1.Index)(['userId', 'fcmToken'], { unique: true }),
|
|
68
|
+
(0, typeorm_1.Index)(['userId', 'isActive']),
|
|
69
|
+
(0, typeorm_1.Index)(['fcmToken'])
|
|
68
70
|
], DeviceToken);
|
|
69
71
|
//# sourceMappingURL=device-token.entity.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"device-token.entity.js","sourceRoot":"","sources":["../../../../src/modules/notifications/entities/device-token.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qCAAuE;AAEvE,kEAA8D;AAC9D,kEAAwD;AAExD,IAAY,UAIX;AAJD,WAAY,UAAU;IACrB,yBAAW,CAAA;IACX,iCAAmB,CAAA;IACnB,yBAAW,CAAA;AACZ,CAAC,EAJW,UAAU,0BAAV,UAAU,QAIrB;
|
|
1
|
+
{"version":3,"file":"device-token.entity.js","sourceRoot":"","sources":["../../../../src/modules/notifications/entities/device-token.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qCAAuE;AAEvE,kEAA8D;AAC9D,kEAAwD;AAExD,IAAY,UAIX;AAJD,WAAY,UAAU;IACrB,yBAAW,CAAA;IACX,iCAAmB,CAAA;IACnB,yBAAW,CAAA;AACZ,CAAC,EAJW,UAAU,0BAAV,UAAU,QAIrB;AAMM,IAAM,WAAW,GAAjB,MAAM,WAAY,SAAQ,wBAAU;IAE1C,MAAM,CAAU;IAIhB,IAAI,CAAQ;IAGZ,QAAQ,CAAU;IAOlB,UAAU,CAAc;IAGxB,UAAU,CAAU;IAGpB,QAAQ,CAAW;IAGnB,UAAU,CAAQ;CAClB,CAAA;AA1BY,kCAAW;AAEvB;IADC,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC;;2CACZ;AAIhB;IAFC,IAAA,mBAAS,EAAC,GAAG,EAAE,CAAC,kBAAI,EAAE,EAAE,QAAQ,EAAE,SAAS,EAAE,CAAC;IAC9C,IAAA,oBAAU,EAAC,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC;8BACzB,kBAAI;yCAAC;AAGZ;IADC,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,WAAW,EAAE,CAAC;;6CACZ;AAOlB;IALC,IAAA,gBAAM,EAAC;QACP,IAAI,EAAE,aAAa;QACnB,IAAI,EAAE,MAAM;QACZ,IAAI,EAAE,UAAU;KAChB,CAAC;;+CACsB;AAGxB;IADC,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,aAAa,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;+CAC5B;AAGpB;IADC,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,WAAW,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;;6CAC1B;AAGnB;IADC,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,cAAc,EAAE,IAAI,EAAE,aAAa,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;8BACzD,IAAI;+CAAC;sBAzBN,WAAW;IAJvB,IAAA,gBAAM,EAAC,eAAe,CAAC;IACvB,IAAA,eAAK,EAAC,CAAC,QAAQ,EAAE,UAAU,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;IAC/C,IAAA,eAAK,EAAC,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAC;IAC7B,IAAA,eAAK,EAAC,CAAC,UAAU,CAAC,CAAC;GACP,WAAW,CA0BvB"}
|
|
@@ -15,6 +15,8 @@ export declare class FcmService {
|
|
|
15
15
|
private readonly errorReporter?;
|
|
16
16
|
constructor(firebaseService: FirebaseService, deviceTokenRepository: Repository<DeviceToken>, settings: SettingsService, logger: StructuredLoggerService, metrics?: MetricsService | undefined, errorReporter?: ErrorReporterService | undefined);
|
|
17
17
|
registerDeviceToken(userId: string, fcmToken: string, deviceType: DeviceType, deviceName?: string): Promise<DeviceToken>;
|
|
18
|
+
/** Deactivates oldest active tokens beyond the per-user cap. */
|
|
19
|
+
private enforceActiveTokenCap;
|
|
18
20
|
removeDeviceTokenForUser(userId: string, fcmToken: string): Promise<void>;
|
|
19
21
|
private deactivateDeviceToken;
|
|
20
22
|
getUserDeviceTokens(userId: string): Promise<DeviceToken[]>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fcm.service.d.ts","sourceRoot":"","sources":["../../../../src/modules/notifications/services/fcm.service.ts"],"names":[],"mappings":"AAEA,OAAO,
|
|
1
|
+
{"version":3,"file":"fcm.service.d.ts","sourceRoot":"","sources":["../../../../src/modules/notifications/services/fcm.service.ts"],"names":[],"mappings":"AAEA,OAAO,EAAM,UAAU,EAAE,MAAM,SAAS,CAAC;AAGzC,OAAO,EAAE,oBAAoB,EAAE,MAAM,mDAAmD,CAAC;AACzF,OAAO,EAAE,uBAAuB,EAAE,MAAM,uDAAuD,CAAC;AAChG,OAAO,EAAE,cAAc,EAAE,MAAM,6CAA6C,CAAC;AAE7E,OAAO,EAAE,eAAe,EAAE,MAAM,0CAA0C,CAAC;AAC3E,OAAO,EAAE,mBAAmB,EAAE,MAAM,QAAQ,CAAC;AAC7C,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAC1E,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAWrD,qBACa,UAAU;IAErB,OAAO,CAAC,QAAQ,CAAC,eAAe;IAEhC,OAAO,CAAC,QAAQ,CAAC,qBAAqB;IACtC,OAAO,CAAC,QAAQ,CAAC,QAAQ;IACzB,OAAO,CAAC,QAAQ,CAAC,MAAM;IACX,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAC;IACzB,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAC;gBAN1B,eAAe,EAAE,eAAe,EAEhC,qBAAqB,EAAE,UAAU,CAAC,WAAW,CAAC,EAC9C,QAAQ,EAAE,eAAe,EACzB,MAAM,EAAE,uBAAuB,EACnB,OAAO,CAAC,EAAE,cAAc,YAAA,EACxB,aAAa,CAAC,EAAE,oBAAoB,YAAA;IAK5D,mBAAmB,CACxB,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,MAAM,EAChB,UAAU,EAAE,UAAU,EACtB,UAAU,CAAC,EAAE,MAAM,GACjB,OAAO,CAAC,WAAW,CAAC;IA8BvB,gEAAgE;YAClD,qBAAqB;IAc7B,wBAAwB,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;YAWjE,qBAAqB;IAI7B,mBAAmB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,EAAE,CAAC;IAU3D,YAAY,CAAC,QAAQ,EAAE,MAAM,EAAE,YAAY,EAAE,mBAAmB,GAAG,OAAO,CAAC,OAAO,CAAC;IAqGnF,UAAU,CAAC,MAAM,EAAE,MAAM,EAAE,YAAY,EAAE,mBAAmB,GAAG,OAAO,CAAC,MAAM,CAAC;IAuBpF,OAAO,CAAC,mBAAmB;IAW3B,OAAO,CAAC,gBAAgB;CAKxB"}
|
|
@@ -26,6 +26,10 @@ const device_token_entity_1 = require("../entities/device-token.entity");
|
|
|
26
26
|
const firebase_service_1 = require("./firebase.service");
|
|
27
27
|
const FCM_BASE_URL = 'https://fcm.googleapis.com/v1/projects';
|
|
28
28
|
const FCM_REQUEST_TIMEOUT_MS = 30_000;
|
|
29
|
+
/** Cap active tokens per user to bound fan-out latency under token spam. */
|
|
30
|
+
const MAX_ACTIVE_TOKENS_PER_USER = 10;
|
|
31
|
+
/** Parallel FCM HTTP calls per sendToUser (bounded concurrency). */
|
|
32
|
+
const FCM_SEND_CONCURRENCY = 5;
|
|
29
33
|
const UNREGISTERED_ERRORS = new Set(['UNREGISTERED', 'INVALID_ARGUMENT']);
|
|
30
34
|
let FcmService = class FcmService {
|
|
31
35
|
firebaseService;
|
|
@@ -65,7 +69,20 @@ let FcmService = class FcmService {
|
|
|
65
69
|
lastUsedAt: new Date(),
|
|
66
70
|
});
|
|
67
71
|
}
|
|
68
|
-
|
|
72
|
+
const saved = await this.deviceTokenRepository.save(deviceToken);
|
|
73
|
+
await this.enforceActiveTokenCap(userId);
|
|
74
|
+
return saved;
|
|
75
|
+
}
|
|
76
|
+
/** Deactivates oldest active tokens beyond the per-user cap. */
|
|
77
|
+
async enforceActiveTokenCap(userId) {
|
|
78
|
+
const active = await this.deviceTokenRepository.find({
|
|
79
|
+
where: { userId, isActive: true },
|
|
80
|
+
order: { lastUsedAt: 'DESC', createdAt: 'DESC' },
|
|
81
|
+
});
|
|
82
|
+
const surplus = active.slice(MAX_ACTIVE_TOKENS_PER_USER);
|
|
83
|
+
if (surplus.length === 0)
|
|
84
|
+
return;
|
|
85
|
+
await this.deviceTokenRepository.update({ id: (0, typeorm_2.In)(surplus.map((token) => token.id)) }, { isActive: false });
|
|
69
86
|
}
|
|
70
87
|
async removeDeviceTokenForUser(userId, fcmToken) {
|
|
71
88
|
const device = await this.deviceTokenRepository.findOne({ where: { fcmToken } });
|
|
@@ -81,7 +98,11 @@ let FcmService = class FcmService {
|
|
|
81
98
|
await this.deviceTokenRepository.update({ fcmToken }, { isActive: false });
|
|
82
99
|
}
|
|
83
100
|
async getUserDeviceTokens(userId) {
|
|
84
|
-
return this.deviceTokenRepository.find({
|
|
101
|
+
return this.deviceTokenRepository.find({
|
|
102
|
+
where: { userId, isActive: true },
|
|
103
|
+
order: { lastUsedAt: 'DESC', createdAt: 'DESC' },
|
|
104
|
+
take: MAX_ACTIVE_TOKENS_PER_USER,
|
|
105
|
+
});
|
|
85
106
|
}
|
|
86
107
|
// ─── Push Notifications ──────────────────────────────────────────────────
|
|
87
108
|
async sendToDevice(fcmToken, notification) {
|
|
@@ -178,10 +199,10 @@ let FcmService = class FcmService {
|
|
|
178
199
|
return 0;
|
|
179
200
|
}
|
|
180
201
|
let successCount = 0;
|
|
181
|
-
for (
|
|
182
|
-
const
|
|
183
|
-
|
|
184
|
-
|
|
202
|
+
for (let i = 0; i < deviceTokens.length; i += FCM_SEND_CONCURRENCY) {
|
|
203
|
+
const batch = deviceTokens.slice(i, i + FCM_SEND_CONCURRENCY);
|
|
204
|
+
const results = await Promise.all(batch.map((device) => this.sendToDevice(device.fcmToken, notification)));
|
|
205
|
+
successCount += results.filter(Boolean).length;
|
|
185
206
|
}
|
|
186
207
|
return successCount;
|
|
187
208
|
}
|
|
@@ -197,8 +218,8 @@ let FcmService = class FcmService {
|
|
|
197
218
|
recordFcmOutcome(outcome, durationMs) {
|
|
198
219
|
if (!this.metrics?.isEnabled())
|
|
199
220
|
return;
|
|
221
|
+
// Device-level FCM HTTP only — job-level push delivery metrics live in DeliveryJobRunner.
|
|
200
222
|
this.metrics.recordExternalRequest('fcm', outcome, durationMs);
|
|
201
|
-
this.metrics.recordNotificationDelivery('push', outcome === 'success' ? 'sent' : 'failed');
|
|
202
223
|
}
|
|
203
224
|
};
|
|
204
225
|
exports.FcmService = FcmService;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fcm.service.js","sourceRoot":"","sources":["../../../../src/modules/notifications/services/fcm.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAA0E;AAC1E,6CAAmD;AACnD,
|
|
1
|
+
{"version":3,"file":"fcm.service.js","sourceRoot":"","sources":["../../../../src/modules/notifications/services/fcm.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAA0E;AAC1E,6CAAmD;AACnD,qCAAyC;AAEzC,2FAAmG;AACnG,8FAAyF;AACzF,qGAAgG;AAChG,iFAA6E;AAC7E,0EAAsE;AACtE,+EAA2E;AAE3E,yEAA0E;AAC1E,yDAAqD;AAErD,MAAM,YAAY,GAAG,wCAAwC,CAAC;AAC9D,MAAM,sBAAsB,GAAG,MAAM,CAAC;AACtC,4EAA4E;AAC5E,MAAM,0BAA0B,GAAG,EAAE,CAAC;AACtC,oEAAoE;AACpE,MAAM,oBAAoB,GAAG,CAAC,CAAC;AAE/B,MAAM,mBAAmB,GAAG,IAAI,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,EAAE;YAAE,OAAO;QACvC,0FAA0F;QAC1F,IAAI,CAAC,OAAO,CAAC,qBAAqB,CAAC,KAAK,EAAE,OAAO,EAAE,UAAU,CAAC,CAAC;IAChE,CAAC;CACD,CAAA;AApOY,gCAAU;qBAAV,UAAU;IADtB,IAAA,mBAAU,GAAE;IAIV,WAAA,IAAA,0BAAgB,EAAC,iCAAW,CAAC,CAAA;IAI7B,WAAA,IAAA,iBAAQ,GAAE,CAAA;IACV,WAAA,IAAA,iBAAQ,GAAE,CAAA;qCANuB,kCAAe;QAET,oBAAU;QACvB,kCAAe;QACjB,mDAAuB;QACT,gCAAc;QACR,6CAAoB;GARtD,UAAU,CAoOtB"}
|
|
@@ -1,22 +1,35 @@
|
|
|
1
|
-
import { Repository } from 'typeorm';
|
|
1
|
+
import { EntityManager, Repository } from 'typeorm';
|
|
2
2
|
import { PaginatedResult } from '../../../common/base/base.repository';
|
|
3
3
|
import { NotificationDeliveryService } from '../../delivery/notification-delivery.service';
|
|
4
4
|
import { StructuredLoggerService } from '../../observability/logging/structured-logger.service';
|
|
5
5
|
import { MetricsService } from '../../observability/metrics/metrics.service';
|
|
6
|
+
import { RealtimeService } from '../../realtime/services/realtime.service';
|
|
7
|
+
import { SettingsService } from '../../settings/services/settings.service';
|
|
6
8
|
import { NotificationQueryDto, SendNotificationDto } from '../dto';
|
|
9
|
+
import { NotificationChannel } from '../dto/event-types.dto';
|
|
7
10
|
import { Notification } from '../entities/notification.entity';
|
|
8
11
|
export declare class NotificationsService {
|
|
9
12
|
private readonly notificationRepository;
|
|
10
13
|
private readonly notificationDelivery;
|
|
11
14
|
private readonly logger;
|
|
15
|
+
private readonly realtime?;
|
|
16
|
+
private readonly settings?;
|
|
12
17
|
private readonly metrics?;
|
|
13
|
-
constructor(notificationRepository: Repository<Notification>, notificationDelivery: NotificationDeliveryService | null, logger: StructuredLoggerService, metrics?: MetricsService | undefined);
|
|
18
|
+
constructor(notificationRepository: Repository<Notification>, notificationDelivery: NotificationDeliveryService | null, logger: StructuredLoggerService, realtime?: RealtimeService | undefined, settings?: SettingsService | undefined, metrics?: MetricsService | undefined);
|
|
14
19
|
/**
|
|
15
20
|
* Persists an in-app notification and optionally enqueues push delivery.
|
|
21
|
+
* When `manager` is provided, only the DB insert runs (push is skipped so
|
|
22
|
+
* callers can seal audit in the same TX, then enqueue push after commit).
|
|
16
23
|
*/
|
|
17
|
-
sendNotification(dto: SendNotificationDto): Promise<Notification>;
|
|
24
|
+
sendNotification(dto: SendNotificationDto, manager?: EntityManager): Promise<Notification>;
|
|
25
|
+
/** Enqueue FCM/push and/or websocket delivery after a committed in-app insert. */
|
|
26
|
+
enqueueDeliveryIfNeeded(dto: SendNotificationDto, notification: Notification, channel?: NotificationChannel): Promise<void>;
|
|
27
|
+
/** @deprecated Use {@link enqueueDeliveryIfNeeded} */
|
|
28
|
+
enqueuePushIfNeeded(dto: SendNotificationDto, notification: Notification, channel?: NotificationChannel): Promise<void>;
|
|
29
|
+
private emitWebsocketIfNeeded;
|
|
18
30
|
private mapEventType;
|
|
19
31
|
private extractString;
|
|
32
|
+
private assertPayloadBounds;
|
|
20
33
|
private toPushData;
|
|
21
34
|
/**
|
|
22
35
|
* Save notification to database
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"notifications.service.d.ts","sourceRoot":"","sources":["../../../../src/modules/notifications/services/notifications.service.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"notifications.service.d.ts","sourceRoot":"","sources":["../../../../src/modules/notifications/services/notifications.service.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAEpD,OAAO,EAAE,eAAe,EAAE,MAAM,sCAAsC,CAAC;AACvE,OAAO,EAAE,2BAA2B,EAAE,MAAM,8CAA8C,CAAC;AAC3F,OAAO,EAAE,uBAAuB,EAAE,MAAM,uDAAuD,CAAC;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IA4CnC,OAAO,CAAC,YAAY;IAOpB,OAAO,CAAC,aAAa;IAIrB,OAAO,CAAC,mBAAmB;IAe3B,OAAO,CAAC,UAAU;IAWlB;;OAEG;YACW,gBAAgB;IAe9B;;OAEG;IACG,qBAAqB,CAC1B,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,oBAAoB,GACzB,OAAO,CAAC,eAAe,CAAC,YAAY,CAAC,CAAC;IA+BzC;;OAEG;IACG,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAMrD;;OAEG;IACG,UAAU,CAAC,MAAM,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAcvE;;OAEG;IACG,aAAa,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAQpD;;OAEG;IACG,kBAAkB,CAAC,MAAM,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAW/E"}
|
|
@@ -18,17 +18,27 @@ const typeorm_1 = require("@nestjs/typeorm");
|
|
|
18
18
|
const typeorm_2 = require("typeorm");
|
|
19
19
|
const structured_logger_service_1 = require("../../observability/logging/structured-logger.service");
|
|
20
20
|
const metrics_service_1 = require("../../observability/metrics/metrics.service");
|
|
21
|
+
const realtime_constants_1 = require("../../realtime/constants/realtime.constants");
|
|
22
|
+
const realtime_service_1 = require("../../realtime/services/realtime.service");
|
|
23
|
+
const settings_keys_1 = require("../../settings/constants/settings.keys");
|
|
24
|
+
const settings_service_1 = require("../../settings/services/settings.service");
|
|
21
25
|
const event_types_dto_1 = require("../dto/event-types.dto");
|
|
22
26
|
const notification_entity_1 = require("../entities/notification.entity");
|
|
27
|
+
const MAX_PAYLOAD_KEYS = 50;
|
|
28
|
+
const MAX_PAYLOAD_JSON_CHARS = 16_384;
|
|
23
29
|
let NotificationsService = class NotificationsService {
|
|
24
30
|
notificationRepository;
|
|
25
31
|
notificationDelivery;
|
|
26
32
|
logger;
|
|
33
|
+
realtime;
|
|
34
|
+
settings;
|
|
27
35
|
metrics;
|
|
28
|
-
constructor(notificationRepository, notificationDelivery, logger, metrics) {
|
|
36
|
+
constructor(notificationRepository, notificationDelivery, logger, realtime, settings, metrics) {
|
|
29
37
|
this.notificationRepository = notificationRepository;
|
|
30
38
|
this.notificationDelivery = notificationDelivery;
|
|
31
39
|
this.logger = logger;
|
|
40
|
+
this.realtime = realtime;
|
|
41
|
+
this.settings = settings;
|
|
32
42
|
this.metrics = metrics;
|
|
33
43
|
}
|
|
34
44
|
// ============================================
|
|
@@ -36,8 +46,11 @@ let NotificationsService = class NotificationsService {
|
|
|
36
46
|
// ============================================
|
|
37
47
|
/**
|
|
38
48
|
* Persists an in-app notification and optionally enqueues push delivery.
|
|
49
|
+
* When `manager` is provided, only the DB insert runs (push is skipped so
|
|
50
|
+
* callers can seal audit in the same TX, then enqueue push after commit).
|
|
39
51
|
*/
|
|
40
|
-
async sendNotification(dto) {
|
|
52
|
+
async sendNotification(dto, manager) {
|
|
53
|
+
this.assertPayloadBounds(dto.payload);
|
|
41
54
|
const channel = dto.channel ?? event_types_dto_1.NotificationChannel.BOTH;
|
|
42
55
|
const title = this.extractString(dto.payload.title) ?? dto.eventType;
|
|
43
56
|
const body = this.extractString(dto.payload.body) ?? '';
|
|
@@ -47,28 +60,71 @@ let NotificationsService = class NotificationsService {
|
|
|
47
60
|
body,
|
|
48
61
|
type: this.mapEventType(dto.eventType),
|
|
49
62
|
data: dto.payload,
|
|
50
|
-
});
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
try {
|
|
54
|
-
await this.notificationDelivery.sendPush(dto.userId, {
|
|
55
|
-
title,
|
|
56
|
-
body,
|
|
57
|
-
data: this.toPushData(dto.payload),
|
|
58
|
-
}, `notification:${notification.id}`);
|
|
59
|
-
this.metrics?.recordNotificationDelivery('push', 'sent');
|
|
60
|
-
}
|
|
61
|
-
catch (err) {
|
|
62
|
-
this.metrics?.recordNotificationDelivery('push', 'failed');
|
|
63
|
-
this.logger.error('Notification push enqueue failed', {
|
|
64
|
-
event: 'notifications.push.enqueue_failed',
|
|
65
|
-
metadata: { userId: dto.userId, notificationId: notification.id },
|
|
66
|
-
err: err instanceof Error ? err : undefined,
|
|
67
|
-
});
|
|
68
|
-
}
|
|
63
|
+
}, manager);
|
|
64
|
+
if (!manager) {
|
|
65
|
+
await this.enqueueDeliveryIfNeeded(dto, notification, channel);
|
|
69
66
|
}
|
|
70
67
|
return notification;
|
|
71
68
|
}
|
|
69
|
+
/** Enqueue FCM/push and/or websocket delivery after a committed in-app insert. */
|
|
70
|
+
async enqueueDeliveryIfNeeded(dto, notification, channel = dto.channel ?? event_types_dto_1.NotificationChannel.BOTH) {
|
|
71
|
+
await Promise.all([
|
|
72
|
+
this.enqueuePushIfNeeded(dto, notification, channel),
|
|
73
|
+
this.emitWebsocketIfNeeded(dto, notification, channel),
|
|
74
|
+
]);
|
|
75
|
+
}
|
|
76
|
+
/** @deprecated Use {@link enqueueDeliveryIfNeeded} */
|
|
77
|
+
async enqueuePushIfNeeded(dto, notification, channel = dto.channel ?? event_types_dto_1.NotificationChannel.BOTH) {
|
|
78
|
+
const shouldPush = channel === event_types_dto_1.NotificationChannel.FCM || channel === event_types_dto_1.NotificationChannel.BOTH;
|
|
79
|
+
if (!shouldPush || !this.notificationDelivery?.isEnabled())
|
|
80
|
+
return;
|
|
81
|
+
const title = this.extractString(dto.payload.title) ?? dto.eventType;
|
|
82
|
+
const body = this.extractString(dto.payload.body) ?? '';
|
|
83
|
+
try {
|
|
84
|
+
await this.notificationDelivery.sendPush(dto.userId, {
|
|
85
|
+
title,
|
|
86
|
+
body,
|
|
87
|
+
data: this.toPushData(dto.payload),
|
|
88
|
+
}, `notification:${notification.id}`);
|
|
89
|
+
// Actual send metric is recorded by DeliveryJobRunner — avoid double-count on enqueue.
|
|
90
|
+
}
|
|
91
|
+
catch (err) {
|
|
92
|
+
this.metrics?.recordNotificationDelivery('push', 'failed');
|
|
93
|
+
this.logger.error('Notification push enqueue failed', {
|
|
94
|
+
event: 'notifications.push.enqueue_failed',
|
|
95
|
+
metadata: { userId: dto.userId, notificationId: notification.id },
|
|
96
|
+
err: err instanceof Error ? err : undefined,
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
async emitWebsocketIfNeeded(dto, notification, channel) {
|
|
101
|
+
const shouldWs = channel === event_types_dto_1.NotificationChannel.WEBSOCKET || channel === event_types_dto_1.NotificationChannel.BOTH;
|
|
102
|
+
if (!shouldWs || !this.realtime?.isReady())
|
|
103
|
+
return;
|
|
104
|
+
const emitEnabled = this.settings?.get(settings_keys_1.SETTING_KEYS.REALTIME_EMIT_NOTIFICATION_CREATED) !== false;
|
|
105
|
+
if (!emitEnabled)
|
|
106
|
+
return;
|
|
107
|
+
const title = this.extractString(dto.payload.title) ?? dto.eventType;
|
|
108
|
+
const body = this.extractString(dto.payload.body) ?? '';
|
|
109
|
+
try {
|
|
110
|
+
const ok = await this.realtime.emitToUser(dto.userId, realtime_constants_1.REALTIME_SERVER_EVENTS.NOTIFICATION_CREATED, {
|
|
111
|
+
id: notification.id,
|
|
112
|
+
title,
|
|
113
|
+
body,
|
|
114
|
+
eventType: dto.eventType,
|
|
115
|
+
payload: dto.payload,
|
|
116
|
+
}, { eventId: `notification:${notification.id}` });
|
|
117
|
+
this.metrics?.recordNotificationDelivery('websocket', ok ? 'sent' : 'failed');
|
|
118
|
+
}
|
|
119
|
+
catch (err) {
|
|
120
|
+
this.metrics?.recordNotificationDelivery('websocket', 'failed');
|
|
121
|
+
this.logger.error('Notification websocket emit failed', {
|
|
122
|
+
event: 'notifications.websocket.emit_failed',
|
|
123
|
+
metadata: { userId: dto.userId, notificationId: notification.id },
|
|
124
|
+
err: err instanceof Error ? err : undefined,
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
}
|
|
72
128
|
// ============================================
|
|
73
129
|
// Notification Persistence Methods
|
|
74
130
|
// ============================================
|
|
@@ -81,6 +137,16 @@ let NotificationsService = class NotificationsService {
|
|
|
81
137
|
extractString(value) {
|
|
82
138
|
return typeof value === 'string' && value.length > 0 ? value : undefined;
|
|
83
139
|
}
|
|
140
|
+
assertPayloadBounds(payload) {
|
|
141
|
+
const keys = Object.keys(payload ?? {});
|
|
142
|
+
if (keys.length > MAX_PAYLOAD_KEYS) {
|
|
143
|
+
throw new common_1.BadRequestException(`Notification payload exceeds maximum of ${MAX_PAYLOAD_KEYS} keys.`);
|
|
144
|
+
}
|
|
145
|
+
const json = JSON.stringify(payload ?? {});
|
|
146
|
+
if (json.length > MAX_PAYLOAD_JSON_CHARS) {
|
|
147
|
+
throw new common_1.BadRequestException(`Notification payload exceeds maximum of ${MAX_PAYLOAD_JSON_CHARS} characters.`);
|
|
148
|
+
}
|
|
149
|
+
}
|
|
84
150
|
toPushData(payload) {
|
|
85
151
|
const data = {};
|
|
86
152
|
for (const [key, value] of Object.entries(payload)) {
|
|
@@ -93,9 +159,10 @@ let NotificationsService = class NotificationsService {
|
|
|
93
159
|
/**
|
|
94
160
|
* Save notification to database
|
|
95
161
|
*/
|
|
96
|
-
async saveNotification(params) {
|
|
97
|
-
const
|
|
98
|
-
|
|
162
|
+
async saveNotification(params, manager) {
|
|
163
|
+
const repo = manager?.getRepository(notification_entity_1.Notification) ?? this.notificationRepository;
|
|
164
|
+
const notification = repo.create(params);
|
|
165
|
+
return repo.save(notification);
|
|
99
166
|
}
|
|
100
167
|
/**
|
|
101
168
|
* Get user's notifications with pagination
|
|
@@ -173,7 +240,11 @@ exports.NotificationsService = NotificationsService = __decorate([
|
|
|
173
240
|
__param(0, (0, typeorm_1.InjectRepository)(notification_entity_1.Notification)),
|
|
174
241
|
__param(1, (0, common_1.Optional)()),
|
|
175
242
|
__param(3, (0, common_1.Optional)()),
|
|
243
|
+
__param(4, (0, common_1.Optional)()),
|
|
244
|
+
__param(5, (0, common_1.Optional)()),
|
|
176
245
|
__metadata("design:paramtypes", [typeorm_2.Repository, Object, structured_logger_service_1.StructuredLoggerService,
|
|
246
|
+
realtime_service_1.RealtimeService,
|
|
247
|
+
settings_service_1.SettingsService,
|
|
177
248
|
metrics_service_1.MetricsService])
|
|
178
249
|
], NotificationsService);
|
|
179
250
|
//# sourceMappingURL=notifications.service.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"notifications.service.js","sourceRoot":"","sources":["../../../../src/modules/notifications/services/notifications.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"notifications.service.js","sourceRoot":"","sources":["../../../../src/modules/notifications/services/notifications.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAA8F;AAC9F,6CAAmD;AACnD,qCAAoD;AAIpD,qGAAgG;AAChG,iFAA6E;AAC7E,oFAAqF;AACrF,+EAA2E;AAC3E,0EAAsE;AACtE,+EAA2E;AAE3E,4DAA6D;AAC7D,yEAAiF;AAEjF,MAAM,gBAAgB,GAAG,EAAE,CAAC;AAC5B,MAAM,sBAAsB,GAAG,MAAM,CAAC;AAG/B,IAAM,oBAAoB,GAA1B,MAAM,oBAAoB;IAGd;IAEA;IACA;IACY;IACA;IACA;IAR9B,YAEkB,sBAAgD,EAEhD,oBAAwD,EACxD,MAA+B,EACnB,QAA0B,EAC1B,QAA0B,EAC1B,OAAwB;QANpC,2BAAsB,GAAtB,sBAAsB,CAA0B;QAEhD,yBAAoB,GAApB,oBAAoB,CAAoC;QACxD,WAAM,GAAN,MAAM,CAAyB;QACnB,aAAQ,GAAR,QAAQ,CAAkB;QAC1B,aAAQ,GAAR,QAAQ,CAAkB;QAC1B,YAAO,GAAP,OAAO,CAAiB;IACnD,CAAC;IAEJ,+CAA+C;IAC/C,4BAA4B;IAC5B,+CAA+C;IAE/C;;;;OAIG;IACH,KAAK,CAAC,gBAAgB,CACrB,GAAwB,EACxB,OAAuB;QAEvB,IAAI,CAAC,mBAAmB,CAAC,GAAG,CAAC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Y,GAAG,MAAM,IAAI,CAAC,sBAAsB,CAAC,OAAO,CAAC;YAC9D,KAAK,EAAE,EAAE,EAAE,EAAE,cAAc,EAAE,MAAM,EAAE;SACrC,CAAC,CAAC;QAEH,IAAI,CAAC,YAAY,EAAE,CAAC;YACnB,MAAM,IAAI,0BAAiB,CAAC,wBAAwB,CAAC,CAAC;QACvD,CAAC;QAED,MAAM,IAAI,CAAC,sBAAsB,CAAC,UAAU,CAAC,YAAY,CAAC,CAAC;IAC5D,CAAC;CACD,CAAA;AA1RY,oDAAoB;+BAApB,oBAAoB;IADhC,IAAA,mBAAU,GAAE;IAGV,WAAA,IAAA,0BAAgB,EAAC,kCAAY,CAAC,CAAA;IAE9B,WAAA,IAAA,iBAAQ,GAAE,CAAA;IAGV,WAAA,IAAA,iBAAQ,GAAE,CAAA;IACV,WAAA,IAAA,iBAAQ,GAAE,CAAA;IACV,WAAA,IAAA,iBAAQ,GAAE,CAAA;qCAN8B,oBAAU,UAG1B,mDAAuB;QACR,kCAAe;QACf,kCAAe;QAChB,gCAAc;GAT1C,oBAAoB,CA0RhC"}
|
|
@@ -14,6 +14,7 @@ export declare class MetricsService implements OnModuleDestroy {
|
|
|
14
14
|
private readonly externalRequestTotal;
|
|
15
15
|
private readonly externalRequestDuration;
|
|
16
16
|
private readonly businessEventsTotal;
|
|
17
|
+
private readonly realtimeConnections;
|
|
17
18
|
private queueDepthTimer;
|
|
18
19
|
constructor(configService: ConfigService);
|
|
19
20
|
isEnabled(): boolean;
|
|
@@ -23,6 +24,7 @@ export declare class MetricsService implements OnModuleDestroy {
|
|
|
23
24
|
recordNotificationDelivery(channel: string, status: 'sent' | 'failed' | 'permanent_failure'): void;
|
|
24
25
|
recordExternalRequest(provider: string, statusClass: 'success' | 'failed', durationMs: number): void;
|
|
25
26
|
recordBusinessEvent(domain: string, event: string, outcome: string): void;
|
|
27
|
+
setRealtimeConnections(count: number): void;
|
|
26
28
|
startQueueDepthCollection(intervalMs: number, collect: () => Promise<Array<{
|
|
27
29
|
queue: string;
|
|
28
30
|
state: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"metrics.service.d.ts","sourceRoot":"","sources":["../../../../src/modules/observability/metrics/metrics.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAC7D,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAG/C,MAAM,MAAM,UAAU,GAAG,SAAS,GAAG,QAAQ,GAAG,mBAAmB,CAAC;AAEpE,qBACa,cAAe,YAAW,eAAe;
|
|
1
|
+
{"version":3,"file":"metrics.service.d.ts","sourceRoot":"","sources":["../../../../src/modules/observability/metrics/metrics.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAC7D,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAG/C,MAAM,MAAM,UAAU,GAAG,SAAS,GAAG,QAAQ,GAAG,mBAAmB,CAAC;AAEpE,qBACa,cAAe,YAAW,eAAe;IAezC,OAAO,CAAC,QAAQ,CAAC,aAAa;IAd1C,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAkB;IAC3C,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAU;IAClC,OAAO,CAAC,QAAQ,CAAC,iBAAiB,CAAU;IAC5C,OAAO,CAAC,QAAQ,CAAC,mBAAmB,CAAY;IAChD,OAAO,CAAC,QAAQ,CAAC,wBAAwB,CAAU;IACnD,OAAO,CAAC,QAAQ,CAAC,iBAAiB,CAAY;IAC9C,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAAQ;IACzC,OAAO,CAAC,QAAQ,CAAC,yBAAyB,CAAU;IACpD,OAAO,CAAC,QAAQ,CAAC,oBAAoB,CAAU;IAC/C,OAAO,CAAC,QAAQ,CAAC,uBAAuB,CAAY;IACpD,OAAO,CAAC,QAAQ,CAAC,mBAAmB,CAAU;IAC9C,OAAO,CAAC,Q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|
businessEventsTotal;
|
|
29
|
+
realtimeConnections;
|
|
29
30
|
queueDepthTimer = null;
|
|
30
31
|
constructor(configService) {
|
|
31
32
|
this.configService = configService;
|
|
@@ -89,6 +90,11 @@ let MetricsService = class MetricsService {
|
|
|
89
90
|
labelNames: ['domain', 'event', 'outcome'],
|
|
90
91
|
registers: [this.registry],
|
|
91
92
|
});
|
|
93
|
+
this.realtimeConnections = new prom_client_1.Gauge({
|
|
94
|
+
name: 'realtime_connections',
|
|
95
|
+
help: 'Local WebSocket connections on this instance',
|
|
96
|
+
registers: [this.registry],
|
|
97
|
+
});
|
|
92
98
|
if (this.enabled) {
|
|
93
99
|
(0, prom_client_1.collectDefaultMetrics)({ register: this.registry });
|
|
94
100
|
}
|
|
@@ -129,6 +135,11 @@ let MetricsService = class MetricsService {
|
|
|
129
135
|
return;
|
|
130
136
|
this.businessEventsTotal.inc({ domain, event, outcome });
|
|
131
137
|
}
|
|
138
|
+
setRealtimeConnections(count) {
|
|
139
|
+
if (!this.enabled)
|
|
140
|
+
return;
|
|
141
|
+
this.realtimeConnections.set(count);
|
|
142
|
+
}
|
|
132
143
|
startQueueDepthCollection(intervalMs, collect) {
|
|
133
144
|
if (!this.enabled || this.queueDepthTimer)
|
|
134
145
|
return;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"metrics.service.js","sourceRoot":"","sources":["../../../../src/modules/observability/metrics/metrics.service.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAA6D;AAC7D,2CAA+C;AAC/C,6CAAyF;AAKlF,IAAM,cAAc,GAApB,MAAM,cAAc;
|
|
1
|
+
{"version":3,"file":"metrics.service.js","sourceRoot":"","sources":["../../../../src/modules/observability/metrics/metrics.service.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAA6D;AAC7D,2CAA+C;AAC/C,6CAAyF;AAKlF,IAAM,cAAc,GAApB,MAAM,cAAc;IAeG;IAdZ,QAAQ,GAAG,IAAI,sBAAQ,EAAE,C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