@wazo/sdk 0.38.7 → 0.38.10
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.
- package/dist/wazo-sdk.js +2 -2
- package/esm/__tests__/api-client.test.js +163 -2
- package/esm/__tests__/web-rtc-client.test.js +248 -27
- package/esm/api/auth.js +12 -0
- package/esm/api/calld.js +8 -0
- package/esm/api/confd.js +134 -2
- package/esm/api/ctid-ng.js +1 -0
- package/esm/api-client.js +163 -2
- package/esm/checker/Checker.js +204 -24
- package/esm/checker/checks/aor.js +163 -2
- package/esm/checker/checks/api.js +163 -2
- package/esm/checker/checks/index.js +204 -24
- package/esm/checker/checks/wazo-websocket.js +2 -0
- package/esm/checker/checks/webrtc-transport.js +202 -24
- package/esm/checker/checks/webrtc.js +202 -24
- package/esm/domain/AdHocAPIConference.js +170 -4
- package/esm/domain/Features.js +170 -4
- package/esm/domain/Meeting.js +18 -0
- package/esm/domain/MeetingAuthorization.js +70 -0
- package/esm/domain/Phone/CTIPhone.js +170 -4
- package/esm/domain/Phone/WebRTCPhone.js +2 -3
- package/esm/domain/__tests__/Meeting.test.js +87 -1
- package/esm/domain/__tests__/MeetingAuthorization.test.js +109 -0
- package/esm/index.js +300 -36
- package/esm/service/CallApi.js +170 -4
- package/esm/service/getApiClient.js +176 -5
- package/esm/simple/Auth.js +301 -37
- package/esm/simple/Configuration.js +300 -36
- package/esm/simple/Directory.js +170 -4
- package/esm/simple/Phone.js +300 -36
- package/esm/simple/Softphone.js +5 -0
- package/esm/simple/Websocket.js +3 -0
- package/esm/simple/index.js +300 -36
- package/esm/simple/room/LocalParticipant.js +300 -36
- package/esm/simple/room/Participant.js +300 -36
- package/esm/simple/room/RemoteParticipant.js +300 -36
- package/esm/simple/room/Room.js +300 -36
- package/esm/simple/room/SipRoom.js +300 -36
- package/esm/simple/room/Stream.js +300 -36
- package/esm/simple/room/__tests__/Participant.test.js +14812 -0
- package/esm/simple/room/__tests__/RemoteParticipant.test.js +300 -36
- package/esm/simple/utils.js +300 -36
- package/esm/utils/__tests__/object.test.js +57 -0
- package/esm/utils/__tests__/string.test.js +30 -0
- package/esm/utils/object.js +24 -0
- package/esm/utils/string.js +10 -0
- package/esm/web-rtc-client.js +202 -24
- package/esm/websocket-client.js +3 -1
- package/lib/__tests__/api-client.test.js +163 -2
- package/lib/__tests__/web-rtc-client.test.js +248 -27
- package/lib/api/auth.js +12 -0
- package/lib/api/calld.js +8 -0
- package/lib/api/confd.js +134 -2
- package/lib/api/ctid-ng.js +1 -0
- package/lib/api-client.js +163 -2
- package/lib/checker/Checker.js +204 -24
- package/lib/checker/checks/aor.js +163 -2
- package/lib/checker/checks/api.js +163 -2
- package/lib/checker/checks/index.js +204 -24
- package/lib/checker/checks/wazo-websocket.js +2 -0
- package/lib/checker/checks/webrtc-transport.js +202 -24
- package/lib/checker/checks/webrtc.js +202 -24
- package/lib/domain/AdHocAPIConference.js +170 -4
- package/lib/domain/Features.js +170 -4
- package/lib/domain/Meeting.js +18 -0
- package/lib/domain/MeetingAuthorization.js +79 -0
- package/lib/domain/Phone/CTIPhone.js +170 -4
- package/lib/domain/Phone/WebRTCPhone.js +2 -3
- package/lib/domain/__tests__/Meeting.test.js +87 -1
- package/lib/domain/__tests__/MeetingAuthorization.test.js +111 -0
- package/lib/index.js +300 -36
- package/lib/service/CallApi.js +170 -4
- package/lib/service/getApiClient.js +176 -4
- package/lib/simple/Auth.js +301 -36
- package/lib/simple/Configuration.js +300 -36
- package/lib/simple/Directory.js +170 -4
- package/lib/simple/Phone.js +300 -36
- package/lib/simple/Softphone.js +5 -0
- package/lib/simple/Websocket.js +3 -0
- package/lib/simple/index.js +300 -36
- package/lib/simple/room/LocalParticipant.js +300 -36
- package/lib/simple/room/Participant.js +300 -36
- package/lib/simple/room/RemoteParticipant.js +300 -36
- package/lib/simple/room/Room.js +300 -36
- package/lib/simple/room/SipRoom.js +300 -36
- package/lib/simple/room/Stream.js +300 -36
- package/lib/simple/room/__tests__/Participant.test.js +14822 -0
- package/lib/simple/room/__tests__/RemoteParticipant.test.js +300 -36
- package/lib/simple/utils.js +300 -36
- package/lib/utils/__tests__/object.test.js +59 -0
- package/lib/utils/__tests__/string.test.js +32 -0
- package/lib/utils/object.js +28 -0
- package/lib/utils/string.js +14 -0
- package/lib/web-rtc-client.js +202 -24
- package/lib/websocket-client.js +3 -0
- package/package.json +1 -1
- package/src/__tests__/web-rtc-client.test.js +46 -3
- package/src/api/auth.js +12 -0
- package/src/api/calld.js +8 -0
- package/src/api/confd.js +43 -2
- package/src/api-client.js +8 -0
- package/src/domain/Meeting.js +20 -0
- package/src/domain/MeetingAuthorization.js +67 -0
- package/src/domain/Phone/WebRTCPhone.js +1 -3
- package/src/domain/__tests__/Meeting.test.js +70 -1
- package/src/domain/__tests__/MeetingAuthorization.test.js +58 -0
- package/src/service/getApiClient.js +13 -2
- package/src/simple/Auth.js +35 -4
- package/src/simple/Softphone.js +5 -0
- package/src/simple/index.js +2 -1
- package/src/simple/room/Participant.js +40 -0
- package/src/simple/room/Room.js +2 -2
- package/src/simple/room/SipRoom.js +1 -1
- package/src/simple/room/__tests__/Participant.test.js +81 -0
- package/src/types/WebSocketMessage.js +7 -1
- package/src/utils/__tests__/object.test.js +35 -0
- package/src/utils/__tests__/string.test.js +23 -0
- package/src/utils/object.js +15 -0
- package/src/utils/string.js +8 -0
- package/src/web-rtc-client.js +39 -22
- package/src/websocket-client.js +2 -0
|
@@ -2209,6 +2209,7 @@ var authMethods = (client , baseUrl ) => ({
|
|
|
2209
2209
|
|
|
2210
2210
|
|
|
2211
2211
|
|
|
2212
|
+
|
|
2212
2213
|
) {
|
|
2213
2214
|
const body = {
|
|
2214
2215
|
backend: params.backend || DEFAULT_BACKEND_USER,
|
|
@@ -2229,9 +2230,14 @@ var authMethods = (client , baseUrl ) => ({
|
|
|
2229
2230
|
}
|
|
2230
2231
|
|
|
2231
2232
|
if (params.tenantId) {
|
|
2233
|
+
console.warn('Use of `tenantId` is deprecated when calling logIn() method, use `domainName` instead.');
|
|
2232
2234
|
body.tenant_id = params.tenantId;
|
|
2233
2235
|
}
|
|
2234
2236
|
|
|
2237
|
+
if (params.domainName) {
|
|
2238
|
+
body.domain_name = params.domainName;
|
|
2239
|
+
}
|
|
2240
|
+
|
|
2235
2241
|
return client.post(`${baseUrl}/token`, body, headers).then(response => Session.parse(response));
|
|
2236
2242
|
},
|
|
2237
2243
|
|
|
@@ -2244,6 +2250,7 @@ var authMethods = (client , baseUrl ) => ({
|
|
|
2244
2250
|
expiration ,
|
|
2245
2251
|
isMobile = false,
|
|
2246
2252
|
tenantId ,
|
|
2253
|
+
domainName ,
|
|
2247
2254
|
) => {
|
|
2248
2255
|
const body = {
|
|
2249
2256
|
backend: backend || DEFAULT_BACKEND_USER,
|
|
@@ -2253,9 +2260,14 @@ var authMethods = (client , baseUrl ) => ({
|
|
|
2253
2260
|
};
|
|
2254
2261
|
|
|
2255
2262
|
if (tenantId) {
|
|
2263
|
+
console.warn('Use of `tenantId` is deprecated when calling refreshToken() method, use `domainName` instead.');
|
|
2256
2264
|
body.tenant_id = tenantId;
|
|
2257
2265
|
}
|
|
2258
2266
|
|
|
2267
|
+
if (domainName) {
|
|
2268
|
+
body.domain_name = domainName;
|
|
2269
|
+
}
|
|
2270
|
+
|
|
2259
2271
|
const headers = {
|
|
2260
2272
|
'Content-Type': 'application/json',
|
|
2261
2273
|
...(isMobile ? { 'Wazo-Session-Type': 'mobile' } : {}),
|
|
@@ -2625,6 +2637,70 @@ class ExternalApp {
|
|
|
2625
2637
|
|
|
2626
2638
|
//
|
|
2627
2639
|
|
|
2640
|
+
class MeetingAuthorization {
|
|
2641
|
+
|
|
2642
|
+
|
|
2643
|
+
|
|
2644
|
+
|
|
2645
|
+
|
|
2646
|
+
|
|
2647
|
+
constructor({
|
|
2648
|
+
meetingUuid,
|
|
2649
|
+
uuid,
|
|
2650
|
+
userUuid,
|
|
2651
|
+
userName,
|
|
2652
|
+
} = {}) {
|
|
2653
|
+
this.meetingUuid = meetingUuid;
|
|
2654
|
+
this.uuid = uuid;
|
|
2655
|
+
this.userUuid = userUuid;
|
|
2656
|
+
this.userName = userName;
|
|
2657
|
+
}
|
|
2658
|
+
|
|
2659
|
+
setStatus(status ) {
|
|
2660
|
+
this.status = status;
|
|
2661
|
+
}
|
|
2662
|
+
|
|
2663
|
+
getStatus() {
|
|
2664
|
+
return this.status;
|
|
2665
|
+
}
|
|
2666
|
+
|
|
2667
|
+
static parse(plain ) {
|
|
2668
|
+
const {
|
|
2669
|
+
meeting_uuid: meetingUuid,
|
|
2670
|
+
uuid,
|
|
2671
|
+
guest_uuid: userUuid,
|
|
2672
|
+
guest_name: userName,
|
|
2673
|
+
} = plain;
|
|
2674
|
+
|
|
2675
|
+
return new MeetingAuthorization({
|
|
2676
|
+
meetingUuid,
|
|
2677
|
+
uuid,
|
|
2678
|
+
userUuid,
|
|
2679
|
+
userName,
|
|
2680
|
+
});
|
|
2681
|
+
}
|
|
2682
|
+
|
|
2683
|
+
static parseMany(items ) {
|
|
2684
|
+
if (!items) {
|
|
2685
|
+
return [];
|
|
2686
|
+
}
|
|
2687
|
+
return items.map(MeetingAuthorization.parse);
|
|
2688
|
+
}
|
|
2689
|
+
}
|
|
2690
|
+
|
|
2691
|
+
//
|
|
2692
|
+
|
|
2693
|
+
|
|
2694
|
+
|
|
2695
|
+
|
|
2696
|
+
|
|
2697
|
+
|
|
2698
|
+
|
|
2699
|
+
|
|
2700
|
+
|
|
2701
|
+
|
|
2702
|
+
|
|
2703
|
+
|
|
2628
2704
|
|
|
2629
2705
|
|
|
2630
2706
|
|
|
@@ -2635,6 +2711,7 @@ class ExternalApp {
|
|
|
2635
2711
|
|
|
2636
2712
|
|
|
2637
2713
|
|
|
2714
|
+
|
|
2638
2715
|
|
|
2639
2716
|
|
|
2640
2717
|
class Meeting {
|
|
@@ -2649,6 +2726,8 @@ class Meeting {
|
|
|
2649
2726
|
|
|
2650
2727
|
|
|
2651
2728
|
|
|
2729
|
+
|
|
2730
|
+
|
|
2652
2731
|
|
|
2653
2732
|
static parse(plain ) {
|
|
2654
2733
|
return new Meeting({
|
|
@@ -2661,6 +2740,7 @@ class Meeting {
|
|
|
2661
2740
|
extension: plain.exten,
|
|
2662
2741
|
persistent: plain.persistent,
|
|
2663
2742
|
creationTime: moment(plain.creation_time).toDate(),
|
|
2743
|
+
requireAuthorization: plain.require_authorization,
|
|
2664
2744
|
});
|
|
2665
2745
|
}
|
|
2666
2746
|
|
|
@@ -2685,6 +2765,7 @@ class Meeting {
|
|
|
2685
2765
|
extension,
|
|
2686
2766
|
persistent,
|
|
2687
2767
|
creationTime,
|
|
2768
|
+
requireAuthorization,
|
|
2688
2769
|
} = {}) {
|
|
2689
2770
|
this.guestSipAuthorization = guestSipAuthorization;
|
|
2690
2771
|
this.uri = uri;
|
|
@@ -2695,6 +2776,7 @@ class Meeting {
|
|
|
2695
2776
|
this.extension = extension;
|
|
2696
2777
|
this.persistent = persistent;
|
|
2697
2778
|
this.creationTime = creationTime;
|
|
2779
|
+
this.requireAuthorization = requireAuthorization;
|
|
2698
2780
|
|
|
2699
2781
|
// Useful to compare instead of instanceof with minified code
|
|
2700
2782
|
this.type = 'Meeting';
|
|
@@ -2705,8 +2787,32 @@ class Meeting {
|
|
|
2705
2787
|
const [username, secret] = atob(this.guestSipAuthorization).split(':');
|
|
2706
2788
|
return { username, secret };
|
|
2707
2789
|
}
|
|
2790
|
+
|
|
2708
2791
|
}
|
|
2709
2792
|
|
|
2793
|
+
//
|
|
2794
|
+
|
|
2795
|
+
const camelToUnderscore = (key ) => {
|
|
2796
|
+
if (typeof key !== 'string') {
|
|
2797
|
+
throw new Error('Input is not a string');
|
|
2798
|
+
}
|
|
2799
|
+
return key.charAt(0).toLowerCase() + key.substring(1).replace(/([A-Z])/g, '_$1').toLowerCase();
|
|
2800
|
+
};
|
|
2801
|
+
|
|
2802
|
+
//
|
|
2803
|
+
|
|
2804
|
+
const convertKeysFromCamelToUnderscore = (args ) => {
|
|
2805
|
+
if (!args || typeof args !== 'object' || Array.isArray(args)) {
|
|
2806
|
+
throw new Error('Input is not an object');
|
|
2807
|
+
}
|
|
2808
|
+
|
|
2809
|
+
return Object.keys(args).reduce((acc, key) => {
|
|
2810
|
+
acc[camelToUnderscore(key)] = typeof args[key] === 'object' && !Array.isArray(args[key])
|
|
2811
|
+
? convertKeysFromCamelToUnderscore(args[key]) : args[key];
|
|
2812
|
+
return acc;
|
|
2813
|
+
}, {});
|
|
2814
|
+
};
|
|
2815
|
+
|
|
2710
2816
|
/* */
|
|
2711
2817
|
|
|
2712
2818
|
var confdMethods = (client , baseUrl ) => ({
|
|
@@ -2775,8 +2881,18 @@ var confdMethods = (client , baseUrl ) => ({
|
|
|
2775
2881
|
getMyMeetings: () =>
|
|
2776
2882
|
client.get(`${baseUrl}/users/me/meetings`).then(response => Meeting.parseMany(response.items)),
|
|
2777
2883
|
|
|
2778
|
-
createMyMeeting: (
|
|
2779
|
-
client
|
|
2884
|
+
createMyMeeting: (args ) =>
|
|
2885
|
+
client
|
|
2886
|
+
.post(`${baseUrl}/users/me/meetings`, convertKeysFromCamelToUnderscore(args))
|
|
2887
|
+
.then(Meeting.parse),
|
|
2888
|
+
|
|
2889
|
+
updateMyMeeting: (meetingUuid , data ) =>
|
|
2890
|
+
client.put(
|
|
2891
|
+
`${baseUrl}/users/me/meetings/${meetingUuid}`,
|
|
2892
|
+
convertKeysFromCamelToUnderscore(data),
|
|
2893
|
+
null,
|
|
2894
|
+
ApiRequester.successResponseParser,
|
|
2895
|
+
),
|
|
2780
2896
|
|
|
2781
2897
|
deleteMyMeeting: (meetingUuid ) =>
|
|
2782
2898
|
client.delete(`${baseUrl}/users/me/meetings/${meetingUuid}`, null),
|
|
@@ -2784,8 +2900,36 @@ var confdMethods = (client , baseUrl ) => ({
|
|
|
2784
2900
|
getMeeting: (meetingUuid ) =>
|
|
2785
2901
|
client.get(`${baseUrl}/meetings/${meetingUuid}`, null).then(Meeting.parse),
|
|
2786
2902
|
|
|
2903
|
+
meetingAuthorizations: (meetingUuid ) =>
|
|
2904
|
+
client.get(`${baseUrl}/users/me/meetings/${meetingUuid}/authorizations`, null).then(MeetingAuthorization.parseMany),
|
|
2905
|
+
|
|
2906
|
+
meetingAuthorizationReject: (meetingUuid , authorizationUuid ) =>
|
|
2907
|
+
client.put(
|
|
2908
|
+
`${baseUrl}/users/me/meetings/${meetingUuid}/authorizations/${authorizationUuid}/reject`,
|
|
2909
|
+
{},
|
|
2910
|
+
null,
|
|
2911
|
+
ApiRequester.successResponseParser,
|
|
2912
|
+
),
|
|
2913
|
+
|
|
2914
|
+
meetingAuthorizationAccept: (meetingUuid , authorizationUuid ) =>
|
|
2915
|
+
client.put(
|
|
2916
|
+
`${baseUrl}/users/me/meetings/${meetingUuid}/authorizations/${authorizationUuid}/accept`,
|
|
2917
|
+
{},
|
|
2918
|
+
null,
|
|
2919
|
+
ApiRequester.successResponseParser,
|
|
2920
|
+
),
|
|
2921
|
+
|
|
2787
2922
|
guestGetMeeting: (meetingUuid ) =>
|
|
2788
2923
|
client.get(`${baseUrl}/guests/me/meetings/${meetingUuid}`, null).then(Meeting.parse),
|
|
2924
|
+
|
|
2925
|
+
guestAuthorizationRequest: (userUuid , meetingUuid , username ) =>
|
|
2926
|
+
client
|
|
2927
|
+
.post(`${baseUrl}/guests/${userUuid}/meetings/${meetingUuid}/authorizations`, { guest_name: username })
|
|
2928
|
+
.then(MeetingAuthorization.parse),
|
|
2929
|
+
|
|
2930
|
+
guestAuthorizationCheck: (userUuid , meetingUuid , authorizationUuid ) =>
|
|
2931
|
+
client.get(`${baseUrl}/guests/${userUuid}/meetings/${meetingUuid}/authorizations/${authorizationUuid}`, null),
|
|
2932
|
+
|
|
2789
2933
|
});
|
|
2790
2934
|
|
|
2791
2935
|
//
|
|
@@ -3550,6 +3694,7 @@ global.wazoClientId = global.wazoClientId || {};
|
|
|
3550
3694
|
global.wazoClientToken = global.wazoClientToken || {};
|
|
3551
3695
|
global.wazoRefreshToken = global.wazoRefreshToken || {};
|
|
3552
3696
|
global.wazoRefreshTenantId = global.wazoRefreshTenantId || {};
|
|
3697
|
+
global.wazoRefreshDomainName = global.wazoRefreshDomainName || {};
|
|
3553
3698
|
global.wazoOnRefreshToken = global.wazoOnRefreshToken || {};
|
|
3554
3699
|
global.wazoOnRefreshTokenError = global.wazoOnRefreshTokenError || {};
|
|
3555
3700
|
global.wazoRefreshExpiration = global.wazoRefreshExpiration || {};
|
|
@@ -4224,6 +4369,14 @@ var calldMethods = (client , baseUrl ) => ({
|
|
|
4224
4369
|
getMeetingParticipantsAsUser: async (meetingUuid ) =>
|
|
4225
4370
|
client.get(`${baseUrl}/users/me/meetings/${meetingUuid}/participants`),
|
|
4226
4371
|
|
|
4372
|
+
banMeetingParticipant: (meetingUuid , participantUuid ) =>
|
|
4373
|
+
client.delete(
|
|
4374
|
+
`${baseUrl}/users/me/meetings/${meetingUuid}/participants/${participantUuid}`,
|
|
4375
|
+
null,
|
|
4376
|
+
null,
|
|
4377
|
+
ApiRequester.successResponseParser,
|
|
4378
|
+
),
|
|
4379
|
+
|
|
4227
4380
|
listTrunks: () => client.get(`${baseUrl}/trunks`),
|
|
4228
4381
|
|
|
4229
4382
|
mute: (callId ) =>
|
|
@@ -4601,6 +4754,7 @@ class ApiClient {
|
|
|
4601
4754
|
|
|
4602
4755
|
|
|
4603
4756
|
|
|
4757
|
+
|
|
4604
4758
|
|
|
4605
4759
|
|
|
4606
4760
|
|
|
@@ -4642,6 +4796,7 @@ class ApiClient {
|
|
|
4642
4796
|
refreshToken: this.refreshToken,
|
|
4643
4797
|
refreshBackend: this.refreshBackend,
|
|
4644
4798
|
refreshTenantId: this.refreshTenantId,
|
|
4799
|
+
refreshDomainName: this.refreshDomainName,
|
|
4645
4800
|
refreshExpiration: this.refreshExpiration,
|
|
4646
4801
|
isMobile: this.isMobile,
|
|
4647
4802
|
});
|
|
@@ -4657,6 +4812,7 @@ class ApiClient {
|
|
|
4657
4812
|
this.refreshExpiration,
|
|
4658
4813
|
this.isMobile,
|
|
4659
4814
|
this.refreshTenantId,
|
|
4815
|
+
this.refreshDomainName,
|
|
4660
4816
|
);
|
|
4661
4817
|
|
|
4662
4818
|
logger.info('token refreshed', { token: session.token });
|
|
@@ -4710,9 +4866,14 @@ class ApiClient {
|
|
|
4710
4866
|
}
|
|
4711
4867
|
|
|
4712
4868
|
setRefreshTenantId(tenantId ) {
|
|
4869
|
+
console.warn('Use of `setRefreshTenantId` is deprecated, use `setRefreshDomainName` instead');
|
|
4713
4870
|
this.refreshTenantId = tenantId;
|
|
4714
4871
|
}
|
|
4715
4872
|
|
|
4873
|
+
setRefreshDomainName(domainName ) {
|
|
4874
|
+
this.refreshDomainName = domainName;
|
|
4875
|
+
}
|
|
4876
|
+
|
|
4716
4877
|
setIsMobile(isMobile ) {
|
|
4717
4878
|
this.isMobile = isMobile;
|
|
4718
4879
|
}
|