@signalwire/js 1.3.0-dev.1 → 1.4.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.
- package/README.md +4 -2
- package/dist/esm/common/src/BaseSession.d.ts +8 -13
- package/dist/esm/common/src/BaseSession.js +33 -46
- package/dist/esm/common/src/BrowserSession.d.ts +20 -57
- package/dist/esm/common/src/BrowserSession.js +91 -359
- package/dist/esm/common/src/messages/Verto.d.ts +1 -10
- package/dist/esm/common/src/messages/Verto.js +1 -16
- package/dist/esm/common/src/messages/verto/Login.d.ts +1 -13
- package/dist/esm/common/src/messages/verto/Login.js +2 -5
- package/dist/esm/common/src/services/BroadcastHandler.js +3 -2
- package/dist/esm/common/src/services/Connection.d.ts +2 -2
- package/dist/esm/common/src/services/Handler.d.ts +8 -9
- package/dist/esm/common/src/services/Handler.js +38 -41
- package/dist/esm/common/src/util/constants/index.d.ts +0 -1
- package/dist/esm/common/src/util/constants/index.js +0 -1
- package/dist/esm/common/src/util/helpers.d.ts +10 -3
- package/dist/esm/common/src/util/helpers.js +11 -6
- package/dist/esm/common/src/util/interfaces.d.ts +56 -21
- package/dist/esm/common/src/util/interfaces.js +1 -0
- package/dist/esm/common/src/util/logger.js +1 -4
- package/dist/esm/common/src/util/webrtc/index.d.ts +2 -7
- package/dist/esm/common/src/util/webrtc/index.js +2 -63
- package/dist/esm/common/src/webrtc/BaseCall.d.ts +79 -0
- package/dist/esm/common/src/webrtc/BaseCall.js +711 -0
- package/dist/esm/common/src/webrtc/Call.d.ts +5 -5
- package/dist/esm/common/src/webrtc/Call.js +15 -34
- package/dist/esm/common/src/webrtc/CantinaAuth.d.ts +14 -9
- package/dist/esm/common/src/webrtc/CantinaAuth.js +18 -24
- package/dist/esm/common/src/webrtc/LayoutHandler.d.ts +3 -0
- package/dist/esm/common/src/webrtc/LayoutHandler.js +36 -0
- package/dist/esm/common/src/webrtc/Peer.d.ts +23 -0
- package/dist/esm/common/src/webrtc/Peer.js +169 -0
- package/dist/esm/common/src/webrtc/VertoHandler.d.ts +11 -2
- package/dist/esm/common/src/webrtc/VertoHandler.js +187 -147
- package/dist/esm/common/src/webrtc/constants.d.ts +12 -27
- package/dist/esm/common/src/webrtc/constants.js +11 -33
- package/dist/esm/common/src/webrtc/helpers.d.ts +25 -19
- package/dist/esm/common/src/webrtc/helpers.js +190 -162
- package/dist/esm/common/src/webrtc/interfaces.d.ts +52 -209
- package/dist/esm/common/src/webrtc/interfaces.js +1 -0
- package/dist/esm/js/index.d.ts +1 -3
- package/dist/esm/js/index.js +2 -2
- package/dist/esm/js/src/SignalWire.d.ts +2 -0
- package/dist/esm/js/src/SignalWire.js +13 -0
- package/dist/esm/js/src/Verto.d.ts +2 -8
- package/dist/esm/js/src/Verto.js +14 -50
- package/dist/index.min.js +2 -6
- package/dist/index.min.js.LICENSE.txt +5 -0
- package/package.json +24 -19
- package/dist/esm/common/src/webrtc/ChatChannelHandler.d.ts +0 -5
- package/dist/esm/common/src/webrtc/ChatChannelHandler.js +0 -22
- package/dist/esm/common/src/webrtc/Conference.d.ts +0 -15
- package/dist/esm/common/src/webrtc/Conference.js +0 -68
- package/dist/esm/common/src/webrtc/ConferenceListChannelHandler.d.ts +0 -5
- package/dist/esm/common/src/webrtc/ConferenceListChannelHandler.js +0 -77
- package/dist/esm/common/src/webrtc/InfoChannelHandler.d.ts +0 -7
- package/dist/esm/common/src/webrtc/InfoChannelHandler.js +0 -85
- package/dist/esm/common/src/webrtc/LaChannelHandler.d.ts +0 -5
- package/dist/esm/common/src/webrtc/LaChannelHandler.js +0 -58
- package/dist/esm/common/src/webrtc/ModChannelHandler.d.ts +0 -71
- package/dist/esm/common/src/webrtc/ModChannelHandler.js +0 -267
- package/dist/esm/common/src/webrtc/RTCPeer.d.ts +0 -51
- package/dist/esm/common/src/webrtc/RTCPeer.js +0 -556
- package/dist/esm/common/src/webrtc/WebRTCCall.d.ts +0 -182
- package/dist/esm/common/src/webrtc/WebRTCCall.js +0 -784
- package/dist/esm/common/src/webrtc/deviceHelpers.d.ts +0 -18
- package/dist/esm/common/src/webrtc/deviceHelpers.js +0 -113
- package/dist/esm/common/src/webrtc/sdpHelpers.d.ts +0 -3
- package/dist/esm/common/src/webrtc/sdpHelpers.js +0 -56
package/dist/esm/js/index.js
CHANGED
|
@@ -2,7 +2,7 @@ import Relay from './src/SignalWire';
|
|
|
2
2
|
import Verto from './src/Verto';
|
|
3
3
|
import { setAgentName } from '../common/src/messages/blade/Connect';
|
|
4
4
|
import CantinaAuth from '../common/src/webrtc/CantinaAuth';
|
|
5
|
-
export const VERSION = '1.
|
|
5
|
+
export const VERSION = '1.4.0';
|
|
6
6
|
setAgentName(`JavaScript SDK/${VERSION}`);
|
|
7
7
|
export { Relay, Verto, CantinaAuth };
|
|
8
|
-
export * from '../common/src/
|
|
8
|
+
export * from '../common/src/util/interfaces';
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import BrowserSession from '../../common/src/BrowserSession';
|
|
2
|
+
import BaseMessage from '../../common/src/messages/BaseMessage';
|
|
2
3
|
import { CallOptions } from '../../common/src/webrtc/interfaces';
|
|
3
4
|
import Call from '../../common/src/webrtc/Call';
|
|
4
5
|
export default class SignalWire extends BrowserSession {
|
|
6
|
+
execute(message: BaseMessage): any;
|
|
5
7
|
newCall(options: CallOptions): Promise<Call>;
|
|
6
8
|
}
|
|
@@ -8,8 +8,21 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
10
|
import BrowserSession from '../../common/src/BrowserSession';
|
|
11
|
+
import { Execute } from '../../common/src/messages/Blade';
|
|
12
|
+
import BaseRequest from '../../common/src/messages/verto/BaseRequest';
|
|
11
13
|
import Call from '../../common/src/webrtc/Call';
|
|
12
14
|
export default class SignalWire extends BrowserSession {
|
|
15
|
+
execute(message) {
|
|
16
|
+
let msg = message;
|
|
17
|
+
if (message instanceof BaseRequest) {
|
|
18
|
+
const params = { message: message.request };
|
|
19
|
+
if (message.targetNodeId) {
|
|
20
|
+
params.node_id = message.targetNodeId;
|
|
21
|
+
}
|
|
22
|
+
msg = new Execute({ protocol: this.relayProtocol, method: 'message', params });
|
|
23
|
+
}
|
|
24
|
+
return super.execute(msg);
|
|
25
|
+
}
|
|
13
26
|
newCall(options) {
|
|
14
27
|
return __awaiter(this, void 0, void 0, function* () {
|
|
15
28
|
const { destinationNumber = null } = options;
|
|
@@ -2,21 +2,15 @@ import BrowserSession from '../../common/src/BrowserSession';
|
|
|
2
2
|
import { SubscribeParams, BroadcastParams } from '../../common/src/util/interfaces';
|
|
3
3
|
import { CallOptions } from '../../common/src/webrtc/interfaces';
|
|
4
4
|
import Call from '../../common/src/webrtc/Call';
|
|
5
|
-
|
|
5
|
+
export declare const VERTO_PROTOCOL = "verto-protocol";
|
|
6
6
|
export default class Verto extends BrowserSession {
|
|
7
7
|
relayProtocol: string;
|
|
8
8
|
timeoutErrorCode: number;
|
|
9
|
-
loginResponse: any;
|
|
10
|
-
moderator: boolean;
|
|
11
|
-
superuser: boolean;
|
|
12
9
|
validateOptions(): boolean;
|
|
13
10
|
newCall(options: CallOptions): Call;
|
|
14
|
-
broadcast(params: BroadcastParams):
|
|
11
|
+
broadcast(params: BroadcastParams): void;
|
|
15
12
|
subscribe(params: SubscribeParams): Promise<any>;
|
|
16
13
|
unsubscribe(params: SubscribeParams): Promise<any>;
|
|
17
|
-
ping(): any;
|
|
18
|
-
_wrapInExecute(message: BaseMessage): BaseMessage;
|
|
19
|
-
vertoLogin(): Promise<any>;
|
|
20
14
|
protected _onSocketOpen(): Promise<void>;
|
|
21
15
|
protected _onSocketMessage(msg: any): void;
|
|
22
16
|
}
|
package/dist/esm/js/src/Verto.js
CHANGED
|
@@ -8,20 +8,18 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
10
|
import BrowserSession from '../../common/src/BrowserSession';
|
|
11
|
-
import { Login
|
|
11
|
+
import { Login } from '../../common/src/messages/Verto';
|
|
12
12
|
import Call from '../../common/src/webrtc/Call';
|
|
13
|
-
import { SwEvent, SESSION_ID
|
|
13
|
+
import { SwEvent, SESSION_ID } from '../../common/src/util/constants';
|
|
14
14
|
import { trigger } from '../../common/src/services/Handler';
|
|
15
15
|
import { localStorage } from '../../common/src/util/storage/';
|
|
16
16
|
import VertoHandler from '../../common/src/webrtc/VertoHandler';
|
|
17
|
+
export const VERTO_PROTOCOL = 'verto-protocol';
|
|
17
18
|
export default class Verto extends BrowserSession {
|
|
18
19
|
constructor() {
|
|
19
20
|
super(...arguments);
|
|
20
21
|
this.relayProtocol = VERTO_PROTOCOL;
|
|
21
22
|
this.timeoutErrorCode = -329990;
|
|
22
|
-
this.loginResponse = {};
|
|
23
|
-
this.moderator = false;
|
|
24
|
-
this.superuser = false;
|
|
25
23
|
}
|
|
26
24
|
validateOptions() {
|
|
27
25
|
const { host, login, passwd, password } = this.options;
|
|
@@ -45,60 +43,26 @@ export default class Verto extends BrowserSession {
|
|
|
45
43
|
unsubscribe(params) {
|
|
46
44
|
return this.vertoUnsubscribe(params);
|
|
47
45
|
}
|
|
48
|
-
|
|
49
|
-
const msg = new Ping({ serno: Date.now() });
|
|
50
|
-
return this.execute(msg);
|
|
51
|
-
}
|
|
52
|
-
_wrapInExecute(message) {
|
|
53
|
-
return message;
|
|
54
|
-
}
|
|
55
|
-
vertoLogin() {
|
|
46
|
+
_onSocketOpen() {
|
|
56
47
|
return __awaiter(this, void 0, void 0, function* () {
|
|
57
|
-
|
|
58
|
-
const
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
callIds: this._experimental ? this.callIds : [],
|
|
65
|
-
});
|
|
48
|
+
this._idle = false;
|
|
49
|
+
const { login, password, passwd, userVariables } = this.options;
|
|
50
|
+
if (this.sessionid) {
|
|
51
|
+
const sessidLogin = new Login(undefined, undefined, this.sessionid, undefined);
|
|
52
|
+
yield this.execute(sessidLogin).catch(console.error);
|
|
53
|
+
}
|
|
54
|
+
const msg = new Login(login, (password || passwd), this.sessionid, userVariables);
|
|
66
55
|
const response = yield this.execute(msg).catch(this._handleLoginError);
|
|
67
56
|
if (response) {
|
|
68
57
|
this._autoReconnect = true;
|
|
69
|
-
this._idle = false;
|
|
70
|
-
this.loginResponse = response;
|
|
71
|
-
this.moderator = response.moderator || false;
|
|
72
|
-
this.superuser = response.superuser || false;
|
|
73
58
|
this.sessionid = response.sessid;
|
|
74
|
-
|
|
75
|
-
this.authorization = {
|
|
76
|
-
expires_at: response['auth-expires'],
|
|
77
|
-
signature: null,
|
|
78
|
-
project: null,
|
|
79
|
-
scope_id: null,
|
|
80
|
-
scopes: [],
|
|
81
|
-
resource: null,
|
|
82
|
-
};
|
|
83
|
-
this._checkTokenExpiration();
|
|
84
|
-
}
|
|
85
|
-
if (!this.incognito) {
|
|
86
|
-
localStorage.setItem(SESSION_ID, this.sessionid);
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
return response;
|
|
90
|
-
});
|
|
91
|
-
}
|
|
92
|
-
_onSocketOpen() {
|
|
93
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
94
|
-
this._idle = false;
|
|
95
|
-
const response = yield this.vertoLogin();
|
|
96
|
-
if (response) {
|
|
59
|
+
localStorage.setItem(SESSION_ID, this.sessionid);
|
|
97
60
|
trigger(SwEvent.Ready, this, this.uuid);
|
|
98
61
|
}
|
|
99
62
|
});
|
|
100
63
|
}
|
|
101
64
|
_onSocketMessage(msg) {
|
|
102
|
-
VertoHandler(this
|
|
65
|
+
const handler = new VertoHandler(this);
|
|
66
|
+
handler.handleMessage(msg);
|
|
103
67
|
}
|
|
104
68
|
}
|