@platform-x/hep-notification-client 1.3.0 → 1.3.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.
- package/README.md +7 -7
- package/dist/jest-setup.js +28 -0
- package/dist/jest-setup.js.map +1 -0
- package/dist/src/common/controllers/common_controller.js +72 -0
- package/dist/src/common/controllers/common_controller.js.map +1 -0
- package/dist/src/common/controllers/index.js +29 -0
- package/dist/src/common/controllers/index.js.map +1 -0
- package/dist/src/common/middleware/commonMiddleware.js +141 -0
- package/dist/src/common/middleware/commonMiddleware.js.map +1 -0
- package/dist/src/common/service/requestService.js +79 -1
- package/dist/src/common/service/requestService.js.map +1 -0
- package/dist/src/common/service/twilioService.js +3 -11
- package/dist/src/common/service/twilioService.js.map +1 -0
- package/dist/src/common/util/commonUtil.js +119 -1
- package/dist/src/common/util/commonUtil.js.map +1 -0
- package/dist/src/common/util/constants.js +18 -0
- package/dist/src/common/util/constants.js.map +1 -0
- package/dist/src/common/util/errorHandler.js +4 -6
- package/dist/src/common/util/errorHandler.js.map +1 -0
- package/dist/src/common/util/httpCodes.js +26 -0
- package/dist/src/common/util/httpCodes.js.map +1 -0
- package/dist/src/common/util/logger.js +1 -1
- package/dist/src/common/util/logger.js.map +1 -0
- package/dist/src/common/util/requestTracer.js +18 -1
- package/dist/src/common/util/requestTracer.js.map +1 -0
- package/dist/src/common/util/solrConnector.js.map +1 -0
- package/dist/src/config/index.js +49 -4
- package/dist/src/config/index.js.map +1 -0
- package/dist/src/platform-x/app.js +35 -0
- package/dist/src/platform-x/app.js.map +1 -0
- package/dist/src/platform-x/constants/index.js +2 -14
- package/dist/src/platform-x/constants/index.js.map +1 -0
- package/dist/src/platform-x/constants/style.js +98 -98
- package/dist/src/platform-x/constants/style.js.map +1 -0
- package/dist/src/platform-x/controllers/cronController.js +399 -0
- package/dist/src/platform-x/controllers/cronController.js.map +1 -0
- package/dist/src/platform-x/controllers/fileUploadController.js +76 -0
- package/dist/src/platform-x/controllers/fileUploadController.js.map +1 -0
- package/dist/src/platform-x/controllers/graphRESTControllers.js +183 -0
- package/dist/src/platform-x/controllers/graphRESTControllers.js.map +1 -0
- package/dist/src/platform-x/controllers/index.js +30 -0
- package/dist/src/platform-x/controllers/index.js.map +1 -0
- package/dist/src/platform-x/controllers/siteDomainController.js +74 -0
- package/dist/src/platform-x/controllers/siteDomainController.js.map +1 -0
- package/dist/src/platform-x/dataSource/emailDataSource.js.map +1 -0
- package/dist/src/platform-x/database/connection.js +3 -6
- package/dist/src/platform-x/database/connection.js.map +1 -0
- package/dist/src/platform-x/database/dao/formBuilder.dao.js +1 -1
- package/dist/src/platform-x/database/dao/formBuilder.dao.js.map +1 -0
- package/dist/src/platform-x/database/dao/siteDomain.dao.js +73 -0
- package/dist/src/platform-x/database/dao/siteDomain.dao.js.map +1 -0
- package/dist/src/platform-x/database/index.js.map +1 -0
- package/dist/src/platform-x/{interface/interface.js → database/interfaces/site_domain.interface.js} +1 -1
- package/dist/src/platform-x/database/interfaces/site_domain.interface.js.map +1 -0
- package/dist/src/platform-x/database/models/formBuilder.model.js.map +1 -0
- package/dist/src/platform-x/database/models/site_domains.model.js +51 -0
- package/dist/src/platform-x/database/models/site_domains.model.js.map +1 -0
- package/dist/src/platform-x/routes/index.js +19 -0
- package/dist/src/platform-x/routes/index.js.map +1 -0
- package/dist/src/platform-x/services/cron.services.js +117 -0
- package/dist/src/platform-x/services/cron.services.js.map +1 -0
- package/dist/src/platform-x/util/emailHandler.js +53 -137
- package/dist/src/platform-x/util/emailHandler.js.map +1 -0
- package/dist/src/platform-x/util/emailTemplate.js +63 -60
- package/dist/src/platform-x/util/emailTemplate.js.map +1 -0
- package/dist/src/platform-x/util/solr-data-source/SolrHttpDataSource.js +2 -0
- package/dist/src/platform-x/util/solr-data-source/SolrHttpDataSource.js.map +1 -0
- package/dist/src/server.js +38 -0
- package/dist/src/server.js.map +1 -0
- package/dist/swagger.json +247 -0
- package/dist/test/controllers/common_controller.spec.js +79 -0
- package/dist/test/controllers/common_controller.spec.js.map +1 -0
- package/dist/test/middleware/commonMiddleware.spec.js +88 -0
- package/dist/test/middleware/commonMiddleware.spec.js.map +1 -0
- package/dist/test/platform-x/controllers/graphRESTControllers.spec.js +195 -0
- package/dist/test/platform-x/controllers/graphRESTControllers.spec.js.map +1 -0
- package/dist/test/platform-x/datasource/emailDataSource.spec.js +81 -0
- package/dist/test/platform-x/datasource/emailDataSource.spec.js.map +1 -0
- package/dist/test/platform-x/util/emailHandler.spec.js +474 -0
- package/dist/test/platform-x/util/emailHandler.spec.js.map +1 -0
- package/dist/test/platform-x/util/solr-data-source/SolrHttpDataSource.spec.js +80 -0
- package/dist/test/platform-x/util/solr-data-source/SolrHttpDataSource.spec.js.map +1 -0
- package/dist/test/services/requestService.spec.js +108 -0
- package/dist/test/services/requestService.spec.js.map +1 -0
- package/dist/test/services/requestServiceGet.spec.js +43 -0
- package/dist/test/services/requestServiceGet.spec.js.map +1 -0
- package/dist/test/src/common/service/twilioService.spec.js +65 -0
- package/dist/test/src/common/service/twilioService.spec.js.map +1 -0
- package/dist/test/util/commonUtil.spec.js +110 -0
- package/dist/test/util/commonUtil.spec.js.map +1 -0
- package/dist/test/util/logger.spec.js +51 -0
- package/dist/test/util/logger.spec.js.map +1 -0
- package/dist/test/util/requestTracer.spec.js +64 -0
- package/dist/test/util/requestTracer.spec.js.map +1 -0
- package/dist/test/util/solrconnector.spec.js +145 -0
- package/dist/test/util/solrconnector.spec.js.map +1 -0
- package/package.json +66 -62
- package/postman_collection/HEP_Environment.postman_environment.json +44 -44
- package/postman_collection/hep-notification.postman_collection.json +55 -55
- package/reports/output.jtl +1 -1
- package/reports/scripts/jmeter_sendgrid.js +34 -34
- package/reports/scripts/newman_sendgrid.js +40 -40
- package/reports/scripts/sendgrid.js +40 -40
- package/reports/scripts/trivy_sendgrid.js +40 -40
- package/src/common/service/requestService.ts +87 -0
- package/{dist/src/common/service/secretKeyManager.services.js → src/common/service/secretKeyManager.services.ts} +1 -2
- package/src/common/service/twilioService.ts +58 -0
- package/src/common/util/commonUtil.ts +39 -0
- package/src/common/util/errorHandler.ts +120 -0
- package/src/common/util/logger.ts +215 -0
- package/src/common/util/requestTracer.ts +10 -0
- package/src/common/util/solrConnector.ts +319 -0
- package/src/config/index.ts +35 -0
- package/src/index.ts +34 -0
- package/src/platform-x/constants/index.ts +20 -0
- package/src/platform-x/constants/style.ts +99 -0
- package/src/platform-x/dataSource/emailDataSource.ts +34 -0
- package/src/platform-x/database/connection.ts +47 -0
- package/src/platform-x/database/dao/formBuilder.dao.ts +33 -0
- package/src/platform-x/database/index.ts +7 -0
- package/src/platform-x/database/models/formBuilder.model.ts +23 -0
- package/src/platform-x/util/emailHandler.ts +580 -0
- package/src/platform-x/util/emailTemplate.ts +66 -0
- package/src/platform-x/util/solr-data-source/SolrHttpDataSource.ts +97 -0
- package/{dist → src}/templates/orderPlaced.ejs +172 -172
- package/{dist → src}/templates/orderPlaced.html +189 -189
- package/tsconfig.json +73 -0
- package/dist/src/common/service/requestService.d.ts +0 -26
- package/dist/src/common/service/secretKeyManager.services.d.ts +0 -0
- package/dist/src/common/service/twilioService.d.ts +0 -19
- package/dist/src/common/util/commonUtil.d.ts +0 -22
- package/dist/src/common/util/errorHandler.d.ts +0 -44
- package/dist/src/common/util/logger.d.ts +0 -68
- package/dist/src/common/util/requestTracer.d.ts +0 -2
- package/dist/src/common/util/secretKeyManager.d.ts +0 -7
- package/dist/src/common/util/secretKeyManager.js +0 -58
- package/dist/src/common/util/solrConnector.d.ts +0 -35
- package/dist/src/config/index.d.ts +0 -30
- package/dist/src/index.d.ts +0 -5
- package/dist/src/index.js +0 -20
- package/dist/src/platform-x/constants/index.d.ts +0 -18
- package/dist/src/platform-x/constants/style.d.ts +0 -1
- package/dist/src/platform-x/dataSource/emailDataSource.d.ts +0 -5
- package/dist/src/platform-x/database/connection.d.ts +0 -8
- package/dist/src/platform-x/database/dao/formBuilder.dao.d.ts +0 -9
- package/dist/src/platform-x/database/index.d.ts +0 -7
- package/dist/src/platform-x/database/models/formBuilder.model.d.ts +0 -34
- package/dist/src/platform-x/interface/interface.d.ts +0 -4
- package/dist/src/platform-x/util/emailHandler.d.ts +0 -62
- package/dist/src/platform-x/util/emailTemplate.d.ts +0 -4
- package/dist/src/platform-x/util/solr-data-source/SolrHttpDataSource.d.ts +0 -26
package/README.md
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
#@platform-x/hep-notification-client
|
|
2
|
-
Provide module to send email to the users.
|
|
3
|
-
|
|
4
|
-
How to install and use
|
|
5
|
-
|
|
6
|
-
npm install @platform-x/hep-notification-client
|
|
7
|
-
|
|
1
|
+
#@platform-x/hep-notification-client
|
|
2
|
+
Provide module to send email to the users.
|
|
3
|
+
|
|
4
|
+
How to install and use
|
|
5
|
+
|
|
6
|
+
npm install @platform-x/hep-notification-client
|
|
7
|
+
|
|
8
8
|
import the modules and implement.
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
require('ts-node/register');
|
|
4
|
+
const setup = () => {
|
|
5
|
+
// setup globally for tests
|
|
6
|
+
process.env.PORT = "8090";
|
|
7
|
+
process.env.AUTHPROVIDER = "keycloak";
|
|
8
|
+
process.env.AUTH_ISSUER_URL = "https://keycloak.fanuep.com";
|
|
9
|
+
process.env.AUTH_TENANTS_INFO = "W3sidGVuYW50IjoicGxhdGZvcm0teCIsImNsaWVudHMiOlt7ImNsaWVudF9pZCI6InJlYWN0IiwiY2xpZW50X3NlY3JldCI6ImE4ZDliZjFlLTk2MjEtNGRhMC05ZjIzLWE1ZjYyMjcyZDZjMCJ9XX0seyJ0ZW5hbnQiOiJhbmdsby1hbWVyaWNhIiwiY2xpZW50cyI6W3siY2xpZW50X2lkIjoiYW5nbG8tZWR1Y2F0aW9uLXdlYiIsImNsaWVudF9zZWNyZXQiOiI5OTM3ODZlNS05OWZiLTRiMmItYTM3OS00OTgwOWQwNDM5ODkifV19XQ==";
|
|
10
|
+
process.env.LOG_LEVELS = "error, info";
|
|
11
|
+
process.env.npm_package_name = "platform-x";
|
|
12
|
+
process.env.NODE_ENV = "dev";
|
|
13
|
+
process.env.CORS_ORIGIN = "*";
|
|
14
|
+
process.env.CORS_CREDENTIALS = "true";
|
|
15
|
+
process.env.COOKIE_SECRET = "asdd";
|
|
16
|
+
process.env.COOKIE_SECURE = "false";
|
|
17
|
+
process.env.COOKIE_HTTP_ONLY = "false";
|
|
18
|
+
process.env.COOKIE_SAME_SITE = "none";
|
|
19
|
+
process.env.COOKIE_PATH = "/";
|
|
20
|
+
process.env.COOKIE_MAXAGE = "34000";
|
|
21
|
+
process.env.AUTH_ADMIN_USERNAME = "dsdsda";
|
|
22
|
+
process.env.AUTH_ADMIN_PASS = "asdsd";
|
|
23
|
+
process.env.REDIS_HOST = 'asddsd';
|
|
24
|
+
process.env.REDIS_PORT = "asd";
|
|
25
|
+
process.env.REDIS_PASS = "asd";
|
|
26
|
+
};
|
|
27
|
+
exports.default = setup;
|
|
28
|
+
//# sourceMappingURL=jest-setup.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jest-setup.js","sourceRoot":"","sources":["../jest-setup.ts"],"names":[],"mappings":";;AAAA,OAAO,CAAC,kBAAkB,CAAC,CAAC;AAE5B,MAAM,KAAK,GAAG,GAAS,EAAE;IACvB,2BAA2B;IAC3B,OAAO,CAAC,GAAG,CAAC,IAAI,GAAC,MAAM,CAAC;IACxB,OAAO,CAAC,GAAG,CAAC,YAAY,GAAC,UAAU,CAAC;IACpC,OAAO,CAAC,GAAG,CAAC,eAAe,GAAC,6BAA6B,CAAC;IAC1D,OAAO,CAAC,GAAG,CAAC,iBAAiB,GAAC,0UAA0U,CAAC;IACzW,OAAO,CAAC,GAAG,CAAC,UAAU,GAAC,aAAa,CAAC;IACrC,OAAO,CAAC,GAAG,CAAC,gBAAgB,GAAC,YAAY,CAAC;IAC1C,OAAO,CAAC,GAAG,CAAC,QAAQ,GAAC,KAAK,CAAC;IAC3B,OAAO,CAAC,GAAG,CAAC,WAAW,GAAC,GAAG,CAAC;IAC5B,OAAO,CAAC,GAAG,CAAC,gBAAgB,GAAC,MAAM,CAAC;IACpC,OAAO,CAAC,GAAG,CAAC,aAAa,GAAC,MAAM,CAAC;IACjC,OAAO,CAAC,GAAG,CAAC,aAAa,GAAC,OAAO,CAAC;IAClC,OAAO,CAAC,GAAG,CAAC,gBAAgB,GAAC,OAAO,CAAC;IACrC,OAAO,CAAC,GAAG,CAAC,gBAAgB,GAAC,MAAM,CAAC;IACpC,OAAO,CAAC,GAAG,CAAC,WAAW,GAAC,GAAG,CAAC;IAC5B,OAAO,CAAC,GAAG,CAAC,aAAa,GAAC,OAAO,CAAC;IAClC,OAAO,CAAC,GAAG,CAAC,mBAAmB,GAAC,QAAQ,CAAC;IACzC,OAAO,CAAC,GAAG,CAAC,eAAe,GAAC,OAAO,CAAC;IACpC,OAAO,CAAC,GAAG,CAAC,UAAU,GAAC,QAAQ,CAAC;IAChC,OAAO,CAAC,GAAG,CAAC,UAAU,GAAC,KAAK,CAAC;IAC7B,OAAO,CAAC,GAAG,CAAC,UAAU,GAAC,KAAK,CAAC;AAE/B,CAAC,CAAC;AAEF,kBAAe,KAAK,CAAC"}
|
|
@@ -0,0 +1,72 @@
|
|
|
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.healthCheck = void 0;
|
|
16
|
+
const commonUtil_1 = require("../util/commonUtil");
|
|
17
|
+
const logger_1 = require("../util/logger");
|
|
18
|
+
const index_1 = __importDefault(require("../../config/index"));
|
|
19
|
+
const requestService_1 = require("../service/requestService");
|
|
20
|
+
const httpHandler = new requestService_1.HttpRequestHandler();
|
|
21
|
+
/**
|
|
22
|
+
* healthCheckHelper helper fn for health check
|
|
23
|
+
* @param url
|
|
24
|
+
* @returns
|
|
25
|
+
*/
|
|
26
|
+
const healthCheckHelper = (url) => __awaiter(void 0, void 0, void 0, function* () {
|
|
27
|
+
logger_1.Logger.info('Reached Health check helper', 'healthCheckHelper');
|
|
28
|
+
logger_1.Logger.debug('Reached Health check helper', 'healthCheckHelper', url);
|
|
29
|
+
let response = yield httpHandler.get({ url })
|
|
30
|
+
.catch((err) => {
|
|
31
|
+
logger_1.Logger.error(`CommonController: Error from healthCheck url- ${url}`, 'healthCheckHelper', err);
|
|
32
|
+
return {
|
|
33
|
+
error: err,
|
|
34
|
+
};
|
|
35
|
+
});
|
|
36
|
+
logger_1.Logger.debug('After receiving HTTP response END', 'healthCheckHelper', response);
|
|
37
|
+
if (!response.error) {
|
|
38
|
+
response = {
|
|
39
|
+
status: 'ok',
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
return response;
|
|
43
|
+
});
|
|
44
|
+
/**
|
|
45
|
+
* healthCheck - to check health of srvices
|
|
46
|
+
* @param {Request} req- express http request
|
|
47
|
+
* @param {Response} res- express http response
|
|
48
|
+
* @return {Response} success or error response
|
|
49
|
+
*/
|
|
50
|
+
const healthCheck = (req, res) => __awaiter(void 0, void 0, void 0, function* () {
|
|
51
|
+
logger_1.Logger.info('CommonController: Reached healthcheck', 'healthCheck');
|
|
52
|
+
try {
|
|
53
|
+
const solrService = `http://${index_1.default.SOLR.HOST}:${index_1.default.SOLR.PORT}${index_1.default.SOLR.PATH}`;
|
|
54
|
+
logger_1.Logger.debug('Before calling healthCheckHelper', 'healthCheck', { solrService: solrService });
|
|
55
|
+
let solrRes = yield healthCheckHelper(solrService);
|
|
56
|
+
let response = {
|
|
57
|
+
status: 200,
|
|
58
|
+
ok: (!solrRes.error),
|
|
59
|
+
services: {
|
|
60
|
+
solrRes,
|
|
61
|
+
},
|
|
62
|
+
};
|
|
63
|
+
logger_1.Logger.debug('Reached Health check END', 'healthCheck', response);
|
|
64
|
+
(0, commonUtil_1.handleResponse)(res, response, null);
|
|
65
|
+
}
|
|
66
|
+
catch (err) {
|
|
67
|
+
logger_1.Logger.error('CommonController: Error in healthCheck', 'healthCheck', err);
|
|
68
|
+
(0, commonUtil_1.handleResponse)(res, null, err, err.code);
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
exports.healthCheck = healthCheck;
|
|
72
|
+
//# sourceMappingURL=common_controller.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"common_controller.js","sourceRoot":"","sources":["../../../../src/common/controllers/common_controller.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AACA,mDAAoD;AACpD,2CAAwC;AACxC,+DAAwC;AACxC,8DAA+D;AAE/D,MAAM,WAAW,GAAG,IAAI,mCAAkB,EAAE,CAAC;AAC7C;;;;GAIG;AACH,MAAM,iBAAiB,GAAG,CAAO,GAAW,EAAE,EAAE;IAC5C,eAAM,CAAC,IAAI,CAAC,6BAA6B,EAAE,mBAAmB,CAAC,CAAC;IAChE,eAAM,CAAC,KAAK,CAAC,6BAA6B,EAAC,mBAAmB,EAAE,GAAG,CAAC,CAAC;IACrE,IAAI,QAAQ,GAAG,MAAM,WAAW,CAAC,GAAG,CAAC,EAAE,GAAG,EAAE,CAAC;SACxC,KAAK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wC,EAAE,aAAa,EAAE,GAAG,CAAC,CAAC;QAC3E,IAAA,2BAAc,EAAC,GAAG,EAAE,IAAI,EAAE,GAAG,EAAE,GAAG,CAAC,IAAI,CAAC,CAAC;KAC5C;AACL,CAAC,CAAA,CAAC;AAnBW,QAAA,WAAW,eAmBtB"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.CommonController = void 0;
|
|
27
|
+
const CommonController = __importStar(require("./common_controller"));
|
|
28
|
+
exports.CommonController = CommonController;
|
|
29
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/common/controllers/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AACA,sEAAwD;AAGpD,4CAAgB"}
|
|
@@ -0,0 +1,141 @@
|
|
|
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.initRoutesMiddlewares = exports.initCommonMiddlewares = exports.traceIdHeaderMiddleware = exports.graphHeaderTypeMiddleware = exports.traceMiddleware = void 0;
|
|
16
|
+
const index_1 = __importDefault(require("../../config/index"));
|
|
17
|
+
const requestTracer_1 = require("../util/requestTracer");
|
|
18
|
+
const helmet_1 = __importDefault(require("helmet"));
|
|
19
|
+
const cors_1 = __importDefault(require("cors"));
|
|
20
|
+
const express_1 = __importDefault(require("express"));
|
|
21
|
+
const swagger_ui_express_1 = __importDefault(require("swagger-ui-express"));
|
|
22
|
+
const swagger_json_1 = __importDefault(require("../../../swagger.json"));
|
|
23
|
+
const commonUtil_1 = require("../util/commonUtil");
|
|
24
|
+
const logger_1 = require("../util/logger");
|
|
25
|
+
const controllers_1 = require("../controllers");
|
|
26
|
+
const requestIp = require('request-ip');
|
|
27
|
+
/**
|
|
28
|
+
* traceMiddleware - middleware to add spanid and traceid into requests
|
|
29
|
+
*/
|
|
30
|
+
exports.traceMiddleware = requestTracer_1.setTracers;
|
|
31
|
+
/**
|
|
32
|
+
* for adding support for application/graphql for CDN caching
|
|
33
|
+
* @param req
|
|
34
|
+
* @param res
|
|
35
|
+
* @param next
|
|
36
|
+
*/
|
|
37
|
+
const graphHeaderTypeMiddleware = (req, res, next) => {
|
|
38
|
+
if (req.is('application/graphql')) {
|
|
39
|
+
req.headers['content-type'] = 'application/json';
|
|
40
|
+
req.body = {
|
|
41
|
+
query: req.body,
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
next();
|
|
45
|
+
};
|
|
46
|
+
exports.graphHeaderTypeMiddleware = graphHeaderTypeMiddleware;
|
|
47
|
+
/**
|
|
48
|
+
* traceIdHeaderMiddleware- to add x-traceid in response for tracking
|
|
49
|
+
* @param req
|
|
50
|
+
* @param res
|
|
51
|
+
* @param next
|
|
52
|
+
*/
|
|
53
|
+
const traceIdHeaderMiddleware = (req, res, next) => {
|
|
54
|
+
const traceId = (0, requestTracer_1.getTraceId)();
|
|
55
|
+
if (traceId) {
|
|
56
|
+
res.setHeader('X-Trace-Id', (0, requestTracer_1.getTraceId)());
|
|
57
|
+
}
|
|
58
|
+
next();
|
|
59
|
+
};
|
|
60
|
+
exports.traceIdHeaderMiddleware = traceIdHeaderMiddleware;
|
|
61
|
+
/**
|
|
62
|
+
* to init common middlewares
|
|
63
|
+
* @param app
|
|
64
|
+
* @returns
|
|
65
|
+
*/
|
|
66
|
+
const initCommonMiddlewares = (app) => __awaiter(void 0, void 0, void 0, function* () {
|
|
67
|
+
logger_1.Logger.info('commonMiddleware: Reached initCommonMiddlewares', 'initCommonMiddlewares');
|
|
68
|
+
const corsOptions = {
|
|
69
|
+
origin: index_1.default.CORS.ORIGIN,
|
|
70
|
+
credentials: index_1.default.CORS.CREDENTIALS,
|
|
71
|
+
optionsSuccessStatus: 200, // some legacy browsers (IE11, various SmartTVs) choke on 204
|
|
72
|
+
};
|
|
73
|
+
logger_1.Logger.debug('Before setting up trust proxy', 'initCommonMiddlewares', { corsOptions });
|
|
74
|
+
app.use((req, res, next) => {
|
|
75
|
+
if (req.headers.x_forwarded_proto) {
|
|
76
|
+
req.headers['x-forwarded-proto'] = req.headers.x_forwarded_proto;
|
|
77
|
+
}
|
|
78
|
+
next();
|
|
79
|
+
});
|
|
80
|
+
app.set('trust proxy', 1);
|
|
81
|
+
app.use(requestIp.mw());
|
|
82
|
+
app.use((0, helmet_1.default)());
|
|
83
|
+
// Add Helmet middleware to set security headers, including Content-Security-Policy
|
|
84
|
+
app.use(helmet_1.default.contentSecurityPolicy({
|
|
85
|
+
directives: {
|
|
86
|
+
defaultSrc: ["'self'"],
|
|
87
|
+
scriptSrc: ["'self'"],
|
|
88
|
+
styleSrc: ["'self'"],
|
|
89
|
+
objectSrc: ["'none'"],
|
|
90
|
+
imgSrc: ["'self'"],
|
|
91
|
+
connectSrc: ["'self'"],
|
|
92
|
+
fontSrc: ["'self'"],
|
|
93
|
+
frameSrc: ["'none'"],
|
|
94
|
+
upgradeInsecureRequests: [], // Optional: auto-upgrade HTTP to HTTPS
|
|
95
|
+
},
|
|
96
|
+
}));
|
|
97
|
+
// Add the Referrer Policy header using Helmet
|
|
98
|
+
app.use(helmet_1.default.referrerPolicy({ policy: 'strict-origin-when-cross-origin' }));
|
|
99
|
+
// Prevent MIME Type Sniffing
|
|
100
|
+
app.use(helmet_1.default.noSniff());
|
|
101
|
+
// Prevent Clickjacking (X-Frame-Options)
|
|
102
|
+
app.use(helmet_1.default.frameguard({ action: 'sameorigin' }));
|
|
103
|
+
// Feature-Policy
|
|
104
|
+
app.use(helmet_1.default.permittedCrossDomainPolicies({
|
|
105
|
+
permittedPolicies: 'none', // Correct property name //master-only, by-content-type, all
|
|
106
|
+
}));
|
|
107
|
+
// Enable XSS Protection (X-XSS-Protection)
|
|
108
|
+
app.use(helmet_1.default.xssFilter());
|
|
109
|
+
// Cross-Origin Resource Policy
|
|
110
|
+
app.use(helmet_1.default.crossOriginResourcePolicy({ policy: 'same-origin' }));
|
|
111
|
+
app.use((0, cors_1.default)(corsOptions));
|
|
112
|
+
app.use(express_1.default.json());
|
|
113
|
+
app.use(exports.traceMiddleware);
|
|
114
|
+
app.use(exports.traceIdHeaderMiddleware);
|
|
115
|
+
app.use('/api-docs', swagger_ui_express_1.default.serve, swagger_ui_express_1.default.setup(swagger_json_1.default));
|
|
116
|
+
return app;
|
|
117
|
+
});
|
|
118
|
+
exports.initCommonMiddlewares = initCommonMiddlewares;
|
|
119
|
+
/**
|
|
120
|
+
* to init all route relates middlewares
|
|
121
|
+
* @param app
|
|
122
|
+
* @returns
|
|
123
|
+
*/
|
|
124
|
+
const initRoutesMiddlewares = (app) => __awaiter(void 0, void 0, void 0, function* () {
|
|
125
|
+
app.get('/', (req, res) => {
|
|
126
|
+
logger_1.Logger.info('Reached gateway-updated apm', 'initRoutesMiddlewares');
|
|
127
|
+
res.send(`<h1>Hep prelem notification service </h1>`);
|
|
128
|
+
});
|
|
129
|
+
app.get('/healthz', controllers_1.CommonController.healthCheck);
|
|
130
|
+
app.use(function (req, res) {
|
|
131
|
+
res.status(404).send('404 not Found!!!');
|
|
132
|
+
});
|
|
133
|
+
// unhandled error exception handling to be implemented
|
|
134
|
+
// should be last middleware always
|
|
135
|
+
app.use(function (err, req, res, next) {
|
|
136
|
+
(0, commonUtil_1.handleResponse)(res, null, err, 500 /* HTTP_STATUS_CODE.INTERNAL_SERVER_ERROR */);
|
|
137
|
+
});
|
|
138
|
+
return app;
|
|
139
|
+
});
|
|
140
|
+
exports.initRoutesMiddlewares = initRoutesMiddlewares;
|
|
141
|
+
//# sourceMappingURL=commonMiddleware.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"commonMiddleware.js","sourceRoot":"","sources":["../../../../src/common/middleware/commonMiddleware.ts"],"names":[],"mapp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AAW,CAAC,CAAC;IAClD,GAAG,CAAC,GAAG,CAAC,UAAU,GAAY,EAAE,GAAa;QAC3C,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAC;IAC3C,CAAC,CAAC,CAAC;IAEH,uDAAuD;IACvD,mCAAmC;IACnC,GAAG,CAAC,GAAG,CAAC,UAAU,GAAQ,EAAE,GAAY,EAAE,GAAa,EAAE,IAAkB;QACzE,IAAA,2BAAc,EAAC,GAAG,EAAE,IAAI,EAAE,GAAG,mDAAyC,CAAC;IACzE,CAAC,CAAC,CAAC;IACH,OAAO,GAAG,CAAC;AACb,CAAC,CAAA,CAAC;AAhBW,QAAA,qBAAqB,yBAgBhC"}
|
|
@@ -15,9 +15,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
15
15
|
exports.HttpRequestHandler = void 0;
|
|
16
16
|
const axios_1 = __importDefault(require("axios"));
|
|
17
17
|
const logger_1 = require("../util/logger");
|
|
18
|
+
const requestTracer_1 = require("../util/requestTracer");
|
|
18
19
|
const https_1 = __importDefault(require("https"));
|
|
20
|
+
const constants_1 = require("../util/constants");
|
|
19
21
|
const errorHandler_1 = require("../util/errorHandler");
|
|
20
|
-
const constants_1 = require("../../platform-x/constants");
|
|
21
22
|
class HttpRequestHandler {
|
|
22
23
|
// NOSONAR-NEXT-LINE
|
|
23
24
|
constructor() {
|
|
@@ -44,6 +45,7 @@ class HttpRequestHandler {
|
|
|
44
45
|
if (!options.headers) {
|
|
45
46
|
options.headers = {};
|
|
46
47
|
}
|
|
48
|
+
options.headers['Platform-X-Trace-Id'] = (0, requestTracer_1.getTraceId)() || '';
|
|
47
49
|
options.timeout = this.requestTimeout;
|
|
48
50
|
return axios_1.default
|
|
49
51
|
.post(url, body, options)
|
|
@@ -76,6 +78,7 @@ class HttpRequestHandler {
|
|
|
76
78
|
if (!options.headers) {
|
|
77
79
|
options.headers = {};
|
|
78
80
|
}
|
|
81
|
+
options.headers['Platform-X-Trace-Id'] = (0, requestTracer_1.getTraceId)() || '';
|
|
79
82
|
options.timeout = this.requestTimeout;
|
|
80
83
|
return axios_1.default
|
|
81
84
|
.get(url, options)
|
|
@@ -91,6 +94,81 @@ class HttpRequestHandler {
|
|
|
91
94
|
});
|
|
92
95
|
});
|
|
93
96
|
}
|
|
97
|
+
/**
|
|
98
|
+
* getStream- handler to ftech data as stream
|
|
99
|
+
* @param axiosConfig
|
|
100
|
+
* @returns
|
|
101
|
+
*/
|
|
102
|
+
getStream(axiosConfig) {
|
|
103
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
104
|
+
logger_1.Logger.info('HttpRequestHandler: Reached getStream method', 'getStream');
|
|
105
|
+
let { url } = axiosConfig;
|
|
106
|
+
return new Promise((resolve, reject) => {
|
|
107
|
+
(0, axios_1.default)({
|
|
108
|
+
method: 'get',
|
|
109
|
+
url,
|
|
110
|
+
responseType: 'stream',
|
|
111
|
+
timeout: this.requestTimeout,
|
|
112
|
+
headers: {
|
|
113
|
+
'Platform-X-Trace-Id': (0, requestTracer_1.getTraceId)() || '',
|
|
114
|
+
},
|
|
115
|
+
})
|
|
116
|
+
.then((response) => {
|
|
117
|
+
logger_1.Logger.info('HttpRequestHandler: Successfull Response', 'getStream');
|
|
118
|
+
let { data, headers } = response;
|
|
119
|
+
let finalResponse = {
|
|
120
|
+
data,
|
|
121
|
+
headers,
|
|
122
|
+
};
|
|
123
|
+
resolve(finalResponse);
|
|
124
|
+
})
|
|
125
|
+
.catch((err) => {
|
|
126
|
+
var _a;
|
|
127
|
+
let apiError = new errorHandler_1.ApiError(err.message, (_a = err.response) === null || _a === void 0 ? void 0 : _a.status);
|
|
128
|
+
logger_1.Logger.error('HttpRequestHandler: Error in getStream', 'getStream', err);
|
|
129
|
+
reject(apiError);
|
|
130
|
+
});
|
|
131
|
+
});
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* delete - handler to do delete api calls
|
|
136
|
+
* @param requestConfig
|
|
137
|
+
* @returns
|
|
138
|
+
*/
|
|
139
|
+
delete(requestConfig) {
|
|
140
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
141
|
+
logger_1.Logger.info('HttpRequestHandler: Reached delete method', 'delete');
|
|
142
|
+
const { url, body } = requestConfig;
|
|
143
|
+
const defaultOptions = {
|
|
144
|
+
headers: {
|
|
145
|
+
'Content-Type': constants_1.HTTP_CONTENT_TYPE_JSON,
|
|
146
|
+
},
|
|
147
|
+
};
|
|
148
|
+
let options = requestConfig.options || defaultOptions;
|
|
149
|
+
options.httpsAgent = new https_1.default.Agent({
|
|
150
|
+
rejectUnauthorized: true,
|
|
151
|
+
});
|
|
152
|
+
if (!options.headers) {
|
|
153
|
+
options.headers = {};
|
|
154
|
+
}
|
|
155
|
+
options.headers['Platform-X-Trace-Id'] = (0, requestTracer_1.getTraceId)() || '';
|
|
156
|
+
options.timeout = this.requestTimeout;
|
|
157
|
+
options.data = body;
|
|
158
|
+
return axios_1.default
|
|
159
|
+
.delete(url, options)
|
|
160
|
+
.then((res) => {
|
|
161
|
+
logger_1.Logger.info('HttpRequestHandler: Successfull Response', 'delete');
|
|
162
|
+
return res.data;
|
|
163
|
+
})
|
|
164
|
+
.catch((err) => {
|
|
165
|
+
var _a;
|
|
166
|
+
let apiError = new errorHandler_1.ApiError(err.message, (_a = err.response) === null || _a === void 0 ? void 0 : _a.status);
|
|
167
|
+
logger_1.Logger.error('HttpRequestHandler: Error in delete', 'delete', err);
|
|
168
|
+
throw apiError;
|
|
169
|
+
});
|
|
170
|
+
});
|
|
171
|
+
}
|
|
94
172
|
}
|
|
95
173
|
exports.HttpRequestHandler = HttpRequestHandler;
|
|
96
174
|
//# sourceMappingURL=requestService.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"requestService.js","sourceRoot":"","sources":["../../../../src/common/service/requestService.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,kDAA0B;AAC1B,2CAAwC;AAC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EAAE,GAAG,aAAa,CAAC;YACpC,MAAM,cAAc,GAAG;gBACrB,OAAO,EAAE;oBACP,cAAc,EAAE,kCAAsB;iBACvC;aACF,CAAC;YACF,IAAI,OAAO,GAAG,aAAa,CAAC,OAAO,IAAI,cAAc,CAAC;YACtD,OAAO,CAAC,UAAU,GAAG,IAAI,eAAK,CAAC,KAAK,CAAC;gBACnC,kBAAkB,EAAE,IAAI;aACzB,CAAC,CAAC;YACH,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE;gBACpB,OAAO,CAAC,OAAO,GAAG,EAAE,CAAC;aACtB;YACD,OAAO,CAAC,OAAO,CAAC,qBAAqB,CAAC,GAAG,IAAA,0BAAU,GAAE,IAAI,EAAE,CAAC;YAC5D,OAAO,CAAC,OAAO,GAAG,IAAI,CAAC,cAAc,CAAC;YACtC,OAAO,CAAC,IAAI,GAAG,IAAI,CAAC;YACpB,OAAO,eAAK;iBACT,MAAM,CAAC,GAAG,EAAE,OAAO,CAAC;iBACpB,IAAI,CAAC,CAAC,GAAQ,EAAE,EAAE;gBACjB,eAAM,CAAC,IAAI,CAAC,0CAA0C,EAAE,QAAQ,CAAC,CAAC;gBAClE,OAAO,GAAG,CAAC,IAAI,CAAC;YAClB,CAAC,CAAC;iBACD,KAAK,CAAC,CAAC,GAAQ,EAAE,EAAE;;gBAClB,IAAI,QAAQ,GAAG,IAAI,uBAAQ,CAAC,GAAG,CAAC,OAAO,EAAE,MAAA,GAAG,CAAC,QAAQ,0CAAE,MAAM,CAAC,CAAC;gBAC/D,eAAM,CAAC,KAAK,CAAC,qCAAqC,EAAE,QAAQ,EAAE,GAAG,CAAC,CAAC;gBACnE,MAAM,QAAQ,CAAC;YACjB,CAAC,CAAC,CAAC;QACP,CAAC;KAAA;CACF;AA3JD,gDA2JC"}
|
|
@@ -15,8 +15,6 @@ 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 constants_1 = require("../../platform-x/constants");
|
|
19
|
-
const __1 = require("../..");
|
|
20
18
|
class TwilioService {
|
|
21
19
|
/**
|
|
22
20
|
* Constructor to initialize Twilio client and sender number
|
|
@@ -24,15 +22,9 @@ class TwilioService {
|
|
|
24
22
|
* @param authToken - Twilio Auth Token
|
|
25
23
|
* @param senderNumber - Twilio Sender Phone Number
|
|
26
24
|
*/
|
|
27
|
-
constructor(
|
|
28
|
-
this.client = (0, twilio_1.default)(
|
|
29
|
-
this.senderNumber =
|
|
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
|
-
});
|
|
25
|
+
constructor(accountSid, authToken, senderNumber) {
|
|
26
|
+
this.client = (0, twilio_1.default)(accountSid, authToken);
|
|
27
|
+
this.senderNumber = senderNumber;
|
|
36
28
|
}
|
|
37
29
|
/**
|
|
38
30
|
* Send an SMS using Twilio
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"twilioService.js","sourceRoot":"","sources":["../../../../src/common/service/twilioService.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,oDAA4B;AAC5B,2CAAwC;AAExC,MAAa,aAAa;IAItB;;;;;OAKG;IACH,YAAY,UAAkB,EAAE,SAAiB,EAAE,YAAoB;QACnE,IAAI,CAAC,MAAM,GAAG,IAAA,gBAAM,EAAC,UAAU,EAAE,SAAS,CAAC,CAAC;QAC5C,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;IACrC,CAAC;IAED;;;;;OAKG;IACG,OAAO,CAAC,EAAU,EAAE,OAAe;;YACrC,eAAM,CAAC,IAAI,CACP,gCAAgC,EAChC,SAAS,CACV,CAAC;YACF,eAAM,CAAC,KAAK,CACV,mDAAmD,EACnD,SAAS,EACT,EAAC,EAAE,EAAE,OAAO,EAAC,CACd,CAAC;YACJ,IAAI;gBACA,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC;oBAC/C,IAAI,EAAE,OAAO;oBACb,IAAI,EAAE,IAAI,CAAC,YAAY;oBACvB,EAAE;iBACL,CAAC,CAAC;gBACH,OAAO,QAAQ,CAAC;aACnB;YAAC,OAAO,KAAK,EAAE;gBACZ,eAAM,CAAC,KAAK,CACR,4CAA4C,EAC5C,SAAS,EACT,KAAK,CACN,CAAC;gBACJ,MAAM,IAAI,KAAK,CAAC,oBAAoB,CAAC,CAAC;aACzC;QACL,CAAC;KAAA;CACJ;AA/CD,sCA+CC"}
|
|
@@ -1,7 +1,112 @@
|
|
|
1
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
|
+
};
|
|
2
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.validate = exports.validateMessage = exports.validatePhoneNumber = void 0;
|
|
15
|
+
exports.getTwoDaysBeforeDeadlineWindow = exports.validate = exports.validateMessage = exports.validatePhoneNumber = exports.fetchDataSolr = exports.getUrlEncoded = exports.decodeVerifiedAccessToken = exports.base64ToString = exports.stringToBase64 = exports.handleResponse = void 0;
|
|
4
16
|
const errorHandler_1 = require("./errorHandler");
|
|
17
|
+
const logger_1 = require("./logger");
|
|
18
|
+
const jsonwebtoken_1 = __importDefault(require("jsonwebtoken"));
|
|
19
|
+
const solrConnector_1 = require("./solrConnector");
|
|
20
|
+
/**
|
|
21
|
+
* handleErrorResponse - error handler
|
|
22
|
+
* @param {object} err- error object
|
|
23
|
+
*/
|
|
24
|
+
const handleErrorResponse = (err) => {
|
|
25
|
+
if (!err) {
|
|
26
|
+
return undefined;
|
|
27
|
+
}
|
|
28
|
+
else {
|
|
29
|
+
return (0, errorHandler_1.errorMapper)(err).toJSON();
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
/**
|
|
33
|
+
* handleResponse - response handler to create standard response
|
|
34
|
+
* @param {object} res- express Response
|
|
35
|
+
* @param {object} data- data param
|
|
36
|
+
* @param {object} err- err object
|
|
37
|
+
* @param {number} status- http status
|
|
38
|
+
*/
|
|
39
|
+
const handleResponse = (res, data, err, status) => {
|
|
40
|
+
logger_1.Logger.info('commonUtil: Reached handleResponse', 'handleResponse');
|
|
41
|
+
let code;
|
|
42
|
+
if (!err) {
|
|
43
|
+
code = status || 200 /* HTTP_STATUS_CODE.OK */;
|
|
44
|
+
}
|
|
45
|
+
else {
|
|
46
|
+
code =
|
|
47
|
+
status || err.code || 500 /* HTTP_STATUS_CODE.INTERNAL_SERVER_ERROR */;
|
|
48
|
+
}
|
|
49
|
+
const response = {
|
|
50
|
+
code,
|
|
51
|
+
status: !err ? 'success' : 'error',
|
|
52
|
+
// NOSONAR-NEXT-LINE
|
|
53
|
+
data: !err ? (data ? data : null) : null,
|
|
54
|
+
error: handleErrorResponse(err),
|
|
55
|
+
};
|
|
56
|
+
logger_1.Logger.debug('Before sending response', 'handleResponse', response);
|
|
57
|
+
res.status(code).send(response);
|
|
58
|
+
};
|
|
59
|
+
exports.handleResponse = handleResponse;
|
|
60
|
+
/**
|
|
61
|
+
* stringToBase64 - to convert string into base64
|
|
62
|
+
* @param {string} toEncode- string request
|
|
63
|
+
*/
|
|
64
|
+
const stringToBase64 = (toEncode) => {
|
|
65
|
+
return Buffer.from(toEncode, 'ascii').toString('base64');
|
|
66
|
+
};
|
|
67
|
+
exports.stringToBase64 = stringToBase64;
|
|
68
|
+
/**
|
|
69
|
+
* base64ToString - to convert base64 into string
|
|
70
|
+
* @param {string} toDecode- string base64 request
|
|
71
|
+
*/
|
|
72
|
+
const base64ToString = (toDecode) => {
|
|
73
|
+
return Buffer.from(toDecode, 'base64').toString('ascii');
|
|
74
|
+
};
|
|
75
|
+
exports.base64ToString = base64ToString;
|
|
76
|
+
const decodeVerifiedAccessToken = (token) => {
|
|
77
|
+
logger_1.Logger.info('Authenticate: Reached decodeVerifiedAccessToken', 'decodeVerifiedAccessToken');
|
|
78
|
+
try {
|
|
79
|
+
return jsonwebtoken_1.default.decode(token);
|
|
80
|
+
}
|
|
81
|
+
catch (err) {
|
|
82
|
+
logger_1.Logger.error('Error in decodeVerifiedAccessToken', 'decodeVerifiedAccessToken', err);
|
|
83
|
+
throw err;
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
exports.decodeVerifiedAccessToken = decodeVerifiedAccessToken;
|
|
87
|
+
const getUrlEncoded = (sURL) => {
|
|
88
|
+
if (decodeURI(sURL) === sURL) {
|
|
89
|
+
return encodeURI(sURL);
|
|
90
|
+
}
|
|
91
|
+
return sURL;
|
|
92
|
+
};
|
|
93
|
+
exports.getUrlEncoded = getUrlEncoded;
|
|
94
|
+
const fetchDataSolr = (args, fields, filterType, sortData, filterQuery, solrCore) => __awaiter(void 0, void 0, void 0, function* () {
|
|
95
|
+
try {
|
|
96
|
+
logger_1.Logger.info('solrResolver: Reached fetchDataSolr', 'fetchDataSolr');
|
|
97
|
+
const solr_core = solrCore || 'platform-x';
|
|
98
|
+
const solrClient = new solrConnector_1.SolrClient(solr_core);
|
|
99
|
+
logger_1.Logger.debug('solrResolver: Reached fetchDataSolr', 'fetchDataSolr', solrClient);
|
|
100
|
+
let response = yield solrClient.solrSearch(args, fields, filterType, sortData, filterQuery);
|
|
101
|
+
logger_1.Logger.debug('solrResolver: Reached fetchDataSolr', 'fetchDataSolr', response);
|
|
102
|
+
return response;
|
|
103
|
+
}
|
|
104
|
+
catch (err) {
|
|
105
|
+
logger_1.Logger.error('fetchDataSolr: Error while fetching data', 'fetchDataSolr', err);
|
|
106
|
+
(0, errorHandler_1.throwError)(err);
|
|
107
|
+
}
|
|
108
|
+
});
|
|
109
|
+
exports.fetchDataSolr = fetchDataSolr;
|
|
5
110
|
/**
|
|
6
111
|
* Validate a phone number for format and length
|
|
7
112
|
* @param phoneNumber
|
|
@@ -41,4 +146,17 @@ const validate = (phoneNumber, message) => {
|
|
|
41
146
|
return { valid: true, errors: '' };
|
|
42
147
|
};
|
|
43
148
|
exports.validate = validate;
|
|
149
|
+
/**
|
|
150
|
+
* get two days before deadline date
|
|
151
|
+
* @returns
|
|
152
|
+
*/
|
|
153
|
+
const getTwoDaysBeforeDeadlineWindow = () => {
|
|
154
|
+
const today = new Date();
|
|
155
|
+
today.setUTCHours(0, 0, 0, 0); // Start of the day
|
|
156
|
+
const deadlineLimit = new Date(today);
|
|
157
|
+
deadlineLimit.setUTCDate(today.getUTCDate() + 2);
|
|
158
|
+
deadlineLimit.setUTCHours(23, 59, 59, 999); // End of deadline day
|
|
159
|
+
return { deadlineLimit, today };
|
|
160
|
+
};
|
|
161
|
+
exports.getTwoDaysBeforeDeadlineWindow = getTwoDaysBeforeDeadlineWindow;
|
|
44
162
|
//# sourceMappingURL=commonUtil.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"commonUtil.js","sourceRoot":"","sources":["../../../../src/common/util/commonUtil.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AACA,iDAAsE;AACtE,qCAAkC;AAElC,gEAA+B;AAC/B,mDAA6C;AAC7C;;;GAGG;AACH,MAAM,mBAAmB,GAAG,CAAC,GAAQ,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A,yBAAU,EAAC,+CAA+C,CAAC,CAAC;KAC7D;IACD,OAAO,EAAC,KAAK,EAAC,IAAI,EAAE,MAAM,EAAC,EAAE,EAAC,CAAC;AACjC,CAAC,CAAC;AATW,QAAA,QAAQ,YASnB;AAEF;;;GAGG;AACI,MAAM,8BAA8B,GAAG,GAAG,EAAE;IACjD,MAAM,KAAK,GAAG,IAAI,IAAI,EAAE,CAAC;IACzB,KAAK,CAAC,WAAW,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,CAAE,mBAAmB;IACnD,MAAM,aAAa,GAAG,IAAI,IAAI,CAAC,KAAK,CAAC,CAAC;IACtC,aAAa,CAAC,UAAU,CAAC,KAAK,CAAC,UAAU,EAAE,GAAG,CAAC,CAAC,CAAC;IACjD,aAAa,CAAC,WAAW,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,GAAG,CAAC,CAAC,CAAE,sBAAsB;IACnE,OAAO,EAAC,aAAa,EAAE,KAAK,EAAC,CAAC;AAChC,CAAC,CAAC;AAPW,QAAA,8BAA8B,kCAOzC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GCP_STORAGE_URL = exports.NEWS_LETTER = exports.CONTACT_US = exports.APPLICATION_ID = exports.FORM_NAME = exports.UPLOAD_URL = exports.DEFAULT_REALM_NAME = exports.DEFAULT_APP_NAME = exports.DEFAULT_APP_PORT = exports.TRACE_ID_HEADER_NAME = exports.HTTP_CONTENT_TYPE_FORM_ENCODED = exports.HTTP_CONTENT_TYPE_JSON = void 0;
|
|
4
|
+
/** HTTP Request related constants */
|
|
5
|
+
exports.HTTP_CONTENT_TYPE_JSON = 'application/json';
|
|
6
|
+
exports.HTTP_CONTENT_TYPE_FORM_ENCODED = 'application/x-www-form-urlencoded';
|
|
7
|
+
/** Miscellaneous */
|
|
8
|
+
exports.TRACE_ID_HEADER_NAME = 'Platform-X-Trace-Id';
|
|
9
|
+
exports.DEFAULT_APP_PORT = 8080;
|
|
10
|
+
exports.DEFAULT_APP_NAME = 'api-gateway';
|
|
11
|
+
exports.DEFAULT_REALM_NAME = 'platform-x';
|
|
12
|
+
exports.UPLOAD_URL = '/platform-x/form';
|
|
13
|
+
exports.FORM_NAME = 'Form_Data';
|
|
14
|
+
exports.APPLICATION_ID = 'CFF_Application_Data';
|
|
15
|
+
exports.CONTACT_US = 'CFF_Contact_Us_Data';
|
|
16
|
+
exports.NEWS_LETTER = 'CFF_News_Letter_Data';
|
|
17
|
+
exports.GCP_STORAGE_URL = 'https://storage.googleapis.com/';
|
|
18
|
+
//# sourceMappingURL=constants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../src/common/util/constants.ts"],"names":[],"mappings":";;;AAMA,qCAAqC;AACxB,QAAA,sBAAsB,GAAG,kBAAkB,CAAC;AAC5C,QAAA,8BAA8B,GAAG,mCAAmC,CAAC;AAGlF,oBAAoB;AACP,QAAA,oBAAoB,GAAG,qBAAqB,CAAC;AAC7C,QAAA,gBAAgB,GAAG,IAAI,CAAC;AACxB,QAAA,gBAAgB,GAAG,aAAa,CAAC;AACjC,QAAA,kBAAkB,GAAG,YAAY,CAAC;AASlC,QAAA,UAAU,GAAG,kBAAkB,CAAC;AAChC,QAAA,SAAS,GAAG,WAAW,CAAC;AACxB,QAAA,cAAc,GAAG,sBAAsB,CAAC;AACxC,QAAA,UAAU,GAAG,qBAAqB,CAAC;AACnC,QAAA,WAAW,GAAG,sBAAsB,CAAC;AACrC,QAAA,eAAe,GAAG,iCAAiC,CAAC"}
|