@webex/calling 3.9.0 → 3.10.0-next.1

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