@rongcloud/engine 4.5.2 → 4.5.5

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 - v4.5.2
3
- * CommitId - ba81ca4a531f2c59a5e2f0cecb5e05aab7e03210
4
- * Thu Nov 25 2021 10:37:04 GMT+0800 (China Standard Time)
2
+ * RCEngine - v4.5.5
3
+ * CommitId - 995181d9e191b32bf0910367a205e604999e026a
4
+ * Wed Jan 26 2022 11:32:58 GMT+0800 (China Standard Time)
5
5
  * ©2020 RongCloud, Inc. All rights reserved.
6
6
  */
7
7
  /**
@@ -558,12 +558,17 @@ interface IUserProfile {
558
558
  name?: string;
559
559
  /**
560
560
  * 用户头像地址
561
+ * @deprecated
561
562
  */
562
563
  portraitUri?: string;
563
564
  /**
564
565
  * user info 中附加信息
565
566
  */
566
567
  extra?: string;
568
+ /**
569
+ * 用户头像地址(向移动端兼容)
570
+ */
571
+ portrait?: string;
567
572
  }
568
573
  /**
569
574
  * 发送消息时的可选项信息
@@ -1733,6 +1738,10 @@ interface IRequest {
1733
1738
  * @default 10 * 1000 毫秒
1734
1739
  */
1735
1740
  timeout?: number;
1741
+ /**
1742
+ * 期望返回的数据格式,如果为 json 则返回后会对返回的数据进行一次 JSON.parse, 在小程序平台需要
1743
+ */
1744
+ dataType?: 'json' | 'text' | 'base64' | 'arraybuffer';
1736
1745
  }
