@webex/calling 3.10.0-next.13 → 3.10.0-next.15

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 (95) hide show
  1. package/dist/CallHistory/CallHistory.js +118 -124
  2. package/dist/CallHistory/CallHistory.js.map +1 -1
  3. package/dist/CallHistory/CallHistory.test.js +189 -201
  4. package/dist/CallHistory/CallHistory.test.js.map +1 -1
  5. package/dist/CallSettings/CallSettings.js +17 -18
  6. package/dist/CallSettings/CallSettings.js.map +1 -1
  7. package/dist/CallSettings/CallSettings.test.js +14 -14
  8. package/dist/CallSettings/CallSettings.test.js.map +1 -1
  9. package/dist/CallSettings/UcmBackendConnector.js +71 -24
  10. package/dist/CallSettings/UcmBackendConnector.js.map +1 -1
  11. package/dist/CallSettings/UcmBackendConnector.test.js +136 -47
  12. package/dist/CallSettings/UcmBackendConnector.test.js.map +1 -1
  13. package/dist/CallSettings/WxCallBackendConnector.js +135 -137
  14. package/dist/CallSettings/WxCallBackendConnector.js.map +1 -1
  15. package/dist/CallSettings/WxCallBackendConnector.test.js +145 -149
  16. package/dist/CallSettings/WxCallBackendConnector.test.js.map +1 -1
  17. package/dist/CallingClient/CallingClient.js +198 -201
  18. package/dist/CallingClient/CallingClient.js.map +1 -1
  19. package/dist/CallingClient/CallingClient.test.js +168 -168
  20. package/dist/CallingClient/CallingClient.test.js.map +1 -1
  21. package/dist/CallingClient/calling/CallerId/index.js +7 -8
  22. package/dist/CallingClient/calling/CallerId/index.js.map +1 -1
  23. package/dist/CallingClient/calling/CallerId/index.test.js +24 -24
  24. package/dist/CallingClient/calling/CallerId/index.test.js.map +1 -1
  25. package/dist/CallingClient/calling/call.js +364 -366
  26. package/dist/CallingClient/calling/call.js.map +1 -1
  27. package/dist/CallingClient/calling/call.test.js +340 -340
  28. package/dist/CallingClient/calling/call.test.js.map +1 -1
  29. package/dist/CallingClient/calling/callManager.js +15 -18
  30. package/dist/CallingClient/calling/callManager.js.map +1 -1
  31. package/dist/CallingClient/calling/callManager.test.js +113 -113
  32. package/dist/CallingClient/calling/callManager.test.js.map +1 -1
  33. package/dist/CallingClient/line/index.js +57 -74
  34. package/dist/CallingClient/line/index.js.map +1 -1
  35. package/dist/CallingClient/line/line.test.js +22 -22
  36. package/dist/CallingClient/line/line.test.js.map +1 -1
  37. package/dist/CallingClient/registration/register.js +293 -300
  38. package/dist/CallingClient/registration/register.js.map +1 -1
  39. package/dist/CallingClient/registration/register.test.js +246 -246
  40. package/dist/CallingClient/registration/register.test.js.map +1 -1
  41. package/dist/CallingClient/registration/webWorker.js +24 -24
  42. package/dist/CallingClient/registration/webWorker.js.map +1 -1
  43. package/dist/CallingClient/registration/webWorker.test.js +20 -20
  44. package/dist/CallingClient/registration/webWorker.test.js.map +1 -1
  45. package/dist/CallingClient/windowsChromiumIceWarmupUtils.js +28 -28
  46. package/dist/CallingClient/windowsChromiumIceWarmupUtils.js.map +1 -1
  47. package/dist/Contacts/ContactsClient.js +250 -253
  48. package/dist/Contacts/ContactsClient.js.map +1 -1
  49. package/dist/Contacts/ContactsClient.test.js +60 -60
  50. package/dist/Contacts/ContactsClient.test.js.map +1 -1
  51. package/dist/Errors/catalog/CallError.js +7 -10
  52. package/dist/Errors/catalog/CallError.js.map +1 -1
  53. package/dist/Errors/catalog/CallingDeviceError.js +6 -9
  54. package/dist/Errors/catalog/CallingDeviceError.js.map +1 -1
  55. package/dist/Errors/catalog/ExtendedError.js +6 -8
  56. package/dist/Errors/catalog/ExtendedError.js.map +1 -1
  57. package/dist/Errors/catalog/LineError.js +6 -9
  58. package/dist/Errors/catalog/LineError.js.map +1 -1
  59. package/dist/Events/impl/index.js +11 -13
  60. package/dist/Events/impl/index.js.map +1 -1
  61. package/dist/Metrics/index.js +1 -2
  62. package/dist/Metrics/index.js.map +1 -1
  63. package/dist/SDKConnector/index.js +1 -2
  64. package/dist/SDKConnector/index.js.map +1 -1
  65. package/dist/Voicemail/BroadworksBackendConnector.js +126 -127
  66. package/dist/Voicemail/BroadworksBackendConnector.js.map +1 -1
  67. package/dist/Voicemail/BroadworksBackendConnector.test.js +98 -98
  68. package/dist/Voicemail/BroadworksBackendConnector.test.js.map +1 -1
  69. package/dist/Voicemail/UcmBackendConnector.js +84 -85
  70. package/dist/Voicemail/UcmBackendConnector.js.map +1 -1
  71. package/dist/Voicemail/UcmBackendConnector.test.js +72 -72
  72. package/dist/Voicemail/UcmBackendConnector.test.js.map +1 -1
  73. package/dist/Voicemail/Voicemail.js +58 -61
  74. package/dist/Voicemail/Voicemail.js.map +1 -1
  75. package/dist/Voicemail/Voicemail.test.js +20 -20
  76. package/dist/Voicemail/Voicemail.test.js.map +1 -1
  77. package/dist/Voicemail/WxCallBackendConnector.js +116 -117
  78. package/dist/Voicemail/WxCallBackendConnector.js.map +1 -1
  79. package/dist/Voicemail/WxCallBackendConnector.test.js +140 -140
  80. package/dist/Voicemail/WxCallBackendConnector.test.js.map +1 -1
  81. package/dist/common/Utils.js +168 -167
  82. package/dist/common/Utils.js.map +1 -1
  83. package/dist/common/Utils.test.js +120 -120
  84. package/dist/common/Utils.test.js.map +1 -1
  85. package/dist/common/constants.js +3 -1
  86. package/dist/common/constants.js.map +1 -1
  87. package/dist/common/testUtil.js +3 -3
  88. package/dist/common/testUtil.js.map +1 -1
  89. package/dist/module/CallSettings/UcmBackendConnector.js +20 -6
  90. package/dist/module/common/constants.js +2 -0
  91. package/dist/types/CallSettings/UcmBackendConnector.d.ts +1 -0
  92. package/dist/types/CallSettings/UcmBackendConnector.d.ts.map +1 -1
  93. package/dist/types/common/constants.d.ts +2 -0
  94. package/dist/types/common/constants.d.ts.map +1 -1
  95. package/package.json +2 -2
