@wazo/sdk 0.37.42 → 0.37.43

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 (104) hide show
  1. package/dist/wazo-sdk.js +3 -3
  2. package/esm/__tests__/api-client.test.js +12 -7
  3. package/esm/__tests__/web-rtc-client.test.js +16 -9
  4. package/esm/api/agentd.js +12 -7
  5. package/esm/api/amid.js +12 -7
  6. package/esm/api/application.js +12 -7
  7. package/esm/api/auth.js +12 -7
  8. package/esm/api/call-logd.js +12 -7
  9. package/esm/api/calld.js +12 -7
  10. package/esm/api/chatd.js +12 -7
  11. package/esm/api/confd.js +12 -7
  12. package/esm/api/ctid-ng.js +12 -7
  13. package/esm/api/dird.js +12 -7
  14. package/esm/api/webhookd.js +12 -7
  15. package/esm/api-client.js +12 -7
  16. package/esm/checker/Checker.js +17 -10
  17. package/esm/checker/checks/aor.js +12 -7
  18. package/esm/checker/checks/api.js +12 -7
  19. package/esm/checker/checks/index.js +17 -10
  20. package/esm/checker/checks/wazo-websocket.js +13 -8
  21. package/esm/checker/checks/webrtc-transport.js +16 -9
  22. package/esm/checker/checks/webrtc.js +16 -9
  23. package/esm/domain/AdHocAPIConference.js +12 -7
  24. package/esm/domain/Features.js +12 -7
  25. package/esm/domain/Phone/CTIPhone.js +12 -7
  26. package/esm/domain/Phone/WebRTCPhone.js +12 -7
  27. package/esm/index.js +17 -10
  28. package/esm/lib/WazoSessionDescriptionHandler.js +12 -7
  29. package/esm/service/CallApi.js +12 -7
  30. package/esm/service/IssueReporter.js +12 -7
  31. package/esm/service/__tests__/IssueReporter.test.js +18 -7
  32. package/esm/service/getApiClient.js +12 -7
  33. package/esm/simple/Auth.js +17 -10
  34. package/esm/simple/Configuration.js +17 -10
  35. package/esm/simple/Directory.js +12 -7
  36. package/esm/simple/Phone.js +17 -10
  37. package/esm/simple/Websocket.js +13 -8
  38. package/esm/simple/index.js +17 -10
  39. package/esm/simple/room/LocalParticipant.js +17 -10
  40. package/esm/simple/room/Participant.js +17 -10
  41. package/esm/simple/room/RemoteParticipant.js +17 -10
  42. package/esm/simple/room/Room.js +17 -10
  43. package/esm/simple/room/SipRoom.js +17 -10
  44. package/esm/simple/room/Stream.js +17 -10
  45. package/esm/simple/room/__tests__/RemoteParticipant.test.js +17 -10
  46. package/esm/simple/utils.js +17 -10
  47. package/esm/utils/__tests__/api-requester.test.js +12 -7
  48. package/esm/utils/api-requester.js +12 -7
  49. package/esm/web-rtc-client.js +16 -9
  50. package/esm/websocket-client.js +13 -8
  51. package/lib/__tests__/api-client.test.js +12 -7
  52. package/lib/__tests__/web-rtc-client.test.js +16 -9
  53. package/lib/api/agentd.js +12 -7
  54. package/lib/api/amid.js +12 -7
  55. package/lib/api/application.js +12 -7
  56. package/lib/api/auth.js +12 -7
  57. package/lib/api/call-logd.js +12 -7
  58. package/lib/api/calld.js +12 -7
  59. package/lib/api/chatd.js +12 -7
  60. package/lib/api/confd.js +12 -7
  61. package/lib/api/ctid-ng.js +12 -7
  62. package/lib/api/dird.js +12 -7
  63. package/lib/api/webhookd.js +12 -7
  64. package/lib/api-client.js +12 -7
  65. package/lib/checker/Checker.js +17 -10
  66. package/lib/checker/checks/aor.js +12 -7
  67. package/lib/checker/checks/api.js +12 -7
  68. package/lib/checker/checks/index.js +17 -10
  69. package/lib/checker/checks/wazo-websocket.js +13 -8
  70. package/lib/checker/checks/webrtc-transport.js +16 -9
  71. package/lib/checker/checks/webrtc.js +16 -9
  72. package/lib/domain/AdHocAPIConference.js +12 -7
  73. package/lib/domain/Features.js +12 -7
  74. package/lib/domain/Phone/CTIPhone.js +12 -7
  75. package/lib/domain/Phone/WebRTCPhone.js +12 -7
  76. package/lib/index.js +17 -10
  77. package/lib/lib/WazoSessionDescriptionHandler.js +12 -7
  78. package/lib/service/CallApi.js +12 -7
  79. package/lib/service/IssueReporter.js +12 -7
  80. package/lib/service/__tests__/IssueReporter.test.js +18 -7
  81. package/lib/service/getApiClient.js +12 -7
  82. package/lib/simple/Auth.js +17 -10
  83. package/lib/simple/Configuration.js +17 -10
  84. package/lib/simple/Directory.js +12 -7
  85. package/lib/simple/Phone.js +17 -10
  86. package/lib/simple/Websocket.js +13 -8
  87. package/lib/simple/index.js +17 -10
  88. package/lib/simple/room/LocalParticipant.js +17 -10
  89. package/lib/simple/room/Participant.js +17 -10
  90. package/lib/simple/room/RemoteParticipant.js +17 -10
  91. package/lib/simple/room/Room.js +17 -10
  92. package/lib/simple/room/SipRoom.js +17 -10
  93. package/lib/simple/room/Stream.js +17 -10
  94. package/lib/simple/room/__tests__/RemoteParticipant.test.js +17 -10
  95. package/lib/simple/utils.js +17 -10
  96. package/lib/utils/__tests__/api-requester.test.js +12 -7
  97. package/lib/utils/api-requester.js +12 -7
  98. package/lib/web-rtc-client.js +16 -9
  99. package/lib/websocket-client.js +13 -8
  100. package/package.json +1 -1
  101. package/src/service/IssueReporter.js +12 -7
  102. package/src/service/__tests__/IssueReporter.test.js +6 -0
  103. package/src/web-rtc-client.js +4 -2
  104. package/src/websocket-client.js +1 -1
