@visulima/email 1.0.0-alpha.2 → 1.0.0-alpha.21

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.
Files changed (231) hide show
  1. package/CHANGELOG.md +246 -0
  2. package/LICENSE.md +536 -899
  3. package/README.md +36 -21
  4. package/dist/crypto/index.d.ts +147 -4
  5. package/dist/crypto/index.js +1 -1
  6. package/dist/index.d.ts +785 -9
  7. package/dist/index.js +1 -1
  8. package/dist/packem_shared/{DkimSigner-pFd4c3fZ.js → DkimSigner-CT2DSHD1.js} +4 -4
  9. package/dist/packem_shared/Mail-D93oo_9g.js +1 -0
  10. package/dist/packem_shared/MailMessage-BvaH5tZZ.js +1 -0
  11. package/dist/packem_shared/{SmimeEncrypter-CBevU534.js → SmimeEncrypter-ZhHEgDwY.js} +2 -2
  12. package/dist/packem_shared/{SmimeSigner-CObA4jzT.js → SmimeSigner-CYSVF6ez.js} +1 -1
  13. package/dist/packem_shared/{ahaSendProvider-DlFKEQ6D.js → ahaSendProvider-DOAAW65O.js} +1 -1
  14. package/dist/packem_shared/{attachment-processor-2rHmfa7j.js → attachment-processor-DsmIomKc.js} +1 -1
  15. package/dist/packem_shared/{awsSesProvider-Ba-eVJxZ.js → awsSesProvider-DX1630Ms.js} +7 -7
  16. package/dist/packem_shared/azureProvider-EkNYKAiF.js +1 -0
  17. package/dist/packem_shared/{brevoProvider-5p6jjiK9.js → brevoProvider-CkR4U4RD.js} +1 -1
  18. package/dist/packem_shared/build-mime-message-6xstxaUV.js +2 -0
  19. package/dist/packem_shared/defineProvider-CtLH0VBE.js +1 -0
  20. package/dist/packem_shared/detectMimeType-bo5oxfnt.js +1 -0
  21. package/dist/packem_shared/failoverProvider-W5ctAhdC.js +1 -0
  22. package/dist/packem_shared/httpProvider-DUg1AQfO.js +1 -0
  23. package/dist/packem_shared/{infobipProvider-CtLwrUaP.js → infobipProvider-BhTsWi7e.js} +1 -1
  24. package/dist/packem_shared/{mailCrabProvider-CM_CFDca.js → mailCrabProvider-B7H6HwWu.js} +1 -1
  25. package/dist/packem_shared/mailPaceProvider-DRt6Z9Hr.js +1 -0
  26. package/dist/packem_shared/{mailerSendProvider-CeeIXFnW.js → mailerSendProvider-Dx_iHInH.js} +1 -1
  27. package/dist/packem_shared/mailgunProvider-ChkLGZZW.js +1 -0
  28. package/dist/packem_shared/mailjetProvider-BMRhNe6H.js +1 -0
  29. package/dist/packem_shared/{mailomatProvider-DMQmjKHT.js → mailomatProvider-CydV-JB6.js} +1 -1
  30. package/dist/packem_shared/{mailtrapProvider-BN3UBEQw.js → mailtrapProvider-CuAfJWDr.js} +1 -1
  31. package/dist/packem_shared/{make-request-BDzF9W9D.js → make-request-CaT4d5oC.js} +1 -1
  32. package/dist/packem_shared/{mandrillProvider-370y7CLu.js → mandrillProvider-BBeLbaw0.js} +1 -1
  33. package/dist/packem_shared/mockProvider-C0P1lKOy.js +1 -0
  34. package/dist/packem_shared/{nodemailerProvider-_w8QXMU-.js → nodemailerProvider-DFcvoVFv.js} +1 -1
  35. package/dist/packem_shared/{opentelemetryProvider-C_ZXOLSd.js → opentelemetryProvider-Dwv88G3O.js} +1 -1
  36. package/dist/packem_shared/{plunkProvider-DfJumQ4U.js → plunkProvider-BQyjG6YT.js} +1 -1
  37. package/dist/packem_shared/{postalProvider-Bavx2FcH.js → postalProvider-DPHQ620q.js} +1 -1
  38. package/dist/packem_shared/{postmarkProvider-DFC0uvjO.js → postmarkProvider-bMTC2gdJ.js} +1 -1
  39. package/dist/packem_shared/provider.d-DcfYeGJJ.d.ts +28 -0
  40. package/dist/packem_shared/readFile-BAVMZg5e-C4whBIPd.js +1 -0
  41. package/dist/packem_shared/resendProvider-Cns1tvF5.js +1 -0
  42. package/dist/packem_shared/roundRobinProvider-FvZQKl6n.js +1 -0
  43. package/dist/packem_shared/{scalewayProvider-be1HPimL.js → scalewayProvider-O1dHz7iJ.js} +1 -1
  44. package/dist/packem_shared/{sendGridProvider-BVI1sq3n.js → sendGridProvider-DmywC-eT.js} +1 -1
  45. package/dist/packem_shared/{smtpProvider-BV-ufR53.js → smtpProvider-Unjao_fn.js} +8 -8
  46. package/dist/packem_shared/sweegoProvider-D086G6xG.js +1 -0
  47. package/dist/packem_shared/types.d-CNnnk-Ya.d.ts +102 -0
  48. package/dist/packem_shared/types.d-nyR1ty1Q.d.ts +9 -0
  49. package/dist/packem_shared/types.d-wwpgA3to.d.ts +204 -0
  50. package/dist/packem_shared/validate-email-options-DPo3SgC0.js +1 -0
  51. package/dist/packem_shared/zeptomailProvider-DKKEpEsW.js +1 -0
  52. package/dist/providers/ahasend/index.d.ts +36 -3
  53. package/dist/providers/ahasend/index.js +1 -1
  54. package/dist/providers/aws-ses/index.d.ts +47 -3
  55. package/dist/providers/aws-ses/index.js +1 -1
  56. package/dist/providers/azure/index.d.ts +52 -3
  57. package/dist/providers/azure/index.js +1 -1
  58. package/dist/providers/brevo/index.d.ts +65 -3
  59. package/dist/providers/brevo/index.js +1 -1
  60. package/dist/providers/failover/index.d.ts +27 -3
  61. package/dist/providers/failover/index.js +1 -1
  62. package/dist/providers/http/index.d.ts +35 -3
  63. package/dist/providers/http/index.js +1 -1
  64. package/dist/providers/infobip/index.d.ts +56 -3
  65. package/dist/providers/infobip/index.js +1 -1
  66. package/dist/providers/mailcrab/index.d.ts +32 -3
  67. package/dist/providers/mailcrab/index.js +1 -1
  68. package/dist/providers/mailersend/index.d.ts +51 -3
  69. package/dist/providers/mailersend/index.js +1 -1
  70. package/dist/providers/mailgun/index.d.ts +73 -3
  71. package/dist/providers/mailgun/index.js +1 -1
  72. package/dist/providers/mailjet/index.d.ts +72 -3
  73. package/dist/providers/mailjet/index.js +1 -1
  74. package/dist/providers/mailomat/index.d.ts +40 -3
  75. package/dist/providers/mailomat/index.js +1 -1
  76. package/dist/providers/mailpace/index.d.ts +52 -3
  77. package/dist/providers/mailpace/index.js +1 -1
  78. package/dist/providers/mailtrap/index.d.ts +44 -3
  79. package/dist/providers/mailtrap/index.js +1 -1
  80. package/dist/providers/mandrill/index.d.ts +87 -3
  81. package/dist/providers/mandrill/index.js +1 -1
  82. package/dist/providers/mock/index.d.ts +59 -3
  83. package/dist/providers/mock/index.js +1 -1
  84. package/dist/providers/nodemailer/index.d.ts +38 -3
  85. package/dist/providers/nodemailer/index.js +1 -1
  86. package/dist/providers/opentelemetry/index.d.ts +529 -3
  87. package/dist/providers/opentelemetry/index.js +1 -1
  88. package/dist/providers/plunk/index.d.ts +38 -3
  89. package/dist/providers/plunk/index.js +1 -1
  90. package/dist/providers/postal/index.d.ts +48 -3
  91. package/dist/providers/postal/index.js +1 -1
  92. package/dist/providers/postmark/index.d.ts +60 -3
  93. package/dist/providers/postmark/index.js +1 -1
  94. package/dist/providers/resend/index.d.ts +51 -3
  95. package/dist/providers/resend/index.js +1 -1
  96. package/dist/providers/roundrobin/index.d.ts +27 -3
  97. package/dist/providers/roundrobin/index.js +1 -1
  98. package/dist/providers/scaleway/index.d.ts +44 -3
  99. package/dist/providers/scaleway/index.js +1 -1
  100. package/dist/providers/sendgrid/index.d.ts +84 -3
  101. package/dist/providers/sendgrid/index.js +1 -1
  102. package/dist/providers/smtp/index.d.ts +71 -3
  103. package/dist/providers/smtp/index.js +1 -1
  104. package/dist/providers/sweego/index.d.ts +40 -3
  105. package/dist/providers/sweego/index.js +1 -1
  106. package/dist/providers/zeptomail/index.d.ts +37 -3
  107. package/dist/providers/zeptomail/index.js +1 -1
  108. package/dist/template-engines/handlebars.d.ts +23 -22
  109. package/dist/template-engines/handlebars.js +1 -1
  110. package/dist/template-engines/html-to-text.d.ts +24 -24
  111. package/dist/template-engines/mjml.d.ts +10 -10
  112. package/dist/template-engines/react-email.d.ts +9 -9
  113. package/dist/template-engines/vue-email.d.ts +9 -9
  114. package/dist/utils/cache.d.ts +49 -48
  115. package/dist/utils/format-email-address.d.ts +8 -7
  116. package/dist/utils/normalize-email-aliases.d.ts +20 -20
  117. package/dist/utils/parse-address.d.ts +18 -17
  118. package/dist/utils/parse-address.js +1 -1
  119. package/dist/utils/validation/check-mx-records.d.ts +36 -35
  120. package/dist/utils/validation/disposable-email-domains.d.ts +1 -13
  121. package/dist/utils/validation/role-accounts.d.ts +18 -18
  122. package/dist/utils/validation/validate-email.d.ts +5 -5
  123. package/dist/utils/validation/verify-email.d.ts +45 -42
  124. package/dist/utils/validation/verify-email.js +1 -1
  125. package/dist/utils/validation/verify-smtp.d.ts +35 -34
  126. package/dist/utils/validation/verify-smtp.js +1 -1
  127. package/package.json +61 -61
  128. package/dist/attachment-helpers.d.ts +0 -64
  129. package/dist/crypto/dkim-signer.d.ts +0 -48
  130. package/dist/crypto/smime-encrypter.d.ts +0 -53
  131. package/dist/crypto/smime-signer.d.ts +0 -48
  132. package/dist/crypto/types.d.ts +0 -101
  133. package/dist/draft-mail-message.d.ts +0 -13
  134. package/dist/errors/email-error.d.ts +0 -17
  135. package/dist/errors/required-option-error.d.ts +0 -10
  136. package/dist/mail-message.d.ts +0 -425
  137. package/dist/mail.d.ts +0 -206
  138. package/dist/packem_shared/Mail-6Bltpy_p.js +0 -1
  139. package/dist/packem_shared/MailMessage-B76GPBBA.js +0 -1
  140. package/dist/packem_shared/azureProvider-CQYAkgVF.js +0 -1
  141. package/dist/packem_shared/build-mime-message-IYaUqqPJ.js +0 -2
  142. package/dist/packem_shared/defineProvider-B9rSklAJ.js +0 -1
  143. package/dist/packem_shared/detectMimeType-S8WRsNtY.js +0 -1
  144. package/dist/packem_shared/failoverProvider-CAHQQueo.js +0 -1
  145. package/dist/packem_shared/httpProvider-CZD6LZX3.js +0 -1
  146. package/dist/packem_shared/mailPaceProvider-B6yKvh6z.js +0 -1
  147. package/dist/packem_shared/mailgunProvider-mmjKzouh.js +0 -1
  148. package/dist/packem_shared/mailjetProvider-DwN6i0VA.js +0 -1
  149. package/dist/packem_shared/mockProvider-DN5ZwutD.js +0 -1
  150. package/dist/packem_shared/readFile-BlZxbhCU-C8bCdiA2.js +0 -1
  151. package/dist/packem_shared/resendProvider-CfqU7UdE.js +0 -1
  152. package/dist/packem_shared/roundRobinProvider-1WQnuKR8.js +0 -1
  153. package/dist/packem_shared/sweegoProvider-7419CSAq.js +0 -1
  154. package/dist/packem_shared/validate-email-options-DfJ7llf8.js +0 -1
  155. package/dist/packem_shared/zeptomailProvider-C2lh0Xmo.js +0 -1
  156. package/dist/providers/ahasend/provider.d.ts +0 -7
  157. package/dist/providers/ahasend/types.d.ts +0 -28
  158. package/dist/providers/aws-ses/provider.d.ts +0 -8
  159. package/dist/providers/aws-ses/types.d.ts +0 -38
  160. package/dist/providers/azure/provider.d.ts +0 -7
  161. package/dist/providers/azure/types.d.ts +0 -44
  162. package/dist/providers/brevo/provider.d.ts +0 -7
  163. package/dist/providers/brevo/types.d.ts +0 -57
  164. package/dist/providers/failover/provider.d.ts +0 -7
  165. package/dist/providers/failover/types.d.ts +0 -19
  166. package/dist/providers/http/provider.d.ts +0 -7
  167. package/dist/providers/http/types.d.ts +0 -27
  168. package/dist/providers/infobip/provider.d.ts +0 -7
  169. package/dist/providers/infobip/types.d.ts +0 -48
  170. package/dist/providers/mailcrab/provider.d.ts +0 -9
  171. package/dist/providers/mailcrab/types.d.ts +0 -22
  172. package/dist/providers/mailersend/provider.d.ts +0 -7
  173. package/dist/providers/mailersend/types.d.ts +0 -43
  174. package/dist/providers/mailgun/provider.d.ts +0 -7
  175. package/dist/providers/mailgun/types.d.ts +0 -65
  176. package/dist/providers/mailjet/provider.d.ts +0 -7
  177. package/dist/providers/mailjet/types.d.ts +0 -64
  178. package/dist/providers/mailomat/provider.d.ts +0 -7
  179. package/dist/providers/mailomat/types.d.ts +0 -32
  180. package/dist/providers/mailpace/provider.d.ts +0 -7
  181. package/dist/providers/mailpace/types.d.ts +0 -44
  182. package/dist/providers/mailtrap/provider.d.ts +0 -7
  183. package/dist/providers/mailtrap/types.d.ts +0 -36
  184. package/dist/providers/mandrill/provider.d.ts +0 -7
  185. package/dist/providers/mandrill/types.d.ts +0 -79
  186. package/dist/providers/mock/provider.d.ts +0 -8
  187. package/dist/providers/mock/types.d.ts +0 -50
  188. package/dist/providers/nodemailer/provider.d.ts +0 -7
  189. package/dist/providers/nodemailer/types.d.ts +0 -30
  190. package/dist/providers/opentelemetry/provider.d.ts +0 -8
  191. package/dist/providers/opentelemetry/types.d.ts +0 -31
  192. package/dist/providers/plunk/provider.d.ts +0 -7
  193. package/dist/providers/plunk/types.d.ts +0 -30
  194. package/dist/providers/postal/provider.d.ts +0 -7
  195. package/dist/providers/postal/types.d.ts +0 -40
  196. package/dist/providers/postmark/provider.d.ts +0 -7
  197. package/dist/providers/postmark/types.d.ts +0 -52
  198. package/dist/providers/provider.d.ts +0 -27
  199. package/dist/providers/resend/provider.d.ts +0 -7
  200. package/dist/providers/resend/types.d.ts +0 -43
  201. package/dist/providers/roundrobin/provider.d.ts +0 -7
  202. package/dist/providers/roundrobin/types.d.ts +0 -19
  203. package/dist/providers/scaleway/provider.d.ts +0 -7
  204. package/dist/providers/scaleway/types.d.ts +0 -36
  205. package/dist/providers/sendgrid/provider.d.ts +0 -7
  206. package/dist/providers/sendgrid/types.d.ts +0 -76
  207. package/dist/providers/smtp/provider.d.ts +0 -7
  208. package/dist/providers/smtp/types.d.ts +0 -63
  209. package/dist/providers/sweego/provider.d.ts +0 -7
  210. package/dist/providers/sweego/types.d.ts +0 -32
  211. package/dist/providers/utils/address-formatter.d.ts +0 -139
  212. package/dist/providers/utils/attachment-processor.d.ts +0 -58
  213. package/dist/providers/utils/index.d.ts +0 -4
  214. package/dist/providers/utils/payload-builder.d.ts +0 -78
  215. package/dist/providers/utils/provider-base.d.ts +0 -69
  216. package/dist/providers/zeptomail/provider.d.ts +0 -7
  217. package/dist/providers/zeptomail/types.d.ts +0 -29
  218. package/dist/template-engines/types.d.ts +0 -8
  219. package/dist/types.d.ts +0 -203
  220. package/dist/utils/build-mime-message.d.ts +0 -8
  221. package/dist/utils/create-logger.d.ts +0 -16
  222. package/dist/utils/format-email-addresses.d.ts +0 -8
  223. package/dist/utils/generate-boundary.d.ts +0 -7
  224. package/dist/utils/generate-message-id.d.ts +0 -6
  225. package/dist/utils/headers-to-record.d.ts +0 -9
  226. package/dist/utils/is-port-available.d.ts +0 -9
  227. package/dist/utils/make-request.d.ts +0 -18
  228. package/dist/utils/retry.d.ts +0 -10
  229. package/dist/utils/sanitize-header.d.ts +0 -14
  230. package/dist/utils/to-base64.d.ts +0 -8
  231. package/dist/utils/validation/validate-email-options.d.ts +0 -8
