@webex/calling 3.9.0-next.7 → 3.9.0-next.9

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 (171) hide show
  1. package/dist/CallHistory/CallHistory.js +51 -46
  2. package/dist/CallHistory/CallHistory.js.map +1 -1
  3. package/dist/CallHistory/CallHistory.test.js +146 -147
  4. package/dist/CallHistory/CallHistory.test.js.map +1 -1
  5. package/dist/CallHistory/callHistoryFixtures.js.map +1 -1
  6. package/dist/CallHistory/constants.js.map +1 -1
  7. package/dist/CallHistory/types.js.map +1 -1
  8. package/dist/CallSettings/CallSettings.js +8 -8
  9. package/dist/CallSettings/CallSettings.js.map +1 -1
  10. package/dist/CallSettings/CallSettings.test.js +1 -1
  11. package/dist/CallSettings/CallSettings.test.js.map +1 -1
  12. package/dist/CallSettings/UcmBackendConnector.js +12 -11
  13. package/dist/CallSettings/UcmBackendConnector.js.map +1 -1
  14. package/dist/CallSettings/UcmBackendConnector.test.js +9 -10
  15. package/dist/CallSettings/UcmBackendConnector.test.js.map +1 -1
  16. package/dist/CallSettings/WxCallBackendConnector.js +66 -59
  17. package/dist/CallSettings/WxCallBackendConnector.js.map +1 -1
  18. package/dist/CallSettings/WxCallBackendConnector.test.js +108 -109
  19. package/dist/CallSettings/WxCallBackendConnector.test.js.map +1 -1
  20. package/dist/CallSettings/constants.js.map +1 -1
  21. package/dist/CallSettings/testFixtures.js.map +1 -1
  22. package/dist/CallSettings/types.js.map +1 -1
  23. package/dist/CallingClient/CallingClient.js +142 -85
  24. package/dist/CallingClient/CallingClient.js.map +1 -1
  25. package/dist/CallingClient/CallingClient.test.js +184 -173
  26. package/dist/CallingClient/CallingClient.test.js.map +1 -1
  27. package/dist/CallingClient/callRecordFixtures.js.map +1 -1
  28. package/dist/CallingClient/calling/CallerId/index.js +2 -2
  29. package/dist/CallingClient/calling/CallerId/index.js.map +1 -1
  30. package/dist/CallingClient/calling/CallerId/index.test.js +8 -7
  31. package/dist/CallingClient/calling/CallerId/index.test.js.map +1 -1
  32. package/dist/CallingClient/calling/CallerId/types.js.map +1 -1
  33. package/dist/CallingClient/calling/call.js +343 -320
  34. package/dist/CallingClient/calling/call.js.map +1 -1
  35. package/dist/CallingClient/calling/call.test.js +405 -406
  36. package/dist/CallingClient/calling/call.test.js.map +1 -1
  37. package/dist/CallingClient/calling/callManager.js +3 -4
  38. package/dist/CallingClient/calling/callManager.js.map +1 -1
  39. package/dist/CallingClient/calling/callManager.test.js +67 -68
  40. package/dist/CallingClient/calling/callManager.test.js.map +1 -1
  41. package/dist/CallingClient/calling/index.js.map +1 -1
  42. package/dist/CallingClient/calling/types.js.map +1 -1
  43. package/dist/CallingClient/callingClientFixtures.js.map +1 -1
  44. package/dist/CallingClient/constants.js +2 -1
  45. package/dist/CallingClient/constants.js.map +1 -1
  46. package/dist/CallingClient/line/index.js +7 -7
  47. package/dist/CallingClient/line/index.js.map +1 -1
  48. package/dist/CallingClient/line/line.test.js +6 -6
  49. package/dist/CallingClient/line/line.test.js.map +1 -1
  50. package/dist/CallingClient/line/types.js.map +1 -1
  51. package/dist/CallingClient/registration/index.js.map +1 -1
  52. package/dist/CallingClient/registration/register.js +239 -230
  53. package/dist/CallingClient/registration/register.js.map +1 -1
  54. package/dist/CallingClient/registration/register.test.js +172 -173
  55. package/dist/CallingClient/registration/register.test.js.map +1 -1
  56. package/dist/CallingClient/registration/registerFixtures.js.map +1 -1
  57. package/dist/CallingClient/registration/types.js.map +1 -1
  58. package/dist/CallingClient/registration/webWorker.js +5 -4
  59. package/dist/CallingClient/registration/webWorker.js.map +1 -1
  60. package/dist/CallingClient/registration/webWorker.test.js +14 -14
  61. package/dist/CallingClient/registration/webWorker.test.js.map +1 -1
  62. package/dist/CallingClient/registration/webWorkerStr.js.map +1 -1
  63. package/dist/CallingClient/types.js.map +1 -1
  64. package/dist/CallingClient/windowsChromiumIceWarmupUtils.js +2 -6
  65. package/dist/CallingClient/windowsChromiumIceWarmupUtils.js.map +1 -1
  66. package/dist/Contacts/ContactsClient.js +244 -238
  67. package/dist/Contacts/ContactsClient.js.map +1 -1
  68. package/dist/Contacts/ContactsClient.test.js +89 -90
  69. package/dist/Contacts/ContactsClient.test.js.map +1 -1
  70. package/dist/Contacts/constants.js +2 -2
  71. package/dist/Contacts/constants.js.map +1 -1
  72. package/dist/Contacts/contactFixtures.js.map +1 -1
  73. package/dist/Contacts/types.js.map +1 -1
  74. package/dist/Errors/catalog/CallError.js +2 -2
  75. package/dist/Errors/catalog/CallError.js.map +1 -1
  76. package/dist/Errors/catalog/CallingDeviceError.js +2 -2
  77. package/dist/Errors/catalog/CallingDeviceError.js.map +1 -1
  78. package/dist/Errors/catalog/ExtendedError.js +3 -3
  79. package/dist/Errors/catalog/ExtendedError.js.map +1 -1
  80. package/dist/Errors/catalog/LineError.js +2 -2
  81. package/dist/Errors/catalog/LineError.js.map +1 -1
  82. package/dist/Errors/index.js.map +1 -1
  83. package/dist/Errors/types.js.map +1 -1
  84. package/dist/Events/impl/index.js +2 -2
  85. package/dist/Events/impl/index.js.map +1 -1
  86. package/dist/Events/types.js.map +1 -1
  87. package/dist/Logger/index.js.map +1 -1
  88. package/dist/Logger/index.test.js.map +1 -1
  89. package/dist/Logger/types.js.map +1 -1
  90. package/dist/Metrics/index.js +109 -46
  91. package/dist/Metrics/index.js.map +1 -1
  92. package/dist/Metrics/index.test.js.map +1 -1
  93. package/dist/Metrics/types.js +8 -1
  94. package/dist/Metrics/types.js.map +1 -1
  95. package/dist/SDKConnector/index.js +0 -1
  96. package/dist/SDKConnector/index.js.map +1 -1
  97. package/dist/SDKConnector/index.test.js.map +1 -1
  98. package/dist/SDKConnector/types.js.map +1 -1
  99. package/dist/SDKConnector/utils.js.map +1 -1
  100. package/dist/SDKConnector/utils.test.js.map +1 -1
  101. package/dist/Voicemail/BroadworksBackendConnector.js +42 -39
  102. package/dist/Voicemail/BroadworksBackendConnector.js.map +1 -1
  103. package/dist/Voicemail/BroadworksBackendConnector.test.js +119 -120
  104. package/dist/Voicemail/BroadworksBackendConnector.test.js.map +1 -1
  105. package/dist/Voicemail/UcmBackendConnector.js +54 -47
  106. package/dist/Voicemail/UcmBackendConnector.js.map +1 -1
  107. package/dist/Voicemail/UcmBackendConnector.test.js +73 -74
  108. package/dist/Voicemail/UcmBackendConnector.test.js.map +1 -1
  109. package/dist/Voicemail/Voicemail.js +12 -11
  110. package/dist/Voicemail/Voicemail.js.map +1 -1
  111. package/dist/Voicemail/Voicemail.test.js +2 -2
  112. package/dist/Voicemail/Voicemail.test.js.map +1 -1
  113. package/dist/Voicemail/WxCallBackendConnector.js +78 -70
  114. package/dist/Voicemail/WxCallBackendConnector.js.map +1 -1
  115. package/dist/Voicemail/WxCallBackendConnector.test.js +184 -185
  116. package/dist/Voicemail/WxCallBackendConnector.test.js.map +1 -1
  117. package/dist/Voicemail/constants.js.map +1 -1
  118. package/dist/Voicemail/types.js.map +1 -1
  119. package/dist/Voicemail/voicemailFixture.js.map +1 -1
  120. package/dist/api.js.map +1 -1
  121. package/dist/common/Utils.js +80 -63
  122. package/dist/common/Utils.js.map +1 -1
  123. package/dist/common/Utils.test.js +95 -104
  124. package/dist/common/Utils.test.js.map +1 -1
  125. package/dist/common/constants.js.map +1 -1
  126. package/dist/common/index.js.map +1 -1
  127. package/dist/common/testUtil.js +1 -1
  128. package/dist/common/testUtil.js.map +1 -1
  129. package/dist/common/types.js.map +1 -1
  130. package/dist/index.js +5 -5
  131. package/dist/index.js.map +1 -1
  132. package/dist/module/CallHistory/CallHistory.js +4 -0
  133. package/dist/module/CallSettings/UcmBackendConnector.js +1 -0
  134. package/dist/module/CallSettings/WxCallBackendConnector.js +7 -0
  135. package/dist/module/CallingClient/CallingClient.js +62 -20
  136. package/dist/module/CallingClient/calling/call.js +66 -43
  137. package/dist/module/CallingClient/constants.js +2 -1
  138. package/dist/module/CallingClient/registration/register.js +6 -3
  139. package/dist/module/CallingClient/registration/webWorker.js +2 -1
  140. package/dist/module/CallingClient/windowsChromiumIceWarmupUtils.js +1 -4
  141. package/dist/module/Contacts/ContactsClient.js +23 -17
  142. package/dist/module/Contacts/constants.js +1 -1
  143. package/dist/module/Metrics/index.js +42 -0
  144. package/dist/module/Metrics/types.js +7 -0
  145. package/dist/module/Voicemail/BroadworksBackendConnector.js +3 -0
  146. package/dist/module/Voicemail/UcmBackendConnector.js +6 -0
  147. package/dist/module/Voicemail/WxCallBackendConnector.js +8 -0
  148. package/dist/module/common/Utils.js +22 -8
  149. package/dist/types/CallHistory/CallHistory.d.ts.map +1 -1
  150. package/dist/types/CallSettings/UcmBackendConnector.d.ts.map +1 -1
  151. package/dist/types/CallSettings/WxCallBackendConnector.d.ts.map +1 -1
  152. package/dist/types/CallingClient/CallingClient.d.ts.map +1 -1
  153. package/dist/types/CallingClient/calling/call.d.ts.map +1 -1
  154. package/dist/types/CallingClient/constants.d.ts +2 -1
  155. package/dist/types/CallingClient/constants.d.ts.map +1 -1
  156. package/dist/types/CallingClient/registration/register.d.ts.map +1 -1
  157. package/dist/types/CallingClient/registration/webWorker.d.ts +2 -1
  158. package/dist/types/CallingClient/registration/webWorker.d.ts.map +1 -1
  159. package/dist/types/CallingClient/windowsChromiumIceWarmupUtils.d.ts +2 -4
  160. package/dist/types/CallingClient/windowsChromiumIceWarmupUtils.d.ts.map +1 -1
  161. package/dist/types/Contacts/ContactsClient.d.ts.map +1 -1
  162. package/dist/types/Contacts/constants.d.ts +1 -1
  163. package/dist/types/Contacts/constants.d.ts.map +1 -1
  164. package/dist/types/Metrics/index.d.ts.map +1 -1
  165. package/dist/types/Metrics/types.d.ts +10 -2
  166. package/dist/types/Metrics/types.d.ts.map +1 -1
  167. package/dist/types/Voicemail/BroadworksBackendConnector.d.ts.map +1 -1
  168. package/dist/types/Voicemail/UcmBackendConnector.d.ts.map +1 -1
  169. package/dist/types/Voicemail/WxCallBackendConnector.d.ts.map +1 -1
  170. package/dist/types/common/Utils.d.ts.map +1 -1
  171. package/package.json +9 -7
