@dereekb/dbx-core 9.20.18 → 9.20.19

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,21 +1,38 @@
1
- import { AuthRole, SetIncludesMode, ArrayOrValue } from '@dereekb/util';
1
+ import { OperatorFunction } from 'rxjs';
2
+ import { AuthRole, SetIncludesMode, ArrayOrValue, AuthRoleSet } from '@dereekb/util';
2
3
  import { TransitionService } from '@uirouter/core';
3
4
  import { AuthTransitionHookOptions, AuthTransitionStateData } from './hook';
4
5
  export interface HasAuthRoleHookConfig {
5
- options: AuthTransitionHookOptions;
6
+ readonly options: AuthTransitionHookOptions;
6
7
  }
7
- /**
8
- * UIRouter State data with configuration for the hasAuthRoleHook.
9
- */
10
- export interface HasAuthRoleStateData extends AuthTransitionStateData {
8
+ export interface HasAuthRoleStateRoleConfig {
9
+ /**
10
+ * Auth roles marked for this state
11
+ */
12
+ readonly authRoles: ArrayOrValue<AuthRole>;
13
+ /**
14
+ * How to use the above auth roles. This defaults to 'all' by default.
15
+ */
16
+ readonly authRolesMode?: SetIncludesMode;
17
+ }
18
+ export interface ParsedHasAuthRoleStateRoleConfig {
11
19
  /**
12
20
  * Auth roles marked for this state
13
21
  */
14
- authRoles: ArrayOrValue<AuthRole>;
22
+ readonly requiredRoles: Set<AuthRole>;
15
23
  /**
16
24
  * How to use the above auth roles. This defaults to 'all' by default.
17
25
  */
18
- authRolesMode?: SetIncludesMode;
26
+ readonly authRolesMode?: SetIncludesMode;
27
+ }
28
+ /**
29
+ * UIRouter State data with configuration for the hasAuthRoleHook.
30
+ */
31
+ export interface HasAuthRoleStateData extends AuthTransitionStateData, Pick<HasAuthRoleStateRoleConfig, 'authRolesMode'> {
32
+ /**
33
+ * Auth roles configuration for this state.
34
+ */
35
+ readonly authRoles: ArrayOrValue<AuthRole | HasAuthRoleStateRoleConfig>;
19
36
  }
20
37
  /**
21
38
  * This hook redirects to the configured default state when a user:
@@ -24,3 +41,4 @@ export interface HasAuthRoleStateData extends AuthTransitionStateData {
24
41
  * - has a disallowed state
25
42
  */
26
43
  export declare function enableHasAuthRoleHook(transitionService: TransitionService, config: HasAuthRoleHookConfig): void;
44
+ export declare function hasAuthRoleDecisionPipe(stateData: HasAuthRoleStateData): OperatorFunction<AuthRoleSet, boolean>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dereekb/dbx-core",
3
- "version": "9.20.18",
3
+ "version": "9.20.19",
4
4
  "peerDependencies": {
5
5
  "@angular/common": "^14.0.0",
6
6
  "@angular/core": "^14.0.0",
@@ -9,12 +9,12 @@
9
9
  "@ngrx/effects": "^14.0.0",
10
10
  "@ngrx/entity": "^14.0.0",
11
11
  "@ngrx/store": "^14.0.0",
12
- "@dereekb/util": "9.20.18",
13
- "@dereekb/rxjs": "9.20.18",
12
+ "@dereekb/util": "9.20.19",
13
+ "@dereekb/rxjs": "9.20.19",
14
14
  "@angular/platform-browser": "^14.2.0",
15
15
  "@uirouter/core": "^6.0.8",
16
16
  "date-fns": "^2.29.0",
17
- "@dereekb/date": "9.20.18",
17
+ "@dereekb/date": "9.20.19",
18
18
  "@angular/router": "^14.2.0"
19
19
  },
20
20
  "dependencies": {