@imam-inter/openim-sdk-js-wasm 3.8.2-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.
Files changed (75) hide show
  1. package/LICENSE +661 -0
  2. package/README.md +166 -0
  3. package/assets/openIM.wasm +0 -0
  4. package/assets/sql-wasm.wasm +0 -0
  5. package/assets/wasm_exec.js +561 -0
  6. package/lib/api/database/alter.d.ts +2 -0
  7. package/lib/api/database/black.d.ts +7 -0
  8. package/lib/api/database/conversation.d.ts +31 -0
  9. package/lib/api/database/friend.d.ts +12 -0
  10. package/lib/api/database/friendRequest.d.ts +7 -0
  11. package/lib/api/database/groupMember.d.ts +22 -0
  12. package/lib/api/database/groupRequest.d.ts +8 -0
  13. package/lib/api/database/groups.d.ts +14 -0
  14. package/lib/api/database/index.d.ts +20 -0
  15. package/lib/api/database/init.d.ts +3 -0
  16. package/lib/api/database/instance.d.ts +3 -0
  17. package/lib/api/database/localAppSdkVersion.d.ts +2 -0
  18. package/lib/api/database/message.d.ts +31 -0
  19. package/lib/api/database/notification.d.ts +3 -0
  20. package/lib/api/database/sendingMessages.d.ts +3 -0
  21. package/lib/api/database/stranger.d.ts +4 -0
  22. package/lib/api/database/superGroup.d.ts +6 -0
  23. package/lib/api/database/tableMaster.d.ts +1 -0
  24. package/lib/api/database/tempCacheChatLogs.d.ts +2 -0
  25. package/lib/api/database/unreadMessage.d.ts +2 -0
  26. package/lib/api/database/upload.d.ts +4 -0
  27. package/lib/api/database/users.d.ts +3 -0
  28. package/lib/api/database/versionSync.d.ts +3 -0
  29. package/lib/api/index.d.ts +2 -0
  30. package/lib/api/upload.d.ts +5 -0
  31. package/lib/api/worker.d.ts +1 -0
  32. package/lib/constant/index.d.ts +71 -0
  33. package/lib/index.d.ts +6 -0
  34. package/lib/index.es.js +2121 -0
  35. package/lib/index.js +2125 -0
  36. package/lib/index.umd.js +2131 -0
  37. package/lib/sdk/index.d.ts +173 -0
  38. package/lib/sdk/initialize.d.ts +5 -0
  39. package/lib/sqls/index.d.ts +20 -0
  40. package/lib/sqls/localAdminGroupRequests.d.ts +9 -0
  41. package/lib/sqls/localAppSdkVersion.d.ts +8 -0
  42. package/lib/sqls/localBlack.d.ts +12 -0
  43. package/lib/sqls/localChatLogsConversationID.d.ts +36 -0
  44. package/lib/sqls/localConversationUnreadMessages.d.ts +7 -0
  45. package/lib/sqls/localConversations.d.ts +34 -0
  46. package/lib/sqls/localFriend.d.ts +16 -0
  47. package/lib/sqls/localFriendRequest.d.ts +12 -0
  48. package/lib/sqls/localGroupMembers.d.ts +27 -0
  49. package/lib/sqls/localGroupRequests.d.ts +9 -0
  50. package/lib/sqls/localGroups.d.ts +16 -0
  51. package/lib/sqls/localNotification.d.ts +8 -0
  52. package/lib/sqls/localSendingMessages.d.ts +8 -0
  53. package/lib/sqls/localStranger.d.ts +8 -0
  54. package/lib/sqls/localSuperGroups.d.ts +10 -0
  55. package/lib/sqls/localTableMaster.d.ts +5 -0
  56. package/lib/sqls/localUpload.d.ts +10 -0
  57. package/lib/sqls/localUsers.d.ts +8 -0
  58. package/lib/sqls/localVersionSync.d.ts +9 -0
  59. package/lib/sqls/tempCacheLocalChatLogs.d.ts +6 -0
  60. package/lib/types/entity.d.ts +452 -0
  61. package/lib/types/enum.d.ts +134 -0
  62. package/lib/types/eventData.d.ts +51 -0
  63. package/lib/types/params.d.ts +390 -0
  64. package/lib/utils/emitter.d.ts +12 -0
  65. package/lib/utils/escape.d.ts +23 -0
  66. package/lib/utils/index.d.ts +7 -0
  67. package/lib/utils/is.d.ts +6 -0
  68. package/lib/utils/key.d.ts +3 -0
  69. package/lib/utils/logFormat.d.ts +1 -0
  70. package/lib/utils/response.d.ts +1 -0
  71. package/lib/utils/timer.d.ts +1 -0
  72. package/lib/utils/value.d.ts +6 -0
  73. package/lib/worker-legacy.js +1 -0
  74. package/lib/worker.js +1 -0
  75. package/package.json +94 -0
