@smartbit4all/ng-client 2.0.9 → 2.0.11

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.
@@ -1,13 +1,17 @@
1
- import { HttpEvent, HttpHandler, HttpInterceptor, HttpRequest } from "@angular/common/http";
2
- import { Observable } from "rxjs";
3
- import { SessionError, SmartSessionService } from "./projects";
1
+ import { HttpEvent, HttpHandler, HttpInterceptor, HttpRequest } from '@angular/common/http';
2
+ import { Observable } from 'rxjs';
3
+ import { SessionError, SmartSessionService } from './projects';
4
4
  import * as i0 from "@angular/core";
5
5
  export declare class SmartErrorCatchingInterceptor implements HttpInterceptor {
6
6
  private session;
7
7
  sessionErrorCodes: SessionError[];
8
8
  constructor(session: SmartSessionService);
9
9
  intercept(request: HttpRequest<unknown>, next: HttpHandler): Observable<HttpEvent<unknown>>;
10
- resolveError(sessionError: SessionError): Observable<any>;
10
+ private handleError;
11
+ private isSessionError;
12
+ private getSessionError;
13
+ private resolveError;
14
+ private updateRequestHeaders;
11
15
  static ɵfac: i0.ɵɵFactoryDeclaration<SmartErrorCatchingInterceptor, never>;
12
16
  static ɵprov: i0.ɵɵInjectableDeclaration<SmartErrorCatchingInterceptor>;
13
17
  }
@@ -1,4 +1,14 @@
1
1
  export interface SmartSessionHandlerService {
2
+ /**
3
+ * Handles SessionErrors with RESTART behaviour. With this method it is possible to add application
4
+ * specific logic to the session restart mechanism.
5
+ * E.g.: navigate to the login page when the session can not be refreshed.
6
+ *
7
+ * By default when the session can not be refreshed, the smart-session.service clears and starts a new session.
8
+ * By throwing an exception in this method it is possible to avoid this default functionality,
9
+ * and handle the session recreation completely here in the application level.
10
+ * @param sessionError the SessionError with RESTART behaviour cached in the http interceptor
11
+ */
2
12
  handleSessionError(sessionError: SessionError): Promise<void>;
3
13
  }
4
14
  export interface SessionError {
@@ -44,6 +44,8 @@ export declare class SmartSessionService implements OnDestroy {
44
44
  private startSession;
45
45
  getSession(): Promise<SessionInfoData>;
46
46
  refreshSession(): Promise<SessionInfoData>;
47
+ private updateSessionInfo;
48
+ private isInvalidRefreshTokenError;
47
49
  getAuthenticationProviders(): Promise<Array<AuthenticationProviderData>>;
48
50
  getIsAuthenticated(): Promise<boolean>;
49
51
  clearAndStartNewSession(): Promise<void>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@smartbit4all/ng-client",
3
- "version": "2.0.9",
3
+ "version": "2.0.11",
4
4
  "peerDependencies": {
5
5
  "@angular/common": "^13.2.0",
6
6
  "@angular/core": "^13.2.0",
Binary file