@optimiser/common 1.0.352 → 1.0.353
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/aws/awsservices.d.ts +39 -39
- package/dist/aws/awsservices.js +398 -398
- package/dist/constants.d.ts +35 -35
- package/dist/constants.js +36 -36
- package/dist/enums/databasetype.enum.d.ts +7 -7
- package/dist/enums/databasetype.enum.js +11 -11
- package/dist/enums/log.enum.d.ts +22 -22
- package/dist/enums/log.enum.js +26 -26
- package/dist/index.d.ts +25 -25
- package/dist/index.js +61 -61
- package/dist/lib/activity.d.ts +1 -1
- package/dist/lib/activity.js +44 -44
- package/dist/lib/calculatedbsize.d.ts +15 -15
- package/dist/lib/calculatedbsize.js +75 -75
- package/dist/lib/connection.d.ts +116 -116
- package/dist/lib/connection.js +595 -595
- package/dist/lib/convertfilesize.d.ts +2 -2
- package/dist/lib/convertfilesize.js +15 -15
- package/dist/lib/countrycode.d.ts +2 -2
- package/dist/lib/countrycode.js +255 -255
- package/dist/lib/event.d.ts +25 -25
- package/dist/lib/event.js +171 -171
- package/dist/lib/helper.d.ts +93 -93
- package/dist/lib/helper.js +1009 -1009
- package/dist/lib/memoryserverclient.d.ts +40 -40
- package/dist/lib/memoryserverclient.js +252 -252
- package/dist/lib/operautilitycommon.d.ts +65 -65
- package/dist/lib/operautilitycommon.js +620 -620
- package/dist/lib/redis.d.ts +21 -21
- package/dist/lib/redis.js +46 -46
- package/dist/lib/socketidfromredis.d.ts +3 -3
- package/dist/lib/socketidfromredis.js +5 -5
- package/dist/lib/taskutils.d.ts +40 -40
- package/dist/lib/taskutils.js +656 -656
- package/dist/lib/utility.d.ts +292 -292
- package/dist/lib/utility.js +5570 -5570
- package/dist/lib/validateRequest.d.ts +3 -3
- package/dist/lib/validateRequest.js +13 -13
- package/dist/logs/auditlog.d.ts +25 -25
- package/dist/logs/auditlog.js +1029 -1029
- package/dist/logs/checklogtable.d.ts +3 -3
- package/dist/logs/checklogtable.js +67 -67
- package/dist/logs/log.table.d.ts +7 -7
- package/dist/logs/log.table.js +127 -127
- package/dist/modals/connection.modal.d.ts +32 -32
- package/dist/modals/connection.modal.js +2 -2
- package/dist/modals/globalNotification.modal.d.ts +8 -8
- package/dist/modals/globalNotification.modal.js +2 -2
- package/dist/modals/log.modal.d.ts +64 -64
- package/dist/modals/log.modal.js +2 -2
- package/dist/modals/mail.modal.d.ts +6 -6
- package/dist/modals/mail.modal.js +2 -2
- package/dist/modals/notificationData.modal.d.ts +29 -29
- package/dist/modals/notificationData.modal.js +2 -2
- package/dist/modals/redisconfig.modal.d.ts +6 -6
- package/dist/modals/redisconfig.modal.js +2 -2
- package/dist/modals/sqsconfig.modal.d.ts +7 -7
- package/dist/modals/sqsconfig.modal.js +2 -2
- package/dist/modals/utility.modal.d.ts +17 -17
- package/dist/modals/utility.modal.js +2 -2
- package/dist/utility/crypto.d.ts +4 -4
- package/dist/utility/crypto.js +43 -43
- package/dist/utility/errorHandler.d.ts +30 -30
- package/dist/utility/errorHandler.js +24 -24
- package/dist/utility/errorHandlerForServices.d.ts +22 -22
- package/dist/utility/errorHandlerForServices.js +19 -19
- package/dist/utility/mail.d.ts +21 -21
- package/dist/utility/mail.js +87 -87
- package/package.json +56 -56
package/dist/lib/event.js
CHANGED
|
@@ -1,171 +1,171 @@
|
|
|
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 __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
-
function step(op) {
|
|
16
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
-
while (_) try {
|
|
18
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
-
switch (op[0]) {
|
|
21
|
-
case 0: case 1: t = op; break;
|
|
22
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
-
default:
|
|
26
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
-
if (t[2]) _.ops.pop();
|
|
31
|
-
_.trys.pop(); continue;
|
|
32
|
-
}
|
|
33
|
-
op = body.call(thisArg, _);
|
|
34
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
exports.Event = void 0;
|
|
40
|
-
var aws_sdk_1 = require("aws-sdk");
|
|
41
|
-
var uuid_1 = require("uuid");
|
|
42
|
-
var mongodb_1 = require("mongodb");
|
|
43
|
-
var Event = /** @class */ (function () {
|
|
44
|
-
function Event(eventConfig) {
|
|
45
|
-
var _this = this;
|
|
46
|
-
/**
|
|
47
|
-
* @param userId
|
|
48
|
-
* @param db company DB
|
|
49
|
-
* @param data Notification Object to send Push Notification, EMail and socket Events
|
|
50
|
-
*/
|
|
51
|
-
this.CreateEvent = function (userId, db, data) { return __awaiter(_this, void 0, void 0, function () {
|
|
52
|
-
var _this = this;
|
|
53
|
-
return __generator(this, function (_a) {
|
|
54
|
-
return [2 /*return*/, new Promise(function (resolve, reject) { return __awaiter(_this, void 0, void 0, function () {
|
|
55
|
-
var userObj, uniqueID, params;
|
|
56
|
-
return __generator(this, function (_a) {
|
|
57
|
-
switch (_a.label) {
|
|
58
|
-
case 0:
|
|
59
|
-
if (!(db && userId && data && data.PushNotificationObj && !data.PushNotificationObj["endpoint"])) return [3 /*break*/, 2];
|
|
60
|
-
return [4 /*yield*/, db.collection('UserNotification').findOne({ UserID: new mongodb_1.ObjectId(userId) })];
|
|
61
|
-
case 1:
|
|
62
|
-
userObj = _a.sent();
|
|
63
|
-
if (userObj && userObj.endpoint && userObj.keys && data.PushNotificationObj) {
|
|
64
|
-
data.PushNotificationObj["endpoint"] = userObj.endpoint;
|
|
65
|
-
data.PushNotificationObj["keys"] = userObj.keys;
|
|
66
|
-
}
|
|
67
|
-
else {
|
|
68
|
-
delete data.PushNotificationObj;
|
|
69
|
-
}
|
|
70
|
-
_a.label = 2;
|
|
71
|
-
case 2:
|
|
72
|
-
// if (userId && data.SocketObj && !data.SocketObj.userId) {
|
|
73
|
-
//QPC-7064, Ankush changes added
|
|
74
|
-
if (userId && data.SocketObj && data.SocketObj.userId != userId) {
|
|
75
|
-
data.SocketObj["userId"] = userId;
|
|
76
|
-
}
|
|
77
|
-
uniqueID = uuid_1.v4() + "-" + Math.floor(Math.random() * 100000000);
|
|
78
|
-
params = {
|
|
79
|
-
MessageGroupId: uniqueID,
|
|
80
|
-
MessageDeduplicationId: uniqueID,
|
|
81
|
-
MessageBody: JSON.stringify(data),
|
|
82
|
-
QueueUrl: this.queueURL
|
|
83
|
-
};
|
|
84
|
-
console.log('Queue enter---->', params);
|
|
85
|
-
this.sqs.sendMessage(params, function (err, data) {
|
|
86
|
-
if (err) {
|
|
87
|
-
reject(err);
|
|
88
|
-
console.log('Queue reject---->', err);
|
|
89
|
-
}
|
|
90
|
-
else {
|
|
91
|
-
resolve(data.MessageId);
|
|
92
|
-
console.log('Queue resolve---->', data);
|
|
93
|
-
}
|
|
94
|
-
});
|
|
95
|
-
return [2 /*return*/];
|
|
96
|
-
}
|
|
97
|
-
});
|
|
98
|
-
}); })];
|
|
99
|
-
});
|
|
100
|
-
}); };
|
|
101
|
-
/**
|
|
102
|
-
* @param userIds
|
|
103
|
-
* @param db
|
|
104
|
-
* @param data notification object
|
|
105
|
-
* @description to send push notification, desktop notification, Email notification to user
|
|
106
|
-
*/
|
|
107
|
-
this.CreateEvents = function (userIds, db, data) { return __awaiter(_this, void 0, void 0, function () {
|
|
108
|
-
var promiseArr;
|
|
109
|
-
var _this = this;
|
|
110
|
-
return __generator(this, function (_a) {
|
|
111
|
-
promiseArr = [];
|
|
112
|
-
if (userIds && userIds.length > 0 && db) {
|
|
113
|
-
userIds.forEach(function (userId) {
|
|
114
|
-
promiseArr.push(_this.CreateEvent(userId, db, data));
|
|
115
|
-
});
|
|
116
|
-
}
|
|
117
|
-
return [2 /*return*/, Promise.all(promiseArr)];
|
|
118
|
-
});
|
|
119
|
-
}); };
|
|
120
|
-
this.RefreshNotificationBar = function (userId) {
|
|
121
|
-
_this.CreateEvent(userId, null, {
|
|
122
|
-
SocketObj: {
|
|
123
|
-
eventType: "refresh-notification",
|
|
124
|
-
data: "Refresh Notification"
|
|
125
|
-
}
|
|
126
|
-
});
|
|
127
|
-
};
|
|
128
|
-
this.SetGlobalNotification = function (data, db) {
|
|
129
|
-
return new Promise(function (resolve, reject) {
|
|
130
|
-
var saveObj = {
|
|
131
|
-
IsActive: true,
|
|
132
|
-
CreatedDate: new Date(),
|
|
133
|
-
Users: [],
|
|
134
|
-
EventObjectName: data.EventObjectName,
|
|
135
|
-
EventID: new mongodb_1.ObjectId(data.EventID),
|
|
136
|
-
CreatedBy: new mongodb_1.ObjectId(data.CreatedBy),
|
|
137
|
-
Message: data.Message
|
|
138
|
-
};
|
|
139
|
-
var Userid = [];
|
|
140
|
-
data.UserIds.forEach(function (id) {
|
|
141
|
-
Userid.push({
|
|
142
|
-
"IsSeen": false,
|
|
143
|
-
"IsNew": true,
|
|
144
|
-
"UserID": new mongodb_1.ObjectId(id)
|
|
145
|
-
});
|
|
146
|
-
});
|
|
147
|
-
saveObj.Users = Userid;
|
|
148
|
-
db.collection("Notification").insertOne(saveObj, function (error, result) {
|
|
149
|
-
if (error) {
|
|
150
|
-
reject(error);
|
|
151
|
-
}
|
|
152
|
-
else {
|
|
153
|
-
resolve(result);
|
|
154
|
-
data.UserIds.forEach(function (id) {
|
|
155
|
-
_this.RefreshNotificationBar(id.toString());
|
|
156
|
-
});
|
|
157
|
-
}
|
|
158
|
-
});
|
|
159
|
-
});
|
|
160
|
-
};
|
|
161
|
-
this.queueURL = eventConfig.QUEUE_URL;
|
|
162
|
-
this.sqs = new aws_sdk_1.SQS({
|
|
163
|
-
apiVersion: eventConfig.SQS_API_VERSION,
|
|
164
|
-
region: eventConfig.SQS_REGION,
|
|
165
|
-
accessKeyId: eventConfig.SQS_ACCESSKEY_ID,
|
|
166
|
-
secretAccessKey: eventConfig.SQS_SECRET_KEY
|
|
167
|
-
});
|
|
168
|
-
}
|
|
169
|
-
return Event;
|
|
170
|
-
}());
|
|
171
|
-
exports.Event = Event;
|
|
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 __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
+
function step(op) {
|
|
16
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
+
while (_) try {
|
|
18
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
+
switch (op[0]) {
|
|
21
|
+
case 0: case 1: t = op; break;
|
|
22
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
+
default:
|
|
26
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
+
if (t[2]) _.ops.pop();
|
|
31
|
+
_.trys.pop(); continue;
|
|
32
|
+
}
|
|
33
|
+
op = body.call(thisArg, _);
|
|
34
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
exports.Event = void 0;
|
|
40
|
+
var aws_sdk_1 = require("aws-sdk");
|
|
41
|
+
var uuid_1 = require("uuid");
|
|
42
|
+
var mongodb_1 = require("mongodb");
|
|
43
|
+
var Event = /** @class */ (function () {
|
|
44
|
+
function Event(eventConfig) {
|
|
45
|
+
var _this = this;
|
|
46
|
+
/**
|
|
47
|
+
* @param userId
|
|
48
|
+
* @param db company DB
|
|
49
|
+
* @param data Notification Object to send Push Notification, EMail and socket Events
|
|
50
|
+
*/
|
|
51
|
+
this.CreateEvent = function (userId, db, data) { return __awaiter(_this, void 0, void 0, function () {
|
|
52
|
+
var _this = this;
|
|
53
|
+
return __generator(this, function (_a) {
|
|
54
|
+
return [2 /*return*/, new Promise(function (resolve, reject) { return __awaiter(_this, void 0, void 0, function () {
|
|
55
|
+
var userObj, uniqueID, params;
|
|
56
|
+
return __generator(this, function (_a) {
|
|
57
|
+
switch (_a.label) {
|
|
58
|
+
case 0:
|
|
59
|
+
if (!(db && userId && data && data.PushNotificationObj && !data.PushNotificationObj["endpoint"])) return [3 /*break*/, 2];
|
|
60
|
+
return [4 /*yield*/, db.collection('UserNotification').findOne({ UserID: new mongodb_1.ObjectId(userId) })];
|
|
61
|
+
case 1:
|
|
62
|
+
userObj = _a.sent();
|
|
63
|
+
if (userObj && userObj.endpoint && userObj.keys && data.PushNotificationObj) {
|
|
64
|
+
data.PushNotificationObj["endpoint"] = userObj.endpoint;
|
|
65
|
+
data.PushNotificationObj["keys"] = userObj.keys;
|
|
66
|
+
}
|
|
67
|
+
else {
|
|
68
|
+
delete data.PushNotificationObj;
|
|
69
|
+
}
|
|
70
|
+
_a.label = 2;
|
|
71
|
+
case 2:
|
|
72
|
+
// if (userId && data.SocketObj && !data.SocketObj.userId) {
|
|
73
|
+
//QPC-7064, Ankush changes added
|
|
74
|
+
if (userId && data.SocketObj && data.SocketObj.userId != userId) {
|
|
75
|
+
data.SocketObj["userId"] = userId;
|
|
76
|
+
}
|
|
77
|
+
uniqueID = uuid_1.v4() + "-" + Math.floor(Math.random() * 100000000);
|
|
78
|
+
params = {
|
|
79
|
+
MessageGroupId: uniqueID,
|
|
80
|
+
MessageDeduplicationId: uniqueID,
|
|
81
|
+
MessageBody: JSON.stringify(data),
|
|
82
|
+
QueueUrl: this.queueURL
|
|
83
|
+
};
|
|
84
|
+
console.log('Queue enter---->', params);
|
|
85
|
+
this.sqs.sendMessage(params, function (err, data) {
|
|
86
|
+
if (err) {
|
|
87
|
+
reject(err);
|
|
88
|
+
console.log('Queue reject---->', err);
|
|
89
|
+
}
|
|
90
|
+
else {
|
|
91
|
+
resolve(data.MessageId);
|
|
92
|
+
console.log('Queue resolve---->', data);
|
|
93
|
+
}
|
|
94
|
+
});
|
|
95
|
+
return [2 /*return*/];
|
|
96
|
+
}
|
|
97
|
+
});
|
|
98
|
+
}); })];
|
|
99
|
+
});
|
|
100
|
+
}); };
|
|
101
|
+
/**
|
|
102
|
+
* @param userIds
|
|
103
|
+
* @param db
|
|
104
|
+
* @param data notification object
|
|
105
|
+
* @description to send push notification, desktop notification, Email notification to user
|
|
106
|
+
*/
|
|
107
|
+
this.CreateEvents = function (userIds, db, data) { return __awaiter(_this, void 0, void 0, function () {
|
|
108
|
+
var promiseArr;
|
|
109
|
+
var _this = this;
|
|
110
|
+
return __generator(this, function (_a) {
|
|
111
|
+
promiseArr = [];
|
|
112
|
+
if (userIds && userIds.length > 0 && db) {
|
|
113
|
+
userIds.forEach(function (userId) {
|
|
114
|
+
promiseArr.push(_this.CreateEvent(userId, db, data));
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
return [2 /*return*/, Promise.all(promiseArr)];
|
|
118
|
+
});
|
|
119
|
+
}); };
|
|
120
|
+
this.RefreshNotificationBar = function (userId) {
|
|
121
|
+
_this.CreateEvent(userId, null, {
|
|
122
|
+
SocketObj: {
|
|
123
|
+
eventType: "refresh-notification",
|
|
124
|
+
data: "Refresh Notification"
|
|
125
|
+
}
|
|
126
|
+
});
|
|
127
|
+
};
|
|
128
|
+
this.SetGlobalNotification = function (data, db) {
|
|
129
|
+
return new Promise(function (resolve, reject) {
|
|
130
|
+
var saveObj = {
|
|
131
|
+
IsActive: true,
|
|
132
|
+
CreatedDate: new Date(),
|
|
133
|
+
Users: [],
|
|
134
|
+
EventObjectName: data.EventObjectName,
|
|
135
|
+
EventID: new mongodb_1.ObjectId(data.EventID),
|
|
136
|
+
CreatedBy: new mongodb_1.ObjectId(data.CreatedBy),
|
|
137
|
+
Message: data.Message
|
|
138
|
+
};
|
|
139
|
+
var Userid = [];
|
|
140
|
+
data.UserIds.forEach(function (id) {
|
|
141
|
+
Userid.push({
|
|
142
|
+
"IsSeen": false,
|
|
143
|
+
"IsNew": true,
|
|
144
|
+
"UserID": new mongodb_1.ObjectId(id)
|
|
145
|
+
});
|
|
146
|
+
});
|
|
147
|
+
saveObj.Users = Userid;
|
|
148
|
+
db.collection("Notification").insertOne(saveObj, function (error, result) {
|
|
149
|
+
if (error) {
|
|
150
|
+
reject(error);
|
|
151
|
+
}
|
|
152
|
+
else {
|
|
153
|
+
resolve(result);
|
|
154
|
+
data.UserIds.forEach(function (id) {
|
|
155
|
+
_this.RefreshNotificationBar(id.toString());
|
|
156
|
+
});
|
|
157
|
+
}
|
|
158
|
+
});
|
|
159
|
+
});
|
|
160
|
+
};
|
|
161
|
+
this.queueURL = eventConfig.QUEUE_URL;
|
|
162
|
+
this.sqs = new aws_sdk_1.SQS({
|
|
163
|
+
apiVersion: eventConfig.SQS_API_VERSION,
|
|
164
|
+
region: eventConfig.SQS_REGION,
|
|
165
|
+
accessKeyId: eventConfig.SQS_ACCESSKEY_ID,
|
|
166
|
+
secretAccessKey: eventConfig.SQS_SECRET_KEY
|
|
167
|
+
});
|
|
168
|
+
}
|
|
169
|
+
return Event;
|
|
170
|
+
}());
|
|
171
|
+
exports.Event = Event;
|
package/dist/lib/helper.d.ts
CHANGED
|
@@ -1,93 +1,93 @@
|
|
|
1
|
-
import { Db, ObjectId } from "mongodb";
|
|
2
|
-
import { AnyObjectInterface } from "../modals/utility.modal";
|
|
3
|
-
declare function GetCompanyDetails(Master_DB: Db, companyId: string): Promise<any>;
|
|
4
|
-
declare function GetListSchema(db: Db, listName: string): Promise<Error | AnyObjectInterface[] | []>;
|
|
5
|
-
declare function GetEmailwiseUnsubscribeData(db: Db, mailID: string, domainID?: string): Promise<Error | AnyObjectInterface[] | []>;
|
|
6
|
-
declare function GenerateAutoIncrementFieldValue(db: Db, autoIncrementID: string): Promise<null | string>;
|
|
7
|
-
declare function GetAccountDetailByName(db: Db, accountName: string): Promise<AnyObjectInterface | null>;
|
|
8
|
-
declare function GetContactDetailByEmail(db: Db, contactEmail: string): Promise<null | AnyObjectInterface>;
|
|
9
|
-
declare function GetSystemEmailTemplate(db: Db, TemplateIDArray: ObjectId[]): Promise<null | AnyObjectInterface>;
|
|
10
|
-
declare function UpdateContactDetails(db: Db, contactData: AnyObjectInterface): void;
|
|
11
|
-
declare function CreateContact(db: Db, contactData: AnyObjectInterface): Promise<null | AnyObjectInterface>;
|
|
12
|
-
declare function MapAccountContact(db: Db, dataObj: AnyObjectInterface): void;
|
|
13
|
-
declare function UpdatePipelineMailStatus(db: Db, pipelineID: string, mailStatus: any): void;
|
|
14
|
-
declare function AddLog(db: Db, data: any): void;
|
|
15
|
-
/**
|
|
16
|
-
* Returns object - To and From date from given operator value
|
|
17
|
-
*
|
|
18
|
-
* @param {string} operator today/yesterday/tomorrow
|
|
19
|
-
* @return { dates } object container start and end date
|
|
20
|
-
*/
|
|
21
|
-
declare const GetDateRangeFromOperatorValue: (operator: any, fiscalMonth: any, fiscalFrom: any) => {
|
|
22
|
-
startDate: any;
|
|
23
|
-
endDate: any;
|
|
24
|
-
};
|
|
25
|
-
/**
|
|
26
|
-
* Returns boolean - Check date exist in Given Date Range(Quarter)
|
|
27
|
-
*
|
|
28
|
-
* @param {string} date date to compare
|
|
29
|
-
* @param {string} startDate format DD-MMM-YYYY
|
|
30
|
-
* @param {string} endDate format DD-MMM-YYYY
|
|
31
|
-
* @return { boolean } true/false
|
|
32
|
-
*/
|
|
33
|
-
declare const CheckDateExistInRange: (date: any, startDate: any, endDate: any) => boolean;
|
|
34
|
-
/**
|
|
35
|
-
* To get the email subscribe status. By default it take email as subscribed
|
|
36
|
-
* and check if email is unsusbscribed for all categories of all domains then it give it as unsubscribe.
|
|
37
|
-
* @param {db} database object
|
|
38
|
-
* @param {email} string
|
|
39
|
-
*
|
|
40
|
-
* @param retunrs true|false|error for subscribe or unsubscribe.
|
|
41
|
-
*/
|
|
42
|
-
declare const GetEmailSubscribeStatus: (db: Db, email: string) => Promise<Error | boolean>;
|
|
43
|
-
/**
|
|
44
|
-
* To subscribe or unsubscribe email id for all domains
|
|
45
|
-
* @param {db} database object
|
|
46
|
-
* @param {email} string
|
|
47
|
-
* @param {isSubscribe} boolean
|
|
48
|
-
* @param {companyID} mongodb object id, comany id of email
|
|
49
|
-
* @param {comment} string , to add comment
|
|
50
|
-
* @param {mongodbQueryOptions} object, params to pass on db queries
|
|
51
|
-
* @returns resolve success | error object
|
|
52
|
-
*/
|
|
53
|
-
declare const SubscribeEmailForAllDomains: (db: Db, email: string, isSubscribe: boolean, companyID:
|
|
54
|
-
/**
|
|
55
|
-
* checking phone number is valid and has dialing code
|
|
56
|
-
* if it has dialing code then get country code, get its optimiser country phone code
|
|
57
|
-
* if it doesn't has dialing code then try to pasrse it with countryCode
|
|
58
|
-
* if phone is valid then use it other wise ignore that no.
|
|
59
|
-
* @param {phoneNumber} string, phone no with or without dialing code
|
|
60
|
-
* @param {countryCode} string, ISO country code
|
|
61
|
-
* @returns {
|
|
62
|
-
IsValid: boolean, //phone is valid or not
|
|
63
|
-
CountryCode?: string, //phone country code
|
|
64
|
-
PhoneCallingCode?: CountryCallingCode, //phone country calling code
|
|
65
|
-
PhoneNumberParsed?: NationalNumber, //phone no local to the country, without country calling code and only digits
|
|
66
|
-
Error: Error
|
|
67
|
-
}
|
|
68
|
-
*/
|
|
69
|
-
declare const IsValidPhoneNumber: (phoneNumber: string, countryCode: string) => AnyObjectInterface;
|
|
70
|
-
/**
|
|
71
|
-
*
|
|
72
|
-
* Server side field validatinon
|
|
73
|
-
* @param {db} object database connection
|
|
74
|
-
* @param {dataObj} object contains field data
|
|
75
|
-
* @param {objectType} string object name
|
|
76
|
-
* @param {countryCode} string, ISO country code
|
|
77
|
-
* @returns {
|
|
78
|
-
IsValid: boolean, //phone is valid or not
|
|
79
|
-
CountryCode?: string, //phone country code
|
|
80
|
-
PhoneCallingCode?: CountryCallingCode, //phone country calling code
|
|
81
|
-
PhoneNumberParsed?: NationalNumber, //phone no local to the country, without country calling code and only digits
|
|
82
|
-
Error: Error
|
|
83
|
-
}
|
|
84
|
-
*/
|
|
85
|
-
declare function ValidateData(db: Db, dataObj: AnyObjectInterface, objectType: string): Promise<unknown>;
|
|
86
|
-
/**
|
|
87
|
-
* Returns boolean - Whether given date is future or not
|
|
88
|
-
*
|
|
89
|
-
* @param {string} date date
|
|
90
|
-
* @return { boolean } true/false
|
|
91
|
-
*/
|
|
92
|
-
declare const IsFutureDate: (date: any) => boolean;
|
|
93
|
-
export { GetCompanyDetails, GetListSchema, GetEmailwiseUnsubscribeData, GenerateAutoIncrementFieldValue, GetAccountDetailByName, GetContactDetailByEmail, GetSystemEmailTemplate, UpdateContactDetails, CreateContact, MapAccountContact, UpdatePipelineMailStatus, AddLog, CheckDateExistInRange, GetDateRangeFromOperatorValue, GetEmailSubscribeStatus, SubscribeEmailForAllDomains, IsValidPhoneNumber, ValidateData, IsFutureDate };
|
|
1
|
+
import { Db, ObjectId } from "mongodb";
|
|
2
|
+
import { AnyObjectInterface } from "../modals/utility.modal";
|
|
3
|
+
declare function GetCompanyDetails(Master_DB: Db, companyId: string): Promise<any>;
|
|
4
|
+
declare function GetListSchema(db: Db, listName: string): Promise<Error | AnyObjectInterface[] | []>;
|
|
5
|
+
declare function GetEmailwiseUnsubscribeData(db: Db, mailID: string, domainID?: string): Promise<Error | AnyObjectInterface[] | []>;
|
|
6
|
+
declare function GenerateAutoIncrementFieldValue(db: Db, autoIncrementID: string): Promise<null | string>;
|
|
7
|
+
declare function GetAccountDetailByName(db: Db, accountName: string): Promise<AnyObjectInterface | null>;
|
|
8
|
+
declare function GetContactDetailByEmail(db: Db, contactEmail: string): Promise<null | AnyObjectInterface>;
|
|
9
|
+
declare function GetSystemEmailTemplate(db: Db, TemplateIDArray: ObjectId[]): Promise<null | AnyObjectInterface>;
|
|
10
|
+
declare function UpdateContactDetails(db: Db, contactData: AnyObjectInterface): void;
|
|
11
|
+
declare function CreateContact(db: Db, contactData: AnyObjectInterface): Promise<null | AnyObjectInterface>;
|
|
12
|
+
declare function MapAccountContact(db: Db, dataObj: AnyObjectInterface): void;
|
|
13
|
+
declare function UpdatePipelineMailStatus(db: Db, pipelineID: string, mailStatus: any): void;
|
|
14
|
+
declare function AddLog(db: Db, data: any): void;
|
|
15
|
+
/**
|
|
16
|
+
* Returns object - To and From date from given operator value
|
|
17
|
+
*
|
|
18
|
+
* @param {string} operator today/yesterday/tomorrow
|
|
19
|
+
* @return { dates } object container start and end date
|
|
20
|
+
*/
|
|
21
|
+
declare const GetDateRangeFromOperatorValue: (operator: any, fiscalMonth: any, fiscalFrom: any) => {
|
|
22
|
+
startDate: any;
|
|
23
|
+
endDate: any;
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* Returns boolean - Check date exist in Given Date Range(Quarter)
|
|
27
|
+
*
|
|
28
|
+
* @param {string} date date to compare
|
|
29
|
+
* @param {string} startDate format DD-MMM-YYYY
|
|
30
|
+
* @param {string} endDate format DD-MMM-YYYY
|
|
31
|
+
* @return { boolean } true/false
|
|
32
|
+
*/
|
|
33
|
+
declare const CheckDateExistInRange: (date: any, startDate: any, endDate: any) => boolean;
|
|
34
|
+
/**
|
|
35
|
+
* To get the email subscribe status. By default it take email as subscribed
|
|
36
|
+
* and check if email is unsusbscribed for all categories of all domains then it give it as unsubscribe.
|
|
37
|
+
* @param {db} database object
|
|
38
|
+
* @param {email} string
|
|
39
|
+
*
|
|
40
|
+
* @param retunrs true|false|error for subscribe or unsubscribe.
|
|
41
|
+
*/
|
|
42
|
+
declare const GetEmailSubscribeStatus: (db: Db, email: string) => Promise<Error | boolean>;
|
|
43
|
+
/**
|
|
44
|
+
* To subscribe or unsubscribe email id for all domains
|
|
45
|
+
* @param {db} database object
|
|
46
|
+
* @param {email} string
|
|
47
|
+
* @param {isSubscribe} boolean
|
|
48
|
+
* @param {companyID} mongodb object id, comany id of email
|
|
49
|
+
* @param {comment} string , to add comment
|
|
50
|
+
* @param {mongodbQueryOptions} object, params to pass on db queries
|
|
51
|
+
* @returns resolve success | error object
|
|
52
|
+
*/
|
|
53
|
+
declare const SubscribeEmailForAllDomains: (db: Db, email: string, isSubscribe: boolean, companyID: ObjectId, comment?: string, mongodbQueryOptions?: any) => Promise<unknown>;
|
|
54
|
+
/**
|
|
55
|
+
* checking phone number is valid and has dialing code
|
|
56
|
+
* if it has dialing code then get country code, get its optimiser country phone code
|
|
57
|
+
* if it doesn't has dialing code then try to pasrse it with countryCode
|
|
58
|
+
* if phone is valid then use it other wise ignore that no.
|
|
59
|
+
* @param {phoneNumber} string, phone no with or without dialing code
|
|
60
|
+
* @param {countryCode} string, ISO country code
|
|
61
|
+
* @returns {
|
|
62
|
+
IsValid: boolean, //phone is valid or not
|
|
63
|
+
CountryCode?: string, //phone country code
|
|
64
|
+
PhoneCallingCode?: CountryCallingCode, //phone country calling code
|
|
65
|
+
PhoneNumberParsed?: NationalNumber, //phone no local to the country, without country calling code and only digits
|
|
66
|
+
Error: Error
|
|
67
|
+
}
|
|
68
|
+
*/
|
|
69
|
+
declare const IsValidPhoneNumber: (phoneNumber: string, countryCode: string) => AnyObjectInterface;
|
|
70
|
+
/**
|
|
71
|
+
*
|
|
72
|
+
* Server side field validatinon
|
|
73
|
+
* @param {db} object database connection
|
|
74
|
+
* @param {dataObj} object contains field data
|
|
75
|
+
* @param {objectType} string object name
|
|
76
|
+
* @param {countryCode} string, ISO country code
|
|
77
|
+
* @returns {
|
|
78
|
+
IsValid: boolean, //phone is valid or not
|
|
79
|
+
CountryCode?: string, //phone country code
|
|
80
|
+
PhoneCallingCode?: CountryCallingCode, //phone country calling code
|
|
81
|
+
PhoneNumberParsed?: NationalNumber, //phone no local to the country, without country calling code and only digits
|
|
82
|
+
Error: Error
|
|
83
|
+
}
|
|
84
|
+
*/
|
|
85
|
+
declare function ValidateData(db: Db, dataObj: AnyObjectInterface, objectType: string): Promise<unknown>;
|
|
86
|
+
/**
|
|
87
|
+
* Returns boolean - Whether given date is future or not
|
|
88
|
+
*
|
|
89
|
+
* @param {string} date date
|
|
90
|
+
* @return { boolean } true/false
|
|
91
|
+
*/
|
|
92
|
+
declare const IsFutureDate: (date: any) => boolean;
|
|
93
|
+
export { GetCompanyDetails, GetListSchema, GetEmailwiseUnsubscribeData, GenerateAutoIncrementFieldValue, GetAccountDetailByName, GetContactDetailByEmail, GetSystemEmailTemplate, UpdateContactDetails, CreateContact, MapAccountContact, UpdatePipelineMailStatus, AddLog, CheckDateExistInRange, GetDateRangeFromOperatorValue, GetEmailSubscribeStatus, SubscribeEmailForAllDomains, IsValidPhoneNumber, ValidateData, IsFutureDate };
|