@visulima/email 1.0.0-alpha.9 → 1.0.1

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 (396) hide show
  1. package/CHANGELOG.md +782 -0
  2. package/LICENSE.md +541 -847
  3. package/README.md +212 -191
  4. package/dist/crypto/index.d.ts +304 -4
  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 +94 -9
  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-CiLBaXrg.js +18 -0
  20. package/dist/packem_shared/DraftMailMessage-CGTVuy2z.js +1 -0
  21. package/dist/packem_shared/EmailError-B-sEf3bp.js +1 -0
  22. package/dist/packem_shared/Mail-C1zp-fqt.js +1 -0
  23. package/dist/packem_shared/MailMessage-DQRgs5Dz.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-DavopRlE.js +6 -0
  30. package/dist/packem_shared/SmimeSigner-0onWksAv.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-D81_wUA1.js +1 -0
  35. package/dist/packem_shared/arcMessageSignatureBase-DDLEHW2E.js +17 -0
  36. package/dist/packem_shared/attachment-processor-CMp7qqMI.js +1 -0
  37. package/dist/packem_shared/awsSesProvider-BGZJUIep.js +32 -0
  38. package/dist/packem_shared/azureProvider-CmcK4bsf.js +1 -0
  39. package/dist/packem_shared/brevoProvider-C1BDXr41.js +1 -0
  40. package/dist/packem_shared/build-mime-message-B6927SQy.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-Bv-ty-74.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-D3XPGiHY.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-DFH3kp6K.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-BoZvzveg.js +11 -0
  65. package/dist/packem_shared/infobipProvider-lHyGrXgZ.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-DyloxzNC.js +1 -0
  71. package/dist/packem_shared/mail.d-B9SSqyy0.d.ts +909 -0
  72. package/dist/packem_shared/{mailCrabProvider-CM_CFDca.js → mailCrabProvider-CPtBT6Th.js} +1 -1
  73. package/dist/packem_shared/mailPaceProvider-CJEvOFBh.js +1 -0
  74. package/dist/packem_shared/mailchannelsProvider-osRkW_tz.js +1 -0
  75. package/dist/packem_shared/mailerSendProvider-C_6LzARK.js +1 -0
  76. package/dist/packem_shared/mailgunProvider-DkISvMPe.js +1 -0
  77. package/dist/packem_shared/mailjetProvider-CV0i4Xzh.js +1 -0
  78. package/dist/packem_shared/mailomatProvider-B5YFonEO.js +1 -0
  79. package/dist/packem_shared/mailtrapProvider-C4ZquIPz.js +1 -0
  80. package/dist/packem_shared/make-request-BlK_B72c.js +1 -0
  81. package/dist/packem_shared/mandrillProvider-DWPFh_Sj.js +1 -0
  82. package/dist/packem_shared/mockProvider-Behywbl1.js +1 -0
  83. package/dist/packem_shared/netcoreProvider-C5TEciaN.js +1 -0
  84. package/dist/packem_shared/nodemailerProvider-BFHobXxt.js +1 -0
  85. package/dist/packem_shared/normalizeMessageId-DAx2pGe2.js +1 -0
  86. package/dist/packem_shared/oauth2Middleware-CodqXkyj.js +1 -0
  87. package/dist/packem_shared/opentelemetryProvider-ByHC01ub.js +1 -0
  88. package/dist/packem_shared/outlook365Provider-63ggDpqV.js +1 -0
  89. package/dist/packem_shared/parseAddress-DdbViBAJ.js +1 -0
  90. package/dist/packem_shared/parseArfReport-Ds6S3c4J.js +6 -0
  91. package/dist/packem_shared/parseCloudflareInbound-C__j-oNa.js +1 -0
  92. package/dist/packem_shared/parseDmarcRecord-DXZ-_rF0.js +1 -0
  93. package/dist/packem_shared/parseMailgunInbound-BpC6uPNe.js +1 -0
  94. package/dist/packem_shared/parsePostmarkInbound-Co3_c6-9.js +1 -0
  95. package/dist/packem_shared/parseSendGridInbound-DsALoijO.js +4 -0
  96. package/dist/packem_shared/parseSesInbound-CH5tHIjp.js +1 -0
  97. package/dist/packem_shared/parseTlsReport-wPe1lIDs.js +1 -0
  98. package/dist/packem_shared/plunkProvider-yTlrJVEp.js +1 -0
  99. package/dist/packem_shared/postProcessHtml-DqKi2Ucg.js +1 -0
  100. package/dist/packem_shared/postalProvider-CRX_bMYD.js +1 -0
  101. package/dist/packem_shared/postmarkProvider-CDx85Yge.js +1 -0
  102. package/dist/packem_shared/provider-base-C7PuopYK.js +1 -0
  103. package/dist/packem_shared/provider.d-J-y6iogK.d.ts +28 -0
  104. package/dist/packem_shared/quoted-printable-nSGDA1tA.js +7 -0
  105. package/dist/packem_shared/resendProvider-CiclWxzr.js +1 -0
  106. package/dist/packem_shared/retry-3pnxTuNs.js +1 -0
  107. package/dist/packem_shared/retryMiddleware-DbViDX4r.js +1 -0
  108. package/dist/packem_shared/roundRobinProvider-D1by5KGW.js +1 -0
  109. package/dist/packem_shared/sanitize-header-DJhgZl3y.js +1 -0
  110. package/dist/packem_shared/scalewayProvider-BcND48qO.js +1 -0
  111. package/dist/packem_shared/sendGridProvider-D8ZLgY62.js +1 -0
  112. package/dist/packem_shared/smtpProvider-Bm0yP97W.js +25 -0
  113. package/dist/packem_shared/sparkpostProvider-CTYfSRaV.js +1 -0
  114. package/dist/packem_shared/sweegoProvider-DOoin_vi.js +1 -0
  115. package/dist/packem_shared/toEmailSnapshot-DeRqM5SJ.js +1 -0
  116. package/dist/packem_shared/tracer.d-MU42G1jG.d.ts +494 -0
  117. package/dist/packem_shared/types.d-BId55FW2.d.ts +107 -0
  118. package/dist/packem_shared/types.d-CmoWvdZi.d.ts +61 -0
  119. package/dist/packem_shared/types.d-DCkecJse.d.ts +51 -0
  120. package/dist/packem_shared/types.d-Mpu0HZoG.d.ts +24 -0
  121. package/dist/packem_shared/types.d-ejzh-xBP.d.ts +209 -0
  122. package/dist/packem_shared/types.d-lcJZmwRK.d.ts +69 -0
  123. package/dist/packem_shared/types.d-nyR1ty1Q.d.ts +9 -0
  124. package/dist/packem_shared/utils-BfYfPB_I.js +1 -0
  125. package/dist/packem_shared/validate-email-options-mCM9dVug.js +1 -0
  126. package/dist/packem_shared/verifyMailgunWebhook-Cwl0OD3P.js +1 -0
  127. package/dist/packem_shared/verifyPostmarkWebhook-C72ZvbrG.js +1 -0
  128. package/dist/packem_shared/verifyResendWebhook-YK2zNDXR.js +1 -0
  129. package/dist/packem_shared/verifySendGridWebhook-Dbwc1tfG.js +1 -0
  130. package/dist/packem_shared/withEvents-CCVblSqj.js +1 -0
  131. package/dist/packem_shared/withMetrics-DWywX_6M.js +1 -0
  132. package/dist/packem_shared/withRender-VP9wE5Yr.js +1 -0
  133. package/dist/packem_shared/withSuppression-DBaZDMAr.js +1 -0
  134. package/dist/packem_shared/withTelemetry-DL2qo0Hp.js +1 -0
  135. package/dist/packem_shared/zeptomailProvider-DKBPSHPj.js +1 -0
  136. package/dist/providers/ahasend/index.d.ts +36 -3
  137. package/dist/providers/ahasend/index.js +1 -1
  138. package/dist/providers/aws-ses/index.d.ts +47 -3
  139. package/dist/providers/aws-ses/index.js +1 -1
  140. package/dist/providers/azure/index.d.ts +52 -3
  141. package/dist/providers/azure/index.js +1 -1
  142. package/dist/providers/brevo/index.d.ts +65 -3
  143. package/dist/providers/brevo/index.js +1 -1
  144. package/dist/providers/cloudflare-email/index.d.ts +36 -0
  145. package/dist/providers/cloudflare-email/index.js +1 -0
  146. package/dist/providers/failover/index.d.ts +27 -3
  147. package/dist/providers/failover/index.js +1 -1
  148. package/dist/providers/http/index.d.ts +35 -3
  149. package/dist/providers/http/index.js +1 -1
  150. package/dist/providers/infobip/index.d.ts +56 -3
  151. package/dist/providers/infobip/index.js +1 -1
  152. package/dist/providers/loops/index.d.ts +47 -0
  153. package/dist/providers/loops/index.js +1 -0
  154. package/dist/providers/mailchannels/index.d.ts +26 -0
  155. package/dist/providers/mailchannels/index.js +1 -0
  156. package/dist/providers/mailcrab/index.d.ts +32 -3
  157. package/dist/providers/mailcrab/index.js +1 -1
  158. package/dist/providers/mailersend/index.d.ts +51 -3
  159. package/dist/providers/mailersend/index.js +1 -1
  160. package/dist/providers/mailgun/index.d.ts +73 -3
  161. package/dist/providers/mailgun/index.js +1 -1
  162. package/dist/providers/mailjet/index.d.ts +72 -3
  163. package/dist/providers/mailjet/index.js +1 -1
  164. package/dist/providers/mailomat/index.d.ts +40 -3
  165. package/dist/providers/mailomat/index.js +1 -1
  166. package/dist/providers/mailpace/index.d.ts +52 -3
  167. package/dist/providers/mailpace/index.js +1 -1
  168. package/dist/providers/mailtrap/index.d.ts +44 -3
  169. package/dist/providers/mailtrap/index.js +1 -1
  170. package/dist/providers/mandrill/index.d.ts +87 -3
  171. package/dist/providers/mandrill/index.js +1 -1
  172. package/dist/providers/mock/index.d.ts +12 -3
  173. package/dist/providers/mock/index.js +1 -1
  174. package/dist/providers/netcore/index.d.ts +35 -0
  175. package/dist/providers/netcore/index.js +1 -0
  176. package/dist/providers/nodemailer/index.d.ts +38 -3
  177. package/dist/providers/nodemailer/index.js +1 -1
  178. package/dist/providers/opentelemetry/index.d.ts +37 -3
  179. package/dist/providers/opentelemetry/index.js +1 -1
  180. package/dist/providers/outlook365/index.d.ts +48 -0
  181. package/dist/providers/outlook365/index.js +1 -0
  182. package/dist/providers/plunk/index.d.ts +38 -3
  183. package/dist/providers/plunk/index.js +1 -1
  184. package/dist/providers/postal/index.d.ts +48 -3
  185. package/dist/providers/postal/index.js +1 -1
  186. package/dist/providers/postmark/index.d.ts +60 -3
  187. package/dist/providers/postmark/index.js +1 -1
  188. package/dist/providers/resend/index.d.ts +51 -3
  189. package/dist/providers/resend/index.js +1 -1
  190. package/dist/providers/roundrobin/index.d.ts +27 -3
  191. package/dist/providers/roundrobin/index.js +1 -1
  192. package/dist/providers/scaleway/index.d.ts +44 -3
  193. package/dist/providers/scaleway/index.js +1 -1
  194. package/dist/providers/sendgrid/index.d.ts +84 -3
  195. package/dist/providers/sendgrid/index.js +1 -1
  196. package/dist/providers/smtp/index.d.ts +71 -3
  197. package/dist/providers/smtp/index.js +1 -1
  198. package/dist/providers/sparkpost/index.d.ts +43 -0
  199. package/dist/providers/sparkpost/index.js +1 -0
  200. package/dist/providers/sweego/index.d.ts +40 -3
  201. package/dist/providers/sweego/index.js +1 -1
  202. package/dist/providers/zeptomail/index.d.ts +37 -3
  203. package/dist/providers/zeptomail/index.js +1 -1
  204. package/dist/queue/bullmq-queue.d.ts +46 -0
  205. package/dist/queue/bullmq-queue.js +1 -0
  206. package/dist/queue/index.d.ts +147 -0
  207. package/dist/queue/index.js +1 -0
  208. package/dist/queue/pg-boss-queue.d.ts +41 -0
  209. package/dist/queue/pg-boss-queue.js +1 -0
  210. package/dist/queue/sqs-queue.d.ts +72 -0
  211. package/dist/queue/sqs-queue.js +1 -0
  212. package/dist/queue/unstorage-queue.d.ts +199 -0
  213. package/dist/queue/unstorage-queue.js +1 -0
  214. package/dist/render/index.d.ts +107 -0
  215. package/dist/render/index.js +1 -0
  216. package/dist/template-engines/handlebars.d.ts +23 -22
  217. package/dist/template-engines/handlebars.js +1 -1
  218. package/dist/template-engines/html-to-text.d.ts +24 -24
  219. package/dist/template-engines/html-to-text.js +1 -1
  220. package/dist/template-engines/i18n.d.ts +61 -0
  221. package/dist/template-engines/i18n.js +1 -0
  222. package/dist/template-engines/jsx-email.d.ts +11 -0
  223. package/dist/template-engines/jsx-email.js +1 -0
  224. package/dist/template-engines/liquid.d.ts +12 -0
  225. package/dist/template-engines/liquid.js +1 -0
  226. package/dist/template-engines/mjml.d.ts +10 -10
  227. package/dist/template-engines/mjml.js +1 -1
  228. package/dist/template-engines/react-email.d.ts +9 -9
  229. package/dist/template-engines/react-email.js +1 -1
  230. package/dist/template-engines/vue-email.d.ts +9 -9
  231. package/dist/template-engines/vue-email.js +1 -1
  232. package/dist/test/index.d.ts +155 -0
  233. package/dist/test/index.js +1 -0
  234. package/dist/utils/cache.d.ts +49 -48
  235. package/dist/utils/cache.js +1 -1
  236. package/dist/utils/format-email-address.d.ts +8 -7
  237. package/dist/utils/format-email-address.js +1 -1
  238. package/dist/utils/normalize-email-aliases.d.ts +20 -20
  239. package/dist/utils/normalize-email-aliases.js +1 -1
  240. package/dist/utils/parse-address.d.ts +18 -17
  241. package/dist/utils/parse-address.js +1 -1
  242. package/dist/utils/parse-eml.d.ts +22 -0
  243. package/dist/utils/parse-eml.js +6 -0
  244. package/dist/utils/result.d.ts +49 -0
  245. package/dist/utils/result.js +1 -0
  246. package/dist/utils/validation/check-feature-support.d.ts +53 -0
  247. package/dist/utils/validation/check-feature-support.js +1 -0
  248. package/dist/utils/validation/validate-email.d.ts +5 -5
  249. package/dist/utils/validation/validate-email.js +1 -1
  250. package/dist/webhooks/index.d.ts +231 -0
  251. package/dist/webhooks/index.js +1 -0
  252. package/package.json +191 -81
  253. package/dist/attachment-helpers.d.ts +0 -64
  254. package/dist/crypto/dkim-signer.d.ts +0 -48
  255. package/dist/crypto/smime-encrypter.d.ts +0 -53
  256. package/dist/crypto/smime-signer.d.ts +0 -48
  257. package/dist/crypto/types.d.ts +0 -101
  258. package/dist/draft-mail-message.d.ts +0 -13
  259. package/dist/errors/email-error.d.ts +0 -17
  260. package/dist/errors/required-option-error.d.ts +0 -10
  261. package/dist/mail-message.d.ts +0 -425
  262. package/dist/mail.d.ts +0 -206
  263. package/dist/packem_shared/DkimSigner-pFd4c3fZ.js +0 -18
  264. package/dist/packem_shared/EmailError-zm2ffVav.js +0 -1
  265. package/dist/packem_shared/Mail-6Bltpy_p.js +0 -1
  266. package/dist/packem_shared/MailMessage-B76GPBBA.js +0 -1
  267. package/dist/packem_shared/RequiredOptionError-CevW3u2K.js +0 -1
  268. package/dist/packem_shared/SmimeEncrypter-CBevU534.js +0 -6
  269. package/dist/packem_shared/SmimeSigner-CObA4jzT.js +0 -8
  270. package/dist/packem_shared/address-formatter-Cm_E_ZMa.js +0 -1
  271. package/dist/packem_shared/ahaSendProvider-DlFKEQ6D.js +0 -1
  272. package/dist/packem_shared/attachment-processor-2rHmfa7j.js +0 -1
  273. package/dist/packem_shared/awsSesProvider-Ba-eVJxZ.js +0 -32
  274. package/dist/packem_shared/azureProvider-CQYAkgVF.js +0 -1
  275. package/dist/packem_shared/brevoProvider-5p6jjiK9.js +0 -1
  276. package/dist/packem_shared/build-mime-message-IYaUqqPJ.js +0 -2
  277. package/dist/packem_shared/create-logger-BiWdqFNg.js +0 -1
  278. package/dist/packem_shared/defineProvider-B9rSklAJ.js +0 -1
  279. package/dist/packem_shared/detectMimeType-S8WRsNtY.js +0 -1
  280. package/dist/packem_shared/failoverProvider-CAHQQueo.js +0 -1
  281. package/dist/packem_shared/generate-boundary-Cx8nXYS0.js +0 -1
  282. package/dist/packem_shared/generate-message-id-D4uA8gkj.js +0 -1
  283. package/dist/packem_shared/headers-to-record-Qo124ImV.js +0 -1
  284. package/dist/packem_shared/httpProvider-CZD6LZX3.js +0 -1
  285. package/dist/packem_shared/infobipProvider-CtLwrUaP.js +0 -1
  286. package/dist/packem_shared/mailPaceProvider-B6yKvh6z.js +0 -1
  287. package/dist/packem_shared/mailerSendProvider-CeeIXFnW.js +0 -1
  288. package/dist/packem_shared/mailgunProvider-mmjKzouh.js +0 -1
  289. package/dist/packem_shared/mailjetProvider-DwN6i0VA.js +0 -1
  290. package/dist/packem_shared/mailomatProvider-DMQmjKHT.js +0 -1
  291. package/dist/packem_shared/mailtrapProvider-BN3UBEQw.js +0 -1
  292. package/dist/packem_shared/make-request-BDzF9W9D.js +0 -1
  293. package/dist/packem_shared/mandrillProvider-370y7CLu.js +0 -1
  294. package/dist/packem_shared/mockProvider-DN5ZwutD.js +0 -1
  295. package/dist/packem_shared/nodemailerProvider-_w8QXMU-.js +0 -1
  296. package/dist/packem_shared/opentelemetryProvider-C_ZXOLSd.js +0 -1
  297. package/dist/packem_shared/plunkProvider-DfJumQ4U.js +0 -1
  298. package/dist/packem_shared/postalProvider-Bavx2FcH.js +0 -1
  299. package/dist/packem_shared/postmarkProvider-DFC0uvjO.js +0 -1
  300. package/dist/packem_shared/provider-base-Cmzx6BTO.js +0 -1
  301. package/dist/packem_shared/readFile-BlZxbhCU-C8bCdiA2.js +0 -1
  302. package/dist/packem_shared/resendProvider-CfqU7UdE.js +0 -1
  303. package/dist/packem_shared/roundRobinProvider-1WQnuKR8.js +0 -1
  304. package/dist/packem_shared/sanitize-header-wWav-Scu.js +0 -1
  305. package/dist/packem_shared/scalewayProvider-be1HPimL.js +0 -1
  306. package/dist/packem_shared/sendGridProvider-BVI1sq3n.js +0 -1
  307. package/dist/packem_shared/smtpProvider-BV-ufR53.js +0 -23
  308. package/dist/packem_shared/sweegoProvider-7419CSAq.js +0 -1
  309. package/dist/packem_shared/validate-email-options-DfJ7llf8.js +0 -1
  310. package/dist/packem_shared/zeptomailProvider-C2lh0Xmo.js +0 -1
  311. package/dist/providers/ahasend/provider.d.ts +0 -7
  312. package/dist/providers/ahasend/types.d.ts +0 -28
  313. package/dist/providers/aws-ses/provider.d.ts +0 -8
  314. package/dist/providers/aws-ses/types.d.ts +0 -38
  315. package/dist/providers/azure/provider.d.ts +0 -7
  316. package/dist/providers/azure/types.d.ts +0 -44
  317. package/dist/providers/brevo/provider.d.ts +0 -7
  318. package/dist/providers/brevo/types.d.ts +0 -57
  319. package/dist/providers/failover/provider.d.ts +0 -7
  320. package/dist/providers/failover/types.d.ts +0 -19
  321. package/dist/providers/http/provider.d.ts +0 -7
  322. package/dist/providers/http/types.d.ts +0 -27
  323. package/dist/providers/infobip/provider.d.ts +0 -7
  324. package/dist/providers/infobip/types.d.ts +0 -48
  325. package/dist/providers/mailcrab/provider.d.ts +0 -9
  326. package/dist/providers/mailcrab/types.d.ts +0 -22
  327. package/dist/providers/mailersend/provider.d.ts +0 -7
  328. package/dist/providers/mailersend/types.d.ts +0 -43
  329. package/dist/providers/mailgun/provider.d.ts +0 -7
  330. package/dist/providers/mailgun/types.d.ts +0 -65
  331. package/dist/providers/mailjet/provider.d.ts +0 -7
  332. package/dist/providers/mailjet/types.d.ts +0 -64
  333. package/dist/providers/mailomat/provider.d.ts +0 -7
  334. package/dist/providers/mailomat/types.d.ts +0 -32
  335. package/dist/providers/mailpace/provider.d.ts +0 -7
  336. package/dist/providers/mailpace/types.d.ts +0 -44
  337. package/dist/providers/mailtrap/provider.d.ts +0 -7
  338. package/dist/providers/mailtrap/types.d.ts +0 -36
  339. package/dist/providers/mandrill/provider.d.ts +0 -7
  340. package/dist/providers/mandrill/types.d.ts +0 -79
  341. package/dist/providers/mock/provider.d.ts +0 -8
  342. package/dist/providers/mock/types.d.ts +0 -50
  343. package/dist/providers/nodemailer/provider.d.ts +0 -7
  344. package/dist/providers/nodemailer/types.d.ts +0 -30
  345. package/dist/providers/opentelemetry/provider.d.ts +0 -8
  346. package/dist/providers/opentelemetry/types.d.ts +0 -31
  347. package/dist/providers/plunk/provider.d.ts +0 -7
  348. package/dist/providers/plunk/types.d.ts +0 -30
  349. package/dist/providers/postal/provider.d.ts +0 -7
  350. package/dist/providers/postal/types.d.ts +0 -40
  351. package/dist/providers/postmark/provider.d.ts +0 -7
  352. package/dist/providers/postmark/types.d.ts +0 -52
  353. package/dist/providers/provider.d.ts +0 -27
  354. package/dist/providers/resend/provider.d.ts +0 -7
  355. package/dist/providers/resend/types.d.ts +0 -43
  356. package/dist/providers/roundrobin/provider.d.ts +0 -7
  357. package/dist/providers/roundrobin/types.d.ts +0 -19
  358. package/dist/providers/scaleway/provider.d.ts +0 -7
  359. package/dist/providers/scaleway/types.d.ts +0 -36
  360. package/dist/providers/sendgrid/provider.d.ts +0 -7
  361. package/dist/providers/sendgrid/types.d.ts +0 -76
  362. package/dist/providers/smtp/provider.d.ts +0 -7
  363. package/dist/providers/smtp/types.d.ts +0 -63
  364. package/dist/providers/sweego/provider.d.ts +0 -7
  365. package/dist/providers/sweego/types.d.ts +0 -32
  366. package/dist/providers/utils/address-formatter.d.ts +0 -139
  367. package/dist/providers/utils/attachment-processor.d.ts +0 -58
  368. package/dist/providers/utils/index.d.ts +0 -4
  369. package/dist/providers/utils/payload-builder.d.ts +0 -78
  370. package/dist/providers/utils/provider-base.d.ts +0 -69
  371. package/dist/providers/zeptomail/provider.d.ts +0 -7
  372. package/dist/providers/zeptomail/types.d.ts +0 -29
  373. package/dist/template-engines/types.d.ts +0 -8
  374. package/dist/types.d.ts +0 -203
  375. package/dist/utils/build-mime-message.d.ts +0 -8
  376. package/dist/utils/create-logger.d.ts +0 -16
  377. package/dist/utils/format-email-addresses.d.ts +0 -8
  378. package/dist/utils/generate-boundary.d.ts +0 -7
  379. package/dist/utils/generate-message-id.d.ts +0 -6
  380. package/dist/utils/headers-to-record.d.ts +0 -9
  381. package/dist/utils/is-port-available.d.ts +0 -9
  382. package/dist/utils/make-request.d.ts +0 -18
  383. package/dist/utils/retry.d.ts +0 -10
  384. package/dist/utils/sanitize-header.d.ts +0 -14
  385. package/dist/utils/to-base64.d.ts +0 -8
  386. package/dist/utils/validation/check-mx-records.d.ts +0 -42
  387. package/dist/utils/validation/check-mx-records.js +0 -1
  388. package/dist/utils/validation/disposable-email-domains.d.ts +0 -13
  389. package/dist/utils/validation/disposable-email-domains.js +0 -1
  390. package/dist/utils/validation/role-accounts.d.ts +0 -21
  391. package/dist/utils/validation/role-accounts.js +0 -1
  392. package/dist/utils/validation/validate-email-options.d.ts +0 -8
  393. package/dist/utils/validation/verify-email.d.ts +0 -47
  394. package/dist/utils/validation/verify-email.js +0 -1
  395. package/dist/utils/validation/verify-smtp.d.ts +0 -39
  396. package/dist/utils/validation/verify-smtp.js +0 -4
