@daffodil/auth 0.48.2 → 0.50.0
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/esm2020/driver/magento/apollo-bearer-token-link-generator.mjs +6 -2
- package/esm2020/state/actions/auth.actions.mjs +11 -1
- package/esm2020/state/auth-state.module.mjs +10 -4
- package/esm2020/state/config/default.mjs +3 -1
- package/esm2020/state/config/type.mjs +1 -1
- package/esm2020/state/effects/auth.effects.mjs +3 -3
- package/esm2020/state/effects/login.effects.mjs +4 -4
- package/esm2020/state/effects/redirect.effects.mjs +35 -0
- package/esm2020/state/facades/auth/facade.interface.mjs +1 -1
- package/esm2020/state/facades/auth/facade.mjs +3 -2
- package/esm2020/state/reducers/auth/auth-initial-state.mjs +2 -1
- package/esm2020/state/reducers/auth/auth-reducer-state.interface.mjs +1 -1
- package/esm2020/state/reducers/auth/auth.reducer.mjs +18 -1
- package/esm2020/state/selectors/auth/auth.selector.mjs +3 -1
- package/esm2020/state/testing/mock-auth-facade.mjs +2 -1
- package/fesm2015/daffodil-auth-driver-magento.mjs +5 -1
- package/fesm2015/daffodil-auth-driver-magento.mjs.map +1 -1
- package/fesm2015/daffodil-auth-state-testing.mjs +1 -0
- package/fesm2015/daffodil-auth-state-testing.mjs.map +1 -1
- package/fesm2015/daffodil-auth-state.mjs +58 -7
- package/fesm2015/daffodil-auth-state.mjs.map +1 -1
- package/fesm2020/daffodil-auth-driver-magento.mjs +5 -1
- package/fesm2020/daffodil-auth-driver-magento.mjs.map +1 -1
- package/fesm2020/daffodil-auth-state-testing.mjs +1 -0
- package/fesm2020/daffodil-auth-state-testing.mjs.map +1 -1
- package/fesm2020/daffodil-auth-state.mjs +70 -6
- package/fesm2020/daffodil-auth-state.mjs.map +1 -1
- package/package.json +3 -3
- package/state/actions/auth.actions.d.ts +10 -2
- package/state/auth-state.module.d.ts +1 -1
- package/state/config/type.d.ts +10 -0
- package/state/effects/auth.effects.d.ts +2 -2
- package/state/effects/login.effects.d.ts +2 -2
- package/state/effects/redirect.effects.d.ts +17 -0
- package/state/facades/auth/facade.d.ts +4 -4
- package/state/facades/auth/facade.interface.d.ts +4 -0
- package/state/reducers/auth/auth-reducer-state.interface.d.ts +1 -0
- package/state/selectors/auth/auth.selector.d.ts +2 -2
- package/state/testing/mock-auth-facade.d.ts +1 -0
package/state/config/type.d.ts
CHANGED
|
@@ -4,4 +4,14 @@ export interface DaffAuthStateConfig {
|
|
|
4
4
|
* Defaults to twenty minutes.
|
|
5
5
|
*/
|
|
6
6
|
checkInterval: number;
|
|
7
|
+
/**
|
|
8
|
+
* The path to which the user will be redirected when they are logged in and the auth token is stored.
|
|
9
|
+
* Defaults to `'/'`.
|
|
10
|
+
*/
|
|
11
|
+
authCompleteRedirectPath: string;
|
|
12
|
+
/**
|
|
13
|
+
* The path to which the user will be redirected when they are logged out.
|
|
14
|
+
* Defaults to `'/'`.
|
|
15
|
+
*/
|
|
16
|
+
logoutRedirectPath: string;
|
|
7
17
|
}
|
|
@@ -3,7 +3,7 @@ import { Observable } from 'rxjs';
|
|
|
3
3
|
import { DaffAuthStorageService } from '@daffodil/auth';
|
|
4
4
|
import { DaffAuthServiceInterface } from '@daffodil/auth/driver';
|
|
5
5
|
import { ErrorTransformer } from '@daffodil/core/state';
|
|
6
|
-
import { DaffAuthCheckSuccess, DaffAuthCheckFailure, DaffAuthCheck, DaffAuthGuardCheckCompletion, DaffAuthStorageFailure, DaffAuthServerSide } from '../actions/public_api';
|
|
6
|
+
import { DaffAuthCheckSuccess, DaffAuthCheckFailure, DaffAuthCheck, DaffAuthGuardCheckCompletion, DaffAuthStorageFailure, DaffAuthServerSide, DaffAuthRevoke } from '../actions/public_api';
|
|
7
7
|
import { DaffAuthStateConfig } from '../config/public_api';
|
|
8
8
|
import * as i0 from "@angular/core";
|
|
9
9
|
export declare class DaffAuthEffects {
|
|
@@ -15,7 +15,7 @@ export declare class DaffAuthEffects {
|
|
|
15
15
|
constructor(actions$: Actions, authDriver: DaffAuthServiceInterface, errorMatcher: ErrorTransformer, storage: DaffAuthStorageService, config: DaffAuthStateConfig);
|
|
16
16
|
check$: Observable<DaffAuthCheckSuccess | DaffAuthCheckFailure> & import("@ngrx/effects").CreateEffectMetadata;
|
|
17
17
|
guardCheck$: Observable<DaffAuthGuardCheckCompletion> & import("@ngrx/effects").CreateEffectMetadata;
|
|
18
|
-
removeAuthToken$: Observable<DaffAuthStorageFailure | DaffAuthServerSide> & import("@ngrx/effects").CreateEffectMetadata;
|
|
18
|
+
removeAuthToken$: Observable<DaffAuthStorageFailure | DaffAuthServerSide | DaffAuthRevoke> & import("@ngrx/effects").CreateEffectMetadata;
|
|
19
19
|
authCheckInterval$: Observable<DaffAuthStorageFailure | DaffAuthServerSide | DaffAuthCheck> & import("@ngrx/effects").CreateEffectMetadata;
|
|
20
20
|
static ɵfac: i0.ɵɵFactoryDeclaration<DaffAuthEffects, never>;
|
|
21
21
|
static ɵprov: i0.ɵɵInjectableDeclaration<DaffAuthEffects>;
|
|
@@ -3,7 +3,7 @@ import { Observable } from 'rxjs';
|
|
|
3
3
|
import { DaffLoginInfo, DaffAuthToken, DaffAuthStorageService } from '@daffodil/auth';
|
|
4
4
|
import { DaffLoginServiceInterface } from '@daffodil/auth/driver';
|
|
5
5
|
import { ErrorTransformer } from '@daffodil/core/state';
|
|
6
|
-
import { DaffAuthLoginSuccess, DaffAuthLoginFailure, DaffAuthLogoutSuccess, DaffAuthLogoutFailure, DaffAuthStorageFailure, DaffAuthComplete, DaffAuthServerSide } from '../actions/public_api';
|
|
6
|
+
import { DaffAuthLoginSuccess, DaffAuthLoginFailure, DaffAuthLogoutSuccess, DaffAuthLogoutFailure, DaffAuthStorageFailure, DaffAuthComplete, DaffAuthServerSide, DaffAuthRevoke } from '../actions/public_api';
|
|
7
7
|
import * as i0 from "@angular/core";
|
|
8
8
|
export declare class DaffAuthLoginEffects<T extends DaffLoginInfo = DaffLoginInfo, U extends DaffAuthToken = DaffAuthToken> {
|
|
9
9
|
private actions$;
|
|
@@ -13,7 +13,7 @@ export declare class DaffAuthLoginEffects<T extends DaffLoginInfo = DaffLoginInf
|
|
|
13
13
|
constructor(actions$: Actions, loginDriver: DaffLoginServiceInterface<T, U>, errorMatcher: ErrorTransformer, storage: DaffAuthStorageService);
|
|
14
14
|
login$: Observable<DaffAuthLoginFailure | DaffAuthLoginSuccess<U>> & import("@ngrx/effects").CreateEffectMetadata;
|
|
15
15
|
logout$: Observable<DaffAuthLogoutSuccess | DaffAuthLogoutFailure> & import("@ngrx/effects").CreateEffectMetadata;
|
|
16
|
-
removeAuthToken$: Observable<DaffAuthStorageFailure | DaffAuthServerSide> & import("@ngrx/effects").CreateEffectMetadata;
|
|
16
|
+
removeAuthToken$: Observable<DaffAuthStorageFailure | DaffAuthServerSide | DaffAuthRevoke> & import("@ngrx/effects").CreateEffectMetadata;
|
|
17
17
|
storeAuthToken$: Observable<DaffAuthStorageFailure | DaffAuthServerSide | DaffAuthComplete> & import("@ngrx/effects").CreateEffectMetadata;
|
|
18
18
|
static ɵfac: i0.ɵɵFactoryDeclaration<DaffAuthLoginEffects<any, any>, never>;
|
|
19
19
|
static ɵprov: i0.ɵɵInjectableDeclaration<DaffAuthLoginEffects<any, any>>;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Router } from '@angular/router';
|
|
2
|
+
import { Actions } from '@ngrx/effects';
|
|
3
|
+
import { DaffAuthStateConfig } from '../config/public_api';
|
|
4
|
+
import * as i0 from "@angular/core";
|
|
5
|
+
/**
|
|
6
|
+
* Redirects the user to certain pages based on certain auth actions.
|
|
7
|
+
*/
|
|
8
|
+
export declare class DaffAuthRedirectEffects {
|
|
9
|
+
private actions$;
|
|
10
|
+
private router;
|
|
11
|
+
private config;
|
|
12
|
+
constructor(actions$: Actions, router: Router, config: DaffAuthStateConfig);
|
|
13
|
+
redirectAfterLoginOrRegister$: import("rxjs").Observable<never> & import("@ngrx/effects").CreateEffectMetadata;
|
|
14
|
+
redirectAfterLogout$: import("rxjs").Observable<never> & import("@ngrx/effects").CreateEffectMetadata;
|
|
15
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<DaffAuthRedirectEffects, never>;
|
|
16
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<DaffAuthRedirectEffects>;
|
|
17
|
+
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { Action, Store } from '@ngrx/store';
|
|
2
2
|
import { Observable } from 'rxjs';
|
|
3
|
-
import { DaffAuthToken } from '@daffodil/auth';
|
|
4
3
|
import { DaffStateError } from '@daffodil/core/state';
|
|
5
4
|
import { DaffAuthFeatureState } from '../../reducers/public_api';
|
|
6
5
|
import { DaffAuthFacadeInterface } from './facade.interface';
|
|
@@ -8,12 +7,13 @@ import * as i0 from "@angular/core";
|
|
|
8
7
|
/**
|
|
9
8
|
* @inheritdoc
|
|
10
9
|
*/
|
|
11
|
-
export declare class DaffAuthFacade
|
|
10
|
+
export declare class DaffAuthFacade implements DaffAuthFacadeInterface {
|
|
12
11
|
private store;
|
|
13
12
|
loading$: Observable<boolean>;
|
|
14
13
|
errors$: Observable<DaffStateError[]>;
|
|
14
|
+
loggedIn$: Observable<boolean>;
|
|
15
15
|
constructor(store: Store<DaffAuthFeatureState>);
|
|
16
16
|
dispatch(action: Action): void;
|
|
17
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<DaffAuthFacade
|
|
18
|
-
static ɵprov: i0.ɵɵInjectableDeclaration<DaffAuthFacade
|
|
17
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<DaffAuthFacade, never>;
|
|
18
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<DaffAuthFacade>;
|
|
19
19
|
}
|
|
@@ -4,5 +4,9 @@ import { DaffStoreFacade, DaffStateError } from '@daffodil/core/state';
|
|
|
4
4
|
export interface DaffAuthFacadeInterface extends DaffStoreFacade<Action> {
|
|
5
5
|
loading$: Observable<boolean>;
|
|
6
6
|
errors$: Observable<DaffStateError[]>;
|
|
7
|
+
/**
|
|
8
|
+
* Whether the current user is logged in.
|
|
9
|
+
*/
|
|
10
|
+
loggedIn$: Observable<boolean>;
|
|
7
11
|
dispatch(action: Action): void;
|
|
8
12
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { MemoizedSelector } from '@ngrx/store';
|
|
2
|
-
import { DaffAuthToken } from '@daffodil/auth';
|
|
3
2
|
import { DaffStateError } from '@daffodil/core/state';
|
|
4
3
|
import { DaffAuthReducerState } from '../../reducers/public_api';
|
|
5
4
|
export interface AuthSelectors {
|
|
6
5
|
selectAuthState: MemoizedSelector<Record<string, any>, DaffAuthReducerState>;
|
|
7
6
|
selectAuthLoading: MemoizedSelector<Record<string, any>, boolean>;
|
|
8
7
|
selectAuthErrors: MemoizedSelector<Record<string, any>, DaffStateError[]>;
|
|
8
|
+
selectAuthLoggedIn: MemoizedSelector<Record<string, any>, boolean>;
|
|
9
9
|
}
|
|
10
|
-
export declare const getAuthSelectors:
|
|
10
|
+
export declare const getAuthSelectors: () => AuthSelectors;
|
|
@@ -9,6 +9,7 @@ import * as i0 from "@angular/core";
|
|
|
9
9
|
export declare class MockDaffAuthFacade implements DaffAuthFacadeInterface {
|
|
10
10
|
loading$: BehaviorSubject<boolean>;
|
|
11
11
|
errors$: BehaviorSubject<DaffStateError[]>;
|
|
12
|
+
loggedIn$: BehaviorSubject<boolean>;
|
|
12
13
|
dispatch(action: Action): void;
|
|
13
14
|
static ɵfac: i0.ɵɵFactoryDeclaration<MockDaffAuthFacade, never>;
|
|
14
15
|
static ɵprov: i0.ɵɵInjectableDeclaration<MockDaffAuthFacade>;
|