@etsoo/appscript 1.5.59 → 1.5.60

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.
@@ -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,7 +635,6 @@ 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 apiUrl Signout API URL
635
638
  */
636
639
  signout(): Promise<void>;
637
640
  /**
@@ -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,12 @@ class CoreApp {
1623
1632
  }
1624
1633
  /**
1625
1634
  * Signout, with userLogout and toLoginPage
1626
- * @param apiUrl Signout API URL
1627
1635
  */
1628
1636
  async signout() {
1629
1637
  // Clear the keep login status
1630
1638
  this.keepLogin = false;
1639
+ // Reset all APIs
1640
+ this.resetApis();
1631
1641
  const token = this.getCacheToken();
1632
1642
  if (token) {
1633
1643
  const result = await new AuthApi_1.AuthApi(this).signout({
@@ -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,7 +635,6 @@ 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 apiUrl Signout API URL
635
638
  */
636
639
  signout(): Promise<void>;
637
640
  /**
@@ -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,12 @@ export class CoreApp {
1620
1629
  }
1621
1630
  /**
1622
1631
  * Signout, with userLogout and toLoginPage
1623
- * @param apiUrl Signout API URL
1624
1632
  */
1625
1633
  async signout() {
1626
1634
  // Clear the keep login status
1627
1635
  this.keepLogin = false;
1636
+ // Reset all APIs
1637
+ this.resetApis();
1628
1638
  const token = this.getCacheToken();
1629
1639
  if (token) {
1630
1640
  const result = await new AuthApi(this).signout({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@etsoo/appscript",
3
- "version": "1.5.59",
3
+ "version": "1.5.60",
4
4
  "description": "Applications shared TypeScript framework",
5
5
  "main": "lib/cjs/index.js",
6
6
  "module": "lib/mjs/index.js",
@@ -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,14 @@ export abstract class CoreApp<
2208
2218
 
2209
2219
  /**
2210
2220
  * Signout, with userLogout and toLoginPage
2211
- * @param apiUrl Signout API URL
2212
2221
  */
2213
2222
  async signout() {
2214
2223
  // Clear the keep login status
2215
2224
  this.keepLogin = false;
2216
2225
 
2226
+ // Reset all APIs
2227
+ this.resetApis();
2228
+
2217
2229
  const token = this.getCacheToken();
2218
2230
  if (token) {
2219
2231
  const result = await new AuthApi(this).signout(