@@ -398,13 +398,9 @@ class IssueReporter {
398
398
 
399
399
  setTimeout(() => {
400
400
  if (isArray) {
401
- payload = payload.map(message => {
402
- message._retry = retry + 1;
403
- return message;
404
- });
405
- } else {
406
- // $FlowFixMe
407
- payload._retry = retry + 1;
401
+ payload = payload.map(message => this._writeRetryCount(message, retry + 1));
402
+ } else if (payload && typeof payload === 'object') {
403
+ payload = this._writeRetryCount(payload, retry + 1);
408
404
  }
409
405
 
410
406
  this._sendDebugToGrafana(payload, retry + 1);
@@ -412,6 +408,15 @@ class IssueReporter {
412
408
  });
413
409
  }
414
410
 
411
+ _writeRetryCount(message , count ) {
412
+ if (message && typeof message === 'object') {
413
+ // $FlowFixMe
414
+ message._retry = count;
415
+ }
416
+
417
+ return message;
418
+ }
419
+
415
420
  _isLevelAbove(level1 , level2 ) {
416
421
  const index1 = LOG_LEVELS.indexOf(level1);
417
422
  const index2 = LOG_LEVELS.indexOf(level2);
@@ -400,13 +400,9 @@ class IssueReporter {
400
400
 
401
401
  setTimeout(() => {
402
402
  if (isArray) {
403
- payload = payload.map(message => {
404
- message._retry = retry + 1;
405
- return message;
406
- });
407
- } else {
408
- // $FlowFixMe
409
- payload._retry = retry + 1;
403
+ payload = payload.map(message => this._writeRetryCount(message, retry + 1));
404
+ } else if (payload && typeof payload === 'object') {
405
+ payload = this._writeRetryCount(payload, retry + 1);
410
406
  }
411
407
 
412
408
  this._sendDebugToGrafana(payload, retry + 1);
@@ -414,6 +410,15 @@ class IssueReporter {
414
410
  });
415
411
  }
416
412
 
413
+ _writeRetryCount(message , count ) {
414
+ if (message && typeof message === 'object') {
415
+ // $FlowFixMe
416
+ message._retry = count;
417
+ }
418
+
419
+ return message;
420
+ }
421
+
417
422
  _isLevelAbove(level1 , level2 ) {
418
423
  const index1 = LOG_LEVELS.indexOf(level1);
419
424
  const index2 = LOG_LEVELS.indexOf(level2);
@@ -689,13 +689,9 @@ class IssueReporter {
689
689
 
690
690
  setTimeout(() => {
691
691
  if (isArray) {
692
- payload = payload.map(message => {
693
- message._retry = retry + 1;
694
- return message;
695
- });
696
- } else {
697
- // $FlowFixMe
698
- payload._retry = retry + 1;
692
+ payload = payload.map(message => this._writeRetryCount(message, retry + 1));
693
+ } else if (payload && typeof payload === 'object') {
694
+ payload = this._writeRetryCount(payload, retry + 1);
699
695
  }
700
696
 
701
697
  this._sendDebugToGrafana(payload, retry + 1);
@@ -703,6 +699,15 @@ class IssueReporter {
703
699
  });
704
700
  }
705
701
 
702
+ _writeRetryCount(message , count ) {
703
+ if (message && typeof message === 'object') {
704
+ // $FlowFixMe
705
+ message._retry = count;
706
+ }
707
+
708
+ return message;
709
+ }
710
+
706
711
  _isLevelAbove(level1 , level2 ) {
707
712
  const index1 = LOG_LEVELS.indexOf(level1);
708
713
  const index2 = LOG_LEVELS.indexOf(level2);
@@ -6116,8 +6121,10 @@ class WebRTCClient extends Emitter {
6116
6121
  conference: isConference,
6117
6122
  };
6118
6123
 
6119
- // Avoid sdh to created a new stream
6120
- session.sessionDescriptionHandler.localMediaStreamConstraints = options.constraints;
6124
+ // Avoid sdh to create a new stream
6125
+ if (session.sessionDescriptionHandler) {
6126
+ session.sessionDescriptionHandler.localMediaStreamConstraints = options.constraints;
6127
+ }
6121
6128
 
6122
6129
  // Send re-INVITE
6123
6130
  return session.invite(options);
@@ -397,13 +397,9 @@ class IssueReporter {
397
397
 
398
398
  setTimeout(() => {
399
399
  if (isArray) {
400
- payload = payload.map(message => {
401
- message._retry = retry + 1;
402
- return message;
403
- });
404
- } else {
405
- // $FlowFixMe
406
- payload._retry = retry + 1;
400
+ payload = payload.map(message => this._writeRetryCount(message, retry + 1));
401
+ } else if (payload && typeof payload === 'object') {
402
+ payload = this._writeRetryCount(payload, retry + 1);
407
403
  }
408
404
 
409
405
  this._sendDebugToGrafana(payload, retry + 1);
@@ -411,6 +407,15 @@ class IssueReporter {
411
407
  });
412
408
  }
413
409
 
410
+ _writeRetryCount(message , count ) {
411
+ if (message && typeof message === 'object') {
412
+ // $FlowFixMe
413
+ message._retry = count;
414
+ }
415
+
416
+ return message;
417
+ }
418
+
414
419
  _isLevelAbove(level1 , level2 ) {
415
420
  const index1 = LOG_LEVELS.indexOf(level1);
416
421
  const index2 = LOG_LEVELS.indexOf(level2);
@@ -871,7 +876,7 @@ class WebSocketClient extends Emitter {
871
876
  this.close();
872
877
  }
873
878
  const url = `wss://${this.host || ''}/api/websocketd/?token=${this.token || ''}&version=${this.version}`;
874
- logger.log('Wazo WS url computed to reconnect', { url });
879
+ logger.info('Wazo WS url computed to reconnect', { url });
875
880
 
876
881
  return url;
877
882
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wazo/sdk",
3
- "version": "0.37.42",
3
+ "version": "0.37.43",
4
4
  "description": "Wazo's JavaScript Software Development Kit.",
5
5
  "main": "dist/wazo-sdk.js",
6
6
  "author": "Wazo (http://wazo.io)",
@@ -330,13 +330,9 @@ class IssueReporter {
330
330
 
331
331
  setTimeout(() => {
332
332
  if (isArray) {
333
- payload = payload.map(message => {
334
- message._retry = retry + 1;
335
- return message;
336
- });
337
- } else {
338
- // $FlowFixMe
339
- payload._retry = retry + 1;
333
+ payload = payload.map(message => this._writeRetryCount(message, retry + 1));
334
+ } else if (payload && typeof payload === 'object') {
335
+ payload = this._writeRetryCount(payload, retry + 1);
340
336
  }
341
337
 
342
338
  this._sendDebugToGrafana(payload, retry + 1);
@@ -344,6 +340,15 @@ class IssueReporter {
344
340
  });
345
341
  }
346
342
 
343
+ _writeRetryCount(message: string | Object, count: number): string | Object {
344
+ if (message && typeof message === 'object') {
345
+ // $FlowFixMe
346
+ message._retry = count;
347
+ }
348
+
349
+ return message;
350
+ }
351
+
347
352
  _isLevelAbove(level1: string, level2: string) {
348
353
  const index1 = LOG_LEVELS.indexOf(level1);
349
354
  const index2 = LOG_LEVELS.indexOf(level2);
@@ -100,4 +100,10 @@ describe('IssueReporter', () => {
100
100
  expect(IssueReporter.removeSlashes('\"')).toBe("'");
101
101
  expect(IssueReporter.removeSlashes('\\\"')).toBe("'");
102
102
  });
103
+
104
+ it('Add retry count', () => {
105
+ expect(IssueReporter._writeRetryCount('', 1)).toBe('');
106
+ expect(IssueReporter._writeRetryCount('{}', 1)).toBe('{}');
107
+ expect(IssueReporter._writeRetryCount({}, 1)).toEqual({ _retry: 1 });
108
+ });
103
109
  });
@@ -771,8 +771,10 @@ export default class WebRTCClient extends Emitter {
771
771
  conference: isConference,
772
772
  };
773
773
 
774
- // Avoid sdh to created a new stream
775
- session.sessionDescriptionHandler.localMediaStreamConstraints = options.constraints;
774
+ // Avoid sdh to create a new stream
775
+ if (session.sessionDescriptionHandler) {
776
+ session.sessionDescriptionHandler.localMediaStreamConstraints = options.constraints;
777
+ }
776
778
 
777
779
  // Send re-INVITE
778
780
  return session.invite(options);
@@ -356,7 +356,7 @@ class WebSocketClient extends Emitter {
356
356
  this.close();
357
357
  }
358
358
  const url = `wss://${this.host || ''}/api/websocketd/?token=${this.token || ''}&version=${this.version}`;
359
- logger.log('Wazo WS url computed to reconnect', { url });
359
+ logger.info('Wazo WS url computed to reconnect', { url });
360
360
 
361
361
  return url;
362
362
  }