@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
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"file.service.d.ts","sourceRoot":"","sources":["../../src/file/file.service.ts"],"names":[],"mappings":"AAqBA,OAAO,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAC3E,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAOL,YAAY,EACb,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"file.service.d.ts","sourceRoot":"","sources":["../../src/file/file.service.ts"],"names":[],"mappings":"AAqBA,OAAO,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAC3E,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAOL,YAAY,EACb,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAWvC,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAC5D,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EACL,wBAAwB,EAEzB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EACL,gBAAgB,EAEjB,MAAM,8BAA8B,CAAC;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EAAE,MAAM,CAAC;QACzB,MAAM,CAAC,EAAE,MAAM,CAAC;KACjB;IA4DD,mBAAmB,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,SAAO;IAcpD;;;;;;;;OAQG;IACG,oBAAoB,CAAC,GAAG,EAAE,OAAO,GAAG,OAAO,CAAC,MAAM,CAAC;CAoB1D"}
|
|
@@ -11,6 +11,13 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
11
11
|
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
12
12
|
return function (target, key) { decorator(target, key, paramIndex); }
|
|
13
13
|
};
|
|
14
|
+
var __asyncValues = (this && this.__asyncValues) || function (o) {
|
|
15
|
+
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
16
|
+
var m = o[Symbol.asyncIterator], i;
|
|
17
|
+
return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
|
|
18
|
+
function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
|
|
19
|
+
function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
|
|
20
|
+
};
|
|
14
21
|
var _a;
|
|
15
22
|
var FileService_1;
|
|
16
23
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -24,11 +31,14 @@ const api_prisma_1 = require("@hed-hog/api-prisma");
|
|
|
24
31
|
const common_1 = require("@nestjs/common");
|
|
25
32
|
const jwt_1 = require("@nestjs/jwt");
|
|
26
33
|
const fs_1 = require("fs");
|
|
34
|
+
const os_1 = require("os");
|
|
27
35
|
const path_1 = require("path");
|
|
28
36
|
const promises_1 = require("stream/promises");
|
|
37
|
+
const uuid_1 = require("uuid");
|
|
29
38
|
const integration_profile_utils_1 = require("../integration-profile/integration-profile.utils");
|
|
30
39
|
const setting_service_1 = require("../setting/setting.service");
|
|
31
40
|
const image_optimization_service_1 = require("./image-optimization.service");
|
|
41
|
+
const abstract_provider_1 = require("./provider/abstract.provider");
|
|
32
42
|
const provider_factory_1 = require("./provider/provider.factory");
|
|
33
43
|
/**
|
|
34
44
|
* Resolver o provider custa 3 queries (setting + integration_profile, que ainda decifra o
|
|
@@ -341,6 +351,38 @@ let FileService = FileService_1 = class FileService {
|
|
|
341
351
|
buffer,
|
|
342
352
|
};
|
|
343
353
|
}
|
|
354
|
+
/**
|
|
355
|
+
* Renderiza um cartão social 1200x630 (JPEG) a partir de arquivos do acervo.
|
|
356
|
+
*
|
|
357
|
+
* Devolve `null` quando não há arquivo utilizável — quem chama deve responder
|
|
358
|
+
* 404 e deixar o consumidor cair na imagem padrão da marca, nunca 500: do
|
|
359
|
+
* outro lado costuma haver um robô de link preview.
|
|
360
|
+
*/
|
|
361
|
+
async renderShareCard(options) {
|
|
362
|
+
const load = async (fileId) => {
|
|
363
|
+
if (!fileId)
|
|
364
|
+
return null;
|
|
365
|
+
try {
|
|
366
|
+
const { buffer } = await this.getBuffer(fileId);
|
|
367
|
+
return buffer;
|
|
368
|
+
}
|
|
369
|
+
catch (_a) {
|
|
370
|
+
return null;
|
|
371
|
+
}
|
|
372
|
+
};
|
|
373
|
+
const [background, overlay] = await Promise.all([
|
|
374
|
+
load(options.backgroundFileId),
|
|
375
|
+
load(options.overlayFileId),
|
|
376
|
+
]);
|
|
377
|
+
if (!background && !overlay) {
|
|
378
|
+
return null;
|
|
379
|
+
}
|
|
380
|
+
const buffer = await this.imageOptimizationService.composeShareCard(background, overlay, { background: options.background });
|
|
381
|
+
if (!buffer) {
|
|
382
|
+
return null;
|
|
383
|
+
}
|
|
384
|
+
return { buffer, contentType: 'image/jpeg' };
|
|
385
|
+
}
|
|
344
386
|
async getLocalFile(fileId, res) {
|
|
345
387
|
const { buffer, file } = await this.getBuffer(fileId);
|
|
346
388
|
res.set({
|
|
@@ -353,7 +395,9 @@ let FileService = FileService_1 = class FileService {
|
|
|
353
395
|
// Escape hatch para chamadores INTERNOS que já validaram por conta própria —
|
|
354
396
|
// o mesmo par de flags que `uploadFromPath` sempre teve. O FileController não
|
|
355
397
|
// repassa este argumento, então não há como acioná-lo por HTTP.
|
|
398
|
+
// `isPrivate` tira o arquivo das rotas que servem por id sem autenticação.
|
|
356
399
|
options) {
|
|
400
|
+
var _a;
|
|
357
401
|
if (!fileBuffer) {
|
|
358
402
|
throw new common_1.BadRequestException(`No file provided`);
|
|
359
403
|
}
|
|
@@ -381,12 +425,13 @@ let FileService = FileService_1 = class FileService {
|
|
|
381
425
|
location: destination,
|
|
382
426
|
mimetype_id: await this.getMimeType(optimized.mimetype),
|
|
383
427
|
size: optimized.buffer.length,
|
|
428
|
+
is_private: (_a = options === null || options === void 0 ? void 0 : options.isPrivate) !== null && _a !== void 0 ? _a : false,
|
|
384
429
|
},
|
|
385
430
|
});
|
|
386
431
|
return file;
|
|
387
432
|
}
|
|
388
433
|
async uploadFromPath(destination, filePath, metadata) {
|
|
389
|
-
var _a, _b, _c, _d;
|
|
434
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
390
435
|
if (!filePath) {
|
|
391
436
|
throw new common_1.BadRequestException(`No file path provided`);
|
|
392
437
|
}
|
|
@@ -427,16 +472,20 @@ let FileService = FileService_1 = class FileService {
|
|
|
427
472
|
location: destination,
|
|
428
473
|
mimetype_id: await this.getMimeType(mimetype),
|
|
429
474
|
size,
|
|
475
|
+
is_private: (_d = metadata === null || metadata === void 0 ? void 0 : metadata.isPrivate) !== null && _d !== void 0 ? _d : false,
|
|
430
476
|
},
|
|
431
477
|
});
|
|
432
478
|
}
|
|
433
479
|
// Read buffer to allow image optimization regardless of provider support
|
|
434
480
|
const rawBuffer = await fs_1.promises.readFile(filePath);
|
|
435
|
-
const optimized = await this.imageOptimizationService.optimizeBuffer(rawBuffer, mimetype, originalname
|
|
481
|
+
const optimized = await this.imageOptimizationService.optimizeBuffer(rawBuffer, mimetype, originalname, {
|
|
482
|
+
maxWidth: (_e = metadata === null || metadata === void 0 ? void 0 : metadata.resize) === null || _e === void 0 ? void 0 : _e.maxWidth,
|
|
483
|
+
maxHeight: (_f = metadata === null || metadata === void 0 ? void 0 : metadata.resize) === null || _f === void 0 ? void 0 : _f.maxHeight,
|
|
484
|
+
});
|
|
436
485
|
const url = await provider.upload(destination, {
|
|
437
486
|
fieldname: 'file',
|
|
438
487
|
originalname: optimized.originalname,
|
|
439
|
-
encoding: (
|
|
488
|
+
encoding: (_g = metadata === null || metadata === void 0 ? void 0 : metadata.encoding) !== null && _g !== void 0 ? _g : '7bit',
|
|
440
489
|
mimetype: optimized.mimetype,
|
|
441
490
|
size: optimized.buffer.length,
|
|
442
491
|
destination: '',
|
|
@@ -452,6 +501,7 @@ let FileService = FileService_1 = class FileService {
|
|
|
452
501
|
location: destination,
|
|
453
502
|
mimetype_id: await this.getMimeType(optimized.mimetype),
|
|
454
503
|
size: optimized.buffer.length,
|
|
504
|
+
is_private: (_h = metadata === null || metadata === void 0 ? void 0 : metadata.isPrivate) !== null && _h !== void 0 ? _h : false,
|
|
455
505
|
},
|
|
456
506
|
});
|
|
457
507
|
return file;
|
|
@@ -570,9 +620,108 @@ let FileService = FileService_1 = class FileService {
|
|
|
570
620
|
}
|
|
571
621
|
return file;
|
|
572
622
|
}
|
|
623
|
+
/**
|
|
624
|
+
* Creates an independent copy of a stored file: new bytes in storage + a new `file` row.
|
|
625
|
+
*
|
|
626
|
+
* Unlike sharing a `file_id`, the result survives the original being deleted — which is what
|
|
627
|
+
* "duplicate files" means when copying course content between courses.
|
|
628
|
+
*
|
|
629
|
+
* `filename` and `destination` default to the source's, so a caller that only wants
|
|
630
|
+
* independent bytes gets them without thinking about paths. Passing `destination` matters for
|
|
631
|
+
* artifacts addressed by their location (HLS manifests and segments).
|
|
632
|
+
*
|
|
633
|
+
* The bytes are copied server-side when the active provider supports it; otherwise — and when
|
|
634
|
+
* the provider-side copy fails, e.g. an object above S3's 5GB CopyObject cap — they are
|
|
635
|
+
* streamed through a temp file, never buffered in RAM. Mime/size validation is skipped: the
|
|
636
|
+
* source already passed it at upload time.
|
|
637
|
+
*/
|
|
638
|
+
async duplicate(fileId, options) {
|
|
639
|
+
var _a, _b, _c, _d;
|
|
640
|
+
const source = await this.prismaService.file.findUnique({
|
|
641
|
+
where: { id: fileId },
|
|
642
|
+
include: { file_mimetype: true },
|
|
643
|
+
});
|
|
644
|
+
if (!source) {
|
|
645
|
+
throw new common_1.NotFoundException(`File not found: ${fileId}`);
|
|
646
|
+
}
|
|
647
|
+
const destination = (_a = options === null || options === void 0 ? void 0 : options.destination) !== null && _a !== void 0 ? _a : source.location;
|
|
648
|
+
const filename = (_b = options === null || options === void 0 ? void 0 : options.filename) !== null && _b !== void 0 ? _b : source.filename;
|
|
649
|
+
const sourcePath = this.resolveProviderPath(source);
|
|
650
|
+
const provider = await this.getProvider();
|
|
651
|
+
let storedFilename = null;
|
|
652
|
+
if ((0, abstract_provider_1.supportsServerSideCopy)(provider)) {
|
|
653
|
+
try {
|
|
654
|
+
storedFilename = await provider.copy(sourcePath, destination, filename);
|
|
655
|
+
}
|
|
656
|
+
catch (error) {
|
|
657
|
+
this.logger.warn(`Server-side copy failed for file ${fileId}, falling back to streaming: ${error instanceof Error ? error.message : String(error)}`);
|
|
658
|
+
}
|
|
659
|
+
}
|
|
660
|
+
if (storedFilename === null) {
|
|
661
|
+
const tempPath = (0, path_1.join)((0, os_1.tmpdir)(), `hedhog-file-copy-${(0, uuid_1.v4)()}`);
|
|
662
|
+
try {
|
|
663
|
+
await this.downloadToPath(fileId, tempPath);
|
|
664
|
+
storedFilename = await provider.uploadFromPath(destination, tempPath, {
|
|
665
|
+
filename,
|
|
666
|
+
mimetype: (_c = source.file_mimetype) === null || _c === void 0 ? void 0 : _c.name,
|
|
667
|
+
});
|
|
668
|
+
}
|
|
669
|
+
finally {
|
|
670
|
+
await fs_1.promises.unlink(tempPath).catch(() => undefined);
|
|
671
|
+
}
|
|
672
|
+
}
|
|
673
|
+
return this.prismaService.file.create({
|
|
674
|
+
data: {
|
|
675
|
+
filename,
|
|
676
|
+
path: storedFilename,
|
|
677
|
+
provider_id: this.providerId,
|
|
678
|
+
location: destination,
|
|
679
|
+
mimetype_id: source.mimetype_id,
|
|
680
|
+
size: (_d = source.size) !== null && _d !== void 0 ? _d : 0,
|
|
681
|
+
},
|
|
682
|
+
});
|
|
683
|
+
}
|
|
573
684
|
async readStream(filepath) {
|
|
574
685
|
return (await this.getProvider()).readStream(filepath);
|
|
575
686
|
}
|
|
687
|
+
/**
|
|
688
|
+
* Confere se os bytes de um `file` estão mesmo no storage, devolvendo o tamanho
|
|
689
|
+
* relatado pelo provider ao lado do tamanho declarado no banco.
|
|
690
|
+
*
|
|
691
|
+
* Existe para quem precisa **provar** que a cópia sobreviveu antes de apagar o
|
|
692
|
+
* original em outro lugar: o registro em banco sozinho não é prova, porque é
|
|
693
|
+
* gravado depois do upload e nada reconcilia os dois se o insert falhar no meio
|
|
694
|
+
* — o blob fica órfão ou a linha aponta para o vazio, e ninguém percebe até
|
|
695
|
+
* alguém tentar ler.
|
|
696
|
+
*
|
|
697
|
+
* Não lança quando o objeto está ausente: devolve `storedSize: null`, para o
|
|
698
|
+
* chamador decidir o que fazer com a divergência.
|
|
699
|
+
*/
|
|
700
|
+
async statStoredFile(fileId) {
|
|
701
|
+
var _a, _b, _c;
|
|
702
|
+
if (!fileId) {
|
|
703
|
+
throw new common_1.BadRequestException(`No file ID provided`);
|
|
704
|
+
}
|
|
705
|
+
const file = await this.prismaService.file.findUnique({
|
|
706
|
+
where: { id: fileId },
|
|
707
|
+
});
|
|
708
|
+
if (!file) {
|
|
709
|
+
throw new common_1.NotFoundException(`File not found: ${fileId}`);
|
|
710
|
+
}
|
|
711
|
+
const provider = await this.getProvider();
|
|
712
|
+
try {
|
|
713
|
+
const metadata = await provider.metaData(this.resolveProviderPath(file));
|
|
714
|
+
return {
|
|
715
|
+
storedSize: (_a = this.getFileSizeFromMetadata(metadata)) !== null && _a !== void 0 ? _a : null,
|
|
716
|
+
declaredSize: Number((_b = file.size) !== null && _b !== void 0 ? _b : 0),
|
|
717
|
+
};
|
|
718
|
+
}
|
|
719
|
+
catch (_d) {
|
|
720
|
+
// Qualquer falha de leitura de metadado — ausente, sem permissão, provider
|
|
721
|
+
// fora do ar — é tratada como "não deu para provar", nunca como sucesso.
|
|
722
|
+
return { storedSize: null, declaredSize: Number((_c = file.size) !== null && _c !== void 0 ? _c : 0) };
|
|
723
|
+
}
|
|
724
|
+
}
|
|
576
725
|
getFileSizeFromMetadata(metadata) {
|
|
577
726
|
if (!metadata) {
|
|
578
727
|
return undefined;
|
|
@@ -658,13 +807,25 @@ let FileService = FileService_1 = class FileService {
|
|
|
658
807
|
* Resolves the file record and its storage metadata (mimetype + size) without
|
|
659
808
|
* opening a read stream — so callers can answer a conditional 304 cheaply.
|
|
660
809
|
*/
|
|
810
|
+
/**
|
|
811
|
+
* Metadados para servir um arquivo POR ID.
|
|
812
|
+
*
|
|
813
|
+
* Só os dois handlers anônimos passam por aqui (`serveFileById` e
|
|
814
|
+
* `serveImageById`), e é por isso que a checagem de `is_private` mora neste
|
|
815
|
+
* ponto e não em cada um: id de arquivo é sequencial, então servir por id é uma
|
|
816
|
+
* porta enumerável. O caminho por token (`download`) não passa por aqui, então
|
|
817
|
+
* um arquivo privado continua acessível ao admin via
|
|
818
|
+
* `PUT /file/open/:id` -> token -> `GET /file/open/:token`.
|
|
819
|
+
*/
|
|
661
820
|
async resolveFileMeta(locale, id) {
|
|
662
821
|
var _a;
|
|
663
822
|
const file = await this.prismaService.file.findFirst({
|
|
664
823
|
where: { id },
|
|
665
824
|
include: { file_mimetype: true },
|
|
666
825
|
});
|
|
667
|
-
|
|
826
|
+
// Privado responde igual a inexistente: confirmar que o id existe já
|
|
827
|
+
// entregaria metade do que a enumeração procura.
|
|
828
|
+
if (!file || file.is_private) {
|
|
668
829
|
throw new common_1.NotFoundException((0, api_locale_1.getLocaleText)('file.download.not_found', locale, `Not found: ${id}`));
|
|
669
830
|
}
|
|
670
831
|
const provider = await this.getProvider();
|
|
@@ -741,13 +902,60 @@ let FileService = FileService_1 = class FileService {
|
|
|
741
902
|
}
|
|
742
903
|
return mimetype !== null && mimetype !== void 0 ? mimetype : 'application/octet-stream';
|
|
743
904
|
}
|
|
905
|
+
/**
|
|
906
|
+
* Widths this endpoint is willing to render. An allowlist is required, not a
|
|
907
|
+
* range check: the endpoint is `@Public()`, and an arbitrary width means
|
|
908
|
+
* arbitrary CPU and an unbounded number of cache entries per file.
|
|
909
|
+
*/
|
|
910
|
+
async getAllowedImageWidths() {
|
|
911
|
+
var _a;
|
|
912
|
+
const DEFAULT_WIDTHS = [64, 128, 320, 400, 480, 640, 896, 1200];
|
|
913
|
+
const settings = await this.settingService.getSettingValues('image-resize-allowed-widths');
|
|
914
|
+
try {
|
|
915
|
+
const parsed = JSON.parse((_a = settings['image-resize-allowed-widths']) !== null && _a !== void 0 ? _a : '');
|
|
916
|
+
const widths = (Array.isArray(parsed) ? parsed : [])
|
|
917
|
+
.map((w) => Math.round(Number(w)))
|
|
918
|
+
.filter((w) => Number.isFinite(w) && w > 0);
|
|
919
|
+
return widths.length ? widths : DEFAULT_WIDTHS;
|
|
920
|
+
}
|
|
921
|
+
catch (_b) {
|
|
922
|
+
return DEFAULT_WIDTHS;
|
|
923
|
+
}
|
|
924
|
+
}
|
|
925
|
+
/**
|
|
926
|
+
* Resolves the requested variant against the allowlist. Anything unknown or
|
|
927
|
+
* out of the list collapses to "no variant", which serves the original bytes
|
|
928
|
+
* instead of failing — a stale `?w=` in cached HTML must not 500.
|
|
929
|
+
*/
|
|
930
|
+
async resolveImageVariant(variant) {
|
|
931
|
+
const width = Math.round(Number(variant === null || variant === void 0 ? void 0 : variant.width) || 0);
|
|
932
|
+
if (width <= 0)
|
|
933
|
+
return null;
|
|
934
|
+
const allowed = await this.getAllowedImageWidths();
|
|
935
|
+
if (!allowed.includes(width))
|
|
936
|
+
return null;
|
|
937
|
+
const format = ['webp', 'jpeg', 'png', 'avif'].includes(String(variant === null || variant === void 0 ? void 0 : variant.format))
|
|
938
|
+
? String(variant === null || variant === void 0 ? void 0 : variant.format)
|
|
939
|
+
: undefined;
|
|
940
|
+
const rawQuality = Math.round(Number(variant === null || variant === void 0 ? void 0 : variant.quality) || 0);
|
|
941
|
+
const quality = rawQuality >= 50 && rawQuality <= 95 ? rawQuality : 80;
|
|
942
|
+
return { width, format, quality };
|
|
943
|
+
}
|
|
944
|
+
/** Absolute path of the on-disk cache entry for a rendered variant. */
|
|
945
|
+
imageVariantCachePath(id, size, width, format, quality) {
|
|
946
|
+
return (0, path_1.join)((0, os_1.tmpdir)(), 'hedhog-image-variants', `${id}-${size !== null && size !== void 0 ? size : 0}-w${width}-${format}-q${quality}`);
|
|
947
|
+
}
|
|
744
948
|
/**
|
|
745
949
|
* Serves an image by id with strong, immutable HTTP caching. The content of a
|
|
746
950
|
* given fileId never changes (a new upload yields a new id), so the ETag is
|
|
747
951
|
* derived from id+size instead of hashing the buffer, keeping it streaming.
|
|
952
|
+
*
|
|
953
|
+
* With a `variant` (`?w=`), the bytes are resized before being sent and the
|
|
954
|
+
* ETag carries the variant parameters — otherwise a conditional request for
|
|
955
|
+
* one width would get a 304 while holding the bytes of another.
|
|
748
956
|
*/
|
|
749
|
-
async serveImageById(locale, id, ifNoneMatch, res) {
|
|
750
|
-
var _a, _b;
|
|
957
|
+
async serveImageById(locale, id, ifNoneMatch, res, variant) {
|
|
958
|
+
var _a, _b, _c;
|
|
751
959
|
const { provider, providerPath, size, mimetype, filename } = await this.resolveFileMeta(locale, id);
|
|
752
960
|
// Many legacy/imported files store a generic mimetype (application/octet-stream).
|
|
753
961
|
// Since this endpoint serves images referenced by <img> tags, infer the
|
|
@@ -760,16 +968,92 @@ let FileService = FileService_1 = class FileService {
|
|
|
760
968
|
if (!contentType.startsWith('image/') && !isGenericBinary) {
|
|
761
969
|
throw new common_1.NotFoundException((0, api_locale_1.getLocaleText)('file.download.not_found', locale, `Not an image: ${id}`));
|
|
762
970
|
}
|
|
763
|
-
const
|
|
971
|
+
const resolved = await this.resolveImageVariant(variant);
|
|
972
|
+
const variantSuffix = resolved
|
|
973
|
+
? `-w${resolved.width}-${(_c = resolved.format) !== null && _c !== void 0 ? _c : 'auto'}-q${resolved.quality}`
|
|
974
|
+
: '';
|
|
975
|
+
const etag = `"img-${id}-${size !== null && size !== void 0 ? size : 0}${variantSuffix}"`;
|
|
764
976
|
if (ifNoneMatch && ifNoneMatch === etag) {
|
|
765
977
|
res.status(304).end();
|
|
766
978
|
return;
|
|
767
979
|
}
|
|
768
980
|
const ttl = await this.getCacheTtl('image-cache-ttl-seconds', 2592000);
|
|
769
|
-
|
|
981
|
+
const cacheControl = `public, max-age=${ttl}, immutable`;
|
|
982
|
+
if (resolved) {
|
|
983
|
+
const rendered = await this.renderImageVariant(provider, providerPath, contentType, id, size, resolved);
|
|
984
|
+
// A null render (unsupported format, sharp failure) falls through to the
|
|
985
|
+
// original bytes below rather than erroring the request.
|
|
986
|
+
if (rendered) {
|
|
987
|
+
const ext = rendered.mimetype.replace('image/', '');
|
|
988
|
+
this.setInlineHeaders(res, `${(0, path_1.basename)(filename, (0, path_1.extname)(filename))}.${ext === 'jpeg' ? 'jpg' : ext}`, rendered.mimetype, rendered.buffer.length, cacheControl, etag);
|
|
989
|
+
res.end(rendered.buffer);
|
|
990
|
+
return;
|
|
991
|
+
}
|
|
992
|
+
}
|
|
993
|
+
this.setInlineHeaders(res, filename, contentType, size, cacheControl, etag);
|
|
770
994
|
const stream = await provider.readStream(providerPath);
|
|
771
995
|
stream.pipe(res);
|
|
772
996
|
}
|
|
997
|
+
/**
|
|
998
|
+
* Produces (and memoizes on disk) a resized variant of a stored image.
|
|
999
|
+
* The cache key includes the file size, so re-uploading under the same id —
|
|
1000
|
+
* which the storage layer does not normally do — cannot serve stale bytes.
|
|
1001
|
+
*/
|
|
1002
|
+
async renderImageVariant(provider, providerPath, contentType, id, size, variant) {
|
|
1003
|
+
var _a, e_1, _b, _c;
|
|
1004
|
+
var _d;
|
|
1005
|
+
const format = (_d = variant.format) !== null && _d !== void 0 ? _d : (contentType === 'image/png'
|
|
1006
|
+
? 'png'
|
|
1007
|
+
: contentType === 'image/webp'
|
|
1008
|
+
? 'webp'
|
|
1009
|
+
: contentType === 'image/avif'
|
|
1010
|
+
? 'avif'
|
|
1011
|
+
: 'jpeg');
|
|
1012
|
+
const cachePath = this.imageVariantCachePath(id, size, variant.width, format, variant.quality);
|
|
1013
|
+
try {
|
|
1014
|
+
const cached = await fs_1.promises.readFile(cachePath);
|
|
1015
|
+
return { buffer: cached, mimetype: `image/${format}` };
|
|
1016
|
+
}
|
|
1017
|
+
catch (_e) {
|
|
1018
|
+
// Cache miss is the normal path on a cold pod; fall through and render.
|
|
1019
|
+
}
|
|
1020
|
+
try {
|
|
1021
|
+
const stream = await provider.readStream(providerPath);
|
|
1022
|
+
const chunks = [];
|
|
1023
|
+
try {
|
|
1024
|
+
for (var _f = true, stream_1 = __asyncValues(stream), stream_1_1; stream_1_1 = await stream_1.next(), _a = stream_1_1.done, !_a; _f = true) {
|
|
1025
|
+
_c = stream_1_1.value;
|
|
1026
|
+
_f = false;
|
|
1027
|
+
const chunk = _c;
|
|
1028
|
+
chunks.push(Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk));
|
|
1029
|
+
}
|
|
1030
|
+
}
|
|
1031
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
1032
|
+
finally {
|
|
1033
|
+
try {
|
|
1034
|
+
if (!_f && !_a && (_b = stream_1.return)) await _b.call(stream_1);
|
|
1035
|
+
}
|
|
1036
|
+
finally { if (e_1) throw e_1.error; }
|
|
1037
|
+
}
|
|
1038
|
+
const original = Buffer.concat(chunks);
|
|
1039
|
+
const rendered = await this.imageOptimizationService.resizeBuffer(original, contentType, { width: variant.width, format: variant.format, quality: variant.quality });
|
|
1040
|
+
if (!rendered)
|
|
1041
|
+
return null;
|
|
1042
|
+
try {
|
|
1043
|
+
await fs_1.promises.mkdir((0, path_1.dirname)(cachePath), { recursive: true });
|
|
1044
|
+
await fs_1.promises.writeFile(cachePath, rendered.buffer);
|
|
1045
|
+
}
|
|
1046
|
+
catch (err) {
|
|
1047
|
+
// A read-only or full tmpdir must not break serving the image.
|
|
1048
|
+
this.logger.warn(`Could not cache image variant ${cachePath}: ${err instanceof Error ? err.message : String(err)}`);
|
|
1049
|
+
}
|
|
1050
|
+
return { buffer: rendered.buffer, mimetype: rendered.mimetype };
|
|
1051
|
+
}
|
|
1052
|
+
catch (err) {
|
|
1053
|
+
this.logger.warn(`Could not render image variant for file ${id}: ${err instanceof Error ? err.message : String(err)}. Serving the original.`);
|
|
1054
|
+
return null;
|
|
1055
|
+
}
|
|
1056
|
+
}
|
|
773
1057
|
/**
|
|
774
1058
|
* Serves any file by id with configurable HTTP caching (not immutable, shorter
|
|
775
1059
|
* TTL than images). Used by the generic open endpoint's numeric-id branch.
|
|
@@ -1069,6 +1353,33 @@ let FileService = FileService_1 = class FileService {
|
|
|
1069
1353
|
expiresIn: `${Math.max(1, Number(expires) || 3600)}s`,
|
|
1070
1354
|
});
|
|
1071
1355
|
}
|
|
1356
|
+
/**
|
|
1357
|
+
* Base pública para URLs de arquivo devolvidas ao navegador.
|
|
1358
|
+
*
|
|
1359
|
+
* Não dá para derivar do `Host` da requisição: apps que falam com a API por
|
|
1360
|
+
* proxy interno (o class, via rewrite `/api` do Next) fazem o Nest enxergar o
|
|
1361
|
+
* Service do cluster, e a URL sai como `http://hub-api:3100/...` — inútil no
|
|
1362
|
+
* navegador. O setting `api-url` é a URL pública canônica da API no repo; o
|
|
1363
|
+
* `Host` fica só como fallback para ambientes sem o setting configurado.
|
|
1364
|
+
*/
|
|
1365
|
+
async resolvePublicBaseUrl(req) {
|
|
1366
|
+
let configured = '';
|
|
1367
|
+
try {
|
|
1368
|
+
const settings = await this.settingService.getSettingValues([
|
|
1369
|
+
'api-url',
|
|
1370
|
+
'url',
|
|
1371
|
+
]);
|
|
1372
|
+
const value = (settings === null || settings === void 0 ? void 0 : settings['api-url']) || (settings === null || settings === void 0 ? void 0 : settings['url']);
|
|
1373
|
+
configured = typeof value === 'string' ? value.trim() : '';
|
|
1374
|
+
}
|
|
1375
|
+
catch (_a) {
|
|
1376
|
+
configured = '';
|
|
1377
|
+
}
|
|
1378
|
+
if (/^https?:\/\/.+/i.test(configured)) {
|
|
1379
|
+
return configured.replace(/\/+$/, '');
|
|
1380
|
+
}
|
|
1381
|
+
return `${req.protocol}://${req.get('host')}`;
|
|
1382
|
+
}
|
|
1072
1383
|
};
|
|
1073
1384
|
exports.FileService = FileService;
|
|
1074
1385
|
exports.FileService = FileService = FileService_1 = __decorate([
|