@hed-hog/core 0.0.387 → 0.0.390
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/README.md +12 -11
- package/dist/access-log/access-log.interceptor.d.ts.map +1 -1
- package/dist/access-log/access-log.interceptor.js +4 -2
- package/dist/access-log/access-log.interceptor.js.map +1 -1
- package/dist/ai/ai-attachment.fragments.d.ts +23 -0
- package/dist/ai/ai-attachment.fragments.d.ts.map +1 -0
- package/dist/ai/ai-attachment.fragments.js +34 -0
- package/dist/ai/ai-attachment.fragments.js.map +1 -0
- package/dist/ai/ai.controller.d.ts +7 -16
- package/dist/ai/ai.controller.d.ts.map +1 -1
- package/dist/ai/ai.prompts.d.ts +16 -0
- package/dist/ai/ai.prompts.d.ts.map +1 -0
- package/dist/ai/ai.prompts.js +37 -0
- package/dist/ai/ai.prompts.js.map +1 -0
- package/dist/ai/ai.service.d.ts +63 -12
- package/dist/ai/ai.service.d.ts.map +1 -1
- package/dist/ai/ai.service.js +215 -88
- package/dist/ai/ai.service.js.map +1 -1
- package/dist/ai/dto/chat.dto.d.ts +4 -1
- package/dist/ai/dto/chat.dto.d.ts.map +1 -1
- package/dist/ai/dto/chat.dto.js +23 -1
- package/dist/ai/dto/chat.dto.js.map +1 -1
- package/dist/ai/dto/create-agent.dto.d.ts +1 -1
- package/dist/ai/dto/create-agent.dto.d.ts.map +1 -1
- package/dist/ai/dto/create-agent.dto.js +1 -1
- package/dist/ai/dto/create-agent.dto.js.map +1 -1
- package/dist/ai/dto/update-agent.dto.d.ts +1 -1
- package/dist/ai/dto/update-agent.dto.d.ts.map +1 -1
- package/dist/ai/dto/update-agent.dto.js +1 -1
- package/dist/ai/dto/update-agent.dto.js.map +1 -1
- package/dist/ai-instruction/ai-instruction.controller.d.ts +61 -7
- package/dist/ai-instruction/ai-instruction.controller.d.ts.map +1 -1
- package/dist/ai-instruction/ai-instruction.controller.js +63 -20
- package/dist/ai-instruction/ai-instruction.controller.js.map +1 -1
- package/dist/ai-instruction/ai-instruction.module.d.ts.map +1 -1
- package/dist/ai-instruction/ai-instruction.module.js +13 -2
- package/dist/ai-instruction/ai-instruction.module.js.map +1 -1
- package/dist/ai-instruction/ai-instruction.service.d.ts +131 -6
- package/dist/ai-instruction/ai-instruction.service.d.ts.map +1 -1
- package/dist/ai-instruction/ai-instruction.service.js +533 -60
- package/dist/ai-instruction/ai-instruction.service.js.map +1 -1
- package/dist/ai-instruction/ai-prompt-builder.service.d.ts +8 -0
- package/dist/ai-instruction/ai-prompt-builder.service.d.ts.map +1 -1
- package/dist/ai-instruction/ai-prompt-builder.service.js +10 -1
- package/dist/ai-instruction/ai-prompt-builder.service.js.map +1 -1
- package/dist/ai-instruction/ai-prompt-registry.d.ts +45 -0
- package/dist/ai-instruction/ai-prompt-registry.d.ts.map +1 -0
- package/dist/ai-instruction/ai-prompt-registry.js +49 -0
- package/dist/ai-instruction/ai-prompt-registry.js.map +1 -0
- package/dist/ai-instruction/ai-prompt-resolver.service.d.ts +89 -0
- package/dist/ai-instruction/ai-prompt-resolver.service.d.ts.map +1 -0
- package/dist/ai-instruction/ai-prompt-resolver.service.js +222 -0
- package/dist/ai-instruction/ai-prompt-resolver.service.js.map +1 -0
- package/dist/ai-instruction/ai-prompt-template.util.d.ts +70 -0
- package/dist/ai-instruction/ai-prompt-template.util.d.ts.map +1 -0
- package/dist/ai-instruction/ai-prompt-template.util.js +154 -0
- package/dist/ai-instruction/ai-prompt-template.util.js.map +1 -0
- package/dist/ai-instruction/dto/create-ai-instruction.dto.d.ts +5 -0
- package/dist/ai-instruction/dto/create-ai-instruction.dto.d.ts.map +1 -1
- package/dist/ai-instruction/dto/create-ai-instruction.dto.js +27 -1
- package/dist/ai-instruction/dto/create-ai-instruction.dto.js.map +1 -1
- package/dist/ai-instruction/dto/preview-ai-instruction.dto.d.ts +14 -0
- package/dist/ai-instruction/dto/preview-ai-instruction.dto.d.ts.map +1 -0
- package/dist/ai-instruction/dto/preview-ai-instruction.dto.js +42 -0
- package/dist/ai-instruction/dto/preview-ai-instruction.dto.js.map +1 -0
- package/dist/ai-instruction/dto/update-ai-instruction.dto.d.ts +11 -0
- package/dist/ai-instruction/dto/update-ai-instruction.dto.d.ts.map +1 -1
- package/dist/ai-instruction/dto/update-ai-instruction.dto.js +34 -0
- package/dist/ai-instruction/dto/update-ai-instruction.dto.js.map +1 -1
- package/dist/ai-instruction/types/ai-instruction.types.d.ts +13 -1
- package/dist/ai-instruction/types/ai-instruction.types.d.ts.map +1 -1
- package/dist/ai-instruction/types/ai-instruction.types.js +10 -0
- package/dist/ai-instruction/types/ai-instruction.types.js.map +1 -1
- package/dist/auth/auth.controller.d.ts +24 -9
- package/dist/auth/auth.controller.d.ts.map +1 -1
- package/dist/auth/auth.controller.js +49 -21
- package/dist/auth/auth.controller.js.map +1 -1
- package/dist/auth/auth.service.d.ts +33 -8
- package/dist/auth/auth.service.d.ts.map +1 -1
- package/dist/auth/auth.service.js +78 -29
- package/dist/auth/auth.service.js.map +1 -1
- package/dist/captcha/captcha.module.d.ts +3 -0
- package/dist/captcha/captcha.module.d.ts.map +1 -0
- package/dist/captcha/captcha.module.js +23 -0
- package/dist/captcha/captcha.module.js.map +1 -0
- package/dist/captcha/captcha.service.d.ts +38 -0
- package/dist/captcha/captcha.service.d.ts.map +1 -0
- package/dist/captcha/captcha.service.js +144 -0
- package/dist/captcha/captcha.service.js.map +1 -0
- package/dist/challenge/challenge.service.d.ts +16 -7
- package/dist/challenge/challenge.service.d.ts.map +1 -1
- package/dist/challenge/challenge.service.js +64 -16
- package/dist/challenge/challenge.service.js.map +1 -1
- package/dist/core.module.d.ts +3 -1
- package/dist/core.module.d.ts.map +1 -1
- package/dist/core.module.js +29 -2
- package/dist/core.module.js.map +1 -1
- package/dist/dashboard/dashboard/dashboard.controller.d.ts +15 -15
- package/dist/dashboard/dashboard/dashboard.service.d.ts +15 -15
- package/dist/dashboard/dashboard-component/dashboard-component.controller.d.ts +6 -6
- package/dist/dashboard/dashboard-component/dashboard-component.service.d.ts +6 -6
- package/dist/dashboard/dashboard-component-role/dashboard-component-role.controller.d.ts +20 -20
- package/dist/dashboard/dashboard-component-role/dashboard-component-role.service.d.ts +20 -20
- package/dist/dashboard/dashboard-core/dashboard-core.controller.d.ts +1 -1
- package/dist/dashboard/dashboard-core/dashboard-core.service.d.ts +1 -1
- package/dist/dashboard/dashboard-role/dashboard-role.controller.d.ts +13 -13
- package/dist/dashboard/dashboard-role/dashboard-role.service.d.ts +13 -13
- package/dist/file/file.service.d.ts +6 -0
- package/dist/file/file.service.d.ts.map +1 -1
- package/dist/file/file.service.js +44 -4
- package/dist/file/file.service.js.map +1 -1
- package/dist/incident/incident-notifier.service.d.ts +36 -0
- package/dist/incident/incident-notifier.service.d.ts.map +1 -0
- package/dist/incident/incident-notifier.service.js +208 -0
- package/dist/incident/incident-notifier.service.js.map +1 -0
- package/dist/incident/incident.controller.d.ts +23 -0
- package/dist/incident/incident.controller.d.ts.map +1 -0
- package/dist/incident/incident.controller.js +75 -0
- package/dist/incident/incident.controller.js.map +1 -0
- package/dist/incident/incident.module.d.ts +7 -0
- package/dist/incident/incident.module.d.ts.map +1 -0
- package/dist/incident/incident.module.js +32 -0
- package/dist/incident/incident.module.js.map +1 -0
- package/dist/incident/incident.service.d.ts +72 -0
- package/dist/incident/incident.service.d.ts.map +1 -0
- package/dist/incident/incident.service.js +184 -0
- package/dist/incident/incident.service.js.map +1 -0
- package/dist/index.d.ts +26 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +30 -0
- package/dist/index.js.map +1 -1
- package/dist/integration-profile/dto/test.dto.d.ts +13 -0
- package/dist/integration-profile/dto/test.dto.d.ts.map +1 -0
- package/dist/integration-profile/dto/test.dto.js +26 -0
- package/dist/integration-profile/dto/test.dto.js.map +1 -0
- package/dist/integration-profile/integration-profile.controller.d.ts +12 -1
- package/dist/integration-profile/integration-profile.controller.d.ts.map +1 -1
- package/dist/integration-profile/integration-profile.controller.js +9 -1
- package/dist/integration-profile/integration-profile.controller.js.map +1 -1
- package/dist/integration-profile/integration-profile.module.d.ts +6 -1
- package/dist/integration-profile/integration-profile.module.d.ts.map +1 -1
- package/dist/integration-profile/integration-profile.module.js +26 -3
- package/dist/integration-profile/integration-profile.module.js.map +1 -1
- package/dist/integration-profile/integration-profile.secrets.d.ts.map +1 -1
- package/dist/integration-profile/integration-profile.secrets.js +9 -1
- package/dist/integration-profile/integration-profile.secrets.js.map +1 -1
- package/dist/integration-profile/integration-profile.service.d.ts +26 -7
- package/dist/integration-profile/integration-profile.service.d.ts.map +1 -1
- package/dist/integration-profile/integration-profile.service.js +94 -91
- package/dist/integration-profile/integration-profile.service.js.map +1 -1
- package/dist/integration-profile/integration-profile.utils.d.ts +13 -1
- package/dist/integration-profile/integration-profile.utils.d.ts.map +1 -1
- package/dist/integration-profile/integration-profile.utils.js +20 -5
- package/dist/integration-profile/integration-profile.utils.js.map +1 -1
- package/dist/integration-profile/testers/ai.testers.d.ts +3 -0
- package/dist/integration-profile/testers/ai.testers.d.ts.map +1 -0
- package/dist/integration-profile/testers/ai.testers.js +125 -0
- package/dist/integration-profile/testers/ai.testers.js.map +1 -0
- package/dist/integration-profile/testers/captcha.testers.d.ts +3 -0
- package/dist/integration-profile/testers/captcha.testers.d.ts.map +1 -0
- package/dist/integration-profile/testers/captcha.testers.js +121 -0
- package/dist/integration-profile/testers/captcha.testers.js.map +1 -0
- package/dist/integration-profile/testers/email.testers.d.ts +3 -0
- package/dist/integration-profile/testers/email.testers.d.ts.map +1 -0
- package/dist/integration-profile/testers/email.testers.js +128 -0
- package/dist/integration-profile/testers/email.testers.js.map +1 -0
- package/dist/integration-profile/testers/http-probe.d.ts +57 -0
- package/dist/integration-profile/testers/http-probe.d.ts.map +1 -0
- package/dist/integration-profile/testers/http-probe.js +140 -0
- package/dist/integration-profile/testers/http-probe.js.map +1 -0
- package/dist/integration-profile/testers/index.d.ts +12 -0
- package/dist/integration-profile/testers/index.d.ts.map +1 -0
- package/dist/integration-profile/testers/index.js +45 -0
- package/dist/integration-profile/testers/index.js.map +1 -0
- package/dist/integration-profile/testers/infrastructure.testers.d.ts +3 -0
- package/dist/integration-profile/testers/infrastructure.testers.d.ts.map +1 -0
- package/dist/integration-profile/testers/infrastructure.testers.js +105 -0
- package/dist/integration-profile/testers/infrastructure.testers.js.map +1 -0
- package/dist/integration-profile/testers/integration-tester.registry.d.ts +17 -0
- package/dist/integration-profile/testers/integration-tester.registry.d.ts.map +1 -0
- package/dist/integration-profile/testers/integration-tester.registry.js +52 -0
- package/dist/integration-profile/testers/integration-tester.registry.js.map +1 -0
- package/dist/integration-profile/testers/integration-tester.types.d.ts +55 -0
- package/dist/integration-profile/testers/integration-tester.types.d.ts.map +1 -0
- package/dist/integration-profile/testers/integration-tester.types.js +16 -0
- package/dist/integration-profile/testers/integration-tester.types.js.map +1 -0
- package/dist/integration-profile/testers/messaging.testers.d.ts +3 -0
- package/dist/integration-profile/testers/messaging.testers.d.ts.map +1 -0
- package/dist/integration-profile/testers/messaging.testers.js +70 -0
- package/dist/integration-profile/testers/messaging.testers.js.map +1 -0
- package/dist/integration-profile/testers/oauth.testers.d.ts +3 -0
- package/dist/integration-profile/testers/oauth.testers.d.ts.map +1 -0
- package/dist/integration-profile/testers/oauth.testers.js +285 -0
- package/dist/integration-profile/testers/oauth.testers.js.map +1 -0
- package/dist/integration-profile/testers/payment.testers.d.ts +3 -0
- package/dist/integration-profile/testers/payment.testers.d.ts.map +1 -0
- package/dist/integration-profile/testers/payment.testers.js +169 -0
- package/dist/integration-profile/testers/payment.testers.js.map +1 -0
- package/dist/integration-profile/testers/storage.testers.d.ts +3 -0
- package/dist/integration-profile/testers/storage.testers.d.ts.map +1 -0
- package/dist/integration-profile/testers/storage.testers.js +208 -0
- package/dist/integration-profile/testers/storage.testers.js.map +1 -0
- package/dist/language/en.json +4 -2
- package/dist/language/pt.json +4 -2
- package/dist/leaked-password/leaked-password.controller.d.ts +24 -0
- package/dist/leaked-password/leaked-password.controller.d.ts.map +1 -0
- package/dist/leaked-password/leaked-password.controller.js +78 -0
- package/dist/leaked-password/leaked-password.controller.js.map +1 -0
- package/dist/leaked-password/leaked-password.module.d.ts +8 -0
- package/dist/leaked-password/leaked-password.module.d.ts.map +1 -0
- package/dist/leaked-password/leaked-password.module.js +31 -0
- package/dist/leaked-password/leaked-password.module.js.map +1 -0
- package/dist/leaked-password/leaked-password.service.d.ts +64 -0
- package/dist/leaked-password/leaked-password.service.d.ts.map +1 -0
- package/dist/leaked-password/leaked-password.service.js +218 -0
- package/dist/leaked-password/leaked-password.service.js.map +1 -0
- package/dist/locale/locale.controller.d.ts +1 -1
- package/dist/locale/locale.service.d.ts +1 -1
- package/dist/mail/dto/preview.dto.d.ts +18 -0
- package/dist/mail/dto/preview.dto.d.ts.map +1 -0
- package/dist/mail/dto/preview.dto.js +66 -0
- package/dist/mail/dto/preview.dto.js.map +1 -0
- package/dist/mail/dto/send.dto.d.ts +7 -0
- package/dist/mail/dto/send.dto.d.ts.map +1 -1
- package/dist/mail/dto/send.dto.js +10 -0
- package/dist/mail/dto/send.dto.js.map +1 -1
- package/dist/mail/mail.controller.d.ts +4 -0
- package/dist/mail/mail.controller.d.ts.map +1 -1
- package/dist/mail/mail.controller.js +16 -2
- package/dist/mail/mail.controller.js.map +1 -1
- package/dist/mail/mail.service.d.ts +23 -2
- package/dist/mail/mail.service.d.ts.map +1 -1
- package/dist/mail/mail.service.js +102 -13
- package/dist/mail/mail.service.js.map +1 -1
- package/dist/mail-layout/dto/update.dto.d.ts +17 -0
- package/dist/mail-layout/dto/update.dto.d.ts.map +1 -0
- package/dist/mail-layout/dto/update.dto.js +27 -0
- package/dist/mail-layout/dto/update.dto.js.map +1 -0
- package/dist/mail-layout/mail-layout.controller.d.ts +15 -0
- package/dist/mail-layout/mail-layout.controller.d.ts.map +1 -0
- package/dist/mail-layout/mail-layout.controller.js +71 -0
- package/dist/mail-layout/mail-layout.controller.js.map +1 -0
- package/dist/mail-layout/mail-layout.module.d.ts +3 -0
- package/dist/mail-layout/mail-layout.module.d.ts.map +1 -0
- package/dist/mail-layout/mail-layout.module.js +35 -0
- package/dist/mail-layout/mail-layout.module.js.map +1 -0
- package/dist/mail-layout/mail-layout.service.d.ts +27 -0
- package/dist/mail-layout/mail-layout.service.d.ts.map +1 -0
- package/dist/mail-layout/mail-layout.service.js +80 -0
- package/dist/mail-layout/mail-layout.service.js.map +1 -0
- package/dist/mcp-chat/mcp-chat.controller.d.ts +2 -2
- package/dist/mcp-chat/mcp-chat.service.d.ts +24 -2
- package/dist/mcp-chat/mcp-chat.service.d.ts.map +1 -1
- package/dist/mcp-chat/mcp-chat.service.js +80 -24
- package/dist/mcp-chat/mcp-chat.service.js.map +1 -1
- package/dist/menu/menu.controller.d.ts +3 -3
- package/dist/menu/menu.service.d.ts +3 -3
- package/dist/notification/notification.controller.d.ts +12 -12
- package/dist/notification/notification.service.d.ts +12 -12
- package/dist/oauth/oauth-token-broker.service.d.ts +72 -0
- package/dist/oauth/oauth-token-broker.service.d.ts.map +1 -0
- package/dist/oauth/oauth-token-broker.service.js +258 -0
- package/dist/oauth/oauth-token-broker.service.js.map +1 -0
- package/dist/oauth/oauth.module.d.ts.map +1 -1
- package/dist/oauth/oauth.module.js +3 -1
- package/dist/oauth/oauth.module.js.map +1 -1
- package/dist/oauth/oauth.service.d.ts +2 -0
- package/dist/oauth/oauth.service.d.ts.map +1 -1
- package/dist/oauth/oauth.service.js +6 -3
- package/dist/oauth/oauth.service.js.map +1 -1
- package/dist/pdf/pdf.service.d.ts +8 -0
- package/dist/pdf/pdf.service.d.ts.map +1 -1
- package/dist/pdf/pdf.service.js +52 -0
- package/dist/pdf/pdf.service.js.map +1 -1
- package/dist/presence/presence.controller.d.ts +16 -0
- package/dist/presence/presence.controller.d.ts.map +1 -0
- package/dist/presence/presence.controller.js +60 -0
- package/dist/presence/presence.controller.js.map +1 -0
- package/dist/presence/presence.listener.d.ts +29 -0
- package/dist/presence/presence.listener.d.ts.map +1 -0
- package/dist/presence/presence.listener.js +82 -0
- package/dist/presence/presence.listener.js.map +1 -0
- package/dist/presence/presence.module.d.ts +3 -0
- package/dist/presence/presence.module.d.ts.map +1 -0
- package/dist/presence/presence.module.js +32 -0
- package/dist/presence/presence.module.js.map +1 -0
- package/dist/presence/presence.service.d.ts +42 -0
- package/dist/presence/presence.service.d.ts.map +1 -0
- package/dist/presence/presence.service.js +147 -0
- package/dist/presence/presence.service.js.map +1 -0
- package/dist/profile/dto/delete-account.dto.d.ts +8 -0
- package/dist/profile/dto/delete-account.dto.d.ts.map +1 -0
- package/dist/profile/dto/delete-account.dto.js +22 -0
- package/dist/profile/dto/delete-account.dto.js.map +1 -0
- package/dist/profile/events/profile-account-deleted.event.d.ts +12 -0
- package/dist/profile/events/profile-account-deleted.event.d.ts.map +1 -0
- package/dist/profile/events/profile-account-deleted.event.js +17 -0
- package/dist/profile/events/profile-account-deleted.event.js.map +1 -0
- package/dist/profile/profile.controller.d.ts +21 -15
- package/dist/profile/profile.controller.d.ts.map +1 -1
- package/dist/profile/profile.controller.js +75 -46
- package/dist/profile/profile.controller.js.map +1 -1
- package/dist/profile/profile.service.d.ts +30 -18
- package/dist/profile/profile.service.d.ts.map +1 -1
- package/dist/profile/profile.service.js +113 -37
- package/dist/profile/profile.service.js.map +1 -1
- package/dist/realtime/realtime.gateway.d.ts +48 -0
- package/dist/realtime/realtime.gateway.d.ts.map +1 -0
- package/dist/realtime/realtime.gateway.js +156 -0
- package/dist/realtime/realtime.gateway.js.map +1 -0
- package/dist/realtime/realtime.module.d.ts +8 -0
- package/dist/realtime/realtime.module.d.ts.map +1 -0
- package/dist/realtime/realtime.module.js +29 -0
- package/dist/realtime/realtime.module.js.map +1 -0
- package/dist/realtime/realtime.service.d.ts +51 -0
- package/dist/realtime/realtime.service.d.ts.map +1 -0
- package/dist/realtime/realtime.service.js +177 -0
- package/dist/realtime/realtime.service.js.map +1 -0
- package/dist/redis/redis-pubsub.d.ts +27 -0
- package/dist/redis/redis-pubsub.d.ts.map +1 -0
- package/dist/redis/redis-pubsub.js +140 -0
- package/dist/redis/redis-pubsub.js.map +1 -0
- package/dist/role/role.controller.d.ts +3 -3
- package/dist/role/role.service.d.ts +3 -3
- package/dist/setting/dto/create.dto.d.ts.map +1 -1
- package/dist/setting/dto/create.dto.js +9 -2
- package/dist/setting/dto/create.dto.js.map +1 -1
- package/dist/setting/setting.controller.d.ts +5 -5
- package/dist/setting/setting.service.d.ts +8 -5
- package/dist/setting/setting.service.d.ts.map +1 -1
- package/dist/setting/setting.service.js +25 -1
- package/dist/setting/setting.service.js.map +1 -1
- package/dist/user/dto/create-with-email-and-password.dto.d.ts +2 -0
- package/dist/user/dto/create-with-email-and-password.dto.d.ts.map +1 -1
- package/dist/user/dto/create-with-email-and-password.dto.js +5 -0
- package/dist/user/dto/create-with-email-and-password.dto.js.map +1 -1
- package/dist/user/dto/query-user-mail-list.dto.d.ts +5 -0
- package/dist/user/dto/query-user-mail-list.dto.d.ts.map +1 -0
- package/dist/user/dto/query-user-mail-list.dto.js +25 -0
- package/dist/user/dto/query-user-mail-list.dto.js.map +1 -0
- package/dist/user/user-credential.util.d.ts +19 -0
- package/dist/user/user-credential.util.d.ts.map +1 -0
- package/dist/user/user-credential.util.js +32 -0
- package/dist/user/user-credential.util.js.map +1 -0
- package/dist/user/user.controller.d.ts +17 -5
- package/dist/user/user.controller.d.ts.map +1 -1
- package/dist/user/user.controller.js +18 -3
- package/dist/user/user.controller.js.map +1 -1
- package/dist/user/user.service.d.ts +28 -6
- package/dist/user/user.service.d.ts.map +1 -1
- package/dist/user/user.service.js +204 -13
- package/dist/user/user.service.js.map +1 -1
- package/dist/validators/is-strong-password-with-settings.validator.d.ts.map +1 -1
- package/dist/validators/is-strong-password-with-settings.validator.js +11 -0
- package/dist/validators/is-strong-password-with-settings.validator.js.map +1 -1
- package/dist/validators/service-locator.d.ts +9 -0
- package/dist/validators/service-locator.d.ts.map +1 -1
- package/dist/validators/service-locator.js +12 -0
- package/dist/validators/service-locator.js.map +1 -1
- package/dist/whatsapp-sender/whatsapp-sender.module.d.ts +3 -0
- package/dist/whatsapp-sender/whatsapp-sender.module.d.ts.map +1 -0
- package/dist/whatsapp-sender/whatsapp-sender.module.js +23 -0
- package/dist/whatsapp-sender/whatsapp-sender.module.js.map +1 -0
- package/dist/whatsapp-sender/whatsapp-sender.service.d.ts +50 -0
- package/dist/whatsapp-sender/whatsapp-sender.service.d.ts.map +1 -0
- package/dist/whatsapp-sender/whatsapp-sender.service.js +224 -0
- package/dist/whatsapp-sender/whatsapp-sender.service.js.map +1 -0
- package/hedhog/data/integration_provider.yaml +16 -0
- package/hedhog/data/mail.yaml +88 -61
- package/hedhog/data/mail_layout.yaml +188 -0
- package/hedhog/data/menu.yaml +67 -3
- package/hedhog/data/route.yaml +135 -0
- package/hedhog/data/setting_group.yaml +139 -1
- package/hedhog/frontend/app/account/components/mfa-setup-dialog.tsx.ejs +36 -0
- package/hedhog/frontend/app/account/components/two-factor-auth.tsx.ejs +2 -0
- package/hedhog/frontend/app/account/hooks/use-mfa-setup.ts.ejs +10 -7
- package/hedhog/frontend/app/ai_agent/page.tsx.ejs +7 -4
- package/hedhog/frontend/app/ai_instruction/_components/ai-instruction-form.tsx.ejs +580 -0
- package/hedhog/frontend/app/ai_instruction/_components/ai-instruction-preview.tsx.ejs +150 -0
- package/hedhog/frontend/app/ai_instruction/_components/ai-instruction-versions.tsx.ejs +199 -0
- package/hedhog/frontend/app/ai_instruction/_components/prompt-diff.tsx.ejs +63 -0
- package/hedhog/frontend/app/ai_instruction/_lib/line-diff.spec.ts.ejs +59 -0
- package/hedhog/frontend/app/ai_instruction/_lib/line-diff.ts.ejs +72 -0
- package/hedhog/frontend/app/ai_instruction/_lib/prompt-template.spec.ts.ejs +170 -0
- package/hedhog/frontend/app/ai_instruction/_lib/prompt-template.ts.ejs +167 -0
- package/hedhog/frontend/app/ai_instruction/_lib/types.ts.ejs +99 -0
- package/hedhog/frontend/app/ai_instruction/page.tsx.ejs +422 -0
- package/hedhog/frontend/app/configurations/[slug]/components/setting-field.tsx.ejs +51 -4
- package/hedhog/frontend/app/incidents/page.tsx.ejs +400 -0
- package/hedhog/frontend/app/integration/profiles/page.tsx.ejs +153 -84
- package/hedhog/frontend/app/mail/layout/page.tsx.ejs +344 -0
- package/hedhog/frontend/app/mail/template/page.tsx.ejs +155 -121
- package/hedhog/frontend/app/mcp_chat/page.tsx.ejs +129 -17
- package/hedhog/frontend/app/pages/_components/page-delete-dialog.tsx.ejs +343 -0
- package/hedhog/frontend/app/pages/_components/page-detail-sheet.tsx.ejs +438 -0
- package/hedhog/frontend/app/pages/_components/page-wizard-sheet.tsx.ejs +1009 -0
- package/hedhog/frontend/app/pages/_components/system-page-types.ts.ejs +56 -0
- package/hedhog/frontend/app/pages/_components/use-system-pages.ts.ejs +171 -0
- package/hedhog/frontend/app/pages/page.tsx.ejs +514 -0
- package/hedhog/frontend/app/users/page.tsx.ejs +119 -13
- package/hedhog/frontend/app/users/user-activity-timeline.tsx.ejs +231 -0
- package/hedhog/frontend/app/users/user-mails.tsx.ejs +399 -0
- package/hedhog/frontend/app/users/user-sheet.tsx.ejs +60 -75
- package/hedhog/frontend/messages/en.json +499 -3
- package/hedhog/frontend/messages/pt.json +499 -3
- package/hedhog/table/ai_agent.yaml +1 -0
- package/hedhog/table/ai_instruction.yaml +15 -0
- package/hedhog/table/leaked_password.yaml +18 -0
- package/hedhog/table/mail_layout.yaml +35 -0
- package/hedhog/table/mail_var.yaml +4 -0
- package/hedhog/table/setting.yaml +1 -0
- package/hedhog/table/system_incident.yaml +59 -0
- package/hedhog/table/user_presence.yaml +36 -0
- package/package.json +8 -4
- package/src/access-log/access-log.interceptor.ts +4 -2
- package/src/ai/ai-attachment.fragments.spec.ts +319 -0
- package/src/ai/ai-attachment.fragments.ts +35 -0
- package/src/ai/ai.prompts.ts +38 -0
- package/src/ai/ai.service.spec.ts +280 -0
- package/src/ai/ai.service.ts +338 -82
- package/src/ai/dto/chat.dto.ts +33 -3
- package/src/ai/dto/create-agent.dto.ts +2 -2
- package/src/ai/dto/update-agent.dto.ts +2 -2
- package/src/ai-instruction/ai-instruction.controller.ts +40 -9
- package/src/ai-instruction/ai-instruction.module.ts +13 -2
- package/src/ai-instruction/ai-instruction.service.spec.ts +658 -0
- package/src/ai-instruction/ai-instruction.service.ts +661 -62
- package/src/ai-instruction/ai-prompt-builder.service.ts +10 -1
- package/src/ai-instruction/ai-prompt-registry.ts +87 -0
- package/src/ai-instruction/ai-prompt-resolver.service.spec.ts +375 -0
- package/src/ai-instruction/ai-prompt-resolver.service.ts +295 -0
- package/src/ai-instruction/ai-prompt-template.util.spec.ts +162 -0
- package/src/ai-instruction/ai-prompt-template.util.ts +199 -0
- package/src/ai-instruction/dto/create-ai-instruction.dto.ts +39 -3
- package/src/ai-instruction/dto/preview-ai-instruction.dto.ts +26 -0
- package/src/ai-instruction/dto/update-ai-instruction.dto.ts +42 -1
- package/src/ai-instruction/types/ai-instruction.types.ts +24 -1
- package/src/auth/auth.controller.ts +31 -5
- package/src/auth/auth.service.spec.ts +3 -1
- package/src/auth/auth.service.ts +101 -36
- package/src/captcha/captcha.module.ts +10 -0
- package/src/captcha/captcha.service.spec.ts +210 -0
- package/src/captcha/captcha.service.ts +191 -0
- package/src/challenge/challenge.service.spec.ts +39 -4
- package/src/challenge/challenge.service.ts +72 -17
- package/src/core.module.ts +27 -1
- package/src/file/file.service.spec.ts +105 -0
- package/src/file/file.service.ts +60 -3
- package/src/incident/incident-notifier.service.spec.ts +205 -0
- package/src/incident/incident-notifier.service.ts +241 -0
- package/src/incident/incident.controller.ts +38 -0
- package/src/incident/incident.module.ts +19 -0
- package/src/incident/incident.service.spec.ts +150 -0
- package/src/incident/incident.service.ts +209 -0
- package/src/index.ts +37 -0
- package/src/integration-profile/dto/test.dto.ts +19 -0
- package/src/integration-profile/integration-profile.controller.ts +10 -1
- package/src/integration-profile/integration-profile.module.spec.ts +51 -0
- package/src/integration-profile/integration-profile.module.ts +23 -4
- package/src/integration-profile/integration-profile.secrets.ts +9 -1
- package/src/integration-profile/integration-profile.service.spec.ts +279 -0
- package/src/integration-profile/integration-profile.service.ts +120 -124
- package/src/integration-profile/integration-profile.utils.spec.ts +22 -0
- package/src/integration-profile/integration-profile.utils.ts +40 -3
- package/src/integration-profile/testers/ai.testers.ts +165 -0
- package/src/integration-profile/testers/captcha.testers.spec.ts +92 -0
- package/src/integration-profile/testers/captcha.testers.ts +139 -0
- package/src/integration-profile/testers/email.testers.ts +161 -0
- package/src/integration-profile/testers/http-probe.spec.ts +153 -0
- package/src/integration-profile/testers/http-probe.ts +171 -0
- package/src/integration-profile/testers/index.ts +30 -0
- package/src/integration-profile/testers/infrastructure.testers.ts +122 -0
- package/src/integration-profile/testers/integration-tester.registry.spec.ts +75 -0
- package/src/integration-profile/testers/integration-tester.registry.ts +43 -0
- package/src/integration-profile/testers/integration-tester.types.ts +61 -0
- package/src/integration-profile/testers/messaging.testers.ts +102 -0
- package/src/integration-profile/testers/oauth.testers.spec.ts +220 -0
- package/src/integration-profile/testers/oauth.testers.ts +305 -0
- package/src/integration-profile/testers/payment.testers.ts +185 -0
- package/src/integration-profile/testers/remaining.testers.spec.ts +401 -0
- package/src/integration-profile/testers/storage.testers.spec.ts +185 -0
- package/src/integration-profile/testers/storage.testers.ts +226 -0
- package/src/integration-profile/testers/tester-coverage.spec.ts +58 -0
- package/src/language/en.json +4 -2
- package/src/language/pt.json +4 -2
- package/src/leaked-password/README.md +83 -0
- package/src/leaked-password/leaked-password.controller.ts +52 -0
- package/src/leaked-password/leaked-password.module.ts +18 -0
- package/src/leaked-password/leaked-password.service.ts +242 -0
- package/src/leaked-password/seed/build-seed-sql.mjs +180 -0
- package/src/leaked-password/seed/common-passwords.txt +335 -0
- package/src/mail/dto/preview.dto.ts +50 -0
- package/src/mail/dto/send.dto.ts +14 -1
- package/src/mail/mail-template.spec.ts +197 -0
- package/src/mail/mail.controller.ts +9 -2
- package/src/mail/mail.service.spec.ts +116 -1
- package/src/mail/mail.service.ts +118 -12
- package/src/mail-layout/dto/update.dto.ts +19 -0
- package/src/mail-layout/mail-layout.controller.ts +47 -0
- package/src/mail-layout/mail-layout.module.ts +22 -0
- package/src/mail-layout/mail-layout.service.ts +94 -0
- package/src/mcp-chat/mcp-chat.service.spec.ts +236 -0
- package/src/mcp-chat/mcp-chat.service.ts +122 -26
- package/src/oauth/oauth-token-broker.service.spec.ts +172 -0
- package/src/oauth/oauth-token-broker.service.ts +363 -0
- package/src/oauth/oauth.module.ts +3 -1
- package/src/oauth/oauth.service.ts +8 -2
- package/src/pdf/pdf.service.ts +75 -0
- package/src/presence/presence.controller.ts +29 -0
- package/src/presence/presence.listener.ts +53 -0
- package/src/presence/presence.module.ts +19 -0
- package/src/presence/presence.service.spec.ts +97 -0
- package/src/presence/presence.service.ts +160 -0
- package/src/profile/dto/delete-account.dto.ts +11 -0
- package/src/profile/events/profile-account-deleted.event.ts +13 -0
- package/src/profile/profile.controller.ts +46 -34
- package/src/profile/profile.service.ts +138 -38
- package/src/realtime/realtime.gateway.ts +138 -0
- package/src/realtime/realtime.module.ts +16 -0
- package/src/realtime/realtime.service.spec.ts +50 -0
- package/src/realtime/realtime.service.ts +187 -0
- package/src/redis/redis-pubsub.ts +179 -0
- package/src/setting/dto/create.dto.ts +13 -2
- package/src/setting/setting.service.spec.ts +56 -0
- package/src/setting/setting.service.ts +29 -1
- package/src/user/dto/create-with-email-and-password.dto.ts +6 -1
- package/src/user/dto/query-user-mail-list.dto.ts +10 -0
- package/src/user/user-credential.util.ts +35 -0
- package/src/user/user.controller.ts +17 -2
- package/src/user/user.service.spec.ts +153 -0
- package/src/user/user.service.ts +255 -12
- package/src/validators/is-strong-password-with-settings.validator.ts +12 -0
- package/src/validators/service-locator.ts +15 -0
- package/src/whatsapp-sender/whatsapp-sender.module.ts +10 -0
- package/src/whatsapp-sender/whatsapp-sender.service.ts +313 -0
|
@@ -36,9 +36,11 @@ export declare class NotificationService implements OnModuleInit, OnModuleDestro
|
|
|
36
36
|
user_id: number;
|
|
37
37
|
created_at: Date;
|
|
38
38
|
updated_at: Date;
|
|
39
|
+
status: import("@prisma/client").$Enums.notification_status_enum;
|
|
40
|
+
started_at: Date | null;
|
|
41
|
+
finished_at: Date | null;
|
|
39
42
|
type: import("@prisma/client").$Enums.notification_type_enum;
|
|
40
43
|
body: string | null;
|
|
41
|
-
status: import("@prisma/client").$Enums.notification_status_enum;
|
|
42
44
|
icon: string | null;
|
|
43
45
|
title: string;
|
|
44
46
|
progress: number | null;
|
|
@@ -46,8 +48,6 @@ export declare class NotificationService implements OnModuleInit, OnModuleDestro
|
|
|
46
48
|
action_data: import("@prisma/client/runtime/library").JsonValue | null;
|
|
47
49
|
action_url: string | null;
|
|
48
50
|
auto_remove: boolean;
|
|
49
|
-
started_at: Date | null;
|
|
50
|
-
finished_at: Date | null;
|
|
51
51
|
}>;
|
|
52
52
|
markAllRead(userId: number): Promise<import("@prisma/client").Prisma.BatchPayload>;
|
|
53
53
|
delete(userId: number, id: number): Promise<{
|
|
@@ -55,9 +55,11 @@ export declare class NotificationService implements OnModuleInit, OnModuleDestro
|
|
|
55
55
|
user_id: number;
|
|
56
56
|
created_at: Date;
|
|
57
57
|
updated_at: Date;
|
|
58
|
+
status: import("@prisma/client").$Enums.notification_status_enum;
|
|
59
|
+
started_at: Date | null;
|
|
60
|
+
finished_at: Date | null;
|
|
58
61
|
type: import("@prisma/client").$Enums.notification_type_enum;
|
|
59
62
|
body: string | null;
|
|
60
|
-
status: import("@prisma/client").$Enums.notification_status_enum;
|
|
61
63
|
icon: string | null;
|
|
62
64
|
title: string;
|
|
63
65
|
progress: number | null;
|
|
@@ -65,8 +67,6 @@ export declare class NotificationService implements OnModuleInit, OnModuleDestro
|
|
|
65
67
|
action_data: import("@prisma/client/runtime/library").JsonValue | null;
|
|
66
68
|
action_url: string | null;
|
|
67
69
|
auto_remove: boolean;
|
|
68
|
-
started_at: Date | null;
|
|
69
|
-
finished_at: Date | null;
|
|
70
70
|
}>;
|
|
71
71
|
deleteAll(userId: number): Promise<import("@prisma/client").Prisma.BatchPayload>;
|
|
72
72
|
create(data: CreateNotificationDto): Promise<{
|
|
@@ -74,9 +74,11 @@ export declare class NotificationService implements OnModuleInit, OnModuleDestro
|
|
|
74
74
|
user_id: number;
|
|
75
75
|
created_at: Date;
|
|
76
76
|
updated_at: Date;
|
|
77
|
+
status: import("@prisma/client").$Enums.notification_status_enum;
|
|
78
|
+
started_at: Date | null;
|
|
79
|
+
finished_at: Date | null;
|
|
77
80
|
type: import("@prisma/client").$Enums.notification_type_enum;
|
|
78
81
|
body: string | null;
|
|
79
|
-
status: import("@prisma/client").$Enums.notification_status_enum;
|
|
80
82
|
icon: string | null;
|
|
81
83
|
title: string;
|
|
82
84
|
progress: number | null;
|
|
@@ -84,17 +86,17 @@ export declare class NotificationService implements OnModuleInit, OnModuleDestro
|
|
|
84
86
|
action_data: import("@prisma/client/runtime/library").JsonValue | null;
|
|
85
87
|
action_url: string | null;
|
|
86
88
|
auto_remove: boolean;
|
|
87
|
-
started_at: Date | null;
|
|
88
|
-
finished_at: Date | null;
|
|
89
89
|
}>;
|
|
90
90
|
updateProgress(userId: number, id: number, dto: UpdateProgressDto): Promise<{
|
|
91
91
|
id: number;
|
|
92
92
|
user_id: number;
|
|
93
93
|
created_at: Date;
|
|
94
94
|
updated_at: Date;
|
|
95
|
+
status: import("@prisma/client").$Enums.notification_status_enum;
|
|
96
|
+
started_at: Date | null;
|
|
97
|
+
finished_at: Date | null;
|
|
95
98
|
type: import("@prisma/client").$Enums.notification_type_enum;
|
|
96
99
|
body: string | null;
|
|
97
|
-
status: import("@prisma/client").$Enums.notification_status_enum;
|
|
98
100
|
icon: string | null;
|
|
99
101
|
title: string;
|
|
100
102
|
progress: number | null;
|
|
@@ -102,8 +104,6 @@ export declare class NotificationService implements OnModuleInit, OnModuleDestro
|
|
|
102
104
|
action_data: import("@prisma/client/runtime/library").JsonValue | null;
|
|
103
105
|
action_url: string | null;
|
|
104
106
|
auto_remove: boolean;
|
|
105
|
-
started_at: Date | null;
|
|
106
|
-
finished_at: Date | null;
|
|
107
107
|
}>;
|
|
108
108
|
stream(userId: number, req: Request, res: Response): void;
|
|
109
109
|
clearOldNotifications(retentionDays: number, batchLimit: number): Promise<number>;
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { PrismaService } from '@hed-hog/api-prisma';
|
|
2
|
+
import { HttpService } from '@nestjs/axios';
|
|
3
|
+
import { SecurityService } from '../security/security.service';
|
|
4
|
+
import { SettingService } from '../setting/setting.service';
|
|
5
|
+
/**
|
|
6
|
+
* Reasons a brokered access token could not be produced. Consumers (e.g. the
|
|
7
|
+
* `microsoft` library) map these to HTTP responses so the UI can react — most
|
|
8
|
+
* importantly, `not_connected`/`refresh_revoked` should prompt the user to
|
|
9
|
+
* (re)connect their account, and `missing_scope` to re-consent.
|
|
10
|
+
*/
|
|
11
|
+
export type OAuthTokenBrokerReason = 'not_connected' | 'refresh_revoked' | 'missing_scope' | 'provider_not_configured' | 'upstream_failure';
|
|
12
|
+
export declare class OAuthTokenBrokerError extends Error {
|
|
13
|
+
readonly reason: OAuthTokenBrokerReason;
|
|
14
|
+
readonly provider: string;
|
|
15
|
+
readonly cause?: unknown;
|
|
16
|
+
constructor(reason: OAuthTokenBrokerReason, message: string, provider: string, cause?: unknown);
|
|
17
|
+
}
|
|
18
|
+
export interface BrokeredAccessToken {
|
|
19
|
+
accessToken: string;
|
|
20
|
+
/** Absolute expiry of the access token. */
|
|
21
|
+
expiresAt: Date;
|
|
22
|
+
/** Scopes granted to the stored refresh token (best-effort, from `user_account.scopes`). */
|
|
23
|
+
scopes: string[];
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Exchanges a user's stored (encrypted) OAuth **refresh token** for a fresh
|
|
27
|
+
* **access token**, so the backend can call provider APIs (Microsoft Graph,
|
|
28
|
+
* Google, ...) on that user's behalf — the "delegated" access mode.
|
|
29
|
+
*
|
|
30
|
+
* The refresh token is written by {@link OAuthService} during login/connect
|
|
31
|
+
* (encrypted with {@link SecurityService.encrypt} and stored as bytes in
|
|
32
|
+
* `user_account.refresh_token`); this service reads it back, decrypts it, runs
|
|
33
|
+
* a `grant_type=refresh_token` exchange, persists the rotated refresh token,
|
|
34
|
+
* and caches the access token in memory until shortly before it expires.
|
|
35
|
+
*
|
|
36
|
+
* It intentionally reuses the SAME `integration_profile` credentials already
|
|
37
|
+
* configured for OAuth login — no new provider, table, or setting is introduced.
|
|
38
|
+
*/
|
|
39
|
+
export declare class OAuthTokenBrokerService {
|
|
40
|
+
private readonly http;
|
|
41
|
+
private readonly setting;
|
|
42
|
+
private readonly prisma;
|
|
43
|
+
private readonly security;
|
|
44
|
+
private readonly logger;
|
|
45
|
+
/** access-token cache keyed by `${provider}:${userId}`. */
|
|
46
|
+
private readonly cache;
|
|
47
|
+
/** Refresh a bit early so an in-flight request never rides an about-to-expire token. */
|
|
48
|
+
private static readonly EXPIRY_SKEW_MS;
|
|
49
|
+
constructor(http: HttpService, setting: SettingService, prisma: PrismaService, security: SecurityService);
|
|
50
|
+
/** Normalizes a provider to the enum form stored in `user_account.provider`. */
|
|
51
|
+
private toAccountProvider;
|
|
52
|
+
/** Setting slug that points at the integration profile for this provider. */
|
|
53
|
+
private profileSettingSlug;
|
|
54
|
+
private resolveProviderConfig;
|
|
55
|
+
private loadUserAccount;
|
|
56
|
+
private parseScopes;
|
|
57
|
+
/** Scopes granted to the stored refresh token, from `user_account.scopes`. */
|
|
58
|
+
getGrantedScopes(userId: number, provider: string): Promise<string[]>;
|
|
59
|
+
/** Whether the user has this provider connected with a usable refresh token. */
|
|
60
|
+
isConnected(userId: number, provider: string): Promise<boolean>;
|
|
61
|
+
private cacheKey;
|
|
62
|
+
/**
|
|
63
|
+
* Returns a fresh access token for the user, refreshing (and rotating the
|
|
64
|
+
* stored refresh token) when the cache is cold or about to expire.
|
|
65
|
+
*
|
|
66
|
+
* @throws {OAuthTokenBrokerError} with a typed `reason` on any failure.
|
|
67
|
+
*/
|
|
68
|
+
getAccessToken(userId: number, provider: string): Promise<BrokeredAccessToken>;
|
|
69
|
+
/** Drops any cached access token for a user/provider (e.g. after disconnect). */
|
|
70
|
+
invalidate(userId: number, provider: string): void;
|
|
71
|
+
}
|
|
72
|
+
//# sourceMappingURL=oauth-token-broker.service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"oauth-token-broker.service.d.ts","sourceRoot":"","sources":["../../src/oauth/oauth-token-broker.service.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa,EAEd,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAI5C,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAC/D,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAE5D;;;;;GAKG;AACH,MAAM,MAAM,sBAAsB,GAC9B,eAAe,GACf,iBAAiB,GACjB,eAAe,GACf,yBAAyB,GACzB,kBAAkB,CAAC;AAEvB,qBAAa,qBAAsB,SAAQ,KAAK;IAE5C,QAAQ,CAAC,MAAM,EAAE,sBAAsB;IAEvC,QAAQ,CAAC,QAAQ,EAAE,MAAM;IACzB,QAAQ,CAAC,KAAK,CAAC,EAAE,OAAO;gBAHf,MAAM,EAAE,sBAAsB,EACvC,OAAO,EAAE,MAAM,EACN,QAAQ,EAAE,MAAM,EAChB,KAAK,CAAC,EAAE,OAAO;CAK3B;AAED,MAAM,WAAW,mBAAmB;IAClC,WAAW,EAAE,MAAM,CAAC;IACpB,2CAA2C;IAC3C,SAAS,EAAE,IAAI,CAAC;IAChB,4FAA4F;IAC5F,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB;AAcD;;;;;;;;;;;;;GAaG;AACH,qBACa,uBAAuB;IAUhC,OAAO,CAAC,QAAQ,CAAC,IAAI;IAErB,OAAO,CAAC,QAAQ,CAAC,OAAO;IACxB,OAAO,CAAC,QAAQ,CAAC,MAAM;IACvB,OAAO,CAAC,QAAQ,CAAC,QAAQ;IAb3B,OAAO,CAAC,QAAQ,CAAC,MAAM,CAA4C;IAEnE,2DAA2D;IAC3D,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAiC;IAEvD,wFAAwF;IACxF,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,cAAc,CAAa;gBAGhC,IAAI,EAAE,WAAW,EAEjB,OAAO,EAAE,cAAc,EACvB,MAAM,EAAE,aAAa,EACrB,QAAQ,EAAE,eAAe;IAG5C,gFAAgF;IAChF,OAAO,CAAC,iBAAiB;IAQzB,6EAA6E;IAC7E,OAAO,CAAC,kBAAkB;YAaZ,qBAAqB;YA4DrB,eAAe;IAyB7B,OAAO,CAAC,WAAW;IAOnB,8EAA8E;IACxE,gBAAgB,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;IAQ3E,gFAAgF;IAC1E,WAAW,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAQrE,OAAO,CAAC,QAAQ;IAIhB;;;;;OAKG;IACG,cAAc,CAClB,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,mBAAmB,CAAC;IA4H/B,iFAAiF;IACjF,UAAU,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI;CAGnD"}
|
|
@@ -0,0 +1,258 @@
|
|
|
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 OAuthTokenBrokerService_1;
|
|
15
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
+
exports.OAuthTokenBrokerService = exports.OAuthTokenBrokerError = void 0;
|
|
17
|
+
const api_prisma_1 = require("@hed-hog/api-prisma");
|
|
18
|
+
const axios_1 = require("@nestjs/axios");
|
|
19
|
+
const common_1 = require("@nestjs/common");
|
|
20
|
+
const rxjs_1 = require("rxjs");
|
|
21
|
+
const integration_profile_utils_1 = require("../integration-profile/integration-profile.utils");
|
|
22
|
+
const security_service_1 = require("../security/security.service");
|
|
23
|
+
const setting_service_1 = require("../setting/setting.service");
|
|
24
|
+
class OAuthTokenBrokerError extends Error {
|
|
25
|
+
constructor(reason, message, provider, cause) {
|
|
26
|
+
super(message);
|
|
27
|
+
this.reason = reason;
|
|
28
|
+
this.provider = provider;
|
|
29
|
+
this.cause = cause;
|
|
30
|
+
this.name = 'OAuthTokenBrokerError';
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
exports.OAuthTokenBrokerError = OAuthTokenBrokerError;
|
|
34
|
+
/**
|
|
35
|
+
* Exchanges a user's stored (encrypted) OAuth **refresh token** for a fresh
|
|
36
|
+
* **access token**, so the backend can call provider APIs (Microsoft Graph,
|
|
37
|
+
* Google, ...) on that user's behalf — the "delegated" access mode.
|
|
38
|
+
*
|
|
39
|
+
* The refresh token is written by {@link OAuthService} during login/connect
|
|
40
|
+
* (encrypted with {@link SecurityService.encrypt} and stored as bytes in
|
|
41
|
+
* `user_account.refresh_token`); this service reads it back, decrypts it, runs
|
|
42
|
+
* a `grant_type=refresh_token` exchange, persists the rotated refresh token,
|
|
43
|
+
* and caches the access token in memory until shortly before it expires.
|
|
44
|
+
*
|
|
45
|
+
* It intentionally reuses the SAME `integration_profile` credentials already
|
|
46
|
+
* configured for OAuth login — no new provider, table, or setting is introduced.
|
|
47
|
+
*/
|
|
48
|
+
let OAuthTokenBrokerService = OAuthTokenBrokerService_1 = class OAuthTokenBrokerService {
|
|
49
|
+
constructor(http, setting, prisma, security) {
|
|
50
|
+
this.http = http;
|
|
51
|
+
this.setting = setting;
|
|
52
|
+
this.prisma = prisma;
|
|
53
|
+
this.security = security;
|
|
54
|
+
this.logger = new common_1.Logger(OAuthTokenBrokerService_1.name);
|
|
55
|
+
/** access-token cache keyed by `${provider}:${userId}`. */
|
|
56
|
+
this.cache = new Map();
|
|
57
|
+
}
|
|
58
|
+
/** Normalizes a provider to the enum form stored in `user_account.provider`. */
|
|
59
|
+
toAccountProvider(provider) {
|
|
60
|
+
return String(provider)
|
|
61
|
+
.toLowerCase()
|
|
62
|
+
.replace(/-/g, '_');
|
|
63
|
+
}
|
|
64
|
+
/** Setting slug that points at the integration profile for this provider. */
|
|
65
|
+
profileSettingSlug(provider) {
|
|
66
|
+
switch (String(provider).toLowerCase().replace(/_/g, '-')) {
|
|
67
|
+
case 'microsoft-entra-id':
|
|
68
|
+
return 'oauth-microsoft-entra-id-profile-id';
|
|
69
|
+
case 'microsoft':
|
|
70
|
+
return 'oauth-microsoft-profile-id';
|
|
71
|
+
case 'google':
|
|
72
|
+
return 'oauth-google-profile-id';
|
|
73
|
+
default:
|
|
74
|
+
return null;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
async resolveProviderConfig(provider) {
|
|
78
|
+
var _a;
|
|
79
|
+
const settingSlug = this.profileSettingSlug(provider);
|
|
80
|
+
if (!settingSlug) {
|
|
81
|
+
throw new OAuthTokenBrokerError('provider_not_configured', `Token broker does not support provider "${provider}".`, provider);
|
|
82
|
+
}
|
|
83
|
+
const settings = await this.setting.getSettingValues([settingSlug]);
|
|
84
|
+
const profileSlug = String((_a = settings[settingSlug]) !== null && _a !== void 0 ? _a : '').trim();
|
|
85
|
+
if (!profileSlug) {
|
|
86
|
+
throw new OAuthTokenBrokerError('provider_not_configured', `OAuth profile for "${provider}" is not configured.`, provider);
|
|
87
|
+
}
|
|
88
|
+
const profile = await this.prisma.integration_profile.findUnique({
|
|
89
|
+
where: { slug: profileSlug },
|
|
90
|
+
include: { integration_provider: { select: { slug: true } } },
|
|
91
|
+
});
|
|
92
|
+
if (!profile) {
|
|
93
|
+
throw new OAuthTokenBrokerError('provider_not_configured', `OAuth profile "${profileSlug}" for "${provider}" was not found.`, provider);
|
|
94
|
+
}
|
|
95
|
+
const { clientId, clientSecret, tenantId } = (0, integration_profile_utils_1.buildOAuthConfigFromIntegration)(profile.integration_provider.slug, profile.config);
|
|
96
|
+
const normalized = String(provider).toLowerCase().replace(/_/g, '-');
|
|
97
|
+
let tokenUrl;
|
|
98
|
+
if (normalized === 'microsoft-entra-id') {
|
|
99
|
+
if (!tenantId) {
|
|
100
|
+
throw new OAuthTokenBrokerError('provider_not_configured', 'Microsoft Entra ID OAuth profile is missing tenant_id.', provider);
|
|
101
|
+
}
|
|
102
|
+
tokenUrl = `https://login.microsoftonline.com/${tenantId}/oauth2/v2.0/token`;
|
|
103
|
+
}
|
|
104
|
+
else if (normalized === 'microsoft') {
|
|
105
|
+
tokenUrl = 'https://login.microsoftonline.com/common/oauth2/v2.0/token';
|
|
106
|
+
}
|
|
107
|
+
else {
|
|
108
|
+
// google
|
|
109
|
+
tokenUrl = 'https://oauth2.googleapis.com/token';
|
|
110
|
+
}
|
|
111
|
+
return { tokenUrl, clientId, clientSecret };
|
|
112
|
+
}
|
|
113
|
+
async loadUserAccount(userId, provider) {
|
|
114
|
+
const account = await this.prisma.user_account.findFirst({
|
|
115
|
+
where: {
|
|
116
|
+
user_id: userId,
|
|
117
|
+
provider: this.toAccountProvider(provider),
|
|
118
|
+
},
|
|
119
|
+
select: {
|
|
120
|
+
id: true,
|
|
121
|
+
refresh_token: true,
|
|
122
|
+
scopes: true,
|
|
123
|
+
token_expires_at: true,
|
|
124
|
+
},
|
|
125
|
+
});
|
|
126
|
+
if (!account || !account.refresh_token) {
|
|
127
|
+
throw new OAuthTokenBrokerError('not_connected', `User ${userId} has no connected "${provider}" account.`, provider);
|
|
128
|
+
}
|
|
129
|
+
return account;
|
|
130
|
+
}
|
|
131
|
+
parseScopes(scopes) {
|
|
132
|
+
return String(scopes !== null && scopes !== void 0 ? scopes : '')
|
|
133
|
+
.split(/[\s,]+/)
|
|
134
|
+
.map((scope) => scope.trim())
|
|
135
|
+
.filter(Boolean);
|
|
136
|
+
}
|
|
137
|
+
/** Scopes granted to the stored refresh token, from `user_account.scopes`. */
|
|
138
|
+
async getGrantedScopes(userId, provider) {
|
|
139
|
+
const account = await this.prisma.user_account.findFirst({
|
|
140
|
+
where: { user_id: userId, provider: this.toAccountProvider(provider) },
|
|
141
|
+
select: { scopes: true },
|
|
142
|
+
});
|
|
143
|
+
return this.parseScopes(account === null || account === void 0 ? void 0 : account.scopes);
|
|
144
|
+
}
|
|
145
|
+
/** Whether the user has this provider connected with a usable refresh token. */
|
|
146
|
+
async isConnected(userId, provider) {
|
|
147
|
+
const account = await this.prisma.user_account.findFirst({
|
|
148
|
+
where: { user_id: userId, provider: this.toAccountProvider(provider) },
|
|
149
|
+
select: { refresh_token: true },
|
|
150
|
+
});
|
|
151
|
+
return Boolean(account === null || account === void 0 ? void 0 : account.refresh_token);
|
|
152
|
+
}
|
|
153
|
+
cacheKey(userId, provider) {
|
|
154
|
+
return `${String(provider).toLowerCase()}:${userId}`;
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* Returns a fresh access token for the user, refreshing (and rotating the
|
|
158
|
+
* stored refresh token) when the cache is cold or about to expire.
|
|
159
|
+
*
|
|
160
|
+
* @throws {OAuthTokenBrokerError} with a typed `reason` on any failure.
|
|
161
|
+
*/
|
|
162
|
+
async getAccessToken(userId, provider) {
|
|
163
|
+
var _a, _b, _c;
|
|
164
|
+
const key = this.cacheKey(userId, provider);
|
|
165
|
+
const cached = this.cache.get(key);
|
|
166
|
+
if (cached &&
|
|
167
|
+
cached.expiresAt.getTime() - Date.now() > OAuthTokenBrokerService_1.EXPIRY_SKEW_MS) {
|
|
168
|
+
return Object.assign({}, cached);
|
|
169
|
+
}
|
|
170
|
+
const [config, account] = await Promise.all([
|
|
171
|
+
this.resolveProviderConfig(provider),
|
|
172
|
+
this.loadUserAccount(userId, provider),
|
|
173
|
+
]);
|
|
174
|
+
let decryptedRefreshToken;
|
|
175
|
+
try {
|
|
176
|
+
decryptedRefreshToken = this.security.decrypt(account.refresh_token.toString());
|
|
177
|
+
}
|
|
178
|
+
catch (error) {
|
|
179
|
+
throw new OAuthTokenBrokerError('refresh_revoked', `Failed to decrypt stored refresh token for "${provider}".`, provider, error);
|
|
180
|
+
}
|
|
181
|
+
const grantedScopes = this.parseScopes(account.scopes);
|
|
182
|
+
const scopeParam = grantedScopes.includes('offline_access')
|
|
183
|
+
? grantedScopes
|
|
184
|
+
: [...grantedScopes, 'offline_access'];
|
|
185
|
+
const body = new URLSearchParams({
|
|
186
|
+
client_id: config.clientId,
|
|
187
|
+
client_secret: config.clientSecret,
|
|
188
|
+
grant_type: 'refresh_token',
|
|
189
|
+
refresh_token: decryptedRefreshToken,
|
|
190
|
+
});
|
|
191
|
+
if (scopeParam.length > 1) {
|
|
192
|
+
body.set('scope', scopeParam.join(' '));
|
|
193
|
+
}
|
|
194
|
+
let token;
|
|
195
|
+
try {
|
|
196
|
+
const response = await (0, rxjs_1.lastValueFrom)(this.http.post(config.tokenUrl, body.toString(), {
|
|
197
|
+
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
|
|
198
|
+
}));
|
|
199
|
+
token = response.data;
|
|
200
|
+
}
|
|
201
|
+
catch (error) {
|
|
202
|
+
const providerError = (_b = (_a = error === null || error === void 0 ? void 0 : error.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.error;
|
|
203
|
+
if (providerError === 'invalid_grant') {
|
|
204
|
+
// Refresh token revoked/expired — the user must reconnect.
|
|
205
|
+
this.cache.delete(key);
|
|
206
|
+
throw new OAuthTokenBrokerError('refresh_revoked', `Refresh token for "${provider}" is no longer valid. Reconnect the account.`, provider, error);
|
|
207
|
+
}
|
|
208
|
+
this.logger.warn(`Token refresh failed: provider=${provider} userId=${userId} error=${(_c = providerError !== null && providerError !== void 0 ? providerError : error === null || error === void 0 ? void 0 : error.message) !== null && _c !== void 0 ? _c : 'unknown'}`);
|
|
209
|
+
throw new OAuthTokenBrokerError('upstream_failure', `Unable to refresh "${provider}" access token.`, provider, error);
|
|
210
|
+
}
|
|
211
|
+
if (!(token === null || token === void 0 ? void 0 : token.access_token)) {
|
|
212
|
+
throw new OAuthTokenBrokerError('upstream_failure', `Provider "${provider}" returned no access token.`, provider);
|
|
213
|
+
}
|
|
214
|
+
const expiresAt = new Date(Date.now() + (token.expires_in ? token.expires_in * 1000 : 3600 * 1000));
|
|
215
|
+
const resolvedScopes = token.scope
|
|
216
|
+
? this.parseScopes(token.scope)
|
|
217
|
+
: grantedScopes;
|
|
218
|
+
// Persist the rotated refresh token so the next call starts from the newest
|
|
219
|
+
// one (Microsoft rotates refresh tokens on every exchange).
|
|
220
|
+
if (token.refresh_token && token.refresh_token !== decryptedRefreshToken) {
|
|
221
|
+
try {
|
|
222
|
+
const encrypted = this.security.encrypt(token.refresh_token);
|
|
223
|
+
await this.prisma.user_account.update({
|
|
224
|
+
where: { id: account.id },
|
|
225
|
+
data: Object.assign({ refresh_token: Buffer.from(encrypted), token_expires_at: expiresAt }, (token.scope ? { scopes: resolvedScopes.join(',') } : {})),
|
|
226
|
+
});
|
|
227
|
+
}
|
|
228
|
+
catch (error) {
|
|
229
|
+
// A persistence failure must not fail the request — the access token is
|
|
230
|
+
// already valid; log and continue (next refresh reuses the old token).
|
|
231
|
+
this.logger.warn(`Failed to persist rotated refresh token: provider=${provider} userId=${userId} error=${error instanceof Error ? error.message : 'unknown'}`);
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
const entry = {
|
|
235
|
+
accessToken: token.access_token,
|
|
236
|
+
expiresAt,
|
|
237
|
+
scopes: resolvedScopes,
|
|
238
|
+
};
|
|
239
|
+
this.cache.set(key, entry);
|
|
240
|
+
return Object.assign({}, entry);
|
|
241
|
+
}
|
|
242
|
+
/** Drops any cached access token for a user/provider (e.g. after disconnect). */
|
|
243
|
+
invalidate(userId, provider) {
|
|
244
|
+
this.cache.delete(this.cacheKey(userId, provider));
|
|
245
|
+
}
|
|
246
|
+
};
|
|
247
|
+
exports.OAuthTokenBrokerService = OAuthTokenBrokerService;
|
|
248
|
+
/** Refresh a bit early so an in-flight request never rides an about-to-expire token. */
|
|
249
|
+
OAuthTokenBrokerService.EXPIRY_SKEW_MS = 60 * 1000;
|
|
250
|
+
exports.OAuthTokenBrokerService = OAuthTokenBrokerService = OAuthTokenBrokerService_1 = __decorate([
|
|
251
|
+
(0, common_1.Injectable)(),
|
|
252
|
+
__param(1, (0, common_1.Inject)((0, common_1.forwardRef)(() => setting_service_1.SettingService))),
|
|
253
|
+
__metadata("design:paramtypes", [axios_1.HttpService,
|
|
254
|
+
setting_service_1.SettingService,
|
|
255
|
+
api_prisma_1.PrismaService,
|
|
256
|
+
security_service_1.SecurityService])
|
|
257
|
+
], OAuthTokenBrokerService);
|
|
258
|
+
//# sourceMappingURL=oauth-token-broker.service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"oauth-token-broker.service.js","sourceRoot":"","sources":["../../src/oauth/oauth-token-broker.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,oDAG6B;AAC7B,yCAA4C;AAC5C,2CAAwE;AACxE,+BAAqC;A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OAAO,CAAC,CAAC,CAAC,SAAS,EAAE,CAC7I,CAAC;YACJ,CAAC;QACH,CAAC;QAED,MAAM,KAAK,GAAe;YACxB,WAAW,EAAE,KAAK,CAAC,YAAY;YAC/B,SAAS;YACT,MAAM,EAAE,cAAc;SACvB,CAAC;QACF,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;QAC3B,yBAAY,KAAK,EAAG;IACtB,CAAC;IAED,iFAAiF;IACjF,UAAU,CAAC,MAAc,EAAE,QAAgB;QACzC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC,CAAC;IACrD,CAAC;;AAlSU,0DAAuB;AAMlC,wFAAwF;AAChE,sCAAc,GAAG,EAAE,GAAG,IAAI,AAAZ,CAAa;kCAPxC,uBAAuB;IADnC,IAAA,mBAAU,GAAE;IAYR,WAAA,IAAA,eAAM,EAAC,IAAA,mBAAU,EAAC,GAAG,EAAE,CAAC,gCAAc,CAAC,CAAC,CAAA;qCADlB,mBAAW;QAER,gCAAc;QACf,0BAAa;QACX,kCAAe;GAdjC,uBAAuB,CAmSnC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"oauth.module.d.ts","sourceRoot":"","sources":["../../src/oauth/oauth.module.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"oauth.module.d.ts","sourceRoot":"","sources":["../../src/oauth/oauth.module.ts"],"names":[],"mappings":"AAuBA,qBA4Ba,WAAW;CAAG"}
|
|
@@ -19,6 +19,7 @@ const security_module_1 = require("../security/security.module");
|
|
|
19
19
|
const token_module_1 = require("../token/token.module");
|
|
20
20
|
const user_module_1 = require("../user/user.module");
|
|
21
21
|
const oauth_callback_coordinator_service_1 = require("./oauth-callback-coordinator.service");
|
|
22
|
+
const oauth_token_broker_service_1 = require("./oauth-token-broker.service");
|
|
22
23
|
const oauth_controller_1 = require("./oauth.controller");
|
|
23
24
|
const oauth_service_1 = require("./oauth.service");
|
|
24
25
|
const apple_provider_1 = require("./providers/apple.provider");
|
|
@@ -48,6 +49,7 @@ exports.OAuthModule = OAuthModule = __decorate([
|
|
|
48
49
|
controllers: [oauth_controller_1.OAuthController],
|
|
49
50
|
providers: [
|
|
50
51
|
oauth_callback_coordinator_service_1.OAuthCallbackCoordinatorService,
|
|
52
|
+
oauth_token_broker_service_1.OAuthTokenBrokerService,
|
|
51
53
|
oauth_service_1.OAuthService,
|
|
52
54
|
google_provider_1.GoogleProvider,
|
|
53
55
|
facebook_provider_1.FacebookProvider,
|
|
@@ -57,7 +59,7 @@ exports.OAuthModule = OAuthModule = __decorate([
|
|
|
57
59
|
apple_provider_1.AppleProvider,
|
|
58
60
|
linkedin_provider_1.LinkedinProvider,
|
|
59
61
|
],
|
|
60
|
-
exports: [oauth_service_1.OAuthService],
|
|
62
|
+
exports: [oauth_service_1.OAuthService, oauth_token_broker_service_1.OAuthTokenBrokerService],
|
|
61
63
|
})
|
|
62
64
|
], OAuthModule);
|
|
63
65
|
//# sourceMappingURL=oauth.module.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"oauth.module.js","sourceRoot":"","sources":["../../src/oauth/oauth.module.ts"],"names":[],"mappings":";;;;;;;;;AAAA,gDAAiE;AACjE,oDAAmD;AACnD,yCAA2C;AAC3C,2CAAoD;AACpD,2CAA8C;AAC9C,qDAAiD;AACjD,qDAAiD;AACjD,qDAAiD;AACjD,iEAA6D;AAC7D,wDAAoD;AACpD,qDAAiD;AACjD,6FAAuF;AACvF,yDAAqD;AACrD,mDAA+C;AAC/C,+DAA2D;AAC3D,qEAAiE;AACjE,iEAA6D;AAC7D,iEAA6D;AAC7D,qEAAiE;AACjE,yFAAmF;AACnF,uEAAmE;
|
|
1
|
+
{"version":3,"file":"oauth.module.js","sourceRoot":"","sources":["../../src/oauth/oauth.module.ts"],"names":[],"mappings":";;;;;;;;;AAAA,gDAAiE;A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4BAAY,EAAE,oDAAuB,CAAC;KACjD,CAAC;GACW,WAAW,CAAG"}
|
|
@@ -31,6 +31,8 @@ type HandleCallbackProps = {
|
|
|
31
31
|
requestOrigin?: string;
|
|
32
32
|
/** Referer header, used as a fallback when the Origin header is absent. */
|
|
33
33
|
requestReferer?: string;
|
|
34
|
+
/** App key that initiated the flow (decoded from the signed web state), used for per-app email branding. */
|
|
35
|
+
app?: string;
|
|
34
36
|
};
|
|
35
37
|
export declare class OAuthService {
|
|
36
38
|
private readonly callbackCoordinator;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"oauth.service.d.ts","sourceRoot":"","sources":["../../src/oauth/oauth.service.ts"],"names":[],"mappings":"AACA,OAAO,EAAU,aAAa,EAAE,qCAAqC,EAAE,MAAM,qBAAqB,CAAC;AAWnG,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAC/D,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAC5D,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAEtD,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAEnD,OAAO,EAAE,+BAA+B,EAAE,MAAM,sCAAsC,CAAC;AAMvF,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AACjE,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAC7D,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAC7D,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AACjE,OAAO,EAAE,wBAAwB,EAAE,MAAM,yCAAyC,CAAC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f,EAAE;QACD,GAAG,EAAE,QAAQ,CAAC;QACd,GAAG,EAAE,MAAM,CAAC;QACZ,QAAQ,EAAE,qCAAqC,CAAC;QAChD,MAAM,EAAE,MAAM,CAAC;QACf,SAAS,EAAE,MAAM,CAAC;QAClB,SAAS,EAAE,MAAM,CAAC;QAClB,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,aAAa,CAAC,EAAE,MAAM,CAAC;QACvB,cAAc,CAAC,EAAE,MAAM,CAAC;KACzB;;;;;;;YAuFa,gBAAgB;IA0B9B,OAAO,CAAC,kBAAkB;IAY1B,OAAO,CAAC,oBAAoB;IAQ5B,OAAO,CAAC,gBAAgB;YAkEV,WAAW;YAsDX,cAAc;YA2Fd,aAAa;YAoEb,gBAAgB;YAuBhB,6BAA6B;CA+B5C"}
|
|
@@ -218,6 +218,7 @@ let OAuthService = OAuthService_1 = class OAuthService {
|
|
|
218
218
|
profile,
|
|
219
219
|
userId,
|
|
220
220
|
includeRefreshTokenInBody: true,
|
|
221
|
+
app: webState === null || webState === void 0 ? void 0 : webState.app,
|
|
221
222
|
});
|
|
222
223
|
}));
|
|
223
224
|
const params = new URLSearchParams({ accessToken: tokens.accessToken });
|
|
@@ -240,6 +241,7 @@ let OAuthService = OAuthService_1 = class OAuthService {
|
|
|
240
241
|
profile,
|
|
241
242
|
userId,
|
|
242
243
|
includeRefreshTokenInBody,
|
|
244
|
+
app: webState === null || webState === void 0 ? void 0 : webState.app,
|
|
243
245
|
});
|
|
244
246
|
this.logger.log(`OAuth callback completed: provider=${provider} type=${type} profileEmailPresent=${(profile === null || profile === void 0 ? void 0 : profile.email) ? 'yes' : 'no'} userId=${userId !== null && userId !== void 0 ? userId : 'n/a'}`);
|
|
245
247
|
return result;
|
|
@@ -466,12 +468,12 @@ let OAuthService = OAuthService_1 = class OAuthService {
|
|
|
466
468
|
throw this.mapCallbackError(locale, provider, flow, error);
|
|
467
469
|
}
|
|
468
470
|
}
|
|
469
|
-
async finalizeCallback({ res, locale, ipAddress, userAgent, provider, type, profile, userId, includeRefreshTokenInBody, }) {
|
|
471
|
+
async finalizeCallback({ res, locale, ipAddress, userAgent, provider, type, profile, userId, includeRefreshTokenInBody, app, }) {
|
|
470
472
|
switch (type) {
|
|
471
473
|
case 'login':
|
|
472
474
|
return this.handleLogin(res, locale, ipAddress, userAgent, provider, profile, includeRefreshTokenInBody);
|
|
473
475
|
case 'register':
|
|
474
|
-
return this.handleRegister(res, locale, ipAddress, userAgent, provider, profile, includeRefreshTokenInBody);
|
|
476
|
+
return this.handleRegister(res, locale, ipAddress, userAgent, provider, profile, includeRefreshTokenInBody, app);
|
|
475
477
|
case 'connect':
|
|
476
478
|
return this.handleConnect(res, locale, ipAddress, userAgent, provider, profile, userId, includeRefreshTokenInBody);
|
|
477
479
|
default:
|
|
@@ -561,7 +563,7 @@ let OAuthService = OAuthService_1 = class OAuthService {
|
|
|
561
563
|
return this.formatAuthResponse(accessToken, refreshToken, includeRefreshTokenInBody);
|
|
562
564
|
}
|
|
563
565
|
}
|
|
564
|
-
async handleRegister(res, locale, ipAddress, userAgent, provider, profile, includeRefreshTokenInBody) {
|
|
566
|
+
async handleRegister(res, locale, ipAddress, userAgent, provider, profile, includeRefreshTokenInBody, app) {
|
|
565
567
|
var _a, _b, _c, _d;
|
|
566
568
|
const existingUser = await this.prisma.user_identifier.findFirst({
|
|
567
569
|
where: {
|
|
@@ -616,6 +618,7 @@ let OAuthService = OAuthService_1 = class OAuthService {
|
|
|
616
618
|
email: profile.email,
|
|
617
619
|
slug: 'auth-sign-up',
|
|
618
620
|
variables: { name: profile.name },
|
|
621
|
+
app,
|
|
619
622
|
});
|
|
620
623
|
const pictureURL = ((_c = (_b = profile.picture) === null || _b === void 0 ? void 0 : _b.data) === null || _c === void 0 ? void 0 : _c.url) || profile.picture;
|
|
621
624
|
if (pictureURL) {
|