fcr-core 3.4.3 → 3.4.4

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.
Files changed (47) hide show
  1. package/lib/chat-connection/index.js +38 -20
  2. package/lib/engine/index.js +41 -39
  3. package/lib/imports.js +1 -0
  4. package/lib/media-control/desktop.js +11 -3
  5. package/lib/media-control/mobile.js +13 -6
  6. package/lib/peer-session/index.js +47 -34
  7. package/lib/plugins/chatroom.js +113 -99
  8. package/lib/room-control/ability-control/index.d.ts +1 -0
  9. package/lib/room-control/ability-control/index.js +69 -0
  10. package/lib/room-control/ability-control/type.d.ts +9 -0
  11. package/lib/room-control/ability-control/type.js +11 -0
  12. package/lib/room-control/chatroom-control/index.d.ts +1 -0
  13. package/lib/room-control/chatroom-control/index.js +385 -0
  14. package/lib/room-control/group-control/index.js +22 -11
  15. package/lib/room-control/index.js +82 -56
  16. package/lib/room-control/interpreter-control/index.js +17 -9
  17. package/lib/room-control/interpreter-control/room.js +6 -4
  18. package/lib/room-control/mainroom-control/index.js +41 -21
  19. package/lib/room-control/privilege-control/helper.js +10 -5
  20. package/lib/room-control/privilege-control/index.js +21 -12
  21. package/lib/room-control/privilege-control/type.js +0 -1
  22. package/lib/room-control/room-connector-control/index.js +24 -13
  23. package/lib/room-control/room-session/index.js +49 -36
  24. package/lib/room-control/stream-control/index.js +151 -140
  25. package/lib/room-control/user-control/index.js +135 -119
  26. package/lib/room-control/waitingroom-control/index.js +16 -8
  27. package/lib/room-control/whiteboard-control/board-subwindow.js +2 -1
  28. package/lib/room-control/whiteboard-control/board-window.js +57 -49
  29. package/lib/room-control/whiteboard-control/enums.js +0 -84
  30. package/lib/room-control/whiteboard-control/index.js +35 -22
  31. package/lib/room-control/whiteboard-control/mount-manager.js +4 -2
  32. package/lib/room-control/whiteboard-control/utils.js +17 -14
  33. package/lib/room-control/whiteboard-control-v2/index.js +33 -19
  34. package/lib/room-control/whiteboard-control-v2/main-window.js +23 -12
  35. package/lib/schema.d.ts +964 -0
  36. package/lib/schema.js +259 -0
  37. package/lib/service/api.js +82 -76
  38. package/lib/type.js +2 -4
  39. package/lib/utilities/collection.js +3 -2
  40. package/lib/utilities/error.js +5 -3
  41. package/lib/utilities/logger.js +2 -1
  42. package/lib/utilities/parameters.js +8 -4
  43. package/lib/utilities/stream.js +20 -12
  44. package/lib/utilities/user.js +1 -1
  45. package/lib/utilities/validate-params.d.ts +2 -0
  46. package/lib/utilities/validate-params.js +14 -0
  47. package/package.json +4 -4
