mezon-js 2.9.55 → 2.9.56

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/api.gen.ts CHANGED
@@ -81,10 +81,12 @@ export interface ApiAddAppRequest {
81
81
  appname?: string;
82
82
  //Creator of the app.
83
83
  creator_id?: string;
84
- //
84
+ //Role of this app.
85
85
  role?: ApiAppRole;
86
86
  //The password.
87
87
  token?: string;
88
+ //Is shadow.
89
+ is_shadow?: boolean;
88
90
  }
89
91
 
90
92
  /**
@@ -2879,39 +2881,6 @@ export class MezonApi {
2879
2881
  ]);
2880
2882
  }
2881
2883
 
2882
- /** */
2883
- getInfoLoginRequest(bearerToken: string,
2884
- loginId?:string,
2885
- options: any = {}): Promise<ApiLoginIDResponse> {
2886
-
2887
- const urlPath = "/v2/account/authenticate/getinfologin";
2888
- const queryParams = new Map<string, any>();
2889
- queryParams.set("login_id", loginId);
2890
-
2891
- let bodyJson : string = "";
2892
-
2893
- const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
2894
- const fetchOptions = buildFetchOptions("GET", options, bodyJson);
2895
- if (bearerToken) {
2896
- fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
2897
- }
2898
-
2899
- return Promise.race([
2900
- fetch(fullUrl, fetchOptions).then((response) => {
2901
- if (response.status == 204) {
2902
- return response;
2903
- } else if (response.status >= 200 && response.status < 300) {
2904
- return response.json();
2905
- } else {
2906
- throw response;
2907
- }
2908
- }),
2909
- new Promise((_, reject) =>
2910
- setTimeout(reject, this.timeoutMs, "Request timed out.")
2911
- ),
2912
- ]);
2913
- }
2914
-
2915
2884
  /** Authenticate a user with Google against the server. */
2916
2885
  authenticateGoogle(
2917
2886
  basicAuthUsername: string,
package/client.ts CHANGED
@@ -4229,14 +4229,21 @@ export class Client {
4229
4229
  return response
4230
4230
  }
4231
4231
 
4232
- async checkLoginRequest(requet: ApiConfirmLoginRequest): Promise<ApiSession> {
4232
+ async checkLoginRequest(requet: ApiConfirmLoginRequest): Promise<Session | null> {
4233
4233
  const apiSession = await this.apiClient.checkLoginRequest(
4234
4234
  this.serverkey,
4235
4235
  "",
4236
4236
  requet
4237
4237
  );
4238
+ if (!apiSession?.token) {
4239
+ return null
4240
+ }
4241
+ return new Session(
4242
+ apiSession.token || "",
4243
+ apiSession.refresh_token || "",
4244
+ apiSession.created || false
4245
+ );
4238
4246
 
4239
- return apiSession
4240
4247
  }
4241
4248
 
4242
4249
  async confirmLogin(
@@ -4257,23 +4264,4 @@ export class Client {
4257
4264
  return response;
4258
4265
  });
4259
4266
  }
4260
-
4261
- async getInfoLoginRequest(
4262
- session: Session,
4263
- loginId: string
4264
- ): Promise<any> {
4265
- if (
4266
- this.autoRefreshSession &&
4267
- session.refresh_token &&
4268
- session.isexpired((Date.now() + this.expiredTimespanMs) / 1000)
4269
- ) {
4270
- await this.sessionRefresh(session);
4271
- }
4272
-
4273
- return this.apiClient
4274
- .getInfoLoginRequest(session.token, loginId)
4275
- .then((response: any) => {
4276
- return response;
4277
- });
4278
- }
4279
4267
  }
package/dist/api.gen.d.ts CHANGED
@@ -47,6 +47,7 @@ export interface ApiAddAppRequest {
47
47
  creator_id?: string;
48
48
  role?: ApiAppRole;
49
49
  token?: string;
50
+ is_shadow?: boolean;
50
51
  }
51
52
  /**
52
53
  * - USER_ROLE_ADMIN: All access
@@ -1383,8 +1384,6 @@ export declare class MezonApi {
1383
1384
  authenticateFacebookInstantGame(basicAuthUsername: string, basicAuthPassword: string, account: ApiAccountFacebookInstantGame, create?: boolean, username?: string, options?: any): Promise<ApiSession>;
1384
1385
  /** Authenticate a user with Apple's GameCenter against the server. */
1385
1386
  authenticateGameCenter(basicAuthUsername: string, basicAuthPassword: string, account: ApiAccountGameCenter, create?: boolean, username?: string, options?: any): Promise<ApiSession>;
1386
- /** */
1387
- getInfoLoginRequest(bearerToken: string, loginId?: string, options?: any): Promise<ApiLoginIDResponse>;
1388
1387
  /** Authenticate a user with Google against the server. */
1389
1388
  authenticateGoogle(basicAuthUsername: string, basicAuthPassword: string, account: ApiAccountGoogle, create?: boolean, username?: string, options?: any): Promise<ApiSession>;
1390
1389
  /** Authenticate a user with Steam against the server. */
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, ApiSession, 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, ApiListUserActivity, ApiCreateActivityRequest, ApiLoginIDResponse, ApiLoginRequest, ApiConfirmLoginRequest, ApiUserActivity } 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, ApiListUserActivity, ApiCreateActivityRequest, ApiLoginIDResponse, ApiLoginRequest, ApiConfirmLoginRequest, ApiUserActivity } from "./api.gen";
17
17
  import { Session } from "./session";
18
18
  import { Socket } from "./socket";
19
19
  import { WebSocketAdapter } from "./web_socket_adapter";
