@visulima/email 1.0.0-alpha.9 → 1.0.0
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/CHANGELOG.md +775 -0
- package/LICENSE.md +541 -847
- package/README.md +212 -191
- package/dist/crypto/index.d.ts +304 -4
- package/dist/crypto/index.js +1 -1
- package/dist/deliverability/dmarc-report.d.ts +95 -0
- package/dist/deliverability/dmarc-report.js +1 -0
- package/dist/deliverability/index.d.ts +360 -0
- package/dist/deliverability/index.js +1 -0
- package/dist/events/index.d.ts +31 -0
- package/dist/events/index.js +1 -0
- package/dist/inbound/index.d.ts +375 -0
- package/dist/inbound/index.js +1 -0
- package/dist/index.d.ts +94 -9
- package/dist/index.js +1 -1
- package/dist/middleware/index.d.ts +346 -0
- package/dist/middleware/index.js +1 -0
- package/dist/packem_shared/ALL_EVENTS-3kwh5CBE.js +1 -0
- package/dist/packem_shared/DkimSigner-BuSbnos1.js +18 -0
- package/dist/packem_shared/DraftMailMessage-BxqGSLMN.js +1 -0
- package/dist/packem_shared/EmailError-B-sEf3bp.js +1 -0
- package/dist/packem_shared/Mail-BEuzrB00.js +1 -0
- package/dist/packem_shared/MailMessage-D9k5gYrd.js +1 -0
- package/dist/packem_shared/MemoryEventStore-CuhfO9aj.js +1 -0
- package/dist/packem_shared/MemoryQueue-Dl1Fa6OJ.js +1 -0
- package/dist/packem_shared/MemorySuppressionStore-DZnbz-_B.js +1 -0
- package/dist/packem_shared/RATE_LIMIT_PRESETS-BPADLgcA.js +1 -0
- package/dist/packem_shared/RequiredOptionError-DuNNY_a5.js +1 -0
- package/dist/packem_shared/SmimeEncrypter-C7usORKF.js +6 -0
- package/dist/packem_shared/SmimeSigner-DgAApLPS.js +8 -0
- package/dist/packem_shared/addDarkModeSupport-DZYxULjl.js +1 -0
- package/dist/packem_shared/address-formatter-BWR2Dddx.js +1 -0
- package/dist/packem_shared/aggregate-features-BqEjPd42.js +1 -0
- package/dist/packem_shared/ahaSendProvider-D81_wUA1.js +1 -0
- package/dist/packem_shared/arcMessageSignatureBase-BY4j0TxM.js +17 -0
- package/dist/packem_shared/attachment-processor-CMp7qqMI.js +1 -0
- package/dist/packem_shared/awsSesProvider-BGZJUIep.js +32 -0
- package/dist/packem_shared/azureProvider-CmcK4bsf.js +1 -0
- package/dist/packem_shared/brevoProvider-C1BDXr41.js +1 -0
- package/dist/packem_shared/build-mime-message-B6927SQy.js +3 -0
- package/dist/packem_shared/buildListUnsubscribe-Cdr8MvR_.js +1 -0
- package/dist/packem_shared/buildMtaStsPolicy-oEQg8y_C.js +6 -0
- package/dist/packem_shared/circuitBreakerMiddleware-D2SA_07f.js +1 -0
- package/dist/packem_shared/cloudflareEmailProvider-Bv-ty-74.js +1 -0
- package/dist/packem_shared/composeMiddleware-BHwLLEzK.js +1 -0
- package/dist/packem_shared/create-logger-BQTS3f-I.js +1 -0
- package/dist/packem_shared/createSuppressionStore-CeAZKCbY.js +1 -0
- package/dist/packem_shared/createTestEmail-CF_RUjqo.js +1 -0
- package/dist/packem_shared/createWorker-_-yMWcNQ.js +1 -0
- package/dist/packem_shared/dedupeMiddleware-B6ajWOTi.js +1 -0
- package/dist/packem_shared/defineInboundHandler-CnL2BzlL.js +1 -0
- package/dist/packem_shared/defineProvider-C9q-7iwt.js +1 -0
- package/dist/packem_shared/detectMimeType-Dxv4MjZ7.js +1 -0
- package/dist/packem_shared/emailMatchers-DZDkrZ_3.js +1 -0
- package/dist/packem_shared/event-bus.d-DEl3w_EW.d.ts +104 -0
- package/dist/packem_shared/extractCidReferences-BuoTREMp.js +1 -0
- package/dist/packem_shared/extractReply-BUjIBt9A.js +5 -0
- package/dist/packem_shared/failoverProvider-BgX6zfnY.js +1 -0
- package/dist/packem_shared/format-address-DTl-9O70.js +1 -0
- package/dist/packem_shared/generate-boundary-DQbzDiOI.js +1 -0
- package/dist/packem_shared/generate-message-id-gXAuMz4g.js +1 -0
- package/dist/packem_shared/headers-to-record-De1Eg951.js +1 -0
- package/dist/packem_shared/httpProvider-DJAsYSun.js +1 -0
- package/dist/packem_shared/index-yDU-1zOZ.js +11 -0
- package/dist/packem_shared/infobipProvider-lHyGrXgZ.js +1 -0
- package/dist/packem_shared/injectPreheader-CF9WHZ7J.js +1 -0
- package/dist/packem_shared/inlineCss-BQ7d2Cyz.js +1 -0
- package/dist/packem_shared/isValidSigningCertUrl-Bii1AMGC.js +3 -0
- package/dist/packem_shared/loggingMiddleware-CZIiVMVp.js +1 -0
- package/dist/packem_shared/loopsProvider-DyloxzNC.js +1 -0
- package/dist/packem_shared/mail.d-B9SSqyy0.d.ts +909 -0
- package/dist/packem_shared/{mailCrabProvider-CM_CFDca.js → mailCrabProvider-CPtBT6Th.js} +1 -1
- package/dist/packem_shared/mailPaceProvider-CJEvOFBh.js +1 -0
- package/dist/packem_shared/mailchannelsProvider-osRkW_tz.js +1 -0
- package/dist/packem_shared/mailerSendProvider-C_6LzARK.js +1 -0
- package/dist/packem_shared/mailgunProvider-DkISvMPe.js +1 -0
- package/dist/packem_shared/mailjetProvider-CV0i4Xzh.js +1 -0
- package/dist/packem_shared/mailomatProvider-B5YFonEO.js +1 -0
- package/dist/packem_shared/mailtrapProvider-C4ZquIPz.js +1 -0
- package/dist/packem_shared/make-request-BlK_B72c.js +1 -0
- package/dist/packem_shared/mandrillProvider-DWPFh_Sj.js +1 -0
- package/dist/packem_shared/mockProvider-Behywbl1.js +1 -0
- package/dist/packem_shared/netcoreProvider-C5TEciaN.js +1 -0
- package/dist/packem_shared/nodemailerProvider-BFHobXxt.js +1 -0
- package/dist/packem_shared/normalizeMessageId-DAx2pGe2.js +1 -0
- package/dist/packem_shared/oauth2Middleware-CodqXkyj.js +1 -0
- package/dist/packem_shared/opentelemetryProvider-ByHC01ub.js +1 -0
- package/dist/packem_shared/outlook365Provider-63ggDpqV.js +1 -0
- package/dist/packem_shared/parseAddress-DdbViBAJ.js +1 -0
- package/dist/packem_shared/parseArfReport-Ds6S3c4J.js +6 -0
- package/dist/packem_shared/parseCloudflareInbound-C__j-oNa.js +1 -0
- package/dist/packem_shared/parseDmarcRecord-DXZ-_rF0.js +1 -0
- package/dist/packem_shared/parseMailgunInbound-BpC6uPNe.js +1 -0
- package/dist/packem_shared/parsePostmarkInbound-Co3_c6-9.js +1 -0
- package/dist/packem_shared/parseSendGridInbound-DsALoijO.js +4 -0
- package/dist/packem_shared/parseSesInbound-CH5tHIjp.js +1 -0
- package/dist/packem_shared/parseTlsReport-wPe1lIDs.js +1 -0
- package/dist/packem_shared/plunkProvider-yTlrJVEp.js +1 -0
- package/dist/packem_shared/postProcessHtml-DqKi2Ucg.js +1 -0
- package/dist/packem_shared/postalProvider-CRX_bMYD.js +1 -0
- package/dist/packem_shared/postmarkProvider-CDx85Yge.js +1 -0
- package/dist/packem_shared/provider-base-C7PuopYK.js +1 -0
- package/dist/packem_shared/provider.d-J-y6iogK.d.ts +28 -0
- package/dist/packem_shared/quoted-printable-nSGDA1tA.js +7 -0
- package/dist/packem_shared/resendProvider-CiclWxzr.js +1 -0
- package/dist/packem_shared/retry-3pnxTuNs.js +1 -0
- package/dist/packem_shared/retryMiddleware-DbViDX4r.js +1 -0
- package/dist/packem_shared/roundRobinProvider-D1by5KGW.js +1 -0
- package/dist/packem_shared/sanitize-header-DJhgZl3y.js +1 -0
- package/dist/packem_shared/scalewayProvider-BcND48qO.js +1 -0
- package/dist/packem_shared/sendGridProvider-D8ZLgY62.js +1 -0
- package/dist/packem_shared/smtpProvider-Bm0yP97W.js +25 -0
- package/dist/packem_shared/sparkpostProvider-CTYfSRaV.js +1 -0
- package/dist/packem_shared/sweegoProvider-DOoin_vi.js +1 -0
- package/dist/packem_shared/toEmailSnapshot-DeRqM5SJ.js +1 -0
- package/dist/packem_shared/tracer.d-MU42G1jG.d.ts +494 -0
- package/dist/packem_shared/types.d-BId55FW2.d.ts +107 -0
- package/dist/packem_shared/types.d-CmoWvdZi.d.ts +61 -0
- package/dist/packem_shared/types.d-DCkecJse.d.ts +51 -0
- package/dist/packem_shared/types.d-Mpu0HZoG.d.ts +24 -0
- package/dist/packem_shared/types.d-ejzh-xBP.d.ts +209 -0
- package/dist/packem_shared/types.d-lcJZmwRK.d.ts +69 -0
- package/dist/packem_shared/types.d-nyR1ty1Q.d.ts +9 -0
- package/dist/packem_shared/utils-BfYfPB_I.js +1 -0
- package/dist/packem_shared/validate-email-options-mCM9dVug.js +1 -0
- package/dist/packem_shared/verifyMailgunWebhook-Cwl0OD3P.js +1 -0
- package/dist/packem_shared/verifyPostmarkWebhook-C72ZvbrG.js +1 -0
- package/dist/packem_shared/verifyResendWebhook-YK2zNDXR.js +1 -0
- package/dist/packem_shared/verifySendGridWebhook-Dbwc1tfG.js +1 -0
- package/dist/packem_shared/withEvents-CCVblSqj.js +1 -0
- package/dist/packem_shared/withMetrics-DWywX_6M.js +1 -0
- package/dist/packem_shared/withRender-VP9wE5Yr.js +1 -0
- package/dist/packem_shared/withSuppression-DBaZDMAr.js +1 -0
- package/dist/packem_shared/withTelemetry-DL2qo0Hp.js +1 -0
- package/dist/packem_shared/zeptomailProvider-DKBPSHPj.js +1 -0
- package/dist/providers/ahasend/index.d.ts +36 -3
- package/dist/providers/ahasend/index.js +1 -1
- package/dist/providers/aws-ses/index.d.ts +47 -3
- package/dist/providers/aws-ses/index.js +1 -1
- package/dist/providers/azure/index.d.ts +52 -3
- package/dist/providers/azure/index.js +1 -1
- package/dist/providers/brevo/index.d.ts +65 -3
- package/dist/providers/brevo/index.js +1 -1
- package/dist/providers/cloudflare-email/index.d.ts +36 -0
- package/dist/providers/cloudflare-email/index.js +1 -0
- package/dist/providers/failover/index.d.ts +27 -3
- package/dist/providers/failover/index.js +1 -1
- package/dist/providers/http/index.d.ts +35 -3
- package/dist/providers/http/index.js +1 -1
- package/dist/providers/infobip/index.d.ts +56 -3
- package/dist/providers/infobip/index.js +1 -1
- package/dist/providers/loops/index.d.ts +47 -0
- package/dist/providers/loops/index.js +1 -0
- package/dist/providers/mailchannels/index.d.ts +26 -0
- package/dist/providers/mailchannels/index.js +1 -0
- package/dist/providers/mailcrab/index.d.ts +32 -3
- package/dist/providers/mailcrab/index.js +1 -1
- package/dist/providers/mailersend/index.d.ts +51 -3
- package/dist/providers/mailersend/index.js +1 -1
- package/dist/providers/mailgun/index.d.ts +73 -3
- package/dist/providers/mailgun/index.js +1 -1
- package/dist/providers/mailjet/index.d.ts +72 -3
- package/dist/providers/mailjet/index.js +1 -1
- package/dist/providers/mailomat/index.d.ts +40 -3
- package/dist/providers/mailomat/index.js +1 -1
- package/dist/providers/mailpace/index.d.ts +52 -3
- package/dist/providers/mailpace/index.js +1 -1
- package/dist/providers/mailtrap/index.d.ts +44 -3
- package/dist/providers/mailtrap/index.js +1 -1
- package/dist/providers/mandrill/index.d.ts +87 -3
- package/dist/providers/mandrill/index.js +1 -1
- package/dist/providers/mock/index.d.ts +12 -3
- package/dist/providers/mock/index.js +1 -1
- package/dist/providers/netcore/index.d.ts +35 -0
- package/dist/providers/netcore/index.js +1 -0
- package/dist/providers/nodemailer/index.d.ts +38 -3
- package/dist/providers/nodemailer/index.js +1 -1
- package/dist/providers/opentelemetry/index.d.ts +37 -3
- package/dist/providers/opentelemetry/index.js +1 -1
- package/dist/providers/outlook365/index.d.ts +48 -0
- package/dist/providers/outlook365/index.js +1 -0
- package/dist/providers/plunk/index.d.ts +38 -3
- package/dist/providers/plunk/index.js +1 -1
- package/dist/providers/postal/index.d.ts +48 -3
- package/dist/providers/postal/index.js +1 -1
- package/dist/providers/postmark/index.d.ts +60 -3
- package/dist/providers/postmark/index.js +1 -1
- package/dist/providers/resend/index.d.ts +51 -3
- package/dist/providers/resend/index.js +1 -1
- package/dist/providers/roundrobin/index.d.ts +27 -3
- package/dist/providers/roundrobin/index.js +1 -1
- package/dist/providers/scaleway/index.d.ts +44 -3
- package/dist/providers/scaleway/index.js +1 -1
- package/dist/providers/sendgrid/index.d.ts +84 -3
- package/dist/providers/sendgrid/index.js +1 -1
- package/dist/providers/smtp/index.d.ts +71 -3
- package/dist/providers/smtp/index.js +1 -1
- package/dist/providers/sparkpost/index.d.ts +43 -0
- package/dist/providers/sparkpost/index.js +1 -0
- package/dist/providers/sweego/index.d.ts +40 -3
- package/dist/providers/sweego/index.js +1 -1
- package/dist/providers/zeptomail/index.d.ts +37 -3
- package/dist/providers/zeptomail/index.js +1 -1
- package/dist/queue/bullmq-queue.d.ts +46 -0
- package/dist/queue/bullmq-queue.js +1 -0
- package/dist/queue/index.d.ts +147 -0
- package/dist/queue/index.js +1 -0
- package/dist/queue/pg-boss-queue.d.ts +41 -0
- package/dist/queue/pg-boss-queue.js +1 -0
- package/dist/queue/sqs-queue.d.ts +72 -0
- package/dist/queue/sqs-queue.js +1 -0
- package/dist/queue/unstorage-queue.d.ts +199 -0
- package/dist/queue/unstorage-queue.js +1 -0
- package/dist/render/index.d.ts +107 -0
- package/dist/render/index.js +1 -0
- package/dist/template-engines/handlebars.d.ts +23 -22
- package/dist/template-engines/handlebars.js +1 -1
- package/dist/template-engines/html-to-text.d.ts +24 -24
- package/dist/template-engines/html-to-text.js +1 -1
- package/dist/template-engines/i18n.d.ts +61 -0
- package/dist/template-engines/i18n.js +1 -0
- package/dist/template-engines/jsx-email.d.ts +11 -0
- package/dist/template-engines/jsx-email.js +1 -0
- package/dist/template-engines/liquid.d.ts +12 -0
- package/dist/template-engines/liquid.js +1 -0
- package/dist/template-engines/mjml.d.ts +10 -10
- package/dist/template-engines/mjml.js +1 -1
- package/dist/template-engines/react-email.d.ts +9 -9
- package/dist/template-engines/react-email.js +1 -1
- package/dist/template-engines/vue-email.d.ts +9 -9
- package/dist/template-engines/vue-email.js +1 -1
- package/dist/test/index.d.ts +155 -0
- package/dist/test/index.js +1 -0
- package/dist/utils/cache.d.ts +49 -48
- package/dist/utils/cache.js +1 -1
- package/dist/utils/format-email-address.d.ts +8 -7
- package/dist/utils/format-email-address.js +1 -1
- package/dist/utils/normalize-email-aliases.d.ts +20 -20
- package/dist/utils/normalize-email-aliases.js +1 -1
- package/dist/utils/parse-address.d.ts +18 -17
- package/dist/utils/parse-address.js +1 -1
- package/dist/utils/parse-eml.d.ts +22 -0
- package/dist/utils/parse-eml.js +6 -0
- package/dist/utils/result.d.ts +49 -0
- package/dist/utils/result.js +1 -0
- package/dist/utils/validation/check-feature-support.d.ts +53 -0
- package/dist/utils/validation/check-feature-support.js +1 -0
- package/dist/utils/validation/validate-email.d.ts +5 -5
- package/dist/utils/validation/validate-email.js +1 -1
- package/dist/webhooks/index.d.ts +231 -0
- package/dist/webhooks/index.js +1 -0
- package/package.json +177 -67
- package/dist/attachment-helpers.d.ts +0 -64
- package/dist/crypto/dkim-signer.d.ts +0 -48
- package/dist/crypto/smime-encrypter.d.ts +0 -53
- package/dist/crypto/smime-signer.d.ts +0 -48
- package/dist/crypto/types.d.ts +0 -101
- package/dist/draft-mail-message.d.ts +0 -13
- package/dist/errors/email-error.d.ts +0 -17
- package/dist/errors/required-option-error.d.ts +0 -10
- package/dist/mail-message.d.ts +0 -425
- package/dist/mail.d.ts +0 -206
- package/dist/packem_shared/DkimSigner-pFd4c3fZ.js +0 -18
- package/dist/packem_shared/EmailError-zm2ffVav.js +0 -1
- package/dist/packem_shared/Mail-6Bltpy_p.js +0 -1
- package/dist/packem_shared/MailMessage-B76GPBBA.js +0 -1
- package/dist/packem_shared/RequiredOptionError-CevW3u2K.js +0 -1
- package/dist/packem_shared/SmimeEncrypter-CBevU534.js +0 -6
- package/dist/packem_shared/SmimeSigner-CObA4jzT.js +0 -8
- package/dist/packem_shared/address-formatter-Cm_E_ZMa.js +0 -1
- package/dist/packem_shared/ahaSendProvider-DlFKEQ6D.js +0 -1
- package/dist/packem_shared/attachment-processor-2rHmfa7j.js +0 -1
- package/dist/packem_shared/awsSesProvider-Ba-eVJxZ.js +0 -32
- package/dist/packem_shared/azureProvider-CQYAkgVF.js +0 -1
- package/dist/packem_shared/brevoProvider-5p6jjiK9.js +0 -1
- package/dist/packem_shared/build-mime-message-IYaUqqPJ.js +0 -2
- package/dist/packem_shared/create-logger-BiWdqFNg.js +0 -1
- package/dist/packem_shared/defineProvider-B9rSklAJ.js +0 -1
- package/dist/packem_shared/detectMimeType-S8WRsNtY.js +0 -1
- package/dist/packem_shared/failoverProvider-CAHQQueo.js +0 -1
- package/dist/packem_shared/generate-boundary-Cx8nXYS0.js +0 -1
- package/dist/packem_shared/generate-message-id-D4uA8gkj.js +0 -1
- package/dist/packem_shared/headers-to-record-Qo124ImV.js +0 -1
- package/dist/packem_shared/httpProvider-CZD6LZX3.js +0 -1
- package/dist/packem_shared/infobipProvider-CtLwrUaP.js +0 -1
- package/dist/packem_shared/mailPaceProvider-B6yKvh6z.js +0 -1
- package/dist/packem_shared/mailerSendProvider-CeeIXFnW.js +0 -1
- package/dist/packem_shared/mailgunProvider-mmjKzouh.js +0 -1
- package/dist/packem_shared/mailjetProvider-DwN6i0VA.js +0 -1
- package/dist/packem_shared/mailomatProvider-DMQmjKHT.js +0 -1
- package/dist/packem_shared/mailtrapProvider-BN3UBEQw.js +0 -1
- package/dist/packem_shared/make-request-BDzF9W9D.js +0 -1
- package/dist/packem_shared/mandrillProvider-370y7CLu.js +0 -1
- package/dist/packem_shared/mockProvider-DN5ZwutD.js +0 -1
- package/dist/packem_shared/nodemailerProvider-_w8QXMU-.js +0 -1
- package/dist/packem_shared/opentelemetryProvider-C_ZXOLSd.js +0 -1
- package/dist/packem_shared/plunkProvider-DfJumQ4U.js +0 -1
- package/dist/packem_shared/postalProvider-Bavx2FcH.js +0 -1
- package/dist/packem_shared/postmarkProvider-DFC0uvjO.js +0 -1
- package/dist/packem_shared/provider-base-Cmzx6BTO.js +0 -1
- package/dist/packem_shared/readFile-BlZxbhCU-C8bCdiA2.js +0 -1
- package/dist/packem_shared/resendProvider-CfqU7UdE.js +0 -1
- package/dist/packem_shared/roundRobinProvider-1WQnuKR8.js +0 -1
- package/dist/packem_shared/sanitize-header-wWav-Scu.js +0 -1
- package/dist/packem_shared/scalewayProvider-be1HPimL.js +0 -1
- package/dist/packem_shared/sendGridProvider-BVI1sq3n.js +0 -1
- package/dist/packem_shared/smtpProvider-BV-ufR53.js +0 -23
- package/dist/packem_shared/sweegoProvider-7419CSAq.js +0 -1
- package/dist/packem_shared/validate-email-options-DfJ7llf8.js +0 -1
- package/dist/packem_shared/zeptomailProvider-C2lh0Xmo.js +0 -1
- package/dist/providers/ahasend/provider.d.ts +0 -7
- package/dist/providers/ahasend/types.d.ts +0 -28
- package/dist/providers/aws-ses/provider.d.ts +0 -8
- package/dist/providers/aws-ses/types.d.ts +0 -38
- package/dist/providers/azure/provider.d.ts +0 -7
- package/dist/providers/azure/types.d.ts +0 -44
- package/dist/providers/brevo/provider.d.ts +0 -7
- package/dist/providers/brevo/types.d.ts +0 -57
- package/dist/providers/failover/provider.d.ts +0 -7
- package/dist/providers/failover/types.d.ts +0 -19
- package/dist/providers/http/provider.d.ts +0 -7
- package/dist/providers/http/types.d.ts +0 -27
- package/dist/providers/infobip/provider.d.ts +0 -7
- package/dist/providers/infobip/types.d.ts +0 -48
- package/dist/providers/mailcrab/provider.d.ts +0 -9
- package/dist/providers/mailcrab/types.d.ts +0 -22
- package/dist/providers/mailersend/provider.d.ts +0 -7
- package/dist/providers/mailersend/types.d.ts +0 -43
- package/dist/providers/mailgun/provider.d.ts +0 -7
- package/dist/providers/mailgun/types.d.ts +0 -65
- package/dist/providers/mailjet/provider.d.ts +0 -7
- package/dist/providers/mailjet/types.d.ts +0 -64
- package/dist/providers/mailomat/provider.d.ts +0 -7
- package/dist/providers/mailomat/types.d.ts +0 -32
- package/dist/providers/mailpace/provider.d.ts +0 -7
- package/dist/providers/mailpace/types.d.ts +0 -44
- package/dist/providers/mailtrap/provider.d.ts +0 -7
- package/dist/providers/mailtrap/types.d.ts +0 -36
- package/dist/providers/mandrill/provider.d.ts +0 -7
- package/dist/providers/mandrill/types.d.ts +0 -79
- package/dist/providers/mock/provider.d.ts +0 -8
- package/dist/providers/mock/types.d.ts +0 -50
- package/dist/providers/nodemailer/provider.d.ts +0 -7
- package/dist/providers/nodemailer/types.d.ts +0 -30
- package/dist/providers/opentelemetry/provider.d.ts +0 -8
- package/dist/providers/opentelemetry/types.d.ts +0 -31
- package/dist/providers/plunk/provider.d.ts +0 -7
- package/dist/providers/plunk/types.d.ts +0 -30
- package/dist/providers/postal/provider.d.ts +0 -7
- package/dist/providers/postal/types.d.ts +0 -40
- package/dist/providers/postmark/provider.d.ts +0 -7
- package/dist/providers/postmark/types.d.ts +0 -52
- package/dist/providers/provider.d.ts +0 -27
- package/dist/providers/resend/provider.d.ts +0 -7
- package/dist/providers/resend/types.d.ts +0 -43
- package/dist/providers/roundrobin/provider.d.ts +0 -7
- package/dist/providers/roundrobin/types.d.ts +0 -19
- package/dist/providers/scaleway/provider.d.ts +0 -7
- package/dist/providers/scaleway/types.d.ts +0 -36
- package/dist/providers/sendgrid/provider.d.ts +0 -7
- package/dist/providers/sendgrid/types.d.ts +0 -76
- package/dist/providers/smtp/provider.d.ts +0 -7
- package/dist/providers/smtp/types.d.ts +0 -63
- package/dist/providers/sweego/provider.d.ts +0 -7
- package/dist/providers/sweego/types.d.ts +0 -32
- package/dist/providers/utils/address-formatter.d.ts +0 -139
- package/dist/providers/utils/attachment-processor.d.ts +0 -58
- package/dist/providers/utils/index.d.ts +0 -4
- package/dist/providers/utils/payload-builder.d.ts +0 -78
- package/dist/providers/utils/provider-base.d.ts +0 -69
- package/dist/providers/zeptomail/provider.d.ts +0 -7
- package/dist/providers/zeptomail/types.d.ts +0 -29
- package/dist/template-engines/types.d.ts +0 -8
- package/dist/types.d.ts +0 -203
- package/dist/utils/build-mime-message.d.ts +0 -8
- package/dist/utils/create-logger.d.ts +0 -16
- package/dist/utils/format-email-addresses.d.ts +0 -8
- package/dist/utils/generate-boundary.d.ts +0 -7
- package/dist/utils/generate-message-id.d.ts +0 -6
- package/dist/utils/headers-to-record.d.ts +0 -9
- package/dist/utils/is-port-available.d.ts +0 -9
- package/dist/utils/make-request.d.ts +0 -18
- package/dist/utils/retry.d.ts +0 -10
- package/dist/utils/sanitize-header.d.ts +0 -14
- package/dist/utils/to-base64.d.ts +0 -8
- package/dist/utils/validation/check-mx-records.d.ts +0 -42
- package/dist/utils/validation/check-mx-records.js +0 -1
- package/dist/utils/validation/disposable-email-domains.d.ts +0 -13
- package/dist/utils/validation/disposable-email-domains.js +0 -1
- package/dist/utils/validation/role-accounts.d.ts +0 -21
- package/dist/utils/validation/role-accounts.js +0 -1
- package/dist/utils/validation/validate-email-options.d.ts +0 -8
- package/dist/utils/validation/verify-email.d.ts +0 -47
- package/dist/utils/validation/verify-email.js +0 -1
- package/dist/utils/validation/verify-smtp.d.ts +0 -39
- package/dist/utils/validation/verify-smtp.js +0 -4
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { E as EmailOptions, a as EmailResult, R as Result } from "./types.d-ejzh-xBP.js";
|
|
2
|
+
/**
|
|
3
|
+
* The terminal send function a middleware wraps — ultimately the provider's `sendEmail`.
|
|
4
|
+
*/
|
|
5
|
+
type SendFunction = (options: EmailOptions) => Promise<Result<EmailResult>>;
|
|
6
|
+
/**
|
|
7
|
+
* A send middleware. Receives the (fully-resolved) message and the `next` function in the chain;
|
|
8
|
+
* may short-circuit, retry, mutate, or observe.
|
|
9
|
+
*
|
|
10
|
+
* Middlewares run in registration order, wrapping outward-in (the first registered runs first and is
|
|
11
|
+
* the outermost wrapper around the provider call).
|
|
12
|
+
* @param options The resolved email options.
|
|
13
|
+
* @param next The next middleware (or the provider send) in the chain.
|
|
14
|
+
* @returns The send result.
|
|
15
|
+
*/
|
|
16
|
+
type Middleware = (options: EmailOptions, next: SendFunction) => Promise<Result<EmailResult>>;
|
|
17
|
+
/**
|
|
18
|
+
* Composes a middleware stack around a terminal send function.
|
|
19
|
+
* @param middlewares The middlewares, in registration order.
|
|
20
|
+
* @param terminal The provider send call at the centre of the chain.
|
|
21
|
+
* @returns A single {@link SendFunction} that runs the whole chain.
|
|
22
|
+
*/
|
|
23
|
+
declare const composeMiddleware: (middlewares: ReadonlyArray<Middleware>, terminal: SendFunction) => SendFunction;
|
|
24
|
+
export { Middleware as M, SendFunction as S, composeMiddleware as c };
|
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
import { Buffer } from 'node:buffer';
|
|
2
|
+
/**
|
|
3
|
+
* Utility type for values that can be promises
|
|
4
|
+
*/
|
|
5
|
+
type MaybePromise<T> = T | Promise<T>;
|
|
6
|
+
/**
|
|
7
|
+
* Feature flags indicating what capabilities a provider supports
|
|
8
|
+
*/
|
|
9
|
+
interface FeatureFlags {
|
|
10
|
+
attachments?: boolean;
|
|
11
|
+
batchSending?: boolean;
|
|
12
|
+
customHeaders?: boolean;
|
|
13
|
+
html?: boolean;
|
|
14
|
+
replyTo?: boolean;
|
|
15
|
+
scheduling?: boolean;
|
|
16
|
+
tagging?: boolean;
|
|
17
|
+
templates?: boolean;
|
|
18
|
+
tracking?: boolean;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Base configuration for all providers
|
|
22
|
+
*/
|
|
23
|
+
interface BaseConfig {
|
|
24
|
+
debug?: boolean;
|
|
25
|
+
logger?: Console;
|
|
26
|
+
retries?: number;
|
|
27
|
+
timeout?: number;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Email address with optional name
|
|
31
|
+
*/
|
|
32
|
+
interface EmailAddress {
|
|
33
|
+
email: string;
|
|
34
|
+
name?: string;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Email attachment
|
|
38
|
+
*/
|
|
39
|
+
interface Attachment {
|
|
40
|
+
/**
|
|
41
|
+
* Content-ID for inline attachments (used in HTML with cid:)
|
|
42
|
+
*/
|
|
43
|
+
cid?: string;
|
|
44
|
+
/**
|
|
45
|
+
* Attachment content (string, Buffer, or Promise<Uint8Array> for async loading)
|
|
46
|
+
* Required if path, href, or raw are not provided
|
|
47
|
+
*/
|
|
48
|
+
content?: string | Buffer | Promise<Uint8Array>;
|
|
49
|
+
/**
|
|
50
|
+
* Content disposition: 'attachment' (default) or 'inline'
|
|
51
|
+
*/
|
|
52
|
+
contentDisposition?: "attachment" | "inline";
|
|
53
|
+
/**
|
|
54
|
+
* MIME type of the attachment
|
|
55
|
+
*/
|
|
56
|
+
contentType?: string;
|
|
57
|
+
/**
|
|
58
|
+
* Content transfer encoding (e.g., 'base64', '7bit', 'quoted-printable')
|
|
59
|
+
*/
|
|
60
|
+
encoding?: string;
|
|
61
|
+
/**
|
|
62
|
+
* Filename for the attachment
|
|
63
|
+
*/
|
|
64
|
+
filename: string;
|
|
65
|
+
/**
|
|
66
|
+
* Custom headers for this attachment
|
|
67
|
+
*/
|
|
68
|
+
headers?: Record<string, string>;
|
|
69
|
+
/**
|
|
70
|
+
* URL to fetch attachment from
|
|
71
|
+
* Alternative to content or path
|
|
72
|
+
*/
|
|
73
|
+
href?: string;
|
|
74
|
+
/**
|
|
75
|
+
* HTTP headers to use when fetching from href
|
|
76
|
+
*/
|
|
77
|
+
httpHeaders?: Record<string, string>;
|
|
78
|
+
/**
|
|
79
|
+
* File path to read attachment from
|
|
80
|
+
* Alternative to content
|
|
81
|
+
*/
|
|
82
|
+
path?: string;
|
|
83
|
+
/**
|
|
84
|
+
* Raw attachment data (alternative to content)
|
|
85
|
+
* Can be used for pre-encoded content
|
|
86
|
+
*/
|
|
87
|
+
raw?: string | Buffer;
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Email tag for categorization
|
|
91
|
+
*/
|
|
92
|
+
interface EmailTag {
|
|
93
|
+
name: string;
|
|
94
|
+
value: string;
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Priority levels for email messages
|
|
98
|
+
*/
|
|
99
|
+
type Priority = "high" | "normal" | "low";
|
|
100
|
+
/**
|
|
101
|
+
* Represents the headers of an email message.
|
|
102
|
+
* This type is a supertype of the standard `Headers` class, which is used to manage HTTP headers.
|
|
103
|
+
* Note that this type does not include methods for modifying the headers,
|
|
104
|
+
* such as `append`, `delete`, or `set`. It is intended to be used for
|
|
105
|
+
* read-only access to the headers of an email message.
|
|
106
|
+
*/
|
|
107
|
+
type ImmutableHeaders = Omit<Headers, "append" | "delete" | "set">;
|
|
108
|
+
/**
|
|
109
|
+
* Email headers can be either a plain object or an ImmutableHeaders instance
|
|
110
|
+
*/
|
|
111
|
+
type EmailHeaders = Record<string, string> | ImmutableHeaders;
|
|
112
|
+
/**
|
|
113
|
+
* Options for calendar event attachments
|
|
114
|
+
*/
|
|
115
|
+
interface CalendarEventOptions {
|
|
116
|
+
/**
|
|
117
|
+
* Alternative text for the calendar event
|
|
118
|
+
*/
|
|
119
|
+
alternativeText?: string;
|
|
120
|
+
/**
|
|
121
|
+
* Method for the calendar event (e.g., 'REQUEST', 'CANCEL', 'REPLY')
|
|
122
|
+
*/
|
|
123
|
+
method?: string;
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Common email options that all providers support
|
|
127
|
+
*/
|
|
128
|
+
interface EmailOptions {
|
|
129
|
+
attachments?: Attachment[];
|
|
130
|
+
bcc?: EmailAddress | EmailAddress[];
|
|
131
|
+
cc?: EmailAddress | EmailAddress[];
|
|
132
|
+
from: EmailAddress;
|
|
133
|
+
headers?: EmailHeaders;
|
|
134
|
+
html?: string;
|
|
135
|
+
icalEvent?: CalendarEventOptions & {
|
|
136
|
+
content?: string;
|
|
137
|
+
href?: string;
|
|
138
|
+
path?: string;
|
|
139
|
+
};
|
|
140
|
+
priority?: Priority;
|
|
141
|
+
replyTo?: EmailAddress;
|
|
142
|
+
/**
|
|
143
|
+
* The message stream this email belongs to. Used by `Mail.mount` to route the message to a
|
|
144
|
+
* mounted provider (e.g. a Postmark broadcast stream). Providers that don't support streams ignore it.
|
|
145
|
+
*/
|
|
146
|
+
stream?: string;
|
|
147
|
+
subject: string;
|
|
148
|
+
tags?: string[];
|
|
149
|
+
text?: string;
|
|
150
|
+
to: EmailAddress | EmailAddress[];
|
|
151
|
+
}
|
|
152
|
+
/**
|
|
153
|
+
* Result of sending an email
|
|
154
|
+
*/
|
|
155
|
+
interface EmailResult {
|
|
156
|
+
messageId: string;
|
|
157
|
+
provider?: string;
|
|
158
|
+
response?: unknown;
|
|
159
|
+
sent: boolean;
|
|
160
|
+
timestamp: Date;
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* Receipt type for email sending results
|
|
164
|
+
* Uses discriminated union for type safety
|
|
165
|
+
*/
|
|
166
|
+
type Receipt = {
|
|
167
|
+
/**
|
|
168
|
+
* The unique identifier for the message that was sent
|
|
169
|
+
*/
|
|
170
|
+
readonly messageId: string;
|
|
171
|
+
/**
|
|
172
|
+
* Optional provider name
|
|
173
|
+
*/
|
|
174
|
+
readonly provider?: string;
|
|
175
|
+
/**
|
|
176
|
+
* Optional response data from provider
|
|
177
|
+
*/
|
|
178
|
+
readonly response?: unknown;
|
|
179
|
+
/**
|
|
180
|
+
* Indicates that the email was sent successfully
|
|
181
|
+
*/
|
|
182
|
+
readonly successful: true;
|
|
183
|
+
/**
|
|
184
|
+
* Timestamp when email was sent
|
|
185
|
+
*/
|
|
186
|
+
readonly timestamp: Date;
|
|
187
|
+
} | {
|
|
188
|
+
/**
|
|
189
|
+
* An array of error messages that occurred during the sending process
|
|
190
|
+
*/
|
|
191
|
+
readonly errorMessages: ReadonlyArray<string>;
|
|
192
|
+
/**
|
|
193
|
+
* Optional provider name
|
|
194
|
+
*/
|
|
195
|
+
readonly provider?: string;
|
|
196
|
+
/**
|
|
197
|
+
* Indicates that the email failed to send
|
|
198
|
+
*/
|
|
199
|
+
readonly successful: false;
|
|
200
|
+
};
|
|
201
|
+
/**
|
|
202
|
+
* Generic result type
|
|
203
|
+
*/
|
|
204
|
+
interface Result<T = unknown> {
|
|
205
|
+
data?: T;
|
|
206
|
+
error?: Error | unknown;
|
|
207
|
+
success: boolean;
|
|
208
|
+
}
|
|
209
|
+
export { Attachment as A, BaseConfig as B, CalendarEventOptions as C, EmailOptions as E, FeatureFlags as F, ImmutableHeaders as I, MaybePromise as M, Priority as P, Result as R, EmailResult as a, Receipt as b, EmailAddress as c, EmailTag as d, EmailHeaders as e };
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { E as EmailOptions } from "./types.d-ejzh-xBP.js";
|
|
2
|
+
/**
|
|
3
|
+
* A queued email job.
|
|
4
|
+
*/
|
|
5
|
+
interface QueueJob {
|
|
6
|
+
/**
|
|
7
|
+
* Number of delivery attempts so far.
|
|
8
|
+
*/
|
|
9
|
+
attempts: number;
|
|
10
|
+
/**
|
|
11
|
+
* Unique job id.
|
|
12
|
+
*/
|
|
13
|
+
id: string;
|
|
14
|
+
/**
|
|
15
|
+
* The message to send.
|
|
16
|
+
*/
|
|
17
|
+
message: EmailOptions;
|
|
18
|
+
/**
|
|
19
|
+
* Earliest time (ms since epoch) the job may be delivered. Used for `scheduledAt` and retry backoff.
|
|
20
|
+
*/
|
|
21
|
+
scheduledAt: number;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Options when enqueueing a message.
|
|
25
|
+
*/
|
|
26
|
+
interface EnqueueOptions {
|
|
27
|
+
/**
|
|
28
|
+
* Deliver no earlier than this time. Accepts a `Date` or epoch milliseconds.
|
|
29
|
+
*/
|
|
30
|
+
scheduledAt?: Date | number;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* A durable email queue. The in-memory default (`MemoryQueue`) implements this; adapters can
|
|
34
|
+
* back it with Redis/BullMQ, pg-boss, SQS, or `unstorage`.
|
|
35
|
+
*
|
|
36
|
+
* Delivery is reserve → ack/retry: {@link EmailQueue.reserve} hands out a job and hides it for a
|
|
37
|
+
* visibility window; the worker then {@link EmailQueue.ack}s it on success or {@link EmailQueue.retry}s
|
|
38
|
+
* it on failure.
|
|
39
|
+
*/
|
|
40
|
+
interface EmailQueue {
|
|
41
|
+
/**
|
|
42
|
+
* Marks a reserved job as successfully processed and removes it.
|
|
43
|
+
* @param id The job id.
|
|
44
|
+
*/
|
|
45
|
+
ack: (id: string) => Promise<void> | void;
|
|
46
|
+
/**
|
|
47
|
+
* Adds a message to the queue.
|
|
48
|
+
* @param message The message to send later.
|
|
49
|
+
* @param options Optional scheduling. See {@link EnqueueOptions}.
|
|
50
|
+
* @returns The new job id.
|
|
51
|
+
*/
|
|
52
|
+
enqueue: (message: EmailOptions, options?: EnqueueOptions) => Promise<string> | string;
|
|
53
|
+
/**
|
|
54
|
+
* Reserves the next ready job, hiding it from other workers for a visibility window.
|
|
55
|
+
* @returns The next job, or `undefined` when none is ready.
|
|
56
|
+
*/
|
|
57
|
+
reserve: () => (QueueJob | undefined) | Promise<QueueJob | undefined>;
|
|
58
|
+
/**
|
|
59
|
+
* Returns a reserved job to the queue, optionally after a delay, incrementing its attempt count.
|
|
60
|
+
* @param id The job id.
|
|
61
|
+
* @param delayMs Milliseconds to wait before the job becomes ready again.
|
|
62
|
+
*/
|
|
63
|
+
retry: (id: string, delayMs?: number) => Promise<void> | void;
|
|
64
|
+
/**
|
|
65
|
+
* The number of jobs not yet acked (ready + reserved).
|
|
66
|
+
*/
|
|
67
|
+
size: () => number | Promise<number>;
|
|
68
|
+
}
|
|
69
|
+
export { EnqueueOptions as E, QueueJob as Q, EmailQueue as a };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Template render function type.
|
|
3
|
+
* @param template Template content (string, React component, etc.).
|
|
4
|
+
* @param data Data/variables to pass to the template.
|
|
5
|
+
* @param options Options specific to the template engine.
|
|
6
|
+
* @returns Rendered HTML string.
|
|
7
|
+
*/
|
|
8
|
+
type TemplateRenderer = (template: unknown, data?: Record<string, unknown>, options?: Record<string, unknown>) => string | Promise<string>;
|
|
9
|
+
export { TemplateRenderer as T };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{createRequire as c}from"node:module";const f=c(import.meta.url),r=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,a=e=>{if(typeof r<"u"&&r.versions&&r.versions.node){const[t,o]=r.versions.node.split(".").map(Number);if(t>22||t===22&&o>=3||t===20&&o>=16)return r.getBuiltinModule(e)}return f(e)},{Buffer:i}=a("node:buffer"),{timingSafeEqual:u}=a("node:crypto"),d=(e,t)=>{if(e instanceof Headers)return e.get(t)??void 0;const o=t.toLowerCase();for(const[s,n]of Object.entries(e))if(s.toLowerCase()===o)return Array.isArray(n)?n[0]:n},g=(e,t)=>{const o=i.from(e),s=i.from(t);return o.length!==s.length?!1:u(o,s)},m=(e,t,o=Date.now())=>t<=0?!0:Number.isFinite(e)?Math.abs(o/1e3-e)<=t:!1;export{d as g,m as i,g as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import l from"../utils/validation/validate-email.js";const a=i=>{const r=[];i.from?.email||r.push("Missing required field: from"),i.to||r.push("Missing required field: to"),i.subject||r.push("Missing required field: subject"),!i.text&&!i.html&&r.push("Either text or html content is required"),i.from&&i.from.email&&!l(i.from.email)&&r.push(`Invalid from email address: ${i.from.email}`);const e=(s,m)=>{s&&(Array.isArray(s)?s:[s]).forEach(o=>{l(o.email)||r.push(`Invalid ${m} email address: ${o.email}`)})};return e(i.to,"to"),e(i.cc,"cc"),e(i.bcc,"bcc"),i.replyTo&&!l(i.replyTo.email)&&r.push(`Invalid replyTo email address: ${i.replyTo.email}`),r};export{a as f};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{createRequire as m}from"node:module";import{i as d,t as g}from"./utils-BfYfPB_I.js";const l=m(import.meta.url),t=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,p=s=>{if(typeof t<"u"&&t.versions&&t.versions.node){const[e,r]=t.versions.node.split(".").map(Number);if(e>22||e===22&&r>=3||e===20&&r>=16)return t.getBuiltinModule(s)}return l(s)},{createHmac:f}=p("node:crypto"),b=s=>{const{now:e,signature:r,signingKey:o,timestamp:i,token:n,tolerance:a=300}=s,c=typeof i=="number"?i:Number.parseInt(i,10);if(!d(c,a,e))return{reason:"timestamp-out-of-tolerance",valid:!1};const u=f("sha256",o).update(`${String(i)}${n}`).digest("hex");return g(r,u)?{valid:!0}:{reason:"signature-mismatch",valid:!1}};export{b as verifyMailgunWebhook};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{createRequire as a}from"node:module";import{t as l}from"./utils-BfYfPB_I.js";const c=a(import.meta.url),s=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,u=r=>{if(typeof s<"u"&&s.versions&&s.versions.node){const[e,t]=s.versions.node.split(".").map(Number);if(e>22||e===22&&t>=3||e===20&&t>=16)return s.getBuiltinModule(r)}return c(r)},{Buffer:f}=u("node:buffer"),p=r=>{const{authorization:e,password:t,username:o}=r;if(!e?.startsWith("Basic "))return{reason:"missing-credentials",valid:!1};const i=f.from(e.slice(6),"base64").toString("utf8"),n=`${o}:${t}`;return l(i,n)?{valid:!0}:{reason:"credentials-mismatch",valid:!1}};export{p as verifyPostmarkWebhook};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{createRequire as _}from"node:module";import{g as t,i as k,t as w}from"./utils-BfYfPB_I.js";const y=_(import.meta.url),o=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,f=e=>{if(typeof o<"u"&&o.versions&&o.versions.node){const[s,r]=o.versions.node.split(".").map(Number);if(s>22||s===22&&r>=3||s===20&&r>=16)return o.getBuiltinModule(e)}return y(e)},{Buffer:u}=f("node:buffer"),{createHmac:j}=f("node:crypto"),T="v1",W=e=>e.startsWith("whsec_")?u.from(e.slice(6),"base64"):u.from(e,"utf8"),q=e=>{const{headers:s,now:r,payload:l,secret:d,tolerance:m=300}=e,n=t(s,"webhook-id")??t(s,"svix-id"),i=t(s,"webhook-timestamp")??t(s,"svix-timestamp"),a=t(s,"webhook-signature")??t(s,"svix-signature");if(!n||!i||!a)return{reason:"missing-headers",valid:!1};const p=Number.parseInt(i,10);if(!k(p,m,r))return{reason:"timestamp-out-of-tolerance",valid:!1};const g=`${n}.${i}.${l}`,h=j("sha256",W(d)).update(g).digest("base64");return a.split(" ").some(b=>{const[v,c]=b.split(",");return v!==T||!c?!1:w(c,h)})?{valid:!0}:{reason:"signature-mismatch",valid:!1}},B=e=>q(e);export{B as verifyResendWebhook,q as verifyStandardWebhook};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{createRequire as y}from"node:module";import _ from"./EmailError-B-sEf3bp.js";import{i as g}from"./utils-BfYfPB_I.js";const b=y(import.meta.url),o=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,f=e=>{if(typeof o<"u"&&o.versions&&o.versions.node){const[r,s]=o.versions.node.split(".").map(Number);if(r>22||r===22&&s>=3||r===20&&s>=16)return o.getBuiltinModule(e)}return b(e)},{Buffer:i}=f("node:buffer"),{verify:h,createPublicKey:l}=f("node:crypto"),v=e=>e.includes("-----BEGIN")?l(e):l({format:"der",key:i.from(e,"base64"),type:"spki"}),w=e=>{const{now:r,payload:s,publicKey:d,signature:n,timestamp:t,tolerance:u=300}=e;if(!n||!t)return{reason:"missing-headers",valid:!1};let a;try{a=v(d)}catch(p){throw new _("webhooks","Failed to parse SendGrid verification key",{cause:p})}const m=i.from(t+s,"utf8");let c;try{c=h("sha256",m,{dsaEncoding:"der",key:a},i.from(n,"base64"))}catch{return{reason:"signature-malformed",valid:!1}}return c?g(Number.parseInt(t,10),u,r)?{valid:!0}:{reason:"timestamp-out-of-tolerance",valid:!1}:{reason:"signature-mismatch",valid:!1}};export{w as verifySendGridWebhook};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{createRequire as d}from"node:module";const p=d(import.meta.url),i=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,m=e=>{if(typeof i<"u"&&i.versions&&i.versions.node){const[s,r]=i.versions.node.split(".").map(Number);if(s>22||s===22&&r>=3||s===20&&r>=16)return i.getBuiltinModule(e)}return p(e)},{randomUUID:u}=m("node:crypto"),l=e=>(Array.isArray(e)?e[0]:e)?.email,f=(e,s={})=>{const{idFactory:r=u,now:o=Date.now}=s;return async(a,c)=>{const n=l(a.to);e.emit({id:r(),recipient:n,timestamp:new Date(o()),type:"queued"});const t=await c(a);return t.success?e.emit({id:r(),messageId:t.data?.messageId,provider:t.data?.provider,recipient:n,timestamp:new Date(o()),type:"sent"}):e.emit({data:{error:t.error instanceof Error?t.error.message:String(t.error)},id:r(),recipient:n,timestamp:new Date(o()),type:"failed"}),t}};export{f as withEvents};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const i=(e,r={})=>{const s=r.prefix??"email_";return async(a,o)=>{const c=Date.now(),t=await o(a),n={provider:t.data?.provider??"unknown",status:t.success?"success":"failure"};return e.increment(`${s}sent_total`,n),e.observe(`${s}duration_ms`,Date.now()-c,n),t}};export{i as withMetrics};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const s=a=>async(t,o)=>o(await a(t));export{s as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{filterSuppressed as d}from"./createSuppressionStore-CeAZKCbY.js";import w from"./EmailError-B-sEf3bp.js";const u=(o,c={})=>async(e,p)=>{const t={allowed:[],suppressed:[]},r=await d(e.to,o),l=e.cc?await d(e.cc,o):t,s=e.bcc?await d(e.bcc,o):t,a=[...r.suppressed,...l.suppressed,...s.suppressed];return a.length>0&&c.onSuppressed?.(a),r.allowed.length===0&&l.allowed.length===0&&s.allowed.length===0?{error:new w("middleware","All recipients are suppressed",{code:"ALL_SUPPRESSED"}),success:!1}:p({...e,bcc:s.allowed.length>0?s.allowed:void 0,cc:l.allowed.length>0?l.allowed:void 0,to:r.allowed})};export{u as withSuppression};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const c=(r,a={})=>{const i=a.spanName??"email.send";return async(s,n)=>r.startActiveSpan(i,async t=>{t.setAttribute("email.recipients",Array.isArray(s.to)?s.to.length:1);try{const e=await n(s);return t.setAttribute("email.success",e.success),e.data?.provider&&t.setAttribute("email.provider",e.data.provider),e.success||t.setStatus({code:2,message:e.error instanceof Error?e.error.message:"send failed"}),e}catch(e){throw e instanceof Error&&t.recordException(e),t.setStatus({code:2,message:e instanceof Error?e.message:"send failed"}),e}finally{t.end()}})};export{c as withTelemetry};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import l from"./EmailError-B-sEf3bp.js";import y from"./RequiredOptionError-DuNNY_a5.js";import{e as b}from"./generate-message-id-gXAuMz4g.js";import{s as k}from"./headers-to-record-De1Eg951.js";import{m as v}from"./make-request-BlK_B72c.js";import{u as w}from"./retry-3pnxTuNs.js";import{a as A,s as z}from"./sanitize-header-DJhgZl3y.js";import{f as _}from"./validate-email-options-mCM9dVug.js";import{defineProvider as j}from"./defineProvider-C9q-7iwt.js";import{P,h as I,c as T}from"./provider-base-C7PuopYK.js";import{n as h}from"./address-formatter-BWR2Dddx.js";const i="zeptomail",O="https://api.zeptomail.com/v1.1",Z=3e4,E=3,L=j((s={})=>{if(!s.token)throw new y(i,"token");if(!s.token.startsWith("Zoho-enczapikey "))throw new l(i,'Token should be in the format "Zoho-enczapikey <your_api_key>"');const o={debug:s.debug??!1,endpoint:s.endpoint??O,logger:s.logger,retries:s.retries??E,timeout:s.timeout??Z,token:s.token},u=new P,n=T(i,s.logger);return{features:{attachments:!0,batchSending:!1,customHeaders:!0,html:!0,replyTo:!0,scheduling:!1,tagging:!1,templates:!1,tracking:!0},async initialize(){await u.ensureInitialized(async()=>{if(!await this.isAvailable())throw new l(i,"Zeptomail API not available or invalid token");n.debug("Provider initialized successfully")},i)},async isAvailable(){try{return o.token&&o.token.startsWith("Zoho-enczapikey ")?(n.debug("Token format is valid, assuming Zeptomail is available"),!0):!1}catch(e){return n.debug("Error checking availability:",e),!1}},name:i,options:o,async sendEmail(e){try{const m=_(e);if(m.length>0)return{error:new l(i,`Invalid email options: ${m.join(", ")}`),success:!1};await u.ensureInitialized(()=>this.initialize(),i);const a={from:h(e.from).address,subject:e.subject};if(Array.isArray(e.to)?a.to=e.to.length===1?e.to[0].email:e.to.map(t=>t.email):a.to=e.to.email,e.text&&(a.textbody=e.text),e.html&&(a.htmlbody=e.html),e.cc&&(Array.isArray(e.cc)?a.cc=e.cc.length===1?e.cc[0].email:e.cc.map(t=>t.email):a.cc=e.cc.email),e.bcc&&(Array.isArray(e.bcc)?a.bcc=e.bcc.length===1?e.bcc[0].email:e.bcc.map(t=>t.email):a.bcc=e.bcc.email),e.replyTo&&(a.reply_to=[h(e.replyTo).address]),e.trackClicks!==void 0&&(a.track_clicks=e.trackClicks),e.trackOpens!==void 0&&(a.track_opens=e.trackOpens),e.clientReference&&(a.client_reference=e.clientReference),e.mimeHeaders&&Object.keys(e.mimeHeaders).length>0){const t={};for(const[r,d]of Object.entries(e.mimeHeaders))t[r]=d;a.mime_headers=t}if(e.headers){const t=k(e.headers);Object.keys(t).length>0&&(a.mime_headers??={},Object.entries(t).forEach(([r,d])=>{a.mime_headers&&(a.mime_headers[A(r)]=z(d))}))}e.attachments&&e.attachments.length>0&&(a.attachments=e.attachments.map(t=>{const r={name:t.filename};return t.content?(r.content=typeof t.content=="string"?t.content:t.content.toString("base64"),t.contentType&&(r.mime_type=t.contentType)):t.path&&(r.file_cache_key=t.path),r})),n.debug("Sending email via Zeptomail API",{subject:a.subject,to:a.to});const g={Accept:"application/json",Authorization:o.token,"Content-Type":"application/json"},c=await w(async()=>v(`${o.endpoint}/email`,{headers:g,method:"POST",timeout:o.timeout},JSON.stringify(a)),o.retries);if(!c.success){n.debug("API request failed",c.error);let t=c.error instanceof Error?c.error.message:"Unknown error";const r=c.data;return r?.body?.message?t+=` Details: ${r.body.message}`:r?.body?.error?.message&&(t+=` Details: ${r.body.error.message}`),{error:new l(i,`Failed to send email: ${t}`,{cause:c.error}),success:!1}}const p=c.data?.body,f=p?.request_id??b();return n.debug("Email sent successfully",{messageId:f}),{data:{messageId:f,provider:i,response:p,sent:!0,timestamp:new Date},success:!0}}catch(m){return{error:I(i,"send email",m,n),success:!1}}},async validateCredentials(){return this.isAvailable()}}});export{L as default};
|
|
@@ -1,3 +1,36 @@
|
|
|
1
|
-
|
|
2
|
-
export {
|
|
3
|
-
|
|
1
|
+
import { P as ProviderFactory } from "../../packem_shared/provider.d-J-y6iogK.js";
|
|
2
|
+
export type { a as Provider } from "../../packem_shared/provider.d-J-y6iogK.js";
|
|
3
|
+
import { B as BaseConfig, E as EmailOptions } from "../../packem_shared/types.d-ejzh-xBP.js";
|
|
4
|
+
import 'node:buffer';
|
|
5
|
+
/**
|
|
6
|
+
* AhaSend configuration
|
|
7
|
+
*/
|
|
8
|
+
interface AhaSendConfig extends BaseConfig {
|
|
9
|
+
/**
|
|
10
|
+
* AhaSend API key
|
|
11
|
+
*/
|
|
12
|
+
apiKey: string;
|
|
13
|
+
/**
|
|
14
|
+
* AhaSend API endpoint
|
|
15
|
+
* Defaults to: https://api.ahasend.com
|
|
16
|
+
*/
|
|
17
|
+
endpoint?: string;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* AhaSend-specific email options
|
|
21
|
+
*/
|
|
22
|
+
interface AhaSendEmailOptions extends EmailOptions {
|
|
23
|
+
/**
|
|
24
|
+
* AhaSend template ID for template-based emails
|
|
25
|
+
*/
|
|
26
|
+
templateId?: string;
|
|
27
|
+
/**
|
|
28
|
+
* Template variables for AhaSend templates
|
|
29
|
+
*/
|
|
30
|
+
templateVariables?: Record<string, unknown>;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* AhaSend Provider for sending emails through AhaSend API
|
|
34
|
+
*/
|
|
35
|
+
declare const ahaSendProvider: ProviderFactory<AhaSendConfig>;
|
|
36
|
+
export { type AhaSendConfig, type AhaSendEmailOptions, type ProviderFactory, ahaSendProvider };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{default as r}from"../../packem_shared/ahaSendProvider-
|
|
1
|
+
import{default as r}from"../../packem_shared/ahaSendProvider-D81_wUA1.js";export{r as ahaSendProvider};
|
|
@@ -1,3 +1,47 @@
|
|
|
1
|
-
|
|
2
|
-
export {
|
|
3
|
-
|
|
1
|
+
import { P as ProviderFactory } from "../../packem_shared/provider.d-J-y6iogK.js";
|
|
2
|
+
export type { a as Provider } from "../../packem_shared/provider.d-J-y6iogK.js";
|
|
3
|
+
import { B as BaseConfig, E as EmailOptions } from "../../packem_shared/types.d-ejzh-xBP.js";
|
|
4
|
+
import 'node:buffer';
|
|
5
|
+
/**
|
|
6
|
+
* AWS SES configuration
|
|
7
|
+
*/
|
|
8
|
+
interface AwsSesConfig extends BaseConfig {
|
|
9
|
+
accessKeyId: string;
|
|
10
|
+
apiVersion?: string;
|
|
11
|
+
endpoint?: string;
|
|
12
|
+
maxAttempts?: number;
|
|
13
|
+
region: string;
|
|
14
|
+
secretAccessKey: string;
|
|
15
|
+
sessionToken?: string;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* AWS SES-specific email options
|
|
19
|
+
*/
|
|
20
|
+
interface AwsSesEmailOptions extends EmailOptions {
|
|
21
|
+
/**
|
|
22
|
+
* Configuration set name
|
|
23
|
+
*/
|
|
24
|
+
configurationSetName?: string;
|
|
25
|
+
/**
|
|
26
|
+
* Message tags as key-value pairs
|
|
27
|
+
*/
|
|
28
|
+
messageTags?: Record<string, string>;
|
|
29
|
+
/**
|
|
30
|
+
* Return path email address
|
|
31
|
+
*/
|
|
32
|
+
returnPath?: string;
|
|
33
|
+
/**
|
|
34
|
+
* Return path ARN
|
|
35
|
+
*/
|
|
36
|
+
returnPathArn?: string;
|
|
37
|
+
/**
|
|
38
|
+
* Source ARN for sending authorization
|
|
39
|
+
*/
|
|
40
|
+
sourceArn?: string;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* AWS SES Email Provider Implementation - Zero dependency version
|
|
44
|
+
* Uses native Node.js APIs instead of AWS SDK
|
|
45
|
+
*/
|
|
46
|
+
declare const awsSesProvider: ProviderFactory<AwsSesConfig>;
|
|
47
|
+
export { type AwsSesConfig, type AwsSesEmailOptions, type ProviderFactory, awsSesProvider };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{default as a}from"../../packem_shared/awsSesProvider-
|
|
1
|
+
import{default as a}from"../../packem_shared/awsSesProvider-BGZJUIep.js";export{a as awsSesProvider};
|
|
@@ -1,3 +1,52 @@
|
|
|
1
|
-
|
|
2
|
-
export {
|
|
3
|
-
|
|
1
|
+
import { P as ProviderFactory } from "../../packem_shared/provider.d-J-y6iogK.js";
|
|
2
|
+
export type { a as Provider } from "../../packem_shared/provider.d-J-y6iogK.js";
|
|
3
|
+
import { B as BaseConfig, E as EmailOptions } from "../../packem_shared/types.d-ejzh-xBP.js";
|
|
4
|
+
import 'node:buffer';
|
|
5
|
+
/**
|
|
6
|
+
* Azure Communication Services configuration
|
|
7
|
+
*/
|
|
8
|
+
interface AzureConfig extends BaseConfig {
|
|
9
|
+
/**
|
|
10
|
+
* Azure AD access token (for OAuth2 authentication)
|
|
11
|
+
*/
|
|
12
|
+
accessToken?: string;
|
|
13
|
+
/**
|
|
14
|
+
* Azure Communication Services connection string or access token
|
|
15
|
+
*/
|
|
16
|
+
connectionString?: string;
|
|
17
|
+
/**
|
|
18
|
+
* Azure Communication Services endpoint
|
|
19
|
+
* Defaults to: https://{region}.communication.azure.com
|
|
20
|
+
*/
|
|
21
|
+
endpoint?: string;
|
|
22
|
+
/**
|
|
23
|
+
* Azure region (e.g., "eastus", "westus")
|
|
24
|
+
*/
|
|
25
|
+
region: string;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Azure-specific email options
|
|
29
|
+
*/
|
|
30
|
+
interface AzureEmailOptions extends EmailOptions {
|
|
31
|
+
/**
|
|
32
|
+
* Custom headers
|
|
33
|
+
*/
|
|
34
|
+
headers?: Record<string, string>;
|
|
35
|
+
/**
|
|
36
|
+
* Importance level (normal, high)
|
|
37
|
+
*/
|
|
38
|
+
importance?: "normal" | "high";
|
|
39
|
+
/**
|
|
40
|
+
* Azure template ID for template-based emails
|
|
41
|
+
*/
|
|
42
|
+
templateId?: string;
|
|
43
|
+
/**
|
|
44
|
+
* Template variables for Azure templates
|
|
45
|
+
*/
|
|
46
|
+
templateVariables?: Record<string, unknown>;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Azure Communication Services Provider for sending emails through Azure API
|
|
50
|
+
*/
|
|
51
|
+
declare const azureProvider: ProviderFactory<AzureConfig, unknown, AzureEmailOptions>;
|
|
52
|
+
export { type AzureConfig, type AzureEmailOptions, type ProviderFactory, azureProvider };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{default as a}from"../../packem_shared/azureProvider-
|
|
1
|
+
import{default as a}from"../../packem_shared/azureProvider-CmcK4bsf.js";export{a as azureProvider};
|
|
@@ -1,3 +1,65 @@
|
|
|
1
|
-
|
|
2
|
-
export {
|
|
3
|
-
|
|
1
|
+
import { P as ProviderFactory } from "../../packem_shared/provider.d-J-y6iogK.js";
|
|
2
|
+
export type { a as Provider } from "../../packem_shared/provider.d-J-y6iogK.js";
|
|
3
|
+
import { B as BaseConfig, E as EmailOptions, c as EmailAddress } from "../../packem_shared/types.d-ejzh-xBP.js";
|
|
4
|
+
import 'node:buffer';
|
|
5
|
+
/**
|
|
6
|
+
* Brevo configuration
|
|
7
|
+
*/
|
|
8
|
+
interface BrevoConfig extends BaseConfig {
|
|
9
|
+
/**
|
|
10
|
+
* Brevo API key
|
|
11
|
+
*/
|
|
12
|
+
apiKey: string;
|
|
13
|
+
/**
|
|
14
|
+
* Brevo API endpoint
|
|
15
|
+
* Defaults to: https://api.brevo.com/v3
|
|
16
|
+
*/
|
|
17
|
+
endpoint?: string;
|
|
18
|
+
/**
|
|
19
|
+
* Enable hard validation for replyTo addresses.
|
|
20
|
+
* If true, arrays will be rejected. If false, the first address from an array will be used.
|
|
21
|
+
* Defaults to: false
|
|
22
|
+
*/
|
|
23
|
+
hardValidation?: boolean;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Brevo-specific email options
|
|
27
|
+
*/
|
|
28
|
+
interface BrevoEmailOptions extends Omit<EmailOptions, "replyTo"> {
|
|
29
|
+
/**
|
|
30
|
+
* Batch ID for batch sending
|
|
31
|
+
*/
|
|
32
|
+
batchId?: string;
|
|
33
|
+
/**
|
|
34
|
+
* Headers (custom headers)
|
|
35
|
+
*/
|
|
36
|
+
headers?: Record<string, string>;
|
|
37
|
+
/**
|
|
38
|
+
* Reply-to email address (can override base replyTo).
|
|
39
|
+
* Only one address is allowed. If an array is provided and hardValidation is false, the first address will be used.
|
|
40
|
+
*/
|
|
41
|
+
replyTo?: EmailAddress | EmailAddress[];
|
|
42
|
+
/**
|
|
43
|
+
* Scheduled date/time
|
|
44
|
+
* - If string: ISO 8601 format (e.g., "2025-01-15T10:00:00Z")
|
|
45
|
+
* - If number: Unix timestamp in seconds (not milliseconds)
|
|
46
|
+
*/
|
|
47
|
+
scheduledAt?: string | number;
|
|
48
|
+
/**
|
|
49
|
+
* Tags for categorization
|
|
50
|
+
*/
|
|
51
|
+
tags?: string[];
|
|
52
|
+
/**
|
|
53
|
+
* Brevo template ID for template-based emails
|
|
54
|
+
*/
|
|
55
|
+
templateId?: number;
|
|
56
|
+
/**
|
|
57
|
+
* Template parameters for Brevo templates
|
|
58
|
+
*/
|
|
59
|
+
templateParams?: Record<string, unknown>;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Brevo Provider for sending emails through Brevo API
|
|
63
|
+
*/
|
|
64
|
+
declare const brevoProvider: ProviderFactory<BrevoConfig, unknown, BrevoEmailOptions>;
|
|
65
|
+
export { type BrevoConfig, type BrevoEmailOptions, type ProviderFactory, brevoProvider };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{default as o}from"../../packem_shared/brevoProvider-
|
|
1
|
+
import{default as o}from"../../packem_shared/brevoProvider-C1BDXr41.js";export{o as brevoProvider};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { P as ProviderFactory } from "../../packem_shared/provider.d-J-y6iogK.js";
|
|
2
|
+
export type { a as Provider } from "../../packem_shared/provider.d-J-y6iogK.js";
|
|
3
|
+
import { B as BaseConfig, E as EmailOptions } from "../../packem_shared/types.d-ejzh-xBP.js";
|
|
4
|
+
import 'node:buffer';
|
|
5
|
+
/**
|
|
6
|
+
* Cloudflare Email Workers configuration.
|
|
7
|
+
*
|
|
8
|
+
* Cloudflare's send binding lives in the Workers runtime, so you wire it up yourself and pass a thin
|
|
9
|
+
* `send` function — keeping this provider runtime-agnostic and testable.
|
|
10
|
+
*/
|
|
11
|
+
interface CloudflareEmailConfig extends BaseConfig {
|
|
12
|
+
/**
|
|
13
|
+
* Sends a raw RFC 822 message via your Worker's Email binding.
|
|
14
|
+
* @param from The envelope-from address.
|
|
15
|
+
* @param to The single recipient address.
|
|
16
|
+
* @param raw The full RFC 822 (EML) message.
|
|
17
|
+
* @example
|
|
18
|
+
* ```ts
|
|
19
|
+
* send: async (from, to, raw) => {
|
|
20
|
+
* const { EmailMessage } = await import("cloudflare:email");
|
|
21
|
+
* await env.SEND_EMAIL.send(new EmailMessage(from, to, raw));
|
|
22
|
+
* }
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
25
|
+
send: (from: string, to: string, raw: string) => Promise<void>;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Cloudflare Email-specific options.
|
|
29
|
+
*/
|
|
30
|
+
type CloudflareEmailOptions = EmailOptions;
|
|
31
|
+
/**
|
|
32
|
+
* Cloudflare Email Workers provider — sends a raw RFC 822 message through a Worker's Email send
|
|
33
|
+
* binding (supplied via {@link CloudflareEmailConfig.send}). Single-recipient only, per the binding.
|
|
34
|
+
*/
|
|
35
|
+
declare const cloudflareEmailProvider: ProviderFactory<CloudflareEmailConfig>;
|
|
36
|
+
export { type CloudflareEmailConfig, type CloudflareEmailOptions, type ProviderFactory, cloudflareEmailProvider };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{default as e}from"../../packem_shared/cloudflareEmailProvider-Bv-ty-74.js";export{e as cloudflareEmailProvider};
|