@sipgate/integration-bridge 0.22.6 → 0.22.8

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.
Files changed (78) hide show
  1. package/README.md +28 -24
  2. package/dist/cache/index.d.ts +1 -1
  3. package/dist/cache/storage/index.d.ts +2 -2
  4. package/dist/cache/storage/memory-storage-adapter.d.ts +1 -1
  5. package/dist/cache/storage/redis-storage-adapter.d.ts +1 -1
  6. package/dist/cache/storage/redis-storage-adapter.js +10 -10
  7. package/dist/cache/storage-cache.d.ts +5 -6
  8. package/dist/cache/storage-cache.js +8 -14
  9. package/dist/cache/storage-cache.js.map +1 -1
  10. package/dist/index.d.ts +7 -7
  11. package/dist/index.js +27 -27
  12. package/dist/index.test.js +2 -2
  13. package/dist/middlewares/error-handler.middleware.d.ts +2 -2
  14. package/dist/middlewares/extract-header.middleware.d.ts +2 -2
  15. package/dist/middlewares/extract-header.middleware.js +5 -5
  16. package/dist/middlewares/index.d.ts +2 -2
  17. package/dist/models/adapter.model.d.ts +3 -3
  18. package/dist/models/api-contact.model.d.ts +1 -1
  19. package/dist/models/bridge-request.model.d.ts +3 -3
  20. package/dist/models/call-event.model.d.ts +1 -1
  21. package/dist/models/contact-cache.model.d.ts +2 -2
  22. package/dist/models/contact.model.d.ts +1 -1
  23. package/dist/models/controller.model.d.ts +3 -3
  24. package/dist/models/controller.model.js +156 -156
  25. package/dist/models/controller.model.test.js +125 -125
  26. package/dist/models/custom-router.model.d.ts +1 -1
  27. package/dist/models/custom-routes.model.d.ts +2 -2
  28. package/dist/models/index.d.ts +16 -16
  29. package/dist/models/pubsub-client.model.d.ts +1 -1
  30. package/dist/models/pubsub-client.model.js +2 -2
  31. package/dist/models/pubsub-contacts-message.model.d.ts +1 -1
  32. package/dist/models/server-error.model.js +1 -1
  33. package/dist/models/token-cache.model.d.ts +1 -1
  34. package/dist/schemas/calendar-events.js +10 -10
  35. package/dist/schemas/contacts.js +26 -26
  36. package/dist/schemas/index.d.ts +2 -2
  37. package/dist/util/anonymize-key.js +2 -2
  38. package/dist/util/anonymize-key.test.js +8 -8
  39. package/dist/util/call-comment.d.ts +1 -1
  40. package/dist/util/call-comment.js +12 -12
  41. package/dist/util/call-event.test.js +20 -20
  42. package/dist/util/call-event.util.d.ts +1 -1
  43. package/dist/util/callEventHelper.d.ts +1 -1
  44. package/dist/util/callEventHelper.js +6 -6
  45. package/dist/util/env.js +11 -11
  46. package/dist/util/error.d.ts +2 -2
  47. package/dist/util/error.js +3 -3
  48. package/dist/util/gdpr/gdprSlackNotification.d.ts +2 -2
  49. package/dist/util/gdpr/gdprSlackNotification.js +6 -6
  50. package/dist/util/gdpr/index.d.ts +2 -2
  51. package/dist/util/get-contact-cache.d.ts +1 -1
  52. package/dist/util/get-contact-cache.js +4 -4
  53. package/dist/util/get-contact-cache.js.map +1 -1
  54. package/dist/util/http/index.d.ts +6 -6
  55. package/dist/util/http/pagination.d.ts +1 -1
  56. package/dist/util/http/pagination.js +1 -1
  57. package/dist/util/http/rate-limited-axios.d.ts +2 -2
  58. package/dist/util/http/rate-limited-axios.js +2 -2
  59. package/dist/util/http/url.js +2 -2
  60. package/dist/util/index.d.ts +20 -20
  61. package/dist/util/integration-entity.d.ts +1 -1
  62. package/dist/util/integration-entity.js +1 -1
  63. package/dist/util/lang/index.d.ts +1 -1
  64. package/dist/util/logger.util.js +3 -3
  65. package/dist/util/oauth.d.ts +2 -2
  66. package/dist/util/oauth.js +7 -7
  67. package/dist/util/phone-number-utils.d.ts +2 -2
  68. package/dist/util/phone-number-utils.js +5 -5
  69. package/dist/util/phone-number-utils.test.js +49 -49
  70. package/dist/util/security/index.d.ts +2 -2
  71. package/dist/util/security/nonce.d.ts +1 -1
  72. package/dist/util/security/nonce.js +2 -2
  73. package/dist/util/size-of.js +4 -4
  74. package/dist/util/token-util.d.ts +3 -3
  75. package/dist/util/token-util.js +7 -7
  76. package/dist/util/validate.d.ts +1 -1
  77. package/dist/util/validate.js +2 -2
  78. package/package.json +1 -1
