@hed-hog/core 0.0.390 → 0.0.393
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 +39 -0
- package/dist/access-log/access-log.controller.d.ts.map +1 -1
- package/dist/access-log/access-log.controller.js +1 -1
- package/dist/access-log/access-log.controller.js.map +1 -1
- package/dist/access-log/access-log.interceptor.d.ts.map +1 -1
- package/dist/access-log/access-log.interceptor.js +8 -5
- package/dist/access-log/access-log.interceptor.js.map +1 -1
- package/dist/access-log/access-log.service.d.ts +4 -0
- package/dist/access-log/access-log.service.d.ts.map +1 -1
- package/dist/access-log/access-log.service.js +31 -4
- package/dist/access-log/access-log.service.js.map +1 -1
- package/dist/access-log/dto/query-access-log.dto.d.ts +2 -0
- package/dist/access-log/dto/query-access-log.dto.d.ts.map +1 -1
- package/dist/access-log/dto/query-access-log.dto.js +5 -0
- package/dist/access-log/dto/query-access-log.dto.js.map +1 -1
- package/dist/ai/ai.controller.d.ts +12 -8
- package/dist/ai/ai.controller.d.ts.map +1 -1
- package/dist/ai/ai.controller.js +17 -2
- package/dist/ai/ai.controller.js.map +1 -1
- package/dist/ai/ai.module.d.ts.map +1 -1
- package/dist/ai/ai.module.js +3 -2
- package/dist/ai/ai.module.js.map +1 -1
- package/dist/ai/ai.service.d.ts +30 -1
- package/dist/ai/ai.service.d.ts.map +1 -1
- package/dist/ai/ai.service.js +97 -3
- package/dist/ai/ai.service.js.map +1 -1
- package/dist/ai/dto/richtext-edit-html.dto.d.ts +5 -0
- package/dist/ai/dto/richtext-edit-html.dto.d.ts.map +1 -0
- package/dist/ai/dto/richtext-edit-html.dto.js +27 -0
- package/dist/ai/dto/richtext-edit-html.dto.js.map +1 -0
- package/dist/ai/richtext-ai.prompts.d.ts +5 -0
- package/dist/ai/richtext-ai.prompts.d.ts.map +1 -0
- package/dist/ai/richtext-ai.prompts.js +57 -0
- package/dist/ai/richtext-ai.prompts.js.map +1 -0
- package/dist/ai/richtext-ai.service.d.ts +34 -0
- package/dist/ai/richtext-ai.service.d.ts.map +1 -0
- package/dist/ai/richtext-ai.service.js +95 -0
- package/dist/ai/richtext-ai.service.js.map +1 -0
- package/dist/ai-instruction/ai-instruction.controller.d.ts +5 -5
- package/dist/auth/auth.controller.d.ts +66 -7
- package/dist/auth/auth.controller.d.ts.map +1 -1
- package/dist/auth/auth.controller.js +67 -23
- package/dist/auth/auth.controller.js.map +1 -1
- package/dist/auth/auth.module.d.ts.map +1 -1
- package/dist/auth/auth.module.js +2 -0
- package/dist/auth/auth.module.js.map +1 -1
- package/dist/auth/auth.service.d.ts +136 -4
- package/dist/auth/auth.service.d.ts.map +1 -1
- package/dist/auth/auth.service.js +246 -48
- package/dist/auth/auth.service.js.map +1 -1
- package/dist/auth/dto/confirm-email.dto.d.ts +4 -0
- package/dist/auth/dto/confirm-email.dto.d.ts.map +1 -0
- package/dist/auth/dto/confirm-email.dto.js +22 -0
- package/dist/auth/dto/confirm-email.dto.js.map +1 -0
- package/dist/auth/dto/resend-confirmation.dto.d.ts +8 -0
- package/dist/auth/dto/resend-confirmation.dto.d.ts.map +1 -0
- package/dist/auth/dto/resend-confirmation.dto.js +36 -0
- package/dist/auth/dto/resend-confirmation.dto.js.map +1 -0
- package/dist/authorize/authorize.controller.d.ts +1 -1
- package/dist/authorize/authorize.controller.d.ts.map +1 -1
- package/dist/authorize/authorize.controller.js +4 -2
- package/dist/authorize/authorize.controller.js.map +1 -1
- package/dist/authorize/authorize.service.d.ts +7 -0
- package/dist/authorize/authorize.service.d.ts.map +1 -1
- package/dist/authorize/authorize.service.js +1 -1
- package/dist/authorize/authorize.service.js.map +1 -1
- package/dist/challenge/challenge.service.d.ts +18 -5
- package/dist/challenge/challenge.service.d.ts.map +1 -1
- package/dist/challenge/challenge.service.js +50 -3
- package/dist/challenge/challenge.service.js.map +1 -1
- package/dist/core.module.d.ts.map +1 -1
- package/dist/core.module.js +17 -0
- package/dist/core.module.js.map +1 -1
- package/dist/dashboard/dashboard/dashboard.controller.d.ts +6 -6
- package/dist/dashboard/dashboard/dashboard.service.d.ts +6 -6
- package/dist/dashboard/dashboard-component/dashboard-component.controller.d.ts +4 -4
- package/dist/dashboard/dashboard-component/dashboard-component.service.d.ts +4 -4
- package/dist/dashboard/dashboard-component-role/dashboard-component-role.controller.d.ts +1 -1
- package/dist/dashboard/dashboard-component-role/dashboard-component-role.service.d.ts +1 -1
- package/dist/dashboard/dashboard-core/dashboard-core.controller.d.ts +2 -2
- package/dist/dashboard/dashboard-core/dashboard-core.service.d.ts +2 -2
- package/dist/dashboard/dashboard-item/dashboard-item.controller.d.ts +2 -2
- package/dist/dashboard/dashboard-item/dashboard-item.service.d.ts +2 -2
- package/dist/file/file.controller.d.ts +8 -1
- package/dist/file/file.controller.d.ts.map +1 -1
- package/dist/file/file.controller.js +45 -7
- package/dist/file/file.controller.js.map +1 -1
- package/dist/file/file.service.d.ts +128 -1
- package/dist/file/file.service.d.ts.map +1 -1
- package/dist/file/file.service.js +319 -8
- package/dist/file/file.service.js.map +1 -1
- package/dist/file/image-optimization.service.d.ts +43 -0
- package/dist/file/image-optimization.service.d.ts.map +1 -1
- package/dist/file/image-optimization.service.js +154 -0
- package/dist/file/image-optimization.service.js.map +1 -1
- package/dist/file/provider/abstract.provider.d.ts +16 -0
- package/dist/file/provider/abstract.provider.d.ts.map +1 -1
- package/dist/file/provider/abstract.provider.js +4 -0
- package/dist/file/provider/abstract.provider.js.map +1 -1
- package/dist/file/provider/gcs.provider.d.ts +2 -0
- package/dist/file/provider/gcs.provider.d.ts.map +1 -1
- package/dist/file/provider/gcs.provider.js +10 -0
- package/dist/file/provider/gcs.provider.js.map +1 -1
- package/dist/file/provider/local.provider.d.ts +1 -0
- package/dist/file/provider/local.provider.d.ts.map +1 -1
- package/dist/file/provider/local.provider.js +13 -0
- package/dist/file/provider/local.provider.js.map +1 -1
- package/dist/file/provider/s3.provider.d.ts +5 -0
- package/dist/file/provider/s3.provider.d.ts.map +1 -1
- package/dist/file/provider/s3.provider.js +15 -0
- package/dist/file/provider/s3.provider.js.map +1 -1
- package/dist/file/provider/spaces.provider.d.ts +5 -0
- package/dist/file/provider/spaces.provider.d.ts.map +1 -1
- package/dist/file/provider/spaces.provider.js +16 -0
- package/dist/file/provider/spaces.provider.js.map +1 -1
- package/dist/impersonation/dto/redeem-impersonation.dto.d.ts +4 -0
- package/dist/impersonation/dto/redeem-impersonation.dto.d.ts.map +1 -0
- package/dist/impersonation/dto/redeem-impersonation.dto.js +23 -0
- package/dist/impersonation/dto/redeem-impersonation.dto.js.map +1 -0
- package/dist/impersonation/dto/start-impersonation.dto.d.ts +7 -0
- package/dist/impersonation/dto/start-impersonation.dto.d.ts.map +1 -0
- package/dist/impersonation/dto/start-impersonation.dto.js +27 -0
- package/dist/impersonation/dto/start-impersonation.dto.js.map +1 -0
- package/dist/impersonation/impersonation-restrictions.d.ts +26 -0
- package/dist/impersonation/impersonation-restrictions.d.ts.map +1 -0
- package/dist/impersonation/impersonation-restrictions.js +76 -0
- package/dist/impersonation/impersonation-restrictions.js.map +1 -0
- package/dist/impersonation/impersonation.controller.d.ts +90 -0
- package/dist/impersonation/impersonation.controller.d.ts.map +1 -0
- package/dist/impersonation/impersonation.controller.js +135 -0
- package/dist/impersonation/impersonation.controller.js.map +1 -0
- package/dist/impersonation/impersonation.module.d.ts +8 -0
- package/dist/impersonation/impersonation.module.d.ts.map +1 -0
- package/dist/impersonation/impersonation.module.js +44 -0
- package/dist/impersonation/impersonation.module.js.map +1 -0
- package/dist/impersonation/impersonation.service.d.ts +164 -0
- package/dist/impersonation/impersonation.service.d.ts.map +1 -0
- package/dist/impersonation/impersonation.service.js +408 -0
- package/dist/impersonation/impersonation.service.js.map +1 -0
- package/dist/index.d.ts +17 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +19 -0
- package/dist/index.js.map +1 -1
- package/dist/integration/services/outbox-polling.coordinator.d.ts +2 -0
- package/dist/integration/services/outbox-polling.coordinator.d.ts.map +1 -1
- package/dist/integration/services/outbox-polling.coordinator.js +50 -30
- package/dist/integration/services/outbox-polling.coordinator.js.map +1 -1
- package/dist/integration/services/outbox.service.d.ts.map +1 -1
- package/dist/integration/services/outbox.service.js +5 -1
- package/dist/integration/services/outbox.service.js.map +1 -1
- package/dist/integration-profile/integration-profile.secrets.d.ts.map +1 -1
- package/dist/integration-profile/integration-profile.secrets.js +3 -0
- package/dist/integration-profile/integration-profile.secrets.js.map +1 -1
- package/dist/integration-profile/integration-profile.utils.d.ts +14 -0
- package/dist/integration-profile/integration-profile.utils.d.ts.map +1 -1
- package/dist/integration-profile/integration-profile.utils.js +26 -0
- package/dist/integration-profile/integration-profile.utils.js.map +1 -1
- package/dist/integration-profile/testers/email.testers.d.ts.map +1 -1
- package/dist/integration-profile/testers/email.testers.js +28 -0
- package/dist/integration-profile/testers/email.testers.js.map +1 -1
- package/dist/language/en.json +11 -0
- package/dist/language/pt.json +11 -0
- package/dist/mail/dto/send.dto.d.ts +38 -1
- 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 +1 -0
- package/dist/mail/mail.controller.d.ts.map +1 -1
- package/dist/mail/mail.module.d.ts.map +1 -1
- package/dist/mail/mail.module.js +2 -0
- package/dist/mail/mail.module.js.map +1 -1
- package/dist/mail/mail.service.d.ts +48 -4
- package/dist/mail/mail.service.d.ts.map +1 -1
- package/dist/mail/mail.service.js +187 -35
- package/dist/mail/mail.service.js.map +1 -1
- package/dist/mail-delivery/mail-delivery-provision.service.d.ts +21 -0
- package/dist/mail-delivery/mail-delivery-provision.service.d.ts.map +1 -0
- package/dist/mail-delivery/mail-delivery-provision.service.js +64 -0
- package/dist/mail-delivery/mail-delivery-provision.service.js.map +1 -0
- package/dist/mail-delivery/mail-delivery.constants.d.ts +17 -0
- package/dist/mail-delivery/mail-delivery.constants.d.ts.map +1 -0
- package/dist/mail-delivery/mail-delivery.constants.js +31 -0
- package/dist/mail-delivery/mail-delivery.constants.js.map +1 -0
- package/dist/mail-delivery/mail-delivery.controller.d.ts +19 -0
- package/dist/mail-delivery/mail-delivery.controller.d.ts.map +1 -0
- package/dist/mail-delivery/mail-delivery.controller.js +53 -0
- package/dist/mail-delivery/mail-delivery.controller.js.map +1 -0
- package/dist/mail-delivery/mail-delivery.module.d.ts +7 -0
- package/dist/mail-delivery/mail-delivery.module.d.ts.map +1 -0
- package/dist/mail-delivery/mail-delivery.module.js +36 -0
- package/dist/mail-delivery/mail-delivery.module.js.map +1 -0
- package/dist/mail-delivery/mail-delivery.service.d.ts +38 -0
- package/dist/mail-delivery/mail-delivery.service.d.ts.map +1 -0
- package/dist/mail-delivery/mail-delivery.service.js +140 -0
- package/dist/mail-delivery/mail-delivery.service.js.map +1 -0
- package/dist/mail-delivery/ses-event.parser.d.ts +27 -0
- package/dist/mail-delivery/ses-event.parser.d.ts.map +1 -0
- package/dist/mail-delivery/ses-event.parser.js +131 -0
- package/dist/mail-delivery/ses-event.parser.js.map +1 -0
- package/dist/mail-delivery/ses-webhook.service.d.ts +58 -0
- package/dist/mail-delivery/ses-webhook.service.d.ts.map +1 -0
- package/dist/mail-delivery/ses-webhook.service.js +214 -0
- package/dist/mail-delivery/ses-webhook.service.js.map +1 -0
- package/dist/mail-delivery/sns-message.util.d.ts +38 -0
- package/dist/mail-delivery/sns-message.util.d.ts.map +1 -0
- package/dist/mail-delivery/sns-message.util.js +109 -0
- package/dist/mail-delivery/sns-message.util.js.map +1 -0
- package/dist/mail-sent/dto/query-mail-sent-list.dto.d.ts +5 -0
- package/dist/mail-sent/dto/query-mail-sent-list.dto.d.ts.map +1 -1
- package/dist/mail-sent/dto/query-mail-sent-list.dto.js +6 -0
- package/dist/mail-sent/dto/query-mail-sent-list.dto.js.map +1 -1
- package/dist/mail-sent/mail-sent.controller.d.ts +39 -0
- package/dist/mail-sent/mail-sent.controller.d.ts.map +1 -1
- package/dist/mail-sent/mail-sent.service.d.ts +39 -0
- package/dist/mail-sent/mail-sent.service.d.ts.map +1 -1
- package/dist/mail-sent/mail-sent.service.js +45 -4
- package/dist/mail-sent/mail-sent.service.js.map +1 -1
- package/dist/mailbox/mailbox-fetcher.registry.d.ts +100 -0
- package/dist/mailbox/mailbox-fetcher.registry.d.ts.map +1 -0
- package/dist/mailbox/mailbox-fetcher.registry.js +59 -0
- package/dist/mailbox/mailbox-fetcher.registry.js.map +1 -0
- package/dist/mailbox/mailbox.module.d.ts +8 -0
- package/dist/mailbox/mailbox.module.d.ts.map +1 -0
- package/dist/mailbox/mailbox.module.js +27 -0
- package/dist/mailbox/mailbox.module.js.map +1 -0
- package/dist/meeting/meeting-provider.registry.d.ts +155 -0
- package/dist/meeting/meeting-provider.registry.d.ts.map +1 -0
- package/dist/meeting/meeting-provider.registry.js +53 -0
- package/dist/meeting/meeting-provider.registry.js.map +1 -0
- package/dist/meeting/meeting.constants.d.ts +47 -0
- package/dist/meeting/meeting.constants.d.ts.map +1 -0
- package/dist/meeting/meeting.constants.js +21 -0
- package/dist/meeting/meeting.constants.js.map +1 -0
- package/dist/meeting/meeting.module.d.ts +7 -0
- package/dist/meeting/meeting.module.d.ts.map +1 -0
- package/dist/meeting/meeting.module.js +26 -0
- package/dist/meeting/meeting.module.js.map +1 -0
- package/dist/middlewares/locale-injection.middleware.d.ts +12 -0
- package/dist/middlewares/locale-injection.middleware.d.ts.map +1 -1
- package/dist/middlewares/locale-injection.middleware.js +20 -4
- package/dist/middlewares/locale-injection.middleware.js.map +1 -1
- package/dist/oauth/providers/google.provider.d.ts +7 -0
- package/dist/oauth/providers/google.provider.d.ts.map +1 -1
- package/dist/oauth/providers/google.provider.js +43 -13
- package/dist/oauth/providers/google.provider.js.map +1 -1
- package/dist/observability/monitored-cron.d.ts +34 -0
- package/dist/observability/monitored-cron.d.ts.map +1 -0
- package/dist/observability/monitored-cron.js +118 -0
- package/dist/observability/monitored-cron.js.map +1 -0
- package/dist/pairing/dto/approve-reverse-pairing.dto.d.ts +12 -0
- package/dist/pairing/dto/approve-reverse-pairing.dto.d.ts.map +1 -0
- package/dist/pairing/dto/approve-reverse-pairing.dto.js +30 -0
- package/dist/pairing/dto/approve-reverse-pairing.dto.js.map +1 -0
- package/dist/pairing/dto/claim-pairing.dto.d.ts +11 -0
- package/dist/pairing/dto/claim-pairing.dto.d.ts.map +1 -0
- package/dist/pairing/dto/claim-pairing.dto.js +35 -0
- package/dist/pairing/dto/claim-pairing.dto.js.map +1 -0
- package/dist/pairing/dto/confirm-pairing.dto.d.ts +10 -0
- package/dist/pairing/dto/confirm-pairing.dto.d.ts.map +1 -0
- package/dist/pairing/dto/confirm-pairing.dto.js +24 -0
- package/dist/pairing/dto/confirm-pairing.dto.js.map +1 -0
- package/dist/pairing/dto/poll-reverse-pairing.dto.d.ts +5 -0
- package/dist/pairing/dto/poll-reverse-pairing.dto.d.ts.map +1 -0
- package/dist/pairing/dto/poll-reverse-pairing.dto.js +24 -0
- package/dist/pairing/dto/poll-reverse-pairing.dto.js.map +1 -0
- package/dist/pairing/dto/start-pairing.dto.d.ts +11 -0
- package/dist/pairing/dto/start-pairing.dto.d.ts.map +1 -0
- package/dist/pairing/dto/start-pairing.dto.js +30 -0
- package/dist/pairing/dto/start-pairing.dto.js.map +1 -0
- package/dist/pairing/dto/start-reverse-pairing.dto.d.ts +24 -0
- package/dist/pairing/dto/start-reverse-pairing.dto.d.ts.map +1 -0
- package/dist/pairing/dto/start-reverse-pairing.dto.js +47 -0
- package/dist/pairing/dto/start-reverse-pairing.dto.js.map +1 -0
- package/dist/pairing/pairing.controller.d.ts +118 -0
- package/dist/pairing/pairing.controller.d.ts.map +1 -0
- package/dist/pairing/pairing.controller.js +296 -0
- package/dist/pairing/pairing.controller.js.map +1 -0
- package/dist/pairing/pairing.module.d.ts +10 -0
- package/dist/pairing/pairing.module.d.ts.map +1 -0
- package/dist/pairing/pairing.module.js +40 -0
- package/dist/pairing/pairing.module.js.map +1 -0
- package/dist/pairing/pairing.service.d.ts +238 -0
- package/dist/pairing/pairing.service.d.ts.map +1 -0
- package/dist/pairing/pairing.service.js +495 -0
- package/dist/pairing/pairing.service.js.map +1 -0
- package/dist/pdf/pdf.service.d.ts +3 -6
- package/dist/pdf/pdf.service.d.ts.map +1 -1
- package/dist/pdf/pdf.service.js +8 -20
- package/dist/pdf/pdf.service.js.map +1 -1
- package/dist/profile/profile.controller.d.ts +11 -0
- package/dist/profile/profile.controller.d.ts.map +1 -1
- package/dist/profile/profile.service.d.ts +11 -0
- package/dist/profile/profile.service.d.ts.map +1 -1
- package/dist/profile/profile.service.js +20 -11
- package/dist/profile/profile.service.js.map +1 -1
- package/dist/redis/redis-pubsub.d.ts.map +1 -1
- package/dist/redis/redis-pubsub.js +44 -0
- package/dist/redis/redis-pubsub.js.map +1 -1
- package/dist/role/guards/role.guard.d.ts +5 -0
- package/dist/role/guards/role.guard.d.ts.map +1 -1
- package/dist/role/guards/role.guard.js +41 -39
- package/dist/role/guards/role.guard.js.map +1 -1
- package/dist/session/session.controller.d.ts +2 -0
- package/dist/session/session.controller.d.ts.map +1 -1
- package/dist/session/session.service.d.ts +39 -0
- package/dist/session/session.service.d.ts.map +1 -1
- package/dist/session/session.service.js +91 -8
- package/dist/session/session.service.js.map +1 -1
- package/dist/setting/brand-asset.service.d.ts +48 -0
- package/dist/setting/brand-asset.service.d.ts.map +1 -0
- package/dist/setting/brand-asset.service.js +130 -0
- package/dist/setting/brand-asset.service.js.map +1 -0
- package/dist/setting/setting.module.d.ts.map +1 -1
- package/dist/setting/setting.module.js +3 -2
- package/dist/setting/setting.module.js.map +1 -1
- package/dist/setting/setting.service.d.ts +33 -0
- package/dist/setting/setting.service.d.ts.map +1 -1
- package/dist/setting/setting.service.js +88 -0
- package/dist/setting/setting.service.js.map +1 -1
- package/dist/token/token.service.d.ts +23 -2
- package/dist/token/token.service.d.ts.map +1 -1
- package/dist/token/token.service.js +39 -4
- package/dist/token/token.service.js.map +1 -1
- package/dist/user/user.controller.d.ts +8 -22
- package/dist/user/user.controller.d.ts.map +1 -1
- package/dist/user/user.service.d.ts +44 -24
- package/dist/user/user.service.d.ts.map +1 -1
- package/dist/user/user.service.js +89 -6
- package/dist/user/user.service.js.map +1 -1
- package/dist/user-device/user-device.controller.d.ts +54 -0
- package/dist/user-device/user-device.controller.d.ts.map +1 -0
- package/dist/user-device/user-device.controller.js +103 -0
- package/dist/user-device/user-device.controller.js.map +1 -0
- package/dist/user-device/user-device.module.d.ts +3 -0
- package/dist/user-device/user-device.module.d.ts.map +1 -0
- package/dist/user-device/user-device.module.js +26 -0
- package/dist/user-device/user-device.module.js.map +1 -0
- package/dist/user-device/user-device.service.d.ts +71 -0
- package/dist/user-device/user-device.service.d.ts.map +1 -0
- package/dist/user-device/user-device.service.js +158 -0
- package/dist/user-device/user-device.service.js.map +1 -0
- package/dist/utils/device-key.d.ts +23 -0
- package/dist/utils/device-key.d.ts.map +1 -0
- package/dist/utils/device-key.js +31 -0
- package/dist/utils/device-key.js.map +1 -0
- package/dist/utils/geo-ip.d.ts +38 -0
- package/dist/utils/geo-ip.d.ts.map +1 -0
- package/dist/utils/geo-ip.js +122 -0
- package/dist/utils/geo-ip.js.map +1 -0
- package/dist/utils/locale-context.d.ts +10 -7
- package/dist/utils/locale-context.d.ts.map +1 -1
- package/dist/utils/locale-context.js +14 -8
- package/dist/utils/locale-context.js.map +1 -1
- package/dist/utils/security-event-vars.d.ts +56 -0
- package/dist/utils/security-event-vars.d.ts.map +1 -0
- package/dist/utils/security-event-vars.js +109 -0
- package/dist/utils/security-event-vars.js.map +1 -0
- package/dist/utils/user-agent.d.ts +19 -0
- package/dist/utils/user-agent.d.ts.map +1 -0
- package/dist/utils/user-agent.js +36 -0
- package/dist/utils/user-agent.js.map +1 -0
- package/dist/webhook-integration/webhook-integration.service.d.ts +5 -0
- package/dist/webhook-integration/webhook-integration.service.d.ts.map +1 -1
- package/dist/webhook-integration/webhook-integration.service.js +50 -4
- package/dist/webhook-integration/webhook-integration.service.js.map +1 -1
- package/dist/webhook-integration/webhook-protocol.registry.d.ts +6 -0
- package/dist/webhook-integration/webhook-protocol.registry.d.ts.map +1 -1
- package/dist/webhook-integration/webhook-protocol.registry.js.map +1 -1
- package/hedhog/data/integration_provider.yaml +9 -0
- package/hedhog/data/mail.yaml +198 -62
- package/hedhog/data/mail_layout.yaml +43 -33
- package/hedhog/data/menu.yaml +2 -0
- package/hedhog/data/role.yaml +16 -0
- package/hedhog/data/route.yaml +172 -3
- package/hedhog/data/setting_group.yaml +178 -2
- package/hedhog/data/setting_subgroup.yaml +8 -0
- package/hedhog/frontend/app/_lib/hooks/use-core-access.test.tsx.ejs +125 -0
- package/hedhog/frontend/app/_lib/hooks/use-core-access.ts.ejs +29 -0
- package/hedhog/frontend/app/_lib/hooks/use-impersonation-access.test.ts.ejs +71 -0
- package/hedhog/frontend/app/_lib/hooks/use-impersonation-access.ts.ejs +32 -0
- package/hedhog/frontend/app/access-log/page.tsx.ejs +96 -22
- package/hedhog/frontend/app/account/components/active-sessions.tsx.ejs +17 -1
- package/hedhog/frontend/app/account/components/known-devices.tsx.ejs +89 -0
- package/hedhog/frontend/app/account/components/profile-form.tsx.ejs +2 -1
- package/hedhog/frontend/app/account/components/user-devices-list.tsx.ejs +186 -0
- package/hedhog/frontend/app/account/devices/page.tsx.ejs +5 -0
- package/hedhog/frontend/app/account/layout.tsx.ejs +2 -0
- package/hedhog/frontend/app/configurations/[slug]/components/setting-field.test.tsx.ejs +298 -0
- package/hedhog/frontend/app/configurations/[slug]/components/setting-field.tsx.ejs +376 -1236
- package/hedhog/frontend/app/mail/log/page.tsx.ejs +210 -3
- package/hedhog/frontend/app/mail/template/page.tsx.ejs +190 -132
- package/hedhog/frontend/app/users/active-session.tsx.ejs +58 -11
- package/hedhog/frontend/app/users/page.tsx.ejs +69 -10
- package/hedhog/frontend/app/users/simulate-access-dialog.test.tsx.ejs +202 -0
- package/hedhog/frontend/app/users/simulate-access-dialog.tsx.ejs +170 -0
- package/hedhog/frontend/app/users/user-activity-timeline.tsx.ejs +19 -0
- package/hedhog/frontend/app/users/user-devices.tsx.ejs +89 -0
- package/hedhog/frontend/app/users/user-logs.tsx.ejs +13 -1
- package/hedhog/frontend/app/users/user-sheet.tsx.ejs +46 -24
- package/hedhog/frontend/messages/en.json +146 -48
- package/hedhog/frontend/messages/pt.json +146 -48
- package/hedhog/table/access_log.yaml +7 -0
- package/hedhog/table/file.yaml +8 -0
- package/hedhog/table/mail_delivery_event.yaml +76 -0
- package/hedhog/table/mail_sent.yaml +23 -0
- package/hedhog/table/user_activity.yaml +9 -0
- package/hedhog/table/user_device.yaml +52 -0
- package/hedhog/table/user_session.yaml +20 -1
- package/package.json +6 -5
- package/src/access-log/access-log.controller.ts +1 -0
- package/src/access-log/access-log.interceptor.ts +5 -1
- package/src/access-log/access-log.service.spec.ts +33 -2
- package/src/access-log/access-log.service.ts +38 -0
- package/src/access-log/dto/query-access-log.dto.ts +5 -0
- package/src/ai/ai.controller.ts +9 -0
- package/src/ai/ai.module.ts +3 -2
- package/src/ai/ai.service.ts +150 -13
- package/src/ai/dto/richtext-edit-html.dto.ts +11 -0
- package/src/ai/richtext-ai.prompts.ts +57 -0
- package/src/ai/richtext-ai.service.ts +109 -0
- package/src/auth/auth.controller.ts +47 -8
- package/src/auth/auth.module.ts +2 -0
- package/src/auth/auth.service.spec.ts +383 -6
- package/src/auth/auth.service.ts +345 -56
- package/src/auth/dto/confirm-email.dto.ts +7 -0
- package/src/auth/dto/resend-confirmation.dto.ts +20 -0
- package/src/authorize/authorize.controller.ts +2 -0
- package/src/authorize/authorize.service.spec.ts +23 -0
- package/src/authorize/authorize.service.ts +8 -0
- package/src/challenge/challenge.service.spec.ts +73 -0
- package/src/challenge/challenge.service.ts +62 -3
- package/src/core.module.ts +19 -0
- package/src/file/file.controller.ts +54 -4
- package/src/file/file.service.spec.ts +275 -105
- package/src/file/file.service.ts +409 -14
- package/src/file/image-optimization.service.spec.ts +92 -0
- package/src/file/image-optimization.service.ts +202 -0
- package/src/file/provider/abstract.provider.ts +23 -0
- package/src/file/provider/gcs.provider.ts +17 -0
- package/src/file/provider/local.provider.ts +21 -0
- package/src/file/provider/s3.provider.ts +25 -0
- package/src/file/provider/spaces.provider.ts +26 -0
- package/src/impersonation/dto/redeem-impersonation.dto.ts +8 -0
- package/src/impersonation/dto/start-impersonation.dto.ts +13 -0
- package/src/impersonation/impersonation-restrictions.ts +84 -0
- package/src/impersonation/impersonation.controller.ts +109 -0
- package/src/impersonation/impersonation.module.ts +31 -0
- package/src/impersonation/impersonation.service.spec.ts +427 -0
- package/src/impersonation/impersonation.service.ts +577 -0
- package/src/index.ts +21 -0
- package/src/integration/services/outbox-polling.coordinator.spec.ts +90 -0
- package/src/integration/services/outbox-polling.coordinator.ts +62 -40
- package/src/integration/services/outbox.service.spec.ts +8 -0
- package/src/integration/services/outbox.service.ts +19 -13
- package/src/integration-profile/integration-profile.secrets.ts +3 -0
- package/src/integration-profile/integration-profile.utils.ts +38 -0
- package/src/integration-profile/testers/email.testers.ts +34 -1
- package/src/language/en.json +11 -0
- package/src/language/pt.json +11 -0
- package/src/mail/dto/send.dto.ts +46 -2
- package/src/mail/mail-template.spec.ts +79 -2
- package/src/mail/mail.module.ts +2 -0
- package/src/mail/mail.service.spec.ts +307 -6
- package/src/mail/mail.service.ts +227 -30
- package/src/mail-delivery/mail-delivery-provision.service.ts +66 -0
- package/src/mail-delivery/mail-delivery.constants.ts +31 -0
- package/src/mail-delivery/mail-delivery.controller.ts +38 -0
- package/src/mail-delivery/mail-delivery.module.ts +23 -0
- package/src/mail-delivery/mail-delivery.service.spec.ts +136 -0
- package/src/mail-delivery/mail-delivery.service.ts +152 -0
- package/src/mail-delivery/ses-event.parser.spec.ts +140 -0
- package/src/mail-delivery/ses-event.parser.ts +191 -0
- package/src/mail-delivery/ses-webhook.service.spec.ts +170 -0
- package/src/mail-delivery/ses-webhook.service.ts +240 -0
- package/src/mail-delivery/sns-message.util.spec.ts +163 -0
- package/src/mail-delivery/sns-message.util.ts +125 -0
- package/src/mail-sent/dto/query-mail-sent-list.dto.ts +15 -0
- package/src/mail-sent/mail-sent.service.ts +46 -2
- package/src/mailbox/mailbox-fetcher.registry.ts +132 -0
- package/src/mailbox/mailbox.module.ts +14 -0
- package/src/meeting/meeting-provider.registry.ts +193 -0
- package/src/meeting/meeting.constants.ts +53 -0
- package/src/meeting/meeting.module.ts +13 -0
- package/src/middlewares/locale-injection.middleware.ts +25 -6
- package/src/oauth/providers/google.provider.ts +49 -15
- package/src/observability/monitored-cron.spec.ts +102 -0
- package/src/observability/monitored-cron.ts +110 -0
- package/src/pairing/dto/approve-reverse-pairing.dto.ts +20 -0
- package/src/pairing/dto/claim-pairing.dto.ts +19 -0
- package/src/pairing/dto/confirm-pairing.dto.ts +14 -0
- package/src/pairing/dto/poll-reverse-pairing.dto.ts +9 -0
- package/src/pairing/dto/start-pairing.dto.ts +19 -0
- package/src/pairing/dto/start-reverse-pairing.dto.ts +45 -0
- package/src/pairing/pairing.controller.ts +246 -0
- package/src/pairing/pairing.module.ts +27 -0
- package/src/pairing/pairing.service.spec.ts +462 -0
- package/src/pairing/pairing.service.ts +614 -0
- package/src/pdf/pdf.service.ts +6 -24
- package/src/profile/profile.service.ts +26 -8
- package/src/redis/redis-pubsub.ts +11 -0
- package/src/role/guards/role.guard.spec.ts +75 -0
- package/src/role/guards/role.guard.ts +64 -46
- package/src/session/session.service.spec.ts +81 -0
- package/src/session/session.service.ts +93 -6
- package/src/setting/brand-asset.service.ts +137 -0
- package/src/setting/setting.module.ts +3 -2
- package/src/setting/setting.service.spec.ts +79 -1
- package/src/setting/setting.service.ts +109 -1
- package/src/token/token.service.spec.ts +62 -0
- package/src/token/token.service.ts +57 -3
- package/src/user/user.service.spec.ts +33 -2
- package/src/user/user.service.ts +108 -6
- package/src/user-device/user-device.controller.ts +77 -0
- package/src/user-device/user-device.module.ts +13 -0
- package/src/user-device/user-device.service.spec.ts +234 -0
- package/src/user-device/user-device.service.ts +168 -0
- package/src/utils/device-key.spec.ts +57 -0
- package/src/utils/device-key.ts +32 -0
- package/src/utils/geo-ip.spec.ts +134 -0
- package/src/utils/geo-ip.ts +93 -0
- package/src/utils/locale-context.spec.ts +27 -1
- package/src/utils/locale-context.ts +15 -12
- package/src/utils/security-event-vars.spec.ts +161 -0
- package/src/utils/security-event-vars.ts +153 -0
- package/src/utils/user-agent.spec.ts +37 -0
- package/src/utils/user-agent.ts +46 -0
- package/src/webhook-integration/webhook-integration.service.ts +57 -3
- package/src/webhook-integration/webhook-protocol.registry.ts +6 -0
|
@@ -23,14 +23,32 @@ const makeDeps = () => {
|
|
|
23
23
|
createMany: jest.fn(),
|
|
24
24
|
findMany: jest.fn(),
|
|
25
25
|
},
|
|
26
|
-
locale: { findMany: jest.fn() },
|
|
26
|
+
locale: { findMany: jest.fn(), findUnique: jest.fn() },
|
|
27
|
+
user_identifier: { findFirst: jest.fn(async () => null) },
|
|
28
|
+
};
|
|
29
|
+
const mailMainService = {
|
|
30
|
+
send: jest.fn(),
|
|
31
|
+
setConfig: jest.fn(),
|
|
32
|
+
getBrandName: jest.fn(async () => 'HedHog'),
|
|
33
|
+
invalidateLayoutCache: jest.fn(),
|
|
27
34
|
};
|
|
28
|
-
const mailMainService = { send: jest.fn(), setConfig: jest.fn() };
|
|
29
35
|
const localeService = {};
|
|
30
|
-
const setting = {
|
|
36
|
+
const setting = {
|
|
37
|
+
getSettingValues: jest.fn(),
|
|
38
|
+
setValue: jest.fn(),
|
|
39
|
+
getUserSettingValue: jest.fn(async () => null),
|
|
40
|
+
getSettingListValues: jest.fn(async () => ['en', 'pt']),
|
|
41
|
+
// A cadeia de precedencia em si é testada em setting.service.spec.ts.
|
|
42
|
+
resolveUserLocale: jest.fn(async () => 'en'),
|
|
43
|
+
};
|
|
31
44
|
const integrationApi = { subscribe: jest.fn() };
|
|
32
45
|
const incident = { record: jest.fn(), persist: jest.fn() };
|
|
33
|
-
|
|
46
|
+
const brandAsset = {
|
|
47
|
+
resolveAssetUrl: jest.fn(async (value: string) =>
|
|
48
|
+
value?.startsWith('/') ? `https://hub.hcode.com.br${value}` : value,
|
|
49
|
+
),
|
|
50
|
+
};
|
|
51
|
+
return { prismaService, mailMainService, localeService, setting, integrationApi, incident, brandAsset };
|
|
34
52
|
};
|
|
35
53
|
|
|
36
54
|
const makeService = (deps = makeDeps()) => ({
|
|
@@ -41,6 +59,7 @@ const makeService = (deps = makeDeps()) => ({
|
|
|
41
59
|
deps.setting as any,
|
|
42
60
|
deps.integrationApi as any,
|
|
43
61
|
deps.incident as any,
|
|
62
|
+
deps.brandAsset as any,
|
|
44
63
|
),
|
|
45
64
|
deps,
|
|
46
65
|
});
|
|
@@ -242,7 +261,10 @@ describe('MailService', () => {
|
|
|
242
261
|
});
|
|
243
262
|
|
|
244
263
|
describe('sendTemplatedMail', () => {
|
|
245
|
-
|
|
264
|
+
// Continua sem lançar (há call sites sem await que quebrariam), mas o
|
|
265
|
+
// retorno agora diz que nada saiu: era isso que faltava para a fila do SAC
|
|
266
|
+
// distinguir enviado de engolido.
|
|
267
|
+
it('não lança quando mail não configurado, e devolve sent=false', async () => {
|
|
246
268
|
const { service, deps } = makeService();
|
|
247
269
|
deps.setting.getSettingValues.mockResolvedValue({
|
|
248
270
|
'configured-mail': 'false',
|
|
@@ -253,9 +275,268 @@ describe('MailService', () => {
|
|
|
253
275
|
slug: 's',
|
|
254
276
|
variables: {},
|
|
255
277
|
} as any),
|
|
256
|
-
).resolves.
|
|
278
|
+
).resolves.toEqual({ sent: false, reason: 'mail-not-configured' });
|
|
279
|
+
expect(deps.mailMainService.send).not.toHaveBeenCalled();
|
|
280
|
+
});
|
|
281
|
+
|
|
282
|
+
it('devolve sent=false quando o provedor falha, sem propagar a exceção', async () => {
|
|
283
|
+
const { service, deps } = makeService();
|
|
284
|
+
deps.setting.getSettingValues.mockResolvedValue({
|
|
285
|
+
'configured-mail': 'true',
|
|
286
|
+
});
|
|
287
|
+
jest
|
|
288
|
+
.spyOn(service, 'reloadConfig')
|
|
289
|
+
.mockRejectedValue(new Error('SES unreachable'));
|
|
290
|
+
|
|
291
|
+
await expect(
|
|
292
|
+
service.sendTemplatedMail('en', {
|
|
293
|
+
email: 'a@b.com',
|
|
294
|
+
slug: 's',
|
|
295
|
+
variables: {},
|
|
296
|
+
} as any),
|
|
297
|
+
).resolves.toEqual({
|
|
298
|
+
sent: false,
|
|
299
|
+
reason: 'send-failed',
|
|
300
|
+
error: 'SES unreachable',
|
|
301
|
+
});
|
|
257
302
|
expect(deps.mailMainService.send).not.toHaveBeenCalled();
|
|
258
303
|
});
|
|
304
|
+
|
|
305
|
+
it('devolve o id do provedor quando o envio funciona', async () => {
|
|
306
|
+
const { service, deps } = makeService();
|
|
307
|
+
deps.setting.getSettingValues.mockResolvedValue({
|
|
308
|
+
'configured-mail': 'true',
|
|
309
|
+
} as any);
|
|
310
|
+
jest
|
|
311
|
+
.spyOn(service, 'reloadConfig')
|
|
312
|
+
.mockResolvedValue({ success: true, provider: 'ses', from: 'a@b.com', config: {} });
|
|
313
|
+
deps.prismaService.locale.findUnique.mockResolvedValue({ id: 1, code: 'en' });
|
|
314
|
+
deps.prismaService.mail.findUnique.mockResolvedValue({
|
|
315
|
+
id: 7,
|
|
316
|
+
mail_locale: [
|
|
317
|
+
{ subject: 'Oi {{name}}', body: 'Corpo', locale: { code: 'en' } },
|
|
318
|
+
],
|
|
319
|
+
mail_var: [],
|
|
320
|
+
});
|
|
321
|
+
deps.mailMainService.send.mockResolvedValue({
|
|
322
|
+
result: { MessageId: 'ses-abc' },
|
|
323
|
+
});
|
|
324
|
+
|
|
325
|
+
await expect(
|
|
326
|
+
service.sendTemplatedMail('en', {
|
|
327
|
+
email: 'a@b.com',
|
|
328
|
+
slug: 's',
|
|
329
|
+
variables: { name: 'João' },
|
|
330
|
+
} as any),
|
|
331
|
+
).resolves.toEqual({ sent: true, providerMessageId: 'ses-abc' });
|
|
332
|
+
});
|
|
333
|
+
|
|
334
|
+
// O bug que originou esta mudanca: o e-mail saia no idioma do header (ou no
|
|
335
|
+
// `en` de quem nao manda header), ignorando a preferencia do destinatario.
|
|
336
|
+
describe('idioma do destinatario', () => {
|
|
337
|
+
const arrange = (deps: any) => {
|
|
338
|
+
deps.setting.getSettingValues.mockResolvedValue({
|
|
339
|
+
'configured-mail': 'true',
|
|
340
|
+
language: 'en',
|
|
341
|
+
} as any);
|
|
342
|
+
deps.prismaService.mail.findUnique.mockResolvedValue({
|
|
343
|
+
id: 7,
|
|
344
|
+
mail_locale: [
|
|
345
|
+
{ subject: 'Hello', body: 'Body', locale: { code: 'en' } },
|
|
346
|
+
{ subject: 'Olá', body: 'Corpo', locale: { code: 'pt' } },
|
|
347
|
+
],
|
|
348
|
+
mail_var: [],
|
|
349
|
+
});
|
|
350
|
+
deps.mailMainService.send.mockResolvedValue({ result: { MessageId: 'x' } });
|
|
351
|
+
};
|
|
352
|
+
|
|
353
|
+
const send = (service: any, locale: string) =>
|
|
354
|
+
service.sendTemplatedMail(locale, {
|
|
355
|
+
email: 'a@b.com',
|
|
356
|
+
slug: 's',
|
|
357
|
+
variables: {},
|
|
358
|
+
} as any);
|
|
359
|
+
|
|
360
|
+
it('resolve o idioma pelo destinatario, nao pelo locale do chamador', async () => {
|
|
361
|
+
const { service, deps } = makeService();
|
|
362
|
+
arrange(deps);
|
|
363
|
+
jest.spyOn(service, 'reloadConfig').mockResolvedValue({
|
|
364
|
+
success: true, provider: 'ses', from: 'a@b.com', config: {},
|
|
365
|
+
});
|
|
366
|
+
deps.prismaService.user_identifier.findFirst.mockResolvedValue({ user_id: 42 });
|
|
367
|
+
deps.setting.resolveUserLocale.mockResolvedValue('pt');
|
|
368
|
+
|
|
369
|
+
await send(service, 'en');
|
|
370
|
+
|
|
371
|
+
expect(deps.setting.resolveUserLocale).toHaveBeenCalledWith(42);
|
|
372
|
+
expect(deps.mailMainService.send).toHaveBeenCalledWith(
|
|
373
|
+
expect.objectContaining({ subject: 'Olá', body: 'Corpo', locale: 'pt' }),
|
|
374
|
+
);
|
|
375
|
+
});
|
|
376
|
+
|
|
377
|
+
// Envio de fila/cron nao tem requisicao, entao a cadeia do SettingService
|
|
378
|
+
// nao tem contexto de onde tirar idioma: sobra o que o chamador informou.
|
|
379
|
+
it('usa o locale do chamador quando nao ha nada melhor', async () => {
|
|
380
|
+
const { service, deps } = makeService();
|
|
381
|
+
arrange(deps);
|
|
382
|
+
jest.spyOn(service, 'reloadConfig').mockResolvedValue({
|
|
383
|
+
success: true, provider: 'ses', from: 'a@b.com', config: {},
|
|
384
|
+
});
|
|
385
|
+
deps.prismaService.user_identifier.findFirst.mockResolvedValue(null);
|
|
386
|
+
deps.setting.resolveUserLocale.mockResolvedValue('en');
|
|
387
|
+
|
|
388
|
+
await send(service, 'pt');
|
|
389
|
+
|
|
390
|
+
expect(deps.mailMainService.send).toHaveBeenCalledWith(
|
|
391
|
+
expect.objectContaining({ subject: 'Olá', locale: 'pt' }),
|
|
392
|
+
);
|
|
393
|
+
});
|
|
394
|
+
|
|
395
|
+
// Regressao do commerce: 8 call sites passavam 'pt-BR', a tabela `locale`
|
|
396
|
+
// so tem code de 2 letras e o envio morria silenciosamente.
|
|
397
|
+
it('aceita tag regional do chamador e envia', async () => {
|
|
398
|
+
const { service, deps } = makeService();
|
|
399
|
+
arrange(deps);
|
|
400
|
+
jest.spyOn(service, 'reloadConfig').mockResolvedValue({
|
|
401
|
+
success: true, provider: 'ses', from: 'a@b.com', config: {},
|
|
402
|
+
});
|
|
403
|
+
deps.prismaService.user_identifier.findFirst.mockResolvedValue(null);
|
|
404
|
+
deps.setting.getSettingValues.mockResolvedValue({
|
|
405
|
+
'configured-mail': 'true',
|
|
406
|
+
} as any);
|
|
407
|
+
|
|
408
|
+
await expect(send(service, 'pt-BR')).resolves.toEqual({
|
|
409
|
+
sent: true,
|
|
410
|
+
providerMessageId: 'x',
|
|
411
|
+
});
|
|
412
|
+
expect(deps.mailMainService.send).toHaveBeenCalledWith(
|
|
413
|
+
expect.objectContaining({ locale: 'pt' }),
|
|
414
|
+
);
|
|
415
|
+
});
|
|
416
|
+
|
|
417
|
+
it('usa a traducao disponivel quando o idioma pedido nao existe', async () => {
|
|
418
|
+
const { service, deps } = makeService();
|
|
419
|
+
arrange(deps);
|
|
420
|
+
jest.spyOn(service, 'reloadConfig').mockResolvedValue({
|
|
421
|
+
success: true, provider: 'ses', from: 'a@b.com', config: {},
|
|
422
|
+
});
|
|
423
|
+
deps.prismaService.user_identifier.findFirst.mockResolvedValue({ user_id: 42 });
|
|
424
|
+
deps.setting.resolveUserLocale.mockResolvedValue('es');
|
|
425
|
+
|
|
426
|
+
await send(service, 'es');
|
|
427
|
+
|
|
428
|
+
expect(deps.mailMainService.send).toHaveBeenCalledWith(
|
|
429
|
+
expect.objectContaining({ subject: 'Olá', locale: 'pt' }),
|
|
430
|
+
);
|
|
431
|
+
});
|
|
432
|
+
|
|
433
|
+
// Antes virava TypeError engolido pelo catch e reportado como falha do
|
|
434
|
+
// provedor - o e-mail sumia sem ninguem saber por que.
|
|
435
|
+
it('reporta incidente proprio quando o template nao tem traducao alguma', async () => {
|
|
436
|
+
const { service, deps } = makeService();
|
|
437
|
+
arrange(deps);
|
|
438
|
+
jest.spyOn(service, 'reloadConfig').mockResolvedValue({
|
|
439
|
+
success: true, provider: 'ses', from: 'a@b.com', config: {},
|
|
440
|
+
});
|
|
441
|
+
deps.prismaService.user_identifier.findFirst.mockResolvedValue(null);
|
|
442
|
+
deps.prismaService.mail.findUnique.mockResolvedValue({
|
|
443
|
+
id: 7,
|
|
444
|
+
mail_locale: [],
|
|
445
|
+
mail_var: [],
|
|
446
|
+
});
|
|
447
|
+
|
|
448
|
+
await expect(send(service, 'pt')).resolves.toEqual({
|
|
449
|
+
sent: false,
|
|
450
|
+
reason: 'template-locale-missing',
|
|
451
|
+
});
|
|
452
|
+
expect(deps.mailMainService.send).not.toHaveBeenCalled();
|
|
453
|
+
expect(deps.incident.record).toHaveBeenCalledWith(
|
|
454
|
+
expect.objectContaining({ code: 'mail_template_no_locale' }),
|
|
455
|
+
);
|
|
456
|
+
});
|
|
457
|
+
|
|
458
|
+
// Convite, formulario do site: destinatario que ainda nao tem conta.
|
|
459
|
+
it('nao quebra quando o destinatario nao e usuario', async () => {
|
|
460
|
+
const { service, deps } = makeService();
|
|
461
|
+
arrange(deps);
|
|
462
|
+
jest.spyOn(service, 'reloadConfig').mockResolvedValue({
|
|
463
|
+
success: true, provider: 'ses', from: 'a@b.com', config: {},
|
|
464
|
+
});
|
|
465
|
+
deps.prismaService.user_identifier.findFirst.mockResolvedValue(null);
|
|
466
|
+
|
|
467
|
+
await expect(send(service, 'pt')).resolves.toEqual({
|
|
468
|
+
sent: true,
|
|
469
|
+
providerMessageId: 'x',
|
|
470
|
+
});
|
|
471
|
+
// Sem usuario encontrado, a cadeia e consultada sem id — nao explode.
|
|
472
|
+
expect(deps.setting.resolveUserLocale).toHaveBeenCalledWith(null);
|
|
473
|
+
});
|
|
474
|
+
});
|
|
475
|
+
|
|
476
|
+
// Sem isto os transacionais saem sem Reply-To e a resposta de quem trata o
|
|
477
|
+
// e-mail como conversa cai na caixa do remetente.
|
|
478
|
+
it('usa o reply-to do perfil de integração quando o chamador não informa', async () => {
|
|
479
|
+
const { service, deps } = makeService();
|
|
480
|
+
deps.setting.getSettingValues.mockResolvedValue({
|
|
481
|
+
'configured-mail': 'true',
|
|
482
|
+
} as any);
|
|
483
|
+
jest.spyOn(service, 'reloadConfig').mockResolvedValue({
|
|
484
|
+
success: true,
|
|
485
|
+
provider: 'ses',
|
|
486
|
+
from: 'a@b.com',
|
|
487
|
+
replyTo: 'Suporte <suporte@b.com>',
|
|
488
|
+
config: {},
|
|
489
|
+
});
|
|
490
|
+
deps.prismaService.locale.findUnique.mockResolvedValue({ id: 1, code: 'en' });
|
|
491
|
+
deps.prismaService.mail.findUnique.mockResolvedValue({
|
|
492
|
+
id: 7,
|
|
493
|
+
mail_locale: [{ subject: 'Oi', body: 'Corpo', locale: { code: 'en' } }],
|
|
494
|
+
mail_var: [],
|
|
495
|
+
});
|
|
496
|
+
deps.mailMainService.send.mockResolvedValue({ result: {} });
|
|
497
|
+
|
|
498
|
+
await service.sendTemplatedMail('en', {
|
|
499
|
+
email: 'a@b.com',
|
|
500
|
+
slug: 's',
|
|
501
|
+
variables: {},
|
|
502
|
+
} as any);
|
|
503
|
+
|
|
504
|
+
expect(deps.mailMainService.send).toHaveBeenCalledWith(
|
|
505
|
+
expect.objectContaining({ replyTo: 'Suporte <suporte@b.com>' }),
|
|
506
|
+
);
|
|
507
|
+
});
|
|
508
|
+
|
|
509
|
+
it('o reply-to explícito do chamador tem precedência sobre o do perfil', async () => {
|
|
510
|
+
const { service, deps } = makeService();
|
|
511
|
+
deps.setting.getSettingValues.mockResolvedValue({
|
|
512
|
+
'configured-mail': 'true',
|
|
513
|
+
} as any);
|
|
514
|
+
jest.spyOn(service, 'reloadConfig').mockResolvedValue({
|
|
515
|
+
success: true,
|
|
516
|
+
provider: 'ses',
|
|
517
|
+
from: 'a@b.com',
|
|
518
|
+
replyTo: 'suporte@b.com',
|
|
519
|
+
config: {},
|
|
520
|
+
});
|
|
521
|
+
deps.prismaService.locale.findUnique.mockResolvedValue({ id: 1, code: 'en' });
|
|
522
|
+
deps.prismaService.mail.findUnique.mockResolvedValue({
|
|
523
|
+
id: 7,
|
|
524
|
+
mail_locale: [{ subject: 'Oi', body: 'Corpo', locale: { code: 'en' } }],
|
|
525
|
+
mail_var: [],
|
|
526
|
+
});
|
|
527
|
+
deps.mailMainService.send.mockResolvedValue({ result: {} });
|
|
528
|
+
|
|
529
|
+
await service.sendTemplatedMail('en', {
|
|
530
|
+
email: 'a@b.com',
|
|
531
|
+
slug: 's',
|
|
532
|
+
variables: {},
|
|
533
|
+
replyTo: ' atendimento@b.com ',
|
|
534
|
+
} as any);
|
|
535
|
+
|
|
536
|
+
expect(deps.mailMainService.send).toHaveBeenCalledWith(
|
|
537
|
+
expect.objectContaining({ replyTo: 'atendimento@b.com' }),
|
|
538
|
+
);
|
|
539
|
+
});
|
|
259
540
|
});
|
|
260
541
|
|
|
261
542
|
describe('preview', () => {
|
|
@@ -359,6 +640,26 @@ describe('MailService', () => {
|
|
|
359
640
|
expect(html).toBe('<p>cru</p>');
|
|
360
641
|
});
|
|
361
642
|
|
|
643
|
+
it('resolve o logo pelo BrandAssetService, não pela env API_URL', async () => {
|
|
644
|
+
const { service, deps } = makePreviewService();
|
|
645
|
+
deps.setting.getSettingValues.mockResolvedValue({
|
|
646
|
+
'system-name': 'Acme',
|
|
647
|
+
'image-url': '/logo.svg',
|
|
648
|
+
} as any);
|
|
649
|
+
|
|
650
|
+
const { html } = await service.preview('pt', {
|
|
651
|
+
body: '<p>corpo</p>',
|
|
652
|
+
layout: {
|
|
653
|
+
wrapper: '<html>{{{header}}}{{{content}}}</html>',
|
|
654
|
+
header: '{{{brandMark}}}',
|
|
655
|
+
footer: '',
|
|
656
|
+
},
|
|
657
|
+
});
|
|
658
|
+
|
|
659
|
+
expect(deps.brandAsset.resolveAssetUrl).toHaveBeenCalledWith('/logo.svg');
|
|
660
|
+
expect(html).toContain('<img src="https://hub.hcode.com.br/logo.svg"');
|
|
661
|
+
});
|
|
662
|
+
|
|
362
663
|
it('cai no layout embutido quando não há layout no banco', async () => {
|
|
363
664
|
const { service, deps } = makePreviewService();
|
|
364
665
|
(deps.prismaService as any).mail_layout.findFirst.mockResolvedValue(null);
|