@ngrx/effects
Advanced tools
Comparing version 4.0.5 to 4.1.0
@@ -12,48 +12,16 @@ var __extends = (this && this.__extends) || (function () { | ||
import { ScannedActionsSubject, Store, StoreModule, compose } from '@ngrx/store'; | ||
import { merge } from 'rxjs/observable/merge'; | ||
import { ignoreElements } from 'rxjs/operator/ignoreElements'; | ||
import { materialize } from 'rxjs/operator/materialize'; | ||
import { map } from 'rxjs/operator/map'; | ||
import { merge as merge$1 } from 'rxjs/observable/merge'; | ||
import { ignoreElements as ignoreElements$1 } from 'rxjs/operator/ignoreElements'; | ||
import { materialize as materialize$1 } from 'rxjs/operator/materialize'; | ||
import { map as map$1 } from 'rxjs/operator/map'; | ||
import { Inject, Injectable, InjectionToken, NgModule, Optional } from '@angular/core'; | ||
import { Observable } from 'rxjs/Observable'; | ||
import { filter } from 'rxjs/operator/filter'; | ||
import { groupBy } from 'rxjs/operator/groupBy'; | ||
import { mergeMap } from 'rxjs/operator/mergeMap'; | ||
import { exhaustMap } from 'rxjs/operator/exhaustMap'; | ||
import { dematerialize } from 'rxjs/operator/dematerialize'; | ||
import { Subject } from 'rxjs/Subject'; | ||
var METADATA_KEY = '@ngrx/effects'; | ||
var r = Reflect; | ||
import { Observable as Observable$1 } from 'rxjs/Observable'; | ||
import { filter as filter$1 } from 'rxjs/operator/filter'; | ||
import { groupBy as groupBy$1 } from 'rxjs/operator/groupBy'; | ||
import { mergeMap as mergeMap$1 } from 'rxjs/operator/mergeMap'; | ||
import { exhaustMap as exhaustMap$1 } from 'rxjs/operator/exhaustMap'; | ||
import { dematerialize as dematerialize$1 } from 'rxjs/operator/dematerialize'; | ||
import { Subject as Subject$1 } from 'rxjs/Subject'; | ||
var METADATA_KEY = '__@ngrx/effects__'; | ||
/** | ||
* @param {?} sourceType | ||
* @return {?} | ||
*/ | ||
function hasStaticMetadata(sourceType) { | ||
return !!((sourceType)).propDecorators; | ||
} | ||
/** | ||
* @param {?} sourceType | ||
* @return {?} | ||
*/ | ||
function getStaticMetadata(sourceType) { | ||
var /** @type {?} */ propDecorators = sourceType.propDecorators; | ||
return Object.keys(propDecorators).reduce(function (all, key) { return all.concat(getStaticMetadataEntry(propDecorators[key], key)); }, []); | ||
} | ||
/** | ||
* @param {?} metadataEntry | ||
* @param {?} propertyName | ||
* @return {?} | ||
*/ | ||
function getStaticMetadataEntry(metadataEntry, propertyName) { | ||
return metadataEntry | ||
.filter(function (entry) { return entry.type === Effect; }) | ||
.map(function (entry) { | ||
var /** @type {?} */ dispatch = true; | ||
if (entry.args && entry.args.length) { | ||
dispatch = !!entry.args[0].dispatch; | ||
} | ||
return { propertyName: propertyName, dispatch: dispatch }; | ||
}); | ||
} | ||
/** | ||
* @param {?} sourceProto | ||
@@ -63,9 +31,3 @@ * @return {?} | ||
function getEffectMetadataEntries(sourceProto) { | ||
if (hasStaticMetadata(sourceProto.constructor)) { | ||
return getStaticMetadata(sourceProto.constructor); | ||
} | ||
if (r.hasOwnMetadata(METADATA_KEY, sourceProto)) { | ||
return r.getOwnMetadata(METADATA_KEY, sourceProto); | ||
} | ||
return []; | ||
return sourceProto.constructor[METADATA_KEY] || []; | ||
} | ||
@@ -78,6 +40,9 @@ /** | ||
function setEffectMetadataEntries(sourceProto, entries) { | ||
r.defineMetadata(METADATA_KEY, entries, sourceProto); | ||
var /** @type {?} */ constructor = sourceProto.constructor; | ||
var /** @type {?} */ meta = constructor.hasOwnProperty(METADATA_KEY) | ||
? ((constructor))[METADATA_KEY] | ||
: Object.defineProperty(constructor, METADATA_KEY, { value: [] })[METADATA_KEY]; | ||
Array.prototype.push.apply(meta, entries); | ||
} | ||
/** | ||
* \@Annotation | ||
* @param {?=} __0 | ||
@@ -89,5 +54,4 @@ * @return {?} | ||
return function (target, propertyName) { | ||
var /** @type {?} */ effects = getEffectMetadataEntries(target); | ||
var /** @type {?} */ metadata = { propertyName: propertyName, dispatch: dispatch }; | ||
setEffectMetadataEntries(target, effects.concat([metadata])); | ||
setEffectMetadataEntries(target, [metadata]); | ||
}; | ||
@@ -103,2 +67,15 @@ } | ||
var getSourceMetadata = compose(getEffectMetadataEntries, getSourceForInstance); | ||
/** | ||
* @template T | ||
* @param {?} instance | ||
* @return {?} | ||
*/ | ||
function getEffectsMetadata(instance) { | ||
var /** @type {?} */ metadata = {}; | ||
getSourceMetadata(instance).forEach(function (_a) { | ||
var propertyName = _a.propertyName, dispatch = _a.dispatch; | ||
metadata[propertyName] = { dispatch: dispatch }; | ||
}); | ||
return metadata; | ||
} | ||
var onRunEffectsKey = 'ngrxOnRunEffects'; | ||
@@ -125,6 +102,6 @@ /** | ||
if (dispatch === false) { | ||
return ignoreElements.call(observable); | ||
return ignoreElements$1.call(observable); | ||
} | ||
var /** @type {?} */ materialized$ = materialize.call(observable); | ||
return map.call(materialized$, function (notification) { return ({ | ||
var /** @type {?} */ materialized$ = materialize$1.call(observable); | ||
return map$1.call(materialized$, function (notification) { return ({ | ||
effect: sourceInstance[propertyName], | ||
@@ -137,3 +114,3 @@ notification: notification, | ||
}); | ||
return merge.apply(void 0, observables); | ||
return merge$1.apply(void 0, observables); | ||
} | ||
@@ -184,6 +161,6 @@ /** | ||
} | ||
return filter.call(this, function (action) { return allowedTypes.some(function (type) { return type === action.type; }); }); | ||
return filter$1.call(this, function (action) { return allowedTypes.some(function (type) { return type === action.type; }); }); | ||
}; | ||
return Actions; | ||
}(Observable)); | ||
}(Observable$1)); | ||
Actions.decorators = [ | ||
@@ -196,3 +173,3 @@ { type: Injectable }, | ||
Actions.ctorParameters = function () { return [ | ||
{ type: Observable, decorators: [{ type: Inject, args: [ScannedActionsSubject,] },] }, | ||
{ type: Observable$1, decorators: [{ type: Inject, args: [ScannedActionsSubject,] },] }, | ||
]; }; | ||
@@ -316,3 +293,3 @@ /** | ||
var _this = this; | ||
return mergeMap.call(groupBy.call(this, getSourceForInstance), function (source$) { return dematerialize.call(filter.call(map.call(exhaustMap.call(source$, resolveEffectSource), function (output) { | ||
return mergeMap$1.call(groupBy$1.call(this, getSourceForInstance), function (source$) { return dematerialize$1.call(filter$1.call(map$1.call(exhaustMap$1.call(source$, resolveEffectSource), function (output) { | ||
verifyOutput(output, _this.errorReporter); | ||
@@ -323,3 +300,3 @@ return output.notification; | ||
return EffectSources; | ||
}(Subject)); | ||
}(Subject$1)); | ||
EffectSources.decorators = [ | ||
@@ -339,5 +316,5 @@ { type: Injectable }, | ||
*/ | ||
function EffectsRunner(effectSources, store) { | ||
function EffectsRunner(effectSources, store$$1) { | ||
this.effectSources = effectSources; | ||
this.store = store; | ||
this.store = store$$1; | ||
this.effectsSubscription = null; | ||
@@ -376,2 +353,3 @@ } | ||
]; }; | ||
var ROOT_EFFECTS_INIT = '@ngrx/effects/init'; | ||
var EffectsRootModule = (function () { | ||
@@ -381,9 +359,11 @@ /** | ||
* @param {?} runner | ||
* @param {?} store | ||
* @param {?} rootEffects | ||
* @param {?} storeModule | ||
*/ | ||
function EffectsRootModule(sources, runner, rootEffects, storeModule) { | ||
function EffectsRootModule(sources, runner, store$$1, rootEffects, storeModule) { | ||
this.sources = sources; | ||
runner.start(); | ||
rootEffects.forEach(function (effectSourceInstance) { return sources.addEffects(effectSourceInstance); }); | ||
store$$1.dispatch({ type: ROOT_EFFECTS_INIT }); | ||
} | ||
@@ -408,2 +388,3 @@ /** | ||
{ type: EffectsRunner, }, | ||
{ type: Store, }, | ||
{ type: Array, decorators: [{ type: Inject, args: [ROOT_EFFECTS,] },] }, | ||
@@ -518,3 +499,3 @@ { type: StoreModule, decorators: [{ type: Optional },] }, | ||
*/ | ||
export { Effect, mergeEffects, Actions, EffectsModule, EffectSources, toPayload, EffectsFeatureModule as ɵc, createSourceInstances as ɵa, getConsole as ɵb, EffectsRootModule as ɵg, EffectsRunner as ɵi, ErrorReporter as ɵh, CONSOLE as ɵf, FEATURE_EFFECTS as ɵe, ROOT_EFFECTS as ɵd }; | ||
export { Effect, getEffectsMetadata, mergeEffects, Actions, EffectsModule, EffectSources, toPayload, ROOT_EFFECTS_INIT, EffectsFeatureModule as ɵd, createSourceInstances as ɵa, getConsole as ɵb, EffectsRootModule as ɵc, EffectsRunner as ɵi, ErrorReporter as ɵh, CONSOLE as ɵg, FEATURE_EFFECTS as ɵf, ROOT_EFFECTS as ɵe }; | ||
//# sourceMappingURL=effects.es5.js.map |
import { ScannedActionsSubject, Store, StoreModule, compose } from '@ngrx/store'; | ||
import { merge } from 'rxjs/observable/merge'; | ||
import { ignoreElements } from 'rxjs/operator/ignoreElements'; | ||
import { materialize } from 'rxjs/operator/materialize'; | ||
import { map } from 'rxjs/operator/map'; | ||
import { merge as merge$1 } from 'rxjs/observable/merge'; | ||
import { ignoreElements as ignoreElements$1 } from 'rxjs/operator/ignoreElements'; | ||
import { materialize as materialize$1 } from 'rxjs/operator/materialize'; | ||
import { map as map$1 } from 'rxjs/operator/map'; | ||
import { Inject, Injectable, InjectionToken, NgModule, Optional } from '@angular/core'; | ||
import { Observable } from 'rxjs/Observable'; | ||
import { filter } from 'rxjs/operator/filter'; | ||
import { groupBy } from 'rxjs/operator/groupBy'; | ||
import { mergeMap } from 'rxjs/operator/mergeMap'; | ||
import { exhaustMap } from 'rxjs/operator/exhaustMap'; | ||
import { dematerialize } from 'rxjs/operator/dematerialize'; | ||
import { Subject } from 'rxjs/Subject'; | ||
import { Observable as Observable$1 } from 'rxjs/Observable'; | ||
import { filter as filter$1 } from 'rxjs/operator/filter'; | ||
import { groupBy as groupBy$1 } from 'rxjs/operator/groupBy'; | ||
import { mergeMap as mergeMap$1 } from 'rxjs/operator/mergeMap'; | ||
import { exhaustMap as exhaustMap$1 } from 'rxjs/operator/exhaustMap'; | ||
import { dematerialize as dematerialize$1 } from 'rxjs/operator/dematerialize'; | ||
import { Subject as Subject$1 } from 'rxjs/Subject'; | ||
const METADATA_KEY = '@ngrx/effects'; | ||
const r = Reflect; | ||
const METADATA_KEY = '__@ngrx/effects__'; | ||
/** | ||
* @param {?} sourceType | ||
* @return {?} | ||
*/ | ||
function hasStaticMetadata(sourceType) { | ||
return !!((sourceType)).propDecorators; | ||
} | ||
/** | ||
* @param {?} sourceType | ||
* @return {?} | ||
*/ | ||
function getStaticMetadata(sourceType) { | ||
const /** @type {?} */ propDecorators = sourceType.propDecorators; | ||
return Object.keys(propDecorators).reduce((all, key) => all.concat(getStaticMetadataEntry(propDecorators[key], key)), []); | ||
} | ||
/** | ||
* @param {?} metadataEntry | ||
* @param {?} propertyName | ||
* @return {?} | ||
*/ | ||
function getStaticMetadataEntry(metadataEntry, propertyName) { | ||
return metadataEntry | ||
.filter((entry) => entry.type === Effect) | ||
.map((entry) => { | ||
let /** @type {?} */ dispatch = true; | ||
if (entry.args && entry.args.length) { | ||
dispatch = !!entry.args[0].dispatch; | ||
} | ||
return { propertyName, dispatch }; | ||
}); | ||
} | ||
/** | ||
* @param {?} sourceProto | ||
@@ -53,9 +21,3 @@ * @return {?} | ||
function getEffectMetadataEntries(sourceProto) { | ||
if (hasStaticMetadata(sourceProto.constructor)) { | ||
return getStaticMetadata(sourceProto.constructor); | ||
} | ||
if (r.hasOwnMetadata(METADATA_KEY, sourceProto)) { | ||
return r.getOwnMetadata(METADATA_KEY, sourceProto); | ||
} | ||
return []; | ||
return sourceProto.constructor[METADATA_KEY] || []; | ||
} | ||
@@ -68,6 +30,9 @@ /** | ||
function setEffectMetadataEntries(sourceProto, entries) { | ||
r.defineMetadata(METADATA_KEY, entries, sourceProto); | ||
const /** @type {?} */ constructor = sourceProto.constructor; | ||
const /** @type {?} */ meta = constructor.hasOwnProperty(METADATA_KEY) | ||
? ((constructor))[METADATA_KEY] | ||
: Object.defineProperty(constructor, METADATA_KEY, { value: [] })[METADATA_KEY]; | ||
Array.prototype.push.apply(meta, entries); | ||
} | ||
/** | ||
* \@Annotation | ||
* @param {?=} __0 | ||
@@ -78,5 +43,4 @@ * @return {?} | ||
return function (target, propertyName) { | ||
const /** @type {?} */ effects = getEffectMetadataEntries(target); | ||
const /** @type {?} */ metadata = { propertyName, dispatch }; | ||
setEffectMetadataEntries(target, [...effects, metadata]); | ||
setEffectMetadataEntries(target, [metadata]); | ||
}; | ||
@@ -92,2 +56,14 @@ } | ||
const getSourceMetadata = compose(getEffectMetadataEntries, getSourceForInstance); | ||
/** | ||
* @template T | ||
* @param {?} instance | ||
* @return {?} | ||
*/ | ||
function getEffectsMetadata(instance) { | ||
const /** @type {?} */ metadata = {}; | ||
getSourceMetadata(instance).forEach(({ propertyName, dispatch }) => { | ||
metadata[propertyName] = { dispatch }; | ||
}); | ||
return metadata; | ||
} | ||
@@ -115,6 +91,6 @@ const onRunEffectsKey = 'ngrxOnRunEffects'; | ||
if (dispatch === false) { | ||
return ignoreElements.call(observable); | ||
return ignoreElements$1.call(observable); | ||
} | ||
const /** @type {?} */ materialized$ = materialize.call(observable); | ||
return map.call(materialized$, (notification) => ({ | ||
const /** @type {?} */ materialized$ = materialize$1.call(observable); | ||
return map$1.call(materialized$, (notification) => ({ | ||
effect: sourceInstance[propertyName], | ||
@@ -127,3 +103,3 @@ notification, | ||
}); | ||
return merge(...observables); | ||
return merge$1(...observables); | ||
} | ||
@@ -142,3 +118,3 @@ /** | ||
class Actions extends Observable { | ||
class Actions extends Observable$1 { | ||
/** | ||
@@ -170,3 +146,3 @@ * @param {?=} source | ||
ofType(...allowedTypes) { | ||
return filter.call(this, (action) => allowedTypes.some(type => type === action.type)); | ||
return filter$1.call(this, (action) => allowedTypes.some(type => type === action.type)); | ||
} | ||
@@ -181,3 +157,3 @@ } | ||
Actions.ctorParameters = () => [ | ||
{ type: Observable, decorators: [{ type: Inject, args: [ScannedActionsSubject,] },] }, | ||
{ type: Observable$1, decorators: [{ type: Inject, args: [ScannedActionsSubject,] },] }, | ||
]; | ||
@@ -281,3 +257,3 @@ | ||
class EffectSources extends Subject { | ||
class EffectSources extends Subject$1 { | ||
/** | ||
@@ -301,3 +277,3 @@ * @param {?} errorReporter | ||
toActions() { | ||
return mergeMap.call(groupBy.call(this, getSourceForInstance), (source$) => dematerialize.call(filter.call(map.call(exhaustMap.call(source$, resolveEffectSource), (output) => { | ||
return mergeMap$1.call(groupBy$1.call(this, getSourceForInstance), (source$) => dematerialize$1.call(filter$1.call(map$1.call(exhaustMap$1.call(source$, resolveEffectSource), (output) => { | ||
verifyOutput(output, this.errorReporter); | ||
@@ -323,5 +299,5 @@ return output.notification; | ||
*/ | ||
constructor(effectSources, store) { | ||
constructor(effectSources, store$$1) { | ||
this.effectSources = effectSources; | ||
this.store = store; | ||
this.store = store$$1; | ||
this.effectsSubscription = null; | ||
@@ -360,2 +336,3 @@ } | ||
const ROOT_EFFECTS_INIT = '@ngrx/effects/init'; | ||
class EffectsRootModule { | ||
@@ -365,9 +342,11 @@ /** | ||
* @param {?} runner | ||
* @param {?} store | ||
* @param {?} rootEffects | ||
* @param {?} storeModule | ||
*/ | ||
constructor(sources, runner, rootEffects, storeModule) { | ||
constructor(sources, runner, store$$1, rootEffects, storeModule) { | ||
this.sources = sources; | ||
runner.start(); | ||
rootEffects.forEach(effectSourceInstance => sources.addEffects(effectSourceInstance)); | ||
store$$1.dispatch({ type: ROOT_EFFECTS_INIT }); | ||
} | ||
@@ -391,2 +370,3 @@ /** | ||
{ type: EffectsRunner, }, | ||
{ type: Store, }, | ||
{ type: Array, decorators: [{ type: Inject, args: [ROOT_EFFECTS,] },] }, | ||
@@ -498,3 +478,3 @@ { type: StoreModule, decorators: [{ type: Optional },] }, | ||
export { Effect, mergeEffects, Actions, EffectsModule, EffectSources, toPayload, EffectsFeatureModule as ɵc, createSourceInstances as ɵa, getConsole as ɵb, EffectsRootModule as ɵg, EffectsRunner as ɵi, ErrorReporter as ɵh, CONSOLE as ɵf, FEATURE_EFFECTS as ɵe, ROOT_EFFECTS as ɵd }; | ||
export { Effect, getEffectsMetadata, mergeEffects, Actions, EffectsModule, EffectSources, toPayload, ROOT_EFFECTS_INIT, EffectsFeatureModule as ɵd, createSourceInstances as ɵa, getConsole as ɵb, EffectsRootModule as ɵc, EffectsRunner as ɵi, ErrorReporter as ɵh, CONSOLE as ɵg, FEATURE_EFFECTS as ɵf, ROOT_EFFECTS as ɵe }; | ||
//# sourceMappingURL=effects.js.map |
import { Actions } from '@ngrx/effects'; | ||
import { defer } from 'rxjs/observable/defer'; | ||
import { defer as defer$1 } from 'rxjs/observable/defer'; | ||
function provideMockActions(factoryOrSource) { | ||
@@ -8,3 +8,3 @@ return { | ||
if (typeof factoryOrSource === 'function') { | ||
return new Actions(defer(factoryOrSource)); | ||
return new Actions(defer$1(factoryOrSource)); | ||
} | ||
@@ -11,0 +11,0 @@ return new Actions(factoryOrSource); |
import { Actions } from '@ngrx/effects'; | ||
import { defer } from 'rxjs/observable/defer'; | ||
import { defer as defer$1 } from 'rxjs/observable/defer'; | ||
@@ -9,3 +9,3 @@ function provideMockActions(factoryOrSource) { | ||
if (typeof factoryOrSource === 'function') { | ||
return new Actions(defer(factoryOrSource)); | ||
return new Actions(defer$1(factoryOrSource)); | ||
} | ||
@@ -12,0 +12,0 @@ return new Actions(factoryOrSource); |
(function (global, factory) { | ||
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@ngrx/effects'), require('rxjs/observable/defer')) : | ||
typeof define === 'function' && define.amd ? define(['exports', '@ngrx/effects', 'rxjs/observable/defer'], factory) : | ||
(factory((global.ngrx = global.ngrx || {}, global.ngrx.effects = global.ngrx.effects || {}, global.ngrx.effects.testing = global.ngrx.effects.testing || {}),global.ngrx.effects,global.Rx.Observable.defer)); | ||
}(this, (function (exports,_ngrx_effects,rxjs_observable_defer) { 'use strict'; | ||
(factory((global.ngrx = global.ngrx || {}, global.ngrx.effects = global.ngrx.effects || {}, global.ngrx.effects.testing = {}),global.ngrx.effects,global.Rx.Observable.defer)); | ||
}(this, (function (exports,effects,defer) { 'use strict'; | ||
function provideMockActions(factoryOrSource) { | ||
return { | ||
provide: _ngrx_effects.Actions, | ||
provide: effects.Actions, | ||
useFactory: function () { | ||
if (typeof factoryOrSource === 'function') { | ||
return new _ngrx_effects.Actions(rxjs_observable_defer.defer(factoryOrSource)); | ||
return new effects.Actions(defer.defer(factoryOrSource)); | ||
} | ||
return new _ngrx_effects.Actions(factoryOrSource); | ||
return new effects.Actions(factoryOrSource); | ||
}, | ||
@@ -16,0 +16,0 @@ }; |
@@ -1,2 +0,2 @@ | ||
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports,require("@ngrx/effects"),require("rxjs/observable/defer")):"function"==typeof define&&define.amd?define(["exports","@ngrx/effects","rxjs/observable/defer"],n):n((e.ngrx=e.ngrx||{},e.ngrx.effects=e.ngrx.effects||{},e.ngrx.effects.testing=e.ngrx.effects.testing||{}),e.ngrx.effects,e.Rx.Observable.defer)}(this,function(e,n,t){"use strict";function r(e){return{provide:n.Actions,useFactory:function(){return"function"==typeof e?new n.Actions(t.defer(e)):new n.Actions(e)}}}e.provideMockActions=r,Object.defineProperty(e,"__esModule",{value:!0})}); | ||
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports,require("@ngrx/effects"),require("rxjs/observable/defer")):"function"==typeof define&&define.amd?define(["exports","@ngrx/effects","rxjs/observable/defer"],n):n((e.ngrx=e.ngrx||{},e.ngrx.effects=e.ngrx.effects||{},e.ngrx.effects.testing={}),e.ngrx.effects,e.Rx.Observable.defer)}(this,function(e,n,r){"use strict";function t(e){return{provide:n.Actions,useFactory:function(){return"function"==typeof e?new n.Actions(r.defer(e)):new n.Actions(e)}}}e.provideMockActions=t,Object.defineProperty(e,"__esModule",{value:!0})}); | ||
//# sourceMappingURL=./dist/effects/bundles/effects-testing.umd.min.js.map |
(function (global, factory) { | ||
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@ngrx/store'), require('rxjs/observable/merge'), require('rxjs/operator/ignoreElements'), require('rxjs/operator/materialize'), require('rxjs/operator/map'), require('@angular/core'), require('rxjs/Observable'), require('rxjs/operator/filter'), require('rxjs/operator/groupBy'), require('rxjs/operator/mergeMap'), require('rxjs/operator/exhaustMap'), require('rxjs/operator/dematerialize'), require('rxjs/Subject')) : | ||
typeof define === 'function' && define.amd ? define(['exports', '@ngrx/store', 'rxjs/observable/merge', 'rxjs/operator/ignoreElements', 'rxjs/operator/materialize', 'rxjs/operator/map', '@angular/core', 'rxjs/Observable', 'rxjs/operator/filter', 'rxjs/operator/groupBy', 'rxjs/operator/mergeMap', 'rxjs/operator/exhaustMap', 'rxjs/operator/dematerialize', 'rxjs/Subject'], factory) : | ||
(factory((global.ngrx = global.ngrx || {}, global.ngrx.effects = global.ngrx.effects || {}),global.ngrx.store,global.Rx.Observable,global.Rx.Observable.prototype,global.rxjs_operator_materialize,global.rxjs_operator_map,global.ng.core,global.Rx,global.Rx.Observable.prototype,global.rxjs_operator_groupBy,global.rxjs_operator_mergeMap,global.rxjs_operator_exhaustMap,global.rxjs_operator_dematerialize,global.rxjs_Subject)); | ||
}(this, (function (exports,_ngrx_store,rxjs_observable_merge,rxjs_operator_ignoreElements,rxjs_operator_materialize,rxjs_operator_map,_angular_core,rxjs_Observable,rxjs_operator_filter,rxjs_operator_groupBy,rxjs_operator_mergeMap,rxjs_operator_exhaustMap,rxjs_operator_dematerialize,rxjs_Subject) { 'use strict'; | ||
(factory((global.ngrx = global.ngrx || {}, global.ngrx.effects = {}),global.ngrx.store,global.Rx.Observable,global.Rx.Observable.prototype,global.materialize,global.map,global.ng.core,global.Rx,global.Rx.Observable.prototype,global.groupBy,global.mergeMap,global.exhaustMap,global.dematerialize,global.Subject)); | ||
}(this, (function (exports,store,merge,ignoreElements,materialize,map,core,Observable,filter,groupBy,mergeMap,exhaustMap,dematerialize,Subject) { 'use strict'; | ||
@@ -17,36 +17,4 @@ var __extends = (undefined && undefined.__extends) || (function () { | ||
})(); | ||
var METADATA_KEY = '@ngrx/effects'; | ||
var r = Reflect; | ||
var METADATA_KEY = '__@ngrx/effects__'; | ||
/** | ||
* @param {?} sourceType | ||
* @return {?} | ||
*/ | ||
function hasStaticMetadata(sourceType) { | ||
return !!((sourceType)).propDecorators; | ||
} | ||
/** | ||
* @param {?} sourceType | ||
* @return {?} | ||
*/ | ||
function getStaticMetadata(sourceType) { | ||
var /** @type {?} */ propDecorators = sourceType.propDecorators; | ||
return Object.keys(propDecorators).reduce(function (all, key) { return all.concat(getStaticMetadataEntry(propDecorators[key], key)); }, []); | ||
} | ||
/** | ||
* @param {?} metadataEntry | ||
* @param {?} propertyName | ||
* @return {?} | ||
*/ | ||
function getStaticMetadataEntry(metadataEntry, propertyName) { | ||
return metadataEntry | ||
.filter(function (entry) { return entry.type === Effect; }) | ||
.map(function (entry) { | ||
var /** @type {?} */ dispatch = true; | ||
if (entry.args && entry.args.length) { | ||
dispatch = !!entry.args[0].dispatch; | ||
} | ||
return { propertyName: propertyName, dispatch: dispatch }; | ||
}); | ||
} | ||
/** | ||
* @param {?} sourceProto | ||
@@ -56,9 +24,3 @@ * @return {?} | ||
function getEffectMetadataEntries(sourceProto) { | ||
if (hasStaticMetadata(sourceProto.constructor)) { | ||
return getStaticMetadata(sourceProto.constructor); | ||
} | ||
if (r.hasOwnMetadata(METADATA_KEY, sourceProto)) { | ||
return r.getOwnMetadata(METADATA_KEY, sourceProto); | ||
} | ||
return []; | ||
return sourceProto.constructor[METADATA_KEY] || []; | ||
} | ||
@@ -71,6 +33,9 @@ /** | ||
function setEffectMetadataEntries(sourceProto, entries) { | ||
r.defineMetadata(METADATA_KEY, entries, sourceProto); | ||
var /** @type {?} */ constructor = sourceProto.constructor; | ||
var /** @type {?} */ meta = constructor.hasOwnProperty(METADATA_KEY) | ||
? ((constructor))[METADATA_KEY] | ||
: Object.defineProperty(constructor, METADATA_KEY, { value: [] })[METADATA_KEY]; | ||
Array.prototype.push.apply(meta, entries); | ||
} | ||
/** | ||
* \@Annotation | ||
* @param {?=} __0 | ||
@@ -82,5 +47,4 @@ * @return {?} | ||
return function (target, propertyName) { | ||
var /** @type {?} */ effects = getEffectMetadataEntries(target); | ||
var /** @type {?} */ metadata = { propertyName: propertyName, dispatch: dispatch }; | ||
setEffectMetadataEntries(target, effects.concat([metadata])); | ||
setEffectMetadataEntries(target, [metadata]); | ||
}; | ||
@@ -95,3 +59,16 @@ } | ||
} | ||
var getSourceMetadata = _ngrx_store.compose(getEffectMetadataEntries, getSourceForInstance); | ||
var getSourceMetadata = store.compose(getEffectMetadataEntries, getSourceForInstance); | ||
/** | ||
* @template T | ||
* @param {?} instance | ||
* @return {?} | ||
*/ | ||
function getEffectsMetadata(instance) { | ||
var /** @type {?} */ metadata = {}; | ||
getSourceMetadata(instance).forEach(function (_a) { | ||
var propertyName = _a.propertyName, dispatch = _a.dispatch; | ||
metadata[propertyName] = { dispatch: dispatch }; | ||
}); | ||
return metadata; | ||
} | ||
var onRunEffectsKey = 'ngrxOnRunEffects'; | ||
@@ -118,6 +95,6 @@ /** | ||
if (dispatch === false) { | ||
return rxjs_operator_ignoreElements.ignoreElements.call(observable); | ||
return ignoreElements.ignoreElements.call(observable); | ||
} | ||
var /** @type {?} */ materialized$ = rxjs_operator_materialize.materialize.call(observable); | ||
return rxjs_operator_map.map.call(materialized$, function (notification) { return ({ | ||
var /** @type {?} */ materialized$ = materialize.materialize.call(observable); | ||
return map.map.call(materialized$, function (notification) { return ({ | ||
effect: sourceInstance[propertyName], | ||
@@ -130,3 +107,3 @@ notification: notification, | ||
}); | ||
return rxjs_observable_merge.merge.apply(void 0, observables); | ||
return merge.merge.apply(void 0, observables); | ||
} | ||
@@ -177,8 +154,8 @@ /** | ||
} | ||
return rxjs_operator_filter.filter.call(this, function (action) { return allowedTypes.some(function (type) { return type === action.type; }); }); | ||
return filter.filter.call(this, function (action) { return allowedTypes.some(function (type) { return type === action.type; }); }); | ||
}; | ||
return Actions; | ||
}(rxjs_Observable.Observable)); | ||
}(Observable.Observable)); | ||
Actions.decorators = [ | ||
{ type: _angular_core.Injectable }, | ||
{ type: core.Injectable }, | ||
]; | ||
@@ -189,3 +166,3 @@ /** | ||
Actions.ctorParameters = function () { return [ | ||
{ type: rxjs_Observable.Observable, decorators: [{ type: _angular_core.Inject, args: [_ngrx_store.ScannedActionsSubject,] },] }, | ||
{ type: Observable.Observable, decorators: [{ type: core.Inject, args: [store.ScannedActionsSubject,] },] }, | ||
]; }; | ||
@@ -253,6 +230,6 @@ /** | ||
} | ||
var IMMEDIATE_EFFECTS = new _angular_core.InjectionToken('ngrx/effects: Immediate Effects'); | ||
var ROOT_EFFECTS = new _angular_core.InjectionToken('ngrx/effects: Root Effects'); | ||
var FEATURE_EFFECTS = new _angular_core.InjectionToken('ngrx/effects: Feature Effects'); | ||
var CONSOLE = new _angular_core.InjectionToken('Browser Console'); | ||
var IMMEDIATE_EFFECTS = new core.InjectionToken('ngrx/effects: Immediate Effects'); | ||
var ROOT_EFFECTS = new core.InjectionToken('ngrx/effects: Root Effects'); | ||
var FEATURE_EFFECTS = new core.InjectionToken('ngrx/effects: Feature Effects'); | ||
var CONSOLE = new core.InjectionToken('Browser Console'); | ||
var ErrorReporter = (function () { | ||
@@ -280,3 +257,3 @@ /** | ||
ErrorReporter.decorators = [ | ||
{ type: _angular_core.Injectable }, | ||
{ type: core.Injectable }, | ||
]; | ||
@@ -287,3 +264,3 @@ /** | ||
ErrorReporter.ctorParameters = function () { return [ | ||
{ type: undefined, decorators: [{ type: _angular_core.Inject, args: [CONSOLE,] },] }, | ||
{ type: undefined, decorators: [{ type: core.Inject, args: [CONSOLE,] },] }, | ||
]; }; | ||
@@ -312,3 +289,3 @@ var EffectSources = (function (_super) { | ||
var _this = this; | ||
return rxjs_operator_mergeMap.mergeMap.call(rxjs_operator_groupBy.groupBy.call(this, getSourceForInstance), function (source$) { return rxjs_operator_dematerialize.dematerialize.call(rxjs_operator_filter.filter.call(rxjs_operator_map.map.call(rxjs_operator_exhaustMap.exhaustMap.call(source$, resolveEffectSource), function (output) { | ||
return mergeMap.mergeMap.call(groupBy.groupBy.call(this, getSourceForInstance), function (source$) { return dematerialize.dematerialize.call(filter.filter.call(map.map.call(exhaustMap.exhaustMap.call(source$, resolveEffectSource), function (output) { | ||
verifyOutput(output, _this.errorReporter); | ||
@@ -319,5 +296,5 @@ return output.notification; | ||
return EffectSources; | ||
}(rxjs_Subject.Subject)); | ||
}(Subject.Subject)); | ||
EffectSources.decorators = [ | ||
{ type: _angular_core.Injectable }, | ||
{ type: core.Injectable }, | ||
]; | ||
@@ -335,5 +312,5 @@ /** | ||
*/ | ||
function EffectsRunner(effectSources, store) { | ||
function EffectsRunner(effectSources, store$$1) { | ||
this.effectSources = effectSources; | ||
this.store = store; | ||
this.store = store$$1; | ||
this.effectsSubscription = null; | ||
@@ -363,3 +340,3 @@ } | ||
EffectsRunner.decorators = [ | ||
{ type: _angular_core.Injectable }, | ||
{ type: core.Injectable }, | ||
]; | ||
@@ -371,4 +348,5 @@ /** | ||
{ type: EffectSources, }, | ||
{ type: _ngrx_store.Store, }, | ||
{ type: store.Store, }, | ||
]; }; | ||
var ROOT_EFFECTS_INIT = '@ngrx/effects/init'; | ||
var EffectsRootModule = (function () { | ||
@@ -378,9 +356,11 @@ /** | ||
* @param {?} runner | ||
* @param {?} store | ||
* @param {?} rootEffects | ||
* @param {?} storeModule | ||
*/ | ||
function EffectsRootModule(sources, runner, rootEffects, storeModule) { | ||
function EffectsRootModule(sources, runner, store$$1, rootEffects, storeModule) { | ||
this.sources = sources; | ||
runner.start(); | ||
rootEffects.forEach(function (effectSourceInstance) { return sources.addEffects(effectSourceInstance); }); | ||
store$$1.dispatch({ type: ROOT_EFFECTS_INIT }); | ||
} | ||
@@ -397,3 +377,3 @@ /** | ||
EffectsRootModule.decorators = [ | ||
{ type: _angular_core.NgModule, args: [{},] }, | ||
{ type: core.NgModule, args: [{},] }, | ||
]; | ||
@@ -406,4 +386,5 @@ /** | ||
{ type: EffectsRunner, }, | ||
{ type: Array, decorators: [{ type: _angular_core.Inject, args: [ROOT_EFFECTS,] },] }, | ||
{ type: _ngrx_store.StoreModule, decorators: [{ type: _angular_core.Optional },] }, | ||
{ type: store.Store, }, | ||
{ type: Array, decorators: [{ type: core.Inject, args: [ROOT_EFFECTS,] },] }, | ||
{ type: store.StoreModule, decorators: [{ type: core.Optional },] }, | ||
]; }; | ||
@@ -423,3 +404,3 @@ var EffectsFeatureModule = (function () { | ||
EffectsFeatureModule.decorators = [ | ||
{ type: _angular_core.NgModule, args: [{},] }, | ||
{ type: core.NgModule, args: [{},] }, | ||
]; | ||
@@ -431,4 +412,4 @@ /** | ||
{ type: EffectsRootModule, }, | ||
{ type: Array, decorators: [{ type: _angular_core.Inject, args: [FEATURE_EFFECTS,] },] }, | ||
{ type: _ngrx_store.StoreModule, decorators: [{ type: _angular_core.Optional },] }, | ||
{ type: Array, decorators: [{ type: core.Inject, args: [FEATURE_EFFECTS,] },] }, | ||
{ type: store.StoreModule, decorators: [{ type: core.Optional },] }, | ||
]; }; | ||
@@ -484,3 +465,3 @@ var EffectsModule = (function () { | ||
EffectsModule.decorators = [ | ||
{ type: _angular_core.NgModule, args: [{},] }, | ||
{ type: core.NgModule, args: [{},] }, | ||
]; | ||
@@ -518,2 +499,3 @@ /** | ||
exports.Effect = Effect; | ||
exports.getEffectsMetadata = getEffectsMetadata; | ||
exports.mergeEffects = mergeEffects; | ||
@@ -524,11 +506,12 @@ exports.Actions = Actions; | ||
exports.toPayload = toPayload; | ||
exports.ɵc = EffectsFeatureModule; | ||
exports.ROOT_EFFECTS_INIT = ROOT_EFFECTS_INIT; | ||
exports.ɵd = EffectsFeatureModule; | ||
exports.ɵa = createSourceInstances; | ||
exports.ɵb = getConsole; | ||
exports.ɵg = EffectsRootModule; | ||
exports.ɵc = EffectsRootModule; | ||
exports.ɵi = EffectsRunner; | ||
exports.ɵh = ErrorReporter; | ||
exports.ɵf = CONSOLE; | ||
exports.ɵe = FEATURE_EFFECTS; | ||
exports.ɵd = ROOT_EFFECTS; | ||
exports.ɵg = CONSOLE; | ||
exports.ɵf = FEATURE_EFFECTS; | ||
exports.ɵe = ROOT_EFFECTS; | ||
@@ -535,0 +518,0 @@ Object.defineProperty(exports, '__esModule', { value: true }); |
@@ -1,2 +0,2 @@ | ||
!function(r,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("@ngrx/store"),require("rxjs/observable/merge"),require("rxjs/operator/ignoreElements"),require("rxjs/operator/materialize"),require("rxjs/operator/map"),require("@angular/core"),require("rxjs/Observable"),require("rxjs/operator/filter"),require("rxjs/operator/groupBy"),require("rxjs/operator/mergeMap"),require("rxjs/operator/exhaustMap"),require("rxjs/operator/dematerialize"),require("rxjs/Subject")):"function"==typeof define&&define.amd?define(["exports","@ngrx/store","rxjs/observable/merge","rxjs/operator/ignoreElements","rxjs/operator/materialize","rxjs/operator/map","@angular/core","rxjs/Observable","rxjs/operator/filter","rxjs/operator/groupBy","rxjs/operator/mergeMap","rxjs/operator/exhaustMap","rxjs/operator/dematerialize","rxjs/Subject"],e):e((r.ngrx=r.ngrx||{},r.ngrx.effects=r.ngrx.effects||{}),r.ngrx.store,r.Rx.Observable,r.Rx.Observable.prototype,r.rxjs_operator_materialize,r.rxjs_operator_map,r.ng.core,r.Rx,r.Rx.Observable.prototype,r.rxjs_operator_groupBy,r.rxjs_operator_mergeMap,r.rxjs_operator_exhaustMap,r.rxjs_operator_dematerialize,r.rxjs_Subject)}(this,function(r,e,t,o,n,c,a,i,s,u,f,p,l,d){"use strict";function y(r){return!!r.propDecorators}function g(r){var e=r.propDecorators;return Object.keys(e).reduce(function(r,t){return r.concat(x(e[t],t))},[])}function x(r,e){return r.filter(function(r){return r.type===v}).map(function(r){var t=!0;return r.args&&r.args.length&&(t=!!r.args[0].dispatch),{propertyName:e,dispatch:t}})}function j(r){return y(r.constructor)?g(r.constructor):z.hasOwnMetadata(k,r)?z.getOwnMetadata(k,r):[]}function h(r,e){z.defineMetadata(k,e,r)}function v(r){var e=(void 0===r?{dispatch:!0}:r).dispatch;return function(r,t){var o=j(r),n={propertyName:t,dispatch:e};h(r,o.concat([n]))}}function m(r){return Object.getPrototypeOf(r)}function b(r){var e=m(r);return B in e&&"function"==typeof e[B]}function E(r){var e=m(r).constructor.name,a=A(r).map(function(t){var a=t.propertyName,i=t.dispatch,s="function"==typeof r[a]?r[a]():r[a];if(!1===i)return o.ignoreElements.call(s);var u=n.materialize.call(s);return c.map.call(u,function(t){return{effect:r[a],notification:t,propertyName:a,sourceName:e,sourceInstance:r}})});return t.merge.apply(void 0,a)}function _(r){var e=E(r);return b(r)?r.ngrxOnRunEffects(e):e}function O(r,e){M(r,e),S(r,e)}function M(r,e){if("E"===r.notification.kind){var t="Effect "+N(r)+" threw an error";e.report(t,{Source:r.sourceInstance,Effect:r.effect,Error:r.notification.error,Notification:r.notification})}}function S(r,e){if("N"===r.notification.kind){var t=r.notification.value;if(!I(t)){var o="Effect "+N(r)+" dispatched an invalid action";e.report(o,{Source:r.sourceInstance,Effect:r.effect,Dispatched:t,Notification:r.notification})}}}function I(r){return r&&r.type&&"string"==typeof r.type}function N(r){var e=r.propertyName,t=r.sourceInstance;return'"'+r.sourceName+"."+e+("function"==typeof t[e]?"()":"")+'"'}function q(){for(var r=[],e=0;e<arguments.length;e++)r[e]=arguments[e];return r}function P(){return console}function w(r){return r.payload}var R=function(){var r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,e){r.__proto__=e}||function(r,e){for(var t in e)e.hasOwnProperty(t)&&(r[t]=e[t])};return function(e,t){function o(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(o.prototype=t.prototype,new o)}}(),k="@ngrx/effects",z=Reflect,A=e.compose(j,m),B="ngrxOnRunEffects",F=function(r){function e(e){var t=r.call(this)||this;return e&&(t.source=e),t}return R(e,r),e.prototype.lift=function(r){var t=new e;return t.source=this,t.operator=r,t},e.prototype.ofType=function(){for(var r=[],e=0;e<arguments.length;e++)r[e]=arguments[e];return s.filter.call(this,function(e){return r.some(function(r){return r===e.type})})},e}(i.Observable);F.decorators=[{type:a.Injectable}],F.ctorParameters=function(){return[{type:i.Observable,decorators:[{type:a.Inject,args:[e.ScannedActionsSubject]}]}]};var T=(new a.InjectionToken("ngrx/effects: Immediate Effects"),new a.InjectionToken("ngrx/effects: Root Effects")),D=new a.InjectionToken("ngrx/effects: Feature Effects"),C=new a.InjectionToken("Browser Console"),G=function(){function r(r){this.console=r}return r.prototype.report=function(r,e){this.console.group(r);for(var t in e)this.console.error(t+":",e[t]);this.console.groupEnd()},r}();G.decorators=[{type:a.Injectable}],G.ctorParameters=function(){return[{type:void 0,decorators:[{type:a.Inject,args:[C]}]}]};var H=function(r){function e(e){var t=r.call(this)||this;return t.errorReporter=e,t}return R(e,r),e.prototype.addEffects=function(r){this.next(r)},e.prototype.toActions=function(){var r=this;return f.mergeMap.call(u.groupBy.call(this,m),function(e){return l.dematerialize.call(s.filter.call(c.map.call(p.exhaustMap.call(e,_),function(e){return O(e,r.errorReporter),e.notification}),function(r){return"N"===r.kind}))})},e}(d.Subject);H.decorators=[{type:a.Injectable}],H.ctorParameters=function(){return[{type:G}]};var J=function(){function r(r,e){this.effectSources=r,this.store=e,this.effectsSubscription=null}return r.prototype.start=function(){this.effectsSubscription||(this.effectsSubscription=this.effectSources.toActions().subscribe(this.store))},r.prototype.ngOnDestroy=function(){this.effectsSubscription&&(this.effectsSubscription.unsubscribe(),this.effectsSubscription=null)},r}();J.decorators=[{type:a.Injectable}],J.ctorParameters=function(){return[{type:H},{type:e.Store}]};var K=function(){function r(r,e,t,o){this.sources=r,e.start(),t.forEach(function(e){return r.addEffects(e)})}return r.prototype.addEffects=function(r){this.sources.addEffects(r)},r}();K.decorators=[{type:a.NgModule,args:[{}]}],K.ctorParameters=function(){return[{type:H},{type:J},{type:Array,decorators:[{type:a.Inject,args:[T]}]},{type:e.StoreModule,decorators:[{type:a.Optional}]}]};var L=function(){function r(r,e,t){this.root=r,e.forEach(function(e){return e.forEach(function(e){return r.addEffects(e)})})}return r}();L.decorators=[{type:a.NgModule,args:[{}]}],L.ctorParameters=function(){return[{type:K},{type:Array,decorators:[{type:a.Inject,args:[D]}]},{type:e.StoreModule,decorators:[{type:a.Optional}]}]};var Q=function(){function r(){}return r.forFeature=function(r){return{ngModule:L,providers:[r,{provide:D,multi:!0,deps:r,useFactory:q}]}},r.forRoot=function(r){return{ngModule:K,providers:[J,H,G,F,r,{provide:T,deps:r,useFactory:q},{provide:C,useFactory:P}]}},r}();Q.decorators=[{type:a.NgModule,args:[{}]}],Q.ctorParameters=function(){return[]},r.Effect=v,r.mergeEffects=E,r.Actions=F,r.EffectsModule=Q,r.EffectSources=H,r.toPayload=w,r.ɵc=L,r.ɵa=q,r.ɵb=P,r.ɵg=K,r.ɵi=J,r.ɵh=G,r.ɵf=C,r.ɵe=D,r.ɵd=T,Object.defineProperty(r,"__esModule",{value:!0})}); | ||
!function(e,r){"object"==typeof exports&&"undefined"!=typeof module?r(exports,require("@ngrx/store"),require("rxjs/observable/merge"),require("rxjs/operator/ignoreElements"),require("rxjs/operator/materialize"),require("rxjs/operator/map"),require("@angular/core"),require("rxjs/Observable"),require("rxjs/operator/filter"),require("rxjs/operator/groupBy"),require("rxjs/operator/mergeMap"),require("rxjs/operator/exhaustMap"),require("rxjs/operator/dematerialize"),require("rxjs/Subject")):"function"==typeof define&&define.amd?define(["exports","@ngrx/store","rxjs/observable/merge","rxjs/operator/ignoreElements","rxjs/operator/materialize","rxjs/operator/map","@angular/core","rxjs/Observable","rxjs/operator/filter","rxjs/operator/groupBy","rxjs/operator/mergeMap","rxjs/operator/exhaustMap","rxjs/operator/dematerialize","rxjs/Subject"],r):r((e.ngrx=e.ngrx||{},e.ngrx.effects={}),e.ngrx.store,e.Rx.Observable,e.Rx.Observable.prototype,e.materialize,e.map,e.ng.core,e.Rx,e.Rx.Observable.prototype,e.groupBy,e.mergeMap,e.exhaustMap,e.dematerialize,e.Subject)}(this,function(e,r,t,o,n,c,i,a,s,u,f,p,l,y){"use strict";function d(e){return e.constructor[R]||[]}function g(e,r){var t=e.constructor,o=t.hasOwnProperty(R)?t[R]:Object.defineProperty(t,R,{value:[]})[R];Array.prototype.push.apply(o,r)}function h(e){var r=(void 0===e?{dispatch:!0}:e).dispatch;return function(e,t){g(e,[{propertyName:t,dispatch:r}])}}function v(e){return Object.getPrototypeOf(e)}function m(e){var r={};return w(e).forEach(function(e){var t=e.propertyName,o=e.dispatch;r[t]={dispatch:o}}),r}function x(e){var r=v(e);return z in r&&"function"==typeof r[z]}function j(e){var r=v(e).constructor.name,i=w(e).map(function(t){var i=t.propertyName,a=t.dispatch,s="function"==typeof e[i]?e[i]():e[i];if(!1===a)return o.ignoreElements.call(s);var u=n.materialize.call(s);return c.map.call(u,function(t){return{effect:e[i],notification:t,propertyName:i,sourceName:r,sourceInstance:e}})});return t.merge.apply(void 0,i)}function b(e){var r=j(e);return x(e)?e.ngrxOnRunEffects(r):r}function E(e,r){O(e,r),S(e,r)}function O(e,r){if("E"===e.notification.kind){var t="Effect "+M(e)+" threw an error";r.report(t,{Source:e.sourceInstance,Effect:e.effect,Error:e.notification.error,Notification:e.notification})}}function S(e,r){if("N"===e.notification.kind){var t=e.notification.value;if(!I(t)){var o="Effect "+M(e)+" dispatched an invalid action";r.report(o,{Source:e.sourceInstance,Effect:e.effect,Dispatched:t,Notification:e.notification})}}}function I(e){return e&&e.type&&"string"==typeof e.type}function M(e){var r=e.propertyName,t=e.sourceInstance;return'"'+e.sourceName+"."+r+("function"==typeof t[r]?"()":"")+'"'}function _(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];return e}function N(){return console}function P(e){return e.payload}var q=function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,r){e.__proto__=r}||function(e,r){for(var t in r)r.hasOwnProperty(t)&&(e[t]=r[t])};return function(r,t){function o(){this.constructor=r}e(r,t),r.prototype=null===t?Object.create(t):(o.prototype=t.prototype,new o)}}(),R="__@ngrx/effects__",w=r.compose(d,v),z="ngrxOnRunEffects",A=function(e){function r(r){var t=e.call(this)||this;return r&&(t.source=r),t}return q(r,e),r.prototype.lift=function(e){var t=new r;return t.source=this,t.operator=e,t},r.prototype.ofType=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];return s.filter.call(this,function(r){return e.some(function(e){return e===r.type})})},r}(a.Observable);A.decorators=[{type:i.Injectable}],A.ctorParameters=function(){return[{type:a.Observable,decorators:[{type:i.Inject,args:[r.ScannedActionsSubject]}]}]};var T=(new i.InjectionToken("ngrx/effects: Immediate Effects"),new i.InjectionToken("ngrx/effects: Root Effects")),k=new i.InjectionToken("ngrx/effects: Feature Effects"),F=new i.InjectionToken("Browser Console"),B=function(){function e(e){this.console=e}return e.prototype.report=function(e,r){this.console.group(e);for(var t in r)this.console.error(t+":",r[t]);this.console.groupEnd()},e}();B.decorators=[{type:i.Injectable}],B.ctorParameters=function(){return[{type:void 0,decorators:[{type:i.Inject,args:[F]}]}]};var C=function(e){function r(r){var t=e.call(this)||this;return t.errorReporter=r,t}return q(r,e),r.prototype.addEffects=function(e){this.next(e)},r.prototype.toActions=function(){var e=this;return f.mergeMap.call(u.groupBy.call(this,v),function(r){return l.dematerialize.call(s.filter.call(c.map.call(p.exhaustMap.call(r,b),function(r){return E(r,e.errorReporter),r.notification}),function(e){return"N"===e.kind}))})},r}(y.Subject);C.decorators=[{type:i.Injectable}],C.ctorParameters=function(){return[{type:B}]};var D=function(){function e(e,r){this.effectSources=e,this.store=r,this.effectsSubscription=null}return e.prototype.start=function(){this.effectsSubscription||(this.effectsSubscription=this.effectSources.toActions().subscribe(this.store))},e.prototype.ngOnDestroy=function(){this.effectsSubscription&&(this.effectsSubscription.unsubscribe(),this.effectsSubscription=null)},e}();D.decorators=[{type:i.Injectable}],D.ctorParameters=function(){return[{type:C},{type:r.Store}]};var G="@ngrx/effects/init",H=function(){function e(e,r,t,o,n){this.sources=e,r.start(),o.forEach(function(r){return e.addEffects(r)}),t.dispatch({type:G})}return e.prototype.addEffects=function(e){this.sources.addEffects(e)},e}();H.decorators=[{type:i.NgModule,args:[{}]}],H.ctorParameters=function(){return[{type:C},{type:D},{type:r.Store},{type:Array,decorators:[{type:i.Inject,args:[T]}]},{type:r.StoreModule,decorators:[{type:i.Optional}]}]};var J=function(){function e(e,r,t){this.root=e,r.forEach(function(r){return r.forEach(function(r){return e.addEffects(r)})})}return e}();J.decorators=[{type:i.NgModule,args:[{}]}],J.ctorParameters=function(){return[{type:H},{type:Array,decorators:[{type:i.Inject,args:[k]}]},{type:r.StoreModule,decorators:[{type:i.Optional}]}]};var K=function(){function e(){}return e.forFeature=function(e){return{ngModule:J,providers:[e,{provide:k,multi:!0,deps:e,useFactory:_}]}},e.forRoot=function(e){return{ngModule:H,providers:[D,C,B,A,e,{provide:T,deps:e,useFactory:_},{provide:F,useFactory:N}]}},e}();K.decorators=[{type:i.NgModule,args:[{}]}],K.ctorParameters=function(){return[]},e.Effect=h,e.getEffectsMetadata=m,e.mergeEffects=j,e.Actions=A,e.EffectsModule=K,e.EffectSources=C,e.toPayload=P,e.ROOT_EFFECTS_INIT=G,e.ɵd=J,e.ɵa=_,e.ɵb=N,e.ɵc=H,e.ɵi=D,e.ɵh=B,e.ɵg=F,e.ɵf=k,e.ɵe=T,Object.defineProperty(e,"__esModule",{value:!0})}); | ||
//# sourceMappingURL=./dist/effects/bundles/effects.umd.min.js.map |
@@ -5,7 +5,7 @@ /** | ||
export * from './public_api'; | ||
export { EffectsFeatureModule as ɵc } from './src/effects_feature_module'; | ||
export { EffectsFeatureModule as ɵd } from './src/effects_feature_module'; | ||
export { createSourceInstances as ɵa, getConsole as ɵb } from './src/effects_module'; | ||
export { EffectsRootModule as ɵg } from './src/effects_root_module'; | ||
export { EffectsRootModule as ɵc } from './src/effects_root_module'; | ||
export { EffectsRunner as ɵi } from './src/effects_runner'; | ||
export { ErrorReporter as ɵh } from './src/error_reporter'; | ||
export { CONSOLE as ɵf, FEATURE_EFFECTS as ɵe, ROOT_EFFECTS as ɵd } from './src/tokens'; | ||
export { CONSOLE as ɵg, FEATURE_EFFECTS as ɵf, ROOT_EFFECTS as ɵe } from './src/tokens'; |
/** | ||
* Generated bundle index. Do not edit. | ||
*/ | ||
export { Effect, mergeEffects, Actions, EffectsModule, EffectSources, toPayload } from './public_api'; | ||
export { EffectsFeatureModule as ɵc } from './src/effects_feature_module'; | ||
export { Effect, getEffectsMetadata, mergeEffects, Actions, EffectsModule, EffectSources, toPayload, ROOT_EFFECTS_INIT } from './public_api'; | ||
export { EffectsFeatureModule as ɵd } from './src/effects_feature_module'; | ||
export { createSourceInstances as ɵa, getConsole as ɵb } from './src/effects_module'; | ||
export { EffectsRootModule as ɵg } from './src/effects_root_module'; | ||
export { EffectsRootModule as ɵc } from './src/effects_root_module'; | ||
export { EffectsRunner as ɵi } from './src/effects_runner'; | ||
export { ErrorReporter as ɵh } from './src/error_reporter'; | ||
export { CONSOLE as ɵf, FEATURE_EFFECTS as ɵe, ROOT_EFFECTS as ɵd } from './src/tokens'; | ||
export { CONSOLE as ɵg, FEATURE_EFFECTS as ɵf, ROOT_EFFECTS as ɵe } from './src/tokens'; | ||
//# sourceMappingURL=index.js.map |
@@ -1,1 +0,1 @@ | ||
{"__symbolic":"module","version":3,"metadata":{"ɵa":{"__symbolic":"function","parameters":["instances"],"value":{"__symbolic":"reference","name":"instances"}},"ɵb":{"__symbolic":"function","parameters":[],"value":{"__symbolic":"reference","name":"console"}},"Effect":{"__symbolic":"function","parameters":["dispatch"],"defaults":[{"dispatch":true}],"value":{"__symbolic":"error","message":"Function call not supported","line":57,"character":9,"module":"./src/effects_metadata"}},"mergeEffects":{"__symbolic":"function"},"Actions":{"__symbolic":"class","arity":1,"extends":{"__symbolic":"reference","name":"Observable","module":"rxjs/Observable","arguments":[{"__symbolic":"error","message":"Could not resolve type","line":8,"character":65,"context":{"typeName":"V"},"module":"./src/actions"}]},"decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Injectable"}}],"members":{"__ctor__":[{"__symbolic":"constructor","parameterDecorators":[[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject"},"arguments":[{"__symbolic":"reference","module":"@ngrx/store","name":"ScannedActionsSubject"}]}]],"parameters":[{"__symbolic":"reference","name":"Observable","module":"rxjs/Observable","arguments":[{"__symbolic":"error","message":"Could not resolve type","line":8,"character":65,"context":{"typeName":"V"},"module":"./src/actions"}]}]}],"lift":[{"__symbolic":"method"}],"ofType":[{"__symbolic":"method"}]}},"EffectsModule":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"NgModule"},"arguments":[{}]}],"members":{},"statics":{"forFeature":{"__symbolic":"function","parameters":["featureEffects"],"value":{"ngModule":{"__symbolic":"reference","name":"ɵc"},"providers":[{"__symbolic":"reference","name":"featureEffects"},{"provide":{"__symbolic":"reference","name":"ɵe"},"multi":true,"deps":{"__symbolic":"reference","name":"featureEffects"},"useFactory":{"__symbolic":"reference","name":"ɵa"}}]}},"forRoot":{"__symbolic":"function","parameters":["rootEffects"],"value":{"ngModule":{"__symbolic":"reference","name":"ɵg"},"providers":[{"__symbolic":"reference","name":"ɵi"},{"__symbolic":"reference","name":"EffectSources"},{"__symbolic":"reference","name":"ɵh"},{"__symbolic":"reference","name":"Actions"},{"__symbolic":"reference","name":"rootEffects"},{"provide":{"__symbolic":"reference","name":"ɵd"},"deps":{"__symbolic":"reference","name":"rootEffects"},"useFactory":{"__symbolic":"reference","name":"ɵa"}},{"provide":{"__symbolic":"reference","name":"ɵf"},"useFactory":{"__symbolic":"reference","name":"ɵb"}}]}}}},"EffectSources":{"__symbolic":"class","extends":{"__symbolic":"reference","module":"rxjs/Subject","name":"Subject"},"decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Injectable"}}],"members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","name":"ɵh"}]}],"addEffects":[{"__symbolic":"method"}],"toActions":[{"__symbolic":"method"}]}},"OnRunEffects":{"__symbolic":"interface"},"toPayload":{"__symbolic":"function","parameters":["action"],"value":{"__symbolic":"error","message":"Expression form not supported","line":6,"character":10,"module":"./src/util"}},"EffectNotification":{"__symbolic":"interface"},"ɵc":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"NgModule"},"arguments":[{}]}],"members":{"__ctor__":[{"__symbolic":"constructor","parameterDecorators":[null,[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject"},"arguments":[{"__symbolic":"reference","name":"ɵe"}]}],[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Optional"}}]],"parameters":[{"__symbolic":"reference","name":"ɵg"},{"__symbolic":"reference","name":"Array","arguments":[{"__symbolic":"reference","name":"Array","arguments":[{"__symbolic":"reference","name":"any"}]}]},{"__symbolic":"reference","module":"@ngrx/store","name":"StoreModule"}]}]}},"ɵd":{"__symbolic":"new","expression":{"__symbolic":"reference","module":"@angular/core","name":"InjectionToken"},"arguments":["ngrx/effects: Root Effects"]},"ɵe":{"__symbolic":"new","expression":{"__symbolic":"reference","module":"@angular/core","name":"InjectionToken"},"arguments":["ngrx/effects: Feature Effects"]},"ɵf":{"__symbolic":"new","expression":{"__symbolic":"reference","module":"@angular/core","name":"InjectionToken"},"arguments":["Browser Console"]},"ɵg":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"NgModule"},"arguments":[{}]}],"members":{"__ctor__":[{"__symbolic":"constructor","parameterDecorators":[null,null,[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject"},"arguments":[{"__symbolic":"reference","name":"ɵd"}]}],[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Optional"}}]],"parameters":[{"__symbolic":"reference","name":"EffectSources"},{"__symbolic":"reference","name":"ɵi"},{"__symbolic":"reference","name":"Array","arguments":[{"__symbolic":"reference","name":"any"}]},{"__symbolic":"reference","module":"@ngrx/store","name":"StoreModule"}]}],"addEffects":[{"__symbolic":"method"}]}},"ɵh":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Injectable"}}],"members":{"__ctor__":[{"__symbolic":"constructor","parameterDecorators":[[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject"},"arguments":[{"__symbolic":"reference","name":"ɵf"}]}]],"parameters":[{"__symbolic":"reference","name":"any"}]}],"report":[{"__symbolic":"method"}]}},"ɵi":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Injectable"}}],"members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","name":"EffectSources"},{"__symbolic":"reference","name":"Store","module":"@ngrx/store","arguments":[{"__symbolic":"reference","name":"any"}]}]}],"start":[{"__symbolic":"method"}],"ngOnDestroy":[{"__symbolic":"method"}]}}},"origins":{"ɵa":"./src/effects_module","ɵb":"./src/effects_module","Effect":"./src/effects_metadata","mergeEffects":"./src/effects_resolver","Actions":"./src/actions","EffectsModule":"./src/effects_module","EffectSources":"./src/effect_sources","OnRunEffects":"./src/on_run_effects","toPayload":"./src/util","EffectNotification":"./src/effect_notification","ɵc":"./src/effects_feature_module","ɵd":"./src/tokens","ɵe":"./src/tokens","ɵf":"./src/tokens","ɵg":"./src/effects_root_module","ɵh":"./src/error_reporter","ɵi":"./src/effects_runner"},"importAs":"@ngrx/effects"} | ||
{"__symbolic":"module","version":3,"metadata":{"ɵa":{"__symbolic":"function","parameters":["instances"],"value":{"__symbolic":"reference","name":"instances"}},"ɵb":{"__symbolic":"function","parameters":[],"value":{"__symbolic":"reference","name":"console"}},"ɵc":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"NgModule"},"arguments":[{}]}],"members":{"__ctor__":[{"__symbolic":"constructor","parameterDecorators":[null,null,null,[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject"},"arguments":[{"__symbolic":"reference","name":"ɵe"}]}],[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Optional"}}]],"parameters":[{"__symbolic":"reference","name":"EffectSources"},{"__symbolic":"reference","name":"ɵi"},{"__symbolic":"reference","name":"Store","module":"@ngrx/store","arguments":[{"__symbolic":"reference","name":"any"}]},{"__symbolic":"reference","name":"Array","arguments":[{"__symbolic":"reference","name":"any"}]},{"__symbolic":"reference","module":"@ngrx/store","name":"StoreModule"}]}],"addEffects":[{"__symbolic":"method"}]}},"Effect":{"__symbolic":"function","parameters":["dispatch"],"defaults":[{"dispatch":true}],"value":{"__symbolic":"error","message":"Function call not supported","line":28,"character":9,"module":"./src/effects_metadata"}},"EffectsMetadata":{"__symbolic":"interface"},"getEffectsMetadata":{"__symbolic":"function"},"mergeEffects":{"__symbolic":"function"},"Actions":{"__symbolic":"class","arity":1,"extends":{"__symbolic":"reference","name":"Observable","module":"rxjs/Observable","arguments":[{"__symbolic":"error","message":"Could not resolve type","line":8,"character":65,"context":{"typeName":"V"},"module":"./src/actions"}]},"decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Injectable"}}],"members":{"__ctor__":[{"__symbolic":"constructor","parameterDecorators":[[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject"},"arguments":[{"__symbolic":"reference","module":"@ngrx/store","name":"ScannedActionsSubject"}]}]],"parameters":[{"__symbolic":"reference","name":"Observable","module":"rxjs/Observable","arguments":[{"__symbolic":"error","message":"Could not resolve type","line":8,"character":65,"context":{"typeName":"V"},"module":"./src/actions"}]}]}],"lift":[{"__symbolic":"method"}],"ofType":[{"__symbolic":"method"}]}},"EffectsModule":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"NgModule"},"arguments":[{}]}],"members":{},"statics":{"forFeature":{"__symbolic":"function","parameters":["featureEffects"],"value":{"ngModule":{"__symbolic":"reference","name":"ɵd"},"providers":[{"__symbolic":"reference","name":"featureEffects"},{"provide":{"__symbolic":"reference","name":"ɵf"},"multi":true,"deps":{"__symbolic":"reference","name":"featureEffects"},"useFactory":{"__symbolic":"reference","name":"ɵa"}}]}},"forRoot":{"__symbolic":"function","parameters":["rootEffects"],"value":{"ngModule":{"__symbolic":"reference","name":"ɵc"},"providers":[{"__symbolic":"reference","name":"ɵi"},{"__symbolic":"reference","name":"EffectSources"},{"__symbolic":"reference","name":"ɵh"},{"__symbolic":"reference","name":"Actions"},{"__symbolic":"reference","name":"rootEffects"},{"provide":{"__symbolic":"reference","name":"ɵe"},"deps":{"__symbolic":"reference","name":"rootEffects"},"useFactory":{"__symbolic":"reference","name":"ɵa"}},{"provide":{"__symbolic":"reference","name":"ɵg"},"useFactory":{"__symbolic":"reference","name":"ɵb"}}]}}}},"EffectSources":{"__symbolic":"class","extends":{"__symbolic":"reference","module":"rxjs/Subject","name":"Subject"},"decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Injectable"}}],"members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","name":"ɵh"}]}],"addEffects":[{"__symbolic":"method"}],"toActions":[{"__symbolic":"method"}]}},"OnRunEffects":{"__symbolic":"interface"},"toPayload":{"__symbolic":"function","parameters":["action"],"value":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"action"},"member":"payload"}},"EffectNotification":{"__symbolic":"interface"},"ROOT_EFFECTS_INIT":"@ngrx/effects/init","ɵd":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"NgModule"},"arguments":[{}]}],"members":{"__ctor__":[{"__symbolic":"constructor","parameterDecorators":[null,[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject"},"arguments":[{"__symbolic":"reference","name":"ɵf"}]}],[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Optional"}}]],"parameters":[{"__symbolic":"reference","name":"ɵc"},{"__symbolic":"reference","name":"Array","arguments":[{"__symbolic":"reference","name":"Array","arguments":[{"__symbolic":"reference","name":"any"}]}]},{"__symbolic":"reference","module":"@ngrx/store","name":"StoreModule"}]}]}},"ɵe":{"__symbolic":"new","expression":{"__symbolic":"reference","module":"@angular/core","name":"InjectionToken"},"arguments":["ngrx/effects: Root Effects"]},"ɵf":{"__symbolic":"new","expression":{"__symbolic":"reference","module":"@angular/core","name":"InjectionToken"},"arguments":["ngrx/effects: Feature Effects"]},"ɵg":{"__symbolic":"new","expression":{"__symbolic":"reference","module":"@angular/core","name":"InjectionToken"},"arguments":["Browser Console"]},"ɵh":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Injectable"}}],"members":{"__ctor__":[{"__symbolic":"constructor","parameterDecorators":[[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject"},"arguments":[{"__symbolic":"reference","name":"ɵg"}]}]],"parameters":[{"__symbolic":"reference","name":"any"}]}],"report":[{"__symbolic":"method"}]}},"ɵi":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Injectable"}}],"members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","name":"EffectSources"},{"__symbolic":"reference","name":"Store","module":"@ngrx/store","arguments":[{"__symbolic":"reference","name":"any"}]}]}],"start":[{"__symbolic":"method"}],"ngOnDestroy":[{"__symbolic":"method"}]}}},"origins":{"ɵa":"./src/effects_module","ɵb":"./src/effects_module","ɵc":"./src/effects_root_module","Effect":"./src/effects_metadata","EffectsMetadata":"./src/effects_metadata","getEffectsMetadata":"./src/effects_metadata","mergeEffects":"./src/effects_resolver","Actions":"./src/actions","EffectsModule":"./src/effects_module","EffectSources":"./src/effect_sources","OnRunEffects":"./src/on_run_effects","toPayload":"./src/util","EffectNotification":"./src/effect_notification","ROOT_EFFECTS_INIT":"./src/effects_root_module","ɵd":"./src/effects_feature_module","ɵe":"./src/tokens","ɵf":"./src/tokens","ɵg":"./src/tokens","ɵh":"./src/error_reporter","ɵi":"./src/effects_runner"},"importAs":"@ngrx/effects"} |
{ | ||
"name": "@ngrx/effects", | ||
"version": "4.0.5", | ||
"version": "4.1.0", | ||
"description": "Side effect model for @ngrx/store", | ||
@@ -5,0 +5,0 @@ "module": "@ngrx/effects.es5.js", |
@@ -1,2 +0,2 @@ | ||
export { Effect, mergeEffects, Actions, EffectsModule, EffectSources, toPayload } from './src/index'; | ||
export { Effect, getEffectsMetadata, mergeEffects, Actions, EffectsModule, EffectSources, toPayload, ROOT_EFFECTS_INIT } from './src/index'; | ||
//# sourceMappingURL=public_api.js.map |
@@ -5,5 +5,2 @@ export interface EffectMetadata { | ||
} | ||
/** | ||
* @Annotation | ||
*/ | ||
export declare function Effect({dispatch}?: { | ||
@@ -14,1 +11,7 @@ dispatch: boolean; | ||
export declare const getSourceMetadata: (i: Object) => EffectMetadata[]; | ||
export declare type EffectsMetadata<T> = { | ||
[key in keyof T]?: undefined | { | ||
dispatch: boolean; | ||
}; | ||
}; | ||
export declare function getEffectsMetadata<T>(instance: T): EffectsMetadata<T>; |
import { compose } from '@ngrx/store'; | ||
const /** @type {?} */ METADATA_KEY = '@ngrx/effects'; | ||
const /** @type {?} */ METADATA_KEY = '__@ngrx/effects__'; | ||
const /** @type {?} */ r = Reflect; | ||
/** | ||
* @param {?} sourceType | ||
* @return {?} | ||
*/ | ||
function hasStaticMetadata(sourceType) { | ||
return !!((sourceType)).propDecorators; | ||
} | ||
/** | ||
* @param {?} sourceType | ||
* @return {?} | ||
*/ | ||
function getStaticMetadata(sourceType) { | ||
const /** @type {?} */ propDecorators = sourceType.propDecorators; | ||
return Object.keys(propDecorators).reduce((all, key) => all.concat(getStaticMetadataEntry(propDecorators[key], key)), []); | ||
} | ||
/** | ||
* @param {?} metadataEntry | ||
* @param {?} propertyName | ||
* @return {?} | ||
*/ | ||
function getStaticMetadataEntry(metadataEntry, propertyName) { | ||
return metadataEntry | ||
.filter((entry) => entry.type === Effect) | ||
.map((entry) => { | ||
let /** @type {?} */ dispatch = true; | ||
if (entry.args && entry.args.length) { | ||
dispatch = !!entry.args[0].dispatch; | ||
} | ||
return { propertyName, dispatch }; | ||
}); | ||
} | ||
/** | ||
* @param {?} sourceProto | ||
@@ -40,9 +9,3 @@ * @return {?} | ||
function getEffectMetadataEntries(sourceProto) { | ||
if (hasStaticMetadata(sourceProto.constructor)) { | ||
return getStaticMetadata(sourceProto.constructor); | ||
} | ||
if (r.hasOwnMetadata(METADATA_KEY, sourceProto)) { | ||
return r.getOwnMetadata(METADATA_KEY, sourceProto); | ||
} | ||
return []; | ||
return sourceProto.constructor[METADATA_KEY] || []; | ||
} | ||
@@ -55,6 +18,9 @@ /** | ||
function setEffectMetadataEntries(sourceProto, entries) { | ||
r.defineMetadata(METADATA_KEY, entries, sourceProto); | ||
const /** @type {?} */ constructor = sourceProto.constructor; | ||
const /** @type {?} */ meta = constructor.hasOwnProperty(METADATA_KEY) | ||
? ((constructor))[METADATA_KEY] | ||
: Object.defineProperty(constructor, METADATA_KEY, { value: [] })[METADATA_KEY]; | ||
Array.prototype.push.apply(meta, entries); | ||
} | ||
/** | ||
* \@Annotation | ||
* @param {?=} __0 | ||
@@ -65,5 +31,4 @@ * @return {?} | ||
return function (target, propertyName) { | ||
const /** @type {?} */ effects = getEffectMetadataEntries(target); | ||
const /** @type {?} */ metadata = { propertyName, dispatch }; | ||
setEffectMetadataEntries(target, [...effects, metadata]); | ||
setEffectMetadataEntries(target, [metadata]); | ||
}; | ||
@@ -79,2 +44,14 @@ } | ||
export const /** @type {?} */ getSourceMetadata = compose(getEffectMetadataEntries, getSourceForInstance); | ||
/** | ||
* @template T | ||
* @param {?} instance | ||
* @return {?} | ||
*/ | ||
export function getEffectsMetadata(instance) { | ||
const /** @type {?} */ metadata = {}; | ||
getSourceMetadata(instance).forEach(({ propertyName, dispatch }) => { | ||
metadata[propertyName] = { dispatch }; | ||
}); | ||
return metadata; | ||
} | ||
//# sourceMappingURL=effects_metadata.js.map |
@@ -1,8 +0,9 @@ | ||
import { StoreModule } from '@ngrx/store'; | ||
import { StoreModule, Store } from '@ngrx/store'; | ||
import { EffectsRunner } from './effects_runner'; | ||
import { EffectSources } from './effect_sources'; | ||
export declare const ROOT_EFFECTS_INIT = "@ngrx/effects/init"; | ||
export declare class EffectsRootModule { | ||
private sources; | ||
constructor(sources: EffectSources, runner: EffectsRunner, rootEffects: any[], storeModule: StoreModule); | ||
constructor(sources: EffectSources, runner: EffectsRunner, store: Store<any>, rootEffects: any[], storeModule: StoreModule); | ||
addEffects(effectSourceInstance: any): void; | ||
} |
import { NgModule, Inject, Optional } from '@angular/core'; | ||
import { StoreModule } from '@ngrx/store'; | ||
import { StoreModule, Store } from '@ngrx/store'; | ||
import { EffectsRunner } from './effects_runner'; | ||
import { EffectSources } from './effect_sources'; | ||
import { ROOT_EFFECTS } from './tokens'; | ||
export const /** @type {?} */ ROOT_EFFECTS_INIT = '@ngrx/effects/init'; | ||
export class EffectsRootModule { | ||
@@ -10,9 +11,11 @@ /** | ||
* @param {?} runner | ||
* @param {?} store | ||
* @param {?} rootEffects | ||
* @param {?} storeModule | ||
*/ | ||
constructor(sources, runner, rootEffects, storeModule) { | ||
constructor(sources, runner, store, rootEffects, storeModule) { | ||
this.sources = sources; | ||
runner.start(); | ||
rootEffects.forEach(effectSourceInstance => sources.addEffects(effectSourceInstance)); | ||
store.dispatch({ type: ROOT_EFFECTS_INIT }); | ||
} | ||
@@ -36,2 +39,3 @@ /** | ||
{ type: EffectsRunner, }, | ||
{ type: Store, }, | ||
{ type: Array, decorators: [{ type: Inject, args: [ROOT_EFFECTS,] },] }, | ||
@@ -38,0 +42,0 @@ { type: StoreModule, decorators: [{ type: Optional },] }, |
@@ -1,2 +0,2 @@ | ||
export { Effect } from './effects_metadata'; | ||
export { Effect, EffectsMetadata, getEffectsMetadata } from './effects_metadata'; | ||
export { mergeEffects } from './effects_resolver'; | ||
@@ -9,1 +9,2 @@ export { Actions } from './actions'; | ||
export { EffectNotification } from './effect_notification'; | ||
export { ROOT_EFFECTS_INIT } from './effects_root_module'; |
@@ -1,2 +0,2 @@ | ||
export { Effect } from './effects_metadata'; | ||
export { Effect, getEffectsMetadata, } from './effects_metadata'; | ||
export { mergeEffects } from './effects_resolver'; | ||
@@ -7,2 +7,3 @@ export { Actions } from './actions'; | ||
export { toPayload } from './util'; | ||
export { ROOT_EFFECTS_INIT } from './effects_root_module'; | ||
//# sourceMappingURL=index.js.map |
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
212590
2229