@rongcloud/engine 5.8.4 → 5.8.5-alpha.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
@@ -1432,6 +1432,16 @@ declare enum ErrorCode {
1432
1432
  * 设置的代理地址不可用
1433
1433
  */
1434
1434
  RC_CONN_PROXY_UNAVAILABLE = 34245,
1435
+ /**
1436
+ * 不支持V4已读回执功能
1437
+ * @since todo
1438
+ */
1439
+ READ_RECEIPT_V4_NOT_SUPPORT = 34292,
1440
+ /**
1441
+ * 不支持更新v4已读回执信息
1442
+ * @since todo
1443
+ */
1444
+ READ_RECEIPT_V4_UPDATE_NOT_SUPPORT = 34293,
1435
1445
  /**
1436
1446
  * 方法未支持
1437
1447
  */
@@ -1468,6 +1478,10 @@ declare enum ErrorCode {
1468
1478
  * 搜索字段对应消息错误
1469
1479
  */
1470
1480
  SEARCH_PROPS_LIMIT_ERROR = 35022,
1481
+ /**
1482
+ * 无效的数据中心请求, appkey 不是该数据中心的,需要重定向到正确的数据中心
1483
+ */
1484
+ CLOUD_DATA_CENTER_INVALID = 20512,
1471
1485
  /** ============================= 错误码 -- 废弃部分 ============================= */
1472
1486
  /**
1473
1487
  * 未知原因失败。
@@ -1890,6 +1904,10 @@ declare enum MessageType {
1890
1904
  * 合并转发消息
1891
1905
  */
1892
1906
  COMBINE = "RC:CombineMsg",
1907
+ /**
1908
+ * 合并转发消息 v2 版本
1909
+ */
1910
+ COMBINE_V2 = "RC:CombineV2Msg",
1893
1911
  /**
1894
1912
  * 聊天室 KV 通知消息
1895
1913
  */
@@ -1935,9 +1953,13 @@ declare enum MessageType {
1935
1953
  */
1936
1954
  SYNC_READ_STATUS = "RC:SRSMsg",
1937
1955
  /**
1938
- * 接受群已读回执更新消息(导航开关grpRRVer1时使用)
1956
+ * 接受群已读回执更新消息(导航开关grpRRVer = 1时使用)
1939
1957
  */
1940
1958
  GROUP_READ_RECEIPT_REQUEST = "RC:RRMsg",
1959
+ /**
1960
+ * 已读回执消息(V4)(导航开关grpRRVer = 3 时使用),支持单群聊
1961
+ */
1962
+ READ_STATE = "RC:RSMsg",
1941
1963
  /**
1942
1964
  * 消息送达报告,仅单聊
1943
1965
  */
@@ -1977,7 +1999,11 @@ declare enum MessageType {
1977
1999
  /**
1978
2000
  * 拦截消息,(当发送的消息的敏感词时,服务会下发一个拦截消息,内容包含被拦截消息信息)
1979
2001
  */
1980
- INTERCEPT = "RC:InterceptMsg"
2002
+ INTERCEPT = "RC:InterceptMsg",
2003
+ /**
2004
+ * 云控消息
2005
+ */
2006
+ CLOUD_CONTROL = "RC:CCConfigChangeRequestMsg"
1981
2007
  }
1982
2008
 
1983
2009
  /**
@@ -2201,6 +2227,12 @@ declare enum LogTagId {
2201
2227
  A_CALLBACK_O = "A-callback-O",
2202
2228
  A_CALLBACK_E = "A-callback-E",
2203
2229
  L_CALLBACK_E = "L-callback-E",
2230
+ A_SEND_MESSAGE_READ_RECEIPT_T = "A-send_message_read_receipt-T",
2231
+ A_SEND_MESSAGE_READ_RECEIPT_R = "A-send_message_read_receipt-R",
2232
+ A_GET_MESSAGE_READ_RECEIPT_T = "A-get_message_read_receipt-T",
2233
+ A_GET_MESSAGE_READ_RECEIPT_R = "A-get_message_read_receipt-R",
2234
+ A_SYNC_READ_STATUS_T = "A-sync_read_status-T",
2235
+ A_SYNC_READ_STATUS_R = "A-sync_read_status-R",
2204
2236
  A_GET_TOP_CONVERSATION_LIST_E = "A-get_top_conversation_list-E",
2205
2237
  /**
2206
2238
  * PB 数据编码错误
@@ -2247,7 +2279,18 @@ declare enum LogTagId {
2247
2279
  /** 获取静态配置 */
2248
2280
  L_GET_STATIC_CONF_T = "L-get_static_conf-T",
2249
2281
  L_GET_STATIC_CONF_R = "L-get_static_conf-R",
2250
- L_GET_STATIC_CONF_E = "L-get_static_conf-E"
2282
+ L_GET_STATIC_CONF_E = "L-get_static_conf-E",
2283
+ /** 云控日志 */
2284
+ L_CLOUD_DISABLED = "L-cloud_disabled",
2285
+ L_CLOUD_EXPIRE = "L-cloud_expire",
2286
+ L_CLOUD_OVERCLOCK = "L-cloud_overclock",
2287
+ L_CLOUD_APPKEY_REGION_E = "L-cloud_appkey_region_error",
2288
+ L_CLOUD_CONFIG_DATA_E = "L-cloud_config_data_error",
2289
+ L_CLOUD_SET_CACHE_O = "L-cloud_set_cache-O",
2290
+ L_CLOUD_GET_CACHE_O = "L-cloud_get_cache-O",
2291
+ L_CLOUD_MSG_NTF_O = "L-cloud_msg_ntf-O",
2292
+ L_PARSE_JSON_MSGS_E = "L-parse_json_messsages-E",
2293
+ L_PARSE_JSON_E = "L-parse_json-E"
2251
2294
  }
2252
2295
 
2253
2296
  /** 统计数据标签 */
@@ -2258,7 +2301,10 @@ declare enum StatisticsTag {
2258
2301
  IM_CMP = "IM-stats_cmp-S",
2259
2302
  IM_CMP_RMTP = "IM-stats_cmp_rmtp-S",
2260
2303
  IM_STATS_CS = "IM-stats_cs-S",
2261
- IM_NETWORK_CHANGE = "IM-stats_network_change-S"
2304
+ IM_NETWORK_CHANGE = "IM-stats_network_change-S",
2305
+ /** 云控配置埋点 */
2306
+ L_CLOUD_INFO_FETCH_T = "L-cloud_info_fetch-T",
2307
+ L_CLOUD_INFO_FETCH_R = "L-cloud_info_fetch-R"
2262
2308
  }
2263
2309
 
2264
2310
  /**
@@ -2659,7 +2705,15 @@ interface IMessageReaderResponse {
2659
2705
  list: IMessageReader[];
2660
2706
  }
2661
2707
  interface ILocalReadReceiptInfo {
2708
+ /**
2709
+ * 仅已读 V2 支持
2710
+ * @hidden
2711
+ */
2662
2712
  hasRespond?: boolean;
2713
+ /**
2714
+ * 仅已读 V2 支持
2715
+ * @hidden
2716
+ */
2663
2717
  readerInfo?: {
2664
2718
  [userId: string]: number;
2665
2719
  };
@@ -2671,21 +2725,61 @@ interface ILocalReadReceiptInfo {
2671
2725
  */
2672
2726
  interface IReadReceiptInfo {
2673
2727
  /**
2674
- * 是否已经发送已读回执
2728
+ * 是否已经发送已读回执, 仅 V2 支持
2675
2729
  */
2676
2730
  hasRespond?: boolean;
2677
2731
  /**
2678
- * 已阅读用户列表(不准确)
2732
+ * 已阅读用户列表(不准确), 仅 V2 支持
2679
2733
  */
2680
2734
  readerList?: IMessageReader[];
2681
2735
  /**
2682
- * 阅读人数(不准确)
2736
+ * 阅读人数
2737
+ */
2738
+ readCount?: number;
2739
+ /**
2740
+ * 群组总人数
2741
+ */
2742
+ totalCount?: number;
2743
+ }
2744
+ /**
2745
+ * 已读回执事件通知数据
2746
+ * @category Interface
2747
+ * @since todo
2748
+ */
2749
+ interface IReadReceiptData {
2750
+ privateReadReceipt?: IPrivateReadReceiptData;
2751
+ groupReadReceipt?: IGroupReadReceiptData;
2752
+ }
2753
+ interface IPrivateReadReceiptData extends IConversationOption {
2754
+ /**
2755
+ * 最后已读消息时间 (单聊)
2683
2756
  */
2757
+ endMsgTime?: number;
2758
+ }
2759
+ interface IGroupReadReceiptData extends IConversationOption {
2760
+ /**
2761
+ * 已读人数 (群聊)
2762
+ */
2684
2763
  readCount?: number;
2685
2764
  /**
2686
- * 群组总人数(不准确)
2765
+ * 消息发送时群总人数 (群聊)
2687
2766
  */
2688
2767
  totalCount?: number;
2768
+ /**
2769
+ * 消息 UID(群聊)
2770
+ */
2771
+ messageUId?: string;
2772
+ }
2773
+ /**
2774
+ * 多端同步会话已读状态事件数据
2775
+ * @category Interface
2776
+ * @since todo
2777
+ */
2778
+ interface ISyncReadStatusData extends IConversationOption {
2779
+ /**
2780
+ * 已读消息时间
2781
+ */
2782
+ timestamp: number;
2689
2783
  }
2690
2784
  /**
2691
2785
  * 从服务端接收到的消息数据
@@ -3237,6 +3331,64 @@ interface MentionedInfoBody {
3237
3331
  userIdList?: string[];
3238
3332
  mentionedContent?: string;
3239
3333
  }
3334
+ /**
3335
+ * 被合并的消息数据结构
3336
+ */
3337
+ interface ICombinedMessage {
3338
+ /**
3339
+ * 消息发送者的用户 Id
3340
+ */
3341
+ fromUserId: string;
3342
+ /**
3343
+ * 消息所属会话 Id
3344
+ */
3345
+ targetId: string;
3346
+ /**
3347
+ * 消息发送时间
3348
+ */
3349
+ timestamp: number;
3350
+ /**
3351
+ * 消息类型
3352
+ */
3353
+ objectName: string;
3354
+ /**
3355
+ * 消息内容
3356
+ */
3357
+ content: any;
3358
+ }
3359
+ /**
3360
+ * v2 版本合并转发消息 content 结构
3361
+ */
3362
+ interface ICombineV2MessageContent {
3363
+ /**
3364
+ * 被合并消息的来源会话类型
3365
+ */
3366
+ conversationType: ConversationType;
3367
+ /**
3368
+ * 合并信息摘要,建议取被合并消息中的前三条消息的内容
3369
+ */
3370
+ summaryList: string[];
3371
+ /**
3372
+ * 名称列表,单聊时为双方的名称,群聊时为群组名称
3373
+ */
3374
+ nameList: string[];
3375
+ /**
3376
+ * 被合并消息的条目数量
3377
+ */
3378
+ msgNum: number;
3379
+ /**
3380
+ * 被合并消息的消息内容,仅当内容 JSON 序列化后长度小于 120K 时有值;当长度大于 120K 时,内容将被以文件的形式远端存储。
3381
+ */
3382
+ msgList?: Array<ICombinedMessage>;
3383
+ /**
3384
+ * 被合并消息的内容 JSON 序列化后长度大于 120K 时的文件名,暂时无作用,移动端依据此字段判断是否有文件需要下载,而非 remoteUrl 字段
3385
+ */
3386
+ jsonMsgKey?: string;
3387
+ /**
3388
+ * 远端存储文件的 URL,仅 jsonMsgKey 有值时存在
3389
+ */
3390
+ remoteUrl?: string;
3391
+ }
3240
3392
 
3241
3393
  interface IUpdateItem {
3242
3394
  isTop?: {
@@ -3342,6 +3494,10 @@ interface IReceivedConversation {
3342
3494
  * 会话操作时间,暂仅 Electron 平台支持
3343
3495
  */
3344
3496
  operationTime?: number;
3497
+ /**
3498
+ * 会话草稿
3499
+ */
3500
+ draft?: string;
3345
3501
  }
3346
3502
  /**
3347
3503
  * @category Interface
@@ -4105,9 +4261,19 @@ interface INaviInfo {
4105
4261
  */
4106
4262
  crypto?: string;
4107
4263
  /**
4108
- * 群组回执开关, 1: 打开,0(或者没有): 关闭
4264
+ * 群组回执开关,
4265
+ * 0(或者没有): 关闭 v1 版本
4266
+ * 1: 打开, v2 版本
4267
+ * 2: 废弃
4268
+ * 3: V4 版本,单群聊已读回执
4109
4269
  */
4110
4270
  grpRRVer?: number;
4271
+ /**
4272
+ * 会话驱动类型
4273
+ * 0: 默认,客户端离线消息驱动计算未读数(客户端通过pullMsg结果计算)
4274
+ * 1: 服务端会话驱动计算未读数(调用pullSes进行初始化),暂只影响更新会话已读时间接口
4275
+ */
4276
+ sesDriven?: number;
4111
4277
  /**
4112
4278
  * 防黑产开关, 1: 打开,0:关闭
4113
4279
  */
@@ -4431,7 +4597,8 @@ declare class IndexDBStatisticReporter extends BasicStatisticReporter {
4431
4597
  declare enum AreaCode {
4432
4598
  BJ = 1,
4433
4599
  SG = 2,
4434
- NA = 3
4600
+ NA = 3,
4601
+ SG_AWS = 4
4435
4602
  }
4436
4603
 
4437
4604
  interface IStaticConfigData {
@@ -4582,7 +4749,8 @@ declare class WebsocketStaticConfigManager extends BasicStaticConfigManager {
4582
4749
  */
4583
4750
  declare class WebSocketNavi extends BasicNavi {
4584
4751
  private runtime;
4585
- constructor(appkey: string, logger: BasicLogger, statisticLog: BasicStatistic, runtime: IRuntime, staticConfigManager: WebsocketStaticConfigManager);
4752
+ private environment;
4753
+ constructor(appkey: string, logger: BasicLogger, statisticLog: BasicStatistic, runtime: IRuntime, staticConfigManager: WebsocketStaticConfigManager, environment?: string);
4586
4754
  protected httpRequest(uri: string, appkey: string, token: string, traceId: string, finished: boolean): IPromiseResult<INaviInfo>;
4587
4755
  protected httpRequestV2(uri: string, appkey: string, token: string, traceId: string): IPromiseResult<INaviInfo>;
4588
4756
  protected getNaviCache(formatedToken: string): INaviCache | null;
@@ -5270,13 +5438,25 @@ interface IEngine {
5270
5438
  getTagsForConversation(conversation: IConversationOption): IPromiseResult<IConversationTag[]>;
5271
5439
  /**
5272
5440
  * 发送群组消息已读回执
5273
- * 导航下发已读回执开关为 true 时调用
5441
+ * 导航下发已读回执开关为 1 时调用
5274
5442
  */
5275
5443
  sendReadReceiptMessage(targetId: string, messageUIds: string[], channelId?: string): Promise<IAsyncRes>;
5276
5444
  /**
5277
5445
  * 获取群组消息已读列表
5278
5446
  */
5279
5447
  getMessageReader(targetId: string, messageUId: string, channelId?: string): IPromiseResult<IMessageReaderResponse>;
5448
+ /**
5449
+ * 发送已读回执(V4)
5450
+ */
5451
+ sendReadReceiptMessageV4(conversation: IConversationOption, startMsgUid: string, endMsgUid: string): Promise<IAsyncRes>;
5452
+ /**
5453
+ * 获取消息已读回执列表, 暂仅支持群聊(V4)
5454
+ */
5455
+ getMessageReadReceiptV4(conversation: IConversationOption, messageUid: string): IPromiseResult<IMessageReader[]>;
5456
+ /**
5457
+ * 多端同步会话的已读时间(V4)
5458
+ */
5459
+ updateConversationReadTime(conversation: IConversationOption, timestamp: number): Promise<IAsyncRes>;
5280
5460
  /**
5281
5461
  * 获取服务器时间
5282
5462
  */
@@ -5931,7 +6111,7 @@ declare abstract class BasicReporter {
5931
6111
  * @param logId 拉取事务 Id,用于上传日志时的 Http 请求
5932
6112
  * @param messageUId 消息 messageUId
5933
6113
  */
5934
- report(startTime: number, endTime: number, platform: string, uri: string, logId: string, messageUId: string): Promise<void>;
6114
+ report(startTime: number, endTime: number, platform: string, uri: string, logId: string, messageUId: string, isCloudControl?: boolean): Promise<void>;
5935
6115
  /**
5936
6116
  * 以 `POST` 方法向服务发送日志数据
5937
6117
  * @param url
@@ -5978,7 +6158,7 @@ declare class IndexDBReporter extends BasicReporter {
5978
6158
  * @param logId
5979
6159
  * @param messageUId
5980
6160
  */
5981
- report(startTime: number, endTime: number, platform: string, uri: string, logId: string, messageUId: string): Promise<void>;
6161
+ report(startTime: number, endTime: number, platform: string, uri: string, logId: string, messageUId: string, isCloudControl?: boolean): Promise<void>;
5982
6162
  protected realtimeReport(url: string, level: LogL, itv: number): Promise<void>;
5983
6163
  }
5984
6164
 
@@ -6171,6 +6351,14 @@ interface IWatcher {
6171
6351
  ultraGroupChannelUserKicked?: (list: IUltraChannelUserKickedInfo[]) => void;
6172
6352
  ultraGroupChannelDelete?: (list: IUltraChannelDeleteInfo[]) => void;
6173
6353
  userGroupStatus?: (data: IUserGroupStatusInfo) => void;
6354
+ /**
6355
+ * 已读回执 V4
6356
+ */
6357
+ messageReadReceipt?: (data: IReadReceiptData) => void;
6358
+ /**
6359
+ * 同步已读状态 V4
6360
+ */
6361
+ syncReadStatus?: (data: ISyncReadStatusData) => void;
6174
6362
  }
6175
6363
  interface IAPIContextOption {
6176
6364
  /**
@@ -6229,6 +6417,10 @@ interface IAPIContextOption {
6229
6417
  * 日志服务地址
6230
6418
  */
6231
6419
  logServerUrl?: string;
6420
+ /**
6421
+ * 私有云环境配置
6422
+ */
6423
+ environment?: string;
6232
6424
  }
6233
6425
 
6234
6426
  interface IPluginGenerator<API, InitOption> {
@@ -6465,6 +6657,8 @@ declare class APIContext {
6465
6657
  private _ultraGroupChannelUserKickedListener;
6466
6658
  private _ultraGroupChannelDeleteListener;
6467
6659
  private _userGroupStatusListener;
6660
+ private _messageReadReceipt;
6661
+ private _syncReadStatus;
6468
6662
  /**
6469
6663
  * rtc 数据变更通知 pluginContext
6470
6664
  */
@@ -6570,6 +6764,18 @@ declare class APIContext {
6570
6764
  * @param messageUIds
6571
6765
  */
6572
6766
  getMessageReader(targetId: string, messageUId: string, channelId?: string): Promise<IAsyncRes<IMessageReaderResponse>>;
6767
+ /**
6768
+ * 发送已读回执(V4)
6769
+ */
6770
+ sendReadReceiptMessageV4(conversation: IConversationOption, startMsgUid: string, endMsgUid: string): Promise<IAsyncRes>;
6771
+ /**
6772
+ * 获取消息已读回执列表, 暂仅支持群聊(V4)
6773
+ */
6774
+ getMessageReadReceiptV4(conversation: IConversationOption, messageUid: string): IPromiseResult<IMessageReader[]>;
6775
+ /**
6776
+ * 多端同步会话的已读时间(V4)
6777
+ */
6778
+ updateConversationReadTime(conversation: IConversationOption, timestamp: number): Promise<IAsyncRes>;
6573
6779
  /**
6574
6780
  * 反初始化,清空所有监听及计时器
6575
6781
  */
@@ -7491,6 +7697,14 @@ interface IEngineWatcher extends IConnectionListener {
7491
7697
  callInfo: (data: string) => void;
7492
7698
  onNaviDataChange: (naviInfo: INaviInfo) => void;
7493
7699
  userGroupStatus: (info: IUserGroupStatusInfo) => void;
7700
+ /**
7701
+ * 已读回执 V4
7702
+ */
7703
+ messageReadReceipt: (data: IReadReceiptData) => void;
7704
+ /**
7705
+ * 同步已读状态 V4
7706
+ */
7707
+ syncReadStatus: (data: ISyncReadStatusData) => void;
7494
7708
  }
7495
7709
  /**
7496
7710
  * 引擎定义
@@ -7762,6 +7976,18 @@ declare abstract class AEngine {
7762
7976
  * @param messageUIds
7763
7977
  */
7764
7978
  abstract getMessageReader(targetId: string, messageUId: string, channelId?: string): IPromiseResult<IMessageReaderResponse>;
7979
+ /**
7980
+ * 发送已读回执(V4)
7981
+ */
7982
+ abstract sendReadReceiptMessageV4(conversation: IConversationOption, startMsgUid: string, endMsgUid: string): Promise<IAsyncRes>;
7983
+ /**
7984
+ * 获取消息已读回执列表, 暂仅支持群聊(V4)
7985
+ */
7986
+ abstract getMessageReadReceiptV4(conversation: IConversationOption, messageUid: string): IPromiseResult<IMessageReader[]>;
7987
+ /**
7988
+ * 多端同步会话的已读时间(V4)
7989
+ */
7990
+ abstract updateConversationReadTime(conversation: IConversationOption, timestamp: number): Promise<IAsyncRes>;
7765
7991
  /**
7766
7992
  * 断开连接
7767
7993
  * @param closeDB 是否关闭数据库,默认为 true,仅 Electron 平台有效
@@ -8319,6 +8545,10 @@ declare class UrlCenter {
8319
8545
  * 获取静态配置地址
8320
8546
  */
8321
8547
  getStaticConfigUrl(): string[];
8548
+ /**
8549
+ * @returns 获取云控地址
8550
+ */
8551
+ getCloudControllerUrl(areaCode?: number): string[];
8322
8552
  }
8323
8553
  declare const urlCenter: UrlCenter;
8324
8554
 
@@ -8394,6 +8624,10 @@ declare class VersionManage {
8394
8624
  };
8395
8625
  }
8396
8626
 
8627
+ declare function isStartCloudController(): boolean;
8628
+
8629
+ declare const getDeviceId: (runtime: IRuntime) => string;
8630
+
8397
8631
  /**
8398
8632
  * 检查参数是否为字符串
8399
8633
  * 只做类型检查,不做长度检查,故当字符串长度为 0,结果依然为 true
@@ -8529,6 +8763,16 @@ declare namespace base {
8529
8763
  declare const getUUID: () => string;
8530
8764
  declare const getUUID22: () => string;
8531
8765
 
8766
+ declare class SuspendablePromise<T> {
8767
+ private readonly _promise;
8768
+ private _resolve;
8769
+ private _onCancel;
8770
+ constructor(handle: (resolve: (val: T) => void) => void, onCancel: (resolve: (val: T) => void) => void);
8771
+ private _onResolve;
8772
+ result(): Promise<T>;
8773
+ abort(): void;
8774
+ }
8775
+
8532
8776
  /**
8533
8777
  * 预定义的验证规则,只包含`值类型`数据验证
8534
8778
  * 引用类型数据需使用自定义 validator 校验函数进行校验
@@ -8645,8 +8889,9 @@ declare const getbundleId: () => string;
8645
8889
  */
8646
8890
  declare const decryptCBC: (data: string, key: string, iv: string) => Promise<string>;
8647
8891
  declare function fixUrlProtocol(url: string, protocol?: EConnectProtocol): string;
8892
+ declare const getMinionURL: (naviInfo: INaviInfo, logger: BasicLogger) => string;
8648
8893
 
8649
- declare function httpRequest(options: IRequest): Promise<IResponse>;
8894
+ declare function httpRequest(options: IRequest): SuspendablePromise<IResponse>;
8650
8895
 
8651
8896
  /**
8652
8897
  * @todo 后期禁用此方法,容易滥用,且会丢失上下文的数据类型跟踪
@@ -8766,6 +9011,7 @@ declare const FORMATED_VERSION: string;
8766
9011
  declare const MAX_UPLOAD_FILE_SIZE: number;
8767
9012
  declare const UPLOAD_FILE_CHUNK_SIZE: number;
8768
9013
  declare const STATIC_CONFIG_CACHE_TIME: number;
9014
+ declare const RC_DEFAULT_USER = "rongcloudsystem";
8769
9015
  /**
8770
9016
  * localStorage 中的 key 值
8771
9017
  */
@@ -8818,8 +9064,153 @@ declare const LOCAL_STORAGE_KEYS: {
8818
9064
  * staticConfig 静态配置
8819
9065
  */
8820
9066
  STATIC_CONFIG_KEY: (appKey: string) => string;
9067
+ /**
9068
+ * 云控配置存储
9069
+ */
9070
+ CLOUD_CONTROL_KEY: (appKey: string) => string;
8821
9071
  };
8822
9072
 
9073
+ interface ICloudConfig {
9074
+ temporary: boolean;
9075
+ enable: boolean;
9076
+ expire: number;
9077
+ interval: number;
9078
+ }
9079
+ interface IUploadLogConfig {
9080
+ temporary: boolean;
9081
+ tasks: IUploadTask[];
9082
+ }
9083
+ interface IUploadTask {
9084
+ /**
9085
+ * 消息类型
9086
+ */
9087
+ objectName: string;
9088
+ /**
9089
+ * 上报地址
9090
+ */
9091
+ uri: string;
9092
+ /**
9093
+ * 日志 id
9094
+ */
9095
+ logId: string;
9096
+ /**
9097
+ * 开始时间
9098
+ */
9099
+ startTime?: number;
9100
+ /**
9101
+ * 结束时间
9102
+ */
9103
+ endTime?: number;
9104
+ /**
9105
+ * 平台标识
9106
+ */
9107
+ platform?: string;
9108
+ /**
9109
+ * 移动端包名,web 暂未使用
9110
+ */
9111
+ packageName?: string;
9112
+ /**
9113
+ * 会话类型
9114
+ */
9115
+ conversationType?: number;
9116
+ /**
9117
+ * 目标 id
9118
+ */
9119
+ targetId?: string;
9120
+ /**
9121
+ * 频道 id
9122
+ */
9123
+ channelId?: string;
9124
+ /**
9125
+ * 消息 id list
9126
+ * 移动端拉取消息列表使用,web 暂未使用
9127
+ */
9128
+ msgUids?: string;
9129
+ /**
9130
+ * 用户 id
9131
+ */
9132
+ userId?: string;
9133
+ }
9134
+ interface ICloudController {
9135
+ /**
9136
+ * 云控配置
9137
+ */
9138
+ cc: ICloudConfig;
9139
+ /**
9140
+ * 云控配置版本
9141
+ */
9142
+ uploadLog: IUploadLogConfig;
9143
+ /**
9144
+ * 时间戳
9145
+ */
9146
+ timestamp: number;
9147
+ /**
9148
+ * 最后一次请求时间
9149
+ */
9150
+ lastRequestTime: number;
9151
+ /**
9152
+ * 区域码
9153
+ */
9154
+ targetRegion?: number;
9155
+ }
9156
+ declare enum InvokerType {
9157
+ init = 1,
9158
+ newWorkChange = 2,
9159
+ other = 3
9160
+ }
9161
+
9162
+ declare class UploadTaskManage {
9163
+ private readonly reporter;
9164
+ private logId;
9165
+ private uploadTask;
9166
+ private taskLock;
9167
+ constructor(reporter: BasicReporter);
9168
+ uploadLogCmdTask(data: IUploadTask): void;
9169
+ private reportLogCmdTask;
9170
+ private enqueueTask;
9171
+ }
9172
+
9173
+ declare abstract class BaseCloudController {
9174
+ protected logger: BasicLogger;
9175
+ protected appkey: string;
9176
+ protected reporter: BasicReporter;
9177
+ protected statisticLog: BasicStatistic;
9178
+ /**
9179
+ * 是否启用云控
9180
+ */
9181
+ private isEable;
9182
+ /**
9183
+ * 配置有效期, 单位为毫秒
9184
+ */
9185
+ protected expire: number;
9186
+ /**
9187
+ * 配置刷新间隔, 单位为毫秒
9188
+ */
9189
+ protected interval: number;
9190
+ /**
9191
+ * 配置更新时间
9192
+ */
9193
+ protected timestamp: number;
9194
+ /**
9195
+ * 最近一次发起请求时间
9196
+ */
9197
+ protected lastRequestTime: number;
9198
+ protected uploadTaskManage: UploadTaskManage;
9199
+ protected _cache: ICloudController | null;
9200
+ constructor(logger: BasicLogger, appkey: string, reporter: BasicReporter, statisticLog: BasicStatistic);
9201
+ protected init(): void;
9202
+ protected abstract httpRequest(url: string, method: HttpMethod, headers: {
9203
+ [key: string]: string;
9204
+ }, body: any): IPromiseResult<ICloudController>;
9205
+ protected abstract setCloudControllerCache(data: ICloudController): void;
9206
+ protected abstract getLocalCloudControllerCache(): string | null;
9207
+ private isExire;
9208
+ private isOverclock;
9209
+ private logCmdMsgTasks;
9210
+ protected dataHandle(data: ICloudController): void;
9211
+ request(uri: string, invoker: InvokerType, token?: string): Promise<number>;
9212
+ }
9213
+
8823
9214
  /**
8824
9215
  * 请使用 `Codec` 替代 `AbsCodec`
8825
9216
  * @deprecated
@@ -8832,4 +9223,4 @@ declare type AbsCodec<T> = Codec<T>;
8832
9223
  */
8833
9224
  declare const version: string;
8834
9225
 
8835
- export { AConnectionMgr, AEngine, APIContext, AbsCodec, AppStorage, AreaCode, AssertRules, BasicLogger, BasicNavi, BasicReporter, BasicStaticConfigManager, BasicStatistic, BasicStatisticReporter, CPP_PROTOCAL_MSGTYPE_OPTION, CallLibMsgType, ChatroomEntryType, ChatroomSyncStatusReason, ChatroomUserChangeType, ChrmMemBanType, ChrmMemOperateType, ChrmSyncStatus, Codec, CodecPBMaps, ConnectReason, ConnectType, ConnectionStatus, Content, ConversationType, DB_LOG_FLUSH_FREQUENCY, DB_LOG_MAX_SIZE, DelayTimer, EConnectProtocol, EnableLogL, EnterpriseType, ErrorCode, EventEmitter, FORMATED_VERSION, FileType, HTTP_TIMEOUT, HttpMethod, IAPIContextOption, IAndroidPushConfig, IAsyncRes, IBaseConversationInfo, IBaseStatisticsData, IBlockedMessageInfo, ICancelRoomPKOptions, IChannelAndUserGroupChangeData, IChatRoomEntries, IChatRoomEntry, IChatroomEntries, IChatroomEntry, IChatroomEntryListenerData, IChatroomInfo, IChatroomJoinResponse, IChatroomListener, IChatroomListenerData, IChatroomNotifyBan, IChatroomNotifyBlock, IChatroomNotifyMultiLoginSync, IChatroomRejoinedFailed, IChatroomRejoinedInfo, IChatroomRejoinedSuccessed, IChatroomUser, IChatroomUserChangeInfo, IChrmKVEntries, IChrmKVEntry, IConnectResult, IConnectionListener, IConnectionStatusListener, IConversationIdentifier, IConversationOption, IConversationState, IConversationStateListener, IConversationTag, IConversationTagListener, IDeletedExpansion, IDeliveredUser, IDownloadAuth, IEndRoomPKOptions, IEngine, IEngineWatcher, IEventListener, IExpansionListener, IExpansionListenerData, IExpansionMsgContent, IExtraMethod, IGetMsgOption, IGetUltraGroupListOption, IGooglePushConfig, IGroupMessageDeliverInfo, IGroupMessageDeliverStatus, IGroupMessageDeliveredStatusInfo, IInsertMessage, IInsertMsgOptions, IIsValidExpansion, IJoinRTCRoomData, ILocalReadReceiptInfo, ILocalTagStatus, ILogDB, ILogData, ILogger, IM_CHATROOM_PULL_INTERVAL_TIME, IM_PING_INTERVAL_TIME, IM_PING_MIN_TIMEOUT, IM_PING_TIMEOUT, IM_SIGNAL_TIMEOUT, IMessageDeliver, IMessageDeliveredListener, IMessageListnenr, IMessageReader, IMessageReaderResponse, IMetionedData, INaviCache, INaviContextInfo, INaviInfo, INetwork, IOSInfo, IOperateInfo, IOperateStatusNotify, IOperateSummary, IPluginGenerator, IProcessCache, IProcessInfo, IPromiseResult, IProxy, 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, IStaticConfig, IStatistic, IStatisticDB, IStatisticData, IStatisticsCMPData, IStatisticsCSData, IStatisticsDurData, IStatisticsNaviData, IStatisticsNetworkData, IStatisticsRMTPData, IStatisticsWebsocketData, IStorage, ITagInfo, ITagListener, ITagParam, ITagStatus, ITypingInfo, ITypingMessage, ITypingUser, IUltraChannelChangeInfo, IUltraChannelDeleteInfo, IUltraChannelUserKickedInfo, IUltraExMsgOptions, IUltraGroupConversation, IUltraGroupOption, IUltraGroupUnreadInfo, IUltraGroupUnreadMentionedOption, IUltraModifyMsgOptions, IUltraMsgQueryOptions, IUltraUnreadConversation, IUltraUnreadMsg, IUpdateItem, IUpdatedConversation, IUpdatedExpansion, IUploadAuth, IUserGroupChangeData, IUserGroupStatusInfo, IUserProfile, IWatcher, IWebSocket, IiOSPushConfig, IndexDBLogger, IndexDBReporter, IndexDBStatistic, IndexDBStatisticReporter, RTCKeyMaps as InnerRTCKeyMaps, ItypingStateListener, KVString, LOCAL_STORAGE_KEYS, LiveRole, LiveType, LogContent, LogL, LogLevel, LogSource, LogTagId, LogType, MAX_MESSAGE_CONTENT_BYTES, MAX_MESSAGE_EXPANSION_KEY_LENGTH, MAX_MESSAGE_EXPANSION_VAL_LENGTH, MAX_UPLOAD_FILE_SIZE, MentionedInfoBody, MentionedType, MessageBlockSourceType, MessageBlockType, MessageDirection, MessageType, NAVI_CACHE_DURATION, NAVI_REQ_TIMEOUT, NaviCacheType, NetworkType, NotificationLevel, NotificationStatus, ONE_LOG_SIZE_MAX, OperateStatus, PluginContext, ProtocalType, RCAssertError, RCConnectionStatus, REAT_TIME_LOG_SIZE, RTCApiType, RTCIdentityChangeType, RTCJoinType, RTCMode, RTCPluginContext, ReceivedStatus, SEND_MESSAGE_TYPE_OPTION, STATIC_CONFIG_CACHE_TIME, STATIC_CONFIG_IV, STATIC_CONFIG_KEY, STATUS_MESSAGE, SentStatus, StatisticL, StatisticsTag, StatisticsVersion, StoreKeys, TagChangeType, Type, UPLOAD_FILE_CHUNK_SIZE, UltraGroupChannelChangeType, UltraGroupChannelType, UltraMentionedType, UltraMsgChangeType, UltraMsgSubChangeType, UploadMethod, UserGroupChangeType, VERSION, VersionManage, WEB_SOCKET_TIMEOUT, WebSocketNavi, appendUrl, assert, clone, cloneByJSON, deInitLogDB, decryptCBC, fixUrlProtocol, forEach, getBrowser, getClientMessageId, getMimeKey, getUUID, getUUID22, getUploadFileName, getbundleId, httpRequest, indexOf, initLogDB, initStatisticDB, isArray, isArrayBuffer, isBoolean, isConnnectAckCode as isConnnectAck, isDisconnectCode as isDisconnectedByServer, isFunction, isHttpUrl, isInObject, isInclude, isNull, isNumber, isObject, isString, isTypeInConversationList, isUndefined, isValidChannelId, isValidChrmEntryKey, isValidChrmEntryValue, isValidConversationType, isValidExpansion, isValidFileType, isValidNotificationLevel, base as logger, map, notEmptyArray, notEmptyObject, notEmptyString, pushConfigsToJSON, pushJSONToConfigs, statisticTranscsv, todo, transcsv, unInitStatisticDB, urlCenter, usingCppEngine, validate, version };
9226
+ export { AConnectionMgr, AEngine, APIContext, AbsCodec, AppStorage, AreaCode, AssertRules, BaseCloudController, BasicLogger, BasicNavi, BasicReporter, BasicStaticConfigManager, BasicStatistic, BasicStatisticReporter, CPP_PROTOCAL_MSGTYPE_OPTION, CallLibMsgType, ChatroomEntryType, ChatroomSyncStatusReason, ChatroomUserChangeType, ChrmMemBanType, ChrmMemOperateType, ChrmSyncStatus, Codec, CodecPBMaps, ConnectReason, ConnectType, ConnectionStatus, Content, ConversationType, DB_LOG_FLUSH_FREQUENCY, DB_LOG_MAX_SIZE, DelayTimer, EConnectProtocol, EnableLogL, EnterpriseType, ErrorCode, EventEmitter, FORMATED_VERSION, FileType, HTTP_TIMEOUT, HttpMethod, IAPIContextOption, IAndroidPushConfig, IAsyncRes, IBaseConversationInfo, IBaseStatisticsData, IBlockedMessageInfo, ICancelRoomPKOptions, IChannelAndUserGroupChangeData, IChatRoomEntries, IChatRoomEntry, IChatroomEntries, IChatroomEntry, IChatroomEntryListenerData, IChatroomInfo, IChatroomJoinResponse, IChatroomListener, IChatroomListenerData, IChatroomNotifyBan, IChatroomNotifyBlock, IChatroomNotifyMultiLoginSync, IChatroomRejoinedFailed, IChatroomRejoinedInfo, IChatroomRejoinedSuccessed, IChatroomUser, IChatroomUserChangeInfo, IChrmKVEntries, IChrmKVEntry, ICloudController, ICombineV2MessageContent, ICombinedMessage, IConnectResult, IConnectionListener, IConnectionStatusListener, IConversationIdentifier, IConversationOption, IConversationState, IConversationStateListener, IConversationTag, IConversationTagListener, IDeletedExpansion, IDeliveredUser, IDownloadAuth, IEndRoomPKOptions, IEngine, IEngineWatcher, IEventListener, IExpansionListener, IExpansionListenerData, IExpansionMsgContent, IExtraMethod, IGetMsgOption, IGetUltraGroupListOption, IGooglePushConfig, IGroupMessageDeliverInfo, IGroupMessageDeliverStatus, IGroupMessageDeliveredStatusInfo, IGroupReadReceiptData, IInsertMessage, IInsertMsgOptions, IIsValidExpansion, IJoinRTCRoomData, ILocalReadReceiptInfo, ILocalTagStatus, ILogDB, ILogData, ILogger, IM_CHATROOM_PULL_INTERVAL_TIME, IM_PING_INTERVAL_TIME, IM_PING_MIN_TIMEOUT, IM_PING_TIMEOUT, IM_SIGNAL_TIMEOUT, IMessageDeliver, IMessageDeliveredListener, IMessageListnenr, IMessageReader, IMessageReaderResponse, IMetionedData, INaviCache, INaviContextInfo, INaviInfo, INetwork, IOSInfo, IOperateInfo, IOperateStatusNotify, IOperateSummary, IPluginGenerator, IPrivateReadReceiptData, IProcessCache, IProcessInfo, IPromiseResult, IProxy, IPushConfig, IRTCInnerListener, IRTCJoinedInfo, IRTCRoomBindOption, IRTCRoomInfo, IRTCUserData, IRTCUsers, IReadReceiptData, IReadReceiptInfo, IRecallMsgContent, IRecallMsgOptions, IReceivedConversation, IReceivedConversationByTag, IReceivedMessage, IRemoveChatRoomEntries, IRemoveChatRoomEntry, IRemoveChatroomEntries, IRemoveChatroomEntry, IReqRoomPKOptions, IRequest, IResRoomPKOptions, IResponse, IRtcTokenData, IRuntime, ISendExMsgOptions, ISendMsgOptions, IServerConversationStatus, IServerRTCRoomEntry, IServerUserSetting, ISetConversationStatusOptions, IStaticConfig, IStatistic, IStatisticDB, IStatisticData, IStatisticsCMPData, IStatisticsCSData, IStatisticsDurData, IStatisticsNaviData, IStatisticsNetworkData, IStatisticsRMTPData, IStatisticsWebsocketData, IStorage, ISyncReadStatusData, ITagInfo, ITagListener, ITagParam, ITagStatus, ITypingInfo, ITypingMessage, ITypingUser, IUltraChannelChangeInfo, IUltraChannelDeleteInfo, IUltraChannelUserKickedInfo, IUltraExMsgOptions, IUltraGroupConversation, IUltraGroupOption, IUltraGroupUnreadInfo, IUltraGroupUnreadMentionedOption, IUltraModifyMsgOptions, IUltraMsgQueryOptions, IUltraUnreadConversation, IUltraUnreadMsg, IUpdateItem, IUpdatedConversation, IUpdatedExpansion, IUploadAuth, IUploadTask, IUserGroupChangeData, IUserGroupStatusInfo, IUserProfile, IWatcher, IWebSocket, IiOSPushConfig, IndexDBLogger, IndexDBReporter, IndexDBStatistic, IndexDBStatisticReporter, RTCKeyMaps as InnerRTCKeyMaps, InvokerType, ItypingStateListener, KVString, LOCAL_STORAGE_KEYS, LiveRole, LiveType, LogContent, LogL, LogLevel, LogSource, LogTagId, LogType, MAX_MESSAGE_CONTENT_BYTES, MAX_MESSAGE_EXPANSION_KEY_LENGTH, MAX_MESSAGE_EXPANSION_VAL_LENGTH, MAX_UPLOAD_FILE_SIZE, MentionedInfoBody, MentionedType, MessageBlockSourceType, MessageBlockType, MessageDirection, MessageType, NAVI_CACHE_DURATION, NAVI_REQ_TIMEOUT, NaviCacheType, NetworkType, NotificationLevel, NotificationStatus, ONE_LOG_SIZE_MAX, OperateStatus, PluginContext, ProtocalType, RCAssertError, RCConnectionStatus, RC_DEFAULT_USER, REAT_TIME_LOG_SIZE, RTCApiType, RTCIdentityChangeType, RTCJoinType, RTCMode, RTCPluginContext, ReceivedStatus, SEND_MESSAGE_TYPE_OPTION, STATIC_CONFIG_CACHE_TIME, STATIC_CONFIG_IV, STATIC_CONFIG_KEY, STATUS_MESSAGE, SentStatus, StatisticL, StatisticsTag, StatisticsVersion, StoreKeys, SuspendablePromise, TagChangeType, Type, UPLOAD_FILE_CHUNK_SIZE, UltraGroupChannelChangeType, UltraGroupChannelType, UltraMentionedType, UltraMsgChangeType, UltraMsgSubChangeType, UploadMethod, UserGroupChangeType, VERSION, VersionManage, WEB_SOCKET_TIMEOUT, WebSocketNavi, appendUrl, assert, clone, cloneByJSON, deInitLogDB, decryptCBC, fixUrlProtocol, forEach, getBrowser, getClientMessageId, getDeviceId, getMimeKey, getMinionURL, getUUID, getUUID22, getUploadFileName, getbundleId, httpRequest, indexOf, initLogDB, initStatisticDB, isArray, isArrayBuffer, isBoolean, isConnnectAckCode as isConnnectAck, isDisconnectCode as isDisconnectedByServer, isFunction, isHttpUrl, isInObject, isInclude, isNull, isNumber, isObject, isStartCloudController, isString, isTypeInConversationList, isUndefined, isValidChannelId, isValidChrmEntryKey, isValidChrmEntryValue, isValidConversationType, isValidExpansion, isValidFileType, isValidNotificationLevel, base as logger, map, notEmptyArray, notEmptyObject, notEmptyString, pushConfigsToJSON, pushJSONToConfigs, statisticTranscsv, todo, transcsv, unInitStatisticDB, urlCenter, usingCppEngine, validate, version };