@hed-hog/core 0.0.386 → 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 +26 -10
- 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 +35 -9
- 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 +27 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +31 -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 +12 -2
- package/dist/integration-profile/integration-profile.secrets.js.map +1 -1
- package/dist/integration-profile/integration-profile.service.d.ts +28 -2
- package/dist/integration-profile/integration-profile.service.d.ts.map +1 -1
- package/dist/integration-profile/integration-profile.service.js +105 -31
- package/dist/integration-profile/integration-profile.service.js.map +1 -1
- package/dist/integration-profile/integration-profile.utils.d.ts +31 -1
- package/dist/integration-profile/integration-profile.utils.d.ts.map +1 -1
- package/dist/integration-profile/integration-profile.utils.js +35 -4
- 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 +24 -17
- 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 +34 -21
- 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/webhook-integration/webhook-integration.controller.d.ts +5 -8
- package/dist/webhook-integration/webhook-integration.controller.d.ts.map +1 -1
- package/dist/webhook-integration/webhook-integration.controller.js +31 -8
- package/dist/webhook-integration/webhook-integration.controller.js.map +1 -1
- package/dist/webhook-integration/webhook-integration.module.d.ts.map +1 -1
- package/dist/webhook-integration/webhook-integration.module.js +5 -0
- package/dist/webhook-integration/webhook-integration.module.js.map +1 -1
- package/dist/webhook-integration/webhook-integration.service.d.ts +33 -1
- package/dist/webhook-integration/webhook-integration.service.d.ts.map +1 -1
- package/dist/webhook-integration/webhook-integration.service.js +109 -4
- package/dist/webhook-integration/webhook-integration.service.js.map +1 -1
- package/dist/webhook-integration/webhook-protocol.registry.d.ts +63 -0
- package/dist/webhook-integration/webhook-protocol.registry.d.ts.map +1 -0
- package/dist/webhook-integration/webhook-protocol.registry.js +51 -0
- package/dist/webhook-integration/webhook-protocol.registry.js.map +1 -0
- 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 +169 -92
- 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 +521 -3
- package/hedhog/frontend/messages/pt.json +521 -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/hedhog/table/webhook_integration.yaml +64 -43
- 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 +33 -6
- package/src/auth/auth.service.spec.ts +3 -1
- package/src/auth/auth.service.ts +103 -37
- 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 +38 -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 +12 -2
- package/src/integration-profile/integration-profile.service.spec.ts +279 -0
- package/src/integration-profile/integration-profile.service.ts +132 -29
- package/src/integration-profile/integration-profile.utils.spec.ts +97 -0
- package/src/integration-profile/integration-profile.utils.ts +79 -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 +52 -36
- package/src/profile/profile.service.ts +143 -41
- 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/webhook-integration/webhook-integration.controller.ts +40 -2
- package/src/webhook-integration/webhook-integration.module.ts +5 -0
- package/src/webhook-integration/webhook-integration.service.ts +133 -0
- package/src/webhook-integration/webhook-protocol.registry.spec.ts +70 -0
- package/src/webhook-integration/webhook-protocol.registry.ts +93 -0
- package/src/whatsapp-sender/whatsapp-sender.module.ts +10 -0
- package/src/whatsapp-sender/whatsapp-sender.service.ts +313 -0
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { afterEach, beforeEach, describe, expect, it, jest } from '@jest/globals';
|
|
2
|
+
import { CAPTCHA_TESTERS } from './captcha.testers';
|
|
3
|
+
import { IntegrationTestContext, IntegrationTester } from './integration-tester.types';
|
|
4
|
+
|
|
5
|
+
const bySlug = (slug: string): IntegrationTester =>
|
|
6
|
+
CAPTCHA_TESTERS.find((tester) => tester.providerSlug === slug)!;
|
|
7
|
+
|
|
8
|
+
const ctx = (): IntegrationTestContext => ({
|
|
9
|
+
signal: AbortSignal.timeout(5_000),
|
|
10
|
+
typeSlug: 'captcha',
|
|
11
|
+
providerSlug: 'test',
|
|
12
|
+
secretValues: [],
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
function siteverify(errorCodes: string[], success = false) {
|
|
16
|
+
return {
|
|
17
|
+
ok: true,
|
|
18
|
+
status: 200,
|
|
19
|
+
text: async () => JSON.stringify({ success, 'error-codes': errorCodes }),
|
|
20
|
+
} as unknown as Response;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
let fetchMock: jest.Mock;
|
|
24
|
+
|
|
25
|
+
beforeEach(() => {
|
|
26
|
+
fetchMock = jest.fn();
|
|
27
|
+
global.fetch = fetchMock as unknown as typeof fetch;
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
afterEach(() => {
|
|
31
|
+
jest.restoreAllMocks();
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
describe.each([
|
|
35
|
+
['recaptcha', 'Invalid reCAPTCHA secret key.'],
|
|
36
|
+
['cloudflare-turnstile', 'Invalid Turnstile secret key.'],
|
|
37
|
+
])('%s tester', (slug, invalidSecretMessage) => {
|
|
38
|
+
const tester = bySlug(slug);
|
|
39
|
+
|
|
40
|
+
it('reprova quando o siteverify recusa o segredo', async () => {
|
|
41
|
+
fetchMock.mockResolvedValue(siteverify(['invalid-input-secret']));
|
|
42
|
+
|
|
43
|
+
const outcome = await tester.test(
|
|
44
|
+
{ site_key: 'site', secret_key: 'wrong' },
|
|
45
|
+
ctx(),
|
|
46
|
+
);
|
|
47
|
+
|
|
48
|
+
expect(outcome).toEqual({ ok: false, error: invalidSecretMessage });
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
it('aprova quando o siteverify aceita o segredo e só reclama do token de teste', async () => {
|
|
52
|
+
fetchMock.mockResolvedValue(
|
|
53
|
+
siteverify(['missing-input-response', 'invalid-input-response']),
|
|
54
|
+
);
|
|
55
|
+
|
|
56
|
+
const outcome = await tester.test(
|
|
57
|
+
{ site_key: 'site', secret_key: 'right' },
|
|
58
|
+
ctx(),
|
|
59
|
+
);
|
|
60
|
+
|
|
61
|
+
expect(outcome.ok).toBe(true);
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
it('reprova sem ir à rede quando falta o segredo', async () => {
|
|
65
|
+
const outcome = await tester.test({ site_key: 'site' }, ctx());
|
|
66
|
+
|
|
67
|
+
expect(outcome.ok).toBe(false);
|
|
68
|
+
expect(fetchMock).not.toHaveBeenCalled();
|
|
69
|
+
});
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
describe('altcha tester', () => {
|
|
73
|
+
const tester = bySlug('altcha');
|
|
74
|
+
|
|
75
|
+
it('valida a chave localmente e avisa que não há verificação remota', async () => {
|
|
76
|
+
const outcome = await tester.test(
|
|
77
|
+
{ hmac_key: 'uma-chave-hmac-suficientemente-longa' },
|
|
78
|
+
ctx(),
|
|
79
|
+
);
|
|
80
|
+
|
|
81
|
+
expect(outcome.ok).toBe(true);
|
|
82
|
+
expect(outcome.warning).toContain('self-hosted');
|
|
83
|
+
expect(fetchMock).not.toHaveBeenCalled();
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
it('reprova uma chave curta demais', async () => {
|
|
87
|
+
const outcome = await tester.test({ hmac_key: 'curta' }, ctx());
|
|
88
|
+
|
|
89
|
+
expect(outcome.ok).toBe(false);
|
|
90
|
+
expect(outcome.error).toContain('too short');
|
|
91
|
+
});
|
|
92
|
+
});
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
import { createHmac } from 'node:crypto';
|
|
2
|
+
import { fail, pass, probeJson, requireFields, str } from './http-probe';
|
|
3
|
+
import { IntegrationTester } from './integration-tester.types';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Testadores dos providers de captcha.
|
|
7
|
+
*
|
|
8
|
+
* Um captcha só é resolvido por um humano no navegador, então não há token válido para
|
|
9
|
+
* enviar aqui. O truque é que ambos os endpoints de `siteverify` validam o SEGREDO antes
|
|
10
|
+
* do token: mandamos um token vazio e lemos qual das duas reclamações voltou.
|
|
11
|
+
*
|
|
12
|
+
* invalid-input-secret → segredo errado → REPROVA
|
|
13
|
+
* invalid-input-response → segredo aceito, faltou só o token (era o esperado) → APROVA
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
const recaptchaTester: IntegrationTester = {
|
|
17
|
+
providerSlug: 'recaptcha',
|
|
18
|
+
test: async (config, ctx) => {
|
|
19
|
+
const missing = requireFields(config, [
|
|
20
|
+
['site_key', 'Site key'],
|
|
21
|
+
['secret_key', 'Secret key'],
|
|
22
|
+
]);
|
|
23
|
+
if (missing) return missing;
|
|
24
|
+
|
|
25
|
+
const result = await probeJson(
|
|
26
|
+
'https://www.google.com/recaptcha/api/siteverify',
|
|
27
|
+
{
|
|
28
|
+
method: 'POST',
|
|
29
|
+
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
|
|
30
|
+
body: new URLSearchParams({
|
|
31
|
+
secret: String(config.secret_key ?? ''),
|
|
32
|
+
response: '',
|
|
33
|
+
}).toString(),
|
|
34
|
+
},
|
|
35
|
+
ctx.signal,
|
|
36
|
+
);
|
|
37
|
+
|
|
38
|
+
const codes: string[] = Array.isArray(result.body?.['error-codes'])
|
|
39
|
+
? result.body['error-codes']
|
|
40
|
+
: [];
|
|
41
|
+
|
|
42
|
+
if (codes.includes('invalid-input-secret')) {
|
|
43
|
+
return fail('Invalid reCAPTCHA secret key.');
|
|
44
|
+
}
|
|
45
|
+
if (codes.includes('missing-input-secret')) {
|
|
46
|
+
return fail('reCAPTCHA secret key is required.');
|
|
47
|
+
}
|
|
48
|
+
if (
|
|
49
|
+
codes.includes('missing-input-response') ||
|
|
50
|
+
codes.includes('invalid-input-response')
|
|
51
|
+
) {
|
|
52
|
+
return pass('Google accepted the reCAPTCHA secret key');
|
|
53
|
+
}
|
|
54
|
+
if (!result.ok) {
|
|
55
|
+
return fail(`Google returned HTTP ${result.status}.`);
|
|
56
|
+
}
|
|
57
|
+
return pass('Google accepted the reCAPTCHA secret key');
|
|
58
|
+
},
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
const turnstileTester: IntegrationTester = {
|
|
62
|
+
providerSlug: 'cloudflare-turnstile',
|
|
63
|
+
test: async (config, ctx) => {
|
|
64
|
+
const missing = requireFields(config, [
|
|
65
|
+
['site_key', 'Site key'],
|
|
66
|
+
['secret_key', 'Secret key'],
|
|
67
|
+
]);
|
|
68
|
+
if (missing) return missing;
|
|
69
|
+
|
|
70
|
+
const result = await probeJson(
|
|
71
|
+
'https://challenges.cloudflare.com/turnstile/v0/siteverify',
|
|
72
|
+
{
|
|
73
|
+
method: 'POST',
|
|
74
|
+
headers: { 'Content-Type': 'application/json' },
|
|
75
|
+
body: JSON.stringify({
|
|
76
|
+
secret: String(config.secret_key ?? ''),
|
|
77
|
+
response: 'hedhog-connection-test',
|
|
78
|
+
}),
|
|
79
|
+
},
|
|
80
|
+
ctx.signal,
|
|
81
|
+
);
|
|
82
|
+
|
|
83
|
+
const codes: string[] = Array.isArray(result.body?.['error-codes'])
|
|
84
|
+
? result.body['error-codes']
|
|
85
|
+
: [];
|
|
86
|
+
|
|
87
|
+
if (codes.includes('invalid-input-secret')) {
|
|
88
|
+
return fail('Invalid Turnstile secret key.');
|
|
89
|
+
}
|
|
90
|
+
if (codes.includes('missing-input-secret')) {
|
|
91
|
+
return fail('Turnstile secret key is required.');
|
|
92
|
+
}
|
|
93
|
+
if (
|
|
94
|
+
codes.includes('invalid-input-response') ||
|
|
95
|
+
codes.includes('missing-input-response')
|
|
96
|
+
) {
|
|
97
|
+
return pass('Cloudflare accepted the Turnstile secret key');
|
|
98
|
+
}
|
|
99
|
+
if (!result.ok) {
|
|
100
|
+
return fail(`Cloudflare returned HTTP ${result.status}.`);
|
|
101
|
+
}
|
|
102
|
+
return pass('Cloudflare accepted the Turnstile secret key');
|
|
103
|
+
},
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
const altchaTester: IntegrationTester = {
|
|
107
|
+
providerSlug: 'altcha',
|
|
108
|
+
test: async (config) => {
|
|
109
|
+
const missing = requireFields(config, [['hmac_key', 'HMAC key']]);
|
|
110
|
+
if (missing) return missing;
|
|
111
|
+
|
|
112
|
+
const hmacKey = String(config.hmac_key ?? '');
|
|
113
|
+
if (hmacKey.length < 16) {
|
|
114
|
+
return fail('The HMAC key is too short — use at least 16 characters.');
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
// Altcha é self-hosted: não existe endpoint remoto para validar a chave. O que dá
|
|
118
|
+
// para provar é que ela gera um desafio assinado, que é o uso dela em produção.
|
|
119
|
+
try {
|
|
120
|
+
const challenge = createHmac('sha256', hmacKey)
|
|
121
|
+
.update('hedhog-connection-test')
|
|
122
|
+
.digest('hex');
|
|
123
|
+
if (!challenge) throw new Error('empty digest');
|
|
124
|
+
} catch {
|
|
125
|
+
return fail('Could not sign a challenge with this HMAC key.');
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
return pass(
|
|
129
|
+
'HMAC key is usable',
|
|
130
|
+
'Altcha is self-hosted: the key was validated locally, with no remote check.',
|
|
131
|
+
);
|
|
132
|
+
},
|
|
133
|
+
};
|
|
134
|
+
|
|
135
|
+
export const CAPTCHA_TESTERS: IntegrationTester[] = [
|
|
136
|
+
recaptchaTester,
|
|
137
|
+
turnstileTester,
|
|
138
|
+
altchaTester,
|
|
139
|
+
];
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
import { verifySesCredentials, verifySmtpConnection } from '@hed-hog/api-mail';
|
|
2
|
+
import {
|
|
3
|
+
describeHttpError,
|
|
4
|
+
fail,
|
|
5
|
+
pass,
|
|
6
|
+
probeJson,
|
|
7
|
+
requireFields,
|
|
8
|
+
str,
|
|
9
|
+
} from './http-probe';
|
|
10
|
+
import { IntegrationTester } from './integration-tester.types';
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Testadores dos providers de e-mail.
|
|
14
|
+
*
|
|
15
|
+
* Todos exigem `from_email`: sem remetente o perfil não envia nada, e essa validação
|
|
16
|
+
* já era o contrato do teste antes de existirem chamadas de rede.
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
const smtpTester: IntegrationTester = {
|
|
20
|
+
providerSlug: 'smtp',
|
|
21
|
+
test: async (config) => {
|
|
22
|
+
const missing = requireFields(config, [
|
|
23
|
+
['host', 'SMTP host'],
|
|
24
|
+
['from_email', 'Sender email'],
|
|
25
|
+
]);
|
|
26
|
+
if (missing) return missing;
|
|
27
|
+
|
|
28
|
+
const result = await verifySmtpConnection({
|
|
29
|
+
host: str(config, 'host'),
|
|
30
|
+
port: Number(config.port ?? 587),
|
|
31
|
+
secure: Boolean(config.secure),
|
|
32
|
+
username: str(config, 'username'),
|
|
33
|
+
password: String(config.password ?? ''),
|
|
34
|
+
timeoutMs: 8_000,
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
return result.ok ? pass(result.info) : fail(result.error!);
|
|
38
|
+
},
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
const sesTester: IntegrationTester = {
|
|
42
|
+
providerSlug: 'ses',
|
|
43
|
+
test: async (config, ctx) => {
|
|
44
|
+
const missing = requireFields(config, [
|
|
45
|
+
['region', 'AWS region'],
|
|
46
|
+
['access_key_id', 'Access key ID'],
|
|
47
|
+
['secret_access_key', 'Secret access key'],
|
|
48
|
+
['from_email', 'Sender email'],
|
|
49
|
+
]);
|
|
50
|
+
if (missing) return missing;
|
|
51
|
+
|
|
52
|
+
const result = await verifySesCredentials({
|
|
53
|
+
region: str(config, 'region'),
|
|
54
|
+
accessKeyId: str(config, 'access_key_id'),
|
|
55
|
+
secretAccessKey: String(config.secret_access_key ?? ''),
|
|
56
|
+
signal: ctx.signal,
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
return result.ok ? pass(result.info) : fail(result.error!);
|
|
60
|
+
},
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
const gmailTester: IntegrationTester = {
|
|
64
|
+
providerSlug: 'gmail',
|
|
65
|
+
test: async (config, ctx) => {
|
|
66
|
+
const missing = requireFields(config, [
|
|
67
|
+
['client_id', 'Client ID'],
|
|
68
|
+
['client_secret', 'Client secret'],
|
|
69
|
+
['refresh_token', 'Refresh token'],
|
|
70
|
+
['from_email', 'Sender email'],
|
|
71
|
+
]);
|
|
72
|
+
if (missing) return missing;
|
|
73
|
+
|
|
74
|
+
// Troca real do refresh token: separa credencial de app errada (invalid_client)
|
|
75
|
+
// de autorização revogada pelo usuário (invalid_grant).
|
|
76
|
+
const result = await probeJson(
|
|
77
|
+
'https://oauth2.googleapis.com/token',
|
|
78
|
+
{
|
|
79
|
+
method: 'POST',
|
|
80
|
+
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
|
|
81
|
+
body: new URLSearchParams({
|
|
82
|
+
client_id: str(config, 'client_id'),
|
|
83
|
+
client_secret: String(config.client_secret ?? ''),
|
|
84
|
+
refresh_token: String(config.refresh_token ?? ''),
|
|
85
|
+
grant_type: 'refresh_token',
|
|
86
|
+
}).toString(),
|
|
87
|
+
},
|
|
88
|
+
ctx.signal,
|
|
89
|
+
);
|
|
90
|
+
|
|
91
|
+
if (result.ok) {
|
|
92
|
+
return pass(`Gmail authorized for ${str(config, 'from_email')}`);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
const code = String(result.body?.error ?? '');
|
|
96
|
+
if (code === 'invalid_client') {
|
|
97
|
+
return fail('Invalid Client ID or Client secret.');
|
|
98
|
+
}
|
|
99
|
+
if (code === 'invalid_grant') {
|
|
100
|
+
return fail(
|
|
101
|
+
'The refresh token is invalid or was revoked. Authorize the account again.',
|
|
102
|
+
);
|
|
103
|
+
}
|
|
104
|
+
return fail(describeHttpError(result, 'Google rejected the credentials.'));
|
|
105
|
+
},
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
const resendTester: IntegrationTester = {
|
|
109
|
+
providerSlug: 'resend',
|
|
110
|
+
test: async (config, ctx) => {
|
|
111
|
+
const missing = requireFields(config, [
|
|
112
|
+
['api_token', 'Resend API token'],
|
|
113
|
+
['domain', 'Resend sending domain'],
|
|
114
|
+
]);
|
|
115
|
+
if (missing) return missing;
|
|
116
|
+
|
|
117
|
+
const domain = str(config, 'domain').toLowerCase();
|
|
118
|
+
const result = await probeJson(
|
|
119
|
+
'https://api.resend.com/domains',
|
|
120
|
+
{ headers: { Authorization: `Bearer ${String(config.api_token ?? '')}` } },
|
|
121
|
+
ctx.signal,
|
|
122
|
+
);
|
|
123
|
+
|
|
124
|
+
if (result.status === 401 || result.status === 403) {
|
|
125
|
+
return fail('Invalid Resend API token.');
|
|
126
|
+
}
|
|
127
|
+
if (!result.ok) {
|
|
128
|
+
return fail(describeHttpError(result, 'Resend rejected the credentials.'));
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
const domains: Array<{ name?: string; status?: string }> = Array.isArray(
|
|
132
|
+
result.body?.data,
|
|
133
|
+
)
|
|
134
|
+
? result.body.data
|
|
135
|
+
: [];
|
|
136
|
+
const match = domains.find(
|
|
137
|
+
(item) => String(item?.name ?? '').toLowerCase() === domain,
|
|
138
|
+
);
|
|
139
|
+
|
|
140
|
+
if (!match) {
|
|
141
|
+
return pass(
|
|
142
|
+
`Resend token is valid (${domains.length} domain(s))`,
|
|
143
|
+
`The domain "${domain}" is not registered in this Resend account.`,
|
|
144
|
+
);
|
|
145
|
+
}
|
|
146
|
+
if (String(match.status ?? '').toLowerCase() !== 'verified') {
|
|
147
|
+
return pass(
|
|
148
|
+
`Resend token is valid — ${domain}`,
|
|
149
|
+
`The domain "${domain}" is not verified yet (status: ${match.status}).`,
|
|
150
|
+
);
|
|
151
|
+
}
|
|
152
|
+
return pass(`Resend — ${domain} (verified)`);
|
|
153
|
+
},
|
|
154
|
+
};
|
|
155
|
+
|
|
156
|
+
export const EMAIL_TESTERS: IntegrationTester[] = [
|
|
157
|
+
smtpTester,
|
|
158
|
+
sesTester,
|
|
159
|
+
gmailTester,
|
|
160
|
+
resendTester,
|
|
161
|
+
];
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
import { describe, expect, it } from '@jest/globals';
|
|
2
|
+
import {
|
|
3
|
+
assertHttpUrl,
|
|
4
|
+
describeHttpError,
|
|
5
|
+
redactSecrets,
|
|
6
|
+
requireFields,
|
|
7
|
+
sanitizeTesterError,
|
|
8
|
+
str,
|
|
9
|
+
} from './http-probe';
|
|
10
|
+
|
|
11
|
+
describe('sanitizeTesterError', () => {
|
|
12
|
+
it('nunca inclui o stack trace, só a mensagem', () => {
|
|
13
|
+
const error = new Error('Something specific went wrong');
|
|
14
|
+
error.stack = 'Error: secret-laden stack\n at somewhere.ts:1:1';
|
|
15
|
+
|
|
16
|
+
const message = sanitizeTesterError(error, []);
|
|
17
|
+
|
|
18
|
+
expect(message).toBe('Something specific went wrong');
|
|
19
|
+
expect(message).not.toContain('at somewhere.ts');
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
it('redige todos os valores de segredo, inclusive quando a API ecoa a entrada', () => {
|
|
23
|
+
const secret = 'sk_live_51H8xVeryLongToken';
|
|
24
|
+
const other = 'another-long-secret';
|
|
25
|
+
const error = new Error(
|
|
26
|
+
`Provider rejected key ${secret} and app secret ${other}.`,
|
|
27
|
+
);
|
|
28
|
+
|
|
29
|
+
const message = sanitizeTesterError(error, [secret, other]);
|
|
30
|
+
|
|
31
|
+
expect(message).not.toContain(secret);
|
|
32
|
+
expect(message).not.toContain(other);
|
|
33
|
+
expect(message).toContain('***');
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
it('ignora segredos curtos demais para não picotar a mensagem inteira', () => {
|
|
37
|
+
const message = sanitizeTesterError(new Error('bad host name'), ['a', 'ho']);
|
|
38
|
+
|
|
39
|
+
expect(message).toBe('bad host name');
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
it('usa um texto próprio para timeout, distinto de credencial inválida', () => {
|
|
43
|
+
const abort = new Error('The operation was aborted');
|
|
44
|
+
abort.name = 'AbortError';
|
|
45
|
+
|
|
46
|
+
const message = sanitizeTesterError(abort, [], 'api.example.com');
|
|
47
|
+
|
|
48
|
+
expect(message).toContain('Timed out');
|
|
49
|
+
expect(message).toContain('api.example.com');
|
|
50
|
+
expect(message).toContain('outbound network access');
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
it('traduz os códigos de rede mais comuns', () => {
|
|
54
|
+
const cases: Array<[string, string]> = [
|
|
55
|
+
['ENOTFOUND', 'Host not found'],
|
|
56
|
+
['ECONNREFUSED', 'Connection refused'],
|
|
57
|
+
['ECONNRESET', 'Connection interrupted'],
|
|
58
|
+
['CERT_HAS_EXPIRED', 'certificate has expired'],
|
|
59
|
+
['DEPTH_ZERO_SELF_SIGNED_CERT', 'could not be verified'],
|
|
60
|
+
];
|
|
61
|
+
|
|
62
|
+
for (const [code, expected] of cases) {
|
|
63
|
+
const error = Object.assign(new Error('raw driver noise'), { code });
|
|
64
|
+
expect(sanitizeTesterError(error, [])).toContain(expected);
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
it('trunca mensagens muito longas', () => {
|
|
69
|
+
const message = sanitizeTesterError(new Error('x'.repeat(1_000)), []);
|
|
70
|
+
|
|
71
|
+
expect(message.length).toBeLessThanOrEqual(300);
|
|
72
|
+
expect(message.endsWith('…')).toBe(true);
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
it('lida com valores que não são Error', () => {
|
|
76
|
+
expect(sanitizeTesterError('plain string failure', [])).toBe(
|
|
77
|
+
'plain string failure',
|
|
78
|
+
);
|
|
79
|
+
expect(sanitizeTesterError(null, [])).toBe('Unexpected error.');
|
|
80
|
+
});
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
describe('redactSecrets', () => {
|
|
84
|
+
it('substitui todas as ocorrências de um mesmo segredo', () => {
|
|
85
|
+
const secret = 'super-secret-token';
|
|
86
|
+
|
|
87
|
+
expect(redactSecrets(`${secret} and ${secret}`, [secret])).toBe('*** and ***');
|
|
88
|
+
});
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
describe('assertHttpUrl', () => {
|
|
92
|
+
it('aceita http e https, incluindo endereços de rede privada', () => {
|
|
93
|
+
expect(assertHttpUrl('https://api.example.com/x', 'Endpoint').host).toBe(
|
|
94
|
+
'api.example.com',
|
|
95
|
+
);
|
|
96
|
+
// k8s e Evolution self-hosted vivem em rede interna: bloqueá-los quebraria o caso de uso.
|
|
97
|
+
expect(assertHttpUrl('https://10.0.0.1:6443', 'API server').port).toBe('6443');
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
it('rejeita esquemas fora de http/https e URLs inválidas', () => {
|
|
101
|
+
expect(() => assertHttpUrl('file:///etc/passwd', 'Endpoint')).toThrow(
|
|
102
|
+
'Endpoint must use http or https.',
|
|
103
|
+
);
|
|
104
|
+
expect(() => assertHttpUrl('não é url', 'Endpoint')).toThrow(
|
|
105
|
+
'Endpoint is not a valid URL.',
|
|
106
|
+
);
|
|
107
|
+
});
|
|
108
|
+
});
|
|
109
|
+
|
|
110
|
+
describe('requireFields', () => {
|
|
111
|
+
it('devolve null quando todos os campos estão preenchidos', () => {
|
|
112
|
+
expect(requireFields({ host: 'h', token: 't' }, [
|
|
113
|
+
['host', 'Host'],
|
|
114
|
+
['token', 'Token'],
|
|
115
|
+
])).toBeNull();
|
|
116
|
+
});
|
|
117
|
+
|
|
118
|
+
it('reprova no primeiro campo vazio, em branco ou ausente', () => {
|
|
119
|
+
expect(requireFields({ host: ' ' }, [['host', 'Host']])).toEqual({
|
|
120
|
+
ok: false,
|
|
121
|
+
error: 'Host is required.',
|
|
122
|
+
});
|
|
123
|
+
expect(requireFields({}, [['token', 'Token']])).toEqual({
|
|
124
|
+
ok: false,
|
|
125
|
+
error: 'Token is required.',
|
|
126
|
+
});
|
|
127
|
+
});
|
|
128
|
+
});
|
|
129
|
+
|
|
130
|
+
describe('str', () => {
|
|
131
|
+
it('normaliza para string trimada, com fallback vazio', () => {
|
|
132
|
+
expect(str({ a: ' x ' }, 'a')).toBe('x');
|
|
133
|
+
expect(str({}, 'a')).toBe('');
|
|
134
|
+
expect(str({ a: 42 }, 'a')).toBe('42');
|
|
135
|
+
});
|
|
136
|
+
});
|
|
137
|
+
|
|
138
|
+
describe('describeHttpError', () => {
|
|
139
|
+
it('encontra a mensagem nos formatos usados pelos provedores', () => {
|
|
140
|
+
const base = { ok: false, status: 400, text: '' };
|
|
141
|
+
|
|
142
|
+
expect(describeHttpError({ ...base, body: { error: { message: 'a' } } }, 'f')).toBe('a');
|
|
143
|
+
expect(describeHttpError({ ...base, body: { error_description: 'b' } }, 'f')).toBe('b');
|
|
144
|
+
expect(describeHttpError({ ...base, body: { message: 'c' } }, 'f')).toBe('c');
|
|
145
|
+
expect(describeHttpError({ ...base, body: { error: 'd' } }, 'f')).toBe('d');
|
|
146
|
+
});
|
|
147
|
+
|
|
148
|
+
it('cai no fallback com o status quando não há mensagem reconhecível', () => {
|
|
149
|
+
expect(
|
|
150
|
+
describeHttpError({ ok: false, status: 503, body: {}, text: '' }, 'Provider down.'),
|
|
151
|
+
).toBe('Provider down. (HTTP 503)');
|
|
152
|
+
});
|
|
153
|
+
});
|