@visulima/email 4.0.0 → 4.2.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 +15 -0
- package/README.md +74 -1
- package/dist/crypto/index.d.ts +2 -2
- package/dist/deliverability/dmarc-report.js +1 -1
- package/dist/deliverability/index.d.ts +1 -1
- package/dist/inbound/index.d.ts +1 -1
- package/dist/index.d.ts +11 -5
- package/dist/index.js +1 -1
- package/dist/middleware/index.d.ts +3 -3
- package/dist/middleware/index.js +1 -1
- package/dist/packem_chunks/index.js +5 -5
- package/dist/packem_shared/{DraftMailMessage-B0gwf8n_.js → DraftMailMessage-zkKTOxQ8.js} +1 -1
- package/dist/packem_shared/EmailError-SXEFQEyA.js +1 -0
- package/dist/packem_shared/Mail-DtpXUSIl.js +1 -0
- package/dist/packem_shared/MailMessage-Aw0vVAh-.js +1 -0
- package/dist/packem_shared/{RequiredOptionError-ctDEEB1s.js → RequiredOptionError-C2wWqmiE.js} +1 -1
- package/dist/packem_shared/{ahaSendProvider-D95-pwFh.js → ahaSendProvider-Ci_a_O8d.js} +1 -1
- package/dist/packem_shared/{attachment-processor-BJFDS343.js → attachment-processor-AB1m-n9T.js} +1 -1
- package/dist/packem_shared/{autoSendProvider-yxUx3sEj.js → autoSendProvider-DG3pNJML.js} +1 -1
- package/dist/packem_shared/{awsSesProvider-DnZo9X_g.js → awsSesProvider-C4b5kuL4.js} +1 -1
- package/dist/packem_shared/{azureProvider-D6Z4c1yT.js → azureProvider-CEnz3uy_.js} +1 -1
- package/dist/packem_shared/{brevoProvider-D1yTSs0l.js → brevoProvider-BsbInXjw.js} +1 -1
- package/dist/packem_shared/{build-mime-message-BCFKPqaW.js → build-mime-message-D45WdgfP.js} +1 -1
- package/dist/packem_shared/{circuitBreakerMiddleware-DcBN7K6H.js → circuitBreakerMiddleware-Cm0m75qi.js} +1 -1
- package/dist/packem_shared/{cloudflareEmailProvider-DZbs35NL.js → cloudflareEmailProvider-CnpH5R5p.js} +1 -1
- package/dist/packem_shared/{createTestEmail-gr512snl.js → createTestEmail-B2Fz-Ifb.js} +1 -1
- package/dist/packem_shared/createWorker-ChrQvLUF.js +1 -0
- package/dist/packem_shared/extractLinks-BwE1SjNF.js +1 -0
- package/dist/packem_shared/{failoverProvider-IED1M0M5.js → failoverProvider-DsBqMOfK.js} +1 -1
- package/dist/packem_shared/fileProvider-BnDeaSqA.js +1 -0
- package/dist/packem_shared/{httpProvider-CpdWJoRq.js → httpProvider-BuA00407.js} +1 -1
- package/dist/packem_shared/{infobipProvider-DTqFu5pM.js → infobipProvider-DVUg9jKC.js} +1 -1
- package/dist/packem_shared/{isValidSigningCertUrl-CK1t2a7x.js → isValidSigningCertUrl-gnYr3oyD.js} +1 -1
- package/dist/packem_shared/{loopsProvider-PiE2HxoW.js → loopsProvider-BJUNQ2rR.js} +1 -1
- package/dist/packem_shared/{mail.d-BdyyyQO5.d.ts → mail.d-2u-30lWz.d.ts} +12 -4
- package/dist/packem_shared/{mailCrabProvider-BSapw_mS.js → mailCrabProvider-CFKRofS5.js} +1 -1
- package/dist/packem_shared/{mailPaceProvider-BugIutTw.js → mailPaceProvider-DBQd6NYt.js} +1 -1
- package/dist/packem_shared/{mailchannelsProvider-Dn24mI8D.js → mailchannelsProvider-CPVW3wlH.js} +1 -1
- package/dist/packem_shared/{mailerSendProvider-B6X4Lhsf.js → mailerSendProvider-B2H6BtoV.js} +1 -1
- package/dist/packem_shared/{mailgunProvider-4sMtcQcW.js → mailgunProvider-JRVH70PB.js} +1 -1
- package/dist/packem_shared/{mailjetProvider-DvrHwipw.js → mailjetProvider-BzBovF5M.js} +1 -1
- package/dist/packem_shared/{mailomatProvider-CrkNQGfL.js → mailomatProvider-x6IHKuWU.js} +1 -1
- package/dist/packem_shared/{mailtrapProvider-DTgvCUrs.js → mailtrapProvider-CJTJoDcV.js} +1 -1
- package/dist/packem_shared/make-request-mszP240P.js +1 -0
- package/dist/packem_shared/{mandrillProvider-BaK0GEj7.js → mandrillProvider-BcztgKkr.js} +1 -1
- package/dist/packem_shared/{mockProvider-CTxxbT0d.js → mockProvider-DVtl5Jjy.js} +1 -1
- package/dist/packem_shared/{netcoreProvider-BZJ0noQ2.js → netcoreProvider-YWEpa-wi.js} +1 -1
- package/dist/packem_shared/{nodemailerProvider-DqJh8ghN.js → nodemailerProvider-WNNtLE2s.js} +1 -1
- package/dist/packem_shared/{opentelemetryProvider-s0gvh05u.js → opentelemetryProvider-ddbILMeS.js} +1 -1
- package/dist/packem_shared/{outlook365Provider-DQUSFy2d.js → outlook365Provider-D5eETMZq.js} +1 -1
- package/dist/packem_shared/{plunkProvider-WMi1yPya.js → plunkProvider-TrBBoX7_.js} +1 -1
- package/dist/packem_shared/{postalProvider-DpBFGpoX.js → postalProvider-CU53hX0R.js} +1 -1
- package/dist/packem_shared/{postmarkProvider-ClUaHPvw.js → postmarkProvider-DEYQp8Gv.js} +1 -1
- package/dist/packem_shared/{provider-base-BEz00m9R.js → provider-base-G22b4a87.js} +1 -1
- package/dist/packem_shared/{provider.d-Cx5YQJdP.d.ts → provider.d-BLLbEuQ8.d.ts} +1 -1
- package/dist/packem_shared/resendProvider-BaIZCvph.js +1 -0
- package/dist/packem_shared/{retry-aghj7y8m.js → retry-ByPJFAtq.js} +1 -1
- package/dist/packem_shared/{roundRobinProvider-Dr1DdT2L.js → roundRobinProvider-CfuNY7We.js} +1 -1
- package/dist/packem_shared/{scalewayProvider-BhbDUEah.js → scalewayProvider-x6S2ZSPd.js} +1 -1
- package/dist/packem_shared/{sendGridProvider-DBZHhxd6.js → sendGridProvider-8Po3P-ia.js} +1 -1
- package/dist/packem_shared/{smtpProvider-CjcOEiAh.js → smtpProvider-BPamDNuv.js} +1 -1
- package/dist/packem_shared/{sparkpostProvider-B19lU9D5.js → sparkpostProvider-BVu1KeNz.js} +1 -1
- package/dist/packem_shared/{sweegoProvider-H8KWGDff.js → sweegoProvider-DHISjS9s.js} +1 -1
- package/dist/packem_shared/{types.d-Cb5fls_X.d.ts → types.d-A1Eea-p_.d.ts} +1 -1
- package/dist/packem_shared/{types.d-kHO4kX9q.d.ts → types.d-B5iH_mgb.d.ts} +1 -1
- package/dist/packem_shared/{types.d-GKqPNk0I.d.ts → types.d-Chhzb-48.d.ts} +1 -1
- package/dist/packem_shared/{types.d-B9295M4_.d.ts → types.d-CyiC9uRC.d.ts} +10 -0
- package/dist/packem_shared/{types.d-C5geVKes.d.ts → types.d-V_yuAOrx.d.ts} +1 -1
- package/dist/packem_shared/{verifySendGridWebhook-csuRasH3.js → verifySendGridWebhook-0_3qKQA1.js} +1 -1
- package/dist/packem_shared/{withSuppression-B0eZ2xNQ.js → withSuppression-COCHL9Zx.js} +1 -1
- package/dist/packem_shared/{zeptomailProvider-L7nkdn0L.js → zeptomailProvider-IhCIl_2a.js} +1 -1
- package/dist/providers/ahasend/index.d.ts +3 -3
- package/dist/providers/ahasend/index.js +1 -1
- package/dist/providers/autosend/index.d.ts +3 -3
- package/dist/providers/autosend/index.js +1 -1
- package/dist/providers/aws-ses/index.d.ts +3 -3
- package/dist/providers/aws-ses/index.js +1 -1
- package/dist/providers/azure/index.d.ts +3 -3
- package/dist/providers/azure/index.js +1 -1
- package/dist/providers/brevo/index.d.ts +3 -3
- package/dist/providers/brevo/index.js +1 -1
- package/dist/providers/cloudflare-email/index.d.ts +4 -4
- package/dist/providers/cloudflare-email/index.js +1 -1
- package/dist/providers/failover/index.d.ts +3 -3
- package/dist/providers/failover/index.js +1 -1
- package/dist/providers/file/index.d.ts +23 -0
- package/dist/providers/file/index.js +1 -0
- package/dist/providers/http/index.d.ts +3 -3
- package/dist/providers/http/index.js +1 -1
- package/dist/providers/infobip/index.d.ts +3 -3
- package/dist/providers/infobip/index.js +1 -1
- package/dist/providers/loops/index.d.ts +3 -3
- package/dist/providers/loops/index.js +1 -1
- package/dist/providers/mailchannels/index.d.ts +3 -3
- package/dist/providers/mailchannels/index.js +1 -1
- package/dist/providers/mailcrab/index.d.ts +3 -3
- package/dist/providers/mailcrab/index.js +1 -1
- package/dist/providers/mailersend/index.d.ts +3 -3
- package/dist/providers/mailersend/index.js +1 -1
- package/dist/providers/mailgun/index.d.ts +3 -3
- package/dist/providers/mailgun/index.js +1 -1
- package/dist/providers/mailjet/index.d.ts +3 -3
- package/dist/providers/mailjet/index.js +1 -1
- package/dist/providers/mailomat/index.d.ts +3 -3
- package/dist/providers/mailomat/index.js +1 -1
- package/dist/providers/mailpace/index.d.ts +3 -3
- package/dist/providers/mailpace/index.js +1 -1
- package/dist/providers/mailtrap/index.d.ts +3 -3
- package/dist/providers/mailtrap/index.js +1 -1
- package/dist/providers/mandrill/index.d.ts +3 -3
- package/dist/providers/mandrill/index.js +1 -1
- package/dist/providers/mock/index.d.ts +5 -5
- package/dist/providers/mock/index.js +1 -1
- package/dist/providers/netcore/index.d.ts +3 -3
- package/dist/providers/netcore/index.js +1 -1
- package/dist/providers/nodemailer/index.d.ts +3 -3
- package/dist/providers/nodemailer/index.js +1 -1
- package/dist/providers/opentelemetry/index.d.ts +2 -2
- package/dist/providers/opentelemetry/index.js +1 -1
- package/dist/providers/outlook365/index.d.ts +3 -3
- package/dist/providers/outlook365/index.js +1 -1
- package/dist/providers/plunk/index.d.ts +3 -3
- package/dist/providers/plunk/index.js +1 -1
- package/dist/providers/postal/index.d.ts +3 -3
- package/dist/providers/postal/index.js +1 -1
- package/dist/providers/postmark/index.d.ts +3 -3
- package/dist/providers/postmark/index.js +1 -1
- package/dist/providers/resend/index.d.ts +3 -3
- package/dist/providers/resend/index.js +1 -1
- package/dist/providers/roundrobin/index.d.ts +3 -3
- package/dist/providers/roundrobin/index.js +1 -1
- package/dist/providers/scaleway/index.d.ts +3 -3
- package/dist/providers/scaleway/index.js +1 -1
- package/dist/providers/sendgrid/index.d.ts +3 -3
- package/dist/providers/sendgrid/index.js +1 -1
- package/dist/providers/smtp/index.d.ts +4 -4
- package/dist/providers/smtp/index.js +1 -1
- package/dist/providers/sparkpost/index.d.ts +3 -3
- package/dist/providers/sparkpost/index.js +1 -1
- package/dist/providers/sweego/index.d.ts +3 -3
- package/dist/providers/sweego/index.js +1 -1
- package/dist/providers/zeptomail/index.d.ts +3 -3
- package/dist/providers/zeptomail/index.js +1 -1
- package/dist/queue/bullmq-queue.d.ts +2 -2
- package/dist/queue/index.d.ts +4 -3
- package/dist/queue/index.js +1 -1
- package/dist/queue/pg-boss-queue.d.ts +2 -2
- package/dist/queue/sqs-queue.d.ts +2 -2
- package/dist/queue/unstorage-queue.d.ts +2 -2
- package/dist/render/css-inline.js +1 -1
- package/dist/template-engines/handlebars.js +1 -1
- package/dist/template-engines/html-to-text.js +1 -1
- package/dist/template-engines/i18n.js +1 -1
- package/dist/template-engines/jsx-email.js +1 -1
- package/dist/template-engines/liquid.js +1 -1
- package/dist/template-engines/locale-files.d.ts +66 -0
- package/dist/template-engines/locale-files.js +1 -0
- package/dist/template-engines/mjml.js +1 -1
- package/dist/template-engines/react-email.js +1 -1
- package/dist/template-engines/vue-email.js +1 -1
- package/dist/test/index.d.ts +24 -7
- package/dist/test/index.js +1 -1
- package/dist/utils/format-email-address.d.ts +1 -1
- package/dist/utils/format-email-address.js +1 -1
- package/dist/utils/parse-address.d.ts +1 -1
- package/dist/utils/parse-eml.d.ts +1 -1
- package/dist/utils/result.d.ts +1 -1
- package/dist/utils/result.js +1 -1
- package/dist/utils/validation/check-feature-support.d.ts +1 -1
- package/dist/utils/validation/check-feature-support.js +1 -1
- package/dist/webhooks/index.js +1 -1
- package/package.json +9 -1
- package/dist/packem_shared/EmailError-BIaHK1Uw.js +0 -1
- package/dist/packem_shared/Mail-DmYNQ0KK.js +0 -1
- package/dist/packem_shared/MailMessage-DmmaNHHc.js +0 -1
- package/dist/packem_shared/createWorker-ChuTgETP.js +0 -1
- package/dist/packem_shared/make-request-Cyz5_yu8.js +0 -1
- package/dist/packem_shared/resendProvider-DtaB7sk0.js +0 -1
package/dist/packem_shared/{nodemailerProvider-DqJh8ghN.js → nodemailerProvider-WNNtLE2s.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import p from"nodemailer";import l from"./EmailError-
|
|
1
|
+
import p from"nodemailer";import l from"./EmailError-SXEFQEyA.js";import w from"./RequiredOptionError-C2wWqmiE.js";import{g as v}from"./generate-message-id-C5AM6DFE.js";import{h as g}from"./headers-to-record-ZOZ7Dubo.js";import{v as h}from"./validate-email-options-DxdAVLlu.js";import{defineProvider as T}from"./defineProvider-C9q-7iwt.js";const s="nodemailer",x=T((c={})=>{if(!c.transport)throw new w(s,"transport");let o;const f=r=>{const a=r??c.transport;return p.createTransport(a)};let d=!1;const y=async()=>{if(!d)try{o=f(),await o.verify(),d=!0}catch(r){throw new l(s,`Failed to initialize nodemailer transport: ${r instanceof Error?r.message:String(r)}`,{cause:r instanceof Error?r:new Error(String(r))})}},m=r=>{const a=e=>e.name?`${e.name} <${e.email}>`:e.email,t=e=>e.name?`${e.name} <${e.email}>`:e.email,u=c.defaultFrom??r.from,n={from:a(u),subject:r.subject,to:Array.isArray(r.to)?r.to.map(e=>t(e)):t(r.to)};return r.text&&(n.text=r.text),r.html&&(n.html=r.html),r.cc&&(n.cc=Array.isArray(r.cc)?r.cc.map(e=>t(e)):t(r.cc)),r.bcc&&(n.bcc=Array.isArray(r.bcc)?r.bcc.map(e=>t(e)):t(r.bcc)),r.replyTo&&(n.replyTo=r.replyTo.name?`${r.replyTo.name} <${r.replyTo.email}>`:r.replyTo.email),r.headers&&(n.headers=g(r.headers)),r.attachments&&r.attachments.length>0&&(n.attachments=r.attachments.map(e=>{const i={filename:e.filename};return e.raw!==void 0?i.content=e.raw:e.content!==void 0?i.content=e.content:e.path&&(i.path=e.path),e.contentType&&(i.contentType=e.contentType),e.contentDisposition&&(i.contentDisposition=e.contentDisposition),e.cid&&(i.cid=e.cid),e.encoding&&(i.encoding=e.encoding),e.headers&&(i.headers=e.headers),e.href&&(i.href=e.href),e.httpHeaders&&(i.httpHeaders=e.httpHeaders),i})),n};return{features:{attachments:!0,customHeaders:!0,html:!0,replyTo:!0},initialize:y,isAvailable:async()=>{try{return o??=f(),await o.verify(),!0}catch{return!1}},name:s,options:c,sendEmail:async r=>{const a=h(r);if(a.length>0)return{error:new l(s,`Validation failed: ${a.join(", ")}`),success:!1};try{if(d||await y(),!o)throw new l(s,"Transporter not initialized. Call initialize() first.");const t=r.transportOverride?f(r.transportOverride):o,u=m(r),n=await t.sendMail(u);return{data:{messageId:n.messageId??v(),provider:s,response:n,sent:!0,timestamp:new Date},success:!0}}catch(t){return{error:new l(s,`Failed to send email: ${t instanceof Error?t.message:String(t)}`,{cause:t instanceof Error?t:new Error(String(t))}),success:!1}}},shutdown:async()=>{o&&typeof o.close=="function"&&o.close(),o=void 0,d=!1},validateCredentials:async()=>{try{return o??=f(),await o.verify(),!0}catch{return!1}}}});export{x as default};
|
package/dist/packem_shared/{opentelemetryProvider-s0gvh05u.js → opentelemetryProvider-ddbILMeS.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{context as h,trace as w,SpanStatusCode as g}from"@opentelemetry/api";import u from"./EmailError-
|
|
1
|
+
import{context as h,trace as w,SpanStatusCode as g}from"@opentelemetry/api";import u from"./EmailError-SXEFQEyA.js";import p from"./RequiredOptionError-C2wWqmiE.js";import{c as b}from"./create-logger-CazqtXcL.js";import{defineProvider as E}from"./defineProvider-C9q-7iwt.js";const A=e=>typeof e=="function",S=e=>e!==null&&typeof e=="object"&&"sendEmail"in e&&"initialize"in e&&"isAvailable"in e,s="opentelemetry",z="email",P="email.send",d=e=>e?typeof e=="string"?e:Array.isArray(e)?e.map(i=>typeof i=="string"?i:i.email).join(", "):e.email:"",x=(e,i)=>{const a={"email.from":d(e.from),"email.subject":e.subject};return e.to&&(a["email.to"]=d(e.to)),e.cc&&(a["email.cc"]=d(e.cc)),e.bcc&&(a["email.bcc"]=d(e.bcc)),e.replyTo&&(a["email.reply_to"]=d(e.replyTo)),e.priority&&(a["email.priority"]=e.priority),e.tags&&e.tags.length>0&&(a["email.tags"]=e.tags.join(", ")),e.attachments&&e.attachments.length>0&&(a["email.attachments.count"]=e.attachments.length),i?(e.text&&(a["email.text.length"]=e.text.length),e.html&&(a["email.html.length"]=e.html.length)):(e.text&&(a["email.has_text"]=!0),e.html&&(a["email.has_html"]=!0)),a},$=E(e=>{if(!e?.provider)throw new p(s,"provider");const i={debug:e.debug??!1,logger:e.logger,provider:e.provider,recordContent:e.recordContent??!1,retries:e.retries??3,serviceName:e.serviceName??z,timeout:e.timeout??3e4,tracer:e.tracer};let a=!1,t;const l=b(s,e.logger),v=()=>i.tracer?i.tracer:w.getTracer(i.serviceName),m=async()=>{try{if(A(i.provider))t=i.provider({});else if(S(i.provider))t=i.provider;else throw new u(s,"Invalid provider: must be a Provider instance or ProviderFactory function");await t.initialize(),l.debug(`Initialized wrapped provider: ${t.name??"unknown"}`)}catch(o){throw new u(s,`Failed to initialize wrapped provider: ${o.message}`,{cause:o})}},y=()=>t?.features?t.features:{attachments:!0,batchSending:!1,customHeaders:!0,html:!0,replyTo:!0,scheduling:!1,tagging:!1,templates:!1,tracking:!1};return{get features(){return y()},getInstance(){if(!t)throw new u(s,"Provider not initialized. Call initialize() first.");return t},async initialize(){if(!a)try{await m(),a=!0,l.debug("OpenTelemetry provider initialized")}catch(o){throw new u(s,`Failed to initialize: ${o.message}`,{cause:o})}},async isAvailable(){try{return t||await m(),await t.isAvailable()}catch{return!1}},name:s,options:i,async sendEmail(o){const n=v().startSpan(P);try{t||await m();const c=x(o,i.recordContent);n.setAttributes(c),t.name&&n.setAttribute("email.provider",t.name);const r=await h.with(w.setSpan(h.active(),n),async()=>await t.sendEmail(o));if(r.success&&r.data)return n.setStatus({code:g.OK}),n.setAttribute("email.message_id",r.data.messageId),n.setAttribute("email.sent",!0),r.data.timestamp&&n.setAttribute("email.timestamp",r.data.timestamp.toISOString()),l.debug(`Email sent successfully via ${t.name??"unknown"}`),{data:{...r.data,provider:`${s}(${t.name??"unknown"})`},success:!0};const f=r.error instanceof Error?r.error.message:String(r.error??"Unknown error");return n.setStatus({code:g.ERROR,message:f}),n.setAttribute("email.sent",!1),n.recordException(r.error instanceof Error?r.error:new Error(f)),l.debug(`Failed to send email via ${t.name??"unknown"}:`,f),r}catch(c){const r=c instanceof Error?c.message:String(c);return n.setStatus({code:g.ERROR,message:r}),n.setAttribute("email.sent",!1),n.recordException(c instanceof Error?c:new Error(r)),l.debug("Exception sending email:",r),{error:new u(s,`Failed to send email: ${r}`,{cause:c}),success:!1}}finally{n.end()}},async shutdown(){t?.shutdown&&await t.shutdown(),a=!1},async validateCredentials(){try{return t||await m(),t.validateCredentials?await t.validateCredentials():await t.isAvailable()}catch{return!1}}}});export{$ as default};
|
package/dist/packem_shared/{outlook365Provider-DQUSFy2d.js → outlook365Provider-D5eETMZq.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import u from"./EmailError-
|
|
1
|
+
import u from"./EmailError-SXEFQEyA.js";import{g as R}from"./generate-message-id-C5AM6DFE.js";import{m as E}from"./make-request-mszP240P.js";import{r as g}from"./retry-ByPJFAtq.js";import{v}from"./validate-email-options-DxdAVLlu.js";import{defineProvider as P}from"./defineProvider-C9q-7iwt.js";import m from"./RequiredOptionError-C2wWqmiE.js";import{c as b}from"./create-token-cache-BdMsMzf7.js";import{c as $,h as D,P as M}from"./provider-base-G22b4a87.js";import{c as L}from"./attachment-processor-AB1m-n9T.js";const _="https://login.microsoftonline.com",C=6e4,x=3e4,U=3,F=300,j="https://graph.microsoft.com/.default",q=["https://graph.microsoft.com/Mail.Send","offline_access"],B={accessToken:["clientId","clientSecret","refreshToken","tenantId"],clientCredentials:["refreshToken"],getAccessToken:["accessToken","clientId","clientSecret","refreshToken","tenantId"],refreshToken:[]},z=e=>{let t=e.length;for(;t>0&&e[t-1]==="/";)t-=1;return e.slice(0,t)},G=(e,t)=>{if(e.getAccessToken)return"getAccessToken";if(e.accessToken)return"accessToken";if(e.refreshToken)return"refreshToken";if(e.clientSecret)return"clientCredentials";throw new m(t,["accessToken","getAccessToken","clientSecret","refreshToken"])},H=(e,t,c)=>{const r=e.authMode??G(e,t),T=B[r].filter(a=>e[a]!==void 0);if(T.length>0&&c.warn(`The '${r}' auth mode ignores these configured options: ${T.join(", ")}. Set 'authMode' to pin the intended flow.`),r==="getAccessToken"){const{getAccessToken:a}=e;if(!a)throw new m(t,"getAccessToken");return{getToken:async()=>a(),mode:r}}if(r==="accessToken"){const{accessToken:a}=e;if(!a)throw new m(t,"accessToken");return{getToken:()=>Promise.resolve(a),mode:r}}const{clientId:h,clientSecret:n,refreshToken:d,tenantId:l}=e,o=[];if(l||o.push("tenantId"),h||o.push("clientId"),r==="clientCredentials"&&!n&&o.push("clientSecret"),r==="refreshToken"&&!d&&o.push("refreshToken"),!l||!h)throw new m(t,o);if(r==="clientCredentials"){if(!n)throw new m(t,o);return{clientId:h,clientSecret:n,mode:r,tenantId:l}}if(!d)throw new m(t,o);return{clientId:h,clientSecret:n,mode:r,refreshToken:d,tenantId:l}},Y=(e,t,c)=>{if(typeof e!="object"||e===null)throw new u(t,`Token endpoint returned a non-JSON response (status ${String(c)})`);const r=e;if(typeof r.error=="string"){const T=typeof r.error_description=="string"?r.error_description:"no description provided";throw new u(t,`Token request failed: ${r.error} — ${T}`,{code:r.error,hint:"Check the tenantId, clientId and client secret / refresh token in the Azure app registration."})}if(typeof r.access_token!="string")throw new u(t,`Token endpoint response did not contain an access_token (status ${String(c)})`);return{accessToken:r.access_token,expiresIn:typeof r.expires_in=="number"?r.expires_in:F,refreshToken:typeof r.refresh_token=="string"?r.refresh_token:void 0}},J=e=>e===0||e===408||e===429||e>=500,K=(e,t,c,r)=>{if(e.mode==="accessToken"||e.mode==="getAccessToken")return e.getToken;const h=`${z(t.authority??_)}/${e.tenantId}/oauth2/v2.0/token`,n=t.timeout??x,d=t.retries??U,l=t.now??Date.now;let o=e.mode==="refreshToken"?e.refreshToken:void 0;const a=()=>{const s=new URLSearchParams({client_id:e.clientId,scope:(t.scopes??(e.mode==="clientCredentials"?[j]:q)).join(" ")});return e.clientSecret&&s.set("client_secret",e.clientSecret),e.mode==="clientCredentials"?s.set("grant_type","client_credentials"):(s.set("grant_type","refresh_token"),s.set("refresh_token",o)),s.toString()},k=s=>s.data?.statusCode??0,p=async()=>{const s=await E(h,{headers:{"Content-Type":"application/x-www-form-urlencoded"},method:"POST",timeout:n},a());return!s.success&&J(k(s))?s:{data:s.data,success:!0}},w=async s=>{if(o=s,!!t.onRefreshToken)try{await t.onRefreshToken(s)}catch(f){r.error(`Failed to persist the rotated refresh token — the stored token is stale and sending will fail after a restart: ${f instanceof Error?f.message:String(f)}`)}},A=b(async()=>{const s=await g(p,d),f=s.data?.body;if(!s.success&&(typeof f!="object"||f===null))throw s.error instanceof Error?s.error:new u(c,"Token request failed");const y=Y(f,c,k(s));return y.refreshToken&&y.refreshToken!==o&&await w(y.refreshToken),{accessToken:y.accessToken,expiresAt:l()+y.expiresIn*1e3}},{now:l,skewMs:t.tokenRefreshSkewMs??C});return async()=>(await A()).accessToken},i="outlook365",N="https://graph.microsoft.com/v1.0",O=3e4,V=3,S=e=>[e].flat(),I=e=>e.map(t=>({emailAddress:{address:t.email,...t.name?{name:t.name}:{}}})),W=e=>{if(e instanceof u)return e;const t=e instanceof Error?e.message:String(e);return new u(i,`Failed to obtain access token: ${t}`,{cause:e})},ie=P((e={})=>{const t=$(i,e.logger),c=H(e,i,t);if(c.mode==="clientCredentials"&&(e.userId===void 0||e.userId==="me"))throw new u(i,"The app-only (client credentials) flow requires an explicit 'userId'",{hint:"Set 'userId' to the sender's mailbox id or UPN — app-only tokens have no 'me' mailbox."});const r={authMode:c.mode,authority:e.authority??_,clientId:e.clientId,debug:e.debug??!1,endpoint:e.endpoint??N,logger:e.logger,now:e.now,retries:e.retries??V,saveToSentItems:e.saveToSentItems??!0,scopes:e.scopes,tenantId:e.tenantId,timeout:e.timeout??O,tokenRefreshSkewMs:e.tokenRefreshSkewMs,userId:e.userId??"me"},T=new M,h=K(c,e,i,t);return{features:{attachments:!0,batchSending:!1,customHeaders:!0,html:!0,replyTo:!0,scheduling:!1,tagging:!1,templates:!1,tracking:!1},async initialize(){T.setInitialized()},async isAvailable(){return!0},name:i,options:r,async sendEmail(n){try{const d=v(n);if(d.length>0)return{error:new u(i,`Invalid email options: ${d.join(", ")}`),success:!1};let l;try{l=await h()}catch(p){return{error:W(p),success:!1}}const o={body:{content:n.html??n.text??"",contentType:n.html?"HTML":"Text"},subject:n.subject,toRecipients:I(S(n.to))};n.cc&&(o.ccRecipients=I(S(n.cc))),n.bcc&&(o.bccRecipients=I(S(n.bcc))),n.replyTo&&(o.replyTo=I(S(n.replyTo))),n.importance&&(o.importance=n.importance),n.attachments&&n.attachments.length>0&&(o.attachments=await Promise.all(n.attachments.map(async p=>{const w=await L(p,i);return{"@odata.type":"#microsoft.graph.fileAttachment",contentBytes:w.content,contentType:w.contentType,name:w.filename}})));const a=r.userId==="me"?"me":`users/${r.userId}`,k=await g(async()=>E(`${r.endpoint}/${a}/sendMail`,{headers:{Authorization:`Bearer ${l}`,"Content-Type":"application/json"},method:"POST",timeout:r.timeout},JSON.stringify({message:o,saveToSentItems:r.saveToSentItems})),r.retries);return k.success?{data:{messageId:R(),provider:i,response:k.data,sent:!0,timestamp:new Date},success:!0}:{error:k.error??new u(i,"Failed to send email"),success:!1}}catch(d){return{error:D(i,"send email",d,t),success:!1}}},async validateCredentials(){try{return await h(),!0}catch(n){return t.warn(`Credential validation failed: ${n instanceof Error?n.message:String(n)}`),!1}}}});export{ie as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import l from"./EmailError-
|
|
1
|
+
import l from"./EmailError-SXEFQEyA.js";import w from"./RequiredOptionError-C2wWqmiE.js";import{g as b}from"./generate-message-id-C5AM6DFE.js";import{h as A}from"./headers-to-record-ZOZ7Dubo.js";import{m as h}from"./make-request-mszP240P.js";import{r as g}from"./retry-ByPJFAtq.js";import{s as P,a as T}from"./sanitize-header-CW0f3IT7.js";import{v as k}from"./validate-email-options-DxdAVLlu.js";import{defineProvider as z}from"./defineProvider-C9q-7iwt.js";import{c as j,P as R,h as p}from"./provider-base-G22b4a87.js";import{p as _}from"./attachment-processor-AB1m-n9T.js";const t="plunk",D="https://api.useplunk.com/v1",K=3e4,x=3,G=z((n={})=>{if(!n.apiKey)throw new w(t,"apiKey");const a={apiKey:n.apiKey,debug:n.debug??!1,endpoint:n.endpoint??D,logger:n.logger,retries:n.retries??x,timeout:n.timeout??K},f=new R,s=j(t,n.logger);return{features:{attachments:!0,batchSending:!1,customHeaders:!0,html:!0,replyTo:!0,scheduling:!1,tagging:!1,templates:!0,tracking:!0},async getEmail(e){try{if(!e)return{error:new l(t,"Email ID is required to retrieve email details"),success:!1};await f.ensureInitialized(()=>this.initialize(),t);const c={Authorization:`Bearer ${a.apiKey}`,"Content-Type":"application/json"};s.debug("Retrieving email details",{id:e});const i=await g(async()=>h(`${a.endpoint}/emails/${e}`,{headers:c,method:"GET",timeout:a.timeout}),a.retries);return i.success?(s.debug("Email details retrieved successfully"),{data:i.data?.body,success:!0}):(s.debug("API request failed when retrieving email",i.error),{error:new l(t,`Failed to retrieve email: ${i.error instanceof Error?i.error.message:"Unknown error"}`,{cause:i.error}),success:!1})}catch(c){return{error:p(t,"retrieve email",c,s),success:!1}}},async initialize(){await f.ensureInitialized(async()=>{if(!await this.isAvailable())throw new l(t,"Plunk API not available or invalid API key");s.debug("Provider initialized successfully")},t)},async isAvailable(){try{return a.apiKey&&a.apiKey.length>0?(s.debug("API key exists, assuming Plunk is available"),!0):!1}catch(e){return s.debug("Error checking availability:",e),!1}},name:t,options:a,async sendEmail(e){try{const c=k(e);if(c.length>0)return{error:new l(t,`Invalid email options: ${c.join(", ")}`),success:!1};await f.ensureInitialized(()=>this.initialize(),t);const i=o=>Array.isArray(o)?o.map(d=>d.email):[o.email],r={to:e.subscriber??(Array.isArray(e.to)?e.to[0]?.email:e.to.email)};if(e.from&&(r.from=e.from.email,e.from.name&&(r.from_name=e.from.name)),e.subject&&(r.subject=e.subject),e.html?r.body=e.html:e.text&&(r.body=e.text),e.html&&e.text&&(r.text=e.text),e.cc&&(r.cc=i(e.cc)),e.bcc&&(r.bcc=i(e.bcc)),e.replyTo&&(r.reply_to=e.replyTo.email,e.replyTo.name&&(r.reply_to_name=e.replyTo.name)),e.templateId&&(r.template=e.templateId),e.data&&(r.data=e.data),e.subscriberId&&(r.subscriber_id=e.subscriberId),e.headers){const o=A(e.headers),d={};Object.entries(o).forEach(([E,I])=>{d[P(E)]=T(I)}),r.headers=d}e.attachments&&e.attachments.length>0&&(r.attachments=await Promise.all(e.attachments.map(async o=>({content:await _(o,t),filename:o.filename,type:o.contentType??"application/octet-stream"})))),s.debug("Sending email via Plunk API",{subject:r.subject,to:r.to});const v={Authorization:`Bearer ${a.apiKey}`,"Content-Type":"application/json"},u=await g(async()=>h(`${a.endpoint}/send`,{headers:v,method:"POST",timeout:a.timeout},JSON.stringify(r)),a.retries);if(!u.success)return s.debug("API request failed when sending email",u.error),{error:u.error??new l(t,"Failed to send email"),success:!1};const m=u.data,y=m?.body&&typeof m.body=="object"?m.body.id??m.body.messageId??b():b();return s.debug("Email sent successfully",{messageId:y}),{data:{messageId:y,provider:t,response:u.data,sent:!0,timestamp:new Date},success:!0}}catch(c){return{error:p(t,"send email",c,s),success:!1}}},async validateCredentials(){return this.isAvailable()}}});export{G as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import d from"./EmailError-
|
|
1
|
+
import d from"./EmailError-SXEFQEyA.js";import p from"./RequiredOptionError-C2wWqmiE.js";import{g as w}from"./generate-message-id-C5AM6DFE.js";import{h as P}from"./headers-to-record-ZOZ7Dubo.js";import{m as u}from"./make-request-mszP240P.js";import{r as y}from"./retry-ByPJFAtq.js";import{v as E}from"./validate-email-options-DxdAVLlu.js";import{defineProvider as I}from"./defineProvider-C9q-7iwt.js";import{c as A,P as T}from"./provider-base-G22b4a87.js";import{l as m,m as h}from"./address-formatter-w36S9ZYj.js";import{p as C}from"./attachment-processor-AB1m-n9T.js";const a="postal",S=3e4,j=3,L=I((s={})=>{if(!s.host)throw new p(a,"host");if(!s.apiKey)throw new p(a,"apiKey");const f=s.endpoint??`https://${s.host}/api/v1`,o={apiKey:s.apiKey,debug:s.debug??!1,endpoint:f,host:s.host,retries:s.retries??j,timeout:s.timeout??S,...s.logger&&{logger:s.logger}},l=new T,i=A(a,s.logger);return{features:{attachments:!0,batchSending:!1,customHeaders:!0,html:!0,replyTo:!0,scheduling:!1,tagging:!0,templates:!0,tracking:!0},async getEmail(e){try{if(!e)return{error:new d(a,"Email ID is required to retrieve email details"),success:!1};await l.ensureInitialized(()=>this.initialize(),a);const t={"Content-Type":"application/json","X-Server-API-Key":o.apiKey};i.debug("Retrieving email details",{id:e});const r=await y(async()=>u(`${o.endpoint}/messages/${e}`,{headers:t,method:"GET",timeout:o.timeout}),o.retries);return r.success?(i.debug("Email details retrieved successfully"),{data:r.data?.body,success:!0}):(i.debug("API request failed when retrieving email",r.error),{error:new d(a,`Failed to retrieve email: ${r.error instanceof Error?r.error.message:"Unknown error"}`,{cause:r.error}),success:!1})}catch(t){return i.debug("Exception retrieving email",t),{error:new d(a,`Failed to retrieve email: ${t.message}`,{cause:t}),success:!1}}},async initialize(){await l.ensureInitialized(async()=>{if(!await this.isAvailable())throw new d(a,"Postal API not available or invalid API key");i.debug("Provider initialized successfully")},a)},async isAvailable(){try{const e={"Content-Type":"application/json","X-Server-API-Key":o.apiKey};i.debug("Checking Postal API availability");const t=await u(`${o.endpoint}/server`,{headers:e,method:"GET",timeout:o.timeout});return i.debug("Postal API availability check response:",{error:t.error instanceof Error?t.error.message:void 0,statusCode:t.data?.statusCode,success:t.success}),!!(t.success&&t.data&&typeof t.data=="object"&&"statusCode"in t.data&&typeof t.data.statusCode=="number"&&t.data.statusCode>=200&&t.data.statusCode<300)}catch(e){return i.debug("Error checking availability:",e),!1}},name:a,options:o,async sendEmail(e){try{const t=E(e);if(t.length>0)return{error:new d(a,`Invalid email options: ${t.join(", ")}`),success:!1};await l.ensureInitialized(()=>this.initialize(),a);const r={from:h(e.from).address,subject:e.subject,to:m(e.to).map(n=>n.address)};if(e.html&&(r.html_body=e.html),e.text&&(r.plain_body=e.text),e.cc&&(r.cc=m(e.cc).map(n=>n.address)),e.bcc&&(r.bcc=m(e.bcc).map(n=>n.address)),e.replyTo&&(r.reply_to=h(e.replyTo).address),e.templateId&&(r.template_id=e.templateId,e.templateVariables&&(r.template_variables=e.templateVariables)),e.tags&&e.tags.length>0&&(r.tag=e.tags.join(",")),e.headers){const n=P(e.headers);r.headers=n}e.attachments&&e.attachments.length>0&&(r.attachments=await Promise.all(e.attachments.map(async n=>{const v=await C(n,a);return{content_type:n.contentType??"application/octet-stream",data:v,name:n.filename}}))),i.debug("Sending email via Postal API",{subject:r.subject,to:r.to});const b={"Content-Type":"application/json","X-Server-API-Key":o.apiKey},c=await y(async()=>u(`${o.endpoint}/send/message`,{headers:b,method:"POST",timeout:o.timeout},JSON.stringify(r)),o.retries);if(!c.success)return i.debug("API request failed when sending email",c.error),{error:c.error??new d(a,"Failed to send email"),success:!1};const g=c.data?.body?.message_id?.toString()??w();return i.debug("Email sent successfully",{messageId:g}),{data:{messageId:g,provider:a,response:c.data,sent:!0,timestamp:new Date},success:!0}}catch(t){return i.debug("Exception sending email",t),{error:new d(a,`Failed to send email: ${t.message}`,{cause:t}),success:!1}}},async validateCredentials(){return this.isAvailable()}}});export{L as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import c from"./EmailError-
|
|
1
|
+
import c from"./EmailError-SXEFQEyA.js";import p from"./RequiredOptionError-C2wWqmiE.js";import{g as E}from"./generate-message-id-C5AM6DFE.js";import{h as P}from"./headers-to-record-ZOZ7Dubo.js";import{m}from"./make-request-mszP240P.js";import{r as h}from"./retry-ByPJFAtq.js";import{a as I,s as w}from"./sanitize-header-CW0f3IT7.js";import{v as A}from"./validate-email-options-DxdAVLlu.js";import{defineProvider as S}from"./defineProvider-C9q-7iwt.js";import{c as C,P as j,h as v}from"./provider-base-G22b4a87.js";import{e as f,g as T}from"./address-formatter-w36S9ZYj.js";import{b as M}from"./attachment-processor-AB1m-n9T.js";const a="postmark",R="https://api.postmarkapp.com",z=3e4,D=3,J=S((n={})=>{if(!n.serverToken)throw new p(a,"serverToken");const s={debug:n.debug??!1,endpoint:n.endpoint??R,retries:n.retries??D,serverToken:n.serverToken,timeout:n.timeout??z,...n.logger&&{logger:n.logger}},u=new j,o=C(a,n.logger);return{endpoint:s.endpoint,features:{attachments:!0,batchSending:!0,customHeaders:!0,html:!0,replyTo:!0,scheduling:!1,tagging:!0,templates:!0,tracking:!0},async getEmail(e){try{if(!e)return{error:new c(a,"Email ID is required to retrieve email details"),success:!1};await u.ensureInitialized(()=>this.initialize(),a);const t={"Content-Type":"application/json","X-Postmark-Server-Token":s.serverToken};o.debug("Retrieving email details",{id:e});const r=await h(async()=>m(`${s.endpoint}/messages/outbound/${e}/details`,{headers:t,method:"GET",timeout:s.timeout}),s.retries);return r.success?(o.debug("Email details retrieved successfully"),{data:r.data?.body,success:!0}):(o.debug("API request failed when retrieving email",r.error),{error:new c(a,`Failed to retrieve email: ${r.error instanceof Error?r.error.message:"Unknown error"}`,{cause:r.error}),success:!1})}catch(t){return{error:v(a,"retrieve email",t,o),success:!1}}},async initialize(){await u.ensureInitialized(async()=>{if(!await this.isAvailable())throw new c(a,"Postmark API not available or invalid server token");o.debug("Provider initialized successfully")},a)},async isAvailable(){try{const e={"Content-Type":"application/json","X-Postmark-Server-Token":s.serverToken};o.debug("Checking Postmark API availability");const t=await m(`${s.endpoint}/server`,{headers:e,method:"GET",timeout:s.timeout});return o.debug("Postmark API availability check response:",{error:t.error instanceof Error?t.error.message:void 0,statusCode:t.data?.statusCode,success:t.success}),!!(t.success&&t.data&&typeof t.data=="object"&&"statusCode"in t.data&&typeof t.data.statusCode=="number"&&t.data.statusCode>=200&&t.data.statusCode<300)}catch(e){return o.debug("Error checking availability:",e),!1}},name:a,options:s,async sendEmail(e){try{const t=A(e);if(t.length>0)return{error:new c(a,`Invalid email options: ${t.join(", ")}`),success:!1};await u.ensureInitialized(()=>this.initialize(),a);const r={From:T(e.from),Subject:e.subject,To:f(e.to).join(",")};if(e.html&&(r.HtmlBody=e.html),e.text&&(r.TextBody=e.text),e.cc&&(r.Cc=f(e.cc).join(",")),e.bcc&&(r.Bcc=f(e.bcc).join(",")),e.replyTo&&(r.ReplyTo=T(e.replyTo)),e.templateId?(r.TemplateId=e.templateId,e.templateModel&&(r.TemplateModel=e.templateModel)):e.templateAlias&&(r.TemplateAlias=e.templateAlias,e.templateModel&&(r.TemplateModel=e.templateModel)),e.trackOpens!==void 0&&(r.TrackOpens=e.trackOpens),e.trackLinks!==void 0&&(r.TrackLinks=e.trackLinks),e.inlineCss!==void 0&&(r.InlineCss=e.inlineCss),e.messageStream&&(r.MessageStream=e.messageStream),e.metadata&&(r.Metadata=e.metadata),e.tags&&e.tags.length>0){const[d]=e.tags;r.Tag=d}if(e.headers){const d=P(e.headers),l=[];for(const[y,b]of Object.entries(d))l.push({Name:w(y),Value:I(String(b))});l.length>0&&(r.Headers=l)}e.attachments&&e.attachments.length>0&&(r.Attachments=await Promise.all(e.attachments.map(async d=>M(d,a)))),o.debug("Sending email via Postmark API",{subject:r.Subject,to:r.To});const k={"Content-Type":"application/json","X-Postmark-Server-Token":s.serverToken},i=await h(async()=>m(`${s.endpoint}/email`,{headers:k,method:"POST",timeout:s.timeout},JSON.stringify(r)),s.retries);if(!i.success)return o.debug("API request failed when sending email",i.error),{error:i.error??new c(a,"Failed to send email"),success:!1};const g=i.data?.body?.MessageID??E();return o.debug("Email sent successfully",{messageId:g}),{data:{messageId:g,provider:a,response:i.data,sent:!0,timestamp:new Date},success:!0}}catch(t){return{error:v(a,"send email",t,o),success:!1}}},async validateCredentials(){return this.isAvailable()}}});export{J as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import s from"./EmailError-
|
|
1
|
+
import s from"./EmailError-SXEFQEyA.js";import{c as n}from"./create-logger-CazqtXcL.js";class c{isInitialized=!1;get initialized(){return this.isInitialized}setInitialized(){this.isInitialized=!0}async ensureInitialized(i,e){if(!this.isInitialized)try{await i(),this.isInitialized=!0}catch(t){throw new s(e,`Failed to initialize: ${t.message}`,{cause:t})}}}const l=(a,i)=>n(a,i),z=(a,i,e,t)=>{const r=`Failed to ${i}: ${e.message}`;return t&&t.debug(`Exception ${i}`,e),new s(a,r,{cause:e})};export{c as P,l as c,z as h};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { E as EmailOptions, F as FeatureFlags, R as Result, M as MaybePromise, a as EmailResult } from "./types.d-
|
|
1
|
+
import { E as EmailOptions, F as FeatureFlags, R as Result, M as MaybePromise, a as EmailResult } from "./types.d-CyiC9uRC.js";
|
|
2
2
|
/**
|
|
3
3
|
* Standard provider interface for email services.
|
|
4
4
|
*/
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import d from"./EmailError-SXEFQEyA.js";import I from"./RequiredOptionError-C2wWqmiE.js";import{g as A}from"./generate-message-id-C5AM6DFE.js";import{h as w}from"./headers-to-record-ZOZ7Dubo.js";import{m as y}from"./make-request-mszP240P.js";import{r as g}from"./retry-ByPJFAtq.js";import{v as T}from"./validate-email-options-DxdAVLlu.js";import{defineProvider as P}from"./defineProvider-C9q-7iwt.js";import{c as C,P as K,h as b}from"./provider-base-G22b4a87.js";import{e as $,g as v,d as E}from"./address-formatter-w36S9ZYj.js";import{p as R}from"./attachment-processor-AB1m-n9T.js";const s="resend",j="https://api.resend.com",S=3e4,_=3,k=/^[\u0021-\u007E]{1,256}$/,D=o=>{const r=[],c=/^[\w-]+$/;return c.test(o.name)||r.push(`Tag name '${o.name}' must only contain ASCII letters, numbers, underscores, or dashes`),o.name.length>256&&r.push(`Tag name '${o.name}' exceeds maximum length of 256 characters`),c.test(o.value)||r.push(`Tag value '${o.value}' for tag '${o.name}' must only contain ASCII letters, numbers, underscores, or dashes`),r},Y=P((o={})=>{if(!o.apiKey)throw new I(s,"apiKey");const r={apiKey:o.apiKey,debug:o.debug??!1,endpoint:o.endpoint??j,logger:o.logger,retries:o.retries??_,timeout:o.timeout??S},c=new K,n=C(s,o.logger);return{endpoint:r.endpoint,features:{attachments:!0,batchSending:!0,customHeaders:!0,html:!0,idempotency:!0,replyTo:!0,scheduling:!0,tagging:!0,templates:!0,tracking:!0},async getEmail(e){try{if(!e)return{error:new d(s,"Email ID is required to retrieve email details"),success:!1};await c.ensureInitialized(()=>this.initialize(),s);const t={Authorization:`Bearer ${r.apiKey}`,"Content-Type":"application/json"};n.debug("Retrieving email details",{id:e});const a=await g(async()=>y(`${r.endpoint}/emails/${e}`,{headers:t,method:"GET",timeout:r.timeout}),r.retries);return a.success?(n.debug("Email details retrieved successfully"),{data:a.data?.body,success:!0}):(n.debug("API request failed when retrieving email",a.error),{error:new d(s,`Failed to retrieve email: ${a.error instanceof Error?a.error.message:"Unknown error"}`,{cause:a.error}),success:!1})}catch(t){return{error:b(s,"retrieve email",t,n),success:!1}}},async initialize(){await c.ensureInitialized(async()=>{if(!await this.isAvailable())throw new d(s,"Resend API not available or invalid API key");n.debug("Provider initialized successfully")},s)},async isAvailable(){try{if(r.apiKey&&r.apiKey.startsWith("re_"))return n.debug("API key format is valid, assuming Resend is available"),!0;const e={Authorization:`Bearer ${r.apiKey}`,"Content-Type":"application/json"};n.debug("Checking Resend API availability");const t=await y(`${r.endpoint}/domains`,{headers:e,method:"GET",timeout:r.timeout});return t.data&&typeof t.data=="object"&&"body"in t.data&&t.data.body&&typeof t.data.body=="object"&&"name"in t.data.body&&t.data.body.name==="restricted_api_key"?(n.debug("API key is valid but restricted to only sending emails"),!0):(n.debug("Resend API availability check response:",{error:t.error instanceof Error?t.error.message:void 0,statusCode:t.data?.statusCode,success:t.success}),!!(t.success&&t.data&&typeof t.data=="object"&&"statusCode"in t.data&&typeof t.data.statusCode=="number"&&t.data.statusCode>=200&&t.data.statusCode<300))}catch(e){return n.debug("Error checking availability:",e),!1}},name:s,options:r,async sendEmail(e){try{const t=T(e);if(t.length>0)return{error:new d(s,`Invalid email options: ${t.join(", ")}`),success:!1};if(e.idempotencyKey!==void 0&&(typeof e.idempotencyKey!="string"||!k.test(e.idempotencyKey)))return{error:new d(s,"Invalid idempotency key: must be 1-256 visible ASCII characters"),success:!1};await c.ensureInitialized(()=>this.initialize(),s);const a={from:v(e.from),headers:e.headers?w(e.headers):{},html:e.html,subject:e.subject,text:e.text,to:$(e.to)};if(e.cc&&(a.cc=E(e.cc)),e.bcc&&(a.bcc=E(e.bcc)),e.replyTo&&(a.reply_to=v(e.replyTo)),e.templateId&&(a.template=e.templateId,e.templateData&&(a.data=e.templateData)),e.scheduledAt&&(a.scheduled_at=typeof e.scheduledAt=="string"?e.scheduledAt:e.scheduledAt.toISOString()),e.tags&&e.tags.length>0){const i=[];if(e.tags.forEach(l=>{const p=D(l);p.length>0&&i.push(...p)}),i.length>0)return{error:new d(s,`Invalid email tags: ${i.join(", ")}`),success:!1};a.tags=e.tags.map(l=>({name:l.name,value:l.value}))}e.attachments&&e.attachments.length>0&&(a.attachments=await Promise.all(e.attachments.map(async i=>({content:await R(i,s),content_type:i.contentType,filename:i.filename,...i.path&&{path:i.path}})))),n.debug("Sending email via Resend API",{subject:a.subject,to:a.to});const f={Authorization:`Bearer ${r.apiKey}`,"Content-Type":"application/json"};e.idempotencyKey!==void 0&&(f["Idempotency-Key"]=e.idempotencyKey);const u=await g(async()=>y(`${r.endpoint}/emails`,{headers:f,method:"POST",timeout:r.timeout},JSON.stringify(a)),r.retries);if(!u.success)return n.debug("API request failed when sending email",u.error),{error:u.error??new d(s,"Failed to send email"),success:!1};const m=u.data,h=m?.body&&typeof m.body=="object"&&m.body.id?m.body.id:A();return n.debug("Email sent successfully",{messageId:h}),{data:{messageId:h,provider:s,response:u.data,sent:!0,timestamp:new Date},success:!0}}catch(t){return{error:b(s,"send email",t,n),success:!1}}},async validateCredentials(){return this.isAvailable()}}});export{Y as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import c from"./EmailError-
|
|
1
|
+
import c from"./EmailError-SXEFQEyA.js";import{R as i}from"./make-request-mszP240P.js";const E=new Set([408,429,503]),m=r=>{const{statusCode:t}=r.data??{};return t!==void 0?E.has(t):!(r.error instanceof c&&r.error.code===i)},a=async(r,t=3,e=300,s=m)=>{try{const o=await r();return o.success||t<=0||!s(o)?o:(await new Promise(n=>{setTimeout(()=>{n()},e)}),a(r,t-1,e*2,s))}catch(o){return t<=0?{error:o instanceof Error?o:new Error(String(o)),success:!1}:(await new Promise(n=>{setTimeout(()=>{n()},e)}),a(r,t-1,e*2,s))}};export{a as r};
|
package/dist/packem_shared/{roundRobinProvider-Dr1DdT2L.js → roundRobinProvider-CfuNY7We.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import m from"./EmailError-
|
|
1
|
+
import m from"./EmailError-SXEFQEyA.js";import y from"./RequiredOptionError-C2wWqmiE.js";import{c as $}from"./create-logger-CazqtXcL.js";import{defineProvider as E}from"./defineProvider-C9q-7iwt.js";import{a as A}from"./aggregate-features-Bst55u8k.js";const P=i=>typeof i=="function",x=i=>i!=null&&typeof i=="object"&&"sendEmail"in i&&"initialize"in i&&"isAvailable"in i,o="roundrobin",S=E((i={})=>{if(!i.mailers||i.mailers.length===0)throw new y(o,"mailers");const g={debug:i.debug??!1,logger:i.logger,mailers:i.mailers,retries:i.retries??3,retryAfter:i.retryAfter??60,timeout:i.timeout??3e4};let p=!1;const r=[];let a=0;const n=$(o,i.logger),v=async()=>{r.length=0;for(const t of g.mailers)try{let e;if(P(t))e=t({});else if(x(t))e=t;else{n.debug(`Skipping invalid mailer: ${t}`);continue}try{await e.initialize(),r.push(e),n.debug(`Initialized provider: ${e.name??"unknown"}`)}catch(s){n.debug(`Failed to initialize provider ${e.name??"unknown"}:`,s)}}catch(e){n.debug("Error processing mailer:",e)}if(r.length===0)throw new m(o,"No providers could be initialized");a=Math.floor(Math.random()*r.length),n.debug(`Round robin starting at index ${a} (${r[a]?.name??"unknown"})`)},h=async()=>{if(r.length===0)return;const t=a;let e=0;for(;e<r.length;){const s=r[a];if(!s){a=(a+1)%r.length,e+=1;continue}const c=s.name??`provider-${a+1}`;try{if(await s.isAvailable())return a=(a+1)%r.length,n.debug(`Selected provider: ${c} (index ${a===0?r.length-1:a-1})`),s}catch{}a=(a+1)%r.length,e+=1,e<r.length&&g.retryAfter>0&&await new Promise(l=>{setTimeout(()=>{l(void 0)},g.retryAfter)})}return n.debug(`No available providers found, using provider at index ${t}`),r[t]??void 0};return{features:A(g.mailers),async initialize(){if(!p)try{await v(),p=!0,n.debug(`Round robin provider initialized with ${r.length} provider(s)`)}catch(t){throw new m(o,`Failed to initialize: ${t.message}`,{cause:t})}},async isAvailable(){try{return r.length===0&&await v(),(await Promise.allSettled(r.map(e=>e.isAvailable()))).some(e=>e.status==="fulfilled"&&e.value)}catch{return!1}},name:o,options:g,async sendEmail(t){try{if(r.length===0&&await v(),r.length===0)return{error:new m(o,"No providers available"),success:!1};const e=await h();if(!e)return{error:new m(o,"No available providers found"),success:!1};const s=e.name??"unknown";n.debug(`Sending email via ${s}`);const c=await e.sendEmail(t);if(c.success)return n.debug(`Email sent successfully via ${s}`),{data:{...c.data,provider:`${o}(${s})`},success:!0};n.debug(`Failed to send via ${s}, trying next provider`);const l=[];c.error&&l.push(c.error);let b=0;for(;b<r.length-1;){const d=await h();if(!d||d===e)break;const f=d.name??"unknown";n.debug(`Retrying with ${f}`);try{const u=await d.sendEmail(t);if(u.success)return n.debug(`Email sent successfully via ${f} (after retry)`),{data:{...u.data,provider:`${o}(${f})`},success:!0};u.error&&l.push(u.error)}catch(u){l.push(u instanceof Error?u:new Error(String(u)))}b+=1}const w=l.map(d=>d instanceof Error?d.message:String(d)).join("; ");return{error:new m(o,`Failed to send email via all providers. Errors: ${w}`,{cause:l[0]instanceof Error?l[0]:new Error(String(l[0]))}),success:!1}}catch(e){return{error:new m(o,`Failed to send email: ${e.message}`,{cause:e}),success:!1}}},async validateCredentials(){return this.isAvailable()}}});export{S as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import l from"./EmailError-
|
|
1
|
+
import l from"./EmailError-SXEFQEyA.js";import f from"./RequiredOptionError-C2wWqmiE.js";import{g as w}from"./generate-message-id-C5AM6DFE.js";import{h as v}from"./headers-to-record-ZOZ7Dubo.js";import{m as y}from"./make-request-mszP240P.js";import{r as g}from"./retry-ByPJFAtq.js";import{v as E}from"./validate-email-options-DxdAVLlu.js";import{defineProvider as I}from"./defineProvider-C9q-7iwt.js";import{c as T,P as A,h}from"./provider-base-G22b4a87.js";import{f as u,a as P}from"./address-formatter-w36S9ZYj.js";import{p as S}from"./attachment-processor-AB1m-n9T.js";const t="scaleway",j="https://api.scaleway.com/transactional-email/v1alpha1",R=3e4,k=3,G=I((a={})=>{if(!a.apiKey)throw new f(t,"apiKey");if(!a.region)throw new f(t,"region");const p=a.endpoint??j,s={apiKey:a.apiKey,debug:a.debug??!1,endpoint:p,region:a.region,retries:a.retries??k,timeout:a.timeout??R,...a.logger&&{logger:a.logger}},d=new A,i=T(t,a.logger);return{features:{attachments:!0,batchSending:!1,customHeaders:!0,html:!0,replyTo:!0,scheduling:!1,tagging:!1,templates:!0,tracking:!1},async getEmail(e){try{if(!e)return{error:new l(t,"Email ID is required to retrieve email details"),success:!1};await d.ensureInitialized(()=>this.initialize(),t);const o={"Content-Type":"application/json","X-Auth-Token":s.apiKey};i.debug("Retrieving email details",{id:e});const r=await g(async()=>y(`${s.endpoint}/regions/${s.region}/emails/${e}`,{headers:o,method:"GET",timeout:s.timeout}),s.retries);return r.success?(i.debug("Email details retrieved successfully"),{data:r.data?.body,success:!0}):(i.debug("API request failed when retrieving email",r.error),{error:new l(t,`Failed to retrieve email: ${r.error instanceof Error?r.error.message:"Unknown error"}`,{cause:r.error}),success:!1})}catch(o){return{error:h(t,"retrieve email",o,i),success:!1}}},async initialize(){await d.ensureInitialized(async()=>{if(!await this.isAvailable())throw new l(t,"Scaleway API not available or invalid API key");i.debug("Provider initialized successfully")},t)},async isAvailable(){try{return i.debug("Checking Scaleway API availability"),!0}catch(e){return i.debug("Error checking availability:",e),!1}},name:t,options:s,async sendEmail(e){try{const o=E(e);if(o.length>0)return{error:new l(t,`Invalid email options: ${o.join(", ")}`),success:!1};await d.ensureInitialized(()=>this.initialize(),t);const r={from:{email:e.from.email,...e.from.name&&{name:e.from.name}},subject:e.subject,to:u(e.to)};if(e.html&&(r.html=e.html),e.text&&(r.text=e.text),e.cc&&(r.cc=u(e.cc)),e.bcc&&(r.bcc=u(e.bcc)),e.replyTo&&(r.replyTo=P(e.replyTo)),e.templateId&&(r.templateId=e.templateId,e.templateVariables&&(r.templateVariables=e.templateVariables)),e.projectId&&(r.projectId=e.projectId),e.headers){const c=v(e.headers);r.headers=c}e.attachments&&e.attachments.length>0&&(r.attachments=await Promise.all(e.attachments.map(async c=>({content:await S(c,t),name:c.filename,type:c.contentType??"application/octet-stream"})))),i.debug("Sending email via Scaleway API",{subject:r.subject,to:r.to});const b={"Content-Type":"application/json","X-Auth-Token":s.apiKey},n=await g(async()=>y(`${s.endpoint}/regions/${s.region}/emails`,{headers:b,method:"POST",timeout:s.timeout},JSON.stringify(r)),s.retries);if(!n.success)return i.debug("API request failed when sending email",n.error),{error:n.error??new l(t,"Failed to send email"),success:!1};const m=n.data?.body?.id??w();return i.debug("Email sent successfully",{messageId:m}),{data:{messageId:m,provider:t,response:n.data,sent:!0,timestamp:new Date},success:!0}}catch(o){return{error:h(t,"send email",o,i),success:!1}}},async validateCredentials(){return this.isAvailable()}}});export{G as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import u from"./EmailError-
|
|
1
|
+
import u from"./EmailError-SXEFQEyA.js";import E from"./RequiredOptionError-C2wWqmiE.js";import{g as w}from"./generate-message-id-C5AM6DFE.js";import{h as P}from"./headers-to-record-ZOZ7Dubo.js";import{m as h}from"./make-request-mszP240P.js";import{r as p}from"./retry-ByPJFAtq.js";import{v as S}from"./validate-email-options-DxdAVLlu.js";import{defineProvider as T}from"./defineProvider-C9q-7iwt.js";import{c as G,P as _,h as v}from"./provider-base-G22b4a87.js";import{f as y,a as I}from"./address-formatter-w36S9ZYj.js";import{d as j}from"./attachment-processor-AB1m-n9T.js";const s="sendgrid",z="https://api.sendgrid.com/v3",k=3e4,C=3,H=T((o={})=>{if(!o.apiKey)throw new E(s,"apiKey");const r={apiKey:o.apiKey,debug:o.debug??!1,endpoint:o.endpoint??z,...o.logger&&{logger:o.logger},retries:o.retries??C,timeout:o.timeout??k},f=new _,i=G(s,o.logger);return{endpoint:r.endpoint,features:{attachments:!0,batchSending:!0,customHeaders:!0,html:!0,replyTo:!0,scheduling:!0,tagging:!0,templates:!0,tracking:!0},async getEmail(e){try{if(!e)return{error:new u(s,"Email ID is required to retrieve email details"),success:!1};await f.ensureInitialized(()=>this.initialize(),s);const t={Authorization:`Bearer ${r.apiKey}`,"Content-Type":"application/json"};i.debug("Retrieving email details",{id:e});const a=await p(async()=>h(`${r.endpoint}/messages/${e}`,{headers:t,method:"GET",timeout:r.timeout}),r.retries);return a.success?(i.debug("Email details retrieved successfully"),{data:a.data?.body,success:!0}):(i.debug("API request failed when retrieving email",a.error),{error:new u(s,`Failed to retrieve email: ${a.error instanceof Error?a.error.message:"Unknown error"}`,{cause:a.error}),success:!1})}catch(t){return{error:v(s,"retrieve email",t,i),success:!1}}},async initialize(){await f.ensureInitialized(async()=>{if(!await this.isAvailable())throw new u(s,"SendGrid API not available or invalid API key");i.debug("Provider initialized successfully")},s)},async isAvailable(){try{if(r.apiKey&&r.apiKey.startsWith("SG."))return i.debug("API key format is valid, assuming SendGrid is available"),!0;const e={Authorization:`Bearer ${r.apiKey}`,"Content-Type":"application/json"};i.debug("Checking SendGrid API availability");const t=await h(`${r.endpoint}/user/profile`,{headers:e,method:"GET",timeout:r.timeout});return i.debug("SendGrid API availability check response:",{error:t.error instanceof Error?t.error.message:void 0,statusCode:t.data?.statusCode,success:t.success}),!!(t.success&&t.data&&typeof t.data=="object"&&"statusCode"in t.data&&typeof t.data.statusCode=="number"&&t.data.statusCode>=200&&t.data.statusCode<300)}catch(e){return i.debug("Error checking availability:",e),!1}},name:s,options:r,async sendEmail(e){try{const t=S(e);if(t.length>0)return{error:new u(s,`Invalid email options: ${t.join(", ")}`),success:!1};await f.ensureInitialized(()=>this.initialize(),s);const a={to:y(e.to)};if(e.cc&&(a.cc=y(e.cc)),e.bcc&&(a.bcc=y(e.bcc)),e.subject&&(a.subject=e.subject),e.tags&&e.tags.length>0){const n={};for(let g=0;g<e.tags.length;g+=1)n[`tag_${g}`]=e.tags[g];a.customArgs=n}const d={from:I(e.from),personalizations:[a]},l=[];if(e.html&&l.push({type:"text/html",value:e.html}),e.text&&l.push({type:"text/plain",value:e.text}),l.length>0&&(d.content=l),e.replyTo&&(d.reply_to=I(e.replyTo)),e.subject&&(d.subject=e.subject),e.templateId&&(d.template_id=e.templateId,e.templateData&&(a.dynamicTemplateData=e.templateData)),e.sendAt&&(a.send_at=e.sendAt),e.batchId&&(d.batch_id=e.batchId),e.asmGroupId&&(d.asm={group_id:e.asmGroupId}),e.ipPoolName&&(d.ip_pool_name=e.ipPoolName),e.mailSettings&&(d.mail_settings=e.mailSettings),e.trackingSettings&&(d.tracking_settings=e.trackingSettings),e.headers){const n=P(e.headers);d.headers=n}e.attachments&&e.attachments.length>0&&(d.attachments=await Promise.all(e.attachments.map(async n=>j(n,s)))),i.debug("Sending email via SendGrid API",{subject:d.subject,to:a.to});const A={Authorization:`Bearer ${r.apiKey}`,"Content-Type":"application/json"},c=await p(async()=>h(`${r.endpoint}/mail/send`,{headers:A,method:"POST",timeout:r.timeout},JSON.stringify(d)),r.retries);if(!c.success)return i.debug("API request failed when sending email",c.error),{error:c.error??new u(s,"Failed to send email"),success:!1};const m=c.data?.headers,b=(m&&m instanceof Headers?m.get("X-Message-Id"):void 0)??w();return i.debug("Email sent successfully",{messageId:b}),{data:{messageId:b,provider:s,response:c.data,sent:!0,timestamp:new Date},success:!0}}catch(t){return{error:v(s,"send email",t,i),success:!1}}},async validateCredentials(){return this.isAvailable()}}});export{H as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{createRequire as x}from"node:module";import{createTransportDkimSigner as W}from"./DkimSigner-CCxFKitN.js";import f from"./EmailError-
|
|
1
|
+
import{createRequire as x}from"node:module";import{createTransportDkimSigner as W}from"./DkimSigner-CCxFKitN.js";import f from"./EmailError-SXEFQEyA.js";import Y from"./RequiredOptionError-C2wWqmiE.js";import{a as Q}from"./apply-message-id-nFsQiH5j.js";import{b as K}from"./build-mime-message-D45WdgfP.js";import{v as J}from"./validate-email-options-DxdAVLlu.js";import{defineProvider as O}from"./defineProvider-C9q-7iwt.js";let q;const G=d=>(q??=x(import.meta.url))(d),M=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,U=d=>{if(typeof M<"u"&&M.versions&&M.versions.node){const[t,A]=M.versions.node.split(".").map(Number);if(t>22||t===22&&A>=3||t===20&&A>=16)return M.getBuiltinModule(d)}return G(d)},{Buffer:E}=U("node:buffer"),{createHmac:B}=U("node:crypto"),{Socket:X,createConnection:V}=U("node:net"),{connect:H}=U("node:tls"),Z=(d,t)=>new Promise(A=>{const w=new X,g=()=>{w.destroy(),A(!1)};w.setTimeout(1e3),w.on("error",g),w.on("timeout",g),w.connect(t,d,()=>{w.end(),A(!0)})}),l="smtp",ee=25,te=465,re=1e4,se=!1,oe=5,N=3e4,ae=/^\./,pe=O((d={})=>{if(!d.host)throw new Y(l,"host");const t={authMethod:d.authMethod??"LOGIN",debug:d.debug??!1,dkim:d.dkim,host:d.host,maxConnections:d.maxConnections??oe,oauth2:d.oauth2,password:d.password,pool:d.pool??!1,port:d.port!==void 0?d.port:d.secure?te:ee,rejectUnauthorized:d.rejectUnauthorized??!0,retries:d.retries??0,secure:d.secure??se,timeout:d.timeout??re,user:d.user,...d.logger&&{logger:d.logger}};let A=!1;const w=[],g=[];let R=0;const j=()=>{R+=1},v=()=>{R>0&&(R-=1)},$=e=>e.replaceAll(/[\r\n\t\v\f]/g," ").trim(),I=e=>{const a=e.split(`\r
|
|
2
2
|
`),o={};for(const n of a)if(n.startsWith("250-")||n.startsWith("250 ")){const i=n.slice(4).trim().split(" "),s=i[0];s&&(o[s]=i.slice(1))}return o},h=async(e,a,o)=>new Promise((n,c)=>{const i=Array.isArray(o)?o:[o];let s="",u="";const y=setTimeout(()=>{m(),c(new f(l,`Command timeout after ${t.timeout}ms: ${a?.slice(0,50)}...`))},t.timeout),m=()=>{e.removeListener("data",p),e.removeListener("error",S),y&&clearTimeout(y)},p=r=>{s+=r.toString();const T=s.split(`\r
|
|
3
3
|
`).filter(Boolean);if(T.length>0){const L=T.at(-1);if(L){const _=L.match(/^(\d{3})[\s-]/);if(_){const[,z]=_;u=z,L[3]===" "&&(m(),i.includes(u)?n(s):c(new f(l,`Expected ${i.join(" or ")}, got ${u}: ${s.trim()}`)))}}}},S=r=>{m(),c(new f(l,`Socket error: ${r.message}`,{cause:r}))};e.on("data",p),e.on("error",S),a&&e.write(`${a}\r
|
|
4
4
|
`)}),C=async()=>{if(t.pool&&w.length>0){const e=w.pop();if(e&&!e.destroyed)return e;e&&v()}return t.pool&&R>=t.maxConnections?new Promise((e,a)=>{const o={reject:a,resolve:e};o.timeout=setTimeout(()=>{const n=g.indexOf(o);n!==-1&&g.splice(n,1),a(new f(l,`Connection queue timeout after ${N}ms`))},N),g.push(o)}):new Promise((e,a)=>{let o,n=!1,c;const i=()=>{o&&clearTimeout(o)};o=setTimeout(()=>{n||(n=!0,c&&!c.destroyed&&c.destroy(),i(),a(new f(l,`Connection timeout to ${t.host}:${t.port} after ${t.timeout}ms`)))},t.timeout);try{c=t.secure?H({host:t.host,port:t.port,rejectUnauthorized:t.rejectUnauthorized}):V(t.port,t.host),c.on("error",s=>{n||(n=!0,i(),a(new f(l,`Connection error: ${s.message}`,{cause:s})))}),c.once("data",s=>{if(!n&&c){n=!0,i();const u=s.toString();u.slice(0,3)==="220"?(j(),e(c)):(c.destroy(),a(new f(l,`Unexpected server greeting: ${u.trim()}`)))}})}catch(s){n||(n=!0,i(),a(new f(l,`Failed to create connection: ${s.message}`,{cause:s})))}})},P=async e=>new Promise((a,o)=>{let n,c=!1,i;const s=()=>{n&&clearTimeout(n)};n=setTimeout(()=>{c||(c=!0,i&&!i.destroyed&&i.destroy(),s(),o(new f(l,`TLS connection timeout after ${t.timeout}ms`)))},t.timeout);try{const u={host:t.host,rejectUnauthorized:t.rejectUnauthorized,socket:e};i=H(u),i.on("error",y=>{c||(c=!0,s(),o(new f(l,`TLS connection error: ${y.message}`,{cause:y})))}),i.once("secure",()=>{!c&&i&&(c=!0,s(),a(i))})}catch(u){c||(c=!0,s(),o(new f(l,`Failed to upgrade to TLS: ${u.message}`,{cause:u})))}}),k=e=>{if(e.destroyed||!t.pool){try{e.destroy()}catch{}v();return}if(g.length>0){const a=g.shift();if(a){clearTimeout(a.timeout),a.resolve(e);return}}w.push(e)},b=async(e,a=!1)=>{if(a){if(!e.destroyed)try{await h(e,"RSET","250")}catch{e.destroy()}k(e);return}await new Promise(o=>{try{v(),e.write(`QUIT\r
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import h from"./EmailError-
|
|
1
|
+
import h from"./EmailError-SXEFQEyA.js";import A from"./RequiredOptionError-C2wWqmiE.js";import{g as E}from"./generate-message-id-C5AM6DFE.js";import{m as I}from"./make-request-mszP240P.js";import{r as w}from"./retry-ByPJFAtq.js";import{v as P}from"./validate-email-options-DxdAVLlu.js";import{defineProvider as T}from"./defineProvider-C9q-7iwt.js";import{c as _,P as S,h as j}from"./provider-base-G22b4a87.js";import{a as u}from"./address-formatter-w36S9ZYj.js";import{c as z}from"./attachment-processor-AB1m-n9T.js";const r="sparkpost",C="https://api.sparkpost.com/api/v1",D=3e4,K=3,m=a=>[a].flat(),J=T((a={})=>{if(!a.apiKey)throw new A(r,"apiKey");const o={apiKey:a.apiKey,debug:a.debug??!1,endpoint:a.endpoint??C,logger:a.logger,retries:a.retries??K,timeout:a.timeout??D},y=new S,g=_(r,a.logger);return{features:{attachments:!0,batchSending:!0,customHeaders:!0,html:!0,replyTo:!0,scheduling:!1,tagging:!0,templates:!0,tracking:!0},async initialize(){await y.ensureInitialized(async()=>{if(!await this.isAvailable())throw new h(r,"SparkPost API not available or invalid API key");g.debug("Provider initialized successfully")},r)},async isAvailable(){return o.apiKey.length>0},name:r,options:o,async sendEmail(e){try{const i=P(e);if(i.length>0)return{error:new h(r,`Invalid email options: ${i.join(", ")}`),success:!1};await y.ensureInitialized(()=>this.initialize(),r);const l=m(e.to),p=e.cc?m(e.cc):[],v=e.bcc?m(e.bcc):[],k=[...l.map(t=>({address:u(t)})),...p.map(t=>({address:{...u(t),header_to:l.map(s=>s.email).join(", ")}})),...v.map(t=>({address:{...u(t),header_to:l.map(s=>s.email).join(", ")}}))],n={from:u(e.from),subject:e.subject};if(e.html&&(n.html=e.html),e.text&&(n.text=e.text),e.replyTo){const t=m(e.replyTo)[0];t&&(n.reply_to=t.email)}const c={};if(p.length>0&&(c.CC=p.map(t=>t.email).join(", ")),e.headers)for(const[t,s]of Object.entries(e.headers))c[t]=String(s);Object.keys(c).length>0&&(n.headers=c),e.templateId&&(n.template_id=e.templateId),e.attachments&&e.attachments.length>0&&(n.attachments=await Promise.all(e.attachments.map(async t=>{const s=await z(t,r);return{data:s.content,name:s.filename,type:s.contentType}})));const f={content:n,recipients:k};e.campaignId&&(f.campaign_id=e.campaignId),(e.trackOpens!==void 0||e.trackClicks!==void 0)&&(f.options={click_tracking:e.trackClicks??!0,open_tracking:e.trackOpens??!0});const d=await w(async()=>I(`${o.endpoint}/transmissions`,{headers:{Authorization:o.apiKey,"Content-Type":"application/json"},method:"POST",timeout:o.timeout},JSON.stringify(f)),o.retries);if(!d.success)return{error:d.error??new h(r,"Failed to send email"),success:!1};const{body:b}=d.data;return{data:{messageId:b?.results?.id??E(),provider:r,response:d.data,sent:!0,timestamp:new Date},success:!0}}catch(i){return{error:j(r,"send email",i,g),success:!1}}},async validateCredentials(){return this.isAvailable()}}});export{J as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import d from"./EmailError-
|
|
1
|
+
import d from"./EmailError-SXEFQEyA.js";import b from"./RequiredOptionError-C2wWqmiE.js";import{g as v}from"./generate-message-id-C5AM6DFE.js";import{h as w}from"./headers-to-record-ZOZ7Dubo.js";import{m as f}from"./make-request-mszP240P.js";import{r as h}from"./retry-ByPJFAtq.js";import{v as E}from"./validate-email-options-DxdAVLlu.js";import{defineProvider as I}from"./defineProvider-C9q-7iwt.js";import{c as A,P as T,h as y}from"./provider-base-G22b4a87.js";import{f as u,a as P}from"./address-formatter-w36S9ZYj.js";import{p as S}from"./attachment-processor-AB1m-n9T.js";const t="sweego",z="https://api.sweego.com",R=3e4,j=3,_=I((s={})=>{if(!s.apiKey)throw new b(t,"apiKey");const i={apiKey:s.apiKey,debug:s.debug??!1,endpoint:s.endpoint??z,retries:s.retries??j,timeout:s.timeout??R,...s.logger&&{logger:s.logger}},l=new T,a=A(t,s.logger);return{features:{attachments:!0,batchSending:!0,customHeaders:!0,html:!0,replyTo:!0,scheduling:!1,tagging:!0,templates:!0,tracking:!0},async getEmail(e){try{if(!e)return{error:new d(t,"Email ID is required to retrieve email details"),success:!1};await l.ensureInitialized(()=>this.initialize(),t);const o={Authorization:`Bearer ${i.apiKey}`,"Content-Type":"application/json"};a.debug("Retrieving email details",{id:e});const r=await h(async()=>f(`${i.endpoint}/emails/${e}`,{headers:o,method:"GET",timeout:i.timeout}),i.retries);return r.success?(a.debug("Email details retrieved successfully"),{data:r.data?.body,success:!0}):(a.debug("API request failed when retrieving email",r.error),{error:new d(t,`Failed to retrieve email: ${r.error instanceof Error?r.error.message:"Unknown error"}`,{cause:r.error}),success:!1})}catch(o){return{error:y(t,"retrieve email",o,a),success:!1}}},async initialize(){await l.ensureInitialized(async()=>{if(!await this.isAvailable())throw new d(t,"Sweego API not available or invalid API key");a.debug("Provider initialized successfully")},t)},async isAvailable(){try{return a.debug("Checking Sweego API availability"),!0}catch(e){return a.debug("Error checking availability:",e),!1}},name:t,options:i,async sendEmail(e){try{const o=E(e);if(o.length>0)return{error:new d(t,`Invalid email options: ${o.join(", ")}`),success:!1};await l.ensureInitialized(()=>this.initialize(),t);const r={from:{email:e.from.email,name:e.from.name},subject:e.subject,to:u(e.to)};if(e.html&&(r.html=e.html),e.text&&(r.text=e.text),e.cc&&(r.cc=u(e.cc)),e.bcc&&(r.bcc=u(e.bcc)),e.replyTo&&(r.replyTo=P(e.replyTo)),e.templateId&&(r.templateId=e.templateId,e.templateVariables&&(r.templateVariables=e.templateVariables)),e.tags&&e.tags.length>0&&(r.tags=e.tags),e.headers){const n=w(e.headers);r.headers=n}e.attachments&&e.attachments.length>0&&(r.attachments=await Promise.all(e.attachments.map(async n=>({content:await S(n,t),contentType:n.contentType??"application/octet-stream",filename:n.filename,...n.cid&&{cid:n.cid}})))),a.debug("Sending email via Sweego API",{subject:r.subject,to:r.to});const p={Authorization:`Bearer ${i.apiKey}`,"Content-Type":"application/json"},c=await h(async()=>f(`${i.endpoint}/send`,{headers:p,method:"POST",timeout:i.timeout},JSON.stringify(r)),i.retries);if(!c.success)return a.debug("API request failed when sending email",c.error),{error:c.error??new d(t,"Failed to send email"),success:!1};const m=c.data?.body,g=m?.messageId??m?.id??v();return a.debug("Email sent successfully",{messageId:g}),{data:{messageId:g,provider:t,response:c.data,sent:!0,timestamp:new Date},success:!0}}catch(o){return{error:y(t,"send email",o,a),success:!1}}},async validateCredentials(){return this.isAvailable()}}});export{_ as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { E as EmailOptions, a as EmailResult, R as Result } from "./types.d-
|
|
1
|
+
import { E as EmailOptions, a as EmailResult, R as Result } from "./types.d-CyiC9uRC.js";
|
|
2
2
|
/**
|
|
3
3
|
* The terminal send function a middleware wraps — ultimately the provider's `sendEmail`.
|
|
4
4
|
*/
|
|
@@ -11,6 +11,10 @@ interface FeatureFlags {
|
|
|
11
11
|
batchSending?: boolean;
|
|
12
12
|
customHeaders?: boolean;
|
|
13
13
|
html?: boolean;
|
|
14
|
+
/**
|
|
15
|
+
* The provider sends `idempotencyKey` upstream, so a repeated send with the same key is not duplicated.
|
|
16
|
+
*/
|
|
17
|
+
idempotency?: boolean;
|
|
14
18
|
replyTo?: boolean;
|
|
15
19
|
scheduling?: boolean;
|
|
16
20
|
tagging?: boolean;
|
|
@@ -137,6 +141,12 @@ interface EmailOptions {
|
|
|
137
141
|
href?: string;
|
|
138
142
|
path?: string;
|
|
139
143
|
};
|
|
144
|
+
/**
|
|
145
|
+
* Caller-chosen key that lets the provider recognise a repeated send of the same message, so a
|
|
146
|
+
* retry after an ambiguous failure does not deliver twice. Only providers that declare
|
|
147
|
+
* `features.idempotency` act on it; it is never written into the message headers or the MIME body.
|
|
148
|
+
*/
|
|
149
|
+
idempotencyKey?: string;
|
|
140
150
|
priority?: Priority;
|
|
141
151
|
replyTo?: EmailAddress;
|
|
142
152
|
/**
|
package/dist/packem_shared/{verifySendGridWebhook-csuRasH3.js → verifySendGridWebhook-0_3qKQA1.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{createRequire as y}from"node:module";import v from"./EmailError-
|
|
1
|
+
import{createRequire as y}from"node:module";import v from"./EmailError-SXEFQEyA.js";import{i as g}from"./utils-CDV8xy3e.js";let _;const h=e=>(_??=y(import.meta.url))(e),t=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,u=e=>{if(typeof t<"u"&&t.versions&&t.versions.node){const[r,o]=t.versions.node.split(".").map(Number);if(r>22||r===22&&o>=3||r===20&&o>=16)return t.getBuiltinModule(e)}return h(e)},{Buffer:i}=u("node:buffer"),{verify:b,createPublicKey:f}=u("node:crypto"),j=e=>e.includes("-----BEGIN")?f(e):f({format:"der",key:i.from(e,"base64"),type:"spki"}),w=e=>{const{now:r,payload:o,publicKey:d,signature:n,timestamp:s,tolerance:l=300}=e;if(!n||!s)return{reason:"missing-headers",valid:!1};let a;try{a=j(d)}catch(p){throw new v("webhooks","Failed to parse SendGrid verification key",{cause:p})}const m=i.from(s+o,"utf8");let c;try{c=b("sha256",m,{dsaEncoding:"der",key:a},i.from(n,"base64"))}catch{return{reason:"signature-malformed",valid:!1}}return c?g(Number.parseInt(s,10),l,r)?{valid:!0}:{reason:"timestamp-out-of-tolerance",valid:!1}:{reason:"signature-mismatch",valid:!1}};export{w as verifySendGridWebhook};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{filterSuppressed as l}from"./createSuppressionStore-DbocihI8.js";import a from"./EmailError-
|
|
1
|
+
import{filterSuppressed as l}from"./createSuppressionStore-DbocihI8.js";import a from"./EmailError-SXEFQEyA.js";const i=(c,d={})=>async(e,n)=>{const t={allowed:[],suppressed:[]},r=await l(e.to,c),s=e.cc?await l(e.cc,c):t,o=e.bcc?await l(e.bcc,c):t,p=[...r.suppressed,...s.suppressed,...o.suppressed];return p.length>0&&d.onSuppressed?.(p),r.allowed.length===0&&s.allowed.length===0&&o.allowed.length===0?{error:new a("middleware","All recipients are suppressed",{code:"ALL_SUPPRESSED"}),success:!1}:n({...e,bcc:o.allowed.length>0?o.allowed:void 0,cc:s.allowed.length>0?s.allowed:void 0,to:r.allowed})};export{i as withSuppression};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import l from"./EmailError-
|
|
1
|
+
import l from"./EmailError-SXEFQEyA.js";import g from"./RequiredOptionError-C2wWqmiE.js";import{g as k}from"./generate-message-id-C5AM6DFE.js";import{h as v}from"./headers-to-record-ZOZ7Dubo.js";import{m as p}from"./make-request-mszP240P.js";import{r as E}from"./retry-ByPJFAtq.js";import{s as A,a as _}from"./sanitize-header-CW0f3IT7.js";import{v as T}from"./validate-email-options-DxdAVLlu.js";import{defineProvider as w}from"./defineProvider-C9q-7iwt.js";import{c as z,P,h as I}from"./provider-base-G22b4a87.js";import{n as y}from"./address-formatter-w36S9ZYj.js";const s="zeptomail",j="https://api.zeptomail.com/v1.1",D=3e4,R=3,M=w((o={})=>{if(!o.token)throw new g(s,"token");if(!o.token.startsWith("Zoho-enczapikey "))throw new l(s,'Token should be in the format "Zoho-enczapikey <your_api_key>"');const c={debug:o.debug??!1,endpoint:o.endpoint??j,logger:o.logger,retries:o.retries??R,timeout:o.timeout??D,token:o.token},u=new P,i=z(s,o.logger);return{features:{attachments:!0,batchSending:!1,customHeaders:!0,html:!0,replyTo:!0,scheduling:!1,tagging:!1,templates:!1,tracking:!0},async initialize(){await u.ensureInitialized(async()=>{if(!await this.isAvailable())throw new l(s,"Zeptomail API not available or invalid token");i.debug("Provider initialized successfully")},s)},async isAvailable(){try{return c.token&&c.token.startsWith("Zoho-enczapikey ")?(i.debug("Token format is valid, assuming Zeptomail is available"),!0):!1}catch(e){return i.debug("Error checking availability:",e),!1}},name:s,options:c,async sendEmail(e){try{const d=T(e);if(d.length>0)return{error:new l(s,`Invalid email options: ${d.join(", ")}`),success:!1};await u.ensureInitialized(()=>this.initialize(),s);const t={from:y(e.from).address,subject:e.subject};if(Array.isArray(e.to)?t.to=e.to.length===1?e.to[0].email:e.to.map(r=>r.email):t.to=e.to.email,e.text&&(t.textbody=e.text),e.html&&(t.htmlbody=e.html),e.cc&&(Array.isArray(e.cc)?t.cc=e.cc.length===1?e.cc[0].email:e.cc.map(r=>r.email):t.cc=e.cc.email),e.bcc&&(Array.isArray(e.bcc)?t.bcc=e.bcc.length===1?e.bcc[0].email:e.bcc.map(r=>r.email):t.bcc=e.bcc.email),e.replyTo&&(t.reply_to=[y(e.replyTo).address]),e.trackClicks!==void 0&&(t.track_clicks=e.trackClicks),e.trackOpens!==void 0&&(t.track_opens=e.trackOpens),e.clientReference&&(t.client_reference=e.clientReference),e.mimeHeaders&&Object.keys(e.mimeHeaders).length>0){const r={};for(const[a,f]of Object.entries(e.mimeHeaders))r[a]=f;t.mime_headers=r}if(e.headers){const r=v(e.headers);Object.keys(r).length>0&&(t.mime_headers??={},Object.entries(r).forEach(([a,f])=>{t.mime_headers&&(t.mime_headers[A(a)]=_(f))}))}e.attachments&&e.attachments.length>0&&(t.attachments=e.attachments.map(r=>{const a={name:r.filename};return r.content?(a.content=typeof r.content=="string"?r.content:r.content.toString("base64"),r.contentType&&(a.mime_type=r.contentType)):r.path&&(a.file_cache_key=r.path),a})),i.debug("Sending email via Zeptomail API",{subject:t.subject,to:t.to});const b={Accept:"application/json",Authorization:c.token,"Content-Type":"application/json"},n=await E(async()=>p(`${c.endpoint}/email`,{headers:b,method:"POST",timeout:c.timeout},JSON.stringify(t)),c.retries);if(!n.success){i.debug("API request failed",n.error);let r=n.error instanceof Error?n.error.message:"Unknown error";const a=n.data;return a?.body?.message?r+=` Details: ${a.body.message}`:a?.body?.error?.message&&(r+=` Details: ${a.body.error.message}`),{error:new l(s,`Failed to send email: ${r}`,{cause:n.error}),success:!1}}const m=n.data?.body,h=m?.request_id??k();return i.debug("Email sent successfully",{messageId:h}),{data:{messageId:h,provider:s,response:m,sent:!0,timestamp:new Date},success:!0}}catch(d){return{error:I(s,"send email",d,i),success:!1}}},async validateCredentials(){return this.isAvailable()}}});export{M as default};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { P as ProviderFactory } from "../../packem_shared/provider.d-
|
|
2
|
-
export type { a as Provider } from "../../packem_shared/provider.d-
|
|
3
|
-
import { B as BaseConfig, E as EmailOptions } from "../../packem_shared/types.d-
|
|
1
|
+
import { P as ProviderFactory } from "../../packem_shared/provider.d-BLLbEuQ8.js";
|
|
2
|
+
export type { a as Provider } from "../../packem_shared/provider.d-BLLbEuQ8.js";
|
|
3
|
+
import { B as BaseConfig, E as EmailOptions } from "../../packem_shared/types.d-CyiC9uRC.js";
|
|
4
4
|
import 'node:buffer';
|
|
5
5
|
/**
|
|
6
6
|
* AhaSend configuration
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{default as r}from"../../packem_shared/ahaSendProvider-
|
|
1
|
+
import{default as r}from"../../packem_shared/ahaSendProvider-Ci_a_O8d.js";export{r as ahaSendProvider};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { P as ProviderFactory } from "../../packem_shared/provider.d-
|
|
2
|
-
export type { a as Provider } from "../../packem_shared/provider.d-
|
|
3
|
-
import { B as BaseConfig, E as EmailOptions } from "../../packem_shared/types.d-
|
|
1
|
+
import { P as ProviderFactory } from "../../packem_shared/provider.d-BLLbEuQ8.js";
|
|
2
|
+
export type { a as Provider } from "../../packem_shared/provider.d-BLLbEuQ8.js";
|
|
3
|
+
import { B as BaseConfig, E as EmailOptions } from "../../packem_shared/types.d-CyiC9uRC.js";
|
|
4
4
|
import 'node:buffer';
|
|
5
5
|
/**
|
|
6
6
|
* AutoSend configuration.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{default as r}from"../../packem_shared/autoSendProvider-
|
|
1
|
+
import{default as r}from"../../packem_shared/autoSendProvider-DG3pNJML.js";export{r as autoSendProvider};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { P as ProviderFactory } from "../../packem_shared/provider.d-
|
|
2
|
-
export type { a as Provider } from "../../packem_shared/provider.d-
|
|
3
|
-
import { B as BaseConfig, E as EmailOptions } from "../../packem_shared/types.d-
|
|
1
|
+
import { P as ProviderFactory } from "../../packem_shared/provider.d-BLLbEuQ8.js";
|
|
2
|
+
export type { a as Provider } from "../../packem_shared/provider.d-BLLbEuQ8.js";
|
|
3
|
+
import { B as BaseConfig, E as EmailOptions } from "../../packem_shared/types.d-CyiC9uRC.js";
|
|
4
4
|
import 'node:buffer';
|
|
5
5
|
/**
|
|
6
6
|
* AWS SES configuration
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{default as a}from"../../packem_shared/awsSesProvider-
|
|
1
|
+
import{default as a}from"../../packem_shared/awsSesProvider-C4b5kuL4.js";export{a as awsSesProvider};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { P as ProviderFactory } from "../../packem_shared/provider.d-
|
|
2
|
-
export type { a as Provider } from "../../packem_shared/provider.d-
|
|
3
|
-
import { B as BaseConfig, E as EmailOptions } from "../../packem_shared/types.d-
|
|
1
|
+
import { P as ProviderFactory } from "../../packem_shared/provider.d-BLLbEuQ8.js";
|
|
2
|
+
export type { a as Provider } from "../../packem_shared/provider.d-BLLbEuQ8.js";
|
|
3
|
+
import { B as BaseConfig, E as EmailOptions } from "../../packem_shared/types.d-CyiC9uRC.js";
|
|
4
4
|
import 'node:buffer';
|
|
5
5
|
/**
|
|
6
6
|
* Azure Communication Services configuration
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{default as a}from"../../packem_shared/azureProvider-
|
|
1
|
+
import{default as a}from"../../packem_shared/azureProvider-CEnz3uy_.js";export{a as azureProvider};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { P as ProviderFactory } from "../../packem_shared/provider.d-
|
|
2
|
-
export type { a as Provider } from "../../packem_shared/provider.d-
|
|
3
|
-
import { B as BaseConfig, E as EmailOptions, c as EmailAddress } from "../../packem_shared/types.d-
|
|
1
|
+
import { P as ProviderFactory } from "../../packem_shared/provider.d-BLLbEuQ8.js";
|
|
2
|
+
export type { a as Provider } from "../../packem_shared/provider.d-BLLbEuQ8.js";
|
|
3
|
+
import { B as BaseConfig, E as EmailOptions, c as EmailAddress } from "../../packem_shared/types.d-CyiC9uRC.js";
|
|
4
4
|
import 'node:buffer';
|
|
5
5
|
/**
|
|
6
6
|
* Brevo configuration
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{default as o}from"../../packem_shared/brevoProvider-
|
|
1
|
+
import{default as o}from"../../packem_shared/brevoProvider-BsbInXjw.js";export{o as brevoProvider};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { P as ProviderFactory } from "../../packem_shared/provider.d-
|
|
2
|
-
export type { a as Provider } from "../../packem_shared/provider.d-
|
|
3
|
-
import { D as DkimOptions } from "../../packem_shared/types.d-
|
|
4
|
-
import { B as BaseConfig, E as EmailOptions } from "../../packem_shared/types.d-
|
|
1
|
+
import { P as ProviderFactory } from "../../packem_shared/provider.d-BLLbEuQ8.js";
|
|
2
|
+
export type { a as Provider } from "../../packem_shared/provider.d-BLLbEuQ8.js";
|
|
3
|
+
import { D as DkimOptions } from "../../packem_shared/types.d-A1Eea-p_.js";
|
|
4
|
+
import { B as BaseConfig, E as EmailOptions } from "../../packem_shared/types.d-CyiC9uRC.js";
|
|
5
5
|
import 'node:buffer';
|
|
6
6
|
/**
|
|
7
7
|
* Cloudflare Email Workers configuration.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{default as e}from"../../packem_shared/cloudflareEmailProvider-
|
|
1
|
+
import{default as e}from"../../packem_shared/cloudflareEmailProvider-CnpH5R5p.js";export{e as cloudflareEmailProvider};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { P as ProviderFactory } from "../../packem_shared/provider.d-
|
|
2
|
-
export type { a as Provider } from "../../packem_shared/provider.d-
|
|
3
|
-
import { B as BaseConfig, E as EmailOptions } from "../../packem_shared/types.d-
|
|
1
|
+
import { P as ProviderFactory } from "../../packem_shared/provider.d-BLLbEuQ8.js";
|
|
2
|
+
export type { a as Provider } from "../../packem_shared/provider.d-BLLbEuQ8.js";
|
|
3
|
+
import { B as BaseConfig, E as EmailOptions } from "../../packem_shared/types.d-CyiC9uRC.js";
|
|
4
4
|
import 'node:buffer';
|
|
5
5
|
/**
|
|
6
6
|
* Failover configuration
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{default as o}from"../../packem_shared/failoverProvider-
|
|
1
|
+
import{default as o}from"../../packem_shared/failoverProvider-DsBqMOfK.js";export{o as failoverProvider};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { P as ProviderFactory } from "../../packem_shared/provider.d-BLLbEuQ8.js";
|
|
2
|
+
export type { a as Provider } from "../../packem_shared/provider.d-BLLbEuQ8.js";
|
|
3
|
+
import "../../packem_shared/types.d-CyiC9uRC.js";
|
|
4
|
+
import 'node:buffer';
|
|
5
|
+
/**
|
|
6
|
+
* File provider configuration.
|
|
7
|
+
*/
|
|
8
|
+
interface FileConfig {
|
|
9
|
+
/**
|
|
10
|
+
* Directory the `.eml` files are written to. Created on first use.
|
|
11
|
+
*/
|
|
12
|
+
directory: string;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* File Provider that writes each message as an `.eml` file instead of sending it.
|
|
16
|
+
*
|
|
17
|
+
* Useful for development and for test suites that need to inspect the exact MIME output.
|
|
18
|
+
* Files are named after the send time in epoch milliseconds and the message id, with an `.eml`
|
|
19
|
+
* extension, and are never overwritten. Bcc recipients are written into the file, since nothing
|
|
20
|
+
* is delivered and the file is the only record of them.
|
|
21
|
+
*/
|
|
22
|
+
declare const fileProvider: ProviderFactory<FileConfig>;
|
|
23
|
+
export { type FileConfig, type ProviderFactory, fileProvider };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{default as f}from"../../packem_shared/fileProvider-BnDeaSqA.js";export{f as fileProvider};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { P as ProviderFactory } from "../../packem_shared/provider.d-
|
|
2
|
-
export type { a as Provider } from "../../packem_shared/provider.d-
|
|
3
|
-
import { E as EmailOptions } from "../../packem_shared/types.d-
|
|
1
|
+
import { P as ProviderFactory } from "../../packem_shared/provider.d-BLLbEuQ8.js";
|
|
2
|
+
export type { a as Provider } from "../../packem_shared/provider.d-BLLbEuQ8.js";
|
|
3
|
+
import { E as EmailOptions } from "../../packem_shared/types.d-CyiC9uRC.js";
|
|
4
4
|
import 'node:buffer';
|
|
5
5
|
/**
|
|
6
6
|
* HTTP email configuration
|