@rongcloud/engine 5.3.2 → 5.4.0

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/index.d.ts CHANGED
@@ -962,7 +962,7 @@ interface ISendMsgOptions {
962
962
  interface IInsertMsgOptions {
963
963
  senderUserId: string;
964
964
  messageType: string;
965
- content: string;
965
+ content: any;
966
966
  messageDirection: number;
967
967
  readStatus?: number;
968
968
  sentStatus?: number;
@@ -1074,6 +1074,7 @@ interface IBlockedMessageInfo {
1074
1074
  targetId: string;
1075
1075
  channelId: string;
1076
1076
  blockType: MessageBlockType;
1077
+ extra: any;
1077
1078
  }
1078
1079
 
1079
1080
  /**
@@ -1189,9 +1190,9 @@ declare enum ErrorCode {
1189
1190
  */
1190
1191
  CHATROOM_KEY_NOT_EXIST = 23427,
1191
1192
  /*!
1192
- 聊天室设置 KV 失败,出现在两人或者多端同时操作一个 kv。
1193
- 如果出现该错误,为避免和其他端同时操作,请延时一定时间再试
1194
- */
1193
+ 聊天室设置 KV 失败,出现在两人或者多端同时操作一个 kv。
1194
+ 如果出现该错误,为避免和其他端同时操作,请延时一定时间再试
1195
+ */
1195
1196
  CHATROOM_KV_SET_ERROR = 23431,
1196
1197
  /**
1197
1198
  * 敏感词屏蔽
@@ -1326,6 +1327,10 @@ declare enum ErrorCode {
1326
1327
  * Disconnect,由服务器返回,比如用户互踢。
1327
1328
  */
1328
1329
  RC_DISCONN_EXCEPTION = 31011,
1330
+ /**
1331
+ * 开启禁止把已在线客户端踢下线开关后,该错误码标识已有同类型端在线,禁止链接;
1332
+ */
1333
+ RC_DISCONN_SAME_CLIENT_ON_LINE = 31023,
1329
1334
  /**
1330
1335
  * app 验证Token 验证不通过。所有内部超时,访问失败,返回给客户端sdk都是验证不通过,由服务端日志去看具体是那种失败。
1331
1336
  */
@@ -1415,11 +1420,11 @@ declare enum ErrorCode {
1415
1420
  CONVER_CLEAR_ERROR = 34007,
1416
1421
  /**
1417
1422
  * 扩展存储 key value 超出限制 (错误码与移动端对齐)
1418
- */
1423
+ */
1419
1424
  EXPANSION_LIMIT_EXCEET = 34010,
1420
1425
  /**
1421
1426
  * 消息不支持扩展,原消息 canIncludeExpansion 值为 false (错误码与移动端对齐)
1422
- */
1427
+ */
1423
1428
  MESSAGE_KV_NOT_SUPPORT = 34008,
1424
1429
  CLEAR_HIS_TIME_ERROR = 34011,
1425
1430
  /**
@@ -2271,6 +2276,10 @@ interface IChatroomEntries {
2271
2276
  * 用户退出聊天室时是否清除此属性
2272
2277
  */
2273
2278
  isAutoDelete?: boolean;
2279
+ /**
2280
+ * 是否强制覆盖
2281
+ */
2282
+ isForce?: boolean;
2274
2283
  }
2275
2284
 
2276
2285
  interface IUploadAuth {
@@ -2387,6 +2396,7 @@ interface IJoinRTCRoomData extends IRTCUsers {
2387
2396
  value: string;
2388
2397
  }[];
2389
2398
  kvEntries: IServerRTCRoomEntry[];
2399
+ offlineKickTime: number;
2390
2400
  }
2391
2401
  interface KVString {
2392
2402
  [key: string]: string;
@@ -2677,6 +2687,10 @@ declare enum ConnectionStatus {
2677
2687
  * appkey 不正确
2678
2688
  */
2679
2689
  APPKEY_IS_FAKE = 20,
2690
+ /**
2691
+ * 其他端登录,本端禁止连接和重连
2692
+ */
2693
+ FORBID_RECONNECT_BY_OTHER_SAME_CLIENT = 31023,
2680
2694
  /**
2681
2695
  * 互踢次数过多(`count > 5`),此时可能出现:在其它他设备登陆有 reconnect 逻辑
2682
2696
  */
@@ -2931,44 +2945,83 @@ interface IMetionedData {
2931
2945
  }
2932
2946
 
2933
2947
  declare enum LogLevel {
2934
- /**
2935
- * 等同于 `LogLevel.DEBUG`
2936
- */
2937
2948
  LOG = 0,
2938
- /**
2939
- * 0
2940
- */
2941
2949
  DEBUG = 0,
2942
- /**
2943
- * 1
2944
- */
2945
2950
  INFO = 1,
2946
- /**
2947
- * 2
2948
- */
2949
2951
  WARN = 2,
2950
- /**
2951
- * 3
2952
- */
2953
2952
  ERROR = 3,
2954
- /**
2955
- * 4
2956
- */
2957
2953
  FATAL = 4,
2958
- /**
2959
- * 统计日志类型
2960
- */
2961
2954
  STATISTICS = 6,
2962
- /**
2963
- * 不展示任何日志
2964
- */
2965
2955
  NONE = 1000
2966
2956
  }
2967
-
2968
- declare enum LogType {
2957
+ declare enum LogSource {
2969
2958
  IM = "IM",
2970
2959
  RTC = "RTC"
2971
2960
  }
2961
+ declare enum LogTagId {
2962
+ L_IMSDK_VER_O = "L-imsdk_ver-O",
2963
+ A_INIT_O = "A-init-O",
2964
+ L_INIT_O = "L-init-O",
2965
+ P_INIT_O = "P-init-O",
2966
+ A_CONNECT_T = "A-connect-T",
2967
+ A_CONNECT_R = "A-connect-R",
2968
+ A_CONNECT_S = "A-connect-S",
2969
+ A_DISCONNECT_O = "A-disconnect-O",
2970
+ A_RECONNECT_T = "A-reconnect-T",
2971
+ A_RECONNECT_R = "A_RECONNECT_R",
2972
+ L_CONNECT_T = "L-connect-T",
2973
+ L_CONNECT_R = "L-connect-R",
2974
+ L_CONNECT_S = "L-connect-S",
2975
+ P_CONNECT_O = "P-connect-O",
2976
+ P_CONNECT_S = "P-connect-S",
2977
+ A_SEND_MSG_T = "A-send_msg-T",
2978
+ A_SEND_MSG_R = "A-send_msg-R",
2979
+ P_SEND_MSG_T = "P-send_msg-T",
2980
+ P_SEND_MSG_R = "P-send_msg-R",
2981
+ L_SEND_MSG_T = "L-send_msg-T",
2982
+ L_SEND_MSG_R = "L-send_msg-R",
2983
+ L_PULL_MSG_T = "L-pull_msg-T",
2984
+ L_PULL_MSG_R = "L-pull_msg-R",
2985
+ L_PULL_ULTRA_MSG_T = "L-pull_ultra_msg-T",
2986
+ L_PULL_ULTRA_MSG_R = "L-pull_ultra_msg-R",
2987
+ L_PULL_CHATROOM_KV_T = "L-pull_chatroom_kv-T",
2988
+ L_PULL_CHATROOM_KV_R = "L-pull_chatroom_kv-R",
2989
+ L_PULL_CHATROOM_MSG_T = "L-pull_chatroom_msg-T",
2990
+ L_PULL_CHATROOM_MSG_R = "L-pull_chatroom_msg-R",
2991
+ A_DELETE_MESSAGES_S = "A-delete_messages-S",
2992
+ P_DELETE_MSG_S = "P-delete_msg-S",
2993
+ L_PULL_CONVERSATION_S = "L-pull_conversation-S",
2994
+ L_RECALL_ULTRA_MSG_S = "L-recall_ultra_msg-S",
2995
+ A_REGTYP_O = "A-regtyp-O",
2996
+ P_REGTYP_O = "P-regtype-O",
2997
+ P_REGTYP_E = "P-regtype-E",
2998
+ L_GET_NAVI_T = "L-get_navi-T",
2999
+ L_GET_NAVI_R = "L-get_navi-R",
3000
+ L_ENV_S = "L-Env-S",
3001
+ L_GET_INDEX_NAVI_S = "L-get_index_navi-S",
3002
+ A_JOIN_CHATROOM_T = "A-join_chatroom-T",
3003
+ A_JOIN_CHATROOM_R = "A-join_chatroom-R",
3004
+ L_JOIN_CHATROOM_T = "L-join_chatroom-T",
3005
+ L_JOIN_CHATROOM_R = "L-join_chatroom-R",
3006
+ A_QUIT_CHATROOM_T = "A-quit_chatroom-T",
3007
+ A_QUIT_CHATROOM_R = "A-quit_chatroom-R",
3008
+ L_REJOIN_CHATROOM_T = "L-rejoin_chatroom-T",
3009
+ L_REJOIN_CHATROOM_R = "L-rejoin_chatroom-R",
3010
+ L_MEDIA_S = "L-media-S",
3011
+ L_MEDIA_UPLOAD_T = "L-media_upload-T",
3012
+ L_MEDIA_UPLOAD_R = "L-media_upload-R",
3013
+ G_UPLOAD_LOG_S = "G-upload_log-S",
3014
+ G_UPLOAD_LOG_E = "G-upload_log-E",
3015
+ G_GET_REAL_TIMELOG_COMMAND_S = "G-get_real_timelog_command-S",
3016
+ L_CHECK_ALIVE_IM_T = "L-check_alive_im-T",
3017
+ L_CHECK_ALIVE_IM_R = "L-check_alive_im-R",
3018
+ A_GET_HISTORY_MSG_T = "A-get_history_msg-T",
3019
+ A_GET_HISTORY_MSG_R = "A-get_history_msg-R",
3020
+ L_GET_HISTORY_MSG_T = "L-get_history_msg-T",
3021
+ L_GET_HISTORY_MSG_R = "L-get_history_msg-R",
3022
+ A_CALLBACK_O = "A-callback-O",
3023
+ A_CALLBACK_E = "A-callback-E"
3024
+ }
2972
3025
 
2973
3026
  /**
2974
3027
  * 拓展方法定义,便于 electron-solution 实现时保持接口类型推导可用
@@ -3109,6 +3162,7 @@ interface IEngine {
3109
3162
  * @param reconnectKickEnable
3110
3163
  */
3111
3164
  connect(token: string, naviInfo: INaviInfo, reconnectKickEnable?: boolean): Promise<ErrorCode>;
3165
+ requestNaviInfo(uris: string[], appkey: string, token: string, checkCA?: boolean): Promise<INaviInfo | null>;
3112
3166
  /**
3113
3167
  * 上报版本信息
3114
3168
  * @param version
@@ -3161,6 +3215,13 @@ interface IEngine {
3161
3215
  list: IReceivedMessage[];
3162
3216
  hasMore: boolean;
3163
3217
  }>;
3218
+ /**
3219
+ * 获取指定消息类型的历史消息
3220
+ */
3221
+ getHistoryMessagesByObjectNames(conversationType: ConversationType, targetId: string, timestamp: number, count: number, messageTypes: string[], order: number, channelId: string): Promise<IAsyncRes<{
3222
+ list: IReceivedMessage[];
3223
+ hasMore: boolean;
3224
+ }>>;
3164
3225
  /**
3165
3226
  * 删除历史消息 通过 messageUId
3166
3227
  */
@@ -3214,6 +3275,10 @@ interface IEngine {
3214
3275
  * 会话的业务标识
3215
3276
  */
3216
3277
  channelId?: string): IPromiseResult<IReceivedConversation[]>;
3278
+ /**
3279
+ * 分页获取会话列表,仅 electron中使用
3280
+ */
3281
+ getConversationsByPage(conversationTypes: ConversationType[], startTime: number, count: number, channelId: string): IPromiseResult<IReceivedConversation[]>;
3217
3282
  /**
3218
3283
  * 获取指定会话
3219
3284
  */
@@ -3265,7 +3330,7 @@ interface IEngine {
3265
3330
  * 批量设置会话 置顶、免打扰
3266
3331
  */
3267
3332
  batchSetConversationStatus(statusList: ISetConversationStatusOptions[]): Promise<ErrorCode>;
3268
- sendMessage(conversationType: ConversationType, targetId: string, options: ISendMsgOptions, onBefore?: (messageId: number) => void): IPromiseResult<IReceivedMessage>;
3333
+ sendMessage(conversationType: ConversationType, targetId: string, options: ISendMsgOptions, onBefore?: (messageId: number) => void, traceId?: string): IPromiseResult<IReceivedMessage>;
3269
3334
  /**
3270
3335
  * 断开连接
3271
3336
  */
@@ -3486,7 +3551,7 @@ interface IEngine {
3486
3551
  /**
3487
3552
  * 获取指定人员在黑名单中的状态
3488
3553
  */
3489
- getBlacklistStatus(userId: string): IPromiseResult<string>;
3554
+ getBlacklistStatus(userId: string): IPromiseResult<number>;
3490
3555
  /**
3491
3556
  * 向本地插入一条消息,不发送到服务器
3492
3557
  */
@@ -3494,7 +3559,7 @@ interface IEngine {
3494
3559
  /**
3495
3560
  * 删除本地消息
3496
3561
  */
3497
- deleteMessages(timestamps: number[]): Promise<ErrorCode>;
3562
+ deleteMessages(messageIds: number[]): Promise<ErrorCode>;
3498
3563
  /**
3499
3564
  * 通过时间戳删除本地消息
3500
3565
  */
@@ -3516,9 +3581,10 @@ interface IEngine {
3516
3581
  */
3517
3582
  setMessageSearchField(messageId: number, content: any, searchFiles: string): Promise<ErrorCode>;
3518
3583
  /**
3519
- * 通过关键字搜索会话
3584
+ * 通过关键字与 channelId 搜索所有会话
3520
3585
  */
3521
3586
  searchConversationByContent(keyword: string, customMessageTypes: string[], channelId: string, conversationTypes?: ConversationType[]): IPromiseResult<IReceivedConversation[]>;
3587
+ searchConversationByContentWithAllChannel(keyword: string, customMessageTypes: string[], conversationTypes?: ConversationType[]): IPromiseResult<IReceivedConversation[]>;
3522
3588
  /**
3523
3589
  * 按内容搜索会话内的消息
3524
3590
  */
@@ -3526,6 +3592,19 @@ interface IEngine {
3526
3592
  messages: IReceivedMessage[];
3527
3593
  count: number;
3528
3594
  }>;
3595
+ /**
3596
+ * 按内容搜索指定会话(不区分 channelId)的消息
3597
+ */
3598
+ searchMessageByContentWithAllChannel(conversationType: ConversationType, targetId: string, keyword: string, timestamp: number, count: number): IPromiseResult<{
3599
+ messages: IReceivedMessage[];
3600
+ count: number;
3601
+ }>;
3602
+ /**
3603
+ * 按内容搜索时间范围内指定会话(不区分 channelId)的消息
3604
+ */
3605
+ searchMessageByContentInTimeRangeWithAllChannel(conversationType: ConversationType, targetId: string, keyword: string, startTime: number, endTime: number, offset: number, limit: number): IPromiseResult<{
3606
+ messages: IReceivedMessage[];
3607
+ }>;
3529
3608
  /**
3530
3609
  * 获取会话下所有未读的 @ 消息
3531
3610
  */
@@ -3538,6 +3617,10 @@ interface IEngine {
3538
3617
  * 设置消息接收状态
3539
3618
  */
3540
3619
  setMessageReceivedStatus(messageId: number, receivedStatus: number): Promise<ErrorCode>;
3620
+ /**
3621
+ * 将自己发送的指定时间之前的消息标记对方已读,状态值为 SentStatus.READ
3622
+ */
3623
+ updateMessageReceiptStatus(conversationType: ConversationType, targetId: string, timestamp: number, channelId?: string): IPromiseResult<boolean>;
3541
3624
  /**
3542
3625
  * 删除时间戳前的未读数
3543
3626
  */
@@ -3569,6 +3652,7 @@ interface IEngine {
3569
3652
  * 获取所有群聊会话 @ 消息未读数
3570
3653
  */
3571
3654
  getAllUnreadMentionedCount(): Promise<IAsyncRes<number>>;
3655
+ clearData(): Promise<IAsyncRes<boolean>>;
3572
3656
  joinRTCRoom(roomId: string, mode: RTCMode, broadcastType?: number, joinType?: RTCJoinType, innerUserDatas?: IRTCUserData, outerUserDatas?: IRTCUserData): IPromiseResult<IJoinRTCRoomData>;
3573
3657
  quitRTCRoom(roomId: string): Promise<ErrorCode>;
3574
3658
  rtcPing(roomId: string, mode: number, broadcastType?: number): Promise<ErrorCode>;
@@ -3702,6 +3786,32 @@ interface ITypingMessage {
3702
3786
  list: Array<ITypingUser>;
3703
3787
  }
3704
3788
 
3789
+ /**
3790
+ * IndexDB中存储的log数据
3791
+ */
3792
+ interface ILogInfo {
3793
+ sessionId: string;
3794
+ time: number;
3795
+ level: LogLevel;
3796
+ content: string;
3797
+ userId?: string;
3798
+ logSource?: LogSource;
3799
+ tagId?: LogTagId;
3800
+ }
3801
+ interface IRealTimeLog {
3802
+ level: LogLevel;
3803
+ content: string;
3804
+ }
3805
+ interface ILogExtensions {
3806
+ traceId?: string;
3807
+ logSource?: LogSource;
3808
+ }
3809
+ interface ILogInit {
3810
+ userId?: string;
3811
+ localLogLevel?: LogLevel;
3812
+ customLogPrint?: (logLevel: LogLevel, msg: string) => void;
3813
+ }
3814
+
3705
3815
  /**
3706
3816
  * 定义已废弃,请使用 `IRemoveChatroomEntries` 替换
3707
3817
  * @deprecated
@@ -3962,7 +4072,7 @@ declare class DataCodec {
3962
4072
  /**
3963
4073
  * 设置会话状态 (置顶、免打扰)
3964
4074
  */
3965
- encodeSetConversationStatus(statusList: Array<ISetConversationStatusOptions>): any;
4075
+ encodeSetConversationStatus(statusList: Array<ISetConversationStatusOptions>, conversationUpdatedTime: number): any;
3966
4076
  /**
3967
4077
  * 序列化发送群组已读回执
3968
4078
  */
@@ -4227,32 +4337,6 @@ declare class CometChannel extends ADataChannel {
4227
4337
  close(): void;
4228
4338
  }
4229
4339
 
4230
- interface IPluginGenerator<API, InitOption> {
4231
- /**
4232
- * 只读插件标识
4233
- */
4234
- readonly tag: string;
4235
- /**
4236
- * 版本号
4237
- */
4238
- readonly version?: string;
4239
- /**
4240
- * 插件名称
4241
- */
4242
- readonly name?: string;
4243
- /**
4244
- * 插件安装前的环境检测,通过返回 boolean 值确认插件是否可运行
4245
- */
4246
- verify(runtime: IRuntime): boolean;
4247
- /**
4248
- * 插件初始化
4249
- * @param context 插件调用上下文,用于实现插件的消息注册、消息首发等
4250
- * @param runtime 运行时实例,用于标识最终的运行时平台
4251
- * @param options 初始化参数
4252
- */
4253
- setup(context: PluginContext, runtime: IRuntime, options: InitOption): API;
4254
- }
4255
-
4256
4340
  declare type IMessageListnenr = (message: IReceivedMessage, leftCount?: number, hasMore?: boolean) => void;
4257
4341
  declare type IMessagesListnenr = (messages: IReceivedMessage[], leftCount?: number, hasMore?: boolean) => void;
4258
4342
  declare type IConnectionStatusListener = (status: ConnectionStatus) => void;
@@ -4372,6 +4456,32 @@ interface IAPIContextOption {
4372
4456
  checkCA?: boolean;
4373
4457
  }
4374
4458
 
4459
+ interface IPluginGenerator<API, InitOption> {
4460
+ /**
4461
+ * 只读插件标识
4462
+ */
4463
+ readonly tag: string;
4464
+ /**
4465
+ * 版本号
4466
+ */
4467
+ readonly version?: string;
4468
+ /**
4469
+ * 插件名称
4470
+ */
4471
+ readonly name?: string;
4472
+ /**
4473
+ * 插件安装前的环境检测,通过返回 boolean 值确认插件是否可运行
4474
+ */
4475
+ verify(runtime: IRuntime): boolean;
4476
+ /**
4477
+ * 插件初始化
4478
+ * @param context 插件调用上下文,用于实现插件的消息注册、消息首发等
4479
+ * @param runtime 运行时实例,用于标识最终的运行时平台
4480
+ * @param options 初始化参数
4481
+ */
4482
+ setup(context: PluginContext, runtime: IRuntime, options: InitOption): API;
4483
+ }
4484
+
4375
4485
  declare class APIContext {
4376
4486
  private _runtime;
4377
4487
  private static _context?;
@@ -4498,7 +4608,7 @@ declare class APIContext {
4498
4608
  这个字段就是为这种情况加的。
4499
4609
  设置 reconnectKickEnable 为 true 时,SDK 重连的时候发现此时已有别的设备连接成功,不再强行踢出已有设备,而是踢出重连设备。
4500
4610
  */
4501
- connect(token: string, refreshNavi?: boolean, reconnectKickEnable?: boolean): Promise<IConnectResult>;
4611
+ connect(token: string, refreshNavi?: boolean, reconnectKickEnable?: boolean, traceId?: string): Promise<IConnectResult>;
4502
4612
  /**
4503
4613
  * 拉取实时配置 web 端需更新 voipCall 字段
4504
4614
  */
@@ -4528,7 +4638,7 @@ declare class APIContext {
4528
4638
  * @param content
4529
4639
  * @param options
4530
4640
  */
4531
- sendMessage(conversationType: ConversationType, targetId: string, options: ISendMsgOptions, onBefore?: (messageId: number) => void): Promise<IAsyncRes<IReceivedMessage>>;
4641
+ sendMessage(conversationType: ConversationType, targetId: string, options: ISendMsgOptions, onBefore?: (messageId: number) => void, traceId?: string): Promise<IAsyncRes<IReceivedMessage>>;
4532
4642
  /**
4533
4643
  * 发送扩展消息
4534
4644
  * @param messageUId 消息 Id
@@ -4562,7 +4672,11 @@ declare class APIContext {
4562
4672
  * @param channelId
4563
4673
  * @param objectName
4564
4674
  */
4565
- getHistoryMessage(conversationType: ConversationType, targetId: string, timestamp?: number, count?: number, order?: 0 | 1, channelId?: string, objectName?: string): Promise<IAsyncRes<{
4675
+ getHistoryMessage(conversationType: ConversationType, targetId: string, timestamp?: number, count?: number, order?: 0 | 1, channelId?: string, objectName?: string, traceId?: string): Promise<IAsyncRes<{
4676
+ list: IReceivedMessage[];
4677
+ hasMore: boolean;
4678
+ }>>;
4679
+ getHistoryMessagesByObjectNames(conversationType: ConversationType, targetId: string, timestamp: number, count: number, messageTypes: string[], order: number, channelId: string): Promise<IAsyncRes<{
4566
4680
  list: IReceivedMessage[];
4567
4681
  hasMore: boolean;
4568
4682
  }>>;
@@ -4571,6 +4685,10 @@ declare class APIContext {
4571
4685
  * @param count 指定获取数量, 不传则获取全部会话列表,默认 `300`
4572
4686
  */
4573
4687
  getConversationList(count?: number, conversationType?: ConversationType, startTime?: number, order?: 0 | 1, channelId?: string): Promise<IAsyncRes<IReceivedConversation[]>>;
4688
+ /**
4689
+ * 分页获取会话列表,仅 electron中使用
4690
+ */
4691
+ getConversationsByPage(conversationTypes: ConversationType[], startTime: number, count: number, channelId: string): Promise<IAsyncRes<IReceivedConversation[]>>;
4574
4692
  /**
4575
4693
  * 获取单一会话数据
4576
4694
  * @param conversationType
@@ -4659,13 +4777,13 @@ declare class APIContext {
4659
4777
  * @param roomId 聊天室房间 Id
4660
4778
  * @param count 进入聊天室成功后,自动拉取的历史消息数量,默认值为 `10`,最大有效值为 `50`,`-1` 为不拉取
4661
4779
  */
4662
- joinChatroom(roomId: string, count?: number): Promise<ErrorCode>;
4780
+ joinChatroom(roomId: string, count?: number, traceId?: string): Promise<ErrorCode>;
4663
4781
  /**
4664
4782
  * 加入聊天室,若聊天室不存在则抛出异常
4665
4783
  * @param roomId 聊天室房间 Id
4666
4784
  * @param count 进入聊天室成功后,自动拉取的历史消息数量,默认值为 `10`,最大有效值为 `50`,`-1` 为不拉取
4667
4785
  */
4668
- joinExistChatroom(roomId: string, count?: number): Promise<ErrorCode>;
4786
+ joinExistChatroom(roomId: string, count?: number, traceId?: string): Promise<ErrorCode>;
4669
4787
  /**
4670
4788
  * 退出聊天室
4671
4789
  * @param roomId
@@ -4771,6 +4889,7 @@ declare class APIContext {
4771
4889
  getFileToken(fileType: FileType, fileName?: string, httpMethod?: 'POST' | 'PUT', queryString?: string): Promise<IUploadAuth & {
4772
4890
  bos: string;
4773
4891
  qiniu: string;
4892
+ ossConfig: string;
4774
4893
  }>;
4775
4894
  /**
4776
4895
  * 获取 七牛、百度、阿里云 上传成功可下载的 URL
@@ -4931,7 +5050,7 @@ declare class APIContext {
4931
5050
  /**
4932
5051
  * 获取指定人员在黑名单中的状态
4933
5052
  */
4934
- getBlacklistStatus(userId: string): Promise<IAsyncRes<string>>;
5053
+ getBlacklistStatus(userId: string): Promise<IAsyncRes<number>>;
4935
5054
  /**
4936
5055
  * 向本地插入一条消息,不发送到服务器
4937
5056
  */
@@ -4939,7 +5058,7 @@ declare class APIContext {
4939
5058
  /**
4940
5059
  * 删除本地消息
4941
5060
  */
4942
- deleteMessages(timestamp: number[]): Promise<ErrorCode>;
5061
+ deleteMessages(messageIds: number[]): Promise<ErrorCode>;
4943
5062
  /**
4944
5063
  * 从本地消息数据库中删除某一会话指定时间之前的消息数据
4945
5064
  */
@@ -4968,6 +5087,10 @@ declare class APIContext {
4968
5087
  * 设置消息接收状态
4969
5088
  */
4970
5089
  setMessageReceivedStatus(messageId: number, receivedStatus: number): Promise<ErrorCode>;
5090
+ /**
5091
+ * 将自己发送的指定时间之前的消息标记对方已读,状态值为 SentStatus.READ
5092
+ */
5093
+ setMessageStatusToRead(conversationType: ConversationType, targetId: string, timestamp: number, channelId?: string): Promise<IAsyncRes<boolean>>;
4971
5094
  /**
4972
5095
  * 设置当前用户在线状态
4973
5096
  */
@@ -4983,10 +5106,18 @@ declare class APIContext {
4983
5106
  status: string;
4984
5107
  }>>;
4985
5108
  searchConversationByContent(keyword: string, customMessageTypes?: string[], channelId?: string, conversationTypes?: ConversationType[]): Promise<IAsyncRes<IReceivedConversation[]>>;
5109
+ searchConversationByContentWithAllChannel(keyword: string, customMessageTypes?: string[], conversationTypes?: ConversationType[]): Promise<IAsyncRes<IReceivedConversation[]>>;
4986
5110
  searchMessageByContent(conversationType: ConversationType, targetId: string, keyword: string, timestamp: number, count: number, total: number, channelId?: string): Promise<IAsyncRes<{
4987
5111
  messages: IReceivedMessage[];
4988
5112
  count: number;
4989
5113
  }>>;
5114
+ searchMessageByContentWithAllChannel(conversationType: ConversationType, targetId: string, keyword: string, timestamp: number, count: number): Promise<IAsyncRes<{
5115
+ messages: IReceivedMessage[];
5116
+ count: number;
5117
+ }>>;
5118
+ searchMessageByContentInTimeRangeWithAllChannel(conversationType: ConversationType, targetId: string, keyword: string, startTime: number, endTime: number, offset: number, limit: number): Promise<IAsyncRes<{
5119
+ messages: IReceivedMessage[];
5120
+ }>>;
4990
5121
  getUnreadMentionedMessages(conversationType: ConversationType, targetId: string, channelId?: string): IReceivedMessage[];
4991
5122
  clearUnreadCountByTimestamp(conversationType: ConversationType, targetId: string, timestamp: number, channelId?: string): Promise<ErrorCode>;
4992
5123
  /**
@@ -5015,6 +5146,7 @@ declare class APIContext {
5015
5146
  }>>;
5016
5147
  getConversationListWithAllChannel(): Promise<IAsyncRes<IReceivedConversation[]>>;
5017
5148
  getConversationListWithAllChannelByPage(index: number, limit: number): Promise<IAsyncRes<IReceivedConversation[]>>;
5149
+ clearData(): Promise<IAsyncRes<boolean>>;
5018
5150
  /**
5019
5151
  * 加入房间
5020
5152
  * @param roomId
@@ -5284,34 +5416,6 @@ declare class RTCPluginContext extends PluginContext {
5284
5416
  endRoomPK(options: IEndRoomPKOptions): Promise<ErrorCode>;
5285
5417
  }
5286
5418
 
5287
- declare abstract class ANavi {
5288
- protected readonly _runtime: IRuntime;
5289
- protected readonly _options: IAPIContextOption;
5290
- protected readonly _apiVersion: string;
5291
- protected readonly _appkey: string;
5292
- protected _naviInfo: INaviInfo | null;
5293
- constructor(_runtime: IRuntime, _options: IAPIContextOption);
5294
- /**
5295
- * @param uris
5296
- * @param appkey
5297
- * @param token
5298
- */
5299
- protected abstract _reqNavi(uris: string[], appkey: string, token: string, checkCA?: boolean): Promise<INaviInfo | null>;
5300
- /**
5301
- * 获取导航数据
5302
- * @param token
5303
- * @param dynamicUris token 携带的动态导航地址
5304
- * @param force 是否强制重新获取并清空缓存数据
5305
- */
5306
- getInfo(token: string, dynamicUris: string[], force: boolean, checkCA?: boolean): Promise<INaviInfo | null>;
5307
- protected setNaviInfo2Cache(token: string, naviInfo: INaviInfo): void;
5308
- getInfoFromCache(token: string): INaviInfo | null;
5309
- /**
5310
- * 清空导航数据:内存数据、缓存数据
5311
- */
5312
- private _clear;
5313
- }
5314
-
5315
5419
  interface IEngineWatcher {
5316
5420
  /**
5317
5421
  * @param message 消息
@@ -5343,23 +5447,33 @@ declare abstract class AEngine implements IEngine {
5343
5447
  readonly runtime: IRuntime;
5344
5448
  protected readonly _watcher: IEngineWatcher;
5345
5449
  protected readonly _options: IAPIContextOption;
5346
- /**
5347
- * 当前用户 Id
5348
- */
5349
- currentUserId: string;
5350
5450
  /**
5351
5451
  * 连接时间
5352
5452
  */
5353
5453
  abstract getConnectedTime(): number;
5354
- readonly navi: ANavi;
5355
5454
  protected readonly _appkey: string;
5356
5455
  protected readonly _apiVer: string;
5456
+ protected readonly _apiVersion: string;
5457
+ protected _naviInfo: INaviInfo | null;
5357
5458
  /**
5358
5459
  * 引擎初始化
5359
5460
  * @param _appkey
5360
5461
  */
5361
5462
  constructor(runtime: IRuntime, _watcher: IEngineWatcher, _options: IAPIContextOption);
5362
- protected abstract _createNavi(): ANavi;
5463
+ abstract requestNaviInfo(uris: string[], appkey: string, token: string, checkCA?: boolean): Promise<INaviInfo | null>;
5464
+ /**
5465
+ * 获取导航数据
5466
+ * @param token
5467
+ * @param dynamicUris token 携带的动态导航地址
5468
+ * @param force 是否强制重新获取并清空缓存数据
5469
+ */
5470
+ getNaviInfo(token: string, dynamicUris: string[], force: boolean, checkCA?: boolean): Promise<INaviInfo | null>;
5471
+ protected setNaviInfo2Cache(token: string, naviInfo: INaviInfo): void;
5472
+ getInfoFromCache(token: string): INaviInfo | null;
5473
+ /**
5474
+ * 清空导航数据:内存数据、缓存数据
5475
+ */
5476
+ private _clear;
5363
5477
  /**
5364
5478
  * 调用非标准方法。所谓非标准方法,是为某些特定需求或产品添加,暂未作为标准接口添加至 API 层。
5365
5479
  * 对于未实现的方法,接口响应 Unsupport 错误码
@@ -5373,7 +5487,7 @@ declare abstract class AEngine implements IEngine {
5373
5487
  * @param naviInfo
5374
5488
  * @param reconnectKickEnable
5375
5489
  */
5376
- abstract connect(token: string, naviInfo: INaviInfo, reconnectKickEnable?: boolean): Promise<ErrorCode>;
5490
+ abstract connect(token: string, naviInfo: INaviInfo, reconnectKickEnable?: boolean, traceId?: string): Promise<ErrorCode>;
5377
5491
  /**
5378
5492
  * 发送SDK版本
5379
5493
  * @param versionInfo
@@ -5411,10 +5525,17 @@ declare abstract class AEngine implements IEngine {
5411
5525
  /**
5412
5526
  * 消息类型
5413
5527
  */
5414
- objectName: string): IPromiseResult<{
5528
+ objectName: string, traceId?: string): IPromiseResult<{
5415
5529
  list: IReceivedMessage[];
5416
5530
  hasMore: boolean;
5417
5531
  }>;
5532
+ /**
5533
+ * 获取指定消息类型的历史消息
5534
+ */
5535
+ abstract getHistoryMessagesByObjectNames(conversationType: ConversationType, targetId: string, timestamp: number, count: number, messageTypes: string[], order: number, channelId: string): Promise<IAsyncRes<{
5536
+ list: IReceivedMessage[];
5537
+ hasMore: boolean;
5538
+ }>>;
5418
5539
  /**
5419
5540
  * 删除历史消息 通过 messageUId
5420
5541
  */
@@ -5468,6 +5589,10 @@ declare abstract class AEngine implements IEngine {
5468
5589
  * 会话的业务标识
5469
5590
  */
5470
5591
  channelId?: string): IPromiseResult<IReceivedConversation[]>;
5592
+ /**
5593
+ * 分页获取会话列表,仅 electron中使用
5594
+ */
5595
+ abstract getConversationsByPage(conversationTypes: ConversationType[], startTime: number, count: number, channelId: string): IPromiseResult<IReceivedConversation[]>;
5471
5596
  /**
5472
5597
  * 获取指定会话
5473
5598
  */
@@ -5527,7 +5652,7 @@ declare abstract class AEngine implements IEngine {
5527
5652
  /**
5528
5653
  * c++ 消息写库后存在自增 Id,必要时需要向业务层暴露,JSEngine 无需实现
5529
5654
  */
5530
- onBefore?: (messageId: number) => void): IPromiseResult<IReceivedMessage>;
5655
+ onBefore?: (messageId: number) => void, traceId?: string): IPromiseResult<IReceivedMessage>;
5531
5656
  /**
5532
5657
  * 发送群组消息已读回执
5533
5658
  * 导航下发已读回执开关为 true 时调用
@@ -5565,12 +5690,12 @@ declare abstract class AEngine implements IEngine {
5565
5690
  * 加入聊天室
5566
5691
  * @param count 拉取消息数量
5567
5692
  */
5568
- abstract joinChatroom(chatroomId: string, count: number): Promise<ErrorCode>;
5693
+ abstract joinChatroom(chatroomId: string, count: number, traceId?: string): Promise<ErrorCode>;
5569
5694
  /**
5570
5695
  * 加入已存在的聊天室
5571
5696
  * @param count 拉取消息数量
5572
5697
  */
5573
- abstract joinExistChatroom(chatroomId: string, count: number): Promise<ErrorCode>;
5698
+ abstract joinExistChatroom(chatroomId: string, count: number, traceId?: string): Promise<ErrorCode>;
5574
5699
  /**
5575
5700
  * 退出聊天室
5576
5701
  */
@@ -5765,7 +5890,7 @@ declare abstract class AEngine implements IEngine {
5765
5890
  * @param targetId
5766
5891
  * @param options
5767
5892
  */
5768
- abstract sendUltraMessage(targetId: string, options: ISendMsgOptions): Promise<IAsyncRes>;
5893
+ abstract sendUltraMessage(targetId: string, options: ISendMsgOptions, onSendBefore?: (messageId: number) => void, traceId?: string): Promise<IAsyncRes>;
5769
5894
  /**
5770
5895
  * 超级群消息正在输入中
5771
5896
  * @param options
@@ -5791,7 +5916,7 @@ declare abstract class AEngine implements IEngine {
5791
5916
  * @param targetId
5792
5917
  * @param options
5793
5918
  */
5794
- abstract getUltraHistoryMsg(targetId: string, options: IGetMsgOption): Promise<IAsyncRes>;
5919
+ abstract getUltraHistoryMsg(targetId: string, options: IGetMsgOption, traceId?: string): Promise<IAsyncRes>;
5795
5920
  abstract getConversationListWithAllChannel(): IPromiseResult<IReceivedConversation[]>;
5796
5921
  abstract getConversationListWithAllChannelByPage(index: number, limit: number): IPromiseResult<IReceivedConversation[]>;
5797
5922
  /**
@@ -5833,7 +5958,7 @@ declare abstract class AEngine implements IEngine {
5833
5958
  /**
5834
5959
  * 获取指定人员在黑名单中的状态
5835
5960
  */
5836
- abstract getBlacklistStatus(userId: string): IPromiseResult<string>;
5961
+ abstract getBlacklistStatus(userId: string): IPromiseResult<number>;
5837
5962
  /**
5838
5963
  * 向本地插入一条消息,不发送到服务器
5839
5964
  */
@@ -5841,7 +5966,7 @@ declare abstract class AEngine implements IEngine {
5841
5966
  /**
5842
5967
  * 删除本地消息
5843
5968
  */
5844
- abstract deleteMessages(timestamps: number[]): Promise<ErrorCode>;
5969
+ abstract deleteMessages(messageIds: number[]): Promise<ErrorCode>;
5845
5970
  /**
5846
5971
  * 通过时间戳删除本地消息
5847
5972
  */
@@ -5866,6 +5991,10 @@ declare abstract class AEngine implements IEngine {
5866
5991
  * 通过关键字搜索会话
5867
5992
  */
5868
5993
  abstract searchConversationByContent(keyword: string, customMessageTypes: string[], channelId: string, conversationTypes?: ConversationType[]): IPromiseResult<IReceivedConversation[]>;
5994
+ /**
5995
+ * 通过关键字搜索所有会话
5996
+ */
5997
+ abstract searchConversationByContentWithAllChannel(keyword: string, customMessageTypes: string[], conversationTypes?: ConversationType[]): IPromiseResult<IReceivedConversation[]>;
5869
5998
  /**
5870
5999
  * 按内容搜索会话内的消息
5871
6000
  */
@@ -5873,6 +6002,19 @@ declare abstract class AEngine implements IEngine {
5873
6002
  messages: IReceivedMessage[];
5874
6003
  count: number;
5875
6004
  }>;
6005
+ /**
6006
+ * 按内容搜索指定会话(不区分 channelId)的消息
6007
+ */
6008
+ abstract searchMessageByContentWithAllChannel(conversationType: ConversationType, targetId: string, keyword: string, timestamp: number, count: number): IPromiseResult<{
6009
+ messages: IReceivedMessage[];
6010
+ count: number;
6011
+ }>;
6012
+ /**
6013
+ * 按内容搜索时间范围内指定会话(不区分 channelId)的消息
6014
+ */
6015
+ abstract searchMessageByContentInTimeRangeWithAllChannel(conversationType: ConversationType, targetId: string, keyword: string, startTime: number, endTime: number, offset: number, limit: number): IPromiseResult<{
6016
+ messages: IReceivedMessage[];
6017
+ }>;
5876
6018
  /**
5877
6019
  * 获取会话下所有未读的 @ 消息
5878
6020
  */
@@ -5885,6 +6027,10 @@ declare abstract class AEngine implements IEngine {
5885
6027
  * 设置消息接收状态
5886
6028
  */
5887
6029
  abstract setMessageReceivedStatus(messageId: number, receivedStatus: number): Promise<ErrorCode>;
6030
+ /**
6031
+ * 将自己发送的指定时间之前的消息标记对方已读,状态值为 SentStatus.READ
6032
+ */
6033
+ abstract updateMessageReceiptStatus(conversationType: ConversationType, targetId: string, timestamp: number, channelId?: string): IPromiseResult<boolean>;
5888
6034
  /**
5889
6035
  * 删除时间戳前的未读数
5890
6036
  */
@@ -5938,6 +6084,7 @@ declare abstract class AEngine implements IEngine {
5938
6084
  * 获取本地全部会话的状态
5939
6085
  */
5940
6086
  abstract getAllConversationState(): Promise<IAsyncRes<IConversationState[]>>;
6087
+ abstract clearData(): Promise<IAsyncRes<boolean>>;
5941
6088
  abstract joinRTCRoom(roomId: string, mode: RTCMode, broadcastType?: number, joinType?: RTCJoinType, innerUserDatas?: IRTCUserData, outerUserDatas?: IRTCUserData): IPromiseResult<IJoinRTCRoomData>;
5942
6089
  abstract quitRTCRoom(roomId: string): Promise<ErrorCode>;
5943
6090
  abstract rtcPing(roomId: string, mode: number, broadcastType?: number): Promise<ErrorCode>;
@@ -6012,232 +6159,6 @@ declare const appendUrl: (url: string, query?: {
6012
6159
  [key: string]: string | number | null;
6013
6160
  } | undefined) => string;
6014
6161
 
6015
- /**
6016
- * IndexDB中存储的log数据
6017
- */
6018
- interface ILogInfo {
6019
- sessionId: string;
6020
- time: number;
6021
- level: LogLevel;
6022
- content: string;
6023
- userId: string;
6024
- }
6025
- interface IRealTimeLog {
6026
- level: LogLevel;
6027
- content: string;
6028
- }
6029
-
6030
- interface ILogPolicy {
6031
- url: string;
6032
- level: number;
6033
- itv: number;
6034
- times: number;
6035
- }
6036
- interface IReportLogInitInfo {
6037
- runtime: IRuntime;
6038
- logSwitch: number;
6039
- logPolicy: ILogPolicy;
6040
- appkey: string;
6041
- version: string;
6042
- userId?: string;
6043
- sessionId?: string;
6044
- }
6045
- /**
6046
- * 更新上传日志属性
6047
- */
6048
- interface IReportLogUpdateInfo {
6049
- runtime?: IRuntime;
6050
- logSwitch?: number;
6051
- logPolicy?: ILogPolicy;
6052
- appkey?: string;
6053
- version?: string;
6054
- userId?: string;
6055
- sessionId?: string;
6056
- }
6057
- /**
6058
- * 初始化上传日志属性
6059
- */
6060
- interface IFullLogParams {
6061
- startTime: number;
6062
- endTime: number;
6063
- platform: string;
6064
- logId: string;
6065
- uri: string;
6066
- packageName?: string;
6067
- }
6068
- /**
6069
- * 日志上报类
6070
- */
6071
- declare class UploadLog {
6072
- private info;
6073
- private logUrl;
6074
- level: number;
6075
- itv: number;
6076
- times: number;
6077
- private deviceId;
6078
- private deviceInfo;
6079
- logSwitch: number;
6080
- static currentRTTimes: number;
6081
- static reportSwitch: boolean;
6082
- private static _instance;
6083
- constructor(info: IReportLogInitInfo);
6084
- /**
6085
- * 重新设置类属性
6086
- */
6087
- updateUploadLogAttr(info: IReportLogUpdateInfo): void;
6088
- static init(info: IReportLogInitInfo): UploadLog;
6089
- static getInstance(): UploadLog | null;
6090
- /**
6091
- * 上报实时日志
6092
- */
6093
- reportRealtimeLog(list: IRealTimeLog[]): Promise<void>;
6094
- /**
6095
- * 上报全量日志
6096
- */
6097
- reportFullLog(params: IFullLogParams): Promise<void>;
6098
- distroy(): void;
6099
- }
6100
-
6101
- /** 统计数据标签 **/
6102
- declare enum StatisticsTag {
6103
- 'IM_NAVI' = "IM-stats_navi-S",
6104
- 'IM_WEBSOCKET' = "IM-stats_websocket-S",
6105
- 'IM_COMET' = "IM-stats_comet-S",
6106
- 'IM_CONNECTION_DURATION' = "IM-stats_con_dur-S"
6107
- }
6108
-
6109
- /** 统计日志公共数据参数 */
6110
- interface IUpdateBaseStatisticsDataOption {
6111
- sdkPrivate?: number;
6112
- serverPrivate?: number;
6113
- bundleId?: string;
6114
- }
6115
- /** 统计日志公共数据 */
6116
- interface IBaseStatisticsData {
6117
- sdkPrivate: number;
6118
- serverPrivate: number;
6119
- bundleId: string;
6120
- }
6121
-
6122
- declare class Logger {
6123
- readonly tag: string;
6124
- readonly type?: LogType | undefined;
6125
- private readonly initiator?;
6126
- /**
6127
- *
6128
- * @param tag 标签
6129
- * @param type 类型
6130
- * @param initiator 发起方(A: APP 层,L: Lib 层)
6131
- */
6132
- constructor(tag: string, type?: LogType | undefined, initiator?: string | undefined);
6133
- /**
6134
- * 输出等级
6135
- */
6136
- private _outLevel;
6137
- /**
6138
- * 为向前兼容,暂不删除
6139
- */
6140
- private _stdout?;
6141
- /**
6142
- * 输出函数
6143
- */
6144
- private _logStdout?;
6145
- /**
6146
- * 本地存储日志列表
6147
- */
6148
- static databaseLogList: ILogInfo[];
6149
- /**
6150
- * 定时上传日志列表
6151
- */
6152
- static realTimeLogList: IRealTimeLog[];
6153
- static readonly sessionId: string;
6154
- static userId: string;
6155
- static init(userId: string): void;
6156
- static reset(): void;
6157
- /**
6158
- * 默认输出函数
6159
- * @param level
6160
- * @param args
6161
- */
6162
- private _defaultStdout;
6163
- /**
6164
- * 向 databaseLogList 中 push 日志
6165
- * @param level 打印等级
6166
- * @param content 日志内容
6167
- * @param tag 日志tag
6168
- */
6169
- __pushLocalLog(level: LogLevel, content: string, tag: string): void;
6170
- /**
6171
- * 向数据库中插入 log 数据
6172
- */
6173
- __insertLogIntoDatabase(): Promise<boolean>;
6174
- /**
6175
- * 修改 log 输出等级
6176
- * @param logLevel
6177
- */
6178
- setLogLevel(logLevel?: LogLevel): void;
6179
- setLogStdout(stdout?: (level: LogLevel, content: string) => void): void;
6180
- log(level: LogLevel, ...args: any[]): void;
6181
- debug: (...args: any[]) => void;
6182
- info: (...args: any[]) => void;
6183
- warn: (...args: any[]) => void;
6184
- error: (...args: any[]) => void;
6185
- fatal: (...args: any[]) => void;
6186
- /**
6187
- * 日志实时上报
6188
- * @param level 日志等级
6189
- * @param tag 日志标签
6190
- * @param content 日志内容
6191
- */
6192
- reportLog(level: LogLevel, tag: string, content: string): void;
6193
- /**
6194
- * @deprecated
6195
- * 函数已废弃,使用 `setLogLevel` 与 `setStdout` 方法替代
6196
- */
6197
- set(outLevel: LogLevel, stdout?: (level: LogLevel, ...args: any[]) => void): void;
6198
- /**
6199
- * 接口已废弃,改用 `setLogStdout`
6200
- * @param stdout
6201
- * @deprecated
6202
- */
6203
- setStdout(stdout?: (level: LogLevel, msgTag: string, ...args: any[]) => void): void;
6204
- __clearRealTimeLog(): void;
6205
- /** 日志上传实例 */
6206
- static _reportLog: UploadLog;
6207
- /** 初始化日志上传 */
6208
- initReportLog(info: IReportLogInitInfo): void;
6209
- /**
6210
- * 设置日志上传实例属性
6211
- */
6212
- updateUploadLogAttr(info: IReportLogUpdateInfo): void;
6213
- /**
6214
- * 开始上报实时日志(定时上传)
6215
- * @returns void
6216
- */
6217
- startReport(): void;
6218
- /**
6219
- * 上报统计日志
6220
- * @param tag 统计日志类型
6221
- * @param content 日志内容
6222
- */
6223
- reportStatisticsLog(tag: StatisticsTag | string, content: any): Promise<void>;
6224
- /** 统计日志缓存数据 */
6225
- private statisticsCaches;
6226
- private baseStatisData;
6227
- /**
6228
- * 更新统计日志共用数据 updateStatisticsBaseData
6229
- */
6230
- updateStatisticsBaseData(options: IUpdateBaseStatisticsDataOption): void;
6231
- /** 获取统计日志共用数据 getStatisticsBaseData */
6232
- getStatisticsBaseData(): IBaseStatisticsData;
6233
- /** 设置统计日志数据 setStatisticsData */
6234
- setStatisticsData<T>(tag: StatisticsTag | string, options?: T | {
6235
- [key: string]: any;
6236
- }, isReset?: boolean): void;
6237
- /** 获取数据 getStatisticsData */
6238
- getStatisticsData<T>(tag: StatisticsTag | string): T | any;
6239
- }
6240
-
6241
6162
  declare type IEventListener = (...args: any[]) => void;
6242
6163
  declare class EventEmitter {
6243
6164
  private readonly _map;
@@ -6352,6 +6273,7 @@ declare const isHttpUrl: (value: any) => boolean;
6352
6273
  */
6353
6274
  declare const notEmptyObject: (val: Object) => boolean;
6354
6275
  declare const isValidConversationType: (conversation: number) => boolean;
6276
+ declare const isValidChannelId: (value: any) => boolean;
6355
6277
  /**
6356
6278
  * 判断是否是一个有效的文件类型
6357
6279
  */
@@ -6365,6 +6287,152 @@ declare const isValidExpansion: (expansion: {
6365
6287
  [key: string]: string;
6366
6288
  } | undefined) => IIsValidExpansion;
6367
6289
 
6290
+ /** ******************************************新重构logger,按照Web新日志规范上报 ********************************** **/
6291
+ declare const sessionId: string;
6292
+ /**
6293
+ * logLevelTransformer
6294
+ * @description 数据中心与前端日志规范LogLevel定义不统一
6295
+ * WebLogLevel(前端日志级别) -> ServerLogLevel(服务器日志级别)
6296
+ * @param level { LogLevel }
6297
+ * @returns serverLogLevel
6298
+ */
6299
+ declare function logLevelTransformer(level: LogLevel): number;
6300
+ /**
6301
+ * 序列化引用型数据为字符串
6302
+ * @value value
6303
+ */
6304
+ declare const formatLogObj: (value: unknown) => unknown;
6305
+ /**
6306
+ * 缓存日志
6307
+ * @param logLevel 打印等级
6308
+ * @param logObj 日志内容
6309
+ * @param tagId 日志tag
6310
+ */
6311
+ declare function insertIntoLogCache(logLevel: LogLevel, tagId: string, logObj: any, logSource?: LogSource): ILogInfo;
6312
+ /**
6313
+ * 本地默认输出函数
6314
+ * @param level
6315
+ * @param args
6316
+ */
6317
+ declare function _defaultStdout(level: LogLevel, msgTag: string, ...logContents: any[]): void;
6318
+ /**
6319
+ * Trace ID 生成器
6320
+ */
6321
+ declare function ID(): string;
6322
+ declare function init(userLogInfo: ILogInit): void;
6323
+ declare function log(logLevel: LogLevel, tagId: LogTagId | string, logObj?: Object, logExtens?: ILogExtensions): void;
6324
+ declare const debug: (tagId: string, logObj?: Object | undefined, logExtens?: ILogExtensions | undefined) => void;
6325
+ declare const info: (tagId: string, logObj?: Object | undefined, logExtens?: ILogExtensions | undefined) => void;
6326
+ declare const warn: (tagId: string, logObj?: Object | undefined, logExtens?: ILogExtensions | undefined) => void;
6327
+ declare const error: (tagId: string, logObj?: Object | undefined, logExtens?: ILogExtensions | undefined) => void;
6328
+ declare const fatal: (tagId: string, logObj?: Object | undefined, logExtens?: ILogExtensions | undefined) => void;
6329
+
6330
+ declare const base_sessionId: typeof sessionId;
6331
+ declare const base_logLevelTransformer: typeof logLevelTransformer;
6332
+ declare const base_formatLogObj: typeof formatLogObj;
6333
+ declare const base_insertIntoLogCache: typeof insertIntoLogCache;
6334
+ declare const base__defaultStdout: typeof _defaultStdout;
6335
+ declare const base_ID: typeof ID;
6336
+ declare const base_init: typeof init;
6337
+ declare const base_log: typeof log;
6338
+ declare const base_debug: typeof debug;
6339
+ declare const base_info: typeof info;
6340
+ declare const base_warn: typeof warn;
6341
+ declare const base_error: typeof error;
6342
+ declare const base_fatal: typeof fatal;
6343
+ declare namespace base {
6344
+ export {
6345
+ base_sessionId as sessionId,
6346
+ base_logLevelTransformer as logLevelTransformer,
6347
+ base_formatLogObj as formatLogObj,
6348
+ base_insertIntoLogCache as insertIntoLogCache,
6349
+ base__defaultStdout as _defaultStdout,
6350
+ base_ID as ID,
6351
+ base_init as init,
6352
+ base_log as log,
6353
+ base_debug as debug,
6354
+ base_info as info,
6355
+ base_warn as warn,
6356
+ base_error as error,
6357
+ base_fatal as fatal,
6358
+ };
6359
+ }
6360
+
6361
+ /** *********************实时日志上报***************** */
6362
+
6363
+ /**
6364
+ * 缓存日志实时
6365
+ * @param logLevel 日志等级
6366
+ * @param tagId 日志标签
6367
+ * @param content 日志内容
6368
+ */
6369
+ declare function reportLog(logLevel: LogLevel, tagId: string, content: string, logSource?: LogSource): void;
6370
+
6371
+ /** ******************************************旧Logger类,fix兼容用,逐步废弃 ********************************** **/
6372
+
6373
+ /**
6374
+ * @description 兼容旧版用法,建议用Logger静态方法
6375
+ * 1、不符合新版Web日志规范
6376
+ * 2、不支持自定义TagId
6377
+ * 3、后续可能删除,要逐步迁移新Web规范
6378
+ */
6379
+ declare class Logger {
6380
+ readonly tagId: string;
6381
+ readonly logSource?: LogSource | undefined;
6382
+ private readonly initiator?;
6383
+ /**
6384
+ *
6385
+ * @param tagId
6386
+ * @param logSource 类型
6387
+ * @param initiator 发起方(A: APP 层,L: Lib 层)
6388
+ */
6389
+ constructor(tagId: string, logSource?: LogSource | undefined, initiator?: string | undefined);
6390
+ /**
6391
+ * 本地控制台日志输出级别
6392
+ */
6393
+ private _localLogLevel;
6394
+ /**
6395
+ * 自定义本地日志输出函数
6396
+ */
6397
+ private _customLogPrint?;
6398
+ /**
6399
+ * 为向前兼容,暂不删除
6400
+ */
6401
+ private _stdout?;
6402
+ /**
6403
+ * 自定义本地打印日志级别
6404
+ * @param logLevel
6405
+ */
6406
+ setLogLevel(logLevel?: LogLevel): void;
6407
+ /**
6408
+ * 自定义本地打印函数
6409
+ */
6410
+ setLogStdout(stdout?: (level: LogLevel, content: string) => void): void;
6411
+ log(logLevel: LogLevel, ...args: any[]): void;
6412
+ debug: (...args: any[]) => void;
6413
+ info: (...args: any[]) => void;
6414
+ warn: (...args: any[]) => void;
6415
+ error: (...args: any[]) => void;
6416
+ fatal: (...args: any[]) => void;
6417
+ /**
6418
+ * @deprecated
6419
+ * 函数已废弃,使用 `setLogLevel` 与 `setStdout` 方法替代
6420
+ */
6421
+ set(outLevel: LogLevel, stdout?: (level: LogLevel, ...args: any[]) => void): void;
6422
+ /**
6423
+ * 接口已废弃,改用 `setLogStdout`
6424
+ * @param stdout
6425
+ * @deprecated
6426
+ */
6427
+ setStdout(stdout?: (level: LogLevel, msgTag: string, ...args: any[]) => void): void;
6428
+ reportLog: typeof reportLog;
6429
+ }
6430
+ declare const _default: Logger;
6431
+
6432
+ declare const randomNum: (min: number, max: number) => number;
6433
+ declare const getUUID: () => string;
6434
+ declare const getUUID22: () => string;
6435
+
6368
6436
  /**
6369
6437
  * 预定义的验证规则,只包含`值类型`数据验证
6370
6438
  * 引用类型数据需使用自定义 validator 校验函数进行校验
@@ -6401,7 +6469,11 @@ declare enum AssertRules {
6401
6469
  /**
6402
6470
  * ChannelId 验证,必须为 String 且不超过 20 位 且不能包含下划线
6403
6471
  */
6404
- CHANNEL_ID = 7
6472
+ CHANNEL_ID = 7,
6473
+ /**
6474
+ * 类型为会话
6475
+ */
6476
+ CONVERSATION = 8
6405
6477
  }
6406
6478
  declare class RCAssertError extends Error {
6407
6479
  constructor(message?: string);
@@ -6592,10 +6664,14 @@ declare enum CONNECTION_TYPE {
6592
6664
  WEBSOCKET = "websocket",
6593
6665
  COMET = "comet"
6594
6666
  }
6667
+ declare const REAT_TIME_LOG_SIZE = 500;
6668
+ declare const DB_LOG_MAX_SIZE = 100000;
6669
+ declare const DB_LOG_FLUSH_FREQUENCY = 3000;
6670
+ declare const ONE_LOG_SIZE_MAX = 1000;
6595
6671
 
6596
6672
  /**
6597
6673
  * engine 版本号
6598
6674
  */
6599
6675
  declare const version: string;
6600
6676
 
6601
- 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, IGetMsgOption, IInsertMsgOptions, IIsValidExpansion, IJoinRTCRoomData, ILocalReadReceiptInfo, ILocalTagStatus, IM_CHATROOM_PULL_INTERVAL_TIME, 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, IRTCRoomBindOption, IRTCRoomInfo, IRTCUserData, IRTCUsers, IReadReceiptInfo, IRecallMsgContent, 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, IUltraGroupOption, IUltraModifyMsgOptions, IUltraMsgQueryOptions, IUpdatedConversation, IUpdatedExpansion, IUploadAuth, IUserProfile, IWatcher, IWebSocket, ItypingStateListener, KVString, LiveRole, LiveType, LogLevel, LogType, Logger, MAX_MESSAGE_CONTENT_BYTES, MAX_MESSAGE_EXPANSION_KEY_LENGTH, MAX_MESSAGE_EXPANSION_VAL_LENGTH, MINI_COMET_CONNECT_URIS, MINI_SOCKET_CONNECT_URIS, MentionedType, MessageBlockType, MessageDirection, MessageType, NAVI_CACHE_DURATION, NAVI_REQ_TIMEOUT, NetworkType, NotificationLevel, NotificationStatus, OperateStatus, 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 };
6677
+ export { AEngine, APIContext, AppStorage, AssertRules, CONNECTION_TYPE, CPP_PROTOCAL_MSGTYPE_OPTION, CallLibMsgType, ChatroomEntryType, ChatroomUserChangeType as ChatroomMemberChangeType, CometChannel, ConnectResultCode, ConnectionStatus, ConversationType, DB_LOG_FLUSH_FREQUENCY, DB_LOG_MAX_SIZE, 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, IGetMsgOption, IInsertMsgOptions, IIsValidExpansion, IJoinRTCRoomData, ILocalReadReceiptInfo, ILocalTagStatus, ILogExtensions, ILogInfo, ILogInit, IM_CHATROOM_PULL_INTERVAL_TIME, 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, IRTCRoomBindOption, IRTCRoomInfo, IRTCUserData, IRTCUsers, IReadReceiptInfo, IRealTimeLog, IRecallMsgContent, 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, IUltraGroupOption, IUltraModifyMsgOptions, IUltraMsgQueryOptions, IUpdatedConversation, IUpdatedExpansion, IUploadAuth, IUserProfile, IWatcher, IWebSocket, ItypingStateListener, KVString, LiveRole, LiveType, LogLevel, LogSource, LogTagId, Logger, MAX_MESSAGE_CONTENT_BYTES, MAX_MESSAGE_EXPANSION_KEY_LENGTH, MAX_MESSAGE_EXPANSION_VAL_LENGTH, MINI_COMET_CONNECT_URIS, MINI_SOCKET_CONNECT_URIS, MentionedType, MessageBlockType, MessageDirection, MessageType, NAVI_CACHE_DURATION, NAVI_REQ_TIMEOUT, NetworkType, NotificationLevel, NotificationStatus, ONE_LOG_SIZE_MAX, OperateStatus, PING_REQ_TIMEOUT, PUBLIC_CLOUD_NAVI_URIS, PluginContext, RCAssertError, REAT_TIME_LOG_SIZE, 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, _default as engineLogger, forEach, formatConnectResponseCode, getBrowser, getMimeKey, getUUID, getUUID22, getUploadFileName, indexOf, isArray, isArrayBuffer, isBoolean, isFunction, isHttpUrl, isInObject, isInclude, isNull, isNumber, isObject, isString, isUndefined, isValidChannelId, isValidChrmEntryKey, isValidChrmEntryValue, isValidConversationType, isValidExpansion, isValidFileType, base as logger, map, notEmptyArray, notEmptyObject, notEmptyString, pushConfigsToJSON, pushJSONToConfigs, randomNum, todo, usingCppEngine, validate, version };