@coolon/angular-ui-powerups 14.43.0 → 14.45.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/lib/interaction/components/input-activities/input-activity.mjs +8 -2
- package/esm2020/lib/interaction/components/input-activities/select-input-activity.mjs +1 -1
- package/esm2020/lib/place/components/place-outlet/place-outlet.component.mjs +2 -2
- package/esm2020/lib/place/exports.mjs +2 -1
- package/esm2020/lib/place/guards/place.guard.mjs +10 -9
- package/esm2020/lib/place/place-access-guard.mjs +1 -1
- package/esm2020/lib/place/place-auth-service.mjs +121 -0
- package/esm2020/lib/place/place-component.mjs +3 -3
- package/esm2020/lib/place/place-router.mjs +6 -28
- package/fesm2015/coolon-angular-ui-powerups.mjs +159 -55
- package/fesm2015/coolon-angular-ui-powerups.mjs.map +1 -1
- package/fesm2020/coolon-angular-ui-powerups.mjs +158 -55
- package/fesm2020/coolon-angular-ui-powerups.mjs.map +1 -1
- package/lib/interaction/components/input-activities/input-activity.d.ts +2 -0
- package/lib/place/exports.d.ts +1 -0
- package/lib/place/guards/place.guard.d.ts +2 -2
- package/lib/place/place-access-guard.d.ts +2 -2
- package/lib/place/place-auth-service.d.ts +49 -0
- package/lib/place/place-router.d.ts +2 -9
- package/package.json +3 -2
|
@@ -13,6 +13,7 @@ export declare class InputActivity<T, D extends InputActivity.Data<T> = InputAct
|
|
|
13
13
|
get layout(): InputActivity.Layout;
|
|
14
14
|
constructor();
|
|
15
15
|
get additionalCssClassName(): string;
|
|
16
|
+
get dataCyAttribute(): string;
|
|
16
17
|
onEscape(): void;
|
|
17
18
|
shouldCancelOnEscape(): boolean;
|
|
18
19
|
static ɵfac: i0.ɵɵFactoryDeclaration<InputActivity<any, any>, never>;
|
|
@@ -37,6 +38,7 @@ export declare namespace InputActivity {
|
|
|
37
38
|
validators?: Validator<T>[];
|
|
38
39
|
cancelOnEscape?: boolean;
|
|
39
40
|
cssClassName?: string;
|
|
41
|
+
dataCy?: string;
|
|
40
42
|
save?(valueModel: T, interactionContext?: Context): void | Promise<void>;
|
|
41
43
|
}
|
|
42
44
|
}
|
package/lib/place/exports.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Injector } from '@angular/core';
|
|
2
2
|
import { ActivatedRouteSnapshot, CanActivate, CanDeactivate, Router, RouterStateSnapshot, UrlTree } from '@angular/router';
|
|
3
3
|
import { InteractionService } from '../../interaction/services/interaction.service';
|
|
4
|
-
import {
|
|
4
|
+
import { PlaceAuthService } from "../place-auth-service";
|
|
5
5
|
import { PlaceComponent } from '../place-component';
|
|
6
6
|
import { PlaceHistory } from '../place-history';
|
|
7
7
|
import { PlaceRouter } from '../place-router';
|
|
@@ -16,7 +16,7 @@ export declare class PlaceGuard implements CanActivate, CanDeactivate<PlaceCompo
|
|
|
16
16
|
private readonly interactionService;
|
|
17
17
|
private readonly injector;
|
|
18
18
|
constructor(router: Router, urlService: UrlService, placeRouter: PlaceRouter, placeHistory: PlaceHistory, interactionService: InteractionService, injector: Injector);
|
|
19
|
-
get
|
|
19
|
+
get authService(): PlaceAuthService;
|
|
20
20
|
canActivate(activatedRoute: ActivatedRouteSnapshot, state: RouterStateSnapshot): Promise<boolean | UrlTree>;
|
|
21
21
|
private findBestAuthenticatedAlternative;
|
|
22
22
|
canDeactivate(component: PlaceComponent, currentRoute: ActivatedRouteSnapshot, currentState: RouterStateSnapshot, nextState?: RouterStateSnapshot): Promise<boolean | UrlTree>;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { PlaceDefinition } from './place-definition';
|
|
2
2
|
export interface PlaceAccessGuard {
|
|
3
|
-
isAuthenticated(): boolean
|
|
3
|
+
isAuthenticated(): boolean;
|
|
4
4
|
isAuthorised(placeDefinition: PlaceDefinition): boolean;
|
|
5
5
|
}
|
|
6
6
|
export declare namespace PlaceAccessGuard {
|
|
7
7
|
class NoAuth implements PlaceAccessGuard {
|
|
8
|
-
isAuthenticated(): boolean
|
|
8
|
+
isAuthenticated(): boolean;
|
|
9
9
|
isAuthorised(placeDefinition: PlaceDefinition): boolean;
|
|
10
10
|
}
|
|
11
11
|
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { ActivatedRouteSnapshot, RouterStateSnapshot } from "@angular/router";
|
|
2
|
+
import { ComputedModelMechanics, Constructable, GarbageCollector, HasValue, ValueModel } from "@coolon/pectin";
|
|
3
|
+
import { PlaceAccessGuard } from "./place-access-guard";
|
|
4
|
+
import { PlaceComponent } from "./place-component";
|
|
5
|
+
import { PlaceDefinition } from "./place-definition";
|
|
6
|
+
import { Visit } from "./visit";
|
|
7
|
+
export declare class PlaceAuthService extends GarbageCollector {
|
|
8
|
+
private readonly placeGuards$;
|
|
9
|
+
private authZOptions;
|
|
10
|
+
private authNOptions;
|
|
11
|
+
private readonly _ready$;
|
|
12
|
+
private authenticated$;
|
|
13
|
+
private authorisationChecker$;
|
|
14
|
+
readonly accessGuard$: ValueModel<PlaceAuthService.AccessGuard>;
|
|
15
|
+
constructor();
|
|
16
|
+
configureAuthentication(options: PlaceAuthService.AuthenticationOptions): void;
|
|
17
|
+
configureAuthorisation(options: PlaceAuthService.AuthorisationOptions): void;
|
|
18
|
+
enablePlace(placeDefinition: Constructable<PlaceComponent>, options: PlaceAuthService.AuthPlaceOptions): void;
|
|
19
|
+
waitUntilReady(): Promise<void>;
|
|
20
|
+
getAuthenticationFailureRedirect(activatedRoute: ActivatedRouteSnapshot, state: RouterStateSnapshot): Visit;
|
|
21
|
+
getAuthorisationFailureRedirectOptions(component: Constructable<PlaceComponent>): Visit[];
|
|
22
|
+
private toPromise;
|
|
23
|
+
private capturePostoneDependency;
|
|
24
|
+
isAuthenticated(): boolean;
|
|
25
|
+
isAuthorised(c: PlaceDefinition): boolean;
|
|
26
|
+
}
|
|
27
|
+
export declare namespace PlaceAuthService {
|
|
28
|
+
type AuthorisationCheck = (def: PlaceDefinition) => boolean;
|
|
29
|
+
interface AuthenticationOptions extends ComputedModelMechanics.PostponeOptions {
|
|
30
|
+
isAuthenticated$: ValueModel<boolean>;
|
|
31
|
+
redirectTo(activatedRoute?: ActivatedRouteSnapshot, state?: RouterStateSnapshot): Visit | Constructable<PlaceComponent>;
|
|
32
|
+
}
|
|
33
|
+
interface AuthorisationOptions extends ComputedModelMechanics.PostponeOptions {
|
|
34
|
+
isAuthorised: AuthorisationCheck;
|
|
35
|
+
dependsOn: HasValue<any>;
|
|
36
|
+
redirectTo(component: Constructable<PlaceComponent>): (Constructable<PlaceComponent> | Visit)[];
|
|
37
|
+
}
|
|
38
|
+
interface AuthPlaceOptions extends ComputedModelMechanics.PostponeOptions {
|
|
39
|
+
when$?: ValueModel<boolean>;
|
|
40
|
+
unless$?: ValueModel<boolean>;
|
|
41
|
+
}
|
|
42
|
+
class AccessGuard implements PlaceAccessGuard {
|
|
43
|
+
private readonly authenticated;
|
|
44
|
+
private readonly authCheck;
|
|
45
|
+
constructor(authenticated: boolean, authCheck: AuthorisationCheck);
|
|
46
|
+
isAuthenticated(): boolean;
|
|
47
|
+
isAuthorised(placeDefinition: PlaceDefinition): boolean;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
@@ -3,8 +3,8 @@ import { ActivatedRouteSnapshot, NavigationCancel, NavigationEnd, NavigationErro
|
|
|
3
3
|
import { GarbageCollector, MutableValueModel, ValueModel, ValueModelChain } from "@coolon/pectin";
|
|
4
4
|
import { Constructable } from "@coolon/typescript-utilities";
|
|
5
5
|
import { InteractionService } from "../interaction/services/interaction.service";
|
|
6
|
+
import { PlaceAuthService } from "./place-auth-service";
|
|
6
7
|
import { NavigationSession } from "./navigation/session/navigation-session";
|
|
7
|
-
import { PlaceAccessGuard } from "./place-access-guard";
|
|
8
8
|
import { PlaceComponent } from "./place-component";
|
|
9
9
|
import { PlaceHistory } from "./place-history";
|
|
10
10
|
import { UrlService } from "./url-service";
|
|
@@ -26,15 +26,8 @@ export declare class PlaceRouter extends GarbageCollector {
|
|
|
26
26
|
private readonly _activeVisit$;
|
|
27
27
|
private readonly routerInteractionAdapter;
|
|
28
28
|
private sessionFinishedJobs;
|
|
29
|
-
|
|
30
|
-
* An observable model containing the authoriser function. This allows places to react to changes
|
|
31
|
-
* in permissions when any underlying auth logic changes, e.g. a role being removed from a user.
|
|
32
|
-
*/
|
|
33
|
-
private readonly _accessGuard$;
|
|
34
|
-
private redirections;
|
|
29
|
+
readonly authService: PlaceAuthService;
|
|
35
30
|
constructor(angularRouter: Router, angularLocation: Location, interactionService: InteractionService, urlService: UrlService, placeHistory: PlaceHistory);
|
|
36
|
-
get accessGuard$(): ValueModel<PlaceAccessGuard>;
|
|
37
|
-
configureAuth(accessGrant: ValueModel<PlaceAccessGuard>, redirections: PlaceRouter.Redirections): void;
|
|
38
31
|
getAuthenticationFailureRedirect(activatedRoute: ActivatedRouteSnapshot, state: RouterStateSnapshot): Visit;
|
|
39
32
|
getAuthorisationFailureRedirectOptions(component: Constructable<PlaceComponent>): Visit[];
|
|
40
33
|
get navigationSession(): NavigationSession;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@coolon/angular-ui-powerups",
|
|
3
|
-
"version": "14.
|
|
3
|
+
"version": "14.45.0",
|
|
4
4
|
"schematics": "./schematics/collection.json",
|
|
5
5
|
"peerDependencies": {
|
|
6
6
|
"@angular/animations": "^14.2.12",
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"@angular/material": "^14.2.7",
|
|
12
12
|
"@angular/platform-browser": "^14.2.12",
|
|
13
13
|
"@angular/router": "^14.2.12",
|
|
14
|
-
"@coolon/pectin": "^3.
|
|
14
|
+
"@coolon/pectin": "^3.42.0",
|
|
15
15
|
"@typescript-plus/fast-memoize-decorator": "^0.2.1",
|
|
16
16
|
"lodash-es": "^4.17.21",
|
|
17
17
|
"marked": "4.0.2",
|
|
@@ -21,6 +21,7 @@
|
|
|
21
21
|
"json5": "^2.1.0",
|
|
22
22
|
"immer": ">=7.0.15",
|
|
23
23
|
"escape-string-regexp": "^5.0.0",
|
|
24
|
+
"@teppeis/multimaps": "2.0.0",
|
|
24
25
|
"ts-morph": "9.1.0",
|
|
25
26
|
"@angular/flex-layout": "14.0.0-beta.41",
|
|
26
27
|
"zone.js": "0.11.8"
|