@devmoods/express-extras 0.13.3 → 0.13.4
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/email.d.ts +3 -4
- package/dist/email.js +3 -2
- package/dist/middleware.js +10 -0
- package/package.json +1 -1
package/dist/email.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import nodemailer from 'nodemailer';
|
|
1
2
|
export interface EmailOptions {
|
|
2
3
|
host?: string;
|
|
3
4
|
port?: string;
|
|
@@ -6,11 +7,9 @@ export interface EmailOptions {
|
|
|
6
7
|
senderName: string;
|
|
7
8
|
senderAddress: string;
|
|
8
9
|
}
|
|
9
|
-
export interface SendEmailOptions {
|
|
10
|
-
to: string;
|
|
11
|
-
subject: string;
|
|
10
|
+
export interface SendEmailOptions extends nodemailer.SendMailOptions {
|
|
12
11
|
message: string;
|
|
13
12
|
}
|
|
14
13
|
export declare function createEmail({ host, port, user, pass, senderName, senderAddress, }: EmailOptions): {
|
|
15
|
-
send: ({ to, subject, message }: SendEmailOptions) => Promise<void>;
|
|
14
|
+
send: ({ to, subject, message, ...rest }: SendEmailOptions) => Promise<void>;
|
|
16
15
|
};
|
package/dist/email.js
CHANGED
|
@@ -13,12 +13,13 @@ function createEmail({ host, port, user, pass, senderName, senderAddress, }) {
|
|
|
13
13
|
secure: false,
|
|
14
14
|
auth: { user, pass },
|
|
15
15
|
});
|
|
16
|
-
const send = async ({ to, subject, message }) => {
|
|
16
|
+
const send = async ({ to, subject, message, ...rest }) => {
|
|
17
17
|
const result = await transporter.sendMail({
|
|
18
18
|
from: `${senderName} <${senderAddress}>`,
|
|
19
19
|
to,
|
|
20
20
|
subject,
|
|
21
|
-
text: message,
|
|
21
|
+
text: message,
|
|
22
|
+
...rest,
|
|
22
23
|
});
|
|
23
24
|
(0, logger_1.getLogger)('core').info('email-sent', { email: result });
|
|
24
25
|
};
|
package/dist/middleware.js
CHANGED
|
@@ -47,7 +47,17 @@ function before({ cookies = false, helmet: useHelmet = true, json: useJson = tru
|
|
|
47
47
|
(0, helmet_1.default)({
|
|
48
48
|
contentSecurityPolicy: {
|
|
49
49
|
directives: {
|
|
50
|
+
'default-src': ["'self'"],
|
|
51
|
+
'base-uri': ["'self'"],
|
|
52
|
+
'font-src': ["'self'", 'https:', 'data:'],
|
|
53
|
+
'form-action': ["'self'"],
|
|
54
|
+
'frame-ancestors': ["'self'"],
|
|
50
55
|
'img-src': ["'self'", 'data:', 'blob:'],
|
|
56
|
+
'object-src': ["'none'"],
|
|
57
|
+
'script-src': ["'self'"],
|
|
58
|
+
'script-src-attr': ["'none'"],
|
|
59
|
+
'style-src': ["'self'", 'https:', "'unsafe-inline'"],
|
|
60
|
+
'upgrade-insecure-requests': [],
|
|
51
61
|
},
|
|
52
62
|
},
|
|
53
63
|
}),
|