@visulima/email 1.0.0-alpha.33 → 1.0.0-alpha.35
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.
- package/CHANGELOG.md +131 -0
- package/README.md +117 -0
- package/dist/crypto/index.d.ts +160 -3
- package/dist/crypto/index.js +1 -1
- package/dist/deliverability/dmarc-report.d.ts +95 -0
- package/dist/deliverability/dmarc-report.js +1 -0
- package/dist/deliverability/index.d.ts +360 -0
- package/dist/deliverability/index.js +1 -0
- package/dist/events/index.d.ts +31 -0
- package/dist/events/index.js +1 -0
- package/dist/inbound/index.d.ts +375 -0
- package/dist/inbound/index.js +1 -0
- package/dist/index.d.ts +12 -704
- package/dist/index.js +1 -1
- package/dist/middleware/index.d.ts +346 -0
- package/dist/middleware/index.js +1 -0
- package/dist/packem_shared/ALL_EVENTS-A0nTVOo0.js +1 -0
- package/dist/packem_shared/DkimSigner-dKZ45Csc.js +18 -0
- package/dist/packem_shared/Mail-B2QII2P9.js +1 -0
- package/dist/packem_shared/{MailMessage-Dy1gP5e-.js → MailMessage-DB1zaWfM.js} +1 -1
- package/dist/packem_shared/MemoryEventStore-BEKPxa-I.js +1 -0
- package/dist/packem_shared/MemoryQueue-C-CtRRG7.js +1 -0
- package/dist/packem_shared/MemorySuppressionStore-BKY1FrA1.js +1 -0
- package/dist/packem_shared/RATE_LIMIT_PRESETS-DQF78mdO.js +1 -0
- package/dist/packem_shared/{SmimeEncrypter-DInfo-l0.js → SmimeEncrypter-BirIsrip.js} +2 -2
- package/dist/packem_shared/{SmimeSigner-CSWbZ41O.js → SmimeSigner-CkyaShTs.js} +2 -2
- package/dist/packem_shared/addDarkModeSupport-Ys9U2-GH.js +1 -0
- package/dist/packem_shared/address-formatter-CnPg51_n.js +1 -0
- package/dist/packem_shared/aggregate-features-BvgdYul-.js +1 -0
- package/dist/packem_shared/ahaSendProvider-yuqYMW0n.js +1 -0
- package/dist/packem_shared/arcMessageSignatureBase-Cpdnv-H8.js +17 -0
- package/dist/packem_shared/attachment-processor-CFUC3V45.js +1 -0
- package/dist/packem_shared/azureProvider-CK_Wuw4r.js +1 -0
- package/dist/packem_shared/brevoProvider-CNwuzzBA.js +1 -0
- package/dist/packem_shared/build-mime-message-D8WEZejb.js +3 -0
- package/dist/packem_shared/buildListUnsubscribe-CIbz0rtk.js +1 -0
- package/dist/packem_shared/circuitBreakerMiddleware-B7DlzZSG.js +1 -0
- package/dist/packem_shared/cloudflareEmailProvider-C-G821Hg.js +1 -0
- package/dist/packem_shared/composeMiddleware-CkEhbDjL.js +1 -0
- package/dist/packem_shared/createTestEmail-hHdtgmUM.js +1 -0
- package/dist/packem_shared/createWorker-Nkc1GHet.js +1 -0
- package/dist/packem_shared/dedupeMiddleware-JeJbff46.js +1 -0
- package/dist/packem_shared/{detectMimeType-BtkVEtZF.js → detectMimeType-B4QMh7k8.js} +1 -1
- package/dist/packem_shared/emailMatchers-CLANeU71.js +1 -0
- package/dist/packem_shared/event-bus.d-DEl3w_EW.d.ts +104 -0
- package/dist/packem_shared/extractReply-CCWnNRWe.js +5 -0
- package/dist/packem_shared/failoverProvider-D90MHT2T.js +1 -0
- package/dist/packem_shared/filterSuppressed-DntqRV0q.js +1 -0
- package/dist/packem_shared/format-address-Cv6uWTS5.js +1 -0
- package/dist/packem_shared/infobipProvider-DdV62IAG.js +1 -0
- package/dist/packem_shared/injectPreheader-BxPjb0eJ.js +1 -0
- package/dist/packem_shared/inlineCss-BLaEi337.js +1 -0
- package/dist/packem_shared/isValidSigningCertUrl-CF_KuCAi.js +3 -0
- package/dist/packem_shared/loggingMiddleware-CyHzn37U.js +1 -0
- package/dist/packem_shared/loopsProvider-DSedSU3q.js +1 -0
- package/dist/packem_shared/mail.d-LmrdSngG.d.ts +861 -0
- package/dist/packem_shared/{mailCrabProvider-B7H6HwWu.js → mailCrabProvider-xSLhA1CY.js} +1 -1
- package/dist/packem_shared/mailPaceProvider-CWBIjvvJ.js +1 -0
- package/dist/packem_shared/mailchannelsProvider-zKcunGDQ.js +1 -0
- package/dist/packem_shared/mailerSendProvider-BEvPlBKB.js +1 -0
- package/dist/packem_shared/mailgunProvider-CfQAINTC.js +1 -0
- package/dist/packem_shared/mailjetProvider-DEfKptWc.js +1 -0
- package/dist/packem_shared/mailomatProvider-D5sHlxZh.js +1 -0
- package/dist/packem_shared/mailtrapProvider-DwgMKakk.js +1 -0
- package/dist/packem_shared/mandrillProvider-CdGjO3Td.js +1 -0
- package/dist/packem_shared/normalizeMessageId-B_9mXlh4.js +1 -0
- package/dist/packem_shared/oauth2Middleware-B1xz58iP.js +1 -0
- package/dist/packem_shared/parseAddress-CrYOac3K.js +1 -0
- package/dist/packem_shared/parseArfReport-CUHb8WVj.js +6 -0
- package/dist/packem_shared/parseCloudflareInbound-BGgH5u7M.js +1 -0
- package/dist/packem_shared/parseDmarcRecord-DjNqCMZc.js +1 -0
- package/dist/packem_shared/parseInbound-BP-gEjhh.js +1 -0
- package/dist/packem_shared/parseMailgunInbound-C3sZ1TiH.js +1 -0
- package/dist/packem_shared/parseMtaStsPolicy-rFOOVXXK.js +6 -0
- package/dist/packem_shared/parsePostmarkInbound-C0Ttfroo.js +1 -0
- package/dist/packem_shared/parseSendGridInbound-BkvaoYRl.js +4 -0
- package/dist/packem_shared/parseSesInbound-BFS--T8X.js +1 -0
- package/dist/packem_shared/parseTlsRptRecord-DnLwAWsk.js +1 -0
- package/dist/packem_shared/plunkProvider-BIhMU2b5.js +1 -0
- package/dist/packem_shared/postProcessHtml-C73e0b9H.js +1 -0
- package/dist/packem_shared/postalProvider-CmmbCZSi.js +1 -0
- package/dist/packem_shared/postmarkProvider-i9u0h26U.js +1 -0
- package/dist/packem_shared/provider-base-BpHE_uK8.js +1 -0
- package/dist/packem_shared/{provider.d-DcfYeGJJ.d.ts → provider.d-J-y6iogK.d.ts} +1 -1
- package/dist/packem_shared/readFile-BkNfutxp-BS8Q2183.js +1 -0
- package/dist/packem_shared/resendProvider-BNduBn0w.js +1 -0
- package/dist/packem_shared/retry-UPd8F62N.js +1 -0
- package/dist/packem_shared/retryMiddleware-DHespsU2.js +1 -0
- package/dist/packem_shared/rewriteCidLinks-B-Sd5XHs.js +1 -0
- package/dist/packem_shared/roundRobinProvider-B_60F0BC.js +1 -0
- package/dist/packem_shared/scalewayProvider-8gb4sIOB.js +1 -0
- package/dist/packem_shared/sendGridProvider-CayLXvPO.js +1 -0
- package/dist/packem_shared/smtpProvider-DoXVsN4p.js +24 -0
- package/dist/packem_shared/sweegoProvider-C0g9Ajdn.js +1 -0
- package/dist/packem_shared/toEmailSnapshot-CYpMmnAA.js +1 -0
- package/dist/packem_shared/tracer.d-MU42G1jG.d.ts +494 -0
- package/dist/packem_shared/{types.d-CNnnk-Ya.d.ts → types.d-BId55FW2.d.ts} +6 -1
- package/dist/packem_shared/types.d-BMpI2UXj.d.ts +51 -0
- package/dist/packem_shared/types.d-CmoWvdZi.d.ts +61 -0
- package/dist/packem_shared/types.d-Mpu0HZoG.d.ts +24 -0
- package/dist/packem_shared/{types.d-wwpgA3to.d.ts → types.d-ejzh-xBP.d.ts} +6 -1
- package/dist/packem_shared/types.d-lcJZmwRK.d.ts +69 -0
- package/dist/packem_shared/utils-BwolsGlK.js +1 -0
- package/dist/packem_shared/verifyMailgunWebhook-Df7n2Quh.js +1 -0
- package/dist/packem_shared/verifyPostmarkWebhook-D_eXt_Lq.js +1 -0
- package/dist/packem_shared/verifySendGridWebhook-XOSj5yTe.js +1 -0
- package/dist/packem_shared/verifyStandardWebhook-DdUTlIVh.js +1 -0
- package/dist/packem_shared/withEvents-Q9bwpCFG.js +1 -0
- package/dist/packem_shared/withMetrics-BPs3Kdxn.js +1 -0
- package/dist/packem_shared/withRender-DQM2zbbI.js +1 -0
- package/dist/packem_shared/withSuppression-DfjV_tbI.js +1 -0
- package/dist/packem_shared/withTelemetry-CsQsv1DV.js +1 -0
- package/dist/packem_shared/zeptomailProvider-BIbHieGJ.js +1 -0
- package/dist/providers/ahasend/index.d.ts +3 -3
- package/dist/providers/ahasend/index.js +1 -1
- package/dist/providers/aws-ses/index.d.ts +3 -3
- package/dist/providers/azure/index.d.ts +3 -3
- package/dist/providers/azure/index.js +1 -1
- package/dist/providers/brevo/index.d.ts +3 -3
- package/dist/providers/brevo/index.js +1 -1
- package/dist/providers/cloudflare-email/index.d.ts +36 -0
- package/dist/providers/cloudflare-email/index.js +1 -0
- package/dist/providers/failover/index.d.ts +3 -3
- package/dist/providers/failover/index.js +1 -1
- package/dist/providers/http/index.d.ts +3 -3
- package/dist/providers/infobip/index.d.ts +3 -3
- package/dist/providers/infobip/index.js +1 -1
- package/dist/providers/loops/index.d.ts +47 -0
- package/dist/providers/loops/index.js +1 -0
- package/dist/providers/mailchannels/index.d.ts +26 -0
- package/dist/providers/mailchannels/index.js +1 -0
- package/dist/providers/mailcrab/index.d.ts +3 -3
- package/dist/providers/mailcrab/index.js +1 -1
- package/dist/providers/mailersend/index.d.ts +3 -3
- package/dist/providers/mailersend/index.js +1 -1
- package/dist/providers/mailgun/index.d.ts +3 -3
- package/dist/providers/mailgun/index.js +1 -1
- package/dist/providers/mailjet/index.d.ts +3 -3
- package/dist/providers/mailjet/index.js +1 -1
- package/dist/providers/mailomat/index.d.ts +3 -3
- package/dist/providers/mailomat/index.js +1 -1
- package/dist/providers/mailpace/index.d.ts +3 -3
- package/dist/providers/mailpace/index.js +1 -1
- package/dist/providers/mailtrap/index.d.ts +3 -3
- package/dist/providers/mailtrap/index.js +1 -1
- package/dist/providers/mandrill/index.d.ts +3 -3
- package/dist/providers/mandrill/index.js +1 -1
- package/dist/providers/mock/index.d.ts +6 -53
- package/dist/providers/nodemailer/index.d.ts +3 -3
- package/dist/providers/opentelemetry/index.d.ts +3 -495
- package/dist/providers/plunk/index.d.ts +3 -3
- package/dist/providers/plunk/index.js +1 -1
- package/dist/providers/postal/index.d.ts +3 -3
- package/dist/providers/postal/index.js +1 -1
- package/dist/providers/postmark/index.d.ts +3 -3
- package/dist/providers/postmark/index.js +1 -1
- package/dist/providers/resend/index.d.ts +3 -3
- package/dist/providers/resend/index.js +1 -1
- package/dist/providers/roundrobin/index.d.ts +3 -3
- package/dist/providers/roundrobin/index.js +1 -1
- package/dist/providers/scaleway/index.d.ts +3 -3
- package/dist/providers/scaleway/index.js +1 -1
- package/dist/providers/sendgrid/index.d.ts +3 -3
- package/dist/providers/sendgrid/index.js +1 -1
- package/dist/providers/smtp/index.d.ts +3 -3
- package/dist/providers/smtp/index.js +1 -1
- package/dist/providers/sweego/index.d.ts +3 -3
- package/dist/providers/sweego/index.js +1 -1
- package/dist/providers/zeptomail/index.d.ts +3 -3
- package/dist/providers/zeptomail/index.js +1 -1
- package/dist/queue/bullmq-queue.d.ts +46 -0
- package/dist/queue/bullmq-queue.js +1 -0
- package/dist/queue/index.d.ts +148 -0
- package/dist/queue/index.js +1 -0
- package/dist/queue/pg-boss-queue.d.ts +41 -0
- package/dist/queue/pg-boss-queue.js +1 -0
- package/dist/queue/sqs-queue.d.ts +72 -0
- package/dist/queue/sqs-queue.js +1 -0
- package/dist/queue/unstorage-queue.d.ts +81 -0
- package/dist/queue/unstorage-queue.js +1 -0
- package/dist/render/index.d.ts +107 -0
- package/dist/render/index.js +1 -0
- package/dist/template-engines/i18n.d.ts +61 -0
- package/dist/template-engines/i18n.js +1 -0
- package/dist/template-engines/jsx-email.d.ts +11 -0
- package/dist/template-engines/jsx-email.js +1 -0
- package/dist/template-engines/liquid.d.ts +12 -0
- package/dist/template-engines/liquid.js +1 -0
- package/dist/test/index.d.ts +159 -0
- package/dist/test/index.js +1 -0
- package/dist/utils/format-email-address.d.ts +1 -1
- package/dist/utils/format-email-address.js +1 -1
- package/dist/utils/parse-address.d.ts +1 -1
- package/dist/utils/result.d.ts +49 -0
- package/dist/utils/result.js +1 -0
- package/dist/utils/validation/check-feature-support.d.ts +53 -0
- package/dist/utils/validation/check-feature-support.js +1 -0
- package/dist/webhooks/index.d.ts +231 -0
- package/dist/webhooks/index.js +1 -0
- package/package.json +119 -3
- package/dist/packem_shared/DkimSigner-CX2yGILn.js +0 -18
- package/dist/packem_shared/Mail-KMrKXmyB.js +0 -1
- package/dist/packem_shared/address-formatter-Cm_E_ZMa.js +0 -1
- package/dist/packem_shared/ahaSendProvider-DOAAW65O.js +0 -1
- package/dist/packem_shared/attachment-processor-DsmIomKc.js +0 -1
- package/dist/packem_shared/azureProvider-EkNYKAiF.js +0 -1
- package/dist/packem_shared/brevoProvider-CkR4U4RD.js +0 -1
- package/dist/packem_shared/build-mime-message-6xstxaUV.js +0 -2
- package/dist/packem_shared/failoverProvider-W5ctAhdC.js +0 -1
- package/dist/packem_shared/infobipProvider-BhTsWi7e.js +0 -1
- package/dist/packem_shared/mailPaceProvider-DRt6Z9Hr.js +0 -1
- package/dist/packem_shared/mailerSendProvider-Dx_iHInH.js +0 -1
- package/dist/packem_shared/mailgunProvider-ChkLGZZW.js +0 -1
- package/dist/packem_shared/mailjetProvider-BMRhNe6H.js +0 -1
- package/dist/packem_shared/mailomatProvider-CydV-JB6.js +0 -1
- package/dist/packem_shared/mailtrapProvider-CuAfJWDr.js +0 -1
- package/dist/packem_shared/mandrillProvider-BBeLbaw0.js +0 -1
- package/dist/packem_shared/plunkProvider-BQyjG6YT.js +0 -1
- package/dist/packem_shared/postalProvider-DPHQ620q.js +0 -1
- package/dist/packem_shared/postmarkProvider-bMTC2gdJ.js +0 -1
- package/dist/packem_shared/provider-base-Cmzx6BTO.js +0 -1
- package/dist/packem_shared/readFile-BAVMZg5e-CTXYIyEU.js +0 -1
- package/dist/packem_shared/resendProvider-Cns1tvF5.js +0 -1
- package/dist/packem_shared/roundRobinProvider-FvZQKl6n.js +0 -1
- package/dist/packem_shared/scalewayProvider-O1dHz7iJ.js +0 -1
- package/dist/packem_shared/sendGridProvider-DmywC-eT.js +0 -1
- package/dist/packem_shared/smtpProvider-Unjao_fn.js +0 -23
- package/dist/packem_shared/sweegoProvider-D086G6xG.js +0 -1
- package/dist/packem_shared/zeptomailProvider-DKKEpEsW.js +0 -1
package/package.json
CHANGED
|
@@ -1,19 +1,31 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@visulima/email",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.35",
|
|
4
4
|
"description": "A comprehensive email library with multi-provider support, crypto utilities, and template engines",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ahasend",
|
|
7
|
+
"arc",
|
|
7
8
|
"aws-ses",
|
|
8
9
|
"azure",
|
|
10
|
+
"batch",
|
|
9
11
|
"better-mail",
|
|
10
12
|
"brevo",
|
|
11
13
|
"crypto",
|
|
14
|
+
"deliverability",
|
|
12
15
|
"disposable-email",
|
|
13
16
|
"disposable-email-domains",
|
|
14
17
|
"dkim",
|
|
18
|
+
"dmarc",
|
|
15
19
|
"email",
|
|
16
20
|
"encryption",
|
|
21
|
+
"i18n",
|
|
22
|
+
"inbound-email",
|
|
23
|
+
"jsx-email",
|
|
24
|
+
"liquid",
|
|
25
|
+
"list-unsubscribe",
|
|
26
|
+
"middleware",
|
|
27
|
+
"queue",
|
|
28
|
+
"webhook",
|
|
17
29
|
"failover",
|
|
18
30
|
"handlebars",
|
|
19
31
|
"html-to-text",
|
|
@@ -97,6 +109,18 @@
|
|
|
97
109
|
"types": "./dist/template-engines/html-to-text.d.ts",
|
|
98
110
|
"default": "./dist/template-engines/html-to-text.js"
|
|
99
111
|
},
|
|
112
|
+
"./template/liquid": {
|
|
113
|
+
"types": "./dist/template-engines/liquid.d.ts",
|
|
114
|
+
"default": "./dist/template-engines/liquid.js"
|
|
115
|
+
},
|
|
116
|
+
"./template/jsx-email": {
|
|
117
|
+
"types": "./dist/template-engines/jsx-email.d.ts",
|
|
118
|
+
"default": "./dist/template-engines/jsx-email.js"
|
|
119
|
+
},
|
|
120
|
+
"./template/i18n": {
|
|
121
|
+
"types": "./dist/template-engines/i18n.d.ts",
|
|
122
|
+
"default": "./dist/template-engines/i18n.js"
|
|
123
|
+
},
|
|
100
124
|
"./providers/aws-ses": {
|
|
101
125
|
"types": "./dist/providers/aws-ses/index.d.ts",
|
|
102
126
|
"default": "./dist/providers/aws-ses/index.js"
|
|
@@ -149,6 +173,58 @@
|
|
|
149
173
|
"types": "./dist/crypto/index.d.ts",
|
|
150
174
|
"default": "./dist/crypto/index.js"
|
|
151
175
|
},
|
|
176
|
+
"./render": {
|
|
177
|
+
"types": "./dist/render/index.d.ts",
|
|
178
|
+
"default": "./dist/render/index.js"
|
|
179
|
+
},
|
|
180
|
+
"./webhooks": {
|
|
181
|
+
"types": "./dist/webhooks/index.d.ts",
|
|
182
|
+
"default": "./dist/webhooks/index.js"
|
|
183
|
+
},
|
|
184
|
+
"./deliverability": {
|
|
185
|
+
"types": "./dist/deliverability/index.d.ts",
|
|
186
|
+
"default": "./dist/deliverability/index.js"
|
|
187
|
+
},
|
|
188
|
+
"./deliverability/dmarc-report": {
|
|
189
|
+
"types": "./dist/deliverability/dmarc-report.d.ts",
|
|
190
|
+
"default": "./dist/deliverability/dmarc-report.js"
|
|
191
|
+
},
|
|
192
|
+
"./inbound": {
|
|
193
|
+
"types": "./dist/inbound/index.d.ts",
|
|
194
|
+
"default": "./dist/inbound/index.js"
|
|
195
|
+
},
|
|
196
|
+
"./events": {
|
|
197
|
+
"types": "./dist/events/index.d.ts",
|
|
198
|
+
"default": "./dist/events/index.js"
|
|
199
|
+
},
|
|
200
|
+
"./middleware": {
|
|
201
|
+
"types": "./dist/middleware/index.d.ts",
|
|
202
|
+
"default": "./dist/middleware/index.js"
|
|
203
|
+
},
|
|
204
|
+
"./queue": {
|
|
205
|
+
"types": "./dist/queue/index.d.ts",
|
|
206
|
+
"default": "./dist/queue/index.js"
|
|
207
|
+
},
|
|
208
|
+
"./queue/unstorage": {
|
|
209
|
+
"types": "./dist/queue/unstorage-queue.d.ts",
|
|
210
|
+
"default": "./dist/queue/unstorage-queue.js"
|
|
211
|
+
},
|
|
212
|
+
"./queue/sqs": {
|
|
213
|
+
"types": "./dist/queue/sqs-queue.d.ts",
|
|
214
|
+
"default": "./dist/queue/sqs-queue.js"
|
|
215
|
+
},
|
|
216
|
+
"./queue/pg-boss": {
|
|
217
|
+
"types": "./dist/queue/pg-boss-queue.d.ts",
|
|
218
|
+
"default": "./dist/queue/pg-boss-queue.js"
|
|
219
|
+
},
|
|
220
|
+
"./queue/bullmq": {
|
|
221
|
+
"types": "./dist/queue/bullmq-queue.d.ts",
|
|
222
|
+
"default": "./dist/queue/bullmq-queue.js"
|
|
223
|
+
},
|
|
224
|
+
"./test": {
|
|
225
|
+
"types": "./dist/test/index.d.ts",
|
|
226
|
+
"default": "./dist/test/index.js"
|
|
227
|
+
},
|
|
152
228
|
"./providers/sendgrid": {
|
|
153
229
|
"types": "./dist/providers/sendgrid/index.d.ts",
|
|
154
230
|
"default": "./dist/providers/sendgrid/index.js"
|
|
@@ -213,10 +289,26 @@
|
|
|
213
289
|
"types": "./dist/providers/sweego/index.d.ts",
|
|
214
290
|
"default": "./dist/providers/sweego/index.js"
|
|
215
291
|
},
|
|
292
|
+
"./providers/mailchannels": {
|
|
293
|
+
"types": "./dist/providers/mailchannels/index.d.ts",
|
|
294
|
+
"default": "./dist/providers/mailchannels/index.js"
|
|
295
|
+
},
|
|
296
|
+
"./providers/cloudflare-email": {
|
|
297
|
+
"types": "./dist/providers/cloudflare-email/index.d.ts",
|
|
298
|
+
"default": "./dist/providers/cloudflare-email/index.js"
|
|
299
|
+
},
|
|
300
|
+
"./providers/loops": {
|
|
301
|
+
"types": "./dist/providers/loops/index.d.ts",
|
|
302
|
+
"default": "./dist/providers/loops/index.js"
|
|
303
|
+
},
|
|
216
304
|
"./utils/parse-address": {
|
|
217
305
|
"types": "./dist/utils/parse-address.d.ts",
|
|
218
306
|
"default": "./dist/utils/parse-address.js"
|
|
219
307
|
},
|
|
308
|
+
"./utils/result": {
|
|
309
|
+
"types": "./dist/utils/result.d.ts",
|
|
310
|
+
"default": "./dist/utils/result.js"
|
|
311
|
+
},
|
|
220
312
|
"./utils/format-email-address": {
|
|
221
313
|
"types": "./dist/utils/format-email-address.d.ts",
|
|
222
314
|
"default": "./dist/utils/format-email-address.js"
|
|
@@ -249,6 +341,10 @@
|
|
|
249
341
|
"types": "./dist/utils/validation/verify-email.d.ts",
|
|
250
342
|
"default": "./dist/utils/validation/verify-email.js"
|
|
251
343
|
},
|
|
344
|
+
"./validation/check-feature-support": {
|
|
345
|
+
"types": "./dist/utils/validation/check-feature-support.d.ts",
|
|
346
|
+
"default": "./dist/utils/validation/check-feature-support.js"
|
|
347
|
+
},
|
|
252
348
|
"./utils/normalize-email-aliases": {
|
|
253
349
|
"types": "./dist/utils/normalize-email-aliases.d.ts",
|
|
254
350
|
"default": "./dist/utils/normalize-email-aliases.js"
|
|
@@ -261,7 +357,7 @@
|
|
|
261
357
|
"CHANGELOG.md"
|
|
262
358
|
],
|
|
263
359
|
"dependencies": {
|
|
264
|
-
"@visulima/disposable-email-domains": "1.0.0-alpha.
|
|
360
|
+
"@visulima/disposable-email-domains": "1.0.0-alpha.16",
|
|
265
361
|
"html-to-text": "^10.0.0",
|
|
266
362
|
"ical-generator": "10.2.0",
|
|
267
363
|
"lru-cache": "11.4.0",
|
|
@@ -272,10 +368,15 @@
|
|
|
272
368
|
"@react-email/render": "^2.0.8",
|
|
273
369
|
"@vue-email/render": "0.0.9",
|
|
274
370
|
"asn1js": "3.0.10",
|
|
371
|
+
"fast-xml-parser": "^4.5.0",
|
|
275
372
|
"handlebars": "4.7.9",
|
|
373
|
+
"jsx-email": "^2.0.0",
|
|
374
|
+
"juice": "^11.0.0",
|
|
375
|
+
"liquidjs": "^10.0.0",
|
|
276
376
|
"mjml": "5.2.1",
|
|
277
377
|
"nodemailer": ">=7",
|
|
278
|
-
"pkijs": "3.4.0"
|
|
378
|
+
"pkijs": "3.4.0",
|
|
379
|
+
"unstorage": "^1.13.0"
|
|
279
380
|
},
|
|
280
381
|
"peerDependenciesMeta": {
|
|
281
382
|
"@opentelemetry/api": {
|
|
@@ -290,9 +391,21 @@
|
|
|
290
391
|
"asn1js": {
|
|
291
392
|
"optional": true
|
|
292
393
|
},
|
|
394
|
+
"fast-xml-parser": {
|
|
395
|
+
"optional": true
|
|
396
|
+
},
|
|
293
397
|
"handlebars": {
|
|
294
398
|
"optional": true
|
|
295
399
|
},
|
|
400
|
+
"jsx-email": {
|
|
401
|
+
"optional": true
|
|
402
|
+
},
|
|
403
|
+
"juice": {
|
|
404
|
+
"optional": true
|
|
405
|
+
},
|
|
406
|
+
"liquidjs": {
|
|
407
|
+
"optional": true
|
|
408
|
+
},
|
|
296
409
|
"mjml": {
|
|
297
410
|
"optional": true
|
|
298
411
|
},
|
|
@@ -301,6 +414,9 @@
|
|
|
301
414
|
},
|
|
302
415
|
"pkijs": {
|
|
303
416
|
"optional": true
|
|
417
|
+
},
|
|
418
|
+
"unstorage": {
|
|
419
|
+
"optional": true
|
|
304
420
|
}
|
|
305
421
|
},
|
|
306
422
|
"engines": {
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
var v=Object.defineProperty;var m=(o,e)=>v(o,"name",{value:e,configurable:!0});import{createRequire as w}from"node:module";import{B as x}from"./readFile-BAVMZg5e-CTXYIyEU.js";import{i as z}from"./headers-to-record-Qo124ImV.js";const C=w(import.meta.url),p=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,T=m(o=>{if(typeof p<"u"&&p.versions&&p.versions.node){const[e,t]=p.versions.node.split(".").map(Number);if(e>22||e===22&&t>=3||e===20&&t>=16)return p.getBuiltinModule(o)}return C(o)},"__cjs_getBuiltinModule"),{createHash:M,createSign:S,createPrivateKey:_}=T("node:crypto");var H=Object.defineProperty,d=m((o,e)=>H(o,"name",{value:e,configurable:!0}),"l");const I=d((o,e="simple")=>{const t=[];for(const[r,a]of Object.entries(o)){const n=e==="relaxed"?r.toLowerCase().trim():r,s=e==="relaxed"?a.replaceAll(/\s+/g," ").trim():a;t.push(`${n}:${s}`)}return t.join(`\r
|
|
2
|
-
`)},"canonicalizeHeaders"),K=d((o,e="simple")=>{if(e==="simple"){const n=o.replace(/(\r\n|\r|\n)$/,`
|
|
3
|
-
`);let s=n.length;for(;s>0&&n[s-1]===`
|
|
4
|
-
`;)s-=1;const c=n.slice(0,s);return c?`${c}
|
|
5
|
-
`:`
|
|
6
|
-
`}let t=o.replaceAll(`\r
|
|
7
|
-
`,`
|
|
8
|
-
`).replaceAll("\r",`
|
|
9
|
-
`);t=t.split(`
|
|
10
|
-
`).map(n=>n.replaceAll(/\s+/g," ").replace(/[ \t]+$/,"")).join(`
|
|
11
|
-
`);let r=t.length;for(;r>0&&t[r-1]===`
|
|
12
|
-
`;)r-=1;const a=t.slice(0,r);return a?`${a}
|
|
13
|
-
`:`
|
|
14
|
-
`},"canonicalizeBody"),B=d((o,e,t)=>{const r=e.headerCanon??"simple",a=e.bodyCanon??"simple",n=Object.keys(o).filter(s=>!e.headersToIgnore?.some(c=>c.toLowerCase()===s.toLowerCase())).map(s=>s.toLowerCase()).join(":");return["v=1","a=rsa-sha256",`c=${r}/${a}`,`d=${e.domainName}`,`s=${e.keySelector}`,`h=${n}`,`bh=${t}`,"b="].join("; ")},"createDkimSignatureHeader");class i{static{m(this,"DkimSigner")}static{d(this,"DkimSigner")}static sanitizeDisplayName(e){let t=e.replaceAll(/[\r\n\t]+/g," ");t=[...t].filter(n=>{const s=n.codePointAt(0);return s===void 0?!1:s>=32&&s<=126||s>159}).join("");const r="\\",a='"';return t=t.replaceAll(r,r+r).replaceAll(a,r+a),t=t.trim().replaceAll(/\s+/g," "),t}static formatAddress(e){if(e.name){const t=i.sanitizeDisplayName(e.name);return t?`"${t}" <${e.email}>`:e.email}return e.email}static formatAddresses(e){return(Array.isArray(e)?e:[e]).map(t=>i.formatAddress(t)).join(", ")}options;constructor(e){this.options=e}async sign(e){let t=this.options.privateKey;if(t.startsWith("file://")){const l=t.slice(7);t=await x(l,{encoding:"utf8"})}const r={...e.headers?z(e.headers):{},From:i.formatAddress(e.from),To:i.formatAddresses(e.to)};e.cc&&(r.Cc=i.formatAddresses(e.cc)),e.replyTo&&(r["Reply-To"]=i.formatAddress(e.replyTo)),r.Subject=e.subject,r["MIME-Version"]="1.0";const a=[];e.text&&a.push(e.text),e.html&&a.push(e.html);const n=a.join(`
|
|
15
|
-
|
|
16
|
-
`),s=this.options.headerCanon??"simple",c=this.options.bodyCanon??"simple",g=I(r,s),y=K(n,c),A=M("sha256").update(y).digest("base64"),h=B(r,this.options,A),$=`${g}\r
|
|
17
|
-
DKIM-Signature: ${h}`,f=S("RSA-SHA256");f.update($);let u;try{const l=_({key:t,passphrase:this.options.passphrase});u=f.sign(l,"base64")}catch(l){throw new Error(`Failed to create DKIM signature: ${l.message}`)}const j=u.match(/.{1,72}/g)?.join(`\r
|
|
18
|
-
`)??u,b={...r,"DKIM-Signature":`${h}${j}`};return{...e,headers:b}}}const R=d(o=>new i(o),"createDkimSigner");export{i as DkimSigner,R as createDkimSigner};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var p=Object.defineProperty;var l=(o,e)=>p(o,"name",{value:e,configurable:!0});import{MailMessage as f}from"./MailMessage-Dy1gP5e-.js";import{z as b}from"./build-mime-message-6xstxaUV.js";import{c as m}from"./create-logger-BiWdqFNg.js";import{i as n}from"./headers-to-record-Qo124ImV.js";var y=Object.defineProperty,C=l((o,e)=>y(o,"name",{value:e,configurable:!0}),"s");class h extends f{static{l(this,"DraftMailMessage")}static{C(this,"DraftMailMessage")}constructor(){super(),this.header("X-Unsent","1")}}var M=Object.defineProperty,c=l((o,e)=>M(o,"name",{value:e,configurable:!0}),"n");const v=c((o,e,s)=>{e.success&&e.data?o&&o.info("Email sent successfully",{messageId:e.data.messageId,provider:e.data.provider}):o&&o.error("Email send failed",{error:e.error,provider:s})},"logSendResult");class d{static{l(this,"Mail")}static{c(this,"Mail")}static extractErrorMessages(e){return e instanceof Error?[e.message]:[String(e??"Unknown error")]}provider;logger;loggerInstance;globalConfig;constructor(e){this.provider=e}setLogger(e){return this.loggerInstance=e,this.logger=m("Mail",e),this}setFrom(e){return this.globalConfig??={},this.globalConfig.from=e,this.logger&&this.logger.debug("Default from address updated",{from:e.email}),this}setReplyTo(e){return this.globalConfig??={},this.globalConfig.replyTo=e,this.logger&&this.logger.debug("Default reply-to address updated",{replyTo:e.email}),this}setHeaders(e){if(this.globalConfig??={},this.globalConfig.headers=e,this.logger){const s=n(e);this.logger.debug("Default headers updated",{count:Object.keys(s).length,headers:Object.keys(s)})}return this}async draft(e){let s=e instanceof f||e instanceof h?await this.buildDraftFromMessage(e):await this.buildDraftFromOptions(e);s=this.applyGlobalConfig(s);const t=s.headers?n(s.headers):{};s.headers={...t,"X-Unsent":"1"};const r=await b(s);return this.logger&&this.logger.debug("Draft created successfully in EML format",{from:s.from.email,size:r.length,subject:s.subject,to:Array.isArray(s.to)?s.to.length:1}),r}async send(e){if(e instanceof h)throw new TypeError("Cannot send draft messages. Convert to MailMessage first or remove X-Unsent header.");let s;if(e instanceof f)this.logger&&this.logger.debug("Sending MailMessage instance"),this.loggerInstance&&e.setLogger(this.loggerInstance),s=await e.build();else{const r=e;this.logger&&this.logger.debug("Sending email with options",{subject:r.subject,to:Array.isArray(r.to)?r.to.length:1}),s=r}s=this.applyGlobalConfig(s);const t=await this.provider.sendEmail(s);return v(this.logger,t,this.provider.name??"unknown"),t}async*sendMany(e,s){const t=this.provider.name;let r=0,g=0,i=0;this.logger&&this.logger.debug("Starting batch email send",{provider:t});for await(const u of e){if(u instanceof h)throw new TypeError("Cannot send draft messages. Convert to MailMessage first or remove X-Unsent header.");if(s?.signal?.aborted){this.logger&&this.logger.warn("Batch send operation was aborted",{failed:i,processed:r,successful:g}),yield{errorMessages:["Send operation was aborted"],provider:t,successful:!1};return}r+=1;try{const a=await this.send(u);a.success&&a.data?(g+=1,this.logger&&this.logger.debug(`Email ${r} sent successfully`,{messageId:a.data.messageId}),yield{messageId:a.data.messageId,provider:a.data.provider??t,response:a.data.response,successful:!0,timestamp:a.data.timestamp}):(i+=1,this.logger&&this.logger.error(`Email ${r} send failed`,{error:a.error}),yield{errorMessages:d.extractErrorMessages(a.error),provider:t,successful:!1})}catch(a){i+=1,this.logger&&this.logger.error(`Email ${r} send failed with exception`,a),yield{errorMessages:d.extractErrorMessages(a),provider:t,successful:!1}}}this.logger&&this.logger.debug("Batch email send completed",{failureCount:i,processedCount:r,provider:t,successCount:g})}async buildDraftFromMessage(e){return this.logger&&this.logger.debug("Creating draft from MailMessage instance"),this.loggerInstance&&e.setLogger(this.loggerInstance),this.applyGlobalConfigToMessage(e),await e.build()}async buildDraftFromOptions(e){return this.logger&&this.logger.debug("Creating draft from email options",{subject:e.subject,to:Array.isArray(e.to)?e.to.length:1}),e}applyGlobalConfigToMessage(e){const s=this.globalConfig?.from;s&&!e.getFrom()&&e.from(s);const t=this.globalConfig?.replyTo;if(t&&!e.getReplyTo()&&e.replyTo(t),this.globalConfig?.headers){const r=n(this.globalConfig.headers);Object.entries(r).forEach(([g,i])=>{e.header(g,i)})}}applyGlobalConfig(e){if(!this.globalConfig)return e;const s={...e};if(!s.from&&this.globalConfig.from&&(s.from=this.globalConfig.from,this.logger&&this.logger.debug("Applied global from address",{from:this.globalConfig.from.email})),!s.replyTo&&this.globalConfig.replyTo&&(s.replyTo=this.globalConfig.replyTo,this.logger&&this.logger.debug("Applied global reply-to address",{replyTo:this.globalConfig.replyTo.email})),this.globalConfig.headers){const t=n(this.globalConfig.headers),r=s.headers?n(s.headers):{};s.headers={...t,...r},this.logger&&this.logger.debug("Merged global headers",{globalCount:Object.keys(t).length,messageCount:Object.keys(r).length})}return s}}const D=c(o=>new d(o),"createMail");export{d as Mail,D as createMail};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var t=Object.defineProperty;var r=(a,s)=>t(a,"name",{value:s,configurable:!0});var A=Object.defineProperty,e=r((a,s)=>A(a,"name",{value:s,configurable:!0}),"t");const o=e(a=>a.name?`${a.name} <${a.email}>`:a.email,"formatAddress"),i=e(a=>(Array.isArray(a)?a:[a]).map(s=>o(s)),"formatAddresses"),l=e(a=>{const s={email:a.email};return a.name&&(s.name=a.name),s},"formatSendGridAddress"),u=e(a=>(Array.isArray(a)?a:[a]).map(s=>l(s)),"formatSendGridAddresses"),c=e(a=>(Array.isArray(a)?a:[a]).map(s=>s.email),"formatAddressEmails"),f=e(a=>({email:a.email,...a.name&&{displayName:a.name}}),"formatAzureAddress"),j=e(a=>(Array.isArray(a)?a:[a]).map(s=>f(s)),"formatAzureAddresses"),n=e(a=>{const s={Email:a.email};return a.name&&(s.Name=a.name),s},"formatMailjetAddress"),P=e(a=>(Array.isArray(a)?a:[a]).map(s=>n(s)),"formatMailjetAddresses"),y=e((a,s="to")=>({email:a.email,...a.name&&{name:a.name},type:s}),"formatMandrillAddress"),z=e((a,s="to")=>(Array.isArray(a)?a:[a]).map(m=>y(m,s)),"formatMandrillAddresses"),d=e(a=>({address:a.email,...a.name&&{name:a.name}}),"formatPostalAddress"),G=e(a=>(Array.isArray(a)?a:[a]).map(s=>d(s)),"formatPostalAddresses"),S=e(a=>i(a),"formatMailpaceAddresses"),p=e(a=>d(a),"formatZeptomailAddress");e(a=>(Array.isArray(a)?a:[a]).map(s=>({email_address:p(s)})),"formatZeptomailAddresses");export{l as a,i as b,o as c,P as d,n as e,u as f,z as g,G as h,d as i,j,f as k,c as l,p as m,S as n};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var P=Object.defineProperty;var y=(i,r)=>P(i,"name",{value:r,configurable:!0});import{createRequire as I}from"node:module";import c from"./EmailError-zm2ffVav.js";import S from"./RequiredOptionError-CevW3u2K.js";import{s as _}from"./generate-message-id-D4uA8gkj.js";import{i as E}from"./headers-to-record-Qo124ImV.js";import{m as f}from"./make-request-CaT4d5oC.js";import{c as z,u as b,h as w,P as k}from"./provider-base-Cmzx6BTO.js";import{d as q}from"./validate-email-options-DPo3SgC0.js";import{defineProvider as K}from"./defineProvider-CtLH0VBE.js";import{f as p,a as B}from"./address-formatter-Cm_E_ZMa.js";const T=I(import.meta.url),m=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,$=y(i=>{if(typeof m<"u"&&m.versions&&m.versions.node){const[r,u]=m.versions.node.split(".").map(Number);if(r>22||r===22&&u>=3||r===20&&u>=16)return m.getBuiltinModule(i)}return T(i)},"__cjs_getBuiltinModule"),{Buffer:j}=$("node:buffer"),s="ahasend",C="https://api.ahasend.com",x=3e4,G=3,Q=K((i={})=>{if(!i.apiKey)throw new S(s,"apiKey");const r={apiKey:i.apiKey,debug:i.debug??!1,endpoint:i.endpoint??C,retries:i.retries??G,timeout:i.timeout??x,...i.logger&&{logger:i.logger}},u=new k,n=z(s,i.logger);return{features:{attachments:!0,batchSending:!0,customHeaders:!0,html:!0,replyTo:!0,scheduling:!1,tagging:!0,templates:!0,tracking:!0},async getEmail(e){try{if(!e)return{error:new c(s,"Email ID is required to retrieve email details"),success:!1};await this.initialize();const o={Authorization:`Bearer ${r.apiKey}`,"Content-Type":"application/json"};n.debug("Retrieving email details",{id:e});const t=await b(async()=>f(`${r.endpoint}/emails/${e}`,{headers:o,method:"GET",timeout:r.timeout}),r.retries);return t.success?(n.debug("Email details retrieved successfully"),{data:t.data?.body,success:!0}):(n.debug("API request failed when retrieving email",t.error),{error:new c(s,`Failed to retrieve email: ${t.error instanceof Error?t.error.message:"Unknown error"}`,{cause:t.error}),success:!1})}catch(o){return{error:w(s,"retrieve email",o,n),success:!1}}},async initialize(){await u.ensureInitialized(async()=>{if(!await this.isAvailable())throw new c(s,"AhaSend API not available or invalid API key");n.debug("Provider initialized successfully")},s)},async isAvailable(){try{return n.debug("Checking AhaSend API availability"),!!(await f(`${r.endpoint}/v2/ping`,{headers:{Authorization:`Bearer ${r.apiKey}`,"Content-Type":"application/json"},method:"GET",timeout:r.timeout})).success}catch(e){return n.debug("Error checking availability:",e),!1}},name:s,options:r,async sendEmail(e){try{const o=q(e);if(o.length>0)return{error:new c(s,`Invalid email options: ${o.join(", ")}`),success:!1};await this.initialize();const t={from:{email:e.from.email,name:e.from.name},subject:e.subject,to:p(e.to)};if(e.html&&(t.html=e.html),e.text&&(t.text=e.text),e.cc&&(t.cc=p(e.cc)),e.bcc&&(t.bcc=p(e.bcc)),e.replyTo&&(t.replyTo=B(e.replyTo)),e.templateId&&(t.templateId=e.templateId,e.templateVariables&&(t.templateVariables=e.templateVariables)),e.tags&&e.tags.length>0&&(t.tags=e.tags),e.headers){const a=E(e.headers);t.headers=a}e.attachments&&e.attachments.length>0&&(t.attachments=await Promise.all(e.attachments.map(async a=>{let d;if(a.content)if(typeof a.content=="string")d=a.content;else if(a.content instanceof Promise){const A=await a.content;d=j.from(A).toString("base64")}else d=a.content.toString("base64");else if(a.raw)d=typeof a.raw=="string"?a.raw:a.raw.toString("base64");else throw new c(s,`Attachment ${a.filename} has no content`);return{content:d,contentType:a.contentType??"application/octet-stream",filename:a.filename,...a.cid&&{cid:a.cid}}}))),n.debug("Sending email via AhaSend API",{subject:t.subject,to:t.to});const v={Authorization:`Bearer ${r.apiKey}`,"Content-Type":"application/json"},l=await b(async()=>f(`${r.endpoint}/send`,{headers:v,method:"POST",timeout:r.timeout},JSON.stringify(t)),r.retries);if(!l.success)return n.debug("API request failed when sending email",l.error),{error:l.error??new c(s,"Failed to send email"),success:!1};const g=l.data?.body,h=g?.messageId??g?.id??_();return n.debug("Email sent successfully",{messageId:h}),{data:{messageId:h,provider:s,response:l.data,sent:!0,timestamp:new Date},success:!0}}catch(o){return{error:w(s,"send email",o,n),success:!1}}},async validateCredentials(){return this.isAvailable()}}});export{Q as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var r=Object.defineProperty;var i=(e,t)=>r(e,"name",{value:t,configurable:!0});import{createRequire as m}from"node:module";import d from"./EmailError-zm2ffVav.js";const p=m(import.meta.url),a=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,f=i(e=>{if(typeof a<"u"&&a.versions&&a.versions.node){const[t,n]=a.versions.node.split(".").map(Number);if(t>22||t===22&&n>=3||t===20&&n>=16)return a.getBuiltinModule(e)}return p(e)},"__cjs_getBuiltinModule"),{Buffer:l}=f("node:buffer");var u=Object.defineProperty,o=i((e,t)=>u(e,"name",{value:t,configurable:!0}),"o");const c=o(async(e,t)=>{let n;if(e.content)if(typeof e.content=="string")n=e.content;else if(e.content instanceof Promise){const s=await e.content;n=l.from(s).toString("base64")}else n=e.content.toString("base64");else if(e.raw)n=typeof e.raw=="string"?e.raw:e.raw.toString("base64");else throw new d(t,`Attachment ${e.filename} has no content`);return n},"processAttachmentContent");o(async(e,t)=>({content:await c(e,t),contentType:e.contentType??"application/octet-stream",disposition:e.contentDisposition??"attachment",filename:e.filename,...e.cid&&{contentId:e.cid}}),"createStandardAttachment");const _=o(async(e,t)=>({content:await c(e,t),disposition:e.contentDisposition??"attachment",filename:e.filename,type:e.contentType??"application/octet-stream",...e.cid&&{content_id:e.cid}}),"createSendGridAttachment"),b=o(async(e,t)=>({Content:await c(e,t),ContentType:e.contentType??"application/octet-stream",Name:e.filename,...e.cid&&{ContentID:e.cid}}),"createPostmarkAttachment"),w=o(async(e,t,n)=>({content:await c(e,t),key:`attachment[${n}]`}),"createMailgunAttachment");export{w as a,b,_ as c};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var k=Object.defineProperty;var w=(n,l)=>k(n,"name",{value:l,configurable:!0});import{createRequire as z}from"node:module";import u from"./EmailError-zm2ffVav.js";import v from"./RequiredOptionError-CevW3u2K.js";import{s as j}from"./generate-message-id-D4uA8gkj.js";import{i as _}from"./headers-to-record-Qo124ImV.js";import{m as h}from"./make-request-CaT4d5oC.js";import{c as B,P as C,u as T,h as S}from"./provider-base-Cmzx6BTO.js";import{d as E}from"./validate-email-options-DPo3SgC0.js";import{defineProvider as q}from"./defineProvider-CtLH0VBE.js";import{j as y,k as R}from"./address-formatter-Cm_E_ZMa.js";const I=z(import.meta.url),f=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,P=w(n=>{if(typeof f<"u"&&f.versions&&f.versions.node){const[l,t]=f.versions.node.split(".").map(Number);if(l>22||l===22&&t>=3||l===20&&t>=16)return f.getBuiltinModule(n)}return I(n)},"__cjs_getBuiltinModule"),{Buffer:p}=P("node:buffer"),i="azure",x=3e4,O=3,Q=q((n={})=>{if(!n.region)throw new v(i,"region");if(!n.connectionString&&!n.accessToken)throw new v(i,"connectionString or accessToken");const l=n.endpoint??`https://${n.region}.communication.azure.com`,t={debug:n.debug??!1,endpoint:l,region:n.region,retries:n.retries??O,timeout:n.timeout??x,...n.connectionString&&{connectionString:n.connectionString},...n.accessToken&&{accessToken:n.accessToken},...n.logger&&{logger:n.logger}},g=new C,a=B(i,n.logger);return{features:{attachments:!0,batchSending:!1,customHeaders:!0,html:!0,replyTo:!0,scheduling:!1,tagging:!1,templates:!0,tracking:!1},async getEmail(e){try{if(!e)return{error:new u(i,"Email ID is required to retrieve email details"),success:!1};await g.ensureInitialized(()=>this.initialize(),i);const o={"Content-Type":"application/json"};if(t.accessToken)o.Authorization=`Bearer ${t.accessToken}`;else if(t.connectionString){const c=t.connectionString.match(/endpoint=([^;]+);accesskey=([^;]+)/);c&&(o.Authorization=`Bearer ${c[2]}`)}a.debug("Retrieving email details",{id:e});const r=await T(async()=>h(`${t.endpoint}/emails/${e}`,{headers:o,method:"GET",timeout:t.timeout}),t.retries);return r.success?(a.debug("Email details retrieved successfully"),{data:r.data?.body,success:!0}):(a.debug("API request failed when retrieving email",r.error),{error:new u(i,`Failed to retrieve email: ${r.error instanceof Error?r.error.message:"Unknown error"}`,{cause:r.error}),success:!1})}catch(o){return{error:S(i,"retrieve email",o,a),success:!1}}},async initialize(){await g.ensureInitialized(async()=>{if(!await this.isAvailable())throw new u(i,"Azure Communication Services API not available or invalid credentials");a.debug("Provider initialized successfully")},i)},async isAvailable(){try{const e={"Content-Type":"application/json"};if(t.accessToken)e.Authorization=`Bearer ${t.accessToken}`;else if(t.connectionString){const c=t.connectionString.match(/endpoint=([^;]+);accesskey=([^;]+)/);if(c)e.Authorization=`Bearer ${c[2]}`;else return!1}else return!1;a.debug("Checking Azure Communication Services API availability");const o=await h(`${t.endpoint}/emails:send`,{headers:e,method:"POST",timeout:t.timeout},JSON.stringify({}));if(o.success)return!0;const r=o.data?.statusCode;return r===401||r===403?!1:r===400}catch(e){if(a.debug("Error checking availability:",e),e instanceof Error){const o=e.message;if(o.includes("401")||o.includes("403"))return!1}return!1}},name:i,options:t,async sendEmail(e){try{const o=E(e);if(o.length>0)return{error:new u(i,`Invalid email options: ${o.join(", ")}`),success:!1};await g.ensureInitialized(()=>this.initialize(),i);const r={content:{subject:e.subject},recipients:{to:y(e.to)},senderAddress:e.from.email};if(e.html&&(r.content.html=e.html),e.text&&(r.content.plainText=e.text),e.cc&&(r.recipients.cc=y(e.cc)),e.bcc&&(r.recipients.bcc=y(e.bcc)),e.replyTo&&(r.replyTo=R(e.replyTo).email),e.importance&&(r.importance=e.importance),e.headers){const s=_(e.headers);r.headers=s}e.attachments&&e.attachments.length>0&&(r.attachments=await Promise.all(e.attachments.map(async s=>{let d;if(s.content)if(typeof s.content=="string")d=p.from(s.content,"utf8").toString("base64");else if(s.content&&typeof s.content.then=="function"){const A=await s.content;d=p.from(A).toString("base64")}else d=s.content.toString("base64");else if(s.raw)d=typeof s.raw=="string"?p.from(s.raw,"utf8").toString("base64"):s.raw.toString("base64");else throw new u(i,`Attachment ${s.filename} has no content`);return{contentInBase64:d,contentType:s.contentType??"application/octet-stream",name:s.filename}}))),a.debug("Sending email via Azure Communication Services API",{subject:r.content.subject,to:r.recipients.to});const c={"Content-Type":"application/json"};if(t.accessToken)c.Authorization=`Bearer ${t.accessToken}`;else if(t.connectionString){const s=t.connectionString.match(/endpoint=([^;]+);accesskey=([^;]+)/);if(s)c.Authorization=`Bearer ${s[2]}`;else return{error:new u(i,"Invalid connection string format"),success:!1}}const m=await T(async()=>h(`${t.endpoint}/emails:send`,{headers:c,method:"POST",timeout:t.timeout},JSON.stringify(r)),t.retries);if(!m.success)return a.debug("API request failed when sending email",m.error),{error:m.error??new u(i,"Failed to send email"),success:!1};const b=m.data?.body?.messageId??j();return a.debug("Email sent successfully",{messageId:b}),{data:{messageId:b,provider:i,response:m.data,sent:!0,timestamp:new Date},success:!0}}catch(o){return{error:S(i,"send email",o,a),success:!1}}},async validateCredentials(){return this.isAvailable()}}});export{Q as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var j=Object.defineProperty;var w=(o,d)=>j(o,"name",{value:d,configurable:!0});import{createRequire as C}from"node:module";import c from"./EmailError-zm2ffVav.js";import k from"./RequiredOptionError-CevW3u2K.js";import{s as z}from"./generate-message-id-D4uA8gkj.js";import{i as q}from"./headers-to-record-Qo124ImV.js";import{m as y}from"./make-request-CaT4d5oC.js";import{c as B,P as K,u as T,h as A}from"./provider-base-Cmzx6BTO.js";import{d as x}from"./validate-email-options-DPo3SgC0.js";import{defineProvider as D}from"./defineProvider-CtLH0VBE.js";import{f as g,a as h}from"./address-formatter-Cm_E_ZMa.js";const E=C(import.meta.url),p=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,S=w(o=>{if(typeof p<"u"&&p.versions&&p.versions.node){const[d,s]=p.versions.node.split(".").map(Number);if(d>22||d===22&&s>=3||d===20&&s>=16)return p.getBuiltinModule(o)}return E(o)},"__cjs_getBuiltinModule"),{Buffer:_}=S("node:buffer"),a="brevo",G="https://api.brevo.com/v3",O=3e4,R=3,X=D((o={})=>{if(!o.apiKey)throw new k(a,"apiKey");const d=o.endpoint??G,s={apiKey:o.apiKey,debug:o.debug??!1,endpoint:d,hardValidation:o.hardValidation??!1,retries:o.retries??R,timeout:o.timeout??O,...o.logger&&{logger:o.logger}},f=new K,n=B(a,o.logger);return{endpoint:s.endpoint,features:{attachments:!0,batchSending:!0,customHeaders:!0,html:!0,replyTo:!0,scheduling:!0,tagging:!0,templates:!0,tracking:!0},async getEmail(e){try{if(!e)return{error:new c(a,"Email ID is required to retrieve email details"),success:!1};await f.ensureInitialized(()=>this.initialize(),a);const t={"api-key":s.apiKey,"Content-Type":"application/json"};n.debug("Retrieving email details",{id:e});const l=await T(async()=>y(`${s.endpoint}/smtp/emails/${e}`,{headers:t,method:"GET",timeout:s.timeout}),s.retries);return l.success?(n.debug("Email details retrieved successfully"),{data:l.data?.body,success:!0}):(n.debug("API request failed when retrieving email",l.error),{error:new c(a,`Failed to retrieve email: ${l.error instanceof Error?l.error.message:"Unknown error"}`,{cause:l.error}),success:!1})}catch(t){return{error:A(a,"retrieve email",t,n),success:!1}}},async initialize(){await f.ensureInitialized(async()=>{if(!await this.isAvailable())throw new c(a,"Brevo API not available or invalid API key");n.debug("Provider initialized successfully")},a)},async isAvailable(){try{const e={"api-key":s.apiKey,"Content-Type":"application/json"};n.debug("Checking Brevo API availability");const t=await y(`${s.endpoint}/account`,{headers:e,method:"GET",timeout:s.timeout});return n.debug("Brevo API availability check response:",{error:t.error instanceof Error?t.error.message:void 0,statusCode:t.data?.statusCode,success:t.success}),!!(t.success&&t.data&&typeof t.data=="object"&&"statusCode"in t.data&&typeof t.data.statusCode=="number"&&t.data.statusCode>=200&&t.data.statusCode<300)}catch(e){return n.debug("Error checking availability:",e),!1}},name:a,options:s,async sendEmail(e){try{let t;Array.isArray(e.replyTo)?t=e.replyTo.length>0?e.replyTo[0]:void 0:t=e.replyTo;const l={...e,replyTo:t},b=x(l);if(b.length>0)return{error:new c(a,`Invalid email options: ${b.join(", ")}`),success:!1};await f.ensureInitialized(()=>this.initialize(),a);const i={sender:h(e.from),subject:e.subject,to:g(e.to)};if(e.html&&(i.htmlContent=e.html),e.text&&(i.textContent=e.text),e.cc&&(i.cc=g(e.cc)),e.bcc&&(i.bcc=g(e.bcc)),e.replyTo)if(Array.isArray(e.replyTo)){if(s.hardValidation)return{error:new c(a,"Only one replyTo address is allowed"),success:!1};if(e.replyTo.length===0)return{error:new c(a,"replyTo array cannot be empty"),success:!1};const r=e.replyTo[0];if(!r)return{error:new c(a,"replyTo array cannot be empty"),success:!1};i.replyTo=h(r)}else i.replyTo=h(e.replyTo);if(e.templateId&&(i.templateId=e.templateId,e.templateParams&&(i.params=e.templateParams)),e.tags&&e.tags.length>0&&(i.tags=e.tags),e.scheduledAt){const r=typeof e.scheduledAt=="number"?new Date(e.scheduledAt*1e3).toISOString():e.scheduledAt;i.scheduledAt=r}if(e.batchId&&(i.batchId=e.batchId),e.headers){const r=q(e.headers);i.headers=r}e.attachments&&e.attachments.length>0&&(i.attachment=await Promise.all(e.attachments.map(async r=>{let m;if(r.content)if(typeof r.content=="string")m=r.content;else if(r.content instanceof Promise){const P=await r.content;m=_.from(P).toString("base64")}else m=r.content.toString("base64");else if(r.raw)m=typeof r.raw=="string"?r.raw:r.raw.toString("base64");else throw new c(a,`Attachment ${r.filename} has no content`);return{content:m,name:r.filename,...r.contentType&&{type:r.contentType}}}))),n.debug("Sending email via Brevo API",{subject:i.subject,to:i.to});const I={"api-key":s.apiKey,"Content-Type":"application/json"},u=await T(async()=>y(`${s.endpoint}/smtp/email`,{headers:I,method:"POST",timeout:s.timeout},JSON.stringify(i)),s.retries);if(!u.success)return n.debug("API request failed when sending email",u.error),{error:u.error??new c(a,"Failed to send email"),success:!1};const v=u.data?.body?.messageId??z();return n.debug("Email sent successfully",{messageId:v}),{data:{messageId:v,provider:a,response:u.data,sent:!0,timestamp:new Date},success:!0}}catch(t){return{error:A(a,"send email",t,n),success:!1}}},async validateCredentials(){return this.isAvailable()}}});export{X as default};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
var v=Object.defineProperty;var u=(e,o)=>v(e,"name",{value:o,configurable:!0});import C from"./EmailError-zm2ffVav.js";import m from"../utils/format-email-address.js";import{a as w}from"./generate-boundary-Cx8nXYS0.js";import{i as j}from"./headers-to-record-Qo124ImV.js";import{s as h,a as b}from"./sanitize-header-wWav-Scu.js";var x=Object.defineProperty,E=u((e,o)=>x(e,"name",{value:o,configurable:!0}),"m");const l=E(e=>Array.isArray(e)?e.map(o=>m(o)).join(", "):m(e),"formatEmailAddresses");var B=Object.defineProperty,M=u((e,o)=>B(e,"name",{value:o,configurable:!0}),"g$1");const d=globalThis.Buffer!==void 0,g=M(e=>{if(typeof e=="string"){if(d)return Buffer.from(e,"utf8").toString("base64");const t=new TextEncoder().encode(e);let r="";const s=8192;for(let a=0;a<t.length;a+=s){const f=t.subarray(a,Math.min(a+s,t.length));r+=String.fromCharCode(...f)}return btoa(r)}if(d&&e instanceof Buffer)return e.toString("base64");const o=e instanceof Uint8Array?e:new Uint8Array(e);if(d)return Buffer.from(o).toString("base64");let n="";const c=8192;for(let t=0;t<o.length;t+=c){const r=o.subarray(t,Math.min(t+c,o.length));n+=String.fromCharCode(...r)}return btoa(n)},"toBase64");var S=Object.defineProperty,A=u((e,o)=>S(e,"name",{value:o,configurable:!0}),"h");const O=globalThis.Buffer!==void 0,H=A(async e=>{const o=w(),n=[`From: ${m(e.from)}`,`To: ${l(e.to)}`];if(e.cc&&n.push(`Cc: ${l(e.cc)}`),e.bcc&&n.push(`Bcc: ${l(e.bcc)}`),e.replyTo&&n.push(`Reply-To: ${m(e.replyTo)}`),n.push(`Subject: ${h(e.subject)}`,"MIME-Version: 1.0"),e.headers){const c=j(e.headers);Object.entries(c).forEach(([t,r])=>{const s=b(t),a=h(r);n.push(`${s}: ${a}`)})}if(n.push(`Content-Type: multipart/mixed; boundary="${o}"`,""),e.text&&n.push(`--${o}`,"Content-Type: text/plain; charset=UTF-8","Content-Transfer-Encoding: 7bit","",e.text,""),e.html&&n.push(`--${o}`,"Content-Type: text/html; charset=UTF-8","Content-Transfer-Encoding: 7bit","",e.html,""),e.attachments&&e.attachments.length>0){const c=await Promise.all(e.attachments.map(async t=>{let r;if(t.raw!==void 0)r=t.raw;else{if(t.content===void 0)throw new C("attachment",`Attachment '${t.filename}' must have content, raw, or be resolved from path/href before building MIME message`);r=t.content instanceof Promise?await t.content:t.content}return{...t,resolvedContent:r}}));for(const t of c){n.push(`--${o}`);const r=t.contentType??"application/octet-stream",s=h(t.filename);n.push(`Content-Type: ${r}; name="${s}"`);const a=t.contentDisposition??"attachment";n.push(`Content-Disposition: ${a}; filename="${s}"`),t.cid&&n.push(`Content-ID: <${t.cid}>`),t.headers&&Object.entries(t.headers).forEach(([p,$])=>{const y=b(p),T=h($);n.push(`${y}: ${T}`)});const f=t.encoding??"base64";n.push(`Content-Transfer-Encoding: ${f}`,"");const i=t.resolvedContent;if(f==="base64")n.push(g(i));else if(f==="7bit"||f==="8bit")if(typeof i=="string")n.push(i);else if(O&&i instanceof Buffer)n.push(i.toString("utf8"));else{const p=new TextDecoder;n.push(p.decode(i))}else n.push(g(i));n.push("")}}return n.push(`--${o}--`),n.join(`\r
|
|
2
|
-
`)},"buildMimeMessage");export{H as z};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var w=Object.defineProperty;var b=(e,l)=>w(e,"name",{value:l,configurable:!0});import u from"./EmailError-zm2ffVav.js";import $ from"./RequiredOptionError-CevW3u2K.js";import{c as E}from"./create-logger-BiWdqFNg.js";import{s as A}from"./generate-message-id-D4uA8gkj.js";import{defineProvider as z}from"./defineProvider-CtLH0VBE.js";var P=Object.defineProperty,p=b((e,l)=>P(e,"name",{value:l,configurable:!0}),"v");const F=p(e=>typeof e=="function","isProviderFactory"),k=p(e=>e!==null&&typeof e=="object"&&"sendEmail"in e&&"initialize"in e&&"isAvailable"in e,"isProvider"),o="failover",C=z((e={})=>{if(!e.mailers||e.mailers.length===0)throw new $(o,"mailers");const l={debug:e.debug??!1,mailers:e.mailers,retryAfter:e.retryAfter??60};let h=!1;const t=[],n=E(o,e.logger);let g;const m=p(async()=>g||(g=(async()=>{t.length=0;for(const a of l.mailers)try{let r;if(F(a))r=a({});else if(k(a))r=a;else{n.debug(`Skipping invalid mailer: ${a}`);continue}try{await r.initialize(),t.push(r),n.debug(`Initialized provider: ${r.name??"unknown"}`)}catch(c){n.debug(`Failed to initialize provider ${r.name??"unknown"}:`,c)}}catch(r){n.debug("Error processing mailer:",r)}if(t.length===0)throw new u(o,"No providers could be initialized")})(),g),"initializeProviders");return{features:{attachments:!0,batchSending:!1,customHeaders:!0,html:!0,replyTo:!0,scheduling:!1,tagging:!1,templates:!1,tracking:!1},async initialize(){if(!h)try{await m(),h=!0,n.debug(`Failover provider initialized with ${t.length} provider(s)`)}catch(a){throw new u(o,`Failed to initialize: ${a.message}`,{cause:a})}},async isAvailable(){try{t.length===0&&await m();for(const a of t)try{if(await a.isAvailable())return!0}catch{}return!1}catch{return!1}},name:o,options:l,async sendEmail(a){try{if(t.length===0&&await m(),t.length===0)return{error:new u(o,"No providers available"),success:!1};const r=[];let c;for(let s=0;s<t.length;s+=1){const f=t[s];if(!f)continue;const d=f.name??`provider-${s+1}`;n.debug(`Attempting to send email via ${d} (${s+1}/${t.length})`);try{if(!await f.isAvailable()){n.debug(`Provider ${d} is not available, skipping`),r.push(new u(o,`Provider ${d} is not available`));continue}const i=await f.sendEmail(a);if(i.success&&i.data)return n.debug(`Email sent successfully via ${d}`),{data:{...i.data,messageId:i.data.messageId||A(),provider:`${o}(${d})`},success:!0};if(i.error){c=i.error,r.push(i.error);const v=i.error instanceof Error?i.error.message:String(i.error);n.debug(`Failed to send via ${d}:`,v)}}catch(i){c=i instanceof Error?i:new Error(String(i)),r.push(c);const v=c instanceof Error?c.message:String(c);n.debug(`Exception sending via ${d}:`,v)}s<t.length-1&&l.retryAfter>0&&(n.debug(`Waiting ${l.retryAfter}ms before trying next provider`),await new Promise(i=>{setTimeout(()=>{i()},l.retryAfter)}))}const y=r.map(s=>s instanceof Error?s.message:String(s)).join("; ");return{error:new u(o,`All providers failed. Errors: ${y}`,{cause:c}),success:!1}}catch(r){return{error:new u(o,`Failed to send email: ${r.message}`,{cause:r}),success:!1}}},async validateCredentials(){return this.isAvailable()}}});export{C as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var T=Object.defineProperty;var b=(r,n)=>T(r,"name",{value:n,configurable:!0});import{createRequire as P}from"node:module";import c from"./EmailError-zm2ffVav.js";import z from"./RequiredOptionError-CevW3u2K.js";import{s as E}from"./generate-message-id-D4uA8gkj.js";import{i as U}from"./headers-to-record-Qo124ImV.js";import{m as g}from"./make-request-CaT4d5oC.js";import{c as k,P as S,u as w,h as v}from"./provider-base-Cmzx6BTO.js";import{d as q}from"./validate-email-options-DPo3SgC0.js";import{defineProvider as K}from"./defineProvider-CtLH0VBE.js";import{l as y}from"./address-formatter-Cm_E_ZMa.js";const $=P(import.meta.url),d=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,j=b(r=>{if(typeof d<"u"&&d.versions&&d.versions.node){const[n,p]=d.versions.node.split(".").map(Number);if(n>22||n===22&&p>=3||n===20&&p>=16)return d.getBuiltinModule(r)}return $(r)},"__cjs_getBuiltinModule"),{Buffer:_}=j("node:buffer"),a="infobip",R="https://api.infobip.com",C=3e4,x=3,Q=K((r={})=>{if(!r.apiKey)throw new z(a,"apiKey");const n=r.baseUrl??R,p=r.endpoint??`${n}/email/3/send`,s={apiKey:r.apiKey,baseUrl:n,debug:r.debug??!1,endpoint:p,retries:r.retries??x,timeout:r.timeout??C,...r.logger&&{logger:r.logger}},f=new S,o=k(a,r.logger);return{features:{attachments:!0,batchSending:!0,customHeaders:!0,html:!0,replyTo:!0,scheduling:!0,tagging:!1,templates:!0,tracking:!0},async getEmail(e){try{if(!e)return{error:new c(a,"Email ID is required to retrieve email details"),success:!1};await f.ensureInitialized(()=>this.initialize(),a);const l={Authorization:`App ${s.apiKey}`,"Content-Type":"application/json"};o.debug("Retrieving email details",{id:e});const t=await w(async()=>g(`${s.baseUrl}/email/3/reports/${e}`,{headers:l,method:"GET",timeout:s.timeout}),s.retries);return t.success?(o.debug("Email details retrieved successfully"),{data:t.data?.body,success:!0}):(o.debug("API request failed when retrieving email",t.error),{error:new c(a,`Failed to retrieve email: ${t.error instanceof Error?t.error.message:"Unknown error"}`,{cause:t.error}),success:!1})}catch(l){return{error:v(a,"retrieve email",l,o),success:!1}}},async initialize(){await f.ensureInitialized(async()=>{if(!await this.isAvailable())throw new c(a,"Infobip API not available or invalid API key");o.debug("Provider initialized successfully")},a)},async isAvailable(){try{o.debug("Checking Infobip API availability");const e={Authorization:`App ${s.apiKey}`,"Content-Type":"application/json"};return(await g(`${s.baseUrl}/account/1/me`,{headers:e,method:"GET",timeout:s.timeout})).success}catch(e){return o.debug("Error checking availability:",e),!1}},name:a,options:s,async sendEmail(e){try{const l=q(e);if(l.length>0)return{error:new c(a,`Invalid email options: ${l.join(", ")}`),success:!1};await f.ensureInitialized(()=>this.initialize(),a);const t={from:typeof e.from=="string"?e.from:e.from.email,subject:e.subject,to:y(e.to)};if(e.html&&(t.html=e.html),e.text&&(t.text=e.text),e.cc&&(t.cc=y(e.cc)),e.bcc&&(t.bcc=y(e.bcc)),e.replyTo&&(t.replyTo=typeof e.replyTo=="string"?e.replyTo:e.replyTo.email),e.templateId&&(t.templateId=e.templateId,e.templateVariables&&(t.templateData=e.templateVariables)),e.trackingUrl&&(t.trackingUrl=e.trackingUrl),e.notifyUrl&&(t.notifyUrl=e.notifyUrl),e.intermediateReport!==void 0&&(t.intermediateReport=e.intermediateReport),e.sendAt&&(t.sendAt=e.sendAt),e.headers){const i=U(e.headers);t.headers=i}e.attachments&&e.attachments.length>0&&(t.attachments=await Promise.all(e.attachments.map(async i=>{let u;if(i.content)if(typeof i.content=="string")u=i.content;else if(i.content instanceof Promise){const A=await i.content;u=_.from(A).toString("base64")}else u=i.content.toString("base64");else if(i.raw)u=typeof i.raw=="string"?i.raw:i.raw.toString("base64");else throw new c(a,`Attachment ${i.filename} has no content`);return{content:u,contentType:i.contentType??"application/octet-stream",name:i.filename}}))),o.debug("Sending email via Infobip API",{subject:t.subject,to:t.to});const I={Authorization:`App ${s.apiKey}`,"Content-Type":"application/json"},m=await w(async()=>g(s.endpoint,{headers:I,method:"POST",timeout:s.timeout},JSON.stringify(t)),s.retries);if(!m.success)return o.debug("API request failed when sending email",m.error),{error:m.error??new c(a,"Failed to send email"),success:!1};const h=m.data?.body?.messages?.[0]?.messageId??E();return o.debug("Email sent successfully",{messageId:h}),{data:{messageId:h,provider:a,response:m.data,sent:!0,timestamp:new Date},success:!0}}catch(l){return{error:v(a,"send email",l,o),success:!1}}},async validateCredentials(){return this.isAvailable()}}});export{Q as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import c from"./EmailError-zm2ffVav.js";import P from"./RequiredOptionError-CevW3u2K.js";import{s as I}from"./generate-message-id-D4uA8gkj.js";import{i as T}from"./headers-to-record-Qo124ImV.js";import{m as d}from"./make-request-CaT4d5oC.js";import{c as A,P as k,u as g,h as f}from"./provider-base-Cmzx6BTO.js";import{a as $,s as z}from"./sanitize-header-wWav-Scu.js";import{d as E}from"./validate-email-options-DPo3SgC0.js";import{defineProvider as j}from"./defineProvider-CtLH0VBE.js";import{n as u,c as h}from"./address-formatter-Cm_E_ZMa.js";const r="mailpace",C="https://app.mailpace.com/api/v1",M=3e4,S=3,G=j((n={})=>{if(!n.apiToken)throw new P(r,"apiToken");const s={apiToken:n.apiToken,debug:n.debug??!1,endpoint:n.endpoint??C,retries:n.retries??S,timeout:n.timeout??M,...n.logger&&{logger:n.logger}},l=new k,i=A(r,n.logger);return{features:{attachments:!0,batchSending:!1,customHeaders:!0,html:!0,replyTo:!0,scheduling:!1,tagging:!0,templates:!0,tracking:!1},async getEmail(e){try{if(!e)return{error:new c(r,"Email ID is required to retrieve email details"),success:!1};await l.ensureInitialized(()=>this.initialize(),r);const a={Authorization:`Bearer ${s.apiToken}`,"Content-Type":"application/json"};i.debug("Retrieving email details",{id:e});const t=await g(async()=>d(`${s.endpoint}/emails/${e}`,{headers:a,method:"GET",timeout:s.timeout}),s.retries);return t.success?(i.debug("Email details retrieved successfully"),{data:t.data?.body,success:!0}):(i.debug("API request failed when retrieving email",t.error),{error:new c(r,`Failed to retrieve email: ${t.error instanceof Error?t.error.message:"Unknown error"}`,{cause:t.error}),success:!1})}catch(a){return{error:f(r,"retrieve email",a,i),success:!1}}},async initialize(){await l.ensureInitialized(async()=>{if(!await this.isAvailable())throw new c(r,"MailPace API not available or invalid API token");i.debug("Provider initialized successfully")},r)},async isAvailable(){try{const e={Authorization:`Bearer ${s.apiToken}`,"Content-Type":"application/json"};i.debug("Checking MailPace API availability");const a=await d(`${s.endpoint}/account`,{headers:e,method:"GET",timeout:s.timeout});return i.debug("MailPace API availability check response:",{error:a.error instanceof Error?a.error.message:void 0,statusCode:a.data?.statusCode,success:a.success}),!!(a.success&&a.data&&typeof a.data=="object"&&"statusCode"in a.data&&typeof a.data.statusCode=="number"&&a.data.statusCode>=200&&a.data.statusCode<300)}catch(e){return i.debug("Error checking availability:",e),!1}},name:r,options:s,async sendEmail(e){try{const a=E(e);if(a.length>0)return{error:new c(r,`Invalid email options: ${a.join(", ")}`),success:!1};await l.ensureInitialized(()=>this.initialize(),r);const t={from:h(e.from),subject:e.subject,to:u(e.to)};if(e.html&&(t.htmlbody=e.html),e.text&&(t.textbody=e.text),e.cc&&(t.cc=u(e.cc)),e.bcc&&(t.bcc=u(e.bcc)),e.replyTo&&(t.replyto=h(e.replyTo)),e.templateId&&(t.template_id=e.templateId,e.templateVariables&&(t.template_variables=e.templateVariables)),e.tags&&e.tags.length>0&&(t.tags=e.tags),e.listUnsubscribe&&(t.list_unsubscribe=e.listUnsubscribe),e.headers){const y=T(e.headers),p={};Object.entries(y).forEach(([v,w])=>{p[$(v)]=z(w)}),t.headers=p}e.attachments&&e.attachments.length>0&&(t.attachments=e.attachments),i.debug("Sending email via MailPace API",{subject:t.subject,to:t.to});const b={Authorization:`Bearer ${s.apiToken}`,"Content-Type":"application/json"},o=await g(async()=>d(`${s.endpoint}/send`,{headers:b,method:"POST",timeout:s.timeout},JSON.stringify(t)),s.retries);if(!o.success)return i.debug("API request failed when sending email",o.error),{error:o.error??new c(r,"Failed to send email"),success:!1};const m=o.data?.body?.id??I();return i.debug("Email sent successfully",{messageId:m}),{data:{messageId:m,provider:r,response:o.data,sent:!0,timestamp:new Date},success:!0}}catch(a){return{error:f(r,"send email",a,i),success:!1}}},async validateCredentials(){return this.isAvailable()}}});export{G as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var T=Object.defineProperty;var h=(o,a)=>T(o,"name",{value:a,configurable:!0});import{createRequire as A}from"node:module";import l from"./EmailError-zm2ffVav.js";import k from"./RequiredOptionError-CevW3u2K.js";import{s as z}from"./generate-message-id-D4uA8gkj.js";import{i as j}from"./headers-to-record-Qo124ImV.js";import{m as p}from"./make-request-CaT4d5oC.js";import{c as S,P as $,u as b,h as y}from"./provider-base-Cmzx6BTO.js";import{d as C}from"./validate-email-options-DPo3SgC0.js";import{defineProvider as E}from"./defineProvider-CtLH0VBE.js";import{f,a as q}from"./address-formatter-Cm_E_ZMa.js";const I=A(import.meta.url),m=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,P=h(o=>{if(typeof m<"u"&&m.versions&&m.versions.node){const[a,c]=m.versions.node.split(".").map(Number);if(a>22||a===22&&c>=3||a===20&&c>=16)return m.getBuiltinModule(o)}return I(o)},"__cjs_getBuiltinModule"),{Buffer:_}=P("node:buffer"),s="mailersend",M="https://api.mailersend.com",B=3e4,R=3,K=E((o={})=>{if(!o.apiToken)throw new k(s,"apiToken");const a={apiToken:o.apiToken,debug:o.debug??!1,endpoint:o.endpoint??M,retries:o.retries??R,timeout:o.timeout??B,...o.logger&&{logger:o.logger}},c=new $,n=S(s,o.logger);return{features:{attachments:!0,batchSending:!0,customHeaders:!0,html:!0,replyTo:!0,scheduling:!0,tagging:!0,templates:!0,tracking:!0},async getEmail(e){try{if(!e)return{error:new l(s,"Email ID is required to retrieve email details"),success:!1};await c.ensureInitialized(()=>this.initialize(),s);const r={Authorization:`Bearer ${a.apiToken}`,"Content-Type":"application/json"};n.debug("Retrieving email details",{id:e});const t=await b(async()=>p(`${a.endpoint}/v1/activity/${e}`,{headers:r,method:"GET",timeout:a.timeout}),a.retries);return t.success?(n.debug("Email details retrieved successfully"),{data:t.data?.body,success:!0}):(n.debug("API request failed when retrieving email",t.error),{error:new l(s,`Failed to retrieve email: ${t.error instanceof Error?t.error.message:"Unknown error"}`,{cause:t.error}),success:!1})}catch(r){return{error:y(s,"retrieve email",r,n),success:!1}}},async initialize(){await c.ensureInitialized(async()=>{if(!await this.isAvailable())throw new l(s,"MailerSend API not available or invalid API token");n.debug("Provider initialized successfully")},s)},async isAvailable(){try{const e={Authorization:`Bearer ${a.apiToken}`,"Content-Type":"application/json"};n.debug("Checking MailerSend API availability");const r=await p(`${a.endpoint}/v1/tokens/verify`,{headers:e,method:"GET",timeout:a.timeout});return n.debug("MailerSend API availability check response:",{error:r.error instanceof Error?r.error.message:void 0,statusCode:r.data?.statusCode,success:r.success}),!!(r.success&&r.data&&typeof r.data=="object"&&"statusCode"in r.data&&typeof r.data.statusCode=="number"&&r.data.statusCode>=200&&r.data.statusCode<300)}catch(e){return n.debug("Error checking availability:",e),!1}},name:s,options:a,async sendEmail(e){try{const r=C(e);if(r.length>0)return{error:new l(s,`Invalid email options: ${r.join(", ")}`),success:!1};await c.ensureInitialized(()=>this.initialize(),s);const t={from:{email:e.from.email,name:e.from.name},subject:e.subject,to:f(e.to)};if(e.html&&(t.html=e.html),e.text&&(t.text=e.text),e.cc&&(t.cc=f(e.cc)),e.bcc&&(t.bcc=f(e.bcc)),e.replyTo&&(t.reply_to=q(e.replyTo)),e.templateId&&(t.template_id=e.templateId,e.templateVariables&&(t.variables=e.templateVariables)),e.personalization&&e.personalization.length>0&&(t.personalization=e.personalization),e.tags&&e.tags.length>0&&(t.tags=e.tags),e.scheduledAt&&(t.send_at=e.scheduledAt),e.domainId&&(t.domain_id=e.domainId),e.headers){const i=j(e.headers);t.headers=i}e.attachments&&e.attachments.length>0&&(t.attachments=await Promise.all(e.attachments.map(async i=>{let u;if(i.content)if(typeof i.content=="string")u=i.content;else if(i.content instanceof Promise){const w=await i.content;u=_.from(w).toString("base64")}else u=i.content.toString("base64");else if(i.raw)u=typeof i.raw=="string"?i.raw:i.raw.toString("base64");else throw new l(s,`Attachment ${i.filename} has no content`);return{content:u,filename:i.filename,...i.contentType&&{type:i.contentType},...i.cid&&{id:i.cid}}}))),n.debug("Sending email via MailerSend API",{subject:t.subject,to:t.to});const v={Authorization:`Bearer ${a.apiToken}`,"Content-Type":"application/json"},d=await b(async()=>p(`${a.endpoint}/v1/email`,{headers:v,method:"POST",timeout:a.timeout},JSON.stringify(t)),a.retries);if(!d.success)return n.debug("API request failed when sending email",d.error),{error:d.error??new l(s,"Failed to send email"),success:!1};const g=d.data?.body?.message_id??z();return n.debug("Email sent successfully",{messageId:g}),{data:{messageId:g,provider:s,response:d.data,sent:!0,timestamp:new Date},success:!0}}catch(r){return{error:y(s,"send email",r,n),success:!1}}},async validateCredentials(){return this.isAvailable()}}});export{K as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var A=Object.defineProperty;var y=(i,r)=>A(i,"name",{value:r,configurable:!0});import{createRequire as P}from"node:module";import m from"./EmailError-zm2ffVav.js";import T from"./RequiredOptionError-CevW3u2K.js";import{s as R}from"./generate-message-id-D4uA8gkj.js";import{i as S}from"./headers-to-record-Qo124ImV.js";import{m as h}from"./make-request-CaT4d5oC.js";import{c as _,P as z,u as j,h as I}from"./provider-base-Cmzx6BTO.js";import{d as E}from"./validate-email-options-DPo3SgC0.js";import{defineProvider as q}from"./defineProvider-CtLH0VBE.js";import{b as v,c as k}from"./address-formatter-Cm_E_ZMa.js";import{a as U}from"./attachment-processor-DsmIomKc.js";const C=P(import.meta.url),u=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,$=y(i=>{if(typeof u<"u"&&u.versions&&u.versions.node){const[r,n]=u.versions.node.split(".").map(Number);if(r>22||r===22&&n>=3||r===20&&n>=16)return u.getBuiltinModule(i)}return C(i)},"__cjs_getBuiltinModule"),{Buffer:b}=$("node:buffer");var M=Object.defineProperty,K=y((i,r)=>M(i,"name",{value:r,configurable:!0}),"T");const s="mailgun",B="https://api.mailgun.net",O=3e4,x=3,D=K(i=>{const r=[];for(const[n,o]of Object.entries(i))if(o!=null)if(Array.isArray(o))for(const e of o)r.push(`${encodeURIComponent(n)}=${encodeURIComponent(String(e))}`);else typeof o=="object"?r.push(`${encodeURIComponent(n)}=${encodeURIComponent(JSON.stringify(o))}`):r.push(`${encodeURIComponent(n)}=${encodeURIComponent(String(o))}`);return r.join("&")},"objectToFormData"),ee=q((i={})=>{if(!i.apiKey)throw new T(s,"apiKey");if(!i.domain)throw new T(s,"domain");const r={apiKey:i.apiKey,debug:i.debug??!1,domain:i.domain,endpoint:i.endpoint??B,retries:i.retries??x,timeout:i.timeout??O,...i.logger&&{logger:i.logger}},n=new z,o=_(s,i.logger);return{endpoint:r.endpoint,features:{attachments:!0,batchSending:!0,customHeaders:!0,html:!0,replyTo:!0,scheduling:!0,tagging:!0,templates:!0,tracking:!0},async getEmail(e){try{if(!e)return{error:new m(s,"Email ID is required to retrieve email details"),success:!1};await n.ensureInitialized(()=>this.initialize(),s);const a={Authorization:`Basic ${b.from(`api:${r.apiKey}`).toString("base64")}`,"Content-Type":"application/json"};o.debug("Retrieving email details",{id:e});const t=await j(async()=>h(`${r.endpoint}/v3/${r.domain}/events?message-id=${encodeURIComponent(e)}&limit=1`,{headers:a,method:"GET",timeout:r.timeout}),r.retries);if(!t.success)return o.debug("API request failed when retrieving email",t.error),{error:new m(s,`Failed to retrieve email: ${t.error instanceof Error?t.error.message:"Unknown error"}`,{cause:t.error}),success:!1};o.debug("Email details retrieved successfully");const p=t.data?.items??[],g=p.length>0?p[0]:void 0;return{data:g?.message?.headers??g?.storage??void 0,success:!0}}catch(a){return{error:I(s,"retrieve email",a,o),success:!1}}},async initialize(){await n.ensureInitialized(async()=>{if(!await this.isAvailable())throw new m(s,"Mailgun API not available or invalid API key/domain");o.debug("Provider initialized successfully")},s)},async isAvailable(){try{const e={Authorization:`Basic ${b.from(`api:${r.apiKey}`).toString("base64")}`,"Content-Type":"application/json"};o.debug("Checking Mailgun API availability");const a=await h(`${r.endpoint}/v3/domains/${r.domain}`,{headers:e,method:"GET",timeout:r.timeout});if(o.debug("Mailgun API availability check response:",{error:a.error instanceof Error?a.error.message:void 0,statusCode:a.data?.statusCode,success:a.success}),!a.success||!a.data||typeof a.data!="object")return!1;const{statusCode:t}=a.data;return typeof t=="number"&&t>=200&&t<300}catch(e){return o.debug("Error checking availability:",e),!1}},name:s,options:r,async sendEmail(e){try{const a=E(e);if(a.length>0)return{error:new m(s,`Invalid email options: ${a.join(", ")}`),success:!1};await n.ensureInitialized(()=>this.initialize(),s);const t={from:k(e.from),to:v(e.to).join(",")};if(e.subject&&(t.subject=e.subject),e.cc&&(t.cc=v(e.cc).join(",")),e.bcc&&(t.bcc=v(e.bcc).join(",")),e.replyTo&&(t["h:Reply-To"]=k(e.replyTo)),e.html&&(t.html=e.html),e.text&&(t.text=e.text),e.template&&(t.template=e.template,e.templateVariables))for(const[d,c]of Object.entries(e.templateVariables))t[`v:${d}`]=c;if(e.tags&&e.tags.length>0&&(t["o:tag"]=e.tags),e.campaignId&&(t["o:campaign"]=e.campaignId),e.deliveryTime&&(t["o:deliverytime"]=typeof e.deliveryTime=="number"?new Date(e.deliveryTime*1e3).toUTCString():e.deliveryTime),e.clickTracking!==void 0&&(t["o:clicktracking"]=e.clickTracking?"yes":"no"),e.openTracking!==void 0&&(t["o:tracking"]=e.openTracking?"yes":"no"),e.unsubscribeTracking!==void 0&&(t["o:tracking-clicks"]=e.unsubscribeTracking?"yes":"no"),e.testMode&&(t["o:testmode"]="yes"),e.requireTls&&(t["o:require-tls"]="yes"),e.skipVerification&&(t["o:skip-verification"]="yes"),e.headers){const d=S(e.headers);for(const[c,f]of Object.entries(d))t[`h:${c}`]=f}if(e.attachments&&e.attachments.length>0){const d=await Promise.all(e.attachments.map((c,f)=>U(c,s,f)));for(const c of d)t[c.key]=c.content}o.debug("Sending email via Mailgun API",{subject:t.subject,to:t.to});const p={Authorization:`Basic ${b.from(`api:${r.apiKey}`).toString("base64")}`,"Content-Type":"application/x-www-form-urlencoded"},g=D(t),l=await j(async()=>h(`${r.endpoint}/v3/${r.domain}/messages`,{headers:p,method:"POST",timeout:r.timeout},g),r.retries);if(!l.success)return o.debug("API request failed when sending email",l.error),{error:l.error??new m(s,"Failed to send email"),success:!1};const w=l.data?.body?.id??R();return o.debug("Email sent successfully",{messageId:w}),{data:{messageId:w,provider:s,response:l.data,sent:!0,timestamp:new Date},success:!0}}catch(a){return{error:I(s,"send email",a,o),success:!1}}},async validateCredentials(){return this.isAvailable()}}});export{ee as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var P=Object.defineProperty;var b=(s,a)=>P(s,"name",{value:a,configurable:!0});import{createRequire as $}from"node:module";import d from"./EmailError-zm2ffVav.js";import v from"./RequiredOptionError-CevW3u2K.js";import{s as M}from"./generate-message-id-D4uA8gkj.js";import{i as _}from"./headers-to-record-Qo124ImV.js";import{m as f}from"./make-request-CaT4d5oC.js";import{c as z,P as D,u as w,h as T}from"./provider-base-Cmzx6BTO.js";import{d as B}from"./validate-email-options-DPo3SgC0.js";import{defineProvider as R}from"./defineProvider-CtLH0VBE.js";import{d as y,e as S}from"./address-formatter-Cm_E_ZMa.js";const A=$(import.meta.url),m=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,E=b(s=>{if(typeof m<"u"&&m.versions&&m.versions.node){const[a,l]=m.versions.node.split(".").map(Number);if(a>22||a===22&&l>=3||a===20&&l>=16)return m.getBuiltinModule(s)}return A(s)},"__cjs_getBuiltinModule"),{Buffer:p}=E("node:buffer"),n="mailjet",k="https://api.mailjet.com",q=3e4,K=3,W=R((s={})=>{if(!s.apiKey)throw new v(n,"apiKey");if(!s.apiSecret)throw new v(n,"apiSecret");const a={apiKey:s.apiKey,apiSecret:s.apiSecret,debug:s.debug??!1,endpoint:s.endpoint??k,retries:s.retries??K,timeout:s.timeout??q,...s.logger&&{logger:s.logger}},l=new D,o=z(n,s.logger);return{endpoint:a.endpoint,features:{attachments:!0,batchSending:!0,customHeaders:!0,html:!0,replyTo:!0,scheduling:!0,tagging:!0,templates:!0,tracking:!0},async getEmail(e){try{if(!e)return{error:new d(n,"Email ID is required to retrieve email details"),success:!1};await l.ensureInitialized(()=>this.initialize(),n);const i={Authorization:`Basic ${p.from(`${a.apiKey}:${a.apiSecret}`).toString("base64")}`,"Content-Type":"application/json"};o.debug("Retrieving email details",{id:e});const t=await w(async()=>f(`${a.endpoint}/v3.1/REST/message/${e}`,{headers:i,method:"GET",timeout:a.timeout}),a.retries);return t.success?(o.debug("Email details retrieved successfully"),{data:t.data?.body,success:!0}):(o.debug("API request failed when retrieving email",t.error),{error:new d(n,`Failed to retrieve email: ${t.error instanceof Error?t.error.message:"Unknown error"}`,{cause:t.error}),success:!1})}catch(i){return{error:T(n,"retrieve email",i,o),success:!1}}},async initialize(){await l.ensureInitialized(async()=>{if(!await this.isAvailable())throw new d(n,"Mailjet API not available or invalid API credentials");o.debug("Provider initialized successfully")},n)},async isAvailable(){try{const e={Authorization:`Basic ${p.from(`${a.apiKey}:${a.apiSecret}`).toString("base64")}`,"Content-Type":"application/json"};o.debug("Checking Mailjet API availability");const i=await f(`${a.endpoint}/v3.1/REST/user`,{headers:e,method:"GET",timeout:a.timeout});return o.debug("Mailjet API availability check response:",{error:i.error instanceof Error?i.error.message:void 0,statusCode:i.data?.statusCode,success:i.success}),!!(i.success&&i.data&&typeof i.data=="object"&&"statusCode"in i.data&&typeof i.data.statusCode=="number"&&i.data.statusCode>=200&&i.data.statusCode<300)}catch(e){return o.debug("Error checking availability:",e),!1}},name:n,options:a,async sendEmail(e){try{const i=B(e);if(i.length>0)return{error:new d(n,`Invalid email options: ${i.join(", ")}`),success:!1};await l.ensureInitialized(()=>this.initialize(),n);const t={From:S(e.from),Subject:e.subject,To:y(e.to)};if(e.html&&(t.HTMLPart=e.html),e.text&&(t.TextPart=e.text),e.cc&&(t.Cc=y(e.cc)),e.bcc&&(t.Bcc=y(e.bcc)),e.replyTo&&(t.ReplyTo=S(e.replyTo)),e.templateId&&(t.TemplateID=e.templateId,t.TemplateLanguage=e.templateLanguage??!0,e.templateVariables&&(t.Variables=e.templateVariables)),e.customId&&(t.CustomID=e.customId),e.eventPayload&&(t.EventPayload=e.eventPayload),e.campaign&&(t.Campaign=e.campaign),e.deduplicateCampaign!==void 0&&(t.DeduplicateCampaign=e.deduplicateCampaign),e.deliveryTime&&(t.Deliverytime=new Date(e.deliveryTime*1e3).toISOString()),e.priority!==void 0&&(t.Priority=e.priority),e.urlTags&&(t.URLTags=e.urlTags),e.tags&&e.tags.length>0&&(t.CustomCampaign=e.tags.join(",")),e.headers){const r=_(e.headers),c=[];for(const[g,I]of Object.entries(r))c.push({Name:g,Value:String(I)});c.length>0&&(t.Headers=c)}e.attachments&&e.attachments.length>0&&(t.Attachments=await Promise.all(e.attachments.map(async r=>{let c;if(r.content)if(typeof r.content=="string")c=r.content;else if(r.content instanceof Promise){const g=await r.content;c=p.from(g).toString("base64")}else c=r.content.toString("base64");else if(r.raw)c=typeof r.raw=="string"?r.raw:r.raw.toString("base64");else throw new d(n,`Attachment ${r.filename} has no content`);return{Base64Content:c,ContentType:r.contentType??"application/octet-stream",Filename:r.filename,...r.cid&&{ContentID:r.cid}}})));const j={Messages:[t]};o.debug("Sending email via Mailjet API",{subject:t.Subject,to:t.To});const C={Authorization:`Basic ${p.from(`${a.apiKey}:${a.apiSecret}`).toString("base64")}`,"Content-Type":"application/json"},u=await w(async()=>f(`${a.endpoint}/v3.1/send`,{headers:C,method:"POST",timeout:a.timeout},JSON.stringify(j)),a.retries);if(!u.success)return o.debug("API request failed when sending email",u.error),{error:u.error??new d(n,"Failed to send email"),success:!1};const h=u.data?.body?.Messages?.[0]?.To?.[0]?.MessageID?.toString()??M();return o.debug("Email sent successfully",{messageId:h}),{data:{messageId:h,provider:n,response:u.data,sent:!0,timestamp:new Date},success:!0}}catch(i){return{error:T(n,"send email",i,o),success:!1}}},async validateCredentials(){return this.isAvailable()}}});export{W as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var P=Object.defineProperty;var h=(s,a)=>P(s,"name",{value:a,configurable:!0});import{createRequire as A}from"node:module";import c from"./EmailError-zm2ffVav.js";import S from"./RequiredOptionError-CevW3u2K.js";import{s as E}from"./generate-message-id-D4uA8gkj.js";import{i as K}from"./headers-to-record-Qo124ImV.js";import{m as y}from"./make-request-CaT4d5oC.js";import{c as k,P as q,u as b,h as w}from"./provider-base-Cmzx6BTO.js";import{d as z}from"./validate-email-options-DPo3SgC0.js";import{defineProvider as C}from"./defineProvider-CtLH0VBE.js";import{f,a as M}from"./address-formatter-Cm_E_ZMa.js";const j=A(import.meta.url),u=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,T=h(s=>{if(typeof u<"u"&&u.versions&&u.versions.node){const[a,l]=u.versions.node.split(".").map(Number);if(a>22||a===22&&l>=3||a===20&&l>=16)return u.getBuiltinModule(s)}return j(s)},"__cjs_getBuiltinModule"),{Buffer:_}=T("node:buffer"),i="mailomat",x="https://api.mailomat.com",R=3e4,B=3,$=C((s={})=>{if(!s.apiKey)throw new S(i,"apiKey");const a={apiKey:s.apiKey,debug:s.debug??!1,endpoint:s.endpoint??x,retries:s.retries??B,timeout:s.timeout??R,...s.logger&&{logger:s.logger}},l=new q,n=k(i,s.logger);return{features:{attachments:!0,batchSending:!0,customHeaders:!0,html:!0,replyTo:!0,scheduling:!1,tagging:!0,templates:!0,tracking:!0},async getEmail(e){try{if(!e)return{error:new c(i,"Email ID is required to retrieve email details"),success:!1};await l.ensureInitialized(()=>this.initialize(),i);const o={"Content-Type":"application/json","X-API-Key":a.apiKey};n.debug("Retrieving email details",{id:e});const t=await b(async()=>y(`${a.endpoint}/emails/${e}`,{headers:o,method:"GET",timeout:a.timeout}),a.retries);return t.success?(n.debug("Email details retrieved successfully"),{data:t.data?.body,success:!0}):(n.debug("API request failed when retrieving email",t.error),{error:new c(i,`Failed to retrieve email: ${t.error instanceof Error?t.error.message:"Unknown error"}`,{cause:t.error}),success:!1})}catch(o){return{error:w(i,"retrieve email",o,n),success:!1}}},async initialize(){await l.ensureInitialized(async()=>{if(!await this.isAvailable())throw new c(i,"Mailomat API not available or invalid API key");n.debug("Provider initialized successfully")},i)},async isAvailable(){try{return n.debug("Checking Mailomat API availability"),!0}catch(e){return n.debug("Error checking availability:",e),!1}},name:i,options:a,async sendEmail(e){try{const o=z(e);if(o.length>0)return{error:new c(i,`Invalid email options: ${o.join(", ")}`),success:!1};await l.ensureInitialized(()=>this.initialize(),i);const t={from:{email:e.from.email,name:e.from.name},subject:e.subject,to:f(e.to)};if(e.html&&(t.html=e.html),e.text&&(t.text=e.text),e.cc&&(t.cc=f(e.cc)),e.bcc&&(t.bcc=f(e.bcc)),e.replyTo&&(t.replyTo=M(e.replyTo)),e.templateId&&(t.templateId=e.templateId,e.templateVariables&&(t.templateVariables=e.templateVariables)),e.tags&&e.tags.length>0&&(t.tags=e.tags),e.headers){const r=K(e.headers);t.headers=r}e.attachments&&e.attachments.length>0&&(t.attachments=await Promise.all(e.attachments.map(async r=>{let d;if(r.content)if(typeof r.content=="string")d=r.content;else if(r.content instanceof Promise){const I=await r.content;d=_.from(I).toString("base64")}else d=r.content.toString("base64");else if(r.raw)d=typeof r.raw=="string"?r.raw:r.raw.toString("base64");else throw new c(i,`Attachment ${r.filename} has no content`);return{content:d,contentType:r.contentType??"application/octet-stream",filename:r.filename,...r.cid&&{cid:r.cid}}}))),n.debug("Sending email via Mailomat API",{subject:t.subject,to:t.to});const v={"Content-Type":"application/json","X-API-Key":a.apiKey},m=await b(async()=>y(`${a.endpoint}/send`,{headers:v,method:"POST",timeout:a.timeout},JSON.stringify(t)),a.retries);if(!m.success)return n.debug("API request failed when sending email",m.error),{error:m.error??new c(i,"Failed to send email"),success:!1};const p=m.data?.body,g=p?.messageId??p?.id??E();return n.debug("Email sent successfully",{messageId:g}),{data:{messageId:g,provider:i,response:m.data,sent:!0,timestamp:new Date},success:!0}}catch(o){return{error:w(i,"send email",o,n),success:!1}}},async validateCredentials(){return this.isAvailable()}}});export{$ as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var T=Object.defineProperty;var b=(o,a)=>T(o,"name",{value:a,configurable:!0});import{createRequire as _}from"node:module";import l from"./EmailError-zm2ffVav.js";import I from"./RequiredOptionError-CevW3u2K.js";import{s as j}from"./generate-message-id-D4uA8gkj.js";import{i as C}from"./headers-to-record-Qo124ImV.js";import{m as p}from"./make-request-CaT4d5oC.js";import{c as E,P as S,u as h,h as y}from"./provider-base-Cmzx6BTO.js";import{d as $}from"./validate-email-options-DPo3SgC0.js";import{defineProvider as q}from"./defineProvider-CtLH0VBE.js";import{f,a as z}from"./address-formatter-Cm_E_ZMa.js";const k=_(import.meta.url),m=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,P=b(o=>{if(typeof m<"u"&&m.versions&&m.versions.node){const[a,c]=m.versions.node.split(".").map(Number);if(a>22||a===22&&c>=3||a===20&&c>=16)return m.getBuiltinModule(o)}return k(o)},"__cjs_getBuiltinModule"),{Buffer:A}=P("node:buffer"),i="mailtrap",M="https://send.api.mailtrap.io",x=3e4,G=3,K=q((o={})=>{if(!o.apiToken)throw new I(i,"apiToken");const a={apiToken:o.apiToken,debug:o.debug??!1,endpoint:o.endpoint??M,retries:o.retries??G,timeout:o.timeout??x,...o.logger&&{logger:o.logger}},c=new S,n=E(i,o.logger);return{features:{attachments:!0,batchSending:!0,customHeaders:!0,html:!0,replyTo:!0,scheduling:!1,tagging:!0,templates:!0,tracking:!0},async getEmail(e){try{if(!e)return{error:new l(i,"Email ID is required to retrieve email details"),success:!1};await c.ensureInitialized(()=>this.initialize(),i);const r={"Api-Token":a.apiToken,"Content-Type":"application/json"};n.debug("Retrieving email details",{id:e});const t=await h(async()=>p(`${a.endpoint}/api/send/${e}`,{headers:r,method:"GET",timeout:a.timeout}),a.retries);return t.success?(n.debug("Email details retrieved successfully"),{data:t.data?.body,success:!0}):(n.debug("API request failed when retrieving email",t.error),{error:new l(i,`Failed to retrieve email: ${t.error instanceof Error?t.error.message:"Unknown error"}`,{cause:t.error}),success:!1})}catch(r){return{error:y(i,"retrieve email",r,n),success:!1}}},async initialize(){await c.ensureInitialized(async()=>{if(!await this.isAvailable())throw new l(i,"Mailtrap API not available or invalid API token");n.debug("Provider initialized successfully")},i)},async isAvailable(){try{const e={"Api-Token":a.apiToken,"Content-Type":"application/json"};n.debug("Checking Mailtrap API availability");const r=await p(`${a.endpoint}/api/account`,{headers:e,method:"GET",timeout:a.timeout});return n.debug("Mailtrap API availability check response:",{error:r.error instanceof Error?r.error.message:void 0,statusCode:r.data?.statusCode,success:r.success}),!!(r.success&&r.data&&typeof r.data=="object"&&"statusCode"in r.data&&typeof r.data.statusCode=="number"&&r.data.statusCode>=200&&r.data.statusCode<300)}catch(e){return n.debug("Error checking availability:",e),!1}},name:i,options:a,async sendEmail(e){try{const r=$(e);if(r.length>0)return{error:new l(i,`Invalid email options: ${r.join(", ")}`),success:!1};await c.ensureInitialized(()=>this.initialize(),i);const t={from:{email:e.from.email,name:e.from.name},subject:e.subject,to:f(e.to)};if(e.html&&(t.html=e.html),e.text&&(t.text=e.text),e.cc&&(t.cc=f(e.cc)),e.bcc&&(t.bcc=f(e.bcc)),e.replyTo&&(t.reply_to=z(e.replyTo)),e.templateUuid&&(t.template_uuid=e.templateUuid,e.templateVariables&&(t.template_variables=e.templateVariables)),e.category&&(t.category=e.category),e.customVariables&&(t.custom_variables=e.customVariables),e.tags&&e.tags.length>0&&(t.tags=e.tags),e.headers){const s=C(e.headers);t.headers=s}e.attachments&&e.attachments.length>0&&(t.attachments=await Promise.all(e.attachments.map(async s=>{let u;if(s.content)if(typeof s.content=="string")u=s.content;else if(s.content instanceof Promise){const w=await s.content;u=A.from(w).toString("base64")}else u=s.content.toString("base64");else if(s.raw)u=typeof s.raw=="string"?s.raw:s.raw.toString("base64");else throw new l(i,`Attachment ${s.filename} has no content`);return{content:u,filename:s.filename,type:s.contentType??"application/octet-stream",...s.cid&&{cid:s.cid}}}))),n.debug("Sending email via Mailtrap API",{subject:t.subject,to:t.to});const v={"Api-Token":a.apiToken,"Content-Type":"application/json"},d=await h(async()=>p(`${a.endpoint}/api/send`,{headers:v,method:"POST",timeout:a.timeout},JSON.stringify(t)),a.retries);if(!d.success)return n.debug("API request failed when sending email",d.error),{error:d.error??new l(i,"Failed to send email"),success:!1};const g=d.data?.body?.message_ids?.[0]??j();return n.debug("Email sent successfully",{messageId:g}),{data:{messageId:g,provider:i,response:d.data,sent:!0,timestamp:new Date},success:!0}}catch(r){return{error:y(i,"send email",r,n),success:!1}}},async validateCredentials(){return this.isAvailable()}}});export{K as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var A=Object.defineProperty;var h=(i,s)=>A(i,"name",{value:s,configurable:!0});import{createRequire as T}from"node:module";import d from"./EmailError-zm2ffVav.js";import k from"./RequiredOptionError-CevW3u2K.js";import{s as z}from"./generate-message-id-D4uA8gkj.js";import{i as E}from"./headers-to-record-Qo124ImV.js";import{m as f}from"./make-request-CaT4d5oC.js";import{c as M,P as q,u as v,h as w}from"./provider-base-Cmzx6BTO.js";import{s as _,a as K}from"./sanitize-header-wWav-Scu.js";import{d as N}from"./validate-email-options-DPo3SgC0.js";import{defineProvider as O}from"./defineProvider-CtLH0VBE.js";import{g as y}from"./address-formatter-Cm_E_ZMa.js";const C=T(import.meta.url),g=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,I=h(i=>{if(typeof g<"u"&&g.versions&&g.versions.node){const[s,m]=g.versions.node.split(".").map(Number);if(s>22||s===22&&m>=3||s===20&&m>=16)return g.getBuiltinModule(i)}return C(i)},"__cjs_getBuiltinModule"),{Buffer:S}=I("node:buffer"),r="mandrill",V="https://mandrillapp.com/api/1.0",D=3e4,R=3,Y=O((i={})=>{if(!i.apiKey)throw new k(r,"apiKey");const s={apiKey:i.apiKey,debug:i.debug??!1,endpoint:i.endpoint??V,retries:i.retries??R,timeout:i.timeout??D,...i.logger&&{logger:i.logger}},m=new q,n=M(r,i.logger);return{features:{attachments:!0,batchSending:!0,customHeaders:!0,html:!0,replyTo:!0,scheduling:!0,tagging:!0,templates:!0,tracking:!0},async getEmail(e){try{if(!e)return{error:new d(r,"Email ID is required to retrieve email details"),success:!1};await m.ensureInitialized(()=>this.initialize(),r),n.debug("Retrieving email details",{id:e});const l={id:e,key:s.apiKey},t={"Content-Type":"application/json"},o=await v(async()=>f(`${s.endpoint}/messages/info.json`,{headers:t,method:"POST",timeout:s.timeout},JSON.stringify(l)),s.retries);return o.success?(n.debug("Email details retrieved successfully"),{data:o.data?.body,success:!0}):(n.debug("API request failed when retrieving email",o.error),{error:new d(r,`Failed to retrieve email: ${o.error instanceof Error?o.error.message:"Unknown error"}`,{cause:o.error}),success:!1})}catch(l){return{error:w(r,"retrieve email",l,n),success:!1}}},async initialize(){await m.ensureInitialized(async()=>{if(!await this.isAvailable())throw new d(r,"Mandrill API not available or invalid API key");n.debug("Provider initialized successfully")},r)},async isAvailable(){try{n.debug("Checking Mandrill API availability");const e={key:s.apiKey},l={"Content-Type":"application/json"},t=await f(`${s.endpoint}/users/info.json`,{headers:l,method:"POST",timeout:s.timeout},JSON.stringify(e));return n.debug("Mandrill API availability check response:",{error:t.error instanceof Error?t.error.message:void 0,statusCode:t.data?.statusCode,success:t.success}),!!(t.success&&t.data&&typeof t.data=="object"&&"statusCode"in t.data&&typeof t.data.statusCode=="number"&&t.data.statusCode>=200&&t.data.statusCode<300)}catch(e){return n.debug("Error checking availability:",e),!1}},name:r,options:s,async sendEmail(e){try{const l=N(e);if(l.length>0)return{error:new d(r,`Invalid email options: ${l.join(", ")}`),success:!1};await m.ensureInitialized(()=>this.initialize(),r);const t={from_email:e.from.email,html:e.html??"",subject:e.subject,text:e.text??"",...e.from.name&&{from_name:e.from.name},to:y(e.to,"to")};if(e.cc){const a=y(e.cc,"cc");for(const c of a)c.type="cc";t.to=[...t.to,...a]}if(e.bcc){const a=y(e.bcc,"bcc");for(const c of a)c.type="bcc";t.to=[...t.to,...a]}if(e.replyTo){const a=e.replyTo.name?`${_(e.replyTo.name)} <${e.replyTo.email}>`:e.replyTo.email;t.headers={"Reply-To":a}}if(e.headers){const a=E(e.headers),c={};Object.entries(a).forEach(([p,P])=>{c[K(p)]=_(P)}),t.headers={...t.headers,...c}}e.tags&&e.tags.length>0&&(t.tags=e.tags),e.metadata&&(t.metadata=e.metadata),(e.googleAnalyticsDomains||e.googleAnalyticsCampaign)&&(t.google_analytics_domains=e.googleAnalyticsDomains,t.google_analytics_campaign=e.googleAnalyticsCampaign),e.subaccount&&(t.subaccount=e.subaccount),e.attachments&&e.attachments.length>0&&(t.attachments=await Promise.all(e.attachments.map(async a=>{let c;if(a.content)if(typeof a.content=="string")c=a.content;else if(a.content instanceof Promise){const p=await a.content;c=S.from(p).toString("base64")}else c=a.content.toString("base64");else if(a.raw)c=typeof a.raw=="string"?a.raw:a.raw.toString("base64");else throw new d(r,`Attachment ${a.filename} has no content`);return{content:c,name:a.filename,type:a.contentType??"application/octet-stream"}})));const o={key:s.apiKey,message:t};e.templateName&&(o.template_name=e.templateName,e.templateContent&&(o.template_content=e.templateContent),e.templateVariables&&(o.template_vars=e.templateVariables)),e.globalMergeVars&&(t.global_merge_vars=e.globalMergeVars),e.mergeVars&&(t.merge_vars=e.mergeVars),e.sendAt&&(o.send_at=e.sendAt),n.debug("Sending email via Mandrill API",{subject:t.subject,to:t.to});const j={"Content-Type":"application/json"},u=await v(async()=>f(`${s.endpoint}/messages/send.json`,{headers:j,method:"POST",timeout:s.timeout},JSON.stringify(o)),s.retries);if(!u.success)return n.debug("API request failed when sending email",u.error),{error:u.error??new d(r,"Failed to send email"),success:!1};const b=u.data?.body?.[0]?.id??z();return n.debug("Email sent successfully",{messageId:b}),{data:{messageId:b,provider:r,response:u.data,sent:!0,timestamp:new Date},success:!0}}catch(l){return{error:w(r,"send email",l,n),success:!1}}},async validateCredentials(){return this.isAvailable()}}});export{Y as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var j=Object.defineProperty;var b=(i,t)=>j(i,"name",{value:t,configurable:!0});import{createRequire as A}from"node:module";import m from"./EmailError-zm2ffVav.js";import z from"./RequiredOptionError-CevW3u2K.js";import{s as h}from"./generate-message-id-D4uA8gkj.js";import{i as E}from"./headers-to-record-Qo124ImV.js";import{m as v}from"./make-request-CaT4d5oC.js";import{c as K,P as x,u as w,h as P}from"./provider-base-Cmzx6BTO.js";import{a as S,s as q}from"./sanitize-header-wWav-Scu.js";import{d as B}from"./validate-email-options-DPo3SgC0.js";import{defineProvider as R}from"./defineProvider-CtLH0VBE.js";const $=A(import.meta.url),f=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,T=b(i=>{if(typeof f<"u"&&f.versions&&f.versions.node){const[t,u]=f.versions.node.split(".").map(Number);if(t>22||t===22&&u>=3||t===20&&u>=16)return f.getBuiltinModule(i)}return $(i)},"__cjs_getBuiltinModule"),{Buffer:k}=T("node:buffer");var O=Object.defineProperty,C=b((i,t)=>O(i,"name",{value:t,configurable:!0}),"b");const s="plunk",D="https://api.useplunk.com/v1",H=3e4,N=3,Z=R((i={})=>{if(!i.apiKey)throw new z(s,"apiKey");const t={apiKey:i.apiKey,debug:i.debug??!1,endpoint:i.endpoint??D,logger:i.logger,retries:i.retries??N,timeout:i.timeout??H},u=new x,n=K(s,i.logger);return{features:{attachments:!0,batchSending:!1,customHeaders:!0,html:!0,replyTo:!0,scheduling:!1,tagging:!1,templates:!0,tracking:!0},async getEmail(e){try{if(!e)return{error:new m(s,"Email ID is required to retrieve email details"),success:!1};await u.ensureInitialized(()=>this.initialize(),s);const c={Authorization:`Bearer ${t.apiKey}`,"Content-Type":"application/json"};n.debug("Retrieving email details",{id:e});const l=await w(async()=>v(`${t.endpoint}/emails/${e}`,{headers:c,method:"GET",timeout:t.timeout}),t.retries);return l.success?(n.debug("Email details retrieved successfully"),{data:l.data?.body,success:!0}):(n.debug("API request failed when retrieving email",l.error),{error:new m(s,`Failed to retrieve email: ${l.error instanceof Error?l.error.message:"Unknown error"}`,{cause:l.error}),success:!1})}catch(c){return{error:P(s,"retrieve email",c,n),success:!1}}},async initialize(){await u.ensureInitialized(async()=>{if(!await this.isAvailable())throw new m(s,"Plunk API not available or invalid API key");n.debug("Provider initialized successfully")},s)},async isAvailable(){try{return t.apiKey&&t.apiKey.length>0?(n.debug("API key exists, assuming Plunk is available"),!0):!1}catch(e){return n.debug("Error checking availability:",e),!1}},name:s,options:t,async sendEmail(e){try{const c=B(e);if(c.length>0)return{error:new m(s,`Invalid email options: ${c.join(", ")}`),success:!1};await u.ensureInitialized(()=>this.initialize(),s);const l=C(r=>Array.isArray(r)?r.map(o=>o.email):[r.email],"formatRecipients"),a={to:e.subscriber??(Array.isArray(e.to)?e.to[0]?.email:e.to.email)};if(e.from&&(a.from=e.from.email,e.from.name&&(a.from_name=e.from.name)),e.subject&&(a.subject=e.subject),e.html?a.body=e.html:e.text&&(a.body=e.text),e.html&&e.text&&(a.text=e.text),e.cc&&(a.cc=l(e.cc)),e.bcc&&(a.bcc=l(e.bcc)),e.replyTo&&(a.reply_to=e.replyTo.email,e.replyTo.name&&(a.reply_to_name=e.replyTo.name)),e.templateId&&(a.template=e.templateId),e.data&&(a.data=e.data),e.subscriberId&&(a.subscriber_id=e.subscriberId),e.headers){const r=E(e.headers),o={};Object.entries(r).forEach(([y,_])=>{o[S(y)]=q(_)}),a.headers=o}e.attachments&&e.attachments.length>0&&(a.attachments=await Promise.all(e.attachments.map(async r=>{let o;if(r.content)if(typeof r.content=="string")o=r.content;else if(r.content instanceof Promise){const y=await r.content;o=k.from(y).toString("base64")}else o=r.content.toString("base64");else if(r.raw)o=typeof r.raw=="string"?r.raw:r.raw.toString("base64");else throw new m(s,`Attachment ${r.filename} has no content`);return{content:o,filename:r.filename,type:r.contentType??"application/octet-stream"}}))),n.debug("Sending email via Plunk API",{subject:a.subject,to:a.to});const I={Authorization:`Bearer ${t.apiKey}`,"Content-Type":"application/json"},d=await w(async()=>v(`${t.endpoint}/send`,{headers:I,method:"POST",timeout:t.timeout},JSON.stringify(a)),t.retries);if(!d.success)return n.debug("API request failed when sending email",d.error),{error:d.error??new m(s,"Failed to send email"),success:!1};const p=d.data,g=p?.body&&typeof p.body=="object"?p.body.id??p.body.messageId??h():h();return n.debug("Email sent successfully",{messageId:g}),{data:{messageId:g,provider:s,response:d.data,sent:!0,timestamp:new Date},success:!0}}catch(c){return{error:P(s,"send email",c,n),success:!1}}},async validateCredentials(){return this.isAvailable()}}});export{Z as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var I=Object.defineProperty;var y=(r,l)=>I(r,"name",{value:l,configurable:!0});import{createRequire as A}from"node:module";import c from"./EmailError-zm2ffVav.js";import b from"./RequiredOptionError-CevW3u2K.js";import{s as T}from"./generate-message-id-D4uA8gkj.js";import{i as E}from"./headers-to-record-Qo124ImV.js";import{m as g}from"./make-request-CaT4d5oC.js";import{c as C,P as K,u as v}from"./provider-base-Cmzx6BTO.js";import{d as k}from"./validate-email-options-DPo3SgC0.js";import{defineProvider as q}from"./defineProvider-CtLH0VBE.js";import{h as f,i as w}from"./address-formatter-Cm_E_ZMa.js";const j=A(import.meta.url),m=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,$=y(r=>{if(typeof m<"u"&&m.versions&&m.versions.node){const[l,n]=m.versions.node.split(".").map(Number);if(l>22||l===22&&n>=3||l===20&&n>=16)return m.getBuiltinModule(r)}return j(r)},"__cjs_getBuiltinModule"),{Buffer:S}=$("node:buffer"),i="postal",z=3e4,x=3,J=q((r={})=>{if(!r.host)throw new b(i,"host");if(!r.apiKey)throw new b(i,"apiKey");const l=r.endpoint??`https://${r.host}/api/v1`,n={apiKey:r.apiKey,debug:r.debug??!1,endpoint:l,host:r.host,retries:r.retries??x,timeout:r.timeout??z,...r.logger&&{logger:r.logger}},p=new K,o=C(i,r.logger);return{features:{attachments:!0,batchSending:!1,customHeaders:!0,html:!0,replyTo:!0,scheduling:!1,tagging:!0,templates:!0,tracking:!0},async getEmail(e){try{if(!e)return{error:new c(i,"Email ID is required to retrieve email details"),success:!1};await p.ensureInitialized(()=>this.initialize(),i);const t={"Content-Type":"application/json","X-Server-API-Key":n.apiKey};o.debug("Retrieving email details",{id:e});const a=await v(async()=>g(`${n.endpoint}/messages/${e}`,{headers:t,method:"GET",timeout:n.timeout}),n.retries);return a.success?(o.debug("Email details retrieved successfully"),{data:a.data?.body,success:!0}):(o.debug("API request failed when retrieving email",a.error),{error:new c(i,`Failed to retrieve email: ${a.error instanceof Error?a.error.message:"Unknown error"}`,{cause:a.error}),success:!1})}catch(t){return o.debug("Exception retrieving email",t),{error:new c(i,`Failed to retrieve email: ${t.message}`,{cause:t}),success:!1}}},async initialize(){await p.ensureInitialized(async()=>{if(!await this.isAvailable())throw new c(i,"Postal API not available or invalid API key");o.debug("Provider initialized successfully")},i)},async isAvailable(){try{const e={"Content-Type":"application/json","X-Server-API-Key":n.apiKey};o.debug("Checking Postal API availability");const t=await g(`${n.endpoint}/server`,{headers:e,method:"GET",timeout:n.timeout});return o.debug("Postal API availability check response:",{error:t.error instanceof Error?t.error.message:void 0,statusCode:t.data?.statusCode,success:t.success}),!!(t.success&&t.data&&typeof t.data=="object"&&"statusCode"in t.data&&typeof t.data.statusCode=="number"&&t.data.statusCode>=200&&t.data.statusCode<300)}catch(e){return o.debug("Error checking availability:",e),!1}},name:i,options:n,async sendEmail(e){try{const t=k(e);if(t.length>0)return{error:new c(i,`Invalid email options: ${t.join(", ")}`),success:!1};await p.ensureInitialized(()=>this.initialize(),i);const a={from:w(e.from).address,subject:e.subject,to:f(e.to).map(s=>s.address)};if(e.html&&(a.html_body=e.html),e.text&&(a.plain_body=e.text),e.cc&&(a.cc=f(e.cc).map(s=>s.address)),e.bcc&&(a.bcc=f(e.bcc).map(s=>s.address)),e.replyTo&&(a.reply_to=w(e.replyTo).address),e.templateId&&(a.template_id=e.templateId,e.templateVariables&&(a.template_variables=e.templateVariables)),e.tags&&e.tags.length>0&&(a.tag=e.tags.join(",")),e.headers){const s=E(e.headers);a.headers=s}e.attachments&&e.attachments.length>0&&(a.attachments=await Promise.all(e.attachments.map(async s=>{let u;if(s.content)if(typeof s.content=="string")u=s.content;else if(s.content instanceof Promise){const _=await s.content;u=S.from(_).toString("base64")}else u=s.content.toString("base64");else if(s.raw)u=typeof s.raw=="string"?s.raw:s.raw.toString("base64");else throw new c(i,`Attachment ${s.filename} has no content`);return{content_type:s.contentType??"application/octet-stream",data:u,name:s.filename}}))),o.debug("Sending email via Postal API",{subject:a.subject,to:a.to});const P={"Content-Type":"application/json","X-Server-API-Key":n.apiKey},d=await v(async()=>g(`${n.endpoint}/send/message`,{headers:P,method:"POST",timeout:n.timeout},JSON.stringify(a)),n.retries);if(!d.success)return o.debug("API request failed when sending email",d.error),{error:d.error??new c(i,"Failed to send email"),success:!1};const h=d.data?.body?.message_id?.toString()??T();return o.debug("Email sent successfully",{messageId:h}),{data:{messageId:h,provider:i,response:d.data,sent:!0,timestamp:new Date},success:!0}}catch(t){return o.debug("Exception sending email",t),{error:new c(i,`Failed to send email: ${t.message}`,{cause:t}),success:!1}}},async validateCredentials(){return this.isAvailable()}}});export{J as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import d from"./EmailError-zm2ffVav.js";import T from"./RequiredOptionError-CevW3u2K.js";import{s as P}from"./generate-message-id-D4uA8gkj.js";import{i as w}from"./headers-to-record-Qo124ImV.js";import{m as u}from"./make-request-CaT4d5oC.js";import{c as I,P as A,u as f,h}from"./provider-base-Cmzx6BTO.js";import{s as C,a as S}from"./sanitize-header-wWav-Scu.js";import{d as j}from"./validate-email-options-DPo3SgC0.js";import{defineProvider as E}from"./defineProvider-CtLH0VBE.js";import{b as p,c as v}from"./address-formatter-Cm_E_ZMa.js";import{b as z}from"./attachment-processor-DsmIomKc.js";const r="postmark",M="https://api.postmarkapp.com",$=3e4,O=3,V=E((o={})=>{if(!o.serverToken)throw new T(r,"serverToken");const s={debug:o.debug??!1,endpoint:o.endpoint??M,retries:o.retries??O,serverToken:o.serverToken,timeout:o.timeout??$,...o.logger&&{logger:o.logger}},m=new A,i=I(r,o.logger);return{endpoint:s.endpoint,features:{attachments:!0,batchSending:!0,customHeaders:!0,html:!0,replyTo:!0,scheduling:!1,tagging:!0,templates:!0,tracking:!0},async getEmail(e){try{if(!e)return{error:new d(r,"Email ID is required to retrieve email details"),success:!1};await m.ensureInitialized(()=>this.initialize(),r);const a={"Content-Type":"application/json","X-Postmark-Server-Token":s.serverToken};i.debug("Retrieving email details",{id:e});const t=await f(async()=>u(`${s.endpoint}/messages/outbound/${e}/details`,{headers:a,method:"GET",timeout:s.timeout}),s.retries);return t.success?(i.debug("Email details retrieved successfully"),{data:t.data?.body,success:!0}):(i.debug("API request failed when retrieving email",t.error),{error:new d(r,`Failed to retrieve email: ${t.error instanceof Error?t.error.message:"Unknown error"}`,{cause:t.error}),success:!1})}catch(a){return{error:h(r,"retrieve email",a,i),success:!1}}},async initialize(){await m.ensureInitialized(async()=>{if(!await this.isAvailable())throw new d(r,"Postmark API not available or invalid server token");i.debug("Provider initialized successfully")},r)},async isAvailable(){try{const e={"Content-Type":"application/json","X-Postmark-Server-Token":s.serverToken};i.debug("Checking Postmark API availability");const a=await u(`${s.endpoint}/server`,{headers:e,method:"GET",timeout:s.timeout});return i.debug("Postmark API availability check response:",{error:a.error instanceof Error?a.error.message:void 0,statusCode:a.data?.statusCode,success:a.success}),!!(a.success&&a.data&&typeof a.data=="object"&&"statusCode"in a.data&&typeof a.data.statusCode=="number"&&a.data.statusCode>=200&&a.data.statusCode<300)}catch(e){return i.debug("Error checking availability:",e),!1}},name:r,options:s,async sendEmail(e){try{const a=j(e);if(a.length>0)return{error:new d(r,`Invalid email options: ${a.join(", ")}`),success:!1};await m.ensureInitialized(()=>this.initialize(),r);const t={From:v(e.from),Subject:e.subject,To:p(e.to).join(",")};if(e.html&&(t.HtmlBody=e.html),e.text&&(t.TextBody=e.text),e.cc&&(t.Cc=p(e.cc).join(",")),e.bcc&&(t.Bcc=p(e.bcc).join(",")),e.replyTo&&(t.ReplyTo=v(e.replyTo)),e.templateId?(t.TemplateId=e.templateId,e.templateModel&&(t.TemplateModel=e.templateModel)):e.templateAlias&&(t.TemplateAlias=e.templateAlias,e.templateModel&&(t.TemplateModel=e.templateModel)),e.trackOpens!==void 0&&(t.TrackOpens=e.trackOpens),e.trackLinks!==void 0&&(t.TrackLinks=e.trackLinks),e.inlineCss!==void 0&&(t.InlineCss=e.inlineCss),e.messageStream&&(t.MessageStream=e.messageStream),e.metadata&&(t.Metadata=e.metadata),e.tags&&e.tags.length>0){const[l]=e.tags;t.Tag=l}if(e.headers){const l=w(e.headers),c=[];for(const[b,y]of Object.entries(l))c.push({Name:S(b),Value:C(String(y))});c.length>0&&(t.Headers=c)}e.attachments&&e.attachments.length>0&&(t.Attachments=await Promise.all(e.attachments.map(async l=>z(l,r)))),i.debug("Sending email via Postmark API",{subject:t.Subject,to:t.To});const k={"Content-Type":"application/json","X-Postmark-Server-Token":s.serverToken},n=await f(async()=>u(`${s.endpoint}/email`,{headers:k,method:"POST",timeout:s.timeout},JSON.stringify(t)),s.retries);if(!n.success)return i.debug("API request failed when sending email",n.error),{error:n.error??new d(r,"Failed to send email"),success:!1};const g=n.data?.body?.MessageID??P();return i.debug("Email sent successfully",{messageId:g}),{data:{messageId:g,provider:r,response:n.data,sent:!0,timestamp:new Date},success:!0}}catch(a){return{error:h(r,"send email",a,i),success:!1}}},async validateCredentials(){return this.isAvailable()}}});export{V as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var u=Object.defineProperty;var s=(t,e)=>u(t,"name",{value:e,configurable:!0});import c from"./EmailError-zm2ffVav.js";import{c as d}from"./create-logger-BiWdqFNg.js";var l=Object.defineProperty,f=s((t,e)=>l(t,"name",{value:e,configurable:!0}),"i");const o=f(async(t,e=3,i=300)=>{try{const r=await t();return r.success||e<=0?r:(await new Promise(a=>{setTimeout(()=>{a()},i)}),o(t,e-1,i*2))}catch(r){return e<=0?{error:r instanceof Error?r:new Error(String(r)),success:!1}:(await new Promise(a=>{setTimeout(()=>{a()},i)}),o(t,e-1,i*2))}},"retry");var g=Object.defineProperty,n=s((t,e)=>g(t,"name",{value:e,configurable:!0}),"o");class P{static{s(this,"ProviderState")}static{n(this,"ProviderState")}isInitialized=!1;get initialized(){return this.isInitialized}setInitialized(){this.isInitialized=!0}async ensureInitialized(e,i){if(!this.isInitialized)try{await e(),this.isInitialized=!0}catch(r){throw new c(i,`Failed to initialize: ${r.message}`,{cause:r})}}}const w=n((t,e)=>d(t,e),"createProviderLogger");n(t=>{if(!t.success||!t.data)return!1;const e=t.data;return typeof e.statusCode=="number"&&e.statusCode>=200&&e.statusCode<300},"isSuccessfulResponse");const z=n((t,e,i,r)=>{const a=`Failed to ${e}: ${i.message}`;return r&&r.debug(`Exception ${e}`,i),new c(t,a,{cause:i})},"handleProviderError");export{P,w as c,z as h,o as u};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var mr=Object.defineProperty;var $=(t,n)=>mr(t,"name",{value:n,configurable:!0});import{createRequire as hr}from"node:module";const xr=hr(import.meta.url),C=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,br=$(t=>{if(typeof C<"u"&&C.versions&&C.versions.node){const[n,a]=C.versions.node.split(".").map(Number);if(n>22||n===22&&a>=3||n===20&&a>=16)return C.getBuiltinModule(t)}return xr(t)},"__cjs_getBuiltinModule"),{createRequire:te}=br("node:module"),vr=0,$r=4;var wr=Object.defineProperty,yr=$((t,n)=>wr(t,"name",{value:n,configurable:!0}),"t$2"),jr=Object.defineProperty,zr=yr((t,n)=>jr(t,"name",{value:n,configurable:!0}),"t"),Pr=Object.defineProperty,Or=zr((t,n)=>Pr(t,"name",{value:n,configurable:!0}),"n");const Me=Or(t=>{if(!t||!(t instanceof URL)&&typeof t!="string")throw new TypeError("Path must be a non-empty string or URL.")},"assertValidFileOrDirectoryPath");var Mr=Object.defineProperty,l=$((t,n)=>Mr(t,"name",{value:n,configurable:!0}),"s$2");let ye=l(()=>{var t=(()=>{var n=Object.defineProperty,a=Object.getOwnPropertyDescriptor,u=Object.getOwnPropertyNames,d=Object.prototype.hasOwnProperty,x=l((e,r)=>{for(var o in r)n(e,o,{get:r[o],enumerable:!0})},"ne"),w=l((e,r,o,i)=>{if(r&&typeof r=="object"||typeof r=="function")for(let s of u(r))!d.call(e,s)&&s!==o&&n(e,s,{get:l(()=>r[s],"get"),enumerable:!(i=a(r,s))||i.enumerable});return e},"ae"),b=l(e=>w(n({},"__esModule",{value:!0}),e),"oe"),_={};x(_,{zeptomatch:l(()=>we,"zeptomatch")});var T=l(e=>{const r=new Set,o=[e];for(let i=0;i<o.length;i++){const s=o[i];if(r.has(s))continue;r.add(s);const{children:c}=s;if(c?.length)for(let p=0,g=c.length;p<g;p++)o.push(c[p])}return Array.from(r)},"M"),U=l(e=>{let r="";const o=T(e);for(let i=0,s=o.length;i<s;i++){const c=o[i];if(!c.regex)continue;const p=c.regex.flags;if(r||(r=p),r!==p)throw new Error(`Inconsistent RegExp flags used: "${r}" and "${p}"`)}return r},"se"),ne=l((e,r,o)=>{const i=o.get(e);if(i!==void 0)return i;const s=e.partial??r;let c="";if(e.regex&&(c+=s?"(?:$|":"",c+=e.regex.source),e.children?.length){const p=Ue(e.children.map(g=>ne(g,r,o)).filter(Boolean));if(p?.length){const g=e.children.some(q=>!q.regex||!(q.partial??r)),h=p.length>1||s&&(!c.length||g);c+=h?s?"(?:$|":"(?:":"",c+=p.join("|"),c+=h?")":""}}return e.regex&&(c+=s?")":""),o.set(e,c),c},"O"),Ne=l((e,r)=>{const o=new Map,i=T(e);for(let s=i.length-1;s>=0;s--){const c=ne(i[s],r,o);if(!(s>0))return c}return""},"ie"),Ue=l(e=>Array.from(new Set(e)),"ue"),V=l((e,r,o)=>V.compile(e,o).test(r),"R");V.compile=(e,r)=>{const o=r?.partial??!1,i=Ne(e,o),s=U(e);return new RegExp(`^(?:${i})$`,s)};var De=V,Ge=l((e,r)=>{const o=De.compile(e,r),i=`${o.source.slice(0,-1)}[\\\\/]?$`,s=o.flags;return new RegExp(i,s)},"le"),Ve=Ge,Ye=l(e=>{const r=e.map(i=>i.source).join("|")||"$^",o=e[0]?.flags;return new RegExp(r,o)},"ve"),He=Ye,oe=l(e=>Array.isArray(e),"j"),B=l(e=>typeof e=="function","_"),Je=l(e=>e.length===0,"he"),Ke=(()=>{const{toString:e}=Function.prototype,r=/(?:^\(\s*(?:[^,.()]|\.(?!\.\.))*\s*\)\s*=>|^\s*[a-zA-Z$_][a-zA-Z0-9$_]*\s*=>)/;return o=>(o.length===0||o.length===1)&&r.test(e.call(o))})(),Qe=l(e=>typeof e=="number","de"),Xe=l(e=>typeof e=="object"&&e!==null,"xe"),et=l(e=>e instanceof RegExp,"me"),tt=(()=>{const e=/\\\(|\((?!\?(?::|=|!|<=|<!))/;return r=>e.test(r.source)})(),rt=(()=>{const e=/^[a-zA-Z0-9_-]+$/;return r=>e.test(r.source)&&!r.flags.includes("i")})(),se=l(e=>typeof e=="string","A"),P=l(e=>e===void 0,"f"),nt=l(e=>{const r=new Map;return o=>{const i=r.get(o);if(i!==void 0)return i;const s=e(o);return r.set(o,s),s}},"ye"),ie=l((e,r,o={})=>{const i={cache:{},input:e,index:0,indexBacktrackMax:0,options:o,output:[]},s=O(r)(i),c=Math.max(i.index,i.indexBacktrackMax);if(s&&i.index===e.length)return i.output;throw new Error(`Failed to parse at index ${c}`)},"I"),f=l((e,r)=>oe(e)?ot(e,r):se(e)?ae(e,r):st(e,r),"i"),ot=l((e,r)=>{const o={};for(const i of e){if(i.length!==1)throw new Error(`Invalid character: "${i}"`);const s=i.charCodeAt(0);o[s]=!0}return i=>{const s=i.input;let c=i.index,p=c;for(;p<s.length&&s.charCodeAt(p)in o;)p+=1;if(p>c){if(!P(r)&&!i.options.silent){const g=s.slice(c,p),h=B(r)?r(g,s,`${c}`):r;P(h)||i.output.push(h)}i.index=p}return!0}},"we"),st=l((e,r)=>{if(rt(e))return ae(e.source,r);{const o=e.source,i=e.flags.replace(/y|$/,"y"),s=new RegExp(o,i);return tt(e)&&B(r)&&!Ke(r)?it(s,r):at(s,r)}},"$e"),it=l((e,r)=>o=>{const i=o.index,s=o.input;e.lastIndex=i;const c=e.exec(s);if(c){const p=e.lastIndex;if(!o.options.silent){const g=r(...c,s,`${i}`);P(g)||o.output.push(g)}return o.index=p,!0}else return!1},"Ee"),at=l((e,r)=>o=>{const i=o.index,s=o.input;if(e.lastIndex=i,e.test(s)){const c=e.lastIndex;if(!P(r)&&!o.options.silent){const p=B(r)?r(s.slice(i,c),s,`${i}`):r;P(p)||o.output.push(p)}return o.index=c,!0}else return!1},"Ce"),ae=l((e,r)=>o=>{const i=o.index,s=o.input;if(s.startsWith(e,i)){if(!P(r)&&!o.options.silent){const c=B(r)?r(e,s,`${i}`):r;P(c)||o.output.push(c)}return o.index+=e.length,!0}else return!1},"F"),Y=l((e,r,o,i)=>{const s=O(e),c=r>1;return J(H(ce(p=>{let g=0;for(;g<o;){const h=p.index;if(!s(p)||(g+=1,p.index===h))break}return g>=r},c),i))},"k"),le=l((e,r)=>Y(e,0,1,r),"L"),D=l((e,r)=>Y(e,0,1/0,r),"$"),lt=l((e,r)=>Y(e,1,1/0,r),"Re"),k=l((e,r)=>{const o=e.map(O);return J(H(ce(i=>{for(let s=0,c=o.length;s<c;s++)if(!o[s](i))return!1;return!0}),r))},"x"),y=l((e,r)=>{const o=e.map(O);return J(H(i=>{for(let s=0,c=o.length;s<c;s++)if(o[s](i))return!0;return!1},r))},"p"),ce=l((e,r=!0,o=!1)=>{const i=O(e);return r?s=>{const c=s.index,p=s.output.length,g=i(s);return!g&&!o&&(s.indexBacktrackMax=Math.max(s.indexBacktrackMax,s.index)),(!g||o)&&(s.index=c,s.output.length!==p&&(s.output.length=p)),g}:i},"q"),H=l((e,r)=>{const o=O(e);return r?i=>{if(i.options.silent)return o(i);const s=i.output.length;if(o(i)){const c=i.output.splice(s,1/0),p=r(c);return P(p)||i.output.push(p),!0}else return!1}:o},"B"),J=(()=>{let e=0;return r=>{const o=O(r),i=e+=1;return s=>{var c;if(s.options.memoization===!1)return o(s);const p=s.index,g=(c=s.cache)[i]||(c[i]={indexMax:-1,queue:[]}),h=g.queue;if(p<=g.indexMax){const W=g.store||(g.store=new Map);if(h.length){for(let R=0,fr=h.length;R<fr;R+=2){const gr=h[R*2],dr=h[R*2+1];W.set(gr,dr)}h.length=0}const j=W.get(p);if(j===!1)return!1;if(Qe(j))return s.index=j,!0;if(j)return s.index=j.index,j.output?.length&&s.output.push(...j.output),!0}const q=s.output.length,pr=o(s);if(g.indexMax=Math.max(g.indexMax,p),pr){const W=s.index,j=s.output.length;if(j>q){const R=s.output.slice(q,j);h.push(p,{index:W,output:R})}else h.push(p,W);return!0}else return h.push(p,!1),!1}}})(),ue=l(e=>{let r;return o=>(r||(r=O(e())),r(o))},"G"),O=nt(e=>{if(B(e))return Je(e)?ue(e):e;if(se(e)||et(e))return f(e);if(oe(e))return k(e);if(Xe(e))return y(Object.values(e));throw new Error("Invalid rule")}),E=l(e=>e,"d"),ct=l(e=>typeof e=="string","ke"),ut=l(e=>{const r=new WeakMap,o=new WeakMap;return(i,s)=>{const c=s?.partial?o:r,p=c.get(i);if(p!==void 0)return p;const g=e(i,s);return c.set(i,g),g}},"Be"),pt=l(e=>{const r={},o={};return(i,s)=>{const c=s?.partial?o:r;return c[i]??(c[i]=e(i,s))}},"Pe"),ft=f(/\\./,E),gt=f(/./,E),dt=f(/\*\*\*+/,"*"),mt=f(/([^/{[(!])\*\*/,(e,r)=>`${r}*`),ht=f(/(^|.)\*\*(?=[^*/)\]}])/,(e,r)=>`${r}*`),xt=D(y([ft,dt,mt,ht,gt])),bt=xt,vt=l(e=>ie(e,bt,{memoization:!1}).join(""),"Ie"),$t=vt,pe="abcdefghijklmnopqrstuvwxyz",wt=l(e=>{let r="";for(;e>0;){const o=(e-1)%26;r=pe[o]+r,e=Math.floor((e-1)/26)}return r},"Le"),fe=l(e=>{let r=0;for(let o=0,i=e.length;o<i;o++)r=r*26+pe.indexOf(e[o])+1;return r},"V"),K=l((e,r)=>{if(r<e)return K(r,e);const o=[];for(;e<=r;)o.push(e++);return o},"b"),yt=l((e,r,o)=>K(e,r).map(i=>String(i).padStart(o,"0")),"qe"),ge=l((e,r)=>K(fe(e),fe(r)).map(wt),"W"),m=l(e=>({partial:!1,regex:new RegExp(e,"s"),children:[]}),"c"),S=l(e=>({children:e}),"y"),A=(()=>{const e=l((r,o,i)=>{if(i.has(r))return;i.add(r);const{children:s}=r;if(!s.length)s.push(o);else for(let c=0,p=s.length;c<p;c++)e(s[c],o,i)},"e");return r=>{if(!r.length)return S([]);for(let o=r.length-1;o>=1;o--){const i=new Set,s=r[o-1],c=r[o];e(s,c,i)}return r[0]}})(),M=l(()=>({regex:new RegExp("[\\\\/]","s"),children:[]}),"g"),jt=f(/\\./,m),zt=f(/[$.*+?^(){}[\]\|]/,e=>m(`\\${e}`)),Pt=f(/[\\\/]/,M),Ot=f(/[^$.*+?^(){}[\]\|\\\/]+/,m),Mt=f(/^(?:!!)*!(.*)$/,(e,r)=>m(`(?!^${we.compile(r).source}$).*?`)),_t=f(/^(!!)+/),Et=y([Mt,_t]),kt=f(/\/(\*\*\/)+/,()=>S([A([M(),m(".+?"),M()]),M()])),At=f(/^(\*\*\/)+/,()=>S([m("^"),A([m(".*?"),M()])])),Rt=f(/\/(\*\*)$/,()=>S([A([M(),m(".*?")]),m("$")])),Tt=f(/\*\*/,()=>m(".*?")),de=y([kt,At,Rt,Tt]),Bt=f(/\*\/(?!\*\*\/|\*$)/,()=>A([m("[^\\\\/]*?"),M()])),St=f(/\*/,()=>m("[^\\\\/]*")),me=y([Bt,St]),he=f("?",()=>m("[^\\\\/]")),qt=f("[",E),Wt=f("]",E),Ct=f(/[!^]/,"^\\\\/"),It=f(/[a-z]-[a-z]|[0-9]-[0-9]/i,E),Lt=f(/\\./,E),Zt=f(/[$.*+?^(){}[\|]/,e=>`\\${e}`),Ft=f(/[\\\/]/,"\\\\/"),Nt=f(/[^$.*+?^(){}[\]\|\\\/]+/,E),Ut=y([Lt,Zt,Ft,It,Nt]),xe=k([qt,le(Ct),D(Ut),Wt],e=>m(e.join(""))),Dt=f("{","(?:"),Gt=f("}",")"),Vt=f(/(\d+)\.\.(\d+)/,(e,r,o)=>yt(+r,+o,Math.min(r.length,o.length)).join("|")),Yt=f(/([a-z]+)\.\.([a-z]+)/,(e,r,o)=>ge(r,o).join("|")),Ht=f(/([A-Z]+)\.\.([A-Z]+)/,(e,r,o)=>ge(r.toLowerCase(),o.toLowerCase()).join("|").toUpperCase()),Jt=y([Vt,Yt,Ht]),be=k([Dt,Jt,Gt],e=>m(e.join(""))),Kt=f("{"),Qt=f("}"),Xt=f(","),er=f(/\\./,m),tr=f(/[$.*+?^(){[\]\|]/,e=>m(`\\${e}`)),rr=f(/[\\\/]/,M),nr=f(/[^$.*+?^(){}[\]\|\\\/,]+/,m),or=ue(()=>$e),sr=f("",()=>m("(?:)")),ir=lt(y([de,me,he,xe,be,or,er,tr,rr,nr]),A),ve=y([ir,sr]),$e=k([Kt,le(k([ve,D(k([Xt,ve]))])),Qt],S),ar=D(y([Et,de,me,he,xe,be,$e,jt,zt,Pt,Ot]),A),lr=ar,cr=l(e=>ie(e,lr,{memoization:!1})[0],"kr"),ur=cr,Q=l((e,r,o)=>Q.compile(e,o).test(r),"N");Q.compile=(()=>{const e=pt((o,i)=>Ve(ur($t(o)),i)),r=ut((o,i)=>He(o.map(s=>e(s,i))));return(o,i)=>ct(o)?e(o,i):r(o,i)})();var we=Q;return b(_)})();return t.default||t},"_lazyMatch"),X;const _r=l((t,n)=>(X||(X=ye(),ye=null),X(t,n)),"zeptomatch"),Er=/^[A-Z]:\//i,z=l((t="")=>t&&t.replaceAll("\\","/").replace(Er,n=>n.toUpperCase()),"normalizeWindowsPath"),kr=/^[/\\]{2}/,Ar=/^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Z]:[/\\]/i,_e=/^[A-Z]:$/i,je=/^\/([A-Z]:)?$/i,Rr=/.(\.[^./]+)$/,Tr=/^[/\\]|^[a-z]:[/\\]/i,Br=/\/$/,Sr=l(()=>typeof process.cwd=="function"?process.cwd().replaceAll("\\","/"):"/","cwd"),Ee=l((t,n)=>{let a="",u=0,d=-1,x=0,w;for(let b=0;b<=t.length;++b){if(b<t.length)w=t[b];else{if(w==="/")break;w="/"}if(w==="/"){if(!(d===b-1||x===1))if(x===2){if(a.length<2||u!==2||!a.endsWith(".")||a.at(-2)!=="."){if(a.length>2){const _=a.lastIndexOf("/");_===-1?(a="",u=0):(a=a.slice(0,_),u=a.length-1-a.lastIndexOf("/")),d=b,x=0;continue}else if(a.length>0){a="",u=0,d=b,x=0;continue}}n&&(a+=a.length>0?"/..":"..",u=2)}else a.length>0?a+=`/${t.slice(d+1,b)}`:a=t.slice(d+1,b),u=b-d-1;d=b,x=0}else w==="."&&x!==-1?++x:x=-1}return a},"normalizeString"),F=l(t=>Ar.test(t),"isAbsolute"),ke=l(function(t){if(t.length===0)return".";t=z(t);const n=kr.exec(t),a=F(t),u=t.at(-1)==="/";return t=Ee(t,!a),t.length===0?a?"/":u?"./":".":(u&&(t+="/"),_e.test(t)&&(t+="/"),n?a?`//${t}`:`//./${t}`:a&&!F(t)?`/${t}`:t)},"normalize"),Ae=l((...t)=>{let n="";for(const a of t)if(a)if(n.length>0){const u=n.at(-1)==="/",d=a[0]==="/";u&&d?n+=a.slice(1):n+=u||d?a:`/${a}`}else n+=a;return ke(n)},"join"),ee=l(function(...t){t=t.map(u=>z(u));let n="",a=!1;for(let u=t.length-1;u>=-1&&!a;u--){const d=u>=0?t[u]:Sr();!d||d.length===0||(n=`${d}/${n}`,a=F(d))}return n=Ee(n,!a),a&&!F(n)?`/${n}`:n.length>0?n:"."},"resolve");l(function(t){return z(t)},"toNamespacedPath");const Re=l(function(t){return Rr.exec(z(t))?.[1]??""},"extname");l(function(t,n){const a=ee(t).replace(je,"$1").split("/"),u=ee(n).replace(je,"$1").split("/");if(u[0][1]===":"&&a[0][1]===":"&&a[0]!==u[0])return u.join("/");const d=[...a];for(const x of d){if(u[0]!==x)break;a.shift(),u.shift()}return[...a.map(()=>".."),...u].join("/")},"relative");const qr=l(t=>{const n=z(t).replace(Br,"").split("/").slice(0,-1);return n.length===1&&_e.test(n[0])&&(n[0]=`${n[0]}/`),n.join("/")||(F(t)?"/":".")},"dirname");l(function(t){const n=[t.root,t.dir,t.base??t.name+t.ext].filter(Boolean);return z(t.root?ee(...n):n.join("/"))},"format");const Wr=l((t,n)=>{const a=z(t).split("/").pop();return n&&a.endsWith(n)?a.slice(0,-n.length):a},"basename");l(function(t){const n=Tr.exec(t)?.[0]?.replaceAll("\\","/")??"",a=Wr(t),u=Re(a);return{base:a,dir:qr(t),ext:u,name:a.slice(0,a.length-u.length),root:n}},"parse");l((t,n)=>_r(n,ke(t)),"matchesGlob");var Cr=Object.defineProperty,v=$((t,n)=>Cr(t,"name",{value:n,configurable:!0}),"i$2");const Ir=te(import.meta.url),I=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Lr=v(t=>{if(typeof I<"u"&&I.versions&&I.versions.node){const[n,a]=I.versions.node.split(".").map(Number);if(n>22||n===22&&a>=3||n===20&&a>=16)return I.getBuiltinModule(t)}return Ir(t)},"__cjs_getBuiltinModule"),{fileURLToPath:Zr}=Lr("node:url");function Te(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}$(Te,"w$1");v(Te,"getDefaultExportFromCjs");var ze,Pe;function Be(){return Pe||(Pe=1,ze=["3dm","3ds","3g2","3gp","7z","a","aac","adp","afdesign","afphoto","afpub","ai","aif","aiff","alz","ape","apk","appimage","ar","arj","asf","au","avi","bak","baml","bh","bin","bk","bmp","btif","bz2","bzip2","cab","caf","cgm","class","cmx","cpio","cr2","cr3","cur","dat","dcm","deb","dex","djvu","dll","dmg","dng","doc","docm","docx","dot","dotm","dra","DS_Store","dsk","dts","dtshd","dvb","dwg","dxf","ecelp4800","ecelp7470","ecelp9600","egg","eol","eot","epub","exe","f4v","fbs","fh","fla","flac","flatpak","fli","flv","fpx","fst","fvt","g3","gh","gif","graffle","gz","gzip","h261","h263","h264","icns","ico","ief","img","ipa","iso","jar","jpeg","jpg","jpgv","jpm","jxr","key","ktx","lha","lib","lvp","lz","lzh","lzma","lzo","m3u","m4a","m4v","mar","mdi","mht","mid","midi","mj2","mka","mkv","mmr","mng","mobi","mov","movie","mp3","mp4","mp4a","mpeg","mpg","mpga","mxu","nef","npx","numbers","nupkg","o","odp","ods","odt","oga","ogg","ogv","otf","ott","pages","pbm","pcx","pdb","pdf","pea","pgm","pic","png","pnm","pot","potm","potx","ppa","ppam","ppm","pps","ppsm","ppsx","ppt","pptm","pptx","psd","pya","pyc","pyo","pyv","qt","rar","ras","raw","resources","rgb","rip","rlc","rmf","rmvb","rpm","rtf","rz","s3m","s7z","scpt","sgi","shar","snap","sil","sketch","slk","smv","snk","so","stl","suo","sub","swf","tar","tbz","tbz2","tga","tgz","thmx","tif","tiff","tlz","ttc","ttf","txz","udf","uvh","uvi","uvm","uvp","uvs","uvu","viv","vob","war","wav","wax","wbmp","wdp","weba","webm","webp","whl","wim","wm","wma","wmv","wmx","woff","woff2","wrm","wvx","xbm","xif","xla","xlam","xls","xlsb","xlsm","xlsx","xlt","xltm","xltx","xm","xmind","xpi","xpm","xwd","xz","z","zip","zipx"]),ze}$(Be,"y");v(Be,"requireBinaryExtensions");var Fr=Be();const Nr=Te(Fr),Ur=new Set(Nr),Dr=new Set(["/","\\",void 0]),Oe=Symbol.for("pathe:normalizedAlias"),Gr=/(^|[/\\])([^/\\]+?)(?=(?:\.[^.]+)?$)/,Vr=v((t,n)=>n.split("/").length-t.split("/").length,"compareAliases"),G=v((t="/")=>{const n=t.at(-1);return n==="/"||n==="\\"},"hasTrailingSlash"),Se=v(t=>{if(t[Oe])return t;const n=Object.fromEntries(Object.entries(t).toSorted(([a],[u])=>Vr(a,u)));for(const a in n)for(const u in n)u===a||a.startsWith(u)||n[a].startsWith(u)&&Dr.has(n[a][u.length])&&(n[a]=n[u]+n[a].slice(u.length));return Object.defineProperty(n,Oe,{enumerable:!1,value:!0}),n},"normalizeAliases");v((t,n)=>{t=z(t),n=Se(n);for(const[a,u]of Object.entries(n)){if(!t.startsWith(a))continue;const d=G(a)?a.slice(0,-1):a;if(G(t[d.length]))return Ae(u,t.slice(a.length))}return t},"resolveAlias");v(t=>Gr.exec(t)?.[2],"filename");v((t,n)=>{t=z(t),n=Se(n);for(const[a,u]of Object.entries(n).toReversed()){if(!t.startsWith(u))continue;const d=G(u)?u.slice(0,-1):u;if(G(t[d.length]))return Ae(a,t.slice(u.length))}return t},"reverseResolveAlias");const Yr=/^(?:\.?\.[/\\]|\.\.\B)/,Hr=/^(?:msys|cygwin)$/;v(t=>Yr.test(t)||t==="..","isRelative");v(t=>Ur.has(Re(t).slice(1).toLowerCase()),"isBinaryPath");const qe=v(t=>z(t instanceof URL?Zr(t):t),"toPath");v(()=>{if(!globalThis.process)return!1;if(globalThis.process.platform==="win32"||globalThis.process.platform==="cygwin")return!0;const t=globalThis.process.env.OSTYPE;return typeof t!="string"?!1:Hr.test(t)},"isWindows");var Jr=Object.defineProperty,We=$((t,n)=>Jr(t,"name",{value:n,configurable:!0}),"t$1"),Kr=Object.defineProperty,re=We((t,n)=>Kr(t,"name",{value:n,configurable:!0}),"s");const Qr=te(import.meta.url),L=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Xr=re(t=>{if(typeof L<"u"&&L.versions&&L.versions.node){const[n,a]=L.versions.node.split(".").map(Number);if(n>22||n===22&&a>=3||n===20&&a>=16)return L.getBuiltinModule(t)}return Qr(t)},"__cjs_getBuiltinModule"),{access:en}=Xr("node:fs/promises");var tn=Object.defineProperty,rn=re((t,n)=>tn(t,"name",{value:n,configurable:!0}),"o");async function N(t,n=vr){Me(t),t=qe(t);try{return await en(t,n),!0}catch{return!1}}$(N,"i$1");We(N,"d");re(N,"m");rn(N,"isAccessible");var nn=Object.defineProperty,Ce=$((t,n)=>nn(t,"name",{value:n,configurable:!0}),"t"),on=Object.defineProperty,Ie=Ce((t,n)=>on(t,"name",{value:n,configurable:!0}),"t"),sn=Object.defineProperty,an=Ie((t,n)=>sn(t,"name",{value:n,configurable:!0}),"o");let ln=class extends Error{static{$(this,"c")}static{Ce(this,"i")}static{Ie(this,"n")}static{an(this,"PermissionError")}constructor(n){super(`EPERM: Operation not permitted, ${n}`)}get code(){return"EPERM"}set code(n){throw new Error("Cannot overwrite code EPERM")}get name(){return"PermissionError"}set name(n){throw new Error("Cannot overwrite name of PermissionError")}};var cn=Object.defineProperty,un=$((t,n)=>cn(t,"name",{value:n,configurable:!0}),"f"),pn=Object.defineProperty,Le=un((t,n)=>pn(t,"name",{value:n,configurable:!0}),"i");const fn=te(import.meta.url),Z=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Ze=Le(t=>{if(typeof Z<"u"&&Z.versions&&Z.versions.node){const[n,a]=Z.versions.node.split(".").map(Number);if(n>22||n===22&&a>=3||n===20&&a>=16)return Z.getBuiltinModule(t)}return fn(t)},"__cjs_getBuiltinModule"),{readFile:gn}=Ze("node:fs/promises"),{unzip:dn,brotliDecompress:mn}=Ze("node:zlib");var hn=Object.defineProperty,Fe=Le((t,n)=>hn(t,"name",{value:n,configurable:!0}),"n");const xn={brotli:mn,gzip:dn,none:Fe((t,n)=>{n(null,t)},"none")},wn=Fe(async(t,n)=>{if(Me(t),t=qe(t),!await N(t))throw new ln(`unable to read the non-accessible file: ${t}`);if(!await N(t,$r))throw new Error(`Unable to read the non-readable file: ${t}`);const{buffer:a,compression:u,encoding:d,flag:x}=n??{};return await gn(t,x?{encoding:d,flag:x}:{encoding:d}).then(async w=>await new Promise((b,_)=>{xn[u??"none"](w,(T,U)=>{T?_(T):b(a?U:U.toString())})})).catch(w=>{throw w})},"readFile");export{wn as B};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var I=Object.defineProperty;var h=(r,a)=>I(r,"name",{value:a,configurable:!0});import c from"./EmailError-zm2ffVav.js";import P from"./RequiredOptionError-CevW3u2K.js";import{s as $}from"./generate-message-id-D4uA8gkj.js";import{i as j}from"./headers-to-record-Qo124ImV.js";import{m as f}from"./make-request-CaT4d5oC.js";import{c as T,P as C,u as y,h as b}from"./provider-base-Cmzx6BTO.js";import{d as E}from"./validate-email-options-DPo3SgC0.js";import{defineProvider as S}from"./defineProvider-CtLH0VBE.js";import{b as z,c as v,l as w}from"./address-formatter-Cm_E_ZMa.js";var k=Object.defineProperty,K=h((r,a)=>k(r,"name",{value:a,configurable:!0}),"p");const n="resend",R="https://api.resend.com",_=3e4,x=3,D=K(r=>{const a=[],l=/^[\w-]+$/;return l.test(r.name)||a.push(`Tag name '${r.name}' must only contain ASCII letters, numbers, underscores, or dashes`),r.name.length>256&&a.push(`Tag name '${r.name}' exceeds maximum length of 256 characters`),l.test(r.value)||a.push(`Tag value '${r.value}' for tag '${r.name}' must only contain ASCII letters, numbers, underscores, or dashes`),a},"validateTag"),W=S((r={})=>{if(!r.apiKey)throw new P(n,"apiKey");const a={apiKey:r.apiKey,debug:r.debug??!1,endpoint:r.endpoint??R,logger:r.logger,retries:r.retries??x,timeout:r.timeout??_},l=new C,o=T(n,r.logger);return{endpoint:a.endpoint,features:{attachments:!0,batchSending:!0,customHeaders:!0,html:!0,replyTo:!0,scheduling:!0,tagging:!0,templates:!0,tracking:!0},async getEmail(e){try{if(!e)return{error:new c(n,"Email ID is required to retrieve email details"),success:!1};await l.ensureInitialized(()=>this.initialize(),n);const t={Authorization:`Bearer ${a.apiKey}`,"Content-Type":"application/json"};o.debug("Retrieving email details",{id:e});const i=await y(async()=>f(`${a.endpoint}/emails/${e}`,{headers:t,method:"GET",timeout:a.timeout}),a.retries);return i.success?(o.debug("Email details retrieved successfully"),{data:i.data?.body,success:!0}):(o.debug("API request failed when retrieving email",i.error),{error:new c(n,`Failed to retrieve email: ${i.error instanceof Error?i.error.message:"Unknown error"}`,{cause:i.error}),success:!1})}catch(t){return{error:b(n,"retrieve email",t,o),success:!1}}},async initialize(){await l.ensureInitialized(async()=>{if(!await this.isAvailable())throw new c(n,"Resend API not available or invalid API key");o.debug("Provider initialized successfully")},n)},async isAvailable(){try{if(a.apiKey&&a.apiKey.startsWith("re_"))return o.debug("API key format is valid, assuming Resend is available"),!0;const e={Authorization:`Bearer ${a.apiKey}`,"Content-Type":"application/json"};o.debug("Checking Resend API availability");const t=await f(`${a.endpoint}/domains`,{headers:e,method:"GET",timeout:a.timeout});return t.data&&typeof t.data=="object"&&"body"in t.data&&t.data.body&&typeof t.data.body=="object"&&"name"in t.data.body&&t.data.body.name==="restricted_api_key"?(o.debug("API key is valid but restricted to only sending emails"),!0):(o.debug("Resend API availability check response:",{error:t.error instanceof Error?t.error.message:void 0,statusCode:t.data?.statusCode,success:t.success}),!!(t.success&&t.data&&typeof t.data=="object"&&"statusCode"in t.data&&typeof t.data.statusCode=="number"&&t.data.statusCode>=200&&t.data.statusCode<300))}catch(e){return o.debug("Error checking availability:",e),!1}},name:n,options:a,async sendEmail(e){try{const t=E(e);if(t.length>0)return{error:new c(n,`Invalid email options: ${t.join(", ")}`),success:!1};await l.ensureInitialized(()=>this.initialize(),n);const i={from:v(e.from),headers:e.headers?j(e.headers):{},html:e.html,subject:e.subject,text:e.text,to:z(e.to)};if(e.cc&&(i.cc=w(e.cc)),e.bcc&&(i.bcc=w(e.bcc)),e.replyTo&&(i.reply_to=v(e.replyTo)),e.templateId&&(i.template=e.templateId,e.templateData&&(i.data=e.templateData)),e.scheduledAt&&(i.scheduled_at=typeof e.scheduledAt=="string"?e.scheduledAt:e.scheduledAt.toISOString()),e.tags&&e.tags.length>0){const s=[];if(e.tags.forEach(d=>{const p=D(d);p.length>0&&s.push(...p)}),s.length>0)return{error:new c(n,`Invalid email tags: ${s.join(", ")}`),success:!1};i.tags=e.tags.map(d=>({name:d.name,value:d.value}))}e.attachments&&e.attachments.length>0&&(i.attachments=await Promise.all(e.attachments.map(async s=>{let d;if(s.content)if(typeof s.content=="string")d=s.content;else if(s.content instanceof Promise){const p=await s.content;d=Buffer.from(p).toString("base64")}else d=s.content.toString("base64");else if(s.raw)d=typeof s.raw=="string"?s.raw:s.raw.toString("base64");else throw new c(n,`Attachment ${s.filename} has no content`);return{content:d,content_type:s.contentType,filename:s.filename,...s.path&&{path:s.path}}}))),o.debug("Sending email via Resend API",{subject:i.subject,to:i.to});const A={Authorization:`Bearer ${a.apiKey}`,"Content-Type":"application/json"},u=await y(async()=>f(`${a.endpoint}/emails`,{headers:A,method:"POST",timeout:a.timeout},JSON.stringify(i)),a.retries);if(!u.success)return o.debug("API request failed when sending email",u.error),{error:u.error??new c(n,"Failed to send email"),success:!1};const m=u.data,g=m?.body&&typeof m.body=="object"&&m.body.id?m.body.id:$();return o.debug("Email sent successfully",{messageId:g}),{data:{messageId:g,provider:n,response:u.data,sent:!0,timestamp:new Date},success:!0}}catch(t){return{error:b(n,"send email",t,o),success:!1}}},async validateCredentials(){return this.isAvailable()}}});export{W as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var E=Object.defineProperty;var y=(e,u)=>E(e,"name",{value:u,configurable:!0});import f from"./EmailError-zm2ffVav.js";import A from"./RequiredOptionError-CevW3u2K.js";import{c as k}from"./create-logger-BiWdqFNg.js";import{defineProvider as z}from"./defineProvider-CtLH0VBE.js";var P=Object.defineProperty,m=y((e,u)=>P(e,"name",{value:u,configurable:!0}),"f");const S=m(e=>typeof e=="function","isProviderFactory"),x=m(e=>e!=null&&typeof e=="object"&&"sendEmail"in e&&"initialize"in e&&"isAvailable"in e,"isProvider"),o="roundrobin",T=z((e={})=>{if(!e.mailers||e.mailers.length===0)throw new A(o,"mailers");const u={debug:e.debug??!1,logger:e.logger,mailers:e.mailers,retries:e.retries??3,retryAfter:e.retryAfter??60,timeout:e.timeout??3e4};let p=!1;const t=[];let a=0;const n=k(o,e.logger),v=m(async()=>{t.length=0;for(const i of u.mailers)try{let r;if(S(i))r=i({});else if(x(i))r=i;else{n.debug(`Skipping invalid mailer: ${i}`);continue}try{await r.initialize(),t.push(r),n.debug(`Initialized provider: ${r.name??"unknown"}`)}catch(s){n.debug(`Failed to initialize provider ${r.name??"unknown"}:`,s)}}catch(r){n.debug("Error processing mailer:",r)}if(t.length===0)throw new f(o,"No providers could be initialized");a=Math.floor(Math.random()*t.length),n.debug(`Round robin starting at index ${a} (${t[a]?.name??"unknown"})`)},"initializeProviders"),b=m(async()=>{if(t.length===0)return;const i=a;let r=0;for(;r<t.length;){const s=t[a];if(!s){a=(a+1)%t.length,r+=1;continue}const g=s.name??`provider-${a+1}`;try{if(await s.isAvailable())return a=(a+1)%t.length,n.debug(`Selected provider: ${g} (index ${a===0?t.length-1:a-1})`),s}catch{}a=(a+1)%t.length,r+=1,r<t.length&&u.retryAfter>0&&await new Promise(l=>{setTimeout(()=>{l(void 0)},u.retryAfter)})}return n.debug(`No available providers found, using provider at index ${i}`),t[i]??void 0},"getNextProvider");return{features:{attachments:!0,batchSending:!1,customHeaders:!0,html:!0,replyTo:!0,scheduling:!1,tagging:!1,templates:!1,tracking:!1},async initialize(){if(!p)try{await v(),p=!0,n.debug(`Round robin provider initialized with ${t.length} provider(s)`)}catch(i){throw new f(o,`Failed to initialize: ${i.message}`,{cause:i})}},async isAvailable(){try{return t.length===0&&await v(),(await Promise.allSettled(t.map(i=>i.isAvailable()))).some(i=>i.status==="fulfilled"&&i.value)}catch{return!1}},name:o,options:u,async sendEmail(i){try{if(t.length===0&&await v(),t.length===0)return{error:new f(o,"No providers available"),success:!1};const r=await b();if(!r)return{error:new f(o,"No available providers found"),success:!1};const s=r.name??"unknown";n.debug(`Sending email via ${s}`);const g=await r.sendEmail(i);if(g.success)return n.debug(`Email sent successfully via ${s}`),{data:{...g.data,provider:`${o}(${s})`},success:!0};n.debug(`Failed to send via ${s}, trying next provider`);const l=[];g.error&&l.push(g.error);let w=0;for(;w<t.length-1;){const c=await b();if(!c||c===r)break;const h=c.name??"unknown";n.debug(`Retrying with ${h}`);try{const d=await c.sendEmail(i);if(d.success)return n.debug(`Email sent successfully via ${h} (after retry)`),{data:{...d.data,provider:`${o}(${h})`},success:!0};d.error&&l.push(d.error)}catch(d){l.push(d instanceof Error?d:new Error(String(d)))}w+=1}const $=l.map(c=>c instanceof Error?c.message:String(c)).join("; ");return{error:new f(o,`Failed to send email via all providers. Errors: ${$}`,{cause:l[0]instanceof Error?l[0]:new Error(String(l[0]))}),success:!1}}catch(r){return{error:new f(o,`Failed to send email: ${r.message}`,{cause:r}),success:!1}}},async validateCredentials(){return this.isAvailable()}}});export{T as default};
|