@etsoo/appscript 1.5.59 → 1.5.61
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 +6 -2
- package/lib/cjs/app/CoreApp.js +17 -4
- package/lib/cjs/app/IApp.d.ts +2 -1
- package/lib/mjs/app/CoreApp.d.ts +6 -2
- package/lib/mjs/app/CoreApp.js +17 -4
- package/lib/mjs/app/IApp.d.ts +2 -1
- package/package.json +1 -1
- package/src/app/CoreApp.ts +19 -4
- package/src/app/IApp.ts +2 -1
package/lib/cjs/app/CoreApp.d.ts
CHANGED
|
@@ -219,6 +219,10 @@ export declare abstract class CoreApp<U extends IUser, S extends IAppSettings, N
|
|
|
219
219
|
* @returns Result
|
|
220
220
|
*/
|
|
221
221
|
createApi(name: string, item: ExternalEndpoint, refresh?: (api: IApi, rq: ApiRefreshTokenRQ) => Promise<[string, number] | undefined>): IApi<any>;
|
|
222
|
+
/**
|
|
223
|
+
* Reset all APIs
|
|
224
|
+
*/
|
|
225
|
+
protected resetApis(): void;
|
|
222
226
|
/**
|
|
223
227
|
* Update API token and expires
|
|
224
228
|
* @param name Api name
|
|
@@ -631,9 +635,9 @@ export declare abstract class CoreApp<U extends IUser, S extends IAppSettings, N
|
|
|
631
635
|
protected setupTasks(): void;
|
|
632
636
|
/**
|
|
633
637
|
* Signout, with userLogout and toLoginPage
|
|
634
|
-
* @param
|
|
638
|
+
* @param action Callback
|
|
635
639
|
*/
|
|
636
|
-
signout(): Promise<void>;
|
|
640
|
+
signout(action?: () => void | boolean): Promise<void>;
|
|
637
641
|
/**
|
|
638
642
|
* Go to the login page
|
|
639
643
|
* @param data Login parameters
|
package/lib/cjs/app/CoreApp.js
CHANGED
|
@@ -376,6 +376,15 @@ class CoreApp {
|
|
|
376
376
|
this.setApi(api, refresh);
|
|
377
377
|
return api;
|
|
378
378
|
}
|
|
379
|
+
/**
|
|
380
|
+
* Reset all APIs
|
|
381
|
+
*/
|
|
382
|
+
resetApis() {
|
|
383
|
+
for (const name in this.apis) {
|
|
384
|
+
const data = this.apis[name];
|
|
385
|
+
this.updateApi(data, undefined, -1);
|
|
386
|
+
}
|
|
387
|
+
}
|
|
379
388
|
updateApi(nameOrData, token, seconds) {
|
|
380
389
|
const api = typeof nameOrData === 'string' ? this.apis[nameOrData] : nameOrData;
|
|
381
390
|
if (api == null)
|
|
@@ -1623,11 +1632,13 @@ class CoreApp {
|
|
|
1623
1632
|
}
|
|
1624
1633
|
/**
|
|
1625
1634
|
* Signout, with userLogout and toLoginPage
|
|
1626
|
-
* @param
|
|
1635
|
+
* @param action Callback
|
|
1627
1636
|
*/
|
|
1628
|
-
async signout() {
|
|
1637
|
+
async signout(action) {
|
|
1629
1638
|
// Clear the keep login status
|
|
1630
1639
|
this.keepLogin = false;
|
|
1640
|
+
// Reset all APIs
|
|
1641
|
+
this.resetApis();
|
|
1631
1642
|
const token = this.getCacheToken();
|
|
1632
1643
|
if (token) {
|
|
1633
1644
|
const result = await new AuthApi_1.AuthApi(this).signout({
|
|
@@ -1646,8 +1657,10 @@ class CoreApp {
|
|
|
1646
1657
|
}
|
|
1647
1658
|
// Clear, noTrigger = true, avoid state update
|
|
1648
1659
|
this.userLogout(true, true);
|
|
1649
|
-
|
|
1650
|
-
|
|
1660
|
+
if (action == null || action() !== false) {
|
|
1661
|
+
// Go to login page
|
|
1662
|
+
this.toLoginPage({ params: { tryLogin: false }, removeUrl: true });
|
|
1663
|
+
}
|
|
1651
1664
|
}
|
|
1652
1665
|
/**
|
|
1653
1666
|
* Go to the login page
|
package/lib/cjs/app/IApp.d.ts
CHANGED
|
@@ -571,8 +571,9 @@ export interface IApp {
|
|
|
571
571
|
setupLogging(action?: (data: ErrorData) => void | Promise<void>, preventDefault?: ((type: ErrorType) => boolean) | boolean): void;
|
|
572
572
|
/**
|
|
573
573
|
* Signout, with userLogout and toLoginPage
|
|
574
|
+
* @param action Callback
|
|
574
575
|
*/
|
|
575
|
-
signout(): Promise<void>;
|
|
576
|
+
signout(action?: () => void | boolean): Promise<void>;
|
|
576
577
|
/**
|
|
577
578
|
* Persist settings to source when application exit
|
|
578
579
|
*/
|
package/lib/mjs/app/CoreApp.d.ts
CHANGED
|
@@ -219,6 +219,10 @@ export declare abstract class CoreApp<U extends IUser, S extends IAppSettings, N
|
|
|
219
219
|
* @returns Result
|
|
220
220
|
*/
|
|
221
221
|
createApi(name: string, item: ExternalEndpoint, refresh?: (api: IApi, rq: ApiRefreshTokenRQ) => Promise<[string, number] | undefined>): IApi<any>;
|
|
222
|
+
/**
|
|
223
|
+
* Reset all APIs
|
|
224
|
+
*/
|
|
225
|
+
protected resetApis(): void;
|
|
222
226
|
/**
|
|
223
227
|
* Update API token and expires
|
|
224
228
|
* @param name Api name
|
|
@@ -631,9 +635,9 @@ export declare abstract class CoreApp<U extends IUser, S extends IAppSettings, N
|
|
|
631
635
|
protected setupTasks(): void;
|
|
632
636
|
/**
|
|
633
637
|
* Signout, with userLogout and toLoginPage
|
|
634
|
-
* @param
|
|
638
|
+
* @param action Callback
|
|
635
639
|
*/
|
|
636
|
-
signout(): Promise<void>;
|
|
640
|
+
signout(action?: () => void | boolean): Promise<void>;
|
|
637
641
|
/**
|
|
638
642
|
* Go to the login page
|
|
639
643
|
* @param data Login parameters
|
package/lib/mjs/app/CoreApp.js
CHANGED
|
@@ -373,6 +373,15 @@ export class CoreApp {
|
|
|
373
373
|
this.setApi(api, refresh);
|
|
374
374
|
return api;
|
|
375
375
|
}
|
|
376
|
+
/**
|
|
377
|
+
* Reset all APIs
|
|
378
|
+
*/
|
|
379
|
+
resetApis() {
|
|
380
|
+
for (const name in this.apis) {
|
|
381
|
+
const data = this.apis[name];
|
|
382
|
+
this.updateApi(data, undefined, -1);
|
|
383
|
+
}
|
|
384
|
+
}
|
|
376
385
|
updateApi(nameOrData, token, seconds) {
|
|
377
386
|
const api = typeof nameOrData === 'string' ? this.apis[nameOrData] : nameOrData;
|
|
378
387
|
if (api == null)
|
|
@@ -1620,11 +1629,13 @@ export class CoreApp {
|
|
|
1620
1629
|
}
|
|
1621
1630
|
/**
|
|
1622
1631
|
* Signout, with userLogout and toLoginPage
|
|
1623
|
-
* @param
|
|
1632
|
+
* @param action Callback
|
|
1624
1633
|
*/
|
|
1625
|
-
async signout() {
|
|
1634
|
+
async signout(action) {
|
|
1626
1635
|
// Clear the keep login status
|
|
1627
1636
|
this.keepLogin = false;
|
|
1637
|
+
// Reset all APIs
|
|
1638
|
+
this.resetApis();
|
|
1628
1639
|
const token = this.getCacheToken();
|
|
1629
1640
|
if (token) {
|
|
1630
1641
|
const result = await new AuthApi(this).signout({
|
|
@@ -1643,8 +1654,10 @@ export class CoreApp {
|
|
|
1643
1654
|
}
|
|
1644
1655
|
// Clear, noTrigger = true, avoid state update
|
|
1645
1656
|
this.userLogout(true, true);
|
|
1646
|
-
|
|
1647
|
-
|
|
1657
|
+
if (action == null || action() !== false) {
|
|
1658
|
+
// Go to login page
|
|
1659
|
+
this.toLoginPage({ params: { tryLogin: false }, removeUrl: true });
|
|
1660
|
+
}
|
|
1648
1661
|
}
|
|
1649
1662
|
/**
|
|
1650
1663
|
* Go to the login page
|
package/lib/mjs/app/IApp.d.ts
CHANGED
|
@@ -571,8 +571,9 @@ export interface IApp {
|
|
|
571
571
|
setupLogging(action?: (data: ErrorData) => void | Promise<void>, preventDefault?: ((type: ErrorType) => boolean) | boolean): void;
|
|
572
572
|
/**
|
|
573
573
|
* Signout, with userLogout and toLoginPage
|
|
574
|
+
* @param action Callback
|
|
574
575
|
*/
|
|
575
|
-
signout(): Promise<void>;
|
|
576
|
+
signout(action?: () => void | boolean): Promise<void>;
|
|
576
577
|
/**
|
|
577
578
|
* Persist settings to source when application exit
|
|
578
579
|
*/
|
package/package.json
CHANGED
package/src/app/CoreApp.ts
CHANGED
|
@@ -620,6 +620,16 @@ export abstract class CoreApp<
|
|
|
620
620
|
return api;
|
|
621
621
|
}
|
|
622
622
|
|
|
623
|
+
/**
|
|
624
|
+
* Reset all APIs
|
|
625
|
+
*/
|
|
626
|
+
protected resetApis() {
|
|
627
|
+
for (const name in this.apis) {
|
|
628
|
+
const data = this.apis[name];
|
|
629
|
+
this.updateApi(data, undefined, -1);
|
|
630
|
+
}
|
|
631
|
+
}
|
|
632
|
+
|
|
623
633
|
/**
|
|
624
634
|
* Update API token and expires
|
|
625
635
|
* @param name Api name
|
|
@@ -2208,12 +2218,15 @@ export abstract class CoreApp<
|
|
|
2208
2218
|
|
|
2209
2219
|
/**
|
|
2210
2220
|
* Signout, with userLogout and toLoginPage
|
|
2211
|
-
* @param
|
|
2221
|
+
* @param action Callback
|
|
2212
2222
|
*/
|
|
2213
|
-
async signout() {
|
|
2223
|
+
async signout(action?: () => void | boolean) {
|
|
2214
2224
|
// Clear the keep login status
|
|
2215
2225
|
this.keepLogin = false;
|
|
2216
2226
|
|
|
2227
|
+
// Reset all APIs
|
|
2228
|
+
this.resetApis();
|
|
2229
|
+
|
|
2217
2230
|
const token = this.getCacheToken();
|
|
2218
2231
|
if (token) {
|
|
2219
2232
|
const result = await new AuthApi(this).signout(
|
|
@@ -2241,8 +2254,10 @@ export abstract class CoreApp<
|
|
|
2241
2254
|
// Clear, noTrigger = true, avoid state update
|
|
2242
2255
|
this.userLogout(true, true);
|
|
2243
2256
|
|
|
2244
|
-
|
|
2245
|
-
|
|
2257
|
+
if (action == null || action() !== false) {
|
|
2258
|
+
// Go to login page
|
|
2259
|
+
this.toLoginPage({ params: { tryLogin: false }, removeUrl: true });
|
|
2260
|
+
}
|
|
2246
2261
|
}
|
|
2247
2262
|
|
|
2248
2263
|
/**
|
package/src/app/IApp.ts
CHANGED
|
@@ -770,8 +770,9 @@ export interface IApp {
|
|
|
770
770
|
|
|
771
771
|
/**
|
|
772
772
|
* Signout, with userLogout and toLoginPage
|
|
773
|
+
* @param action Callback
|
|
773
774
|
*/
|
|
774
|
-
signout(): Promise<void>;
|
|
775
|
+
signout(action?: () => void | boolean): Promise<void>;
|
|
775
776
|
|
|
776
777
|
/**
|
|
777
778
|
* Persist settings to source when application exit
|