@wazo/sdk 0.37.24 → 0.37.25

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 (94) hide show
  1. package/dist/wazo-sdk.js +6 -6
  2. package/esm/__tests__/api-client.test.js +12 -12
  3. package/esm/__tests__/web-rtc-client.test.js +120 -103
  4. package/esm/api/amid.js +1 -1
  5. package/esm/api/call-logd.js +2 -2
  6. package/esm/api/ctid-ng.js +3 -3
  7. package/esm/api/dird.js +1 -1
  8. package/esm/api/webhookd.js +1 -1
  9. package/esm/api-client.js +12 -12
  10. package/esm/checker/Checker.js +145 -128
  11. package/esm/checker/checks/aor.js +12 -12
  12. package/esm/checker/checks/api.js +12 -12
  13. package/esm/checker/checks/index.js +135 -118
  14. package/esm/checker/checks/wazo-websocket.js +15 -15
  15. package/esm/checker/checks/webrtc-transport.js +120 -103
  16. package/esm/checker/checks/webrtc.js +120 -103
  17. package/esm/domain/AdHocAPIConference.js +12 -12
  18. package/esm/domain/CallLog.js +1 -1
  19. package/esm/domain/Contact.js +1 -1
  20. package/esm/domain/Features.js +12 -12
  21. package/esm/domain/Phone/CTIPhone.js +26 -26
  22. package/esm/domain/Phone/WebRTCPhone.js +87 -86
  23. package/esm/domain/__tests__/CallLog.test.js +1 -1
  24. package/esm/domain/__tests__/Contact.test.js +1 -1
  25. package/esm/index.js +356 -338
  26. package/esm/lib/WazoSessionDescriptionHandler.js +1 -1
  27. package/esm/service/CallApi.js +12 -12
  28. package/esm/service/IssueReporter.js +1 -1
  29. package/esm/service/__tests__/IssueReporter.test.js +1 -1
  30. package/esm/service/getApiClient.js +12 -12
  31. package/esm/simple/Auth.js +346 -328
  32. package/esm/simple/Configuration.js +346 -328
  33. package/esm/simple/Directory.js +12 -12
  34. package/esm/simple/Phone.js +346 -328
  35. package/esm/simple/Websocket.js +17 -17
  36. package/esm/simple/index.js +350 -332
  37. package/esm/simple/room/LocalParticipant.js +350 -332
  38. package/esm/simple/room/Participant.js +350 -332
  39. package/esm/simple/room/RemoteParticipant.js +350 -332
  40. package/esm/simple/room/Room.js +351 -333
  41. package/esm/simple/room/SipRoom.js +350 -332
  42. package/esm/simple/room/Stream.js +350 -332
  43. package/esm/simple/room/__tests__/RemoteParticipant.test.js +350 -332
  44. package/esm/simple/utils.js +350 -332
  45. package/esm/web-rtc-client.js +120 -103
  46. package/esm/websocket-client.js +15 -15
  47. package/lib/__tests__/api-client.test.js +12 -12
  48. package/lib/__tests__/web-rtc-client.test.js +120 -103
  49. package/lib/api/amid.js +1 -1
  50. package/lib/api/call-logd.js +2 -2
  51. package/lib/api/ctid-ng.js +3 -3
  52. package/lib/api/dird.js +1 -1
  53. package/lib/api/webhookd.js +1 -1
  54. package/lib/api-client.js +12 -12
  55. package/lib/checker/Checker.js +145 -128
  56. package/lib/checker/checks/aor.js +12 -12
  57. package/lib/checker/checks/api.js +12 -12
  58. package/lib/checker/checks/index.js +135 -118
  59. package/lib/checker/checks/wazo-websocket.js +15 -15
  60. package/lib/checker/checks/webrtc-transport.js +120 -103
  61. package/lib/checker/checks/webrtc.js +120 -103
  62. package/lib/domain/AdHocAPIConference.js +12 -12
  63. package/lib/domain/CallLog.js +1 -1
  64. package/lib/domain/Contact.js +1 -1
  65. package/lib/domain/Features.js +12 -12
  66. package/lib/domain/Phone/CTIPhone.js +26 -26
  67. package/lib/domain/Phone/WebRTCPhone.js +87 -86
  68. package/lib/domain/__tests__/CallLog.test.js +1 -1
  69. package/lib/domain/__tests__/Contact.test.js +1 -1
  70. package/lib/index.js +356 -338
  71. package/lib/lib/WazoSessionDescriptionHandler.js +1 -1
  72. package/lib/service/CallApi.js +12 -12
  73. package/lib/service/IssueReporter.js +1 -1
  74. package/lib/service/__tests__/IssueReporter.test.js +1 -1
  75. package/lib/service/getApiClient.js +12 -12
  76. package/lib/simple/Auth.js +346 -328
  77. package/lib/simple/Configuration.js +346 -328
  78. package/lib/simple/Directory.js +12 -12
  79. package/lib/simple/Phone.js +346 -328
  80. package/lib/simple/Websocket.js +17 -17
  81. package/lib/simple/index.js +350 -332
  82. package/lib/simple/room/LocalParticipant.js +350 -332
  83. package/lib/simple/room/Participant.js +350 -332
  84. package/lib/simple/room/RemoteParticipant.js +350 -332
  85. package/lib/simple/room/Room.js +351 -333
  86. package/lib/simple/room/SipRoom.js +350 -332
  87. package/lib/simple/room/Stream.js +350 -332
  88. package/lib/simple/room/__tests__/RemoteParticipant.test.js +350 -332
  89. package/lib/simple/utils.js +350 -332
  90. package/lib/web-rtc-client.js +120 -103
  91. package/lib/websocket-client.js +15 -15
  92. package/package.json +1 -1
  93. package/src/domain/Phone/WebRTCPhone.js +3 -2
  94. package/src/web-rtc-client.js +27 -10
