@webex/calling 3.3.1 → 3.4.0-next.10

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 (108) hide show
  1. package/dist/CallHistory/CallHistory.js +103 -4
  2. package/dist/CallHistory/CallHistory.js.map +1 -1
  3. package/dist/CallHistory/CallHistory.test.js +143 -0
  4. package/dist/CallHistory/CallHistory.test.js.map +1 -1
  5. package/dist/CallHistory/callHistoryFixtures.js +224 -1
  6. package/dist/CallHistory/callHistoryFixtures.js.map +1 -1
  7. package/dist/CallHistory/constants.js +8 -2
  8. package/dist/CallHistory/constants.js.map +1 -1
  9. package/dist/CallHistory/types.js.map +1 -1
  10. package/dist/CallSettings/UcmBackendConnector.js +1 -1
  11. package/dist/CallSettings/UcmBackendConnector.js.map +1 -1
  12. package/dist/CallSettings/UcmBackendConnector.test.js +1 -1
  13. package/dist/CallSettings/UcmBackendConnector.test.js.map +1 -1
  14. package/dist/CallSettings/constants.js +1 -3
  15. package/dist/CallSettings/constants.js.map +1 -1
  16. package/dist/CallingClient/calling/CallerId/types.js.map +1 -1
  17. package/dist/CallingClient/calling/call.js +5 -3
  18. package/dist/CallingClient/calling/call.js.map +1 -1
  19. package/dist/CallingClient/calling/call.test.js +17 -15
  20. package/dist/CallingClient/calling/call.test.js.map +1 -1
  21. package/dist/CallingClient/constants.js +6 -8
  22. package/dist/CallingClient/constants.js.map +1 -1
  23. package/dist/CallingClient/registration/register.js +18 -13
  24. package/dist/CallingClient/registration/register.js.map +1 -1
  25. package/dist/CallingClient/registration/register.test.js +242 -125
  26. package/dist/CallingClient/registration/register.test.js.map +1 -1
  27. package/dist/Contacts/ContactsClient.js +270 -292
  28. package/dist/Contacts/ContactsClient.js.map +1 -1
  29. package/dist/Contacts/ContactsClient.test.js +109 -12
  30. package/dist/Contacts/ContactsClient.test.js.map +1 -1
  31. package/dist/Contacts/constants.js +3 -1
  32. package/dist/Contacts/constants.js.map +1 -1
  33. package/dist/Contacts/contactFixtures.js +164 -48
  34. package/dist/Contacts/contactFixtures.js.map +1 -1
  35. package/dist/Contacts/types.js.map +1 -1
  36. package/dist/Events/types.js.map +1 -1
  37. package/dist/Metrics/index.js +9 -9
  38. package/dist/Metrics/index.js.map +1 -1
  39. package/dist/Metrics/index.test.js +37 -10
  40. package/dist/Metrics/index.test.js.map +1 -1
  41. package/dist/SDKConnector/types.js.map +1 -1
  42. package/dist/common/Utils.js +12 -10
  43. package/dist/common/Utils.js.map +1 -1
  44. package/dist/common/Utils.test.js +25 -1
  45. package/dist/common/Utils.test.js.map +1 -1
  46. package/dist/common/constants.js +10 -1
  47. package/dist/common/constants.js.map +1 -1
  48. package/dist/common/testUtil.js +24 -6
  49. package/dist/common/testUtil.js.map +1 -1
  50. package/dist/common/types.js +1 -0
  51. package/dist/common/types.js.map +1 -1
  52. package/dist/module/CallHistory/CallHistory.js +57 -3
  53. package/dist/module/CallHistory/callHistoryFixtures.js +215 -0
  54. package/dist/module/CallHistory/constants.js +7 -1
  55. package/dist/module/CallSettings/UcmBackendConnector.js +5 -3
  56. package/dist/module/CallSettings/constants.js +0 -2
  57. package/dist/module/CallingClient/calling/call.js +6 -4
  58. package/dist/module/CallingClient/constants.js +5 -6
  59. package/dist/module/CallingClient/registration/register.js +12 -6
  60. package/dist/module/Contacts/ContactsClient.js +75 -58
  61. package/dist/module/Contacts/constants.js +2 -0
  62. package/dist/module/Contacts/contactFixtures.js +198 -31
  63. package/dist/module/Metrics/index.js +9 -9
  64. package/dist/module/common/Utils.js +10 -9
  65. package/dist/module/common/constants.js +9 -0
  66. package/dist/module/common/testUtil.js +24 -4
  67. package/dist/module/common/types.js +1 -0
  68. package/dist/types/CallHistory/CallHistory.d.ts +1 -0
  69. package/dist/types/CallHistory/CallHistory.d.ts.map +1 -1
  70. package/dist/types/CallHistory/callHistoryFixtures.d.ts +98 -1
  71. package/dist/types/CallHistory/callHistoryFixtures.d.ts.map +1 -1
  72. package/dist/types/CallHistory/constants.d.ts +7 -1
  73. package/dist/types/CallHistory/constants.d.ts.map +1 -1
  74. package/dist/types/CallHistory/types.d.ts +9 -1
  75. package/dist/types/CallHistory/types.d.ts.map +1 -1
  76. package/dist/types/CallSettings/UcmBackendConnector.d.ts.map +1 -1
  77. package/dist/types/CallSettings/constants.d.ts +0 -2
  78. package/dist/types/CallSettings/constants.d.ts.map +1 -1
  79. package/dist/types/CallingClient/calling/CallerId/types.d.ts +1 -23
  80. package/dist/types/CallingClient/calling/CallerId/types.d.ts.map +1 -1
  81. package/dist/types/CallingClient/calling/call.d.ts.map +1 -1
  82. package/dist/types/CallingClient/constants.d.ts +4 -5
  83. package/dist/types/CallingClient/constants.d.ts.map +1 -1
  84. package/dist/types/CallingClient/registration/register.d.ts +1 -0
  85. package/dist/types/CallingClient/registration/register.d.ts.map +1 -1
  86. package/dist/types/Contacts/ContactsClient.d.ts +2 -2
  87. package/dist/types/Contacts/ContactsClient.d.ts.map +1 -1
  88. package/dist/types/Contacts/constants.d.ts +2 -0
  89. package/dist/types/Contacts/constants.d.ts.map +1 -1
  90. package/dist/types/Contacts/contactFixtures.d.ts +99 -39
  91. package/dist/types/Contacts/contactFixtures.d.ts.map +1 -1
  92. package/dist/types/Contacts/types.d.ts +7 -14
  93. package/dist/types/Contacts/types.d.ts.map +1 -1
  94. package/dist/types/Events/types.d.ts +15 -0
  95. package/dist/types/Events/types.d.ts.map +1 -1
  96. package/dist/types/SDKConnector/types.d.ts +1 -5
  97. package/dist/types/SDKConnector/types.d.ts.map +1 -1
  98. package/dist/types/Voicemail/UcmBackendConnector.d.ts +1 -1
  99. package/dist/types/Voicemail/WxCallBackendConnector.d.ts +1 -1
  100. package/dist/types/common/Utils.d.ts +3 -2
  101. package/dist/types/common/Utils.d.ts.map +1 -1
  102. package/dist/types/common/constants.d.ts +9 -0
  103. package/dist/types/common/constants.d.ts.map +1 -1
  104. package/dist/types/common/testUtil.d.ts +20 -4
  105. package/dist/types/common/testUtil.d.ts.map +1 -1
  106. package/dist/types/common/types.d.ts +56 -25
  107. package/dist/types/common/types.d.ts.map +1 -1
  108. package/package.json +7 -7
