@wazo/sdk 0.39.15 → 0.40.1
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/README.md +2 -2
- package/dist/wazo-sdk.js +12 -12
- package/esm/__tests__/api-client.test.js +0 -10
- package/esm/__tests__/web-rtc-client.test.js +2 -15
- package/esm/api/chatd.js +0 -1
- package/esm/api/dird.js +7 -10
- package/esm/checker/checks/ice-ipv4.js +2 -3
- package/esm/checker/checks/symmetric-nat.js +7 -4
- package/esm/domain/AdHocAPIConference.js +1 -1
- package/esm/domain/CallLog.js +1 -1
- package/esm/domain/Contact.js +2 -1
- package/esm/domain/MeetingAuthorization.js +6 -0
- package/esm/domain/Phone/CTIPhone.js +3 -1
- package/esm/domain/Phone/WebRTCPhone.js +16 -18
- package/esm/domain/Session.js +2 -2
- package/esm/domain/__tests__/Agent.test.js +0 -2
- package/esm/domain/__tests__/Call.test.js +0 -1
- package/esm/domain/__tests__/CallLog.test.js +0 -1
- package/esm/domain/__tests__/CallSession.test.js +1 -2
- package/esm/domain/__tests__/Contact.test.js +2 -4
- package/esm/domain/__tests__/IndirectTransfer.test.js +0 -1
- package/esm/domain/__tests__/Profile.test.js +0 -1
- package/esm/domain/__tests__/Room.test.js +1 -25
- package/esm/domain/__tests__/Session.test.js +13 -14
- package/esm/domain/__tests__/SipLine.test.js +2 -3
- package/esm/index.js +44 -88
- package/esm/lib/WazoSessionDescriptionHandler.js +9 -15
- package/esm/service/IssueReporter.js +1 -3
- package/esm/service/__tests__/IssueReporter.test.js +0 -1
- package/esm/simple/Phone.js +1 -1
- package/esm/simple/Websocket.js +2 -2
- package/esm/simple/index.js +7 -6
- package/esm/simple/room/Room.js +15 -15
- package/esm/simple/room/SipRoom.js +1 -1
- package/esm/simple/room/Stream.js +1 -2
- package/esm/simple/room/__tests__/Participant.test.js +0 -2
- package/esm/simple/room/__tests__/RemoteParticipant.test.js +1 -2
- package/esm/types/api/auth.d.ts +2 -2
- package/esm/types/api/auth.d.ts.map +1 -1
- package/esm/types/api/call-logd.d.ts +3 -3
- package/esm/types/api/call-logd.d.ts.map +1 -1
- package/esm/types/api/chatd.d.ts +9 -22
- package/esm/types/api/chatd.d.ts.map +1 -1
- package/esm/types/api/dird.d.ts +21 -14
- package/esm/types/api/dird.d.ts.map +1 -1
- package/esm/types/checker/checks/ice-ipv4.d.ts.map +1 -1
- package/esm/types/checker/checks/index.d.ts +1 -1
- package/esm/types/checker/checks/symmetric-nat.d.ts.map +1 -1
- package/esm/types/checker/checks/webrtc-transport.d.ts +2 -2
- package/esm/types/checker/checks/webrtc-transport.d.ts.map +1 -1
- package/esm/types/domain/Agent.d.ts +1 -1
- package/esm/types/domain/Agent.d.ts.map +1 -1
- package/esm/types/domain/CallLog.d.ts +14 -26
- package/esm/types/domain/CallLog.d.ts.map +1 -1
- package/esm/types/domain/CallSession.d.ts +3 -4
- package/esm/types/domain/CallSession.d.ts.map +1 -1
- package/esm/types/domain/Contact.d.ts +8 -0
- package/esm/types/domain/Contact.d.ts.map +1 -1
- package/esm/types/domain/MeetingAuthorization.d.ts +6 -0
- package/esm/types/domain/MeetingAuthorization.d.ts.map +1 -1
- package/esm/types/domain/Phone/CTIPhone.d.ts +3 -1
- package/esm/types/domain/Phone/CTIPhone.d.ts.map +1 -1
- package/esm/types/domain/Phone/Phone.d.ts +13 -2
- package/esm/types/domain/Phone/Phone.d.ts.map +1 -1
- package/esm/types/domain/Phone/WebRTCPhone.d.ts +24 -20
- package/esm/types/domain/Phone/WebRTCPhone.d.ts.map +1 -1
- package/esm/types/domain/Room.d.ts +10 -12
- package/esm/types/domain/Room.d.ts.map +1 -1
- package/esm/types/domain/Session.d.ts +1 -1
- package/esm/types/domain/Session.d.ts.map +1 -1
- package/esm/types/domain/SipLine.d.ts +3 -3
- package/esm/types/domain/SipLine.d.ts.map +1 -1
- package/esm/types/domain/types.d.ts +64 -10
- package/esm/types/domain/types.d.ts.map +1 -1
- package/esm/types/index.d.ts +52 -314
- package/esm/types/index.d.ts.map +1 -1
- package/esm/types/lib/WazoSessionDescriptionHandler.d.ts +5 -4
- package/esm/types/lib/WazoSessionDescriptionHandler.d.ts.map +1 -1
- package/esm/types/service/CallApi.d.ts +3 -3
- package/esm/types/service/CallApi.d.ts.map +1 -1
- package/esm/types/service/IssueReporter.d.ts.map +1 -1
- package/esm/types/simple/Auth.d.ts +0 -40
- package/esm/types/simple/Auth.d.ts.map +1 -1
- package/esm/types/simple/Phone.d.ts +0 -113
- package/esm/types/simple/Phone.d.ts.map +1 -1
- package/esm/types/simple/Websocket.d.ts +0 -16
- package/esm/types/simple/Websocket.d.ts.map +1 -1
- package/esm/types/simple/index.d.ts +8 -8
- package/esm/types/simple/index.d.ts.map +1 -1
- package/esm/types/simple/room/Participant.d.ts +4 -3
- package/esm/types/simple/room/Participant.d.ts.map +1 -1
- package/esm/types/simple/room/Room.d.ts +29 -18
- package/esm/types/simple/room/Room.d.ts.map +1 -1
- package/esm/types/simple/room/SipRoom.d.ts +1 -1
- package/esm/types/simple/room/SipRoom.d.ts.map +1 -1
- package/esm/types/simple/room/Stream.d.ts +1 -1
- package/esm/types/simple/room/Stream.d.ts.map +1 -1
- package/esm/types/utils/PhoneNumberUtil.d.ts +1 -1
- package/esm/types/utils/PhoneNumberUtil.d.ts.map +1 -1
- package/esm/types/utils/api-requester.d.ts +1 -1
- package/esm/types/utils/api-requester.d.ts.map +1 -1
- package/esm/types/utils/sdp.d.ts +20 -5
- package/esm/types/utils/sdp.d.ts.map +1 -1
- package/esm/types/web-rtc-client.d.ts +51 -49
- package/esm/types/web-rtc-client.d.ts.map +1 -1
- package/esm/types/websocket-client.d.ts.map +1 -1
- package/esm/utils/__tests__/PhoneNumberUtil.test.js +0 -6
- package/esm/utils/__tests__/api-requester.test.js +0 -2
- package/esm/utils/__tests__/sdp.test.js +4 -18
- package/esm/utils/api-requester.js +1 -2
- package/esm/utils/sdp.js +8 -3
- package/esm/web-rtc-client.js +99 -136
- package/esm/websocket-client.js +1 -2
- package/index.js +1 -0
- package/lib/__tests__/api-client.test.js +0 -10
- package/lib/__tests__/web-rtc-client.test.js +2 -15
- package/lib/api/chatd.js +0 -1
- package/lib/api/dird.js +19 -22
- package/lib/checker/checks/ice-ipv4.js +2 -3
- package/lib/checker/checks/symmetric-nat.js +7 -4
- package/lib/domain/AdHocAPIConference.js +1 -1
- package/lib/domain/CallLog.js +1 -1
- package/lib/domain/Contact.js +2 -1
- package/lib/domain/MeetingAuthorization.js +6 -0
- package/lib/domain/Phone/CTIPhone.js +3 -1
- package/lib/domain/Phone/WebRTCPhone.js +16 -18
- package/lib/domain/Session.js +2 -2
- package/lib/domain/__tests__/Agent.test.js +0 -2
- package/lib/domain/__tests__/Call.test.js +0 -1
- package/lib/domain/__tests__/CallLog.test.js +0 -1
- package/lib/domain/__tests__/CallSession.test.js +1 -2
- package/lib/domain/__tests__/Contact.test.js +2 -4
- package/lib/domain/__tests__/IndirectTransfer.test.js +0 -1
- package/lib/domain/__tests__/Profile.test.js +0 -1
- package/lib/domain/__tests__/Room.test.js +1 -25
- package/lib/domain/__tests__/Session.test.js +13 -14
- package/lib/domain/__tests__/SipLine.test.js +2 -3
- package/lib/index.js +96 -99
- package/lib/lib/WazoSessionDescriptionHandler.js +9 -15
- package/lib/service/IssueReporter.js +1 -3
- package/lib/service/__tests__/IssueReporter.test.js +0 -1
- package/lib/simple/Phone.js +1 -1
- package/lib/simple/Websocket.js +2 -2
- package/lib/simple/index.js +4 -3
- package/lib/simple/room/Room.js +17 -15
- package/lib/simple/room/SipRoom.js +1 -1
- package/lib/simple/room/Stream.js +1 -2
- package/lib/simple/room/__tests__/Participant.test.js +0 -2
- package/lib/simple/room/__tests__/RemoteParticipant.test.js +1 -2
- package/lib/types/api/auth.d.ts +2 -2
- package/lib/types/api/auth.d.ts.map +1 -1
- package/lib/types/api/call-logd.d.ts +3 -3
- package/lib/types/api/call-logd.d.ts.map +1 -1
- package/lib/types/api/chatd.d.ts +9 -22
- package/lib/types/api/chatd.d.ts.map +1 -1
- package/lib/types/api/dird.d.ts +21 -14
- package/lib/types/api/dird.d.ts.map +1 -1
- package/lib/types/checker/checks/ice-ipv4.d.ts.map +1 -1
- package/lib/types/checker/checks/index.d.ts +1 -1
- package/lib/types/checker/checks/symmetric-nat.d.ts.map +1 -1
- package/lib/types/checker/checks/webrtc-transport.d.ts +2 -2
- package/lib/types/checker/checks/webrtc-transport.d.ts.map +1 -1
- package/lib/types/domain/Agent.d.ts +1 -1
- package/lib/types/domain/Agent.d.ts.map +1 -1
- package/lib/types/domain/CallLog.d.ts +14 -26
- package/lib/types/domain/CallLog.d.ts.map +1 -1
- package/lib/types/domain/CallSession.d.ts +3 -4
- package/lib/types/domain/CallSession.d.ts.map +1 -1
- package/lib/types/domain/Contact.d.ts +8 -0
- package/lib/types/domain/Contact.d.ts.map +1 -1
- package/lib/types/domain/MeetingAuthorization.d.ts +6 -0
- package/lib/types/domain/MeetingAuthorization.d.ts.map +1 -1
- package/lib/types/domain/Phone/CTIPhone.d.ts +3 -1
- package/lib/types/domain/Phone/CTIPhone.d.ts.map +1 -1
- package/lib/types/domain/Phone/Phone.d.ts +13 -2
- package/lib/types/domain/Phone/Phone.d.ts.map +1 -1
- package/lib/types/domain/Phone/WebRTCPhone.d.ts +24 -20
- package/lib/types/domain/Phone/WebRTCPhone.d.ts.map +1 -1
- package/lib/types/domain/Room.d.ts +10 -12
- package/lib/types/domain/Room.d.ts.map +1 -1
- package/lib/types/domain/Session.d.ts +1 -1
- package/lib/types/domain/Session.d.ts.map +1 -1
- package/lib/types/domain/SipLine.d.ts +3 -3
- package/lib/types/domain/SipLine.d.ts.map +1 -1
- package/lib/types/domain/types.d.ts +64 -10
- package/lib/types/domain/types.d.ts.map +1 -1
- package/lib/types/index.d.ts +52 -314
- package/lib/types/index.d.ts.map +1 -1
- package/lib/types/lib/WazoSessionDescriptionHandler.d.ts +5 -4
- package/lib/types/lib/WazoSessionDescriptionHandler.d.ts.map +1 -1
- package/lib/types/service/CallApi.d.ts +3 -3
- package/lib/types/service/CallApi.d.ts.map +1 -1
- package/lib/types/service/IssueReporter.d.ts.map +1 -1
- package/lib/types/simple/Auth.d.ts +0 -40
- package/lib/types/simple/Auth.d.ts.map +1 -1
- package/lib/types/simple/Phone.d.ts +0 -113
- package/lib/types/simple/Phone.d.ts.map +1 -1
- package/lib/types/simple/Websocket.d.ts +0 -16
- package/lib/types/simple/Websocket.d.ts.map +1 -1
- package/lib/types/simple/index.d.ts +8 -8
- package/lib/types/simple/index.d.ts.map +1 -1
- package/lib/types/simple/room/Participant.d.ts +4 -3
- package/lib/types/simple/room/Participant.d.ts.map +1 -1
- package/lib/types/simple/room/Room.d.ts +29 -18
- package/lib/types/simple/room/Room.d.ts.map +1 -1
- package/lib/types/simple/room/SipRoom.d.ts +1 -1
- package/lib/types/simple/room/SipRoom.d.ts.map +1 -1
- package/lib/types/simple/room/Stream.d.ts +1 -1
- package/lib/types/simple/room/Stream.d.ts.map +1 -1
- package/lib/types/utils/PhoneNumberUtil.d.ts +1 -1
- package/lib/types/utils/PhoneNumberUtil.d.ts.map +1 -1
- package/lib/types/utils/api-requester.d.ts +1 -1
- package/lib/types/utils/api-requester.d.ts.map +1 -1
- package/lib/types/utils/sdp.d.ts +20 -5
- package/lib/types/utils/sdp.d.ts.map +1 -1
- package/lib/types/web-rtc-client.d.ts +51 -49
- package/lib/types/web-rtc-client.d.ts.map +1 -1
- package/lib/types/websocket-client.d.ts.map +1 -1
- package/lib/utils/__tests__/PhoneNumberUtil.test.js +0 -6
- package/lib/utils/__tests__/api-requester.test.js +0 -2
- package/lib/utils/__tests__/sdp.test.js +6 -18
- package/lib/utils/api-requester.js +2 -3
- package/lib/utils/sdp.js +9 -3
- package/lib/web-rtc-client.js +105 -140
- package/lib/websocket-client.js +1 -2
- package/package.json +5 -18
- package/src/__tests__/api-client.test.ts +10 -19
- package/src/__tests__/web-rtc-client.test.ts +13 -25
- package/src/api/auth.ts +2 -5
- package/src/api/call-logd.ts +3 -3
- package/src/api/chatd.ts +10 -24
- package/src/api/dird.ts +33 -39
- package/src/checker/checks/ice-ipv4.ts +4 -5
- package/src/checker/checks/symmetric-nat.ts +11 -7
- package/src/checker/checks/webrtc-transport.ts +2 -2
- package/src/domain/AdHocAPIConference.ts +1 -1
- package/src/domain/Agent.ts +1 -1
- package/src/domain/CallLog.ts +19 -27
- package/src/domain/CallSession.ts +3 -4
- package/src/domain/Contact.ts +3 -1
- package/src/domain/MeetingAuthorization.ts +13 -0
- package/src/domain/Phone/CTIPhone.ts +5 -1
- package/src/domain/Phone/Phone.ts +12 -2
- package/src/domain/Phone/WebRTCPhone.ts +51 -52
- package/src/domain/Room.ts +12 -14
- package/src/domain/Session.ts +3 -3
- package/src/domain/SipLine.ts +3 -3
- package/src/domain/__tests__/Agent.test.ts +3 -5
- package/src/domain/__tests__/Call.test.ts +4 -5
- package/src/domain/__tests__/CallLog.test.ts +1 -3
- package/src/domain/__tests__/CallSession.test.ts +10 -11
- package/src/domain/__tests__/Contact.test.ts +2 -4
- package/src/domain/__tests__/IndirectTransfer.test.ts +6 -7
- package/src/domain/__tests__/Profile.test.ts +3 -4
- package/src/domain/__tests__/Room.test.ts +27 -51
- package/src/domain/__tests__/Session.test.ts +27 -28
- package/src/domain/__tests__/SipLine.test.ts +4 -5
- package/src/domain/types.ts +64 -11
- package/src/index.ts +52 -111
- package/src/lib/WazoSessionDescriptionHandler.ts +24 -30
- package/src/service/CallApi.ts +3 -3
- package/src/service/IssueReporter.ts +3 -5
- package/src/service/__tests__/IssueReporter.test.ts +1 -2
- package/src/simple/Auth.ts +1 -41
- package/src/simple/Phone.ts +9 -116
- package/src/simple/Websocket.ts +4 -20
- package/src/simple/index.ts +10 -9
- package/src/simple/room/Participant.ts +4 -3
- package/src/simple/room/Room.ts +44 -36
- package/src/simple/room/SipRoom.ts +4 -4
- package/src/simple/room/Stream.ts +2 -3
- package/src/simple/room/__tests__/Participant.test.ts +2 -4
- package/src/simple/room/__tests__/RemoteParticipant.test.ts +4 -3
- package/src/types/wazo.d.ts +1 -0
- package/src/utils/PhoneNumberUtil.ts +1 -1
- package/src/utils/__tests__/PhoneNumberUtil.test.ts +0 -6
- package/src/utils/__tests__/api-requester.test.ts +3 -4
- package/src/utils/__tests__/sdp.test.ts +16 -30
- package/src/utils/api-requester.ts +1 -4
- package/src/utils/sdp.ts +38 -17
- package/src/web-rtc-client.ts +196 -234
- package/src/websocket-client.ts +2 -3
- package/lib/.DS_Store +0 -0
package/src/domain/types.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import type { Session, UserAgentOptions as sipJsUserAgentOptions } from 'sip.js';
|
|
1
|
+
import type { Invitation, Inviter, Session as SipSession, UserAgentOptions as sipJsUserAgentOptions } from 'sip.js';
|
|
2
2
|
import { SessionDescriptionHandlerFactoryOptions } from 'sip.js/lib/platform/web';
|
|
3
|
+
import type { IncomingResponse as SipIncomingResponse } from 'sip.js/lib/core/messages/incoming-response';
|
|
4
|
+
import { Transport } from 'sip.js/lib/api';
|
|
3
5
|
import WazoSessionDescriptionHandler from '../lib/WazoSessionDescriptionHandler';
|
|
4
6
|
|
|
5
|
-
|
|
6
|
-
type TodoObject = object;
|
|
7
|
+
type GenericObject = Record<string, any>;
|
|
7
8
|
|
|
8
9
|
export type Token = string;
|
|
9
10
|
export type UUID = string;
|
|
@@ -46,7 +47,7 @@ export type Tenant = {
|
|
|
46
47
|
}>;
|
|
47
48
|
parent_uuid: UUID;
|
|
48
49
|
};
|
|
49
|
-
export type Group =
|
|
50
|
+
export type Group = GenericObject;
|
|
50
51
|
export type Policy = {
|
|
51
52
|
acl_templates: Array<string>;
|
|
52
53
|
// Deprecated
|
|
@@ -75,12 +76,12 @@ export type ListPoliciesResponse = {
|
|
|
75
76
|
total: number;
|
|
76
77
|
items: Array<Policy>;
|
|
77
78
|
};
|
|
78
|
-
export type AccessdGroup =
|
|
79
|
+
export type AccessdGroup = GenericObject;
|
|
79
80
|
export type Link = {
|
|
80
81
|
href: string;
|
|
81
82
|
rel: string;
|
|
82
83
|
};
|
|
83
|
-
|
|
84
|
+
type LocalLine = {
|
|
84
85
|
id: number;
|
|
85
86
|
endpoint_sip: {
|
|
86
87
|
id: number;
|
|
@@ -141,7 +142,7 @@ export type ConfdUser = {
|
|
|
141
142
|
groups: Array<AccessdGroup>;
|
|
142
143
|
incalls: Array<Record<string, any>>;
|
|
143
144
|
// @TODO
|
|
144
|
-
lines: Array<
|
|
145
|
+
lines: Array<LocalLine>;
|
|
145
146
|
forwards: {
|
|
146
147
|
busy: {
|
|
147
148
|
enable: boolean;
|
|
@@ -196,7 +197,7 @@ export type Node = {
|
|
|
196
197
|
calls: Array<Record<string, any>>; // @TODO
|
|
197
198
|
|
|
198
199
|
};
|
|
199
|
-
export type CallNode =
|
|
200
|
+
export type CallNode = GenericObject;
|
|
200
201
|
export type ListNodesResponse = {
|
|
201
202
|
items: Array<Node>;
|
|
202
203
|
};
|
|
@@ -204,8 +205,8 @@ export type ListCallNodesResponse = {
|
|
|
204
205
|
uuid: UUID;
|
|
205
206
|
items: Array<CallNode>;
|
|
206
207
|
};
|
|
207
|
-
export type GetTenantResponse =
|
|
208
|
-
export type GetUserResponse =
|
|
208
|
+
export type GetTenantResponse = GenericObject;
|
|
209
|
+
export type GetUserResponse = GenericObject;
|
|
209
210
|
export type CTITransfer = {
|
|
210
211
|
'flow': string;
|
|
211
212
|
'id': string;
|
|
@@ -217,7 +218,7 @@ export type CTITransfer = {
|
|
|
217
218
|
};
|
|
218
219
|
export type UserAgentOptions = sipJsUserAgentOptions & {
|
|
219
220
|
peerConnectionOptions?: Record<string, any>,
|
|
220
|
-
sessionDescriptionHandlerFactory: (session:
|
|
221
|
+
sessionDescriptionHandlerFactory: (session: SipSession, options: SessionDescriptionHandlerFactoryOptions) => WazoSessionDescriptionHandler,
|
|
221
222
|
};
|
|
222
223
|
export type UserAgentConfigOverrides = Partial<UserAgentOptions & {
|
|
223
224
|
traceSip: any,
|
|
@@ -253,3 +254,55 @@ export type ConnectionOptions = WebRtcConfig & {
|
|
|
253
254
|
audioDeviceOutput: string,
|
|
254
255
|
audioDeviceRing: string
|
|
255
256
|
};
|
|
257
|
+
export type IncomingResponse = SipIncomingResponse & { session: any };
|
|
258
|
+
|
|
259
|
+
export type PeerConnection = RTCPeerConnection & {
|
|
260
|
+
getRemoteStreams: () => MediaStream[],
|
|
261
|
+
getLocalStreams: () => MediaStream[],
|
|
262
|
+
onremovestream: (func: any) => void,
|
|
263
|
+
addStream: (stream: MediaStream) => void,
|
|
264
|
+
sfu: any
|
|
265
|
+
};
|
|
266
|
+
|
|
267
|
+
export type WazoSession = (Invitation | Inviter) & { remoteTag?: any, callId?: string };
|
|
268
|
+
|
|
269
|
+
export type WazoTransport = Transport & {
|
|
270
|
+
configuration: Record<string, any>,
|
|
271
|
+
connectPromise: Promise<any>,
|
|
272
|
+
disconnectPromise: Promise<any>,
|
|
273
|
+
disconnectResolve: any,
|
|
274
|
+
transitionState: any,
|
|
275
|
+
transitioningState: any;
|
|
276
|
+
_ws: any;
|
|
277
|
+
};
|
|
278
|
+
|
|
279
|
+
export type PhonebookResponseItem = {
|
|
280
|
+
phonebook_uuid: number;
|
|
281
|
+
firstname: string;
|
|
282
|
+
lastname: string;
|
|
283
|
+
number: string;
|
|
284
|
+
mobile?: string;
|
|
285
|
+
extension?: string;
|
|
286
|
+
number_other?: string;
|
|
287
|
+
email: string;
|
|
288
|
+
address: string;
|
|
289
|
+
enterprise: string;
|
|
290
|
+
birthday: string;
|
|
291
|
+
note: string;
|
|
292
|
+
id: string;
|
|
293
|
+
};
|
|
294
|
+
|
|
295
|
+
export type PresenceResponse = {
|
|
296
|
+
lines: Array<{
|
|
297
|
+
id: number;
|
|
298
|
+
state: string;
|
|
299
|
+
}>;
|
|
300
|
+
sessions: Array<{
|
|
301
|
+
mobile: boolean;
|
|
302
|
+
uuid: string;
|
|
303
|
+
}>;
|
|
304
|
+
state: string;
|
|
305
|
+
status: string;
|
|
306
|
+
user_uuid: string;
|
|
307
|
+
last_activity?: string,
|
|
308
|
+
};
|
package/src/index.ts
CHANGED
|
@@ -1,113 +1,54 @@
|
|
|
1
|
-
import ApiClient from './api-client';
|
|
2
|
-
import WebRTCClient from './web-rtc-client';
|
|
3
|
-
import WebSocketClient, { SOCKET_EVENTS } from './websocket-client';
|
|
4
|
-
import Emitter from './utils/Emitter';
|
|
5
|
-
import IssueReporter from './service/IssueReporter';
|
|
6
|
-
// Domain
|
|
7
|
-
import BadResponse from './domain/BadResponse';
|
|
8
|
-
import ServerError from './domain/ServerError';
|
|
9
|
-
import SFUNotAvailableError from './domain/SFUNotAvailableError';
|
|
10
|
-
import Call from './domain/Call';
|
|
11
|
-
import CallLog from './domain/CallLog';
|
|
12
|
-
import Recording from './domain/Recording';
|
|
13
|
-
import ChatMessage from './domain/ChatMessage';
|
|
14
|
-
import ChatRoom from './domain/ChatRoom';
|
|
15
|
-
import Contact from './domain/Contact';
|
|
16
|
-
import COUNTRIES from './domain/Country';
|
|
17
|
-
import Features from './domain/Features';
|
|
18
|
-
import ForwardOption, { FORWARD_KEYS } from './domain/ForwardOption';
|
|
19
|
-
import Line from './domain/Line';
|
|
20
|
-
import NotificationOptions from './domain/NotificationOptions';
|
|
21
|
-
import Profile, { STATE as PROFILE_STATE, LINE_STATE } from './domain/Profile';
|
|
22
|
-
import Session from './domain/Session';
|
|
23
|
-
import Voicemail from './domain/Voicemail';
|
|
24
|
-
import Relocation from './domain/Relocation';
|
|
25
|
-
import Room from './domain/Room';
|
|
26
|
-
import CallSession from './domain/CallSession';
|
|
27
|
-
import IndirectTransfer from './domain/IndirectTransfer';
|
|
28
|
-
import SwitchboardCall from './domain/SwitchboardCall';
|
|
29
|
-
import WebRTCPhone from './domain/Phone/WebRTCPhone';
|
|
30
|
-
import CTIPhone from './domain/Phone/CTIPhone';
|
|
31
|
-
import Meeting from './domain/Meeting';
|
|
32
|
-
import type { NewContact as NewContactType, ContactResponse as ContactResponseType, ContactsResponse as ContactsResponseType, ContactPersonalResponse as ContactPersonalResponseType, ContactMobileResponse as ContactMobileResponseType } from './domain/Contact';
|
|
33
|
-
import type { Phone as PhoneType, PhoneEventCallbacks as PhoneEventCallbacksType } from './domain/Phone/Phone';
|
|
34
|
-
import type { ChatUser as ChatUserType } from './domain/ChatMessage';
|
|
35
|
-
import type { Device as DeviceType } from './domain/Device/Device';
|
|
36
|
-
import type { WebSocketMessage as WebSocketMessageType } from './types/WebSocketMessage';
|
|
37
|
-
import DebugDevice from './domain/Device/DebugDevice';
|
|
38
|
-
import Checker from './checker/Checker';
|
|
39
|
-
import { PhoneNumberUtil, PhoneNumberFormat, AsYouTypeFormatter, getDisplayableNumber, getCallableNumber } from './utils/PhoneNumberUtil';
|
|
40
|
-
import ApiRequester from './utils/api-requester';
|
|
41
|
-
import type { DirectorySource as DirectorySourceType, DirectorySources as DirectorySourcesType } from './domain/DirectorySource';
|
|
42
|
-
import type { SwitchboardAnwseredQueuedCall as SwitchboardAnwseredQueuedCallType, SwitchboardAnwseredHeldCall as SwitchboardAnwseredHeldCallType, SwitchboardCallItem as SwitchboardCallItemType, SwitchboardCallItems as SwitchboardCallItemsType } from './domain/SwitchboardCall';
|
|
43
1
|
import Wazo from './simple/index';
|
|
44
|
-
import MeetingStatus from './domain/MeetingStatus';
|
|
45
|
-
import MeetingAuthorization from './domain/MeetingAuthorization';
|
|
46
|
-
import SipLine from './domain/SipLine';
|
|
47
|
-
import getApiClient from './service/getApiClient';
|
|
48
2
|
|
|
49
|
-
export
|
|
50
|
-
export
|
|
51
|
-
export
|
|
52
|
-
export
|
|
53
|
-
export
|
|
54
|
-
export
|
|
55
|
-
export
|
|
56
|
-
export
|
|
57
|
-
export
|
|
58
|
-
export
|
|
59
|
-
export
|
|
60
|
-
export
|
|
61
|
-
export
|
|
62
|
-
export
|
|
63
|
-
export
|
|
64
|
-
export
|
|
65
|
-
export default
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
DebugDevice,
|
|
102
|
-
PROFILE_STATE,
|
|
103
|
-
FORWARD_KEYS,
|
|
104
|
-
LINE_STATE,
|
|
105
|
-
SOCKET_EVENTS,
|
|
106
|
-
Wazo,
|
|
107
|
-
WebRTCPhone,
|
|
108
|
-
Meeting,
|
|
109
|
-
MeetingAuthorization,
|
|
110
|
-
MeetingStatus,
|
|
111
|
-
SipLine,
|
|
112
|
-
getApiClient,
|
|
113
|
-
};
|
|
3
|
+
export { default as Emitter } from './utils/Emitter';
|
|
4
|
+
export { default as IssueReporter } from './service/IssueReporter';
|
|
5
|
+
export { default as BadResponse } from './domain/BadResponse';
|
|
6
|
+
export { default as ServerError } from './domain/ServerError';
|
|
7
|
+
export { default as SFUNotAvailableError } from './domain/SFUNotAvailableError';
|
|
8
|
+
export { default as Call } from './domain/Call';
|
|
9
|
+
export { default as CallLog } from './domain/CallLog';
|
|
10
|
+
export { default as Recording } from './domain/Recording';
|
|
11
|
+
export { default as ChatMessage } from './domain/ChatMessage';
|
|
12
|
+
export { default as ChatRoom, RoomResponse } from './domain/ChatRoom';
|
|
13
|
+
export { default as Contact } from './domain/Contact';
|
|
14
|
+
export { default as COUNTRIES } from './domain/Country';
|
|
15
|
+
export { default as Features } from './domain/Features';
|
|
16
|
+
export { default as ForwardOption, FORWARD_KEYS } from './domain/ForwardOption';
|
|
17
|
+
export { default as Line } from './domain/Line';
|
|
18
|
+
export { default as NotificationOptions } from './domain/NotificationOptions';
|
|
19
|
+
export { default as Profile, STATE as PROFILE_STATE, LINE_STATE } from './domain/Profile';
|
|
20
|
+
export { default as Session } from './domain/Session';
|
|
21
|
+
export { default as Voicemail } from './domain/Voicemail';
|
|
22
|
+
export { default as Relocation } from './domain/Relocation';
|
|
23
|
+
export { default as Room } from './domain/Room';
|
|
24
|
+
export { default as CallSession } from './domain/CallSession';
|
|
25
|
+
export { default as IndirectTransfer } from './domain/IndirectTransfer';
|
|
26
|
+
export { default as SwitchboardCall } from './domain/SwitchboardCall';
|
|
27
|
+
export { default as WebRTCPhone } from './domain/Phone/WebRTCPhone';
|
|
28
|
+
export { default as CTIPhone } from './domain/Phone/CTIPhone';
|
|
29
|
+
export { default as Meeting, MeetingCreateArguments, MeetingUpdateArguments } from './domain/Meeting';
|
|
30
|
+
export { NewContact, ContactResponse, ContactsResponse, ContactPersonalResponse, ContactMobileResponse } from './domain/Contact';
|
|
31
|
+
export { Phone, PhoneEventCallbacks } from './domain/Phone/Phone';
|
|
32
|
+
export { ChatUser, ChatMessageResponse } from './domain/ChatMessage';
|
|
33
|
+
export { Device } from './domain/Device/Device';
|
|
34
|
+
export { default as DebugDevice } from './domain/Device/DebugDevice';
|
|
35
|
+
export { default as Checker } from './checker/Checker';
|
|
36
|
+
export { default as ApiRequester } from './utils/api-requester';
|
|
37
|
+
export { DirectorySource as Source, DirectorySources as Sources } from './domain/DirectorySource';
|
|
38
|
+
export { DirectorySource, DirectorySources } from './domain/DirectorySource';
|
|
39
|
+
export { SwitchboardAnwseredQueuedCall, SwitchboardAnwseredHeldCall, SwitchboardCallItem, SwitchboardCallItems } from './domain/SwitchboardCall';
|
|
40
|
+
export { default as MeetingStatus } from './domain/MeetingStatus';
|
|
41
|
+
export { default as MeetingAuthorization, RawMeetingAuthorization } from './domain/MeetingAuthorization';
|
|
42
|
+
export { default as SipLine } from './domain/SipLine';
|
|
43
|
+
export { default as getApiClient, setApiToken, setCurrentServer, setOnRefreshToken, setOnRefreshTokenError, setIsMobile } from './service/getApiClient';
|
|
44
|
+
export { default as CallApi } from './service/CallApi';
|
|
45
|
+
export { default as AdHocAPIConference } from './domain/AdHocAPIConference';
|
|
46
|
+
export { default as WebSocketClient, SOCKET_EVENTS } from './websocket-client';
|
|
47
|
+
export { default as WebRTCClient } from './web-rtc-client';
|
|
48
|
+
export { default as WazoApiClient } from './api-client';
|
|
49
|
+
export { default as Agent, AgentResponse, AgentArguments } from './domain/Agent';
|
|
50
|
+
export * from './types/WebSocketMessage';
|
|
51
|
+
export * from './utils/PhoneNumberUtil';
|
|
52
|
+
export * from './domain/types';
|
|
53
|
+
|
|
54
|
+
export default Wazo;
|
|
@@ -5,9 +5,9 @@ import type { MediaStreamFactory } from 'sip.js/lib/platform/web/session-descrip
|
|
|
5
5
|
import type { SessionDescriptionHandlerConfiguration } from 'sip.js/lib/platform/web/session-description-handler/session-description-handler-configuration';
|
|
6
6
|
import { SessionDescriptionHandler } from 'sip.js/lib/platform/web/session-description-handler/session-description-handler';
|
|
7
7
|
import { SessionDescriptionHandlerOptions } from 'sip.js/lib/platform/web/session-description-handler/session-description-handler-options';
|
|
8
|
-
import {
|
|
8
|
+
import { PeerConnection, WazoSession } from '../domain/types';
|
|
9
9
|
import IssueReporter from '../service/IssueReporter';
|
|
10
|
-
import { addIcesInAllBundles, fixSdp, parseCandidate } from '../utils/sdp';
|
|
10
|
+
import { type Candidate, addIcesInAllBundles, fixSdp, parseCandidate } from '../utils/sdp';
|
|
11
11
|
|
|
12
12
|
const wazoLogger = IssueReporter ? IssueReporter.loggerFor('webrtc-sdh') : console;
|
|
13
13
|
// Customized mediaStreamFactory allowing to send screensharing stream directory when upgrading
|
|
@@ -30,16 +30,16 @@ export const wazoMediaStreamFactory = (constraints: Record<string, any>): Promis
|
|
|
30
30
|
};
|
|
31
31
|
|
|
32
32
|
class WazoSessionDescriptionHandler extends SessionDescriptionHandler {
|
|
33
|
-
gatheredCandidates:
|
|
33
|
+
gatheredCandidates: Candidate[];
|
|
34
34
|
|
|
35
35
|
eventEmitter: EventEmitter;
|
|
36
36
|
|
|
37
37
|
isWeb: boolean;
|
|
38
38
|
|
|
39
|
-
session:
|
|
39
|
+
session: WazoSession;
|
|
40
40
|
|
|
41
41
|
// eslint-disable-next-line @typescript-eslint/default-param-last
|
|
42
|
-
constructor(logger: Logger, mediaStreamFactory: MediaStreamFactory, sessionDescriptionHandlerConfiguration: SessionDescriptionHandlerConfiguration, isWeb: boolean, session:
|
|
42
|
+
constructor(logger: Logger, mediaStreamFactory: MediaStreamFactory, sessionDescriptionHandlerConfiguration: SessionDescriptionHandlerConfiguration, isWeb: boolean, session: WazoSession) {
|
|
43
43
|
super(logger, mediaStreamFactory, sessionDescriptionHandlerConfiguration);
|
|
44
44
|
this.eventEmitter = new EventEmitter();
|
|
45
45
|
this.isWeb = isWeb;
|
|
@@ -74,7 +74,7 @@ class WazoSessionDescriptionHandler extends SessionDescriptionHandler {
|
|
|
74
74
|
}
|
|
75
75
|
|
|
76
76
|
// Callback on data channel creation
|
|
77
|
-
// @ts-ignore
|
|
77
|
+
// @ts-ignore: private
|
|
78
78
|
this.onDataChannel = options.onDataChannel;
|
|
79
79
|
// ICE will restart upon applying an offer created with the iceRestart option
|
|
80
80
|
const iceRestart = options.offerOptions ? options.offerOptions.iceRestart : false;
|
|
@@ -83,7 +83,7 @@ class WazoSessionDescriptionHandler extends SessionDescriptionHandler {
|
|
|
83
83
|
// We should wait for ice when iceRestart (reinvite) or for the first invite
|
|
84
84
|
// We shouldn't wait for ice when holding or resuming the call
|
|
85
85
|
// We shouldn't wait for ice when receiving a reinvite (eg: pendingReinviteAck = true)
|
|
86
|
-
// @ts-ignore
|
|
86
|
+
// @ts-ignore: private
|
|
87
87
|
const shouldWaitForIce = !this.session.pendingReinviteAck && (iceRestart || 'constraints' in options);
|
|
88
88
|
// ICE gathering timeout may be set on a per call basis, otherwise the configured default is used
|
|
89
89
|
const iceTimeout = options.iceGatheringTimeout === undefined ? this.sessionDescriptionHandlerConfiguration?.iceGatheringTimeout : options.iceGatheringTimeout;
|
|
@@ -105,7 +105,7 @@ class WazoSessionDescriptionHandler extends SessionDescriptionHandler {
|
|
|
105
105
|
});
|
|
106
106
|
|
|
107
107
|
if (event.candidate) {
|
|
108
|
-
// @ts-ignore
|
|
108
|
+
// @ts-ignore: we're possibly inject null candidates
|
|
109
109
|
this.gatheredCandidates.push(parseCandidate(event.candidate.candidate));
|
|
110
110
|
|
|
111
111
|
// When receiving a `srflx` or a `relay` candidate, consider the negotiation done.
|
|
@@ -130,10 +130,10 @@ class WazoSessionDescriptionHandler extends SessionDescriptionHandler {
|
|
|
130
130
|
}
|
|
131
131
|
})
|
|
132
132
|
.then(() => this.createLocalOfferOrAnswer(options))
|
|
133
|
-
.then((sessionDescription
|
|
133
|
+
.then((sessionDescription) => this.setLocalSessionDescription(sessionDescription))
|
|
134
134
|
.then(() => this.waitForIceGatheringComplete(iceRestart, iceTimeout))
|
|
135
135
|
.then(() => this.getLocalSessionDescription())
|
|
136
|
-
.then((description
|
|
136
|
+
.then((description) => {
|
|
137
137
|
const {
|
|
138
138
|
sdp,
|
|
139
139
|
} = description;
|
|
@@ -153,12 +153,11 @@ class WazoSessionDescriptionHandler extends SessionDescriptionHandler {
|
|
|
153
153
|
return {
|
|
154
154
|
type: description.type,
|
|
155
155
|
// Fix sdp only when no candidates
|
|
156
|
-
// @ts-ignore
|
|
157
156
|
sdp: fixSdp(sdp, this.gatheredCandidates, options && options.constraints ? options.constraints.video : false),
|
|
158
157
|
};
|
|
159
158
|
})
|
|
160
|
-
.then((sessionDescription
|
|
161
|
-
.then((sessionDescription
|
|
159
|
+
.then((sessionDescription) => this.applyModifiers(sessionDescription, modifiers))
|
|
160
|
+
.then((sessionDescription) => ({
|
|
162
161
|
body: sessionDescription.sdp,
|
|
163
162
|
contentType: 'application/sdp',
|
|
164
163
|
}))
|
|
@@ -209,18 +208,15 @@ class WazoSessionDescriptionHandler extends SessionDescriptionHandler {
|
|
|
209
208
|
}
|
|
210
209
|
|
|
211
210
|
// Closing senders via getLocalStreams, `getLocalStreams` is deprecated, we have to check if it exists.
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
// @ts-ignore
|
|
215
|
-
this.peerConnection?.getLocalStreams().forEach(stream => {
|
|
211
|
+
if ((this.peerConnection as PeerConnection)?.getLocalStreams) {
|
|
212
|
+
(this.peerConnection as PeerConnection)?.getLocalStreams().forEach(stream => {
|
|
216
213
|
stream.getTracks()
|
|
217
214
|
.filter((track: MediaStreamTrack) => track.enabled)
|
|
218
215
|
.forEach((track: MediaStreamTrack) => track.stop());
|
|
219
216
|
});
|
|
220
217
|
|
|
221
218
|
// Closing receivers via getRemoteStreams
|
|
222
|
-
|
|
223
|
-
this.peerConnection?.getRemoteStreams().forEach(stream => {
|
|
219
|
+
(this.peerConnection as PeerConnection)?.getRemoteStreams().forEach(stream => {
|
|
224
220
|
stream.getTracks()
|
|
225
221
|
.filter((track: MediaStreamTrack) => track.enabled)
|
|
226
222
|
.forEach((track: MediaStreamTrack) => track.stop());
|
|
@@ -365,8 +361,7 @@ class WazoSessionDescriptionHandler extends SessionDescriptionHandler {
|
|
|
365
361
|
|
|
366
362
|
// set the transceiver direction to the answer direction
|
|
367
363
|
this._peerConnection.getTransceivers().forEach(transceiver => {
|
|
368
|
-
|
|
369
|
-
if (transceiver.stopped) {
|
|
364
|
+
if ((transceiver as RTCRtpTransceiver & { stopped: boolean }).stopped) {
|
|
370
365
|
return;
|
|
371
366
|
}
|
|
372
367
|
|
|
@@ -411,7 +406,7 @@ class WazoSessionDescriptionHandler extends SessionDescriptionHandler {
|
|
|
411
406
|
throw new Error('Peer connection undefined.');
|
|
412
407
|
}
|
|
413
408
|
|
|
414
|
-
const pc
|
|
409
|
+
const pc = this._peerConnection as PeerConnection;
|
|
415
410
|
const {
|
|
416
411
|
sfu,
|
|
417
412
|
} = pc;
|
|
@@ -427,7 +422,7 @@ class WazoSessionDescriptionHandler extends SessionDescriptionHandler {
|
|
|
427
422
|
throw new Error(`Unknown new track kind ${kind}.`);
|
|
428
423
|
}
|
|
429
424
|
|
|
430
|
-
const sender = pc.getSenders && pc.getSenders().find((otherSender
|
|
425
|
+
const sender = pc.getSenders && pc.getSenders().find((otherSender) => otherSender.track && otherSender.track.kind === kind);
|
|
431
426
|
|
|
432
427
|
// Do not reuse sender video tracks in SFU
|
|
433
428
|
if (sender && (!sfu || newTrack.kind === 'audio')) {
|
|
@@ -445,12 +440,12 @@ class WazoSessionDescriptionHandler extends SessionDescriptionHandler {
|
|
|
445
440
|
if (oldTrack) {
|
|
446
441
|
oldTrack.stop();
|
|
447
442
|
localStream.removeTrack(oldTrack);
|
|
448
|
-
// @ts-ignore
|
|
443
|
+
// @ts-ignore: private
|
|
449
444
|
SessionDescriptionHandler.dispatchRemoveTrackEvent(localStream, oldTrack);
|
|
450
445
|
}
|
|
451
446
|
|
|
452
447
|
localStream.addTrack(newTrack);
|
|
453
|
-
// @ts-ignore
|
|
448
|
+
// @ts-ignore: private
|
|
454
449
|
SessionDescriptionHandler.dispatchAddTrackEvent(localStream, newTrack);
|
|
455
450
|
}).catch((error: Error) => {
|
|
456
451
|
this.logger.error(`SessionDescriptionHandler.setLocalMediaStream - failed to replace sender ${kind} track`);
|
|
@@ -475,7 +470,7 @@ class WazoSessionDescriptionHandler extends SessionDescriptionHandler {
|
|
|
475
470
|
}
|
|
476
471
|
|
|
477
472
|
localStream.addTrack(newTrack);
|
|
478
|
-
// @ts-ignore
|
|
473
|
+
// @ts-ignore: private
|
|
479
474
|
SessionDescriptionHandler.dispatchAddTrackEvent(localStream, newTrack);
|
|
480
475
|
}));
|
|
481
476
|
}
|
|
@@ -510,10 +505,10 @@ class WazoSessionDescriptionHandler extends SessionDescriptionHandler {
|
|
|
510
505
|
} : {};
|
|
511
506
|
|
|
512
507
|
// if we already have a local media stream...
|
|
513
|
-
// @ts-ignore
|
|
508
|
+
// @ts-ignore: private
|
|
514
509
|
if (this.localMediaStreamConstraints) {
|
|
515
510
|
// if constraints have not changed, do not get a new media stream
|
|
516
|
-
// @ts-ignore
|
|
511
|
+
// @ts-ignore: private
|
|
517
512
|
if (JSON.stringify(this.localMediaStreamConstraints.audio) === JSON.stringify(constraints.audio) && JSON.stringify(this.localMediaStreamConstraints.video) === JSON.stringify(constraints.video)) {
|
|
518
513
|
return Promise.resolve();
|
|
519
514
|
}
|
|
@@ -524,9 +519,8 @@ class WazoSessionDescriptionHandler extends SessionDescriptionHandler {
|
|
|
524
519
|
};
|
|
525
520
|
}
|
|
526
521
|
|
|
527
|
-
// @ts-ignore
|
|
522
|
+
// @ts-ignore: private
|
|
528
523
|
this.localMediaStreamConstraints = constraints;
|
|
529
|
-
// @ts-ignore
|
|
530
524
|
return this.mediaStreamFactory(constraints, this).then(mediaStream => {
|
|
531
525
|
this.setLocalMediaStream(mediaStream);
|
|
532
526
|
return mediaStream;
|
package/src/service/CallApi.ts
CHANGED
|
@@ -8,7 +8,7 @@ import getApiClient from './getApiClient';
|
|
|
8
8
|
import Transfer from '../domain/IndirectTransfer';
|
|
9
9
|
|
|
10
10
|
export default class CallApi {
|
|
11
|
-
static async fetchCallLogs(offset: number, limit
|
|
11
|
+
static async fetchCallLogs(offset: number, limit?: number): Promise<CallLog[]> {
|
|
12
12
|
return getApiClient().callLogd.listCallLogs(offset, limit);
|
|
13
13
|
}
|
|
14
14
|
|
|
@@ -24,11 +24,11 @@ export default class CallApi {
|
|
|
24
24
|
return getApiClient().callLogd.listCallLogsFromDate(from, number);
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
-
static async search(query: string, limit
|
|
27
|
+
static async search(query: string, limit?: number): Promise<CallLog[]> {
|
|
28
28
|
return getApiClient().callLogd.search(query, limit);
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
-
static async searchBy(field: string, value: string, limit
|
|
31
|
+
static async searchBy(field: string, value: string, limit?: number): Promise<CallLog[]> {
|
|
32
32
|
return getApiClient().callLogd.searchBy(field, value, limit);
|
|
33
33
|
}
|
|
34
34
|
|
|
@@ -168,8 +168,7 @@ class IssueReporter {
|
|
|
168
168
|
errorMessage: lastArg.message,
|
|
169
169
|
errorStack: lastArg.stack,
|
|
170
170
|
errorType: lastArg.constructor.name,
|
|
171
|
-
|
|
172
|
-
skipSendToRemote: lastArg.skipSendToRemote,
|
|
171
|
+
skipSendToRemote: (lastArg as Error & { skipSendToRemote: boolean }).skipSendToRemote,
|
|
173
172
|
};
|
|
174
173
|
} else {
|
|
175
174
|
extra = lastArg;
|
|
@@ -263,7 +262,7 @@ class IssueReporter {
|
|
|
263
262
|
this.oldConsoleMethods = {};
|
|
264
263
|
CONSOLE_METHODS.forEach((methodName: string) => {
|
|
265
264
|
if (this.oldConsoleMethods) {
|
|
266
|
-
// @ts-ignore
|
|
265
|
+
// @ts-ignore: keys
|
|
267
266
|
// eslint-disable-next-line
|
|
268
267
|
this.oldConsoleMethods[methodName] = console[methodName];
|
|
269
268
|
}
|
|
@@ -391,8 +390,7 @@ class IssueReporter {
|
|
|
391
390
|
'Content-Type': 'application/json',
|
|
392
391
|
},
|
|
393
392
|
body,
|
|
394
|
-
}).catch((e: Error) => {
|
|
395
|
-
// @ts-ignore
|
|
393
|
+
}).catch((e: Error & { skipSendToRemote?: boolean }) => {
|
|
396
394
|
e.skipSendToRemote = true;
|
|
397
395
|
this.log('error', this._makeCategory('grafana'), 'Sending log to grafana, error', e);
|
|
398
396
|
// wait at least 1 second, at most 50 seconds
|
package/src/simple/Auth.ts
CHANGED
|
@@ -26,47 +26,7 @@ export class NoTenantIdError extends Error {}
|
|
|
26
26
|
export class NoDomainNameError extends Error {}
|
|
27
27
|
const logger = IssueReporter.loggerFor('simple-auth');
|
|
28
28
|
|
|
29
|
-
|
|
30
|
-
clientId: string;
|
|
31
|
-
expiration: number;
|
|
32
|
-
minSubscriptionType: number | null;
|
|
33
|
-
authorizationName: string | null;
|
|
34
|
-
host: string | null;
|
|
35
|
-
session: Session | null;
|
|
36
|
-
onRefreshTokenCallback: ((...args: Array<any>) => any) | null;
|
|
37
|
-
onRefreshTokenCallbackError: ((...args: Array<any>) => any) | null;
|
|
38
|
-
authenticated: boolean;
|
|
39
|
-
mobile: boolean;
|
|
40
|
-
BACKEND_WAZO: string;
|
|
41
|
-
BACKEND_LDAP: string;
|
|
42
|
-
init: (clientId: string, expiration: number, minSubscriptionType: number | null | undefined, authorizationName: string | null, mobile: boolean) => void;
|
|
43
|
-
setFetchOptions: (options: Record<string, any>) => void;
|
|
44
|
-
logIn: (username: string, password: string, backend?: string, extra?: string | Record<string, any>) => Promise<Session | null>;
|
|
45
|
-
logInViaRefreshToken: (refreshToken: string) => Promise<Session | null>;
|
|
46
|
-
validateToken: (token: string, refreshToken: string) => Promise<Session | undefined | null>;
|
|
47
|
-
generateNewToken: (refreshToken: string) => Promise<Session | null | undefined>;
|
|
48
|
-
logout: (deleteRefreshToken?: boolean) => Promise<void>;
|
|
49
|
-
setOnRefreshToken: (callback: (...args: Array<any>) => any) => void;
|
|
50
|
-
setOnRefreshTokenError: (callback: (...args: Array<any>) => any) => void;
|
|
51
|
-
checkAuthorizations: (session: Session, authorizationName: string | null | undefined) => void;
|
|
52
|
-
checkSubscription: (session: Session, minSubscriptionType: number) => void;
|
|
53
|
-
setHost: (host: string) => void;
|
|
54
|
-
setApiToken: (token: string) => void;
|
|
55
|
-
setRefreshToken: (refreshToken: string) => void ;
|
|
56
|
-
setRefreshTenantId: (refreshTenantId: string) => void;
|
|
57
|
-
setRefreshDomainName: (domainName: string) => void;
|
|
58
|
-
forceRefreshToken: () => void;
|
|
59
|
-
setIsMobile: (mobile: boolean) => void ;
|
|
60
|
-
getHost: () => string | undefined;
|
|
61
|
-
getSession: () => Session | undefined;
|
|
62
|
-
getFirstName: () => string;
|
|
63
|
-
getLastName: () => string;
|
|
64
|
-
setClientId: (clientId: string) => void;
|
|
65
|
-
getName: () => string ;
|
|
66
|
-
_onAuthenticated: (rawSession: Session) => Promise<Session | null>;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
class Auth implements IAuth {
|
|
29
|
+
class Auth {
|
|
70
30
|
clientId: string;
|
|
71
31
|
|
|
72
32
|
expiration: number;
|