@platform-x/hep-notification-client 1.2.8 → 1.3.0
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/dist/src/common/service/twilioService.d.ts +2 -1
- package/dist/src/common/service/twilioService.js +11 -4
- package/dist/src/common/util/secretKeyManager.d.ts +7 -0
- package/dist/src/common/util/secretKeyManager.js +58 -0
- package/dist/src/index.d.ts +2 -0
- package/dist/src/index.js +13 -1
- package/dist/src/platform-x/database/connection.js +4 -1
- package/dist/src/platform-x/interface/interface.d.ts +4 -0
- package/dist/src/platform-x/interface/interface.js +3 -0
- package/dist/src/platform-x/util/emailHandler.js +18 -12
- package/package.json +2 -2
- package/postman_collection/HEP_Environment.postman_environment.json +45 -0
- package/postman_collection/hep-notification.postman_collection.json +56 -0
- package/reports/output.jtl +1 -0
- package/reports/scripts/jmeter_sendgrid.js +34 -0
- package/reports/scripts/newman_sendgrid.js +40 -0
- package/reports/scripts/sendgrid.js +40 -0
- package/reports/scripts/trivy_sendgrid.js +40 -0
|
@@ -7,7 +7,8 @@ export declare class TwilioService {
|
|
|
7
7
|
* @param authToken - Twilio Auth Token
|
|
8
8
|
* @param senderNumber - Twilio Sender Phone Number
|
|
9
9
|
*/
|
|
10
|
-
constructor();
|
|
10
|
+
private constructor();
|
|
11
|
+
static TwilioClassObject(): Promise<TwilioService>;
|
|
11
12
|
/**
|
|
12
13
|
* Send an SMS using Twilio
|
|
13
14
|
* @param to - Recipient's phone number
|
|
@@ -15,7 +15,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
15
15
|
exports.TwilioService = void 0;
|
|
16
16
|
const twilio_1 = __importDefault(require("twilio"));
|
|
17
17
|
const logger_1 = require("../util/logger");
|
|
18
|
-
const
|
|
18
|
+
const constants_1 = require("../../platform-x/constants");
|
|
19
|
+
const __1 = require("../..");
|
|
19
20
|
class TwilioService {
|
|
20
21
|
/**
|
|
21
22
|
* Constructor to initialize Twilio client and sender number
|
|
@@ -23,9 +24,15 @@ class TwilioService {
|
|
|
23
24
|
* @param authToken - Twilio Auth Token
|
|
24
25
|
* @param senderNumber - Twilio Sender Phone Number
|
|
25
26
|
*/
|
|
26
|
-
constructor() {
|
|
27
|
-
this.client = (0, twilio_1.default)(
|
|
28
|
-
this.senderNumber =
|
|
27
|
+
constructor(twilioConfig) {
|
|
28
|
+
this.client = (0, twilio_1.default)(twilioConfig === null || twilioConfig === void 0 ? void 0 : twilioConfig[constants_1.DynamicValues === null || constants_1.DynamicValues === void 0 ? void 0 : constants_1.DynamicValues.TWILIO_ACCOUNT_SID], twilioConfig === null || twilioConfig === void 0 ? void 0 : twilioConfig[constants_1.DynamicValues === null || constants_1.DynamicValues === void 0 ? void 0 : constants_1.DynamicValues.TWILIO_AUTH_TOKEN]);
|
|
29
|
+
this.senderNumber = twilioConfig === null || twilioConfig === void 0 ? void 0 : twilioConfig[constants_1.DynamicValues === null || constants_1.DynamicValues === void 0 ? void 0 : constants_1.DynamicValues.TWILIO_SENDER_NUMBER];
|
|
30
|
+
}
|
|
31
|
+
static TwilioClassObject() {
|
|
32
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
33
|
+
const secrets = yield (0, __1.getIAMSecrets)();
|
|
34
|
+
return new TwilioService(secrets);
|
|
35
|
+
});
|
|
29
36
|
}
|
|
30
37
|
/**
|
|
31
38
|
* Send an SMS using Twilio
|
|
@@ -0,0 +1,58 @@
|
|
|
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.SecretKeyServices = void 0;
|
|
16
|
+
const hep_secret_access_1 = require("hep-secret-access");
|
|
17
|
+
const constants_1 = require("../../platform-x/constants");
|
|
18
|
+
const config_1 = __importDefault(require("../../config"));
|
|
19
|
+
class SecretKeyServices {
|
|
20
|
+
constructor() {
|
|
21
|
+
this.ruleCache = new Map();
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Fetches all the secret keys
|
|
25
|
+
*/
|
|
26
|
+
getSecretKeys() {
|
|
27
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
28
|
+
try {
|
|
29
|
+
// Initialize secret manager object
|
|
30
|
+
if (this.ruleCache.has('secret_data')) {
|
|
31
|
+
return this.ruleCache.get('secret_data');
|
|
32
|
+
}
|
|
33
|
+
const secretObject = (0, hep_secret_access_1.secretManager)();
|
|
34
|
+
// If secret mode is ENV – read one by one
|
|
35
|
+
// for local testing
|
|
36
|
+
if ((config_1.default === null || config_1.default === void 0 ? void 0 : config_1.default.SECRET_MODE) === 'env') {
|
|
37
|
+
const keyConfig = {};
|
|
38
|
+
for (const key of Object.values(constants_1.DynamicValues)) {
|
|
39
|
+
// Fetch individual value (existing read() method)
|
|
40
|
+
const value = yield secretObject.read(key);
|
|
41
|
+
keyConfig[key] = value;
|
|
42
|
+
}
|
|
43
|
+
this.ruleCache.set('secret_data', keyConfig);
|
|
44
|
+
return keyConfig;
|
|
45
|
+
}
|
|
46
|
+
// else – fetch all secrets from GSM
|
|
47
|
+
const data = yield secretObject.readAllSecrets();
|
|
48
|
+
this.ruleCache.set('secret_data', data);
|
|
49
|
+
return data;
|
|
50
|
+
}
|
|
51
|
+
catch (err) {
|
|
52
|
+
return {};
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
exports.SecretKeyServices = SecretKeyServices;
|
|
58
|
+
//# sourceMappingURL=secretKeyManager.js.map
|
package/dist/src/index.d.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
1
|
import { EmailHandler } from "./platform-x/util/emailHandler";
|
|
2
2
|
import { TwilioService } from "./common/service/twilioService";
|
|
3
|
+
export declare const initNotificationSecrets: (secretServiceIns: any) => void;
|
|
4
|
+
export declare const getIAMSecrets: () => any;
|
|
3
5
|
export { EmailHandler, TwilioService };
|
package/dist/src/index.js
CHANGED
|
@@ -1,8 +1,20 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.TwilioService = exports.EmailHandler = void 0;
|
|
3
|
+
exports.TwilioService = exports.EmailHandler = exports.getIAMSecrets = exports.initNotificationSecrets = void 0;
|
|
4
4
|
const emailHandler_1 = require("./platform-x/util/emailHandler");
|
|
5
5
|
Object.defineProperty(exports, "EmailHandler", { enumerable: true, get: function () { return emailHandler_1.EmailHandler; } });
|
|
6
6
|
const twilioService_1 = require("./common/service/twilioService");
|
|
7
7
|
Object.defineProperty(exports, "TwilioService", { enumerable: true, get: function () { return twilioService_1.TwilioService; } });
|
|
8
|
+
let injectedSecretService;
|
|
9
|
+
const initNotificationSecrets = (secretServiceIns) => {
|
|
10
|
+
injectedSecretService = secretServiceIns;
|
|
11
|
+
};
|
|
12
|
+
exports.initNotificationSecrets = initNotificationSecrets;
|
|
13
|
+
const getIAMSecrets = () => {
|
|
14
|
+
if (!injectedSecretService) {
|
|
15
|
+
throw new Error("IAM secrets not initialized");
|
|
16
|
+
}
|
|
17
|
+
return injectedSecretService.getSecretKeys(); // returns cached data
|
|
18
|
+
};
|
|
19
|
+
exports.getIAMSecrets = getIAMSecrets;
|
|
8
20
|
//# sourceMappingURL=index.js.map
|
|
@@ -15,6 +15,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
15
15
|
const mongoose_1 = __importDefault(require("mongoose"));
|
|
16
16
|
const logger_1 = require("../../common/util/logger");
|
|
17
17
|
const index_1 = __importDefault(require("../../config/index"));
|
|
18
|
+
const constants_1 = require("../constants");
|
|
19
|
+
const __1 = require("../..");
|
|
18
20
|
let database = mongoose_1.default.connection;
|
|
19
21
|
// Exit on error
|
|
20
22
|
mongoose_1.default.connection.on('error', (err) => {
|
|
@@ -25,7 +27,8 @@ const connect = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
25
27
|
if (database.readyState) {
|
|
26
28
|
return;
|
|
27
29
|
}
|
|
28
|
-
|
|
30
|
+
const secrets = yield (0, __1.getIAMSecrets)();
|
|
31
|
+
mongoose_1.default.connect(`mongodb://${index_1.default.MONGO.USER}:${secrets === null || secrets === void 0 ? void 0 : secrets[constants_1.DynamicValues === null || constants_1.DynamicValues === void 0 ? void 0 : constants_1.DynamicValues.MONGO_PASS]}@${index_1.default.MONGO.HOST}:${index_1.default.MONGO.PORT}/${index_1.default.MONGO.DB_NAME}?directConnection=true&authMechanism=DEFAULT&authSource=${index_1.default.MONGO.DB_NAME}`);
|
|
29
32
|
database = mongoose_1.default.connection;
|
|
30
33
|
database.once('open', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
31
34
|
logger_1.Logger.info(`[Server] connected to MongoDB`, 'connect');
|
|
@@ -47,7 +47,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
47
47
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
48
48
|
exports.EmailHandler = void 0;
|
|
49
49
|
const emailDataSource_1 = require("../dataSource/emailDataSource");
|
|
50
|
-
const
|
|
50
|
+
const HTMLParser = __importStar(require("node-html-parser"));
|
|
51
51
|
const style_1 = require("../constants/style");
|
|
52
52
|
const config_1 = __importDefault(require("../../config"));
|
|
53
53
|
const constants_1 = require("../constants");
|
|
@@ -63,6 +63,7 @@ const dompurify_1 = __importDefault(require("dompurify"));
|
|
|
63
63
|
const jsdom_1 = require("jsdom");
|
|
64
64
|
const logger_1 = require("../../common/util/logger");
|
|
65
65
|
const path_1 = __importDefault(require("path"));
|
|
66
|
+
const __1 = require("../..");
|
|
66
67
|
const window = new jsdom_1.JSDOM('').window;
|
|
67
68
|
const DOMPurify = (0, dompurify_1.default)(window);
|
|
68
69
|
// NOSONAR-NEXT-LINE
|
|
@@ -76,7 +77,8 @@ class EmailHandler {
|
|
|
76
77
|
sendEmail(emailConfig) {
|
|
77
78
|
return __awaiter(this, void 0, void 0, function* () {
|
|
78
79
|
logger_1.Logger.info('EmailHandler: Reached sendEmail method', 'sendEmail');
|
|
79
|
-
|
|
80
|
+
const secrets = yield (0, __1.getIAMSecrets)();
|
|
81
|
+
sgMail.setApiKey(secrets === null || secrets === void 0 ? void 0 : secrets[constants_1.DynamicValues === null || constants_1.DynamicValues === void 0 ? void 0 : constants_1.DynamicValues.SENDGRID_API_KEY]);
|
|
80
82
|
// Build personalization object
|
|
81
83
|
const personalization = {
|
|
82
84
|
to: [{ email: emailConfig.email }],
|
|
@@ -126,7 +128,7 @@ class EmailHandler {
|
|
|
126
128
|
let curentTimeZone = start
|
|
127
129
|
.tz(reqBody.timezoneOffset)
|
|
128
130
|
.format('Do MMMM YYYY, h:mm a');
|
|
129
|
-
const root =
|
|
131
|
+
const root = HTMLParser.parse((_a = response[0]) === null || _a === void 0 ? void 0 : _a.hclplatformx_Body);
|
|
130
132
|
root.querySelector('#1_dynamic_text').textContent = ` ${reqBody.userName}`;
|
|
131
133
|
root.querySelector('#2_dynamic_text').textContent = DOMPurify.sanitize(`<b> ${reqBody.pageTitle} </b>`);
|
|
132
134
|
root.querySelector('#3_dynamic_text').textContent = DOMPurify.sanitize(`<b>${curentTimeZone}</b>`);
|
|
@@ -181,7 +183,7 @@ class EmailHandler {
|
|
|
181
183
|
}
|
|
182
184
|
}
|
|
183
185
|
}
|
|
184
|
-
const root =
|
|
186
|
+
const root = HTMLParser.parse((_c = templateData[0]) === null || _c === void 0 ? void 0 : _c.hclplatformx_Body);
|
|
185
187
|
let emailConfiguration = {
|
|
186
188
|
email: (_d = reqBody.replacement_variables) === null || _d === void 0 ? void 0 : _d.EMAIL,
|
|
187
189
|
emailTemplate: root ? root.toString() : '',
|
|
@@ -227,12 +229,13 @@ class EmailHandler {
|
|
|
227
229
|
sendEmailWithPersonalizations(emailConfig, email_from) {
|
|
228
230
|
return __awaiter(this, void 0, void 0, function* () {
|
|
229
231
|
logger_1.Logger.info(`EmailHandler: Reached sendEmailWithPersonalizations method with emailConfig: ${JSON.stringify(emailConfig)}`, 'sendEmailWithPersonalizations');
|
|
230
|
-
logger_1.Logger.info(`EMAIL_FROM-------> ${email_from}`, '
|
|
232
|
+
logger_1.Logger.info(`EMAIL_FROM-------> ${email_from}`, 'sendEmailWithPersonalizations');
|
|
231
233
|
const Mail = sgHelpers.classes.Mail;
|
|
232
234
|
// let email_from = isCFF ? config?.CFF_MAIL_FROM : config?.EMAIL_FROM;
|
|
233
235
|
logger_1.Logger.info('sendEmailWithPersonalizations : Email From:', JSON.stringify(email_from));
|
|
234
236
|
const Personalization = sgHelpers.classes.Personalization;
|
|
235
|
-
|
|
237
|
+
const secrets = yield (0, __1.getIAMSecrets)();
|
|
238
|
+
sgMail.setApiKey(secrets === null || secrets === void 0 ? void 0 : secrets[constants_1.DynamicValues === null || constants_1.DynamicValues === void 0 ? void 0 : constants_1.DynamicValues.SENDGRID_API_KEY]);
|
|
236
239
|
const mail = new Mail();
|
|
237
240
|
mail.setFrom(email_from);
|
|
238
241
|
mail.setSubject(emailConfig.subject);
|
|
@@ -338,7 +341,7 @@ class EmailHandler {
|
|
|
338
341
|
var _a, _b;
|
|
339
342
|
try {
|
|
340
343
|
let { email_type, replacement_variables, recipients, cc_recipients, isCFF = config_1.default === null || config_1.default === void 0 ? void 0 : config_1.default.EMAIL_FROM } = reqBody;
|
|
341
|
-
logger_1.Logger.info(`EmailHandler: reached in sendPersonalizeEmailRequest with emailType: ${email_type}`, 'sendPersonalizeEmailRequest');
|
|
344
|
+
logger_1.Logger.info(`EmailHandler: reached in sendPersonalizeEmailRequest with emailType: ${email_type} and ${isCFF}`, 'sendPersonalizeEmailRequest');
|
|
342
345
|
// disable SOLR because of connectivity issue
|
|
343
346
|
logger_1.Logger.debug('Reached sendPersonalizeEmailRequest in emailHandler', 'sendPersonalizeEmailRequest');
|
|
344
347
|
let templateData = yield this.fetchEmailTemplateData(reqBody);
|
|
@@ -368,7 +371,8 @@ class EmailHandler {
|
|
|
368
371
|
}
|
|
369
372
|
}
|
|
370
373
|
if (templateData && ((_a = Object.keys(templateData)) === null || _a === void 0 ? void 0 : _a.length) !== 0) {
|
|
371
|
-
const root =
|
|
374
|
+
const root = HTMLParser.parse(templateData === null || templateData === void 0 ? void 0 : templateData.body);
|
|
375
|
+
isCFF = (templateData === null || templateData === void 0 ? void 0 : templateData.email_from) && (templateData === null || templateData === void 0 ? void 0 : templateData.email_from) !== '' ? templateData === null || templateData === void 0 ? void 0 : templateData.email_from : isCFF;
|
|
372
376
|
const emailConfiguration = {
|
|
373
377
|
email: (_b = reqBody.replacement_variables) === null || _b === void 0 ? void 0 : _b.EMAIL,
|
|
374
378
|
emailTemplate: root ? root.toString() : '',
|
|
@@ -407,7 +411,7 @@ class EmailHandler {
|
|
|
407
411
|
const start = moment.tz(reqBody.dateTime, 'UTC'); // original timezone
|
|
408
412
|
start.tz(reqBody.timezoneOffset).format('Do MMMM YYYY, h:mm a');
|
|
409
413
|
let str = yield emailTemplate_1.EmailTemplateHandler.prepareEmailTemplate(reqBody);
|
|
410
|
-
let root =
|
|
414
|
+
let root = HTMLParser.parse(str);
|
|
411
415
|
root.querySelector('#1_dynamic_text').textContent = `${reqBody.userName}`;
|
|
412
416
|
root.querySelector('#2_dynamic_text').textContent = DOMPurify.sanitize(`<b> ${reqBody.total_price} </b>`);
|
|
413
417
|
root.querySelector('#3_dynamic_text').textContent = DOMPurify.sanitize(`<b>${reqBody.currency_code}</b>`);
|
|
@@ -490,7 +494,7 @@ class EmailHandler {
|
|
|
490
494
|
}
|
|
491
495
|
fetchEmailTemplateData(reqBody) {
|
|
492
496
|
return __awaiter(this, void 0, void 0, function* () {
|
|
493
|
-
var _a, _b, _c, _d;
|
|
497
|
+
var _a, _b, _c, _d, _e, _f;
|
|
494
498
|
try {
|
|
495
499
|
logger_1.Logger.info('EmailHandler: Reached fetchEmailTemplateData', 'fetchEmailTemplateData');
|
|
496
500
|
let { email_type } = reqBody;
|
|
@@ -501,12 +505,14 @@ class EmailHandler {
|
|
|
501
505
|
if ((templateSolrRes === null || templateSolrRes === void 0 ? void 0 : templateSolrRes.length) > 0) {
|
|
502
506
|
templateData.body = ((_a = templateSolrRes === null || templateSolrRes === void 0 ? void 0 : templateSolrRes[0]) === null || _a === void 0 ? void 0 : _a.hclplatformx_Body) || '';
|
|
503
507
|
templateData.subject = ((_b = templateSolrRes === null || templateSolrRes === void 0 ? void 0 : templateSolrRes[0]) === null || _b === void 0 ? void 0 : _b.hclplatformx_Subject) || '';
|
|
508
|
+
templateData.email_from = ((_c = templateSolrRes === null || templateSolrRes === void 0 ? void 0 : templateSolrRes[0]) === null || _c === void 0 ? void 0 : _c.hclplatformx_To) || '';
|
|
504
509
|
}
|
|
505
510
|
}
|
|
506
511
|
else {
|
|
507
512
|
let templateRes = yield new formBuilder_dao_1.default().fetch('email_templates', { name: email_type });
|
|
508
|
-
templateData.body = (
|
|
509
|
-
templateData.subject = (
|
|
513
|
+
templateData.body = (_d = templateRes === null || templateRes === void 0 ? void 0 : templateRes[0]) === null || _d === void 0 ? void 0 : _d.body;
|
|
514
|
+
templateData.subject = (_e = templateRes === null || templateRes === void 0 ? void 0 : templateRes[0]) === null || _e === void 0 ? void 0 : _e.subject;
|
|
515
|
+
templateData.email_from = ((_f = templateRes === null || templateRes === void 0 ? void 0 : templateRes[0]) === null || _f === void 0 ? void 0 : _f.to) || '';
|
|
510
516
|
}
|
|
511
517
|
return templateData;
|
|
512
518
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@platform-x/hep-notification-client",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.0",
|
|
4
4
|
"description": "@platform-x/hep-notification-client",
|
|
5
5
|
"main": "dist/src/index.js",
|
|
6
6
|
"types": "dist/src/index.d.ts",
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
"mongodb": "5.9.2",
|
|
50
50
|
"mongoose": "7.0.3",
|
|
51
51
|
"mysql2": "2.3.3",
|
|
52
|
-
"node-html-parser": "5.
|
|
52
|
+
"node-html-parser": "^5.4.2",
|
|
53
53
|
"request-ip": "2.1.3",
|
|
54
54
|
"solr-client": "0.10.0-rc6",
|
|
55
55
|
"twilio": "^5.3.6",
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
{
|
|
2
|
+
"id": "e77aba62-34ba-47a9-acac-2dd708bbe87a",
|
|
3
|
+
"name": "HEP_Environment",
|
|
4
|
+
"values": [
|
|
5
|
+
{
|
|
6
|
+
"key": "devUrl",
|
|
7
|
+
"value": "https://platx-api-dev.fanuep.com/",
|
|
8
|
+
"type": "default",
|
|
9
|
+
"enabled": true
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
"key": "local_reg_url",
|
|
13
|
+
"value": "http://localhost:8090/",
|
|
14
|
+
"type": "default",
|
|
15
|
+
"enabled": true
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
"key": "local_delivery_url",
|
|
19
|
+
"value": "http://localhost:8099/",
|
|
20
|
+
"type": "default",
|
|
21
|
+
"enabled": true
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
"key": "local_gateway_url",
|
|
25
|
+
"value": "http://localhost:8091/",
|
|
26
|
+
"type": "default",
|
|
27
|
+
"enabled": true
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
"key": "dev_reg_url",
|
|
31
|
+
"value": "https://platx-prelem-regs-dev.fanuep.com/",
|
|
32
|
+
"type": "default",
|
|
33
|
+
"enabled": true
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
"key": "local_notification_url",
|
|
37
|
+
"value": "http://localhost:8099/",
|
|
38
|
+
"type": "default",
|
|
39
|
+
"enabled": true
|
|
40
|
+
}
|
|
41
|
+
],
|
|
42
|
+
"_postman_variable_scope": "environment",
|
|
43
|
+
"_postman_exported_at": "2022-11-18T06:40:59.828Z",
|
|
44
|
+
"_postman_exported_using": "Postman/9.19.0"
|
|
45
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
{
|
|
2
|
+
"info": {
|
|
3
|
+
"_postman_id": "84173df2-abc7-4295-9cb7-95c70c4c04c7",
|
|
4
|
+
"name": "hep-notification",
|
|
5
|
+
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
|
|
6
|
+
},
|
|
7
|
+
"item": [
|
|
8
|
+
{
|
|
9
|
+
"name": "publish notification",
|
|
10
|
+
"request": {
|
|
11
|
+
"auth": {
|
|
12
|
+
"type": "basic",
|
|
13
|
+
"basic": [
|
|
14
|
+
{
|
|
15
|
+
"key": "username",
|
|
16
|
+
"value": "dinesh",
|
|
17
|
+
"type": "string"
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
"key": "password",
|
|
21
|
+
"value": "1234567890",
|
|
22
|
+
"type": "string"
|
|
23
|
+
}
|
|
24
|
+
]
|
|
25
|
+
},
|
|
26
|
+
"method": "POST",
|
|
27
|
+
"header": [],
|
|
28
|
+
"body": {
|
|
29
|
+
"mode": "raw",
|
|
30
|
+
"raw": "{\n \"pageTitle\": \"Vod Publish Mail Testing\",\n \"userName\": \"Kapil Patel\",\n \"dateTime\": \"2022-04-26T05:09:40Z\",\n \"timezoneOffset\": \"Asia/Calcutta\",\n \"emailTo\": \"s_sunil@hcl.com\",\n \"eventPageUrl\": \"https://platx-dev.com\",\n \"event\": \"published\",\n \"contentType\": \"Vod\"\n}",
|
|
31
|
+
"options": {
|
|
32
|
+
"raw": {
|
|
33
|
+
"language": "json"
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
"url": {
|
|
38
|
+
"raw": "{{local_notification_url}}platform-x/api/v1/web/en/notifications/send-email/publishunpublishemail",
|
|
39
|
+
"host": [
|
|
40
|
+
"{{local_notification_url}}platform-x"
|
|
41
|
+
],
|
|
42
|
+
"path": [
|
|
43
|
+
"api",
|
|
44
|
+
"v1",
|
|
45
|
+
"web",
|
|
46
|
+
"en",
|
|
47
|
+
"notifications",
|
|
48
|
+
"send-email",
|
|
49
|
+
"publishunpublishemail"
|
|
50
|
+
]
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
"response": []
|
|
54
|
+
}
|
|
55
|
+
]
|
|
56
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
This is test file
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
#! /usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const sgMail = require('@sendgrid/mail');
|
|
4
|
+
sgMail.setApiKey(process.env.SENDGRID_API_KEY);
|
|
5
|
+
|
|
6
|
+
const fs = require('fs'),
|
|
7
|
+
filename = 'api_qa_jmeter.zip',
|
|
8
|
+
fileType = 'application/zip',
|
|
9
|
+
data = fs.readFileSync(filename);
|
|
10
|
+
const msg = {
|
|
11
|
+
to: 'HEP_Team@hcl.com',
|
|
12
|
+
from: 'hepteamhcl@gmail.com',
|
|
13
|
+
subject: 'auto generated test report for performance testing ',
|
|
14
|
+
text: 'Build Artifact Testing',
|
|
15
|
+
html: '<p>Hi Team,<br> Please find below the auto generated load testing report by Jmeter </br> <br> Thanks </br> <br> DevOps Team </br> </p>',
|
|
16
|
+
attachments: [
|
|
17
|
+
{
|
|
18
|
+
content: data.toString('base64'),
|
|
19
|
+
filename: filename,
|
|
20
|
+
type: fileType,
|
|
21
|
+
disposition: 'attachment',
|
|
22
|
+
},
|
|
23
|
+
// {
|
|
24
|
+
// content: data2.toString('base64'),
|
|
25
|
+
// filename: filename2,
|
|
26
|
+
// type: fileType2,
|
|
27
|
+
// disposition: 'attachment',
|
|
28
|
+
// },
|
|
29
|
+
],
|
|
30
|
+
};
|
|
31
|
+
sgMail
|
|
32
|
+
.send(msg)
|
|
33
|
+
.then(() => console.log('Mail sent successfully'))
|
|
34
|
+
.catch((error) => console.error(error.toString()));
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
#! /usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const sgMail = require('@sendgrid/mail');
|
|
4
|
+
sgMail.setApiKey(process.env.SENDGRID_API_KEY);
|
|
5
|
+
|
|
6
|
+
const fs = require('fs'),
|
|
7
|
+
filename = 'api_qa_newman.zip',
|
|
8
|
+
fileType = 'application/zip',
|
|
9
|
+
data = fs.readFileSync(filename);
|
|
10
|
+
|
|
11
|
+
// const filename2 = 'sonarsast.html',
|
|
12
|
+
// fileType2 = 'application/html',
|
|
13
|
+
// data2 = fs.readFileSync( filename2);
|
|
14
|
+
|
|
15
|
+
const msg = {
|
|
16
|
+
to: 'HEP_Team@hcl.com',
|
|
17
|
+
from: 'hepteamhcl@gmail.com',
|
|
18
|
+
subject: 'Auto generated Test Reports for API Testing',
|
|
19
|
+
text: 'Build Artifact Testing',
|
|
20
|
+
html: '<p>Hi Team,<br> Please find below the auto generated test reports for api testing </br> <br> Thanks </br> <br> DevOps Team </br> </p>',
|
|
21
|
+
attachments: [
|
|
22
|
+
{
|
|
23
|
+
content: data.toString('base64'),
|
|
24
|
+
filename: filename,
|
|
25
|
+
type: fileType,
|
|
26
|
+
disposition: 'attachment',
|
|
27
|
+
},
|
|
28
|
+
// {
|
|
29
|
+
// content: data2.toString('base64'),
|
|
30
|
+
// filename: filename2,
|
|
31
|
+
// type: fileType2,
|
|
32
|
+
// disposition: 'attachment',
|
|
33
|
+
// },
|
|
34
|
+
],
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
sgMail
|
|
38
|
+
.send(msg)
|
|
39
|
+
.then(() => console.log('Mail sent successfully'))
|
|
40
|
+
.catch(error => console.error(error.toString()));
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
#! /usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const sgMail = require('@sendgrid/mail');
|
|
4
|
+
sgMail.setApiKey(process.env.SENDGRID_API_KEY);
|
|
5
|
+
|
|
6
|
+
const fs = require('fs'),
|
|
7
|
+
filename = 'sonarsast.html',
|
|
8
|
+
fileType = 'application/html',
|
|
9
|
+
data = fs.readFileSync(filename);
|
|
10
|
+
|
|
11
|
+
// const filename2 = 'sonarsast.html',
|
|
12
|
+
// fileType2 = 'application/html',
|
|
13
|
+
// data2 = fs.readFileSync( filename2);
|
|
14
|
+
|
|
15
|
+
const msg = {
|
|
16
|
+
to: 'HEP_Team@hcl.com',
|
|
17
|
+
from: 'hepteamhcl@gmail.com',
|
|
18
|
+
subject: 'Auto generated Test Reports for API Testing',
|
|
19
|
+
text: 'Build Artifact Testing',
|
|
20
|
+
html: '<p>Hi Team,<br> Please find below the auto generated test reports for api testing </br> <br> Thanks </br> <br> DevOps Team </br> </p>',
|
|
21
|
+
attachments: [
|
|
22
|
+
{
|
|
23
|
+
content: data.toString('base64'),
|
|
24
|
+
filename: filename,
|
|
25
|
+
type: fileType,
|
|
26
|
+
disposition: 'attachment',
|
|
27
|
+
},
|
|
28
|
+
// {
|
|
29
|
+
// content: data2.toString('base64'),
|
|
30
|
+
// filename: filename2,
|
|
31
|
+
// type: fileType2,
|
|
32
|
+
// disposition: 'attachment',
|
|
33
|
+
// },
|
|
34
|
+
],
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
sgMail
|
|
38
|
+
.send(msg)
|
|
39
|
+
.then(() => console.log('Mail sent successfully'))
|
|
40
|
+
.catch(error => console.error(error.toString()));
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
#! /usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const sgMail = require('@sendgrid/mail');
|
|
4
|
+
sgMail.setApiKey(process.env.SENDGRID_API_KEY);
|
|
5
|
+
|
|
6
|
+
const fs = require('fs'),
|
|
7
|
+
filename = 'api_qa_trivy.zip',
|
|
8
|
+
fileType = 'application/zip',
|
|
9
|
+
data = fs.readFileSync(filename);
|
|
10
|
+
|
|
11
|
+
// const filename2 = 'sonarsast.html',
|
|
12
|
+
// fileType2 = 'application/html',
|
|
13
|
+
// data2 = fs.readFileSync( filename2);
|
|
14
|
+
|
|
15
|
+
const msg = {
|
|
16
|
+
to: 'HEP_Team@hcl.com',
|
|
17
|
+
from: 'hepteamhcl@gmail.com',
|
|
18
|
+
subject: 'auto generated vulnerability scanner report ',
|
|
19
|
+
text: 'Build Artifact Testing',
|
|
20
|
+
html: '<p>Hi Team,<br> Please find below the auto generated vulnerability scan report by trivy </br> <br> Thanks </br> <br> DevOps Team </br> </p>',
|
|
21
|
+
attachments: [
|
|
22
|
+
{
|
|
23
|
+
content: data.toString('base64'),
|
|
24
|
+
filename: filename,
|
|
25
|
+
type: fileType,
|
|
26
|
+
disposition: 'attachment',
|
|
27
|
+
},
|
|
28
|
+
// {
|
|
29
|
+
// content: data2.toString('base64'),
|
|
30
|
+
// filename: filename2,
|
|
31
|
+
// type: fileType2,
|
|
32
|
+
// disposition: 'attachment',
|
|
33
|
+
// },
|
|
34
|
+
],
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
sgMail
|
|
38
|
+
.send(msg)
|
|
39
|
+
.then(() => console.log('Mail sent successfully'))
|
|
40
|
+
.catch(error => console.error(error.toString()));
|