@visulima/email 1.0.0-alpha.8 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (396) hide show
  1. package/CHANGELOG.md +786 -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-BuSbnos1.js +18 -0
  20. package/dist/packem_shared/DraftMailMessage-BxqGSLMN.js +1 -0
  21. package/dist/packem_shared/EmailError-B-sEf3bp.js +1 -0
  22. package/dist/packem_shared/Mail-BEuzrB00.js +1 -0
  23. package/dist/packem_shared/MailMessage-D9k5gYrd.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-D81_wUA1.js +1 -0
  35. package/dist/packem_shared/arcMessageSignatureBase-BY4j0TxM.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-CF_RUjqo.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-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 +177 -67
  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,375 @@
1
+ import { M as MaybePromise } from "../packem_shared/types.d-ejzh-xBP.js";
2
+ import 'node:buffer';
3
+ /**
4
+ * A parsed address from an inbound message.
5
+ */
6
+ interface InboundAddress {
7
+ /**
8
+ * The email address.
9
+ */
10
+ email: string;
11
+ /**
12
+ * The display name, when present.
13
+ */
14
+ name?: string;
15
+ }
16
+ /**
17
+ * An attachment on an inbound message.
18
+ */
19
+ interface InboundAttachment {
20
+ /**
21
+ * The Content-ID, for inline attachments.
22
+ */
23
+ cid?: string;
24
+ /**
25
+ * Base64-encoded content, when the provider includes it inline.
26
+ */
27
+ content?: string;
28
+ /**
29
+ * The MIME type.
30
+ */
31
+ contentType?: string;
32
+ /**
33
+ * The filename.
34
+ */
35
+ filename: string;
36
+ /**
37
+ * The size in bytes, when reported.
38
+ */
39
+ size?: number;
40
+ }
41
+ /**
42
+ * A normalized inbound email, produced from any provider's inbound webhook/event payload.
43
+ *
44
+ * This is the common shape every `parse*Inbound` adapter maps onto, so downstream code is
45
+ * provider-agnostic.
46
+ */
47
+ interface InboundEmail {
48
+ /**
49
+ * Attachments included on the message.
50
+ */
51
+ attachments: InboundAttachment[];
52
+ /**
53
+ * Blind carbon-copy recipients.
54
+ */
55
+ bcc: InboundAddress[];
56
+ /**
57
+ * Carbon-copy recipients.
58
+ */
59
+ cc: InboundAddress[];
60
+ /**
61
+ * The sender.
62
+ */
63
+ from?: InboundAddress;
64
+ /**
65
+ * All headers, keyed by lower-cased name.
66
+ */
67
+ headers: Record<string, string>;
68
+ /**
69
+ * The HTML body, when present.
70
+ */
71
+ html?: string;
72
+ /**
73
+ * The `In-Reply-To` header value (a Message-ID), when present.
74
+ */
75
+ inReplyTo?: string;
76
+ /**
77
+ * The canonical `Message-ID` of this message, when present.
78
+ */
79
+ messageId?: string;
80
+ /**
81
+ * The provider this message was parsed from.
82
+ */
83
+ provider: string;
84
+ /**
85
+ * The raw payload the adapter received, for provider-specific fields.
86
+ */
87
+ raw?: unknown;
88
+ /**
89
+ * Message-IDs from the `References` header, oldest first.
90
+ */
91
+ references: string[];
92
+ /**
93
+ * The `Reply-To` address, when present.
94
+ */
95
+ replyTo?: InboundAddress;
96
+ /**
97
+ * The subject line.
98
+ */
99
+ subject?: string;
100
+ /**
101
+ * The plain-text body, when present.
102
+ */
103
+ text?: string;
104
+ /**
105
+ * Primary (`To`) recipients.
106
+ */
107
+ to: InboundAddress[];
108
+ }
109
+ /**
110
+ * The inbound providers {@link parseInbound} can normalize.
111
+ */
112
+ type InboundProvider = "cloudflare" | "mailgun" | "postmark" | "sendgrid" | "ses";
113
+ /**
114
+ * Normalizes a provider-specific inbound webhook payload into the common {@link InboundEmail} shape.
115
+ * @param provider The provider the payload came from.
116
+ * @param payload The raw (already JSON/form-decoded) payload.
117
+ * @returns The normalized inbound email.
118
+ */
119
+ declare const parseInbound: (provider: InboundProvider, payload: unknown) => InboundEmail;
120
+ /**
121
+ * Options for {@link defineInboundHandler}.
122
+ */
123
+ interface InboundHandlerOptions {
124
+ /**
125
+ * Invoked when a payload fails to parse or `onMessage` throws. When omitted, the error propagates.
126
+ * @param error The thrown error.
127
+ * @param provider The provider being handled.
128
+ * @param payload The offending payload.
129
+ */
130
+ onError?: (error: unknown, provider: InboundProvider, payload: unknown) => MaybePromise<void>;
131
+ /**
132
+ * Invoked with each normalized inbound message.
133
+ * @param email The normalized inbound email.
134
+ */
135
+ onMessage: (email: InboundEmail) => MaybePromise<void>;
136
+ /**
137
+ * Strip quoted history from the plain-text body (via {@link extractReply}) before `onMessage`.
138
+ * @default false
139
+ */
140
+ stripReply?: boolean;
141
+ }
142
+ /**
143
+ * A unified inbound handler created by {@link defineInboundHandler}.
144
+ */
145
+ interface InboundHandler {
146
+ /**
147
+ * Parses a provider payload, optionally strips quoted history, and dispatches it to `onMessage`.
148
+ * @param provider The provider the payload came from.
149
+ * @param payload The raw payload.
150
+ * @returns The normalized email, or `undefined` when an error was handled by `onError`.
151
+ */
152
+ handle: (provider: InboundProvider, payload: unknown) => Promise<InboundEmail | undefined>;
153
+ }
154
+ /**
155
+ * Creates a single inbound entry point over the five provider parsers — parse, optionally strip the
156
+ * reply quote, then dispatch to your `onMessage` callback.
157
+ * @param options Handler options. See {@link InboundHandlerOptions}.
158
+ * @returns The handler. See {@link InboundHandler}.
159
+ * @example
160
+ * ```ts
161
+ * const handler = defineInboundHandler({ stripReply: true, onMessage: (email) => saveReply(email) });
162
+ *
163
+ * app.post("/inbound/postmark", async (req) => { await handler.handle("postmark", req.body); });
164
+ * ```
165
+ */
166
+ declare const defineInboundHandler: (options: InboundHandlerOptions) => InboundHandler;
167
+ /**
168
+ * The shape of a Cloudflare Email Workers message, narrowed to what the parser reads.
169
+ *
170
+ * Cloudflare delivers a `ForwardableEmailMessage` with `from`, `to`, and a `Headers` object; the body
171
+ * arrives as a raw stream you must parse yourself, so pass the decoded `text`/`html` alongside it.
172
+ */
173
+ interface CloudflareEmailLike {
174
+ from?: string;
175
+ headers?: Headers | Record<string, string>;
176
+ html?: string;
177
+ text?: string;
178
+ to?: string;
179
+ }
180
+ /**
181
+ * Parses a [Cloudflare Email Workers](https://developers.cloudflare.com/email-routing/email-workers/)
182
+ * message into the normalized {@link InboundEmail} shape.
183
+ *
184
+ * Because Cloudflare exposes the body only as a raw stream, decode it first and pass the result via
185
+ * `text`/`html`.
186
+ * @param message The Cloudflare email message (plus optionally the decoded body).
187
+ * @returns The normalized inbound email.
188
+ */
189
+ declare const parseCloudflareInbound: (message: CloudflareEmailLike) => InboundEmail;
190
+ interface MailgunInboundPayload {
191
+ [key: string]: unknown;
192
+ "body-html"?: string;
193
+ "body-plain"?: string;
194
+ cc?: string;
195
+ from?: string;
196
+ "message-headers"?: [string, string][] | string;
197
+ "Message-Id"?: string;
198
+ recipient?: string;
199
+ sender?: string;
200
+ "stripped-html"?: string;
201
+ "stripped-text"?: string;
202
+ subject?: string;
203
+ To?: string;
204
+ }
205
+ /**
206
+ * Parses a [Mailgun inbound](https://documentation.mailgun.com/docs/mailgun/user-manual/receive-forward-store/)
207
+ * route payload into the normalized {@link InboundEmail} shape.
208
+ * @param payload The parsed form fields of the Mailgun inbound request.
209
+ * @returns The normalized inbound email.
210
+ */
211
+ declare const parseMailgunInbound: (payload: MailgunInboundPayload) => InboundEmail;
212
+ interface PostmarkFullAddress {
213
+ Email?: string;
214
+ Name?: string;
215
+ }
216
+ interface PostmarkInboundPayload {
217
+ [key: string]: unknown;
218
+ Attachments?: {
219
+ Content?: string;
220
+ ContentID?: string;
221
+ ContentLength?: number;
222
+ ContentType?: string;
223
+ Name?: string;
224
+ }[];
225
+ BccFull?: PostmarkFullAddress[];
226
+ CcFull?: PostmarkFullAddress[];
227
+ FromFull?: PostmarkFullAddress;
228
+ Headers?: {
229
+ Name?: string;
230
+ Value?: string;
231
+ }[];
232
+ HtmlBody?: string;
233
+ MessageID?: string;
234
+ ReplyTo?: string;
235
+ Subject?: string;
236
+ TextBody?: string;
237
+ ToFull?: PostmarkFullAddress[];
238
+ }
239
+ /**
240
+ * Parses a [Postmark inbound](https://postmarkapp.com/developer/webhooks/inbound-webhook) webhook
241
+ * payload into the normalized {@link InboundEmail} shape.
242
+ * @param payload The parsed JSON body of the Postmark inbound webhook.
243
+ * @returns The normalized inbound email.
244
+ */
245
+ declare const parsePostmarkInbound: (payload: PostmarkInboundPayload) => InboundEmail;
246
+ interface SendGridInboundPayload {
247
+ [key: string]: unknown;
248
+ cc?: string;
249
+ from?: string;
250
+ headers?: string;
251
+ html?: string;
252
+ subject?: string;
253
+ text?: string;
254
+ to?: string;
255
+ }
256
+ /**
257
+ * Parses a [SendGrid Inbound Parse](https://www.twilio.com/docs/sendgrid/for-developers/parsing-email/setting-up-the-inbound-parse-webhook)
258
+ * payload (the multipart fields, already decoded into an object) into the normalized
259
+ * {@link InboundEmail} shape.
260
+ * @param payload The decoded Inbound Parse fields.
261
+ * @returns The normalized inbound email.
262
+ */
263
+ declare const parseSendGridInbound: (payload: SendGridInboundPayload) => InboundEmail;
264
+ interface SesCommonHeaders {
265
+ cc?: string[];
266
+ from?: string[];
267
+ messageId?: string;
268
+ replyTo?: string[];
269
+ subject?: string;
270
+ to?: string[];
271
+ }
272
+ interface SesMail {
273
+ commonHeaders?: SesCommonHeaders;
274
+ headers?: {
275
+ name?: string;
276
+ value?: string;
277
+ }[];
278
+ messageId?: string;
279
+ source?: string;
280
+ }
281
+ interface SesInboundPayload {
282
+ [key: string]: unknown;
283
+ content?: string;
284
+ html?: string;
285
+ mail?: SesMail;
286
+ text?: string;
287
+ }
288
+ /**
289
+ * Parses an [Amazon SES inbound](https://docs.aws.amazon.com/ses/latest/dg/receiving-email-action-lambda.html)
290
+ * notification (the `mail` object, typically delivered via SNS/Lambda) into the normalized
291
+ * {@link InboundEmail} shape.
292
+ *
293
+ * SES does not include the decoded body in the notification — fetch it from S3 (or pass it directly)
294
+ * and supply it via `text`/`html`.
295
+ * @param payload The SES notification, with optional decoded body.
296
+ * @returns The normalized inbound email.
297
+ */
298
+ declare const parseSesInbound: (payload: SesInboundPayload) => InboundEmail;
299
+ /**
300
+ * Options for {@link extractReply}.
301
+ */
302
+ interface ExtractReplyOptions {
303
+ /**
304
+ * Also strip a trailing signature block (everything after a `-- ` delimiter line).
305
+ * @default true
306
+ */
307
+ stripSignature?: boolean;
308
+ }
309
+ /**
310
+ * Extracts the new reply text from a plain-text email body, stripping quoted history and (optionally)
311
+ * the trailing signature.
312
+ *
313
+ * Uses the same heuristics email clients use: quote markers (`>`), localized attribution lines
314
+ * (EN/DE/FR/ES/TR), Outlook/`Original Message` separators, and the RFC 3676 `-- ` signature delimiter.
315
+ * @param text The plain-text body.
316
+ * @param options Extraction options. See {@link ExtractReplyOptions}.
317
+ * @returns The trimmed reply text with quoted history removed.
318
+ */
319
+ declare const extractReply: (text: string, options?: ExtractReplyOptions) => string;
320
+ /**
321
+ * A group of inbound messages belonging to the same conversation.
322
+ */
323
+ interface EmailThread {
324
+ /**
325
+ * A stable identifier for the thread: the union-find root, which is a normalized root Message-ID
326
+ * or a synthetic `__index_&lt;n>` key when a message has no Message-ID.
327
+ */
328
+ id: string;
329
+ /**
330
+ * The messages in the thread. Order reflects input order (callers can sort by date if needed).
331
+ */
332
+ messages: InboundEmail[];
333
+ }
334
+ /**
335
+ * Strips angle brackets and surrounding whitespace from a Message-ID for consistent matching.
336
+ * @param id A raw Message-ID, optionally wrapped in angle brackets.
337
+ * @returns The bare Message-ID.
338
+ */
339
+ declare const normalizeMessageId: (id: string) => string;
340
+ /**
341
+ * Normalizes a subject for fallback threading: strips leading `Re:`/`Fwd:`/`Aw:`/`Wg:` prefixes and
342
+ * collapses whitespace. Uses a linear loop rather than a backtracking regex.
343
+ * @param subject The raw subject.
344
+ * @returns The normalized subject key.
345
+ */
346
+ declare const normalizeSubject: (subject: string) => string;
347
+ /**
348
+ * Groups inbound messages into conversation threads.
349
+ *
350
+ * Messages are linked via their `In-Reply-To` and `References` Message-IDs (RFC 5322 threading).
351
+ * Messages that share no references but have an identical normalized subject are stitched together as
352
+ * a fallback, matching how mail clients group conversations.
353
+ * @param messages The inbound messages to thread.
354
+ * @returns The detected threads. See {@link EmailThread}.
355
+ */
356
+ declare const stitchThreads: (messages: InboundEmail[]) => EmailThread[];
357
+ /**
358
+ * Parses a single RFC 5322 address such as `John Doe &lt;john@example.com>` or `john@example.com`.
359
+ * @param value The address string.
360
+ * @returns The parsed address, or `undefined` when empty.
361
+ */
362
+ declare const parseAddress: (value: string | undefined | null) => InboundAddress | undefined;
363
+ /**
364
+ * Splits and parses a comma-separated address list, respecting commas inside quoted display names.
365
+ * @param value The address-list string.
366
+ * @returns The parsed addresses (empty when none).
367
+ */
368
+ declare const parseAddressList: (value: string | undefined | null) => InboundAddress[];
369
+ /**
370
+ * Splits a `References` header value into individual Message-IDs.
371
+ * @param value The raw `References` header.
372
+ * @returns The Message-IDs in document order (oldest first).
373
+ */
374
+ declare const parseReferences: (value: string | undefined | null) => string[];
375
+ export { type CloudflareEmailLike, type EmailThread, type ExtractReplyOptions, type InboundAddress, type InboundAttachment, type InboundEmail, type InboundHandler, type InboundHandlerOptions, type InboundProvider, defineInboundHandler, extractReply, normalizeMessageId, normalizeSubject, parseAddress, parseAddressList, parseCloudflareInbound, parseInbound, parseMailgunInbound, parsePostmarkInbound, parseReferences, parseSendGridInbound, parseSesInbound, stitchThreads };
@@ -0,0 +1 @@
1
+ import{defineInboundHandler as o,parseInbound as a}from"../packem_shared/defineInboundHandler-CnL2BzlL.js";import{default as d}from"../packem_shared/parseCloudflareInbound-C__j-oNa.js";import{default as t}from"../packem_shared/parseMailgunInbound-BpC6uPNe.js";import{default as f}from"../packem_shared/parsePostmarkInbound-Co3_c6-9.js";import{default as l}from"../packem_shared/parseSendGridInbound-DsALoijO.js";import{default as x}from"../packem_shared/parseSesInbound-CH5tHIjp.js";import{extractReply as I}from"../packem_shared/extractReply-BUjIBt9A.js";import{normalizeMessageId as c,normalizeSubject as S,stitchThreads as g}from"../packem_shared/normalizeMessageId-DAx2pGe2.js";import{parseAddress as z,parseAddressList as A,parseReferences as M}from"../packem_shared/parseAddress-DdbViBAJ.js";export{o as defineInboundHandler,I as extractReply,c as normalizeMessageId,S as normalizeSubject,z as parseAddress,A as parseAddressList,d as parseCloudflareInbound,a as parseInbound,t as parseMailgunInbound,f as parsePostmarkInbound,M as parseReferences,l as parseSendGridInbound,x as parseSesInbound,g as stitchThreads};
package/dist/index.d.ts CHANGED
@@ -1,9 +1,94 @@
1
- export { type AttachmentDataOptions, type AttachmentOptions, detectMimeType, generateContentId, readFileAsBuffer } from "./attachment-helpers.d.ts";
2
- export { default as EmailError } from "./errors/email-error.d.ts";
3
- export { default as RequiredOptionError } from "./errors/required-option-error.d.ts";
4
- export { createMail, Mail, type MailGlobalConfig, type SendableMessage } from "./mail.d.ts";
5
- export { default as MailMessage } from "./mail-message.d.ts";
6
- export type { Provider, ProviderFactory } from "./providers/provider.d.ts";
7
- export { defineProvider } from "./providers/provider.d.ts";
8
- export type { TemplateRenderer } from "./template-engines/types.d.ts";
9
- export type { Attachment, BaseConfig, CalendarEventOptions, EmailAddress, EmailHeaders, EmailOptions, EmailResult, EmailTag, FeatureFlags, ImmutableHeaders, MaybePromise, Priority, Receipt, Result, } from "./types.d.ts";
1
+ export { type A as AttachmentDataOptions, type a as AttachmentOptions, type B as BatchBase, type b as BatchRenderer, D as DraftMailMessage, type F as FeatureCheckMode, M as Mail, type c as MailGlobalConfig, d as MailMessage, type e as MailOptions, type P as Personalization, type S as SendBatchOptions, type f as SendableMessage, g as createMail, h as detectMimeType, i as generateContentId, r as readFileAsBuffer } from "./packem_shared/mail.d-B9SSqyy0.js";
2
+ export type { M as Middleware, S as SendFunction } from "./packem_shared/types.d-Mpu0HZoG.js";
3
+ export { type a as Provider, type P as ProviderFactory, d as defineProvider } from "./packem_shared/provider.d-J-y6iogK.js";
4
+ export type { T as TemplateRenderer } from "./packem_shared/types.d-nyR1ty1Q.js";
5
+ export type { A as Attachment, B as BaseConfig, C as CalendarEventOptions, c as EmailAddress, e as EmailHeaders, E as EmailOptions, a as EmailResult, d as EmailTag, F as FeatureFlags, I as ImmutableHeaders, M as MaybePromise, P as Priority, b as Receipt, R as Result } from "./packem_shared/types.d-ejzh-xBP.js";
6
+ export { default as parseEml } from "./utils/parse-eml.js";
7
+ export { type OkResult, isErr, isOk, mapOk, tryAsync, unwrap, unwrapOr } from "./utils/result.js";
8
+ export { type FeatureSupportResult, type FeatureViolation, default as checkFeatureSupport } from "./utils/validation/check-feature-support.js";
9
+ import 'ical-generator';
10
+ import 'node:buffer';
11
+ import 'node:crypto';
12
+ import "./packem_shared/types.d-BId55FW2.js";
13
+ interface ErrorProperties {
14
+ cause?: unknown;
15
+ hint?: ErrorHint;
16
+ location?: ErrorLocation;
17
+ message?: string;
18
+ name: string;
19
+ stack?: string;
20
+ title?: string;
21
+ }
22
+ interface ErrorLocation {
23
+ column?: number;
24
+ file?: string;
25
+ line?: number;
26
+ }
27
+ /**
28
+ * A message that explains to the user how they can fix the error.
29
+ * @example
30
+ * ```ts
31
+ * const error = new VisulimaError({
32
+ * hint: "Try running `npm install` to install missing dependencies.",
33
+ * location: {
34
+ * file: "src/index.ts",
35
+ * line: 1,
36
+ * column: 1,
37
+ * },
38
+ * message: "Cannot find module 'react'",
39
+ * name: "ModuleNotFoundError",
40
+ * });
41
+ * ```
42
+ *
43
+ * For more complex hints, you can pass an array of strings or a single string in markdown format.
44
+ */
45
+ type ErrorHint = string[] | string;
46
+ declare class VisulimaError extends Error {
47
+ loc: ErrorLocation | undefined;
48
+ title: string | undefined;
49
+ /**
50
+ * A message that explains to the user how they can fix the error.
51
+ */
52
+ hint: ErrorHint | undefined;
53
+ type: string;
54
+ constructor({
55
+ cause,
56
+ hint,
57
+ location,
58
+ message,
59
+ name,
60
+ stack,
61
+ title
62
+ }: ErrorProperties);
63
+ setLocation(location: ErrorLocation): void;
64
+ setName(name: string): void;
65
+ setMessage(message: string): void;
66
+ setHint(hint: ErrorHint): void;
67
+ }
68
+ /**
69
+ * Will return an array of all causes in the error in the order they occurred.
70
+ */
71
+ /**
72
+ * Base error class for email package operations.
73
+ * @param component The component name where the error occurred.
74
+ * @param message The error message describing what went wrong.
75
+ * @param options Optional error options including cause, code, and hint.
76
+ */
77
+ declare class EmailError extends VisulimaError {
78
+ readonly component: string;
79
+ readonly code?: string;
80
+ constructor(component: string, message: string, options?: {
81
+ cause?: Error | unknown;
82
+ code?: string;
83
+ hint?: string | string[];
84
+ });
85
+ }
86
+ /**
87
+ * Error for missing required options
88
+ * @param component The component name where the error occurred
89
+ * @param name The name(s) of the missing required option(s)
90
+ */
91
+ declare class RequiredOptionError extends EmailError {
92
+ constructor(component: string, name: string | string[]);
93
+ }
94
+ export { EmailError, RequiredOptionError };
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- import{detectMimeType as o,generateContentId as t,readFileAsBuffer as a}from"./packem_shared/detectMimeType-S8WRsNtY.js";import{default as i}from"./packem_shared/EmailError-zm2ffVav.js";import{default as m}from"./packem_shared/RequiredOptionError-CevW3u2K.js";import{Mail as l,createMail as x}from"./packem_shared/Mail-6Bltpy_p.js";import{MailMessage as s}from"./packem_shared/MailMessage-B76GPBBA.js";import{defineProvider as u}from"./packem_shared/defineProvider-B9rSklAJ.js";export{i as EmailError,l as Mail,s as MailMessage,m as RequiredOptionError,x as createMail,u as defineProvider,o as detectMimeType,t as generateContentId,a as readFileAsBuffer};
1
+ import{detectMimeType as a,generateContentId as t,readFileAsBuffer as o}from"./packem_shared/detectMimeType-Dxv4MjZ7.js";import{default as p}from"./packem_shared/DraftMailMessage-BxqGSLMN.js";import{default as m}from"./packem_shared/EmailError-B-sEf3bp.js";import{default as l}from"./packem_shared/RequiredOptionError-DuNNY_a5.js";import{Mail as u,createMail as x}from"./packem_shared/Mail-BEuzrB00.js";import{default as M}from"./packem_shared/MailMessage-D9k5gYrd.js";import{defineProvider as E}from"./packem_shared/defineProvider-C9q-7iwt.js";import{default as g}from"./utils/parse-eml.js";import{isErr as y,isOk as w,mapOk as A,tryAsync as F,unwrap as h,unwrapOr as q}from"./utils/result.js";import{default as B}from"./utils/validation/check-feature-support.js";export{p as DraftMailMessage,m as EmailError,u as Mail,M as MailMessage,l as RequiredOptionError,B as checkFeatureSupport,x as createMail,E as defineProvider,a as detectMimeType,t as generateContentId,y as isErr,w as isOk,A as mapOk,g as parseEml,o as readFileAsBuffer,F as tryAsync,h as unwrap,q as unwrapOr};