@colveor/core 1.1.0 → 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 +17 -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 +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
|
@@ -0,0 +1,343 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
12
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
13
|
+
};
|
|
14
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
15
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
16
|
+
};
|
|
17
|
+
var RealtimeService_1;
|
|
18
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19
|
+
exports.RealtimeService = void 0;
|
|
20
|
+
const common_1 = require("@nestjs/common");
|
|
21
|
+
const config_1 = require("@nestjs/config");
|
|
22
|
+
const jwt_1 = require("@nestjs/jwt");
|
|
23
|
+
const crypto_1 = require("crypto");
|
|
24
|
+
const ioredis_1 = __importDefault(require("ioredis"));
|
|
25
|
+
const node_env_util_1 = require("../../../config/node-env.util");
|
|
26
|
+
const redis_module_1 = require("../../../config/redis.module");
|
|
27
|
+
const access_token_validator_1 = require("../../auth/auth-core/services/access-token.validator");
|
|
28
|
+
const metrics_service_1 = require("../../observability/metrics/metrics.service");
|
|
29
|
+
const settings_keys_1 = require("../../settings/constants/settings.keys");
|
|
30
|
+
const settings_service_1 = require("../../settings/services/settings.service");
|
|
31
|
+
const realtime_constants_1 = require("../constants/realtime.constants");
|
|
32
|
+
const realtime_types_1 = require("../types/realtime.types");
|
|
33
|
+
const realtime_presence_service_1 = require("./realtime-presence.service");
|
|
34
|
+
const realtime_rate_limiter_service_1 = require("./realtime-rate-limiter.service");
|
|
35
|
+
let RealtimeService = RealtimeService_1 = class RealtimeService {
|
|
36
|
+
jwtService;
|
|
37
|
+
accessTokenValidator;
|
|
38
|
+
presence;
|
|
39
|
+
rateLimiter;
|
|
40
|
+
settings;
|
|
41
|
+
configService;
|
|
42
|
+
redis;
|
|
43
|
+
metrics;
|
|
44
|
+
logger = new common_1.Logger(RealtimeService_1.name);
|
|
45
|
+
/** Used to ignore control-channel echoes from this process. */
|
|
46
|
+
instanceId = (0, crypto_1.randomUUID)();
|
|
47
|
+
server = null;
|
|
48
|
+
controlSub = null;
|
|
49
|
+
localConnections = 0;
|
|
50
|
+
/** Disconnects requested before the Socket.IO server was attached. */
|
|
51
|
+
pendingDisconnects = [];
|
|
52
|
+
constructor(jwtService, accessTokenValidator, presence, rateLimiter, settings, configService, redis, metrics) {
|
|
53
|
+
this.jwtService = jwtService;
|
|
54
|
+
this.accessTokenValidator = accessTokenValidator;
|
|
55
|
+
this.presence = presence;
|
|
56
|
+
this.rateLimiter = rateLimiter;
|
|
57
|
+
this.settings = settings;
|
|
58
|
+
this.configService = configService;
|
|
59
|
+
this.redis = redis;
|
|
60
|
+
this.metrics = metrics;
|
|
61
|
+
}
|
|
62
|
+
onModuleInit() {
|
|
63
|
+
if ((0, node_env_util_1.isProductionNodeEnv)(this.configService.get('app.nodeEnv')) &&
|
|
64
|
+
process.env.REDIS_ENABLED !== 'true') {
|
|
65
|
+
throw new Error('Realtime requires REDIS_ENABLED=true in production for the Socket.IO Redis adapter and presence.');
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
async onModuleDestroy() {
|
|
69
|
+
await this.controlSub?.unsubscribe();
|
|
70
|
+
this.controlSub = null;
|
|
71
|
+
}
|
|
72
|
+
/** Called by the gateway when the Socket.IO server is ready. */
|
|
73
|
+
attachServer(server) {
|
|
74
|
+
this.server = server;
|
|
75
|
+
this.metrics?.setRealtimeConnections(this.localConnections);
|
|
76
|
+
const pending = this.pendingDisconnects.splice(0, this.pendingDisconnects.length);
|
|
77
|
+
for (const item of pending) {
|
|
78
|
+
if (item.kind === 'user') {
|
|
79
|
+
this.applyDisconnectUser(item.id, item.reason, { emitEvent: item.emitEvent });
|
|
80
|
+
}
|
|
81
|
+
else {
|
|
82
|
+
this.applyDisconnectFamily(item.id, item.reason, { emitEvent: item.emitEvent });
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
getServer() {
|
|
87
|
+
return this.server;
|
|
88
|
+
}
|
|
89
|
+
isReady() {
|
|
90
|
+
return this.server != null;
|
|
91
|
+
}
|
|
92
|
+
trackConnect() {
|
|
93
|
+
this.localConnections += 1;
|
|
94
|
+
this.metrics?.setRealtimeConnections(this.localConnections);
|
|
95
|
+
this.metrics?.recordBusinessEvent('realtime', 'connect', 'success');
|
|
96
|
+
}
|
|
97
|
+
trackDisconnect() {
|
|
98
|
+
this.localConnections = Math.max(0, this.localConnections - 1);
|
|
99
|
+
this.metrics?.setRealtimeConnections(this.localConnections);
|
|
100
|
+
this.metrics?.recordBusinessEvent('realtime', 'disconnect', 'success');
|
|
101
|
+
}
|
|
102
|
+
getLocalConnectionCount() {
|
|
103
|
+
return this.localConnections;
|
|
104
|
+
}
|
|
105
|
+
buildHandshakeDpopUri(host, proto = 'https') {
|
|
106
|
+
const safeProto = (proto.split(',')[0] ?? 'https').trim() || 'https';
|
|
107
|
+
const safeHost = host.trim() || 'localhost';
|
|
108
|
+
return `${safeProto}://${safeHost}${realtime_constants_1.REALTIME_PATH}`;
|
|
109
|
+
}
|
|
110
|
+
async authenticateToken(token, dpopCtx) {
|
|
111
|
+
let payload;
|
|
112
|
+
try {
|
|
113
|
+
payload = this.jwtService.verify(token);
|
|
114
|
+
}
|
|
115
|
+
catch (err) {
|
|
116
|
+
this.metrics?.recordBusinessEvent('realtime', 'handshake', 'token_invalid');
|
|
117
|
+
const expired = err instanceof Error &&
|
|
118
|
+
(err.name === 'TokenExpiredError' ||
|
|
119
|
+
/jwt expired|token expired/i.test(err.message));
|
|
120
|
+
throw new Error(expired ? realtime_constants_1.REALTIME_CLOSE_CODES.TOKEN_EXPIRED : realtime_constants_1.REALTIME_CLOSE_CODES.UNAUTHORIZED);
|
|
121
|
+
}
|
|
122
|
+
const user = await this.accessTokenValidator.validate(payload, {
|
|
123
|
+
method: dpopCtx.method,
|
|
124
|
+
uri: dpopCtx.uri,
|
|
125
|
+
authorization: `Bearer ${token}`,
|
|
126
|
+
dpop: dpopCtx.dpop,
|
|
127
|
+
});
|
|
128
|
+
return {
|
|
129
|
+
user,
|
|
130
|
+
connectedAt: Date.now(),
|
|
131
|
+
tokenExp: payload.exp,
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
async emitToUser(userId, event, payload, opts) {
|
|
135
|
+
return this.emitToRoom((0, realtime_constants_1.userRoom)(userId), event, payload, opts, userId);
|
|
136
|
+
}
|
|
137
|
+
async emitToUsers(userIds, event, payload, opts) {
|
|
138
|
+
let sent = 0;
|
|
139
|
+
for (const id of [...new Set(userIds.filter(Boolean))]) {
|
|
140
|
+
if (await this.emitToUser(id, event, payload, opts))
|
|
141
|
+
sent += 1;
|
|
142
|
+
}
|
|
143
|
+
return sent;
|
|
144
|
+
}
|
|
145
|
+
async emitToRoom(room, event, payload, opts, rateLimitUserId) {
|
|
146
|
+
this.assertRoomAllowed(room);
|
|
147
|
+
this.assertEventName(event);
|
|
148
|
+
const maxBytes = this.settings.get(settings_keys_1.SETTING_KEYS.REALTIME_MAX_PAYLOAD_BYTES);
|
|
149
|
+
const envelope = (0, realtime_types_1.buildEnvelope)(event, payload, opts?.eventId);
|
|
150
|
+
const size = Buffer.byteLength(JSON.stringify(envelope), 'utf8');
|
|
151
|
+
if (size > maxBytes) {
|
|
152
|
+
this.metrics?.recordBusinessEvent('realtime', 'emit', 'payload_too_large');
|
|
153
|
+
if (opts?.dropOnLimit === false) {
|
|
154
|
+
throw new common_1.BadRequestException(realtime_constants_1.REALTIME_CLOSE_CODES.PAYLOAD_TOO_LARGE);
|
|
155
|
+
}
|
|
156
|
+
return false;
|
|
157
|
+
}
|
|
158
|
+
if (opts?.rateLimit && rateLimitUserId) {
|
|
159
|
+
const ok = await this.rateLimiter.allowEmit(rateLimitUserId);
|
|
160
|
+
if (!ok) {
|
|
161
|
+
this.metrics?.recordBusinessEvent('realtime', 'emit', 'rate_limited');
|
|
162
|
+
if (opts?.dropOnLimit === false) {
|
|
163
|
+
throw new common_1.BadRequestException(realtime_constants_1.REALTIME_CLOSE_CODES.RATE_LIMITED);
|
|
164
|
+
}
|
|
165
|
+
return false;
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
if (!this.server) {
|
|
169
|
+
this.metrics?.recordBusinessEvent('realtime', 'emit', 'not_ready');
|
|
170
|
+
return false;
|
|
171
|
+
}
|
|
172
|
+
this.server.to(room).emit(event, envelope);
|
|
173
|
+
this.metrics?.recordBusinessEvent('realtime', 'emit', 'success');
|
|
174
|
+
return true;
|
|
175
|
+
}
|
|
176
|
+
async emitToAll(event, payload, opts) {
|
|
177
|
+
this.assertEventName(event);
|
|
178
|
+
if (!this.server)
|
|
179
|
+
return false;
|
|
180
|
+
const envelope = (0, realtime_types_1.buildEnvelope)(event, payload, opts?.eventId);
|
|
181
|
+
const maxBytes = this.settings.get(settings_keys_1.SETTING_KEYS.REALTIME_MAX_PAYLOAD_BYTES);
|
|
182
|
+
if (Buffer.byteLength(JSON.stringify(envelope), 'utf8') > maxBytes) {
|
|
183
|
+
this.metrics?.recordBusinessEvent('realtime', 'emit', 'payload_too_large');
|
|
184
|
+
return false;
|
|
185
|
+
}
|
|
186
|
+
this.server.emit(event, envelope);
|
|
187
|
+
this.metrics?.recordBusinessEvent('realtime', 'emit_all', 'success');
|
|
188
|
+
return true;
|
|
189
|
+
}
|
|
190
|
+
async joinRoom(socket, room) {
|
|
191
|
+
this.assertRoomAllowed(room);
|
|
192
|
+
await socket.join(room);
|
|
193
|
+
}
|
|
194
|
+
/**
|
|
195
|
+
* Add all of a user's connected sockets to an allowlisted room
|
|
196
|
+
* (e.g. `tenant:{id}`, `role:{slug}`) without holding a Socket reference.
|
|
197
|
+
*/
|
|
198
|
+
async addUserToRoom(userId, room) {
|
|
199
|
+
this.assertRoomAllowed(room);
|
|
200
|
+
if (!this.server) {
|
|
201
|
+
throw new common_1.BadRequestException('Realtime server is not ready');
|
|
202
|
+
}
|
|
203
|
+
this.server.in((0, realtime_constants_1.userRoom)(userId)).socketsJoin(room);
|
|
204
|
+
}
|
|
205
|
+
/** Remove a user's sockets from an allowlisted room. */
|
|
206
|
+
async removeUserFromRoom(userId, room) {
|
|
207
|
+
this.assertRoomAllowed(room);
|
|
208
|
+
if (!this.server) {
|
|
209
|
+
throw new common_1.BadRequestException('Realtime server is not ready');
|
|
210
|
+
}
|
|
211
|
+
this.server.in((0, realtime_constants_1.userRoom)(userId)).socketsLeave(room);
|
|
212
|
+
}
|
|
213
|
+
/**
|
|
214
|
+
* Admin / explicit disconnect. Applies locally; Socket.IO Redis adapter fans out
|
|
215
|
+
* room emit/disconnect to other instances. Control publish is an origin-tagged
|
|
216
|
+
* backup signal — peers apply disconnect-only (no second session.revoked emit).
|
|
217
|
+
*/
|
|
218
|
+
disconnectUser(userId, reason = realtime_constants_1.REALTIME_CLOSE_CODES.SESSION_REVOKED) {
|
|
219
|
+
this.applyDisconnectUser(userId, reason, { emitEvent: true });
|
|
220
|
+
void this.publishControl({
|
|
221
|
+
op: 'disconnect_user',
|
|
222
|
+
userId,
|
|
223
|
+
reason,
|
|
224
|
+
origin: this.instanceId,
|
|
225
|
+
});
|
|
226
|
+
}
|
|
227
|
+
disconnectFamily(familyId, reason = realtime_constants_1.REALTIME_CLOSE_CODES.SESSION_REVOKED) {
|
|
228
|
+
this.applyDisconnectFamily(familyId, reason, { emitEvent: true });
|
|
229
|
+
void this.publishControl({
|
|
230
|
+
op: 'disconnect_family',
|
|
231
|
+
familyId,
|
|
232
|
+
reason,
|
|
233
|
+
origin: this.instanceId,
|
|
234
|
+
});
|
|
235
|
+
}
|
|
236
|
+
/**
|
|
237
|
+
* Session layer entry point — always applies locally (works with REDIS_ENABLED=false).
|
|
238
|
+
* Cross-instance: Socket.IO Redis adapter fans out room disconnect/emit.
|
|
239
|
+
*/
|
|
240
|
+
notifySessionRevokedUser(userId) {
|
|
241
|
+
this.disconnectUser(userId, realtime_constants_1.REALTIME_CLOSE_CODES.SESSION_REVOKED);
|
|
242
|
+
}
|
|
243
|
+
notifySessionRevokedFamily(familyId) {
|
|
244
|
+
this.disconnectFamily(familyId, realtime_constants_1.REALTIME_CLOSE_CODES.SESSION_REVOKED);
|
|
245
|
+
}
|
|
246
|
+
/** Local apply — used by gateway ops and control-channel subscriber. */
|
|
247
|
+
applyDisconnectUser(userId, reason = realtime_constants_1.REALTIME_CLOSE_CODES.SESSION_REVOKED, opts = {}) {
|
|
248
|
+
const emitEvent = opts.emitEvent !== false;
|
|
249
|
+
if (!this.server) {
|
|
250
|
+
this.pendingDisconnects.push({ kind: 'user', id: userId, reason, emitEvent });
|
|
251
|
+
return;
|
|
252
|
+
}
|
|
253
|
+
if (emitEvent && this.settings.get(settings_keys_1.SETTING_KEYS.REALTIME_EMIT_SESSION_REVOKED)) {
|
|
254
|
+
this.server
|
|
255
|
+
.to((0, realtime_constants_1.userRoom)(userId))
|
|
256
|
+
.emit(realtime_constants_1.REALTIME_SERVER_EVENTS.SESSION_REVOKED, (0, realtime_types_1.buildEnvelope)(realtime_constants_1.REALTIME_SERVER_EVENTS.SESSION_REVOKED, { reason }));
|
|
257
|
+
}
|
|
258
|
+
this.server.in((0, realtime_constants_1.userRoom)(userId)).disconnectSockets(true);
|
|
259
|
+
this.metrics?.recordBusinessEvent('realtime', 'force_disconnect', 'user');
|
|
260
|
+
}
|
|
261
|
+
applyDisconnectFamily(familyId, reason = realtime_constants_1.REALTIME_CLOSE_CODES.SESSION_REVOKED, opts = {}) {
|
|
262
|
+
const emitEvent = opts.emitEvent !== false;
|
|
263
|
+
if (!this.server) {
|
|
264
|
+
this.pendingDisconnects.push({ kind: 'family', id: familyId, reason, emitEvent });
|
|
265
|
+
return;
|
|
266
|
+
}
|
|
267
|
+
if (emitEvent && this.settings.get(settings_keys_1.SETTING_KEYS.REALTIME_EMIT_SESSION_REVOKED)) {
|
|
268
|
+
this.server
|
|
269
|
+
.to((0, realtime_constants_1.familyRoom)(familyId))
|
|
270
|
+
.emit(realtime_constants_1.REALTIME_SERVER_EVENTS.SESSION_REVOKED, (0, realtime_types_1.buildEnvelope)(realtime_constants_1.REALTIME_SERVER_EVENTS.SESSION_REVOKED, { reason }));
|
|
271
|
+
}
|
|
272
|
+
this.server.in((0, realtime_constants_1.familyRoom)(familyId)).disconnectSockets(true);
|
|
273
|
+
this.metrics?.recordBusinessEvent('realtime', 'force_disconnect', 'family');
|
|
274
|
+
}
|
|
275
|
+
async isOnline(userId) {
|
|
276
|
+
return this.presence.isOnline(userId);
|
|
277
|
+
}
|
|
278
|
+
async getPresence(userId) {
|
|
279
|
+
return this.presence.getPresence(userId);
|
|
280
|
+
}
|
|
281
|
+
/** Bind Redis control subscriber (called from adapter lifecycle when Redis on). */
|
|
282
|
+
bindControlSubscriber(sub) {
|
|
283
|
+
void sub
|
|
284
|
+
.subscribe(realtime_constants_1.REALTIME_CONTROL_CHANNEL, (raw) => {
|
|
285
|
+
try {
|
|
286
|
+
const msg = JSON.parse(raw);
|
|
287
|
+
if (msg.origin && msg.origin === this.instanceId) {
|
|
288
|
+
return;
|
|
289
|
+
}
|
|
290
|
+
if (msg.op === 'disconnect_user') {
|
|
291
|
+
// Emit already fanned out via Socket.IO Redis adapter from origin.
|
|
292
|
+
this.applyDisconnectUser(msg.userId, msg.reason ?? realtime_constants_1.REALTIME_CLOSE_CODES.SESSION_REVOKED, { emitEvent: false });
|
|
293
|
+
}
|
|
294
|
+
else if (msg.op === 'disconnect_family') {
|
|
295
|
+
this.applyDisconnectFamily(msg.familyId, msg.reason ?? realtime_constants_1.REALTIME_CLOSE_CODES.SESSION_REVOKED, { emitEvent: false });
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
catch (err) {
|
|
299
|
+
this.logger.warn(`Invalid realtime control message: ${err instanceof Error ? err.message : String(err)}`);
|
|
300
|
+
}
|
|
301
|
+
})
|
|
302
|
+
.then(() => {
|
|
303
|
+
this.controlSub = sub;
|
|
304
|
+
})
|
|
305
|
+
.catch((err) => {
|
|
306
|
+
this.logger.error(`Failed to subscribe realtime control channel: ${err instanceof Error ? err.message : String(err)}`);
|
|
307
|
+
});
|
|
308
|
+
}
|
|
309
|
+
async publishControl(msg) {
|
|
310
|
+
try {
|
|
311
|
+
await this.redis.publish(realtime_constants_1.REALTIME_CONTROL_CHANNEL, JSON.stringify(msg));
|
|
312
|
+
}
|
|
313
|
+
catch (err) {
|
|
314
|
+
this.logger.debug(`Realtime control publish skipped: ${err instanceof Error ? err.message : String(err)}`);
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
assertRoomAllowed(room) {
|
|
318
|
+
const ok = realtime_constants_1.REALTIME_ROOM_PREFIX_ALLOWLIST.some((p) => room.startsWith(p));
|
|
319
|
+
if (!ok || room.includes('*') || room.includes(',')) {
|
|
320
|
+
throw new common_1.BadRequestException(`Realtime room "${room}" is not allowlisted`);
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
assertEventName(event) {
|
|
324
|
+
if (!event || event.length > 128 || !/^[a-zA-Z][a-zA-Z0-9_.:-]*$/.test(event)) {
|
|
325
|
+
throw new common_1.BadRequestException('Invalid realtime event name');
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
};
|
|
329
|
+
exports.RealtimeService = RealtimeService;
|
|
330
|
+
exports.RealtimeService = RealtimeService = RealtimeService_1 = __decorate([
|
|
331
|
+
(0, common_1.Injectable)(),
|
|
332
|
+
__param(6, (0, common_1.Inject)(redis_module_1.REDIS_CLIENT)),
|
|
333
|
+
__param(7, (0, common_1.Optional)()),
|
|
334
|
+
__metadata("design:paramtypes", [jwt_1.JwtService,
|
|
335
|
+
access_token_validator_1.AccessTokenValidator,
|
|
336
|
+
realtime_presence_service_1.RealtimePresenceService,
|
|
337
|
+
realtime_rate_limiter_service_1.RealtimeRateLimiterService,
|
|
338
|
+
settings_service_1.SettingsService,
|
|
339
|
+
config_1.ConfigService,
|
|
340
|
+
ioredis_1.default,
|
|
341
|
+
metrics_service_1.MetricsService])
|
|
342
|
+
], RealtimeService);
|
|
343
|
+
//# sourceMappingURL=realtime.service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"realtime.service.js","sourceRoot":"","sources":["../../../../src/modules/realtime/services/realtime.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;AAAA,2CAQwB;AACxB,2CAA+C;AAC/C,qCAAyC;AACzC,mCAAoC;AACpC,sDA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,OAAO,GAAG,EAAE,CAAC;YACd,IAAI,CAAC,MAAM,CAAC,KAAK,CAChB,qCAAqC,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,CACvF,CAAC;QACH,CAAC;IACF,CAAC;IAEO,iBAAiB,CAAC,IAAY;QACrC,MAAM,EAAE,GAAG,mDAA8B,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC;QAC1E,IAAI,CAAC,EAAE,IAAI,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;YACrD,MAAM,IAAI,4BAAmB,CAAC,kBAAkB,IAAI,sBAAsB,CAAC,CAAC;QAC7E,CAAC;IACF,CAAC;IAEO,eAAe,CAAC,KAAa;QACpC,IAAI,CAAC,KAAK,IAAI,KAAK,CAAC,MAAM,GAAG,GAAG,IAAI,CAAC,4BAA4B,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;YAC/E,MAAM,IAAI,4BAAmB,CAAC,6BAA6B,CAAC,CAAC;QAC9D,CAAC;IACF,CAAC;CACD,CAAA;AAxXY,0CAAe;0BAAf,eAAe;IAD3B,IAAA,mBAAU,GAAE;IAqBV,WAAA,IAAA,eAAM,EAAC,2BAAY,CAAC,CAAA;IACpB,WAAA,IAAA,iBAAQ,GAAE,CAAA;qCAPkB,gBAAU;QACA,6CAAoB;QAChC,mDAAuB;QACpB,0DAA0B;QAC7B,kCAAe;QACV,sBAAa;QACC,iBAAO;QACd,gCAAc;GArB1C,eAAe,CAwX3B"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import type { RequestUser } from '../../../common/interfaces/request-user';
|
|
2
|
+
import { REALTIME_ENVELOPE_VERSION } from '../constants/realtime.constants';
|
|
3
|
+
export interface RealtimeEnvelope<T = unknown> {
|
|
4
|
+
v: typeof REALTIME_ENVELOPE_VERSION;
|
|
5
|
+
event: string;
|
|
6
|
+
payload: T;
|
|
7
|
+
eventId?: string;
|
|
8
|
+
at: string;
|
|
9
|
+
}
|
|
10
|
+
export interface RealtimeEmitOptions {
|
|
11
|
+
eventId?: string;
|
|
12
|
+
/** Skip emit when over size/rate limits (default true → drop + metric). */
|
|
13
|
+
dropOnLimit?: boolean;
|
|
14
|
+
/**
|
|
15
|
+
* Apply per-user server-emit rate limit. Default false — server pushes
|
|
16
|
+
* (notifications, domain events) should not be silently dropped.
|
|
17
|
+
*/
|
|
18
|
+
rateLimit?: boolean;
|
|
19
|
+
}
|
|
20
|
+
/** Public presence view — never includes raw socket IDs. */
|
|
21
|
+
export interface RealtimePresence {
|
|
22
|
+
userId: string;
|
|
23
|
+
online: boolean;
|
|
24
|
+
connectionCount: number;
|
|
25
|
+
lastSeenAt: string | null;
|
|
26
|
+
}
|
|
27
|
+
export interface RealtimeSocketData {
|
|
28
|
+
user: RequestUser;
|
|
29
|
+
connectedAt: number;
|
|
30
|
+
/** Exp (unix seconds) from access token for reauth/expiry checks. */
|
|
31
|
+
tokenExp?: number;
|
|
32
|
+
}
|
|
33
|
+
export type RealtimeControlMessage = {
|
|
34
|
+
op: 'disconnect_user';
|
|
35
|
+
userId: string;
|
|
36
|
+
reason?: string;
|
|
37
|
+
origin?: string;
|
|
38
|
+
} | {
|
|
39
|
+
op: 'disconnect_family';
|
|
40
|
+
familyId: string;
|
|
41
|
+
reason?: string;
|
|
42
|
+
origin?: string;
|
|
43
|
+
};
|
|
44
|
+
export type RealtimeDisconnectReason = string;
|
|
45
|
+
export type RealtimeInboundHandler = (user: RequestUser, payload: unknown, meta: {
|
|
46
|
+
socketId: string;
|
|
47
|
+
event: string;
|
|
48
|
+
}) => void | Promise<void>;
|
|
49
|
+
export declare function buildEnvelope<T>(event: string, payload: T, eventId?: string): RealtimeEnvelope<T>;
|
|
50
|
+
//# sourceMappingURL=realtime.types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"realtime.types.d.ts","sourceRoot":"","sources":["../../../../src/modules/realtime/types/realtime.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yCAAyC,CAAC;AAC3E,OAAO,EAAE,yBAAyB,EAAE,MAAM,iCAAiC,CAAC;AAE5E,MAAM,WAAW,gBAAgB,CAAC,CAAC,GAAG,OAAO;IAC5C,CAAC,EAAE,OAAO,yBAAyB,CAAC;IACpC,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,CAAC,CAAC;IACX,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,EAAE,EAAE,MAAM,CAAC;CACX;AAED,MAAM,WAAW,mBAAmB;IACnC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,2EAA2E;IAC3E,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB;;;OAGG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,4DAA4D;AAC5D,MAAM,WAAW,gBAAgB;IAChC,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,OAAO,CAAC;IAChB,eAAe,EAAE,MAAM,CAAC;IACxB,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;CAC1B;AAED,MAAM,WAAW,kBAAkB;IAClC,IAAI,EAAE,WAAW,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,qEAAqE;IACrE,QAAQ,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,MAAM,sBAAsB,GAC/B;IAAE,EAAE,EAAE,iBAAiB,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,GAC3E;IAAE,EAAE,EAAE,mBAAmB,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AAEnF,MAAM,MAAM,wBAAwB,GAAG,MAAM,CAAC;AAE9C,MAAM,MAAM,sBAAsB,GAAG,CACpC,IAAI,EAAE,WAAW,EACjB,OAAO,EAAE,OAAO,EAChB,IAAI,EAAE;IAAE,QAAQ,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,KACrC,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;AAE1B,wBAAgB,aAAa,CAAC,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,gBAAgB,CAAC,CAAC,CAAC,CAQjG"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.buildEnvelope = buildEnvelope;
|
|
4
|
+
const realtime_constants_1 = require("../constants/realtime.constants");
|
|
5
|
+
function buildEnvelope(event, payload, eventId) {
|
|
6
|
+
return {
|
|
7
|
+
v: realtime_constants_1.REALTIME_ENVELOPE_VERSION,
|
|
8
|
+
event,
|
|
9
|
+
payload,
|
|
10
|
+
...(eventId ? { eventId } : {}),
|
|
11
|
+
at: new Date().toISOString(),
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=realtime.types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"realtime.types.js","sourceRoot":"","sources":["../../../../src/modules/realtime/types/realtime.types.ts"],"names":[],"mappings":";;AAiDA,sCAQC;AAxDD,wEAA4E;AAgD5E,SAAgB,aAAa,CAAI,KAAa,EAAE,OAAU,EAAE,OAAgB;IAC3E,OAAO;QACN,CAAC,EAAE,8CAAyB;QAC5B,KAAK;QACL,OAAO;QACP,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAC/B,EAAE,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;KAC5B,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"handshake-error.util.d.ts","sourceRoot":"","sources":["../../../../src/modules/realtime/utils/handshake-error.util.ts"],"names":[],"mappings":"AAIA;;GAEG;AACH,wBAAgB,yBAAyB,CAAC,GAAG,EAAE,OAAO,GAAG,MAAM,CAyB9D"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.mapRealtimeHandshakeError = mapRealtimeHandshakeError;
|
|
4
|
+
const common_1 = require("@nestjs/common");
|
|
5
|
+
const realtime_constants_1 = require("../constants/realtime.constants");
|
|
6
|
+
/**
|
|
7
|
+
* Map auth failures from {@link AccessTokenValidator} / JWT verify onto client close codes.
|
|
8
|
+
*/
|
|
9
|
+
function mapRealtimeHandshakeError(err) {
|
|
10
|
+
if (err instanceof Error && err.message === realtime_constants_1.REALTIME_CLOSE_CODES.UNAUTHORIZED) {
|
|
11
|
+
return realtime_constants_1.REALTIME_CLOSE_CODES.UNAUTHORIZED;
|
|
12
|
+
}
|
|
13
|
+
if (err instanceof Error && err.message === realtime_constants_1.REALTIME_CLOSE_CODES.TOKEN_EXPIRED) {
|
|
14
|
+
return realtime_constants_1.REALTIME_CLOSE_CODES.TOKEN_EXPIRED;
|
|
15
|
+
}
|
|
16
|
+
if (err instanceof Error && err.message === realtime_constants_1.REALTIME_CLOSE_CODES.SESSION_REVOKED) {
|
|
17
|
+
return realtime_constants_1.REALTIME_CLOSE_CODES.SESSION_REVOKED;
|
|
18
|
+
}
|
|
19
|
+
const msg = err instanceof common_1.UnauthorizedException
|
|
20
|
+
? extractUnauthorizedMessage(err)
|
|
21
|
+
: err instanceof Error
|
|
22
|
+
? err.message
|
|
23
|
+
: String(err);
|
|
24
|
+
if (/session has been revoked|token has been revoked|outdated/i.test(msg)) {
|
|
25
|
+
return realtime_constants_1.REALTIME_CLOSE_CODES.SESSION_REVOKED;
|
|
26
|
+
}
|
|
27
|
+
if (/expired/i.test(msg)) {
|
|
28
|
+
return realtime_constants_1.REALTIME_CLOSE_CODES.TOKEN_EXPIRED;
|
|
29
|
+
}
|
|
30
|
+
return realtime_constants_1.REALTIME_CLOSE_CODES.UNAUTHORIZED;
|
|
31
|
+
}
|
|
32
|
+
function extractUnauthorizedMessage(err) {
|
|
33
|
+
const response = err.getResponse();
|
|
34
|
+
if (typeof response === 'string')
|
|
35
|
+
return response;
|
|
36
|
+
if (response && typeof response === 'object' && 'message' in response) {
|
|
37
|
+
const message = response.message;
|
|
38
|
+
if (typeof message === 'string')
|
|
39
|
+
return message;
|
|
40
|
+
if (Array.isArray(message))
|
|
41
|
+
return message.map(String).join(' ');
|
|
42
|
+
}
|
|
43
|
+
return err.message;
|
|
44
|
+
}
|
|
45
|
+
//# sourceMappingURL=handshake-error.util.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"handshake-error.util.js","sourceRoot":"","sources":["../../../../src/modules/realtime/utils/handshake-error.util.ts"],"names":[],"mappings":";;AAOA,8DAyBC;AAhCD,2CAAuD;AAEvD,wEAAuE;AAEvE;;GAEG;AACH,SAAgB,yBAAyB,CAAC,GAAY;IACrD,IAAI,GAAG,YAAY,KAAK,IAAI,GAAG,CAAC,OAAO,KAAK,yCAAoB,CAAC,YAAY,EAAE,CAAC;QAC/E,OAAO,yCAAoB,CAAC,YAAY,CAAC;IAC1C,CAAC;IACD,IAAI,GAAG,YAAY,KAAK,IAAI,GAAG,CAAC,OAAO,KAAK,yCAAoB,CAAC,aAAa,EAAE,CAAC;QAChF,OAAO,yCAAoB,CAAC,aAAa,CAAC;IAC3C,CAAC;IACD,IAAI,GAAG,YAAY,KAAK,IAAI,GAAG,CAAC,OAAO,KAAK,yCAAoB,CAAC,eAAe,EAAE,CAAC;QAClF,OAAO,yCAAoB,CAAC,eAAe,CAAC;IAC7C,CAAC;IAED,MAAM,GAAG,GACR,GAAG,YAAY,8BAAqB;QACnC,CAAC,CAAC,0BAA0B,CAAC,GAAG,CAAC;QACjC,CAAC,CAAC,GAAG,YAAY,KAAK;YACrB,CAAC,CAAC,GAAG,CAAC,OAAO;YACb,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;IAEjB,IAAI,2DAA2D,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;QAC3E,OAAO,yCAAoB,CAAC,eAAe,CAAC;IAC7C,CAAC;IACD,IAAI,UAAU,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;QAC1B,OAAO,yCAAoB,CAAC,aAAa,CAAC;IAC3C,CAAC;IACD,OAAO,yCAAoB,CAAC,YAAY,CAAC;AAC1C,CAAC;AAED,SAAS,0BAA0B,CAAC,GAA0B;IAC7D,MAAM,QAAQ,GAAG,GAAG,CAAC,WAAW,EAAE,CAAC;IACnC,IAAI,OAAO,QAAQ,KAAK,QAAQ;QAAE,OAAO,QAAQ,CAAC;IAClD,IAAI,QAAQ,IAAI,OAAO,QAAQ,KAAK,QAAQ,IAAI,SAAS,IAAI,QAAQ,EAAE,CAAC;QACvE,MAAM,OAAO,GAAI,QAAkC,CAAC,OAAO,CAAC;QAC5D,IAAI,OAAO,OAAO,KAAK,QAAQ;YAAE,OAAO,OAAO,CAAC;QAChD,IAAI,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC;YAAE,OAAO,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAClE,CAAC;IACD,OAAO,GAAG,CAAC,OAAO,CAAC;AACpB,CAAC"}
|
|
@@ -1,13 +1,14 @@
|
|
|
1
|
+
import { RequestUser } from '../../../common/interfaces/request-user';
|
|
1
2
|
import { CreateModuleDto, UpdateModuleDto } from '../dto';
|
|
2
3
|
import { ModulesService } from '../services';
|
|
3
4
|
export declare class ModulesController {
|
|
4
5
|
private readonly modulesService;
|
|
5
6
|
constructor(modulesService: ModulesService);
|
|
6
|
-
create(dto: CreateModuleDto): Promise<import("..").FeatureModule>;
|
|
7
|
+
create(dto: CreateModuleDto, actor: RequestUser): Promise<import("..").FeatureModule>;
|
|
7
8
|
findAll(): Promise<import("..").FeatureModule[]>;
|
|
8
9
|
findOne(id: string): Promise<import("..").FeatureModule>;
|
|
9
|
-
update(id: string, dto: UpdateModuleDto): Promise<import("..").FeatureModule>;
|
|
10
|
-
delete(id: string): Promise<{
|
|
10
|
+
update(id: string, dto: UpdateModuleDto, actor: RequestUser): Promise<import("..").FeatureModule>;
|
|
11
|
+
delete(id: string, actor: RequestUser): Promise<{
|
|
11
12
|
message: string;
|
|
12
13
|
}>;
|
|
13
14
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"modules.controller.d.ts","sourceRoot":"","sources":["../../../../src/modules/roles/controllers/modules.controller.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"modules.controller.d.ts","sourceRoot":"","sources":["../../../../src/modules/roles/controllers/modules.controller.ts"],"names":[],"mappings":"AAeA,OAAO,EAAE,WAAW,EAAE,MAAM,yCAAyC,CAAC;AACtE,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,QAAQ,CAAC;AAE1D,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAE7C,qBAEa,iBAAiB;IACjB,OAAO,CAAC,QAAQ,CAAC,cAAc;gBAAd,cAAc,EAAE,cAAc;IAI3D,MAAM,CAAS,GAAG,EAAE,eAAe,EAAiB,KAAK,EAAE,WAAW;IAMtE,OAAO;IAMP,OAAO,CAA6B,EAAE,EAAE,MAAM;IAM9C,MAAM,CACuB,EAAE,EAAE,MAAM,EAC9B,GAAG,EAAE,eAAe,EACb,KAAK,EAAE,WAAW;IAO5B,MAAM,CAA6B,EAAE,EAAE,MAAM,EAAiB,KAAK,EAAE,WAAW;;;CAItF"}
|
|
@@ -14,16 +14,19 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
15
|
exports.ModulesController = void 0;
|
|
16
16
|
const common_1 = require("@nestjs/common");
|
|
17
|
+
const decorators_1 = require("../../../common/decorators");
|
|
17
18
|
const auth_guard_1 = require("../../../common/guards/auth.guard");
|
|
19
|
+
const permissions_guard_1 = require("../../../common/guards/permissions.guard");
|
|
18
20
|
const dto_1 = require("../dto");
|
|
21
|
+
const roles_manifest_1 = require("../roles.manifest");
|
|
19
22
|
const services_1 = require("../services");
|
|
20
23
|
let ModulesController = class ModulesController {
|
|
21
24
|
modulesService;
|
|
22
25
|
constructor(modulesService) {
|
|
23
26
|
this.modulesService = modulesService;
|
|
24
27
|
}
|
|
25
|
-
create(dto) {
|
|
26
|
-
return this.modulesService.create(dto);
|
|
28
|
+
create(dto, actor) {
|
|
29
|
+
return this.modulesService.create(dto, actor.id);
|
|
27
30
|
}
|
|
28
31
|
findAll() {
|
|
29
32
|
return this.modulesService.findAll();
|
|
@@ -31,30 +34,34 @@ let ModulesController = class ModulesController {
|
|
|
31
34
|
findOne(id) {
|
|
32
35
|
return this.modulesService.findById(id);
|
|
33
36
|
}
|
|
34
|
-
update(id, dto) {
|
|
35
|
-
return this.modulesService.update(id, dto);
|
|
37
|
+
update(id, dto, actor) {
|
|
38
|
+
return this.modulesService.update(id, dto, actor.id);
|
|
36
39
|
}
|
|
37
|
-
async delete(id) {
|
|
38
|
-
await this.modulesService.delete(id);
|
|
40
|
+
async delete(id, actor) {
|
|
41
|
+
await this.modulesService.delete(id, actor.id);
|
|
39
42
|
return { message: 'Module deleted' };
|
|
40
43
|
}
|
|
41
44
|
};
|
|
42
45
|
exports.ModulesController = ModulesController;
|
|
43
46
|
__decorate([
|
|
44
47
|
(0, common_1.Post)(),
|
|
48
|
+
(0, decorators_1.RequirePermission)(roles_manifest_1.ROLES_PERMISSIONS.MODULES_MANAGE),
|
|
45
49
|
__param(0, (0, common_1.Body)()),
|
|
50
|
+
__param(1, (0, decorators_1.CurrentUser)()),
|
|
46
51
|
__metadata("design:type", Function),
|
|
47
|
-
__metadata("design:paramtypes", [dto_1.CreateModuleDto]),
|
|
52
|
+
__metadata("design:paramtypes", [dto_1.CreateModuleDto, Object]),
|
|
48
53
|
__metadata("design:returntype", void 0)
|
|
49
54
|
], ModulesController.prototype, "create", null);
|
|
50
55
|
__decorate([
|
|
51
56
|
(0, common_1.Get)(),
|
|
57
|
+
(0, decorators_1.RequirePermission)(roles_manifest_1.ROLES_PERMISSIONS.READ),
|
|
52
58
|
__metadata("design:type", Function),
|
|
53
59
|
__metadata("design:paramtypes", []),
|
|
54
60
|
__metadata("design:returntype", void 0)
|
|
55
61
|
], ModulesController.prototype, "findAll", null);
|
|
56
62
|
__decorate([
|
|
57
63
|
(0, common_1.Get)(':id'),
|
|
64
|
+
(0, decorators_1.RequirePermission)(roles_manifest_1.ROLES_PERMISSIONS.READ),
|
|
58
65
|
__param(0, (0, common_1.Param)('id', common_1.ParseUUIDPipe)),
|
|
59
66
|
__metadata("design:type", Function),
|
|
60
67
|
__metadata("design:paramtypes", [String]),
|
|
@@ -62,22 +69,26 @@ __decorate([
|
|
|
62
69
|
], ModulesController.prototype, "findOne", null);
|
|
63
70
|
__decorate([
|
|
64
71
|
(0, common_1.Patch)(':id'),
|
|
72
|
+
(0, decorators_1.RequirePermission)(roles_manifest_1.ROLES_PERMISSIONS.MODULES_MANAGE),
|
|
65
73
|
__param(0, (0, common_1.Param)('id', common_1.ParseUUIDPipe)),
|
|
66
74
|
__param(1, (0, common_1.Body)()),
|
|
75
|
+
__param(2, (0, decorators_1.CurrentUser)()),
|
|
67
76
|
__metadata("design:type", Function),
|
|
68
|
-
__metadata("design:paramtypes", [String, dto_1.UpdateModuleDto]),
|
|
77
|
+
__metadata("design:paramtypes", [String, dto_1.UpdateModuleDto, Object]),
|
|
69
78
|
__metadata("design:returntype", void 0)
|
|
70
79
|
], ModulesController.prototype, "update", null);
|
|
71
80
|
__decorate([
|
|
72
81
|
(0, common_1.Delete)(':id'),
|
|
82
|
+
(0, decorators_1.RequirePermission)(roles_manifest_1.ROLES_PERMISSIONS.MODULES_MANAGE),
|
|
73
83
|
__param(0, (0, common_1.Param)('id', common_1.ParseUUIDPipe)),
|
|
84
|
+
__param(1, (0, decorators_1.CurrentUser)()),
|
|
74
85
|
__metadata("design:type", Function),
|
|
75
|
-
__metadata("design:paramtypes", [String]),
|
|
86
|
+
__metadata("design:paramtypes", [String, Object]),
|
|
76
87
|
__metadata("design:returntype", Promise)
|
|
77
88
|
], ModulesController.prototype, "delete", null);
|
|
78
89
|
exports.ModulesController = ModulesController = __decorate([
|
|
79
90
|
(0, common_1.Controller)('modules'),
|
|
80
|
-
(0, common_1.UseGuards)(auth_guard_1.JwtAuthGuard),
|
|
91
|
+
(0, common_1.UseGuards)(auth_guard_1.JwtAuthGuard, permissions_guard_1.PermissionsGuard),
|
|
81
92
|
__metadata("design:paramtypes", [services_1.ModulesService])
|
|
82
93
|
], ModulesController);
|
|
83
94
|
//# sourceMappingURL=modules.controller.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"modules.controller.js","sourceRoot":"","sources":["../../../../src/modules/roles/controllers/modules.controller.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAUwB;AAExB,kEAAiE;AACjE,gCAA0D;AAC1D,0CAA6C;AAItC,IAAM,iBAAiB,GAAvB,MAAM,iBAAiB;IACA;IAA7B,YAA6B,cAA8B;QAA9B,mBAAc,GAAd,cAAc,CAAgB;IAAG,CAAC;
|
|
1
|
+
{"version":3,"file":"modules.controller.js","sourceRoot":"","sources":["../../../../src/modules/roles/controllers/modules.controller.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAUwB;AAExB,2DAA4E;AAC5E,kEAAiE;AACjE,gFAA4E;AAE5E,gCAA0D;AAC1D,sDAAs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