@rongcloud/engine 5.3.3 → 5.4.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/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;
@@ -1119,7 +1119,6 @@ declare enum ErrorCode {
1119
1119
  * 成功
1120
1120
  */
1121
1121
  SUCCESS = 0,
1122
- RC_MSG_UNAUTHORIZED = 20406,
1123
1122
  /**
1124
1123
  * 群组 Id 无效
1125
1124
  */
@@ -1190,14 +1189,17 @@ declare enum ErrorCode {
1190
1189
  */
1191
1190
  CHATROOM_KEY_NOT_EXIST = 23427,
1192
1191
  /*!
1193
- 聊天室设置 KV 失败,出现在两人或者多端同时操作一个 kv。
1194
- 如果出现该错误,为避免和其他端同时操作,请延时一定时间再试
1195
- */
1192
+ 聊天室设置 KV 失败,出现在两人或者多端同时操作一个 kv。
1193
+ 如果出现该错误,为避免和其他端同时操作,请延时一定时间再试
1194
+ */
1196
1195
  CHATROOM_KV_SET_ERROR = 23431,
1197
1196
  /**
1198
1197
  * 敏感词屏蔽
1199
1198
  */
1200
1199
  SENSITIVE_SHIELD = 21501,
1200
+ /**
1201
+ * 消息中含敏感词且敏感词已被替换
1202
+ */
1201
1203
  SENSITIVE_REPLACE = 21502,
1202
1204
  /**
1203
1205
  * 加入讨论失败
@@ -1327,6 +1329,10 @@ declare enum ErrorCode {
1327
1329
  * Disconnect,由服务器返回,比如用户互踢。
1328
1330
  */
1329
1331
  RC_DISCONN_EXCEPTION = 31011,
1332
+ /**
1333
+ * 开启禁止把已在线客户端踢下线开关后,该错误码标识已有同类型端在线,禁止链接;
1334
+ */
1335
+ RC_DISCONN_SAME_CLIENT_ON_LINE = 31023,
1330
1336
  /**
1331
1337
  * app 验证Token 验证不通过。所有内部超时,访问失败,返回给客户端sdk都是验证不通过,由服务端日志去看具体是那种失败。
1332
1338
  */
@@ -1375,7 +1381,13 @@ declare enum ErrorCode {
1375
1381
  * 消息漫游服务未开通
1376
1382
  */
1377
1383
  MSG_ROAMING_SERVICE_UNAVAILABLE = 33007,
1384
+ /**
1385
+ * 消息存入本地数据库失败
1386
+ */
1378
1387
  MSG_INSERT_ERROR = 33008,
1388
+ /**
1389
+ * 删除本地消息失败
1390
+ */
1379
1391
  MSG_DEL_ERROR = 33009,
1380
1392
  /**
1381
1393
  * 标签已存在
@@ -1413,20 +1425,21 @@ declare enum ErrorCode {
1413
1425
  * 获取指定用户ID&会话类型未读消息数异常
1414
1426
  */
1415
1427
  CONVER_ID_TYPE_UNREAD_ERROR = 34006,
1416
- CONVER_CLEAR_ERROR = 34007,
1417
1428
  /**
1418
1429
  * 扩展存储 key value 超出限制 (错误码与移动端对齐)
1419
- */
1430
+ */
1420
1431
  EXPANSION_LIMIT_EXCEET = 34010,
1421
1432
  /**
1422
1433
  * 消息不支持扩展,原消息 canIncludeExpansion 值为 false (错误码与移动端对齐)
1423
- */
1434
+ */
1424
1435
  MESSAGE_KV_NOT_SUPPORT = 34008,
1425
- CLEAR_HIS_TIME_ERROR = 34011,
1426
1436
  /**
1427
1437
  * 会话数量超出上限
1428
1438
  */
1429
1439
  CONVER_OUT_LIMIT_ERROR = 34013,
1440
+ /**
1441
+ * 获取会话失败
1442
+ */
1430
1443
  CONVER_GET_ERROR = 35021,
1431
1444
  /**
1432
1445
  * 群组信息异常
@@ -1540,7 +1553,6 @@ declare enum ErrorCode {
1540
1553
  * cookie被禁用
1541
1554
  */
1542
1555
  COOKIE_ENABLE = 51001,
1543
- GET_MESSAGE_BY_ID_ERROR = 61001,
1544
1556
  HAVNODEVICEID = 24001,
1545
1557
  DEVICEIDISHAVE = 24002,
1546
1558
  FEILD = 24009,
@@ -1551,14 +1563,6 @@ declare enum ErrorCode {
1551
1563
  NOVOIP = 24014,
1552
1564
  INTERNALERRROR = 24015,
1553
1565
  VOIPCLOSE = 24016,
1554
- CLOSE_BEFORE_OPEN = 51001,
1555
- ALREADY_IN_USE = 51002,
1556
- INVALID_CHANNEL_NAME = 51003,
1557
- VIDEO_CONTAINER_IS_NULL = 51004,
1558
- /**
1559
- * 删除消息数组长度为 0 .
1560
- */
1561
- DELETE_MESSAGE_ID_IS_NULL = 61001,
1562
1566
  /**
1563
1567
  * 己方取消已发出的通话请求
1564
1568
  */
@@ -2272,6 +2276,10 @@ interface IChatroomEntries {
2272
2276
  * 用户退出聊天室时是否清除此属性
2273
2277
  */
2274
2278
  isAutoDelete?: boolean;
2279
+ /**
2280
+ * 是否强制覆盖
2281
+ */
2282
+ isForce?: boolean;
2275
2283
  }
2276
2284
 
2277
2285
  interface IUploadAuth {
@@ -2679,6 +2687,10 @@ declare enum ConnectionStatus {
2679
2687
  * appkey 不正确
2680
2688
  */
2681
2689
  APPKEY_IS_FAKE = 20,
2690
+ /**
2691
+ * 其他端登录,本端禁止连接和重连
2692
+ */
2693
+ FORBID_RECONNECT_BY_OTHER_SAME_CLIENT = 31023,
2682
2694
  /**
2683
2695
  * 互踢次数过多(`count > 5`),此时可能出现:在其它他设备登陆有 reconnect 逻辑
2684
2696
  */
@@ -2933,44 +2945,87 @@ interface IMetionedData {
2933
2945
  }
2934
2946
 
2935
2947
  declare enum LogLevel {
2936
- /**
2937
- * 等同于 `LogLevel.DEBUG`
2938
- */
2939
2948
  LOG = 0,
2940
- /**
2941
- * 0
2942
- */
2943
2949
  DEBUG = 0,
2944
- /**
2945
- * 1
2946
- */
2947
2950
  INFO = 1,
2948
- /**
2949
- * 2
2950
- */
2951
2951
  WARN = 2,
2952
- /**
2953
- * 3
2954
- */
2955
2952
  ERROR = 3,
2956
- /**
2957
- * 4
2958
- */
2959
2953
  FATAL = 4,
2960
- /**
2961
- * 统计日志类型
2962
- */
2963
2954
  STATISTICS = 6,
2964
- /**
2965
- * 不展示任何日志
2966
- */
2967
2955
  NONE = 1000
2968
2956
  }
2969
-
2970
- declare enum LogType {
2957
+ declare enum LogSource {
2971
2958
  IM = "IM",
2972
2959
  RTC = "RTC"
2973
2960
  }
2961
+ /**
2962
+ * IMLib 埋点日志 Id 枚举
2963
+ * @desc 参考文档-https://rongcloud.yuque.com/tbvylv/znhprz/dpt9wf#fE9u
2964
+ */
2965
+ declare enum LogTagId {
2966
+ L_IMSDK_VER_O = "L-imsdk_ver-O",
2967
+ A_INIT_O = "A-init-O",
2968
+ L_INIT_O = "L-init-O",
2969
+ P_INIT_O = "P-init-O",
2970
+ A_CONNECT_T = "A-connect-T",
2971
+ A_CONNECT_R = "A-connect-R",
2972
+ A_CONNECT_S = "A-connect-S",
2973
+ A_DISCONNECT_O = "A-disconnect-O",
2974
+ A_RECONNECT_T = "A-reconnect-T",
2975
+ A_RECONNECT_R = "A_RECONNECT_R",
2976
+ L_CONNECT_T = "L-connect-T",
2977
+ L_CONNECT_R = "L-connect-R",
2978
+ L_CONNECT_S = "L-connect-S",
2979
+ P_CONNECT_O = "P-connect-O",
2980
+ P_CONNECT_S = "P-connect-S",
2981
+ A_SEND_MSG_T = "A-send_msg-T",
2982
+ A_SEND_MSG_R = "A-send_msg-R",
2983
+ P_SEND_MSG_T = "P-send_msg-T",
2984
+ P_SEND_MSG_R = "P-send_msg-R",
2985
+ L_SEND_MSG_T = "L-send_msg-T",
2986
+ L_SEND_MSG_R = "L-send_msg-R",
2987
+ L_PULL_MSG_T = "L-pull_msg-T",
2988
+ L_PULL_MSG_R = "L-pull_msg-R",
2989
+ L_PULL_ULTRA_MSG_T = "L-pull_ultra_msg-T",
2990
+ L_PULL_ULTRA_MSG_R = "L-pull_ultra_msg-R",
2991
+ L_PULL_CHATROOM_KV_T = "L-pull_chatroom_kv-T",
2992
+ L_PULL_CHATROOM_KV_R = "L-pull_chatroom_kv-R",
2993
+ L_PULL_CHATROOM_MSG_T = "L-pull_chatroom_msg-T",
2994
+ L_PULL_CHATROOM_MSG_R = "L-pull_chatroom_msg-R",
2995
+ A_DELETE_MESSAGES_S = "A-delete_messages-S",
2996
+ P_DELETE_MSG_S = "P-delete_msg-S",
2997
+ L_PULL_CONVERSATION_S = "L-pull_conversation-S",
2998
+ L_RECALL_ULTRA_MSG_S = "L-recall_ultra_msg-S",
2999
+ A_REGTYP_O = "A-regtyp-O",
3000
+ P_REGTYP_O = "P-regtype-O",
3001
+ P_REGTYP_E = "P-regtype-E",
3002
+ L_GET_NAVI_T = "L-get_navi-T",
3003
+ L_GET_NAVI_R = "L-get_navi-R",
3004
+ L_ENV_S = "L-Env-S",
3005
+ L_GET_INDEX_NAVI_S = "L-get_index_navi-S",
3006
+ A_JOIN_CHATROOM_T = "A-join_chatroom-T",
3007
+ A_JOIN_CHATROOM_R = "A-join_chatroom-R",
3008
+ L_JOIN_CHATROOM_T = "L-join_chatroom-T",
3009
+ L_JOIN_CHATROOM_R = "L-join_chatroom-R",
3010
+ A_QUIT_CHATROOM_T = "A-quit_chatroom-T",
3011
+ A_QUIT_CHATROOM_R = "A-quit_chatroom-R",
3012
+ L_REJOIN_CHATROOM_T = "L-rejoin_chatroom-T",
3013
+ L_REJOIN_CHATROOM_R = "L-rejoin_chatroom-R",
3014
+ L_MEDIA_S = "L-media-S",
3015
+ L_MEDIA_UPLOAD_T = "L-media_upload-T",
3016
+ L_MEDIA_UPLOAD_R = "L-media_upload-R",
3017
+ G_UPLOAD_LOG_S = "G-upload_log-S",
3018
+ G_UPLOAD_LOG_E = "G-upload_log-E",
3019
+ G_GET_REAL_TIMELOG_COMMAND_S = "G-get_real_timelog_command-S",
3020
+ L_CHECK_ALIVE_IM_T = "L-check_alive_im-T",
3021
+ L_CHECK_ALIVE_IM_R = "L-check_alive_im-R",
3022
+ A_GET_HISTORY_MSG_T = "A-get_history_msg-T",
3023
+ A_GET_HISTORY_MSG_R = "A-get_history_msg-R",
3024
+ L_GET_HISTORY_MSG_T = "L-get_history_msg-T",
3025
+ L_GET_HISTORY_MSG_R = "L-get_history_msg-R",
3026
+ A_CALLBACK_O = "A-callback-O",
3027
+ A_CALLBACK_E = "A-callback-E"
3028
+ }
2974
3029
 
2975
3030
  /**
2976
3031
  * 拓展方法定义,便于 electron-solution 实现时保持接口类型推导可用
@@ -3112,6 +3167,7 @@ interface IEngine {
3112
3167
  */
3113
3168
  connect(token: string, naviInfo: INaviInfo, reconnectKickEnable?: boolean): Promise<ErrorCode>;
3114
3169
  requestNaviInfo(uris: string[], appkey: string, token: string, checkCA?: boolean): Promise<INaviInfo | null>;
3170
+ getNaviInfoFromCache(): INaviInfo | null;
3115
3171
  /**
3116
3172
  * 上报版本信息
3117
3173
  * @param version
@@ -3164,6 +3220,13 @@ interface IEngine {
3164
3220
  list: IReceivedMessage[];
3165
3221
  hasMore: boolean;
3166
3222
  }>;
3223
+ /**
3224
+ * 获取指定消息类型的历史消息
3225
+ */
3226
+ getHistoryMessagesByObjectNames(conversationType: ConversationType, targetId: string, timestamp: number, count: number, messageTypes: string[], order: number, channelId: string): Promise<IAsyncRes<{
3227
+ list: IReceivedMessage[];
3228
+ hasMore: boolean;
3229
+ }>>;
3167
3230
  /**
3168
3231
  * 删除历史消息 通过 messageUId
3169
3232
  */
@@ -3217,6 +3280,10 @@ interface IEngine {
3217
3280
  * 会话的业务标识
3218
3281
  */
3219
3282
  channelId?: string): IPromiseResult<IReceivedConversation[]>;
3283
+ /**
3284
+ * 分页获取会话列表,仅 electron中使用
3285
+ */
3286
+ getConversationsByPage(conversationTypes: ConversationType[], startTime: number, count: number, channelId: string): IPromiseResult<IReceivedConversation[]>;
3220
3287
  /**
3221
3288
  * 获取指定会话
3222
3289
  */
@@ -3268,7 +3335,7 @@ interface IEngine {
3268
3335
  * 批量设置会话 置顶、免打扰
3269
3336
  */
3270
3337
  batchSetConversationStatus(statusList: ISetConversationStatusOptions[]): Promise<ErrorCode>;
3271
- sendMessage(conversationType: ConversationType, targetId: string, options: ISendMsgOptions, onBefore?: (messageId: number) => void): IPromiseResult<IReceivedMessage>;
3338
+ sendMessage(conversationType: ConversationType, targetId: string, options: ISendMsgOptions, onBefore?: (messageId: number) => void, traceId?: string): IPromiseResult<IReceivedMessage>;
3272
3339
  /**
3273
3340
  * 断开连接
3274
3341
  */
@@ -3489,7 +3556,7 @@ interface IEngine {
3489
3556
  /**
3490
3557
  * 获取指定人员在黑名单中的状态
3491
3558
  */
3492
- getBlacklistStatus(userId: string): IPromiseResult<string>;
3559
+ getBlacklistStatus(userId: string): IPromiseResult<number>;
3493
3560
  /**
3494
3561
  * 向本地插入一条消息,不发送到服务器
3495
3562
  */
@@ -3497,7 +3564,7 @@ interface IEngine {
3497
3564
  /**
3498
3565
  * 删除本地消息
3499
3566
  */
3500
- deleteMessages(timestamps: number[]): Promise<ErrorCode>;
3567
+ deleteMessages(messageIds: number[]): Promise<ErrorCode>;
3501
3568
  /**
3502
3569
  * 通过时间戳删除本地消息
3503
3570
  */
@@ -3519,9 +3586,10 @@ interface IEngine {
3519
3586
  */
3520
3587
  setMessageSearchField(messageId: number, content: any, searchFiles: string): Promise<ErrorCode>;
3521
3588
  /**
3522
- * 通过关键字搜索会话
3589
+ * 通过关键字与 channelId 搜索所有会话
3523
3590
  */
3524
3591
  searchConversationByContent(keyword: string, customMessageTypes: string[], channelId: string, conversationTypes?: ConversationType[]): IPromiseResult<IReceivedConversation[]>;
3592
+ searchConversationByContentWithAllChannel(keyword: string, customMessageTypes: string[], conversationTypes?: ConversationType[]): IPromiseResult<IReceivedConversation[]>;
3525
3593
  /**
3526
3594
  * 按内容搜索会话内的消息
3527
3595
  */
@@ -3529,6 +3597,19 @@ interface IEngine {
3529
3597
  messages: IReceivedMessage[];
3530
3598
  count: number;
3531
3599
  }>;
3600
+ /**
3601
+ * 按内容搜索指定会话(不区分 channelId)的消息
3602
+ */
3603
+ searchMessageByContentWithAllChannel(conversationType: ConversationType, targetId: string, keyword: string, timestamp: number, count: number): IPromiseResult<{
3604
+ messages: IReceivedMessage[];
3605
+ count: number;
3606
+ }>;
3607
+ /**
3608
+ * 按内容搜索时间范围内指定会话(不区分 channelId)的消息
3609
+ */
3610
+ searchMessageByContentInTimeRangeWithAllChannel(conversationType: ConversationType, targetId: string, keyword: string, startTime: number, endTime: number, offset: number, limit: number): IPromiseResult<{
3611
+ messages: IReceivedMessage[];
3612
+ }>;
3532
3613
  /**
3533
3614
  * 获取会话下所有未读的 @ 消息
3534
3615
  */
@@ -3541,6 +3622,10 @@ interface IEngine {
3541
3622
  * 设置消息接收状态
3542
3623
  */
3543
3624
  setMessageReceivedStatus(messageId: number, receivedStatus: number): Promise<ErrorCode>;
3625
+ /**
3626
+ * 将自己发送的指定时间之前的消息标记对方已读,状态值为 SentStatus.READ
3627
+ */
3628
+ updateMessageReceiptStatus(conversationType: ConversationType, targetId: string, timestamp: number, channelId?: string): IPromiseResult<boolean>;
3544
3629
  /**
3545
3630
  * 删除时间戳前的未读数
3546
3631
  */
@@ -3572,6 +3657,7 @@ interface IEngine {
3572
3657
  * 获取所有群聊会话 @ 消息未读数
3573
3658
  */
3574
3659
  getAllUnreadMentionedCount(): Promise<IAsyncRes<number>>;
3660
+ clearData(): Promise<IAsyncRes<boolean>>;
3575
3661
  joinRTCRoom(roomId: string, mode: RTCMode, broadcastType?: number, joinType?: RTCJoinType, innerUserDatas?: IRTCUserData, outerUserDatas?: IRTCUserData): IPromiseResult<IJoinRTCRoomData>;
3576
3662
  quitRTCRoom(roomId: string): Promise<ErrorCode>;
3577
3663
  rtcPing(roomId: string, mode: number, broadcastType?: number): Promise<ErrorCode>;
@@ -3705,6 +3791,32 @@ interface ITypingMessage {
3705
3791
  list: Array<ITypingUser>;
3706
3792
  }
3707
3793
 
3794
+ /**
3795
+ * IndexDB中存储的log数据
3796
+ */
3797
+ interface ILogInfo {
3798
+ sessionId: string;
3799
+ time: number;
3800
+ level: LogLevel;
3801
+ content: string;
3802
+ userId?: string;
3803
+ logSource?: LogSource;
3804
+ tagId?: LogTagId;
3805
+ }
3806
+ interface IRealTimeLog {
3807
+ level: LogLevel;
3808
+ content: string;
3809
+ }
3810
+ interface ILogExtensions {
3811
+ traceId?: string;
3812
+ logSource?: LogSource;
3813
+ }
3814
+ interface ILogInit {
3815
+ userId?: string;
3816
+ localLogLevel?: LogLevel;
3817
+ customLogPrint?: (logLevel: LogLevel, msg: string) => void;
3818
+ }
3819
+
3708
3820
  /**
3709
3821
  * 定义已废弃,请使用 `IRemoveChatroomEntries` 替换
3710
3822
  * @deprecated
@@ -3965,7 +4077,7 @@ declare class DataCodec {
3965
4077
  /**
3966
4078
  * 设置会话状态 (置顶、免打扰)
3967
4079
  */
3968
- encodeSetConversationStatus(statusList: Array<ISetConversationStatusOptions>): any;
4080
+ encodeSetConversationStatus(statusList: Array<ISetConversationStatusOptions>, conversationUpdatedTime: number): any;
3969
4081
  /**
3970
4082
  * 序列化发送群组已读回执
3971
4083
  */
@@ -4230,32 +4342,6 @@ declare class CometChannel extends ADataChannel {
4230
4342
  close(): void;
4231
4343
  }
4232
4344
 
4233
- interface IPluginGenerator<API, InitOption> {
4234
- /**
4235
- * 只读插件标识
4236
- */
4237
- readonly tag: string;
4238
- /**
4239
- * 版本号
4240
- */
4241
- readonly version?: string;
4242
- /**
4243
- * 插件名称
4244
- */
4245
- readonly name?: string;
4246
- /**
4247
- * 插件安装前的环境检测,通过返回 boolean 值确认插件是否可运行
4248
- */
4249
- verify(runtime: IRuntime): boolean;
4250
- /**
4251
- * 插件初始化
4252
- * @param context 插件调用上下文,用于实现插件的消息注册、消息首发等
4253
- * @param runtime 运行时实例,用于标识最终的运行时平台
4254
- * @param options 初始化参数
4255
- */
4256
- setup(context: PluginContext, runtime: IRuntime, options: InitOption): API;
4257
- }
4258
-
4259
4345
  declare type IMessageListnenr = (message: IReceivedMessage, leftCount?: number, hasMore?: boolean) => void;
4260
4346
  declare type IMessagesListnenr = (messages: IReceivedMessage[], leftCount?: number, hasMore?: boolean) => void;
4261
4347
  declare type IConnectionStatusListener = (status: ConnectionStatus) => void;
@@ -4375,6 +4461,32 @@ interface IAPIContextOption {
4375
4461
  checkCA?: boolean;
4376
4462
  }
4377
4463
 
4464
+ interface IPluginGenerator<API, InitOption> {
4465
+ /**
4466
+ * 只读插件标识
4467
+ */
4468
+ readonly tag: string;
4469
+ /**
4470
+ * 版本号
4471
+ */
4472
+ readonly version?: string;
4473
+ /**
4474
+ * 插件名称
4475
+ */
4476
+ readonly name?: string;
4477
+ /**
4478
+ * 插件安装前的环境检测,通过返回 boolean 值确认插件是否可运行
4479
+ */
4480
+ verify(runtime: IRuntime): boolean;
4481
+ /**
4482
+ * 插件初始化
4483
+ * @param context 插件调用上下文,用于实现插件的消息注册、消息首发等
4484
+ * @param runtime 运行时实例,用于标识最终的运行时平台
4485
+ * @param options 初始化参数
4486
+ */
4487
+ setup(context: PluginContext, runtime: IRuntime, options: InitOption): API;
4488
+ }
4489
+
4378
4490
  declare class APIContext {
4379
4491
  private _runtime;
4380
4492
  private static _context?;
@@ -4501,7 +4613,7 @@ declare class APIContext {
4501
4613
  这个字段就是为这种情况加的。
4502
4614
  设置 reconnectKickEnable 为 true 时,SDK 重连的时候发现此时已有别的设备连接成功,不再强行踢出已有设备,而是踢出重连设备。
4503
4615
  */
4504
- connect(token: string, refreshNavi?: boolean, reconnectKickEnable?: boolean): Promise<IConnectResult>;
4616
+ connect(token: string, refreshNavi?: boolean, reconnectKickEnable?: boolean, traceId?: string): Promise<IConnectResult>;
4505
4617
  /**
4506
4618
  * 拉取实时配置 web 端需更新 voipCall 字段
4507
4619
  */
@@ -4531,7 +4643,7 @@ declare class APIContext {
4531
4643
  * @param content
4532
4644
  * @param options
4533
4645
  */
4534
- sendMessage(conversationType: ConversationType, targetId: string, options: ISendMsgOptions, onBefore?: (messageId: number) => void): Promise<IAsyncRes<IReceivedMessage>>;
4646
+ sendMessage(conversationType: ConversationType, targetId: string, options: ISendMsgOptions, onBefore?: (messageId: number) => void, traceId?: string): Promise<IAsyncRes<IReceivedMessage>>;
4535
4647
  /**
4536
4648
  * 发送扩展消息
4537
4649
  * @param messageUId 消息 Id
@@ -4565,7 +4677,11 @@ declare class APIContext {
4565
4677
  * @param channelId
4566
4678
  * @param objectName
4567
4679
  */
4568
- getHistoryMessage(conversationType: ConversationType, targetId: string, timestamp?: number, count?: number, order?: 0 | 1, channelId?: string, objectName?: string): Promise<IAsyncRes<{
4680
+ getHistoryMessage(conversationType: ConversationType, targetId: string, timestamp?: number, count?: number, order?: 0 | 1, channelId?: string, objectName?: string, traceId?: string): Promise<IAsyncRes<{
4681
+ list: IReceivedMessage[];
4682
+ hasMore: boolean;
4683
+ }>>;
4684
+ getHistoryMessagesByObjectNames(conversationType: ConversationType, targetId: string, timestamp: number, count: number, messageTypes: string[], order: number, channelId: string): Promise<IAsyncRes<{
4569
4685
  list: IReceivedMessage[];
4570
4686
  hasMore: boolean;
4571
4687
  }>>;
@@ -4574,6 +4690,10 @@ declare class APIContext {
4574
4690
  * @param count 指定获取数量, 不传则获取全部会话列表,默认 `300`
4575
4691
  */
4576
4692
  getConversationList(count?: number, conversationType?: ConversationType, startTime?: number, order?: 0 | 1, channelId?: string): Promise<IAsyncRes<IReceivedConversation[]>>;
4693
+ /**
4694
+ * 分页获取会话列表,仅 electron中使用
4695
+ */
4696
+ getConversationsByPage(conversationTypes: ConversationType[], startTime: number, count: number, channelId: string): Promise<IAsyncRes<IReceivedConversation[]>>;
4577
4697
  /**
4578
4698
  * 获取单一会话数据
4579
4699
  * @param conversationType
@@ -4662,13 +4782,13 @@ declare class APIContext {
4662
4782
  * @param roomId 聊天室房间 Id
4663
4783
  * @param count 进入聊天室成功后,自动拉取的历史消息数量,默认值为 `10`,最大有效值为 `50`,`-1` 为不拉取
4664
4784
  */
4665
- joinChatroom(roomId: string, count?: number): Promise<ErrorCode>;
4785
+ joinChatroom(roomId: string, count?: number, traceId?: string): Promise<ErrorCode>;
4666
4786
  /**
4667
4787
  * 加入聊天室,若聊天室不存在则抛出异常
4668
4788
  * @param roomId 聊天室房间 Id
4669
4789
  * @param count 进入聊天室成功后,自动拉取的历史消息数量,默认值为 `10`,最大有效值为 `50`,`-1` 为不拉取
4670
4790
  */
4671
- joinExistChatroom(roomId: string, count?: number): Promise<ErrorCode>;
4791
+ joinExistChatroom(roomId: string, count?: number, traceId?: string): Promise<ErrorCode>;
4672
4792
  /**
4673
4793
  * 退出聊天室
4674
4794
  * @param roomId
@@ -4774,6 +4894,7 @@ declare class APIContext {
4774
4894
  getFileToken(fileType: FileType, fileName?: string, httpMethod?: 'POST' | 'PUT', queryString?: string): Promise<IUploadAuth & {
4775
4895
  bos: string;
4776
4896
  qiniu: string;
4897
+ ossConfig: string;
4777
4898
  }>;
4778
4899
  /**
4779
4900
  * 获取 七牛、百度、阿里云 上传成功可下载的 URL
@@ -4934,7 +5055,7 @@ declare class APIContext {
4934
5055
  /**
4935
5056
  * 获取指定人员在黑名单中的状态
4936
5057
  */
4937
- getBlacklistStatus(userId: string): Promise<IAsyncRes<string>>;
5058
+ getBlacklistStatus(userId: string): Promise<IAsyncRes<number>>;
4938
5059
  /**
4939
5060
  * 向本地插入一条消息,不发送到服务器
4940
5061
  */
@@ -4942,7 +5063,7 @@ declare class APIContext {
4942
5063
  /**
4943
5064
  * 删除本地消息
4944
5065
  */
4945
- deleteMessages(timestamp: number[]): Promise<ErrorCode>;
5066
+ deleteMessages(messageIds: number[]): Promise<ErrorCode>;
4946
5067
  /**
4947
5068
  * 从本地消息数据库中删除某一会话指定时间之前的消息数据
4948
5069
  */
@@ -4971,6 +5092,10 @@ declare class APIContext {
4971
5092
  * 设置消息接收状态
4972
5093
  */
4973
5094
  setMessageReceivedStatus(messageId: number, receivedStatus: number): Promise<ErrorCode>;
5095
+ /**
5096
+ * 将自己发送的指定时间之前的消息标记对方已读,状态值为 SentStatus.READ
5097
+ */
5098
+ setMessageStatusToRead(conversationType: ConversationType, targetId: string, timestamp: number, channelId?: string): Promise<IAsyncRes<boolean>>;
4974
5099
  /**
4975
5100
  * 设置当前用户在线状态
4976
5101
  */
@@ -4986,10 +5111,18 @@ declare class APIContext {
4986
5111
  status: string;
4987
5112
  }>>;
4988
5113
  searchConversationByContent(keyword: string, customMessageTypes?: string[], channelId?: string, conversationTypes?: ConversationType[]): Promise<IAsyncRes<IReceivedConversation[]>>;
5114
+ searchConversationByContentWithAllChannel(keyword: string, customMessageTypes?: string[], conversationTypes?: ConversationType[]): Promise<IAsyncRes<IReceivedConversation[]>>;
4989
5115
  searchMessageByContent(conversationType: ConversationType, targetId: string, keyword: string, timestamp: number, count: number, total: number, channelId?: string): Promise<IAsyncRes<{
4990
5116
  messages: IReceivedMessage[];
4991
5117
  count: number;
4992
5118
  }>>;
5119
+ searchMessageByContentWithAllChannel(conversationType: ConversationType, targetId: string, keyword: string, timestamp: number, count: number): Promise<IAsyncRes<{
5120
+ messages: IReceivedMessage[];
5121
+ count: number;
5122
+ }>>;
5123
+ searchMessageByContentInTimeRangeWithAllChannel(conversationType: ConversationType, targetId: string, keyword: string, startTime: number, endTime: number, offset: number, limit: number): Promise<IAsyncRes<{
5124
+ messages: IReceivedMessage[];
5125
+ }>>;
4993
5126
  getUnreadMentionedMessages(conversationType: ConversationType, targetId: string, channelId?: string): IReceivedMessage[];
4994
5127
  clearUnreadCountByTimestamp(conversationType: ConversationType, targetId: string, timestamp: number, channelId?: string): Promise<ErrorCode>;
4995
5128
  /**
@@ -5018,6 +5151,7 @@ declare class APIContext {
5018
5151
  }>>;
5019
5152
  getConversationListWithAllChannel(): Promise<IAsyncRes<IReceivedConversation[]>>;
5020
5153
  getConversationListWithAllChannelByPage(index: number, limit: number): Promise<IAsyncRes<IReceivedConversation[]>>;
5154
+ clearData(): Promise<IAsyncRes<boolean>>;
5021
5155
  /**
5022
5156
  * 加入房间
5023
5157
  * @param roomId
@@ -5325,7 +5459,6 @@ declare abstract class AEngine implements IEngine {
5325
5459
  protected readonly _appkey: string;
5326
5460
  protected readonly _apiVer: string;
5327
5461
  protected readonly _apiVersion: string;
5328
- protected _naviInfo: INaviInfo | null;
5329
5462
  /**
5330
5463
  * 引擎初始化
5331
5464
  * @param _appkey
@@ -5340,7 +5473,7 @@ declare abstract class AEngine implements IEngine {
5340
5473
  */
5341
5474
  getNaviInfo(token: string, dynamicUris: string[], force: boolean, checkCA?: boolean): Promise<INaviInfo | null>;
5342
5475
  protected setNaviInfo2Cache(token: string, naviInfo: INaviInfo): void;
5343
- getInfoFromCache(token: string): INaviInfo | null;
5476
+ abstract getNaviInfoFromCache(): INaviInfo | null;
5344
5477
  /**
5345
5478
  * 清空导航数据:内存数据、缓存数据
5346
5479
  */
@@ -5358,7 +5491,7 @@ declare abstract class AEngine implements IEngine {
5358
5491
  * @param naviInfo
5359
5492
  * @param reconnectKickEnable
5360
5493
  */
5361
- abstract connect(token: string, naviInfo: INaviInfo, reconnectKickEnable?: boolean): Promise<ErrorCode>;
5494
+ abstract connect(token: string, naviInfo: INaviInfo, reconnectKickEnable?: boolean, traceId?: string): Promise<ErrorCode>;
5362
5495
  /**
5363
5496
  * 发送SDK版本
5364
5497
  * @param versionInfo
@@ -5396,10 +5529,17 @@ declare abstract class AEngine implements IEngine {
5396
5529
  /**
5397
5530
  * 消息类型
5398
5531
  */
5399
- objectName: string): IPromiseResult<{
5532
+ objectName: string, traceId?: string): IPromiseResult<{
5400
5533
  list: IReceivedMessage[];
5401
5534
  hasMore: boolean;
5402
5535
  }>;
5536
+ /**
5537
+ * 获取指定消息类型的历史消息
5538
+ */
5539
+ abstract getHistoryMessagesByObjectNames(conversationType: ConversationType, targetId: string, timestamp: number, count: number, messageTypes: string[], order: number, channelId: string): Promise<IAsyncRes<{
5540
+ list: IReceivedMessage[];
5541
+ hasMore: boolean;
5542
+ }>>;
5403
5543
  /**
5404
5544
  * 删除历史消息 通过 messageUId
5405
5545
  */
@@ -5453,6 +5593,10 @@ declare abstract class AEngine implements IEngine {
5453
5593
  * 会话的业务标识
5454
5594
  */
5455
5595
  channelId?: string): IPromiseResult<IReceivedConversation[]>;
5596
+ /**
5597
+ * 分页获取会话列表,仅 electron中使用
5598
+ */
5599
+ abstract getConversationsByPage(conversationTypes: ConversationType[], startTime: number, count: number, channelId: string): IPromiseResult<IReceivedConversation[]>;
5456
5600
  /**
5457
5601
  * 获取指定会话
5458
5602
  */
@@ -5512,7 +5656,7 @@ declare abstract class AEngine implements IEngine {
5512
5656
  /**
5513
5657
  * c++ 消息写库后存在自增 Id,必要时需要向业务层暴露,JSEngine 无需实现
5514
5658
  */
5515
- onBefore?: (messageId: number) => void): IPromiseResult<IReceivedMessage>;
5659
+ onBefore?: (messageId: number) => void, traceId?: string): IPromiseResult<IReceivedMessage>;
5516
5660
  /**
5517
5661
  * 发送群组消息已读回执
5518
5662
  * 导航下发已读回执开关为 true 时调用
@@ -5550,12 +5694,12 @@ declare abstract class AEngine implements IEngine {
5550
5694
  * 加入聊天室
5551
5695
  * @param count 拉取消息数量
5552
5696
  */
5553
- abstract joinChatroom(chatroomId: string, count: number): Promise<ErrorCode>;
5697
+ abstract joinChatroom(chatroomId: string, count: number, traceId?: string): Promise<ErrorCode>;
5554
5698
  /**
5555
5699
  * 加入已存在的聊天室
5556
5700
  * @param count 拉取消息数量
5557
5701
  */
5558
- abstract joinExistChatroom(chatroomId: string, count: number): Promise<ErrorCode>;
5702
+ abstract joinExistChatroom(chatroomId: string, count: number, traceId?: string): Promise<ErrorCode>;
5559
5703
  /**
5560
5704
  * 退出聊天室
5561
5705
  */
@@ -5750,7 +5894,7 @@ declare abstract class AEngine implements IEngine {
5750
5894
  * @param targetId
5751
5895
  * @param options
5752
5896
  */
5753
- abstract sendUltraMessage(targetId: string, options: ISendMsgOptions): Promise<IAsyncRes>;
5897
+ abstract sendUltraMessage(targetId: string, options: ISendMsgOptions, onSendBefore?: (messageId: number) => void, traceId?: string): Promise<IAsyncRes>;
5754
5898
  /**
5755
5899
  * 超级群消息正在输入中
5756
5900
  * @param options
@@ -5776,7 +5920,7 @@ declare abstract class AEngine implements IEngine {
5776
5920
  * @param targetId
5777
5921
  * @param options
5778
5922
  */
5779
- abstract getUltraHistoryMsg(targetId: string, options: IGetMsgOption): Promise<IAsyncRes>;
5923
+ abstract getUltraHistoryMsg(targetId: string, options: IGetMsgOption, traceId?: string): Promise<IAsyncRes>;
5780
5924
  abstract getConversationListWithAllChannel(): IPromiseResult<IReceivedConversation[]>;
5781
5925
  abstract getConversationListWithAllChannelByPage(index: number, limit: number): IPromiseResult<IReceivedConversation[]>;
5782
5926
  /**
@@ -5818,7 +5962,7 @@ declare abstract class AEngine implements IEngine {
5818
5962
  /**
5819
5963
  * 获取指定人员在黑名单中的状态
5820
5964
  */
5821
- abstract getBlacklistStatus(userId: string): IPromiseResult<string>;
5965
+ abstract getBlacklistStatus(userId: string): IPromiseResult<number>;
5822
5966
  /**
5823
5967
  * 向本地插入一条消息,不发送到服务器
5824
5968
  */
@@ -5826,7 +5970,7 @@ declare abstract class AEngine implements IEngine {
5826
5970
  /**
5827
5971
  * 删除本地消息
5828
5972
  */
5829
- abstract deleteMessages(timestamps: number[]): Promise<ErrorCode>;
5973
+ abstract deleteMessages(messageIds: number[]): Promise<ErrorCode>;
5830
5974
  /**
5831
5975
  * 通过时间戳删除本地消息
5832
5976
  */
@@ -5851,6 +5995,10 @@ declare abstract class AEngine implements IEngine {
5851
5995
  * 通过关键字搜索会话
5852
5996
  */
5853
5997
  abstract searchConversationByContent(keyword: string, customMessageTypes: string[], channelId: string, conversationTypes?: ConversationType[]): IPromiseResult<IReceivedConversation[]>;
5998
+ /**
5999
+ * 通过关键字搜索所有会话
6000
+ */
6001
+ abstract searchConversationByContentWithAllChannel(keyword: string, customMessageTypes: string[], conversationTypes?: ConversationType[]): IPromiseResult<IReceivedConversation[]>;
5854
6002
  /**
5855
6003
  * 按内容搜索会话内的消息
5856
6004
  */
@@ -5858,6 +6006,19 @@ declare abstract class AEngine implements IEngine {
5858
6006
  messages: IReceivedMessage[];
5859
6007
  count: number;
5860
6008
  }>;
6009
+ /**
6010
+ * 按内容搜索指定会话(不区分 channelId)的消息
6011
+ */
6012
+ abstract searchMessageByContentWithAllChannel(conversationType: ConversationType, targetId: string, keyword: string, timestamp: number, count: number): IPromiseResult<{
6013
+ messages: IReceivedMessage[];
6014
+ count: number;
6015
+ }>;
6016
+ /**
6017
+ * 按内容搜索时间范围内指定会话(不区分 channelId)的消息
6018
+ */
6019
+ abstract searchMessageByContentInTimeRangeWithAllChannel(conversationType: ConversationType, targetId: string, keyword: string, startTime: number, endTime: number, offset: number, limit: number): IPromiseResult<{
6020
+ messages: IReceivedMessage[];
6021
+ }>;
5861
6022
  /**
5862
6023
  * 获取会话下所有未读的 @ 消息
5863
6024
  */
@@ -5870,6 +6031,10 @@ declare abstract class AEngine implements IEngine {
5870
6031
  * 设置消息接收状态
5871
6032
  */
5872
6033
  abstract setMessageReceivedStatus(messageId: number, receivedStatus: number): Promise<ErrorCode>;
6034
+ /**
6035
+ * 将自己发送的指定时间之前的消息标记对方已读,状态值为 SentStatus.READ
6036
+ */
6037
+ abstract updateMessageReceiptStatus(conversationType: ConversationType, targetId: string, timestamp: number, channelId?: string): IPromiseResult<boolean>;
5873
6038
  /**
5874
6039
  * 删除时间戳前的未读数
5875
6040
  */
@@ -5923,6 +6088,7 @@ declare abstract class AEngine implements IEngine {
5923
6088
  * 获取本地全部会话的状态
5924
6089
  */
5925
6090
  abstract getAllConversationState(): Promise<IAsyncRes<IConversationState[]>>;
6091
+ abstract clearData(): Promise<IAsyncRes<boolean>>;
5926
6092
  abstract joinRTCRoom(roomId: string, mode: RTCMode, broadcastType?: number, joinType?: RTCJoinType, innerUserDatas?: IRTCUserData, outerUserDatas?: IRTCUserData): IPromiseResult<IJoinRTCRoomData>;
5927
6093
  abstract quitRTCRoom(roomId: string): Promise<ErrorCode>;
5928
6094
  abstract rtcPing(roomId: string, mode: number, broadcastType?: number): Promise<ErrorCode>;
@@ -5997,232 +6163,6 @@ declare const appendUrl: (url: string, query?: {
5997
6163
  [key: string]: string | number | null;
5998
6164
  } | undefined) => string;
5999
6165
 
6000
- /**
6001
- * IndexDB中存储的log数据
6002
- */
6003
- interface ILogInfo {
6004
- sessionId: string;
6005
- time: number;
6006
- level: LogLevel;
6007
- content: string;
6008
- userId: string;
6009
- }
6010
- interface IRealTimeLog {
6011
- level: LogLevel;
6012
- content: string;
6013
- }
6014
-
6015
- interface ILogPolicy {
6016
- url: string;
6017
- level: number;
6018
- itv: number;
6019
- times: number;
6020
- }
6021
- interface IReportLogInitInfo {
6022
- runtime: IRuntime;
6023
- logSwitch: number;
6024
- logPolicy: ILogPolicy;
6025
- appkey: string;
6026
- version: string;
6027
- userId?: string;
6028
- sessionId?: string;
6029
- }
6030
- /**
6031
- * 更新上传日志属性
6032
- */
6033
- interface IReportLogUpdateInfo {
6034
- runtime?: IRuntime;
6035
- logSwitch?: number;
6036
- logPolicy?: ILogPolicy;
6037
- appkey?: string;
6038
- version?: string;
6039
- userId?: string;
6040
- sessionId?: string;
6041
- }
6042
- /**
6043
- * 初始化上传日志属性
6044
- */
6045
- interface IFullLogParams {
6046
- startTime: number;
6047
- endTime: number;
6048
- platform: string;
6049
- logId: string;
6050
- uri: string;
6051
- packageName?: string;
6052
- }
6053
- /**
6054
- * 日志上报类
6055
- */
6056
- declare class UploadLog {
6057
- private info;
6058
- private logUrl;
6059
- level: number;
6060
- itv: number;
6061
- times: number;
6062
- private deviceId;
6063
- private deviceInfo;
6064
- logSwitch: number;
6065
- static currentRTTimes: number;
6066
- static reportSwitch: boolean;
6067
- private static _instance;
6068
- constructor(info: IReportLogInitInfo);
6069
- /**
6070
- * 重新设置类属性
6071
- */
6072
- updateUploadLogAttr(info: IReportLogUpdateInfo): void;
6073
- static init(info: IReportLogInitInfo): UploadLog;
6074
- static getInstance(): UploadLog | null;
6075
- /**
6076
- * 上报实时日志
6077
- */
6078
- reportRealtimeLog(list: IRealTimeLog[]): Promise<void>;
6079
- /**
6080
- * 上报全量日志
6081
- */
6082
- reportFullLog(params: IFullLogParams): Promise<void>;
6083
- distroy(): void;
6084
- }
6085
-
6086
- /** 统计数据标签 **/
6087
- declare enum StatisticsTag {
6088
- 'IM_NAVI' = "IM-stats_navi-S",
6089
- 'IM_WEBSOCKET' = "IM-stats_websocket-S",
6090
- 'IM_COMET' = "IM-stats_comet-S",
6091
- 'IM_CONNECTION_DURATION' = "IM-stats_con_dur-S"
6092
- }
6093
-
6094
- /** 统计日志公共数据参数 */
6095
- interface IUpdateBaseStatisticsDataOption {
6096
- sdkPrivate?: number;
6097
- serverPrivate?: number;
6098
- bundleId?: string;
6099
- }
6100
- /** 统计日志公共数据 */
6101
- interface IBaseStatisticsData {
6102
- sdkPrivate: number;
6103
- serverPrivate: number;
6104
- bundleId: string;
6105
- }
6106
-
6107
- declare class Logger {
6108
- readonly tag: string;
6109
- readonly type?: LogType | undefined;
6110
- private readonly initiator?;
6111
- /**
6112
- *
6113
- * @param tag 标签
6114
- * @param type 类型
6115
- * @param initiator 发起方(A: APP 层,L: Lib 层)
6116
- */
6117
- constructor(tag: string, type?: LogType | undefined, initiator?: string | undefined);
6118
- /**
6119
- * 输出等级
6120
- */
6121
- private _outLevel;
6122
- /**
6123
- * 为向前兼容,暂不删除
6124
- */
6125
- private _stdout?;
6126
- /**
6127
- * 输出函数
6128
- */
6129
- private _logStdout?;
6130
- /**
6131
- * 本地存储日志列表
6132
- */
6133
- static databaseLogList: ILogInfo[];
6134
- /**
6135
- * 定时上传日志列表
6136
- */
6137
- static realTimeLogList: IRealTimeLog[];
6138
- static readonly sessionId: string;
6139
- static userId: string;
6140
- static init(userId: string): void;
6141
- static reset(): void;
6142
- /**
6143
- * 默认输出函数
6144
- * @param level
6145
- * @param args
6146
- */
6147
- private _defaultStdout;
6148
- /**
6149
- * 向 databaseLogList 中 push 日志
6150
- * @param level 打印等级
6151
- * @param content 日志内容
6152
- * @param tag 日志tag
6153
- */
6154
- __pushLocalLog(level: LogLevel, content: string, tag: string): void;
6155
- /**
6156
- * 向数据库中插入 log 数据
6157
- */
6158
- __insertLogIntoDatabase(): Promise<boolean>;
6159
- /**
6160
- * 修改 log 输出等级
6161
- * @param logLevel
6162
- */
6163
- setLogLevel(logLevel?: LogLevel): void;
6164
- setLogStdout(stdout?: (level: LogLevel, content: string) => void): void;
6165
- log(level: LogLevel, ...args: any[]): void;
6166
- debug: (...args: any[]) => void;
6167
- info: (...args: any[]) => void;
6168
- warn: (...args: any[]) => void;
6169
- error: (...args: any[]) => void;
6170
- fatal: (...args: any[]) => void;
6171
- /**
6172
- * 日志实时上报
6173
- * @param level 日志等级
6174
- * @param tag 日志标签
6175
- * @param content 日志内容
6176
- */
6177
- reportLog(level: LogLevel, tag: string, content: string): void;
6178
- /**
6179
- * @deprecated
6180
- * 函数已废弃,使用 `setLogLevel` 与 `setStdout` 方法替代
6181
- */
6182
- set(outLevel: LogLevel, stdout?: (level: LogLevel, ...args: any[]) => void): void;
6183
- /**
6184
- * 接口已废弃,改用 `setLogStdout`
6185
- * @param stdout
6186
- * @deprecated
6187
- */
6188
- setStdout(stdout?: (level: LogLevel, msgTag: string, ...args: any[]) => void): void;
6189
- __clearRealTimeLog(): void;
6190
- /** 日志上传实例 */
6191
- static _reportLog: UploadLog;
6192
- /** 初始化日志上传 */
6193
- initReportLog(info: IReportLogInitInfo): void;
6194
- /**
6195
- * 设置日志上传实例属性
6196
- */
6197
- updateUploadLogAttr(info: IReportLogUpdateInfo): void;
6198
- /**
6199
- * 开始上报实时日志(定时上传)
6200
- * @returns void
6201
- */
6202
- startReport(): void;
6203
- /**
6204
- * 上报统计日志
6205
- * @param tag 统计日志类型
6206
- * @param content 日志内容
6207
- */
6208
- reportStatisticsLog(tag: StatisticsTag | string, content: any): Promise<void>;
6209
- /** 统计日志缓存数据 */
6210
- private statisticsCaches;
6211
- private baseStatisData;
6212
- /**
6213
- * 更新统计日志共用数据 updateStatisticsBaseData
6214
- */
6215
- updateStatisticsBaseData(options: IUpdateBaseStatisticsDataOption): void;
6216
- /** 获取统计日志共用数据 getStatisticsBaseData */
6217
- getStatisticsBaseData(): IBaseStatisticsData;
6218
- /** 设置统计日志数据 setStatisticsData */
6219
- setStatisticsData<T>(tag: StatisticsTag | string, options?: T | {
6220
- [key: string]: any;
6221
- }, isReset?: boolean): void;
6222
- /** 获取数据 getStatisticsData */
6223
- getStatisticsData<T>(tag: StatisticsTag | string): T | any;
6224
- }
6225
-
6226
6166
  declare type IEventListener = (...args: any[]) => void;
6227
6167
  declare class EventEmitter {
6228
6168
  private readonly _map;
@@ -6337,6 +6277,7 @@ declare const isHttpUrl: (value: any) => boolean;
6337
6277
  */
6338
6278
  declare const notEmptyObject: (val: Object) => boolean;
6339
6279
  declare const isValidConversationType: (conversation: number) => boolean;
6280
+ declare const isValidChannelId: (value: any) => boolean;
6340
6281
  /**
6341
6282
  * 判断是否是一个有效的文件类型
6342
6283
  */
@@ -6350,6 +6291,152 @@ declare const isValidExpansion: (expansion: {
6350
6291
  [key: string]: string;
6351
6292
  } | undefined) => IIsValidExpansion;
6352
6293
 
6294
+ /** ******************************************新重构logger,按照Web新日志规范上报 ********************************** **/
6295
+ declare const sessionId: string;
6296
+ /**
6297
+ * logLevelTransformer
6298
+ * @description 数据中心与前端日志规范LogLevel定义不统一
6299
+ * WebLogLevel(前端日志级别) -> ServerLogLevel(服务器日志级别)
6300
+ * @param level { LogLevel }
6301
+ * @returns serverLogLevel
6302
+ */
6303
+ declare function logLevelTransformer(level: LogLevel): number;
6304
+ /**
6305
+ * 序列化引用型数据为字符串
6306
+ * @value value
6307
+ */
6308
+ declare const formatLogObj: (value: unknown) => unknown;
6309
+ /**
6310
+ * 缓存日志
6311
+ * @param logLevel 打印等级
6312
+ * @param logObj 日志内容
6313
+ * @param tagId 日志tag
6314
+ */
6315
+ declare function insertIntoLogCache(logLevel: LogLevel, tagId: string, logObj: any, logSource?: LogSource): ILogInfo;
6316
+ /**
6317
+ * 本地默认输出函数
6318
+ * @param level
6319
+ * @param args
6320
+ */
6321
+ declare function _defaultStdout(level: LogLevel, msgTag: string, ...logContents: any[]): void;
6322
+ /**
6323
+ * Trace ID 生成器
6324
+ */
6325
+ declare function ID(): string;
6326
+ declare function init(userLogInfo: ILogInit): void;
6327
+ declare function log(logLevel: LogLevel, tagId: LogTagId | string, logObj?: Object, logExtens?: ILogExtensions): void;
6328
+ declare const debug: (tagId: string, logObj?: Object | undefined, logExtens?: ILogExtensions | undefined) => void;
6329
+ declare const info: (tagId: string, logObj?: Object | undefined, logExtens?: ILogExtensions | undefined) => void;
6330
+ declare const warn: (tagId: string, logObj?: Object | undefined, logExtens?: ILogExtensions | undefined) => void;
6331
+ declare const error: (tagId: string, logObj?: Object | undefined, logExtens?: ILogExtensions | undefined) => void;
6332
+ declare const fatal: (tagId: string, logObj?: Object | undefined, logExtens?: ILogExtensions | undefined) => void;
6333
+
6334
+ declare const base_sessionId: typeof sessionId;
6335
+ declare const base_logLevelTransformer: typeof logLevelTransformer;
6336
+ declare const base_formatLogObj: typeof formatLogObj;
6337
+ declare const base_insertIntoLogCache: typeof insertIntoLogCache;
6338
+ declare const base__defaultStdout: typeof _defaultStdout;
6339
+ declare const base_ID: typeof ID;
6340
+ declare const base_init: typeof init;
6341
+ declare const base_log: typeof log;
6342
+ declare const base_debug: typeof debug;
6343
+ declare const base_info: typeof info;
6344
+ declare const base_warn: typeof warn;
6345
+ declare const base_error: typeof error;
6346
+ declare const base_fatal: typeof fatal;
6347
+ declare namespace base {
6348
+ export {
6349
+ base_sessionId as sessionId,
6350
+ base_logLevelTransformer as logLevelTransformer,
6351
+ base_formatLogObj as formatLogObj,
6352
+ base_insertIntoLogCache as insertIntoLogCache,
6353
+ base__defaultStdout as _defaultStdout,
6354
+ base_ID as ID,
6355
+ base_init as init,
6356
+ base_log as log,
6357
+ base_debug as debug,
6358
+ base_info as info,
6359
+ base_warn as warn,
6360
+ base_error as error,
6361
+ base_fatal as fatal,
6362
+ };
6363
+ }
6364
+
6365
+ /** *********************实时日志上报***************** */
6366
+
6367
+ /**
6368
+ * 缓存日志实时
6369
+ * @param logLevel 日志等级
6370
+ * @param tagId 日志标签
6371
+ * @param content 日志内容
6372
+ */
6373
+ declare function reportLog(logLevel: LogLevel, tagId: string, content: string, logSource?: LogSource): void;
6374
+
6375
+ /** ******************************************旧Logger类,fix兼容用,逐步废弃 ********************************** **/
6376
+
6377
+ /**
6378
+ * @description 兼容旧版用法,建议用Logger静态方法
6379
+ * 1、不符合新版Web日志规范
6380
+ * 2、不支持自定义TagId
6381
+ * 3、后续可能删除,要逐步迁移新Web规范
6382
+ */
6383
+ declare class Logger {
6384
+ readonly tagId: string;
6385
+ readonly logSource?: LogSource | undefined;
6386
+ private readonly initiator?;
6387
+ /**
6388
+ *
6389
+ * @param tagId
6390
+ * @param logSource 类型
6391
+ * @param initiator 发起方(A: APP 层,L: Lib 层)
6392
+ */
6393
+ constructor(tagId: string, logSource?: LogSource | undefined, initiator?: string | undefined);
6394
+ /**
6395
+ * 本地控制台日志输出级别
6396
+ */
6397
+ private _localLogLevel;
6398
+ /**
6399
+ * 自定义本地日志输出函数
6400
+ */
6401
+ private _customLogPrint?;
6402
+ /**
6403
+ * 为向前兼容,暂不删除
6404
+ */
6405
+ private _stdout?;
6406
+ /**
6407
+ * 自定义本地打印日志级别
6408
+ * @param logLevel
6409
+ */
6410
+ setLogLevel(logLevel?: LogLevel): void;
6411
+ /**
6412
+ * 自定义本地打印函数
6413
+ */
6414
+ setLogStdout(stdout?: (level: LogLevel, content: string) => void): void;
6415
+ log(logLevel: LogLevel, ...args: any[]): void;
6416
+ debug: (...args: any[]) => void;
6417
+ info: (...args: any[]) => void;
6418
+ warn: (...args: any[]) => void;
6419
+ error: (...args: any[]) => void;
6420
+ fatal: (...args: any[]) => void;
6421
+ /**
6422
+ * @deprecated
6423
+ * 函数已废弃,使用 `setLogLevel` 与 `setStdout` 方法替代
6424
+ */
6425
+ set(outLevel: LogLevel, stdout?: (level: LogLevel, ...args: any[]) => void): void;
6426
+ /**
6427
+ * 接口已废弃,改用 `setLogStdout`
6428
+ * @param stdout
6429
+ * @deprecated
6430
+ */
6431
+ setStdout(stdout?: (level: LogLevel, msgTag: string, ...args: any[]) => void): void;
6432
+ reportLog: typeof reportLog;
6433
+ }
6434
+ declare const _default: Logger;
6435
+
6436
+ declare const randomNum: (min: number, max: number) => number;
6437
+ declare const getUUID: () => string;
6438
+ declare const getUUID22: () => string;
6439
+
6353
6440
  /**
6354
6441
  * 预定义的验证规则,只包含`值类型`数据验证
6355
6442
  * 引用类型数据需使用自定义 validator 校验函数进行校验
@@ -6386,7 +6473,11 @@ declare enum AssertRules {
6386
6473
  /**
6387
6474
  * ChannelId 验证,必须为 String 且不超过 20 位 且不能包含下划线
6388
6475
  */
6389
- CHANNEL_ID = 7
6476
+ CHANNEL_ID = 7,
6477
+ /**
6478
+ * 类型为会话
6479
+ */
6480
+ CONVERSATION = 8
6390
6481
  }
6391
6482
  declare class RCAssertError extends Error {
6392
6483
  constructor(message?: string);
@@ -6577,10 +6668,14 @@ declare enum CONNECTION_TYPE {
6577
6668
  WEBSOCKET = "websocket",
6578
6669
  COMET = "comet"
6579
6670
  }
6671
+ declare const REAT_TIME_LOG_SIZE = 500;
6672
+ declare const DB_LOG_MAX_SIZE = 100000;
6673
+ declare const DB_LOG_FLUSH_FREQUENCY = 3000;
6674
+ declare const ONE_LOG_SIZE_MAX = 1000;
6580
6675
 
6581
6676
  /**
6582
6677
  * engine 版本号
6583
6678
  */
6584
6679
  declare const version: string;
6585
6680
 
6586
- export { AEngine, 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 };
6681
+ export { AEngine, APIContext, AppStorage, AssertRules, CONNECTION_TYPE, CPP_PROTOCAL_MSGTYPE_OPTION, CallLibMsgType, ChatroomEntryType, ChatroomUserChangeType, CometChannel, ConnectResultCode, ConnectionStatus, ConversationType, DB_LOG_FLUSH_FREQUENCY, DB_LOG_MAX_SIZE, DelayTimer, ErrorCode, EventEmitter, FileType, HttpMethod, IAPIContextOption, IAndroidPushConfig, IAsyncRes, IBaseConversationInfo, IBlockedMessageInfo, ICancelRoomPKOptions, IChatRoomEntries, IChatRoomEntry, IChatroomEntries, IChatroomEntry, IChatroomEntryListenerData, IChatroomInfo, IChatroomListener, IChatroomListenerData, IChatroomRejoinedFailed, IChatroomRejoinedInfo, IChatroomRejoinedSuccessed, IChatroomUser, IChatroomUserChangeInfo, IChrmKVEntries, IChrmKVEntry, IConnectResult, IConnectionStatusListener, IConversationOption, IConversationState, IConversationStateListener, IConversationTag, IConversationTagListener, IDataChannelWatcher, IDeletedExpansion, IEndRoomPKOptions, IEngine, IEngineWatcher, IEventListener, IExpansionListener, IExpansionListenerData, IExpansionMsgContent, IExtraMethod, IGetMsgOption, IGooglePushConfig, 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, IiOSPushConfig, 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 };