@wazo/sdk 0.37.41 → 0.38.0

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 (112) hide show
  1. package/dist/wazo-sdk.js +3 -3
  2. package/esm/__tests__/api-client.test.js +45 -22
  3. package/esm/__tests__/web-rtc-client.test.js +49 -24
  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 +16 -8
  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 +14 -7
  13. package/esm/api/dird.js +12 -7
  14. package/esm/api/webhookd.js +12 -7
  15. package/esm/api-client.js +45 -22
  16. package/esm/checker/Checker.js +50 -25
  17. package/esm/checker/checks/aor.js +45 -22
  18. package/esm/checker/checks/api.js +45 -22
  19. package/esm/checker/checks/index.js +50 -25
  20. package/esm/checker/checks/wazo-websocket.js +13 -8
  21. package/esm/checker/checks/webrtc-transport.js +49 -24
  22. package/esm/checker/checks/webrtc.js +49 -24
  23. package/esm/domain/AdHocAPIConference.js +54 -23
  24. package/esm/domain/Features.js +54 -23
  25. package/esm/domain/Phone/CTIPhone.js +54 -23
  26. package/esm/domain/Phone/WebRTCPhone.js +14 -7
  27. package/esm/index.js +233 -25
  28. package/esm/lib/WazoSessionDescriptionHandler.js +12 -7
  29. package/esm/service/CallApi.js +54 -23
  30. package/esm/service/IssueReporter.js +12 -7
  31. package/esm/service/__tests__/IssueReporter.test.js +18 -7
  32. package/esm/service/getApiClient.js +63 -24
  33. package/esm/simple/Auth.js +233 -25
  34. package/esm/simple/Configuration.js +233 -25
  35. package/esm/simple/Directory.js +54 -23
  36. package/esm/simple/Phone.js +233 -25
  37. package/esm/simple/Softphone.js +148 -0
  38. package/esm/simple/Websocket.js +13 -8
  39. package/esm/simple/index.js +233 -25
  40. package/esm/simple/room/LocalParticipant.js +233 -25
  41. package/esm/simple/room/Participant.js +233 -25
  42. package/esm/simple/room/RemoteParticipant.js +233 -25
  43. package/esm/simple/room/Room.js +233 -25
  44. package/esm/simple/room/SipRoom.js +233 -25
  45. package/esm/simple/room/Stream.js +233 -25
  46. package/esm/simple/room/__tests__/RemoteParticipant.test.js +233 -25
  47. package/esm/simple/utils.js +233 -25
  48. package/esm/utils/__tests__/api-requester.test.js +12 -7
  49. package/esm/utils/api-requester.js +12 -7
  50. package/esm/web-rtc-client.js +49 -24
  51. package/esm/websocket-client.js +13 -8
  52. package/lib/__tests__/api-client.test.js +45 -22
  53. package/lib/__tests__/web-rtc-client.test.js +49 -24
  54. package/lib/api/agentd.js +12 -7
  55. package/lib/api/amid.js +12 -7
  56. package/lib/api/application.js +12 -7
  57. package/lib/api/auth.js +16 -8
  58. package/lib/api/call-logd.js +12 -7
  59. package/lib/api/calld.js +12 -7
  60. package/lib/api/chatd.js +12 -7
  61. package/lib/api/confd.js +12 -7
  62. package/lib/api/ctid-ng.js +14 -7
  63. package/lib/api/dird.js +12 -7
  64. package/lib/api/webhookd.js +12 -7
  65. package/lib/api-client.js +45 -22
  66. package/lib/checker/Checker.js +50 -25
  67. package/lib/checker/checks/aor.js +45 -22
  68. package/lib/checker/checks/api.js +45 -22
  69. package/lib/checker/checks/index.js +50 -25
  70. package/lib/checker/checks/wazo-websocket.js +13 -8
  71. package/lib/checker/checks/webrtc-transport.js +49 -24
  72. package/lib/checker/checks/webrtc.js +49 -24
  73. package/lib/domain/AdHocAPIConference.js +54 -23
  74. package/lib/domain/Features.js +54 -23
  75. package/lib/domain/Phone/CTIPhone.js +54 -23
  76. package/lib/domain/Phone/WebRTCPhone.js +14 -7
  77. package/lib/index.js +233 -25
  78. package/lib/lib/WazoSessionDescriptionHandler.js +12 -7
  79. package/lib/service/CallApi.js +54 -23
  80. package/lib/service/IssueReporter.js +12 -7
  81. package/lib/service/__tests__/IssueReporter.test.js +18 -7
  82. package/lib/service/getApiClient.js +64 -23
  83. package/lib/simple/Auth.js +233 -25
  84. package/lib/simple/Configuration.js +233 -25
  85. package/lib/simple/Directory.js +54 -23
  86. package/lib/simple/Phone.js +233 -25
  87. package/lib/simple/Softphone.js +150 -0
  88. package/lib/simple/Websocket.js +13 -8
  89. package/lib/simple/index.js +233 -25
  90. package/lib/simple/room/LocalParticipant.js +233 -25
  91. package/lib/simple/room/Participant.js +233 -25
  92. package/lib/simple/room/RemoteParticipant.js +233 -25
  93. package/lib/simple/room/Room.js +233 -25
  94. package/lib/simple/room/SipRoom.js +233 -25
  95. package/lib/simple/room/Stream.js +233 -25
  96. package/lib/simple/room/__tests__/RemoteParticipant.test.js +233 -25
  97. package/lib/simple/utils.js +233 -25
  98. package/lib/utils/__tests__/api-requester.test.js +12 -7
  99. package/lib/utils/api-requester.js +12 -7
  100. package/lib/web-rtc-client.js +49 -24
  101. package/lib/websocket-client.js +13 -8
  102. package/package.json +1 -1
  103. package/src/api/auth.js +4 -1
  104. package/src/api-client.js +26 -13
  105. package/src/service/IssueReporter.js +12 -7
  106. package/src/service/__tests__/IssueReporter.test.js +6 -0
  107. package/src/service/getApiClient.js +19 -1
  108. package/src/simple/Auth.js +21 -0
  109. package/src/simple/Softphone.js +148 -0
  110. package/src/simple/index.js +2 -0
  111. package/src/web-rtc-client.js +4 -2
  112. package/src/websocket-client.js +1 -1
