@rongcloud/engine 5.3.3 → 5.3.4

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
@@ -1190,9 +1190,9 @@ declare enum ErrorCode {
1190
1190
  */
1191
1191
  CHATROOM_KEY_NOT_EXIST = 23427,
1192
1192
  /*!
1193
- 聊天室设置 KV 失败,出现在两人或者多端同时操作一个 kv。
1194
- 如果出现该错误,为避免和其他端同时操作,请延时一定时间再试
1195
- */
1193
+ 聊天室设置 KV 失败,出现在两人或者多端同时操作一个 kv。
1194
+ 如果出现该错误,为避免和其他端同时操作,请延时一定时间再试
1195
+ */
1196
1196
  CHATROOM_KV_SET_ERROR = 23431,
1197
1197
  /**
1198
1198
  * 敏感词屏蔽
@@ -1327,6 +1327,10 @@ declare enum ErrorCode {
1327
1327
  * Disconnect,由服务器返回,比如用户互踢。
1328
1328
  */
1329
1329
  RC_DISCONN_EXCEPTION = 31011,
1330
+ /**
1331
+ * 开启禁止把已在线客户端踢下线开关后,该错误码标识已有同类型端在线,禁止链接;
1332
+ */
1333
+ RC_DISCONN_SAME_CLIENT_ON_LINE = 31023,
1330
1334
  /**
1331
1335
  * app 验证Token 验证不通过。所有内部超时,访问失败,返回给客户端sdk都是验证不通过,由服务端日志去看具体是那种失败。
1332
1336
  */
@@ -1416,11 +1420,11 @@ declare enum ErrorCode {
1416
1420
  CONVER_CLEAR_ERROR = 34007,
1417
1421
  /**
1418
1422
  * 扩展存储 key value 超出限制 (错误码与移动端对齐)
1419
- */
1423
+ */
1420
1424
  EXPANSION_LIMIT_EXCEET = 34010,
1421
1425
  /**
1422
1426
  * 消息不支持扩展,原消息 canIncludeExpansion 值为 false (错误码与移动端对齐)
1423
- */
1427
+ */
1424
1428
  MESSAGE_KV_NOT_SUPPORT = 34008,
1425
1429
  CLEAR_HIS_TIME_ERROR = 34011,
1426
1430
  /**
@@ -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,83 @@ 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
+ 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
+ }
2974
3025
 
2975
3026
  /**
2976
3027
  * 拓展方法定义,便于 electron-solution 实现时保持接口类型推导可用
@@ -3705,6 +3756,32 @@ interface ITypingMessage {
3705
3756
  list: Array<ITypingUser>;
3706
3757
  }
3707
3758
 
3759
+ /**
3760
+ * IndexDB中存储的log数据
3761
+ */
3762
+ interface ILogInfo {
3763
+ sessionId: string;
3764
+ time: number;
3765
+ level: LogLevel;
3766
+ content: string;
3767
+ userId?: string;
3768
+ logSource?: LogSource;
3769
+ tagId?: LogTagId;
3770
+ }
3771
+ interface IRealTimeLog {
3772
+ level: LogLevel;
3773
+ content: string;
3774
+ }
3775
+ interface ILogExtensions {
3776
+ traceId?: string;
3777
+ logSource?: LogSource;
3778
+ }
3779
+ interface ILogInit {
3780
+ userId?: string;
3781
+ localLogLevel?: LogLevel;
3782
+ customLogPrint?: (logLevel: LogLevel, msg: string) => void;
3783
+ }
3784
+
3708
3785
  /**
3709
3786
  * 定义已废弃,请使用 `IRemoveChatroomEntries` 替换
3710
3787
  * @deprecated
@@ -3965,7 +4042,7 @@ declare class DataCodec {
3965
4042
  /**
3966
4043
  * 设置会话状态 (置顶、免打扰)
3967
4044
  */
3968
- encodeSetConversationStatus(statusList: Array<ISetConversationStatusOptions>): any;
4045
+ encodeSetConversationStatus(statusList: Array<ISetConversationStatusOptions>, conversationUpdatedTime: number): any;
3969
4046
  /**
3970
4047
  * 序列化发送群组已读回执
3971
4048
  */
@@ -4230,32 +4307,6 @@ declare class CometChannel extends ADataChannel {
4230
4307
  close(): void;
4231
4308
  }
4232
4309
 
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
4310
  declare type IMessageListnenr = (message: IReceivedMessage, leftCount?: number, hasMore?: boolean) => void;
4260
4311
  declare type IMessagesListnenr = (messages: IReceivedMessage[], leftCount?: number, hasMore?: boolean) => void;
4261
4312
  declare type IConnectionStatusListener = (status: ConnectionStatus) => void;
@@ -4375,6 +4426,32 @@ interface IAPIContextOption {
4375
4426
  checkCA?: boolean;
4376
4427
  }
4377
4428
 
4429
+ interface IPluginGenerator<API, InitOption> {
4430
+ /**
4431
+ * 只读插件标识
4432
+ */
4433
+ readonly tag: string;
4434
+ /**
4435
+ * 版本号
4436
+ */
4437
+ readonly version?: string;
4438
+ /**
4439
+ * 插件名称
4440
+ */
4441
+ readonly name?: string;
4442
+ /**
4443
+ * 插件安装前的环境检测,通过返回 boolean 值确认插件是否可运行
4444
+ */
4445
+ verify(runtime: IRuntime): boolean;
4446
+ /**
4447
+ * 插件初始化
4448
+ * @param context 插件调用上下文,用于实现插件的消息注册、消息首发等
4449
+ * @param runtime 运行时实例,用于标识最终的运行时平台
4450
+ * @param options 初始化参数
4451
+ */
4452
+ setup(context: PluginContext, runtime: IRuntime, options: InitOption): API;
4453
+ }
4454
+
4378
4455
  declare class APIContext {
4379
4456
  private _runtime;
4380
4457
  private static _context?;
@@ -4501,7 +4578,7 @@ declare class APIContext {
4501
4578
  这个字段就是为这种情况加的。
4502
4579
  设置 reconnectKickEnable 为 true 时,SDK 重连的时候发现此时已有别的设备连接成功,不再强行踢出已有设备,而是踢出重连设备。
4503
4580
  */
4504
- connect(token: string, refreshNavi?: boolean, reconnectKickEnable?: boolean): Promise<IConnectResult>;
4581
+ connect(token: string, refreshNavi?: boolean, reconnectKickEnable?: boolean, traceId?: string): Promise<IConnectResult>;
4505
4582
  /**
4506
4583
  * 拉取实时配置 web 端需更新 voipCall 字段
4507
4584
  */
@@ -4531,7 +4608,7 @@ declare class APIContext {
4531
4608
  * @param content
4532
4609
  * @param options
4533
4610
  */
4534
- sendMessage(conversationType: ConversationType, targetId: string, options: ISendMsgOptions, onBefore?: (messageId: number) => void): Promise<IAsyncRes<IReceivedMessage>>;
4611
+ sendMessage(conversationType: ConversationType, targetId: string, options: ISendMsgOptions, onBefore?: (messageId: number) => void, traceId?: string): Promise<IAsyncRes<IReceivedMessage>>;
4535
4612
  /**
4536
4613
  * 发送扩展消息
4537
4614
  * @param messageUId 消息 Id
@@ -4565,7 +4642,7 @@ declare class APIContext {
4565
4642
  * @param channelId
4566
4643
  * @param objectName
4567
4644
  */
4568
- getHistoryMessage(conversationType: ConversationType, targetId: string, timestamp?: number, count?: number, order?: 0 | 1, channelId?: string, objectName?: string): Promise<IAsyncRes<{
4645
+ getHistoryMessage(conversationType: ConversationType, targetId: string, timestamp?: number, count?: number, order?: 0 | 1, channelId?: string, objectName?: string, traceId?: string): Promise<IAsyncRes<{
4569
4646
  list: IReceivedMessage[];
4570
4647
  hasMore: boolean;
4571
4648
  }>>;
@@ -4662,13 +4739,13 @@ declare class APIContext {
4662
4739
  * @param roomId 聊天室房间 Id
4663
4740
  * @param count 进入聊天室成功后,自动拉取的历史消息数量,默认值为 `10`,最大有效值为 `50`,`-1` 为不拉取
4664
4741
  */
4665
- joinChatroom(roomId: string, count?: number): Promise<ErrorCode>;
4742
+ joinChatroom(roomId: string, count?: number, traceId?: string): Promise<ErrorCode>;
4666
4743
  /**
4667
4744
  * 加入聊天室,若聊天室不存在则抛出异常
4668
4745
  * @param roomId 聊天室房间 Id
4669
4746
  * @param count 进入聊天室成功后,自动拉取的历史消息数量,默认值为 `10`,最大有效值为 `50`,`-1` 为不拉取
4670
4747
  */
4671
- joinExistChatroom(roomId: string, count?: number): Promise<ErrorCode>;
4748
+ joinExistChatroom(roomId: string, count?: number, traceId?: string): Promise<ErrorCode>;
4672
4749
  /**
4673
4750
  * 退出聊天室
4674
4751
  * @param roomId
@@ -4774,6 +4851,7 @@ declare class APIContext {
4774
4851
  getFileToken(fileType: FileType, fileName?: string, httpMethod?: 'POST' | 'PUT', queryString?: string): Promise<IUploadAuth & {
4775
4852
  bos: string;
4776
4853
  qiniu: string;
4854
+ ossConfig: string;
4777
4855
  }>;
4778
4856
  /**
4779
4857
  * 获取 七牛、百度、阿里云 上传成功可下载的 URL
@@ -5358,7 +5436,7 @@ declare abstract class AEngine implements IEngine {
5358
5436
  * @param naviInfo
5359
5437
  * @param reconnectKickEnable
5360
5438
  */
5361
- abstract connect(token: string, naviInfo: INaviInfo, reconnectKickEnable?: boolean): Promise<ErrorCode>;
5439
+ abstract connect(token: string, naviInfo: INaviInfo, reconnectKickEnable?: boolean, traceId?: string): Promise<ErrorCode>;
5362
5440
  /**
5363
5441
  * 发送SDK版本
5364
5442
  * @param versionInfo
@@ -5396,7 +5474,7 @@ declare abstract class AEngine implements IEngine {
5396
5474
  /**
5397
5475
  * 消息类型
5398
5476
  */
5399
- objectName: string): IPromiseResult<{
5477
+ objectName: string, traceId?: string): IPromiseResult<{
5400
5478
  list: IReceivedMessage[];
5401
5479
  hasMore: boolean;
5402
5480
  }>;
@@ -5512,7 +5590,7 @@ declare abstract class AEngine implements IEngine {
5512
5590
  /**
5513
5591
  * c++ 消息写库后存在自增 Id,必要时需要向业务层暴露,JSEngine 无需实现
5514
5592
  */
5515
- onBefore?: (messageId: number) => void): IPromiseResult<IReceivedMessage>;
5593
+ onBefore?: (messageId: number) => void, traceId?: string): IPromiseResult<IReceivedMessage>;
5516
5594
  /**
5517
5595
  * 发送群组消息已读回执
5518
5596
  * 导航下发已读回执开关为 true 时调用
@@ -5550,12 +5628,12 @@ declare abstract class AEngine implements IEngine {
5550
5628
  * 加入聊天室
5551
5629
  * @param count 拉取消息数量
5552
5630
  */
5553
- abstract joinChatroom(chatroomId: string, count: number): Promise<ErrorCode>;
5631
+ abstract joinChatroom(chatroomId: string, count: number, traceId?: string): Promise<ErrorCode>;
5554
5632
  /**
5555
5633
  * 加入已存在的聊天室
5556
5634
  * @param count 拉取消息数量
5557
5635
  */
5558
- abstract joinExistChatroom(chatroomId: string, count: number): Promise<ErrorCode>;
5636
+ abstract joinExistChatroom(chatroomId: string, count: number, traceId?: string): Promise<ErrorCode>;
5559
5637
  /**
5560
5638
  * 退出聊天室
5561
5639
  */
@@ -5750,7 +5828,7 @@ declare abstract class AEngine implements IEngine {
5750
5828
  * @param targetId
5751
5829
  * @param options
5752
5830
  */
5753
- abstract sendUltraMessage(targetId: string, options: ISendMsgOptions): Promise<IAsyncRes>;
5831
+ abstract sendUltraMessage(targetId: string, options: ISendMsgOptions, traceId?: string): Promise<IAsyncRes>;
5754
5832
  /**
5755
5833
  * 超级群消息正在输入中
5756
5834
  * @param options
@@ -5776,7 +5854,7 @@ declare abstract class AEngine implements IEngine {
5776
5854
  * @param targetId
5777
5855
  * @param options
5778
5856
  */
5779
- abstract getUltraHistoryMsg(targetId: string, options: IGetMsgOption): Promise<IAsyncRes>;
5857
+ abstract getUltraHistoryMsg(targetId: string, options: IGetMsgOption, traceId?: string): Promise<IAsyncRes>;
5780
5858
  abstract getConversationListWithAllChannel(): IPromiseResult<IReceivedConversation[]>;
5781
5859
  abstract getConversationListWithAllChannelByPage(index: number, limit: number): IPromiseResult<IReceivedConversation[]>;
5782
5860
  /**
@@ -5997,232 +6075,6 @@ declare const appendUrl: (url: string, query?: {
5997
6075
  [key: string]: string | number | null;
5998
6076
  } | undefined) => string;
5999
6077
 
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
6078
  declare type IEventListener = (...args: any[]) => void;
6227
6079
  declare class EventEmitter {
6228
6080
  private readonly _map;
@@ -6350,6 +6202,148 @@ declare const isValidExpansion: (expansion: {
6350
6202
  [key: string]: string;
6351
6203
  } | undefined) => IIsValidExpansion;
6352
6204
 
6205
+ /** ******************************************新重构logger,按照Web新日志规范上报 ********************************** **/
6206
+ declare const sessionId: string;
6207
+ /**
6208
+ * logLevelTransformer
6209
+ * @description 数据中心与前端日志规范LogLevel定义不统一
6210
+ * WebLogLevel(前端日志级别) -> ServerLogLevel(服务器日志级别)
6211
+ * @param level { LogLevel }
6212
+ * @returns serverLogLevel
6213
+ */
6214
+ declare function logLevelTransformer(level: LogLevel): number;
6215
+ /**
6216
+ * 序列化引用型数据为字符串
6217
+ * @value value
6218
+ */
6219
+ declare const formatLogObj: (value: unknown) => unknown;
6220
+ /**
6221
+ * 缓存日志
6222
+ * @param logLevel 打印等级
6223
+ * @param logObj 日志内容
6224
+ * @param tagId 日志tag
6225
+ */
6226
+ declare function insertIntoLogCache(logLevel: LogLevel, tagId: string, logObj: any, logSource?: LogSource): ILogInfo;
6227
+ /**
6228
+ * 本地默认输出函数
6229
+ * @param level
6230
+ * @param args
6231
+ */
6232
+ declare function _defaultStdout(level: LogLevel, msgTag: string, logContent?: any): void;
6233
+ /**
6234
+ * Trace ID 生成器
6235
+ */
6236
+ declare function ID(): string;
6237
+ declare function init(userLogInfo: ILogInit): void;
6238
+ declare function log(logLevel: LogLevel, tagId: LogTagId | string, logObj?: Object, logExtens?: ILogExtensions): void;
6239
+ declare const debug: (tagId: string, logObj?: Object | undefined, logExtens?: ILogExtensions | undefined) => void;
6240
+ declare const info: (tagId: string, logObj?: Object | undefined, logExtens?: ILogExtensions | undefined) => void;
6241
+ declare const warn: (tagId: string, logObj?: Object | undefined, logExtens?: ILogExtensions | undefined) => void;
6242
+ declare const error: (tagId: string, logObj?: Object | undefined, logExtens?: ILogExtensions | undefined) => void;
6243
+ declare const fatal: (tagId: string, logObj?: Object | undefined, logExtens?: ILogExtensions | undefined) => void;
6244
+
6245
+ declare const base_sessionId: typeof sessionId;
6246
+ declare const base_logLevelTransformer: typeof logLevelTransformer;
6247
+ declare const base_formatLogObj: typeof formatLogObj;
6248
+ declare const base_insertIntoLogCache: typeof insertIntoLogCache;
6249
+ declare const base__defaultStdout: typeof _defaultStdout;
6250
+ declare const base_ID: typeof ID;
6251
+ declare const base_init: typeof init;
6252
+ declare const base_log: typeof log;
6253
+ declare const base_debug: typeof debug;
6254
+ declare const base_info: typeof info;
6255
+ declare const base_warn: typeof warn;
6256
+ declare const base_error: typeof error;
6257
+ declare const base_fatal: typeof fatal;
6258
+ declare namespace base {
6259
+ export {
6260
+ base_sessionId as sessionId,
6261
+ base_logLevelTransformer as logLevelTransformer,
6262
+ base_formatLogObj as formatLogObj,
6263
+ base_insertIntoLogCache as insertIntoLogCache,
6264
+ base__defaultStdout as _defaultStdout,
6265
+ base_ID as ID,
6266
+ base_init as init,
6267
+ base_log as log,
6268
+ base_debug as debug,
6269
+ base_info as info,
6270
+ base_warn as warn,
6271
+ base_error as error,
6272
+ base_fatal as fatal,
6273
+ };
6274
+ }
6275
+
6276
+ /** *********************实时日志上报***************** */
6277
+
6278
+ /**
6279
+ * 缓存日志实时
6280
+ * @param logLevel 日志等级
6281
+ * @param tagId 日志标签
6282
+ * @param content 日志内容
6283
+ */
6284
+ declare function reportLog(logLevel: LogLevel, tagId: string, content: string, logSource?: LogSource): void;
6285
+
6286
+ /** ******************************************旧Logger类,fix兼容用,逐步废弃 ********************************** **/
6287
+
6288
+ /**
6289
+ * @description 兼容旧版用法,建议用Logger静态方法
6290
+ * 1、不符合新版Web日志规范
6291
+ * 2、不支持自定义TagId
6292
+ * 3、后续可能删除,要逐步迁移新Web规范
6293
+ */
6294
+ declare class Logger {
6295
+ readonly tagId: string;
6296
+ readonly logSource?: LogSource | undefined;
6297
+ private readonly initiator?;
6298
+ /**
6299
+ *
6300
+ * @param tagId
6301
+ * @param logSource 类型
6302
+ * @param initiator 发起方(A: APP 层,L: Lib 层)
6303
+ */
6304
+ constructor(tagId: string, logSource?: LogSource | undefined, initiator?: string | undefined);
6305
+ /**
6306
+ * 本地控制台日志输出级别
6307
+ */
6308
+ private _localLogLevel;
6309
+ /**
6310
+ * 自定义本地日志输出函数
6311
+ */
6312
+ private _customLogPrint?;
6313
+ /**
6314
+ * 为向前兼容,暂不删除
6315
+ */
6316
+ private _stdout?;
6317
+ /**
6318
+ * 自定义本地打印日志级别
6319
+ * @param logLevel
6320
+ */
6321
+ setLogLevel(logLevel?: LogLevel): void;
6322
+ /**
6323
+ * 自定义本地打印函数
6324
+ */
6325
+ setLogStdout(stdout?: (level: LogLevel, content: string) => void): void;
6326
+ log(logLevel: LogLevel, ...args: any[]): void;
6327
+ debug: (...args: any[]) => void;
6328
+ info: (...args: any[]) => void;
6329
+ warn: (...args: any[]) => void;
6330
+ error: (...args: any[]) => void;
6331
+ fatal: (...args: any[]) => void;
6332
+ /**
6333
+ * @deprecated
6334
+ * 函数已废弃,使用 `setLogLevel` 与 `setStdout` 方法替代
6335
+ */
6336
+ set(outLevel: LogLevel, stdout?: (level: LogLevel, ...args: any[]) => void): void;
6337
+ /**
6338
+ * 接口已废弃,改用 `setLogStdout`
6339
+ * @param stdout
6340
+ * @deprecated
6341
+ */
6342
+ setStdout(stdout?: (level: LogLevel, msgTag: string, ...args: any[]) => void): void;
6343
+ reportLog: typeof reportLog;
6344
+ }
6345
+ declare const _default: Logger;
6346
+
6353
6347
  /**
6354
6348
  * 预定义的验证规则,只包含`值类型`数据验证
6355
6349
  * 引用类型数据需使用自定义 validator 校验函数进行校验
@@ -6577,10 +6571,14 @@ declare enum CONNECTION_TYPE {
6577
6571
  WEBSOCKET = "websocket",
6578
6572
  COMET = "comet"
6579
6573
  }
6574
+ declare const REAT_TIME_LOG_SIZE = 500;
6575
+ declare const DB_LOG_MAX_SIZE = 100000;
6576
+ declare const DB_LOG_FLUSH_FREQUENCY = 3000;
6577
+ declare const ONE_LOG_SIZE_MAX = 1000;
6580
6578
 
6581
6579
  /**
6582
6580
  * engine 版本号
6583
6581
  */
6584
6582
  declare const version: string;
6585
6583
 
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 };
6584
+ 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, getUploadFileName, indexOf, isArray, isArrayBuffer, isBoolean, isFunction, isHttpUrl, isInObject, isInclude, isNull, isNumber, isObject, isString, isUndefined, isValidChrmEntryKey, isValidChrmEntryValue, isValidConversationType, isValidExpansion, isValidFileType, base as logger, map, notEmptyArray, notEmptyObject, notEmptyString, pushConfigsToJSON, pushJSONToConfigs, todo, usingCppEngine, validate, version };