@visulima/email 1.0.0-alpha.34 → 1.0.0-alpha.36

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 (288) hide show
  1. package/CHANGELOG.md +53 -0
  2. package/LICENSE.md +57 -0
  3. package/README.md +96 -0
  4. package/dist/crypto/index.d.ts +160 -3
  5. package/dist/crypto/index.js +1 -1
  6. package/dist/deliverability/dmarc-report.d.ts +95 -0
  7. package/dist/deliverability/dmarc-report.js +1 -0
  8. package/dist/deliverability/index.d.ts +360 -0
  9. package/dist/deliverability/index.js +1 -0
  10. package/dist/events/index.d.ts +31 -0
  11. package/dist/events/index.js +1 -0
  12. package/dist/inbound/index.d.ts +375 -0
  13. package/dist/inbound/index.js +1 -0
  14. package/dist/index.d.ts +12 -734
  15. package/dist/index.js +1 -1
  16. package/dist/middleware/index.d.ts +346 -0
  17. package/dist/middleware/index.js +1 -0
  18. package/dist/packem_shared/ALL_EVENTS-3kwh5CBE.js +1 -0
  19. package/dist/packem_shared/DkimSigner-BuSbnos1.js +18 -0
  20. package/dist/packem_shared/DraftMailMessage-C9tevR8K.js +1 -0
  21. package/dist/packem_shared/EmailError-B-sEf3bp.js +1 -0
  22. package/dist/packem_shared/Mail-DpjH0Exh.js +1 -0
  23. package/dist/packem_shared/MailMessage-L-Q9yc5v.js +1 -0
  24. package/dist/packem_shared/MemoryEventStore-CuhfO9aj.js +1 -0
  25. package/dist/packem_shared/MemoryQueue-Dl1Fa6OJ.js +1 -0
  26. package/dist/packem_shared/MemorySuppressionStore-DZnbz-_B.js +1 -0
  27. package/dist/packem_shared/RATE_LIMIT_PRESETS-BPADLgcA.js +1 -0
  28. package/dist/packem_shared/RequiredOptionError-DuNNY_a5.js +1 -0
  29. package/dist/packem_shared/SmimeEncrypter-C7usORKF.js +6 -0
  30. package/dist/packem_shared/SmimeSigner-DgAApLPS.js +8 -0
  31. package/dist/packem_shared/addDarkModeSupport-DZYxULjl.js +1 -0
  32. package/dist/packem_shared/address-formatter-BWR2Dddx.js +1 -0
  33. package/dist/packem_shared/aggregate-features-BqEjPd42.js +1 -0
  34. package/dist/packem_shared/ahaSendProvider-Dq5mElHZ.js +1 -0
  35. package/dist/packem_shared/arcMessageSignatureBase-BY4j0TxM.js +17 -0
  36. package/dist/packem_shared/attachment-processor-BjTNoMyb.js +1 -0
  37. package/dist/packem_shared/awsSesProvider-BGZJUIep.js +32 -0
  38. package/dist/packem_shared/azureProvider-DlM6UWUv.js +1 -0
  39. package/dist/packem_shared/brevoProvider-D_Hhc0Z-.js +1 -0
  40. package/dist/packem_shared/build-mime-message-Be6TOi1T.js +3 -0
  41. package/dist/packem_shared/buildListUnsubscribe-Cdr8MvR_.js +1 -0
  42. package/dist/packem_shared/buildMtaStsPolicy-oEQg8y_C.js +6 -0
  43. package/dist/packem_shared/circuitBreakerMiddleware-D2SA_07f.js +1 -0
  44. package/dist/packem_shared/cloudflareEmailProvider-D4adkOjA.js +1 -0
  45. package/dist/packem_shared/composeMiddleware-BHwLLEzK.js +1 -0
  46. package/dist/packem_shared/create-logger-BQTS3f-I.js +1 -0
  47. package/dist/packem_shared/createSuppressionStore-CeAZKCbY.js +1 -0
  48. package/dist/packem_shared/createTestEmail-BM3iNznm.js +1 -0
  49. package/dist/packem_shared/createWorker-_-yMWcNQ.js +1 -0
  50. package/dist/packem_shared/dedupeMiddleware-B6ajWOTi.js +1 -0
  51. package/dist/packem_shared/defineInboundHandler-CnL2BzlL.js +1 -0
  52. package/dist/packem_shared/defineProvider-C9q-7iwt.js +1 -0
  53. package/dist/packem_shared/detectMimeType-Dxv4MjZ7.js +1 -0
  54. package/dist/packem_shared/emailMatchers-DZDkrZ_3.js +1 -0
  55. package/dist/packem_shared/event-bus.d-DEl3w_EW.d.ts +104 -0
  56. package/dist/packem_shared/extractCidReferences-BuoTREMp.js +1 -0
  57. package/dist/packem_shared/extractReply-BUjIBt9A.js +5 -0
  58. package/dist/packem_shared/failoverProvider-BgX6zfnY.js +1 -0
  59. package/dist/packem_shared/format-address-DTl-9O70.js +1 -0
  60. package/dist/packem_shared/generate-boundary-DQbzDiOI.js +1 -0
  61. package/dist/packem_shared/generate-message-id-gXAuMz4g.js +1 -0
  62. package/dist/packem_shared/headers-to-record-De1Eg951.js +1 -0
  63. package/dist/packem_shared/httpProvider-DJAsYSun.js +1 -0
  64. package/dist/packem_shared/index-yDU-1zOZ.js +11 -0
  65. package/dist/packem_shared/infobipProvider-oOL-ThpP.js +1 -0
  66. package/dist/packem_shared/injectPreheader-CF9WHZ7J.js +1 -0
  67. package/dist/packem_shared/inlineCss-BQ7d2Cyz.js +1 -0
  68. package/dist/packem_shared/isValidSigningCertUrl-Bii1AMGC.js +3 -0
  69. package/dist/packem_shared/loggingMiddleware-CZIiVMVp.js +1 -0
  70. package/dist/packem_shared/loopsProvider-BXr0KSjB.js +1 -0
  71. package/dist/packem_shared/mail.d-B9SSqyy0.d.ts +909 -0
  72. package/dist/packem_shared/{mailCrabProvider-B7H6HwWu.js → mailCrabProvider-C7Ao5H9p.js} +1 -1
  73. package/dist/packem_shared/mailPaceProvider-DklGeGEM.js +1 -0
  74. package/dist/packem_shared/mailchannelsProvider-DPfQVzUd.js +1 -0
  75. package/dist/packem_shared/mailerSendProvider-B8iT5Uhb.js +1 -0
  76. package/dist/packem_shared/mailgunProvider-Ctyrs9d0.js +1 -0
  77. package/dist/packem_shared/mailjetProvider-v55nFDsr.js +1 -0
  78. package/dist/packem_shared/mailomatProvider-BCyB4Q4B.js +1 -0
  79. package/dist/packem_shared/mailtrapProvider-DcVw3sxR.js +1 -0
  80. package/dist/packem_shared/make-request-BlK_B72c.js +1 -0
  81. package/dist/packem_shared/mandrillProvider-gqMFMwgs.js +1 -0
  82. package/dist/packem_shared/mockProvider-Behywbl1.js +1 -0
  83. package/dist/packem_shared/nodemailerProvider-BFHobXxt.js +1 -0
  84. package/dist/packem_shared/normalizeMessageId-DAx2pGe2.js +1 -0
  85. package/dist/packem_shared/oauth2Middleware-CodqXkyj.js +1 -0
  86. package/dist/packem_shared/opentelemetryProvider-ByHC01ub.js +1 -0
  87. package/dist/packem_shared/parseAddress-DdbViBAJ.js +1 -0
  88. package/dist/packem_shared/parseArfReport-Ds6S3c4J.js +6 -0
  89. package/dist/packem_shared/parseCloudflareInbound-C__j-oNa.js +1 -0
  90. package/dist/packem_shared/parseDmarcRecord-DXZ-_rF0.js +1 -0
  91. package/dist/packem_shared/parseMailgunInbound-BpC6uPNe.js +1 -0
  92. package/dist/packem_shared/parsePostmarkInbound-Co3_c6-9.js +1 -0
  93. package/dist/packem_shared/parseSendGridInbound-DsALoijO.js +4 -0
  94. package/dist/packem_shared/parseSesInbound-CH5tHIjp.js +1 -0
  95. package/dist/packem_shared/parseTlsReport-wPe1lIDs.js +1 -0
  96. package/dist/packem_shared/plunkProvider-C0LO-1E3.js +1 -0
  97. package/dist/packem_shared/postProcessHtml-DqKi2Ucg.js +1 -0
  98. package/dist/packem_shared/postalProvider-B26IqgxE.js +1 -0
  99. package/dist/packem_shared/postmarkProvider-DWQJv5_M.js +1 -0
  100. package/dist/packem_shared/provider-base-gIoUu9so.js +1 -0
  101. package/dist/packem_shared/{provider.d-DcfYeGJJ.d.ts → provider.d-J-y6iogK.d.ts} +1 -1
  102. package/dist/packem_shared/quoted-printable-nSGDA1tA.js +7 -0
  103. package/dist/packem_shared/resendProvider-DhvKVyCD.js +1 -0
  104. package/dist/packem_shared/retry-3pnxTuNs.js +1 -0
  105. package/dist/packem_shared/retryMiddleware-DbViDX4r.js +1 -0
  106. package/dist/packem_shared/roundRobinProvider-D1by5KGW.js +1 -0
  107. package/dist/packem_shared/sanitize-header-DJhgZl3y.js +1 -0
  108. package/dist/packem_shared/scalewayProvider-D8dmHuwZ.js +1 -0
  109. package/dist/packem_shared/sendGridProvider-CChhLr7s.js +1 -0
  110. package/dist/packem_shared/smtpProvider-x4WBN-3W.js +25 -0
  111. package/dist/packem_shared/sweegoProvider-7xhOvagC.js +1 -0
  112. package/dist/packem_shared/toEmailSnapshot-DeRqM5SJ.js +1 -0
  113. package/dist/packem_shared/tracer.d-MU42G1jG.d.ts +494 -0
  114. package/dist/packem_shared/{types.d-CNnnk-Ya.d.ts → types.d-BId55FW2.d.ts} +6 -1
  115. package/dist/packem_shared/types.d-CmoWvdZi.d.ts +61 -0
  116. package/dist/packem_shared/types.d-DCkecJse.d.ts +51 -0
  117. package/dist/packem_shared/types.d-Mpu0HZoG.d.ts +24 -0
  118. package/dist/packem_shared/{types.d-wwpgA3to.d.ts → types.d-ejzh-xBP.d.ts} +6 -1
  119. package/dist/packem_shared/types.d-lcJZmwRK.d.ts +69 -0
  120. package/dist/packem_shared/utils-BfYfPB_I.js +1 -0
  121. package/dist/packem_shared/validate-email-options-mCM9dVug.js +1 -0
  122. package/dist/packem_shared/verifyMailgunWebhook-Cwl0OD3P.js +1 -0
  123. package/dist/packem_shared/verifyPostmarkWebhook-C72ZvbrG.js +1 -0
  124. package/dist/packem_shared/verifyResendWebhook-YK2zNDXR.js +1 -0
  125. package/dist/packem_shared/verifySendGridWebhook-Dbwc1tfG.js +1 -0
  126. package/dist/packem_shared/withEvents-CCVblSqj.js +1 -0
  127. package/dist/packem_shared/withMetrics-DWywX_6M.js +1 -0
  128. package/dist/packem_shared/withRender-VP9wE5Yr.js +1 -0
  129. package/dist/packem_shared/withSuppression-DBaZDMAr.js +1 -0
  130. package/dist/packem_shared/withTelemetry-DL2qo0Hp.js +1 -0
  131. package/dist/packem_shared/zeptomailProvider-D3nQKXRf.js +1 -0
  132. package/dist/providers/ahasend/index.d.ts +3 -3
  133. package/dist/providers/ahasend/index.js +1 -1
  134. package/dist/providers/aws-ses/index.d.ts +3 -3
  135. package/dist/providers/aws-ses/index.js +1 -1
  136. package/dist/providers/azure/index.d.ts +3 -3
  137. package/dist/providers/azure/index.js +1 -1
  138. package/dist/providers/brevo/index.d.ts +3 -3
  139. package/dist/providers/brevo/index.js +1 -1
  140. package/dist/providers/cloudflare-email/index.d.ts +36 -0
  141. package/dist/providers/cloudflare-email/index.js +1 -0
  142. package/dist/providers/failover/index.d.ts +3 -3
  143. package/dist/providers/failover/index.js +1 -1
  144. package/dist/providers/http/index.d.ts +3 -3
  145. package/dist/providers/http/index.js +1 -1
  146. package/dist/providers/infobip/index.d.ts +3 -3
  147. package/dist/providers/infobip/index.js +1 -1
  148. package/dist/providers/loops/index.d.ts +47 -0
  149. package/dist/providers/loops/index.js +1 -0
  150. package/dist/providers/mailchannels/index.d.ts +26 -0
  151. package/dist/providers/mailchannels/index.js +1 -0
  152. package/dist/providers/mailcrab/index.d.ts +3 -3
  153. package/dist/providers/mailcrab/index.js +1 -1
  154. package/dist/providers/mailersend/index.d.ts +3 -3
  155. package/dist/providers/mailersend/index.js +1 -1
  156. package/dist/providers/mailgun/index.d.ts +3 -3
  157. package/dist/providers/mailgun/index.js +1 -1
  158. package/dist/providers/mailjet/index.d.ts +3 -3
  159. package/dist/providers/mailjet/index.js +1 -1
  160. package/dist/providers/mailomat/index.d.ts +3 -3
  161. package/dist/providers/mailomat/index.js +1 -1
  162. package/dist/providers/mailpace/index.d.ts +3 -3
  163. package/dist/providers/mailpace/index.js +1 -1
  164. package/dist/providers/mailtrap/index.d.ts +3 -3
  165. package/dist/providers/mailtrap/index.js +1 -1
  166. package/dist/providers/mandrill/index.d.ts +3 -3
  167. package/dist/providers/mandrill/index.js +1 -1
  168. package/dist/providers/mock/index.d.ts +6 -53
  169. package/dist/providers/mock/index.js +1 -1
  170. package/dist/providers/nodemailer/index.d.ts +3 -3
  171. package/dist/providers/nodemailer/index.js +1 -1
  172. package/dist/providers/opentelemetry/index.d.ts +3 -495
  173. package/dist/providers/opentelemetry/index.js +1 -1
  174. package/dist/providers/plunk/index.d.ts +3 -3
  175. package/dist/providers/plunk/index.js +1 -1
  176. package/dist/providers/postal/index.d.ts +3 -3
  177. package/dist/providers/postal/index.js +1 -1
  178. package/dist/providers/postmark/index.d.ts +3 -3
  179. package/dist/providers/postmark/index.js +1 -1
  180. package/dist/providers/resend/index.d.ts +3 -3
  181. package/dist/providers/resend/index.js +1 -1
  182. package/dist/providers/roundrobin/index.d.ts +3 -3
  183. package/dist/providers/roundrobin/index.js +1 -1
  184. package/dist/providers/scaleway/index.d.ts +3 -3
  185. package/dist/providers/scaleway/index.js +1 -1
  186. package/dist/providers/sendgrid/index.d.ts +3 -3
  187. package/dist/providers/sendgrid/index.js +1 -1
  188. package/dist/providers/smtp/index.d.ts +3 -3
  189. package/dist/providers/smtp/index.js +1 -1
  190. package/dist/providers/sweego/index.d.ts +3 -3
  191. package/dist/providers/sweego/index.js +1 -1
  192. package/dist/providers/zeptomail/index.d.ts +3 -3
  193. package/dist/providers/zeptomail/index.js +1 -1
  194. package/dist/queue/bullmq-queue.d.ts +46 -0
  195. package/dist/queue/bullmq-queue.js +1 -0
  196. package/dist/queue/index.d.ts +147 -0
  197. package/dist/queue/index.js +1 -0
  198. package/dist/queue/pg-boss-queue.d.ts +41 -0
  199. package/dist/queue/pg-boss-queue.js +1 -0
  200. package/dist/queue/sqs-queue.d.ts +72 -0
  201. package/dist/queue/sqs-queue.js +1 -0
  202. package/dist/queue/unstorage-queue.d.ts +199 -0
  203. package/dist/queue/unstorage-queue.js +1 -0
  204. package/dist/render/index.d.ts +107 -0
  205. package/dist/render/index.js +1 -0
  206. package/dist/template-engines/handlebars.js +1 -1
  207. package/dist/template-engines/html-to-text.js +1 -1
  208. package/dist/template-engines/i18n.d.ts +61 -0
  209. package/dist/template-engines/i18n.js +1 -0
  210. package/dist/template-engines/jsx-email.d.ts +11 -0
  211. package/dist/template-engines/jsx-email.js +1 -0
  212. package/dist/template-engines/liquid.d.ts +12 -0
  213. package/dist/template-engines/liquid.js +1 -0
  214. package/dist/template-engines/mjml.js +1 -1
  215. package/dist/template-engines/react-email.js +1 -1
  216. package/dist/template-engines/vue-email.js +1 -1
  217. package/dist/test/index.d.ts +159 -0
  218. package/dist/test/index.js +1 -0
  219. package/dist/utils/cache.js +1 -1
  220. package/dist/utils/format-email-address.d.ts +1 -1
  221. package/dist/utils/format-email-address.js +1 -1
  222. package/dist/utils/normalize-email-aliases.js +1 -1
  223. package/dist/utils/parse-address.d.ts +1 -1
  224. package/dist/utils/parse-address.js +1 -1
  225. package/dist/utils/parse-eml.d.ts +22 -0
  226. package/dist/utils/parse-eml.js +6 -0
  227. package/dist/utils/result.d.ts +49 -0
  228. package/dist/utils/result.js +1 -0
  229. package/dist/utils/validation/check-feature-support.d.ts +1 -1
  230. package/dist/utils/validation/check-feature-support.js +1 -1
  231. package/dist/utils/validation/check-mx-records.d.ts +1 -1
  232. package/dist/utils/validation/check-mx-records.js +1 -1
  233. package/dist/utils/validation/role-accounts.js +1 -1
  234. package/dist/utils/validation/validate-email.js +1 -1
  235. package/dist/utils/validation/verify-email.js +1 -1
  236. package/dist/utils/validation/verify-smtp.js +4 -4
  237. package/dist/webhooks/index.d.ts +231 -0
  238. package/dist/webhooks/index.js +1 -0
  239. package/package.json +122 -6
  240. package/dist/packem_shared/DkimSigner-CT2DSHD1.js +0 -18
  241. package/dist/packem_shared/EmailError-zm2ffVav.js +0 -1
  242. package/dist/packem_shared/Mail-BWSWWq6m.js +0 -1
  243. package/dist/packem_shared/MailMessage-BvaH5tZZ.js +0 -1
  244. package/dist/packem_shared/RequiredOptionError-CevW3u2K.js +0 -1
  245. package/dist/packem_shared/SmimeEncrypter-ZhHEgDwY.js +0 -6
  246. package/dist/packem_shared/SmimeSigner-CYSVF6ez.js +0 -8
  247. package/dist/packem_shared/address-formatter-Cm_E_ZMa.js +0 -1
  248. package/dist/packem_shared/aggregate-features-BvgdYul-.js +0 -1
  249. package/dist/packem_shared/ahaSendProvider-DOAAW65O.js +0 -1
  250. package/dist/packem_shared/attachment-processor-DsmIomKc.js +0 -1
  251. package/dist/packem_shared/awsSesProvider-DX1630Ms.js +0 -32
  252. package/dist/packem_shared/azureProvider-EkNYKAiF.js +0 -1
  253. package/dist/packem_shared/brevoProvider-CkR4U4RD.js +0 -1
  254. package/dist/packem_shared/build-mime-message-6xstxaUV.js +0 -2
  255. package/dist/packem_shared/create-logger-BiWdqFNg.js +0 -1
  256. package/dist/packem_shared/defineProvider-CtLH0VBE.js +0 -1
  257. package/dist/packem_shared/detectMimeType-bo5oxfnt.js +0 -1
  258. package/dist/packem_shared/failoverProvider-D90MHT2T.js +0 -1
  259. package/dist/packem_shared/generate-boundary-Cx8nXYS0.js +0 -1
  260. package/dist/packem_shared/generate-message-id-D4uA8gkj.js +0 -1
  261. package/dist/packem_shared/headers-to-record-Qo124ImV.js +0 -1
  262. package/dist/packem_shared/httpProvider-DUg1AQfO.js +0 -1
  263. package/dist/packem_shared/infobipProvider-BhTsWi7e.js +0 -1
  264. package/dist/packem_shared/mailPaceProvider-DRt6Z9Hr.js +0 -1
  265. package/dist/packem_shared/mailerSendProvider-Dx_iHInH.js +0 -1
  266. package/dist/packem_shared/mailgunProvider-ChkLGZZW.js +0 -1
  267. package/dist/packem_shared/mailjetProvider-BMRhNe6H.js +0 -1
  268. package/dist/packem_shared/mailomatProvider-CydV-JB6.js +0 -1
  269. package/dist/packem_shared/mailtrapProvider-CuAfJWDr.js +0 -1
  270. package/dist/packem_shared/make-request-CaT4d5oC.js +0 -1
  271. package/dist/packem_shared/mandrillProvider-BBeLbaw0.js +0 -1
  272. package/dist/packem_shared/mockProvider-C0P1lKOy.js +0 -1
  273. package/dist/packem_shared/nodemailerProvider-DFcvoVFv.js +0 -1
  274. package/dist/packem_shared/opentelemetryProvider-Dwv88G3O.js +0 -1
  275. package/dist/packem_shared/plunkProvider-BQyjG6YT.js +0 -1
  276. package/dist/packem_shared/postalProvider-DPHQ620q.js +0 -1
  277. package/dist/packem_shared/postmarkProvider-bMTC2gdJ.js +0 -1
  278. package/dist/packem_shared/provider-base-Cmzx6BTO.js +0 -1
  279. package/dist/packem_shared/readFile-BAVMZg5e-C4whBIPd.js +0 -1
  280. package/dist/packem_shared/resendProvider-Cns1tvF5.js +0 -1
  281. package/dist/packem_shared/roundRobinProvider-B_60F0BC.js +0 -1
  282. package/dist/packem_shared/sanitize-header-wWav-Scu.js +0 -1
  283. package/dist/packem_shared/scalewayProvider-O1dHz7iJ.js +0 -1
  284. package/dist/packem_shared/sendGridProvider-DmywC-eT.js +0 -1
  285. package/dist/packem_shared/smtpProvider-Unjao_fn.js +0 -23
  286. package/dist/packem_shared/sweegoProvider-D086G6xG.js +0 -1
  287. package/dist/packem_shared/validate-email-options-DPo3SgC0.js +0 -1
  288. package/dist/packem_shared/zeptomailProvider-DKKEpEsW.js +0 -1
