@webex/calling 3.13.0-next.1 → 3.13.0-next.11

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 (70) hide show
  1. package/README.md +1 -1
  2. package/dist/CallHistory/CallHistory.js +1 -1
  3. package/dist/CallHistory/CallHistory.js.map +1 -1
  4. package/dist/CallHistory/CallHistory.test.js +2 -1
  5. package/dist/CallHistory/CallHistory.test.js.map +1 -1
  6. package/dist/CallQueue/CallQueue.js +1322 -0
  7. package/dist/CallQueue/CallQueue.js.map +1 -0
  8. package/dist/CallQueue/CallQueue.test.js +3321 -0
  9. package/dist/CallQueue/CallQueue.test.js.map +1 -0
  10. package/dist/CallQueue/constants.js +65 -0
  11. package/dist/CallQueue/constants.js.map +1 -0
  12. package/dist/CallQueue/types.js +4 -0
  13. package/dist/CallQueue/types.js.map +1 -0
  14. package/dist/CallQueue/utils.js +370 -0
  15. package/dist/CallQueue/utils.js.map +1 -0
  16. package/dist/CallQueue/utils.test.js +548 -0
  17. package/dist/CallQueue/utils.test.js.map +1 -0
  18. package/dist/CallingClient/constants.js +1 -1
  19. package/dist/CallingClient/constants.js.map +1 -1
  20. package/dist/CallingClient/registration/register.js +2 -2
  21. package/dist/CallingClient/registration/register.js.map +1 -1
  22. package/dist/CallingClient/registration/register.test.js +133 -97
  23. package/dist/CallingClient/registration/register.test.js.map +1 -1
  24. package/dist/Events/types.js +1 -0
  25. package/dist/Events/types.js.map +1 -1
  26. package/dist/SDKConnector/types.js.map +1 -1
  27. package/dist/Voicemail/Voicemail.js +10 -10
  28. package/dist/Voicemail/Voicemail.js.map +1 -1
  29. package/dist/Voicemail/Voicemail.test.js +40 -20
  30. package/dist/Voicemail/Voicemail.test.js.map +1 -1
  31. package/dist/api.js +47 -8
  32. package/dist/api.js.map +1 -1
  33. package/dist/common/Utils.js +8 -7
  34. package/dist/common/Utils.js.map +1 -1
  35. package/dist/common/Utils.test.js +320 -239
  36. package/dist/common/Utils.test.js.map +1 -1
  37. package/dist/index.js +102 -45
  38. package/dist/index.js.map +1 -1
  39. package/dist/module/CallHistory/CallHistory.js +1 -1
  40. package/dist/module/CallQueue/CallQueue.js +718 -0
  41. package/dist/module/CallQueue/constants.js +41 -0
  42. package/dist/module/CallQueue/types.js +1 -0
  43. package/dist/module/CallQueue/utils.js +253 -0
  44. package/dist/module/CallingClient/constants.js +1 -1
  45. package/dist/module/CallingClient/registration/register.js +1 -1
  46. package/dist/module/Events/types.js +1 -0
  47. package/dist/module/Voicemail/Voicemail.js +10 -10
  48. package/dist/module/api.js +5 -2
  49. package/dist/module/common/Utils.js +7 -5
  50. package/dist/module/index.js +4 -1
  51. package/dist/types/CallQueue/CallQueue.d.ts +45 -0
  52. package/dist/types/CallQueue/CallQueue.d.ts.map +1 -0
  53. package/dist/types/CallQueue/constants.d.ts +37 -0
  54. package/dist/types/CallQueue/constants.d.ts.map +1 -0
  55. package/dist/types/CallQueue/types.d.ts +97 -0
  56. package/dist/types/CallQueue/types.d.ts.map +1 -0
  57. package/dist/types/CallQueue/utils.d.ts +19 -0
  58. package/dist/types/CallQueue/utils.d.ts.map +1 -0
  59. package/dist/types/CallingClient/constants.d.ts +1 -1
  60. package/dist/types/CallingClient/constants.d.ts.map +1 -1
  61. package/dist/types/Events/types.d.ts +2 -1
  62. package/dist/types/Events/types.d.ts.map +1 -1
  63. package/dist/types/SDKConnector/types.d.ts +1 -1
  64. package/dist/types/SDKConnector/types.d.ts.map +1 -1
  65. package/dist/types/api.d.ts +8 -4
  66. package/dist/types/api.d.ts.map +1 -1
  67. package/dist/types/common/Utils.d.ts.map +1 -1
  68. package/dist/types/index.d.ts +5 -1
  69. package/dist/types/index.d.ts.map +1 -1
  70. package/package.json +12 -25
@@ -12,6 +12,8 @@ var _stringify = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/
12
12
  var _regenerator = _interopRequireDefault(require("@babel/runtime-corejs2/regenerator"));
13
13
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/defineProperty"));
14
14
  var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/asyncToGenerator"));
15
+ var _fs = _interopRequireDefault(require("fs"));
16
+ var _path = _interopRequireDefault(require("path"));
15
17
  var _uuid = require("uuid");
16
18
  var _calling = require("../CallingClient/calling");
17
19
  var _Errors = require("../Errors");
@@ -40,6 +42,23 @@ var mockEmitterCb = jest.fn();
40
42
  var mockRestoreCb = jest.fn();
41
43
  var mock429RetryCb = jest.fn();
42
44
  var mockSessionSupersededCb = jest.fn();
45
+ var retryAfterCases = [{
46
+ headers: {
47
+ 'retry-after': '120'
48
+ },
49
+ retryAfter: 120
50
+ }, {
51
+ headers: {
52
+ 'Retry-After': '120'
53
+ },
54
+ retryAfter: 120
55
+ }, {
56
+ headers: {
57
+ 'retry-after': '0',
58
+ 'Retry-After': '120'
59
+ },
60
+ retryAfter: 0
61
+ }];
43
62
  var webex = (0, _testUtil.getTestUtilsWebex)();
44
63
  _SDKConnector.default.setWebex(webex);
45
64
  webex.internal.metrics.submitClientMetrics = mockSubmitRegistrationMetric;
@@ -166,41 +185,46 @@ describe('Call Tests - keepalive (handleCallEstablished) cases', function () {
166
185
  }
167
186
  }, _callee2);
168
187
  })));
