@jibb-open/jssdk 3.5.12 → 3.5.14
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 +8 -1
- package/api/admin.js +1 -418
- package/api/auth.js +1 -246
- package/api/eventbus.js +1 -249
- package/api/index.js +1 -53
- package/api/meeting.js +1 -488
- package/api/recording.js +1 -260
- package/api/superadmin.js +1 -105
- package/api/user.js +1 -51
- package/api/webexbot.js +1 -41
- package/api/whiteboard.js +1 -179
- package/config.js +1 -16
- package/package.json +7 -3
- package/post-processing.js +1 -43
- package/types/exceptions.js +1 -55
- package/types/jibb.pb.js +1 -1324
- package/types/proto.js +1 -15
- package/types/types.js +1 -67
- package/utils/cached_variable.js +1 -25
- package/utils/future.js +1 -31
- package/utils/http/http.axios.js +1 -41
- package/utils/http/index.js +1 -10
- package/utils/index.js +1 -11
- package/utils/logger/index.js +1 -19
- package/utils/logger/logger.empty.js +1 -25
- package/utils/logger/logger.pino.js +1 -19
- package/ws/connection_base.js +1 -95
- package/ws/eventbus.js +1 -376
- package/ws/index.js +1 -36
- package/ws/ipsa.js +1 -262
- package/ws/meeting.js +1 -181
- package/ws/observable_connection.js +1 -87
- package/ws/retry_connection.js +1 -94
- package/examples/browser/462.jibb.js +0 -306
- package/examples/browser/index.html +0 -17
- package/examples/browser/jibb.js +0 -7381
- package/examples/browser/startSession.js +0 -102
- package/examples/examples.js +0 -6
- package/examples/webexDevicesMacros/cameraPresets/jibb.js +0 -279
- package/examples/webexDevicesMacros/jssdk/jibb_WebexXapi.js +0 -3033
- package/examples/webexDevicesMacros/simplestExample/jibb.js +0 -181
- package/examples/webexDevicesMacros/withCameraControl/jibb.js +0 -263
package/api/auth.js
CHANGED
|
@@ -1,246 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.Auth = void 0;
|
|
7
|
-
require("core-js/modules/web.dom-collections.iterator.js");
|
|
8
|
-
require("core-js/modules/es.promise.js");
|
|
9
|
-
var _config = require("../config.js");
|
|
10
|
-
var _index = require("../utils/logger/index.js");
|
|
11
|
-
var _types = require("../types/types.js");
|
|
12
|
-
var _index2 = require("../utils/http/index.js");
|
|
13
|
-
function _classPrivateMethodInitSpec(obj, privateSet) { _checkPrivateRedeclaration(obj, privateSet); privateSet.add(obj); }
|
|
14
|
-
function _classPrivateFieldInitSpec(obj, privateMap, value) { _checkPrivateRedeclaration(obj, privateMap); privateMap.set(obj, value); }
|
|
15
|
-
function _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollection.has(obj)) { throw new TypeError("Cannot initialize the same private elements twice on an object"); } }
|
|
16
|
-
function _classPrivateMethodGet(receiver, privateSet, fn) { if (!privateSet.has(receiver)) { throw new TypeError("attempted to get private field on non-instance"); } return fn; }
|
|
17
|
-
function _classPrivateFieldGet(receiver, privateMap) { var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "get"); return _classApplyDescriptorGet(receiver, descriptor); }
|
|
18
|
-
function _classApplyDescriptorGet(receiver, descriptor) { if (descriptor.get) { return descriptor.get.call(receiver); } return descriptor.value; }
|
|
19
|
-
function _classPrivateFieldSet(receiver, privateMap, value) { var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "set"); _classApplyDescriptorSet(receiver, descriptor, value); return value; }
|
|
20
|
-
function _classExtractFieldDescriptor(receiver, privateMap, action) { if (!privateMap.has(receiver)) { throw new TypeError("attempted to " + action + " private field on non-instance"); } return privateMap.get(receiver); }
|
|
21
|
-
function _classApplyDescriptorSet(receiver, descriptor, value) { if (descriptor.set) { descriptor.set.call(receiver, value); } else { if (!descriptor.writable) { throw new TypeError("attempted to set read only private field"); } descriptor.value = value; } }
|
|
22
|
-
var _userClaims = /*#__PURE__*/new WeakMap();
|
|
23
|
-
var _getUserTokenFromApiKey = /*#__PURE__*/new WeakSet();
|
|
24
|
-
var _getUserTokenFromIDToken = /*#__PURE__*/new WeakSet();
|
|
25
|
-
var _refreshUserToken = /*#__PURE__*/new WeakSet();
|
|
26
|
-
/**
|
|
27
|
-
* @module auth
|
|
28
|
-
*/
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
* AuthClass.
|
|
32
|
-
* @class AuthClass
|
|
33
|
-
*
|
|
34
|
-
*/
|
|
35
|
-
|
|
36
|
-
class AuthClass {
|
|
37
|
-
constructor() {
|
|
38
|
-
_classPrivateMethodInitSpec(this, _refreshUserToken);
|
|
39
|
-
_classPrivateMethodInitSpec(this, _getUserTokenFromIDToken);
|
|
40
|
-
_classPrivateMethodInitSpec(this, _getUserTokenFromApiKey);
|
|
41
|
-
_classPrivateFieldInitSpec(this, _userClaims, {
|
|
42
|
-
writable: true,
|
|
43
|
-
value: void 0
|
|
44
|
-
});
|
|
45
|
-
_index.logger.debug("Creating new Auth instance");
|
|
46
|
-
this.apiKey = undefined;
|
|
47
|
-
_classPrivateFieldSet(this, _userClaims, new Map());
|
|
48
|
-
this.getIdToken = undefined;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
/**
|
|
52
|
-
* Manually setting userToken
|
|
53
|
-
* @param {string} token
|
|
54
|
-
* @param {AccessLevel} accessLevel
|
|
55
|
-
*/
|
|
56
|
-
setUserToken(token) {
|
|
57
|
-
let accessLevel = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _types.AccessLevel.USER;
|
|
58
|
-
let claims = new _types.UserClaims(token);
|
|
59
|
-
_classPrivateFieldGet(this, _userClaims).set(accessLevel, claims);
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
/**
|
|
63
|
-
* setting Api key
|
|
64
|
-
* @param {string} apiKey
|
|
65
|
-
*/
|
|
66
|
-
setApiKey(apiKey) {
|
|
67
|
-
this.apiKey = apiKey;
|
|
68
|
-
_classPrivateFieldGet(this, _userClaims).clear();
|
|
69
|
-
}
|
|
70
|
-
/**
|
|
71
|
-
*
|
|
72
|
-
* @returns {UserClaims}
|
|
73
|
-
*/
|
|
74
|
-
async getUserClaims() {
|
|
75
|
-
await this.getUserToken();
|
|
76
|
-
return _classPrivateFieldGet(this, _userClaims).get(_types.AccessLevel.USER);
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
/**
|
|
80
|
-
*
|
|
81
|
-
* @async
|
|
82
|
-
* @param {object} [param0={}]
|
|
83
|
-
* @param {Number} [param0.expiry=3600] - meeting ID.
|
|
84
|
-
* @param {boolean} [param0.refresh=fales] - 1 Read or 2 Write.
|
|
85
|
-
* @param {AccessLevel} [param0.accessLevel=AccessLevel.USER]
|
|
86
|
-
* @returns {string} - user Token.
|
|
87
|
-
*/
|
|
88
|
-
|
|
89
|
-
async getUserToken() {
|
|
90
|
-
let {
|
|
91
|
-
expiry,
|
|
92
|
-
refresh,
|
|
93
|
-
accessLevel
|
|
94
|
-
} = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
95
|
-
let claim = undefined;
|
|
96
|
-
refresh = refresh || false;
|
|
97
|
-
accessLevel = accessLevel || _types.AccessLevel.USER;
|
|
98
|
-
expiry = expiry || 3600;
|
|
99
|
-
if (refresh === true) {
|
|
100
|
-
await _classPrivateMethodGet(this, _refreshUserToken, _refreshUserToken2).call(this, {
|
|
101
|
-
expiry,
|
|
102
|
-
accessLevel
|
|
103
|
-
});
|
|
104
|
-
}
|
|
105
|
-
claim = _classPrivateFieldGet(this, _userClaims).get(accessLevel);
|
|
106
|
-
if (claim !== undefined && !claim.isExpired()) return claim.token;
|
|
107
|
-
await _classPrivateMethodGet(this, _refreshUserToken, _refreshUserToken2).call(this, {
|
|
108
|
-
expiry,
|
|
109
|
-
accessLevel
|
|
110
|
-
});
|
|
111
|
-
claim = _classPrivateFieldGet(this, _userClaims).get(accessLevel);
|
|
112
|
-
if (claim !== undefined && !claim.isExpired()) return claim.token;
|
|
113
|
-
throw new Error("could not create user token");
|
|
114
|
-
}
|
|
115
|
-
/**
|
|
116
|
-
* clear user.
|
|
117
|
-
*/
|
|
118
|
-
|
|
119
|
-
logout() {
|
|
120
|
-
_classPrivateFieldGet(this, _userClaims).clear();
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
/**
|
|
124
|
-
*
|
|
125
|
-
* Generate a new API Key, old API KEY will be discareded
|
|
126
|
-
* It require a userToken to be set.
|
|
127
|
-
* @returns {string} api key
|
|
128
|
-
*/
|
|
129
|
-
async generateAPIKey() {
|
|
130
|
-
let headers = {
|
|
131
|
-
"Content-Type": "application/json",
|
|
132
|
-
Accept: "application/json",
|
|
133
|
-
"x-jibb-user-jwt": await this.getUserToken()
|
|
134
|
-
};
|
|
135
|
-
let response = await _index2.http.get("".concat(_config.Config.apiBaseURL, "/v1/auth/apikey"), headers);
|
|
136
|
-
return response.data.apiKey;
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
/**
|
|
140
|
-
*
|
|
141
|
-
* Generating a one time password.
|
|
142
|
-
* It require a IdToken to be set.
|
|
143
|
-
* @async
|
|
144
|
-
* @returns {string} - Custom Password.
|
|
145
|
-
*/
|
|
146
|
-
async generateCustomAuthPassword() {
|
|
147
|
-
let headers = {
|
|
148
|
-
"Content-Type": "application/json",
|
|
149
|
-
Accept: "application/json",
|
|
150
|
-
"x-jibb-id-jwt": await this.getIdToken()
|
|
151
|
-
};
|
|
152
|
-
let response = await _index2.http.get("".concat(_config.Config.apiBaseURL, "/v1/auth/custom"), headers);
|
|
153
|
-
return response.data.password;
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
/**
|
|
158
|
-
* Expotred instance of AuthClass.
|
|
159
|
-
* @type {AuthClass}
|
|
160
|
-
*/
|
|
161
|
-
async function _getUserTokenFromApiKey2(_ref) {
|
|
162
|
-
let {
|
|
163
|
-
expiry,
|
|
164
|
-
accessLevel
|
|
165
|
-
} = _ref;
|
|
166
|
-
let headers = {
|
|
167
|
-
"Content-Type": "application/json",
|
|
168
|
-
Accept: "application/json"
|
|
169
|
-
};
|
|
170
|
-
let body = {
|
|
171
|
-
api_key: this.apiKey,
|
|
172
|
-
expiry: {
|
|
173
|
-
seconds: expiry
|
|
174
|
-
}
|
|
175
|
-
};
|
|
176
|
-
let url;
|
|
177
|
-
switch (accessLevel) {
|
|
178
|
-
case _types.AccessLevel.ADMIN:
|
|
179
|
-
url = "".concat(_config.Config.apiBaseURL, "/v1/admin/auth/token");
|
|
180
|
-
break;
|
|
181
|
-
case _types.AccessLevel.SUPERADMIN:
|
|
182
|
-
url = "".concat(_config.Config.apiBaseURL, "/v1/superadmin/auth/token");
|
|
183
|
-
break;
|
|
184
|
-
default:
|
|
185
|
-
url = "".concat(_config.Config.apiBaseURL, "/v1/auth/token");
|
|
186
|
-
break;
|
|
187
|
-
}
|
|
188
|
-
let response = await _index2.http.post(url, body, headers);
|
|
189
|
-
return response.data.token;
|
|
190
|
-
}
|
|
191
|
-
async function _getUserTokenFromIDToken2(_ref2) {
|
|
192
|
-
let {
|
|
193
|
-
expiry,
|
|
194
|
-
accessLevel
|
|
195
|
-
} = _ref2;
|
|
196
|
-
let headers = {
|
|
197
|
-
"Content-Type": "application/json",
|
|
198
|
-
Accept: "application/json",
|
|
199
|
-
"x-jibb-id-jwt": await this.getIdToken()
|
|
200
|
-
};
|
|
201
|
-
let body = {
|
|
202
|
-
expiry: {
|
|
203
|
-
seconds: expiry
|
|
204
|
-
}
|
|
205
|
-
};
|
|
206
|
-
let url;
|
|
207
|
-
switch (accessLevel) {
|
|
208
|
-
case _types.AccessLevel.ADMIN:
|
|
209
|
-
url = "".concat(_config.Config.apiBaseURL, "/v1/admin/auth/token");
|
|
210
|
-
break;
|
|
211
|
-
case _types.AccessLevel.SUPERADMIN:
|
|
212
|
-
url = "".concat(_config.Config.apiBaseURL, "/v1/superadmin/auth/token");
|
|
213
|
-
break;
|
|
214
|
-
default:
|
|
215
|
-
url = "".concat(_config.Config.apiBaseURL, "/v1/auth/token");
|
|
216
|
-
break;
|
|
217
|
-
}
|
|
218
|
-
let response = await _index2.http.post(url, body, headers);
|
|
219
|
-
return response.data.token;
|
|
220
|
-
}
|
|
221
|
-
async function _refreshUserToken2(_ref3) {
|
|
222
|
-
let {
|
|
223
|
-
expiry,
|
|
224
|
-
accessLevel
|
|
225
|
-
} = _ref3;
|
|
226
|
-
if (this.apiKey) {
|
|
227
|
-
let token = await _classPrivateMethodGet(this, _getUserTokenFromApiKey, _getUserTokenFromApiKey2).call(this, {
|
|
228
|
-
expiry,
|
|
229
|
-
accessLevel
|
|
230
|
-
});
|
|
231
|
-
this.setUserToken(token, accessLevel);
|
|
232
|
-
return token;
|
|
233
|
-
}
|
|
234
|
-
try {
|
|
235
|
-
let token = await _classPrivateMethodGet(this, _getUserTokenFromIDToken, _getUserTokenFromIDToken2).call(this, {
|
|
236
|
-
expiry,
|
|
237
|
-
accessLevel
|
|
238
|
-
});
|
|
239
|
-
this.setUserToken(token, accessLevel);
|
|
240
|
-
return token;
|
|
241
|
-
} catch (error) {
|
|
242
|
-
_index.logger.error(error);
|
|
243
|
-
}
|
|
244
|
-
}
|
|
245
|
-
let Auth = new AuthClass();
|
|
246
|
-
exports.Auth = Auth;
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.Auth=void 0,require("core-js/modules/web.dom-collections.iterator.js"),require("core-js/modules/es.promise.js");var _config=require("../config.js"),_index=require("../utils/logger/index.js"),_types=require("../types/types.js"),_index2=require("../utils/http/index.js");function _classPrivateMethodInitSpec(a,b){_checkPrivateRedeclaration(a,b),b.add(a)}function _classPrivateFieldInitSpec(a,b,c){_checkPrivateRedeclaration(a,b),b.set(a,c)}function _checkPrivateRedeclaration(a,b){if(b.has(a))throw new TypeError("Cannot initialize the same private elements twice on an object")}function _classPrivateMethodGet(a,b,c){if(!b.has(a))throw new TypeError("attempted to get private field on non-instance");return c}function _classPrivateFieldGet(a,b){var c=_classExtractFieldDescriptor(a,b,"get");return _classApplyDescriptorGet(a,c)}function _classApplyDescriptorGet(a,b){return b.get?b.get.call(a):b.value}function _classPrivateFieldSet(a,b,c){var d=_classExtractFieldDescriptor(a,b,"set");return _classApplyDescriptorSet(a,d,c),c}function _classExtractFieldDescriptor(a,b,c){if(!b.has(a))throw new TypeError("attempted to "+c+" private field on non-instance");return b.get(a)}function _classApplyDescriptorSet(a,b,c){if(b.set)b.set.call(a,c);else{if(!b.writable)throw new TypeError("attempted to set read only private field");b.value=c}}var _userClaims=/*#__PURE__*/new WeakMap,_getUserTokenFromApiKey=/*#__PURE__*/new WeakSet,_getUserTokenFromIDToken=/*#__PURE__*/new WeakSet,_refreshUserToken=/*#__PURE__*/new WeakSet;class AuthClass{constructor(){_classPrivateMethodInitSpec(this,_refreshUserToken),_classPrivateMethodInitSpec(this,_getUserTokenFromIDToken),_classPrivateMethodInitSpec(this,_getUserTokenFromApiKey),_classPrivateFieldInitSpec(this,_userClaims,{writable:!0,value:void 0}),_index.logger.debug("Creating new Auth instance"),this.apiKey=void 0,_classPrivateFieldSet(this,_userClaims,new Map),this.getIdToken=void 0}setUserToken(a){let b=1<arguments.length&&arguments[1]!==void 0?arguments[1]:_types.AccessLevel.USER,c=new _types.UserClaims(a);_classPrivateFieldGet(this,_userClaims).set(b,c)}setApiKey(a){this.apiKey=a,_classPrivateFieldGet(this,_userClaims).clear()}async getUserClaims(){return await this.getUserToken(),_classPrivateFieldGet(this,_userClaims).get(_types.AccessLevel.USER)}async getUserToken(){let a,{expiry:b,refresh:c,accessLevel:d}=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};if(c=c||!1,d=d||_types.AccessLevel.USER,b=b||3600,!0===c&&(await _classPrivateMethodGet(this,_refreshUserToken,_refreshUserToken2).call(this,{expiry:b,accessLevel:d})),a=_classPrivateFieldGet(this,_userClaims).get(d),void 0!==a&&!a.isExpired())return a.token;if(await _classPrivateMethodGet(this,_refreshUserToken,_refreshUserToken2).call(this,{expiry:b,accessLevel:d}),a=_classPrivateFieldGet(this,_userClaims).get(d),void 0!==a&&!a.isExpired())return a.token;throw new Error("could not create user token")}logout(){_classPrivateFieldGet(this,_userClaims).clear()}async generateAPIKey(){let a={"Content-Type":"application/json",Accept:"application/json","x-jibb-user-jwt":await this.getUserToken()},b=await _index2.http.get("".concat(_config.Config.apiBaseURL,"/v1/auth/apikey"),a);return b.data.apiKey}async generateCustomAuthPassword(){let a={"Content-Type":"application/json",Accept:"application/json","x-jibb-id-jwt":await this.getIdToken()},b=await _index2.http.get("".concat(_config.Config.apiBaseURL,"/v1/auth/custom"),a);return b.data.password}}async function _getUserTokenFromApiKey2(a){let b,{expiry:c,accessLevel:d}=a,e={api_key:this.apiKey,expiry:{seconds:c}};switch(d){case _types.AccessLevel.ADMIN:b="".concat(_config.Config.apiBaseURL,"/v1/admin/auth/token");break;case _types.AccessLevel.SUPERADMIN:b="".concat(_config.Config.apiBaseURL,"/v1/superadmin/auth/token");break;default:b="".concat(_config.Config.apiBaseURL,"/v1/auth/token");}let f=await _index2.http.post(b,e,{"Content-Type":"application/json",Accept:"application/json"});return f.data.token}async function _getUserTokenFromIDToken2(a){let b,{expiry:c,accessLevel:d}=a,e={"Content-Type":"application/json",Accept:"application/json","x-jibb-id-jwt":await this.getIdToken()};switch(d){case _types.AccessLevel.ADMIN:b="".concat(_config.Config.apiBaseURL,"/v1/admin/auth/token");break;case _types.AccessLevel.SUPERADMIN:b="".concat(_config.Config.apiBaseURL,"/v1/superadmin/auth/token");break;default:b="".concat(_config.Config.apiBaseURL,"/v1/auth/token");}let f=await _index2.http.post(b,{expiry:{seconds:c}},e);return f.data.token}async function _refreshUserToken2(a){let{expiry:b,accessLevel:c}=a;if(this.apiKey){let a=await _classPrivateMethodGet(this,_getUserTokenFromApiKey,_getUserTokenFromApiKey2).call(this,{expiry:b,accessLevel:c});return this.setUserToken(a,c),a}try{let a=await _classPrivateMethodGet(this,_getUserTokenFromIDToken,_getUserTokenFromIDToken2).call(this,{expiry:b,accessLevel:c});return this.setUserToken(a,c),a}catch(a){_index.logger.error(a)}}let Auth=new AuthClass;exports.Auth=Auth;
|
package/api/eventbus.js
CHANGED
|
@@ -1,249 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.getCameraList = getCameraList;
|
|
7
|
-
exports.getCameraPreview = getCameraPreview;
|
|
8
|
-
exports.getClientStatusList = getClientStatusList;
|
|
9
|
-
exports.sendMessage = sendMessage;
|
|
10
|
-
exports.setRuntimeConfig = setRuntimeConfig;
|
|
11
|
-
exports.startStream = startStream;
|
|
12
|
-
exports.stopStream = stopStream;
|
|
13
|
-
require("core-js/modules/es.promise.js");
|
|
14
|
-
var _auth = require("./auth.js");
|
|
15
|
-
var _config = require("../config.js");
|
|
16
|
-
var _index = require("../utils/http/index.js");
|
|
17
|
-
/**
|
|
18
|
-
* EventBus.
|
|
19
|
-
* @module EventBus
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*/
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
*
|
|
26
|
-
* @async
|
|
27
|
-
* @param {string} clientId
|
|
28
|
-
* @returns {array} - list of available camera, each camera is an object of with id and name properties.
|
|
29
|
-
*/
|
|
30
|
-
async function getCameraList(clientId) {
|
|
31
|
-
let response = await _index.http.get("".concat(_config.Config.apiBaseURL, "/v1/eventbus/clients/").concat(clientId, "/cameras"), await _prepareRequestHeaders());
|
|
32
|
-
return response.data.items;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
/**
|
|
36
|
-
*
|
|
37
|
-
* @async
|
|
38
|
-
* @param {object} param0
|
|
39
|
-
* @param {object} param0.cameraId
|
|
40
|
-
* @param {object} param0.clientId
|
|
41
|
-
* @returns {data}
|
|
42
|
-
*/
|
|
43
|
-
async function getCameraPreview(_ref) {
|
|
44
|
-
let {
|
|
45
|
-
cameraId,
|
|
46
|
-
clientId
|
|
47
|
-
} = _ref;
|
|
48
|
-
let body = {
|
|
49
|
-
source: {
|
|
50
|
-
id: cameraId
|
|
51
|
-
}
|
|
52
|
-
};
|
|
53
|
-
let response = await _index.http.post("".concat(_config.Config.apiBaseURL, "/v1/eventbus/").concat(clientId, "/preview"), body, await _prepareRequestHeaders());
|
|
54
|
-
return response.data.image;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
/**
|
|
58
|
-
*
|
|
59
|
-
* @async
|
|
60
|
-
* @param {object} param0
|
|
61
|
-
* @param {string} param0.meetingId
|
|
62
|
-
* @param {string} param0.meeting_token
|
|
63
|
-
* @param {string} param0.surfaceType - PAPER or WHITEBOARD
|
|
64
|
-
* @param {string} [param0.cameraId] - either sipUri or cameraId should be specified.
|
|
65
|
-
* @param {string} [param0.sipUri] - either sipUri or cameraId should be specified.
|
|
66
|
-
* @param {boolean} [param0.flipLeftRight=false] - mirror output stream.
|
|
67
|
-
* @param {boolean} [param0.flipUpDown=false] - mirror vertically output stream.
|
|
68
|
-
* @param {number} [param0.rotation=0] - output rotation degree 0, 90, 180, 270.
|
|
69
|
-
* @param {boolean} [param0.fixedCorners=fales] - enable srufcae fixed corners after first detection.
|
|
70
|
-
* @param {string} param0.clientId
|
|
71
|
-
* @param {array} [param0.customCorners] - array of 8 Numbers ranged from 0-1 that decribe 4 points based on percentage [x1, y1, x2, y2 ...] example [0.1, 0.1, 0.8, 0.1, 0.1, 0.8, 0.8 ,0.8]
|
|
72
|
-
* @param {boolean} [param0.enableColor]
|
|
73
|
-
* @param {boolean} [param0.enableEstimation]
|
|
74
|
-
* @returns - http result
|
|
75
|
-
*/
|
|
76
|
-
async function startStream(_ref2) {
|
|
77
|
-
let {
|
|
78
|
-
meetingId,
|
|
79
|
-
meetingToken,
|
|
80
|
-
surfaceType,
|
|
81
|
-
cameraId,
|
|
82
|
-
sipUri,
|
|
83
|
-
flipLeftRight,
|
|
84
|
-
flipUpDown,
|
|
85
|
-
rotation,
|
|
86
|
-
fixedCorners,
|
|
87
|
-
clientId,
|
|
88
|
-
customCorners,
|
|
89
|
-
enableColor,
|
|
90
|
-
enableEstimation
|
|
91
|
-
} = _ref2;
|
|
92
|
-
let request = {
|
|
93
|
-
config: {
|
|
94
|
-
surface_type: surfaceType
|
|
95
|
-
},
|
|
96
|
-
app_config: {
|
|
97
|
-
meeting_id: meetingId,
|
|
98
|
-
meeting_token: meetingToken
|
|
99
|
-
},
|
|
100
|
-
runtime_config: _makeRuntimeConfig({
|
|
101
|
-
fixedCorners,
|
|
102
|
-
flipLeftRight,
|
|
103
|
-
flipUpDown,
|
|
104
|
-
rotation,
|
|
105
|
-
customCorners,
|
|
106
|
-
enableColor,
|
|
107
|
-
enableEstimation
|
|
108
|
-
})
|
|
109
|
-
};
|
|
110
|
-
if (!cameraId && !sipUri) {
|
|
111
|
-
return Promise.reject("Invalid request: either sipUri or cameraId should be specified");
|
|
112
|
-
}
|
|
113
|
-
if (cameraId && sipUri) {
|
|
114
|
-
return Promise.reject("Invalid request: both sipUri (".concat(sipUri, ") and cameraId (").concat(sipUri, ") are specified"));
|
|
115
|
-
} else if (sipUri) {
|
|
116
|
-
request["sip_uri"] = sipUri;
|
|
117
|
-
} else {
|
|
118
|
-
request["camera"] = {
|
|
119
|
-
id: cameraId
|
|
120
|
-
};
|
|
121
|
-
}
|
|
122
|
-
let body = {
|
|
123
|
-
start_request: request
|
|
124
|
-
};
|
|
125
|
-
return _index.http.post("".concat(_config.Config.apiBaseURL, "/v1/eventbus/clients/").concat(clientId, "/start"), body, await _prepareRequestHeaders());
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
//if there is no body I get error code:401 status:Unauthorized
|
|
129
|
-
|
|
130
|
-
/**
|
|
131
|
-
*
|
|
132
|
-
* @async
|
|
133
|
-
* @param {string} clientId
|
|
134
|
-
* @returns - http result
|
|
135
|
-
*/
|
|
136
|
-
async function stopStream(clientId) {
|
|
137
|
-
let body = {};
|
|
138
|
-
return _index.http.post("".concat(_config.Config.apiBaseURL, "/v1/eventbus/").concat(clientId, "/stop"), body, await _prepareRequestHeaders());
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
// the only decent solution that comes to my mind is using body as parameter,
|
|
142
|
-
//other one is having all possible events as paramaters ( more than 13) and then check for null and build the body like jibb.startStream.
|
|
143
|
-
// we can send grpc event data but then client need to have the grpc file and complie it.
|
|
144
|
-
|
|
145
|
-
/**
|
|
146
|
-
*
|
|
147
|
-
* @async
|
|
148
|
-
* @param {string} body
|
|
149
|
-
* @returns - http result.
|
|
150
|
-
*/
|
|
151
|
-
async function sendMessage(body) {
|
|
152
|
-
return _index.http.post("".concat(_config.Config.apiBaseURL, "/v1/eventbus"), body, await _prepareRequestHeaders());
|
|
153
|
-
}
|
|
154
|
-
/**
|
|
155
|
-
*
|
|
156
|
-
* @async
|
|
157
|
-
* @param {object} param0
|
|
158
|
-
* @param {boolean} [param0.flipLeftRight=false] - mirror output stream.
|
|
159
|
-
* @param {boolean} [param0.flipUpDown=false] - mirror vertically output stream.
|
|
160
|
-
* @param {number} [param0.rotation=0] - output rotation degree 0, 90, 180, 270.
|
|
161
|
-
* @param {boolean} [param0.fixedCorners=fales] - enable srufcae fixed corners after first detection.
|
|
162
|
-
* @param {string} param0.clientId
|
|
163
|
-
* @param {array} [param0.customCorners] - array of 8 Numbers ranged from 0-1 that decribe 4 points based on percentage [x1, y1, x2, y2 ...] example [0.1, 0.1, 0.8, 0.1, 0.1, 0.8, 0.8 ,0.8]
|
|
164
|
-
* @param {boolean} [param0.enableColor]
|
|
165
|
-
* @param {boolean} [param0.enableEstimation]
|
|
166
|
-
* @returns - http result.
|
|
167
|
-
*/
|
|
168
|
-
async function setRuntimeConfig(_ref3) {
|
|
169
|
-
let {
|
|
170
|
-
flipLeftRight,
|
|
171
|
-
flipUpDown,
|
|
172
|
-
rotation,
|
|
173
|
-
fixedCorners,
|
|
174
|
-
customCorners,
|
|
175
|
-
clientId,
|
|
176
|
-
enableColor,
|
|
177
|
-
enableEstimation
|
|
178
|
-
} = _ref3;
|
|
179
|
-
let body = {
|
|
180
|
-
runtime_config_request: {
|
|
181
|
-
runtime_config: _makeRuntimeConfig({
|
|
182
|
-
fixedCorners,
|
|
183
|
-
flipLeftRight,
|
|
184
|
-
flipUpDown,
|
|
185
|
-
rotation,
|
|
186
|
-
customCorners,
|
|
187
|
-
enableColor,
|
|
188
|
-
enableEstimation
|
|
189
|
-
})
|
|
190
|
-
}
|
|
191
|
-
};
|
|
192
|
-
return _index.http.post("".concat(_config.Config.apiBaseURL, "/v1/eventbus/").concat(clientId, "/runtime_config"), body, await _prepareRequestHeaders());
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
/**
|
|
196
|
-
*
|
|
197
|
-
*
|
|
198
|
-
* @async
|
|
199
|
-
* @returns {array} - list of connected clients, each clinet is an object with id and type property
|
|
200
|
-
*/
|
|
201
|
-
async function getClientStatusList() {
|
|
202
|
-
let response = await _index.http.get("".concat(_config.Config.apiBaseURL, "/v1/eventbus/clients"), await _prepareRequestHeaders());
|
|
203
|
-
return response.data.clients;
|
|
204
|
-
}
|
|
205
|
-
async function _prepareRequestHeaders() {
|
|
206
|
-
return {
|
|
207
|
-
"Content-Type": "application/json",
|
|
208
|
-
Accept: "application/json",
|
|
209
|
-
"x-jibb-user-jwt": await _auth.Auth.getUserToken()
|
|
210
|
-
};
|
|
211
|
-
}
|
|
212
|
-
function _makeRuntimeConfig(_ref4) {
|
|
213
|
-
let {
|
|
214
|
-
fixedCorners,
|
|
215
|
-
flipLeftRight,
|
|
216
|
-
flipUpDown,
|
|
217
|
-
rotation,
|
|
218
|
-
customCorners,
|
|
219
|
-
enableColor,
|
|
220
|
-
enableEstimation
|
|
221
|
-
} = _ref4;
|
|
222
|
-
switch (rotation) {
|
|
223
|
-
case 90:
|
|
224
|
-
rotation = "1";
|
|
225
|
-
break;
|
|
226
|
-
case 180:
|
|
227
|
-
case -180:
|
|
228
|
-
rotation = "2";
|
|
229
|
-
break;
|
|
230
|
-
case -90:
|
|
231
|
-
case 270:
|
|
232
|
-
rotation = "3";
|
|
233
|
-
break;
|
|
234
|
-
case 0:
|
|
235
|
-
case 360:
|
|
236
|
-
default:
|
|
237
|
-
rotation = "0";
|
|
238
|
-
break;
|
|
239
|
-
}
|
|
240
|
-
return {
|
|
241
|
-
custom_corners: customCorners || [],
|
|
242
|
-
rotation: rotation,
|
|
243
|
-
enable_color: enableColor || false,
|
|
244
|
-
fixed_corners: fixedCorners,
|
|
245
|
-
enable_estimation: enableEstimation || false,
|
|
246
|
-
flip_up_down: flipUpDown || false,
|
|
247
|
-
flip_left_right: flipLeftRight || false
|
|
248
|
-
};
|
|
249
|
-
}
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.getCameraList=getCameraList,exports.getCameraPreview=getCameraPreview,exports.getClientStatusList=getClientStatusList,exports.sendMessage=sendMessage,exports.setRuntimeConfig=setRuntimeConfig,exports.startStream=startStream,exports.stopStream=stopStream,require("core-js/modules/es.promise.js");var _auth=require("./auth.js"),_config=require("../config.js"),_index=require("../utils/http/index.js");async function getCameraList(a){let b=await _index.http.get("".concat(_config.Config.apiBaseURL,"/v1/eventbus/clients/").concat(a,"/cameras"),await _prepareRequestHeaders());return b.data.items}async function getCameraPreview(a){let{cameraId:b,clientId:c}=a,d=await _index.http.post("".concat(_config.Config.apiBaseURL,"/v1/eventbus/").concat(c,"/preview"),{source:{id:b}},await _prepareRequestHeaders());return d.data.image}async function startStream(a){let{meetingId:b,meetingToken:c,surfaceType:d,cameraId:e,sipUri:f,flipLeftRight:g,flipUpDown:h,rotation:i,fixedCorners:j,clientId:k,customCorners:l,enableColor:m,enableEstimation:n}=a,o={config:{surface_type:d},app_config:{meeting_id:b,meeting_token:c},runtime_config:_makeRuntimeConfig({fixedCorners:j,flipLeftRight:g,flipUpDown:h,rotation:i,customCorners:l,enableColor:m,enableEstimation:n})};if(!e&&!f)return Promise.reject("Invalid request: either sipUri or cameraId should be specified");if(e&&f)return Promise.reject("Invalid request: both sipUri (".concat(f,") and cameraId (").concat(f,") are specified"));f?o.sip_uri=f:o.camera={id:e};return _index.http.post("".concat(_config.Config.apiBaseURL,"/v1/eventbus/clients/").concat(k,"/start"),{start_request:o},await _prepareRequestHeaders())}async function stopStream(a){return _index.http.post("".concat(_config.Config.apiBaseURL,"/v1/eventbus/").concat(a,"/stop"),{},await _prepareRequestHeaders())}async function sendMessage(a){return _index.http.post("".concat(_config.Config.apiBaseURL,"/v1/eventbus"),a,await _prepareRequestHeaders())}async function setRuntimeConfig(a){let{flipLeftRight:b,flipUpDown:c,rotation:d,fixedCorners:e,customCorners:f,clientId:g,enableColor:h,enableEstimation:i}=a,j={runtime_config_request:{runtime_config:_makeRuntimeConfig({fixedCorners:e,flipLeftRight:b,flipUpDown:c,rotation:d,customCorners:f,enableColor:h,enableEstimation:i})}};return _index.http.post("".concat(_config.Config.apiBaseURL,"/v1/eventbus/").concat(g,"/runtime_config"),j,await _prepareRequestHeaders())}async function getClientStatusList(){let a=await _index.http.get("".concat(_config.Config.apiBaseURL,"/v1/eventbus/clients"),await _prepareRequestHeaders());return a.data.clients}async function _prepareRequestHeaders(){return{"Content-Type":"application/json",Accept:"application/json","x-jibb-user-jwt":await _auth.Auth.getUserToken()}}function _makeRuntimeConfig(a){let{fixedCorners:b,flipLeftRight:c,flipUpDown:d,rotation:e,customCorners:f,enableColor:g,enableEstimation:h}=a;switch(e){case 90:e="1";break;case 180:case-180:e="2";break;case-90:case 270:e="3";break;case 0:case 360:default:e="0";}return{custom_corners:f||[],rotation:e,enable_color:g||!1,fixed_corners:b,enable_estimation:h||!1,flip_up_down:d||!1,flip_left_right:c||!1}}
|
package/api/index.js
CHANGED
|
@@ -1,53 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
require("core-js/modules/web.dom-collections.iterator.js");
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.Admin = void 0;
|
|
8
|
-
Object.defineProperty(exports, "Auth", {
|
|
9
|
-
enumerable: true,
|
|
10
|
-
get: function get() {
|
|
11
|
-
return _auth.Auth;
|
|
12
|
-
}
|
|
13
|
-
});
|
|
14
|
-
exports.WebexBot = exports.User = exports.SuperAdmin = exports.Recording = exports.Meeting = exports.EventBus = void 0;
|
|
15
|
-
Object.defineProperty(exports, "Whiteboard", {
|
|
16
|
-
enumerable: true,
|
|
17
|
-
get: function get() {
|
|
18
|
-
return _whiteboard.Whiteboard;
|
|
19
|
-
}
|
|
20
|
-
});
|
|
21
|
-
exports.default = void 0;
|
|
22
|
-
var WebexBot = _interopRequireWildcard(require("./webexbot.js"));
|
|
23
|
-
exports.WebexBot = WebexBot;
|
|
24
|
-
var Meeting = _interopRequireWildcard(require("./meeting.js"));
|
|
25
|
-
exports.Meeting = Meeting;
|
|
26
|
-
var SuperAdmin = _interopRequireWildcard(require("./superadmin.js"));
|
|
27
|
-
exports.SuperAdmin = SuperAdmin;
|
|
28
|
-
var Admin = _interopRequireWildcard(require("./admin.js"));
|
|
29
|
-
exports.Admin = Admin;
|
|
30
|
-
var User = _interopRequireWildcard(require("./user.js"));
|
|
31
|
-
exports.User = User;
|
|
32
|
-
var _auth = require("./auth.js");
|
|
33
|
-
var _whiteboard = require("./whiteboard.js");
|
|
34
|
-
var EventBus = _interopRequireWildcard(require("./eventbus.js"));
|
|
35
|
-
exports.EventBus = EventBus;
|
|
36
|
-
var Recording = _interopRequireWildcard(require("./recording.js"));
|
|
37
|
-
exports.Recording = Recording;
|
|
38
|
-
var _index = require("../utils/logger/index.js");
|
|
39
|
-
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
40
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
41
|
-
(0, _index.initPinoLogger)();
|
|
42
|
-
var _default = {
|
|
43
|
-
WebexBot,
|
|
44
|
-
Meeting,
|
|
45
|
-
Auth: _auth.Auth,
|
|
46
|
-
User,
|
|
47
|
-
Admin,
|
|
48
|
-
SuperAdmin,
|
|
49
|
-
Recording,
|
|
50
|
-
Whiteboard: _whiteboard.Whiteboard,
|
|
51
|
-
EventBus
|
|
52
|
-
};
|
|
53
|
-
exports.default = _default;
|
|
1
|
+
"use strict";var WebexBot=_interopRequireWildcard(require("./webexbot.js"));var Meeting=_interopRequireWildcard(require("./meeting.js"));var SuperAdmin=_interopRequireWildcard(require("./superadmin.js"));var Admin=_interopRequireWildcard(require("./admin.js"));var User=_interopRequireWildcard(require("./user.js"));var Recording=_interopRequireWildcard(require("./recording.js"));var _index=require("../utils/logger/index.js");require("core-js/modules/web.dom-collections.iterator.js"),Object.defineProperty(exports,"__esModule",{value:!0}),exports.Admin=void 0,Object.defineProperty(exports,"Auth",{enumerable:!0,get:function get(){return _auth.Auth}}),exports.WebexBot=exports.User=exports.SuperAdmin=exports.Recording=exports.Meeting=exports.EventBus=void 0,Object.defineProperty(exports,"Whiteboard",{enumerable:!0,get:function get(){return _whiteboard.Whiteboard}}),exports.default=void 0;exports.WebexBot=WebexBot;exports.Meeting=Meeting;exports.SuperAdmin=SuperAdmin;exports.Admin=Admin;exports.User=User;var _auth=require("./auth.js"),_whiteboard=require("./whiteboard.js"),EventBus=_interopRequireWildcard(require("./eventbus.js"));exports.EventBus=EventBus;exports.Recording=Recording;function _getRequireWildcardCache(a){if("function"!=typeof WeakMap)return null;var b=new WeakMap,c=new WeakMap;return(_getRequireWildcardCache=function(a){return a?c:b})(a)}function _interopRequireWildcard(a,b){if(!b&&a&&a.__esModule)return a;if(null===a||"object"!=typeof a&&"function"!=typeof a)return{default:a};var c=_getRequireWildcardCache(b);if(c&&c.has(a))return c.get(a);var d={},e=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var f in a)if("default"!=f&&Object.prototype.hasOwnProperty.call(a,f)){var g=e?Object.getOwnPropertyDescriptor(a,f):null;g&&(g.get||g.set)?Object.defineProperty(d,f,g):d[f]=a[f]}return d.default=a,c&&c.set(a,d),d}(0,_index.initPinoLogger)();var _default={WebexBot,Meeting,Auth:_auth.Auth,User,Admin,SuperAdmin,Recording,Whiteboard:_whiteboard.Whiteboard,EventBus};exports.default=_default;
|