@wazo/sdk 0.37.36 → 0.37.39

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 (71) hide show
  1. package/README.md +7 -2
  2. package/dist/wazo-sdk.js +2 -2
  3. package/esm/__tests__/api-client.test.js +9 -0
  4. package/esm/__tests__/web-rtc-client.test.js +9 -0
  5. package/esm/api/auth.js +4 -1
  6. package/esm/api-client.js +9 -0
  7. package/esm/checker/Checker.js +9 -0
  8. package/esm/checker/checks/aor.js +9 -0
  9. package/esm/checker/checks/api.js +9 -0
  10. package/esm/checker/checks/index.js +9 -0
  11. package/esm/checker/checks/webrtc-transport.js +9 -0
  12. package/esm/checker/checks/webrtc.js +9 -0
  13. package/esm/domain/AdHocAPIConference.js +14 -5
  14. package/esm/domain/Features.js +9 -0
  15. package/esm/domain/Phone/CTIPhone.js +9 -0
  16. package/esm/domain/SwitchboardCall.js +5 -5
  17. package/esm/index.js +40 -11
  18. package/esm/service/CallApi.js +9 -0
  19. package/esm/service/getApiClient.js +9 -0
  20. package/esm/simple/Auth.js +41 -12
  21. package/esm/simple/Configuration.js +40 -11
  22. package/esm/simple/Directory.js +9 -0
  23. package/esm/simple/Phone.js +40 -11
  24. package/esm/simple/index.js +40 -11
  25. package/esm/simple/room/LocalParticipant.js +40 -11
  26. package/esm/simple/room/Participant.js +40 -11
  27. package/esm/simple/room/RemoteParticipant.js +40 -11
  28. package/esm/simple/room/Room.js +40 -11
  29. package/esm/simple/room/SipRoom.js +40 -11
  30. package/esm/simple/room/Stream.js +40 -11
  31. package/esm/simple/room/__tests__/RemoteParticipant.test.js +40 -11
  32. package/esm/simple/utils.js +40 -11
  33. package/esm/web-rtc-client.js +9 -0
  34. package/lib/__tests__/api-client.test.js +9 -0
  35. package/lib/__tests__/web-rtc-client.test.js +9 -0
  36. package/lib/api/auth.js +5 -0
  37. package/lib/api-client.js +9 -0
  38. package/lib/checker/Checker.js +9 -0
  39. package/lib/checker/checks/aor.js +9 -0
  40. package/lib/checker/checks/api.js +9 -0
  41. package/lib/checker/checks/index.js +9 -0
  42. package/lib/checker/checks/webrtc-transport.js +9 -0
  43. package/lib/checker/checks/webrtc.js +9 -0
  44. package/lib/domain/AdHocAPIConference.js +14 -5
  45. package/lib/domain/Features.js +9 -0
  46. package/lib/domain/Phone/CTIPhone.js +9 -0
  47. package/lib/domain/SwitchboardCall.js +5 -5
  48. package/lib/index.js +40 -11
  49. package/lib/service/CallApi.js +9 -0
  50. package/lib/service/getApiClient.js +9 -0
  51. package/lib/simple/Auth.js +41 -11
  52. package/lib/simple/Configuration.js +40 -11
  53. package/lib/simple/Directory.js +9 -0
  54. package/lib/simple/Phone.js +40 -11
  55. package/lib/simple/index.js +40 -11
  56. package/lib/simple/room/LocalParticipant.js +40 -11
  57. package/lib/simple/room/Participant.js +40 -11
  58. package/lib/simple/room/RemoteParticipant.js +40 -11
  59. package/lib/simple/room/Room.js +40 -11
  60. package/lib/simple/room/SipRoom.js +40 -11
  61. package/lib/simple/room/Stream.js +40 -11
  62. package/lib/simple/room/__tests__/RemoteParticipant.test.js +40 -11
  63. package/lib/simple/utils.js +40 -11
  64. package/lib/web-rtc-client.js +9 -0
  65. package/package.json +1 -1
  66. package/src/api/auth.js +4 -1
  67. package/src/api-client.js +7 -0
  68. package/src/domain/AdHocAPIConference.js +5 -5
  69. package/src/domain/SwitchboardCall.js +5 -5
  70. package/src/simple/Auth.js +20 -2
  71. package/src/simple/index.js +2 -1
