mezon-js 2.9.41 → 2.9.43
Sign up to get free protection for your applications and to get access to all the features.
- package/client.ts +3 -2
- package/dist/client.d.ts +2 -2
- package/dist/mezon-js.cjs.js +5 -5
- package/dist/mezon-js.esm.mjs +5 -5
- package/dist/socket.d.ts +2 -2
- package/dist/web_socket_adapter.d.ts +2 -2
- package/package.json +1 -1
- package/socket.ts +3 -3
- package/web_socket_adapter.ts +3 -3
package/client.ts
CHANGED
@@ -125,6 +125,7 @@ import {
|
|
125
125
|
ApiEditChannelCanvasRequest,
|
126
126
|
ApiChannelSettingListResponse,
|
127
127
|
ApiAddFavoriteChannelResponse,
|
128
|
+
ApiRegistFcmDeviceTokenResponse,
|
128
129
|
} from "./api.gen";
|
129
130
|
|
130
131
|
import { Session } from "./session";
|
@@ -1838,7 +1839,7 @@ export class Client {
|
|
1838
1839
|
tokenId: string,
|
1839
1840
|
deviceId: string,
|
1840
1841
|
platform: string
|
1841
|
-
): Promise<
|
1842
|
+
): Promise<ApiRegistFcmDeviceTokenResponse> {
|
1842
1843
|
if (
|
1843
1844
|
this.autoRefreshSession &&
|
1844
1845
|
session.refresh_token &&
|
@@ -1850,7 +1851,7 @@ export class Client {
|
|
1850
1851
|
return this.apiClient
|
1851
1852
|
.registFCMDeviceToken(session.token, tokenId, deviceId, platform)
|
1852
1853
|
.then((response: any) => {
|
1853
|
-
return response
|
1854
|
+
return Promise.resolve(response);
|
1854
1855
|
});
|
1855
1856
|
}
|
1856
1857
|
|
package/dist/client.d.ts
CHANGED
@@ -13,7 +13,7 @@
|
|
13
13
|
* See the License for the specific language governing permissions and
|
14
14
|
* limitations under the License.
|
15
15
|
*/
|
16
|
-
import { ApiAccount, ApiAccountCustom, ApiAccountDevice, ApiAccountEmail, ApiAccountFacebook, ApiAccountFacebookInstantGame, ApiAccountGoogle, ApiAccountGameCenter, ApiAccountSteam, ApiChannelDescList, ApiChannelDescription, ApiCreateChannelDescRequest, ApiDeleteRoleRequest, ApiClanDescList, ApiCreateClanDescRequest, ApiClanDesc, ApiCategoryDesc, ApiCategoryDescList, ApiPermissionList, ApiRoleUserList, ApiRole, ApiCreateRoleRequest, ApiAddRoleChannelDescRequest, ApiCreateCategoryDescRequest, ApiUpdateCategoryDescRequest, ApiEvent, ApiUpdateAccountRequest, ApiAccountApple, ApiLinkSteamRequest, ApiClanDescProfile, ApiClanProfile, ApiChannelUserList, ApiClanUserList, ApiLinkInviteUserRequest, ApiUpdateEventRequest, ApiLinkInviteUser, ApiInviteUserRes, ApiUploadAttachmentRequest, ApiUploadAttachment, ApiMessageReaction, ApiMessageMention, ApiMessageAttachment, ApiMessageRef, ApiChannelMessageHeader, ApiVoiceChannelUserList, ApiChannelAttachmentList, ApiCreateEventRequest, ApiEventManagement, ApiEventList, ApiDeleteEventRequest, ApiSetDefaultNotificationRequest, ApiSetNotificationRequest, ApiSetMuteNotificationRequest, ApiSearchMessageRequest, ApiSearchMessageResponse, ApiPinMessageRequest, ApiPinMessagesList, ApiDeleteChannelDescRequest, ApiChangeChannelPrivateRequest, ApiClanEmojiCreateRequest, MezonUpdateClanEmojiByIdBody, ApiWebhookCreateRequest, ApiWebhookListResponse, MezonUpdateWebhookByIdBody, ApiWebhookGenerateResponse, ApiCheckDuplicateClanNameResponse, ApiClanStickerAddRequest, MezonUpdateClanStickerByIdBody, MezonChangeChannelCategoryBody, ApiUpdateRoleChannelRequest, ApiAddAppRequest, ApiAppList, ApiApp, MezonUpdateAppBody, ApiSystemMessagesList, ApiSystemMessage, ApiSystemMessageRequest, MezonUpdateSystemMessageBody, ApiUpdateCategoryOrderRequest, ApiGiveCoffeeEvent, ApiListStreamingChannelsResponse, ApiStreamingChannelUserList, ApiRegisterStreamingChannelRequest, ApiRoleList, ApiListChannelAppsResponse, ApiNotificationChannelCategorySettingList, ApiNotificationUserChannel, ApiNotificationSetting, ApiNotifiReactMessage, ApiHashtagDmList, ApiEmojiListedResponse, ApiStickerListedResponse, ApiAllUsersAddChannelResponse, ApiRoleListEventResponse, ApiAllUserClans, ApiUserPermissionInChannelListResponse, ApiPermissionRoleChannelListEventResponse, ApiMarkAsReadRequest, ApiEditChannelCanvasRequest, ApiChannelSettingListResponse, ApiAddFavoriteChannelResponse } from "./api.gen";
|
16
|
+
import { ApiAccount, ApiAccountCustom, ApiAccountDevice, ApiAccountEmail, ApiAccountFacebook, ApiAccountFacebookInstantGame, ApiAccountGoogle, ApiAccountGameCenter, ApiAccountSteam, ApiChannelDescList, ApiChannelDescription, ApiCreateChannelDescRequest, ApiDeleteRoleRequest, ApiClanDescList, ApiCreateClanDescRequest, ApiClanDesc, ApiCategoryDesc, ApiCategoryDescList, ApiPermissionList, ApiRoleUserList, ApiRole, ApiCreateRoleRequest, ApiAddRoleChannelDescRequest, ApiCreateCategoryDescRequest, ApiUpdateCategoryDescRequest, ApiEvent, ApiUpdateAccountRequest, ApiAccountApple, ApiLinkSteamRequest, ApiClanDescProfile, ApiClanProfile, ApiChannelUserList, ApiClanUserList, ApiLinkInviteUserRequest, ApiUpdateEventRequest, ApiLinkInviteUser, ApiInviteUserRes, ApiUploadAttachmentRequest, ApiUploadAttachment, ApiMessageReaction, ApiMessageMention, ApiMessageAttachment, ApiMessageRef, ApiChannelMessageHeader, ApiVoiceChannelUserList, ApiChannelAttachmentList, ApiCreateEventRequest, ApiEventManagement, ApiEventList, ApiDeleteEventRequest, ApiSetDefaultNotificationRequest, ApiSetNotificationRequest, ApiSetMuteNotificationRequest, ApiSearchMessageRequest, ApiSearchMessageResponse, ApiPinMessageRequest, ApiPinMessagesList, ApiDeleteChannelDescRequest, ApiChangeChannelPrivateRequest, ApiClanEmojiCreateRequest, MezonUpdateClanEmojiByIdBody, ApiWebhookCreateRequest, ApiWebhookListResponse, MezonUpdateWebhookByIdBody, ApiWebhookGenerateResponse, ApiCheckDuplicateClanNameResponse, ApiClanStickerAddRequest, MezonUpdateClanStickerByIdBody, MezonChangeChannelCategoryBody, ApiUpdateRoleChannelRequest, ApiAddAppRequest, ApiAppList, ApiApp, MezonUpdateAppBody, ApiSystemMessagesList, ApiSystemMessage, ApiSystemMessageRequest, MezonUpdateSystemMessageBody, ApiUpdateCategoryOrderRequest, ApiGiveCoffeeEvent, ApiListStreamingChannelsResponse, ApiStreamingChannelUserList, ApiRegisterStreamingChannelRequest, ApiRoleList, ApiListChannelAppsResponse, ApiNotificationChannelCategorySettingList, ApiNotificationUserChannel, ApiNotificationSetting, ApiNotifiReactMessage, ApiHashtagDmList, ApiEmojiListedResponse, ApiStickerListedResponse, ApiAllUsersAddChannelResponse, ApiRoleListEventResponse, ApiAllUserClans, ApiUserPermissionInChannelListResponse, ApiPermissionRoleChannelListEventResponse, ApiMarkAsReadRequest, ApiEditChannelCanvasRequest, ApiChannelSettingListResponse, ApiAddFavoriteChannelResponse, ApiRegistFcmDeviceTokenResponse } from "./api.gen";
|
17
17
|
import { Session } from "./session";
|
18
18
|
import { Socket } from "./socket";
|
19
19
|
import { WebSocketAdapter } from "./web_socket_adapter";
|
@@ -427,7 +427,7 @@ export declare class Client {
|
|
427
427
|
listRolePermissions(session: Session, roleId: string): Promise<ApiPermissionList>;
|
428
428
|
/** List user roles */
|
429
429
|
listRoleUsers(session: Session, roleId: string, limit?: number, cursor?: string): Promise<ApiRoleUserList>;
|
430
|
-
registFCMDeviceToken(session: Session, tokenId: string, deviceId: string, platform: string): Promise<
|
430
|
+
registFCMDeviceToken(session: Session, tokenId: string, deviceId: string, platform: string): Promise<ApiRegistFcmDeviceTokenResponse>;
|
431
431
|
/** Get a clan desc profile */
|
432
432
|
getClanDescProfile(session: Session, clanId: string): Promise<ApiClanDescProfile>;
|
433
433
|
getUserProfileOnClan(session: Session, clanId: string): Promise<ApiClanProfile>;
|
package/dist/mezon-js.cjs.js
CHANGED
@@ -6044,13 +6044,13 @@ var WebSocketAdapterText = class {
|
|
6044
6044
|
var _a;
|
6045
6045
|
return ((_a = this._socket) == null ? void 0 : _a.readyState) == WebSocket.OPEN;
|
6046
6046
|
}
|
6047
|
-
connect(scheme, host, port, createStatus, token, signal) {
|
6047
|
+
connect(scheme, host, port, createStatus, token, platform, signal) {
|
6048
6048
|
if (signal) {
|
6049
6049
|
signal.addEventListener("abort", () => {
|
6050
6050
|
this.close();
|
6051
6051
|
});
|
6052
6052
|
}
|
6053
|
-
const url = `${scheme}${host}:${port}/ws?lang=en&status=${encodeURIComponent(createStatus.toString())}&token=${encodeURIComponent(token)}`;
|
6053
|
+
const url = `${scheme}${host}:${port}/ws?lang=en&status=${encodeURIComponent(createStatus.toString())}&token=${encodeURIComponent(token)}&paltform=${encodeURIComponent(platform)}`;
|
6054
6054
|
this._socket = new WebSocket(url);
|
6055
6055
|
}
|
6056
6056
|
close() {
|
@@ -6093,12 +6093,12 @@ var _DefaultSocket = class _DefaultSocket {
|
|
6093
6093
|
isOpen() {
|
6094
6094
|
return this.adapter.isOpen();
|
6095
6095
|
}
|
6096
|
-
connect(session, createStatus = false, connectTimeoutMs = _DefaultSocket.DefaultConnectTimeoutMs, signal) {
|
6096
|
+
connect(session, createStatus = false, platform = "", connectTimeoutMs = _DefaultSocket.DefaultConnectTimeoutMs, signal) {
|
6097
6097
|
if (this.adapter.isOpen()) {
|
6098
6098
|
return Promise.resolve(session);
|
6099
6099
|
}
|
6100
6100
|
const scheme = this.useSSL ? "wss://" : "ws://";
|
6101
|
-
this.adapter.connect(scheme, this.host, this.port, createStatus, session.token, signal);
|
6101
|
+
this.adapter.connect(scheme, this.host, this.port, createStatus, session.token, platform, signal);
|
6102
6102
|
this.adapter.onClose = (evt) => {
|
6103
6103
|
this.ondisconnect(evt);
|
6104
6104
|
};
|
@@ -7573,7 +7573,7 @@ var Client = class {
|
|
7573
7573
|
yield this.sessionRefresh(session);
|
7574
7574
|
}
|
7575
7575
|
return this.apiClient.registFCMDeviceToken(session.token, tokenId, deviceId, platform).then((response) => {
|
7576
|
-
return response
|
7576
|
+
return Promise.resolve(response);
|
7577
7577
|
});
|
7578
7578
|
});
|
7579
7579
|
}
|
package/dist/mezon-js.esm.mjs
CHANGED
@@ -6015,13 +6015,13 @@ var WebSocketAdapterText = class {
|
|
6015
6015
|
var _a;
|
6016
6016
|
return ((_a = this._socket) == null ? void 0 : _a.readyState) == WebSocket.OPEN;
|
6017
6017
|
}
|
6018
|
-
connect(scheme, host, port, createStatus, token, signal) {
|
6018
|
+
connect(scheme, host, port, createStatus, token, platform, signal) {
|
6019
6019
|
if (signal) {
|
6020
6020
|
signal.addEventListener("abort", () => {
|
6021
6021
|
this.close();
|
6022
6022
|
});
|
6023
6023
|
}
|
6024
|
-
const url = `${scheme}${host}:${port}/ws?lang=en&status=${encodeURIComponent(createStatus.toString())}&token=${encodeURIComponent(token)}`;
|
6024
|
+
const url = `${scheme}${host}:${port}/ws?lang=en&status=${encodeURIComponent(createStatus.toString())}&token=${encodeURIComponent(token)}&paltform=${encodeURIComponent(platform)}`;
|
6025
6025
|
this._socket = new WebSocket(url);
|
6026
6026
|
}
|
6027
6027
|
close() {
|
@@ -6064,12 +6064,12 @@ var _DefaultSocket = class _DefaultSocket {
|
|
6064
6064
|
isOpen() {
|
6065
6065
|
return this.adapter.isOpen();
|
6066
6066
|
}
|
6067
|
-
connect(session, createStatus = false, connectTimeoutMs = _DefaultSocket.DefaultConnectTimeoutMs, signal) {
|
6067
|
+
connect(session, createStatus = false, platform = "", connectTimeoutMs = _DefaultSocket.DefaultConnectTimeoutMs, signal) {
|
6068
6068
|
if (this.adapter.isOpen()) {
|
6069
6069
|
return Promise.resolve(session);
|
6070
6070
|
}
|
6071
6071
|
const scheme = this.useSSL ? "wss://" : "ws://";
|
6072
|
-
this.adapter.connect(scheme, this.host, this.port, createStatus, session.token, signal);
|
6072
|
+
this.adapter.connect(scheme, this.host, this.port, createStatus, session.token, platform, signal);
|
6073
6073
|
this.adapter.onClose = (evt) => {
|
6074
6074
|
this.ondisconnect(evt);
|
6075
6075
|
};
|
@@ -7544,7 +7544,7 @@ var Client = class {
|
|
7544
7544
|
yield this.sessionRefresh(session);
|
7545
7545
|
}
|
7546
7546
|
return this.apiClient.registFCMDeviceToken(session.token, tokenId, deviceId, platform).then((response) => {
|
7547
|
-
return response
|
7547
|
+
return Promise.resolve(response);
|
7548
7548
|
});
|
7549
7549
|
});
|
7550
7550
|
}
|
package/dist/socket.d.ts
CHANGED
@@ -574,7 +574,7 @@ export interface Socket {
|
|
574
574
|
/** Connection is Open */
|
575
575
|
isOpen(): boolean;
|
576
576
|
/** Connect to the server. */
|
577
|
-
connect(session: Session, createStatus: boolean, connectTimeoutMs?: number, signal?: AbortSignal): Promise<Session>;
|
577
|
+
connect(session: Session, createStatus: boolean, platform: string, connectTimeoutMs?: number, signal?: AbortSignal): Promise<Session>;
|
578
578
|
/** Disconnect from the server. */
|
579
579
|
disconnect(fireDisconnectEvent: boolean): void;
|
580
580
|
/** Subscribe to one or more users for their status updates. */
|
@@ -704,7 +704,7 @@ export declare class DefaultSocket implements Socket {
|
|
704
704
|
constructor(host: string, port: string, useSSL?: boolean, verbose?: boolean, adapter?: WebSocketAdapter, sendTimeoutMs?: number);
|
705
705
|
generatecid(): string;
|
706
706
|
isOpen(): boolean;
|
707
|
-
connect(session: Session, createStatus?: boolean, connectTimeoutMs?: number, signal?: AbortSignal): Promise<Session>;
|
707
|
+
connect(session: Session, createStatus?: boolean, platform?: string, connectTimeoutMs?: number, signal?: AbortSignal): Promise<Session>;
|
708
708
|
disconnect(fireDisconnectEvent?: boolean): void;
|
709
709
|
setHeartbeatTimeoutMs(ms: number): void;
|
710
710
|
getHeartbeatTimeoutMs(): number;
|
@@ -35,7 +35,7 @@ export interface WebSocketAdapter {
|
|
35
35
|
onOpen: SocketOpenHandler | null;
|
36
36
|
isOpen(): boolean;
|
37
37
|
close(): void;
|
38
|
-
connect(scheme: string, host: string, port: string, createStatus: boolean, token: string, signal?: AbortSignal): void;
|
38
|
+
connect(scheme: string, host: string, port: string, createStatus: boolean, token: string, platform: string, signal?: AbortSignal): void;
|
39
39
|
send(message: any): void;
|
40
40
|
}
|
41
41
|
/**
|
@@ -77,7 +77,7 @@ export declare class WebSocketAdapterText implements WebSocketAdapter {
|
|
77
77
|
get onOpen(): SocketOpenHandler | null;
|
78
78
|
set onOpen(value: SocketOpenHandler | null);
|
79
79
|
isOpen(): boolean;
|
80
|
-
connect(scheme: string, host: string, port: string, createStatus: boolean, token: string, signal?: AbortSignal): void;
|
80
|
+
connect(scheme: string, host: string, port: string, createStatus: boolean, token: string, platform: string, signal?: AbortSignal): void;
|
81
81
|
close(): void;
|
82
82
|
send(msg: any): void;
|
83
83
|
}
|
package/package.json
CHANGED
package/socket.ts
CHANGED
@@ -801,7 +801,7 @@ export interface Socket {
|
|
801
801
|
isOpen(): boolean;
|
802
802
|
|
803
803
|
/** Connect to the server. */
|
804
|
-
connect(session: Session, createStatus: boolean, connectTimeoutMs?: number, signal?: AbortSignal): Promise<Session>;
|
804
|
+
connect(session: Session, createStatus: boolean, platform: string, connectTimeoutMs?: number, signal?: AbortSignal): Promise<Session>;
|
805
805
|
|
806
806
|
/** Disconnect from the server. */
|
807
807
|
disconnect(fireDisconnectEvent: boolean): void;
|
@@ -1029,13 +1029,13 @@ export class DefaultSocket implements Socket {
|
|
1029
1029
|
return this.adapter.isOpen();
|
1030
1030
|
}
|
1031
1031
|
|
1032
|
-
connect(session: Session, createStatus: boolean = false, connectTimeoutMs: number = DefaultSocket.DefaultConnectTimeoutMs, signal?: AbortSignal): Promise<Session> {
|
1032
|
+
connect(session: Session, createStatus: boolean = false, platform: string = "", connectTimeoutMs: number = DefaultSocket.DefaultConnectTimeoutMs, signal?: AbortSignal): Promise<Session> {
|
1033
1033
|
if (this.adapter.isOpen()) {
|
1034
1034
|
return Promise.resolve(session);
|
1035
1035
|
}
|
1036
1036
|
|
1037
1037
|
const scheme = (this.useSSL) ? "wss://" : "ws://";
|
1038
|
-
this.adapter.connect(scheme, this.host, this.port, createStatus, session.token, signal);
|
1038
|
+
this.adapter.connect(scheme, this.host, this.port, createStatus, session.token, platform, signal);
|
1039
1039
|
|
1040
1040
|
this.adapter.onClose = (evt: Event) => {
|
1041
1041
|
this.ondisconnect(evt);
|
package/web_socket_adapter.ts
CHANGED
@@ -44,7 +44,7 @@ export interface WebSocketAdapter {
|
|
44
44
|
|
45
45
|
isOpen(): boolean;
|
46
46
|
close(): void;
|
47
|
-
connect(scheme: string, host: string, port: string, createStatus: boolean, token: string, signal?: AbortSignal): void;
|
47
|
+
connect(scheme: string, host: string, port: string, createStatus: boolean, token: string, platform: string, signal?: AbortSignal): void;
|
48
48
|
send(message: any): void;
|
49
49
|
}
|
50
50
|
|
@@ -131,13 +131,13 @@ export class WebSocketAdapterText implements WebSocketAdapter {
|
|
131
131
|
return this._socket?.readyState == WebSocket.OPEN;
|
132
132
|
}
|
133
133
|
|
134
|
-
connect(scheme: string, host: string, port: string, createStatus: boolean, token: string, signal?: AbortSignal): void {
|
134
|
+
connect(scheme: string, host: string, port: string, createStatus: boolean, token: string, platform: string, signal?: AbortSignal): void {
|
135
135
|
if (signal) {
|
136
136
|
signal.addEventListener('abort', () => {
|
137
137
|
this.close();
|
138
138
|
});
|
139
139
|
}
|
140
|
-
const url = `${scheme}${host}:${port}/ws?lang=en&status=${encodeURIComponent(createStatus.toString())}&token=${encodeURIComponent(token)}`;
|
140
|
+
const url = `${scheme}${host}:${port}/ws?lang=en&status=${encodeURIComponent(createStatus.toString())}&token=${encodeURIComponent(token)}&paltform=${encodeURIComponent(platform)}`;
|
141
141
|
this._socket = new WebSocket(url);
|
142
142
|
}
|
143
143
|
|