@etsoo/appscript 1.6.9 → 1.6.10
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/lib/cjs/app/CoreApp.d.ts +5 -0
- package/lib/cjs/app/CoreApp.js +10 -3
- package/lib/cjs/app/IApp.d.ts +5 -0
- package/lib/mjs/app/CoreApp.d.ts +5 -0
- package/lib/mjs/app/CoreApp.js +10 -3
- package/lib/mjs/app/IApp.d.ts +5 -0
- package/package.json +1 -1
- package/src/app/CoreApp.ts +10 -2
- package/src/app/IApp.ts +6 -0
package/lib/cjs/app/CoreApp.d.ts
CHANGED
|
@@ -676,6 +676,11 @@ export declare abstract class CoreApp<U extends IUser, S extends IAppSettings, N
|
|
|
676
676
|
* @returns Result
|
|
677
677
|
*/
|
|
678
678
|
protected apiRefreshToken(api: IApi, rq: ApiRefreshTokenRQ): Promise<[string, number] | undefined>;
|
|
679
|
+
/**
|
|
680
|
+
* Save refresh token to cache
|
|
681
|
+
* @param token Refresh token
|
|
682
|
+
*/
|
|
683
|
+
saveCacheToken(token: string | undefined): void;
|
|
679
684
|
/**
|
|
680
685
|
* Setup tasks
|
|
681
686
|
*/
|
package/lib/cjs/app/CoreApp.js
CHANGED
|
@@ -738,9 +738,7 @@ class CoreApp {
|
|
|
738
738
|
this.api.authorize(schema, token);
|
|
739
739
|
// Overwrite the current value
|
|
740
740
|
if (refreshToken !== "") {
|
|
741
|
-
|
|
742
|
-
refreshToken = this.encrypt(refreshToken);
|
|
743
|
-
this.storage.setData(this.fields.headerToken, refreshToken);
|
|
741
|
+
this.saveCacheToken(refreshToken);
|
|
744
742
|
}
|
|
745
743
|
// Reset tryLogin state
|
|
746
744
|
this._isTryingLogin = false;
|
|
@@ -1657,6 +1655,15 @@ class CoreApp {
|
|
|
1657
1655
|
// Return the new refresh token and access token expiration seconds
|
|
1658
1656
|
return [data.refreshToken, data.expiresIn];
|
|
1659
1657
|
}
|
|
1658
|
+
/**
|
|
1659
|
+
* Save refresh token to cache
|
|
1660
|
+
* @param token Refresh token
|
|
1661
|
+
*/
|
|
1662
|
+
saveCacheToken(token) {
|
|
1663
|
+
if (token != null)
|
|
1664
|
+
token = this.encrypt(token);
|
|
1665
|
+
this.storage.setData(this.fields.headerToken, token);
|
|
1666
|
+
}
|
|
1660
1667
|
/**
|
|
1661
1668
|
* Setup tasks
|
|
1662
1669
|
*/
|
package/lib/cjs/app/IApp.d.ts
CHANGED
|
@@ -575,6 +575,11 @@ export interface IApp {
|
|
|
575
575
|
* @param callback Callback
|
|
576
576
|
*/
|
|
577
577
|
refreshToken(props?: RefreshTokenProps, callback?: (result?: boolean | IActionResult) => boolean | void): Promise<void>;
|
|
578
|
+
/**
|
|
579
|
+
* Save refresh token to cache
|
|
580
|
+
* @param token Refresh token
|
|
581
|
+
*/
|
|
582
|
+
saveCacheToken(token: string | undefined): void;
|
|
578
583
|
/**
|
|
579
584
|
* Setup Api error handler
|
|
580
585
|
* @param api Api
|
package/lib/mjs/app/CoreApp.d.ts
CHANGED
|
@@ -676,6 +676,11 @@ export declare abstract class CoreApp<U extends IUser, S extends IAppSettings, N
|
|
|
676
676
|
* @returns Result
|
|
677
677
|
*/
|
|
678
678
|
protected apiRefreshToken(api: IApi, rq: ApiRefreshTokenRQ): Promise<[string, number] | undefined>;
|
|
679
|
+
/**
|
|
680
|
+
* Save refresh token to cache
|
|
681
|
+
* @param token Refresh token
|
|
682
|
+
*/
|
|
683
|
+
saveCacheToken(token: string | undefined): void;
|
|
679
684
|
/**
|
|
680
685
|
* Setup tasks
|
|
681
686
|
*/
|
package/lib/mjs/app/CoreApp.js
CHANGED
|
@@ -735,9 +735,7 @@ export class CoreApp {
|
|
|
735
735
|
this.api.authorize(schema, token);
|
|
736
736
|
// Overwrite the current value
|
|
737
737
|
if (refreshToken !== "") {
|
|
738
|
-
|
|
739
|
-
refreshToken = this.encrypt(refreshToken);
|
|
740
|
-
this.storage.setData(this.fields.headerToken, refreshToken);
|
|
738
|
+
this.saveCacheToken(refreshToken);
|
|
741
739
|
}
|
|
742
740
|
// Reset tryLogin state
|
|
743
741
|
this._isTryingLogin = false;
|
|
@@ -1654,6 +1652,15 @@ export class CoreApp {
|
|
|
1654
1652
|
// Return the new refresh token and access token expiration seconds
|
|
1655
1653
|
return [data.refreshToken, data.expiresIn];
|
|
1656
1654
|
}
|
|
1655
|
+
/**
|
|
1656
|
+
* Save refresh token to cache
|
|
1657
|
+
* @param token Refresh token
|
|
1658
|
+
*/
|
|
1659
|
+
saveCacheToken(token) {
|
|
1660
|
+
if (token != null)
|
|
1661
|
+
token = this.encrypt(token);
|
|
1662
|
+
this.storage.setData(this.fields.headerToken, token);
|
|
1663
|
+
}
|
|
1657
1664
|
/**
|
|
1658
1665
|
* Setup tasks
|
|
1659
1666
|
*/
|
package/lib/mjs/app/IApp.d.ts
CHANGED
|
@@ -575,6 +575,11 @@ export interface IApp {
|
|
|
575
575
|
* @param callback Callback
|
|
576
576
|
*/
|
|
577
577
|
refreshToken(props?: RefreshTokenProps, callback?: (result?: boolean | IActionResult) => boolean | void): Promise<void>;
|
|
578
|
+
/**
|
|
579
|
+
* Save refresh token to cache
|
|
580
|
+
* @param token Refresh token
|
|
581
|
+
*/
|
|
582
|
+
saveCacheToken(token: string | undefined): void;
|
|
578
583
|
/**
|
|
579
584
|
* Setup Api error handler
|
|
580
585
|
* @param api Api
|
package/package.json
CHANGED
package/src/app/CoreApp.ts
CHANGED
|
@@ -1120,8 +1120,7 @@ export abstract class CoreApp<
|
|
|
1120
1120
|
|
|
1121
1121
|
// Overwrite the current value
|
|
1122
1122
|
if (refreshToken !== "") {
|
|
1123
|
-
|
|
1124
|
-
this.storage.setData(this.fields.headerToken, refreshToken);
|
|
1123
|
+
this.saveCacheToken(refreshToken);
|
|
1125
1124
|
}
|
|
1126
1125
|
|
|
1127
1126
|
// Reset tryLogin state
|
|
@@ -2222,6 +2221,15 @@ export abstract class CoreApp<
|
|
|
2222
2221
|
return [data.refreshToken, data.expiresIn];
|
|
2223
2222
|
}
|
|
2224
2223
|
|
|
2224
|
+
/**
|
|
2225
|
+
* Save refresh token to cache
|
|
2226
|
+
* @param token Refresh token
|
|
2227
|
+
*/
|
|
2228
|
+
saveCacheToken(token: string | undefined) {
|
|
2229
|
+
if (token != null) token = this.encrypt(token);
|
|
2230
|
+
this.storage.setData(this.fields.headerToken, token);
|
|
2231
|
+
}
|
|
2232
|
+
|
|
2225
2233
|
/**
|
|
2226
2234
|
* Setup tasks
|
|
2227
2235
|
*/
|
package/src/app/IApp.ts
CHANGED
|
@@ -765,6 +765,12 @@ export interface IApp {
|
|
|
765
765
|
callback?: (result?: boolean | IActionResult) => boolean | void
|
|
766
766
|
): Promise<void>;
|
|
767
767
|
|
|
768
|
+
/**
|
|
769
|
+
* Save refresh token to cache
|
|
770
|
+
* @param token Refresh token
|
|
771
|
+
*/
|
|
772
|
+
saveCacheToken(token: string | undefined): void;
|
|
773
|
+
|
|
768
774
|
/**
|
|
769
775
|
* Setup Api error handler
|
|
770
776
|
* @param api Api
|