@clairejs/client 3.5.3 → 3.5.5

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/README.md CHANGED
@@ -1,6 +1,10 @@
1
1
  ## Change Log
2
2
 
3
- #### 3.5.3:
3
+ #### 3.5.5:
4
+
5
+ - improve RefreshHttpClient refreshToken
6
+
7
+ #### 3.5.4:
4
8
 
5
9
  - improve crud api cache
6
10
 
@@ -87,7 +87,7 @@ export class CrudApi {
87
87
  }
88
88
  }
89
89
  clearDirty(key) {
90
- this.dirty.delete(key);
90
+ this.dirty.set(key, false);
91
91
  }
92
92
  async getMany(queries, options) {
93
93
  const url = `${this.getEndpointBaseUrl()}?${stringifyQueries(queries || {})}`;
@@ -14,7 +14,7 @@ export declare abstract class RefreshHttpClient extends DefaultHttpClient {
14
14
  private tokenQueue;
15
15
  constructor(apiServerUrl: string, tokenManager: AbstractTokenManager, logger?: LogHandler | undefined, maxRetryCount?: number, delayMsBetweenRetry?: number, storage?: AbstractStorage | undefined);
16
16
  protected getAuthorization(): Promise<string>;
17
- protected abstract refreshSession(refreshToken: string): Promise<AccessToken | undefined>;
17
+ protected abstract refreshSession(token?: AccessToken): Promise<AccessToken | undefined>;
18
18
  protected errorHandler<T = any>(operation: () => Promise<T>, err: any): Promise<T | undefined>;
19
19
  protected getAuthorizationHeader(): Promise<Record<string, string>>;
20
20
  protected refreshToken(token?: AccessToken): Promise<void>;
@@ -48,13 +48,9 @@ export class RefreshHttpClient extends DefaultHttpClient {
48
48
  });
49
49
  }
50
50
  token = token || (await this.tokenManager.getAccessToken());
51
- if (!token || !token.refreshToken) {
52
- //-- there is no refresh token to refresh
53
- throw Errors.SESSION_EXPIRED();
54
- }
55
51
  try {
56
52
  this.refreshing = true;
57
- token = await this.refreshSession(token.refreshToken).catch(() => undefined);
53
+ token = await this.refreshSession(token).catch(() => undefined);
58
54
  if (!token) {
59
55
  throw Errors.SESSION_EXPIRED();
60
56
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@clairejs/client",
3
- "version": "3.5.3",
3
+ "version": "3.5.5",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "type": "module",