@platform-x/hep-push-notification-client 1.0.8 → 1.0.10
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/util/commonUtil.js +1 -1
- package/dist/src/platform-x/services/fcmservices.d.ts +1 -1
- package/dist/src/platform-x/services/fcmservices.js +1 -1
- package/package.json +1 -1
- package/dist/src/common/service/requestService.d.ts +0 -26
- package/dist/src/common/service/requestService.js +0 -96
- package/dist/src/common/service/secretKeyManager.services.d.ts +0 -0
- package/dist/src/common/service/secretKeyManager.services.js +0 -38
- package/dist/src/common/service/twilioService.d.ts +0 -19
- package/dist/src/common/service/twilioService.js +0 -63
- package/dist/src/common/util/solrConnector.d.ts +0 -35
- package/dist/src/common/util/solrConnector.js +0 -157
- package/dist/src/platform-x/constants/style.d.ts +0 -1
- package/dist/src/platform-x/constants/style.js +0 -103
- package/dist/src/platform-x/dataSource/emailDataSource.d.ts +0 -5
- package/dist/src/platform-x/dataSource/emailDataSource.js +0 -36
- package/dist/src/platform-x/database/dao/formBuilder.dao.d.ts +0 -9
- package/dist/src/platform-x/database/dao/formBuilder.dao.js +0 -51
- package/dist/src/platform-x/database/models/formBuilder.model.d.ts +0 -34
- package/dist/src/platform-x/database/models/formBuilder.model.js +0 -35
- package/dist/src/platform-x/util/emailHandler.d.ts +0 -62
- package/dist/src/platform-x/util/emailHandler.js +0 -524
- package/dist/src/platform-x/util/emailTemplate.d.ts +0 -4
- package/dist/src/platform-x/util/emailTemplate.js +0 -82
- package/dist/src/platform-x/util/solr-data-source/SolrHttpDataSource.d.ts +0 -26
- package/dist/src/platform-x/util/solr-data-source/SolrHttpDataSource.js +0 -75
- package/dist/templates/orderPlaced.ejs +0 -173
- package/dist/templates/orderPlaced.html +0 -190
|
@@ -29,7 +29,7 @@ function getDynamicSecretdata(sitename, providerName, secretKey) {
|
|
|
29
29
|
const defaultData = constants_1.DynamicValues === null || constants_1.DynamicValues === void 0 ? void 0 : constants_1.DynamicValues.DEFAULT;
|
|
30
30
|
const targetKey = `${sitename}_${providerName}_${secretKey}`.toUpperCase();
|
|
31
31
|
const fallbackKey = `${defaultData}_${providerName}_${secretKey}`.toUpperCase();
|
|
32
|
-
logger_1.Logger.info(
|
|
32
|
+
logger_1.Logger.info(`Target Key: ${targetKey}`, 'getDynamicSecretdata');
|
|
33
33
|
logger_1.Logger.info('Fallback Key: ', 'getDynamicSecretdata');
|
|
34
34
|
let finalValue = secretValue.hasOwnProperty(targetKey) ? secretValue[targetKey] : secretValue[fallbackKey];
|
|
35
35
|
if (!finalValue || finalValue == '') {
|
|
@@ -14,5 +14,5 @@ export declare class FcmClient implements PushNotifyProvider {
|
|
|
14
14
|
* @param notification
|
|
15
15
|
* @returns
|
|
16
16
|
*/
|
|
17
|
-
sendNotificationsToTopics(topics:
|
|
17
|
+
sendNotificationsToTopics(topics: any[], notification: any): Promise<any>;
|
|
18
18
|
}
|
|
@@ -165,7 +165,7 @@ class FcmClient {
|
|
|
165
165
|
return __awaiter(this, void 0, void 0, function* () {
|
|
166
166
|
try {
|
|
167
167
|
if (Array.isArray(topics) && topics.length > 0) {
|
|
168
|
-
const topicsStr = topics.map(t => `'${t}' in topics`).join(' || ');
|
|
168
|
+
const topicsStr = topics.map(t => typeof t === 'object' ? `'${t === null || t === void 0 ? void 0 : t.label}' in topics` : `'${t}' in topics`).join(' || ');
|
|
169
169
|
logger_1.Logger.debug('FCM-Client>FCMClient: Reached sendNotificationsToTopics', 'sendNotificationsToTopics', { topicsStr });
|
|
170
170
|
const message = {
|
|
171
171
|
notification: {
|
package/package.json
CHANGED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
interface RequestHandlerPostOptions {
|
|
2
|
-
url: string;
|
|
3
|
-
body: any;
|
|
4
|
-
options?: any;
|
|
5
|
-
}
|
|
6
|
-
interface RequestHandlerGetOptions {
|
|
7
|
-
url: string;
|
|
8
|
-
options?: any;
|
|
9
|
-
}
|
|
10
|
-
export declare class HttpRequestHandler {
|
|
11
|
-
private requestTimeout;
|
|
12
|
-
constructor();
|
|
13
|
-
/**
|
|
14
|
-
* post - handler to do post api calls
|
|
15
|
-
* @param requestConfig
|
|
16
|
-
* @returns
|
|
17
|
-
*/
|
|
18
|
-
post(requestConfig: RequestHandlerPostOptions): Promise<any>;
|
|
19
|
-
/**
|
|
20
|
-
* get - handler to do get api calls
|
|
21
|
-
* @param requestConfig
|
|
22
|
-
* @returns
|
|
23
|
-
*/
|
|
24
|
-
get(requestConfig: RequestHandlerGetOptions): Promise<any>;
|
|
25
|
-
}
|
|
26
|
-
export {};
|
|
@@ -1,96 +0,0 @@
|
|
|
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.HttpRequestHandler = void 0;
|
|
16
|
-
const axios_1 = __importDefault(require("axios"));
|
|
17
|
-
const logger_1 = require("../util/logger");
|
|
18
|
-
const https_1 = __importDefault(require("https"));
|
|
19
|
-
const errorHandler_1 = require("../util/errorHandler");
|
|
20
|
-
const constants_1 = require("../../platform-x/constants");
|
|
21
|
-
class HttpRequestHandler {
|
|
22
|
-
// NOSONAR-NEXT-LINE
|
|
23
|
-
constructor() {
|
|
24
|
-
this.requestTimeout = 1000 * 30;
|
|
25
|
-
} // NOSONAR
|
|
26
|
-
/**
|
|
27
|
-
* post - handler to do post api calls
|
|
28
|
-
* @param requestConfig
|
|
29
|
-
* @returns
|
|
30
|
-
*/
|
|
31
|
-
post(requestConfig) {
|
|
32
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
33
|
-
logger_1.Logger.info('HttpRequestHandler: Reached post method', 'post');
|
|
34
|
-
const { url, body } = requestConfig;
|
|
35
|
-
const defaultOptions = {
|
|
36
|
-
headers: {
|
|
37
|
-
'Content-Type': constants_1.HTTP_CONTENT_TYPE_JSON,
|
|
38
|
-
},
|
|
39
|
-
};
|
|
40
|
-
let options = requestConfig.options || defaultOptions;
|
|
41
|
-
options.httpsAgent = new https_1.default.Agent({
|
|
42
|
-
rejectUnauthorized: true,
|
|
43
|
-
});
|
|
44
|
-
if (!options.headers) {
|
|
45
|
-
options.headers = {};
|
|
46
|
-
}
|
|
47
|
-
options.timeout = this.requestTimeout;
|
|
48
|
-
return axios_1.default
|
|
49
|
-
.post(url, body, options)
|
|
50
|
-
.then((res) => {
|
|
51
|
-
logger_1.Logger.info('HttpRequestHandler: Successfull Response', 'post');
|
|
52
|
-
return res.data;
|
|
53
|
-
})
|
|
54
|
-
.catch((err) => {
|
|
55
|
-
var _a;
|
|
56
|
-
let apiError = new errorHandler_1.ApiError(err.message, (_a = err.response) === null || _a === void 0 ? void 0 : _a.status);
|
|
57
|
-
logger_1.Logger.error('HttpRequestHandler: Error in post', 'post', err);
|
|
58
|
-
throw apiError;
|
|
59
|
-
});
|
|
60
|
-
});
|
|
61
|
-
}
|
|
62
|
-
/**
|
|
63
|
-
* get - handler to do get api calls
|
|
64
|
-
* @param requestConfig
|
|
65
|
-
* @returns
|
|
66
|
-
*/
|
|
67
|
-
get(requestConfig) {
|
|
68
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
69
|
-
logger_1.Logger.info('HttpRequestHandler: Reached get method', 'get');
|
|
70
|
-
const { url } = requestConfig;
|
|
71
|
-
const defaultOptions = {};
|
|
72
|
-
let options = requestConfig.options || defaultOptions;
|
|
73
|
-
options.httpsAgent = new https_1.default.Agent({
|
|
74
|
-
rejectUnauthorized: true,
|
|
75
|
-
});
|
|
76
|
-
if (!options.headers) {
|
|
77
|
-
options.headers = {};
|
|
78
|
-
}
|
|
79
|
-
options.timeout = this.requestTimeout;
|
|
80
|
-
return axios_1.default
|
|
81
|
-
.get(url, options)
|
|
82
|
-
.then((res) => {
|
|
83
|
-
logger_1.Logger.info('HttpRequestHandler: Successfull Response', 'get');
|
|
84
|
-
return res.data;
|
|
85
|
-
})
|
|
86
|
-
.catch((err) => {
|
|
87
|
-
var _a;
|
|
88
|
-
let apiError = new errorHandler_1.ApiError(err.message, (_a = err.response) === null || _a === void 0 ? void 0 : _a.status);
|
|
89
|
-
logger_1.Logger.error('HttpRequestHandler: Error in get', 'get', err);
|
|
90
|
-
throw apiError;
|
|
91
|
-
});
|
|
92
|
-
});
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
exports.HttpRequestHandler = HttpRequestHandler;
|
|
96
|
-
//# sourceMappingURL=requestService.js.map
|
|
File without changes
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// import { secretManager } from 'hep-secret-access';
|
|
3
|
-
// import config from '../../config';
|
|
4
|
-
// import { DynamicValues } from '../../platform-x/constants';
|
|
5
|
-
// export class SecretKeyServices {
|
|
6
|
-
// private ruleCache = new Map<string, any | null>();
|
|
7
|
-
// /**
|
|
8
|
-
// * Fetches all the secret keys
|
|
9
|
-
// */
|
|
10
|
-
// public async getSecretKeys() {
|
|
11
|
-
// try {
|
|
12
|
-
// // Initialize secret manager object
|
|
13
|
-
// if (this.ruleCache.has('secret_data')) {
|
|
14
|
-
// return this.ruleCache.get('secret_data')!;
|
|
15
|
-
// }
|
|
16
|
-
// const secretObject = secretManager();
|
|
17
|
-
// // If secret mode is ENV – read one by one
|
|
18
|
-
// // for local testing
|
|
19
|
-
// if (config?.SECRET_MODE === 'env') {
|
|
20
|
-
// const keyConfig: Record<any, any> = {};
|
|
21
|
-
// for (const key of Object.values(DynamicValues)) {
|
|
22
|
-
// // Fetch individual value (existing read() method)
|
|
23
|
-
// const value = await secretObject.read(key);
|
|
24
|
-
// keyConfig[key] = value;
|
|
25
|
-
// }
|
|
26
|
-
// this.ruleCache.set('secret_data', keyConfig);
|
|
27
|
-
// return keyConfig;
|
|
28
|
-
// }
|
|
29
|
-
// // else – fetch all secrets from GSM
|
|
30
|
-
// const data = await secretObject.readAllSecrets();
|
|
31
|
-
// this.ruleCache.set('secret_data', data);
|
|
32
|
-
// return data;
|
|
33
|
-
// } catch (err) {
|
|
34
|
-
// return {};
|
|
35
|
-
// }
|
|
36
|
-
// }
|
|
37
|
-
// }
|
|
38
|
-
//# sourceMappingURL=secretKeyManager.services.js.map
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
export declare class TwilioService {
|
|
2
|
-
private client;
|
|
3
|
-
private senderNumber;
|
|
4
|
-
/**
|
|
5
|
-
* Constructor to initialize Twilio client and sender number
|
|
6
|
-
* @param accountSid - Twilio Account SID
|
|
7
|
-
* @param authToken - Twilio Auth Token
|
|
8
|
-
* @param senderNumber - Twilio Sender Phone Number
|
|
9
|
-
*/
|
|
10
|
-
private constructor();
|
|
11
|
-
static TwilioClassObject(): Promise<TwilioService>;
|
|
12
|
-
/**
|
|
13
|
-
* Send an SMS using Twilio
|
|
14
|
-
* @param to - Recipient's phone number
|
|
15
|
-
* @param message - Message content
|
|
16
|
-
* @returns Promise resolving with the Twilio response
|
|
17
|
-
*/
|
|
18
|
-
sendSMS(to: string, message: string): Promise<import("twilio/lib/rest/api/v2010/account/message").MessageInstance>;
|
|
19
|
-
}
|
|
@@ -1,63 +0,0 @@
|
|
|
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.TwilioService = void 0;
|
|
16
|
-
const twilio_1 = __importDefault(require("twilio"));
|
|
17
|
-
const logger_1 = require("../util/logger");
|
|
18
|
-
const constants_1 = require("../../platform-x/constants");
|
|
19
|
-
const __1 = require("../..");
|
|
20
|
-
class TwilioService {
|
|
21
|
-
/**
|
|
22
|
-
* Constructor to initialize Twilio client and sender number
|
|
23
|
-
* @param accountSid - Twilio Account SID
|
|
24
|
-
* @param authToken - Twilio Auth Token
|
|
25
|
-
* @param senderNumber - Twilio Sender Phone Number
|
|
26
|
-
*/
|
|
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
|
-
});
|
|
36
|
-
}
|
|
37
|
-
/**
|
|
38
|
-
* Send an SMS using Twilio
|
|
39
|
-
* @param to - Recipient's phone number
|
|
40
|
-
* @param message - Message content
|
|
41
|
-
* @returns Promise resolving with the Twilio response
|
|
42
|
-
*/
|
|
43
|
-
sendSMS(to, message) {
|
|
44
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
45
|
-
logger_1.Logger.info('twilioService: Reached sendSMS', 'sendSMS');
|
|
46
|
-
logger_1.Logger.debug('twilioService: check message and recipient number', 'sendSMS', { to, message });
|
|
47
|
-
try {
|
|
48
|
-
const response = yield this.client.messages.create({
|
|
49
|
-
body: message,
|
|
50
|
-
from: this.senderNumber,
|
|
51
|
-
to,
|
|
52
|
-
});
|
|
53
|
-
return response;
|
|
54
|
-
}
|
|
55
|
-
catch (error) {
|
|
56
|
-
logger_1.Logger.error('twilioService: error in send SMS by twilio', 'sendSMS', error);
|
|
57
|
-
throw new Error('Failed to send SMS');
|
|
58
|
-
}
|
|
59
|
-
});
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
exports.TwilioService = TwilioService;
|
|
63
|
-
//# sourceMappingURL=twilioService.js.map
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
interface SolrQuery {
|
|
2
|
-
query(query: string | object | null | undefined): any;
|
|
3
|
-
paginate(start?: number, rows?: number): any;
|
|
4
|
-
filterList(fields: any): any;
|
|
5
|
-
sort(fields: any): any;
|
|
6
|
-
filterQuery(fields: any): any;
|
|
7
|
-
}
|
|
8
|
-
export declare class SolrClient {
|
|
9
|
-
private host;
|
|
10
|
-
private port;
|
|
11
|
-
private core;
|
|
12
|
-
private path;
|
|
13
|
-
private secure;
|
|
14
|
-
private solrNodeClient;
|
|
15
|
-
private solrQuery;
|
|
16
|
-
constructor(core?: string);
|
|
17
|
-
getQuery(): any;
|
|
18
|
-
createQuery(): SolrQuery;
|
|
19
|
-
executeSearch(): Promise<any>;
|
|
20
|
-
/**
|
|
21
|
-
* solrSearch- fn to call solr search
|
|
22
|
-
* @param queryParams
|
|
23
|
-
* @param fields
|
|
24
|
-
* @param fieldType
|
|
25
|
-
* @param sortData
|
|
26
|
-
* @returns
|
|
27
|
-
*/
|
|
28
|
-
solrSearch(queryParams: any, fields?: any, fieldType?: any, sortData?: any, filterQuery?: any): Promise<unknown>;
|
|
29
|
-
private query;
|
|
30
|
-
private paginate;
|
|
31
|
-
private filterList;
|
|
32
|
-
private sort;
|
|
33
|
-
private filterQuery;
|
|
34
|
-
}
|
|
35
|
-
export {};
|
|
@@ -1,157 +0,0 @@
|
|
|
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.SolrClient = void 0;
|
|
16
|
-
const logger_1 = require("./logger");
|
|
17
|
-
const index_1 = __importDefault(require("../../config/index"));
|
|
18
|
-
const errorHandler_1 = require("./errorHandler");
|
|
19
|
-
const constants_1 = require("../../platform-x/constants");
|
|
20
|
-
const solr = require('solr-client');
|
|
21
|
-
class SolrClient {
|
|
22
|
-
constructor(core) {
|
|
23
|
-
this.host = index_1.default.SOLR.HOST || '';
|
|
24
|
-
this.port = Number(index_1.default.SOLR.PORT);
|
|
25
|
-
this.path = index_1.default.SOLR.PATH || '/solr';
|
|
26
|
-
this.secure = false;
|
|
27
|
-
this.core = core || process.env.SOLR_CORE || '';
|
|
28
|
-
const options = {
|
|
29
|
-
host: this.host,
|
|
30
|
-
port: this.port,
|
|
31
|
-
core: this.core,
|
|
32
|
-
path: this.path,
|
|
33
|
-
secure: this.secure,
|
|
34
|
-
};
|
|
35
|
-
this.solrNodeClient = solr.createClient(options);
|
|
36
|
-
this.solrQuery = null;
|
|
37
|
-
}
|
|
38
|
-
getQuery() {
|
|
39
|
-
return this.solrQuery;
|
|
40
|
-
}
|
|
41
|
-
createQuery() {
|
|
42
|
-
this.solrQuery = this.solrNodeClient.createQuery();
|
|
43
|
-
return {
|
|
44
|
-
query: this.query.bind(this),
|
|
45
|
-
filterQuery: this.filterQuery.bind(this),
|
|
46
|
-
sort: this.sort.bind(this),
|
|
47
|
-
filterList: this.filterList.bind(this),
|
|
48
|
-
paginate: this.paginate.bind(this),
|
|
49
|
-
};
|
|
50
|
-
}
|
|
51
|
-
executeSearch() {
|
|
52
|
-
logger_1.Logger.info('SOLR ExecuteSearch Reached', 'executeSearch');
|
|
53
|
-
const q = this.solrQuery;
|
|
54
|
-
logger_1.Logger.debug('Before calling search method', 'executeSearch', q);
|
|
55
|
-
//try {
|
|
56
|
-
return new Promise((resolve, reject) => {
|
|
57
|
-
this.solrNodeClient.search(q, function (err, res) {
|
|
58
|
-
if (err) {
|
|
59
|
-
logger_1.Logger.error(`Error in Solr Search for query:--------------------->`, 'executeSearch', err);
|
|
60
|
-
let solrError = new errorHandler_1.SolrError(err.message || err.name, Number(err.statusCode));
|
|
61
|
-
logger_1.Logger.error('Error in Solr Search for query: ${q}', 'solrSearch', err);
|
|
62
|
-
reject(solrError);
|
|
63
|
-
}
|
|
64
|
-
else {
|
|
65
|
-
logger_1.Logger.debug('Before returning search result', 'executeSearch', res);
|
|
66
|
-
resolve(res.response.docs);
|
|
67
|
-
}
|
|
68
|
-
});
|
|
69
|
-
});
|
|
70
|
-
// } catch (err: any) {
|
|
71
|
-
// Logger.info(`SOLR EXECUTION ERRROR------${err}`);
|
|
72
|
-
// throw err;
|
|
73
|
-
// }
|
|
74
|
-
}
|
|
75
|
-
/**
|
|
76
|
-
* solrSearch- fn to call solr search
|
|
77
|
-
* @param queryParams
|
|
78
|
-
* @param fields
|
|
79
|
-
* @param fieldType
|
|
80
|
-
* @param sortData
|
|
81
|
-
* @returns
|
|
82
|
-
*/
|
|
83
|
-
solrSearch(queryParams, fields, fieldType, sortData, filterQuery) {
|
|
84
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
85
|
-
logger_1.Logger.debug('Before calling solrSearch method', 'solrSearch', queryParams);
|
|
86
|
-
return new Promise((resolve, reject) => {
|
|
87
|
-
logger_1.Logger.info('Reached Solr Search', 'solrSearch');
|
|
88
|
-
logger_1.Logger.debug('Reached Solr Search', 'solrSearch', { queryParams });
|
|
89
|
-
const defaultRows = constants_1.DEFAULT_SOLR_ROWS;
|
|
90
|
-
let query = this.solrNodeClient.createQuery();
|
|
91
|
-
if (filterQuery) {
|
|
92
|
-
query.matchFilter(filterQuery === null || filterQuery === void 0 ? void 0 : filterQuery.filterKey, filterQuery === null || filterQuery === void 0 ? void 0 : filterQuery.filterValue);
|
|
93
|
-
}
|
|
94
|
-
if (queryParams) {
|
|
95
|
-
query.q(fieldType);
|
|
96
|
-
}
|
|
97
|
-
else {
|
|
98
|
-
query.q(`*:*`);
|
|
99
|
-
}
|
|
100
|
-
if (queryParams && queryParams.pagination) {
|
|
101
|
-
query.start(queryParams.pagination.start ? queryParams.pagination.start : 0);
|
|
102
|
-
query.rows(queryParams.pagination.rows
|
|
103
|
-
? queryParams.pagination.rows
|
|
104
|
-
: defaultRows);
|
|
105
|
-
}
|
|
106
|
-
else {
|
|
107
|
-
query.start(0);
|
|
108
|
-
query.rows(defaultRows);
|
|
109
|
-
}
|
|
110
|
-
if (fields) {
|
|
111
|
-
let fieldsTemp = Array.isArray(fields) ? fields : Object.keys(fields);
|
|
112
|
-
query.fl(fieldsTemp);
|
|
113
|
-
}
|
|
114
|
-
if (sortData) {
|
|
115
|
-
query.sort(sortData);
|
|
116
|
-
}
|
|
117
|
-
this.solrNodeClient.search(query, function (err, res) {
|
|
118
|
-
if (err) {
|
|
119
|
-
let solrError = new errorHandler_1.SolrError(err.message || err.name, Number(err.statusCode));
|
|
120
|
-
logger_1.Logger.error(`Error in Solr Search for query: ${query}`, 'solrSearch', err);
|
|
121
|
-
reject(solrError);
|
|
122
|
-
}
|
|
123
|
-
else {
|
|
124
|
-
logger_1.Logger.debug('Before returning search result', 'solrSearch', res);
|
|
125
|
-
resolve(res.response.docs);
|
|
126
|
-
}
|
|
127
|
-
});
|
|
128
|
-
});
|
|
129
|
-
});
|
|
130
|
-
}
|
|
131
|
-
query(query) {
|
|
132
|
-
let queryString = query || `*:*`;
|
|
133
|
-
this.solrQuery.q(queryString);
|
|
134
|
-
}
|
|
135
|
-
paginate(start, rows) {
|
|
136
|
-
this.solrQuery.start(start || 0);
|
|
137
|
-
this.solrQuery.rows(rows || constants_1.DEFAULT_SOLR_ROWS);
|
|
138
|
-
}
|
|
139
|
-
filterList(fields) {
|
|
140
|
-
if (fields) {
|
|
141
|
-
let fieldsTemp = Array.isArray(fields) ? fields : Object.keys(fields);
|
|
142
|
-
this.solrQuery.fl(fieldsTemp);
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
sort(fields) {
|
|
146
|
-
if (fields) {
|
|
147
|
-
this.solrQuery.sort(fields);
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
filterQuery(fields) {
|
|
151
|
-
if (fields === null || fields === void 0 ? void 0 : fields.length) {
|
|
152
|
-
this.solrQuery.fq(fields);
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
exports.SolrClient = SolrClient;
|
|
157
|
-
//# sourceMappingURL=solrConnector.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const style = "<style>\n .username {\n font-size:24px;\n }\n .main_div {\n background-color: #dff3ff;\n box-sizing: border-box;\n\t\t\t\t\t\t\tfont-family: Segoe, \"Segoe UI\", \"DejaVu Sans\", \"Trebuchet MS\", Verdana, \"sans-serif\"\n }\n table {\n height: 100%;\n margin-left: auto;\n margin-right: auto;\n }\n .table_div {\n max-width: 600px;\n width: 100%;\n background-color: #fff;\n padding: 40px;\n border-radius: 5px;\n box-shadow: 8px 8px 16px 0 #b4e3ff;\n box-sizing: border-box;\n }\n .table_2 {\n width: 100%;\n padding-bottom: 30px;\n border-bottom: solid 1px #bfbfbf;\n margin-bottom: 30px;\n }\n .w-400 {\n width: 402px;\n }\n .w_h_30 {\n width: 40px;\n height: auto;\n }\n h1 {\n font-size: 24px;\n color: #000;\n text-transform: capitalize;\n margin: 0 0 20px;\n }\n .main_text {\n font-size: 16px;\n line-height: 1.5;\n color: #000000;\n margin: 0 0 30px;\n }\n a {\n color: #0077b5;\n }\n .mb_20 {\n margin-bottom: 20px;\n }\n .btn {\n display: block;\n width: 100px;\n padding: 15px 30px;\n font-size: 18px;\n font-weight: 600;\n color: #ffffff;\n text-align: center;\n background-color: #2D2D39;\n border-radius: 4px;\n text-decoration: none;\n }\n .border {\n margin-bottom: 30px;\n border-bottom: solid 1px #bfbfbf;\n padding-bottom: 30px;\n }\n .mb_pb_20 {\n margin-bottom: 30px;\n padding-bottom: 30px;\n }\n .sub_text {\n font-size: 14px;\n line-height: 1.5;\n color: #000000;\n margin: 26.5px 16px 15px 1px;\n }\n .link {\n font-size: 14px;\n font-weight: 600;\n color: #0077b5;\n margin-bottom: 20px;\n margin-right: 15px;\n }\n .thanks{\n font-size: 16px;\n line-height: 1.5;\n color: #000000;\n margin-top:40px\n }\n .mt_10{\n margin-top:10px\n }\n </style>\n";
|
|
@@ -1,103 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.style = void 0;
|
|
4
|
-
exports.style = `<style>
|
|
5
|
-
.username {
|
|
6
|
-
font-size:24px;
|
|
7
|
-
}
|
|
8
|
-
.main_div {
|
|
9
|
-
background-color: #dff3ff;
|
|
10
|
-
box-sizing: border-box;
|
|
11
|
-
font-family: Segoe, "Segoe UI", "DejaVu Sans", "Trebuchet MS", Verdana, "sans-serif"
|
|
12
|
-
}
|
|
13
|
-
table {
|
|
14
|
-
height: 100%;
|
|
15
|
-
margin-left: auto;
|
|
16
|
-
margin-right: auto;
|
|
17
|
-
}
|
|
18
|
-
.table_div {
|
|
19
|
-
max-width: 600px;
|
|
20
|
-
width: 100%;
|
|
21
|
-
background-color: #fff;
|
|
22
|
-
padding: 40px;
|
|
23
|
-
border-radius: 5px;
|
|
24
|
-
box-shadow: 8px 8px 16px 0 #b4e3ff;
|
|
25
|
-
box-sizing: border-box;
|
|
26
|
-
}
|
|
27
|
-
.table_2 {
|
|
28
|
-
width: 100%;
|
|
29
|
-
padding-bottom: 30px;
|
|
30
|
-
border-bottom: solid 1px #bfbfbf;
|
|
31
|
-
margin-bottom: 30px;
|
|
32
|
-
}
|
|
33
|
-
.w-400 {
|
|
34
|
-
width: 402px;
|
|
35
|
-
}
|
|
36
|
-
.w_h_30 {
|
|
37
|
-
width: 40px;
|
|
38
|
-
height: auto;
|
|
39
|
-
}
|
|
40
|
-
h1 {
|
|
41
|
-
font-size: 24px;
|
|
42
|
-
color: #000;
|
|
43
|
-
text-transform: capitalize;
|
|
44
|
-
margin: 0 0 20px;
|
|
45
|
-
}
|
|
46
|
-
.main_text {
|
|
47
|
-
font-size: 16px;
|
|
48
|
-
line-height: 1.5;
|
|
49
|
-
color: #000000;
|
|
50
|
-
margin: 0 0 30px;
|
|
51
|
-
}
|
|
52
|
-
a {
|
|
53
|
-
color: #0077b5;
|
|
54
|
-
}
|
|
55
|
-
.mb_20 {
|
|
56
|
-
margin-bottom: 20px;
|
|
57
|
-
}
|
|
58
|
-
.btn {
|
|
59
|
-
display: block;
|
|
60
|
-
width: 100px;
|
|
61
|
-
padding: 15px 30px;
|
|
62
|
-
font-size: 18px;
|
|
63
|
-
font-weight: 600;
|
|
64
|
-
color: #ffffff;
|
|
65
|
-
text-align: center;
|
|
66
|
-
background-color: #2D2D39;
|
|
67
|
-
border-radius: 4px;
|
|
68
|
-
text-decoration: none;
|
|
69
|
-
}
|
|
70
|
-
.border {
|
|
71
|
-
margin-bottom: 30px;
|
|
72
|
-
border-bottom: solid 1px #bfbfbf;
|
|
73
|
-
padding-bottom: 30px;
|
|
74
|
-
}
|
|
75
|
-
.mb_pb_20 {
|
|
76
|
-
margin-bottom: 30px;
|
|
77
|
-
padding-bottom: 30px;
|
|
78
|
-
}
|
|
79
|
-
.sub_text {
|
|
80
|
-
font-size: 14px;
|
|
81
|
-
line-height: 1.5;
|
|
82
|
-
color: #000000;
|
|
83
|
-
margin: 26.5px 16px 15px 1px;
|
|
84
|
-
}
|
|
85
|
-
.link {
|
|
86
|
-
font-size: 14px;
|
|
87
|
-
font-weight: 600;
|
|
88
|
-
color: #0077b5;
|
|
89
|
-
margin-bottom: 20px;
|
|
90
|
-
margin-right: 15px;
|
|
91
|
-
}
|
|
92
|
-
.thanks{
|
|
93
|
-
font-size: 16px;
|
|
94
|
-
line-height: 1.5;
|
|
95
|
-
color: #000000;
|
|
96
|
-
margin-top:40px
|
|
97
|
-
}
|
|
98
|
-
.mt_10{
|
|
99
|
-
margin-top:10px
|
|
100
|
-
}
|
|
101
|
-
</style>
|
|
102
|
-
`;
|
|
103
|
-
//# sourceMappingURL=style.js.map
|
|
@@ -1,36 +0,0 @@
|
|
|
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
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.EmailDataSource = void 0;
|
|
13
|
-
const logger_1 = require("../../common/util/logger");
|
|
14
|
-
const SolrHttpDataSource_1 = require("../util/solr-data-source/SolrHttpDataSource");
|
|
15
|
-
// NOSONAR-NEXT-LINE
|
|
16
|
-
class EmailDataSource extends SolrHttpDataSource_1.SolrHttpDataSource {
|
|
17
|
-
constructor() {
|
|
18
|
-
super();
|
|
19
|
-
}
|
|
20
|
-
fetchPageModel(tagName) {
|
|
21
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
22
|
-
logger_1.Logger.info('emailModelDataSource: Reached fetchPageModel', 'fetchPageModel');
|
|
23
|
-
logger_1.Logger.debug('Before calling createQuery method', 'fetchPageModel', tagName);
|
|
24
|
-
let queryRequest = {
|
|
25
|
-
query: `hclplatformx_TagName:"email" AND name:"${tagName}"`,
|
|
26
|
-
};
|
|
27
|
-
this.createQuery(queryRequest);
|
|
28
|
-
logger_1.Logger.debug('Reached fetchPageModel', 'fetchPageModel', queryRequest);
|
|
29
|
-
let response = yield this.executeSearch();
|
|
30
|
-
logger_1.Logger.debug('Reached fetchPageModel', 'fetchPageModel', response);
|
|
31
|
-
return response;
|
|
32
|
-
});
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
exports.EmailDataSource = EmailDataSource;
|
|
36
|
-
//# sourceMappingURL=emailDataSource.js.map
|