mezon-js 2.12.97 → 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/client.ts +10 -0
- package/dist/client.d.ts +6 -0
- package/dist/mezon-js.cjs.js +9 -0
- package/dist/mezon-js.esm.mjs +9 -0
- package/package.json +1 -1
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/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. */
|
package/dist/mezon-js.cjs.js
CHANGED
@@ -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);
|
package/dist/mezon-js.esm.mjs
CHANGED
@@ -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);
|