@ngrx/effects
Advanced tools
Comparing version 15.1.0 to 15.2.0
{ | ||
"name": "@ngrx/effects", | ||
"version": "15.1.0", | ||
"version": "15.2.0", | ||
"description": "Side effect model for @ngrx/store", | ||
@@ -25,3 +25,3 @@ "repository": { | ||
"@angular/core": "^15.0.0", | ||
"@ngrx/store": "15.1.0", | ||
"@ngrx/store": "15.2.0", | ||
"rxjs": "^6.5.3 || ^7.5.0" | ||
@@ -28,0 +28,0 @@ }, |
"use strict"; | ||
exports.__esModule = true; | ||
exports.platformVersion = void 0; | ||
exports.platformVersion = '^15.1.0'; | ||
exports.platformVersion = '^15.2.0'; | ||
//# sourceMappingURL=libs-version.js.map |
import { Observable } from 'rxjs'; | ||
import { Action, ActionCreator } from '@ngrx/store'; | ||
import { EffectMetadata, EffectConfig, CreateEffectMetadata } from './models'; | ||
import { CreateEffectMetadata, EffectConfig, EffectMetadata, FunctionalEffect } from './models'; | ||
declare type DispatchType<T> = T extends { | ||
@@ -10,36 +10,14 @@ dispatch: infer U; | ||
declare type ConditionallyDisallowActionCreator<DT, Result> = DT extends false ? unknown : Result extends EffectResult<infer OT> ? OT extends ActionCreator ? 'ActionCreator cannot be dispatched. Did you forget to call the action creator function?' : unknown : unknown; | ||
/** | ||
* @description | ||
* Creates an effect from an `Observable` and an `EffectConfig`. | ||
* | ||
* @param source A function which returns an `Observable`. | ||
* @param config A `Partial<EffectConfig>` to configure the effect. By default, `dispatch` is true and `useEffectsErrorHandler` is true. | ||
* @returns If `EffectConfig`#`dispatch` is true, returns `Observable<Action>`. Else, returns `Observable<unknown>`. | ||
* | ||
* @usageNotes | ||
* | ||
* ** Mapping to a different action ** | ||
* ```ts | ||
* effectName$ = createEffect( | ||
* () => this.actions$.pipe( | ||
* ofType(FeatureActions.actionOne), | ||
* map(() => FeatureActions.actionTwo()) | ||
* ) | ||
* ); | ||
* ``` | ||
* | ||
* ** Non-dispatching effects ** | ||
* ```ts | ||
* effectName$ = createEffect( | ||
* () => this.actions$.pipe( | ||
* ofType(FeatureActions.actionOne), | ||
* tap(() => console.log('Action One Dispatched')) | ||
* ), | ||
* { dispatch: false } | ||
* // FeatureActions.actionOne is not dispatched | ||
* ); | ||
* ``` | ||
*/ | ||
export declare function createEffect<C extends EffectConfig, DT extends DispatchType<C>, OT extends ObservableType<DT, OT>, R extends EffectResult<OT>>(source: () => R & ConditionallyDisallowActionCreator<DT, R>, config?: Partial<C>): R & CreateEffectMetadata; | ||
export declare function createEffect<C extends EffectConfig & { | ||
functional?: false; | ||
}, DT extends DispatchType<C>, OT extends ObservableType<DT, OT>, R extends EffectResult<OT>>(source: () => R & ConditionallyDisallowActionCreator<DT, R>, config?: C): R & CreateEffectMetadata; | ||
export declare function createEffect<Source extends () => Observable<unknown>>(source: Source, config: EffectConfig & { | ||
functional: true; | ||
dispatch: false; | ||
}): FunctionalEffect<Source>; | ||
export declare function createEffect<Source extends () => Observable<Action>>(source: Source & ConditionallyDisallowActionCreator<true, ReturnType<Source>>, config: EffectConfig & { | ||
functional: true; | ||
dispatch?: true; | ||
}): FunctionalEffect<Source>; | ||
export declare function getCreateEffectMetadata<T extends Record<keyof T, Object>>(instance: T): EffectMetadata<T>[]; | ||
export {}; |
@@ -5,3 +5,3 @@ import { StoreRootModule, StoreFeatureModule } from '@ngrx/store'; | ||
export declare class EffectsFeatureModule { | ||
constructor(root: EffectsRootModule, effectSourceGroups: any[][], storeRootModule: StoreRootModule, storeFeatureModule: StoreFeatureModule); | ||
constructor(effectsRootModule: EffectsRootModule, effectsInstanceGroups: unknown[][], storeRootModule: StoreRootModule, storeFeatureModule: StoreFeatureModule); | ||
static ɵfac: i0.ɵɵFactoryDeclaration<EffectsFeatureModule, [null, null, { optional: true; }, { optional: true; }]>; | ||
@@ -8,0 +8,0 @@ static ɵmod: i0.ɵɵNgModuleDeclaration<EffectsFeatureModule, never, never, never>; |
import { ModuleWithProviders, Type } from '@angular/core'; | ||
import { EffectsFeatureModule } from './effects_feature_module'; | ||
import { EffectsRootModule } from './effects_root_module'; | ||
import { FunctionalEffect } from './models'; | ||
import * as i0 from "@angular/core"; | ||
export declare class EffectsModule { | ||
static forFeature(featureEffects: Type<unknown>[]): ModuleWithProviders<EffectsFeatureModule>; | ||
static forFeature(...featureEffects: Type<unknown>[]): ModuleWithProviders<EffectsFeatureModule>; | ||
static forRoot(rootEffects: Type<unknown>[]): ModuleWithProviders<EffectsRootModule>; | ||
static forRoot(...rootEffects: Type<unknown>[]): ModuleWithProviders<EffectsRootModule>; | ||
static forFeature(featureEffects: Array<Type<unknown> | Record<string, FunctionalEffect>>): ModuleWithProviders<EffectsFeatureModule>; | ||
static forFeature(...featureEffects: Array<Type<unknown> | Record<string, FunctionalEffect>>): ModuleWithProviders<EffectsFeatureModule>; | ||
static forRoot(rootEffects: Array<Type<unknown> | Record<string, FunctionalEffect>>): ModuleWithProviders<EffectsRootModule>; | ||
static forRoot(...rootEffects: Array<Type<unknown> | Record<string, FunctionalEffect>>): ModuleWithProviders<EffectsRootModule>; | ||
static ɵfac: i0.ɵɵFactoryDeclaration<EffectsModule, never>; | ||
@@ -11,0 +12,0 @@ static ɵmod: i0.ɵɵNgModuleDeclaration<EffectsModule, never, never, never>; |
@@ -7,4 +7,4 @@ import { Store, StoreRootModule, StoreFeatureModule } from '@ngrx/store'; | ||
private sources; | ||
constructor(sources: EffectSources, runner: EffectsRunner, store: Store<any>, rootEffects: any[], storeRootModule: StoreRootModule, storeFeatureModule: StoreFeatureModule, guard: any); | ||
addEffects(effectSourceInstance: any): void; | ||
constructor(sources: EffectSources, runner: EffectsRunner, store: Store, rootEffectsInstances: unknown[], storeRootModule: StoreRootModule, storeFeatureModule: StoreFeatureModule, guard: unknown); | ||
addEffects(effectsInstance: unknown): void; | ||
static ɵfac: i0.ɵɵFactoryDeclaration<EffectsRootModule, [null, null, null, null, { optional: true; }, { optional: true; }, { optional: true; }]>; | ||
@@ -11,0 +11,0 @@ static ɵmod: i0.ɵɵNgModuleDeclaration<EffectsRootModule, never, never, never>; |
@@ -6,3 +6,3 @@ export { createEffect } from './effect_creator'; | ||
export { EffectsErrorHandler, defaultEffectsErrorHandler, } from './effects_error_handler'; | ||
export { EffectsMetadata, CreateEffectMetadata } from './models'; | ||
export { EffectsMetadata, CreateEffectMetadata, FunctionalEffect, } from './models'; | ||
export { Actions, ofType } from './actions'; | ||
@@ -9,0 +9,0 @@ export { EffectsModule } from './effects_module'; |
@@ -0,1 +1,2 @@ | ||
import { Observable } from 'rxjs'; | ||
/** | ||
@@ -11,2 +12,7 @@ * Configures an effect created by `createEffect`. | ||
/** | ||
* Determines whether the functional effect will be created. | ||
* If true, the effect can be created outside the effects class. | ||
*/ | ||
functional?: boolean; | ||
/** | ||
* Determines if the effect will be resubscribed to if an error occurs in the main actions stream. | ||
@@ -21,2 +27,8 @@ */ | ||
} | ||
export interface FunctionalCreateEffectMetadata extends CreateEffectMetadata { | ||
[CREATE_EFFECT_METADATA_KEY]: EffectConfig & { | ||
functional: true; | ||
}; | ||
} | ||
export declare type FunctionalEffect<Source extends () => Observable<unknown> = () => Observable<unknown>> = Source & FunctionalCreateEffectMetadata; | ||
export declare type EffectPropertyKey<T extends Record<keyof T, Object>> = Exclude<keyof T, keyof Object>; | ||
@@ -23,0 +35,0 @@ export interface EffectMetadata<T extends Record<keyof T, Object>> extends Required<EffectConfig> { |
import { EnvironmentProviders, Type } from '@angular/core'; | ||
import { FunctionalEffect } from './models'; | ||
/** | ||
@@ -6,3 +7,3 @@ * Runs the provided effects. | ||
*/ | ||
export declare function provideEffects(effects: Type<unknown>[]): EnvironmentProviders; | ||
export declare function provideEffects(effects: Array<Type<unknown> | Record<string, FunctionalEffect>>): EnvironmentProviders; | ||
/** | ||
@@ -12,2 +13,2 @@ * Runs the provided effects. | ||
*/ | ||
export declare function provideEffects(...effects: Type<unknown>[]): EnvironmentProviders; | ||
export declare function provideEffects(...effects: Array<Type<unknown> | Record<string, FunctionalEffect>>): EnvironmentProviders; |
import { InjectionToken, Type } from '@angular/core'; | ||
import { EffectsErrorHandler } from './effects_error_handler'; | ||
import { FunctionalEffect } from './models'; | ||
export declare const _ROOT_EFFECTS_GUARD: InjectionToken<void>; | ||
export declare const USER_PROVIDED_EFFECTS: InjectionToken<Type<any>[][]>; | ||
export declare const _ROOT_EFFECTS: InjectionToken<Type<any>[]>; | ||
export declare const ROOT_EFFECTS: InjectionToken<Type<any>[]>; | ||
export declare const _FEATURE_EFFECTS: InjectionToken<Type<any>[]>; | ||
export declare const FEATURE_EFFECTS: InjectionToken<any[][]>; | ||
export declare const USER_PROVIDED_EFFECTS: InjectionToken<Type<unknown>[][]>; | ||
export declare const _ROOT_EFFECTS: InjectionToken<[(Type<unknown> | Record<string, FunctionalEffect<() => import("rxjs").Observable<unknown>>>)[]]>; | ||
export declare const _ROOT_EFFECTS_INSTANCES: InjectionToken<unknown[]>; | ||
export declare const _FEATURE_EFFECTS: InjectionToken<(Type<unknown> | Record<string, FunctionalEffect<() => import("rxjs").Observable<unknown>>>)[][]>; | ||
export declare const _FEATURE_EFFECTS_INSTANCE_GROUPS: InjectionToken<unknown[][]>; | ||
export declare const EFFECTS_ERROR_HANDLER: InjectionToken<EffectsErrorHandler>; |
@@ -0,2 +1,6 @@ | ||
import { Type } from '@angular/core'; | ||
export declare function getSourceForInstance<T>(instance: T): T; | ||
export declare function isClassInstance(obj: object): boolean; | ||
export declare function isClass(classOrRecord: Type<unknown> | Record<string, unknown>): classOrRecord is Type<unknown>; | ||
export declare function getClasses(classesAndRecords: Array<Type<unknown> | Record<string, unknown>>): Type<unknown>[]; | ||
export interface NextNotification<T> { | ||
@@ -3,0 +7,0 @@ kind: 'N'; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
584071
5138