@@ -62,7 +62,7 @@ var ContactsClient = exports.ContactsClient = /*#__PURE__*/function () {
62
62
  this.groups = undefined;
63
63
  this.contacts = undefined;
64
64
  this.defaultGroupId = '';
65
- _Logger.default.setLogger(logger.level, _constants2.CONTACTS_FILE);
65
+ _Logger.default.setLogger(logger.level, _constants2.CONTACTS_CLIENT);
66
66
  }
67
67
 
68
68
  /**
@@ -71,7 +71,7 @@ var ContactsClient = exports.ContactsClient = /*#__PURE__*/function () {
71
71
  (0, _createClass2.default)(ContactsClient, [{
72
72
  key: "decryptContactDetail",
73
73
  value: (function () {
74
- var _decryptContactDetail = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(encryptionKeyUrl, contactDetails) {
74
+ var _decryptContactDetail = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee(encryptionKeyUrl, contactDetails) {
75
75
  var _this = this;
76
76
  var decryptedContactDetail, decryptedValues;
77
77
  return _regenerator.default.wrap(function _callee$(_context) {
@@ -107,7 +107,7 @@ var ContactsClient = exports.ContactsClient = /*#__PURE__*/function () {
107
107
  }, {
108
108
  key: "encryptContactDetail",
109
109
  value: (function () {
110
- var _encryptContactDetail = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2(encryptionKeyUrl, contactDetails) {
110
+ var _encryptContactDetail = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee2(encryptionKeyUrl, contactDetails) {
111
111
  var _this2 = this;
112
112
  var encryptedContactDetail, encryptedValues;
113
113
  return _regenerator.default.wrap(function _callee2$(_context2) {
@@ -142,7 +142,7 @@ var ContactsClient = exports.ContactsClient = /*#__PURE__*/function () {
142
142
  }, {
143
143
  key: "encryptContact",
144
144
  value: (function () {
145
- var _encryptContact = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee5(contact) {
145
+ var _encryptContact = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee5(contact) {
146
146
  var _this3 = this;
147
147
  var encryptionKeyUrl, encryptedContact, encryptionPromises, encryptedFieldsList;
148
148
  return _regenerator.default.wrap(function _callee5$(_context5) {
@@ -150,8 +150,8 @@ var ContactsClient = exports.ContactsClient = /*#__PURE__*/function () {
150
150
  case 0:
151
151
  encryptionKeyUrl = contact.encryptionKeyUrl;
152
152
  encryptedContact = _objectSpread({}, contact);
153
- encryptionPromises = (0, _values.default)(_constants2.encryptedFields).map( /*#__PURE__*/function () {
154
- var _ref = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee4(field) {
153
+ encryptionPromises = (0, _values.default)(_constants2.encryptedFields).map(/*#__PURE__*/function () {
154
+ var _ref = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee4(field) {
155
155
  var plaintextAddressInfo, encryptedAddressInfo, encryptedAddressInfoPromises, plainTextDetails, encryptedDetails, encryptedValue;
156
156
  return _regenerator.default.wrap(function _callee4$(_context4) {
157
157
  while (1) switch (_context4.prev = _context4.next) {
@@ -165,8 +165,8 @@ var ContactsClient = exports.ContactsClient = /*#__PURE__*/function () {
165
165
  _context4.next = 11;
166
166
  break;
167
167
  }
168
- encryptedAddressInfoPromises = (0, _entries.default)(plaintextAddressInfo).map( /*#__PURE__*/function () {
169
- var _ref3 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3(_ref2) {
168
+ encryptedAddressInfoPromises = (0, _entries.default)(plaintextAddressInfo).map(/*#__PURE__*/function () {
169
+ var _ref3 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee3(_ref2) {
170
170
  var _ref4, key, value;
171
171
  return _regenerator.default.wrap(function _callee3$(_context3) {
172
172
  while (1) switch (_context3.prev = _context3.next) {
@@ -260,7 +260,7 @@ var ContactsClient = exports.ContactsClient = /*#__PURE__*/function () {
260
260
  }, {
261
261
  key: "decryptContact",
262
262
  value: (function () {
263
- var _decryptContact = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee8(contact) {
263
+ var _decryptContact = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee8(contact) {
264
264
  var _this4 = this;
265
265
  var encryptionKeyUrl, decryptedContact, decryptionPromises, decryptedFieldsList;
266
266
  return _regenerator.default.wrap(function _callee8$(_context8) {
@@ -268,8 +268,8 @@ var ContactsClient = exports.ContactsClient = /*#__PURE__*/function () {
268
268
  case 0:
269
269
  encryptionKeyUrl = contact.encryptionKeyUrl;
270
270
  decryptedContact = _objectSpread({}, contact);
271
- decryptionPromises = (0, _values.default)(_constants2.encryptedFields).map( /*#__PURE__*/function () {
272
- var _ref7 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee7(field) {
271
+ decryptionPromises = (0, _values.default)(_constants2.encryptedFields).map(/*#__PURE__*/function () {
272
+ var _ref7 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee7(field) {
273
273
  var plaintextAddressInfo, decryptedAddressInfo, decryptedAddressInfoPromises, plainTextDetails, decryptedDetails, decryptedValue;
274
274
  return _regenerator.default.wrap(function _callee7$(_context7) {
275
275
  while (1) switch (_context7.prev = _context7.next) {
@@ -283,13 +283,13 @@ var ContactsClient = exports.ContactsClient = /*#__PURE__*/function () {
283
283
  _context7.next = 11;
284
284
  break;
285
285
  }
286
- decryptedAddressInfoPromises = (0, _entries.default)(plaintextAddressInfo).map( /*#__PURE__*/function () {
287
- var _ref9 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee6(_ref8) {
288
- var _ref10, key, value;
286
+ decryptedAddressInfoPromises = (0, _entries.default)(plaintextAddressInfo).map(/*#__PURE__*/function () {
287
+ var _ref9 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee6(_ref8) {
288
+ var _ref0, key, value;
289
289
  return _regenerator.default.wrap(function _callee6$(_context6) {
290
290
  while (1) switch (_context6.prev = _context6.next) {
291
291
  case 0:
292
- _ref10 = (0, _slicedToArray2.default)(_ref8, 2), key = _ref10[0], value = _ref10[1];
292
+ _ref0 = (0, _slicedToArray2.default)(_ref8, 2), key = _ref0[0], value = _ref0[1];
293
293
  _context6.t0 = key;
294
294
  _context6.next = 4;
295
295
  return _this4.webex.internal.encryption.decryptText(encryptionKeyUrl, value);
@@ -302,7 +302,7 @@ var ContactsClient = exports.ContactsClient = /*#__PURE__*/function () {
302
302
  }
303
303
  }, _callee6);
304
304
  }));
305
- return function (_x10) {
305
+ return function (_x0) {
306
306
  return _ref9.apply(this, arguments);
307
307
  };
308
308
  }());
@@ -351,10 +351,10 @@ var ContactsClient = exports.ContactsClient = /*#__PURE__*/function () {
351
351
  return _promise.default.all(decryptionPromises);
352
352
  case 5:
353
353
  decryptedFieldsList = _context8.sent;
354
- decryptedFieldsList.forEach(function (_ref11) {
355
- var _ref12 = (0, _slicedToArray2.default)(_ref11, 2),
356
- field = _ref12[0],
357
- value = _ref12[1];
354
+ decryptedFieldsList.forEach(function (_ref1) {
355
+ var _ref10 = (0, _slicedToArray2.default)(_ref1, 2),
356
+ field = _ref10[0],
357
+ value = _ref10[1];
358
358
  if (value !== undefined) {
359
359
  decryptedContact[field] = value;
360
360
  }
@@ -375,7 +375,7 @@ var ContactsClient = exports.ContactsClient = /*#__PURE__*/function () {
375
375
  key: "resolveCloudContacts",
376
376
  value: function resolveCloudContacts(contactsDataMap, inputList) {
377
377
  var loggerContext = {
378
- file: _constants2.CONTACTS_FILE,
378
+ file: _constants2.CONTACTS_CLIENT,
379
379
  method: 'resolveCloudContacts'
380
380
  };
381
381
  var finalContactList = [];
@@ -449,39 +449,40 @@ var ContactsClient = exports.ContactsClient = /*#__PURE__*/function () {
449
449
  }, {
450
450
  key: "getContacts",
451
451
  value: (function () {
452
- var _getContacts = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee11() {
452
+ var _getContacts = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee1() {
453
453
  var _this5 = this;
454
- var loggerContext, contactList, cloudContactsMap, response, responseBody, contacts, groups, contactIdList, totalContacts, MAX_CONTACTS_PER_QUERY, i, contactIdListChunk, query, result, slicedCloudContactsMap, resolvedContacts, contactResponse, errorInfo, extendedError, errorStatus;
455
- return _regenerator.default.wrap(function _callee11$(_context11) {
456
- while (1) switch (_context11.prev = _context11.next) {
454
+ var loggerContext, contactList, cloudContactsMap, _response$headers, response, responseBody, contacts, groups, contactIdList, totalContacts, MAX_CONTACTS_PER_QUERY, i, contactIdListChunk, query, result, slicedCloudContactsMap, resolvedContacts, contactResponse, errorInfo, extendedError, errorStatus;
455
+ return _regenerator.default.wrap(function _callee1$(_context1) {
456
+ while (1) switch (_context1.prev = _context1.next) {
457
457
  case 0:
458
458
  loggerContext = {
459
- file: _constants2.CONTACTS_FILE,
459
+ file: _constants2.CONTACTS_CLIENT,
460
460
  method: _constants2.METHODS.GET_CONTACTS
461
461
  };
462
462
  _Logger.default.info(_constants.METHOD_START_MESSAGE, loggerContext);
463
463
  contactList = [];
464
464
  cloudContactsMap = {};
465
- _context11.prev = 4;
466
- _context11.next = 7;
465
+ _context1.prev = 4;
466
+ _context1.next = 7;
467
467
  return this.webex.request({
468
468
  // eslint-disable-next-line no-underscore-dangle
469
469
  uri: "".concat(this.webex.internal.services._serviceUrls.contactsService, "/").concat(_constants2.ENCRYPT_FILTER, "/").concat(_constants2.USERS, "/").concat(_constants2.CONTACT_FILTER),
470
470
  method: _types.HTTP_METHODS.GET
471
471
  });
472
472
  case 7:
473
- response = _context11.sent;
473
+ response = _context1.sent;
474
+ _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);
474
475
  responseBody = response.body;
475
476
  if (responseBody) {
476
- _context11.next = 11;
477
+ _context1.next = 12;
477
478
  break;
478
479
  }
479
480
  throw new Error("".concat(response));
480
- case 11:
481
+ case 12:
481
482
  contacts = responseBody.contacts, groups = responseBody.groups;
482
- _context11.next = 14;
483
- return _promise.default.all(contacts.map( /*#__PURE__*/function () {
484
- var _ref13 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee9(contact) {
483
+ _context1.next = 15;
484
+ return _promise.default.all(contacts.map(/*#__PURE__*/function () {
485
+ var _ref11 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee9(contact) {
485
486
  var decryptedContact;
486
487
  return _regenerator.default.wrap(function _callee9$(_context9) {
487
488
  while (1) switch (_context9.prev = _context9.next) {
@@ -507,33 +508,33 @@ var ContactsClient = exports.ContactsClient = /*#__PURE__*/function () {
507
508
  }
508
509
  }, _callee9);
509
510
  }));
510
- return function (_x11) {
511
- return _ref13.apply(this, arguments);
511
+ return function (_x1) {
512
+ return _ref11.apply(this, arguments);
512
513
  };
513
514
  }()));
514
- case 14:
515
+ case 15:
515
516
  if (!(0, _keys.default)(cloudContactsMap).length) {
516
- _context11.next = 37;
517
+ _context1.next = 38;
517
518
  break;
518
519
  }
519
520
  contactIdList = (0, _keys.default)(cloudContactsMap);
520
521
  totalContacts = contactIdList.length;
521
522
  MAX_CONTACTS_PER_QUERY = 50;
522
523
  i = 0;
523
- case 19:
524
+ case 20:
524
525
  if (!(i < totalContacts)) {
525
- _context11.next = 37;
526
+ _context1.next = 38;
526
527
  break;
527
528
  }
528
- _context11.prev = 20;
529
+ _context1.prev = 21;
529
530
  contactIdListChunk = contactIdList.slice(i, i + MAX_CONTACTS_PER_QUERY);
530
531
  query = contactIdListChunk.map(function (item) {
531
532
  return "".concat(_constants2.SCIM_ID_FILTER, " \"").concat(item, "\"");
532
533
  }).join(_constants2.OR);
533
- _context11.next = 25;
534
+ _context1.next = 26;
534
535
  return (0, _Utils.scimQuery)(query);
535
- case 25:
536
- result = _context11.sent;
536
+ case 26:
537
+ result = _context1.sent;
537
538
  slicedCloudContactsMap = Object.fromEntries((0, _entries.default)(cloudContactsMap).slice(i, i + MAX_CONTACTS_PER_QUERY));
538
539
  resolvedContacts = this.resolveCloudContacts(slicedCloudContactsMap, result.body);
539
540
  if (resolvedContacts) {
@@ -541,38 +542,38 @@ var ContactsClient = exports.ContactsClient = /*#__PURE__*/function () {
541
542
  return contactList.push(item);
542
543
  });
543
544
  }
544
- _context11.next = 34;
545
+ _context1.next = 35;
545
546
  break;
546
- case 31:
547
- _context11.prev = 31;
548
- _context11.t0 = _context11["catch"](20);
547
+ case 32:
548
+ _context1.prev = 32;
549
+ _context1.t0 = _context1["catch"](21);
549
550
  _Logger.default.warn("Error processing contact chunk ".concat(i, "-").concat(i + MAX_CONTACTS_PER_QUERY), loggerContext);
550
- case 34:
551
+ case 35:
551
552
  i += MAX_CONTACTS_PER_QUERY;
552
- _context11.next = 19;
553
+ _context1.next = 20;
553
554
  break;
554
- case 37:
555
- _context11.next = 39;
556
- return _promise.default.all(groups.map( /*#__PURE__*/function () {
557
- var _ref14 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee10(group, idx) {
558
- return _regenerator.default.wrap(function _callee10$(_context10) {
559
- while (1) switch (_context10.prev = _context10.next) {
555
+ case 38:
556
+ _context1.next = 40;
557
+ return _promise.default.all(groups.map(/*#__PURE__*/function () {
558
+ var _ref12 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee0(group, idx) {
559
+ return _regenerator.default.wrap(function _callee0$(_context0) {
560
+ while (1) switch (_context0.prev = _context0.next) {
560
561
  case 0:
561
- _context10.next = 2;
562
+ _context0.next = 2;
562
563
  return _this5.webex.internal.encryption.decryptText(group.encryptionKeyUrl, group.displayName);
563
564
  case 2:
564
- groups[idx].displayName = _context10.sent;
565
+ groups[idx].displayName = _context0.sent;
565
566
  case 3:
566
567
  case "end":
567
- return _context10.stop();
568
+ return _context0.stop();
568
569
  }
569
- }, _callee10);
570
+ }, _callee0);
570
571
  }));
571
- return function (_x12, _x13) {
572
- return _ref14.apply(this, arguments);
572
+ return function (_x10, _x11) {
573
+ return _ref12.apply(this, arguments);
573
574
  };
574
575
  }()));
575
- case 39:
576
+ case 40:
576
577
  this.groups = groups;
577
578
  this.contacts = contactList;
578
579
  contactResponse = {
@@ -584,23 +585,23 @@ var ContactsClient = exports.ContactsClient = /*#__PURE__*/function () {
584
585
  message: _constants.SUCCESS_MESSAGE
585
586
  };
586
587
  _Logger.default.log('Successfully fetched contacts and groups', loggerContext);
587
- return _context11.abrupt("return", contactResponse);
588
- case 46:
589
- _context11.prev = 46;
590
- _context11.t1 = _context11["catch"](4);
591
- errorInfo = _context11.t1;
592
- extendedError = new Error("Error fetching contacts: ".concat(_context11.t1));
588
+ return _context1.abrupt("return", contactResponse);
589
+ case 47:
590
+ _context1.prev = 47;
591
+ _context1.t1 = _context1["catch"](4);
592
+ errorInfo = _context1.t1;
593
+ extendedError = new Error("Error fetching contacts: ".concat(_context1.t1));
593
594
  _Logger.default.error(extendedError, loggerContext);
594
595
  errorStatus = (0, _Utils.serviceErrorCodeHandler)(errorInfo, loggerContext);
595
- _context11.next = 54;
596
+ _context1.next = 55;
596
597
  return (0, _Utils.uploadLogs)();
597
- case 54:
598
- return _context11.abrupt("return", errorStatus);
599
598
  case 55:
599
+ return _context1.abrupt("return", errorStatus);
600
+ case 56:
600
601
  case "end":
601
- return _context11.stop();
602
+ return _context1.stop();
602
603
  }
603
- }, _callee11, this, [[4, 46], [20, 31]]);
604
+ }, _callee1, this, [[4, 47], [21, 32]]);
604
605
  }));
605
606
  function getContacts() {
606
607
  return _getContacts.apply(this, arguments);
@@ -616,34 +617,34 @@ var ContactsClient = exports.ContactsClient = /*#__PURE__*/function () {
616
617
  }, {
617
618
  key: "createNewEncryptionKeyUrl",
618
619
  value: (function () {
619
- var _createNewEncryptionKeyUrl = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee12() {
620
+ var _createNewEncryptionKeyUrl = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee10() {
620
621
  var loggerContext, unboundedKeyUri, unboundedKeys;
621
- return _regenerator.default.wrap(function _callee12$(_context12) {
622
- while (1) switch (_context12.prev = _context12.next) {
622
+ return _regenerator.default.wrap(function _callee10$(_context10) {
623
+ while (1) switch (_context10.prev = _context10.next) {
623
624
  case 0:
624
625
  loggerContext = {
625
- file: _constants2.CONTACTS_FILE,
626
+ file: _constants2.CONTACTS_CLIENT,
626
627
  method: _constants2.METHODS.CREATE_NEW_ENCRYPTION_KEY_URL
627
628
  };
628
629
  _Logger.default.info(_constants.METHOD_START_MESSAGE, loggerContext);
629
630
  unboundedKeyUri = '';
630
631
  _Logger.default.info('Requesting kms for a new KRO and key', loggerContext);
631
- _context12.next = 6;
632
+ _context10.next = 6;
632
633
  return this.webex.internal.encryption.kms.createUnboundKeys({
633
634
  count: 1
634
635
  });
635
636
  case 6:
636
- unboundedKeys = _context12.sent;
637
+ unboundedKeys = _context10.sent;
637
638
  unboundedKeyUri = unboundedKeys[0].uri;
638
639
  this.webex.internal.encryption.kms.createResource({
639
640
  keyUris: [unboundedKeyUri]
640
641
  });
641
- return _context12.abrupt("return", unboundedKeyUri);
642
+ return _context10.abrupt("return", unboundedKeyUri);
642
643
  case 10:
643
644
  case "end":
644
- return _context12.stop();
645
+ return _context10.stop();
645
646
  }
646
- }, _callee12, this);
647
+ }, _callee10, this);
647
648
  }));
648
649
  function createNewEncryptionKeyUrl() {
649
650
  return _createNewEncryptionKeyUrl.apply(this, arguments);
@@ -659,22 +660,22 @@ var ContactsClient = exports.ContactsClient = /*#__PURE__*/function () {
659
660
  }, {
660
661
  key: "fetchEncryptionKeyUrl",
661
662
  value: (function () {
662
- var _fetchEncryptionKeyUrl = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee13() {
663
+ var _fetchEncryptionKeyUrl = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee11() {
663
664
  var _response$data$group;
664
665
  var loggerContext, response, _response$data$group2;
665
- return _regenerator.default.wrap(function _callee13$(_context13) {
666
- while (1) switch (_context13.prev = _context13.next) {
666
+ return _regenerator.default.wrap(function _callee11$(_context11) {
667
+ while (1) switch (_context11.prev = _context11.next) {
667
668
  case 0:
668
669
  loggerContext = {
669
- file: _constants2.CONTACTS_FILE,
670
+ file: _constants2.CONTACTS_CLIENT,
670
671
  method: _constants2.METHODS.FETCH_ENCRYPTION_KEY_URL
671
672
  };
672
673
  _Logger.default.info(_constants.METHOD_START_MESSAGE, loggerContext);
673
674
  if (!this.encryptionKeyUrl) {
674
- _context13.next = 4;
675
+ _context11.next = 4;
675
676
  break;
676
677
  }
677
- return _context13.abrupt("return", this.encryptionKeyUrl);
678
+ return _context11.abrupt("return", this.encryptionKeyUrl);
678
679
  case 4:
679
680
  // istanbul ignore else
680
681
  if (this.groups === undefined) {
@@ -682,36 +683,36 @@ var ContactsClient = exports.ContactsClient = /*#__PURE__*/function () {
682
683
  }
683
684
  // istanbul ignore else
684
685
  if (!(this.groups && this.groups.length)) {
685
- _context13.next = 7;
686
+ _context11.next = 7;
686
687
  break;
687
688
  }
688
- return _context13.abrupt("return", this.groups[0].encryptionKeyUrl);
689
+ return _context11.abrupt("return", this.groups[0].encryptionKeyUrl);
689
690
  case 7:
690
- _context13.next = 9;
691
+ _context11.next = 9;
691
692
  return this.createNewEncryptionKeyUrl();
692
693
  case 9:
693
- this.encryptionKeyUrl = _context13.sent;
694
+ this.encryptionKeyUrl = _context11.sent;
694
695
  _Logger.default.log("Creating a default group: ".concat(_constants2.DEFAULT_GROUP_NAME), {
695
- file: _constants2.CONTACTS_FILE,
696
+ file: _constants2.CONTACTS_CLIENT,
696
697
  method: this.fetchEncryptionKeyUrl.name
697
698
  });
698
- _context13.next = 13;
699
+ _context11.next = 13;
699
700
  return this.createContactGroup(_constants2.DEFAULT_GROUP_NAME, this.encryptionKeyUrl);
700
701
  case 13:
701
- response = _context13.sent;
702
+ response = _context11.sent;
702
703
  if ((_response$data$group = response.data.group) !== null && _response$data$group !== void 0 && _response$data$group.groupId) {
703
704
  this.defaultGroupId = (_response$data$group2 = response.data.group) === null || _response$data$group2 === void 0 ? void 0 : _response$data$group2.groupId;
704
705
  _Logger.default.log("Successfully created default group with ID: ".concat(this.defaultGroupId), {
705
- file: _constants2.CONTACTS_FILE,
706
+ file: _constants2.CONTACTS_CLIENT,
706
707
  method: this.fetchEncryptionKeyUrl.name
707
708
  });
708
709
  }
709
- return _context13.abrupt("return", this.encryptionKeyUrl);
710
+ return _context11.abrupt("return", this.encryptionKeyUrl);
710
711
  case 16:
711
712
  case "end":
712
- return _context13.stop();
713
+ return _context11.stop();
713
714
  }
714
- }, _callee13, this);
715
+ }, _callee11, this);
715
716
  }));
716
717
  function fetchEncryptionKeyUrl() {
717
718
  return _fetchEncryptionKeyUrl.apply(this, arguments);
@@ -727,77 +728,77 @@ var ContactsClient = exports.ContactsClient = /*#__PURE__*/function () {
727
728
  }, {
728
729
  key: "fetchDefaultGroup",
729
730
  value: (function () {
730
- var _fetchDefaultGroup = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee14() {
731
+ var _fetchDefaultGroup = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee12() {
731
732
  var loggerContext, i, response, group, groupId;
732
- return _regenerator.default.wrap(function _callee14$(_context14) {
733
- while (1) switch (_context14.prev = _context14.next) {
733
+ return _regenerator.default.wrap(function _callee12$(_context12) {
734
+ while (1) switch (_context12.prev = _context12.next) {
734
735
  case 0:
735
736
  loggerContext = {
736
- file: _constants2.CONTACTS_FILE,
737
+ file: _constants2.CONTACTS_CLIENT,
737
738
  method: _constants2.METHODS.FETCH_DEFAULT_GROUP
738
739
  };
739
740
  _Logger.default.info(_constants.METHOD_START_MESSAGE, loggerContext);
740
741
  if (!this.defaultGroupId) {
741
- _context14.next = 5;
742
+ _context12.next = 5;
742
743
  break;
743
744
  }
744
745
  _Logger.default.log("Using existing default group with ID: ".concat(this.defaultGroupId), {
745
- file: _constants2.CONTACTS_FILE,
746
+ file: _constants2.CONTACTS_CLIENT,
746
747
  method: this.fetchDefaultGroup.name
747
748
  });
748
- return _context14.abrupt("return", this.defaultGroupId);
749
+ return _context12.abrupt("return", this.defaultGroupId);
749
750
  case 5:
750
751
  if (!(this.groups && this.groups.length)) {
751
- _context14.next = 15;
752
+ _context12.next = 15;
752
753
  break;
753
754
  }
754
755
  i = 0;
755
756
  case 7:
756
757
  if (!(i < this.groups.length)) {
757
- _context14.next = 15;
758
+ _context12.next = 15;
758
759
  break;
759
760
  }
760
761
  if (!(this.groups[i].displayName === _constants2.DEFAULT_GROUP_NAME)) {
761
- _context14.next = 12;
762
+ _context12.next = 12;
762
763
  break;
763
764
  }
764
765
  this.defaultGroupId = this.groups[i].groupId;
765
766
  _Logger.default.log("Found default group with ID: ".concat(this.defaultGroupId), {
766
- file: _constants2.CONTACTS_FILE,
767
+ file: _constants2.CONTACTS_CLIENT,
767
768
  method: this.fetchDefaultGroup.name
768
769
  });
769
- return _context14.abrupt("return", this.defaultGroupId);
770
+ return _context12.abrupt("return", this.defaultGroupId);
770
771
  case 12:
771
772
  i += 1;
772
- _context14.next = 7;
773
+ _context12.next = 7;
773
774
  break;
774
775
  case 15:
775
776
  _Logger.default.log('No default group found.', {
776
- file: _constants2.CONTACTS_FILE,
777
+ file: _constants2.CONTACTS_CLIENT,
777
778
  method: this.fetchDefaultGroup.name
778
779
  });
779
- _context14.next = 18;
780
+ _context12.next = 18;
780
781
  return this.createContactGroup(_constants2.DEFAULT_GROUP_NAME);
781
782
  case 18:
782
- response = _context14.sent;
783
+ response = _context12.sent;
783
784
  group = response.data.group;
784
785
  if (!group) {
785
- _context14.next = 24;
786
+ _context12.next = 24;
786
787
  break;
787
788
  }
788
789
  groupId = group.groupId;
789
790
  _Logger.default.log("Successfully created new default group with ID: ".concat(groupId), {
790
- file: _constants2.CONTACTS_FILE,
791
+ file: _constants2.CONTACTS_CLIENT,
791
792
  method: this.fetchDefaultGroup.name
792
793
  });
793
- return _context14.abrupt("return", groupId);
794
+ return _context12.abrupt("return", groupId);
794
795
  case 24:
795
- return _context14.abrupt("return", '');
796
+ return _context12.abrupt("return", '');
796
797
  case 25:
797
798
  case "end":
798
- return _context14.stop();
799
+ return _context12.stop();
799
800
  }
800
- }, _callee14, this);
801
+ }, _callee12, this);
801
802
  }));
802
803
  function fetchDefaultGroup() {
803
804
  return _fetchDefaultGroup.apply(this, arguments);
@@ -815,47 +816,47 @@ var ContactsClient = exports.ContactsClient = /*#__PURE__*/function () {
815
816
  }, {
816
817
  key: "createContactGroup",
817
818
  value: (function () {
818
- var _createContactGroup = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee15(displayName, encryptionKeyUrl, groupType) {
819
- var loggerContext, encryptionKeyUrlFinal, isExistingGroup, encryptedDisplayName, groupInfo, _this$groups, response, group, contactResponse, errorInfo, extendedError, errorStatus;
820
- return _regenerator.default.wrap(function _callee15$(_context15) {
821
- while (1) switch (_context15.prev = _context15.next) {
819
+ var _createContactGroup = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee13(displayName, encryptionKeyUrl, groupType) {
820
+ var loggerContext, encryptionKeyUrlFinal, isExistingGroup, encryptedDisplayName, groupInfo, _response$headers2, _this$groups, response, group, contactResponse, errorInfo, extendedError, errorStatus;
821
+ return _regenerator.default.wrap(function _callee13$(_context13) {
822
+ while (1) switch (_context13.prev = _context13.next) {
822
823
  case 0:
823
824
  loggerContext = {
824
- file: _constants2.CONTACTS_FILE,
825
+ file: _constants2.CONTACTS_CLIENT,
825
826
  method: _constants2.METHODS.CREATE_CONTACT_GROUP
826
827
  };
827
828
  _Logger.default.info("".concat(_constants.METHOD_START_MESSAGE, " with displayName: ").concat(displayName), loggerContext);
828
- _context15.t0 = encryptionKeyUrl;
829
- if (_context15.t0) {
830
- _context15.next = 7;
829
+ _context13.t0 = encryptionKeyUrl;
830
+ if (_context13.t0) {
831
+ _context13.next = 7;
831
832
  break;
832
833
  }
833
- _context15.next = 6;
834
+ _context13.next = 6;
834
835
  return this.fetchEncryptionKeyUrl();
835
836
  case 6:
836
- _context15.t0 = _context15.sent;
837
+ _context13.t0 = _context13.sent;
837
838
  case 7:
838
- encryptionKeyUrlFinal = _context15.t0;
839
+ encryptionKeyUrlFinal = _context13.t0;
839
840
  if (!(this.groups === undefined)) {
840
- _context15.next = 11;
841
+ _context13.next = 11;
841
842
  break;
842
843
  }
843
- _context15.next = 11;
844
+ _context13.next = 11;
844
845
  return this.getContacts();
845
846
  case 11:
846
847
  if (!(this.groups && this.groups.length)) {
847
- _context15.next = 16;
848
+ _context13.next = 16;
848
849
  break;
849
850
  }
850
851
  isExistingGroup = this.groups.find(function (group) {
851
852
  return group.displayName === displayName;
852
853
  });
853
854
  if (!isExistingGroup) {
854
- _context15.next = 16;
855
+ _context13.next = 16;
855
856
  break;
856
857
  }
857
858
  _Logger.default.warn("Group name ".concat(displayName, " already exists."), loggerContext);
858
- return _context15.abrupt("return", {
859
+ return _context13.abrupt("return", {
859
860
  statusCode: 400,
860
861
  data: {
861
862
  error: 'Group displayName already exists'
@@ -863,18 +864,18 @@ var ContactsClient = exports.ContactsClient = /*#__PURE__*/function () {
863
864
  message: _constants.FAILURE_MESSAGE
864
865
  });
865
866
  case 16:
866
- _context15.next = 18;
867
+ _context13.next = 18;
867
868
  return this.webex.internal.encryption.encryptText(encryptionKeyUrlFinal, displayName);
868
869
  case 18:
869
- encryptedDisplayName = _context15.sent;
870
+ encryptedDisplayName = _context13.sent;
870
871
  groupInfo = {
871
872
  schemas: _constants2.CONTACTS_SCHEMA,
872
873
  displayName: encryptedDisplayName,
873
874
  groupType: groupType || _types2.GroupType.NORMAL,
874
875
  encryptionKeyUrl: encryptionKeyUrlFinal
875
876
  };
876
- _context15.prev = 20;
877
- _context15.next = 23;
877
+ _context13.prev = 20;
878
+ _context13.next = 23;
878
879
  return this.webex.request({
879
880
  // eslint-disable-next-line no-underscore-dangle
880
881
  uri: "".concat(this.webex.internal.services._serviceUrls.contactsService, "/").concat(_constants2.ENCRYPT_FILTER, "/").concat(_constants2.USERS, "/").concat(_constants2.GROUP_FILTER),
@@ -882,7 +883,9 @@ var ContactsClient = exports.ContactsClient = /*#__PURE__*/function () {
882
883
  body: groupInfo
883
884
  });
884
885
  case 23:
885
- response = _context15.sent;
886
+ response = _context13.sent;
887
+ _Logger.default.log("Response code: ".concat(response.statusCode), loggerContext);
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);
886
889
  group = response.body;
887
890
  group.displayName = displayName;
888
891
  contactResponse = {
@@ -894,25 +897,25 @@ var ContactsClient = exports.ContactsClient = /*#__PURE__*/function () {
894
897
  };
895
898
  (_this$groups = this.groups) === null || _this$groups === void 0 ? void 0 : _this$groups.push(group);
896
899
  _Logger.default.log("Contact group ".concat(displayName, " successfully created"), loggerContext);
897
- return _context15.abrupt("return", contactResponse);
898
- case 32:
899
- _context15.prev = 32;
900
- _context15.t1 = _context15["catch"](20);
901
- errorInfo = _context15.t1;
902
- extendedError = new Error("Unable to create contact group: ".concat(_context15.t1));
900
+ return _context13.abrupt("return", contactResponse);
901
+ case 34:
902
+ _context13.prev = 34;
903
+ _context13.t1 = _context13["catch"](20);
904
+ errorInfo = _context13.t1;
905
+ extendedError = new Error("Unable to create contact group: ".concat(_context13.t1));
903
906
  _Logger.default.error(extendedError, loggerContext);
904
907
  errorStatus = (0, _Utils.serviceErrorCodeHandler)(errorInfo, loggerContext);
905
- _context15.next = 40;
908
+ _context13.next = 42;
906
909
  return (0, _Utils.uploadLogs)();
907
- case 40:
908
- return _context15.abrupt("return", errorStatus);
909
- case 41:
910
+ case 42:
911
+ return _context13.abrupt("return", errorStatus);
912
+ case 43:
910
913
  case "end":
911
- return _context15.stop();
914
+ return _context13.stop();
912
915
  }
913
- }, _callee15, this, [[20, 32]]);
916
+ }, _callee13, this, [[20, 34]]);
914
917
  }));
915
- function createContactGroup(_x14, _x15, _x16) {
918
+ function createContactGroup(_x12, _x13, _x14) {
916
919
  return _createContactGroup.apply(this, arguments);
917
920
  }
918
921
  return createContactGroup;
@@ -925,26 +928,27 @@ var ContactsClient = exports.ContactsClient = /*#__PURE__*/function () {
925
928
  }, {
926
929
  key: "deleteContactGroup",
927
930
  value: (function () {
928
- var _deleteContactGroup = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee16(groupId) {
929
- var loggerContext, _this$groups2, _this$groups4, response, contactResponse, groupToDelete, _this$groups3, errorInfo, extendedError, errorStatus;
930
- return _regenerator.default.wrap(function _callee16$(_context16) {
931
- while (1) switch (_context16.prev = _context16.next) {
931
+ 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, errorInfo, extendedError, errorStatus;
933
+ return _regenerator.default.wrap(function _callee14$(_context14) {
934
+ while (1) switch (_context14.prev = _context14.next) {
932
935
  case 0:
933
936
  loggerContext = {
934
- file: _constants2.CONTACTS_FILE,
937
+ file: _constants2.CONTACTS_CLIENT,
935
938
  method: _constants2.METHODS.DELETE_CONTACT_GROUP
936
939
  };
937
940
  _Logger.default.info("".concat(_constants.METHOD_START_MESSAGE, " with groupId: ").concat(groupId), loggerContext);
938
- _context16.prev = 2;
941
+ _context14.prev = 2;
939
942
  _Logger.default.info("Deleting contact group: ".concat(groupId), loggerContext);
940
- _context16.next = 6;
943
+ _context14.next = 6;
941
944
  return this.webex.request({
942
945
  // eslint-disable-next-line no-underscore-dangle
943
946
  uri: "".concat(this.webex.internal.services._serviceUrls.contactsService, "/").concat(_constants2.ENCRYPT_FILTER, "/").concat(_constants2.USERS, "/").concat(_constants2.GROUP_FILTER, "/").concat(groupId),
944
947
  method: _types.HTTP_METHODS.DELETE
945
948
  });
946
949
  case 6:
947
- response = _context16.sent;
950
+ response = _context14.sent;
951
+ _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);
948
952
  contactResponse = {
949
953
  statusCode: Number(response[_constants.STATUS_CODE]),
950
954
  data: {},
@@ -960,25 +964,25 @@ var ContactsClient = exports.ContactsClient = /*#__PURE__*/function () {
960
964
  this.defaultGroupId = '';
961
965
  }
962
966
  _Logger.default.log("Contact group ".concat(groupId, " successfully deleted"), loggerContext);
963
- return _context16.abrupt("return", contactResponse);
964
- case 15:
965
- _context16.prev = 15;
966
- _context16.t0 = _context16["catch"](2);
967
- errorInfo = _context16.t0;
968
- extendedError = new Error("Unable to delete contact group ".concat(groupId, ": ").concat(_context16.t0));
967
+ return _context14.abrupt("return", contactResponse);
968
+ case 16:
969
+ _context14.prev = 16;
970
+ _context14.t0 = _context14["catch"](2);
971
+ errorInfo = _context14.t0;
972
+ extendedError = new Error("Unable to delete contact group ".concat(groupId, ": ").concat(_context14.t0));
969
973
  _Logger.default.error(extendedError, loggerContext);
970
974
  errorStatus = (0, _Utils.serviceErrorCodeHandler)(errorInfo, loggerContext);
971
- _context16.next = 23;
975
+ _context14.next = 24;
972
976
  return (0, _Utils.uploadLogs)();
973
- case 23:
974
- return _context16.abrupt("return", errorStatus);
975
977
  case 24:
978
+ return _context14.abrupt("return", errorStatus);
979
+ case 25:
976
980
  case "end":
977
- return _context16.stop();
981
+ return _context14.stop();
978
982
  }
979
- }, _callee16, this, [[2, 15]]);
983
+ }, _callee14, this, [[2, 16]]);
980
984
  }));
981
- function deleteContactGroup(_x17) {
985
+ function deleteContactGroup(_x15) {
982
986
  return _deleteContactGroup.apply(this, arguments);
983
987
  }
984
988
  return deleteContactGroup;
@@ -991,55 +995,55 @@ var ContactsClient = exports.ContactsClient = /*#__PURE__*/function () {
991
995
  }, {
992
996
  key: "createContact",
993
997
  value: (function () {
994
- var _createContact = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee17(contactInfo) {
995
- var loggerContext, contact, defaultGroupId, requestBody, encryptedContact, _encryptedContact, response, newContact, contactResponse, query, res, resolvedContact, _this$contacts, _this$contacts2, errorInfo, extendedError, errorStatus;
996
- return _regenerator.default.wrap(function _callee17$(_context17) {
997
- while (1) switch (_context17.prev = _context17.next) {
998
+ var _createContact = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee15(contactInfo) {
999
+ var loggerContext, _response$headers4, contact, defaultGroupId, requestBody, encryptedContact, _encryptedContact, response, newContact, contactResponse, query, res, resolvedContact, _this$contacts, _this$contacts2, errorInfo, extendedError, errorStatus;
1000
+ return _regenerator.default.wrap(function _callee15$(_context15) {
1001
+ while (1) switch (_context15.prev = _context15.next) {
998
1002
  case 0:
999
1003
  loggerContext = {
1000
- file: _constants2.CONTACTS_FILE,
1004
+ file: _constants2.CONTACTS_CLIENT,
1001
1005
  method: _constants2.METHODS.CREATE_CONTACT
1002
1006
  };
1003
1007
  _Logger.default.info("".concat(_constants.METHOD_START_MESSAGE, " with contactType: ").concat(contactInfo.contactType), loggerContext);
1004
- _context17.prev = 2;
1008
+ _context15.prev = 2;
1005
1009
  contact = _objectSpread({}, contactInfo);
1006
1010
  if (contact.encryptionKeyUrl) {
1007
- _context17.next = 8;
1011
+ _context15.next = 8;
1008
1012
  break;
1009
1013
  }
1010
- _context17.next = 7;
1014
+ _context15.next = 7;
1011
1015
  return this.fetchEncryptionKeyUrl();
1012
1016
  case 7:
1013
- contact.encryptionKeyUrl = _context17.sent;
1017
+ contact.encryptionKeyUrl = _context15.sent;
1014
1018
  case 8:
1015
1019
  if (!(!contact.groups || contact.groups.length === 0)) {
1016
- _context17.next = 13;
1020
+ _context15.next = 13;
1017
1021
  break;
1018
1022
  }
1019
- _context17.next = 11;
1023
+ _context15.next = 11;
1020
1024
  return this.fetchDefaultGroup();
1021
1025
  case 11:
1022
- defaultGroupId = _context17.sent;
1026
+ defaultGroupId = _context15.sent;
1023
1027
  contact.groups = [defaultGroupId];
1024
1028
  case 13:
1025
1029
  contact.schemas = _constants2.CONTACTS_SCHEMA;
1026
1030
  requestBody = {};
1027
- _context17.t0 = contact.contactType;
1028
- _context17.next = _context17.t0 === _types2.ContactType.CUSTOM ? 18 : _context17.t0 === _types2.ContactType.CLOUD ? 23 : 30;
1031
+ _context15.t0 = contact.contactType;
1032
+ _context15.next = _context15.t0 === _types2.ContactType.CUSTOM ? 18 : _context15.t0 === _types2.ContactType.CLOUD ? 23 : 30;
1029
1033
  break;
1030
1034
  case 18:
1031
- _context17.next = 20;
1035
+ _context15.next = 20;
1032
1036
  return this.encryptContact(contact);
1033
1037
  case 20:
1034
- encryptedContact = _context17.sent;
1038
+ encryptedContact = _context15.sent;
1035
1039
  requestBody = encryptedContact;
1036
- return _context17.abrupt("break", 31);
1040
+ return _context15.abrupt("break", 31);
1037
1041
  case 23:
1038
1042
  if (contact.contactId) {
1039
- _context17.next = 25;
1043
+ _context15.next = 25;
1040
1044
  break;
1041
1045
  }
1042
- return _context17.abrupt("return", {
1046
+ return _context15.abrupt("return", {
1043
1047
  statusCode: 400,
1044
1048
  data: {
1045
1049
  error: 'contactId is required for contactType:CLOUD.'
@@ -1047,14 +1051,14 @@ var ContactsClient = exports.ContactsClient = /*#__PURE__*/function () {
1047
1051
  message: _constants.FAILURE_MESSAGE
1048
1052
  });
1049
1053
  case 25:
1050
- _context17.next = 27;
1054
+ _context15.next = 27;
1051
1055
  return this.encryptContact(contact);
1052
1056
  case 27:
1053
- _encryptedContact = _context17.sent;
1057
+ _encryptedContact = _context15.sent;
1054
1058
  requestBody = _encryptedContact;
1055
- return _context17.abrupt("break", 31);
1059
+ return _context15.abrupt("break", 31);
1056
1060
  case 30:
1057
- return _context17.abrupt("return", {
1061
+ return _context15.abrupt("return", {
1058
1062
  statusCode: 400,
1059
1063
  data: {
1060
1064
  error: 'Unknown contactType received.'
@@ -1062,7 +1066,7 @@ var ContactsClient = exports.ContactsClient = /*#__PURE__*/function () {
1062
1066
  message: _constants.FAILURE_MESSAGE
1063
1067
  });
1064
1068
  case 31:
1065
- _context17.next = 33;
1069
+ _context15.next = 33;
1066
1070
  return this.webex.request({
1067
1071
  // eslint-disable-next-line no-underscore-dangle
1068
1072
  uri: "".concat(this.webex.internal.services._serviceUrls.contactsService, "/").concat(_constants2.ENCRYPT_FILTER, "/").concat(_constants2.USERS, "/").concat(_constants2.CONTACT_FILTER),
@@ -1070,7 +1074,9 @@ var ContactsClient = exports.ContactsClient = /*#__PURE__*/function () {
1070
1074
  body: requestBody
1071
1075
  });
1072
1076
  case 33:
1073
- response = _context17.sent;
1077
+ response = _context15.sent;
1078
+ _Logger.default.log("Response code: ".concat(response.statusCode), loggerContext);
1079
+ _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);
1074
1080
  newContact = response.body;
1075
1081
  contact.contactId = newContact.contactId;
1076
1082
  contactResponse = {
@@ -1081,43 +1087,43 @@ var ContactsClient = exports.ContactsClient = /*#__PURE__*/function () {
1081
1087
  message: _constants.SUCCESS_MESSAGE
1082
1088
  };
1083
1089
  if (!(contact.contactType === _types2.ContactType.CLOUD && newContact.contactId)) {
1084
- _context17.next = 46;
1090
+ _context15.next = 48;
1085
1091
  break;
1086
1092
  }
1087
1093
  query = "".concat(_constants2.SCIM_ID_FILTER, " \"").concat(newContact.contactId, "\"");
1088
- _context17.next = 41;
1094
+ _context15.next = 43;
1089
1095
  return (0, _Utils.scimQuery)(query);
1090
- case 41:
1091
- res = _context17.sent;
1096
+ case 43:
1097
+ res = _context15.sent;
1092
1098
  resolvedContact = this.resolveCloudContacts(Object.fromEntries([[newContact.contactId, newContact]]), res.body);
1093
1099
  if (resolvedContact) {
1094
1100
  (_this$contacts = this.contacts) === null || _this$contacts === void 0 ? void 0 : _this$contacts.push(resolvedContact[0]);
1095
1101
  }
1096
- _context17.next = 47;
1102
+ _context15.next = 49;
1097
1103
  break;
1098
- case 46:
1104
+ case 48:
1099
1105
  (_this$contacts2 = this.contacts) === null || _this$contacts2 === void 0 ? void 0 : _this$contacts2.push(contact);
1100
- case 47:
1106
+ case 49:
1101
1107
  _Logger.default.log("Contact successfully created", loggerContext);
1102
- return _context17.abrupt("return", contactResponse);
1103
- case 51:
1104
- _context17.prev = 51;
1105
- _context17.t1 = _context17["catch"](2);
1106
- errorInfo = _context17.t1;
1107
- extendedError = new Error("Failed to create contact: ".concat(_context17.t1));
1108
+ return _context15.abrupt("return", contactResponse);
1109
+ case 53:
1110
+ _context15.prev = 53;
1111
+ _context15.t1 = _context15["catch"](2);
1112
+ errorInfo = _context15.t1;
1113
+ extendedError = new Error("Failed to create contact: ".concat(_context15.t1));
1108
1114
  _Logger.default.error(extendedError, loggerContext);
1109
1115
  errorStatus = (0, _Utils.serviceErrorCodeHandler)(errorInfo, loggerContext);
1110
- _context17.next = 59;
1116
+ _context15.next = 61;
1111
1117
  return (0, _Utils.uploadLogs)();
1112
- case 59:
1113
- return _context17.abrupt("return", errorStatus);
1114
- case 60:
1118
+ case 61:
1119
+ return _context15.abrupt("return", errorStatus);
1120
+ case 62:
1115
1121
  case "end":
1116
- return _context17.stop();
1122
+ return _context15.stop();
1117
1123
  }
1118
- }, _callee17, this, [[2, 51]]);
1124
+ }, _callee15, this, [[2, 53]]);
1119
1125
  }));
1120
- function createContact(_x18) {
1126
+ function createContact(_x16) {
1121
1127
  return _createContact.apply(this, arguments);
1122
1128
  }
1123
1129
  return createContact;
@@ -1130,26 +1136,26 @@ var ContactsClient = exports.ContactsClient = /*#__PURE__*/function () {
1130
1136
  }, {
1131
1137
  key: "deleteContact",
1132
1138
  value: (function () {
1133
- var _deleteContact = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee18(contactId) {
1139
+ var _deleteContact = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee16(contactId) {
1134
1140
  var loggerContext, _this$contacts3, response, contactResponse, contactToDelete, _this$contacts4, errorInfo, extendedError, errorStatus;
1135
- return _regenerator.default.wrap(function _callee18$(_context18) {
1136
- while (1) switch (_context18.prev = _context18.next) {
1141
+ return _regenerator.default.wrap(function _callee16$(_context16) {
1142
+ while (1) switch (_context16.prev = _context16.next) {
1137
1143
  case 0:
1138
1144
  loggerContext = {
1139
- file: _constants2.CONTACTS_FILE,
1145
+ file: _constants2.CONTACTS_CLIENT,
1140
1146
  method: _constants2.METHODS.DELETE_CONTACT
1141
1147
  };
1142
1148
  _Logger.default.info("".concat(_constants.METHOD_START_MESSAGE, " with contactId: ").concat(contactId), loggerContext);
1143
- _context18.prev = 2;
1149
+ _context16.prev = 2;
1144
1150
  _Logger.default.info("Deleting contact : ".concat(contactId), loggerContext);
1145
- _context18.next = 6;
1151
+ _context16.next = 6;
1146
1152
  return this.webex.request({
1147
1153
  // eslint-disable-next-line no-underscore-dangle
1148
1154
  uri: "".concat(this.webex.internal.services._serviceUrls.contactsService, "/").concat(_constants2.ENCRYPT_FILTER, "/").concat(_constants2.USERS, "/").concat(_constants2.CONTACT_FILTER, "/").concat(contactId),
1149
1155
  method: _types.HTTP_METHODS.DELETE
1150
1156
  });
1151
1157
  case 6:
1152
- response = _context18.sent;
1158
+ response = _context16.sent;
1153
1159
  contactResponse = {
1154
1160
  statusCode: Number(response[_constants.STATUS_CODE]),
1155
1161
  data: {},
@@ -1162,25 +1168,25 @@ var ContactsClient = exports.ContactsClient = /*#__PURE__*/function () {
1162
1168
  (_this$contacts4 = this.contacts) === null || _this$contacts4 === void 0 ? void 0 : _this$contacts4.splice(contactToDelete, 1);
1163
1169
  }
1164
1170
  _Logger.default.log("Contact ".concat(contactId, " successfully deleted"), loggerContext);
1165
- return _context18.abrupt("return", contactResponse);
1171
+ return _context16.abrupt("return", contactResponse);
1166
1172
  case 14:
1167
- _context18.prev = 14;
1168
- _context18.t0 = _context18["catch"](2);
1169
- errorInfo = _context18.t0;
1170
- extendedError = new Error("Unable to delete contact ".concat(contactId, ": ").concat(_context18.t0));
1173
+ _context16.prev = 14;
1174
+ _context16.t0 = _context16["catch"](2);
1175
+ errorInfo = _context16.t0;
1176
+ extendedError = new Error("Unable to delete contact ".concat(contactId, ": ").concat(_context16.t0));
1171
1177
  _Logger.default.error(extendedError, loggerContext);
1172
1178
  errorStatus = (0, _Utils.serviceErrorCodeHandler)(errorInfo, loggerContext);
1173
- _context18.next = 22;
1179
+ _context16.next = 22;
1174
1180
  return (0, _Utils.uploadLogs)();
1175
1181
  case 22:
1176
- return _context18.abrupt("return", errorStatus);
1182
+ return _context16.abrupt("return", errorStatus);
1177
1183
  case 23:
1178
1184
  case "end":
1179
- return _context18.stop();
1185
+ return _context16.stop();
1180
1186
  }
1181
- }, _callee18, this, [[2, 14]]);
1187
+ }, _callee16, this, [[2, 14]]);
1182
1188
  }));
1183
- function deleteContact(_x19) {
1189
+ function deleteContact(_x17) {
1184
1190
  return _deleteContact.apply(this, arguments);
1185
1191
  }
1186
1192
  return deleteContact;