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

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.2
3
- * CommitId - d019850f365470868589d4566cc4194fd2b14c73
4
- * Mon Jan 24 2022 17:46:21 GMT+0800 (China Standard Time)
2
+ * RCEngine - v5.2.1-alpha.2
3
+ * CommitId - dd7ef7feba5b7d52ab85eca736707953c9652394
4
+ * Tue Mar 08 2022 14:52:47 GMT+0800 (China Standard Time)
5
5
  * ©2020 RongCloud, Inc. All rights reserved.
6
6
  */
7
7
  /**
@@ -741,6 +741,10 @@ interface IReceivedMessage {
741
741
  * 超级群专有字段,是否断档,服务端收到大量消息可能会断档,所以消息存在此标志位,断档需要客户手动拉取历史消息
742
742
  */
743
743
  isInterrupt?: boolean;
744
+ /**
745
+ * 拉取历史消息时表示该消息是否修改过
746
+ */
747
+ isModifyMessage?: boolean;
744
748
  }
745
749
  interface IUserProfile {
746
750
  /**
@@ -1432,6 +1436,10 @@ declare enum ErrorCode {
1432
1436
  * 消息数量没在范围内
1433
1437
  */
1434
1438
  MSG_LIMIT_ERROR = 35013,
1439
+ /**
1440
+ * 该功能仅支持超级群
1441
+ */
1442
+ METHOD_ONLY_SUPPORT_ULTRA_GROUP = 35014,
1435
1443
  /**
1436
1444
  * 上传文件失败
1437
1445
  */
@@ -1793,6 +1801,10 @@ interface IBaseConversationInfo {
1793
1801
  targetId: string;
1794
1802
  channelId: string;
1795
1803
  }
1804
+ interface IConversationState extends IBaseConversationInfo {
1805
+ unreadCount: number;
1806
+ unreadMentionedCount: number;
1807
+ }
1796
1808
 
1797
1809
  /**
1798
1810
  * 导航信息数据就结构
@@ -2281,6 +2293,10 @@ interface IRTCUsers {
2281
2293
  * 发布的资源数据,是一个 JSON 字符串,解析后为发布的资源列表
2282
2294
  */
2283
2295
  uris?: string;
2296
+ /**
2297
+ * 加房间的身份标识,保存主房间 roomId
2298
+ */
2299
+ extra?: string;
2284
2300
  };
2285
2301
  };
2286
2302
  }