@@ -0,0 +1,61 @@
1
+ import { T as TemplateRenderer } from "../packem_shared/types.d-nyR1ty1Q.js";
2
+ /**
3
+ * A map of locale code (e.g. `en`, `en-US`, `de`) to that locale's template.
4
+ *
5
+ * The template value is whatever the underlying {@link TemplateRenderer} accepts (a string for
6
+ * Handlebars/MJML/Liquid, a component for react-email/jsx-email, etc.).
7
+ */
8
+ type LocaleTemplates = Record<string, unknown>;
9
+ /**
10
+ * Options for {@link renderI18n} and {@link createI18nRenderer}.
11
+ */
12
+ interface I18nRenderOptions {
13
+ /**
14
+ * Locale to fall back to when the requested locale (and its language root) is missing.
15
+ */
16
+ defaultLocale?: string;
17
+ /**
18
+ * Options forwarded to the underlying renderer.
19
+ */
20
+ rendererOptions?: Record<string, unknown>;
21
+ }
22
+ /**
23
+ * Resolves the best-matching available locale key: exact match, then the language subtag
24
+ * (`en-US` → `en`), then the default locale.
25
+ * @param templates The available locale templates.
26
+ * @param locale The requested locale.
27
+ * @param defaultLocale Optional fallback locale.
28
+ * @returns The matching key, or `undefined` when nothing matches.
29
+ */
30
+ declare const resolveLocale: (templates: LocaleTemplates, locale: string, defaultLocale?: string) => string | undefined;
31
+ /**
32
+ * Renders the template for a given locale using the supplied engine, with locale fallback.
33
+ * @param templates The per-locale templates. See {@link LocaleTemplates}.
34
+ * @param locale The requested locale (e.g. `de-AT`).
35
+ * @param renderer The underlying template engine (Handlebars, MJML, Liquid, react-email, …).
36
+ * @param data Data/variables passed to the renderer.
37
+ * @param options Fallback locale and renderer options. See {@link I18nRenderOptions}.
38
+ * @returns The rendered output for the resolved locale.
39
+ * @throws {EmailError} When no template matches the locale or the fallback.
40
+ */
41
+ declare const renderI18n: (templates: LocaleTemplates, locale: string, renderer: TemplateRenderer, data?: Record<string, unknown>, options?: I18nRenderOptions) => Promise<string>;
42
+ /**
43
+ * A locale-resolving renderer produced by {@link createI18nRenderer}.
44
+ */
45
+ type LocalizedRenderer = (templates: LocaleTemplates, locale: string, data?: Record<string, unknown>, rendererOptions?: Record<string, unknown>) => Promise<string>;
46
+ /**
47
+ * Creates a reusable localized renderer bound to an engine and default locale.
48
+ * @param renderer The underlying template engine.
49
+ * @param defaultLocale Optional default/fallback locale applied to every call.
50
+ * @returns A {@link LocalizedRenderer}.
51
+ * @example
52
+ * ```ts
53
+ * import { renderHandlebars } from "@visulima/email/template/handlebars";
54
+ * import { createI18nRenderer } from "@visulima/email/template/i18n";
55
+ *
56
+ * const render = createI18nRenderer(renderHandlebars, "en");
57
+ * await render({ en: "Hello {{name}}", de: "Hallo {{name}}" }, "de", { name: "Ada" });
58
+ * ```
59
+ */
60
+ declare const createI18nRenderer: (renderer: TemplateRenderer, defaultLocale?: string) => LocalizedRenderer;
61
+ export { I18nRenderOptions, LocaleTemplates, LocalizedRenderer, createI18nRenderer, renderI18n, resolveLocale };
@@ -0,0 +1 @@
1
+ import l from"../packem_shared/EmailError-B-sEf3bp.js";const c=(t,r,a)=>{const n=new Map(Object.keys(t).map(o=>[o.toLowerCase(),o])),e=o=>{if(o!==void 0)return n.get(o.toLowerCase())};return e(r)??e(r.split("-")[0])??e(a)},d=async(t,r,a,n,e)=>{const o=c(t,r,e?.defaultLocale);if(o===void 0)throw new l("i18n",`No template found for locale "${r}"${e?.defaultLocale?` or default "${e.defaultLocale}"`:""}`);return await a(t[o],n,e?.rendererOptions)},f=(t,r)=>(a,n,e,o)=>d(a,n,t,e,{defaultLocale:r,rendererOptions:o});export{f as createI18nRenderer,d as renderI18n,c as resolveLocale};
@@ -0,0 +1,11 @@
1
+ import { T as TemplateRenderer } from "../packem_shared/types.d-nyR1ty1Q.js";
2
+ /**
3
+ * Renders a [jsx-email](https://jsx.email/) component to HTML.
4
+ * @param template The jsx-email component element to render.
5
+ * @param _data Data object (unused; jsx-email components receive props directly).
6
+ * @param options Render options (`plainText`, `pretty`).
7
+ * @returns The rendered HTML (or plain text) string.
8
+ * @throws {EmailError} When `jsx-email` is not installed or rendering fails.
9
+ */
10
+ declare const jsxEmail: TemplateRenderer;
11
+ export { jsxEmail as default };
@@ -0,0 +1 @@
1
+ import t from"../packem_shared/EmailError-B-sEf3bp.js";const l=async(n,s,a)=>{try{const{render:e}=await import("jsx-email");return await e(n,{plainText:a?.plainText,pretty:a?.pretty})}catch(e){throw e instanceof Error&&(e.code==="ERR_MODULE_NOT_FOUND"||e.message.includes("Cannot find module")||e.message.includes("Cannot find package"))?new t("jsx-email","jsx-email is not installed. Please install it: pnpm add jsx-email",{cause:e}):new t("jsx-email",`Failed to render jsx-email component: ${e.message}`,{cause:e})}};export{l as default};
@@ -0,0 +1,12 @@
1
+ import { T as TemplateRenderer } from "../packem_shared/types.d-nyR1ty1Q.js";
2
+ /**
3
+ * Renders a [LiquidJS](https://liquidjs.com/) template to a string.
4
+ * @param template The Liquid template string.
5
+ * @param data The data/variables exposed to the template.
6
+ * @param options LiquidJS engine options (passed to the `Liquid` constructor).
7
+ * @returns The rendered output.
8
+ * @throws {TypeError} When the template is not a string.
9
+ * @throws {EmailError} When `liquidjs` is not installed or rendering fails.
10
+ */
11
+ declare const liquid: TemplateRenderer;
12
+ export { liquid as default };
@@ -0,0 +1 @@
1
+ import t from"../packem_shared/EmailError-B-sEf3bp.js";const r=async(i,a,n)=>{try{if(typeof i!="string")throw new TypeError("Liquid template must be a string");const{Liquid:e}=await import("liquidjs");return await new e(n??{}).parseAndRender(i,a??{})}catch(e){throw e instanceof TypeError?e:e instanceof Error&&(e.code==="ERR_MODULE_NOT_FOUND"||e.message.includes("Cannot find module")||e.message.includes("Cannot find package"))?new t("liquid","liquidjs is not installed. Please install it: pnpm add liquidjs",{cause:e}):new t("liquid",`Failed to render Liquid template: ${e.message}`,{cause:e})}};export{r as default};
@@ -1 +1 @@
1
- var i=Object.defineProperty;var a=(t,o)=>i(t,"name",{value:o,configurable:!0});import l from"mjml";import r from"../packem_shared/EmailError-zm2ffVav.js";var f=Object.defineProperty,d=a((t,o)=>f(t,"name",{value:o,configurable:!0}),"o");const v=d((t,o,n)=>{try{if(typeof t!="string")throw new TypeError("MJML template must be a string");const e=l(t,{beautify:n?.beautify??!1,fonts:n?.fonts,keepComments:n?.keepComments??!0,minify:n?.minify??!1,validationLevel:n?.validationLevel??"soft"});if(e.errors&&e.errors.length>0){const s=e.errors.map(m=>m.message).join("; ");throw new r("mjml",`MJML validation errors: ${s}`)}return e.html}catch(e){throw e instanceof Error&&e.message.includes("Cannot find module")?new r("mjml","MJML is not installed. Please install it: pnpm add mjml",{cause:e}):e instanceof r?e:new r("mjml",`Failed to render MJML: ${e.message}`,{cause:e})}},"mjml");export{v as default};
1
+ import r from"mjml";import n from"../packem_shared/EmailError-B-sEf3bp.js";const f=(s,i,t)=>{try{if(typeof s!="string")throw new TypeError("MJML template must be a string");const e=r(s,{beautify:t?.beautify??!1,fonts:t?.fonts,keepComments:t?.keepComments??!0,minify:t?.minify??!1,validationLevel:t?.validationLevel??"soft"});if(e.errors&&e.errors.length>0){const o=e.errors.map(a=>a.message).join("; ");throw new n("mjml",`MJML validation errors: ${o}`)}return e.html}catch(e){throw e instanceof Error&&e.message.includes("Cannot find module")?new n("mjml","MJML is not installed. Please install it: pnpm add mjml",{cause:e}):e instanceof n?e:new n("mjml",`Failed to render MJML: ${e.message}`,{cause:e})}};export{f as default};
@@ -1 +1 @@
1
- var l=Object.defineProperty;var n=(e,t)=>l(e,"name",{value:t,configurable:!0});import{render as c}from"@react-email/render";import i from"../packem_shared/EmailError-zm2ffVav.js";var o=Object.defineProperty,m=n((e,t)=>o(e,"name",{value:t,configurable:!0}),"t");const u=m(async(e,t,r)=>{try{return await c(e,{plainText:r?.plainText,pretty:r?.pretty})}catch(a){throw a instanceof Error&&a.message.includes("Cannot find module")?new i("react-email","@react-email/render is not installed. Please install it: pnpm add @react-email/render",{cause:a}):new i("react-email",`Failed to render React Email component: ${a.message}`,{cause:a})}},"reactEmail");export{u as default};
1
+ import{render as n}from"@react-email/render";import a from"../packem_shared/EmailError-B-sEf3bp.js";const s=async(r,i,t)=>{try{return await n(r,{plainText:t?.plainText,pretty:t?.pretty})}catch(e){throw e instanceof Error&&e.message.includes("Cannot find module")?new a("react-email","@react-email/render is not installed. Please install it: pnpm add @react-email/render",{cause:e}):new a("react-email",`Failed to render React Email component: ${e.message}`,{cause:e})}};export{s as default};
@@ -1 +1 @@
1
- var l=Object.defineProperty;var r=(e,a)=>l(e,"name",{value:a,configurable:!0});import{render as o}from"@vue-email/render";import i from"../packem_shared/EmailError-zm2ffVav.js";var m=Object.defineProperty,s=r((e,a)=>m(e,"name",{value:a,configurable:!0}),"a");const c=s(async(e,a,n)=>{try{return await o(e,a??{},{htmlToTextOptions:n?.htmlToTextOptions,plainText:n?.plainText,pretty:n?.pretty})}catch(t){throw t instanceof Error&&t.message.includes("Cannot find module")?new i("vue-email","@vue-email/render is not installed. Please install it: pnpm add @vue-email/render",{cause:t}):new i("vue-email",`Failed to render Vue Email component: ${t.message}`,{cause:t})}},"vueEmail");export{c as default};
1
+ import{render as i}from"@vue-email/render";import a from"../packem_shared/EmailError-B-sEf3bp.js";const s=async(n,r,t)=>{try{return await i(n,r??{},{htmlToTextOptions:t?.htmlToTextOptions,plainText:t?.plainText,pretty:t?.pretty})}catch(e){throw e instanceof Error&&e.message.includes("Cannot find module")?new a("vue-email","@vue-email/render is not installed. Please install it: pnpm add @vue-email/render",{cause:e}):new a("vue-email",`Failed to render Vue Email component: ${e.message}`,{cause:e})}};export{s as default};
@@ -0,0 +1,159 @@
1
+ import { a as MockEmailEntry } from "../packem_shared/types.d-DCkecJse.js";
2
+ import { E as EmailOptions } from "../packem_shared/types.d-ejzh-xBP.js";
3
+ import { M as Mail } from "../packem_shared/mail.d-B9SSqyy0.js";
4
+ import 'node:buffer';
5
+ import 'ical-generator';
6
+ import 'node:crypto';
7
+ import "../packem_shared/types.d-BId55FW2.js";
8
+ import "../packem_shared/types.d-nyR1ty1Q.js";
9
+ import "../packem_shared/types.d-Mpu0HZoG.js";
10
+ import "../packem_shared/provider.d-J-y6iogK.js";
11
+ /**
12
+ * A test harness around the in-memory mock provider: a ready-to-use {@link Mail} instance plus
13
+ * helpers to inspect, wait on, and reset the captured outbox.
14
+ */
15
+ interface TestEmail {
16
+ /**
17
+ * The {@link Mail} instance wired to the mock provider. Use it exactly like a real one.
18
+ */
19
+ mail: Mail;
20
+ /**
21
+ * Removes all captured messages.
22
+ */
23
+ reset: () => void;
24
+ /**
25
+ * Returns the captured messages, oldest first.
26
+ */
27
+ sent: () => ReadonlyArray<MockEmailEntry>;
28
+ /**
29
+ * Resolves with the first captured message matching `predicate`, polling until `timeout`.
30
+ * @param predicate The match condition.
31
+ * @param options Optional `timeout` (ms, default 1000) and `interval` (ms, default 10).
32
+ * @param options.interval Poll interval in milliseconds.
33
+ * @param options.timeout Maximum time to wait in milliseconds.
34
+ */
35
+ waitFor: (predicate: (message: MockEmailEntry) => boolean, options?: {
36
+ interval?: number;
37
+ timeout?: number;
38
+ }) => Promise<MockEmailEntry>;
39
+ }
40
+ /**
41
+ * Creates a {@link TestEmail} harness backed by the in-memory mock provider.
42
+ *
43
+ * Nothing is sent over the network; every message is captured for assertion via the
44
+ * {@link https://vitest.dev/ Vitest} matchers exported from `@visulima/email/test`.
45
+ * @returns The test harness. See {@link TestEmail}.
46
+ * @example
47
+ * ```ts
48
+ * const email = createTestEmail();
49
+ * await email.mail.send({ from: { email: "a@x.com" }, to: { email: "b@x.com" }, subject: "Hi", text: "yo" });
50
+ * expect(email).toHaveSentTo("b@x.com");
51
+ * ```
52
+ */
53
+ declare const createTestEmail: () => TestEmail;
54
+ /**
55
+ * The minimal result shape a Vitest/Jest matcher must return.
56
+ */
57
+ interface MatcherResult {
58
+ message: () => string;
59
+ pass: boolean;
60
+ }
61
+ /**
62
+ * A value the email matchers can assert against: a {@link TestEmail} harness or a raw list of captured
63
+ * entries.
64
+ */
65
+ type MatcherTarget = ReadonlyArray<MockEmailEntry> | TestEmail;
66
+ /**
67
+ * Asserts that at least one captured message was addressed to `address` (in To, Cc, or Bcc).
68
+ * @param target The {@link TestEmail} harness or captured entries.
69
+ * @param address The recipient address to look for (case-insensitive).
70
+ * @returns The matcher result.
71
+ */
72
+ declare const toHaveSentTo: (target: MatcherTarget, address: string) => MatcherResult;
73
+ /**
74
+ * Asserts that at least one captured message has a subject equal to (or matching) `expected`.
75
+ * @param target The {@link TestEmail} harness or captured entries.
76
+ * @param expected An exact subject string or a `RegExp`.
77
+ * @returns The matcher result.
78
+ */
79
+ declare const toHaveSentWithSubject: (target: MatcherTarget, expected: RegExp | string) => MatcherResult;
80
+ /**
81
+ * Asserts that at least one captured message carried an attachment (optionally with a given filename).
82
+ * @param target The {@link TestEmail} harness or captured entries.
83
+ * @param filename When provided, requires an attachment with this exact filename.
84
+ * @returns The matcher result.
85
+ */
86
+ declare const toHaveSentWithAttachment: (target: MatcherTarget, filename?: string) => MatcherResult;
87
+ /**
88
+ * Asserts that at least one captured message matches a predicate or a partial {@link EmailOptions}.
89
+ * @param target The {@link TestEmail} harness or captured entries.
90
+ * @param matcher A predicate over the sent options, or a partial options object to shallow-match.
91
+ * @returns The matcher result.
92
+ */
93
+ declare const toHaveSentMatching: (target: MatcherTarget, matcher: Partial<EmailOptions> | ((options: EmailOptions) => boolean)) => MatcherResult;
94
+ /**
95
+ * The matcher map, suitable for passing to Vitest/Jest `expect.extend(...)`.
96
+ */
97
+ declare const emailMatchers: {
98
+ toHaveSentMatching: typeof toHaveSentMatching;
99
+ toHaveSentTo: typeof toHaveSentTo;
100
+ toHaveSentWithAttachment: typeof toHaveSentWithAttachment;
101
+ toHaveSentWithSubject: typeof toHaveSentWithSubject;
102
+ };
103
+ /**
104
+ * The shape of the {@link emailMatchers} map.
105
+ */
106
+
107
+ /**
108
+ * A Vitest/Jest-compatible `expect` exposing `.extend(...)`.
109
+ */
110
+ interface ExpectLike {
111
+ extend: (matchers: Record<string, unknown>) => void;
112
+ }
113
+ /**
114
+ * Registers the email matchers with a Vitest/Jest-compatible `expect`.
115
+ *
116
+ * Kept dependency-free by accepting `expect` as an argument rather than importing `vitest` into the
117
+ * shipped bundle. Add the matching type augmentation to a `vitest.d.ts` in your project for typed
118
+ * `expect(...).toHaveSentTo(...)` calls.
119
+ * @param expectInstance The `expect` object exposing `.extend(...)`.
120
+ * @example
121
+ * ```ts
122
+ * import { expect } from "vitest";
123
+ * import { registerEmailMatchers } from "@visulima/email/test";
124
+ *
125
+ * registerEmailMatchers(expect);
126
+ * ```
127
+ */
128
+ declare const registerEmailMatchers: (expectInstance: ExpectLike) => void;
129
+ /**
130
+ * A stable, snapshot-friendly view of a sent message — volatile fields (message id, timestamp) are
131
+ * omitted so the snapshot doesn't churn between runs.
132
+ */
133
+ interface EmailSnapshot {
134
+ attachments?: {
135
+ contentType?: string;
136
+ filename: string;
137
+ }[];
138
+ bcc?: string[];
139
+ cc?: string[];
140
+ from: string;
141
+ headers?: Record<string, string>;
142
+ html?: string;
143
+ replyTo?: string;
144
+ subject: string;
145
+ text?: string;
146
+ to: string[];
147
+ }
148
+ /**
149
+ * Normalizes a captured message (a `createTestEmail` outbox entry or raw {@link EmailOptions}) into a
150
+ * deterministic {@link EmailSnapshot} for use with Vitest/Jest `toMatchSnapshot()`.
151
+ * @param source A mock-provider outbox entry or an `EmailOptions` object.
152
+ * @returns The snapshot view.
153
+ * @example
154
+ * ```ts
155
+ * expect(toEmailSnapshot(email.sent()[0])).toMatchSnapshot();
156
+ * ```
157
+ */
158
+ declare const toEmailSnapshot: (source: EmailOptions | MockEmailEntry) => EmailSnapshot;
159
+ export { type EmailSnapshot, type MatcherResult, type MatcherTarget, type TestEmail, createTestEmail, emailMatchers, registerEmailMatchers, toEmailSnapshot, toHaveSentMatching, toHaveSentTo, toHaveSentWithAttachment, toHaveSentWithSubject };
@@ -0,0 +1 @@
1
+ import{emailMatchers as a,registerEmailMatchers as o,toHaveSentMatching as r,toHaveSentTo as i,toHaveSentWithAttachment as m,toHaveSentWithSubject as h}from"../packem_shared/emailMatchers-DZDkrZ_3.js";import{toEmailSnapshot as c}from"../packem_shared/toEmailSnapshot-DeRqM5SJ.js";import{createTestEmail as s}from"../packem_shared/createTestEmail-BM3iNznm.js";export{s as createTestEmail,a as emailMatchers,o as registerEmailMatchers,c as toEmailSnapshot,r as toHaveSentMatching,i as toHaveSentTo,m as toHaveSentWithAttachment,h as toHaveSentWithSubject};
@@ -1 +1 @@
1
- var h=Object.defineProperty;var r=(c,e)=>h(c,"name",{value:e,configurable:!0});import{LRUCache as n}from"lru-cache";var l=Object.defineProperty,t=r((c,e)=>l(c,"name",{value:e,configurable:!0}),"t");class m{static{r(this,"InMemoryCache")}static{t(this,"InMemoryCache")}cache;constructor(e={}){const{max:a=500,ttl:s=36e5}=e;this.cache=new n({max:a,ttl:s})}clear=t(async()=>{this.cache.clear()},"clear");delete=t(async e=>{this.cache.delete(e)},"delete");get=t(async e=>this.cache.get(e),"get");set=t(async(e,a,s)=>{this.cache.set(e,a,{ttl:s})},"set")}export{m as InMemoryCache};
1
+ import{LRUCache as a}from"lru-cache";class l{cache;constructor(c={}){const{max:e=500,ttl:t=36e5}=c;this.cache=new a({max:e,ttl:t})}clear=async()=>{this.cache.clear()};delete=async c=>{this.cache.delete(c)};get=async c=>this.cache.get(c);set=async(c,e,t)=>{this.cache.set(c,e,{ttl:t})}}export{l as InMemoryCache};
@@ -1,4 +1,4 @@
1
- import { b as EmailAddress } from "../packem_shared/types.d-wwpgA3to.js";
1
+ import { c as EmailAddress } from "../packem_shared/types.d-ejzh-xBP.js";
2
2
  import 'node:buffer';
