fcr-core 3.7.8 → 3.7.9-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 -41
- package/lib/engine/index.js +74 -67
- 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 -48
- package/lib/plugins/chatroom.js +202 -218
- 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 +17 -25
- 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 -48
- package/lib/room-control/shared-cache.js +29 -36
- package/lib/room-control/sharing-control/index.js +32 -40
- package/lib/room-control/stream-control/index.js +173 -181
- 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-v2/annotation-control/control.js +24 -32
- package/lib/room-control/whiteboard-control-v2/annotation-control/index.js +16 -27
- package/lib/room-control/whiteboard-control-v2/annotation-control/privilege-control.js +53 -63
- package/lib/room-control/whiteboard-control-v2/index.js +28 -40
- package/lib/room-control/whiteboard-control-v2/main-window.js +23 -28
- package/lib/room-control/whiteboard-control-v2/utils.js +6 -7
- package/lib/room-control/whiteboard-control-v2/whiteboard-control/control.js +27 -38
- package/lib/room-control/whiteboard-control-v2/whiteboard-control/index.js +3 -5
- package/lib/room-control/whiteboard-control-v2/whiteboard-control/privilege-control.js +42 -54
- package/lib/room-router/index.js +42 -52
- package/lib/service/api.js +207 -231
- 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/shared-storage.js +0 -1
- package/lib/utilities/storage.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 +4 -4
|
@@ -1,7 +1,5 @@
|
|
|
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
5
|
require("core-js/modules/esnext.map.delete-all.js");
|
|
@@ -24,9 +22,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
24
22
|
value: true
|
|
25
23
|
});
|
|
26
24
|
exports.FcrMainRoomControlImpl = void 0;
|
|
27
|
-
require("core-js/modules/es.json.stringify.js");
|
|
28
|
-
require("core-js/modules/web.dom-collections.iterator.js");
|
|
29
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
30
25
|
var _imports = require("../../imports");
|
|
31
26
|
var _ = require("..");
|
|
32
27
|
var _groupControl = require("../group-control");
|
|
@@ -38,8 +33,7 @@ var _schema = require("../../schema");
|
|
|
38
33
|
var _logger = require("../../utilities/logger");
|
|
39
34
|
var _validateParams = _interopRequireDefault(require("../../utilities/validate-params"));
|
|
40
35
|
var _sharedStorage = require("../../utilities/shared-storage");
|
|
41
|
-
|
|
42
|
-
let _initProto, _enableWaitingRoomDecs, _moveToWaitingRoomByUserIdsDecs, _ref;
|
|
36
|
+
let _initProto, _enableWaitingRoomDecs, _moveToWaitingRoomByUserIdsDecs;
|
|
43
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)]; } }; }
|
|
44
38
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
45
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); }
|
|
@@ -52,14 +46,16 @@ const {
|
|
|
52
46
|
/**
|
|
53
47
|
* @internal
|
|
54
48
|
*/
|
|
55
|
-
_ref = (_enableWaitingRoomDecs = [_imports.trace, (0, _validateParams.default)(_schema.booleanSchema)], _moveToWaitingRoomByUserIdsDecs = [_imports.trace, (0, _validateParams.default)(_schema.stringArraySchema)], "logger");
|
|
56
49
|
class FcrMainRoomControlImpl extends _.FcrBaseRoomControlImpl {
|
|
50
|
+
static {
|
|
51
|
+
[_initProto] = _applyDecs(this, [[_imports.trace, 2, "join"], [_imports.trace, 2, "leave"], [_enableWaitingRoomDecs, 2, "enableWaitingRoom"], [_moveToWaitingRoomByUserIdsDecs, 2, "moveToWaitingRoomByUserIds"], [_imports.trace, 2, "moveToWaitingRoomByUserRoles"], [_imports.bound, 2, "_getToken"], [_imports.bound, 2, "_getBoardToken"]], [], 0, void 0, _.FcrBaseRoomControlImpl).e;
|
|
52
|
+
}
|
|
53
|
+
//@internal
|
|
54
|
+
[(_enableWaitingRoomDecs = [_imports.trace, (0, _validateParams.default)(_schema.booleanSchema)], _moveToWaitingRoomByUserIdsDecs = [_imports.trace, (0, _validateParams.default)(_schema.stringArraySchema)], "logger")] = (_initProto(this), (0, _logger.createLogger)({
|
|
55
|
+
prefix: 'FcrMainRoomControlImpl'
|
|
56
|
+
}));
|
|
57
57
|
constructor(engine, scene, api, config, sharedCache, chatConnection, chatRoomControl) {
|
|
58
58
|
super(engine, scene, api, config, _type2.FcrRoomType.Mainroom, chatConnection, sharedCache, chatRoomControl);
|
|
59
|
-
//@internal
|
|
60
|
-
(0, _defineProperty2.default)(this, _ref, (_initProto(this), (0, _logger.createLogger)({
|
|
61
|
-
prefix: 'FcrMainRoomControlImpl'
|
|
62
|
-
})));
|
|
63
59
|
this._groupControl = new _groupControl.FcrGroupControl(engine, scene, api, sharedCache);
|
|
64
60
|
this._interpreterControl = new _interpreterControl.FcrInterpreterControlImpl(api, scene, config, engine, chatConnection, sharedCache);
|
|
65
61
|
this._addLogObserver();
|
|
@@ -82,7 +78,7 @@ class FcrMainRoomControlImpl extends _.FcrBaseRoomControlImpl {
|
|
|
82
78
|
this._initBoardInfo();
|
|
83
79
|
}
|
|
84
80
|
});
|
|
85
|
-
this.logger.info(
|
|
81
|
+
this.logger.info(`initialized, room id: ${this._scene.sceneId}`);
|
|
86
82
|
}
|
|
87
83
|
|
|
88
84
|
// @trace
|
|
@@ -117,8 +113,7 @@ class FcrMainRoomControlImpl extends _.FcrBaseRoomControlImpl {
|
|
|
117
113
|
try {
|
|
118
114
|
return await super.leave();
|
|
119
115
|
} finally {
|
|
120
|
-
|
|
121
|
-
(_this$_logUploadTask = this._logUploadTask) === null || _this$_logUploadTask === void 0 || _this$_logUploadTask.stop();
|
|
116
|
+
this._logUploadTask?.stop();
|
|
122
117
|
this._engine.getMonitor().uploadLog({
|
|
123
118
|
userUuid: this._config.userId,
|
|
124
119
|
roomUuid: this._scene.sceneId
|
|
@@ -140,10 +135,9 @@ class FcrMainRoomControlImpl extends _.FcrBaseRoomControlImpl {
|
|
|
140
135
|
async moveToWaitingRoomByUserIds(userIds) {
|
|
141
136
|
const [error] = await (0, _imports.to)(this._api.moveToWaitingRoomByUserIds(userIds, this._scene.sceneId));
|
|
142
137
|
if (error) {
|
|
143
|
-
this.logger.error(
|
|
138
|
+
this.logger.error(`[RoomControl] move to waiting room failed, ${error.message}-${JSON.stringify(error)}`);
|
|
144
139
|
if (error instanceof _imports.AgoraRestfulClientError) {
|
|
145
|
-
|
|
146
|
-
throw (0, _error.generateFcrCoreServerError)((_error$serviceCode = error.serviceCode) !== null && _error$serviceCode !== void 0 ? _error$serviceCode : -1, error.message, error);
|
|
140
|
+
throw (0, _error.generateFcrCoreServerError)(error.serviceCode ?? -1, error.message, error);
|
|
147
141
|
}
|
|
148
142
|
throw (0, _error.generateFcrCoreClientError)(_error.FcrErrorModuleCode.ROOM, _error.FcrErrorCode.UNDEFINED_ERROR, 'move to waiting room failed', error);
|
|
149
143
|
}
|
|
@@ -156,9 +150,9 @@ class FcrMainRoomControlImpl extends _.FcrBaseRoomControlImpl {
|
|
|
156
150
|
const userId = this._scene.localUser.getLocalUserId();
|
|
157
151
|
const boardOptions = (await this._getToken(roomId, userId)).data;
|
|
158
152
|
if (!boardOptions) {
|
|
159
|
-
this.logger.error(
|
|
153
|
+
this.logger.error(`get annotation board options failed, roomId: ${roomId}, userId: ${userId}, boardOptions: ${(0, _imports.jsonstring)(boardOptions)}`);
|
|
160
154
|
} else {
|
|
161
|
-
this.logger.info(
|
|
155
|
+
this.logger.info(`get annotation board options success, roomId: ${roomId}, userId: ${userId}, boardOptions: ${(0, _imports.jsonstring)(boardOptions)}`);
|
|
162
156
|
(0, _sharedStorage.setAnnotationBoardOptions)(boardOptions);
|
|
163
157
|
}
|
|
164
158
|
}
|
|
@@ -167,9 +161,9 @@ class FcrMainRoomControlImpl extends _.FcrBaseRoomControlImpl {
|
|
|
167
161
|
const userId = this._scene.localUser.getLocalUserId();
|
|
168
162
|
const boardOptions = (await this._getBoardToken(roomId, userId)).data;
|
|
169
163
|
if (!boardOptions) {
|
|
170
|
-
this.logger.error(
|
|
164
|
+
this.logger.error(`get whiteboard options failed, roomId: ${roomId}, userId: ${userId}, boardOptions: ${(0, _imports.jsonstring)(boardOptions)}`);
|
|
171
165
|
} else {
|
|
172
|
-
this.logger.info(
|
|
166
|
+
this.logger.info(`get whiteboard options success, roomId: ${roomId}, userId: ${userId}, boardOptions: ${(0, _imports.jsonstring)(boardOptions)}`);
|
|
173
167
|
(0, _sharedStorage.setWhiteboardOptions)(boardOptions);
|
|
174
168
|
}
|
|
175
169
|
}
|
|
@@ -192,6 +186,4 @@ class FcrMainRoomControlImpl extends _.FcrBaseRoomControlImpl {
|
|
|
192
186
|
'onRoomMessageReceived', 'onRoomPropertiesDeleted', 'onRoomPropertiesUpdated', 'onRoomStateUpdated']));
|
|
193
187
|
}
|
|
194
188
|
}
|
|
195
|
-
exports.FcrMainRoomControlImpl = FcrMainRoomControlImpl;
|
|
196
|
-
_FcrMainRoomControlImpl = FcrMainRoomControlImpl;
|
|
197
|
-
[_initProto] = _applyDecs(_FcrMainRoomControlImpl, [[_imports.trace, 2, "join"], [_imports.trace, 2, "leave"], [_enableWaitingRoomDecs, 2, "enableWaitingRoom"], [_moveToWaitingRoomByUserIdsDecs, 2, "moveToWaitingRoomByUserIds"], [_imports.trace, 2, "moveToWaitingRoomByUserRoles"], [_imports.bound, 2, "_getToken"], [_imports.bound, 2, "_getBoardToken"]], [], 0, void 0, _.FcrBaseRoomControlImpl).e;
|
|
189
|
+
exports.FcrMainRoomControlImpl = FcrMainRoomControlImpl;
|
|
@@ -7,7 +7,6 @@ exports.getLocalUserPermissionInfo = exports.addLocalUserPermissionObserver = ex
|
|
|
7
7
|
require("core-js/modules/esnext.iterator.constructor.js");
|
|
8
8
|
require("core-js/modules/esnext.iterator.find.js");
|
|
9
9
|
require("core-js/modules/esnext.iterator.map.js");
|
|
10
|
-
require("core-js/modules/web.dom-collections.iterator.js");
|
|
11
10
|
var _type = require("./type");
|
|
12
11
|
var _user = require("../../utilities/user");
|
|
13
12
|
// 初始化权限策略表达式:{module}:{action}-{k1=v1|v2;k2=v3}>{role1|role2}
|
|
@@ -47,7 +46,7 @@ class FcrPermission {
|
|
|
47
46
|
}
|
|
48
47
|
exports.FcrPermission = FcrPermission;
|
|
49
48
|
const getLocalUserPermissionInfo = (scene, action) => {
|
|
50
|
-
const permissionStringArray = scene.getUserPropertiesByKeyPath(
|
|
49
|
+
const permissionStringArray = scene.getUserPropertiesByKeyPath(`permission.list`, scene.localUser.getLocalUserId());
|
|
51
50
|
const permissionString = permissionStringArray.find(permission => permission.startsWith(action));
|
|
52
51
|
if (!permissionString) {
|
|
53
52
|
return {
|
|
@@ -71,7 +70,7 @@ const convertPermissionInfo = (permission, operateType) => {
|
|
|
71
70
|
enable: operateType === _type.FcrOperatePermissionType.ADD || operateType === _type.FcrOperatePermissionType.GET ? true : false,
|
|
72
71
|
info: {
|
|
73
72
|
targetRoles: permission.targetRoles.map(role => (0, _user.convertStringPrivilegeRoleToFcrPrivilegeRole)(role)),
|
|
74
|
-
action:
|
|
73
|
+
action: `${module}:${action}`,
|
|
75
74
|
params: permission.conditions
|
|
76
75
|
}
|
|
77
76
|
};
|
|
@@ -80,13 +79,11 @@ const convertPermissionInfo = (permission, operateType) => {
|
|
|
80
79
|
const addLocalUserPermissionObserver = (scene, observer, cache) => {
|
|
81
80
|
scene.addObserver({
|
|
82
81
|
onUserPropertiesUpdated: (sceneId, event) => {
|
|
83
|
-
|
|
84
|
-
if (((_event$cause = event.cause) === null || _event$cause === void 0 ? void 0 : _event$cause.cmd) === 3200) {
|
|
82
|
+
if (event.cause?.cmd === 3200) {
|
|
85
83
|
if (event.modifiedUser.userId === scene.localUser.getLocalUserId()) {
|
|
86
|
-
var _data$addPermissions, _data$removePermissio;
|
|
87
84
|
const data = event.cause.data;
|
|
88
|
-
const addedPermissions =
|
|
89
|
-
const removedPermissions =
|
|
85
|
+
const addedPermissions = data.addPermissions?.map(p => convertPermissionInfo(FcrPermission.fromString(p), _type.FcrOperatePermissionType.ADD));
|
|
86
|
+
const removedPermissions = data.removePermissions?.map(p => convertPermissionInfo(FcrPermission.fromString(p), _type.FcrOperatePermissionType.DELETE));
|
|
90
87
|
if (removedPermissions && removedPermissions.length > 0) {
|
|
91
88
|
observer.onLocalUserPermissionInfoDeleted && observer.onLocalUserPermissionInfoDeleted(sceneId, {
|
|
92
89
|
permissionInfo: removedPermissions,
|
|
@@ -1,10 +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.filter.js");
|
|
8
5
|
require("core-js/modules/esnext.map.delete-all.js");
|
|
9
6
|
require("core-js/modules/esnext.map.emplace.js");
|
|
10
7
|
require("core-js/modules/esnext.map.every.js");
|
|
@@ -28,8 +25,6 @@ exports.FcrPrivilegeControlImpl = void 0;
|
|
|
28
25
|
require("core-js/modules/esnext.iterator.constructor.js");
|
|
29
26
|
require("core-js/modules/esnext.iterator.for-each.js");
|
|
30
27
|
require("core-js/modules/esnext.iterator.map.js");
|
|
31
|
-
require("core-js/modules/web.dom-collections.iterator.js");
|
|
32
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
33
28
|
var _imports = require("../../imports");
|
|
34
29
|
var _type = require("../../type");
|
|
35
30
|
var _user = require("../../utilities/user");
|
|
@@ -39,26 +34,25 @@ var _logger = require("../../utilities/logger");
|
|
|
39
34
|
var _error = require("../../utilities/error");
|
|
40
35
|
var _validateParams = _interopRequireDefault(require("../../utilities/validate-params"));
|
|
41
36
|
var _schema = require("../../schema");
|
|
42
|
-
|
|
43
|
-
let _initProto, _getSecurityInfoDecs, _getLocalUserPermissionInfoDecs, _enableLockedRoomDecs, _allowShareAndWriteDecs, _allowWriteBoardDecs, _allowSendChatDecs, _allowStartAudioDecs, _allowStartVideoDecs, _allowJoinWithMutedAudioDecs, _allowJoinWithMutedVideoDecs, _allowWatermarkDecs, _allowChangeUserNameDecs, _ref;
|
|
44
|
-
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; }
|
|
45
|
-
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
|
+
let _initProto, _getSecurityInfoDecs, _getLocalUserPermissionInfoDecs, _enableLockedRoomDecs, _allowShareAndWriteDecs, _allowWriteBoardDecs, _allowSendChatDecs, _allowStartAudioDecs, _allowStartVideoDecs, _allowJoinWithMutedAudioDecs, _allowJoinWithMutedVideoDecs, _allowWatermarkDecs, _allowChangeUserNameDecs;
|
|
46
38
|
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)]; } }; }
|
|
47
39
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
48
40
|
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); }
|
|
49
41
|
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; }
|
|
50
42
|
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; }
|
|
51
|
-
_ref = (_getSecurityInfoDecs = [_imports.trace, (0, _validateParams.default)(_schema.fcrSecurityActionSchema)], _getLocalUserPermissionInfoDecs = [_imports.trace, (0, _validateParams.default)(_schema.fcrPermissionActionSchema)], _enableLockedRoomDecs = [_imports.trace, (0, _validateParams.default)(_schema.booleanSchema, _schema.fcrPrivilegeUserRoleArraySchema)], _allowShareAndWriteDecs = [_imports.trace, (0, _validateParams.default)(_schema.booleanSchema, _schema.fcrPrivilegeUserRoleArraySchema)], _allowWriteBoardDecs = [_imports.trace, (0, _validateParams.default)(_schema.booleanSchema, _schema.fcrPrivilegeUserRoleArraySchema)], _allowSendChatDecs = [_imports.trace, (0, _validateParams.default)(_schema.booleanSchema, _schema.fcrPrivilegeUserRoleArraySchema, _schema.fcrSecuritySendChatPayloadSchema)], _allowStartAudioDecs = [_imports.trace, (0, _validateParams.default)(_schema.booleanSchema, _schema.fcrPrivilegeUserRoleArraySchema)], _allowStartVideoDecs = [_imports.trace, (0, _validateParams.default)(_schema.booleanSchema, _schema.fcrPrivilegeUserRoleArraySchema)], _allowJoinWithMutedAudioDecs = [_imports.trace, (0, _validateParams.default)(_schema.booleanSchema, _schema.fcrPrivilegeUserRoleArraySchema)], _allowJoinWithMutedVideoDecs = [_imports.trace, (0, _validateParams.default)(_schema.booleanSchema, _schema.fcrPrivilegeUserRoleArraySchema)], _allowWatermarkDecs = [_imports.trace, (0, _validateParams.default)(_schema.booleanSchema, _schema.fcrPrivilegeUserRoleArraySchema, _schema.fcrLineTypeSchema.optional())], _allowChangeUserNameDecs = [_imports.trace, (0, _validateParams.default)(_schema.booleanSchema, _schema.fcrPrivilegeUserRoleArraySchema)], "logger");
|
|
52
43
|
/**
|
|
53
44
|
* @internal
|
|
54
45
|
*/
|
|
55
46
|
class FcrPrivilegeControlImpl {
|
|
47
|
+
static {
|
|
48
|
+
[_initProto] = _applyDecs(this, [[_imports.trace, 2, "allowWriteAnnotation"], [_getSecurityInfoDecs, 2, "getSecurityInfo"], [_getLocalUserPermissionInfoDecs, 2, "getLocalUserPermissionInfo"], [_enableLockedRoomDecs, 2, "enableLockedRoom"], [_allowShareAndWriteDecs, 2, "allowShareAndWrite"], [_allowWriteBoardDecs, 2, "allowWriteBoard"], [_allowSendChatDecs, 2, "allowSendChat"], [_allowStartAudioDecs, 2, "allowStartAudio"], [_allowStartVideoDecs, 2, "allowStartVideo"], [_allowJoinWithMutedAudioDecs, 2, "allowJoinWithMutedAudio"], [_allowJoinWithMutedVideoDecs, 2, "allowJoinWithMutedVideo"], [_allowWatermarkDecs, 2, "allowWatermark"], [_allowChangeUserNameDecs, 2, "allowChangeUserName"]], []).e;
|
|
49
|
+
}
|
|
50
|
+
//@internal
|
|
51
|
+
[(_getSecurityInfoDecs = [_imports.trace, (0, _validateParams.default)(_schema.fcrSecurityActionSchema)], _getLocalUserPermissionInfoDecs = [_imports.trace, (0, _validateParams.default)(_schema.fcrPermissionActionSchema)], _enableLockedRoomDecs = [_imports.trace, (0, _validateParams.default)(_schema.booleanSchema, _schema.fcrPrivilegeUserRoleArraySchema)], _allowShareAndWriteDecs = [_imports.trace, (0, _validateParams.default)(_schema.booleanSchema, _schema.fcrPrivilegeUserRoleArraySchema)], _allowWriteBoardDecs = [_imports.trace, (0, _validateParams.default)(_schema.booleanSchema, _schema.fcrPrivilegeUserRoleArraySchema)], _allowSendChatDecs = [_imports.trace, (0, _validateParams.default)(_schema.booleanSchema, _schema.fcrPrivilegeUserRoleArraySchema, _schema.fcrSecuritySendChatPayloadSchema)], _allowStartAudioDecs = [_imports.trace, (0, _validateParams.default)(_schema.booleanSchema, _schema.fcrPrivilegeUserRoleArraySchema)], _allowStartVideoDecs = [_imports.trace, (0, _validateParams.default)(_schema.booleanSchema, _schema.fcrPrivilegeUserRoleArraySchema)], _allowJoinWithMutedAudioDecs = [_imports.trace, (0, _validateParams.default)(_schema.booleanSchema, _schema.fcrPrivilegeUserRoleArraySchema)], _allowJoinWithMutedVideoDecs = [_imports.trace, (0, _validateParams.default)(_schema.booleanSchema, _schema.fcrPrivilegeUserRoleArraySchema)], _allowWatermarkDecs = [_imports.trace, (0, _validateParams.default)(_schema.booleanSchema, _schema.fcrPrivilegeUserRoleArraySchema, _schema.fcrLineTypeSchema.optional())], _allowChangeUserNameDecs = [_imports.trace, (0, _validateParams.default)(_schema.booleanSchema, _schema.fcrPrivilegeUserRoleArraySchema)], "logger")] = (_initProto(this), (0, _logger.createLogger)({
|
|
52
|
+
prefix: 'FcrPrivilegeControlImpl'
|
|
53
|
+
}));
|
|
54
|
+
_observable = new _imports.AgoraObservable();
|
|
56
55
|
constructor(_engine, _scene, _api, _sharedCache) {
|
|
57
|
-
//@internal
|
|
58
|
-
(0, _defineProperty2.default)(this, _ref, (_initProto(this), (0, _logger.createLogger)({
|
|
59
|
-
prefix: 'FcrPrivilegeControlImpl'
|
|
60
|
-
})));
|
|
61
|
-
(0, _defineProperty2.default)(this, "_observable", new _imports.AgoraObservable());
|
|
62
56
|
this._engine = _engine;
|
|
63
57
|
this._scene = _scene;
|
|
64
58
|
this._api = _api;
|
|
@@ -78,7 +72,7 @@ class FcrPrivilegeControlImpl {
|
|
|
78
72
|
}), _error.FcrErrorModuleCode.ROOM_WHITEBOARD, 'allow annotation failed');
|
|
79
73
|
}
|
|
80
74
|
getSecurityInfo(action) {
|
|
81
|
-
const info = this._scene.getScenePropertiesByKeyPath(
|
|
75
|
+
const info = this._scene.getScenePropertiesByKeyPath(`security.${action}`);
|
|
82
76
|
return this._convertSecurityInfo(info, action);
|
|
83
77
|
}
|
|
84
78
|
// @trace
|
|
@@ -106,7 +100,7 @@ class FcrPrivilegeControlImpl {
|
|
|
106
100
|
|
|
107
101
|
// @trace
|
|
108
102
|
getAllLocalUserPermissionInfo() {
|
|
109
|
-
const permissionStringArray = this._scene.getUserPropertiesByKeyPath(
|
|
103
|
+
const permissionStringArray = this._scene.getUserPropertiesByKeyPath(`permission.list`, this._scene.localUser.getLocalUserId());
|
|
110
104
|
return permissionStringArray.map(permissionString => this._convertPermissionInfo(_helper.FcrPermission.fromString(permissionString), _type2.FcrOperatePermissionType.GET));
|
|
111
105
|
}
|
|
112
106
|
async enableLockedRoom(enable, targetRoles) {
|
|
@@ -200,7 +194,7 @@ class FcrPrivilegeControlImpl {
|
|
|
200
194
|
enable,
|
|
201
195
|
targetRoles: targetRoles.map(role => _type2.FcrPrivilegeUserRoleToStringMap[role]),
|
|
202
196
|
payload: {
|
|
203
|
-
lineType: lineType
|
|
197
|
+
lineType: lineType ?? _type.FcrLineType.SINGLE_ROW
|
|
204
198
|
}
|
|
205
199
|
}), _error.FcrErrorModuleCode.ROOM_PRIVILEGE, 'allow water mark failed');
|
|
206
200
|
}
|
|
@@ -228,12 +222,13 @@ class FcrPrivilegeControlImpl {
|
|
|
228
222
|
payload
|
|
229
223
|
} = security;
|
|
230
224
|
if (action === _type2.FcrSecurityAction.Annotation) {
|
|
231
|
-
return
|
|
225
|
+
return {
|
|
232
226
|
info: {
|
|
233
227
|
action: action,
|
|
234
228
|
payload
|
|
235
|
-
}
|
|
236
|
-
|
|
229
|
+
},
|
|
230
|
+
...security
|
|
231
|
+
};
|
|
237
232
|
}
|
|
238
233
|
return {
|
|
239
234
|
enable: !!security.enable,
|
|
@@ -258,7 +253,7 @@ class FcrPrivilegeControlImpl {
|
|
|
258
253
|
enable: operateType === _type2.FcrOperatePermissionType.ADD || operateType === _type2.FcrOperatePermissionType.GET ? true : false,
|
|
259
254
|
info: {
|
|
260
255
|
targetRoles: permission.targetRoles.map(role => (0, _user.convertStringPrivilegeRoleToFcrPrivilegeRole)(role)),
|
|
261
|
-
action:
|
|
256
|
+
action: `${module}:${action}`,
|
|
262
257
|
params: permission.conditions
|
|
263
258
|
}
|
|
264
259
|
};
|
|
@@ -270,7 +265,7 @@ class FcrPrivilegeControlImpl {
|
|
|
270
265
|
if ('security' in event.changedProperties) {
|
|
271
266
|
const securityChangedKeys = Object.keys(event.changedProperties.security);
|
|
272
267
|
securityChangedKeys.forEach(key => {
|
|
273
|
-
const infoObj = (0, _imports.get)(event.changedProperties,
|
|
268
|
+
const infoObj = (0, _imports.get)(event.changedProperties, `security.${key}`);
|
|
274
269
|
this._observable.notifyObservers('onSecurityInfoUpdated', sceneId, {
|
|
275
270
|
securityInfo: this._convertSecurityInfo(infoObj, key),
|
|
276
271
|
operatorUser: (0, _user.checkFcrUserRole)((0, _user.convertRteUserToFcrUser)(event.operatorUser, this._roomCache)),
|
|
@@ -293,6 +288,4 @@ class FcrPrivilegeControlImpl {
|
|
|
293
288
|
this.addObserver((0, _logger.generateLogObserver)(this.logger, ['onSecurityInfoUpdated', 'onLocalUserPermissionInfoAdded', 'onLocalUserPermissionInfoDeleted']));
|
|
294
289
|
}
|
|
295
290
|
}
|
|
296
|
-
exports.FcrPrivilegeControlImpl = FcrPrivilegeControlImpl;
|
|
297
|
-
_FcrPrivilegeControlImpl = FcrPrivilegeControlImpl;
|
|
298
|
-
[_initProto] = _applyDecs(_FcrPrivilegeControlImpl, [[_imports.trace, 2, "allowWriteAnnotation"], [_getSecurityInfoDecs, 2, "getSecurityInfo"], [_getLocalUserPermissionInfoDecs, 2, "getLocalUserPermissionInfo"], [_enableLockedRoomDecs, 2, "enableLockedRoom"], [_allowShareAndWriteDecs, 2, "allowShareAndWrite"], [_allowWriteBoardDecs, 2, "allowWriteBoard"], [_allowSendChatDecs, 2, "allowSendChat"], [_allowStartAudioDecs, 2, "allowStartAudio"], [_allowStartVideoDecs, 2, "allowStartVideo"], [_allowJoinWithMutedAudioDecs, 2, "allowJoinWithMutedAudio"], [_allowJoinWithMutedVideoDecs, 2, "allowJoinWithMutedVideo"], [_allowWatermarkDecs, 2, "allowWatermark"], [_allowChangeUserNameDecs, 2, "allowChangeUserName"]], []).e;
|
|
291
|
+
exports.FcrPrivilegeControlImpl = FcrPrivilegeControlImpl;
|
|
@@ -1,7 +1,5 @@
|
|
|
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/esnext.function.metadata.js");
|
|
6
4
|
require("core-js/modules/esnext.map.delete-all.js");
|
|
7
5
|
require("core-js/modules/esnext.map.emplace.js");
|
|
@@ -27,16 +25,13 @@ require("core-js/modules/es.array.push.js");
|
|
|
27
25
|
require("core-js/modules/esnext.iterator.constructor.js");
|
|
28
26
|
require("core-js/modules/esnext.iterator.map.js");
|
|
29
27
|
require("core-js/modules/esnext.iterator.reduce.js");
|
|
30
|
-
require("core-js/modules/web.dom-collections.iterator.js");
|
|
31
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
32
28
|
var _type = require("./type");
|
|
33
29
|
var _imports = require("../../imports");
|
|
34
30
|
var _logger = require("../../utilities/logger");
|
|
35
31
|
var _error = require("../../utilities/error");
|
|
36
32
|
var _validateParams = _interopRequireDefault(require("../../utilities/validate-params"));
|
|
37
33
|
var _schema = require("../../schema");
|
|
38
|
-
|
|
39
|
-
let _initProto, _startSessionByPhoneDecs, _startSessionByIPDecs, _stopSessionDecs, _ref;
|
|
34
|
+
let _initProto, _startSessionByPhoneDecs, _startSessionByIPDecs, _stopSessionDecs;
|
|
40
35
|
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)]; } }; }
|
|
41
36
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
42
37
|
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,14 +40,16 @@ function _checkInRHS(e) { if (Object(e) !== e) throw TypeError("right-hand side
|
|
|
45
40
|
/**
|
|
46
41
|
* @internal
|
|
47
42
|
*/
|
|
48
|
-
_ref = (_startSessionByPhoneDecs = [_imports.trace, (0, _validateParams.default)(_schema.fcrPhoneConnectorSessionParamsSchema)], _startSessionByIPDecs = [_imports.trace, (0, _validateParams.default)(_schema.fcrIPConnectorSessionParamsSchema)], _stopSessionDecs = [_imports.trace, (0, _validateParams.default)(_schema.stringSchema)], "logger");
|
|
49
43
|
class FcrRoomConnectorControlImpl {
|
|
44
|
+
static {
|
|
45
|
+
[_initProto] = _applyDecs(this, [[_imports.trace, 2, "getRoomConnectorPhoneInfo"], [_imports.trace, 2, "getRoomConnectorIpInfo"], [_startSessionByPhoneDecs, 2, "startSessionByPhone"], [_startSessionByIPDecs, 2, "startSessionByIP"], [_stopSessionDecs, 2, "stopSession"]], []).e;
|
|
46
|
+
}
|
|
47
|
+
//@internal
|
|
48
|
+
[(_startSessionByPhoneDecs = [_imports.trace, (0, _validateParams.default)(_schema.fcrPhoneConnectorSessionParamsSchema)], _startSessionByIPDecs = [_imports.trace, (0, _validateParams.default)(_schema.fcrIPConnectorSessionParamsSchema)], _stopSessionDecs = [_imports.trace, (0, _validateParams.default)(_schema.stringSchema)], "logger")] = (_initProto(this), (0, _logger.createLogger)({
|
|
49
|
+
prefix: 'FcrRoomConnectorControlImpl'
|
|
50
|
+
}));
|
|
51
|
+
_observable = new _imports.AgoraObservable();
|
|
50
52
|
constructor(_scene, _engine, _api) {
|
|
51
|
-
//@internal
|
|
52
|
-
(0, _defineProperty2.default)(this, _ref, (_initProto(this), (0, _logger.createLogger)({
|
|
53
|
-
prefix: 'FcrRoomConnectorControlImpl'
|
|
54
|
-
})));
|
|
55
|
-
(0, _defineProperty2.default)(this, "_observable", new _imports.AgoraObservable());
|
|
56
53
|
this._scene = _scene;
|
|
57
54
|
this._engine = _engine;
|
|
58
55
|
this._api = _api;
|
|
@@ -62,18 +59,16 @@ class FcrRoomConnectorControlImpl {
|
|
|
62
59
|
});
|
|
63
60
|
}
|
|
64
61
|
getRoomConnectorPhoneInfo() {
|
|
65
|
-
var _ref2;
|
|
66
62
|
const mid = this._scene.getScenePropertiesByKeyPath('call.mid');
|
|
67
|
-
const callIn =
|
|
63
|
+
const callIn = this._scene.getScenePropertiesByKeyPath('call.callIn') ?? [];
|
|
68
64
|
const uid = this._scene.getUserPropertiesByKeyPath('call.uid', this._scene.getLocalUser().getLocalUserId());
|
|
69
65
|
const regionMap = {
|
|
70
66
|
cn: _type.FcrRoomConnectorPhoneRegion.CN
|
|
71
67
|
};
|
|
72
|
-
return Promise.resolve(callIn.map(
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
} = _ref3;
|
|
68
|
+
return Promise.resolve(callIn.map(({
|
|
69
|
+
callNumbers,
|
|
70
|
+
region
|
|
71
|
+
}) => {
|
|
77
72
|
return {
|
|
78
73
|
region: regionMap[region],
|
|
79
74
|
phoneNumberList: callNumbers,
|
|
@@ -83,14 +78,12 @@ class FcrRoomConnectorControlImpl {
|
|
|
83
78
|
}));
|
|
84
79
|
}
|
|
85
80
|
getRoomConnectorIpInfo() {
|
|
86
|
-
var _ref4;
|
|
87
81
|
const mid = this._scene.getScenePropertiesByKeyPath('call.mid');
|
|
88
|
-
const callIn =
|
|
82
|
+
const callIn = this._scene.getScenePropertiesByKeyPath('call.callIn') ?? [];
|
|
89
83
|
return Promise.resolve({
|
|
90
|
-
addressList: callIn.reduce((prev,
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
} = _ref5;
|
|
84
|
+
addressList: callIn.reduce((prev, {
|
|
85
|
+
ipAddresses
|
|
86
|
+
}) => {
|
|
94
87
|
if (Array.isArray(ipAddresses)) {
|
|
95
88
|
prev.push(...ipAddresses);
|
|
96
89
|
}
|
|
@@ -190,6 +183,4 @@ class FcrRoomConnectorControlImpl {
|
|
|
190
183
|
this.addObserver((0, _logger.generateLogObserver)(this.logger, ['onIPConnectorSessionStateUpdated', 'onPhoneConnectorSessionStateUpdated']));
|
|
191
184
|
}
|
|
192
185
|
}
|
|
193
|
-
exports.FcrRoomConnectorControlImpl = FcrRoomConnectorControlImpl;
|
|
194
|
-
_FcrRoomConnectorControlImpl = FcrRoomConnectorControlImpl;
|
|
195
|
-
[_initProto] = _applyDecs(_FcrRoomConnectorControlImpl, [[_imports.trace, 2, "getRoomConnectorPhoneInfo"], [_imports.trace, 2, "getRoomConnectorIpInfo"], [_startSessionByPhoneDecs, 2, "startSessionByPhone"], [_startSessionByIPDecs, 2, "startSessionByIP"], [_stopSessionDecs, 2, "stopSession"]], []).e;
|
|
186
|
+
exports.FcrRoomConnectorControlImpl = FcrRoomConnectorControlImpl;
|
|
@@ -4,7 +4,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.RoomControlFactory = void 0;
|
|
7
|
-
require("core-js/modules/es.error.cause.js");
|
|
8
7
|
require("core-js/modules/esnext.iterator.constructor.js");
|
|
9
8
|
require("core-js/modules/esnext.iterator.map.js");
|
|
10
9
|
var _type = require("./type");
|
|
@@ -54,7 +53,7 @@ class RoomControlFactory {
|
|
|
54
53
|
const roomType = roomResponse.room.roomProperties.roomType;
|
|
55
54
|
const RoomControlImpl = ROOM_CONTROL_IMPLEMENTATIONS[roomType];
|
|
56
55
|
if (!RoomControlImpl) {
|
|
57
|
-
throw (0, _error.generateFcrCoreClientError)(_error.FcrErrorModuleCode.ROOM, _error.FcrErrorCode.UNDEFINED_ERROR,
|
|
56
|
+
throw (0, _error.generateFcrCoreClientError)(_error.FcrErrorModuleCode.ROOM, _error.FcrErrorCode.UNDEFINED_ERROR, `Unsupported room types: ${roomType}`, new Error(`Unsupported room type: ${roomType}`));
|
|
58
57
|
}
|
|
59
58
|
|
|
60
59
|
// 创建聊天室控制
|