@@ -72,27 +72,27 @@ var ContactsClient = exports.ContactsClient = /*#__PURE__*/function () {
72
72
  /**
73
73
  * Decrypt emails, phoneNumbers, sipAddresses.
74
74
  */
75
- (0, _createClass2.default)(ContactsClient, [{
75
+ return (0, _createClass2.default)(ContactsClient, [{
76
76
  key: "decryptContactDetail",
77
77
  value: (function () {
78
78
  var _decryptContactDetail = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee(encryptionKeyUrl, contactDetails) {
79
79
  var _this = this;
80
80
  var decryptedContactDetail, decryptedValues;
81
- return _regenerator.default.wrap(function _callee$(_context) {
81
+ return _regenerator.default.wrap(function (_context) {
82
82
  while (1) switch (_context.prev = _context.next) {
83
83
  case 0:
84
84
  decryptedContactDetail = (0, _toConsumableArray2.default)(contactDetails);
85
- _context.next = 3;
85
+ _context.next = 1;
86
86
  return _promise.default.all(decryptedContactDetail.map(function (detail) {
87
87
  return _this.webex.internal.encryption.decryptText(encryptionKeyUrl, detail.value);
88
88
  }));
89
- case 3:
89
+ case 1:
90
90
  decryptedValues = _context.sent;
91
91
  decryptedValues.forEach(function (decryptedValue, index) {
92
92
  decryptedContactDetail[index].value = decryptedValue;
93
93
  });
94
94
  return _context.abrupt("return", decryptedContactDetail);
95
- case 6:
95
+ case 2:
96
96
  case "end":
97
97
  return _context.stop();
98
98
  }
@@ -114,21 +114,21 @@ var ContactsClient = exports.ContactsClient = /*#__PURE__*/function () {
114
114
  var _encryptContactDetail = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee2(encryptionKeyUrl, contactDetails) {
115
115
  var _this2 = this;
116
116
  var encryptedContactDetail, encryptedValues;
117
- return _regenerator.default.wrap(function _callee2$(_context2) {
117
+ return _regenerator.default.wrap(function (_context2) {
118
118
  while (1) switch (_context2.prev = _context2.next) {
119
119
  case 0:
120
120
  encryptedContactDetail = (0, _toConsumableArray2.default)(contactDetails);
121
- _context2.next = 3;
121
+ _context2.next = 1;
122
122
  return _promise.default.all(encryptedContactDetail.map(function (detail) {
123
123
  return _this2.webex.internal.encryption.encryptText(encryptionKeyUrl, detail.value);
124
124
  }));
125
- case 3:
125
+ case 1:
126
126
  encryptedValues = _context2.sent;
127
127
  encryptedValues.forEach(function (encryptedValue, index) {
128
128
  encryptedContactDetail[index].value = encryptedValue;
129
129
  });
130
130
  return _context2.abrupt("return", encryptedContactDetail);
131
- case 6:
131
+ case 2:
132
132
  case "end":
133
133
  return _context2.stop();
134
134
  }
@@ -149,40 +149,40 @@ var ContactsClient = exports.ContactsClient = /*#__PURE__*/function () {
149
149
  var _encryptContact = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee5(contact) {
150
150
  var _this3 = this;
151
151
  var encryptionKeyUrl, encryptedContact, encryptionPromises, encryptedFieldsList;
152
- return _regenerator.default.wrap(function _callee5$(_context5) {
152
+ return _regenerator.default.wrap(function (_context5) {
153
153
  while (1) switch (_context5.prev = _context5.next) {
154
154
  case 0:
155
155
  encryptionKeyUrl = contact.encryptionKeyUrl;
156
156
  encryptedContact = _objectSpread({}, contact);
157
157
  encryptionPromises = (0, _values.default)(_constants2.encryptedFields).map(/*#__PURE__*/function () {
158
158
  var _ref = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee4(field) {
159
- var plaintextAddressInfo, encryptedAddressInfo, encryptedAddressInfoPromises, plainTextDetails, encryptedDetails, encryptedValue;
160
- return _regenerator.default.wrap(function _callee4$(_context4) {
159
+ var plaintextAddressInfo, encryptedAddressInfo, encryptedAddressInfoPromises, plainTextDetails, encryptedDetails, encryptedValue, _t3, _t4;
160
+ return _regenerator.default.wrap(function (_context4) {
161
161
  while (1) switch (_context4.prev = _context4.next) {
162
162
  case 0:
163
- _context4.t0 = field;
164
- _context4.next = _context4.t0 === _constants2.encryptedFields.ADDRESS_INFO ? 3 : _context4.t0 === _constants2.encryptedFields.EMAILS ? 12 : _context4.t0 === _constants2.encryptedFields.PHONE_NUMBERS ? 12 : _context4.t0 === _constants2.encryptedFields.SIP_ADDRESSES ? 12 : 18;
163
+ _t3 = field;
164
+ _context4.next = _t3 === _constants2.encryptedFields.ADDRESS_INFO ? 1 : _t3 === _constants2.encryptedFields.EMAILS ? 4 : _t3 === _constants2.encryptedFields.PHONE_NUMBERS ? 4 : _t3 === _constants2.encryptedFields.SIP_ADDRESSES ? 4 : 7;
165
165
  break;
166
- case 3:
166
+ case 1:
167
167
  plaintextAddressInfo = encryptedContact.addressInfo;
168
168
  if (!plaintextAddressInfo) {
169
- _context4.next = 11;
169
+ _context4.next = 3;
170
170
  break;
171
171
  }
172
172
  encryptedAddressInfoPromises = (0, _entries.default)(plaintextAddressInfo).map(/*#__PURE__*/function () {
173
173
  var _ref3 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee3(_ref2) {
174
- var _ref4, key, value;
175
- return _regenerator.default.wrap(function _callee3$(_context3) {
174
+ var _ref4, key, value, _t, _t2;
175
+ return _regenerator.default.wrap(function (_context3) {
176
176
  while (1) switch (_context3.prev = _context3.next) {
177
177
  case 0:
178
178
  _ref4 = (0, _slicedToArray2.default)(_ref2, 2), key = _ref4[0], value = _ref4[1];
179
- _context3.t0 = key;
180
- _context3.next = 4;
179
+ _t = key;
180
+ _context3.next = 1;
181
181
  return _this3.webex.internal.encryption.encryptText(encryptionKeyUrl, value);
182
- case 4:
183
- _context3.t1 = _context3.sent;
184
- return _context3.abrupt("return", [_context3.t0, _context3.t1]);
185
- case 6:
182
+ case 1:
183
+ _t2 = _context3.sent;
184
+ return _context3.abrupt("return", [_t, _t2]);
185
+ case 2:
186
186
  case "end":
187
187
  return _context3.stop();
188
188
  }
@@ -192,38 +192,37 @@ var ContactsClient = exports.ContactsClient = /*#__PURE__*/function () {
192
192
  return _ref3.apply(this, arguments);
193
193
  };
194
194
  }());
195
- _context4.t1 = Object;
196
- _context4.next = 9;
195
+ _t4 = Object;
196
+ _context4.next = 2;
197
197
  return _promise.default.all(encryptedAddressInfoPromises);
198
- case 9:
199
- _context4.t2 = _context4.sent;
200
- encryptedAddressInfo = _context4.t1.fromEntries.call(_context4.t1, _context4.t2);
201
- case 11:
198
+ case 2:
199
+ encryptedAddressInfo = _t4.fromEntries.call(_t4, _context4.sent);
200
+ case 3:
202
201
  return _context4.abrupt("return", [field, encryptedAddressInfo]);
203
- case 12:
202
+ case 4:
204
203
  plainTextDetails = encryptedContact[field];
205
204
  if (!plainTextDetails) {
206
- _context4.next = 17;
205
+ _context4.next = 6;
207
206
  break;
208
207
  }
209
- _context4.next = 16;
208
+ _context4.next = 5;
210
209
  return _this3.encryptContactDetail(encryptionKeyUrl, plainTextDetails);
211
- case 16:
210
+ case 5:
212
211
  encryptedDetails = _context4.sent;
213
- case 17:
212
+ case 6:
214
213
  return _context4.abrupt("return", [field, encryptedDetails]);
215
- case 18:
214
+ case 7:
216
215
  if (!((0, _values.default)(_constants2.encryptedFields).includes(field) && encryptedContact[field])) {
217
- _context4.next = 22;
216
+ _context4.next = 9;
218
217
  break;
219
218
  }
220
- _context4.next = 21;
219
+ _context4.next = 8;
221
220
  return _this3.webex.internal.encryption.encryptText(encryptionKeyUrl, encryptedContact[field]);
222
- case 21:
221
+ case 8:
223
222
  encryptedValue = _context4.sent;
224
- case 22:
223
+ case 9:
225
224
  return _context4.abrupt("return", [field, encryptedValue]);
226
- case 23:
225
+ case 10:
227
226
  case "end":
228
227
  return _context4.stop();
229
228
  }
@@ -233,9 +232,9 @@ var ContactsClient = exports.ContactsClient = /*#__PURE__*/function () {
233
232
  return _ref.apply(this, arguments);
234
233
  };
235
234
  }());
236
- _context5.next = 5;
235
+ _context5.next = 1;
237
236
  return _promise.default.all(encryptionPromises);
238
- case 5:
237
+ case 1:
239
238
  encryptedFieldsList = _context5.sent;
240
239
  encryptedFieldsList.forEach(function (_ref5) {
241
240
  var _ref6 = (0, _slicedToArray2.default)(_ref5, 2),
@@ -246,7 +245,7 @@ var ContactsClient = exports.ContactsClient = /*#__PURE__*/function () {
246
245
  }
247
246
  });
248
247
  return _context5.abrupt("return", encryptedContact);
249
- case 8:
248
+ case 2:
250
249
  case "end":
251
250
  return _context5.stop();
252
251
  }
@@ -267,40 +266,40 @@ var ContactsClient = exports.ContactsClient = /*#__PURE__*/function () {
267
266
  var _decryptContact = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee8(contact) {
268
267
  var _this4 = this;
269
268
  var encryptionKeyUrl, decryptedContact, decryptionPromises, decryptedFieldsList;
270
- return _regenerator.default.wrap(function _callee8$(_context8) {
269
+ return _regenerator.default.wrap(function (_context8) {
271
270
  while (1) switch (_context8.prev = _context8.next) {
272
271
  case 0:
273
272
  encryptionKeyUrl = contact.encryptionKeyUrl;
274
273
  decryptedContact = _objectSpread({}, contact);
275
274
  decryptionPromises = (0, _values.default)(_constants2.encryptedFields).map(/*#__PURE__*/function () {
276
275
  var _ref7 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee7(field) {
277
- var plaintextAddressInfo, decryptedAddressInfo, decryptedAddressInfoPromises, plainTextDetails, decryptedDetails, decryptedValue;
278
- return _regenerator.default.wrap(function _callee7$(_context7) {
276
+ var plaintextAddressInfo, decryptedAddressInfo, decryptedAddressInfoPromises, plainTextDetails, decryptedDetails, decryptedValue, _t7, _t8;
277
+ return _regenerator.default.wrap(function (_context7) {
279
278
  while (1) switch (_context7.prev = _context7.next) {
280
279
  case 0:
281
- _context7.t0 = field;
282
- _context7.next = _context7.t0 === _constants2.encryptedFields.ADDRESS_INFO ? 3 : _context7.t0 === _constants2.encryptedFields.EMAILS ? 12 : _context7.t0 === _constants2.encryptedFields.PHONE_NUMBERS ? 12 : _context7.t0 === _constants2.encryptedFields.SIP_ADDRESSES ? 12 : 18;
280
+ _t7 = field;
281
+ _context7.next = _t7 === _constants2.encryptedFields.ADDRESS_INFO ? 1 : _t7 === _constants2.encryptedFields.EMAILS ? 4 : _t7 === _constants2.encryptedFields.PHONE_NUMBERS ? 4 : _t7 === _constants2.encryptedFields.SIP_ADDRESSES ? 4 : 7;
283
282
  break;
284
- case 3:
283
+ case 1:
285
284
  plaintextAddressInfo = decryptedContact.addressInfo;
286
285
  if (!plaintextAddressInfo) {
287
- _context7.next = 11;
286
+ _context7.next = 3;
288
287
  break;
289
288
  }
290
289
  decryptedAddressInfoPromises = (0, _entries.default)(plaintextAddressInfo).map(/*#__PURE__*/function () {
291
290
  var _ref9 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee6(_ref8) {
292
- var _ref0, key, value;
293
- return _regenerator.default.wrap(function _callee6$(_context6) {
291
+ var _ref0, key, value, _t5, _t6;
292
+ return _regenerator.default.wrap(function (_context6) {
294
293
  while (1) switch (_context6.prev = _context6.next) {
295
294
  case 0:
296
295
  _ref0 = (0, _slicedToArray2.default)(_ref8, 2), key = _ref0[0], value = _ref0[1];
297
- _context6.t0 = key;
298
- _context6.next = 4;
296
+ _t5 = key;
297
+ _context6.next = 1;
299
298
  return _this4.webex.internal.encryption.decryptText(encryptionKeyUrl, value);
300
- case 4:
301
- _context6.t1 = _context6.sent;
302
- return _context6.abrupt("return", [_context6.t0, _context6.t1]);
303
- case 6:
299
+ case 1:
300
+ _t6 = _context6.sent;
301
+ return _context6.abrupt("return", [_t5, _t6]);
302
+ case 2:
304
303
  case "end":
305
304
  return _context6.stop();
306
305
  }
@@ -310,38 +309,37 @@ var ContactsClient = exports.ContactsClient = /*#__PURE__*/function () {
310
309
  return _ref9.apply(this, arguments);
311
310
  };
312
311
  }());
313
- _context7.t1 = Object;
314
- _context7.next = 9;
312
+ _t8 = Object;
313
+ _context7.next = 2;
315
314
  return _promise.default.all(decryptedAddressInfoPromises);
316
- case 9:
317
- _context7.t2 = _context7.sent;
318
- decryptedAddressInfo = _context7.t1.fromEntries.call(_context7.t1, _context7.t2);
319
- case 11:
315
+ case 2:
316
+ decryptedAddressInfo = _t8.fromEntries.call(_t8, _context7.sent);
317
+ case 3:
320
318
  return _context7.abrupt("return", [field, decryptedAddressInfo]);
321
- case 12:
319
+ case 4:
322
320
  plainTextDetails = decryptedContact[field];
323
321
  if (!plainTextDetails) {
324
- _context7.next = 17;
322
+ _context7.next = 6;
325
323
  break;
326
324
  }
327
- _context7.next = 16;
325
+ _context7.next = 5;
328
326
  return _this4.decryptContactDetail(encryptionKeyUrl, plainTextDetails);
329
- case 16:
327
+ case 5:
330
328
  decryptedDetails = _context7.sent;
331
- case 17:
329
+ case 6:
332
330
  return _context7.abrupt("return", [field, decryptedDetails]);
333
- case 18:
331
+ case 7:
334
332
  if (!((0, _values.default)(_constants2.encryptedFields).includes(field) && decryptedContact[field])) {
335
- _context7.next = 22;
333
+ _context7.next = 9;
336
334
  break;
337
335
  }
338
- _context7.next = 21;
336
+ _context7.next = 8;
339
337
  return _this4.webex.internal.encryption.decryptText(encryptionKeyUrl, decryptedContact[field]);
340
- case 21:
338
+ case 8:
341
339
  decryptedValue = _context7.sent;
342
- case 22:
340
+ case 9:
343
341
  return _context7.abrupt("return", [field, decryptedValue]);
344
- case 23:
342
+ case 10:
345
343
  case "end":
346
344
  return _context7.stop();
347
345
  }
@@ -351,9 +349,9 @@ var ContactsClient = exports.ContactsClient = /*#__PURE__*/function () {
351
349
  return _ref7.apply(this, arguments);
352
350
  };
353
351
  }());
354
- _context8.next = 5;
352
+ _context8.next = 1;
355
353
  return _promise.default.all(decryptionPromises);
356
- case 5:
354
+ case 1:
357
355
  decryptedFieldsList = _context8.sent;
358
356
  decryptedFieldsList.forEach(function (_ref1) {
359
357
  var _ref10 = (0, _slicedToArray2.default)(_ref1, 2),
@@ -364,7 +362,7 @@ var ContactsClient = exports.ContactsClient = /*#__PURE__*/function () {
364
362
  }
365
363
  });
366
364
  return _context8.abrupt("return", decryptedContact);
367
- case 8:
365
+ case 2:
368
366
  case "end":
369
367
  return _context8.stop();
370
368
  }
@@ -455,8 +453,8 @@ var ContactsClient = exports.ContactsClient = /*#__PURE__*/function () {
455
453
  value: (function () {
456
454
  var _getContacts = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee1() {
457
455
  var _this5 = this;
458
- var loggerContext, contactList, cloudContactsMap, _response$headers, response, responseBody, contacts, groups, contactIdList, totalContacts, MAX_CONTACTS_PER_QUERY, i, contactIdListChunk, query, result, slicedCloudContactsMap, resolvedContacts, contactResponse, errorStatus;
459
- return _regenerator.default.wrap(function _callee1$(_context1) {
456
+ var loggerContext, contactList, cloudContactsMap, _response$headers, response, responseBody, contacts, groups, contactIdList, totalContacts, MAX_CONTACTS_PER_QUERY, i, contactIdListChunk, query, result, slicedCloudContactsMap, resolvedContacts, contactResponse, errorStatus, _t9, _t0;
457
+ return _regenerator.default.wrap(function (_context1) {
460
458
  while (1) switch (_context1.prev = _context1.next) {
461
459
  case 0:
462
460
  loggerContext = {
@@ -466,47 +464,47 @@ var ContactsClient = exports.ContactsClient = /*#__PURE__*/function () {
466
464
  _Logger.default.info(_constants.METHOD_START_MESSAGE, loggerContext);
467
465
  contactList = [];
468
466
  cloudContactsMap = {};
469
- _context1.prev = 4;
470
- _context1.next = 7;
467
+ _context1.prev = 1;
468
+ _context1.next = 2;
471
469
  return this.webex.request({
472
470
  // eslint-disable-next-line no-underscore-dangle
473
471
  uri: "".concat(this.contactsServiceUrl, "/").concat(_constants2.ENCRYPT_FILTER, "/").concat(_constants2.USERS, "/").concat(_constants2.CONTACT_FILTER),
474
472
  method: _types.HTTP_METHODS.GET
475
473
  });
476
- case 7:
474
+ case 2:
477
475
  response = _context1.sent;
478
476
  _Logger.default.log("Response code: ".concat(response.statusCode, " and Response trackingId: ").concat(response === null || response === void 0 ? void 0 : (_response$headers = response.headers) === null || _response$headers === void 0 ? void 0 : _response$headers.trackingid), loggerContext);
479
477
  responseBody = response.body;
480
478
  if (responseBody) {
481
- _context1.next = 12;
479
+ _context1.next = 3;
482
480
  break;
483
481
  }
484
482
  throw new Error("".concat(response));
485
- case 12:
483
+ case 3:
486
484
  contacts = responseBody.contacts, groups = responseBody.groups;
487
- _context1.next = 15;
485
+ _context1.next = 4;
488
486
  return _promise.default.all(contacts.map(/*#__PURE__*/function () {
489
487
  var _ref11 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee9(contact) {
490
488
  var decryptedContact;
491
- return _regenerator.default.wrap(function _callee9$(_context9) {
489
+ return _regenerator.default.wrap(function (_context9) {
492
490
  while (1) switch (_context9.prev = _context9.next) {
493
491
  case 0:
494
492
  if (!(contact.contactType === _types2.ContactType.CUSTOM)) {
495
- _context9.next = 7;
493
+ _context9.next = 2;
496
494
  break;
497
495
  }
498
- _context9.next = 3;
496
+ _context9.next = 1;
499
497
  return _this5.decryptContact(contact);
500
- case 3:
498
+ case 1:
501
499
  decryptedContact = _context9.sent;
502
500
  contactList.push(decryptedContact);
503
- _context9.next = 8;
501
+ _context9.next = 3;
504
502
  break;
505
- case 7:
503
+ case 2:
506
504
  if (contact.contactType === _types2.ContactType.CLOUD && contact.contactId) {
507
505
  cloudContactsMap[contact.contactId] = contact;
508
506
  }
509
- case 8:
507
+ case 3:
510
508
  case "end":
511
509
  return _context9.stop();
512
510
  }
@@ -516,28 +514,28 @@ var ContactsClient = exports.ContactsClient = /*#__PURE__*/function () {
516
514
  return _ref11.apply(this, arguments);
517
515
  };
518
516
  }()));
519
- case 15:
517
+ case 4:
520
518
  if (!(0, _keys.default)(cloudContactsMap).length) {
521
- _context1.next = 38;
519
+ _context1.next = 10;
522
520
  break;
523
521
  }
524
522
  contactIdList = (0, _keys.default)(cloudContactsMap);
525
523
  totalContacts = contactIdList.length;
526
524
  MAX_CONTACTS_PER_QUERY = 50;
527
525
  i = 0;
528
- case 20:
526
+ case 5:
529
527
  if (!(i < totalContacts)) {
530
- _context1.next = 38;
528
+ _context1.next = 10;
531
529
  break;
532
530
  }
533
- _context1.prev = 21;
531
+ _context1.prev = 6;
534
532
  contactIdListChunk = contactIdList.slice(i, i + MAX_CONTACTS_PER_QUERY);
535
533
  query = contactIdListChunk.map(function (item) {
536
534
  return "".concat(_constants2.SCIM_ID_FILTER, " \"").concat(item, "\"");
537
535
  }).join(_constants2.OR);
538
- _context1.next = 26;
536
+ _context1.next = 7;
539
537
  return (0, _Utils.scimQuery)(query);
540
- case 26:
538
+ case 7:
541
539
  result = _context1.sent;
542
540
  slicedCloudContactsMap = Object.fromEntries((0, _entries.default)(cloudContactsMap).slice(i, i + MAX_CONTACTS_PER_QUERY));
543
541
  resolvedContacts = this.resolveCloudContacts(slicedCloudContactsMap, result.body);
@@ -546,28 +544,28 @@ var ContactsClient = exports.ContactsClient = /*#__PURE__*/function () {
546
544
  return contactList.push(item);
547
545
  });
548
546
  }
549
- _context1.next = 35;
547
+ _context1.next = 9;
550
548
  break;
551
- case 32:
552
- _context1.prev = 32;
553
- _context1.t0 = _context1["catch"](21);
549
+ case 8:
550
+ _context1.prev = 8;
551
+ _t9 = _context1["catch"](6);
554
552
  _Logger.default.warn("Error processing contact chunk ".concat(i, "-").concat(i + MAX_CONTACTS_PER_QUERY), loggerContext);
555
- case 35:
553
+ case 9:
556
554
  i += MAX_CONTACTS_PER_QUERY;
557
- _context1.next = 20;
555
+ _context1.next = 5;
558
556
  break;
559
- case 38:
560
- _context1.next = 40;
557
+ case 10:
558
+ _context1.next = 11;
561
559
  return _promise.default.all(groups.map(/*#__PURE__*/function () {
562
560
  var _ref12 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee0(group, idx) {
563
- return _regenerator.default.wrap(function _callee0$(_context0) {
561
+ return _regenerator.default.wrap(function (_context0) {
564
562
  while (1) switch (_context0.prev = _context0.next) {
565
563
  case 0:
566
- _context0.next = 2;
564
+ _context0.next = 1;
567
565
  return _this5.webex.internal.encryption.decryptText(group.encryptionKeyUrl, group.displayName);
568
- case 2:
566
+ case 1:
569
567
  groups[idx].displayName = _context0.sent;
570
- case 3:
568
+ case 2:
571
569
  case "end":
572
570
  return _context0.stop();
573
571
  }
@@ -577,7 +575,7 @@ var ContactsClient = exports.ContactsClient = /*#__PURE__*/function () {
577
575
  return _ref12.apply(this, arguments);
578
576
  };
579
577
  }()));
580
- case 40:
578
+ case 11:
581
579
  this.groups = groups;
582
580
  this.contacts = contactList;
583
581
  contactResponse = {
@@ -590,20 +588,20 @@ var ContactsClient = exports.ContactsClient = /*#__PURE__*/function () {
590
588
  };
591
589
  _Logger.default.log('Successfully fetched contacts and groups', loggerContext);
592
590
  return _context1.abrupt("return", contactResponse);
593
- case 47:
594
- _context1.prev = 47;
595
- _context1.t1 = _context1["catch"](4);
596
- _Logger.default.error("Error fetching contacts: ".concat((0, _stringify.default)(_context1.t1)), loggerContext);
597
- errorStatus = (0, _Utils.serviceErrorCodeHandler)(_context1.t1, loggerContext);
598
- _context1.next = 53;
591
+ case 12:
592
+ _context1.prev = 12;
593
+ _t0 = _context1["catch"](1);
594
+ _Logger.default.error("Error fetching contacts: ".concat((0, _stringify.default)(_t0)), loggerContext);
595
+ errorStatus = (0, _Utils.serviceErrorCodeHandler)(_t0, loggerContext);
596
+ _context1.next = 13;
599
597
  return (0, _Utils.uploadLogs)();
600
- case 53:
598
+ case 13:
601
599
  return _context1.abrupt("return", errorStatus);
602
- case 54:
600
+ case 14:
603
601
  case "end":
604
602
  return _context1.stop();
605
603
  }
606
- }, _callee1, this, [[4, 47], [21, 32]]);
604
+ }, _callee1, this, [[1, 12], [6, 8]]);
607
605
  }));
608
606
  function getContacts() {
609
607
  return _getContacts.apply(this, arguments);
@@ -621,7 +619,7 @@ var ContactsClient = exports.ContactsClient = /*#__PURE__*/function () {
621
619
  value: (function () {
622
620
  var _createNewEncryptionKeyUrl = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee10() {
623
621
  var loggerContext, unboundedKeyUri, unboundedKeys;
624
- return _regenerator.default.wrap(function _callee10$(_context10) {
622
+ return _regenerator.default.wrap(function (_context10) {
625
623
  while (1) switch (_context10.prev = _context10.next) {
626
624
  case 0:
627
625
  loggerContext = {
@@ -631,18 +629,18 @@ var ContactsClient = exports.ContactsClient = /*#__PURE__*/function () {
631
629
  _Logger.default.info(_constants.METHOD_START_MESSAGE, loggerContext);
632
630
  unboundedKeyUri = '';
633
631
  _Logger.default.info('Requesting kms for a new KRO and key', loggerContext);
634
- _context10.next = 6;
632
+ _context10.next = 1;
635
633
  return this.webex.internal.encryption.kms.createUnboundKeys({
636
634
  count: 1
637
635
  });
638
- case 6:
636
+ case 1:
639
637
  unboundedKeys = _context10.sent;
640
638
  unboundedKeyUri = unboundedKeys[0].uri;
641
639
  this.webex.internal.encryption.kms.createResource({
642
640
  keyUris: [unboundedKeyUri]
643
641
  });
644
642
  return _context10.abrupt("return", unboundedKeyUri);
645
- case 10:
643
+ case 2:
646
644
  case "end":
647
645
  return _context10.stop();
648
646
  }
@@ -665,7 +663,7 @@ var ContactsClient = exports.ContactsClient = /*#__PURE__*/function () {
665
663
  var _fetchEncryptionKeyUrl = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee11() {
666
664
  var _response$data$group;
667
665
  var loggerContext, response, _response$data$group2;
668
- return _regenerator.default.wrap(function _callee11$(_context11) {
666
+ return _regenerator.default.wrap(function (_context11) {
669
667
  while (1) switch (_context11.prev = _context11.next) {
670
668
  case 0:
671
669
  loggerContext = {
@@ -674,33 +672,33 @@ var ContactsClient = exports.ContactsClient = /*#__PURE__*/function () {
674
672
  };
675
673
  _Logger.default.info(_constants.METHOD_START_MESSAGE, loggerContext);
676
674
  if (!this.encryptionKeyUrl) {
677
- _context11.next = 4;
675
+ _context11.next = 1;
678
676
  break;
679
677
  }
680
678
  return _context11.abrupt("return", this.encryptionKeyUrl);
681
- case 4:
679
+ case 1:
682
680
  // istanbul ignore else
683
681
  if (this.groups === undefined) {
684
682
  this.getContacts();
685
683
  }
686
684
  // istanbul ignore else
687
685
  if (!(this.groups && this.groups.length)) {
688
- _context11.next = 7;
686
+ _context11.next = 2;
689
687
  break;
690
688
  }
691
689
  return _context11.abrupt("return", this.groups[0].encryptionKeyUrl);
692
- case 7:
693
- _context11.next = 9;
690
+ case 2:
691
+ _context11.next = 3;
694
692
  return this.createNewEncryptionKeyUrl();
695
- case 9:
693
+ case 3:
696
694
  this.encryptionKeyUrl = _context11.sent;
697
695
  _Logger.default.log("Creating a default group: ".concat(_constants2.DEFAULT_GROUP_NAME), {
698
696
  file: _constants2.CONTACTS_CLIENT,
699
697
  method: this.fetchEncryptionKeyUrl.name
700
698
  });
701
- _context11.next = 13;
699
+ _context11.next = 4;
702
700
  return this.createContactGroup(_constants2.DEFAULT_GROUP_NAME, this.encryptionKeyUrl);
703
- case 13:
701
+ case 4:
704
702
  response = _context11.sent;
705
703
  if ((_response$data$group = response.data.group) !== null && _response$data$group !== void 0 && _response$data$group.groupId) {
706
704
  this.defaultGroupId = (_response$data$group2 = response.data.group) === null || _response$data$group2 === void 0 ? void 0 : _response$data$group2.groupId;
@@ -710,7 +708,7 @@ var ContactsClient = exports.ContactsClient = /*#__PURE__*/function () {
710
708
  });
711
709
  }
712
710
  return _context11.abrupt("return", this.encryptionKeyUrl);
713
- case 16:
711
+ case 5:
714
712
  case "end":
715
713
  return _context11.stop();
716
714
  }
@@ -732,7 +730,7 @@ var ContactsClient = exports.ContactsClient = /*#__PURE__*/function () {
732
730
  value: (function () {
733
731
  var _fetchDefaultGroup = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee12() {
734
732
  var loggerContext, i, response, group, groupId;
735
- return _regenerator.default.wrap(function _callee12$(_context12) {
733
+ return _regenerator.default.wrap(function (_context12) {
736
734
  while (1) switch (_context12.prev = _context12.next) {
737
735
  case 0:
738
736
  loggerContext = {
@@ -741,7 +739,7 @@ var ContactsClient = exports.ContactsClient = /*#__PURE__*/function () {
741
739
  };
742
740
  _Logger.default.info(_constants.METHOD_START_MESSAGE, loggerContext);
743
741
  if (!this.defaultGroupId) {
744
- _context12.next = 5;
742
+ _context12.next = 1;
745
743
  break;
746
744
  }
747
745
  _Logger.default.log("Using existing default group with ID: ".concat(this.defaultGroupId), {
@@ -749,19 +747,19 @@ var ContactsClient = exports.ContactsClient = /*#__PURE__*/function () {
749
747
  method: this.fetchDefaultGroup.name
750
748
  });
751
749
  return _context12.abrupt("return", this.defaultGroupId);
752
- case 5:
750
+ case 1:
753
751
  if (!(this.groups && this.groups.length)) {
754
- _context12.next = 15;
752
+ _context12.next = 4;
755
753
  break;
756
754
  }
757
755
  i = 0;
758
- case 7:
756
+ case 2:
759
757
  if (!(i < this.groups.length)) {
760
- _context12.next = 15;
758
+ _context12.next = 4;
761
759
  break;
762
760
  }
763
761
  if (!(this.groups[i].displayName === _constants2.DEFAULT_GROUP_NAME)) {
764
- _context12.next = 12;
762
+ _context12.next = 3;
765
763
  break;
766
764
  }
767
765
  this.defaultGroupId = this.groups[i].groupId;
@@ -770,22 +768,22 @@ var ContactsClient = exports.ContactsClient = /*#__PURE__*/function () {
770
768
  method: this.fetchDefaultGroup.name
771
769
  });
772
770
  return _context12.abrupt("return", this.defaultGroupId);
773
- case 12:
771
+ case 3:
774
772
  i += 1;
775
- _context12.next = 7;
773
+ _context12.next = 2;
776
774
  break;
777
- case 15:
775
+ case 4:
778
776
  _Logger.default.log('No default group found.', {
779
777
  file: _constants2.CONTACTS_CLIENT,
780
778
  method: this.fetchDefaultGroup.name
781
779
  });
782
- _context12.next = 18;
780
+ _context12.next = 5;
783
781
  return this.createContactGroup(_constants2.DEFAULT_GROUP_NAME);
784
- case 18:
782
+ case 5:
785
783
  response = _context12.sent;
786
784
  group = response.data.group;
787
785
  if (!group) {
788
- _context12.next = 24;
786
+ _context12.next = 6;
789
787
  break;
790
788
  }
791
789
  groupId = group.groupId;
@@ -794,9 +792,9 @@ var ContactsClient = exports.ContactsClient = /*#__PURE__*/function () {
794
792
  method: this.fetchDefaultGroup.name
795
793
  });
796
794
  return _context12.abrupt("return", groupId);
797
- case 24:
795
+ case 6:
798
796
  return _context12.abrupt("return", '');
799
- case 25:
797
+ case 7:
800
798
  case "end":
801
799
  return _context12.stop();
802
800
  }
@@ -819,8 +817,8 @@ var ContactsClient = exports.ContactsClient = /*#__PURE__*/function () {
819
817
  key: "createContactGroup",
820
818
  value: (function () {
821
819
  var _createContactGroup = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee13(displayName, encryptionKeyUrl, groupType) {
822
- var loggerContext, encryptionKeyUrlFinal, isExistingGroup, encryptedDisplayName, groupInfo, _response$headers2, _this$groups, response, group, contactResponse, errorStatus;
823
- return _regenerator.default.wrap(function _callee13$(_context13) {
820
+ var loggerContext, encryptionKeyUrlFinal, isExistingGroup, encryptedDisplayName, groupInfo, _response$headers2, _this$groups, response, group, contactResponse, errorStatus, _t1, _t10;
821
+ return _regenerator.default.wrap(function (_context13) {
824
822
  while (1) switch (_context13.prev = _context13.next) {
825
823
  case 0:
826
824
  loggerContext = {
@@ -828,33 +826,33 @@ var ContactsClient = exports.ContactsClient = /*#__PURE__*/function () {
828
826
  method: _constants2.METHODS.CREATE_CONTACT_GROUP
829
827
  };
830
828
  _Logger.default.info("".concat(_constants.METHOD_START_MESSAGE, " with displayName: ").concat(displayName), loggerContext);
831
- _context13.t0 = encryptionKeyUrl;
832
- if (_context13.t0) {
833
- _context13.next = 7;
829
+ _t1 = encryptionKeyUrl;
830
+ if (_t1) {
831
+ _context13.next = 2;
834
832
  break;
835
833
  }
836
- _context13.next = 6;
834
+ _context13.next = 1;
837
835
  return this.fetchEncryptionKeyUrl();
838
- case 6:
839
- _context13.t0 = _context13.sent;
840
- case 7:
841
- encryptionKeyUrlFinal = _context13.t0;
836
+ case 1:
837
+ _t1 = _context13.sent;
838
+ case 2:
839
+ encryptionKeyUrlFinal = _t1;
842
840
  if (!(this.groups === undefined)) {
843
- _context13.next = 11;
841
+ _context13.next = 3;
844
842
  break;
845
843
  }
846
- _context13.next = 11;
844
+ _context13.next = 3;
847
845
  return this.getContacts();
848
- case 11:
846
+ case 3:
849
847
  if (!(this.groups && this.groups.length)) {
850
- _context13.next = 16;
848
+ _context13.next = 4;
851
849
  break;
852
850
  }
853
851
  isExistingGroup = this.groups.find(function (group) {
854
852
  return group.displayName === displayName;
855
853
  });
856
854
  if (!isExistingGroup) {
857
- _context13.next = 16;
855
+ _context13.next = 4;
858
856
  break;
859
857
  }
860
858
  _Logger.default.warn("Group name ".concat(displayName, " already exists."), loggerContext);
@@ -865,10 +863,10 @@ var ContactsClient = exports.ContactsClient = /*#__PURE__*/function () {
865
863
  },
866
864
  message: _constants.FAILURE_MESSAGE
867
865
  });
868
- case 16:
869
- _context13.next = 18;
866
+ case 4:
867
+ _context13.next = 5;
870
868
  return this.webex.internal.encryption.encryptText(encryptionKeyUrlFinal, displayName);
871
- case 18:
869
+ case 5:
872
870
  encryptedDisplayName = _context13.sent;
873
871
  groupInfo = {
874
872
  schemas: _constants2.CONTACTS_SCHEMA,
@@ -876,15 +874,15 @@ var ContactsClient = exports.ContactsClient = /*#__PURE__*/function () {
876
874
  groupType: groupType || _types2.GroupType.NORMAL,
877
875
  encryptionKeyUrl: encryptionKeyUrlFinal
878
876
  };
879
- _context13.prev = 20;
880
- _context13.next = 23;
877
+ _context13.prev = 6;
878
+ _context13.next = 7;
881
879
  return this.webex.request({
882
880
  // eslint-disable-next-line no-underscore-dangle
883
881
  uri: "".concat(this.contactsServiceUrl, "/").concat(_constants2.ENCRYPT_FILTER, "/").concat(_constants2.USERS, "/").concat(_constants2.GROUP_FILTER),
884
882
  method: _types.HTTP_METHODS.POST,
885
883
  body: groupInfo
886
884
  });
887
- case 23:
885
+ case 7:
888
886
  response = _context13.sent;
889
887
  _Logger.default.log("Response code: ".concat(response.statusCode), loggerContext);
890
888
  _Logger.default.log("Response trackingId: ".concat(response === null || response === void 0 ? void 0 : (_response$headers2 = response.headers) === null || _response$headers2 === void 0 ? void 0 : _response$headers2.trackingid), loggerContext);
@@ -900,20 +898,20 @@ var ContactsClient = exports.ContactsClient = /*#__PURE__*/function () {
900
898
  (_this$groups = this.groups) === null || _this$groups === void 0 ? void 0 : _this$groups.push(group);
901
899
  _Logger.default.log("Contact group ".concat(displayName, " successfully created"), loggerContext);
902
900
  return _context13.abrupt("return", contactResponse);
903
- case 34:
904
- _context13.prev = 34;
905
- _context13.t1 = _context13["catch"](20);
906
- _Logger.default.error("Unable to create contact group: ".concat((0, _stringify.default)(_context13.t1)), loggerContext);
907
- errorStatus = (0, _Utils.serviceErrorCodeHandler)(_context13.t1, loggerContext);
908
- _context13.next = 40;
901
+ case 8:
902
+ _context13.prev = 8;
903
+ _t10 = _context13["catch"](6);
904
+ _Logger.default.error("Unable to create contact group: ".concat((0, _stringify.default)(_t10)), loggerContext);
905
+ errorStatus = (0, _Utils.serviceErrorCodeHandler)(_t10, loggerContext);
906
+ _context13.next = 9;
909
907
  return (0, _Utils.uploadLogs)();
910
- case 40:
908
+ case 9:
911
909
  return _context13.abrupt("return", errorStatus);
912
- case 41:
910
+ case 10:
913
911
  case "end":
914
912
  return _context13.stop();
915
913
  }
916
- }, _callee13, this, [[20, 34]]);
914
+ }, _callee13, this, [[6, 8]]);
917
915
  }));
918
916
  function createContactGroup(_x12, _x13, _x14) {
919
917
  return _createContactGroup.apply(this, arguments);
@@ -929,8 +927,8 @@ var ContactsClient = exports.ContactsClient = /*#__PURE__*/function () {
929
927
  key: "deleteContactGroup",
930
928
  value: (function () {
931
929
  var _deleteContactGroup = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee14(groupId) {
932
- var loggerContext, _response$headers3, _this$groups2, _this$groups4, response, contactResponse, groupToDelete, _this$groups3, errorStatus;
933
- return _regenerator.default.wrap(function _callee14$(_context14) {
930
+ var loggerContext, _response$headers3, _this$groups2, _this$groups4, response, contactResponse, groupToDelete, _this$groups3, errorStatus, _t11;
931
+ return _regenerator.default.wrap(function (_context14) {
934
932
  while (1) switch (_context14.prev = _context14.next) {
935
933
  case 0:
936
934
  loggerContext = {
@@ -938,15 +936,15 @@ var ContactsClient = exports.ContactsClient = /*#__PURE__*/function () {
938
936
  method: _constants2.METHODS.DELETE_CONTACT_GROUP
939
937
  };
940
938
  _Logger.default.info("".concat(_constants.METHOD_START_MESSAGE, " with groupId: ").concat(groupId), loggerContext);
941
- _context14.prev = 2;
939
+ _context14.prev = 1;
942
940
  _Logger.default.info("Deleting contact group: ".concat(groupId), loggerContext);
943
- _context14.next = 6;
941
+ _context14.next = 2;
944
942
  return this.webex.request({
945
943
  // eslint-disable-next-line no-underscore-dangle
946
944
  uri: "".concat(this.contactsServiceUrl, "/").concat(_constants2.ENCRYPT_FILTER, "/").concat(_constants2.USERS, "/").concat(_constants2.GROUP_FILTER, "/").concat(groupId),
947
945
  method: _types.HTTP_METHODS.DELETE
948
946
  });
949
- case 6:
947
+ case 2:
950
948
  response = _context14.sent;
951
949
  _Logger.default.log("Response trackingId: ".concat(response === null || response === void 0 ? void 0 : (_response$headers3 = response.headers) === null || _response$headers3 === void 0 ? void 0 : _response$headers3.trackingid), loggerContext);
952
950
  contactResponse = {
@@ -965,20 +963,20 @@ var ContactsClient = exports.ContactsClient = /*#__PURE__*/function () {
965
963
  }
966
964
  _Logger.default.log("Contact group ".concat(groupId, " successfully deleted"), loggerContext);
967
965
  return _context14.abrupt("return", contactResponse);
968
- case 16:
969
- _context14.prev = 16;
970
- _context14.t0 = _context14["catch"](2);
971
- _Logger.default.error("Unable to delete contact group ".concat(groupId, ": ").concat((0, _stringify.default)(_context14.t0)), loggerContext);
972
- errorStatus = (0, _Utils.serviceErrorCodeHandler)(_context14.t0, loggerContext);
973
- _context14.next = 22;
966
+ case 3:
967
+ _context14.prev = 3;
968
+ _t11 = _context14["catch"](1);
969
+ _Logger.default.error("Unable to delete contact group ".concat(groupId, ": ").concat((0, _stringify.default)(_t11)), loggerContext);
970
+ errorStatus = (0, _Utils.serviceErrorCodeHandler)(_t11, loggerContext);
971
+ _context14.next = 4;
974
972
  return (0, _Utils.uploadLogs)();
975
- case 22:
973
+ case 4:
976
974
  return _context14.abrupt("return", errorStatus);
977
- case 23:
975
+ case 5:
978
976
  case "end":
979
977
  return _context14.stop();
980
978
  }
981
- }, _callee14, this, [[2, 16]]);
979
+ }, _callee14, this, [[1, 3]]);
982
980
  }));
983
981
  function deleteContactGroup(_x15) {
984
982
  return _deleteContactGroup.apply(this, arguments);
@@ -994,8 +992,8 @@ var ContactsClient = exports.ContactsClient = /*#__PURE__*/function () {
994
992
  key: "createContact",
995
993
  value: (function () {
996
994
  var _createContact = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee15(contactInfo) {
997
- var loggerContext, _response$headers4, contact, defaultGroupId, requestBody, encryptedContact, _encryptedContact, response, newContact, contactResponse, query, res, resolvedContact, _this$contacts, _this$contacts2, errorStatus;
998
- return _regenerator.default.wrap(function _callee15$(_context15) {
995
+ var loggerContext, _response$headers4, contact, defaultGroupId, requestBody, encryptedContact, _encryptedContact, response, newContact, contactResponse, query, res, resolvedContact, _this$contacts, _this$contacts2, errorStatus, _t12, _t13;
996
+ return _regenerator.default.wrap(function (_context15) {
999
997
  while (1) switch (_context15.prev = _context15.next) {
1000
998
  case 0:
1001
999
  loggerContext = {
@@ -1003,42 +1001,42 @@ var ContactsClient = exports.ContactsClient = /*#__PURE__*/function () {
1003
1001
  method: _constants2.METHODS.CREATE_CONTACT
1004
1002
  };
1005
1003
  _Logger.default.info("".concat(_constants.METHOD_START_MESSAGE, " with contactType: ").concat(contactInfo.contactType), loggerContext);
1006
- _context15.prev = 2;
1004
+ _context15.prev = 1;
1007
1005
  contact = _objectSpread({}, contactInfo);
1008
1006
  if (contact.encryptionKeyUrl) {
1009
- _context15.next = 8;
1007
+ _context15.next = 3;
1010
1008
  break;
1011
1009
  }
1012
- _context15.next = 7;
1010
+ _context15.next = 2;
1013
1011
  return this.fetchEncryptionKeyUrl();
1014
- case 7:
1012
+ case 2:
1015
1013
  contact.encryptionKeyUrl = _context15.sent;
1016
- case 8:
1014
+ case 3:
1017
1015
  if (!(!contact.groups || contact.groups.length === 0)) {
1018
- _context15.next = 13;
1016
+ _context15.next = 5;
1019
1017
  break;
1020
1018
  }
1021
- _context15.next = 11;
1019
+ _context15.next = 4;
1022
1020
  return this.fetchDefaultGroup();
1023
- case 11:
1021
+ case 4:
1024
1022
  defaultGroupId = _context15.sent;
1025
1023
  contact.groups = [defaultGroupId];
1026
- case 13:
1024
+ case 5:
1027
1025
  contact.schemas = _constants2.CONTACTS_SCHEMA;
1028
1026
  requestBody = {};
1029
- _context15.t0 = contact.contactType;
1030
- _context15.next = _context15.t0 === _types2.ContactType.CUSTOM ? 18 : _context15.t0 === _types2.ContactType.CLOUD ? 23 : 30;
1027
+ _t12 = contact.contactType;
1028
+ _context15.next = _t12 === _types2.ContactType.CUSTOM ? 6 : _t12 === _types2.ContactType.CLOUD ? 8 : 11;
1031
1029
  break;
1032
- case 18:
1033
- _context15.next = 20;
1030
+ case 6:
1031
+ _context15.next = 7;
1034
1032
  return this.encryptContact(contact);
1035
- case 20:
1033
+ case 7:
1036
1034
  encryptedContact = _context15.sent;
1037
1035
  requestBody = encryptedContact;
1038
- return _context15.abrupt("break", 31);
1039
- case 23:
1036
+ return _context15.abrupt("continue", 12);
1037
+ case 8:
1040
1038
  if (contact.contactId) {
1041
- _context15.next = 25;
1039
+ _context15.next = 9;
1042
1040
  break;
1043
1041
  }
1044
1042
  return _context15.abrupt("return", {
@@ -1048,14 +1046,14 @@ var ContactsClient = exports.ContactsClient = /*#__PURE__*/function () {
1048
1046
  },
1049
1047
  message: _constants.FAILURE_MESSAGE
1050
1048
  });
1051
- case 25:
1052
- _context15.next = 27;
1049
+ case 9:
1050
+ _context15.next = 10;
1053
1051
  return this.encryptContact(contact);
1054
- case 27:
1052
+ case 10:
1055
1053
  _encryptedContact = _context15.sent;
1056
1054
  requestBody = _encryptedContact;
1057
- return _context15.abrupt("break", 31);
1058
- case 30:
1055
+ return _context15.abrupt("continue", 12);
1056
+ case 11:
1059
1057
  return _context15.abrupt("return", {
1060
1058
  statusCode: 400,
1061
1059
  data: {
@@ -1063,15 +1061,15 @@ var ContactsClient = exports.ContactsClient = /*#__PURE__*/function () {
1063
1061
  },
1064
1062
  message: _constants.FAILURE_MESSAGE
1065
1063
  });
1066
- case 31:
1067
- _context15.next = 33;
1064
+ case 12:
1065
+ _context15.next = 13;
1068
1066
  return this.webex.request({
1069
1067
  // eslint-disable-next-line no-underscore-dangle
1070
1068
  uri: "".concat(this.contactsServiceUrl, "/").concat(_constants2.ENCRYPT_FILTER, "/").concat(_constants2.USERS, "/").concat(_constants2.CONTACT_FILTER),
1071
1069
  method: _types.HTTP_METHODS.POST,
1072
1070
  body: requestBody
1073
1071
  });
1074
- case 33:
1072
+ case 13:
1075
1073
  response = _context15.sent;
1076
1074
  _Logger.default.log("Response code: ".concat(response.statusCode), loggerContext);
1077
1075
  _Logger.default.log("Response trackingId: ".concat(response === null || response === void 0 ? void 0 : (_response$headers4 = response.headers) === null || _response$headers4 === void 0 ? void 0 : _response$headers4.trackingid), loggerContext);
@@ -1085,39 +1083,39 @@ var ContactsClient = exports.ContactsClient = /*#__PURE__*/function () {
1085
1083
  message: _constants.SUCCESS_MESSAGE
1086
1084
  };
1087
1085
  if (!(contact.contactType === _types2.ContactType.CLOUD && newContact.contactId)) {
1088
- _context15.next = 48;
1086
+ _context15.next = 15;
1089
1087
  break;
1090
1088
  }
1091
1089
  query = "".concat(_constants2.SCIM_ID_FILTER, " \"").concat(newContact.contactId, "\"");
1092
- _context15.next = 43;
1090
+ _context15.next = 14;
1093
1091
  return (0, _Utils.scimQuery)(query);
1094
- case 43:
1092
+ case 14:
1095
1093
  res = _context15.sent;
1096
1094
  resolvedContact = this.resolveCloudContacts(Object.fromEntries([[newContact.contactId, newContact]]), res.body);
1097
1095
  if (resolvedContact) {
1098
1096
  (_this$contacts = this.contacts) === null || _this$contacts === void 0 ? void 0 : _this$contacts.push(resolvedContact[0]);
1099
1097
  }
1100
- _context15.next = 49;
1098
+ _context15.next = 16;
1101
1099
  break;
1102
- case 48:
1100
+ case 15:
1103
1101
  (_this$contacts2 = this.contacts) === null || _this$contacts2 === void 0 ? void 0 : _this$contacts2.push(contact);
1104
- case 49:
1102
+ case 16:
1105
1103
  _Logger.default.log("Contact successfully created", loggerContext);
1106
1104
  return _context15.abrupt("return", contactResponse);
1107
- case 53:
1108
- _context15.prev = 53;
1109
- _context15.t1 = _context15["catch"](2);
1110
- _Logger.default.error("Failed to create contact: ".concat((0, _stringify.default)(_context15.t1)), loggerContext);
1111
- errorStatus = (0, _Utils.serviceErrorCodeHandler)(_context15.t1, loggerContext);
1112
- _context15.next = 59;
1105
+ case 17:
1106
+ _context15.prev = 17;
1107
+ _t13 = _context15["catch"](1);
1108
+ _Logger.default.error("Failed to create contact: ".concat((0, _stringify.default)(_t13)), loggerContext);
1109
+ errorStatus = (0, _Utils.serviceErrorCodeHandler)(_t13, loggerContext);
1110
+ _context15.next = 18;
1113
1111
  return (0, _Utils.uploadLogs)();
1114
- case 59:
1112
+ case 18:
1115
1113
  return _context15.abrupt("return", errorStatus);
1116
- case 60:
1114
+ case 19:
1117
1115
  case "end":
1118
1116
  return _context15.stop();
1119
1117
  }
1120
- }, _callee15, this, [[2, 53]]);
1118
+ }, _callee15, this, [[1, 17]]);
1121
1119
  }));
1122
1120
  function createContact(_x16) {
1123
1121
  return _createContact.apply(this, arguments);
@@ -1133,8 +1131,8 @@ var ContactsClient = exports.ContactsClient = /*#__PURE__*/function () {
1133
1131
  key: "deleteContact",
1134
1132
  value: (function () {
1135
1133
  var _deleteContact = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee16(contactId) {
1136
- var loggerContext, _this$contacts3, response, contactResponse, contactToDelete, _this$contacts4, errorStatus;
1137
- return _regenerator.default.wrap(function _callee16$(_context16) {
1134
+ var loggerContext, _this$contacts3, response, contactResponse, contactToDelete, _this$contacts4, errorStatus, _t14;
1135
+ return _regenerator.default.wrap(function (_context16) {
1138
1136
  while (1) switch (_context16.prev = _context16.next) {
1139
1137
  case 0:
1140
1138
  loggerContext = {
@@ -1142,15 +1140,15 @@ var ContactsClient = exports.ContactsClient = /*#__PURE__*/function () {
1142
1140
  method: _constants2.METHODS.DELETE_CONTACT
1143
1141
  };
1144
1142
  _Logger.default.info("".concat(_constants.METHOD_START_MESSAGE, " with contactId: ").concat(contactId), loggerContext);
1145
- _context16.prev = 2;
1143
+ _context16.prev = 1;
1146
1144
  _Logger.default.info("Deleting contact : ".concat(contactId), loggerContext);
1147
- _context16.next = 6;
1145
+ _context16.next = 2;
1148
1146
  return this.webex.request({
1149
1147
  // eslint-disable-next-line no-underscore-dangle
1150
1148
  uri: "".concat(this.contactsServiceUrl, "/").concat(_constants2.ENCRYPT_FILTER, "/").concat(_constants2.USERS, "/").concat(_constants2.CONTACT_FILTER, "/").concat(contactId),
1151
1149
  method: _types.HTTP_METHODS.DELETE
1152
1150
  });
1153
- case 6:
1151
+ case 2:
1154
1152
  response = _context16.sent;
1155
1153
  contactResponse = {
1156
1154
  statusCode: Number(response[_constants.STATUS_CODE]),
@@ -1165,20 +1163,20 @@ var ContactsClient = exports.ContactsClient = /*#__PURE__*/function () {
1165
1163
  }
1166
1164
  _Logger.default.log("Contact ".concat(contactId, " successfully deleted"), loggerContext);
1167
1165
  return _context16.abrupt("return", contactResponse);
1168
- case 14:
1169
- _context16.prev = 14;
1170
- _context16.t0 = _context16["catch"](2);
1171
- _Logger.default.error("Unable to delete contact ".concat(contactId, ": ").concat((0, _stringify.default)(_context16.t0)), loggerContext);
1172
- errorStatus = (0, _Utils.serviceErrorCodeHandler)(_context16.t0, loggerContext);
1173
- _context16.next = 20;
1166
+ case 3:
1167
+ _context16.prev = 3;
1168
+ _t14 = _context16["catch"](1);
1169
+ _Logger.default.error("Unable to delete contact ".concat(contactId, ": ").concat((0, _stringify.default)(_t14)), loggerContext);
1170
+ errorStatus = (0, _Utils.serviceErrorCodeHandler)(_t14, loggerContext);
1171
+ _context16.next = 4;
1174
1172
  return (0, _Utils.uploadLogs)();
1175
- case 20:
1173
+ case 4:
1176
1174
  return _context16.abrupt("return", errorStatus);
1177
- case 21:
1175
+ case 5:
1178
1176
  case "end":
1179
1177
  return _context16.stop();
1180
1178
  }
1181
- }, _callee16, this, [[2, 14]]);
1179
+ }, _callee16, this, [[1, 3]]);
1182
1180
  }));
1183
1181
  function deleteContact(_x17) {
1184
1182
  return _deleteContact.apply(this, arguments);
@@ -1195,7 +1193,6 @@ var ContactsClient = exports.ContactsClient = /*#__PURE__*/function () {
1195
1193
  return this.sdkConnector;
1196
1194
  }
1197
1195
  }]);
1198
- return ContactsClient;
1199
1196
  }();
1200
1197
  /**
1201
1198
  * Creates a ContactsClient instance