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