@nestjs-modules/mailer 1.6.1 → 1.8.1
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 +43 -0
- package/SECURITY.md +21 -0
- package/dist/adapters/ejs.adapter.js +13 -10
- package/dist/adapters/handlebars.adapter.js +12 -9
- package/dist/adapters/mjml.adapter.d.ts +12 -0
- package/dist/adapters/mjml.adapter.js +34 -0
- package/dist/adapters/pug.adapter.js +12 -9
- package/dist/interfaces/mailer-async-options.interface.d.ts +2 -0
- package/dist/interfaces/send-mail-options.interface.d.ts +10 -0
- package/dist/mailer-core.module.js +3 -2
- package/dist/mailer-transport.factory.js +2 -2
- package/dist/mailer.module.js +1 -1
- package/dist/mailer.service.d.ts +3 -0
- package/dist/mailer.service.js +13 -8
- package/package.json +34 -29
- package/.dockerignore +0 -2
- package/.github/workflows/codeql-analysis.yml +0 -71
- package/Dockerfile +0 -10
- package/docker-compose.yml +0 -18
- package/jest.config.js +0 -17
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,49 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
4
4
|
|
|
5
|
+
### [1.8.1](https://github.com/nest-modules/mailer/compare/v1.8.0...v1.8.1) (2022-07-21)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
* fixes a bad call to smtp options and broken unit tests ([1ef2d80](https://github.com/nest-modules/mailer/commit/1ef2d8090480b7500baf704c127723e796a34697))
|
|
11
|
+
|
|
12
|
+
## [1.8.0](https://github.com/nest-modules/mailer/compare/v1.7.1...v1.8.0) (2022-07-19)
|
|
13
|
+
|
|
14
|
+
### [1.7.1](https://github.com/nest-modules/mailer/compare/v1.7.0...v1.7.1) (2022-06-20)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
### Bug Fixes
|
|
18
|
+
|
|
19
|
+
* corrects dependency with security problems ([6076fca](https://github.com/nest-modules/mailer/commit/6076fca3b9992e7d2bbf373717de4332070b7900))
|
|
20
|
+
|
|
21
|
+
## [1.7.0](https://github.com/nest-modules/mailer/compare/v1.6.0...v1.7.0) (2022-06-19)
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
### Features
|
|
25
|
+
|
|
26
|
+
* Add possibility to specify extra providers ([#762](https://github.com/nest-modules/mailer/issues/762)) ([680c67f](https://github.com/nest-modules/mailer/commit/680c67fd5618909b6705eb1c73bd55d6b94ac76c))
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
### Bug Fixes
|
|
30
|
+
|
|
31
|
+
* **adapters:** resolving correct templateDir ([9bee48b](https://github.com/nest-modules/mailer/commit/9bee48b0e630c71c3702b83747dc41152670947e))
|
|
32
|
+
* **deps:** update dependency dotenv to v10 ([8dcb4e0](https://github.com/nest-modules/mailer/commit/8dcb4e0b563461d0d1b8ab90419992e434197bd9))
|
|
33
|
+
* **deps:** update dependency dotenv to v8.6.0 ([8cd1094](https://github.com/nest-modules/mailer/commit/8cd10947722a4c74ec841814118dcc535024e042))
|
|
34
|
+
* **deps:** update dependency glob to v7.1.7 ([cba34c6](https://github.com/nest-modules/mailer/commit/cba34c682992331895c43224fdc3686daa29c05e))
|
|
35
|
+
* **deps:** update dependency glob to v7.2.0 ([222e701](https://github.com/nest-modules/mailer/commit/222e701642b93d5d90d023307a4c0bdf0a533944))
|
|
36
|
+
* **deps:** update dependency nodemailer to v6.6.1 ([ec1eec9](https://github.com/nest-modules/mailer/commit/ec1eec95696c958eff8f02ad6a210f771ffdf624))
|
|
37
|
+
* **deps:** update dependency nodemailer to v6.6.2 ([fc92ddd](https://github.com/nest-modules/mailer/commit/fc92ddd9852876306a3a5c87649f3d27806b7853))
|
|
38
|
+
* **deps:** update dependency nodemailer to v6.6.5 ([d68d341](https://github.com/nest-modules/mailer/commit/d68d34120fd7028f260e8b914d455859e0469f88))
|
|
39
|
+
* **deps:** update dependency nodemailer to v6.7.2 ([7638b01](https://github.com/nest-modules/mailer/commit/7638b01f9ec8bcded5b320766be65477adab024d))
|
|
40
|
+
* **deps:** update dependency rxjs to v7 ([efcc64e](https://github.com/nest-modules/mailer/commit/efcc64e3eb8d8b110a2aa0fa4b352c34d9e6154f))
|
|
41
|
+
* **deps:** update dependency rxjs to v7.3.1 ([a5aa0ae](https://github.com/nest-modules/mailer/commit/a5aa0ae646395db2d87c74130bf25c9214624c43))
|
|
42
|
+
* **deps:** update dependency rxjs to v7.4.0 ([8fb17f1](https://github.com/nest-modules/mailer/commit/8fb17f17f7ab0253f3c0620fe91c6dbbd578d9f2))
|
|
43
|
+
* **deps:** update dependency twing to v5.1.0 ([7d45c53](https://github.com/nest-modules/mailer/commit/7d45c53132c5d81e5042887db782fe0878973d1b))
|
|
44
|
+
* **deps:** update nest monorepo to v7.6.18 ([6f7bdf8](https://github.com/nest-modules/mailer/commit/6f7bdf8ce793821888e22ee12c73cd204619cbd8))
|
|
45
|
+
* no error handling for inlineCss ([c232e75](https://github.com/nest-modules/mailer/commit/c232e752d77c521076583a489a7ccc214df13803))
|
|
46
|
+
* register partials in handlebars ([#715](https://github.com/nest-modules/mailer/issues/715)) ([7f2cbae](https://github.com/nest-modules/mailer/commit/7f2cbae49858f88e686534e43dd45ec63d2256ca))
|
|
47
|
+
|
|
5
48
|
### [1.6.1](https://github.com/nest-modules/mailer/compare/v1.6.0...v1.6.1) (2021-12-30)
|
|
6
49
|
|
|
7
50
|
|
package/SECURITY.md
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# Security Policy
|
|
2
|
+
|
|
3
|
+
## Supported Versions
|
|
4
|
+
|
|
5
|
+
Use this section to tell people about which versions of your project are
|
|
6
|
+
currently being supported with security updates.
|
|
7
|
+
|
|
8
|
+
| Version | Supported |
|
|
9
|
+
| ------- | ------------------ |
|
|
10
|
+
| 5.1.x | :white_check_mark: |
|
|
11
|
+
| 5.0.x | :x: |
|
|
12
|
+
| 4.0.x | :white_check_mark: |
|
|
13
|
+
| < 4.0 | :x: |
|
|
14
|
+
|
|
15
|
+
## Reporting a Vulnerability
|
|
16
|
+
|
|
17
|
+
Use this section to tell people how to report a vulnerability.
|
|
18
|
+
|
|
19
|
+
Tell them where to go, how often they can expect to get an update on a
|
|
20
|
+
reported vulnerability, what to expect if the vulnerability is accepted or
|
|
21
|
+
declined, etc.
|
|
@@ -16,28 +16,31 @@ class EjsAdapter {
|
|
|
16
16
|
Object.assign(this.config, config);
|
|
17
17
|
}
|
|
18
18
|
compile(mail, callback, mailerOptions) {
|
|
19
|
-
const
|
|
20
|
-
const
|
|
21
|
-
const
|
|
22
|
-
|
|
23
|
-
|
|
19
|
+
const { context, template } = mail.data;
|
|
20
|
+
const templateExt = path.extname(template) || '.ejs';
|
|
21
|
+
const templateName = path.basename(template, path.extname(template));
|
|
22
|
+
const templateDir = path.isAbsolute(template)
|
|
23
|
+
? path.dirname(template)
|
|
24
|
+
: path.join((0, lodash_1.get)(mailerOptions, 'template.dir', ''), path.dirname(template));
|
|
24
25
|
const templatePath = path.join(templateDir, templateName + templateExt);
|
|
25
26
|
if (!this.precompiledTemplates[templateName]) {
|
|
26
27
|
try {
|
|
27
|
-
const template = fs.readFileSync(templatePath, '
|
|
28
|
-
this.precompiledTemplates[templateName] = ejs_1.compile(template, Object.assign(Object.assign({}, lodash_1.get(mailerOptions, 'template.options', {})), { filename: templatePath }));
|
|
28
|
+
const template = fs.readFileSync(templatePath, 'utf-8');
|
|
29
|
+
this.precompiledTemplates[templateName] = (0, ejs_1.compile)(template, Object.assign(Object.assign({}, (0, lodash_1.get)(mailerOptions, 'template.options', {})), { filename: templatePath }));
|
|
29
30
|
}
|
|
30
31
|
catch (err) {
|
|
31
32
|
return callback(err);
|
|
32
33
|
}
|
|
33
34
|
}
|
|
34
|
-
const rendered = this.precompiledTemplates[templateName](
|
|
35
|
+
const rendered = this.precompiledTemplates[templateName](context);
|
|
35
36
|
const render = (html) => {
|
|
36
37
|
if (this.config.inlineCssEnabled) {
|
|
37
|
-
inlineCss(html, this.config.inlineCssOptions)
|
|
38
|
+
inlineCss(html, this.config.inlineCssOptions)
|
|
39
|
+
.then((html) => {
|
|
38
40
|
mail.data.html = html;
|
|
39
41
|
return callback();
|
|
40
|
-
})
|
|
42
|
+
})
|
|
43
|
+
.catch(callback);
|
|
41
44
|
}
|
|
42
45
|
else {
|
|
43
46
|
mail.data.html = html;
|
|
@@ -25,14 +25,14 @@ class HandlebarsAdapter {
|
|
|
25
25
|
const precompile = (template, callback, options) => {
|
|
26
26
|
const templateExt = path.extname(template) || '.hbs';
|
|
27
27
|
const templateName = path.basename(template, path.extname(template));
|
|
28
|
-
const templateDir =
|
|
28
|
+
const templateDir = path.isAbsolute(template)
|
|
29
29
|
? path.dirname(template)
|
|
30
|
-
: lodash_1.get(options, 'dir', '');
|
|
30
|
+
: path.join((0, lodash_1.get)(options, 'dir', ''), path.dirname(template));
|
|
31
31
|
const templatePath = path.join(templateDir, templateName + templateExt);
|
|
32
32
|
if (!this.precompiledTemplates[templateName]) {
|
|
33
33
|
try {
|
|
34
|
-
const template = fs.readFileSync(templatePath, '
|
|
35
|
-
this.precompiledTemplates[templateName] = handlebars.compile(template, lodash_1.get(options, 'options', {}));
|
|
34
|
+
const template = fs.readFileSync(templatePath, 'utf-8');
|
|
35
|
+
this.precompiledTemplates[templateName] = handlebars.compile(template, (0, lodash_1.get)(options, 'options', {}));
|
|
36
36
|
}
|
|
37
37
|
catch (err) {
|
|
38
38
|
return callback(err);
|
|
@@ -46,23 +46,26 @@ class HandlebarsAdapter {
|
|
|
46
46
|
};
|
|
47
47
|
};
|
|
48
48
|
const { templateName } = precompile(mail.data.template, callback, mailerOptions.template);
|
|
49
|
-
const runtimeOptions = lodash_1.get(mailerOptions, 'options', {
|
|
49
|
+
const runtimeOptions = (0, lodash_1.get)(mailerOptions, 'options', {
|
|
50
50
|
partials: false,
|
|
51
51
|
data: {},
|
|
52
52
|
});
|
|
53
53
|
if (runtimeOptions.partials) {
|
|
54
|
-
const files = glob.sync(path.join(runtimeOptions.partials.dir, '*.hbs'));
|
|
54
|
+
const files = glob.sync(path.join(runtimeOptions.partials.dir, '**', '*.hbs'));
|
|
55
55
|
files.forEach((file) => {
|
|
56
56
|
const { templateName, templatePath } = precompile(file, () => { }, runtimeOptions.partials);
|
|
57
|
-
|
|
57
|
+
const templateDir = path.relative(runtimeOptions.partials.dir, path.dirname(templatePath));
|
|
58
|
+
handlebars.registerPartial(path.join(templateDir, templateName), fs.readFileSync(templatePath, 'utf-8'));
|
|
58
59
|
});
|
|
59
60
|
}
|
|
60
61
|
const rendered = this.precompiledTemplates[templateName](mail.data.context, Object.assign(Object.assign({}, runtimeOptions), { partials: this.precompiledTemplates }));
|
|
61
62
|
if (this.config.inlineCssEnabled) {
|
|
62
|
-
inlineCss(rendered, this.config.inlineCssOptions)
|
|
63
|
+
inlineCss(rendered, this.config.inlineCssOptions)
|
|
64
|
+
.then((html) => {
|
|
63
65
|
mail.data.html = html;
|
|
64
66
|
return callback();
|
|
65
|
-
})
|
|
67
|
+
})
|
|
68
|
+
.catch(callback);
|
|
66
69
|
}
|
|
67
70
|
else {
|
|
68
71
|
mail.data.html = rendered;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { TemplateAdapterConfig } from '../interfaces/template-adapter-config.interface';
|
|
2
|
+
import { TemplateAdapter } from '../interfaces/template-adapter.interface';
|
|
3
|
+
import { MailerOptions } from '../interfaces/mailer-options.interface';
|
|
4
|
+
export declare class MjmlAdapter implements TemplateAdapter {
|
|
5
|
+
private engine;
|
|
6
|
+
constructor(engine: TemplateAdapter | '' | 'pug' | 'handlebars' | 'ejs', config?: TemplateAdapterConfig, others?: {
|
|
7
|
+
handlebar?: {
|
|
8
|
+
helper?: any;
|
|
9
|
+
};
|
|
10
|
+
});
|
|
11
|
+
compile(mail: any, callback: any, mailerOptions: MailerOptions): void;
|
|
12
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MjmlAdapter = void 0;
|
|
4
|
+
const handlebars_adapter_1 = require("./handlebars.adapter");
|
|
5
|
+
const ejs_adapter_1 = require("./ejs.adapter");
|
|
6
|
+
const pug_adapter_1 = require("./pug.adapter");
|
|
7
|
+
const mjml_1 = require("mjml");
|
|
8
|
+
class MjmlAdapter {
|
|
9
|
+
constructor(engine, config, others) {
|
|
10
|
+
this.engine = engine;
|
|
11
|
+
if (typeof engine == 'string') {
|
|
12
|
+
if (engine === 'pug') {
|
|
13
|
+
this.engine = new pug_adapter_1.PugAdapter(config);
|
|
14
|
+
}
|
|
15
|
+
else if (engine === 'handlebars') {
|
|
16
|
+
this.engine = new handlebars_adapter_1.HandlebarsAdapter(others.handlebar.helper, config);
|
|
17
|
+
}
|
|
18
|
+
else if (engine === 'ejs') {
|
|
19
|
+
this.engine = new ejs_adapter_1.EjsAdapter(config);
|
|
20
|
+
}
|
|
21
|
+
else if (engine === '') {
|
|
22
|
+
engine = null;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
compile(mail, callback, mailerOptions) {
|
|
27
|
+
var _a;
|
|
28
|
+
(_a = this === null || this === void 0 ? void 0 : this.engine) === null || _a === void 0 ? void 0 : _a.compile(mail, () => {
|
|
29
|
+
mail.data.html = (0, mjml_1.default)(mail.data.html).html;
|
|
30
|
+
callback();
|
|
31
|
+
}, mailerOptions);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
exports.MjmlAdapter = MjmlAdapter;
|
|
@@ -14,22 +14,25 @@ class PugAdapter {
|
|
|
14
14
|
Object.assign(this.config, config);
|
|
15
15
|
}
|
|
16
16
|
compile(mail, callback, mailerOptions) {
|
|
17
|
-
const
|
|
18
|
-
const
|
|
19
|
-
const
|
|
20
|
-
|
|
21
|
-
|
|
17
|
+
const { context, template } = mail.data;
|
|
18
|
+
const templateExt = path.extname(template) || '.pug';
|
|
19
|
+
const templateName = path.basename(template, path.extname(template));
|
|
20
|
+
const templateDir = path.isAbsolute(template)
|
|
21
|
+
? path.dirname(template)
|
|
22
|
+
: path.join((0, lodash_1.get)(mailerOptions, 'template.dir', ''), path.dirname(template));
|
|
22
23
|
const templatePath = path.join(templateDir, templateName + templateExt);
|
|
23
|
-
const options = Object.assign(Object.assign({},
|
|
24
|
-
pug_1.renderFile(templatePath, options, (err, body) => {
|
|
24
|
+
const options = Object.assign(Object.assign({}, context), (0, lodash_1.get)(mailerOptions, 'template.options', {}));
|
|
25
|
+
(0, pug_1.renderFile)(templatePath, options, (err, body) => {
|
|
25
26
|
if (err) {
|
|
26
27
|
return callback(err);
|
|
27
28
|
}
|
|
28
29
|
if (this.config.inlineCssEnabled) {
|
|
29
|
-
inlineCss(body, this.config.inlineCssOptions)
|
|
30
|
+
inlineCss(body, this.config.inlineCssOptions)
|
|
31
|
+
.then((html) => {
|
|
30
32
|
mail.data.html = html;
|
|
31
33
|
return callback();
|
|
32
|
-
})
|
|
34
|
+
})
|
|
35
|
+
.catch(callback);
|
|
33
36
|
}
|
|
34
37
|
else {
|
|
35
38
|
mail.data.html = body;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ModuleMetadata, Type } from '@nestjs/common/interfaces';
|
|
2
|
+
import { Provider } from '@nestjs/common';
|
|
2
3
|
import { MailerOptions } from './mailer-options.interface';
|
|
3
4
|
import { MailerOptionsFactory } from './mailer-options-factory.interface';
|
|
4
5
|
export interface MailerAsyncOptions extends Pick<ModuleMetadata, 'imports'> {
|
|
@@ -6,4 +7,5 @@ export interface MailerAsyncOptions extends Pick<ModuleMetadata, 'imports'> {
|
|
|
6
7
|
useClass?: Type<MailerOptionsFactory>;
|
|
7
8
|
useExisting?: Type<MailerOptionsFactory>;
|
|
8
9
|
useFactory?: (...args: any[]) => Promise<MailerOptions> | MailerOptions;
|
|
10
|
+
extraProviders?: Provider[];
|
|
9
11
|
}
|
|
@@ -40,5 +40,15 @@ export interface ISendMailOptions extends SendMailOptions {
|
|
|
40
40
|
};
|
|
41
41
|
transporterName?: string;
|
|
42
42
|
template?: string;
|
|
43
|
+
attachments?: {
|
|
44
|
+
filename: string;
|
|
45
|
+
content?: any;
|
|
46
|
+
path?: string;
|
|
47
|
+
contentType?: string;
|
|
48
|
+
cid?: string;
|
|
49
|
+
encoding?: string;
|
|
50
|
+
contentDisposition?: 'attachment' | 'inline' | undefined;
|
|
51
|
+
href?: string;
|
|
52
|
+
}[];
|
|
43
53
|
dkim?: DKIM.Options;
|
|
44
54
|
}
|
|
@@ -30,6 +30,7 @@ let MailerCoreModule = MailerCoreModule_1 = class MailerCoreModule {
|
|
|
30
30
|
providers: [
|
|
31
31
|
...providers,
|
|
32
32
|
mailer_service_1.MailerService,
|
|
33
|
+
...(options.extraProviders || []),
|
|
33
34
|
],
|
|
34
35
|
imports: options.imports,
|
|
35
36
|
exports: [
|
|
@@ -67,7 +68,7 @@ let MailerCoreModule = MailerCoreModule_1 = class MailerCoreModule {
|
|
|
67
68
|
}
|
|
68
69
|
};
|
|
69
70
|
MailerCoreModule = MailerCoreModule_1 = tslib_1.__decorate([
|
|
70
|
-
common_1.Global(),
|
|
71
|
-
common_1.Module({})
|
|
71
|
+
(0, common_1.Global)(),
|
|
72
|
+
(0, common_1.Module)({})
|
|
72
73
|
], MailerCoreModule);
|
|
73
74
|
exports.MailerCoreModule = MailerCoreModule;
|
|
@@ -10,11 +10,11 @@ let MailerTransportFactory = class MailerTransportFactory {
|
|
|
10
10
|
this.options = options;
|
|
11
11
|
}
|
|
12
12
|
createTransport(opts) {
|
|
13
|
-
return nodemailer_1.createTransport(opts || this.options.transport, this.options.defaults);
|
|
13
|
+
return (0, nodemailer_1.createTransport)(opts || this.options.transport, this.options.defaults);
|
|
14
14
|
}
|
|
15
15
|
};
|
|
16
16
|
MailerTransportFactory = tslib_1.__decorate([
|
|
17
|
-
tslib_1.__param(0, common_1.Inject(mailer_constant_1.MAILER_OPTIONS)),
|
|
17
|
+
tslib_1.__param(0, (0, common_1.Inject)(mailer_constant_1.MAILER_OPTIONS)),
|
|
18
18
|
tslib_1.__metadata("design:paramtypes", [Object])
|
|
19
19
|
], MailerTransportFactory);
|
|
20
20
|
exports.MailerTransportFactory = MailerTransportFactory;
|
package/dist/mailer.module.js
CHANGED
package/dist/mailer.service.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { SentMessageInfo } from 'nodemailer';
|
|
2
|
+
import * as smtpTransport from 'nodemailer/lib/smtp-transport';
|
|
2
3
|
import { MailerOptions } from './interfaces/mailer-options.interface';
|
|
3
4
|
import { ISendMailOptions } from './interfaces/send-mail-options.interface';
|
|
4
5
|
import { MailerTransportFactory as IMailerTransportFactory } from './interfaces/mailer-transport-factory.interface';
|
|
@@ -7,7 +8,9 @@ export declare class MailerService {
|
|
|
7
8
|
private readonly transportFactory;
|
|
8
9
|
private transporter;
|
|
9
10
|
private transporters;
|
|
11
|
+
private templateAdapter;
|
|
10
12
|
private initTemplateAdapter;
|
|
11
13
|
constructor(mailerOptions: MailerOptions, transportFactory: IMailerTransportFactory);
|
|
12
14
|
sendMail(sendMailOptions: ISendMailOptions): Promise<SentMessageInfo>;
|
|
15
|
+
addTransporter(transporterName: string, config: string | smtpTransport | smtpTransport.Options): string;
|
|
13
16
|
}
|
package/dist/mailer.service.js
CHANGED
|
@@ -20,23 +20,23 @@ let MailerService = class MailerService {
|
|
|
20
20
|
!mailerOptions.transports) {
|
|
21
21
|
throw new Error('Make sure to provide a nodemailer transport configuration object, connection url or a transport plugin instance.');
|
|
22
22
|
}
|
|
23
|
-
|
|
23
|
+
this.templateAdapter = (0, lodash_1.get)(this.mailerOptions, 'template.adapter');
|
|
24
24
|
if (this.mailerOptions.preview) {
|
|
25
25
|
const defaults = { open: { wait: false } };
|
|
26
26
|
this.mailerOptions.preview =
|
|
27
27
|
typeof this.mailerOptions.preview === 'boolean'
|
|
28
28
|
? defaults
|
|
29
|
-
: lodash_1.defaultsDeep(this.mailerOptions.preview, defaults);
|
|
29
|
+
: (0, lodash_1.defaultsDeep)(this.mailerOptions.preview, defaults);
|
|
30
30
|
}
|
|
31
31
|
if (mailerOptions.transports) {
|
|
32
32
|
Object.keys(mailerOptions.transports).forEach((name) => {
|
|
33
33
|
this.transporters.set(name, this.transportFactory.createTransport(this.mailerOptions.transports[name]));
|
|
34
|
-
this.initTemplateAdapter(templateAdapter, this.transporters.get(name));
|
|
34
|
+
this.initTemplateAdapter(this.templateAdapter, this.transporters.get(name));
|
|
35
35
|
});
|
|
36
36
|
}
|
|
37
37
|
if (mailerOptions.transport) {
|
|
38
38
|
this.transporter = this.transportFactory.createTransport();
|
|
39
|
-
this.initTemplateAdapter(templateAdapter, this.transporter);
|
|
39
|
+
this.initTemplateAdapter(this.templateAdapter, this.transporter);
|
|
40
40
|
}
|
|
41
41
|
}
|
|
42
42
|
initTemplateAdapter(templateAdapter, transporter) {
|
|
@@ -79,12 +79,17 @@ let MailerService = class MailerService {
|
|
|
79
79
|
}
|
|
80
80
|
});
|
|
81
81
|
}
|
|
82
|
+
addTransporter(transporterName, config) {
|
|
83
|
+
this.transporters.set(transporterName, this.transportFactory.createTransport(config));
|
|
84
|
+
this.initTemplateAdapter(this.templateAdapter, this.transporters.get(transporterName));
|
|
85
|
+
return transporterName;
|
|
86
|
+
}
|
|
82
87
|
};
|
|
83
88
|
MailerService = tslib_1.__decorate([
|
|
84
|
-
common_1.Injectable(),
|
|
85
|
-
tslib_1.__param(0, common_1.Inject(mailer_constant_1.MAILER_OPTIONS)),
|
|
86
|
-
tslib_1.__param(1, common_1.Optional()),
|
|
87
|
-
tslib_1.__param(1, common_1.Inject(mailer_constant_1.MAILER_TRANSPORT_FACTORY)),
|
|
89
|
+
(0, common_1.Injectable)(),
|
|
90
|
+
tslib_1.__param(0, (0, common_1.Inject)(mailer_constant_1.MAILER_OPTIONS)),
|
|
91
|
+
tslib_1.__param(1, (0, common_1.Optional)()),
|
|
92
|
+
tslib_1.__param(1, (0, common_1.Inject)(mailer_constant_1.MAILER_TRANSPORT_FACTORY)),
|
|
88
93
|
tslib_1.__metadata("design:paramtypes", [Object, Object])
|
|
89
94
|
], MailerService);
|
|
90
95
|
exports.MailerService = MailerService;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nestjs-modules/mailer",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.8.1",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "NestJS - a mailer module (@mailer)",
|
|
6
6
|
"keywords": [
|
|
@@ -31,6 +31,9 @@
|
|
|
31
31
|
"build": "tsc -p tsconfig.json",
|
|
32
32
|
"deploy": "sh ./publish.sh",
|
|
33
33
|
"format": "prettier **/**/*.ts --ignore-path ./.prettierignore --write",
|
|
34
|
+
"audit:convert": "yarn-audit-fix --flow=convert",
|
|
35
|
+
"audit:patch": "yarn-audit-fix --flow=patch",
|
|
36
|
+
"audit:fix": "npx yarn-audit-fix --package-lock-only=false --force --legacy-peer-deps --flow=convert",
|
|
34
37
|
"major": "npm run release -- --release-as major",
|
|
35
38
|
"minor": "npm run release -- --release-as minor",
|
|
36
39
|
"patch": "npm run release -- --release-as patch",
|
|
@@ -49,53 +52,55 @@
|
|
|
49
52
|
]
|
|
50
53
|
},
|
|
51
54
|
"dependencies": {
|
|
52
|
-
"glob": "
|
|
53
|
-
"inline-css": "
|
|
54
|
-
"
|
|
55
|
+
"glob": "8.0.3",
|
|
56
|
+
"inline-css": "4.0.1",
|
|
57
|
+
"mjml": "^4.12.0",
|
|
58
|
+
"preview-email": "3.0.5"
|
|
55
59
|
},
|
|
56
60
|
"optionalDependencies": {
|
|
57
61
|
"@types/ejs": "^3.0.3",
|
|
58
|
-
"@types/pug": "2.0.
|
|
62
|
+
"@types/pug": "2.0.6",
|
|
59
63
|
"ejs": "^3.1.2",
|
|
60
64
|
"handlebars": "^4.7.6",
|
|
61
65
|
"pug": "^3.0.1"
|
|
62
66
|
},
|
|
63
67
|
"devDependencies": {
|
|
64
|
-
"@commitlint/cli": "
|
|
65
|
-
"@commitlint/config-angular": "
|
|
66
|
-
"@nestjs/common": "
|
|
67
|
-
"@nestjs/core": "
|
|
68
|
-
"@nestjs/testing": "
|
|
69
|
-
"@types/glob": "7.
|
|
68
|
+
"@commitlint/cli": "17.0.3",
|
|
69
|
+
"@commitlint/config-angular": "17.0.3",
|
|
70
|
+
"@nestjs/common": "^9.0.1",
|
|
71
|
+
"@nestjs/core": "^9.0.1",
|
|
72
|
+
"@nestjs/testing": "^9.0.1",
|
|
73
|
+
"@types/glob": "7.2.0",
|
|
70
74
|
"@types/inline-css": "3.0.1",
|
|
71
75
|
"@types/jest": "26.0.24",
|
|
72
|
-
"@types/lodash": "4.14.
|
|
76
|
+
"@types/lodash": "4.14.182",
|
|
73
77
|
"@types/nodemailer": "6.4.4",
|
|
74
|
-
"@types/pug": "2.0.
|
|
75
|
-
"@typescript-eslint/eslint-plugin": "
|
|
76
|
-
"@typescript-eslint/parser": "
|
|
77
|
-
"husky": "
|
|
78
|
-
"lint-staged": "11.2.4",
|
|
78
|
+
"@types/pug": "2.0.6",
|
|
79
|
+
"@typescript-eslint/eslint-plugin": "5.30.7",
|
|
80
|
+
"@typescript-eslint/parser": "5.30.7",
|
|
81
|
+
"husky": "8.0.1",
|
|
79
82
|
"jest": "27.0.6",
|
|
80
|
-
"
|
|
81
|
-
"nodemailer
|
|
82
|
-
"
|
|
83
|
+
"lint-staged": "13.0.3",
|
|
84
|
+
"nodemailer": "6.7.7",
|
|
85
|
+
"nodemailer-mock": "1.5.12",
|
|
86
|
+
"prettier": "2.7.1",
|
|
83
87
|
"reflect-metadata": "0.1.13",
|
|
84
88
|
"rimraf": "3.0.2",
|
|
85
|
-
"
|
|
86
|
-
"
|
|
87
|
-
"ts-
|
|
88
|
-
"
|
|
89
|
-
"
|
|
89
|
+
"rxjs": "7.5.6",
|
|
90
|
+
"standard-version": "9.5.0",
|
|
91
|
+
"ts-jest": "27.1.2",
|
|
92
|
+
"ts-node": "10.9.1",
|
|
93
|
+
"typescript": "4.7.4",
|
|
94
|
+
"yarn-audit-fix": "^9.3.2"
|
|
90
95
|
},
|
|
91
96
|
"peerDependencies": {
|
|
92
|
-
"@nestjs/common": "^7.0.9 || ^8.0.0",
|
|
93
|
-
"@nestjs/core": "^7.0.9 || ^8.0.0",
|
|
97
|
+
"@nestjs/common": "^7.0.9 || ^8.0.0 || ^9.0.0",
|
|
98
|
+
"@nestjs/core": "^7.0.9 || ^8.0.0 || ^9.0.0",
|
|
94
99
|
"@types/ejs": "^3.0.3",
|
|
95
|
-
"@types/pug": "2.0.
|
|
100
|
+
"@types/pug": "2.0.6",
|
|
96
101
|
"ejs": "^3.1.2",
|
|
97
102
|
"handlebars": "^4.7.6",
|
|
98
103
|
"nodemailer": "^6.4.6",
|
|
99
|
-
"pug": "^
|
|
104
|
+
"pug": "^3.0.1"
|
|
100
105
|
}
|
|
101
106
|
}
|
package/.dockerignore
DELETED
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
# For most projects, this workflow file will not need changing; you simply need
|
|
2
|
-
# to commit it to your repository.
|
|
3
|
-
#
|
|
4
|
-
# You may wish to alter this file to override the set of languages analyzed,
|
|
5
|
-
# or to provide custom queries or build logic.
|
|
6
|
-
#
|
|
7
|
-
# ******** NOTE ********
|
|
8
|
-
# We have attempted to detect the languages in your repository. Please check
|
|
9
|
-
# the `language` matrix defined below to confirm you have the correct set of
|
|
10
|
-
# supported CodeQL languages.
|
|
11
|
-
#
|
|
12
|
-
name: "CodeQL"
|
|
13
|
-
|
|
14
|
-
on:
|
|
15
|
-
push:
|
|
16
|
-
branches: [ master ]
|
|
17
|
-
pull_request:
|
|
18
|
-
# The branches below must be a subset of the branches above
|
|
19
|
-
branches: [ master ]
|
|
20
|
-
schedule:
|
|
21
|
-
- cron: '36 11 * * 1'
|
|
22
|
-
|
|
23
|
-
jobs:
|
|
24
|
-
analyze:
|
|
25
|
-
name: Analyze
|
|
26
|
-
runs-on: ubuntu-latest
|
|
27
|
-
permissions:
|
|
28
|
-
actions: read
|
|
29
|
-
contents: read
|
|
30
|
-
security-events: write
|
|
31
|
-
|
|
32
|
-
strategy:
|
|
33
|
-
fail-fast: false
|
|
34
|
-
matrix:
|
|
35
|
-
language: [ 'javascript' ]
|
|
36
|
-
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ]
|
|
37
|
-
# Learn more:
|
|
38
|
-
# https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed
|
|
39
|
-
|
|
40
|
-
steps:
|
|
41
|
-
- name: Checkout repository
|
|
42
|
-
uses: actions/checkout@v2
|
|
43
|
-
|
|
44
|
-
# Initializes the CodeQL tools for scanning.
|
|
45
|
-
- name: Initialize CodeQL
|
|
46
|
-
uses: github/codeql-action/init@v1
|
|
47
|
-
with:
|
|
48
|
-
languages: ${{ matrix.language }}
|
|
49
|
-
# If you wish to specify custom queries, you can do so here or in a config file.
|
|
50
|
-
# By default, queries listed here will override any specified in a config file.
|
|
51
|
-
# Prefix the list here with "+" to use these queries and those in the config file.
|
|
52
|
-
# queries: ./path/to/local/query, your-org/your-repo/queries@main
|
|
53
|
-
|
|
54
|
-
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
|
|
55
|
-
# If this step fails, then you should remove it and run the build manually (see below)
|
|
56
|
-
- name: Autobuild
|
|
57
|
-
uses: github/codeql-action/autobuild@v1
|
|
58
|
-
|
|
59
|
-
# ℹ️ Command-line programs to run using the OS shell.
|
|
60
|
-
# 📚 https://git.io/JvXDl
|
|
61
|
-
|
|
62
|
-
# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
|
|
63
|
-
# and modify them (or add more) to build your code if your project
|
|
64
|
-
# uses a compiled language
|
|
65
|
-
|
|
66
|
-
#- run: |
|
|
67
|
-
# make bootstrap
|
|
68
|
-
# make release
|
|
69
|
-
|
|
70
|
-
- name: Perform CodeQL Analysis
|
|
71
|
-
uses: github/codeql-action/analyze@v1
|
package/Dockerfile
DELETED
package/docker-compose.yml
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
version: "3"
|
|
2
|
-
|
|
3
|
-
services:
|
|
4
|
-
docusaurus:
|
|
5
|
-
build: .
|
|
6
|
-
ports:
|
|
7
|
-
- 3000:3000
|
|
8
|
-
- 35729:35729
|
|
9
|
-
volumes:
|
|
10
|
-
- ./docs:/app/docs
|
|
11
|
-
- ./website/blog:/app/website/blog
|
|
12
|
-
- ./website/core:/app/website/core
|
|
13
|
-
- ./website/i18n:/app/website/i18n
|
|
14
|
-
- ./website/pages:/app/website/pages
|
|
15
|
-
- ./website/static:/app/website/static
|
|
16
|
-
- ./website/sidebars.json:/app/website/sidebars.json
|
|
17
|
-
- ./website/siteConfig.js:/app/website/siteConfig.js
|
|
18
|
-
working_dir: /app/website
|
package/jest.config.js
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
require('ts-node/register');
|
|
2
|
-
|
|
3
|
-
module.exports = {
|
|
4
|
-
'moduleFileExtensions': [
|
|
5
|
-
'js',
|
|
6
|
-
'json',
|
|
7
|
-
'ts',
|
|
8
|
-
],
|
|
9
|
-
'rootDir': 'lib',
|
|
10
|
-
'testRegex': '/lib/.*\\.spec\\.(ts|js)$',
|
|
11
|
-
'globals': {
|
|
12
|
-
'ts-jest': {
|
|
13
|
-
'tsConfig': 'tsconfig.json'
|
|
14
|
-
}
|
|
15
|
-
},
|
|
16
|
-
'preset': 'ts-jest',
|
|
17
|
-
};
|