mezon-js 2.12.95 → 2.12.98

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
@@ -5053,7 +5053,7 @@ export class MezonApi {
5053
5053
  /** Leave a channel the user is a member of. */
5054
5054
  leaveThread(bearerToken: string,
5055
5055
  clanId:string,
5056
- channelId:string,
5056
+ channelId:string,
5057
5057
  options: any = {}): Promise<any> {
5058
5058
 
5059
5059
  if (channelId === null || channelId === undefined) {
@@ -5301,8 +5301,8 @@ export class MezonApi {
5301
5301
 
5302
5302
  /** Delete a channel by ID. */
5303
5303
  deleteChannelDesc(bearerToken: string,
5304
- channelId:string,
5305
- clanId?:string,
5304
+ clanId:string,
5305
+ channelId:string,
5306
5306
  options: any = {}): Promise<any> {
5307
5307
 
5308
5308
  if (channelId === null || channelId === undefined) {
package/client.ts CHANGED
@@ -571,6 +571,15 @@ export class Client {
571
571
  this.apiClient = new MezonApi(serverkey, timeout, basePath);
572
572
  }
573
573
 
574
+ /**
575
+ * Called when a token refresh is initiated.
576
+ * This is a placeholder method that subclasses or instances can override
577
+ * to perform actions before or after the refresh logic.
578
+ */
579
+ onRefreshToken(session: ApiSession): void {
580
+ console.log(`Token refresh occurred. Token: ${session.token}`);
581
+ }
582
+
574
583
  /** check session isexpired */
575
584
  isexpired(session: Session): boolean {
576
585
  return session.isexpired(Date.now() / 1000)
@@ -2086,6 +2095,7 @@ export class Client {
2086
2095
  }
2087
2096
  );
2088
2097
  session.update(apiSession.token!, apiSession.refresh_token!, apiSession.is_remember || false);
2098
+ this.onRefreshToken(apiSession);
2089
2099
  resolve(session);
2090
2100
  } catch (error) {
2091
2101
  console.error("Session refresh failed:", error);
package/dist/api.gen.d.ts CHANGED
@@ -2042,7 +2042,7 @@ export declare class MezonApi {
2042
2042
  /** list user add channel by channel ids */
2043
2043
  listChannelUsersUC(bearerToken: string, channelId?: string, limit?: number, options?: any): Promise<ApiAllUsersAddChannelResponse>;
2044
2044
  /** Delete a channel by ID. */
2045
- deleteChannelDesc(bearerToken: string, channelId: string, clanId?: string, options?: any): Promise<any>;
2045
+ deleteChannelDesc(bearerToken: string, clanId: string, channelId: string, options?: any): Promise<any>;
2046
2046
  /** Update fields in a given channel. */
2047
2047
  updateChannelDesc(bearerToken: string, channelId: string, body: MezonUpdateChannelDescBody, options?: any): Promise<any>;
2048
2048
  /** List channel setting */
package/dist/client.d.ts CHANGED
@@ -330,6 +330,12 @@ export declare class Client {
330
330
  port: string;
331
331
  useSSL: boolean;
332
332
  constructor(serverkey?: string, host?: string, port?: string, useSSL?: boolean, timeout?: number, autoRefreshSession?: boolean);
333
+ /**
334
+ * Called when a token refresh is initiated.
335
+ * This is a placeholder method that subclasses or instances can override
336
+ * to perform actions before or after the refresh logic.
337
+ */
338
+ onRefreshToken(session: ApiSession): void;
333
339
  /** check session isexpired */
334
340
  isexpired(session: Session): boolean;
335
341
  /** Authenticate a user with a custom id against the server. */
@@ -2222,7 +2222,7 @@ var MezonApi = class {
2222
2222
  ]);
2223
2223
  }
2224
2224
  /** Delete a channel by ID. */
2225
- deleteChannelDesc(bearerToken, channelId, clanId, options = {}) {
2225
+ deleteChannelDesc(bearerToken, clanId, channelId, options = {}) {
2226
2226
  if (channelId === null || channelId === void 0) {
2227
2227
  throw new Error("'channelId' is a required parameter but is null or undefined.");
2228
2228
  }
@@ -8333,6 +8333,14 @@ var Client = class {
8333
8333
  const basePath = `${scheme}${host}:${port}`;
8334
8334
  this.apiClient = new MezonApi(serverkey, timeout, basePath);
8335
8335
  }
8336
+ /**
8337
+ * Called when a token refresh is initiated.
8338
+ * This is a placeholder method that subclasses or instances can override
8339
+ * to perform actions before or after the refresh logic.
8340
+ */
8341
+ onRefreshToken(session) {
8342
+ console.log(`Token refresh occurred. Token: ${session.token}`);
8343
+ }
8336
8344
  /** check session isexpired */
8337
8345
  isexpired(session) {
8338
8346
  return session.isexpired(Date.now() / 1e3);
@@ -9289,6 +9297,7 @@ var Client = class {
9289
9297
  }
9290
9298
  );
9291
9299
  session.update(apiSession.token, apiSession.refresh_token, apiSession.is_remember || false);
9300
+ this.onRefreshToken(apiSession);
9292
9301
  resolve(session);
9293
9302
  } catch (error) {
9294
9303
  console.error("Session refresh failed:", error);
@@ -2188,7 +2188,7 @@ var MezonApi = class {
2188
2188
  ]);
2189
2189
  }
2190
2190
  /** Delete a channel by ID. */
2191
- deleteChannelDesc(bearerToken, channelId, clanId, options = {}) {
2191
+ deleteChannelDesc(bearerToken, clanId, channelId, options = {}) {
2192
2192
  if (channelId === null || channelId === void 0) {
2193
2193
  throw new Error("'channelId' is a required parameter but is null or undefined.");
2194
2194
  }
@@ -8299,6 +8299,14 @@ var Client = class {
8299
8299
  const basePath = `${scheme}${host}:${port}`;
8300
8300
  this.apiClient = new MezonApi(serverkey, timeout, basePath);
8301
8301
  }
8302
+ /**
8303
+ * Called when a token refresh is initiated.
8304
+ * This is a placeholder method that subclasses or instances can override
8305
+ * to perform actions before or after the refresh logic.
8306
+ */
8307
+ onRefreshToken(session) {
8308
+ console.log(`Token refresh occurred. Token: ${session.token}`);
8309
+ }
8302
8310
  /** check session isexpired */
8303
8311
  isexpired(session) {
8304
8312
  return session.isexpired(Date.now() / 1e3);
@@ -9255,6 +9263,7 @@ var Client = class {
9255
9263
  }
9256
9264
  );
9257
9265
  session.update(apiSession.token, apiSession.refresh_token, apiSession.is_remember || false);
9266
+ this.onRefreshToken(apiSession);
9258
9267
  resolve(session);
9259
9268
  } catch (error) {
9260
9269
  console.error("Session refresh failed:", error);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mezon-js",
3
- "version": "2.12.95",
3
+ "version": "2.12.98",
4
4
  "scripts": {
5
5
  "build": "npx tsc && npx rollup -c --bundleConfigAsCjs && node build.mjs"
6
6
  },