easemob-websdk 4.1.6 → 4.1.7-beta
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/CHANGELOG.md +18 -0
- package/Easemob-chat.d.ts +295 -116
- package/Easemob-chat.js +1 -1
- package/chatroom/chatroom.js +1 -1
- package/contact/contact.d.ts +73 -20
- package/contact/contact.js +1 -1
- package/group/group.js +1 -1
- package/message/audio.d.ts +8 -4
- package/message/channel.d.ts +4 -4
- package/message/cmd.d.ts +8 -4
- package/message/custom.d.ts +6 -4
- package/message/delivery.d.ts +4 -4
- package/message/file.d.ts +6 -4
- package/message/img.d.ts +10 -4
- package/message/location.d.ts +6 -4
- package/message/read.d.ts +4 -4
- package/message/text.d.ts +8 -4
- package/message/video.d.ts +8 -4
- package/miniCore/miniCore.js +1 -1
- package/package.json +1 -1
- package/presence/presence.js +1 -1
- package/types/engineCore.d.ts +15 -0
- package/types/indexApi.d.ts +49 -23
- package/types/status.d.ts +6 -0
- package/uniApp/Easemob-chat.js +1 -1
package/package.json
CHANGED
package/presence/presence.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(e,r){"object"==typeof exports&&"object"==typeof module?module.exports=r():"function"==typeof define&&define.amd?define([],r):"object"==typeof exports?exports.websdk=r():e.websdk=r()}(this,(function(){return(this.webpackChunkwebsdk=this.webpackChunkwebsdk||[]).push([[962],{
|
|
1
|
+
!function(e,r){"object"==typeof exports&&"object"==typeof module?module.exports=r():"function"==typeof define&&define.amd?define([],r):"object"==typeof exports?exports.websdk=r():e.websdk=r()}(this,(function(){return(this.webpackChunkwebsdk=this.webpackChunkwebsdk||[]).push([[962],{3770:function(e,r,t){t.r(r),t.d(r,{getPresenceStatus:function(){return y},getSubscribedPresenceList:function(){return f},getSubscribedPresencelist:function(){return d},publishPresence:function(){return l},subscribePresence:function(){return p},unsubscribePresence:function(){return h}}),t(1539),t(8674),t(2526),t(1817),t(2165),t(6992),t(8783),t(3948),t(2222),t(9753);var n=t(4370),s=t(3246),a=t(7252),o=t(5531),c=t(7360),i=function(e,r,t,n){return new(t||(t=Promise))((function(s,a){function o(e){try{i(n.next(e))}catch(e){a(e)}}function c(e){try{i(n.throw(e))}catch(e){a(e)}}function i(e){var r;e.done?s(e.value):(r=e.value,r instanceof t?r:new t((function(e){e(r)}))).then(o,c)}i((n=n.apply(e,r||[])).next())}))},u=function(e,r){var t,n,s,a,o={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]};return a={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function c(a){return function(c){return function(a){if(t)throw new TypeError("Generator is already executing.");for(;o;)try{if(t=1,n&&(s=2&a[0]?n.return:a[0]?n.throw||((s=n.return)&&s.call(n),0):n.next)&&!(s=s.call(n,a[1])).done)return s;switch(n=0,s&&(a=[2&a[0],s.value]),a[0]){case 0:case 1:s=a;break;case 4:return o.label++,{value:a[1],done:!1};case 5:o.label++,n=a[1],a=[0];continue;case 7:a=o.ops.pop(),o.trys.pop();continue;default:if(!((s=(s=o.trys).length>0&&s[s.length-1])||6!==a[0]&&2!==a[0])){o=0;continue}if(3===a[0]&&(!s||a[1]>s[0]&&a[1]<s[3])){o.label=a[1];break}if(6===a[0]&&o.label<s[1]){o.label=s[1],s=a;break}if(s&&o.label<s[2]){o.label=s[2],o.ops.push(a);break}s[2]&&o.ops.pop(),o.trys.pop();continue}a=r.call(e,o)}catch(e){a=[6,e],n=0}finally{t=s=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,c])}}};function l(e){return i(this,void 0,void 0,(function(){var r,t,i,l,p,h,f,d,y;return u(this,(function(u){switch(u.label){case 0:if("string"!=typeof e.description)throw Error('Invalid parameter: "description"');return s.XZ.call(this)?(t=this.context,i=t.accessToken,l=t.orgName,p=t.appName,h=t.userId,f=this.context.jid.clientResource,d={ext:e.description},y={url:"".concat(this.apiUrl,"/").concat(l,"/").concat(p,"/users/").concat(h,"/presence/").concat(f,"/1"),type:"POST",dataType:"json",data:JSON.stringify(d),headers:{Authorization:"Bearer "+i,"Content-Type":"application/json"},success:e.success,error:e.error},c.kg.debug("Call publishPresence:",e),[4,n.hj.call(this,y)]):(r=a.Z.create({type:o.E.REST_PARAMS_STATUS,message:"appkey or token error"}),[2,Promise.reject(r)]);case 1:return u.sent(),[2]}}))}))}function p(e){if(!Array.isArray(e.usernames))throw Error('Invalid parameter: "usernames"');if(!e.usernames.length)throw Error('"usernames" can not be empty');if("number"!=typeof e.expiry)throw Error('Invalid parameter: "expiry"');if(!s.XZ.call(this)){var r=a.Z.create({type:o.E.REST_PARAMS_STATUS,message:"appkey or token error"});return Promise.reject(r)}var t=this.context,i=t.orgName,u=t.appName,l=t.userId,p=t.accessToken,h={usernames:e.usernames},f={url:"".concat(this.apiUrl,"/").concat(i,"/").concat(u,"/users/").concat(l,"/presence/").concat(e.expiry),type:"POST",dataType:"json",data:JSON.stringify(h),headers:{Authorization:"Bearer "+p,"Content-Type":"application/json"},success:e.success,error:e.error};return c.kg.debug("Call subscribePresence:",e),n.hj.call(this,f).then((function(e){return e.data={result:null==e?void 0:e.result},e}))}function h(e){return i(this,void 0,void 0,(function(){var r,t,i,l,p,h,f;return u(this,(function(u){switch(u.label){case 0:if(!Array.isArray(e.usernames))throw Error('Invalid parameter: "usernames"');if(!e.usernames.length)throw Error('"usernames" can not be empty');return s.XZ.call(this)?(t=this.context,i=t.orgName,l=t.appName,p=t.userId,h=t.accessToken,f={url:"".concat(this.apiUrl,"/").concat(i,"/").concat(l,"/users/").concat(p,"/presence"),type:"DELETE",dataType:"json",data:JSON.stringify(e.usernames),headers:{Authorization:"Bearer "+h,"Content-Type":"application/json"},success:e.success,error:e.error},c.kg.debug("Call unsubscribePresence:",e),[4,n.hj.call(this,f)]):(r=a.Z.create({type:o.E.REST_PARAMS_STATUS,message:"appkey or token error"}),[2,Promise.reject(r)]);case 1:return u.sent(),[2]}}))}))}function f(e){if("number"!=typeof e.pageNum||"number"!=typeof e.pageSize)throw Error('Invalid parameter: "pageNum or pageSize"');if(e.pageNum<0||e.pageSize<0)throw Error('"pageNum" should >= 0 and "pageSize" should >= 0');if(!s.XZ.call(this)){var r=a.Z.create({type:o.E.REST_PARAMS_STATUS,message:"appkey or token error"});return Promise.reject(r)}var t=this.context,i=t.orgName,u=t.appName,l=t.userId,p=t.accessToken,h={url:"".concat(this.apiUrl,"/").concat(i,"/").concat(u,"/users/").concat(l,"/presence/sublist?pageNum=").concat(e.pageNum,"&pageSize=").concat(e.pageSize),type:"GET",dataType:"json",headers:{Authorization:"Bearer "+p,"Content-Type":"application/json"},success:e.success,error:e.error};return c.kg.debug("Call getSubscribedPresenceList:",e),n.hj.call(this,h).then((function(e){return e.data={result:null==e?void 0:e.result},e}))}var d=f;function y(e){if(!Array.isArray(e.usernames))throw Error('Invalid parameter: "usernames"');if(!e.usernames.length)throw Error('"usernames" can not be empty');if(!s.XZ.call(this)){var r=a.Z.create({type:o.E.REST_PARAMS_STATUS,message:"appkey or token error"});return Promise.reject(r)}var t={usernames:e.usernames},i=this.context,u=i.orgName,l=i.appName,p=i.userId,h=i.accessToken,f={url:"".concat(this.apiUrl,"/").concat(u,"/").concat(l,"/users/").concat(p,"/presence"),type:"POST",dataType:"json",data:JSON.stringify(t),headers:{Authorization:"Bearer "+h,"Content-Type":"application/json"},success:e.success,error:e.error};return c.kg.debug("Call getPresenceStatus:",e),n.hj.call(this,f).then((function(e){return e.data={result:null==e?void 0:e.result},e}))}},3246:function(e,r,t){t.d(r,{H7:function(){return u},XZ:function(){return c},_W:function(){return i}}),t(7941),t(9554),t(1539),t(4747),t(6699),t(2023);var n=t(5531),s=t(7252);function a(){var e=this.context.appName,r=this.context.orgName;return!(!e||!r)||(this.onError&&this.onError({type:n.E.WEBIM_CONNCTION_AUTH_ERROR,message:"appName or orgName is illegal"}),!1)}function o(){var e;if(!this.context.accessToken){var r=s.Z.create({type:n.E.WEBIM_CONNCTION_TOKEN_NOT_ASSIGN_ERROR,message:"token not assign error"});return this.onError&&this.onError(r),null===(e=this.eventHandler)||void 0===e||e.dispatch("onError",r),!1}return!0}function c(){return o.call(this)&&a.call(this)}function i(e){var r=e.data,t=e.type;return{data:{status:Object.keys(r.errorKeys).length>0?"fail":"success",errorKeys:r.errorKeys,successKeys:r.successKeys},type:t}}function u(e){var r=e.data,t=void 0;return Object.keys(r.errorKeys).length>0&&Object.keys(r.errorKeys).forEach((function(e){var a=r.errorKeys[e];t=a.includes("is not part of you")?s.Z.create({type:n.E.NO_PERMISSION,message:a}):a.includes("size of metadata for this single chatroom exceeds the user defined limit")||a.includes("total size of chatroom metadata for this app exceeds the user defined limit")||a.includes("is exceeding maximum limit")?s.Z.create({type:n.E.MAX_LIMIT,message:a}):a.includes("is not Legal")?s.Z.create({type:n.E.REQUEST_PARAMETER_ERROR,message:a}):a.includes("Failed to update userMetadata. Concurrent updates not allowed")?s.Z.create({type:n.E.OPERATION_NOT_ALLOWED,message:a}):s.Z.create({type:n.E.WEBIM_CONNCTION_AJAX_ERROR,message:a})})),t}}},function(e){return 3770,e(e.s=3770)}])}));
|
package/types/engineCore.d.ts
CHANGED
|
@@ -107,9 +107,23 @@ interface GroupMemberAttributesUpdateMultiDeviceInfo {
|
|
|
107
107
|
/** The user ID of the group member whose custom attributes are set. */
|
|
108
108
|
userId: UserId;
|
|
109
109
|
}
|
|
110
|
+
interface ConversationChangedInfo {
|
|
111
|
+
/** The multi-device conversation event. */
|
|
112
|
+
operation:
|
|
113
|
+
| 'pinnedConversation'
|
|
114
|
+
| 'unpinnedConversation'
|
|
115
|
+
| 'deleteConversation';
|
|
116
|
+
/** The conversation ID. */
|
|
117
|
+
conversationId: string;
|
|
118
|
+
/** The conversation type. */
|
|
119
|
+
conversationType: 'singleChat' | 'groupChat';
|
|
120
|
+
/** The UNIX timestamp of the current operation. The unit is millisecond.*/
|
|
121
|
+
timestamp: number;
|
|
122
|
+
}
|
|
110
123
|
|
|
111
124
|
type MultiDeviceEvent =
|
|
112
125
|
| ThreadMultiDeviceInfo
|
|
126
|
+
| ConversationChangedInfo
|
|
113
127
|
| RoamingDeleteMultiDeviceInfo
|
|
114
128
|
| GroupMemberAttributesUpdateMultiDeviceInfo;
|
|
115
129
|
|
|
@@ -120,4 +134,5 @@ export type {
|
|
|
120
134
|
ThreadMultiDeviceInfo,
|
|
121
135
|
multiDeviceEventType,
|
|
122
136
|
MultiDeviceEvent,
|
|
137
|
+
ConversationChangedInfo,
|
|
123
138
|
};
|
package/types/indexApi.d.ts
CHANGED
|
@@ -3,19 +3,19 @@ import { MessagesType, MessageBody } from './message';
|
|
|
3
3
|
interface UpdateOwnUserInfoParams {
|
|
4
4
|
/** The nickname. */
|
|
5
5
|
nickname?: string;
|
|
6
|
-
/** The avatar
|
|
6
|
+
/** The avatar URL. */
|
|
7
7
|
avatarurl?: string;
|
|
8
|
-
/** The email. */
|
|
8
|
+
/** The email address. */
|
|
9
9
|
mail?: string;
|
|
10
10
|
/** The phone number. */
|
|
11
11
|
phone?: string;
|
|
12
|
-
/** Gender. */
|
|
13
|
-
gender?: string;
|
|
12
|
+
/** Gender. You can define it with the following type: string, number, boolean. */
|
|
13
|
+
gender?: string | number | boolean;
|
|
14
14
|
/** Signature. */
|
|
15
15
|
sign?: string;
|
|
16
16
|
/** Birthday. */
|
|
17
17
|
birth?: string;
|
|
18
|
-
/** Extension. */
|
|
18
|
+
/** Extension. You can define it with the following type: string, number, boolean. */
|
|
19
19
|
ext?: string;
|
|
20
20
|
}
|
|
21
21
|
/** Configurable fields. */
|
|
@@ -38,7 +38,7 @@ interface BaseUserInfo {
|
|
|
38
38
|
activated: boolean;
|
|
39
39
|
/** The timestamp when the current user is created. */
|
|
40
40
|
created: number;
|
|
41
|
-
/** The time when the user information is last
|
|
41
|
+
/** The time when the user information is last modified. */
|
|
42
42
|
modified: number;
|
|
43
43
|
/** The display name in the message push notification. */
|
|
44
44
|
nickname: string;
|
|
@@ -46,7 +46,7 @@ interface BaseUserInfo {
|
|
|
46
46
|
type: string;
|
|
47
47
|
/** The user ID. */
|
|
48
48
|
username: string;
|
|
49
|
-
/** The user uuid on the
|
|
49
|
+
/** The user uuid on the server. */
|
|
50
50
|
uuid: string;
|
|
51
51
|
}
|
|
52
52
|
export interface PushInfo {
|
|
@@ -58,7 +58,7 @@ export interface PushInfo {
|
|
|
58
58
|
notifier_name: string;
|
|
59
59
|
}
|
|
60
60
|
interface UploadTokenResult extends BaseUserInfo {
|
|
61
|
-
/** The push
|
|
61
|
+
/** The push information. */
|
|
62
62
|
pushInfo: PushInfo[];
|
|
63
63
|
}
|
|
64
64
|
interface SessionInfo {
|
|
@@ -90,7 +90,6 @@ interface ConversationList {
|
|
|
90
90
|
}
|
|
91
91
|
interface ConversationInfo {
|
|
92
92
|
/** The conversation list. */
|
|
93
|
-
/** 会话列表。 */
|
|
94
93
|
channel_infos: ConversationList[];
|
|
95
94
|
}
|
|
96
95
|
interface DeleteSessionResult {
|
|
@@ -98,27 +97,52 @@ interface DeleteSessionResult {
|
|
|
98
97
|
result: 'ok';
|
|
99
98
|
}
|
|
100
99
|
interface SendMsgResult {
|
|
101
|
-
/** The
|
|
100
|
+
/** The local ID of the message. */
|
|
102
101
|
localMsgId: string;
|
|
103
|
-
/** The ID
|
|
102
|
+
/** The message ID on the server. */
|
|
104
103
|
serverMsgId: string;
|
|
105
104
|
}
|
|
106
105
|
interface HistoryMessages {
|
|
107
|
-
/**
|
|
106
|
+
/** 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. */
|
|
108
107
|
cursor?: string;
|
|
109
|
-
/** The
|
|
108
|
+
/** The historical messages. */
|
|
110
109
|
messages: MessagesType[];
|
|
110
|
+
/** Whether it is the last page of data.
|
|
111
|
+
* - `true`: Yes;
|
|
112
|
+
* - `false`: No.
|
|
113
|
+
* If the number of data entries is smaller than the message count set in the request, `false` is returned; otherwise, `true` is returned.
|
|
114
|
+
*/
|
|
115
|
+
isLast: boolean;
|
|
111
116
|
}
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
to
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
117
|
+
|
|
118
|
+
interface ServerConversations {
|
|
119
|
+
/** The conversation list. */
|
|
120
|
+
conversations: ConversationItem[];
|
|
121
|
+
/** 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 an empty string (''), 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.*/
|
|
122
|
+
cursor: string;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
interface ConversationItem {
|
|
126
|
+
/** The conversation ID. */
|
|
127
|
+
conversationId: string;
|
|
128
|
+
/** The conversation type. */
|
|
129
|
+
conversationType: 'singleChat' | 'groupChat';
|
|
130
|
+
/** Whether the conversation is pinned. `true`: pinned; `false`: unpinned. */
|
|
131
|
+
isPinned: boolean;
|
|
132
|
+
/** The UNIX timestamp when the conversation is pinned. The unit is millisecond. This value is `0` when conversation is not pinned. */
|
|
133
|
+
pinnedTime: number;
|
|
134
|
+
/** Overview of the latest message. */
|
|
135
|
+
lastMessage: MessageBody | Record<string, never> | null;
|
|
136
|
+
/** The number of unread messages. */
|
|
137
|
+
unReadCount: number;
|
|
138
|
+
}
|
|
139
|
+
interface PinConversation {
|
|
140
|
+
/** Whether the conversation is pinned. `true`: pinned; `false`: unpinned.*/
|
|
141
|
+
isPinned: boolean;
|
|
142
|
+
/** The UNIX timestamp when the conversation is pinned. The unit is millisecond. This value is `0` when the conversation is not pinned. */
|
|
143
|
+
pinnedTime: number;
|
|
121
144
|
}
|
|
145
|
+
|
|
122
146
|
export type {
|
|
123
147
|
UploadTokenResult,
|
|
124
148
|
SessionInfo,
|
|
@@ -126,8 +150,10 @@ export type {
|
|
|
126
150
|
BaseUserInfo,
|
|
127
151
|
DeleteSessionResult,
|
|
128
152
|
SendMsgResult,
|
|
129
|
-
ContactRelationshipMsg,
|
|
130
153
|
ConversationInfo,
|
|
154
|
+
ServerConversations,
|
|
155
|
+
ConversationItem,
|
|
156
|
+
PinConversation,
|
|
131
157
|
};
|
|
132
158
|
export type {
|
|
133
159
|
RosterData,
|
package/types/status.d.ts
CHANGED
|
@@ -257,6 +257,9 @@ declare enum Code {
|
|
|
257
257
|
/** The network is disconnected, causing message sending failure. */
|
|
258
258
|
/** 网络断开连接导致消息发送失败。 */
|
|
259
259
|
MESSAGE_WEBSOCKET_DISCONNECTED = 510,
|
|
260
|
+
/** You have exceeded the maximum allowed size of a message body.*/
|
|
261
|
+
/** 消息体大小超过限制。 */
|
|
262
|
+
MESSAGE_SIZE_LIMIT = 511,
|
|
260
263
|
/** The group is not found. */
|
|
261
264
|
/** 群组不存在。 */
|
|
262
265
|
GROUP_NOT_EXIST = 605,
|
|
@@ -327,5 +330,8 @@ declare enum Code {
|
|
|
327
330
|
/** Chat thread already exists. */
|
|
328
331
|
/** chatThread 已经存在。 */
|
|
329
332
|
THREAD_ALREADY_EXIST = 1301,
|
|
333
|
+
/** The current conversation not exist . */
|
|
334
|
+
/** 操作的用户会话不存在。 */
|
|
335
|
+
CONVERSATION_NOT_EXIST = 1400, //操作的用户会话不存在
|
|
330
336
|
}
|
|
331
337
|
export { Code };
|