@@ -0,0 +1,155 @@
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
+ * A Vitest/Jest-compatible `expect` exposing `.extend(...)`.
105
+ */
106
+ interface ExpectLike {
107
+ extend: (matchers: Record<string, unknown>) => void;
108
+ }
109
+ /**
110
+ * Registers the email matchers with a Vitest/Jest-compatible `expect`.
111
+ *
112
+ * Kept dependency-free by accepting `expect` as an argument rather than importing `vitest` into the
113
+ * shipped bundle. Add the matching type augmentation to a `vitest.d.ts` in your project for typed
114
+ * `expect(...).toHaveSentTo(...)` calls.
115
+ * @param expectInstance The `expect` object exposing `.extend(...)`.
116
+ * @example
117
+ * ```ts
118
+ * import { expect } from "vitest";
119
+ * import { registerEmailMatchers } from "@visulima/email/test";
120
+ *
121
+ * registerEmailMatchers(expect);
122
+ * ```
123
+ */
124
+ declare const registerEmailMatchers: (expectInstance: ExpectLike) => void;
125
+ /**
126
+ * A stable, snapshot-friendly view of a sent message — volatile fields (message id, timestamp) are
127
+ * omitted so the snapshot doesn't churn between runs.
128
+ */
129
+ interface EmailSnapshot {
130
+ attachments?: {
131
+ contentType?: string;
132
+ filename: string;
133
+ }[];
134
+ bcc?: string[];
135
+ cc?: string[];
136
+ from: string;
137
+ headers?: Record<string, string>;
138
+ html?: string;
139
+ replyTo?: string;
140
+ subject: string;
141
+ text?: string;
142
+ to: string[];
143
+ }
144
+ /**
145
+ * Normalizes a captured message (a `createTestEmail` outbox entry or raw {@link EmailOptions}) into a
146
+ * deterministic {@link EmailSnapshot} for use with Vitest/Jest `toMatchSnapshot()`.
147
+ * @param source A mock-provider outbox entry or an `EmailOptions` object.
148
+ * @returns The snapshot view.
149
+ * @example
150
+ * ```ts
151
+ * expect(toEmailSnapshot(email.sent()[0])).toMatchSnapshot();
152
+ * ```
153
+ */
154
+ declare const toEmailSnapshot: (source: EmailOptions | MockEmailEntry) => EmailSnapshot;
155
+ 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-D3XPGiHY.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,54 +1,55 @@
1
1
  /**
2
- * Generic cache interface for caching any type of data.
3
- * Implementations can use in-memory cache, LRU cache, Redis, etc.
4
- */
5
- export interface Cache<T = unknown> {
6
- /**
7
- * Clears all cached entries.
8
- */
9
- clear: () => Promise<void>;
10
- /**
11
- * Deletes a cached entry.
12
- * @param key The cache key.
13
- */
14
- delete: (key: string) => Promise<void>;
15
- /**
16
- * Gets a cached value.
17
- * @param key The cache key.
18
- * @returns The cached value or undefined if not found or expired.
19
- */
20
- get: (key: string) => Promise<T | undefined>;
21
- /**
22
- * Sets a cached value.
23
- * @param key The cache key.
24
- * @param value The value to cache.
25
- * @param ttl Time-to-live in milliseconds.
26
- */
27
- set: (key: string, value: T, ttl: number) => Promise<void>;
2
+ * Generic cache interface for caching any type of data.
3
+ * Implementations can use in-memory cache, LRU cache, Redis, etc.
4
+ */
5
+ interface Cache<T = unknown> {
6
+ /**
7
+ * Clears all cached entries.
8
+ */
9
+ clear: () => Promise<void>;
10
+ /**
11
+ * Deletes a cached entry.
12
+ * @param key The cache key.
13
+ */
14
+ delete: (key: string) => Promise<void>;
15
+ /**
16
+ * Gets a cached value.
17
+ * @param key The cache key.
18
+ * @returns The cached value or undefined if not found or expired.
19
+ */
20
+ get: (key: string) => Promise<T | undefined>;
21
+ /**
22
+ * Sets a cached value.
23
+ * @param key The cache key.
24
+ * @param value The value to cache.
25
+ * @param ttl Time-to-live in milliseconds.
26
+ */
27
+ set: (key: string, value: T, ttl: number) => Promise<void>;
28
28
  }
29
29
  /**
30
- * Options for creating an in-memory cache.
31
- */
32
- export interface InMemoryCacheOptions {
33
- /**
34
- * Maximum number of entries in the cache.
35
- * @default 500
36
- */
37
- max?: number;
38
- /**
39
- * Default TTL in milliseconds for entries.
40
- * @default 3600000 (1 hour)
41
- */
42
- ttl?: number;
30
+ * Options for creating an in-memory cache.
31
+ */
32
+ interface InMemoryCacheOptions {
33
+ /**
34
+ * Maximum number of entries in the cache.
35
+ * @default 500
36
+ */
37
+ max?: number;
38
+ /**
39
+ * Default TTL in milliseconds for entries.
40
+ * @default 3600000 (1 hour)
41
+ */
42
+ ttl?: number;
43
43
  }
44
44
  /**
45
- * Default in-memory cache implementation using LRU cache.
46
- */
47
- export declare class InMemoryCache<T extends object = Record<string, unknown>> implements Cache<T> {
48
- private readonly cache;
49
- constructor(options?: InMemoryCacheOptions);
50
- clear: () => Promise<void>;
51
- delete: (key: string) => Promise<void>;
52
- get: (key: string) => Promise<T | undefined>;
53
- set: (key: string, value: T, ttl: number) => Promise<void>;
45
+ * Default in-memory cache implementation using LRU cache.
46
+ */
47
+ declare class InMemoryCache<T extends object = Record<string, unknown>> implements Cache<T> {
48
+ private readonly cache;
49
+ constructor(options?: InMemoryCacheOptions);
50
+ clear: () => Promise<void>;
51
+ delete: (key: string) => Promise<void>;
52
+ get: (key: string) => Promise<T | undefined>;
53
+ set: (key: string, value: T, ttl: number) => Promise<void>;
54
54
  }
55
+ export { Cache, InMemoryCache, InMemoryCacheOptions };
@@ -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,9 +1,10 @@
1
- import type { EmailAddress } from "../types.d.ts";
1
+ import { c as EmailAddress } from "../packem_shared/types.d-ejzh-xBP.js";
2
+ import 'node:buffer';
2
3
  /**
3
- * Formats an email address as "Name &lt;email@example.com>" or just "email@example.com" if no name is provided.
4
- * @param address The email address object to format.
5
- * @returns The formatted email address string in RFC 5322 format.
6
- * @throws {EmailError} When the email address is invalid.
7
- */
4
+ * Formats an email address as "Name &lt;email@example.com>" or just "email@example.com" if no name is provided.
5
+ * @param address The email address object to format.
6
+ * @returns The formatted email address string in RFC 5322 format.
7
+ * @throws {EmailError} When the email address is invalid.
8
+ */
8
9
  declare const formatEmailAddress: (address: EmailAddress) => string;
9
- export default formatEmailAddress;
10
+ export { formatEmailAddress as default };
@@ -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,22 +1,22 @@
1
1
  /**
2
- * Normalizes email aliases for supported email providers.
3
- * For example: example@gmail.com and example+another@gmail.com point to the same email address.
4
- * This function normalizes aliases to their canonical form.
5
- *
6
- * Supported providers:
7
- * - Gmail: Removes dots and plus aliases (example+test@gmail.com → example@gmail.com)
8
- * - Yahoo, Outlook, Hotmail, Live, MSN, iCloud, ProtonMail, Zoho, FastMail, Mail.com, GMX: Removes plus aliases only
9
- * @param email The email address to normalize.
10
- * @returns The normalized email address, or the original email if not supported or invalid.
11
- * @example
12
- * ```ts
13
- * import { normalizeEmailAliases } from "@visulima/email/utils/normalize-email-aliases";
14
- *
15
- * normalizeEmailAliases("example+test@gmail.com"); // "example@gmail.com"
16
- * normalizeEmailAliases("ex.ample@gmail.com"); // "example@gmail.com"
17
- * normalizeEmailAliases("user+tag@yahoo.com"); // "user@yahoo.com"
18
- * normalizeEmailAliases("user@example.com"); // "user@example.com" (unchanged)
19
- * ```
20
- */
2
+ * Normalizes email aliases for supported email providers.
3
+ * For example: example@gmail.com and example+another@gmail.com point to the same email address.
4
+ * This function normalizes aliases to their canonical form.
5
+ *
6
+ * Supported providers:
7
+ * - Gmail: Removes dots and plus aliases (example+test@gmail.com → example@gmail.com)
8
+ * - Yahoo, Outlook, Hotmail, Live, MSN, iCloud, ProtonMail, Zoho, FastMail, Mail.com, GMX: Removes plus aliases only
9
+ * @param email The email address to normalize.
10
+ * @returns The normalized email address, or the original email if not supported or invalid.
11
+ * @example
12
+ * ```ts
13
+ * import { normalizeEmailAliases } from "@visulima/email/utils/normalize-email-aliases";
14
+ *
15
+ * normalizeEmailAliases("example+test@gmail.com"); // "example@gmail.com"
16
+ * normalizeEmailAliases("ex.ample@gmail.com"); // "example@gmail.com"
17
+ * normalizeEmailAliases("user+tag@yahoo.com"); // "user@yahoo.com"
18
+ * normalizeEmailAliases("user@example.com"); // "user@example.com" (unchanged)
19
+ * ```
20
+ */
21
21
  declare const normalizeEmailAliases: (email: string) => string;
22
- export default normalizeEmailAliases;
22
+ export { normalizeEmailAliases 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,19 +1,20 @@
1
- import type { EmailAddress } from "../types.d.ts";
1
+ import { c as EmailAddress } from "../packem_shared/types.d-ejzh-xBP.js";
2
+ import 'node:buffer';
2
3
  /**
3
- * Parses a string representation of an email address into an EmailAddress object.
4
- * Supports formats: "email@example.com", "Name &lt;email@example.com>", "&lt;email@example.com>".
5
- * @example Parsing an address with a name
6
- * ```ts
7
- * const address = parseAddress("John Doe <john@example.com>");
8
- * // { name: "John Doe", email: "john@example.com" }
9
- * ```
10
- * @example Parsing an address without a name
11
- * ```ts
12
- * const address = parseAddress("jane@example.com");
13
- * // { email: "jane@example.com" }
14
- * ```
15
- * @param address The string representation of the address to parse.
16
- * @returns An EmailAddress object if parsing is successful, or undefined if invalid.
17
- */
4
+ * Parses a string representation of an email address into an EmailAddress object.
5
+ * Supports formats: "email@example.com", "Name &lt;email@example.com>", "&lt;email@example.com>".
6
+ * @example Parsing an address with a name
7
+ * ```ts
8
+ * const address = parseAddress("John Doe <john@example.com>");
9
+ * // { name: "John Doe", email: "john@example.com" }
10
+ * ```
11
+ * @example Parsing an address without a name
12
+ * ```ts
13
+ * const address = parseAddress("jane@example.com");
14
+ * // { email: "jane@example.com" }
15
+ * ```
16
+ * @param address The string representation of the address to parse.
17
+ * @returns An EmailAddress object if parsing is successful, or undefined if invalid.
18
+ */
18
19
  declare const parseAddress: (address: string) => EmailAddress | undefined;
19
- export default parseAddress;
20
+ export { parseAddress as default };
@@ -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&&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&&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 v}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,I=/^\r?\n/,L=/[\r\n]+$/,N=/\r?\n$/,P=/\s/g,_=/high|^1|^2/i,F=/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 u=a.indexOf(":");u===-1?(i="",c=""):(i=a.slice(0,u).trim(),c=a.slice(u+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)},G=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 v(r);if(n==="base64"){const e=r.replaceAll(P,"");return O?Buffer.from(e,"base64").toString("utf8"):new TextDecoder().decode(Uint8Array.from(atob(e),s=>s.codePointAt(0)))}return r},W=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"),u=G(a);if(u&&a?.toLowerCase().includes("multipart")){const d=t.split(`--${u}`);for(const l of d){const p=l.replace(I,"");if(!(!p||p.startsWith("--"))){const{body:C,headers:m}=B(p),x=m.map.get("content-type")??"",A=m.map.get("content-transfer-encoding");(m.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 d=e.get("content-transfer-encoding"),l=w(t.replace(N,""),d);a?.toLowerCase().includes("text/html")?c.html=l:l&&(c.text=l)}const $=new Set(["bcc","cc","content-transfer-encoding","content-type","from","mime-version","reply-to","subject","to"]),g={};for(const[d,l]of n.raw){const p=d.toLowerCase();(p==="x-priority"||p==="importance")&&(_.test(l)?c.priority="high":F.test(l)&&(c.priority="low")),$.has(p)||(g[d]=l)}return Object.keys(g).length>0&&(c.headers=g),c};export{W 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};
@@ -0,0 +1,53 @@
1
+ import { F as FeatureFlags, E as EmailOptions } from "../../packem_shared/types.d-ejzh-xBP.js";
2
+ import 'node:buffer';
3
+ /**
4
+ * A single capability that a message uses but the target provider cannot represent.
5
+ */
6
+ interface FeatureViolation {
7
+ /**
8
+ * The provider capability flag that is not supported.
9
+ */
10
+ feature: keyof FeatureFlags;
11
+ /**
12
+ * The message field that triggered the check.
13
+ */
14
+ field: string;
15
+ /**
16
+ * Human-readable explanation of the violation.
17
+ */
18
+ message: string;
19
+ }
20
+ /**
21
+ * Result of a fail-fast provider capability check.
22
+ */
23
+ interface FeatureSupportResult {
24
+ /**
25
+ * True when the message uses no capability the provider has explicitly disabled.
26
+ */
27
+ supported: boolean;
28
+ /**
29
+ * The list of capabilities the message uses that the provider cannot represent.
30
+ */
31
+ violations: FeatureViolation[];
32
+ }
33
+ /**
34
+ * Performs a fail-fast field-support check for a message against a provider's declared capabilities.
35
+ *
36
+ * A capability counts as a violation only when the message actually uses it **and** the provider
37
+ * has explicitly declared it unsupported (`features[capability] === false`). Capabilities left
38
+ * `undefined` are treated as "unknown" and never raise a violation, so providers that publish a
39
+ * partial (or no) {@link FeatureFlags} map are never falsely rejected.
40
+ * @param options The normalized email options about to be sent.
41
+ * @param features The target provider's declared capabilities. When omitted the check is a no-op.
42
+ * @returns A {@link FeatureSupportResult} describing any unsupported capabilities in use.
43
+ * @example
44
+ * ```ts
45
+ * const { supported, violations } = checkFeatureSupport(message, provider.features);
46
+ *
47
+ * if (!supported) {
48
+ * throw new Error(violations.map((v) => v.message).join(", "));
49
+ * }
50
+ * ```
51
+ */
52
+ declare function checkFeatureSupport(options: EmailOptions, features?: FeatureFlags): FeatureSupportResult;
53
+ export { FeatureSupportResult, FeatureViolation, checkFeatureSupport as default };
@@ -0,0 +1 @@
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,7 +1,7 @@
1
1
  /**
2
- * Validates an email address format according to basic RFC standards.
3
- * @param email The email address string to validate.
4
- * @returns True if the email address is valid, false otherwise.
5
- */
2
+ * Validates an email address format according to basic RFC standards.
3
+ * @param email The email address string to validate.
4
+ * @returns True if the email address is valid, false otherwise.
5
+ */
6
6
  declare const validateEmail: (email: string) => boolean;
7
- export default validateEmail;
7
+ export { validateEmail as default };
@@ -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};