@colveor/core 1.0.1 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +23 -0
- package/README.md +6 -0
- package/dist/bootstrap/bootstrap-colveor-app.d.ts.map +1 -1
- package/dist/bootstrap/bootstrap-colveor-app.js +22 -3
- package/dist/bootstrap/bootstrap-colveor-app.js.map +1 -1
- package/dist/common/decorators/index.d.ts +6 -0
- package/dist/common/decorators/index.d.ts.map +1 -1
- package/dist/common/decorators/index.js +8 -1
- package/dist/common/decorators/index.js.map +1 -1
- package/dist/common/decorators/ip-rate-limit-bucket.decorator.d.ts +9 -0
- package/dist/common/decorators/ip-rate-limit-bucket.decorator.d.ts.map +1 -0
- package/dist/common/decorators/ip-rate-limit-bucket.decorator.js +12 -0
- package/dist/common/decorators/ip-rate-limit-bucket.decorator.js.map +1 -0
- package/dist/common/guards/login-ip-rate-limit.guard.d.ts +12 -6
- package/dist/common/guards/login-ip-rate-limit.guard.d.ts.map +1 -1
- package/dist/common/guards/login-ip-rate-limit.guard.js +65 -21
- package/dist/common/guards/login-ip-rate-limit.guard.js.map +1 -1
- package/dist/common/guards/otp-ip-rate-limit.guard.d.ts +3 -2
- package/dist/common/guards/otp-ip-rate-limit.guard.d.ts.map +1 -1
- package/dist/common/guards/otp-ip-rate-limit.guard.js +17 -15
- package/dist/common/guards/otp-ip-rate-limit.guard.js.map +1 -1
- package/dist/common/guards/permissions.guard.d.ts.map +1 -1
- package/dist/common/guards/permissions.guard.js +12 -2
- package/dist/common/guards/permissions.guard.js.map +1 -1
- package/dist/common/interceptors/timeout.interceptor.d.ts +1 -1
- package/dist/common/interceptors/timeout.interceptor.d.ts.map +1 -1
- package/dist/common/interceptors/timeout.interceptor.js +5 -1
- package/dist/common/interceptors/timeout.interceptor.js.map +1 -1
- package/dist/common/interfaces/request-user.d.ts +4 -3
- package/dist/common/interfaces/request-user.d.ts.map +1 -1
- package/dist/common/utils/cache-version.util.d.ts +12 -0
- package/dist/common/utils/cache-version.util.d.ts.map +1 -0
- package/dist/common/utils/cache-version.util.js +34 -0
- package/dist/common/utils/cache-version.util.js.map +1 -0
- package/dist/common/utils/postgres-error.util.d.ts +5 -0
- package/dist/common/utils/postgres-error.util.d.ts.map +1 -0
- package/dist/common/utils/postgres-error.util.js +13 -0
- package/dist/common/utils/postgres-error.util.js.map +1 -0
- package/dist/common/utils/singleflight.util.d.ts +6 -0
- package/dist/common/utils/singleflight.util.d.ts.map +1 -0
- package/dist/common/utils/singleflight.util.js +21 -0
- package/dist/common/utils/singleflight.util.js.map +1 -0
- package/dist/common/validators/is-exclusive-auth-params.validator.js +1 -1
- package/dist/common/validators/is-exclusive-auth-params.validator.js.map +1 -1
- package/dist/common/validators/is-exclusive-delete-confirm-params.validator.js +1 -1
- package/dist/common/validators/is-exclusive-delete-confirm-params.validator.js.map +1 -1
- package/dist/config/app.config.d.ts +38 -0
- package/dist/config/app.config.d.ts.map +1 -1
- package/dist/config/app.config.js +24 -0
- package/dist/config/app.config.js.map +1 -1
- package/dist/config/database.config.d.ts +6 -0
- package/dist/config/database.config.d.ts.map +1 -1
- package/dist/config/database.config.js +3 -0
- package/dist/config/database.config.js.map +1 -1
- package/dist/config/env-flags.util.d.ts +4 -0
- package/dist/config/env-flags.util.d.ts.map +1 -1
- package/dist/config/env-flags.util.js +7 -0
- package/dist/config/env-flags.util.js.map +1 -1
- package/dist/config/env.validation.d.ts +24 -1
- package/dist/config/env.validation.d.ts.map +1 -1
- package/dist/config/env.validation.js +92 -2
- package/dist/config/env.validation.js.map +1 -1
- package/dist/config/in-memory-redis.client.d.ts +23 -4
- package/dist/config/in-memory-redis.client.d.ts.map +1 -1
- package/dist/config/in-memory-redis.client.js +148 -4
- package/dist/config/in-memory-redis.client.js.map +1 -1
- package/dist/config/redis.module.d.ts.map +1 -1
- package/dist/config/redis.module.js +5 -0
- package/dist/config/redis.module.js.map +1 -1
- package/dist/core.module.d.ts +5 -0
- package/dist/core.module.d.ts.map +1 -1
- package/dist/core.module.js +5 -0
- package/dist/core.module.js.map +1 -1
- package/dist/database/migrations/1785006199371-auth-mfa-oauth.d.ts +7 -0
- package/dist/database/migrations/1785006199371-auth-mfa-oauth.d.ts.map +1 -0
- package/dist/database/migrations/1785006199371-auth-mfa-oauth.js +24 -0
- package/dist/database/migrations/1785006199371-auth-mfa-oauth.js.map +1 -0
- package/dist/database/migrations/1785006199372-auth-mfa-backup-codes.d.ts +7 -0
- package/dist/database/migrations/1785006199372-auth-mfa-backup-codes.d.ts.map +1 -0
- package/dist/database/migrations/1785006199372-auth-mfa-backup-codes.js +16 -0
- package/dist/database/migrations/1785006199372-auth-mfa-backup-codes.js.map +1 -0
- package/dist/database/migrations/1785006199373-auth-gap-fixes.d.ts +7 -0
- package/dist/database/migrations/1785006199373-auth-gap-fixes.d.ts.map +1 -0
- package/dist/database/migrations/1785006199373-auth-gap-fixes.js +14 -0
- package/dist/database/migrations/1785006199373-auth-gap-fixes.js.map +1 -0
- package/dist/database/migrations/1785006199374-auth-sessions-indexes.d.ts +13 -0
- package/dist/database/migrations/1785006199374-auth-sessions-indexes.d.ts.map +1 -0
- package/dist/database/migrations/1785006199374-auth-sessions-indexes.js +35 -0
- package/dist/database/migrations/1785006199374-auth-sessions-indexes.js.map +1 -0
- package/dist/database/migrations/1785006199375-auth-identity-and-audit.d.ts +11 -0
- package/dist/database/migrations/1785006199375-auth-identity-and-audit.d.ts.map +1 -0
- package/dist/database/migrations/1785006199375-auth-identity-and-audit.js +60 -0
- package/dist/database/migrations/1785006199375-auth-identity-and-audit.js.map +1 -0
- package/dist/database/migrations/1785006199376-auth-settings-security-defaults.d.ts +14 -0
- package/dist/database/migrations/1785006199376-auth-settings-security-defaults.d.ts.map +1 -0
- package/dist/database/migrations/1785006199376-auth-settings-security-defaults.js +39 -0
- package/dist/database/migrations/1785006199376-auth-settings-security-defaults.js.map +1 -0
- package/dist/database/migrations/1785006199377-auth-security-hardening.d.ts +13 -0
- package/dist/database/migrations/1785006199377-auth-security-hardening.d.ts.map +1 -0
- package/dist/database/migrations/1785006199377-auth-security-hardening.js +69 -0
- package/dist/database/migrations/1785006199377-auth-security-hardening.js.map +1 -0
- package/dist/database/migrations/1785006199378-auth-family-denylist-and-hardening.d.ts +11 -0
- package/dist/database/migrations/1785006199378-auth-family-denylist-and-hardening.d.ts.map +1 -0
- package/dist/database/migrations/1785006199378-auth-family-denylist-and-hardening.js +51 -0
- package/dist/database/migrations/1785006199378-auth-family-denylist-and-hardening.js.map +1 -0
- package/dist/database/migrations/1785006199379-authz-lifecycle-hardening.d.ts +12 -0
- package/dist/database/migrations/1785006199379-authz-lifecycle-hardening.d.ts.map +1 -0
- package/dist/database/migrations/1785006199379-authz-lifecycle-hardening.js +37 -0
- package/dist/database/migrations/1785006199379-authz-lifecycle-hardening.js.map +1 -0
- package/dist/database/migrations/1785006199380-auth-remaining-gaps.d.ts +12 -0
- package/dist/database/migrations/1785006199380-auth-remaining-gaps.d.ts.map +1 -0
- package/dist/database/migrations/1785006199380-auth-remaining-gaps.js +74 -0
- package/dist/database/migrations/1785006199380-auth-remaining-gaps.js.map +1 -0
- package/dist/database/migrations/1785006199381-settings-blast-radius.d.ts +12 -0
- package/dist/database/migrations/1785006199381-settings-blast-radius.d.ts.map +1 -0
- package/dist/database/migrations/1785006199381-settings-blast-radius.js +52 -0
- package/dist/database/migrations/1785006199381-settings-blast-radius.js.map +1 -0
- package/dist/database/migrations/1785006199382-oauth-client-ids-lock.d.ts +11 -0
- package/dist/database/migrations/1785006199382-oauth-client-ids-lock.d.ts.map +1 -0
- package/dist/database/migrations/1785006199382-oauth-client-ids-lock.js +36 -0
- package/dist/database/migrations/1785006199382-oauth-client-ids-lock.js.map +1 -0
- package/dist/database/migrations/1785006199383-settings-role-and-verified-lock.d.ts +12 -0
- package/dist/database/migrations/1785006199383-settings-role-and-verified-lock.d.ts.map +1 -0
- package/dist/database/migrations/1785006199383-settings-role-and-verified-lock.js +39 -0
- package/dist/database/migrations/1785006199383-settings-role-and-verified-lock.js.map +1 -0
- package/dist/database/migrations/1785006199384-settings-providers-and-test-otp-lock.d.ts +12 -0
- package/dist/database/migrations/1785006199384-settings-providers-and-test-otp-lock.d.ts.map +1 -0
- package/dist/database/migrations/1785006199384-settings-providers-and-test-otp-lock.js +39 -0
- package/dist/database/migrations/1785006199384-settings-providers-and-test-otp-lock.js.map +1 -0
- package/dist/database/migrations/1785006199385-settings-auth-surface-lock.d.ts +13 -0
- package/dist/database/migrations/1785006199385-settings-auth-surface-lock.d.ts.map +1 -0
- package/dist/database/migrations/1785006199385-settings-auth-surface-lock.js +72 -0
- package/dist/database/migrations/1785006199385-settings-auth-surface-lock.js.map +1 -0
- package/dist/database/migrations/1785006199386-audit-events.d.ts +10 -0
- package/dist/database/migrations/1785006199386-audit-events.d.ts.map +1 -0
- package/dist/database/migrations/1785006199386-audit-events.js +60 -0
- package/dist/database/migrations/1785006199386-audit-events.js.map +1 -0
- package/dist/database/migrations/1785006199387-audit-resource-id-varchar.d.ts +10 -0
- package/dist/database/migrations/1785006199387-audit-resource-id-varchar.d.ts.map +1 -0
- package/dist/database/migrations/1785006199387-audit-resource-id-varchar.js +25 -0
- package/dist/database/migrations/1785006199387-audit-resource-id-varchar.js.map +1 -0
- package/dist/database/migrations/1785006199388-audit-enterprise.d.ts +11 -0
- package/dist/database/migrations/1785006199388-audit-enterprise.d.ts.map +1 -0
- package/dist/database/migrations/1785006199388-audit-enterprise.js +157 -0
- package/dist/database/migrations/1785006199388-audit-enterprise.js.map +1 -0
- package/dist/database/migrations/1785006199389-drop-admin-logs.d.ts +10 -0
- package/dist/database/migrations/1785006199389-drop-admin-logs.d.ts.map +1 -0
- package/dist/database/migrations/1785006199389-drop-admin-logs.js +38 -0
- package/dist/database/migrations/1785006199389-drop-admin-logs.js.map +1 -0
- package/dist/database/migrations/1785006199390-audit-hardening.d.ts +14 -0
- package/dist/database/migrations/1785006199390-audit-hardening.d.ts.map +1 -0
- package/dist/database/migrations/1785006199390-audit-hardening.js +345 -0
- package/dist/database/migrations/1785006199390-audit-hardening.js.map +1 -0
- package/dist/database/migrations/1785006199391-audit-owner-schema-create.d.ts +10 -0
- package/dist/database/migrations/1785006199391-audit-owner-schema-create.d.ts.map +1 -0
- package/dist/database/migrations/1785006199391-audit-owner-schema-create.js +39 -0
- package/dist/database/migrations/1785006199391-audit-owner-schema-create.js.map +1 -0
- package/dist/database/migrations/1785006199392-profile-photo-url.d.ts +11 -0
- package/dist/database/migrations/1785006199392-profile-photo-url.d.ts.map +1 -0
- package/dist/database/migrations/1785006199392-profile-photo-url.js +33 -0
- package/dist/database/migrations/1785006199392-profile-photo-url.js.map +1 -0
- package/dist/database/migrations/1785006199393-profile-cover-url.d.ts +11 -0
- package/dist/database/migrations/1785006199393-profile-cover-url.d.ts.map +1 -0
- package/dist/database/migrations/1785006199393-profile-cover-url.js +33 -0
- package/dist/database/migrations/1785006199393-profile-cover-url.js.map +1 -0
- package/dist/database/migrations/1785006199394-profile-is-public-default-false.d.ts +11 -0
- package/dist/database/migrations/1785006199394-profile-is-public-default-false.d.ts.map +1 -0
- package/dist/database/migrations/1785006199394-profile-is-public-default-false.js +24 -0
- package/dist/database/migrations/1785006199394-profile-is-public-default-false.js.map +1 -0
- package/dist/database/migrations/1785006199395-delivery-scale-indexes.d.ts +10 -0
- package/dist/database/migrations/1785006199395-delivery-scale-indexes.d.ts.map +1 -0
- package/dist/database/migrations/1785006199395-delivery-scale-indexes.js +35 -0
- package/dist/database/migrations/1785006199395-delivery-scale-indexes.js.map +1 -0
- package/dist/database/migrations/1785006199396-delivery-recipient-index.d.ts +11 -0
- package/dist/database/migrations/1785006199396-delivery-recipient-index.d.ts.map +1 -0
- package/dist/database/migrations/1785006199396-delivery-recipient-index.js +23 -0
- package/dist/database/migrations/1785006199396-delivery-recipient-index.js.map +1 -0
- package/dist/database/seeds/roles.seed.d.ts +6 -0
- package/dist/database/seeds/roles.seed.d.ts.map +1 -1
- package/dist/database/seeds/roles.seed.js +22 -5
- package/dist/database/seeds/roles.seed.js.map +1 -1
- package/dist/database/seeds/settings.seed.d.ts +5 -0
- package/dist/database/seeds/settings.seed.d.ts.map +1 -1
- package/dist/database/seeds/settings.seed.js +500 -25
- package/dist/database/seeds/settings.seed.js.map +1 -1
- package/dist/database/seeds/templates/html-template.reader.d.ts +1 -0
- package/dist/database/seeds/templates/html-template.reader.d.ts.map +1 -1
- package/dist/database/seeds/templates/html-template.reader.js +3 -1
- package/dist/database/seeds/templates/html-template.reader.js.map +1 -1
- package/dist/database/seeds/templates/html-template.reader.ts +5 -1
- package/dist/database/typeorm.util.d.ts.map +1 -1
- package/dist/database/typeorm.util.js +6 -0
- package/dist/database/typeorm.util.js.map +1 -1
- package/dist/index.d.ts +8 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +39 -4
- package/dist/index.js.map +1 -1
- package/dist/modules/admin/controllers/admin.controller.d.ts +15 -7
- package/dist/modules/admin/controllers/admin.controller.d.ts.map +1 -1
- package/dist/modules/admin/controllers/admin.controller.js +74 -17
- package/dist/modules/admin/controllers/admin.controller.js.map +1 -1
- package/dist/modules/admin/services/admin-log.service.d.ts +14 -7
- package/dist/modules/admin/services/admin-log.service.d.ts.map +1 -1
- package/dist/modules/admin/services/admin-log.service.js +41 -38
- package/dist/modules/admin/services/admin-log.service.js.map +1 -1
- package/dist/modules/audit/audit.manifest.d.ts +8 -0
- package/dist/modules/audit/audit.manifest.d.ts.map +1 -0
- package/dist/modules/audit/audit.manifest.js +31 -0
- package/dist/modules/audit/audit.manifest.js.map +1 -0
- package/dist/modules/audit/audit.module.d.ts +8 -0
- package/dist/modules/audit/audit.module.d.ts.map +1 -0
- package/dist/modules/audit/audit.module.js +57 -0
- package/dist/modules/audit/audit.module.js.map +1 -0
- package/dist/modules/audit/constants/audit-actions.d.ts +79 -0
- package/dist/modules/audit/constants/audit-actions.d.ts.map +1 -0
- package/dist/modules/audit/constants/audit-actions.js +89 -0
- package/dist/modules/audit/constants/audit-actions.js.map +1 -0
- package/dist/modules/audit/constants/audit-mutation.d.ts +10 -0
- package/dist/modules/audit/constants/audit-mutation.d.ts.map +1 -0
- package/dist/modules/audit/constants/audit-mutation.js +13 -0
- package/dist/modules/audit/constants/audit-mutation.js.map +1 -0
- package/dist/modules/audit/controllers/audit.controller.d.ts +13 -0
- package/dist/modules/audit/controllers/audit.controller.d.ts.map +1 -0
- package/dist/modules/audit/controllers/audit.controller.js +149 -0
- package/dist/modules/audit/controllers/audit.controller.js.map +1 -0
- package/dist/modules/audit/decorators/audit.decorator.d.ts +27 -0
- package/dist/modules/audit/decorators/audit.decorator.d.ts.map +1 -0
- package/dist/modules/audit/decorators/audit.decorator.js +18 -0
- package/dist/modules/audit/decorators/audit.decorator.js.map +1 -0
- package/dist/modules/audit/dto/audit.dto.d.ts +54 -0
- package/dist/modules/audit/dto/audit.dto.d.ts.map +1 -0
- package/dist/modules/audit/dto/audit.dto.js +129 -0
- package/dist/modules/audit/dto/audit.dto.js.map +1 -0
- package/dist/modules/audit/entities/audit-event.entity.d.ts +33 -0
- package/dist/modules/audit/entities/audit-event.entity.d.ts.map +1 -0
- package/dist/modules/audit/entities/audit-event.entity.js +125 -0
- package/dist/modules/audit/entities/audit-event.entity.js.map +1 -0
- package/dist/modules/audit/entities/audit-outbox.entity.d.ts +16 -0
- package/dist/modules/audit/entities/audit-outbox.entity.d.ts.map +1 -0
- package/dist/modules/audit/entities/audit-outbox.entity.js +65 -0
- package/dist/modules/audit/entities/audit-outbox.entity.js.map +1 -0
- package/dist/modules/audit/index.d.ts +13 -0
- package/dist/modules/audit/index.d.ts.map +1 -0
- package/dist/modules/audit/index.js +23 -0
- package/dist/modules/audit/index.js.map +1 -0
- package/dist/modules/audit/interceptors/audit.interceptor.d.ts +11 -0
- package/dist/modules/audit/interceptors/audit.interceptor.d.ts.map +1 -0
- package/dist/modules/audit/interceptors/audit.interceptor.js +75 -0
- package/dist/modules/audit/interceptors/audit.interceptor.js.map +1 -0
- package/dist/modules/audit/listeners/auth-audit.listener.d.ts +31 -0
- package/dist/modules/audit/listeners/auth-audit.listener.d.ts.map +1 -0
- package/dist/modules/audit/listeners/auth-audit.listener.js +338 -0
- package/dist/modules/audit/listeners/auth-audit.listener.js.map +1 -0
- package/dist/modules/audit/services/audit-archive.service.d.ts +28 -0
- package/dist/modules/audit/services/audit-archive.service.d.ts.map +1 -0
- package/dist/modules/audit/services/audit-archive.service.js +132 -0
- package/dist/modules/audit/services/audit-archive.service.js.map +1 -0
- package/dist/modules/audit/services/audit-hash-backfill.service.d.ts +22 -0
- package/dist/modules/audit/services/audit-hash-backfill.service.d.ts.map +1 -0
- package/dist/modules/audit/services/audit-hash-backfill.service.js +79 -0
- package/dist/modules/audit/services/audit-hash-backfill.service.js.map +1 -0
- package/dist/modules/audit/services/audit-leader.service.d.ts +28 -0
- package/dist/modules/audit/services/audit-leader.service.d.ts.map +1 -0
- package/dist/modules/audit/services/audit-leader.service.js +99 -0
- package/dist/modules/audit/services/audit-leader.service.js.map +1 -0
- package/dist/modules/audit/services/audit-outbox.worker.d.ts +29 -0
- package/dist/modules/audit/services/audit-outbox.worker.d.ts.map +1 -0
- package/dist/modules/audit/services/audit-outbox.worker.js +144 -0
- package/dist/modules/audit/services/audit-outbox.worker.js.map +1 -0
- package/dist/modules/audit/services/audit-partition.service.d.ts +18 -0
- package/dist/modules/audit/services/audit-partition.service.d.ts.map +1 -0
- package/dist/modules/audit/services/audit-partition.service.js +70 -0
- package/dist/modules/audit/services/audit-partition.service.js.map +1 -0
- package/dist/modules/audit/services/audit-write.service.d.ts +60 -0
- package/dist/modules/audit/services/audit-write.service.d.ts.map +1 -0
- package/dist/modules/audit/services/audit-write.service.js +463 -0
- package/dist/modules/audit/services/audit-write.service.js.map +1 -0
- package/dist/modules/audit/services/audit.service.d.ts +60 -0
- package/dist/modules/audit/services/audit.service.d.ts.map +1 -0
- package/dist/modules/audit/services/audit.service.js +373 -0
- package/dist/modules/audit/services/audit.service.js.map +1 -0
- package/dist/modules/audit/utils/audit-hash.util.d.ts +20 -0
- package/dist/modules/audit/utils/audit-hash.util.d.ts.map +1 -0
- package/dist/modules/audit/utils/audit-hash.util.js +44 -0
- package/dist/modules/audit/utils/audit-hash.util.js.map +1 -0
- package/dist/modules/auth/auth-core/auth-core.module.d.ts.map +1 -1
- package/dist/modules/auth/auth-core/auth-core.module.js +16 -4
- package/dist/modules/auth/auth-core/auth-core.module.js.map +1 -1
- package/dist/modules/auth/auth-core/constants/jwt-redis.keys.d.ts +22 -0
- package/dist/modules/auth/auth-core/constants/jwt-redis.keys.d.ts.map +1 -0
- package/dist/modules/auth/auth-core/constants/jwt-redis.keys.js +25 -0
- package/dist/modules/auth/auth-core/constants/jwt-redis.keys.js.map +1 -0
- package/dist/modules/auth/auth-core/services/access-token.validator.d.ts +19 -0
- package/dist/modules/auth/auth-core/services/access-token.validator.d.ts.map +1 -0
- package/dist/modules/auth/auth-core/services/access-token.validator.js +110 -0
- package/dist/modules/auth/auth-core/services/access-token.validator.js.map +1 -0
- package/dist/modules/auth/auth-core/services/family-denylist.reader.d.ts +10 -0
- package/dist/modules/auth/auth-core/services/family-denylist.reader.d.ts.map +1 -0
- package/dist/modules/auth/auth-core/services/family-denylist.reader.js +44 -0
- package/dist/modules/auth/auth-core/services/family-denylist.reader.js.map +1 -0
- package/dist/modules/auth/auth-core/services/session-epoch.reader.d.ts +10 -0
- package/dist/modules/auth/auth-core/services/session-epoch.reader.d.ts.map +1 -0
- package/dist/modules/auth/auth-core/services/session-epoch.reader.js +44 -0
- package/dist/modules/auth/auth-core/services/session-epoch.reader.js.map +1 -0
- package/dist/modules/auth/auth-core/strategies/jwt.strategy.d.ts +7 -8
- package/dist/modules/auth/auth-core/strategies/jwt.strategy.d.ts.map +1 -1
- package/dist/modules/auth/auth-core/strategies/jwt.strategy.js +34 -34
- package/dist/modules/auth/auth-core/strategies/jwt.strategy.js.map +1 -1
- package/dist/modules/auth/auth.manifest.d.ts +6 -0
- package/dist/modules/auth/auth.manifest.d.ts.map +1 -1
- package/dist/modules/auth/auth.manifest.js +38 -2
- package/dist/modules/auth/auth.manifest.js.map +1 -1
- package/dist/modules/auth/auth.module.d.ts.map +1 -1
- package/dist/modules/auth/auth.module.js +39 -4
- package/dist/modules/auth/auth.module.js.map +1 -1
- package/dist/modules/auth/controllers/account.controller.d.ts +15 -1
- package/dist/modules/auth/controllers/account.controller.d.ts.map +1 -1
- package/dist/modules/auth/controllers/account.controller.js +65 -7
- package/dist/modules/auth/controllers/account.controller.js.map +1 -1
- package/dist/modules/auth/controllers/auth.controller.d.ts +7 -3
- package/dist/modules/auth/controllers/auth.controller.d.ts.map +1 -1
- package/dist/modules/auth/controllers/auth.controller.js +76 -16
- package/dist/modules/auth/controllers/auth.controller.js.map +1 -1
- package/dist/modules/auth/controllers/forgot-password.controller.d.ts +4 -2
- package/dist/modules/auth/controllers/forgot-password.controller.d.ts.map +1 -1
- package/dist/modules/auth/controllers/forgot-password.controller.js +32 -11
- package/dist/modules/auth/controllers/forgot-password.controller.js.map +1 -1
- package/dist/modules/auth/controllers/mfa.controller.d.ts +18 -0
- package/dist/modules/auth/controllers/mfa.controller.d.ts.map +1 -0
- package/dist/modules/auth/controllers/mfa.controller.js +192 -0
- package/dist/modules/auth/controllers/mfa.controller.js.map +1 -0
- package/dist/modules/auth/controllers/oauth.controller.d.ts +22 -0
- package/dist/modules/auth/controllers/oauth.controller.d.ts.map +1 -0
- package/dist/modules/auth/controllers/oauth.controller.js +192 -0
- package/dist/modules/auth/controllers/oauth.controller.js.map +1 -0
- package/dist/modules/auth/controllers/otp.controller.d.ts +6 -3
- package/dist/modules/auth/controllers/otp.controller.d.ts.map +1 -1
- package/dist/modules/auth/controllers/otp.controller.js +32 -33
- package/dist/modules/auth/controllers/otp.controller.js.map +1 -1
- package/dist/modules/auth/controllers/pin.controller.d.ts.map +1 -1
- package/dist/modules/auth/controllers/pin.controller.js +10 -2
- package/dist/modules/auth/controllers/pin.controller.js.map +1 -1
- package/dist/modules/auth/controllers/session.controller.d.ts +12 -4
- package/dist/modules/auth/controllers/session.controller.d.ts.map +1 -1
- package/dist/modules/auth/controllers/session.controller.js +130 -31
- package/dist/modules/auth/controllers/session.controller.js.map +1 -1
- package/dist/modules/auth/dto/auth-config.dto.d.ts +11 -2
- package/dist/modules/auth/dto/auth-config.dto.d.ts.map +1 -1
- package/dist/modules/auth/dto/auth-config.dto.js +78 -3
- package/dist/modules/auth/dto/auth-config.dto.js.map +1 -1
- package/dist/modules/auth/dto/index.d.ts +2 -0
- package/dist/modules/auth/dto/index.d.ts.map +1 -1
- package/dist/modules/auth/dto/index.js +2 -0
- package/dist/modules/auth/dto/index.js.map +1 -1
- package/dist/modules/auth/dto/login.dto.d.ts +8 -1
- package/dist/modules/auth/dto/login.dto.d.ts.map +1 -1
- package/dist/modules/auth/dto/login.dto.js +48 -3
- package/dist/modules/auth/dto/login.dto.js.map +1 -1
- package/dist/modules/auth/dto/mfa.dto.d.ts +61 -0
- package/dist/modules/auth/dto/mfa.dto.d.ts.map +1 -0
- package/dist/modules/auth/dto/mfa.dto.js +326 -0
- package/dist/modules/auth/dto/mfa.dto.js.map +1 -0
- package/dist/modules/auth/dto/oauth.dto.d.ts +45 -0
- package/dist/modules/auth/dto/oauth.dto.d.ts.map +1 -0
- package/dist/modules/auth/dto/oauth.dto.js +249 -0
- package/dist/modules/auth/dto/oauth.dto.js.map +1 -0
- package/dist/modules/auth/dto/otp.dto.d.ts +3 -1
- package/dist/modules/auth/dto/otp.dto.d.ts.map +1 -1
- package/dist/modules/auth/dto/otp.dto.js +19 -0
- package/dist/modules/auth/dto/otp.dto.js.map +1 -1
- package/dist/modules/auth/dto/password.dto.d.ts +28 -0
- package/dist/modules/auth/dto/password.dto.d.ts.map +1 -1
- package/dist/modules/auth/dto/password.dto.js +191 -5
- package/dist/modules/auth/dto/password.dto.js.map +1 -1
- package/dist/modules/auth/dto/register.dto.d.ts +1 -0
- package/dist/modules/auth/dto/register.dto.d.ts.map +1 -1
- package/dist/modules/auth/dto/register.dto.js +1 -0
- package/dist/modules/auth/dto/register.dto.js.map +1 -1
- package/dist/modules/auth/dto/session.dto.d.ts +20 -0
- package/dist/modules/auth/dto/session.dto.d.ts.map +1 -0
- package/dist/modules/auth/dto/session.dto.js +98 -0
- package/dist/modules/auth/dto/session.dto.js.map +1 -0
- package/dist/modules/auth/dto/token.dto.d.ts +38 -1
- package/dist/modules/auth/dto/token.dto.d.ts.map +1 -1
- package/dist/modules/auth/dto/token.dto.js +21 -1
- package/dist/modules/auth/dto/token.dto.js.map +1 -1
- package/dist/modules/auth/entities/index.d.ts +2 -0
- package/dist/modules/auth/entities/index.d.ts.map +1 -1
- package/dist/modules/auth/entities/index.js +2 -0
- package/dist/modules/auth/entities/index.js.map +1 -1
- package/dist/modules/auth/entities/password-reset-token.entity.d.ts +2 -0
- package/dist/modules/auth/entities/password-reset-token.entity.d.ts.map +1 -1
- package/dist/modules/auth/entities/password-reset-token.entity.js +6 -0
- package/dist/modules/auth/entities/password-reset-token.entity.js.map +1 -1
- package/dist/modules/auth/entities/user-mfa.entity.d.ts +19 -0
- package/dist/modules/auth/entities/user-mfa.entity.d.ts.map +1 -0
- package/dist/modules/auth/entities/user-mfa.entity.js +73 -0
- package/dist/modules/auth/entities/user-mfa.entity.js.map +1 -0
- package/dist/modules/auth/entities/user-oauth-identity.entity.d.ts +24 -0
- package/dist/modules/auth/entities/user-oauth-identity.entity.d.ts.map +1 -0
- package/dist/modules/auth/entities/user-oauth-identity.entity.js +84 -0
- package/dist/modules/auth/entities/user-oauth-identity.entity.js.map +1 -0
- package/dist/modules/auth/events/auth.events.d.ts +84 -19
- package/dist/modules/auth/events/auth.events.d.ts.map +1 -1
- package/dist/modules/auth/events/auth.events.js +17 -9
- package/dist/modules/auth/events/auth.events.js.map +1 -1
- package/dist/modules/auth/services/account.service.d.ts +74 -14
- package/dist/modules/auth/services/account.service.d.ts.map +1 -1
- package/dist/modules/auth/services/account.service.js +247 -31
- package/dist/modules/auth/services/account.service.js.map +1 -1
- package/dist/modules/auth/services/dpop.service.d.ts +41 -0
- package/dist/modules/auth/services/dpop.service.d.ts.map +1 -0
- package/dist/modules/auth/services/dpop.service.js +159 -0
- package/dist/modules/auth/services/dpop.service.js.map +1 -0
- package/dist/modules/auth/services/index.d.ts +2 -0
- package/dist/modules/auth/services/index.d.ts.map +1 -1
- package/dist/modules/auth/services/index.js +2 -0
- package/dist/modules/auth/services/index.js.map +1 -1
- package/dist/modules/auth/services/legacy-hash-cleanup.service.d.ts +28 -0
- package/dist/modules/auth/services/legacy-hash-cleanup.service.d.ts.map +1 -0
- package/dist/modules/auth/services/legacy-hash-cleanup.service.js +163 -0
- package/dist/modules/auth/services/legacy-hash-cleanup.service.js.map +1 -0
- package/dist/modules/auth/services/login.service.d.ts +29 -34
- package/dist/modules/auth/services/login.service.d.ts.map +1 -1
- package/dist/modules/auth/services/login.service.js +173 -61
- package/dist/modules/auth/services/login.service.js.map +1 -1
- package/dist/modules/auth/services/mfa.service.d.ts +111 -0
- package/dist/modules/auth/services/mfa.service.d.ts.map +1 -0
- package/dist/modules/auth/services/mfa.service.js +662 -0
- package/dist/modules/auth/services/mfa.service.js.map +1 -0
- package/dist/modules/auth/services/oauth/apple-id-token.verifier.d.ts +11 -0
- package/dist/modules/auth/services/oauth/apple-id-token.verifier.d.ts.map +1 -0
- package/dist/modules/auth/services/oauth/apple-id-token.verifier.js +56 -0
- package/dist/modules/auth/services/oauth/apple-id-token.verifier.js.map +1 -0
- package/dist/modules/auth/services/oauth/google-id-token.verifier.d.ts +12 -0
- package/dist/modules/auth/services/oauth/google-id-token.verifier.d.ts.map +1 -0
- package/dist/modules/auth/services/oauth/google-id-token.verifier.js +64 -0
- package/dist/modules/auth/services/oauth/google-id-token.verifier.js.map +1 -0
- package/dist/modules/auth/services/oauth/microsoft-id-token.verifier.d.ts +11 -0
- package/dist/modules/auth/services/oauth/microsoft-id-token.verifier.d.ts.map +1 -0
- package/dist/modules/auth/services/oauth/microsoft-id-token.verifier.js +76 -0
- package/dist/modules/auth/services/oauth/microsoft-id-token.verifier.js.map +1 -0
- package/dist/modules/auth/services/oauth/oidc-id-token.verifier.d.ts +16 -0
- package/dist/modules/auth/services/oauth/oidc-id-token.verifier.d.ts.map +1 -0
- package/dist/modules/auth/services/oauth/oidc-id-token.verifier.js +92 -0
- package/dist/modules/auth/services/oauth/oidc-id-token.verifier.js.map +1 -0
- package/dist/modules/auth/services/oauth/verified-oauth-identity.d.ts +9 -0
- package/dist/modules/auth/services/oauth/verified-oauth-identity.d.ts.map +1 -0
- package/dist/modules/auth/services/oauth/verified-oauth-identity.js +3 -0
- package/dist/modules/auth/services/oauth/verified-oauth-identity.js.map +1 -0
- package/dist/modules/auth/services/oauth.service.d.ts +83 -0
- package/dist/modules/auth/services/oauth.service.d.ts.map +1 -0
- package/dist/modules/auth/services/oauth.service.js +471 -0
- package/dist/modules/auth/services/oauth.service.js.map +1 -0
- package/dist/modules/auth/services/otp-auth.service.d.ts +13 -3
- package/dist/modules/auth/services/otp-auth.service.d.ts.map +1 -1
- package/dist/modules/auth/services/otp-auth.service.js +41 -7
- package/dist/modules/auth/services/otp-auth.service.js.map +1 -1
- package/dist/modules/auth/services/password-reset-audit-retention.service.d.ts +22 -0
- package/dist/modules/auth/services/password-reset-audit-retention.service.d.ts.map +1 -0
- package/dist/modules/auth/services/password-reset-audit-retention.service.js +117 -0
- package/dist/modules/auth/services/password-reset-audit-retention.service.js.map +1 -0
- package/dist/modules/auth/services/password.service.d.ts +25 -5
- package/dist/modules/auth/services/password.service.d.ts.map +1 -1
- package/dist/modules/auth/services/password.service.js +154 -20
- package/dist/modules/auth/services/password.service.js.map +1 -1
- package/dist/modules/auth/services/pin-auth.service.d.ts +10 -3
- package/dist/modules/auth/services/pin-auth.service.d.ts.map +1 -1
- package/dist/modules/auth/services/pin-auth.service.js +110 -13
- package/dist/modules/auth/services/pin-auth.service.js.map +1 -1
- package/dist/modules/auth/services/registration.service.d.ts +10 -2
- package/dist/modules/auth/services/registration.service.d.ts.map +1 -1
- package/dist/modules/auth/services/registration.service.js +113 -25
- package/dist/modules/auth/services/registration.service.js.map +1 -1
- package/dist/modules/auth/services/turnstile.service.d.ts +17 -0
- package/dist/modules/auth/services/turnstile.service.d.ts.map +1 -0
- package/dist/modules/auth/services/turnstile.service.js +94 -0
- package/dist/modules/auth/services/turnstile.service.js.map +1 -0
- package/dist/modules/auth/utils/auth-params.util.d.ts +13 -6
- package/dist/modules/auth/utils/auth-params.util.d.ts.map +1 -1
- package/dist/modules/auth/utils/auth-params.util.js +27 -4
- package/dist/modules/auth/utils/auth-params.util.js.map +1 -1
- package/dist/modules/auth/utils/auth-supported.util.d.ts +12 -1
- package/dist/modules/auth/utils/auth-supported.util.d.ts.map +1 -1
- package/dist/modules/auth/utils/auth-supported.util.js +36 -4
- package/dist/modules/auth/utils/auth-supported.util.js.map +1 -1
- package/dist/modules/auth/utils/backup-code-hash.util.d.ts +10 -0
- package/dist/modules/auth/utils/backup-code-hash.util.d.ts.map +1 -0
- package/dist/modules/auth/utils/backup-code-hash.util.js +31 -0
- package/dist/modules/auth/utils/backup-code-hash.util.js.map +1 -0
- package/dist/modules/auth/utils/backup-codes.util.d.ts +5 -0
- package/dist/modules/auth/utils/backup-codes.util.d.ts.map +1 -0
- package/dist/modules/auth/utils/backup-codes.util.js +22 -0
- package/dist/modules/auth/utils/backup-codes.util.js.map +1 -0
- package/dist/modules/auth/utils/dpop.util.d.ts +22 -0
- package/dist/modules/auth/utils/dpop.util.d.ts.map +1 -0
- package/dist/modules/auth/utils/dpop.util.js +73 -0
- package/dist/modules/auth/utils/dpop.util.js.map +1 -0
- package/dist/modules/auth/utils/mfa-secret.util.d.ts +22 -0
- package/dist/modules/auth/utils/mfa-secret.util.d.ts.map +1 -0
- package/dist/modules/auth/utils/mfa-secret.util.js +59 -0
- package/dist/modules/auth/utils/mfa-secret.util.js.map +1 -0
- package/dist/modules/auth/utils/mfa-verify-params.util.d.ts +26 -0
- package/dist/modules/auth/utils/mfa-verify-params.util.d.ts.map +1 -0
- package/dist/modules/auth/utils/mfa-verify-params.util.js +49 -0
- package/dist/modules/auth/utils/mfa-verify-params.util.js.map +1 -0
- package/dist/modules/auth/utils/step-up-purpose.util.d.ts +5 -0
- package/dist/modules/auth/utils/step-up-purpose.util.d.ts.map +1 -0
- package/dist/modules/auth/utils/step-up-purpose.util.js +18 -0
- package/dist/modules/auth/utils/step-up-purpose.util.js.map +1 -0
- package/dist/modules/auth/utils/totp.util.d.ts +16 -0
- package/dist/modules/auth/utils/totp.util.d.ts.map +1 -0
- package/dist/modules/auth/utils/totp.util.js +88 -0
- package/dist/modules/auth/utils/totp.util.js.map +1 -0
- package/dist/modules/delivery/composers/otp-delivery.composer.d.ts +28 -1
- package/dist/modules/delivery/composers/otp-delivery.composer.d.ts.map +1 -1
- package/dist/modules/delivery/composers/otp-delivery.composer.js +48 -2
- package/dist/modules/delivery/composers/otp-delivery.composer.js.map +1 -1
- package/dist/modules/delivery/constants/delivery-worker.constants.d.ts +29 -0
- package/dist/modules/delivery/constants/delivery-worker.constants.d.ts.map +1 -0
- package/dist/modules/delivery/constants/delivery-worker.constants.js +51 -0
- package/dist/modules/delivery/constants/delivery-worker.constants.js.map +1 -0
- package/dist/modules/delivery/delivery.module.d.ts.map +1 -1
- package/dist/modules/delivery/delivery.module.js +1 -15
- package/dist/modules/delivery/delivery.module.js.map +1 -1
- package/dist/modules/delivery/entities/notification-delivery-log.entity.d.ts.map +1 -1
- package/dist/modules/delivery/entities/notification-delivery-log.entity.js +3 -1
- package/dist/modules/delivery/entities/notification-delivery-log.entity.js.map +1 -1
- package/dist/modules/delivery/notification-delivery.service.d.ts +12 -1
- package/dist/modules/delivery/notification-delivery.service.d.ts.map +1 -1
- package/dist/modules/delivery/notification-delivery.service.js +121 -40
- package/dist/modules/delivery/notification-delivery.service.js.map +1 -1
- package/dist/modules/delivery/processors/delivery-job.runner.d.ts +22 -1
- package/dist/modules/delivery/processors/delivery-job.runner.d.ts.map +1 -1
- package/dist/modules/delivery/processors/delivery-job.runner.js +144 -42
- package/dist/modules/delivery/processors/delivery-job.runner.js.map +1 -1
- package/dist/modules/delivery/processors/delivery.processor.d.ts.map +1 -1
- package/dist/modules/delivery/processors/delivery.processor.js +6 -1
- package/dist/modules/delivery/processors/delivery.processor.js.map +1 -1
- package/dist/modules/delivery/processors/otp-delivery-job.runner.d.ts +11 -0
- package/dist/modules/delivery/processors/otp-delivery-job.runner.d.ts.map +1 -1
- package/dist/modules/delivery/processors/otp-delivery-job.runner.js +90 -16
- package/dist/modules/delivery/processors/otp-delivery-job.runner.js.map +1 -1
- package/dist/modules/delivery/processors/otp-delivery.processor.d.ts.map +1 -1
- package/dist/modules/delivery/processors/otp-delivery.processor.js +6 -1
- package/dist/modules/delivery/processors/otp-delivery.processor.js.map +1 -1
- package/dist/modules/delivery/queues/sync-jobs.queue.d.ts +7 -1
- package/dist/modules/delivery/queues/sync-jobs.queue.d.ts.map +1 -1
- package/dist/modules/delivery/queues/sync-jobs.queue.js +11 -2
- package/dist/modules/delivery/queues/sync-jobs.queue.js.map +1 -1
- package/dist/modules/delivery/services/delivery-audit-retention.service.d.ts +7 -3
- package/dist/modules/delivery/services/delivery-audit-retention.service.d.ts.map +1 -1
- package/dist/modules/delivery/services/delivery-audit-retention.service.js +33 -10
- package/dist/modules/delivery/services/delivery-audit-retention.service.js.map +1 -1
- package/dist/modules/delivery/services/notification-audit.service.d.ts +7 -4
- package/dist/modules/delivery/services/notification-audit.service.d.ts.map +1 -1
- package/dist/modules/delivery/services/notification-audit.service.js +83 -26
- package/dist/modules/delivery/services/notification-audit.service.js.map +1 -1
- package/dist/modules/delivery/utils/payload-snapshot.util.d.ts +2 -0
- package/dist/modules/delivery/utils/payload-snapshot.util.d.ts.map +1 -1
- package/dist/modules/delivery/utils/payload-snapshot.util.js +22 -3
- package/dist/modules/delivery/utils/payload-snapshot.util.js.map +1 -1
- package/dist/modules/file-upload/controllers/file-upload.controller.d.ts +7 -1
- package/dist/modules/file-upload/controllers/file-upload.controller.d.ts.map +1 -1
- package/dist/modules/file-upload/controllers/file-upload.controller.js +5 -7
- package/dist/modules/file-upload/controllers/file-upload.controller.js.map +1 -1
- package/dist/modules/file-upload/dto/file-upload.dto.d.ts +2 -0
- package/dist/modules/file-upload/dto/file-upload.dto.d.ts.map +1 -1
- package/dist/modules/file-upload/dto/file-upload.dto.js +20 -0
- package/dist/modules/file-upload/dto/file-upload.dto.js.map +1 -1
- package/dist/modules/file-upload/file-upload.module.d.ts.map +1 -1
- package/dist/modules/file-upload/file-upload.module.js +12 -2
- package/dist/modules/file-upload/file-upload.module.js.map +1 -1
- package/dist/modules/file-upload/services/file-upload.service.d.ts +24 -6
- package/dist/modules/file-upload/services/file-upload.service.d.ts.map +1 -1
- package/dist/modules/file-upload/services/file-upload.service.js +164 -36
- package/dist/modules/file-upload/services/file-upload.service.js.map +1 -1
- package/dist/modules/file-upload/services/upload-orphan-cleanup.service.d.ts +4 -2
- package/dist/modules/file-upload/services/upload-orphan-cleanup.service.d.ts.map +1 -1
- package/dist/modules/file-upload/services/upload-orphan-cleanup.service.js +30 -5
- package/dist/modules/file-upload/services/upload-orphan-cleanup.service.js.map +1 -1
- package/dist/modules/file-upload/utils/image-optimize.util.d.ts.map +1 -1
- package/dist/modules/file-upload/utils/image-optimize.util.js +7 -1
- package/dist/modules/file-upload/utils/image-optimize.util.js.map +1 -1
- package/dist/modules/health/health.controller.d.ts +5 -1
- package/dist/modules/health/health.controller.d.ts.map +1 -1
- package/dist/modules/health/health.controller.js +57 -3
- package/dist/modules/health/health.controller.js.map +1 -1
- package/dist/modules/invitations/controllers/invitations.controller.d.ts +19 -4
- package/dist/modules/invitations/controllers/invitations.controller.d.ts.map +1 -1
- package/dist/modules/invitations/controllers/invitations.controller.js +19 -10
- package/dist/modules/invitations/controllers/invitations.controller.js.map +1 -1
- package/dist/modules/invitations/dto/invitation.dto.d.ts +13 -0
- package/dist/modules/invitations/dto/invitation.dto.d.ts.map +1 -1
- package/dist/modules/invitations/dto/invitation.dto.js +69 -2
- package/dist/modules/invitations/dto/invitation.dto.js.map +1 -1
- package/dist/modules/invitations/services/invitations.service.d.ts +24 -6
- package/dist/modules/invitations/services/invitations.service.d.ts.map +1 -1
- package/dist/modules/invitations/services/invitations.service.js +96 -20
- package/dist/modules/invitations/services/invitations.service.js.map +1 -1
- package/dist/modules/jobs/queues/jobs.queue.d.ts +7 -2
- package/dist/modules/jobs/queues/jobs.queue.d.ts.map +1 -1
- package/dist/modules/jobs/queues/jobs.queue.js +25 -10
- package/dist/modules/jobs/queues/jobs.queue.js.map +1 -1
- package/dist/modules/notifications/controllers/notifications.controller.d.ts +3 -1
- package/dist/modules/notifications/controllers/notifications.controller.d.ts.map +1 -1
- package/dist/modules/notifications/controllers/notifications.controller.js +25 -2
- package/dist/modules/notifications/controllers/notifications.controller.js.map +1 -1
- package/dist/modules/notifications/dto/notification-query.dto.d.ts.map +1 -1
- package/dist/modules/notifications/dto/notification-query.dto.js +1 -0
- package/dist/modules/notifications/dto/notification-query.dto.js.map +1 -1
- package/dist/modules/notifications/entities/device-token.entity.d.ts.map +1 -1
- package/dist/modules/notifications/entities/device-token.entity.js +3 -1
- package/dist/modules/notifications/entities/device-token.entity.js.map +1 -1
- package/dist/modules/notifications/services/fcm.service.d.ts +2 -0
- package/dist/modules/notifications/services/fcm.service.d.ts.map +1 -1
- package/dist/modules/notifications/services/fcm.service.js +28 -7
- package/dist/modules/notifications/services/fcm.service.js.map +1 -1
- package/dist/modules/notifications/services/notifications.service.d.ts +16 -3
- package/dist/modules/notifications/services/notifications.service.d.ts.map +1 -1
- package/dist/modules/notifications/services/notifications.service.js +95 -24
- package/dist/modules/notifications/services/notifications.service.js.map +1 -1
- package/dist/modules/observability/metrics/metrics.service.d.ts +2 -0
- package/dist/modules/observability/metrics/metrics.service.d.ts.map +1 -1
- package/dist/modules/observability/metrics/metrics.service.js +11 -0
- package/dist/modules/observability/metrics/metrics.service.js.map +1 -1
- package/dist/modules/otp/constants/otp.constants.d.ts +7 -5
- package/dist/modules/otp/constants/otp.constants.d.ts.map +1 -1
- package/dist/modules/otp/constants/otp.constants.js +11 -8
- package/dist/modules/otp/constants/otp.constants.js.map +1 -1
- package/dist/modules/otp/interfaces/otp.service.interface.d.ts +1 -1
- package/dist/modules/otp/interfaces/otp.service.interface.d.ts.map +1 -1
- package/dist/modules/otp/otp.service.d.ts +10 -2
- package/dist/modules/otp/otp.service.d.ts.map +1 -1
- package/dist/modules/otp/otp.service.js +48 -4
- package/dist/modules/otp/otp.service.js.map +1 -1
- package/dist/modules/otp/services/otp.rate-limiter.d.ts +2 -0
- package/dist/modules/otp/services/otp.rate-limiter.d.ts.map +1 -1
- package/dist/modules/otp/services/otp.rate-limiter.js +19 -0
- package/dist/modules/otp/services/otp.rate-limiter.js.map +1 -1
- package/dist/modules/otp/services/otp.session.store.d.ts +9 -3
- package/dist/modules/otp/services/otp.session.store.d.ts.map +1 -1
- package/dist/modules/otp/services/otp.session.store.js +34 -42
- package/dist/modules/otp/services/otp.session.store.js.map +1 -1
- package/dist/modules/otp/utils/otp-code-hash.util.d.ts +11 -0
- package/dist/modules/otp/utils/otp-code-hash.util.d.ts.map +1 -0
- package/dist/modules/otp/utils/otp-code-hash.util.js +68 -0
- package/dist/modules/otp/utils/otp-code-hash.util.js.map +1 -0
- package/dist/modules/profile/controllers/profile.controller.d.ts +9 -3
- package/dist/modules/profile/controllers/profile.controller.d.ts.map +1 -1
- package/dist/modules/profile/controllers/profile.controller.js +140 -8
- package/dist/modules/profile/controllers/profile.controller.js.map +1 -1
- package/dist/modules/profile/dto/create-user-profile.dto.d.ts +10 -0
- package/dist/modules/profile/dto/create-user-profile.dto.d.ts.map +1 -1
- package/dist/modules/profile/dto/create-user-profile.dto.js +43 -1
- package/dist/modules/profile/dto/create-user-profile.dto.js.map +1 -1
- package/dist/modules/profile/dto/public-user-profile.dto.d.ts +24 -0
- package/dist/modules/profile/dto/public-user-profile.dto.d.ts.map +1 -0
- package/dist/modules/profile/dto/public-user-profile.dto.js +115 -0
- package/dist/modules/profile/dto/public-user-profile.dto.js.map +1 -0
- package/dist/modules/profile/dto/user-profile-response.dto.d.ts +4 -0
- package/dist/modules/profile/dto/user-profile-response.dto.d.ts.map +1 -1
- package/dist/modules/profile/dto/user-profile-response.dto.js +4 -0
- package/dist/modules/profile/dto/user-profile-response.dto.js.map +1 -1
- package/dist/modules/profile/dto/username-available.dto.d.ts +6 -0
- package/dist/modules/profile/dto/username-available.dto.d.ts.map +1 -0
- package/dist/modules/profile/dto/username-available.dto.js +31 -0
- package/dist/modules/profile/dto/username-available.dto.js.map +1 -0
- package/dist/modules/profile/entities/user-profiles.entity.d.ts +10 -0
- package/dist/modules/profile/entities/user-profiles.entity.d.ts.map +1 -1
- package/dist/modules/profile/entities/user-profiles.entity.js +29 -1
- package/dist/modules/profile/entities/user-profiles.entity.js.map +1 -1
- package/dist/modules/profile/index.d.ts +1 -0
- package/dist/modules/profile/index.d.ts.map +1 -1
- package/dist/modules/profile/index.js +1 -0
- package/dist/modules/profile/index.js.map +1 -1
- package/dist/modules/profile/profile.manifest.d.ts +2 -2
- package/dist/modules/profile/profile.manifest.js +2 -2
- package/dist/modules/profile/profile.manifest.js.map +1 -1
- package/dist/modules/profile/profile.module.d.ts.map +1 -1
- package/dist/modules/profile/profile.module.js +7 -2
- package/dist/modules/profile/profile.module.js.map +1 -1
- package/dist/modules/profile/services/profile.service.d.ts +56 -4
- package/dist/modules/profile/services/profile.service.d.ts.map +1 -1
- package/dist/modules/profile/services/profile.service.js +247 -20
- package/dist/modules/profile/services/profile.service.js.map +1 -1
- package/dist/modules/realtime/adapters/redis-io.adapter.d.ts +26 -0
- package/dist/modules/realtime/adapters/redis-io.adapter.d.ts.map +1 -0
- package/dist/modules/realtime/adapters/redis-io.adapter.js +124 -0
- package/dist/modules/realtime/adapters/redis-io.adapter.js.map +1 -0
- package/dist/modules/realtime/constants/realtime.constants.d.ts +36 -0
- package/dist/modules/realtime/constants/realtime.constants.d.ts.map +1 -0
- package/dist/modules/realtime/constants/realtime.constants.js +42 -0
- package/dist/modules/realtime/constants/realtime.constants.js.map +1 -0
- package/dist/modules/realtime/controllers/realtime.controller.d.ts +21 -0
- package/dist/modules/realtime/controllers/realtime.controller.d.ts.map +1 -0
- package/dist/modules/realtime/controllers/realtime.controller.js +113 -0
- package/dist/modules/realtime/controllers/realtime.controller.js.map +1 -0
- package/dist/modules/realtime/gateway/realtime.gateway.d.ts +42 -0
- package/dist/modules/realtime/gateway/realtime.gateway.d.ts.map +1 -0
- package/dist/modules/realtime/gateway/realtime.gateway.js +289 -0
- package/dist/modules/realtime/gateway/realtime.gateway.js.map +1 -0
- package/dist/modules/realtime/index.d.ts +12 -0
- package/dist/modules/realtime/index.d.ts.map +1 -0
- package/dist/modules/realtime/index.js +35 -0
- package/dist/modules/realtime/index.js.map +1 -0
- package/dist/modules/realtime/realtime.manifest.d.ts +8 -0
- package/dist/modules/realtime/realtime.manifest.d.ts.map +1 -0
- package/dist/modules/realtime/realtime.manifest.js +31 -0
- package/dist/modules/realtime/realtime.manifest.js.map +1 -0
- package/dist/modules/realtime/realtime.module.d.ts +14 -0
- package/dist/modules/realtime/realtime.module.d.ts.map +1 -0
- package/dist/modules/realtime/realtime.module.js +126 -0
- package/dist/modules/realtime/realtime.module.js.map +1 -0
- package/dist/modules/realtime/services/realtime-handler.registry.d.ts +16 -0
- package/dist/modules/realtime/services/realtime-handler.registry.d.ts.map +1 -0
- package/dist/modules/realtime/services/realtime-handler.registry.js +55 -0
- package/dist/modules/realtime/services/realtime-handler.registry.js.map +1 -0
- package/dist/modules/realtime/services/realtime-presence.service.d.ts +15 -0
- package/dist/modules/realtime/services/realtime-presence.service.d.ts.map +1 -0
- package/dist/modules/realtime/services/realtime-presence.service.js +86 -0
- package/dist/modules/realtime/services/realtime-presence.service.js.map +1 -0
- package/dist/modules/realtime/services/realtime-rate-limiter.service.d.ts +12 -0
- package/dist/modules/realtime/services/realtime-rate-limiter.service.d.ts.map +1 -0
- package/dist/modules/realtime/services/realtime-rate-limiter.service.js +63 -0
- package/dist/modules/realtime/services/realtime-rate-limiter.service.js.map +1 -0
- package/dist/modules/realtime/services/realtime.service.d.ts +88 -0
- package/dist/modules/realtime/services/realtime.service.d.ts.map +1 -0
- package/dist/modules/realtime/services/realtime.service.js +343 -0
- package/dist/modules/realtime/services/realtime.service.js.map +1 -0
- package/dist/modules/realtime/types/realtime.types.d.ts +50 -0
- package/dist/modules/realtime/types/realtime.types.d.ts.map +1 -0
- package/dist/modules/realtime/types/realtime.types.js +14 -0
- package/dist/modules/realtime/types/realtime.types.js.map +1 -0
- package/dist/modules/realtime/utils/handshake-error.util.d.ts +5 -0
- package/dist/modules/realtime/utils/handshake-error.util.d.ts.map +1 -0
- package/dist/modules/realtime/utils/handshake-error.util.js +45 -0
- package/dist/modules/realtime/utils/handshake-error.util.js.map +1 -0
- package/dist/modules/roles/controllers/modules.controller.d.ts +4 -3
- package/dist/modules/roles/controllers/modules.controller.d.ts.map +1 -1
- package/dist/modules/roles/controllers/modules.controller.js +21 -10
- package/dist/modules/roles/controllers/modules.controller.js.map +1 -1
- package/dist/modules/roles/controllers/permissions.controller.d.ts +4 -3
- package/dist/modules/roles/controllers/permissions.controller.d.ts.map +1 -1
- package/dist/modules/roles/controllers/permissions.controller.js +21 -10
- package/dist/modules/roles/controllers/permissions.controller.js.map +1 -1
- package/dist/modules/roles/controllers/roles.controller.d.ts +5 -4
- package/dist/modules/roles/controllers/roles.controller.d.ts.map +1 -1
- package/dist/modules/roles/controllers/roles.controller.js +26 -13
- package/dist/modules/roles/controllers/roles.controller.js.map +1 -1
- package/dist/modules/roles/controllers/user-roles.controller.d.ts +3 -2
- package/dist/modules/roles/controllers/user-roles.controller.d.ts.map +1 -1
- package/dist/modules/roles/controllers/user-roles.controller.js +14 -6
- package/dist/modules/roles/controllers/user-roles.controller.js.map +1 -1
- package/dist/modules/roles/services/modules.service.d.ts +8 -5
- package/dist/modules/roles/services/modules.service.d.ts.map +1 -1
- package/dist/modules/roles/services/modules.service.js +58 -12
- package/dist/modules/roles/services/modules.service.js.map +1 -1
- package/dist/modules/roles/services/permissions.service.d.ts +8 -5
- package/dist/modules/roles/services/permissions.service.d.ts.map +1 -1
- package/dist/modules/roles/services/permissions.service.js +61 -12
- package/dist/modules/roles/services/permissions.service.js.map +1 -1
- package/dist/modules/roles/services/roles.service.d.ts +19 -9
- package/dist/modules/roles/services/roles.service.d.ts.map +1 -1
- package/dist/modules/roles/services/roles.service.js +137 -47
- package/dist/modules/roles/services/roles.service.js.map +1 -1
- package/dist/modules/roles/services/user-roles.service.d.ts +12 -4
- package/dist/modules/roles/services/user-roles.service.d.ts.map +1 -1
- package/dist/modules/roles/services/user-roles.service.js +58 -26
- package/dist/modules/roles/services/user-roles.service.js.map +1 -1
- package/dist/modules/sessions/entities/refresh-token.entity.d.ts +7 -1
- package/dist/modules/sessions/entities/refresh-token.entity.d.ts.map +1 -1
- package/dist/modules/sessions/entities/refresh-token.entity.js +10 -0
- package/dist/modules/sessions/entities/refresh-token.entity.js.map +1 -1
- package/dist/modules/sessions/entities/revoked-refresh-family.entity.d.ts +12 -0
- package/dist/modules/sessions/entities/revoked-refresh-family.entity.d.ts.map +1 -0
- package/dist/modules/sessions/entities/revoked-refresh-family.entity.js +46 -0
- package/dist/modules/sessions/entities/revoked-refresh-family.entity.js.map +1 -0
- package/dist/modules/sessions/services/refresh-token-retention.service.d.ts +20 -0
- package/dist/modules/sessions/services/refresh-token-retention.service.d.ts.map +1 -0
- package/dist/modules/sessions/services/refresh-token-retention.service.js +97 -0
- package/dist/modules/sessions/services/refresh-token-retention.service.js.map +1 -0
- package/dist/modules/sessions/services/token.service.d.ts +150 -16
- package/dist/modules/sessions/services/token.service.d.ts.map +1 -1
- package/dist/modules/sessions/services/token.service.js +505 -74
- package/dist/modules/sessions/services/token.service.js.map +1 -1
- package/dist/modules/sessions/sessions.module.d.ts.map +1 -1
- package/dist/modules/sessions/sessions.module.js +4 -2
- package/dist/modules/sessions/sessions.module.js.map +1 -1
- package/dist/modules/sessions/utils/refresh-token-hash.util.d.ts +13 -0
- package/dist/modules/sessions/utils/refresh-token-hash.util.d.ts.map +1 -0
- package/dist/modules/sessions/utils/refresh-token-hash.util.js +37 -0
- package/dist/modules/sessions/utils/refresh-token-hash.util.js.map +1 -0
- package/dist/modules/settings/constants/settings.defaults.d.ts +57 -3
- package/dist/modules/settings/constants/settings.defaults.d.ts.map +1 -1
- package/dist/modules/settings/constants/settings.defaults.js +58 -3
- package/dist/modules/settings/constants/settings.defaults.js.map +1 -1
- package/dist/modules/settings/constants/settings.keys.d.ts +138 -2
- package/dist/modules/settings/constants/settings.keys.d.ts.map +1 -1
- package/dist/modules/settings/constants/settings.keys.js +140 -2
- package/dist/modules/settings/constants/settings.keys.js.map +1 -1
- package/dist/modules/settings/controllers/settings.controller.d.ts +5 -1
- package/dist/modules/settings/controllers/settings.controller.d.ts.map +1 -1
- package/dist/modules/settings/controllers/settings.controller.js +134 -5
- package/dist/modules/settings/controllers/settings.controller.js.map +1 -1
- package/dist/modules/settings/services/settings.service.d.ts +17 -7
- package/dist/modules/settings/services/settings.service.d.ts.map +1 -1
- package/dist/modules/settings/services/settings.service.js +80 -14
- package/dist/modules/settings/services/settings.service.js.map +1 -1
- package/dist/modules/settings/utils/settings-secret.util.d.ts +13 -0
- package/dist/modules/settings/utils/settings-secret.util.d.ts.map +1 -0
- package/dist/modules/settings/utils/settings-secret.util.js +80 -0
- package/dist/modules/settings/utils/settings-secret.util.js.map +1 -0
- package/dist/modules/users/controllers/users.controller.d.ts +4 -2
- package/dist/modules/users/controllers/users.controller.d.ts.map +1 -1
- package/dist/modules/users/controllers/users.controller.js +89 -10
- package/dist/modules/users/controllers/users.controller.js.map +1 -1
- package/dist/modules/users/dto/user.dto.d.ts +5 -0
- package/dist/modules/users/dto/user.dto.d.ts.map +1 -1
- package/dist/modules/users/dto/user.dto.js +46 -5
- package/dist/modules/users/dto/user.dto.js.map +1 -1
- package/dist/modules/users/entities/user.entity.d.ts +7 -1
- package/dist/modules/users/entities/user.entity.d.ts.map +1 -1
- package/dist/modules/users/entities/user.entity.js +10 -0
- package/dist/modules/users/entities/user.entity.js.map +1 -1
- package/dist/modules/users/services/users.service.d.ts +15 -2
- package/dist/modules/users/services/users.service.d.ts.map +1 -1
- package/dist/modules/users/services/users.service.js +152 -37
- package/dist/modules/users/services/users.service.js.map +1 -1
- package/dist/modules/users/users.module.d.ts.map +1 -1
- package/dist/modules/users/users.module.js +1 -2
- package/dist/modules/users/users.module.js.map +1 -1
- package/package.json +19 -7
- package/dist/modules/admin/entities/admin-log.entity.d.ts +0 -20
- package/dist/modules/admin/entities/admin-log.entity.d.ts.map +0 -1
- package/dist/modules/admin/entities/admin-log.entity.js +0 -65
- package/dist/modules/admin/entities/admin-log.entity.js.map +0 -1
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.manifest = exports.REALTIME_PERMISSIONS = void 0;
|
|
4
|
+
exports.REALTIME_PERMISSIONS = {
|
|
5
|
+
READ: 'realtime:read',
|
|
6
|
+
DISCONNECT: 'realtime:disconnect',
|
|
7
|
+
EMIT_ALL: 'realtime:emit-all',
|
|
8
|
+
};
|
|
9
|
+
exports.manifest = {
|
|
10
|
+
slug: 'realtime',
|
|
11
|
+
name: 'Realtime',
|
|
12
|
+
description: 'WebSocket realtime connections, presence, and force-disconnect ops',
|
|
13
|
+
permissions: [
|
|
14
|
+
{
|
|
15
|
+
slug: exports.REALTIME_PERMISSIONS.READ,
|
|
16
|
+
name: 'Read realtime status',
|
|
17
|
+
description: 'View realtime status and user presence',
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
slug: exports.REALTIME_PERMISSIONS.DISCONNECT,
|
|
21
|
+
name: 'Force disconnect',
|
|
22
|
+
description: 'Force-disconnect user WebSocket sessions',
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
slug: exports.REALTIME_PERMISSIONS.EMIT_ALL,
|
|
26
|
+
name: 'Emit to all',
|
|
27
|
+
description: 'Broadcast realtime events to all connected clients',
|
|
28
|
+
},
|
|
29
|
+
],
|
|
30
|
+
};
|
|
31
|
+
//# sourceMappingURL=realtime.manifest.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"realtime.manifest.js","sourceRoot":"","sources":["../../../src/modules/realtime/realtime.manifest.ts"],"names":[],"mappings":";;;AAEa,QAAA,oBAAoB,GAAG;IACnC,IAAI,EAAE,eAAe;IACrB,UAAU,EAAE,qBAAqB;IACjC,QAAQ,EAAE,mBAAmB;CACpB,CAAC;AAEE,QAAA,QAAQ,GAAmB;IACvC,IAAI,EAAE,UAAU;IAChB,IAAI,EAAE,UAAU;IAChB,WAAW,EAAE,oEAAoE;IACjF,WAAW,EAAE;QACZ;YACC,IAAI,EAAE,4BAAoB,CAAC,IAAI;YAC/B,IAAI,EAAE,sBAAsB;YAC5B,WAAW,EAAE,wCAAwC;SACrD;QACD;YACC,IAAI,EAAE,4BAAoB,CAAC,UAAU;YACrC,IAAI,EAAE,kBAAkB;YACxB,WAAW,EAAE,0CAA0C;SACvD;QACD;YACC,IAAI,EAAE,4BAAoB,CAAC,QAAQ;YACnC,IAAI,EAAE,aAAa;YACnB,WAAW,EAAE,oDAAoD;SACjE;KACD;CACD,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { DynamicModule } from '@nestjs/common';
|
|
2
|
+
import { RedisIoAdapter } from './adapters/redis-io.adapter';
|
|
3
|
+
/** DI token — true when the real gateway/adapter stack is registered. */
|
|
4
|
+
export declare const REALTIME_ENABLED_TOKEN = "REALTIME_ENABLED_TOKEN";
|
|
5
|
+
export type RealtimeModuleOptions = {
|
|
6
|
+
/** When set, overrides REALTIME_ENABLED env. */
|
|
7
|
+
enabled?: boolean;
|
|
8
|
+
};
|
|
9
|
+
export declare class RealtimeModule {
|
|
10
|
+
private static readonly logger;
|
|
11
|
+
static register(options?: RealtimeModuleOptions): DynamicModule;
|
|
12
|
+
}
|
|
13
|
+
export { RedisIoAdapter };
|
|
14
|
+
//# sourceMappingURL=realtime.module.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"realtime.module.d.ts","sourceRoot":"","sources":["../../../src/modules/realtime/realtime.module.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAA0B,MAAM,gBAAgB,CAAC;AAMvE,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAQ7D,yEAAyE;AACzE,eAAO,MAAM,sBAAsB,2BAA2B,CAAC;AAE/D,MAAM,MAAM,qBAAqB,GAAG;IACnC,gDAAgD;IAChD,OAAO,CAAC,EAAE,OAAO,CAAC;CAClB,CAAC;AAEF,qBAEa,cAAc;IAC1B,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAmC;IAEjE,MAAM,CAAC,QAAQ,CAAC,OAAO,GAAE,qBAA0B,GAAG,aAAa;CA2DnE;AA2CD,OAAO,EAAE,cAAc,EAAE,CAAC"}
|
|
@@ -0,0 +1,126 @@
|
|
|
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 RealtimeModule_1;
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.RedisIoAdapter = exports.RealtimeModule = exports.REALTIME_ENABLED_TOKEN = void 0;
|
|
11
|
+
const common_1 = require("@nestjs/common");
|
|
12
|
+
const config_1 = require("@nestjs/config");
|
|
13
|
+
const env_flags_util_1 = require("../../config/env-flags.util");
|
|
14
|
+
const node_env_util_1 = require("../../config/node-env.util");
|
|
15
|
+
const auth_core_module_1 = require("../auth/auth-core/auth-core.module");
|
|
16
|
+
const redis_io_adapter_1 = require("./adapters/redis-io.adapter");
|
|
17
|
+
Object.defineProperty(exports, "RedisIoAdapter", { enumerable: true, get: function () { return redis_io_adapter_1.RedisIoAdapter; } });
|
|
18
|
+
const realtime_controller_1 = require("./controllers/realtime.controller");
|
|
19
|
+
const realtime_gateway_1 = require("./gateway/realtime.gateway");
|
|
20
|
+
const realtime_service_1 = require("./services/realtime.service");
|
|
21
|
+
const realtime_handler_registry_1 = require("./services/realtime-handler.registry");
|
|
22
|
+
const realtime_presence_service_1 = require("./services/realtime-presence.service");
|
|
23
|
+
const realtime_rate_limiter_service_1 = require("./services/realtime-rate-limiter.service");
|
|
24
|
+
/** DI token — true when the real gateway/adapter stack is registered. */
|
|
25
|
+
exports.REALTIME_ENABLED_TOKEN = 'REALTIME_ENABLED_TOKEN';
|
|
26
|
+
let RealtimeModule = class RealtimeModule {
|
|
27
|
+
static { RealtimeModule_1 = this; }
|
|
28
|
+
static logger = new common_1.Logger(RealtimeModule_1.name);
|
|
29
|
+
static register(options = {}) {
|
|
30
|
+
const enabled = options.enabled !== undefined ? options.enabled : (0, env_flags_util_1.isRealtimeEnabled)();
|
|
31
|
+
if (!enabled) {
|
|
32
|
+
return {
|
|
33
|
+
module: RealtimeModule_1,
|
|
34
|
+
providers: [
|
|
35
|
+
{ provide: exports.REALTIME_ENABLED_TOKEN, useValue: false },
|
|
36
|
+
{
|
|
37
|
+
provide: realtime_service_1.RealtimeService,
|
|
38
|
+
useValue: createNoopRealtimeService(),
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
provide: realtime_handler_registry_1.RealtimeHandlerRegistry,
|
|
42
|
+
useValue: {
|
|
43
|
+
register: () => undefined,
|
|
44
|
+
unregister: () => undefined,
|
|
45
|
+
isRegistered: () => false,
|
|
46
|
+
listEvents: () => [],
|
|
47
|
+
dispatch: async () => false,
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
],
|
|
51
|
+
exports: [realtime_service_1.RealtimeService, realtime_handler_registry_1.RealtimeHandlerRegistry, exports.REALTIME_ENABLED_TOKEN],
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
if ((0, node_env_util_1.isProductionNodeEnv)(process.env.NODE_ENV) && !(0, env_flags_util_1.isRedisEnabled)()) {
|
|
55
|
+
throw new Error('REALTIME_ENABLED=true requires REDIS_ENABLED=true in production (Socket.IO Redis adapter + presence).');
|
|
56
|
+
}
|
|
57
|
+
if (!(0, env_flags_util_1.isRedisEnabled)()) {
|
|
58
|
+
RealtimeModule_1.logger.warn('Realtime enabled without Redis — single-process adapter only. Not suitable for multi-instance.');
|
|
59
|
+
}
|
|
60
|
+
return {
|
|
61
|
+
module: RealtimeModule_1,
|
|
62
|
+
imports: [config_1.ConfigModule, auth_core_module_1.AuthCoreModule],
|
|
63
|
+
controllers: [realtime_controller_1.RealtimeController],
|
|
64
|
+
providers: [
|
|
65
|
+
{ provide: exports.REALTIME_ENABLED_TOKEN, useValue: true },
|
|
66
|
+
realtime_service_1.RealtimeService,
|
|
67
|
+
realtime_presence_service_1.RealtimePresenceService,
|
|
68
|
+
realtime_rate_limiter_service_1.RealtimeRateLimiterService,
|
|
69
|
+
realtime_handler_registry_1.RealtimeHandlerRegistry,
|
|
70
|
+
realtime_gateway_1.RealtimeGateway,
|
|
71
|
+
],
|
|
72
|
+
exports: [
|
|
73
|
+
realtime_service_1.RealtimeService,
|
|
74
|
+
realtime_handler_registry_1.RealtimeHandlerRegistry,
|
|
75
|
+
realtime_presence_service_1.RealtimePresenceService,
|
|
76
|
+
exports.REALTIME_ENABLED_TOKEN,
|
|
77
|
+
],
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
exports.RealtimeModule = RealtimeModule;
|
|
82
|
+
exports.RealtimeModule = RealtimeModule = RealtimeModule_1 = __decorate([
|
|
83
|
+
(0, common_1.Global)(),
|
|
84
|
+
(0, common_1.Module)({})
|
|
85
|
+
], RealtimeModule);
|
|
86
|
+
/** Minimal stub so optional inject sites never crash when realtime is off. */
|
|
87
|
+
function createNoopRealtimeService() {
|
|
88
|
+
const noop = {
|
|
89
|
+
isReady: () => false,
|
|
90
|
+
emitToUser: async () => false,
|
|
91
|
+
emitToUsers: async () => 0,
|
|
92
|
+
emitToRoom: async () => false,
|
|
93
|
+
emitToAll: async () => false,
|
|
94
|
+
instanceId: 'noop',
|
|
95
|
+
disconnectUser: () => undefined,
|
|
96
|
+
disconnectFamily: () => undefined,
|
|
97
|
+
notifySessionRevokedUser: () => undefined,
|
|
98
|
+
notifySessionRevokedFamily: () => undefined,
|
|
99
|
+
applyDisconnectUser: () => undefined,
|
|
100
|
+
applyDisconnectFamily: () => undefined,
|
|
101
|
+
isOnline: async () => false,
|
|
102
|
+
getPresence: async (userId) => ({
|
|
103
|
+
userId,
|
|
104
|
+
online: false,
|
|
105
|
+
connectionCount: 0,
|
|
106
|
+
lastSeenAt: null,
|
|
107
|
+
}),
|
|
108
|
+
getLocalConnectionCount: () => 0,
|
|
109
|
+
attachServer: () => undefined,
|
|
110
|
+
getServer: () => null,
|
|
111
|
+
trackConnect: () => undefined,
|
|
112
|
+
trackDisconnect: () => undefined,
|
|
113
|
+
authenticateToken: async () => {
|
|
114
|
+
throw new Error('Realtime is disabled');
|
|
115
|
+
},
|
|
116
|
+
buildHandshakeDpopUri: () => 'http://localhost/realtime',
|
|
117
|
+
bindControlSubscriber: () => undefined,
|
|
118
|
+
joinRoom: async () => undefined,
|
|
119
|
+
addUserToRoom: async () => undefined,
|
|
120
|
+
removeUserFromRoom: async () => undefined,
|
|
121
|
+
onModuleInit: () => undefined,
|
|
122
|
+
onModuleDestroy: async () => undefined,
|
|
123
|
+
};
|
|
124
|
+
return noop;
|
|
125
|
+
}
|
|
126
|
+
//# sourceMappingURL=realtime.module.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"realtime.module.js","sourceRoot":"","sources":["../../../src/modules/realtime/realtime.module.ts"],"names":[],"mappings":";;;;;;;;;;AAAA,2CAAuE;AACvE,2CAA8C;AAE9C,gEAAgF;AAChF,8DAAiE;AACjE,yEAAoE;AACpE,kEAA6D;AA2HpD,+FA3HA,iCAAc,OA2HA;AA1HvB,2EAAuE;AACvE,iEAA6D;AAC7D,kEAA8D;AAC9D,oFAA+E;AAC/E,oFAA+E;AAC/E,4FAAsF;AAEtF,yEAAyE;AAC5D,QAAA,sBAAsB,GAAG,wBAAwB,CAAC;AASxD,IAAM,cAAc,GAApB,MAAM,cAAc;;IAClB,MAAM,CAAU,MAAM,GAAG,IAAI,eAAM,CAAC,gBAAc,CAAC,IAAI,CAAC,CAAC;IAEjE,MAAM,CAAC,QAAQ,CAAC,UAAiC,EAAE;QAClD,MAAM,OAAO,GAAG,OAAO,CAAC,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,IAAA,kCAAiB,GAAE,CAAC;QAEtF,IAAI,CAAC,OAAO,EAAE,CAAC;YACd,OAAO;gBACN,MAAM,EAAE,gBAAc;gBACtB,SAAS,EAAE;oBACV,EAAE,OAAO,EAAE,8BAAsB,EAAE,QAAQ,EAAE,KAAK,EAAE;oBACpD;wBACC,OAAO,EAAE,kCAAe;wBACxB,QAAQ,EAAE,yBAAyB,EAAE;qBACrC;oBACD;wBACC,OAAO,EAAE,mDAAuB;wBAChC,QAAQ,EAAE;4BACT,QAAQ,EAAE,GAAG,EAAE,CAAC,SAAS;4BACzB,UAAU,EAAE,GAAG,EAAE,CAAC,SAAS;4BAC3B,YAAY,EAAE,GAAG,EAAE,CAAC,KAAK;4BACzB,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AC;AAC3C,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { RealtimeInboundHandler } from '../types/realtime.types';
|
|
2
|
+
/**
|
|
3
|
+
* Server-side inbound event handlers for host/sibling packages.
|
|
4
|
+
* Register during module init — do not subclass the Core gateway.
|
|
5
|
+
*/
|
|
6
|
+
export declare class RealtimeHandlerRegistry {
|
|
7
|
+
private readonly logger;
|
|
8
|
+
private readonly handlers;
|
|
9
|
+
/** Events packages may handle in addition to built-in client events. */
|
|
10
|
+
register(event: string, handler: RealtimeInboundHandler): void;
|
|
11
|
+
unregister(event: string, handler: RealtimeInboundHandler): void;
|
|
12
|
+
isRegistered(event: string): boolean;
|
|
13
|
+
listEvents(): string[];
|
|
14
|
+
dispatch(event: string, ...args: Parameters<RealtimeInboundHandler>): Promise<boolean>;
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=realtime-handler.registry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"realtime-handler.registry.d.ts","sourceRoot":"","sources":["../../../../src/modules/realtime/services/realtime-handler.registry.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,yBAAyB,CAAC;AAEtE;;;GAGG;AACH,qBACa,uBAAuB;IACnC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAA4C;IACnE,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAkD;IAE3E,wEAAwE;IACxE,QAAQ,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,sBAAsB,GAAG,IAAI;IAe9D,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,sBAAsB,GAAG,IAAI;IAIhE,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO;IAIpC,UAAU,IAAI,MAAM,EAAE;IAIhB,QAAQ,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,UAAU,CAAC,sBAAsB,CAAC,GAAG,OAAO,CAAC,OAAO,CAAC;CAU5F"}
|
|
@@ -0,0 +1,55 @@
|
|
|
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 RealtimeHandlerRegistry_1;
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.RealtimeHandlerRegistry = void 0;
|
|
11
|
+
const common_1 = require("@nestjs/common");
|
|
12
|
+
/**
|
|
13
|
+
* Server-side inbound event handlers for host/sibling packages.
|
|
14
|
+
* Register during module init — do not subclass the Core gateway.
|
|
15
|
+
*/
|
|
16
|
+
let RealtimeHandlerRegistry = RealtimeHandlerRegistry_1 = class RealtimeHandlerRegistry {
|
|
17
|
+
logger = new common_1.Logger(RealtimeHandlerRegistry_1.name);
|
|
18
|
+
handlers = new Map();
|
|
19
|
+
/** Events packages may handle in addition to built-in client events. */
|
|
20
|
+
register(event, handler) {
|
|
21
|
+
if (!event?.trim() || event.startsWith('realtime:')) {
|
|
22
|
+
throw new Error(`Invalid realtime handler event "${event}". Use a domain event name (not realtime:*).`);
|
|
23
|
+
}
|
|
24
|
+
let set = this.handlers.get(event);
|
|
25
|
+
if (!set) {
|
|
26
|
+
set = new Set();
|
|
27
|
+
this.handlers.set(event, set);
|
|
28
|
+
}
|
|
29
|
+
set.add(handler);
|
|
30
|
+
this.logger.log(`Registered realtime inbound handler for ${event}`);
|
|
31
|
+
}
|
|
32
|
+
unregister(event, handler) {
|
|
33
|
+
this.handlers.get(event)?.delete(handler);
|
|
34
|
+
}
|
|
35
|
+
isRegistered(event) {
|
|
36
|
+
return (this.handlers.get(event)?.size ?? 0) > 0;
|
|
37
|
+
}
|
|
38
|
+
listEvents() {
|
|
39
|
+
return [...this.handlers.keys()];
|
|
40
|
+
}
|
|
41
|
+
async dispatch(event, ...args) {
|
|
42
|
+
const set = this.handlers.get(event);
|
|
43
|
+
if (!set?.size)
|
|
44
|
+
return false;
|
|
45
|
+
await Promise.all([...set].map(async (h) => {
|
|
46
|
+
await h(...args);
|
|
47
|
+
}));
|
|
48
|
+
return true;
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
exports.RealtimeHandlerRegistry = RealtimeHandlerRegistry;
|
|
52
|
+
exports.RealtimeHandlerRegistry = RealtimeHandlerRegistry = RealtimeHandlerRegistry_1 = __decorate([
|
|
53
|
+
(0, common_1.Injectable)()
|
|
54
|
+
], RealtimeHandlerRegistry);
|
|
55
|
+
//# sourceMappingURL=realtime-handler.registry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"realtime-handler.registry.js","sourceRoot":"","sources":["../../../../src/modules/realtime/services/realtime-handler.registry.ts"],"names":[],"mappings":";;;;;;;;;;AAAA,2CAAoD;AAIpD;;;GAGG;AAEI,IAAM,uBAAuB,+BAA7B,MAAM,uBAAuB;IAClB,MAAM,GAAG,IAAI,eAAM,CAAC,yBAAuB,CAAC,IAAI,CAAC,CAAC;IAClD,QAAQ,GAAG,IAAI,GAAG,EAAuC,CAAC;IAE3E,wEAAwE;IACxE,QAAQ,CAAC,KAAa,EAAE,OAA+B;QACtD,IAAI,CAAC,KAAK,EAAE,IAAI,EAAE,IAAI,KAAK,CAAC,UAAU,CAAC,WAAW,CAAC,EAAE,CAAC;YACrD,MAAM,IAAI,KAAK,CACd,mCAAmC,KAAK,8CAA8C,CACtF,CAAC;QACH,CAAC;QACD,IAAI,GAAG,GAAG,IAAI,CAAC,QAAQ,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@@ -0,0 +1,15 @@
|
|
|
1
|
+
import IORedis from 'ioredis';
|
|
2
|
+
import { SettingsService } from '../../settings/services/settings.service';
|
|
3
|
+
import type { RealtimePresence } from '../types/realtime.types';
|
|
4
|
+
export declare class RealtimePresenceService {
|
|
5
|
+
private readonly redis;
|
|
6
|
+
private readonly settings;
|
|
7
|
+
constructor(redis: IORedis, settings: SettingsService);
|
|
8
|
+
addConnection(userId: string, socketId: string): Promise<void>;
|
|
9
|
+
removeConnection(userId: string, socketId: string): Promise<void>;
|
|
10
|
+
heartbeat(userId: string): Promise<void>;
|
|
11
|
+
getPresence(userId: string): Promise<RealtimePresence>;
|
|
12
|
+
isOnline(userId: string): Promise<boolean>;
|
|
13
|
+
private ttlSeconds;
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=realtime-presence.service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"realtime-presence.service.d.ts","sourceRoot":"","sources":["../../../../src/modules/realtime/services/realtime-presence.service.ts"],"names":[],"mappings":"AACA,OAAO,OAAO,MAAM,SAAS,CAAC;AAI9B,OAAO,EAAE,eAAe,EAAE,MAAM,0CAA0C,CAAC;AAE3E,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAEhE,qBACa,uBAAuB;IAEZ,OAAO,CAAC,QAAQ,CAAC,KAAK;IAC5C,OAAO,CAAC,QAAQ,CAAC,QAAQ;gBADc,KAAK,EAAE,OAAO,EACpC,QAAQ,EAAE,eAAe;IAGrC,aAAa,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAU9D,gBAAgB,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAYjE,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAOxC,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,CAAC;IActD,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAIhD,OAAO,CAAC,UAAU;CAGlB"}
|
|
@@ -0,0 +1,86 @@
|
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
exports.RealtimePresenceService = void 0;
|
|
19
|
+
const common_1 = require("@nestjs/common");
|
|
20
|
+
const ioredis_1 = __importDefault(require("ioredis"));
|
|
21
|
+
const redis_module_1 = require("../../../config/redis.module");
|
|
22
|
+
const settings_keys_1 = require("../../settings/constants/settings.keys");
|
|
23
|
+
const settings_service_1 = require("../../settings/services/settings.service");
|
|
24
|
+
const realtime_constants_1 = require("../constants/realtime.constants");
|
|
25
|
+
let RealtimePresenceService = class RealtimePresenceService {
|
|
26
|
+
redis;
|
|
27
|
+
settings;
|
|
28
|
+
constructor(redis, settings) {
|
|
29
|
+
this.redis = redis;
|
|
30
|
+
this.settings = settings;
|
|
31
|
+
}
|
|
32
|
+
async addConnection(userId, socketId) {
|
|
33
|
+
const key = (0, realtime_constants_1.presenceKey)(userId);
|
|
34
|
+
const ttl = this.ttlSeconds();
|
|
35
|
+
const pipeline = this.redis.pipeline();
|
|
36
|
+
pipeline.sadd(key, socketId);
|
|
37
|
+
pipeline.set(`${key}:last`, new Date().toISOString(), 'EX', ttl);
|
|
38
|
+
pipeline.expire(key, ttl);
|
|
39
|
+
await pipeline.exec();
|
|
40
|
+
}
|
|
41
|
+
async removeConnection(userId, socketId) {
|
|
42
|
+
const key = (0, realtime_constants_1.presenceKey)(userId);
|
|
43
|
+
await this.redis.srem(key, socketId);
|
|
44
|
+
const remaining = await this.redis.scard(key);
|
|
45
|
+
if (remaining <= 0) {
|
|
46
|
+
await this.redis.del(key);
|
|
47
|
+
await this.redis.set(`${key}:last`, new Date().toISOString(), 'EX', this.ttlSeconds());
|
|
48
|
+
}
|
|
49
|
+
else {
|
|
50
|
+
await this.redis.expire(key, this.ttlSeconds());
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
async heartbeat(userId) {
|
|
54
|
+
const key = (0, realtime_constants_1.presenceKey)(userId);
|
|
55
|
+
const ttl = this.ttlSeconds();
|
|
56
|
+
await this.redis.set(`${key}:last`, new Date().toISOString(), 'EX', ttl);
|
|
57
|
+
await this.redis.expire(key, ttl);
|
|
58
|
+
}
|
|
59
|
+
async getPresence(userId) {
|
|
60
|
+
const key = (0, realtime_constants_1.presenceKey)(userId);
|
|
61
|
+
const [connectionCount, lastSeenAt] = await Promise.all([
|
|
62
|
+
this.redis.scard(key),
|
|
63
|
+
this.redis.get(`${key}:last`),
|
|
64
|
+
]);
|
|
65
|
+
return {
|
|
66
|
+
userId,
|
|
67
|
+
online: connectionCount > 0,
|
|
68
|
+
connectionCount,
|
|
69
|
+
lastSeenAt,
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
async isOnline(userId) {
|
|
73
|
+
return (await this.redis.scard((0, realtime_constants_1.presenceKey)(userId))) > 0;
|
|
74
|
+
}
|
|
75
|
+
ttlSeconds() {
|
|
76
|
+
return Math.max(30, this.settings.get(settings_keys_1.SETTING_KEYS.REALTIME_PRESENCE_TTL_SECONDS));
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
exports.RealtimePresenceService = RealtimePresenceService;
|
|
80
|
+
exports.RealtimePresenceService = RealtimePresenceService = __decorate([
|
|
81
|
+
(0, common_1.Injectable)(),
|
|
82
|
+
__param(0, (0, common_1.Inject)(redis_module_1.REDIS_CLIENT)),
|
|
83
|
+
__metadata("design:paramtypes", [ioredis_1.default,
|
|
84
|
+
settings_service_1.SettingsService])
|
|
85
|
+
], RealtimePresenceService);
|
|
86
|
+
//# sourceMappingURL=realtime-presence.service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"realtime-presence.service.js","sourceRoot":"","sources":["../../../../src/modules/realtime/services/realtime-presence.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,2CAAoD;AACpD,sDAA8B;AAE9B,+DAA4D;AAC5D,0EAAsE;AACtE,+EAA2E;AAC3E,wEAA8D;AAIvD,IAAM,uBAAuB,GAA7B,MAAM,uBAAuB;IAEK;IACtB;IAFlB,YACwC,KAAc,EACpC,QAAyB;QADH,UAAK,GAAL,KAAK,CAAS;QACpC,aAAQ,GAAR,QAAQ,CAAiB;IACxC,CAAC;IAEJ,KAAK,CAAC,aAAa,CAAC,MAAc,EAAE,QAAgB;QACnD,MAAM,GAAG,GAAG,IAAA,gCAAW,EAAC,MAAM,CAAC,CAAC;QAChC,MAAM,GAAG,GAAG,IAAI,CAAC,UAAU,EAAE,CAAC;QAC9B,MAAM,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC;QACvC,QAAQ,C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C,WAAW,EAAE,EAAE,IAAI,EAAE,GAAG,CAAC,CAAC;QACzE,MAAM,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;IACnC,CAAC;IAED,KAAK,CAAC,WAAW,CAAC,MAAc;QAC/B,MAAM,GAAG,GAAG,IAAA,gCAAW,EAAC,MAAM,CAAC,CAAC;QAChC,MAAM,CAAC,eAAe,EAAE,UAAU,CAAC,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC;YACvD,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC;YACrB,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,GAAG,OAAO,CAAC;SAC7B,CAAC,CAAC;QACH,OAAO;YACN,MAAM;YACN,MAAM,EAAE,eAAe,GAAG,CAAC;YAC3B,eAAe;YACf,UAAU;SACV,CAAC;IACH,CAAC;IAED,KAAK,CAAC,QAAQ,CAAC,MAAc;QAC5B,OAAO,CAAC,MAAM,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,IAAA,gCAAW,EAAC,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;IAC1D,CAAC;IAEO,UAAU;QACjB,OAAO,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAS,4BAAY,CAAC,6BAA6B,CAAC,CAAC,CAAC;IAC5F,CAAC;CACD,CAAA;AAxDY,0DAAuB;kCAAvB,uBAAuB;IADnC,IAAA,mBAAU,GAAE;IAGV,WAAA,IAAA,eAAM,EAAC,2BAAY,CAAC,CAAA;qCAAyB,iBAAO;QAC1B,kCAAe;GAH/B,uBAAuB,CAwDnC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import IORedis from 'ioredis';
|
|
2
|
+
import { SettingsService } from '../../settings/services/settings.service';
|
|
3
|
+
export declare class RealtimeRateLimiterService {
|
|
4
|
+
private readonly redis;
|
|
5
|
+
private readonly settings;
|
|
6
|
+
constructor(redis: IORedis, settings: SettingsService);
|
|
7
|
+
allowHandshake(ip: string): Promise<boolean>;
|
|
8
|
+
allowEmit(userId: string): Promise<boolean>;
|
|
9
|
+
allowInbound(userId: string): Promise<boolean>;
|
|
10
|
+
private hit;
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=realtime-rate-limiter.service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"realtime-rate-limiter.service.d.ts","sourceRoot":"","sources":["../../../../src/modules/realtime/services/realtime-rate-limiter.service.ts"],"names":[],"mappings":"AACA,OAAO,OAAO,MAAM,SAAS,CAAC;AAI9B,OAAO,EAAE,eAAe,EAAE,MAAM,0CAA0C,CAAC;AAE3E,qBACa,0BAA0B;IAEf,OAAO,CAAC,QAAQ,CAAC,KAAK;IAC5C,OAAO,CAAC,QAAQ,CAAC,QAAQ;gBADc,KAAK,EAAE,OAAO,EACpC,QAAQ,EAAE,eAAe;IAGrC,cAAc,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAQ5C,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAQ3C,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;YAQtC,GAAG;CAQjB"}
|
|
@@ -0,0 +1,63 @@
|
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
exports.RealtimeRateLimiterService = void 0;
|
|
19
|
+
const common_1 = require("@nestjs/common");
|
|
20
|
+
const ioredis_1 = __importDefault(require("ioredis"));
|
|
21
|
+
const redis_module_1 = require("../../../config/redis.module");
|
|
22
|
+
const settings_keys_1 = require("../../settings/constants/settings.keys");
|
|
23
|
+
const settings_service_1 = require("../../settings/services/settings.service");
|
|
24
|
+
let RealtimeRateLimiterService = class RealtimeRateLimiterService {
|
|
25
|
+
redis;
|
|
26
|
+
settings;
|
|
27
|
+
constructor(redis, settings) {
|
|
28
|
+
this.redis = redis;
|
|
29
|
+
this.settings = settings;
|
|
30
|
+
}
|
|
31
|
+
async allowHandshake(ip) {
|
|
32
|
+
const max = this.settings.get(settings_keys_1.SETTING_KEYS.REALTIME_HANDSHAKE_IP_RATE_LIMIT_MAX);
|
|
33
|
+
const window = this.settings.get(settings_keys_1.SETTING_KEYS.REALTIME_HANDSHAKE_IP_RATE_LIMIT_WINDOW_SECONDS);
|
|
34
|
+
return this.hit(`realtime:rl:hs:${ip || 'unknown'}`, max, window);
|
|
35
|
+
}
|
|
36
|
+
async allowEmit(userId) {
|
|
37
|
+
const max = this.settings.get(settings_keys_1.SETTING_KEYS.REALTIME_EMIT_USER_RATE_LIMIT_MAX);
|
|
38
|
+
const window = this.settings.get(settings_keys_1.SETTING_KEYS.REALTIME_EMIT_USER_RATE_LIMIT_WINDOW_SECONDS);
|
|
39
|
+
return this.hit(`realtime:rl:emit:${userId}`, max, window);
|
|
40
|
+
}
|
|
41
|
+
async allowInbound(userId) {
|
|
42
|
+
const max = this.settings.get(settings_keys_1.SETTING_KEYS.REALTIME_INBOUND_USER_RATE_LIMIT_MAX);
|
|
43
|
+
const window = this.settings.get(settings_keys_1.SETTING_KEYS.REALTIME_INBOUND_USER_RATE_LIMIT_WINDOW_SECONDS);
|
|
44
|
+
return this.hit(`realtime:rl:in:${userId}`, max, window);
|
|
45
|
+
}
|
|
46
|
+
async hit(key, max, windowSeconds) {
|
|
47
|
+
if (max <= 0)
|
|
48
|
+
return true;
|
|
49
|
+
const count = await this.redis.incr(key);
|
|
50
|
+
if (count === 1) {
|
|
51
|
+
await this.redis.expire(key, Math.max(1, windowSeconds));
|
|
52
|
+
}
|
|
53
|
+
return count <= max;
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
exports.RealtimeRateLimiterService = RealtimeRateLimiterService;
|
|
57
|
+
exports.RealtimeRateLimiterService = RealtimeRateLimiterService = __decorate([
|
|
58
|
+
(0, common_1.Injectable)(),
|
|
59
|
+
__param(0, (0, common_1.Inject)(redis_module_1.REDIS_CLIENT)),
|
|
60
|
+
__metadata("design:paramtypes", [ioredis_1.default,
|
|
61
|
+
settings_service_1.SettingsService])
|
|
62
|
+
], RealtimeRateLimiterService);
|
|
63
|
+
//# sourceMappingURL=realtime-rate-limiter.service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"realtime-rate-limiter.service.js","sourceRoot":"","sources":["../../../../src/modules/realtime/services/realtime-rate-limiter.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,2CAAoD;AACpD,sDAA8B;AAE9B,+DAA4D;AAC5D,0EAAsE;AACtE,+EAA2E;AAGpE,IAAM,0BAA0B,GAAhC,MAAM,0BAA0B;IAEE;IACtB;IAFlB,YACwC,KAAc,EACpC,QAAyB;QADH,UAAK,G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KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QACzC,IAAI,KAAK,KAAK,CAAC,EAAE,CAAC;YACjB,MAAM,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,GAAG,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,aAAa,CAAC,CAAC,CAAC;QAC1D,CAAC;QACD,OAAO,KAAK,IAAI,GAAG,CAAC;IACrB,CAAC;CACD,CAAA;AAtCY,gEAA0B;qCAA1B,0BAA0B;IADtC,IAAA,mBAAU,GAAE;IAGV,WAAA,IAAA,eAAM,EAAC,2BAAY,CAAC,CAAA;qCAAyB,iBAAO;QAC1B,kCAAe;GAH/B,0BAA0B,CAsCtC"}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { OnModuleDestroy, OnModuleInit } from '@nestjs/common';
|
|
2
|
+
import { ConfigService } from '@nestjs/config';
|
|
3
|
+
import { JwtService } from '@nestjs/jwt';
|
|
4
|
+
import IORedis from 'ioredis';
|
|
5
|
+
import type { Server, Socket } from 'socket.io';
|
|
6
|
+
import { AccessTokenValidator } from '../../auth/auth-core/services/access-token.validator';
|
|
7
|
+
import { MetricsService } from '../../observability/metrics/metrics.service';
|
|
8
|
+
import { SettingsService } from '../../settings/services/settings.service';
|
|
9
|
+
import type { RealtimeEmitOptions, RealtimePresence, RealtimeSocketData } from '../types/realtime.types';
|
|
10
|
+
import { RealtimePresenceService } from './realtime-presence.service';
|
|
11
|
+
import { RealtimeRateLimiterService } from './realtime-rate-limiter.service';
|
|
12
|
+
export declare class RealtimeService implements OnModuleInit, OnModuleDestroy {
|
|
13
|
+
private readonly jwtService;
|
|
14
|
+
private readonly accessTokenValidator;
|
|
15
|
+
private readonly presence;
|
|
16
|
+
private readonly rateLimiter;
|
|
17
|
+
private readonly settings;
|
|
18
|
+
private readonly configService;
|
|
19
|
+
private readonly redis;
|
|
20
|
+
private readonly metrics?;
|
|
21
|
+
private readonly logger;
|
|
22
|
+
/** Used to ignore control-channel echoes from this process. */
|
|
23
|
+
readonly instanceId: `${string}-${string}-${string}-${string}-${string}`;
|
|
24
|
+
private server;
|
|
25
|
+
private controlSub;
|
|
26
|
+
private localConnections;
|
|
27
|
+
/** Disconnects requested before the Socket.IO server was attached. */
|
|
28
|
+
private pendingDisconnects;
|
|
29
|
+
constructor(jwtService: JwtService, accessTokenValidator: AccessTokenValidator, presence: RealtimePresenceService, rateLimiter: RealtimeRateLimiterService, settings: SettingsService, configService: ConfigService, redis: IORedis, metrics?: MetricsService | undefined);
|
|
30
|
+
onModuleInit(): void;
|
|
31
|
+
onModuleDestroy(): Promise<void>;
|
|
32
|
+
/** Called by the gateway when the Socket.IO server is ready. */
|
|
33
|
+
attachServer(server: Server): void;
|
|
34
|
+
getServer(): Server | null;
|
|
35
|
+
isReady(): boolean;
|
|
36
|
+
trackConnect(): void;
|
|
37
|
+
trackDisconnect(): void;
|
|
38
|
+
getLocalConnectionCount(): number;
|
|
39
|
+
buildHandshakeDpopUri(host: string, proto?: string): string;
|
|
40
|
+
authenticateToken(token: string, dpopCtx: {
|
|
41
|
+
method: string;
|
|
42
|
+
uri: string;
|
|
43
|
+
dpop?: string;
|
|
44
|
+
}): Promise<RealtimeSocketData>;
|
|
45
|
+
emitToUser(userId: string, event: string, payload: unknown, opts?: RealtimeEmitOptions): Promise<boolean>;
|
|
46
|
+
emitToUsers(userIds: string[], event: string, payload: unknown, opts?: RealtimeEmitOptions): Promise<number>;
|
|
47
|
+
emitToRoom(room: string, event: string, payload: unknown, opts?: RealtimeEmitOptions, rateLimitUserId?: string): Promise<boolean>;
|
|
48
|
+
emitToAll(event: string, payload: unknown, opts?: RealtimeEmitOptions): Promise<boolean>;
|
|
49
|
+
joinRoom(socket: Socket, room: string): Promise<void>;
|
|
50
|
+
/**
|
|
51
|
+
* Add all of a user's connected sockets to an allowlisted room
|
|
52
|
+
* (e.g. `tenant:{id}`, `role:{slug}`) without holding a Socket reference.
|
|
53
|
+
*/
|
|
54
|
+
addUserToRoom(userId: string, room: string): Promise<void>;
|
|
55
|
+
/** Remove a user's sockets from an allowlisted room. */
|
|
56
|
+
removeUserFromRoom(userId: string, room: string): Promise<void>;
|
|
57
|
+
/**
|
|
58
|
+
* Admin / explicit disconnect. Applies locally; Socket.IO Redis adapter fans out
|
|
59
|
+
* room emit/disconnect to other instances. Control publish is an origin-tagged
|
|
60
|
+
* backup signal — peers apply disconnect-only (no second session.revoked emit).
|
|
61
|
+
*/
|
|
62
|
+
disconnectUser(userId: string, reason?: string): void;
|
|
63
|
+
disconnectFamily(familyId: string, reason?: string): void;
|
|
64
|
+
/**
|
|
65
|
+
* Session layer entry point — always applies locally (works with REDIS_ENABLED=false).
|
|
66
|
+
* Cross-instance: Socket.IO Redis adapter fans out room disconnect/emit.
|
|
67
|
+
*/
|
|
68
|
+
notifySessionRevokedUser(userId: string): void;
|
|
69
|
+
notifySessionRevokedFamily(familyId: string): void;
|
|
70
|
+
/** Local apply — used by gateway ops and control-channel subscriber. */
|
|
71
|
+
applyDisconnectUser(userId: string, reason?: string, opts?: {
|
|
72
|
+
emitEvent?: boolean;
|
|
73
|
+
}): void;
|
|
74
|
+
applyDisconnectFamily(familyId: string, reason?: string, opts?: {
|
|
75
|
+
emitEvent?: boolean;
|
|
76
|
+
}): void;
|
|
77
|
+
isOnline(userId: string): Promise<boolean>;
|
|
78
|
+
getPresence(userId: string): Promise<RealtimePresence>;
|
|
79
|
+
/** Bind Redis control subscriber (called from adapter lifecycle when Redis on). */
|
|
80
|
+
bindControlSubscriber(sub: {
|
|
81
|
+
subscribe: (channel: string, handler: (msg: string) => void) => Promise<void>;
|
|
82
|
+
unsubscribe: () => Promise<void>;
|
|
83
|
+
}): void;
|
|
84
|
+
private publishControl;
|
|
85
|
+
private assertRoomAllowed;
|
|
86
|
+
private assertEventName;
|
|
87
|
+
}
|
|
88
|
+
//# sourceMappingURL=realtime.service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"realtime.service.d.ts","sour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