@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,199 @@
|
|
|
1
|
+
import { E as EmailOptions } from "../packem_shared/types.d-ejzh-xBP.js";
|
|
2
|
+
import { E as EnqueueOptions, Q as QueueJob, a as EmailQueue } from "../packem_shared/types.d-lcJZmwRK.js";
|
|
3
|
+
import 'node:buffer';
|
|
4
|
+
type StorageValue = null | string | number | boolean | object;
|
|
5
|
+
type WatchEvent = "update" | "remove";
|
|
6
|
+
type WatchCallback = (event: WatchEvent, key: string) => any;
|
|
7
|
+
type MaybePromise<T> = T | Promise<T>;
|
|
8
|
+
type MaybeDefined<T> = T extends any ? T : any;
|
|
9
|
+
type Unwatch = () => MaybePromise<void>;
|
|
10
|
+
interface StorageMeta {
|
|
11
|
+
atime?: Date;
|
|
12
|
+
mtime?: Date;
|
|
13
|
+
ttl?: number;
|
|
14
|
+
[key: string]: StorageValue | Date | undefined;
|
|
15
|
+
}
|
|
16
|
+
type TransactionOptions = Record<string, any>;
|
|
17
|
+
type GetKeysOptions = TransactionOptions & {
|
|
18
|
+
maxDepth?: number;
|
|
19
|
+
};
|
|
20
|
+
interface DriverFlags {
|
|
21
|
+
maxDepth?: boolean;
|
|
22
|
+
ttl?: boolean;
|
|
23
|
+
}
|
|
24
|
+
interface Driver<OptionsT = any, InstanceT = any> {
|
|
25
|
+
name?: string;
|
|
26
|
+
flags?: DriverFlags;
|
|
27
|
+
options?: OptionsT;
|
|
28
|
+
getInstance?: () => InstanceT;
|
|
29
|
+
hasItem: (key: string, opts: TransactionOptions) => MaybePromise<boolean>;
|
|
30
|
+
getItem: (key: string, opts?: TransactionOptions) => MaybePromise<StorageValue>;
|
|
31
|
+
/** @experimental */
|
|
32
|
+
getItems?: (items: {
|
|
33
|
+
key: string;
|
|
34
|
+
options?: TransactionOptions;
|
|
35
|
+
}[], commonOptions?: TransactionOptions) => MaybePromise<{
|
|
36
|
+
key: string;
|
|
37
|
+
value: StorageValue;
|
|
38
|
+
}[]>;
|
|
39
|
+
/** @experimental */
|
|
40
|
+
getItemRaw?: (key: string, opts: TransactionOptions) => MaybePromise<unknown>;
|
|
41
|
+
setItem?: (key: string, value: string, opts: TransactionOptions) => MaybePromise<void>;
|
|
42
|
+
/** @experimental */
|
|
43
|
+
setItems?: (items: {
|
|
44
|
+
key: string;
|
|
45
|
+
value: string;
|
|
46
|
+
options?: TransactionOptions;
|
|
47
|
+
}[], commonOptions?: TransactionOptions) => MaybePromise<void>;
|
|
48
|
+
/** @experimental */
|
|
49
|
+
setItemRaw?: (key: string, value: any, opts: TransactionOptions) => MaybePromise<void>;
|
|
50
|
+
removeItem?: (key: string, opts: TransactionOptions) => MaybePromise<void>;
|
|
51
|
+
getMeta?: (key: string, opts: TransactionOptions) => MaybePromise<StorageMeta | null>;
|
|
52
|
+
getKeys: (base: string, opts: GetKeysOptions) => MaybePromise<string[]>;
|
|
53
|
+
clear?: (base: string, opts: TransactionOptions) => MaybePromise<void>;
|
|
54
|
+
dispose?: () => MaybePromise<void>;
|
|
55
|
+
watch?: (callback: WatchCallback) => MaybePromise<Unwatch>;
|
|
56
|
+
}
|
|
57
|
+
type StorageDefinition = {
|
|
58
|
+
items: unknown;
|
|
59
|
+
[key: string]: unknown;
|
|
60
|
+
};
|
|
61
|
+
type StorageItemMap<T> = T extends StorageDefinition ? T["items"] : T;
|
|
62
|
+
type StorageItemType<T, K> = K extends keyof StorageItemMap<T> ? StorageItemMap<T>[K] : T extends StorageDefinition ? StorageValue : T;
|
|
63
|
+
interface Storage<T extends StorageValue = StorageValue> {
|
|
64
|
+
hasItem<U extends Extract<T, StorageDefinition>, K extends keyof StorageItemMap<U>>(key: K, opts?: TransactionOptions): Promise<boolean>;
|
|
65
|
+
hasItem(key: string, opts?: TransactionOptions): Promise<boolean>;
|
|
66
|
+
getItem<U extends Extract<T, StorageDefinition>, K extends string & keyof StorageItemMap<U>>(key: K, ops?: TransactionOptions): Promise<StorageItemType<T, K> | null>;
|
|
67
|
+
getItem<R = StorageItemType<T, string>>(key: string, opts?: TransactionOptions): Promise<R | null>;
|
|
68
|
+
/** @experimental */
|
|
69
|
+
getItems: <U extends T>(items: (string | {
|
|
70
|
+
key: string;
|
|
71
|
+
options?: TransactionOptions;
|
|
72
|
+
})[], commonOptions?: TransactionOptions) => Promise<{
|
|
73
|
+
key: string;
|
|
74
|
+
value: U;
|
|
75
|
+
}[]>;
|
|
76
|
+
/** @experimental See https://github.com/unjs/unstorage/issues/142 */
|
|
77
|
+
getItemRaw: <T = any>(key: string, opts?: TransactionOptions) => Promise<MaybeDefined<T> | null>;
|
|
78
|
+
setItem<U extends Extract<T, StorageDefinition>, K extends keyof StorageItemMap<U>>(key: K, value: StorageItemType<T, K>, opts?: TransactionOptions): Promise<void>;
|
|
79
|
+
setItem<U extends T>(key: string, value: U, opts?: TransactionOptions): Promise<void>;
|
|
80
|
+
/** @experimental */
|
|
81
|
+
setItems: <U extends T>(items: {
|
|
82
|
+
key: string;
|
|
83
|
+
value: U;
|
|
84
|
+
options?: TransactionOptions;
|
|
85
|
+
}[], commonOptions?: TransactionOptions) => Promise<void>;
|
|
86
|
+
/** @experimental See https://github.com/unjs/unstorage/issues/142 */
|
|
87
|
+
setItemRaw: <T = any>(key: string, value: MaybeDefined<T>, opts?: TransactionOptions) => Promise<void>;
|
|
88
|
+
removeItem<U extends Extract<T, StorageDefinition>, K extends keyof StorageItemMap<U>>(key: K, opts?: (TransactionOptions & {
|
|
89
|
+
removeMeta?: boolean;
|
|
90
|
+
}) | boolean): Promise<void>;
|
|
91
|
+
removeItem(key: string, opts?: (TransactionOptions & {
|
|
92
|
+
removeMeta?: boolean;
|
|
93
|
+
}) | boolean): Promise<void>;
|
|
94
|
+
getMeta: (key: string, opts?: (TransactionOptions & {
|
|
95
|
+
nativeOnly?: boolean;
|
|
96
|
+
}) | boolean) => MaybePromise<StorageMeta>;
|
|
97
|
+
setMeta: (key: string, value: StorageMeta, opts?: TransactionOptions) => Promise<void>;
|
|
98
|
+
removeMeta: (key: string, opts?: TransactionOptions) => Promise<void>;
|
|
99
|
+
getKeys: (base?: string, opts?: GetKeysOptions) => Promise<string[]>;
|
|
100
|
+
clear: (base?: string, opts?: TransactionOptions) => Promise<void>;
|
|
101
|
+
dispose: () => Promise<void>;
|
|
102
|
+
watch: (callback: WatchCallback) => Promise<Unwatch>;
|
|
103
|
+
unwatch: () => Promise<void>;
|
|
104
|
+
mount: (base: string, driver: Driver) => Storage;
|
|
105
|
+
unmount: (base: string, dispose?: boolean) => Promise<void>;
|
|
106
|
+
getMount: (key?: string) => {
|
|
107
|
+
base: string;
|
|
108
|
+
driver: Driver;
|
|
109
|
+
};
|
|
110
|
+
getMounts: (base?: string, options?: {
|
|
111
|
+
parents?: boolean;
|
|
112
|
+
}) => {
|
|
113
|
+
base: string;
|
|
114
|
+
driver: Driver;
|
|
115
|
+
}[];
|
|
116
|
+
keys: Storage["getKeys"];
|
|
117
|
+
get: Storage<T>["getItem"];
|
|
118
|
+
set: Storage<T>["setItem"];
|
|
119
|
+
has: Storage<T>["hasItem"];
|
|
120
|
+
del: Storage<T>["removeItem"];
|
|
121
|
+
remove: Storage<T>["removeItem"];
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* Options for {@link UnstorageQueue}.
|
|
125
|
+
*/
|
|
126
|
+
interface UnstorageQueueOptions {
|
|
127
|
+
/**
|
|
128
|
+
* Time source in milliseconds — injectable for tests. Defaults to `Date.now`.
|
|
129
|
+
*/
|
|
130
|
+
now?: () => number;
|
|
131
|
+
/**
|
|
132
|
+
* Key prefix under which jobs are stored.
|
|
133
|
+
* @default "email:queue"
|
|
134
|
+
*/
|
|
135
|
+
prefix?: string;
|
|
136
|
+
/**
|
|
137
|
+
* How long, in milliseconds, a reserved job stays hidden before becoming deliverable again.
|
|
138
|
+
* @default 30000
|
|
139
|
+
*/
|
|
140
|
+
visibilityTimeout?: number;
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* A durable {@link EmailQueue} backed by an [unstorage](https://unstorage.unjs.io/) `Storage`.
|
|
144
|
+
*
|
|
145
|
+
* Because unstorage abstracts many backends (memory, filesystem, Redis, Cloudflare KV, Postgres, …),
|
|
146
|
+
* a single adapter persists the queue across all of them. The stored `message` must be
|
|
147
|
+
* JSON-serializable (avoid `Buffer` attachments — pass `path`/`href`/base64 `content` instead).
|
|
148
|
+
*
|
|
149
|
+
* Note: unstorage has no transactions, so {@link UnstorageQueue.reserve} is best-effort under
|
|
150
|
+
* concurrent workers; the visibility timeout bounds duplicate delivery on a crash.
|
|
151
|
+
*/
|
|
152
|
+
declare class UnstorageQueue implements EmailQueue {
|
|
153
|
+
private readonly storage;
|
|
154
|
+
private readonly prefix;
|
|
155
|
+
private readonly visibilityTimeout;
|
|
156
|
+
private readonly now;
|
|
157
|
+
/**
|
|
158
|
+
* @param storage The unstorage instance to persist jobs in.
|
|
159
|
+
* @param options Adapter options. See {@link UnstorageQueueOptions}.
|
|
160
|
+
*/
|
|
161
|
+
constructor(storage: Storage, options?: UnstorageQueueOptions);
|
|
162
|
+
/**
|
|
163
|
+
* Persists a message to the store.
|
|
164
|
+
* @param message The message to send later.
|
|
165
|
+
* @param options Optional scheduling. See {@link EnqueueOptions}.
|
|
166
|
+
* @returns The new job id.
|
|
167
|
+
*/
|
|
168
|
+
enqueue(message: EmailOptions, options?: EnqueueOptions): Promise<string>;
|
|
169
|
+
/**
|
|
170
|
+
* Reserves the next ready job, hiding it for the visibility window.
|
|
171
|
+
* @returns The next deliverable job, or `undefined` when none is ready.
|
|
172
|
+
*/
|
|
173
|
+
reserve(): Promise<QueueJob | undefined>;
|
|
174
|
+
/**
|
|
175
|
+
* Removes a processed job from the store.
|
|
176
|
+
* @param id The job id.
|
|
177
|
+
*/
|
|
178
|
+
ack(id: string): Promise<void>;
|
|
179
|
+
/**
|
|
180
|
+
* Requeues a job after a delay, incrementing its attempt count.
|
|
181
|
+
* @param id The job id.
|
|
182
|
+
* @param delayMs Milliseconds to wait before the job becomes ready again.
|
|
183
|
+
*/
|
|
184
|
+
retry(id: string, delayMs?: number): Promise<void>;
|
|
185
|
+
/**
|
|
186
|
+
* Counts the jobs currently in the store.
|
|
187
|
+
* @returns The number of stored (ready plus reserved) jobs.
|
|
188
|
+
*/
|
|
189
|
+
size(): Promise<number>;
|
|
190
|
+
private keyOf;
|
|
191
|
+
}
|
|
192
|
+
/**
|
|
193
|
+
* Creates an {@link UnstorageQueue}.
|
|
194
|
+
* @param storage The unstorage instance to persist jobs in.
|
|
195
|
+
* @param options Adapter options. See {@link UnstorageQueueOptions}.
|
|
196
|
+
* @returns A new {@link UnstorageQueue}.
|
|
197
|
+
*/
|
|
198
|
+
declare const createUnstorageQueue: (storage: Storage, options?: UnstorageQueueOptions) => UnstorageQueue;
|
|
199
|
+
export { UnstorageQueue, UnstorageQueueOptions, createUnstorageQueue };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{createRequire as n}from"node:module";const c=n(import.meta.url),o=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,u=r=>{if(typeof o<"u"&&o.versions&&o.versions.node){const[e,s]=o.versions.node.split(".").map(Number);if(e>22||e===22&&s>=3||e===20&&s>=16)return o.getBuiltinModule(r)}return c(r)},{randomUUID:d}=u("node:crypto");class h{storage;prefix;visibilityTimeout;now;constructor(e,s={}){this.storage=e,this.prefix=s.prefix??"email:queue",this.visibilityTimeout=s.visibilityTimeout??3e4,this.now=s.now??Date.now}async enqueue(e,s={}){const i=d(),t=s.scheduledAt instanceof Date?s.scheduledAt.getTime():s.scheduledAt??this.now(),a={attempts:0,id:i,message:e,reservedUntil:0,scheduledAt:t};return await this.storage.setItem(this.keyOf(i),a),i}async reserve(){const e=this.now(),s=await this.storage.getKeys(this.prefix);for(const i of s){const t=await this.storage.getItem(i);if(t&&t.scheduledAt<=e&&t.reservedUntil<=e)return t.reservedUntil=e+this.visibilityTimeout,await this.storage.setItem(i,t),{attempts:t.attempts,id:t.id,message:t.message,scheduledAt:t.scheduledAt}}}async ack(e){await this.storage.removeItem(this.keyOf(e))}async retry(e,s=0){const i=this.keyOf(e),t=await this.storage.getItem(i);t&&(t.attempts+=1,t.reservedUntil=0,t.scheduledAt=this.now()+s,await this.storage.setItem(i,t))}async size(){return(await this.storage.getKeys(this.prefix)).length}keyOf(e){return`${this.prefix}:${e}`}}const m=(r,e)=>new h(r,e);export{h as UnstorageQueue,m as createUnstorageQueue};
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Rewrites `cid:` references in `src`/`href` attributes using a resolver.
|
|
3
|
+
*
|
|
4
|
+
* Useful for turning inline (Content-ID) image references into hosted URLs for previews/webmail, or
|
|
5
|
+
* for normalizing them. Returning `undefined` from the resolver leaves that reference unchanged.
|
|
6
|
+
* @param html The HTML email.
|
|
7
|
+
* @param resolver Maps a Content-ID to a replacement URL (or `undefined` to keep it).
|
|
8
|
+
* @returns The rewritten HTML.
|
|
9
|
+
*/
|
|
10
|
+
declare const rewriteCidLinks: (html: string, resolver: (cid: string) => string | undefined) => string;
|
|
11
|
+
/**
|
|
12
|
+
* Collects the Content-IDs referenced via `cid:` in `src`/`href` attributes.
|
|
13
|
+
* @param html The HTML email.
|
|
14
|
+
* @returns The referenced Content-IDs (de-duplicated, in first-seen order).
|
|
15
|
+
*/
|
|
16
|
+
declare const extractCidReferences: (html: string) => string[];
|
|
17
|
+
/**
|
|
18
|
+
* Inlines `<style>`/linked CSS into element `style` attributes for maximum email-client
|
|
19
|
+
* compatibility, via [juice](https://github.com/Automattic/juice).
|
|
20
|
+
*
|
|
21
|
+
* `juice` is an optional peer dependency — install it (`pnpm add juice`) to use this. It is loaded
|
|
22
|
+
* lazily (via `createRequire`) so importing the render entry point doesn't fail when `juice` is absent.
|
|
23
|
+
* @param html The HTML email.
|
|
24
|
+
* @param options Options forwarded to `juice` (e.g. `preserveImportant`, `removeStyleTags`).
|
|
25
|
+
* @returns The HTML with CSS inlined.
|
|
26
|
+
* @throws {EmailError} When `juice` is not installed or inlining fails.
|
|
27
|
+
*/
|
|
28
|
+
declare const inlineCss: (html: string, options?: Record<string, unknown>) => string;
|
|
29
|
+
/**
|
|
30
|
+
* Options for {@link addDarkModeSupport}.
|
|
31
|
+
*/
|
|
32
|
+
interface DarkModeOptions {
|
|
33
|
+
/**
|
|
34
|
+
* Extra CSS to wrap in a `@media (prefers-color-scheme: dark)` block (the dark-mode overrides).
|
|
35
|
+
*/
|
|
36
|
+
styles?: string;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Adds dark-mode hooks to an HTML email: the `color-scheme` / `supported-color-schemes` meta tags and,
|
|
40
|
+
* when provided, a `@media (prefers-color-scheme: dark)` style block.
|
|
41
|
+
*
|
|
42
|
+
* Injected into `<head>` (created after `<html>` if absent, otherwise prepended).
|
|
43
|
+
* @param html The HTML email.
|
|
44
|
+
* @param options Dark-mode options. See {@link DarkModeOptions}.
|
|
45
|
+
* @returns The HTML with dark-mode support added.
|
|
46
|
+
*/
|
|
47
|
+
declare const addDarkModeSupport: (html: string, options?: DarkModeOptions) => string;
|
|
48
|
+
/**
|
|
49
|
+
* Options for {@link injectPreheader}.
|
|
50
|
+
*/
|
|
51
|
+
interface PreheaderOptions {
|
|
52
|
+
/**
|
|
53
|
+
* Append invisible padding characters so the preheader text isn't followed by leaked body content
|
|
54
|
+
* in the inbox preview.
|
|
55
|
+
* @default true
|
|
56
|
+
*/
|
|
57
|
+
spacer?: boolean;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Injects a hidden preheader (inbox preview text) at the start of the HTML body.
|
|
61
|
+
*
|
|
62
|
+
* The preheader is wrapped in a `display:none` element with `mso-hide:all`, followed by zero-width
|
|
63
|
+
* padding so the preview shows only your text. Inserted right after `<body>` (or prepended if no
|
|
64
|
+
* body tag is present).
|
|
65
|
+
* @param html The HTML email.
|
|
66
|
+
* @param preheader The preview text.
|
|
67
|
+
* @param options Injection options. See {@link PreheaderOptions}.
|
|
68
|
+
* @returns The HTML with the preheader injected.
|
|
69
|
+
*/
|
|
70
|
+
declare const injectPreheader: (html: string, preheader: string, options?: PreheaderOptions) => string;
|
|
71
|
+
/**
|
|
72
|
+
* Options for {@link postProcessHtml}. Each step runs only when its option is set; the order is
|
|
73
|
+
* CSS-inline → preheader → dark-mode → CID rewrite.
|
|
74
|
+
*/
|
|
75
|
+
interface PostProcessOptions {
|
|
76
|
+
/**
|
|
77
|
+
* Rewrite `cid:` references using this resolver (see {@link rewriteCidLinks}).
|
|
78
|
+
*/
|
|
79
|
+
cidResolver?: (cid: string) => string | undefined;
|
|
80
|
+
/**
|
|
81
|
+
* Add dark-mode hooks. `true` adds the meta tags only; an object also injects dark CSS.
|
|
82
|
+
*/
|
|
83
|
+
darkMode?: DarkModeOptions | boolean;
|
|
84
|
+
/**
|
|
85
|
+
* Inline CSS via `juice`. `true` uses defaults; an object forwards options to `juice`.
|
|
86
|
+
*/
|
|
87
|
+
inlineCss?: Record<string, unknown> | boolean;
|
|
88
|
+
/**
|
|
89
|
+
* Inject hidden preview text at the top of the body.
|
|
90
|
+
*/
|
|
91
|
+
preheader?: string;
|
|
92
|
+
/**
|
|
93
|
+
* Options for the preheader injection.
|
|
94
|
+
*/
|
|
95
|
+
preheaderOptions?: PreheaderOptions;
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Runs an HTML email through the selected post-processing steps.
|
|
99
|
+
*
|
|
100
|
+
* A convenience pipeline over {@link inlineCss}, {@link injectPreheader}, {@link addDarkModeSupport} and
|
|
101
|
+
* {@link rewriteCidLinks}. Only the steps whose options are provided run.
|
|
102
|
+
* @param html The HTML email.
|
|
103
|
+
* @param options Which steps to apply. See {@link PostProcessOptions}.
|
|
104
|
+
* @returns The processed HTML.
|
|
105
|
+
*/
|
|
106
|
+
declare const postProcessHtml: (html: string, options?: PostProcessOptions) => string;
|
|
107
|
+
export { type DarkModeOptions, type PostProcessOptions, type PreheaderOptions, addDarkModeSupport, extractCidReferences, injectPreheader, inlineCss, postProcessHtml, rewriteCidLinks };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{extractCidReferences as o,rewriteCidLinks as t}from"../packem_shared/extractCidReferences-BuoTREMp.js";import{default as s}from"../packem_shared/inlineCss-BQ7d2Cyz.js";import{addDarkModeSupport as f}from"../packem_shared/addDarkModeSupport-DZYxULjl.js";import{postProcessHtml as a}from"../packem_shared/postProcessHtml-DqKi2Ucg.js";import{injectPreheader as x}from"../packem_shared/injectPreheader-CF9WHZ7J.js";export{f as addDarkModeSupport,o as extractCidReferences,x as injectPreheader,s as inlineCss,a as postProcessHtml,t as rewriteCidLinks};
|
|
@@ -1,25 +1,26 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { T as TemplateRenderer } from "../packem_shared/types.d-nyR1ty1Q.js";
|
|
2
2
|
/**
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
3
|
+
* Renders Handlebars template.
|
|
4
|
+
* @param template Handlebars template string.
|
|
5
|
+
* @param data Data to pass to the template.
|
|
6
|
+
* @param options Handlebars compile options.
|
|
7
|
+
* @returns Rendered HTML string.
|
|
8
|
+
* @throws {TypeError} When template is not a string.
|
|
9
|
+
* @throws {EmailError} When Handlebars is not installed or rendering fails.
|
|
10
|
+
*/
|
|
11
|
+
declare const renderHandlebars: TemplateRenderer;
|
|
12
12
|
/**
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
13
|
+
* Registers a Handlebars helper function for use in templates.
|
|
14
|
+
* @param name The name of the helper to register.
|
|
15
|
+
* @param helper The helper function to register.
|
|
16
|
+
* @throws {EmailError} When Handlebars is not installed.
|
|
17
|
+
*/
|
|
18
|
+
declare const registerHandlebarsHelper: (name: string, helper: unknown) => void;
|
|
19
19
|
/**
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
20
|
+
* Registers a Handlebars partial template for reuse in other templates.
|
|
21
|
+
* @param name The name of the partial to register.
|
|
22
|
+
* @param partial The partial template string to register.
|
|
23
|
+
* @throws {EmailError} When Handlebars is not installed.
|
|
24
|
+
*/
|
|
25
|
+
declare const registerHandlebarsPartial: (name: string, partial: string) => void;
|
|
26
|
+
export { registerHandlebarsHelper, registerHandlebarsPartial, renderHandlebars };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
import t from"handlebars";import s from"../packem_shared/EmailError-B-sEf3bp.js";const i=(a,r,e)=>{try{if(typeof a!="string")throw new TypeError("Handlebars template must be a string");return t.compile(a,e)(r??{})}catch(n){throw n instanceof Error&&n.message.includes("Cannot find module")?new s("handlebars","Handlebars is not installed. Please install it: pnpm add handlebars",{cause:n}):new s("handlebars",`Failed to render Handlebars template: ${n.message}`,{cause:n})}},o=(a,r)=>{try{t.registerHelper(a,r)}catch(e){throw e instanceof Error&&e.message.includes("Cannot find module")?new s("handlebars","Handlebars is not installed. Please install it: pnpm add handlebars",{cause:e}):e}},c=(a,r)=>{try{t.registerPartial(a,r)}catch(e){throw e instanceof Error&&e.message.includes("Cannot find module")?new s("handlebars","Handlebars is not installed. Please install it: pnpm add handlebars",{cause:e}):e}};export{o as registerHandlebarsHelper,c as registerHandlebarsPartial,i as renderHandlebars};
|
|
@@ -1,27 +1,27 @@
|
|
|
1
1
|
/**
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
2
|
+
* Converts HTML content to plain text format.
|
|
3
|
+
* @param html The HTML string to convert.
|
|
4
|
+
* @param options Configuration options for the html-to-text conversion.
|
|
5
|
+
* @param options.longWordSplit Options for handling long words that exceed the word wrap limit.
|
|
6
|
+
* @param options.longWordSplit.forceWrapOnLimit Whether to force wrap on the limit.
|
|
7
|
+
* @param options.longWordSplit.wrapCharacters Characters to use for wrapping.
|
|
8
|
+
* @param options.preserveNewlines Whether to preserve newlines in the output.
|
|
9
|
+
* @param options.selectors Custom selectors for formatting specific HTML elements.
|
|
10
|
+
* @param options.wordwrap The word wrap limit (number of characters) or false to disable.
|
|
11
|
+
* @returns The converted plain text string.
|
|
12
|
+
* @throws {EmailError} When html-to-text is not installed or conversion fails.
|
|
13
|
+
*/
|
|
14
14
|
declare const htmlToText: (html: string, options?: {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
15
|
+
longWordSplit?: {
|
|
16
|
+
forceWrapOnLimit?: boolean;
|
|
17
|
+
wrapCharacters?: string[];
|
|
18
|
+
};
|
|
19
|
+
preserveNewlines?: boolean;
|
|
20
|
+
selectors?: {
|
|
21
|
+
format?: string;
|
|
22
|
+
options?: Record<string, unknown>;
|
|
23
|
+
selector: string;
|
|
24
|
+
}[];
|
|
25
|
+
wordwrap?: number | false;
|
|
26
26
|
}) => string;
|
|
27
|
-
export default
|
|
27
|
+
export { htmlToText as default };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
import{convert as s}from"html-to-text";import o from"../packem_shared/EmailError-B-sEf3bp.js";const a=(r,e)=>{try{return s(r,{longWordSplit:e?.longWordSplit,preserveNewlines:e?.preserveNewlines??!1,selectors:e?.selectors,wordwrap:e?.wordwrap??80})}catch(t){throw t instanceof Error&&t.message.includes("Cannot find module")?new o("html-to-text","html-to-text is not installed. Please install it: pnpm add html-to-text",{cause:t}):new o("html-to-text",`Failed to convert HTML to text: ${t.message}`,{cause:t})}};export{a as default};
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { T as TemplateRenderer } from "../packem_shared/types.d-nyR1ty1Q.js";
|
|
2
|
+
/**
|
|
3
|
+
* A map of locale code (e.g. `en`, `en-US`, `de`) to that locale's template.
|
|
4
|
+
*
|
|
5
|
+
* The template value is whatever the underlying {@link TemplateRenderer} accepts (a string for
|
|
6
|
+
* Handlebars/MJML/Liquid, a component for react-email/jsx-email, etc.).
|
|
7
|
+
*/
|
|
8
|
+
type LocaleTemplates = Record<string, unknown>;
|
|
9
|
+
/**
|
|
10
|
+
* Options for {@link renderI18n} and {@link createI18nRenderer}.
|
|
11
|
+
*/
|
|
12
|
+
interface I18nRenderOptions {
|
|
13
|
+
/**
|
|
14
|
+
* Locale to fall back to when the requested locale (and its language root) is missing.
|
|
15
|
+
*/
|
|
16
|
+
defaultLocale?: string;
|
|
17
|
+
/**
|
|
18
|
+
* Options forwarded to the underlying renderer.
|
|
19
|
+
*/
|
|
20
|
+
rendererOptions?: Record<string, unknown>;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Resolves the best-matching available locale key: exact match, then the language subtag
|
|
24
|
+
* (`en-US` → `en`), then the default locale.
|
|
25
|
+
* @param templates The available locale templates.
|
|
26
|
+
* @param locale The requested locale.
|
|
27
|
+
* @param defaultLocale Optional fallback locale.
|
|
28
|
+
* @returns The matching key, or `undefined` when nothing matches.
|
|
29
|
+
*/
|
|
30
|
+
declare const resolveLocale: (templates: LocaleTemplates, locale: string, defaultLocale?: string) => string | undefined;
|
|
31
|
+
/**
|
|
32
|
+
* Renders the template for a given locale using the supplied engine, with locale fallback.
|
|
33
|
+
* @param templates The per-locale templates. See {@link LocaleTemplates}.
|
|
34
|
+
* @param locale The requested locale (e.g. `de-AT`).
|
|
35
|
+
* @param renderer The underlying template engine (Handlebars, MJML, Liquid, react-email, …).
|
|
36
|
+
* @param data Data/variables passed to the renderer.
|
|
37
|
+
* @param options Fallback locale and renderer options. See {@link I18nRenderOptions}.
|
|
38
|
+
* @returns The rendered output for the resolved locale.
|
|
39
|
+
* @throws {EmailError} When no template matches the locale or the fallback.
|
|
40
|
+
*/
|
|
41
|
+
declare const renderI18n: (templates: LocaleTemplates, locale: string, renderer: TemplateRenderer, data?: Record<string, unknown>, options?: I18nRenderOptions) => Promise<string>;
|
|
42
|
+
/**
|
|
43
|
+
* A locale-resolving renderer produced by {@link createI18nRenderer}.
|
|
44
|
+
*/
|
|
45
|
+
type LocalizedRenderer = (templates: LocaleTemplates, locale: string, data?: Record<string, unknown>, rendererOptions?: Record<string, unknown>) => Promise<string>;
|
|
46
|
+
/**
|
|
47
|
+
* Creates a reusable localized renderer bound to an engine and default locale.
|
|
48
|
+
* @param renderer The underlying template engine.
|
|
49
|
+
* @param defaultLocale Optional default/fallback locale applied to every call.
|
|
50
|
+
* @returns A {@link LocalizedRenderer}.
|
|
51
|
+
* @example
|
|
52
|
+
* ```ts
|
|
53
|
+
* import { renderHandlebars } from "@visulima/email/template/handlebars";
|
|
54
|
+
* import { createI18nRenderer } from "@visulima/email/template/i18n";
|
|
55
|
+
*
|
|
56
|
+
* const render = createI18nRenderer(renderHandlebars, "en");
|
|
57
|
+
* await render({ en: "Hello {{name}}", de: "Hallo {{name}}" }, "de", { name: "Ada" });
|
|
58
|
+
* ```
|
|
59
|
+
*/
|
|
60
|
+
declare const createI18nRenderer: (renderer: TemplateRenderer, defaultLocale?: string) => LocalizedRenderer;
|
|
61
|
+
export { I18nRenderOptions, LocaleTemplates, LocalizedRenderer, createI18nRenderer, renderI18n, resolveLocale };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import l from"../packem_shared/EmailError-B-sEf3bp.js";const c=(t,r,a)=>{const n=new Map(Object.keys(t).map(o=>[o.toLowerCase(),o])),e=o=>{if(o!==void 0)return n.get(o.toLowerCase())};return e(r)??e(r.split("-")[0])??e(a)},d=async(t,r,a,n,e)=>{const o=c(t,r,e?.defaultLocale);if(o===void 0)throw new l("i18n",`No template found for locale "${r}"${e?.defaultLocale?` or default "${e.defaultLocale}"`:""}`);return await a(t[o],n,e?.rendererOptions)},f=(t,r)=>(a,n,e,o)=>d(a,n,t,e,{defaultLocale:r,rendererOptions:o});export{f as createI18nRenderer,d as renderI18n,c as resolveLocale};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { T as TemplateRenderer } from "../packem_shared/types.d-nyR1ty1Q.js";
|
|
2
|
+
/**
|
|
3
|
+
* Renders a [jsx-email](https://jsx.email/) component to HTML.
|
|
4
|
+
* @param template The jsx-email component element to render.
|
|
5
|
+
* @param _data Data object (unused; jsx-email components receive props directly).
|
|
6
|
+
* @param options Render options (`plainText`, `pretty`).
|
|
7
|
+
* @returns The rendered HTML (or plain text) string.
|
|
8
|
+
* @throws {EmailError} When `jsx-email` is not installed or rendering fails.
|
|
9
|
+
*/
|
|
10
|
+
declare const jsxEmail: TemplateRenderer;
|
|
11
|
+
export { jsxEmail as default };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import t from"../packem_shared/EmailError-B-sEf3bp.js";const l=async(n,s,a)=>{try{const{render:e}=await import("jsx-email");return await e(n,{plainText:a?.plainText,pretty:a?.pretty})}catch(e){throw e instanceof Error&&(e.code==="ERR_MODULE_NOT_FOUND"||e.message.includes("Cannot find module")||e.message.includes("Cannot find package"))?new t("jsx-email","jsx-email is not installed. Please install it: pnpm add jsx-email",{cause:e}):new t("jsx-email",`Failed to render jsx-email component: ${e.message}`,{cause:e})}};export{l as default};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { T as TemplateRenderer } from "../packem_shared/types.d-nyR1ty1Q.js";
|
|
2
|
+
/**
|
|
3
|
+
* Renders a [LiquidJS](https://liquidjs.com/) template to a string.
|
|
4
|
+
* @param template The Liquid template string.
|
|
5
|
+
* @param data The data/variables exposed to the template.
|
|
6
|
+
* @param options LiquidJS engine options (passed to the `Liquid` constructor).
|
|
7
|
+
* @returns The rendered output.
|
|
8
|
+
* @throws {TypeError} When the template is not a string.
|
|
9
|
+
* @throws {EmailError} When `liquidjs` is not installed or rendering fails.
|
|
10
|
+
*/
|
|
11
|
+
declare const liquid: TemplateRenderer;
|
|
12
|
+
export { liquid as default };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import t from"../packem_shared/EmailError-B-sEf3bp.js";const r=async(i,a,n)=>{try{if(typeof i!="string")throw new TypeError("Liquid template must be a string");const{Liquid:e}=await import("liquidjs");return await new e(n??{}).parseAndRender(i,a??{})}catch(e){throw e instanceof TypeError?e:e instanceof Error&&(e.code==="ERR_MODULE_NOT_FOUND"||e.message.includes("Cannot find module")||e.message.includes("Cannot find package"))?new t("liquid","liquidjs is not installed. Please install it: pnpm add liquidjs",{cause:e}):new t("liquid",`Failed to render Liquid template: ${e.message}`,{cause:e})}};export{r as default};
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { T as TemplateRenderer } from "../packem_shared/types.d-nyR1ty1Q.js";
|
|
2
2
|
/**
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
3
|
+
* Renders MJML to HTML.
|
|
4
|
+
* @param template MJML template string.
|
|
5
|
+
* @param _data Data (not used for MJML).
|
|
6
|
+
* @param options MJML options (beautify, fonts, keepComments, minify, validationLevel).
|
|
7
|
+
* @returns Rendered HTML string.
|
|
8
|
+
* @throws {TypeError} When template is not a string.
|
|
9
|
+
* @throws {EmailError} When MJML is not installed, validation fails, or rendering fails.
|
|
10
|
+
*/
|
|
11
11
|
declare const mjml: TemplateRenderer;
|
|
12
|
-
export default
|
|
12
|
+
export { mjml as default };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
import r from"mjml";import n from"../packem_shared/EmailError-B-sEf3bp.js";const f=(s,i,t)=>{try{if(typeof s!="string")throw new TypeError("MJML template must be a string");const e=r(s,{beautify:t?.beautify??!1,fonts:t?.fonts,keepComments:t?.keepComments??!0,minify:t?.minify??!1,validationLevel:t?.validationLevel??"soft"});if(e.errors&&e.errors.length>0){const o=e.errors.map(a=>a.message).join("; ");throw new n("mjml",`MJML validation errors: ${o}`)}return e.html}catch(e){throw e instanceof Error&&e.message.includes("Cannot find module")?new n("mjml","MJML is not installed. Please install it: pnpm add mjml",{cause:e}):e instanceof n?e:new n("mjml",`Failed to render MJML: ${e.message}`,{cause:e})}};export{f as default};
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { T as TemplateRenderer } from "../packem_shared/types.d-nyR1ty1Q.js";
|
|
2
2
|
/**
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
3
|
+
* Renders a React Email component to HTML.
|
|
4
|
+
* @param template The React component from \@react-email/components to render.
|
|
5
|
+
* @param _data Data object (not used for React Email, but kept for API compatibility).
|
|
6
|
+
* @param options Render options including plainText and pretty formatting.
|
|
7
|
+
* @returns The rendered HTML string.
|
|
8
|
+
* @throws {EmailError} When \@react-email/render is not installed or rendering fails.
|
|
9
|
+
*/
|
|
10
10
|
declare const reactEmail: TemplateRenderer;
|
|
11
|
-
export default
|
|
11
|
+
export { reactEmail as default };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
import{render as n}from"@react-email/render";import a from"../packem_shared/EmailError-B-sEf3bp.js";const s=async(r,i,t)=>{try{return await n(r,{plainText:t?.plainText,pretty:t?.pretty})}catch(e){throw e instanceof Error&&e.message.includes("Cannot find module")?new a("react-email","@react-email/render is not installed. Please install it: pnpm add @react-email/render",{cause:e}):new a("react-email",`Failed to render React Email component: ${e.message}`,{cause:e})}};export{s as default};
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { T as TemplateRenderer } from "../packem_shared/types.d-nyR1ty1Q.js";
|
|
2
2
|
/**
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
3
|
+
* Renders a Vue Email component to HTML.
|
|
4
|
+
* @param template The Vue component from \@vue-email/components to render.
|
|
5
|
+
* @param data Data and variables to pass to the template.
|
|
6
|
+
* @param options Render options including pretty formatting, plainText output, and htmlToTextOptions.
|
|
7
|
+
* @returns The rendered HTML or plain text string.
|
|
8
|
+
* @throws {EmailError} When \@vue-email/render is not installed or rendering fails.
|
|
9
|
+
*/
|
|
10
10
|
declare const vueEmail: TemplateRenderer;
|
|
11
|
-
export default
|
|
11
|
+
export { vueEmail as default };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
import{render as i}from"@vue-email/render";import a from"../packem_shared/EmailError-B-sEf3bp.js";const s=async(n,r,t)=>{try{return await i(n,r??{},{htmlToTextOptions:t?.htmlToTextOptions,plainText:t?.plainText,pretty:t?.pretty})}catch(e){throw e instanceof Error&&e.message.includes("Cannot find module")?new a("vue-email","@vue-email/render is not installed. Please install it: pnpm add @vue-email/render",{cause:e}):new a("vue-email",`Failed to render Vue Email component: ${e.message}`,{cause:e})}};export{s as default};
|