@pixelplex/mail-service 0.1.19 → 0.1.21-attachments

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.
@@ -0,0 +1,9 @@
1
+ #!/bin/sh
2
+ . "$(dirname "$0")/_/husky.sh"
3
+
4
+ if [[ "$NO_LINT" ]]; then
5
+ exit 0
6
+ fi
7
+
8
+ npx pretty-quick --staged
9
+ yarn lint
package/README.md CHANGED
@@ -22,6 +22,18 @@ TL;DR
22
22
 
23
23
  Didn't understand anything? Okay, let's see more details
24
24
 
25
+ ### Local development
26
+
27
+ To use the package locally, pass the follow config:
28
+
29
+ ```text
30
+ - MAIL_SERVICE_SMTP_HOST=smtp.ethereal.email
31
+ - MAIL_SERVICE_SMTP_PORT=587
32
+ - MAIL_SERVICE_SMTP_SENDER=postmail@pixelplex.io
33
+ - MAIL_SERVICE_SMTP_USERNAME=
34
+ - MAIL_SERVICE_SMTP_PASSWORD=
35
+ ```
36
+
25
37
  ### Prepare templates
26
38
 
27
39
  The service uses Handlebars as template engine. So all your email templates should be prepared as handlebars templates.
@@ -32,7 +44,7 @@ For sending message your templates folder should include at least 3 files:
32
44
  - `{type}.handlebars` - body of your email where `{type}` is just your unique key for a unique type of email. For example `welcome.handlebars` for the welcome use email
33
45
  - `{type}.subject.handlebars` - subject (title) of yur email
34
46
 
35
- For example our project will store files in `templates` folder.
47
+ For example our project will store files in `templates` folder.
36
48
 
37
49
  ```
38
50
  ├── docker-compose.yml
@@ -52,9 +64,7 @@ For example our project will store files in `templates` folder.
52
64
  ```
53
65
 
54
66
  ```handlebars
55
- # welcome.subject.handlebars
56
-
57
- Welcome, {{name}}!
67
+ # welcome.subject.handlebars Welcome, {{name}}!
58
68
  ```
59
69
 
60
70
  ```handlebars
@@ -69,16 +79,16 @@ Welcome, {{name}}!
69
79
  Then you need to run this service and connect it to RMQ. For example, you can use Docker Compose:
70
80
 
71
81
  ```yaml
72
- version: "3"
82
+ version: '3'
73
83
  services:
74
84
  rabbitmq:
75
- image: "rabbitmq:3-management"
85
+ image: 'rabbitmq:3-management'
76
86
  ports:
77
- - "127.0.0.1:5672:5672"
78
- - "127.0.0.1:15672:15672"
87
+ - '127.0.0.1:5672:5672'
88
+ - '127.0.0.1:15672:15672'
79
89
 
80
90
  mail-service:
81
- image: "pixelplex/mail-service:0.1.18"
91
+ image: 'pixelplex/mail-service:0.1.18'
82
92
  environment:
83
93
  - MAIL_SERVICE_RMQ_URL=amqp://rabbitmq:5672
84
94
  - MAIL_SERVICE_RMQ_QUEUE=test_queue
@@ -89,8 +99,8 @@ services:
89
99
  - MAIL_SERVICE_SMTP_PASSWORD=$MAIL_SERVICE_SMTP_PASSWORD
90
100
  - MAIL_SERVICE_SENTRY_DNS=$MAIL_SERVICE_SENTRY_DNS
91
101
  volumes:
92
- - ./templates:/app/templates # note that we attach our template folder as /app/templates
93
- ```
102
+ - ./templates:/app/templates # note that we attach our template folder as /app/templates
103
+ ```
94
104
 
95
105
  ### Trigger new message sending
96
106
 
@@ -150,13 +160,11 @@ import { MailService } from '@pixelplex/mail-service';
150
160
 
151
161
  @Injectable()