@@ -2208,6 +2208,7 @@ class ApiRequester {
2208
2208
  /* */
2209
2209
 
2210
2210
  const DEFAULT_BACKEND_USER = 'wazo_user';
2211
+ const BACKEND_LDAP_USER = 'ldap_user';
2211
2212
  const DETAULT_EXPIRATION = 3600;
2212
2213
 
2213
2214
  var authMethods = (client , baseUrl ) => ({
@@ -2257,12 +2258,14 @@ var authMethods = (client , baseUrl ) => ({
2257
2258
  backend ,
2258
2259
  expiration ,
2259
2260
  isMobile = false,
2261
+ tenantId ,
2260
2262
  ) => {
2261
2263
  const body = {
2262
2264
  backend: backend || DEFAULT_BACKEND_USER,
2263
2265
  expiration: expiration || DETAULT_EXPIRATION,
2264
2266
  refresh_token: refreshToken,
2265
2267
  client_id: client.clientId,
2268
+ tenant_id: tenantId,
2266
2269
  };
2267
2270
 
2268
2271
  const headers = {
@@ -5414,6 +5417,7 @@ class ApiClient {
5414
5417
 
5415
5418
 
5416
5419
 
5420
+
5417
5421
 
5418
5422
 
5419
5423
 
@@ -5454,6 +5458,7 @@ class ApiClient {
5454
5458
  logger$a.info('refresh token callback called', {
5455
5459
  refreshToken: this.refreshToken,
5456
5460
  refreshBackend: this.refreshBackend,
5461
+ refreshTenantId: this.refreshTenantId,
5457
5462
  refreshExpiration: this.refreshExpiration,
5458
5463
  isMobile: this.isMobile,
5459
5464
  });
@@ -5467,6 +5472,7 @@ class ApiClient {
5467
5472
  this.refreshBackend,
5468
5473
  this.refreshExpiration,
5469
5474
  this.isMobile,
5475
+ this.refreshTenantId,
5470
5476
  );
5471
5477
 
5472
5478
  logger$a.info('token refreshed', { token: session.token });
@@ -5508,6 +5514,10 @@ class ApiClient {
5508
5514
  this.refreshBackend = refreshBackend;
5509
5515
  }
5510
5516
 
5517
+ setRefreshTenantId(tenantId ) {
5518
+ this.refreshTenantId = tenantId;
5519
+ }
5520
+
5511
5521
  setIsMobile(isMobile ) {
5512
5522
  this.isMobile = isMobile;
5513
5523
  }
@@ -5609,6 +5619,7 @@ var getApiClient = (forServer ) => {
5609
5619
 
5610
5620
  class InvalidSubscription extends Error {}
5611
5621
  class InvalidAuthorization extends Error {}
5622
+ class NoTenantIdError extends Error {}
5612
5623
 
5613
5624
  const logger$9 = IssueReporter$1.loggerFor('simple-auth');
5614
5625
 
@@ -5622,11 +5633,15 @@ class Auth {
5622
5633
 
5623
5634
 
5624
5635
 
5636
+
5637
+
5625
5638
 
5626
5639
  constructor() {
5627
5640
  this.expiration = DETAULT_EXPIRATION;
5628
5641
  this.authenticated = false;
5629
5642
  this.minSubscriptionType = null;
5643
+ this.BACKEND_WAZO = DEFAULT_BACKEND_USER;
5644
+ this.BACKEND_LDAP = BACKEND_LDAP_USER;
5630
5645
  }
5631
5646
 
5632
5647
  init(clientId ,
@@ -5659,15 +5674,28 @@ class Auth {
5659
5674
  setFetchOptions(options);
5660
5675
  }
5661
5676
 
5662
- async logIn(username , password ) {
5677
+ async logIn(username , password , backend , tenantId ) {
5678
+ if (backend && backend !== this.BACKEND_WAZO && !tenantId) {
5679
+ throw new NoTenantIdError('No tenant id');
5680
+ }
5681
+
5663
5682
  this.authenticated = false;
5664
5683
  this.session = null;
5665
5684
  const rawSession = await getApiClient().auth.logIn({
5666
5685
  username,
5667
5686
  password,
5687
+ backend,
5688
+ tenantId,
5668
5689
  expiration: this.expiration,
5669
5690
  mobile: this.mobile,
5670
5691
  });
5692
+
5693
+ if (backend) {
5694
+ getApiClient().setRefreshBackend(backend);
5695
+ }
5696
+
5697
+ getApiClient().setRefreshTenantId(tenantId);
5698
+
5671
5699
  return this._onAuthenticated(rawSession);
5672
5700
  }
5673
5701
 
@@ -5894,7 +5922,7 @@ var Auth$1 = global.wazoAuthInstance;
5894
5922
 
5895
5923
 
5896
5924
 
5897
-
5925
+
5898
5926
 
5899
5927
 
5900
5928
 
@@ -5914,7 +5942,7 @@ class AdHocAPIConference {
5914
5942
 
5915
5943
 
5916
5944
 
5917
-
5945
+
5918
5946
 
5919
5947
 
5920
5948
 
@@ -5926,7 +5954,7 @@ class AdHocAPIConference {
5926
5954
  participants,
5927
5955
  started,
5928
5956
  finished,
5929
- startTime,
5957
+ answerTime,
5930
5958
  conferenceId,
5931
5959
  muted,
5932
5960
  paused,
@@ -5936,7 +5964,7 @@ class AdHocAPIConference {
5936
5964
  this.participants = participants || {};
5937
5965
  this.started = started || false;
5938
5966
  this.finished = finished || false;
5939
- this.startTime = startTime;
5967
+ this.answerTime = answerTime;
5940
5968
  this.conferenceId = conferenceId || '';
5941
5969
  this.muted = muted || false;
5942
5970
  this.paused = paused || false;
@@ -5949,7 +5977,7 @@ class AdHocAPIConference {
5949
5977
  async start() {
5950
5978
  this.started = true;
5951
5979
  // $FlowFixMe
5952
- this.startTime = Object.values(this.participants).length ? Object.values(this.participants)[0].startTime : null;
5980
+ this.answerTime = Object.values(this.participants).length ? Object.values(this.participants)[0].answerTime : null;
5953
5981
 
5954
5982
  const participantIds = Object.keys(this.participants);
5955
5983
  const conference = await getApiClient().calld.createAdHocConference(this.host.callId, participantIds);
@@ -13243,7 +13271,7 @@ class Room {
13243
13271
 
13244
13272
 
13245
13273
 
13246
-
13274
+
13247
13275
 
13248
13276
 
13249
13277
 
@@ -13269,7 +13297,7 @@ class SwitchboardCall {
13269
13297
 
13270
13298
 
13271
13299
 
13272
-
13300
+
13273
13301
 
13274
13302
 
13275
13303
 
@@ -13283,7 +13311,7 @@ class SwitchboardCall {
13283
13311
  callerIdName: plain.caller_id_name || null,
13284
13312
  callerIdNumber: plain.caller_id_number || null,
13285
13313
  participantId: plain.participantId || null,
13286
- startTime: plain.startTime,
13314
+ answerTime: plain.startTime,
13287
13315
  state: plain.state,
13288
13316
  switchboardName: plain.switchboardName,
13289
13317
  switchboardUuid: plain.switchboardUuid,
@@ -13296,7 +13324,7 @@ class SwitchboardCall {
13296
13324
  callerIdName,
13297
13325
  callerIdNumber,
13298
13326
  participantId,
13299
- startTime,
13327
+ answerTime,
13300
13328
  state,
13301
13329
  switchboardName,
13302
13330
  switchboardUuid,
@@ -13306,7 +13334,7 @@ class SwitchboardCall {
13306
13334
  this.callerIdName = callerIdName;
13307
13335
  this.callerIdNumber = callerIdNumber;
13308
13336
  this.participantId = participantId;
13309
- this.startTime = startTime;
13337
+ this.answerTime = answerTime;
13310
13338
  this.state = state;
13311
13339
  this.switchboardName = switchboardName;
13312
13340
  this.switchboardUuid = switchboardUuid;
@@ -13943,6 +13971,7 @@ const Wazo = {
13943
13971
  InvalidAuthorization,
13944
13972
  CanceledCallError,
13945
13973
  SFUNotAvailableError,
13974
+ NoTenantIdError,
13946
13975
  };
13947
13976
 
13948
13977
  if (window) {
@@ -2208,6 +2208,7 @@ class ApiRequester {
2208
2208
  /* */
2209
2209
 
2210
2210
  const DEFAULT_BACKEND_USER = 'wazo_user';
2211
+ const BACKEND_LDAP_USER = 'ldap_user';
2211
2212
  const DETAULT_EXPIRATION = 3600;
2212
2213
 
2213
2214
  var authMethods = (client , baseUrl ) => ({
@@ -2257,12 +2258,14 @@ var authMethods = (client , baseUrl ) => ({
2257
2258
  backend ,
2258
2259
  expiration ,
2259
2260
  isMobile = false,
2261
+ tenantId ,
2260
2262
  ) => {
2261
2263
  const body = {
2262
2264
  backend: backend || DEFAULT_BACKEND_USER,
2263
2265
  expiration: expiration || DETAULT_EXPIRATION,
2264
2266
  refresh_token: refreshToken,
2265
2267
  client_id: client.clientId,
2268
+ tenant_id: tenantId,
2266
2269
  };
2267
2270
 
2268
2271
  const headers = {
@@ -5414,6 +5417,7 @@ class ApiClient {
5414
5417
 
5415
5418
 
5416
5419
 
5420
+
5417
5421
 
5418
5422
 
5419
5423
 
@@ -5454,6 +5458,7 @@ class ApiClient {
5454
5458
  logger$a.info('refresh token callback called', {
5455
5459
  refreshToken: this.refreshToken,
5456
5460
  refreshBackend: this.refreshBackend,
5461
+ refreshTenantId: this.refreshTenantId,
5457
5462
  refreshExpiration: this.refreshExpiration,
5458
5463
  isMobile: this.isMobile,
5459
5464
  });
@@ -5467,6 +5472,7 @@ class ApiClient {
5467
5472
  this.refreshBackend,
5468
5473
  this.refreshExpiration,
5469
5474
  this.isMobile,
5475
+ this.refreshTenantId,
5470
5476
  );
5471
5477
 
5472
5478
  logger$a.info('token refreshed', { token: session.token });
@@ -5508,6 +5514,10 @@ class ApiClient {
5508
5514
  this.refreshBackend = refreshBackend;
5509
5515
  }
5510
5516
 
5517
+ setRefreshTenantId(tenantId ) {
5518
+ this.refreshTenantId = tenantId;
5519
+ }
5520
+
5511
5521
  setIsMobile(isMobile ) {
5512
5522
  this.isMobile = isMobile;
5513
5523
  }
@@ -5609,6 +5619,7 @@ var getApiClient = (forServer ) => {
5609
5619
 
5610
5620
  class InvalidSubscription extends Error {}
5611
5621
  class InvalidAuthorization extends Error {}
5622
+ class NoTenantIdError extends Error {}
5612
5623
 
5613
5624
  const logger$9 = IssueReporter$1.loggerFor('simple-auth');
5614
5625
 
@@ -5622,11 +5633,15 @@ class Auth {
5622
5633
 
5623
5634
 
5624
5635
 
5636
+
5637
+
5625
5638
 
5626
5639
  constructor() {
5627
5640
  this.expiration = DETAULT_EXPIRATION;
5628
5641
  this.authenticated = false;
5629
5642
  this.minSubscriptionType = null;
5643
+ this.BACKEND_WAZO = DEFAULT_BACKEND_USER;
5644
+ this.BACKEND_LDAP = BACKEND_LDAP_USER;
5630
5645
  }
5631
5646
 
5632
5647
  init(clientId ,
@@ -5659,15 +5674,28 @@ class Auth {
5659
5674
  setFetchOptions(options);
5660
5675
  }
5661
5676
 
5662
- async logIn(username , password ) {
5677
+ async logIn(username , password , backend , tenantId ) {
5678
+ if (backend && backend !== this.BACKEND_WAZO && !tenantId) {
5679
+ throw new NoTenantIdError('No tenant id');
5680
+ }
5681
+
5663
5682
  this.authenticated = false;
5664
5683
  this.session = null;
5665
5684
  const rawSession = await getApiClient().auth.logIn({
5666
5685
  username,
5667
5686
  password,
5687
+ backend,
5688
+ tenantId,
5668
5689
  expiration: this.expiration,
5669
5690
  mobile: this.mobile,
5670
5691
  });
5692
+
5693
+ if (backend) {
5694
+ getApiClient().setRefreshBackend(backend);
5695
+ }
5696
+
5697
+ getApiClient().setRefreshTenantId(tenantId);
5698
+
5671
5699
  return this._onAuthenticated(rawSession);
5672
5700
  }
5673
5701
 
@@ -5894,7 +5922,7 @@ var Auth$1 = global.wazoAuthInstance;
5894
5922
 
5895
5923
 
5896
5924
 
5897
-
5925
+
5898
5926
 
5899
5927
 
5900
5928
 
@@ -5914,7 +5942,7 @@ class AdHocAPIConference {
5914
5942
 
5915
5943
 
5916
5944
 
5917
-
5945
+
5918
5946
 
5919
5947
 
5920
5948
 
@@ -5926,7 +5954,7 @@ class AdHocAPIConference {
5926
5954
  participants,
5927
5955
  started,
5928
5956
  finished,
5929
- startTime,
5957
+ answerTime,
5930
5958
  conferenceId,
5931
5959
  muted,
5932
5960
  paused,
@@ -5936,7 +5964,7 @@ class AdHocAPIConference {
5936
5964
  this.participants = participants || {};
5937
5965
  this.started = started || false;
5938
5966
  this.finished = finished || false;
5939
- this.startTime = startTime;
5967
+ this.answerTime = answerTime;
5940
5968
  this.conferenceId = conferenceId || '';
5941
5969
  this.muted = muted || false;
5942
5970
  this.paused = paused || false;
@@ -5949,7 +5977,7 @@ class AdHocAPIConference {
5949
5977
  async start() {
5950
5978
  this.started = true;
5951
5979
  // $FlowFixMe
5952
- this.startTime = Object.values(this.participants).length ? Object.values(this.participants)[0].startTime : null;
5980
+ this.answerTime = Object.values(this.participants).length ? Object.values(this.participants)[0].answerTime : null;
5953
5981
 
5954
5982
  const participantIds = Object.keys(this.participants);
5955
5983
  const conference = await getApiClient().calld.createAdHocConference(this.host.callId, participantIds);
@@ -13227,7 +13255,7 @@ class Room {
13227
13255
 
13228
13256
 
13229
13257
 
13230
-
13258
+
13231
13259
 
13232
13260
 
13233
13261
 
@@ -13253,7 +13281,7 @@ class SwitchboardCall {
13253
13281
 
13254
13282
 
13255
13283
 
13256
-
13284
+
13257
13285
 
13258
13286
 
13259
13287
 
@@ -13267,7 +13295,7 @@ class SwitchboardCall {
13267
13295
  callerIdName: plain.caller_id_name || null,
13268
13296
  callerIdNumber: plain.caller_id_number || null,
13269
13297
  participantId: plain.participantId || null,
13270
- startTime: plain.startTime,
13298
+ answerTime: plain.startTime,
13271
13299
  state: plain.state,
13272
13300
  switchboardName: plain.switchboardName,
13273
13301
  switchboardUuid: plain.switchboardUuid,
@@ -13280,7 +13308,7 @@ class SwitchboardCall {
13280
13308
  callerIdName,
13281
13309
  callerIdNumber,
13282
13310
  participantId,
13283
- startTime,
13311
+ answerTime,
13284
13312
  state,
13285
13313
  switchboardName,
13286
13314
  switchboardUuid,
@@ -13290,7 +13318,7 @@ class SwitchboardCall {
13290
13318
  this.callerIdName = callerIdName;
13291
13319
  this.callerIdNumber = callerIdNumber;
13292
13320
  this.participantId = participantId;
13293
- this.startTime = startTime;
13321
+ this.answerTime = answerTime;
13294
13322
  this.state = state;
13295
13323
  this.switchboardName = switchboardName;
13296
13324
  this.switchboardUuid = switchboardUuid;
@@ -13927,6 +13955,7 @@ const Wazo = {
13927
13955
  InvalidAuthorization,
13928
13956
  CanceledCallError,
13929
13957
  SFUNotAvailableError,
13958
+ NoTenantIdError,
13930
13959
  };
13931
13960
 
13932
13961
  if (window) {
@@ -2786,12 +2786,14 @@ var authMethods = (client , baseUrl ) => ({
2786
2786
  backend ,
2787
2787
  expiration ,
2788
2788
  isMobile = false,
2789
+ tenantId ,
2789
2790
  ) => {
2790
2791
  const body = {
2791
2792
  backend: backend || DEFAULT_BACKEND_USER,
2792
2793
  expiration: expiration || DETAULT_EXPIRATION,
2793
2794
  refresh_token: refreshToken,
2794
2795
  client_id: client.clientId,
2796
+ tenant_id: tenantId,
2795
2797
  };
2796
2798
 
2797
2799
  const headers = {
@@ -5129,6 +5131,7 @@ class ApiClient {
5129
5131
 
5130
5132
 
5131
5133
 
5134
+
5132
5135
 
5133
5136
 
5134
5137
 
@@ -5169,6 +5172,7 @@ class ApiClient {
5169
5172
  logger$1.info('refresh token callback called', {
5170
5173
  refreshToken: this.refreshToken,
5171
5174
  refreshBackend: this.refreshBackend,
5175
+ refreshTenantId: this.refreshTenantId,
5172
5176
  refreshExpiration: this.refreshExpiration,
5173
5177
  isMobile: this.isMobile,
5174
5178
  });
@@ -5182,6 +5186,7 @@ class ApiClient {
5182
5186
  this.refreshBackend,
5183
5187
  this.refreshExpiration,
5184
5188
  this.isMobile,
5189
+ this.refreshTenantId,
5185
5190
  );
5186
5191
 
5187
5192
  logger$1.info('token refreshed', { token: session.token });
@@ -5223,6 +5228,10 @@ class ApiClient {
5223
5228
  this.refreshBackend = refreshBackend;
5224
5229
  }
5225
5230
 
5231
+ setRefreshTenantId(tenantId ) {
5232
+ this.refreshTenantId = tenantId;
5233
+ }
5234
+
5226
5235
  setIsMobile(isMobile ) {
5227
5236
  this.isMobile = isMobile;
5228
5237
  }
@@ -2244,12 +2244,14 @@ var authMethods = (client , baseUrl ) => ({
2244
2244
  backend ,
2245
2245
  expiration ,
2246
2246
  isMobile = false,
2247
+ tenantId ,
2247
2248
  ) => {
2248
2249
  const body = {
2249
2250
  backend: backend || DEFAULT_BACKEND_USER,
2250
2251
  expiration: expiration || DETAULT_EXPIRATION,
2251
2252
  refresh_token: refreshToken,
2252
2253
  client_id: client.clientId,
2254
+ tenant_id: tenantId,
2253
2255
  };
2254
2256
 
2255
2257
  const headers = {
@@ -4587,6 +4589,7 @@ class ApiClient {
4587
4589
 
4588
4590
 
4589
4591
 
4592
+
4590
4593
 
4591
4594
 
4592
4595
 
@@ -4627,6 +4630,7 @@ class ApiClient {
4627
4630
  logger.info('refresh token callback called', {
4628
4631
  refreshToken: this.refreshToken,
4629
4632
  refreshBackend: this.refreshBackend,
4633
+ refreshTenantId: this.refreshTenantId,
4630
4634
  refreshExpiration: this.refreshExpiration,
4631
4635
  isMobile: this.isMobile,
4632
4636
  });
@@ -4640,6 +4644,7 @@ class ApiClient {
4640
4644
  this.refreshBackend,
4641
4645
  this.refreshExpiration,
4642
4646
  this.isMobile,
4647
+ this.refreshTenantId,
4643
4648
  );
4644
4649
 
4645
4650
  logger.info('token refreshed', { token: session.token });
@@ -4681,6 +4686,10 @@ class ApiClient {
4681
4686
  this.refreshBackend = refreshBackend;
4682
4687
  }
4683
4688
 
4689
+ setRefreshTenantId(tenantId ) {
4690
+ this.refreshTenantId = tenantId;
4691
+ }
4692
+
4684
4693
  setIsMobile(isMobile ) {
4685
4694
  this.isMobile = isMobile;
4686
4695
  }
@@ -2795,12 +2795,14 @@ var authMethods = (client , baseUrl ) => ({
2795
2795
  backend ,
2796
2796
  expiration ,
2797
2797
  isMobile = false,
2798
+ tenantId ,
2798
2799
  ) => {
2799
2800
  const body = {
2800
2801
  backend: backend || DEFAULT_BACKEND_USER,
2801
2802
  expiration: expiration || DETAULT_EXPIRATION,
2802
2803
  refresh_token: refreshToken,
2803
2804
  client_id: client.clientId,
2805
+ tenant_id: tenantId,
2804
2806
  };
2805
2807
 
2806
2808
  const headers = {
@@ -5138,6 +5140,7 @@ class ApiClient {
5138
5140
 
5139
5141
 
5140
5142
 
5143
+
5141
5144
 
5142
5145
 
5143
5146
 
@@ -5178,6 +5181,7 @@ class ApiClient {
5178
5181
  logger$1.info('refresh token callback called', {
5179
5182
  refreshToken: this.refreshToken,
5180
5183
  refreshBackend: this.refreshBackend,
5184
+ refreshTenantId: this.refreshTenantId,
5181
5185
  refreshExpiration: this.refreshExpiration,
5182
5186
  isMobile: this.isMobile,
5183
5187
  });
@@ -5191,6 +5195,7 @@ class ApiClient {
5191
5195
  this.refreshBackend,
5192
5196
  this.refreshExpiration,
5193
5197
  this.isMobile,
5198
+ this.refreshTenantId,
5194
5199
  );
5195
5200
 
5196
5201
  logger$1.info('token refreshed', { token: session.token });
@@ -5232,6 +5237,10 @@ class ApiClient {
5232
5237
  this.refreshBackend = refreshBackend;
5233
5238
  }
5234
5239
 
5240
+ setRefreshTenantId(tenantId ) {
5241
+ this.refreshTenantId = tenantId;
5242
+ }
5243
+
5235
5244
  setIsMobile(isMobile ) {
5236
5245
  this.isMobile = isMobile;
5237
5246
  }
package/lib/api/auth.js CHANGED
@@ -954,6 +954,7 @@ class Session {
954
954
  /* */
955
955
 
956
956
  const DEFAULT_BACKEND_USER = 'wazo_user';
957
+ const BACKEND_LDAP_USER = 'ldap_user';
957
958
  const DETAULT_EXPIRATION = 3600;
958
959
 
959
960
  var auth = (client , baseUrl ) => ({
@@ -1003,12 +1004,14 @@ var auth = (client , baseUrl ) => ({
1003
1004
  backend ,
1004
1005
  expiration ,
1005
1006
  isMobile = false,
1007
+ tenantId ,
1006
1008
  ) => {
1007
1009
  const body = {
1008
1010
  backend: backend || DEFAULT_BACKEND_USER,
1009
1011
  expiration: expiration || DETAULT_EXPIRATION,
1010
1012
  refresh_token: refreshToken,
1011
1013
  client_id: client.clientId,
1014
+ tenant_id: tenantId,
1012
1015
  };
1013
1016
 
1014
1017
  const headers = {
@@ -1197,5 +1200,7 @@ var auth = (client , baseUrl ) => ({
1197
1200
  client.delete(`${baseUrl}/users/${userUuid}/external/${provider}`),
1198
1201
  });
1199
1202
 
1203
+ exports.BACKEND_LDAP_USER = BACKEND_LDAP_USER;
1204
+ exports.DEFAULT_BACKEND_USER = DEFAULT_BACKEND_USER;
1200
1205
  exports.DETAULT_EXPIRATION = DETAULT_EXPIRATION;
1201
1206
  exports.default = auth;
package/lib/api-client.js CHANGED
@@ -2244,12 +2244,14 @@ var authMethods = (client , baseUrl ) => ({
2244
2244
  backend ,
2245
2245
  expiration ,
2246
2246
  isMobile = false,
2247
+ tenantId ,
2247
2248
  ) => {
2248
2249
  const body = {
2249
2250
  backend: backend || DEFAULT_BACKEND_USER,
2250
2251
  expiration: expiration || DETAULT_EXPIRATION,
2251
2252
  refresh_token: refreshToken,
2252
2253
  client_id: client.clientId,
2254
+ tenant_id: tenantId,
2253
2255
  };
2254
2256
 
2255
2257
  const headers = {
@@ -4587,6 +4589,7 @@ class ApiClient {
4587
4589
 
4588
4590
 
4589
4591
 
4592
+
4590
4593
 
4591
4594
 
4592
4595
 
@@ -4627,6 +4630,7 @@ class ApiClient {
4627
4630
  logger.info('refresh token callback called', {
4628
4631
  refreshToken: this.refreshToken,
4629
4632
  refreshBackend: this.refreshBackend,
4633
+ refreshTenantId: this.refreshTenantId,
4630
4634
  refreshExpiration: this.refreshExpiration,
4631
4635
  isMobile: this.isMobile,
4632
4636
  });
@@ -4640,6 +4644,7 @@ class ApiClient {
4640
4644
  this.refreshBackend,
4641
4645
  this.refreshExpiration,
4642
4646
  this.isMobile,
4647
+ this.refreshTenantId,
4643
4648
  );
4644
4649
 
4645
4650
  logger.info('token refreshed', { token: session.token });
@@ -4681,6 +4686,10 @@ class ApiClient {
4681
4686
  this.refreshBackend = refreshBackend;
4682
4687
  }
4683
4688
 
4689
+ setRefreshTenantId(tenantId ) {
4690
+ this.refreshTenantId = tenantId;
4691
+ }
4692
+
4684
4693
  setIsMobile(isMobile ) {
4685
4694
  this.isMobile = isMobile;
4686
4695
  }
@@ -2266,12 +2266,14 @@ var authMethods = (client , baseUrl ) => ({
2266
2266
  backend ,
2267
2267
  expiration ,
2268
2268
  isMobile = false,
2269
+ tenantId ,
2269
2270
  ) => {
2270
2271
  const body = {
2271
2272
  backend: backend || DEFAULT_BACKEND_USER,
2272
2273
  expiration: expiration || DETAULT_EXPIRATION,
2273
2274
  refresh_token: refreshToken,
2274
2275
  client_id: client.clientId,
2276
+ tenant_id: tenantId,
2275
2277
  };
2276
2278
 
2277
2279
  const headers = {
@@ -4635,6 +4637,7 @@ class ApiClient {
4635
4637
 
4636
4638
 
4637
4639
 
4640
+
4638
4641
 
4639
4642
 
4640
4643
 
@@ -4675,6 +4678,7 @@ class ApiClient {
4675
4678
  logger$3.info('refresh token callback called', {
4676
4679
  refreshToken: this.refreshToken,
4677
4680
  refreshBackend: this.refreshBackend,
4681
+ refreshTenantId: this.refreshTenantId,
4678
4682
  refreshExpiration: this.refreshExpiration,
4679
4683
  isMobile: this.isMobile,
4680
4684
  });
@@ -4688,6 +4692,7 @@ class ApiClient {
4688
4692
  this.refreshBackend,
4689
4693
  this.refreshExpiration,
4690
4694
  this.isMobile,
4695
+ this.refreshTenantId,
4691
4696
  );
4692
4697
 
4693
4698
  logger$3.info('token refreshed', { token: session.token });
@@ -4729,6 +4734,10 @@ class ApiClient {
4729
4734
  this.refreshBackend = refreshBackend;
4730
4735
  }
4731
4736
 
4737
+ setRefreshTenantId(tenantId ) {
4738
+ this.refreshTenantId = tenantId;
4739
+ }
4740
+
4732
4741
  setIsMobile(isMobile ) {
4733
4742
  this.isMobile = isMobile;
4734
4743
  }