3
3
  /**
4
4
  * Formats an email address as "Name &lt;email@example.com>" or just "email@example.com" if no name is provided.
@@ -1 +1 @@
1
- var m=Object.defineProperty;var r=(e,a)=>m(e,"name",{value:a,configurable:!0});import o from"../packem_shared/EmailError-zm2ffVav.js";import{s as l}from"../packem_shared/sanitize-header-wWav-Scu.js";import t from"./validation/validate-email.js";var i=Object.defineProperty,n=r((e,a)=>i(e,"name",{value:a,configurable:!0}),"m");const p=n(e=>{if(!t(e.email))throw new o("email",`Invalid email address: ${e.email}`);return e.name?`${l(e.name)} <${e.email}>`:e.email},"formatEmailAddress");export{p as default};
1
+ import{s as m}from"../packem_shared/format-address-DTl-9O70.js";import r from"../packem_shared/EmailError-B-sEf3bp.js";import i from"./validation/validate-email.js";const n=a=>{if(!i(a.email))throw new r("email",`Invalid email address: ${a.email}`);if(a.name){const e=m(a.name);if(e)return`"${e}" <${a.email}>`}return a.email};export{n as default};
@@ -1 +1 @@
1
- var a=Object.defineProperty;var l=(o,e)=>a(o,"name",{value:e,configurable:!0});var g=Object.defineProperty,u=l((o,e)=>g(o,"name",{value:e,configurable:!0}),"m");const c=new Map([["fastmail.com",{domain:"fastmail.com",ignoreDots:!1,ignorePlus:!0}],["gmail.com",{domain:"gmail.com",ignoreDots:!0,ignorePlus:!0}],["gmx.com",{domain:"gmx.com",ignoreDots:!1,ignorePlus:!0}],["gmx.de",{domain:"gmx.de",ignoreDots:!1,ignorePlus:!0}],["gmx.net",{domain:"gmx.net",ignoreDots:!1,ignorePlus:!0}],["hotmail.com",{domain:"hotmail.com",ignoreDots:!1,ignorePlus:!0}],["icloud.com",{domain:"icloud.com",ignoreDots:!1,ignorePlus:!0}],["live.com",{domain:"live.com",ignoreDots:!1,ignorePlus:!0}],["mail.com",{domain:"mail.com",ignoreDots:!1,ignorePlus:!0}],["msn.com",{domain:"msn.com",ignoreDots:!1,ignorePlus:!0}],["outlook.com",{domain:"outlook.com",ignoreDots:!1,ignorePlus:!0}],["protonmail.com",{domain:"protonmail.com",ignoreDots:!1,ignorePlus:!0}],["yahoo.com",{domain:"yahoo.com",ignoreDots:!1,ignorePlus:!0}],["zoho.com",{domain:"zoho.com",ignoreDots:!1,ignorePlus:!0}]]),d=u(o=>{if(!o||typeof o!="string")return o;const e=o.trim().toLowerCase(),n=e.indexOf("@");if(n===-1||n===0||n===e.length-1)return o;const m=e.slice(0,n),r=e.slice(n+1);if(!m||!r)return o;const t=c.get(r);if(!t)return e;let i=m;if(t.ignorePlus){const s=i.indexOf("+");s!==-1&&(i=i.slice(0,s))}return t.ignoreDots&&(i=i.replaceAll(".","")),`${i}@${r}`},"normalizeEmailAliases");export{d as default};
1
+ const l=new Map([["fastmail.com",{domain:"fastmail.com",ignoreDots:!1,ignorePlus:!0}],["gmail.com",{domain:"gmail.com",ignoreDots:!0,ignorePlus:!0}],["gmx.com",{domain:"gmx.com",ignoreDots:!1,ignorePlus:!0}],["gmx.de",{domain:"gmx.de",ignoreDots:!1,ignorePlus:!0}],["gmx.net",{domain:"gmx.net",ignoreDots:!1,ignorePlus:!0}],["hotmail.com",{domain:"hotmail.com",ignoreDots:!1,ignorePlus:!0}],["icloud.com",{domain:"icloud.com",ignoreDots:!1,ignorePlus:!0}],["live.com",{domain:"live.com",ignoreDots:!1,ignorePlus:!0}],["mail.com",{domain:"mail.com",ignoreDots:!1,ignorePlus:!0}],["msn.com",{domain:"msn.com",ignoreDots:!1,ignorePlus:!0}],["outlook.com",{domain:"outlook.com",ignoreDots:!1,ignorePlus:!0}],["protonmail.com",{domain:"protonmail.com",ignoreDots:!1,ignorePlus:!0}],["yahoo.com",{domain:"yahoo.com",ignoreDots:!1,ignorePlus:!0}],["zoho.com",{domain:"zoho.com",ignoreDots:!1,ignorePlus:!0}]]),a=o=>{if(!o||typeof o!="string")return o;const i=o.trim().toLowerCase(),n=i.indexOf("@");if(n===-1||n===0||n===i.length-1)return o;const s=i.slice(0,n),r=i.slice(n+1);if(!s||!r)return o;const t=l.get(r);if(!t)return i;let e=s;if(t.ignorePlus){const m=e.indexOf("+");m!==-1&&(e=e.slice(0,m))}return t.ignoreDots&&(e=e.replaceAll(".","")),`${e}@${r}`};export{a as default};
@@ -1,4 +1,4 @@
1
- import { b as EmailAddress } from "../packem_shared/types.d-wwpgA3to.js";
1
+ import { c as EmailAddress } from "../packem_shared/types.d-ejzh-xBP.js";
2
2
  import 'node:buffer';
3
3
  /**
4
4
  * Parses a string representation of an email address into an EmailAddress object.
@@ -1 +1 @@
1
- var m=Object.defineProperty;var o=(t,e)=>m(t,"name",{value:e,configurable:!0});import d from"./validation/validate-email.js";var h=Object.defineProperty,c=o((t,e)=>h(t,"name",{value:e,configurable:!0}),"l");const g=c(t=>{const e=t.replace(/^"(.+)"$/,"$1");return!(!e||e.length===0||e.includes("..")||e.startsWith(".")||e.endsWith("."))},"isValidLocalPart"),a=c(t=>{const e=t.indexOf("@[");if(e>0&&t.endsWith("]")){const n=t.length-1,l=t.slice(e+2,n);if(l.includes("@["))return!1;const i=t.slice(0,e),s=l;return!s||s.trim().length===0||s.includes("]")?!1:i?g(i):!1}if(t.includes("@[")&&!t.includes("]"))return!1;const r=t.match(/^"((?:[^"\\]|\\.)+)"@(.+)$/);if(r?.[2]){const n=r[2];return n.startsWith("[")?!1:d(`test@${n}`)}return d(t)},"isValidEmailFormat"),$=c(t=>{if(!t||typeof t!="string")return;const e=t.trim();if(!e)return;const r=e.lastIndexOf("<"),n=e.lastIndexOf(">");if(r!==-1&&n>r){const i=e.slice(0,r).trim(),s=e.slice(r+1,n).trim();if(s&&a(s)){if(i){const f=i.replace(/^"(.+)"$/,"$1");return{email:s,name:f}}return{email:s}}}const l=e.match(/^<([^>]+)>$/);if(l?.[1]){const i=l[1].trim();return a(i)?{email:i}:void 0}if(!(e.includes("]")&&!e.includes("@["))&&!(e.includes('"')&&!e.startsWith('"')&&e.indexOf('"')<e.indexOf("@"))){if(e.startsWith('"')){let i=1,s=!1;for(;i<e.length;)if(e[i]==="\\"&&i+1<e.length)i+=2;else if(e[i]==='"'){if(i+1<e.length&&e[i+1]==="@"){s=!0;break}i+=1}else i+=1;if(!s&&e.includes("@")){const f=e.indexOf("@"),u=e.slice(1).indexOf('"');if(u===-1||f<u+1)return}}if(a(e))return{email:e}}},"parseAddress");export{$ as default};
1
+ import u from"./validation/validate-email.js";const d=i=>{const e=i.replace(/^"(.+)"$/,"$1");return!(!e||e.length===0||e.includes("..")||e.startsWith(".")||e.endsWith("."))},c=i=>{const e=i.indexOf("@[");if(e>0&&i.endsWith("]")){const n=i.length-1,l=i.slice(e+2,n);if(l.includes("@["))return!1;const t=i.slice(0,e),s=l;return!s||s.trim().length===0||s.includes("]")?!1:t?d(t):!1}if(i.includes("@[")&&!i.includes("]"))return!1;const r=i.match(/^"((?:[^"\\]|\\.)+)"@(.+)$/);if(r?.[2]){const n=r[2];return n.startsWith("[")?!1:u(`test@${n}`)}return u(i)},h=i=>{if(!i||typeof i!="string")return;const e=i.trim();if(!e)return;const r=e.lastIndexOf("<"),n=e.lastIndexOf(">");if(r!==-1&&n>r){const t=e.slice(0,r).trim(),s=e.slice(r+1,n).trim();if(s&&c(s)){if(t){const f=t.replace(/^"(.+)"$/,"$1");return{email:s,name:f}}return{email:s}}}const l=e.match(/^<([^>]+)>$/);if(l?.[1]){const t=l[1].trim();return c(t)?{email:t}:void 0}if(!(e.includes("]")&&!e.includes("@["))&&!(e.includes('"')&&!e.startsWith('"')&&e.indexOf('"')<e.indexOf("@"))){if(e.startsWith('"')){let t=1,s=!1;for(;t<e.length;)if(e[t]==="\\"&&t+1<e.length)t+=2;else if(e[t]==='"'){if(t+1<e.length&&e[t+1]==="@"){s=!0;break}t+=1}else t+=1;if(!s&&e.includes("@")){const f=e.indexOf("@"),a=e.slice(1).indexOf('"');if(a===-1||f<a+1)return}}if(c(e))return{email:e}}};export{h as default};
@@ -0,0 +1,22 @@
1
+ import { E as EmailOptions } from "../packem_shared/types.d-ejzh-xBP.js";
2
+ import 'node:buffer';
3
+ /**
4
+ * Parses a raw EML / RFC 5322 MIME message back into {@link EmailOptions}.
5
+ *
6
+ * This closes the round-trip story for {@link "../mail".Mail.draft}: serialise a
7
+ * message to EML, persist/transmit it, then `parseEml()` it back into options you
8
+ * can hand to `mail.send()`. It understands the multipart layout produced by this
9
+ * library's own `buildMimeMessage` (text/plain + text/html parts, quoted-printable
10
+ * and base64 transfer encodings, RFC 2047 encoded headers) and common
11
+ * single-part messages.
12
+ *
13
+ * Scope: it extracts `from`, `to`, `cc`, `bcc`, `replyTo`, `subject`, `text`,
14
+ * `html`, `priority`, and remaining custom `headers`. Attachment bodies are not
15
+ * decoded into {@link "../types".Attachment} objects (use a full MIME parser such
16
+ * as `mailparser` for that); attachment parts are skipped.
17
+ * @param eml The raw EML/MIME message string.
18
+ * @returns The parsed email options.
19
+ * @throws {Error} When the message has no `From` or `To`/`Cc`/`Bcc` recipient and therefore cannot satisfy the required {@link EmailOptions} shape.
20
+ */
21
+ declare const parseEml: (eml: string) => EmailOptions;
22
+ export { parseEml as default };
@@ -0,0 +1,6 @@
1
+ import y from"./parse-address.js";import{p as $}from"../packem_shared/quoted-printable-nSGDA1tA.js";const T=globalThis.Buffer!==void 0,k=r=>{if(T)return Uint8Array.from(Buffer.from(r,"base64"));const t=atob(r),n=new Uint8Array(t.length);for(let e=0;e<t.length;e+=1)n[e]=t.charCodeAt(e);return n},E=r=>{const t=r.replaceAll("_"," "),n=[];for(let e=0;e<t.length;e+=1){const s=t[e];s==="="&&e+2<t.length?(n.push(Number.parseInt(t.slice(e+1,e+3),16)),e+=2):n.push(s.charCodeAt(0))}return Uint8Array.from(n)},U=/^utf-?8$/i,j=(r,t)=>{if(T&&U.test(t))return Buffer.from(r).toString("utf8");try{return new TextDecoder(t).decode(r)}catch{return new TextDecoder().decode(r)}},D=/=\?([^?]+)\?([bq])\?([^?]*)\?=/gi,M=r=>r.includes("=?")?r.replaceAll(/(\?=)\s+(=\?)/g,"$1$2").replaceAll(D,(t,n,e,s)=>{const o=e.toUpperCase()==="B"?k(s):E(s);return j(o,n)}):r,O=globalThis.Buffer!==void 0,S=/^[ \t]/,q=/boundary=(?:"([^"]+)"|([^";]+))/i,H=/^\r?\n/,L=/[\r\n]+$/,I=/\r?\n$/,N=/\s/g,P=/high|^1|^2/i,_=/low|^4|^5/i,B=r=>{const t=r.replaceAll(`\r
2
+ `,`
3
+ `),n=t.indexOf(`
4
+
5
+ `),e=n===-1?t:t.slice(0,n),s=n===-1?"":t.slice(n+2),o=[],f=new Map;let i="",c="";const h=()=>{if(i){const a=M(c.trim());o.push([i,a]),f.set(i.toLowerCase(),a)}};for(const a of e.split(`
6
+ `))if(S.test(a)&&i)c+=` ${a.trim()}`;else{h();const d=a.indexOf(":");d===-1?(i="",c=""):(i=a.slice(0,d).trim(),c=a.slice(d+1).trim())}return h(),{body:s,headers:{map:f,raw:o}}},b=r=>{if(!r)return[];const t=[];let n="",e=!1,s=!1;for(const o of r){switch(o){case'"':{e=!e;break}case"<":{s=!0;break}case">":{s=!1;break}}o===","&&!e&&!s?(t.push(n),n=""):n+=o}return n.trim()&&t.push(n),t.map(o=>y(o.trim())).filter(o=>o!==void 0)},F=r=>{if(!r)return;const t=q.exec(r);return t?.[1]??t?.[2]},w=(r,t)=>{const n=(t??"7bit").trim().toLowerCase();if(n==="quoted-printable")return $(r);if(n==="base64"){const e=r.replaceAll(N,"");return O?Buffer.from(e,"base64").toString("utf8"):new TextDecoder().decode(Uint8Array.from(atob(e),s=>s.codePointAt(0)))}return r},V=r=>{const{body:t,headers:n}=B(r),{map:e}=n,s=y(e.get("from")??"");if(!s)throw new Error("Cannot parse EML: missing or invalid `From` header");const o=b(e.get("to")??""),f=b(e.get("cc")??""),i=b(e.get("bcc")??"");if(o.length===0&&f.length===0&&i.length===0)throw new Error("Cannot parse EML: no recipient (`To`/`Cc`/`Bcc`) found");const c={from:s,subject:e.get("subject")??"",to:o.length===1?o[0]:o};f.length>0&&(c.cc=f.length===1?f[0]:f),i.length>0&&(c.bcc=i.length===1?i[0]:i);const h=e.get("reply-to")?y(e.get("reply-to")):void 0;h&&(c.replyTo=h);const a=e.get("content-type"),d=F(a);if(d&&a?.toLowerCase().includes("multipart")){const u=t.split(`--${d}`);for(const l of u){const p=l.replace(H,"");if(!(!p||p.startsWith("--"))){const{body:C,headers:g}=B(p),x=g.map.get("content-type")??"",A=g.map.get("content-transfer-encoding");(g.map.get("content-disposition")??"").toLowerCase().includes("attachment")||(x.toLowerCase().includes("text/plain")?c.text=w(C.replace(L,""),A):x.toLowerCase().includes("text/html")&&(c.html=w(C.replace(L,""),A)))}}}else{const u=e.get("content-transfer-encoding"),l=w(t.replace(I,""),u);a?.toLowerCase().includes("text/html")?c.html=l:l&&(c.text=l)}const v=new Set(["bcc","cc","content-transfer-encoding","content-type","from","mime-version","reply-to","subject","to"]),m={};for(const[u,l]of n.raw){const p=u.toLowerCase();(p==="x-priority"||p==="importance")&&(P.test(l)?c.priority="high":_.test(l)&&(c.priority="low")),v.has(p)||(m[u]=l)}return Object.keys(m).length>0&&(c.headers=m),c};export{V as default};
@@ -0,0 +1,49 @@
1
+ import { R as Result } from "../packem_shared/types.d-ejzh-xBP.js";
2
+ import 'node:buffer';
3
+ /**
4
+ * A successful {@link Result} with its data narrowed to be present.
5
+ */
6
+ type OkResult<T> = Result<T> & {
7
+ data: T;
8
+ success: true;
9
+ };
10
+ /**
11
+ * Returns whether a {@link Result} succeeded, narrowing `data` to be present.
12
+ * @param result The result to test.
13
+ * @returns `true` when the result is successful.
14
+ */
15
+ declare const isOk: <T>(result: Result<T>) => result is OkResult<T>;
16
+ /**
17
+ * Returns whether a {@link Result} failed.
18
+ * @param result The result to test.
19
+ * @returns `true` when the result is a failure.
20
+ */
21
+ declare const isErr: <T>(result: Result<T>) => boolean;
22
+ /**
23
+ * Returns the data of a successful {@link Result}, or throws its error.
24
+ * @param result The result to unwrap.
25
+ * @returns The contained data.
26
+ * @throws {EmailError} The result's error (wrapped when it is not already an `Error`).
27
+ */
28
+ declare const unwrap: <T>(result: Result<T>) => T;
29
+ /**
30
+ * Returns the data of a successful {@link Result}, or a fallback when it failed.
31
+ * @param result The result to unwrap.
32
+ * @param fallback The value to return on failure.
33
+ * @returns The data, or the fallback.
34
+ */
35
+ declare const unwrapOr: <T>(result: Result<T>, fallback: T) => T;
36
+ /**
37
+ * Maps the data of a successful {@link Result}, passing failures through unchanged.
38
+ * @param result The result to map.
39
+ * @param function_ The mapper applied to the data on success.
40
+ * @returns A new result with the mapped data, or the original failure.
41
+ */
42
+ declare const mapOk: <T, U>(result: Result<T>, function_: (data: T) => U) => Result<U>;
43
+ /**
44
+ * Runs an async function and captures its outcome as a {@link Result}, never throwing.
45
+ * @param function_ The async function to run.
46
+ * @returns A successful result with the value, or a failed result with the thrown error.
47
+ */
48
+ declare const tryAsync: <T>(function_: () => Promise<T>) => Promise<Result<T>>;
49
+ export { OkResult, isErr, isOk, mapOk, tryAsync, unwrap, unwrapOr };
@@ -0,0 +1 @@
1
+ import e from"../packem_shared/EmailError-B-sEf3bp.js";const c=s=>s.success,t=s=>!s.success,u=s=>{if(s.success)return s.data;throw s.error instanceof Error?s.error:new e("result","Called unwrap() on a failed result",{cause:s.error})},o=(s,r)=>s.success?s.data:r,n=(s,r)=>s.success?{data:r(s.data),success:!0}:{error:s.error,success:!1},d=async s=>{try{return{data:await s(),success:!0}}catch(r){return{error:r,success:!1}}};export{t as isErr,c as isOk,n as mapOk,d as tryAsync,u as unwrap,o as unwrapOr};
@@ -1,4 +1,4 @@
1
- import { F as FeatureFlags, E as EmailOptions } from "../../packem_shared/types.d-wwpgA3to.js";
1
+ import { F as FeatureFlags, E as EmailOptions } from "../../packem_shared/types.d-ejzh-xBP.js";
2
2
  import 'node:buffer';
