fcr-core 3.8.2 → 3.9.0-alpha
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/chat-connector/type.d.ts +40 -0
- package/lib/{chat-connection → chat-connector}/type.js +1 -1
- package/lib/engine/index.d.ts +10 -11
- package/lib/engine/index.js +63 -72
- package/lib/engine/type.d.ts +96 -0
- package/lib/engine/type.js +5 -0
- package/lib/imports.d.ts +7 -4
- package/lib/imports.js +30 -4
- package/lib/index.d.ts +3 -2
- package/lib/index.js +21 -2
- package/lib/media-control/desktop.js +12 -12
- package/lib/media-control/mobile.js +4 -0
- package/lib/media-control/type.d.ts +32 -33
- package/lib/monitor-control/index.js +3 -3
- package/lib/peer-session/index.js +14 -14
- package/lib/peer-session/type.d.ts +1 -1
- package/lib/plugins/chat/chatroom.js +417 -0
- package/lib/{chat-connection → plugins/chat}/config.d.ts +1 -0
- package/lib/{chat-connection → plugins/chat}/config.js +2 -1
- package/lib/plugins/chat/connector.d.ts +38 -0
- package/lib/{chat-connection/index.js → plugins/chat/connector.js} +181 -61
- package/lib/room-control/ability-control/index.js +5 -4
- package/lib/room-control/ability-control/type.d.ts +5 -1
- package/lib/room-control/ability-control/type.js +4 -0
- package/lib/room-control/chatroom-control/type.d.ts +44 -35
- package/lib/room-control/group-control/index.js +9 -9
- package/lib/room-control/index.js +37 -22
- package/lib/room-control/interpreter-control/index.js +7 -4
- package/lib/room-control/interpreter-control/room.js +3 -3
- package/lib/room-control/interpreter-control/types.d.ts +2 -2
- package/lib/room-control/join-before-host-waitingroom-control/index.js +3 -3
- package/lib/room-control/mainroom-control/index.js +15 -13
- package/lib/room-control/privilege-control/index.js +39 -24
- package/lib/room-control/privilege-control/type.d.ts +15 -15
- package/lib/room-control/room-connector-control/index.js +7 -5
- package/lib/room-control/room-connector-control/type.d.ts +1 -1
- package/lib/room-control/room-control-factory.d.ts +3 -3
- package/lib/room-control/room-control-factory.js +7 -7
- package/lib/room-control/room-session/index.js +17 -15
- package/lib/room-control/room-session/type.d.ts +3 -3
- package/lib/room-control/sharing-control/index.js +13 -7
- package/lib/room-control/stream-control/index.js +18 -16
- package/lib/room-control/stream-control/type.d.ts +5 -5
- package/lib/room-control/stt-control/index.js +38 -31
- package/lib/room-control/type.d.ts +19 -19
- package/lib/room-control/user-control/index.js +20 -22
- package/lib/room-control/user-control/type.d.ts +1 -1
- package/lib/room-control/waitingroom-control/index.js +11 -11
- package/lib/room-control/whiteboard-control-v1/board-window.d.ts +21 -20
- package/lib/room-control/whiteboard-control-v1/board-window.js +27 -8
- package/lib/room-control/whiteboard-control-v1/factory.js +1 -1
- package/lib/room-control/whiteboard-control-v1/index.js +26 -18
- package/lib/room-control/whiteboard-control-v1/type.d.ts +26 -25
- package/lib/room-control/whiteboard-control-v1/type.js +1 -0
- package/lib/room-control/whiteboard-control-v2/annotation-control/control.d.ts +15 -6
- package/lib/room-control/whiteboard-control-v2/annotation-control/control.js +39 -5
- package/lib/room-control/whiteboard-control-v2/annotation-control/factory.d.ts +4 -5
- package/lib/room-control/whiteboard-control-v2/annotation-control/factory.js +6 -5
- package/lib/room-control/whiteboard-control-v2/annotation-control/type.d.ts +7 -1
- package/lib/room-control/whiteboard-control-v2/base/index.d.ts +9 -8
- package/lib/room-control/whiteboard-control-v2/base/index.js +84 -42
- package/lib/room-control/whiteboard-control-v2/base/main-window.d.ts +16 -15
- package/lib/room-control/whiteboard-control-v2/base/main-window.js +23 -4
- package/lib/room-control/whiteboard-control-v2/type.d.ts +17 -17
- package/lib/room-control/whiteboard-control-v2/whiteboard-control/control.d.ts +12 -6
- package/lib/room-control/whiteboard-control-v2/whiteboard-control/control.js +64 -18
- package/lib/room-control/whiteboard-control-v2/whiteboard-control/factory.d.ts +2 -2
- package/lib/room-control/whiteboard-control-v2/whiteboard-control/factory.js +10 -10
- package/lib/room-control/whiteboard-control-v2/whiteboard-control/type.d.ts +1 -1
- package/lib/room-router/index.js +10 -7
- package/lib/room-router/type.d.ts +1 -1
- package/lib/schema.d.ts +24 -46
- package/lib/schema.js +1 -2
- package/lib/service/api.d.ts +5 -3
- package/lib/service/api.js +17 -12
- package/lib/type.d.ts +64 -45
- package/lib/type.js +76 -11
- package/lib/utilities/abortable-retry.d.ts +38 -0
- package/lib/utilities/abortable-retry.js +61 -0
- package/lib/utilities/dual-video-stream-config.d.ts +6 -0
- package/lib/utilities/dual-video-stream-config.js +25 -0
- package/lib/utilities/error-helpers.d.ts +10 -9
- package/lib/utilities/error-helpers.js +12 -11
- package/lib/utilities/error.d.ts +4 -40
- package/lib/utilities/error.js +20 -77
- package/lib/utilities/join-helper.js +2 -2
- package/lib/utilities/logger.d.ts +2 -2
- package/lib/utilities/logger.js +6 -25
- package/lib/utilities/package-info.d.ts +1 -2
- package/lib/utilities/package-info.js +4 -8
- package/lib/utilities/parameters.js +88 -15
- package/lib/utilities/validate-params.js +1 -1
- package/lib/utilities/video-encoder-config.d.ts +9 -0
- package/lib/utilities/video-encoder-config.js +109 -0
- package/lib-es/{chat-connection → chat-connector}/type.js +1 -1
- package/lib-es/engine/index.js +46 -56
- package/lib-es/engine/type.js +1 -0
- package/lib-es/imports.js +5 -3
- package/lib-es/index.js +2 -1
- package/lib-es/media-control/desktop.js +12 -12
- package/lib-es/media-control/mobile.js +4 -0
- package/lib-es/monitor-control/index.js +3 -3
- package/lib-es/peer-session/index.js +16 -15
- package/lib-es/plugins/chat/chatroom.js +409 -0
- package/lib-es/{chat-connection → plugins/chat}/config.js +2 -1
- package/lib-es/{chat-connection/index.js → plugins/chat/connector.js} +178 -58
- package/lib-es/room-control/ability-control/index.js +5 -4
- package/lib-es/room-control/ability-control/type.js +4 -0
- package/lib-es/room-control/group-control/index.js +11 -10
- package/lib-es/room-control/index.js +40 -26
- package/lib-es/room-control/interpreter-control/index.js +10 -5
- package/lib-es/room-control/interpreter-control/room.js +3 -3
- package/lib-es/room-control/join-before-host-waitingroom-control/index.js +4 -3
- package/lib-es/room-control/mainroom-control/index.js +16 -17
- package/lib-es/room-control/privilege-control/index.js +43 -29
- package/lib-es/room-control/room-connector-control/index.js +9 -6
- package/lib-es/room-control/room-control-factory.js +6 -6
- package/lib-es/room-control/room-session/index.js +21 -22
- package/lib-es/room-control/sharing-control/index.js +13 -7
- package/lib-es/room-control/stream-control/index.js +21 -18
- package/lib-es/room-control/stt-control/index.js +23 -15
- package/lib-es/room-control/user-control/index.js +23 -23
- package/lib-es/room-control/waitingroom-control/index.js +10 -9
- package/lib-es/room-control/whiteboard-control-v1/board-window.js +27 -8
- package/lib-es/room-control/whiteboard-control-v1/factory.js +1 -1
- package/lib-es/room-control/whiteboard-control-v1/index.js +26 -17
- package/lib-es/room-control/whiteboard-control-v1/type.js +1 -0
- package/lib-es/room-control/whiteboard-control-v2/annotation-control/control.js +39 -5
- package/lib-es/room-control/whiteboard-control-v2/annotation-control/factory.js +7 -6
- package/lib-es/room-control/whiteboard-control-v2/base/index.js +86 -42
- package/lib-es/room-control/whiteboard-control-v2/base/main-window.js +23 -4
- package/lib-es/room-control/whiteboard-control-v2/whiteboard-control/control.js +60 -13
- package/lib-es/room-control/whiteboard-control-v2/whiteboard-control/factory.js +10 -10
- package/lib-es/room-router/index.js +10 -6
- package/lib-es/schema.js +1 -2
- package/lib-es/service/api.js +17 -12
- package/lib-es/type.js +70 -18
- package/lib-es/utilities/abortable-retry.js +54 -0
- package/lib-es/utilities/dual-video-stream-config.js +19 -0
- package/lib-es/utilities/error-helpers.js +13 -12
- package/lib-es/utilities/error.js +9 -75
- package/lib-es/utilities/join-helper.js +4 -3
- package/lib-es/utilities/logger.js +7 -23
- package/lib-es/utilities/package-info.js +4 -6
- package/lib-es/utilities/parameters.js +88 -15
- package/lib-es/utilities/validate-params.js +3 -2
- package/lib-es/utilities/video-encoder-config.js +103 -0
- package/package.json +7 -7
- package/lib/chat-connection/index.d.ts +0 -24
- package/lib/chat-connection/type.d.ts +0 -17
- package/lib/plugins/chatroom.js +0 -454
- package/lib/room-control/chatroom-control/config.d.ts +0 -51
- package/lib/room-control/chatroom-control/config.js +0 -105
- package/lib/utilities/storage.d.ts +0 -8
- package/lib/utilities/storage.js +0 -33
- package/lib-es/plugins/chatroom.js +0 -446
- package/lib-es/room-control/chatroom-control/config.js +0 -100
- package/lib-es/utilities/storage.js +0 -27
- /package/lib/plugins/{chatroom.d.ts → chat/chatroom.d.ts} +0 -0
|
@@ -26,11 +26,14 @@ function _checkInRHS(e) { if (Object(e) !== e) throw TypeError("right-hand side
|
|
|
26
26
|
import { AgoraObservable, get, trace } from '../../imports';
|
|
27
27
|
import { FcrInterpreterRoomControlImpl } from './room';
|
|
28
28
|
import { FcrInterpreterActionType } from './types';
|
|
29
|
+
import { FcrReturnCode } from '../../type';
|
|
29
30
|
import { convertRteUserToFcrUser } from '../../utilities/user';
|
|
30
31
|
import { createLogger, generateLogObserver } from '../../utilities/logger';
|
|
31
|
-
import {
|
|
32
|
+
import { handleRequestError } from '../../utilities/error';
|
|
32
33
|
import validateParams from '../../utilities/validate-params';
|
|
33
34
|
import { fcrInterpreterUsersParamsArraySchema, stringSchema } from '../../schema';
|
|
35
|
+
import { ErrorModuleCode } from '../../imports';
|
|
36
|
+
|
|
34
37
|
/**
|
|
35
38
|
* @internal
|
|
36
39
|
*/
|
|
@@ -39,7 +42,7 @@ export class FcrInterpreterControlImpl {
|
|
|
39
42
|
[_initProto] = _applyDecs(this, [[_createRoomControlDecs, 2, "createRoomControl"], [_setInterpreterUsersDecs, 2, "setInterpreterUsers"], [trace, 2, "close"], [trace, 2, "getState"], [trace, 2, "getInterpreterRoomList"], [trace, 2, "getInterpreterLanguageList"]], []).e;
|
|
40
43
|
}
|
|
41
44
|
//@internal
|
|
42
|
-
[(_createRoomControlDecs = [trace, validateParams(stringSchema)], _setInterpreterUsersDecs = [trace, validateParams(fcrInterpreterUsersParamsArraySchema)], "logger")] = (_initProto(this), createLogger({
|
|
45
|
+
[(_createRoomControlDecs = [trace(['roomId']), validateParams(stringSchema)], _setInterpreterUsersDecs = [trace(['params']), validateParams(fcrInterpreterUsersParamsArraySchema)], "logger")] = (_initProto(this), createLogger({
|
|
43
46
|
prefix: 'FcrInterpreterControlImpl'
|
|
44
47
|
}));
|
|
45
48
|
_observable = new AgoraObservable();
|
|
@@ -76,12 +79,14 @@ export class FcrInterpreterControlImpl {
|
|
|
76
79
|
};
|
|
77
80
|
})
|
|
78
81
|
}
|
|
79
|
-
}),
|
|
82
|
+
}), ErrorModuleCode.FCR_ROOM_INTERPRETER, 'set interpreterUsers failed');
|
|
83
|
+
return FcrReturnCode.SUCCESS;
|
|
80
84
|
}
|
|
81
85
|
async close() {
|
|
82
86
|
await handleRequestError(() => this._api.closeInterpreter({
|
|
83
87
|
roomId: this._roomId
|
|
84
|
-
}),
|
|
88
|
+
}), ErrorModuleCode.FCR_ROOM_INTERPRETER, 'close interpreter failed');
|
|
89
|
+
return FcrReturnCode.SUCCESS;
|
|
85
90
|
}
|
|
86
91
|
getState() {
|
|
87
92
|
const enable = this._scene.getScenePropertiesByKeyPath('interpreter.enable');
|
|
@@ -162,6 +167,6 @@ export class FcrInterpreterControlImpl {
|
|
|
162
167
|
});
|
|
163
168
|
}
|
|
164
169
|
_addLogObserver() {
|
|
165
|
-
this.addObserver(generateLogObserver(this.logger, ['onInterpreterStateUpdated', 'onInterpreterUsersUpdated', 'onInterpreterRoomListUpdated']));
|
|
170
|
+
this.addObserver(generateLogObserver(this.logger, [['onInterpreterStateUpdated', ['roomId', 'state', 'operatorUser']], ['onInterpreterUsersUpdated', ['roomId', 'users', 'operatorUser']], ['onInterpreterRoomListUpdated', ['roomId', 'rooms', 'operatorUser']]]));
|
|
166
171
|
}
|
|
167
172
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { FcrBaseRoomControlImpl } from '..';
|
|
2
|
-
import { FcrRoomType } from '../type';
|
|
3
2
|
import { createLogger, generateLogObserver } from '../../utilities/logger';
|
|
3
|
+
import { FcrRoomType } from '../type';
|
|
4
4
|
/**
|
|
5
5
|
* @internal
|
|
6
6
|
*/
|
|
@@ -20,9 +20,9 @@ export class FcrInterpreterRoomControlImpl extends FcrBaseRoomControlImpl {
|
|
|
20
20
|
this._addLogObserver();
|
|
21
21
|
}
|
|
22
22
|
_addLogObserver() {
|
|
23
|
-
this.addObserver(generateLogObserver(this.logger, ['onCloudRecordingStateUpdated', 'onJoinRoomFailure', 'onJoinRoomSuccess', 'onLiveStreamingStateUpdated',
|
|
23
|
+
this.addObserver(generateLogObserver(this.logger, [['onCloudRecordingStateUpdated', ['roomId', 'state']], ['onJoinRoomFailure', ['roomId', 'error']], ['onJoinRoomSuccess', ['roomId']], ['onLiveStreamingStateUpdated', ['roomId', 'state', 'url', 'reason']],
|
|
24
24
|
// 'onNetworkQualityUpdated',
|
|
25
25
|
// 'onNetworkStatsUpdated',
|
|
26
|
-
'onRoomMessageReceived', 'onRoomPropertiesDeleted', 'onRoomPropertiesUpdated', 'onRoomStateUpdated']));
|
|
26
|
+
['onRoomMessageReceived', ['roomId', 'message']], ['onRoomPropertiesDeleted', ['roomId', 'event']], ['onRoomPropertiesUpdated', ['roomId', 'event']], ['onRoomStateUpdated', ['roomId', 'state']]]));
|
|
27
27
|
}
|
|
28
28
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { FcrBaseRoomControlImpl } from '..';
|
|
2
|
-
import { FcrRoomType } from '../type';
|
|
3
2
|
import { createLogger, generateLogObserver } from '../../utilities/logger';
|
|
3
|
+
import { FcrRoomType } from '../type';
|
|
4
|
+
|
|
4
5
|
/**
|
|
5
6
|
* @internal
|
|
6
7
|
*/
|
|
@@ -20,9 +21,9 @@ export class FcrJoinBeforeHostWaitingRoomControlImpl extends FcrBaseRoomControlI
|
|
|
20
21
|
super.removeObserver(observer);
|
|
21
22
|
}
|
|
22
23
|
_addLogObserver() {
|
|
23
|
-
this.addObserver(generateLogObserver(this.logger, ['onCloudRecordingStateUpdated', 'onJoinRoomFailure', 'onJoinRoomSuccess', 'onLiveStreamingStateUpdated',
|
|
24
|
+
this.addObserver(generateLogObserver(this.logger, [['onCloudRecordingStateUpdated', ['roomId', 'state']], ['onJoinRoomFailure', ['roomId', 'error']], ['onJoinRoomSuccess', ['roomId']], ['onLiveStreamingStateUpdated', ['roomId', 'state', 'url', 'reason']],
|
|
24
25
|
// 'onNetworkQualityUpdated',
|
|
25
26
|
// 'onNetworkStatsUpdated',
|
|
26
|
-
'onRoomMessageReceived', 'onRoomPropertiesDeleted', 'onRoomPropertiesUpdated', 'onRoomStateUpdated']));
|
|
27
|
+
['onRoomMessageReceived', ['roomId', 'message']], ['onRoomPropertiesDeleted', ['roomId', 'event']], ['onRoomPropertiesUpdated', ['roomId', 'event']], ['onRoomStateUpdated', ['roomId', 'state']]]));
|
|
27
28
|
}
|
|
28
29
|
}
|
|
@@ -24,20 +24,17 @@ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol"
|
|
|
24
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); }
|
|
25
25
|
function _setFunctionName(e, t, n) { "symbol" == typeof t && (t = (t = t.description) ? "[" + t + "]" : ""); try { Object.defineProperty(e, "name", { configurable: !0, value: n ? n + " " + t : t }); } catch (e) {} return e; }
|
|
26
26
|
function _checkInRHS(e) { if (Object(e) !== e) throw TypeError("right-hand side of 'in' should be an object, got " + (null !== e ? typeof e : "null")); return e; }
|
|
27
|
-
import { AgoraScheduler, bound, get, jsonstring, trace } from '../../imports';
|
|
28
27
|
import { FcrBaseRoomControlImpl } from '..';
|
|
29
|
-
import {
|
|
30
|
-
import { FcrPlatform, FcrUserRole, FcrVideoSourceType } from '../../type';
|
|
31
|
-
import { FcrRoomType } from '../type';
|
|
32
|
-
import { FcrUserRoleToStringMap } from '../../type';
|
|
33
|
-
import { to } from '../../imports';
|
|
34
|
-
import { AgoraRestfulClientError } from '../../imports';
|
|
35
|
-
import { FcrErrorCode, FcrErrorModuleCode, generateFcrCoreClientError, generateFcrCoreServerError, handleRequestError } from '../../utilities/error';
|
|
36
|
-
import { FcrInterpreterControlImpl } from '../interpreter-control';
|
|
28
|
+
import { AgoraRestfulClientError, AgoraScheduler, bound, DetailErrorCode, ErrorModuleCode, get, jsonstring, to, trace } from '../../imports';
|
|
37
29
|
import { booleanSchema, stringArraySchema } from '../../schema';
|
|
30
|
+
import { FcrPlatform, FcrReturnCode, FcrUserRole, FcrUserRoleToStringMap, FcrVideoSourceType } from '../../type';
|
|
31
|
+
import { generateFcrCoreClientError, generateFcrCoreServerError, handleRequestError } from '../../utilities/error';
|
|
38
32
|
import { createLogger, generateLogObserver } from '../../utilities/logger';
|
|
39
|
-
import validateParams from '../../utilities/validate-params';
|
|
40
33
|
import { clearAnnotationBoardOptions, clearWhiteboardOptions, setAnnotationBoardOptions, setWhiteboardOptions } from '../../utilities/shared-storage';
|
|
34
|
+
import validateParams from '../../utilities/validate-params';
|
|
35
|
+
import { FcrGroupControl } from '../group-control';
|
|
36
|
+
import { FcrInterpreterControlImpl } from '../interpreter-control';
|
|
37
|
+
import { FcrRoomType } from '../type';
|
|
41
38
|
import { getAnnotationConfigFromRoomProperties } from '../whiteboard-control-v2/utils';
|
|
42
39
|
import { hasAnnotationWritePermission, hasBoardWritePermission } from '../whiteboard-control/utils';
|
|
43
40
|
const {
|
|
@@ -52,7 +49,7 @@ export class FcrMainRoomControlImpl extends FcrBaseRoomControlImpl {
|
|
|
52
49
|
[_initProto] = _applyDecs(this, [[trace, 2, "join"], [trace, 2, "leave"], [_enableWaitingRoomDecs, 2, "enableWaitingRoom"], [_moveToWaitingRoomByUserIdsDecs, 2, "moveToWaitingRoomByUserIds"], [trace, 2, "moveToWaitingRoomByUserRoles"], [bound, 2, "_onLocalUserPermissionInfoAdded"], [bound, 2, "_onLocalUserPermissionInfoDeleted"]], [], 0, void 0, FcrBaseRoomControlImpl).e;
|
|
53
50
|
}
|
|
54
51
|
//@internal
|
|
55
|
-
[(_enableWaitingRoomDecs = [trace, validateParams(booleanSchema)], _moveToWaitingRoomByUserIdsDecs = [trace, validateParams(stringArraySchema)], "logger")] = (_initProto(this), createLogger({
|
|
52
|
+
[(_enableWaitingRoomDecs = [trace(['enable']), validateParams(booleanSchema)], _moveToWaitingRoomByUserIdsDecs = [trace(['userIds']), validateParams(stringArraySchema)], "logger")] = (_initProto(this), createLogger({
|
|
56
53
|
prefix: 'FcrMainRoomControlImpl'
|
|
57
54
|
}));
|
|
58
55
|
_privilegeObserver = {
|
|
@@ -109,6 +106,7 @@ export class FcrMainRoomControlImpl extends FcrBaseRoomControlImpl {
|
|
|
109
106
|
});
|
|
110
107
|
}, Duration.minute(5), false);
|
|
111
108
|
this._logUploadTask = task;
|
|
109
|
+
return FcrReturnCode.SUCCESS;
|
|
112
110
|
} finally {
|
|
113
111
|
this._engine.getMonitor().uploadLog({
|
|
114
112
|
userUuid: this._config.userId,
|
|
@@ -139,7 +137,7 @@ export class FcrMainRoomControlImpl extends FcrBaseRoomControlImpl {
|
|
|
139
137
|
return handleRequestError(() => this._api.enableWaitingRoom({
|
|
140
138
|
enable,
|
|
141
139
|
roomId: this._scene.sceneId
|
|
142
|
-
}),
|
|
140
|
+
}), ErrorModuleCode.FCR_ROOM, 'enable waiting room failed');
|
|
143
141
|
}
|
|
144
142
|
async moveToWaitingRoomByUserIds(userIds) {
|
|
145
143
|
const [error] = await to(this._api.moveToWaitingRoomByUserIds(userIds, this._scene.sceneId));
|
|
@@ -148,8 +146,9 @@ export class FcrMainRoomControlImpl extends FcrBaseRoomControlImpl {
|
|
|
148
146
|
if (error instanceof AgoraRestfulClientError) {
|
|
149
147
|
throw generateFcrCoreServerError(error.serviceCode ?? -1, error.message, error);
|
|
150
148
|
}
|
|
151
|
-
throw generateFcrCoreClientError(
|
|
149
|
+
throw generateFcrCoreClientError(ErrorModuleCode.FCR_ROOM, DetailErrorCode.UNDEFINED_ERROR, 'move to waiting room failed', error);
|
|
152
150
|
}
|
|
151
|
+
return FcrReturnCode.SUCCESS;
|
|
153
152
|
}
|
|
154
153
|
async moveToWaitingRoomByUserRoles() {
|
|
155
154
|
return this._api.moveToWaitingRoomByUserRoles([FcrUserRoleToStringMap[FcrUserRole.PARTICIPANT]], this._scene.sceneId);
|
|
@@ -180,13 +179,13 @@ export class FcrMainRoomControlImpl extends FcrBaseRoomControlImpl {
|
|
|
180
179
|
return await handleRequestError(() => this._api.getAnnotationToken({
|
|
181
180
|
roomId,
|
|
182
181
|
userId
|
|
183
|
-
}),
|
|
182
|
+
}), ErrorModuleCode.FCR_ROOM_WHITEBOARD, 'get whiteboard token failed');
|
|
184
183
|
}
|
|
185
184
|
async _getBoardToken(roomId, userId) {
|
|
186
185
|
return await handleRequestError(() => this._api.getWhiteboardToken({
|
|
187
186
|
roomId,
|
|
188
187
|
userId
|
|
189
|
-
}),
|
|
188
|
+
}), ErrorModuleCode.FCR_ROOM_WHITEBOARD, 'get whiteboard token failed');
|
|
190
189
|
}
|
|
191
190
|
_onLocalUserPermissionInfoAdded(roomId, event) {
|
|
192
191
|
if (hasBoardWritePermission(event.permissionInfo)) {
|
|
@@ -241,9 +240,9 @@ export class FcrMainRoomControlImpl extends FcrBaseRoomControlImpl {
|
|
|
241
240
|
}
|
|
242
241
|
}
|
|
243
242
|
_addLogObserver() {
|
|
244
|
-
this.addObserver(generateLogObserver(this.logger, ['onCloudRecordingStateUpdated', 'onJoinRoomFailure', 'onJoinRoomSuccess', 'onLiveStreamingStateUpdated',
|
|
243
|
+
this.addObserver(generateLogObserver(this.logger, [['onCloudRecordingStateUpdated', ['roomId', 'state']], ['onJoinRoomFailure', ['roomId', 'error']], ['onJoinRoomSuccess', ['roomId']], ['onLiveStreamingStateUpdated', ['roomId', 'state', 'url', 'reason']],
|
|
245
244
|
// 'onNetworkQualityUpdated',
|
|
246
245
|
// 'onNetworkStatsUpdated',
|
|
247
|
-
'onRoomMessageReceived', 'onRoomPropertiesDeleted', 'onRoomPropertiesUpdated', 'onRoomStateUpdated']));
|
|
246
|
+
['onRoomMessageReceived', ['roomId', 'message']], ['onRoomPropertiesDeleted', ['roomId', 'event']], ['onRoomPropertiesUpdated', ['roomId', 'event']], ['onRoomStateUpdated', ['roomId', 'state']]]));
|
|
248
247
|
}
|
|
249
248
|
}
|
|
@@ -15,7 +15,7 @@ import "core-js/modules/esnext.map.reduce.js";
|
|
|
15
15
|
import "core-js/modules/esnext.map.some.js";
|
|
16
16
|
import "core-js/modules/esnext.map.update.js";
|
|
17
17
|
import "core-js/modules/esnext.symbol.metadata.js";
|
|
18
|
-
let _initProto, _getSecurityInfoDecs, _getLocalUserPermissionInfoDecs, _enableLockedRoomDecs, _allowShareAndWriteDecs, _allowWriteBoardDecs, _allowWriteBoardByUserIdsDecs, _allowSendChatDecs, _allowStartAudioDecs, _allowStartVideoDecs, _allowJoinWithMutedAudioDecs, _allowJoinWithMutedVideoDecs, _allowWatermarkDecs, _allowChangeUserNameDecs, _allowStartCaptionDecs, _allowStartTranscribingDecs, _allowUpdateSttSourceLanguageDecs, _allowJoinWithPromptSoundDecs;
|
|
18
|
+
let _initProto, _allowWriteAnnotationDecs, _getSecurityInfoDecs, _getLocalUserPermissionInfoDecs, _enableLockedRoomDecs, _allowShareAndWriteDecs, _allowWriteBoardDecs, _allowWriteBoardByUserIdsDecs, _allowSendChatDecs, _allowStartAudioDecs, _allowStartVideoDecs, _allowJoinWithMutedAudioDecs, _allowJoinWithMutedVideoDecs, _allowWatermarkDecs, _allowChangeUserNameDecs, _allowStartCaptionDecs, _allowStartTranscribingDecs, _allowUpdateSttSourceLanguageDecs, _allowJoinWithPromptSoundDecs;
|
|
19
19
|
import "core-js/modules/esnext.iterator.constructor.js";
|
|
20
20
|
import "core-js/modules/esnext.iterator.for-each.js";
|
|
21
21
|
import "core-js/modules/esnext.iterator.map.js";
|
|
@@ -24,26 +24,25 @@ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol"
|
|
|
24
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); }
|
|
25
25
|
function _setFunctionName(e, t, n) { "symbol" == typeof t && (t = (t = t.description) ? "[" + t + "]" : ""); try { Object.defineProperty(e, "name", { configurable: !0, value: n ? n + " " + t : t }); } catch (e) {} return e; }
|
|
26
26
|
function _checkInRHS(e) { if (Object(e) !== e) throw TypeError("right-hand side of 'in' should be an object, got " + (null !== e ? typeof e : "null")); return e; }
|
|
27
|
-
import {
|
|
28
|
-
import {
|
|
29
|
-
import {
|
|
30
|
-
import {
|
|
31
|
-
import {
|
|
32
|
-
import { addLocalUserPermissionObserver, FcrPermission, getLocalUserPermissionInfo } from './helper';
|
|
33
|
-
import { FcrSecurityAction, FcrPrivilegeUserRoleToStringMap, FcrOperatePermissionType } from './type';
|
|
27
|
+
import { ErrorModuleCode } from '../../imports';
|
|
28
|
+
import { AgoraObservable, get, trace } from '../../imports';
|
|
29
|
+
import { booleanSchema, fcrLineTypeSchema, fcrPermissionActionSchema, fcrPrivilegeUserRoleArraySchema, fcrSecurityActionSchema, fcrSecuritySendChatPayloadSchema, stringArraySchema } from '../../schema';
|
|
30
|
+
import { FcrLineType, FcrReturnCode } from '../../type';
|
|
31
|
+
import { handleRequestError } from '../../utilities/error';
|
|
34
32
|
import { createLogger, generateLogObserver } from '../../utilities/logger';
|
|
35
|
-
import {
|
|
33
|
+
import { checkFcrUserRole, convertRteUserToFcrUser, convertStringPrivilegeRoleToFcrPrivilegeRole } from '../../utilities/user';
|
|
36
34
|
import validateParams from '../../utilities/validate-params';
|
|
37
|
-
import {
|
|
35
|
+
import { FcrPermission, addLocalUserPermissionObserver, getLocalUserPermissionInfo } from './helper';
|
|
36
|
+
import { FcrOperatePermissionType, FcrPrivilegeUserRoleToStringMap, FcrSecurityAction } from './type';
|
|
38
37
|
/**
|
|
39
38
|
* @internal
|
|
40
39
|
*/
|
|
41
40
|
export class FcrPrivilegeControlImpl {
|
|
42
41
|
static {
|
|
43
|
-
[_initProto] = _applyDecs(this, [[
|
|
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"]], []).e;
|
|
44
43
|
}
|
|
45
44
|
//@internal
|
|
46
|
-
[(_getSecurityInfoDecs = [trace, validateParams(fcrSecurityActionSchema)], _getLocalUserPermissionInfoDecs = [trace, validateParams(fcrPermissionActionSchema)], _enableLockedRoomDecs = [trace, validateParams(booleanSchema, fcrPrivilegeUserRoleArraySchema)], _allowShareAndWriteDecs = [trace, validateParams(booleanSchema, fcrPrivilegeUserRoleArraySchema)], _allowWriteBoardDecs = [trace, validateParams(booleanSchema, fcrPrivilegeUserRoleArraySchema)], _allowWriteBoardByUserIdsDecs = [trace, validateParams(booleanSchema, stringArraySchema)], _allowSendChatDecs = [trace, validateParams(booleanSchema, fcrPrivilegeUserRoleArraySchema, fcrSecuritySendChatPayloadSchema)], _allowStartAudioDecs = [trace, validateParams(booleanSchema, fcrPrivilegeUserRoleArraySchema)], _allowStartVideoDecs = [trace, validateParams(booleanSchema, fcrPrivilegeUserRoleArraySchema)], _allowJoinWithMutedAudioDecs = [trace, validateParams(booleanSchema, fcrPrivilegeUserRoleArraySchema)], _allowJoinWithMutedVideoDecs = [trace, validateParams(booleanSchema, fcrPrivilegeUserRoleArraySchema)], _allowWatermarkDecs = [trace, validateParams(booleanSchema, fcrPrivilegeUserRoleArraySchema, fcrLineTypeSchema.optional())], _allowChangeUserNameDecs = [trace, validateParams(booleanSchema, fcrPrivilegeUserRoleArraySchema)], _allowStartCaptionDecs = [trace, validateParams(booleanSchema, fcrPrivilegeUserRoleArraySchema)], _allowStartTranscribingDecs = [trace, validateParams(booleanSchema, fcrPrivilegeUserRoleArraySchema)], _allowUpdateSttSourceLanguageDecs = [trace, validateParams(booleanSchema, fcrPrivilegeUserRoleArraySchema)], _allowJoinWithPromptSoundDecs = [trace, validateParams(booleanSchema, fcrPrivilegeUserRoleArraySchema)], "logger")] = (_initProto(this), createLogger({
|
|
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)], "logger")] = (_initProto(this), createLogger({
|
|
47
46
|
prefix: 'FcrPrivilegeControlImpl'
|
|
48
47
|
}));
|
|
49
48
|
_observable = new AgoraObservable();
|
|
@@ -64,7 +63,8 @@ export class FcrPrivilegeControlImpl {
|
|
|
64
63
|
payload: {
|
|
65
64
|
write: enable ? 1 : 0
|
|
66
65
|
}
|
|
67
|
-
}),
|
|
66
|
+
}), ErrorModuleCode.FCR_ROOM_WHITEBOARD, 'allow annotation failed');
|
|
67
|
+
return FcrReturnCode.SUCCESS;
|
|
68
68
|
}
|
|
69
69
|
getSecurityInfo(action) {
|
|
70
70
|
const info = this._scene.getScenePropertiesByKeyPath(`security.${action}`);
|
|
@@ -103,7 +103,7 @@ export class FcrPrivilegeControlImpl {
|
|
|
103
103
|
enable,
|
|
104
104
|
roomId: this._scene.sceneId,
|
|
105
105
|
targetRoles
|
|
106
|
-
}),
|
|
106
|
+
}), ErrorModuleCode.FCR_ROOM_PRIVILEGE, 'enable locked room failed');
|
|
107
107
|
}
|
|
108
108
|
async allowShareAndWrite(enable, targetRoles) {
|
|
109
109
|
await handleRequestError(() => this._api.toggleShareEnable({
|
|
@@ -119,7 +119,8 @@ export class FcrPrivilegeControlImpl {
|
|
|
119
119
|
start: enable ? 1 : 0
|
|
120
120
|
}
|
|
121
121
|
}
|
|
122
|
-
}),
|
|
122
|
+
}), ErrorModuleCode.FCR_ROOM_PRIVILEGE, 'allow share failed');
|
|
123
|
+
return FcrReturnCode.SUCCESS;
|
|
123
124
|
}
|
|
124
125
|
async allowWriteBoard(enable, targetRoles) {
|
|
125
126
|
await handleRequestError(() => this._api.toggleShareEnable({
|
|
@@ -135,7 +136,8 @@ export class FcrPrivilegeControlImpl {
|
|
|
135
136
|
write: enable ? 1 : 0
|
|
136
137
|
}
|
|
137
138
|
}
|
|
138
|
-
}),
|
|
139
|
+
}), ErrorModuleCode.FCR_ROOM_PRIVILEGE, 'allow write board failed');
|
|
140
|
+
return FcrReturnCode.SUCCESS;
|
|
139
141
|
}
|
|
140
142
|
async allowWriteBoardByUserIds(enable, targetUserIds) {
|
|
141
143
|
await handleRequestError(() => this._api.toggleShareEnableByUserIds({
|
|
@@ -147,7 +149,8 @@ export class FcrPrivilegeControlImpl {
|
|
|
147
149
|
write: enable ? 1 : 0
|
|
148
150
|
}
|
|
149
151
|
}
|
|
150
|
-
}),
|
|
152
|
+
}), ErrorModuleCode.FCR_ROOM_PRIVILEGE, 'allow write board by user ids failed');
|
|
153
|
+
return FcrReturnCode.SUCCESS;
|
|
151
154
|
}
|
|
152
155
|
async allowSendChat(enable, targetRoles, payload) {
|
|
153
156
|
await handleRequestError(() => this._api.allowSendChat({
|
|
@@ -155,35 +158,40 @@ export class FcrPrivilegeControlImpl {
|
|
|
155
158
|
targetRoles: targetRoles.map(role => FcrPrivilegeUserRoleToStringMap[role]),
|
|
156
159
|
roomId: this._scene.sceneId,
|
|
157
160
|
payload
|
|
158
|
-
}),
|
|
161
|
+
}), ErrorModuleCode.FCR_ROOM_PRIVILEGE, 'allow send chat failed');
|
|
162
|
+
return FcrReturnCode.SUCCESS;
|
|
159
163
|
}
|
|
160
164
|
async allowStartAudio(enable, targetRoles) {
|
|
161
165
|
await handleRequestError(() => this._api.allowStartAudio({
|
|
162
166
|
enable,
|
|
163
167
|
targetRoles: targetRoles.map(role => FcrPrivilegeUserRoleToStringMap[role]),
|
|
164
168
|
roomId: this._scene.sceneId
|
|
165
|
-
}),
|
|
169
|
+
}), ErrorModuleCode.FCR_ROOM_PRIVILEGE, 'allow start audio failed');
|
|
170
|
+
return FcrReturnCode.SUCCESS;
|
|
166
171
|
}
|
|
167
172
|
async allowStartVideo(enable, targetRoles) {
|
|
168
173
|
await handleRequestError(() => this._api.allowStartVideo({
|
|
169
174
|
enable,
|
|
170
175
|
targetRoles: targetRoles.map(role => FcrPrivilegeUserRoleToStringMap[role]),
|
|
171
176
|
roomId: this._scene.sceneId
|
|
172
|
-
}),
|
|
177
|
+
}), ErrorModuleCode.FCR_ROOM_PRIVILEGE, 'allow start video failed');
|
|
178
|
+
return FcrReturnCode.SUCCESS;
|
|
173
179
|
}
|
|
174
180
|
async allowJoinWithMutedAudio(enable, targetRoles) {
|
|
175
181
|
await handleRequestError(() => this._api.allowJoinWithMuteAudio({
|
|
176
182
|
enable,
|
|
177
183
|
targetRoles: targetRoles.map(role => FcrPrivilegeUserRoleToStringMap[role]),
|
|
178
184
|
roomId: this._scene.sceneId
|
|
179
|
-
}),
|
|
185
|
+
}), ErrorModuleCode.FCR_ROOM_PRIVILEGE, 'allow join with mute audio failed');
|
|
186
|
+
return FcrReturnCode.SUCCESS;
|
|
180
187
|
}
|
|
181
188
|
async allowJoinWithMutedVideo(enable, targetRoles) {
|
|
182
189
|
await handleRequestError(() => this._api.allowJoinWithMutedVideo({
|
|
183
190
|
enable,
|
|
184
191
|
targetRoles: targetRoles.map(role => FcrPrivilegeUserRoleToStringMap[role]),
|
|
185
192
|
roomId: this._scene.sceneId
|
|
186
|
-
}),
|
|
193
|
+
}), ErrorModuleCode.FCR_ROOM_PRIVILEGE, 'allow join with mute audio failed');
|
|
194
|
+
return FcrReturnCode.SUCCESS;
|
|
187
195
|
}
|
|
188
196
|
|
|
189
197
|
/* async allowChangeName(enable: boolean, targetRoles: FcrPrivilegeUserRole[]) {
|
|
@@ -203,42 +211,48 @@ export class FcrPrivilegeControlImpl {
|
|
|
203
211
|
payload: {
|
|
204
212
|
lineType: lineType ?? FcrLineType.SINGLE_ROW
|
|
205
213
|
}
|
|
206
|
-
}),
|
|
214
|
+
}), ErrorModuleCode.FCR_ROOM_PRIVILEGE, 'allow water mark failed');
|
|
215
|
+
return FcrReturnCode.SUCCESS;
|
|
207
216
|
}
|
|
208
217
|
async allowChangeUserName(enable, targetRoles) {
|
|
209
218
|
await handleRequestError(() => this._api.allowChangeUserName({
|
|
210
219
|
roomId: this._scene.sceneId,
|
|
211
220
|
enable,
|
|
212
221
|
targetRoles: targetRoles.map(role => FcrPrivilegeUserRoleToStringMap[role])
|
|
213
|
-
}),
|
|
222
|
+
}), ErrorModuleCode.FCR_ROOM_PRIVILEGE, 'allow change user name failed');
|
|
223
|
+
return FcrReturnCode.SUCCESS;
|
|
214
224
|
}
|
|
215
225
|
async allowStartCaption(enable, targetRoles) {
|
|
216
226
|
await handleRequestError(() => this._api.allowStartCaption({
|
|
217
227
|
roomUuid: this._scene.sceneId,
|
|
218
228
|
enable,
|
|
219
229
|
targetRoles: targetRoles.map(role => FcrPrivilegeUserRoleToStringMap[role])
|
|
220
|
-
}),
|
|
230
|
+
}), ErrorModuleCode.FCR_ROOM_STT, 'allow start caption failed');
|
|
231
|
+
return FcrReturnCode.SUCCESS;
|
|
221
232
|
}
|
|
222
233
|
async allowStartTranscribing(enable, targetRoles) {
|
|
223
234
|
await handleRequestError(() => this._api.allowStartTranscribing({
|
|
224
235
|
roomUuid: this._scene.sceneId,
|
|
225
236
|
enable,
|
|
226
237
|
targetRoles: targetRoles.map(role => FcrPrivilegeUserRoleToStringMap[role])
|
|
227
|
-
}),
|
|
238
|
+
}), ErrorModuleCode.FCR_ROOM_STT, 'allow start transcribing failed');
|
|
239
|
+
return FcrReturnCode.SUCCESS;
|
|
228
240
|
}
|
|
229
241
|
async allowUpdateSttSourceLanguage(enable, targetRoles) {
|
|
230
242
|
await handleRequestError(() => this._api.allowUpdateSttSourceLanguage({
|
|
231
243
|
roomUuid: this._scene.sceneId,
|
|
232
244
|
enable,
|
|
233
245
|
targetRoles: targetRoles.map(role => FcrPrivilegeUserRoleToStringMap[role])
|
|
234
|
-
}),
|
|
246
|
+
}), ErrorModuleCode.FCR_ROOM_STT, 'allow update stt source language failed');
|
|
247
|
+
return FcrReturnCode.SUCCESS;
|
|
235
248
|
}
|
|
236
249
|
async allowJoinWithPromptSound(enable, targetRoles) {
|
|
237
250
|
await handleRequestError(() => this._api.allowJoinWithPromptSound({
|
|
238
251
|
roomId: this._scene.sceneId,
|
|
239
252
|
enable,
|
|
240
253
|
targetRoles: targetRoles.map(role => FcrPrivilegeUserRoleToStringMap[role])
|
|
241
|
-
}),
|
|
254
|
+
}), ErrorModuleCode.FCR_ROOM_PRIVILEGE, 'allow join with prompt sound failed');
|
|
255
|
+
return FcrReturnCode.SUCCESS;
|
|
242
256
|
}
|
|
243
257
|
addObserver(observer) {
|
|
244
258
|
this._observable.addObserver(observer);
|
|
@@ -320,6 +334,6 @@ export class FcrPrivilegeControlImpl {
|
|
|
320
334
|
}, this._roomCache);
|
|
321
335
|
}
|
|
322
336
|
_addLogObserver() {
|
|
323
|
-
this.addObserver(generateLogObserver(this.logger, ['onSecurityInfoUpdated', 'onLocalUserPermissionInfoAdded', 'onLocalUserPermissionInfoDeleted']));
|
|
337
|
+
this.addObserver(generateLogObserver(this.logger, [['onSecurityInfoUpdated', ['roomId', 'event']], ['onLocalUserPermissionInfoAdded', ['roomId', 'event']], ['onLocalUserPermissionInfoDeleted', ['roomId', 'event']]]));
|
|
324
338
|
}
|
|
325
339
|
}
|
|
@@ -27,9 +27,11 @@ function _checkInRHS(e) { if (Object(e) !== e) throw TypeError("right-hand side
|
|
|
27
27
|
import { FcrIPConnectorSessionType, FcrRoomConnectorPhoneRegion, FcrRoomConnectorSessionReason, FcrRoomConnectorSessionState } from './type';
|
|
28
28
|
import { AgoraObservable, trace } from '../../imports';
|
|
29
29
|
import { createLogger, generateLogObserver } from '../../utilities/logger';
|
|
30
|
-
import {
|
|
30
|
+
import { handleRequestError } from '../../utilities/error';
|
|
31
31
|
import validateParams from '../../utilities/validate-params';
|
|
32
32
|
import { fcrIPConnectorSessionParamsSchema, fcrPhoneConnectorSessionParamsSchema, stringSchema } from '../../schema';
|
|
33
|
+
import { FcrReturnCode } from '../../type';
|
|
34
|
+
import { ErrorModuleCode } from '../../imports';
|
|
33
35
|
|
|
34
36
|
/**
|
|
35
37
|
* @internal
|
|
@@ -39,7 +41,7 @@ export class FcrRoomConnectorControlImpl {
|
|
|
39
41
|
[_initProto] = _applyDecs(this, [[trace, 2, "getRoomConnectorPhoneInfo"], [trace, 2, "getRoomConnectorIpInfo"], [_startSessionByPhoneDecs, 2, "startSessionByPhone"], [_startSessionByIPDecs, 2, "startSessionByIP"], [_stopSessionDecs, 2, "stopSession"]], []).e;
|
|
40
42
|
}
|
|
41
43
|
//@internal
|
|
42
|
-
[(_startSessionByPhoneDecs = [trace, validateParams(fcrPhoneConnectorSessionParamsSchema)], _startSessionByIPDecs = [trace, validateParams(fcrIPConnectorSessionParamsSchema)], _stopSessionDecs = [trace, validateParams(stringSchema)], "logger")] = (_initProto(this), createLogger({
|
|
44
|
+
[(_startSessionByPhoneDecs = [trace(['params']), validateParams(fcrPhoneConnectorSessionParamsSchema)], _startSessionByIPDecs = [trace(['params']), validateParams(fcrIPConnectorSessionParamsSchema)], _stopSessionDecs = [trace(['sessionId']), validateParams(stringSchema)], "logger")] = (_initProto(this), createLogger({
|
|
43
45
|
prefix: 'FcrRoomConnectorControlImpl'
|
|
44
46
|
}));
|
|
45
47
|
_observable = new AgoraObservable();
|
|
@@ -94,7 +96,7 @@ export class FcrRoomConnectorControlImpl {
|
|
|
94
96
|
callNumber: params.phoneNumber,
|
|
95
97
|
userId: params.phoneUserId,
|
|
96
98
|
userName: params.userName
|
|
97
|
-
}),
|
|
99
|
+
}), ErrorModuleCode.FCR_ROOM, 'start session by phone failed');
|
|
98
100
|
return data.data.sessionUuid;
|
|
99
101
|
}
|
|
100
102
|
async startSessionByIP(params) {
|
|
@@ -108,7 +110,7 @@ export class FcrRoomConnectorControlImpl {
|
|
|
108
110
|
roomId: this._scene.sceneId,
|
|
109
111
|
callType,
|
|
110
112
|
ipAddress: params.address
|
|
111
|
-
}),
|
|
113
|
+
}), ErrorModuleCode.FCR_ROOM, 'start session by IP failed');
|
|
112
114
|
return data.data.sessionUuid;
|
|
113
115
|
}
|
|
114
116
|
async stopSession(sessionId) {
|
|
@@ -116,7 +118,8 @@ export class FcrRoomConnectorControlImpl {
|
|
|
116
118
|
roomId: this._scene.sceneId,
|
|
117
119
|
callId: sessionId,
|
|
118
120
|
userId: this._scene.getLocalUser().getLocalUserId()
|
|
119
|
-
}),
|
|
121
|
+
}), ErrorModuleCode.FCR_ROOM, 'stop session failed');
|
|
122
|
+
return FcrReturnCode.SUCCESS;
|
|
120
123
|
}
|
|
121
124
|
addObserver(observer) {
|
|
122
125
|
this._observable.addObserver(observer);
|
|
@@ -174,6 +177,6 @@ export class FcrRoomConnectorControlImpl {
|
|
|
174
177
|
}
|
|
175
178
|
}
|
|
176
179
|
_addLogObserver() {
|
|
177
|
-
this.addObserver(generateLogObserver(this.logger, ['onIPConnectorSessionStateUpdated', 'onPhoneConnectorSessionStateUpdated']));
|
|
180
|
+
this.addObserver(generateLogObserver(this.logger, [['onIPConnectorSessionStateUpdated', ['session', 'state', 'reason']], ['onPhoneConnectorSessionStateUpdated', ['session', 'state', 'reason']]]));
|
|
178
181
|
}
|
|
179
182
|
}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import "core-js/modules/esnext.iterator.constructor.js";
|
|
2
2
|
import "core-js/modules/esnext.iterator.map.js";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
3
|
+
import { DetailErrorCode, ErrorModuleCode, FcrChatRoomControlImpl } from '../imports';
|
|
4
|
+
import { generateFcrCoreClientError } from '../utilities/error';
|
|
5
|
+
import { FcrInterpreterRoomControlImpl } from './interpreter-control/room';
|
|
5
6
|
import { FcrJoinBeforeHostWaitingRoomControlImpl } from './join-before-host-waitingroom-control';
|
|
6
7
|
import { FcrMainRoomControlImpl } from './mainroom-control';
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import { FcrErrorCode, FcrErrorModuleCode, generateFcrCoreClientError } from '../utilities/error';
|
|
8
|
+
import { FcrRoomType } from './type';
|
|
9
|
+
import { FcrWaitingRoomControlImpl } from './waitingroom-control';
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
12
|
* 房间控制的创建参数
|
|
@@ -48,7 +48,7 @@ export class RoomControlFactory {
|
|
|
48
48
|
const roomType = roomResponse.room.roomProperties.roomType;
|
|
49
49
|
const RoomControlImpl = ROOM_CONTROL_IMPLEMENTATIONS[roomType];
|
|
50
50
|
if (!RoomControlImpl) {
|
|
51
|
-
throw generateFcrCoreClientError(
|
|
51
|
+
throw generateFcrCoreClientError(ErrorModuleCode.FCR_ROOM, DetailErrorCode.UNDEFINED_ERROR, `Unsupported room types: ${roomType}`, new Error(`Unsupported room type: ${roomType}`));
|
|
52
52
|
}
|
|
53
53
|
|
|
54
54
|
// 创建聊天室控制
|
|
@@ -24,16 +24,13 @@ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol"
|
|
|
24
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); }
|
|
25
25
|
function _setFunctionName(e, t, n) { "symbol" == typeof t && (t = (t = t.description) ? "[" + t + "]" : ""); try { Object.defineProperty(e, "name", { configurable: !0, value: n ? n + " " + t : t }); } catch (e) {} return e; }
|
|
26
26
|
function _checkInRHS(e) { if (Object(e) !== e) throw TypeError("right-hand side of 'in' should be an object, got " + (null !== e ? typeof e : "null")); return e; }
|
|
27
|
-
import {
|
|
28
|
-
import { ActionWhenTaskFail, AgoraScheduler } from '../../imports';
|
|
29
|
-
import {
|
|
30
|
-
import {
|
|
31
|
-
import {
|
|
32
|
-
import { FcrPrivilegeUserRoleToStringMap } from '../../type';
|
|
33
|
-
import { FcrErrorCode, generateFcrCoreServerError } from '../../utilities/error';
|
|
27
|
+
import { DetailErrorCode } from '../../imports';
|
|
28
|
+
import { ActionWhenTaskFail, AgoraObservable, AgoraScheduler, Duration, md5, trace } from '../../imports';
|
|
29
|
+
import { fcrPrivilegeUserRoleArraySchema, fcrRoomSessionParamsSchema, fcrSessionBaseSchema, stringKeyUnknownValueSchema, stringSchema } from '../../schema';
|
|
30
|
+
import { FcrPrivilegeUserRoleToStringMap, FcrReturnCode } from '../../type';
|
|
31
|
+
import { generateFcrCoreServerError } from '../../utilities/error';
|
|
34
32
|
import { createLogger, generateLogObserver } from '../../utilities/logger';
|
|
35
33
|
import validateParams from '../../utilities/validate-params';
|
|
36
|
-
import { fcrRoomSessionParamsSchema, fcrSessionBaseSchema, stringSchema, stringKeyUnknownValueSchema, fcrPrivilegeUserRoleArraySchema } from '../../schema';
|
|
37
34
|
import { ROOM_MESSAGE_COMMANDS } from '../helpers';
|
|
38
35
|
/**
|
|
39
36
|
* @internal
|
|
@@ -43,7 +40,7 @@ export class FcrRoomSessionControlImpl {
|
|
|
43
40
|
[_initProto] = _applyDecs(this, [[_startRoomSessionDecs, 2, "startRoomSession"], [_stopRoomSessionDecs, 2, "stopRoomSession"], [_acceptRoomSessionDecs, 2, "acceptRoomSession"], [_rejectRoomSessionDecs, 2, "rejectRoomSession"]], []).e;
|
|
44
41
|
}
|
|
45
42
|
//@internal
|
|
46
|
-
[(_startRoomSessionDecs = [trace, validateParams(fcrRoomSessionParamsSchema, fcrPrivilegeUserRoleArraySchema.optional())], _stopRoomSessionDecs = [trace, validateParams(stringSchema)], _acceptRoomSessionDecs = [trace, validateParams(fcrSessionBaseSchema, stringKeyUnknownValueSchema.optional())], _rejectRoomSessionDecs = [trace, validateParams(fcrSessionBaseSchema, stringKeyUnknownValueSchema.optional())], "logger")] = (_initProto(this), createLogger({
|
|
43
|
+
[(_startRoomSessionDecs = [trace(['params', 'targetRoles']), validateParams(fcrRoomSessionParamsSchema, fcrPrivilegeUserRoleArraySchema.optional())], _stopRoomSessionDecs = [trace(['sessionId']), validateParams(stringSchema)], _acceptRoomSessionDecs = [trace(['session', 'cause']), validateParams(fcrSessionBaseSchema, stringKeyUnknownValueSchema.optional())], _rejectRoomSessionDecs = [trace(['session', 'cause']), validateParams(fcrSessionBaseSchema, stringKeyUnknownValueSchema.optional())], "logger")] = (_initProto(this), createLogger({
|
|
47
44
|
prefix: 'FcrRoomSessionControlImpl'
|
|
48
45
|
}));
|
|
49
46
|
//@internal
|
|
@@ -100,18 +97,18 @@ export class FcrRoomSessionControlImpl {
|
|
|
100
97
|
this.logger.info(`[RoomSession] put into session schedule: ${session.sessionId}, next ts: ${nextTs}, remain: ${nextTs - Date.now()}ms`);
|
|
101
98
|
return session.sessionId;
|
|
102
99
|
} catch (e) {
|
|
103
|
-
throw generateFcrCoreServerError(
|
|
100
|
+
throw generateFcrCoreServerError(DetailErrorCode.LOCAL_HTTP_REQUEST_FAILED, 'start room session failed', e);
|
|
104
101
|
}
|
|
105
102
|
}
|
|
106
103
|
stopRoomSession(sessionId) {
|
|
107
|
-
this._scheduleMap.delete(sessionId);
|
|
104
|
+
return this._scheduleMap.delete(sessionId);
|
|
108
105
|
}
|
|
109
106
|
async acceptRoomSession(session, cause) {
|
|
110
107
|
if (this._isSessionExpired(session)) {
|
|
111
|
-
throw generateFcrCoreServerError(
|
|
108
|
+
throw generateFcrCoreServerError(DetailErrorCode.EXPIRED, 'accept room session failed: session expired', new Error());
|
|
112
109
|
}
|
|
113
110
|
try {
|
|
114
|
-
this._api.deleteRoomSession({
|
|
111
|
+
await this._api.deleteRoomSession({
|
|
115
112
|
userId: this._userId,
|
|
116
113
|
sessionId: session.sessionId,
|
|
117
114
|
sessionKey: session.sessionKey,
|
|
@@ -122,16 +119,17 @@ export class FcrRoomSessionControlImpl {
|
|
|
122
119
|
cause
|
|
123
120
|
}
|
|
124
121
|
});
|
|
122
|
+
return FcrReturnCode.SUCCESS;
|
|
125
123
|
} catch (e) {
|
|
126
|
-
throw generateFcrCoreServerError(
|
|
124
|
+
throw generateFcrCoreServerError(DetailErrorCode.LOCAL_HTTP_REQUEST_FAILED, 'accept room session failed', e);
|
|
127
125
|
}
|
|
128
126
|
}
|
|
129
127
|
async rejectRoomSession(session, cause) {
|
|
130
128
|
if (this._isSessionExpired(session)) {
|
|
131
|
-
throw generateFcrCoreServerError(
|
|
129
|
+
throw generateFcrCoreServerError(DetailErrorCode.EXPIRED, 'reject room session failed: session expired', new Error());
|
|
132
130
|
}
|
|
133
131
|
try {
|
|
134
|
-
this._api.deleteRoomSession({
|
|
132
|
+
await this._api.deleteRoomSession({
|
|
135
133
|
userId: this._userId,
|
|
136
134
|
sessionId: session.sessionId,
|
|
137
135
|
sessionKey: session.sessionKey,
|
|
@@ -142,8 +140,9 @@ export class FcrRoomSessionControlImpl {
|
|
|
142
140
|
cause
|
|
143
141
|
}
|
|
144
142
|
});
|
|
143
|
+
return FcrReturnCode.SUCCESS;
|
|
145
144
|
} catch (e) {
|
|
146
|
-
throw generateFcrCoreServerError(
|
|
145
|
+
throw generateFcrCoreServerError(DetailErrorCode.LOCAL_HTTP_REQUEST_FAILED, 'reject room session failed', e);
|
|
147
146
|
}
|
|
148
147
|
}
|
|
149
148
|
addObserver(observer) {
|
|
@@ -169,13 +168,13 @@ export class FcrRoomSessionControlImpl {
|
|
|
169
168
|
interval: 0
|
|
170
169
|
};
|
|
171
170
|
if (this._isSessionExpired(session)) {
|
|
172
|
-
this.logger.info(`
|
|
171
|
+
this.logger.info(`room session expired, removed: ${session.sessionId}`);
|
|
173
172
|
this._scheduleMap.delete(session.sessionId);
|
|
174
173
|
continue;
|
|
175
174
|
}
|
|
176
175
|
// check timeout
|
|
177
176
|
if (params.nextTs < Date.now()) {
|
|
178
|
-
this.logger.info(`
|
|
177
|
+
this.logger.info(`ping session: ${session.sessionId}`);
|
|
179
178
|
try {
|
|
180
179
|
const {
|
|
181
180
|
data: {
|
|
@@ -199,7 +198,7 @@ export class FcrRoomSessionControlImpl {
|
|
|
199
198
|
this.logger.info(`[RoomSession] refresh session schedule: ${session.sessionId}, next ts: ${nextTs}`);
|
|
200
199
|
}
|
|
201
200
|
} catch (e) {
|
|
202
|
-
this.logger.error(`
|
|
201
|
+
this.logger.error(`ping session failed: ${e}`);
|
|
203
202
|
}
|
|
204
203
|
}
|
|
205
204
|
}
|
|
@@ -208,7 +207,7 @@ export class FcrRoomSessionControlImpl {
|
|
|
208
207
|
const session = this._receivedMap.get(key);
|
|
209
208
|
if (this._isSessionExpired(session)) {
|
|
210
209
|
this._receivedMap.delete(key);
|
|
211
|
-
this.logger.info(`
|
|
210
|
+
this.logger.info(`delete session callback: ${key}`);
|
|
212
211
|
}
|
|
213
212
|
}
|
|
214
213
|
}
|
|
@@ -288,6 +287,6 @@ export class FcrRoomSessionControlImpl {
|
|
|
288
287
|
return session.timestamp + session.duration * Duration.second(1) < Date.now();
|
|
289
288
|
}
|
|
290
289
|
_addLogObserver() {
|
|
291
|
-
this.addObserver(generateLogObserver(this.logger, ['onRoomSessionAccepted', 'onRoomSessionRejected', 'onRoomSessionReceived']));
|
|
290
|
+
this.addObserver(generateLogObserver(this.logger, [['onRoomSessionAccepted', ['roomId', 'response']], ['onRoomSessionRejected', ['roomId', 'response']], ['onRoomSessionReceived', ['roomId', 'session']]]));
|
|
292
291
|
}
|
|
293
292
|
}
|