How to use the @ngrx/store.compose function in @ngrx/store

To help you get started, we’ve selected a few @ngrx/store examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github cloudfoundry / stratos / src / frontend / packages / cloud-foundry / src / store / selectors / cf-current-user-role.selectors.ts View on Github external
export const selectCurrentUserCFRolesState = (state: ICurrentUserRolesState) => state.cf;
export const selectCurrentUserCFEndpointRolesState = (endpointGuid: string) =>
  (state: IAllCfRolesState) => state ? state[endpointGuid] : null;

export const selectCurrentUserCFGlobalRolesStates = (state: ICfRolesState) => state ? state.global : null;
export const selectCurrentUserCFGlobalRolesState = (role: PermissionValues) => (state: IGlobalRolesState) => state[role] || false;
export const selectCurrentUserCFOrgsRolesState = (state: ICfRolesState) => state.organizations;
export const selectCurrentUserCFSpacesRolesState = (state: ICfRolesState) => state.spaces;
export const selectCurrentUserCFGlobalScopesState = (state: IGlobalRolesState) => state ? state.scopes : [];

export const selectCurrentUserCFSpaceRolesState = (spaceId: string) => (state: ISpacesRoleState) => state[spaceId];
export const selectCurrentUserCFOrgRolesState = (orgId: string) => (state: IOrgsRoleState) => state[orgId];

// Top level cf endpoint role objects
// ============================
export const getCurrentUserCFRolesState = compose(
  selectCurrentUserCFRolesState,
  selectCurrentUserRolesState
);
// ============================

// Specific endpoint roles
// ============================
export const getCurrentUserCFEndpointRolesState = (endpointGuid: string) => compose(
  selectCurrentUserCFEndpointRolesState(endpointGuid),
  getCurrentUserCFRolesState
);
// ============================

// CF Global roles
// ============================
export const getCurrentUserCFGlobalStates = (endpointGuid: string) => compose(
github cloudfoundry / stratos / src / frontend / packages / cloud-foundry / src / store / selectors / cf-current-user-role.selectors.ts View on Github external
export const getCurrentUserCFEndpointHasScope = (endpointGuid: string, scope: ScopeStrings) => compose(
  selectCurrentUserCFGlobalHasScopes(scope),
  getCurrentUserCFEndpointScopesState(endpointGuid)
);
// ============================
github cloudfoundry / stratos / src / frontend / packages / cloud-foundry / src / store / selectors / cf-current-user-role.selectors.ts View on Github external
export const getCurrentUserCFOrgsRolesState = (endpointGuid: string) => compose(
  selectCurrentUserCFOrgsRolesState,
  getCurrentUserCFEndpointRolesState(endpointGuid)
);
// ============================
github cloudfoundry / stratos / src / frontend / packages / cloud-foundry / src / store / selectors / cf-current-user-role.selectors.ts View on Github external
export const getCurrentUserCFRequestState = (endpointGuid: string) => compose(
  selectCurrentUserRequestState,
  getCurrentUserCFGlobalStates(endpointGuid)
);
// ============================
github cloudfoundry / stratos / src / frontend / app / store / selectors / current-user-roles-permissions-selectors / role.selectors.ts View on Github external
export const getCurrentUserCFEndpointRolesState = (endpointGuid: string) => compose(
  selectCurrentUserCFEndpointRolesState(endpointGuid),
  getCurrentUserCFRolesState
);
// ============================
github cloudfoundry / stratos / src / frontend / packages / store / src / selectors / internal-events.selectors.ts View on Github external
export const internalEventTypeSelector = (type: string) => compose(
  (state: InternalEventsState) => state.types[type] || {},
  internalEventStateSelector
);
github cloudfoundry / stratos / src / app / store / selectors / api.selectors.ts View on Github external
export function selectRequestInfo(entityType: string, entityGuid: string) {
  return compose(
    getEntityById(entityGuid),
    getRequestEntityType(entityType),
    getAPIRequestInfoState
  );
}
github cloudfoundry / stratos / src / frontend / app / store / selectors / deploy-application.selector.ts View on Github external
getApplicationSource,
  selectDeployAppState
);

export const selectProjectName = compose(
  getApplicationProjectName,
  getApplicationSource,
  selectDeployAppState
);

export const selectProjectExists = compose(
  getProjectExists,
  selectDeployAppState
);

export const selectNewProjectCommit = compose(
  getCommit,
  getApplicationSource,
  selectDeployAppState
);

export const selectNewProjectBranch = compose(
  getBranch,
  getApplicationSource,
  selectDeployAppState
);

export const selectCfDetails = compose(
  getCFDetails,
  selectDeployAppState
);
github cloudfoundry / stratos / src / frontend / packages / store / src / selectors / favorite-groups.selectors.ts View on Github external
if (favorite.entityType === 'endpoint' && !group.ethereal) {
      return true;
    }
    return group.entitiesIds.includes(favorite.guid);
  };
};

export function isFavoriteSelector(favorite: UserFavorite) {
  return compose(
    favoriteInGroupGroupSelector(favorite),
    favoriteGroupSelector(favorite),
    favoriteGroupsSelector
  );
}

export const fetchingFavoritesSelector = compose(
  favoriteGroupsFetchingSelector,
  favoriteGroupsStateSelector
);

export const errorFetchingFavoritesSelector = compose(
  favoriteGroupsErrorSelector,
  favoriteGroupsStateSelector
);
github cloudfoundry / stratos / src / frontend / packages / cloud-foundry / src / store / selectors / deploy-application.selector.ts View on Github external
selectDeployAppState
);

export const selectNewProjectCommit = compose(
  getCommit,
  getApplicationSource,
  selectDeployAppState
);

export const selectNewProjectBranch = compose(
  getBranch,
  getApplicationSource,
  selectDeployAppState
);

export const selectCfDetails = compose(
  getCFDetails,
  selectDeployAppState
);

export const selectDeployBranchName = compose(
  getDeployBranchName,
  getApplicationSource,
  selectDeployAppState
);

export const selectPEProjectName = compose(
  getProjectName,
  getProjectExists,
  selectDeployAppState
);