docta-package 1.2.14 → 1.2.16

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/build/config.d.ts CHANGED
@@ -10,6 +10,10 @@ interface GeneralConfig {
10
10
  forgotPasswordTokenSecret: string;
11
11
  activationTokenSecret: string;
12
12
  rabbitmqHost: string;
13
+ awsSesHost: string;
14
+ awsSesPort: number;
15
+ awsSesUsername: string;
16
+ awsSesPassword: string;
13
17
  }
14
18
  export declare const getGeneralConfig: () => GeneralConfig;
15
19
  export {};
package/build/config.js CHANGED
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getGeneralConfig = void 0;
4
4
  const getGeneralConfig = () => {
5
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
5
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
6
6
  return ({
7
7
  accessTokenSecret: (_a = process.env.ACCESS_TOKEN_SECRET) !== null && _a !== void 0 ? _a : "",
8
8
  refreshTokenSecret: (_b = process.env.REFRESH_TOKEN_SECRET) !== null && _b !== void 0 ? _b : "",
@@ -15,6 +15,10 @@ const getGeneralConfig = () => {
15
15
  forgotPasswordTokenSecret: (_j = process.env.FORGOT_PASSWORD_TOKEN_SECRET) !== null && _j !== void 0 ? _j : "",
16
16
  activationTokenSecret: (_k = process.env.ACTIVATION_TOKEN_SECRET) !== null && _k !== void 0 ? _k : "",
17
17
  rabbitmqHost: (_l = process.env.RABBITMQ_HOST) !== null && _l !== void 0 ? _l : "",
18
+ awsSesHost: (_m = process.env.AWS_SES_HOST) !== null && _m !== void 0 ? _m : "",
19
+ awsSesPort: Number((_o = process.env.AWS_SES_PORT) !== null && _o !== void 0 ? _o : 0),
20
+ awsSesUsername: (_p = process.env.AWS_SES_USERNAME) !== null && _p !== void 0 ? _p : "",
21
+ awsSesPassword: (_q = process.env.AWS_SES_PASSWORD) !== null && _q !== void 0 ? _q : "",
18
22
  });
19
23
  };
20
24
  exports.getGeneralConfig = getGeneralConfig;
@@ -3,3 +3,4 @@ export * from "./s3-helper";
3
3
  export * from "./token-utils";
4
4
  export * from "./validate-info";
5
5
  export * from "./winston";
6
+ export * from "./ses-helper";
@@ -19,3 +19,4 @@ __exportStar(require("./s3-helper"), exports);
19
19
  __exportStar(require("./token-utils"), exports);
20
20
  __exportStar(require("./validate-info"), exports);
21
21
  __exportStar(require("./winston"), exports);
22
+ __exportStar(require("./ses-helper"), exports);
@@ -0,0 +1,6 @@
1
+ import SMTPTransport from "nodemailer/lib/smtp-transport";
2
+ export declare class AwsSesHelper {
3
+ private transporter;
4
+ constructor();
5
+ sendEmail(receiver: string, sender: string, html: string, subject: string): Promise<SMTPTransport.SentMessageInfo>;
6
+ }
@@ -0,0 +1,45 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __importDefault = (this && this.__importDefault) || function (mod) {
12
+ return (mod && mod.__esModule) ? mod : { "default": mod };
13
+ };
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.AwsSesHelper = void 0;
16
+ const nodemailer_1 = __importDefault(require("nodemailer"));
17
+ const config_1 = require("../config");
18
+ class AwsSesHelper {
19
+ constructor() {
20
+ this.transporter = nodemailer_1.default.createTransport({
21
+ host: (0, config_1.getGeneralConfig)().awsSesHost,
22
+ port: (0, config_1.getGeneralConfig)().awsSesPort,
23
+ auth: {
24
+ user: (0, config_1.getGeneralConfig)().awsSesUsername,
25
+ pass: (0, config_1.getGeneralConfig)().awsSesPassword,
26
+ },
27
+ // tls: {
28
+ // rejectUnauthorized: false, // Bypass certificate validation
29
+ // },
30
+ });
31
+ }
32
+ sendEmail(receiver, sender, html, subject) {
33
+ return __awaiter(this, void 0, void 0, function* () {
34
+ const mailOptions = {
35
+ from: sender,
36
+ to: receiver,
37
+ subject,
38
+ html,
39
+ };
40
+ const data = yield this.transporter.sendMail(mailOptions);
41
+ return data;
42
+ });
43
+ }
44
+ }
45
+ exports.AwsSesHelper = AwsSesHelper;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "docta-package",
3
- "version": "1.2.14",
3
+ "version": "1.2.16",
4
4
  "description": "This package will contail all the required files to run the docta micro-service app",
5
5
  "main": "build/index.js",
6
6
  "types": "build/index.d.ts",
@@ -30,6 +30,7 @@
30
30
  "@aws-sdk/client-s3": "^3.908.0",
31
31
  "@aws-sdk/s3-request-presigner": "^3.908.0",
32
32
  "@types/amqplib": "^0.10.7",
33
+ "@types/nodemailer": "^7.0.2",
33
34
  "amqplib": "^0.10.9",
34
35
  "bcryptjs": "^3.0.2",
35
36
  "class-transformer": "^0.5.1",
@@ -38,6 +39,7 @@
38
39
  "jsonwebtoken": "^9.0.2",
39
40
  "mongoose": "^8.19.1",
40
41
  "multer": "^2.0.2",
42
+ "nodemailer": "^7.0.9",
41
43
  "reflect-metadata": "^0.2.2",
42
44
  "winston": "^3.18.3",
43
45
  "winston-daily-rotate-file": "^5.0.0"