sim-sdk-web 1.0.35 → 1.0.37

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.
@@ -1,5 +1,5 @@
1
1
  import { RequestApi } from '../constant/api';
2
- import { AllowType, ApplicationHandleResult, GROUP_TYPE, GroupJoinSource, GroupMemberRole, GroupStatus, GroupType, GroupVerificationType, MessageReceiveOptType, MessageType, MSG_TYPE, Relationship } from './enum';
2
+ import { GroupType, MessageType } from './enum';
3
3
  import { HttpMethod } from '../utils/request';
4
4
  import { MessageService } from '../api/message';
5
5
  import { ConversationService } from '../api/conversation';
@@ -34,158 +34,14 @@ export interface ServerResponse<T = unknown> {
34
34
  data: T;
35
35
  timestamp?: number;
36
36
  }
37
- export interface PromiseMap {
38
- resolve: (response: ServerResponse) => void;
39
- reject: (response: ServerResponse) => void;
40
- }
41
37
  export type Pagination = {
42
38
  offset: number;
43
39
  count: number;
44
40
  };
45
- export type PicBaseInfo = {
46
- uuid: string;
47
- type: string;
48
- size: number;
49
- width: number;
50
- height: number;
51
- url: string;
52
- };
53
- export type AtUsersInfoItem = {
54
- atUserID: string;
55
- groupNickname: string;
56
- };
57
- export type GroupApplicationItem = {
58
- createTime: number;
59
- creatorUserID: string;
60
- ex: string;
61
- groupFaceURL: string;
62
- groupId: number;
63
- groupName: string;
64
- groupType: GroupType;
65
- handleResult: ApplicationHandleResult;
66
- handleUserID: string;
67
- handledMsg: string;
68
- handledTime: number;
69
- introduction: string;
70
- memberCount: number;
71
- nickname: string;
72
- notification: string;
73
- ownerUserID: string;
74
- reqMsg: string;
75
- reqTime: number;
76
- joinSource: GroupJoinSource;
77
- status: GroupStatus;
78
- userFaceURL: string;
79
- userId: string;
80
- };
81
- export type FriendApplicationItem = {
82
- createTime: number;
83
- ex: string;
84
- fromFaceURL: string;
85
- fromNickname: string;
86
- fromUserID: string;
87
- handleMsg: string;
88
- handleResult: ApplicationHandleResult;
89
- handleTime: number;
90
- handlerUserID: string;
91
- reqMsg: string;
92
- toFaceURL: string;
93
- toNickname: string;
94
- toUserID: string;
95
- };
96
- export type FullUserItem = {
97
- blackInfo: BlackUserItem | null;
98
- friendInfo: FriendUserItem | null;
99
- publicInfo: PublicUserItem | null;
100
- };
101
- export type FullUserItemWithCache = {
102
- blackInfo: BlackUserItem | null;
103
- friendInfo: FriendUserItem | null;
104
- publicInfo: PublicUserItem | null;
105
- groupMemberInfo: GroupMemberItem | null;
106
- };
107
- export type PublicUserItem = {
108
- nickname: string;
109
- userId: string;
110
- faceURL: string;
111
- ex: string;
112
- };
113
- export type SelfUserInfo = {
114
- createTime: number;
115
- ex: string;
116
- faceURL: string;
117
- nickname: string;
118
- userId: string;
119
- globalRecvMsgOpt: MessageReceiveOptType;
120
- };
121
- export type PartialUserInfo = {
122
- userId: string;
123
- } & Partial<Omit<SelfUserInfo, 'userId'>>;
124
- export type FriendUserItem = {
125
- addSource: number;
126
- createTime: number;
127
- ex: string;
128
- faceURL: string;
129
- userId: string;
130
- nickname: string;
131
- operatorUserID: string;
132
- ownerUserID: string;
133
- remark: string;
134
- attachedInfo: string;
135
- };
136
- export type SearchedFriendsInfo = FriendUserItem & {
137
- relationship: Relationship;
138
- };
139
- export type FriendshipInfo = {
140
- result: number;
141
- userId: string;
142
- };
143
- export type BlackUserItem = {
144
- addSource: number;
145
- userId: string;
146
- createTime: number;
147
- ex: string;
148
- faceURL: string;
149
- nickname: string;
150
- operatorUserID: string;
151
- ownerUserID: string;
152
- };
153
- export type GroupItem = {
154
- groupId: number;
155
- groupName: string;
156
- notification: string;
157
- notificationUserID: string;
158
- notificationUpdateTime: number;
159
- introduction: string;
160
- faceURL: string;
161
- ownerUserID: string;
162
- createTime: number;
163
- memberCount: number;
164
- status: GroupStatus;
165
- creatorUserID: string;
166
- groupType: GroupType;
167
- needVerification: GroupVerificationType;
168
- ex: string;
169
- applyMemberFriend: AllowType;
170
- lookMemberInfo: AllowType;
171
- };
172
- export type GroupMemberItem = {
173
- groupId: number;
174
- userId: string;
175
- nickname: string;
176
- faceURL: string;
177
- roleLevel: GroupMemberRole;
178
- muteEndTime: number;
179
- joinTime: number;
180
- joinSource: GroupJoinSource;
181
- inviterUserID: string;
182
- operatorUserID: string;
183
- ex: string;
184
- };
185
41
  export type ConversationItem = {
186
42
  id: number;
187
43
  name: string;
188
- groupType: number;
44
+ groupType: GroupType;
189
45
  avatar: string;
190
46
  status: number;
191
47
  latest: MessageItem;
@@ -218,14 +74,14 @@ interface AvatarMap {
218
74
  export type MessageItem = {
219
75
  msgId: number;
220
76
  username: string;
221
- groupType: number;
77
+ groupType: GroupType;
222
78
  groupId: number;
223
79
  replyMsgId: number;
224
80
  clientMsgId: string;
225
81
  userId: number;
226
82
  send: number;
227
83
  to: number;
228
- msgType: MSG_TYPE;
84
+ msgType: MessageType;
229
85
  text?: string;
230
86
  link?: string;
231
87
  snapshot?: string;
@@ -242,7 +98,7 @@ export interface GroupInfoVO {
242
98
  /**
243
99
  * 聊天群类型: 0:一对一私聊 ,1:群聊,2:客服聊天
244
100
  */
245
- groupType: GROUP_TYPE;
101
+ groupType: GroupType;
246
102
  createTime: number;
247
103
  updateTime: number;
248
104
  /**
@@ -323,4 +179,8 @@ export interface ActiveConversationSyncPayload {
323
179
  serverLatestMessageId: number;
324
180
  timestamp: number;
325
181
  }
182
+ export interface LatestMessagesUpdateResponse {
183
+ ttl: number;
184
+ groupChatIds: Record<number, number>;
185
+ }
326
186
  export {};
@@ -1,137 +1,9 @@
1
- export declare enum MessageReceiveOptType {
2
- Nomal = 0,
3
- NotReceive = 1,
4
- NotNotify = 2
5
- }
6
- export declare enum AllowType {
7
- Allowed = 0,
8
- NotAllowed = 1
9
- }
10
1
  export declare enum GroupType {
11
- Group = 2,
12
- WorkingGroup = 2
13
- }
14
- export declare enum GroupJoinSource {
15
- Invitation = 2,
16
- Search = 3,
17
- QrCode = 4
18
- }
19
- export declare enum GroupMemberRole {
20
- Nomal = 20,
21
- Admin = 60,
22
- Owner = 100
23
- }
24
- export declare enum GroupVerificationType {
25
- ApplyNeedInviteNot = 0,
26
- AllNeed = 1,
27
- AllNot = 2
28
- }
29
- export declare enum Platform {
30
- iOS = 1,
31
- Android = 2,
32
- Windows = 3,
33
- MacOSX = 4,
34
- Web = 5,
35
- Linux = 7,
36
- AndroidPad = 8,
37
- iPad = 9
38
- }
39
- export declare enum LogLevel {
40
- Debug = 5,
41
- Info = 4,
42
- Warn = 3,
43
- Error = 2,
44
- Fatal = 1,
45
- Panic = 0
46
- }
47
- export declare enum ApplicationHandleResult {
48
- Unprocessed = 0,
49
- Agree = 1,
50
- Reject = -1
51
- }
52
- export declare enum MessageType {
53
- MESSAGE_TYPE_TEXT = 0,
54
- TextMessage = 101,
55
- PictureMessage = 102,
56
- VoiceMessage = 103,
57
- VideoMessage = 104,
58
- FileMessage = 105,
59
- AtTextMessage = 106,
60
- MergeMessage = 107,
61
- CardMessage = 108,
62
- LocationMessage = 109,
63
- CustomMessage = 110,
64
- TypingMessage = 113,
65
- QuoteMessage = 114,
66
- FaceMessage = 115,
67
- FriendAdded = 1201,
68
- OANotification = 1400,
69
- GroupCreated = 1501,
70
- MemberQuit = 1504,
71
- GroupOwnerTransferred = 1507,
72
- MemberKicked = 1508,
73
- MemberInvited = 1509,
74
- MemberEnter = 1510,
75
- GroupDismissed = 1511,
76
- GroupMemberMuted = 1512,
77
- GroupMemberCancelMuted = 1513,
78
- GroupMuted = 1514,
79
- GroupCancelMuted = 1515,
80
- GroupAnnouncementUpdated = 1519,
81
- GroupNameUpdated = 1520,
82
- BurnMessageChange = 1701,
83
- RevokeMessage = 2101
84
- }
85
- export declare enum SessionType {
86
- Single = 1,
87
- Group = 3,
88
- WorkingGroup = 3,
89
- Notification = 4
90
- }
91
- export declare enum GroupStatus {
92
- Nomal = 0,
93
- Baned = 1,
94
- Dismissed = 2,
95
- Muted = 3
96
- }
97
- export declare enum GroupAtType {
98
- AtNormal = 0,
99
- AtMe = 1,
100
- AtAll = 2,
101
- AtAllAtMe = 3,
102
- AtGroupNotice = 4
103
- }
104
- export declare enum GroupMemberFilter {
105
- All = 0,
106
- Owner = 1,
107
- Admin = 2,
108
- Nomal = 3,
109
- AdminAndNomal = 4,
110
- AdminAndOwner = 5
111
- }
112
- export declare enum Relationship {
113
- isBlack = 0,
114
- isFriend = 1
115
- }
116
- export declare enum LoginStatus {
117
- Logout = 1,
118
- Logging = 2,
119
- Logged = 3
120
- }
121
- export declare enum OnlineState {
122
- Online = 1,
123
- Offline = 0
124
- }
125
- export declare enum GroupMessageReaderFilter {
126
- Readed = 0,
127
- UnRead = 1
128
- }
129
- export declare enum GROUP_TYPE {
130
2
  ONE_ON_ONE = 0,
131
3
  GROUP_CHAT = 1,
132
4
  CUSTOMER_SERVICE = 2
133
5
  }
134
- export declare enum MSG_TYPE {
6
+ export declare enum MessageType {
135
7
  TEXT = 0,
136
8
  IMAGE = 1,
137
9
  FILE = 2,
@@ -149,13 +21,3 @@ export declare enum SSE_RESPONSE_TYPE {
149
21
  EVENT_PONG_IDLE = 2,
150
22
  EVENT_MESSAGE_PUSH = 3
151
23
  }
152
- export declare enum MessageSendStatus {
153
- Sending = 1,
154
- Succeed = 2,
155
- Failed = 3
156
- }
157
- export declare const MessageStatus: {
158
- NORMAL: number;
159
- EDITED: number;
160
- DELETED: number;
161
- };
@@ -1,15 +1,8 @@
1
- import type { AtUsersInfoItem, GroupItem, MessageItem, PicBaseInfo, SelfUserInfo } from './entity';
2
- import type { GroupJoinSource, GroupMemberFilter, GroupMemberRole, MessageReceiveOptType, MessageType } from './enum';
3
1
  export type LoginParams = {
4
2
  username: string;
5
3
  token: string;
6
4
  appKey?: string;
7
5
  };
8
- export type SetSelfInfoParams = Partial<SelfUserInfo>;
9
- export type GetUserInfoWithCacheParams = {
10
- userIDList: string[];
11
- groupID?: string;
12
- };
13
6
  export type SplitConversationParams = {
14
7
  offset: number;
15
8
  count: number;
@@ -26,10 +19,6 @@ export type PinConversationParams = {
26
19
  conversationID: string;
27
20
  isPinned: boolean;
28
21
  };
29
- export type SetConversationRecvOptParams = {
30
- conversationID: string;
31
- opt: MessageReceiveOptType;
32
- };
33
22
  export type SetConversationPrivateParams = {
34
23
  conversationID: string;
35
24
  isPrivate: boolean;
@@ -56,198 +45,17 @@ export type RemarkFriendParams = {
56
45
  toUserID: string;
57
46
  remark: string;
58
47
  };
59
- export type CreateGroupParams = {
60
- memberUserIDs: string[];
61
- groupInfo: Partial<GroupItem>;
62
- adminUserIDs?: string[];
63
- ownerUserID?: string;
64
- };
65
- export type JoinGroupParams = {
66
- groupID: string;
67
- reqMsg: string;
68
- joinSource: GroupJoinSource;
69
- ex?: string;
70
- };
71
- export type OpreateGroupParams = {
72
- groupID: string;
73
- reason: string;
74
- userIDList: string[];
75
- };
76
- export type SearchGroupParams = {
77
- keywordList: string[];
78
- isSearchGroupID: boolean;
79
- isSearchGroupName: boolean;
80
- };
81
- export type SetGroupinfoParams = Partial<GroupItem> & {
82
- groupID: string;
83
- };
84
- export type AccessGroupParams = {
85
- groupID: string;
86
- fromUserID: string;
87
- handleMsg: string;
88
- };
89
- export declare type GetGroupMemberParams = {
90
- groupID: string;
91
- filter: GroupMemberFilter;
92
- offset: number;
93
- count: number;
94
- };
95
- export type getGroupMembersInfoParams = {
96
- groupID: string;
97
- userIDList: string[];
98
- };
99
- export type SearchGroupMemberParams = {
100
- groupID: string;
101
- keywordList: string[];
102
- isSearchUserID: boolean;
103
- isSearchMemberNickname: boolean;
104
- offset: number;
105
- count: number;
106
- };
107
- export type UpdateMemberInfoParams = {
108
- groupID: string;
109
- userId: string;
110
- nickname?: string;
111
- faceURL?: string;
112
- roleLevel?: GroupMemberRole;
113
- ex?: string;
114
- };
115
- export type GetGroupMemberByTimeParams = {
116
- groupID: string;
117
- filterUserIDList: string[];
118
- offset: number;
119
- count: number;
120
- joinTimeBegin: number;
121
- joinTimeEnd: number;
122
- };
123
- export type ChangeGroupMemberMuteParams = {
124
- groupID: string;
125
- userId: string;
126
- mutedSeconds: number;
127
- };
128
- export type ChangeGroupMuteParams = {
129
- groupID: string;
130
- isMute: boolean;
131
- };
132
- export type TransferGroupParams = {
133
- groupID: string;
134
- newOwnerUserID: string;
135
- };
136
- export type AtMsgParams = {
137
- text: string;
138
- atUserIDList: string[];
139
- atUsersInfo?: AtUsersInfoItem[];
140
- message?: MessageItem;
141
- };
142
- export type ImageMsgParams = {
143
- sourcePicture: PicBaseInfo;
144
- bigPicture: PicBaseInfo;
145
- snapshotPicture: PicBaseInfo;
146
- sourcePath: string;
147
- };
148
- export type SoundMsgParams = {
149
- uuid: string;
150
- soundPath: string;
151
- sourceUrl: string;
152
- dataSize: number;
153
- duration: number;
154
- soundType?: string;
155
- };
156
- export type VideoMsgParams = {
157
- videoPath: string;
158
- duration: number;
159
- videoType: string;
160
- snapshotPath: string;
161
- videoUUID: string;
162
- videoUrl: string;
163
- videoSize: number;
164
- snapshotUUID: string;
165
- snapshotSize: number;
166
- snapshotUrl: string;
167
- snapshotWidth: number;
168
- snapshotHeight: number;
169
- snapShotType?: string;
170
- };
171
- export type FileMsgParams = {
172
- filePath: string;
173
- fileName: string;
174
- uuid: string;
175
- sourceUrl: string;
176
- fileSize: number;
177
- fileType?: string;
178
- };
179
- export type MergerMsgParams = {
180
- messageList: MessageItem[];
181
- title: string;
182
- summaryList: string[];
183
- };
184
- export type LocationMsgParams = {
185
- description: string;
186
- longitude: number;
187
- latitude: number;
188
- };
189
- export type QuoteMsgParams = {
190
- text: string;
191
- message: string;
192
- };
193
- export type CustomMsgParams = {
194
- data: string;
195
- extension: string;
196
- description: string;
197
- };
198
- export type FaceMessageParams = {
199
- index: number;
200
- data: string;
201
- };
202
- export type TypingUpdateParams = {
203
- recvID: string;
204
- msgTip: string;
205
- };
206
- export type OpreateMessageParams = {
207
- conversationID: string;
208
- clientMsgID: string;
209
- };
210
- export type SearchLocalParams = {
211
- conversationID: string;
212
- keywordList: string[];
213
- keywordListMatchType?: number;
214
- senderUserIDList?: string[];
215
- messageTypeList?: MessageType[];
216
- searchTimePosition?: number;
217
- searchTimePeriod?: number;
218
- pageIndex?: number;
219
- count?: number;
220
- };
221
- export type GetAdvancedHistoryMsgParams = {
222
- userId?: string;
223
- groupID?: string;
224
- lastMinSeq: number;
225
- count: number;
226
- startClientMsgID: string;
227
- conversationID: string;
228
- };
229
- export type FindMessageParams = {
230
- conversationID: string;
231
- clientMsgIDList: string[];
232
- };
233
- export type InsertGroupMsgParams = {
234
- message: MessageItem;
235
- groupID: string;
236
- sendID: string;
237
- };
238
- export type InsertSingleMsgParams = {
239
- message: MessageItem;
240
- recvID: string;
241
- sendID: string;
242
- };
243
- export type SetMessageLocalExParams = {
244
- conversationID: string;
245
- clientMsgID: string;
246
- localEx: string;
247
- };
248
48
  export declare type UploadFileParams = {
249
49
  name?: string;
250
50
  contentType?: string;
251
51
  uuid?: string;
252
52
  file: File;
253
53
  };
54
+ /**
55
+ * 上传返回结构
56
+ */
57
+ export type UploadResult = {
58
+ originalUrl?: string;
59
+ thumbnailUrl?: string;
60
+ error?: Error;
61
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sim-sdk-web",
3
- "version": "v1.0.35",
3
+ "version": "v1.0.37",
4
4
  "description": "Sim SDK for Web",
5
5
  "source": "src/index.ts",
6
6
  "main": "lib/index.js",