@pixelplex/mail-service 0.2.0 → 0.2.2

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.
Files changed (43) hide show
  1. package/README.md +27 -20
  2. package/audit-ci.json +4 -0
  3. package/commitlint.config.js +27 -0
  4. package/dist/constants/mail.constants.d.ts +2 -1
  5. package/dist/constants/mail.constants.js +1 -0
  6. package/dist/constants/mail.constants.js.map +1 -1
  7. package/dist/factories/gateway.factory.js +1 -0
  8. package/dist/factories/gateway.factory.js.map +1 -1
  9. package/dist/gateways/console.gateway.js +2 -1
  10. package/dist/gateways/console.gateway.js.map +1 -1
  11. package/dist/gateways/index.d.ts +1 -0
  12. package/dist/gateways/index.js +1 -0
  13. package/dist/gateways/index.js.map +1 -1
  14. package/dist/gateways/sendgrid.gateway.d.ts +8 -0
  15. package/dist/gateways/sendgrid.gateway.js +46 -0
  16. package/dist/gateways/sendgrid.gateway.js.map +1 -0
  17. package/dist/gateways/slack.gateway.js +3 -2
  18. package/dist/gateways/slack.gateway.js.map +1 -1
  19. package/dist/gateways/smtp.gateway.js +2 -1
  20. package/dist/gateways/smtp.gateway.js.map +1 -1
  21. package/dist/mail.module.js +2 -1
  22. package/dist/mail.module.js.map +1 -1
  23. package/dist/services/mail-sender.service.d.ts +2 -2
  24. package/dist/services/mail-sender.service.js +21 -13
  25. package/dist/services/mail-sender.service.js.map +1 -1
  26. package/dist/tsconfig.build.tsbuildinfo +1 -1
  27. package/dist/types/index.d.ts +1 -0
  28. package/dist/types/index.js +1 -0
  29. package/dist/types/index.js.map +1 -1
  30. package/dist/types/options.types.d.ts +4 -1
  31. package/dist/types/sendgrid-options.types.d.ts +4 -0
  32. package/dist/types/sendgrid-options.types.js +3 -0
  33. package/dist/types/sendgrid-options.types.js.map +1 -0
  34. package/dist/types/slack-options.types.d.ts +1 -1
  35. package/dist/types/templates.types.d.ts +5 -3
  36. package/dist/utils/index.d.ts +1 -0
  37. package/dist/utils/index.js +1 -0
  38. package/dist/utils/index.js.map +1 -1
  39. package/dist/utils/object.utils.d.ts +1 -0
  40. package/dist/utils/object.utils.js +8 -0
  41. package/dist/utils/object.utils.js.map +1 -0
  42. package/package.json +33 -15
  43. package/.husky/pre-commit +0 -9
@@ -18,6 +18,7 @@ __exportStar(require("./templates.types"), exports);
18
18
  __exportStar(require("./decorators.types"), exports);
19
19
  __exportStar(require("./gateway.class"), exports);
20
20
  __exportStar(require("./options.types"), exports);
21
+ __exportStar(require("./sendgrid-options.types"), exports);
21
22
  __exportStar(require("./slack-options.types"), exports);
22
23
  __exportStar(require("./smtp-options.types"), exports);
23
24
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,oDAAkC;AAClC,qDAAmC;AACnC,kDAAgC;AAChC,kDAAgC;AAChC,wDAAsC;AACtC,uDAAqC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,oDAAkC;AAClC,qDAAmC;AACnC,kDAAgC;AAChC,kDAAgC;AAChC,2DAAyC;AACzC,wDAAsC;AACtC,uDAAqC"}
@@ -1,8 +1,9 @@
1
1
  import { ExtendsOrEmpty } from '../utils';
2
2
  import { GatewayClass } from './gateway.class';
3
+ import { SendgridOptions } from './sendgrid-options.types';
3
4
  import { SlackOptions } from './slack-options.types';
4
5
  import { SmtpOptions } from './smtp-options.types';