@@ -0,0 +1,390 @@
1
+ import { MessageEntity, OfflinePush, PicBaseInfo, AtUsersInfoItem, MessageItem, SelfUserInfo, RtcInvite, GroupItem } from './entity';
2
+ import { AllowType, GroupJoinSource, GroupVerificationType, MessageType, MessageReceiveOptType, GroupMemberRole, GroupMemberFilter, LogLevel, GroupMessageReaderFilter, GroupAtType } from './enum';
3
+ export declare type WasmPathConfig = {
4
+ coreWasmPath?: string;
5
+ sqlWasmPath?: string;
6
+ debug?: boolean;
7
+ };
8
+ export declare type InitAndLoginConfig = {
9
+ userID: string;
10
+ token: string;
11
+ platformID: number;
12
+ apiAddr: string;
13
+ wsAddr: string;
14
+ logLevel?: LogLevel;
15
+ isLogStandardOutput?: boolean;
16
+ isExternalExtensions?: boolean;
17
+ tryParse?: boolean;
18
+ };
19
+ export declare type GetOneConversationParams = {
20
+ sourceID: string;
21
+ sessionType: number;
22
+ };
23
+ export declare type GetAdvancedHistoryMsgParams = {
24
+ userID?: string;
25
+ groupID?: string;
26
+ lastMinSeq: number;
27
+ count: number;
28
+ startClientMsgID: string;
29
+ conversationID: string;
30
+ };
31
+ export declare type GetHistoryMsgParams = {
32
+ userID: string;
33
+ groupID: string;
34
+ count: number;
35
+ startClientMsgID: string;
36
+ conversationID?: string;
37
+ };
38
+ export declare type SendGroupReadReceiptParams = {
39
+ conversationID: string;
40
+ clientMsgIDList: string[];
41
+ };
42
+ export declare type GetGroupMessageReaderParams = {
43
+ conversationID: string;
44
+ clientMsgID: string;
45
+ filter: GroupMessageReaderFilter;
46
+ offset: number;
47
+ count: number;
48
+ };
49
+ export declare type GetGroupMemberParams = {
50
+ groupID: string;
51
+ filter: GroupMemberFilter;
52
+ offset: number;
53
+ count: number;
54
+ };
55
+ export declare type SendMsgParams = {
56
+ recvID: string;
57
+ groupID: string;
58
+ offlinePushInfo?: OfflinePush;
59
+ message: MessageItem;
60
+ isOnlineOnly?: boolean;
61
+ };
62
+ export declare type SetMessageLocalExParams = {
63
+ conversationID: string;
64
+ clientMsgID: string;
65
+ localEx: string;
66
+ };
67
+ export declare type ImageMsgParamsByURL = {
68
+ sourcePicture: PicBaseInfo;
69
+ bigPicture: PicBaseInfo;
70
+ snapshotPicture: PicBaseInfo;
71
+ sourcePath: string;
72
+ };
73
+ export declare type VideoMsgParamsByURL = {
74
+ videoPath: string;
75
+ duration: number;
76
+ videoType: string;
77
+ snapshotPath: string;
78
+ videoUUID: string;
79
+ videoUrl: string;
80
+ videoSize: number;
81
+ snapshotUUID: string;
82
+ snapshotSize: number;
83
+ snapshotUrl: string;
84
+ snapshotWidth: number;
85
+ snapshotHeight: number;
86
+ snapShotType?: string;
87
+ };
88
+ export declare type VideoMsgParamsByFullPath = {
89
+ videoFullPath: string;
90
+ videoType: string;
91
+ duration: number;
92
+ snapshotFullPath: string;
93
+ };
94
+ export declare type CustomMsgParams = {
95
+ data: string;
96
+ extension: string;
97
+ description: string;
98
+ };
99
+ export declare type QuoteMsgParams = {
100
+ text: string;
101
+ message: string;
102
+ };
103
+ export declare type AdvancedQuoteMsgParams = {
104
+ text: string;
105
+ message: MessageItem;
106
+ messageEntityList?: MessageEntity[];
107
+ };
108
+ export declare type AdvancedMsgParams = {
109
+ text: string;
110
+ messageEntityList?: MessageEntity[];
111
+ };
112
+ export declare type SetConversationParams = {
113
+ conversationID: string;
114
+ recvMsgOpt?: MessageReceiveOptType;
115
+ groupAtType?: GroupAtType;
116
+ burnDuration?: number;
117
+ msgDestructTime?: number;
118
+ isPinned?: boolean;
119
+ isPrivateChat?: boolean;
120
+ isMsgDestruct?: boolean;
121
+ ex?: string;
122
+ };
123
+ export declare type SetConversationPrivateStateParams = {
124
+ conversationID: string;
125
+ isPrivate: boolean;
126
+ };
127
+ export declare type SplitConversationParams = {
128
+ offset: number;
129
+ count: number;
130
+ };
131
+ export declare type SetConversationDraftParams = {
132
+ conversationID: string;
133
+ draftText: string;
134
+ };
135
+ export declare type SetConversationPinParams = {
136
+ conversationID: string;
137
+ isPinned: boolean;
138
+ };
139
+ export declare type JoinGroupParams = {
140
+ groupID: string;
141
+ reqMsg: string;
142
+ joinSource: GroupJoinSource;
143
+ ex?: string;
144
+ };
145
+ export declare type SearchGroupParams = {
146
+ keywordList: string[];
147
+ isSearchGroupID: boolean;
148
+ isSearchGroupName: boolean;
149
+ };
150
+ export declare type ChangeGroupMuteParams = {
151
+ groupID: string;
152
+ isMute: boolean;
153
+ };
154
+ export declare type ChangeGroupMemberMuteParams = {
155
+ groupID: string;
156
+ userID: string;
157
+ mutedSeconds: number;
158
+ };
159
+ export declare type TransferGroupParams = {
160
+ groupID: string;
161
+ newOwnerUserID: string;
162
+ };
163
+ export declare type AccessGroupApplicationParams = {
164
+ groupID: string;
165
+ fromUserID: string;
166
+ handleMsg: string;
167
+ };
168
+ export declare type SetGroupRoleParams = {
169
+ groupID: string;
170
+ userID: string;
171
+ roleLevel: GroupMemberRole;
172
+ };
173
+ export declare type SetGroupVerificationParams = {
174
+ verification: GroupVerificationType;
175
+ groupID: string;
176
+ };
177
+ export declare type SetBurnDurationParams = {
178
+ conversationID: string;
179
+ burnDuration: number;
180
+ };
181
+ export declare type AtMsgParams = {
182
+ text: string;
183
+ atUserIDList: string[];
184
+ atUsersInfo?: AtUsersInfoItem[];
185
+ message?: MessageItem;
186
+ };
187
+ export declare type SoundMsgParamsByURL = {
188
+ uuid: string;
189
+ soundPath: string;
190
+ sourceUrl: string;
191
+ dataSize: number;
192
+ duration: number;
193
+ soundType?: string;
194
+ };
195
+ export declare type FileMsgParamsByURL = {
196
+ filePath: string;
197
+ fileName: string;
198
+ uuid: string;
199
+ sourceUrl: string;
200
+ fileSize: number;
201
+ fileType?: string;
202
+ };
203
+ export declare type FileMsgParamsByFullPath = {
204
+ fileFullPath: string;
205
+ fileName: string;
206
+ };
207
+ export declare type SoundMsgParamsByFullPath = {
208
+ soundPath: string;
209
+ duration: number;
210
+ };
211
+ export declare type MergerMsgParams = {
212
+ messageList: MessageItem[];
213
+ title: string;
214
+ summaryList: string[];
215
+ };
216
+ export declare type FaceMessageParams = {
217
+ index: number;
218
+ data: string;
219
+ };
220
+ export declare type LocationMsgParams = {
221
+ description: string;
222
+ longitude: number;
223
+ latitude: number;
224
+ };
225
+ export declare type InsertSingleMsgParams = {
226
+ message: MessageItem;
227
+ recvID: string;
228
+ sendID: string;
229
+ };
230
+ export declare type InsertGroupMsgParams = {
231
+ message: MessageItem;
232
+ groupID: string;
233
+ sendID: string;
234
+ };
235
+ export declare type AccessMessageParams = {
236
+ conversationID: string;
237
+ clientMsgID: string;
238
+ };
239
+ export declare type TypingUpdateParams = {
240
+ recvID: string;
241
+ msgTip: string;
242
+ };
243
+ export declare type ChangeInputStatesParams = {
244
+ conversationID: string;
245
+ focus: boolean;
246
+ };
247
+ export declare type GetInputstatesParams = {
248
+ conversationID: string;
249
+ userID: string;
250
+ };
251
+ export declare type SetConversationExParams = {
252
+ conversationID: string;
253
+ ex: string;
254
+ };
255
+ export declare type SetConversationRecvOptParams = {
256
+ conversationID: string;
257
+ opt: MessageReceiveOptType;
258
+ };
259
+ export declare type SearchLocalParams = {
260
+ conversationID: string;
261
+ keywordList: string[];
262
+ keywordListMatchType?: number;
263
+ senderUserIDList?: string[];
264
+ messageTypeList?: MessageType[];
265
+ searchTimePosition?: number;
266
+ searchTimePeriod?: number;
267
+ pageIndex?: number;
268
+ count?: number;
269
+ };
270
+ export declare type AddFriendParams = {
271
+ toUserID: string;
272
+ reqMsg: string;
273
+ };
274
+ export declare type SearchFriendParams = {
275
+ keywordList: string[];
276
+ isSearchUserID: boolean;
277
+ isSearchNickname: boolean;
278
+ isSearchRemark: boolean;
279
+ };
280
+ export declare type GetSpecifiedFriendsParams = {
281
+ friendUserIDList: string[];
282
+ filterBlack?: boolean;
283
+ };
284
+ export declare type UpdateFriendsParams = {
285
+ friendUserIDs: string[];
286
+ isPinned?: boolean;
287
+ remark?: boolean;
288
+ ex?: boolean;
289
+ };
290
+ export declare type RemarkFriendParams = {
291
+ toUserID: string;
292
+ remark: string;
293
+ };
294
+ export declare type PinFriendParams = {
295
+ toUserIDs: string[];
296
+ isPinned: boolean;
297
+ };
298
+ export declare type SetFriendExParams = {
299
+ toUserIDs: string[];
300
+ ex: string;
301
+ };
302
+ export declare type AccessFriendApplicationParams = {
303
+ toUserID: string;
304
+ handleMsg: string;
305
+ };
306
+ export declare type AddBlackParams = {
307
+ toUserID: string;
308
+ ex?: string;
309
+ };
310
+ export declare type AccessToGroupParams = {
311
+ groupID: string;
312
+ reason: string;
313
+ userIDList: string[];
314
+ };
315
+ export declare type GetGroupMemberByTimeParams = {
316
+ groupID: string;
317
+ filterUserIDList: string[];
318
+ offset: number;
319
+ count: number;
320
+ joinTimeBegin: number;
321
+ joinTimeEnd: number;
322
+ };
323
+ export declare type SearchGroupMemberParams = {
324
+ groupID: string;
325
+ keywordList: string[];
326
+ isSearchUserID: boolean;
327
+ isSearchMemberNickname: boolean;
328
+ offset: number;
329
+ count: number;
330
+ };
331
+ export declare type SetMemberPermissionParams = {
332
+ rule: AllowType;
333
+ groupID: string;
334
+ };
335
+ export declare type OffsetParams = {
336
+ offset: number;
337
+ count: number;
338
+ };
339
+ export declare type CreateGroupParams = {
340
+ memberUserIDs: string[];
341
+ groupInfo: Partial<GroupItem>;
342
+ adminUserIDs?: string[];
343
+ ownerUserID?: string;
344
+ };
345
+ export declare type SetGroupMemberNickParams = {
346
+ groupID: string;
347
+ userID: string;
348
+ groupMemberNickname: string;
349
+ };
350
+ export declare type UpdateMemberInfoParams = {
351
+ groupID: string;
352
+ userID: string;
353
+ nickname?: string;
354
+ faceURL?: string;
355
+ roleLevel?: GroupMemberRole;
356
+ ex?: string;
357
+ };
358
+ export declare type FindMessageParams = {
359
+ conversationID: string;
360
+ clientMsgIDList: string[];
361
+ };
362
+ export declare type UploadFileParams = {
363
+ name: string;
364
+ contentType: string;
365
+ uuid: string;
366
+ file?: File;
367
+ filepath?: string;
368
+ cause?: string;
369
+ };
370
+ export declare type PartialUserItem = Partial<SelfUserInfo>;
371
+ export declare type SignalingInviteParams = {
372
+ invitation: RtcInvite;
373
+ offlinePushInfo?: OfflinePush;
374
+ };
375
+ export declare type RtcActionParams = {
376
+ opUserID: string;
377
+ invitation: RtcInvite;
378
+ };
379
+ export declare type CustomSignalParams = {
380
+ roomID: string;
381
+ customInfo: string;
382
+ };
383
+ export declare type SetConversationMsgDestructParams = {
384
+ conversationID: string;
385
+ isMsgDestruct: boolean;
386
+ };
387
+ export declare type SetConversationMsgDestructTimeParams = {
388
+ conversationID: string;
389
+ msgDestructTime: number;
390
+ };
@@ -0,0 +1,12 @@
1
+ import { WSEvent } from '../types/entity';
2
+ import { CbEvents } from '../constant';
3
+ import { DataOfEvent } from '../types/eventData';
4
+ declare type Cbfn<E extends CbEvents> = (data: WSEvent<DataOfEvent<E>>) => void;
5
+ declare class Emitter {
6
+ private events;
7
+ constructor();
8
+ emit<E extends CbEvents>(event: E, data: WSEvent<DataOfEvent<E>>): this;
9
+ on<E extends CbEvents>(event: E, fn: Cbfn<E>): this;
10
+ off<E extends CbEvents>(event: E, fn: Cbfn<E>): this | undefined;
11
+ }
12
+ export default Emitter;
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Escapes the given string to protect against SQL injection attacks.
3
+ *
4
+ * By default it assumes that backslashes are not supported as they are not part of the standard SQL spec.
5
+ * Quoting from the [SQLlite web site](https://sqlite.org/lang_expr.html):
6
+ *
7
+ * > C-style escapes using the backslash character are not supported because they are not standard SQL.
8
+ *
9
+ * This means three things:
10
+ *
11
+ * - backslashes and double quotes `"` are not escaped by default
12
+ * - single quotes are escaped via `''` instead of `\'`
13
+ * - your sql engine should throw an error when encountering a backslash escape
14
+ * as part of a string, unless it is a literal backslash, i.e. `'backslash: \\'`.
15
+ *
16
+ * It is recommended to set the `backslashSupported` option `true` if your SQL
17
+ * engine supports it. In that case backslash sequences are escaped and single
18
+ * and double quotes are escaped via a backslash, i.e. `'\''`.
19
+ *
20
+ */
21
+ export declare function escapeString(val: string, opts?: {
22
+ backslashSupported: boolean;
23
+ }): string;
@@ -0,0 +1,7 @@
1
+ export * from './response';
2
+ export * from './timer';
3
+ export * from './key';
4
+ export * from './value';
5
+ export * from './is';
6
+ export * from './escape';
7
+ export * from './logFormat';
@@ -0,0 +1,6 @@
1
+ export declare function isString(value: unknown): boolean;
2
+ export declare function isNumber(value: unknown): boolean;
3
+ export declare function isBoolean(value: unknown): boolean;
4
+ export declare function isUndefined(value: unknown): boolean;
5
+ export declare function isObject(value: unknown): boolean;
6
+ export declare function isFunction(value: unknown): boolean;
@@ -0,0 +1,3 @@
1
+ export declare type KeyType = 'CamelCase' | 'SnakeCase';
2
+ export declare function convertSnakeCaseToCamelCase(key: string): string;
3
+ export declare function convertCamelCaseToSnakeCase(key: string): string;
@@ -0,0 +1 @@
1
+ export declare function logBoxStyleValue(backgroundColor?: string, color?: string): string;
@@ -0,0 +1 @@
1
+ export declare function formatResponse(data: unknown, errCode?: number, errMsg?: string): any;
@@ -0,0 +1 @@
1
+ export declare function wait(duration: number): Promise<unknown>;
@@ -0,0 +1,6 @@
1
+ import { QueryExecResult } from '@jlongster/sql.js';
2
+ import { KeyType } from './key';
3
+ export declare function converSqlExecResult(record: QueryExecResult, keyType?: KeyType, booleanKeys?: string[], convertMap?: Record<string, string>): Record<string, unknown>[];
4
+ export declare function convertToCamelCaseObject(obj: Record<string, unknown>): Record<string, unknown>;
5
+ export declare function convertToSnakeCaseObject(obj: Record<string, unknown>, escape?: boolean): Record<string, unknown>;
6
+ export declare function convertObjectField(obj: Record<string, unknown>, convertMap?: Record<string, string>): Record<string, any>;