@vonage/client-sdk 0.1.3-alpha.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/LICENSE +3 -0
- package/README.md +24 -0
- package/dist/Client.d.ts +17 -0
- package/dist/Client.js +30 -0
- package/dist/HttpClient.d.ts +8 -0
- package/dist/HttpClient.js +59 -0
- package/dist/MediaClient.d.ts +16 -0
- package/dist/MediaClient.js +103 -0
- package/dist/SocketClient.d.ts +12 -0
- package/dist/SocketClient.js +79 -0
- package/dist/coreExtend.d.ts +10 -0
- package/dist/coreExtend.js +3 -0
- package/dist/global.d.ts +7 -0
- package/dist/global.js +2 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +7 -0
- package/dist/kotlin/Kermit-kermit-js-ir.js +263 -0
- package/dist/kotlin/Kermit-kermit-js-ir.js.map +1 -0
- package/dist/kotlin/clientsdk-clientcore.js +20359 -0
- package/dist/kotlin/clientsdk-clientcore.js.map +1 -0
- package/dist/kotlin/clientsdk-clientcore_js.d.ts +98 -0
- package/dist/kotlin/clientsdk-clientcore_js.js +949 -0
- package/dist/kotlin/clientsdk-clientcore_js.js.map +1 -0
- package/dist/kotlin/kotlin-kotlin-stdlib-js-ir.js +11717 -0
- package/dist/kotlin/kotlin-kotlin-stdlib-js-ir.js.map +1 -0
- package/dist/kotlin/kotlinx-serialization-kotlinx-serialization-core-js-ir.js +6048 -0
- package/dist/kotlin/kotlinx-serialization-kotlinx-serialization-core-js-ir.js.map +1 -0
- package/dist/kotlin/kotlinx-serialization-kotlinx-serialization-json-js-ir.js +5530 -0
- package/dist/kotlin/kotlinx-serialization-kotlinx-serialization-json-js-ir.js.map +1 -0
- package/dist/utils/createRtcAudioConnection.d.ts +5 -0
- package/dist/utils/createRtcAudioConnection.js +85 -0
- package/package.json +51 -0
package/LICENSE
ADDED
package/README.md
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# Vonage Voice SDK
|
|
2
|
+
|
|
3
|
+
## Install
|
|
4
|
+
|
|
5
|
+
### 1. Create a Personal Access Token
|
|
6
|
+
|
|
7
|
+
- generate token, see [here](https://docs.github.com/en/enterprise-server@3.4/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token ), you will need a PAT with `packages:read` scope enabled
|
|
8
|
+
- enable SSO for new token, see [here](https://docs.github.com/en/enterprise-cloud@latest/authentication/authenticating-with-saml-single-sign-on/authorizing-a-personal-access-token-for-use-with-saml-single-sign-on)
|
|
9
|
+
|
|
10
|
+
### 2. Authenticate with Github packages
|
|
11
|
+
|
|
12
|
+
```
|
|
13
|
+
$ npm login --scope=@nexmoinc --registry=https://npm.pkg.github.com
|
|
14
|
+
|
|
15
|
+
> Username: USERNAME //github user
|
|
16
|
+
> Password: TOKEN // Personal access token
|
|
17
|
+
> Email: github email
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
### 3. Add dependency
|
|
21
|
+
|
|
22
|
+
```
|
|
23
|
+
npm install @nexmoinc/voice-sdk
|
|
24
|
+
```
|
package/dist/Client.d.ts
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { vonage } from './kotlin/clientsdk-clientcore_js';
|
|
2
|
+
import './coreExtend';
|
|
3
|
+
import './global';
|
|
4
|
+
/**
|
|
5
|
+
* Minimal Interface built on top of KMP export
|
|
6
|
+
* DO NOT ADD CODE HERE UNLESS REALLY NEEDEED!!111!
|
|
7
|
+
*/
|
|
8
|
+
export declare type VonageEvent = vonage.CoreClientEvents;
|
|
9
|
+
export declare type Invite = vonage.VoiceInviteJS;
|
|
10
|
+
export declare type VoiceCall = vonage.VoiceCallJS;
|
|
11
|
+
export declare type Conversation = vonage.ConversationJS;
|
|
12
|
+
declare class VoiceClient extends vonage.CoreClientJS {
|
|
13
|
+
private callbacks;
|
|
14
|
+
constructor();
|
|
15
|
+
on<T extends keyof VonageEvent, Fn extends VonageEvent[T]>(event: T, callback: Fn): void;
|
|
16
|
+
}
|
|
17
|
+
export default VoiceClient;
|
package/dist/Client.js
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const clientsdk_clientcore_js_1 = require("./kotlin/clientsdk-clientcore_js");
|
|
4
|
+
require("./coreExtend");
|
|
5
|
+
const HttpClient_1 = require("./HttpClient");
|
|
6
|
+
const MediaClient_1 = require("./MediaClient");
|
|
7
|
+
const SocketClient_1 = require("./SocketClient");
|
|
8
|
+
require("./global");
|
|
9
|
+
class VoiceClient extends clientsdk_clientcore_js_1.vonage.CoreClientJS {
|
|
10
|
+
constructor() {
|
|
11
|
+
super(new HttpClient_1.default(), new SocketClient_1.default(), new MediaClient_1.default());
|
|
12
|
+
this.callbacks = new Map();
|
|
13
|
+
// eslint-disable-next-line @typescript-eslint/no-this-alias
|
|
14
|
+
const _this = this;
|
|
15
|
+
this.emitter = new Proxy(Object(), {
|
|
16
|
+
get(_, prop) {
|
|
17
|
+
// NOTE: with great power comes great responsiblity ...
|
|
18
|
+
// We skip ts checks here, but enforce safety via on() generic type constraints.
|
|
19
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
20
|
+
// @ts-ignore
|
|
21
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
22
|
+
return _this.callbacks.get(prop) || (() => { });
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
on(event, callback) {
|
|
27
|
+
this.callbacks.set(event, callback);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
exports.default = VoiceClient;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import * as KMPPackage from './kotlin/clientsdk-clientcore_js';
|
|
2
|
+
import { vonage } from './kotlin/clientsdk-clientcore_js';
|
|
3
|
+
declare type HttpHeaders = Record<string, string | number | boolean>;
|
|
4
|
+
declare class HttpClient implements vonage.HttpClientJS {
|
|
5
|
+
private stringToVerb;
|
|
6
|
+
request(verb: string, url: string, headers: HttpHeaders, body: string | null, callback: (p0: KMPPackage.Nullable<Error>, p1: KMPPackage.Nullable<string>) => void): Promise<void>;
|
|
7
|
+
}
|
|
8
|
+
export default HttpClient;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
const axios_1 = require("axios");
|
|
13
|
+
class HttpClient {
|
|
14
|
+
stringToVerb(m) {
|
|
15
|
+
if (m.toLowerCase() === 'get')
|
|
16
|
+
return 'GET';
|
|
17
|
+
else if (m.toLowerCase() === 'post')
|
|
18
|
+
return 'POST';
|
|
19
|
+
else if (m.toLowerCase() === 'patch')
|
|
20
|
+
return 'PATCH';
|
|
21
|
+
else if (m.toLowerCase() === 'put')
|
|
22
|
+
return 'PUT';
|
|
23
|
+
else if (m.toLowerCase() === 'options')
|
|
24
|
+
return 'OPTIONS';
|
|
25
|
+
else if (m.toLowerCase() === 'delete')
|
|
26
|
+
return 'DELETE';
|
|
27
|
+
else
|
|
28
|
+
return 'GET';
|
|
29
|
+
}
|
|
30
|
+
request(verb, url, headers, body, callback) {
|
|
31
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
32
|
+
const method = this.stringToVerb(verb);
|
|
33
|
+
const data = body !== null && body.length > 0 ? JSON.parse(body) : '';
|
|
34
|
+
const axiosReq = {
|
|
35
|
+
url,
|
|
36
|
+
method,
|
|
37
|
+
headers,
|
|
38
|
+
data
|
|
39
|
+
};
|
|
40
|
+
try {
|
|
41
|
+
const res = yield (0, axios_1.default)(axiosReq);
|
|
42
|
+
console.log(`[JS response]: `, res.data);
|
|
43
|
+
callback(null, JSON.stringify(res.data));
|
|
44
|
+
}
|
|
45
|
+
catch (error) {
|
|
46
|
+
// let errorMessage: string = '';
|
|
47
|
+
// let errorStack: string = '';
|
|
48
|
+
let e = Error('');
|
|
49
|
+
if (error instanceof Error) {
|
|
50
|
+
// errorMessage = error.message;
|
|
51
|
+
// errorStack = error.stack;
|
|
52
|
+
e = error;
|
|
53
|
+
}
|
|
54
|
+
callback(e, null);
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
exports.default = HttpClient;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import * as KMPPackage from './kotlin/clientsdk-clientcore_js';
|
|
2
|
+
import { vonage } from './kotlin/clientsdk-clientcore_js';
|
|
3
|
+
declare class MediaClient implements vonage.MediaClientJS {
|
|
4
|
+
delegate: KMPPackage.Nullable<vonage.MediaClientDelegateJS>;
|
|
5
|
+
private pcs;
|
|
6
|
+
private audio;
|
|
7
|
+
private stream;
|
|
8
|
+
constructor();
|
|
9
|
+
enableMedia(id: string, remoteDescription?: string): Promise<void>;
|
|
10
|
+
mute(id: string): Promise<void>;
|
|
11
|
+
unmute(id: string): Promise<void>;
|
|
12
|
+
processAnswer(id: string, sdp: string, streamId: string, legId: string): void;
|
|
13
|
+
disableMedia(id: string): void;
|
|
14
|
+
private setMediaTracksEnabled;
|
|
15
|
+
}
|
|
16
|
+
export default MediaClient;
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
const createRtcAudioConnection_1 = require("./utils/createRtcAudioConnection");
|
|
13
|
+
class MediaClient {
|
|
14
|
+
constructor() {
|
|
15
|
+
this.pcs = new Map();
|
|
16
|
+
this.audio = undefined;
|
|
17
|
+
}
|
|
18
|
+
enableMedia(id, remoteDescription) {
|
|
19
|
+
var _a, _b;
|
|
20
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
21
|
+
try {
|
|
22
|
+
const pc = yield (0, createRtcAudioConnection_1.createRtcAudioConnection)();
|
|
23
|
+
this.pcs.set(id, pc);
|
|
24
|
+
pc.ontrack = (evt) => {
|
|
25
|
+
const stream = evt.streams[0];
|
|
26
|
+
if (stream) {
|
|
27
|
+
const audio = new Audio();
|
|
28
|
+
audio.srcObject = stream;
|
|
29
|
+
audio.autoplay = true;
|
|
30
|
+
this.audio = audio;
|
|
31
|
+
this.stream = stream;
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
if (remoteDescription) {
|
|
35
|
+
const sdp = yield (0, createRtcAudioConnection_1.createAnswer)(pc, remoteDescription);
|
|
36
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
37
|
+
(_a = this.delegate) === null || _a === void 0 ? void 0 : _a.onAnswer(id, '', sdp, () => { });
|
|
38
|
+
}
|
|
39
|
+
else {
|
|
40
|
+
const sdp = yield (0, createRtcAudioConnection_1.createOffer)(pc);
|
|
41
|
+
(_b = this.delegate) === null || _b === void 0 ? void 0 : _b.onOffer(id, '', sdp, () => {
|
|
42
|
+
// Do we need to save the leg id for later?
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
catch (error) {
|
|
47
|
+
// TODO
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
mute(id) {
|
|
52
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
53
|
+
this.setMediaTracksEnabled(id, false);
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
unmute(id) {
|
|
57
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
58
|
+
this.setMediaTracksEnabled(id, true);
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
// async getLocalStream(): Promise<MediaStream> {
|
|
62
|
+
// return await navigator.mediaDevices.getUserMedia({
|
|
63
|
+
// video: false,
|
|
64
|
+
// audio: true
|
|
65
|
+
// });
|
|
66
|
+
// }
|
|
67
|
+
processAnswer(id, sdp,
|
|
68
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
69
|
+
streamId,
|
|
70
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
71
|
+
legId) {
|
|
72
|
+
const remoteDescription = new RTCSessionDescription({
|
|
73
|
+
type: 'answer',
|
|
74
|
+
sdp
|
|
75
|
+
});
|
|
76
|
+
const pc = this.pcs.get(id);
|
|
77
|
+
if (pc) {
|
|
78
|
+
pc.setRemoteDescription(remoteDescription);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
disableMedia(id) {
|
|
82
|
+
const peerConnection = this.pcs.get(id);
|
|
83
|
+
if (peerConnection) {
|
|
84
|
+
peerConnection.close();
|
|
85
|
+
this.pcs.delete(id);
|
|
86
|
+
}
|
|
87
|
+
else {
|
|
88
|
+
throw new Error('No RTCPeerConnection established');
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
// Private Methods
|
|
92
|
+
setMediaTracksEnabled(id, value) {
|
|
93
|
+
const pc = this.pcs.get(id);
|
|
94
|
+
const transceiver = pc === null || pc === void 0 ? void 0 : pc.getTransceivers();
|
|
95
|
+
const tracks = transceiver === null || transceiver === void 0 ? void 0 : transceiver.map((t) => t.sender.track);
|
|
96
|
+
tracks === null || tracks === void 0 ? void 0 : tracks.forEach((t) => {
|
|
97
|
+
if (t) {
|
|
98
|
+
t.enabled = value;
|
|
99
|
+
}
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
exports.default = MediaClient;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import * as KMPPackage from './kotlin/clientsdk-clientcore_js';
|
|
2
|
+
import { vonage } from './kotlin/clientsdk-clientcore_js';
|
|
3
|
+
declare class SocketClient implements vonage.SocketClientJS {
|
|
4
|
+
delegate: KMPPackage.Nullable<vonage.SocketClientDelegateJS>;
|
|
5
|
+
private socket;
|
|
6
|
+
emit(type: string, msg: unknown, _callback: (p0: KMPPackage.Nullable<Error>, p1: KMPPackage.Nullable<string>) => void): void;
|
|
7
|
+
connect(host: string, path: string, reconnectionAttempts: number, reconnectionDelay: number, randomizationFactor: number, query: string): void;
|
|
8
|
+
disconnect(): void;
|
|
9
|
+
startVerifyResponseTimer(milliseconds: number, callback: () => void): void;
|
|
10
|
+
setConnectParamsSocketConfig(token: string): void;
|
|
11
|
+
}
|
|
12
|
+
export default SocketClient;
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const clientsdk_clientcore_js_1 = require("./kotlin/clientsdk-clientcore_js");
|
|
4
|
+
const socket_io = require("socket.io-client");
|
|
5
|
+
// import { SocketConfig } from './NexmoClient';
|
|
6
|
+
class SocketClient {
|
|
7
|
+
emit(type, msg, _callback) {
|
|
8
|
+
var _a;
|
|
9
|
+
(_a = this.socket) === null || _a === void 0 ? void 0 : _a.emit(type, msg);
|
|
10
|
+
_callback(null, ''); // WHAT DO I NEED TODO HERE?
|
|
11
|
+
}
|
|
12
|
+
connect(host, path, reconnectionAttempts, reconnectionDelay, randomizationFactor, query) {
|
|
13
|
+
const config = {
|
|
14
|
+
transports: ['websocket'],
|
|
15
|
+
autoConnect: true,
|
|
16
|
+
reconnection: true,
|
|
17
|
+
forceNew: true,
|
|
18
|
+
path,
|
|
19
|
+
reconnectionAttempts,
|
|
20
|
+
reconnectionDelay,
|
|
21
|
+
randomizationFactor,
|
|
22
|
+
query
|
|
23
|
+
};
|
|
24
|
+
this.socket = socket_io.connect(host, config);
|
|
25
|
+
this.socket.on('connect', () => {
|
|
26
|
+
var _a;
|
|
27
|
+
(_a = this.delegate) === null || _a === void 0 ? void 0 : _a.didReceiveNewSocketConnectionStatusEvent(clientsdk_clientcore_js_1.vonage.SOCKET_CONNECTED, null);
|
|
28
|
+
});
|
|
29
|
+
this.socket.on('reconnect_attempt', () => {
|
|
30
|
+
var _a;
|
|
31
|
+
(_a = this.delegate) === null || _a === void 0 ? void 0 : _a.didReceiveNewSocketConnectionStatusEvent(clientsdk_clientcore_js_1.vonage.SOCKET_RECONNECTING, null);
|
|
32
|
+
});
|
|
33
|
+
this.socket.on('reconnect_failed', () => {
|
|
34
|
+
var _a;
|
|
35
|
+
(_a = this.delegate) === null || _a === void 0 ? void 0 : _a.didReceiveNewSocketConnectionStatusEvent(clientsdk_clientcore_js_1.vonage.SOCKET_DISCONNECTED, clientsdk_clientcore_js_1.vonage.REASON_CLIENT_NETWORK_ERROR);
|
|
36
|
+
});
|
|
37
|
+
this.socket.on('disconnect', (reason) => {
|
|
38
|
+
var _a, _b;
|
|
39
|
+
console.log({ reason });
|
|
40
|
+
if (reason === 'io client disconnect') {
|
|
41
|
+
(_a = this.delegate) === null || _a === void 0 ? void 0 : _a.didReceiveNewSocketConnectionStatusEvent(clientsdk_clientcore_js_1.vonage.SOCKET_DISCONNECTED, clientsdk_clientcore_js_1.vonage.REASON_CLIENT_DISCONNECTED);
|
|
42
|
+
}
|
|
43
|
+
else if (reason === 'io server disconnect') {
|
|
44
|
+
(_b = this.delegate) === null || _b === void 0 ? void 0 : _b.didReceiveNewSocketConnectionStatusEvent(clientsdk_clientcore_js_1.vonage.SOCKET_DISCONNECTED, clientsdk_clientcore_js_1.vonage.REASON_SERVER_DISCONNECTED);
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
this.socket.io.on('packet', (packet) => {
|
|
48
|
+
var _a;
|
|
49
|
+
if (packet.type !== 2)
|
|
50
|
+
return;
|
|
51
|
+
if (packet.data[0] === 'echo')
|
|
52
|
+
return; // ignore echo event
|
|
53
|
+
const [type, body] = packet.data;
|
|
54
|
+
if (typeof type == 'string' && body instanceof Object) {
|
|
55
|
+
(_a = this.delegate) === null || _a === void 0 ? void 0 : _a.didReceiveNewSocketEvent(type, JSON.stringify(body));
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
disconnect() {
|
|
60
|
+
var _a;
|
|
61
|
+
(_a = this.socket) === null || _a === void 0 ? void 0 : _a.disconnect();
|
|
62
|
+
}
|
|
63
|
+
startVerifyResponseTimer(milliseconds, callback) {
|
|
64
|
+
console.log(`startVerifyResponseTimer: ${milliseconds}`);
|
|
65
|
+
setTimeout(() => {
|
|
66
|
+
callback();
|
|
67
|
+
}, milliseconds);
|
|
68
|
+
}
|
|
69
|
+
setConnectParamsSocketConfig(
|
|
70
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
71
|
+
token) {
|
|
72
|
+
if (this.socket) {
|
|
73
|
+
this.socket.io.opts.query = {
|
|
74
|
+
token: token
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
exports.default = SocketClient;
|
package/dist/global.d.ts
ADDED
package/dist/global.js
ADDED
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.VoiceClient = void 0;
|
|
4
|
+
// export { Vonage } from './kotlin/clientsdk-core_js';
|
|
5
|
+
require("./coreExtend");
|
|
6
|
+
var Client_1 = require("./Client");
|
|
7
|
+
Object.defineProperty(exports, "VoiceClient", { enumerable: true, get: function () { return Client_1.default; } });
|
|
@@ -0,0 +1,263 @@
|
|
|
1
|
+
(function (root, factory) {
|
|
2
|
+
if (typeof define === 'function' && define.amd)
|
|
3
|
+
define(['exports', './kotlin-kotlin-stdlib-js-ir.js'], factory);
|
|
4
|
+
else if (typeof exports === 'object')
|
|
5
|
+
factory(module.exports, require('./kotlin-kotlin-stdlib-js-ir.js'));
|
|
6
|
+
else {
|
|
7
|
+
if (typeof this['kotlin-kotlin-stdlib-js-ir'] === 'undefined') {
|
|
8
|
+
throw new Error("Error loading module 'Kermit-kermit-js-ir'. Its dependency 'kotlin-kotlin-stdlib-js-ir' was not found. Please, check whether 'kotlin-kotlin-stdlib-js-ir' is loaded prior to 'Kermit-kermit-js-ir'.");
|
|
9
|
+
}
|
|
10
|
+
root['Kermit-kermit-js-ir'] = factory(typeof this['Kermit-kermit-js-ir'] === 'undefined' ? {} : this['Kermit-kermit-js-ir'], this['kotlin-kotlin-stdlib-js-ir']);
|
|
11
|
+
}
|
|
12
|
+
}(this, function (_, kotlin_kotlin) {
|
|
13
|
+
'use strict';
|
|
14
|
+
//region block: imports
|
|
15
|
+
var classMeta = kotlin_kotlin.$_$.h5;
|
|
16
|
+
var objectMeta = kotlin_kotlin.$_$.h6;
|
|
17
|
+
var listOf = kotlin_kotlin.$_$.g4;
|
|
18
|
+
var interfaceMeta = kotlin_kotlin.$_$.o5;
|
|
19
|
+
var Unit_getInstance = kotlin_kotlin.$_$.o2;
|
|
20
|
+
var Enum = kotlin_kotlin.$_$.q7;
|
|
21
|
+
var stackTraceToString = kotlin_kotlin.$_$.l8;
|
|
22
|
+
//endregion
|
|
23
|
+
//region block: pre-declaration
|
|
24
|
+
Companion.prototype = Object.create(Logger.prototype);
|
|
25
|
+
Companion.prototype.constructor = Companion;
|
|
26
|
+
Severity.prototype = Object.create(Enum.prototype);
|
|
27
|
+
Severity.prototype.constructor = Severity;
|
|
28
|
+
ConsoleWriter.prototype = Object.create(LogWriter.prototype);
|
|
29
|
+
ConsoleWriter.prototype.constructor = ConsoleWriter;
|
|
30
|
+
//endregion
|
|
31
|
+
function LogWriter() {
|
|
32
|
+
}
|
|
33
|
+
LogWriter.prototype.h1a = function (severity) {
|
|
34
|
+
return true;
|
|
35
|
+
};
|
|
36
|
+
LogWriter.$metadata$ = classMeta('LogWriter');
|
|
37
|
+
function get_DEFAULT_MIN_SEVERITY() {
|
|
38
|
+
init_properties_Logger_kt_sgvsqe();
|
|
39
|
+
return DEFAULT_MIN_SEVERITY;
|
|
40
|
+
}
|
|
41
|
+
var DEFAULT_MIN_SEVERITY;
|
|
42
|
+
function get_DEFAULT_TAG() {
|
|
43
|
+
return DEFAULT_TAG;
|
|
44
|
+
}
|
|
45
|
+
var DEFAULT_TAG;
|
|
46
|
+
function Logger_init_$Init$(config, tag, $mask0, $marker, $this) {
|
|
47
|
+
if (!(($mask0 & 2) === 0))
|
|
48
|
+
tag = 'Kermit';
|
|
49
|
+
Logger.call($this, config, tag);
|
|
50
|
+
return $this;
|
|
51
|
+
}
|
|
52
|
+
function Companion() {
|
|
53
|
+
Companion_instance = this;
|
|
54
|
+
var tmp = LoggerGlobal_getInstance().j1a_1;
|
|
55
|
+
Logger_init_$Init$(tmp, null, 2, null, this);
|
|
56
|
+
}
|
|
57
|
+
Companion.prototype.m1a = function () {
|
|
58
|
+
return get_defaultTag();
|
|
59
|
+
};
|
|
60
|
+
Companion.prototype.n1a = function (tag) {
|
|
61
|
+
set_defaultTag(tag);
|
|
62
|
+
};
|
|
63
|
+
Companion.$metadata$ = objectMeta('Companion', undefined, undefined, undefined, undefined, Logger.prototype);
|
|
64
|
+
var Companion_instance;
|
|
65
|
+
function Companion_getInstance() {
|
|
66
|
+
if (Companion_instance == null)
|
|
67
|
+
new Companion();
|
|
68
|
+
return Companion_instance;
|
|
69
|
+
}
|
|
70
|
+
function Logger(config, tag) {
|
|
71
|
+
Companion_getInstance();
|
|
72
|
+
this.o1a_1 = config;
|
|
73
|
+
this.p1a_1 = tag;
|
|
74
|
+
}
|
|
75
|
+
Logger.prototype.q1a = function () {
|
|
76
|
+
return this.o1a_1;
|
|
77
|
+
};
|
|
78
|
+
Logger.prototype.m1a = function () {
|
|
79
|
+
return this.p1a_1;
|
|
80
|
+
};
|
|
81
|
+
Logger.prototype.r1a = function (tag) {
|
|
82
|
+
return new Logger(this.o1a_1, tag);
|
|
83
|
+
};
|
|
84
|
+
Logger.prototype.s1a = function (message) {
|
|
85
|
+
if (this.o1a_1.w1a().q3(Severity_Info_getInstance()) <= 0)
|
|
86
|
+
this.v1a(Severity_Info_getInstance(), this.m1a(), null, message());
|
|
87
|
+
};
|
|
88
|
+
Logger.prototype.t1a = function (message) {
|
|
89
|
+
if (this.o1a_1.w1a().q3(Severity_Error_getInstance()) <= 0)
|
|
90
|
+
this.v1a(Severity_Error_getInstance(), this.m1a(), null, message());
|
|
91
|
+
};
|
|
92
|
+
Logger.prototype.u1a = function (message) {
|
|
93
|
+
if (this.o1a_1.w1a().q3(Severity_Error_getInstance()) <= 0)
|
|
94
|
+
this.v1a(Severity_Error_getInstance(), this.m1a(), null, message);
|
|
95
|
+
};
|
|
96
|
+
Logger.prototype.v1a = function (severity, tag, throwable, message) {
|
|
97
|
+
{
|
|
98
|
+
{
|
|
99
|
+
var tmp0_forEach = this.o1a_1.x1a();
|
|
100
|
+
var tmp0_iterator = tmp0_forEach.g();
|
|
101
|
+
while (tmp0_iterator.h()) {
|
|
102
|
+
var element = tmp0_iterator.i();
|
|
103
|
+
{
|
|
104
|
+
if (element.h1a(severity)) {
|
|
105
|
+
{
|
|
106
|
+
element.i1a(severity, message, tag, throwable);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
};
|
|
114
|
+
Logger.$metadata$ = classMeta('Logger');
|
|
115
|
+
function LoggerGlobal() {
|
|
116
|
+
LoggerGlobal_instance = this;
|
|
117
|
+
this.j1a_1 = mutableKermitConfigInit(listOf(platformLogWriter()));
|
|
118
|
+
}
|
|
119
|
+
LoggerGlobal.$metadata$ = objectMeta('LoggerGlobal');
|
|
120
|
+
var LoggerGlobal_instance;
|
|
121
|
+
function LoggerGlobal_getInstance() {
|
|
122
|
+
if (LoggerGlobal_instance == null)
|
|
123
|
+
new LoggerGlobal();
|
|
124
|
+
return LoggerGlobal_instance;
|
|
125
|
+
}
|
|
126
|
+
var properties_initialized_Logger_kt_6n8a9a;
|
|
127
|
+
function init_properties_Logger_kt_sgvsqe() {
|
|
128
|
+
if (properties_initialized_Logger_kt_6n8a9a) {
|
|
129
|
+
} else {
|
|
130
|
+
properties_initialized_Logger_kt_6n8a9a = true;
|
|
131
|
+
DEFAULT_MIN_SEVERITY = Severity_Verbose_getInstance();
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
function LoggerConfig() {
|
|
135
|
+
}
|
|
136
|
+
LoggerConfig.$metadata$ = interfaceMeta('LoggerConfig');
|
|
137
|
+
function MutableLoggerConfig() {
|
|
138
|
+
}
|
|
139
|
+
MutableLoggerConfig.$metadata$ = interfaceMeta('MutableLoggerConfig', [LoggerConfig]);
|
|
140
|
+
var Severity_Verbose_instance;
|
|
141
|
+
var Severity_Debug_instance;
|
|
142
|
+
var Severity_Info_instance;
|
|
143
|
+
var Severity_Warn_instance;
|
|
144
|
+
var Severity_Error_instance;
|
|
145
|
+
var Severity_Assert_instance;
|
|
146
|
+
var Severity_entriesInitialized;
|
|
147
|
+
function Severity_initEntries() {
|
|
148
|
+
if (Severity_entriesInitialized)
|
|
149
|
+
return Unit_getInstance();
|
|
150
|
+
Severity_entriesInitialized = true;
|
|
151
|
+
Severity_Verbose_instance = new Severity('Verbose', 0);
|
|
152
|
+
Severity_Debug_instance = new Severity('Debug', 1);
|
|
153
|
+
Severity_Info_instance = new Severity('Info', 2);
|
|
154
|
+
Severity_Warn_instance = new Severity('Warn', 3);
|
|
155
|
+
Severity_Error_instance = new Severity('Error', 4);
|
|
156
|
+
Severity_Assert_instance = new Severity('Assert', 5);
|
|
157
|
+
}
|
|
158
|
+
function Severity(name, ordinal) {
|
|
159
|
+
Enum.call(this, name, ordinal);
|
|
160
|
+
}
|
|
161
|
+
Severity.$metadata$ = classMeta('Severity', undefined, undefined, undefined, undefined, Enum.prototype);
|
|
162
|
+
function Severity_Verbose_getInstance() {
|
|
163
|
+
Severity_initEntries();
|
|
164
|
+
return Severity_Verbose_instance;
|
|
165
|
+
}
|
|
166
|
+
function Severity_Debug_getInstance() {
|
|
167
|
+
Severity_initEntries();
|
|
168
|
+
return Severity_Debug_instance;
|
|
169
|
+
}
|
|
170
|
+
function Severity_Info_getInstance() {
|
|
171
|
+
Severity_initEntries();
|
|
172
|
+
return Severity_Info_instance;
|
|
173
|
+
}
|
|
174
|
+
function Severity_Error_getInstance() {
|
|
175
|
+
Severity_initEntries();
|
|
176
|
+
return Severity_Error_instance;
|
|
177
|
+
}
|
|
178
|
+
function ConsoleWriter() {
|
|
179
|
+
LogWriter.call(this);
|
|
180
|
+
}
|
|
181
|
+
ConsoleWriter.prototype.i1a = function (severity, message, tag, throwable) {
|
|
182
|
+
var output = '[' + tag + '] ' + message;
|
|
183
|
+
var tmp0_safe_receiver = throwable;
|
|
184
|
+
if (tmp0_safe_receiver == null)
|
|
185
|
+
null;
|
|
186
|
+
else {
|
|
187
|
+
var tmp$ret$0;
|
|
188
|
+
{
|
|
189
|
+
{
|
|
190
|
+
}
|
|
191
|
+
output = output + (' ' + stackTraceToString(tmp0_safe_receiver));
|
|
192
|
+
tmp$ret$0 = Unit_getInstance();
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
var tmp1_subject = severity;
|
|
196
|
+
var tmp0 = tmp1_subject.ue();
|
|
197
|
+
switch (tmp0) {
|
|
198
|
+
case 5:
|
|
199
|
+
case 4:
|
|
200
|
+
console.error(output);
|
|
201
|
+
break;
|
|
202
|
+
case 3:
|
|
203
|
+
console.warn(output);
|
|
204
|
+
break;
|
|
205
|
+
case 2:
|
|
206
|
+
console.info(output);
|
|
207
|
+
break;
|
|
208
|
+
case 1:
|
|
209
|
+
case 0:
|
|
210
|
+
console.log(output);
|
|
211
|
+
break;
|
|
212
|
+
}
|
|
213
|
+
};
|
|
214
|
+
ConsoleWriter.$metadata$ = classMeta('ConsoleWriter', undefined, undefined, undefined, undefined, LogWriter.prototype);
|
|
215
|
+
function JsMutableLoggerConfig(logWriters) {
|
|
216
|
+
this.y1a_1 = get_DEFAULT_MIN_SEVERITY();
|
|
217
|
+
this.z1a_1 = logWriters;
|
|
218
|
+
}
|
|
219
|
+
JsMutableLoggerConfig.prototype.w1a = function () {
|
|
220
|
+
return this.y1a_1;
|
|
221
|
+
};
|
|
222
|
+
JsMutableLoggerConfig.prototype.x1a = function () {
|
|
223
|
+
return this.z1a_1;
|
|
224
|
+
};
|
|
225
|
+
JsMutableLoggerConfig.$metadata$ = classMeta('JsMutableLoggerConfig', [MutableLoggerConfig]);
|
|
226
|
+
function set_defaultTag(_set____db54di) {
|
|
227
|
+
init_properties_KermitConfig_kt_vkjurc();
|
|
228
|
+
defaultTag = _set____db54di;
|
|
229
|
+
}
|
|
230
|
+
function get_defaultTag() {
|
|
231
|
+
init_properties_KermitConfig_kt_vkjurc();
|
|
232
|
+
return defaultTag;
|
|
233
|
+
}
|
|
234
|
+
var defaultTag;
|
|
235
|
+
function mutableKermitConfigInit(logWriters) {
|
|
236
|
+
init_properties_KermitConfig_kt_vkjurc();
|
|
237
|
+
return new JsMutableLoggerConfig(logWriters);
|
|
238
|
+
}
|
|
239
|
+
var properties_initialized_KermitConfig_kt_gdrujo;
|
|
240
|
+
function init_properties_KermitConfig_kt_vkjurc() {
|
|
241
|
+
if (properties_initialized_KermitConfig_kt_gdrujo) {
|
|
242
|
+
} else {
|
|
243
|
+
properties_initialized_KermitConfig_kt_gdrujo = true;
|
|
244
|
+
defaultTag = get_DEFAULT_TAG();
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
function platformLogWriter() {
|
|
248
|
+
return new ConsoleWriter();
|
|
249
|
+
}
|
|
250
|
+
//region block: init
|
|
251
|
+
DEFAULT_TAG = 'Kermit';
|
|
252
|
+
//endregion
|
|
253
|
+
//region block: exports
|
|
254
|
+
_.$_$ = _.$_$ || {};
|
|
255
|
+
_.$_$.a = Severity_Debug_getInstance;
|
|
256
|
+
_.$_$.b = Severity_Error_getInstance;
|
|
257
|
+
_.$_$.c = Severity_Info_getInstance;
|
|
258
|
+
_.$_$.d = Companion_getInstance;
|
|
259
|
+
//endregion
|
|
260
|
+
return _;
|
|
261
|
+
}));
|
|
262
|
+
|
|
263
|
+
//# sourceMappingURL=Kermit-kermit-js-ir.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../LogWriter.kt","../../../../../Logger.kt","../../../../../commonMainSources/libraries/stdlib/common/src/generated/_Collections.kt","../../../../../ConsoleWriter.kt","../../../../../commonMainSources/libraries/stdlib/src/kotlin/util/Standard.kt","../../../../../JsMutableLoggerConfig.kt","../../../../../KermitConfig.kt","../../../../../platformLogWriter.kt"],"sourcesContent":[null,null,null,null,null,null,null,null],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAgB2D,OAAJ,I;;;;;IC4L9C,2B;;;;IACM,kB;;;;QA7LV,qB;MAAA,MAEuB,Q;IAFvB,+B;;;;;cA6JsC,gC;IAApB,4C;;;IAEO,OAAV,gB;;;IAmBR,eAAa,GAAb,C;;;;;;;;;;IAnLZ,uB;IAEI,mB;IACA,gB;;;IADA,iB;;;IACK,iB;;;IAGD,OAAO,WAAO,IAAK,MAAZ,EAAoB,GAApB,C;;;QA8CH,UAAO,MAAP,qC;MACA,sCAAmB,UAAnB,EAAwB,IAAxB,EAA8B,SAA9B,C;;;QAqCA,UAAO,MAAP,sC;MACA,uCAAoB,UAApB,EAAyB,IAAzB,EAA+B,SAA/B,C;;;QASA,UAAO,MAAP,sC;MACA,uCAAoB,UAApB,EAAyB,IAAzB,EAA+B,OAA/B,C;;;;;QCkEgB,mBAjBe,IAiBtB,MAAO,M;QAooDR,oC;eAAA,iB;UAAX,cAAW,iB;;gBDzmDq6rD,OA3Ct6rD,KAjBP,QAiBO,C;;gBA2Cs6rD,OAvD76rD,KAAI,QAAJ,EAFA,OAEA,EAJA,GAIA,EAHA,SAGA,C;;;;;;;;;;;IA8CY,qCAAwB,OAAO,mBAAP,CAAxB,C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IEvLF,oB;;;IAEd,aAAc,GAAd,GAAgB,GAAhB,GAAmB,IAAnB,GAAsB,O;IACtB,kC;QAAA,kBAAW,Q;MAAA,I;;;;;;QCMkC,mBAAW,GAAX,GAAiB,mBAA9C,kBAA8C,CAAjB,C;QAqFjD,8B;;;IDxFU,2B;IAAA,4B;;WACO,C;WAAiB,C;QAAS,OAAQ,OAAM,MAAN,C;;WAClC,C;QAAQ,OAAQ,MAAK,MAAL,C;;WAChB,C;QAAQ,OAAQ,MAAK,MAAL,C;;WAChB,C;WAAgB,C;QAAW,OAAQ,KAAI,MAAJ,C;;;;;;IEdf,uC;IACS,uB;;;IADrC,iB;;;IACA,iB;;;;;ICAG,2B;;;;IAAA,iB;;;;;IAFiH,OAAjC,0BAAsB,UAAtB,C;;;;;;;mBAEvD,iB;;;;ICFkB,OAAf,mB;;;gBNiMX,Q;;;;;;;;;;;"}
|