@nestjs-modules/mailer 1.7.0 → 1.7.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 CHANGED
@@ -2,6 +2,13 @@
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.7.1](https://github.com/nest-modules/mailer/compare/v1.7.0...v1.7.1) (2022-06-20)
6
+
7
+
8
+ ### Bug Fixes
9
+
10
+ * corrects dependency with security problems ([6076fca](https://github.com/nest-modules/mailer/commit/6076fca3b9992e7d2bbf373717de4332070b7900))
11
+
5
12
  ## [1.7.0](https://github.com/nest-modules/mailer/compare/v1.6.0...v1.7.0) (2022-06-19)
6
13
 
7
14
 
@@ -21,12 +21,12 @@ class EjsAdapter {
21
21
  const templateName = path.basename(template, path.extname(template));
22
22
  const templateDir = path.isAbsolute(template)
23
23
  ? path.dirname(template)
24
- : path.join(lodash_1.get(mailerOptions, 'template.dir', ''), path.dirname(template));
24
+ : path.join((0, lodash_1.get)(mailerOptions, 'template.dir', ''), path.dirname(template));
25
25
  const templatePath = path.join(templateDir, templateName + templateExt);
26
26
  if (!this.precompiledTemplates[templateName]) {
27
27
  try {
28
28
  const template = fs.readFileSync(templatePath, 'utf-8');
29
- this.precompiledTemplates[templateName] = ejs_1.compile(template, Object.assign(Object.assign({}, lodash_1.get(mailerOptions, 'template.options', {})), { filename: templatePath }));
29
+ this.precompiledTemplates[templateName] = (0, ejs_1.compile)(template, Object.assign(Object.assign({}, (0, lodash_1.get)(mailerOptions, 'template.options', {})), { filename: templatePath }));
30
30
  }
31
31
  catch (err) {
32
32
  return callback(err);
@@ -27,12 +27,12 @@ class HandlebarsAdapter {
27
27
  const templateName = path.basename(template, path.extname(template));
28
28
  const templateDir = path.isAbsolute(template)
29
29
  ? path.dirname(template)
30
- : path.join(lodash_1.get(options, 'dir', ''), path.dirname(template));
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
34
  const template = fs.readFileSync(templatePath, 'utf-8');
35
- this.precompiledTemplates[templateName] = handlebars.compile(template, lodash_1.get(options, 'options', {}));
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,7 +46,7 @@ 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
  });
@@ -1,9 +1,9 @@
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";
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
4
  export declare class MjmlAdapter implements TemplateAdapter {
5
5
  private engine;
6
- constructor(engine: TemplateAdapter | "" | "pug" | "handlebars" | "ejs", config?: TemplateAdapterConfig, others?: {
6
+ constructor(engine: TemplateAdapter | '' | 'pug' | 'handlebars' | 'ejs', config?: TemplateAdapterConfig, others?: {
7
7
  handlebar?: {
8
8
  helper?: any;
9
9
  };
@@ -8,17 +8,17 @@ const mjml_1 = require("mjml");
8
8
  class MjmlAdapter {
9
9
  constructor(engine, config, others) {
10
10
  this.engine = engine;
11
- if (typeof engine == "string") {
12
- if (engine === "pug") {
11
+ if (typeof engine == 'string') {
12
+ if (engine === 'pug') {
13
13
  this.engine = new pug_adapter_1.PugAdapter(config);
14
14
  }
15
- else if (engine === "handlebars") {
15
+ else if (engine === 'handlebars') {
16
16
  this.engine = new handlebars_adapter_1.HandlebarsAdapter(others.handlebar.helper, config);
17
17
  }
18
- else if (engine === "ejs") {
18
+ else if (engine === 'ejs') {
19
19
  this.engine = new ejs_adapter_1.EjsAdapter(config);
20
20
  }
21
- else if (engine === "") {
21
+ else if (engine === '') {
22
22
  engine = null;
23
23
  }
24
24
  }
@@ -26,7 +26,7 @@ class MjmlAdapter {
26
26
  compile(mail, callback, mailerOptions) {
27
27
  var _a;
28
28
  (_a = this === null || this === void 0 ? void 0 : this.engine) === null || _a === void 0 ? void 0 : _a.compile(mail, () => {
29
- mail.data.html = mjml_1.default(mail.data.html).html;
29
+ mail.data.html = (0, mjml_1.default)(mail.data.html).html;
30
30
  callback();
31
31
  }, mailerOptions);
32
32
  }
@@ -19,10 +19,10 @@ class PugAdapter {
19
19
  const templateName = path.basename(template, path.extname(template));
20
20
  const templateDir = path.isAbsolute(template)
21
21
  ? path.dirname(template)
22
- : path.join(lodash_1.get(mailerOptions, 'template.dir', ''), path.dirname(template));
22
+ : path.join((0, lodash_1.get)(mailerOptions, 'template.dir', ''), path.dirname(template));
23
23
  const templatePath = path.join(templateDir, templateName + templateExt);
24
- const options = Object.assign(Object.assign({}, context), lodash_1.get(mailerOptions, 'template.options', {}));
25
- 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) => {
26
26
  if (err) {
27
27
  return callback(err);
28
28
  }
@@ -1,5 +1,5 @@
1
1
  import { ModuleMetadata, Type } from '@nestjs/common/interfaces';
2
- import { Provider } from "@nestjs/common";
2
+ import { Provider } from '@nestjs/common';
3
3
  import { MailerOptions } from './mailer-options.interface';
4
4
  import { MailerOptionsFactory } from './mailer-options-factory.interface';
5
5
  export interface MailerAsyncOptions extends Pick<ModuleMetadata, 'imports'> {
@@ -68,7 +68,7 @@ let MailerCoreModule = MailerCoreModule_1 = class MailerCoreModule {
68
68
  }
69
69
  };
70
70
  MailerCoreModule = MailerCoreModule_1 = tslib_1.__decorate([
71
- common_1.Global(),
72
- common_1.Module({})
71
+ (0, common_1.Global)(),
72
+ (0, common_1.Module)({})
73
73
  ], MailerCoreModule);
74
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;
@@ -24,6 +24,6 @@ let MailerModule = MailerModule_1 = class MailerModule {
24
24
  }
25
25
  };
26
26
  MailerModule = MailerModule_1 = tslib_1.__decorate([
27
- common_1.Module({})
27
+ (0, common_1.Module)({})
28
28
  ], MailerModule);
29
29
  exports.MailerModule = MailerModule;
@@ -20,13 +20,13 @@ 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
- const templateAdapter = lodash_1.get(this.mailerOptions, 'template.adapter');
23
+ const 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) => {
@@ -81,10 +81,10 @@ let MailerService = class MailerService {
81
81
  }
82
82
  };
83
83
  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)),
84
+ (0, common_1.Injectable)(),
85
+ tslib_1.__param(0, (0, common_1.Inject)(mailer_constant_1.MAILER_OPTIONS)),
86
+ tslib_1.__param(1, (0, common_1.Optional)()),
87
+ tslib_1.__param(1, (0, common_1.Inject)(mailer_constant_1.MAILER_TRANSPORT_FACTORY)),
88
88
  tslib_1.__metadata("design:paramtypes", [Object, Object])
89
89
  ], MailerService);
90
90
  exports.MailerService = MailerService;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nestjs-modules/mailer",
3
- "version": "1.7.0",
3
+ "version": "1.7.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,10 +52,10 @@
49
52
  ]
50
53
  },
51
54
  "dependencies": {
52
- "glob": "7.2.0",
55
+ "glob": "8.0.3",
53
56
  "inline-css": "3.0.0",
54
57
  "mjml": "^4.12.0",
55
- "preview-email": "3.0.4"
58
+ "preview-email": "3.0.5"
56
59
  },
57
60
  "optionalDependencies": {
58
61
  "@types/ejs": "^3.0.3",
@@ -65,29 +68,30 @@
65
68
  "@commitlint/cli": "13.2.1",
66
69
  "@commitlint/config-angular": "13.2.0",
67
70
  "@nestjs/common": "8.2.4",
68
- "@nestjs/core": "8.2.4",
69
- "@nestjs/testing": "8.2.4",
71
+ "@nestjs/core": "8.4.7",
72
+ "@nestjs/testing": "8.4.7",
70
73
  "@types/glob": "7.2.0",
71
74
  "@types/inline-css": "3.0.1",
72
75
  "@types/jest": "26.0.24",
73
- "@types/lodash": "4.14.176",
76
+ "@types/lodash": "4.14.182",
74
77
  "@types/nodemailer": "6.4.4",
75
78
  "@types/pug": "2.0.5",
76
- "@typescript-eslint/eslint-plugin": "5.8.0",
79
+ "@typescript-eslint/eslint-plugin": "5.28.0",
77
80
  "@typescript-eslint/parser": "5.8.0",
78
81
  "husky": "7.0.4",
79
82
  "jest": "27.0.6",
80
- "lint-staged": "11.2.6",
81
- "nodemailer": "6.7.2",
82
- "nodemailer-mock": "1.5.11",
83
- "prettier": "2.3.2",
83
+ "lint-staged": "13.0.2",
84
+ "nodemailer": "6.7.5",
85
+ "nodemailer-mock": "1.5.12",
86
+ "prettier": "2.7.1",
84
87
  "reflect-metadata": "0.1.13",
85
88
  "rimraf": "3.0.2",
86
89
  "rxjs": "7.4.0",
87
90
  "standard-version": "9.3.2",
88
91
  "ts-jest": "27.1.2",
89
- "ts-node": "10.2.1",
90
- "typescript": "4.3.5"
92
+ "ts-node": "10.8.1",
93
+ "typescript": "4.7.4",
94
+ "yarn-audit-fix": "^9.3.2"
91
95
  },
92
96
  "peerDependencies": {
93
97
  "@nestjs/common": "^7.0.9 || ^8.0.0",