@antelopejs/dms-mailing 0.2.2
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/LICENSE +190 -0
- package/README.md +162 -0
- package/dist/antelope-modules.d.ts +32 -0
- package/dist/antelope-modules.js +36 -0
- package/dist/antelope-modules.js.map +1 -0
- package/dist/automation/email-event-trigger.d.ts +16 -0
- package/dist/automation/email-event-trigger.js +70 -0
- package/dist/automation/email-event-trigger.js.map +1 -0
- package/dist/automation/index.d.ts +4 -0
- package/dist/automation/index.js +39 -0
- package/dist/automation/index.js.map +1 -0
- package/dist/automation/send-template-action.d.ts +13 -0
- package/dist/automation/send-template-action.js +71 -0
- package/dist/automation/send-template-action.js.map +1 -0
- package/dist/config.d.ts +5 -0
- package/dist/config.js +13 -0
- package/dist/config.js.map +1 -0
- package/dist/constants.d.ts +28 -0
- package/dist/constants.js +32 -0
- package/dist/constants.js.map +1 -0
- package/dist/crons/index.d.ts +1 -0
- package/dist/crons/index.js +18 -0
- package/dist/crons/index.js.map +1 -0
- package/dist/crons/retention.d.ts +18 -0
- package/dist/crons/retention.js +107 -0
- package/dist/crons/retention.js.map +1 -0
- package/dist/data/body.d.ts +1 -0
- package/dist/data/body.js +18 -0
- package/dist/data/body.js.map +1 -0
- package/dist/data/index.d.ts +3 -0
- package/dist/data/index.js +20 -0
- package/dist/data/index.js.map +1 -0
- package/dist/data/sends-table.d.ts +28 -0
- package/dist/data/sends-table.js +161 -0
- package/dist/data/sends-table.js.map +1 -0
- package/dist/data/templates-table.d.ts +31 -0
- package/dist/data/templates-table.js +173 -0
- package/dist/data/templates-table.js.map +1 -0
- package/dist/data-types/categories-type.d.ts +35 -0
- package/dist/data-types/categories-type.js +37 -0
- package/dist/data-types/categories-type.js.map +1 -0
- package/dist/data-types/category-type.d.ts +8 -0
- package/dist/data-types/category-type.js +43 -0
- package/dist/data-types/category-type.js.map +1 -0
- package/dist/data-types/index.d.ts +2 -0
- package/dist/data-types/index.js +19 -0
- package/dist/data-types/index.js.map +1 -0
- package/dist/db/index.d.ts +2 -0
- package/dist/db/index.js +19 -0
- package/dist/db/index.js.map +1 -0
- package/dist/db/models/index.d.ts +4 -0
- package/dist/db/models/index.js +21 -0
- package/dist/db/models/index.js.map +1 -0
- package/dist/db/models/send-events.model.d.ts +27 -0
- package/dist/db/models/send-events.model.js +35 -0
- package/dist/db/models/send-events.model.js.map +1 -0
- package/dist/db/models/sends.model.d.ts +32 -0
- package/dist/db/models/sends.model.js +115 -0
- package/dist/db/models/sends.model.js.map +1 -0
- package/dist/db/models/settings.model.d.ts +23 -0
- package/dist/db/models/settings.model.js +13 -0
- package/dist/db/models/settings.model.js.map +1 -0
- package/dist/db/models/templates.model.d.ts +23 -0
- package/dist/db/models/templates.model.js +13 -0
- package/dist/db/models/templates.model.js.map +1 -0
- package/dist/db/tables/index.d.ts +4 -0
- package/dist/db/tables/index.js +21 -0
- package/dist/db/tables/index.js.map +1 -0
- package/dist/db/tables/send-events.table.d.ts +10 -0
- package/dist/db/tables/send-events.table.js +44 -0
- package/dist/db/tables/send-events.table.js.map +1 -0
- package/dist/db/tables/sends.table.d.ts +26 -0
- package/dist/db/tables/sends.table.js +113 -0
- package/dist/db/tables/sends.table.js.map +1 -0
- package/dist/db/tables/settings.table.d.ts +15 -0
- package/dist/db/tables/settings.table.js +68 -0
- package/dist/db/tables/settings.table.js.map +1 -0
- package/dist/db/tables/templates.table.d.ts +18 -0
- package/dist/db/tables/templates.table.js +81 -0
- package/dist/db/tables/templates.table.js.map +1 -0
- package/dist/engine/conditions.d.ts +2 -0
- package/dist/engine/conditions.js +20 -0
- package/dist/engine/conditions.js.map +1 -0
- package/dist/engine/coverage.d.ts +4 -0
- package/dist/engine/coverage.js +45 -0
- package/dist/engine/coverage.js.map +1 -0
- package/dist/engine/fallback-html.d.ts +4 -0
- package/dist/engine/fallback-html.js +84 -0
- package/dist/engine/fallback-html.js.map +1 -0
- package/dist/engine/index.d.ts +7 -0
- package/dist/engine/index.js +24 -0
- package/dist/engine/index.js.map +1 -0
- package/dist/engine/paths.d.ts +3 -0
- package/dist/engine/paths.js +32 -0
- package/dist/engine/paths.js.map +1 -0
- package/dist/engine/resolve.d.ts +4 -0
- package/dist/engine/resolve.js +139 -0
- package/dist/engine/resolve.js.map +1 -0
- package/dist/engine/tokens.d.ts +7 -0
- package/dist/engine/tokens.js +29 -0
- package/dist/engine/tokens.js.map +1 -0
- package/dist/engine/walk.d.ts +3 -0
- package/dist/engine/walk.js +14 -0
- package/dist/engine/walk.js.map +1 -0
- package/dist/hooks/index.d.ts +1 -0
- package/dist/hooks/index.js +18 -0
- package/dist/hooks/index.js.map +1 -0
- package/dist/hooks/tenant-export.d.ts +14 -0
- package/dist/hooks/tenant-export.js +84 -0
- package/dist/hooks/tenant-export.js.map +1 -0
- package/dist/implementations/dms-mailing/index.d.ts +2 -0
- package/dist/implementations/dms-mailing/index.js +8 -0
- package/dist/implementations/dms-mailing/index.js.map +1 -0
- package/dist/index.d.ts +13 -0
- package/dist/index.js +95 -0
- package/dist/index.js.map +1 -0
- package/dist/pages/editor.d.ts +9 -0
- package/dist/pages/editor.js +30 -0
- package/dist/pages/editor.js.map +1 -0
- package/dist/pages/index.d.ts +7 -0
- package/dist/pages/index.js +24 -0
- package/dist/pages/index.js.map +1 -0
- package/dist/pages/module.d.ts +1 -0
- package/dist/pages/module.js +12 -0
- package/dist/pages/module.js.map +1 -0
- package/dist/pages/overview.d.ts +14 -0
- package/dist/pages/overview.js +92 -0
- package/dist/pages/overview.js.map +1 -0
- package/dist/pages/sends.d.ts +13 -0
- package/dist/pages/sends.js +125 -0
- package/dist/pages/sends.js.map +1 -0
- package/dist/pages/settings/form.d.ts +1 -0
- package/dist/pages/settings/form.js +68 -0
- package/dist/pages/settings/form.js.map +1 -0
- package/dist/pages/settings/index.d.ts +2 -0
- package/dist/pages/settings/index.js +19 -0
- package/dist/pages/settings/index.js.map +1 -0
- package/dist/pages/settings/page.d.ts +10 -0
- package/dist/pages/settings/page.js +35 -0
- package/dist/pages/settings/page.js.map +1 -0
- package/dist/pages/templates.d.ts +10 -0
- package/dist/pages/templates.js +140 -0
- package/dist/pages/templates.js.map +1 -0
- package/dist/permissions.d.ts +1 -0
- package/dist/permissions.js +37 -0
- package/dist/permissions.js.map +1 -0
- package/dist/quick-actions.d.ts +2 -0
- package/dist/quick-actions.js +18 -0
- package/dist/quick-actions.js.map +1 -0
- package/dist/realtime.d.ts +4 -0
- package/dist/realtime.js +44 -0
- package/dist/realtime.js.map +1 -0
- package/dist/routes/events.d.ts +9 -0
- package/dist/routes/events.js +63 -0
- package/dist/routes/events.js.map +1 -0
- package/dist/routes/index.d.ts +7 -0
- package/dist/routes/index.js +24 -0
- package/dist/routes/index.js.map +1 -0
- package/dist/routes/metrics.d.ts +54 -0
- package/dist/routes/metrics.js +235 -0
- package/dist/routes/metrics.js.map +1 -0
- package/dist/routes/period.d.ts +5 -0
- package/dist/routes/period.js +36 -0
- package/dist/routes/period.js.map +1 -0
- package/dist/routes/provider.d.ts +13 -0
- package/dist/routes/provider.js +41 -0
- package/dist/routes/provider.js.map +1 -0
- package/dist/routes/sends.d.ts +31 -0
- package/dist/routes/sends.js +178 -0
- package/dist/routes/sends.js.map +1 -0
- package/dist/routes/settings.d.ts +14 -0
- package/dist/routes/settings.js +72 -0
- package/dist/routes/settings.js.map +1 -0
- package/dist/routes/templates.d.ts +61 -0
- package/dist/routes/templates.js +230 -0
- package/dist/routes/templates.js.map +1 -0
- package/dist/services/attention.d.ts +23 -0
- package/dist/services/attention.js +104 -0
- package/dist/services/attention.js.map +1 -0
- package/dist/services/categories.d.ts +34 -0
- package/dist/services/categories.js +34 -0
- package/dist/services/categories.js.map +1 -0
- package/dist/services/events.d.ts +10 -0
- package/dist/services/events.js +89 -0
- package/dist/services/events.js.map +1 -0
- package/dist/services/metrics.d.ts +34 -0
- package/dist/services/metrics.js +103 -0
- package/dist/services/metrics.js.map +1 -0
- package/dist/services/notify.d.ts +20 -0
- package/dist/services/notify.js +63 -0
- package/dist/services/notify.js.map +1 -0
- package/dist/services/permissions.d.ts +2 -0
- package/dist/services/permissions.js +15 -0
- package/dist/services/permissions.js.map +1 -0
- package/dist/services/provider.d.ts +6 -0
- package/dist/services/provider.js +25 -0
- package/dist/services/provider.js.map +1 -0
- package/dist/services/render.d.ts +6 -0
- package/dist/services/render.js +21 -0
- package/dist/services/render.js.map +1 -0
- package/dist/services/send.d.ts +49 -0
- package/dist/services/send.js +259 -0
- package/dist/services/send.js.map +1 -0
- package/dist/services/settings.d.ts +4 -0
- package/dist/services/settings.js +61 -0
- package/dist/services/settings.js.map +1 -0
- package/dist/services/status.d.ts +3 -0
- package/dist/services/status.js +16 -0
- package/dist/services/status.js.map +1 -0
- package/dist/services/templates.d.ts +17 -0
- package/dist/services/templates.js +92 -0
- package/dist/services/templates.js.map +1 -0
- package/dist/test/antelope.test.d.ts +2 -0
- package/dist/test/antelope.test.js +179 -0
- package/dist/test/antelope.test.js.map +1 -0
- package/dist/test/helpers/http.d.ts +4 -0
- package/dist/test/helpers/http.js +28 -0
- package/dist/test/helpers/http.js.map +1 -0
- package/dist/test/helpers/owner.d.ts +5 -0
- package/dist/test/helpers/owner.js +30 -0
- package/dist/test/helpers/owner.js.map +1 -0
- package/dist/test/integration/events.test.d.ts +1 -0
- package/dist/test/integration/events.test.js +132 -0
- package/dist/test/integration/events.test.js.map +1 -0
- package/dist/test/integration/retention.test.d.ts +1 -0
- package/dist/test/integration/retention.test.js +291 -0
- package/dist/test/integration/retention.test.js.map +1 -0
- package/dist/test/integration/sends.test.d.ts +1 -0
- package/dist/test/integration/sends.test.js +157 -0
- package/dist/test/integration/sends.test.js.map +1 -0
- package/dist/test/integration/settings.test.d.ts +1 -0
- package/dist/test/integration/settings.test.js +45 -0
- package/dist/test/integration/settings.test.js.map +1 -0
- package/dist/test/integration/setup.test.d.ts +1 -0
- package/dist/test/integration/setup.test.js +32 -0
- package/dist/test/integration/setup.test.js.map +1 -0
- package/dist/test/integration/templates.test.d.ts +1 -0
- package/dist/test/integration/templates.test.js +167 -0
- package/dist/test/integration/templates.test.js.map +1 -0
- package/dist/test/integration/tenant-export.test.d.ts +1 -0
- package/dist/test/integration/tenant-export.test.js +85 -0
- package/dist/test/integration/tenant-export.test.js.map +1 -0
- package/dist/test/unit/attention.test.d.ts +1 -0
- package/dist/test/unit/attention.test.js +109 -0
- package/dist/test/unit/attention.test.js.map +1 -0
- package/dist/test/unit/automation.test.d.ts +1 -0
- package/dist/test/unit/automation.test.js +104 -0
- package/dist/test/unit/automation.test.js.map +1 -0
- package/dist/test/unit/categories.test.d.ts +1 -0
- package/dist/test/unit/categories.test.js +38 -0
- package/dist/test/unit/categories.test.js.map +1 -0
- package/dist/test/unit/engine/conditions.test.d.ts +1 -0
- package/dist/test/unit/engine/conditions.test.js +23 -0
- package/dist/test/unit/engine/conditions.test.js.map +1 -0
- package/dist/test/unit/engine/coverage.test.d.ts +1 -0
- package/dist/test/unit/engine/coverage.test.js +106 -0
- package/dist/test/unit/engine/coverage.test.js.map +1 -0
- package/dist/test/unit/engine/fallback-html.test.d.ts +1 -0
- package/dist/test/unit/engine/fallback-html.test.js +78 -0
- package/dist/test/unit/engine/fallback-html.test.js.map +1 -0
- package/dist/test/unit/engine/paths.test.d.ts +1 -0
- package/dist/test/unit/engine/paths.test.js +33 -0
- package/dist/test/unit/engine/paths.test.js.map +1 -0
- package/dist/test/unit/engine/resolve.test.d.ts +1 -0
- package/dist/test/unit/engine/resolve.test.js +157 -0
- package/dist/test/unit/engine/resolve.test.js.map +1 -0
- package/dist/test/unit/engine/tokens.test.d.ts +1 -0
- package/dist/test/unit/engine/tokens.test.js +26 -0
- package/dist/test/unit/engine/tokens.test.js.map +1 -0
- package/dist/test/unit/events.test.d.ts +1 -0
- package/dist/test/unit/events.test.js +13 -0
- package/dist/test/unit/events.test.js.map +1 -0
- package/dist/test/unit/metrics.test.d.ts +1 -0
- package/dist/test/unit/metrics.test.js +108 -0
- package/dist/test/unit/metrics.test.js.map +1 -0
- package/dist/test/unit/notify.test.d.ts +1 -0
- package/dist/test/unit/notify.test.js +49 -0
- package/dist/test/unit/notify.test.js.map +1 -0
- package/dist/test/unit/period.test.d.ts +1 -0
- package/dist/test/unit/period.test.js +44 -0
- package/dist/test/unit/period.test.js.map +1 -0
- package/dist/test/unit/provider.test.d.ts +1 -0
- package/dist/test/unit/provider.test.js +47 -0
- package/dist/test/unit/provider.test.js.map +1 -0
- package/dist/test/unit/realtime.test.d.ts +1 -0
- package/dist/test/unit/realtime.test.js +13 -0
- package/dist/test/unit/realtime.test.js.map +1 -0
- package/dist/test/unit/render.test.d.ts +1 -0
- package/dist/test/unit/render.test.js +23 -0
- package/dist/test/unit/render.test.js.map +1 -0
- package/dist/test/unit/retention.test.d.ts +1 -0
- package/dist/test/unit/retention.test.js +66 -0
- package/dist/test/unit/retention.test.js.map +1 -0
- package/dist/test/unit/send-batch.test.d.ts +1 -0
- package/dist/test/unit/send-batch.test.js +46 -0
- package/dist/test/unit/send-batch.test.js.map +1 -0
- package/dist/test/unit/send.test.d.ts +1 -0
- package/dist/test/unit/send.test.js +120 -0
- package/dist/test/unit/send.test.js.map +1 -0
- package/dist/test/unit/smoke.test.d.ts +1 -0
- package/dist/test/unit/smoke.test.js +10 -0
- package/dist/test/unit/smoke.test.js.map +1 -0
- package/dist/test/unit/status.test.d.ts +1 -0
- package/dist/test/unit/status.test.js +16 -0
- package/dist/test/unit/status.test.js.map +1 -0
- package/dist/test/unit/templates.test.d.ts +1 -0
- package/dist/test/unit/templates.test.js +48 -0
- package/dist/test/unit/templates.test.js.map +1 -0
- package/dist/test/unit/tenant-export.test.d.ts +1 -0
- package/dist/test/unit/tenant-export.test.js +59 -0
- package/dist/test/unit/tenant-export.test.js.map +1 -0
- package/dist/test/unit/webhook-secret.test.d.ts +1 -0
- package/dist/test/unit/webhook-secret.test.js +42 -0
- package/dist/test/unit/webhook-secret.test.js.map +1 -0
- package/dist/types/blocks.d.ts +2 -0
- package/dist/types/blocks.js +3 -0
- package/dist/types/blocks.js.map +1 -0
- package/dist/types/index.d.ts +4 -0
- package/dist/types/index.js +21 -0
- package/dist/types/index.js.map +1 -0
- package/dist/types/resolved.d.ts +68 -0
- package/dist/types/resolved.js +3 -0
- package/dist/types/resolved.js.map +1 -0
- package/dist/types/sends.d.ts +14 -0
- package/dist/types/sends.js +19 -0
- package/dist/types/sends.js.map +1 -0
- package/dist/types/settings.d.ts +16 -0
- package/dist/types/settings.js +11 -0
- package/dist/types/settings.js.map +1 -0
- package/dist/validation/settings.schema.d.ts +63 -0
- package/dist/validation/settings.schema.js +29 -0
- package/dist/validation/settings.schema.js.map +1 -0
- package/dist/validation/templates.schema.d.ts +248 -0
- package/dist/validation/templates.schema.js +126 -0
- package/dist/validation/templates.schema.js.map +1 -0
- package/frontend-vue/.editorconfig +12 -0
- package/frontend-vue/.prettierrc +11 -0
- package/frontend-vue/app/components/AttentionCard.vue +78 -0
- package/frontend-vue/app/components/CategoriesInput.vue +126 -0
- package/frontend-vue/app/components/CategoryInput.vue +67 -0
- package/frontend-vue/app/components/Editor.vue +63 -0
- package/frontend-vue/app/components/FunnelCard.vue +66 -0
- package/frontend-vue/app/components/HtmlPreviewModal.vue +20 -0
- package/frontend-vue/app/components/NewTemplateModal.vue +158 -0
- package/frontend-vue/app/components/ProviderChip.vue +39 -0
- package/frontend-vue/app/components/SendDrawer.vue +298 -0
- package/frontend-vue/app/components/TemplateCard.vue +127 -0
- package/frontend-vue/app/components/TemplateDrawer.vue +394 -0
- package/frontend-vue/app/components/TemplateGallery.vue +112 -0
- package/frontend-vue/app/components/TemplatePreviewFrame.vue +103 -0
- package/frontend-vue/app/components/TestSendModal.vue +162 -0
- package/frontend-vue/app/components/TokenText.vue +26 -0
- package/frontend-vue/app/components/blocks/Button.vue +19 -0
- package/frontend-vue/app/components/blocks/Code.vue +17 -0
- package/frontend-vue/app/components/blocks/Divider.vue +3 -0
- package/frontend-vue/app/components/blocks/Footer.vue +22 -0
- package/frontend-vue/app/components/blocks/Heading.vue +18 -0
- package/frontend-vue/app/components/blocks/Hero.vue +32 -0
- package/frontend-vue/app/components/blocks/List.vue +33 -0
- package/frontend-vue/app/components/blocks/Paragraph.vue +18 -0
- package/frontend-vue/app/components/blocks/Total.vue +18 -0
- package/frontend-vue/app/components/editor/EditorBlock.vue +121 -0
- package/frontend-vue/app/components/editor/EditorBlockList.vue +44 -0
- package/frontend-vue/app/components/editor/EditorBlockSettings.vue +186 -0
- package/frontend-vue/app/components/editor/EditorCanvas.vue +91 -0
- package/frontend-vue/app/components/editor/EditorConditionFields.vue +88 -0
- package/frontend-vue/app/components/editor/EditorDataPanel.vue +128 -0
- package/frontend-vue/app/components/editor/EditorDraftBar.vue +35 -0
- package/frontend-vue/app/components/editor/EditorIfBlock.vue +120 -0
- package/frontend-vue/app/components/editor/EditorMissingLocale.vue +62 -0
- package/frontend-vue/app/components/editor/EditorPalette.vue +62 -0
- package/frontend-vue/app/components/editor/EditorRail.vue +58 -0
- package/frontend-vue/app/components/editor/EditorSubjectSettings.vue +37 -0
- package/frontend-vue/app/components/editor/EditorTemplateSettings.vue +87 -0
- package/frontend-vue/app/components/editor/EditorTestSendModal.vue +66 -0
- package/frontend-vue/app/components/editor/EditorToolbar.vue +155 -0
- package/frontend-vue/app/components/editor/EditorVariables.vue +163 -0
- package/frontend-vue/app/components/editor/EditorWorkspace.vue +189 -0
- package/frontend-vue/app/composables/useEditorContext.ts +44 -0
- package/frontend-vue/app/composables/useMailingApi.ts +197 -0
- package/frontend-vue/app/composables/useMailingPeriodData.ts +39 -0
- package/frontend-vue/app/composables/useTemplateDrawer.ts +90 -0
- package/frontend-vue/app/composables/useTemplateEditor.ts +228 -0
- package/frontend-vue/app/emails/EmailMailingTemplate.vue +24 -0
- package/frontend-vue/app/emails/components/MailingBlocks.vue +117 -0
- package/frontend-vue/app/plugins/template-gallery-display.client.ts +14 -0
- package/frontend-vue/app/types/component.ts +29 -0
- package/frontend-vue/app/types/mailing.ts +365 -0
- package/frontend-vue/app/utils/blocks/components.ts +14 -0
- package/frontend-vue/app/utils/blocks/dnd.ts +15 -0
- package/frontend-vue/app/utils/blocks/factory.ts +100 -0
- package/frontend-vue/app/utils/blocks/fields.ts +58 -0
- package/frontend-vue/app/utils/blocks/index.ts +5 -0
- package/frontend-vue/app/utils/blocks/tree.ts +74 -0
- package/frontend-vue/app/utils/categories.ts +54 -0
- package/frontend-vue/app/utils/clone.ts +3 -0
- package/frontend-vue/app/utils/conditions.ts +50 -0
- package/frontend-vue/app/utils/editor-route.ts +18 -0
- package/frontend-vue/app/utils/gallery.ts +41 -0
- package/frontend-vue/app/utils/locales.ts +41 -0
- package/frontend-vue/app/utils/paths.ts +84 -0
- package/frontend-vue/app/utils/period.ts +23 -0
- package/frontend-vue/app/utils/testData.ts +10 -0
- package/frontend-vue/app/utils/timeline.ts +68 -0
- package/frontend-vue/app/utils/tokens.ts +24 -0
- package/frontend-vue/app/utils/variables.ts +48 -0
- package/frontend-vue/dms.email.ts +9 -0
- package/frontend-vue/dms.frontend.ts +29 -0
- package/frontend-vue/eslint.config.mjs +13 -0
- package/frontend-vue/i18n/locales/mailing-en-GB.json +397 -0
- package/frontend-vue/i18n/locales/mailing-fr-FR.json +397 -0
- package/frontend-vue/package.json +32 -0
- package/frontend-vue/pnpm-lock.yaml +6446 -0
- package/frontend-vue/pnpm-workspace.yaml +2 -0
- package/frontend-vue/tests/block-components.test.ts +14 -0
- package/frontend-vue/tests/block-fields.test.ts +23 -0
- package/frontend-vue/tests/blocks-factory.test.ts +28 -0
- package/frontend-vue/tests/blocks-tree.test.ts +49 -0
- package/frontend-vue/tests/categories.test.ts +64 -0
- package/frontend-vue/tests/conditions.test.ts +36 -0
- package/frontend-vue/tests/dnd.test.ts +11 -0
- package/frontend-vue/tests/editor-block-list.test.ts +54 -0
- package/frontend-vue/tests/editor-route.test.ts +23 -0
- package/frontend-vue/tests/email-render-cases.json +77 -0
- package/frontend-vue/tests/gallery.test.ts +39 -0
- package/frontend-vue/tests/i18n-editor.test.ts +21 -0
- package/frontend-vue/tests/i18n.test.ts +83 -0
- package/frontend-vue/tests/locales.test.ts +38 -0
- package/frontend-vue/tests/mailing-api.test.ts +10 -0
- package/frontend-vue/tests/paths.test.ts +128 -0
- package/frontend-vue/tests/period.test.ts +13 -0
- package/frontend-vue/tests/smoke.test.ts +8 -0
- package/frontend-vue/tests/template-editor.test.ts +65 -0
- package/frontend-vue/tests/test-data.test.ts +15 -0
- package/frontend-vue/tests/timeline.test.ts +29 -0
- package/frontend-vue/tests/tokens.test.ts +12 -0
- package/frontend-vue/tests/variables.test.ts +46 -0
- package/frontend-vue/vitest.config.ts +10 -0
- package/package.json +94 -0
- package/src/antelope-modules.ts +48 -0
- package/src/automation/email-event-trigger.ts +112 -0
- package/src/automation/index.ts +33 -0
- package/src/automation/send-template-action.ts +100 -0
- package/src/config.ts +15 -0
- package/src/constants.ts +42 -0
- package/src/crons/index.ts +1 -0
- package/src/crons/retention.ts +126 -0
- package/src/data/body.ts +14 -0
- package/src/data/index.ts +3 -0
- package/src/data/sends-table.ts +154 -0
- package/src/data/templates-table.ts +202 -0
- package/src/data-types/categories-type.ts +29 -0
- package/src/data-types/category-type.ts +44 -0
- package/src/data-types/index.ts +2 -0
- package/src/db/index.ts +2 -0
- package/src/db/models/index.ts +4 -0
- package/src/db/models/send-events.model.ts +46 -0
- package/src/db/models/sends.model.ts +147 -0
- package/src/db/models/settings.model.ts +12 -0
- package/src/db/models/templates.model.ts +12 -0
- package/src/db/tables/index.ts +4 -0
- package/src/db/tables/send-events.table.ts +31 -0
- package/src/db/tables/sends.table.ts +85 -0
- package/src/db/tables/settings.table.ts +49 -0
- package/src/db/tables/templates.table.ts +70 -0
- package/src/engine/conditions.ts +30 -0
- package/src/engine/coverage.ts +67 -0
- package/src/engine/fallback-html.ts +116 -0
- package/src/engine/index.ts +7 -0
- package/src/engine/paths.ts +33 -0
- package/src/engine/resolve.ts +178 -0
- package/src/engine/tokens.ts +35 -0
- package/src/engine/walk.ts +18 -0
- package/src/hooks/index.ts +1 -0
- package/src/hooks/tenant-export.ts +127 -0
- package/src/implementations/dms-mailing/index.ts +2 -0
- package/src/index.ts +62 -0
- package/src/pages/editor.ts +23 -0
- package/src/pages/index.ts +11 -0
- package/src/pages/module.ts +9 -0
- package/src/pages/overview.ts +175 -0
- package/src/pages/sends.ts +174 -0
- package/src/pages/settings/form.ts +67 -0
- package/src/pages/settings/index.ts +2 -0
- package/src/pages/settings/page.ts +34 -0
- package/src/pages/templates.ts +141 -0
- package/src/permissions.ts +44 -0
- package/src/quick-actions.ts +20 -0
- package/src/realtime.ts +53 -0
- package/src/routes/events.ts +57 -0
- package/src/routes/index.ts +7 -0
- package/src/routes/metrics.ts +243 -0
- package/src/routes/period.ts +46 -0
- package/src/routes/provider.ts +31 -0
- package/src/routes/sends.ts +215 -0
- package/src/routes/settings.ts +66 -0
- package/src/routes/templates.ts +256 -0
- package/src/services/attention.ts +151 -0
- package/src/services/categories.ts +43 -0
- package/src/services/events.ts +121 -0
- package/src/services/metrics.ts +175 -0
- package/src/services/notify.ts +90 -0
- package/src/services/permissions.ts +42 -0
- package/src/services/provider.ts +46 -0
- package/src/services/render.ts +33 -0
- package/src/services/send.ts +409 -0
- package/src/services/settings.ts +74 -0
- package/src/services/status.ts +16 -0
- package/src/services/templates.ts +157 -0
- package/src/test/antelope.test.ts +188 -0
- package/src/test/helpers/http.ts +23 -0
- package/src/test/helpers/owner.ts +37 -0
- package/src/test/integration/events.test.ts +136 -0
- package/src/test/integration/retention.test.ts +363 -0
- package/src/test/integration/sends.test.ts +200 -0
- package/src/test/integration/settings.test.ts +50 -0
- package/src/test/integration/setup.test.ts +35 -0
- package/src/test/integration/templates.test.ts +229 -0
- package/src/test/integration/tenant-export.test.ts +125 -0
- package/src/test/unit/attention.test.ts +129 -0
- package/src/test/unit/automation.test.ts +130 -0
- package/src/test/unit/categories.test.ts +51 -0
- package/src/test/unit/engine/conditions.test.ts +35 -0
- package/src/test/unit/engine/coverage.test.ts +118 -0
- package/src/test/unit/engine/fallback-html.test.ts +86 -0
- package/src/test/unit/engine/paths.test.ts +39 -0
- package/src/test/unit/engine/resolve.test.ts +176 -0
- package/src/test/unit/engine/tokens.test.ts +26 -0
- package/src/test/unit/events.test.ts +19 -0
- package/src/test/unit/metrics.test.ts +170 -0
- package/src/test/unit/notify.test.ts +71 -0
- package/src/test/unit/period.test.ts +64 -0
- package/src/test/unit/provider.test.ts +57 -0
- package/src/test/unit/realtime.test.ts +11 -0
- package/src/test/unit/render.test.ts +23 -0
- package/src/test/unit/retention.test.ts +91 -0
- package/src/test/unit/send-batch.test.ts +72 -0
- package/src/test/unit/send.test.ts +161 -0
- package/src/test/unit/smoke.test.ts +8 -0
- package/src/test/unit/status.test.ts +14 -0
- package/src/test/unit/templates.test.ts +52 -0
- package/src/test/unit/tenant-export.test.ts +88 -0
- package/src/test/unit/webhook-secret.test.ts +50 -0
- package/src/types/blocks.ts +31 -0
- package/src/types/index.ts +4 -0
- package/src/types/resolved.ts +89 -0
- package/src/types/sends.ts +44 -0
- package/src/types/settings.ts +24 -0
- package/src/validation/settings.schema.ts +33 -0
- package/src/validation/templates.schema.ts +145 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
Copyright (c) 2025-present - AntelopeJS Team
|
|
179
|
+
|
|
180
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
181
|
+
you may not use this file except in compliance with the License.
|
|
182
|
+
You may obtain a copy of the License at
|
|
183
|
+
|
|
184
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
185
|
+
|
|
186
|
+
Unless required by applicable law or agreed to in writing, software
|
|
187
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
188
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
189
|
+
See the License for the specific language governing permissions and
|
|
190
|
+
limitations under the License.
|
package/README.md
ADDED
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
# @antelopejs/dms-mailing
|
|
2
|
+
|
|
3
|
+
<div align="center">
|
|
4
|
+
<a href="./LICENSE"><img alt="License" src="https://img.shields.io/badge/license-Apache--2.0-blue?style=for-the-badge&labelColor=000000"></a>
|
|
5
|
+
<a href="https://discord.gg/sjK28QHrA7"><img src="https://img.shields.io/badge/Discord-18181B?logo=discord&style=for-the-badge&color=000000" alt="Discord"></a>
|
|
6
|
+
<a href="https://antelopejs.com"><img src="https://img.shields.io/badge/Docs-18181B?style=for-the-badge&color=000000" alt="Documentation"></a>
|
|
7
|
+
</div>
|
|
8
|
+
|
|
9
|
+
Mailing module for the AntelopeJS DMS: a template library with a block-based
|
|
10
|
+
e-mail editor, a send log, an overview dashboard and
|
|
11
|
+
settings. It owns the data (tenant-scoped Mongo tables), renders e-mails
|
|
12
|
+
through the DMS html-render chain and sends them through
|
|
13
|
+
`@antelopejs/interface-email`.
|
|
14
|
+
|
|
15
|
+
## Layout
|
|
16
|
+
|
|
17
|
+
| Path | What it holds |
|
|
18
|
+
| --- | --- |
|
|
19
|
+
| `src/index.ts` | Module lifecycle (`construct`/`start`/`stop`/`destroy`); registers the Vue frontend module, the automation nodes, the tenant-export contributor, the realtime topics and the retention cron. |
|
|
20
|
+
| `src/pages/` | The DMS pages: `overview`, `templates`, `editor`, `sends` and the settings form. |
|
|
21
|
+
| `src/data/` | The `TableView` data controllers behind `/api/mailing/tables/*`. |
|
|
22
|
+
| `src/routes/` | The HTTP API under `/api/mailing` (templates, sends, events, metrics, settings, provider). |
|
|
23
|
+
| `src/engine/` | The pure-TS rendering engine: block tree + variables → resolved e-mail. |
|
|
24
|
+
| `../interface-dms-mailing/` | The separately published public AntelopeJS interface (see below). |
|
|
25
|
+
| `src/automation/` | The `dms-automation` action and trigger. |
|
|
26
|
+
| `src/crons/` | The daily, replay-safe send-log retention job. |
|
|
27
|
+
| `src/hooks/` | The tenant data export contributor. |
|
|
28
|
+
| `frontend-vue/` | Vue Inertia module: gallery display, detail drawers, block editor, `dms.email.ts` server template entry and the `mailing-*.json` i18n catalogs. |
|
|
29
|
+
| `playground/` | Standalone AntelopeJS project wiring this module to the DMS, Mongo, the API server and the mailer, for local development. |
|
|
30
|
+
|
|
31
|
+
## Public interface
|
|
32
|
+
|
|
33
|
+
Published as `@antelopejs/interface-dms-mailing`.
|
|
34
|
+
|
|
35
|
+
```ts
|
|
36
|
+
import {
|
|
37
|
+
RecordEmailEvent,
|
|
38
|
+
SendTemplate,
|
|
39
|
+
} from "@antelopejs/interface-dms-mailing";
|
|
40
|
+
|
|
41
|
+
// Render a live template and send it.
|
|
42
|
+
const result = await SendTemplate("order-confirmation", {
|
|
43
|
+
tenantId,
|
|
44
|
+
to: [{ email: "sofie@example.com", name: "Sofie" }],
|
|
45
|
+
locale: "fr",
|
|
46
|
+
variables: { order: { total: "48.00" } },
|
|
47
|
+
source: "checkout",
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
// Report a provider event against the send it belongs to.
|
|
51
|
+
await RecordEmailEvent(tenantId, {
|
|
52
|
+
provider: "brevo",
|
|
53
|
+
messageId,
|
|
54
|
+
type: "bounced",
|
|
55
|
+
details: { reason: "mailbox full" },
|
|
56
|
+
});
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
`SendTemplate` accepts one address or an array. With more than one recipient
|
|
60
|
+
and a provider that advertises `features.batch`, the module renders the e-mail
|
|
61
|
+
once and issues a single `SendBatch`; otherwise it loops `Send`. Either way one
|
|
62
|
+
row per recipient lands in the send log, and the returned
|
|
63
|
+
`SendTemplateResult` describes the first one.
|
|
64
|
+
|
|
65
|
+
## Webhook contract
|
|
66
|
+
|
|
67
|
+
Provider events are posted to `POST /api/mailing/events/:provider`, guarded by
|
|
68
|
+
the `x-mailing-webhook-secret` header (the secret lives in the mailing
|
|
69
|
+
settings, per tenant).
|
|
70
|
+
|
|
71
|
+
```sh
|
|
72
|
+
curl -X POST http://localhost:5010/api/mailing/events/brevo \
|
|
73
|
+
-H "Content-Type: application/json" \
|
|
74
|
+
-H "x-mailing-webhook-secret: <settings.webhookSecret>" \
|
|
75
|
+
-d '{"messageId":"<provider message id>","type":"bounced","at":"2026-09-09T10:00:00.000Z","details":{"reason":"mailbox full"}}'
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
`type` is one of `queued`, `sent`, `delivered`, `opened`, `clicked`,
|
|
79
|
+
`bounced`, `spam`, `failed`, `unsubscribed`. The event is appended to the
|
|
80
|
+
send's timeline, the send status only ever moves forward, and a `bounced`,
|
|
81
|
+
`spam` or `failed` event notifies the tenant owners in the DMS bell.
|
|
82
|
+
|
|
83
|
+
## Retention
|
|
84
|
+
|
|
85
|
+
The daily sweep retires sends only when their creation time, latest event time
|
|
86
|
+
and latest ingested activity all precede the tenant's retention cutoff. Queued
|
|
87
|
+
sends remain active. Retirement irreversibly closes a send to provider events;
|
|
88
|
+
the sweep then removes its events and finally the send. A failed cleanup leaves
|
|
89
|
+
the retirement marker available for another sweep to resume.
|
|
90
|
+
|
|
91
|
+
Concurrent sweeps require no shared cron lock. Send mutations use the database
|
|
92
|
+
interface's `Table.atomicMutation` revision contract. Retirement rechecks the
|
|
93
|
+
send's age and activity before comparing its revision; concurrent webhook
|
|
94
|
+
activity advances that revision and invalidates the stale candidate. Known
|
|
95
|
+
webhook conflicts reread and recompute counters, with a bounded retry limit.
|
|
96
|
+
An unknown write outcome fails without retrying or reporting a deletion.
|
|
97
|
+
|
|
98
|
+
This requires the atomic-mutation interface and adapter implementations; generic
|
|
99
|
+
filtered updates and deletes are not an alternative. The dependency releases
|
|
100
|
+
are prerequisites for rollout. Every send is inserted with a unique identity and
|
|
101
|
+
revision, stored in the declared `revision` column.
|
|
102
|
+
|
|
103
|
+
Each sweep inspects at most 20,000 send candidates per tenant and reports only
|
|
104
|
+
actual send deletions. It also reconciles orphan events left by writers that
|
|
105
|
+
crashed after inserting an event for an already-deleted send. That reconciliation
|
|
106
|
+
scans the event table in keyset pages of 500 rows, with a parent lookup per
|
|
107
|
+
distinct send in each page; its total work is not capped by the send limit.
|
|
108
|
+
Event writes create the parent first and never reuse deleted send IDs. Neither
|
|
109
|
+
retention path deletes templates or files. Disabled retention skips both passes.
|
|
110
|
+
|
|
111
|
+
## Automation nodes
|
|
112
|
+
|
|
113
|
+
Registered against the optional `@antelopejs/interface-dms-automation`.
|
|
114
|
+
They are inert no-ops when no module implements it.
|
|
115
|
+
|
|
116
|
+
| Node | Id | Purpose |
|
|
117
|
+
| --- | --- | --- |
|
|
118
|
+
| Action | `mailing.send-template` | Renders a live template and sends it. Inputs `tenantId`, `slug`, `to` (required), `locale`, `variables`, `source`. |
|
|
119
|
+
| Trigger | `mailing.email-event` | Fires on provider events. Config `types` filters the event types; empty fires on every one. |
|
|
120
|
+
|
|
121
|
+
## Development
|
|
122
|
+
|
|
123
|
+
```sh
|
|
124
|
+
pnpm install
|
|
125
|
+
pnpm --dir frontend-vue install
|
|
126
|
+
pnpm --dir playground install
|
|
127
|
+
|
|
128
|
+
pnpm dev # backend + module, watching src/
|
|
129
|
+
pnpm frontend:dev # the DMS front-end, in another terminal
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
The backend listens on `http://localhost:5010` and needs a MongoDB on
|
|
133
|
+
`mongodb://localhost:27017` (database `playground_dms_mailing`).
|
|
134
|
+
|
|
135
|
+
Both packages are public on npm, published under the `@antelopejs` scope with
|
|
136
|
+
npm trusted publishing and provenance. The interface package must be released
|
|
137
|
+
before `@antelopejs/dms-mailing`. Each package has its own manual workflow:
|
|
138
|
+
`Release DMS mailing interface` publishes `../interface-dms-mailing`, `Release
|
|
139
|
+
DMS mailing module` publishes this package and refuses to run until the
|
|
140
|
+
interface version its dependency range is floored at resolves on npm. Inside
|
|
141
|
+
the workspace that same range resolves to the sibling package, through
|
|
142
|
+
`link-workspace-packages`.
|
|
143
|
+
|
|
144
|
+
## Conventions
|
|
145
|
+
|
|
146
|
+
Every backend-declared text uses the `$key` convention: a string starting with
|
|
147
|
+
`$` is resolved against the i18n catalogs by the front-end. Add keys to
|
|
148
|
+
`frontend-vue/i18n/locales/mailing-en-GB.json` and its French counterpart.
|
|
149
|
+
|
|
150
|
+
## Checks
|
|
151
|
+
|
|
152
|
+
```sh
|
|
153
|
+
pnpm lint # oxlint + oxfmt + the layer's eslint
|
|
154
|
+
pnpm typecheck # tsconfig.json (the one editors and the type-aware lint read)
|
|
155
|
+
pnpm knip # unused dependencies
|
|
156
|
+
pnpm build # tsconfig.build.json -> dist/
|
|
157
|
+
pnpm test # backend (mocha through `ajs module test`) + layer (vitest)
|
|
158
|
+
pnpm test:frontend # generated client/SSR/email builds and Vue typecheck
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
The frontend check uses the published DMS and frontend adapter packages. It
|
|
162
|
+
renders English/French email fixtures locally and does not send email.
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
export declare const SHARED_MODULE_SOURCES: {
|
|
2
|
+
readonly dms: {
|
|
3
|
+
readonly type: "package";
|
|
4
|
+
readonly package: "@antelopejs/dms";
|
|
5
|
+
readonly version: ">=0.0.1 <1.0.0";
|
|
6
|
+
};
|
|
7
|
+
readonly mongodb: {
|
|
8
|
+
readonly type: "package";
|
|
9
|
+
readonly package: "@antelopejs/mongodb";
|
|
10
|
+
readonly version: "^1.3.0";
|
|
11
|
+
};
|
|
12
|
+
readonly "auth-jwt": {
|
|
13
|
+
readonly type: "package";
|
|
14
|
+
readonly package: "@antelopejs/auth-jwt";
|
|
15
|
+
readonly version: "^1.0.3";
|
|
16
|
+
};
|
|
17
|
+
readonly api: {
|
|
18
|
+
readonly type: "package";
|
|
19
|
+
readonly package: "@antelopejs/api";
|
|
20
|
+
readonly version: "1.2.5";
|
|
21
|
+
};
|
|
22
|
+
readonly "file-storage-local": {
|
|
23
|
+
readonly type: "package";
|
|
24
|
+
readonly package: "@antelopejs/file-storage-local";
|
|
25
|
+
readonly version: "^0.1.4";
|
|
26
|
+
};
|
|
27
|
+
readonly nodemailer: {
|
|
28
|
+
readonly type: "package";
|
|
29
|
+
readonly package: "@antelopejs/nodemailer";
|
|
30
|
+
readonly version: "^0.0.4";
|
|
31
|
+
};
|
|
32
|
+
};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SHARED_MODULE_SOURCES = void 0;
|
|
4
|
+
exports.SHARED_MODULE_SOURCES = {
|
|
5
|
+
dms: {
|
|
6
|
+
type: "package",
|
|
7
|
+
package: "@antelopejs/dms",
|
|
8
|
+
version: ">=0.0.1 <1.0.0",
|
|
9
|
+
},
|
|
10
|
+
mongodb: {
|
|
11
|
+
type: "package",
|
|
12
|
+
package: "@antelopejs/mongodb",
|
|
13
|
+
version: "^1.3.0",
|
|
14
|
+
},
|
|
15
|
+
"auth-jwt": {
|
|
16
|
+
type: "package",
|
|
17
|
+
package: "@antelopejs/auth-jwt",
|
|
18
|
+
version: "^1.0.3",
|
|
19
|
+
},
|
|
20
|
+
api: {
|
|
21
|
+
type: "package",
|
|
22
|
+
package: "@antelopejs/api",
|
|
23
|
+
version: "1.2.5",
|
|
24
|
+
},
|
|
25
|
+
"file-storage-local": {
|
|
26
|
+
type: "package",
|
|
27
|
+
package: "@antelopejs/file-storage-local",
|
|
28
|
+
version: "^0.1.4",
|
|
29
|
+
},
|
|
30
|
+
nodemailer: {
|
|
31
|
+
type: "package",
|
|
32
|
+
package: "@antelopejs/nodemailer",
|
|
33
|
+
version: "^0.0.4",
|
|
34
|
+
},
|
|
35
|
+
};
|
|
36
|
+
//# sourceMappingURL=antelope-modules.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"antelope-modules.js","sourceRoot":"","sources":["../src/antelope-modules.ts"],"names":[],"mappings":";;;AAgBa,QAAA,qBAAqB,GAAG;IACnC,GAAG,EAAE;QACH,IAAI,EAAE,SAAS;QACf,OAAO,EAAE,iBAAiB;QAC1B,OAAO,EAAE,gBAAgB;KAC1B;IACD,OAAO,EAAE;QACP,IAAI,EAAE,SAAS;QACf,OAAO,EAAE,qBAAqB;QAC9B,OAAO,EAAE,QAAQ;KAClB;IACD,UAAU,EAAE;QACV,IAAI,EAAE,SAAS;QACf,OAAO,EAAE,sBAAsB;QAC/B,OAAO,EAAE,QAAQ;KAClB;IACD,GAAG,EAAE;QACH,IAAI,EAAE,SAAS;QACf,OAAO,EAAE,iBAAiB;QAC1B,OAAO,EAAE,OAAO;KACjB;IACD,oBAAoB,EAAE;QACpB,IAAI,EAAE,SAAS;QACf,OAAO,EAAE,gCAAgC;QACzC,OAAO,EAAE,QAAQ;KAClB;IACD,UAAU,EAAE;QACV,IAAI,EAAE,SAAS;QACf,OAAO,EAAE,wBAAwB;QACjC,OAAO,EAAE,QAAQ;KAClB;CACO,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { TriggerType } from "@antelopejs/interface-dms-automation";
|
|
2
|
+
import { type SendEventType } from "../types";
|
|
3
|
+
export interface EmailEventPayload {
|
|
4
|
+
tenantId: string;
|
|
5
|
+
sendId: string;
|
|
6
|
+
templateSlug: string;
|
|
7
|
+
type: SendEventType;
|
|
8
|
+
recipientEmail: string;
|
|
9
|
+
}
|
|
10
|
+
export interface EmailEventTriggerConfig {
|
|
11
|
+
types?: SendEventType[];
|
|
12
|
+
}
|
|
13
|
+
export declare const EMAIL_EVENT_TRIGGER_ID = "mailing.email-event";
|
|
14
|
+
export declare function emitEmailEvent(payload: EmailEventPayload): void;
|
|
15
|
+
export declare function clearEmailEventSubscriptions(): void;
|
|
16
|
+
export declare const emailEventTrigger: TriggerType<EmailEventTriggerConfig, EmailEventPayload>;
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.emailEventTrigger = exports.EMAIL_EVENT_TRIGGER_ID = void 0;
|
|
4
|
+
exports.emitEmailEvent = emitEmailEvent;
|
|
5
|
+
exports.clearEmailEventSubscriptions = clearEmailEventSubscriptions;
|
|
6
|
+
const logging_1 = require("@antelopejs/interface-core/logging");
|
|
7
|
+
const types_1 = require("../types");
|
|
8
|
+
exports.EMAIL_EVENT_TRIGGER_ID = "mailing.email-event";
|
|
9
|
+
const CONFIG_SCHEMA = {
|
|
10
|
+
type: "object",
|
|
11
|
+
properties: {
|
|
12
|
+
types: {
|
|
13
|
+
type: "array",
|
|
14
|
+
items: { type: "string", enum: types_1.SEND_STATUSES },
|
|
15
|
+
description: "Event types the trigger fires on. Leave empty to fire on every event.",
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
};
|
|
19
|
+
const OUTPUT_SCHEMA = {
|
|
20
|
+
type: "object",
|
|
21
|
+
properties: {
|
|
22
|
+
tenantId: { type: "string" },
|
|
23
|
+
sendId: { type: "string" },
|
|
24
|
+
templateSlug: { type: "string" },
|
|
25
|
+
type: { type: "string", enum: types_1.SEND_STATUSES },
|
|
26
|
+
recipientEmail: { type: "string" },
|
|
27
|
+
},
|
|
28
|
+
};
|
|
29
|
+
const FIRST_SUBSCRIPTION_INDEX = 1;
|
|
30
|
+
const SUBSCRIPTION_FAILURE_PREFIX = "[dms-mailing] E-mail event subscription";
|
|
31
|
+
const subscriptions = new Map();
|
|
32
|
+
let nextSubscriptionIndex = FIRST_SUBSCRIPTION_INDEX;
|
|
33
|
+
const accepts = (subscription, payload) => subscription.types.length === 0 || subscription.types.includes(payload.type);
|
|
34
|
+
function deliver(handle, subscription, payload) {
|
|
35
|
+
try {
|
|
36
|
+
subscription.emit(payload);
|
|
37
|
+
}
|
|
38
|
+
catch (error) {
|
|
39
|
+
logging_1.Logging.Warn(`${SUBSCRIPTION_FAILURE_PREFIX} "${handle}" failed on a "${payload.type}" event:`, error);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
function emitEmailEvent(payload) {
|
|
43
|
+
for (const [handle, subscription] of subscriptions) {
|
|
44
|
+
if (accepts(subscription, payload))
|
|
45
|
+
deliver(handle, subscription, payload);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
function clearEmailEventSubscriptions() {
|
|
49
|
+
subscriptions.clear();
|
|
50
|
+
}
|
|
51
|
+
exports.emailEventTrigger = {
|
|
52
|
+
id: exports.EMAIL_EVENT_TRIGGER_ID,
|
|
53
|
+
name: "E-mail event",
|
|
54
|
+
description: "Fires when a provider reports a delivery event on a mailing send",
|
|
55
|
+
icon: "i-ph-bell-ringing",
|
|
56
|
+
cluster: "replicated",
|
|
57
|
+
configSchema: CONFIG_SCHEMA,
|
|
58
|
+
outputSchema: OUTPUT_SCHEMA,
|
|
59
|
+
activate(config, emit) {
|
|
60
|
+
const handle = `${exports.EMAIL_EVENT_TRIGGER_ID}:${nextSubscriptionIndex}`;
|
|
61
|
+
nextSubscriptionIndex += 1;
|
|
62
|
+
subscriptions.set(handle, { types: config?.types ?? [], emit });
|
|
63
|
+
return Promise.resolve(handle);
|
|
64
|
+
},
|
|
65
|
+
deactivate(handle) {
|
|
66
|
+
subscriptions.delete(String(handle));
|
|
67
|
+
return Promise.resolve();
|
|
68
|
+
},
|
|
69
|
+
};
|
|
70
|
+
//# sourceMappingURL=email-event-trigger.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"email-event-trigger.js","sourceRoot":"","sources":["../../src/automation/email-event-trigger.ts"],"names":[],"mappings":";;;AA8EA,wCAIC;AAGD,oEAEC;AAvFD,gEAA6D;AAK7D,oCAA6D;AAmBhD,QAAA,sBAAsB,GAAG,qBAAqB,CAAC;AAE5D,MAAM,aAAa,GAAe;IAChC,IAAI,EAAE,QAAQ;IACd,UAAU,EAAE;QACV,KAAK,EAAE;YACL,IAAI,EAAE,OAAO;YACb,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,qBAAa,EAAE;YAC9C,WAAW,EACT,uEAAuE;SAC1E;KACF;CACF,CAAC;AAEF,MAAM,aAAa,GAAe;IAChC,IAAI,EAAE,QAAQ;IACd,UAAU,EAAE;QACV,QAAQ,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;QAC5B,MAAM,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;QAC1B,YAAY,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;QAChC,IAAI,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,qBAAa,EAAE;QAC7C,cAAc,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;KACnC;CACF,CAAC;AAEF,MAAM,wBAAwB,GAAG,CAAC,CAAC;AAEnC,MAAM,2BAA2B,GAAG,yCAAyC,CAAC;AAE9E,MAAM,aAAa,GAAG,IAAI,GAAG,EAAkC,CAAC;AAEhE,IAAI,qBAAqB,GAAG,wBAAwB,CAAC;AAErD,MAAM,OAAO,GAAG,CACd,YAAoC,EACpC,OAA0B,EACjB,EAAE,CACX,YAAY,CAAC,KAAK,CAAC,MAAM,KAAK,CAAC,IAAI,YAAY,CAAC,KAAK,CAAC,QAAQ,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;AAE/E,SAAS,OAAO,CACd,MAAc,EACd,YAAoC,EACpC,OAA0B;IAE1B,IAAI,CAAC;QACH,YAAY,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAC7B,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,iBAAO,CAAC,IAAI,CACV,GAAG,2BAA2B,KAAK,MAAM,kBAAkB,OAAO,CAAC,IAAI,UAAU,EACjF,KAAK,CACN,CAAC;IACJ,CAAC;AACH,CAAC;AAED,SAAgB,cAAc,CAAC,OAA0B;IACvD,KAAK,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,IAAI,aAAa,EAAE,CAAC;QACnD,IAAI,OAAO,CAAC,YAAY,EAAE,OAAO,CAAC;YAAE,OAAO,CAAC,MAAM,EAAE,YAAY,EAAE,OAAO,CAAC,CAAC;IAC7E,CAAC;AACH,CAAC;AAGD,SAAgB,4BAA4B;IAC1C,aAAa,CAAC,KAAK,EAAE,CAAC;AACxB,CAAC;AAEY,QAAA,iBAAiB,GAG1B;IACF,EAAE,EAAE,8BAAsB;IAC1B,IAAI,EAAE,cAAc;IACpB,WAAW,EACT,kEAAkE;IACpE,IAAI,EAAE,mBAAmB;IACzB,OAAO,EAAE,YAAY;IACrB,YAAY,EAAE,aAAa;IAC3B,YAAY,EAAE,aAAa;IAC3B,QAAQ,CAAC,MAAM,EAAE,IAAI;QACnB,MAAM,MAAM,GAAG,GAAG,8BAAsB,IAAI,qBAAqB,EAAE,CAAC;QACpE,qBAAqB,IAAI,CAAC,CAAC;QAC3B,aAAa,CAAC,GAAG,CAAC,MAAM,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,IAAI,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC;QAChE,OAAO,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;IACjC,CAAC;IACD,UAAU,CAAC,MAAM;QACf,aAAa,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC;QACrC,OAAO,OAAO,CAAC,OAAO,EAAE,CAAC;IAC3B,CAAC;CACF,CAAC"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.registerAutomationNodes = registerAutomationNodes;
|
|
18
|
+
exports.unregisterAutomationNodes = unregisterAutomationNodes;
|
|
19
|
+
const interface_dms_automation_1 = require("@antelopejs/interface-dms-automation");
|
|
20
|
+
const email_event_trigger_1 = require("./email-event-trigger");
|
|
21
|
+
const send_template_action_1 = require("./send-template-action");
|
|
22
|
+
__exportStar(require("./email-event-trigger"), exports);
|
|
23
|
+
__exportStar(require("./send-template-action"), exports);
|
|
24
|
+
const TRIGGERS = [email_event_trigger_1.emailEventTrigger];
|
|
25
|
+
const ACTIONS = [send_template_action_1.sendTemplateAction];
|
|
26
|
+
function registerAutomationNodes() {
|
|
27
|
+
for (const trigger of TRIGGERS)
|
|
28
|
+
(0, interface_dms_automation_1.RegisterTriggerType)(trigger);
|
|
29
|
+
for (const action of ACTIONS)
|
|
30
|
+
(0, interface_dms_automation_1.RegisterActionType)(action);
|
|
31
|
+
}
|
|
32
|
+
function unregisterAutomationNodes() {
|
|
33
|
+
for (const trigger of TRIGGERS)
|
|
34
|
+
(0, interface_dms_automation_1.UnregisterTriggerType)(trigger.id);
|
|
35
|
+
for (const action of ACTIONS)
|
|
36
|
+
(0, interface_dms_automation_1.UnregisterActionType)(action.id);
|
|
37
|
+
(0, email_event_trigger_1.clearEmailEventSubscriptions)();
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/automation/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAuBA,0DAGC;AAED,8DAIC;AAhCD,mFAK8C;AAC9C,+DAG+B;AAC/B,iEAA4D;AAE5D,wDAAsC;AACtC,yDAAuC;AAEvC,MAAM,QAAQ,GAAG,CAAC,uCAAiB,CAAC,CAAC;AACrC,MAAM,OAAO,GAAG,CAAC,yCAAkB,CAAC,CAAC;AAOrC,SAAgB,uBAAuB;IACrC,KAAK,MAAM,OAAO,IAAI,QAAQ;QAAE,IAAA,8CAAmB,EAAC,OAAO,CAAC,CAAC;IAC7D,KAAK,MAAM,MAAM,IAAI,OAAO;QAAE,IAAA,6CAAkB,EAAC,MAAM,CAAC,CAAC;AAC3D,CAAC;AAED,SAAgB,yBAAyB;IACvC,KAAK,MAAM,OAAO,IAAI,QAAQ;QAAE,IAAA,gDAAqB,EAAC,OAAO,CAAC,EAAE,CAAC,CAAC;IAClE,KAAK,MAAM,MAAM,IAAI,OAAO;QAAE,IAAA,+CAAoB,EAAC,MAAM,CAAC,EAAE,CAAC,CAAC;IAC9D,IAAA,kDAA4B,GAAE,CAAC;AACjC,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { ActionType } from "@antelopejs/interface-dms-automation";
|
|
2
|
+
import type { EmailAddress } from "@antelopejs/interface-email";
|
|
3
|
+
import type { SendTemplateResult } from "@antelopejs/interface-dms-mailing";
|
|
4
|
+
export interface SendTemplateActionInput {
|
|
5
|
+
tenantId: string;
|
|
6
|
+
slug: string;
|
|
7
|
+
to: EmailAddress | EmailAddress[];
|
|
8
|
+
locale?: string;
|
|
9
|
+
variables?: Record<string, unknown>;
|
|
10
|
+
source?: string;
|
|
11
|
+
}
|
|
12
|
+
export declare const SEND_TEMPLATE_ACTION_ID = "mailing.send-template";
|
|
13
|
+
export declare const sendTemplateAction: ActionType<SendTemplateActionInput, SendTemplateResult>;
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.sendTemplateAction = exports.SEND_TEMPLATE_ACTION_ID = void 0;
|
|
4
|
+
const send_1 = require("../services/send");
|
|
5
|
+
const types_1 = require("../types");
|
|
6
|
+
exports.SEND_TEMPLATE_ACTION_ID = "mailing.send-template";
|
|
7
|
+
const AUTOMATION_SOURCE_PREFIX = "automation:";
|
|
8
|
+
const INPUT_SCHEMA = {
|
|
9
|
+
type: "object",
|
|
10
|
+
properties: {
|
|
11
|
+
tenantId: { type: "string" },
|
|
12
|
+
slug: { type: "string", description: "Slug of the live mailing template" },
|
|
13
|
+
to: {
|
|
14
|
+
type: ["string", "array"],
|
|
15
|
+
items: { type: "string" },
|
|
16
|
+
description: "Recipient address, or the list of addresses to send to",
|
|
17
|
+
},
|
|
18
|
+
locale: { type: "string" },
|
|
19
|
+
variables: { type: "object" },
|
|
20
|
+
source: { type: "string" },
|
|
21
|
+
},
|
|
22
|
+
required: ["tenantId", "slug", "to"],
|
|
23
|
+
};
|
|
24
|
+
const RESULT_PROPERTIES = {
|
|
25
|
+
sendId: { type: "string" },
|
|
26
|
+
status: { type: "string", enum: types_1.SEND_STATUSES },
|
|
27
|
+
messageId: { type: "string" },
|
|
28
|
+
error: { type: "string" },
|
|
29
|
+
};
|
|
30
|
+
const OUTPUT_SCHEMA = {
|
|
31
|
+
type: "object",
|
|
32
|
+
properties: {
|
|
33
|
+
...RESULT_PROPERTIES,
|
|
34
|
+
results: {
|
|
35
|
+
type: "array",
|
|
36
|
+
description: "One entry per recipient",
|
|
37
|
+
items: { type: "object", properties: RESULT_PROPERTIES },
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
};
|
|
41
|
+
const failedRecipients = (result) => (result.results ?? [result]).filter((entry) => entry.status === "failed");
|
|
42
|
+
exports.sendTemplateAction = {
|
|
43
|
+
id: exports.SEND_TEMPLATE_ACTION_ID,
|
|
44
|
+
name: "Send e-mail template",
|
|
45
|
+
description: "Render a live mailing template and send it to a recipient",
|
|
46
|
+
icon: "i-ph-envelope-simple",
|
|
47
|
+
inputSchema: INPUT_SCHEMA,
|
|
48
|
+
outputSchema: OUTPUT_SCHEMA,
|
|
49
|
+
async execute(input, ctx) {
|
|
50
|
+
const source = input.source ?? `${AUTOMATION_SOURCE_PREFIX}${ctx.procedureId}`;
|
|
51
|
+
try {
|
|
52
|
+
const result = await (0, send_1.sendTemplate)(input.slug, {
|
|
53
|
+
tenantId: input.tenantId,
|
|
54
|
+
to: input.to,
|
|
55
|
+
locale: input.locale,
|
|
56
|
+
variables: input.variables,
|
|
57
|
+
source,
|
|
58
|
+
});
|
|
59
|
+
const failures = failedRecipients(result);
|
|
60
|
+
if (failures.length > 0) {
|
|
61
|
+
ctx.log("error", `Template "${input.slug}" was rejected for ${failures.length} recipient(s)`, failures);
|
|
62
|
+
}
|
|
63
|
+
return result;
|
|
64
|
+
}
|
|
65
|
+
catch (error) {
|
|
66
|
+
ctx.log("error", `Template "${input.slug}" could not be sent`, error);
|
|
67
|
+
throw error;
|
|
68
|
+
}
|
|
69
|
+
},
|
|
70
|
+
};
|
|
71
|
+
//# sourceMappingURL=send-template-action.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"send-template-action.js","sourceRoot":"","sources":["../../src/automation/send-template-action.ts"],"names":[],"mappings":";;;AAMA,2CAAgD;AAChD,oCAAyC;AAW5B,QAAA,uBAAuB,GAAG,uBAAuB,CAAC;AAE/D,MAAM,wBAAwB,GAAG,aAAa,CAAC;AAE/C,MAAM,YAAY,GAAe;IAC/B,IAAI,EAAE,QAAQ;IACd,UAAU,EAAE;QACV,QAAQ,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;QAC5B,IAAI,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,mCAAmC,EAAE;QAI1E,EAAE,EAAE;YACF,IAAI,EAAE,CAAC,QAAQ,EAAE,OAAO,CAAC;YACzB,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;YACzB,WAAW,EAAE,wDAAwD;SACtE;QACD,MAAM,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;QAC1B,SAAS,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;QAC7B,MAAM,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;KAC3B;IACD,QAAQ,EAAE,CAAC,UAAU,EAAE,MAAM,EAAE,IAAI,CAAC;CACrC,CAAC;AAEF,MAAM,iBAAiB,GAAe;IACpC,MAAM,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;IAC1B,MAAM,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,qBAAa,EAAE;IAC/C,SAAS,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;IAC7B,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;CAC1B,CAAC;AAEF,MAAM,aAAa,GAAe;IAChC,IAAI,EAAE,QAAQ;IACd,UAAU,EAAE;QACV,GAAG,iBAAiB;QACpB,OAAO,EAAE;YACP,IAAI,EAAE,OAAO;YACb,WAAW,EAAE,yBAAyB;YACtC,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,UAAU,EAAE,iBAAiB,EAAE;SACzD;KACF;CACF,CAAC;AAEF,MAAM,gBAAgB,GAAG,CAAC,MAA0B,EAAwB,EAAE,CAC5E,CAAC,MAAM,CAAC,OAAO,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,MAAM,KAAK,QAAQ,CAAC,CAAC;AAE/D,QAAA,kBAAkB,GAG3B;IACF,EAAE,EAAE,+BAAuB;IAC3B,IAAI,EAAE,sBAAsB;IAC5B,WAAW,EAAE,2DAA2D;IACxE,IAAI,EAAE,sBAAsB;IAC5B,WAAW,EAAE,YAAY;IACzB,YAAY,EAAE,aAAa;IAC3B,KAAK,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG;QACtB,MAAM,MAAM,GACV,KAAK,CAAC,MAAM,IAAI,GAAG,wBAAwB,GAAG,GAAG,CAAC,WAAW,EAAE,CAAC;QAClE,IAAI,CAAC;YACH,MAAM,MAAM,GAAG,MAAM,IAAA,mBAAY,EAAC,KAAK,CAAC,IAAI,EAAE;gBAC5C,QAAQ,EAAE,KAAK,CAAC,QAAQ;gBACxB,EAAE,EAAE,KAAK,CAAC,EAAE;gBACZ,MAAM,EAAE,KAAK,CAAC,MAAM;gBACpB,SAAS,EAAE,KAAK,CAAC,SAAS;gBAC1B,MAAM;aACP,CAAC,CAAC;YACH,MAAM,QAAQ,GAAG,gBAAgB,CAAC,MAAM,CAAC,CAAC;YAC1C,IAAI,QAAQ,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;gBACxB,GAAG,CAAC,GAAG,CACL,OAAO,EACP,aAAa,KAAK,CAAC,IAAI,sBAAsB,QAAQ,CAAC,MAAM,eAAe,EAC3E,QAAQ,CACT,CAAC;YACJ,CAAC;YACD,OAAO,MAAM,CAAC;QAChB,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,GAAG,CAAC,GAAG,CAAC,OAAO,EAAE,aAAa,KAAK,CAAC,IAAI,qBAAqB,EAAE,KAAK,CAAC,CAAC;YACtE,MAAM,KAAK,CAAC;QACd,CAAC;IACH,CAAC;CACF,CAAC"}
|