3
3
  /**
4
4
  * A single capability that a message uses but the target provider cannot represent.
@@ -1 +1 @@
1
- var i=Object.defineProperty;var l=(e,a)=>i(e,"name",{value:a,configurable:!0});import{i as u}from"../../packem_shared/headers-to-record-Qo124ImV.js";var n=Object.defineProperty,t=l((e,a)=>n(e,"name",{value:a,configurable:!0}),"t");const o=t(e=>Array.isArray(e)&&e.length>0,"hasItems"),c=t((e,a)=>a.find(r=>e[r]!==void 0),"firstSetField"),f=[{detect:t(e=>o(e.attachments)?"attachments":void 0,"detect"),feature:"attachments",label:"attachments"},{detect:t(e=>typeof e.html=="string"&&e.html.length>0?"html":void 0,"detect"),feature:"html",label:"HTML content"},{detect:t(e=>e.replyTo?"replyTo":void 0,"detect"),feature:"replyTo",label:"a reply-to address"},{detect:t(e=>e.headers!==void 0&&Object.keys(u(e.headers)).length>0?"headers":void 0,"detect"),feature:"customHeaders",label:"custom headers"},{detect:t(e=>o(e.tags)?"tags":void 0,"detect"),feature:"tagging",label:"tags"},{detect:t(e=>c(e,["scheduledAt","sendAt"]),"detect"),feature:"scheduling",label:"scheduled delivery"},{detect:t(e=>c(e,["templateId","template"]),"detect"),feature:"templates",label:"provider templates"}];function h(e,a){if(!a)return{supported:!0,violations:[]};const r=[];for(const d of f){if(a[d.feature]!==!1)continue;const s=d.detect(e);s!==void 0&&r.push({feature:d.feature,field:s,message:`Message uses ${d.label} (field "${s}") but the provider does not support the "${d.feature}" capability`})}return{supported:r.length===0,violations:r}}l(h,"f");t(h,"checkFeatureSupport");export{h as default};
1
+ import{s as o}from"../../packem_shared/headers-to-record-De1Eg951.js";const r=e=>Array.isArray(e)&&e.length>0,d=(e,s)=>s.find(t=>e[t]!==void 0),i=[{detect:e=>r(e.attachments)?"attachments":void 0,feature:"attachments",label:"attachments"},{detect:e=>typeof e.html=="string"&&e.html.length>0?"html":void 0,feature:"html",label:"HTML content"},{detect:e=>e.replyTo?"replyTo":void 0,feature:"replyTo",label:"a reply-to address"},{detect:e=>e.headers!==void 0&&Object.keys(o(e.headers)).length>0?"headers":void 0,feature:"customHeaders",label:"custom headers"},{detect:e=>r(e.tags)?"tags":void 0,feature:"tagging",label:"tags"},{detect:e=>d(e,["scheduledAt","sendAt"]),feature:"scheduling",label:"scheduled delivery"},{detect:e=>d(e,["templateId","template"]),feature:"templates",label:"provider templates"}];function u(e,s){if(!s)return{supported:!0,violations:[]};const t=[];for(const a of i){if(s[a.feature]!==!1)continue;const l=a.detect(e);l!==void 0&&t.push({feature:a.feature,field:l,message:`Message uses ${a.label} (field "${l}") but the provider does not support the "${a.feature}" capability`})}return{supported:t.length===0,violations:t}}export{u as default};
@@ -1,5 +1,5 @@
1
1
  import { Cache } from "../cache.js";
2
- export { type InMemoryCache } from "../cache.js";
2
+ export type { InMemoryCache } from "../cache.js";
3
3
  /**
4
4
  * MX record information.
5
5
  */
