@visulima/email 2.1.6 → 2.1.7
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 +7 -0
- package/dist/crypto/index.d.ts +183 -183
- package/dist/crypto/index.js +1 -1
- package/dist/deliverability/dmarc-report.d.ts +43 -43
- package/dist/deliverability/dmarc-report.js +1 -1
- package/dist/deliverability/index.d.ts +201 -201
- package/dist/events/index.d.ts +17 -17
- package/dist/inbound/index.d.ts +180 -180
- package/dist/index.d.ts +35 -46
- package/dist/index.js +1 -1
- package/dist/middleware/index.d.ts +213 -216
- package/dist/middleware/index.js +1 -1
- package/dist/packem_shared/{DkimSigner-CiLBaXrg.js → DkimSigner-sLcIw9bp.js} +6 -6
- package/dist/packem_shared/{DraftMailMessage-CGTVuy2z.js → DraftMailMessage-C3YTXqWo.js} +1 -1
- package/dist/packem_shared/EmailError-CDvYwuqz.js +1 -0
- package/dist/packem_shared/{Mail-CYAwMRnX.js → Mail-CIyxkmxu.js} +1 -1
- package/dist/packem_shared/MailMessage-DuEXJiCg.js +1 -0
- package/dist/packem_shared/{RequiredOptionError-DuNNY_a5.js → RequiredOptionError-DU2lxzk3.js} +1 -1
- package/dist/packem_shared/SmimeEncrypter-CzTbQM-z.js +6 -0
- package/dist/packem_shared/SmimeSigner-DjLShaOw.js +8 -0
- package/dist/packem_shared/{ahaSendProvider-DSuZIzaQ.js → ahaSendProvider-br1yB2un.js} +1 -1
- package/dist/packem_shared/arcMessageSignatureBase-D54jQIWu.js +17 -0
- package/dist/packem_shared/attachment-processor-D1cbAhQi.js +1 -0
- package/dist/packem_shared/{autoSendProvider-DqAoelWR.js → autoSendProvider-BSP8ueOC.js} +1 -1
- package/dist/packem_shared/{awsSesProvider-ClK1FUln.js → awsSesProvider-zRICW1pH.js} +13 -13
- package/dist/packem_shared/azureProvider-DwN4c5dC.js +1 -0
- package/dist/packem_shared/{brevoProvider-CIzuIDlt.js → brevoProvider-C491beE_.js} +1 -1
- package/dist/packem_shared/{build-mime-message-BW5FQ2Bt.js → build-mime-message-DT67qfMp.js} +1 -1
- package/dist/packem_shared/{circuitBreakerMiddleware-D2SA_07f.js → circuitBreakerMiddleware-N0CKF90q.js} +1 -1
- package/dist/packem_shared/{cloudflareEmailProvider-B8mOEl3N.js → cloudflareEmailProvider-8JxzLbpX.js} +1 -1
- package/dist/packem_shared/{createTestEmail-f12yLlWn.js → createTestEmail-D_ksEez3.js} +1 -1
- package/dist/packem_shared/dedupeMiddleware-CYYI_O7S.js +1 -0
- package/dist/packem_shared/{detectMimeType-DFH3kp6K.js → detectMimeType-CmYmWDXE.js} +1 -1
- package/dist/packem_shared/event-bus.d-BNQA-FZE.d.ts +104 -0
- package/dist/packem_shared/{failoverProvider-BgX6zfnY.js → failoverProvider-6qwE_HSJ.js} +1 -1
- package/dist/packem_shared/generate-boundary-0xGe9GqK.js +1 -0
- package/dist/packem_shared/{httpProvider-aBfTXyCT.js → httpProvider-BqrdZhGw.js} +1 -1
- package/dist/packem_shared/index-Gd7m-UQA.js +11 -0
- package/dist/packem_shared/{infobipProvider-DxzsONUX.js → infobipProvider-C2FU6VMP.js} +1 -1
- package/dist/packem_shared/isValidSigningCertUrl-DNxPA0Q-.js +3 -0
- package/dist/packem_shared/{loopsProvider-QBsAH6Ee.js → loopsProvider-Bz63so6m.js} +1 -1
- package/dist/packem_shared/mail.d-xKtvoKMK.d.ts +909 -0
- package/dist/packem_shared/{mailCrabProvider-DRE5snM9.js → mailCrabProvider-bkQy-2a1.js} +1 -1
- package/dist/packem_shared/{mailPaceProvider-DCa-4ghl.js → mailPaceProvider-S1AB-AYq.js} +1 -1
- package/dist/packem_shared/{mailchannelsProvider-GiwkYBdD.js → mailchannelsProvider-B_K6X4VY.js} +1 -1
- package/dist/packem_shared/{mailerSendProvider-RK6IbUrL.js → mailerSendProvider-DPEww2H1.js} +1 -1
- package/dist/packem_shared/mailgunProvider-DKxzVbDW.js +1 -0
- package/dist/packem_shared/mailjetProvider-C2TQcujL.js +1 -0
- package/dist/packem_shared/{mailomatProvider-DPDpVS8r.js → mailomatProvider-B8-5bQsu.js} +1 -1
- package/dist/packem_shared/{mailtrapProvider-DtrS4Q34.js → mailtrapProvider-DW7TLOdG.js} +1 -1
- package/dist/packem_shared/{make-request-B9XjBynA.js → make-request-CylyuRaN.js} +1 -1
- package/dist/packem_shared/{mandrillProvider-B84zH-eV.js → mandrillProvider-S-0lKNGd.js} +1 -1
- package/dist/packem_shared/{mockProvider-Behywbl1.js → mockProvider-BAl292mW.js} +1 -1
- package/dist/packem_shared/{netcoreProvider-D-wtCyJj.js → netcoreProvider-DajMprlo.js} +1 -1
- package/dist/packem_shared/{nodemailerProvider-BFHobXxt.js → nodemailerProvider-DRo0lJ6g.js} +1 -1
- package/dist/packem_shared/{opentelemetryProvider-ByHC01ub.js → opentelemetryProvider-C6spx2CD.js} +1 -1
- package/dist/packem_shared/{outlook365Provider-Btk4Emig.js → outlook365Provider-B0o7UZBW.js} +1 -1
- package/dist/packem_shared/{plunkProvider-Bw8e6460.js → plunkProvider-DJzEUEtU.js} +1 -1
- package/dist/packem_shared/{postalProvider-CT8zr89z.js → postalProvider-DHFjFE3Y.js} +1 -1
- package/dist/packem_shared/{postmarkProvider-CQSqZWDs.js → postmarkProvider-Dt1EGGBA.js} +1 -1
- package/dist/packem_shared/{provider-base-C7PuopYK.js → provider-base-DjPzWncP.js} +1 -1
- package/dist/packem_shared/{provider.d-J-y6iogK.d.ts → provider.d-Cx5YQJdP.d.ts} +9 -9
- package/dist/packem_shared/{resendProvider-drJYlvLP.js → resendProvider-qjI86j_d.js} +1 -1
- package/dist/packem_shared/{retry-ipI5DRJ8.js → retry-CG9iT2wF.js} +1 -1
- package/dist/packem_shared/{roundRobinProvider-D1by5KGW.js → roundRobinProvider-CO5YvhgR.js} +1 -1
- package/dist/packem_shared/{scalewayProvider-DU5gXQrl.js → scalewayProvider-CihQKhw6.js} +1 -1
- package/dist/packem_shared/{sendGridProvider-BuTbEXW8.js → sendGridProvider-Dkc5AKlC.js} +1 -1
- package/dist/packem_shared/{smtpProvider-5MI3-EPh.js → smtpProvider-CIXMxPu-.js} +12 -12
- package/dist/packem_shared/{sparkpostProvider-UAsFYIjP.js → sparkpostProvider-CKxQhpyB.js} +1 -1
- package/dist/packem_shared/{sweegoProvider-SUz0LIcA.js → sweegoProvider-DjmAs6La.js} +1 -1
- package/dist/packem_shared/{tracer.d-MU42G1jG.d.ts → tracer.d-sb5yrt_n.d.ts} +2 -2
- package/dist/packem_shared/types.d-B0t3PQ3t.d.ts +107 -0
- package/dist/packem_shared/{types.d-ejzh-xBP.d.ts → types.d-B9295M4_.d.ts} +82 -82
- package/dist/packem_shared/types.d-BzoHR9nB.d.ts +61 -0
- package/dist/packem_shared/types.d-C5geVKes.d.ts +51 -0
- package/dist/packem_shared/types.d-GKqPNk0I.d.ts +24 -0
- package/dist/packem_shared/types.d-I-KeZ5w2.d.ts +9 -0
- package/dist/packem_shared/types.d-kHO4kX9q.d.ts +69 -0
- package/dist/packem_shared/utils-DjEtR3qT.js +1 -0
- package/dist/packem_shared/verifyMailgunWebhook-DNk080BF.js +1 -0
- package/dist/packem_shared/verifyPostmarkWebhook-B4OIEHQF.js +1 -0
- package/dist/packem_shared/verifyResendWebhook-C7E32LZ1.js +1 -0
- package/dist/packem_shared/verifySendGridWebhook-1l9bqIMw.js +1 -0
- package/dist/packem_shared/withEvents-CytsykaK.js +1 -0
- package/dist/packem_shared/{withSuppression-DBaZDMAr.js → withSuppression-BoaO4Qdz.js} +1 -1
- package/dist/packem_shared/{zeptomailProvider-DXNX9mG_.js → zeptomailProvider-DSTC9pUi.js} +1 -1
- package/dist/providers/ahasend/index.d.ts +18 -18
- package/dist/providers/ahasend/index.js +1 -1
- package/dist/providers/autosend/index.d.ts +30 -30
- package/dist/providers/autosend/index.js +1 -1
- package/dist/providers/aws-ses/index.d.ts +20 -20
- package/dist/providers/aws-ses/index.js +1 -1
- package/dist/providers/azure/index.d.ts +26 -26
- package/dist/providers/azure/index.js +1 -1
- package/dist/providers/brevo/index.d.ts +35 -35
- package/dist/providers/brevo/index.js +1 -1
- package/dist/providers/cloudflare-email/index.d.ts +25 -25
- package/dist/providers/cloudflare-email/index.js +1 -1
- package/dist/providers/failover/index.d.ts +14 -14
- package/dist/providers/failover/index.js +1 -1
- package/dist/providers/http/index.d.ts +15 -15
- package/dist/providers/http/index.js +1 -1
- package/dist/providers/infobip/index.d.ts +28 -28
- package/dist/providers/infobip/index.js +1 -1
- package/dist/providers/loops/index.d.ts +25 -25
- package/dist/providers/loops/index.js +1 -1
- package/dist/providers/mailchannels/index.d.ts +13 -13
- package/dist/providers/mailchannels/index.js +1 -1
- package/dist/providers/mailcrab/index.d.ts +17 -17
- package/dist/providers/mailcrab/index.js +1 -1
- package/dist/providers/mailersend/index.d.ts +24 -24
- package/dist/providers/mailersend/index.js +1 -1
- package/dist/providers/mailgun/index.d.ts +37 -37
- package/dist/providers/mailgun/index.js +1 -1
- package/dist/providers/mailjet/index.d.ts +36 -36
- package/dist/providers/mailjet/index.js +1 -1
- package/dist/providers/mailomat/index.d.ts +20 -20
- package/dist/providers/mailomat/index.js +1 -1
- package/dist/providers/mailpace/index.d.ts +24 -24
- package/dist/providers/mailpace/index.js +1 -1
- package/dist/providers/mailtrap/index.d.ts +22 -22
- package/dist/providers/mailtrap/index.js +1 -1
- package/dist/providers/mandrill/index.d.ts +36 -36
- package/dist/providers/mandrill/index.js +1 -1
- package/dist/providers/mock/index.d.ts +8 -8
- package/dist/providers/mock/index.js +1 -1
- package/dist/providers/netcore/index.d.ts +17 -17
- package/dist/providers/netcore/index.js +1 -1
- package/dist/providers/nodemailer/index.d.ts +22 -22
- package/dist/providers/nodemailer/index.js +1 -1
- package/dist/providers/opentelemetry/index.d.ts +20 -20
- package/dist/providers/opentelemetry/index.js +1 -1
- package/dist/providers/outlook365/index.d.ts +82 -82
- package/dist/providers/outlook365/index.js +1 -1
- package/dist/providers/plunk/index.d.ts +18 -18
- package/dist/providers/plunk/index.js +1 -1
- package/dist/providers/postal/index.d.ts +24 -24
- package/dist/providers/postal/index.js +1 -1
- package/dist/providers/postmark/index.d.ts +30 -30
- package/dist/providers/postmark/index.js +1 -1
- package/dist/providers/resend/index.d.ts +24 -24
- package/dist/providers/resend/index.js +1 -1
- package/dist/providers/roundrobin/index.d.ts +14 -14
- package/dist/providers/roundrobin/index.js +1 -1
- package/dist/providers/scaleway/index.d.ts +22 -22
- package/dist/providers/scaleway/index.js +1 -1
- package/dist/providers/sendgrid/index.d.ts +25 -25
- package/dist/providers/sendgrid/index.js +1 -1
- package/dist/providers/smtp/index.d.ts +11 -11
- package/dist/providers/smtp/index.js +1 -1
- package/dist/providers/sparkpost/index.d.ts +21 -21
- package/dist/providers/sparkpost/index.js +1 -1
- package/dist/providers/sweego/index.d.ts +20 -20
- package/dist/providers/sweego/index.js +1 -1
- package/dist/providers/zeptomail/index.d.ts +17 -17
- package/dist/providers/zeptomail/index.js +1 -1
- package/dist/queue/bullmq-queue.d.ts +26 -26
- package/dist/queue/index.d.ts +86 -86
- package/dist/queue/pg-boss-queue.d.ts +13 -13
- package/dist/queue/sqs-queue.d.ts +20 -20
- package/dist/queue/unstorage-queue.d.ts +47 -47
- package/dist/queue/unstorage-queue.js +1 -1
- package/dist/render/cid.d.ts +12 -12
- package/dist/render/css-inline.d.ts +12 -12
- package/dist/render/css-inline.js +1 -1
- package/dist/render/dark-mode.d.ts +12 -12
- package/dist/render/preheader.d.ts +16 -16
- package/dist/template-engines/handlebars.d.ts +19 -19
- package/dist/template-engines/handlebars.js +1 -1
- package/dist/template-engines/html-to-text.d.ts +12 -12
- package/dist/template-engines/html-to-text.js +1 -1
- package/dist/template-engines/i18n.d.ts +43 -43
- package/dist/template-engines/i18n.js +1 -1
- package/dist/template-engines/jsx-email.d.ts +8 -8
- package/dist/template-engines/jsx-email.js +1 -1
- package/dist/template-engines/liquid.d.ts +9 -9
- package/dist/template-engines/liquid.js +1 -1
- package/dist/template-engines/mjml.d.ts +9 -9
- package/dist/template-engines/mjml.js +1 -1
- package/dist/template-engines/react-email.d.ts +8 -8
- package/dist/template-engines/react-email.js +1 -1
- package/dist/template-engines/vue-email.d.ts +8 -8
- package/dist/template-engines/vue-email.js +1 -1
- package/dist/test/index.d.ts +89 -89
- package/dist/test/index.js +1 -1
- package/dist/utils/cache.d.ts +27 -27
- package/dist/utils/format-email-address.d.ts +6 -6
- package/dist/utils/format-email-address.js +1 -1
- package/dist/utils/normalize-email-aliases.d.ts +19 -19
- package/dist/utils/parse-address.d.ts +16 -16
- package/dist/utils/parse-eml.d.ts +18 -18
- package/dist/utils/result.d.ts +30 -30
- package/dist/utils/result.js +1 -1
- package/dist/utils/validation/check-feature-support.d.ts +33 -33
- package/dist/utils/validation/validate-email.d.ts +4 -4
- package/dist/webhooks/index.d.ts +134 -134
- package/dist/webhooks/index.js +1 -1
- package/package.json +1 -1
- package/dist/packem_shared/EmailError-B-sEf3bp.js +0 -1
- package/dist/packem_shared/MailMessage-DQRgs5Dz.js +0 -1
- package/dist/packem_shared/SmimeEncrypter-DavopRlE.js +0 -6
- package/dist/packem_shared/SmimeSigner-0onWksAv.js +0 -8
- package/dist/packem_shared/arcMessageSignatureBase-DDLEHW2E.js +0 -17
- package/dist/packem_shared/attachment-processor-CMp7qqMI.js +0 -1
- package/dist/packem_shared/azureProvider-Cw_Tmde6.js +0 -1
- package/dist/packem_shared/dedupeMiddleware-B6ajWOTi.js +0 -1
- package/dist/packem_shared/event-bus.d-DEl3w_EW.d.ts +0 -104
- package/dist/packem_shared/generate-boundary-DQbzDiOI.js +0 -1
- package/dist/packem_shared/index-BoZvzveg.js +0 -11
- package/dist/packem_shared/isValidSigningCertUrl-Bii1AMGC.js +0 -3
- package/dist/packem_shared/mail.d-B9SSqyy0.d.ts +0 -909
- package/dist/packem_shared/mailgunProvider-D9HUWGKN.js +0 -1
- package/dist/packem_shared/mailjetProvider-DelLs2Vt.js +0 -1
- package/dist/packem_shared/types.d-BId55FW2.d.ts +0 -107
- package/dist/packem_shared/types.d-CmoWvdZi.d.ts +0 -61
- package/dist/packem_shared/types.d-DCkecJse.d.ts +0 -51
- package/dist/packem_shared/types.d-Mpu0HZoG.d.ts +0 -24
- package/dist/packem_shared/types.d-lcJZmwRK.d.ts +0 -69
- package/dist/packem_shared/types.d-nyR1ty1Q.d.ts +0 -9
- package/dist/packem_shared/utils-BfYfPB_I.js +0 -1
- package/dist/packem_shared/verifyMailgunWebhook-Cwl0OD3P.js +0 -1
- package/dist/packem_shared/verifyPostmarkWebhook-C72ZvbrG.js +0 -1
- package/dist/packem_shared/verifyResendWebhook-YK2zNDXR.js +0 -1
- package/dist/packem_shared/verifySendGridWebhook-Dbwc1tfG.js +0 -1
- package/dist/packem_shared/withEvents-CCVblSqj.js +0 -1
package/dist/queue/index.d.ts
CHANGED
|
@@ -1,147 +1,147 @@
|
|
|
1
|
-
import { E as EmailOptions, a as EmailResult, R as Result } from "../packem_shared/types.d-
|
|
2
|
-
import { E as EnqueueOptions, Q as QueueJob, a as EmailQueue } from "../packem_shared/types.d-
|
|
1
|
+
import { E as EmailOptions, a as EmailResult, R as Result } from "../packem_shared/types.d-B9295M4_.js";
|
|
2
|
+
import { E as EnqueueOptions, Q as QueueJob, a as EmailQueue } from "../packem_shared/types.d-kHO4kX9q.js";
|
|
3
3
|
export { UnstorageQueue, type UnstorageQueueOptions, createUnstorageQueue } from "./unstorage-queue.js";
|
|
4
4
|
import 'node:buffer';
|
|
5
5
|
/**
|
|
6
|
-
* Options for {@link MemoryQueue}.
|
|
7
|
-
*/
|
|
6
|
+
* Options for {@link MemoryQueue}.
|
|
7
|
+
*/
|
|
8
8
|
interface MemoryQueueOptions {
|
|
9
9
|
/**
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
* Time source in milliseconds — injectable for tests. Defaults to `Date.now`.
|
|
11
|
+
*/
|
|
12
12
|
now?: () => number;
|
|
13
13
|
/**
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
14
|
+
* How long, in milliseconds, a reserved job stays hidden before it becomes deliverable again
|
|
15
|
+
* (in case the worker crashed mid-process).
|
|
16
|
+
* @default 30000
|
|
17
|
+
*/
|
|
18
18
|
visibilityTimeout?: number;
|
|
19
19
|
}
|
|
20
20
|
/**
|
|
21
|
-
* An in-memory {@link EmailQueue} with `scheduledAt` support and a reservation visibility timeout.
|
|
22
|
-
*
|
|
23
|
-
* Suitable for tests, single-process apps, and as a reference for adapter authors. Jobs do not survive
|
|
24
|
-
* a process restart — use a durable adapter in production.
|
|
25
|
-
*/
|
|
21
|
+
* An in-memory {@link EmailQueue} with `scheduledAt` support and a reservation visibility timeout.
|
|
22
|
+
*
|
|
23
|
+
* Suitable for tests, single-process apps, and as a reference for adapter authors. Jobs do not survive
|
|
24
|
+
* a process restart — use a durable adapter in production.
|
|
25
|
+
*/
|
|
26
26
|
declare class MemoryQueue implements EmailQueue {
|
|
27
27
|
private readonly jobs;
|
|
28
28
|
private readonly visibilityTimeout;
|
|
29
29
|
private readonly now;
|
|
30
30
|
private sequence;
|
|
31
31
|
/**
|
|
32
|
-
|
|
33
|
-
|
|
32
|
+
* @param options Queue options. See {@link MemoryQueueOptions}.
|
|
33
|
+
*/
|
|
34
34
|
constructor(options?: MemoryQueueOptions);
|
|
35
35
|
/**
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
36
|
+
* Adds a message to the queue.
|
|
37
|
+
* @param message The message to send later.
|
|
38
|
+
* @param options Optional scheduling. See {@link EnqueueOptions}.
|
|
39
|
+
* @returns The new job id.
|
|
40
|
+
*/
|
|
41
41
|
enqueue(message: EmailOptions, options?: EnqueueOptions): string;
|
|
42
42
|
/**
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
43
|
+
* Reserves the next ready job, hiding it for the visibility window.
|
|
44
|
+
* @returns The next deliverable job, or `undefined` when none is ready.
|
|
45
|
+
*/
|
|
46
46
|
reserve(): QueueJob | undefined;
|
|
47
47
|
/**
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
48
|
+
* Marks a reserved job as processed and removes it.
|
|
49
|
+
* @param id The job id.
|
|
50
|
+
*/
|
|
51
51
|
ack(id: string): void;
|
|
52
52
|
/**
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
53
|
+
* Returns a job to the queue after a delay, incrementing its attempt count.
|
|
54
|
+
* @param id The job id.
|
|
55
|
+
* @param delayMs Milliseconds to wait before the job becomes ready again.
|
|
56
|
+
*/
|
|
57
57
|
retry(id: string, delayMs?: number): void;
|
|
58
58
|
/**
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
59
|
+
* Reports how many jobs remain (ready plus reserved).
|
|
60
|
+
* @returns The count of ready and reserved jobs.
|
|
61
|
+
*/
|
|
62
62
|
size(): number;
|
|
63
63
|
}
|
|
64
64
|
/**
|
|
65
|
-
* Options for {@link createWorker}.
|
|
66
|
-
*/
|
|
65
|
+
* Options for {@link createWorker}.
|
|
66
|
+
*/
|
|
67
67
|
interface WorkerOptions {
|
|
68
68
|
/**
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
69
|
+
* Retry backoff: returns the delay (ms) before re-attempting after `attempts` failures.
|
|
70
|
+
* @default attempts => 1000 * 2 ** (attempts - 1)
|
|
71
|
+
*/
|
|
72
72
|
backoff?: (attempts: number) => number;
|
|
73
73
|
/**
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
74
|
+
* How many jobs to process concurrently.
|
|
75
|
+
* @default 1
|
|
76
|
+
*/
|
|
77
77
|
concurrency?: number;
|
|
78
78
|
/**
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
79
|
+
* Maximum delivery attempts before a job is dead-lettered.
|
|
80
|
+
* @default 3
|
|
81
|
+
*/
|
|
82
82
|
maxAttempts?: number;
|
|
83
83
|
/**
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
84
|
+
* Called when a job exhausts its attempts and is dropped.
|
|
85
|
+
* @param job The dead-lettered job.
|
|
86
|
+
* @param result The final failed result.
|
|
87
|
+
*/
|
|
88
88
|
onDeadLetter?: (job: QueueJob, result: Result<EmailResult>) => void;
|
|
89
89
|
/**
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
90
|
+
* Called on every failed attempt (before any retry).
|
|
91
|
+
* @param job The job that failed.
|
|
92
|
+
* @param result The failed result (or thrown error wrapped).
|
|
93
|
+
*/
|
|
94
94
|
onError?: (job: QueueJob, result: Result<EmailResult>) => void;
|
|
95
95
|
/**
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
96
|
+
* Called when `queue.reserve()` itself rejects (e.g. a transient store error). The poll loop keeps
|
|
97
|
+
* running regardless; this hook just surfaces the failure.
|
|
98
|
+
* @param error The reserve error.
|
|
99
|
+
*/
|
|
100
100
|
onReserveError?: (error: Error) => void;
|
|
101
101
|
/**
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
102
|
+
* Idle poll interval, in milliseconds, when no job is ready.
|
|
103
|
+
* @default 1000
|
|
104
|
+
*/
|
|
105
105
|
pollInterval?: number;
|
|
106
106
|
/**
|
|
107
|
-
|
|
108
|
-
|
|
107
|
+
* The queue to consume.
|
|
108
|
+
*/
|
|
109
109
|
queue: EmailQueue;
|
|
110
110
|
/**
|
|
111
|
-
|
|
112
|
-
|
|
111
|
+
* The send function — typically `mail.send.bind(mail)`.
|
|
112
|
+
*/
|
|
113
113
|
send: (message: EmailOptions) => Promise<Result<EmailResult>>;
|
|
114
114
|
}
|
|
115
115
|
/**
|
|
116
|
-
* A running queue worker.
|
|
117
|
-
*/
|
|
116
|
+
* A running queue worker.
|
|
117
|
+
*/
|
|
118
118
|
interface Worker {
|
|
119
119
|
/**
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
120
|
+
* Processes ready jobs until the queue has none currently deliverable, then resolves.
|
|
121
|
+
*
|
|
122
|
+
* Does not wait for future-scheduled jobs. Useful in tests and one-shot drains.
|
|
123
|
+
*/
|
|
124
124
|
drain: () => Promise<void>;
|
|
125
125
|
/**
|
|
126
|
-
|
|
127
|
-
|
|
126
|
+
* Begins polling and processing jobs in the background.
|
|
127
|
+
*/
|
|
128
128
|
start: () => void;
|
|
129
129
|
/**
|
|
130
|
-
|
|
131
|
-
|
|
130
|
+
* Stops polling. In-flight jobs are allowed to finish.
|
|
131
|
+
*/
|
|
132
132
|
stop: () => void;
|
|
133
133
|
}
|
|
134
134
|
/**
|
|
135
|
-
* Creates a worker that durably processes queued messages with bounded concurrency, retry/backoff, and
|
|
136
|
-
* dead-lettering.
|
|
137
|
-
* @param options Worker configuration. See {@link WorkerOptions}.
|
|
138
|
-
* @returns The worker handle. See {@link Worker}.
|
|
139
|
-
* @example
|
|
140
|
-
* ```ts
|
|
141
|
-
* const queue = new MemoryQueue();
|
|
142
|
-
* const worker = createWorker({ queue, send: mail.send.bind(mail), concurrency: 5 });
|
|
143
|
-
* worker.start();
|
|
144
|
-
* ```
|
|
145
|
-
*/
|
|
135
|
+
* Creates a worker that durably processes queued messages with bounded concurrency, retry/backoff, and
|
|
136
|
+
* dead-lettering.
|
|
137
|
+
* @param options Worker configuration. See {@link WorkerOptions}.
|
|
138
|
+
* @returns The worker handle. See {@link Worker}.
|
|
139
|
+
* @example
|
|
140
|
+
* ```ts
|
|
141
|
+
* const queue = new MemoryQueue();
|
|
142
|
+
* const worker = createWorker({ queue, send: mail.send.bind(mail), concurrency: 5 });
|
|
143
|
+
* worker.start();
|
|
144
|
+
* ```
|
|
145
|
+
*/
|
|
146
146
|
declare const createWorker: (options: WorkerOptions) => Worker;
|
|
147
147
|
export { type EmailQueue, type EnqueueOptions, MemoryQueue, type MemoryQueueOptions, type QueueJob, type Worker, type WorkerOptions, createWorker };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { a as EmailQueue } from "../packem_shared/types.d-
|
|
2
|
-
import "../packem_shared/types.d-
|
|
1
|
+
import { a as EmailQueue } from "../packem_shared/types.d-kHO4kX9q.js";
|
|
2
|
+
import "../packem_shared/types.d-B9295M4_.js";
|
|
3
3
|
import 'node:buffer';
|
|
4
4
|
interface PgBossJob {
|
|
5
5
|
data: unknown;
|
|
@@ -8,8 +8,8 @@ interface PgBossJob {
|
|
|
8
8
|
retryCount?: number;
|
|
9
9
|
}
|
|
10
10
|
/**
|
|
11
|
-
* The subset of a [pg-boss](https://github.com/timgit/pg-boss) instance this adapter uses (v10 API).
|
|
12
|
-
*/
|
|
11
|
+
* The subset of a [pg-boss](https://github.com/timgit/pg-boss) instance this adapter uses (v10 API).
|
|
12
|
+
*/
|
|
13
13
|
interface PgBossLike {
|
|
14
14
|
complete: (name: string, id: string) => Promise<unknown>;
|
|
15
15
|
fail: (name: string, id: string) => Promise<unknown>;
|
|
@@ -23,19 +23,19 @@ interface PgBossLike {
|
|
|
23
23
|
}) => Promise<null | string>;
|
|
24
24
|
}
|
|
25
25
|
/**
|
|
26
|
-
* Options for {@link createPgBossQueue}.
|
|
27
|
-
*/
|
|
26
|
+
* Options for {@link createPgBossQueue}.
|
|
27
|
+
*/
|
|
28
28
|
interface PgBossQueueOptions {
|
|
29
29
|
/**
|
|
30
|
-
|
|
31
|
-
|
|
30
|
+
* The pg-boss queue name.
|
|
31
|
+
*/
|
|
32
32
|
queueName: string;
|
|
33
33
|
}
|
|
34
34
|
/**
|
|
35
|
-
* Creates an {@link EmailQueue} backed by pg-boss.
|
|
36
|
-
* @param boss A started pg-boss instance (optional peer).
|
|
37
|
-
* @param options Queue options. See {@link PgBossQueueOptions}.
|
|
38
|
-
* @returns The pg-boss-backed queue.
|
|
39
|
-
*/
|
|
35
|
+
* Creates an {@link EmailQueue} backed by pg-boss.
|
|
36
|
+
* @param boss A started pg-boss instance (optional peer).
|
|
37
|
+
* @param options Queue options. See {@link PgBossQueueOptions}.
|
|
38
|
+
* @returns The pg-boss-backed queue.
|
|
39
|
+
*/
|
|
40
40
|
declare const createPgBossQueue: (boss: PgBossLike, options: PgBossQueueOptions) => EmailQueue;
|
|
41
41
|
export { type PgBossLike, type PgBossQueueOptions, createPgBossQueue };
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { a as EmailQueue } from "../packem_shared/types.d-
|
|
2
|
-
import "../packem_shared/types.d-
|
|
1
|
+
import { a as EmailQueue } from "../packem_shared/types.d-kHO4kX9q.js";
|
|
2
|
+
import "../packem_shared/types.d-B9295M4_.js";
|
|
3
3
|
import 'node:buffer';
|
|
4
4
|
/**
|
|
5
|
-
* The subset of the `@aws-sdk/client-sqs` `SQS` client this adapter uses. The `SQS` class (not the
|
|
6
|
-
* lower-level `SQSClient`) exposes these operation methods directly.
|
|
7
|
-
*/
|
|
5
|
+
* The subset of the `@aws-sdk/client-sqs` `SQS` client this adapter uses. The `SQS` class (not the
|
|
6
|
+
* lower-level `SQSClient`) exposes these operation methods directly.
|
|
7
|
+
*/
|
|
8
8
|
interface SqsClientLike {
|
|
9
9
|
changeMessageVisibility: (input: {
|
|
10
10
|
QueueUrl: string;
|
|
@@ -44,29 +44,29 @@ interface SqsClientLike {
|
|
|
44
44
|
}>;
|
|
45
45
|
}
|
|
46
46
|
/**
|
|
47
|
-
* Options for {@link createSqsQueue}.
|
|
48
|
-
*/
|
|
47
|
+
* Options for {@link createSqsQueue}.
|
|
48
|
+
*/
|
|
49
49
|
interface SqsQueueOptions {
|
|
50
50
|
/**
|
|
51
|
-
|
|
52
|
-
|
|
51
|
+
* The SQS queue URL.
|
|
52
|
+
*/
|
|
53
53
|
queueUrl: string;
|
|
54
54
|
/**
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
55
|
+
* Visibility timeout (seconds) applied when reserving a message.
|
|
56
|
+
* @default 30
|
|
57
|
+
*/
|
|
58
58
|
visibilityTimeout?: number;
|
|
59
59
|
/**
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
60
|
+
* Long-poll wait time (seconds) for `reserve`.
|
|
61
|
+
* @default 0
|
|
62
|
+
*/
|
|
63
63
|
waitTimeSeconds?: number;
|
|
64
64
|
}
|
|
65
65
|
/**
|
|
66
|
-
* Creates an {@link EmailQueue} backed by Amazon SQS.
|
|
67
|
-
* @param client An `@aws-sdk/client-sqs` `SQS` instance (optional peer).
|
|
68
|
-
* @param options Queue options. See {@link SqsQueueOptions}.
|
|
69
|
-
* @returns The SQS-backed queue.
|
|
70
|
-
*/
|
|
66
|
+
* Creates an {@link EmailQueue} backed by Amazon SQS.
|
|
67
|
+
* @param client An `@aws-sdk/client-sqs` `SQS` instance (optional peer).
|
|
68
|
+
* @param options Queue options. See {@link SqsQueueOptions}.
|
|
69
|
+
* @returns The SQS-backed queue.
|
|
70
|
+
*/
|
|
71
71
|
declare const createSqsQueue: (client: SqsClientLike, options: SqsQueueOptions) => EmailQueue;
|
|
72
72
|
export { type SqsClientLike, type SqsQueueOptions, createSqsQueue };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { E as EmailOptions } from "../packem_shared/types.d-
|
|
2
|
-
import { E as EnqueueOptions, Q as QueueJob, a as EmailQueue } from "../packem_shared/types.d-
|
|
1
|
+
import { E as EmailOptions } from "../packem_shared/types.d-B9295M4_.js";
|
|
2
|
+
import { E as EnqueueOptions, Q as QueueJob, a as EmailQueue } from "../packem_shared/types.d-kHO4kX9q.js";
|
|
3
3
|
import 'node:buffer';
|
|
4
4
|
type StorageValue = null | string | number | boolean | object;
|
|
5
5
|
type WatchEvent = "update" | "remove";
|
|
@@ -121,79 +121,79 @@ interface Storage<T extends StorageValue = StorageValue> {
|
|
|
121
121
|
remove: Storage<T>["removeItem"];
|
|
122
122
|
}
|
|
123
123
|
/**
|
|
124
|
-
* Options for {@link UnstorageQueue}.
|
|
125
|
-
*/
|
|
124
|
+
* Options for {@link UnstorageQueue}.
|
|
125
|
+
*/
|
|
126
126
|
interface UnstorageQueueOptions {
|
|
127
127
|
/**
|
|
128
|
-
|
|
129
|
-
|
|
128
|
+
* Time source in milliseconds — injectable for tests. Defaults to `Date.now`.
|
|
129
|
+
*/
|
|
130
130
|
now?: () => number;
|
|
131
131
|
/**
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
132
|
+
* Key prefix under which jobs are stored.
|
|
133
|
+
* @default "email:queue"
|
|
134
|
+
*/
|
|
135
135
|
prefix?: string;
|
|
136
136
|
/**
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
137
|
+
* How long, in milliseconds, a reserved job stays hidden before becoming deliverable again.
|
|
138
|
+
* @default 30000
|
|
139
|
+
*/
|
|
140
140
|
visibilityTimeout?: number;
|
|
141
141
|
}
|
|
142
142
|
/**
|
|
143
|
-
* A durable {@link EmailQueue} backed by an [unstorage](https://unstorage.unjs.io/) `Storage`.
|
|
144
|
-
*
|
|
145
|
-
* Because unstorage abstracts many backends (memory, filesystem, Redis, Cloudflare KV, Postgres, …),
|
|
146
|
-
* a single adapter persists the queue across all of them. The stored `message` must be
|
|
147
|
-
* JSON-serializable (avoid `Buffer` attachments — pass `path`/`href`/base64 `content` instead).
|
|
148
|
-
*
|
|
149
|
-
* Note: unstorage has no transactions, so {@link UnstorageQueue.reserve} is best-effort under
|
|
150
|
-
* concurrent workers; the visibility timeout bounds duplicate delivery on a crash.
|
|
151
|
-
*/
|
|
143
|
+
* A durable {@link EmailQueue} backed by an [unstorage](https://unstorage.unjs.io/) `Storage`.
|
|
144
|
+
*
|
|
145
|
+
* Because unstorage abstracts many backends (memory, filesystem, Redis, Cloudflare KV, Postgres, …),
|
|
146
|
+
* a single adapter persists the queue across all of them. The stored `message` must be
|
|
147
|
+
* JSON-serializable (avoid `Buffer` attachments — pass `path`/`href`/base64 `content` instead).
|
|
148
|
+
*
|
|
149
|
+
* Note: unstorage has no transactions, so {@link UnstorageQueue.reserve} is best-effort under
|
|
150
|
+
* concurrent workers; the visibility timeout bounds duplicate delivery on a crash.
|
|
151
|
+
*/
|
|
152
152
|
declare class UnstorageQueue implements EmailQueue {
|
|
153
153
|
private readonly storage;
|
|
154
154
|
private readonly prefix;
|
|
155
155
|
private readonly visibilityTimeout;
|
|
156
156
|
private readonly now;
|
|
157
157
|
/**
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
158
|
+
* @param storage The unstorage instance to persist jobs in.
|
|
159
|
+
* @param options Adapter options. See {@link UnstorageQueueOptions}.
|
|
160
|
+
*/
|
|
161
161
|
constructor(storage: Storage, options?: UnstorageQueueOptions);
|
|
162
162
|
/**
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
163
|
+
* Persists a message to the store.
|
|
164
|
+
* @param message The message to send later.
|
|
165
|
+
* @param options Optional scheduling. See {@link EnqueueOptions}.
|
|
166
|
+
* @returns The new job id.
|
|
167
|
+
*/
|
|
168
168
|
enqueue(message: EmailOptions, options?: EnqueueOptions): Promise<string>;
|
|
169
169
|
/**
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
170
|
+
* Reserves the next ready job, hiding it for the visibility window.
|
|
171
|
+
* @returns The next deliverable job, or `undefined` when none is ready.
|
|
172
|
+
*/
|
|
173
173
|
reserve(): Promise<QueueJob | undefined>;
|
|
174
174
|
/**
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
175
|
+
* Removes a processed job from the store.
|
|
176
|
+
* @param id The job id.
|
|
177
|
+
*/
|
|
178
178
|
ack(id: string): Promise<void>;
|
|
179
179
|
/**
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
180
|
+
* Requeues a job after a delay, incrementing its attempt count.
|
|
181
|
+
* @param id The job id.
|
|
182
|
+
* @param delayMs Milliseconds to wait before the job becomes ready again.
|
|
183
|
+
*/
|
|
184
184
|
retry(id: string, delayMs?: number): Promise<void>;
|
|
185
185
|
/**
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
186
|
+
* Counts the jobs currently in the store.
|
|
187
|
+
* @returns The number of stored (ready plus reserved) jobs.
|
|
188
|
+
*/
|
|
189
189
|
size(): Promise<number>;
|
|
190
190
|
private keyOf;
|
|
191
191
|
}
|
|
192
192
|
/**
|
|
193
|
-
* Creates an {@link UnstorageQueue}.
|
|
194
|
-
* @param storage The unstorage instance to persist jobs in.
|
|
195
|
-
* @param options Adapter options. See {@link UnstorageQueueOptions}.
|
|
196
|
-
* @returns A new {@link UnstorageQueue}.
|
|
197
|
-
*/
|
|
193
|
+
* Creates an {@link UnstorageQueue}.
|
|
194
|
+
* @param storage The unstorage instance to persist jobs in.
|
|
195
|
+
* @param options Adapter options. See {@link UnstorageQueueOptions}.
|
|
196
|
+
* @returns A new {@link UnstorageQueue}.
|
|
197
|
+
*/
|
|
198
198
|
declare const createUnstorageQueue: (storage: Storage, options?: UnstorageQueueOptions) => UnstorageQueue;
|
|
199
199
|
export { UnstorageQueue, UnstorageQueueOptions, createUnstorageQueue };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{createRequire as n}from"node:module";const c
|
|
1
|
+
import{createRequire as n}from"node:module";let c;const u=r=>(c??=n(import.meta.url))(r),o=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,d=r=>{if(typeof o<"u"&&o.versions&&o.versions.node){const[e,s]=o.versions.node.split(".").map(Number);if(e>22||e===22&&s>=3||e===20&&s>=16)return o.getBuiltinModule(r)}return u(r)},{randomUUID:h}=d("node:crypto");class l{storage;prefix;visibilityTimeout;now;constructor(e,s={}){this.storage=e,this.prefix=s.prefix??"email:queue",this.visibilityTimeout=s.visibilityTimeout??3e4,this.now=s.now??Date.now}async enqueue(e,s={}){const i=h(),t=s.scheduledAt instanceof Date?s.scheduledAt.getTime():s.scheduledAt??this.now(),a={attempts:0,id:i,message:e,reservedUntil:0,scheduledAt:t};return await this.storage.setItem(this.keyOf(i),a),i}async reserve(){const e=this.now(),s=await this.storage.getKeys(this.prefix);for(const i of s){const t=await this.storage.getItem(i);if(t&&t.scheduledAt<=e&&t.reservedUntil<=e)return t.reservedUntil=e+this.visibilityTimeout,await this.storage.setItem(i,t),{attempts:t.attempts,id:t.id,message:t.message,scheduledAt:t.scheduledAt}}}async ack(e){await this.storage.removeItem(this.keyOf(e))}async retry(e,s=0){const i=this.keyOf(e),t=await this.storage.getItem(i);t&&(t.attempts+=1,t.reservedUntil=0,t.scheduledAt=this.now()+s,await this.storage.setItem(i,t))}async size(){return(await this.storage.getKeys(this.prefix)).length}keyOf(e){return`${this.prefix}:${e}`}}const g=(r,e)=>new l(r,e);export{l as UnstorageQueue,g as createUnstorageQueue};
|
package/dist/render/cid.d.ts
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Rewrites `cid:` references in `src`/`href` attributes using a resolver.
|
|
3
|
-
*
|
|
4
|
-
* Useful for turning inline (Content-ID) image references into hosted URLs for previews/webmail, or
|
|
5
|
-
* for normalizing them. Returning `undefined` from the resolver leaves that reference unchanged.
|
|
6
|
-
* @param html The HTML email.
|
|
7
|
-
* @param resolver Maps a Content-ID to a replacement URL (or `undefined` to keep it).
|
|
8
|
-
* @returns The rewritten HTML.
|
|
9
|
-
*/
|
|
2
|
+
* Rewrites `cid:` references in `src`/`href` attributes using a resolver.
|
|
3
|
+
*
|
|
4
|
+
* Useful for turning inline (Content-ID) image references into hosted URLs for previews/webmail, or
|
|
5
|
+
* for normalizing them. Returning `undefined` from the resolver leaves that reference unchanged.
|
|
6
|
+
* @param html The HTML email.
|
|
7
|
+
* @param resolver Maps a Content-ID to a replacement URL (or `undefined` to keep it).
|
|
8
|
+
* @returns The rewritten HTML.
|
|
9
|
+
*/
|
|
10
10
|
declare const rewriteCidLinks: (html: string, resolver: (cid: string) => string | undefined) => string;
|
|
11
11
|
/**
|
|
12
|
-
* Collects the Content-IDs referenced via `cid:` in `src`/`href` attributes.
|
|
13
|
-
* @param html The HTML email.
|
|
14
|
-
* @returns The referenced Content-IDs (de-duplicated, in first-seen order).
|
|
15
|
-
*/
|
|
12
|
+
* Collects the Content-IDs referenced via `cid:` in `src`/`href` attributes.
|
|
13
|
+
* @param html The HTML email.
|
|
14
|
+
* @returns The referenced Content-IDs (de-duplicated, in first-seen order).
|
|
15
|
+
*/
|
|
16
16
|
declare const extractCidReferences: (html: string) => string[];
|
|
17
17
|
export { extractCidReferences, rewriteCidLinks };
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Inlines `<style>`/linked CSS into element `style` attributes for maximum email-client
|
|
3
|
-
* compatibility, via [juice](https://github.com/Automattic/juice).
|
|
4
|
-
*
|
|
5
|
-
* `juice` is an optional peer dependency, and this helper is published as its own subpath
|
|
6
|
-
* (`@visulima/email/render/css-inline`). Importing this module resolves `juice` eagerly, so install
|
|
7
|
-
* it (`pnpm add juice`) before importing — consumers who never inline CSS simply never import this
|
|
8
|
-
* entry, which keeps `juice` out of edge/worker bundles.
|
|
9
|
-
* @param html The HTML email.
|
|
10
|
-
* @param options Options forwarded to `juice` (e.g. `preserveImportant`, `removeStyleTags`).
|
|
11
|
-
* @returns The HTML with CSS inlined.
|
|
12
|
-
* @throws {EmailError} When inlining fails.
|
|
13
|
-
*/
|
|
2
|
+
* Inlines `<style>`/linked CSS into element `style` attributes for maximum email-client
|
|
3
|
+
* compatibility, via [juice](https://github.com/Automattic/juice).
|
|
4
|
+
*
|
|
5
|
+
* `juice` is an optional peer dependency, and this helper is published as its own subpath
|
|
6
|
+
* (`@visulima/email/render/css-inline`). Importing this module resolves `juice` eagerly, so install
|
|
7
|
+
* it (`pnpm add juice`) before importing — consumers who never inline CSS simply never import this
|
|
8
|
+
* entry, which keeps `juice` out of edge/worker bundles.
|
|
9
|
+
* @param html The HTML email.
|
|
10
|
+
* @param options Options forwarded to `juice` (e.g. `preserveImportant`, `removeStyleTags`).
|
|
11
|
+
* @returns The HTML with CSS inlined.
|
|
12
|
+
* @throws {EmailError} When inlining fails.
|
|
13
|
+
*/
|
|
14
14
|
declare const inlineCss: (html: string, options?: Record<string, unknown>) => string;
|
|
15
15
|
export { inlineCss as default };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import t from"juice";import n from"../packem_shared/EmailError-
|
|
1
|
+
import t from"juice";import n from"../packem_shared/EmailError-CDvYwuqz.js";const i=(r,o)=>{const a=t.default??t;try{return a(r,o)}catch(e){throw new n("render",`Failed to inline CSS: ${e.message}`,{cause:e})}};export{i as default};
|
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Options for {@link addDarkModeSupport}.
|
|
3
|
-
*/
|
|
2
|
+
* Options for {@link addDarkModeSupport}.
|
|
3
|
+
*/
|
|
4
4
|
interface DarkModeOptions {
|
|
5
5
|
/**
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
* Extra CSS to wrap in a `@media (prefers-color-scheme: dark)` block (the dark-mode overrides).
|
|
7
|
+
*/
|
|
8
8
|
styles?: string;
|
|
9
9
|
}
|
|
10
10
|
/**
|
|
11
|
-
* Adds dark-mode hooks to an HTML email: the `color-scheme` / `supported-color-schemes` meta tags and,
|
|
12
|
-
* when provided, a `@media (prefers-color-scheme: dark)` style block.
|
|
13
|
-
*
|
|
14
|
-
* Injected into `<head>` (created after `<html>` if absent, otherwise prepended).
|
|
15
|
-
* @param html The HTML email.
|
|
16
|
-
* @param options Dark-mode options. See {@link DarkModeOptions}.
|
|
17
|
-
* @returns The HTML with dark-mode support added.
|
|
18
|
-
*/
|
|
11
|
+
* Adds dark-mode hooks to an HTML email: the `color-scheme` / `supported-color-schemes` meta tags and,
|
|
12
|
+
* when provided, a `@media (prefers-color-scheme: dark)` style block.
|
|
13
|
+
*
|
|
14
|
+
* Injected into `<head>` (created after `<html>` if absent, otherwise prepended).
|
|
15
|
+
* @param html The HTML email.
|
|
16
|
+
* @param options Dark-mode options. See {@link DarkModeOptions}.
|
|
17
|
+
* @returns The HTML with dark-mode support added.
|
|
18
|
+
*/
|
|
19
19
|
declare const addDarkModeSupport: (html: string, options?: DarkModeOptions) => string;
|
|
20
20
|
export { DarkModeOptions, addDarkModeSupport };
|
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Options for {@link injectPreheader}.
|
|
3
|
-
*/
|
|
2
|
+
* Options for {@link injectPreheader}.
|
|
3
|
+
*/
|
|
4
4
|
interface PreheaderOptions {
|
|
5
5
|
/**
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
6
|
+
* Append invisible padding characters so the preheader text isn't followed by leaked body content
|
|
7
|
+
* in the inbox preview.
|
|
8
|
+
* @default true
|
|
9
|
+
*/
|
|
10
10
|
spacer?: boolean;
|
|
11
11
|
}
|
|
12
12
|
/**
|
|
13
|
-
* Injects a hidden preheader (inbox preview text) at the start of the HTML body.
|
|
14
|
-
*
|
|
15
|
-
* The preheader is wrapped in a `display:none` element with `mso-hide:all`, followed by zero-width
|
|
16
|
-
* padding so the preview shows only your text. Inserted right after `<body>` (or prepended if no
|
|
17
|
-
* body tag is present).
|
|
18
|
-
* @param html The HTML email.
|
|
19
|
-
* @param preheader The preview text.
|
|
20
|
-
* @param options Injection options. See {@link PreheaderOptions}.
|
|
21
|
-
* @returns The HTML with the preheader injected.
|
|
22
|
-
*/
|
|
13
|
+
* Injects a hidden preheader (inbox preview text) at the start of the HTML body.
|
|
14
|
+
*
|
|
15
|
+
* The preheader is wrapped in a `display:none` element with `mso-hide:all`, followed by zero-width
|
|
16
|
+
* padding so the preview shows only your text. Inserted right after `<body>` (or prepended if no
|
|
17
|
+
* body tag is present).
|
|
18
|
+
* @param html The HTML email.
|
|
19
|
+
* @param preheader The preview text.
|
|
20
|
+
* @param options Injection options. See {@link PreheaderOptions}.
|
|
21
|
+
* @returns The HTML with the preheader injected.
|
|
22
|
+
*/
|
|
23
23
|
declare const injectPreheader: (html: string, preheader: string, options?: PreheaderOptions) => string;
|
|
24
24
|
export { PreheaderOptions, injectPreheader };
|