@@ -33,7 +33,7 @@ function sanitizeContact(contact, locale) {
33
33
  class Controller {
34
34
  constructor(adapter, contactCache) {
35
35
  this.pubSubClient = null;
36
- this.integrationName = "UNKNOWN";
36
+ this.integrationName = 'UNKNOWN';
37
37
  this.streamingPromises = new Map();
38
38
  this.adapter = adapter;
39
39
  this.contactCache = contactCache;
@@ -41,58 +41,58 @@ class Controller {
41
41
  if (this.adapter.streamContacts) {
42
42
  const { PUBSUB_TOPIC_NAME: topicName, INTEGRATION_NAME: integrationName, } = process.env;
43
43
  if (!topicName) {
44
- throw new Error("No PUBSUB_TOPIC_NAME provided.");
44
+ throw new Error('No PUBSUB_TOPIC_NAME provided.');
45
45
  }
46
46
  if (!integrationName) {
47
- throw new Error("No INTEGRATION_NAME provided.");
47
+ throw new Error('No INTEGRATION_NAME provided.');
48
48
  }
49
49
  this.integrationName = integrationName;
50
50
  this.pubSubClient = new pubsub_client_model_1.PubSubClient(topicName);
51
- (0, logger_util_1.infoLogger)("Controller", `Initialized PubSub client with topic ${topicName}`);
51
+ (0, logger_util_1.infoLogger)('Controller', `Initialized PubSub client with topic ${topicName}`);
52
52
  }
53
53
  }
54
54
  getContacts(req, res, next) {
55
55
  return __awaiter(this, void 0, void 0, function* () {
56
56
  const { providerConfig } = req;
57
57
  if (!providerConfig) {
58
- throw new _1.ServerError(400, "Missing parameters");
58
+ throw new _1.ServerError(400, 'Missing parameters');
59
59
  }
60
60
  try {
61
- (0, logger_util_1.infoLogger)("getContacts", "START", providerConfig.apiKey);
61
+ (0, logger_util_1.infoLogger)('getContacts', 'START', providerConfig.apiKey);
62
62
  const fetchContacts = () => __awaiter(this, void 0, void 0, function* () {
63
63
  if (!this.adapter.getContacts) {
64
- throw new _1.ServerError(501, "Fetching contacts is not implemented");
64
+ throw new _1.ServerError(501, 'Fetching contacts is not implemented');
65
65
  }
66
- (0, logger_util_1.infoLogger)("getContacts", `Fetching contacts…`, providerConfig.apiKey);
66
+ (0, logger_util_1.infoLogger)('getContacts', `Fetching contacts…`, providerConfig.apiKey);
67
67
  const fetchedContacts = yield this.adapter.getContacts(providerConfig);
68
68
  if (!(0, validate_1.validate)(this.ajv, schemas_1.contactsSchema, fetchedContacts)) {
69
- throw new _1.ServerError(500, "Invalid contacts received");
69
+ throw new _1.ServerError(500, 'Invalid contacts received');
70
70
  }
71
71
  return fetchedContacts.map((contact) => sanitizeContact(contact, providerConfig.locale));
72
72
  });
73
73
  const fetcherPromise = this.contactCache
74
74
  ? this.contactCache.get(providerConfig.apiKey, fetchContacts)
75
75
  : fetchContacts();
76
- const timeoutPromise = new Promise((resolve) => setTimeout(() => resolve("TIMEOUT"), CONTACT_FETCH_TIMEOUT));
76
+ const timeoutPromise = new Promise((resolve) => setTimeout(() => resolve('TIMEOUT'), CONTACT_FETCH_TIMEOUT));
77
77
  const raceResult = yield Promise.race([fetcherPromise, timeoutPromise]);
78
- if (raceResult === "TIMEOUT") {
79
- (0, logger_util_1.infoLogger)("getContacts", `Fetching too slow, returning empty array.`, providerConfig.apiKey);
78
+ if (raceResult === 'TIMEOUT') {
79
+ (0, logger_util_1.infoLogger)('getContacts', `Fetching too slow, returning empty array.`, providerConfig.apiKey);
80
80
  }
81
81
  const responseContacts = Array.isArray(raceResult)
82
82
  ? raceResult
83
83
  : [];
84
84
  const contactsCount = responseContacts.length;
85
- (0, logger_util_1.infoLogger)("getContacts", `Found ${contactsCount} cached contacts`, providerConfig.apiKey);
85
+ (0, logger_util_1.infoLogger)('getContacts', `Found ${contactsCount} cached contacts`, providerConfig.apiKey);
86
86
  if (!Array.isArray(raceResult) &&
87
- (raceResult === "TIMEOUT" ||
87
+ (raceResult === 'TIMEOUT' ||
88
88
  raceResult.state === cache_item_state_model_1.CacheItemStateType.FETCHING)) {
89
- res.header("X-Fetching-State", "pending");
89
+ res.header('X-Fetching-State', 'pending');
90
90
  }
91
91
  if (this.adapter.getToken && req.providerConfig) {
92
92
  const { apiKey } = yield this.adapter.getToken(req.providerConfig);
93
- res.header("X-Provider-Key", apiKey);
93
+ res.header('X-Provider-Key', apiKey);
94
94
  }
95
- (0, logger_util_1.infoLogger)("getContacts", "END", providerConfig.apiKey);
95
+ (0, logger_util_1.infoLogger)('getContacts', 'END', providerConfig.apiKey);
96
96
  res.status(200).send(responseContacts);
97
97
  }
98
98
  catch (error) {
@@ -102,7 +102,7 @@ class Controller {
102
102
  next(error);
103
103
  return;
104
104
  }
105
- (0, logger_util_1.errorLogger)("getContacts", "Could not get contacts:", providerConfig.apiKey, error);
105
+ (0, logger_util_1.errorLogger)('getContacts', 'Could not get contacts:', providerConfig.apiKey, error);
106
106
  next(error);
107
107
  }
108
108
  });
@@ -111,19 +111,19 @@ class Controller {
111
111
  return __awaiter(this, void 0, void 0, function* () {
112
112
  const { providerConfig } = req;
113
113
  if (!providerConfig) {
114
- throw new _1.ServerError(400, "Missing parameters");
114
+ throw new _1.ServerError(400, 'Missing parameters');
115
115
  }
116
116
  const { userId } = providerConfig;
117
117
  if (!userId) {
118
- throw new _1.ServerError(400, "Missing user ID");
118
+ throw new _1.ServerError(400, 'Missing user ID');
119
119
  }
120
120
  const timestamp = Date.now();
121
121
  try {
122
- (0, logger_util_1.infoLogger)("streamContacts", `Starting contact streaming ${timestamp}`, providerConfig.apiKey);
122
+ (0, logger_util_1.infoLogger)('streamContacts', `Starting contact streaming ${timestamp}`, providerConfig.apiKey);
123
123
  const streamContacts = () => __awaiter(this, void 0, void 0, function* () {
124
124
  var _a;
125
125
  if (!this.adapter.streamContacts) {
126
- throw new _1.ServerError(501, "Streaming contacts is not implemented");
126
+ throw new _1.ServerError(501, 'Streaming contacts is not implemented');
127
127
  }
128
128
  const iterator = this.adapter.streamContacts(providerConfig);
129
129
  let result = yield iterator.next();
@@ -131,7 +131,7 @@ class Controller {
131
131
  const { value: contacts } = result;
132
132
  try {
133
133
  if (!(0, validate_1.validate)(this.ajv, schemas_1.contactsSchema, contacts)) {
134
- throw new Error("Invalid contacts received");
134
+ throw new Error('Invalid contacts received');
135
135
  }
136
136
  const message = {
137
137
  userId,
@@ -143,7 +143,7 @@ class Controller {
143
143
  yield ((_a = this.pubSubClient) === null || _a === void 0 ? void 0 : _a.publishMessage(message));
144
144
  }
145
145
  catch (error) {
146
- (0, logger_util_1.errorLogger)("streamContacts", `Could not publish contacts`, providerConfig.apiKey, error);
146
+ (0, logger_util_1.errorLogger)('streamContacts', `Could not publish contacts`, providerConfig.apiKey, error);
147
147
  }
148
148
  finally {
149
149
  result = yield iterator.next();
@@ -151,7 +151,7 @@ class Controller {
151
151
  }
152
152
  });
153
153
  const streamingPromise = streamContacts()
154
- .catch((error) => (0, logger_util_1.errorLogger)("streamContacts", "Could not stream contacts", providerConfig.apiKey, error))
154
+ .catch((error) => (0, logger_util_1.errorLogger)('streamContacts', 'Could not stream contacts', providerConfig.apiKey, error))
155
155
  .finally(() => {
156
156
  var _a;
157
157
  (_a = this.pubSubClient) === null || _a === void 0 ? void 0 : _a.publishMessage({
@@ -166,9 +166,9 @@ class Controller {
166
166
  this.streamingPromises.set(`${userId}:${timestamp}`, streamingPromise);
167
167
  if (this.adapter.getToken && req.providerConfig) {
168
168
  const { apiKey } = yield this.adapter.getToken(req.providerConfig);
169
- res.header("X-Provider-Key", apiKey);
169
+ res.header('X-Provider-Key', apiKey);
170
170
  }
171
- (0, logger_util_1.infoLogger)("streamContacts", "END", providerConfig.apiKey);
171
+ (0, logger_util_1.infoLogger)('streamContacts', 'END', providerConfig.apiKey);
172
172
  res.status(200).send({ timestamp });
173
173
  }
174
174
  catch (error) {
@@ -178,34 +178,34 @@ class Controller {
178
178
  next(error);
179
179
  return;
180
180
  }
181
- (0, logger_util_1.errorLogger)("streamContacts", "Could not stream contacts", providerConfig.apiKey, error);
181
+ (0, logger_util_1.errorLogger)('streamContacts', 'Could not stream contacts', providerConfig.apiKey, error);
182
182
  next(error);
183
183
  }
184
184
  });
185
185
  }
186
186
  createContact(req, res, next) {
187
187
  return __awaiter(this, void 0, void 0, function* () {
188
- const { providerConfig: { apiKey = "", locale = "" } = {} } = req;
188
+ const { providerConfig: { apiKey = '', locale = '' } = {} } = req;
189
189
  try {
190
- (0, logger_util_1.infoLogger)("createContact", "START", apiKey);
190
+ (0, logger_util_1.infoLogger)('createContact', 'START', apiKey);
191
191
  if (!this.adapter.createContact) {
192
- throw new _1.ServerError(501, "Creating contacts is not implemented");
192
+ throw new _1.ServerError(501, 'Creating contacts is not implemented');
193
193
  }
194
194
  if (!req.providerConfig) {
195
- throw new _1.ServerError(400, "Missing config parameters");
195
+ throw new _1.ServerError(400, 'Missing config parameters');
196
196
  }
197
- (0, logger_util_1.infoLogger)("createContact", "Creating contact", apiKey);
197
+ (0, logger_util_1.infoLogger)('createContact', 'Creating contact', apiKey);
198
198
  const contact = yield this.adapter.createContact(req.providerConfig, req.body);
199
199
  const valid = (0, validate_1.validate)(this.ajv, schemas_1.contactsSchema, [contact]);
200
200
  if (!valid) {
201
- (0, logger_util_1.errorLogger)("createContact", "Invalid contact provided by adapter", apiKey, this.ajv.errorsText());
202
- throw new _1.ServerError(400, "Invalid contact provided by adapter");
201
+ (0, logger_util_1.errorLogger)('createContact', 'Invalid contact provided by adapter', apiKey, this.ajv.errorsText());
202
+ throw new _1.ServerError(400, 'Invalid contact provided by adapter');
203
203
  }
204
- (0, logger_util_1.infoLogger)("createContact", `Contact with id ${contact.id} created`, apiKey);
204
+ (0, logger_util_1.infoLogger)('createContact', `Contact with id ${contact.id} created`, apiKey);
205
205
  const sanitizedContact = sanitizeContact(contact, locale);
206
206
  if (this.adapter.getToken && req.providerConfig) {
207
207
  const { apiKey } = yield this.adapter.getToken(req.providerConfig);
208
- res.header("X-Provider-Key", apiKey);
208
+ res.header('X-Provider-Key', apiKey);
209
209
  }
210
210
  res.status(200).send(sanitizedContact);
211
211
  if (this.contactCache) {
@@ -214,7 +214,7 @@ class Controller {
214
214
  yield this.contactCache.set(apiKey, [...contacts, sanitizedContact]);
215
215
  }
216
216
  }
217
- (0, logger_util_1.infoLogger)("createContact", "END", apiKey);
217
+ (0, logger_util_1.infoLogger)('createContact', 'END', apiKey);
218
218
  }
219
219
  catch (error) {
220
220
  // prevent logging of refresh errors
@@ -223,34 +223,34 @@ class Controller {
223
223
  next(error);
224
224
  return;
225
225
  }
226
- (0, logger_util_1.errorLogger)("createContact", "Could not create contact:", apiKey, error || "Unknown");
227
- (0, logger_util_1.errorLogger)("createContact", "Entity", apiKey, req.body);
226
+ (0, logger_util_1.errorLogger)('createContact', 'Could not create contact:', apiKey, error || 'Unknown');
227
+ (0, logger_util_1.errorLogger)('createContact', 'Entity', apiKey, req.body);
228
228
  next(error);
229
229
  }
230
230
  });
231
231
  }
232
232
  updateContact(req, res, next) {
233
233
  return __awaiter(this, void 0, void 0, function* () {
234
- const { providerConfig: { apiKey = "", locale = "" } = {} } = req;
234
+ const { providerConfig: { apiKey = '', locale = '' } = {} } = req;
235
235
  try {
236
236
  if (!this.adapter.updateContact) {
237
- throw new _1.ServerError(501, "Updating contacts is not implemented");
237
+ throw new _1.ServerError(501, 'Updating contacts is not implemented');
238
238
  }
239
239
  if (!req.providerConfig) {
240
- throw new _1.ServerError(400, "Missing config parameters");
240
+ throw new _1.ServerError(400, 'Missing config parameters');
241
241
  }
242
- (0, logger_util_1.infoLogger)("updateContact", "Updating contact", apiKey);
242
+ (0, logger_util_1.infoLogger)('updateContact', 'Updating contact', apiKey);
243
243
  const contact = yield this.adapter.updateContact(req.providerConfig, req.params.id, req.body);
244
244
  const valid = (0, validate_1.validate)(this.ajv, schemas_1.contactsSchema, [contact]);
245
245
  if (!valid) {
246
- (0, logger_util_1.errorLogger)("updateContact", "Invalid contact provided by adapter", apiKey, this.ajv.errorsText());
247
- throw new _1.ServerError(400, "Invalid contact provided by adapter");
246
+ (0, logger_util_1.errorLogger)('updateContact', 'Invalid contact provided by adapter', apiKey, this.ajv.errorsText());
247
+ throw new _1.ServerError(400, 'Invalid contact provided by adapter');
248
248
  }
249
- (0, logger_util_1.infoLogger)("updateContact", `Contact with id ${contact.id} updated`, apiKey);
249
+ (0, logger_util_1.infoLogger)('updateContact', `Contact with id ${contact.id} updated`, apiKey);
250
250
  const sanitizedContact = sanitizeContact(contact, locale);
251
251
  if (this.adapter.getToken && req.providerConfig) {
252
252
  const { apiKey } = yield this.adapter.getToken(req.providerConfig);
253
- res.header("X-Provider-Key", apiKey);
253
+ res.header('X-Provider-Key', apiKey);
254
254
  }
255
255
  res.status(200).send(sanitizedContact);
256
256
  if (this.contactCache) {
@@ -260,7 +260,7 @@ class Controller {
260
260
  yield this.contactCache.set(apiKey, updatedCache);
261
261
  }
262
262
  }
263
- (0, logger_util_1.infoLogger)("updateContact", "END", apiKey);
263
+ (0, logger_util_1.infoLogger)('updateContact', 'END', apiKey);
264
264
  }
265
265
  catch (error) {
266
266
  // prevent logging of refresh errors
@@ -269,32 +269,32 @@ class Controller {
269
269
  next(error);
270
270
  return;
271
271
  }
272
- (0, logger_util_1.errorLogger)("updateContact", "Could not update contact:", apiKey, error || "Unknown");
273
- (0, logger_util_1.errorLogger)("updateContact", "Entity", apiKey, req.body);
272
+ (0, logger_util_1.errorLogger)('updateContact', 'Could not update contact:', apiKey, error || 'Unknown');
273
+ (0, logger_util_1.errorLogger)('updateContact', 'Entity', apiKey, req.body);
274
274
  next(error);
275
275
  }
276
276
  });
277
277
  }
278
278
  deleteContact(req, res, next) {
279
279
  return __awaiter(this, void 0, void 0, function* () {
280
- const { providerConfig: { apiKey = "" } = {} } = req;
280
+ const { providerConfig: { apiKey = '' } = {} } = req;
281
281
  try {
282
- (0, logger_util_1.infoLogger)("deleteContact", "START", apiKey);
282
+ (0, logger_util_1.infoLogger)('deleteContact', 'START', apiKey);
283
283
  if (!this.adapter.deleteContact) {
284
- throw new _1.ServerError(501, "Deleting contacts is not implemented");
284
+ throw new _1.ServerError(501, 'Deleting contacts is not implemented');
285
285
  }
286
286
  if (!req.providerConfig) {
287
- throw new _1.ServerError(400, "Missing config parameters");
287
+ throw new _1.ServerError(400, 'Missing config parameters');
288
288
  }
289
- (0, logger_util_1.infoLogger)("deleteContact", "Deleting contact", apiKey);
289
+ (0, logger_util_1.infoLogger)('deleteContact', 'Deleting contact', apiKey);
290
290
  const contactId = req.params.id;
291
291
  yield this.adapter.deleteContact(req.providerConfig, contactId);
292
292
  if (this.adapter.getToken && req.providerConfig) {
293
293
  const { apiKey } = yield this.adapter.getToken(req.providerConfig);
294
- res.header("X-Provider-Key", apiKey);
294
+ res.header('X-Provider-Key', apiKey);
295
295
  }
296
296
  res.status(200).send();
297
- (0, logger_util_1.infoLogger)("deleteContact", `Contact with id ${contactId} deleted`, apiKey);
297
+ (0, logger_util_1.infoLogger)('deleteContact', `Contact with id ${contactId} deleted`, apiKey);
298
298
  if (this.contactCache) {
299
299
  const contacts = yield this.contactCache.get(apiKey);
300
300
  if (Array.isArray(contacts)) {
@@ -302,7 +302,7 @@ class Controller {
302
302
  yield this.contactCache.set(apiKey, updatedCache);
303
303
  }
304
304
  }
305
- (0, logger_util_1.infoLogger)("deleteContact", "END", apiKey);
305
+ (0, logger_util_1.infoLogger)('deleteContact', 'END', apiKey);
306
306
  }
307
307
  catch (error) {
308
308
  // prevent logging of refresh errors
@@ -311,25 +311,25 @@ class Controller {
311
311
  next(error);
312
312
  return;
313
313
  }
314
- (0, logger_util_1.errorLogger)("deleteContact", "Could not delete contact:", apiKey, error || "Unknown");
314
+ (0, logger_util_1.errorLogger)('deleteContact', 'Could not delete contact:', apiKey, error || 'Unknown');
315
315
  next(error);
316
316
  }
317
317
  });
318
318
  }
319
319
  getCalendarEvents(req, res, next) {
320
320
  return __awaiter(this, void 0, void 0, function* () {
321
- const { providerConfig: { apiKey = "" } = {}, query: { start, end }, } = req;
321
+ const { providerConfig: { apiKey = '' } = {}, query: { start, end }, } = req;
322
322
  try {
323
- (0, logger_util_1.infoLogger)("getCalendarEvents", "START", apiKey);
323
+ (0, logger_util_1.infoLogger)('getCalendarEvents', 'START', apiKey);
324
324
  if (!this.adapter.getCalendarEvents) {
325
- throw new _1.ServerError(501, "Fetching calendar events is not implemented");
325
+ throw new _1.ServerError(501, 'Fetching calendar events is not implemented');
326
326
  }
327
327
  if (!req.providerConfig) {
328
- (0, logger_util_1.errorLogger)("getCalendarEvents", "Missing config parameters", apiKey);
329
- throw new _1.ServerError(400, "Missing config parameters");
328
+ (0, logger_util_1.errorLogger)('getCalendarEvents', 'Missing config parameters', apiKey);
329
+ throw new _1.ServerError(400, 'Missing config parameters');
330
330
  }
331
- (0, logger_util_1.infoLogger)("getCalendarEvents", "Fetching calendar events", apiKey);
332
- const filter = typeof start === "string" && typeof end === "string"
331
+ (0, logger_util_1.infoLogger)('getCalendarEvents', 'Fetching calendar events', apiKey);
332
+ const filter = typeof start === 'string' && typeof end === 'string'
333
333
  ? {
334
334
  start: Number(start),
335
335
  end: Number(end),
@@ -338,93 +338,93 @@ class Controller {
338
338
  const calendarEvents = yield this.adapter.getCalendarEvents(req.providerConfig, filter);
339
339
  const valid = (0, validate_1.validate)(this.ajv, schemas_1.calendarEventsSchema, calendarEvents);
340
340
  if (!valid) {
341
- (0, logger_util_1.errorLogger)("getCalendarEvents", `Invalid calendar events provided by adapter`, apiKey, this.ajv.errorsText());
342
- throw new _1.ServerError(400, "Invalid calendar events provided by adapter");
341
+ (0, logger_util_1.errorLogger)('getCalendarEvents', `Invalid calendar events provided by adapter`, apiKey, this.ajv.errorsText());
342
+ throw new _1.ServerError(400, 'Invalid calendar events provided by adapter');
343
343
  }
344
- (0, logger_util_1.infoLogger)("getCalendarEvents", `Found ${calendarEvents.length} events`, apiKey);
344
+ (0, logger_util_1.infoLogger)('getCalendarEvents', `Found ${calendarEvents.length} events`, apiKey);
345
345
  res.status(200).send(calendarEvents);
346
- (0, logger_util_1.infoLogger)("getCalendarEvents", `END`, apiKey);
346
+ (0, logger_util_1.infoLogger)('getCalendarEvents', `END`, apiKey);
347
347
  }
348
348
  catch (error) {
349
- (0, logger_util_1.errorLogger)("getCalendarEvents", `Could not get calendar events:`, apiKey, error || "Unknown");
349
+ (0, logger_util_1.errorLogger)('getCalendarEvents', `Could not get calendar events:`, apiKey, error || 'Unknown');
350
350
  next(error);
351
351
  }
352
352
  });
353
353
  }
354
354
  createCalendarEvent(req, res, next) {
355
355
  return __awaiter(this, void 0, void 0, function* () {
356
- const { providerConfig: { apiKey = "" } = {} } = req;
356
+ const { providerConfig: { apiKey = '' } = {} } = req;
357
357
  try {
358
- (0, logger_util_1.infoLogger)("createCalendarEvent", `START`, apiKey);
358
+ (0, logger_util_1.infoLogger)('createCalendarEvent', `START`, apiKey);
359
359
  if (!this.adapter.createCalendarEvent) {
360
- throw new _1.ServerError(501, "Creating calendar events is not implemented");
360
+ throw new _1.ServerError(501, 'Creating calendar events is not implemented');
361
361
  }
362
362
  if (!req.providerConfig) {
363
- throw new _1.ServerError(400, "Missing config parameters");
363
+ throw new _1.ServerError(400, 'Missing config parameters');
364
364
  }
365
- (0, logger_util_1.infoLogger)("createCalendarEvent", `Creating calendar event`, apiKey);
365
+ (0, logger_util_1.infoLogger)('createCalendarEvent', `Creating calendar event`, apiKey);
366
366
  const calendarEvent = yield this.adapter.createCalendarEvent(req.providerConfig, req.body);
367
367
  const valid = (0, validate_1.validate)(this.ajv, schemas_1.calendarEventsSchema, [calendarEvent]);
368
368
  if (!valid) {
369
- (0, logger_util_1.errorLogger)("createCalendarEvent", "Invalid calendar event provided by adapter", apiKey, this.ajv.errorsText());
370
- throw new _1.ServerError(400, "Invalid calendar event provided by adapter");
369
+ (0, logger_util_1.errorLogger)('createCalendarEvent', 'Invalid calendar event provided by adapter', apiKey, this.ajv.errorsText());
370
+ throw new _1.ServerError(400, 'Invalid calendar event provided by adapter');
371
371
  }
372
- (0, logger_util_1.infoLogger)("createCalendarEvent", `END`, apiKey);
372
+ (0, logger_util_1.infoLogger)('createCalendarEvent', `END`, apiKey);
373
373
  res.status(200).send(calendarEvent);
374
374
  }
375
375
  catch (error) {
376
- (0, logger_util_1.errorLogger)("createCalendarEvent", "Could not create calendar event:", apiKey, error || "Unknown");
377
- (0, logger_util_1.errorLogger)("createCalendarEvent", "Entity", apiKey, req.body);
376
+ (0, logger_util_1.errorLogger)('createCalendarEvent', 'Could not create calendar event:', apiKey, error || 'Unknown');
377
+ (0, logger_util_1.errorLogger)('createCalendarEvent', 'Entity', apiKey, req.body);
378
378
  next(error);
379
379
  }
380
380
  });
381
381
  }
382
382
  updateCalendarEvent(req, res, next) {
383
383
  return __awaiter(this, void 0, void 0, function* () {
384
- const { providerConfig: { apiKey = "" } = {} } = req;
384
+ const { providerConfig: { apiKey = '' } = {} } = req;
385
385
  try {
386
- (0, logger_util_1.infoLogger)("updateCalendarEvent", `START`, apiKey);
386
+ (0, logger_util_1.infoLogger)('updateCalendarEvent', `START`, apiKey);
387
387
  if (!this.adapter.updateCalendarEvent) {
388
- throw new _1.ServerError(501, "Updating calendar events is not implemented");
388
+ throw new _1.ServerError(501, 'Updating calendar events is not implemented');
389
389
  }
390
390
  if (!req.providerConfig) {
391
- throw new _1.ServerError(400, "Missing config parameters");
391
+ throw new _1.ServerError(400, 'Missing config parameters');
392
392
  }
393
- (0, logger_util_1.infoLogger)("updateCalendarEvent", `Updating calendar event`, apiKey);
393
+ (0, logger_util_1.infoLogger)('updateCalendarEvent', `Updating calendar event`, apiKey);
394
394
  const calendarEvent = yield this.adapter.updateCalendarEvent(req.providerConfig, req.params.id, req.body);
395
395
  const valid = (0, validate_1.validate)(this.ajv, schemas_1.calendarEventsSchema, [calendarEvent]);
396
396
  if (!valid) {
397
- (0, logger_util_1.errorLogger)("updateCalendarEvent", `Invalid calendar event provided by adapter`, apiKey, this.ajv.errorsText());
398
- throw new _1.ServerError(400, "Invalid calendar event provided by adapter");
397
+ (0, logger_util_1.errorLogger)('updateCalendarEvent', `Invalid calendar event provided by adapter`, apiKey, this.ajv.errorsText());
398
+ throw new _1.ServerError(400, 'Invalid calendar event provided by adapter');
399
399
  }
400
- (0, logger_util_1.infoLogger)("updateCalendarEvent", `END`, apiKey);
400
+ (0, logger_util_1.infoLogger)('updateCalendarEvent', `END`, apiKey);
401
401
  res.status(200).send(calendarEvent);
402
402
  }
403
403
  catch (error) {
404
- (0, logger_util_1.errorLogger)("updateCalendarEvent", `Could not update calendar event:`, apiKey, error || "Unknown");
405
- (0, logger_util_1.errorLogger)("updateCalendarEvent", "Entity", apiKey, req.body);
404
+ (0, logger_util_1.errorLogger)('updateCalendarEvent', `Could not update calendar event:`, apiKey, error || 'Unknown');
405
+ (0, logger_util_1.errorLogger)('updateCalendarEvent', 'Entity', apiKey, req.body);
406
406
  next(error);
407
407
  }
408
408
  });
409
409
  }
410
410
  deleteCalendarEvent(req, res, next) {
411
411
  return __awaiter(this, void 0, void 0, function* () {
412
- const { providerConfig: { apiKey = "" } = {} } = req;
412
+ const { providerConfig: { apiKey = '' } = {} } = req;
413
413
  try {
414
- (0, logger_util_1.infoLogger)("deleteCalendarEvent", `START`, apiKey);
414
+ (0, logger_util_1.infoLogger)('deleteCalendarEvent', `START`, apiKey);
415
415
  if (!this.adapter.deleteCalendarEvent) {
416
- throw new _1.ServerError(501, "Deleting calendar events is not implemented");
416
+ throw new _1.ServerError(501, 'Deleting calendar events is not implemented');
417
417
  }
418
418
  if (!req.providerConfig) {
419
- throw new _1.ServerError(400, "Missing config parameters");
419
+ throw new _1.ServerError(400, 'Missing config parameters');
420
420
  }
421
- (0, logger_util_1.infoLogger)("deleteCalendarEvent", `Deleting calendar event`, apiKey);
421
+ (0, logger_util_1.infoLogger)('deleteCalendarEvent', `Deleting calendar event`, apiKey);
422
422
  yield this.adapter.deleteCalendarEvent(req.providerConfig, req.params.id);
423
- (0, logger_util_1.infoLogger)("deleteCalendarEvent", `END`, apiKey);
423
+ (0, logger_util_1.infoLogger)('deleteCalendarEvent', `END`, apiKey);
424
424
  res.status(200).send();
425
425
  }
426
426
  catch (error) {
427
- (0, logger_util_1.errorLogger)("deleteCalendarEvent", `Could not delete calendar event:`, apiKey, error || "Unknown");
427
+ (0, logger_util_1.errorLogger)('deleteCalendarEvent', `Could not delete calendar event:`, apiKey, error || 'Unknown');
428
428
  next(error);
429
429
  }
430
430
  });
@@ -439,53 +439,53 @@ class Controller {
439
439
  return __awaiter(this, void 0, void 0, function* () {
440
440
  const { providerConfig } = req;
441
441
  try {
442
- (0, logger_util_1.infoLogger)("handleCallEvent", `START`, providerConfig === null || providerConfig === void 0 ? void 0 : providerConfig.apiKey);
442
+ (0, logger_util_1.infoLogger)('handleCallEvent', `START`, providerConfig === null || providerConfig === void 0 ? void 0 : providerConfig.apiKey);
443
443
  if (!providerConfig) {
444
- throw new _1.ServerError(400, "Missing config parameters");
444
+ throw new _1.ServerError(400, 'Missing config parameters');
445
445
  }
446
446
  if (!this.adapter.handleCallEvent) {
447
- throw new _1.ServerError(501, "Handling call event is not implemented");
447
+ throw new _1.ServerError(501, 'Handling call event is not implemented');
448
448
  }
449
449
  if ((0, call_event_util_1.shouldSkipCallEvent)(req.body)) {
450
- (0, logger_util_1.infoLogger)("handleCallEvent", `Skipping call event for call id ${req.body.id}`, providerConfig.apiKey);
451
- res.status(200).send("Skipping call event");
450
+ (0, logger_util_1.infoLogger)('handleCallEvent', `Skipping call event for call id ${req.body.id}`, providerConfig.apiKey);
451
+ res.status(200).send('Skipping call event');
452
452
  return;
453
453
  }
454
- (0, logger_util_1.infoLogger)("handleCallEvent", `Handling call event`, providerConfig.apiKey);
454
+ (0, logger_util_1.infoLogger)('handleCallEvent', `Handling call event`, providerConfig.apiKey);
455
455
  const integrationCallEventRef = yield this.adapter.handleCallEvent(providerConfig, req.body);
456
- if (integrationCallEventRef != "")
457
- (0, logger_util_1.infoLogger)("handleCallEvent", `CallEvent with refId ${integrationCallEventRef} created!`, providerConfig.apiKey);
456
+ if (integrationCallEventRef != '')
457
+ (0, logger_util_1.infoLogger)('handleCallEvent', `CallEvent with refId ${integrationCallEventRef} created!`, providerConfig.apiKey);
458
458
  else
459
- (0, logger_util_1.infoLogger)("handleCallEvent", `Did not create callEvent`, providerConfig.apiKey);
460
- (0, logger_util_1.infoLogger)("handleCallEvent", `END`, providerConfig.apiKey);
459
+ (0, logger_util_1.infoLogger)('handleCallEvent', `Did not create callEvent`, providerConfig.apiKey);
460
+ (0, logger_util_1.infoLogger)('handleCallEvent', `END`, providerConfig.apiKey);
461
461
  res.status(200).send(integrationCallEventRef);
462
462
  }
463
463
  catch (error) {
464
- (0, logger_util_1.errorLogger)("handleCallEvent", "Could not handle call event:", providerConfig === null || providerConfig === void 0 ? void 0 : providerConfig.apiKey, error || "Unknown");
465
- (0, logger_util_1.errorLogger)("handleCallEvent", "Entity", providerConfig === null || providerConfig === void 0 ? void 0 : providerConfig.apiKey, req.body);
464
+ (0, logger_util_1.errorLogger)('handleCallEvent', 'Could not handle call event:', providerConfig === null || providerConfig === void 0 ? void 0 : providerConfig.apiKey, error || 'Unknown');
465
+ (0, logger_util_1.errorLogger)('handleCallEvent', 'Entity', providerConfig === null || providerConfig === void 0 ? void 0 : providerConfig.apiKey, req.body);
466
466
  next(error);
467
467
  }
468
468
  });
469
469
  }
470
470
  handleConnectedEvent(req, res, next) {
471
471
  return __awaiter(this, void 0, void 0, function* () {
472
- const { providerConfig: { apiKey = "" } = {} } = req;
472
+ const { providerConfig: { apiKey = '' } = {} } = req;
473
473
  try {
474
- (0, logger_util_1.infoLogger)("handleConnectedEvent", `START`, apiKey);
474
+ (0, logger_util_1.infoLogger)('handleConnectedEvent', `START`, apiKey);
475
475
  if (!this.adapter.handleConnectedEvent) {
476
- throw new _1.ServerError(501, "Handling connected event is not implemented");
476
+ throw new _1.ServerError(501, 'Handling connected event is not implemented');
477
477
  }
478
478
  if (!req.providerConfig) {
479
- throw new _1.ServerError(400, "Missing config parameters");
479
+ throw new _1.ServerError(400, 'Missing config parameters');
480
480
  }
481
- (0, logger_util_1.infoLogger)("handleConnectedEvent", `Handling connected event`, apiKey);
481
+ (0, logger_util_1.infoLogger)('handleConnectedEvent', `Handling connected event`, apiKey);
482
482
  yield this.adapter.handleConnectedEvent(req.providerConfig);
483
- (0, logger_util_1.infoLogger)("handleConnectedEvent", `END`, apiKey);
483
+ (0, logger_util_1.infoLogger)('handleConnectedEvent', `END`, apiKey);
484
484
  res.status(200).send();
485
485
  }
486
486
  catch (error) {
487
- (0, logger_util_1.errorLogger)("handleConnectedEvent", `Could not handle connected event:`, apiKey, error || "Unknown");
488
- (0, logger_util_1.errorLogger)("handleConnectedEvent", "Entity", apiKey, req.body);
487
+ (0, logger_util_1.errorLogger)('handleConnectedEvent', `Could not handle connected event:`, apiKey, error || 'Unknown');
488
+ (0, logger_util_1.errorLogger)('handleConnectedEvent', 'Entity', apiKey, req.body);
489
489
  next(error);
490
490
  }
491
491
  });
@@ -498,23 +498,23 @@ class Controller {
498
498
  */
499
499
  updateCallEvent(req, res, next) {
500
500
  return __awaiter(this, void 0, void 0, function* () {
501
- const { providerConfig: { apiKey = "" } = {}, body, params } = req;
501
+ const { providerConfig: { apiKey = '' } = {}, body, params } = req;
502
502
  try {
503
- (0, logger_util_1.infoLogger)("updateCallEvent", `START`, apiKey);
503
+ (0, logger_util_1.infoLogger)('updateCallEvent', `START`, apiKey);
504
504
  if (!this.adapter.updateCallEvent) {
505
- throw new _1.ServerError(501, "Updating call events is not implemented");
505
+ throw new _1.ServerError(501, 'Updating call events is not implemented');
506
506
  }
507
507
  if (!req.providerConfig) {
508
- throw new _1.ServerError(400, "Missing config parameters");
508
+ throw new _1.ServerError(400, 'Missing config parameters');
509
509
  }
510
- (0, logger_util_1.infoLogger)("updateCallEvent", `Updating call event`, apiKey);
510
+ (0, logger_util_1.infoLogger)('updateCallEvent', `Updating call event`, apiKey);
511
511
  yield this.adapter.updateCallEvent(req.providerConfig, params.id, body);
512
- (0, logger_util_1.infoLogger)("updateCallEvent", `END`, apiKey);
512
+ (0, logger_util_1.infoLogger)('updateCallEvent', `END`, apiKey);
513
513
  res.status(200).send();
514
514
  }
515
515
  catch (error) {
516
- (0, logger_util_1.errorLogger)("updateCallEvent", `Could not update call event:`, apiKey, error || "Unknown");
517
- (0, logger_util_1.errorLogger)("updateCallEvent", "Entity", apiKey, req.body);
516
+ (0, logger_util_1.errorLogger)('updateCallEvent', `Could not update call event:`, apiKey, error || 'Unknown');
517
+ (0, logger_util_1.errorLogger)('updateCallEvent', 'Entity', apiKey, req.body);
518
518
  next(error);
519
519
  }
520
520
  });
@@ -523,25 +523,25 @@ class Controller {
523
523
  return __awaiter(this, void 0, void 0, function* () {
524
524
  const { providerConfig } = req;
525
525
  try {
526
- (0, logger_util_1.infoLogger)("createCallLogForPhoneNumber", `START`, providerConfig === null || providerConfig === void 0 ? void 0 : providerConfig.apiKey);
526
+ (0, logger_util_1.infoLogger)('createCallLogForPhoneNumber', `START`, providerConfig === null || providerConfig === void 0 ? void 0 : providerConfig.apiKey);
527
527
  if (!providerConfig) {
528
- throw new _1.ServerError(400, "Missing config parameters");
528
+ throw new _1.ServerError(400, 'Missing config parameters');
529
529
  }
530
530
  if (!this.adapter.createCallLogForPhoneNumber) {
531
- throw new _1.ServerError(501, "Creating call log for phoneNumber is not implemented");
531
+ throw new _1.ServerError(501, 'Creating call log for phoneNumber is not implemented');
532
532
  }
533
533
  if ((0, call_event_util_1.shouldSkipCallEvent)(req.body)) {
534
- (0, logger_util_1.infoLogger)("createCallLogForPhoneNumber", `Skipping call log for call id ${req.body.id}`, providerConfig.apiKey);
534
+ (0, logger_util_1.infoLogger)('createCallLogForPhoneNumber', `Skipping call log for call id ${req.body.id}`, providerConfig.apiKey);
535
535
  res.status(200).send([]);
536
536
  return;
537
537
  }
538
- (0, logger_util_1.infoLogger)("createCallLogForPhoneNumber", `Creating call Log for PhoneNumber…`, providerConfig.apiKey);
538
+ (0, logger_util_1.infoLogger)('createCallLogForPhoneNumber', `Creating call Log for PhoneNumber…`, providerConfig.apiKey);
539
539
  const loggedEntities = yield this.adapter.createCallLogForPhoneNumber(providerConfig, req.body);
540
- (0, logger_util_1.infoLogger)("createCallLogForPhoneNumber", `END`, providerConfig.apiKey);
540
+ (0, logger_util_1.infoLogger)('createCallLogForPhoneNumber', `END`, providerConfig.apiKey);
541
541
  res.status(200).send(loggedEntities);
542
542
  }
543
543
  catch (error) {
544
- (0, logger_util_1.errorLogger)("createCallLogForPhoneNumber", "Could not create call log for phoneNumber:", providerConfig === null || providerConfig === void 0 ? void 0 : providerConfig.apiKey, error || "Unknown");
544
+ (0, logger_util_1.errorLogger)('createCallLogForPhoneNumber', 'Could not create call log for phoneNumber:', providerConfig === null || providerConfig === void 0 ? void 0 : providerConfig.apiKey, error || 'Unknown');
545
545
  next(error);
546
546
  }
547
547
  });
@@ -550,25 +550,25 @@ class Controller {
550
550
  return __awaiter(this, void 0, void 0, function* () {
551
551
  const { providerConfig } = req;
552
552
  try {
553
- (0, logger_util_1.infoLogger)("createOrUpdateCallLogForEntities", `START`, providerConfig === null || providerConfig === void 0 ? void 0 : providerConfig.apiKey);
553
+ (0, logger_util_1.infoLogger)('createOrUpdateCallLogForEntities', `START`, providerConfig === null || providerConfig === void 0 ? void 0 : providerConfig.apiKey);
554
554
  if (!providerConfig) {
555
- throw new _1.ServerError(400, "Missing config parameters");
555
+ throw new _1.ServerError(400, 'Missing config parameters');
556
556
  }
557
557
  if (!this.adapter.createOrUpdateCallLogForEntities) {
558
- throw new _1.ServerError(501, "Updating call log with entities is not implemented");
558
+ throw new _1.ServerError(501, 'Updating call log with entities is not implemented');
559
559
  }
560
560
  if ((0, call_event_util_1.shouldSkipCallEvent)(req.body)) {
561
- (0, logger_util_1.infoLogger)("createOrUpdateCallLogForEntities", `Skipping call log for call id ${req.body.id}`, providerConfig.apiKey);
561
+ (0, logger_util_1.infoLogger)('createOrUpdateCallLogForEntities', `Skipping call log for call id ${req.body.id}`, providerConfig.apiKey);
562
562
  res.status(200).send([]);
563
563
  return;
564
564
  }
565
- (0, logger_util_1.infoLogger)("createOrUpdateCallLogForEntities", `Creating and updating call Logs…`, providerConfig.apiKey);
565
+ (0, logger_util_1.infoLogger)('createOrUpdateCallLogForEntities', `Creating and updating call Logs…`, providerConfig.apiKey);
566
566
  const entitiesWithCallLogReferences = yield this.adapter.createOrUpdateCallLogForEntities(providerConfig, req.body);
567
- (0, logger_util_1.infoLogger)("createOrUpdateCallLogForEntities", `END`, providerConfig.apiKey);
567
+ (0, logger_util_1.infoLogger)('createOrUpdateCallLogForEntities', `END`, providerConfig.apiKey);
568
568
  res.status(200).send(entitiesWithCallLogReferences);
569
569
  }
570
570
  catch (error) {
571
- (0, logger_util_1.errorLogger)("createOrUpdateCallLogForEntities", "Could not update call logs with entities:", providerConfig === null || providerConfig === void 0 ? void 0 : providerConfig.apiKey, error || "Unknown");
571
+ (0, logger_util_1.errorLogger)('createOrUpdateCallLogForEntities', 'Could not update call logs with entities:', providerConfig === null || providerConfig === void 0 ? void 0 : providerConfig.apiKey, error || 'Unknown');
572
572
  next(error);
573
573
  }
574
574
  });
@@ -577,20 +577,20 @@ class Controller {
577
577
  return __awaiter(this, void 0, void 0, function* () {
578
578
  const { providerConfig } = req;
579
579
  try {
580
- (0, logger_util_1.infoLogger)("getEntity", `START`, providerConfig === null || providerConfig === void 0 ? void 0 : providerConfig.apiKey);
580
+ (0, logger_util_1.infoLogger)('getEntity', `START`, providerConfig === null || providerConfig === void 0 ? void 0 : providerConfig.apiKey);
581
581
  if (!providerConfig) {
582
- throw new _1.ServerError(400, "Missing parameters");
582
+ throw new _1.ServerError(400, 'Missing parameters');
583
583
  }
584
584
  if (!this.adapter.getEntity) {
585
- throw new _1.ServerError(501, "Fetching Entity is not implemented");
585
+ throw new _1.ServerError(501, 'Fetching Entity is not implemented');
586
586
  }
587
587
  const fetchedEntity = yield this.adapter.getEntity(providerConfig, req.params.id, req.params.type);
588
- (0, logger_util_1.infoLogger)("getEntity", `[${JSON.stringify(fetchedEntity)}] `, providerConfig.apiKey);
589
- (0, logger_util_1.infoLogger)("getEntity", `END`, providerConfig === null || providerConfig === void 0 ? void 0 : providerConfig.apiKey);
588
+ (0, logger_util_1.infoLogger)('getEntity', `[${JSON.stringify(fetchedEntity)}] `, providerConfig.apiKey);
589
+ (0, logger_util_1.infoLogger)('getEntity', `END`, providerConfig === null || providerConfig === void 0 ? void 0 : providerConfig.apiKey);
590
590
  res.status(200).send(fetchedEntity);
591
591
  }
592
592
  catch (error) {
593
- (0, logger_util_1.errorLogger)("getEntity", "Could not get entity:", providerConfig === null || providerConfig === void 0 ? void 0 : providerConfig.apiKey, error);
593
+ (0, logger_util_1.errorLogger)('getEntity', 'Could not get entity:', providerConfig === null || providerConfig === void 0 ? void 0 : providerConfig.apiKey, error);
594
594
  next(error);
595
595
  }
596
596
  });
@@ -604,8 +604,8 @@ class Controller {
604
604
  res.sendStatus(200);
605
605
  }
606
606
  catch (error) {
607
- (0, logger_util_1.errorLogger)("getHealth", "Health check failed:", "", error || "Unknown");
608
- next(error || "Internal Server Error");
607
+ (0, logger_util_1.errorLogger)('getHealth', 'Health check failed:', '', error || 'Unknown');
608
+ next(error || 'Internal Server Error');
609
609
  }
610
610
  });
611
611
  }
@@ -613,28 +613,28 @@ class Controller {
613
613
  return __awaiter(this, void 0, void 0, function* () {
614
614
  try {
615
615
  if (!this.adapter.getOAuth2RedirectUrl) {
616
- throw new _1.ServerError(501, "OAuth2 flow not implemented");
616
+ throw new _1.ServerError(501, 'OAuth2 flow not implemented');
617
617
  }
618
618
  const redirectUrl = yield this.adapter.getOAuth2RedirectUrl(req, res);
619
619
  res.status(200).send({ redirectUrl });
620
620
  }
621
621
  catch (error) {
622
- (0, logger_util_1.errorLogger)("oAuth2Redirect", "Could not get OAuth2 redirect URL:", "", error || "Unknown");
622
+ (0, logger_util_1.errorLogger)('oAuth2Redirect', 'Could not get OAuth2 redirect URL:', '', error || 'Unknown');
623
623
  next(error);
624
624
  }
625
625
  });
626
626
  }
627
627
  oAuth2Callback(req, res) {
628
628
  return __awaiter(this, void 0, void 0, function* () {
629
- let { OAUTH2_REDIRECT_URL: redirectUrl, OAUTH2_IDENTIFIER: oAuth2Identifier = "UNKNOWN", } = process.env;
629
+ let { OAUTH2_REDIRECT_URL: redirectUrl, OAUTH2_IDENTIFIER: oAuth2Identifier = 'UNKNOWN', } = process.env;
630
630
  if (!redirectUrl) {
631
- (0, logger_util_1.errorLogger)("oAuth2Callback", "OAuth2 Redirect URL not configured!", "");
632
- res.status(500).send("OAuth2 Redirect URL not configured!");
631
+ (0, logger_util_1.errorLogger)('oAuth2Callback', 'OAuth2 Redirect URL not configured!', '');
632
+ res.status(500).send('OAuth2 Redirect URL not configured!');
633
633
  return;
634
634
  }
635
635
  try {
636
636
  if (!this.adapter.handleOAuth2Callback) {
637
- throw new _1.ServerError(501, "OAuth2 flow not implemented");
637
+ throw new _1.ServerError(501, 'OAuth2 flow not implemented');
638
638
  }
639
639
  const { apiKey, apiUrl } = yield this.adapter.handleOAuth2Callback(req, res);
640
640
  const params = (0, querystring_1.stringify)({
@@ -645,7 +645,7 @@ class Controller {
645
645
  res.redirect(`${redirectUrl}?${params}`);
646
646
  }
647
647
  catch (error) {
648
- (0, logger_util_1.errorLogger)("oAuth2Callback", "Unable to save OAuth2 token:", "", error || "Unknown");
648
+ (0, logger_util_1.errorLogger)('oAuth2Callback', 'Unable to save OAuth2 token:', '', error || 'Unknown');
649
649
  res.redirect(redirectUrl);
650
650
  }
651
651
  });