import { DefaultProjectorFn, MemoizedSelector } from '@ngrx/store'; import { NoIntersection } from '../utils'; import { IdLoadingActions } from './id-loading-state-actions'; import { IdFailureAction, IdLoadAction, IdLoadingStates, IdSuccessAction, WithIdLoadingStatesOnly } from './id-loading-state-types'; export declare function idLoad>(): IdLoad; export declare function idSuccess>(): IdSuccess; export declare function idFailure>(): IdFailure; /** * Creates a set of IdLoadAction, IdSuccessAction, and IdFailureAction. Selectors and reducers are always bundled into * the same structure. * * The difference between IdLoadAction and LoadAction is that IdLoadAction is parameterized by an id field. So you can * display loading states for multiple items that are all loading in parallel. Typical use case is you have a list of items, * and you can issue load actions for each one, parameterized by an id of your own choosing, and observe the loading state * of each item, again parameterized by the id. * * @param type The "type" of the action. * @param _idLoad See usage example * @param _idSuccess See usage example * @param _idFailure See usage example * @returns An instance of LoadingActions class that bundles together actions, selectors and reducers. * @example * export const fetchItem = createIdLoadingActions( * 'Fetch Item', * // An id field is already included in each of LoadAction, SuccessAction, FailureAction * load<{}>(), * success<{ item: object }>(), * failure<{}>() * ); * * // Dispatch load action * const id = "123"; * this.store.dispatch(fetchItem.idLoad({ id })); * * // Using ngrx's createFeatureSelector to select the feature slice from global store. * const selectState = createFeatureSelector(SIMPLE_FEATURE_KEY); * const selectLoadingStates = createLoadingStatesSelector(selectState); * * const fetchItemSelectors = fetchItem.createIdSelectors(selectLoadingStates); * * // Observe the loading state. * this.store.select(fetchItemSelectors.state(id)); * */ export declare function createIdLoadingActions(actionTypePrefix: string, _idLoad: IdLoad, _idSuccess: IdSuccess, _idFailure: IdFailure): IdLoadingActions; /** * * @param featureSelector Selector that selects the current feature slice of the store. * @returns Selector that selects the loadingStates field from the store * @example * // Using ngrx's createFeatureSelector to select the feature slice from global store. * const selectState = createFeatureSelector(SIMPLE_FEATURE_KEY); * const selectLoadingStates = createLoadingStatesSelector(selectState); * * You can then use selectLoadingStates to compose other selectors. eg. * * export const fetchItem = createIdLoadingActions( * 'Fetch Item', * load<{}>(), * success<{ item: object }>(), * failure<{}>() * ); * * export const fetchItemSelectors = fetchItem.createSelectors(selectLoadingStates); * */ export declare function createIdLoadingStatesSelector(featureSelector: MemoizedSelector>): MemoizedSelector>; declare class IdLoad<_LoadPayloadType> { type: 'ID_LOAD'; } declare class IdSuccess<_SuccessPayloadType> { type: 'ID_SUCCESS'; } declare class IdFailure<_FailurePayloadType> { type: 'ID_FAILURE'; } declare type NotIdLoadingAction = NoIntersection; declare type NotIdSuccessAction = NoIntersection; declare type NotIdFailureAction = NoIntersection; export {};