@@ -2296,6 +2312,12 @@ interface IJoinRTCRoomData extends IRTCUsers {
2296
2312
  interface KVString {
2297
2313
  [key: string]: string;
2298
2314
  }
2315
+ /**
2316
+ * 设置 RTC 人员 inner、outer 数据
2317
+ */
2318
+ interface IRTCUserData {
2319
+ [key: string]: string;
2320
+ }
2299
2321
 
2300
2322
  interface IAsyncRes<T = any> {
2301
2323
  /**
@@ -2973,8 +2995,9 @@ interface IEngine {
2973
2995
  * 建立连接
2974
2996
  * @param token
2975
2997
  * @param naviInfo
2998
+ * @param reconnectKickEnable
2976
2999
  */
2977
- connect(token: string, naviInfo: INaviInfo, versionInfo: string): Promise<ErrorCode>;
3000
+ connect(token: string, naviInfo: INaviInfo, reconnectKickEnable?: boolean): Promise<ErrorCode>;
2978
3001
  /**
2979
3002
  * 上报版本信息
2980
3003
  * @param version
@@ -3149,8 +3172,9 @@ interface IEngine {
3149
3172
  * @param isPersited 是否存储
3150
3173
  * @param isCounted 是否技术
3151
3174
  * @param searchProps 搜索字段,只在搭配协议栈使用时有效
3175
+ * @param isStatusMessage 是否是状态消息
3152
3176
  */
3153
- registerMessageType(objectName: string, isPersited: boolean, isCounted: boolean, searchProps: string[]): void;
3177
+ registerMessageType(objectName: string, isPersited: boolean, isCounted: boolean, searchProps: string[], isStatusMessage: boolean): void;
3154
3178
  /**
3155
3179
  * 加入聊天室
3156
3180
  * @param count 拉取消息数量
@@ -3434,7 +3458,7 @@ interface IEngine {
3434
3458
  * 获取所有群聊会话 @ 消息未读数
3435
3459
  */
3436
3460
  getAllUnreadMentionedCount(): Promise<IAsyncRes<number>>;
3437
- joinRTCRoom(roomId: string, mode: RTCMode, broadcastType?: number): IPromiseResult<IJoinRTCRoomData>;
3461
+ joinRTCRoom(roomId: string, mode: RTCMode, broadcastType?: number, joinType?: RTCJoinType, innerUserDatas?: IRTCUserData, outerUserDatas?: IRTCUserData): IPromiseResult<IJoinRTCRoomData>;
3438
3462
  quitRTCRoom(roomId: string): Promise<ErrorCode>;
3439
3463
  rtcPing(roomId: string, mode: number, broadcastType?: number): Promise<ErrorCode>;
3440
3464
  getRTCRoomInfo(roomId: string): IPromiseResult<IRTCRoomInfo>;
@@ -3841,7 +3865,7 @@ declare class DataCodec {
3841
3865
  /**
3842
3866
  * 加入 RTC 房间
3843
3867
  */
3844
- encodeJoinRTCRoom(mode: RTCMode, broadcastType?: number, joinType?: RTCJoinType): any[];
3868
+ encodeJoinRTCRoom(mode: RTCMode, broadcastType?: number, joinType?: RTCJoinType, innerUserDatas?: IRTCUserData, outerUserDatas?: IRTCUserData): any[];
3845
3869
  /**
3846
3870
  * 退出 RTC 房间
3847
3871
  */
@@ -4129,8 +4153,8 @@ interface IWatcher {
4129
4153
  pullFinished?: ITagListener;
4130
4154
  onConnecting?: () => void;
4131
4155
  onConnected?: () => void;
4132
- onDisconnect?: () => void;
4133
- onSuspend?: () => void;
4156
+ onDisconnect?: (status: ConnectionStatus) => void;
4157
+ onSuspend?: (status: ConnectionStatus | ErrorCode) => void;
4134
4158
  readReceiptReceived?: (conversation: IConversationOption, messageUId: string, sentTime: number) => void;
4135
4159
  messageReceiptRequest?: (conversation: IConversationOption, messageUId: string, senderUserId: string) => void;
4136
4160
  messageReceiptResponse?: (conversation: IConversationOption, receivedUserId: string, messageUIdList: string[]) => void;
@@ -4252,8 +4276,8 @@ declare class APIContext {
4252
4276
  private _connectionStatusListener;
4253
4277
  _handleConnecting(): void;
4254
4278
  _handleConnected(): void;
4255
- _handleDisconnect(): void;
4256
- _handleSuspend(): void;
4279
+ _handleDisconnect(status: ConnectionStatus): void;
4280
+ _handleSuspend(status: ConnectionStatus | ErrorCode): void;
4257
4281
  private _messageReceiver;
4258
4282
  _batchMessageReceiver(messages: IReceivedMessage[], leftCount?: number, hasMore?: boolean): void;
4259
4283
  /**
@@ -4320,14 +4344,22 @@ declare class APIContext {
4320
4344
  * 建立连接,连接失败则抛出异常,连接成功后返回用户 userId,否则返回相应的错误码
4321
4345
  * @param token
4322
4346
  * @param refreshNavi 是否需要重新请求导航,当值为 `false` 时,优先使用有效缓存导航,若缓存失效则重新获取导航
4347
+ * @param reconnectKickEnable 设置断线重连时是否踢出当前正在重连的设备 (仅 Electron 环境有效)
4348
+ * 同一个账号在一台新设备上登录的时候,会把这个账号在之前登录的设备上踢出。
4349
+ 由于 SDK 有断线重连功能,存在下面情况。
4350
+ 用户在 A 设备登录,A 设备网络不稳定,没有连接成功,SDK 启动重连机制。
4351
+ 用户此时又在 B 设备登录,B 设备连接成功。
4352
+ A 设备网络稳定之后,用户在 A 设备连接成功,B 设备被踢出。
4353
+ 这个字段就是为这种情况加的。
4354
+ 设置 reconnectKickEnable 为 true 时,SDK 重连的时候发现此时已有别的设备连接成功,不再强行踢出已有设备,而是踢出重连设备。
4323
4355
  */
4324
- connect(token: string, refreshNavi?: boolean): Promise<IConnectResult>;
4356
+ connect(token: string, refreshNavi?: boolean, reconnectKickEnable?: boolean): Promise<IConnectResult>;
4325
4357
  /**
4326
4358
  * 拉取实时配置 web 端需更新 voipCall 字段
4327
4359
  */
4328
4360
  private _pullUserSettings;
4329
4361
  disconnect(): Promise<void>;
4330
- reconnect(): Promise<IConnectResult>;
4362
+ reconnect(reconnectKickEnable?: boolean): Promise<IConnectResult>;
4331
4363
  private _getTokenWithoutNavi;
4332
4364
  /**
4333
4365
  * 获取当前缓存的导航数据
@@ -4340,8 +4372,9 @@ declare class APIContext {
4340
4372
  * @param isPersited 是否存储
4341
4373
  * @param isCounted 是否技术
4342
4374
  * @param searchProps 搜索字段,只在搭配协议栈使用时有效
4375
+ * @param isStatusMessage 是否是状态消息
4343
4376
  */
4344
- registerMessageType(objectName: string, isPersited: boolean, isCounted: boolean, searchProps?: string[]): void;
4377
+ registerMessageType(objectName: string, isPersited: boolean, isCounted: boolean, searchProps?: string[], isStatusMessage?: boolean): void;
4345
4378
  /**
4346
4379
  * 发送消息
4347
4380
  * @param conversationType
@@ -4694,6 +4727,7 @@ declare class APIContext {
4694
4727
  * @param targetId
4695
4728
  */
4696
4729
  getUltraGroupUnreadMentionedCountByTargetId(targetId: string): Promise<IAsyncRes<number>>;
4730
+ getAllConversationState(): Promise<IAsyncRes<IConversationState[]>>;
4697
4731
  /**
4698
4732
  * 调用非标准方法。所谓非标准方法,是为某些特定需求或产品添加,暂未作为标准接口添加至 API 层。
4699
4733
  * 对于未实现的方法,接口响应 Unsupport 错误码
@@ -4800,7 +4834,7 @@ declare class APIContext {
4800
4834
  * @param mode 房间模式:直播 or 会议
4801
4835
  * @param mediaType 直播房间模式下的媒体资源类型
4802
4836
  */
4803
- joinRTCRoom(roomId: string, mode: RTCMode, mediaType?: number, joinType?: RTCJoinType): Promise<IAsyncRes<IJoinRTCRoomData>>;
4837
+ joinRTCRoom(roomId: string, mode: RTCMode, mediaType?: number, joinType?: RTCJoinType, innerUserDatas?: IRTCUserData, outerUserDatas?: IRTCUserData): Promise<IAsyncRes<IJoinRTCRoomData>>;
4804
4838
  quitRTCRoom(roomId: string): Promise<ErrorCode>;
4805
4839
  rtcPing(roomId: string, mode: number, mediaType?: number): Promise<ErrorCode>;
4806
4840
  getRTCRoomInfo(roomId: string): Promise<IAsyncRes<IRTCRoomInfo>>;
@@ -4867,6 +4901,14 @@ declare class APIContext {
4867
4901
  declare class PluginContext {
4868
4902
  protected readonly _context: APIContext;
4869
4903
  constructor(_context: APIContext);
4904
+ /**
4905
+ * 获取 context
4906
+ */
4907
+ __getContext(): APIContext;
4908
+ /**
4909
+ * 获取当前的导航数据
4910
+ */
4911
+ getNaviInfo(): INaviInfo | null;
4870
4912
  /**
4871
4913
  * 接收 IM 服务推送的消息,并通过返回 boolean 值决定此消息是否拦截
4872
4914
  * @param message
@@ -4950,8 +4992,9 @@ declare class RTCPluginContext extends PluginContext {
4950
4992
  * @param roomId
4951
4993
  * @param mode 房间模式:直播 or 会议
4952
4994
  * @param broadcastType
4995
+ * @param innerUserData 加副房间时的主房间 Id
4953
4996
  */
4954
- joinRTCRoom(roomId: string, mode: RTCMode, broadcastType?: number, joinType?: RTCJoinType): IPromiseResult<IJoinRTCRoomData>;
4997
+ joinRTCRoom(roomId: string, mode: RTCMode, broadcastType?: number, joinType?: RTCJoinType, innerUserDatas?: IRTCUserData, outerUserDatas?: IRTCUserData): IPromiseResult<IJoinRTCRoomData>;
4955
4998
  quitRTCRoom(roomId: string): Promise<ErrorCode>;
4956
4999
  rtcPing(roomId: string, mode: number, broadcastType?: number): Promise<ErrorCode>;
4957
5000
  getRTCRoomInfo(roomId: string): IPromiseResult<IRTCRoomInfo>;
@@ -5137,8 +5180,9 @@ declare abstract class AEngine implements IEngine {
5137
5180
  * 建立连接
5138
5181
  * @param token
5139
5182
  * @param naviInfo
5183
+ * @param reconnectKickEnable
5140
5184
  */
5141
- abstract connect(token: string, naviInfo: INaviInfo): Promise<ErrorCode>;
5185
+ abstract connect(token: string, naviInfo: INaviInfo, reconnectKickEnable?: boolean): Promise<ErrorCode>;
5142
5186
  /**
5143
5187
  * 发送SDK版本
5144
5188
  * @param versionInfo
@@ -5323,8 +5367,9 @@ declare abstract class AEngine implements IEngine {
5323
5367
  * @param isPersited 是否存储
5324
5368
  * @param isCounted 是否技术
5325
5369
  * @param searchProps 搜索字段,只在搭配协议栈使用时有效
5370
+ * @param isStatusMessage 是否是状态消息
5326
5371
  */
5327
- abstract registerMessageType(objectName: string, isPersited: boolean, isCounted: boolean, searchProps: string[]): void;
5372
+ abstract registerMessageType(objectName: string, isPersited: boolean, isCounted: boolean, searchProps: string[], isStatusMessage: boolean): void;
5328
5373
  /**
5329
5374
  * 加入聊天室
5330
5375
  * @param count 拉取消息数量
@@ -5668,7 +5713,11 @@ declare abstract class AEngine implements IEngine {
5668
5713
  * 获取所有群聊会话 @ 消息未读数
5669
5714
  */
5670
5715
  abstract getAllUnreadMentionedCount(): Promise<IAsyncRes<number>>;
5671
- abstract joinRTCRoom(roomId: string, mode: RTCMode, broadcastType?: number, joinType?: RTCJoinType): IPromiseResult<IJoinRTCRoomData>;
5716
+ /**
5717
+ * 获取本地全部会话的状态
5718
+ */
5719
+ abstract getAllConversationState(): Promise<IAsyncRes<IConversationState[]>>;
5720
+ abstract joinRTCRoom(roomId: string, mode: RTCMode, broadcastType?: number, joinType?: RTCJoinType, innerUserDatas?: IRTCUserData, outerUserDatas?: IRTCUserData): IPromiseResult<IJoinRTCRoomData>;
5672
5721
  abstract quitRTCRoom(roomId: string): Promise<ErrorCode>;
5673
5722
  abstract rtcPing(roomId: string, mode: number, broadcastType?: number): Promise<ErrorCode>;
5674
5723
  abstract getRTCRoomInfo(roomId: string): IPromiseResult<IRTCRoomInfo>;
@@ -6185,4 +6234,4 @@ declare enum CONNECTION_TYPE {
6185
6234
  */
6186
6235
  declare const version: string;
6187
6236
 
6188
- 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, isValidExpansion, isValidFileType, map, notEmptyArray, notEmptyObject, notEmptyString, pushConfigsToJSON, pushJSONToConfigs, todo, usingCppEngine, validate, version };
6237
+ 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 };