@@ -396,13 +396,9 @@ class IssueReporter {
396
396
 
397
397
  setTimeout(() => {
398
398
  if (isArray) {
399
- payload = payload.map(message => {
400
- message._retry = retry + 1;
401
- return message;
402
- });
403
- } else {
404
- // $FlowFixMe
405
- payload._retry = retry + 1;
399
+ payload = payload.map(message => this._writeRetryCount(message, retry + 1));
400
+ } else if (payload && typeof payload === 'object') {
401
+ payload = this._writeRetryCount(payload, retry + 1);
406
402
  }
407
403
 
408
404
  this._sendDebugToGrafana(payload, retry + 1);
@@ -410,6 +406,15 @@ class IssueReporter {
410
406
  });
411
407
  }
412
408
 
409
+ _writeRetryCount(message , count ) {
410
+ if (message && typeof message === 'object') {
411
+ // $FlowFixMe
412
+ message._retry = count;
413
+ }
414
+
415
+ return message;
416
+ }
417
+
413
418
  _isLevelAbove(level1 , level2 ) {
414
419
  const index1 = LOG_LEVELS.indexOf(level1);
415
420
  const index2 = LOG_LEVELS.indexOf(level2);
@@ -2245,9 +2250,12 @@ var authMethods = (client , baseUrl ) => ({
2245
2250
  expiration: expiration || DETAULT_EXPIRATION,
2246
2251
  refresh_token: refreshToken,
2247
2252
  client_id: client.clientId,
2248
- tenant_id: tenantId,
2249
2253
  };
2250
2254
 
2255
+ if (tenantId) {
2256
+ body.tenant_id = tenantId;
2257
+ }
2258
+
2251
2259
  const headers = {
2252
2260
  'Content-Type': 'application/json',
2253
2261
  ...(isMobile ? { 'Wazo-Session-Type': 'mobile' } : {}),
@@ -3535,7 +3543,9 @@ global.wazoClients = global.wazoClients || {};
3535
3543
  global.wazoClientId = global.wazoClientId || {};
3536
3544
  global.wazoClientToken = global.wazoClientToken || {};
3537
3545
  global.wazoRefreshToken = global.wazoRefreshToken || {};
3546
+ global.wazoRefreshTenantId = global.wazoRefreshTenantId || {};
3538
3547
  global.wazoOnRefreshToken = global.wazoOnRefreshToken || {};
3548
+ global.wazoOnRefreshTokenError = global.wazoOnRefreshTokenError || {};
3539
3549
  global.wazoRefreshExpiration = global.wazoRefreshExpiration || {};
3540
3550
  global.wazoRefreshBackend = global.wazoRefreshBackend || {};
3541
3551
  global.wazoIsMobile = global.wazoIsMobile || {};
@@ -4581,6 +4591,7 @@ class ApiClient {
4581
4591
 
4582
4592
 
4583
4593
 
4594
+
4584
4595
 
4585
4596
 
4586
4597
 
@@ -4633,23 +4644,31 @@ class ApiClient {
4633
4644
  return null;
4634
4645
  }
4635
4646
 
4636
- const session = await this.auth.refreshToken(
4637
- this.refreshToken,
4638
- this.refreshBackend,
4639
- this.refreshExpiration,
4640
- this.isMobile,
4641
- this.refreshTenantId,
4642
- );
4643
-
4644
- logger.info('token refreshed', { token: session.token });
4647
+ try {
4648
+ const session = await this.auth.refreshToken(
4649
+ this.refreshToken,
4650
+ this.refreshBackend,
4651
+ this.refreshExpiration,
4652
+ this.isMobile,
4653
+ this.refreshTenantId,
4654
+ );
4655
+
4656
+ logger.info('token refreshed', { token: session.token });
4657
+
4658
+ if (this.onRefreshToken) {
4659
+ this.onRefreshToken(session.token, session);
4660
+ }
4645
4661
 
4646
- if (this.onRefreshToken) {
4647
- this.onRefreshToken(session.token, session);
4648
- }
4662
+ this.setToken(session.token);
4649
4663
 
4650
- this.setToken(session.token);
4664
+ return session.token;
4665
+ } catch (error) {
4666
+ logger.error('token refresh, error', error);
4651
4667
 
4652
- return session.token;
4668
+ if (this.onRefreshTokenError) {
4669
+ this.onRefreshTokenError(error);
4670
+ }
4671
+ }
4653
4672
  }
4654
4673
 
4655
4674
  setToken(token ) {
@@ -4672,6 +4691,10 @@ class ApiClient {
4672
4691
  this.onRefreshToken = onRefreshToken;
4673
4692
  }
4674
4693
 
4694
+ setOnRefreshTokenError(callback ) {
4695
+ this.onRefreshTokenError = callback;
4696
+ }
4697
+
4675
4698
  setRefreshExpiration(refreshExpiration ) {
4676
4699
  this.refreshExpiration = refreshExpiration;
4677
4700
  }
@@ -678,13 +678,9 @@ class IssueReporter {
678
678
 
679
679
  setTimeout(() => {
680
680
  if (isArray) {
681
- payload = payload.map(message => {
682
- message._retry = retry + 1;
683
- return message;
684
- });
685
- } else {
686
- // $FlowFixMe
687
- payload._retry = retry + 1;
681
+ payload = payload.map(message => this._writeRetryCount(message, retry + 1));
682
+ } else if (payload && typeof payload === 'object') {
683
+ payload = this._writeRetryCount(payload, retry + 1);
688
684
  }
689
685
 
690
686
  this._sendDebugToGrafana(payload, retry + 1);
@@ -692,6 +688,15 @@ class IssueReporter {
692
688
  });
693
689
  }
694
690
 
691
+ _writeRetryCount(message , count ) {
692
+ if (message && typeof message === 'object') {
693
+ // $FlowFixMe
694
+ message._retry = count;
695
+ }
696
+
697
+ return message;
698
+ }
699
+
695
700
  _isLevelAbove(level1 , level2 ) {
696
701
  const index1 = LOG_LEVELS.indexOf(level1);
697
702
  const index2 = LOG_LEVELS.indexOf(level2);
@@ -2793,9 +2798,12 @@ var authMethods = (client , baseUrl ) => ({
2793
2798
  expiration: expiration || DETAULT_EXPIRATION,
2794
2799
  refresh_token: refreshToken,
2795
2800
  client_id: client.clientId,
2796
- tenant_id: tenantId,
2797
2801
  };
2798
2802
 
2803
+ if (tenantId) {
2804
+ body.tenant_id = tenantId;
2805
+ }
2806
+
2799
2807
  const headers = {
2800
2808
  'Content-Type': 'application/json',
2801
2809
  ...(isMobile ? { 'Wazo-Session-Type': 'mobile' } : {}),
@@ -4083,7 +4091,9 @@ global.wazoClients = global.wazoClients || {};
4083
4091
  global.wazoClientId = global.wazoClientId || {};
4084
4092
  global.wazoClientToken = global.wazoClientToken || {};
4085
4093
  global.wazoRefreshToken = global.wazoRefreshToken || {};
4094
+ global.wazoRefreshTenantId = global.wazoRefreshTenantId || {};
4086
4095
  global.wazoOnRefreshToken = global.wazoOnRefreshToken || {};
4096
+ global.wazoOnRefreshTokenError = global.wazoOnRefreshTokenError || {};
4087
4097
  global.wazoRefreshExpiration = global.wazoRefreshExpiration || {};
4088
4098
  global.wazoRefreshBackend = global.wazoRefreshBackend || {};
4089
4099
  global.wazoIsMobile = global.wazoIsMobile || {};
@@ -5129,6 +5139,7 @@ class ApiClient {
5129
5139
 
5130
5140
 
5131
5141
 
5142
+
5132
5143
 
5133
5144
 
5134
5145
 
@@ -5181,23 +5192,31 @@ class ApiClient {
5181
5192
  return null;
5182
5193
  }
5183
5194
 
5184
- const session = await this.auth.refreshToken(
5185
- this.refreshToken,
5186
- this.refreshBackend,
5187
- this.refreshExpiration,
5188
- this.isMobile,
5189
- this.refreshTenantId,
5190
- );
5191
-
5192
- logger$1.info('token refreshed', { token: session.token });
5195
+ try {
5196
+ const session = await this.auth.refreshToken(
5197
+ this.refreshToken,
5198
+ this.refreshBackend,
5199
+ this.refreshExpiration,
5200
+ this.isMobile,
5201
+ this.refreshTenantId,
5202
+ );
5203
+
5204
+ logger$1.info('token refreshed', { token: session.token });
5205
+
5206
+ if (this.onRefreshToken) {
5207
+ this.onRefreshToken(session.token, session);
5208
+ }
5193
5209
 
5194
- if (this.onRefreshToken) {
5195
- this.onRefreshToken(session.token, session);
5196
- }
5210
+ this.setToken(session.token);
5197
5211
 
5198
- this.setToken(session.token);
5212
+ return session.token;
5213
+ } catch (error) {
5214
+ logger$1.error('token refresh, error', error);
5199
5215
 
5200
- return session.token;
5216
+ if (this.onRefreshTokenError) {
5217
+ this.onRefreshTokenError(error);
5218
+ }
5219
+ }
5201
5220
  }
5202
5221
 
5203
5222
  setToken(token ) {
@@ -5220,6 +5239,10 @@ class ApiClient {
5220
5239
  this.onRefreshToken = onRefreshToken;
5221
5240
  }
5222
5241
 
5242
+ setOnRefreshTokenError(callback ) {
5243
+ this.onRefreshTokenError = callback;
5244
+ }
5245
+
5223
5246
  setRefreshExpiration(refreshExpiration ) {
5224
5247
  this.refreshExpiration = refreshExpiration;
5225
5248
  }
@@ -6084,8 +6107,10 @@ class WebRTCClient extends Emitter {
6084
6107
  conference: isConference,
6085
6108
  };
6086
6109
 
6087
- // Avoid sdh to created a new stream
6088
- session.sessionDescriptionHandler.localMediaStreamConstraints = options.constraints;
6110
+ // Avoid sdh to create a new stream
6111
+ if (session.sessionDescriptionHandler) {
6112
+ session.sessionDescriptionHandler.localMediaStreamConstraints = options.constraints;
6113
+ }
6089
6114
 
6090
6115
  // Send re-INVITE
6091
6116
  return session.invite(options);
package/esm/api/agentd.js CHANGED
@@ -392,13 +392,9 @@ class IssueReporter {
392
392
 
393
393
  setTimeout(() => {
394
394
  if (isArray) {
395
- payload = payload.map(message => {
396
- message._retry = retry + 1;
397
- return message;
398
- });
399
- } else {
400
- // $FlowFixMe
401
- payload._retry = retry + 1;
395
+ payload = payload.map(message => this._writeRetryCount(message, retry + 1));
396
+ } else if (payload && typeof payload === 'object') {
397
+ payload = this._writeRetryCount(payload, retry + 1);
402
398
  }
403
399
 
404
400
  this._sendDebugToGrafana(payload, retry + 1);
@@ -406,6 +402,15 @@ class IssueReporter {
406
402
  });
407
403
  }
408
404
 
405
+ _writeRetryCount(message , count ) {
406
+ if (message && typeof message === 'object') {
407
+ // $FlowFixMe
408
+ message._retry = count;
409
+ }
410
+
411
+ return message;
412
+ }
413
+
409
414
  _isLevelAbove(level1 , level2 ) {
410
415
  const index1 = LOG_LEVELS.indexOf(level1);
411
416
  const index2 = LOG_LEVELS.indexOf(level2);
package/esm/api/amid.js CHANGED
@@ -331,13 +331,9 @@ class IssueReporter {
331
331
 
332
332
  setTimeout(() => {
333
333
  if (isArray) {
334
- payload = payload.map(message => {
335
- message._retry = retry + 1;
336
- return message;
337
- });
338
- } else {
339
- // $FlowFixMe
340
- payload._retry = retry + 1;
334
+ payload = payload.map(message => this._writeRetryCount(message, retry + 1));
335
+ } else if (payload && typeof payload === 'object') {
336
+ payload = this._writeRetryCount(payload, retry + 1);
341
337
  }
342
338
 
343
339
  this._sendDebugToGrafana(payload, retry + 1);
@@ -345,6 +341,15 @@ class IssueReporter {
345
341
  });
346
342
  }
347
343
 
344
+ _writeRetryCount(message , count ) {
345
+ if (message && typeof message === 'object') {
346
+ // $FlowFixMe
347
+ message._retry = count;
348
+ }
349
+
350
+ return message;
351
+ }
352
+
348
353
  _isLevelAbove(level1 , level2 ) {
349
354
  const index1 = LOG_LEVELS.indexOf(level1);
350
355
  const index2 = LOG_LEVELS.indexOf(level2);
@@ -392,13 +392,9 @@ class IssueReporter {
392
392
 
393
393
  setTimeout(() => {
394
394
  if (isArray) {
395
- payload = payload.map(message => {
396
- message._retry = retry + 1;
397
- return message;
398
- });
399
- } else {
400
- // $FlowFixMe
401
- payload._retry = retry + 1;
395
+ payload = payload.map(message => this._writeRetryCount(message, retry + 1));
396
+ } else if (payload && typeof payload === 'object') {
397
+ payload = this._writeRetryCount(payload, retry + 1);
402
398
  }
403
399
 
404
400
  this._sendDebugToGrafana(payload, retry + 1);
@@ -406,6 +402,15 @@ class IssueReporter {
406
402
  });
407
403
  }
408
404
 
405
+ _writeRetryCount(message , count ) {
406
+ if (message && typeof message === 'object') {
407
+ // $FlowFixMe
408
+ message._retry = count;
409
+ }
410
+
411
+ return message;
412
+ }
413
+
409
414
  _isLevelAbove(level1 , level2 ) {
410
415
  const index1 = LOG_LEVELS.indexOf(level1);
411
416
  const index2 = LOG_LEVELS.indexOf(level2);
package/esm/api/auth.js CHANGED
@@ -393,13 +393,9 @@ class IssueReporter {
393
393
 
394
394
  setTimeout(() => {
395
395
  if (isArray) {
396
- payload = payload.map(message => {
397
- message._retry = retry + 1;
398
- return message;
399
- });
400
- } else {
401
- // $FlowFixMe
402
- payload._retry = retry + 1;
396
+ payload = payload.map(message => this._writeRetryCount(message, retry + 1));
397
+ } else if (payload && typeof payload === 'object') {
398
+ payload = this._writeRetryCount(payload, retry + 1);
403
399
  }
404
400
 
405
401
  this._sendDebugToGrafana(payload, retry + 1);
@@ -407,6 +403,15 @@ class IssueReporter {
407
403
  });
408
404
  }
409
405
 
406
+ _writeRetryCount(message , count ) {
407
+ if (message && typeof message === 'object') {
408
+ // $FlowFixMe
409
+ message._retry = count;
410
+ }
411
+
412
+ return message;
413
+ }
414
+
410
415
  _isLevelAbove(level1 , level2 ) {
411
416
  const index1 = LOG_LEVELS.indexOf(level1);
412
417
  const index2 = LOG_LEVELS.indexOf(level2);
@@ -1003,9 +1008,12 @@ var auth = (client , baseUrl ) => ({
1003
1008
  expiration: expiration || DETAULT_EXPIRATION,
1004
1009
  refresh_token: refreshToken,
1005
1010
  client_id: client.clientId,
1006
- tenant_id: tenantId,
1007
1011
  };
1008
1012
 
1013
+ if (tenantId) {
1014
+ body.tenant_id = tenantId;
1015
+ }
1016
+
1009
1017
  const headers = {
1010
1018
  'Content-Type': 'application/json',
1011
1019
  ...(isMobile ? { 'Wazo-Session-Type': 'mobile' } : {}),
@@ -332,13 +332,9 @@ class IssueReporter {
332
332
 
333
333
  setTimeout(() => {
334
334
  if (isArray) {
335
- payload = payload.map(message => {
336
- message._retry = retry + 1;
337
- return message;
338
- });
339
- } else {
340
- // $FlowFixMe
341
- payload._retry = retry + 1;
335
+ payload = payload.map(message => this._writeRetryCount(message, retry + 1));
336
+ } else if (payload && typeof payload === 'object') {
337
+ payload = this._writeRetryCount(payload, retry + 1);
342
338
  }
343
339
 
344
340
  this._sendDebugToGrafana(payload, retry + 1);
@@ -346,6 +342,15 @@ class IssueReporter {
346
342
  });
347
343
  }
348
344
 
345
+ _writeRetryCount(message , count ) {
346
+ if (message && typeof message === 'object') {
347
+ // $FlowFixMe
348
+ message._retry = count;
349
+ }
350
+
351
+ return message;
352
+ }
353
+
349
354
  _isLevelAbove(level1 , level2 ) {
350
355
  const index1 = LOG_LEVELS.indexOf(level1);
351
356
  const index2 = LOG_LEVELS.indexOf(level2);
package/esm/api/calld.js CHANGED
@@ -393,13 +393,9 @@ class IssueReporter {
393
393
 
394
394
  setTimeout(() => {
395
395
  if (isArray) {
396
- payload = payload.map(message => {
397
- message._retry = retry + 1;
398
- return message;
399
- });
400
- } else {
401
- // $FlowFixMe
402
- payload._retry = retry + 1;
396
+ payload = payload.map(message => this._writeRetryCount(message, retry + 1));
397
+ } else if (payload && typeof payload === 'object') {
398
+ payload = this._writeRetryCount(payload, retry + 1);
403
399
  }
404
400
 
405
401
  this._sendDebugToGrafana(payload, retry + 1);
@@ -407,6 +403,15 @@ class IssueReporter {
407
403
  });
408
404
  }
409
405
 
406
+ _writeRetryCount(message , count ) {
407
+ if (message && typeof message === 'object') {
408
+ // $FlowFixMe
409
+ message._retry = count;
410
+ }
411
+
412
+ return message;
413
+ }
414
+
410
415
  _isLevelAbove(level1 , level2 ) {
411
416
  const index1 = LOG_LEVELS.indexOf(level1);
412
417
  const index2 = LOG_LEVELS.indexOf(level2);
package/esm/api/chatd.js CHANGED
@@ -392,13 +392,9 @@ class IssueReporter {
392
392
 
393
393
  setTimeout(() => {
394
394
  if (isArray) {
395
- payload = payload.map(message => {
396
- message._retry = retry + 1;
397
- return message;
398
- });
399
- } else {
400
- // $FlowFixMe
401
- payload._retry = retry + 1;
395
+ payload = payload.map(message => this._writeRetryCount(message, retry + 1));
396
+ } else if (payload && typeof payload === 'object') {
397
+ payload = this._writeRetryCount(payload, retry + 1);
402
398
  }
403
399
 
404
400
  this._sendDebugToGrafana(payload, retry + 1);
@@ -406,6 +402,15 @@ class IssueReporter {
406
402
  });
407
403
  }
408
404
 
405
+ _writeRetryCount(message , count ) {
406
+ if (message && typeof message === 'object') {
407
+ // $FlowFixMe
408
+ message._retry = count;
409
+ }
410
+
411
+ return message;
412
+ }
413
+
409
414
  _isLevelAbove(level1 , level2 ) {
410
415
  const index1 = LOG_LEVELS.indexOf(level1);
411
416
  const index2 = LOG_LEVELS.indexOf(level2);
package/esm/api/confd.js CHANGED
@@ -392,13 +392,9 @@ class IssueReporter {
392
392
 
393
393
  setTimeout(() => {
394
394
  if (isArray) {
395
- payload = payload.map(message => {
396
- message._retry = retry + 1;
397
- return message;
398
- });
399
- } else {
400
- // $FlowFixMe
401
- payload._retry = retry + 1;
395
+ payload = payload.map(message => this._writeRetryCount(message, retry + 1));
396
+ } else if (payload && typeof payload === 'object') {
397
+ payload = this._writeRetryCount(payload, retry + 1);
402
398
  }
403
399
 
404
400
  this._sendDebugToGrafana(payload, retry + 1);
@@ -406,6 +402,15 @@ class IssueReporter {
406
402
  });
407
403
  }
408
404
 
405
+ _writeRetryCount(message , count ) {
406
+ if (message && typeof message === 'object') {
407
+ // $FlowFixMe
408
+ message._retry = count;
409
+ }
410
+
411
+ return message;
412
+ }
413
+
409
414
  _isLevelAbove(level1 , level2 ) {
410
415
  const index1 = LOG_LEVELS.indexOf(level1);
411
416
  const index2 = LOG_LEVELS.indexOf(level2);
@@ -396,13 +396,9 @@ class IssueReporter {
396
396
 
397
397
  setTimeout(() => {
398
398
  if (isArray) {
399
- payload = payload.map(message => {
400
- message._retry = retry + 1;
401
- return message;
402
- });
403
- } else {
404
- // $FlowFixMe
405
- payload._retry = retry + 1;
399
+ payload = payload.map(message => this._writeRetryCount(message, retry + 1));
400
+ } else if (payload && typeof payload === 'object') {
401
+ payload = this._writeRetryCount(payload, retry + 1);
406
402
  }
407
403
 
408
404
  this._sendDebugToGrafana(payload, retry + 1);
@@ -410,6 +406,15 @@ class IssueReporter {
410
406
  });
411
407
  }
412
408
 
409
+ _writeRetryCount(message , count ) {
410
+ if (message && typeof message === 'object') {
411
+ // $FlowFixMe
412
+ message._retry = count;
413
+ }
414
+
415
+ return message;
416
+ }
417
+
413
418
  _isLevelAbove(level1 , level2 ) {
414
419
  const index1 = LOG_LEVELS.indexOf(level1);
415
420
  const index2 = LOG_LEVELS.indexOf(level2);
@@ -1174,7 +1179,9 @@ global.wazoClients = global.wazoClients || {};
1174
1179
  global.wazoClientId = global.wazoClientId || {};
1175
1180
  global.wazoClientToken = global.wazoClientToken || {};
1176
1181
  global.wazoRefreshToken = global.wazoRefreshToken || {};
1182
+ global.wazoRefreshTenantId = global.wazoRefreshTenantId || {};
1177
1183
  global.wazoOnRefreshToken = global.wazoOnRefreshToken || {};
1184
+ global.wazoOnRefreshTokenError = global.wazoOnRefreshTokenError || {};
1178
1185
  global.wazoRefreshExpiration = global.wazoRefreshExpiration || {};
1179
1186
  global.wazoRefreshBackend = global.wazoRefreshBackend || {};
1180
1187
  global.wazoIsMobile = global.wazoIsMobile || {};
package/esm/api/dird.js CHANGED
@@ -394,13 +394,9 @@ class IssueReporter {
394
394
 
395
395
  setTimeout(() => {
396
396
  if (isArray) {
397
- payload = payload.map(message => {
398
- message._retry = retry + 1;
399
- return message;
400
- });
401
- } else {
402
- // $FlowFixMe
403
- payload._retry = retry + 1;
397
+ payload = payload.map(message => this._writeRetryCount(message, retry + 1));
398
+ } else if (payload && typeof payload === 'object') {
399
+ payload = this._writeRetryCount(payload, retry + 1);
404
400
  }
405
401
 
406
402
  this._sendDebugToGrafana(payload, retry + 1);
@@ -408,6 +404,15 @@ class IssueReporter {
408
404
  });
409
405
  }
410
406
 
407
+ _writeRetryCount(message , count ) {
408
+ if (message && typeof message === 'object') {
409
+ // $FlowFixMe
410
+ message._retry = count;
411
+ }
412
+
413
+ return message;
414
+ }
415
+
411
416
  _isLevelAbove(level1 , level2 ) {
412
417
  const index1 = LOG_LEVELS.indexOf(level1);
413
418
  const index2 = LOG_LEVELS.indexOf(level2);
@@ -331,13 +331,9 @@ class IssueReporter {
331
331
 
332
332
  setTimeout(() => {
333
333
  if (isArray) {
334
- payload = payload.map(message => {
335
- message._retry = retry + 1;
336
- return message;
337
- });
338
- } else {
339
- // $FlowFixMe
340
- payload._retry = retry + 1;
334
+ payload = payload.map(message => this._writeRetryCount(message, retry + 1));
335
+ } else if (payload && typeof payload === 'object') {
336
+ payload = this._writeRetryCount(payload, retry + 1);
341
337
  }
342
338
 
343
339
  this._sendDebugToGrafana(payload, retry + 1);
@@ -345,6 +341,15 @@ class IssueReporter {
345
341
  });
346
342
  }
347
343
 
344
+ _writeRetryCount(message , count ) {
345
+ if (message && typeof message === 'object') {
346
+ // $FlowFixMe
347
+ message._retry = count;
348
+ }
349
+
350
+ return message;
351
+ }
352
+
348
353
  _isLevelAbove(level1 , level2 ) {
349
354
  const index1 = LOG_LEVELS.indexOf(level1);
350
355
  const index2 = LOG_LEVELS.indexOf(level2);