fcr-core 3.10.2 → 3.10.5
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/engine/index.js +102 -108
- package/lib/imports.js +1 -0
- package/lib/media-control/desktop.js +22 -13
- package/lib/media-control/mobile.js +27 -19
- package/lib/media-control/type.d.ts +3 -3
- package/lib/monitor-control/index.js +17 -7
- package/lib/peer-session/index.js +120 -121
- package/lib/plugins/chat/chatroom.js +119 -96
- package/lib/plugins/chat/connector.js +69 -48
- package/lib/remote-control/index.js +194 -216
- package/lib/room-control/ability-control/index.js +20 -10
- package/lib/room-control/application-control/index.js +82 -75
- package/lib/room-control/group-control/index.js +31 -30
- package/lib/room-control/helpers/board-init-info-helper.js +16 -10
- package/lib/room-control/helpers/validation-helper.js +1 -1
- package/lib/room-control/index.js +70 -51
- package/lib/room-control/infinity-room-control/index.js +27 -19
- package/lib/room-control/interpreter-control/index.js +77 -65
- package/lib/room-control/interpreter-control/room.js +6 -4
- package/lib/room-control/join-before-host-waitingroom-control/index.js +6 -4
- package/lib/room-control/mainroom-control/index.js +37 -25
- package/lib/room-control/privilege-control/helper.js +28 -13
- package/lib/room-control/privilege-control/index.js +36 -28
- package/lib/room-control/room-connector-control/index.js +52 -49
- package/lib/room-control/room-connector-control/type.d.ts +1 -1
- package/lib/room-control/room-control-factory.js +10 -12
- package/lib/room-control/room-session/index.js +77 -74
- package/lib/room-control/shared-cache.js +63 -56
- package/lib/room-control/sharing-control/index.js +65 -57
- package/lib/room-control/stream-control/index.js +197 -193
- package/lib/room-control/stt-control/de-compress-gzip.js +10 -0
- package/lib/room-control/stt-control/index.js +93 -86
- package/lib/room-control/user-control/index.js +162 -155
- package/lib/room-control/waitingroom-control/index.js +18 -9
- package/lib/room-control/whiteboard-control/utils.js +4 -2
- package/lib/room-control/whiteboard-control-v1/board-subwindow.js +2 -1
- package/lib/room-control/whiteboard-control-v1/board-window.js +120 -103
- package/lib/room-control/whiteboard-control-v1/factory.js +7 -4
- package/lib/room-control/whiteboard-control-v1/index.js +80 -67
- package/lib/room-control/whiteboard-control-v1/mount-manager.js +4 -2
- package/lib/room-control/whiteboard-control-v1/utils.js +17 -14
- package/lib/room-control/whiteboard-control-v2/annotation-control/control.js +14 -10
- package/lib/room-control/whiteboard-control-v2/annotation-control/factory.js +17 -8
- package/lib/room-control/whiteboard-control-v2/base/index.js +61 -53
- package/lib/room-control/whiteboard-control-v2/base/main-window.js +39 -30
- package/lib/room-control/whiteboard-control-v2/utils.js +10 -10
- package/lib/room-control/whiteboard-control-v2/whiteboard-control/control.js +45 -33
- package/lib/room-control/whiteboard-control-v2/whiteboard-control/factory.js +27 -11
- package/lib/room-control/widget-control/index.js +43 -33
- package/lib/room-router/index.js +66 -58
- package/lib/schema.d.ts +15 -15
- package/lib/service/api.js +446 -548
- package/lib/struct.js +5 -2
- package/lib/utilities/abortable-retry.js +3 -0
- package/lib/utilities/collection.js +15 -11
- package/lib/utilities/error-helpers.js +34 -27
- package/lib/utilities/error.js +4 -3
- package/lib/utilities/join-helper.js +37 -31
- package/lib/utilities/logger.js +8 -5
- package/lib/utilities/parameters.js +21 -10
- package/lib/utilities/retry-helpers.js +1 -0
- package/lib/utilities/stream.js +16 -11
- package/lib/utilities/user.js +4 -3
- package/lib/utilities/validate-params.js +1 -1
- package/lib/utilities/video-encoder-config.js +10 -5
- package/lib-es/engine/index.js +102 -108
- package/lib-es/media-control/desktop.js +22 -13
- package/lib-es/media-control/mobile.js +27 -19
- package/lib-es/monitor-control/index.js +16 -7
- package/lib-es/peer-session/index.js +120 -121
- package/lib-es/plugins/chat/chatroom.js +118 -95
- package/lib-es/plugins/chat/connector.js +67 -47
- package/lib-es/remote-control/index.js +194 -216
- package/lib-es/room-control/ability-control/index.js +19 -10
- package/lib-es/room-control/application-control/index.js +81 -75
- package/lib-es/room-control/group-control/index.js +31 -30
- package/lib-es/room-control/helpers/board-init-info-helper.js +15 -10
- package/lib-es/room-control/helpers/validation-helper.js +1 -1
- package/lib-es/room-control/index.js +69 -51
- package/lib-es/room-control/infinity-room-control/index.js +26 -19
- package/lib-es/room-control/interpreter-control/index.js +77 -65
- package/lib-es/room-control/interpreter-control/room.js +5 -4
- package/lib-es/room-control/join-before-host-waitingroom-control/index.js +5 -4
- package/lib-es/room-control/mainroom-control/index.js +37 -25
- package/lib-es/room-control/privilege-control/helper.js +27 -13
- package/lib-es/room-control/privilege-control/index.js +36 -28
- package/lib-es/room-control/room-connector-control/index.js +52 -49
- package/lib-es/room-control/room-control-factory.js +10 -12
- package/lib-es/room-control/room-session/index.js +77 -74
- package/lib-es/room-control/shared-cache.js +62 -56
- package/lib-es/room-control/sharing-control/index.js +64 -57
- package/lib-es/room-control/stream-control/index.js +197 -193
- package/lib-es/room-control/stt-control/de-compress-gzip.js +10 -0
- package/lib-es/room-control/stt-control/index.js +93 -86
- package/lib-es/room-control/user-control/index.js +162 -155
- package/lib-es/room-control/waitingroom-control/index.js +18 -9
- package/lib-es/room-control/whiteboard-control/utils.js +4 -2
- package/lib-es/room-control/whiteboard-control-v1/board-subwindow.js +2 -1
- package/lib-es/room-control/whiteboard-control-v1/board-window.js +120 -103
- package/lib-es/room-control/whiteboard-control-v1/factory.js +6 -4
- package/lib-es/room-control/whiteboard-control-v1/index.js +80 -67
- package/lib-es/room-control/whiteboard-control-v1/mount-manager.js +3 -2
- package/lib-es/room-control/whiteboard-control-v1/utils.js +17 -14
- package/lib-es/room-control/whiteboard-control-v2/annotation-control/control.js +13 -10
- package/lib-es/room-control/whiteboard-control-v2/annotation-control/factory.js +16 -8
- package/lib-es/room-control/whiteboard-control-v2/base/index.js +60 -53
- package/lib-es/room-control/whiteboard-control-v2/base/main-window.js +39 -30
- package/lib-es/room-control/whiteboard-control-v2/utils.js +10 -10
- package/lib-es/room-control/whiteboard-control-v2/whiteboard-control/control.js +45 -33
- package/lib-es/room-control/whiteboard-control-v2/whiteboard-control/factory.js +26 -11
- package/lib-es/room-control/widget-control/index.js +42 -33
- package/lib-es/room-router/index.js +66 -58
- package/lib-es/service/api.js +445 -548
- package/lib-es/struct.js +4 -2
- package/lib-es/utilities/abortable-retry.js +3 -0
- package/lib-es/utilities/collection.js +14 -11
- package/lib-es/utilities/error-helpers.js +33 -26
- package/lib-es/utilities/error.js +4 -3
- package/lib-es/utilities/join-helper.js +36 -29
- package/lib-es/utilities/logger.js +7 -5
- package/lib-es/utilities/parameters.js +21 -10
- package/lib-es/utilities/retry-helpers.js +1 -0
- package/lib-es/utilities/stream.js +15 -11
- package/lib-es/utilities/user.js +4 -3
- package/lib-es/utilities/validate-params.js +1 -1
- package/lib-es/utilities/video-encoder-config.js +10 -5
- package/package.json +4 -4
|
@@ -1,5 +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");
|
|
3
5
|
require("core-js/modules/es.array.push.js");
|
|
4
6
|
require("core-js/modules/esnext.function.metadata.js");
|
|
5
7
|
require("core-js/modules/esnext.map.delete-all.js");
|
|
@@ -17,6 +19,7 @@ require("core-js/modules/esnext.map.reduce.js");
|
|
|
17
19
|
require("core-js/modules/esnext.map.some.js");
|
|
18
20
|
require("core-js/modules/esnext.map.update.js");
|
|
19
21
|
require("core-js/modules/esnext.symbol.metadata.js");
|
|
22
|
+
require("core-js/modules/web.dom-collections.iterator.js");
|
|
20
23
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
21
24
|
Object.defineProperty(exports, "__esModule", {
|
|
22
25
|
value: true
|
|
@@ -25,6 +28,8 @@ exports.FcrInterpreterControlImpl = void 0;
|
|
|
25
28
|
require("core-js/modules/es.array.includes.js");
|
|
26
29
|
require("core-js/modules/esnext.iterator.constructor.js");
|
|
27
30
|
require("core-js/modules/esnext.iterator.map.js");
|
|
31
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
32
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
28
33
|
var _imports = require("../../imports");
|
|
29
34
|
var _room = require("./room");
|
|
30
35
|
var _types = require("./types");
|
|
@@ -34,7 +39,8 @@ var _logger = require("../../utilities/logger");
|
|
|
34
39
|
var _error = require("../../utilities/error");
|
|
35
40
|
var _validateParams = _interopRequireDefault(require("../../utilities/validate-params"));
|
|
36
41
|
var _schema = require("../../schema");
|
|
37
|
-
|
|
42
|
+
var _FcrInterpreterControlImpl;
|
|
43
|
+
let _initProto, _createRoomControlDecs, _setInterpreterUsersDecs, _ref;
|
|
38
44
|
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)]; } }; }
|
|
39
45
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
40
46
|
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); }
|
|
@@ -43,45 +49,44 @@ function _checkInRHS(e) { if (Object(e) !== e) throw TypeError("right-hand side
|
|
|
43
49
|
/**
|
|
44
50
|
* @internal
|
|
45
51
|
*/
|
|
52
|
+
_ref = (_createRoomControlDecs = [(0, _imports.trace)(['roomId']), (0, _validateParams.default)(_schema.stringSchema)], _setInterpreterUsersDecs = [(0, _imports.trace)(['params']), (0, _validateParams.default)(_schema.fcrInterpreterUsersParamsArraySchema)], "logger");
|
|
46
53
|
class FcrInterpreterControlImpl {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
54
|
+
constructor(_api, _scene, _config, _engine, _chatConnection, _sharedCache) {
|
|
55
|
+
//@internal
|
|
56
|
+
(0, _defineProperty2.default)(this, _ref, (_initProto(this), (0, _logger.createLogger)({
|
|
57
|
+
prefix: 'FcrInterpreterControlImpl'
|
|
58
|
+
})));
|
|
59
|
+
(0, _defineProperty2.default)(this, "_observable", new _imports.AgoraObservable());
|
|
60
|
+
(0, _defineProperty2.default)(this, "_interpreterUserList", null);
|
|
61
|
+
(0, _defineProperty2.default)(this, "_sceneObserver", {
|
|
62
|
+
onScenePropertiesUpdated: (_, event) => {
|
|
63
|
+
var _event$cause;
|
|
64
|
+
if (((_event$cause = event.cause) === null || _event$cause === void 0 ? void 0 : _event$cause.cmd) === 800) {
|
|
65
|
+
const actionType = (0, _imports.get)(event.cause.data, 'actionType');
|
|
66
|
+
let operatorUser;
|
|
67
|
+
if (event.operatorUser) {
|
|
68
|
+
operatorUser = (0, _user.convertRteUserToFcrUser)(event.operatorUser, this._roomCache);
|
|
69
|
+
}
|
|
70
|
+
const isStateUpdated = [_types.FcrInterpreterActionType.OPEN, _types.FcrInterpreterActionType.CLOSE].includes(actionType);
|
|
71
|
+
const isUpdated = [
|
|
72
|
+
// FcrInterpreterActionType.OPEN,
|
|
73
|
+
_types.FcrInterpreterActionType.UPDATE].includes(actionType);
|
|
74
|
+
if (isStateUpdated || isUpdated) {
|
|
75
|
+
this._setInterpreterUserList();
|
|
76
|
+
}
|
|
77
|
+
if (isStateUpdated) {
|
|
78
|
+
this._observable.notifyObservers('onInterpreterStateUpdated', this._roomId, this.getState(), operatorUser);
|
|
79
|
+
}
|
|
80
|
+
if (isUpdated) {
|
|
81
|
+
this._observable.notifyObservers('onInterpreterUsersUpdated', this._roomId, this.getInterpreterUserList(), operatorUser);
|
|
82
|
+
this._observable.notifyObservers('onInterpreterRoomListUpdated', this._roomId, this.getInterpreterRoomList(), operatorUser);
|
|
83
|
+
}
|
|
77
84
|
}
|
|
85
|
+
},
|
|
86
|
+
onJoinSceneSuccess: () => {
|
|
87
|
+
this._setInterpreterUserList();
|
|
78
88
|
}
|
|
79
|
-
}
|
|
80
|
-
onJoinSceneSuccess: () => {
|
|
81
|
-
this._setInterpreterUserList();
|
|
82
|
-
}
|
|
83
|
-
};
|
|
84
|
-
constructor(_api, _scene, _config, _engine, _chatConnection, _sharedCache) {
|
|
89
|
+
});
|
|
85
90
|
this._api = _api;
|
|
86
91
|
this._scene = _scene;
|
|
87
92
|
this._config = _config;
|
|
@@ -102,11 +107,10 @@ class FcrInterpreterControlImpl {
|
|
|
102
107
|
await (0, _error.handleRequestError)(() => this._api.openInterpreter({
|
|
103
108
|
roomId: this._roomId,
|
|
104
109
|
data: {
|
|
105
|
-
interpreters: params.map(
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
}) => {
|
|
110
|
+
interpreters: params.map(_ref2 => {
|
|
111
|
+
let userUuid = _ref2.userId,
|
|
112
|
+
sourceLanguage = _ref2.sourceLanguage,
|
|
113
|
+
targetLanguage = _ref2.targetLanguage;
|
|
110
114
|
return {
|
|
111
115
|
userUuid,
|
|
112
116
|
languagePair: [sourceLanguage, targetLanguage]
|
|
@@ -130,31 +134,34 @@ class FcrInterpreterControlImpl {
|
|
|
130
134
|
}
|
|
131
135
|
getInterpreterRoomList() {
|
|
132
136
|
const rooms = this._scene.getScenePropertiesByKeyPath('interpreter.rooms') || [];
|
|
133
|
-
return rooms.length > 0 ? rooms.map(
|
|
134
|
-
roomUuid,
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
137
|
+
return rooms.length > 0 ? rooms.map(_ref3 => {
|
|
138
|
+
let roomUuid = _ref3.roomUuid,
|
|
139
|
+
language = _ref3.language;
|
|
140
|
+
return {
|
|
141
|
+
roomId: roomUuid,
|
|
142
|
+
language
|
|
143
|
+
};
|
|
144
|
+
}) : null;
|
|
140
145
|
}
|
|
141
146
|
_setInterpreterUserList() {
|
|
142
147
|
const interpreter = this._scene.getScenePropertiesByKeyPath('interpreter');
|
|
143
|
-
const {
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
translates
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
148
|
+
const _ref4 = interpreter || {
|
|
149
|
+
translates: []
|
|
150
|
+
},
|
|
151
|
+
translates = _ref4.translates;
|
|
152
|
+
const results = translates.map(_ref5 => {
|
|
153
|
+
let userId = _ref5.userUuid,
|
|
154
|
+
userName = _ref5.userName,
|
|
155
|
+
_ref5$languagePair = (0, _slicedToArray2.default)(_ref5.languagePair, 2),
|
|
156
|
+
sourceLanguage = _ref5$languagePair[0],
|
|
157
|
+
targetLanguage = _ref5$languagePair[1];
|
|
158
|
+
return {
|
|
159
|
+
userId,
|
|
160
|
+
userName,
|
|
161
|
+
sourceLanguage,
|
|
162
|
+
targetLanguage
|
|
163
|
+
};
|
|
164
|
+
});
|
|
158
165
|
this._interpreterUserList = results.length > 0 ? results : null;
|
|
159
166
|
}
|
|
160
167
|
getInterpreterUserList() {
|
|
@@ -181,4 +188,9 @@ class FcrInterpreterControlImpl {
|
|
|
181
188
|
this.addObserver((0, _logger.generateLogObserver)(this.logger, [['onInterpreterStateUpdated', ['roomId', 'state', 'operatorUser']], ['onInterpreterUsersUpdated', ['roomId', 'users', 'operatorUser']], ['onInterpreterRoomListUpdated', ['roomId', 'rooms', 'operatorUser']]]));
|
|
182
189
|
}
|
|
183
190
|
}
|
|
184
|
-
exports.FcrInterpreterControlImpl = FcrInterpreterControlImpl;
|
|
191
|
+
exports.FcrInterpreterControlImpl = FcrInterpreterControlImpl;
|
|
192
|
+
_FcrInterpreterControlImpl = FcrInterpreterControlImpl;
|
|
193
|
+
var _applyDecs$e = _applyDecs(_FcrInterpreterControlImpl, [[_createRoomControlDecs, 2, "createRoomControl"], [_setInterpreterUsersDecs, 2, "setInterpreterUsers"], [_imports.trace, 2, "close"], [_imports.trace, 2, "getState"], [_imports.trace, 2, "getInterpreterRoomList"], [_imports.trace, 2, "getInterpreterLanguageList"], [_imports.trace, 2, "release"]], []).e;
|
|
194
|
+
var _applyDecs$e2 = (0, _slicedToArray2.default)(_applyDecs$e, 1);
|
|
195
|
+
_initProto = _applyDecs$e2[0];
|
|
196
|
+
_applyDecs$e;
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
3
4
|
Object.defineProperty(exports, "__esModule", {
|
|
4
5
|
value: true
|
|
5
6
|
});
|
|
6
7
|
exports.FcrInterpreterRoomControlImpl = void 0;
|
|
8
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
7
9
|
var _ = require("..");
|
|
8
10
|
var _logger = require("../../utilities/logger");
|
|
9
11
|
var _type = require("../type");
|
|
@@ -11,12 +13,12 @@ var _type = require("../type");
|
|
|
11
13
|
* @internal
|
|
12
14
|
*/
|
|
13
15
|
class FcrInterpreterRoomControlImpl extends _.FcrBaseRoomControlImpl {
|
|
14
|
-
//@internal
|
|
15
|
-
logger = (0, _logger.createLogger)({
|
|
16
|
-
prefix: 'FcrInterpreterRoomControlImpl'
|
|
17
|
-
});
|
|
18
16
|
constructor(_engine, _scene, _api, _config, _sharedCache, _chatConnection, chatRoomControl) {
|
|
19
17
|
super(_engine, _scene, _api, _config, _type.FcrRoomType.Interpreterroom, _chatConnection, _sharedCache, chatRoomControl);
|
|
18
|
+
//@internal
|
|
19
|
+
(0, _defineProperty2.default)(this, "logger", (0, _logger.createLogger)({
|
|
20
|
+
prefix: 'FcrInterpreterRoomControlImpl'
|
|
21
|
+
}));
|
|
20
22
|
this._engine = _engine;
|
|
21
23
|
this._scene = _scene;
|
|
22
24
|
this._api = _api;
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
3
4
|
Object.defineProperty(exports, "__esModule", {
|
|
4
5
|
value: true
|
|
5
6
|
});
|
|
6
7
|
exports.FcrJoinBeforeHostWaitingRoomControlImpl = void 0;
|
|
8
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
7
9
|
var _ = require("..");
|
|
8
10
|
var _logger = require("../../utilities/logger");
|
|
9
11
|
var _type = require("../type");
|
|
@@ -11,12 +13,12 @@ var _type = require("../type");
|
|
|
11
13
|
* @internal
|
|
12
14
|
*/
|
|
13
15
|
class FcrJoinBeforeHostWaitingRoomControlImpl extends _.FcrBaseRoomControlImpl {
|
|
14
|
-
//@internal
|
|
15
|
-
logger = (0, _logger.createLogger)({
|
|
16
|
-
prefix: 'FcrJoinBeforeHostWaitingRoomControlImpl'
|
|
17
|
-
});
|
|
18
16
|
constructor(engine, scene, api, config, sharedCache, chatConnection, chatRoomControl) {
|
|
19
17
|
super(engine, scene, api, config, _type.FcrRoomType.JoinBeforeHostWaitingRoom, chatConnection, sharedCache, chatRoomControl);
|
|
18
|
+
//@internal
|
|
19
|
+
(0, _defineProperty2.default)(this, "logger", (0, _logger.createLogger)({
|
|
20
|
+
prefix: 'FcrJoinBeforeHostWaitingRoomControlImpl'
|
|
21
|
+
}));
|
|
20
22
|
this._addLogObserver();
|
|
21
23
|
}
|
|
22
24
|
addObserver(observer) {
|
|
@@ -1,5 +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");
|
|
3
5
|
require("core-js/modules/es.array.push.js");
|
|
4
6
|
require("core-js/modules/esnext.function.metadata.js");
|
|
5
7
|
require("core-js/modules/esnext.map.delete-all.js");
|
|
@@ -17,6 +19,7 @@ require("core-js/modules/esnext.map.reduce.js");
|
|
|
17
19
|
require("core-js/modules/esnext.map.some.js");
|
|
18
20
|
require("core-js/modules/esnext.map.update.js");
|
|
19
21
|
require("core-js/modules/esnext.symbol.metadata.js");
|
|
22
|
+
require("core-js/modules/web.dom-collections.iterator.js");
|
|
20
23
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
21
24
|
Object.defineProperty(exports, "__esModule", {
|
|
22
25
|
value: true
|
|
@@ -26,6 +29,8 @@ require("core-js/modules/es.array.includes.js");
|
|
|
26
29
|
require("core-js/modules/es.json.stringify.js");
|
|
27
30
|
require("core-js/modules/esnext.iterator.constructor.js");
|
|
28
31
|
require("core-js/modules/esnext.iterator.find.js");
|
|
32
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
33
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
29
34
|
var _ = require("..");
|
|
30
35
|
var _imports = require("../../imports");
|
|
31
36
|
var _schema = require("../../schema");
|
|
@@ -40,38 +45,35 @@ var _type2 = require("../type");
|
|
|
40
45
|
var _utils = require("../whiteboard-control-v2/utils");
|
|
41
46
|
var _utils2 = require("../whiteboard-control/utils");
|
|
42
47
|
var _boardInitInfoHelper = require("../helpers/board-init-info-helper");
|
|
43
|
-
|
|
48
|
+
var _FcrMainRoomControlImpl;
|
|
49
|
+
let _initProto, _enableWaitingRoomDecs, _moveToWaitingRoomByUserIdsDecs, _ref;
|
|
44
50
|
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)]; } }; }
|
|
45
51
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
46
52
|
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); }
|
|
47
53
|
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; }
|
|
48
54
|
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; }
|
|
49
|
-
const
|
|
50
|
-
|
|
51
|
-
Duration
|
|
52
|
-
} = _imports.AgoraScheduler;
|
|
55
|
+
const sharedScheduler = _imports.AgoraScheduler.shared,
|
|
56
|
+
Duration = _imports.AgoraScheduler.Duration;
|
|
53
57
|
/**
|
|
54
58
|
* @internal
|
|
55
59
|
*/
|
|
60
|
+
_ref = (_enableWaitingRoomDecs = [(0, _imports.trace)(['enable']), (0, _validateParams.default)(_schema.booleanSchema)], _moveToWaitingRoomByUserIdsDecs = [(0, _imports.trace)(['userIds']), (0, _validateParams.default)(_schema.stringArraySchema)], "logger");
|
|
56
61
|
class FcrMainRoomControlImpl extends _.FcrBaseRoomControlImpl {
|
|
57
|
-
static {
|
|
58
|
-
[_initProto] = _applyDecs(this, [[_imports.trace, 2, "join"], [_imports.trace, 2, "leave"], [_enableWaitingRoomDecs, 2, "enableWaitingRoom"], [_moveToWaitingRoomByUserIdsDecs, 2, "moveToWaitingRoomByUserIds"], [_imports.trace, 2, "moveToWaitingRoomByUserRoles"], [_imports.bound, 2, "_onLocalUserPermissionInfoDeleted"]], [], 0, void 0, _.FcrBaseRoomControlImpl).e;
|
|
59
|
-
}
|
|
60
|
-
//@internal
|
|
61
|
-
[(_enableWaitingRoomDecs = [(0, _imports.trace)(['enable']), (0, _validateParams.default)(_schema.booleanSchema)], _moveToWaitingRoomByUserIdsDecs = [(0, _imports.trace)(['userIds']), (0, _validateParams.default)(_schema.stringArraySchema)], "logger")] = (_initProto(this), (0, _logger.createLogger)({
|
|
62
|
-
prefix: 'FcrMainRoomControlImpl'
|
|
63
|
-
}));
|
|
64
|
-
_privilegeObserver = {
|
|
65
|
-
onLocalUserPermissionInfoDeleted: this._onLocalUserPermissionInfoDeleted
|
|
66
|
-
};
|
|
67
62
|
constructor(engine, scene, api, config, sharedCache, chatConnection, chatRoomControl, monitorControl) {
|
|
68
63
|
super(engine, scene, api, config, _type2.FcrRoomType.Mainroom, chatConnection, sharedCache, chatRoomControl);
|
|
64
|
+
//@internal
|
|
65
|
+
(0, _defineProperty2.default)(this, _ref, (_initProto(this), (0, _logger.createLogger)({
|
|
66
|
+
prefix: 'FcrMainRoomControlImpl'
|
|
67
|
+
})));
|
|
68
|
+
(0, _defineProperty2.default)(this, "_privilegeObserver", {
|
|
69
|
+
onLocalUserPermissionInfoDeleted: this._onLocalUserPermissionInfoDeleted
|
|
70
|
+
});
|
|
69
71
|
this._monitorControl = monitorControl;
|
|
70
72
|
this._groupControl = new _groupControl.FcrGroupControl(engine, scene, api, sharedCache);
|
|
71
73
|
this._interpreterControl = new _interpreterControl.FcrInterpreterControlImpl(api, scene, config, engine, chatConnection, sharedCache);
|
|
72
74
|
this._addLogObserver();
|
|
73
75
|
(0, _boardInitInfoHelper.addBoardInitInfoObserver)(this._scene, this._api, this.logger);
|
|
74
|
-
this.logger.info(
|
|
76
|
+
this.logger.info("initialized, room id: ".concat(this._scene.sceneId));
|
|
75
77
|
}
|
|
76
78
|
|
|
77
79
|
// @trace
|
|
@@ -105,7 +107,8 @@ class FcrMainRoomControlImpl extends _.FcrBaseRoomControlImpl {
|
|
|
105
107
|
privilegeControl.removeObserver(this._privilegeObserver);
|
|
106
108
|
return await super.leave();
|
|
107
109
|
} finally {
|
|
108
|
-
|
|
110
|
+
var _this$_logUploadTask;
|
|
111
|
+
(_this$_logUploadTask = this._logUploadTask) === null || _this$_logUploadTask === void 0 || _this$_logUploadTask.stop();
|
|
109
112
|
this._uploadLog();
|
|
110
113
|
}
|
|
111
114
|
}
|
|
@@ -122,11 +125,14 @@ class FcrMainRoomControlImpl extends _.FcrBaseRoomControlImpl {
|
|
|
122
125
|
}), _imports.ErrorModuleCode.FCR_ROOM, 'enable waiting room failed');
|
|
123
126
|
}
|
|
124
127
|
async moveToWaitingRoomByUserIds(userIds) {
|
|
125
|
-
const
|
|
128
|
+
const _await$to = await (0, _imports.to)(this._api.moveToWaitingRoomByUserIds(userIds, this._scene.sceneId)),
|
|
129
|
+
_await$to2 = (0, _slicedToArray2.default)(_await$to, 1),
|
|
130
|
+
error = _await$to2[0];
|
|
126
131
|
if (error) {
|
|
127
|
-
this.logger.error(
|
|
132
|
+
this.logger.error("[RoomControl] move to waiting room failed, ".concat(error.message, "-").concat(JSON.stringify(error)));
|
|
128
133
|
if (error instanceof _imports.AgoraRestfulClientError) {
|
|
129
|
-
|
|
134
|
+
var _error$serviceCode;
|
|
135
|
+
throw (0, _error.generateFcrCoreServerError)((_error$serviceCode = error.serviceCode) !== null && _error$serviceCode !== void 0 ? _error$serviceCode : -1, error.message);
|
|
130
136
|
}
|
|
131
137
|
throw (0, _error.generateFcrCoreClientError)(_imports.ErrorModuleCode.FCR_ROOM, _imports.DetailErrorCode.UNDEFINED_ERROR, 'move to waiting room failed', error.message);
|
|
132
138
|
}
|
|
@@ -137,12 +143,12 @@ class FcrMainRoomControlImpl extends _.FcrBaseRoomControlImpl {
|
|
|
137
143
|
}
|
|
138
144
|
_onLocalUserPermissionInfoDeleted(roomId, event) {
|
|
139
145
|
if ((0, _utils2.hasBoardWritePermission)(event.permissionInfo)) {
|
|
140
|
-
this.logger.info(
|
|
146
|
+
this.logger.info("remove board write permission");
|
|
141
147
|
|
|
142
148
|
// this.getSharingControl().getBoardControl().getMainWindow()?.setWritable(false);
|
|
143
149
|
}
|
|
144
150
|
if ((0, _utils2.hasAnnotationWritePermission)(event.permissionInfo)) {
|
|
145
|
-
this.logger.info(
|
|
151
|
+
this.logger.info("remove annotation write permission");
|
|
146
152
|
|
|
147
153
|
// this.getSharingControl().getAnnotationControl().getMainWindow()?.setWritable(false);
|
|
148
154
|
}
|
|
@@ -156,12 +162,13 @@ class FcrMainRoomControlImpl extends _.FcrBaseRoomControlImpl {
|
|
|
156
162
|
const stream = streamControl.getStreamList().find(stream => stream.videoSourceType === _type.FcrVideoSourceType.SCREEN);
|
|
157
163
|
const localUserId = userControl.getLocalUser().userId;
|
|
158
164
|
if (stream) {
|
|
165
|
+
var _userControl$getUser;
|
|
159
166
|
const ownerId = stream.owner.userId;
|
|
160
167
|
const isNotMeSharing = ownerId !== localUserId;
|
|
161
|
-
const platform = userControl.getUser(ownerId)
|
|
168
|
+
const platform = (_userControl$getUser = userControl.getUser(ownerId)) === null || _userControl$getUser === void 0 ? void 0 : _userControl$getUser.platform;
|
|
162
169
|
const isPcPlatform = platform && [_type.FcrPlatform.WEB_DESKTOP, _type.FcrPlatform.WINDOWS, _type.FcrPlatform.MACOS].includes(platform);
|
|
163
170
|
const isAndroidPlatform = platform && platform === _type.FcrPlatform.ANDROID;
|
|
164
|
-
this.logger.info(
|
|
171
|
+
this.logger.info("check if set auto cancel draw, isPcPlatform: ".concat(isPcPlatform, ", isAndroidPlatform: ").concat(isAndroidPlatform, ", isNotMeSharing: ").concat(isNotMeSharing, ", ownerId: ").concat(ownerId, ", localUserId: ").concat(localUserId, ", platform: ").concat(platform));
|
|
165
172
|
if (isPcPlatform) {
|
|
166
173
|
mainWindow.setAutoCancelDraw(false);
|
|
167
174
|
}
|
|
@@ -196,4 +203,9 @@ class FcrMainRoomControlImpl extends _.FcrBaseRoomControlImpl {
|
|
|
196
203
|
['onRoomMessageReceived', ['roomId', 'message']], ['onRoomPropertiesDeleted', ['roomId', 'event']], ['onRoomPropertiesUpdated', ['roomId', 'event']], ['onRoomStateUpdated', ['roomId', 'state']]]));
|
|
197
204
|
}
|
|
198
205
|
}
|
|
199
|
-
exports.FcrMainRoomControlImpl = FcrMainRoomControlImpl;
|
|
206
|
+
exports.FcrMainRoomControlImpl = FcrMainRoomControlImpl;
|
|
207
|
+
_FcrMainRoomControlImpl = FcrMainRoomControlImpl;
|
|
208
|
+
var _applyDecs$e = _applyDecs(_FcrMainRoomControlImpl, [[_imports.trace, 2, "join"], [_imports.trace, 2, "leave"], [_enableWaitingRoomDecs, 2, "enableWaitingRoom"], [_moveToWaitingRoomByUserIdsDecs, 2, "moveToWaitingRoomByUserIds"], [_imports.trace, 2, "moveToWaitingRoomByUserRoles"], [_imports.bound, 2, "_onLocalUserPermissionInfoDeleted"]], [], 0, void 0, _.FcrBaseRoomControlImpl).e;
|
|
209
|
+
var _applyDecs$e2 = (0, _slicedToArray2.default)(_applyDecs$e, 1);
|
|
210
|
+
_initProto = _applyDecs$e2[0];
|
|
211
|
+
_applyDecs$e;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
3
4
|
Object.defineProperty(exports, "__esModule", {
|
|
4
5
|
value: true
|
|
5
6
|
});
|
|
@@ -7,6 +8,8 @@ exports.getLocalUserPermissionInfo = exports.addLocalUserPermissionObserver = ex
|
|
|
7
8
|
require("core-js/modules/esnext.iterator.constructor.js");
|
|
8
9
|
require("core-js/modules/esnext.iterator.find.js");
|
|
9
10
|
require("core-js/modules/esnext.iterator.map.js");
|
|
11
|
+
require("core-js/modules/web.dom-collections.iterator.js");
|
|
12
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
10
13
|
var _type = require("./type");
|
|
11
14
|
var _user = require("../../utilities/user");
|
|
12
15
|
// 初始化权限策略表达式:{module}:{action}-{k1=v1|v2;k2=v3}>{role1|role2}
|
|
@@ -31,13 +34,25 @@ class FcrPermission {
|
|
|
31
34
|
this.targetRoles = targetRoles;
|
|
32
35
|
}
|
|
33
36
|
static fromString(permission) {
|
|
34
|
-
const
|
|
35
|
-
|
|
36
|
-
|
|
37
|
+
const _permission$split = permission.split('>'),
|
|
38
|
+
_permission$split2 = (0, _slicedToArray2.default)(_permission$split, 2),
|
|
39
|
+
moduleActionParams = _permission$split2[0],
|
|
40
|
+
roles = _permission$split2[1];
|
|
41
|
+
const _moduleActionParams$s = moduleActionParams.split('-'),
|
|
42
|
+
_moduleActionParams$s2 = (0, _slicedToArray2.default)(_moduleActionParams$s, 2),
|
|
43
|
+
moduleAction = _moduleActionParams$s2[0],
|
|
44
|
+
params = _moduleActionParams$s2[1];
|
|
45
|
+
const _moduleAction$split = moduleAction.split(':'),
|
|
46
|
+
_moduleAction$split2 = (0, _slicedToArray2.default)(_moduleAction$split, 2),
|
|
47
|
+
module = _moduleAction$split2[0],
|
|
48
|
+
action = _moduleAction$split2[1];
|
|
37
49
|
const paramsObj = {};
|
|
38
50
|
if (params) {
|
|
39
51
|
for (const param of params.split(';')) {
|
|
40
|
-
const
|
|
52
|
+
const _param$split = param.split('='),
|
|
53
|
+
_param$split2 = (0, _slicedToArray2.default)(_param$split, 2),
|
|
54
|
+
key = _param$split2[0],
|
|
55
|
+
values = _param$split2[1];
|
|
41
56
|
paramsObj[key] = values.split('|');
|
|
42
57
|
}
|
|
43
58
|
}
|
|
@@ -46,7 +61,7 @@ class FcrPermission {
|
|
|
46
61
|
}
|
|
47
62
|
exports.FcrPermission = FcrPermission;
|
|
48
63
|
const getLocalUserPermissionInfo = (scene, action) => {
|
|
49
|
-
const permissionStringArray = scene.getUserPropertiesByKeyPath(
|
|
64
|
+
const permissionStringArray = scene.getUserPropertiesByKeyPath("permission.list", scene.localUser.getLocalUserId());
|
|
50
65
|
const permissionString = permissionStringArray.find(permission => permission.startsWith(action));
|
|
51
66
|
if (!permissionString) {
|
|
52
67
|
return {
|
|
@@ -62,15 +77,13 @@ const convertPermissionInfo = (permission, operateType) => {
|
|
|
62
77
|
enable: false
|
|
63
78
|
};
|
|
64
79
|
}
|
|
65
|
-
const
|
|
66
|
-
|
|
67
|
-
action
|
|
68
|
-
} = permission;
|
|
80
|
+
const module = permission.module,
|
|
81
|
+
action = permission.action;
|
|
69
82
|
const permissionInfo = {
|
|
70
83
|
enable: operateType === _type.FcrOperatePermissionType.ADD || operateType === _type.FcrOperatePermissionType.GET ? true : false,
|
|
71
84
|
info: {
|
|
72
85
|
targetRoles: permission.targetRoles.map(role => (0, _user.convertStringPrivilegeRoleToFcrPrivilegeRole)(role)),
|
|
73
|
-
action:
|
|
86
|
+
action: "".concat(module, ":").concat(action),
|
|
74
87
|
params: permission.conditions
|
|
75
88
|
}
|
|
76
89
|
};
|
|
@@ -79,11 +92,13 @@ const convertPermissionInfo = (permission, operateType) => {
|
|
|
79
92
|
const addLocalUserPermissionObserver = (scene, observer, cache) => {
|
|
80
93
|
scene.addObserver({
|
|
81
94
|
onUserPropertiesUpdated: (sceneId, event) => {
|
|
82
|
-
|
|
95
|
+
var _event$cause;
|
|
96
|
+
if (((_event$cause = event.cause) === null || _event$cause === void 0 ? void 0 : _event$cause.cmd) === 3200) {
|
|
83
97
|
if (event.modifiedUser.userId === scene.localUser.getLocalUserId()) {
|
|
98
|
+
var _data$addPermissions, _data$removePermissio;
|
|
84
99
|
const data = event.cause.data;
|
|
85
|
-
const addedPermissions = data.addPermissions
|
|
86
|
-
const removedPermissions = data.removePermissions
|
|
100
|
+
const addedPermissions = (_data$addPermissions = data.addPermissions) === null || _data$addPermissions === void 0 ? void 0 : _data$addPermissions.map(p => convertPermissionInfo(FcrPermission.fromString(p), _type.FcrOperatePermissionType.ADD));
|
|
101
|
+
const removedPermissions = (_data$removePermissio = data.removePermissions) === null || _data$removePermissio === void 0 ? void 0 : _data$removePermissio.map(p => convertPermissionInfo(FcrPermission.fromString(p), _type.FcrOperatePermissionType.DELETE));
|
|
87
102
|
if (removedPermissions && removedPermissions.length > 0) {
|
|
88
103
|
observer.onLocalUserPermissionInfoDeleted && observer.onLocalUserPermissionInfoDeleted(sceneId, {
|
|
89
104
|
permissionInfo: removedPermissions,
|