@rongcloud/engine 5.2.0-alpha.1 → 5.2.1-alpha.1

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/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  /*
2
- * RCEngine - v5.2.0-alpha.1
3
- * CommitId - 68fc235a96486a3750698a56d22643a1093aa1c5
4
- * Tue Jan 18 2022 19:55:05 GMT+0800 (China Standard Time)
2
+ * RCEngine - v5.2.1-alpha.1
3
+ * CommitId - c92d4d82612fce55930384270b7c9e99cba689a2
4
+ * Mon Mar 07 2022 10:08:54 GMT+0800 (China Standard Time)
5
5
  * ©2020 RongCloud, Inc. All rights reserved.
6
6
  */
7
7
  /**
@@ -1432,6 +1432,10 @@ declare enum ErrorCode {
1432
1432
  * 消息数量没在范围内
1433
1433
  */
1434
1434
  MSG_LIMIT_ERROR = 35013,
1435
+ /**
1436
+ * 该功能仅支持超级群
1437
+ */
1438
+ METHOD_ONLY_SUPPORT_ULTRA_GROUP = 35014,
1435
1439
  /**
1436
1440
  * 上传文件失败
1437
1441
  */
@@ -1793,6 +1797,10 @@ interface IBaseConversationInfo {
1793
1797
  targetId: string;
1794
1798
  channelId: string;
1795
1799
  }
1800
+ interface IConversationState extends IBaseConversationInfo {
1801
+ unreadCount: number;
1802
+ unreadMentionedCount: number;
1803
+ }
1796
1804
 
1797
1805
  /**
1798
1806
  * 导航信息数据就结构
@@ -2281,6 +2289,10 @@ interface IRTCUsers {
2281
2289
  * 发布的资源数据,是一个 JSON 字符串,解析后为发布的资源列表
2282
2290
  */
2283
2291
  uris?: string;
2292
+ /**
2293
+ * 加房间的身份标识,保存主房间 roomId
2294
+ */
2295
+ extra?: string;
2284
2296
  };
2285
2297
  };
2286
2298
  }
