@carlonicora/nestjs-neo4jsonapi 1.115.1 → 1.117.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/dist/bootstrap/app.module.factory.d.ts.map +1 -1
- package/dist/bootstrap/app.module.factory.js +1 -0
- package/dist/bootstrap/app.module.factory.js.map +1 -1
- package/dist/bootstrap/bootstrap.options.d.ts +17 -0
- package/dist/bootstrap/bootstrap.options.d.ts.map +1 -1
- package/dist/common/guards/jwt.auth.admin.guard.d.ts +3 -2
- package/dist/common/guards/jwt.auth.admin.guard.d.ts.map +1 -1
- package/dist/common/guards/jwt.auth.admin.guard.js +19 -4
- package/dist/common/guards/jwt.auth.admin.guard.js.map +1 -1
- package/dist/common/guards/jwt.auth.guard.d.ts +3 -2
- package/dist/common/guards/jwt.auth.guard.d.ts.map +1 -1
- package/dist/common/guards/jwt.auth.guard.js +7 -2
- package/dist/common/guards/jwt.auth.guard.js.map +1 -1
- package/dist/common/interfaces/entity.schema.interface.d.ts +2 -0
- package/dist/common/interfaces/entity.schema.interface.d.ts.map +1 -1
- package/dist/common/tokens.d.ts +68 -0
- package/dist/common/tokens.d.ts.map +1 -1
- package/dist/common/tokens.js +37 -2
- package/dist/common/tokens.js.map +1 -1
- package/dist/config/base.config.d.ts.map +1 -1
- package/dist/config/base.config.js +9 -0
- package/dist/config/base.config.js.map +1 -1
- package/dist/config/enums/queue.id.d.ts +2 -1
- package/dist/config/enums/queue.id.d.ts.map +1 -1
- package/dist/config/enums/queue.id.js +1 -0
- package/dist/config/enums/queue.id.js.map +1 -1
- package/dist/config/interfaces/base.config.interface.d.ts +2 -0
- package/dist/config/interfaces/base.config.interface.d.ts.map +1 -1
- package/dist/config/interfaces/config.ai.interface.d.ts +8 -0
- package/dist/config/interfaces/config.ai.interface.d.ts.map +1 -1
- package/dist/config/interfaces/config.auth.interface.d.ts +7 -0
- package/dist/config/interfaces/config.auth.interface.d.ts.map +1 -1
- package/dist/config/interfaces/config.credits.interface.d.ts +24 -0
- package/dist/config/interfaces/config.credits.interface.d.ts.map +1 -0
- package/dist/{foundations/auth/entities/auth.entity.js → config/interfaces/config.credits.interface.js} +1 -1
- package/dist/config/interfaces/config.credits.interface.js.map +1 -0
- package/dist/config/interfaces/config.email.interface.d.ts +6 -0
- package/dist/config/interfaces/config.email.interface.d.ts.map +1 -1
- package/dist/config/interfaces/index.d.ts +1 -0
- package/dist/config/interfaces/index.d.ts.map +1 -1
- package/dist/config/interfaces/index.js +1 -0
- package/dist/config/interfaces/index.js.map +1 -1
- package/dist/core/email/services/email.service.d.ts +1 -0
- package/dist/core/email/services/email.service.d.ts.map +1 -1
- package/dist/core/email/services/email.service.js +10 -7
- package/dist/core/email/services/email.service.js.map +1 -1
- package/dist/core/llm/services/embedder.service.d.ts +36 -2
- package/dist/core/llm/services/embedder.service.d.ts.map +1 -1
- package/dist/core/llm/services/embedder.service.js +87 -7
- package/dist/core/llm/services/embedder.service.js.map +1 -1
- package/dist/core/llm/services/llm.service.d.ts +9 -1
- package/dist/core/llm/services/llm.service.d.ts.map +1 -1
- package/dist/core/llm/services/llm.service.js +13 -3
- package/dist/core/llm/services/llm.service.js.map +1 -1
- package/dist/core/neo4j/abstracts/abstract.repository.d.ts.map +1 -1
- package/dist/core/neo4j/abstracts/abstract.repository.js +33 -2
- package/dist/core/neo4j/abstracts/abstract.repository.js.map +1 -1
- package/dist/foundations/auth/auth.module.d.ts.map +1 -1
- package/dist/foundations/auth/auth.module.js +9 -10
- package/dist/foundations/auth/auth.module.js.map +1 -1
- package/dist/foundations/auth/controllers/auth.controller.d.ts.map +1 -1
- package/dist/foundations/auth/controllers/auth.controller.js +5 -0
- package/dist/foundations/auth/controllers/auth.controller.js.map +1 -1
- package/dist/foundations/auth/controllers/auth.discord.controller.d.ts.map +1 -1
- package/dist/foundations/auth/controllers/auth.discord.controller.js +6 -3
- package/dist/foundations/auth/controllers/auth.discord.controller.js.map +1 -1
- package/dist/foundations/auth/controllers/auth.google.controller.d.ts.map +1 -1
- package/dist/foundations/auth/controllers/auth.google.controller.js +7 -3
- package/dist/foundations/auth/controllers/auth.google.controller.js.map +1 -1
- package/dist/foundations/auth/entities/auth.code.d.ts +34 -0
- package/dist/foundations/auth/entities/auth.code.d.ts.map +1 -0
- package/dist/foundations/auth/entities/auth.code.js +53 -0
- package/dist/foundations/auth/entities/auth.code.js.map +1 -0
- package/dist/foundations/auth/entities/auth.d.ts +41 -0
- package/dist/foundations/auth/entities/auth.d.ts.map +1 -0
- package/dist/foundations/auth/entities/auth.js +68 -0
- package/dist/foundations/auth/entities/auth.js.map +1 -0
- package/dist/foundations/auth/entities/pending-auth.d.ts +39 -0
- package/dist/foundations/auth/entities/pending-auth.d.ts.map +1 -0
- package/dist/foundations/auth/entities/pending-auth.js +41 -0
- package/dist/foundations/auth/entities/pending-auth.js.map +1 -0
- package/dist/foundations/auth/index.d.ts +13 -0
- package/dist/foundations/auth/index.d.ts.map +1 -1
- package/dist/foundations/auth/index.js +31 -1
- package/dist/foundations/auth/index.js.map +1 -1
- package/dist/foundations/auth/repositories/auth.repository.d.ts +49 -9
- package/dist/foundations/auth/repositories/auth.repository.d.ts.map +1 -1
- package/dist/foundations/auth/repositories/auth.repository.js +115 -63
- package/dist/foundations/auth/repositories/auth.repository.js.map +1 -1
- package/dist/foundations/auth/services/auth.discord.service.d.ts +1 -1
- package/dist/foundations/auth/services/auth.discord.service.d.ts.map +1 -1
- package/dist/foundations/auth/services/auth.discord.service.js +5 -2
- package/dist/foundations/auth/services/auth.discord.service.js.map +1 -1
- package/dist/foundations/auth/services/auth.google.service.d.ts +1 -1
- package/dist/foundations/auth/services/auth.google.service.d.ts.map +1 -1
- package/dist/foundations/auth/services/auth.google.service.js +6 -2
- package/dist/foundations/auth/services/auth.google.service.js.map +1 -1
- package/dist/foundations/auth/services/auth.service.d.ts +42 -7
- package/dist/foundations/auth/services/auth.service.d.ts.map +1 -1
- package/dist/foundations/auth/services/auth.service.js +140 -77
- package/dist/foundations/auth/services/auth.service.js.map +1 -1
- package/dist/foundations/company/dtos/company.post.dto.d.ts +3 -3
- package/dist/foundations/company/dtos/company.post.dto.d.ts.map +1 -1
- package/dist/foundations/company/dtos/company.post.dto.js +3 -3
- package/dist/foundations/company/dtos/company.post.dto.js.map +1 -1
- package/dist/foundations/company/dtos/company.put.dto.d.ts +3 -3
- package/dist/foundations/company/dtos/company.put.dto.d.ts.map +1 -1
- package/dist/foundations/company/dtos/company.put.dto.js +3 -3
- package/dist/foundations/company/dtos/company.put.dto.js.map +1 -1
- package/dist/foundations/company/entities/company.d.ts +4 -4
- package/dist/foundations/company/entities/company.d.ts.map +1 -1
- package/dist/foundations/company/entities/company.js +18 -4
- package/dist/foundations/company/entities/company.js.map +1 -1
- package/dist/foundations/company/index.d.ts +5 -0
- package/dist/foundations/company/index.d.ts.map +1 -1
- package/dist/foundations/company/index.js +16 -1
- package/dist/foundations/company/index.js.map +1 -1
- package/dist/foundations/company/processors/company.processor.js +1 -1
- package/dist/foundations/company/processors/company.processor.js.map +1 -1
- package/dist/foundations/company/repositories/company.repository.d.ts +96 -33
- package/dist/foundations/company/repositories/company.repository.d.ts.map +1 -1
- package/dist/foundations/company/repositories/company.repository.js +125 -95
- package/dist/foundations/company/repositories/company.repository.js.map +1 -1
- package/dist/foundations/company/services/company.service.d.ts +52 -13
- package/dist/foundations/company/services/company.service.d.ts.map +1 -1
- package/dist/foundations/company/services/company.service.js +62 -39
- package/dist/foundations/company/services/company.service.js.map +1 -1
- package/dist/foundations/content/content.module.d.ts +20 -8
- package/dist/foundations/content/content.module.d.ts.map +1 -1
- package/dist/foundations/content/content.module.js +40 -24
- package/dist/foundations/content/content.module.js.map +1 -1
- package/dist/foundations/content/controllers/content.controller.d.ts +1 -1
- package/dist/foundations/content/controllers/content.controller.d.ts.map +1 -1
- package/dist/foundations/content/controllers/content.controller.js +2 -2
- package/dist/foundations/content/controllers/content.controller.js.map +1 -1
- package/dist/foundations/content/entities/content.d.ts +74 -0
- package/dist/foundations/content/entities/content.d.ts.map +1 -0
- package/dist/foundations/content/entities/content.js +141 -0
- package/dist/foundations/content/entities/content.js.map +1 -0
- package/dist/foundations/content/index.d.ts +2 -4
- package/dist/foundations/content/index.d.ts.map +1 -1
- package/dist/foundations/content/index.js +6 -5
- package/dist/foundations/content/index.js.map +1 -1
- package/dist/foundations/content/interfaces/content.extension.interface.d.ts +126 -0
- package/dist/foundations/content/interfaces/content.extension.interface.d.ts.map +1 -1
- package/dist/foundations/content/interfaces/content.extension.interface.js +7 -1
- package/dist/foundations/content/interfaces/content.extension.interface.js.map +1 -1
- package/dist/foundations/content/repositories/content.repository.d.ts +14 -7
- package/dist/foundations/content/repositories/content.repository.d.ts.map +1 -1
- package/dist/foundations/content/repositories/content.repository.js +18 -16
- package/dist/foundations/content/repositories/content.repository.js.map +1 -1
- package/dist/foundations/content/services/content.cypher.service.d.ts +19 -0
- package/dist/foundations/content/services/content.cypher.service.d.ts.map +1 -1
- package/dist/foundations/content/services/content.cypher.service.js +65 -4
- package/dist/foundations/content/services/content.cypher.service.js.map +1 -1
- package/dist/foundations/content/services/content.service.js +4 -4
- package/dist/foundations/content/services/content.service.js.map +1 -1
- package/dist/foundations/discord-user/services/discord-user.service.js +2 -2
- package/dist/foundations/discord-user/services/discord-user.service.js.map +1 -1
- package/dist/foundations/feature/entities/feature.d.ts +32 -0
- package/dist/foundations/feature/entities/feature.d.ts.map +1 -0
- package/dist/foundations/feature/entities/feature.js +64 -0
- package/dist/foundations/feature/entities/feature.js.map +1 -0
- package/dist/foundations/feature/entities/feature.model.d.ts +1 -3
- package/dist/foundations/feature/entities/feature.model.d.ts.map +1 -1
- package/dist/foundations/feature/entities/feature.model.js +3 -11
- package/dist/foundations/feature/entities/feature.model.js.map +1 -1
- package/dist/foundations/feature/feature.module.d.ts.map +1 -1
- package/dist/foundations/feature/feature.module.js +4 -5
- package/dist/foundations/feature/feature.module.js.map +1 -1
- package/dist/foundations/feature/index.d.ts +12 -0
- package/dist/foundations/feature/index.d.ts.map +1 -1
- package/dist/foundations/feature/index.js +22 -1
- package/dist/foundations/feature/index.js.map +1 -1
- package/dist/foundations/feature/repositories/feature.repository.d.ts +37 -13
- package/dist/foundations/feature/repositories/feature.repository.d.ts.map +1 -1
- package/dist/foundations/feature/repositories/feature.repository.js +41 -35
- package/dist/foundations/feature/repositories/feature.repository.js.map +1 -1
- package/dist/foundations/feature/services/feature.service.d.ts +31 -4
- package/dist/foundations/feature/services/feature.service.d.ts.map +1 -1
- package/dist/foundations/feature/services/feature.service.js +20 -12
- package/dist/foundations/feature/services/feature.service.js.map +1 -1
- package/dist/foundations/foundations.modules.d.ts +6 -0
- package/dist/foundations/foundations.modules.d.ts.map +1 -1
- package/dist/foundations/foundations.modules.js +14 -3
- package/dist/foundations/foundations.modules.js.map +1 -1
- package/dist/foundations/google-user/services/google-user.service.js +2 -2
- package/dist/foundations/google-user/services/google-user.service.js.map +1 -1
- package/dist/foundations/index.d.ts +3 -0
- package/dist/foundations/index.d.ts.map +1 -1
- package/dist/foundations/index.js +3 -0
- package/dist/foundations/index.js.map +1 -1
- package/dist/foundations/membership/entities/membership.d.ts.map +1 -1
- package/dist/foundations/membership/entities/membership.js +4 -0
- package/dist/foundations/membership/entities/membership.js.map +1 -1
- package/dist/foundations/notification/controllers/notification.controller.js +2 -2
- package/dist/foundations/notification/controllers/notification.controller.js.map +1 -1
- package/dist/foundations/notification/entities/notification.d.ts +75 -0
- package/dist/foundations/notification/entities/notification.d.ts.map +1 -0
- package/dist/foundations/notification/entities/notification.js +73 -0
- package/dist/foundations/notification/entities/notification.js.map +1 -0
- package/dist/foundations/notification/index.d.ts +6 -2
- package/dist/foundations/notification/index.d.ts.map +1 -1
- package/dist/foundations/notification/index.js +17 -3
- package/dist/foundations/notification/index.js.map +1 -1
- package/dist/foundations/notification/notification.module.d.ts.map +1 -1
- package/dist/foundations/notification/notification.module.js +3 -4
- package/dist/foundations/notification/notification.module.js.map +1 -1
- package/dist/foundations/notification/repositories/notification.repository.d.ts +125 -8
- package/dist/foundations/notification/repositories/notification.repository.d.ts.map +1 -1
- package/dist/foundations/notification/repositories/notification.repository.js +219 -20
- package/dist/foundations/notification/repositories/notification.repository.js.map +1 -1
- package/dist/foundations/notification/services/notification.service.d.ts +31 -5
- package/dist/foundations/notification/services/notification.service.d.ts.map +1 -1
- package/dist/foundations/notification/services/notification.service.js +26 -9
- package/dist/foundations/notification/services/notification.service.js.map +1 -1
- package/dist/foundations/rbac/dump.d.ts +48 -4
- package/dist/foundations/rbac/dump.d.ts.map +1 -1
- package/dist/foundations/rbac/dump.js +28 -4
- package/dist/foundations/rbac/dump.js.map +1 -1
- package/dist/foundations/rbac/serializer/matrix-to-ts.d.ts +14 -0
- package/dist/foundations/rbac/serializer/matrix-to-ts.d.ts.map +1 -1
- package/dist/foundations/rbac/serializer/matrix-to-ts.js +13 -3
- package/dist/foundations/rbac/serializer/matrix-to-ts.js.map +1 -1
- package/dist/foundations/referral/services/referral.service.js +4 -4
- package/dist/foundations/referral/services/referral.service.js.map +1 -1
- package/dist/foundations/relevancy/repositories/relevancy.repository.d.ts.map +1 -1
- package/dist/foundations/relevancy/repositories/relevancy.repository.js +13 -1
- package/dist/foundations/relevancy/repositories/relevancy.repository.js.map +1 -1
- package/dist/foundations/role/entities/role.d.ts +1 -1
- package/dist/foundations/role/entities/role.d.ts.map +1 -1
- package/dist/foundations/stripe/index.d.ts +3 -0
- package/dist/foundations/stripe/index.d.ts.map +1 -1
- package/dist/foundations/stripe/index.js +6 -0
- package/dist/foundations/stripe/index.js.map +1 -1
- package/dist/foundations/stripe-price/entities/stripe-price.entity.d.ts +1 -1
- package/dist/foundations/stripe-price/entities/stripe-price.entity.d.ts.map +1 -1
- package/dist/foundations/stripe-subscription/services/token-allocation.service.d.ts +1 -1
- package/dist/foundations/stripe-subscription/services/token-allocation.service.js +10 -10
- package/dist/foundations/stripe-subscription/services/token-allocation.service.js.map +1 -1
- package/dist/foundations/stripe-trial/services/trial.service.js +2 -2
- package/dist/foundations/stripe-trial/services/trial.service.js.map +1 -1
- package/dist/foundations/stripe-webhook/processors/stripe-webhook.processor.js +2 -2
- package/dist/foundations/stripe-webhook/processors/stripe-webhook.processor.js.map +1 -1
- package/dist/foundations/tokenusage/entities/tokenusage.d.ts +50 -0
- package/dist/foundations/tokenusage/entities/tokenusage.d.ts.map +1 -0
- package/dist/foundations/tokenusage/entities/tokenusage.js +68 -0
- package/dist/foundations/tokenusage/entities/tokenusage.js.map +1 -0
- package/dist/foundations/tokenusage/enums/tokenusage.type.d.ts +2 -1
- package/dist/foundations/tokenusage/enums/tokenusage.type.d.ts.map +1 -1
- package/dist/foundations/tokenusage/enums/tokenusage.type.js +1 -0
- package/dist/foundations/tokenusage/enums/tokenusage.type.js.map +1 -1
- package/dist/foundations/tokenusage/events/tokenusage.events.d.ts +2 -0
- package/dist/foundations/tokenusage/events/tokenusage.events.d.ts.map +1 -1
- package/dist/foundations/tokenusage/index.d.ts +3 -3
- package/dist/foundations/tokenusage/index.d.ts.map +1 -1
- package/dist/foundations/tokenusage/index.js +5 -3
- package/dist/foundations/tokenusage/index.js.map +1 -1
- package/dist/foundations/tokenusage/repositories/tokenusage.repository.d.ts +90 -5
- package/dist/foundations/tokenusage/repositories/tokenusage.repository.d.ts.map +1 -1
- package/dist/foundations/tokenusage/repositories/tokenusage.repository.js +165 -14
- package/dist/foundations/tokenusage/repositories/tokenusage.repository.js.map +1 -1
- package/dist/foundations/tokenusage/services/tokenusage.service.d.ts +73 -10
- package/dist/foundations/tokenusage/services/tokenusage.service.d.ts.map +1 -1
- package/dist/foundations/tokenusage/services/tokenusage.service.js +88 -8
- package/dist/foundations/tokenusage/services/tokenusage.service.js.map +1 -1
- package/dist/foundations/tokenusage/tokenusage.module.js +3 -3
- package/dist/foundations/tokenusage/tokenusage.module.js.map +1 -1
- package/dist/foundations/user/controllers/user.controller.js +4 -4
- package/dist/foundations/user/controllers/user.controller.js.map +1 -1
- package/dist/foundations/user/dtos/user.put.dto.d.ts +1 -1
- package/dist/foundations/user/dtos/user.put.dto.d.ts.map +1 -1
- package/dist/foundations/user/dtos/user.put.dto.js +1 -1
- package/dist/foundations/user/dtos/user.put.dto.js.map +1 -1
- package/dist/foundations/user/entities/user.d.ts +4 -0
- package/dist/foundations/user/entities/user.d.ts.map +1 -1
- package/dist/foundations/user/entities/user.js +18 -4
- package/dist/foundations/user/entities/user.js.map +1 -1
- package/dist/foundations/user/index.d.ts +6 -1
- package/dist/foundations/user/index.d.ts.map +1 -1
- package/dist/foundations/user/index.js +13 -1
- package/dist/foundations/user/index.js.map +1 -1
- package/dist/foundations/user/repositories/user.repository.d.ts +56 -11
- package/dist/foundations/user/repositories/user.repository.d.ts.map +1 -1
- package/dist/foundations/user/repositories/user.repository.js +55 -35
- package/dist/foundations/user/repositories/user.repository.js.map +1 -1
- package/dist/foundations/user/services/user.service.d.ts +48 -9
- package/dist/foundations/user/services/user.service.d.ts.map +1 -1
- package/dist/foundations/user/services/user.service.js +50 -32
- package/dist/foundations/user/services/user.service.js.map +1 -1
- package/dist/foundations/user-activity/entities/user-activity.d.ts +36 -0
- package/dist/foundations/user-activity/entities/user-activity.d.ts.map +1 -0
- package/dist/foundations/user-activity/entities/user-activity.js +86 -0
- package/dist/foundations/user-activity/entities/user-activity.js.map +1 -0
- package/dist/foundations/user-activity/entities/user-activity.meta.d.ts +3 -0
- package/dist/foundations/user-activity/entities/user-activity.meta.d.ts.map +1 -0
- package/dist/foundations/user-activity/entities/user-activity.meta.js +10 -0
- package/dist/foundations/user-activity/entities/user-activity.meta.js.map +1 -0
- package/dist/foundations/user-activity/index.d.ts +10 -0
- package/dist/foundations/user-activity/index.d.ts.map +1 -0
- package/dist/foundations/user-activity/index.js +22 -0
- package/dist/foundations/user-activity/index.js.map +1 -0
- package/dist/foundations/user-activity/interceptors/user-activity.interceptor.d.ts +29 -0
- package/dist/foundations/user-activity/interceptors/user-activity.interceptor.d.ts.map +1 -0
- package/dist/foundations/user-activity/interceptors/user-activity.interceptor.js +98 -0
- package/dist/foundations/user-activity/interceptors/user-activity.interceptor.js.map +1 -0
- package/dist/foundations/user-activity/interfaces/user-activity.config.interface.d.ts +67 -0
- package/dist/foundations/user-activity/interfaces/user-activity.config.interface.d.ts.map +1 -0
- package/dist/foundations/user-activity/interfaces/user-activity.config.interface.js +26 -0
- package/dist/foundations/user-activity/interfaces/user-activity.config.interface.js.map +1 -0
- package/dist/foundations/user-activity/interfaces/user-activity.record.input.d.ts +18 -0
- package/dist/foundations/user-activity/interfaces/user-activity.record.input.d.ts.map +1 -0
- package/dist/foundations/{auth/entities/pending-auth.entity.js → user-activity/interfaces/user-activity.record.input.js} +1 -1
- package/dist/foundations/user-activity/interfaces/user-activity.record.input.js.map +1 -0
- package/dist/foundations/user-activity/processors/user-activity.processor.d.ts +25 -0
- package/dist/foundations/user-activity/processors/user-activity.processor.d.ts.map +1 -0
- package/dist/foundations/user-activity/processors/user-activity.processor.js +74 -0
- package/dist/foundations/user-activity/processors/user-activity.processor.js.map +1 -0
- package/dist/foundations/user-activity/repositories/user-activity.repository.d.ts +47 -0
- package/dist/foundations/user-activity/repositories/user-activity.repository.d.ts.map +1 -0
- package/dist/foundations/user-activity/repositories/user-activity.repository.js +124 -0
- package/dist/foundations/user-activity/repositories/user-activity.repository.js.map +1 -0
- package/dist/foundations/user-activity/services/user-activity.service.d.ts +29 -0
- package/dist/foundations/user-activity/services/user-activity.service.d.ts.map +1 -0
- package/dist/foundations/user-activity/services/user-activity.service.js +61 -0
- package/dist/foundations/user-activity/services/user-activity.service.js.map +1 -0
- package/dist/foundations/user-activity/user-activity.module.d.ts +40 -0
- package/dist/foundations/user-activity/user-activity.module.d.ts.map +1 -0
- package/dist/foundations/user-activity/user-activity.module.js +99 -0
- package/dist/foundations/user-activity/user-activity.module.js.map +1 -0
- package/package.json +2 -1
- package/dist/foundations/auth/entities/auth.code.entity.d.ts +0 -7
- package/dist/foundations/auth/entities/auth.code.entity.d.ts.map +0 -1
- package/dist/foundations/auth/entities/auth.code.entity.js +0 -3
- package/dist/foundations/auth/entities/auth.code.entity.js.map +0 -1
- package/dist/foundations/auth/entities/auth.code.map.d.ts +0 -8
- package/dist/foundations/auth/entities/auth.code.map.d.ts.map +0 -1
- package/dist/foundations/auth/entities/auth.code.map.js +0 -13
- package/dist/foundations/auth/entities/auth.code.map.js.map +0 -1
- package/dist/foundations/auth/entities/auth.code.model.d.ts +0 -4
- package/dist/foundations/auth/entities/auth.code.model.d.ts.map +0 -1
- package/dist/foundations/auth/entities/auth.code.model.js +0 -13
- package/dist/foundations/auth/entities/auth.code.model.js.map +0 -1
- package/dist/foundations/auth/entities/auth.entity.d.ts +0 -18
- package/dist/foundations/auth/entities/auth.entity.d.ts.map +0 -1
- package/dist/foundations/auth/entities/auth.entity.js.map +0 -1
- package/dist/foundations/auth/entities/auth.map.d.ts +0 -8
- package/dist/foundations/auth/entities/auth.map.d.ts.map +0 -1
- package/dist/foundations/auth/entities/auth.map.js +0 -14
- package/dist/foundations/auth/entities/auth.map.js.map +0 -1
- package/dist/foundations/auth/entities/auth.model.d.ts +0 -4
- package/dist/foundations/auth/entities/auth.model.d.ts.map +0 -1
- package/dist/foundations/auth/entities/auth.model.js +0 -15
- package/dist/foundations/auth/entities/auth.model.js.map +0 -1
- package/dist/foundations/auth/entities/pending-auth.entity.d.ts +0 -16
- package/dist/foundations/auth/entities/pending-auth.entity.d.ts.map +0 -1
- package/dist/foundations/auth/entities/pending-auth.entity.js.map +0 -1
- package/dist/foundations/auth/entities/pending-auth.map.d.ts +0 -6
- package/dist/foundations/auth/entities/pending-auth.map.d.ts.map +0 -1
- package/dist/foundations/auth/entities/pending-auth.map.js +0 -20
- package/dist/foundations/auth/entities/pending-auth.map.js.map +0 -1
- package/dist/foundations/auth/entities/pending-auth.model.d.ts +0 -9
- package/dist/foundations/auth/entities/pending-auth.model.d.ts.map +0 -1
- package/dist/foundations/auth/entities/pending-auth.model.js +0 -19
- package/dist/foundations/auth/entities/pending-auth.model.js.map +0 -1
- package/dist/foundations/auth/serialisers/auth.serialiser.d.ts +0 -13
- package/dist/foundations/auth/serialisers/auth.serialiser.d.ts.map +0 -1
- package/dist/foundations/auth/serialisers/auth.serialiser.js +0 -52
- package/dist/foundations/auth/serialisers/auth.serialiser.js.map +0 -1
- package/dist/foundations/auth/serialisers/pending-auth.serialiser.d.ts +0 -18
- package/dist/foundations/auth/serialisers/pending-auth.serialiser.d.ts.map +0 -1
- package/dist/foundations/auth/serialisers/pending-auth.serialiser.js +0 -49
- package/dist/foundations/auth/serialisers/pending-auth.serialiser.js.map +0 -1
- package/dist/foundations/content/entities/content.entity.d.ts +0 -31
- package/dist/foundations/content/entities/content.entity.d.ts.map +0 -1
- package/dist/foundations/content/entities/content.entity.js +0 -3
- package/dist/foundations/content/entities/content.entity.js.map +0 -1
- package/dist/foundations/content/entities/content.map.d.ts +0 -8
- package/dist/foundations/content/entities/content.map.d.ts.map +0 -1
- package/dist/foundations/content/entities/content.map.js +0 -19
- package/dist/foundations/content/entities/content.map.js.map +0 -1
- package/dist/foundations/content/entities/content.model.d.ts +0 -4
- package/dist/foundations/content/entities/content.model.d.ts.map +0 -1
- package/dist/foundations/content/entities/content.model.js +0 -16
- package/dist/foundations/content/entities/content.model.js.map +0 -1
- package/dist/foundations/content/factories/content.model.factory.d.ts +0 -17
- package/dist/foundations/content/factories/content.model.factory.d.ts.map +0 -1
- package/dist/foundations/content/factories/content.model.factory.js +0 -65
- package/dist/foundations/content/factories/content.model.factory.js.map +0 -1
- package/dist/foundations/content/serialisers/content.serialiser.d.ts +0 -14
- package/dist/foundations/content/serialisers/content.serialiser.d.ts.map +0 -1
- package/dist/foundations/content/serialisers/content.serialiser.js +0 -78
- package/dist/foundations/content/serialisers/content.serialiser.js.map +0 -1
- package/dist/foundations/feature/entities/feature.entity.d.ts +0 -8
- package/dist/foundations/feature/entities/feature.entity.d.ts.map +0 -1
- package/dist/foundations/feature/entities/feature.entity.js +0 -3
- package/dist/foundations/feature/entities/feature.entity.js.map +0 -1
- package/dist/foundations/feature/entities/feature.map.d.ts +0 -8
- package/dist/foundations/feature/entities/feature.map.d.ts.map +0 -1
- package/dist/foundations/feature/entities/feature.map.js +0 -14
- package/dist/foundations/feature/entities/feature.map.js.map +0 -1
- package/dist/foundations/feature/serialisers/feature.serialiser.d.ts +0 -12
- package/dist/foundations/feature/serialisers/feature.serialiser.d.ts.map +0 -1
- package/dist/foundations/feature/serialisers/feature.serialiser.js +0 -45
- package/dist/foundations/feature/serialisers/feature.serialiser.js.map +0 -1
- package/dist/foundations/notification/entities/notification.entity.d.ts +0 -10
- package/dist/foundations/notification/entities/notification.entity.d.ts.map +0 -1
- package/dist/foundations/notification/entities/notification.entity.js +0 -3
- package/dist/foundations/notification/entities/notification.entity.js.map +0 -1
- package/dist/foundations/notification/entities/notification.map.d.ts +0 -8
- package/dist/foundations/notification/entities/notification.map.d.ts.map +0 -1
- package/dist/foundations/notification/entities/notification.map.js +0 -16
- package/dist/foundations/notification/entities/notification.map.js.map +0 -1
- package/dist/foundations/notification/entities/notification.model.d.ts +0 -4
- package/dist/foundations/notification/entities/notification.model.d.ts.map +0 -1
- package/dist/foundations/notification/entities/notification.model.js +0 -15
- package/dist/foundations/notification/entities/notification.model.js.map +0 -1
- package/dist/foundations/notification/interfaces/notification.service.interface.d.ts +0 -4
- package/dist/foundations/notification/interfaces/notification.service.interface.d.ts.map +0 -1
- package/dist/foundations/notification/interfaces/notification.service.interface.js +0 -3
- package/dist/foundations/notification/interfaces/notification.service.interface.js.map +0 -1
- package/dist/foundations/notification/serialisers/notifications.serialiser.d.ts +0 -12
- package/dist/foundations/notification/serialisers/notifications.serialiser.d.ts.map +0 -1
- package/dist/foundations/notification/serialisers/notifications.serialiser.js +0 -47
- package/dist/foundations/notification/serialisers/notifications.serialiser.js.map +0 -1
- package/dist/foundations/tokenusage/entities/tokenusage.entity.d.ts +0 -11
- package/dist/foundations/tokenusage/entities/tokenusage.entity.d.ts.map +0 -1
- package/dist/foundations/tokenusage/entities/tokenusage.entity.js +0 -3
- package/dist/foundations/tokenusage/entities/tokenusage.entity.js.map +0 -1
- package/dist/foundations/tokenusage/entities/tokenusage.map.d.ts +0 -8
- package/dist/foundations/tokenusage/entities/tokenusage.map.d.ts.map +0 -1
- package/dist/foundations/tokenusage/entities/tokenusage.map.js +0 -17
- package/dist/foundations/tokenusage/entities/tokenusage.map.js.map +0 -1
- package/dist/foundations/tokenusage/entities/tokenusage.model.d.ts +0 -4
- package/dist/foundations/tokenusage/entities/tokenusage.model.d.ts.map +0 -1
- package/dist/foundations/tokenusage/entities/tokenusage.model.js +0 -15
- package/dist/foundations/tokenusage/entities/tokenusage.model.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth.google.service.js","sourceRoot":"","sources":["../../../../src/foundations/auth/services/auth.google.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAA4C;AAC5C,2CAA+C;AAC/C,kDAA0B;AAC1B,mCAAoC;AACpC,2CAAwC;AACxC,
|
|
1
|
+
{"version":3,"file":"auth.google.service.js","sourceRoot":"","sources":["../../../../src/foundations/auth/services/auth.google.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAA4C;AAC5C,2CAA+C;AAC/C,kDAA0B;AAC1B,mCAAoC;AACpC,2CAAwC;AACxC,+EAA+E;AAC/E,4EAA4E;AAC5E,6EAA6E;AAC7E,iEAAiE;AACjE,iDAA6C;AAI7C,kGAA6F;AAE7F,qCAA4C;AAC5C,iFAA4E;AAGrE,IAAM,iBAAiB,GAAvB,MAAM,iBAAiB;IAC5B,YACmB,cAA8B,EAC9B,oBAA0C,EAC1C,WAAwB,EACxB,MAA0C,EAC1C,UAAsB,EACtB,0BAAsD;QALtD,mBAAc,GAAd,cAAc,CAAgB;QAC9B,yBAAoB,GAApB,oBAAoB,CAAsB;QAC1C,gBAAW,GAAX,WAAW,CAAa;QACxB,WAAM,GAAN,MAAM,CAAoC;QAC1C,eAAU,GAAV,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QAAQ,CAAC,CAAC,QAAQ;YACpE,aAAa,EAAE,IAAI,CAAC,MAAM,CAAC,GAAG,CAAwB,QAAQ,CAAC,CAAC,YAAY;YAC5E,UAAU,EAAE,oBAAoB;YAChC,IAAI,EAAE,IAAI;YACV,YAAY,EAAE,GAAG,IAAI,CAAC,MAAM,CAAC,GAAG,CAAqB,KAAK,CAAC,CAAC,GAAG,sBAAsB;SACtF,CAAC,CAAC,QAAQ,EAAE,EACb;YACE,OAAO,EAAE;gBACP,cAAc,EAAE,mCAAmC;aACpD;SACF,CACF,CAAC;QAEF,OAAO,QAAQ,CAAC,IAAI,CAAC,YAAY,CAAC;IACpC,CAAC;IAED,KAAK,CAAC,gBAAgB,CAAC,WAAmB;QACxC,MAAM,QAAQ,GAAG,MAAM,eAAK,CAAC,GAAG,CAAC,IAAI,CAAC,kBAAkB,EAAE;YACxD,OAAO,EAAE;gBACP,aAAa,EAAE,UAAU,WAAW,EAAE;aACvC;SACF,CAAC,CAAC;QAEH,OAAO;YACL,EAAE,EAAE,QAAQ,CAAC,IAAI,CAAC,EAAE;YACpB,KAAK,EAAE,QAAQ,CAAC,IAAI,CAAC,KAAK;YAC1B,IAAI,EAAE,QAAQ,CAAC,IAAI,CAAC,IAAI;YACxB,OAAO,EAAE,QAAQ,CAAC,IAAI,CAAC,OAAO,IAAI,IAAI;SACvC,CAAC;IACJ,CAAC;CACF,CAAA;AA7IY,8CAAiB;4BAAjB,iBAAiB;IAD7B,IAAA,mBAAU,GAAE;qCAGwB,qBAAc;QACR,6CAAoB;QAC7B,0BAAW;QAChB,sBAAa;QACT,uBAAU;QACM,yDAA0B;GAP9D,iBAAiB,CA6I7B"}
|
|
@@ -5,12 +5,13 @@ import { SecurityService } from "../../../core/security/services/security.servic
|
|
|
5
5
|
import { AuthPostLoginDataDTO } from "../../auth/dtos/auth.post.login.dto";
|
|
6
6
|
import { ClsService } from "nestjs-cls";
|
|
7
7
|
import { BaseConfigInterface } from "../../../config/interfaces";
|
|
8
|
+
import { AbstractService } from "../../../core/neo4j/abstracts/abstract.service";
|
|
8
9
|
import { JsonApiDataInterface } from "../../../core/jsonapi/interfaces/jsonapi.data.interface";
|
|
9
10
|
import { JsonApiService } from "../../../core/jsonapi/services/jsonapi.service";
|
|
10
11
|
import { Neo4jService } from "../../../core/neo4j/services/neo4j.service";
|
|
11
12
|
import { AuthPostRegisterDataDTO } from "../../auth/dtos/auth.post.register.dto";
|
|
12
|
-
import { AuthCode } from "../../auth/entities/auth.code
|
|
13
|
-
import { Auth } from "../../auth/entities/auth
|
|
13
|
+
import { AuthCode } from "../../auth/entities/auth.code";
|
|
14
|
+
import { Auth, AuthDescriptor } from "../../auth/entities/auth";
|
|
14
15
|
import { AuthRepository } from "../../auth/repositories/auth.repository";
|
|
15
16
|
import { CompanyRepository } from "../../company/repositories/company.repository";
|
|
16
17
|
import { DiscordUserService } from "../../discord-user/services/discord-user.service";
|
|
@@ -22,15 +23,34 @@ import { UserService } from "../../user/services/user.service";
|
|
|
22
23
|
import { WaitlistService } from "../../waitlist/services/waitlist.service";
|
|
23
24
|
import { PendingRegistrationService } from "./pending-registration.service";
|
|
24
25
|
import { TrialQueueService } from "./trial-queue.service";
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
26
|
+
/**
|
|
27
|
+
* Every method here is a bespoke, non-CRUD auth flow (login, register,
|
|
28
|
+
* refresh, code exchange, password reset/activation) — none maps onto
|
|
29
|
+
* AbstractService's generic find/findById/create/put/patch/delete, and none
|
|
30
|
+
* of their names collide with it, so no renames were needed (see
|
|
31
|
+
* AuthRepository for the two that did). Extending AbstractService is for
|
|
32
|
+
* descriptor typing consistency; the inherited generic methods are simply
|
|
33
|
+
* unused.
|
|
34
|
+
*
|
|
35
|
+
* SATELLITE DEPENDENCIES: `twoFactorService`, `discordUserService`,
|
|
36
|
+
* `waitlistService` and `trialQueueService` are `@Optional()` so that an
|
|
37
|
+
* application can compose an auth module without the corresponding
|
|
38
|
+
* foundation modules. The package `AuthModule` still imports every one of
|
|
39
|
+
* them, so package consumers see no behavioural change; each guarded branch
|
|
40
|
+
* below documents what happens when the dependency is absent. They are typed
|
|
41
|
+
* `X | undefined` rather than `x?: X` because a `?` parameter cannot precede
|
|
42
|
+
* a required one and the constructor order is preserved verbatim. A union type
|
|
43
|
+
* makes TypeScript emit `Object` for `design:paramtypes`, so each one MUST also
|
|
44
|
+
* carry an explicit `@Inject(...)` token — without it Nest cannot resolve the
|
|
45
|
+
* provider and silently injects `undefined` even when the module supplies it.
|
|
46
|
+
*/
|
|
47
|
+
export declare class AuthService extends AbstractService<Auth, typeof AuthDescriptor.relationships> {
|
|
48
|
+
private readonly authRepository;
|
|
28
49
|
private readonly userService;
|
|
29
50
|
private readonly users;
|
|
30
51
|
private readonly companyRepository;
|
|
31
52
|
private readonly emailService;
|
|
32
53
|
private readonly security;
|
|
33
|
-
private readonly clsService;
|
|
34
54
|
private readonly neo4j;
|
|
35
55
|
private readonly moduleRef;
|
|
36
56
|
private readonly configService;
|
|
@@ -40,8 +60,17 @@ export declare class AuthService {
|
|
|
40
60
|
private readonly trialQueueService;
|
|
41
61
|
private readonly waitlistService;
|
|
42
62
|
private readonly twoFactorService;
|
|
63
|
+
protected readonly descriptor: import("../../..").EntityDescriptor<Auth, {
|
|
64
|
+
user: {
|
|
65
|
+
model: import("../../..").DataMeta;
|
|
66
|
+
direction: "in";
|
|
67
|
+
relationship: string;
|
|
68
|
+
cardinality: "one";
|
|
69
|
+
description: string;
|
|
70
|
+
};
|
|
71
|
+
}>;
|
|
43
72
|
private readonly logger;
|
|
44
|
-
constructor(
|
|
73
|
+
constructor(jsonApiService: JsonApiService, authRepository: AuthRepository, userService: UserService, users: UserRepository, companyRepository: CompanyRepository, emailService: EmailService, security: SecurityService, clsService: ClsService, neo4j: Neo4jService, moduleRef: ModuleRef, configService: ConfigService<BaseConfigInterface>, pendingRegistrationService: PendingRegistrationService, discordUserService: DiscordUserService | undefined, googleUserService: GoogleUserService, trialQueueService: TrialQueueService | undefined, waitlistService: WaitlistService | undefined, twoFactorService: TwoFactorService | undefined);
|
|
45
74
|
/**
|
|
46
75
|
* Lazily resolves the registration hook from the module container.
|
|
47
76
|
* This allows app modules loaded after AuthModule to provide the hook.
|
|
@@ -50,6 +79,12 @@ export declare class AuthService {
|
|
|
50
79
|
private getRegistrationHook;
|
|
51
80
|
private get appConfig();
|
|
52
81
|
private get authConfig();
|
|
82
|
+
/**
|
|
83
|
+
* Locale used for transactional emails and for the `<locale>/…` prefix of
|
|
84
|
+
* the links inside them. Defaults to "en", which is the value every existing
|
|
85
|
+
* consumer was hardcoded to.
|
|
86
|
+
*/
|
|
87
|
+
private get emailLocale();
|
|
53
88
|
findCurrentAuth(): Promise<JsonApiDataInterface>;
|
|
54
89
|
createAuth(params: {
|
|
55
90
|
user: User;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth.service.d.ts","sourceRoot":"","sources":["../../../../src/foundations/auth/services/auth.service.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAGzC,OAAO,EAAE,YAAY,EAAE,MAAM,4CAA4C,CAAC;AAC1E,OAAO,EAA+B,eAAe,EAAE,MAAM,kDAAkD,CAAC;AAChH,OAAO,EAAE,oBAAoB,EAAE,MAAM,qCAAqC,CAAC;AAE3E,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AACxC,OAAO,EAAE,mBAAmB,EAA2C,MAAM,4BAA4B,CAAC;AAC1G,OAAO,EAAE,oBAAoB,EAAE,MAAM,yDAAyD,CAAC;AAE/F,OAAO,EAAE,cAAc,EAAE,MAAM,gDAAgD,CAAC;AAChF,OAAO,EAAE,YAAY,EAAE,MAAM,4CAA4C,CAAC;AAC1E,OAAO,EAAE,uBAAuB,EAAE,MAAM,wCAAwC,CAAC;AACjF,OAAO,EAAE,QAAQ,EAAE,MAAM,
|
|
1
|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AMG;IACG,sBAAsB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,oBAAoB,CAAC;IAyBrE,QAAQ,CAAC,MAAM,EAAE;QAAE,IAAI,EAAE,uBAAuB,CAAA;KAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAmGlE,cAAc,CAAC,MAAM,EAAE;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,oBAAoB,CAAC;IAoBvE,aAAa,CAAC,MAAM,EAAE;QAAE,KAAK,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAIvD,kBAAkB,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,CAAC,EAAE,MAAM;IAyB9C,YAAY,CAAC,IAAI,EAAE,MAAM;IAQzB,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM;IAe5C,gBAAgB,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM;IAe/C,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC;IAsB3C,yBAAyB,CAAC,MAAM,EAAE;QACtC,SAAS,EAAE,MAAM,CAAC;QAClB,eAAe,EAAE,MAAM,CAAC;QACxB,gBAAgB,EAAE,OAAO,CAAC;QAC1B,kBAAkB,EAAE,MAAM,GAAG,IAAI,CAAC;KACnC,GAAG,OAAO,CAAC;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC;IAyI7B;;;OAGG;YACW,0BAA0B;CAmCzC"}
|
|
@@ -22,11 +22,12 @@ const system_roles_1 = require("../../../common/constants/system.roles");
|
|
|
22
22
|
const email_service_1 = require("../../../core/email/services/email.service");
|
|
23
23
|
const security_service_1 = require("../../../core/security/services/security.service");
|
|
24
24
|
const nestjs_cls_1 = require("nestjs-cls");
|
|
25
|
+
const abstract_service_1 = require("../../../core/neo4j/abstracts/abstract.service");
|
|
25
26
|
const jsonapi_paginator_1 = require("../../../core/jsonapi/serialisers/jsonapi.paginator");
|
|
26
27
|
const jsonapi_service_1 = require("../../../core/jsonapi/services/jsonapi.service");
|
|
27
28
|
const neo4j_service_1 = require("../../../core/neo4j/services/neo4j.service");
|
|
28
|
-
const
|
|
29
|
-
const
|
|
29
|
+
const auth_1 = require("../../auth/entities/auth");
|
|
30
|
+
const pending_auth_1 = require("../../auth/entities/pending-auth");
|
|
30
31
|
const auth_repository_1 = require("../../auth/repositories/auth.repository");
|
|
31
32
|
const company_1 = require("../../company");
|
|
32
33
|
const company_repository_1 = require("../../company/repositories/company.repository");
|
|
@@ -39,16 +40,36 @@ const waitlist_service_1 = require("../../waitlist/services/waitlist.service");
|
|
|
39
40
|
const registration_hook_interface_1 = require("../interfaces/registration-hook.interface");
|
|
40
41
|
const pending_registration_service_1 = require("./pending-registration.service");
|
|
41
42
|
const trial_queue_service_1 = require("./trial-queue.service");
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
43
|
+
/**
|
|
44
|
+
* Every method here is a bespoke, non-CRUD auth flow (login, register,
|
|
45
|
+
* refresh, code exchange, password reset/activation) — none maps onto
|
|
46
|
+
* AbstractService's generic find/findById/create/put/patch/delete, and none
|
|
47
|
+
* of their names collide with it, so no renames were needed (see
|
|
48
|
+
* AuthRepository for the two that did). Extending AbstractService is for
|
|
49
|
+
* descriptor typing consistency; the inherited generic methods are simply
|
|
50
|
+
* unused.
|
|
51
|
+
*
|
|
52
|
+
* SATELLITE DEPENDENCIES: `twoFactorService`, `discordUserService`,
|
|
53
|
+
* `waitlistService` and `trialQueueService` are `@Optional()` so that an
|
|
54
|
+
* application can compose an auth module without the corresponding
|
|
55
|
+
* foundation modules. The package `AuthModule` still imports every one of
|
|
56
|
+
* them, so package consumers see no behavioural change; each guarded branch
|
|
57
|
+
* below documents what happens when the dependency is absent. They are typed
|
|
58
|
+
* `X | undefined` rather than `x?: X` because a `?` parameter cannot precede
|
|
59
|
+
* a required one and the constructor order is preserved verbatim. A union type
|
|
60
|
+
* makes TypeScript emit `Object` for `design:paramtypes`, so each one MUST also
|
|
61
|
+
* carry an explicit `@Inject(...)` token — without it Nest cannot resolve the
|
|
62
|
+
* provider and silently injects `undefined` even when the module supplies it.
|
|
63
|
+
*/
|
|
64
|
+
let AuthService = AuthService_1 = class AuthService extends abstract_service_1.AbstractService {
|
|
65
|
+
constructor(jsonApiService, authRepository, userService, users, companyRepository, emailService, security, clsService, neo4j, moduleRef, configService, pendingRegistrationService, discordUserService, googleUserService, trialQueueService, waitlistService, twoFactorService) {
|
|
66
|
+
super(jsonApiService, authRepository, clsService, auth_1.AuthDescriptor.model);
|
|
67
|
+
this.authRepository = authRepository;
|
|
46
68
|
this.userService = userService;
|
|
47
69
|
this.users = users;
|
|
48
70
|
this.companyRepository = companyRepository;
|
|
49
71
|
this.emailService = emailService;
|
|
50
72
|
this.security = security;
|
|
51
|
-
this.clsService = clsService;
|
|
52
73
|
this.neo4j = neo4j;
|
|
53
74
|
this.moduleRef = moduleRef;
|
|
54
75
|
this.configService = configService;
|
|
@@ -58,6 +79,7 @@ let AuthService = AuthService_1 = class AuthService {
|
|
|
58
79
|
this.trialQueueService = trialQueueService;
|
|
59
80
|
this.waitlistService = waitlistService;
|
|
60
81
|
this.twoFactorService = twoFactorService;
|
|
82
|
+
this.descriptor = auth_1.AuthDescriptor;
|
|
61
83
|
this.logger = new common_1.Logger(AuthService_1.name);
|
|
62
84
|
}
|
|
63
85
|
/**
|
|
@@ -80,15 +102,23 @@ let AuthService = AuthService_1 = class AuthService {
|
|
|
80
102
|
get authConfig() {
|
|
81
103
|
return this.configService.get("auth");
|
|
82
104
|
}
|
|
105
|
+
/**
|
|
106
|
+
* Locale used for transactional emails and for the `<locale>/…` prefix of
|
|
107
|
+
* the links inside them. Defaults to "en", which is the value every existing
|
|
108
|
+
* consumer was hardcoded to.
|
|
109
|
+
*/
|
|
110
|
+
get emailLocale() {
|
|
111
|
+
return this.authConfig.emailLocale ?? "en";
|
|
112
|
+
}
|
|
83
113
|
async findCurrentAuth() {
|
|
84
114
|
const token = this.clsService.get("token");
|
|
85
|
-
const auth = await this.
|
|
115
|
+
const auth = await this.authRepository.findByToken({
|
|
86
116
|
token: token,
|
|
87
117
|
});
|
|
88
118
|
if (!auth)
|
|
89
119
|
throw new common_1.HttpException("Auth not found", common_1.HttpStatus.NOT_FOUND);
|
|
90
120
|
auth.refreshToken = auth.id;
|
|
91
|
-
return await this.
|
|
121
|
+
return await this.jsonApiService.buildSingle(this.descriptor.model, auth);
|
|
92
122
|
}
|
|
93
123
|
async createAuth(params) {
|
|
94
124
|
const userId = params.user.id;
|
|
@@ -102,7 +132,7 @@ let AuthService = AuthService_1 = class AuthService {
|
|
|
102
132
|
features: features,
|
|
103
133
|
userName: params.user.name,
|
|
104
134
|
});
|
|
105
|
-
const auth = await this.
|
|
135
|
+
const auth = await this.authRepository.createSession({
|
|
106
136
|
authId: (0, crypto_1.randomUUID)(),
|
|
107
137
|
userId: params.user.id,
|
|
108
138
|
token: token,
|
|
@@ -113,7 +143,7 @@ let AuthService = AuthService_1 = class AuthService {
|
|
|
113
143
|
expiration: this.security.refreshTokenExpiration,
|
|
114
144
|
});
|
|
115
145
|
auth.refreshToken = auth.id;
|
|
116
|
-
await this.
|
|
146
|
+
await this.authRepository.setLastLogin({ userId: auth.user.id });
|
|
117
147
|
if (!!params.refreshToken)
|
|
118
148
|
auth.user = undefined;
|
|
119
149
|
return auth;
|
|
@@ -124,20 +154,20 @@ let AuthService = AuthService_1 = class AuthService {
|
|
|
124
154
|
this.clsService.set("companyId", auth.user.company.id);
|
|
125
155
|
this.clsService.set("userId", auth.user.id);
|
|
126
156
|
}
|
|
127
|
-
return await this.
|
|
157
|
+
return await this.jsonApiService.buildSingle(this.descriptor.model, auth);
|
|
128
158
|
}
|
|
129
159
|
async createCode(params) {
|
|
130
160
|
const now = new Date();
|
|
131
161
|
const expiration = new Date(now.getTime() + 5 * 60 * 1000);
|
|
132
|
-
await this.
|
|
162
|
+
await this.authRepository.createCode({
|
|
133
163
|
authCodeId: params.authCodeId,
|
|
134
164
|
authId: params.authId,
|
|
135
165
|
expiration: expiration,
|
|
136
166
|
});
|
|
137
|
-
return await this.
|
|
167
|
+
return await this.authRepository.findByCode({ code: params.authCodeId });
|
|
138
168
|
}
|
|
139
169
|
async refreshToken(params) {
|
|
140
|
-
let auth = await this.
|
|
170
|
+
let auth = await this.authRepository.findByRefreshToken({
|
|
141
171
|
authId: params.refreshToken,
|
|
142
172
|
});
|
|
143
173
|
if (!auth)
|
|
@@ -146,7 +176,7 @@ let AuthService = AuthService_1 = class AuthService {
|
|
|
146
176
|
// issued for, otherwise a refresh would silently drop the active company's roles.
|
|
147
177
|
const previousPayload = this.security.decodeJwt(auth.token);
|
|
148
178
|
const companyId = previousPayload?.companyId ?? undefined;
|
|
149
|
-
const user = await this.
|
|
179
|
+
const user = await this.authRepository.findUserById({
|
|
150
180
|
userId: auth.user.id,
|
|
151
181
|
companyId: companyId,
|
|
152
182
|
});
|
|
@@ -162,18 +192,18 @@ let AuthService = AuthService_1 = class AuthService {
|
|
|
162
192
|
features: features,
|
|
163
193
|
userName: user.name,
|
|
164
194
|
});
|
|
165
|
-
auth = await this.
|
|
195
|
+
auth = await this.authRepository.refreshToken({
|
|
166
196
|
authId: params.refreshToken,
|
|
167
197
|
token: token,
|
|
168
198
|
});
|
|
169
|
-
await this.
|
|
199
|
+
await this.authRepository.deleteExpiredAuths({ userId: user.id });
|
|
170
200
|
const newAuth = {
|
|
171
201
|
authId: auth.id,
|
|
172
202
|
refreshToken: auth.id,
|
|
173
203
|
token: auth.token,
|
|
174
204
|
expiration: auth.expiration,
|
|
175
205
|
};
|
|
176
|
-
return this.
|
|
206
|
+
return this.jsonApiService.buildSingle(this.descriptor.model, newAuth);
|
|
177
207
|
}
|
|
178
208
|
async login(params) {
|
|
179
209
|
const user = await this.users.findByEmail({
|
|
@@ -190,43 +220,48 @@ let AuthService = AuthService_1 = class AuthService {
|
|
|
190
220
|
throw new common_1.HttpException("The email or password you entered is incorrect.", common_1.HttpStatus.UNAUTHORIZED);
|
|
191
221
|
if (!user.isActive)
|
|
192
222
|
throw new common_1.HttpException("The account has not been activated yet", common_1.HttpStatus.FORBIDDEN);
|
|
193
|
-
// Check if user has 2FA enabled
|
|
194
|
-
|
|
195
|
-
if (
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
223
|
+
// Check if user has 2FA enabled. Without TwoFactorModule there is no 2FA to
|
|
224
|
+
// check, so login proceeds straight to the normal flow below.
|
|
225
|
+
if (this.twoFactorService) {
|
|
226
|
+
const twoFactorConfig = await this.twoFactorService.getConfig(user.id);
|
|
227
|
+
if (twoFactorConfig?.isEnabled) {
|
|
228
|
+
// User has 2FA enabled - return pending auth response
|
|
229
|
+
const pendingSession = await this.twoFactorService.createPendingSession(user.id);
|
|
230
|
+
const availableMethods = await this.twoFactorService.getAvailableMethods(user.id);
|
|
231
|
+
// Generate a pending JWT with limited access
|
|
232
|
+
const pendingToken = this.security.signPendingJwt({
|
|
233
|
+
userId: user.id,
|
|
234
|
+
pendingId: pendingSession.pendingId,
|
|
235
|
+
});
|
|
236
|
+
const now = new Date();
|
|
237
|
+
// Return pending auth response requiring 2FA verification
|
|
238
|
+
const response = await this.jsonApiService.buildSingle(pending_auth_1.PendingAuthDescriptor.model, {
|
|
239
|
+
id: pendingSession.pendingId, // ADD: id field required by JSON:API
|
|
240
|
+
createdAt: now, // ADD: for meta
|
|
241
|
+
updatedAt: now, // ADD: for meta
|
|
242
|
+
// `pendingToken` / `expiresAt` are the wire attribute names — see
|
|
243
|
+
// entities/pending-auth.ts.
|
|
244
|
+
pendingToken: pendingToken,
|
|
245
|
+
expiresAt: pendingSession.expiration,
|
|
246
|
+
availableMethods: availableMethods,
|
|
247
|
+
preferredMethod: twoFactorConfig.preferredMethod,
|
|
248
|
+
});
|
|
249
|
+
return response;
|
|
250
|
+
}
|
|
216
251
|
}
|
|
217
252
|
// No 2FA - proceed with normal login
|
|
218
253
|
// Roles are held per company, so a user who belongs to more than one company has
|
|
219
254
|
// no single "active" company at login: hand back a short-lived selection token
|
|
220
255
|
// instead of a session, and let POST auth/company-selection/:companyId mint the
|
|
221
256
|
// real, company-scoped one.
|
|
222
|
-
const companyCount = await this.
|
|
257
|
+
const companyCount = await this.authRepository.countUserCompanies({ userId: user.id });
|
|
223
258
|
if (companyCount > 1)
|
|
224
|
-
return await this.
|
|
259
|
+
return await this.jsonApiService.buildSingle(this.descriptor.model, {
|
|
225
260
|
id: (0, crypto_1.randomUUID)(),
|
|
226
261
|
requiresCompanySelection: true,
|
|
227
262
|
selectionToken: this.security.signCompanySelectionJwt({ userId: user.id }),
|
|
228
263
|
});
|
|
229
|
-
await this.
|
|
264
|
+
await this.authRepository.setLastLogin({ userId: user.id });
|
|
230
265
|
return await this.createToken({ user: user });
|
|
231
266
|
}
|
|
232
267
|
/**
|
|
@@ -235,8 +270,8 @@ let AuthService = AuthService_1 = class AuthService {
|
|
|
235
270
|
*/
|
|
236
271
|
async findCompanies() {
|
|
237
272
|
const userId = this.clsService.get("userId");
|
|
238
|
-
const companies = await this.
|
|
239
|
-
return await this.
|
|
273
|
+
const companies = await this.authRepository.findUserCompanies({ userId: userId });
|
|
274
|
+
return await this.jsonApiService.buildList(company_1.CompanyDescriptor.model, companies, new jsonapi_paginator_1.JsonApiPaginator({}));
|
|
240
275
|
}
|
|
241
276
|
/**
|
|
242
277
|
* Exchanges a company-selection (or full) token for a session scoped to
|
|
@@ -244,7 +279,7 @@ let AuthService = AuthService_1 = class AuthService {
|
|
|
244
279
|
*/
|
|
245
280
|
async selectCompany(params) {
|
|
246
281
|
const userId = this.clsService.get("userId");
|
|
247
|
-
const user = await this.
|
|
282
|
+
const user = await this.authRepository.findUserById({
|
|
248
283
|
userId: userId,
|
|
249
284
|
companyId: params.companyId,
|
|
250
285
|
});
|
|
@@ -271,14 +306,14 @@ let AuthService = AuthService_1 = class AuthService {
|
|
|
271
306
|
// Same company-selection gate as password login: 2FA is complete at this point,
|
|
272
307
|
// so handing back a selection token here cannot bypass verification. Without
|
|
273
308
|
// this, a multi-company user would get a session pinned to an arbitrary company.
|
|
274
|
-
const companyCount = await this.
|
|
309
|
+
const companyCount = await this.authRepository.countUserCompanies({ userId: user.id });
|
|
275
310
|
if (companyCount > 1)
|
|
276
|
-
return await this.
|
|
311
|
+
return await this.jsonApiService.buildSingle(this.descriptor.model, {
|
|
277
312
|
id: (0, crypto_1.randomUUID)(),
|
|
278
313
|
requiresCompanySelection: true,
|
|
279
314
|
selectionToken: this.security.signCompanySelectionJwt({ userId: user.id }),
|
|
280
315
|
});
|
|
281
|
-
await this.
|
|
316
|
+
await this.authRepository.setLastLogin({ userId: user.id });
|
|
282
317
|
return await this.createToken({ user: user });
|
|
283
318
|
}
|
|
284
319
|
async register(params) {
|
|
@@ -291,6 +326,11 @@ let AuthService = AuthService_1 = class AuthService {
|
|
|
291
326
|
throw new common_1.HttpException("Registration is currently closed", common_1.HttpStatus.FORBIDDEN);
|
|
292
327
|
}
|
|
293
328
|
if (registrationMode === "waitlist") {
|
|
329
|
+
// Waitlist mode needs WaitlistModule; without it there is no way to
|
|
330
|
+
// validate an invite, so the flow is unavailable rather than open.
|
|
331
|
+
if (!this.waitlistService) {
|
|
332
|
+
throw new common_1.HttpException("Waitlist registration is not available", common_1.HttpStatus.NOT_IMPLEMENTED);
|
|
333
|
+
}
|
|
294
334
|
// Require invite code for waitlist mode
|
|
295
335
|
if (!params.data.attributes.inviteCode) {
|
|
296
336
|
throw new common_1.HttpException("Registration requires an invitation. Please join the waitlist.", common_1.HttpStatus.FORBIDDEN);
|
|
@@ -306,7 +346,7 @@ let AuthService = AuthService_1 = class AuthService {
|
|
|
306
346
|
name: params.data.attributes.companyName ?? params.data.attributes.name,
|
|
307
347
|
});
|
|
308
348
|
const password = await (0, security_service_1.hashPassword)(params.data.attributes.password);
|
|
309
|
-
const user = await this.users.
|
|
349
|
+
const user = await this.users.createUser({
|
|
310
350
|
userId: params.data.id,
|
|
311
351
|
email: params.data.attributes.email,
|
|
312
352
|
name: params.data.attributes.name,
|
|
@@ -337,54 +377,58 @@ let AuthService = AuthService_1 = class AuthService {
|
|
|
337
377
|
}
|
|
338
378
|
}
|
|
339
379
|
}
|
|
340
|
-
// After successful registration, mark waitlist entry as registered
|
|
380
|
+
// After successful registration, mark waitlist entry as registered.
|
|
381
|
+
// `?.` only for the type checker: waitlist mode already threw above when the
|
|
382
|
+
// service is absent, so this call always happens when it is reached.
|
|
341
383
|
if (registrationMode === "waitlist" && params.data.attributes.inviteCode) {
|
|
342
|
-
await this.waitlistService
|
|
384
|
+
await this.waitlistService?.markAsRegistered({
|
|
343
385
|
inviteCode: params.data.attributes.inviteCode,
|
|
344
386
|
userId: user.id,
|
|
345
387
|
});
|
|
346
388
|
}
|
|
347
|
-
const
|
|
389
|
+
const locale = this.emailLocale;
|
|
390
|
+
const link = `${this.appConfig.url}${locale}/activation/${user.code}`;
|
|
348
391
|
await this.emailService.sendEmail("activationEmail", {
|
|
349
392
|
to: user.email,
|
|
350
393
|
activationLink: link,
|
|
351
394
|
expirationDate: user.codeExpiration.toDateString(),
|
|
352
395
|
expirationTime: user.codeExpiration.toTimeString(),
|
|
353
396
|
companyName: user.company.name,
|
|
354
|
-
},
|
|
397
|
+
}, locale);
|
|
355
398
|
}
|
|
356
399
|
async findAuthByCode(params) {
|
|
357
|
-
const authCode = await this.
|
|
400
|
+
const authCode = await this.authRepository.findByCode({
|
|
358
401
|
code: params.code,
|
|
359
402
|
});
|
|
360
403
|
if (!authCode)
|
|
361
404
|
throw new common_1.HttpException("Invalid code", common_1.HttpStatus.NOT_FOUND);
|
|
362
405
|
if (authCode.expiration < new Date())
|
|
363
406
|
throw new common_1.HttpException("Code has expired", common_1.HttpStatus.NOT_FOUND);
|
|
364
|
-
const auth = await this.
|
|
407
|
+
const auth = await this.authRepository.findAuthById({
|
|
365
408
|
authId: authCode.auth.id,
|
|
366
409
|
});
|
|
367
410
|
if (!auth)
|
|
368
411
|
throw new common_1.HttpException("Auth not found", common_1.HttpStatus.NOT_FOUND);
|
|
369
412
|
auth.refreshToken = auth.id;
|
|
370
|
-
return await this.
|
|
413
|
+
return await this.jsonApiService.buildSingle(this.descriptor.model, auth);
|
|
371
414
|
}
|
|
372
415
|
async deleteByToken(params) {
|
|
373
|
-
await this.
|
|
416
|
+
await this.authRepository.deleteByToken(params);
|
|
374
417
|
}
|
|
375
418
|
async startResetPassword(email, lng) {
|
|
376
419
|
let user = await this.users.findByEmail({ email: email });
|
|
377
420
|
if (!user)
|
|
378
421
|
return;
|
|
379
422
|
this.clsService.set("companyId", user.company.id);
|
|
380
|
-
user = await this.
|
|
381
|
-
const
|
|
423
|
+
user = await this.authRepository.startResetPassword({ userId: user.id });
|
|
424
|
+
const locale = lng ?? this.emailLocale;
|
|
425
|
+
const link = `${this.appConfig.url}${locale}/reset/${user.code}`;
|
|
382
426
|
await this.emailService.sendEmail("resetEmail", {
|
|
383
427
|
to: user.email,
|
|
384
428
|
resetLink: link,
|
|
385
429
|
expirationDate: user.codeExpiration.toDateString(),
|
|
386
430
|
expirationTime: user.codeExpiration.toTimeString(),
|
|
387
|
-
},
|
|
431
|
+
}, locale);
|
|
388
432
|
}
|
|
389
433
|
async validateCode(code) {
|
|
390
434
|
const user = await this.users.findByCode({ code: code });
|
|
@@ -400,7 +444,7 @@ let AuthService = AuthService_1 = class AuthService {
|
|
|
400
444
|
if (user.codeExpiration < new Date())
|
|
401
445
|
throw new common_1.HttpException("The code is expired", common_1.HttpStatus.BAD_REQUEST);
|
|
402
446
|
const newPassword = await (0, security_service_1.hashPassword)(password);
|
|
403
|
-
await this.
|
|
447
|
+
await this.authRepository.resetPassword({
|
|
404
448
|
userId: user.id,
|
|
405
449
|
password: newPassword,
|
|
406
450
|
});
|
|
@@ -412,7 +456,7 @@ let AuthService = AuthService_1 = class AuthService {
|
|
|
412
456
|
if (user.codeExpiration < new Date())
|
|
413
457
|
throw new common_1.HttpException("The code is expired", common_1.HttpStatus.BAD_REQUEST);
|
|
414
458
|
const newPassword = await (0, security_service_1.hashPassword)(password);
|
|
415
|
-
await this.
|
|
459
|
+
await this.authRepository.acceptInvitation({
|
|
416
460
|
userId: user.id,
|
|
417
461
|
password: newPassword,
|
|
418
462
|
});
|
|
@@ -423,9 +467,10 @@ let AuthService = AuthService_1 = class AuthService {
|
|
|
423
467
|
throw new common_1.HttpException("The code provided is invalid", common_1.HttpStatus.NOT_FOUND);
|
|
424
468
|
if (user.codeExpiration < new Date())
|
|
425
469
|
throw new common_1.HttpException("The code provided is expired", common_1.HttpStatus.NOT_FOUND);
|
|
426
|
-
await this.
|
|
427
|
-
// Queue trial creation now that account is activated
|
|
428
|
-
|
|
470
|
+
await this.authRepository.activateAccount({ userId: user.id });
|
|
471
|
+
// Queue trial creation now that account is activated. Without the trial
|
|
472
|
+
// queue there is nothing to queue and activation completes unchanged.
|
|
473
|
+
if (this.trialQueueService && user.company?.id) {
|
|
429
474
|
await this.trialQueueService.queueTrialCreation({
|
|
430
475
|
companyId: user.company.id,
|
|
431
476
|
userId: user.id,
|
|
@@ -450,6 +495,10 @@ let AuthService = AuthService_1 = class AuthService {
|
|
|
450
495
|
throw new common_1.HttpException("Registration is currently closed", common_1.HttpStatus.FORBIDDEN);
|
|
451
496
|
}
|
|
452
497
|
if (registrationMode === "waitlist") {
|
|
498
|
+
// Waitlist mode needs WaitlistModule - see register().
|
|
499
|
+
if (!this.waitlistService) {
|
|
500
|
+
throw new common_1.HttpException("Waitlist registration is not available", common_1.HttpStatus.NOT_IMPLEMENTED);
|
|
501
|
+
}
|
|
453
502
|
// Require invite code for waitlist mode
|
|
454
503
|
if (!pending.inviteCode) {
|
|
455
504
|
throw new common_1.HttpException("Registration requires an invitation. Please join the waitlist.", common_1.HttpStatus.FORBIDDEN);
|
|
@@ -465,6 +514,9 @@ let AuthService = AuthService_1 = class AuthService {
|
|
|
465
514
|
const companyId = (0, crypto_1.randomUUID)();
|
|
466
515
|
// Create user based on provider
|
|
467
516
|
if (pending.provider === "discord") {
|
|
517
|
+
if (!this.discordUserService) {
|
|
518
|
+
throw new common_1.HttpException("Waitlist registration is not available", common_1.HttpStatus.NOT_IMPLEMENTED);
|
|
519
|
+
}
|
|
468
520
|
await this.discordUserService.create({
|
|
469
521
|
userId,
|
|
470
522
|
companyId,
|
|
@@ -517,14 +569,17 @@ let AuthService = AuthService_1 = class AuthService {
|
|
|
517
569
|
}
|
|
518
570
|
}
|
|
519
571
|
}
|
|
520
|
-
// Queue trial creation (async, non-blocking)
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
572
|
+
// Queue trial creation (async, non-blocking) - see activateAccount()
|
|
573
|
+
if (this.trialQueueService) {
|
|
574
|
+
await this.trialQueueService.queueTrialCreation({
|
|
575
|
+
companyId: companyId,
|
|
576
|
+
userId: userId,
|
|
577
|
+
});
|
|
578
|
+
}
|
|
579
|
+
// After successful OAuth registration, mark waitlist entry as registered.
|
|
580
|
+
// `?.` only for the type checker - see register().
|
|
526
581
|
if (registrationMode === "waitlist" && pending.inviteCode) {
|
|
527
|
-
await this.waitlistService
|
|
582
|
+
await this.waitlistService?.markAsRegistered({
|
|
528
583
|
inviteCode: pending.inviteCode,
|
|
529
584
|
userId: userId,
|
|
530
585
|
});
|
|
@@ -554,7 +609,8 @@ let AuthService = AuthService_1 = class AuthService {
|
|
|
554
609
|
if (platformAdmins.length === 0) {
|
|
555
610
|
return;
|
|
556
611
|
}
|
|
557
|
-
const
|
|
612
|
+
const locale = this.emailLocale;
|
|
613
|
+
const dashboardLink = `${this.appConfig.url}${locale}/administration`;
|
|
558
614
|
for (const admin of platformAdmins) {
|
|
559
615
|
try {
|
|
560
616
|
await this.emailService.sendEmail("registrationAdminNotification", {
|
|
@@ -565,7 +621,7 @@ let AuthService = AuthService_1 = class AuthService {
|
|
|
565
621
|
companyName: user.company?.name || "N/A",
|
|
566
622
|
activatedAt: new Date().toISOString(),
|
|
567
623
|
dashboardLink,
|
|
568
|
-
},
|
|
624
|
+
}, locale);
|
|
569
625
|
}
|
|
570
626
|
catch (emailError) {
|
|
571
627
|
this.logger.error(`Failed to send registration notification to admin ${admin.email}:`, emailError);
|
|
@@ -580,6 +636,13 @@ let AuthService = AuthService_1 = class AuthService {
|
|
|
580
636
|
exports.AuthService = AuthService;
|
|
581
637
|
exports.AuthService = AuthService = AuthService_1 = __decorate([
|
|
582
638
|
(0, common_1.Injectable)(),
|
|
639
|
+
__param(12, (0, common_1.Optional)()),
|
|
640
|
+
__param(12, (0, common_1.Inject)(discord_user_service_1.DiscordUserService)),
|
|
641
|
+
__param(14, (0, common_1.Optional)()),
|
|
642
|
+
__param(14, (0, common_1.Inject)(trial_queue_service_1.TrialQueueService)),
|
|
643
|
+
__param(15, (0, common_1.Optional)()),
|
|
644
|
+
__param(15, (0, common_1.Inject)(waitlist_service_1.WaitlistService)),
|
|
645
|
+
__param(16, (0, common_1.Optional)()),
|
|
583
646
|
__param(16, (0, common_1.Inject)((0, common_1.forwardRef)(() => two_factor_service_1.TwoFactorService))),
|
|
584
647
|
__metadata("design:paramtypes", [jsonapi_service_1.JsonApiService,
|
|
585
648
|
auth_repository_1.AuthRepository,
|