169
- it('500 during keepalive with retry-after triggers retryCb with interval', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee3() {
170
- var emitted, endSpy, retrySpy, payload;
171
- return _regenerator.default.wrap(function (_context3) {
172
- while (1) switch (_context3.prev = _context3.next) {
173
- case 0:
174
- emitted = false;
175
- endSpy = jest.fn();
176
- retrySpy = jest.fn();
177
- payload = {
178
- statusCode: 500,
179
- headers: {
180
- trackingid: 't',
181
- 'retry-after': 2
182
- },
183
- body: {
184
- device: {
185
- deviceId: 'd'
186
- },
187
- errorCode: 0
188
- }
189
- };
190
- _context3.next = 1;
191
- return (0, _Utils.handleCallErrors)(function () {
192
- emitted = true;
193
- }, _types2.ERROR_LAYER.CALL_CONTROL, retrySpy, dummyCorrelationId, payload, 'handleCallEstablished', logObj.file, endSpy);
194
- case 1:
195
- expect(emitted).toBe(true);
196
- expect(endSpy).not.toHaveBeenCalled();
197
- expect(retrySpy).toHaveBeenCalledWith(2);
198
- case 2:
199
- case "end":
200
- return _context3.stop();
201
- }
202
- }, _callee3);
203
- })));
188
+ it.each(retryAfterCases)('500 keepalive honors $headers', /*#__PURE__*/function () {
189
+ var _ref4 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee3(_ref3) {
190
+ var headers, retryAfter, emitted, endSpy, retrySpy, payload;
191
+ return _regenerator.default.wrap(function (_context3) {
192
+ while (1) switch (_context3.prev = _context3.next) {
193
+ case 0:
194
+ headers = _ref3.headers, retryAfter = _ref3.retryAfter;
195
+ emitted = false;
196
+ endSpy = jest.fn();
197
+ retrySpy = jest.fn();
198
+ payload = {
199
+ statusCode: 500,
200
+ headers: _objectSpread({
201
+ trackingid: 't'
202
+ }, headers),
203
+ body: {
204
+ device: {
205
+ deviceId: 'd'
206
+ },
207
+ errorCode: 0
208
+ }
209
+ };
210
+ _context3.next = 1;
211
+ return (0, _Utils.handleCallErrors)(function () {
212
+ emitted = true;
213
+ }, _types2.ERROR_LAYER.CALL_CONTROL, retrySpy, dummyCorrelationId, payload, 'handleCallEstablished', logObj.file, endSpy);
214
+ case 1:
215
+ expect(emitted).toBe(true);
216
+ expect(endSpy).not.toHaveBeenCalled();
217
+ expect(retrySpy).toBeCalledOnceWith(retryAfter);
218
+ case 2:
219
+ case "end":
220
+ return _context3.stop();
221
+ }
222
+ }, _callee3);
223
+ }));
224
+ return function (_x) {
225
+ return _ref4.apply(this, arguments);
226
+ };
227
+ }());
204
228
  it('500 during keepalive without retry-after triggers retryCb without args', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee4() {
205
229
  var emitted, retrySpy, payload, abort;
206
230
  return _regenerator.default.wrap(function (_context4) {
@@ -268,41 +292,46 @@ describe('Call Tests - keepalive (handleCallEstablished) cases', function () {
268
292
  }
269
293
  }, _callee5);
270
294
  })));