@@ -2296,6 +2308,12 @@ interface IJoinRTCRoomData extends IRTCUsers {
2296
2308
  interface KVString {
2297
2309
  [key: string]: string;
2298
2310
  }
2311
+ /**
2312
+ * 设置 RTC 人员 inner、outer 数据
2313
+ */
2314
+ interface IRTCUserData {
2315
+ [key: string]: string;
2316
+ }
2299
2317
 
2300
2318
  interface IAsyncRes<T = any> {
2301
2319
  /**
@@ -2973,8 +2991,9 @@ interface IEngine {
2973
2991
  * 建立连接
2974
2992
  * @param token
2975
2993
  * @param naviInfo
2994
+ * @param reconnectKickEnable
2976
2995
  */
2977
- connect(token: string, naviInfo: INaviInfo, versionInfo: string): Promise<ErrorCode>;
2996
+ connect(token: string, naviInfo: INaviInfo, reconnectKickEnable?: boolean): Promise<ErrorCode>;
2978
2997
  /**
2979
2998
  * 上报版本信息
2980
2999
  * @param version
@@ -3149,8 +3168,9 @@ interface IEngine {
3149
3168
  * @param isPersited 是否存储
3150
3169
  * @param isCounted 是否技术
3151
3170
  * @param searchProps 搜索字段,只在搭配协议栈使用时有效
3171
+ * @param isStatusMessage 是否是状态消息
3152
3172
  */
3153
- registerMessageType(objectName: string, isPersited: boolean, isCounted: boolean, searchProps: string[]): void;
3173
+ registerMessageType(objectName: string, isPersited: boolean, isCounted: boolean, searchProps: string[], isStatusMessage: boolean): void;
3154
3174
  /**
3155
3175
  * 加入聊天室
3156
3176
  * @param count 拉取消息数量
@@ -3434,7 +3454,7 @@ interface IEngine {
3434
3454
  * 获取所有群聊会话 @ 消息未读数
3435
3455
  */
3436
3456
  getAllUnreadMentionedCount(): Promise<IAsyncRes<number>>;
3437
- joinRTCRoom(roomId: string, mode: RTCMode, broadcastType?: number): IPromiseResult<IJoinRTCRoomData>;
3457
+ joinRTCRoom(roomId: string, mode: RTCMode, broadcastType?: number, joinType?: RTCJoinType, innerUserDatas?: IRTCUserData, outerUserDatas?: IRTCUserData): IPromiseResult<IJoinRTCRoomData>;
3438
3458
  quitRTCRoom(roomId: string): Promise<ErrorCode>;
3439
3459
  rtcPing(roomId: string, mode: number, broadcastType?: number): Promise<ErrorCode>;
3440
3460
  getRTCRoomInfo(roomId: string): IPromiseResult<IRTCRoomInfo>;
@@ -3841,7 +3861,7 @@ declare class DataCodec {
3841
3861
  /**
3842
3862
  * 加入 RTC 房间
3843
3863
  */
3844
- encodeJoinRTCRoom(mode: RTCMode, broadcastType?: number, joinType?: RTCJoinType): any[];
3864
+ encodeJoinRTCRoom(mode: RTCMode, broadcastType?: number, joinType?: RTCJoinType, innerUserDatas?: IRTCUserData, outerUserDatas?: IRTCUserData): any[];
3845
3865
  /**
3846
3866
  * 退出 RTC 房间
3847
3867
  */
@@ -4129,8 +4149,8 @@ interface IWatcher {
4129
4149
  pullFinished?: ITagListener;
4130
4150
  onConnecting?: () => void;
4131
4151
  onConnected?: () => void;
4132
- onDisconnect?: () => void;
4133
- onSuspend?: () => void;
4152
+ onDisconnect?: (status: ConnectionStatus) => void;
4153
+ onSuspend?: (status: ConnectionStatus | ErrorCode) => void;
4134
4154
  readReceiptReceived?: (conversation: IConversationOption, messageUId: string, sentTime: number) => void;
4135
4155
  messageReceiptRequest?: (conversation: IConversationOption, messageUId: string, senderUserId: string) => void;
4136
4156
  messageReceiptResponse?: (conversation: IConversationOption, receivedUserId: string, messageUIdList: string[]) => void;
@@ -4252,8 +4272,8 @@ declare class APIContext {
4252
4272
  private _connectionStatusListener;
4253
4273
  _handleConnecting(): void;
4254
4274
  _handleConnected(): void;
4255
- _handleDisconnect(): void;
4256
- _handleSuspend(): void;
4275
+ _handleDisconnect(status: ConnectionStatus): void;
4276
+ _handleSuspend(status: ConnectionStatus | ErrorCode): void;
4257
4277
  private _messageReceiver;
4258
4278
  _batchMessageReceiver(messages: IReceivedMessage[], leftCount?: number, hasMore?: boolean): void;
4259
4279
  /**
@@ -4320,14 +4340,22 @@ declare class APIContext {
4320
4340
  * 建立连接,连接失败则抛出异常,连接成功后返回用户 userId,否则返回相应的错误码
4321
4341
  * @param token
4322
4342
  * @param refreshNavi 是否需要重新请求导航,当值为 `false` 时,优先使用有效缓存导航,若缓存失效则重新获取导航
4343
+ * @param reconnectKickEnable 设置断线重连时是否踢出当前正在重连的设备 (仅 Electron 环境有效)
4344
+ * 同一个账号在一台新设备上登录的时候,会把这个账号在之前登录的设备上踢出。
4345
+ 由于 SDK 有断线重连功能,存在下面情况。
4346
+ 用户在 A 设备登录,A 设备网络不稳定,没有连接成功,SDK 启动重连机制。
4347
+ 用户此时又在 B 设备登录,B 设备连接成功。
4348
+ A 设备网络稳定之后,用户在 A 设备连接成功,B 设备被踢出。
4349
+ 这个字段就是为这种情况加的。
4350
+ 设置 reconnectKickEnable 为 true 时,SDK 重连的时候发现此时已有别的设备连接成功,不再强行踢出已有设备,而是踢出重连设备。
4323
4351
  */
4324
- connect(token: string, refreshNavi?: boolean): Promise<IConnectResult>;
4352
+ connect(token: string, refreshNavi?: boolean, reconnectKickEnable?: boolean): Promise<IConnectResult>;
4325
4353
  /**
4326
4354
  * 拉取实时配置 web 端需更新 voipCall 字段
4327
4355
  */
4328
4356
  private _pullUserSettings;
4329
4357
  disconnect(): Promise<void>;
4330
- reconnect(): Promise<IConnectResult>;
4358
+ reconnect(reconnectKickEnable?: boolean): Promise<IConnectResult>;
4331
4359
  private _getTokenWithoutNavi;
4332
4360
  /**
4333
4361
  * 获取当前缓存的导航数据
@@ -4340,8 +4368,9 @@ declare class APIContext {
4340
4368
  * @param isPersited 是否存储
4341
4369
  * @param isCounted 是否技术
4342
4370
  * @param searchProps 搜索字段,只在搭配协议栈使用时有效
4371
+ * @param isStatusMessage 是否是状态消息
4343
4372
  */
4344
- registerMessageType(objectName: string, isPersited: boolean, isCounted: boolean, searchProps?: string[]): void;
4373
+ registerMessageType(objectName: string, isPersited: boolean, isCounted: boolean, searchProps?: string[], isStatusMessage?: boolean): void;
4345
4374
  /**
4346
4375
  * 发送消息
4347
4376
  * @param conversationType
@@ -4694,6 +4723,7 @@ declare class APIContext {
4694
4723
  * @param targetId
4695
4724
  */
4696
4725
  getUltraGroupUnreadMentionedCountByTargetId(targetId: string): Promise<IAsyncRes<number>>;
4726
+ getAllConversationState(): Promise<IAsyncRes<IConversationState[]>>;
4697
4727
  /**
4698
4728
  * 调用非标准方法。所谓非标准方法,是为某些特定需求或产品添加,暂未作为标准接口添加至 API 层。
4699
4729
  * 对于未实现的方法,接口响应 Unsupport 错误码
@@ -4800,7 +4830,7 @@ declare class APIContext {
4800
4830
  * @param mode 房间模式:直播 or 会议
4801
4831
  * @param mediaType 直播房间模式下的媒体资源类型
4802
4832
  */
4803
- joinRTCRoom(roomId: string, mode: RTCMode, mediaType?: number, joinType?: RTCJoinType): Promise<IAsyncRes<IJoinRTCRoomData>>;
4833
+ joinRTCRoom(roomId: string, mode: RTCMode, mediaType?: number, joinType?: RTCJoinType, innerUserDatas?: IRTCUserData, outerUserDatas?: IRTCUserData): Promise<IAsyncRes<IJoinRTCRoomData>>;
4804
4834
  quitRTCRoom(roomId: string): Promise<ErrorCode>;
4805
4835
  rtcPing(roomId: string, mode: number, mediaType?: number): Promise<ErrorCode>;
4806
4836
  getRTCRoomInfo(roomId: string): Promise<IAsyncRes<IRTCRoomInfo>>;
@@ -4867,6 +4897,14 @@ declare class APIContext {
4867
4897
  declare class PluginContext {
4868
4898
  protected readonly _context: APIContext;
4869
4899
  constructor(_context: APIContext);
4900
+ /**
4901
+ * 获取 context
4902
+ */
4903
+ __getContext(): APIContext;
4904
+ /**
4905
+ * 获取当前的导航数据
4906
+ */
4907
+ getNaviInfo(): INaviInfo | null;
4870
4908
  /**
4871
4909
  * 接收 IM 服务推送的消息,并通过返回 boolean 值决定此消息是否拦截
4872
4910
  * @param message
@@ -4950,8 +4988,9 @@ declare class RTCPluginContext extends PluginContext {
4950
4988
  * @param roomId
4951
4989
  * @param mode 房间模式:直播 or 会议
4952
4990
  * @param broadcastType
4991
+ * @param innerUserData 加副房间时的主房间 Id
4953
4992
  */
4954
- joinRTCRoom(roomId: string, mode: RTCMode, broadcastType?: number, joinType?: RTCJoinType): IPromiseResult<IJoinRTCRoomData>;
4993
+ joinRTCRoom(roomId: string, mode: RTCMode, broadcastType?: number, joinType?: RTCJoinType, innerUserDatas?: IRTCUserData, outerUserDatas?: IRTCUserData): IPromiseResult<IJoinRTCRoomData>;
4955
4994
  quitRTCRoom(roomId: string): Promise<ErrorCode>;
4956
4995
  rtcPing(roomId: string, mode: number, broadcastType?: number): Promise<ErrorCode>;
4957
4996
  getRTCRoomInfo(roomId: string): IPromiseResult<IRTCRoomInfo>;
@@ -5137,8 +5176,9 @@ declare abstract class AEngine implements IEngine {
5137
5176
  * 建立连接
5138
5177
  * @param token
5139
5178
  * @param naviInfo
5179
+ * @param reconnectKickEnable
5140
5180
  */
5141
- abstract connect(token: string, naviInfo: INaviInfo): Promise<ErrorCode>;
5181
+ abstract connect(token: string, naviInfo: INaviInfo, reconnectKickEnable?: boolean): Promise<ErrorCode>;
5142
5182
  /**
5143
5183
  * 发送SDK版本
5144
5184
  * @param versionInfo
@@ -5323,8 +5363,9 @@ declare abstract class AEngine implements IEngine {
5323
5363
  * @param isPersited 是否存储
5324
5364
  * @param isCounted 是否技术
5325
5365
  * @param searchProps 搜索字段,只在搭配协议栈使用时有效
5366
+ * @param isStatusMessage 是否是状态消息
5326
5367
  */
5327
- abstract registerMessageType(objectName: string, isPersited: boolean, isCounted: boolean, searchProps: string[]): void;
5368
+ abstract registerMessageType(objectName: string, isPersited: boolean, isCounted: boolean, searchProps: string[], isStatusMessage: boolean): void;
5328
5369
  /**
5329
5370
  * 加入聊天室
5330
5371
  * @param count 拉取消息数量
@@ -5668,7 +5709,11 @@ declare abstract class AEngine implements IEngine {
5668
5709
  * 获取所有群聊会话 @ 消息未读数
5669
5710
  */
5670
5711
  abstract getAllUnreadMentionedCount(): Promise<IAsyncRes<number>>;
5671
- abstract joinRTCRoom(roomId: string, mode: RTCMode, broadcastType?: number, joinType?: RTCJoinType): IPromiseResult<IJoinRTCRoomData>;
5712
+ /**
5713
+ * 获取本地全部会话的状态
5714
+ */
5715
+ abstract getAllConversationState(): Promise<IAsyncRes<IConversationState[]>>;
5716
+ abstract joinRTCRoom(roomId: string, mode: RTCMode, broadcastType?: number, joinType?: RTCJoinType, innerUserDatas?: IRTCUserData, outerUserDatas?: IRTCUserData): IPromiseResult<IJoinRTCRoomData>;
5672
5717
  abstract quitRTCRoom(roomId: string): Promise<ErrorCode>;
5673
5718
  abstract rtcPing(roomId: string, mode: number, broadcastType?: number): Promise<ErrorCode>;
5674
5719
  abstract getRTCRoomInfo(roomId: string): IPromiseResult<IRTCRoomInfo>;
@@ -5959,6 +6004,10 @@ declare const isValidConversationType: (conversation: number) => boolean;
5959
6004
  * 判断是否是一个有效的文件类型
5960
6005
  */
5961
6006
  declare const isValidFileType: (fileType: number) => boolean;
6007
+ /**
6008
+ * 判断是否是一个合法的消息扩展
6009
+ */
6010
+ declare const isValidExpansion: (expansion: any) => boolean;
5962
6011
 
5963
6012
  /**
5964
6013
  * 预定义的验证规则,只包含`值类型`数据验证
@@ -6181,4 +6230,4 @@ declare enum CONNECTION_TYPE {
6181
6230
  */
6182
6231
  declare const version: string;
6183
6232
 
6184
- export { AEngine, ANavi, APIContext, AppStorage, AssertRules, CONNECTION_TYPE, CPP_PROTOCAL_MSGTYPE_OPTION, CallLibMsgType, ChatroomEntryType, ChatroomUserChangeType as ChatroomMemberChangeType, CometChannel, ConnectResultCode, ConnectionStatus, ConversationType, DelayTimer, ErrorCode, EventEmitter, FileType, HttpMethod, IAPIContextOption, IAsyncRes, IBaseConversationInfo, IBlockedMessageInfo, ICancelRoomPKOptions, IChatRoomEntries, IChatRoomEntry, IChatroomEntries, IChatroomEntry, IChatroomInfo, IChatroomListener, IChatroomListenerData, IChrmKVEntries, IChrmKVEntry, IConnectResult, IConnectionStatusListener, IConversationOption, IConversationStateListener, IConversationTag, IConversationTagListener, IDataChannelWatcher, IDeletedExpansion, IEndRoomPKOptions, IEngine, IEngineWatcher, IEventListener, IExpansionListener, IExpansionListenerData, IExpansionMsgContent, IExtraMethod, IInsertMsgOptions, IJoinRTCRoomData, ILocalReadReceiptInfo, ILocalTagStatus, IM_COMET_PULLMSG_TIMEOUT, IM_PING_INTERVAL_TIME, IM_PING_MIN_TIMEOUT, IM_PING_TIMEOUT, IM_SIGNAL_TIMEOUT, IMessageListnenr, IMessageReader, IMessageReaderResponse, IMetionedData, INaviInfo, IPluginGenerator, IPromiseResult, IPushConfig, IRTCInnerListener, IRTCJoinedInfo, IRTCRoomInfo, IRTCUsers, IReadReceiptInfo, IRecallMsgOptions, IReceivedConversation, IReceivedConversationByTag, IReceivedMessage, IRemoveChatRoomEntries, IRemoveChatRoomEntry, IRemoveChatroomEntries, IRemoveChatroomEntry, IReqRoomPKOptions, IRequest, IResRoomPKOptions, IResponse, IRtcTokenData, IRuntime, ISendExMsgOptions, ISendMsgOptions, IServerConversationStatus, IServerRTCRoomEntry, IServerUserSetting, ISetConversationStatusOptions, IStorage, ITagInfo, ITagListener, ITagParam, ITagStatus, ITypingInfo, ITypingMessage, ITypingUser, IUltraExMsgOptions, IUltraModifyMsgOptions, IUpdatedConversation, IUpdatedExpansion, IUploadAuth, IUserProfile, IWatcher, IWebSocket, ItypingStateListener, KVString, LiveRole, LiveType, LogLevel, LogType, Logger, MAX_MESSAGE_CONTENT_BYTES, MINI_COMET_CONNECT_URIS, MINI_SOCKET_CONNECT_URIS, MentionedType, MessageBlockType, MessageDirection, MessageType, NAVI_CACHE_DURATION, NAVI_REQ_TIMEOUT, NotificationStatus, PING_REQ_TIMEOUT, PUBLIC_CLOUD_NAVI_URIS, PluginContext, RCAssertError, RTCApiType, RTCIdentityChangeType, RTCJoinType, RTCMode, RTCPluginContext, ReceivedStatus, SEND_MESSAGE_TYPE_OPTION, STATUS_MESSAGE, STORAGE_ROOT_KEY, TagChangeType, UploadMethod, VersionManage, WEB_SOCKET_TIMEOUT, WebSocketChannel, appendUrl, assert, clone, cloneByJSON, forEach, formatConnectResponseCode, getBrowser, getMimeKey, getUploadFileName, indexOf, isArray, isArrayBuffer, isBoolean, isFunction, isHttpUrl, isInObject, isInclude, isNull, isNumber, isObject, isString, isUndefined, isValidChrmEntryKey, isValidChrmEntryValue, isValidConversationType, isValidFileType, map, notEmptyArray, notEmptyObject, notEmptyString, pushConfigsToJSON, pushJSONToConfigs, todo, usingCppEngine, validate, version };
6233
+ export { AEngine, ANavi, APIContext, AppStorage, AssertRules, CONNECTION_TYPE, CPP_PROTOCAL_MSGTYPE_OPTION, CallLibMsgType, ChatroomEntryType, ChatroomUserChangeType as ChatroomMemberChangeType, CometChannel, ConnectResultCode, ConnectionStatus, ConversationType, DelayTimer, ErrorCode, EventEmitter, FileType, HttpMethod, IAPIContextOption, IAsyncRes, IBaseConversationInfo, IBlockedMessageInfo, ICancelRoomPKOptions, IChatRoomEntries, IChatRoomEntry, IChatroomEntries, IChatroomEntry, IChatroomInfo, IChatroomListener, IChatroomListenerData, IChrmKVEntries, IChrmKVEntry, IConnectResult, IConnectionStatusListener, IConversationOption, IConversationState, IConversationStateListener, IConversationTag, IConversationTagListener, IDataChannelWatcher, IDeletedExpansion, IEndRoomPKOptions, IEngine, IEngineWatcher, IEventListener, IExpansionListener, IExpansionListenerData, IExpansionMsgContent, IExtraMethod, IInsertMsgOptions, IJoinRTCRoomData, ILocalReadReceiptInfo, ILocalTagStatus, IM_COMET_PULLMSG_TIMEOUT, IM_PING_INTERVAL_TIME, IM_PING_MIN_TIMEOUT, IM_PING_TIMEOUT, IM_SIGNAL_TIMEOUT, IMessageListnenr, IMessageReader, IMessageReaderResponse, IMetionedData, INaviInfo, IPluginGenerator, IPromiseResult, IPushConfig, IRTCInnerListener, IRTCJoinedInfo, IRTCRoomInfo, IRTCUserData, IRTCUsers, IReadReceiptInfo, IRecallMsgOptions, IReceivedConversation, IReceivedConversationByTag, IReceivedMessage, IRemoveChatRoomEntries, IRemoveChatRoomEntry, IRemoveChatroomEntries, IRemoveChatroomEntry, IReqRoomPKOptions, IRequest, IResRoomPKOptions, IResponse, IRtcTokenData, IRuntime, ISendExMsgOptions, ISendMsgOptions, IServerConversationStatus, IServerRTCRoomEntry, IServerUserSetting, ISetConversationStatusOptions, IStorage, ITagInfo, ITagListener, ITagParam, ITagStatus, ITypingInfo, ITypingMessage, ITypingUser, IUltraExMsgOptions, IUltraModifyMsgOptions, IUpdatedConversation, IUpdatedExpansion, IUploadAuth, IUserProfile, IWatcher, IWebSocket, ItypingStateListener, KVString, LiveRole, LiveType, LogLevel, LogType, Logger, MAX_MESSAGE_CONTENT_BYTES, MINI_COMET_CONNECT_URIS, MINI_SOCKET_CONNECT_URIS, MentionedType, MessageBlockType, MessageDirection, MessageType, NAVI_CACHE_DURATION, NAVI_REQ_TIMEOUT, NotificationStatus, PING_REQ_TIMEOUT, PUBLIC_CLOUD_NAVI_URIS, PluginContext, RCAssertError, RTCApiType, RTCIdentityChangeType, RTCJoinType, RTCMode, RTCPluginContext, ReceivedStatus, SEND_MESSAGE_TYPE_OPTION, STATUS_MESSAGE, STORAGE_ROOT_KEY, TagChangeType, UploadMethod, VersionManage, WEB_SOCKET_TIMEOUT, WebSocketChannel, appendUrl, assert, clone, cloneByJSON, forEach, formatConnectResponseCode, getBrowser, getMimeKey, getUploadFileName, indexOf, isArray, isArrayBuffer, isBoolean, isFunction, isHttpUrl, isInObject, isInclude, isNull, isNumber, isObject, isString, isUndefined, isValidChrmEntryKey, isValidChrmEntryValue, isValidConversationType, isValidExpansion, isValidFileType, map, notEmptyArray, notEmptyObject, notEmptyString, pushConfigsToJSON, pushJSONToConfigs, todo, usingCppEngine, validate, version };