@dereekb/dbx-core 5.2.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';
@@ -1102,8 +1102,7 @@ class DbxActionDisabledDirective extends AbstractSubscriptionDirective {
1102
1102
  return this._disabled.value;
1103
1103
  }
1104
1104
  set disabled(disabled) {
1105
- const disable = disabled !== false;
1106
- this._disabled.next(disable);
1105
+ this._disabled.next(disabled !== false);
1107
1106
  }
1108
1107
  }
1109
1108
  DbxActionDisabledDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: DbxActionDisabledDirective, deps: [{ token: DbxActionContextStoreSourceInstance, host: true }], target: i0.ɵɵFactoryTarget.Directive });
@@ -1389,7 +1388,7 @@ class DbxActionEnforceModifiedDirective extends AbstractSubscriptionDirective {
1389
1388
  return this._enabled.value;
1390
1389
  }
1391
1390
  set enabled(enabled) {
1392
- this._enabled.next(Boolean(enabled) ?? true);
1391
+ this._enabled.next(enabled !== false);
1393
1392
  }
1394
1393
  }
1395
1394
  DbxActionEnforceModifiedDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.2", ngImport: i0, type: DbxActionEnforceModifiedDirective, deps: [{ token: DbxActionContextStoreSourceInstance, host: true }], target: i0.ɵɵFactoryTarget.Directive });
@@ -1706,7 +1705,8 @@ function makeAuthTransitionHook(config) {
1706
1705
  else {
1707
1706
  resultObs = of(redirectTo);
1708
1707
  }
1709
- redirectToObs = resultObs.pipe(map((stateRef) => {
1708
+ redirectToObs = resultObs.pipe(map((inputStateRef) => {
1709
+ const stateRef = asSegueRef(inputStateRef);
1710
1710
  let redirectTarget;
1711
1711
  let redirectParams;
1712
1712
  if (stateRef) {
@@ -1734,7 +1734,8 @@ function makeAuthTransitionHook(config) {
1734
1734
  }
1735
1735
  }
1736
1736
  else {
1737
- 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));
1738
1739
  }
1739
1740
  }), catchError((x) => {
1740
1741
  console.warn('Encountered error in auth transition hook.', x);
@@ -1815,8 +1816,7 @@ function enableHasAuthRoleHook(transitionService, config) {
1815
1816
  const targetState = transition.targetState();
1816
1817
  const data = targetState.state().data;
1817
1818
  const requiredRoles = new Set(data.authRoles);
1818
- const setIncludes = setIncludesFunction(requiredRoles, data.authRolesMode);
1819
- return authService.authUserState$.pipe(map((x) => setIncludes(x)));
1819
+ return authService.authRoles$.pipe(map((x) => setIncludes(x, requiredRoles, data.authRolesMode)));
1820
1820
  }
1821
1821
  });
1822
1822
  // Register the "requires auth" hook with the TransitionsService
@@ -1844,8 +1844,8 @@ function enableHasAuthStateHook(transitionService, config) {
1844
1844
  const targetState = transition.targetState();
1845
1845
  const data = targetState.state().data;
1846
1846
  const config = toHasAuthStateObjectConfig(data.authStates);
1847
- const parsed = toParsedHasAuthStateConfig(config);
1848
- return authService.authUserState$.pipe(map((x) => isAllowed(x, parsed)));
1847
+ const allowedStates = toParsedHasAuthStateConfig(config);
1848
+ return authService.authUserState$.pipe(map((x) => isAllowed(x, allowedStates)));
1849
1849
  }
1850
1850
  });
1851
1851
  // Register the "requires auth" hook with the TransitionsService