fcr-core
Version:
Core APIs for building online scenes
302 lines (299 loc) • 17.4 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.agoraRtcVideoEncoderConfigurationSchema = exports.agoraRtcEncryptionConfig = exports.AgoraRtcDimensions = void 0;
Object.defineProperty(exports, "anySchema", {
enumerable: true,
get: function () {
return _imports.anySchema;
}
});
Object.defineProperty(exports, "booleanSchema", {
enumerable: true,
get: function () {
return _imports.booleanSchema;
}
});
exports.colorSchema = void 0;
Object.defineProperty(exports, "createArraySchema", {
enumerable: true,
get: function () {
return _imports.createArraySchema;
}
});
Object.defineProperty(exports, "createRecordSchemaWithKey", {
enumerable: true,
get: function () {
return _imports.createRecordSchemaWithKey;
}
});
Object.defineProperty(exports, "createUnionSchema", {
enumerable: true,
get: function () {
return _imports.createUnionSchema;
}
});
exports.fcrRenderModeSchema = exports.fcrRenderConfigSchema = exports.fcrPrivilegeUserRoleSchema = exports.fcrPrivilegeUserRoleArraySchema = exports.fcrPhoneConnectorSessionParamsSchema = exports.fcrPermissionActionSchema = exports.fcrPeerSessionParamsSchema = exports.fcrMobileDeviceIdOrNameSchema = exports.fcrMediaStreamTypeSchema = exports.fcrMediaStreamCreateConfigSchema = exports.fcrMediaSourceStateSchema = exports.fcrLocalStreamCreateArrayConfigSchema = exports.fcrLineTypeSchema = exports.fcrLatencyLevelTypeSchema = exports.fcrLanguageSchema = exports.fcrLanguageConfigSchema = 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;
Object.defineProperty(exports, "fcrRenderViewSchema", {
enumerable: true,
get: function () {
return _imports.fcrRenderViewSchema;
}
});
exports.messageSchema = exports.fcrVideoStreamTypeSchema = exports.fcrVideoSourceTypeSchema = exports.fcrUserRolesSchema = exports.fcrUserRoleSchema = exports.fcrUserKickedOutTypeSchema = exports.fcrUpdateStreamPrivilegeScopeSchema = exports.fcrUpdateStreamCustomSchema = exports.fcrStreamPrivilegeVideoSourceTypeSchema = exports.fcrStreamPrivilegeOperation = exports.fcrStreamPrivilegeAudioSourceTypeSchema = exports.fcrStreamJoinConfig = exports.fcrStreamBindConfigSchema = exports.fcrStreamBindConfigArrySchema = exports.fcrSizeSchema = exports.fcrSessionBaseSchema = exports.fcrSecuritySendChatPayloadSchema = exports.fcrSecurityPrivateChatConfigSchema = exports.fcrSecurityActionSchema = exports.fcrScreenStreamCreateConfigSize = exports.fcrScreenStreamCreateConfigSchema = exports.fcrScreenScenarioTypeSchema = exports.fcrRoomSessionParamsSchema = exports.fcrRoomJoinOptionsWithTicketSchema = exports.fcrRoomJoinOptionsSchema = void 0;
Object.defineProperty(exports, "numberSchema", {
enumerable: true,
get: function () {
return _imports.numberSchema;
}
});
exports.stringOrObjectSchema = exports.stringKeyUnknownValueSchema = exports.stringKeyNumberValueSchema = exports.stringArraySchema = exports.progressSchema = void 0;
Object.defineProperty(exports, "stringSchema", {
enumerable: true,
get: function () {
return _imports.stringSchema;
}
});
exports.unknownArraySchema = void 0;
Object.defineProperty(exports, "unknownSchema", {
enumerable: true,
get: function () {
return _imports.unknownSchema;
}
});
Object.defineProperty(exports, "z", {
enumerable: true,
get: function () {
return _imports.z;
}
});
require("core-js/modules/esnext.iterator.constructor.js");
require("core-js/modules/esnext.iterator.some.js");
var _types = require("./room-control/interpreter-control/types");
var _type = require("./room-control/privilege-control/type");
var _type2 = require("./room-control/room-connector-control/type");
var _type3 = require("./room-control/user-control/type");
var _enum = require("./room-control/whiteboard-control-v2/enum");
var _type4 = require("./room-control/chatroom-control/type");
var _imports = require("./imports");
var _type5 = require("./media-control/type");
var _type6 = require("./room-control/type");
const stringOrObjectSchema = exports.stringOrObjectSchema = (0, _imports.createUnionSchema)([_imports.stringSchema, _imports.objectSchema]);
const stringArraySchema = exports.stringArraySchema = (0, _imports.createArraySchema)(_imports.stringSchema);
const unknownArraySchema = exports.unknownArraySchema = (0, _imports.createArraySchema)(_imports.unknownSchema);
const stringKeyUnknownValueSchema = exports.stringKeyUnknownValueSchema = (0, _imports.createRecordSchemaWithKey)(_imports.stringSchema, _imports.unknownSchema);
const stringKeyNumberValueSchema = exports.stringKeyNumberValueSchema = (0, _imports.createRecordSchemaWithKey)(_imports.stringSchema, _imports.numberSchema);
const fcrStreamPrivilegeOperation = exports.fcrStreamPrivilegeOperation = _imports.z.nativeEnum(_imports.AgoraRteStreamPrivilegeOperation);
const fcrSecurityActionSchema = exports.fcrSecurityActionSchema = _imports.z.nativeEnum(_type.FcrSecurityAction);
const fcrPermissionActionSchema = exports.fcrPermissionActionSchema = _imports.z.nativeEnum(_type.FcrPermissionAction);
const fcrPrivilegeUserRoleSchema = exports.fcrPrivilegeUserRoleSchema = _imports.z.nativeEnum(_type.FcrPrivilegeUserRole);
const fcrLineTypeSchema = exports.fcrLineTypeSchema = _imports.z.nativeEnum(_type6.FcrLineType);
const fcrUserRoleSchema = exports.fcrUserRoleSchema = _imports.z.nativeEnum(_type3.FcrUserRole);
const fcrUserKickedOutTypeSchema = exports.fcrUserKickedOutTypeSchema = _imports.z.nativeEnum(_type3.FcrUserKickedOutType);
const fcrBoardToolTypeSchema = exports.fcrBoardToolTypeSchema = _imports.z.nativeEnum(_enum.FcrBoardToolType);
const fcrLanguageSchema = exports.fcrLanguageSchema = _imports.z.nativeEnum(_types.FcrLanguage);
const fcrIPConnectorSessionTypeSchema = exports.fcrIPConnectorSessionTypeSchema = _imports.z.nativeEnum(_type2.FcrIPConnectorSessionType);
const fcrDeviceTypeSchema = exports.fcrDeviceTypeSchema = _imports.z.nativeEnum(_type5.FcrDeviceType);
const fcrChatRoomMessageTypeSchema = exports.fcrChatRoomMessageTypeSchema = _imports.z.nativeEnum(_type4.FcrChatRoomMessageType);
// Native Enum Schemas
const fcrMediaStreamTypeSchema = exports.fcrMediaStreamTypeSchema = _imports.z.nativeEnum(_imports.AgoraRteMediaStreamType);
const fcrVideoSourceTypeSchema = exports.fcrVideoSourceTypeSchema = _imports.z.nativeEnum(_imports.AgoraRteVideoSourceType);
const fcrMediaSourceStateSchema = exports.fcrMediaSourceStateSchema = _imports.z.nativeEnum(_imports.AgoraRtcMediaSourceState);
const fcrCapabilitySchema = exports.fcrCapabilitySchema = _imports.z.nativeEnum(_imports.AgoraRtcCapability);
const fcrRenderModeSchema = exports.fcrRenderModeSchema = _imports.z.nativeEnum(_imports.AgoraRtcRenderMode);
const fcrEncryptionModeSchema = exports.fcrEncryptionModeSchema = _imports.z.nativeEnum(_imports.AgoraRtcEncryptionMode);
const fcrLatencyLevelTypeSchema = exports.fcrLatencyLevelTypeSchema = _imports.z.nativeEnum(_imports.AgoraRtcLatencyLevelType);
const fcrAudioSourceTypeSchema = exports.fcrAudioSourceTypeSchema = _imports.z.nativeEnum(_imports.AgoraRtcAudioSourceType);
const fcrVideoStreamTypeSchema = exports.fcrVideoStreamTypeSchema = _imports.z.nativeEnum(_imports.AgoraRtcVideoStreamType);
const fcrStreamPrivilegeAudioSourceTypeSchema = exports.fcrStreamPrivilegeAudioSourceTypeSchema = _imports.z.nativeEnum(_imports.AgoraRteStreamPrivilegeAudioSourceType);
const fcrScreenScenarioTypeSchema = exports.fcrScreenScenarioTypeSchema = _imports.z.nativeEnum(_imports.FcrScreenScenarioType);
const fcrStreamPrivilegeVideoSourceTypeSchema = exports.fcrStreamPrivilegeVideoSourceTypeSchema = _imports.z.nativeEnum(_imports.AgoraRteStreamPrivilegeVideoSourceType);
// Array Schemas
const fcrUserRolesSchema = exports.fcrUserRolesSchema = _imports.z.array(fcrUserRoleSchema);
const fcrPrivilegeUserRoleArraySchema = exports.fcrPrivilegeUserRoleArraySchema = _imports.z.array(fcrPrivilegeUserRoleSchema);
// Object Schemas
const fcrLanguageConfigSchema = exports.fcrLanguageConfigSchema = _imports.z.object({
sourceLanguage: fcrLanguageSchema,
targetLanguage: fcrLanguageSchema.optional()
});
const fcrSessionBaseSchema = exports.fcrSessionBaseSchema = _imports.z.object({
sessionId: _imports.stringSchema,
sessionKey: _imports.stringSchema,
timestamp: _imports.numberSchema,
duration: _imports.numberSchema,
payload: stringKeyUnknownValueSchema,
senderId: _imports.stringSchema,
interval: _imports.numberSchema
});
const fcrInterpreterUsersParamsSchema = exports.fcrInterpreterUsersParamsSchema = _imports.z.object({
userId: _imports.stringSchema,
sourceLanguage: fcrLanguageSchema,
targetLanguage: fcrLanguageSchema
});
const fcrSecurityPrivateChatConfigSchema = exports.fcrSecurityPrivateChatConfigSchema = _imports.z.object({
host: _imports.booleanSchema,
cohost: _imports.booleanSchema,
participant: _imports.booleanSchema
});
const fcrSecuritySendChatPayloadSchema = exports.fcrSecuritySendChatPayloadSchema = _imports.z.object({
public: _imports.booleanSchema,
private: fcrSecurityPrivateChatConfigSchema
});
const fcrPhoneConnectorSessionParamsSchema = exports.fcrPhoneConnectorSessionParamsSchema = _imports.z.object({
phoneNumber: _imports.stringSchema,
userName: _imports.stringSchema,
phoneUserId: _imports.stringSchema.optional()
});
const fcrIPConnectorSessionParamsSchema = exports.fcrIPConnectorSessionParamsSchema = _imports.z.object({
address: _imports.stringSchema,
type: fcrIPConnectorSessionTypeSchema
});
const fcrRoomSessionParamsSchema = exports.fcrRoomSessionParamsSchema = _imports.z.object({
sessionKey: _imports.stringSchema,
duration: _imports.numberSchema,
payload: stringKeyUnknownValueSchema
});
const colorSchema = exports.colorSchema = _imports.z.object({
r: _imports.numberSchema,
g: _imports.numberSchema,
b: _imports.numberSchema,
a: _imports.numberSchema.optional()
});
const fcrPeerSessionParamsSchema = exports.fcrPeerSessionParamsSchema = _imports.z.object({
sessionKey: _imports.stringSchema,
receiverId: _imports.stringSchema,
duration: _imports.numberSchema,
payload: stringKeyUnknownValueSchema
});
const fcrGroupCreateConfigSchema = exports.fcrGroupCreateConfigSchema = _imports.z.object({
groupName: _imports.stringSchema,
userList: stringArraySchema
});
// Chat Room Schemas
const fcrChatRoomSendBaseMessageSchema = exports.fcrChatRoomSendBaseMessageSchema = _imports.z.object({
type: fcrChatRoomMessageTypeSchema,
properties: stringKeyUnknownValueSchema.optional(),
to: stringArraySchema.optional()
});
const fcrChatRoomSendTextMessageSchema = exports.fcrChatRoomSendTextMessageSchema = _imports.z.object({
content: _imports.stringSchema
}).merge(fcrChatRoomSendBaseMessageSchema);
const fcrChatRoomFileSchema = exports.fcrChatRoomFileSchema = _imports.z.object({
fileName: _imports.stringSchema,
fileType: _imports.stringSchema,
filePath: _imports.stringSchema.optional(),
data: _imports.anySchema.optional()
});
const fcrChatRoomSendImageMessageSchema = exports.fcrChatRoomSendImageMessageSchema = _imports.z.object({
file: fcrChatRoomFileSchema
}).merge(fcrChatRoomSendBaseMessageSchema);
const messageSchema = exports.messageSchema = _imports.z.union([fcrChatRoomSendTextMessageSchema, fcrChatRoomSendImageMessageSchema]);
const progressSchema = exports.progressSchema = _imports.z.function().args(_imports.z.number()) // 定义参数类型
.returns(_imports.z.void()) // 定义返回值类型
.describe('A callback function that takes a progress and returns void');
// RTC Schemas
const agoraRtcEncryptionConfig = exports.agoraRtcEncryptionConfig = _imports.z.object({
encryptionKey: _imports.stringSchema,
encryptionMode: fcrEncryptionModeSchema
});
const AgoraRtcDimensions = exports.AgoraRtcDimensions = _imports.z.object({
width: _imports.numberSchema,
height: _imports.numberSchema
});
const agoraRtcVideoEncoderConfigurationSchema = exports.agoraRtcVideoEncoderConfigurationSchema = _imports.z.object({
dimensions: AgoraRtcDimensions,
frameRate: _imports.numberSchema,
bitrate: _imports.numberSchema,
isMirror: _imports.booleanSchema
});
// Stream Config Schemas
const fcrStreamJoinConfig = exports.fcrStreamJoinConfig = _imports.z.object({
videoEncoderConfig: agoraRtcVideoEncoderConfigurationSchema.optional(),
videoSourceId: _imports.stringSchema.optional(),
audioSourceId: _imports.stringSchema.optional(),
streamName: _imports.stringSchema.optional(),
streamType: fcrMediaStreamTypeSchema,
videoSourceType: fcrVideoSourceTypeSchema,
audioSourceType: fcrAudioSourceTypeSchema,
audioSourceState: fcrMediaSourceStateSchema.optional(),
videoSourceState: fcrMediaSourceStateSchema.optional()
});
const fcrRoomJoinOptionsSchema = exports.fcrRoomJoinOptionsSchema = _imports.z.object({
userName: _imports.stringSchema,
userRole: fcrUserRoleSchema,
userProperties: stringKeyUnknownValueSchema.optional(),
roomToken: _imports.stringSchema,
streamLatency: fcrLatencyLevelTypeSchema,
streamEncryptionConfig: agoraRtcEncryptionConfig.optional(),
createStreamConfigs: _imports.z.array(fcrStreamJoinConfig),
password: _imports.stringSchema.optional(),
platform: _imports.numberSchema.optional(),
avatar: _imports.stringSchema.optional()
});
// Other Schemas
const fcrRenderConfigSchema = exports.fcrRenderConfigSchema = _imports.z.object({
renderMode: fcrRenderModeSchema,
isMirror: _imports.booleanSchema
});
const fcrGroupUpdateOptionsSchema = exports.fcrGroupUpdateOptionsSchema = _imports.z.object({
groupId: _imports.stringSchema,
groupName: _imports.stringSchema
});
const fcrRoomJoinOptionsWithTicketSchema = exports.fcrRoomJoinOptionsWithTicketSchema = _imports.z.object({
ticket: _imports.stringSchema.optional()
}).merge(fcrRoomJoinOptionsSchema);
const fcrMediaStreamCreateConfigSchema = exports.fcrMediaStreamCreateConfigSchema = _imports.z.object({
streamName: _imports.stringSchema,
streamType: fcrMediaStreamTypeSchema,
videoSourceType: fcrVideoSourceTypeSchema,
audioSourceType: fcrAudioSourceTypeSchema,
ownerId: _imports.stringSchema,
videoSourceId: _imports.stringSchema,
audioSourceId: _imports.stringSchema,
generateToken: _imports.booleanSchema.optional()
});
const fcrStreamBindConfigSchema = exports.fcrStreamBindConfigSchema = _imports.z.object({
streamId: _imports.stringSchema,
videoSourceId: _imports.stringSchema.optional(),
audioSourceId: _imports.stringSchema.optional()
});
// Array Collection Schemas
const fcrScreenStreamCreateConfigSchema = exports.fcrScreenStreamCreateConfigSchema = _imports.z.object({
streamType: fcrMediaStreamTypeSchema,
audioDeviceName: _imports.stringSchema.optional(),
videoSourceId: _imports.stringSchema.optional(),
audioSourceId: _imports.stringSchema.optional()
});
const fcrScreenStreamCreateConfigSize = exports.fcrScreenStreamCreateConfigSize = _imports.z.object({
width: _imports.numberSchema,
height: _imports.numberSchema
});
const fcrSizeSchema = exports.fcrSizeSchema = _imports.z.object({
width: _imports.numberSchema,
height: _imports.numberSchema
}).optional();
const fcrGroupCreateConfigArraySchema = exports.fcrGroupCreateConfigArraySchema = _imports.z.array(fcrGroupCreateConfigSchema);
const fcrGroupUpdateOptionsArraySchema = exports.fcrGroupUpdateOptionsArraySchema = _imports.z.array(fcrGroupUpdateOptionsSchema);
const fcrLocalStreamCreateArrayConfigSchema = exports.fcrLocalStreamCreateArrayConfigSchema = _imports.z.array(fcrMediaStreamCreateConfigSchema);
const fcrInterpreterUsersParamsArraySchema = exports.fcrInterpreterUsersParamsArraySchema = _imports.z.array(fcrInterpreterUsersParamsSchema);
const fcrStreamBindConfigArrySchema = exports.fcrStreamBindConfigArrySchema = _imports.z.array(fcrStreamBindConfigSchema);
const fcrUpdateStreamPrivilegeScopeSchema = exports.fcrUpdateStreamPrivilegeScopeSchema = _imports.z.object({
videoSourceType: fcrStreamPrivilegeVideoSourceTypeSchema.optional(),
audioSourceType: fcrStreamPrivilegeAudioSourceTypeSchema.optional(),
targetRoleType: _imports.z.array(fcrUserRoleSchema),
targetRoleTypeIsInclude: _imports.booleanSchema
});
const fcrUpdateStreamCustomSchema = exports.fcrUpdateStreamCustomSchema = _imports.z.custom(obj => {
const hasBothInSelf = Object.keys(obj).includes('videoPrivilege') && Object.keys(obj).includes('audioPrivilege');
if (hasBothInSelf) {
return true;
}
return Object.values(obj).some(value => {
if (typeof value === 'object' && value !== null && !Array.isArray(value)) {
return Object.keys(value).includes('videoPrivilege') && Object.keys(value).includes('audioPrivilege');
}
return false;
});
});
const fcrMobileDeviceIdOrNameSchema = exports.fcrMobileDeviceIdOrNameSchema = _imports.z.string().optional();