fcr-core 3.8.0-alpha → 3.8.1-alpha
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/lib/chat-connection/index.js +26 -40
- package/lib/engine/index.js +72 -66
- package/lib/imports.js +0 -1
- package/lib/media-control/desktop.js +13 -18
- package/lib/media-control/mobile.js +13 -18
- package/lib/monitor-control/index.js +5 -10
- package/lib/peer-session/index.js +39 -47
- package/lib/plugins/chatroom.js +213 -229
- package/lib/room-control/ability-control/index.js +9 -14
- package/lib/room-control/group-control/index.js +16 -21
- package/lib/room-control/helpers/validation-helper.js +1 -1
- package/lib/room-control/index.js +36 -53
- package/lib/room-control/interpreter-control/index.js +34 -47
- package/lib/room-control/interpreter-control/room.js +4 -6
- package/lib/room-control/join-before-host-waitingroom-control/index.js +4 -6
- package/lib/room-control/mainroom-control/index.js +27 -35
- package/lib/room-control/privilege-control/helper.js +5 -8
- package/lib/room-control/privilege-control/index.js +19 -26
- package/lib/room-control/room-connector-control/index.js +19 -28
- package/lib/room-control/room-control-factory.js +1 -2
- package/lib/room-control/room-session/index.js +39 -46
- package/lib/room-control/shared-cache.js +29 -36
- package/lib/room-control/sharing-control/index.d.ts +1 -1
- package/lib/room-control/sharing-control/index.js +34 -42
- package/lib/room-control/stream-control/index.js +191 -195
- package/lib/room-control/stream-control/type.d.ts +1 -1
- package/lib/room-control/stt-control/de-compress-gzip.js +0 -10
- package/lib/room-control/stt-control/index.js +95 -98
- package/lib/room-control/stt-control/type.d.ts +1 -1
- package/lib/room-control/user-control/index.js +136 -143
- package/lib/room-control/waitingroom-control/index.js +9 -14
- package/lib/room-control/whiteboard-control/utils.js +2 -4
- package/lib/room-control/whiteboard-control-v1/board-subwindow.js +1 -2
- package/lib/room-control/whiteboard-control-v1/board-window.js +88 -99
- package/lib/room-control/whiteboard-control-v1/factory.js +4 -7
- package/lib/room-control/whiteboard-control-v1/index.js +28 -40
- package/lib/room-control/whiteboard-control-v1/mount-manager.js +2 -4
- package/lib/room-control/whiteboard-control-v1/utils.js +14 -17
- package/lib/room-control/whiteboard-control-v2/annotation-control/control.js +4 -6
- package/lib/room-control/whiteboard-control-v2/annotation-control/factory.js +5 -10
- package/lib/room-control/whiteboard-control-v2/base/index.js +34 -41
- package/lib/room-control/whiteboard-control-v2/base/main-window.js +24 -29
- package/lib/room-control/whiteboard-control-v2/utils.js +6 -7
- package/lib/room-control/whiteboard-control-v2/whiteboard-control/control.d.ts +0 -1
- package/lib/room-control/whiteboard-control-v2/whiteboard-control/control.js +23 -34
- package/lib/room-control/whiteboard-control-v2/whiteboard-control/factory.js +7 -14
- package/lib/room-router/index.js +47 -53
- package/lib/room-router/type.d.ts +2 -2
- package/lib/service/api.js +227 -250
- package/lib/utilities/collection.js +2 -3
- package/lib/utilities/error-helpers.js +27 -34
- package/lib/utilities/error.js +8 -9
- package/lib/utilities/join-helper.js +25 -32
- package/lib/utilities/logger.js +3 -6
- package/lib/utilities/parameters.js +4 -8
- package/lib/utilities/retry-helpers.js +0 -1
- package/lib/utilities/stream.js +11 -16
- package/lib/utilities/user.js +3 -4
- package/lib/utilities/validate-params.js +1 -2
- package/package.json +5 -6
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
require("core-js/modules/es.symbol.description.js");
|
|
4
3
|
require("core-js/modules/es.array.push.js");
|
|
5
4
|
require("core-js/modules/esnext.function.metadata.js");
|
|
6
5
|
require("core-js/modules/esnext.map.delete-all.js");
|
|
@@ -23,11 +22,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
23
22
|
value: true
|
|
24
23
|
});
|
|
25
24
|
exports.FcrBoardMainWindowImpl = void 0;
|
|
26
|
-
require("core-js/modules/es.error.cause.js");
|
|
27
25
|
require("core-js/modules/esnext.iterator.constructor.js");
|
|
28
26
|
require("core-js/modules/esnext.iterator.some.js");
|
|
29
|
-
require("core-js/modules/web.dom-collections.iterator.js");
|
|
30
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
31
27
|
var _forgeWhiteboard = require("@netless/forge-whiteboard");
|
|
32
28
|
var _observable = require("agora-foundation/lib/utilities/observable");
|
|
33
29
|
var _utils = require("../utils");
|
|
@@ -37,29 +33,30 @@ var _schema = require("agora-foundation/lib/utilities/schema");
|
|
|
37
33
|
var _validateParams = _interopRequireDefault(require("../../../utilities/validate-params"));
|
|
38
34
|
var _schema2 = require("../../../schema");
|
|
39
35
|
var _decorator = require("agora-foundation/lib/decorator");
|
|
40
|
-
|
|
41
|
-
let _initProto, _setBackgroundColorDecs, _setToolTypeDecs, _setStrokeWidthDecs, _setStrokeColorDecs, _setTextColorDecs, _setTextSizeDecs, _insertImageDecs, _setContainerSizeRatioDecs, _setBoardTransparentDecs, _updateWindowSizeDecs, _setAutoCancelDrawDecs, _ref;
|
|
36
|
+
let _initProto, _setBackgroundColorDecs, _setToolTypeDecs, _setStrokeWidthDecs, _setStrokeColorDecs, _setTextColorDecs, _setTextSizeDecs, _insertImageDecs, _setContainerSizeRatioDecs, _setBoardTransparentDecs, _updateWindowSizeDecs, _setAutoCancelDrawDecs;
|
|
42
37
|
function _applyDecs(e, t, r, n, o, a) { function i(e, t, r) { return function (n, o) { return r && r(n), e[t].call(n, o); }; } function c(e, t) { for (var r = 0; r < e.length; r++) e[r].call(t); return t; } function s(e, t, r, n) { if ("function" != typeof e && (n || void 0 !== e)) throw new TypeError(t + " must " + (r || "be") + " a function" + (n ? "" : " or undefined")); return e; } function applyDec(e, t, r, n, o, a, c, u, l, f, p, d, h) { function m(e) { if (!h(e)) throw new TypeError("Attempted to access private element on non-instance"); } var y, v = t[0], g = t[3], b = !u; if (!b) { r || Array.isArray(v) || (v = [v]); var w = {}, S = [], A = 3 === o ? "get" : 4 === o || d ? "set" : "value"; f ? (p || d ? w = { get: _setFunctionName(function () { return g(this); }, n, "get"), set: function (e) { t[4](this, e); } } : w[A] = g, p || _setFunctionName(w[A], n, 2 === o ? "" : A)) : p || (w = Object.getOwnPropertyDescriptor(e, n)); } for (var P = e, j = v.length - 1; j >= 0; j -= r ? 2 : 1) { var D = v[j], E = r ? v[j - 1] : void 0, I = {}, O = { kind: ["field", "accessor", "method", "getter", "setter", "class"][o], name: n, metadata: a, addInitializer: function (e, t) { if (e.v) throw Error("attempted to call addInitializer after decoration was finished"); s(t, "An initializer", "be", !0), c.push(t); }.bind(null, I) }; try { if (b) (y = s(D.call(E, P, O), "class decorators", "return")) && (P = y);else { var k, F; O.static = l, O.private = f, f ? 2 === o ? k = function (e) { return m(e), w.value; } : (o < 4 && (k = i(w, "get", m)), 3 !== o && (F = i(w, "set", m))) : (k = function (e) { return e[n]; }, (o < 2 || 4 === o) && (F = function (e, t) { e[n] = t; })); var N = O.access = { has: f ? h.bind() : function (e) { return n in e; } }; if (k && (N.get = k), F && (N.set = F), P = D.call(E, d ? { get: w.get, set: w.set } : w[A], O), d) { if ("object" == typeof P && P) (y = s(P.get, "accessor.get")) && (w.get = y), (y = s(P.set, "accessor.set")) && (w.set = y), (y = s(P.init, "accessor.init")) && S.push(y);else if (void 0 !== P) throw new TypeError("accessor decorators must return an object with get, set, or init properties or void 0"); } else s(P, (p ? "field" : "method") + " decorators", "return") && (p ? S.push(P) : w[A] = P); } } finally { I.v = !0; } } return (p || d) && u.push(function (e, t) { for (var r = S.length - 1; r >= 0; r--) t = S[r].call(e, t); return t; }), p || b || (f ? d ? u.push(i(w, "get"), i(w, "set")) : u.push(2 === o ? w[A] : i.call.bind(w[A])) : Object.defineProperty(e, n, w)), P; } function u(e, t) { return Object.defineProperty(e, Symbol.metadata || Symbol.for("Symbol.metadata"), { configurable: !0, enumerable: !0, value: t }); } if (arguments.length >= 6) var l = a[Symbol.metadata || Symbol.for("Symbol.metadata")]; var f = Object.create(null == l ? null : l), p = function (e, t, r, n) { var o, a, i = [], s = function (t) { return _checkInRHS(t) === e; }, u = new Map(); function l(e) { e && i.push(c.bind(null, e)); } for (var f = 0; f < t.length; f++) { var p = t[f]; if (Array.isArray(p)) { var d = p[1], h = p[2], m = p.length > 3, y = 16 & d, v = !!(8 & d), g = 0 == (d &= 7), b = h + "/" + v; if (!g && !m) { var w = u.get(b); if (!0 === w || 3 === w && 4 !== d || 4 === w && 3 !== d) throw Error("Attempted to decorate a public method/accessor that has the same name as a previously decorated public method/accessor. This is not currently supported by the decorators plugin. Property name was: " + h); u.set(b, !(d > 2) || d); } applyDec(v ? e : e.prototype, p, y, m ? "#" + h : _toPropertyKey(h), d, n, v ? a = a || [] : o = o || [], i, v, m, g, 1 === d, v && m ? s : r); } } return l(o), l(a), i; }(e, t, o, f); return r.length || u(e, f), { e: p, get c() { var t = []; return r.length && [u(applyDec(e, [r], n, e.name, 5, f, t), f), c.bind(null, t, e)]; } }; }
|
|
43
38
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
44
39
|
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
45
40
|
function _setFunctionName(e, t, n) { "symbol" == typeof t && (t = (t = t.description) ? "[" + t + "]" : ""); try { Object.defineProperty(e, "name", { configurable: !0, value: n ? n + " " + t : t }); } catch (e) {} return e; }
|
|
46
41
|
function _checkInRHS(e) { if (Object(e) !== e) throw TypeError("right-hand side of 'in' should be an object, got " + (null !== e ? typeof e : "null")); return e; }
|
|
47
|
-
_ref = (_setBackgroundColorDecs = [_log.trace, (0, _validateParams.default)(_schema.stringSchema)], _setToolTypeDecs = [_log.trace, (0, _validateParams.default)(_schema2.fcrBoardToolTypeSchema)], _setStrokeWidthDecs = [_log.trace, (0, _validateParams.default)(_schema2.numberSchema)], _setStrokeColorDecs = [_log.trace, (0, _validateParams.default)(_schema2.z.union([_schema2.colorSchema, _schema.stringSchema]))], _setTextColorDecs = [_log.trace, (0, _validateParams.default)(_schema2.colorSchema)], _setTextSizeDecs = [_log.trace, (0, _validateParams.default)(_schema2.numberSchema)], _insertImageDecs = [_log.trace, (0, _validateParams.default)(_schema.stringSchema, _schema2.numberSchema, _schema2.numberSchema, _schema2.numberSchema, _schema2.numberSchema)], _setContainerSizeRatioDecs = [_log.trace, (0, _validateParams.default)(_schema2.numberSchema)], _setBoardTransparentDecs = [_log.trace, (0, _validateParams.default)(_schema2.booleanSchema)], _updateWindowSizeDecs = [_log.trace, (0, _validateParams.default)(_schema2.fcrSizeSchema)], _setAutoCancelDrawDecs = [_log.trace, (0, _validateParams.default)(_schema2.booleanSchema)], "logger");
|
|
48
42
|
class FcrBoardMainWindowImpl {
|
|
43
|
+
static {
|
|
44
|
+
[_initProto] = _applyDecs(this, [[_log.trace, 2, "addPage"], [_log.trace, 2, "removePage"], [_log.trace, 2, "undo"], [_log.trace, 2, "redo"], [_log.trace, 2, "clean"], [_log.trace, 2, "getSnapshotImage"], [_setBackgroundColorDecs, 2, "setBackgroundColor"], [_log.trace, 2, "getPageInfo"], [_log.trace, 2, "prevPage"], [_log.trace, 2, "nextPage"], [_setToolTypeDecs, 2, "setToolType"], [_setStrokeWidthDecs, 2, "setStrokeWidth"], [_setStrokeColorDecs, 2, "setStrokeColor"], [_setTextColorDecs, 2, "setTextColor"], [_setTextSizeDecs, 2, "setTextSize"], [_insertImageDecs, 2, "insertImage"], [_log.trace, 2, "getContentView"], [_setContainerSizeRatioDecs, 2, "setContainerSizeRatio"], [_setBoardTransparentDecs, 2, "setBoardTransparent"], [_updateWindowSizeDecs, 2, "updateWindowSize"], [_setAutoCancelDrawDecs, 2, "setAutoCancelDraw"], [_log.trace, 2, "getWritable"], [[_decorator.bound, _log.trace], 2, "_handleApplicationLaunch"], [[_decorator.bound, _log.trace], 2, "_handleApplicationTerminal"], [_log.trace, 2, "_enableAutoCancel"]], []).e;
|
|
45
|
+
}
|
|
46
|
+
[(_setBackgroundColorDecs = [_log.trace, (0, _validateParams.default)(_schema.stringSchema)], _setToolTypeDecs = [_log.trace, (0, _validateParams.default)(_schema2.fcrBoardToolTypeSchema)], _setStrokeWidthDecs = [_log.trace, (0, _validateParams.default)(_schema2.numberSchema)], _setStrokeColorDecs = [_log.trace, (0, _validateParams.default)(_schema2.z.union([_schema2.colorSchema, _schema.stringSchema]))], _setTextColorDecs = [_log.trace, (0, _validateParams.default)(_schema2.colorSchema)], _setTextSizeDecs = [_log.trace, (0, _validateParams.default)(_schema2.numberSchema)], _insertImageDecs = [_log.trace, (0, _validateParams.default)(_schema.stringSchema, _schema2.numberSchema, _schema2.numberSchema, _schema2.numberSchema, _schema2.numberSchema)], _setContainerSizeRatioDecs = [_log.trace, (0, _validateParams.default)(_schema2.numberSchema)], _setBoardTransparentDecs = [_log.trace, (0, _validateParams.default)(_schema2.booleanSchema)], _updateWindowSizeDecs = [_log.trace, (0, _validateParams.default)(_schema2.fcrSizeSchema)], _setAutoCancelDrawDecs = [_log.trace, (0, _validateParams.default)(_schema2.booleanSchema)], "logger")] = (_initProto(this), (0, _logger.createLogger)({
|
|
47
|
+
prefix: 'FcrBoardMainWindowImpl'
|
|
48
|
+
}));
|
|
49
|
+
_observable = new _observable.AgoraObservable();
|
|
50
|
+
_currentPage = 0;
|
|
51
|
+
_background = 'rgba(0, 0, 0, 0)';
|
|
52
|
+
_isAutoCancelEnabled = false;
|
|
49
53
|
constructor(whiteboard, boardRoom, appId) {
|
|
50
|
-
(0, _defineProperty2.default)(this, _ref, (_initProto(this), (0, _logger.createLogger)({
|
|
51
|
-
prefix: 'FcrBoardMainWindowImpl'
|
|
52
|
-
})));
|
|
53
|
-
(0, _defineProperty2.default)(this, "_observable", new _observable.AgoraObservable());
|
|
54
|
-
(0, _defineProperty2.default)(this, "_currentPage", 0);
|
|
55
|
-
(0, _defineProperty2.default)(this, "_background", 'rgba(0, 0, 0, 0)');
|
|
56
|
-
(0, _defineProperty2.default)(this, "_isAutoCancelEnabled", false);
|
|
57
54
|
this._addLogObserver();
|
|
58
55
|
this._boardView = document.createElement('div');
|
|
59
56
|
this._boardView.classList.add('fcr-whiteboard-window-view');
|
|
60
57
|
this._boardView.appendChild(whiteboard.view);
|
|
61
|
-
this._boardView.style.height =
|
|
62
|
-
this._boardView.style.width =
|
|
58
|
+
this._boardView.style.height = `100%`;
|
|
59
|
+
this._boardView.style.width = `100%`;
|
|
63
60
|
this._boardView.setAttribute('data-app-id', appId);
|
|
64
61
|
this._whiteboard = whiteboard;
|
|
65
62
|
this._setBoardViewStyle(whiteboard.view);
|
|
@@ -68,7 +65,7 @@ class FcrBoardMainWindowImpl {
|
|
|
68
65
|
boardRoom.applicationManager.on('terminal', this._handleApplicationTerminal);
|
|
69
66
|
|
|
70
67
|
// @ts-ignore
|
|
71
|
-
this.logger.info(
|
|
68
|
+
this.logger.info(`initialized, room: ${boardRoom.roomId}`);
|
|
72
69
|
}
|
|
73
70
|
async addPage() {
|
|
74
71
|
this._whiteboard.addPage('next');
|
|
@@ -115,7 +112,7 @@ class FcrBoardMainWindowImpl {
|
|
|
115
112
|
}
|
|
116
113
|
async setBackgroundColor(color) {
|
|
117
114
|
this._background = color;
|
|
118
|
-
this.logger.info(
|
|
115
|
+
this.logger.info(`set canvas background color: ${this._background}`);
|
|
119
116
|
this._whiteboard.setCanvasBackgroundColor(color);
|
|
120
117
|
}
|
|
121
118
|
getPageInfo() {
|
|
@@ -146,7 +143,7 @@ class FcrBoardMainWindowImpl {
|
|
|
146
143
|
}
|
|
147
144
|
}
|
|
148
145
|
async setStrokeColor(color) {
|
|
149
|
-
const c = typeof color === 'string' ? color :
|
|
146
|
+
const c = typeof color === 'string' ? color : `rgb(${color.r},${color.g},${color.b})`;
|
|
150
147
|
if (this._whiteboard) {
|
|
151
148
|
this._whiteboard.strokeColor = c;
|
|
152
149
|
} else {
|
|
@@ -154,7 +151,7 @@ class FcrBoardMainWindowImpl {
|
|
|
154
151
|
}
|
|
155
152
|
}
|
|
156
153
|
async setTextColor(color) {
|
|
157
|
-
const c = typeof color === 'string' ? color :
|
|
154
|
+
const c = typeof color === 'string' ? color : `rgb(${color.r},${color.g},${color.b})`;
|
|
158
155
|
if (this._whiteboard) {
|
|
159
156
|
this._whiteboard.fillColor = c;
|
|
160
157
|
} else {
|
|
@@ -220,7 +217,7 @@ class FcrBoardMainWindowImpl {
|
|
|
220
217
|
this._whiteboard = app;
|
|
221
218
|
this._setBoardViewStyle(app.view);
|
|
222
219
|
if (this._background) {
|
|
223
|
-
this.logger.info(
|
|
220
|
+
this.logger.info(`set canvas background color: ${this._background}`);
|
|
224
221
|
this._whiteboard.setCanvasBackgroundColor(this._background);
|
|
225
222
|
}
|
|
226
223
|
this._enableAutoCancel(this._isAutoCancelEnabled);
|
|
@@ -234,18 +231,18 @@ class FcrBoardMainWindowImpl {
|
|
|
234
231
|
_handleApplicationTerminal(appId, app) {
|
|
235
232
|
try {
|
|
236
233
|
if (this._boardView.contains(app.view)) {
|
|
237
|
-
this.logger.info(
|
|
234
|
+
this.logger.info(`remove application view: ${appId}`);
|
|
238
235
|
this._boardView.removeChild(app.view);
|
|
239
236
|
} else {
|
|
240
|
-
this.logger.warn(
|
|
237
|
+
this.logger.warn(`application view not found in board view: ${appId}`);
|
|
241
238
|
}
|
|
242
239
|
} catch (e) {
|
|
243
|
-
this.logger.error(
|
|
240
|
+
this.logger.error(`failed to handle terminal: ${appId}`, e);
|
|
244
241
|
}
|
|
245
242
|
}
|
|
246
243
|
_setBoardViewStyle(view) {
|
|
247
|
-
view.style.height =
|
|
248
|
-
view.style.width =
|
|
244
|
+
view.style.height = `100%`;
|
|
245
|
+
view.style.width = `100%`;
|
|
249
246
|
view.style.backgroundColor = 'rgba(0, 0, 0, 0)';
|
|
250
247
|
}
|
|
251
248
|
_enableAutoCancel(enable) {
|
|
@@ -258,6 +255,4 @@ class FcrBoardMainWindowImpl {
|
|
|
258
255
|
this.addObserver((0, _logger.generateLogObserver)(this.logger, ['onWritable', 'onPageInfoUpdated', 'onUndoStateUpdated', 'onRedoStateUpdated']));
|
|
259
256
|
}
|
|
260
257
|
}
|
|
261
|
-
exports.FcrBoardMainWindowImpl = FcrBoardMainWindowImpl;
|
|
262
|
-
_FcrBoardMainWindowImpl = FcrBoardMainWindowImpl;
|
|
263
|
-
[_initProto] = _applyDecs(_FcrBoardMainWindowImpl, [[_log.trace, 2, "addPage"], [_log.trace, 2, "removePage"], [_log.trace, 2, "undo"], [_log.trace, 2, "redo"], [_log.trace, 2, "clean"], [_log.trace, 2, "getSnapshotImage"], [_setBackgroundColorDecs, 2, "setBackgroundColor"], [_log.trace, 2, "getPageInfo"], [_log.trace, 2, "prevPage"], [_log.trace, 2, "nextPage"], [_setToolTypeDecs, 2, "setToolType"], [_setStrokeWidthDecs, 2, "setStrokeWidth"], [_setStrokeColorDecs, 2, "setStrokeColor"], [_setTextColorDecs, 2, "setTextColor"], [_setTextSizeDecs, 2, "setTextSize"], [_insertImageDecs, 2, "insertImage"], [_log.trace, 2, "getContentView"], [_setContainerSizeRatioDecs, 2, "setContainerSizeRatio"], [_setBoardTransparentDecs, 2, "setBoardTransparent"], [_updateWindowSizeDecs, 2, "updateWindowSize"], [_setAutoCancelDrawDecs, 2, "setAutoCancelDraw"], [_log.trace, 2, "getWritable"], [[_decorator.bound, _log.trace], 2, "_handleApplicationLaunch"], [[_decorator.bound, _log.trace], 2, "_handleApplicationTerminal"], [_log.trace, 2, "_enableAutoCancel"]], []).e;
|
|
258
|
+
exports.FcrBoardMainWindowImpl = FcrBoardMainWindowImpl;
|
|
@@ -48,11 +48,11 @@ const getAnnotationConfigFromRoomProperties = (properties, logger) => {
|
|
|
48
48
|
let width = (0, _imports.get)(properties, 'widgets.annotation.size.width');
|
|
49
49
|
let height = (0, _imports.get)(properties, 'widgets.annotation.size.height');
|
|
50
50
|
if (typeof width !== 'number') {
|
|
51
|
-
logger.warn(
|
|
51
|
+
logger.warn(`got invalid width for annotation board, width: ${width}`);
|
|
52
52
|
width = 0;
|
|
53
53
|
}
|
|
54
54
|
if (typeof height !== 'number') {
|
|
55
|
-
logger.warn(
|
|
55
|
+
logger.warn(`got invalid height for annotation board, height: ${height}`);
|
|
56
56
|
height = 0;
|
|
57
57
|
}
|
|
58
58
|
const boardWidthVal = width;
|
|
@@ -65,16 +65,16 @@ const getAnnotationConfigFromRoomProperties = (properties, logger) => {
|
|
|
65
65
|
height: boardHeight
|
|
66
66
|
} = resizeToMax(boardWidthVal, boardHeightVal, FCR_ANNOTATION_SCALE_BASE));
|
|
67
67
|
} else {
|
|
68
|
-
logger.warn(
|
|
68
|
+
logger.warn(`got invalid width or height for annotation board, skip resizing, width: ${boardWidthVal}, height: ${boardHeightVal}`);
|
|
69
69
|
}
|
|
70
|
-
logger.info(
|
|
70
|
+
logger.info(`got board config info, ${(0, _imports.jsonstring)({
|
|
71
71
|
boardAppId,
|
|
72
72
|
boardId,
|
|
73
73
|
boardToken,
|
|
74
74
|
boardRegion,
|
|
75
75
|
boardWidth,
|
|
76
76
|
boardHeight
|
|
77
|
-
}))
|
|
77
|
+
})}`);
|
|
78
78
|
return {
|
|
79
79
|
size: {
|
|
80
80
|
width: boardWidth,
|
|
@@ -89,8 +89,7 @@ const getAnnotationConfigFromRoomProperties = (properties, logger) => {
|
|
|
89
89
|
};
|
|
90
90
|
};
|
|
91
91
|
exports.getAnnotationConfigFromRoomProperties = getAnnotationConfigFromRoomProperties;
|
|
92
|
-
const resizeToMax =
|
|
93
|
-
let scaleBase = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : FCR_ANNOTATION_SCALE_BASE;
|
|
92
|
+
const resizeToMax = (w, h, scaleBase = FCR_ANNOTATION_SCALE_BASE) => {
|
|
94
93
|
const scale = scaleBase / Math.max(w, h);
|
|
95
94
|
return {
|
|
96
95
|
width: Math.round(w * scale),
|
|
@@ -24,7 +24,6 @@ export declare class FcrWhiteboardControlImpl extends FcrBaseWhiteboardControlIm
|
|
|
24
24
|
getBackgroundColor(): string;
|
|
25
25
|
getActivity(): boolean;
|
|
26
26
|
getOwnerId(): string | null;
|
|
27
|
-
protected getApplicationId(): string;
|
|
28
27
|
private _onScenePropertiesUpdated;
|
|
29
28
|
protected getWhiteboardOption(): WhiteboardOption;
|
|
30
29
|
protected addLogObserver(): void;
|
|
@@ -1,12 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
require("core-js/modules/es.symbol.description.js");
|
|
4
|
-
require("core-js/modules/es.error.cause.js");
|
|
5
3
|
require("core-js/modules/es.array.push.js");
|
|
6
4
|
require("core-js/modules/esnext.function.metadata.js");
|
|
7
|
-
require("core-js/modules/esnext.iterator.constructor.js");
|
|
8
|
-
require("core-js/modules/esnext.iterator.filter.js");
|
|
9
|
-
require("core-js/modules/esnext.iterator.for-each.js");
|
|
10
5
|
require("core-js/modules/esnext.map.delete-all.js");
|
|
11
6
|
require("core-js/modules/esnext.map.emplace.js");
|
|
12
7
|
require("core-js/modules/esnext.map.every.js");
|
|
@@ -27,8 +22,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
27
22
|
value: true
|
|
28
23
|
});
|
|
29
24
|
exports.FcrWhiteboardControlImpl = exports.FcrStandaloneWhiteboardControlImpl = void 0;
|
|
30
|
-
require("core-js/modules/web.dom-collections.iterator.js");
|
|
31
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
32
25
|
var _imports = require("../../../imports");
|
|
33
26
|
var _user = require("../../../utilities/user");
|
|
34
27
|
var _error = require("../../../utilities/error");
|
|
@@ -41,33 +34,33 @@ var _type = require("../../whiteboard-control/type");
|
|
|
41
34
|
var _type2 = require("../../sharing-control/type");
|
|
42
35
|
var _logger = require("../../../utilities/logger");
|
|
43
36
|
var _utils = require("../utils");
|
|
44
|
-
var _ref
|
|
45
|
-
let _initProto, _setBackgroundColorDecs
|
|
46
|
-
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
47
|
-
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
37
|
+
var _ref;
|
|
38
|
+
let _initProto, _setBackgroundColorDecs;
|
|
48
39
|
function _applyDecs(e, t, r, n, o, a) { function i(e, t, r) { return function (n, o) { return r && r(n), e[t].call(n, o); }; } function c(e, t) { for (var r = 0; r < e.length; r++) e[r].call(t); return t; } function s(e, t, r, n) { if ("function" != typeof e && (n || void 0 !== e)) throw new TypeError(t + " must " + (r || "be") + " a function" + (n ? "" : " or undefined")); return e; } function applyDec(e, t, r, n, o, a, c, u, l, f, p, d, h) { function m(e) { if (!h(e)) throw new TypeError("Attempted to access private element on non-instance"); } var y, v = t[0], g = t[3], b = !u; if (!b) { r || Array.isArray(v) || (v = [v]); var w = {}, S = [], A = 3 === o ? "get" : 4 === o || d ? "set" : "value"; f ? (p || d ? w = { get: _setFunctionName(function () { return g(this); }, n, "get"), set: function (e) { t[4](this, e); } } : w[A] = g, p || _setFunctionName(w[A], n, 2 === o ? "" : A)) : p || (w = Object.getOwnPropertyDescriptor(e, n)); } for (var P = e, j = v.length - 1; j >= 0; j -= r ? 2 : 1) { var D = v[j], E = r ? v[j - 1] : void 0, I = {}, O = { kind: ["field", "accessor", "method", "getter", "setter", "class"][o], name: n, metadata: a, addInitializer: function (e, t) { if (e.v) throw Error("attempted to call addInitializer after decoration was finished"); s(t, "An initializer", "be", !0), c.push(t); }.bind(null, I) }; try { if (b) (y = s(D.call(E, P, O), "class decorators", "return")) && (P = y);else { var k, F; O.static = l, O.private = f, f ? 2 === o ? k = function (e) { return m(e), w.value; } : (o < 4 && (k = i(w, "get", m)), 3 !== o && (F = i(w, "set", m))) : (k = function (e) { return e[n]; }, (o < 2 || 4 === o) && (F = function (e, t) { e[n] = t; })); var N = O.access = { has: f ? h.bind() : function (e) { return n in e; } }; if (k && (N.get = k), F && (N.set = F), P = D.call(E, d ? { get: w.get, set: w.set } : w[A], O), d) { if ("object" == typeof P && P) (y = s(P.get, "accessor.get")) && (w.get = y), (y = s(P.set, "accessor.set")) && (w.set = y), (y = s(P.init, "accessor.init")) && S.push(y);else if (void 0 !== P) throw new TypeError("accessor decorators must return an object with get, set, or init properties or void 0"); } else s(P, (p ? "field" : "method") + " decorators", "return") && (p ? S.push(P) : w[A] = P); } } finally { I.v = !0; } } return (p || d) && u.push(function (e, t) { for (var r = S.length - 1; r >= 0; r--) t = S[r].call(e, t); return t; }), p || b || (f ? d ? u.push(i(w, "get"), i(w, "set")) : u.push(2 === o ? w[A] : i.call.bind(w[A])) : Object.defineProperty(e, n, w)), P; } function u(e, t) { return Object.defineProperty(e, Symbol.metadata || Symbol.for("Symbol.metadata"), { configurable: !0, enumerable: !0, value: t }); } if (arguments.length >= 6) var l = a[Symbol.metadata || Symbol.for("Symbol.metadata")]; var f = Object.create(null == l ? null : l), p = function (e, t, r, n) { var o, a, i = [], s = function (t) { return _checkInRHS(t) === e; }, u = new Map(); function l(e) { e && i.push(c.bind(null, e)); } for (var f = 0; f < t.length; f++) { var p = t[f]; if (Array.isArray(p)) { var d = p[1], h = p[2], m = p.length > 3, y = 16 & d, v = !!(8 & d), g = 0 == (d &= 7), b = h + "/" + v; if (!g && !m) { var w = u.get(b); if (!0 === w || 3 === w && 4 !== d || 4 === w && 3 !== d) throw Error("Attempted to decorate a public method/accessor that has the same name as a previously decorated public method/accessor. This is not currently supported by the decorators plugin. Property name was: " + h); u.set(b, !(d > 2) || d); } applyDec(v ? e : e.prototype, p, y, m ? "#" + h : _toPropertyKey(h), d, n, v ? a = a || [] : o = o || [], i, v, m, g, 1 === d, v && m ? s : r); } } return l(o), l(a), i; }(e, t, o, f); return r.length || u(e, f), { e: p, get c() { var t = []; return r.length && [u(applyDec(e, [r], n, e.name, 5, f, t), f), c.bind(null, t, e)]; } }; }
|
|
49
40
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
50
41
|
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
51
42
|
function _setFunctionName(e, t, n) { "symbol" == typeof t && (t = (t = t.description) ? "[" + t + "]" : ""); try { Object.defineProperty(e, "name", { configurable: !0, value: n ? n + " " + t : t }); } catch (e) {} return e; }
|
|
52
43
|
function _checkInRHS(e) { if (Object(e) !== e) throw TypeError("right-hand side of 'in' should be an object, got " + (null !== e ? typeof e : "null")); return e; }
|
|
53
|
-
_ref2 = (_setBackgroundColorDecs = [_imports.trace, (0, _validateParams.default)(_schema.stringSchema)], "logger");
|
|
54
44
|
class FcrWhiteboardControlImpl extends (_ref = _base.FcrBaseWhiteboardControlImpl) {
|
|
45
|
+
static {
|
|
46
|
+
[_initProto] = _applyDecs(this, [[_imports.trace, 2, "active"], [_imports.trace, 2, "inactive"], [_setBackgroundColorDecs, 2, "setBackgroundColor"], [_imports.trace, 2, "getBackgroundColor"], [_imports.trace, 2, "getActivity"], [_imports.trace, 2, "getOwnerId"], [_imports.bound, 2, "_onScenePropertiesUpdated"]], [], 0, void 0, _ref).e;
|
|
47
|
+
}
|
|
48
|
+
[(_setBackgroundColorDecs = [_imports.trace, (0, _validateParams.default)(_schema.stringSchema)], "logger")] = (_initProto(this), (0, _logger.createLogger)({
|
|
49
|
+
prefix: 'FcrWhiteboardControlImpl'
|
|
50
|
+
}));
|
|
51
|
+
_backgroundColor = '#ffffff';
|
|
52
|
+
_isActive = false;
|
|
53
|
+
_ownerId = null;
|
|
54
|
+
_notifyObservers = {
|
|
55
|
+
onScenePropertiesUpdated: this._onScenePropertiesUpdated
|
|
56
|
+
};
|
|
55
57
|
constructor(rtmClient, config, hasOperationPrivilege, sharedCache, forgeInitConfigFetcher, _scene, _api) {
|
|
56
58
|
super(rtmClient, config, hasOperationPrivilege, forgeInitConfigFetcher);
|
|
57
|
-
(0, _defineProperty2.default)(this, _ref2, (_initProto(this), (0, _logger.createLogger)({
|
|
58
|
-
prefix: 'FcrWhiteboardControlImpl'
|
|
59
|
-
})));
|
|
60
|
-
(0, _defineProperty2.default)(this, "_backgroundColor", '#ffffff');
|
|
61
|
-
(0, _defineProperty2.default)(this, "_isActive", false);
|
|
62
|
-
(0, _defineProperty2.default)(this, "_ownerId", null);
|
|
63
|
-
(0, _defineProperty2.default)(this, "_notifyObservers", {
|
|
64
|
-
onScenePropertiesUpdated: this._onScenePropertiesUpdated
|
|
65
|
-
});
|
|
66
59
|
this._scene = _scene;
|
|
67
60
|
this._api = _api;
|
|
68
61
|
this._roomCache = sharedCache.getRoomCache(config.roomId);
|
|
69
62
|
this._scene.addObserver(this._notifyObservers);
|
|
70
|
-
this.logger.info(
|
|
63
|
+
this.logger.info(`Whitebaord Version: forge-whiteboard@${(0, _packageInfo.getDependenciesInfo)('@netless/forge-whiteboard')}, forge-room@${(0, _packageInfo.getDependenciesInfo)('@netless/forge-room')}, forge-room@${(0, _packageInfo.getDependenciesInfo)('@netless/forge-rtm')}`);
|
|
71
64
|
this._isActive = this._scene.getScenePropertiesByKeyPath('widgets.netlessBoard').state === 1;
|
|
72
65
|
const backgroundColor = this._scene.getScenePropertiesByKeyPath('widgets.netlessBoard.extra.backgroundColor');
|
|
73
66
|
if (backgroundColor) {
|
|
@@ -77,7 +70,7 @@ class FcrWhiteboardControlImpl extends (_ref = _base.FcrBaseWhiteboardControlImp
|
|
|
77
70
|
if (ownerId) {
|
|
78
71
|
this._ownerId = ownerId;
|
|
79
72
|
}
|
|
80
|
-
this.logger.info(
|
|
73
|
+
this.logger.info(`initialized, hasOperationPrivilege: ${hasOperationPrivilege}`);
|
|
81
74
|
}
|
|
82
75
|
async active() {
|
|
83
76
|
return (0, _error.handleRequestError)(() => this._api.toggleWhiteboardActivityState(this.config.roomId, _type2.FcrSharePermissionState.ON), _error.FcrErrorModuleCode.ROOM_WHITEBOARD, 'active failed');
|
|
@@ -121,15 +114,11 @@ class FcrWhiteboardControlImpl extends (_ref = _base.FcrBaseWhiteboardControlImp
|
|
|
121
114
|
getOwnerId() {
|
|
122
115
|
return this._ownerId;
|
|
123
116
|
}
|
|
124
|
-
getApplicationId() {
|
|
125
|
-
return _constant.WHITEBOARD_APP_ID;
|
|
126
|
-
}
|
|
127
117
|
_onScenePropertiesUpdated(sceneId, event) {
|
|
128
118
|
const operatorUser = (0, _user.convertRteUserToFcrUser)(event.operatorUser, this._roomCache);
|
|
129
119
|
const getByKeyPath = value => this._scene.getScenePropertiesByKeyPath(value);
|
|
130
120
|
if (event.cause && event.cause.cmd === 10) {
|
|
131
|
-
|
|
132
|
-
const state = (_getByKeyPath = getByKeyPath('widgets.netlessBoard.state')) !== null && _getByKeyPath !== void 0 ? _getByKeyPath : _type.FcrBoardPropertiesState.INACTIVE;
|
|
121
|
+
const state = getByKeyPath('widgets.netlessBoard.state') ?? _type.FcrBoardPropertiesState.INACTIVE;
|
|
133
122
|
const backgroundColor = getByKeyPath('widgets.netlessBoard.extra.backgroundColor');
|
|
134
123
|
const widgetCauseReason = (0, _imports.get)(event.cause.data, 'widgetCause.data.reason');
|
|
135
124
|
const widgetCauseCmd = (0, _imports.get)(event.cause.data, 'widgetCause.cmd');
|
|
@@ -151,27 +140,27 @@ class FcrWhiteboardControlImpl extends (_ref = _base.FcrBaseWhiteboardControlImp
|
|
|
151
140
|
}
|
|
152
141
|
}
|
|
153
142
|
getWhiteboardOption() {
|
|
154
|
-
return
|
|
143
|
+
return {
|
|
144
|
+
...super.getWhiteboardOption(),
|
|
155
145
|
width: _utils.WHITEBOARD_WIDTH,
|
|
156
146
|
height: _utils.WHITEBOARD_HEIGHT
|
|
157
|
-
}
|
|
147
|
+
};
|
|
158
148
|
}
|
|
159
149
|
addLogObserver() {
|
|
160
150
|
this.addObserver((0, _logger.generateLogObserver)(this.logger, ['onConnectionStateUpdated', 'onActive', 'onInactive', 'onBackgroundColorUpdated']));
|
|
161
151
|
}
|
|
162
152
|
}
|
|
163
153
|
exports.FcrWhiteboardControlImpl = FcrWhiteboardControlImpl;
|
|
164
|
-
_FcrWhiteboardControlImpl = FcrWhiteboardControlImpl;
|
|
165
|
-
[_initProto] = _applyDecs(_FcrWhiteboardControlImpl, [[_imports.trace, 2, "active"], [_imports.trace, 2, "inactive"], [_setBackgroundColorDecs, 2, "setBackgroundColor"], [_imports.trace, 2, "getBackgroundColor"], [_imports.trace, 2, "getActivity"], [_imports.trace, 2, "getOwnerId"], [_imports.bound, 2, "_onScenePropertiesUpdated"]], [], 0, void 0, _ref).e;
|
|
166
154
|
class FcrStandaloneWhiteboardControlImpl extends _base.FcrBaseWhiteboardControlImpl {
|
|
167
155
|
getApplicationId() {
|
|
168
156
|
return _constant.WHITEBOARD_APP_ID;
|
|
169
157
|
}
|
|
170
158
|
getWhiteboardOption() {
|
|
171
|
-
return
|
|
159
|
+
return {
|
|
160
|
+
...super.getWhiteboardOption(),
|
|
172
161
|
width: _utils.WHITEBOARD_WIDTH,
|
|
173
162
|
height: _utils.WHITEBOARD_HEIGHT
|
|
174
|
-
}
|
|
163
|
+
};
|
|
175
164
|
}
|
|
176
165
|
}
|
|
177
166
|
exports.FcrStandaloneWhiteboardControlImpl = FcrStandaloneWhiteboardControlImpl;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
require("core-js/modules/es.symbol.description.js");
|
|
4
3
|
require("core-js/modules/es.array.push.js");
|
|
5
4
|
require("core-js/modules/esnext.function.metadata.js");
|
|
6
5
|
require("core-js/modules/esnext.map.delete-all.js");
|
|
@@ -18,21 +17,16 @@ require("core-js/modules/esnext.map.reduce.js");
|
|
|
18
17
|
require("core-js/modules/esnext.map.some.js");
|
|
19
18
|
require("core-js/modules/esnext.map.update.js");
|
|
20
19
|
require("core-js/modules/esnext.symbol.metadata.js");
|
|
21
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
22
20
|
Object.defineProperty(exports, "__esModule", {
|
|
23
21
|
value: true
|
|
24
22
|
});
|
|
25
23
|
exports.FcrWhiteboardControlFactoryImpl = void 0;
|
|
26
|
-
require("core-js/modules/es.error.cause.js");
|
|
27
|
-
require("core-js/modules/web.dom-collections.iterator.js");
|
|
28
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
29
24
|
var _logger = require("../../../utilities/logger");
|
|
30
25
|
var _error = require("../../../utilities/error");
|
|
31
26
|
var _log = require("agora-foundation/lib/decorator/log");
|
|
32
27
|
var _base = require("../base");
|
|
33
28
|
var _control = require("./control");
|
|
34
29
|
var _sharedStorage = require("../../../utilities/shared-storage");
|
|
35
|
-
var _FcrWhiteboardControlFactoryImpl;
|
|
36
30
|
let _initProto;
|
|
37
31
|
function _applyDecs(e, t, r, n, o, a) { function i(e, t, r) { return function (n, o) { return r && r(n), e[t].call(n, o); }; } function c(e, t) { for (var r = 0; r < e.length; r++) e[r].call(t); return t; } function s(e, t, r, n) { if ("function" != typeof e && (n || void 0 !== e)) throw new TypeError(t + " must " + (r || "be") + " a function" + (n ? "" : " or undefined")); return e; } function applyDec(e, t, r, n, o, a, c, u, l, f, p, d, h) { function m(e) { if (!h(e)) throw new TypeError("Attempted to access private element on non-instance"); } var y, v = t[0], g = t[3], b = !u; if (!b) { r || Array.isArray(v) || (v = [v]); var w = {}, S = [], A = 3 === o ? "get" : 4 === o || d ? "set" : "value"; f ? (p || d ? w = { get: _setFunctionName(function () { return g(this); }, n, "get"), set: function (e) { t[4](this, e); } } : w[A] = g, p || _setFunctionName(w[A], n, 2 === o ? "" : A)) : p || (w = Object.getOwnPropertyDescriptor(e, n)); } for (var P = e, j = v.length - 1; j >= 0; j -= r ? 2 : 1) { var D = v[j], E = r ? v[j - 1] : void 0, I = {}, O = { kind: ["field", "accessor", "method", "getter", "setter", "class"][o], name: n, metadata: a, addInitializer: function (e, t) { if (e.v) throw Error("attempted to call addInitializer after decoration was finished"); s(t, "An initializer", "be", !0), c.push(t); }.bind(null, I) }; try { if (b) (y = s(D.call(E, P, O), "class decorators", "return")) && (P = y);else { var k, F; O.static = l, O.private = f, f ? 2 === o ? k = function (e) { return m(e), w.value; } : (o < 4 && (k = i(w, "get", m)), 3 !== o && (F = i(w, "set", m))) : (k = function (e) { return e[n]; }, (o < 2 || 4 === o) && (F = function (e, t) { e[n] = t; })); var N = O.access = { has: f ? h.bind() : function (e) { return n in e; } }; if (k && (N.get = k), F && (N.set = F), P = D.call(E, d ? { get: w.get, set: w.set } : w[A], O), d) { if ("object" == typeof P && P) (y = s(P.get, "accessor.get")) && (w.get = y), (y = s(P.set, "accessor.set")) && (w.set = y), (y = s(P.init, "accessor.init")) && S.push(y);else if (void 0 !== P) throw new TypeError("accessor decorators must return an object with get, set, or init properties or void 0"); } else s(P, (p ? "field" : "method") + " decorators", "return") && (p ? S.push(P) : w[A] = P); } } finally { I.v = !0; } } return (p || d) && u.push(function (e, t) { for (var r = S.length - 1; r >= 0; r--) t = S[r].call(e, t); return t; }), p || b || (f ? d ? u.push(i(w, "get"), i(w, "set")) : u.push(2 === o ? w[A] : i.call.bind(w[A])) : Object.defineProperty(e, n, w)), P; } function u(e, t) { return Object.defineProperty(e, Symbol.metadata || Symbol.for("Symbol.metadata"), { configurable: !0, enumerable: !0, value: t }); } if (arguments.length >= 6) var l = a[Symbol.metadata || Symbol.for("Symbol.metadata")]; var f = Object.create(null == l ? null : l), p = function (e, t, r, n) { var o, a, i = [], s = function (t) { return _checkInRHS(t) === e; }, u = new Map(); function l(e) { e && i.push(c.bind(null, e)); } for (var f = 0; f < t.length; f++) { var p = t[f]; if (Array.isArray(p)) { var d = p[1], h = p[2], m = p.length > 3, y = 16 & d, v = !!(8 & d), g = 0 == (d &= 7), b = h + "/" + v; if (!g && !m) { var w = u.get(b); if (!0 === w || 3 === w && 4 !== d || 4 === w && 3 !== d) throw Error("Attempted to decorate a public method/accessor that has the same name as a previously decorated public method/accessor. This is not currently supported by the decorators plugin. Property name was: " + h); u.set(b, !(d > 2) || d); } applyDec(v ? e : e.prototype, p, y, m ? "#" + h : _toPropertyKey(h), d, n, v ? a = a || [] : o = o || [], i, v, m, g, 1 === d, v && m ? s : r); } } return l(o), l(a), i; }(e, t, o, f); return r.length || u(e, f), { e: p, get c() { var t = []; return r.length && [u(applyDec(e, [r], n, e.name, 5, f, t), f), c.bind(null, t, e)]; } }; }
|
|
38
32
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
@@ -40,16 +34,17 @@ function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e =
|
|
|
40
34
|
function _setFunctionName(e, t, n) { "symbol" == typeof t && (t = (t = t.description) ? "[" + t + "]" : ""); try { Object.defineProperty(e, "name", { configurable: !0, value: n ? n + " " + t : t }); } catch (e) {} return e; }
|
|
41
35
|
function _checkInRHS(e) { if (Object(e) !== e) throw TypeError("right-hand side of 'in' should be an object, got " + (null !== e ? typeof e : "null")); return e; }
|
|
42
36
|
class FcrWhiteboardControlFactoryImpl {
|
|
43
|
-
|
|
44
|
-
(
|
|
45
|
-
prefix: 'FcrWhiteboardControlFactory'
|
|
46
|
-
})));
|
|
37
|
+
static {
|
|
38
|
+
[_initProto] = _applyDecs(this, [[_log.trace, 2, "createForSubProcess"], [_log.trace, 2, "createForMainProcess"]], []).e;
|
|
47
39
|
}
|
|
40
|
+
logger = (_initProto(this), (0, _logger.createLogger)({
|
|
41
|
+
prefix: 'FcrWhiteboardControlFactory'
|
|
42
|
+
}));
|
|
48
43
|
createForSubProcess(rtmClient, hasOperationPrivilege, boardConfig) {
|
|
49
44
|
return new _base.FcrBaseWhiteboardControlImpl(rtmClient, boardConfig, hasOperationPrivilege, () => {
|
|
50
45
|
const forgeInitConfig = (0, _sharedStorage.getWhiteboardOptions)();
|
|
51
46
|
if (!forgeInitConfig) {
|
|
52
|
-
throw (0, _error.generateFcrCoreClientError)(_error.FcrErrorModuleCode.ROOM_WHITEBOARD, _error.FcrErrorCode.UNDEFINED_ERROR,
|
|
47
|
+
throw (0, _error.generateFcrCoreClientError)(_error.FcrErrorModuleCode.ROOM_WHITEBOARD, _error.FcrErrorCode.UNDEFINED_ERROR, `whiteboard init config is not exist`, new Error(`whiteboard init config is not exist`));
|
|
53
48
|
}
|
|
54
49
|
return Promise.resolve(forgeInitConfig);
|
|
55
50
|
});
|
|
@@ -70,6 +65,4 @@ class FcrWhiteboardControlFactoryImpl {
|
|
|
70
65
|
};
|
|
71
66
|
}
|
|
72
67
|
}
|
|
73
|
-
exports.FcrWhiteboardControlFactoryImpl = FcrWhiteboardControlFactoryImpl;
|
|
74
|
-
_FcrWhiteboardControlFactoryImpl = FcrWhiteboardControlFactoryImpl;
|
|
75
|
-
[_initProto] = _applyDecs(_FcrWhiteboardControlFactoryImpl, [[_log.trace, 2, "createForSubProcess"], [_log.trace, 2, "createForMainProcess"]], []).e;
|
|
68
|
+
exports.FcrWhiteboardControlFactoryImpl = FcrWhiteboardControlFactoryImpl;
|
package/lib/room-router/index.js
CHANGED
|
@@ -1,11 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
require("core-js/modules/es.symbol.description.js");
|
|
4
3
|
require("core-js/modules/es.array.push.js");
|
|
5
4
|
require("core-js/modules/esnext.function.metadata.js");
|
|
6
|
-
require("core-js/modules/esnext.iterator.constructor.js");
|
|
7
|
-
require("core-js/modules/esnext.iterator.filter.js");
|
|
8
|
-
require("core-js/modules/esnext.iterator.for-each.js");
|
|
9
5
|
require("core-js/modules/esnext.map.delete-all.js");
|
|
10
6
|
require("core-js/modules/esnext.map.emplace.js");
|
|
11
7
|
require("core-js/modules/esnext.map.every.js");
|
|
@@ -26,10 +22,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
26
22
|
value: true
|
|
27
23
|
});
|
|
28
24
|
exports.FcrRoomRouterImpl = void 0;
|
|
29
|
-
require("core-js/modules/es.error.cause.js");
|
|
30
|
-
require("core-js/modules/es.regexp.exec.js");
|
|
31
|
-
require("core-js/modules/web.dom-collections.iterator.js");
|
|
32
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
33
25
|
var _imports = require("../imports");
|
|
34
26
|
var _roomControlFactory = require("../room-control/room-control-factory");
|
|
35
27
|
var _type = require("../room-control/type");
|
|
@@ -40,10 +32,7 @@ var _retryHelpers = require("../utilities/retry-helpers");
|
|
|
40
32
|
var _logger = require("../utilities/logger");
|
|
41
33
|
var _validateParams = _interopRequireDefault(require("../utilities/validate-params"));
|
|
42
34
|
var _type2 = require("./type");
|
|
43
|
-
|
|
44
|
-
let _initProto, _initDecs, _joinRoomDecs, _ref;
|
|
45
|
-
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
46
|
-
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
35
|
+
let _initProto, _initDecs, _joinRoomDecs;
|
|
47
36
|
function _applyDecs(e, t, r, n, o, a) { function i(e, t, r) { return function (n, o) { return r && r(n), e[t].call(n, o); }; } function c(e, t) { for (var r = 0; r < e.length; r++) e[r].call(t); return t; } function s(e, t, r, n) { if ("function" != typeof e && (n || void 0 !== e)) throw new TypeError(t + " must " + (r || "be") + " a function" + (n ? "" : " or undefined")); return e; } function applyDec(e, t, r, n, o, a, c, u, l, f, p, d, h) { function m(e) { if (!h(e)) throw new TypeError("Attempted to access private element on non-instance"); } var y, v = t[0], g = t[3], b = !u; if (!b) { r || Array.isArray(v) || (v = [v]); var w = {}, S = [], A = 3 === o ? "get" : 4 === o || d ? "set" : "value"; f ? (p || d ? w = { get: _setFunctionName(function () { return g(this); }, n, "get"), set: function (e) { t[4](this, e); } } : w[A] = g, p || _setFunctionName(w[A], n, 2 === o ? "" : A)) : p || (w = Object.getOwnPropertyDescriptor(e, n)); } for (var P = e, j = v.length - 1; j >= 0; j -= r ? 2 : 1) { var D = v[j], E = r ? v[j - 1] : void 0, I = {}, O = { kind: ["field", "accessor", "method", "getter", "setter", "class"][o], name: n, metadata: a, addInitializer: function (e, t) { if (e.v) throw Error("attempted to call addInitializer after decoration was finished"); s(t, "An initializer", "be", !0), c.push(t); }.bind(null, I) }; try { if (b) (y = s(D.call(E, P, O), "class decorators", "return")) && (P = y);else { var k, F; O.static = l, O.private = f, f ? 2 === o ? k = function (e) { return m(e), w.value; } : (o < 4 && (k = i(w, "get", m)), 3 !== o && (F = i(w, "set", m))) : (k = function (e) { return e[n]; }, (o < 2 || 4 === o) && (F = function (e, t) { e[n] = t; })); var N = O.access = { has: f ? h.bind() : function (e) { return n in e; } }; if (k && (N.get = k), F && (N.set = F), P = D.call(E, d ? { get: w.get, set: w.set } : w[A], O), d) { if ("object" == typeof P && P) (y = s(P.get, "accessor.get")) && (w.get = y), (y = s(P.set, "accessor.set")) && (w.set = y), (y = s(P.init, "accessor.init")) && S.push(y);else if (void 0 !== P) throw new TypeError("accessor decorators must return an object with get, set, or init properties or void 0"); } else s(P, (p ? "field" : "method") + " decorators", "return") && (p ? S.push(P) : w[A] = P); } } finally { I.v = !0; } } return (p || d) && u.push(function (e, t) { for (var r = S.length - 1; r >= 0; r--) t = S[r].call(e, t); return t; }), p || b || (f ? d ? u.push(i(w, "get"), i(w, "set")) : u.push(2 === o ? w[A] : i.call.bind(w[A])) : Object.defineProperty(e, n, w)), P; } function u(e, t) { return Object.defineProperty(e, Symbol.metadata || Symbol.for("Symbol.metadata"), { configurable: !0, enumerable: !0, value: t }); } if (arguments.length >= 6) var l = a[Symbol.metadata || Symbol.for("Symbol.metadata")]; var f = Object.create(null == l ? null : l), p = function (e, t, r, n) { var o, a, i = [], s = function (t) { return _checkInRHS(t) === e; }, u = new Map(); function l(e) { e && i.push(c.bind(null, e)); } for (var f = 0; f < t.length; f++) { var p = t[f]; if (Array.isArray(p)) { var d = p[1], h = p[2], m = p.length > 3, y = 16 & d, v = !!(8 & d), g = 0 == (d &= 7), b = h + "/" + v; if (!g && !m) { var w = u.get(b); if (!0 === w || 3 === w && 4 !== d || 4 === w && 3 !== d) throw Error("Attempted to decorate a public method/accessor that has the same name as a previously decorated public method/accessor. This is not currently supported by the decorators plugin. Property name was: " + h); u.set(b, !(d > 2) || d); } applyDec(v ? e : e.prototype, p, y, m ? "#" + h : _toPropertyKey(h), d, n, v ? a = a || [] : o = o || [], i, v, m, g, 1 === d, v && m ? s : r); } } return l(o), l(a), i; }(e, t, o, f); return r.length || u(e, f), { e: p, get c() { var t = []; return r.length && [u(applyDec(e, [r], n, e.name, 5, f, t), f), c.bind(null, t, e)]; } }; }
|
|
48
37
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
49
38
|
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
@@ -52,30 +41,34 @@ function _checkInRHS(e) { if (Object(e) !== e) throw TypeError("right-hand side
|
|
|
52
41
|
/**
|
|
53
42
|
* @internal
|
|
54
43
|
*/
|
|
55
|
-
|
|
44
|
+
|
|
56
45
|
class FcrRoomRouterImpl {
|
|
46
|
+
static {
|
|
47
|
+
[_initProto] = _applyDecs(this, [[_initDecs, 2, "_init"], [_joinRoomDecs, 2, "joinRoom"], [_imports.trace, 2, "leaveRoom"]], []).e;
|
|
48
|
+
}
|
|
49
|
+
[(_initDecs = [_imports.trace, (0, _validateParams.default)(_schema.stringSchema)], _joinRoomDecs = [_imports.trace, (0, _validateParams.default)(_schema.fcrRoomJoinOptionsSchema)], "logger")] = (_initProto(this), (0, _logger.createLogger)({
|
|
50
|
+
prefix: 'FcrRoomRouterImpl'
|
|
51
|
+
}));
|
|
52
|
+
_abortController = null;
|
|
53
|
+
_observable = new _imports.AgoraObservable();
|
|
54
|
+
_roomControlObservable = {
|
|
55
|
+
onRoomRouteSwitched: async event => {
|
|
56
|
+
this._nextRoomRoute = event.targetRouting;
|
|
57
|
+
this._observable.notifyObservers('onRoomRouteSwitched', this._nextRoomRoute);
|
|
58
|
+
this.roomControl.removeObserver(this._roomControlObservable);
|
|
59
|
+
this._roomControl = null;
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
_roomControl = null;
|
|
63
|
+
_nextRoomRoute = {
|
|
64
|
+
roomId: '',
|
|
65
|
+
roomType: _type.FcrRoomType.Mainroom,
|
|
66
|
+
isJoined: false
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
// 接口中新增一个bypass字段,在第一次调用joinRoom的时候不传,在后续收到房间切换后的joinRoom时传true
|
|
70
|
+
_bypass = undefined;
|
|
57
71
|
constructor(_rteEngine, _apiService, _config, _chatConnection, _sharedCache, roomId) {
|
|
58
|
-
(0, _defineProperty2.default)(this, _ref, (_initProto(this), (0, _logger.createLogger)({
|
|
59
|
-
prefix: 'FcrRoomRouterImpl'
|
|
60
|
-
})));
|
|
61
|
-
(0, _defineProperty2.default)(this, "_abortController", null);
|
|
62
|
-
(0, _defineProperty2.default)(this, "_observable", new _imports.AgoraObservable());
|
|
63
|
-
(0, _defineProperty2.default)(this, "_roomControlObservable", {
|
|
64
|
-
onRoomRouteSwitched: async event => {
|
|
65
|
-
this._nextRoomRoute = event.targetRouting;
|
|
66
|
-
this._observable.notifyObservers('onRoomRouteSwitched', this._nextRoomRoute);
|
|
67
|
-
this.roomControl.removeObserver(this._roomControlObservable);
|
|
68
|
-
this._roomControl = null;
|
|
69
|
-
}
|
|
70
|
-
});
|
|
71
|
-
(0, _defineProperty2.default)(this, "_roomControl", null);
|
|
72
|
-
(0, _defineProperty2.default)(this, "_nextRoomRoute", {
|
|
73
|
-
roomId: '',
|
|
74
|
-
roomType: _type.FcrRoomType.Mainroom,
|
|
75
|
-
isJoined: false
|
|
76
|
-
});
|
|
77
|
-
// 接口中新增一个bypass字段,在第一次调用joinRoom的时候不传,在后续收到房间切换后的joinRoom时传true
|
|
78
|
-
(0, _defineProperty2.default)(this, "_bypass", undefined);
|
|
79
72
|
this._rteEngine = _rteEngine;
|
|
80
73
|
this._apiService = _apiService;
|
|
81
74
|
this._config = _config;
|
|
@@ -105,14 +98,17 @@ class FcrRoomRouterImpl {
|
|
|
105
98
|
this._abortController = null;
|
|
106
99
|
if (error) {
|
|
107
100
|
this._handleJoinRoomError(error);
|
|
108
|
-
|
|
101
|
+
return Promise.reject(error);
|
|
109
102
|
}
|
|
103
|
+
if (!this._roomControl) {
|
|
104
|
+
return Promise.reject(new Error('Room control is not initialized'));
|
|
105
|
+
}
|
|
106
|
+
return Promise.resolve(this._roomControl);
|
|
110
107
|
}
|
|
111
108
|
async leaveRoom() {
|
|
112
|
-
|
|
113
|
-
(_this$_abortControlle = this._abortController) === null || _this$_abortControlle === void 0 || _this$_abortControlle.abort();
|
|
109
|
+
this._abortController?.abort();
|
|
114
110
|
this._abortController = null;
|
|
115
|
-
|
|
111
|
+
this._roomControl?.leave();
|
|
116
112
|
this._roomControl = null;
|
|
117
113
|
}
|
|
118
114
|
|
|
@@ -134,12 +130,11 @@ class FcrRoomRouterImpl {
|
|
|
134
130
|
const abortController = this._abortController;
|
|
135
131
|
return (0, _imports.retryAttempt)(() => this._performSingleJoinAttempt(options), [], {
|
|
136
132
|
retriesMax: _type2.ROOM_ROUTER_CONSTANTS.MAX_JOIN_ATTEMPTS
|
|
137
|
-
}).fail(async
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
} = _ref2;
|
|
133
|
+
}).fail(async ({
|
|
134
|
+
error,
|
|
135
|
+
timeFn: waitBeforeRetry,
|
|
136
|
+
currentRetry: attemptCount
|
|
137
|
+
}) => {
|
|
143
138
|
return (0, _joinHelper.handleJoinRetryFailure)(error, waitBeforeRetry, attemptCount, _retryHelpers.canRetryJoinError, () => {
|
|
144
139
|
this._throwIfAborted(abortController);
|
|
145
140
|
}, 'join room via router');
|
|
@@ -192,14 +187,15 @@ class FcrRoomRouterImpl {
|
|
|
192
187
|
} = roomResponse;
|
|
193
188
|
const abortController = this._abortController;
|
|
194
189
|
const roomControl = this._createRoomControl(data);
|
|
195
|
-
abortController
|
|
190
|
+
abortController?.signal.addEventListener('abort', () => {
|
|
196
191
|
roomControl.leave();
|
|
197
192
|
});
|
|
198
|
-
await roomControl.join(
|
|
193
|
+
await roomControl.join({
|
|
194
|
+
...options,
|
|
199
195
|
snapshot: data,
|
|
200
196
|
timestamp: ts,
|
|
201
197
|
createStreamConfigs: options.createStreamConfigs
|
|
202
|
-
})
|
|
198
|
+
});
|
|
203
199
|
return roomControl;
|
|
204
200
|
}
|
|
205
201
|
|
|
@@ -227,8 +223,8 @@ class FcrRoomRouterImpl {
|
|
|
227
223
|
* @private
|
|
228
224
|
*/
|
|
229
225
|
_handleJoinRoomError(error) {
|
|
230
|
-
this.logger.error(
|
|
231
|
-
const fcrError = (0, _error.generateFcrCoreClientErrorNew)(_error.FcrErrorModuleCode.ROOM, _error.FcrErrorCode.LOCAL_HTTP_REQUEST_FAILED,
|
|
226
|
+
this.logger.error(`Failed to join the room: ${error.message}`);
|
|
227
|
+
const fcrError = (0, _error.generateFcrCoreClientErrorNew)(_error.FcrErrorModuleCode.ROOM, _error.FcrErrorCode.LOCAL_HTTP_REQUEST_FAILED, `join room failed: ${error.message}`);
|
|
232
228
|
this._observable.notifyObservers('onErrorOccurred', fcrError);
|
|
233
229
|
}
|
|
234
230
|
|
|
@@ -253,7 +249,7 @@ class FcrRoomRouterImpl {
|
|
|
253
249
|
});
|
|
254
250
|
}
|
|
255
251
|
_throwIfAborted(abortController) {
|
|
256
|
-
if (abortController
|
|
252
|
+
if (abortController?.signal.aborted) {
|
|
257
253
|
throw new Error('Join room attempt aborted');
|
|
258
254
|
}
|
|
259
255
|
}
|
|
@@ -267,6 +263,4 @@ class FcrRoomRouterImpl {
|
|
|
267
263
|
this._observable.removeObserver(observer);
|
|
268
264
|
}
|
|
269
265
|
}
|
|
270
|
-
exports.FcrRoomRouterImpl = FcrRoomRouterImpl;
|
|
271
|
-
_FcrRoomRouterImpl = FcrRoomRouterImpl;
|
|
272
|
-
[_initProto] = _applyDecs(_FcrRoomRouterImpl, [[_initDecs, 2, "_init"], [_joinRoomDecs, 2, "joinRoom"], [_imports.trace, 2, "leaveRoom"]], []).e;
|
|
266
|
+
exports.FcrRoomRouterImpl = FcrRoomRouterImpl;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { FcrInterpreterRoomControlImpl } from '../room-control/interpreter-control/room';
|
|
2
2
|
import { FcrJoinBeforeHostWaitingRoomControlImpl } from '../room-control/join-before-host-waitingroom-control';
|
|
3
3
|
import { FcrMainRoomControlImpl } from '../room-control/mainroom-control';
|
|
4
|
-
import { FcrJoinBeforeHostWaitingRoomControl, FcrMainRoomControl, FcrRoomJoinOptions, FcrRoomType, FcrWaitingRoomControl } from '../room-control/type';
|
|
4
|
+
import { FcrBaseRoomControl, FcrJoinBeforeHostWaitingRoomControl, FcrMainRoomControl, FcrRoomJoinOptions, FcrRoomType, FcrWaitingRoomControl } from '../room-control/type';
|
|
5
5
|
import { FcrWaitingRoomControlImpl } from '../room-control/waitingroom-control';
|
|
6
6
|
import { FcrError } from '../utilities/error';
|
|
7
7
|
export type FcrRoomControlType = FcrMainRoomControl | FcrWaitingRoomControl | FcrJoinBeforeHostWaitingRoomControl;
|
|
@@ -34,7 +34,7 @@ export interface FcrRoomRouter {
|
|
|
34
34
|
/**
|
|
35
35
|
* 加入会议
|
|
36
36
|
*/
|
|
37
|
-
joinRoom(options: FcrRoomJoinOptions): Promise<
|
|
37
|
+
joinRoom(options: FcrRoomJoinOptions): Promise<FcrBaseRoomControl>;
|
|
38
38
|
/**
|
|
39
39
|
* 离开会议
|
|
40
40
|
*/
|