@@ -440,7 +440,7 @@ var IssueReporter$1 = new IssueReporter();
440
440
 
441
441
  const methods = ['head', 'get', 'post', 'put', 'delete'];
442
442
 
443
- const logger = IssueReporter$1 ? IssueReporter$1.loggerFor('api') : console;
443
+ const logger$1 = IssueReporter$1 ? IssueReporter$1.loggerFor('api') : console;
444
444
 
445
445
  // Use a function here to be able to mock it in tests
446
446
  const realFetch = () => {
@@ -579,7 +579,7 @@ class ApiRequester {
579
579
  };
580
580
 
581
581
  if (this.refreshTokenPromise) {
582
- logger.info('A token is already refreshing, waiting ...', { url });
582
+ logger$1.info('A token is already refreshing, waiting ...', { url });
583
583
  await this.refreshTokenPromise;
584
584
  }
585
585
 
@@ -599,7 +599,7 @@ class ApiRequester {
599
599
  return promise.then(async (err ) => {
600
600
  // Check if the token is still valid
601
601
  if (firstCall && this._checkTokenExpired(response, err)) {
602
- logger.warn('token expired', { error: err.reason });
602
+ logger$1.warn('token expired', { error: err.reason });
603
603
  // Replay the call after refreshing the token
604
604
  return this._replayWithNewToken(err, path, method, body, headers, parse);
605
605
  }
@@ -609,7 +609,7 @@ class ApiRequester {
609
609
  : exceptionClass.fromResponse(err, response.status);
610
610
 
611
611
  if (this.shouldLogErrors) {
612
- logger.error('API error', error);
612
+ logger$1.error('API error', error);
613
613
  }
614
614
 
615
615
  throw error;
@@ -619,7 +619,7 @@ class ApiRequester {
619
619
  return newParse(response, isJson);
620
620
  }).catch(error => {
621
621
  if (this.shouldLogErrors) {
622
- logger.error('Fetch failed', { url, options, message: error.message, stack: error.stack });
622
+ logger$1.error('Fetch failed', { url, options, message: error.message, stack: error.stack });
623
623
  }
624
624
 
625
625
  throw error;
@@ -647,13 +647,13 @@ class ApiRequester {
647
647
  ) {
648
648
  const isTokenNotFound = this._isTokenNotFound(err);
649
649
  let newPath = path;
650
- logger.info('refreshing token', { inProgress: !!this.refreshTokenPromise });
650
+ logger$1.info('refreshing token', { inProgress: !!this.refreshTokenPromise });
651
651
 
652
652
  this.refreshTokenPromise = this.refreshTokenPromise || this.refreshTokenCallback();
653
653
 
654
654
  return this.refreshTokenPromise.then(() => {
655
655
  this.refreshTokenPromise = null;
656
- logger.info('token refreshed', { isTokenNotFound });
656
+ logger$1.info('token refreshed', { isTokenNotFound });
657
657
  if (isTokenNotFound) {
658
658
  const pathParts = path.split('/');
659
659
  pathParts.pop();
@@ -3595,7 +3595,7 @@ const TRANSFER_FLOW_BLIND = 'blind';
3595
3595
 
3596
3596
  // const MINIMUM_WAZO_ENGINE_VERSION_FOR_CTI_HOLD = '20.11';
3597
3597
 
3598
- const logger$1 = IssueReporter$1 ? IssueReporter$1.loggerFor('cti-phone') : console;
3598
+ IssueReporter$1 ? IssueReporter$1.loggerFor('cti-phone') : console;
3599
3599
 
3600
3600
  /* */
3601
3601
 
@@ -4514,7 +4514,7 @@ const AGENTD_VERSION = '1.0';
4514
4514
  const WEBHOOKD_VERSION = '1.0';
4515
4515
  const AMID_VERSION = '1.0';
4516
4516
 
4517
- const logger$2 = IssueReporter$1 ? IssueReporter$1.loggerFor('api') : console;
4517
+ const logger = IssueReporter$1 ? IssueReporter$1.loggerFor('api') : console;
4518
4518
 
4519
4519
  class ApiClient {
4520
4520
 
@@ -4566,12 +4566,12 @@ class ApiClient {
4566
4566
  }
4567
4567
 
4568
4568
  async forceRefreshToken() {
4569
- logger$2.info('forcing refresh token, calling callback');
4569
+ logger.info('forcing refresh token, calling callback');
4570
4570
  return this.refreshTokenCallback();
4571
4571
  }
4572
4572
 
4573
4573
  async refreshTokenCallback() {
4574
- logger$2.info('refresh token callback called', {
4574
+ logger.info('refresh token callback called', {
4575
4575
  refreshToken: this.refreshToken,
4576
4576
  refreshBackend: this.refreshBackend,
4577
4577
  refreshExpiration: this.refreshExpiration,
@@ -4589,7 +4589,7 @@ class ApiClient {
4589
4589
  this.isMobile,
4590
4590
  );
4591
4591
 
4592
- logger$2.info('token refreshed', { token: session.token });
4592
+ logger.info('token refreshed', { token: session.token });
4593
4593
 
4594
4594
  if (this.onRefreshToken) {
4595
4595
  this.onRefreshToken(session.token, session);
@@ -440,7 +440,7 @@ var IssueReporter$1 = new IssueReporter();
440
440
 
441
441
  const methods = ['head', 'get', 'post', 'put', 'delete'];
442
442
 
443
- const logger = IssueReporter$1 ? IssueReporter$1.loggerFor('api') : console;
443
+ const logger$1 = IssueReporter$1 ? IssueReporter$1.loggerFor('api') : console;
444
444
 
445
445
  // Use a function here to be able to mock it in tests
446
446
  const realFetch = () => {
@@ -579,7 +579,7 @@ class ApiRequester {
579
579
  };
580
580
 
581
581
  if (this.refreshTokenPromise) {
582
- logger.info('A token is already refreshing, waiting ...', { url });
582
+ logger$1.info('A token is already refreshing, waiting ...', { url });
583
583
  await this.refreshTokenPromise;
584
584
  }
585
585
 
@@ -599,7 +599,7 @@ class ApiRequester {
599
599
  return promise.then(async (err ) => {
600
600
  // Check if the token is still valid
601
601
  if (firstCall && this._checkTokenExpired(response, err)) {
602
- logger.warn('token expired', { error: err.reason });
602
+ logger$1.warn('token expired', { error: err.reason });
603
603
  // Replay the call after refreshing the token
604
604
  return this._replayWithNewToken(err, path, method, body, headers, parse);
605
605
  }
@@ -609,7 +609,7 @@ class ApiRequester {
609
609
  : exceptionClass.fromResponse(err, response.status);
610
610
 
611
611
  if (this.shouldLogErrors) {
612
- logger.error('API error', error);
612
+ logger$1.error('API error', error);
613
613
  }
614
614
 
615
615
  throw error;
@@ -619,7 +619,7 @@ class ApiRequester {
619
619
  return newParse(response, isJson);
620
620
  }).catch(error => {
621
621
  if (this.shouldLogErrors) {
622
- logger.error('Fetch failed', { url, options, message: error.message, stack: error.stack });
622
+ logger$1.error('Fetch failed', { url, options, message: error.message, stack: error.stack });
623
623
  }
624
624
 
625
625
  throw error;
@@ -647,13 +647,13 @@ class ApiRequester {
647
647
  ) {
648
648
  const isTokenNotFound = this._isTokenNotFound(err);
649
649
  let newPath = path;
650
- logger.info('refreshing token', { inProgress: !!this.refreshTokenPromise });
650
+ logger$1.info('refreshing token', { inProgress: !!this.refreshTokenPromise });
651
651
 
652
652
  this.refreshTokenPromise = this.refreshTokenPromise || this.refreshTokenCallback();
653
653
 
654
654
  return this.refreshTokenPromise.then(() => {
655
655
  this.refreshTokenPromise = null;
656
- logger.info('token refreshed', { isTokenNotFound });
656
+ logger$1.info('token refreshed', { isTokenNotFound });
657
657
  if (isTokenNotFound) {
658
658
  const pathParts = path.split('/');
659
659
  pathParts.pop();
@@ -3595,7 +3595,7 @@ const TRANSFER_FLOW_BLIND = 'blind';
3595
3595
 
3596
3596
  // const MINIMUM_WAZO_ENGINE_VERSION_FOR_CTI_HOLD = '20.11';
3597
3597
 
3598
- const logger$1 = IssueReporter$1 ? IssueReporter$1.loggerFor('cti-phone') : console;
3598
+ IssueReporter$1 ? IssueReporter$1.loggerFor('cti-phone') : console;
3599
3599
 
3600
3600
  /* */
3601
3601
 
@@ -4514,7 +4514,7 @@ const AGENTD_VERSION = '1.0';
4514
4514
  const WEBHOOKD_VERSION = '1.0';
4515
4515
  const AMID_VERSION = '1.0';
4516
4516
 
4517
- const logger$2 = IssueReporter$1 ? IssueReporter$1.loggerFor('api') : console;
4517
+ const logger = IssueReporter$1 ? IssueReporter$1.loggerFor('api') : console;
4518
4518
 
4519
4519
  class ApiClient {
4520
4520
 
@@ -4566,12 +4566,12 @@ class ApiClient {
4566
4566
  }
4567
4567
 
4568
4568
  async forceRefreshToken() {
4569
- logger$2.info('forcing refresh token, calling callback');
4569
+ logger.info('forcing refresh token, calling callback');
4570
4570
  return this.refreshTokenCallback();
4571
4571
  }
4572
4572
 
4573
4573
  async refreshTokenCallback() {
4574
- logger$2.info('refresh token callback called', {
4574
+ logger.info('refresh token callback called', {
4575
4575
  refreshToken: this.refreshToken,
4576
4576
  refreshBackend: this.refreshBackend,
4577
4577
  refreshExpiration: this.refreshExpiration,
@@ -4589,7 +4589,7 @@ class ApiClient {
4589
4589
  this.isMobile,
4590
4590
  );
4591
4591
 
4592
- logger$2.info('token refreshed', { token: session.token });
4592
+ logger.info('token refreshed', { token: session.token });
4593
4593
 
4594
4594
  if (this.onRefreshToken) {
4595
4595
  this.onRefreshToken(session.token, session);