@@ -595,7 +595,6 @@ export declare class Client {
595
595
  listActivity(session: Session): Promise<ApiListUserActivity>;
596
596
  createActiviy(session: Session, request: ApiCreateActivityRequest): Promise<ApiUserActivity>;
597
597
  createQRLogin(requet: ApiLoginRequest): Promise<ApiLoginIDResponse>;
598
- checkLoginRequest(requet: ApiConfirmLoginRequest): Promise<ApiSession>;
598
+ checkLoginRequest(requet: ApiConfirmLoginRequest): Promise<Session | null>;
599
599
  confirmLogin(session: Session, body: ApiConfirmLoginRequest): Promise<any>;
600
- getInfoLoginRequest(session: Session, loginId: string): Promise<any>;
601
600
  }
@@ -1111,32 +1111,6 @@ var MezonApi = class {
1111
1111
  )
1112
1112
  ]);
1113
1113
  }
1114
- /** */
1115
- getInfoLoginRequest(bearerToken, loginId, options = {}) {
1116
- const urlPath = "/v2/account/authenticate/getinfologin";
1117
- const queryParams = /* @__PURE__ */ new Map();
1118
- queryParams.set("login_id", loginId);
1119
- let bodyJson = "";
1120
- const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
1121
- const fetchOptions = buildFetchOptions("GET", options, bodyJson);
1122
- if (bearerToken) {
1123
- fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
1124
- }
1125
- return Promise.race([
1126
- fetch(fullUrl, fetchOptions).then((response) => {
1127
- if (response.status == 204) {
1128
- return response;
1129
- } else if (response.status >= 200 && response.status < 300) {
1130
- return response.json();
1131
- } else {
1132
- throw response;
1133
- }
1134
- }),
1135
- new Promise(
1136
- (_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
1137
- )
1138
- ]);
1139
- }
1140
1114
  /** Authenticate a user with Google against the server. */
1141
1115
  authenticateGoogle(basicAuthUsername, basicAuthPassword, account, create, username, options = {}) {
1142
1116
  if (account === null || account === void 0) {
@@ -9100,7 +9074,14 @@ var Client = class {
9100
9074
  "",
9101
9075
  requet
9102
9076
  );
9103
- return apiSession;
9077
+ if (!(apiSession == null ? void 0 : apiSession.token)) {
9078
+ return null;
9079
+ }
9080
+ return new Session(
9081
+ apiSession.token || "",
9082
+ apiSession.refresh_token || "",
9083
+ apiSession.created || false
9084
+ );
9104
9085
  });
9105
9086
  }
9106
9087
  confirmLogin(session, body) {
@@ -9113,14 +9094,4 @@ var Client = class {
9113
9094
  });
9114
9095
  });
9115
9096
  }
9116
- getInfoLoginRequest(session, loginId) {
9117
- return __async(this, null, function* () {
9118
- if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
9119
- yield this.sessionRefresh(session);
9120
- }
9121
- return this.apiClient.getInfoLoginRequest(session.token, loginId).then((response) => {
9122
- return response;
9123
- });
9124
- });
9125
- }
9126
9097
  };
@@ -1082,32 +1082,6 @@ var MezonApi = class {
1082
1082
  )
1083
1083
  ]);
1084
1084
  }
1085
- /** */
1086
- getInfoLoginRequest(bearerToken, loginId, options = {}) {
1087
- const urlPath = "/v2/account/authenticate/getinfologin";
1088
- const queryParams = /* @__PURE__ */ new Map();
1089
- queryParams.set("login_id", loginId);
1090
- let bodyJson = "";
1091
- const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
1092
- const fetchOptions = buildFetchOptions("GET", options, bodyJson);
1093
- if (bearerToken) {
1094
- fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
1095
- }
1096
- return Promise.race([
1097
- fetch(fullUrl, fetchOptions).then((response) => {
1098
- if (response.status == 204) {
1099
- return response;
1100
- } else if (response.status >= 200 && response.status < 300) {
1101
- return response.json();
1102
- } else {
1103
- throw response;
1104
- }
1105
- }),
1106
- new Promise(
1107
- (_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
1108
- )
1109
- ]);
1110
- }
1111
1085
  /** Authenticate a user with Google against the server. */
1112
1086
  authenticateGoogle(basicAuthUsername, basicAuthPassword, account, create, username, options = {}) {
1113
1087
  if (account === null || account === void 0) {
@@ -9071,7 +9045,14 @@ var Client = class {
9071
9045
  "",
9072
9046
  requet
9073
9047
  );
9074
- return apiSession;
9048
+ if (!(apiSession == null ? void 0 : apiSession.token)) {
9049
+ return null;
9050
+ }
9051
+ return new Session(
9052
+ apiSession.token || "",
9053
+ apiSession.refresh_token || "",
9054
+ apiSession.created || false
9055
+ );
9075
9056
  });
9076
9057
  }
9077
9058
  confirmLogin(session, body) {
@@ -9084,16 +9065,6 @@ var Client = class {
9084
9065
  });
9085
9066
  });
9086
9067
  }
9087
- getInfoLoginRequest(session, loginId) {
9088
- return __async(this, null, function* () {
9089
- if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
9090
- yield this.sessionRefresh(session);
9091
- }
9092
- return this.apiClient.getInfoLoginRequest(session.token, loginId).then((response) => {
9093
- return response;
9094
- });
9095
- });
9096
- }
9097
9068
  };
9098
9069
  export {
9099
9070
  ChannelStreamMode,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "mezon-js",
3
3
 
4
- "version": "2.9.55",
4
+ "version": "2.9.56",
5
5
 
6
6
  "scripts": {
7
7
  "build": "npx tsc && npx rollup -c --bundleConfigAsCjs && node build.mjs"