@jibb-open/jssdk 3.5.9 → 3.5.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.
Files changed (87) hide show
  1. package/{dist/api → api}/admin.js +0 -0
  2. package/{dist/api → api}/auth.js +0 -0
  3. package/{dist/api → api}/eventbus.js +0 -0
  4. package/{dist/api → api}/index.js +0 -0
  5. package/{dist/api → api}/meeting.js +0 -0
  6. package/{dist/api → api}/recording.js +0 -0
  7. package/{dist/api → api}/superadmin.js +0 -0
  8. package/{dist/api → api}/user.js +0 -0
  9. package/{dist/api → api}/webexbot.js +0 -0
  10. package/{dist/api → api}/whiteboard.js +0 -0
  11. package/{dist/config.js → config.js} +0 -0
  12. package/{dist/examples → examples}/browser/462.jibb.js +0 -0
  13. package/{dist/examples → examples}/browser/index.html +0 -0
  14. package/{dist/examples → examples}/browser/jibb.js +0 -0
  15. package/{dist/examples → examples}/browser/startSession.js +0 -0
  16. package/{dist/examples → examples}/examples.js +0 -0
  17. package/{dist/examples → examples}/webexDevicesMacros/cameraPresets/jibb.js +0 -0
  18. package/{dist/examples → examples}/webexDevicesMacros/simplestExample/jibb.js +0 -0
  19. package/{dist/examples → examples}/webexDevicesMacros/webexDevice JSSDK/jibb_WebexXapi.js +0 -0
  20. package/{dist/examples → examples}/webexDevicesMacros/withCameraControl/jibb.js +0 -0
  21. package/package.json +1 -1
  22. package/{dist/post-processing.js → post-processing.js} +0 -0
  23. package/{dist/types → types}/exceptions.js +0 -0
  24. package/{dist/types → types}/jibb.pb.js +0 -0
  25. package/{dist/types → types}/proto.js +0 -0
  26. package/{dist/types → types}/types.js +0 -0
  27. package/{dist/utils → utils}/cached_variable.js +0 -0
  28. package/{dist/utils → utils}/future.js +0 -0
  29. package/{dist/utils → utils}/http/http.axios.js +0 -0
  30. package/{dist/utils → utils}/http/index.js +0 -0
  31. package/{dist/utils → utils}/index.js +0 -0
  32. package/{dist/utils → utils}/logger/index.js +0 -0
  33. package/{dist/utils → utils}/logger/logger.empty.js +0 -0
  34. package/{dist/utils → utils}/logger/logger.pino.js +0 -0
  35. package/{dist/ws → ws}/connection_base.js +0 -0
  36. package/{dist/ws → ws}/eventbus.js +0 -0
  37. package/{dist/ws → ws}/index.js +0 -0
  38. package/{dist/ws → ws}/ipsa.js +0 -0
  39. package/{dist/ws → ws}/meeting.js +0 -0
  40. package/{dist/ws → ws}/observable_connection.js +0 -0
  41. package/{dist/ws → ws}/retry_connection.js +0 -0
  42. package/.babelrc +0 -31
  43. package/README.md +0 -4
  44. package/dist/package.json +0 -69
  45. package/src/api/admin.js +0 -333
  46. package/src/api/auth.js +0 -208
  47. package/src/api/eventbus.js +0 -246
  48. package/src/api/index.js +0 -26
  49. package/src/api/meeting.js +0 -421
  50. package/src/api/recording.js +0 -225
  51. package/src/api/superadmin.js +0 -84
  52. package/src/api/user.js +0 -46
  53. package/src/api/webexbot.js +0 -32
  54. package/src/api/whiteboard.js +0 -175
  55. package/src/config.js +0 -12
  56. package/src/examples/browser/462.jibb.js +0 -1
  57. package/src/examples/browser/index.html +0 -17
  58. package/src/examples/browser/jibb.js +0 -2
  59. package/src/examples/browser/startSession.js +0 -112
  60. package/src/examples/examples.js +0 -5
  61. package/src/examples/webexDevicesMacros/cameraPresets/jibb.js +0 -338
  62. package/src/examples/webexDevicesMacros/simplestExample/jibb.js +0 -212
  63. package/src/examples/webexDevicesMacros/webexDevice JSSDK/jibb_WebexXapi.js +0 -2
  64. package/src/examples/webexDevicesMacros/withCameraControl/jibb.js +0 -303
  65. package/src/index.webex-devices.js +0 -13
  66. package/src/post-processing.js +0 -39
  67. package/src/types/exceptions.js +0 -48
  68. package/src/types/jibb.pb.js +0 -1357
  69. package/src/types/proto.js +0 -7
  70. package/src/types/types.js +0 -64
  71. package/src/utils/cached_variable.js +0 -23
  72. package/src/utils/future.js +0 -24
  73. package/src/utils/http/http.axios.js +0 -34
  74. package/src/utils/http/http.xapi.js +0 -87
  75. package/src/utils/http/index.js +0 -8
  76. package/src/utils/index.js +0 -5
  77. package/src/utils/logger/index.js +0 -11
  78. package/src/utils/logger/logger.empty.js +0 -25
  79. package/src/utils/logger/logger.pino.js +0 -15
  80. package/src/ws/connection_base.js +0 -81
  81. package/src/ws/eventbus.js +0 -363
  82. package/src/ws/index.js +0 -15
  83. package/src/ws/ipsa.js +0 -246
  84. package/src/ws/meeting.js +0 -170
  85. package/src/ws/observable_connection.js +0 -84
  86. package/src/ws/retry_connection.js +0 -82
  87. package/webpack.config.cjs +0 -144