@@ -1 +1 @@
1
- var d=Object.defineProperty;var n=(r,e)=>d(r,"name",{value:e,configurable:!0});import{createRequire as l}from"node:module";const u=l(import.meta.url),c=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,p=n(r=>{if(typeof c<"u"&&c.versions&&c.versions.node){const[e,o]=c.versions.node.split(".").map(Number);if(e>22||e===22&&o>=3||e===20&&o>=16)return c.getBuiltinModule(r)}return u(r)},"__cjs_getBuiltinModule"),{resolveMx:h}=p("node:dns/promises");var f=Object.defineProperty,g=n((r,e)=>f(r,"name",{value:e,configurable:!0}),"h");const v=g(async(r,e={})=>{const o=e.ttl??36e5;if(e.cache){const t=await e.cache.get(r);if(t!==void 0)return t}try{const t=(await h(r)).map(i=>({exchange:i.exchange,priority:i.priority})),s={records:t.toSorted((i,a)=>i.priority-a.priority),valid:t.length>0};return e.cache&&await e.cache.set(r,s,o),s}catch(t){const s={error:t instanceof Error?t.message:String(t),valid:!1};return e.cache&&await e.cache.set(r,s,o),s}},"checkMxRecords");export{v as checkMxRecords};
1
+ import{createRequire as a}from"node:module";const d=a(import.meta.url),c=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,l=o=>{if(typeof c<"u"&&c.versions&&c.versions.node){const[e,s]=c.versions.node.split(".").map(Number);if(e>22||e===22&&s>=3||e===20&&s>=16)return c.getBuiltinModule(o)}return d(o)},{resolveMx:p}=l("node:dns/promises"),h=async(o,e={})=>{const s=e.ttl??36e5;if(e.cache){const r=await e.cache.get(o);if(r!==void 0)return r}try{const r=(await p(o)).map(i=>({exchange:i.exchange,priority:i.priority})),t={records:r.toSorted((i,n)=>i.priority-n.priority),valid:r.length>0};return e.cache&&await e.cache.set(o,t,s),t}catch(r){const t={error:r instanceof Error?r.message:String(r),valid:!1};return e.cache&&await e.cache.set(o,t,s),t}};export{h as checkMxRecords};
@@ -1 +1 @@
1
- var l=Object.defineProperty;var u=(e,r)=>l(e,"name",{value:r,configurable:!0});var p=Object.defineProperty,i=u((e,r)=>p(e,"name",{value:r,configurable:!0}),"n");const m=new Set(["abuse","accounts","admin","adminhelp","administrator","adminoffice","adminteam","affiliates","alarms","alert","alternative","analytics","anonymous","archive","audit","automated","autoreply","backoffice","backup","batch","billing","board","bot","bounce","bug","bugreport","build","careers","cert","chapter","chatbot","ci","compliance","contact","continuousintegration","cron","csirt","customer-care","customercare","customerservice","customersupport","cvs","daemon","default","demo","deploy","deployment","dev","development","devops","digest","director","dnsadmin","docs","donotreply","enquiry","errors","events","executive","faculty","failover","feed","feedback","finance","forensics","ftp","git","guardian","guest","help","helpdesk","helpsec","hostmaster","hr","incident","incidents","indexer","info","ingest","inquiry","issues","it","jobs","legal","list","list-request","log","logistics","logs","maildaemon","mailer-daemon","malicious","management","manager","marketing","media","membership","metrics","mod","moderator","mods","monitor","network","news","newsletter","no-reply","noc","noreply","notifications","notify","operations","operator","owner","owners","parent","partners","patches","payments","phish","phishing","pipeline","post","postmaster","pr","press","privacy","procurement","qa","recruitment","redundancy","registrar","releases","reminder","reminders","reply","report","reports","request","resource","root","sales","scheduler","secondary","secops","secretariat","secretary","security","server","service","spam","spamreport","staff","standby","student","subscribe","subscriptions","summaries","supervisor","supplychain","support","supportteam","svn","sync","sysadmin","system","system-alert","system-msg","team","tech","techsupport","temp","tertiary","test","threat","threats","tracker","trial","unknown","unsubscribe","update","updates","usenet","usergroup","uucp","volunteer","vuln","vulnerability","webinars","webmaster","www"]),o=i((e,r)=>m.has(e)||(r?.has(e)??!1),"checkRolePrefix"),d=i((e,r)=>{if(e.length<2)return!1;const t=["-",".","_"];for(const s of t){const n=`${e[0]}${s}${e[1]}`;if(o(n,r))return!0}return!1},"checkCombinedParts"),f=i((e,r)=>{for(const t of e)if(!o(t,r))return!1;return!0},"checkAllPartsAreRoleAccounts"),h=i((e,r)=>{if(!e||typeof e!="string")return!1;const t=e.toLowerCase().trim(),s=t.indexOf("@");if(s===-1||s===0)return!1;const n=t.slice(0,s);if(o(n,r))return!0;const a=n.split(/[+._-]/);if(a.length===1){const c=a[0];return c===void 0?!1:o(c,r)}return d(a,r)?!0:f(a,r)},"isRoleAccount");export{m as ROLE_ACCOUNT_PREFIXES,h as isRoleAccount};
1
+ const c=new Set(["abuse","accounts","admin","adminhelp","administrator","adminoffice","adminteam","affiliates","alarms","alert","alternative","analytics","anonymous","archive","audit","automated","autoreply","backoffice","backup","batch","billing","board","bot","bounce","bug","bugreport","build","careers","cert","chapter","chatbot","ci","compliance","contact","continuousintegration","cron","csirt","customer-care","customercare","customerservice","customersupport","cvs","daemon","default","demo","deploy","deployment","dev","development","devops","digest","director","dnsadmin","docs","donotreply","enquiry","errors","events","executive","faculty","failover","feed","feedback","finance","forensics","ftp","git","guardian","guest","help","helpdesk","helpsec","hostmaster","hr","incident","incidents","indexer","info","ingest","inquiry","issues","it","jobs","legal","list","list-request","log","logistics","logs","maildaemon","mailer-daemon","malicious","management","manager","marketing","media","membership","metrics","mod","moderator","mods","monitor","network","news","newsletter","no-reply","noc","noreply","notifications","notify","operations","operator","owner","owners","parent","partners","patches","payments","phish","phishing","pipeline","post","postmaster","pr","press","privacy","procurement","qa","recruitment","redundancy","registrar","releases","reminder","reminders","reply","report","reports","request","resource","root","sales","scheduler","secondary","secops","secretariat","secretary","security","server","service","spam","spamreport","staff","standby","student","subscribe","subscriptions","summaries","supervisor","supplychain","support","supportteam","svn","sync","sysadmin","system","system-alert","system-msg","team","tech","techsupport","temp","tertiary","test","threat","threats","tracker","trial","unknown","unsubscribe","update","updates","usenet","usergroup","uucp","volunteer","vuln","vulnerability","webinars","webmaster","www"]),o=(e,r)=>c.has(e)||(r?.has(e)??!1),u=(e,r)=>{if(e.length<2)return!1;const t=["-",".","_"];for(const s of t){const n=`${e[0]}${s}${e[1]}`;if(o(n,r))return!0}return!1},p=(e,r)=>{for(const t of e)if(!o(t,r))return!1;return!0},l=(e,r)=>{if(!e||typeof e!="string")return!1;const t=e.toLowerCase().trim(),s=t.indexOf("@");if(s===-1||s===0)return!1;const n=t.slice(0,s);if(o(n,r))return!0;const a=n.split(/[+._-]/);if(a.length===1){const i=a[0];return i===void 0?!1:o(i,r)}return u(a,r)?!0:p(a,r)};export{c as ROLE_ACCOUNT_PREFIXES,l as isRoleAccount};
@@ -1 +1 @@
1
- var l=Object.defineProperty;var i=(t,e)=>l(t,"name",{value:e,configurable:!0});var f=Object.defineProperty,u=i((t,e)=>f(t,"name",{value:e,configurable:!0}),"i");const c=u(t=>{if(!/^[^\s@]+@[^\s@][^\s.@]*\.[^\s@]+$/.test(t))return!1;const e=t.split("@");if(e.length!==2)return!1;const[r,s]=e;if(!r||!s||t.includes("..")||r.startsWith(".")||r.endsWith(".")||!s.includes(".")||s.startsWith("-")||s.endsWith("-"))return!1;const a=s.split(".");for(const n of a)if(n.startsWith("-")||n.endsWith("-")||n.length===0)return!1;return!0},"validateEmail");export{c as default};
1
+ const f=s=>{if(!/^[^\s@]+@[^\s@][^\s.@]*\.[^\s@]+$/.test(s))return!1;const r=s.split("@");if(r.length!==2)return!1;const[e,t]=r;if(!e||!t||s.includes("..")||e.startsWith(".")||e.endsWith(".")||!t.includes(".")||t.startsWith("-")||t.endsWith("-"))return!1;const i=t.split(".");for(const n of i)if(n.startsWith("-")||n.endsWith("-")||n.length===0)return!1;return!0};export{f as default};
@@ -1 +1 @@
1
- var V=Object.defineProperty;var f=(e,r)=>V(e,"name",{value:r,configurable:!0});import{checkMxRecords as y}from"./check-mx-records.js";import{isRoleAccount as k}from"./role-accounts.js";import w from"./validate-email.js";import{verifySmtp as E}from"./verify-smtp.js";import{isDisposableEmail as A}from"@visulima/disposable-email-domains";var D=Object.defineProperty,M=f((e,r)=>D(e,"name",{value:r,configurable:!0}),"f");const N=M(async(e,r={})=>{const{checkDisposable:p=!0,checkMx:d=!0,checkRoleAccount:u=!0,checkSmtp:h=!1,customDisposableDomains:v,customRolePrefixes:b,...g}=r,c=w(e),a=[],i=[];if(!c)return a.push("Invalid email format"),{errors:a,formatValid:!1,valid:!1,warnings:i};let s,l,m,n;if(p)try{s=A(e,v),s&&i.push("Email is from a disposable email service")}catch{}if(u&&(l=k(e,b),l&&i.push("Email appears to be a role account (non-personal)")),d){const o=e.split("@")[1];if(!o)return a.push("Invalid email format: missing domain"),{disposable:s,errors:a,formatValid:!1,mxValid:!1,roleAccount:l,valid:!1,warnings:i};const t=await y(o,{cache:r.cache});m=t.valid,t.valid||a.push(t.error??"No valid MX records found")}if(h){const o=await E(e,{...g,cache:r.cache,smtpCache:r.smtpCache});n=o.valid,!o.valid&&o.error&&a.push(`SMTP verification failed: ${o.error}`)}const x=c&&a.length===0;return{disposable:s,errors:a,formatValid:c,mxValid:m,roleAccount:l,smtpValid:n,valid:x,warnings:i}},"verifyEmail");export{N as verifyEmail};
1
+ import{checkMxRecords as x}from"./check-mx-records.js";import{isRoleAccount as g}from"./role-accounts.js";import k from"./validate-email.js";import{verifySmtp as w}from"./verify-smtp.js";import{isDisposableEmail as y}from"@visulima/disposable-email-domains";const S=async(r,s={})=>{const{checkDisposable:f=!0,checkMx:p=!0,checkRoleAccount:d=!0,checkSmtp:u=!1,customDisposableDomains:h,customRolePrefixes:v,...b}=s,c=k(r),a=[],e=[];if(!c)return a.push("Invalid email format"),{errors:a,formatValid:!1,valid:!1,warnings:e};let o,l,m,n;if(f)try{o=y(r,h),o&&e.push("Email is from a disposable email service")}catch{}if(d&&(l=g(r,v),l&&e.push("Email appears to be a role account (non-personal)")),p){const i=r.split("@")[1];if(!i)return a.push("Invalid email format: missing domain"),{disposable:o,errors:a,formatValid:!1,mxValid:!1,roleAccount:l,valid:!1,warnings:e};const t=await x(i,{cache:s.cache});m=t.valid,t.valid||a.push(t.error??"No valid MX records found")}if(u){const i=await w(r,{...b,cache:s.cache,smtpCache:s.smtpCache});n=i.valid,!i.valid&&i.error&&a.push(`SMTP verification failed: ${i.error}`)}const V=c&&a.length===0;return{disposable:o,errors:a,formatValid:c,mxValid:m,roleAccount:l,smtpValid:n,valid:V,warnings:e}};export{S as verifyEmail};
@@ -1,4 +1,4 @@
1
- var j=Object.defineProperty;var R=(t,e)=>j(t,"name",{value:e,configurable:!0});import{createRequire as S}from"node:module";import{checkMxRecords as C}from"./check-mx-records.js";const $=S(import.meta.url),u=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,O=R(t=>{if(typeof u<"u"&&u.versions&&u.versions.node){const[e,d]=u.versions.node.split(".").map(Number);if(e>22||e===22&&d>=3||e===20&&d>=16)return u.getBuiltinModule(t)}return $(t)},"__cjs_getBuiltinModule"),{Socket:P}=O("node:net");var E=Object.defineProperty,p=R((t,e)=>E(t,"name",{value:e,configurable:!0}),"n");const A=p(async(t,e={})=>{const{fromEmail:d="test@example.com",port:x=25,timeout:M=5e3,ttl:_=36e5}=e;if(!t||typeof t!="string")return{error:"Invalid email address",valid:!1};const l=t.toLowerCase().trim(),h=l.indexOf("@");if(h===-1||h===l.length-1)return{error:"Invalid email format",valid:!1};const{smtpCache:c}=e,g=`smtp:${l}:${d}:${x}`;if(c){const n=await c.get(g);if(n!==void 0)return n}const w=l.slice(h+1),W=e.cache,r=await C(w,{cache:W});if(!r.valid||!r.records||r.records.length===0){const n={error:r.error??"No MX records found",mxRecords:r.records,valid:!1};return c&&await c.set(g,n,_),n}const y=r.records[0];return new Promise(n=>{const o=new P;let v="",s="connected";const m=p(()=>{o.removeAllListeners(),o.destroy()},"cleanup"),f=p(a=>{c&&c.set(g,a,_).catch(()=>{}),n(a)},"cacheAndResolve"),T=p(a=>{m(),f({error:a.message,mxRecords:r.records,valid:!1})},"onError"),b=p(()=>{m(),f({error:"SMTP connection timeout",mxRecords:r.records,valid:!1})},"onTimeout");o.setTimeout(M),o.on("error",T),o.on("timeout",b),o.on("data",a=>{v+=a.toString();const i=v.slice(-3);s==="connected"&&(i.startsWith("220")||i.startsWith("250"))?(s="helo",o.write(`HELO ${w}\r
2
- `)):s==="helo"&&i.startsWith("250")?(s="mail-from",o.write(`MAIL FROM:<${d}>\r
3
- `)):s==="mail-from"&&i.startsWith("250")?(s="rcpt-to",o.write(`RCPT TO:<${l}>\r
4
- `)):s==="rcpt-to"&&i.startsWith("250")?(m(),f({mxRecords:r.records,smtpResponse:v,valid:!0})):s==="rcpt-to"&&(i.startsWith("550")||i.startsWith("551")||i.startsWith("553"))&&(m(),f({error:"Email address does not exist",mxRecords:r.records,smtpResponse:v,valid:!1}))}),y?o.connect(x,y.exchange):(m(),f({error:"No MX record available",mxRecords:r.records,valid:!1}))})},"verifySmtp");export{A as verifySmtp};
1
+ import{createRequire as T}from"node:module";import{checkMxRecords as S}from"./check-mx-records.js";const $=T(import.meta.url),p=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,b=c=>{if(typeof p<"u"&&p.versions&&p.versions.node){const[o,d]=p.versions.node.split(".").map(Number);if(o>22||o===22&&d>=3||o===20&&d>=16)return p.getBuiltinModule(c)}return $(c)},{Socket:j}=b("node:net"),O=async(c,o={})=>{const{fromEmail:d="test@example.com",port:g=25,timeout:w=5e3,ttl:R=36e5}=o;if(!c||typeof c!="string")return{error:"Invalid email address",valid:!1};const l=c.toLowerCase().trim(),h=l.indexOf("@");if(h===-1||h===l.length-1)return{error:"Invalid email format",valid:!1};const{smtpCache:n}=o,v=`smtp:${l}:${d}:${g}`;if(n){const i=await n.get(v);if(i!==void 0)return i}const x=l.slice(h+1),M=o.cache,e=await S(x,{cache:M});if(!e.valid||!e.records||e.records.length===0){const i={error:e.error??"No MX records found",mxRecords:e.records,valid:!1};return n&&await n.set(v,i,R),i}const _=e.records[0];return new Promise(i=>{const r=new j;let u="",t="connected";const m=()=>{r.removeAllListeners(),r.destroy()},f=a=>{n&&n.set(v,a,R).catch(()=>{}),i(a)},W=a=>{m(),f({error:a.message,mxRecords:e.records,valid:!1})},y=()=>{m(),f({error:"SMTP connection timeout",mxRecords:e.records,valid:!1})};r.setTimeout(w),r.on("error",W),r.on("timeout",y),r.on("data",a=>{u+=a.toString();const s=u.slice(-3);t==="connected"&&(s.startsWith("220")||s.startsWith("250"))?(t="helo",r.write(`HELO ${x}\r
2
+ `)):t==="helo"&&s.startsWith("250")?(t="mail-from",r.write(`MAIL FROM:<${d}>\r
3
+ `)):t==="mail-from"&&s.startsWith("250")?(t="rcpt-to",r.write(`RCPT TO:<${l}>\r
4
+ `)):t==="rcpt-to"&&s.startsWith("250")?(m(),f({mxRecords:e.records,smtpResponse:u,valid:!0})):t==="rcpt-to"&&(s.startsWith("550")||s.startsWith("551")||s.startsWith("553"))&&(m(),f({error:"Email address does not exist",mxRecords:e.records,smtpResponse:u,valid:!1}))}),_?r.connect(g,_.exchange):(m(),f({error:"No MX record available",mxRecords:e.records,valid:!1}))})};export{O as verifySmtp};