@punks/backend-entity-manager 0.0.357 → 0.0.359
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/dist/cjs/index.js +13 -0
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/types/abstractions/email.d.ts +10 -0
- package/dist/esm/index.js +13 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/types/abstractions/email.d.ts +10 -0
- package/dist/index.d.ts +10 -1
- package/package.json +1 -1
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
1
2
|
export interface IEmailTemplateMiddleware {
|
|
2
3
|
processPayload(payload: unknown): Promise<unknown>;
|
|
3
4
|
}
|
|
@@ -9,6 +10,13 @@ export interface IEmailTemplatesCollection {
|
|
|
9
10
|
registerTemplate(id: string, template: IEmailTemplate<unknown, unknown, unknown>): void;
|
|
10
11
|
getTemplate<TTemplateData, TPayload, TAugmentedPayload = TPayload>(id: string): IEmailTemplate<TTemplateData, TPayload, TAugmentedPayload>;
|
|
11
12
|
}
|
|
13
|
+
export type EmailAttachmentData = {
|
|
14
|
+
content: string | Buffer;
|
|
15
|
+
filename: string;
|
|
16
|
+
type?: string;
|
|
17
|
+
disposition?: string;
|
|
18
|
+
contentId?: string;
|
|
19
|
+
};
|
|
12
20
|
export type TemplatedEmailInput<TPayload> = {
|
|
13
21
|
from?: string;
|
|
14
22
|
to?: string[];
|
|
@@ -18,6 +26,7 @@ export type TemplatedEmailInput<TPayload> = {
|
|
|
18
26
|
templateId: string;
|
|
19
27
|
languageCode: string;
|
|
20
28
|
payload: TPayload;
|
|
29
|
+
attachments?: EmailAttachmentData[];
|
|
21
30
|
};
|
|
22
31
|
export interface HtmlEmailInput<TPayload> {
|
|
23
32
|
replyTo?: string;
|
|
@@ -28,6 +37,7 @@ export interface HtmlEmailInput<TPayload> {
|
|
|
28
37
|
subjectTemplate: string;
|
|
29
38
|
bodyTemplate: string;
|
|
30
39
|
payload: TPayload;
|
|
40
|
+
attachments?: EmailAttachmentData[];
|
|
31
41
|
}
|
|
32
42
|
export interface IEmailProvider<TTemplateData> {
|
|
33
43
|
sendTemplatedEmail<TPayload, TAugmentedPayload>(input: TemplatedEmailInput<TPayload>, template: IEmailTemplate<TTemplateData, TPayload, TAugmentedPayload>): Promise<void>;
|
package/dist/esm/index.js
CHANGED
|
@@ -40385,6 +40385,7 @@ let AwsSesEmailProvider = class AwsSesEmailProvider {
|
|
|
40385
40385
|
bcc: input.bcc ?? templateData.bcc,
|
|
40386
40386
|
cc: input.cc ?? templateData.cc,
|
|
40387
40387
|
from: input.from ?? templateData.from,
|
|
40388
|
+
attachments: input.attachments,
|
|
40388
40389
|
});
|
|
40389
40390
|
}
|
|
40390
40391
|
async sendHtmlEmail(input) {
|
|
@@ -40486,6 +40487,12 @@ let SendgridEmailProvider = class SendgridEmailProvider {
|
|
|
40486
40487
|
cc: input.cc ?? templateData.cc,
|
|
40487
40488
|
from: input.from ?? templateData.from,
|
|
40488
40489
|
to: input.to ?? templateData.to,
|
|
40490
|
+
attachments: input.attachments?.map((attachment) => ({
|
|
40491
|
+
...attachment,
|
|
40492
|
+
content: attachment.content instanceof Buffer
|
|
40493
|
+
? attachment.content.toString("utf-8")
|
|
40494
|
+
: attachment.content,
|
|
40495
|
+
})),
|
|
40489
40496
|
});
|
|
40490
40497
|
return;
|
|
40491
40498
|
}
|
|
@@ -40511,6 +40518,12 @@ let SendgridEmailProvider = class SendgridEmailProvider {
|
|
|
40511
40518
|
...processedPayload,
|
|
40512
40519
|
},
|
|
40513
40520
|
templateId: templateData.sendgridTemplateId,
|
|
40521
|
+
attachments: input.attachments?.map((attachment) => ({
|
|
40522
|
+
...attachment,
|
|
40523
|
+
content: attachment.content instanceof Buffer
|
|
40524
|
+
? attachment.content.toString("utf-8")
|
|
40525
|
+
: attachment.content,
|
|
40526
|
+
})),
|
|
40514
40527
|
});
|
|
40515
40528
|
if (sendgridSettings.value.loggingEnabled) {
|
|
40516
40529
|
this.logger.info("Sending templated email", {
|