1737
1746
  interface IStorage {
1738
1747
  setItem(key: string, value: string): void;
@@ -1852,6 +1861,10 @@ declare class WebSocketChannel extends ADataChannel {
1852
1861
  * @param apiVersion - apiVersion 需符合 `/\d+(\.\d+){2}/` 规则
1853
1862
  */
1854
1863
  connect(appkey: string, token: string, hosts: string[], protocol: 'http' | 'https', apiVersion: string, protocolVer: ConnAckProtocolVer): Promise<ErrorCode>;
1864
+ /**
1865
+ * 发起连接请求
1866
+ */
1867
+ private _connect;
1855
1868
  /**
1856
1869
  * 当前累计心跳超时次数
1857
1870
  */
@@ -1901,6 +1914,7 @@ declare class CometChannel extends ADataChannel {
1901
1914
  * @returns
1902
1915
  */
1903
1916
  connect(appkey: string, token: string, hosts: string[], protocol: 'http' | 'https', apiVersion: string, protocolVer: ConnAckProtocolVer): Promise<ErrorCode>;
1917
+ private _connect;
1904
1918
  private _idCount;
1905
1919
  private _generateMessageId;
1906
1920
  sendCometData(writer: BaseWriter, timeout?: number): Promise<void>;
@@ -2936,6 +2950,24 @@ declare enum LogType {
2936
2950
  RTC = "RTC"
2937
2951
  }
2938
2952
 
2953
+ /**
2954
+ * 消息被拦截类型
2955
+ */
2956
+ declare enum MessageBlockType {
2957
+ /*!
2958
+ 全局敏感词:命中了融云内置的全局敏感词
2959
+ */
2960
+ GLOBAL = 1,
2961
+ /*!
2962
+ 自定义敏感词拦截:命中了客户在融云自定义的敏感词
2963
+ */
2964
+ CUSTOM = 2,
2965
+ /*!
2966
+ 第三方审核拦截:命中了第三方(数美)或模板路由决定不下发的状态
2967
+ */
2968
+ THIRD_PARTY = 3
2969
+ }
2970
+
2939
2971
  /**
2940
2972
  * 导航信息数据就结构
2941
2973
  */
@@ -3187,24 +3219,6 @@ interface ITypingMessage {
3187
3219
  list: Array<ITypingUser>;
3188
3220
  }
3189
3221
 
3190
- /**
3191
- * 消息被拦截类型
3192
- */
3193
- declare enum MessageBlockType {
3194
- /*!
3195
- 全局敏感词:命中了融云内置的全局敏感词
3196
- */
3197
- GLOBAL = 1,
3198
- /*!
3199
- 自定义敏感词拦截:命中了客户在融云自定义的敏感词
3200
- */
3201
- CUSTOM = 2,
3202
- /*!
3203
- 第三方审核拦截:命中了第三方(数美)或模板路由决定不下发的状态
3204
- */
3205
- THIRD_PARTY = 3
3206
- }
3207
-
3208
3222
  /**
3209
3223
  * 被拦截的消息信息
3210
3224
  */
@@ -3212,6 +3226,7 @@ interface IBlockedMessageInfo {
3212
3226
  blockedMessageUId: string;
3213
3227
  conversationType: number;
3214
3228
  targetId: string;
3229
+ channelId: string;
3215
3230
  blockType: MessageBlockType;
3216
3231
  }
3217
3232
 
@@ -3490,14 +3505,22 @@ declare class APIContext {
3490
3505
  * 建立连接,连接失败则抛出异常,连接成功后返回用户 userId,否则返回相应的错误码
3491
3506
  * @param token
3492
3507
  * @param refreshNavi 是否需要重新请求导航,当值为 `false` 时,优先使用有效缓存导航,若缓存失效则重新获取导航
3508
+ * @param reconnectKickEnable 设置断线重连时是否踢出当前正在重连的设备 (仅 Electron 环境有效)
3509
+ * 同一个账号在一台新设备上登录的时候,会把这个账号在之前登录的设备上踢出。
3510
+ 由于 SDK 有断线重连功能,存在下面情况。
3511
+ 用户在 A 设备登录,A 设备网络不稳定,没有连接成功,SDK 启动重连机制。
3512
+ 用户此时又在 B 设备登录,B 设备连接成功。
3513
+ A 设备网络稳定之后,用户在 A 设备连接成功,B 设备被踢出。
3514
+ 这个字段就是为这种情况加的。
3515
+ 设置 reconnectKickEnable 为 true 时,SDK 重连的时候发现此时已有别的设备连接成功,不再强行踢出已有设备,而是踢出重连设备。
3493
3516
  */
3494
- connect(token: string, refreshNavi?: boolean): Promise<IConnectResult>;
3517
+ connect(token: string, refreshNavi?: boolean, reconnectKickEnable?: boolean): Promise<IConnectResult>;
3495
3518
  /**
3496
3519
  * 拉取实时配置 web 端需更新 voipCall 字段
3497
3520
  */
3498
3521
  private _pullUserSettings;
3499
3522
  disconnect(): Promise<void>;
3500
- reconnect(): Promise<IConnectResult>;
3523
+ reconnect(reconnectKickEnable?: boolean): Promise<IConnectResult>;
3501
3524
  private _getTokenWithoutNavi;
3502
3525
  /**
3503
3526
  * 获取当前缓存的导航数据
@@ -3578,6 +3601,10 @@ declare class APIContext {
3578
3601
  * 清除会话消息未读数
3579
3602
  */
3580
3603
  clearUnreadCount(conversationType: ConversationType, targetId: string, channelId?: string): Promise<ErrorCode>;
3604
+ /**
3605
+ * 清除全部会话消息未读数
3606
+ */
3607
+ clearAllUnreadCount(): Promise<ErrorCode>;
3581
3608
  /**
3582
3609
  * 获取指定会话消息未读数
3583
3610
  */
@@ -3961,8 +3988,9 @@ interface IEngine {
3961
3988
  * 建立连接
3962
3989
  * @param token
3963
3990
  * @param naviInfo
3991
+ * @param reconnectKickEnable
3964
3992
  */
3965
- connect(token: string, naviInfo: INaviInfo, versionInfo: string): Promise<ErrorCode>;
3993
+ connect(token: string, naviInfo: INaviInfo, reconnectKickEnable?: boolean): Promise<ErrorCode>;
3966
3994
  /**
3967
3995
  * 上报版本信息
3968
3996
  * @param version
@@ -4638,8 +4666,9 @@ declare abstract class AEngine implements IEngine {
4638
4666
  * 建立连接
4639
4667
  * @param token
4640
4668
  * @param naviInfo
4669
+ * @param reconnectKickEnable
4641
4670
  */
4642
- abstract connect(token: string, naviInfo: INaviInfo): Promise<ErrorCode>;
4671
+ abstract connect(token: string, naviInfo: INaviInfo, reconnectKickEnable?: boolean): Promise<ErrorCode>;
4643
4672
  /**
4644
4673
  * 发送SDK版本
4645
4674
  * @param versionInfo
@@ -4760,6 +4789,10 @@ declare abstract class AEngine implements IEngine {
4760
4789
  * 清除指定会话未读数
4761
4790
  */
4762
4791
  abstract clearConversationUnreadCount(conversationType: ConversationType, targetId: string, channelId: string): Promise<ErrorCode>;
4792
+ /**
4793
+ * 清除全部会话未读数
4794
+ */
4795
+ abstract clearAllUnreadCount(): Promise<ErrorCode>;
4763
4796
  /**
4764
4797
  * 获取第一个未读消息
4765
4798
  */
@@ -5595,4 +5628,4 @@ declare enum CONNECTION_TYPE {
5595
5628
  */
5596
5629
  declare const version: string;
5597
5630
 
5598
- 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, IBlockedMessageInfo, IChatroomEntries, IChatroomEntry, IChatroomInfo, IChatroomListener, IChatroomListenerData, IChrmKVEntries, IChrmKVEntry, IConnectResult, IConnectionStatusListener, IConversationOption, IConversationStateListener, IConversationTag, IConversationTagListener, IDataChannelWatcher, IDeletedExpansion, IEngine, IEngineWatcher, 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, IMessageBlockedListener, IMessageListnenr, IMessageReader, IMessageReaderResponse, IMetionedData, INaviInfo, IPluginGenerator, IPromiseResult, IPushConfig, IRTCInnerListener, IRTCJoinedInfo, IRTCRoomInfo, IRTCUsers, IReadReceiptInfo, IRecallMsgOptions, IReceivedConversation, IReceivedConversationByTag, IReceivedMessage, IRemoveChatRoomEntriesOption, IRemoveChatRoomEntryOption, IRequest, IResponse, IRtcTokenData, IRuntime, ISendExMsgOptions, ISendMsgOptions, IServerConversationStatus, IServerRTCRoomEntry, IServerUserSetting, ISetConversationStatusOptions, IStorage, ITagInfo, ITagListener, ITagParam, ITagStatus, ITypingInfo, ITypingMessage, ITypingUser, 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, 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, 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 };
5631
+ 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, IBlockedMessageInfo, IChatroomEntries, IChatroomEntry, IChatroomInfo, IChatroomListener, IChatroomListenerData, IChrmKVEntries, IChrmKVEntry, IConnectResult, IConnectionStatusListener, IConversationOption, IConversationStateListener, IConversationTag, IConversationTagListener, IDataChannelWatcher, IDeletedExpansion, IEngine, IEngineWatcher, 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, IMessageBlockedListener, IMessageListnenr, IMessageReader, IMessageReaderResponse, IMetionedData, INaviInfo, IPluginGenerator, IPromiseResult, IPushConfig, IRTCInnerListener, IRTCJoinedInfo, IRTCRoomInfo, IRTCUsers, IReadReceiptInfo, IRecallMsgOptions, IReceivedConversation, IReceivedConversationByTag, IReceivedMessage, IRemoveChatRoomEntriesOption, IRemoveChatRoomEntryOption, IRequest, IResponse, IRtcTokenData, IRuntime, ISendExMsgOptions, ISendMsgOptions, IServerConversationStatus, IServerRTCRoomEntry, IServerUserSetting, ISetConversationStatusOptions, IStorage, ITagInfo, ITagListener, ITagParam, ITagStatus, ITypingInfo, ITypingMessage, ITypingUser, 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, 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 };