@@ -370,211 +370,187 @@ var ContactsClient = exports.ContactsClient = /*#__PURE__*/function () {
370
370
  return _decryptContact.apply(this, arguments);
371
371
  }
372
372
  return decryptContact;
373
- }()
374
- /**
375
- * Fetches contacts from DSS.
376
- */
377
- )
373
+ }())
378
374
  }, {
379
- key: "fetchContactFromDSS",
380
- value: (function () {
381
- var _fetchContactFromDSS = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee9(contactsDataMap) {
382
- var _this5 = this;
383
- var contactList, dssResult, _loop, i;
384
- return _regenerator.default.wrap(function _callee9$(_context10) {
385
- while (1) switch (_context10.prev = _context10.next) {
386
- case 0:
387
- contactList = [];
388
- _context10.next = 3;
389
- return this.webex.internal.dss.lookup({
390
- ids: (0, _keys.default)(contactsDataMap)
391
- });
392
- case 3:
393
- dssResult = _context10.sent;
394
- _loop = /*#__PURE__*/_regenerator.default.mark(function _loop() {
395
- var contact, contactId, displayName, emails, phoneNumbers, sipAddresses, photos, _contact$additionalIn, department, firstName, identityManager, jobTitle, lastName, manager, _contactsDataMap$cont, contactType, avatarUrlDomain, encryptionKeyUrl, ownerId, groups, avatarURL, addedPhoneNumbers, decryptedPhoneNumbers, addedSipAddresses, decryptedSipAddresses, cloudContact;
396
- return _regenerator.default.wrap(function _loop$(_context9) {
397
- while (1) switch (_context9.prev = _context9.next) {
398
- case 0:
399
- contact = dssResult[i];
400
- contactId = contact.identity;
401
- displayName = contact.displayName, emails = contact.emails, phoneNumbers = contact.phoneNumbers, sipAddresses = contact.sipAddresses, photos = contact.photos;
402
- _contact$additionalIn = contact.additionalInfo, department = _contact$additionalIn.department, firstName = _contact$additionalIn.firstName, identityManager = _contact$additionalIn.identityManager, jobTitle = _contact$additionalIn.jobTitle, lastName = _contact$additionalIn.lastName;
403
- manager = identityManager && identityManager.displayName ? identityManager.displayName : undefined;
404
- _contactsDataMap$cont = contactsDataMap[contactId], contactType = _contactsDataMap$cont.contactType, avatarUrlDomain = _contactsDataMap$cont.avatarUrlDomain, encryptionKeyUrl = _contactsDataMap$cont.encryptionKeyUrl, ownerId = _contactsDataMap$cont.ownerId, groups = _contactsDataMap$cont.groups;
405
- avatarURL = '';
406
- if (photos.length) {
407
- avatarURL = photos[0].value;
408
- }
409
- addedPhoneNumbers = contactsDataMap[contactId].phoneNumbers;
410
- if (!addedPhoneNumbers) {
411
- _context9.next = 14;
412
- break;
413
- }
414
- _context9.next = 12;
415
- return _this5.decryptContactDetail(encryptionKeyUrl, addedPhoneNumbers);
416
- case 12:
417
- decryptedPhoneNumbers = _context9.sent;
418
- decryptedPhoneNumbers.forEach(function (number) {
419
- return phoneNumbers.push(number);
420
- });
421
- case 14:
422
- addedSipAddresses = contactsDataMap[contactId].sipAddresses;
423
- if (!addedSipAddresses) {
424
- _context9.next = 20;
425
- break;
426
- }
427
- _context9.next = 18;
428
- return _this5.decryptContactDetail(encryptionKeyUrl, addedSipAddresses);
429
- case 18:
430
- decryptedSipAddresses = _context9.sent;
431
- decryptedSipAddresses.forEach(function (address) {
432
- return sipAddresses.push(address);
433
- });
434
- case 20:
435
- cloudContact = {
436
- avatarUrlDomain: avatarUrlDomain,
437
- avatarURL: avatarURL,
438
- contactId: contactId,
439
- contactType: contactType,
440
- department: department,
441
- displayName: displayName,
442
- emails: emails,
443
- encryptionKeyUrl: encryptionKeyUrl,
444
- firstName: firstName,
445
- groups: groups,
446
- lastName: lastName,
447
- manager: manager,
448
- ownerId: ownerId,
449
- phoneNumbers: phoneNumbers,
450
- sipAddresses: sipAddresses,
451
- title: jobTitle
452
- };
453
- contactList.push(cloudContact);
454
- case 22:
455
- case "end":
456
- return _context9.stop();
457
- }
458
- }, _loop);
459
- });
460
- i = 0;
461
- case 6:
462
- if (!(i < dssResult.length)) {
463
- _context10.next = 11;
464
- break;
465
- }
466
- return _context10.delegateYield(_loop(), "t0", 8);
467
- case 8:
468
- i += 1;
469
- _context10.next = 6;
470
- break;
471
- case 11:
472
- return _context10.abrupt("return", contactList);
473
- case 12:
474
- case "end":
475
- return _context10.stop();
375
+ key: "resolveCloudContacts",
376
+ value: function resolveCloudContacts(contactsDataMap, inputList) {
377
+ var loggerContext = {
378
+ file: _constants2.CONTACTS_FILE,
379
+ method: 'resolveCloudContacts'
380
+ };
381
+ var finalContactList = [];
382
+ var resolvedList = [];
383
+ try {
384
+ inputList.Resources.forEach(function (item) {
385
+ resolvedList.push(item.id);
386
+ });
387
+ (0, _values.default)(contactsDataMap).forEach(function (item) {
388
+ var isResolved = resolvedList.some(function (listItem) {
389
+ return listItem === item.contactId;
390
+ });
391
+ if (!isResolved) {
392
+ finalContactList.push(_objectSpread(_objectSpread({}, item), {}, {
393
+ resolved: false
394
+ }));
476
395
  }
477
- }, _callee9, this);
478
- }));
479
- function fetchContactFromDSS(_x11) {
480
- return _fetchContactFromDSS.apply(this, arguments);
396
+ });
397
+ for (var n = 0; n < inputList.Resources.length; n += 1) {
398
+ var _filteredContact$name, _filteredContact$name2, _filteredContact$SCIM, _filteredContact$SCIM2, _filteredContact$SCIM3;
399
+ var filteredContact = inputList.Resources[n];
400
+ var displayName = filteredContact.displayName,
401
+ emails = filteredContact.emails,
402
+ phoneNumbers = filteredContact.phoneNumbers,
403
+ photos = filteredContact.photos;
404
+ var sipAddresses = void 0;
405
+ if (filteredContact[_constants.SCIM_WEBEXIDENTITY_USER]) {
406
+ sipAddresses = filteredContact[_constants.SCIM_WEBEXIDENTITY_USER].sipAddresses;
407
+ }
408
+ var firstName = (_filteredContact$name = filteredContact.name) === null || _filteredContact$name === void 0 ? void 0 : _filteredContact$name.givenName;
409
+ var lastName = (_filteredContact$name2 = filteredContact.name) === null || _filteredContact$name2 === void 0 ? void 0 : _filteredContact$name2.familyName;
410
+ var manager = (_filteredContact$SCIM = filteredContact[_constants.SCIM_ENTERPRISE_USER]) === null || _filteredContact$SCIM === void 0 ? void 0 : (_filteredContact$SCIM2 = _filteredContact$SCIM.manager) === null || _filteredContact$SCIM2 === void 0 ? void 0 : _filteredContact$SCIM2.displayName;
411
+ var department = (_filteredContact$SCIM3 = filteredContact[_constants.SCIM_ENTERPRISE_USER]) === null || _filteredContact$SCIM3 === void 0 ? void 0 : _filteredContact$SCIM3.department;
412
+ var avatarURL = photos !== null && photos !== void 0 && photos.length ? photos[0].value : '';
413
+ var _contactsDataMap$inpu = contactsDataMap[inputList.Resources[n].id],
414
+ contactType = _contactsDataMap$inpu.contactType,
415
+ avatarUrlDomain = _contactsDataMap$inpu.avatarUrlDomain,
416
+ encryptionKeyUrl = _contactsDataMap$inpu.encryptionKeyUrl,
417
+ ownerId = _contactsDataMap$inpu.ownerId,
418
+ groups = _contactsDataMap$inpu.groups;
419
+ var cloudContact = {
420
+ avatarUrlDomain: avatarUrlDomain,
421
+ avatarURL: avatarURL,
422
+ contactId: inputList.Resources[n].id,
423
+ contactType: contactType,
424
+ department: department,
425
+ displayName: displayName,
426
+ emails: emails,
427
+ encryptionKeyUrl: encryptionKeyUrl,
428
+ firstName: firstName,
429
+ groups: groups,
430
+ lastName: lastName,
431
+ manager: manager,
432
+ ownerId: ownerId,
433
+ phoneNumbers: phoneNumbers,
434
+ sipAddresses: sipAddresses,
435
+ resolved: true
436
+ };
437
+ finalContactList.push(cloudContact);
438
+ }
439
+ } catch (error) {
440
+ _Logger.default.warn('Error occurred while parsing resolved contacts', loggerContext);
441
+ return null;
481
442
  }
482
- return fetchContactFromDSS;
483
- }()
443
+ return finalContactList;
444
+ }
445
+
484
446
  /**
485
447
  * Returns list of contacts.
486
448
  */
487
- )
488
449
  }, {
489
450
  key: "getContacts",
490
451
  value: (function () {
491
452
  var _getContacts = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee11() {
492
- var _this6 = this;
493
- var loggerContext, contactList, contactsDataMap, response, responseBody, contacts, groups, i, contact, decryptedContact, cloudContacts, contactResponse, errorInfo, errorStatus;
494
- return _regenerator.default.wrap(function _callee11$(_context12) {
495
- while (1) switch (_context12.prev = _context12.next) {
453
+ var _this5 = this;
454
+ var loggerContext, contactList, cloudContactsMap, response, responseBody, contacts, groups, contactIdList, query, result, resolvedContacts, contactResponse, errorInfo, errorStatus;
455
+ return _regenerator.default.wrap(function _callee11$(_context11) {
456
+ while (1) switch (_context11.prev = _context11.next) {
496
457
  case 0:
497
458
  loggerContext = {
498
459
  file: _constants2.CONTACTS_FILE,
499
460
  method: 'getContacts'
500
461
  };
501
462
  contactList = [];
502
- contactsDataMap = {};
503
- _context12.prev = 3;
504
- _context12.next = 6;
463
+ cloudContactsMap = {};
464
+ _context11.prev = 3;
465
+ _context11.next = 6;
505
466
  return this.webex.request({
506
467
  // eslint-disable-next-line no-underscore-dangle
507
468
  uri: "".concat(this.webex.internal.services._serviceUrls.contactsService, "/").concat(_constants2.ENCRYPT_FILTER, "/").concat(_constants2.USERS, "/").concat(_constants2.CONTACT_FILTER),
508
469
  method: _types.HTTP_METHODS.GET
509
470
  });
510
471
  case 6:
511
- response = _context12.sent;
472
+ response = _context11.sent;
512
473
  responseBody = response.body;
513
474
  if (responseBody) {
514
- _context12.next = 10;
475
+ _context11.next = 10;
515
476
  break;
516
477
  }
517
478
  throw new Error("".concat(response));
518
479
  case 10:
519
480
  contacts = responseBody.contacts, groups = responseBody.groups;
520
- i = 0;
521
- case 12:
522
- if (!(i < contacts.length)) {
523
- _context12.next = 25;
524
- break;
525
- }
526
- contact = contacts[i];
527
- if (!(contact.contactType === _types2.ContactType.CUSTOM)) {
528
- _context12.next = 21;
481
+ contacts.map( /*#__PURE__*/function () {
482
+ var _ref13 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee9(contact) {
483
+ var decryptedContact;
484
+ return _regenerator.default.wrap(function _callee9$(_context9) {
485
+ while (1) switch (_context9.prev = _context9.next) {
486
+ case 0:
487
+ if (!(contact.contactType === _types2.ContactType.CUSTOM)) {
488
+ _context9.next = 7;
489
+ break;
490
+ }
491
+ _context9.next = 3;
492
+ return _this5.decryptContact(contact);
493
+ case 3:
494
+ decryptedContact = _context9.sent;
495
+ contactList.push(decryptedContact);
496
+ _context9.next = 8;
497
+ break;
498
+ case 7:
499
+ if (contact.contactType === _types2.ContactType.CLOUD && contact.contactId) {
500
+ cloudContactsMap[contact.contactId] = contact;
501
+ }
502
+ case 8:
503
+ case "end":
504
+ return _context9.stop();
505
+ }
506
+ }, _callee9);
507
+ }));
508
+ return function (_x11) {
509
+ return _ref13.apply(this, arguments);
510
+ };
511
+ }());
512
+
513
+ // Resolve cloud contacts
514
+ if (!(0, _keys.default)(cloudContactsMap).length) {
515
+ _context11.next = 20;
529
516
  break;
530
517
  }
531
- _context12.next = 17;
532
- return this.decryptContact(contact);
518
+ contactIdList = (0, _keys.default)(cloudContactsMap);
519
+ query = contactIdList.map(function (item) {
520
+ return "".concat(_constants2.SCIM_ID_FILTER, " \"").concat(item, "\"");
521
+ }).join(_constants2.OR);
522
+ _context11.next = 17;
523
+ return (0, _Utils.scimQuery)(query);
533
524
  case 17:
534
- decryptedContact = _context12.sent;
535
- contactList.push(decryptedContact);
536
- _context12.next = 22;
537
- break;
538
- case 21:
539
- if (contact.contactType === _types2.ContactType.CLOUD && contact.contactId) {
540
- contactsDataMap[contact.contactId] = contact;
541
- }
542
- case 22:
543
- i += 1;
544
- _context12.next = 12;
545
- break;
546
- case 25:
547
- if (!(0, _keys.default)(contactsDataMap).length) {
548
- _context12.next = 30;
549
- break;
525
+ result = _context11.sent;
526
+ resolvedContacts = this.resolveCloudContacts(cloudContactsMap, result.body);
527
+ if (resolvedContacts) {
528
+ resolvedContacts.map(function (item) {
529
+ return contactList.push(item);
530
+ });
550
531
  }
551
- _context12.next = 28;
552
- return this.fetchContactFromDSS(contactsDataMap);
553
- case 28:
554
- cloudContacts = _context12.sent;
555
- contactList.push.apply(contactList, (0, _toConsumableArray2.default)(cloudContacts));
556
- case 30:
557
- _context12.next = 32;
532
+ case 20:
533
+ _context11.next = 22;
558
534
  return _promise.default.all(groups.map( /*#__PURE__*/function () {
559
- var _ref13 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee10(group, idx) {
560
- return _regenerator.default.wrap(function _callee10$(_context11) {
561
- while (1) switch (_context11.prev = _context11.next) {
535
+ var _ref14 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee10(group, idx) {
536
+ return _regenerator.default.wrap(function _callee10$(_context10) {
537
+ while (1) switch (_context10.prev = _context10.next) {
562
538
  case 0:
563
- _context11.next = 2;
564
- return _this6.webex.internal.encryption.decryptText(group.encryptionKeyUrl, group.displayName);
539
+ _context10.next = 2;
540
+ return _this5.webex.internal.encryption.decryptText(group.encryptionKeyUrl, group.displayName);
565
541
  case 2:
566
- groups[idx].displayName = _context11.sent;
542
+ groups[idx].displayName = _context10.sent;
567
543
  case 3:
568
544
  case "end":
569
- return _context11.stop();
545
+ return _context10.stop();
570
546
  }
571
547
  }, _callee10);
572
548
  }));
573
549
  return function (_x12, _x13) {
574
- return _ref13.apply(this, arguments);
550
+ return _ref14.apply(this, arguments);
575
551
  };
576
552
  }()));
577
- case 32:
553
+ case 22:
578
554
  this.groups = groups;
579
555
  this.contacts = contactList;
580
556
  contactResponse = {
@@ -585,18 +561,18 @@ var ContactsClient = exports.ContactsClient = /*#__PURE__*/function () {
585
561
  },
586
562
  message: _constants.SUCCESS_MESSAGE
587
563
  };
588
- return _context12.abrupt("return", contactResponse);
589
- case 38:
590
- _context12.prev = 38;
591
- _context12.t0 = _context12["catch"](3);
592
- errorInfo = _context12.t0;
564
+ return _context11.abrupt("return", contactResponse);
565
+ case 28:
566
+ _context11.prev = 28;
567
+ _context11.t0 = _context11["catch"](3);
568
+ errorInfo = _context11.t0;
593
569
  errorStatus = (0, _Utils.serviceErrorCodeHandler)(errorInfo, loggerContext);
594
- return _context12.abrupt("return", errorStatus);
595
- case 43:
570
+ return _context11.abrupt("return", errorStatus);
571
+ case 33:
596
572
  case "end":
597
- return _context12.stop();
573
+ return _context11.stop();
598
574
  }
599
- }, _callee11, this, [[3, 38]]);
575
+ }, _callee11, this, [[3, 28]]);
600
576
  }));
601
577
  function getContacts() {
602
578
  return _getContacts.apply(this, arguments);
@@ -614,8 +590,8 @@ var ContactsClient = exports.ContactsClient = /*#__PURE__*/function () {
614
590
  value: (function () {
615
591
  var _createNewEncryptionKeyUrl = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee12() {
616
592
  var loggerContext, unboundedKeyUri, unboundedKeys;
617
- return _regenerator.default.wrap(function _callee12$(_context13) {
618
- while (1) switch (_context13.prev = _context13.next) {
593
+ return _regenerator.default.wrap(function _callee12$(_context12) {
594
+ while (1) switch (_context12.prev = _context12.next) {
619
595
  case 0:
620
596
  loggerContext = {
621
597
  file: _constants2.CONTACTS_FILE,
@@ -623,20 +599,20 @@ var ContactsClient = exports.ContactsClient = /*#__PURE__*/function () {
623
599
  };
624
600
  unboundedKeyUri = '';
625
601
  _Logger.default.info('Requesting kms for a new KRO and key', loggerContext);
626
- _context13.next = 5;
602
+ _context12.next = 5;
627
603
  return this.webex.internal.encryption.kms.createUnboundKeys({
628
604
  count: 1
629
605
  });
630
606
  case 5:
631
- unboundedKeys = _context13.sent;
607
+ unboundedKeys = _context12.sent;
632
608
  unboundedKeyUri = unboundedKeys[0].uri;
633
609
  this.webex.internal.encryption.kms.createResource({
634
610
  keyUris: [unboundedKeyUri]
635
611
  });
636
- return _context13.abrupt("return", unboundedKeyUri);
612
+ return _context12.abrupt("return", unboundedKeyUri);
637
613
  case 9:
638
614
  case "end":
639
- return _context13.stop();
615
+ return _context12.stop();
640
616
  }
641
617
  }, _callee12, this);
642
618
  }));
@@ -657,14 +633,14 @@ var ContactsClient = exports.ContactsClient = /*#__PURE__*/function () {
657
633
  var _fetchEncryptionKeyUrl = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee13() {
658
634
  var _response$data$group;
659
635
  var response, _response$data$group2;
660
- return _regenerator.default.wrap(function _callee13$(_context14) {
661
- while (1) switch (_context14.prev = _context14.next) {
636
+ return _regenerator.default.wrap(function _callee13$(_context13) {
637
+ while (1) switch (_context13.prev = _context13.next) {
662
638
  case 0:
663
639
  if (!this.encryptionKeyUrl) {
664
- _context14.next = 2;
640
+ _context13.next = 2;
665
641
  break;
666
642
  }
667
- return _context14.abrupt("return", this.encryptionKeyUrl);
643
+ return _context13.abrupt("return", this.encryptionKeyUrl);
668
644
  case 2:
669
645
  // istanbul ignore else
670
646
  if (this.groups === undefined) {
@@ -672,30 +648,30 @@ var ContactsClient = exports.ContactsClient = /*#__PURE__*/function () {
672
648
  }
673
649
  // istanbul ignore else
674
650
  if (!(this.groups && this.groups.length)) {
675
- _context14.next = 5;
651
+ _context13.next = 5;
676
652
  break;
677
653
  }
678
- return _context14.abrupt("return", this.groups[0].encryptionKeyUrl);
654
+ return _context13.abrupt("return", this.groups[0].encryptionKeyUrl);
679
655
  case 5:
680
- _context14.next = 7;
656
+ _context13.next = 7;
681
657
  return this.createNewEncryptionKeyUrl();
682
658
  case 7:
683
- this.encryptionKeyUrl = _context14.sent;
659
+ this.encryptionKeyUrl = _context13.sent;
684
660
  _Logger.default.info("Creating a default group: ".concat(_constants2.DEFAULT_GROUP_NAME), {
685
661
  file: _constants2.CONTACTS_FILE,
686
662
  method: this.fetchEncryptionKeyUrl.name
687
663
  });
688
- _context14.next = 11;
664
+ _context13.next = 11;
689
665
  return this.createContactGroup(_constants2.DEFAULT_GROUP_NAME, this.encryptionKeyUrl);
690
666
  case 11:
691
- response = _context14.sent;
667
+ response = _context13.sent;
692
668
  if ((_response$data$group = response.data.group) !== null && _response$data$group !== void 0 && _response$data$group.groupId) {
693
669
  this.defaultGroupId = (_response$data$group2 = response.data.group) === null || _response$data$group2 === void 0 ? void 0 : _response$data$group2.groupId;
694
670
  }
695
- return _context14.abrupt("return", this.encryptionKeyUrl);
671
+ return _context13.abrupt("return", this.encryptionKeyUrl);
696
672
  case 14:
697
673
  case "end":
698
- return _context14.stop();
674
+ return _context13.stop();
699
675
  }
700
676
  }, _callee13, this);
701
677
  }));
@@ -715,55 +691,55 @@ var ContactsClient = exports.ContactsClient = /*#__PURE__*/function () {
715
691
  value: (function () {
716
692
  var _fetchDefaultGroup = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee14() {
717
693
  var i, response, group;
718
- return _regenerator.default.wrap(function _callee14$(_context15) {
719
- while (1) switch (_context15.prev = _context15.next) {
694
+ return _regenerator.default.wrap(function _callee14$(_context14) {
695
+ while (1) switch (_context14.prev = _context14.next) {
720
696
  case 0:
721
697
  if (!this.defaultGroupId) {
722
- _context15.next = 2;
698
+ _context14.next = 2;
723
699
  break;
724
700
  }
725
- return _context15.abrupt("return", this.defaultGroupId);
701
+ return _context14.abrupt("return", this.defaultGroupId);
726
702
  case 2:
727
703
  if (!(this.groups && this.groups.length)) {
728
- _context15.next = 11;
704
+ _context14.next = 11;
729
705
  break;
730
706
  }
731
707
  i = 0;
732
708
  case 4:
733
709
  if (!(i < this.groups.length)) {
734
- _context15.next = 11;
710
+ _context14.next = 11;
735
711
  break;
736
712
  }
737
713
  if (!(this.groups[i].displayName === _constants2.DEFAULT_GROUP_NAME)) {
738
- _context15.next = 8;
714
+ _context14.next = 8;
739
715
  break;
740
716
  }
741
717
  this.defaultGroupId = this.groups[i].groupId;
742
- return _context15.abrupt("return", this.defaultGroupId);
718
+ return _context14.abrupt("return", this.defaultGroupId);
743
719
  case 8:
744
720
  i += 1;
745
- _context15.next = 4;
721
+ _context14.next = 4;
746
722
  break;
747
723
  case 11:
748
724
  _Logger.default.info('No default group found.', {
749
725
  file: _constants2.CONTACTS_FILE,
750
726
  method: this.fetchDefaultGroup.name
751
727
  });
752
- _context15.next = 14;
728
+ _context14.next = 14;
753
729
  return this.createContactGroup(_constants2.DEFAULT_GROUP_NAME);
754
730
  case 14:
755
- response = _context15.sent;
731
+ response = _context14.sent;
756
732
  group = response.data.group;
757
733
  if (!group) {
758
- _context15.next = 18;
734
+ _context14.next = 18;
759
735
  break;
760
736
  }
761
- return _context15.abrupt("return", group.groupId);
737
+ return _context14.abrupt("return", group.groupId);
762
738
  case 18:
763
- return _context15.abrupt("return", '');
739
+ return _context14.abrupt("return", '');
764
740
  case 19:
765
741
  case "end":
766
- return _context15.stop();
742
+ return _context14.stop();
767
743
  }
768
744
  }, _callee14, this);
769
745
  }));
@@ -785,45 +761,45 @@ var ContactsClient = exports.ContactsClient = /*#__PURE__*/function () {
785
761
  value: (function () {
786
762
  var _createContactGroup = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee15(displayName, encryptionKeyUrl, groupType) {
787
763
  var loggerContext, encryptionKeyUrlFinal, isExistingGroup, encryptedDisplayName, groupInfo, _this$groups, response, group, contactResponse, errorInfo, errorStatus;
788
- return _regenerator.default.wrap(function _callee15$(_context16) {
789
- while (1) switch (_context16.prev = _context16.next) {
764
+ return _regenerator.default.wrap(function _callee15$(_context15) {
765
+ while (1) switch (_context15.prev = _context15.next) {
790
766
  case 0:
791
767
  loggerContext = {
792
768
  file: _constants2.CONTACTS_FILE,
793
769
  method: this.createContactGroup.name
794
770
  };
795
771
  _Logger.default.info("Creating contact group ".concat(displayName), loggerContext);
796
- _context16.t0 = encryptionKeyUrl;
797
- if (_context16.t0) {
798
- _context16.next = 7;
772
+ _context15.t0 = encryptionKeyUrl;
773
+ if (_context15.t0) {
774
+ _context15.next = 7;
799
775
  break;
800
776
  }
801
- _context16.next = 6;
777
+ _context15.next = 6;
802
778
  return this.fetchEncryptionKeyUrl();
803
779
  case 6:
804
- _context16.t0 = _context16.sent;
780
+ _context15.t0 = _context15.sent;
805
781
  case 7:
806
- encryptionKeyUrlFinal = _context16.t0;
782
+ encryptionKeyUrlFinal = _context15.t0;
807
783
  if (!(this.groups === undefined)) {
808
- _context16.next = 11;
784
+ _context15.next = 11;
809
785
  break;
810
786
  }
811
- _context16.next = 11;
787
+ _context15.next = 11;
812
788
  return this.getContacts();
813
789
  case 11:
814
790
  if (!(this.groups && this.groups.length)) {
815
- _context16.next = 16;
791
+ _context15.next = 16;
816
792
  break;
817
793
  }
818
794
  isExistingGroup = this.groups.find(function (group) {
819
795
  return group.displayName === displayName;
820
796
  });
821
797
  if (!isExistingGroup) {
822
- _context16.next = 16;
798
+ _context15.next = 16;
823
799
  break;
824
800
  }
825
801
  _Logger.default.warn("Group name ".concat(displayName, " already exists."), loggerContext);
826
- return _context16.abrupt("return", {
802
+ return _context15.abrupt("return", {
827
803
  statusCode: 400,
828
804
  data: {
829
805
  error: 'Group displayName already exists'
@@ -831,18 +807,18 @@ var ContactsClient = exports.ContactsClient = /*#__PURE__*/function () {
831
807
  message: _constants.FAILURE_MESSAGE
832
808
  });
833
809
  case 16:
834
- _context16.next = 18;
810
+ _context15.next = 18;
835
811
  return this.webex.internal.encryption.encryptText(encryptionKeyUrlFinal, displayName);
836
812
  case 18:
837
- encryptedDisplayName = _context16.sent;
813
+ encryptedDisplayName = _context15.sent;
838
814
  groupInfo = {
839
815
  schemas: _constants2.CONTACTS_SCHEMA,
840
816
  displayName: encryptedDisplayName,
841
817
  groupType: groupType || _types2.GroupType.NORMAL,
842
818
  encryptionKeyUrl: encryptionKeyUrlFinal
843
819
  };
844
- _context16.prev = 20;
845
- _context16.next = 23;
820
+ _context15.prev = 20;
821
+ _context15.next = 23;
846
822
  return this.webex.request({
847
823
  // eslint-disable-next-line no-underscore-dangle
848
824
  uri: "".concat(this.webex.internal.services._serviceUrls.contactsService, "/").concat(_constants2.ENCRYPT_FILTER, "/").concat(_constants2.USERS, "/").concat(_constants2.GROUP_FILTER),
@@ -850,7 +826,7 @@ var ContactsClient = exports.ContactsClient = /*#__PURE__*/function () {
850
826
  body: groupInfo
851
827
  });
852
828
  case 23:
853
- response = _context16.sent;
829
+ response = _context15.sent;
854
830
  group = response.body;
855
831
  group.displayName = displayName;
856
832
  contactResponse = {
@@ -861,17 +837,17 @@ var ContactsClient = exports.ContactsClient = /*#__PURE__*/function () {
861
837
  message: _constants.SUCCESS_MESSAGE
862
838
  };
863
839
  (_this$groups = this.groups) === null || _this$groups === void 0 ? void 0 : _this$groups.push(group);
864
- return _context16.abrupt("return", contactResponse);
840
+ return _context15.abrupt("return", contactResponse);
865
841
  case 31:
866
- _context16.prev = 31;
867
- _context16.t1 = _context16["catch"](20);
842
+ _context15.prev = 31;
843
+ _context15.t1 = _context15["catch"](20);
868
844
  _Logger.default.warn('Unable to create contact group.', loggerContext);
869
- errorInfo = _context16.t1;
845
+ errorInfo = _context15.t1;
870
846
  errorStatus = (0, _Utils.serviceErrorCodeHandler)(errorInfo, loggerContext);
871
- return _context16.abrupt("return", errorStatus);
847
+ return _context15.abrupt("return", errorStatus);
872
848
  case 37:
873
849
  case "end":
874
- return _context16.stop();
850
+ return _context15.stop();
875
851
  }
876
852
  }, _callee15, this, [[20, 31]]);
877
853
  }));
@@ -890,23 +866,23 @@ var ContactsClient = exports.ContactsClient = /*#__PURE__*/function () {
890
866
  value: (function () {
891
867
  var _deleteContactGroup = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee16(groupId) {
892
868
  var loggerContext, _this$groups2, _this$groups4, response, contactResponse, groupToDelete, _this$groups3, errorInfo, errorStatus;
893
- return _regenerator.default.wrap(function _callee16$(_context17) {
894
- while (1) switch (_context17.prev = _context17.next) {
869
+ return _regenerator.default.wrap(function _callee16$(_context16) {
870
+ while (1) switch (_context16.prev = _context16.next) {
895
871
  case 0:
896
872
  loggerContext = {
897
873
  file: _constants2.CONTACTS_FILE,
898
874
  method: this.deleteContactGroup.name
899
875
  };
900
- _context17.prev = 1;
876
+ _context16.prev = 1;
901
877
  _Logger.default.info("Deleting contact group: ".concat(groupId), loggerContext);
902
- _context17.next = 5;
878
+ _context16.next = 5;
903
879
  return this.webex.request({
904
880
  // eslint-disable-next-line no-underscore-dangle
905
881
  uri: "".concat(this.webex.internal.services._serviceUrls.contactsService, "/").concat(_constants2.ENCRYPT_FILTER, "/").concat(_constants2.USERS, "/").concat(_constants2.GROUP_FILTER, "/").concat(groupId),
906
882
  method: _types.HTTP_METHODS.DELETE
907
883
  });
908
884
  case 5:
909
- response = _context17.sent;
885
+ response = _context16.sent;
910
886
  contactResponse = {
911
887
  statusCode: Number(response[_constants.STATUS_CODE]),
912
888
  data: {},
@@ -921,17 +897,17 @@ var ContactsClient = exports.ContactsClient = /*#__PURE__*/function () {
921
897
  if (!((_this$groups4 = this.groups) !== null && _this$groups4 !== void 0 && _this$groups4.length)) {
922
898
  this.defaultGroupId = '';
923
899
  }
924
- return _context17.abrupt("return", contactResponse);
900
+ return _context16.abrupt("return", contactResponse);
925
901
  case 13:
926
- _context17.prev = 13;
927
- _context17.t0 = _context17["catch"](1);
902
+ _context16.prev = 13;
903
+ _context16.t0 = _context16["catch"](1);
928
904
  _Logger.default.warn("Unable to delete contact group ".concat(groupId), loggerContext);
929
- errorInfo = _context17.t0;
905
+ errorInfo = _context16.t0;
930
906
  errorStatus = (0, _Utils.serviceErrorCodeHandler)(errorInfo, loggerContext);
931
- return _context17.abrupt("return", errorStatus);
907
+ return _context16.abrupt("return", errorStatus);
932
908
  case 19:
933
909
  case "end":
934
- return _context17.stop();
910
+ return _context16.stop();
935
911
  }
936
912
  }, _callee16, this, [[1, 13]]);
937
913
  }));
@@ -949,54 +925,54 @@ var ContactsClient = exports.ContactsClient = /*#__PURE__*/function () {
949
925
  key: "createContact",
950
926
  value: (function () {
951
927
  var _createContact = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee17(contactInfo) {
952
- var loggerContext, contact, defaultGroupId, requestBody, encryptedContact, _encryptedContact, response, newContact, contactResponse, decryptedContacts, _this$contacts, _this$contacts2, errorInfo, errorStatus;
953
- return _regenerator.default.wrap(function _callee17$(_context18) {
954
- while (1) switch (_context18.prev = _context18.next) {
928
+ var loggerContext, contact, defaultGroupId, requestBody, encryptedContact, _encryptedContact, response, newContact, contactResponse, query, res, resolvedContact, _this$contacts, _this$contacts2, errorInfo, errorStatus;
929
+ return _regenerator.default.wrap(function _callee17$(_context17) {
930
+ while (1) switch (_context17.prev = _context17.next) {
955
931
  case 0:
956
932
  loggerContext = {
957
933
  file: _constants2.CONTACTS_FILE,
958
934
  method: this.createContact.name
959
935
  };
960
936
  _Logger.default.info("Request to create contact: contactType: ".concat(contactInfo.contactType), loggerContext);
961
- _context18.prev = 2;
937
+ _context17.prev = 2;
962
938
  contact = _objectSpread({}, contactInfo);
963
939
  if (contact.encryptionKeyUrl) {
964
- _context18.next = 8;
940
+ _context17.next = 8;
965
941
  break;
966
942
  }
967
- _context18.next = 7;
943
+ _context17.next = 7;
968
944
  return this.fetchEncryptionKeyUrl();
969
945
  case 7:
970
- contact.encryptionKeyUrl = _context18.sent;
946
+ contact.encryptionKeyUrl = _context17.sent;
971
947
  case 8:
972
948
  if (!(!contact.groups || contact.groups.length === 0)) {
973
- _context18.next = 13;
949
+ _context17.next = 13;
974
950
  break;
975
951
  }
976
- _context18.next = 11;
952
+ _context17.next = 11;
977
953
  return this.fetchDefaultGroup();
978
954
  case 11:
979
- defaultGroupId = _context18.sent;
955
+ defaultGroupId = _context17.sent;
980
956
  contact.groups = [defaultGroupId];
981
957
  case 13:
982
958
  contact.schemas = _constants2.CONTACTS_SCHEMA;
983
959
  requestBody = {};
984
- _context18.t0 = contact.contactType;
985
- _context18.next = _context18.t0 === _types2.ContactType.CUSTOM ? 18 : _context18.t0 === _types2.ContactType.CLOUD ? 23 : 30;
960
+ _context17.t0 = contact.contactType;
961
+ _context17.next = _context17.t0 === _types2.ContactType.CUSTOM ? 18 : _context17.t0 === _types2.ContactType.CLOUD ? 23 : 30;
986
962
  break;
987
963
  case 18:
988
- _context18.next = 20;
964
+ _context17.next = 20;
989
965
  return this.encryptContact(contact);
990
966
  case 20:
991
- encryptedContact = _context18.sent;
967
+ encryptedContact = _context17.sent;
992
968
  requestBody = encryptedContact;
993
- return _context18.abrupt("break", 31);
969
+ return _context17.abrupt("break", 31);
994
970
  case 23:
995
971
  if (contact.contactId) {
996
- _context18.next = 25;
972
+ _context17.next = 25;
997
973
  break;
998
974
  }
999
- return _context18.abrupt("return", {
975
+ return _context17.abrupt("return", {
1000
976
  statusCode: 400,
1001
977
  data: {
1002
978
  error: 'contactId is required for contactType:CLOUD.'
@@ -1004,14 +980,14 @@ var ContactsClient = exports.ContactsClient = /*#__PURE__*/function () {
1004
980
  message: _constants.FAILURE_MESSAGE
1005
981
  });
1006
982
  case 25:
1007
- _context18.next = 27;
983
+ _context17.next = 27;
1008
984
  return this.encryptContact(contact);
1009
985
  case 27:
1010
- _encryptedContact = _context18.sent;
986
+ _encryptedContact = _context17.sent;
1011
987
  requestBody = _encryptedContact;
1012
- return _context18.abrupt("break", 31);
988
+ return _context17.abrupt("break", 31);
1013
989
  case 30:
1014
- return _context18.abrupt("return", {
990
+ return _context17.abrupt("return", {
1015
991
  statusCode: 400,
1016
992
  data: {
1017
993
  error: 'Unknown contactType received.'
@@ -1019,7 +995,7 @@ var ContactsClient = exports.ContactsClient = /*#__PURE__*/function () {
1019
995
  message: _constants.FAILURE_MESSAGE
1020
996
  });
1021
997
  case 31:
1022
- _context18.next = 33;
998
+ _context17.next = 33;
1023
999
  return this.webex.request({
1024
1000
  // eslint-disable-next-line no-underscore-dangle
1025
1001
  uri: "".concat(this.webex.internal.services._serviceUrls.contactsService, "/").concat(_constants2.ENCRYPT_FILTER, "/").concat(_constants2.USERS, "/").concat(_constants2.CONTACT_FILTER),
@@ -1027,7 +1003,7 @@ var ContactsClient = exports.ContactsClient = /*#__PURE__*/function () {
1027
1003
  body: requestBody
1028
1004
  });
1029
1005
  case 33:
1030
- response = _context18.sent;
1006
+ response = _context17.sent;
1031
1007
  newContact = response.body;
1032
1008
  contact.contactId = newContact.contactId;
1033
1009
  contactResponse = {
@@ -1037,38 +1013,40 @@ var ContactsClient = exports.ContactsClient = /*#__PURE__*/function () {
1037
1013
  },
1038
1014
  message: _constants.SUCCESS_MESSAGE
1039
1015
  };
1040
- if (!(contact.contactType === _types2.ContactType.CLOUD)) {
1041
- _context18.next = 44;
1016
+ if (!(contact.contactType === _types2.ContactType.CLOUD && newContact.contactId)) {
1017
+ _context17.next = 46;
1042
1018
  break;
1043
1019
  }
1044
- _context18.next = 40;
1045
- return this.fetchContactFromDSS(Object.fromEntries([[newContact.contactId, newContact]]));
1046
- case 40:
1047
- decryptedContacts = _context18.sent;
1048
- if (decryptedContacts.length && decryptedContacts[0]) {
1049
- (_this$contacts = this.contacts) === null || _this$contacts === void 0 ? void 0 : _this$contacts.push(decryptedContacts[0]);
1020
+ query = "".concat(_constants2.SCIM_ID_FILTER, " \"").concat(newContact.contactId, "\"");
1021
+ _context17.next = 41;
1022
+ return (0, _Utils.scimQuery)(query);
1023
+ case 41:
1024
+ res = _context17.sent;
1025
+ resolvedContact = this.resolveCloudContacts(Object.fromEntries([[newContact.contactId, newContact]]), res.body);
1026
+ if (resolvedContact) {
1027
+ (_this$contacts = this.contacts) === null || _this$contacts === void 0 ? void 0 : _this$contacts.push(resolvedContact[0]);
1050
1028
  }
1051
- _context18.next = 45;
1029
+ _context17.next = 47;
1052
1030
  break;
1053
- case 44:
1031
+ case 46:
1054
1032
  (_this$contacts2 = this.contacts) === null || _this$contacts2 === void 0 ? void 0 : _this$contacts2.push(contact);
1055
- case 45:
1056
- return _context18.abrupt("return", contactResponse);
1057
- case 48:
1058
- _context18.prev = 48;
1059
- _context18.t1 = _context18["catch"](2);
1033
+ case 47:
1034
+ return _context17.abrupt("return", contactResponse);
1035
+ case 50:
1036
+ _context17.prev = 50;
1037
+ _context17.t1 = _context17["catch"](2);
1060
1038
  _Logger.default.warn('Failed to create contact.', {
1061
1039
  file: _constants2.CONTACTS_FILE,
1062
1040
  method: this.createContact.name
1063
1041
  });
1064
- errorInfo = _context18.t1;
1042
+ errorInfo = _context17.t1;
1065
1043
  errorStatus = (0, _Utils.serviceErrorCodeHandler)(errorInfo, loggerContext);
1066
- return _context18.abrupt("return", errorStatus);
1067
- case 54:
1044
+ return _context17.abrupt("return", errorStatus);
1045
+ case 56:
1068
1046
  case "end":
1069
- return _context18.stop();
1047
+ return _context17.stop();
1070
1048
  }
1071
- }, _callee17, this, [[2, 48]]);
1049
+ }, _callee17, this, [[2, 50]]);
1072
1050
  }));
1073
1051
  function createContact(_x18) {
1074
1052
  return _createContact.apply(this, arguments);
@@ -1085,23 +1063,23 @@ var ContactsClient = exports.ContactsClient = /*#__PURE__*/function () {
1085
1063
  value: (function () {
1086
1064
  var _deleteContact = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee18(contactId) {
1087
1065
  var loggerContext, _this$contacts3, response, contactResponse, contactToDelete, _this$contacts4, errorInfo, errorStatus;
1088
- return _regenerator.default.wrap(function _callee18$(_context19) {
1089
- while (1) switch (_context19.prev = _context19.next) {
1066
+ return _regenerator.default.wrap(function _callee18$(_context18) {
1067
+ while (1) switch (_context18.prev = _context18.next) {
1090
1068
  case 0:
1091
1069
  loggerContext = {
1092
1070
  file: _constants2.CONTACTS_FILE,
1093
1071
  method: this.deleteContact.name
1094
1072
  };
1095
- _context19.prev = 1;
1073
+ _context18.prev = 1;
1096
1074
  _Logger.default.info("Deleting contact : ".concat(contactId), loggerContext);
1097
- _context19.next = 5;
1075
+ _context18.next = 5;
1098
1076
  return this.webex.request({
1099
1077
  // eslint-disable-next-line no-underscore-dangle
1100
1078
  uri: "".concat(this.webex.internal.services._serviceUrls.contactsService, "/").concat(_constants2.ENCRYPT_FILTER, "/").concat(_constants2.USERS, "/").concat(_constants2.CONTACT_FILTER, "/").concat(contactId),
1101
1079
  method: _types.HTTP_METHODS.DELETE
1102
1080
  });
1103
1081
  case 5:
1104
- response = _context19.sent;
1082
+ response = _context18.sent;
1105
1083
  contactResponse = {
1106
1084
  statusCode: Number(response[_constants.STATUS_CODE]),
1107
1085
  data: {},
@@ -1113,17 +1091,17 @@ var ContactsClient = exports.ContactsClient = /*#__PURE__*/function () {
1113
1091
  if (contactToDelete !== undefined && contactToDelete !== -1) {
1114
1092
  (_this$contacts4 = this.contacts) === null || _this$contacts4 === void 0 ? void 0 : _this$contacts4.splice(contactToDelete, 1);
1115
1093
  }
1116
- return _context19.abrupt("return", contactResponse);
1094
+ return _context18.abrupt("return", contactResponse);
1117
1095
  case 12:
1118
- _context19.prev = 12;
1119
- _context19.t0 = _context19["catch"](1);
1096
+ _context18.prev = 12;
1097
+ _context18.t0 = _context18["catch"](1);
1120
1098
  _Logger.default.warn("Unable to delete contact ".concat(contactId), loggerContext);
1121
- errorInfo = _context19.t0;
1099
+ errorInfo = _context18.t0;
1122
1100
  errorStatus = (0, _Utils.serviceErrorCodeHandler)(errorInfo, loggerContext);
1123
- return _context19.abrupt("return", errorStatus);
1101
+ return _context18.abrupt("return", errorStatus);
1124
1102
  case 18:
1125
1103
  case "end":
1126
- return _context19.stop();
1104
+ return _context18.stop();
1127
1105
  }
1128
1106
  }, _callee18, this, [[1, 12]]);
1129
1107
  }));