UNPKG

3.24 kBTypeScriptView Raw
1import { ModuleWithProviders, OnDestroy, InjectionToken, Injector } from '@angular/core';
2import { Action, ActionReducer, ActionReducerMap, ActionReducerFactory, StoreFeature, InitialState, MetaReducer, RuntimeChecks } from './models';
3import { ActionsSubject } from './actions_subject';
4import { ReducerManager, ReducerObservable } from './reducer_manager';
5import { ScannedActionsSubject } from './scanned_actions_subject';
6import { Store } from './store';
7export declare class StoreRootModule {
8 constructor(actions$: ActionsSubject, reducer$: ReducerObservable, scannedActions$: ScannedActionsSubject, store: Store<any>, guard: any, actionCheck: any);
9}
10export declare class StoreFeatureModule implements OnDestroy {
11 private features;
12 private featureReducers;
13 private reducerManager;
14 constructor(features: StoreFeature<any, any>[], featureReducers: ActionReducerMap<any>[], reducerManager: ReducerManager, root: StoreRootModule, actionCheck: any);
15 ngOnDestroy(): void;
16}
17export interface StoreConfig<T, V extends Action = Action> {
18 initialState?: InitialState<T>;
19 reducerFactory?: ActionReducerFactory<T, V>;
20 metaReducers?: MetaReducer<T, V>[];
21}
22export interface RootStoreConfig<T, V extends Action = Action> extends StoreConfig<T, V> {
23 runtimeChecks?: Partial<RuntimeChecks>;
24}
25/**
26 * An object with the name and the reducer for the feature.
27 */
28export interface FeatureSlice<T, V extends Action = Action> {
29 name: string;
30 reducer: ActionReducer<T, V>;
31}
32export declare class StoreModule {
33 static forRoot<T, V extends Action = Action>(reducers: ActionReducerMap<T, V> | InjectionToken<ActionReducerMap<T, V>>, config?: RootStoreConfig<T, V>): ModuleWithProviders<StoreRootModule>;
34 static forFeature<T, V extends Action = Action>(featureName: string, reducers: ActionReducerMap<T, V> | InjectionToken<ActionReducerMap<T, V>>, config?: StoreConfig<T, V> | InjectionToken<StoreConfig<T, V>>): ModuleWithProviders<StoreFeatureModule>;
35 static forFeature<T, V extends Action = Action>(featureName: string, reducer: ActionReducer<T, V> | InjectionToken<ActionReducer<T, V>>, config?: StoreConfig<T, V> | InjectionToken<StoreConfig<T, V>>): ModuleWithProviders<StoreFeatureModule>;
36 static forFeature<T, V extends Action = Action>(slice: FeatureSlice<T, V>, config?: StoreConfig<T, V> | InjectionToken<StoreConfig<T, V>>): ModuleWithProviders<StoreFeatureModule>;
37}
38export declare function _createStoreReducers(injector: Injector, reducers: ActionReducerMap<any, any>): unknown;
39export declare function _createFeatureStore(injector: Injector, configs: StoreConfig<any, any>[] | InjectionToken<StoreConfig<any, any>>[], featureStores: StoreFeature<any, any>[]): (StoreFeature<any, any> | {
40 key: string;
41 reducerFactory: any;
42 metaReducers: any;
43 initialState: any;
44})[];
45export declare function _createFeatureReducers(injector: Injector, reducerCollection: ActionReducerMap<any, any>[]): unknown[];
46export declare function _initialStateFactory(initialState: any): any;
47export declare function _concatMetaReducers(metaReducers: MetaReducer[], userProvidedMetaReducers: MetaReducer[]): MetaReducer[];
48export declare function _provideForRootGuard(store: Store<any>): any;