@visulima/email 1.0.0-alpha.35 → 1.0.0-alpha.37
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 +36 -0
- package/LICENSE.md +57 -0
- package/README.md +19 -0
- package/dist/crypto/index.js +1 -1
- package/dist/deliverability/dmarc-report.js +1 -1
- package/dist/deliverability/index.js +1 -1
- package/dist/events/index.js +1 -1
- package/dist/inbound/index.js +1 -1
- package/dist/index.d.ts +5 -4
- package/dist/index.js +1 -1
- package/dist/middleware/index.js +1 -1
- package/dist/packem_shared/ALL_EVENTS-3kwh5CBE.js +1 -0
- package/dist/packem_shared/DkimSigner-BuSbnos1.js +18 -0
- package/dist/packem_shared/DraftMailMessage-C9tevR8K.js +1 -0
- package/dist/packem_shared/EmailError-B-sEf3bp.js +1 -0
- package/dist/packem_shared/Mail-DpjH0Exh.js +1 -0
- package/dist/packem_shared/MailMessage-L-Q9yc5v.js +1 -0
- package/dist/packem_shared/MemoryEventStore-CuhfO9aj.js +1 -0
- package/dist/packem_shared/MemoryQueue-Dl1Fa6OJ.js +1 -0
- package/dist/packem_shared/MemorySuppressionStore-DZnbz-_B.js +1 -0
- package/dist/packem_shared/RATE_LIMIT_PRESETS-BPADLgcA.js +1 -0
- package/dist/packem_shared/RequiredOptionError-DuNNY_a5.js +1 -0
- package/dist/packem_shared/SmimeEncrypter-C7usORKF.js +6 -0
- package/dist/packem_shared/SmimeSigner-DgAApLPS.js +8 -0
- package/dist/packem_shared/addDarkModeSupport-DZYxULjl.js +1 -0
- package/dist/packem_shared/address-formatter-BWR2Dddx.js +1 -0
- package/dist/packem_shared/aggregate-features-BqEjPd42.js +1 -0
- package/dist/packem_shared/ahaSendProvider-Dq5mElHZ.js +1 -0
- package/dist/packem_shared/arcMessageSignatureBase-BY4j0TxM.js +17 -0
- package/dist/packem_shared/attachment-processor-BjTNoMyb.js +1 -0
- package/dist/packem_shared/awsSesProvider-BGZJUIep.js +32 -0
- package/dist/packem_shared/azureProvider-DlM6UWUv.js +1 -0
- package/dist/packem_shared/brevoProvider-D_Hhc0Z-.js +1 -0
- package/dist/packem_shared/build-mime-message-Be6TOi1T.js +3 -0
- package/dist/packem_shared/buildListUnsubscribe-Cdr8MvR_.js +1 -0
- package/dist/packem_shared/buildMtaStsPolicy-oEQg8y_C.js +6 -0
- package/dist/packem_shared/circuitBreakerMiddleware-D2SA_07f.js +1 -0
- package/dist/packem_shared/cloudflareEmailProvider-D4adkOjA.js +1 -0
- package/dist/packem_shared/composeMiddleware-BHwLLEzK.js +1 -0
- package/dist/packem_shared/create-logger-BQTS3f-I.js +1 -0
- package/dist/packem_shared/createSuppressionStore-CeAZKCbY.js +1 -0
- package/dist/packem_shared/createTestEmail-BM3iNznm.js +1 -0
- package/dist/packem_shared/createWorker-_-yMWcNQ.js +1 -0
- package/dist/packem_shared/dedupeMiddleware-B6ajWOTi.js +1 -0
- package/dist/packem_shared/defineInboundHandler-CnL2BzlL.js +1 -0
- package/dist/packem_shared/defineProvider-C9q-7iwt.js +1 -0
- package/dist/packem_shared/detectMimeType-Dxv4MjZ7.js +1 -0
- package/dist/packem_shared/emailMatchers-DZDkrZ_3.js +1 -0
- package/dist/packem_shared/extractCidReferences-BuoTREMp.js +1 -0
- package/dist/packem_shared/extractReply-BUjIBt9A.js +5 -0
- package/dist/packem_shared/failoverProvider-BgX6zfnY.js +1 -0
- package/dist/packem_shared/format-address-DTl-9O70.js +1 -0
- package/dist/packem_shared/generate-boundary-DQbzDiOI.js +1 -0
- package/dist/packem_shared/generate-message-id-gXAuMz4g.js +1 -0
- package/dist/packem_shared/headers-to-record-De1Eg951.js +1 -0
- package/dist/packem_shared/httpProvider-DJAsYSun.js +1 -0
- package/dist/packem_shared/index-yDU-1zOZ.js +11 -0
- package/dist/packem_shared/infobipProvider-oOL-ThpP.js +1 -0
- package/dist/packem_shared/injectPreheader-CF9WHZ7J.js +1 -0
- package/dist/packem_shared/inlineCss-BQ7d2Cyz.js +1 -0
- package/dist/packem_shared/isValidSigningCertUrl-Bii1AMGC.js +3 -0
- package/dist/packem_shared/loggingMiddleware-CZIiVMVp.js +1 -0
- package/dist/packem_shared/{loopsProvider-DSedSU3q.js → loopsProvider-BXr0KSjB.js} +1 -1
- package/dist/packem_shared/{mail.d-LmrdSngG.d.ts → mail.d-B9SSqyy0.d.ts} +54 -6
- package/dist/packem_shared/{mailCrabProvider-xSLhA1CY.js → mailCrabProvider-C7Ao5H9p.js} +1 -1
- package/dist/packem_shared/{mailPaceProvider-CWBIjvvJ.js → mailPaceProvider-DklGeGEM.js} +1 -1
- package/dist/packem_shared/{mailchannelsProvider-zKcunGDQ.js → mailchannelsProvider-DPfQVzUd.js} +1 -1
- package/dist/packem_shared/mailerSendProvider-B8iT5Uhb.js +1 -0
- package/dist/packem_shared/mailgunProvider-Ctyrs9d0.js +1 -0
- package/dist/packem_shared/mailjetProvider-v55nFDsr.js +1 -0
- package/dist/packem_shared/mailomatProvider-BCyB4Q4B.js +1 -0
- package/dist/packem_shared/mailtrapProvider-DcVw3sxR.js +1 -0
- package/dist/packem_shared/make-request-BlK_B72c.js +1 -0
- package/dist/packem_shared/mandrillProvider-gqMFMwgs.js +1 -0
- package/dist/packem_shared/mockProvider-Behywbl1.js +1 -0
- package/dist/packem_shared/nodemailerProvider-BFHobXxt.js +1 -0
- package/dist/packem_shared/normalizeMessageId-DAx2pGe2.js +1 -0
- package/dist/packem_shared/oauth2Middleware-CodqXkyj.js +1 -0
- package/dist/packem_shared/opentelemetryProvider-ByHC01ub.js +1 -0
- package/dist/packem_shared/parseAddress-DdbViBAJ.js +1 -0
- package/dist/packem_shared/parseArfReport-Ds6S3c4J.js +6 -0
- package/dist/packem_shared/parseCloudflareInbound-C__j-oNa.js +1 -0
- package/dist/packem_shared/parseDmarcRecord-DXZ-_rF0.js +1 -0
- package/dist/packem_shared/parseMailgunInbound-BpC6uPNe.js +1 -0
- package/dist/packem_shared/parsePostmarkInbound-Co3_c6-9.js +1 -0
- package/dist/packem_shared/parseSendGridInbound-DsALoijO.js +4 -0
- package/dist/packem_shared/parseSesInbound-CH5tHIjp.js +1 -0
- package/dist/packem_shared/parseTlsReport-wPe1lIDs.js +1 -0
- package/dist/packem_shared/plunkProvider-C0LO-1E3.js +1 -0
- package/dist/packem_shared/postProcessHtml-DqKi2Ucg.js +1 -0
- package/dist/packem_shared/postalProvider-B26IqgxE.js +1 -0
- package/dist/packem_shared/{postmarkProvider-i9u0h26U.js → postmarkProvider-DWQJv5_M.js} +1 -1
- package/dist/packem_shared/provider-base-gIoUu9so.js +1 -0
- package/dist/packem_shared/quoted-printable-nSGDA1tA.js +7 -0
- package/dist/packem_shared/resendProvider-DhvKVyCD.js +1 -0
- package/dist/packem_shared/retry-3pnxTuNs.js +1 -0
- package/dist/packem_shared/retryMiddleware-DbViDX4r.js +1 -0
- package/dist/packem_shared/roundRobinProvider-D1by5KGW.js +1 -0
- package/dist/packem_shared/sanitize-header-DJhgZl3y.js +1 -0
- package/dist/packem_shared/scalewayProvider-D8dmHuwZ.js +1 -0
- package/dist/packem_shared/{sendGridProvider-CayLXvPO.js → sendGridProvider-CChhLr7s.js} +1 -1
- package/dist/packem_shared/smtpProvider-x4WBN-3W.js +25 -0
- package/dist/packem_shared/sweegoProvider-7xhOvagC.js +1 -0
- package/dist/packem_shared/toEmailSnapshot-DeRqM5SJ.js +1 -0
- package/dist/packem_shared/{types.d-BMpI2UXj.d.ts → types.d-DCkecJse.d.ts} +1 -1
- package/dist/packem_shared/utils-BfYfPB_I.js +1 -0
- package/dist/packem_shared/validate-email-options-mCM9dVug.js +1 -0
- package/dist/packem_shared/verifyMailgunWebhook-Cwl0OD3P.js +1 -0
- package/dist/packem_shared/verifyPostmarkWebhook-C72ZvbrG.js +1 -0
- package/dist/packem_shared/verifyResendWebhook-YK2zNDXR.js +1 -0
- package/dist/packem_shared/verifySendGridWebhook-Dbwc1tfG.js +1 -0
- package/dist/packem_shared/withEvents-CCVblSqj.js +1 -0
- package/dist/packem_shared/withMetrics-DWywX_6M.js +1 -0
- package/dist/packem_shared/withRender-VP9wE5Yr.js +1 -0
- package/dist/packem_shared/withSuppression-DBaZDMAr.js +1 -0
- package/dist/packem_shared/withTelemetry-DL2qo0Hp.js +1 -0
- package/dist/packem_shared/zeptomailProvider-D3nQKXRf.js +1 -0
- package/dist/providers/ahasend/index.d.ts +1 -1
- package/dist/providers/ahasend/index.js +1 -1
- package/dist/providers/aws-ses/index.d.ts +1 -1
- package/dist/providers/aws-ses/index.js +1 -1
- package/dist/providers/azure/index.d.ts +1 -1
- package/dist/providers/azure/index.js +1 -1
- package/dist/providers/brevo/index.d.ts +1 -1
- package/dist/providers/brevo/index.js +1 -1
- package/dist/providers/cloudflare-email/index.d.ts +1 -1
- package/dist/providers/cloudflare-email/index.js +1 -1
- package/dist/providers/failover/index.d.ts +1 -1
- package/dist/providers/failover/index.js +1 -1
- package/dist/providers/http/index.d.ts +1 -1
- package/dist/providers/http/index.js +1 -1
- package/dist/providers/infobip/index.d.ts +1 -1
- package/dist/providers/infobip/index.js +1 -1
- package/dist/providers/loops/index.d.ts +1 -1
- package/dist/providers/loops/index.js +1 -1
- package/dist/providers/mailchannels/index.d.ts +1 -1
- package/dist/providers/mailchannels/index.js +1 -1
- package/dist/providers/mailcrab/index.d.ts +1 -1
- package/dist/providers/mailcrab/index.js +1 -1
- package/dist/providers/mailersend/index.d.ts +1 -1
- package/dist/providers/mailersend/index.js +1 -1
- package/dist/providers/mailgun/index.d.ts +1 -1
- package/dist/providers/mailgun/index.js +1 -1
- package/dist/providers/mailjet/index.d.ts +1 -1
- package/dist/providers/mailjet/index.js +1 -1
- package/dist/providers/mailomat/index.d.ts +1 -1
- package/dist/providers/mailomat/index.js +1 -1
- package/dist/providers/mailpace/index.d.ts +1 -1
- package/dist/providers/mailpace/index.js +1 -1
- package/dist/providers/mailtrap/index.d.ts +1 -1
- package/dist/providers/mailtrap/index.js +1 -1
- package/dist/providers/mandrill/index.d.ts +1 -1
- package/dist/providers/mandrill/index.js +1 -1
- package/dist/providers/mock/index.d.ts +3 -3
- package/dist/providers/mock/index.js +1 -1
- package/dist/providers/nodemailer/index.d.ts +1 -1
- package/dist/providers/nodemailer/index.js +1 -1
- package/dist/providers/opentelemetry/index.js +1 -1
- package/dist/providers/plunk/index.d.ts +1 -1
- package/dist/providers/plunk/index.js +1 -1
- package/dist/providers/postal/index.d.ts +1 -1
- package/dist/providers/postal/index.js +1 -1
- package/dist/providers/postmark/index.d.ts +1 -1
- package/dist/providers/postmark/index.js +1 -1
- package/dist/providers/resend/index.d.ts +1 -1
- package/dist/providers/resend/index.js +1 -1
- package/dist/providers/roundrobin/index.d.ts +1 -1
- package/dist/providers/roundrobin/index.js +1 -1
- package/dist/providers/scaleway/index.d.ts +1 -1
- package/dist/providers/scaleway/index.js +1 -1
- package/dist/providers/sendgrid/index.d.ts +1 -1
- package/dist/providers/sendgrid/index.js +1 -1
- package/dist/providers/smtp/index.d.ts +1 -1
- package/dist/providers/smtp/index.js +1 -1
- package/dist/providers/sweego/index.d.ts +1 -1
- package/dist/providers/sweego/index.js +1 -1
- package/dist/providers/zeptomail/index.d.ts +1 -1
- package/dist/providers/zeptomail/index.js +1 -1
- package/dist/queue/bullmq-queue.js +1 -1
- package/dist/queue/index.d.ts +0 -1
- package/dist/queue/index.js +1 -1
- package/dist/queue/pg-boss-queue.js +1 -1
- package/dist/queue/sqs-queue.js +1 -1
- package/dist/queue/unstorage-queue.d.ts +119 -1
- package/dist/queue/unstorage-queue.js +1 -1
- package/dist/render/index.js +1 -1
- package/dist/template-engines/handlebars.js +1 -1
- package/dist/template-engines/html-to-text.js +1 -1
- package/dist/template-engines/i18n.js +1 -1
- package/dist/template-engines/jsx-email.js +1 -1
- package/dist/template-engines/liquid.js +1 -1
- package/dist/template-engines/mjml.js +1 -1
- package/dist/template-engines/react-email.js +1 -1
- package/dist/template-engines/vue-email.js +1 -1
- package/dist/test/index.d.ts +2 -2
- package/dist/test/index.js +1 -1
- package/dist/utils/cache.js +1 -1
- package/dist/utils/format-email-address.js +1 -1
- package/dist/utils/normalize-email-aliases.js +1 -1
- package/dist/utils/parse-address.js +1 -1
- package/dist/utils/parse-eml.d.ts +22 -0
- package/dist/utils/parse-eml.js +6 -0
- package/dist/utils/result.js +1 -1
- package/dist/utils/validation/check-feature-support.js +1 -1
- package/dist/utils/validation/check-mx-records.d.ts +1 -1
- package/dist/utils/validation/check-mx-records.js +1 -1
- package/dist/utils/validation/role-accounts.js +1 -1
- package/dist/utils/validation/validate-email.js +1 -1
- package/dist/utils/validation/verify-email.js +1 -1
- package/dist/utils/validation/verify-smtp.js +4 -4
- package/dist/webhooks/index.js +1 -1
- package/package.json +10 -6
- package/dist/packem_shared/ALL_EVENTS-A0nTVOo0.js +0 -1
- package/dist/packem_shared/DkimSigner-dKZ45Csc.js +0 -18
- package/dist/packem_shared/EmailError-zm2ffVav.js +0 -1
- package/dist/packem_shared/Mail-B2QII2P9.js +0 -1
- package/dist/packem_shared/MailMessage-DB1zaWfM.js +0 -1
- package/dist/packem_shared/MemoryEventStore-BEKPxa-I.js +0 -1
- package/dist/packem_shared/MemoryQueue-C-CtRRG7.js +0 -1
- package/dist/packem_shared/MemorySuppressionStore-BKY1FrA1.js +0 -1
- package/dist/packem_shared/RATE_LIMIT_PRESETS-DQF78mdO.js +0 -1
- package/dist/packem_shared/RequiredOptionError-CevW3u2K.js +0 -1
- package/dist/packem_shared/SmimeEncrypter-BirIsrip.js +0 -6
- package/dist/packem_shared/SmimeSigner-CkyaShTs.js +0 -8
- package/dist/packem_shared/addDarkModeSupport-Ys9U2-GH.js +0 -1
- package/dist/packem_shared/address-formatter-CnPg51_n.js +0 -1
- package/dist/packem_shared/aggregate-features-BvgdYul-.js +0 -1
- package/dist/packem_shared/ahaSendProvider-yuqYMW0n.js +0 -1
- package/dist/packem_shared/arcMessageSignatureBase-Cpdnv-H8.js +0 -17
- package/dist/packem_shared/attachment-processor-CFUC3V45.js +0 -1
- package/dist/packem_shared/awsSesProvider-DX1630Ms.js +0 -32
- package/dist/packem_shared/azureProvider-CK_Wuw4r.js +0 -1
- package/dist/packem_shared/brevoProvider-CNwuzzBA.js +0 -1
- package/dist/packem_shared/build-mime-message-D8WEZejb.js +0 -3
- package/dist/packem_shared/buildListUnsubscribe-CIbz0rtk.js +0 -1
- package/dist/packem_shared/circuitBreakerMiddleware-B7DlzZSG.js +0 -1
- package/dist/packem_shared/cloudflareEmailProvider-C-G821Hg.js +0 -1
- package/dist/packem_shared/composeMiddleware-CkEhbDjL.js +0 -1
- package/dist/packem_shared/create-logger-BiWdqFNg.js +0 -1
- package/dist/packem_shared/createTestEmail-hHdtgmUM.js +0 -1
- package/dist/packem_shared/createWorker-Nkc1GHet.js +0 -1
- package/dist/packem_shared/dedupeMiddleware-JeJbff46.js +0 -1
- package/dist/packem_shared/defineProvider-CtLH0VBE.js +0 -1
- package/dist/packem_shared/detectMimeType-B4QMh7k8.js +0 -1
- package/dist/packem_shared/emailMatchers-CLANeU71.js +0 -1
- package/dist/packem_shared/extractReply-CCWnNRWe.js +0 -5
- package/dist/packem_shared/failoverProvider-D90MHT2T.js +0 -1
- package/dist/packem_shared/filterSuppressed-DntqRV0q.js +0 -1
- package/dist/packem_shared/format-address-Cv6uWTS5.js +0 -1
- package/dist/packem_shared/generate-boundary-Cx8nXYS0.js +0 -1
- package/dist/packem_shared/generate-message-id-D4uA8gkj.js +0 -1
- package/dist/packem_shared/headers-to-record-Qo124ImV.js +0 -1
- package/dist/packem_shared/httpProvider-DUg1AQfO.js +0 -1
- package/dist/packem_shared/infobipProvider-DdV62IAG.js +0 -1
- package/dist/packem_shared/injectPreheader-BxPjb0eJ.js +0 -1
- package/dist/packem_shared/inlineCss-BLaEi337.js +0 -1
- package/dist/packem_shared/isValidSigningCertUrl-CF_KuCAi.js +0 -3
- package/dist/packem_shared/loggingMiddleware-CyHzn37U.js +0 -1
- package/dist/packem_shared/mailerSendProvider-BEvPlBKB.js +0 -1
- package/dist/packem_shared/mailgunProvider-CfQAINTC.js +0 -1
- package/dist/packem_shared/mailjetProvider-DEfKptWc.js +0 -1
- package/dist/packem_shared/mailomatProvider-D5sHlxZh.js +0 -1
- package/dist/packem_shared/mailtrapProvider-DwgMKakk.js +0 -1
- package/dist/packem_shared/make-request-CaT4d5oC.js +0 -1
- package/dist/packem_shared/mandrillProvider-CdGjO3Td.js +0 -1
- package/dist/packem_shared/mockProvider-C0P1lKOy.js +0 -1
- package/dist/packem_shared/nodemailerProvider-DFcvoVFv.js +0 -1
- package/dist/packem_shared/normalizeMessageId-B_9mXlh4.js +0 -1
- package/dist/packem_shared/oauth2Middleware-B1xz58iP.js +0 -1
- package/dist/packem_shared/opentelemetryProvider-Dwv88G3O.js +0 -1
- package/dist/packem_shared/parseAddress-CrYOac3K.js +0 -1
- package/dist/packem_shared/parseArfReport-CUHb8WVj.js +0 -6
- package/dist/packem_shared/parseCloudflareInbound-BGgH5u7M.js +0 -1
- package/dist/packem_shared/parseDmarcRecord-DjNqCMZc.js +0 -1
- package/dist/packem_shared/parseInbound-BP-gEjhh.js +0 -1
- package/dist/packem_shared/parseMailgunInbound-C3sZ1TiH.js +0 -1
- package/dist/packem_shared/parseMtaStsPolicy-rFOOVXXK.js +0 -6
- package/dist/packem_shared/parsePostmarkInbound-C0Ttfroo.js +0 -1
- package/dist/packem_shared/parseSendGridInbound-BkvaoYRl.js +0 -4
- package/dist/packem_shared/parseSesInbound-BFS--T8X.js +0 -1
- package/dist/packem_shared/parseTlsRptRecord-DnLwAWsk.js +0 -1
- package/dist/packem_shared/plunkProvider-BIhMU2b5.js +0 -1
- package/dist/packem_shared/postProcessHtml-C73e0b9H.js +0 -1
- package/dist/packem_shared/postalProvider-CmmbCZSi.js +0 -1
- package/dist/packem_shared/provider-base-BpHE_uK8.js +0 -1
- package/dist/packem_shared/readFile-BkNfutxp-BS8Q2183.js +0 -1
- package/dist/packem_shared/resendProvider-BNduBn0w.js +0 -1
- package/dist/packem_shared/retry-UPd8F62N.js +0 -1
- package/dist/packem_shared/retryMiddleware-DHespsU2.js +0 -1
- package/dist/packem_shared/rewriteCidLinks-B-Sd5XHs.js +0 -1
- package/dist/packem_shared/roundRobinProvider-B_60F0BC.js +0 -1
- package/dist/packem_shared/sanitize-header-wWav-Scu.js +0 -1
- package/dist/packem_shared/scalewayProvider-8gb4sIOB.js +0 -1
- package/dist/packem_shared/smtpProvider-DoXVsN4p.js +0 -24
- package/dist/packem_shared/sweegoProvider-C0g9Ajdn.js +0 -1
- package/dist/packem_shared/toEmailSnapshot-CYpMmnAA.js +0 -1
- package/dist/packem_shared/utils-BwolsGlK.js +0 -1
- package/dist/packem_shared/validate-email-options-DPo3SgC0.js +0 -1
- package/dist/packem_shared/verifyMailgunWebhook-Df7n2Quh.js +0 -1
- package/dist/packem_shared/verifyPostmarkWebhook-D_eXt_Lq.js +0 -1
- package/dist/packem_shared/verifySendGridWebhook-XOSj5yTe.js +0 -1
- package/dist/packem_shared/verifyStandardWebhook-DdUTlIVh.js +0 -1
- package/dist/packem_shared/withEvents-Q9bwpCFG.js +0 -1
- package/dist/packem_shared/withMetrics-BPs3Kdxn.js +0 -1
- package/dist/packem_shared/withRender-DQM2zbbI.js +0 -1
- package/dist/packem_shared/withSuppression-DfjV_tbI.js +0 -1
- package/dist/packem_shared/withTelemetry-CsQsv1DV.js +0 -1
- package/dist/packem_shared/zeptomailProvider-BIbHieGJ.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import n from"./parseCloudflareInbound-C__j-oNa.js";import a from"./parseMailgunInbound-BpC6uPNe.js";import i from"./parsePostmarkInbound-Co3_c6-9.js";import s from"./parseSendGridInbound-DsALoijO.js";import m from"./parseSesInbound-CH5tHIjp.js";import{extractReply as c}from"./extractReply-BUjIBt9A.js";const u=(e,r)=>{switch(e){case"cloudflare":return n(r);case"mailgun":return a(r);case"sendgrid":return s(r);case"ses":return m(r);default:return i(r)}},w=e=>({handle:async(r,o)=>{try{const t=u(r,o);return e.stripReply&&t.text!==void 0&&(t.text=c(t.text)),await e.onMessage(t),t}catch(t){if(e.onError){await e.onError(t,r,o);return}throw t}}});export{w as defineInboundHandler,u as parseInbound};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const o=e=>e;export{o as defineProvider};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{z as o}from"./index-yDU-1zOZ.js";import a from"mime";const n=e=>a.getType(e)??"application/octet-stream",p=e=>{const t=e.replaceAll(/[^a-z0-9]/gi,"-").replaceAll(/-+/g,"-").replaceAll(/^-|-$/g,"").toLowerCase(),r=Math.random().toString(36).slice(2,9);return`${t}-${r}@email`},c=e=>o(e,{buffer:!0});export{n as detectMimeType,p as generateContentId,c as readFileAsBuffer};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const o=e=>Array.isArray(e)?e:e.sent(),c=e=>e?(Array.isArray(e)?e:[e]).map(t=>t.email.toLowerCase()):[],m=e=>[...c(e.to),...c(e.cc),...c(e.bcc)],h=(e,t)=>{const n=t.toLowerCase(),s=o(e).some(a=>m(a.options).includes(n));return{message:()=>`expected ${s?"no ":""}email to have been sent to ${t}`,pass:s}},p=(e,t)=>{const n=o(e).some(s=>typeof t=="string"?s.options.subject===t:t.test(s.options.subject));return{message:()=>`expected ${n?"no ":""}email to have been sent with subject ${String(t)}`,pass:n}},v=(e,t)=>{const n=o(e).some(s=>{const a=s.options.attachments??[];return t===void 0?a.length>0:a.some(i=>i.filename===t)});return{message:()=>`expected ${n?"no ":""}email to have been sent with attachment${t?` "${t}"`:""}`,pass:n}},u=(e,t)=>{const n=typeof t=="function"?t:a=>Object.entries(t).every(([i,r])=>a[i]===r),s=o(e).some(a=>n(a.options));return{message:()=>`expected ${s?"no ":""}email to have been sent matching the given condition`,pass:s}},g={toHaveSentMatching:u,toHaveSentTo:h,toHaveSentWithAttachment:v,toHaveSentWithSubject:p},b=e=>{e.extend(g)};export{g as emailMatchers,b as registerEmailMatchers,u as toHaveSentMatching,h as toHaveSentTo,v as toHaveSentWithAttachment,p as toHaveSentWithSubject};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const o=/\b(src|href)\s*=\s*(["'])cid:([^"']+)\2/gi,d=(t,e)=>t.replaceAll(o,(r,s,c,i)=>{const n=e(i);return n===void 0?r:`${s}=${c}${n}${c}`}),l=t=>{const e=new Set;for(const r of t.matchAll(o))r[3]&&e.add(r[3]);return[...e]};export{l as extractCidReferences,d as rewriteCidLinks};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
const a=[/^On .*wrote:$/i,/^Am .*schrieb.*:$/i,/^Le .*a écrit ?:$/i,/^El .*escribió:$/i,/^.+\btarihinde\b.+yazdı:$/i],l=[/^-{2,}\s*Original Message\s*-{2,}/i,/^-{2,}\s*Forwarded message\s*-{2,}/i,/^_{5,}$/],c=/^--\s?$/,f=/^(?:from|von):\s/i,u=/^(?:to|an|cc|sent|gesendet|date|datum|subject|betreff|reply-to):\s/i,m=e=>e.startsWith(">")||l.some(r=>r.test(e))?!0:a.some(r=>r.test(e)),g=(e,r)=>{if(!f.test((e[r]??"").trim()))return!1;let i=0;for(let s=r+1;s<e.length&&i<3;s+=1){const t=e[s].trim();if(t!==""&&(i+=1,u.test(t)))return!0}return!1},p=(e,r={})=>{const{stripSignature:i=!0}=r,s=e.replaceAll(`\r
|
|
2
|
+
`,`
|
|
3
|
+
`).split(`
|
|
4
|
+
`),t=[];for(let n=0;n<s.length;n+=1){const o=s[n];if(m(o.trim())||g(s,n)||i&&c.test(o))break;t.push(o)}for(;t.length>0&&t[t.length-1].trim()==="";)t.pop();return t.join(`
|
|
5
|
+
`).trim()};export{p as extractReply};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import u from"./EmailError-B-sEf3bp.js";import b from"./RequiredOptionError-DuNNY_a5.js";import{c as w}from"./create-logger-BQTS3f-I.js";import{e as y}from"./generate-message-id-gXAuMz4g.js";import{defineProvider as $}from"./defineProvider-C9q-7iwt.js";import{d as A}from"./aggregate-features-BqEjPd42.js";const E=i=>typeof i=="function",z=i=>i!==null&&typeof i=="object"&&"sendEmail"in i&&"initialize"in i&&"isAvailable"in i,o="failover",j=$((i={})=>{if(!i.mailers||i.mailers.length===0)throw new b(o,"mailers");const d={debug:i.debug??!1,mailers:i.mailers,retryAfter:i.retryAfter??60};let v=!1;const t=[],n=w(o,i.logger);let g;const m=async()=>g||(g=(async()=>{t.length=0;for(const a of d.mailers)try{let e;if(E(a))e=a({});else if(z(a))e=a;else{n.debug(`Skipping invalid mailer: ${a}`);continue}try{await e.initialize(),t.push(e),n.debug(`Initialized provider: ${e.name??"unknown"}`)}catch(l){n.debug(`Failed to initialize provider ${e.name??"unknown"}:`,l)}}catch(e){n.debug("Error processing mailer:",e)}if(t.length===0)throw new u(o,"No providers could be initialized")})(),g);return{features:A(d.mailers),async initialize(){if(!v)try{await m(),v=!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:d,async sendEmail(a){try{if(t.length===0&&await m(),t.length===0)return{error:new u(o,"No providers available"),success:!1};const e=[];let l;for(let s=0;s<t.length;s+=1){const f=t[s];if(!f)continue;const c=f.name??`provider-${s+1}`;n.debug(`Attempting to send email via ${c} (${s+1}/${t.length})`);try{if(!await f.isAvailable()){n.debug(`Provider ${c} is not available, skipping`),e.push(new u(o,`Provider ${c} is not available`));continue}const r=await f.sendEmail(a);if(r.success&&r.data)return n.debug(`Email sent successfully via ${c}`),{data:{...r.data,messageId:r.data.messageId||y(),provider:`${o}(${c})`},success:!0};if(r.error){l=r.error,e.push(r.error);const p=r.error instanceof Error?r.error.message:String(r.error);n.debug(`Failed to send via ${c}:`,p)}}catch(r){l=r instanceof Error?r:new Error(String(r)),e.push(l);const p=l instanceof Error?l.message:String(l);n.debug(`Exception sending via ${c}:`,p)}s<t.length-1&&d.retryAfter>0&&(n.debug(`Waiting ${d.retryAfter}ms before trying next provider`),await new Promise(r=>{setTimeout(()=>{r()},d.retryAfter)}))}const h=e.map(s=>s instanceof Error?s.message:String(s)).join("; ");return{error:new u(o,`All providers failed. Errors: ${h}`,{cause:l}),success:!1}}catch(e){return{error:new u(o,`Failed to send email: ${e.message}`,{cause:e}),success:!1}}},async validateCredentials(){return this.isAvailable()}}});export{j as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const n=/[\r\n<>]/,i=e=>{let a=e.replaceAll(/[\r\n\t]+/g," ");a=[...a].filter(s=>{const t=s.codePointAt(0);return t===void 0?!1:t>=32&&t<=126||t>159}).join("");const r="\\",l='"';return a=a.replaceAll(r,r+r).replaceAll(l,r+l),a.trim().replaceAll(/\s+/g," ")},o=e=>{if(n.test(e.email))throw new Error("Invalid email address for header formatting");if(e.name){const a=i(e.name);if(a)return`"${a}" <${e.email}>`}return e.email},m=e=>(Array.isArray(e)?e:[e]).map(a=>o(a)).join(", ");export{o as a,m as f,i as s};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{createRequire as t}from"node:module";const n=t(import.meta.url),e=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,i=r=>{if(typeof e<"u"&&e.versions&&e.versions.node){const[o,s]=e.versions.node.split(".").map(Number);if(o>22||o===22&&s>=3||o===20&&s>=16)return e.getBuiltinModule(r)}return n(r)},{randomBytes:c}=i("node:crypto"),u=()=>`----_=_NextPart_${c(16).toString("hex")}`;export{u as r};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const a=()=>{const t="visulima.local",n=Date.now(),o=Math.random().toString(36).slice(2,10);return`<${n}.${o}@${t}>`};export{a as e};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const r=e=>{if(!(e instanceof Headers))return e;const n={};return e.forEach((t,o)=>{n[o]=t}),n};export{r as s};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import c from"./EmailError-B-sEf3bp.js";import g from"./RequiredOptionError-DuNNY_a5.js";import{e as w}from"./generate-message-id-gXAuMz4g.js";import{m as u}from"./make-request-BlK_B72c.js";import{f as A}from"./validate-email-options-mCM9dVug.js";import{defineProvider as j}from"./defineProvider-C9q-7iwt.js";const i="http",v="POST",f=3e4,S=j((o={})=>{if(!o.endpoint)throw new g(i,"endpoint");const a={apiKey:o.apiKey??"",endpoint:o.endpoint,headers:o.headers??{},method:o.method??v},d=()=>{const e={"Content-Type":"application/json",...a.headers};return a.apiKey&&(e.Authorization=`Bearer ${a.apiKey}`),e},p=e=>{const t={from:e.from.email,from_name:e.from.name,html:e.html,subject:e.subject,text:e.text,to:Array.isArray(e.to)?e.to.map(s=>s.email):e.to.email};return e.cc&&(t.cc=Array.isArray(e.cc)?e.cc.map(s=>s.email):e.cc.email),e.bcc&&(t.bcc=Array.isArray(e.bcc)?e.bcc.map(s=>s.email):e.bcc.email),e.customParams&&Object.assign(t,e.customParams),t};let m=!1;return{features:{attachments:!1,batchSending:!1,customHeaders:!0,html:!0,replyTo:!1,scheduling:!1,tagging:!1,templates:!1,tracking:!1},async initialize(){if(!m){if(!await this.isAvailable())throw new c(i,"API endpoint not available");m=!0}},async isAvailable(){try{return!!(await u(a.endpoint,{headers:d(),method:"OPTIONS",timeout:f})).success}catch(e){if(e instanceof Error){const t=e.message;if(t.includes("401")||t.includes("403"))return!1}return!1}},name:i,options:a,async sendEmail(e){try{const t=A(e);if(t.length>0)return{error:new c(i,`Invalid email options: ${t.join(", ")}`),success:!1};m||await this.initialize();const s=d();e.headers&&Object.assign(s,e.headers);const h=p(e),y=e.endpointOverride??a.endpoint,b=e.methodOverride??a.method,n=await u(y,{headers:s,method:b,timeout:f},JSON.stringify(h));if(!n.success)return{error:new c(i,`Failed to send email: ${n.error?.message||"Unknown error"}`,{cause:n.error}),success:!1};let l;const r=n.data?.body;return r&&typeof r=="object"&&(l=r.id??r.messageId??(r.data&&typeof r.data=="object"&&(r.data.id??r.data.messageId))),l??=w(),{data:{messageId:l,provider:i,response:n.data?.body,sent:!0,timestamp:new Date},success:!0}}catch(t){return{error:new c(i,`Failed to send email: ${t.message}`,{cause:t}),success:!1}}},async validateCredentials(){try{const e=await u(a.endpoint,{headers:d(),method:"GET",timeout:f});return!!(e.data&&typeof e.data=="object"&&"statusCode"in e.data&&typeof e.data.statusCode=="number"&&e.data.statusCode>=200&&e.data.statusCode<300)}catch{return!1}}}});export{S as default};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import{createRequire as Bt}from"node:module";const It=Bt(import.meta.url),de=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Pt=t=>{if(typeof de<"u"&&de.versions&&de.versions.node){const[e,o]=de.versions.node.split(".").map(Number);if(e>22||e===22&&o>=3||e===20&&o>=16)return de.getBuiltinModule(t)}return It(t)},{createRequire:O}=Pt("node:module"),Dt=/^[A-Z]:\//i,Gt=(t="")=>t&&t.replaceAll("\\","/").replace(Dt,e=>e.toUpperCase()),Ut=O(import.meta.url),be=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Kt=t=>{if(typeof be<"u"&&be.versions&&be.versions.node){const[e,o]=be.versions.node.split(".").map(Number);if(e>22||e===22&&o>=3||e===20&&o>=16)return be.getBuiltinModule(t)}return Ut(t)},{fileURLToPath:zt}=Kt("node:url");function Ft(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var gt,dt;function jt(){return dt||(dt=1,gt=["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"]),gt}var Xt=jt();const Qt=Ft(Xt);new Set(Qt);const Wt=t=>Gt(t instanceof URL?zt(t):t),qt=t=>{if(!t||!(t instanceof URL)&&typeof t!="string")throw new TypeError("Path must be a non-empty string or URL.")},Zt=O(import.meta.url),he=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Yt=t=>{if(typeof he<"u"&&he.versions&&he.versions.node){const[e,o]=he.versions.node.split(".").map(Number);if(e>22||e===22&&o>=3||e===20&&o>=16)return he.getBuiltinModule(t)}return Zt(t)};Yt("node:fs/promises");const Vt=O(import.meta.url),me=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Jt=t=>{if(typeof me<"u"&&me.versions&&me.versions.node){const[e,o]=me.versions.node.split(".").map(Number);if(e>22||e===22&&o>=3||e===20&&o>=16)return me.getBuiltinModule(t)}return Vt(t)};Jt("node:fs");const eo=O(import.meta.url),ye=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,to=t=>{if(typeof ye<"u"&&ye.versions&&ye.versions.node){const[e,o]=ye.versions.node.split(".").map(Number);if(e>22||e===22&&o>=3||e===20&&o>=16)return ye.getBuiltinModule(t)}return eo(t)};to("node:fs/promises");const oo=O(import.meta.url),ve=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,ro=t=>{if(typeof ve<"u"&&ve.versions&&ve.versions.node){const[e,o]=ve.versions.node.split(".").map(Number);if(e>22||e===22&&o>=3||e===20&&o>=16)return ve.getBuiltinModule(t)}return oo(t)};ro("node:fs");const so=O(import.meta.url),Re=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,no=t=>{if(typeof Re<"u"&&Re.versions&&Re.versions.node){const[e,o]=Re.versions.node.split(".").map(Number);if(e>22||e===22&&o>=3||e===20&&o>=16)return Re.getBuiltinModule(t)}return so(t)};no("node:fs/promises");const uo=O(import.meta.url),$e=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,io=t=>{if(typeof $e<"u"&&$e.versions&&$e.versions.node){const[e,o]=$e.versions.node.split(".").map(Number);if(e>22||e===22&&o>=3||e===20&&o>=16)return $e.getBuiltinModule(t)}return uo(t)};io("node:fs");const ao=O(import.meta.url),Ee=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,lo=t=>{if(typeof Ee<"u"&&Ee.versions&&Ee.versions.node){const[e,o]=Ee.versions.node.split(".").map(Number);if(e>22||e===22&&o>=3||e===20&&o>=16)return Ee.getBuiltinModule(t)}return ao(t)};lo("node:fs/promises");const po=O(import.meta.url),Ae=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,co=t=>{if(typeof Ae<"u"&&Ae.versions&&Ae.versions.node){const[e,o]=Ae.versions.node.split(".").map(Number);if(e>22||e===22&&o>=3||e===20&&o>=16)return Ae.getBuiltinModule(t)}return po(t)};co("node:fs");const fo=O(import.meta.url),_e=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,go=t=>{if(typeof _e<"u"&&_e.versions&&_e.versions.node){const[e,o]=_e.versions.node.split(".").map(Number);if(e>22||e===22&&o>=3||e===20&&o>=16)return _e.getBuiltinModule(t)}return fo(t)};go("node:fs/promises");const bo=O(import.meta.url),Te=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,ho=t=>{if(typeof Te<"u"&&Te.versions&&Te.versions.node){const[e,o]=Te.versions.node.split(".").map(Number);if(e>22||e===22&&o>=3||e===20&&o>=16)return Te.getBuiltinModule(t)}return bo(t)};ho("node:fs");O(import.meta.url);const mo=O(import.meta.url),xe=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,yo=t=>{if(typeof xe<"u"&&xe.versions&&xe.versions.node){const[e,o]=xe.versions.node.split(".").map(Number);if(e>22||e===22&&o>=3||e===20&&o>=16)return xe.getBuiltinModule(t)}return mo(t)};yo("node:fs/promises");const vo=O(import.meta.url),Ce=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Ro=t=>{if(typeof Ce<"u"&&Ce.versions&&Ce.versions.node){const[e,o]=Ce.versions.node.split(".").map(Number);if(e>22||e===22&&o>=3||e===20&&o>=16)return Ce.getBuiltinModule(t)}return vo(t)};Ro("node:fs");const $o=O(import.meta.url),Se=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Eo=t=>{if(typeof Se<"u"&&Se.versions&&Se.versions.node){const[e,o]=Se.versions.node.split(".").map(Number);if(e>22||e===22&&o>=3||e===20&&o>=16)return Se.getBuiltinModule(t)}return $o(t)};Eo("node:fs/promises");const Ao=O(import.meta.url),Oe=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,_o=t=>{if(typeof Oe<"u"&&Oe.versions&&Oe.versions.node){const[e,o]=Oe.versions.node.split(".").map(Number);if(e>22||e===22&&o>=3||e===20&&o>=16)return Oe.getBuiltinModule(t)}return Ao(t)};_o("node:fs");function pt(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var bt={},tt,ht;function Je(){if(ht)return tt;ht=1;const t="[^\\\\/]",e=Symbol("unignore"),o="\\.",N="\\+",b="\\?",s="\\/",a="(?=.)",g="[^/]",l=`(?:${s}|$)`,A=`(?:^|${s})`,d=`${o}{1,2}${l}`,x=`(?!${o})`,S=`(?!${A}${d})`,$=`(?!${o}{0,1}${l})`,M=`(?!${d})`,te=`[^.${s}]`,q=`${g}*?`,j="/",c={DOT_LITERAL:o,PLUS_LITERAL:N,QMARK_LITERAL:b,SLASH_LITERAL:s,ONE_CHAR:a,QMARK:g,END_ANCHOR:l,DOTS_SLASH:d,NO_DOT:x,NO_DOTS:S,NO_DOT_SLASH:$,NO_DOTS_SLASH:M,QMARK_NO_DOT:te,STAR:q,START_ANCHOR:A,SEP:j},h={...c,SLASH_LITERAL:"[\\\\/]",QMARK:t,STAR:`${t}*?`,DOTS_SLASH:`${o}{1,2}(?:[\\\\/]|$)`,NO_DOT:`(?!${o})`,NO_DOTS:`(?!(?:^|[\\\\/])${o}{1,2}(?:[\\\\/]|$))`,NO_DOT_SLASH:`(?!${o}{0,1}(?:[\\\\/]|$))`,NO_DOTS_SLASH:`(?!${o}{1,2}(?:[\\\\/]|$))`,QMARK_NO_DOT:"[^.\\\\/]",START_ANCHOR:"(?:^|[\\\\/])",END_ANCHOR:"(?:[\\\\/]|$)",SEP:"\\"},r={__proto__:null,alnum:"a-zA-Z0-9",alpha:"a-zA-Z",ascii:"\\x00-\\x7F",blank:" \\t",cntrl:"\\x00-\\x1F\\x7F",digit:"0-9",graph:"\\x21-\\x7E",lower:"a-z",print:"\\x20-\\x7E ",punct:"\\-!\"#$%&'()\\*+,./:;<=>?@[\\]^_`{|}~",space:" \\t\\r\\n\\v\\f",upper:"A-Z",word:"A-Za-z0-9_",xdigit:"A-Fa-f0-9"};return tt={DEFAULT_MAX_EXTGLOB_RECURSION:0,MAX_LENGTH:1024*64,POSIX_REGEX_SOURCE:r,UNIGNORE:e,REGEX_BACKSLASH:/\\(?![*+?^${}(|)[\]])/g,REGEX_NON_SPECIAL_CHARS:/^[^@![\].,$*+?^{}()|\\/]+/,REGEX_SPECIAL_CHARS:/[-*+?.^${}(|)[\]]/,REGEX_SPECIAL_CHARS_BACKREF:/(\\?)((\W)(\3*))/g,REGEX_SPECIAL_CHARS_GLOBAL:/([-*+?.^${}(|)[\]])/g,REGEX_REMOVE_BACKSLASH:/(?:\[.*?[^\\]\]|\\(?=.))/g,REPLACEMENTS:{__proto__:null,"***":"*","**/**":"**","**/**/**":"**"},CHAR_0:48,CHAR_9:57,CHAR_UPPERCASE_A:65,CHAR_LOWERCASE_A:97,CHAR_UPPERCASE_Z:90,CHAR_LOWERCASE_Z:122,CHAR_LEFT_PARENTHESES:40,CHAR_RIGHT_PARENTHESES:41,CHAR_ASTERISK:42,CHAR_AMPERSAND:38,CHAR_AT:64,CHAR_BACKWARD_SLASH:92,CHAR_CARRIAGE_RETURN:13,CHAR_CIRCUMFLEX_ACCENT:94,CHAR_COLON:58,CHAR_COMMA:44,CHAR_DOT:46,CHAR_DOUBLE_QUOTE:34,CHAR_EQUAL:61,CHAR_EXCLAMATION_MARK:33,CHAR_FORM_FEED:12,CHAR_FORWARD_SLASH:47,CHAR_GRAVE_ACCENT:96,CHAR_HASH:35,CHAR_HYPHEN_MINUS:45,CHAR_LEFT_ANGLE_BRACKET:60,CHAR_LEFT_CURLY_BRACE:123,CHAR_LEFT_SQUARE_BRACKET:91,CHAR_LINE_FEED:10,CHAR_NO_BREAK_SPACE:160,CHAR_PERCENT:37,CHAR_PLUS:43,CHAR_QUESTION_MARK:63,CHAR_RIGHT_ANGLE_BRACKET:62,CHAR_RIGHT_CURLY_BRACE:125,CHAR_RIGHT_SQUARE_BRACKET:93,CHAR_SEMICOLON:59,CHAR_SINGLE_QUOTE:39,CHAR_SPACE:32,CHAR_TAB:9,CHAR_UNDERSCORE:95,CHAR_VERTICAL_LINE:124,CHAR_ZERO_WIDTH_NOBREAK_SPACE:65279,extglobChars(m){return{"!":{type:"negate",open:"(?:(?!(?:",close:`))${m.STAR})`},"?":{type:"qmark",open:"(?:",close:")?"},"+":{type:"plus",open:"(?:",close:")+"},"*":{type:"star",open:"(?:",close:")*"},"@":{type:"at",open:"(?:",close:")"}}},globChars(m){return m===!0?h:c}},tt}var mt;function et(){return mt||(mt=1,(function(t){const{REGEX_BACKSLASH:e,REGEX_REMOVE_BACKSLASH:o,REGEX_SPECIAL_CHARS:N,REGEX_SPECIAL_CHARS_GLOBAL:b}=Je();t.isObject=s=>s!==null&&typeof s=="object"&&!Array.isArray(s),t.hasRegexChars=s=>N.test(s),t.isRegexChar=s=>s.length===1&&t.hasRegexChars(s),t.escapeRegex=s=>s.replace(b,"\\$1"),t.toPosixSlashes=s=>s.replace(e,"/"),t.isWindows=()=>{if(typeof navigator<"u"&&navigator.platform){const s=navigator.platform.toLowerCase();return s==="win32"||s==="windows"}return process.platform?process.platform==="win32":!1},t.removeBackslashes=s=>s.replace(o,a=>a==="\\"?"":a),t.escapeLast=(s,a,g)=>{const l=s.lastIndexOf(a,g);return l===-1?s:s[l-1]==="\\"?t.escapeLast(s,a,l-1):`${s.slice(0,l)}\\${s.slice(l)}`},t.removePrefix=(s,a={})=>{let g=s;return g.startsWith("./")&&(g=g.slice(2),a.prefix="./"),g},t.wrapOutput=(s,a={},g={})=>{const l=g.contains?"":"^",A=g.contains?"":"$";let d=`${l}(?:${s})${A}`;return a.negated===!0&&(d=`(?:^(?!${d}).*$)`),d},t.basename=(s,{windows:a}={})=>{const g=s.split(a?/[\\/]/:"/"),l=g[g.length-1];return l===""?g[g.length-2]:l}})(bt)),bt}var ot,yt;function To(){if(yt)return ot;yt=1;const t=et(),{CHAR_ASTERISK:e,CHAR_AT:o,CHAR_BACKWARD_SLASH:N,CHAR_COMMA:b,CHAR_DOT:s,CHAR_EXCLAMATION_MARK:a,CHAR_FORWARD_SLASH:g,CHAR_LEFT_CURLY_BRACE:l,CHAR_LEFT_PARENTHESES:A,CHAR_LEFT_SQUARE_BRACKET:d,CHAR_PLUS:x,CHAR_QUESTION_MARK:S,CHAR_RIGHT_CURLY_BRACE:$,CHAR_RIGHT_PARENTHESES:M,CHAR_RIGHT_SQUARE_BRACKET:te}=Je(),q=c=>c===g||c===N,j=c=>{c.isPrefix!==!0&&(c.depth=c.isGlobstar?1/0:1)};return ot=(c,h)=>{const r=h||{},m=c.length-1,v=r.parts===!0||r.scanToEnd===!0,R=[],y=[],H=[];let X=c,Z=-1,U=0,oe=0,Q=!1,re=!1,I=!1,ae=!1,fe=!1,se=!1,L=!1,ne=!1,ge=!1,W=!1,F=0,V,E,C={value:"",depth:0,isGlob:!1};const i=()=>Z>=m,Y=()=>X.charCodeAt(Z+1),K=()=>(V=E,X.charCodeAt(++Z));for(;Z<m;){E=K();let w;if(E===N){L=C.backslashes=!0,E=K(),E===l&&(se=!0);continue}if(se===!0||E===l){for(F++;i()!==!0&&(E=K());){if(E===N){L=C.backslashes=!0,K();continue}if(E===l){F++;continue}if(se!==!0&&E===s&&(E=K())===s){if(Q=C.isBrace=!0,I=C.isGlob=!0,W=!0,v===!0)continue;break}if(se!==!0&&E===b){if(Q=C.isBrace=!0,I=C.isGlob=!0,W=!0,v===!0)continue;break}if(E===$&&(F--,F===0)){se=!1,Q=C.isBrace=!0,W=!0;break}}if(v===!0)continue;break}if(E===g){if(R.push(Z),y.push(C),C={value:"",depth:0,isGlob:!1},W===!0)continue;if(V===s&&Z===U+1){U+=2;continue}oe=Z+1;continue}if(r.noext!==!0&&(E===x||E===o||E===e||E===S||E===a)&&Y()===A){if(I=C.isGlob=!0,ae=C.isExtglob=!0,W=!0,E===a&&Z===U&&(ge=!0),v===!0){for(;i()!==!0&&(E=K());){if(E===N){L=C.backslashes=!0,E=K();continue}if(E===M){I=C.isGlob=!0,W=!0;break}}continue}break}if(E===e){if(V===e&&(fe=C.isGlobstar=!0),I=C.isGlob=!0,W=!0,v===!0)continue;break}if(E===S){if(I=C.isGlob=!0,W=!0,v===!0)continue;break}if(E===d){for(;i()!==!0&&(w=K());){if(w===N){L=C.backslashes=!0,K();continue}if(w===te){re=C.isBracket=!0,I=C.isGlob=!0,W=!0;break}}if(v===!0)continue;break}if(r.nonegate!==!0&&E===a&&Z===U){ne=C.negated=!0,U++;continue}if(r.noparen!==!0&&E===A){if(I=C.isGlob=!0,v===!0){for(;i()!==!0&&(E=K());){if(E===A){L=C.backslashes=!0,E=K();continue}if(E===M){W=!0;break}}continue}break}if(I===!0){if(W=!0,v===!0)continue;break}}r.noext===!0&&(ae=!1,I=!1);let G=X,n="",u="";U>0&&(n=X.slice(0,U),X=X.slice(U),oe-=U),G&&I===!0&&oe>0?(G=X.slice(0,oe),u=X.slice(oe)):I===!0?(G="",u=X):G=X,G&&G!==""&&G!=="/"&&G!==X&&q(G.charCodeAt(G.length-1))&&(G=G.slice(0,-1)),r.unescape===!0&&(u&&(u=t.removeBackslashes(u)),G&&L===!0&&(G=t.removeBackslashes(G)));const ee={prefix:n,input:c,start:U,base:G,glob:u,isBrace:Q,isBracket:re,isGlob:I,isExtglob:ae,isGlobstar:fe,negated:ne,negatedExtglob:ge};if(r.tokens===!0&&(ee.maxDepth=0,q(E)||y.push(C),ee.tokens=y),r.parts===!0||r.tokens===!0){let w;for(let P=0;P<R.length;P++){const le=w?w+1:U,J=R[P],pe=c.slice(le,J);r.tokens&&(P===0&&U!==0?(y[P].isPrefix=!0,y[P].value=n):y[P].value=pe,j(y[P]),ee.maxDepth+=y[P].depth),(P!==0||pe!=="")&&H.push(pe),w=J}if(w&&w+1<c.length){const P=c.slice(w+1);H.push(P),r.tokens&&(y[y.length-1].value=P,j(y[y.length-1]),ee.maxDepth+=y[y.length-1].depth)}ee.slashes=R,ee.parts=H}return ee},ot}var rt,vt;function xo(){if(vt)return rt;vt=1;const t=Je(),e=et(),{MAX_LENGTH:o,POSIX_REGEX_SOURCE:N,REGEX_NON_SPECIAL_CHARS:b,REGEX_SPECIAL_CHARS_BACKREF:s,REPLACEMENTS:a}=t,g=(c,h)=>typeof h.expandRange=="function"?h.expandRange(...c,h):(c.sort(),`[${c.join("-")}]`),l=(c,h)=>`Missing ${c}: "${h}" - use "\\\\${h}" to match literal characters`,A=c=>{const h=[];let r=0,m=0,v=0,R="",y=!1;for(const H of c){if(y===!0){R+=H,y=!1;continue}if(H==="\\"){R+=H,y=!0;continue}if(H==='"'){v=v===1?0:1,R+=H;continue}if(v===0){if(H==="[")r++;else if(H==="]"&&r>0)r--;else if(r===0){if(H==="(")m++;else if(H===")"&&m>0)m--;else if(H==="|"&&m===0){h.push(R),R="";continue}}}R+=H}return h.push(R),h},d=c=>{let h=!1;for(const r of c){if(h===!0){h=!1;continue}if(r==="\\"){h=!0;continue}if(/[?*+@!()[\]{}]/.test(r))return!1}return!0},x=c=>{let h=c.trim(),r=!0;for(;r===!0;)r=!1,/^@\([^\\()[\]{}|]+\)$/.test(h)&&(h=h.slice(2,-1),r=!0);if(d(h))return h.replace(/\\(.)/g,"$1")},S=c=>{const h=c.map(x).filter(Boolean);for(let r=0;r<h.length;r++)for(let m=r+1;m<h.length;m++){const v=h[r],R=h[m],y=v[0];if(!(!y||v!==y.repeat(v.length)||R!==y.repeat(R.length))&&(v===R||v.startsWith(R)||R.startsWith(v)))return!0}return!1},$=(c,h=!0)=>{if(c[0]!=="+"&&c[0]!=="*"||c[1]!=="(")return;let r=0,m=0,v=0,R=!1;for(let y=1;y<c.length;y++){const H=c[y];if(R===!0){R=!1;continue}if(H==="\\"){R=!0;continue}if(H==='"'){v=v===1?0:1;continue}if(v!==1){if(H==="["){r++;continue}if(H==="]"&&r>0){r--;continue}if(!(r>0)){if(H==="("){m++;continue}if(H===")"&&(m--,m===0))return h===!0&&y!==c.length-1?void 0:{type:c[0],body:c.slice(2,y),end:y}}}}},M=c=>{let h=0;const r=[];for(;h<c.length;){const m=$(c.slice(h),!1);if(!m||m.type!=="*")return;const v=A(m.body).map(y=>y.trim());if(v.length!==1)return;const R=x(v[0]);if(!R||R.length!==1)return;r.push(R),h+=m.end+1}return r.length<1?void 0:`${r.length===1?e.escapeRegex(r[0]):`[${r.map(m=>e.escapeRegex(m)).join("")}]`}*`},te=c=>{let h=0,r=c.trim(),m=$(r);for(;m;)h++,r=m.body.trim(),m=$(r);return h},q=(c,h)=>{if(h.maxExtglobRecursion===!1)return{risky:!1};const r=typeof h.maxExtglobRecursion=="number"?h.maxExtglobRecursion:t.DEFAULT_MAX_EXTGLOB_RECURSION,m=A(c).map(v=>v.trim());if(m.length>1&&(m.some(v=>v==="")||m.some(v=>/^[*?]+$/.test(v))||S(m)))return{risky:!0};for(const v of m){const R=M(v);if(R)return{risky:!0,safeOutput:R};if(te(v)>r)return{risky:!0}}return{risky:!1}},j=(c,h)=>{if(typeof c!="string")throw new TypeError("Expected a string");c=a[c]||c;const r={...h},m=typeof r.maxLength=="number"?Math.min(o,r.maxLength):o;let v=c.length;if(v>m)throw new SyntaxError(`Input length: ${v}, exceeds maximum allowed length: ${m}`);const R={type:"bos",value:"",output:r.prepend||""},y=[R],H=r.capture?"":"?:",X=t.globChars(r.windows),Z=t.extglobChars(X),{DOT_LITERAL:U,PLUS_LITERAL:oe,SLASH_LITERAL:Q,ONE_CHAR:re,DOTS_SLASH:I,NO_DOT:ae,NO_DOT_SLASH:fe,NO_DOTS_SLASH:se,QMARK:L,QMARK_NO_DOT:ne,STAR:ge,START_ANCHOR:W}=X,F=f=>`(${H}(?:(?!${W}${f.dot?I:U}).)*?)`,V=r.dot?"":ae,E=r.dot?L:ne;let C=r.bash===!0?F(r):ge;r.capture&&(C=`(${C})`),typeof r.noext=="boolean"&&(r.noextglob=r.noext);const i={input:c,index:-1,start:0,dot:r.dot===!0,consumed:"",output:"",prefix:"",backtrack:!1,negated:!1,brackets:0,braces:0,parens:0,quotes:0,globstar:!1,tokens:y};c=e.removePrefix(c,i),v=c.length;const Y=[],K=[],G=[];let n=R,u;const ee=()=>i.index===v-1,w=i.peek=(f=1)=>c[i.index+f],P=i.advance=()=>c[++i.index]||"",le=()=>c.slice(i.index+1),J=(f="",B=0)=>{i.consumed+=f,i.index+=B},pe=f=>{i.output+=f.output!=null?f.output:f.value,J(f.value)},Lt=()=>{let f=1;for(;w()==="!"&&(w(2)!=="("||w(3)==="?");)P(),i.start++,f++;return f%2===0?!1:(i.negated=!0,i.start++,!0)},Ye=f=>{i[f]++,G.push(f)},ce=f=>{i[f]--,G.pop()},_=f=>{if(n.type==="globstar"){const B=i.braces>0&&(f.type==="comma"||f.type==="brace"),p=f.extglob===!0||Y.length&&(f.type==="pipe"||f.type==="paren");f.type!=="slash"&&f.type!=="paren"&&!B&&!p&&(i.output=i.output.slice(0,-n.output.length),n.type="star",n.value="*",n.output=C,i.output+=n.output)}if(Y.length&&f.type!=="paren"&&(Y[Y.length-1].inner+=f.value),(f.value||f.output)&&pe(f),n&&n.type==="text"&&f.type==="text"){n.output=(n.output||n.value)+f.value,n.value+=f.value;return}f.prev=n,y.push(f),n=f},Ve=(f,B)=>{const p={...Z[B],conditions:1,inner:""};p.prev=n,p.parens=i.parens,p.output=i.output,p.startIndex=i.index,p.tokensIndex=y.length;const T=(r.capture?"(":"")+p.open;Ye("parens"),_({type:f,value:B,output:i.output?"":re}),_({type:"paren",extglob:!0,value:P(),output:T}),Y.push(p)},Mt=f=>{const B=c.slice(f.startIndex,i.index+1),p=c.slice(f.startIndex+2,i.index),T=q(p,r);if((f.type==="plus"||f.type==="star")&&T.risky){const k=T.safeOutput?(f.output?"":re)+(r.capture?`(${T.safeOutput})`:T.safeOutput):void 0,ue=y[f.tokensIndex];ue.type="text",ue.value=B,ue.output=k||e.escapeRegex(B);for(let ie=f.tokensIndex+1;ie<y.length;ie++)y[ie].value="",y[ie].output="",delete y[ie].suffix;i.output=f.output+ue.output,i.backtrack=!0,_({type:"paren",extglob:!0,value:u,output:""}),ce("parens");return}let D=f.close+(r.capture?")":""),z;if(f.type==="negate"){let k=C;if(f.inner&&f.inner.length>1&&f.inner.includes("/")&&(k=F(r)),(k!==C||ee()||/^\)+$/.test(le()))&&(D=f.close=`)$))${k}`),f.inner.includes("*")&&(z=le())&&/^\.[^\\/.]+$/.test(z)){const ue=j(z,{...h,fastpaths:!1}).output;D=f.close=`)${ue})${k})`}f.prev.type==="bos"&&(i.negatedExtglob=!0)}_({type:"paren",extglob:!0,value:u,output:D}),ce("parens")};if(r.fastpaths!==!1&&!/(^[*!]|[/()[\]{}"])/.test(c)){let f=!1,B=c.replace(s,(p,T,D,z,k,ue)=>z==="\\"?(f=!0,p):z==="?"?T?T+z+(k?L.repeat(k.length):""):ue===0?E+(k?L.repeat(k.length):""):L.repeat(D.length):z==="."?U.repeat(D.length):z==="*"?T?T+z+(k?C:""):C:T?p:`\\${p}`);return f===!0&&(r.unescape===!0?B=B.replace(/\\/g,""):B=B.replace(/\\+/g,p=>p.length%2===0?"\\\\":p?"\\":"")),B===c&&r.contains===!0?(i.output=c,i):(i.output=e.wrapOutput(B,i,h),i)}for(;!ee();){if(u=P(),u==="\0")continue;if(u==="\\"){const p=w();if(p==="/"&&r.bash!==!0||p==="."||p===";")continue;if(!p){u+="\\",_({type:"text",value:u});continue}const T=/^\\+/.exec(le());let D=0;if(T&&T[0].length>2&&(D=T[0].length,i.index+=D,D%2!==0&&(u+="\\")),r.unescape===!0?u=P():u+=P(),i.brackets===0){_({type:"text",value:u});continue}}if(i.brackets>0&&(u!=="]"||n.value==="["||n.value==="[^")){if(r.posix!==!1&&u===":"){const p=n.value.slice(1);if(p.includes("[")&&(n.posix=!0,p.includes(":"))){const T=n.value.lastIndexOf("["),D=n.value.slice(0,T),z=n.value.slice(T+2),k=N[z];if(k){n.value=D+k,i.backtrack=!0,P(),!R.output&&y.indexOf(n)===1&&(R.output=re);continue}}}(u==="["&&w()!==":"||u==="-"&&w()==="]")&&(u=`\\${u}`),u==="]"&&(n.value==="["||n.value==="[^")&&(u=`\\${u}`),r.posix===!0&&u==="!"&&n.value==="["&&(u="^"),n.value+=u,pe({value:u});continue}if(i.quotes===1&&u!=='"'){u=e.escapeRegex(u),n.value+=u,pe({value:u});continue}if(u==='"'){i.quotes=i.quotes===1?0:1,r.keepQuotes===!0&&_({type:"text",value:u});continue}if(u==="("){Ye("parens"),_({type:"paren",value:u});continue}if(u===")"){if(i.parens===0&&r.strictBrackets===!0)throw new SyntaxError(l("opening","("));const p=Y[Y.length-1];if(p&&i.parens===p.parens+1){Mt(Y.pop());continue}_({type:"paren",value:u,output:i.parens?")":"\\)"}),ce("parens");continue}if(u==="["){if(r.nobracket===!0||!le().includes("]")){if(r.nobracket!==!0&&r.strictBrackets===!0)throw new SyntaxError(l("closing","]"));u=`\\${u}`}else Ye("brackets");_({type:"bracket",value:u});continue}if(u==="]"){if(r.nobracket===!0||n&&n.type==="bracket"&&n.value.length===1){_({type:"text",value:u,output:`\\${u}`});continue}if(i.brackets===0){if(r.strictBrackets===!0)throw new SyntaxError(l("opening","["));_({type:"text",value:u,output:`\\${u}`});continue}ce("brackets");const p=n.value.slice(1);if(n.posix!==!0&&p[0]==="^"&&!p.includes("/")&&(u=`/${u}`),n.value+=u,pe({value:u}),r.literalBrackets===!1||e.hasRegexChars(p))continue;const T=e.escapeRegex(n.value);if(i.output=i.output.slice(0,-n.value.length),r.literalBrackets===!0){i.output+=T,n.value=T;continue}n.value=`(${H}${T}|${n.value})`,i.output+=n.value;continue}if(u==="{"&&r.nobrace!==!0){Ye("braces");const p={type:"brace",value:u,output:"(",outputIndex:i.output.length,tokensIndex:i.tokens.length};K.push(p),_(p);continue}if(u==="}"){const p=K[K.length-1];if(r.nobrace===!0||!p){_({type:"text",value:u,output:u});continue}let T=")";if(p.dots===!0){const D=y.slice(),z=[];for(let k=D.length-1;k>=0&&(y.pop(),D[k].type!=="brace");k--)D[k].type!=="dots"&&z.unshift(D[k].value);T=g(z,r),i.backtrack=!0}if(p.comma!==!0&&p.dots!==!0){const D=i.output.slice(0,p.outputIndex),z=i.tokens.slice(p.tokensIndex);p.value=p.output="\\{",u=T="\\}",i.output=D;for(const k of z)i.output+=k.output||k.value}_({type:"brace",value:u,output:T}),ce("braces"),K.pop();continue}if(u==="|"){Y.length>0&&Y[Y.length-1].conditions++,_({type:"text",value:u});continue}if(u===","){let p=u;const T=K[K.length-1];T&&G[G.length-1]==="braces"&&(T.comma=!0,p="|"),_({type:"comma",value:u,output:p});continue}if(u==="/"){if(n.type==="dot"&&i.index===i.start+1){i.start=i.index+1,i.consumed="",i.output="",y.pop(),n=R;continue}_({type:"slash",value:u,output:Q});continue}if(u==="."){if(i.braces>0&&n.type==="dot"){n.value==="."&&(n.output=U);const p=K[K.length-1];n.type="dots",n.output+=u,n.value+=u,p.dots=!0;continue}if(i.braces+i.parens===0&&n.type!=="bos"&&n.type!=="slash"){_({type:"text",value:u,output:U});continue}_({type:"dot",value:u,output:U});continue}if(u==="?"){if(!(n&&n.value==="(")&&r.noextglob!==!0&&w()==="("&&w(2)!=="?"){Ve("qmark",u);continue}if(n&&n.type==="paren"){const p=w();let T=u;(n.value==="("&&!/[!=<:]/.test(p)||p==="<"&&!/<([!=]|\w+>)/.test(le()))&&(T=`\\${u}`),_({type:"text",value:u,output:T});continue}if(r.dot!==!0&&(n.type==="slash"||n.type==="bos")){_({type:"qmark",value:u,output:ne});continue}_({type:"qmark",value:u,output:L});continue}if(u==="!"){if(r.noextglob!==!0&&w()==="("&&(w(2)!=="?"||!/[!=<:]/.test(w(3)))){Ve("negate",u);continue}if(r.nonegate!==!0&&i.index===0){Lt();continue}}if(u==="+"){if(r.noextglob!==!0&&w()==="("&&w(2)!=="?"){Ve("plus",u);continue}if(n&&n.value==="("||r.regex===!1){_({type:"plus",value:u,output:oe});continue}if(n&&(n.type==="bracket"||n.type==="paren"||n.type==="brace")||i.parens>0){_({type:"plus",value:u});continue}_({type:"plus",value:oe});continue}if(u==="@"){if(r.noextglob!==!0&&w()==="("&&w(2)!=="?"){_({type:"at",extglob:!0,value:u,output:""});continue}_({type:"text",value:u});continue}if(u!=="*"){(u==="$"||u==="^")&&(u=`\\${u}`);const p=b.exec(le());p&&(u+=p[0],i.index+=p[0].length),_({type:"text",value:u});continue}if(n&&(n.type==="globstar"||n.star===!0)){n.type="star",n.star=!0,n.value+=u,n.output=C,i.backtrack=!0,i.globstar=!0,J(u);continue}let f=le();if(r.noextglob!==!0&&/^\([^?]/.test(f)){Ve("star",u);continue}if(n.type==="star"){if(r.noglobstar===!0){J(u);continue}const p=n.prev,T=p.prev,D=p.type==="slash"||p.type==="bos",z=T&&(T.type==="star"||T.type==="globstar");if(r.bash===!0&&(!D||f[0]&&f[0]!=="/")){_({type:"star",value:u,output:""});continue}const k=i.braces>0&&(p.type==="comma"||p.type==="brace"),ue=Y.length&&(p.type==="pipe"||p.type==="paren");if(!D&&p.type!=="paren"&&!k&&!ue){_({type:"star",value:u,output:""});continue}for(;f.slice(0,3)==="/**";){const ie=c[i.index+4];if(ie&&ie!=="/")break;f=f.slice(3),J("/**",3)}if(p.type==="bos"&&ee()){n.type="globstar",n.value+=u,n.output=F(r),i.output=n.output,i.globstar=!0,J(u);continue}if(p.type==="slash"&&p.prev.type!=="bos"&&!z&&ee()){i.output=i.output.slice(0,-(p.output+n.output).length),p.output=`(?:${p.output}`,n.type="globstar",n.output=F(r)+(r.strictSlashes?")":"|$)"),n.value+=u,i.globstar=!0,i.output+=p.output+n.output,J(u);continue}if(p.type==="slash"&&p.prev.type!=="bos"&&f[0]==="/"){const ie=f[1]!==void 0?"|$":"";i.output=i.output.slice(0,-(p.output+n.output).length),p.output=`(?:${p.output}`,n.type="globstar",n.output=`${F(r)}${Q}|${Q}${ie})`,n.value+=u,i.output+=p.output+n.output,i.globstar=!0,J(u+P()),_({type:"slash",value:"/",output:""});continue}if(p.type==="bos"&&f[0]==="/"){n.type="globstar",n.value+=u,n.output=`(?:^|${Q}|${F(r)}${Q})`,i.output=n.output,i.globstar=!0,J(u+P()),_({type:"slash",value:"/",output:""});continue}if(k&&f[0]==="/"){n.type="globstar",n.value+=u,n.output=`(?:^|${Q}|${F(r)}${Q})`,i.output+=n.output,i.globstar=!0,J(u+P()),_({type:"slash",value:"/",output:""});continue}i.output=i.output.slice(0,-n.output.length),n.type="globstar",n.output=F(r),n.value+=u,i.output+=n.output,i.globstar=!0,J(u);continue}const B={type:"star",value:u,output:C};if(r.bash===!0){B.output=".*?",(n.type==="bos"||n.type==="slash")&&(B.output=V+B.output),_(B);continue}if(n&&(n.type==="bracket"||n.type==="paren")&&r.regex===!0){B.output=u,_(B);continue}(i.index===i.start||n.type==="slash"||n.type==="dot")&&(n.type==="dot"?(i.output+=fe,n.output+=fe):r.dot===!0?(i.output+=se,n.output+=se):(i.output+=V,n.output+=V),w()!=="*"&&(i.output+=re,n.output+=re)),_(B)}for(;i.brackets>0;){if(r.strictBrackets===!0)throw new SyntaxError(l("closing","]"));i.output=e.escapeLast(i.output,"["),ce("brackets")}for(;i.parens>0;){if(r.strictBrackets===!0)throw new SyntaxError(l("closing",")"));i.output=e.escapeLast(i.output,"("),ce("parens")}for(;i.braces>0;){if(r.strictBrackets===!0)throw new SyntaxError(l("closing","}"));i.output=e.escapeLast(i.output,"{"),ce("braces")}if(r.strictSlashes!==!0&&(n.type==="star"||n.type==="bracket")&&_({type:"maybe_slash",value:"",output:`${Q}?`}),i.backtrack===!0){i.output="";for(const f of i.tokens)i.output+=f.output!=null?f.output:f.value,f.suffix&&(i.output+=f.suffix)}return i};return j.fastpaths=(c,h)=>{const r={...h},m=typeof r.maxLength=="number"?Math.min(o,r.maxLength):o,v=c.length;if(v>m)throw new SyntaxError(`Input length: ${v}, exceeds maximum allowed length: ${m}`);c=a[c]||c;const{DOT_LITERAL:R,SLASH_LITERAL:y,ONE_CHAR:H,DOTS_SLASH:X,NO_DOT:Z,NO_DOTS:U,NO_DOTS_SLASH:oe,STAR:Q,START_ANCHOR:re}=t.globChars(r.windows),I=r.dot?U:Z,ae=r.dot?oe:Z,fe=r.capture?"":"?:",se={negated:!1,prefix:""};let L=r.bash===!0?".*?":Q;r.capture&&(L=`(${L})`);const ne=V=>V.noglobstar===!0?L:`(${fe}(?:(?!${re}${V.dot?X:R}).)*?)`,ge=V=>{switch(V){case"*":return`${I}${H}${L}`;case".*":return`${R}${H}${L}`;case"*.*":return`${I}${L}${R}${H}${L}`;case"*/*":return`${I}${L}${y}${H}${ae}${L}`;case"**":return I+ne(r);case"**/*":return`(?:${I}${ne(r)}${y})?${ae}${H}${L}`;case"**/*.*":return`(?:${I}${ne(r)}${y})?${ae}${L}${R}${H}${L}`;case"**/.*":return`(?:${I}${ne(r)}${y})?${R}${H}${L}`;default:{const E=/^(.*?)\.(\w+)$/.exec(V);if(!E)return;const C=ge(E[1]);return C?C+R+E[2]:void 0}}},W=e.removePrefix(c,se);let F=ge(W);return F&&r.strictSlashes!==!0&&(F+=`${y}?`),F},rt=j,rt}var st,Rt;function Co(){if(Rt)return st;Rt=1;const t=To(),e=xo(),o=et(),N=Je(),b=a=>a&&typeof a=="object"&&!Array.isArray(a),s=(a,g,l=!1)=>{if(Array.isArray(a)){const q=a.map(j=>s(j,g,l));return j=>{for(const c of q){const h=c(j);if(h)return h}return!1}}const A=b(a)&&a.tokens&&a.input;if(a===""||typeof a!="string"&&!A)throw new TypeError("Expected pattern to be a non-empty string");const d=g||{},x=d.windows,S=A?s.compileRe(a,g):s.makeRe(a,g,!1,!0),$=S.state;delete S.state;let M=()=>!1;if(d.ignore){const q={...g,ignore:null,onMatch:null,onResult:null};M=s(d.ignore,q,l)}const te=(q,j=!1)=>{const{isMatch:c,match:h,output:r}=s.test(q,S,g,{glob:a,posix:x}),m={glob:a,state:$,regex:S,posix:x,input:q,output:r,match:h,isMatch:c};if(typeof d.onResult=="function"&&d.onResult(m),c===!1)return m.isMatch=!1,j?m:!1;e:if(M(q)){if(typeof d.onIgnore=="function"&&d.onIgnore(m)===N.UNIGNORE){m.isMatch=!0;break e}return m.isMatch=!1,j?m:!1}return typeof d.onMatch=="function"&&d.onMatch(m),j?m:!0};return l&&(te.state=$),te};return s.test=(a,g,l,{glob:A,posix:d}={})=>{if(typeof a!="string")throw new TypeError("Expected input to be a string");if(a==="")return{isMatch:!1,output:""};const x=l||{},S=x.format||(d?o.toPosixSlashes:null);let $=a===A,M=$&&S?S(a):a;return $===!1&&(M=S?S(a):a,$=M===A),($===!1||x.capture===!0)&&(x.matchBase===!0||x.basename===!0?$=s.matchBase(a,g,l,d):$=g.exec(M)),{isMatch:!!$,match:$,output:M}},s.matchBase=(a,g,l)=>(g instanceof RegExp?g:s.makeRe(g,l)).test(o.basename(a)),s.isMatch=(a,g,l)=>s(g,l)(a),s.parse=(a,g)=>Array.isArray(a)?a.map(l=>s.parse(l,g)):e(a,{...g,fastpaths:!1}),s.scan=(a,g)=>t(a,g),s.compileRe=(a,g,l=!1,A=!1)=>{if(l===!0)return a.output;const d=g||{},x=d.contains?"":"^",S=d.contains?"":"$";let $=`${x}(?:${a.output})${S}`;a&&a.negated===!0&&($=`^(?!${$}).*$`);const M=s.toRegex($,g);return A===!0&&(M.state=a),M},s.makeRe=(a,g={},l=!1,A=!1)=>{if(!a||typeof a!="string")throw new TypeError("Expected a non-empty string");let d={negated:!1,fastpaths:!0};return g.fastpaths!==!1&&(a[0]==="."||a[0]==="*")&&(d.output=e.fastpaths(a,g)),d.output||(d=e(a,g)),s.compileRe(d,g,l,A)},s.toRegex=(a,g)=>{try{const l=g||{};return new RegExp(a,l.flags||(l.nocase?"i":""))}catch(l){if(g&&g.debug===!0)throw l;return/$^/}},s.constants=N,st=s,st}var nt,$t;function So(){if($t)return nt;$t=1;const t=Co(),e=et();function o(N,b,s=!1){return b&&(b.windows===null||b.windows===void 0)&&(b={...b,windows:e.isWindows()}),t(N,b,s)}return Object.assign(o,t),nt=o,nt}var Oo=So();pt(Oo);const Ho=O(import.meta.url),He=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Ze=t=>{if(typeof He<"u"&&He.versions&&He.versions.node){const[e,o]=He.versions.node.split(".").map(Number);if(e>22||e===22&&o>=3||e===20&&o>=16)return He.getBuiltinModule(t)}return Ho(t)};Ze("fs");Ze("fs");Ze("path");Ze("url");const{createRequire:wo}=Ze("module");var Et=wo(import.meta.url);try{Et.resolve("picomatch"),Et("picomatch")}catch{}var ut,At;function No(){if(At)return ut;At=1;/*!
|
|
2
|
+
* is-extglob <https://github.com/jonschlinkert/is-extglob>
|
|
3
|
+
*
|
|
4
|
+
* Copyright (c) 2014-2016, Jon Schlinkert.
|
|
5
|
+
* Licensed under the MIT License.
|
|
6
|
+
*/return ut=function(t){if(typeof t!="string"||t==="")return!1;for(var e;e=/(\\).|([@?!+*]\(.*\))/g.exec(t);){if(e[2])return!0;t=t.slice(e.index+e[0].length)}return!1},ut}var it,_t;function Ct(){if(_t)return it;_t=1;/*!
|
|
7
|
+
* is-glob <https://github.com/jonschlinkert/is-glob>
|
|
8
|
+
*
|
|
9
|
+
* Copyright (c) 2014-2017, Jon Schlinkert.
|
|
10
|
+
* Released under the MIT License.
|
|
11
|
+
*/var t=No(),e={"{":"}","(":")","[":"]"},o=function(b){if(b[0]==="!")return!0;for(var s=0,a=-2,g=-2,l=-2,A=-2,d=-2;s<b.length;){if(b[s]==="*"||b[s+1]==="?"&&/[\].+)]/.test(b[s])||g!==-1&&b[s]==="["&&b[s+1]!=="]"&&(g<s&&(g=b.indexOf("]",s)),g>s&&(d===-1||d>g||(d=b.indexOf("\\",s),d===-1||d>g)))||l!==-1&&b[s]==="{"&&b[s+1]!=="}"&&(l=b.indexOf("}",s),l>s&&(d=b.indexOf("\\",s),d===-1||d>l))||A!==-1&&b[s]==="("&&b[s+1]==="?"&&/[:!=]/.test(b[s+2])&&b[s+3]!==")"&&(A=b.indexOf(")",s),A>s&&(d=b.indexOf("\\",s),d===-1||d>A))||a!==-1&&b[s]==="("&&b[s+1]!=="|"&&(a<s&&(a=b.indexOf("|",s)),a!==-1&&b[a+1]!==")"&&(A=b.indexOf(")",a),A>a&&(d=b.indexOf("\\",a),d===-1||d>A))))return!0;if(b[s]==="\\"){var x=b[s+1];s+=2;var S=e[x];if(S){var $=b.indexOf(S,s);$!==-1&&(s=$+1)}if(b[s]==="!")return!0}else s++}return!1},N=function(b){if(b[0]==="!")return!0;for(var s=0;s<b.length;){if(/[*?{}()[\]]/.test(b[s]))return!0;if(b[s]==="\\"){var a=b[s+1];s+=2;var g=e[a];if(g){var l=b.indexOf(g,s);l!==-1&&(s=l+1)}if(b[s]==="!")return!0}else s++}return!1};return it=function(b,s){if(typeof b!="string"||b==="")return!1;if(t(b))return!0;var a=o;return s&&s.strict===!1&&(a=N),a(b)},it}const ko=O(import.meta.url),we=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,St=t=>{if(typeof we<"u"&&we.versions&&we.versions.node){const[e,o]=we.versions.node.split(".").map(Number);if(e>22||e===22&&o>=3||e===20&&o>=16)return we.getBuiltinModule(t)}return ko(t)},Lo=St("path"),Mo=St("os");var at,Tt;function Bo(){if(Tt)return at;Tt=1;var t=Ct(),e=Lo.posix.dirname,o=Mo.platform()==="win32",N="/",b=/\\/g,s=/\\([!*?|[\](){}])/g;at=function(l,A){var d=Object.assign({flipBackslashes:!0},A);d.flipBackslashes&&o&&l.indexOf(N)<0&&(l=l.replace(b,N)),a(l)&&(l+=N),l+="a";do l=e(l);while(g(l));return l.replace(s,"$1")};function a(l){var A=l.slice(-1),d;switch(A){case"}":d="{";break;case"]":d="[";break;default:return!1}var x=l.indexOf(d);return x<0?!1:l.slice(x+1,-1).includes(N)}function g(l){return/\([^()]+$/.test(l)||l[0]==="{"||l[0]==="["||/[^\\][{[]/.test(l)?!0:t(l)}return at}var Io=Bo();pt(Io);const Po=O(import.meta.url),Ne=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Do=t=>{if(typeof Ne<"u"&&Ne.versions&&Ne.versions.node){const[e,o]=Ne.versions.node.split(".").map(Number);if(e>22||e===22&&o>=3||e===20&&o>=16)return Ne.getBuiltinModule(t)}return Po(t)};Do("node:fs/promises");const Go=O(import.meta.url),ke=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Uo=t=>{if(typeof ke<"u"&&ke.versions&&ke.versions.node){const[e,o]=ke.versions.node.split(".").map(Number);if(e>22||e===22&&o>=3||e===20&&o>=16)return ke.getBuiltinModule(t)}return Go(t)};Uo("node:fs");var Ko=Ct();pt(Ko);const zo=O(import.meta.url),Le=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Ot=t=>{if(typeof Le<"u"&&Le.versions&&Le.versions.node){const[e,o]=Le.versions.node.split(".").map(Number);if(e>22||e===22&&o>=3||e===20&&o>=16)return Le.getBuiltinModule(t)}return zo(t)};Ot("node:fs/promises");Ot("node:fs");let Fo=class extends Error{constructor(e){super(`ENOENT: ${e}`)}get code(){return"ENOENT"}set code(e){throw new Error("Cannot overwrite code ENOENT")}get name(){return"NotFoundError"}set name(e){throw new Error("Cannot overwrite name of NotFoundError")}},jo=class extends Error{constructor(e){super(`EPERM: Operation not permitted, ${e}`)}get code(){return"EPERM"}set code(e){throw new Error("Cannot overwrite code EPERM")}get name(){return"PermissionError"}set name(e){throw new Error("Cannot overwrite name of PermissionError")}};const Xo=(t,e)=>{const o=t?.code;return o==="ENOENT"?new Fo(`no such file or directory, open '${e}'`):o==="EACCES"||o==="EPERM"?new jo(`unable to read the non-readable file: ${e}`):t},Qo=O(import.meta.url),Me=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Ht=t=>{if(typeof Me<"u"&&Me.versions&&Me.versions.node){const[e,o]=Me.versions.node.split(".").map(Number);if(e>22||e===22&&o>=3||e===20&&o>=16)return Me.getBuiltinModule(t)}return Qo(t)},{readFile:Wo}=Ht("node:fs/promises"),{unzip:qo,brotliDecompress:Zo}=Ht("node:zlib"),Yo={brotli:Zo,gzip:qo,none:(t,e)=>{e(null,t)}},Hr=async(t,e)=>{qt(t),t=Wt(t);const{buffer:o,compression:N,encoding:b,flag:s}=e??{};let a;try{a=await Wo(t,s?{flag:s}:{})}catch(g){throw Xo(g,t)}return await new Promise((g,l)=>{Yo[N??"none"](a,(A,d)=>{A?l(A):g(o?d:d.toString(b??"utf8"))})})},Vo=O(import.meta.url),Be=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,wt=t=>{if(typeof Be<"u"&&Be.versions&&Be.versions.node){const[e,o]=Be.versions.node.split(".").map(Number);if(e>22||e===22&&o>=3||e===20&&o>=16)return Be.getBuiltinModule(t)}return Vo(t)};wt("node:fs");wt("node:zlib");const Jo=O(import.meta.url),Ie=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,er=t=>{if(typeof Ie<"u"&&Ie.versions&&Ie.versions.node){const[e,o]=Ie.versions.node.split(".").map(Number);if(e>22||e===22&&o>=3||e===20&&o>=16)return Ie.getBuiltinModule(t)}return Jo(t)},{createRequire:Nt}=er("node:module"),tr=new Map([["Error",Error],["EvalError",EvalError],["RangeError",RangeError],["ReferenceError",ReferenceError],["SyntaxError",SyntaxError],["TypeError",TypeError],["URIError",URIError]]);typeof AggregateError<"u"&&tr.set("AggregateError",AggregateError);const or=Nt(import.meta.url),Pe=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,rr=t=>{if(typeof Pe<"u"&&Pe.versions&&Pe.versions.node){const[e,o]=Pe.versions.node.split(".").map(Number);if(e>22||e===22&&o>=3||e===20&&o>=16)return Pe.getBuiltinModule(t)}return or(t)};rr("node:util");const sr=Nt(import.meta.url),De=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,ct=t=>{if(typeof De<"u"&&De.versions&&De.versions.node){const[e,o]=De.versions.node.split(".").map(Number);if(e>22||e===22&&o>=3||e===20&&o>=16)return De.getBuiltinModule(t)}return sr(t)};ct("node:fs");ct("node:path");ct("node:url");const nr=O(import.meta.url),Ge=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,kt=t=>{if(typeof Ge<"u"&&Ge.versions&&Ge.versions.node){const[e,o]=Ge.versions.node.split(".").map(Number);if(e>22||e===22&&o>=3||e===20&&o>=16)return Ge.getBuiltinModule(t)}return nr(t)};kt("node:fs");kt("node:fs/promises");const ur=O(import.meta.url),Ue=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,ir=t=>{if(typeof Ue<"u"&&Ue.versions&&Ue.versions.node){const[e,o]=Ue.versions.node.split(".").map(Number);if(e>22||e===22&&o>=3||e===20&&o>=16)return Ue.getBuiltinModule(t)}return ur(t)};ir("node:fs");const ar=O(import.meta.url),Ke=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,lr=t=>{if(typeof Ke<"u"&&Ke.versions&&Ke.versions.node){const[e,o]=Ke.versions.node.split(".").map(Number);if(e>22||e===22&&o>=3||e===20&&o>=16)return Ke.getBuiltinModule(t)}return ar(t)};lr("node:fs/promises");const pr=O(import.meta.url),ze=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,cr=t=>{if(typeof ze<"u"&&ze.versions&&ze.versions.node){const[e,o]=ze.versions.node.split(".").map(Number);if(e>22||e===22&&o>=3||e===20&&o>=16)return ze.getBuiltinModule(t)}return pr(t)};cr("node:fs");O(import.meta.url);const fr=O(import.meta.url),Fe=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,gr=t=>{if(typeof Fe<"u"&&Fe.versions&&Fe.versions.node){const[e,o]=Fe.versions.node.split(".").map(Number);if(e>22||e===22&&o>=3||e===20&&o>=16)return Fe.getBuiltinModule(t)}return fr(t)};gr("node:crypto");new TextEncoder;const dr=O(import.meta.url),je=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,br=t=>{if(typeof je<"u"&&je.versions&&je.versions.node){const[e,o]=je.versions.node.split(".").map(Number);if(e>22||e===22&&o>=3||e===20&&o>=16)return je.getBuiltinModule(t)}return dr(t)};br("node:fs/promises");const hr=O(import.meta.url),Xe=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,mr=t=>{if(typeof Xe<"u"&&Xe.versions&&Xe.versions.node){const[e,o]=Xe.versions.node.split(".").map(Number);if(e>22||e===22&&o>=3||e===20&&o>=16)return Xe.getBuiltinModule(t)}return hr(t)};mr("node:fs");const yr=O(import.meta.url),Qe=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,vr=t=>{if(typeof Qe<"u"&&Qe.versions&&Qe.versions.node){const[e,o]=Qe.versions.node.split(".").map(Number);if(e>22||e===22&&o>=3||e===20&&o>=16)return Qe.getBuiltinModule(t)}return yr(t)};vr("node:fs/promises");const Rr=O(import.meta.url),We=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,$r=t=>{if(typeof We<"u"&&We.versions&&We.versions.node){const[e,o]=We.versions.node.split(".").map(Number);if(e>22||e===22&&o>=3||e===20&&o>=16)return We.getBuiltinModule(t)}return Rr(t)};$r("node:fs");const Er=O(import.meta.url),qe=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,ft=t=>{if(typeof qe<"u"&&qe.versions&&qe.versions.node){const[e,o]=qe.versions.node.split(".").map(Number);if(e>22||e===22&&o>=3||e===20&&o>=16)return qe.getBuiltinModule(t)}return Er(t)},Ar=ft("fs"),_r=ft("os"),Tr=ft("path");var lt={},xt;function xr(){if(xt)return lt;xt=1;var t=Object.defineProperty,e=(d,x)=>t(d,"name",{value:x,configurable:!0}),o=Ar,N=_r,b=Tr;const s=e(d=>{let x="";for(let S=0;S<d.length;S+=1){const $=d[S],M=$.toUpperCase();x+=$===M?$.toLowerCase():M}return x},"invertCase"),a=new Map,g=e((d,x)=>{const S=b.join(d,`.is-fs-case-sensitive-test-${process.pid}`);try{return x.writeFileSync(S,""),!x.existsSync(s(S))}finally{try{x.unlinkSync(S)}catch{}}},"checkDirectoryCaseWithWrite"),l=e((d,x,S)=>{try{return g(d,S)}catch($){if(x===void 0)return g(N.tmpdir(),S);throw $}},"checkDirectoryCaseWithFallback"),A=e((d,x=o,S=!0)=>{const $=d??process.cwd();if(S&&a.has($))return a.get($);let M;const te=s($);return te!==$&&x.existsSync($)?M=!x.existsSync(te):M=l($,d,x),S&&a.set($,M),M},"isFsCaseSensitive");return lt.isFsCaseSensitive=A,lt}xr();export{Hr as z};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{createRequire as A}from"node:module";import c from"./EmailError-B-sEf3bp.js";import _ from"./RequiredOptionError-DuNNY_a5.js";import{e as z}from"./generate-message-id-gXAuMz4g.js";import{s as E}from"./headers-to-record-De1Eg951.js";import{m as g}from"./make-request-BlK_B72c.js";import{u as b}from"./retry-3pnxTuNs.js";import{f as U}from"./validate-email-options-mCM9dVug.js";import{defineProvider as k}from"./defineProvider-C9q-7iwt.js";import{P as S,h as w,c as q}from"./provider-base-gIoUu9so.js";import{d as y}from"./address-formatter-BWR2Dddx.js";const T=A(import.meta.url),d=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,P=a=>{if(typeof d<"u"&&d.versions&&d.versions.node){const[l,p]=d.versions.node.split(".").map(Number);if(l>22||l===22&&p>=3||l===20&&p>=16)return d.getBuiltinModule(a)}return T(a)},{Buffer:j}=P("node:buffer"),i="infobip",K="https://api.infobip.com",R=3e4,C=3,L=k((a={})=>{if(!a.apiKey)throw new _(i,"apiKey");const l=a.baseUrl??K,p=a.endpoint??`${l}/email/3/send`,s={apiKey:a.apiKey,baseUrl:l,debug:a.debug??!1,endpoint:p,retries:a.retries??C,timeout:a.timeout??R,...a.logger&&{logger:a.logger}},f=new S,o=q(i,a.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(i,"Email ID is required to retrieve email details"),success:!1};await f.ensureInitialized(()=>this.initialize(),i);const n={Authorization:`App ${s.apiKey}`,"Content-Type":"application/json"};o.debug("Retrieving email details",{id:e});const t=await b(async()=>g(`${s.baseUrl}/email/3/reports/${e}`,{headers:n,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(i,`Failed to retrieve email: ${t.error instanceof Error?t.error.message:"Unknown error"}`,{cause:t.error}),success:!1})}catch(n){return{error:w(i,"retrieve email",n,o),success:!1}}},async initialize(){await f.ensureInitialized(async()=>{if(!await this.isAvailable())throw new c(i,"Infobip API not available or invalid API key");o.debug("Provider initialized successfully")},i)},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:i,options:s,async sendEmail(e){try{const n=U(e);if(n.length>0)return{error:new c(i,`Invalid email options: ${n.join(", ")}`),success:!1};await f.ensureInitialized(()=>this.initialize(),i);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 r=E(e.headers);t.headers=r}e.attachments&&e.attachments.length>0&&(t.attachments=await Promise.all(e.attachments.map(async r=>{let u;if(r.content)if(typeof r.content=="string")u=r.content;else if(r.content instanceof Promise){const I=await r.content;u=j.from(I).toString("base64")}else u=r.content.toString("base64");else if(r.raw)u=typeof r.raw=="string"?r.raw:r.raw.toString("base64");else throw new c(i,`Attachment ${r.filename} has no content`);return{content:u,contentType:r.contentType??"application/octet-stream",name:r.filename}}))),o.debug("Sending email via Infobip API",{subject:t.subject,to:t.to});const v={Authorization:`App ${s.apiKey}`,"Content-Type":"application/json"},m=await b(async()=>g(s.endpoint,{headers:v,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(i,"Failed to send email"),success:!1};const h=m.data?.body?.messages?.[0]?.messageId??z();return o.debug("Email sent successfully",{messageId:h}),{data:{messageId:h,provider:i,response:m.data,sent:!0,timestamp:new Date},success:!0}}catch(n){return{error:w(i,"send email",n,o),success:!1}}},async validateCredentials(){return this.isAvailable()}}});export{L as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const i=/<body[^<>]*>/i,o=e=>e.replaceAll("&","&").replaceAll("<","<").replaceAll(">",">").replaceAll('"',"""),s=(e,c,a={})=>{const n=a.spacer===!1?"":" ".repeat(120),t=`<div style="display:none;max-height:0;overflow:hidden;mso-hide:all;">${o(c)}${n}</div>`,l=i.exec(e);if(l){const r=l.index+l[0].length;return`${e.slice(0,r)}${t}${e.slice(r)}`}return`${t}${e}`};export{s as injectPreheader};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{createRequire as i}from"node:module";import r from"./EmailError-B-sEf3bp.js";const a=i(import.meta.url),n=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,c=o=>{if(typeof n<"u"&&n.versions&&n.versions.node){const[s,t]=n.versions.node.split(".").map(Number);if(s>22||s===22&&t>=3||s===20&&t>=16)return n.getBuiltinModule(o)}return a(o)},{createRequire:u}=c("node:module"),d=u(import.meta.url),p=(o,s)=>{let t;try{const e=d("juice");t=e.default??e}catch(e){throw e instanceof Error&&(e.code==="MODULE_NOT_FOUND"||e.message.includes("Cannot find module")||e.message.includes("Cannot find package"))?new r("render","juice is not installed. Please install it: pnpm add juice",{cause:e}):new r("render",`Failed to load juice: ${e.message}`,{cause:e})}try{return t(o,s)}catch(e){throw new r("render",`Failed to inline CSS: ${e.message}`,{cause:e})}};export{p as default};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import{createRequire as g}from"node:module";import o from"./EmailError-B-sEf3bp.js";const p=g(import.meta.url),n=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,u=e=>{if(typeof n<"u"&&n.versions&&n.versions.node){const[t,s]=n.versions.node.split(".").map(Number);if(t>22||t===22&&s>=3||t===20&&s>=16)return n.getBuiltinModule(e)}return p(e)},{Buffer:m}=u("node:buffer"),{X509Certificate:d,createVerify:S}=u("node:crypto"),y={Notification:["Message","MessageId","Subject","Timestamp","TopicArn","Type"],SubscriptionConfirmation:["Message","MessageId","SubscribeURL","Timestamp","Token","TopicArn","Type"],UnsubscribeConfirmation:["Message","MessageId","SubscribeURL","Timestamp","Token","TopicArn","Type"]},b=/^sns\.[a-z0-9-]+\.amazonaws\.com(?:\.cn)?$/,w=/\.$/,h=e=>{let t;try{t=new URL(e)}catch{return!1}if(t.protocol!=="https:"||t.username!==""||t.password!==""||t.port!=="")return!1;const s=t.hostname.toLowerCase().replace(w,"");return b.test(s)},T=async e=>{if(!h(e))throw new o("webhooks",`Refusing to fetch SNS signing certificate from untrusted URL: ${e}`);const t=await fetch(e,{signal:AbortSignal.timeout(5e3)});if(!t.ok)throw new o("webhooks",`Failed to fetch SNS signing certificate (status ${String(t.status)})`);return await t.text()},v=e=>{const t=y[e.Type??""];if(!t)return;let s="";for(const i of t){const r=e[i];typeof r=="string"&&(s+=`${i}
|
|
2
|
+
${r}
|
|
3
|
+
`)}return s},M=async(e,t={})=>{const{certificateResolver:s=T}=t;if(!e.Signature||!e.SigningCertURL)return{reason:"missing-signature",valid:!1};const i=v(e);if(i===void 0)return{reason:"unknown-message-type",valid:!1};let r;if(e.SignatureVersion==="1")r="RSA-SHA1";else if(e.SignatureVersion==="2")r="RSA-SHA256";else return{reason:"unknown-signature-version",valid:!1};const f=await s(e.SigningCertURL);let a;try{a=new d(f).publicKey}catch(l){throw new o("webhooks","Failed to parse SNS signing certificate",{cause:l})}let c;try{c=S(r).update(i,"utf8").verify(a,m.from(e.Signature,"base64"))}catch{return{reason:"signature-malformed",valid:!1}}return c?{valid:!0}:{reason:"signature-mismatch",valid:!1}};export{h as isValidSigningCertUrl,M as verifySnsMessage};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const n=e=>{const r=e.indexOf("@");if(r<=0)return"•••";const s=e.slice(0,r),a=e.slice(r+1);return`${s.slice(0,1)}${"•".repeat(Math.max(1,s.length-1))}@${a}`},c=(e,r)=>(Array.isArray(e)?e:[e]).map(s=>r?n(s.email):s.email),l=(e={})=>{const{logger:r=console,redact:s=!0}=e;return async(a,t)=>{const o=c(a.to,s);r.info("[@visulima/email] sending",{subject:s?void 0:a.subject,to:o});const i=await t(a);return i.success?r.info("[@visulima/email] sent",{messageId:i.data?.messageId,to:o}):r.error("[@visulima/email] send failed",{error:i.error instanceof Error?i.error.message:i.error,to:o}),i}};export{l as loggingMiddleware};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import o from"./EmailError-
|
|
1
|
+
import o from"./EmailError-B-sEf3bp.js";import f from"./RequiredOptionError-DuNNY_a5.js";import{e as g}from"./generate-message-id-gXAuMz4g.js";import{m as h}from"./make-request-BlK_B72c.js";import{u as y}from"./retry-3pnxTuNs.js";import{defineProvider as b}from"./defineProvider-C9q-7iwt.js";import{c as v}from"./attachment-processor-BjTNoMyb.js";import{h as w,P as T,c as A}from"./provider-base-gIoUu9so.js";const t="loops",I="https://app.loops.so/api/v1/transactional",P=3e4,K=3,E=b((a={})=>{if(!a.apiKey)throw new f(t,"apiKey");const r={apiKey:a.apiKey,debug:a.debug??!1,defaultTransactionalId:a.defaultTransactionalId,endpoint:a.endpoint??I,logger:a.logger,retries:a.retries??K,timeout:a.timeout??P},m=new T,u=A(t,a.logger);return{features:{attachments:!0,batchSending:!1,customHeaders:!1,html:!1,replyTo:!1,scheduling:!1,tagging:!1,templates:!0,tracking:!0},async initialize(){m.setInitialized()},async isAvailable(){return r.apiKey.length>0},name:t,options:r,async sendEmail(e){try{const s=e.transactionalId??r.defaultTransactionalId;if(!s)return{error:new o(t,"Loops requires a `transactionalId` (on the message or as `defaultTransactionalId`)"),success:!1};const l=Array.isArray(e.to)?e.to:[e.to];if(l.length!==1||e.cc!==void 0||e.bcc!==void 0)return{error:new o(t,"Loops supports exactly one `to` recipient and does not support cc/bcc"),success:!1};const[d]=l;if(!d)return{error:new o(t,"A `to` recipient is required"),success:!1};const n={email:d.email,transactionalId:s};e.dataVariables&&(n.dataVariables=e.dataVariables),e.addToAudience&&(n.addToAudience=!0),e.attachments&&e.attachments.length>0&&(n.attachments=await Promise.all(e.attachments.map(async p=>{const c=await v(p,t);return{contentType:c.contentType,data:c.content,filename:c.filename}})));const i=await y(async()=>h(r.endpoint,{headers:{Authorization:`Bearer ${r.apiKey}`,"Content-Type":"application/json"},method:"POST",timeout:r.timeout},JSON.stringify(n)),r.retries);return i.success?{data:{messageId:g(),provider:t,response:i.data,sent:!0,timestamp:new Date},success:!0}:{error:i.error??new o(t,"Failed to send email"),success:!1}}catch(s){return{error:w(t,"send email",s,u),success:!1}}},async validateCredentials(){return this.isAvailable()}}});export{E as default};
|
|
@@ -96,6 +96,7 @@ declare class MailMessage {
|
|
|
96
96
|
private encrypter?;
|
|
97
97
|
private logger?;
|
|
98
98
|
private icalEventData?;
|
|
99
|
+
private icalEventBuilder?;
|
|
99
100
|
/**
|
|
100
101
|
* Sets the sender address.
|
|
101
102
|
* @param address The sender email address (string or EmailAddress object).
|
|
@@ -504,6 +505,16 @@ declare class DraftMailMessage extends MailMessage {
|
|
|
504
505
|
*/
|
|
505
506
|
type SendableMessage = MailMessage | EmailOptions;
|
|
506
507
|
/**
|
|
508
|
+
* Base message accepted by {@link Mail.sendBatch}.
|
|
509
|
+
*
|
|
510
|
+
* Unlike {@link SendableMessage}, the `to` field is optional here: every outgoing message gets its
|
|
511
|
+
* recipients from its {@link Personalization}, so the base never needs a (always-ignored) `to`. A
|
|
512
|
+
* {@link MailMessage} is also accepted — its `to` is built lazily and may legitimately be unset.
|
|
513
|
+
*/
|
|
514
|
+
type BatchBase = MailMessage | (Omit<EmailOptions, "to"> & {
|
|
515
|
+
to?: EmailAddress | EmailAddress[];
|
|
516
|
+
});
|
|
517
|
+
/**
|
|
507
518
|
* Renders a template string against per-recipient data (e.g. a Handlebars/Liquid renderer).
|
|
508
519
|
*/
|
|
509
520
|
type BatchRenderer = (template: string, data: Record<string, unknown>) => MaybePromise<string>;
|
|
@@ -547,6 +558,11 @@ interface Personalization {
|
|
|
547
558
|
* Options for {@link Mail.sendBatch}.
|
|
548
559
|
*/
|
|
549
560
|
interface SendBatchOptions {
|
|
561
|
+
/**
|
|
562
|
+
* Maximum number of messages to send in parallel. Defaults to `1` (serial). See
|
|
563
|
+
* {@link Mail.sendMany} for the concurrency semantics.
|
|
564
|
+
*/
|
|
565
|
+
concurrency?: number;
|
|
550
566
|
/**
|
|
551
567
|
* Renders the base `subject`/`html`/`text` templates against each personalization's `data`.
|
|
552
568
|
*/
|
|
@@ -760,9 +776,14 @@ declare class Mail {
|
|
|
760
776
|
* @param messages An iterable of MailMessage instances or email options to send.
|
|
761
777
|
* @param options Optional parameters for sending.
|
|
762
778
|
* @param options.signal Abort signal to cancel the operation.
|
|
779
|
+
* @param options.concurrency Maximum number of messages to send in parallel. Defaults to `1`
|
|
780
|
+
* (strictly serial). Values > 1 spin up a bounded worker pool and yield receipts as they
|
|
781
|
+
* settle (so the yield order is completion order, not input order) — a large win for
|
|
782
|
+
* latency-bound HTTP providers (Resend/SendGrid/etc.).
|
|
763
783
|
* @returns An async iterable that yields receipts for each sent message.
|
|
764
784
|
*/
|
|
765
785
|
sendMany(messages: Iterable<SendableMessage> | AsyncIterable<SendableMessage>, options?: {
|
|
786
|
+
concurrency?: number;
|
|
766
787
|
signal?: AbortSignal;
|
|
767
788
|
}): AsyncIterable<Receipt>;
|
|
768
789
|
/**
|
|
@@ -772,23 +793,50 @@ declare class Mail {
|
|
|
772
793
|
* `options.render` is supplied, the base `subject`/`html`/`text` are treated as templates and
|
|
773
794
|
* rendered against each personalization's `data`. Results stream back as {@link Receipt}s, exactly
|
|
774
795
|
* like {@link Mail.sendMany}.
|
|
775
|
-
* @param base The shared base message (MailMessage or
|
|
796
|
+
* @param base The shared base message (MailMessage or a {@link BatchBase}). Its `to` is optional
|
|
797
|
+
* and ignored — each personalization supplies its own recipients.
|
|
776
798
|
* @param personalizations One entry per outgoing message.
|
|
777
|
-
* @param options Optional renderer
|
|
799
|
+
* @param options Optional renderer, abort signal and concurrency. See {@link SendBatchOptions}.
|
|
778
800
|
* @returns An async iterable of receipts, one per personalization.
|
|
779
801
|
* @example
|
|
780
802
|
* ```ts
|
|
781
803
|
* import { renderHandlebars } from "@visulima/email/template/handlebars";
|
|
782
804
|
*
|
|
783
805
|
* for await (const receipt of mail.sendBatch(
|
|
784
|
-
* // `to`
|
|
785
|
-
* { from: { email: "a@x.com" },
|
|
806
|
+
* // No `to` needed on the base — each personalization supplies its own.
|
|
807
|
+
* { from: { email: "a@x.com" }, subject: "Hi {{name}}", html: "<p>Hello {{name}}</p>" },
|
|
786
808
|
* [{ to: { email: "b@x.com" }, data: { name: "Bob" } }],
|
|
787
809
|
* { render: (tpl, data) => renderHandlebars(tpl, data) },
|
|
788
810
|
* )) { /* ... *\/ }
|
|
789
811
|
* ```
|
|
790
812
|
*/
|
|
791
|
-
sendBatch(base:
|
|
813
|
+
sendBatch(base: BatchBase, personalizations: Personalization[], options?: SendBatchOptions): AsyncIterable<Receipt>;
|
|
814
|
+
/**
|
|
815
|
+
* Sends a single message and converts the result to a {@link Receipt}.
|
|
816
|
+
* Shared by the serial and concurrent {@link Mail.sendMany} paths.
|
|
817
|
+
* @param message The message to send (must not be a draft).
|
|
818
|
+
* @returns The receipt describing success or failure.
|
|
819
|
+
*/
|
|
820
|
+
private sendOneToReceipt;
|
|
821
|
+
/**
|
|
822
|
+
* Serial implementation of {@link Mail.sendMany} (concurrency 1).
|
|
823
|
+
* @param messages The messages to send.
|
|
824
|
+
* @param signal Optional abort signal.
|
|
825
|
+
* @yields A receipt per message, in input order.
|
|
826
|
+
*/
|
|
827
|
+
private sendManySerial;
|
|
828
|
+
/**
|
|
829
|
+
* Concurrent implementation of {@link Mail.sendMany}.
|
|
830
|
+
*
|
|
831
|
+
* Maintains a bounded pool of in-flight sends; as each settles its receipt is
|
|
832
|
+
* yielded immediately (completion order) and the next pending message is pulled
|
|
833
|
+
* from the source iterator, keeping the pool full without buffering the whole input.
|
|
834
|
+
* @param messages The messages to send.
|
|
835
|
+
* @param concurrency Maximum number of in-flight sends (>= 2).
|
|
836
|
+
* @param signal Optional abort signal.
|
|
837
|
+
* @yields A receipt per message, in completion order.
|
|
838
|
+
*/
|
|
839
|
+
private sendManyConcurrent;
|
|
792
840
|
/**
|
|
793
841
|
* Sends the resolved options through the middleware chain (or straight to the provider when no
|
|
794
842
|
* middleware is registered). The composed chain is memoized and rebuilt whenever {@link Mail.use}
|
|
@@ -858,4 +906,4 @@ declare class Mail {
|
|
|
858
906
|
* ```
|
|
859
907
|
*/
|
|
860
908
|
declare const createMail: (provider: Provider, options?: MailOptions) => Mail;
|
|
861
|
-
export { AttachmentDataOptions as A,
|
|
909
|
+
export { AttachmentDataOptions as A, BatchBase as B, DraftMailMessage as D, FeatureCheckMode as F, Mail as M, Personalization as P, SendBatchOptions as S, AttachmentOptions as a, BatchRenderer as b, MailGlobalConfig as c, MailMessage as d, MailOptions as e, SendableMessage as f, createMail as g, detectMimeType as h, generateContentId as i, readFileAsBuffer as r };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{defineProvider as
|
|
1
|
+
import{defineProvider as l}from"./defineProvider-C9q-7iwt.js";import o from"./smtpProvider-x4WBN-3W.js";const s="mailcrab",u="localhost",n=1025,g=l((t={})=>{const e={debug:t.debug??!1,host:t.host??u,logger:t.logger,port:t.port??n,retries:t.retries,secure:t.secure??!1,timeout:t.timeout},a=o({debug:e.debug,host:e.host,logger:e.logger,port:e.port,retries:e.retries,secure:e.secure,timeout:e.timeout});return{features:{attachments:!0,batchSending:!1,customHeaders:!0,html:!0,replyTo:!0,scheduling:!1,tagging:!1,templates:!1,tracking:!1},async initialize(){await a.initialize()},async isAvailable(){return a.isAvailable()},name:s,options:e,async sendEmail(i){const r=await a.sendEmail(i);return r.success&&r.data?{data:{...r.data,provider:s},success:!0}:r},async validateCredentials(){return a.validateCredentials?.()??!1}}});export{g as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import c from"./EmailError-
|
|
1
|
+
import c from"./EmailError-B-sEf3bp.js";import P from"./RequiredOptionError-DuNNY_a5.js";import{e as I}from"./generate-message-id-gXAuMz4g.js";import{s as T}from"./headers-to-record-De1Eg951.js";import{m as d}from"./make-request-BlK_B72c.js";import{u as g}from"./retry-3pnxTuNs.js";import{a as A,s as k}from"./sanitize-header-DJhgZl3y.js";import{f as z}from"./validate-email-options-mCM9dVug.js";import{defineProvider as j}from"./defineProvider-C9q-7iwt.js";import{P as E,h as f,c as C}from"./provider-base-gIoUu9so.js";import{j as u,g as h}from"./address-formatter-BWR2Dddx.js";const r="mailpace",M="https://app.mailpace.com/api/v1",S=3e4,q=3,R=j((o={})=>{if(!o.apiToken)throw new P(r,"apiToken");const s={apiToken:o.apiToken,debug:o.debug??!1,endpoint:o.endpoint??M,retries:o.retries??q,timeout:o.timeout??S,...o.logger&&{logger:o.logger}},l=new E,i=C(r,o.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=z(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[A(v)]=k(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"},n=await g(async()=>d(`${s.endpoint}/send`,{headers:b,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 c(r,"Failed to send email"),success:!1};const m=n.data?.body?.id??I();return i.debug("Email sent successfully",{messageId:m}),{data:{messageId:m,provider:r,response:n.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{R as default};
|
package/dist/packem_shared/{mailchannelsProvider-zKcunGDQ.js → mailchannelsProvider-DPfQVzUd.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import p from"./EmailError-
|
|
1
|
+
import p from"./EmailError-B-sEf3bp.js";import g from"./RequiredOptionError-DuNNY_a5.js";import{e as v}from"./generate-message-id-gXAuMz4g.js";import{s as b}from"./headers-to-record-De1Eg951.js";import{m as w}from"./make-request-BlK_B72c.js";import{u as K}from"./retry-3pnxTuNs.js";import{f as S}from"./validate-email-options-mCM9dVug.js";import{defineProvider as P}from"./defineProvider-C9q-7iwt.js";import{f as l,a as u}from"./address-formatter-BWR2Dddx.js";import{c as x}from"./attachment-processor-BjTNoMyb.js";import{h as A,P as T,c as j}from"./provider-base-gIoUu9so.js";const a="mailchannels",I="https://api.mailchannels.net/tx/v1/send",_=3e4,z=3,N=P((t={})=>{if(!t.apiKey)throw new g(a,"apiKey");const r={apiKey:t.apiKey,debug:t.debug??!1,endpoint:t.endpoint??I,logger:t.logger,retries:t.retries??z,timeout:t.timeout??_},f=new T,h=j(a,t.logger);return{features:{attachments:!0,batchSending:!1,customHeaders:!0,html:!0,replyTo:!0,scheduling:!1,tagging:!1,templates:!1,tracking:!1},async initialize(){f.setInitialized()},async isAvailable(){return r.apiKey.length>0},name:a,options:r,async sendEmail(e){try{const s=S(e);if(s.length>0)return{error:new p(a,`Invalid email options: ${s.join(", ")}`),success:!1};const o=[];e.text&&o.push({type:"text/plain",value:e.text}),e.html&&o.push({type:"text/html",value:e.html});const c={to:l(e.to)};e.cc&&(c.cc=l(e.cc)),e.bcc&&(c.bcc=l(e.bcc));const n={content:o,from:u(e.from),personalizations:[c],subject:e.subject};e.replyTo&&(n.reply_to=u(e.replyTo)),e.headers&&(n.headers=b(e.headers)),e.attachments&&e.attachments.length>0&&(n.attachments=await Promise.all(e.attachments.map(async y=>{const m=await x(y,a);return{content:m.content,filename:m.filename,type:m.contentType}})));const i=await K(async()=>w(r.endpoint,{headers:{"Content-Type":"application/json","X-Api-Key":r.apiKey},method:"POST",timeout:r.timeout},JSON.stringify(n)),r.retries);if(!i.success)return{error:i.error??new p(a,"Failed to send email"),success:!1};const{body:d}=i.data;return{data:{messageId:d?.message_id??d?.request_id??v(),provider:a,response:i.data,sent:!0,timestamp:new Date},success:!0}}catch(s){return{error:A(a,"send email",s,h),success:!1}}},async validateCredentials(){return this.isAvailable()}}});export{N as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{createRequire as w}from"node:module";import l from"./EmailError-B-sEf3bp.js";import P from"./RequiredOptionError-DuNNY_a5.js";import{e as _}from"./generate-message-id-gXAuMz4g.js";import{s as k}from"./headers-to-record-De1Eg951.js";import{m as p}from"./make-request-BlK_B72c.js";import{u as h}from"./retry-3pnxTuNs.js";import{f as z}from"./validate-email-options-mCM9dVug.js";import{defineProvider as j}from"./defineProvider-C9q-7iwt.js";import{P as S,h as b,c as C}from"./provider-base-gIoUu9so.js";import{f,a as E}from"./address-formatter-BWR2Dddx.js";const T=w(import.meta.url),m=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,A=o=>{if(typeof m<"u"&&m.versions&&m.versions.node){const[i,c]=m.versions.node.split(".").map(Number);if(i>22||i===22&&c>=3||i===20&&c>=16)return m.getBuiltinModule(o)}return T(o)},{Buffer:I}=A("node:buffer"),s="mailersend",q="https://api.mailersend.com",M=3e4,B=3,U=j((o={})=>{if(!o.apiToken)throw new P(s,"apiToken");const i={apiToken:o.apiToken,debug:o.debug??!1,endpoint:o.endpoint??q,retries:o.retries??B,timeout:o.timeout??M,...o.logger&&{logger:o.logger}},c=new S,n=C(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 ${i.apiToken}`,"Content-Type":"application/json"};n.debug("Retrieving email details",{id:e});const t=await h(async()=>p(`${i.endpoint}/v1/activity/${e}`,{headers:r,method:"GET",timeout:i.timeout}),i.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:b(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 ${i.apiToken}`,"Content-Type":"application/json"};n.debug("Checking MailerSend API availability");const r=await p(`${i.endpoint}/v1/tokens/verify`,{headers:e,method:"GET",timeout:i.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:i,async sendEmail(e){try{const r=z(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=E(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 a=k(e.headers);t.headers=a}e.attachments&&e.attachments.length>0&&(t.attachments=await Promise.all(e.attachments.map(async a=>{let u;if(a.content)if(typeof a.content=="string")u=a.content;else if(a.content instanceof Promise){const v=await a.content;u=I.from(v).toString("base64")}else u=a.content.toString("base64");else if(a.raw)u=typeof a.raw=="string"?a.raw:a.raw.toString("base64");else throw new l(s,`Attachment ${a.filename} has no content`);return{content:u,filename:a.filename,...a.contentType&&{type:a.contentType},...a.cid&&{id:a.cid}}}))),n.debug("Sending email via MailerSend API",{subject:t.subject,to:t.to});const y={Authorization:`Bearer ${i.apiToken}`,"Content-Type":"application/json"},d=await h(async()=>p(`${i.endpoint}/v1/email`,{headers:y,method:"POST",timeout:i.timeout},JSON.stringify(t)),i.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??_();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:b(s,"send email",r,n),success:!1}}},async validateCredentials(){return this.isAvailable()}}});export{U as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{createRequire as j}from"node:module";import m from"./EmailError-B-sEf3bp.js";import w from"./RequiredOptionError-DuNNY_a5.js";import{e as P}from"./generate-message-id-gXAuMz4g.js";import{s as R}from"./headers-to-record-De1Eg951.js";import{m as h}from"./make-request-BlK_B72c.js";import{u as T}from"./retry-3pnxTuNs.js";import{f as S}from"./validate-email-options-mCM9dVug.js";import{defineProvider as _}from"./defineProvider-C9q-7iwt.js";import{P as z,h as k,c as E}from"./provider-base-gIoUu9so.js";import{e as b,g as I}from"./address-formatter-BWR2Dddx.js";import{a as U}from"./attachment-processor-BjTNoMyb.js";const A=j(import.meta.url),u=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,C=s=>{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(s)}return A(s)},{Buffer:y}=C("node:buffer"),a="mailgun",q="https://api.mailgun.net",M=3e4,K=3,B=s=>{const r=[];for(const[n,i]of Object.entries(s))if(i!=null)if(Array.isArray(i))for(const e of i)r.push(`${encodeURIComponent(n)}=${encodeURIComponent(String(e))}`);else typeof i=="object"?r.push(`${encodeURIComponent(n)}=${encodeURIComponent(JSON.stringify(i))}`):r.push(`${encodeURIComponent(n)}=${encodeURIComponent(String(i))}`);return r.join("&")},X=_((s={})=>{if(!s.apiKey)throw new w(a,"apiKey");if(!s.domain)throw new w(a,"domain");const r={apiKey:s.apiKey,debug:s.debug??!1,domain:s.domain,endpoint:s.endpoint??q,retries:s.retries??K,timeout:s.timeout??M,...s.logger&&{logger:s.logger}},n=new z,i=E(a,s.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(a,"Email ID is required to retrieve email details"),success:!1};await n.ensureInitialized(()=>this.initialize(),a);const o={Authorization:`Basic ${y.from(`api:${r.apiKey}`).toString("base64")}`,"Content-Type":"application/json"};i.debug("Retrieving email details",{id:e});const t=await T(async()=>h(`${r.endpoint}/v3/${r.domain}/events?message-id=${encodeURIComponent(e)}&limit=1`,{headers:o,method:"GET",timeout:r.timeout}),r.retries);if(!t.success)return i.debug("API request failed when retrieving email",t.error),{error:new m(a,`Failed to retrieve email: ${t.error instanceof Error?t.error.message:"Unknown error"}`,{cause:t.error}),success:!1};i.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(o){return{error:k(a,"retrieve email",o,i),success:!1}}},async initialize(){await n.ensureInitialized(async()=>{if(!await this.isAvailable())throw new m(a,"Mailgun API not available or invalid API key/domain");i.debug("Provider initialized successfully")},a)},async isAvailable(){try{const e={Authorization:`Basic ${y.from(`api:${r.apiKey}`).toString("base64")}`,"Content-Type":"application/json"};i.debug("Checking Mailgun API availability");const o=await h(`${r.endpoint}/v3/domains/${r.domain}`,{headers:e,method:"GET",timeout:r.timeout});if(i.debug("Mailgun API availability check response:",{error:o.error instanceof Error?o.error.message:void 0,statusCode:o.data?.statusCode,success:o.success}),!o.success||!o.data||typeof o.data!="object")return!1;const{statusCode:t}=o.data;return typeof t=="number"&&t>=200&&t<300}catch(e){return i.debug("Error checking availability:",e),!1}},name:a,options:r,async sendEmail(e){try{const o=S(e);if(o.length>0)return{error:new m(a,`Invalid email options: ${o.join(", ")}`),success:!1};await n.ensureInitialized(()=>this.initialize(),a);const t={from:I(e.from),to:b(e.to).join(",")};if(e.subject&&(t.subject=e.subject),e.cc&&(t.cc=b(e.cc).join(",")),e.bcc&&(t.bcc=b(e.bcc).join(",")),e.replyTo&&(t["h:Reply-To"]=I(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=R(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,a,f)));for(const c of d)t[c.key]=c.content}i.debug("Sending email via Mailgun API",{subject:t.subject,to:t.to});const p={Authorization:`Basic ${y.from(`api:${r.apiKey}`).toString("base64")}`,"Content-Type":"application/x-www-form-urlencoded"},g=B(t),l=await T(async()=>h(`${r.endpoint}/v3/${r.domain}/messages`,{headers:p,method:"POST",timeout:r.timeout},g),r.retries);if(!l.success)return i.debug("API request failed when sending email",l.error),{error:l.error??new m(a,"Failed to send email"),success:!1};const v=l.data?.body?.id??P();return i.debug("Email sent successfully",{messageId:v}),{data:{messageId:v,provider:a,response:l.data,sent:!0,timestamp:new Date},success:!0}}catch(o){return{error:k(a,"send email",o,i),success:!1}}},async validateCredentials(){return this.isAvailable()}}});export{X as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{createRequire as I}from"node:module";import d from"./EmailError-B-sEf3bp.js";import b from"./RequiredOptionError-DuNNY_a5.js";import{e as E}from"./generate-message-id-gXAuMz4g.js";import{s as M}from"./headers-to-record-De1Eg951.js";import{m as f}from"./make-request-BlK_B72c.js";import{u as v}from"./retry-3pnxTuNs.js";import{f as _}from"./validate-email-options-mCM9dVug.js";import{defineProvider as z}from"./defineProvider-C9q-7iwt.js";import{P as D,h as w,c as B}from"./provider-base-gIoUu9so.js";import{h as y,i as T}from"./address-formatter-BWR2Dddx.js";const P=I(import.meta.url),m=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,A=n=>{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(n)}return P(n)},{Buffer:p}=A("node:buffer"),s="mailjet",R="https://api.mailjet.com",k=3e4,q=3,Q=z((n={})=>{if(!n.apiKey)throw new b(s,"apiKey");if(!n.apiSecret)throw new b(s,"apiSecret");const a={apiKey:n.apiKey,apiSecret:n.apiSecret,debug:n.debug??!1,endpoint:n.endpoint??R,retries:n.retries??q,timeout:n.timeout??k,...n.logger&&{logger:n.logger}},l=new D,o=B(s,n.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(s,"Email ID is required to retrieve email details"),success:!1};await l.ensureInitialized(()=>this.initialize(),s);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 v(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(s,`Failed to retrieve email: ${t.error instanceof Error?t.error.message:"Unknown error"}`,{cause:t.error}),success:!1})}catch(i){return{error:w(s,"retrieve email",i,o),success:!1}}},async initialize(){await l.ensureInitialized(async()=>{if(!await this.isAvailable())throw new d(s,"Mailjet API not available or invalid API credentials");o.debug("Provider initialized successfully")},s)},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:s,options:a,async sendEmail(e){try{const i=_(e);if(i.length>0)return{error:new d(s,`Invalid email options: ${i.join(", ")}`),success:!1};await l.ensureInitialized(()=>this.initialize(),s);const t={From:T(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=T(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=M(e.headers),c=[];for(const[g,C]of Object.entries(r))c.push({Name:g,Value:String(C)});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(s,`Attachment ${r.filename} has no content`);return{Base64Content:c,ContentType:r.contentType??"application/octet-stream",Filename:r.filename,...r.cid&&{ContentID:r.cid}}})));const S={Messages:[t]};o.debug("Sending email via Mailjet API",{subject:t.Subject,to:t.To});const j={Authorization:`Basic ${p.from(`${a.apiKey}:${a.apiSecret}`).toString("base64")}`,"Content-Type":"application/json"},u=await v(async()=>f(`${a.endpoint}/v3.1/send`,{headers:j,method:"POST",timeout:a.timeout},JSON.stringify(S)),a.retries);if(!u.success)return o.debug("API request failed when sending email",u.error),{error:u.error??new d(s,"Failed to send email"),success:!1};const h=u.data?.body?.Messages?.[0]?.To?.[0]?.MessageID?.toString()??E();return o.debug("Email sent successfully",{messageId:h}),{data:{messageId:h,provider:s,response:u.data,sent:!0,timestamp:new Date},success:!0}}catch(i){return{error:w(s,"send email",i,o),success:!1}}},async validateCredentials(){return this.isAvailable()}}});export{Q as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{createRequire as I}from"node:module";import c from"./EmailError-B-sEf3bp.js";import T from"./RequiredOptionError-DuNNY_a5.js";import{e as _}from"./generate-message-id-gXAuMz4g.js";import{s as S}from"./headers-to-record-De1Eg951.js";import{m as h}from"./make-request-BlK_B72c.js";import{u as y}from"./retry-3pnxTuNs.js";import{f as E}from"./validate-email-options-mCM9dVug.js";import{defineProvider as K}from"./defineProvider-C9q-7iwt.js";import{P as k,h as b,c as q}from"./provider-base-gIoUu9so.js";import{f,a as z}from"./address-formatter-BWR2Dddx.js";const P=I(import.meta.url),u=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,A=s=>{if(typeof u<"u"&&u.versions&&u.versions.node){const[i,l]=u.versions.node.split(".").map(Number);if(i>22||i===22&&l>=3||i===20&&l>=16)return u.getBuiltinModule(s)}return P(s)},{Buffer:j}=A("node:buffer"),a="mailomat",C="https://api.mailomat.com",M=3e4,x=3,L=K((s={})=>{if(!s.apiKey)throw new T(a,"apiKey");const i={apiKey:s.apiKey,debug:s.debug??!1,endpoint:s.endpoint??C,retries:s.retries??x,timeout:s.timeout??M,...s.logger&&{logger:s.logger}},l=new k,n=q(a,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(a,"Email ID is required to retrieve email details"),success:!1};await l.ensureInitialized(()=>this.initialize(),a);const o={"Content-Type":"application/json","X-API-Key":i.apiKey};n.debug("Retrieving email details",{id:e});const t=await y(async()=>h(`${i.endpoint}/emails/${e}`,{headers:o,method:"GET",timeout:i.timeout}),i.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(a,`Failed to retrieve email: ${t.error instanceof Error?t.error.message:"Unknown error"}`,{cause:t.error}),success:!1})}catch(o){return{error:b(a,"retrieve email",o,n),success:!1}}},async initialize(){await l.ensureInitialized(async()=>{if(!await this.isAvailable())throw new c(a,"Mailomat API not available or invalid API key");n.debug("Provider initialized successfully")},a)},async isAvailable(){try{return n.debug("Checking Mailomat API availability"),!0}catch(e){return n.debug("Error checking availability:",e),!1}},name:a,options:i,async sendEmail(e){try{const o=E(e);if(o.length>0)return{error:new c(a,`Invalid email options: ${o.join(", ")}`),success:!1};await l.ensureInitialized(()=>this.initialize(),a);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=z(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=S(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 v=await r.content;d=j.from(v).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(a,`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 w={"Content-Type":"application/json","X-API-Key":i.apiKey},m=await y(async()=>h(`${i.endpoint}/send`,{headers:w,method:"POST",timeout:i.timeout},JSON.stringify(t)),i.retries);if(!m.success)return n.debug("API request failed when sending email",m.error),{error:m.error??new c(a,"Failed to send email"),success:!1};const p=m.data?.body,g=p?.messageId??p?.id??_();return n.debug("Email sent successfully",{messageId:g}),{data:{messageId:g,provider:a,response:m.data,sent:!0,timestamp:new Date},success:!0}}catch(o){return{error:b(a,"send email",o,n),success:!1}}},async validateCredentials(){return this.isAvailable()}}});export{L as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{createRequire as w}from"node:module";import l from"./EmailError-B-sEf3bp.js";import P from"./RequiredOptionError-DuNNY_a5.js";import{e as A}from"./generate-message-id-gXAuMz4g.js";import{s as I}from"./headers-to-record-De1Eg951.js";import{m as p}from"./make-request-BlK_B72c.js";import{u as b}from"./retry-3pnxTuNs.js";import{f as j}from"./validate-email-options-mCM9dVug.js";import{defineProvider as C}from"./defineProvider-C9q-7iwt.js";import{P as E,h,c as S}from"./provider-base-gIoUu9so.js";import{f,a as q}from"./address-formatter-BWR2Dddx.js";const T=w(import.meta.url),m=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,_=o=>{if(typeof m<"u"&&m.versions&&m.versions.node){const[s,c]=m.versions.node.split(".").map(Number);if(s>22||s===22&&c>=3||s===20&&c>=16)return m.getBuiltinModule(o)}return T(o)},{Buffer:k}=_("node:buffer"),i="mailtrap",z="https://send.api.mailtrap.io",M=3e4,x=3,L=C((o={})=>{if(!o.apiToken)throw new P(i,"apiToken");const s={apiToken:o.apiToken,debug:o.debug??!1,endpoint:o.endpoint??z,retries:o.retries??x,timeout:o.timeout??M,...o.logger&&{logger:o.logger}},c=new E,n=S(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":s.apiToken,"Content-Type":"application/json"};n.debug("Retrieving email details",{id:e});const t=await b(async()=>p(`${s.endpoint}/api/send/${e}`,{headers:r,method:"GET",timeout:s.timeout}),s.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:h(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":s.apiToken,"Content-Type":"application/json"};n.debug("Checking Mailtrap API availability");const r=await p(`${s.endpoint}/api/account`,{headers:e,method:"GET",timeout:s.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:s,async sendEmail(e){try{const r=j(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=q(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 a=I(e.headers);t.headers=a}e.attachments&&e.attachments.length>0&&(t.attachments=await Promise.all(e.attachments.map(async a=>{let u;if(a.content)if(typeof a.content=="string")u=a.content;else if(a.content instanceof Promise){const v=await a.content;u=k.from(v).toString("base64")}else u=a.content.toString("base64");else if(a.raw)u=typeof a.raw=="string"?a.raw:a.raw.toString("base64");else throw new l(i,`Attachment ${a.filename} has no content`);return{content:u,filename:a.filename,type:a.contentType??"application/octet-stream",...a.cid&&{cid:a.cid}}}))),n.debug("Sending email via Mailtrap API",{subject:t.subject,to:t.to});const y={"Api-Token":s.apiToken,"Content-Type":"application/json"},d=await b(async()=>p(`${s.endpoint}/api/send`,{headers:y,method:"POST",timeout:s.timeout},JSON.stringify(t)),s.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]??A();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:h(i,"send email",r,n),success:!1}}},async validateCredentials(){return this.isAvailable()}}});export{L as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import d from"./EmailError-B-sEf3bp.js";const y=globalThis.Buffer!==void 0,p=async(i,s={},r)=>{const l=typeof i=="string"?new URL(i):i;try{const e=new Headers;s.headers&&Object.entries(s.headers).forEach(([t,u])=>{e.set(t,u)});const o={headers:e,method:s.method??(r?"POST":"GET")};r&&(typeof r=="string"||r instanceof Uint8Array?o.body=r:y&&r instanceof globalThis.Buffer?o.body=new Uint8Array(r):o.body=new Uint8Array(r));let c,a;s.timeout&&(c=new AbortController,a=setTimeout(()=>{c?.abort()},s.timeout),o.signal=c.signal);try{const t=await fetch(l.toString(),o);a&&clearTimeout(a);const u=(t.headers.get("content-type")??"").includes("application/json");let n;if(u)try{n=await t.json()}catch{n=await t.text()}else n=await t.text();const f=t.status>=200&&t.status<300,h={};return t.headers.forEach((m,w)=>{h[w]=m}),{data:{body:n,headers:h,statusCode:t.status},error:f?void 0:new d("http",`Request failed with status ${t.status}`,{code:t.status.toString()}),success:f}}catch(t){if(a&&clearTimeout(a),t instanceof Error&&t.name==="AbortError")return{error:new d("http",`Request timed out after ${s.timeout}ms`),success:!1};throw t}}catch(e){return{error:new d("http",`Request failed: ${e instanceof Error?e.message:String(e)}`,{cause:e instanceof Error?e:new Error(String(e))}),success:!1}}};export{p as m};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{createRequire as P}from"node:module";import d from"./EmailError-B-sEf3bp.js";import I from"./RequiredOptionError-DuNNY_a5.js";import{e as S}from"./generate-message-id-gXAuMz4g.js";import{s as k}from"./headers-to-record-De1Eg951.js";import{m as f}from"./make-request-BlK_B72c.js";import{u as h}from"./retry-3pnxTuNs.js";import{s as v,a as z}from"./sanitize-header-DJhgZl3y.js";import{f as E}from"./validate-email-options-mCM9dVug.js";import{defineProvider as M}from"./defineProvider-C9q-7iwt.js";import{P as q,h as w,c as K}from"./provider-base-gIoUu9so.js";import{k as y}from"./address-formatter-BWR2Dddx.js";const A=P(import.meta.url),g=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,T=i=>{if(typeof g<"u"&&g.versions&&g.versions.node){const[r,m]=g.versions.node.split(".").map(Number);if(r>22||r===22&&m>=3||r===20&&m>=16)return g.getBuiltinModule(i)}return A(i)},{Buffer:C}=T("node:buffer"),s="mandrill",N="https://mandrillapp.com/api/1.0",O=3e4,V=3,X=M((i={})=>{if(!i.apiKey)throw new I(s,"apiKey");const r={apiKey:i.apiKey,debug:i.debug??!1,endpoint:i.endpoint??N,retries:i.retries??V,timeout:i.timeout??O,...i.logger&&{logger:i.logger}},m=new q,o=K(s,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(s,"Email ID is required to retrieve email details"),success:!1};await m.ensureInitialized(()=>this.initialize(),s),o.debug("Retrieving email details",{id:e});const l={id:e,key:r.apiKey},t={"Content-Type":"application/json"},n=await h(async()=>f(`${r.endpoint}/messages/info.json`,{headers:t,method:"POST",timeout:r.timeout},JSON.stringify(l)),r.retries);return n.success?(o.debug("Email details retrieved successfully"),{data:n.data?.body,success:!0}):(o.debug("API request failed when retrieving email",n.error),{error:new d(s,`Failed to retrieve email: ${n.error instanceof Error?n.error.message:"Unknown error"}`,{cause:n.error}),success:!1})}catch(l){return{error:w(s,"retrieve email",l,o),success:!1}}},async initialize(){await m.ensureInitialized(async()=>{if(!await this.isAvailable())throw new d(s,"Mandrill API not available or invalid API key");o.debug("Provider initialized successfully")},s)},async isAvailable(){try{o.debug("Checking Mandrill API availability");const e={key:r.apiKey},l={"Content-Type":"application/json"},t=await f(`${r.endpoint}/users/info.json`,{headers:l,method:"POST",timeout:r.timeout},JSON.stringify(e));return o.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 o.debug("Error checking availability:",e),!1}},name:s,options:r,async sendEmail(e){try{const l=E(e);if(l.length>0)return{error:new d(s,`Invalid email options: ${l.join(", ")}`),success:!1};await m.ensureInitialized(()=>this.initialize(),s);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?`${v(e.replyTo.name)} <${e.replyTo.email}>`:e.replyTo.email;t.headers={"Reply-To":a}}if(e.headers){const a=k(e.headers),c={};Object.entries(a).forEach(([p,j])=>{c[z(p)]=v(j)}),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=C.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(s,`Attachment ${a.filename} has no content`);return{content:c,name:a.filename,type:a.contentType??"application/octet-stream"}})));const n={key:r.apiKey,message:t};e.templateName&&(n.template_name=e.templateName,e.templateContent&&(n.template_content=e.templateContent),e.templateVariables&&(n.template_vars=e.templateVariables)),e.globalMergeVars&&(t.global_merge_vars=e.globalMergeVars),e.mergeVars&&(t.merge_vars=e.mergeVars),e.sendAt&&(n.send_at=e.sendAt),o.debug("Sending email via Mandrill API",{subject:t.subject,to:t.to});const _={"Content-Type":"application/json"},u=await h(async()=>f(`${r.endpoint}/messages/send.json`,{headers:_,method:"POST",timeout:r.timeout},JSON.stringify(n)),r.retries);if(!u.success)return o.debug("API request failed when sending email",u.error),{error:u.error??new d(s,"Failed to send email"),success:!1};const b=u.data?.body?.[0]?.id??S();return o.debug("Email sent successfully",{messageId:b}),{data:{messageId:b,provider:s,response:u.data,sent:!0,timestamp:new Date},success:!0}}catch(l){return{error:w(s,"send email",l,o),success:!1}}},async validateCredentials(){return this.isAvailable()}}});export{X as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import d from"./EmailError-B-sEf3bp.js";import{c as E}from"./create-logger-BQTS3f-I.js";import{e as v}from"./generate-message-id-gXAuMz4g.js";import{f as S}from"./validate-email-options-mCM9dVug.js";import{defineProvider as I}from"./defineProvider-C9q-7iwt.js";const u="mock",p=new Map,D=()=>({debug:!1,delay:0,failureRate:0,randomDelayRange:{max:0,min:0},retries:0,simulateFailure:!1,timeout:0}),C=I((f={})=>{const c=`mock-${Date.now()}-${Math.random().toString(36).slice(2,9)}`;p.has(c)||p.set(c,[]);const a=p.get(c);if(!a)throw new Error(`Storage not found for instance: ${c}`);let y=!1,g;const s={...D(),defaultResponse:f.defaultResponse,logger:f.logger,randomDelayRange:f.randomDelayRange??{max:0,min:0},...f},r=E(u,s.logger);return{clearSentMessages(){a.length=0,r.debug("Cleared all sent messages")},features:{attachments:!0,batchSending:!0,customHeaders:!0,html:!0,replyTo:!0,scheduling:!1,tagging:!0,templates:!1,tracking:!1},findMessageBy(e){return a.find(t=>e(t))},findMessagesBy(e){return a.filter(t=>e(t))},async getEmail(e){try{if(!e)return{error:new d(u,"Email ID is required to retrieve email details"),success:!1};const t=a.find(o=>o.id===e);return t?(r.debug("Retrieved email",{id:e}),{data:t,success:!0}):{error:new d(u,`Email with ID ${e} not found`),success:!1}}catch(t){return r.debug("Exception retrieving email",t),{error:new d(u,`Failed to retrieve email: ${t.message}`,{cause:t}),success:!1}}},getInstance(){return a},getLastSentMessage(){return a.at(-1)},getMessagesBySubject(e){return a.filter(t=>t.options.subject===e)},getMessagesTo(e){return a.filter(t=>{const o=Array.isArray(t.options.to)?t.options.to:[t.options.to];let i=[];t.options.cc&&(i=Array.isArray(t.options.cc)?t.options.cc:[t.options.cc]);let l=[];return t.options.bcc&&(l=Array.isArray(t.options.bcc)?t.options.bcc:[t.options.bcc]),[...o,...i,...l].some(w=>w.email===e)})},getSentEmails(){return[...a]},getSentMessages(){return[...a]},getSentMessagesCount(){return a.length},async initialize(){y||(s.delay>0&&await new Promise(e=>{setTimeout(e,s.delay)}),y=!0,r.debug("Mock provider initialized"))},async isAvailable(){return!0},name:u,options:s,reset(){a.length=0,g=void 0;const e=D();s.debug=e.debug,s.delay=e.delay,s.failureRate=e.failureRate,s.retries=e.retries,s.simulateFailure=e.simulateFailure,s.timeout=e.timeout,s.randomDelayRange={max:0,min:0},s.defaultResponse=void 0,r.debug("Mock provider reset to initial state")},async sendEmail(e){try{const t=S(e);if(t.length>0)return{error:new d(u,`Invalid email options: ${t.join(", ")}`),success:!1};y||await this.initialize();let o=s.delay;if(s.randomDelayRange&&s.randomDelayRange.max>0){const{max:n,min:m}=s.randomDelayRange;o=Math.floor(Math.random()*(n-m+1))+m}if(o>0&&await new Promise(n=>{setTimeout(n,o)}),g!==void 0){const n=g;if(g=void 0,!n.successful)return r.debug("Using next response (failure)",n),{error:new d(u,n.errorMessages.join(", ")),success:!1};const m=n.messageId||v(),b=n.timestamp||new Date,h={messageId:m,provider:n.provider??u,response:n.response,sent:!0,timestamp:b},x={id:m,options:e,result:h,timestamp:b};return a.push(x),r.debug("Email stored using next response",{messageId:m}),{data:h,success:!0}}if(s.simulateFailure||s.failureRate>0&&Math.random()<s.failureRate)return r.debug("Simulating email send failure"),{error:new d(u,"Simulated failure"),success:!1};const i=s.defaultResponse?.successful?s.defaultResponse.messageId:v(),l=s.defaultResponse?.successful&&s.defaultResponse.timestamp?s.defaultResponse.timestamp:new Date,w=s.defaultResponse&&"response"in s.defaultResponse?s.defaultResponse.response:void 0,R={messageId:i,provider:u,response:w??{mock:!0,stored:!0},sent:!0,timestamp:l},M={id:i,options:e,result:R,timestamp:l};return a.push(M),r.debug("Email stored in mock provider",{messageId:i,subject:e.subject,to:Array.isArray(e.to)?e.to.map(n=>n.email):e.to.email}),{data:R,success:!0}}catch(t){return r.debug("Exception sending email",t),{error:new d(u,`Failed to send email: ${t.message}`,{cause:t}),success:!1}}},setDefaultResponse(e){s.defaultResponse=e,r.debug("Set default response",{receipt:e})},setDelay(e){if(e<0)throw new RangeError("Delay must be non-negative");s.delay=e,s.randomDelayRange={max:0,min:0},r.debug("Set fixed delay",{milliseconds:e})},setFailureRate(e){if(e<0||e>1)throw new RangeError("Failure rate must be between 0.0 and 1.0");s.failureRate=e,r.debug("Set failure rate",{rate:e})},setNextResponse(e){g=e,r.debug("Set next response",{receipt:e})},setRandomDelay(e,t){if(e<0||t<0||e>t)throw new RangeError("Invalid delay range");s.delay=0,s.randomDelayRange={max:t,min:e},r.debug("Set random delay range",{max:t,min:e})},async shutdown(){a.length=0,p.delete(c),r.debug("Mock provider shutdown")},async validateCredentials(){return!0},async waitForMessage(e,t=5e3){const o=Date.now();for(;;){const i=a.find(l=>e(l));if(i)return i;if(Date.now()-o>t)throw new Error("Timeout waiting for message");await new Promise(l=>{setTimeout(l,10)})}},async waitForMessageCount(e,t=5e3){const o=Date.now();for(;a.length<e;){if(Date.now()-o>t)throw new Error(`Timeout waiting for ${e} messages (got ${a.length})`);await new Promise(i=>{setTimeout(i,10)})}}}});export{C as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import u from"nodemailer";import p from"./EmailError-B-sEf3bp.js";import y from"./RequiredOptionError-DuNNY_a5.js";import{e as w}from"./generate-message-id-gXAuMz4g.js";import{s as g}from"./headers-to-record-De1Eg951.js";import{f as $}from"./validate-email-options-mCM9dVug.js";import{defineProvider as v}from"./defineProvider-C9q-7iwt.js";const i="nodemailer",H=v((c={})=>{if(!c.transport)throw new y(i,"transport");let r;const m=t=>{const s=t??c.transport;return u.createTransport(s)};let l=!1;const f=async()=>{if(!l)try{r=m(),await r.verify(),l=!0}catch(t){throw new p(i,`Failed to initialize nodemailer transport: ${t instanceof Error?t.message:String(t)}`,{cause:t instanceof Error?t:new Error(String(t))})}},h=t=>{const s=e=>e.name?`${e.name} <${e.email}>`:e.email,a=e=>e.name?`${e.name} <${e.email}>`:e.email,d=c.defaultFrom??t.from,n={from:s(d),subject:t.subject,to:Array.isArray(t.to)?t.to.map(e=>a(e)):a(t.to)};return t.text&&(n.text=t.text),t.html&&(n.html=t.html),t.cc&&(n.cc=Array.isArray(t.cc)?t.cc.map(e=>a(e)):a(t.cc)),t.bcc&&(n.bcc=Array.isArray(t.bcc)?t.bcc.map(e=>a(e)):a(t.bcc)),t.replyTo&&(n.replyTo=t.replyTo.name?`${t.replyTo.name} <${t.replyTo.email}>`:t.replyTo.email),t.headers&&(n.headers=g(t.headers)),t.attachments&&t.attachments.length>0&&(n.attachments=t.attachments.map(e=>{const o={filename:e.filename};return e.raw!==void 0?o.content=e.raw:e.content!==void 0?o.content=e.content:e.path&&(o.path=e.path),e.contentType&&(o.contentType=e.contentType),e.contentDisposition&&(o.contentDisposition=e.contentDisposition),e.cid&&(o.cid=e.cid),e.encoding&&(o.encoding=e.encoding),e.headers&&(o.headers=e.headers),e.href&&(o.href=e.href),e.httpHeaders&&(o.httpHeaders=e.httpHeaders),o})),n};return{features:{attachments:!0,customHeaders:!0,html:!0,replyTo:!0},initialize:f,isAvailable:async()=>{try{return r??=m(),await r.verify(),!0}catch{return!1}},name:i,options:c,sendEmail:async t=>{const s=$(t);if(s.length>0)return{error:new p(i,`Validation failed: ${s.join(", ")}`),success:!1};try{if(l||await f(),!r)throw new p(i,"Transporter not initialized. Call initialize() first.");const a=t.transportOverride?m(t.transportOverride):r,d=h(t),n=await a.sendMail(d);return{data:{messageId:n.messageId||w(),provider:i,response:n,sent:!0,timestamp:new Date},success:!0}}catch(a){return{error:new p(i,`Failed to send email: ${a instanceof Error?a.message:String(a)}`,{cause:a instanceof Error?a:new Error(String(a))}),success:!1}}},shutdown:async()=>{r&&typeof r.close=="function"&&r.close(),r=void 0,l=!1},validateCredentials:async()=>{try{return r??=m(),await r.verify(),!0}catch{return!1}}}});export{H as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const u=["re","fwd","fw","aw","wg","sv","vs"];class p{parent=new Map;find(e){if(!this.parent.has(e))return this.parent.set(e,e),e;let t=e,r=this.parent.get(t);for(;r!==void 0&&r!==t;)t=r,r=this.parent.get(t);return this.parent.set(e,t),t}union(e,t){const r=this.find(e),i=this.find(t);r!==i&&this.parent.set(r,i)}}const h=o=>o.replaceAll(/[<>]/g,"").trim(),d=o=>{let e=o.trim(),t=!0;for(;t;){t=!1;for(const r of u){if(!e.toLowerCase().startsWith(r))continue;const i=e.slice(r.length).trimStart();if(i.startsWith(":")){e=i.slice(1).trimStart(),t=!0;break}}}return e.replaceAll(/\s+/g," ").trim().toLowerCase()},g=o=>{const e=new p,t=new Map,r=(s,a)=>{if(s.messageId){const n=h(s.messageId);if(n!=="")return n}return`__index_${String(a)}`};o.forEach((s,a)=>{const n=r(s,a),f=[s.inReplyTo,...s.references].filter(c=>c!==void 0);for(const c of f)e.union(n,h(c));if(f.length===0&&s.subject){const c=d(s.subject);if(c){const l=t.get(c);l?e.union(n,l):t.set(c,n)}}});const i=new Map;return o.forEach((s,a)=>{const n=e.find(r(s,a)),f=i.get(n);f?f.push(s):i.set(n,[s])}),[...i.entries()].map(([s,a])=>({id:s,messages:a}))};export{h as normalizeMessageId,d as normalizeSubject,g as stitchThreads};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{s as u}from"./headers-to-record-De1Eg951.js";const p=o=>{const{fetchToken:r,headerName:s="Authorization",now:t=Date.now,onToken:n,scheme:c="Bearer",skewMs:i=6e4}=o;let e;const h=async()=>(e&&(e.expiresAt===void 0||e.expiresAt-i>t())&&e||(e=await r(),n?.(e)),e);return async(a,d)=>{const w=await h(),k=a.headers?u(a.headers):{};return d({...a,headers:{...k,[s]:`${c} ${w.accessToken}`}})}};export{p as oauth2Middleware};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{context as f,trace as h,SpanStatusCode as p}from"@opentelemetry/api";import m from"./EmailError-B-sEf3bp.js";import y from"./RequiredOptionError-DuNNY_a5.js";import{c as b}from"./create-logger-BQTS3f-I.js";import{defineProvider as E}from"./defineProvider-C9q-7iwt.js";const A=t=>typeof t=="function",S=t=>t!==null&&typeof t=="object"&&"sendEmail"in t&&"initialize"in t&&"isAvailable"in t,s="opentelemetry",x="email",z="email.send",d=t=>t?typeof t=="string"?t:Array.isArray(t)?t.map(i=>typeof i=="string"?i:i.email).join(", "):t.email:"",C=(t,i)=>{const a={"email.from":d(t.from),"email.subject":t.subject};return t.to&&(a["email.to"]=d(t.to)),t.cc&&(a["email.cc"]=d(t.cc)),t.bcc&&(a["email.bcc"]=d(t.bcc)),t.replyTo&&(a["email.reply_to"]=d(t.replyTo)),t.priority&&(a["email.priority"]=t.priority),t.tags&&t.tags.length>0&&(a["email.tags"]=t.tags.join(", ")),t.attachments&&t.attachments.length>0&&(a["email.attachments.count"]=t.attachments.length),i?(t.text&&(a["email.text.length"]=t.text.length),t.html&&(a["email.html.length"]=t.html.length)):(t.text&&(a["email.has_text"]=!0),t.html&&(a["email.has_html"]=!0)),a},F=E(t=>{if(!t?.provider)throw new y(s,"provider");const i={debug:t.debug??!1,logger:t.logger,provider:t.provider,recordContent:t.recordContent??!1,retries:t.retries??3,serviceName:t.serviceName??x,timeout:t.timeout??3e4,tracer:t.tracer};let a=!1,e;const c=b(s,t.logger),w=()=>i.tracer?i.tracer:h.getTracer(i.serviceName),u=async()=>{try{if(A(i.provider))e=i.provider({});else if(S(i.provider))e=i.provider;else throw new m(s,"Invalid provider: must be a Provider instance or ProviderFactory function");await e.initialize(),c.debug(`Initialized wrapped provider: ${e.name??"unknown"}`)}catch(o){throw new m(s,`Failed to initialize wrapped provider: ${o.message}`,{cause:o})}},v=()=>e?.features?e.features:{attachments:!0,batchSending:!1,customHeaders:!0,html:!0,replyTo:!0,scheduling:!1,tagging:!1,templates:!1,tracking:!1};return{get features(){return v()},getInstance(){if(!e)throw new m(s,"Provider not initialized. Call initialize() first.");return e},async initialize(){if(!a)try{await u(),a=!0,c.debug("OpenTelemetry provider initialized")}catch(o){throw new m(s,`Failed to initialize: ${o.message}`,{cause:o})}},async isAvailable(){try{return e||await u(),await e.isAvailable()}catch{return!1}},name:s,options:i,async sendEmail(o){const n=w().startSpan(z);try{e||await u();const l=C(o,i.recordContent);n.setAttributes(l),e.name&&n.setAttribute("email.provider",e.name);const r=await f.with(h.setSpan(f.active(),n),async()=>await e.sendEmail(o));if(r.success&&r.data)return n.setStatus({code:p.OK}),n.setAttribute("email.message_id",r.data.messageId),n.setAttribute("email.sent",!0),r.data.timestamp&&n.setAttribute("email.timestamp",r.data.timestamp.toISOString()),c.debug(`Email sent successfully via ${e.name??"unknown"}`),{data:{...r.data,provider:`${s}(${e.name??"unknown"})`},success:!0};const g=r.error instanceof Error?r.error.message:String(r.error??"Unknown error");return n.setStatus({code:p.ERROR,message:g}),n.setAttribute("email.sent",!1),n.recordException(r.error instanceof Error?r.error:new Error(g)),c.debug(`Failed to send email via ${e.name??"unknown"}:`,g),r}catch(l){const r=l instanceof Error?l.message:String(l);return n.setStatus({code:p.ERROR,message:r}),n.setAttribute("email.sent",!1),n.recordException(l instanceof Error?l:new Error(r)),c.debug("Exception sending email:",r),{error:new m(s,`Failed to send email: ${r}`,{cause:l}),success:!1}}finally{n.end()}},async shutdown(){e?.shutdown&&await e.shutdown(),a=!1},async validateCredentials(){try{return e||await u(),e.validateCredentials?await e.validateCredentials():await e.isAvailable()}catch{return!1}}}});export{F as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const o=/<[^<>]+>/g,f=/\s+/,a=/^"|"$/g,c=t=>{if(!(t===void 0||t.length===0))return t},l=t=>{if(!t)return;const r=t.trim();if(r.length===0)return;const e=r.lastIndexOf("<"),n=r.lastIndexOf(">");if(e!==-1&&n>e){const s=r.slice(e+1,n).trim(),i=r.slice(0,e).trim().replaceAll(a,"").trim();return i?{email:s,name:i}:{email:s}}return{email:r}},m=t=>{if(!t)return[];const r=[];let e="",n=!1;for(const s of t)s==='"'?(n=!n,e+=s):s===","&&!n?(r.push(e),e=""):e+=s;return e.trim()&&r.push(e),r.map(s=>l(s)).filter(s=>s!==void 0)},p=t=>{if(!t)return[];const r=t.match(o);return r?r.map(e=>e.trim()):t.split(f).map(e=>e.trim()).filter(e=>e.length>0)},u=t=>{const r={};if(!t)return r;for(const[e,n]of Object.entries(t))typeof n=="string"?r[e.toLowerCase()]=n:(typeof n=="number"||typeof n=="boolean")&&(r[e.toLowerCase()]=String(n));return r};export{u as lowercaseHeaders,c as nonEmpty,l as parseAddress,m as parseAddressList,p as parseReferences};
|