5
- export type Gateway = 'smtp' | 'console' | 'slack';
6
+ export type Gateway = 'smtp' | 'console' | 'slack' | 'sendgrid';
6
7
  export type MailOptions<TGateway extends Gateway = Gateway> = {
7
8
  readonly gateways: [TGateway, ...TGateway[]];
8
9
  readonly customGateways?: [GatewayClass, ...GatewayClass[]];
@@ -10,4 +11,6 @@ export type MailOptions<TGateway extends Gateway = Gateway> = {
10
11
  smtp: SmtpOptions;
11
12
  }> & ExtendsOrEmpty<'slack', TGateway, {
12
13
  slack: SlackOptions;
14
+ }> & ExtendsOrEmpty<'sendgrid', TGateway, {
15
+ sendgrid: SendgridOptions;
13
16
  }>;
@@ -0,0 +1,4 @@
1
+ export type SendgridOptions = {
2
+ readonly apiKey: string;
3
+ readonly sender: string;
4
+ };
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=sendgrid-options.types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sendgrid-options.types.js","sourceRoot":"","sources":["../../src/types/sendgrid-options.types.ts"],"names":[],"mappings":""}
@@ -1,3 +1,3 @@
1
1
  export type SlackOptions = {
2
- url: string;
2
+ readonly url: string;
3
3
  };
@@ -1,10 +1,12 @@
1
1
  export type Content = {
2
2
  subject?: string;
3
- html?: string;
3
+ html: string;
4
4
  plain?: string;
5
5
  };
6
- export type TemplatePaths = {
7
- html?: string;
6
+ export type TemplatePathsOrContent = {
7
+ htmlPath: string;
8
8
  plain?: string;
9
+ plainPath?: string;
9
10
  subject?: string;
11
+ subjectPath?: string;
10
12
  };
@@ -1,2 +1,3 @@
1
1
  export * from './connection.utils';
2
+ export * from './object.utils';
2
3
  export * from './types.utils';
@@ -15,5 +15,6 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./connection.utils"), exports);
18
+ __exportStar(require("./object.utils"), exports);
18
19
  __exportStar(require("./types.utils"), exports);
19
20
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,qDAAmC;AACnC,gDAA8B"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,qDAAmC;AACnC,iDAA+B;AAC/B,gDAA8B"}
@@ -0,0 +1 @@
1
+ export declare function isDefined<T>(value: T): value is NonNullable<T>;
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isDefined = void 0;
4
+ function isDefined(value) {
5
+ return value !== undefined && value !== null;
6
+ }
7
+ exports.isDefined = isDefined;
8
+ //# sourceMappingURL=object.utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"object.utils.js","sourceRoot":"","sources":["../../src/utils/object.utils.ts"],"names":[],"mappings":";;;AAAA,SAAgB,SAAS,CAAI,KAAQ;IACnC,OAAO,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,IAAI,CAAC;AAC/C,CAAC;AAFD,8BAEC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pixelplex/mail-service",
3
- "version": "0.2.0",
3
+ "version": "0.2.2",
4
4
  "description": "Mail service",
5
5
  "author": "dev@pixelplex.io",
6
6
  "private": false,
@@ -19,23 +19,27 @@
19
19
  "test:e2e": "jest --config ./test/jest-e2e.json",
20
20
  "audit": "audit-ci --config audit-ci.json",
21
21
  "prepare": "husky install",
22
- "type-check": "tsc --pretty --noEmit"
22
+ "type-check": "tsc --pretty --noEmit",
23
+ "commit": "git-cz"
23
24
  },
24
25
  "dependencies": {
25
- "@nestjs/common": "^9.4.3",
26
- "@nestjs/core": "^9.4.3",
27
- "axios": "^1.4.0",
28
- "handlebars": "^4.7.7",
29
- "nodemailer": "^6.9.3",
26
+ "@nestjs/common": "^10.2.8",
27
+ "@nestjs/core": "^10.2.8",
28
+ "@sendgrid/mail": "^7.7.0",
29
+ "axios": "^1.6.1",
30
+ "handlebars": "^4.7.8",
31
+ "nodemailer": "^6.9.7",
30
32
  "reflect-metadata": "^0.1.13",
31
33
  "rimraf": "^3.0.2"
32
34
  },
33
35
  "devDependencies": {
36
+ "@commitlint/cli": "^17.6.6",
37
+ "@commitlint/config-conventional": "^17.6.6",
38
+ "@commitlint/cz-commitlint": "^17.5.0",
34
39
  "@nestjs/cli": "^9.5.0",
35
40
  "@nestjs/schematics": "^9.2.0",
36
41
  "@nestjs/testing": "^9.4.3",
37
- "@types/express": "^4.17.17",
38
- "@types/jest": "^26.0.15",
42
+ "@types/jest": "^29.5.0",
39
43
  "@types/node": "^18.16.18",
40
44
  "@types/nodemailer": "^6.4.8",
41
45
  "@types/supertest": "^2.0.12",
@@ -43,22 +47,28 @@
43
47
  "@typescript-eslint/eslint-plugin-tslint": "^5.60.1",
44
48
  "@typescript-eslint/parser": "^5.60.1",
45
49
  "audit-ci": "^5.1.2",
50
+ "commitizen": "^4.3.0",
46
51
  "eslint": "^8.43.0",
47
52
  "eslint-config-prettier": "^8.8.0",
48
53
  "eslint-import-resolver-typescript": "^3.5.5",
49
54
  "eslint-plugin-import": "^2.27.5",
50
55
  "eslint-plugin-prettier": "^4.2.1",
51
- "husky": "^7.0.2",
52
- "jest": "^26.6.3",
53
- "prettier": "^2.5.1",
56
+ "husky": "^8.0.3",
57
+ "jest": "^29.6.1",
58
+ "lint-staged": "^13.2.2",
59
+ "prettier": "^2.8.7",
54
60
  "pretty-quick": "^3.1.3",
55
61
  "supertest": "^6.3.3",
56
- "ts-jest": "^26.4.3",
57
- "ts-loader": "^8.0.8",
58
- "ts-node": "^9.0.0",
62
+ "ts-jest": "^29.1.0",
63
+ "ts-loader": "^9.4.2",
64
+ "ts-node": "^10.9.1",
59
65
  "tsconfig-paths": "^4.2.0",
66
+ "tslint": "^6.1.3",
60
67
  "typescript": "^5.1.6"
61
68
  },
69
+ "resolutions": {
70
+ "axios": "1.6.1"
71
+ },
62
72
  "jest": {
63
73
  "moduleFileExtensions": [
64
74
  "js",
@@ -75,5 +85,13 @@
75
85
  ],
76
86
  "coverageDirectory": "../coverage",
77
87
  "testEnvironment": "node"
88
+ },
89
+ "lint-staged": {
90
+ "*.ts": "eslint --fix"
91
+ },
92
+ "config": {
93
+ "commitizen": {
94
+ "path": "@commitlint/cz-commitlint"
95
+ }
78
96
  }
79
97
  }
package/.husky/pre-commit DELETED
@@ -1,9 +0,0 @@
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