package/src/api/auth.js DELETED
@@ -1,208 +0,0 @@
1
- import { Config } from "../config.js"
2
- import { logger } from "../utils/logger/index.js"
3
- import { AccessLevel, UserClaims } from "../types/types.js"
4
- import { http } from "../utils/http/index.js"
5
-
6
- /**
7
- * @module auth
8
- */
9
-
10
-
11
- /**
12
- * AuthClass.
13
- * @class AuthClass
14
- *
15
- */
16
-
17
- class AuthClass {
18
- #userClaims
19
-
20
- constructor() {
21
- logger.debug("Creating new Auth instance")
22
- this.apiKey = undefined
23
- this.#userClaims = new Map()
24
- this.getIdToken = undefined
25
- }
26
-
27
- /**
28
- * Manually setting userToken
29
- * @param {string} token
30
- * @param {AccessLevel} accessLevel
31
- */
32
- setUserToken(token, accessLevel = AccessLevel.USER) {
33
- let claims = new UserClaims(token)
34
- this.#userClaims.set(accessLevel, claims)
35
- }
36
-
37
- /**
38
- * setting Api key
39
- * @param {string} apiKey
40
- */
41
- setApiKey(apiKey) {
42
- this.apiKey = apiKey
43
- this.#userClaims.clear()
44
- }
45
-
46
- async #getUserTokenFromApiKey({ expiry, accessLevel }) {
47
- let headers = {
48
- "Content-Type": "application/json",
49
- Accept: "application/json",
50
- }
51
- let body = {
52
- api_key: this.apiKey,
53
- expiry: {
54
- seconds: expiry,
55
- },
56
- }
57
- let url
58
-
59
- switch (accessLevel) {
60
- case AccessLevel.ADMIN:
61
- url = `${Config.apiBaseURL}/v1/admin/auth/token`
62
- break
63
- case AccessLevel.SUPERADMIN:
64
- url = `${Config.apiBaseURL}/v1/superadmin/auth/token`
65
- break
66
- default:
67
- url = `${Config.apiBaseURL}/v1/auth/token`
68
- break
69
- }
70
-
71
- let response = await http.post(url, body, headers)
72
- return response.data.token
73
- }
74
-
75
- async #getUserTokenFromIDToken({ expiry, accessLevel }) {
76
- let headers = {
77
- "Content-Type": "application/json",
78
- Accept: "application/json",
79
- "x-jibb-id-jwt": await this.getIdToken(),
80
- }
81
- let body = {
82
- expiry: {
83
- seconds: expiry,
84
- },
85
- }
86
- let url
87
-
88
- switch (accessLevel) {
89
- case AccessLevel.ADMIN:
90
- url = `${Config.apiBaseURL}/v1/admin/auth/token`
91
- break
92
- case AccessLevel.SUPERADMIN:
93
- url = `${Config.apiBaseURL}/v1/superadmin/auth/token`
94
- break
95
- default:
96
- url = `${Config.apiBaseURL}/v1/auth/token`
97
- break
98
- }
99
-
100
- let response = await http.post(url, body, headers)
101
- return response.data.token
102
- }
103
-
104
- /**
105
- *
106
- * @returns {UserClaims}
107
- */
108
- async getUserClaims() {
109
- await this.getUserToken()
110
- return this.#userClaims.get(AccessLevel.USER)
111
- }
112
-
113
- /**
114
- *
115
- * @async
116
- * @param {object} [param0={}]
117
- * @param {Number} [param0.expiry=3600] - meeting ID.
118
- * @param {boolean} [param0.refresh=fales] - 1 Read or 2 Write.
119
- * @param {AccessLevel} [param0.accessLevel=AccessLevel.USER]
120
- * @returns {string} - user Token.
121
- */
122
-
123
- async getUserToken({ expiry, refresh, accessLevel } = {}) {
124
- let claim = undefined
125
- refresh = refresh || false
126
- accessLevel = accessLevel || AccessLevel.USER
127
- expiry = expiry || 3600
128
-
129
- if (refresh === true) {
130
- await this.#refreshUserToken({ expiry, accessLevel })
131
- }
132
-
133
- claim = this.#userClaims.get(accessLevel)
134
- if (claim !== undefined && !claim.isExpired()) return claim.token
135
-
136
- await this.#refreshUserToken({ expiry, accessLevel })
137
-
138
- claim = this.#userClaims.get(accessLevel)
139
- if (claim !== undefined && !claim.isExpired()) return claim.token
140
-
141
- throw new Error("could not create user token")
142
- }
143
-
144
- async #refreshUserToken({ expiry, accessLevel }) {
145
- if (this.apiKey) {
146
- let token = await this.#getUserTokenFromApiKey({ expiry, accessLevel })
147
- this.setUserToken(token, accessLevel)
148
- return token
149
- }
150
-
151
- try {
152
- let token = await this.#getUserTokenFromIDToken({ expiry, accessLevel })
153
- this.setUserToken(token, accessLevel)
154
- return token
155
- } catch (error) {
156
- logger.error(error)
157
- }
158
- }
159
-
160
- /**
161
- * clear user.
162
- */
163
-
164
- logout() {
165
- this.#userClaims.clear()
166
- }
167
-
168
- /**
169
- *
170
- * Generate a new API Key, old API KEY will be discareded
171
- * It require a userToken to be set.
172
- * @returns {string} api key
173
- */
174
- async generateAPIKey() {
175
- let headers = {
176
- "Content-Type": "application/json",
177
- Accept: "application/json",
178
- "x-jibb-user-jwt": await this.getUserToken(),
179
- }
180
- let response = await http.get(`${Config.apiBaseURL}/v1/auth/apikey`, headers)
181
- return response.data.apiKey
182
- }
183
-
184
- /**
185
- *
186
- * Generating a one time password.
187
- * It require a IdToken to be set.
188
- * @async
189
- * @returns {string} - Custom Password.
190
- */
191
- async generateCustomAuthPassword() {
192
- let headers = {
193
- "Content-Type": "application/json",
194
- Accept: "application/json",
195
- "x-jibb-id-jwt": await this.getIdToken(),
196
- }
197
-
198
- let response = await http.get(`${Config.apiBaseURL}/v1/auth/custom`, headers)
199
- return response.data.password
200
- }
201
- }
202
-
203
- /**
204
- * Expotred instance of AuthClass.
205
- * @type {AuthClass}
206
- */
207
- let Auth = new AuthClass()
208
- export { Auth }
@@ -1,246 +0,0 @@
1
- import {Auth} from './auth.js';
2
- import {Config} from '../config.js'
3
- import {http} from "../utils/http/index.js"
4
-
5
- /**
6
- * EventBus.
7
- * @module EventBus
8
- *
9
- *
10
- */
11
-
12
- /**
13
- *
14
- * @async
15
- * @param {string} clientId
16
- * @returns {array} - list of available camera, each camera is an object of with id and name properties.
17
- */
18
- export async function getCameraList(clientId) {
19
- let response = await http.get(
20
- `${Config.apiBaseURL}/v1/eventbus/clients/${clientId}/cameras`,
21
- await _prepareRequestHeaders()
22
- )
23
- return response.data.items
24
- }
25
-
26
- /**
27
- *
28
- * @async
29
- * @param {object} param0
30
- * @param {object} param0.cameraId
31
- * @param {object} param0.clientId
32
- * @returns {data}
33
- */
34
- export async function getCameraPreview({ cameraId, clientId }) {
35
- let body = {
36
- source: {
37
- id: cameraId,
38
- },
39
- }
40
- let response = await http.post(
41
- `${Config.apiBaseURL}/v1/eventbus/${clientId}/preview`,
42
- body,
43
- await _prepareRequestHeaders()
44
- )
45
- return response.data.image
46
- }
47
-
48
- /**
49
- *
50
- * @async
51
- * @param {object} param0
52
- * @param {string} param0.meetingId
53
- * @param {string} param0.meeting_token
54
- * @param {string} param0.surfaceType - PAPER or WHITEBOARD
55
- * @param {string} [param0.cameraId] - either sipUri or cameraId should be specified.
56
- * @param {string} [param0.sipUri] - either sipUri or cameraId should be specified.
57
- * @param {boolean} [param0.flipLeftRight=false] - mirror output stream.
58
- * @param {boolean} [param0.flipUpDown=false] - mirror vertically output stream.
59
- * @param {number} [param0.rotation=0] - output rotation degree 0, 90, 180, 270.
60
- * @param {boolean} [param0.fixedCorners=fales] - enable srufcae fixed corners after first detection.
61
- * @param {string} param0.clientId
62
- * @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]
63
- * @param {boolean} [param0.enableColor]
64
- * @param {boolean} [param0.enableEstimation]
65
- * @returns - http result
66
- */
67
- export async function startStream({
68
- meetingId,
69
- meetingToken,
70
- surfaceType,
71
- cameraId,
72
- sipUri,
73
- flipLeftRight,
74
- flipUpDown,
75
- rotation,
76
- fixedCorners,
77
- clientId,
78
- customCorners,
79
- enableColor,
80
- enableEstimation,
81
- }) {
82
- let request = {
83
- config: {
84
- surface_type: surfaceType,
85
- },
86
- app_config: {
87
- meeting_id: meetingId,
88
- meeting_token: meetingToken,
89
- },
90
- runtime_config: _makeRuntimeConfig({
91
- fixedCorners,
92
- flipLeftRight,
93
- flipUpDown,
94
- rotation,
95
- customCorners,
96
- enableColor,
97
- enableEstimation,
98
- }),
99
- }
100
-
101
- if (!cameraId && !sipUri) {
102
- return Promise.reject(`Invalid request: either sipUri or cameraId should be specified`)
103
- }
104
- if (cameraId && sipUri) {
105
- return Promise.reject(`Invalid request: both sipUri (${sipUri}) and cameraId (${sipUri}) are specified`)
106
- } else if (sipUri) {
107
- request["sip_uri"] = sipUri
108
- } else {
109
- request["camera"] = {
110
- id: cameraId,
111
- }
112
- }
113
-
114
- let body = {
115
- start_request: request,
116
- }
117
-
118
- return http.post(`${Config.apiBaseURL}/v1/eventbus/clients/${clientId}/start`, body, await _prepareRequestHeaders())
119
- }
120
-
121
- //if there is no body I get error code:401 status:Unauthorized
122
-
123
- /**
124
- *
125
- * @async
126
- * @param {string} clientId
127
- * @returns - http result
128
- */
129
- export async function stopStream(clientId) {
130
- let body = {}
131
- return http.post(`${Config.apiBaseURL}/v1/eventbus/${clientId}/stop`, body, await _prepareRequestHeaders())
132
- }
133
-
134
- // the only decent solution that comes to my mind is using body as parameter,
135
- //other one is having all possible events as paramaters ( more than 13) and then check for null and build the body like jibb.startStream.
136
- // we can send grpc event data but then client need to have the grpc file and complie it.
137
-
138
- /**
139
- *
140
- * @async
141
- * @param {string} body
142
- * @returns - http result.
143
- */
144
- export async function sendMessage(body) {
145
- return http.post(`${Config.apiBaseURL}/v1/eventbus`, body, await _prepareRequestHeaders())
146
- }
147
- /**
148
- *
149
- * @async
150
- * @param {object} param0
151
- * @param {boolean} [param0.flipLeftRight=false] - mirror output stream.
152
- * @param {boolean} [param0.flipUpDown=false] - mirror vertically output stream.
153
- * @param {number} [param0.rotation=0] - output rotation degree 0, 90, 180, 270.
154
- * @param {boolean} [param0.fixedCorners=fales] - enable srufcae fixed corners after first detection.
155
- * @param {string} param0.clientId
156
- * @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]
157
- * @param {boolean} [param0.enableColor]
158
- * @param {boolean} [param0.enableEstimation]
159
- * @returns - http result.
160
- */
161
- export async function setRuntimeConfig({
162
- flipLeftRight,
163
- flipUpDown,
164
- rotation,
165
- fixedCorners,
166
- customCorners,
167
- clientId,
168
- enableColor,
169
- enableEstimation,
170
- }) {
171
- let body = {
172
- runtime_config_request: {
173
- runtime_config: _makeRuntimeConfig({
174
- fixedCorners,
175
- flipLeftRight,
176
- flipUpDown,
177
- rotation,
178
- customCorners,
179
- enableColor,
180
- enableEstimation,
181
- }),
182
- },
183
- }
184
-
185
- return http.post(`${Config.apiBaseURL}/v1/eventbus/${clientId}/runtime_config`, body, await _prepareRequestHeaders())
186
- }
187
-
188
- /**
189
- *
190
- *
191
- * @async
192
- * @returns {array} - list of connected clients, each clinet is an object with id and type property
193
- */
194
- export async function getClientStatusList() {
195
- let response = await http.get(`${Config.apiBaseURL}/v1/eventbus/clients`, await _prepareRequestHeaders())
196
-
197
- return response.data.clients
198
- }
199
-
200
- async function _prepareRequestHeaders() {
201
- return {
202
- "Content-Type": "application/json",
203
- Accept: "application/json",
204
- "x-jibb-user-jwt": await Auth.getUserToken(),
205
- }
206
- }
207
-
208
- function _makeRuntimeConfig({
209
- fixedCorners,
210
- flipLeftRight,
211
- flipUpDown,
212
- rotation,
213
- customCorners,
214
- enableColor,
215
- enableEstimation,
216
- }) {
217
- switch (rotation) {
218
- case 90:
219
- rotation = "1"
220
- break
221
- case 180:
222
- case -180:
223
- rotation = "2"
224
- break
225
- case -90:
226
- case 270:
227
- rotation = "3"
228
- break
229
- case 0:
230
- case 360:
231
- default:
232
- rotation = "0"
233
- break
234
- }
235
-
236
- return {
237
- custom_corners: customCorners || [],
238
- rotation: rotation,
239
- enable_color: enableColor || false,
240
- fixed_corners: fixedCorners,
241
- enable_estimation: enableEstimation || false,
242
- flip_up_down: flipUpDown || false,
243
- flip_left_right: flipLeftRight || false,
244
- }
245
- }
246
-
package/src/api/index.js DELETED
@@ -1,26 +0,0 @@
1
- import * as WebexBot from "./webexbot.js"
2
- import * as Meeting from "./meeting.js"
3
- import * as SuperAdmin from "./superadmin.js"
4
- import * as Admin from "./admin.js"
5
- import * as User from "./user.js"
6
- import {Auth} from "./auth.js"
7
- import {Whiteboard} from "./whiteboard.js"
8
- import * as EventBus from "./eventbus.js"
9
- import * as Recording from "./recording.js"
10
- import {initPinoLogger} from "../utils/logger/index.js"
11
-
12
- initPinoLogger()
13
-
14
- export {WebexBot, Meeting, Auth, User, Admin, SuperAdmin, Recording, Whiteboard, EventBus}
15
-
16
- export default {
17
- WebexBot,
18
- Meeting,
19
- Auth,
20
- User,
21
- Admin,
22
- SuperAdmin,
23
- Recording,
24
- Whiteboard,
25
- EventBus,
26
- }