UNPKG

4 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';
7import * as i0 from "@angular/core";
8export declare class StoreRootModule {
9 constructor(actions$: ActionsSubject, reducer$: ReducerObservable, scannedActions$: ScannedActionsSubject, store: Store<any>, guard: any, actionCheck: any);
10 static ɵfac: i0.ɵɵFactoryDeclaration<StoreRootModule, [null, null, null, null, { optional: true; }, { optional: true; }]>;
11 static ɵmod: i0.ɵɵNgModuleDeclaration<StoreRootModule, never, never, never>;
12 static ɵinj: i0.ɵɵInjectorDeclaration<StoreRootModule>;
13}
14export declare class StoreFeatureModule implements OnDestroy {
15 private features;
16 private featureReducers;
17 private reducerManager;
18 constructor(features: StoreFeature<any, any>[], featureReducers: ActionReducerMap<any>[], reducerManager: ReducerManager, root: StoreRootModule, actionCheck: any);
19 ngOnDestroy(): void;
20 static ɵfac: i0.ɵɵFactoryDeclaration<StoreFeatureModule, [null, null, null, null, { optional: true; }]>;
21 static ɵmod: i0.ɵɵNgModuleDeclaration<StoreFeatureModule, never, never, never>;
22 static ɵinj: i0.ɵɵInjectorDeclaration<StoreFeatureModule>;
23}
24export interface StoreConfig<T, V extends Action = Action> {
25 initialState?: InitialState<T>;
26 reducerFactory?: ActionReducerFactory<T, V>;
27 metaReducers?: MetaReducer<{
28 [P in keyof T]: T[P];
29 }, V>[];
30}
31export interface RootStoreConfig<T, V extends Action = Action> extends StoreConfig<T, V> {
32 runtimeChecks?: Partial<RuntimeChecks>;
33}
34/**
35 * An object with the name and the reducer for the feature.
36 */
37export interface FeatureSlice<T, V extends Action = Action> {
38 name: string;
39 reducer: ActionReducer<T, V>;
40}
41export declare class StoreModule {
42 static forRoot<T, V extends Action = Action>(reducers: ActionReducerMap<T, V> | InjectionToken<ActionReducerMap<T, V>>, config?: RootStoreConfig<T, V>): ModuleWithProviders<StoreRootModule>;
43 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>;
44 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>;
45 static forFeature<T, V extends Action = Action>(slice: FeatureSlice<T, V>): ModuleWithProviders<StoreFeatureModule>;
46 static ɵfac: i0.ɵɵFactoryDeclaration<StoreModule, never>;
47 static ɵmod: i0.ɵɵNgModuleDeclaration<StoreModule, never, never, never>;
48 static ɵinj: i0.ɵɵInjectorDeclaration<StoreModule>;
49}
50export declare function _createStoreReducers(injector: Injector, reducers: ActionReducerMap<any, any>): unknown;
51export declare function _createFeatureStore(injector: Injector, configs: StoreConfig<any, any>[] | InjectionToken<StoreConfig<any, any>>[], featureStores: StoreFeature<any, any>[]): (StoreFeature<any, any> | {
52 key: string;
53 reducerFactory: any;
54 metaReducers: any;
55 initialState: any;
56})[];
57export declare function _createFeatureReducers(injector: Injector, reducerCollection: ActionReducerMap<any, any>[]): unknown[];
58export declare function _initialStateFactory(initialState: any): any;
59export declare function _concatMetaReducers(metaReducers: MetaReducer[], userProvidedMetaReducers: MetaReducer[]): MetaReducer[];
60export declare function _provideForRootGuard(store: Store<any>): any;