271
- it('503 during keepalive with retry-after does not invoke emitterCb and retries with interval', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee6() {
272
- var emitted, retrySpy, payload, abort;
273
- return _regenerator.default.wrap(function (_context6) {
274
- while (1) switch (_context6.prev = _context6.next) {
275
- case 0:
276
- emitted = false;
277
- retrySpy = jest.fn();
278
- payload = {
279
- statusCode: 503,
280
- headers: {
281
- trackingid: 't',
282
- 'retry-after': 7
283
- },
284
- body: {
285
- device: {
286
- deviceId: 'd'
287
- },
288
- errorCode: 0
289
- }
290
- };
291
- _context6.next = 1;
292
- return (0, _Utils.handleCallErrors)(function () {
293
- emitted = true;
294
- }, _types2.ERROR_LAYER.CALL_CONTROL, retrySpy, dummyCorrelationId, payload, 'handleCallEstablished', logObj.file);
295
- case 1:
296
- abort = _context6.sent;
297
- expect(abort).toBe(false);
298
- expect(emitted).toBe(false);
299
- expect(retrySpy).toHaveBeenCalledWith(7);
300
- case 2:
301
- case "end":
302
- return _context6.stop();
303
- }
304
- }, _callee6);
305
- })));
295
+ it.each(retryAfterCases)('503 keepalive honors $headers', /*#__PURE__*/function () {
296
+ var _ref8 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee6(_ref7) {
297
+ var headers, retryAfter, emitted, retrySpy, payload, abort;
298
+ return _regenerator.default.wrap(function (_context6) {
299
+ while (1) switch (_context6.prev = _context6.next) {
300
+ case 0:
301
+ headers = _ref7.headers, retryAfter = _ref7.retryAfter;
302
+ emitted = false;
303
+ retrySpy = jest.fn();
304
+ payload = {
305
+ statusCode: 503,
306
+ headers: _objectSpread({
307
+ trackingid: 't'
308
+ }, headers),
309
+ body: {
310
+ device: {
311
+ deviceId: 'd'
312
+ },
313
+ errorCode: 0
314
+ }
315
+ };
316
+ _context6.next = 1;
317
+ return (0, _Utils.handleCallErrors)(function () {
318
+ emitted = true;
319
+ }, _types2.ERROR_LAYER.CALL_CONTROL, retrySpy, dummyCorrelationId, payload, 'handleCallEstablished', logObj.file);
320
+ case 1:
321
+ abort = _context6.sent;
322
+ expect(abort).toBe(false);
323
+ expect(emitted).toBe(false);
324
+ expect(retrySpy).toBeCalledOnceWith(retryAfter);
325
+ case 2:
326
+ case "end":
327
+ return _context6.stop();
328
+ }
329
+ }, _callee6);
330
+ }));
331
+ return function (_x2) {
332
+ return _ref8.apply(this, arguments);
333
+ };
334
+ }());
306
335
  it('503 during keepalive without retry-after invokes emitterCb and triggers retryCb without args', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee7() {
307
336
  var emitted, retrySpy, payload, abort;
308
337
  return _regenerator.default.wrap(function (_context7) {
@@ -514,7 +543,7 @@ describe('Registration Tests', function () {
514
543
 
515
544
  /* eslint-disable @typescript-eslint/no-explicit-any */
516
545
  it.each(errorCodes)('%s', /*#__PURE__*/function () {
517
- var _ref8 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee8(codeObj) {
546
+ var _ref0 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee8(codeObj) {
518
547
  var webexPayload, mockErrorEvent, callClientError, result;
519
548
  return _regenerator.default.wrap(function (_context8) {
520
549
  while (1) switch (_context8.prev = _context8.next) {
@@ -587,14 +616,42 @@ describe('Registration Tests', function () {
587
616
  }
588
617
  }, _callee8);
589
618
  }));
590
- return function (_x) {
591
- return _ref8.apply(this, arguments);
619
+ return function (_x3) {
620
+ return _ref0.apply(this, arguments);
592
621
  };
593
622
  }());
594
- it('verify 409 response for a caller that does not handle a superseded session', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee9() {
623
+ it.each(retryAfterCases)('429 honors $headers', /*#__PURE__*/function () {
624
+ var _ref10 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee9(_ref1) {
625
+ var headers, retryAfter, webexPayload;
626
+ return _regenerator.default.wrap(function (_context9) {
627
+ while (1) switch (_context9.prev = _context9.next) {
628
+ case 0:
629
+ headers = _ref1.headers, retryAfter = _ref1.retryAfter;
630
+ webexPayload = {
631
+ statusCode: _types2.ERROR_CODE.TOO_MANY_REQUESTS,
632
+ headers: headers
633
+ };
634
+ _context9.next = 1;
635
+ return (0, _Utils.handleRegistrationErrors)(webexPayload, mockEmitterCb, logObj, {
636
+ retry429Cb: mock429RetryCb
637
+ });
638
+ case 1:
639
+ expect(mock429RetryCb).toBeCalledOnceWith(retryAfter, logObj.method);
640
+ expect(mockEmitterCb).not.toHaveBeenCalled();
641
+ case 2:
642
+ case "end":
643
+ return _context9.stop();
644
+ }
645
+ }, _callee9);
646
+ }));
647
+ return function (_x4) {
648
+ return _ref10.apply(this, arguments);
649
+ };
650
+ }());
651
+ it('verify 409 response for a caller that does not handle a superseded session', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee0() {
595
652
  var webexPayload, result;
596
- return _regenerator.default.wrap(function (_context9) {
597
- while (1) switch (_context9.prev = _context9.next) {
653
+ return _regenerator.default.wrap(function (_context0) {
654
+ while (1) switch (_context0.prev = _context0.next) {
598
655
  case 0:
599
656
  webexPayload = {
600
657
  statusCode: _types2.ERROR_CODE.CONFLICT,
@@ -602,13 +659,13 @@ describe('Registration Tests', function () {
602
659
  trackingid: 'webex-js-sdk_b5812e58-7246-4a9b-bf64-831bdf13b0cd_31'
603
660
  }
604
661
  };
605
- _context9.next = 1;
662
+ _context0.next = 1;
606
663
  return (0, _Utils.handleRegistrationErrors)(webexPayload, mockEmitterCb, logObj, {
607
664
  retry429Cb: mock429RetryCb,
608
665
  restoreRegCb: mockRestoreCb
609
666
  });
610
667
  case 1:
611
- result = _context9.sent;
668
+ result = _context0.sent;
612
669
  expect(result).toStrictEqual({
613
670
  finalError: false,
614
671
  shouldDisconnect: false
@@ -617,9 +674,9 @@ describe('Registration Tests', function () {
617
674
  expect(logSpy).toHaveBeenCalledWith('409 Conflict: ignored, caller does not handle a superseded session', logObj);
618
675
  case 2:
619
676
  case "end":
620
- return _context9.stop();
677
+ return _context0.stop();
621
678
  }
622
- }, _callee9);
679
+ }, _callee0);
623
680
  })));
624
681
  });
625
682
  describe('CallingClient Error Tests', function () {
@@ -631,10 +688,10 @@ describe('CallingClient Error Tests', function () {
631
688
  beforeEach(function () {
632
689
  jest.clearAllMocks();
633
690
  });
634
- it('verify 401 error response for calling client', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee0() {
691
+ it('verify 401 error response for calling client', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee1() {
635
692
  var statusCode, message, errorType, finalError, webexPayload, mockErrorEvent, callClientError, result;
636
- return _regenerator.default.wrap(function (_context0) {
637
- while (1) switch (_context0.prev = _context0.next) {
693
+ return _regenerator.default.wrap(function (_context1) {
694
+ while (1) switch (_context1.prev = _context1.next) {
638
695
  case 0:
639
696
  statusCode = _types2.ERROR_CODE.UNAUTHORIZED;
640
697
  message = 'User is unauthorized due to an expired token.';
@@ -659,24 +716,24 @@ describe('CallingClient Error Tests', function () {
659
716
  context: logObj
660
717
  };
661
718
  callClientError = new _Errors.CallingClientError(mockErrorEvent.message, mockErrorEvent.context, mockErrorEvent.type, _types.RegistrationStatus.ACTIVE);
662
- _context0.next = 1;
719
+ _context1.next = 1;
663
720
  return (0, _Utils.handleCallingClientErrors)(webexPayload, mockEmitterCb, logObj);
664
721
  case 1:
665
- result = _context0.sent;
722
+ result = _context1.sent;
666
723
  expect(mockEmitterCb).toHaveBeenCalledWith(callClientError, finalError);
667
724
  expect(result).toBe(finalError);
668
725
  expect(logSpy).toHaveBeenCalledWith("Status code: -> ".concat(statusCode), logObj);
669
726
  expect(logSpy).toHaveBeenCalledWith('401 Unauthorized', logObj);
670
727
  case 2:
671
728
  case "end":
672
- return _context0.stop();
729
+ return _context1.stop();
673
730
  }
674
- }, _callee0);
731
+ }, _callee1);
675
732
  })));
676
- it('verify 500 error response for calling client', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee1() {
733
+ it('verify 500 error response for calling client', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee10() {
677
734
  var statusCode, message, errorType, finalError, webexPayload, mockErrorEvent, callClientError, result;
678
- return _regenerator.default.wrap(function (_context1) {
679
- while (1) switch (_context1.prev = _context1.next) {
735
+ return _regenerator.default.wrap(function (_context10) {
736
+ while (1) switch (_context10.prev = _context10.next) {
680
737
  case 0:
681
738
  statusCode = _types2.ERROR_CODE.INTERNAL_SERVER_ERROR;
682
739
  message = 'An unknown error occurred while placing the request. Wait a moment and try again.';
@@ -701,24 +758,24 @@ describe('CallingClient Error Tests', function () {
701
758
  context: logObj
702
759
  };
703
760
  callClientError = new _Errors.CallingClientError(mockErrorEvent.message, mockErrorEvent.context, mockErrorEvent.type, _types.RegistrationStatus.ACTIVE);
704
- _context1.next = 1;
761
+ _context10.next = 1;
705
762
  return (0, _Utils.handleCallingClientErrors)(webexPayload, mockEmitterCb, logObj);
706
763
  case 1:
707
- result = _context1.sent;
764
+ result = _context10.sent;
708
765
  expect(mockEmitterCb).toHaveBeenCalledWith(callClientError, finalError);
709
766
  expect(result).toBe(finalError);
710
767
  expect(logSpy).toHaveBeenCalledWith("Status code: -> ".concat(statusCode), logObj);
711
768
  expect(logSpy).toHaveBeenCalledWith('500 Internal Server Error', logObj);
712
769
  case 2:
713
770
  case "end":
714
- return _context1.stop();
771
+ return _context10.stop();
715
772
  }
716
- }, _callee1);
773
+ }, _callee10);
717
774
  })));
718
- it('verify unknown error response for calling client', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee10() {
775
+ it('verify unknown error response for calling client', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee11() {
719
776
  var statusCode, message, errorType, finalError, webexPayload, mockErrorEvent, callClientError, result;
720
- return _regenerator.default.wrap(function (_context10) {
721
- while (1) switch (_context10.prev = _context10.next) {
777
+ return _regenerator.default.wrap(function (_context11) {
778
+ while (1) switch (_context11.prev = _context11.next) {
722
779
  case 0:
723
780
  statusCode = 206;
724
781
  message = 'Unknown error';
@@ -743,19 +800,19 @@ describe('CallingClient Error Tests', function () {
743
800
  context: logObj
744
801
  };
745
802
  callClientError = new _Errors.CallingClientError(mockErrorEvent.message, mockErrorEvent.context, mockErrorEvent.type, _types.RegistrationStatus.ACTIVE);
746
- _context10.next = 1;
803
+ _context11.next = 1;
747
804
  return (0, _Utils.handleCallingClientErrors)(webexPayload, mockEmitterCb, logObj);
748
805
  case 1:
749
- result = _context10.sent;
806
+ result = _context11.sent;
750
807
  expect(mockEmitterCb).toHaveBeenCalledWith(callClientError, finalError);
751
808
  expect(result).toBe(finalError);
752
809
  expect(logSpy).toHaveBeenCalledWith("Status code: -> ".concat(statusCode), logObj);
753
810
  expect(logSpy).toHaveBeenCalledWith('Unknown Error', logObj);
754
811
  case 2:
755
812
  case "end":
756
- return _context10.stop();
813
+ return _context11.stop();
757
814
  }
758
- }, _callee10);
815
+ }, _callee11);
759
816
  })));
760
817
  });
761
818
  describe('Call Tests', function () {
@@ -1303,11 +1360,11 @@ describe('resolveContact tests', function () {
1303
1360
  }));
1304
1361
  });
1305
1362
  });
1306
- it('Resolve by userExternalId - SCIM exception', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee11() {
1363
+ it('Resolve by userExternalId - SCIM exception', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee12() {
1307
1364
  var _callingPartyInfo$use2;
1308
1365
  var callingPartyInfo, warnSpy, webexSpy, displayInfo, query;
1309
- return _regenerator.default.wrap(function (_context11) {
1310
- while (1) switch (_context11.prev = _context11.next) {
1366
+ return _regenerator.default.wrap(function (_context12) {
1367
+ while (1) switch (_context12.prev = _context12.next) {
1311
1368
  case 0:
1312
1369
  callingPartyInfo = {};
1313
1370
  warnSpy = jest.spyOn(_Logger.default, 'warn');
@@ -1317,10 +1374,10 @@ describe('resolveContact tests', function () {
1317
1374
  callingPartyInfo.userExternalId = {
1318
1375
  $: 'userExternalId'
1319
1376
  };
1320
- _context11.next = 1;
1377
+ _context12.next = 1;
1321
1378
  return (0, _Utils.resolveContact)(callingPartyInfo);
1322
1379
  case 1:
1323
- displayInfo = _context11.sent;
1380
+ displayInfo = _context12.sent;
1324
1381
  expect(displayInfo === null || displayInfo === void 0 ? void 0 : displayInfo.name).toBeUndefined();
1325
1382
  expect(warnSpy).toHaveBeenCalledWith('Error response: - 500', {
1326
1383
  file: _constants.UTILS_FILE,
@@ -1332,15 +1389,15 @@ describe('resolveContact tests', function () {
1332
1389
  }));
1333
1390
  case 2:
1334
1391
  case "end":
1335
- return _context11.stop();
1392
+ return _context12.stop();
1336
1393
  }
1337
- }, _callee11);
1394
+ }, _callee12);
1338
1395
  })));
1339
- it('Resolve by userExternalId - totalResults zero', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee12() {
1396
+ it('Resolve by userExternalId - totalResults zero', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee13() {
1340
1397
  var _callingPartyInfo$use3;
1341
1398
  var callingPartyInfo, scimResponse, webexSpy, displayInfo, query;
1342
- return _regenerator.default.wrap(function (_context12) {
1343
- while (1) switch (_context12.prev = _context12.next) {
1399
+ return _regenerator.default.wrap(function (_context13) {
1400
+ while (1) switch (_context13.prev = _context13.next) {
1344
1401
  case 0:
1345
1402
  callingPartyInfo = {};
1346
1403
  scimResponse = (0, _testUtil.getSampleScimResponse)();
@@ -1352,10 +1409,10 @@ describe('resolveContact tests', function () {
1352
1409
  callingPartyInfo.userExternalId = {
1353
1410
  $: 'userExternalId'
1354
1411
  };
1355
- _context12.next = 1;
1412
+ _context13.next = 1;
1356
1413
  return (0, _Utils.resolveContact)(callingPartyInfo);
1357
1414
  case 1:
1358
- displayInfo = _context12.sent;
1415
+ displayInfo = _context13.sent;
1359
1416
  query = scimUrl + encodeURIComponent("id eq \"".concat((_callingPartyInfo$use3 = callingPartyInfo.userExternalId) === null || _callingPartyInfo$use3 === void 0 ? void 0 : _callingPartyInfo$use3.$, "\""));
1360
1417
  expect(displayInfo === null || displayInfo === void 0 ? void 0 : displayInfo.name).toBeUndefined();
1361
1418
  expect(webexSpy).toBeCalledOnceWith(expect.objectContaining({
@@ -1364,15 +1421,15 @@ describe('resolveContact tests', function () {
1364
1421
  scimResponse.totalResults = '1';
1365
1422
  case 2:
1366
1423
  case "end":
1367
- return _context12.stop();
1424
+ return _context13.stop();
1368
1425
  }
1369
- }, _callee12);
1426
+ }, _callee13);
1370
1427
  })));
1371
- it('Resolve by userExternalId - no primary number and no phone numbers', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee13() {
1428
+ it('Resolve by userExternalId - no primary number and no phone numbers', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee14() {
1372
1429
  var _callingPartyInfo$use4, _displayInfo, _displayInfo2;
1373
1430
  var callingPartyInfo, scimResponse, webexSpy, displayInfo, query, phoneNumbers;
1374
- return _regenerator.default.wrap(function (_context13) {
1375
- while (1) switch (_context13.prev = _context13.next) {
1431
+ return _regenerator.default.wrap(function (_context14) {
1432
+ while (1) switch (_context14.prev = _context14.next) {
1376
1433
  case 0:
1377
1434
  callingPartyInfo = {};
1378
1435
  scimResponse = (0, _testUtil.getSampleScimResponse)();
@@ -1384,10 +1441,10 @@ describe('resolveContact tests', function () {
1384
1441
  callingPartyInfo.userExternalId = {
1385
1442
  $: 'userExternalId'
1386
1443
  };
1387
- _context13.next = 1;
1444
+ _context14.next = 1;
1388
1445
  return (0, _Utils.resolveContact)(callingPartyInfo);
1389
1446
  case 1:
1390
- displayInfo = _context13.sent;
1447
+ displayInfo = _context14.sent;
1391
1448
  query = scimUrl + encodeURIComponent("id eq \"".concat((_callingPartyInfo$use4 = callingPartyInfo.userExternalId) === null || _callingPartyInfo$use4 === void 0 ? void 0 : _callingPartyInfo$use4.$, "\""));
1392
1449
  expect(webexSpy).toBeCalledOnceWith(expect.objectContaining({
1393
1450
  uri: query
@@ -1403,10 +1460,10 @@ describe('resolveContact tests', function () {
1403
1460
  statusCode: 200,
1404
1461
  body: scimResponse
1405
1462
  });
1406
- _context13.next = 2;
1463
+ _context14.next = 2;
1407
1464
  return (0, _Utils.resolveContact)(callingPartyInfo);
1408
1465
  case 2:
1409
- displayInfo = _context13.sent;
1466
+ displayInfo = _context14.sent;
1410
1467
  expect((_displayInfo2 = displayInfo) === null || _displayInfo2 === void 0 ? void 0 : _displayInfo2.num).toBeUndefined();
1411
1468
  expect(webexSpy).toBeCalledOnceWith(expect.objectContaining({
1412
1469
  uri: query
@@ -1414,9 +1471,9 @@ describe('resolveContact tests', function () {
1414
1471
  scimResponse.Resources[0].phoneNumbers = phoneNumbers;
1415
1472
  case 3:
1416
1473
  case "end":
1417
- return _context13.stop();
1474
+ return _context14.stop();
1418
1475
  }
1419
- }, _callee13);
1476
+ }, _callee14);
1420
1477
  })));
1421
1478
  it('Resolve by userExternalId - no photo', function () {
1422
1479
  var callingPartyInfo = {};
@@ -1441,10 +1498,10 @@ describe('resolveContact tests', function () {
1441
1498
  }));
1442
1499
  });
1443
1500
  });
1444
- it('resolveContact escapes SCIM filter injection in userExternalId', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee14() {
1501
+ it('resolveContact escapes SCIM filter injection in userExternalId', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee15() {
1445
1502
  var callingPartyInfo, injectionPayload, webexSpy, escapedValue, expectedQuery;
1446
- return _regenerator.default.wrap(function (_context14) {
1447
- while (1) switch (_context14.prev = _context14.next) {
1503
+ return _regenerator.default.wrap(function (_context15) {
1504
+ while (1) switch (_context15.prev = _context15.next) {
1448
1505
  case 0:
1449
1506
  callingPartyInfo = {};
1450
1507
  injectionPayload = 'x" or userName pr "';
@@ -1455,7 +1512,7 @@ describe('resolveContact tests', function () {
1455
1512
  callingPartyInfo.userExternalId = {
1456
1513
  $: injectionPayload
1457
1514
  };
1458
- _context14.next = 1;
1515
+ _context15.next = 1;
1459
1516
  return (0, _Utils.resolveContact)(callingPartyInfo);
1460
1517
  case 1:
1461
1518
  // After escaping: backslash → \\ then double-quote → \"
@@ -1466,14 +1523,14 @@ describe('resolveContact tests', function () {
1466
1523
  }));
1467
1524
  case 2:
1468
1525
  case "end":
1469
- return _context14.stop();
1526
+ return _context15.stop();
1470
1527
  }
1471
- }, _callee14);
1528
+ }, _callee15);
1472
1529
  })));
1473
- it('legitimate externalId still resolves', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee15() {
1530
+ it('legitimate externalId still resolves', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee16() {
1474
1531
  var callingPartyInfo, legitimateId, webexSpy, expectedQuery;
1475
- return _regenerator.default.wrap(function (_context15) {
1476
- while (1) switch (_context15.prev = _context15.next) {
1532
+ return _regenerator.default.wrap(function (_context16) {
1533
+ while (1) switch (_context16.prev = _context16.next) {
1477
1534
  case 0:
1478
1535
  callingPartyInfo = {};
1479
1536
  legitimateId = '69fde5ad-fb8b-4a1b-9998-b0999e95719b';
@@ -1484,7 +1541,7 @@ describe('resolveContact tests', function () {
1484
1541
  callingPartyInfo.userExternalId = {
1485
1542
  $: legitimateId
1486
1543
  };
1487
- _context15.next = 1;
1544
+ _context16.next = 1;
1488
1545
  return (0, _Utils.resolveContact)(callingPartyInfo);
1489
1546
  case 1:
1490
1547
  // A UUID contains no SCIM metacharacters; the query string is unchanged
@@ -1494,9 +1551,9 @@ describe('resolveContact tests', function () {
1494
1551
  }));
1495
1552
  case 2:
1496
1553
  case "end":
1497
- return _context15.stop();
1554
+ return _context16.stop();
1498
1555
  }
1499
- }, _callee15);
1556
+ }, _callee16);
1500
1557
  })));
1501
1558
  it('Resolve with minimal response from SCIM', function () {
1502
1559
  var callingPartyInfo = {};
@@ -1538,10 +1595,10 @@ describe('resolveContact tests', function () {
1538
1595
  }));
1539
1596
  });
1540
1597
  });
1541
- it('Resolve by name - Empty Info', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee16() {
1598
+ it('Resolve by name - Empty Info', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee17() {
1542
1599
  var callingPartyInfo, peopleListResponse, items, webexSpy, displayInfo;
1543
- return _regenerator.default.wrap(function (_context16) {
1544
- while (1) switch (_context16.prev = _context16.next) {
1600
+ return _regenerator.default.wrap(function (_context17) {
1601
+ while (1) switch (_context17.prev = _context17.next) {
1545
1602
  case 0:
1546
1603
  callingPartyInfo = {};
1547
1604
  peopleListResponse = (0, _testUtil.getSamplePeopleListResponse)();
@@ -1551,10 +1608,10 @@ describe('resolveContact tests', function () {
1551
1608
  callingPartyInfo.name = {
1552
1609
  $: 'Name'
1553
1610
  };
1554
- _context16.next = 1;
1611
+ _context17.next = 1;
1555
1612
  return (0, _Utils.resolveContact)(callingPartyInfo);
1556
1613
  case 1:
1557
- displayInfo = _context16.sent;
1614
+ displayInfo = _context17.sent;
1558
1615
  expect(displayInfo === null || displayInfo === void 0 ? void 0 : displayInfo.name).toBeUndefined();
1559
1616
  expect(webexSpy).toBeCalledOnceWith(expect.objectContaining({
1560
1617
  displayName: 'Name'
@@ -1562,15 +1619,15 @@ describe('resolveContact tests', function () {
1562
1619
  peopleListResponse.items = items;
1563
1620
  case 2:
1564
1621
  case "end":
1565
- return _context16.stop();
1622
+ return _context17.stop();
1566
1623
  }
1567
- }, _callee16);
1624
+ }, _callee17);
1568
1625
  })));
1569
- it('Resolve by name - ID as plain UUID instead of part of URI', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee17() {
1626
+ it('Resolve by name - ID as plain UUID instead of part of URI', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee18() {
1570
1627
  var _displayInfo3, _displayInfo4, _displayInfo5, _displayInfo6, _displayInfo7, _displayInfo8;
1571
1628
  var callingPartyInfo, peopleListResponse, id, webexSpy, displayInfo;
1572
- return _regenerator.default.wrap(function (_context17) {
1573
- while (1) switch (_context17.prev = _context17.next) {
1629
+ return _regenerator.default.wrap(function (_context18) {
1630
+ while (1) switch (_context18.prev = _context18.next) {
1574
1631
  case 0:
1575
1632
  callingPartyInfo = {};
1576
1633
  peopleListResponse = (0, _testUtil.getSamplePeopleListResponse)();
@@ -1581,10 +1638,10 @@ describe('resolveContact tests', function () {
1581
1638
  callingPartyInfo.name = {
1582
1639
  $: 'Name'
1583
1640
  };
1584
- _context17.next = 1;
1641
+ _context18.next = 1;
1585
1642
  return (0, _Utils.resolveContact)(callingPartyInfo);
1586
1643
  case 1:
1587
- displayInfo = _context17.sent;
1644
+ displayInfo = _context18.sent;
1588
1645
  expect(webexSpy).toBeCalledOnceWith(expect.objectContaining({
1589
1646
  displayName: 'Name'
1590
1647
  }));
@@ -1597,10 +1654,10 @@ describe('resolveContact tests', function () {
1597
1654
  /* Also test empty id */
1598
1655
  peopleListResponse.items[0].id = '';
1599
1656
  webex.people.list.mockResolvedValueOnce(peopleListResponse);
1600
- _context17.next = 2;
1657
+ _context18.next = 2;
1601
1658
  return (0, _Utils.resolveContact)(callingPartyInfo);
1602
1659
  case 2:
1603
- displayInfo = _context17.sent;
1660
+ displayInfo = _context18.sent;
1604
1661
  expect((_displayInfo7 = displayInfo) === null || _displayInfo7 === void 0 ? void 0 : _displayInfo7.id).toStrictEqual('');
1605
1662
  expect((_displayInfo8 = displayInfo) === null || _displayInfo8 === void 0 ? void 0 : _displayInfo8.name).toStrictEqual(peopleListResponse.items[0].displayName);
1606
1663
  expect(webexSpy).toBeCalledOnceWith(expect.objectContaining({
@@ -1609,14 +1666,14 @@ describe('resolveContact tests', function () {
1609
1666
  peopleListResponse.items[0].id = id;
1610
1667
  case 3:
1611
1668
  case "end":
1612
- return _context17.stop();
1669
+ return _context18.stop();
1613
1670
  }
1614
- }, _callee17);
1671
+ }, _callee18);
1615
1672
  })));
1616
- it('Resolve by name - Phone numbers no match for type - work', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee18() {
1673
+ it('Resolve by name - Phone numbers no match for type - work', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee19() {
1617
1674
  var callingPartyInfo, peopleListResponse, phoneNumbers, webexSpy, displayInfo;
1618
- return _regenerator.default.wrap(function (_context18) {
1619
- while (1) switch (_context18.prev = _context18.next) {
1675
+ return _regenerator.default.wrap(function (_context19) {
1676
+ while (1) switch (_context19.prev = _context19.next) {
1620
1677
  case 0:
1621
1678
  callingPartyInfo = {};
1622
1679
  peopleListResponse = (0, _testUtil.getSamplePeopleListResponse)();
@@ -1627,10 +1684,10 @@ describe('resolveContact tests', function () {
1627
1684
  callingPartyInfo.name = {
1628
1685
  $: 'Name'
1629
1686
  };
1630
- _context18.next = 1;
1687
+ _context19.next = 1;
1631
1688
  return (0, _Utils.resolveContact)(callingPartyInfo);
1632
1689
  case 1:
1633
- displayInfo = _context18.sent;
1690
+ displayInfo = _context19.sent;
1634
1691
  expect(displayInfo === null || displayInfo === void 0 ? void 0 : displayInfo.name).toStrictEqual(peopleListResponse.items[0].displayName);
1635
1692
  expect(displayInfo === null || displayInfo === void 0 ? void 0 : displayInfo.num).toStrictEqual(peopleListResponse.items[0].phoneNumbers[0].value);
1636
1693
  expect(displayInfo === null || displayInfo === void 0 ? void 0 : displayInfo.avatarSrc).toStrictEqual(peopleListResponse.items[0].avatar);
@@ -1640,14 +1697,14 @@ describe('resolveContact tests', function () {
1640
1697
  peopleListResponse.items[0].phoneNumbers = phoneNumbers;
1641
1698
  case 2:
1642
1699
  case "end":
1643
- return _context18.stop();
1700
+ return _context19.stop();
1644
1701
  }
1645
- }, _callee18);
1702
+ }, _callee19);
1646
1703
  })));
1647
- it('Resolve by name - Phone numbers empty', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee19() {
1704
+ it('Resolve by name - Phone numbers empty', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee20() {
1648
1705
  var callingPartyInfo, peopleListResponse, phoneNumbers, webexSpy, displayInfo;
1649
- return _regenerator.default.wrap(function (_context19) {
1650
- while (1) switch (_context19.prev = _context19.next) {
1706
+ return _regenerator.default.wrap(function (_context20) {
1707
+ while (1) switch (_context20.prev = _context20.next) {
1651
1708
  case 0:
1652
1709
  callingPartyInfo = {};
1653
1710
  peopleListResponse = (0, _testUtil.getSamplePeopleListResponse)();
@@ -1657,10 +1714,10 @@ describe('resolveContact tests', function () {
1657
1714
  callingPartyInfo.name = {
1658
1715
  $: 'Name'
1659
1716
  };
1660
- _context19.next = 1;
1717
+ _context20.next = 1;
1661
1718
  return (0, _Utils.resolveContact)(callingPartyInfo);
1662
1719
  case 1:
1663
- displayInfo = _context19.sent;
1720
+ displayInfo = _context20.sent;
1664
1721
  expect(webexSpy).toBeCalledOnceWith(expect.objectContaining({
1665
1722
  displayName: 'Name'
1666
1723
  }));
@@ -1670,9 +1727,9 @@ describe('resolveContact tests', function () {
1670
1727
  peopleListResponse.items[0].phoneNumbers = phoneNumbers;
1671
1728
  case 2:
1672
1729
  case "end":
1673
- return _context19.stop();
1730
+ return _context20.stop();
1674
1731
  }
1675
- }, _callee19);
1732
+ }, _callee20);
1676
1733
  })));
1677
1734
  });
1678
1735
  describe('Store and Fetch voicemail tests', function () {
@@ -1699,6 +1756,30 @@ describe('Store and Fetch voicemail tests', function () {
1699
1756
  return vmListStorage[key];
1700
1757
  });
1701
1758
  });
1759
+ it('storeVoicemailList/fetchVoicemailList JSDoc omits encrypted/decrypted labeling', function () {
1760
+ var utilsSource = _fs.default.readFileSync(_path.default.resolve(__dirname, 'Utils.ts'), 'utf8');
1761
+ var extractJsDoc = function extractJsDoc(functionName) {
1762
+ var exportIndex = utilsSource.indexOf("export function ".concat(functionName, "("));
1763
+ if (exportIndex === -1) {
1764
+ return '';
1765
+ }
1766
+ var beforeExport = utilsSource.slice(0, exportIndex);
1767
+ var jsDocStart = beforeExport.lastIndexOf('/**');
1768
+ var jsDocEnd = beforeExport.lastIndexOf('*/');
1769
+ if (jsDocStart === -1 || jsDocEnd === -1 || jsDocEnd < jsDocStart) {
1770
+ return '';
1771
+ }
1772
+ return beforeExport.slice(jsDocStart, jsDocEnd + 2);
1773
+ };
1774
+ var storeJsDoc = extractJsDoc('storeVoicemailList');
1775
+ var fetchJsDoc = extractJsDoc('fetchVoicemailList');
1776
+ expect(storeJsDoc).not.toEqual('');
1777
+ expect(fetchJsDoc).not.toEqual('');
1778
+ expect(storeJsDoc.toLowerCase()).not.toContain('encrypted');
1779
+ expect(storeJsDoc.toLowerCase()).not.toContain('decrypted');
1780
+ expect(fetchJsDoc.toLowerCase()).not.toContain('encrypted');
1781
+ expect(fetchJsDoc.toLowerCase()).not.toContain('decrypted');
1782
+ });
1702
1783
  it('verify saving Voicemails in session storage', function () {
1703
1784
  var voicemailList = _voicemailFixture.getVoicemailListJsonWXC.body.VoiceMessagingMessages.messageInfoList.messageInfo;
1704
1785
  (0, _Utils.storeVoicemailList)(dummyContext, voicemailList);
@@ -1790,40 +1871,40 @@ describe('Infer id from UUID Tests', function () {
1790
1871
  });
1791
1872
  });
1792
1873
  describe('Get endpoint by CALLING_BACKEND tests', function () {
1793
- it('verify invalid calling backend ucm for xsi endpoint', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee20() {
1874
+ it('verify invalid calling backend ucm for xsi endpoint', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee21() {
1794
1875
  var _t;
1795
- return _regenerator.default.wrap(function (_context20) {
1796
- while (1) switch (_context20.prev = _context20.next) {
1876
+ return _regenerator.default.wrap(function (_context21) {
1877
+ while (1) switch (_context21.prev = _context21.next) {
1797
1878
  case 0:
1798
1879
  _t = expect;
1799
- _context20.next = 1;
1880
+ _context21.next = 1;
1800
1881
  return (0, _Utils.getXsiActionEndpoint)(webex, {
1801
1882
  file: 'testFile',
1802
1883
  method: 'testMethod'
1803
1884
  }, _types.CALLING_BACKEND.UCM);
1804
1885
  case 1:
1805
- _t(_context20.sent).toBeInstanceOf(Error);
1886
+ _t(_context21.sent).toBeInstanceOf(Error);
1806
1887
  case 2:
1807
1888
  case "end":
1808
- return _context20.stop();
1889
+ return _context21.stop();
1809
1890
  }
1810
- }, _callee20);
1891
+ }, _callee21);
1811
1892
  })));
1812
- it('verify invalid calling backend wxc for vg endpoint', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee21() {
1893
+ it('verify invalid calling backend wxc for vg endpoint', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee22() {
1813
1894
  var _t2;
1814
- return _regenerator.default.wrap(function (_context21) {
1815
- while (1) switch (_context21.prev = _context21.next) {
1895
+ return _regenerator.default.wrap(function (_context22) {
1896
+ while (1) switch (_context22.prev = _context22.next) {
1816
1897
  case 0:
1817
1898
  _t2 = expect;
1818
- _context21.next = 1;
1899
+ _context22.next = 1;
1819
1900
  return (0, _Utils.getVgActionEndpoint)(webex, _types.CALLING_BACKEND.WXC);
1820
1901
  case 1:
1821
- _t2(_context21.sent).toBeInstanceOf(Error);
1902
+ _t2(_context22.sent).toBeInstanceOf(Error);
1822
1903
  case 2:
1823
1904
  case "end":
1824
- return _context21.stop();
1905
+ return _context22.stop();
1825
1906
  }
1826
- }, _callee21);
1907
+ }, _callee22);
1827
1908
  })));
1828
1909
  });
1829
1910
  describe('Get XSI Action Endpoint tests', function () {
@@ -1845,10 +1926,10 @@ describe('Get XSI Action Endpoint tests', function () {
1845
1926
  beforeEach(function () {
1846
1927
  mockWebex.request.mockClear();
1847
1928
  });
1848
- it('should return xsiEndpoint for WXC backend using _serviceUrls.hydra', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee22() {
1929
+ it('should return xsiEndpoint for WXC backend using _serviceUrls.hydra', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee23() {
1849
1930
  var hydraEndpoint, wxcWebex, result;
1850
- return _regenerator.default.wrap(function (_context22) {
1851
- while (1) switch (_context22.prev = _context22.next) {
1931
+ return _regenerator.default.wrap(function (_context23) {
1932
+ while (1) switch (_context23.prev = _context23.next) {
1852
1933
  case 0:
1853
1934
  hydraEndpoint = 'https://hydra-a.wbx2.com/v1/';
1854
1935
  wxcWebex = {
@@ -1868,10 +1949,10 @@ describe('Get XSI Action Endpoint tests', function () {
1868
1949
  }
1869
1950
  }
1870
1951
  };
1871
- _context22.next = 1;
1952
+ _context23.next = 1;
1872
1953
  return (0, _Utils.getXsiActionEndpoint)(wxcWebex, loggerContext, _types.CALLING_BACKEND.WXC);
1873
1954
  case 1:
1874
- result = _context22.sent;
1955
+ result = _context23.sent;
1875
1956
  expect(wxcWebex.request).toBeCalledOnceWith({
1876
1957
  method: _types.HTTP_METHODS.GET,
1877
1958
  uri: "".concat(hydraEndpoint, "/").concat(_constants2.XSI_ACTION_ENDPOINT_ORG_URL_PARAM)
@@ -1880,14 +1961,14 @@ describe('Get XSI Action Endpoint tests', function () {
1880
1961
  expect(wxcWebex.internal.services.get).not.toHaveBeenCalled();
1881
1962
  case 2:
1882
1963
  case "end":
1883
- return _context22.stop();
1964
+ return _context23.stop();
1884
1965
  }
1885
- }, _callee22);
1966
+ }, _callee23);
1886
1967
  })));
1887
- it('should return xsiEndpoint for WXC backend using services.get when _serviceUrls is undefined', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee23() {
1968
+ it('should return xsiEndpoint for WXC backend using services.get when _serviceUrls is undefined', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee24() {
1888
1969
  var hydraEndpoint, activeHydraCluster, wxcWebex, result;
1889
- return _regenerator.default.wrap(function (_context23) {
1890
- while (1) switch (_context23.prev = _context23.next) {
1970
+ return _regenerator.default.wrap(function (_context24) {
1971
+ while (1) switch (_context24.prev = _context24.next) {
1891
1972
  case 0:
1892
1973
  hydraEndpoint = 'https://hydra-a.wbx2.com/v1/';
1893
1974
  activeHydraCluster = 'urn:TEAM:us-east-2_a:hydra';
@@ -1906,10 +1987,10 @@ describe('Get XSI Action Endpoint tests', function () {
1906
1987
  }
1907
1988
  }
1908
1989
  };
1909
- _context23.next = 1;
1990
+ _context24.next = 1;
1910
1991
  return (0, _Utils.getXsiActionEndpoint)(wxcWebex, loggerContext, _types.CALLING_BACKEND.WXC);
1911
1992
  case 1:
1912
- result = _context23.sent;
1993
+ result = _context24.sent;
1913
1994
  expect(wxcWebex.internal.services.get).toBeCalledOnceWith(activeHydraCluster);
1914
1995
  expect(wxcWebex.request).toBeCalledOnceWith({
1915
1996
  method: _types.HTTP_METHODS.GET,
@@ -1918,14 +1999,14 @@ describe('Get XSI Action Endpoint tests', function () {
1918
1999
  expect(result).toBe(expectedXsiEndpoint);
1919
2000
  case 2:
1920
2001
  case "end":
1921
- return _context23.stop();
2002
+ return _context24.stop();
1922
2003
  }
1923
- }, _callee23);
2004
+ }, _callee24);
1924
2005
  })));
1925
- it('should return xsiEndpoint for BWRKS backend when URL ends with /v2.0', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee24() {
2006
+ it('should return xsiEndpoint for BWRKS backend when URL ends with /v2.0', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee25() {
1926
2007
  var mockResponse, xsiEndpoint;
1927
- return _regenerator.default.wrap(function (_context24) {
1928
- while (1) switch (_context24.prev = _context24.next) {
2008
+ return _regenerator.default.wrap(function (_context25) {
2009
+ while (1) switch (_context25.prev = _context25.next) {
1929
2010
  case 0:
1930
2011
  mockResponse = {
1931
2012
  body: {
@@ -1937,22 +2018,22 @@ describe('Get XSI Action Endpoint tests', function () {
1937
2018
  }
1938
2019
  };
1939
2020
  mockWebex.request.mockResolvedValue(mockResponse);
1940
- _context24.next = 1;
2021
+ _context25.next = 1;
1941
2022
  return (0, _Utils.getXsiActionEndpoint)(mockWebex, loggerContext, _types.CALLING_BACKEND.BWRKS);
1942
2023
  case 1:
1943
- xsiEndpoint = _context24.sent;
2024
+ xsiEndpoint = _context25.sent;
1944
2025
  expect(mockWebex.request).toHaveBeenCalledTimes(1);
1945
2026
  expect(xsiEndpoint).toBe('https://fake-broadworks-url.com');
1946
2027
  case 2:
1947
2028
  case "end":
1948
- return _context24.stop();
2029
+ return _context25.stop();
1949
2030
  }
1950
- }, _callee24);
2031
+ }, _callee25);
1951
2032
  })));
1952
- it('should return xsiEndpoint for BWRKS backend when URL ends with /v2.0/', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee25() {
2033
+ it('should return xsiEndpoint for BWRKS backend when URL ends with /v2.0/', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee26() {
1953
2034
  var mockResponse, xsiEndpoint;
1954
- return _regenerator.default.wrap(function (_context25) {
1955
- while (1) switch (_context25.prev = _context25.next) {
2035
+ return _regenerator.default.wrap(function (_context26) {
2036
+ while (1) switch (_context26.prev = _context26.next) {
1956
2037
  case 0:
1957
2038
  mockResponse = {
1958
2039
  body: {
@@ -1964,22 +2045,22 @@ describe('Get XSI Action Endpoint tests', function () {
1964
2045
  }
1965
2046
  };
1966
2047
  mockWebex.request.mockResolvedValue(mockResponse);
1967
- _context25.next = 1;
2048
+ _context26.next = 1;
1968
2049
  return (0, _Utils.getXsiActionEndpoint)(mockWebex, loggerContext, _types.CALLING_BACKEND.BWRKS);
1969
2050
  case 1:
1970
- xsiEndpoint = _context25.sent;
2051
+ xsiEndpoint = _context26.sent;
1971
2052
  expect(mockWebex.request).toHaveBeenCalledTimes(1);
1972
2053
  expect(xsiEndpoint).toBe('https://fake-broadworks-url.com');
1973
2054
  case 2:
1974
2055
  case "end":
1975
- return _context25.stop();
2056
+ return _context26.stop();
1976
2057
  }
1977
- }, _callee25);
2058
+ }, _callee26);
1978
2059
  })));
1979
- it('should return xsiEndpoint for BWRKS backend when URL does not end with any version', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee26() {
2060
+ it('should return xsiEndpoint for BWRKS backend when URL does not end with any version', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee27() {
1980
2061
  var mockResponse, xsiEndpoint;
1981
- return _regenerator.default.wrap(function (_context26) {
1982
- while (1) switch (_context26.prev = _context26.next) {
2062
+ return _regenerator.default.wrap(function (_context27) {
2063
+ while (1) switch (_context27.prev = _context27.next) {
1983
2064
  case 0:
1984
2065
  mockResponse = {
1985
2066
  body: {
@@ -1991,17 +2072,17 @@ describe('Get XSI Action Endpoint tests', function () {
1991
2072
  }
1992
2073
  };
1993
2074
  mockWebex.request.mockResolvedValue(mockResponse);
1994
- _context26.next = 1;
2075
+ _context27.next = 1;
1995
2076
  return (0, _Utils.getXsiActionEndpoint)(mockWebex, loggerContext, _types.CALLING_BACKEND.BWRKS);
1996
2077
  case 1:
1997
- xsiEndpoint = _context26.sent;
2078
+ xsiEndpoint = _context27.sent;
1998
2079
  expect(mockWebex.request).toHaveBeenCalledTimes(1);
1999
2080
  expect(xsiEndpoint).toBe('https://fake-broadworks-url.com');
2000
2081
  case 2:
2001
2082
  case "end":
2002
- return _context26.stop();
2083
+ return _context27.stop();
2003
2084
  }
2004
- }, _callee26);
2085
+ }, _callee27);
2005
2086
  })));
2006
2087
  });
2007
2088
  describe('uploadLogs', function () {
@@ -2023,19 +2104,19 @@ describe('uploadLogs', function () {
2023
2104
  afterEach(function () {
2024
2105
  jest.clearAllMocks();
2025
2106
  });
2026
- it('should upload logs and return the response', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee27() {
2107
+ it('should upload logs and return the response', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee28() {
2027
2108
  var mockMetaData, logSpy, result;
2028
- return _regenerator.default.wrap(function (_context27) {
2029
- while (1) switch (_context27.prev = _context27.next) {
2109
+ return _regenerator.default.wrap(function (_context28) {
2110
+ while (1) switch (_context28.prev = _context28.next) {
2030
2111
  case 0:
2031
2112
  mockMetaData = {
2032
2113
  correlationId: 'test-correlation'
2033
2114
  };
2034
2115
  logSpy = jest.spyOn(_Logger.default, 'info');
2035
- _context27.next = 1;
2116
+ _context28.next = 1;
2036
2117
  return (0, _Utils.uploadLogs)(mockMetaData, true);
2037
2118
  case 1:
2038
- result = _context27.sent;
2119
+ result = _context28.sent;
2039
2120
  expect(result).toEqual({
2040
2121
  trackingid: '1234',
2041
2122
  feedbackId: 'mocked-uuid-12345'
@@ -2068,14 +2149,14 @@ describe('uploadLogs', function () {
2068
2149
  });
2069
2150
  case 2:
2070
2151
  case "end":
2071
- return _context27.stop();
2152
+ return _context28.stop();
2072
2153
  }
2073
- }, _callee27);
2154
+ }, _callee28);
2074
2155
  })));
2075
- it('should log and throw an error if the upload fails', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee28() {
2156
+ it('should log and throw an error if the upload fails', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee29() {
2076
2157
  var mockMetaData, mockError, logSpy, _t3;
2077
- return _regenerator.default.wrap(function (_context28) {
2078
- while (1) switch (_context28.prev = _context28.next) {
2158
+ return _regenerator.default.wrap(function (_context29) {
2159
+ while (1) switch (_context29.prev = _context29.next) {
2079
2160
  case 0:
2080
2161
  mockMetaData = {
2081
2162
  correlationId: 'test-correlation'
@@ -2083,17 +2164,17 @@ describe('uploadLogs', function () {
2083
2164
  mockError = new Error('Upload failed'); // Mock the submitLogs to fail
2084
2165
  submitLogsMock.mockRejectedValueOnce(mockError);
2085
2166
  logSpy = jest.spyOn(_Logger.default, 'error');
2086
- _context28.prev = 1;
2087
- _context28.next = 2;
2167
+ _context29.prev = 1;
2168
+ _context29.next = 2;
2088
2169
  return (0, _Utils.uploadLogs)(mockMetaData, true);
2089
2170
  case 2:
2090
2171
  // If we get here, the test should fail since we expected an exception
2091
2172
  expect(true).toBe(false); // This will fail the test if no exception is thrown
2092
- _context28.next = 4;
2173
+ _context29.next = 4;
2093
2174
  break;
2094
2175
  case 3:
2095
- _context28.prev = 3;
2096
- _t3 = _context28["catch"](1);
2176
+ _context29.prev = 3;
2177
+ _t3 = _context29["catch"](1);
2097
2178
  expect(_t3).toBe(mockError);
2098
2179
  expect(logSpy).toHaveBeenCalledWith("Failed to upload Logs ".concat((0, _stringify.default)(_t3)), {
2099
2180
  file: _constants.UTILS_FILE,
@@ -2120,14 +2201,14 @@ describe('uploadLogs', function () {
2120
2201
  });
2121
2202
  case 4:
2122
2203
  case "end":
2123
- return _context28.stop();
2204
+ return _context29.stop();
2124
2205
  }
2125
- }, _callee28, null, [[1, 3]]);
2206
+ }, _callee29, null, [[1, 3]]);
2126
2207
  })));
2127
- it('should log error and not throw an error if the upload fails with throw exception false', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee29() {
2208
+ it('should log error and not throw an error if the upload fails with throw exception false', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee30() {
2128
2209
  var mockMetaData, mockError, logSpy, result;
2129
- return _regenerator.default.wrap(function (_context29) {
2130
- while (1) switch (_context29.prev = _context29.next) {
2210
+ return _regenerator.default.wrap(function (_context30) {
2211
+ while (1) switch (_context30.prev = _context30.next) {
2131
2212
  case 0:
2132
2213
  mockMetaData = {
2133
2214
  correlationId: 'test-correlation',
@@ -2136,10 +2217,10 @@ describe('uploadLogs', function () {
2136
2217
  mockError = new Error('Upload failed'); // Mock the submitLogs to fail
2137
2218
  submitLogsMock.mockRejectedValueOnce(mockError);
2138
2219
  logSpy = jest.spyOn(_Logger.default, 'error');
2139
- _context29.next = 1;
2220
+ _context30.next = 1;
2140
2221
  return (0, _Utils.uploadLogs)(mockMetaData, false);
2141
2222
  case 1:
2142
- result = _context29.sent;
2223
+ result = _context30.sent;
2143
2224
  expect(result).toBeUndefined();
2144
2225
  expect(logSpy).toHaveBeenCalledWith("Failed to upload Logs ".concat((0, _stringify.default)(mockError)), {
2145
2226
  file: _constants.UTILS_FILE,
@@ -2166,9 +2247,9 @@ describe('uploadLogs', function () {
2166
2247
  });
2167
2248
  case 2:
2168
2249
  case "end":
2169
- return _context29.stop();
2250
+ return _context30.stop();
2170
2251
  }
2171
- }, _callee29);
2252
+ }, _callee30);
2172
2253
  })));
2173
2254
  });
2174
2255
  describe('resolveCallingBackend', function () {