152
162
  export class AppService {
153
-
154
163
  constructor(private mailService: MailService) {}
155
164
 
156
165
  async onModuleInit() {
157
166
  this.mailService.sendMail('test@gmail.com', 'welcome', { name: 'Афанасий' }, 20);
158
167
  }
159
-
160
168
  }
161
169
  ```
162
170
 
@@ -164,5 +172,5 @@ In the example below we'll send email to `test@gmail.com` with type `welcome` (`
164
172
 
165
173
  `{name: 'Афанасий'}` is the object with data which will used as payload data during processing your handlebars template.
166
174
 
167
- The last argument, `20`, is the number of seconds after which the message will be rejected from the queue if, but only if it was processed with an error.
175
+ The last argument, `20`, is the number of seconds after which the message will be rejected from the queue if, but only if it was processed with an error.
168
176
  If you think your message should live until it is successfully sent use `0`.
@@ -13,8 +13,8 @@ exports.MailService = void 0;
13
13
  const common_1 = require("@nestjs/common");
14
14
  const microservices_1 = require("@nestjs/microservices");
15
15
  const rxjs_1 = require("rxjs");
16
- const retry_1 = require("./retry");
17
16
  const connection_1 = require("../connection");
17
+ const retry_1 = require("./retry");
18
18
  let MailService = class MailService {
19
19
  constructor() {
20
20
  this.logger = new common_1.Logger('Mail::MailService');
@@ -23,7 +23,9 @@ let MailService = class MailService {
23
23
  await rxjs_1.defer(async () => {
24
24
  await this.client.connect();
25
25
  await this.clientRecovery.connect();
26
- }).pipe(retry_1.default(10, 5000)).toPromise();
26
+ })
27
+ .pipe(retry_1.default(10, 5000))
28
+ .toPromise();
27
29
  this.logger.log('RMQ Connected');
28
30
  }
29
31
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"app.service.js","sourceRoot":"","sources":["../../src/connect/app.service.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAA4E;AAC5E,yDAA4D;AAC5D,+BAAyC;AACzC,mCAA4B;AAC5B,8CAAwD;AAIxD,IAAa,WAAW,GAAxB,MAAa,WAAW;IAAxB;QAEU,WAAM,GAAW,IAAI,eAAM,CAAC,mBAAmB,CAAC,CAAC;IAkC3D,CAAC;IA1BC,KAAK,CAAC,sBAAsB;QAC1B,MAAM,YAAK,CAAC,KAAK,IAAI,EAAE;YACrB,MAAM,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;YAC5B,MAAM,IAAI,CAAC,cAAc,CAAC,OAAO,EAAE,CAAC;QACtC,CAAC,CAAC,CAAC,IAAI,CAAC,eAAK,CAAC,EAAE,EAAE,IAAI,CAAC,CAAC,CAAC,SAAS,EAAE,CAAC;QACrC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,eAAe,CAAC,CAAC;IACnC,CAAC;IAED;;;;;;;OAOG;IACH,QAAQ,CAAgB,EAAU,EAAE,IAAY,EAAE,OAAoC,EAAE,MAAc,CAAC;QACrG,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,CAAuB,UAAU,EAAE;YACxD,IAAI;YACJ,OAAO;YACP,EAAE;YACF,SAAS,EAAE,IAAI,IAAI,EAAE,C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;IADC,sBAAM,CAAC,qBAAQ,CAAC;8BACD,2BAAW;mDAAC;AAPjB,WAAW;IADvB,mBAAU,EAAE;GACA,WAAW,CAyCvB;AAzCY,kCAAW"}
@@ -1 +1 @@
1
- {"version":3,"file":"retry.js","sourceRoot":"","sources":["../../src/connect/retry.ts"],"names":[],"mappings":";;AACA,8CAAwD;AAExD,SAAwB,KAAK,CAC3B,aAAa,GAAG,EAAE,EAClB,UAAU,GAAG,KAAK;IAElB,OAAO,CAAI,MAAqB,EAAE,EAAE,CAClC,MAAM,CAAC,IAAI,CACT,qBAAS,CAAC,CAAC,CAAC,EAAE,EAAE,CACd,CAAC,CAAC,IAAI,CACJ,gBAAI,CAAC,CAAC,GAAW,EAAE,KAAY,EAAE,EAAE;QACjC,IAAI,GAAG,GAAG,CAAC,IAAI,aAAa,EAAE;YAC5B,MAAM,KAAK,CAAC;SACb;QACD,OAAO,GAAG,GAAG,CAAC,CAAC;IACjB,CAAC,EAAE,CAAC,CAAC,EACL,iBAAK,CAAC,UAAU,CAAC,CAClB,CACF,CACF,CAAC;AACN,CAAC;AAlBD,wBAkBC"}
1
+ {"version":3,"file":"retry.js","sourceRoot":"","sources":["../../src/connect/retry.ts"],"names":[],"mappings":";;AACA,8CAAwD;AAExD,SAAwB,KAAK,CAAC,aAAa,GAAG,EAAE,EAAE,UAAU,GAAG,KAAK;IAClE,OAAO,CAAI,MAAqB,EAAE,EAAE,CAClC,MAAM,CAAC,IAAI,CACT,qBAAS,CAAC,CAAC,CAAC,EAAE,EAAE,CACd,CAAC,CAAC,IAAI,CACJ,gBAAI,CAAC,CAAC,GAAW,EAAE,KAAY,EAAE,EAAE;QACjC,IAAI,GAAG,GAAG,CAAC,IAAI,aAAa,EAAE;YAC5B,MAAM,KAAK,CAAC;SACb;QACD,OAAO,GAAG,GAAG,CAAC,CAAC;IACjB,CAAC,EAAE,CAAC,CAAC,EACL,iBAAK,CAAC,UAAU,CAAC,CAClB,CACF,CACF,CAAC;AACN,CAAC;AAfD,wBAeC"}
package/dist/index.d.ts CHANGED
@@ -1,3 +1,3 @@
1
1
  import { MailModule } from './connect/app.module';
