sim-sdk-web 1.0.36 → 1.0.38

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
  /**
@@ -327,4 +183,33 @@ export interface LatestMessagesUpdateResponse {
327
183
  ttl: number;
328
184
  groupChatIds: Record<number, number>;
329
185
  }
186
+ export interface GroupPermission {
187
+ id?: number;
188
+ /**
189
+ * 权限状态: 0: 启用,1: 不启用
190
+ */
191
+ status?: number;
192
+ /**
193
+ * 权限描述
194
+ */
195
+ description?: string;
196
+ /**
197
+ * 权限值
198
+ */
199
+ value?: number;
200
+ }
201
+ export interface UpdateGroupPermission {
202
+ /** 群id */
203
+ groupId: number;
204
+ /** 更新的权限列表 */
205
+ permissions: GroupPermission[];
206
+ }
207
+ export interface UpdateGroupMemberPermission {
208
+ /** 群id */
209
+ groupId: number;
210
+ /** 成员id,可选字段,如果不是必须的 */
211
+ targetMemberId?: number;
212
+ /** 更新的权限列表 */
213
+ permissions: GroupPermission[];
214
+ }
330
215
  export {};
@@ -1,137 +1,11 @@
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
2
+ PrivateChat = 0,// 一对一私聊
3
+ PrivateGroup = 1,// 群聊 - 私群
4
+ PublicGroup = 2,// 群聊 - 公群
5
+ CustomerService = 3,// 客服聊天
6
+ LiveGroup = 4
51
7
  }
52
8
  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
- ONE_ON_ONE = 0,
131
- GROUP_CHAT = 1,
132
- CUSTOMER_SERVICE = 2
133
- }
134
- export declare enum MSG_TYPE {
135
9
  TEXT = 0,
136
10
  IMAGE = 1,
137
11
  FILE = 2,
@@ -143,19 +17,9 @@ export declare enum MSG_TYPE {
143
17
  EMOJI = 8,
144
18
  CUSTOM = 100
145
19
  }
146
- export declare enum SSE_RESPONSE_TYPE {
20
+ export declare enum SseEventType {
147
21
  EVENT_PONG_CONN = 0,
148
22
  EVENT_PONG_RE_CONN = 1,
149
23
  EVENT_PONG_IDLE = 2,
150
24
  EVENT_MESSAGE_PUSH = 3
151
25
  }
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,250 +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
- export type SplitConversationParams = {
14
- offset: number;
15
- count: number;
16
- };
17
- export type GetOneConversationParams = {
18
- sourceID: string;
19
- sessionType: number;
20
- };
21
- export type SetConversationDraftParams = {
22
- conversationID: string;
23
- draftText: string;
24
- };
25
- export type PinConversationParams = {
26
- conversationID: string;
27
- isPinned: boolean;
28
- };
29
- export type SetConversationRecvOptParams = {
30
- conversationID: string;
31
- opt: MessageReceiveOptType;
32
- };
33
- export type SetConversationPrivateParams = {
34
- conversationID: string;
35
- isPrivate: boolean;
36
- };
37
- export type SetBurnDurationParams = {
38
- conversationID: string;
39
- burnDuration: number;
40
- };
41
- export type AccessFriendParams = {
42
- toUserID: string;
43
- handleMsg: string;
44
- };
45
- export type AddBlackParams = {
46
- toUserID: string;
47
- ex?: string;
48
- };
49
- export type SearchFriendParams = {
50
- keywordList: string[];
51
- isSearchUserID: boolean;
52
- isSearchNickname: boolean;
53
- isSearchRemark: boolean;
54
- };
55
- export type RemarkFriendParams = {
56
- toUserID: string;
57
- remark: string;
58
- };
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
6
  export declare type UploadFileParams = {
249
7
  name?: string;
250
8
  contentType?: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sim-sdk-web",
3
- "version": "v1.0.36",
3
+ "version": "v1.0.38",
4
4
  "description": "Sim SDK for Web",
5
5
  "source": "src/index.ts",
6
6
  "main": "lib/index.js",