@dereekb/dbx-core 5.3.0 → 6.0.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.
@@ -5,7 +5,7 @@ import { switchMap, first, BehaviorSubject, combineLatest, distinctUntilChanged,
5
5
  import * as i1$5 from '@dereekb/rxjs';
6
6
  import { SubscriptionObject, LockSet, filterMaybe, LoadingStateType, beginLoading, idleLoadingState, errorResult, successResult, scanCount, combineLatestFromMapValuesObsFn, workFactory, emitDelayObs, asObservable, returnIfIs, skipFirstMaybe, onFalseToTrue, onTrueToFalse, setContainsAllValuesFrom, FilterSourceInstance, FilterSource, FilterSourceConnector, FilterMap } from '@dereekb/rxjs';
7
7
  import * as i1$6 from '@dereekb/util';
8
- import { isDefinedAndNotFalse, hasValueOrNotEmpty, BooleanStringKeyArrayUtilityInstance, reduceBooleansWithOrFn, getValueFromGetter, toReadableError, isGetter, setIncludesFunction, maybeSet, isAllowed, expandTreeFunction, flattenTreeToArrayFunction, expandFlattenTreeFunction, mergeArrays, filterMaybeValues, mergeObjects, mergeArrayOrValueIntoArray, makePromiseFullRef, DataIsExpiredError, DataDoesNotExistError, filterMaybeValuesFn, StorageObjectUtility, SHARED_MEMORY_STORAGE } from '@dereekb/util';
8
+ import { isDefinedAndNotFalse, hasValueOrNotEmpty, BooleanStringKeyArrayUtilityInstance, reduceBooleansWithOrFn, getValueFromGetter, toReadableError, isGetter, setIncludes, maybeSet, isAllowed, expandTreeFunction, flattenTreeToArrayFunction, expandFlattenTreeFunction, mergeArrays, filterMaybeValues, mergeObjects, mergeArrayOrValueIntoArray, makePromiseFullRef, DataIsExpiredError, DataDoesNotExistError, filterMaybeValuesFn, StorageObjectUtility, SHARED_MEMORY_STORAGE } from '@dereekb/util';
9
9
  import { ComponentStore } from '@ngrx/component-store';
10
10
  import { CommonModule, formatDate } from '@angular/common';
11
11
  import * as i1$3 from '@ngrx/effects';
@@ -1705,7 +1705,8 @@ function makeAuthTransitionHook(config) {
1705
1705
  else {
1706
1706
  resultObs = of(redirectTo);
1707
1707
  }
1708
- redirectToObs = resultObs.pipe(map((stateRef) => {
1708
+ redirectToObs = resultObs.pipe(map((inputStateRef) => {
1709
+ const stateRef = asSegueRef(inputStateRef);
1709
1710
  let redirectTarget;
1710
1711
  let redirectParams;
1711
1712
  if (stateRef) {
@@ -1733,7 +1734,8 @@ function makeAuthTransitionHook(config) {
1733
1734
  }
1734
1735
  }
1735
1736
  else {
1736
- return of($state.target(asSegueRefString(decision.ref), decision.refParams, decision.refOptions));
1737
+ const segueRef = asSegueRef(decision);
1738
+ return of($state.target(asSegueRefString(segueRef.ref), segueRef.refParams, segueRef.refOptions));
1737
1739
  }
1738
1740
  }), catchError((x) => {
1739
1741
  console.warn('Encountered error in auth transition hook.', x);
@@ -1814,8 +1816,7 @@ function enableHasAuthRoleHook(transitionService, config) {
1814
1816
  const targetState = transition.targetState();
1815
1817
  const data = targetState.state().data;
1816
1818
  const requiredRoles = new Set(data.authRoles);
1817
- const setIncludes = setIncludesFunction(requiredRoles, data.authRolesMode);
1818
- return authService.authUserState$.pipe(map((x) => setIncludes(x)));
1819
+ return authService.authRoles$.pipe(map((x) => setIncludes(x, requiredRoles, data.authRolesMode)));
1819
1820
  }
1820
1821
  });
1821
1822
  // Register the "requires auth" hook with the TransitionsService
@@ -1843,8 +1844,8 @@ function enableHasAuthStateHook(transitionService, config) {
1843
1844
  const targetState = transition.targetState();
1844
1845
  const data = targetState.state().data;
1845
1846
  const config = toHasAuthStateObjectConfig(data.authStates);
1846
- const parsed = toParsedHasAuthStateConfig(config);
1847
- return authService.authUserState$.pipe(map((x) => isAllowed(x, parsed)));
1847
+ const allowedStates = toParsedHasAuthStateConfig(config);
1848
+ return authService.authUserState$.pipe(map((x) => isAllowed(x, allowedStates)));
1848
1849
  }
1849
1850
  });
1850
1851
  // Register the "requires auth" hook with the TransitionsService