@visulima/email 1.0.0-alpha.8 → 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 +786 -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
|
@@ -1,3 +1,84 @@
|
|
|
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
|
+
* SendGrid configuration
|
|
7
|
+
*/
|
|
8
|
+
interface SendGridConfig extends BaseConfig {
|
|
9
|
+
apiKey: string;
|
|
10
|
+
endpoint?: string;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* SendGrid-specific email options
|
|
14
|
+
*/
|
|
15
|
+
interface SendGridEmailOptions extends EmailOptions {
|
|
16
|
+
/**
|
|
17
|
+
* ASM (Advanced Suppression Management) group ID for unsubscribe
|
|
18
|
+
*/
|
|
19
|
+
asmGroupId?: number;
|
|
20
|
+
/**
|
|
21
|
+
* Batch ID for batch sending
|
|
22
|
+
*/
|
|
23
|
+
batchId?: string;
|
|
24
|
+
/**
|
|
25
|
+
* IP pool name
|
|
26
|
+
*/
|
|
27
|
+
ipPoolName?: string;
|
|
28
|
+
/**
|
|
29
|
+
* Mail settings (click tracking, open tracking, etc.)
|
|
30
|
+
*/
|
|
31
|
+
mailSettings?: {
|
|
32
|
+
bypassListManagement?: boolean;
|
|
33
|
+
footer?: {
|
|
34
|
+
enable?: boolean;
|
|
35
|
+
html?: string;
|
|
36
|
+
text?: string;
|
|
37
|
+
};
|
|
38
|
+
sandboxMode?: boolean;
|
|
39
|
+
};
|
|
40
|
+
/**
|
|
41
|
+
* Send at timestamp (Unix timestamp)
|
|
42
|
+
*/
|
|
43
|
+
sendAt?: number;
|
|
44
|
+
/**
|
|
45
|
+
* Dynamic template data for SendGrid dynamic templates
|
|
46
|
+
*/
|
|
47
|
+
templateData?: Record<string, unknown>;
|
|
48
|
+
/**
|
|
49
|
+
* SendGrid template ID for template-based emails
|
|
50
|
+
*/
|
|
51
|
+
templateId?: string;
|
|
52
|
+
/**
|
|
53
|
+
* Tracking settings
|
|
54
|
+
*/
|
|
55
|
+
trackingSettings?: {
|
|
56
|
+
clickTracking?: {
|
|
57
|
+
enable?: boolean;
|
|
58
|
+
enableText?: boolean;
|
|
59
|
+
};
|
|
60
|
+
ganalytics?: {
|
|
61
|
+
enable?: boolean;
|
|
62
|
+
utmCampaign?: string;
|
|
63
|
+
utmContent?: string;
|
|
64
|
+
utmMedium?: string;
|
|
65
|
+
utmSource?: string;
|
|
66
|
+
utmTerm?: string;
|
|
67
|
+
};
|
|
68
|
+
openTracking?: {
|
|
69
|
+
enable?: boolean;
|
|
70
|
+
substitutionTag?: string;
|
|
71
|
+
};
|
|
72
|
+
subscriptionTracking?: {
|
|
73
|
+
enable?: boolean;
|
|
74
|
+
html?: string;
|
|
75
|
+
substitutionTag?: string;
|
|
76
|
+
text?: string;
|
|
77
|
+
};
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* SendGrid Provider for sending emails through SendGrid API
|
|
82
|
+
*/
|
|
83
|
+
declare const sendGridProvider: ProviderFactory<SendGridConfig>;
|
|
84
|
+
export { type ProviderFactory, type SendGridConfig, type SendGridEmailOptions, sendGridProvider };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{default as e}from"../../packem_shared/sendGridProvider-
|
|
1
|
+
import{default as e}from"../../packem_shared/sendGridProvider-D8ZLgY62.js";export{e as sendGridProvider};
|
|
@@ -1,3 +1,71 @@
|
|
|
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
|
+
* SMTP configuration
|
|
7
|
+
*/
|
|
8
|
+
interface SmtpConfig extends BaseConfig {
|
|
9
|
+
authMethod?: "LOGIN" | "PLAIN" | "CRAM-MD5" | "OAUTH2";
|
|
10
|
+
dkim?: {
|
|
11
|
+
domainName: string;
|
|
12
|
+
keySelector: string;
|
|
13
|
+
privateKey: string;
|
|
14
|
+
};
|
|
15
|
+
host: string;
|
|
16
|
+
maxConnections?: number;
|
|
17
|
+
oauth2?: {
|
|
18
|
+
accessToken?: string;
|
|
19
|
+
clientId: string;
|
|
20
|
+
clientSecret: string;
|
|
21
|
+
expires?: number;
|
|
22
|
+
refreshToken: string;
|
|
23
|
+
user: string;
|
|
24
|
+
};
|
|
25
|
+
password?: string;
|
|
26
|
+
pool?: boolean;
|
|
27
|
+
port: number;
|
|
28
|
+
rejectUnauthorized?: boolean;
|
|
29
|
+
secure?: boolean;
|
|
30
|
+
user?: string;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* SMTP-specific email options
|
|
34
|
+
*/
|
|
35
|
+
interface SmtpEmailOptions extends EmailOptions {
|
|
36
|
+
/**
|
|
37
|
+
* Delivery Status Notification options
|
|
38
|
+
*/
|
|
39
|
+
dsn?: {
|
|
40
|
+
/** Request notification on delay */
|
|
41
|
+
delay?: boolean;
|
|
42
|
+
/** Request notification on failure */
|
|
43
|
+
failure?: boolean;
|
|
44
|
+
/** Request successful delivery notification */
|
|
45
|
+
success?: boolean;
|
|
46
|
+
};
|
|
47
|
+
/** Special Google Mail headers */
|
|
48
|
+
googleMailHeaders?: {
|
|
49
|
+
/** Category for email organization */
|
|
50
|
+
category?: "primary" | "social" | "promotions" | "updates" | "forums";
|
|
51
|
+
/** Feedback ID for engagement tracking */
|
|
52
|
+
feedbackId?: string;
|
|
53
|
+
/** Mark as promotional content */
|
|
54
|
+
promotionalContent?: boolean;
|
|
55
|
+
};
|
|
56
|
+
/** Reference to a previous message ID (for threading) */
|
|
57
|
+
inReplyTo?: string;
|
|
58
|
+
/** List-Unsubscribe header for easy unsubscribe functionality */
|
|
59
|
+
listUnsubscribe?: string | string[];
|
|
60
|
+
/** Message priority: 'high', 'normal', or 'low' */
|
|
61
|
+
priority?: "high" | "normal" | "low";
|
|
62
|
+
/** References to related message IDs */
|
|
63
|
+
references?: string | string[];
|
|
64
|
+
/** Whether to sign the email with DKIM */
|
|
65
|
+
useDkim?: boolean;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* SMTP provider for sending emails via SMTP protocol
|
|
69
|
+
*/
|
|
70
|
+
declare const smtpProvider: ProviderFactory<SmtpConfig>;
|
|
71
|
+
export { type ProviderFactory, type SmtpConfig, type SmtpEmailOptions, smtpProvider };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{default as o}from"../../packem_shared/smtpProvider-
|
|
1
|
+
import{default as o}from"../../packem_shared/smtpProvider-Bm0yP97W.js";export{o as smtpProvider};
|
|
@@ -0,0 +1,43 @@
|
|
|
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
|
+
* SparkPost configuration.
|
|
7
|
+
*/
|
|
8
|
+
interface SparkPostConfig extends BaseConfig {
|
|
9
|
+
/**
|
|
10
|
+
* SparkPost API key (sent as the `Authorization` header).
|
|
11
|
+
*/
|
|
12
|
+
apiKey: string;
|
|
13
|
+
/**
|
|
14
|
+
* API endpoint override. Use `https://api.eu.sparkpost.com/api/v1` for the EU region.
|
|
15
|
+
*/
|
|
16
|
+
endpoint?: string;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* SparkPost-specific email options.
|
|
20
|
+
*/
|
|
21
|
+
interface SparkPostEmailOptions extends EmailOptions {
|
|
22
|
+
/**
|
|
23
|
+
* Campaign id applied to the transmission.
|
|
24
|
+
*/
|
|
25
|
+
campaignId?: string;
|
|
26
|
+
/**
|
|
27
|
+
* Stored template id to send instead of inline content.
|
|
28
|
+
*/
|
|
29
|
+
templateId?: string;
|
|
30
|
+
/**
|
|
31
|
+
* Whether click tracking is enabled.
|
|
32
|
+
*/
|
|
33
|
+
trackClicks?: boolean;
|
|
34
|
+
/**
|
|
35
|
+
* Whether engagement tracking (opens/clicks) is enabled.
|
|
36
|
+
*/
|
|
37
|
+
trackOpens?: boolean;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* SparkPost provider — sends email through the SparkPost Transmissions API.
|
|
41
|
+
*/
|
|
42
|
+
declare const sparkpostProvider: ProviderFactory<SparkPostConfig>;
|
|
43
|
+
export { type ProviderFactory, type SparkPostConfig, type SparkPostEmailOptions, sparkpostProvider };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{default as a}from"../../packem_shared/sparkpostProvider-CTYfSRaV.js";export{a as sparkpostProvider};
|
|
@@ -1,3 +1,40 @@
|
|
|
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
|
+
* Sweego configuration
|
|
7
|
+
*/
|
|
8
|
+
interface SweegoConfig extends BaseConfig {
|
|
9
|
+
/**
|
|
10
|
+
* Sweego API key
|
|
11
|
+
*/
|
|
12
|
+
apiKey: string;
|
|
13
|
+
/**
|
|
14
|
+
* Sweego API endpoint
|
|
15
|
+
* Defaults to: https://api.sweego.com
|
|
16
|
+
*/
|
|
17
|
+
endpoint?: string;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Sweego-specific email options
|
|
21
|
+
*/
|
|
22
|
+
interface SweegoEmailOptions extends EmailOptions {
|
|
23
|
+
/**
|
|
24
|
+
* Tags for categorization
|
|
25
|
+
*/
|
|
26
|
+
tags?: string[];
|
|
27
|
+
/**
|
|
28
|
+
* Sweego template ID for template-based emails
|
|
29
|
+
*/
|
|
30
|
+
templateId?: string;
|
|
31
|
+
/**
|
|
32
|
+
* Template variables for Sweego templates
|
|
33
|
+
*/
|
|
34
|
+
templateVariables?: Record<string, unknown>;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Sweego Provider for sending emails through Sweego API
|
|
38
|
+
*/
|
|
39
|
+
declare const sweegoProvider: ProviderFactory<SweegoConfig>;
|
|
40
|
+
export { type ProviderFactory, type SweegoConfig, type SweegoEmailOptions, sweegoProvider };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{default as r}from"../../packem_shared/sweegoProvider-
|
|
1
|
+
import{default as r}from"../../packem_shared/sweegoProvider-DOoin_vi.js";export{r as sweegoProvider};
|
|
@@ -1,3 +1,37 @@
|
|
|
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
|
+
* Zeptomail configuration
|
|
7
|
+
*/
|
|
8
|
+
interface ZeptomailConfig extends BaseConfig {
|
|
9
|
+
endpoint?: string;
|
|
10
|
+
token: string;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Zeptomail-specific email options
|
|
14
|
+
*/
|
|
15
|
+
interface ZeptomailEmailOptions extends EmailOptions {
|
|
16
|
+
/**
|
|
17
|
+
* Client reference - identifier set by the user to track a particular transaction
|
|
18
|
+
*/
|
|
19
|
+
clientReference?: string;
|
|
20
|
+
/**
|
|
21
|
+
* MIME headers - additional headers sent in the email for reference
|
|
22
|
+
*/
|
|
23
|
+
mimeHeaders?: Record<string, string>;
|
|
24
|
+
/**
|
|
25
|
+
* Track email clicks - enables tracking for click events
|
|
26
|
+
*/
|
|
27
|
+
trackClicks?: boolean;
|
|
28
|
+
/**
|
|
29
|
+
* Track email opens - enables tracking for open events
|
|
30
|
+
*/
|
|
31
|
+
trackOpens?: boolean;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Zeptomail Provider for sending emails through Zeptomail API
|
|
35
|
+
*/
|
|
36
|
+
declare const zeptomailProvider: ProviderFactory<ZeptomailConfig>;
|
|
37
|
+
export { type ProviderFactory, type ZeptomailConfig, type ZeptomailEmailOptions, zeptomailProvider };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{default as r}from"../../packem_shared/zeptomailProvider-
|
|
1
|
+
import{default as r}from"../../packem_shared/zeptomailProvider-DKBPSHPj.js";export{r as zeptomailProvider};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { E as EmailOptions, a as EmailResult, R as Result } from "../packem_shared/types.d-ejzh-xBP.js";
|
|
2
|
+
import { E as EnqueueOptions } from "../packem_shared/types.d-lcJZmwRK.js";
|
|
3
|
+
import 'node:buffer';
|
|
4
|
+
/**
|
|
5
|
+
* The subset of a [BullMQ](https://docs.bullmq.io/) `Queue` this adapter uses.
|
|
6
|
+
*/
|
|
7
|
+
interface BullmqQueueLike {
|
|
8
|
+
add: (name: string, data: unknown, options?: {
|
|
9
|
+
delay?: number;
|
|
10
|
+
}) => Promise<{
|
|
11
|
+
id?: string;
|
|
12
|
+
}>;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* A BullMQ job, narrowed to its `data` payload.
|
|
16
|
+
*/
|
|
17
|
+
interface BullmqJobLike {
|
|
18
|
+
data: EmailOptions;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* A BullMQ `Worker` processor that sends a job's message and resolves with the send result.
|
|
22
|
+
*/
|
|
23
|
+
type BullmqProcessor = (job: BullmqJobLike) => Promise<EmailResult>;
|
|
24
|
+
/**
|
|
25
|
+
* Adds a message to a BullMQ queue.
|
|
26
|
+
*
|
|
27
|
+
* BullMQ is push-based — jobs are consumed by a BullMQ `Worker`, not the pull-based reserve/ack model
|
|
28
|
+
* of `EmailQueue`. Use this to enqueue and {@link createBullmqProcessor} to consume.
|
|
29
|
+
* @param queue A BullMQ `Queue` instance to add the job to (optional peer).
|
|
30
|
+
* @param message The email payload stored as the BullMQ job data.
|
|
31
|
+
* @param options Optional scheduling — `scheduledAt` maps to a BullMQ `delay`.
|
|
32
|
+
* @param jobName The name to enqueue the job under.
|
|
33
|
+
* @returns The id of the created BullMQ job.
|
|
34
|
+
*/
|
|
35
|
+
declare const enqueueToBullmq: (queue: BullmqQueueLike, message: EmailOptions, options?: EnqueueOptions, jobName?: string) => Promise<string>;
|
|
36
|
+
/**
|
|
37
|
+
* Builds a BullMQ `Worker` processor that sends each job's message via the given send function.
|
|
38
|
+
*
|
|
39
|
+
* Pass it to `new Worker(queueName, createBullmqProcessor(mail.send.bind(mail)), { concurrency })`.
|
|
40
|
+
* BullMQ then handles concurrency, retries (via the job's `attempts`/`backoff`) and dead-lettering. A
|
|
41
|
+
* failed send throws so BullMQ records the attempt.
|
|
42
|
+
* @param send The send function — typically `mail.send.bind(mail)`.
|
|
43
|
+
* @returns A BullMQ processor function.
|
|
44
|
+
*/
|
|
45
|
+
declare const createBullmqProcessor: (send: (message: EmailOptions) => Promise<Result<EmailResult>>) => BullmqProcessor;
|
|
46
|
+
export { BullmqJobLike, BullmqProcessor, BullmqQueueLike, createBullmqProcessor, enqueueToBullmq };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const s=async(a,t,e={},d="email")=>{let r;if(e.scheduledAt!==void 0){const o=e.scheduledAt instanceof Date?e.scheduledAt.getTime():e.scheduledAt;r=Math.max(0,o-Date.now())}return(await a.add(d,t,r===void 0?void 0:{delay:r})).id??""},c=a=>async t=>{const e=await a(t.data);if(!e.success||!e.data)throw e.error instanceof Error?e.error:new Error("Email send failed");return e.data};export{c as createBullmqProcessor,s as enqueueToBullmq};
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
import { E as EmailOptions, a as EmailResult, R as Result } 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
|
+
export { UnstorageQueue, type UnstorageQueueOptions, createUnstorageQueue } from "./unstorage-queue.js";
|
|
4
|
+
import 'node:buffer';
|
|
5
|
+
/**
|
|
6
|
+
* Options for {@link MemoryQueue}.
|
|
7
|
+
*/
|
|
8
|
+
interface MemoryQueueOptions {
|
|
9
|
+
/**
|
|
10
|
+
* Time source in milliseconds — injectable for tests. Defaults to `Date.now`.
|
|
11
|
+
*/
|
|
12
|
+
now?: () => number;
|
|
13
|
+
/**
|
|
14
|
+
* How long, in milliseconds, a reserved job stays hidden before it becomes deliverable again
|
|
15
|
+
* (in case the worker crashed mid-process).
|
|
16
|
+
* @default 30000
|
|
17
|
+
*/
|
|
18
|
+
visibilityTimeout?: number;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* An in-memory {@link EmailQueue} with `scheduledAt` support and a reservation visibility timeout.
|
|
22
|
+
*
|
|
23
|
+
* Suitable for tests, single-process apps, and as a reference for adapter authors. Jobs do not survive
|
|
24
|
+
* a process restart — use a durable adapter in production.
|
|
25
|
+
*/
|
|
26
|
+
declare class MemoryQueue implements EmailQueue {
|
|
27
|
+
private readonly jobs;
|
|
28
|
+
private readonly visibilityTimeout;
|
|
29
|
+
private readonly now;
|
|
30
|
+
private sequence;
|
|
31
|
+
/**
|
|
32
|
+
* @param options Queue options. See {@link MemoryQueueOptions}.
|
|
33
|
+
*/
|
|
34
|
+
constructor(options?: MemoryQueueOptions);
|
|
35
|
+
/**
|
|
36
|
+
* Adds a message to the queue.
|
|
37
|
+
* @param message The message to send later.
|
|
38
|
+
* @param options Optional scheduling. See {@link EnqueueOptions}.
|
|
39
|
+
* @returns The new job id.
|
|
40
|
+
*/
|
|
41
|
+
enqueue(message: EmailOptions, options?: EnqueueOptions): string;
|
|
42
|
+
/**
|
|
43
|
+
* Reserves the next ready job, hiding it for the visibility window.
|
|
44
|
+
* @returns The next deliverable job, or `undefined` when none is ready.
|
|
45
|
+
*/
|
|
46
|
+
reserve(): QueueJob | undefined;
|
|
47
|
+
/**
|
|
48
|
+
* Marks a reserved job as processed and removes it.
|
|
49
|
+
* @param id The job id.
|
|
50
|
+
*/
|
|
51
|
+
ack(id: string): void;
|
|
52
|
+
/**
|
|
53
|
+
* Returns a job to the queue after a delay, incrementing its attempt count.
|
|
54
|
+
* @param id The job id.
|
|
55
|
+
* @param delayMs Milliseconds to wait before the job becomes ready again.
|
|
56
|
+
*/
|
|
57
|
+
retry(id: string, delayMs?: number): void;
|
|
58
|
+
/**
|
|
59
|
+
* Reports how many jobs remain (ready plus reserved).
|
|
60
|
+
* @returns The count of ready and reserved jobs.
|
|
61
|
+
*/
|
|
62
|
+
size(): number;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Options for {@link createWorker}.
|
|
66
|
+
*/
|
|
67
|
+
interface WorkerOptions {
|
|
68
|
+
/**
|
|
69
|
+
* Retry backoff: returns the delay (ms) before re-attempting after `attempts` failures.
|
|
70
|
+
* @default attempts => 1000 * 2 ** (attempts - 1)
|
|
71
|
+
*/
|
|
72
|
+
backoff?: (attempts: number) => number;
|
|
73
|
+
/**
|
|
74
|
+
* How many jobs to process concurrently.
|
|
75
|
+
* @default 1
|
|
76
|
+
*/
|
|
77
|
+
concurrency?: number;
|
|
78
|
+
/**
|
|
79
|
+
* Maximum delivery attempts before a job is dead-lettered.
|
|
80
|
+
* @default 3
|
|
81
|
+
*/
|
|
82
|
+
maxAttempts?: number;
|
|
83
|
+
/**
|
|
84
|
+
* Called when a job exhausts its attempts and is dropped.
|
|
85
|
+
* @param job The dead-lettered job.
|
|
86
|
+
* @param result The final failed result.
|
|
87
|
+
*/
|
|
88
|
+
onDeadLetter?: (job: QueueJob, result: Result<EmailResult>) => void;
|
|
89
|
+
/**
|
|
90
|
+
* Called on every failed attempt (before any retry).
|
|
91
|
+
* @param job The job that failed.
|
|
92
|
+
* @param result The failed result (or thrown error wrapped).
|
|
93
|
+
*/
|
|
94
|
+
onError?: (job: QueueJob, result: Result<EmailResult>) => void;
|
|
95
|
+
/**
|
|
96
|
+
* Called when `queue.reserve()` itself rejects (e.g. a transient store error). The poll loop keeps
|
|
97
|
+
* running regardless; this hook just surfaces the failure.
|
|
98
|
+
* @param error The reserve error.
|
|
99
|
+
*/
|
|
100
|
+
onReserveError?: (error: Error) => void;
|
|
101
|
+
/**
|
|
102
|
+
* Idle poll interval, in milliseconds, when no job is ready.
|
|
103
|
+
* @default 1000
|
|
104
|
+
*/
|
|
105
|
+
pollInterval?: number;
|
|
106
|
+
/**
|
|
107
|
+
* The queue to consume.
|
|
108
|
+
*/
|
|
109
|
+
queue: EmailQueue;
|
|
110
|
+
/**
|
|
111
|
+
* The send function — typically `mail.send.bind(mail)`.
|
|
112
|
+
*/
|
|
113
|
+
send: (message: EmailOptions) => Promise<Result<EmailResult>>;
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* A running queue worker.
|
|
117
|
+
*/
|
|
118
|
+
interface Worker {
|
|
119
|
+
/**
|
|
120
|
+
* Processes ready jobs until the queue has none currently deliverable, then resolves.
|
|
121
|
+
*
|
|
122
|
+
* Does not wait for future-scheduled jobs. Useful in tests and one-shot drains.
|
|
123
|
+
*/
|
|
124
|
+
drain: () => Promise<void>;
|
|
125
|
+
/**
|
|
126
|
+
* Begins polling and processing jobs in the background.
|
|
127
|
+
*/
|
|
128
|
+
start: () => void;
|
|
129
|
+
/**
|
|
130
|
+
* Stops polling. In-flight jobs are allowed to finish.
|
|
131
|
+
*/
|
|
132
|
+
stop: () => void;
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* Creates a worker that durably processes queued messages with bounded concurrency, retry/backoff, and
|
|
136
|
+
* dead-lettering.
|
|
137
|
+
* @param options Worker configuration. See {@link WorkerOptions}.
|
|
138
|
+
* @returns The worker handle. See {@link Worker}.
|
|
139
|
+
* @example
|
|
140
|
+
* ```ts
|
|
141
|
+
* const queue = new MemoryQueue();
|
|
142
|
+
* const worker = createWorker({ queue, send: mail.send.bind(mail), concurrency: 5 });
|
|
143
|
+
* worker.start();
|
|
144
|
+
* ```
|
|
145
|
+
*/
|
|
146
|
+
declare const createWorker: (options: WorkerOptions) => Worker;
|
|
147
|
+
export { type EmailQueue, type EnqueueOptions, MemoryQueue, type MemoryQueueOptions, type QueueJob, type Worker, type WorkerOptions, createWorker };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{MemoryQueue as o}from"../packem_shared/MemoryQueue-Dl1Fa6OJ.js";import{UnstorageQueue as u,createUnstorageQueue as a}from"./unstorage-queue.js";import{createWorker as f}from"../packem_shared/createWorker-_-yMWcNQ.js";export{o as MemoryQueue,u as UnstorageQueue,a as createUnstorageQueue,f as createWorker};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { a as EmailQueue } from "../packem_shared/types.d-lcJZmwRK.js";
|
|
2
|
+
import "../packem_shared/types.d-ejzh-xBP.js";
|
|
3
|
+
import 'node:buffer';
|
|
4
|
+
interface PgBossJob {
|
|
5
|
+
data: unknown;
|
|
6
|
+
id: string;
|
|
7
|
+
/** pg-boss retry count (present when fetched with `includeMetadata`). */
|
|
8
|
+
retryCount?: number;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* The subset of a [pg-boss](https://github.com/timgit/pg-boss) instance this adapter uses (v10 API).
|
|
12
|
+
*/
|
|
13
|
+
interface PgBossLike {
|
|
14
|
+
complete: (name: string, id: string) => Promise<unknown>;
|
|
15
|
+
fail: (name: string, id: string) => Promise<unknown>;
|
|
16
|
+
fetch: (name: string, options?: {
|
|
17
|
+
batchSize?: number;
|
|
18
|
+
includeMetadata?: boolean;
|
|
19
|
+
}) => Promise<PgBossJob[] | PgBossJob | null>;
|
|
20
|
+
getQueueSize: (name: string) => Promise<number>;
|
|
21
|
+
send: (name: string, data: object, options?: {
|
|
22
|
+
startAfter?: Date | number | string;
|
|
23
|
+
}) => Promise<null | string>;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Options for {@link createPgBossQueue}.
|
|
27
|
+
*/
|
|
28
|
+
interface PgBossQueueOptions {
|
|
29
|
+
/**
|
|
30
|
+
* The pg-boss queue name.
|
|
31
|
+
*/
|
|
32
|
+
queueName: string;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Creates an {@link EmailQueue} backed by pg-boss.
|
|
36
|
+
* @param boss A started pg-boss instance (optional peer).
|
|
37
|
+
* @param options Queue options. See {@link PgBossQueueOptions}.
|
|
38
|
+
* @returns The pg-boss-backed queue.
|
|
39
|
+
*/
|
|
40
|
+
declare const createPgBossQueue: (boss: PgBossLike, options: PgBossQueueOptions) => EmailQueue;
|
|
41
|
+
export { type PgBossLike, type PgBossQueueOptions, createPgBossQueue };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
class u{boss;queueName;constructor(e,s){this.boss=e,this.queueName=s.queueName}async enqueue(e,s={}){const a=s.scheduledAt;return await this.boss.send(this.queueName,e,a===void 0?void 0:{startAfter:a})??""}async reserve(){const e=await this.boss.fetch(this.queueName,{batchSize:1,includeMetadata:!0});if(!e)return;const s=Array.isArray(e)?e[0]:e;if(s)return{attempts:s.retryCount??0,id:s.id,message:s.data,scheduledAt:0}}async ack(e){await this.boss.complete(this.queueName,e)}async retry(e){await this.boss.fail(this.queueName,e)}async size(){return this.boss.getQueueSize(this.queueName)}}const i=(t,e)=>new u(t,e);export{i as createPgBossQueue};
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { a as EmailQueue } from "../packem_shared/types.d-lcJZmwRK.js";
|
|
2
|
+
import "../packem_shared/types.d-ejzh-xBP.js";
|
|
3
|
+
import 'node:buffer';
|
|
4
|
+
/**
|
|
5
|
+
* The subset of the `@aws-sdk/client-sqs` `SQS` client this adapter uses. The `SQS` class (not the
|
|
6
|
+
* lower-level `SQSClient`) exposes these operation methods directly.
|
|
7
|
+
*/
|
|
8
|
+
interface SqsClientLike {
|
|
9
|
+
changeMessageVisibility: (input: {
|
|
10
|
+
QueueUrl: string;
|
|
11
|
+
ReceiptHandle: string;
|
|
12
|
+
VisibilityTimeout: number;
|
|
13
|
+
}) => Promise<unknown>;
|
|
14
|
+
deleteMessage: (input: {
|
|
15
|
+
QueueUrl: string;
|
|
16
|
+
ReceiptHandle: string;
|
|
17
|
+
}) => Promise<unknown>;
|
|
18
|
+
getQueueAttributes: (input: {
|
|
19
|
+
AttributeNames: string[];
|
|
20
|
+
QueueUrl: string;
|
|
21
|
+
}) => Promise<{
|
|
22
|
+
Attributes?: Record<string, string>;
|
|
23
|
+
}>;
|
|
24
|
+
receiveMessage: (input: {
|
|
25
|
+
AttributeNames?: string[];
|
|
26
|
+
MaxNumberOfMessages?: number;
|
|
27
|
+
QueueUrl: string;
|
|
28
|
+
VisibilityTimeout?: number;
|
|
29
|
+
WaitTimeSeconds?: number;
|
|
30
|
+
}) => Promise<{
|
|
31
|
+
Messages?: {
|
|
32
|
+
Attributes?: Record<string, string>;
|
|
33
|
+
Body?: string;
|
|
34
|
+
MessageId?: string;
|
|
35
|
+
ReceiptHandle?: string;
|
|
36
|
+
}[];
|
|
37
|
+
}>;
|
|
38
|
+
sendMessage: (input: {
|
|
39
|
+
DelaySeconds?: number;
|
|
40
|
+
MessageBody: string;
|
|
41
|
+
QueueUrl: string;
|
|
42
|
+
}) => Promise<{
|
|
43
|
+
MessageId?: string;
|
|
44
|
+
}>;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Options for {@link createSqsQueue}.
|
|
48
|
+
*/
|
|
49
|
+
interface SqsQueueOptions {
|
|
50
|
+
/**
|
|
51
|
+
* The SQS queue URL.
|
|
52
|
+
*/
|
|
53
|
+
queueUrl: string;
|
|
54
|
+
/**
|
|
55
|
+
* Visibility timeout (seconds) applied when reserving a message.
|
|
56
|
+
* @default 30
|
|
57
|
+
*/
|
|
58
|
+
visibilityTimeout?: number;
|
|
59
|
+
/**
|
|
60
|
+
* Long-poll wait time (seconds) for `reserve`.
|
|
61
|
+
* @default 0
|
|
62
|
+
*/
|
|
63
|
+
waitTimeSeconds?: number;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Creates an {@link EmailQueue} backed by Amazon SQS.
|
|
67
|
+
* @param client An `@aws-sdk/client-sqs` `SQS` instance (optional peer).
|
|
68
|
+
* @param options Queue options. See {@link SqsQueueOptions}.
|
|
69
|
+
* @returns The SQS-backed queue.
|
|
70
|
+
*/
|
|
71
|
+
declare const createSqsQueue: (client: SqsClientLike, options: SqsQueueOptions) => EmailQueue;
|
|
72
|
+
export { type SqsClientLike, type SqsQueueOptions, createSqsQueue };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const a="ApproximateNumberOfMessages",u="ApproximateNumberOfMessagesNotVisible",r=(i,e)=>{if(i===void 0)return 0;const t=i instanceof Date?i.getTime():i,s=Math.ceil((t-e)/1e3);return Math.max(0,s)};class n{client;queueUrl;visibilityTimeout;waitTimeSeconds;constructor(e,t){this.client=e,this.queueUrl=t.queueUrl,this.visibilityTimeout=t.visibilityTimeout??30,this.waitTimeSeconds=t.waitTimeSeconds??0}async enqueue(e,t={}){const s=r(t.scheduledAt,Date.now());if(s>900)throw new RangeError(`SQS supports a maximum scheduling delay of ${String(900)}s (15 minutes); use a scheduler for longer delays`);return(await this.client.sendMessage({DelaySeconds:s,MessageBody:JSON.stringify(e),QueueUrl:this.queueUrl})).MessageId??""}async reserve(){const e=(await this.client.receiveMessage({AttributeNames:["ApproximateReceiveCount"],MaxNumberOfMessages:1,QueueUrl:this.queueUrl,VisibilityTimeout:this.visibilityTimeout,WaitTimeSeconds:this.waitTimeSeconds})).Messages?.[0];if(!e?.ReceiptHandle)return;const t=Number(e.Attributes?.ApproximateReceiveCount??"1");let s;try{s=JSON.parse(e.Body??"{}")}catch{await this.client.deleteMessage({QueueUrl:this.queueUrl,ReceiptHandle:e.ReceiptHandle});return}return{attempts:Math.max(0,t-1),id:e.ReceiptHandle,message:s,scheduledAt:0}}async ack(e){await this.client.deleteMessage({QueueUrl:this.queueUrl,ReceiptHandle:e})}async retry(e,t=0){await this.client.changeMessageVisibility({QueueUrl:this.queueUrl,ReceiptHandle:e,VisibilityTimeout:Math.min(900,Math.max(0,Math.ceil(t/1e3)))})}async size(){const e=await this.client.getQueueAttributes({AttributeNames:[a,u],QueueUrl:this.queueUrl});return Number(e.Attributes?.[a]??0)+Number(e.Attributes?.[u]??0)}}const l=(i,e)=>new n(i,e);export{l as createSqsQueue};
|