@optimiser/common 1.0.365 → 1.0.367
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 +69 -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 +26 -26
- package/dist/lib/event.js +252 -248
- package/dist/lib/helper.d.ts +94 -93
- package/dist/lib/helper.js +1016 -1009
- package/dist/lib/memoryserverclient.d.ts +40 -40
- package/dist/lib/memoryserverclient.js +256 -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 +300 -298
- package/dist/lib/utility.js +5626 -5621
- 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 +1033 -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 +8 -8
- 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 +91 -87
- package/package.json +3 -3
package/dist/lib/event.js
CHANGED
|
@@ -1,248 +1,252 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
return
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
return
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
if (t[
|
|
50
|
-
_.
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
var
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
case
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
if (!
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
return [
|
|
126
|
-
case
|
|
127
|
-
|
|
128
|
-
console.log('
|
|
129
|
-
return [3 /*break*/, 6];
|
|
130
|
-
case
|
|
131
|
-
|
|
132
|
-
console.log('
|
|
133
|
-
|
|
134
|
-
case 8
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
console.log('Queue
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
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
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
26
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
27
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
28
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
29
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
30
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
31
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
32
|
+
});
|
|
33
|
+
};
|
|
34
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
35
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
36
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
37
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
38
|
+
function step(op) {
|
|
39
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
40
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
41
|
+
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;
|
|
42
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
43
|
+
switch (op[0]) {
|
|
44
|
+
case 0: case 1: t = op; break;
|
|
45
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
46
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
47
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
48
|
+
default:
|
|
49
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
50
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
51
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
52
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
53
|
+
if (t[2]) _.ops.pop();
|
|
54
|
+
_.trys.pop(); continue;
|
|
55
|
+
}
|
|
56
|
+
op = body.call(thisArg, _);
|
|
57
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
58
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
62
|
+
exports.Event = void 0;
|
|
63
|
+
var aws_sdk_1 = require("aws-sdk");
|
|
64
|
+
var uuid_1 = require("uuid");
|
|
65
|
+
var mongodb_1 = require("mongodb");
|
|
66
|
+
var admin = __importStar(require("firebase-admin"));
|
|
67
|
+
var Event = /** @class */ (function () {
|
|
68
|
+
function Event(eventConfig) {
|
|
69
|
+
var _this = this;
|
|
70
|
+
/**
|
|
71
|
+
* @param userId
|
|
72
|
+
* @param db company DB
|
|
73
|
+
* @param data Notification Object to send Push Notification, EMail and socket Events
|
|
74
|
+
*/
|
|
75
|
+
this.CreateEvent = function (userId, db, data) { return __awaiter(_this, void 0, void 0, function () {
|
|
76
|
+
var _this = this;
|
|
77
|
+
return __generator(this, function (_a) {
|
|
78
|
+
return [2 /*return*/, new Promise(function (resolve, reject) { return __awaiter(_this, void 0, void 0, function () {
|
|
79
|
+
var notificationDataObj, userObj, userDeviceInfoObj, message, response, error_1, uniqueID, params;
|
|
80
|
+
return __generator(this, function (_a) {
|
|
81
|
+
switch (_a.label) {
|
|
82
|
+
case 0:
|
|
83
|
+
if (!(db && userId && data && data.PushNotificationObj && !data.PushNotificationObj["endpoint"])) return [3 /*break*/, 8];
|
|
84
|
+
notificationDataObj = data.PushNotificationObj;
|
|
85
|
+
return [4 /*yield*/, db.collection('UserNotification').findOne({ UserID: new mongodb_1.ObjectId(userId) })];
|
|
86
|
+
case 1:
|
|
87
|
+
userObj = _a.sent();
|
|
88
|
+
if (userObj && userObj.endpoint && userObj.keys && data.PushNotificationObj) {
|
|
89
|
+
data.PushNotificationObj["endpoint"] = userObj.endpoint;
|
|
90
|
+
data.PushNotificationObj["keys"] = userObj.keys;
|
|
91
|
+
}
|
|
92
|
+
else {
|
|
93
|
+
delete data.PushNotificationObj;
|
|
94
|
+
}
|
|
95
|
+
if (!this.FCMMobileServiceAccountKey) return [3 /*break*/, 7];
|
|
96
|
+
return [4 /*yield*/, db.collection('UserMobileNotification').findOne({ UserID: new mongodb_1.ObjectId(userId) })];
|
|
97
|
+
case 2:
|
|
98
|
+
userDeviceInfoObj = _a.sent();
|
|
99
|
+
if (!(userDeviceInfoObj && userDeviceInfoObj.deviceToken && notificationDataObj)) return [3 /*break*/, 6];
|
|
100
|
+
message = {
|
|
101
|
+
token: userDeviceInfoObj.deviceToken,
|
|
102
|
+
notification: {
|
|
103
|
+
title: notificationDataObj.title,
|
|
104
|
+
body: notificationDataObj.message
|
|
105
|
+
},
|
|
106
|
+
android: {
|
|
107
|
+
notification: {
|
|
108
|
+
sound: 'default' // added by komal Include the default sound for Android
|
|
109
|
+
},
|
|
110
|
+
priority: 'high' // You can set the priority to 'high' or 'normal' for Android
|
|
111
|
+
},
|
|
112
|
+
apns: {
|
|
113
|
+
payload: {
|
|
114
|
+
aps: {
|
|
115
|
+
contentAvailable: true,
|
|
116
|
+
sound: 'default' // added by komal Include the default sound for iOS
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
},
|
|
120
|
+
data: notificationDataObj // changes done by komal, to get data attr val in notification
|
|
121
|
+
};
|
|
122
|
+
_a.label = 3;
|
|
123
|
+
case 3:
|
|
124
|
+
_a.trys.push([3, 5, , 6]);
|
|
125
|
+
return [4 /*yield*/, admin.messaging().send(message)];
|
|
126
|
+
case 4:
|
|
127
|
+
response = _a.sent();
|
|
128
|
+
console.log('Successfully sent FCM notify(Mobile) message:', response);
|
|
129
|
+
return [3 /*break*/, 6];
|
|
130
|
+
case 5:
|
|
131
|
+
error_1 = _a.sent();
|
|
132
|
+
console.log('ERROR WHILE sent FCM notify(Mobile) message:', error_1.stack);
|
|
133
|
+
return [3 /*break*/, 6];
|
|
134
|
+
case 6: return [3 /*break*/, 8];
|
|
135
|
+
case 7:
|
|
136
|
+
console.log('Attention!!-- We are not sending mobile notifications due to lack of FIREBASE ADMIN APP configurations.\n Please provide firebaseSet-up.JSON file.');
|
|
137
|
+
_a.label = 8;
|
|
138
|
+
case 8:
|
|
139
|
+
// if (userId && data.SocketObj && !data.SocketObj.userId) {
|
|
140
|
+
//QPC-7064, Ankush changes added
|
|
141
|
+
if (userId && data.SocketObj && data.SocketObj.userId != userId) {
|
|
142
|
+
data.SocketObj["userId"] = userId;
|
|
143
|
+
}
|
|
144
|
+
uniqueID = "".concat((0, uuid_1.v4)(), "-").concat(Math.floor(Math.random() * 100000000));
|
|
145
|
+
params = {
|
|
146
|
+
MessageGroupId: uniqueID,
|
|
147
|
+
MessageDeduplicationId: uniqueID,
|
|
148
|
+
MessageBody: JSON.stringify(data),
|
|
149
|
+
QueueUrl: this.queueURL
|
|
150
|
+
};
|
|
151
|
+
console.log('Queue enter---->', params);
|
|
152
|
+
this.sqs.sendMessage(params, function (err, data) {
|
|
153
|
+
if (err) {
|
|
154
|
+
reject(err);
|
|
155
|
+
console.log('Queue reject---->', err);
|
|
156
|
+
}
|
|
157
|
+
else {
|
|
158
|
+
resolve(data.MessageId);
|
|
159
|
+
console.log('Queue resolve---->', data);
|
|
160
|
+
}
|
|
161
|
+
});
|
|
162
|
+
return [2 /*return*/];
|
|
163
|
+
}
|
|
164
|
+
});
|
|
165
|
+
}); })];
|
|
166
|
+
});
|
|
167
|
+
}); };
|
|
168
|
+
/**
|
|
169
|
+
* @param userIds
|
|
170
|
+
* @param db
|
|
171
|
+
* @param data notification object
|
|
172
|
+
* @description to send push notification, desktop notification, Email notification to user
|
|
173
|
+
*/
|
|
174
|
+
this.CreateEvents = function (userIds, db, data) { return __awaiter(_this, void 0, void 0, function () {
|
|
175
|
+
var promiseArr;
|
|
176
|
+
var _this = this;
|
|
177
|
+
return __generator(this, function (_a) {
|
|
178
|
+
promiseArr = [];
|
|
179
|
+
if (userIds && userIds.length > 0 && db) {
|
|
180
|
+
userIds.forEach(function (userId) {
|
|
181
|
+
promiseArr.push(_this.CreateEvent(userId, db, data));
|
|
182
|
+
});
|
|
183
|
+
}
|
|
184
|
+
return [2 /*return*/, Promise.all(promiseArr)];
|
|
185
|
+
});
|
|
186
|
+
}); };
|
|
187
|
+
this.RefreshNotificationBar = function (userId) {
|
|
188
|
+
_this.CreateEvent(userId, null, {
|
|
189
|
+
SocketObj: {
|
|
190
|
+
eventType: "refresh-notification",
|
|
191
|
+
data: "Refresh Notification"
|
|
192
|
+
}
|
|
193
|
+
});
|
|
194
|
+
};
|
|
195
|
+
this.SetGlobalNotification = function (data, db) {
|
|
196
|
+
return new Promise(function (resolve, reject) {
|
|
197
|
+
var saveObj = {
|
|
198
|
+
IsActive: true,
|
|
199
|
+
CreatedDate: new Date(),
|
|
200
|
+
Users: [],
|
|
201
|
+
EventObjectName: data.EventObjectName,
|
|
202
|
+
EventID: new mongodb_1.ObjectId(data.EventID),
|
|
203
|
+
CreatedBy: new mongodb_1.ObjectId(data.CreatedBy),
|
|
204
|
+
Message: data.Message
|
|
205
|
+
};
|
|
206
|
+
var Userid = [];
|
|
207
|
+
data.UserIds.forEach(function (id) {
|
|
208
|
+
Userid.push({
|
|
209
|
+
"IsSeen": false,
|
|
210
|
+
"IsNew": true,
|
|
211
|
+
"UserID": new mongodb_1.ObjectId(id)
|
|
212
|
+
});
|
|
213
|
+
});
|
|
214
|
+
saveObj.Users = Userid;
|
|
215
|
+
db.collection("Notification").insertOne(saveObj, function (error, result) {
|
|
216
|
+
if (error) {
|
|
217
|
+
reject(error);
|
|
218
|
+
}
|
|
219
|
+
else {
|
|
220
|
+
resolve(result);
|
|
221
|
+
data.UserIds.forEach(function (id) {
|
|
222
|
+
_this.RefreshNotificationBar(id.toString());
|
|
223
|
+
});
|
|
224
|
+
}
|
|
225
|
+
});
|
|
226
|
+
});
|
|
227
|
+
};
|
|
228
|
+
this.queueURL = eventConfig.QUEUE_URL;
|
|
229
|
+
this.sqs = new aws_sdk_1.SQS({
|
|
230
|
+
apiVersion: eventConfig.SQS_API_VERSION,
|
|
231
|
+
region: eventConfig.SQS_REGION,
|
|
232
|
+
accessKeyId: eventConfig.SQS_ACCESSKEY_ID,
|
|
233
|
+
secretAccessKey: eventConfig.SQS_SECRET_KEY
|
|
234
|
+
});
|
|
235
|
+
this.FCMMobileServiceAccountKey = eventConfig === null || eventConfig === void 0 ? void 0 : eventConfig.FCM_NOTIFICATION_SERVICE_ACCOUNT_KEY;
|
|
236
|
+
if (eventConfig === null || eventConfig === void 0 ? void 0 : eventConfig.FCM_NOTIFICATION_SERVICE_ACCOUNT_KEY) { // scope added by komal, to handle the firebase warning,
|
|
237
|
+
try {
|
|
238
|
+
admin.initializeApp({
|
|
239
|
+
credential: admin.credential.cert(this.FCMMobileServiceAccountKey)
|
|
240
|
+
});
|
|
241
|
+
}
|
|
242
|
+
catch (error) {
|
|
243
|
+
console.log('Error while INITIALIZING FIREBASE ADMIN APP\n Please check firebaseSet-up.JSON file.\n This will impact mobile app notifications -----', error);
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
else {
|
|
247
|
+
console.log('We are not INITIALIZING mobile notifications due to lack of FIREBASE ADMIN APP configurations.\n Please provide firebaseSet-up.JSON file.');
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
return Event;
|
|
251
|
+
}());
|
|
252
|
+
exports.Event = Event;
|