easemob-websdk 4.22.0 → 4.24.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/Easemob-chat.d.ts CHANGED
@@ -1,7 +1,6 @@
1
1
  export interface EasemobChatStatic {
2
2
  connection: typeof EasemobChat.Connection;
3
3
  message: typeof EasemobChat.Message;
4
- image: EasemobChat.ImageModule;
5
4
  utils: EasemobChat.Utils;
6
5
  logger: EasemobChat.Logger;
7
6
  statusCode: EasemobChat.Code;
@@ -67,78 +66,6 @@ export declare namespace EasemobChat {
67
66
 
68
67
  type VoiceSourceFile = File | MiniProgramVoiceFile;
69
68
 
70
- interface ImageInfo {
71
- width: number;
72
- height: number;
73
- type?: string;
74
- }
75
-
76
- interface BigImageOptions {
77
- maxShortEdge: number;
78
- quality: number;
79
- }
80
-
81
- interface BigImageResult {
82
- file?: File;
83
- path?: string;
84
- width: number;
85
- height: number;
86
- size: number;
87
- type: string;
88
- }
89
-
90
- interface ImageProcessor {
91
- getImageInfo(source: File | string): Promise<ImageInfo>;
92
- generateBigImage(
93
- source: File | string,
94
- options: BigImageOptions
95
- ): Promise<BigImageResult | null>;
96
- computeMd5(source: File | string): Promise<string>;
97
- }
98
-
99
- interface MiniAppRuntime {
100
- getImageInfo(options: {
101
- src: string;
102
- success: (res: { width: number; height: number; type?: string }) => void;
103
- fail: (err: any) => void;
104
- }): void;
105
- compressImage?(options: {
106
- src: string;
107
- quality?: number;
108
- compressedWidth?: number;
109
- compressedHeight?: number;
110
- success?: (res: { tempFilePath: string }) => void;
111
- fail?: (err: any) => void;
112
- }): void;
113
- getFileSystemManager?(): {
114
- getFileInfo(options: {
115
- filePath: string;
116
- success: (res: { size: number }) => void;
117
- fail: (err: any) => void;
118
- }): void;
119
- readFile(options: {
120
- filePath: string;
121
- encoding?: string;
122
- success: (res: { data: ArrayBuffer | string }) => void;
123
- fail: (err: any) => void;
124
- }): void;
125
- };
126
- }
127
-
128
- interface ImageModule {
129
- DEFAULT_BIG_IMAGE_SHORT_EDGE: number;
130
- DEFAULT_BIG_IMAGE_QUALITY: number;
131
- webImageProcessor: ImageProcessor;
132
- resolveScaledSize: (
133
- width: number,
134
- height: number,
135
- maxShortEdge: number
136
- ) => { width: number; height: number };
137
- createMiniAppImageProcessor: (
138
- runtime: MiniAppRuntime
139
- ) => ImageProcessor;
140
- }
141
-
142
69
  type ExcludeAckMessageBody = Exclude<
143
70
  MessageBody,
144
71
  ReadMsgBody | DeliveryMsgBody | ChannelMsgBody
@@ -992,7 +919,74 @@ export declare namespace EasemobChat {
992
919
  isLast: boolean;
993
920
  }
994
921
 
995
- interface ServerConversations {
922
+ /**
923
+ * The multiple-keyword match type for server message search.
924
+ * `or` means any keyword can match, and `and` means all keywords must match.
925
+ */
926
+ type MessageSearchKeywordListMatchType = 'or' | 'and';
927
+
928
+ /**
929
+ * The search scope for server message search.
930
+ * `none` searches only the message body, `with` searches both body and extensions,
931
+ * and `only` searches only extension fields.
932
+ */
933
+ type MessageSearchScope = 'none' | 'with' | 'only';
934
+
935
+ /**
936
+ * A WebSDK message object mapped from one server-side search hit.
937
+ */
938
+ type ServerSearchMessage = ExcludeAckMessageBody & {
939
+ /** The conversation ID of the matched message. */
940
+ conversationId?: string;
941
+ /** Highlight fragments returned by the server. */
942
+ highlight?: string[];
943
+ /** Summary text returned by the server for quick display. */
944
+ text?: string;
945
+ };
946
+
947
+ /**
948
+ * The paged result returned by server-side message search.
949
+ */
950
+ interface ServerSearchMessagesResult {
951
+ /** The server search result messages. */
952
+ messages: ServerSearchMessage[];
953
+ /** The current page number. */
954
+ pageNum: number;
955
+ /** The requested page size echoed by the SDK. */
956
+ pageSize: number;
957
+ /** The total number of pages. */
958
+ totalPages: number;
959
+ /** Whether the current page is the last page. */
960
+ isLast: boolean;
961
+ /** The request trace id returned by the server. */
962
+ requestId?: string;
963
+ /** The server response timestamp in milliseconds. */
964
+ timestamp: number;
965
+ }
966
+
967
+ /**
968
+ * The options for server-side message search.
969
+ */
970
+ interface MessageSearchOption {
971
+ /** The keyword list for search. */
972
+ keywordList: string[];
973
+ /** The keyword list match type. The valid values are `or` and `and`. The default value is `or`. */
974
+ keywordListMatchType?: MessageSearchKeywordListMatchType;
975
+ /** The conversation ID for in-conversation search. */
976
+ conversationId?: string;
977
+ /** The conversation type for filtering. Must be used with conversationId. */
978
+ conversationType?: ChatType;
979
+ /** Message body type filters. */
980
+ msgTypes?: MessageType[];
981
+ /** The start timestamp for query. The unit is millisecond. */
982
+ startTime?: number;
983
+ /** The end timestamp for query. The unit is millisecond. */
984
+ endTime?: number;
985
+ /** The search scope. */
986
+ searchScope?: MessageSearchScope;
987
+ }
988
+
989
+ interface ServerConversations {
996
990
  /** The conversation list. */
997
991
  conversations: ConversationItem[];
998
992
  /** The position from which to start getting data for the next query. If the number of returned data entries is smaller than that specified in the request, the cursor is `'undefined'`, which indicates that the current page is the last page; otherwise, the SDK returns the specific cursor position which indicates where to start getting data for the next query.*/
@@ -4713,8 +4707,28 @@ export declare namespace EasemobChat {
4713
4707
  }
4714
4708
  ): Promise<HistoryMessages>;
4715
4709
 
4716
- /**
4717
- * Unidirectionally deletes historical messages from the server.
4710
+ /**
4711
+ * Searches messages from the server.
4712
+ * This feature requires the "Message Search" service to be enabled in the Console.
4713
+ *
4714
+ * @param option The search option. See {@link MessageSearchOption}.
4715
+ * @param pageNum The page number for pagination, starting from 1.
4716
+ * @param pageSize The number of results per page (1-100, default 20).
4717
+ */
4718
+ searchMessages(
4719
+ this: Connection,
4720
+ params: {
4721
+ /** The search option. */
4722
+ option: MessageSearchOption;
4723
+ /** The page number for pagination, starting from 1. */
4724
+ pageNum?: number;
4725
+ /** The number of results per page. The range is 1 to 100. */
4726
+ pageSize?: number;
4727
+ }
4728
+ ): Promise<ServerSearchMessagesResult>;
4729
+
4730
+ /**
4731
+ * Unidirectionally deletes historical messages from the server.
4718
4732
  *
4719
4733
  * ```typescript
4720
4734
  * connection.removeHistoryMessages({targetId: 'userId', chatType: 'singleChat', time: Date.now()})
@@ -6969,6 +6983,8 @@ export declare namespace EasemobChat {
6969
6983
  modifiedInfo?: ModifiedMsgInfo;
6970
6984
  /** The list of message recipients. */
6971
6985
  receiverList?: string[];
6986
+ /** The webhookEnv field in the sending message protocol. */
6987
+ webhookEnv?: string;
6972
6988
  /** Has the message been read (only single chat messages have this field). */
6973
6989
  isRead?: boolean;
6974
6990
  /** Has the message been delivered (only single chat messages have this field). */
@@ -7001,6 +7017,8 @@ export declare namespace EasemobChat {
7001
7017
  deliverOnlineOnly?: boolean;
7002
7018
  /** The list of message recipients. */
7003
7019
  receiverList?: string[];
7020
+ /** The webhookEnv field in the sending message protocol. */
7021
+ webhookEnv?: string;
7004
7022
  }
7005
7023
 
7006
7024
  interface StreamChunk {
@@ -7073,6 +7091,8 @@ export declare namespace EasemobChat {
7073
7091
  modifiedInfo?: ModifiedMsgInfo;
7074
7092
  /** The list of message recipients. */
7075
7093
  receiverList?: string[];
7094
+ /** The webhookEnv field in the sending message protocol. */
7095
+ webhookEnv?: string;
7076
7096
  /** The file URL. */
7077
7097
  url?: string;
7078
7098
  /** The secret key required to download the file. */
@@ -7136,6 +7156,8 @@ export declare namespace EasemobChat {
7136
7156
  deliverOnlineOnly?: boolean;
7137
7157
  /** The list of message recipients. */
7138
7158
  receiverList?: string[];
7159
+ /** The webhookEnv field in the sending message protocol. */
7160
+ webhookEnv?: string;
7139
7161
  /** Compatibility information for merging messages. */
7140
7162
  compatibleText: string;
7141
7163
  /** The title of the merged messages. */
@@ -7223,6 +7245,8 @@ export declare namespace EasemobChat {
7223
7245
  * - (Default) `false`: The message is delivered when the recipient(s) is/are online. If the recipient(s) is/are offline, the message will not be delivered to them until they get online.
7224
7246
  */
7225
7247
  deliverOnlineOnly?: boolean;
7248
+ /** The webhookEnv field in the sending message protocol. */
7249
+ webhookEnv?: string;
7226
7250
  /** Message modified info. */
7227
7251
  modifiedInfo?: ModifiedMsgInfo;
7228
7252
  /** The list of message recipients. */
@@ -7261,6 +7285,8 @@ export declare namespace EasemobChat {
7261
7285
  deliverOnlineOnly?: boolean;
7262
7286
  /** The list of message recipients. */
7263
7287
  receiverList?: string[];
7288
+ /** The webhookEnv field in the sending message protocol. */
7289
+ webhookEnv?: string;
7264
7290
  }
7265
7291
 
7266
7292
  interface CustomParameters {
@@ -7343,6 +7369,8 @@ export declare namespace EasemobChat {
7343
7369
  deliverOnlineOnly?: boolean;
7344
7370
  /** The list of message recipients. */
7345
7371
  receiverList?: string[];
7372
+ /** The webhookEnv field in the sending message protocol. */
7373
+ webhookEnv?: string;
7346
7374
  /** Message modified info. */
7347
7375
  modifiedInfo?: ModifiedMsgInfo;
7348
7376
  /** Has the message been read (only single chat messages have this field). */
@@ -7379,6 +7407,8 @@ export declare namespace EasemobChat {
7379
7407
  deliverOnlineOnly?: boolean;
7380
7408
  /** The list of message recipients. */
7381
7409
  receiverList?: string[];
7410
+ /** The webhookEnv field in the sending message protocol. */
7411
+ webhookEnv?: string;
7382
7412
  }
7383
7413
 
7384
7414
  interface LocationParameters {
@@ -7467,6 +7497,8 @@ export declare namespace EasemobChat {
7467
7497
  * - (Default) `false`: The message is delivered when the recipient(s) is/are online. If the recipient(s) is/are offline, the message will not be delivered to them until they get online.
7468
7498
  */
7469
7499
  deliverOnlineOnly?: boolean;
7500
+ /** The webhookEnv field in the sending message protocol. */
7501
+ webhookEnv?: string;
7470
7502
  /** Message modified info. */
7471
7503
  modifiedInfo?: ModifiedMsgInfo;
7472
7504
  /** The list of message recipients. */
@@ -7507,6 +7539,8 @@ export declare namespace EasemobChat {
7507
7539
  * - (Default) `false`: The message is delivered when the recipient(s) is/are online. If the recipient(s) is/are offline, the message will not be delivered to them until they get online.
7508
7540
  */
7509
7541
  deliverOnlineOnly?: boolean;
7542
+ /** The webhookEnv field in the sending message protocol. */
7543
+ webhookEnv?: string;
7510
7544
  /** The list of message recipients. */
7511
7545
  receiverList?: string[];
7512
7546
  }
@@ -7619,6 +7653,8 @@ export declare namespace EasemobChat {
7619
7653
  * - (Default) `false`: The message is delivered when the recipient(s) is/are online. If the recipient(s) is/are offline, the message will not be delivered to them until they get online.
7620
7654
  */
7621
7655
  deliverOnlineOnly?: boolean;
7656
+ /** The webhookEnv field in the sending message protocol. */
7657
+ webhookEnv?: string;
7622
7658
  /** Message modified info. */
7623
7659
  modifiedInfo?: ModifiedMsgInfo;
7624
7660
  /** Has the message been read (only single chat messages have this field). */
@@ -7674,6 +7710,8 @@ export declare namespace EasemobChat {
7674
7710
  deliverOnlineOnly?: boolean;
7675
7711
  /** The list of message recipients. */
7676
7712
  receiverList?: string[];
7713
+ /** The webhookEnv field in the sending message protocol. */
7714
+ webhookEnv?: string;
7677
7715
  }
7678
7716
 
7679
7717
  interface ImgParameters {
@@ -7767,6 +7805,8 @@ export declare namespace EasemobChat {
7767
7805
  deliverOnlineOnly?: boolean;
7768
7806
  /** The list of message recipients. */
7769
7807
  receiverList?: string[];
7808
+ /** The webhookEnv field in the sending message protocol. */
7809
+ webhookEnv?: string;
7770
7810
  /** The thumbnail width. */
7771
7811
  thumbnailWidth?: number;
7772
7812
  /** The thumbnail height. */
@@ -7799,22 +7839,37 @@ export declare namespace EasemobChat {
7799
7839
  }
7800
7840
 
7801
7841
  interface CreateImageMessageParameters {
7842
+ /** The conversation type. */
7802
7843
  chatType: ChatType;
7844
+ /** The recipient. */
7803
7845
  to: string;
7846
+ /** The sender, which can only be the current user and can not be changed. */
7804
7847
  from?: string;
7848
+ /** The image file source. */
7805
7849
  file: ImageFileSource;
7850
+ /** The image width. */
7806
7851
  width?: number;
7852
+ /** The image height. */
7807
7853
  height?: number;
7808
7854
  /** Whether to send the original image. Default is false. */
7809
7855
  isOriginalImage?: boolean;
7856
+ /** Message extension. */
7810
7857
  ext?: { [key: string]: any };
7858
+ /** Whether read receipts are required during a group session. */
7811
7859
  msgConfig?: { allowGroupAck: boolean };
7860
+ /** Whether the message is a thread message. */
7812
7861
  isChatThread?: boolean;
7862
+ /** Message priority. */
7813
7863
  priority?: MessagePriority;
7864
+ /** Whether the message is delivered only when the recipient(s) is/are online. */
7814
7865
  deliverOnlineOnly?: boolean;
7866
+ /** The list of message recipients. */
7815
7867
  receiverList?: string[];
7868
+ /** The callback of file upload error. */
7816
7869
  onFileUploadError?: (err: ErrorEvent) => void;
7870
+ /** The callback of file upload completion. */
7817
7871
  onFileUploadComplete?: (data: UploadFileResult) => void;
7872
+ /** The callback of file upload progress. */
7818
7873
  onFileUploadProgress?: (data: ProgressEvent) => void;
7819
7874
  }
7820
7875
 
@@ -7867,6 +7922,8 @@ export declare namespace EasemobChat {
7867
7922
  deliverOnlineOnly?: boolean;
7868
7923
  /** The list of message recipients. */
7869
7924
  receiverList?: string[];
7925
+ /** The webhookEnv field in the sending message protocol. */
7926
+ webhookEnv?: string;
7870
7927
  /** The thumbnail width. */
7871
7928
  thumbnailWidth?: number;
7872
7929
  /** The thumbnail height. */
@@ -7971,6 +8028,8 @@ export declare namespace EasemobChat {
7971
8028
  modifiedInfo?: ModifiedMsgInfo;
7972
8029
  /** The list of message recipients. */
7973
8030
  receiverList?: string[];
8031
+ /** The webhookEnv field in the sending message protocol. */
8032
+ webhookEnv?: string;
7974
8033
  /** Has the message been read (only single chat messages have this field). */
7975
8034
  isRead?: boolean;
7976
8035
  /** Has the message been delivered (only single chat messages have this field). */
@@ -8026,6 +8085,8 @@ export declare namespace EasemobChat {
8026
8085
  deliverOnlineOnly?: boolean;
8027
8086
  /** The list of message recipients. */
8028
8087
  receiverList?: string[];
8088
+ /** The webhookEnv field in the sending message protocol. */
8089
+ webhookEnv?: string;
8029
8090
  }
8030
8091
 
8031
8092
  interface VideoParameters {
@@ -8126,6 +8187,8 @@ export declare namespace EasemobChat {
8126
8187
  modifiedInfo?: ModifiedMsgInfo;
8127
8188
  /** The list of message recipients. */
8128
8189
  receiverList?: string[];
8190
+ /** The webhookEnv field in the sending message protocol. */
8191
+ webhookEnv?: string;
8129
8192
  /** Has the message been read (only single chat messages have this field). */
8130
8193
  isRead?: boolean;
8131
8194
  /** Has the message been delivered (only single chat messages have this field). */
@@ -8183,6 +8246,8 @@ export declare namespace EasemobChat {
8183
8246
  deliverOnlineOnly?: boolean;
8184
8247
  /** The list of message recipients. */
8185
8248
  receiverList?: string[];
8249
+ /** The webhookEnv field in the sending message protocol. */
8250
+ webhookEnv?: string;
8186
8251
  }
8187
8252
 
8188
8253
  interface ReceivedMsgBody {