@jibb-open/jssdk 3.5.8 → 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 (83) hide show
  1. package/api/admin.js +418 -0
  2. package/api/auth.js +246 -0
  3. package/api/eventbus.js +249 -0
  4. package/api/index.js +53 -0
  5. package/api/meeting.js +488 -0
  6. package/api/recording.js +260 -0
  7. package/api/superadmin.js +105 -0
  8. package/api/user.js +51 -0
  9. package/api/webexbot.js +41 -0
  10. package/api/whiteboard.js +179 -0
  11. package/config.js +16 -0
  12. package/examples/browser/462.jibb.js +306 -0
  13. package/{src/examples → examples}/browser/index.html +0 -0
  14. package/examples/browser/jibb.js +7381 -0
  15. package/examples/browser/startSession.js +102 -0
  16. package/{src/examples → examples}/examples.js +1 -0
  17. package/examples/webexDevicesMacros/cameraPresets/jibb.js +280 -0
  18. package/examples/webexDevicesMacros/simplestExample/jibb.js +182 -0
  19. package/examples/webexDevicesMacros/webexDevice JSSDK/jibb_WebexXapi.js +3033 -0
  20. package/examples/webexDevicesMacros/withCameraControl/jibb.js +264 -0
  21. package/package.json +1 -1
  22. package/post-processing.js +43 -0
  23. package/types/exceptions.js +55 -0
  24. package/{src/types → types}/jibb.pb.js +5 -38
  25. package/types/proto.js +15 -0
  26. package/types/types.js +67 -0
  27. package/utils/cached_variable.js +25 -0
  28. package/utils/future.js +31 -0
  29. package/utils/http/http.axios.js +41 -0
  30. package/utils/http/index.js +10 -0
  31. package/utils/index.js +11 -0
  32. package/utils/logger/index.js +19 -0
  33. package/utils/logger/logger.empty.js +25 -0
  34. package/utils/logger/logger.pino.js +19 -0
  35. package/ws/connection_base.js +95 -0
  36. package/ws/eventbus.js +376 -0
  37. package/ws/index.js +36 -0
  38. package/ws/ipsa.js +262 -0
  39. package/ws/meeting.js +181 -0
  40. package/ws/observable_connection.js +87 -0
  41. package/ws/retry_connection.js +94 -0
  42. package/.babelrc +0 -31
  43. package/README.md +0 -4
  44. package/src/api/admin.js +0 -333
  45. package/src/api/auth.js +0 -208
  46. package/src/api/eventbus.js +0 -246
  47. package/src/api/index.js +0 -26
  48. package/src/api/meeting.js +0 -421
  49. package/src/api/recording.js +0 -225
  50. package/src/api/superadmin.js +0 -84
  51. package/src/api/user.js +0 -46
  52. package/src/api/webexbot.js +0 -32
  53. package/src/api/whiteboard.js +0 -175
  54. package/src/config.js +0 -12
  55. package/src/examples/browser/462.jibb.js +0 -1
  56. package/src/examples/browser/jibb.js +0 -2
  57. package/src/examples/browser/startSession.js +0 -112
  58. package/src/examples/webexDevicesMacros/cameraPresets/jibb.js +0 -338
  59. package/src/examples/webexDevicesMacros/simplestExample/jibb.js +0 -212
  60. package/src/examples/webexDevicesMacros/webexDevice JSSDK/jibb_WebexXapi.js +0 -2
  61. package/src/examples/webexDevicesMacros/withCameraControl/jibb.js +0 -303
  62. package/src/index.webex-devices.js +0 -13
  63. package/src/post-processing.js +0 -39
  64. package/src/types/exceptions.js +0 -48
  65. package/src/types/proto.js +0 -7
  66. package/src/types/types.js +0 -64
  67. package/src/utils/cached_variable.js +0 -23
  68. package/src/utils/future.js +0 -24
  69. package/src/utils/http/http.axios.js +0 -34
  70. package/src/utils/http/http.xapi.js +0 -87
  71. package/src/utils/http/index.js +0 -8
  72. package/src/utils/index.js +0 -5
  73. package/src/utils/logger/index.js +0 -11
  74. package/src/utils/logger/logger.empty.js +0 -25
  75. package/src/utils/logger/logger.pino.js +0 -15
  76. package/src/ws/connection_base.js +0 -81
  77. package/src/ws/eventbus.js +0 -363
  78. package/src/ws/index.js +0 -15
  79. package/src/ws/ipsa.js +0 -246
  80. package/src/ws/meeting.js +0 -170
  81. package/src/ws/observable_connection.js +0 -84
  82. package/src/ws/retry_connection.js +0 -82
  83. package/webpack.config.cjs +0 -144
@@ -0,0 +1,249 @@
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
+ }
package/api/index.js ADDED
@@ -0,0 +1,53 @@
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;