2
2
  import { MailService } from './connect/app.service';
3
- export { MailModule, MailService, };
3
+ export { MailModule, MailService };
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,qDAAkD;AAIhD,2FAJO,uBAAU,OAIP;AAHZ,uDAAoD;AAIlD,4FAJO,yBAAW,OAIP"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,qDAAkD;AAGzC,2FAHA,uBAAU,OAGA;AAFnB,uDAAoD;AAE/B,4FAFZ,yBAAW,OAEY"}
@@ -1,6 +1,6 @@
1
1
  import { RmqContext } from '@nestjs/microservices';
2
- import { SenderService } from './sender.service';
3
2
  import { MailMessage } from '../mail';
3
+ import { SenderService } from './sender.service';
4
4
  export declare class AppController {
5
5
  private readonly senderService;
6
6
  private logger;
@@ -26,7 +26,7 @@ let AppController = class AppController {
26
26
  const channel = context.getChannelRef();
27
27
  const originalMsg = context.getMessage();
28
28
  try {
29
- await this.senderService.sendMail(data.to, data.type, data.payload);
29
+ await this.senderService.sendMail(data.to, data.type, data.payload, data.attachments);
30
30
  channel.ack(originalMsg);
31
31
  }
32
32
  catch (e) {
@@ -1 +1 @@
1
- {"version":3,"file":"app.controller.js","sourceRoot":"","sources":["../../src/service/app.controller.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAAoD;AACpD,yDAA+E;AAC/E,uCAAuC;AACvC,qDAAiD;AAIjD,IAAa,aAAa,GAA1B,MAAa,aAAa;IAExB,YAA6B,aAA4B;QAA5B,kBAAa,GAAb,aAAa,CAAe;QADjD,WAAM,GAAG,IAAI,eAAM,CAAC,qBAAqB,CAAC,CAAC;IACS,CAAC;IAG7D,KAAK,CAAC,QAAQ,CAAY,IAAiB,EAAS,OAAmB;Q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AC,IAAI,CAAC,WAAW,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC;SACzC;IACH,CAAC;CACF,CAAA;AAtBC;IADC,4BAAY,CAAC,UAAU,CAAC;IACT,WAAA,uBAAO,EAAE,CAAA,EAAqB,WAAA,mBAAG,EAAE,CAAA;;6CAAU,0BAAU;;6CAqBtE;AA1BU,aAAa;IADzB,mBAAU,EAAE;qCAGiC,8BAAa;GAF9C,aAAa,CA2BzB;AA3BY,sCAAa"}
@@ -1,7 +1,8 @@
1
+ import { Attachment } from 'nodemailer/lib/mailer';
1
2
  export declare class SenderService {
2
3
  private transporter;
3
4
  private readonly logger;
4
5
  onModuleInit(): Promise<void>;
5
6
  connect(): Promise<void>;
6
- sendMail(to: string, template: string, context?: {}): Promise<void>;
7
+ sendMail(to: string, template: string, context?: {}, attachments?: Attachment[]): Promise<void>;
7
8
  }
@@ -1,9 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.SenderService = void 0;
4
+ const fs = require("fs");
4
5
  const common_1 = require("@nestjs/common");
5
6
  const config_1 = require("config");
6
- const fs = require("fs");
7
7
  const Handlebars = require("handlebars");
8
8
  const nodemailer_1 = require("nodemailer");
9
9
  const hbs = require("nodemailer-express-handlebars");
@@ -21,33 +21,43 @@ class SenderService {
21
21
  await this.connect();
22
22
  }
23
23
  async connect() {
24
- if (!config_1.MAIL_SERVICE.SMTP.PASSWORD) {
25
- throw new Error('[NodemailerConnector Error] Password wasn\'t provided. ' +
26
- 'You should provide the password in ENV Variable or in local.json config file');
24
+ const isEthereal = config_1.MAIL_SERVICE.SMTP.HOST === 'smtp.ethereal.email';
25
+ if (!config_1.MAIL_SERVICE.SMTP.PASSWORD && !isEthereal) {
26
+ throw new Error(`[NodemailerConnector Error] Password wasn\'t provided.
27
+ You should provide the password in ENV Variable or in local.json config file`);
28
+ }
29
+ let testAccount;
30
+ if (isEthereal) {
31
+ this.logger.warn('Run in ethereal.email mode');
32
+ testAccount = await nodemailer_1.createTestAccount();
27
33
  }
28
34
  this.transporter = nodemailer_1.createTransport({
29
35
  host: config_1.MAIL_SERVICE.SMTP.HOST,
30
36
  port: config_1.MAIL_SERVICE.SMTP.PORT,
31
37
  auth: {
32
- user: config_1.MAIL_SERVICE.SMTP.USERNAME,
33
- pass: config_1.MAIL_SERVICE.SMTP.PASSWORD,
38
+ user: config_1.MAIL_SERVICE.SMTP.USERNAME || testAccount.user,
39
+ pass: config_1.MAIL_SERVICE.SMTP.PASSWORD || testAccount.pass,
34
40
  },
35
41
  });
36
42
  this.transporter.use('compile', hbs(hbsOptions));
37
43
  this.logger.log('Connected');
38
44
  }
39
- async sendMail(to, template, context = {}) {
45
+ async sendMail(to, template, context = {}, attachments) {
40
46
  this.logger.debug(`New message to "${to}" with template "${template}"`);
41
47
  const subjectTpl = Handlebars.compile(fs.readFileSync(`templates/${template}.subject.handlebars`).toString());
42
48
  const info = await this.transporter.sendMail({
43
49
  from: config_1.MAIL_SERVICE.SMTP.SENDER,
44
50
  to,
45
- html: subjectTpl(context),
51
+ subject: subjectTpl(context),
46
52
  template,
47
53
  context,
48
- subject: context['subject'] || subjectTpl(context),
54
+ attachments,
49
55
  });
50
56
  this.logger.debug(`Message sent: ${info.messageId}, ${info.response}`);
57
+ const isEthereal = config_1.MAIL_SERVICE.SMTP.HOST === 'smtp.ethereal.email';
58
+ if (isEthereal) {
59
+ this.logger.debug(`Preview URL: ${nodemailer_1.getTestMessageUrl(info)}`);
60
+ }
51
61
  }
52
62
  }
53
63
  exports.SenderService = SenderService;
@@ -1 +1 @@
1
- {"version":3,"file":"sender.service.js","sourceRoot":"","sources":["../../src/service/sender.service.ts"],"names":[],"mappings":";;;AAAA,2CAAwC;AACxC,mCAAsC;AACtC,yBAAyB;AACzB,yCAAyC;AACzC,2CAA0D;AAC1D,qDAAqD;AAErD,MAAM,UAAU,GAAG;IACjB,UAAU,EAAE;QACV,UAAU,EAAE,YAAY;KACzB;IACD,QAAQ,EAAE,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SAC9D;IACH,CAAC;CACF;AAnDD,sCAmDC"}
@@ -162,8 +162,8 @@
162
162
  "affectsGlobalScope": false
163
163
  },
164
164
  "../config/config.d.ts": {
165
- "version": "f0c18c57a4bff760d051e3f3a1250ba811df4e1f79f5e416e0bf8bcee130d57e",
166
- "signature": "f0c18c57a4bff760d051e3f3a1250ba811df4e1f79f5e416e0bf8bcee130d57e",
165
+ "version": "a11b8b28e405cdf8818fc053f80ca0d46ae55cfecd39d6dfb0ac89f4b7965ade",
166
+ "signature": "a11b8b28e405cdf8818fc053f80ca0d46ae55cfecd39d6dfb0ac89f4b7965ade",
167
167
  "affectsGlobalScope": false
168
168
  },
169
169
  "../node_modules/reflect-metadata/index.d.ts": {
@@ -1966,6 +1966,11 @@
1966
1966
  "signature": "d0e844f8d00a27b4afd839f57ddabff3f457f8ed98e670c3f17cf61407576906",
1967
1967
  "affectsGlobalScope": false
1968
1968
  },
1969
+ "../src/mail.d.ts": {
1970
+ "version": "023e3fcc154e0171bb22980109336d347682a43ac3b30c33212bfb613ab76704",
1971
+ "signature": "023e3fcc154e0171bb22980109336d347682a43ac3b30c33212bfb613ab76704",
1972
+ "affectsGlobalScope": false
1973
+ },
1969
1974
  "../node_modules/rxjs/internal/operators/audit.d.ts": {
1970
1975
  "version": "fe936a68d281ccc2060f8c3de69a0682a807c8fd1b8abccc0a91b83195ca0f94",
1971
1976
  "signature": "fe936a68d281ccc2060f8c3de69a0682a807c8fd1b8abccc0a91b83195ca0f94",
@@ -2487,28 +2492,23 @@
2487
2492
  "affectsGlobalScope": false
2488
2493
  },
2489
2494
  "../src/connect/retry.ts": {
2490
- "version": "f5154248c8f80502bfe422df1af38e73dea4d939e44152b51e1950885be26e3b",
2495
+ "version": "42b8e65e9e160a7e9bb0c559205007efdff041c9501ef6d8114edb557e0db5ad",
2491
2496
  "signature": "f70a6637f85c35150334dd3eab81fd249c48e434ec73281b27ee651200814ffc",
2492
2497
  "affectsGlobalScope": false
2493
2498
  },
2494
- "../src/mail.d.ts": {
2495
- "version": "5f3399155258696fcde2116d01c07bf803f4c6c7d9de3708aa35d80995ce7d19",
2496
- "signature": "5f3399155258696fcde2116d01c07bf803f4c6c7d9de3708aa35d80995ce7d19",
2497
- "affectsGlobalScope": false
2498
- },
2499
2499
  "../src/connect/app.service.ts": {
2500
- "version": "09ae2a2615f9a7be2d5c7b1fb6fe8bff5c70ef3ead2ede0726cb80a49d752d46",
2500
+ "version": "432256fad9934c875d9951fb289aca55f7af9c229ac4d95007644da6c009377d",
2501
2501
  "signature": "3a2a5a3ae4859ce6e5b358b7e3fd8924a91d3337e94c00a92f247883c7ad3823",
2502
2502
  "affectsGlobalScope": false
2503
2503
  },
2504
2504
  "../src/connect/app.module.ts": {
2505
- "version": "f5d30a372a33befb6a7987f066fa60b37f15a7d113f91e25d14274bc981ced18",
2505
+ "version": "e54f2fd0be8dcdc83252ba372c97c8eef27cfc3eb5ec6f50426075f958d2dbec",
2506
2506
  "signature": "447b753b3e76578ef29631d0bcca78bac6ce0b377c4ca60923c08c835f09e01e",
2507
2507
  "affectsGlobalScope": false
2508
2508
  },
2509
2509
  "../src/index.ts": {
2510
- "version": "b27fd00a2326830dfdf90a20ac65cefe4a01782739e71cafd2b4b35de57acf98",
2511
- "signature": "a68497cbe44702698fed6c7c1c0db528bdaa2e3d4c6f7f7b4e7d70abd2b96214",
2510
+ "version": "e1b28ebbced0520af911163e9cebd9d17ec40a08b08299ee49190f9cf2f43d9a",
2511
+ "signature": "9ea9eb6ec27a350c86cadf8abac728ddb46d6fd294c9f50fb917ed6e152381d0",
2512
2512
  "affectsGlobalScope": false
2513
2513
  },
2514
2514
  "../node_modules/@sentry/types/dist/severity.d.ts": {
@@ -2947,13 +2947,13 @@
2947
2947
  "affectsGlobalScope": true
2948
2948
  },
2949
2949
  "../src/service/sender.service.ts": {
2950
- "version": "8efc6bb2b0d1ab5075035208c8f0a0824a1acb4947a076e2633981c9fb706d5f",
2951
- "signature": "5e96a95ffb4d84a38bd2e97153d2e1f92eb116d00d9e52791b51a5b09933e527",
2950
+ "version": "b5f4a5b70115a000ce90e72dc1510cc29493a52413cbce393acf57f21c807390",
2951
+ "signature": "9d42adcd455789e45848adcfe94505e1b2c401fdfcc3a62b8d6c216b415bd89f",
2952
2952
  "affectsGlobalScope": false
2953
2953
  },
2954
2954
  "../src/service/app.controller.ts": {
2955
- "version": "b284b83841b93fe86d126cfc2bffa1790c275be4e4fa1f32af55e8db765b8845",
2956
- "signature": "412ac792be8c4736e7711ce1beb2ed87387413f2a23633fa2eabf5c8bf2e80b9",
2955
+ "version": "d850b6e7f4fd62c1d4e46bbcf25861acc6bc2e9e9f81ee55c97aa1c27a57b9dd",
2956
+ "signature": "aea0ee31c1f217cc949e3d2a97ba74a9117869048f9f703c18742696ed4d2eec",
2957
2957
  "affectsGlobalScope": false
2958
2958
  },
2959
2959
  "../src/service/app.module.ts": {
@@ -3136,6 +3136,11 @@
3136
3136
  "signature": "96d14f21b7652903852eef49379d04dbda28c16ed36468f8c9fa08f7c14c9538",
3137
3137
  "affectsGlobalScope": false
3138
3138
  },
3139
+ "../node_modules/@types/minimatch/index.d.ts": {
3140
+ "version": "8841e2aa774b89bd23302dede20663306dc1b9902431ac64b24be8b8d0e3f649",
3141
+ "signature": "8841e2aa774b89bd23302dede20663306dc1b9902431ac64b24be8b8d0e3f649",
3142
+ "affectsGlobalScope": false
3143
+ },
3139
3144
  "../node_modules/@types/normalize-package-data/index.d.ts": {
3140
3145
  "version": "c9ad058b2cc9ce6dc2ed92960d6d009e8c04bef46d3f5312283debca6869f613",
3141
3146
  "signature": "c9ad058b2cc9ce6dc2ed92960d6d009e8c04bef46d3f5312283debca6869f613",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pixelplex/mail-service",
3
- "version": "0.1.19",
3
+ "version": "0.1.21-attachments",
4
4
  "description": "Mail service",
5
5
  "author": "dev@pixelplex.io",
6
6
  "private": false,
@@ -9,7 +9,7 @@
9
9
  "scripts": {
10
10
  "prebuild": "rimraf dist",
11
11
  "build": "nest build",
12
- "format": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\"",
12
+ "format": "prettier --write \"src/**/*.ts\"",
13
13
  "start": "nest start",
14
14
  "start:dev": "nest start --watch",
15
15
  "start:debug": "nest start --debug --watch",
@@ -19,7 +19,9 @@
19
19
  "test:watch": "jest --watch",
20
20
  "test:cov": "jest --coverage",
21
21
  "test:debug": "node --inspect-brk -r tsconfig-paths/register -r ts-node/register node_modules/.bin/jest --runInBand",
22
- "test:e2e": "jest --config ./test/jest-e2e.json"
22
+ "test:e2e": "jest --config ./test/jest-e2e.json",
23
+ "audit": "audit-ci --config audit-ci.json",
24
+ "prepare": "husky install"
23
25
  },
24
26
  "dependencies": {
25
27
  "@nestjs/common": "^7.5.1",
@@ -32,7 +34,7 @@
32
34
  "config": "^3.3.2",
33
35
  "express-handlebars": "^5.2.0",
34
36
  "handlebars": "^4.7.6",
35
- "nodemailer": "^6.4.14",
37
+ "nodemailer": "^6.7.2",
36
38
  "nodemailer-express-handlebars": "^4.0.0",
37
39
  "reflect-metadata": "^0.1.13",
38
40
  "rimraf": "^3.0.2",
@@ -46,14 +48,19 @@
46
48
  "@types/jest": "^26.0.15",
47
49
  "@types/node": "^14.14.6",
48
50
  "@types/supertest": "^2.0.10",
49
- "@typescript-eslint/eslint-plugin": "^4.6.1",
50
- "@typescript-eslint/parser": "^4.6.1",
51
- "eslint": "^7.12.1",
52
- "eslint-config-prettier": "^6.15.0",
53
- "eslint-plugin-prettier": "^3.1.4",
54
- "husky": "^4.3.0",
51
+ "@typescript-eslint/eslint-plugin": "^5.3.0",
52
+ "@typescript-eslint/eslint-plugin-tslint": "^5.3.0",
53
+ "@typescript-eslint/parser": "^5.3.0",
54
+ "audit-ci": "^5.1.2",
55
+ "eslint": "^8.2.0",
56
+ "eslint-config-prettier": "^8.3.0",
57
+ "eslint-import-resolver-typescript": "^2.5.0",
58
+ "eslint-plugin-import": "^2.25.2",
59
+ "eslint-plugin-prettier": "^4.0.0",
60
+ "husky": "^7.0.2",
55
61
  "jest": "^26.6.3",
56
- "prettier": "^2.1.2",
62
+ "prettier": "^2.5.1",
63
+ "pretty-quick": "^3.1.3",
57
64
  "supertest": "^6.0.0",
58
65
  "ts-jest": "^26.4.3",
59
66
  "ts-loader": "^8.0.8",
@@ -77,10 +84,5 @@
77
84
  ],
78
85
  "coverageDirectory": "../coverage",
79
86
  "testEnvironment": "node"
80
- },
81
- "husky": {
82
- "hooks": {
83
- "pre-commit": "yarn lint"
84
- }
85
87
  }
86
88
  }