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
package/lib/type.d.ts
CHANGED
|
@@ -1,55 +1,42 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { FcrSharePermissionState } from './room-control/sharing-control/type';
|
|
3
|
-
import { FcrUserRole } from './room-control/user-control/type';
|
|
1
|
+
import { AgoraRtcDeviceInfo, AgoraRtcDisplayInfo, AgoraRtcNetworkStats, AgoraRtcWindowInfo, AgoraRteConnectionState, AgoraRteMessage, AgoraRteNetworkQualityEvent, AgoraRteOperatCause, AgoraRtePerformanceInfo, AgoraRteRenderView, AgoraRteScenePropertiesDeletedEvent, AgoraRteScenePropertiesUpdatedEvent, AgoraRteStreamEncryptionConfig, AgoraRteStreamJoinConfig, AgoraRteUploadEvent, FcrWhiteboardView } from './imports';
|
|
4
2
|
import type { FcrAudioSourceType, FcrMediaSourceState, FcrRegion, FcrRoomConnectorType, FcrStreamType, FcrVideoSourceType } from '.';
|
|
3
|
+
import { FcrSharePermissionState } from './room-control/sharing-control/type';
|
|
5
4
|
import { FcrLineType, FcrRoomJoinOptions, FcrRoomType } from './room-control/type';
|
|
6
|
-
import {
|
|
5
|
+
import { FcrUserRole } from './room-control/user-control/type';
|
|
7
6
|
import { FcrRoomRoute } from './room-router/type';
|
|
7
|
+
import { FcrGroupCreateConfigSchema, FcrGroupUpdateOptionsSchema, FcrRenderConfigSchema, FcrRoomJoinOptionsWithTicketSchema, FcrSessionBaseSchema } from './schema';
|
|
8
8
|
export type { FcrBaseRoomControl, FcrRoomObserver } from './room-control/type';
|
|
9
|
-
export type {
|
|
10
|
-
export
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
token: string;
|
|
15
|
-
/** 用户唯一标识 */
|
|
16
|
-
userId: string;
|
|
17
|
-
/** 服务区域 */
|
|
18
|
-
region: FcrRegion;
|
|
19
|
-
/** 双摄像头视频流配置 */
|
|
20
|
-
dualCameraVideoStreamConfig: AgoraRteDualVideoStreamConfig;
|
|
21
|
-
/** 双屏幕视频流配置 */
|
|
22
|
-
dualScreenVideoStreamConfig: AgoraRteDualVideoStreamConfig;
|
|
23
|
-
/** 额外参数配置 */
|
|
24
|
-
parameters?: Record<string, unknown>;
|
|
25
|
-
};
|
|
26
|
-
export { AgoraRteRegion as FcrRegion, AgoraRteMediaStreamType as FcrStreamType, AgoraRteUserUpdatedReason as FcrUserUpdatedReason, AgoraRteRoomConnectorType as FcrRoomConnectorType, AgoraRtcVideoSourceType as FcrVideoSourceType, AgoraRtcAudioSourceType as FcrAudioSourceType, AgoraRtcMediaSourceState as FcrMediaSourceState, AgoraRtcRenderMode as FcrVideoRenderMode, AgoraRtcVideoStreamType as FcrVideoStreamType, AgoraRtcCapability as FcrCapability, AgoraRtcAiDenoiseLevel as FcrAiDenoiseLevel, AgoraRteStreamPrivilegeOperation as FcrStreamPrivilegeOperation, AgoraRteStreamPrivilegeVideoSourceType as FcrStreamPrivilegeVideoSourceType, AgoraRteStreamPrivilegeAudioSourceType as FcrStreamPrivilegeAudioSourceType, AgoraRteConnectionState as FcrConnectionState, AgoraRteLatencyLevel as FcrStreamLatencyLevel, AgoraRteScreenCaptureType as FcrScreenCaptureType, AgoraRteVideoOrientation as FcrVideoOrientation, FcrCoreEngine, registerPlugin, } from './imports';
|
|
27
|
-
export type FcrDualVideoStreamConfig = AgoraRteDualVideoStreamConfig;
|
|
9
|
+
export type { FcrChatConnector, FcrChatConnectionObserver, FcrChatConnectionState, } from './chat-connector/type';
|
|
10
|
+
export { AgoraRtcAiDenoiseLevel as FcrAiDenoiseLevel, AgoraRtcAudioSourceType as FcrAudioSourceType, AgoraRtcCapability as FcrCapability, AgoraRteConnectionState as FcrConnectionState, AgoraRtcMediaSourceState as FcrMediaSourceState, AgoraRteRegion as FcrRegion, AgoraRteRoomConnectorType as FcrRoomConnectorType, AgoraRteScreenCaptureType as FcrScreenCaptureType, AgoraRteLatencyLevel as FcrStreamLatencyLevel, AgoraRteStreamPrivilegeAudioSourceType as FcrStreamPrivilegeAudioSourceType, AgoraRteStreamPrivilegeOperation as FcrStreamPrivilegeOperation, AgoraRteStreamPrivilegeVideoSourceType as FcrStreamPrivilegeVideoSourceType, AgoraRteMediaStreamType as FcrStreamType, AgoraRteUserUpdatedReason as FcrUserUpdatedReason, AgoraRteVideoOrientation as FcrVideoOrientation, AgoraRtcRenderMode as FcrVideoRenderMode, AgoraRtcVideoSourceType as FcrVideoSourceType, AgoraRtcVideoStreamType as FcrVideoStreamType, registerPlugin, } from './imports';
|
|
11
|
+
import { FcrDualVideoStreamConfig } from './utilities/dual-video-stream-config';
|
|
12
|
+
import { FcrVideoEncoderConfig } from './utilities/video-encoder-config';
|
|
13
|
+
export { FcrDualVideoStreamConfig };
|
|
28
14
|
export type FcrMessage = AgoraRteMessage;
|
|
29
15
|
export type FcrRenderView = AgoraRteRenderView;
|
|
30
|
-
export type { FcrAudioOutputRouting,
|
|
16
|
+
export type { FcrAudioOutputRouting, FcrDesktopMediaControl, FcrDesktopMediaObserver, FcrMobileMediaControl, FcrMobileMediaObserver, } from './media-control/type';
|
|
31
17
|
export type { FcrMonitorControl, FcrMonitorObserver } from './monitor-control/type';
|
|
32
18
|
export type { FcrPeerSessionControl, FcrPeerSessionObserver } from './peer-session/type';
|
|
33
|
-
export type { FcrAbilityControl } from './room-control/ability-control/type';
|
|
34
19
|
export { FcrAbility } from './room-control/ability-control/type';
|
|
35
|
-
export type {
|
|
20
|
+
export type { FcrAbilityControl } from './room-control/ability-control/type';
|
|
36
21
|
export { FcrChatRoomConnectionState, FcrChatRoomMessageType, } from './room-control/chatroom-control/type';
|
|
37
|
-
export type {
|
|
38
|
-
export {
|
|
39
|
-
export type {
|
|
40
|
-
export {
|
|
41
|
-
export
|
|
42
|
-
export { FcrIPConnectorSessionType, FcrRoomConnectorSessionReason, FcrRoomConnectorSessionState,
|
|
43
|
-
export type {
|
|
44
|
-
export type {
|
|
22
|
+
export type { FcrChatRoomControl, FcrChatRoomControlInitConfig, FcrChatRoomFile, FcrChatRoomObserver, FcrChatRoomReceiveCustomMessage, FcrChatRoomReceivedBaseMessage, FcrChatRoomReceivedImageMessage, FcrChatRoomReceivedTextMessage, FcrChatRoomSendBaseMessage, FcrChatRoomSendImageMessage, FcrChatRoomSendTextMessage, } from './room-control/chatroom-control/type';
|
|
23
|
+
export { FcrInterpreterActionType, FcrLanguage } from './room-control/interpreter-control/types';
|
|
24
|
+
export type { FcrInterpreterObserver, FcrInterpreterRoomControl, FcrInterpreterRoomInfo, FcrInterpreterState, FcrInterpreterUsersParams, FcrLanguageChannelInfo, } from './room-control/interpreter-control/types';
|
|
25
|
+
export type { FcrPermission, FcrPermissionInfo, FcrPermissionInfoAddedEvent, FcrPermissionInfoDeletedEvent, FcrPrivilegeControl, FcrPrivilegeObserver, FcrSecurityInfo, FcrSecurityInfoUpdatedEvent, FcrSecurityObj, FcrSecurityPrivateChatConfig, FcrSecuritySendChatPayload, FcrSecuritySharePayload, FcrSecurityWriteBoardPayload, } from './room-control/privilege-control/type';
|
|
26
|
+
export { FcrChatPermissionType, FcrOperatePermissionType, FcrPermissionAction, FcrPrivilegeUserRole, FcrPrivilegeUserRoleToStringMap, FcrPrivilegeUserStringToRoleMap, FcrSecurityAction, FcrWatermarkPermissionState, } from './room-control/privilege-control/type';
|
|
27
|
+
export { FcrIPConnectorSessionType, FcrRoomConnectorPhoneRegion, FcrRoomConnectorSessionReason, FcrRoomConnectorSessionState, } from './room-control/room-connector-control/type';
|
|
28
|
+
export type { FcrIPConnectorSession, FcrIPConnectorSessionParams, FcrPhoneConnectorSession, FcrPhoneConnectorSessionParams, FcrRoomConnectorControl, FcrRoomConnectorIpInfo, FcrRoomConnectorObserver, FcrRoomConnectorPhoneInfo, } from './room-control/room-connector-control/type';
|
|
29
|
+
export type { FcrRoomSession, FcrRoomSessionControl, FcrRoomSessionObserver, FcrRoomSessionParams, } from './room-control/room-session/type';
|
|
45
30
|
export { FcrScreenSharingState, FcrWhiteboardState } from './room-control/sharing-control/type';
|
|
46
|
-
export type {
|
|
47
|
-
export type {
|
|
48
|
-
export {
|
|
49
|
-
export type {
|
|
50
|
-
export type {
|
|
51
|
-
export type {
|
|
31
|
+
export type { FcrSharingControl, FcrSharingObserver } from './room-control/sharing-control/type';
|
|
32
|
+
export type { FcrDimensions, FcrLocalAudioStats, FcrLocalStreamCreateConfig, FcrLocalVideoStats, FcrRemoteAudioStats, FcrRemoteVideoStats, FcrSize, FcrSnapshotInfo, FcrStreamControl, FcrStreamCreateConfig, FcrStreamEvent, FcrStreamObserver, FcrUpdateStreamPrivilege, FcrUpdateStreamPrivilegeScope, } from './room-control/stream-control/type';
|
|
33
|
+
export { FcrUserKickedOutType, FcrUserLeftReason, FcrUserRole, } from './room-control/user-control/type';
|
|
34
|
+
export type { FcrUserControl, FcrUserJoinedEvent, FcrUserKickedOutEvent, FcrUserLeftEvent, FcrUserObserver, FcrUserPageParams, FcrUserPageResponse, FcrUserPropertiesDeletedEvent, FcrUserPropertiesUpdatedEvent, FcrUserUpdatedEvent, } from './room-control/user-control/type';
|
|
35
|
+
export type { FcrAnnotationConfig, FcrAnnotationControl, } from './room-control/whiteboard-control-v2/annotation-control/type';
|
|
36
|
+
export type { FcrBoardConfig, FcrWhiteboardControl, FcrWhiteboardObserver, } from './room-control/whiteboard-control-v2/whiteboard-control/type';
|
|
37
|
+
export type { FcrRoomControlImplType, FcrRoomControlType, FcrRoomRoute, FcrRoomRouter, FcrRoomRouterObserver, } from './room-router/type';
|
|
52
38
|
export type { FcrChatRoomTokenResData, FcrCheckInParams } from './service/type';
|
|
39
|
+
export { FcrVideoEncoderConfig };
|
|
53
40
|
export type FcrCoreEngineObserver = {
|
|
54
41
|
/** 连接状态更新回调 */
|
|
55
42
|
onConnectionStateUpdated?(state: FcrConnectionState): void;
|
|
@@ -205,7 +192,6 @@ export type FcrSessionResponse = {
|
|
|
205
192
|
};
|
|
206
193
|
export type FcrOperateCause = AgoraRteOperatCause;
|
|
207
194
|
export type FcrStreamEncryptionConfig = AgoraRteStreamEncryptionConfig;
|
|
208
|
-
export type FcrVideoEncoderConfig = AgoraRteVideoEncoderConfig;
|
|
209
195
|
export type FcrDeviceInfo = AgoraRtcDeviceInfo;
|
|
210
196
|
export type FcrWindowInfo = AgoraRtcWindowInfo;
|
|
211
197
|
export type FcrDisplayInfo = AgoraRtcDisplayInfo;
|
|
@@ -241,6 +227,10 @@ export declare const FcrUserStringToRoleMap: {
|
|
|
241
227
|
observer: FcrUserRole;
|
|
242
228
|
robot: FcrUserRole;
|
|
243
229
|
};
|
|
230
|
+
export declare enum FcrReturnCode {
|
|
231
|
+
UNDEFINED = -1,
|
|
232
|
+
SUCCESS = 0
|
|
233
|
+
}
|
|
244
234
|
export declare enum FcrLiveStreamingLayoutType {
|
|
245
235
|
GALLERY = 1,// 画廊模式
|
|
246
236
|
SPEAKER = 2
|
|
@@ -278,13 +268,13 @@ export declare enum RoomMessageKey {
|
|
|
278
268
|
USER_WAITING_ROOM_JOINED = "USER_WAITING_ROOM_JOINED"
|
|
279
269
|
}
|
|
280
270
|
export type FcrMonitorUploadEvent = AgoraRteUploadEvent;
|
|
281
|
-
export { FcrLineType } from './room-control/type';
|
|
282
271
|
export { FcrDeviceType } from './media-control/type';
|
|
272
|
+
export { FcrLineType } from './room-control/type';
|
|
273
|
+
export { FcrError } from './utilities/error';
|
|
283
274
|
export declare enum FcrStreamState {
|
|
284
275
|
UNPUBLISH = 0,
|
|
285
276
|
PUBLISH = 1
|
|
286
277
|
}
|
|
287
|
-
export { FcrError } from './utilities/error';
|
|
288
278
|
export type FcrWhiteboardParameters = {
|
|
289
279
|
cursor?: boolean;
|
|
290
280
|
syncMode?: boolean;
|
|
@@ -294,7 +284,36 @@ export type FcrWhiteboardParameters = {
|
|
|
294
284
|
floatBar?: unknown;
|
|
295
285
|
containerElement?: FcrWhiteboardView;
|
|
296
286
|
};
|
|
297
|
-
export {
|
|
287
|
+
export type { FcrLanguageConfig } from './room-control/stt-control/type';
|
|
288
|
+
export { FcrBoardShape, FcrBoardToolType } from './room-control/whiteboard-control-v2/enum';
|
|
298
289
|
export type { FcrBoardMainWindow, FcrBoardMainWindowObserver, } from './room-control/whiteboard-control-v2/type';
|
|
299
290
|
export type { FcrColor } from './room-control/whiteboard-control/type';
|
|
300
|
-
|
|
291
|
+
/** 引擎配置类 */
|
|
292
|
+
export declare class FcrCoreEngineConfig {
|
|
293
|
+
/** 应用唯一标识 */
|
|
294
|
+
appId: string;
|
|
295
|
+
/** 身份验证令牌 */
|
|
296
|
+
token: string;
|
|
297
|
+
/** 用户唯一标识 */
|
|
298
|
+
userId: string;
|
|
299
|
+
/** 服务区域 */
|
|
300
|
+
region: FcrRegion;
|
|
301
|
+
/** 双摄像头视频流配置 */
|
|
302
|
+
dualCameraVideoStreamConfig: FcrDualVideoStreamConfig;
|
|
303
|
+
/** 双屏幕视频流配置 */
|
|
304
|
+
dualScreenVideoStreamConfig: FcrDualVideoStreamConfig;
|
|
305
|
+
/** 额外参数配置 */
|
|
306
|
+
parameters?: Record<string, unknown>;
|
|
307
|
+
constructor(params: {
|
|
308
|
+
appId: string;
|
|
309
|
+
token: string;
|
|
310
|
+
userId: string;
|
|
311
|
+
region: FcrRegion;
|
|
312
|
+
dualCameraVideoStreamConfig: FcrDualVideoStreamConfig;
|
|
313
|
+
dualScreenVideoStreamConfig: FcrDualVideoStreamConfig;
|
|
314
|
+
parameters?: Record<string, unknown>;
|
|
315
|
+
});
|
|
316
|
+
static createDefaultConfig(appId: string, token: string, region: FcrRegion, userId: string, parameters?: Record<string, unknown>): FcrCoreEngineConfig;
|
|
317
|
+
private _prependInternalParameters;
|
|
318
|
+
}
|
|
319
|
+
export type { FcrCoreEngine } from './engine/type';
|
package/lib/type.js
CHANGED
|
@@ -64,16 +64,17 @@ Object.defineProperty(exports, "FcrConnectionState", {
|
|
|
64
64
|
return _imports.AgoraRteConnectionState;
|
|
65
65
|
}
|
|
66
66
|
});
|
|
67
|
-
|
|
67
|
+
exports.FcrCoreEngineConfig = void 0;
|
|
68
|
+
Object.defineProperty(exports, "FcrDeviceType", {
|
|
68
69
|
enumerable: true,
|
|
69
70
|
get: function () {
|
|
70
|
-
return
|
|
71
|
+
return _type7.FcrDeviceType;
|
|
71
72
|
}
|
|
72
73
|
});
|
|
73
|
-
Object.defineProperty(exports, "
|
|
74
|
+
Object.defineProperty(exports, "FcrDualVideoStreamConfig", {
|
|
74
75
|
enumerable: true,
|
|
75
76
|
get: function () {
|
|
76
|
-
return
|
|
77
|
+
return _dualVideoStreamConfig.FcrDualVideoStreamConfig;
|
|
77
78
|
}
|
|
78
79
|
});
|
|
79
80
|
Object.defineProperty(exports, "FcrError", {
|
|
@@ -103,7 +104,7 @@ Object.defineProperty(exports, "FcrLanguage", {
|
|
|
103
104
|
Object.defineProperty(exports, "FcrLineType", {
|
|
104
105
|
enumerable: true,
|
|
105
106
|
get: function () {
|
|
106
|
-
return
|
|
107
|
+
return _type8.FcrLineType;
|
|
107
108
|
}
|
|
108
109
|
});
|
|
109
110
|
exports.FcrLiveStreamingState = exports.FcrLiveStreamingLayoutType = void 0;
|
|
@@ -151,6 +152,7 @@ Object.defineProperty(exports, "FcrRegion", {
|
|
|
151
152
|
return _imports.AgoraRteRegion;
|
|
152
153
|
}
|
|
153
154
|
});
|
|
155
|
+
exports.FcrReturnCode = void 0;
|
|
154
156
|
Object.defineProperty(exports, "FcrRoomConnectorPhoneRegion", {
|
|
155
157
|
enumerable: true,
|
|
156
158
|
get: function () {
|
|
@@ -250,6 +252,12 @@ Object.defineProperty(exports, "FcrUserUpdatedReason", {
|
|
|
250
252
|
return _imports.AgoraRteUserUpdatedReason;
|
|
251
253
|
}
|
|
252
254
|
});
|
|
255
|
+
Object.defineProperty(exports, "FcrVideoEncoderConfig", {
|
|
256
|
+
enumerable: true,
|
|
257
|
+
get: function () {
|
|
258
|
+
return _videoEncoderConfig.FcrVideoEncoderConfig;
|
|
259
|
+
}
|
|
260
|
+
});
|
|
253
261
|
Object.defineProperty(exports, "FcrVideoOrientation", {
|
|
254
262
|
enumerable: true,
|
|
255
263
|
get: function () {
|
|
@@ -294,22 +302,24 @@ Object.defineProperty(exports, "registerPlugin", {
|
|
|
294
302
|
}
|
|
295
303
|
});
|
|
296
304
|
var _type = require("./room-control/user-control/type");
|
|
305
|
+
var _parameters = require("./utilities/parameters");
|
|
297
306
|
var _imports = require("./imports");
|
|
307
|
+
var _dualVideoStreamConfig = require("./utilities/dual-video-stream-config");
|
|
308
|
+
var _videoEncoderConfig = require("./utilities/video-encoder-config");
|
|
298
309
|
var _type2 = require("./room-control/ability-control/type");
|
|
299
310
|
var _type3 = require("./room-control/chatroom-control/type");
|
|
300
311
|
var _types = require("./room-control/interpreter-control/types");
|
|
301
312
|
var _type4 = require("./room-control/privilege-control/type");
|
|
302
313
|
var _type5 = require("./room-control/room-connector-control/type");
|
|
303
314
|
var _type6 = require("./room-control/sharing-control/type");
|
|
304
|
-
var _type7 = require("./
|
|
305
|
-
var _type8 = require("./
|
|
315
|
+
var _type7 = require("./media-control/type");
|
|
316
|
+
var _type8 = require("./room-control/type");
|
|
306
317
|
var _error = require("./utilities/error");
|
|
307
318
|
var _enum = require("./room-control/whiteboard-control-v2/enum");
|
|
308
319
|
// 基础导入类型(集中管理第三方依赖类型别名)
|
|
309
320
|
// 内部枚举与基础类型导入
|
|
310
321
|
// 模块类型导出(按功能模块分组)
|
|
311
322
|
// 聊天连接模块
|
|
312
|
-
// 引擎核心配置
|
|
313
323
|
// 第三方类型别名(统一前缀避免冲突)
|
|
314
324
|
// 基础类型别名(简化常用类型引用)
|
|
315
325
|
// 媒体控制模块
|
|
@@ -395,8 +405,11 @@ const FcrUserStringToRoleMap = exports.FcrUserStringToRoleMap = {
|
|
|
395
405
|
observer: _type.FcrUserRole.OBSERVER,
|
|
396
406
|
robot: _type.FcrUserRole.ROBOT
|
|
397
407
|
};
|
|
398
|
-
|
|
399
|
-
|
|
408
|
+
let FcrReturnCode = exports.FcrReturnCode = /*#__PURE__*/function (FcrReturnCode) {
|
|
409
|
+
FcrReturnCode[FcrReturnCode["UNDEFINED"] = -1] = "UNDEFINED";
|
|
410
|
+
FcrReturnCode[FcrReturnCode["SUCCESS"] = 0] = "SUCCESS";
|
|
411
|
+
return FcrReturnCode;
|
|
412
|
+
}({}); // 直播相关类型
|
|
400
413
|
let FcrLiveStreamingLayoutType = exports.FcrLiveStreamingLayoutType = /*#__PURE__*/function (FcrLiveStreamingLayoutType) {
|
|
401
414
|
FcrLiveStreamingLayoutType[FcrLiveStreamingLayoutType["GALLERY"] = 1] = "GALLERY";
|
|
402
415
|
// 画廊模式
|
|
@@ -417,4 +430,56 @@ let FcrStreamState = exports.FcrStreamState = /*#__PURE__*/function (FcrStreamSt
|
|
|
417
430
|
FcrStreamState[FcrStreamState["UNPUBLISH"] = 0] = "UNPUBLISH";
|
|
418
431
|
FcrStreamState[FcrStreamState["PUBLISH"] = 1] = "PUBLISH";
|
|
419
432
|
return FcrStreamState;
|
|
420
|
-
}({});
|
|
433
|
+
}({});
|
|
434
|
+
/** 引擎配置类 */
|
|
435
|
+
class FcrCoreEngineConfig {
|
|
436
|
+
/** 应用唯一标识 */
|
|
437
|
+
|
|
438
|
+
/** 身份验证令牌 */
|
|
439
|
+
|
|
440
|
+
/** 用户唯一标识 */
|
|
441
|
+
|
|
442
|
+
/** 服务区域 */
|
|
443
|
+
|
|
444
|
+
/** 双摄像头视频流配置 */
|
|
445
|
+
|
|
446
|
+
/** 双屏幕视频流配置 */
|
|
447
|
+
|
|
448
|
+
/** 额外参数配置 */
|
|
449
|
+
|
|
450
|
+
constructor(params) {
|
|
451
|
+
this.appId = params.appId;
|
|
452
|
+
this.token = params.token;
|
|
453
|
+
this.userId = params.userId;
|
|
454
|
+
this.region = params.region;
|
|
455
|
+
this.dualCameraVideoStreamConfig = params.dualCameraVideoStreamConfig;
|
|
456
|
+
this.dualScreenVideoStreamConfig = params.dualScreenVideoStreamConfig;
|
|
457
|
+
this.parameters = params.parameters;
|
|
458
|
+
this._prependInternalParameters();
|
|
459
|
+
}
|
|
460
|
+
static createDefaultConfig(appId, token, region, userId, parameters) {
|
|
461
|
+
return new FcrCoreEngineConfig({
|
|
462
|
+
appId,
|
|
463
|
+
token,
|
|
464
|
+
userId,
|
|
465
|
+
region,
|
|
466
|
+
dualCameraVideoStreamConfig: _dualVideoStreamConfig.FcrDualVideoStreamConfig.createDefaultCameraConfig(),
|
|
467
|
+
dualScreenVideoStreamConfig: _dualVideoStreamConfig.FcrDualVideoStreamConfig.createDefaultScreenConfig(),
|
|
468
|
+
parameters
|
|
469
|
+
});
|
|
470
|
+
}
|
|
471
|
+
_prependInternalParameters() {
|
|
472
|
+
const rtcPresetParameters = (0, _parameters.getRtcPresetParameters)();
|
|
473
|
+
if (!this.parameters) {
|
|
474
|
+
this.parameters = {
|
|
475
|
+
rtc: rtcPresetParameters
|
|
476
|
+
};
|
|
477
|
+
} else if (!this.parameters.rtc) {
|
|
478
|
+
this.parameters.rtc = rtcPresetParameters;
|
|
479
|
+
} else {
|
|
480
|
+
// 将内部参数插入到数组前列
|
|
481
|
+
this.parameters.rtc.unshift(...rtcPresetParameters);
|
|
482
|
+
}
|
|
483
|
+
}
|
|
484
|
+
}
|
|
485
|
+
exports.FcrCoreEngineConfig = FcrCoreEngineConfig;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
export type RetryOptions = {
|
|
2
|
+
retriesMax: number;
|
|
3
|
+
};
|
|
4
|
+
/**
|
|
5
|
+
* Creates an abortable retry operation that can be cancelled at any time.
|
|
6
|
+
*
|
|
7
|
+
* The handler function will be retried up to `retriesMax` times if it fails.
|
|
8
|
+
* The operation can be cancelled by calling the returned abort function,
|
|
9
|
+
* which will cause the promise to reject with an AbortError.
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```typescript
|
|
13
|
+
* const [abort, promise] = abortableRetry(async (signal) => {
|
|
14
|
+
* await asyncFunction1();
|
|
15
|
+
* // Check if aborted after each async operation
|
|
16
|
+
* signal.throwIfAborted();
|
|
17
|
+
*
|
|
18
|
+
* await asyncFunction2();
|
|
19
|
+
* signal.throwIfAborted();
|
|
20
|
+
*
|
|
21
|
+
* return result;
|
|
22
|
+
* }, { retriesMax: 10 });
|
|
23
|
+
*
|
|
24
|
+
* // Cancel the operation at any time
|
|
25
|
+
* setTimeout(() => abort(), 5000);
|
|
26
|
+
*
|
|
27
|
+
* const [err, result] = await promise;
|
|
28
|
+
* if (err?.name === 'AbortError') {
|
|
29
|
+
* console.log('Operation was cancelled');
|
|
30
|
+
* }
|
|
31
|
+
* ```
|
|
32
|
+
*
|
|
33
|
+
* @param handler - Async function that receives an AbortSignal.
|
|
34
|
+
* Should call `signal.throwIfAborted()` periodically to check for cancellation.
|
|
35
|
+
* @param options - Retry configuration
|
|
36
|
+
* @returns Tuple of [abort function, result promise]. The promise resolves to [error, result].
|
|
37
|
+
*/
|
|
38
|
+
export declare const abortableRetry: <T>(handler: (signal: AbortSignal) => Promise<T>, options: RetryOptions) => readonly [() => void, Promise<[Error | null, T]>];
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.abortableRetry = void 0;
|
|
7
|
+
require("core-js/modules/web.dom-exception.stack.js");
|
|
8
|
+
var _imports = require("../imports");
|
|
9
|
+
/**
|
|
10
|
+
* Creates an abortable retry operation that can be cancelled at any time.
|
|
11
|
+
*
|
|
12
|
+
* The handler function will be retried up to `retriesMax` times if it fails.
|
|
13
|
+
* The operation can be cancelled by calling the returned abort function,
|
|
14
|
+
* which will cause the promise to reject with an AbortError.
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```typescript
|
|
18
|
+
* const [abort, promise] = abortableRetry(async (signal) => {
|
|
19
|
+
* await asyncFunction1();
|
|
20
|
+
* // Check if aborted after each async operation
|
|
21
|
+
* signal.throwIfAborted();
|
|
22
|
+
*
|
|
23
|
+
* await asyncFunction2();
|
|
24
|
+
* signal.throwIfAborted();
|
|
25
|
+
*
|
|
26
|
+
* return result;
|
|
27
|
+
* }, { retriesMax: 10 });
|
|
28
|
+
*
|
|
29
|
+
* // Cancel the operation at any time
|
|
30
|
+
* setTimeout(() => abort(), 5000);
|
|
31
|
+
*
|
|
32
|
+
* const [err, result] = await promise;
|
|
33
|
+
* if (err?.name === 'AbortError') {
|
|
34
|
+
* console.log('Operation was cancelled');
|
|
35
|
+
* }
|
|
36
|
+
* ```
|
|
37
|
+
*
|
|
38
|
+
* @param handler - Async function that receives an AbortSignal.
|
|
39
|
+
* Should call `signal.throwIfAborted()` periodically to check for cancellation.
|
|
40
|
+
* @param options - Retry configuration
|
|
41
|
+
* @returns Tuple of [abort function, result promise]. The promise resolves to [error, result].
|
|
42
|
+
*/
|
|
43
|
+
const abortableRetry = (handler, options) => {
|
|
44
|
+
const abortController = new AbortController();
|
|
45
|
+
const promise = (0, _imports.to)((0, _imports.retryAttempt)(async () => {
|
|
46
|
+
abortController.signal.throwIfAborted();
|
|
47
|
+
const result = await handler(abortController.signal);
|
|
48
|
+
abortController.signal.throwIfAborted();
|
|
49
|
+
return result;
|
|
50
|
+
}, [], {
|
|
51
|
+
retriesMax: options.retriesMax
|
|
52
|
+
}).fail(async options => {
|
|
53
|
+
if (abortController.signal.aborted) {
|
|
54
|
+
throw new DOMException('Operation aborted', 'AbortError');
|
|
55
|
+
}
|
|
56
|
+
await options.timeFn();
|
|
57
|
+
return true;
|
|
58
|
+
}).exec());
|
|
59
|
+
return [() => abortController.abort(), promise];
|
|
60
|
+
};
|
|
61
|
+
exports.abortableRetry = abortableRetry;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { AgoraRteDualVideoStreamConfig } from '../imports';
|
|
2
|
+
export type FcrDualVideoStreamConfig = AgoraRteDualVideoStreamConfig;
|
|
3
|
+
export declare namespace FcrDualVideoStreamConfig {
|
|
4
|
+
function createDefaultCameraConfig(): FcrDualVideoStreamConfig;
|
|
5
|
+
function createDefaultScreenConfig(): FcrDualVideoStreamConfig;
|
|
6
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.FcrDualVideoStreamConfig = void 0;
|
|
7
|
+
var _videoEncoderConfig = require("./video-encoder-config");
|
|
8
|
+
let FcrDualVideoStreamConfig = exports.FcrDualVideoStreamConfig = void 0;
|
|
9
|
+
(function (_FcrDualVideoStreamConfig) {
|
|
10
|
+
function createDefaultCameraConfig() {
|
|
11
|
+
return {
|
|
12
|
+
highVideoEncoderConfig: _videoEncoderConfig.FcrVideoEncoderConfig.createDefaultHighCameraConfig(),
|
|
13
|
+
lowVideoEncoderConfig: _videoEncoderConfig.FcrVideoEncoderConfig.createDefaultLowCameraConfig(),
|
|
14
|
+
enableDualStreamMode: true
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
_FcrDualVideoStreamConfig.createDefaultCameraConfig = createDefaultCameraConfig;
|
|
18
|
+
function createDefaultScreenConfig() {
|
|
19
|
+
return {
|
|
20
|
+
highVideoEncoderConfig: _videoEncoderConfig.FcrVideoEncoderConfig.createDefaultClarityScreenConfig(),
|
|
21
|
+
enableDualStreamMode: false
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
_FcrDualVideoStreamConfig.createDefaultScreenConfig = createDefaultScreenConfig;
|
|
25
|
+
})(FcrDualVideoStreamConfig || (exports.FcrDualVideoStreamConfig = FcrDualVideoStreamConfig = {}));
|
|
@@ -3,7 +3,8 @@
|
|
|
3
3
|
*
|
|
4
4
|
* 提供统一的错误创建和处理机制,支持实例化配置
|
|
5
5
|
*/
|
|
6
|
-
import {
|
|
6
|
+
import { ErrorModuleCode } from '../imports';
|
|
7
|
+
import { FcrError } from './error';
|
|
7
8
|
/**
|
|
8
9
|
* 控制器类型枚举
|
|
9
10
|
*/
|
|
@@ -26,7 +27,7 @@ export declare enum ControllerType {
|
|
|
26
27
|
*/
|
|
27
28
|
export interface FcrErrorHelperConfig {
|
|
28
29
|
/** 默认模块代码 */
|
|
29
|
-
defaultModuleCode?:
|
|
30
|
+
defaultModuleCode?: ErrorModuleCode;
|
|
30
31
|
/** 是否启用详细错误信息 */
|
|
31
32
|
enableDetailedMessages?: boolean;
|
|
32
33
|
/** 错误日志前缀 */
|
|
@@ -46,7 +47,7 @@ export declare class FcrErrorHelper {
|
|
|
46
47
|
* @param moduleCode 模块错误码
|
|
47
48
|
* @returns FcrError
|
|
48
49
|
*/
|
|
49
|
-
createControllerNotInitializedError(controllerType: ControllerType, moduleCode?:
|
|
50
|
+
createControllerNotInitializedError(controllerType: ControllerType, moduleCode?: ErrorModuleCode): FcrError;
|
|
50
51
|
/**
|
|
51
52
|
* 生成操作冲突错误
|
|
52
53
|
* @param operation 操作名称
|
|
@@ -54,21 +55,21 @@ export declare class FcrErrorHelper {
|
|
|
54
55
|
* @param moduleCode 模块错误码
|
|
55
56
|
* @returns FcrError
|
|
56
57
|
*/
|
|
57
|
-
createOperationConflictError(operation: string, reason: string, moduleCode?:
|
|
58
|
+
createOperationConflictError(operation: string, reason: string, moduleCode?: ErrorModuleCode): FcrError;
|
|
58
59
|
/**
|
|
59
60
|
* 生成操作取消错误
|
|
60
61
|
* @param operation 操作名称
|
|
61
62
|
* @param moduleCode 模块错误码
|
|
62
63
|
* @returns FcrError
|
|
63
64
|
*/
|
|
64
|
-
createOperationCanceledError(operation: string, moduleCode?:
|
|
65
|
+
createOperationCanceledError(operation: string, moduleCode?: ErrorModuleCode): FcrError;
|
|
65
66
|
/**
|
|
66
67
|
* 生成消息发送错误
|
|
67
68
|
* @param originalError 原始错误
|
|
68
69
|
* @param moduleCode 模块错误码
|
|
69
70
|
* @returns FcrError
|
|
70
71
|
*/
|
|
71
|
-
createSendMessageError(originalError: Error, moduleCode?:
|
|
72
|
+
createSendMessageError(originalError: Error, moduleCode?: ErrorModuleCode): FcrError;
|
|
72
73
|
/**
|
|
73
74
|
* 生成通用操作错误
|
|
74
75
|
* @param operation 操作类型
|
|
@@ -76,14 +77,14 @@ export declare class FcrErrorHelper {
|
|
|
76
77
|
* @param moduleCode 模块错误码
|
|
77
78
|
* @returns FcrError
|
|
78
79
|
*/
|
|
79
|
-
createOperationError(operation: string, originalError?: Error, moduleCode?:
|
|
80
|
+
createOperationError(operation: string, originalError?: Error, moduleCode?: ErrorModuleCode): FcrError;
|
|
80
81
|
/**
|
|
81
82
|
* 生成网络请求相关错误
|
|
82
83
|
* @param message 错误消息
|
|
83
84
|
* @param moduleCode 模块错误码
|
|
84
85
|
* @returns FcrError
|
|
85
86
|
*/
|
|
86
|
-
createNetworkError(message: string, moduleCode?:
|
|
87
|
+
createNetworkError(message: string, moduleCode?: ErrorModuleCode): FcrError;
|
|
87
88
|
/**
|
|
88
89
|
* 生成参数无效错误
|
|
89
90
|
* @param paramName 参数名
|
|
@@ -91,7 +92,7 @@ export declare class FcrErrorHelper {
|
|
|
91
92
|
* @param moduleCode 模块错误码
|
|
92
93
|
* @returns FcrError
|
|
93
94
|
*/
|
|
94
|
-
createInvalidParamsError(paramName: string, reason: string, moduleCode?:
|
|
95
|
+
createInvalidParamsError(paramName: string, reason: string, moduleCode?: ErrorModuleCode): FcrError;
|
|
95
96
|
/**
|
|
96
97
|
* 生成房间加入冲突错误的便捷方法
|
|
97
98
|
*/
|
|
@@ -4,6 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.roomControlErrorHelper = exports.liveStreamingErrorHelper = exports.engineErrorHelper = exports.defaultErrorHelper = exports.FcrErrorHelper = exports.ControllerType = void 0;
|
|
7
|
+
var _imports = require("../imports");
|
|
7
8
|
var _error = require("./error");
|
|
8
9
|
/**
|
|
9
10
|
* 通用错误处理辅助工具
|
|
@@ -37,7 +38,7 @@ let ControllerType = exports.ControllerType = /*#__PURE__*/function (ControllerT
|
|
|
37
38
|
class FcrErrorHelper {
|
|
38
39
|
constructor(config = {}) {
|
|
39
40
|
this.config = {
|
|
40
|
-
defaultModuleCode:
|
|
41
|
+
defaultModuleCode: _imports.ErrorModuleCode.FCR_ROOM,
|
|
41
42
|
enableDetailedMessages: true,
|
|
42
43
|
logPrefix: 'FCR',
|
|
43
44
|
autoLog: false,
|
|
@@ -53,7 +54,7 @@ class FcrErrorHelper {
|
|
|
53
54
|
createControllerNotInitializedError(controllerType, moduleCode) {
|
|
54
55
|
const module = moduleCode ?? this.config.defaultModuleCode;
|
|
55
56
|
const message = this.config.enableDetailedMessages ? `[${this.config.logPrefix}] The ${controllerType} controller is not initialized, please join the room first` : `${controllerType} controller not initialized`;
|
|
56
|
-
const error = (0, _error.
|
|
57
|
+
const error = (0, _error.generateFcrCoreClientError)(module, _imports.DetailErrorCode.NOT_JOINED_ROOM, message);
|
|
57
58
|
if (this.config.autoLog) {
|
|
58
59
|
console.error(`${this.config.logPrefix}: ${message}`);
|
|
59
60
|
}
|
|
@@ -70,7 +71,7 @@ class FcrErrorHelper {
|
|
|
70
71
|
createOperationConflictError(operation, reason, moduleCode) {
|
|
71
72
|
const module = moduleCode ?? this.config.defaultModuleCode;
|
|
72
73
|
const message = this.config.enableDetailedMessages ? `[${this.config.logPrefix}] Failed to ${operation}: ${reason}` : `${operation} failed: ${reason}`;
|
|
73
|
-
const error = (0, _error.
|
|
74
|
+
const error = (0, _error.generateFcrCoreClientError)(module, _imports.DetailErrorCode.JOIN_CONFLICT, message);
|
|
74
75
|
if (this.config.autoLog) {
|
|
75
76
|
console.error(`${this.config.logPrefix}: ${message}`);
|
|
76
77
|
}
|
|
@@ -86,7 +87,7 @@ class FcrErrorHelper {
|
|
|
86
87
|
createOperationCanceledError(operation, moduleCode) {
|
|
87
88
|
const module = moduleCode ?? this.config.defaultModuleCode;
|
|
88
89
|
const message = this.config.enableDetailedMessages ? `[${this.config.logPrefix}] ${operation} operation has been cancelled` : `${operation} cancelled`;
|
|
89
|
-
const error = (0, _error.
|
|
90
|
+
const error = (0, _error.generateFcrCoreClientError)(module, _imports.DetailErrorCode.NOT_JOINED_ROOM, message);
|
|
90
91
|
if (this.config.autoLog) {
|
|
91
92
|
console.error(`${this.config.logPrefix}: ${message}`);
|
|
92
93
|
}
|
|
@@ -102,7 +103,7 @@ class FcrErrorHelper {
|
|
|
102
103
|
createSendMessageError(originalError, moduleCode) {
|
|
103
104
|
const module = moduleCode ?? this.config.defaultModuleCode;
|
|
104
105
|
const message = this.config.enableDetailedMessages ? `[${this.config.logPrefix}] Send message failed: ${originalError.message}` : 'send message failed';
|
|
105
|
-
const error = (0, _error.
|
|
106
|
+
const error = (0, _error.generateFcrCoreClientError)(module, _imports.DetailErrorCode.UNDEFINED_ERROR, message);
|
|
106
107
|
if (this.config.autoLog) {
|
|
107
108
|
console.error(`${this.config.logPrefix}: ${message}`, originalError);
|
|
108
109
|
}
|
|
@@ -119,7 +120,7 @@ class FcrErrorHelper {
|
|
|
119
120
|
createOperationError(operation, originalError, moduleCode) {
|
|
120
121
|
const module = moduleCode ?? this.config.defaultModuleCode;
|
|
121
122
|
const message = this.config.enableDetailedMessages ? `[${this.config.logPrefix}] ${operation} failed${originalError ? `: ${originalError.message}` : ''}` : `${operation} failed`;
|
|
122
|
-
const error = (0, _error.
|
|
123
|
+
const error = (0, _error.generateFcrCoreClientError)(module, _imports.DetailErrorCode.NOT_JOINED_ROOM, message);
|
|
123
124
|
if (this.config.autoLog) {
|
|
124
125
|
console.error(`${this.config.logPrefix}: ${message}`, originalError);
|
|
125
126
|
}
|
|
@@ -135,7 +136,7 @@ class FcrErrorHelper {
|
|
|
135
136
|
createNetworkError(message, moduleCode) {
|
|
136
137
|
const module = moduleCode ?? this.config.defaultModuleCode;
|
|
137
138
|
const formattedMessage = this.config.enableDetailedMessages ? `[${this.config.logPrefix}] Network error: ${message}` : message;
|
|
138
|
-
const error = (0, _error.
|
|
139
|
+
const error = (0, _error.generateFcrCoreClientError)(module, _imports.DetailErrorCode.LOCAL_HTTP_REQUEST_FAILED, formattedMessage);
|
|
139
140
|
if (this.config.autoLog) {
|
|
140
141
|
console.error(`${this.config.logPrefix}: ${formattedMessage}`);
|
|
141
142
|
}
|
|
@@ -152,7 +153,7 @@ class FcrErrorHelper {
|
|
|
152
153
|
createInvalidParamsError(paramName, reason, moduleCode) {
|
|
153
154
|
const module = moduleCode ?? this.config.defaultModuleCode;
|
|
154
155
|
const message = this.config.enableDetailedMessages ? `[${this.config.logPrefix}] Invalid parameter '${paramName}': ${reason}` : `Invalid parameter '${paramName}': ${reason}`;
|
|
155
|
-
const error = (0, _error.
|
|
156
|
+
const error = (0, _error.generateFcrCoreClientError)(module, _imports.DetailErrorCode.INVALID_PARAMS, message);
|
|
156
157
|
if (this.config.autoLog) {
|
|
157
158
|
console.error(`${this.config.logPrefix}: ${message}`);
|
|
158
159
|
}
|
|
@@ -179,7 +180,7 @@ class FcrErrorHelper {
|
|
|
179
180
|
*/
|
|
180
181
|
static forRoomControl() {
|
|
181
182
|
return new FcrErrorHelper({
|
|
182
|
-
defaultModuleCode:
|
|
183
|
+
defaultModuleCode: _imports.ErrorModuleCode.FCR_ROOM,
|
|
183
184
|
logPrefix: 'RoomControl',
|
|
184
185
|
enableDetailedMessages: true
|
|
185
186
|
});
|
|
@@ -190,7 +191,7 @@ class FcrErrorHelper {
|
|
|
190
191
|
*/
|
|
191
192
|
static forEngine() {
|
|
192
193
|
return new FcrErrorHelper({
|
|
193
|
-
defaultModuleCode:
|
|
194
|
+
defaultModuleCode: _imports.ErrorModuleCode.FCR_ENGINE,
|
|
194
195
|
logPrefix: 'Engine',
|
|
195
196
|
enableDetailedMessages: true
|
|
196
197
|
});
|
|
@@ -201,7 +202,7 @@ class FcrErrorHelper {
|
|
|
201
202
|
*/
|
|
202
203
|
static forLiveStreaming() {
|
|
203
204
|
return new FcrErrorHelper({
|
|
204
|
-
defaultModuleCode:
|
|
205
|
+
defaultModuleCode: _imports.ErrorModuleCode.FCR_ROOM_LIVE_STREAMING,
|
|
205
206
|
logPrefix: 'LiveStreaming',
|
|
206
207
|
enableDetailedMessages: true
|
|
207
208
|
});
|