package/lib/schema.js ADDED
@@ -0,0 +1,259 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.agoraRtcVideoEncoderConfigurationSchema = exports.agoraRtcEncryptionConfig = exports.AgoraRtcDimensions = void 0;
7
+ Object.defineProperty(exports, "anySchema", {
8
+ enumerable: true,
9
+ get: function () {
10
+ return _imports.anySchema;
11
+ }
12
+ });
13
+ Object.defineProperty(exports, "booleanSchema", {
14
+ enumerable: true,
15
+ get: function () {
16
+ return _imports.booleanSchema;
17
+ }
18
+ });
19
+ exports.colorSchema = void 0;
20
+ Object.defineProperty(exports, "createArraySchema", {
21
+ enumerable: true,
22
+ get: function () {
23
+ return _imports.createArraySchema;
24
+ }
25
+ });
26
+ Object.defineProperty(exports, "createRecordSchemaWithKey", {
27
+ enumerable: true,
28
+ get: function () {
29
+ return _imports.createRecordSchemaWithKey;
30
+ }
31
+ });
32
+ Object.defineProperty(exports, "createUnionSchema", {
33
+ enumerable: true,
34
+ get: function () {
35
+ return _imports.createUnionSchema;
36
+ }
37
+ });
38
+ exports.fcrRenderModeSchema = exports.fcrRenderConfigSchema = exports.fcrPrivilegeUserRoleSchema = exports.fcrPrivilegeUserRoleArraySchema = exports.fcrPhoneConnectorSessionParamsSchema = exports.fcrPermissionActionSchema = exports.fcrPeerSessionParamsSchema = exports.fcrMediaStreamTypeSchema = exports.fcrMediaStreamCreateConfigSchema = exports.fcrMediaSourceStateSchema = exports.fcrLocalStreamCreateArrayConfigSchema = exports.fcrLineTypeSchema = exports.fcrLatencyLevelTypeSchema = exports.fcrLanguageSchema = exports.fcrInterpreterUsersParamsSchema = exports.fcrInterpreterUsersParamsArraySchema = exports.fcrIPConnectorSessionTypeSchema = exports.fcrIPConnectorSessionParamsSchema = exports.fcrGroupUpdateOptionsSchema = exports.fcrGroupUpdateOptionsArraySchema = exports.fcrGroupCreateConfigSchema = exports.fcrGroupCreateConfigArraySchema = exports.fcrEncryptionModeSchema = exports.fcrDeviceTypeSchema = exports.fcrChatRoomSendTextMessageSchema = exports.fcrChatRoomSendImageMessageSchema = exports.fcrChatRoomSendBaseMessageSchema = exports.fcrChatRoomMessageTypeSchema = exports.fcrChatRoomFileSchema = exports.fcrCapabilitySchema = exports.fcrBoardToolTypeSchema = exports.fcrAudioSourceTypeSchema = void 0;
39
+ Object.defineProperty(exports, "fcrRenderViewSchema", {
40
+ enumerable: true,
41
+ get: function () {
42
+ return _imports.fcrRenderViewSchema;
43
+ }
44
+ });
45
+ exports.messageSchema = exports.fcrVideoStreamTypeSchema = exports.fcrVideoSourceTypeSchema = exports.fcrUserRolesSchema = exports.fcrUserRoleSchema = exports.fcrUserKickedOutTypeSchema = exports.fcrStreamJoinConfig = exports.fcrStreamBindConfigSchema = exports.fcrStreamBindConfigArrySchema = exports.fcrSessionBaseSchema = exports.fcrSecuritySendChatPayloadSchema = exports.fcrSecurityPrivateChatConfigSchema = exports.fcrSecurityActionSchema = exports.fcrScreenStreamCreateConfigSchema = exports.fcrRoomSessionParamsSchema = exports.fcrRoomJoinOptionsWithTicketSchema = exports.fcrRoomJoinOptionsSchema = void 0;
46
+ Object.defineProperty(exports, "numberSchema", {
47
+ enumerable: true,
48
+ get: function () {
49
+ return _imports.numberSchema;
50
+ }
51
+ });
52
+ exports.stringOrObjectSchema = exports.stringKeyUnknownValueSchema = exports.stringKeyNumberValueSchema = exports.stringArraySchema = exports.progressSchema = void 0;
53
+ Object.defineProperty(exports, "stringSchema", {
54
+ enumerable: true,
55
+ get: function () {
56
+ return _imports.stringSchema;
57
+ }
58
+ });
59
+ exports.unknownArraySchema = void 0;
60
+ Object.defineProperty(exports, "unknownSchema", {
61
+ enumerable: true,
62
+ get: function () {
63
+ return _imports.unknownSchema;
64
+ }
65
+ });
66
+ Object.defineProperty(exports, "z", {
67
+ enumerable: true,
68
+ get: function () {
69
+ return _imports.z;
70
+ }
71
+ });
72
+ var _types = require("./room-control/interpreter-control/types");
73
+ var _type = require("./room-control/privilege-control/type");
74
+ var _type2 = require("./room-control/room-connector-control/type");
75
+ var _type3 = require("./room-control/user-control/type");
76
+ var _enums = require("./room-control/whiteboard-control/enums");
77
+ var _type4 = require("./room-control/chatroom-control/type");
78
+ var _imports = require("./imports");
79
+ var _type5 = require("./media-control/type");
80
+ var _type6 = require("./room-control/type");
81
+ const stringOrObjectSchema = exports.stringOrObjectSchema = (0, _imports.createUnionSchema)([_imports.stringSchema, _imports.objectSchema]);
82
+ const stringArraySchema = exports.stringArraySchema = (0, _imports.createArraySchema)(_imports.stringSchema);
83
+ const unknownArraySchema = exports.unknownArraySchema = (0, _imports.createArraySchema)(_imports.unknownSchema);
84
+ const stringKeyUnknownValueSchema = exports.stringKeyUnknownValueSchema = (0, _imports.createRecordSchemaWithKey)(_imports.stringSchema, _imports.unknownSchema);
85
+ const stringKeyNumberValueSchema = exports.stringKeyNumberValueSchema = (0, _imports.createRecordSchemaWithKey)(_imports.stringSchema, _imports.numberSchema);
86
+ const fcrSecurityActionSchema = exports.fcrSecurityActionSchema = _imports.z.nativeEnum(_type.FcrSecurityAction);
87
+ const fcrPermissionActionSchema = exports.fcrPermissionActionSchema = _imports.z.nativeEnum(_type.FcrPermissionAction);
88
+ const fcrPrivilegeUserRoleSchema = exports.fcrPrivilegeUserRoleSchema = _imports.z.nativeEnum(_type.FcrPrivilegeUserRole);
89
+ const fcrLineTypeSchema = exports.fcrLineTypeSchema = _imports.z.nativeEnum(_type6.FcrLineType);
90
+ const fcrUserRoleSchema = exports.fcrUserRoleSchema = _imports.z.nativeEnum(_type3.FcrUserRole);
91
+ const fcrUserKickedOutTypeSchema = exports.fcrUserKickedOutTypeSchema = _imports.z.nativeEnum(_type3.FcrUserKickedOutType);
92
+ const fcrBoardToolTypeSchema = exports.fcrBoardToolTypeSchema = _imports.z.nativeEnum(_enums.FcrBoardToolType);
93
+ const fcrLanguageSchema = exports.fcrLanguageSchema = _imports.z.nativeEnum(_types.FcrLanguage);
94
+ const fcrIPConnectorSessionTypeSchema = exports.fcrIPConnectorSessionTypeSchema = _imports.z.nativeEnum(_type2.FcrIPConnectorSessionType);
95
+ const fcrDeviceTypeSchema = exports.fcrDeviceTypeSchema = _imports.z.nativeEnum(_type5.FcrDeviceType);
96
+ const fcrChatRoomMessageTypeSchema = exports.fcrChatRoomMessageTypeSchema = _imports.z.nativeEnum(_type4.FcrChatRoomMessageType);
97
+ // Native Enum Schemas
98
+ const fcrMediaStreamTypeSchema = exports.fcrMediaStreamTypeSchema = _imports.z.nativeEnum(_imports.AgoraRteMediaStreamType);
99
+ const fcrVideoSourceTypeSchema = exports.fcrVideoSourceTypeSchema = _imports.z.nativeEnum(_imports.AgoraRteVideoSourceType);
100
+ const fcrMediaSourceStateSchema = exports.fcrMediaSourceStateSchema = _imports.z.nativeEnum(_imports.AgoraRtcMediaSourceState);
101
+ const fcrCapabilitySchema = exports.fcrCapabilitySchema = _imports.z.nativeEnum(_imports.AgoraRtcCapability);
102
+ const fcrRenderModeSchema = exports.fcrRenderModeSchema = _imports.z.nativeEnum(_imports.AgoraRtcRenderMode);
103
+ const fcrEncryptionModeSchema = exports.fcrEncryptionModeSchema = _imports.z.nativeEnum(_imports.AgoraRtcEncryptionMode);
104
+ const fcrLatencyLevelTypeSchema = exports.fcrLatencyLevelTypeSchema = _imports.z.nativeEnum(_imports.AgoraRtcLatencyLevelType);
105
+ const fcrAudioSourceTypeSchema = exports.fcrAudioSourceTypeSchema = _imports.z.nativeEnum(_imports.AgoraRtcAudioSourceType);
106
+ const fcrVideoStreamTypeSchema = exports.fcrVideoStreamTypeSchema = _imports.z.nativeEnum(_imports.AgoraRtcVideoStreamType);
107
+ // Array Schemas
108
+ const fcrUserRolesSchema = exports.fcrUserRolesSchema = _imports.z.array(fcrUserRoleSchema);
109
+ const fcrPrivilegeUserRoleArraySchema = exports.fcrPrivilegeUserRoleArraySchema = _imports.z.array(fcrPrivilegeUserRoleSchema);
110
+ // Object Schemas
111
+ const fcrSessionBaseSchema = exports.fcrSessionBaseSchema = _imports.z.object({
112
+ sessionId: _imports.stringSchema,
113
+ sessionKey: _imports.stringSchema,
114
+ timestamp: _imports.numberSchema,
115
+ duration: _imports.numberSchema,
116
+ payload: stringKeyUnknownValueSchema,
117
+ senderId: _imports.stringSchema,
118
+ interval: _imports.numberSchema
119
+ });
120
+ const fcrInterpreterUsersParamsSchema = exports.fcrInterpreterUsersParamsSchema = _imports.z.object({
121
+ userId: _imports.stringSchema,
122
+ sourceLanguage: fcrLanguageSchema,
123
+ targetLanguage: fcrLanguageSchema
124
+ });
125
+ const fcrSecurityPrivateChatConfigSchema = exports.fcrSecurityPrivateChatConfigSchema = _imports.z.object({
126
+ host: _imports.booleanSchema,
127
+ cohost: _imports.booleanSchema,
128
+ participant: _imports.booleanSchema
129
+ });
130
+ const fcrSecuritySendChatPayloadSchema = exports.fcrSecuritySendChatPayloadSchema = _imports.z.object({
131
+ public: _imports.booleanSchema,
132
+ private: fcrSecurityPrivateChatConfigSchema
133
+ });
134
+ const fcrPhoneConnectorSessionParamsSchema = exports.fcrPhoneConnectorSessionParamsSchema = _imports.z.object({
135
+ phoneNumber: _imports.stringSchema,
136
+ userName: _imports.stringSchema,
137
+ phoneUserId: _imports.stringSchema.optional()
138
+ });
139
+ const fcrIPConnectorSessionParamsSchema = exports.fcrIPConnectorSessionParamsSchema = _imports.z.object({
140
+ address: _imports.stringSchema,
141
+ type: fcrIPConnectorSessionTypeSchema
142
+ });
143
+ const fcrRoomSessionParamsSchema = exports.fcrRoomSessionParamsSchema = _imports.z.object({
144
+ sessionKey: _imports.stringSchema,
145
+ duration: _imports.numberSchema,
146
+ payload: stringKeyUnknownValueSchema
147
+ });
148
+ const colorSchema = exports.colorSchema = _imports.z.object({
149
+ r: _imports.numberSchema,
150
+ g: _imports.numberSchema,
151
+ b: _imports.numberSchema
152
+ });
153
+ const fcrPeerSessionParamsSchema = exports.fcrPeerSessionParamsSchema = _imports.z.object({
154
+ sessionKey: _imports.stringSchema,
155
+ receiverId: _imports.stringSchema,
156
+ duration: _imports.numberSchema,
157
+ payload: stringKeyUnknownValueSchema
158
+ });
159
+ const fcrGroupCreateConfigSchema = exports.fcrGroupCreateConfigSchema = _imports.z.object({
160
+ groupName: _imports.stringSchema,
161
+ userList: stringArraySchema
162
+ });
163
+ // Chat Room Schemas
164
+ const fcrChatRoomSendBaseMessageSchema = exports.fcrChatRoomSendBaseMessageSchema = _imports.z.object({
165
+ type: fcrChatRoomMessageTypeSchema,
166
+ properties: stringKeyUnknownValueSchema.optional(),
167
+ to: stringArraySchema.optional()
168
+ });
169
+ const fcrChatRoomSendTextMessageSchema = exports.fcrChatRoomSendTextMessageSchema = _imports.z.object({
170
+ content: _imports.stringSchema
171
+ }).merge(fcrChatRoomSendBaseMessageSchema);
172
+ const fcrChatRoomFileSchema = exports.fcrChatRoomFileSchema = _imports.z.object({
173
+ fileName: _imports.stringSchema,
174
+ fileType: _imports.stringSchema,
175
+ filePath: _imports.stringSchema.optional(),
176
+ data: _imports.anySchema.optional()
177
+ });
178
+ const fcrChatRoomSendImageMessageSchema = exports.fcrChatRoomSendImageMessageSchema = _imports.z.object({
179
+ file: fcrChatRoomFileSchema
180
+ }).merge(fcrChatRoomSendBaseMessageSchema);
181
+ const messageSchema = exports.messageSchema = _imports.z.union([fcrChatRoomSendTextMessageSchema, fcrChatRoomSendImageMessageSchema]);
182
+ const progressSchema = exports.progressSchema = _imports.z.function().args(_imports.z.number()) // 定义参数类型
183
+ .returns(_imports.z.void()) // 定义返回值类型
184
+ .describe('A callback function that takes a progress and returns void');
185
+
186
+ // RTC Schemas
187
+ const agoraRtcEncryptionConfig = exports.agoraRtcEncryptionConfig = _imports.z.object({
188
+ encryptionKey: _imports.stringSchema,
189
+ encryptionMode: fcrEncryptionModeSchema
190
+ });
191
+ const AgoraRtcDimensions = exports.AgoraRtcDimensions = _imports.z.object({
192
+ width: _imports.numberSchema,
193
+ height: _imports.numberSchema
194
+ });
195
+ const agoraRtcVideoEncoderConfigurationSchema = exports.agoraRtcVideoEncoderConfigurationSchema = _imports.z.object({
196
+ dimensions: AgoraRtcDimensions,
197
+ frameRate: _imports.numberSchema,
198
+ bitrate: _imports.numberSchema
199
+ });
200
+ // Stream Config Schemas
201
+ const fcrStreamJoinConfig = exports.fcrStreamJoinConfig = _imports.z.object({
202
+ videoEncoderConfig: agoraRtcVideoEncoderConfigurationSchema.optional(),
203
+ videoSourceId: _imports.stringSchema.optional(),
204
+ audioSourceId: _imports.stringSchema.optional(),
205
+ streamName: _imports.stringSchema.optional(),
206
+ streamType: fcrMediaStreamTypeSchema,
207
+ videoSourceType: fcrVideoSourceTypeSchema,
208
+ audioSourceType: fcrAudioSourceTypeSchema,
209
+ audioSourceState: fcrMediaSourceStateSchema.optional(),
210
+ videoSourceState: fcrMediaSourceStateSchema.optional()
211
+ });
212
+ const fcrRoomJoinOptionsSchema = exports.fcrRoomJoinOptionsSchema = _imports.z.object({
213
+ userName: _imports.stringSchema,
214
+ userRole: fcrUserRoleSchema,
215
+ userProperties: stringKeyUnknownValueSchema.optional(),
216
+ roomToken: _imports.stringSchema,
217
+ streamLatency: fcrLatencyLevelTypeSchema,
218
+ streamEncryptionConfig: agoraRtcEncryptionConfig.optional(),
219
+ createStreamConfigs: _imports.z.array(fcrStreamJoinConfig),
220
+ password: _imports.stringSchema.optional(),
221
+ platform: _imports.numberSchema.optional()
222
+ });
223
+ // Other Schemas
224
+ const fcrRenderConfigSchema = exports.fcrRenderConfigSchema = _imports.z.object({
225
+ renderMode: fcrRenderModeSchema,
226
+ isMirror: _imports.booleanSchema
227
+ });
228
+ const fcrGroupUpdateOptionsSchema = exports.fcrGroupUpdateOptionsSchema = _imports.z.object({
229
+ groupId: _imports.stringSchema,
230
+ groupName: _imports.stringSchema
231
+ });
232
+ const fcrRoomJoinOptionsWithTicketSchema = exports.fcrRoomJoinOptionsWithTicketSchema = _imports.z.object({
233
+ ticket: _imports.stringSchema.optional()
234
+ }).merge(fcrRoomJoinOptionsSchema);
235
+ const fcrMediaStreamCreateConfigSchema = exports.fcrMediaStreamCreateConfigSchema = _imports.z.object({
236
+ streamName: _imports.stringSchema,
237
+ streamType: fcrMediaStreamTypeSchema,
238
+ videoSourceType: fcrVideoSourceTypeSchema,
239
+ audioSourceType: fcrAudioSourceTypeSchema,
240
+ ownerId: _imports.stringSchema,
241
+ videoSourceId: _imports.stringSchema,
242
+ audioSourceId: _imports.stringSchema,
243
+ generateToken: _imports.booleanSchema.optional()
244
+ });
245
+ const fcrStreamBindConfigSchema = exports.fcrStreamBindConfigSchema = _imports.z.object({
246
+ streamId: _imports.stringSchema,
247
+ videoSourceId: _imports.stringSchema.optional(),
248
+ audioSourceId: _imports.stringSchema.optional()
249
+ });
250
+ // Array Collection Schemas
251
+ const fcrScreenStreamCreateConfigSchema = exports.fcrScreenStreamCreateConfigSchema = _imports.z.object({
252
+ streamType: fcrMediaStreamTypeSchema,
253
+ audioDeviceName: _imports.stringSchema.optional()
254
+ });
255
+ const fcrGroupCreateConfigArraySchema = exports.fcrGroupCreateConfigArraySchema = _imports.z.array(fcrGroupCreateConfigSchema);
256
+ const fcrGroupUpdateOptionsArraySchema = exports.fcrGroupUpdateOptionsArraySchema = _imports.z.array(fcrGroupUpdateOptionsSchema);
257
+ const fcrLocalStreamCreateArrayConfigSchema = exports.fcrLocalStreamCreateArrayConfigSchema = _imports.z.array(fcrMediaStreamCreateConfigSchema);
258
+ const fcrInterpreterUsersParamsArraySchema = exports.fcrInterpreterUsersParamsArraySchema = _imports.z.array(fcrInterpreterUsersParamsSchema);
259
+ const fcrStreamBindConfigArrySchema = exports.fcrStreamBindConfigArrySchema = _imports.z.array(fcrStreamBindConfigSchema);