@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
package/CHANGELOG.md CHANGED
@@ -1,3 +1,56 @@
1
+ ## @visulima/email [1.0.0-alpha.36](https://github.com/visulima/visulima/compare/@visulima/email@1.0.0-alpha.35...@visulima/email@1.0.0-alpha.36) (2026-06-13)
2
+
3
+ ### Bug Fixes
4
+
5
+ * **email:** harden header sanitization, DSN fallback header, batch counts ([5629850](https://github.com/visulima/visulima/commit/5629850e2fe23710bc11d71820c867e5952c9a1d))
6
+ * **email:** stop bcc disclosure and fix mime header/dsn handling ([70f0c70](https://github.com/visulima/visulima/commit/70f0c70fe441be5ba9cf15b3e94acbe7cc7af3c2))
7
+ * **email:** unwrap juice ESM default export and align fs error expectation ([0bc2705](https://github.com/visulima/visulima/commit/0bc2705af39a0da641eb50a4e85eff0f954f267e))
8
+
9
+ ### Performance Improvements
10
+
11
+ * **email:** lazy-load ical-generator on build ([b6b4466](https://github.com/visulima/visulima/commit/b6b4466d87ddaaed19e5726bef4583bf433403d0))
12
+
13
+ ### Miscellaneous Chores
14
+
15
+ * **email:** clear baseline eslint violations ([1906b0b](https://github.com/visulima/visulima/commit/1906b0bed81cba8d979aa55b5e5d8518263b7b7b))
16
+
17
+ ### Tests
18
+
19
+ * **email:** deepen middleware/queue/events tests ([be80a72](https://github.com/visulima/visulima/commit/be80a725e20661b24650f13b6b524891811b8af8))
20
+ * **email:** restore precise toHaveBeenCalledWith assertions ([524d4bd](https://github.com/visulima/visulima/commit/524d4bd545c7440e1d26fbb201706a1a0bdc8023))
21
+
22
+ ### Build System
23
+
24
+ * **deps:** update email dependencies ([5ce1f27](https://github.com/visulima/visulima/commit/5ce1f27ebecb9f7459db7503e4a8128b1ff8ac01))
25
+ * regenerate bundled-license manifests and types ordering ([af26588](https://github.com/visulima/visulima/commit/af26588d75aaa937fd4862800560bd4070a4878c))
26
+
27
+
28
+ ### Dependencies
29
+
30
+ * **@visulima/disposable-email-domains:** upgraded to 1.0.0-alpha.17
31
+ * **@visulima/error:** upgraded to 6.0.0-alpha.33
32
+ * **@visulima/fs:** upgraded to 5.0.0-alpha.32
33
+ * **@visulima/path:** upgraded to 3.0.0-alpha.13
34
+
35
+ ## @visulima/email [1.0.0-alpha.35](https://github.com/visulima/visulima/compare/@visulima/email@1.0.0-alpha.34...@visulima/email@1.0.0-alpha.35) (2026-06-04)
36
+
37
+ ### Features
38
+
39
+ * **email:** inbound, webhooks, deliverability, middleware, queue, events, testing + ARC/i18n/batch ([#671](https://github.com/visulima/visulima/issues/671)) ([2ca23f2](https://github.com/visulima/visulima/commit/2ca23f27ecc5064d693c16bd3f44ccaeaf050888))
40
+
41
+ ### Bug Fixes
42
+
43
+ * **email:** 5 bug fixes ([4e87c42](https://github.com/visulima/visulima/commit/4e87c429a56d68d7a0a09325484ed299ffe6493c))
44
+ * **lint:** clear pre-existing eslint rot across packages ([#674](https://github.com/visulima/visulima/issues/674)) ([5354253](https://github.com/visulima/visulima/commit/5354253b163bd50bcefaf8a3fddf831bdb5df32b))
45
+
46
+
47
+ ### Dependencies
48
+
49
+ * **@visulima/disposable-email-domains:** upgraded to 1.0.0-alpha.16
50
+ * **@visulima/error:** upgraded to 6.0.0-alpha.32
51
+ * **@visulima/fs:** upgraded to 5.0.0-alpha.30
52
+ * **@visulima/path:** upgraded to 3.0.0-alpha.12
53
+
1
54
  ## @visulima/email [1.0.0-alpha.34](https://github.com/visulima/visulima/compare/@visulima/email@1.0.0-alpha.33...@visulima/email@1.0.0-alpha.34) (2026-06-02)
2
55
 
3
56
  ### Features
package/LICENSE.md CHANGED
@@ -459,6 +459,35 @@ Repository: git+https://github.com/visulima/visulima.git
459
459
  >
460
460
  > ---------------------------------------
461
461
  >
462
+ > ## tinyglobby
463
+ > License: MIT
464
+ > By: Superchupu
465
+ > Repository: git+https://github.com/SuperchupuDev/tinyglobby.git
466
+ >
467
+ > > MIT License
468
+ > >
469
+ > > Copyright (c) 2024 Madeline Gurriarán
470
+ > >
471
+ > > Permission is hereby granted, free of charge, to any person obtaining a copy
472
+ > > of this software and associated documentation files (the "Software"), to deal
473
+ > > in the Software without restriction, including without limitation the rights
474
+ > > to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
475
+ > > copies of the Software, and to permit persons to whom the Software is
476
+ > > furnished to do so, subject to the following conditions:
477
+ > >
478
+ > > The above copyright notice and this permission notice shall be included in all
479
+ > > copies or substantial portions of the Software.
480
+ > >
481
+ > > THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
482
+ > > IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
483
+ > > FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
484
+ > > AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
485
+ > > LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
486
+ > > OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
487
+ > > SOFTWARE.
488
+ >
489
+ > ---------------------------------------
490
+ >
462
491
  > ## yaml
463
492
  > License: ISC
464
493
  > By: Eemeli Aro
@@ -900,4 +929,32 @@ Repository: git+https://github.com/visulima/visulima.git
900
929
  > > See the License for the specific language governing permissions and
901
930
  > > limitations under the License.
902
931
 
932
+ ---------------------------------------
933
+
934
+ ## unstorage
935
+ License: MIT
936
+ Repository: unjs/unstorage
937
+
938
+ > MIT License
939
+ >
940
+ > Copyright (c) Pooya Parsa <pooya@pi0.io>
941
+ >
942
+ > Permission is hereby granted, free of charge, to any person obtaining a copy
943
+ > of this software and associated documentation files (the "Software"), to deal
944
+ > in the Software without restriction, including without limitation the rights
945
+ > to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
946
+ > copies of the Software, and to permit persons to whom the Software is
947
+ > furnished to do so, subject to the following conditions:
948
+ >
949
+ > The above copyright notice and this permission notice shall be included in all
950
+ > copies or substantial portions of the Software.
951
+ >
952
+ > THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
953
+ > IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
954
+ > FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
955
+ > AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
956
+ > LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
957
+ > OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
958
+ > SOFTWARE.
959
+
903
960
  <!-- /TYPE_DEPENDENCIES -->
package/README.md CHANGED
@@ -1416,6 +1416,102 @@ normalizeEmailAliases("user+tag@gmx.com"); // "user@gmx.com"
1416
1416
  normalizeEmailAliases("user@example.com"); // "user@example.com"
1417
1417
  ```
1418
1418
 
1419
+ ## Batch Sending & Result Helpers
1420
+
1421
+ Send one message per recipient from a shared base, with optional per-recipient template rendering, via `mail.sendBatch(base, personalizations, options?)`. Every `send` returns a `Result<EmailResult>`; the `isOk`/`isErr`/`unwrap`/`unwrapOr`/`mapOk`/`tryAsync` helpers (exported from the root and `@visulima/email/utils/result`) make handling it ergonomic.
1422
+
1423
+ ```typescript
1424
+ import { createMail, isOk, unwrapOr } from "@visulima/email";
1425
+
1426
+ const mail = createMail(provider);
1427
+
1428
+ for await (const receipt of mail.sendBatch(
1429
+ { from: { email: "news@example.com" }, subject: "Hi {{name}}", html: "<p>Hello {{name}}</p>" },
1430
+ [{ to: { email: "a@example.com" }, data: { name: "Ada" } }],
1431
+ { render: (template, data) => renderHandlebars(template, data) },
1432
+ )) {
1433
+ if (receipt.successful) console.log("sent", receipt.messageId);
1434
+ }
1435
+ ```
1436
+
1437
+ See [Sending Mail](https://visulima.com/docs/package/email/getting-started/sending-mail).
1438
+
1439
+ ## Middleware
1440
+
1441
+ Attach resilience middleware with `mail.use(...)`: retry (full-jitter backoff + dead-letter), rate limiting (with per-provider presets), circuit breaker, deduplication, OAuth2 token refresh, and PII-redacting logging.
1442
+
1443
+ ```typescript
1444
+ import { createMail } from "@visulima/email";
1445
+ import { circuitBreakerMiddleware, RATE_LIMIT_PRESETS, rateLimitMiddleware, retryMiddleware } from "@visulima/email/middleware";
1446
+
1447
+ const mail = createMail(provider)
1448
+ .use(rateLimitMiddleware({ rate: RATE_LIMIT_PRESETS.resend }))
1449
+ .use(circuitBreakerMiddleware())
1450
+ .use(retryMiddleware({ retries: 3 }));
1451
+ ```
1452
+
1453
+ See [Middleware](https://visulima.com/docs/package/email/middleware/introduction).
1454
+
1455
+ ## Queue & Worker
1456
+
1457
+ Durable background sending via the `EmailQueue` interface: an in-memory `MemoryQueue`, an `UnstorageQueue` (`@visulima/email/queue/unstorage`) backed by any [unstorage](https://unstorage.unjs.io/) store (Redis/FS/KV/Postgres), and a `createWorker(...)` with bounded concurrency, retry/backoff and dead-lettering.
1458
+
1459
+ ```typescript
1460
+ import { createMail } from "@visulima/email";
1461
+ import { createWorker, MemoryQueue } from "@visulima/email/queue";
1462
+
1463
+ const queue = new MemoryQueue();
1464
+ const mail = createMail(provider);
1465
+
1466
+ await queue.enqueue({ from: { email: "a@x.com" }, to: { email: "b@x.com" }, subject: "Hi", text: "yo" });
1467
+ createWorker({ queue, send: mail.send.bind(mail), concurrency: 5 }).start();
1468
+ ```
1469
+
1470
+ See [Queue](https://visulima.com/docs/package/email/queue/introduction).
1471
+
1472
+ ## Webhook Verification
1473
+
1474
+ Verify provider webhook signatures with `@visulima/email/webhooks`: `verifyStandardWebhook`/`verifyResendWebhook` (Svix/Standard Webhooks), `verifyMailgunWebhook`, `verifySendGridWebhook` (ECDSA + replay window), `verifyPostmarkWebhook` (Basic Auth), and `verifySnsMessage` (AWS SES via SNS, with a tight `sns.<region>.amazonaws.com` cert allowlist). All return `{ valid, reason? }` — always pass the **raw** request body.
1475
+
1476
+ See [Webhooks](https://visulima.com/docs/package/email/webhooks/introduction).
1477
+
1478
+ ## Inbound Parsing
1479
+
1480
+ Normalize inbound webhooks from Postmark, SendGrid, Mailgun, Cloudflare Email and SES into one `InboundEmail` shape, then strip quoted history with `extractReply()` (EN/DE/FR/ES/TR) and group conversations with `stitchThreads()`.
1481
+
1482
+ See [Inbound](https://visulima.com/docs/package/email/inbound/introduction).
1483
+
1484
+ ## Deliverability
1485
+
1486
+ 2024 bulk-sender tooling in `@visulima/email/deliverability`: RFC 8058 one-click `buildListUnsubscribe`, suppression stores (`MemorySuppressionStore` + `filterSuppressed`), and parsers for DMARC records, MTA-STS policies, TLS-RPT records/reports, and ARF feedback-loop complaints. ARC sealing (`signArc`) lives in `@visulima/email/crypto`.
1487
+
1488
+ See [Deliverability](https://visulima.com/docs/package/email/deliverability/introduction).
1489
+
1490
+ ## Events & Testing
1491
+
1492
+ A unified `EmailEvent` stream (`EventBus` + `MemoryEventStore` in `@visulima/email/events`), and a test harness (`@visulima/email/test`): `createTestEmail()` plus Vitest matchers `toHaveSentTo` / `toHaveSentWithSubject` / `toHaveSentWithAttachment` / `toHaveSentMatching`.
1493
+
1494
+ See [Events](https://visulima.com/docs/package/email/events/introduction) and [Testing](https://visulima.com/docs/package/email/testing/introduction).
1495
+
1496
+ ## Crypto (DKIM / S/MIME / ARC)
1497
+
1498
+ Sign and encrypt messages with `@visulima/email/crypto`: `createDkimSigner` (DKIM-Signature header), `createSmimeSigner` / `createSmimeEncrypter` (S/MIME sign and encrypt, via the optional `pkijs` + `asn1js` peers), and `signArc` / `verifyArc` for ARC sealing on forwarded mail. Attach signers/encrypters to a `MailMessage` with `.sign(...)` / `.encrypt(...)`.
1499
+
1500
+ ```typescript
1501
+ import { MailMessage } from "@visulima/email";
1502
+ import { createDkimSigner } from "@visulima/email/crypto";
1503
+
1504
+ const signer = createDkimSigner({
1505
+ domainName: "example.com",
1506
+ keySelector: "default",
1507
+ privateKey: "file:///path/to/dkim.private.key", // or an inline PEM string
1508
+ });
1509
+
1510
+ const message = new MailMessage().from({ email: "a@example.com" }).to({ email: "b@example.com" }).subject("Signed").html("<p>Hello</p>").sign(signer); // DKIM-Signature is added during build()
1511
+ ```
1512
+
1513
+ See [Crypto](https://visulima.com/docs/package/email/crypto/introduction).
1514
+
1419
1515
  ## Related
1420
1516
 
1421
1517
  ## Supported Node.js Versions
@@ -1,7 +1,164 @@
1
- import { E as EmailOptions } from "../packem_shared/types.d-wwpgA3to.js";
2
- import { D as DkimOptions, E as EmailSigner, S as SmimeEncryptOptions, a as EmailEncrypter, b as SmimeSignOptions } from "../packem_shared/types.d-CNnnk-Ya.js";
1
+ import { KeyObject } from 'node:crypto';
2
+ import { E as EmailOptions } from "../packem_shared/types.d-ejzh-xBP.js";
3
+ import { D as DkimOptions, E as EmailSigner, S as SmimeEncryptOptions, a as EmailEncrypter, b as SmimeSignOptions } from "../packem_shared/types.d-BId55FW2.js";
3
4
  import 'node:buffer';
4
5
  /**
6
+ * The signature algorithm for the ARC headers. RSA per RFC 8617, Ed25519 per RFC 8463.
7
+ */
8
+ type ArcAlgorithm = "ed25519-sha256" | "rsa-sha256";
9
+ /**
10
+ * Options for {@link signArc}.
11
+ */
12
+ interface ArcSealOptions {
13
+ /**
14
+ * Signature algorithm (`a=`). `rsa-sha256` (default) or `ed25519-sha256` (RFC 8463).
15
+ * @default "rsa-sha256"
16
+ */
17
+ algorithm?: ArcAlgorithm;
18
+ /**
19
+ * The `Authentication-Results` value to chain (authserv-id plus method results),
20
+ * e.g. `example.com; spf=pass smtp.mailfrom=...; dkim=pass header.d=...`.
21
+ */
22
+ authenticationResults: string;
23
+ /**
24
+ * Chain validation status for the seal (`cv`). For an originating sealer (instance 1) this is
25
+ * always `none`.
26
+ * @default "none"
27
+ */
28
+ cv?: "fail" | "none" | "pass";
29
+ /**
30
+ * The signing domain (`d`).
31
+ */
32
+ domainName: string;
33
+ /**
34
+ * Lower-cased header names covered by the ARC-Message-Signature (`h`).
35
+ * @default from, to, cc, subject, date, message-id, mime-version
36
+ */
37
+ headersToSign?: string[];
38
+ /**
39
+ * The ARC instance number (`i`). Only `1` (originating sealer) is supported.
40
+ * @default 1
41
+ */
42
+ instance?: number;
43
+ /**
44
+ * The DKIM/ARC key selector (`s`).
45
+ */
46
+ keySelector: string;
47
+ /**
48
+ * Passphrase for an encrypted private key.
49
+ */
50
+ passphrase?: string;
51
+ /**
52
+ * Private key (PEM string, or a `file://` path). RSA or Ed25519 to match `algorithm`.
53
+ */
54
+ privateKey: string;
55
+ /**
56
+ * Signature timestamp (`t`) in unix seconds. Defaults to now.
57
+ */
58
+ timestamp?: number;
59
+ }
60
+ /**
61
+ * The three ARC header fields produced for one instance.
62
+ */
63
+ interface ArcHeaderSet {
64
+ "ARC-Authentication-Results": string;
65
+ "ARC-Message-Signature": string;
66
+ "ARC-Seal": string;
67
+ }
68
+ /**
69
+ * Options for {@link verifyArc}.
70
+ */
71
+ interface ArcVerifyOptions {
72
+ /**
73
+ * The ARC/DKIM public key for the signing domain+selector — a PEM string or a `KeyObject`. Look it
74
+ * up at `&lt;selector>._domainkey.&lt;d>` (the `p=` tag), decoded to SPKI.
75
+ */
76
+ publicKey: KeyObject | string;
77
+ }
78
+ /**
79
+ * The outcome of {@link verifyArc}.
80
+ */
81
+ interface ArcVerifyResult {
82
+ /**
83
+ * Per-component verification: the ARC-Message-Signature, the ARC-Seal, and the body hash.
84
+ */
85
+ components: {
86
+ ams: boolean;
87
+ bodyHash: boolean;
88
+ seal: boolean;
89
+ };
90
+ /**
91
+ * The chain-validation status (`cv`) from the ARC-Seal.
92
+ */
93
+ cv?: string;
94
+ /**
95
+ * A machine-readable reason when `valid` is `false`.
96
+ */
97
+ reason?: string;
98
+ /**
99
+ * Whether the whole instance verified (signature + seal + body hash).
100
+ */
101
+ valid: boolean;
102
+ }
103
+ /**
104
+ * Computes the exact byte string that the ARC-Message-Signature `b=` value signs.
105
+ *
106
+ * Exposed so ARC verifiers (and tests) can re-derive the signing input.
107
+ * @param email The email being sealed.
108
+ * @param options The seal options.
109
+ * @returns The AMS header (without the `b=` value) and the data signed.
110
+ */
111
+ declare const arcMessageSignatureBase: (email: EmailOptions, options: ArcSealOptions) => {
112
+ header: string;
113
+ signBase: string;
114
+ };
115
+ /**
116
+ * Computes the exact byte string that the ARC-Seal `b=` value signs (for an originating, i=1 seal).
117
+ *
118
+ * Exposed so ARC verifiers (and tests) can re-derive the signing input.
119
+ * @param aarValue The ARC-Authentication-Results value.
120
+ * @param amsValue The full ARC-Message-Signature value (including its `b=` signature).
121
+ * @param options The signing domain, selector, instance, timestamp and chain-validation status.
122
+ * @returns The ARC-Seal header (without the `b=` value) and the data signed.
123
+ */
124
+ declare const arcSealBase: (aarValue: string, amsValue: string, options: ArcSealOptions) => {
125
+ header: string;
126
+ signBase: string;
127
+ };
128
+ /**
129
+ * Seals a message with an ARC (Authenticated Received Chain, RFC 8617) header set for an originating
130
+ * sealer (instance `i=1`).
131
+ *
132
+ * Adds `ARC-Authentication-Results`, `ARC-Message-Signature`, and `ARC-Seal` headers. Use this when
133
+ * your service forwards mail and wants downstream receivers to trust the authentication results you
134
+ * observed. Supports RSA (default) and Ed25519 (`algorithm: "ed25519-sha256"`, RFC 8463) keys.
135
+ *
136
+ * IMPORTANT: the body hash (`bh=`) is computed over `text` + "\n\n" + `html` with relaxed
137
+ * canonicalization — the same simplification as the DKIM signer. For a third-party ARC verifier to
138
+ * accept the seal, the body actually transmitted on the wire must canonicalize to this same value, so
139
+ * apply ARC at the point where the MIME body is finalized (or feed in the exact rendered body).
140
+ * @param email The email to seal.
141
+ * @param options The seal options. See {@link ArcSealOptions}.
142
+ * @returns The email with the ARC header set added, and the raw {@link ArcHeaderSet}.
143
+ * @throws {Error} When the private key cannot be loaded or signing fails.
144
+ */
145
+ declare const signArc: (email: EmailOptions, options: ArcSealOptions) => Promise<{
146
+ email: EmailOptions;
147
+ headers: ArcHeaderSet;
148
+ }>;
149
+ /**
150
+ * Verifies an originating (i=1) ARC header set against the signing domain's public key.
151
+ *
152
+ * Re-derives the AMS and ARC-Seal signing inputs from `email` + the supplied ARC headers, recomputes
153
+ * the body hash, and checks all three. The public key must be the one published for the seal's
154
+ * `s=`/`d=` (the DKIM-style `&lt;selector>._domainkey.&lt;domain>` TXT `p=` value).
155
+ * @param email The message that was sealed (same fields used when signing).
156
+ * @param headers The ARC header set (or any record containing the three `ARC-*` headers).
157
+ * @param options Verification options. See {@link ArcVerifyOptions}.
158
+ * @returns The verification result. See {@link ArcVerifyResult}.
159
+ */
160
+ declare const verifyArc: (email: EmailOptions, headers: ArcHeaderSet | Record<string, string>, options: ArcVerifyOptions) => ArcVerifyResult;
161
+ /**
5
162
  * DKIM signer implementation
6
163
  */
7
164
  declare class DkimSigner implements EmailSigner {
@@ -144,4 +301,4 @@ declare class SmimeSigner implements EmailSigner {
144
301
  * @returns A new SmimeSigner instance ready to sign emails.
145
302
  */
146
303
  declare const createSmimeSigner: (options: SmimeSignOptions) => SmimeSigner;
147
- export { type DkimOptions, DkimSigner, type EmailEncrypter, type EmailSigner, type SmimeEncryptOptions, SmimeEncrypter, type SmimeSignOptions, SmimeSigner, createDkimSigner, createSmimeEncrypter, createSmimeSigner };
304
+ export { type ArcAlgorithm, type ArcHeaderSet, type ArcSealOptions, type ArcVerifyOptions, type ArcVerifyResult, type DkimOptions, DkimSigner, type EmailEncrypter, type EmailSigner, type SmimeEncryptOptions, SmimeEncrypter, type SmimeSignOptions, SmimeSigner, arcMessageSignatureBase, arcSealBase, createDkimSigner, createSmimeEncrypter, createSmimeSigner, signArc, verifyArc };
@@ -1 +1 @@
1
- import{DkimSigner as m,createDkimSigner as i}from"../packem_shared/DkimSigner-CT2DSHD1.js";import{SmimeEncrypter as S,createSmimeEncrypter as n}from"../packem_shared/SmimeEncrypter-ZhHEgDwY.js";import{SmimeSigner as c,createSmimeSigner as p}from"../packem_shared/SmimeSigner-CYSVF6ez.js";export{m as DkimSigner,S as SmimeEncrypter,c as SmimeSigner,i as createDkimSigner,n as createSmimeEncrypter,p as createSmimeSigner};
1
+ import{arcMessageSignatureBase as m,arcSealBase as i,signArc as a,verifyArc as t}from"../packem_shared/arcMessageSignatureBase-BY4j0TxM.js";import{DkimSigner as c,createDkimSigner as n}from"../packem_shared/DkimSigner-BuSbnos1.js";import{SmimeEncrypter as g,createSmimeEncrypter as p}from"../packem_shared/SmimeEncrypter-C7usORKF.js";import{SmimeSigner as s,createSmimeSigner as x}from"../packem_shared/SmimeSigner-DgAApLPS.js";export{c as DkimSigner,g as SmimeEncrypter,s as SmimeSigner,m as arcMessageSignatureBase,i as arcSealBase,n as createDkimSigner,p as createSmimeEncrypter,x as createSmimeSigner,a as signArc,t as verifyArc};
@@ -0,0 +1,95 @@
1
+ /**
2
+ * A DKIM/SPF auth result inside a DMARC aggregate record.
3
+ */
4
+ interface DmarcAuthResult {
5
+ domain?: string;
6
+ result?: string;
7
+ }
8
+ /**
9
+ * One `&lt;record>` row of a DMARC aggregate report.
10
+ */
11
+ interface DmarcRecordRow {
12
+ /**
13
+ * The per-mechanism auth results.
14
+ */
15
+ authResults: {
16
+ dkim: DmarcAuthResult[];
17
+ spf: DmarcAuthResult[];
18
+ };
19
+ /**
20
+ * Number of messages this row represents.
21
+ */
22
+ count: number;
23
+ /**
24
+ * The policy disposition applied (`none` / `quarantine` / `reject`).
25
+ */
26
+ disposition?: string;
27
+ /**
28
+ * The DKIM alignment result (`pass` / `fail`).
29
+ */
30
+ dkim?: string;
31
+ /**
32
+ * The `From:` header domain.
33
+ */
34
+ headerFrom?: string;
35
+ /**
36
+ * The source IP that sent the messages.
37
+ */
38
+ sourceIp?: string;
39
+ /**
40
+ * The SPF alignment result (`pass` / `fail`).
41
+ */
42
+ spf?: string;
43
+ }
44
+ /**
45
+ * A parsed DMARC aggregate (RUA) report.
46
+ */
47
+ interface DmarcAggregateReport {
48
+ /**
49
+ * Report window start (`date_range.begin`, unix seconds as a string).
50
+ */
51
+ dateRangeBegin?: string;
52
+ /**
53
+ * Report window end (`date_range.end`, unix seconds as a string).
54
+ */
55
+ dateRangeEnd?: string;
56
+ /**
57
+ * The reporter's contact email.
58
+ */
59
+ email?: string;
60
+ /**
61
+ * The reporting organization.
62
+ */
63
+ organizationName?: string;
64
+ /**
65
+ * The published policy the report was evaluated against.
66
+ */
67
+ policyPublished?: {
68
+ adkim?: string;
69
+ aspf?: string;
70
+ domain?: string;
71
+ p?: string;
72
+ pct?: number;
73
+ sp?: string;
74
+ };
75
+ /**
76
+ * The per-source rows.
77
+ */
78
+ records: DmarcRecordRow[];
79
+ /**
80
+ * The unique report id.
81
+ */
82
+ reportId?: string;
83
+ }
84
+ /**
85
+ * Parses a DMARC aggregate (RUA) report XML document into a structured object.
86
+ *
87
+ * Reports arrive gzipped/zipped — decompress to the XML string first. `fast-xml-parser` is an optional
88
+ * peer dependency (`pnpm add fast-xml-parser`), loaded only via this `./deliverability/dmarc-report`
89
+ * entry point so the rest of the deliverability tooling stays dependency-free.
90
+ * @param xml The DMARC aggregate report XML.
91
+ * @returns The parsed report. See {@link DmarcAggregateReport}.
92
+ * @throws {EmailError} When `fast-xml-parser` is not installed or the XML cannot be parsed.
93
+ */
94
+ declare const parseDmarcReport: (xml: string) => Promise<DmarcAggregateReport>;
95
+ export { type DmarcAggregateReport, type DmarcAuthResult, type DmarcRecordRow, parseDmarcReport };
@@ -0,0 +1 @@
1
+ import l from"../packem_shared/EmailError-B-sEf3bp.js";const g=a=>a==null?[]:Array.isArray(a)?a:[a],e=a=>{if(typeof a=="string")return a;if(typeof a=="number"||typeof a=="boolean")return String(a)},c=a=>{const r=e(a);if(r===void 0)return;const s=Number(r);return Number.isNaN(s)?void 0:s},f=a=>g(a).map(r=>({domain:e(r.domain),result:e(r.result)})),h=async a=>{let r;try{({XMLParser:r}=await import("fast-xml-parser"))}catch(t){throw t instanceof Error&&(t.code==="ERR_MODULE_NOT_FOUND"||t.message.includes("Cannot find module")||t.message.includes("Cannot find package"))?new l("deliverability","fast-xml-parser is not installed. Please install it: pnpm add fast-xml-parser",{cause:t}):new l("deliverability",`Failed to load fast-xml-parser: ${t.message}`,{cause:t})}let s;try{s=new r({ignoreAttributes:!0,parseTagValue:!1}).parse(a)}catch(t){throw new l("deliverability",`Failed to parse DMARC report: ${t.message}`,{cause:t})}const n=s.feedback??{},o=n.report_metadata??{},m=o.date_range??{},i=n.policy_published??{},y=g(n.record).map(t=>{const d=t.row??{},p=d.policy_evaluated??{},b=t.identifiers??{},u=t.auth_results??{};return{authResults:{dkim:f(u.dkim),spf:f(u.spf)},count:c(d.count)??0,disposition:e(p.disposition),dkim:e(p.dkim),headerFrom:e(b.header_from),sourceIp:e(d.source_ip),spf:e(p.spf)}});return{dateRangeBegin:e(m.begin),dateRangeEnd:e(m.end),email:e(o.email),organizationName:e(o.org_name),policyPublished:{adkim:e(i.adkim),aspf:e(i.aspf),domain:e(i.domain),p:e(i.p),pct:c(i.pct),sp:e(i.sp)},records:y,reportId:e(o.report_id)}};export{h as parseDmarcReport};