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,3 +1,5 @@
|
|
|
1
|
+
import "core-js/modules/es.symbol.description.js";
|
|
2
|
+
import "core-js/modules/es.error.cause.js";
|
|
1
3
|
import "core-js/modules/es.array.push.js";
|
|
2
4
|
import "core-js/modules/esnext.function.metadata.js";
|
|
3
5
|
import "core-js/modules/esnext.map.delete-all.js";
|
|
@@ -15,7 +17,11 @@ import "core-js/modules/esnext.map.reduce.js";
|
|
|
15
17
|
import "core-js/modules/esnext.map.some.js";
|
|
16
18
|
import "core-js/modules/esnext.map.update.js";
|
|
17
19
|
import "core-js/modules/esnext.symbol.metadata.js";
|
|
18
|
-
|
|
20
|
+
import "core-js/modules/web.dom-collections.iterator.js";
|
|
21
|
+
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
22
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
23
|
+
var _FcrMainRoomControlImpl;
|
|
24
|
+
let _initProto, _enableWaitingRoomDecs, _moveToWaitingRoomByUserIdsDecs, _ref;
|
|
19
25
|
import "core-js/modules/es.array.includes.js";
|
|
20
26
|
import "core-js/modules/es.json.stringify.js";
|
|
21
27
|
import "core-js/modules/esnext.iterator.constructor.js";
|
|
@@ -39,32 +45,28 @@ import { FcrRoomType } from '../type';
|
|
|
39
45
|
import { getAnnotationConfigFromRoomProperties } from '../whiteboard-control-v2/utils';
|
|
40
46
|
import { hasAnnotationWritePermission, hasBoardWritePermission } from '../whiteboard-control/utils';
|
|
41
47
|
import { addBoardInitInfoObserver } from '../helpers/board-init-info-helper';
|
|
42
|
-
const
|
|
43
|
-
|
|
44
|
-
Duration
|
|
45
|
-
} = AgoraScheduler;
|
|
48
|
+
const sharedScheduler = AgoraScheduler.shared,
|
|
49
|
+
Duration = AgoraScheduler.Duration;
|
|
46
50
|
/**
|
|
47
51
|
* @internal
|
|
48
52
|
*/
|
|
53
|
+
_ref = (_enableWaitingRoomDecs = [trace(['enable']), validateParams(booleanSchema)], _moveToWaitingRoomByUserIdsDecs = [trace(['userIds']), validateParams(stringArraySchema)], "logger");
|
|
49
54
|
export class FcrMainRoomControlImpl extends FcrBaseRoomControlImpl {
|
|
50
|
-
static {
|
|
51
|
-
[_initProto] = _applyDecs(this, [[trace, 2, "join"], [trace, 2, "leave"], [_enableWaitingRoomDecs, 2, "enableWaitingRoom"], [_moveToWaitingRoomByUserIdsDecs, 2, "moveToWaitingRoomByUserIds"], [trace, 2, "moveToWaitingRoomByUserRoles"], [bound, 2, "_onLocalUserPermissionInfoDeleted"]], [], 0, void 0, FcrBaseRoomControlImpl).e;
|
|
52
|
-
}
|
|
53
|
-
//@internal
|
|
54
|
-
[(_enableWaitingRoomDecs = [trace(['enable']), validateParams(booleanSchema)], _moveToWaitingRoomByUserIdsDecs = [trace(['userIds']), validateParams(stringArraySchema)], "logger")] = (_initProto(this), createLogger({
|
|
55
|
-
prefix: 'FcrMainRoomControlImpl'
|
|
56
|
-
}));
|
|
57
|
-
_privilegeObserver = {
|
|
58
|
-
onLocalUserPermissionInfoDeleted: this._onLocalUserPermissionInfoDeleted
|
|
59
|
-
};
|
|
60
55
|
constructor(engine, scene, api, config, sharedCache, chatConnection, chatRoomControl, monitorControl) {
|
|
61
56
|
super(engine, scene, api, config, FcrRoomType.Mainroom, chatConnection, sharedCache, chatRoomControl);
|
|
57
|
+
//@internal
|
|
58
|
+
_defineProperty(this, _ref, (_initProto(this), createLogger({
|
|
59
|
+
prefix: 'FcrMainRoomControlImpl'
|
|
60
|
+
})));
|
|
61
|
+
_defineProperty(this, "_privilegeObserver", {
|
|
62
|
+
onLocalUserPermissionInfoDeleted: this._onLocalUserPermissionInfoDeleted
|
|
63
|
+
});
|
|
62
64
|
this._monitorControl = monitorControl;
|
|
63
65
|
this._groupControl = new FcrGroupControl(engine, scene, api, sharedCache);
|
|
64
66
|
this._interpreterControl = new FcrInterpreterControlImpl(api, scene, config, engine, chatConnection, sharedCache);
|
|
65
67
|
this._addLogObserver();
|
|
66
68
|
addBoardInitInfoObserver(this._scene, this._api, this.logger);
|
|
67
|
-
this.logger.info(
|
|
69
|
+
this.logger.info("initialized, room id: ".concat(this._scene.sceneId));
|
|
68
70
|
}
|
|
69
71
|
|
|
70
72
|
// @trace
|
|
@@ -98,7 +100,8 @@ export class FcrMainRoomControlImpl extends FcrBaseRoomControlImpl {
|
|
|
98
100
|
privilegeControl.removeObserver(this._privilegeObserver);
|
|
99
101
|
return await super.leave();
|
|
100
102
|
} finally {
|
|
101
|
-
|
|
103
|
+
var _this$_logUploadTask;
|
|
104
|
+
(_this$_logUploadTask = this._logUploadTask) === null || _this$_logUploadTask === void 0 || _this$_logUploadTask.stop();
|
|
102
105
|
this._uploadLog();
|
|
103
106
|
}
|
|
104
107
|
}
|
|
@@ -115,11 +118,14 @@ export class FcrMainRoomControlImpl extends FcrBaseRoomControlImpl {
|
|
|
115
118
|
}), ErrorModuleCode.FCR_ROOM, 'enable waiting room failed');
|
|
116
119
|
}
|
|
117
120
|
async moveToWaitingRoomByUserIds(userIds) {
|
|
118
|
-
const
|
|
121
|
+
const _await$to = await to(this._api.moveToWaitingRoomByUserIds(userIds, this._scene.sceneId)),
|
|
122
|
+
_await$to2 = _slicedToArray(_await$to, 1),
|
|
123
|
+
error = _await$to2[0];
|
|
119
124
|
if (error) {
|
|
120
|
-
this.logger.error(
|
|
125
|
+
this.logger.error("[RoomControl] move to waiting room failed, ".concat(error.message, "-").concat(JSON.stringify(error)));
|
|
121
126
|
if (error instanceof AgoraRestfulClientError) {
|
|
122
|
-
|
|
127
|
+
var _error$serviceCode;
|
|
128
|
+
throw generateFcrCoreServerError((_error$serviceCode = error.serviceCode) !== null && _error$serviceCode !== void 0 ? _error$serviceCode : -1, error.message);
|
|
123
129
|
}
|
|
124
130
|
throw generateFcrCoreClientError(ErrorModuleCode.FCR_ROOM, DetailErrorCode.UNDEFINED_ERROR, 'move to waiting room failed', error.message);
|
|
125
131
|
}
|
|
@@ -130,12 +136,12 @@ export class FcrMainRoomControlImpl extends FcrBaseRoomControlImpl {
|
|
|
130
136
|
}
|
|
131
137
|
_onLocalUserPermissionInfoDeleted(roomId, event) {
|
|
132
138
|
if (hasBoardWritePermission(event.permissionInfo)) {
|
|
133
|
-
this.logger.info(
|
|
139
|
+
this.logger.info("remove board write permission");
|
|
134
140
|
|
|
135
141
|
// this.getSharingControl().getBoardControl().getMainWindow()?.setWritable(false);
|
|
136
142
|
}
|
|
137
143
|
if (hasAnnotationWritePermission(event.permissionInfo)) {
|
|
138
|
-
this.logger.info(
|
|
144
|
+
this.logger.info("remove annotation write permission");
|
|
139
145
|
|
|
140
146
|
// this.getSharingControl().getAnnotationControl().getMainWindow()?.setWritable(false);
|
|
141
147
|
}
|
|
@@ -149,12 +155,13 @@ export class FcrMainRoomControlImpl extends FcrBaseRoomControlImpl {
|
|
|
149
155
|
const stream = streamControl.getStreamList().find(stream => stream.videoSourceType === FcrVideoSourceType.SCREEN);
|
|
150
156
|
const localUserId = userControl.getLocalUser().userId;
|
|
151
157
|
if (stream) {
|
|
158
|
+
var _userControl$getUser;
|
|
152
159
|
const ownerId = stream.owner.userId;
|
|
153
160
|
const isNotMeSharing = ownerId !== localUserId;
|
|
154
|
-
const platform = userControl.getUser(ownerId)
|
|
161
|
+
const platform = (_userControl$getUser = userControl.getUser(ownerId)) === null || _userControl$getUser === void 0 ? void 0 : _userControl$getUser.platform;
|
|
155
162
|
const isPcPlatform = platform && [FcrPlatform.WEB_DESKTOP, FcrPlatform.WINDOWS, FcrPlatform.MACOS].includes(platform);
|
|
156
163
|
const isAndroidPlatform = platform && platform === FcrPlatform.ANDROID;
|
|
157
|
-
this.logger.info(
|
|
164
|
+
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));
|
|
158
165
|
if (isPcPlatform) {
|
|
159
166
|
mainWindow.setAutoCancelDraw(false);
|
|
160
167
|
}
|
|
@@ -188,4 +195,9 @@ export class FcrMainRoomControlImpl extends FcrBaseRoomControlImpl {
|
|
|
188
195
|
// 'onNetworkStatsUpdated',
|
|
189
196
|
['onRoomMessageReceived', ['roomId', 'message']], ['onRoomPropertiesDeleted', ['roomId', 'event']], ['onRoomPropertiesUpdated', ['roomId', 'event']], ['onRoomStateUpdated', ['roomId', 'state']]]));
|
|
190
197
|
}
|
|
191
|
-
}
|
|
198
|
+
}
|
|
199
|
+
_FcrMainRoomControlImpl = FcrMainRoomControlImpl;
|
|
200
|
+
var _applyDecs$e = _applyDecs(_FcrMainRoomControlImpl, [[trace, 2, "join"], [trace, 2, "leave"], [_enableWaitingRoomDecs, 2, "enableWaitingRoom"], [_moveToWaitingRoomByUserIdsDecs, 2, "moveToWaitingRoomByUserIds"], [trace, 2, "moveToWaitingRoomByUserRoles"], [bound, 2, "_onLocalUserPermissionInfoDeleted"]], [], 0, void 0, FcrBaseRoomControlImpl).e;
|
|
201
|
+
var _applyDecs$e2 = _slicedToArray(_applyDecs$e, 1);
|
|
202
|
+
_initProto = _applyDecs$e2[0];
|
|
203
|
+
_applyDecs$e;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
1
2
|
import "core-js/modules/esnext.iterator.constructor.js";
|
|
2
3
|
import "core-js/modules/esnext.iterator.find.js";
|
|
3
4
|
import "core-js/modules/esnext.iterator.map.js";
|
|
5
|
+
import "core-js/modules/web.dom-collections.iterator.js";
|
|
4
6
|
// 初始化权限策略表达式:{module}:{action}-{k1=v1|v2;k2=v3}>{role1|role2}
|
|
5
7
|
// {module}表示模块,如房间模块room、用户模块user、发流模块stream等。
|
|
6
8
|
// {action}表示操作,如结束房间、静音、开启视频等。
|
|
@@ -25,13 +27,25 @@ export class FcrPermission {
|
|
|
25
27
|
this.targetRoles = targetRoles;
|
|
26
28
|
}
|
|
27
29
|
static fromString(permission) {
|
|
28
|
-
const
|
|
29
|
-
|
|
30
|
-
|
|
30
|
+
const _permission$split = permission.split('>'),
|
|
31
|
+
_permission$split2 = _slicedToArray(_permission$split, 2),
|
|
32
|
+
moduleActionParams = _permission$split2[0],
|
|
33
|
+
roles = _permission$split2[1];
|
|
34
|
+
const _moduleActionParams$s = moduleActionParams.split('-'),
|
|
35
|
+
_moduleActionParams$s2 = _slicedToArray(_moduleActionParams$s, 2),
|
|
36
|
+
moduleAction = _moduleActionParams$s2[0],
|
|
37
|
+
params = _moduleActionParams$s2[1];
|
|
38
|
+
const _moduleAction$split = moduleAction.split(':'),
|
|
39
|
+
_moduleAction$split2 = _slicedToArray(_moduleAction$split, 2),
|
|
40
|
+
module = _moduleAction$split2[0],
|
|
41
|
+
action = _moduleAction$split2[1];
|
|
31
42
|
const paramsObj = {};
|
|
32
43
|
if (params) {
|
|
33
44
|
for (const param of params.split(';')) {
|
|
34
|
-
const
|
|
45
|
+
const _param$split = param.split('='),
|
|
46
|
+
_param$split2 = _slicedToArray(_param$split, 2),
|
|
47
|
+
key = _param$split2[0],
|
|
48
|
+
values = _param$split2[1];
|
|
35
49
|
paramsObj[key] = values.split('|');
|
|
36
50
|
}
|
|
37
51
|
}
|
|
@@ -39,7 +53,7 @@ export class FcrPermission {
|
|
|
39
53
|
}
|
|
40
54
|
}
|
|
41
55
|
export const getLocalUserPermissionInfo = (scene, action) => {
|
|
42
|
-
const permissionStringArray = scene.getUserPropertiesByKeyPath(
|
|
56
|
+
const permissionStringArray = scene.getUserPropertiesByKeyPath("permission.list", scene.localUser.getLocalUserId());
|
|
43
57
|
const permissionString = permissionStringArray.find(permission => permission.startsWith(action));
|
|
44
58
|
if (!permissionString) {
|
|
45
59
|
return {
|
|
@@ -54,15 +68,13 @@ const convertPermissionInfo = (permission, operateType) => {
|
|
|
54
68
|
enable: false
|
|
55
69
|
};
|
|
56
70
|
}
|
|
57
|
-
const
|
|
58
|
-
|
|
59
|
-
action
|
|
60
|
-
} = permission;
|
|
71
|
+
const module = permission.module,
|
|
72
|
+
action = permission.action;
|
|
61
73
|
const permissionInfo = {
|
|
62
74
|
enable: operateType === FcrOperatePermissionType.ADD || operateType === FcrOperatePermissionType.GET ? true : false,
|
|
63
75
|
info: {
|
|
64
76
|
targetRoles: permission.targetRoles.map(role => convertStringPrivilegeRoleToFcrPrivilegeRole(role)),
|
|
65
|
-
action:
|
|
77
|
+
action: "".concat(module, ":").concat(action),
|
|
66
78
|
params: permission.conditions
|
|
67
79
|
}
|
|
68
80
|
};
|
|
@@ -71,11 +83,13 @@ const convertPermissionInfo = (permission, operateType) => {
|
|
|
71
83
|
export const addLocalUserPermissionObserver = (scene, observer, cache) => {
|
|
72
84
|
scene.addObserver({
|
|
73
85
|
onUserPropertiesUpdated: (sceneId, event) => {
|
|
74
|
-
|
|
86
|
+
var _event$cause;
|
|
87
|
+
if (((_event$cause = event.cause) === null || _event$cause === void 0 ? void 0 : _event$cause.cmd) === 3200) {
|
|
75
88
|
if (event.modifiedUser.userId === scene.localUser.getLocalUserId()) {
|
|
89
|
+
var _data$addPermissions, _data$removePermissio;
|
|
76
90
|
const data = event.cause.data;
|
|
77
|
-
const addedPermissions = data.addPermissions
|
|
78
|
-
const removedPermissions = data.removePermissions
|
|
91
|
+
const addedPermissions = (_data$addPermissions = data.addPermissions) === null || _data$addPermissions === void 0 ? void 0 : _data$addPermissions.map(p => convertPermissionInfo(FcrPermission.fromString(p), FcrOperatePermissionType.ADD));
|
|
92
|
+
const removedPermissions = (_data$removePermissio = data.removePermissions) === null || _data$removePermissio === void 0 ? void 0 : _data$removePermissio.map(p => convertPermissionInfo(FcrPermission.fromString(p), FcrOperatePermissionType.DELETE));
|
|
79
93
|
if (removedPermissions && removedPermissions.length > 0) {
|
|
80
94
|
observer.onLocalUserPermissionInfoDeleted && observer.onLocalUserPermissionInfoDeleted(sceneId, {
|
|
81
95
|
permissionInfo: removedPermissions,
|
|
@@ -1,5 +1,8 @@
|
|
|
1
|
+
import "core-js/modules/es.symbol.description.js";
|
|
2
|
+
import "core-js/modules/es.error.cause.js";
|
|
1
3
|
import "core-js/modules/es.array.push.js";
|
|
2
4
|
import "core-js/modules/esnext.function.metadata.js";
|
|
5
|
+
import "core-js/modules/esnext.iterator.filter.js";
|
|
3
6
|
import "core-js/modules/esnext.map.delete-all.js";
|
|
4
7
|
import "core-js/modules/esnext.map.emplace.js";
|
|
5
8
|
import "core-js/modules/esnext.map.every.js";
|
|
@@ -15,7 +18,13 @@ import "core-js/modules/esnext.map.reduce.js";
|
|
|
15
18
|
import "core-js/modules/esnext.map.some.js";
|
|
16
19
|
import "core-js/modules/esnext.map.update.js";
|
|
17
20
|
import "core-js/modules/esnext.symbol.metadata.js";
|
|
18
|
-
|
|
21
|
+
import "core-js/modules/web.dom-collections.iterator.js";
|
|
22
|
+
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
23
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
24
|
+
var _FcrPrivilegeControlImpl;
|
|
25
|
+
let _initProto, _allowWriteAnnotationDecs, _getSecurityInfoDecs, _getLocalUserPermissionInfoDecs, _enableLockedRoomDecs, _allowShareAndWriteDecs, _allowWriteBoardDecs, _allowWriteBoardByUserIdsDecs, _allowSendChatDecs, _allowStartAudioDecs, _allowStartVideoDecs, _allowJoinWithMutedAudioDecs, _allowJoinWithMutedVideoDecs, _allowWatermarkDecs, _allowChangeUserNameDecs, _allowStartCaptionDecs, _allowStartTranscribingDecs, _allowUpdateSttSourceLanguageDecs, _allowJoinWithPromptSoundDecs, _getRemoteUserPermissionEnableDecs, _allowViewUserCountDecs, _allowHandsUpDecs, _allowSendChatByUserRoleDecs, _allowSendChatByUserIdDecs, _ref;
|
|
26
|
+
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; }
|
|
27
|
+
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) { _defineProperty(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; }
|
|
19
28
|
import "core-js/modules/esnext.iterator.constructor.js";
|
|
20
29
|
import "core-js/modules/esnext.iterator.for-each.js";
|
|
21
30
|
import "core-js/modules/esnext.iterator.map.js";
|
|
@@ -37,16 +46,14 @@ import { FcrOperatePermissionType, FcrPrivilegeUserRoleToStringMap, FcrRemotePer
|
|
|
37
46
|
/**
|
|
38
47
|
* @internal
|
|
39
48
|
*/
|
|
49
|
+
_ref = (_allowWriteAnnotationDecs = trace(['enable', 'targetRoles']), _getSecurityInfoDecs = [trace(['action']), validateParams(fcrSecurityActionSchema)], _getLocalUserPermissionInfoDecs = [trace(['action']), validateParams(fcrPermissionActionSchema)], _enableLockedRoomDecs = [trace(['enable', 'targetRoles']), validateParams(booleanSchema, fcrPrivilegeUserRoleArraySchema)], _allowShareAndWriteDecs = [trace(['enable', 'targetRoles']), validateParams(booleanSchema, fcrPrivilegeUserRoleArraySchema)], _allowWriteBoardDecs = [trace(['enable', 'targetRoles']), validateParams(booleanSchema, fcrPrivilegeUserRoleArraySchema)], _allowWriteBoardByUserIdsDecs = [trace(['enable', 'targetUserIds']), validateParams(booleanSchema, stringArraySchema)], _allowSendChatDecs = [trace(['enable', 'targetRoles', 'payload']), validateParams(booleanSchema, fcrPrivilegeUserRoleArraySchema, fcrSecuritySendChatPayloadSchema)], _allowStartAudioDecs = [trace(['enable', 'targetRoles']), validateParams(booleanSchema, fcrPrivilegeUserRoleArraySchema)], _allowStartVideoDecs = [trace(['enable', 'targetRoles']), validateParams(booleanSchema, fcrPrivilegeUserRoleArraySchema)], _allowJoinWithMutedAudioDecs = [trace(['enable', 'targetRoles']), validateParams(booleanSchema, fcrPrivilegeUserRoleArraySchema)], _allowJoinWithMutedVideoDecs = [trace(['enable', 'targetRoles']), validateParams(booleanSchema, fcrPrivilegeUserRoleArraySchema)], _allowWatermarkDecs = [trace(['enable', 'targetRoles', 'lineType']), validateParams(booleanSchema, fcrPrivilegeUserRoleArraySchema, fcrLineTypeSchema.optional())], _allowChangeUserNameDecs = [trace(['enable', 'targetRoles']), validateParams(booleanSchema, fcrPrivilegeUserRoleArraySchema)], _allowStartCaptionDecs = [trace(['enable', 'targetRoles']), validateParams(booleanSchema, fcrPrivilegeUserRoleArraySchema)], _allowStartTranscribingDecs = [trace(['enable', 'targetRoles']), validateParams(booleanSchema, fcrPrivilegeUserRoleArraySchema)], _allowUpdateSttSourceLanguageDecs = [trace(['enable', 'targetRoles']), validateParams(booleanSchema, fcrPrivilegeUserRoleArraySchema)], _allowJoinWithPromptSoundDecs = [trace(['enable', 'targetRoles']), validateParams(booleanSchema, fcrPrivilegeUserRoleArraySchema)], _getRemoteUserPermissionEnableDecs = trace(['userId', 'type']), _allowViewUserCountDecs = trace(['enable', 'targetRoles']), _allowHandsUpDecs = trace(['enable', 'targetRoles']), _allowSendChatByUserRoleDecs = trace(['config', 'targetRoles']), _allowSendChatByUserIdDecs = trace(['enable', 'userId']), "logger");
|
|
40
50
|
export class FcrPrivilegeControlImpl {
|
|
41
|
-
static {
|
|
42
|
-
[_initProto] = _applyDecs(this, [[_allowWriteAnnotationDecs, 2, "allowWriteAnnotation"], [_getSecurityInfoDecs, 2, "getSecurityInfo"], [_getLocalUserPermissionInfoDecs, 2, "getLocalUserPermissionInfo"], [_enableLockedRoomDecs, 2, "enableLockedRoom"], [_allowShareAndWriteDecs, 2, "allowShareAndWrite"], [_allowWriteBoardDecs, 2, "allowWriteBoard"], [_allowWriteBoardByUserIdsDecs, 2, "allowWriteBoardByUserIds"], [_allowSendChatDecs, 2, "allowSendChat"], [_allowStartAudioDecs, 2, "allowStartAudio"], [_allowStartVideoDecs, 2, "allowStartVideo"], [_allowJoinWithMutedAudioDecs, 2, "allowJoinWithMutedAudio"], [_allowJoinWithMutedVideoDecs, 2, "allowJoinWithMutedVideo"], [_allowWatermarkDecs, 2, "allowWatermark"], [_allowChangeUserNameDecs, 2, "allowChangeUserName"], [_allowStartCaptionDecs, 2, "allowStartCaption"], [_allowStartTranscribingDecs, 2, "allowStartTranscribing"], [_allowUpdateSttSourceLanguageDecs, 2, "allowUpdateSttSourceLanguage"], [_allowJoinWithPromptSoundDecs, 2, "allowJoinWithPromptSound"], [_getRemoteUserPermissionEnableDecs, 2, "getRemoteUserPermissionEnable"], [_allowViewUserCountDecs, 2, "allowViewUserCount"], [_allowHandsUpDecs, 2, "allowHandsUp"], [_allowSendChatByUserRoleDecs, 2, "allowSendChatByUserRole"], [_allowSendChatByUserIdDecs, 2, "allowSendChatByUserId"], [trace, 2, "release"]], []).e;
|
|
43
|
-
}
|
|
44
|
-
//@internal
|
|
45
|
-
[(_allowWriteAnnotationDecs = trace(['enable', 'targetRoles']), _getSecurityInfoDecs = [trace(['action']), validateParams(fcrSecurityActionSchema)], _getLocalUserPermissionInfoDecs = [trace(['action']), validateParams(fcrPermissionActionSchema)], _enableLockedRoomDecs = [trace(['enable', 'targetRoles']), validateParams(booleanSchema, fcrPrivilegeUserRoleArraySchema)], _allowShareAndWriteDecs = [trace(['enable', 'targetRoles']), validateParams(booleanSchema, fcrPrivilegeUserRoleArraySchema)], _allowWriteBoardDecs = [trace(['enable', 'targetRoles']), validateParams(booleanSchema, fcrPrivilegeUserRoleArraySchema)], _allowWriteBoardByUserIdsDecs = [trace(['enable', 'targetUserIds']), validateParams(booleanSchema, stringArraySchema)], _allowSendChatDecs = [trace(['enable', 'targetRoles', 'payload']), validateParams(booleanSchema, fcrPrivilegeUserRoleArraySchema, fcrSecuritySendChatPayloadSchema)], _allowStartAudioDecs = [trace(['enable', 'targetRoles']), validateParams(booleanSchema, fcrPrivilegeUserRoleArraySchema)], _allowStartVideoDecs = [trace(['enable', 'targetRoles']), validateParams(booleanSchema, fcrPrivilegeUserRoleArraySchema)], _allowJoinWithMutedAudioDecs = [trace(['enable', 'targetRoles']), validateParams(booleanSchema, fcrPrivilegeUserRoleArraySchema)], _allowJoinWithMutedVideoDecs = [trace(['enable', 'targetRoles']), validateParams(booleanSchema, fcrPrivilegeUserRoleArraySchema)], _allowWatermarkDecs = [trace(['enable', 'targetRoles', 'lineType']), validateParams(booleanSchema, fcrPrivilegeUserRoleArraySchema, fcrLineTypeSchema.optional())], _allowChangeUserNameDecs = [trace(['enable', 'targetRoles']), validateParams(booleanSchema, fcrPrivilegeUserRoleArraySchema)], _allowStartCaptionDecs = [trace(['enable', 'targetRoles']), validateParams(booleanSchema, fcrPrivilegeUserRoleArraySchema)], _allowStartTranscribingDecs = [trace(['enable', 'targetRoles']), validateParams(booleanSchema, fcrPrivilegeUserRoleArraySchema)], _allowUpdateSttSourceLanguageDecs = [trace(['enable', 'targetRoles']), validateParams(booleanSchema, fcrPrivilegeUserRoleArraySchema)], _allowJoinWithPromptSoundDecs = [trace(['enable', 'targetRoles']), validateParams(booleanSchema, fcrPrivilegeUserRoleArraySchema)], _getRemoteUserPermissionEnableDecs = trace(['userId', 'type']), _allowViewUserCountDecs = trace(['enable', 'targetRoles']), _allowHandsUpDecs = trace(['enable', 'targetRoles']), _allowSendChatByUserRoleDecs = trace(['config', 'targetRoles']), _allowSendChatByUserIdDecs = trace(['enable', 'userId']), "logger")] = (_initProto(this), createLogger({
|
|
46
|
-
prefix: 'FcrPrivilegeControlImpl'
|
|
47
|
-
}));
|
|
48
|
-
_observable = new AgoraObservable();
|
|
49
51
|
constructor(_engine, _scene, _api, _sharedCache) {
|
|
52
|
+
//@internal
|
|
53
|
+
_defineProperty(this, _ref, (_initProto(this), createLogger({
|
|
54
|
+
prefix: 'FcrPrivilegeControlImpl'
|
|
55
|
+
})));
|
|
56
|
+
_defineProperty(this, "_observable", new AgoraObservable());
|
|
50
57
|
this._engine = _engine;
|
|
51
58
|
this._scene = _scene;
|
|
52
59
|
this._api = _api;
|
|
@@ -67,7 +74,7 @@ export class FcrPrivilegeControlImpl {
|
|
|
67
74
|
return FcrReturnCode.SUCCESS;
|
|
68
75
|
}
|
|
69
76
|
getSecurityInfo(action) {
|
|
70
|
-
const info = this._scene.getScenePropertiesByKeyPath(
|
|
77
|
+
const info = this._scene.getScenePropertiesByKeyPath("security.".concat(action));
|
|
71
78
|
return this._convertSecurityInfo(info, action);
|
|
72
79
|
}
|
|
73
80
|
// @trace
|
|
@@ -95,7 +102,7 @@ export class FcrPrivilegeControlImpl {
|
|
|
95
102
|
|
|
96
103
|
// @trace
|
|
97
104
|
getAllLocalUserPermissionInfo() {
|
|
98
|
-
const permissionStringArray = this._scene.getUserPropertiesByKeyPath(
|
|
105
|
+
const permissionStringArray = this._scene.getUserPropertiesByKeyPath("permission.list", this._scene.localUser.getLocalUserId());
|
|
99
106
|
return permissionStringArray.map(permissionString => this._convertPermissionInfo(FcrPermission.fromString(permissionString), FcrOperatePermissionType.GET));
|
|
100
107
|
}
|
|
101
108
|
async enableLockedRoom(enable, targetRoles) {
|
|
@@ -209,7 +216,7 @@ export class FcrPrivilegeControlImpl {
|
|
|
209
216
|
enable,
|
|
210
217
|
targetRoles: targetRoles.map(role => FcrPrivilegeUserRoleToStringMap[role]),
|
|
211
218
|
payload: {
|
|
212
|
-
lineType: lineType
|
|
219
|
+
lineType: lineType !== null && lineType !== void 0 ? lineType : FcrLineType.SINGLE_ROW
|
|
213
220
|
}
|
|
214
221
|
}), ErrorModuleCode.FCR_ROOM_PRIVILEGE, 'allow water mark failed');
|
|
215
222
|
return FcrReturnCode.SUCCESS;
|
|
@@ -319,18 +326,15 @@ export class FcrPrivilegeControlImpl {
|
|
|
319
326
|
enable: false
|
|
320
327
|
};
|
|
321
328
|
}
|
|
322
|
-
const
|
|
323
|
-
|
|
324
|
-
payload
|
|
325
|
-
} = security;
|
|
329
|
+
const targetRoles = security.targetRoles,
|
|
330
|
+
payload = security.payload;
|
|
326
331
|
if (action === FcrSecurityAction.Annotation) {
|
|
327
|
-
return {
|
|
332
|
+
return _objectSpread({
|
|
328
333
|
info: {
|
|
329
334
|
action: action,
|
|
330
335
|
payload
|
|
331
|
-
}
|
|
332
|
-
|
|
333
|
-
};
|
|
336
|
+
}
|
|
337
|
+
}, security);
|
|
334
338
|
}
|
|
335
339
|
return {
|
|
336
340
|
enable: !!security.enable,
|
|
@@ -347,15 +351,13 @@ export class FcrPrivilegeControlImpl {
|
|
|
347
351
|
enable: false
|
|
348
352
|
};
|
|
349
353
|
}
|
|
350
|
-
const
|
|
351
|
-
|
|
352
|
-
action
|
|
353
|
-
} = permission;
|
|
354
|
+
const module = permission.module,
|
|
355
|
+
action = permission.action;
|
|
354
356
|
const permissionInfo = {
|
|
355
357
|
enable: operateType === FcrOperatePermissionType.ADD || operateType === FcrOperatePermissionType.GET ? true : false,
|
|
356
358
|
info: {
|
|
357
359
|
targetRoles: permission.targetRoles.map(role => convertStringPrivilegeRoleToFcrPrivilegeRole(role)),
|
|
358
|
-
action:
|
|
360
|
+
action: "".concat(module, ":").concat(action),
|
|
359
361
|
params: permission.conditions
|
|
360
362
|
}
|
|
361
363
|
};
|
|
@@ -367,7 +369,7 @@ export class FcrPrivilegeControlImpl {
|
|
|
367
369
|
if ('security' in event.changedProperties) {
|
|
368
370
|
const securityChangedKeys = Object.keys(event.changedProperties.security);
|
|
369
371
|
securityChangedKeys.forEach(key => {
|
|
370
|
-
const infoObj = get(event.changedProperties,
|
|
372
|
+
const infoObj = get(event.changedProperties, "security.".concat(key));
|
|
371
373
|
this._observable.notifyObservers('onSecurityInfoUpdated', sceneId, {
|
|
372
374
|
securityInfo: this._convertSecurityInfo(infoObj, key),
|
|
373
375
|
operatorUser: checkFcrUserRole(convertRteUserToFcrUser(event.operatorUser, this._roomCache)),
|
|
@@ -377,7 +379,8 @@ export class FcrPrivilegeControlImpl {
|
|
|
377
379
|
}
|
|
378
380
|
},
|
|
379
381
|
onUserPropertiesUpdated: (sceneId, event) => {
|
|
380
|
-
|
|
382
|
+
var _event$cause;
|
|
383
|
+
if (((_event$cause = event.cause) === null || _event$cause === void 0 ? void 0 : _event$cause.cmd) === 3190) {
|
|
381
384
|
const sendChatPublic = event.changedProperties['security.sendChat.public'];
|
|
382
385
|
const sendChatPrivateHost = event.changedProperties['security.sendChat.private.host'];
|
|
383
386
|
const sendChatPrivateCoHost = event.changedProperties['security.sendChat.private.cohost'];
|
|
@@ -416,4 +419,9 @@ export class FcrPrivilegeControlImpl {
|
|
|
416
419
|
_addLogObserver() {
|
|
417
420
|
this.addObserver(generateLogObserver(this.logger, [['onSecurityInfoUpdated', ['roomId', 'event']], ['onLocalUserPermissionInfoAdded', ['roomId', 'event']], ['onLocalUserPermissionInfoDeleted', ['roomId', 'event']]]));
|
|
418
421
|
}
|
|
419
|
-
}
|
|
422
|
+
}
|
|
423
|
+
_FcrPrivilegeControlImpl = FcrPrivilegeControlImpl;
|
|
424
|
+
var _applyDecs$e = _applyDecs(_FcrPrivilegeControlImpl, [[_allowWriteAnnotationDecs, 2, "allowWriteAnnotation"], [_getSecurityInfoDecs, 2, "getSecurityInfo"], [_getLocalUserPermissionInfoDecs, 2, "getLocalUserPermissionInfo"], [_enableLockedRoomDecs, 2, "enableLockedRoom"], [_allowShareAndWriteDecs, 2, "allowShareAndWrite"], [_allowWriteBoardDecs, 2, "allowWriteBoard"], [_allowWriteBoardByUserIdsDecs, 2, "allowWriteBoardByUserIds"], [_allowSendChatDecs, 2, "allowSendChat"], [_allowStartAudioDecs, 2, "allowStartAudio"], [_allowStartVideoDecs, 2, "allowStartVideo"], [_allowJoinWithMutedAudioDecs, 2, "allowJoinWithMutedAudio"], [_allowJoinWithMutedVideoDecs, 2, "allowJoinWithMutedVideo"], [_allowWatermarkDecs, 2, "allowWatermark"], [_allowChangeUserNameDecs, 2, "allowChangeUserName"], [_allowStartCaptionDecs, 2, "allowStartCaption"], [_allowStartTranscribingDecs, 2, "allowStartTranscribing"], [_allowUpdateSttSourceLanguageDecs, 2, "allowUpdateSttSourceLanguage"], [_allowJoinWithPromptSoundDecs, 2, "allowJoinWithPromptSound"], [_getRemoteUserPermissionEnableDecs, 2, "getRemoteUserPermissionEnable"], [_allowViewUserCountDecs, 2, "allowViewUserCount"], [_allowHandsUpDecs, 2, "allowHandsUp"], [_allowSendChatByUserRoleDecs, 2, "allowSendChatByUserRole"], [_allowSendChatByUserIdDecs, 2, "allowSendChatByUserId"], [trace, 2, "release"]], []).e;
|
|
425
|
+
var _applyDecs$e2 = _slicedToArray(_applyDecs$e, 1);
|
|
426
|
+
_initProto = _applyDecs$e2[0];
|
|
427
|
+
_applyDecs$e;
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import "core-js/modules/es.symbol.description.js";
|
|
2
|
+
import "core-js/modules/es.error.cause.js";
|
|
1
3
|
import "core-js/modules/esnext.function.metadata.js";
|
|
2
4
|
import "core-js/modules/esnext.map.delete-all.js";
|
|
3
5
|
import "core-js/modules/esnext.map.emplace.js";
|
|
@@ -14,11 +16,15 @@ import "core-js/modules/esnext.map.reduce.js";
|
|
|
14
16
|
import "core-js/modules/esnext.map.some.js";
|
|
15
17
|
import "core-js/modules/esnext.map.update.js";
|
|
16
18
|
import "core-js/modules/esnext.symbol.metadata.js";
|
|
17
|
-
|
|
19
|
+
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
20
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
21
|
+
var _FcrRoomConnectorControlImpl;
|
|
22
|
+
let _initProto, _startSessionByPhoneDecs, _startSessionByIPDecs, _stopSessionDecs, _ref;
|
|
18
23
|
import "core-js/modules/es.array.push.js";
|
|
19
24
|
import "core-js/modules/esnext.iterator.constructor.js";
|
|
20
25
|
import "core-js/modules/esnext.iterator.map.js";
|
|
21
26
|
import "core-js/modules/esnext.iterator.reduce.js";
|
|
27
|
+
import "core-js/modules/web.dom-collections.iterator.js";
|
|
22
28
|
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)]; } }; }
|
|
23
29
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
24
30
|
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); }
|
|
@@ -30,25 +36,22 @@ import { createLogger, generateLogObserver } from '../../utilities/logger';
|
|
|
30
36
|
import { handleRequestError } from '../../utilities/error';
|
|
31
37
|
import validateParams from '../../utilities/validate-params';
|
|
32
38
|
import { fcrIPConnectorSessionParamsSchema, fcrPhoneConnectorSessionParamsSchema, stringSchema } from '../../schema';
|
|
33
|
-
import { FcrReturnCode } from '../../type';
|
|
34
39
|
import { ErrorModuleCode } from '../../imports';
|
|
35
40
|
|
|
36
41
|
/**
|
|
37
42
|
* @internal
|
|
38
43
|
*/
|
|
44
|
+
_ref = (_startSessionByPhoneDecs = [trace(['params']), validateParams(fcrPhoneConnectorSessionParamsSchema)], _startSessionByIPDecs = [trace(['params']), validateParams(fcrIPConnectorSessionParamsSchema)], _stopSessionDecs = [trace(['sessionId']), validateParams(stringSchema)], "logger");
|
|
39
45
|
export class FcrRoomConnectorControlImpl {
|
|
40
|
-
static {
|
|
41
|
-
[_initProto] = _applyDecs(this, [[trace, 2, "getRoomConnectorPhoneInfo"], [trace, 2, "getRoomConnectorIpInfo"], [_startSessionByPhoneDecs, 2, "startSessionByPhone"], [_startSessionByIPDecs, 2, "startSessionByIP"], [_stopSessionDecs, 2, "stopSession"], [trace, 2, "release"]], []).e;
|
|
42
|
-
}
|
|
43
|
-
//@internal
|
|
44
|
-
[(_startSessionByPhoneDecs = [trace(['params']), validateParams(fcrPhoneConnectorSessionParamsSchema)], _startSessionByIPDecs = [trace(['params']), validateParams(fcrIPConnectorSessionParamsSchema)], _stopSessionDecs = [trace(['sessionId']), validateParams(stringSchema)], "logger")] = (_initProto(this), createLogger({
|
|
45
|
-
prefix: 'FcrRoomConnectorControlImpl'
|
|
46
|
-
}));
|
|
47
|
-
_observable = new AgoraObservable();
|
|
48
|
-
_sceneObserver = {
|
|
49
|
-
onSceneMessageReceived: this._handleMessageReceived.bind(this)
|
|
50
|
-
};
|
|
51
46
|
constructor(_scene, _engine, _api) {
|
|
47
|
+
//@internal
|
|
48
|
+
_defineProperty(this, _ref, (_initProto(this), createLogger({
|
|
49
|
+
prefix: 'FcrRoomConnectorControlImpl'
|
|
50
|
+
})));
|
|
51
|
+
_defineProperty(this, "_observable", new AgoraObservable());
|
|
52
|
+
_defineProperty(this, "_sceneObserver", {
|
|
53
|
+
onSceneMessageReceived: this._handleMessageReceived.bind(this)
|
|
54
|
+
});
|
|
52
55
|
this._scene = _scene;
|
|
53
56
|
this._engine = _engine;
|
|
54
57
|
this._api = _api;
|
|
@@ -56,16 +59,16 @@ export class FcrRoomConnectorControlImpl {
|
|
|
56
59
|
this._scene.addObserver(this._sceneObserver);
|
|
57
60
|
}
|
|
58
61
|
getRoomConnectorPhoneInfo() {
|
|
62
|
+
var _ref2;
|
|
59
63
|
const mid = this._scene.getScenePropertiesByKeyPath('call.mid');
|
|
60
|
-
const callIn = this._scene.getScenePropertiesByKeyPath('call.callIn')
|
|
64
|
+
const callIn = (_ref2 = this._scene.getScenePropertiesByKeyPath('call.callIn')) !== null && _ref2 !== void 0 ? _ref2 : [];
|
|
61
65
|
const uid = this._scene.getUserPropertiesByKeyPath('call.uid', this._scene.getLocalUser().getLocalUserId());
|
|
62
66
|
const regionMap = {
|
|
63
67
|
cn: FcrRoomConnectorPhoneRegion.CN
|
|
64
68
|
};
|
|
65
|
-
return Promise.resolve(callIn.map(
|
|
66
|
-
callNumbers,
|
|
67
|
-
|
|
68
|
-
}) => {
|
|
69
|
+
return Promise.resolve(callIn.map(_ref3 => {
|
|
70
|
+
let callNumbers = _ref3.callNumbers,
|
|
71
|
+
region = _ref3.region;
|
|
69
72
|
return {
|
|
70
73
|
region: regionMap[region],
|
|
71
74
|
phoneNumberList: callNumbers,
|
|
@@ -75,12 +78,12 @@ export class FcrRoomConnectorControlImpl {
|
|
|
75
78
|
}));
|
|
76
79
|
}
|
|
77
80
|
getRoomConnectorIpInfo() {
|
|
81
|
+
var _ref4;
|
|
78
82
|
const mid = this._scene.getScenePropertiesByKeyPath('call.mid');
|
|
79
|
-
const callIn = this._scene.getScenePropertiesByKeyPath('call.callIn')
|
|
83
|
+
const callIn = (_ref4 = this._scene.getScenePropertiesByKeyPath('call.callIn')) !== null && _ref4 !== void 0 ? _ref4 : [];
|
|
80
84
|
return Promise.resolve({
|
|
81
|
-
addressList: callIn.reduce((prev, {
|
|
82
|
-
ipAddresses
|
|
83
|
-
}) => {
|
|
85
|
+
addressList: callIn.reduce((prev, _ref5) => {
|
|
86
|
+
let ipAddresses = _ref5.ipAddresses;
|
|
84
87
|
if (Array.isArray(ipAddresses)) {
|
|
85
88
|
prev.push(...ipAddresses);
|
|
86
89
|
}
|
|
@@ -94,15 +97,14 @@ export class FcrRoomConnectorControlImpl {
|
|
|
94
97
|
[FcrPhoneConnectorSessionType.PSTN]: 'pstn',
|
|
95
98
|
[FcrPhoneConnectorSessionType.VOLTE]: 'volte'
|
|
96
99
|
}[params.type];
|
|
97
|
-
const {
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
}), ErrorModuleCode.FCR_ROOM, 'start session by phone failed');
|
|
100
|
+
const _await$handleRequestE = await handleRequestError(() => this._api.callPstn({
|
|
101
|
+
roomId: this._scene.sceneId,
|
|
102
|
+
callNumber: params.phoneNumber,
|
|
103
|
+
userId: params.phoneUserId,
|
|
104
|
+
userName: params.userName,
|
|
105
|
+
callType
|
|
106
|
+
}), ErrorModuleCode.FCR_ROOM, 'start session by phone failed'),
|
|
107
|
+
data = _await$handleRequestE.data;
|
|
106
108
|
return data.data.sessionUuid;
|
|
107
109
|
}
|
|
108
110
|
async startSessionByIP(params) {
|
|
@@ -110,13 +112,12 @@ export class FcrRoomConnectorControlImpl {
|
|
|
110
112
|
[FcrIPConnectorSessionType.H323]: 'h323',
|
|
111
113
|
[FcrIPConnectorSessionType.SIP]: 'sip'
|
|
112
114
|
}[params.type];
|
|
113
|
-
const {
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
}), ErrorModuleCode.FCR_ROOM, 'start session by IP failed');
|
|
115
|
+
const _await$handleRequestE2 = await handleRequestError(() => this._api.callIp({
|
|
116
|
+
roomId: this._scene.sceneId,
|
|
117
|
+
callType,
|
|
118
|
+
ipAddress: params.address
|
|
119
|
+
}), ErrorModuleCode.FCR_ROOM, 'start session by IP failed'),
|
|
120
|
+
data = _await$handleRequestE2.data;
|
|
120
121
|
return data.data.sessionUuid;
|
|
121
122
|
}
|
|
122
123
|
async stopSession(sessionId) {
|
|
@@ -125,7 +126,6 @@ export class FcrRoomConnectorControlImpl {
|
|
|
125
126
|
callId: sessionId,
|
|
126
127
|
userId: this._scene.getLocalUser().getLocalUserId()
|
|
127
128
|
}), ErrorModuleCode.FCR_ROOM, 'stop session failed');
|
|
128
|
-
return FcrReturnCode.SUCCESS;
|
|
129
129
|
}
|
|
130
130
|
addObserver(observer) {
|
|
131
131
|
this._observable.addObserver(observer);
|
|
@@ -140,15 +140,13 @@ export class FcrRoomConnectorControlImpl {
|
|
|
140
140
|
_handleMessageReceived(sceneId, message) {
|
|
141
141
|
const cmd = message.cmd;
|
|
142
142
|
if (cmd === 2001 || cmd === 2002 || cmd === 2003) {
|
|
143
|
-
const
|
|
144
|
-
sessionUuid,
|
|
145
|
-
payload
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
}
|
|
151
|
-
} = message.payload;
|
|
143
|
+
const _ref6 = message.payload,
|
|
144
|
+
sessionUuid = _ref6.sessionUuid,
|
|
145
|
+
_ref6$payload = _ref6.payload,
|
|
146
|
+
callNumber = _ref6$payload.callNumber,
|
|
147
|
+
reason = _ref6$payload.reason,
|
|
148
|
+
callType = _ref6$payload.callType,
|
|
149
|
+
ipAddress = _ref6$payload.ipAddress;
|
|
152
150
|
const reasonMap = {
|
|
153
151
|
1: FcrRoomConnectorSessionReason.ACCEPTED,
|
|
154
152
|
2: FcrRoomConnectorSessionReason.CANCELED,
|
|
@@ -189,4 +187,9 @@ export class FcrRoomConnectorControlImpl {
|
|
|
189
187
|
_addLogObserver() {
|
|
190
188
|
this.addObserver(generateLogObserver(this.logger, [['onIPConnectorSessionStateUpdated', ['session', 'state', 'reason']], ['onPhoneConnectorSessionStateUpdated', ['session', 'state', 'reason']]]));
|
|
191
189
|
}
|
|
192
|
-
}
|
|
190
|
+
}
|
|
191
|
+
_FcrRoomConnectorControlImpl = FcrRoomConnectorControlImpl;
|
|
192
|
+
var _applyDecs$e = _applyDecs(_FcrRoomConnectorControlImpl, [[trace, 2, "getRoomConnectorPhoneInfo"], [trace, 2, "getRoomConnectorIpInfo"], [_startSessionByPhoneDecs, 2, "startSessionByPhone"], [_startSessionByIPDecs, 2, "startSessionByIP"], [_stopSessionDecs, 2, "stopSession"], [trace, 2, "release"]], []).e;
|
|
193
|
+
var _applyDecs$e2 = _slicedToArray(_applyDecs$e, 1);
|
|
194
|
+
_initProto = _applyDecs$e2[0];
|
|
195
|
+
_applyDecs$e;
|
|
@@ -39,23 +39,21 @@ export class RoomControlFactory {
|
|
|
39
39
|
* @throws {FcrError} 当房间类型不支持时抛出错误
|
|
40
40
|
*/
|
|
41
41
|
static create(params) {
|
|
42
|
-
const
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
monitorControl
|
|
51
|
-
} = params;
|
|
42
|
+
const engine = params.engine,
|
|
43
|
+
scene = params.scene,
|
|
44
|
+
apiService = params.apiService,
|
|
45
|
+
config = params.config,
|
|
46
|
+
chatConnection = params.chatConnection,
|
|
47
|
+
sharedCache = params.sharedCache,
|
|
48
|
+
roomResponse = params.roomResponse,
|
|
49
|
+
monitorControl = params.monitorControl;
|
|
52
50
|
const roomType = convertServerRoomTypeToFcrRoomType(roomResponse.room.roomProperties.roomType);
|
|
53
51
|
if (roomType === null) {
|
|
54
|
-
throw generateFcrCoreClientError(ErrorModuleCode.FCR_ROOM, DetailErrorCode.UNDEFINED_ERROR,
|
|
52
|
+
throw generateFcrCoreClientError(ErrorModuleCode.FCR_ROOM, DetailErrorCode.UNDEFINED_ERROR, "Unsupported room types: ".concat(roomResponse.room.roomProperties.roomType));
|
|
55
53
|
}
|
|
56
54
|
const RoomControlImpl = ROOM_CONTROL_IMPLEMENTATIONS[roomType];
|
|
57
55
|
if (!RoomControlImpl) {
|
|
58
|
-
throw generateFcrCoreClientError(ErrorModuleCode.FCR_ROOM, DetailErrorCode.UNDEFINED_ERROR,
|
|
56
|
+
throw generateFcrCoreClientError(ErrorModuleCode.FCR_ROOM, DetailErrorCode.UNDEFINED_ERROR, "Unsupported room types: ".concat(roomType));
|
|
59
57
|
}
|
|
60
58
|
|
|
61
59
|
// 创建聊天室控制
|