@@ -1 +0,0 @@
1
- var k=Object.defineProperty;var w=(n,l)=>k(n,"name",{value:l,configurable:!0});import{createRequire as z}from"node:module";import u from"./EmailError-zm2ffVav.js";import v from"./RequiredOptionError-CevW3u2K.js";import{s as P}from"./generate-message-id-D4uA8gkj.js";import{i as j}from"./headers-to-record-Qo124ImV.js";import{m as h}from"./make-request-BDzF9W9D.js";import{c as _,P as B,u as T,h as S}from"./provider-base-Cmzx6BTO.js";import{d as C}from"./validate-email-options-DfJ7llf8.js";import{defineProvider as E}from"./defineProvider-B9rSklAJ.js";import{j as y,k as q}from"./address-formatter-Cm_E_ZMa.js";const $=z(import.meta.url),f=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,I=w(n=>{if(typeof f<"u"&&f.versions&&f.versions.node){const[l,t]=f.versions.node.split(".").map(Number);if(l>22||l===22&&t>=3||l===20&&t>=16)return f.getBuiltinModule(n)}return $(n)},"__cjs_getBuiltinModule"),{Buffer:p}=I("node:buffer"),s="azure",x=3e4,O=3,Q=E((n={})=>{if(!n.region)throw new v(s,"region");if(!n.connectionString&&!n.accessToken)throw new v(s,"connectionString or accessToken");const l=n.endpoint||`https://${n.region}.communication.azure.com`,t={debug:n.debug||!1,endpoint:l,region:n.region,retries:n.retries||O,timeout:n.timeout||x,...n.connectionString&&{connectionString:n.connectionString},...n.accessToken&&{accessToken:n.accessToken},...n.logger&&{logger:n.logger}},g=new B,o=_(s,n.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 u(s,"Email ID is required to retrieve email details"),success:!1};await g.ensureInitialized(()=>this.initialize(),s);const a={"Content-Type":"application/json"};if(t.accessToken)a.Authorization=`Bearer ${t.accessToken}`;else if(t.connectionString){const c=t.connectionString.match(/endpoint=([^;]+);accesskey=([^;]+)/);c&&(a.Authorization=`Bearer ${c[2]}`)}o.debug("Retrieving email details",{id:e});const r=await T(async()=>h(`${t.endpoint}/emails/${e}`,{headers:a,method:"GET",timeout:t.timeout}),t.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 u(s,`Failed to retrieve email: ${r.error instanceof Error?r.error.message:"Unknown error"}`,{cause:r.error}),success:!1})}catch(a){return{error:S(s,"retrieve email",a,o),success:!1}}},async initialize(){await g.ensureInitialized(async()=>{if(!await this.isAvailable())throw new u(s,"Azure Communication Services API not available or invalid credentials");o.debug("Provider initialized successfully")},s)},async isAvailable(){try{const e={"Content-Type":"application/json"};if(t.accessToken)e.Authorization=`Bearer ${t.accessToken}`;else if(t.connectionString){const c=t.connectionString.match(/endpoint=([^;]+);accesskey=([^;]+)/);if(c)e.Authorization=`Bearer ${c[2]}`;else return!1}else return!1;o.debug("Checking Azure Communication Services API availability");const a=await h(`${t.endpoint}/emails:send`,{headers:e,method:"POST",timeout:t.timeout},JSON.stringify({}));if(a.success)return!0;const r=a.data?.statusCode;return r===401||r===403?!1:r===400}catch(e){if(o.debug("Error checking availability:",e),e instanceof Error){const a=e.message;if(a.includes("401")||a.includes("403"))return!1}return!1}},name:s,options:t,async sendEmail(e){try{const a=C(e);if(a.length>0)return{error:new u(s,`Invalid email options: ${a.join(", ")}`),success:!1};await g.ensureInitialized(()=>this.initialize(),s);const r={content:{subject:e.subject},recipients:{to:y(e.to)},senderAddress:e.from.email};if(e.html&&(r.content.html=e.html),e.text&&(r.content.plainText=e.text),e.cc&&(r.recipients.cc=y(e.cc)),e.bcc&&(r.recipients.bcc=y(e.bcc)),e.replyTo&&(r.replyTo=q(e.replyTo).email),e.importance&&(r.importance=e.importance),e.headers){const i=j(e.headers);r.headers=i}e.attachments&&e.attachments.length>0&&(r.attachments=await Promise.all(e.attachments.map(async i=>{let d;if(i.content)if(typeof i.content=="string")d=p.from(i.content,"utf8").toString("base64");else if(i.content&&typeof i.content.then=="function"){const A=await i.content;d=p.from(A).toString("base64")}else d=i.content.toString("base64");else if(i.raw)d=typeof i.raw=="string"?p.from(i.raw,"utf8").toString("base64"):i.raw.toString("base64");else throw new u(s,`Attachment ${i.filename} has no content`);return{contentInBase64:d,contentType:i.contentType||"application/octet-stream",name:i.filename}}))),o.debug("Sending email via Azure Communication Services API",{subject:r.content.subject,to:r.recipients.to});const c={"Content-Type":"application/json"};if(t.accessToken)c.Authorization=`Bearer ${t.accessToken}`;else if(t.connectionString){const i=t.connectionString.match(/endpoint=([^;]+);accesskey=([^;]+)/);if(i)c.Authorization=`Bearer ${i[2]}`;else return{error:new u(s,"Invalid connection string format"),success:!1}}const m=await T(async()=>h(`${t.endpoint}/emails:send`,{headers:c,method:"POST",timeout:t.timeout},JSON.stringify(r)),t.retries);if(!m.success)return o.debug("API request failed when sending email",m.error),{error:m.error||new u(s,"Failed to send email"),success:!1};const b=m.data?.body?.messageId||P();return o.debug("Email sent successfully",{messageId:b}),{data:{messageId:b,provider:s,response:m.data,sent:!0,timestamp:new Date},success:!0}}catch(a){return{error:S(s,"send email",a,o),success:!1}}},async validateCredentials(){return this.isAvailable()}}});export{Q as default};
@@ -1,2 +0,0 @@
1
- var T=Object.defineProperty;var u=(e,o)=>T(e,"name",{value:o,configurable:!0});import C from"./EmailError-zm2ffVav.js";import p from"../utils/format-email-address.js";import{a as w}from"./generate-boundary-Cx8nXYS0.js";import{i as j}from"./headers-to-record-Qo124ImV.js";import{s as h,a as b}from"./sanitize-header-wWav-Scu.js";var x=Object.defineProperty,E=u((e,o)=>x(e,"name",{value:o,configurable:!0}),"m");const l=E(e=>Array.isArray(e)?e.map(o=>p(o)).join(", "):p(e),"formatEmailAddresses");var B=Object.defineProperty,M=u((e,o)=>B(e,"name",{value:o,configurable:!0}),"b");const d=globalThis.Buffer!==void 0,g=M(e=>{if(typeof e=="string"){if(d)return Buffer.from(e,"utf8").toString("base64");const t=new TextEncoder().encode(e);let r="";const s=8192;for(let a=0;a<t.length;a+=s){const f=t.subarray(a,Math.min(a+s,t.length));r+=String.fromCharCode.apply(void 0,f)}return btoa(r)}if(d&&e instanceof Buffer)return e.toString("base64");const o=e instanceof Uint8Array?e:new Uint8Array(e);if(d)return Buffer.from(o).toString("base64");let n="";const c=8192;for(let t=0;t<o.length;t+=c){const r=o.subarray(t,Math.min(t+c,o.length));n+=String.fromCharCode.apply(void 0,r)}return btoa(n)},"toBase64");var S=Object.defineProperty,A=u((e,o)=>S(e,"name",{value:o,configurable:!0}),"h");const O=globalThis.Buffer!==void 0,H=A(async e=>{const o=w(),n=[`From: ${p(e.from)}`,`To: ${l(e.to)}`];if(e.cc&&n.push(`Cc: ${l(e.cc)}`),e.bcc&&n.push(`Bcc: ${l(e.bcc)}`),e.replyTo&&n.push(`Reply-To: ${p(e.replyTo)}`),n.push(`Subject: ${h(e.subject)}`,"MIME-Version: 1.0"),e.headers){const c=j(e.headers);Object.entries(c).forEach(([t,r])=>{const s=b(t),a=h(r);n.push(`${s}: ${a}`)})}if(n.push(`Content-Type: multipart/mixed; boundary="${o}"`,""),e.text&&n.push(`--${o}`,"Content-Type: text/plain; charset=UTF-8","Content-Transfer-Encoding: 7bit","",e.text,""),e.html&&n.push(`--${o}`,"Content-Type: text/html; charset=UTF-8","Content-Transfer-Encoding: 7bit","",e.html,""),e.attachments&&e.attachments.length>0){const c=await Promise.all(e.attachments.map(async t=>{let r;if(t.raw!==void 0)r=t.raw;else{if(t.content===void 0)throw new C("attachment",`Attachment '${t.filename}' must have content, raw, or be resolved from path/href before building MIME message`);r=t.content instanceof Promise?await t.content:t.content}return{...t,resolvedContent:r}}));for(const t of c){n.push(`--${o}`);const r=t.contentType||"application/octet-stream",s=h(t.filename);n.push(`Content-Type: ${r}; name="${s}"`);const a=t.contentDisposition||"attachment";n.push(`Content-Disposition: ${a}; filename="${s}"`),t.cid&&n.push(`Content-ID: <${t.cid}>`),t.headers&&Object.entries(t.headers).forEach(([m,y])=>{const $=b(m),v=h(y);n.push(`${$}: ${v}`)});const f=t.encoding||"base64";n.push(`Content-Transfer-Encoding: ${f}`,"");const i=t.resolvedContent;if(f==="base64")n.push(g(i));else if(f==="7bit"||f==="8bit")if(typeof i=="string")n.push(i);else if(O&&i instanceof Buffer)n.push(i.toString("utf8"));else{const m=new TextDecoder;n.push(m.decode(i))}else n.push(g(i));n.push("")}}return n.push(`--${o}--`),n.join(`\r
2
- `)},"buildMimeMessage");export{H as z};
@@ -1 +0,0 @@
1
- var n=Object.defineProperty;var i=(e,r)=>n(e,"name",{value:r,configurable:!0});var o=Object.defineProperty,a=i((e,r)=>o(e,"name",{value:r,configurable:!0}),"i");const t=a(e=>e,"defineProvider");export{t as defineProvider};
@@ -1 +0,0 @@
1
- var o=Object.defineProperty;var a=(e,r)=>o(e,"name",{value:r,configurable:!0});import{B as l}from"./readFile-BlZxbhCU-C8bCdiA2.js";import i from"mime";var c=Object.defineProperty,t=a((e,r)=>c(e,"name",{value:r,configurable:!0}),"e");const s=t(e=>i.getType(e)||"application/octet-stream","detectMimeType"),d=t(e=>{const r=e.replaceAll(/[^a-z0-9]/gi,"-").replaceAll(/-+/g,"-").replaceAll(/^-|-$/g,"").toLowerCase(),n=Math.random().toString(36).slice(2,9);return`${r}-${n}@email`},"generateContentId"),g=t(async e=>l(e,{buffer:!0}),"readFileAsBuffer");export{s as detectMimeType,d as generateContentId,g as readFileAsBuffer};
@@ -1 +0,0 @@
1
- var w=Object.defineProperty;var b=(e,l)=>w(e,"name",{value:l,configurable:!0});import u from"./EmailError-zm2ffVav.js";import $ from"./RequiredOptionError-CevW3u2K.js";import{c as A}from"./create-logger-BiWdqFNg.js";import{s as E}from"./generate-message-id-D4uA8gkj.js";import{defineProvider as z}from"./defineProvider-B9rSklAJ.js";var P=Object.defineProperty,p=b((e,l)=>P(e,"name",{value:l,configurable:!0}),"v");const k=p(e=>typeof e=="function","isProviderFactory"),F=p(e=>e!==null&&typeof e=="object"&&"sendEmail"in e&&"initialize"in e&&"isAvailable"in e,"isProvider"),o="failover",C=z((e={})=>{if(!e.mailers||e.mailers.length===0)throw new $(o,"mailers");const l={debug:e.debug||!1,mailers:e.mailers,retryAfter:e.retryAfter??60};let h=!1;const t=[],s=A(o,e.logger);let g;const m=p(async()=>g||(g=(async()=>{t.length=0;for(const a of l.mailers)try{let r;if(k(a))r=a({});else if(F(a))r=a;else{s.debug(`Skipping invalid mailer: ${a}`);continue}try{await r.initialize(),t.push(r),s.debug(`Initialized provider: ${r.name||"unknown"}`)}catch(c){s.debug(`Failed to initialize provider ${r.name||"unknown"}:`,c)}}catch(r){s.debug("Error processing mailer:",r)}if(t.length===0)throw new u(o,"No providers could be initialized")})(),g),"initializeProviders");return{features:{attachments:!0,batchSending:!1,customHeaders:!0,html:!0,replyTo:!0,scheduling:!1,tagging:!1,templates:!1,tracking:!1},async initialize(){if(!h)try{await m(),h=!0,s.debug(`Failover provider initialized with ${t.length} provider(s)`)}catch(a){throw new u(o,`Failed to initialize: ${a.message}`,{cause:a})}},async isAvailable(){try{t.length===0&&await m();for(const a of t)try{if(await a.isAvailable())return!0}catch{}return!1}catch{return!1}},name:o,options:l,async sendEmail(a){try{if(t.length===0&&await m(),t.length===0)return{error:new u(o,"No providers available"),success:!1};const r=[];let c;for(let n=0;n<t.length;n+=1){const f=t[n];if(!f)continue;const d=f.name||`provider-${n+1}`;s.debug(`Attempting to send email via ${d} (${n+1}/${t.length})`);try{if(!await f.isAvailable()){s.debug(`Provider ${d} is not available, skipping`),r.push(new u(o,`Provider ${d} is not available`));continue}const i=await f.sendEmail(a);if(i.success&&i.data)return s.debug(`Email sent successfully via ${d}`),{data:{...i.data,messageId:i.data.messageId||E(),provider:`${o}(${d})`},success:!0};if(i.error){c=i.error,r.push(i.error);const v=i.error instanceof Error?i.error.message:String(i.error);s.debug(`Failed to send via ${d}:`,v)}}catch(i){c=i instanceof Error?i:new Error(String(i)),r.push(c);const v=c instanceof Error?c.message:String(c);s.debug(`Exception sending via ${d}:`,v)}n<t.length-1&&l.retryAfter>0&&(s.debug(`Waiting ${l.retryAfter}ms before trying next provider`),await new Promise(i=>{setTimeout(()=>{i()},l.retryAfter)}))}const y=r.map(n=>n instanceof Error?n.message:String(n)).join("; ");return{error:new u(o,`All providers failed. Errors: ${y}`,{cause:c}),success:!1}}catch(r){return{error:new u(o,`Failed to send email: ${r.message}`,{cause:r}),success:!1}}},async validateCredentials(){return this.isAvailable()}}});export{C as default};
@@ -1 +0,0 @@
1
- var v=Object.defineProperty;var p=(r,a)=>v(r,"name",{value:a,configurable:!0});import d from"./EmailError-zm2ffVav.js";import A from"./RequiredOptionError-CevW3u2K.js";import{s as j}from"./generate-message-id-D4uA8gkj.js";import{m as u}from"./make-request-BDzF9W9D.js";import{d as O}from"./validate-email-options-DfJ7llf8.js";import{defineProvider as P}from"./defineProvider-B9rSklAJ.js";var C=Object.defineProperty,h=p((r,a)=>C(r,"name",{value:a,configurable:!0}),"f");const n="http",I="POST",f=3e4,z=P((r={})=>{if(!r.endpoint)throw new A(n,"endpoint");const a={apiKey:r.apiKey||"",endpoint:r.endpoint,headers:r.headers||{},method:r.method||I},m=h(()=>{const e={"Content-Type":"application/json",...a.headers};return a.apiKey&&(e.Authorization=`Bearer ${a.apiKey}`),e},"getStandardHeaders"),y=h(e=>{const t={from:e.from.email,from_name:e.from.name,html:e.html,subject:e.subject,text:e.text,to:Array.isArray(e.to)?e.to.map(s=>s.email):e.to.email};return e.cc&&(t.cc=Array.isArray(e.cc)?e.cc.map(s=>s.email):e.cc.email),e.bcc&&(t.bcc=Array.isArray(e.bcc)?e.bcc.map(s=>s.email):e.bcc.email),e.customParams&&Object.assign(t,e.customParams),t},"formatRequest");let l=!1;return{features:{attachments:!1,batchSending:!1,customHeaders:!0,html:!0,replyTo:!1,scheduling:!1,tagging:!1,templates:!1,tracking:!1},async initialize(){if(!l){if(!await this.isAvailable())throw new d(n,"API endpoint not available");l=!0}},async isAvailable(){try{return!!(await u(a.endpoint,{headers:m(),method:"OPTIONS",timeout:f})).success}catch(e){if(e instanceof Error){const t=e.message;if(t.includes("401")||t.includes("403"))return!1}return!1}},name:n,options:a,async sendEmail(e){try{const t=O(e);if(t.length>0)return{error:new d(n,`Invalid email options: ${t.join(", ")}`),success:!1};l||await this.initialize();const s=m();e.headers&&Object.assign(s,e.headers);const b=y(e),g=e.endpointOverride||a.endpoint,w=e.methodOverride||a.method,o=await u(g,{headers:s,method:w,timeout:f},JSON.stringify(b));if(!o.success)return{error:new d(n,`Failed to send email: ${o.error?.message||"Unknown error"}`,{cause:o.error}),success:!1};let c;const i=o.data?.body;return i&&typeof i=="object"&&(c=i.id||i.messageId||i.data&&typeof i.data=="object"&&(i.data.id||i.data.messageId)),c||(c=j()),{data:{messageId:c,provider:n,response:o.data?.body,sent:!0,timestamp:new Date},success:!0}}catch(t){return{error:new d(n,`Failed to send email: ${t.message}`,{cause:t}),success:!1}}},async validateCredentials(){try{const e=await u(a.endpoint,{headers:m(),method:"GET",timeout:f});return!!(e.data&&typeof e.data=="object"&&"statusCode"in e.data&&typeof e.data.statusCode=="number"&&e.data.statusCode>=200&&e.data.statusCode<300)}catch{return!1}}}});export{z as default};
@@ -1 +0,0 @@
1
- import c from"./EmailError-zm2ffVav.js";import P from"./RequiredOptionError-CevW3u2K.js";import{s as I}from"./generate-message-id-D4uA8gkj.js";import{i as T}from"./headers-to-record-Qo124ImV.js";import{m as d}from"./make-request-BDzF9W9D.js";import{c as A,P as k,u as g,h as f}from"./provider-base-Cmzx6BTO.js";import{s as $,a as z}from"./sanitize-header-wWav-Scu.js";import{d as E}from"./validate-email-options-DfJ7llf8.js";import{defineProvider as j}from"./defineProvider-B9rSklAJ.js";import{n as u,c as h}from"./address-formatter-Cm_E_ZMa.js";const r="mailpace",C="https://app.mailpace.com/api/v1",M=3e4,S=3,G=j(((n={})=>{if(!n.apiToken)throw new P(r,"apiToken");const s={apiToken:n.apiToken,debug:n.debug||!1,endpoint:n.endpoint||C,retries:n.retries||S,timeout:n.timeout||M,...n.logger&&{logger:n.logger}},l=new k,i=A(r,n.logger);return{features:{attachments:!0,batchSending:!1,customHeaders:!0,html:!0,replyTo:!0,scheduling:!1,tagging:!0,templates:!0,tracking:!1},async getEmail(e){try{if(!e)return{error:new c(r,"Email ID is required to retrieve email details"),success:!1};await l.ensureInitialized(()=>this.initialize(),r);const a={Authorization:`Bearer ${s.apiToken}`,"Content-Type":"application/json"};i.debug("Retrieving email details",{id:e});const t=await g(async()=>d(`${s.endpoint}/emails/${e}`,{headers:a,method:"GET",timeout:s.timeout}),s.retries);return t.success?(i.debug("Email details retrieved successfully"),{data:t.data?.body,success:!0}):(i.debug("API request failed when retrieving email",t.error),{error:new c(r,`Failed to retrieve email: ${t.error instanceof Error?t.error.message:"Unknown error"}`,{cause:t.error}),success:!1})}catch(a){return{error:f(r,"retrieve email",a,i),success:!1}}},async initialize(){await l.ensureInitialized(async()=>{if(!await this.isAvailable())throw new c(r,"MailPace API not available or invalid API token");i.debug("Provider initialized successfully")},r)},async isAvailable(){try{const e={Authorization:`Bearer ${s.apiToken}`,"Content-Type":"application/json"};i.debug("Checking MailPace API availability");const a=await d(`${s.endpoint}/account`,{headers:e,method:"GET",timeout:s.timeout});return i.debug("MailPace API availability check response:",{error:a.error instanceof Error?a.error.message:void 0,statusCode:a.data?.statusCode,success:a.success}),!!(a.success&&a.data&&typeof a.data=="object"&&"statusCode"in a.data&&typeof a.data.statusCode=="number"&&a.data.statusCode>=200&&a.data.statusCode<300)}catch(e){return i.debug("Error checking availability:",e),!1}},name:r,options:s,async sendEmail(e){try{const a=E(e);if(a.length>0)return{error:new c(r,`Invalid email options: ${a.join(", ")}`),success:!1};await l.ensureInitialized(()=>this.initialize(),r);const t={from:h(e.from),subject:e.subject,to:u(e.to)};if(e.html&&(t.htmlbody=e.html),e.text&&(t.textbody=e.text),e.cc&&(t.cc=u(e.cc)),e.bcc&&(t.bcc=u(e.bcc)),e.replyTo&&(t.replyto=h(e.replyTo)),e.templateId&&(t.template_id=e.templateId,e.templateVariables&&(t.template_variables=e.templateVariables)),e.tags&&e.tags.length>0&&(t.tags=e.tags),e.listUnsubscribe&&(t.list_unsubscribe=e.listUnsubscribe),e.headers){const y=T(e.headers),p={};Object.entries(y).forEach(([v,w])=>{p[z(v)]=$(w)}),t.headers=p}e.attachments&&e.attachments.length>0&&(t.attachments=e.attachments),i.debug("Sending email via MailPace API",{subject:t.subject,to:t.to});const b={Authorization:`Bearer ${s.apiToken}`,"Content-Type":"application/json"},o=await g(async()=>d(`${s.endpoint}/send`,{headers:b,method:"POST",timeout:s.timeout},JSON.stringify(t)),s.retries);if(!o.success)return i.debug("API request failed when sending email",o.error),{error:o.error||new c(r,"Failed to send email"),success:!1};const m=o.data?.body?.id||I();return i.debug("Email sent successfully",{messageId:m}),{data:{messageId:m,provider:r,response:o.data,sent:!0,timestamp:new Date},success:!0}}catch(a){return{error:f(r,"send email",a,i),success:!1}}},async validateCredentials(){return this.isAvailable()}}}));export{G as default};
@@ -1 +0,0 @@
1
- var I=Object.defineProperty;var y=(r,i)=>I(r,"name",{value:i,configurable:!0});import{createRequire as A}from"node:module";import m from"./EmailError-zm2ffVav.js";import T from"./RequiredOptionError-CevW3u2K.js";import{s as R}from"./generate-message-id-D4uA8gkj.js";import{i as S}from"./headers-to-record-Qo124ImV.js";import{m as h}from"./make-request-BDzF9W9D.js";import{c as _,P as z,u as $,h as j}from"./provider-base-Cmzx6BTO.js";import{d as E}from"./validate-email-options-DfJ7llf8.js";import{defineProvider as q}from"./defineProvider-B9rSklAJ.js";import{a as U}from"./attachment-processor-2rHmfa7j.js";import{b as v,c as k}from"./address-formatter-Cm_E_ZMa.js";const P=A(import.meta.url),u=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,C=y(r=>{if(typeof u<"u"&&u.versions&&u.versions.node){const[i,n]=u.versions.node.split(".").map(Number);if(i>22||i===22&&n>=3||i===20&&n>=16)return u.getBuiltinModule(r)}return P(r)},"__cjs_getBuiltinModule"),{Buffer:b}=C("node:buffer");var M=Object.defineProperty,K=y((r,i)=>M(r,"name",{value:i,configurable:!0}),"k");const o="mailgun",B="https://api.mailgun.net",O=3e4,x=3,D=K(r=>{const i=[];for(const[n,a]of Object.entries(r))if(a!=null)if(Array.isArray(a))for(const e of a)i.push(`${encodeURIComponent(n)}=${encodeURIComponent(String(e))}`);else typeof a=="object"?i.push(`${encodeURIComponent(n)}=${encodeURIComponent(JSON.stringify(a))}`):i.push(`${encodeURIComponent(n)}=${encodeURIComponent(String(a))}`);return i.join("&")},"objectToFormData"),ee=q((r={})=>{if(!r.apiKey)throw new T(o,"apiKey");if(!r.domain)throw new T(o,"domain");const i={apiKey:r.apiKey,debug:r.debug||!1,domain:r.domain,endpoint:r.endpoint||B,retries:r.retries||x,timeout:r.timeout||O,...r.logger&&{logger:r.logger}},n=new z,a=_(o,r.logger);return{endpoint:i.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 m(o,"Email ID is required to retrieve email details"),success:!1};await n.ensureInitialized(()=>this.initialize(),o);const s={Authorization:`Basic ${b.from(`api:${i.apiKey}`).toString("base64")}`,"Content-Type":"application/json"};a.debug("Retrieving email details",{id:e});const t=await $(async()=>h(`${i.endpoint}/v3/${i.domain}/events?message-id=${encodeURIComponent(e)}&limit=1`,{headers:s,method:"GET",timeout:i.timeout}),i.retries);if(!t.success)return a.debug("API request failed when retrieving email",t.error),{error:new m(o,`Failed to retrieve email: ${t.error instanceof Error?t.error.message:"Unknown error"}`,{cause:t.error}),success:!1};a.debug("Email details retrieved successfully");const p=t.data?.items||[],g=p.length>0?p[0]:void 0;return{data:g?.message?.headers||g?.storage||void 0,success:!0}}catch(s){return{error:j(o,"retrieve email",s,a),success:!1}}},async initialize(){await n.ensureInitialized(async()=>{if(!await this.isAvailable())throw new m(o,"Mailgun API not available or invalid API key/domain");a.debug("Provider initialized successfully")},o)},async isAvailable(){try{const e={Authorization:`Basic ${b.from(`api:${i.apiKey}`).toString("base64")}`,"Content-Type":"application/json"};a.debug("Checking Mailgun API availability");const s=await h(`${i.endpoint}/v3/domains/${i.domain}`,{headers:e,method:"GET",timeout:i.timeout});if(a.debug("Mailgun API availability check response:",{error:s.error instanceof Error?s.error.message:void 0,statusCode:s.data?.statusCode,success:s.success}),!s.success||!s.data||typeof s.data!="object")return!1;const{statusCode:t}=s.data;return typeof t=="number"&&t>=200&&t<300}catch(e){return a.debug("Error checking availability:",e),!1}},name:o,options:i,async sendEmail(e){try{const s=E(e);if(s.length>0)return{error:new m(o,`Invalid email options: ${s.join(", ")}`),success:!1};await n.ensureInitialized(()=>this.initialize(),o);const t={from:k(e.from),to:v(e.to).join(",")};if(e.subject&&(t.subject=e.subject),e.cc&&(t.cc=v(e.cc).join(",")),e.bcc&&(t.bcc=v(e.bcc).join(",")),e.replyTo&&(t["h:Reply-To"]=k(e.replyTo)),e.html&&(t.html=e.html),e.text&&(t.text=e.text),e.template&&(t.template=e.template,e.templateVariables))for(const[d,c]of Object.entries(e.templateVariables))t[`v:${d}`]=c;if(e.tags&&e.tags.length>0&&(t["o:tag"]=e.tags),e.campaignId&&(t["o:campaign"]=e.campaignId),e.deliveryTime&&(t["o:deliverytime"]=typeof e.deliveryTime=="number"?new Date(e.deliveryTime*1e3).toUTCString():e.deliveryTime),e.clickTracking!==void 0&&(t["o:clicktracking"]=e.clickTracking?"yes":"no"),e.openTracking!==void 0&&(t["o:tracking"]=e.openTracking?"yes":"no"),e.unsubscribeTracking!==void 0&&(t["o:tracking-clicks"]=e.unsubscribeTracking?"yes":"no"),e.testMode&&(t["o:testmode"]="yes"),e.requireTls&&(t["o:require-tls"]="yes"),e.skipVerification&&(t["o:skip-verification"]="yes"),e.headers){const d=S(e.headers);for(const[c,f]of Object.entries(d))t[`h:${c}`]=f}if(e.attachments&&e.attachments.length>0){const d=await Promise.all(e.attachments.map((c,f)=>U(c,o,f)));for(const c of d)t[c.key]=c.content}a.debug("Sending email via Mailgun API",{subject:t.subject,to:t.to});const p={Authorization:`Basic ${b.from(`api:${i.apiKey}`).toString("base64")}`,"Content-Type":"application/x-www-form-urlencoded"},g=D(t),l=await $(async()=>h(`${i.endpoint}/v3/${i.domain}/messages`,{headers:p,method:"POST",timeout:i.timeout},g),i.retries);if(!l.success)return a.debug("API request failed when sending email",l.error),{error:l.error||new m(o,"Failed to send email"),success:!1};const w=l.data?.body?.id||R();return a.debug("Email sent successfully",{messageId:w}),{data:{messageId:w,provider:o,response:l.data,sent:!0,timestamp:new Date},success:!0}}catch(s){return{error:j(o,"send email",s,a),success:!1}}},async validateCredentials(){return this.isAvailable()}}});export{ee as default};
@@ -1 +0,0 @@
1
- var P=Object.defineProperty;var b=(s,a)=>P(s,"name",{value:a,configurable:!0});import{createRequire as $}from"node:module";import d from"./EmailError-zm2ffVav.js";import v from"./RequiredOptionError-CevW3u2K.js";import{s as M}from"./generate-message-id-D4uA8gkj.js";import{i as _}from"./headers-to-record-Qo124ImV.js";import{m as f}from"./make-request-BDzF9W9D.js";import{c as z,P as D,u as w,h as T}from"./provider-base-Cmzx6BTO.js";import{d as B}from"./validate-email-options-DfJ7llf8.js";import{defineProvider as R}from"./defineProvider-B9rSklAJ.js";import{d as y,e as S}from"./address-formatter-Cm_E_ZMa.js";const A=$(import.meta.url),m=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,E=b(s=>{if(typeof m<"u"&&m.versions&&m.versions.node){const[a,l]=m.versions.node.split(".").map(Number);if(a>22||a===22&&l>=3||a===20&&l>=16)return m.getBuiltinModule(s)}return A(s)},"__cjs_getBuiltinModule"),{Buffer:p}=E("node:buffer"),n="mailjet",k="https://api.mailjet.com",q=3e4,K=3,W=R(((s={})=>{if(!s.apiKey)throw new v(n,"apiKey");if(!s.apiSecret)throw new v(n,"apiSecret");const a={apiKey:s.apiKey,apiSecret:s.apiSecret,debug:s.debug||!1,endpoint:s.endpoint||k,retries:s.retries||K,timeout:s.timeout||q,...s.logger&&{logger:s.logger}},l=new D,o=z(n,s.logger);return{endpoint:a.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 d(n,"Email ID is required to retrieve email details"),success:!1};await l.ensureInitialized(()=>this.initialize(),n);const i={Authorization:`Basic ${p.from(`${a.apiKey}:${a.apiSecret}`).toString("base64")}`,"Content-Type":"application/json"};o.debug("Retrieving email details",{id:e});const t=await w(async()=>f(`${a.endpoint}/v3.1/REST/message/${e}`,{headers:i,method:"GET",timeout:a.timeout}),a.retries);return t.success?(o.debug("Email details retrieved successfully"),{data:t.data?.body,success:!0}):(o.debug("API request failed when retrieving email",t.error),{error:new d(n,`Failed to retrieve email: ${t.error instanceof Error?t.error.message:"Unknown error"}`,{cause:t.error}),success:!1})}catch(i){return{error:T(n,"retrieve email",i,o),success:!1}}},async initialize(){await l.ensureInitialized(async()=>{if(!await this.isAvailable())throw new d(n,"Mailjet API not available or invalid API credentials");o.debug("Provider initialized successfully")},n)},async isAvailable(){try{const e={Authorization:`Basic ${p.from(`${a.apiKey}:${a.apiSecret}`).toString("base64")}`,"Content-Type":"application/json"};o.debug("Checking Mailjet API availability");const i=await f(`${a.endpoint}/v3.1/REST/user`,{headers:e,method:"GET",timeout:a.timeout});return o.debug("Mailjet API availability check response:",{error:i.error instanceof Error?i.error.message:void 0,statusCode:i.data?.statusCode,success:i.success}),!!(i.success&&i.data&&typeof i.data=="object"&&"statusCode"in i.data&&typeof i.data.statusCode=="number"&&i.data.statusCode>=200&&i.data.statusCode<300)}catch(e){return o.debug("Error checking availability:",e),!1}},name:n,options:a,async sendEmail(e){try{const i=B(e);if(i.length>0)return{error:new d(n,`Invalid email options: ${i.join(", ")}`),success:!1};await l.ensureInitialized(()=>this.initialize(),n);const t={From:S(e.from),Subject:e.subject,To:y(e.to)};if(e.html&&(t.HTMLPart=e.html),e.text&&(t.TextPart=e.text),e.cc&&(t.Cc=y(e.cc)),e.bcc&&(t.Bcc=y(e.bcc)),e.replyTo&&(t.ReplyTo=S(e.replyTo)),e.templateId&&(t.TemplateID=e.templateId,t.TemplateLanguage=e.templateLanguage??!0,e.templateVariables&&(t.Variables=e.templateVariables)),e.customId&&(t.CustomID=e.customId),e.eventPayload&&(t.EventPayload=e.eventPayload),e.campaign&&(t.Campaign=e.campaign),e.deduplicateCampaign!==void 0&&(t.DeduplicateCampaign=e.deduplicateCampaign),e.deliveryTime&&(t.Deliverytime=new Date(e.deliveryTime*1e3).toISOString()),e.priority!==void 0&&(t.Priority=e.priority),e.urlTags&&(t.URLTags=e.urlTags),e.tags&&e.tags.length>0&&(t.CustomCampaign=e.tags.join(",")),e.headers){const r=_(e.headers),c=[];for(const[g,I]of Object.entries(r))c.push({Name:g,Value:String(I)});c.length>0&&(t.Headers=c)}e.attachments&&e.attachments.length>0&&(t.Attachments=await Promise.all(e.attachments.map(async r=>{let c;if(r.content)if(typeof r.content=="string")c=r.content;else if(r.content instanceof Promise){const g=await r.content;c=p.from(g).toString("base64")}else c=r.content.toString("base64");else if(r.raw)c=typeof r.raw=="string"?r.raw:r.raw.toString("base64");else throw new d(n,`Attachment ${r.filename} has no content`);return{Base64Content:c,ContentType:r.contentType||"application/octet-stream",Filename:r.filename,...r.cid&&{ContentID:r.cid}}})));const j={Messages:[t]};o.debug("Sending email via Mailjet API",{subject:t.Subject,to:t.To});const C={Authorization:`Basic ${p.from(`${a.apiKey}:${a.apiSecret}`).toString("base64")}`,"Content-Type":"application/json"},u=await w(async()=>f(`${a.endpoint}/v3.1/send`,{headers:C,method:"POST",timeout:a.timeout},JSON.stringify(j)),a.retries);if(!u.success)return o.debug("API request failed when sending email",u.error),{error:u.error||new d(n,"Failed to send email"),success:!1};const h=u.data?.body?.Messages?.[0]?.To?.[0]?.MessageID?.toString()||M();return o.debug("Email sent successfully",{messageId:h}),{data:{messageId:h,provider:n,response:u.data,sent:!0,timestamp:new Date},success:!0}}catch(i){return{error:T(n,"send email",i,o),success:!1}}},async validateCredentials(){return this.isAvailable()}}}));export{W as default};
@@ -1 +0,0 @@
1
- var S=Object.defineProperty;var v=(m,l)=>S(m,"name",{value:l,configurable:!0});import c from"./EmailError-zm2ffVav.js";import{c as I}from"./create-logger-BiWdqFNg.js";import{s as D}from"./generate-message-id-D4uA8gkj.js";import{d as $}from"./validate-email-options-DfJ7llf8.js";import{defineProvider as A}from"./defineProvider-B9rSklAJ.js";var F=Object.defineProperty,k=v((m,l)=>F(m,"name",{value:l,configurable:!0}),"k");const u="mock",p=new Map,M=k(()=>({debug:!1,delay:0,failureRate:0,randomDelayRange:{max:0,min:0},retries:0,simulateFailure:!1,timeout:0}),"createDefaultConfig"),L=A((m={})=>{const l=`mock-${Date.now()}-${Math.random().toString(36).slice(2,9)}`;p.has(l)||p.set(l,[]);const a=p.get(l);if(!a)throw new Error(`Storage not found for instance: ${l}`);let y=!1,f;const s={...M(),defaultResponse:m.defaultResponse,logger:m.logger,randomDelayRange:m.randomDelayRange||{max:0,min:0},...m},r=I(u,s.logger);return{clearSentMessages(){a.length=0,r.debug("Cleared all sent messages")},features:{attachments:!0,batchSending:!0,customHeaders:!0,html:!0,replyTo:!0,scheduling:!1,tagging:!0,templates:!1,tracking:!1},findMessageBy(e){return a.find(t=>e(t))},findMessagesBy(e){return a.filter(t=>e(t))},async getEmail(e){try{if(!e)return{error:new c(u,"Email ID is required to retrieve email details"),success:!1};const t=a.find(o=>o.id===e);return t?(r.debug("Retrieved email",{id:e}),{data:t,success:!0}):{error:new c(u,`Email with ID ${e} not found`),success:!1}}catch(t){return r.debug("Exception retrieving email",t),{error:new c(u,`Failed to retrieve email: ${t.message}`,{cause:t}),success:!1}}},getInstance(){return a},getLastSentMessage(){return a[a.length-1]},getMessagesBySubject(e){return a.filter(t=>t.options.subject===e)},getMessagesTo(e){return a.filter(t=>{const o=Array.isArray(t.options.to)?t.options.to:[t.options.to];let i=[];t.options.cc&&(i=Array.isArray(t.options.cc)?t.options.cc:[t.options.cc]);let d=[];return t.options.bcc&&(d=Array.isArray(t.options.bcc)?t.options.bcc:[t.options.bcc]),[...o,...i,...d].some(w=>w.email===e)})},getSentEmails(){return[...a]},getSentMessages(){return[...a]},getSentMessagesCount(){return a.length},async initialize(){y||(s.delay>0&&await new Promise(e=>{setTimeout(e,s.delay)}),y=!0,r.debug("Mock provider initialized"))},async isAvailable(){return!0},name:u,options:s,reset(){a.length=0,f=void 0;const e=M();s.debug=e.debug,s.delay=e.delay,s.failureRate=e.failureRate,s.retries=e.retries,s.simulateFailure=e.simulateFailure,s.timeout=e.timeout,s.randomDelayRange={max:0,min:0},s.defaultResponse=void 0,r.debug("Mock provider reset to initial state")},async sendEmail(e){try{const t=$(e);if(t.length>0)return{error:new c(u,`Invalid email options: ${t.join(", ")}`),success:!1};y||await this.initialize();let o=s.delay;if(s.randomDelayRange&&s.randomDelayRange.max>0){const{max:n,min:g}=s.randomDelayRange;o=Math.floor(Math.random()*(n-g+1))+g}if(o>0&&await new Promise(n=>{setTimeout(n,o)}),f!==void 0){const n=f;if(f=void 0,!n.successful)return r.debug("Using next response (failure)",n),{error:new c(u,n.errorMessages.join(", ")),success:!1};const g=n.messageId||D(),b=n.timestamp||new Date,h={messageId:g,provider:n.provider||u,response:n.response,sent:!0,timestamp:b},E={id:g,options:e,result:h,timestamp:b};return a.push(E),r.debug("Email stored using next response",{messageId:g}),{data:h,success:!0}}if(s.simulateFailure||s.failureRate>0&&Math.random()<s.failureRate)return r.debug("Simulating email send failure"),{error:new c(u,"Simulated failure"),success:!1};const i=s.defaultResponse?.successful?s.defaultResponse.messageId:D(),d=s.defaultResponse?.successful&&s.defaultResponse.timestamp?s.defaultResponse.timestamp:new Date,w=s.defaultResponse&&"response"in s.defaultResponse?s.defaultResponse.response:void 0,R={messageId:i,provider:u,response:w??{mock:!0,stored:!0},sent:!0,timestamp:d},x={id:i,options:e,result:R,timestamp:d};return a.push(x),r.debug("Email stored in mock provider",{messageId:i,subject:e.subject,to:Array.isArray(e.to)?e.to.map(n=>n.email):e.to.email}),{data:R,success:!0}}catch(t){return r.debug("Exception sending email",t),{error:new c(u,`Failed to send email: ${t.message}`,{cause:t}),success:!1}}},setDefaultResponse(e){s.defaultResponse=e,r.debug("Set default response",{receipt:e})},setDelay(e){if(e<0)throw new RangeError("Delay must be non-negative");s.delay=e,s.randomDelayRange={max:0,min:0},r.debug("Set fixed delay",{milliseconds:e})},setFailureRate(e){if(e<0||e>1)throw new RangeError("Failure rate must be between 0.0 and 1.0");s.failureRate=e,r.debug("Set failure rate",{rate:e})},setNextResponse(e){f=e,r.debug("Set next response",{receipt:e})},setRandomDelay(e,t){if(e<0||t<0||e>t)throw new RangeError("Invalid delay range");s.delay=0,s.randomDelayRange={max:t,min:e},r.debug("Set random delay range",{max:t,min:e})},async shutdown(){a.length=0,p.delete(l),r.debug("Mock provider shutdown")},async validateCredentials(){return!0},async waitForMessage(e,t=5e3){const o=Date.now();for(;;){const i=a.find(d=>e(d));if(i)return i;if(Date.now()-o>t)throw new Error("Timeout waiting for message");await new Promise(d=>{setTimeout(d,10)})}},async waitForMessageCount(e,t=5e3){const o=Date.now();for(;a.length<e;){if(Date.now()-o>t)throw new Error(`Timeout waiting for ${e} messages (got ${a.length})`);await new Promise(i=>{setTimeout(i,10)})}}}});export{L as default};
@@ -1 +0,0 @@
1
- var vr=Object.defineProperty;var $=(e,n)=>vr(e,"name",{value:n,configurable:!0});import{createRequire as $r}from"node:module";const wr=$r(import.meta.url),C=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,yr=$(e=>{if(typeof C<"u"&&C.versions&&C.versions.node){const[n,i]=C.versions.node.split(".").map(Number);if(n>22||n===22&&i>=3||n===20&&i>=16)return C.getBuiltinModule(e)}return wr(e)},"__cjs_getBuiltinModule"),{createRequire:ne}=yr("node:module"),jr=0,zr=4;var Or=Object.defineProperty,Pr=$((e,n)=>Or(e,"name",{value:n,configurable:!0}),"t$2"),Mr=Object.defineProperty,_r=Pr((e,n)=>Mr(e,"name",{value:n,configurable:!0}),"t"),Er=Object.defineProperty,kr=_r((e,n)=>Er(e,"name",{value:n,configurable:!0}),"n");const Be=kr(e=>{if(!e||!(e instanceof URL)&&typeof e!="string")throw new TypeError("Path must be a non-empty string or URL.")},"assertValidFileOrDirectoryPath");var Ar=Object.defineProperty,Rr=$((e,n)=>Ar(e,"name",{value:n,configurable:!0}),"$e"),Br=Object.defineProperty,oe=Rr((e,n)=>Br(e,"name",{value:n,configurable:!0}),"W"),Tr=Object.defineProperty,u=oe((e,n)=>Tr(e,"name",{value:n,configurable:!0}),"u$1");let _e=u(()=>{var e=(()=>{var n=Object.defineProperty,i=Object.getOwnPropertyDescriptor,c=Object.getOwnPropertyNames,d=Object.prototype.hasOwnProperty,b=u((t,r)=>{for(var o in r)n(t,o,{get:r[o],enumerable:!0})},"ne"),w=u((t,r,o,a)=>{if(r&&typeof r=="object"||typeof r=="function")for(let s of c(r))!d.call(t,s)&&s!==o&&n(t,s,{get:u(()=>r[s],"get"),enumerable:!(a=i(r,s))||a.enumerable});return t},"ae"),x=u(t=>w(n({},"__esModule",{value:!0}),t),"oe"),E={};b(E,{zeptomatch:u(()=>Me,"zeptomatch")});var T=u(t=>{const r=new Set,o=[t];for(let a=0;a<o.length;a++){const s=o[a];if(r.has(s))continue;r.add(s);const{children:l}=s;if(l?.length)for(let f=0,g=l.length;f<g;f++)o.push(l[f])}return Array.from(r)},"M"),D=u(t=>{let r="";const o=T(t);for(let a=0,s=o.length;a<s;a++){const l=o[a];if(!l.regex)continue;const f=l.regex.flags;if(r||(r=f),r!==f)throw new Error(`Inconsistent RegExp flags used: "${r}" and "${f}"`)}return r},"se"),ue=u((t,r,o)=>{const a=o.get(t);if(a!==void 0)return a;const s=t.partial??r;let l="";if(t.regex&&(l+=s?"(?:$|":"",l+=t.regex.source),t.children?.length){const f=Ye(t.children.map(g=>ue(g,r,o)).filter(Boolean));if(f?.length){const g=t.children.some(q=>!q.regex||!(q.partial??r)),h=f.length>1||s&&(!l.length||g);l+=h?s?"(?:$|":"(?:":"",l+=f.join("|"),l+=h?")":""}}return t.regex&&(l+=s?")":""),o.set(t,l),l},"O"),Ve=u((t,r)=>{const o=new Map,a=T(t);for(let s=a.length-1;s>=0;s--){const l=ue(a[s],r,o);if(!(s>0))return l}return""},"ie"),Ye=u(t=>Array.from(new Set(t)),"ue"),H=u((t,r,o)=>H.compile(t,o).test(r),"R");H.compile=(t,r)=>{const o=r?.partial??!1,a=Ve(t,o),s=D(t);return new RegExp(`^(?:${a})$`,s)};var He=H,Je=u((t,r)=>{const o=He.compile(t,r),a=`${o.source.slice(0,-1)}[\\\\/]?$`,s=o.flags;return new RegExp(a,s)},"le"),Ke=Je,Qe=u(t=>{const r=t.map(a=>a.source).join("|")||"$^",o=t[0]?.flags;return new RegExp(r,o)},"ve"),Xe=Qe,ce=u(t=>Array.isArray(t),"j"),S=u(t=>typeof t=="function","_"),et=u(t=>t.length===0,"he"),tt=(()=>{const{toString:t}=Function.prototype,r=/(?:^\(\s*(?:[^,.()]|\.(?!\.\.))*\s*\)\s*=>|^\s*[a-zA-Z$_][a-zA-Z0-9$_]*\s*=>)/;return o=>(o.length===0||o.length===1)&&r.test(t.call(o))})(),rt=u(t=>typeof t=="number","de"),nt=u(t=>typeof t=="object"&&t!==null,"xe"),ot=u(t=>t instanceof RegExp,"me"),st=(()=>{const t=/\\\(|\((?!\?(?::|=|!|<=|<!))/;return r=>t.test(r.source)})(),at=(()=>{const t=/^[a-zA-Z0-9_-]+$/;return r=>t.test(r.source)&&!r.flags.includes("i")})(),fe=u(t=>typeof t=="string","A"),P=u(t=>t===void 0,"f"),it=u(t=>{const r=new Map;return o=>{const a=r.get(o);if(a!==void 0)return a;const s=t(o);return r.set(o,s),s}},"ye"),pe=u((t,r,o={})=>{const a={cache:{},input:t,index:0,indexBacktrackMax:0,options:o,output:[]},s=M(r)(a),l=Math.max(a.index,a.indexBacktrackMax);if(s&&a.index===t.length)return a.output;throw new Error(`Failed to parse at index ${l}`)},"I"),p=u((t,r)=>ce(t)?lt(t,r):fe(t)?ge(t,r):ut(t,r),"i"),lt=u((t,r)=>{const o={};for(const a of t){if(a.length!==1)throw new Error(`Invalid character: "${a}"`);const s=a.charCodeAt(0);o[s]=!0}return a=>{const s=a.input;let l=a.index,f=l;for(;f<s.length&&s.charCodeAt(f)in o;)f+=1;if(f>l){if(!P(r)&&!a.options.silent){const g=s.slice(l,f),h=S(r)?r(g,s,`${l}`):r;P(h)||a.output.push(h)}a.index=f}return!0}},"we"),ut=u((t,r)=>{if(at(t))return ge(t.source,r);{const o=t.source,a=t.flags.replace(/y|$/,"y"),s=new RegExp(o,a);return st(t)&&S(r)&&!tt(r)?ct(s,r):ft(s,r)}},"$e"),ct=u((t,r)=>o=>{const a=o.index,s=o.input;t.lastIndex=a;const l=t.exec(s);if(l){const f=t.lastIndex;if(!o.options.silent){const g=r(...l,s,`${a}`);P(g)||o.output.push(g)}return o.index=f,!0}else return!1},"Ee"),ft=u((t,r)=>o=>{const a=o.index,s=o.input;if(t.lastIndex=a,t.test(s)){const l=t.lastIndex;if(!P(r)&&!o.options.silent){const f=S(r)?r(s.slice(a,l),s,`${a}`):r;P(f)||o.output.push(f)}return o.index=l,!0}else return!1},"Ce"),ge=u((t,r)=>o=>{const a=o.index,s=o.input;if(s.startsWith(t,a)){if(!P(r)&&!o.options.silent){const l=S(r)?r(t,s,`${a}`):r;P(l)||o.output.push(l)}return o.index+=t.length,!0}else return!1},"F"),J=u((t,r,o,a)=>{const s=M(t),l=r>1;return Q(K(me(f=>{let g=0;for(;g<o;){const h=f.index;if(!s(f)||(g+=1,f.index===h))break}return g>=r},l),a))},"k"),de=u((t,r)=>J(t,0,1,r),"L"),G=u((t,r)=>J(t,0,1/0,r),"$"),pt=u((t,r)=>J(t,1,1/0,r),"Re"),A=u((t,r)=>{const o=t.map(M);return Q(K(me(a=>{for(let s=0,l=o.length;s<l;s++)if(!o[s](a))return!1;return!0}),r))},"x"),y=u((t,r)=>{const o=t.map(M);return Q(K(a=>{for(let s=0,l=o.length;s<l;s++)if(o[s](a))return!0;return!1},r))},"p"),me=u((t,r=!0,o=!1)=>{const a=M(t);return r?s=>{const l=s.index,f=s.output.length,g=a(s);return!g&&!o&&(s.indexBacktrackMax=Math.max(s.indexBacktrackMax,s.index)),(!g||o)&&(s.index=l,s.output.length!==f&&(s.output.length=f)),g}:a},"q"),K=u((t,r)=>{const o=M(t);return r?a=>{if(a.options.silent)return o(a);const s=a.output.length;if(o(a)){const l=a.output.splice(s,1/0),f=r(l);return P(f)||a.output.push(f),!0}else return!1}:o},"B"),Q=(()=>{let t=0;return r=>{const o=M(r),a=t+=1;return s=>{var l;if(s.options.memoization===!1)return o(s);const f=s.index,g=(l=s.cache)[a]||(l[a]={indexMax:-1,queue:[]}),h=g.queue;if(f<=g.indexMax){const I=g.store||(g.store=new Map);if(h.length){for(let B=0,hr=h.length;B<hr;B+=2){const br=h[B*2],xr=h[B*2+1];I.set(br,xr)}h.length=0}const j=I.get(f);if(j===!1)return!1;if(rt(j))return s.index=j,!0;if(j)return s.index=j.index,j.output?.length&&s.output.push(...j.output),!0}const q=s.output.length,mr=o(s);if(g.indexMax=Math.max(g.indexMax,f),mr){const I=s.index,j=s.output.length;if(j>q){const B=s.output.slice(q,j);h.push(f,{index:I,output:B})}else h.push(f,I);return!0}else return h.push(f,!1),!1}}})(),he=u(t=>{let r;return o=>(r||(r=M(t())),r(o))},"G"),M=it(t=>{if(S(t))return et(t)?he(t):t;if(fe(t)||ot(t))return p(t);if(ce(t))return A(t);if(nt(t))return y(Object.values(t));throw new Error("Invalid rule")}),k=u(t=>t,"d"),gt=u(t=>typeof t=="string","ke"),dt=u(t=>{const r=new WeakMap,o=new WeakMap;return(a,s)=>{const l=s?.partial?o:r,f=l.get(a);if(f!==void 0)return f;const g=t(a,s);return l.set(a,g),g}},"Be"),mt=u(t=>{const r={},o={};return(a,s)=>{const l=s?.partial?o:r;return l[a]??(l[a]=t(a,s))}},"Pe"),ht=p(/\\./,k),bt=p(/./,k),xt=p(/\*\*\*+/,"*"),vt=p(/([^/{[(!])\*\*/,(t,r)=>`${r}*`),$t=p(/(^|.)\*\*(?=[^*/)\]}])/,(t,r)=>`${r}*`),wt=G(y([ht,xt,vt,$t,bt])),yt=wt,jt=u(t=>pe(t,yt,{memoization:!1}).join(""),"Ie"),zt=jt,be="abcdefghijklmnopqrstuvwxyz",Ot=u(t=>{let r="";for(;t>0;){const o=(t-1)%26;r=be[o]+r,t=Math.floor((t-1)/26)}return r},"Le"),xe=u(t=>{let r=0;for(let o=0,a=t.length;o<a;o++)r=r*26+be.indexOf(t[o])+1;return r},"V"),X=u((t,r)=>{if(r<t)return X(r,t);const o=[];for(;t<=r;)o.push(t++);return o},"b"),Pt=u((t,r,o)=>X(t,r).map(a=>String(a).padStart(o,"0")),"qe"),ve=u((t,r)=>X(xe(t),xe(r)).map(Ot),"W"),m=u(t=>({partial:!1,regex:new RegExp(t,"s"),children:[]}),"c"),W=u(t=>({children:t}),"y"),R=(()=>{const t=u((r,o,a)=>{if(a.has(r))return;a.add(r);const{children:s}=r;if(!s.length)s.push(o);else for(let l=0,f=s.length;l<f;l++)t(s[l],o,a)},"e");return r=>{if(!r.length)return W([]);for(let o=r.length-1;o>=1;o--){const a=new Set,s=r[o-1],l=r[o];t(s,l,a)}return r[0]}})(),_=u(()=>({regex:new RegExp("[\\\\/]","s"),children:[]}),"g"),Mt=p(/\\./,m),_t=p(/[$.*+?^(){}[\]\|]/,t=>m(`\\${t}`)),Et=p(/[\\\/]/,_),kt=p(/[^$.*+?^(){}[\]\|\\\/]+/,m),At=p(/^(?:!!)*!(.*)$/,(t,r)=>m(`(?!^${Me.compile(r).source}$).*?`)),Rt=p(/^(!!)+/),Bt=y([At,Rt]),Tt=p(/\/(\*\*\/)+/,()=>W([R([_(),m(".+?"),_()]),_()])),St=p(/^(\*\*\/)+/,()=>W([m("^"),R([m(".*?"),_()])])),Wt=p(/\/(\*\*)$/,()=>W([R([_(),m(".*?")]),m("$")])),qt=p(/\*\*/,()=>m(".*?")),$e=y([Tt,St,Wt,qt]),It=p(/\*\/(?!\*\*\/|\*$)/,()=>R([m("[^\\\\/]*?"),_()])),Ct=p(/\*/,()=>m("[^\\\\/]*")),we=y([It,Ct]),ye=p("?",()=>m("[^\\\\/]")),Lt=p("[",k),Ft=p("]",k),Zt=p(/[!^]/,"^\\\\/"),Nt=p(/[a-z]-[a-z]|[0-9]-[0-9]/i,k),Ut=p(/\\./,k),Dt=p(/[$.*+?^(){}[\|]/,t=>`\\${t}`),Gt=p(/[\\\/]/,"\\\\/"),Vt=p(/[^$.*+?^(){}[\]\|\\\/]+/,k),Yt=y([Ut,Dt,Gt,Nt,Vt]),je=A([Lt,de(Zt),G(Yt),Ft],t=>m(t.join(""))),Ht=p("{","(?:"),Jt=p("}",")"),Kt=p(/(\d+)\.\.(\d+)/,(t,r,o)=>Pt(+r,+o,Math.min(r.length,o.length)).join("|")),Qt=p(/([a-z]+)\.\.([a-z]+)/,(t,r,o)=>ve(r,o).join("|")),Xt=p(/([A-Z]+)\.\.([A-Z]+)/,(t,r,o)=>ve(r.toLowerCase(),o.toLowerCase()).join("|").toUpperCase()),er=y([Kt,Qt,Xt]),ze=A([Ht,er,Jt],t=>m(t.join(""))),tr=p("{"),rr=p("}"),nr=p(","),or=p(/\\./,m),sr=p(/[$.*+?^(){[\]\|]/,t=>m(`\\${t}`)),ar=p(/[\\\/]/,_),ir=p(/[^$.*+?^(){}[\]\|\\\/,]+/,m),lr=he(()=>Pe),ur=p("",()=>m("(?:)")),cr=pt(y([$e,we,ye,je,ze,lr,or,sr,ar,ir]),R),Oe=y([cr,ur]),Pe=A([tr,de(A([Oe,G(A([nr,Oe]))])),rr],W),fr=G(y([Bt,$e,we,ye,je,ze,Pe,Mt,_t,Et,kt]),R),pr=fr,gr=u(t=>pe(t,pr,{memoization:!1})[0],"kr"),dr=gr,ee=u((t,r,o)=>ee.compile(t,o).test(r),"N");ee.compile=(()=>{const t=mt((o,a)=>Ke(dr(zt(o)),a)),r=dt((o,a)=>Xe(o.map(s=>t(s,a))));return(o,a)=>gt(o)?t(o,a):r(o,a)})();var Me=ee;return x(E)})();return e.default||e},"_lazyMatch"),te;const Sr=u((e,n)=>(te||(te=_e(),_e=null),te(e,n)),"default");var Wr=Object.defineProperty,qr=oe((e,n)=>Wr(e,"name",{value:n,configurable:!0}),"t$1");const Ir=/^[A-Z]:\//i,z=qr((e="")=>e&&e.replaceAll("\\","/").replace(Ir,n=>n.toUpperCase()),"normalizeWindowsPath");var Cr=Object.defineProperty,v=oe((e,n)=>Cr(e,"name",{value:n,configurable:!0}),"r");const Lr=/^[/\\]{2}/,Fr=/^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Z]:[/\\]/i,Te=/^[A-Z]:$/i,Ee=/^\/([A-Z]:)?$/i,Zr=/.(\.[^./]+)$/,Nr=/^[/\\]|^[a-z]:[/\\]/i,Ur=v(()=>typeof process.cwd=="function"?process.cwd().replaceAll("\\","/"):"/","cwd"),Se=v((e,n)=>{let i="",c=0,d=-1,b=0,w;for(let x=0;x<=e.length;++x){if(x<e.length)w=e[x];else{if(w==="/")break;w="/"}if(w==="/"){if(!(d===x-1||b===1))if(b===2){if(i.length<2||c!==2||!i.endsWith(".")||i.at(-2)!=="."){if(i.length>2){const E=i.lastIndexOf("/");E===-1?(i="",c=0):(i=i.slice(0,E),c=i.length-1-i.lastIndexOf("/")),d=x,b=0;continue}else if(i.length>0){i="",c=0,d=x,b=0;continue}}n&&(i+=i.length>0?"/..":"..",c=2)}else i.length>0?i+=`/${e.slice(d+1,x)}`:i=e.slice(d+1,x),c=x-d-1;d=x,b=0}else w==="."&&b!==-1?++b:b=-1}return i},"normalizeString"),N=v(e=>Fr.test(e),"isAbsolute"),We=v(function(e){if(e.length===0)return".";e=z(e);const n=Lr.exec(e),i=N(e),c=e.at(-1)==="/";return e=Se(e,!i),e.length===0?i?"/":c?"./":".":(c&&(e+="/"),Te.test(e)&&(e+="/"),n?i?`//${e}`:`//./${e}`:i&&!N(e)?`/${e}`:e)},"normalize"),qe=v((...e)=>{let n="";for(const i of e)if(i)if(n.length>0){const c=n[n.length-1]==="/",d=i[0]==="/";c&&d?n+=i.slice(1):n+=c||d?i:`/${i}`}else n+=i;return We(n)},"join"),re=v(function(...e){e=e.map(c=>z(c));let n="",i=!1;for(let c=e.length-1;c>=-1&&!i;c--){const d=c>=0?e[c]:Ur();!d||d.length===0||(n=`${d}/${n}`,i=N(d))}return n=Se(n,!i),i&&!N(n)?`/${n}`:n.length>0?n:"."},"resolve");v(function(e){return z(e)},"toNamespacedPath");const Ie=v(function(e){return Zr.exec(z(e))?.[1]??""},"extname");v(function(e,n){const i=re(e).replace(Ee,"$1").split("/"),c=re(n).replace(Ee,"$1").split("/");if(c[0][1]===":"&&i[0][1]===":"&&i[0]!==c[0])return c.join("/");const d=[...i];for(const b of d){if(c[0]!==b)break;i.shift(),c.shift()}return[...i.map(()=>".."),...c].join("/")},"relative");const Dr=v(e=>{const n=z(e).replace(/\/$/,"").split("/").slice(0,-1);return n.length===1&&Te.test(n[0])&&(n[0]+="/"),n.join("/")||(N(e)?"/":".")},"dirname");v(function(e){const n=[e.root,e.dir,e.base??e.name+e.ext].filter(Boolean);return z(e.root?re(...n):n.join("/"))},"format");const Gr=v((e,n)=>{const i=z(e).split("/").pop();return n&&i.endsWith(n)?i.slice(0,-n.length):i},"basename");v(function(e){const n=Nr.exec(e)?.[0]?.replaceAll("\\","/")??"",i=Gr(e),c=Ie(i);return{base:i,dir:Dr(e),ext:c,name:i.slice(0,i.length-c.length),root:n}},"parse");v((e,n)=>Sr(n,We(e)),"matchesGlob");var Vr=Object.defineProperty,se=$((e,n)=>Vr(e,"name",{value:n,configurable:!0}),"o$2"),Yr=Object.defineProperty,Y=se((e,n)=>Yr(e,"name",{value:n,configurable:!0}),"o");const Hr=ne(import.meta.url),L=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Jr=Y(e=>{if(typeof L<"u"&&L.versions&&L.versions.node){const[n,i]=L.versions.node.split(".").map(Number);if(n>22||n===22&&i>=3||n===20&&i>=16)return L.getBuiltinModule(e)}return Hr(e)},"__cjs_getBuiltinModule"),{fileURLToPath:Kr}=Jr("node:url");function ae(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}$(ae,"b$1");se(ae,"j");Y(ae,"getDefaultExportFromCjs");var ke,Ae;function ie(){return Ae||(Ae=1,ke=["3dm","3ds","3g2","3gp","7z","a","aac","adp","afdesign","afphoto","afpub","ai","aif","aiff","alz","ape","apk","appimage","ar","arj","asf","au","avi","bak","baml","bh","bin","bk","bmp","btif","bz2","bzip2","cab","caf","cgm","class","cmx","cpio","cr2","cr3","cur","dat","dcm","deb","dex","djvu","dll","dmg","dng","doc","docm","docx","dot","dotm","dra","DS_Store","dsk","dts","dtshd","dvb","dwg","dxf","ecelp4800","ecelp7470","ecelp9600","egg","eol","eot","epub","exe","f4v","fbs","fh","fla","flac","flatpak","fli","flv","fpx","fst","fvt","g3","gh","gif","graffle","gz","gzip","h261","h263","h264","icns","ico","ief","img","ipa","iso","jar","jpeg","jpg","jpgv","jpm","jxr","key","ktx","lha","lib","lvp","lz","lzh","lzma","lzo","m3u","m4a","m4v","mar","mdi","mht","mid","midi","mj2","mka","mkv","mmr","mng","mobi","mov","movie","mp3","mp4","mp4a","mpeg","mpg","mpga","mxu","nef","npx","numbers","nupkg","o","odp","ods","odt","oga","ogg","ogv","otf","ott","pages","pbm","pcx","pdb","pdf","pea","pgm","pic","png","pnm","pot","potm","potx","ppa","ppam","ppm","pps","ppsm","ppsx","ppt","pptm","pptx","psd","pya","pyc","pyo","pyv","qt","rar","ras","raw","resources","rgb","rip","rlc","rmf","rmvb","rpm","rtf","rz","s3m","s7z","scpt","sgi","shar","snap","sil","sketch","slk","smv","snk","so","stl","suo","sub","swf","tar","tbz","tbz2","tga","tgz","thmx","tif","tiff","tlz","ttc","ttf","txz","udf","uvh","uvi","uvm","uvp","uvs","uvu","viv","vob","war","wav","wax","wbmp","wdp","weba","webm","webp","whl","wim","wm","wma","wmv","wmx","woff","woff2","wrm","wvx","xbm","xif","xla","xlam","xls","xlsb","xlsm","xlsx","xlt","xltm","xltx","xm","xmind","xpi","xpm","xwd","xz","z","zip","zipx"]),ke}$(ie,"v$1");se(ie,"z");Y(ie,"requireBinaryExtensions");var Qr=ie();const Xr=ae(Qr);var en=Object.defineProperty,O=Y((e,n)=>en(e,"name",{value:n,configurable:!0}),"r");const tn=new Set(Xr),rn=new Set(["/","\\",void 0]),Re=Symbol.for("pathe:normalizedAlias"),nn=/(^|[/\\])([^/\\]+?)(?=(?:\.[^.]+)?$)/,on=O((e,n)=>n.split("/").length-e.split("/").length,"compareAliases"),V=O((e="/")=>{const n=e.at(-1);return n==="/"||n==="\\"},"hasTrailingSlash"),Ce=O(e=>{if(e[Re])return e;const n=Object.fromEntries(Object.entries(e).toSorted(([i],[c])=>on(i,c)));for(const i in n)for(const c in n)c===i||i.startsWith(c)||n[i].startsWith(c)&&rn.has(n[i][c.length])&&(n[i]=n[c]+n[i].slice(c.length));return Object.defineProperty(n,Re,{enumerable:!1,value:!0}),n},"normalizeAliases");O((e,n)=>{e=z(e),n=Ce(n);for(const[i,c]of Object.entries(n)){if(!e.startsWith(i))continue;const d=V(i)?i.slice(0,-1):i;if(V(e[d.length]))return qe(c,e.slice(i.length))}return e},"resolveAlias");O(e=>nn.exec(e)?.[2],"filename");O((e,n)=>{e=z(e),n=Ce(n);for(const[i,c]of Object.entries(n).toReversed()){if(!e.startsWith(c))continue;const d=V(c)?c.slice(0,-1):c;if(V(e[d.length]))return qe(i,e.slice(c.length))}return e},"reverseResolveAlias");O(e=>/^(?:\.?\.[/\\]|\.\.\B)/.test(e)||e==="..","isRelative");O(e=>tn.has(Ie(e).slice(1).toLowerCase()),"isBinaryPath");const Le=O(e=>z(e instanceof URL?Kr(e):e),"toPath");O(()=>{if(!globalThis?.process)return!1;if(globalThis?.process?.platform==="win32"||globalThis?.process?.platform==="cygwin")return!0;const e=globalThis?.process?.env.OSTYPE;return typeof e!="string"?!1:/^(?:msys|cygwin)$/.test(e)},"isWindows");var sn=Object.defineProperty,Fe=$((e,n)=>sn(e,"name",{value:n,configurable:!0}),"t$1"),an=Object.defineProperty,le=Fe((e,n)=>an(e,"name",{value:n,configurable:!0}),"s");const ln=ne(import.meta.url),F=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,un=le(e=>{if(typeof F<"u"&&F.versions&&F.versions.node){const[n,i]=F.versions.node.split(".").map(Number);if(n>22||n===22&&i>=3||n===20&&i>=16)return F.getBuiltinModule(e)}return ln(e)},"__cjs_getBuiltinModule"),{access:cn}=un("node:fs/promises");var fn=Object.defineProperty,pn=le((e,n)=>fn(e,"name",{value:n,configurable:!0}),"o");async function U(e,n=jr){Be(e),e=Le(e);try{return await cn(e,n),!0}catch{return!1}}$(U,"i$1");Fe(U,"d");le(U,"m");pn(U,"isAccessible");var gn=Object.defineProperty,Ze=$((e,n)=>gn(e,"name",{value:n,configurable:!0}),"t"),dn=Object.defineProperty,Ne=Ze((e,n)=>dn(e,"name",{value:n,configurable:!0}),"t"),mn=Object.defineProperty,hn=Ne((e,n)=>mn(e,"name",{value:n,configurable:!0}),"o");let bn=class extends Error{static{$(this,"c")}static{Ze(this,"i")}static{Ne(this,"n")}static{hn(this,"PermissionError")}constructor(n){super(`EPERM: Operation not permitted, ${n}`)}get code(){return"EPERM"}set code(n){throw new Error("Cannot overwrite code EPERM")}get name(){return"PermissionError"}set name(n){throw new Error("Cannot overwrite name of PermissionError")}};var xn=Object.defineProperty,vn=$((e,n)=>xn(e,"name",{value:n,configurable:!0}),"f"),$n=Object.defineProperty,Ue=vn((e,n)=>$n(e,"name",{value:n,configurable:!0}),"i");const wn=ne(import.meta.url),Z=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,De=Ue(e=>{if(typeof Z<"u"&&Z.versions&&Z.versions.node){const[n,i]=Z.versions.node.split(".").map(Number);if(n>22||n===22&&i>=3||n===20&&i>=16)return Z.getBuiltinModule(e)}return wn(e)},"__cjs_getBuiltinModule"),{readFile:yn}=De("node:fs/promises"),{unzip:jn,brotliDecompress:zn}=De("node:zlib");var On=Object.defineProperty,Ge=Ue((e,n)=>On(e,"name",{value:n,configurable:!0}),"n");const Pn={brotli:zn,gzip:jn,none:Ge((e,n)=>{n(null,e)},"none")},kn=Ge(async(e,n)=>{if(Be(e),e=Le(e),!await U(e))throw new bn(`unable to read the non-accessible file: ${e}`);if(!await U(e,zr))throw new Error(`Unable to read the non-readable file: ${e}`);const{buffer:i,compression:c,encoding:d,flag:b}=n??{};return await yn(e,b?{encoding:d,flag:b}:{encoding:d}).then(async w=>await new Promise((x,E)=>{Pn[c??"none"](w,(T,D)=>{T?E(T):x(i?D:D.toString())})})).catch(w=>{throw w})},"readFile");export{kn as B};
@@ -1 +0,0 @@
1
- var I=Object.defineProperty;var h=(r,a)=>I(r,"name",{value:a,configurable:!0});import c from"./EmailError-zm2ffVav.js";import P from"./RequiredOptionError-CevW3u2K.js";import{s as $}from"./generate-message-id-D4uA8gkj.js";import{i as j}from"./headers-to-record-Qo124ImV.js";import{m as f}from"./make-request-BDzF9W9D.js";import{c as T,P as C,u as y,h as b}from"./provider-base-Cmzx6BTO.js";import{d as E}from"./validate-email-options-DfJ7llf8.js";import{defineProvider as S}from"./defineProvider-B9rSklAJ.js";import{b as z,c as v,l as w}from"./address-formatter-Cm_E_ZMa.js";var k=Object.defineProperty,K=h((r,a)=>k(r,"name",{value:a,configurable:!0}),"p");const n="resend",R="https://api.resend.com",_=3e4,x=3,D=K(r=>{const a=[],l=/^[\w-]+$/;return l.test(r.name)||a.push(`Tag name '${r.name}' must only contain ASCII letters, numbers, underscores, or dashes`),r.name.length>256&&a.push(`Tag name '${r.name}' exceeds maximum length of 256 characters`),l.test(r.value)||a.push(`Tag value '${r.value}' for tag '${r.name}' must only contain ASCII letters, numbers, underscores, or dashes`),a},"validateTag"),W=S(((r={})=>{if(!r.apiKey)throw new P(n,"apiKey");const a={apiKey:r.apiKey,debug:r.debug||!1,endpoint:r.endpoint||R,logger:r.logger,retries:r.retries||x,timeout:r.timeout||_},l=new C,o=T(n,r.logger);return{endpoint:a.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 c(n,"Email ID is required to retrieve email details"),success:!1};await l.ensureInitialized(()=>this.initialize(),n);const t={Authorization:`Bearer ${a.apiKey}`,"Content-Type":"application/json"};o.debug("Retrieving email details",{id:e});const i=await y(async()=>f(`${a.endpoint}/emails/${e}`,{headers:t,method:"GET",timeout:a.timeout}),a.retries);return i.success?(o.debug("Email details retrieved successfully"),{data:i.data?.body,success:!0}):(o.debug("API request failed when retrieving email",i.error),{error:new c(n,`Failed to retrieve email: ${i.error instanceof Error?i.error.message:"Unknown error"}`,{cause:i.error}),success:!1})}catch(t){return{error:b(n,"retrieve email",t,o),success:!1}}},async initialize(){await l.ensureInitialized(async()=>{if(!await this.isAvailable())throw new c(n,"Resend API not available or invalid API key");o.debug("Provider initialized successfully")},n)},async isAvailable(){try{if(a.apiKey&&a.apiKey.startsWith("re_"))return o.debug("API key format is valid, assuming Resend is available"),!0;const e={Authorization:`Bearer ${a.apiKey}`,"Content-Type":"application/json"};o.debug("Checking Resend API availability");const t=await f(`${a.endpoint}/domains`,{headers:e,method:"GET",timeout:a.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"?(o.debug("API key is valid but restricted to only sending emails"),!0):(o.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 o.debug("Error checking availability:",e),!1}},name:n,options:a,async sendEmail(e){try{const t=E(e);if(t.length>0)return{error:new c(n,`Invalid email options: ${t.join(", ")}`),success:!1};await l.ensureInitialized(()=>this.initialize(),n);const i={from:v(e.from),headers:e.headers?j(e.headers):{},html:e.html,subject:e.subject,text:e.text,to:z(e.to)};if(e.cc&&(i.cc=w(e.cc)),e.bcc&&(i.bcc=w(e.bcc)),e.replyTo&&(i.reply_to=v(e.replyTo)),e.templateId&&(i.template=e.templateId,e.templateData&&(i.data=e.templateData)),e.scheduledAt&&(i.scheduled_at=typeof e.scheduledAt=="string"?e.scheduledAt:e.scheduledAt.toISOString()),e.tags&&e.tags.length>0){const s=[];if(e.tags.forEach(d=>{const p=D(d);p.length>0&&s.push(...p)}),s.length>0)return{error:new c(n,`Invalid email tags: ${s.join(", ")}`),success:!1};i.tags=e.tags.map(d=>({name:d.name,value:d.value}))}e.attachments&&e.attachments.length>0&&(i.attachments=await Promise.all(e.attachments.map(async s=>{let d;if(s.content)if(typeof s.content=="string")d=s.content;else if(s.content instanceof Promise){const p=await s.content;d=Buffer.from(p).toString("base64")}else d=s.content.toString("base64");else if(s.raw)d=typeof s.raw=="string"?s.raw:s.raw.toString("base64");else throw new c(n,`Attachment ${s.filename} has no content`);return{content:d,content_type:s.contentType,filename:s.filename,...s.path&&{path:s.path}}}))),o.debug("Sending email via Resend API",{subject:i.subject,to:i.to});const A={Authorization:`Bearer ${a.apiKey}`,"Content-Type":"application/json"},u=await y(async()=>f(`${a.endpoint}/emails`,{headers:A,method:"POST",timeout:a.timeout},JSON.stringify(i)),a.retries);if(!u.success)return o.debug("API request failed when sending email",u.error),{error:u.error||new c(n,"Failed to send email"),success:!1};const m=u.data,g=m?.body&&typeof m.body=="object"&&m.body.id?m.body.id:$();return o.debug("Email sent successfully",{messageId:g}),{data:{messageId:g,provider:n,response:u.data,sent:!0,timestamp:new Date},success:!0}}catch(t){return{error:b(n,"send email",t,o),success:!1}}},async validateCredentials(){return this.isAvailable()}}}));export{W as default};
@@ -1 +0,0 @@
1
- var E=Object.defineProperty;var y=(e,u)=>E(e,"name",{value:u,configurable:!0});import f from"./EmailError-zm2ffVav.js";import A from"./RequiredOptionError-CevW3u2K.js";import{c as k}from"./create-logger-BiWdqFNg.js";import{defineProvider as z}from"./defineProvider-B9rSklAJ.js";var P=Object.defineProperty,m=y((e,u)=>P(e,"name",{value:u,configurable:!0}),"f");const S=m(e=>typeof e=="function","isProviderFactory"),x=m(e=>e!=null&&typeof e=="object"&&"sendEmail"in e&&"initialize"in e&&"isAvailable"in e,"isProvider"),o="roundrobin",T=z((e={})=>{if(!e.mailers||e.mailers.length===0)throw new A(o,"mailers");const u={debug:e.debug||!1,logger:e.logger,mailers:e.mailers,retries:e.retries||3,retryAfter:e.retryAfter??60,timeout:e.timeout||3e4};let p=!1;const t=[];let a=0;const n=k(o,e.logger),v=m(async()=>{t.length=0;for(const i of u.mailers)try{let r;if(S(i))r=i({});else if(x(i))r=i;else{n.debug(`Skipping invalid mailer: ${i}`);continue}try{await r.initialize(),t.push(r),n.debug(`Initialized provider: ${r.name||"unknown"}`)}catch(s){n.debug(`Failed to initialize provider ${r.name||"unknown"}:`,s)}}catch(r){n.debug("Error processing mailer:",r)}if(t.length===0)throw new f(o,"No providers could be initialized");a=Math.floor(Math.random()*t.length),n.debug(`Round robin starting at index ${a} (${t[a]?.name||"unknown"})`)},"initializeProviders"),b=m(async()=>{if(t.length===0)return;const i=a;let r=0;for(;r<t.length;){const s=t[a];if(!s){a=(a+1)%t.length,r+=1;continue}const g=s.name||`provider-${a+1}`;try{if(await s.isAvailable())return a=(a+1)%t.length,n.debug(`Selected provider: ${g} (index ${a===0?t.length-1:a-1})`),s}catch{}a=(a+1)%t.length,r+=1,r<t.length&&u.retryAfter>0&&await new Promise(l=>{setTimeout(()=>{l(void 0)},u.retryAfter)})}return n.debug(`No available providers found, using provider at index ${i}`),t[i]||void 0},"getNextProvider");return{features:{attachments:!0,batchSending:!1,customHeaders:!0,html:!0,replyTo:!0,scheduling:!1,tagging:!1,templates:!1,tracking:!1},async initialize(){if(!p)try{await v(),p=!0,n.debug(`Round robin provider initialized with ${t.length} provider(s)`)}catch(i){throw new f(o,`Failed to initialize: ${i.message}`,{cause:i})}},async isAvailable(){try{return t.length===0&&await v(),(await Promise.allSettled(t.map(i=>i.isAvailable()))).some(i=>i.status==="fulfilled"&&i.value===!0)}catch{return!1}},name:o,options:u,async sendEmail(i){try{if(t.length===0&&await v(),t.length===0)return{error:new f(o,"No providers available"),success:!1};const r=await b();if(!r)return{error:new f(o,"No available providers found"),success:!1};const s=r.name||"unknown";n.debug(`Sending email via ${s}`);const g=await r.sendEmail(i);if(g.success)return n.debug(`Email sent successfully via ${s}`),{data:{...g.data,provider:`${o}(${s})`},success:!0};n.debug(`Failed to send via ${s}, trying next provider`);const l=[];g.error&&l.push(g.error);let w=0;for(;w<t.length-1;){const c=await b();if(!c||c===r)break;const h=c.name||"unknown";n.debug(`Retrying with ${h}`);try{const d=await c.sendEmail(i);if(d.success)return n.debug(`Email sent successfully via ${h} (after retry)`),{data:{...d.data,provider:`${o}(${h})`},success:!0};d.error&&l.push(d.error)}catch(d){l.push(d instanceof Error?d:new Error(String(d)))}w+=1}const $=l.map(c=>c instanceof Error?c.message:String(c)).join("; ");return{error:new f(o,`Failed to send email via all providers. Errors: ${$}`,{cause:l[0]instanceof Error?l[0]:new Error(String(l[0]))}),success:!1}}catch(r){return{error:new f(o,`Failed to send email: ${r.message}`,{cause:r}),success:!1}}},async validateCredentials(){return this.isAvailable()}}});export{T as default};
@@ -1 +0,0 @@
1
- var P=Object.defineProperty;var h=(i,a)=>P(i,"name",{value:a,configurable:!0});import{createRequire as A}from"node:module";import l from"./EmailError-zm2ffVav.js";import _ from"./RequiredOptionError-CevW3u2K.js";import{s as z}from"./generate-message-id-D4uA8gkj.js";import{i as E}from"./headers-to-record-Qo124ImV.js";import{m as y}from"./make-request-BDzF9W9D.js";import{c as q,P as k,u as b,h as w}from"./provider-base-Cmzx6BTO.js";import{d as K}from"./validate-email-options-DfJ7llf8.js";import{defineProvider as B}from"./defineProvider-B9rSklAJ.js";import{f,a as C}from"./address-formatter-Cm_E_ZMa.js";const j=A(import.meta.url),u=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,S=h(i=>{if(typeof u<"u"&&u.versions&&u.versions.node){const[a,c]=u.versions.node.split(".").map(Number);if(a>22||a===22&&c>=3||a===20&&c>=16)return u.getBuiltinModule(i)}return j(i)},"__cjs_getBuiltinModule"),{Buffer:T}=S("node:buffer"),s="sweego",$="https://api.sweego.com",x=3e4,R=3,Q=B((i={})=>{if(!i.apiKey)throw new _(s,"apiKey");const a={apiKey:i.apiKey,debug:i.debug||!1,endpoint:i.endpoint||$,retries:i.retries||R,timeout:i.timeout||x,...i.logger&&{logger:i.logger}},c=new k,n=q(s,i.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 l(s,"Email ID is required to retrieve email details"),success:!1};await c.ensureInitialized(()=>this.initialize(),s);const o={Authorization:`Bearer ${a.apiKey}`,"Content-Type":"application/json"};n.debug("Retrieving email details",{id:e});const t=await b(async()=>y(`${a.endpoint}/emails/${e}`,{headers:o,method:"GET",timeout:a.timeout}),a.retries);return t.success?(n.debug("Email details retrieved successfully"),{data:t.data?.body,success:!0}):(n.debug("API request failed when retrieving email",t.error),{error:new l(s,`Failed to retrieve email: ${t.error instanceof Error?t.error.message:"Unknown error"}`,{cause:t.error}),success:!1})}catch(o){return{error:w(s,"retrieve email",o,n),success:!1}}},async initialize(){await c.ensureInitialized(async()=>{if(!await this.isAvailable())throw new l(s,"Sweego API not available or invalid API key");n.debug("Provider initialized successfully")},s)},async isAvailable(){try{return n.debug("Checking Sweego API availability"),!0}catch(e){return n.debug("Error checking availability:",e),!1}},name:s,options:a,async sendEmail(e){try{const o=K(e);if(o.length>0)return{error:new l(s,`Invalid email options: ${o.join(", ")}`),success:!1};await c.ensureInitialized(()=>this.initialize(),s);const t={from:{email:e.from.email,name:e.from.name},subject:e.subject,to:f(e.to)};if(e.html&&(t.html=e.html),e.text&&(t.text=e.text),e.cc&&(t.cc=f(e.cc)),e.bcc&&(t.bcc=f(e.bcc)),e.replyTo&&(t.replyTo=C(e.replyTo)),e.templateId&&(t.templateId=e.templateId,e.templateVariables&&(t.templateVariables=e.templateVariables)),e.tags&&e.tags.length>0&&(t.tags=e.tags),e.headers){const r=E(e.headers);t.headers=r}e.attachments&&e.attachments.length>0&&(t.attachments=await Promise.all(e.attachments.map(async r=>{let m;if(r.content)if(typeof r.content=="string")m=r.content;else if(r.content instanceof Promise){const I=await r.content;m=T.from(I).toString("base64")}else m=r.content.toString("base64");else if(r.raw)m=typeof r.raw=="string"?r.raw:r.raw.toString("base64");else throw new l(s,`Attachment ${r.filename} has no content`);return{content:m,contentType:r.contentType||"application/octet-stream",filename:r.filename,...r.cid&&{cid:r.cid}}}))),n.debug("Sending email via Sweego API",{subject:t.subject,to:t.to});const v={Authorization:`Bearer ${a.apiKey}`,"Content-Type":"application/json"},d=await b(async()=>y(`${a.endpoint}/send`,{headers:v,method:"POST",timeout:a.timeout},JSON.stringify(t)),a.retries);if(!d.success)return n.debug("API request failed when sending email",d.error),{error:d.error||new l(s,"Failed to send email"),success:!1};const g=d.data?.body,p=g?.messageId||g?.id||z();return n.debug("Email sent successfully",{messageId:p}),{data:{messageId:p,provider:s,response:d.data,sent:!0,timestamp:new Date},success:!0}}catch(o){return{error:w(s,"send email",o,n),success:!1}}},async validateCredentials(){return this.isAvailable()}}});export{Q as default};
@@ -1 +0,0 @@
1
- var d=Object.defineProperty;var l=(r,e)=>d(r,"name",{value:e,configurable:!0});import o from"../utils/validation/validate-email.js";var c=Object.defineProperty,t=l((r,e)=>c(r,"name",{value:e,configurable:!0}),"m");const f=t(r=>{const e=[];(!r.from||!r.from.email)&&e.push("Missing required field: from"),r.to||e.push("Missing required field: to"),r.subject||e.push("Missing required field: subject"),!r.text&&!r.html&&e.push("Either text or html content is required"),r.from&&r.from.email&&!o(r.from.email)&&e.push(`Invalid from email address: ${r.from.email}`);const s=t((i,m)=>{i&&(Array.isArray(i)?i:[i]).forEach(a=>{o(a.email)||e.push(`Invalid ${m} email address: ${a.email}`)})},"checkAddresses");return s(r.to,"to"),s(r.cc,"cc"),s(r.bcc,"bcc"),r.replyTo&&!o(r.replyTo.email)&&e.push(`Invalid replyTo email address: ${r.replyTo.email}`),e},"validateEmailOptions");export{f as d};
@@ -1 +0,0 @@
1
- import l from"./EmailError-zm2ffVav.js";import y from"./RequiredOptionError-CevW3u2K.js";import{s as b}from"./generate-message-id-D4uA8gkj.js";import{i as k}from"./headers-to-record-Qo124ImV.js";import{m as v}from"./make-request-BDzF9W9D.js";import{c as w,P as A,u as _,h as z}from"./provider-base-Cmzx6BTO.js";import{s as j,a as P}from"./sanitize-header-wWav-Scu.js";import{d as I}from"./validate-email-options-DfJ7llf8.js";import{defineProvider as T}from"./defineProvider-B9rSklAJ.js";import{m as f}from"./address-formatter-Cm_E_ZMa.js";const i="zeptomail",$="https://api.zeptomail.com/v1.1",O=3e4,Z=3,F=T((s={})=>{if(!s.token)throw new y(i,"token");if(!s.token.startsWith("Zoho-enczapikey "))throw new l(i,'Token should be in the format "Zoho-enczapikey <your_api_key>"');const n={debug:s.debug||!1,endpoint:s.endpoint||$,logger:s.logger,retries:s.retries||Z,timeout:s.timeout||O,token:s.token},u=new A,o=w(i,s.logger);return{features:{attachments:!0,batchSending:!1,customHeaders:!0,html:!0,replyTo:!0,scheduling:!1,tagging:!1,templates:!1,tracking:!0},async initialize(){await u.ensureInitialized(async()=>{if(!await this.isAvailable())throw new l(i,"Zeptomail API not available or invalid token");o.debug("Provider initialized successfully")},i)},async isAvailable(){try{return n.token&&n.token.startsWith("Zoho-enczapikey ")?(o.debug("Token format is valid, assuming Zeptomail is available"),!0):!1}catch(e){return o.debug("Error checking availability:",e),!1}},name:i,options:n,async sendEmail(e){try{const m=I(e);if(m.length>0)return{error:new l(i,`Invalid email options: ${m.join(", ")}`),success:!1};await u.ensureInitialized(()=>this.initialize(),i);const a={from:f(e.from).address,subject:e.subject};if(Array.isArray(e.to)?a.to=e.to.length===1?e.to[0].email:e.to.map(t=>t.email):a.to=e.to.email,e.text&&(a.textbody=e.text),e.html&&(a.htmlbody=e.html),e.cc&&(Array.isArray(e.cc)?a.cc=e.cc.length===1?e.cc[0].email:e.cc.map(t=>t.email):a.cc=e.cc.email),e.bcc&&(Array.isArray(e.bcc)?a.bcc=e.bcc.length===1?e.bcc[0].email:e.bcc.map(t=>t.email):a.bcc=e.bcc.email),e.replyTo&&(a.reply_to=[f(e.replyTo).address]),e.trackClicks!==void 0&&(a.track_clicks=e.trackClicks),e.trackOpens!==void 0&&(a.track_opens=e.trackOpens),e.clientReference&&(a.client_reference=e.clientReference),e.mimeHeaders&&Object.keys(e.mimeHeaders).length>0){const t={};for(const[r,d]of Object.entries(e.mimeHeaders))t[r]=d;a.mime_headers=t}if(e.headers){const t=k(e.headers);Object.keys(t).length>0&&(a.mime_headers||(a.mime_headers={}),Object.entries(t).forEach(([r,d])=>{a.mime_headers&&(a.mime_headers[P(r)]=j(d))}))}e.attachments&&e.attachments.length>0&&(a.attachments=e.attachments.map(t=>{const r={name:t.filename};return t.content?(r.content=typeof t.content=="string"?t.content:t.content.toString("base64"),t.contentType&&(r.mime_type=t.contentType)):t.path&&(r.file_cache_key=t.path),r})),o.debug("Sending email via Zeptomail API",{subject:a.subject,to:a.to});const g={Accept:"application/json",Authorization:n.token,"Content-Type":"application/json"},c=await _(async()=>v(`${n.endpoint}/email`,{headers:g,method:"POST",timeout:n.timeout},JSON.stringify(a)),n.retries);if(!c.success){o.debug("API request failed",c.error);let t=c.error instanceof Error?c.error.message:"Unknown error";const r=c.data;return r?.body?.message?t+=` Details: ${r.body.message}`:r?.body?.error?.message&&(t+=` Details: ${r.body.error.message}`),{error:new l(i,`Failed to send email: ${t}`,{cause:c.error}),success:!1}}const p=c.data?.body,h=p?.request_id||b();return o.debug("Email sent successfully",{messageId:h}),{data:{messageId:h,provider:i,response:p,sent:!0,timestamp:new Date},success:!0}}catch(m){return{error:z(i,"send email",m,o),success:!1}}},async validateCredentials(){return this.isAvailable()}}});export{F as default};
@@ -1,7 +0,0 @@
1
- import type { ProviderFactory } from "../provider.d.ts";
2
- import type { AhaSendConfig, AhaSendEmailOptions } from "./types.d.ts";
3
- /**
4
- * AhaSend Provider for sending emails through AhaSend API
5
- */
6
- declare const ahaSendProvider: ProviderFactory<AhaSendConfig, unknown, AhaSendEmailOptions>;
7
- export default ahaSendProvider;
@@ -1,28 +0,0 @@
1
- import type { BaseConfig, EmailOptions } from "../../types.d.ts";
2
- /**
3
- * AhaSend configuration
4
- */
5
- export interface AhaSendConfig extends BaseConfig {
6
- /**
7
- * AhaSend API key
8
- */
9
- apiKey: string;
10
- /**
11
- * AhaSend API endpoint
12
- * Defaults to: https://api.ahasend.com
13
- */
14
- endpoint?: string;
15
- }
16
- /**
17
- * AhaSend-specific email options
18
- */
19
- export interface AhaSendEmailOptions extends EmailOptions {
20
- /**
21
- * AhaSend template ID for template-based emails
22
- */
23
- templateId?: string;
24
- /**
25
- * Template variables for AhaSend templates
26
- */
27
- templateVariables?: Record<string, unknown>;
28
- }
@@ -1,8 +0,0 @@
1
- import type { ProviderFactory } from "../provider.d.ts";
2
- import type { AwsSesConfig, AwsSesEmailOptions } from "./types.d.ts";
3
- /**
4
- * AWS SES Email Provider Implementation - Zero dependency version
5
- * Uses native Node.js APIs instead of AWS SDK
6
- */
7
- declare const awsSesProvider: ProviderFactory<AwsSesConfig, unknown, AwsSesEmailOptions>;
8
- export default awsSesProvider;
@@ -1,38 +0,0 @@
1
- import type { BaseConfig, EmailOptions } from "../../types.d.ts";
2
- /**
3
- * AWS SES configuration
4
- */
5
- export interface AwsSesConfig extends BaseConfig {
6
- accessKeyId: string;
7
- apiVersion?: string;
8
- endpoint?: string;
9
- maxAttempts?: number;
10
- region: string;
11
- secretAccessKey: string;
12
- sessionToken?: string;
13
- }
14
- /**
15
- * AWS SES-specific email options
16
- */
17
- export interface AwsSesEmailOptions extends EmailOptions {
18
- /**
19
- * Configuration set name
20
- */
21
- configurationSetName?: string;
22
- /**
23
- * Message tags as key-value pairs
24
- */
25
- messageTags?: Record<string, string>;
26
- /**
27
- * Return path email address
28
- */
29
- returnPath?: string;
30
- /**
31
- * Return path ARN
32
- */
33
- returnPathArn?: string;
34
- /**
35
- * Source ARN for sending authorization
36
- */
37
- sourceArn?: string;
38
- }
@@ -1,7 +0,0 @@
1
- import type { ProviderFactory } from "../provider.d.ts";
2
- import type { AzureConfig, AzureEmailOptions } from "./types.d.ts";
3
- /**
4
- * Azure Communication Services Provider for sending emails through Azure API
5
- */
6
- declare const azureProvider: ProviderFactory<AzureConfig, unknown, AzureEmailOptions>;
7
- export default azureProvider;
@@ -1,44 +0,0 @@
1
- import type { BaseConfig, EmailOptions } from "../../types.d.ts";
2
- /**
3
- * Azure Communication Services configuration
4
- */
5
- export interface AzureConfig extends BaseConfig {
6
- /**
7
- * Azure AD access token (for OAuth2 authentication)
8
- */
9
- accessToken?: string;
10
- /**
11
- * Azure Communication Services connection string or access token
12
- */
13
- connectionString?: string;
14
- /**
15
- * Azure Communication Services endpoint
16
- * Defaults to: https://{region}.communication.azure.com
17
- */
18
- endpoint?: string;
19
- /**
20
- * Azure region (e.g., "eastus", "westus")
21
- */
22
- region: string;
23
- }
24
- /**
25
- * Azure-specific email options
26
- */
27
- export interface AzureEmailOptions extends EmailOptions {
28
- /**
29
- * Custom headers
30
- */
31
- headers?: Record<string, string>;
32
- /**
33
- * Importance level (normal, high)
34
- */
35
- importance?: "normal" | "high";
36
- /**
37
- * Azure template ID for template-based emails
38
- */
39
- templateId?: string;
40
- /**
41
- * Template variables for Azure templates
42
- */
43
- templateVariables?: Record<string, unknown>;
44
- }
@@ -1,7 +0,0 @@
1
- import type { ProviderFactory } from "../provider.d.ts";
2
- import type { BrevoConfig, BrevoEmailOptions } from "./types.d.ts";
3
- /**
4
- * Brevo Provider for sending emails through Brevo API
5
- */
6
- declare const brevoProvider: ProviderFactory<BrevoConfig, unknown, BrevoEmailOptions>;
7
- export default brevoProvider;
@@ -1,57 +0,0 @@
1
- import type { BaseConfig, EmailAddress, EmailOptions } from "../../types.d.ts";
2
- /**
3
- * Brevo configuration
4
- */
5
- export interface BrevoConfig extends BaseConfig {
6
- /**
7
- * Brevo API key
8
- */
9
- apiKey: string;
10
- /**
11
- * Brevo API endpoint
12
- * Defaults to: https://api.brevo.com/v3
13
- */
14
- endpoint?: string;
15
- /**
16
- * Enable hard validation for replyTo addresses.
17
- * If true, arrays will be rejected. If false, the first address from an array will be used.
18
- * Defaults to: false
19
- */
20
- hardValidation?: boolean;
21
- }
22
- /**
23
- * Brevo-specific email options
24
- */
25
- export interface BrevoEmailOptions extends Omit<EmailOptions, "replyTo"> {
26
- /**
27
- * Batch ID for batch sending
28
- */
29
- batchId?: string;
30
- /**
31
- * Headers (custom headers)
32
- */
33
- headers?: Record<string, string>;
34
- /**
35
- * Reply-to email address (can override base replyTo).
36
- * Only one address is allowed. If an array is provided and hardValidation is false, the first address will be used.
37
- */
38
- replyTo?: EmailAddress | EmailAddress[];
39
- /**
40
- * Scheduled date/time
41
- * - If string: ISO 8601 format (e.g., "2025-01-15T10:00:00Z")
42
- * - If number: Unix timestamp in seconds (not milliseconds)
43
- */
44
- scheduledAt?: string | number;
45
- /**
46
- * Tags for categorization
47
- */
48
- tags?: string[];
49
- /**
50
- * Brevo template ID for template-based emails
51
- */
52
- templateId?: number;
53
- /**
54
- * Template parameters for Brevo templates
55
- */
56
- templateParams?: Record<string, unknown>;
57
- }
@@ -1,7 +0,0 @@
1
- import type { ProviderFactory } from "../provider.d.ts";
2
- import type { FailoverConfig, FailoverEmailOptions } from "./types.d.ts";
3
- /**
4
- * Failover Provider for sending emails with automatic failover to backup providers.
5
- */
6
- declare const provider: ProviderFactory<FailoverConfig, unknown, FailoverEmailOptions>;
7
- export default provider;
@@ -1,19 +0,0 @@
1
- import type { BaseConfig, EmailOptions } from "../../types.d.ts";
2
- /**
3
- * Failover configuration
4
- */
5
- export interface FailoverConfig extends BaseConfig {
6
- /**
7
- * Array of provider instances or provider factories to use in failover order
8
- * Can be Provider instances or ProviderFactory functions
9
- */
10
- mailers: unknown[];
11
- /**
12
- * Time in milliseconds to wait before trying the next provider (default: 60)
13
- */
14
- retryAfter?: number;
15
- }
16
- /**
17
- * Failover-specific email options
18
- */
19
- export type FailoverEmailOptions = EmailOptions;
@@ -1,7 +0,0 @@
1
- import type { ProviderFactory } from "../provider.d.ts";
2
- import type { HttpEmailConfig, HttpEmailOptions } from "./types.d.ts";
3
- /**
4
- * HTTP Email Provider for sending emails via HTTP API.
5
- */
6
- declare const httpProvider: ProviderFactory<HttpEmailConfig, unknown, HttpEmailOptions>;
7
- export default httpProvider;
@@ -1,27 +0,0 @@
1
- import type { EmailOptions } from "../../types.d.ts";
2
- /**
3
- * HTTP email configuration
4
- */
5
- export interface HttpEmailConfig {
6
- apiKey?: string;
7
- endpoint: string;
8
- headers?: Record<string, string>;
9
- method?: "GET" | "POST" | "PUT";
10
- }
11
- /**
12
- * HTTP-specific email options
13
- */
14
- export interface HttpEmailOptions extends EmailOptions {
15
- /**
16
- * Custom parameters to include in the request payload
17
- */
18
- customParams?: Record<string, unknown>;
19
- /**
20
- * Override the endpoint for this specific email
21
- */
22
- endpointOverride?: string;
23
- /**
24
- * Override the HTTP method for this specific email
25
- */
26
- methodOverride?: "GET" | "POST" | "PUT";
27
- }
@@ -1,7 +0,0 @@
1
- import type { ProviderFactory } from "../provider.d.ts";
2
- import type { InfobipConfig, InfobipEmailOptions } from "./types.d.ts";
3
- /**
4
- * Infobip Provider for sending emails through Infobip API
5
- */
6
- declare const infobipProvider: ProviderFactory<InfobipConfig, unknown, InfobipEmailOptions>;
7
- export default infobipProvider;
@@ -1,48 +0,0 @@
1
- import type { BaseConfig, EmailOptions } from "../../types.d.ts";
2
- /**
3
- * Infobip configuration
4
- */
5
- export interface InfobipConfig extends BaseConfig {
6
- /**
7
- * Infobip API key
8
- */
9
- apiKey: string;
10
- /**
11
- * Infobip base URL (e.g., "https://api.infobip.com")
12
- */
13
- baseUrl?: string;
14
- /**
15
- * Infobip API endpoint
16
- * Defaults to: https://{baseUrl}/email/3/send
17
- */
18
- endpoint?: string;
19
- }
20
- /**
21
- * Infobip-specific email options
22
- */
23
- export interface InfobipEmailOptions extends EmailOptions {
24
- /**
25
- * Intermediate report (for delivery status updates)
26
- */
27
- intermediateReport?: boolean;
28
- /**
29
- * Notify URL (for delivery notifications)
30
- */
31
- notifyUrl?: string;
32
- /**
33
- * Send at (Unix timestamp in milliseconds)
34
- */
35
- sendAt?: number;
36
- /**
37
- * Infobip template ID for template-based emails
38
- */
39
- templateId?: number;
40
- /**
41
- * Template variables for Infobip templates
42
- */
43
- templateVariables?: Record<string, unknown>;
44
- /**
45
- * Tracking URL (for click tracking)
46
- */
47
- trackingUrl?: string;
48
- }
@@ -1,9 +0,0 @@
1
- import type { ProviderFactory } from "../provider.d.ts";
2
- import type { MailCrabConfig, MailCrabEmailOptions } from "./types.d.ts";
3
- /**
4
- * MailCrab Provider for local email testing
5
- * MailCrab is a local SMTP server for testing emails during development
6
- * This is a convenience wrapper around the SMTP provider with MailCrab defaults
7
- */
8
- declare const mailCrabProvider: ProviderFactory<MailCrabConfig, unknown, MailCrabEmailOptions>;
9
- export default mailCrabProvider;
@@ -1,22 +0,0 @@
1
- import type { BaseConfig, EmailOptions } from "../../types.d.ts";
2
- /**
3
- * MailCrab configuration (for local development/testing)
4
- */
5
- export interface MailCrabConfig extends BaseConfig {
6
- /**
7
- * MailCrab host (default: localhost)
8
- */
9
- host?: string;
10
- /**
11
- * MailCrab port (default: 1025)
12
- */
13
- port?: number;
14
- /**
15
- * Use secure connection (default: false)
16
- */
17
- secure?: boolean;
18
- }
19
- /**
20
- * MailCrab-specific email options
21
- */
22
- export type MailCrabEmailOptions = EmailOptions;
@@ -1,7 +0,0 @@
1
- import type { ProviderFactory } from "../provider.d.ts";
2
- import type { MailerSendConfig, MailerSendEmailOptions } from "./types.d.ts";
3
- /**
4
- * MailerSend Provider for sending emails through MailerSend API
5
- */
6
- declare const mailerSendProvider: ProviderFactory<MailerSendConfig, unknown, MailerSendEmailOptions>;
7
- export default mailerSendProvider;