@ngrx/effects
Advanced tools
Comparing version 6.0.0-beta.0 to 6.0.0-beta.1
/** | ||
* @license NgRx v6.0.0-beta.0 | ||
* @license NgRx v6.0.0-beta.1 | ||
* (c) 2015-2018 Brandon Roberts, Mike Ryan, Rob Wormald, Victor Savkin | ||
@@ -7,675 +7,15 @@ * License: MIT | ||
(function (global, factory) { | ||
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('rxjs'), require('rxjs/operators')) : | ||
typeof define === 'function' && define.amd ? define(['exports', '@angular/core', 'rxjs', 'rxjs/operators'], factory) : | ||
(factory((global.npm_package = {}),global.ng.core,global.rxjs,global.rxjs.operators)); | ||
}(this, (function (exports,core,rxjs,operators) { 'use strict'; | ||
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@ngrx/effects'), require('rxjs')) : | ||
typeof define === 'function' && define.amd ? define(['exports', '@ngrx/effects', 'rxjs'], factory) : | ||
(factory((global.npm_package = {}),global['@ngrx/effects'],global.rxjs)); | ||
}(this, (function (exports,effects,rxjs) { 'use strict'; | ||
var __extends$1 = (undefined && undefined.__extends) || (function () { | ||
var extendStatics = Object.setPrototypeOf || | ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || | ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; | ||
return function (d, b) { | ||
extendStatics(d, b); | ||
function __() { this.constructor = d; } | ||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); | ||
}; | ||
})(); | ||
var INIT = '@ngrx/store/init'; | ||
var ActionsSubject = /** @class */ (function (_super) { | ||
__extends$1(ActionsSubject, _super); | ||
function ActionsSubject() { | ||
return _super.call(this, { type: INIT }) || this; | ||
} | ||
ActionsSubject.prototype.next = function (action) { | ||
if (typeof action === 'undefined') { | ||
throw new TypeError("Actions must be objects"); | ||
} | ||
else if (typeof action.type === 'undefined') { | ||
throw new TypeError("Actions must have a type property"); | ||
} | ||
_super.prototype.next.call(this, action); | ||
}; | ||
ActionsSubject.prototype.complete = function () { | ||
/* noop */ | ||
}; | ||
ActionsSubject.prototype.ngOnDestroy = function () { | ||
_super.prototype.complete.call(this); | ||
}; | ||
ActionsSubject.decorators = [ | ||
{ type: core.Injectable } | ||
]; | ||
/** @nocollapse */ | ||
ActionsSubject.ctorParameters = function () { return []; }; | ||
return ActionsSubject; | ||
}(rxjs.BehaviorSubject)); | ||
var _INITIAL_STATE = new core.InjectionToken('@ngrx/store Internal Initial State'); | ||
var INITIAL_STATE = new core.InjectionToken('@ngrx/store Initial State'); | ||
var REDUCER_FACTORY = new core.InjectionToken('@ngrx/store Reducer Factory'); | ||
var _REDUCER_FACTORY = new core.InjectionToken('@ngrx/store Reducer Factory Provider'); | ||
var INITIAL_REDUCERS = new core.InjectionToken('@ngrx/store Initial Reducers'); | ||
var _INITIAL_REDUCERS = new core.InjectionToken('@ngrx/store Internal Initial Reducers'); | ||
var META_REDUCERS = new core.InjectionToken('@ngrx/store Meta Reducers'); | ||
var STORE_FEATURES = new core.InjectionToken('@ngrx/store Store Features'); | ||
var _STORE_REDUCERS = new core.InjectionToken('@ngrx/store Internal Store Reducers'); | ||
var _FEATURE_REDUCERS = new core.InjectionToken('@ngrx/store Internal Feature Reducers'); | ||
var _FEATURE_REDUCERS_TOKEN = new core.InjectionToken('@ngrx/store Internal Feature Reducers Token'); | ||
var FEATURE_REDUCERS = new core.InjectionToken('@ngrx/store Feature Reducers'); | ||
var __read$1 = (undefined && undefined.__read) || function (o, n) { | ||
var m = typeof Symbol === "function" && o[Symbol.iterator]; | ||
if (!m) return o; | ||
var i = m.call(o), r, ar = [], e; | ||
try { | ||
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); | ||
} | ||
catch (error) { e = { error: error }; } | ||
finally { | ||
try { | ||
if (r && !r.done && (m = i["return"])) m.call(i); | ||
} | ||
finally { if (e) throw e.error; } | ||
} | ||
return ar; | ||
}; | ||
var __spread$1 = (undefined && undefined.__spread) || function () { | ||
for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read$1(arguments[i])); | ||
return ar; | ||
}; | ||
function omit(object, keyToRemove) { | ||
return Object.keys(object) | ||
.filter(function (key) { return key !== keyToRemove; }) | ||
.reduce(function (result, key) { | ||
return Object.assign(result, (_a = {}, _a[key] = object[key], _a)); | ||
var _a; | ||
}, {}); | ||
} | ||
function compose() { | ||
var functions = []; | ||
for (var _i = 0; _i < arguments.length; _i++) { | ||
functions[_i] = arguments[_i]; | ||
} | ||
return function (arg) { | ||
if (functions.length === 0) { | ||
return arg; | ||
} | ||
var last = functions[functions.length - 1]; | ||
var rest = functions.slice(0, -1); | ||
return rest.reduceRight(function (composed, fn) { return fn(composed); }, last(arg)); | ||
}; | ||
} | ||
function createReducerFactory(reducerFactory, metaReducers) { | ||
if (Array.isArray(metaReducers) && metaReducers.length > 0) { | ||
return compose.apply(null, __spread$1(metaReducers, [reducerFactory])); | ||
} | ||
return reducerFactory; | ||
} | ||
function createFeatureReducerFactory(metaReducers) { | ||
var reducerFactory = Array.isArray(metaReducers) && metaReducers.length > 0 | ||
? compose.apply(void 0, __spread$1(metaReducers)) : function (r) { return r; }; | ||
return function (reducer, initialState) { | ||
reducer = reducerFactory(reducer); | ||
return function (state, action) { | ||
state = state === undefined ? initialState : state; | ||
return reducer(state, action); | ||
}; | ||
}; | ||
} | ||
var __extends$2 = (undefined && undefined.__extends) || (function () { | ||
var extendStatics = Object.setPrototypeOf || | ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || | ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; | ||
return function (d, b) { | ||
extendStatics(d, b); | ||
function __() { this.constructor = d; } | ||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); | ||
}; | ||
})(); | ||
var __assign = (undefined && undefined.__assign) || Object.assign || function(t) { | ||
for (var s, i = 1, n = arguments.length; i < n; i++) { | ||
s = arguments[i]; | ||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) | ||
t[p] = s[p]; | ||
} | ||
return t; | ||
}; | ||
var ReducerObservable = /** @class */ (function (_super) { | ||
__extends$2(ReducerObservable, _super); | ||
function ReducerObservable() { | ||
return _super !== null && _super.apply(this, arguments) || this; | ||
} | ||
return ReducerObservable; | ||
}(rxjs.Observable)); | ||
var ReducerManagerDispatcher = /** @class */ (function (_super) { | ||
__extends$2(ReducerManagerDispatcher, _super); | ||
function ReducerManagerDispatcher() { | ||
return _super !== null && _super.apply(this, arguments) || this; | ||
} | ||
return ReducerManagerDispatcher; | ||
}(ActionsSubject)); | ||
var UPDATE = '@ngrx/store/update-reducers'; | ||
var ReducerManager = /** @class */ (function (_super) { | ||
__extends$2(ReducerManager, _super); | ||
function ReducerManager(dispatcher, initialState, reducers, reducerFactory) { | ||
var _this = _super.call(this, reducerFactory(reducers, initialState)) || this; | ||
_this.dispatcher = dispatcher; | ||
_this.initialState = initialState; | ||
_this.reducers = reducers; | ||
_this.reducerFactory = reducerFactory; | ||
return _this; | ||
} | ||
ReducerManager.prototype.addFeature = function (_a) { | ||
var reducers = _a.reducers, reducerFactory = _a.reducerFactory, metaReducers = _a.metaReducers, initialState = _a.initialState, key = _a.key; | ||
var reducer = typeof reducers === 'function' | ||
? createFeatureReducerFactory(metaReducers)(reducers, initialState) | ||
: createReducerFactory(reducerFactory, metaReducers)(reducers, initialState); | ||
this.addReducer(key, reducer); | ||
}; | ||
ReducerManager.prototype.removeFeature = function (_a) { | ||
var key = _a.key; | ||
this.removeReducer(key); | ||
}; | ||
ReducerManager.prototype.addReducer = function (key, reducer) { | ||
this.reducers = __assign({}, this.reducers, (_a = {}, _a[key] = reducer, _a)); | ||
this.updateReducers(key); | ||
var _a; | ||
}; | ||
ReducerManager.prototype.removeReducer = function (key) { | ||
this.reducers = omit(this.reducers, key) /*TODO(#823)*/; | ||
this.updateReducers(key); | ||
}; | ||
ReducerManager.prototype.updateReducers = function (key) { | ||
this.next(this.reducerFactory(this.reducers, this.initialState)); | ||
this.dispatcher.next({ | ||
type: UPDATE, | ||
feature: key, | ||
}); | ||
}; | ||
ReducerManager.prototype.ngOnDestroy = function () { | ||
this.complete(); | ||
}; | ||
ReducerManager.decorators = [ | ||
{ type: core.Injectable } | ||
]; | ||
/** @nocollapse */ | ||
ReducerManager.ctorParameters = function () { return [ | ||
{ type: ReducerManagerDispatcher, }, | ||
{ type: undefined, decorators: [{ type: core.Inject, args: [INITIAL_STATE,] },] }, | ||
{ type: undefined, decorators: [{ type: core.Inject, args: [INITIAL_REDUCERS,] },] }, | ||
{ type: undefined, decorators: [{ type: core.Inject, args: [REDUCER_FACTORY,] },] }, | ||
]; }; | ||
return ReducerManager; | ||
}(rxjs.BehaviorSubject)); | ||
var __extends$4 = (undefined && undefined.__extends) || (function () { | ||
var extendStatics = Object.setPrototypeOf || | ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || | ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; | ||
return function (d, b) { | ||
extendStatics(d, b); | ||
function __() { this.constructor = d; } | ||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); | ||
}; | ||
})(); | ||
var ScannedActionsSubject = /** @class */ (function (_super) { | ||
__extends$4(ScannedActionsSubject, _super); | ||
function ScannedActionsSubject() { | ||
return _super !== null && _super.apply(this, arguments) || this; | ||
} | ||
ScannedActionsSubject.prototype.ngOnDestroy = function () { | ||
this.complete(); | ||
}; | ||
ScannedActionsSubject.decorators = [ | ||
{ type: core.Injectable } | ||
]; | ||
/** @nocollapse */ | ||
ScannedActionsSubject.ctorParameters = function () { return []; }; | ||
return ScannedActionsSubject; | ||
}(rxjs.Subject)); | ||
var __extends$3 = (undefined && undefined.__extends) || (function () { | ||
var extendStatics = Object.setPrototypeOf || | ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || | ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; | ||
return function (d, b) { | ||
extendStatics(d, b); | ||
function __() { this.constructor = d; } | ||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); | ||
}; | ||
})(); | ||
var __read$2 = (undefined && undefined.__read) || function (o, n) { | ||
var m = typeof Symbol === "function" && o[Symbol.iterator]; | ||
if (!m) return o; | ||
var i = m.call(o), r, ar = [], e; | ||
try { | ||
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); | ||
} | ||
catch (error) { e = { error: error }; } | ||
finally { | ||
try { | ||
if (r && !r.done && (m = i["return"])) m.call(i); | ||
} | ||
finally { if (e) throw e.error; } | ||
} | ||
return ar; | ||
}; | ||
var StateObservable = /** @class */ (function (_super) { | ||
__extends$3(StateObservable, _super); | ||
function StateObservable() { | ||
return _super !== null && _super.apply(this, arguments) || this; | ||
} | ||
return StateObservable; | ||
}(rxjs.Observable)); | ||
var State = /** @class */ (function (_super) { | ||
__extends$3(State, _super); | ||
function State(actions$, reducer$, scannedActions, initialState) { | ||
var _this = _super.call(this, initialState) || this; | ||
var actionsOnQueue$ = actions$.pipe(operators.observeOn(rxjs.queueScheduler)); | ||
var withLatestReducer$ = actionsOnQueue$.pipe(operators.withLatestFrom(reducer$)); | ||
var seed = { state: initialState }; | ||
var stateAndAction$ = withLatestReducer$.pipe(operators.scan(reduceState, seed)); | ||
_this.stateSubscription = stateAndAction$.subscribe(function (_a) { | ||
var state = _a.state, action = _a.action; | ||
_this.next(state); | ||
scannedActions.next(action); | ||
}); | ||
return _this; | ||
} | ||
State.prototype.ngOnDestroy = function () { | ||
this.stateSubscription.unsubscribe(); | ||
this.complete(); | ||
}; | ||
State.INIT = INIT; | ||
State.decorators = [ | ||
{ type: core.Injectable } | ||
]; | ||
/** @nocollapse */ | ||
State.ctorParameters = function () { return [ | ||
{ type: ActionsSubject, }, | ||
{ type: ReducerObservable, }, | ||
{ type: ScannedActionsSubject, }, | ||
{ type: undefined, decorators: [{ type: core.Inject, args: [INITIAL_STATE,] },] }, | ||
]; }; | ||
return State; | ||
}(rxjs.BehaviorSubject)); | ||
function reduceState(stateActionPair, _a) { | ||
if (stateActionPair === void 0) { stateActionPair = { state: undefined }; } | ||
var _b = __read$2(_a, 2), action = _b[0], reducer = _b[1]; | ||
var state = stateActionPair.state; | ||
return { state: reducer(state, action), action: action }; | ||
} | ||
var __extends = (undefined && undefined.__extends) || (function () { | ||
var extendStatics = Object.setPrototypeOf || | ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || | ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; | ||
return function (d, b) { | ||
extendStatics(d, b); | ||
function __() { this.constructor = d; } | ||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); | ||
}; | ||
})(); | ||
var __read = (undefined && undefined.__read) || function (o, n) { | ||
var m = typeof Symbol === "function" && o[Symbol.iterator]; | ||
if (!m) return o; | ||
var i = m.call(o), r, ar = [], e; | ||
try { | ||
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); | ||
} | ||
catch (error) { e = { error: error }; } | ||
finally { | ||
try { | ||
if (r && !r.done && (m = i["return"])) m.call(i); | ||
} | ||
finally { if (e) throw e.error; } | ||
} | ||
return ar; | ||
}; | ||
var __spread = (undefined && undefined.__spread) || function () { | ||
for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read(arguments[i])); | ||
return ar; | ||
}; | ||
var Store = /** @class */ (function (_super) { | ||
__extends(Store, _super); | ||
function Store(state$, actionsObserver, reducerManager) { | ||
var _this = _super.call(this) || this; | ||
_this.actionsObserver = actionsObserver; | ||
_this.reducerManager = reducerManager; | ||
_this.source = state$; | ||
return _this; | ||
} | ||
Store.prototype.select = function (pathOrMapFn) { | ||
var paths = []; | ||
for (var _i = 1; _i < arguments.length; _i++) { | ||
paths[_i - 1] = arguments[_i]; | ||
} | ||
return select.apply(void 0, __spread([pathOrMapFn], paths))(this); | ||
}; | ||
Store.prototype.lift = function (operator) { | ||
var store = new Store(this, this.actionsObserver, this.reducerManager); | ||
store.operator = operator; | ||
return store; | ||
}; | ||
Store.prototype.dispatch = function (action) { | ||
this.actionsObserver.next(action); | ||
}; | ||
Store.prototype.next = function (action) { | ||
this.actionsObserver.next(action); | ||
}; | ||
Store.prototype.error = function (err) { | ||
this.actionsObserver.error(err); | ||
}; | ||
Store.prototype.complete = function () { | ||
this.actionsObserver.complete(); | ||
}; | ||
Store.prototype.addReducer = function (key, reducer) { | ||
this.reducerManager.addReducer(key, reducer); | ||
}; | ||
Store.prototype.removeReducer = function (key) { | ||
this.reducerManager.removeReducer(key); | ||
}; | ||
Store.decorators = [ | ||
{ type: core.Injectable } | ||
]; | ||
/** @nocollapse */ | ||
Store.ctorParameters = function () { return [ | ||
{ type: StateObservable, }, | ||
{ type: ActionsSubject, }, | ||
{ type: ReducerManager, }, | ||
]; }; | ||
return Store; | ||
}(rxjs.Observable)); | ||
function select(pathOrMapFn) { | ||
var paths = []; | ||
for (var _i = 1; _i < arguments.length; _i++) { | ||
paths[_i - 1] = arguments[_i]; | ||
} | ||
return function selectOperator(source$) { | ||
var mapped$; | ||
if (typeof pathOrMapFn === 'string') { | ||
mapped$ = source$.pipe(operators.pluck.apply(void 0, __spread([pathOrMapFn], paths))); | ||
} | ||
else if (typeof pathOrMapFn === 'function') { | ||
mapped$ = source$.pipe(operators.map(pathOrMapFn)); | ||
} | ||
else { | ||
throw new TypeError("Unexpected type '" + typeof pathOrMapFn + "' in select operator," + | ||
" expected 'string' or 'function'"); | ||
} | ||
return mapped$.pipe(operators.distinctUntilChanged()); | ||
}; | ||
} | ||
var __read$3 = (undefined && undefined.__read) || function (o, n) { | ||
var m = typeof Symbol === "function" && o[Symbol.iterator]; | ||
if (!m) return o; | ||
var i = m.call(o), r, ar = [], e; | ||
try { | ||
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); | ||
} | ||
catch (error) { e = { error: error }; } | ||
finally { | ||
try { | ||
if (r && !r.done && (m = i["return"])) m.call(i); | ||
} | ||
finally { if (e) throw e.error; } | ||
} | ||
return ar; | ||
}; | ||
var __spread$2 = (undefined && undefined.__spread) || function () { | ||
for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read$3(arguments[i])); | ||
return ar; | ||
}; | ||
var __assign$1 = (undefined && undefined.__assign) || Object.assign || function(t) { | ||
for (var s, i = 1, n = arguments.length; i < n; i++) { | ||
s = arguments[i]; | ||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) | ||
t[p] = s[p]; | ||
} | ||
return t; | ||
}; | ||
/** | ||
* DO NOT EDIT | ||
* | ||
* This file is automatically generated at build | ||
*/ | ||
var METADATA_KEY = '__@ngrx/effects__'; | ||
function getEffectMetadataEntries(sourceProto) { | ||
return sourceProto.constructor[METADATA_KEY] || []; | ||
} | ||
function getSourceForInstance(instance) { | ||
return Object.getPrototypeOf(instance); | ||
} | ||
var getSourceMetadata = compose(getEffectMetadataEntries, getSourceForInstance); | ||
var onRunEffectsKey = 'ngrxOnRunEffects'; | ||
function isOnRunEffects(sourceInstance) { | ||
var source = getSourceForInstance(sourceInstance); | ||
return (onRunEffectsKey in source && typeof source[onRunEffectsKey] === 'function'); | ||
} | ||
var __read$4 = (undefined && undefined.__read) || function (o, n) { | ||
var m = typeof Symbol === "function" && o[Symbol.iterator]; | ||
if (!m) return o; | ||
var i = m.call(o), r, ar = [], e; | ||
try { | ||
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); | ||
} | ||
catch (error) { e = { error: error }; } | ||
finally { | ||
try { | ||
if (r && !r.done && (m = i["return"])) m.call(i); | ||
} | ||
finally { if (e) throw e.error; } | ||
} | ||
return ar; | ||
}; | ||
var __spread$3 = (undefined && undefined.__spread) || function () { | ||
for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read$4(arguments[i])); | ||
return ar; | ||
}; | ||
function mergeEffects(sourceInstance) { | ||
var sourceName = getSourceForInstance(sourceInstance).constructor.name; | ||
var observables = getSourceMetadata(sourceInstance).map(function (_a) { | ||
var propertyName = _a.propertyName, dispatch = _a.dispatch; | ||
var observable = typeof sourceInstance[propertyName] === 'function' | ||
? sourceInstance[propertyName]() | ||
: sourceInstance[propertyName]; | ||
if (dispatch === false) { | ||
return observable.pipe(operators.ignoreElements()); | ||
} | ||
var materialized$ = observable.pipe(operators.materialize()); | ||
return materialized$.pipe(operators.map(function (notification) { | ||
return ({ | ||
effect: sourceInstance[propertyName], | ||
notification: notification, | ||
propertyName: propertyName, | ||
sourceName: sourceName, | ||
sourceInstance: sourceInstance, | ||
}); | ||
})); | ||
}); | ||
return rxjs.merge.apply(void 0, __spread$3(observables)); | ||
} | ||
function resolveEffectSource(sourceInstance) { | ||
var mergedEffects$ = mergeEffects(sourceInstance); | ||
if (isOnRunEffects(sourceInstance)) { | ||
return sourceInstance.ngrxOnRunEffects(mergedEffects$); | ||
} | ||
return mergedEffects$; | ||
} | ||
var __extends$5 = (undefined && undefined.__extends) || (function () { | ||
var extendStatics = Object.setPrototypeOf || | ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || | ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; | ||
return function (d, b) { | ||
extendStatics(d, b); | ||
function __() { this.constructor = d; } | ||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); | ||
}; | ||
})(); | ||
var __read$5 = (undefined && undefined.__read) || function (o, n) { | ||
var m = typeof Symbol === "function" && o[Symbol.iterator]; | ||
if (!m) return o; | ||
var i = m.call(o), r, ar = [], e; | ||
try { | ||
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); | ||
} | ||
catch (error) { e = { error: error }; } | ||
finally { | ||
try { | ||
if (r && !r.done && (m = i["return"])) m.call(i); | ||
} | ||
finally { if (e) throw e.error; } | ||
} | ||
return ar; | ||
}; | ||
var __spread$4 = (undefined && undefined.__spread) || function () { | ||
for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read$5(arguments[i])); | ||
return ar; | ||
}; | ||
var Actions = /** @class */ (function (_super) { | ||
__extends$5(Actions, _super); | ||
function Actions(source) { | ||
var _this = _super.call(this) || this; | ||
if (source) { | ||
_this.source = source; | ||
} | ||
return _this; | ||
} | ||
Actions.prototype.lift = function (operator) { | ||
var observable = new Actions(); | ||
observable.source = this; | ||
observable.operator = operator; | ||
return observable; | ||
}; | ||
Actions.prototype.ofType = function () { | ||
var allowedTypes = []; | ||
for (var _i = 0; _i < arguments.length; _i++) { | ||
allowedTypes[_i] = arguments[_i]; | ||
} | ||
return ofType.apply(void 0, __spread$4(allowedTypes))(this); | ||
}; | ||
Actions.decorators = [ | ||
{ type: core.Injectable } | ||
]; | ||
/** @nocollapse */ | ||
Actions.ctorParameters = function () { return [ | ||
{ type: rxjs.Observable, decorators: [{ type: core.Inject, args: [ScannedActionsSubject,] },] }, | ||
]; }; | ||
return Actions; | ||
}(rxjs.Observable)); | ||
function ofType() { | ||
var allowedTypes = []; | ||
for (var _i = 0; _i < arguments.length; _i++) { | ||
allowedTypes[_i] = arguments[_i]; | ||
} | ||
return operators.filter(function (action) { | ||
return allowedTypes.some(function (type) { return type === action.type; }); | ||
}); | ||
} | ||
function verifyOutput(output, reporter) { | ||
reportErrorThrown(output, reporter); | ||
reportInvalidActions(output, reporter); | ||
} | ||
function reportErrorThrown(output, reporter) { | ||
if (output.notification.kind === 'E') { | ||
reporter.handleError(output.notification.error); | ||
} | ||
} | ||
function reportInvalidActions(output, reporter) { | ||
if (output.notification.kind === 'N') { | ||
var action = output.notification.value; | ||
var isInvalidAction = !isAction(action); | ||
if (isInvalidAction) { | ||
reporter.handleError(new Error("Effect " + getEffectName(output) + " dispatched an invalid action: " + action)); | ||
} | ||
} | ||
} | ||
function isAction(action) { | ||
return action && action.type && typeof action.type === 'string'; | ||
} | ||
function getEffectName(_a) { | ||
var propertyName = _a.propertyName, sourceInstance = _a.sourceInstance, sourceName = _a.sourceName; | ||
var isMethod = typeof sourceInstance[propertyName] === 'function'; | ||
return "\"" + sourceName + "." + propertyName + (isMethod ? '()' : '') + "\""; | ||
} | ||
var __extends$6 = (undefined && undefined.__extends) || (function () { | ||
var extendStatics = Object.setPrototypeOf || | ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || | ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; | ||
return function (d, b) { | ||
extendStatics(d, b); | ||
function __() { this.constructor = d; } | ||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); | ||
}; | ||
})(); | ||
var EffectSources = /** @class */ (function (_super) { | ||
__extends$6(EffectSources, _super); | ||
function EffectSources(errorHandler) { | ||
var _this = _super.call(this) || this; | ||
_this.errorHandler = errorHandler; | ||
return _this; | ||
} | ||
EffectSources.prototype.addEffects = function (effectSourceInstance) { | ||
this.next(effectSourceInstance); | ||
}; | ||
/** | ||
* @internal | ||
*/ | ||
/** | ||
* @internal | ||
*/ | ||
EffectSources.prototype.toActions = /** | ||
* @internal | ||
*/ | ||
function () { | ||
var _this = this; | ||
return this.pipe(operators.groupBy(getSourceForInstance), operators.mergeMap(function (source$) { | ||
return source$.pipe(operators.exhaustMap(resolveEffectSource), operators.map(function (output) { | ||
verifyOutput(output, _this.errorHandler); | ||
return output.notification; | ||
}), operators.filter(function (notification) { | ||
return notification.kind === 'N'; | ||
}), operators.dematerialize()); | ||
})); | ||
}; | ||
EffectSources.decorators = [ | ||
{ type: core.Injectable } | ||
]; | ||
/** @nocollapse */ | ||
EffectSources.ctorParameters = function () { return [ | ||
{ type: core.ErrorHandler, }, | ||
]; }; | ||
return EffectSources; | ||
}(rxjs.Subject)); | ||
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'); | ||
/** | ||
* DO NOT EDIT | ||
* | ||
* This file is automatically generated at build | ||
*/ | ||
function provideMockActions(factoryOrSource) { | ||
return { | ||
provide: Actions, | ||
provide: effects.Actions, | ||
useFactory: function () { | ||
if (typeof factoryOrSource === 'function') { | ||
return new Actions(rxjs.defer(factoryOrSource)); | ||
return new effects.Actions(rxjs.defer(factoryOrSource)); | ||
} | ||
return new Actions(factoryOrSource); | ||
return new effects.Actions(factoryOrSource); | ||
}, | ||
@@ -682,0 +22,0 @@ }; |
/** | ||
* @license NgRx v6.0.0-beta.0 | ||
* @license NgRx v6.0.0-beta.1 | ||
* (c) 2015-2018 Brandon Roberts, Mike Ryan, Rob Wormald, Victor Savkin | ||
* License: MIT | ||
*/ | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("@angular/core"),require("rxjs"),require("rxjs/operators")):"function"==typeof define&&define.amd?define(["exports","@angular/core","rxjs","rxjs/operators"],e):e(t.npm_package={},t.ng.core,t.rxjs,t.rxjs.operators)}(this,function(t,e,r,n){"use strict";var o,i=(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])},function(t,e){function r(){this.constructor=t}o(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),c="@ngrx/store/init",u=function(t){function r(){return t.call(this,{type:c})||this}return i(r,t),r.prototype.next=function(e){if(void 0===e)throw new TypeError("Actions must be objects");if(void 0===e.type)throw new TypeError("Actions must have a type property");t.prototype.next.call(this,e)},r.prototype.complete=function(){},r.prototype.ngOnDestroy=function(){t.prototype.complete.call(this)},r.decorators=[{type:e.Injectable}],r.ctorParameters=function(){return[]},r}(r.BehaviorSubject),a=(new e.InjectionToken("@ngrx/store Internal Initial State"),new e.InjectionToken("@ngrx/store Initial State")),p=new e.InjectionToken("@ngrx/store Reducer Factory"),f=(new e.InjectionToken("@ngrx/store Reducer Factory Provider"),new e.InjectionToken("@ngrx/store Initial Reducers")),s=(new e.InjectionToken("@ngrx/store Internal Initial Reducers"),new e.InjectionToken("@ngrx/store Meta Reducers"),new e.InjectionToken("@ngrx/store Store Features"),new e.InjectionToken("@ngrx/store Internal Store Reducers"),new e.InjectionToken("@ngrx/store Internal Feature Reducers"),new e.InjectionToken("@ngrx/store Internal Feature Reducers Token"),new e.InjectionToken("@ngrx/store Feature Reducers"),function(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,o,i=r.call(t),c=[];try{for(;(void 0===e||e-- >0)&&!(n=i.next()).done;)c.push(n.value)}catch(t){o={error:t}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return c}),y=function(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(s(arguments[e]));return t};function l(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return function(e){if(0===t.length)return e;var r=t[t.length-1];return t.slice(0,-1).reduceRight(function(t,e){return e(t)},r(e))}}var d,h,v,b=(d=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])},function(t,e){function r(){this.constructor=t}d(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),g=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var o in e=arguments[r])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},_=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return b(e,t),e}(r.Observable),j=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return b(e,t),e}(u),O=function(t){function r(e,r,n,o){var i=t.call(this,o(n,r))||this;return i.dispatcher=e,i.initialState=r,i.reducers=n,i.reducerFactory=o,i}return b(r,t),r.prototype.addFeature=function(t){var e=t.reducers,r=t.reducerFactory,n=t.metaReducers,o=t.initialState,i=t.key,c="function"==typeof e?function u(t){var e=Array.isArray(t)&&t.length>0?l.apply(void 0,y(t)):function(t){return t};return function(t,r){return t=e(t),function(e,n){return t(e=void 0===e?r:e,n)}}}(n)(e,o):function a(t,e){return Array.isArray(e)&&e.length>0?l.apply(null,y(e,[t])):t}(r,n)(e,o);this.addReducer(i,c)},r.prototype.removeFeature=function(t){this.removeReducer(t.key)},r.prototype.addReducer=function(t,e){var r;this.reducers=g({},this.reducers,((r={})[t]=e,r)),this.updateReducers(t)},r.prototype.removeReducer=function(t){this.reducers=function e(t,r){return Object.keys(t).filter(function(t){return t!==r}).reduce(function(e,r){return Object.assign(e,((n={})[r]=t[r],n));var n},{})}(this.reducers,t),this.updateReducers(t)},r.prototype.updateReducers=function(t){this.next(this.reducerFactory(this.reducers,this.initialState)),this.dispatcher.next({type:"@ngrx/store/update-reducers",feature:t})},r.prototype.ngOnDestroy=function(){this.complete()},r.decorators=[{type:e.Injectable}],r.ctorParameters=function(){return[{type:j},{type:void 0,decorators:[{type:e.Inject,args:[a]}]},{type:void 0,decorators:[{type:e.Inject,args:[f]}]},{type:void 0,decorators:[{type:e.Inject,args:[p]}]}]},r}(r.BehaviorSubject),m=(h=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])},function(t,e){function r(){this.constructor=t}h(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),x=function(t){function r(){return null!==t&&t.apply(this,arguments)||this}return m(r,t),r.prototype.ngOnDestroy=function(){this.complete()},r.decorators=[{type:e.Injectable}],r.ctorParameters=function(){return[]},r}(r.Subject),w=(v=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])},function(t,e){function r(){this.constructor=t}v(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),I=function(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,o,i=r.call(t),c=[];try{for(;(void 0===e||e-- >0)&&!(n=i.next()).done;)c.push(n.value)}catch(t){o={error:t}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return c},k=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return w(e,t),e}(r.Observable);function P(t,e){void 0===t&&(t={state:void 0});var r=I(e,2),n=r[0];return{state:(0,r[1])(t.state,n),action:n}}!function(t){function o(e,o,i,c){var u=t.call(this,c)||this,a=e.pipe(n.observeOn(r.queueScheduler)).pipe(n.withLatestFrom(o)).pipe(n.scan(P,{state:c}));return u.stateSubscription=a.subscribe(function(t){var e=t.action;u.next(t.state),i.next(e)}),u}w(o,t),o.prototype.ngOnDestroy=function(){this.stateSubscription.unsubscribe(),this.complete()},o.INIT=c,o.decorators=[{type:e.Injectable}],o.ctorParameters=function(){return[{type:u},{type:_},{type:x},{type:void 0,decorators:[{type:e.Inject,args:[a]}]}]}}(r.BehaviorSubject);var R,S=(R=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])},function(t,e){function r(){this.constructor=t}R(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),T=function(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,o,i=r.call(t),c=[];try{for(;(void 0===e||e-- >0)&&!(n=i.next()).done;)c.push(n.value)}catch(t){o={error:t}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return c},E=function(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(T(arguments[e]));return t};function A(t){return Object.getPrototypeOf(t)}!function(t){function r(e,r,n){var o=t.call(this)||this;return o.actionsObserver=r,o.reducerManager=n,o.source=e,o}S(r,t),r.prototype.select=function(t){for(var e=[],r=1;r<arguments.length;r++)e[r-1]=arguments[r];return function o(t){for(var e=[],r=1;r<arguments.length;r++)e[r-1]=arguments[r];return function r(o){var i;if("string"==typeof t)i=o.pipe(n.pluck.apply(void 0,E([t],e)));else{if("function"!=typeof t)throw new TypeError("Unexpected type '"+typeof t+"' in select operator, expected 'string' or 'function'");i=o.pipe(n.map(t))}return i.pipe(n.distinctUntilChanged())}}.apply(void 0,E([t],e))(this)},r.prototype.lift=function(t){var e=new r(this,this.actionsObserver,this.reducerManager);return e.operator=t,e},r.prototype.dispatch=function(t){this.actionsObserver.next(t)},r.prototype.next=function(t){this.actionsObserver.next(t)},r.prototype.error=function(t){this.actionsObserver.error(t)},r.prototype.complete=function(){this.actionsObserver.complete()},r.prototype.addReducer=function(t,e){this.reducerManager.addReducer(t,e)},r.prototype.removeReducer=function(t){this.reducerManager.removeReducer(t)},r.decorators=[{type:e.Injectable}],r.ctorParameters=function(){return[{type:k},{type:u},{type:O}]}}(r.Observable),Object;var F=l(function M(t){return t.constructor["__@ngrx/effects__"]||[]},A),N="ngrxOnRunEffects",q=function(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,o,i=r.call(t),c=[];try{for(;(void 0===e||e-- >0)&&!(n=i.next()).done;)c.push(n.value)}catch(t){o={error:t}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return c},B=function(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(q(arguments[e]));return t};function D(t){var e=function o(t){var e=A(t).constructor.name,o=F(t).map(function(r){var o=r.propertyName,i=r.dispatch,c="function"==typeof t[o]?t[o]():t[o];return!1===i?c.pipe(n.ignoreElements()):c.pipe(n.materialize()).pipe(n.map(function(r){return{effect:t[o],notification:r,propertyName:o,sourceName:e,sourceInstance:t}}))});return r.merge.apply(void 0,B(o))}(t);return function i(t){var e=A(t);return N in e&&"function"==typeof e[N]}(t)?t.ngrxOnRunEffects(e):e}var H,z,U=(H=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])},function(t,e){function r(){this.constructor=t}H(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),C=function(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,o,i=r.call(t),c=[];try{for(;(void 0===e||e-- >0)&&!(n=i.next()).done;)c.push(n.value)}catch(t){o={error:t}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return c},L=function(t){function o(e){var r=t.call(this)||this;return e&&(r.source=e),r}return U(o,t),o.prototype.lift=function(t){var e=new o;return e.source=this,e.operator=t,e},o.prototype.ofType=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return function r(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return n.filter(function(e){return t.some(function(t){return t===e.type})})}.apply(void 0,function(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(C(arguments[e]));return t}(t))(this)},o.decorators=[{type:e.Injectable}],o.ctorParameters=function(){return[{type:r.Observable,decorators:[{type:e.Inject,args:[x]}]}]},o}(r.Observable),G=(z=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])},function(t,e){function r(){this.constructor=t}z(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)});(function(t){function r(e){var r=t.call(this)||this;return r.errorHandler=e,r}G(r,t),r.prototype.addEffects=function(t){this.next(t)},r.prototype.toActions=function(){var t=this;return this.pipe(n.groupBy(A),n.mergeMap(function(e){return e.pipe(n.exhaustMap(D),n.map(function(e){return function r(t,e){!function r(t,e){"E"===t.notification.kind&&e.handleError(t.notification.error)}(t,e),function n(t,e){if("N"===t.notification.kind){var r=t.notification.value;!function n(t){return t&&t.type&&"string"==typeof t.type}(r)&&e.handleError(new Error("Effect "+function o(t){var e=t.propertyName;return'"'+t.sourceName+"."+e+("function"==typeof t.sourceInstance[e]?"()":"")+'"'}(t)+" dispatched an invalid action: "+r))}}(t,e)}(e,t.errorHandler),e.notification}),n.filter(function(t){return"N"===t.kind}),n.dematerialize())}))},r.decorators=[{type:e.Injectable}],r.ctorParameters=function(){return[{type:e.ErrorHandler}]}})(r.Subject),new e.InjectionToken("ngrx/effects: Immediate Effects"),new e.InjectionToken("ngrx/effects: Root Effects"),new e.InjectionToken("ngrx/effects: Feature Effects"),t.provideMockActions=function J(t){return{provide:L,useFactory:function(){return new L("function"==typeof t?r.defer(t):t)}}},Object.defineProperty(t,"__esModule",{value:!0})}); | ||
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports,require("@ngrx/effects"),require("rxjs")):"function"==typeof define&&define.amd?define(["exports","@ngrx/effects","rxjs"],n):n(e.npm_package={},e["@ngrx/effects"],e.rxjs)}(this,function(e,n,t){"use strict";e.provideMockActions=function o(e){return{provide:n.Actions,useFactory:function(){return new n.Actions("function"==typeof e?t.defer(e):e)}}},Object.defineProperty(e,"__esModule",{value:!0})}); |
/** | ||
* @license NgRx v6.0.0-beta.0 | ||
* @license NgRx v6.0.0-beta.1 | ||
* (c) 2015-2018 Brandon Roberts, Mike Ryan, Rob Wormald, Victor Savkin | ||
@@ -7,496 +7,7 @@ * License: MIT | ||
(function (global, factory) { | ||
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('rxjs'), require('rxjs/operators')) : | ||
typeof define === 'function' && define.amd ? define(['exports', '@angular/core', 'rxjs', 'rxjs/operators'], factory) : | ||
(factory((global.npm_package = {}),global.ng.core,global.rxjs,global.rxjs.operators)); | ||
}(this, (function (exports,core,rxjs,operators) { 'use strict'; | ||
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@ngrx/store'), require('rxjs'), require('rxjs/operators'), require('@angular/core')) : | ||
typeof define === 'function' && define.amd ? define(['exports', '@ngrx/store', 'rxjs', 'rxjs/operators', '@angular/core'], factory) : | ||
(factory((global.npm_package = {}),global['@ngrx/store'],global.rxjs,global.rxjs.operators,global.ng.core)); | ||
}(this, (function (exports,store,rxjs,operators,core) { 'use strict'; | ||
var __extends$1 = (undefined && undefined.__extends) || (function () { | ||
var extendStatics = Object.setPrototypeOf || | ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || | ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; | ||
return function (d, b) { | ||
extendStatics(d, b); | ||
function __() { this.constructor = d; } | ||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); | ||
}; | ||
})(); | ||
var INIT = '@ngrx/store/init'; | ||
var ActionsSubject = /** @class */ (function (_super) { | ||
__extends$1(ActionsSubject, _super); | ||
function ActionsSubject() { | ||
return _super.call(this, { type: INIT }) || this; | ||
} | ||
ActionsSubject.prototype.next = function (action) { | ||
if (typeof action === 'undefined') { | ||
throw new TypeError("Actions must be objects"); | ||
} | ||
else if (typeof action.type === 'undefined') { | ||
throw new TypeError("Actions must have a type property"); | ||
} | ||
_super.prototype.next.call(this, action); | ||
}; | ||
ActionsSubject.prototype.complete = function () { | ||
/* noop */ | ||
}; | ||
ActionsSubject.prototype.ngOnDestroy = function () { | ||
_super.prototype.complete.call(this); | ||
}; | ||
ActionsSubject.decorators = [ | ||
{ type: core.Injectable } | ||
]; | ||
/** @nocollapse */ | ||
ActionsSubject.ctorParameters = function () { return []; }; | ||
return ActionsSubject; | ||
}(rxjs.BehaviorSubject)); | ||
var _INITIAL_STATE = new core.InjectionToken('@ngrx/store Internal Initial State'); | ||
var INITIAL_STATE = new core.InjectionToken('@ngrx/store Initial State'); | ||
var REDUCER_FACTORY = new core.InjectionToken('@ngrx/store Reducer Factory'); | ||
var _REDUCER_FACTORY = new core.InjectionToken('@ngrx/store Reducer Factory Provider'); | ||
var INITIAL_REDUCERS = new core.InjectionToken('@ngrx/store Initial Reducers'); | ||
var _INITIAL_REDUCERS = new core.InjectionToken('@ngrx/store Internal Initial Reducers'); | ||
var META_REDUCERS = new core.InjectionToken('@ngrx/store Meta Reducers'); | ||
var STORE_FEATURES = new core.InjectionToken('@ngrx/store Store Features'); | ||
var _STORE_REDUCERS = new core.InjectionToken('@ngrx/store Internal Store Reducers'); | ||
var _FEATURE_REDUCERS = new core.InjectionToken('@ngrx/store Internal Feature Reducers'); | ||
var _FEATURE_REDUCERS_TOKEN = new core.InjectionToken('@ngrx/store Internal Feature Reducers Token'); | ||
var FEATURE_REDUCERS = new core.InjectionToken('@ngrx/store Feature Reducers'); | ||
var __read$1 = (undefined && undefined.__read) || function (o, n) { | ||
var m = typeof Symbol === "function" && o[Symbol.iterator]; | ||
if (!m) return o; | ||
var i = m.call(o), r, ar = [], e; | ||
try { | ||
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); | ||
} | ||
catch (error) { e = { error: error }; } | ||
finally { | ||
try { | ||
if (r && !r.done && (m = i["return"])) m.call(i); | ||
} | ||
finally { if (e) throw e.error; } | ||
} | ||
return ar; | ||
}; | ||
var __spread$1 = (undefined && undefined.__spread) || function () { | ||
for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read$1(arguments[i])); | ||
return ar; | ||
}; | ||
function omit(object, keyToRemove) { | ||
return Object.keys(object) | ||
.filter(function (key) { return key !== keyToRemove; }) | ||
.reduce(function (result, key) { | ||
return Object.assign(result, (_a = {}, _a[key] = object[key], _a)); | ||
var _a; | ||
}, {}); | ||
} | ||
function compose() { | ||
var functions = []; | ||
for (var _i = 0; _i < arguments.length; _i++) { | ||
functions[_i] = arguments[_i]; | ||
} | ||
return function (arg) { | ||
if (functions.length === 0) { | ||
return arg; | ||
} | ||
var last = functions[functions.length - 1]; | ||
var rest = functions.slice(0, -1); | ||
return rest.reduceRight(function (composed, fn) { return fn(composed); }, last(arg)); | ||
}; | ||
} | ||
function createReducerFactory(reducerFactory, metaReducers) { | ||
if (Array.isArray(metaReducers) && metaReducers.length > 0) { | ||
return compose.apply(null, __spread$1(metaReducers, [reducerFactory])); | ||
} | ||
return reducerFactory; | ||
} | ||
function createFeatureReducerFactory(metaReducers) { | ||
var reducerFactory = Array.isArray(metaReducers) && metaReducers.length > 0 | ||
? compose.apply(void 0, __spread$1(metaReducers)) : function (r) { return r; }; | ||
return function (reducer, initialState) { | ||
reducer = reducerFactory(reducer); | ||
return function (state, action) { | ||
state = state === undefined ? initialState : state; | ||
return reducer(state, action); | ||
}; | ||
}; | ||
} | ||
var __extends$2 = (undefined && undefined.__extends) || (function () { | ||
var extendStatics = Object.setPrototypeOf || | ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || | ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; | ||
return function (d, b) { | ||
extendStatics(d, b); | ||
function __() { this.constructor = d; } | ||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); | ||
}; | ||
})(); | ||
var __assign = (undefined && undefined.__assign) || Object.assign || function(t) { | ||
for (var s, i = 1, n = arguments.length; i < n; i++) { | ||
s = arguments[i]; | ||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) | ||
t[p] = s[p]; | ||
} | ||
return t; | ||
}; | ||
var ReducerObservable = /** @class */ (function (_super) { | ||
__extends$2(ReducerObservable, _super); | ||
function ReducerObservable() { | ||
return _super !== null && _super.apply(this, arguments) || this; | ||
} | ||
return ReducerObservable; | ||
}(rxjs.Observable)); | ||
var ReducerManagerDispatcher = /** @class */ (function (_super) { | ||
__extends$2(ReducerManagerDispatcher, _super); | ||
function ReducerManagerDispatcher() { | ||
return _super !== null && _super.apply(this, arguments) || this; | ||
} | ||
return ReducerManagerDispatcher; | ||
}(ActionsSubject)); | ||
var UPDATE = '@ngrx/store/update-reducers'; | ||
var ReducerManager = /** @class */ (function (_super) { | ||
__extends$2(ReducerManager, _super); | ||
function ReducerManager(dispatcher, initialState, reducers, reducerFactory) { | ||
var _this = _super.call(this, reducerFactory(reducers, initialState)) || this; | ||
_this.dispatcher = dispatcher; | ||
_this.initialState = initialState; | ||
_this.reducers = reducers; | ||
_this.reducerFactory = reducerFactory; | ||
return _this; | ||
} | ||
ReducerManager.prototype.addFeature = function (_a) { | ||
var reducers = _a.reducers, reducerFactory = _a.reducerFactory, metaReducers = _a.metaReducers, initialState = _a.initialState, key = _a.key; | ||
var reducer = typeof reducers === 'function' | ||
? createFeatureReducerFactory(metaReducers)(reducers, initialState) | ||
: createReducerFactory(reducerFactory, metaReducers)(reducers, initialState); | ||
this.addReducer(key, reducer); | ||
}; | ||
ReducerManager.prototype.removeFeature = function (_a) { | ||
var key = _a.key; | ||
this.removeReducer(key); | ||
}; | ||
ReducerManager.prototype.addReducer = function (key, reducer) { | ||
this.reducers = __assign({}, this.reducers, (_a = {}, _a[key] = reducer, _a)); | ||
this.updateReducers(key); | ||
var _a; | ||
}; | ||
ReducerManager.prototype.removeReducer = function (key) { | ||
this.reducers = omit(this.reducers, key) /*TODO(#823)*/; | ||
this.updateReducers(key); | ||
}; | ||
ReducerManager.prototype.updateReducers = function (key) { | ||
this.next(this.reducerFactory(this.reducers, this.initialState)); | ||
this.dispatcher.next({ | ||
type: UPDATE, | ||
feature: key, | ||
}); | ||
}; | ||
ReducerManager.prototype.ngOnDestroy = function () { | ||
this.complete(); | ||
}; | ||
ReducerManager.decorators = [ | ||
{ type: core.Injectable } | ||
]; | ||
/** @nocollapse */ | ||
ReducerManager.ctorParameters = function () { return [ | ||
{ type: ReducerManagerDispatcher, }, | ||
{ type: undefined, decorators: [{ type: core.Inject, args: [INITIAL_STATE,] },] }, | ||
{ type: undefined, decorators: [{ type: core.Inject, args: [INITIAL_REDUCERS,] },] }, | ||
{ type: undefined, decorators: [{ type: core.Inject, args: [REDUCER_FACTORY,] },] }, | ||
]; }; | ||
return ReducerManager; | ||
}(rxjs.BehaviorSubject)); | ||
var __extends$4 = (undefined && undefined.__extends) || (function () { | ||
var extendStatics = Object.setPrototypeOf || | ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || | ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; | ||
return function (d, b) { | ||
extendStatics(d, b); | ||
function __() { this.constructor = d; } | ||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); | ||
}; | ||
})(); | ||
var ScannedActionsSubject = /** @class */ (function (_super) { | ||
__extends$4(ScannedActionsSubject, _super); | ||
function ScannedActionsSubject() { | ||
return _super !== null && _super.apply(this, arguments) || this; | ||
} | ||
ScannedActionsSubject.prototype.ngOnDestroy = function () { | ||
this.complete(); | ||
}; | ||
ScannedActionsSubject.decorators = [ | ||
{ type: core.Injectable } | ||
]; | ||
/** @nocollapse */ | ||
ScannedActionsSubject.ctorParameters = function () { return []; }; | ||
return ScannedActionsSubject; | ||
}(rxjs.Subject)); | ||
var __extends$3 = (undefined && undefined.__extends) || (function () { | ||
var extendStatics = Object.setPrototypeOf || | ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || | ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; | ||
return function (d, b) { | ||
extendStatics(d, b); | ||
function __() { this.constructor = d; } | ||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); | ||
}; | ||
})(); | ||
var __read$2 = (undefined && undefined.__read) || function (o, n) { | ||
var m = typeof Symbol === "function" && o[Symbol.iterator]; | ||
if (!m) return o; | ||
var i = m.call(o), r, ar = [], e; | ||
try { | ||
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); | ||
} | ||
catch (error) { e = { error: error }; } | ||
finally { | ||
try { | ||
if (r && !r.done && (m = i["return"])) m.call(i); | ||
} | ||
finally { if (e) throw e.error; } | ||
} | ||
return ar; | ||
}; | ||
var StateObservable = /** @class */ (function (_super) { | ||
__extends$3(StateObservable, _super); | ||
function StateObservable() { | ||
return _super !== null && _super.apply(this, arguments) || this; | ||
} | ||
return StateObservable; | ||
}(rxjs.Observable)); | ||
var State = /** @class */ (function (_super) { | ||
__extends$3(State, _super); | ||
function State(actions$, reducer$, scannedActions, initialState) { | ||
var _this = _super.call(this, initialState) || this; | ||
var actionsOnQueue$ = actions$.pipe(operators.observeOn(rxjs.queueScheduler)); | ||
var withLatestReducer$ = actionsOnQueue$.pipe(operators.withLatestFrom(reducer$)); | ||
var seed = { state: initialState }; | ||
var stateAndAction$ = withLatestReducer$.pipe(operators.scan(reduceState, seed)); | ||
_this.stateSubscription = stateAndAction$.subscribe(function (_a) { | ||
var state = _a.state, action = _a.action; | ||
_this.next(state); | ||
scannedActions.next(action); | ||
}); | ||
return _this; | ||
} | ||
State.prototype.ngOnDestroy = function () { | ||
this.stateSubscription.unsubscribe(); | ||
this.complete(); | ||
}; | ||
State.INIT = INIT; | ||
State.decorators = [ | ||
{ type: core.Injectable } | ||
]; | ||
/** @nocollapse */ | ||
State.ctorParameters = function () { return [ | ||
{ type: ActionsSubject, }, | ||
{ type: ReducerObservable, }, | ||
{ type: ScannedActionsSubject, }, | ||
{ type: undefined, decorators: [{ type: core.Inject, args: [INITIAL_STATE,] },] }, | ||
]; }; | ||
return State; | ||
}(rxjs.BehaviorSubject)); | ||
function reduceState(stateActionPair, _a) { | ||
if (stateActionPair === void 0) { stateActionPair = { state: undefined }; } | ||
var _b = __read$2(_a, 2), action = _b[0], reducer = _b[1]; | ||
var state = stateActionPair.state; | ||
return { state: reducer(state, action), action: action }; | ||
} | ||
var __extends = (undefined && undefined.__extends) || (function () { | ||
var extendStatics = Object.setPrototypeOf || | ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || | ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; | ||
return function (d, b) { | ||
extendStatics(d, b); | ||
function __() { this.constructor = d; } | ||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); | ||
}; | ||
})(); | ||
var __read = (undefined && undefined.__read) || function (o, n) { | ||
var m = typeof Symbol === "function" && o[Symbol.iterator]; | ||
if (!m) return o; | ||
var i = m.call(o), r, ar = [], e; | ||
try { | ||
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); | ||
} | ||
catch (error) { e = { error: error }; } | ||
finally { | ||
try { | ||
if (r && !r.done && (m = i["return"])) m.call(i); | ||
} | ||
finally { if (e) throw e.error; } | ||
} | ||
return ar; | ||
}; | ||
var __spread = (undefined && undefined.__spread) || function () { | ||
for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read(arguments[i])); | ||
return ar; | ||
}; | ||
var Store = /** @class */ (function (_super) { | ||
__extends(Store, _super); | ||
function Store(state$, actionsObserver, reducerManager) { | ||
var _this = _super.call(this) || this; | ||
_this.actionsObserver = actionsObserver; | ||
_this.reducerManager = reducerManager; | ||
_this.source = state$; | ||
return _this; | ||
} | ||
Store.prototype.select = function (pathOrMapFn) { | ||
var paths = []; | ||
for (var _i = 1; _i < arguments.length; _i++) { | ||
paths[_i - 1] = arguments[_i]; | ||
} | ||
return select.apply(void 0, __spread([pathOrMapFn], paths))(this); | ||
}; | ||
Store.prototype.lift = function (operator) { | ||
var store = new Store(this, this.actionsObserver, this.reducerManager); | ||
store.operator = operator; | ||
return store; | ||
}; | ||
Store.prototype.dispatch = function (action) { | ||
this.actionsObserver.next(action); | ||
}; | ||
Store.prototype.next = function (action) { | ||
this.actionsObserver.next(action); | ||
}; | ||
Store.prototype.error = function (err) { | ||
this.actionsObserver.error(err); | ||
}; | ||
Store.prototype.complete = function () { | ||
this.actionsObserver.complete(); | ||
}; | ||
Store.prototype.addReducer = function (key, reducer) { | ||
this.reducerManager.addReducer(key, reducer); | ||
}; | ||
Store.prototype.removeReducer = function (key) { | ||
this.reducerManager.removeReducer(key); | ||
}; | ||
Store.decorators = [ | ||
{ type: core.Injectable } | ||
]; | ||
/** @nocollapse */ | ||
Store.ctorParameters = function () { return [ | ||
{ type: StateObservable, }, | ||
{ type: ActionsSubject, }, | ||
{ type: ReducerManager, }, | ||
]; }; | ||
return Store; | ||
}(rxjs.Observable)); | ||
function select(pathOrMapFn) { | ||
var paths = []; | ||
for (var _i = 1; _i < arguments.length; _i++) { | ||
paths[_i - 1] = arguments[_i]; | ||
} | ||
return function selectOperator(source$) { | ||
var mapped$; | ||
if (typeof pathOrMapFn === 'string') { | ||
mapped$ = source$.pipe(operators.pluck.apply(void 0, __spread([pathOrMapFn], paths))); | ||
} | ||
else if (typeof pathOrMapFn === 'function') { | ||
mapped$ = source$.pipe(operators.map(pathOrMapFn)); | ||
} | ||
else { | ||
throw new TypeError("Unexpected type '" + typeof pathOrMapFn + "' in select operator," + | ||
" expected 'string' or 'function'"); | ||
} | ||
return mapped$.pipe(operators.distinctUntilChanged()); | ||
}; | ||
} | ||
var __read$3 = (undefined && undefined.__read) || function (o, n) { | ||
var m = typeof Symbol === "function" && o[Symbol.iterator]; | ||
if (!m) return o; | ||
var i = m.call(o), r, ar = [], e; | ||
try { | ||
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); | ||
} | ||
catch (error) { e = { error: error }; } | ||
finally { | ||
try { | ||
if (r && !r.done && (m = i["return"])) m.call(i); | ||
} | ||
finally { if (e) throw e.error; } | ||
} | ||
return ar; | ||
}; | ||
var __spread$2 = (undefined && undefined.__spread) || function () { | ||
for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read$3(arguments[i])); | ||
return ar; | ||
}; | ||
var __assign$1 = (undefined && undefined.__assign) || Object.assign || function(t) { | ||
for (var s, i = 1, n = arguments.length; i < n; i++) { | ||
s = arguments[i]; | ||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) | ||
t[p] = s[p]; | ||
} | ||
return t; | ||
}; | ||
var StoreRootModule = /** @class */ (function () { | ||
function StoreRootModule(actions$, reducer$, scannedActions$, store) { | ||
} | ||
StoreRootModule.decorators = [ | ||
{ type: core.NgModule, args: [{},] } | ||
]; | ||
/** @nocollapse */ | ||
StoreRootModule.ctorParameters = function () { return [ | ||
{ type: ActionsSubject, }, | ||
{ type: ReducerObservable, }, | ||
{ type: ScannedActionsSubject, }, | ||
{ type: Store, }, | ||
]; }; | ||
return StoreRootModule; | ||
}()); | ||
var StoreFeatureModule = /** @class */ (function () { | ||
function StoreFeatureModule(features, featureReducers, reducerManager, root) { | ||
this.features = features; | ||
this.featureReducers = featureReducers; | ||
this.reducerManager = reducerManager; | ||
features | ||
.map(function (feature, index) { | ||
var featureReducerCollection = featureReducers.shift(); | ||
var reducers = featureReducerCollection[index]; | ||
return __assign$1({}, feature, { reducers: reducers, initialState: _initialStateFactory(feature.initialState) }); | ||
}) | ||
.forEach(function (feature) { return reducerManager.addFeature(feature); }); | ||
} | ||
StoreFeatureModule.prototype.ngOnDestroy = function () { | ||
var _this = this; | ||
this.features.forEach(function (feature) { | ||
return _this.reducerManager.removeFeature(feature); | ||
}); | ||
}; | ||
StoreFeatureModule.decorators = [ | ||
{ type: core.NgModule, args: [{},] } | ||
]; | ||
/** @nocollapse */ | ||
StoreFeatureModule.ctorParameters = function () { return [ | ||
{ type: Array, decorators: [{ type: core.Inject, args: [STORE_FEATURES,] },] }, | ||
{ type: Array, decorators: [{ type: core.Inject, args: [FEATURE_REDUCERS,] },] }, | ||
{ type: ReducerManager, }, | ||
{ type: StoreRootModule, }, | ||
]; }; | ||
return StoreFeatureModule; | ||
}()); | ||
function _initialStateFactory(initialState) { | ||
if (typeof initialState === 'function') { | ||
return initialState(); | ||
} | ||
return initialState; | ||
} | ||
/** | ||
* DO NOT EDIT | ||
* | ||
* This file is automatically generated at build | ||
*/ | ||
var METADATA_KEY = '__@ngrx/effects__'; | ||
@@ -523,3 +34,3 @@ function getEffectMetadataEntries(sourceProto) { | ||
} | ||
var getSourceMetadata = compose(getEffectMetadataEntries, getSourceForInstance); | ||
var getSourceMetadata = store.compose(getEffectMetadataEntries, getSourceForInstance); | ||
function getEffectsMetadata(instance) { | ||
@@ -540,3 +51,3 @@ var metadata = {}; | ||
var __read$4 = (undefined && undefined.__read) || function (o, n) { | ||
var __read = (undefined && undefined.__read) || function (o, n) { | ||
var m = typeof Symbol === "function" && o[Symbol.iterator]; | ||
@@ -557,4 +68,4 @@ if (!m) return o; | ||
}; | ||
var __spread$3 = (undefined && undefined.__spread) || function () { | ||
for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read$4(arguments[i])); | ||
var __spread = (undefined && undefined.__spread) || function () { | ||
for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read(arguments[i])); | ||
return ar; | ||
@@ -583,3 +94,3 @@ }; | ||
}); | ||
return rxjs.merge.apply(void 0, __spread$3(observables)); | ||
return rxjs.merge.apply(void 0, __spread(observables)); | ||
} | ||
@@ -594,3 +105,3 @@ function resolveEffectSource(sourceInstance) { | ||
var __extends$5 = (undefined && undefined.__extends) || (function () { | ||
var __extends = (undefined && undefined.__extends) || (function () { | ||
var extendStatics = Object.setPrototypeOf || | ||
@@ -605,3 +116,3 @@ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || | ||
})(); | ||
var __read$5 = (undefined && undefined.__read) || function (o, n) { | ||
var __read$1 = (undefined && undefined.__read) || function (o, n) { | ||
var m = typeof Symbol === "function" && o[Symbol.iterator]; | ||
@@ -622,8 +133,8 @@ if (!m) return o; | ||
}; | ||
var __spread$4 = (undefined && undefined.__spread) || function () { | ||
for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read$5(arguments[i])); | ||
var __spread$1 = (undefined && undefined.__spread) || function () { | ||
for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read$1(arguments[i])); | ||
return ar; | ||
}; | ||
var Actions = /** @class */ (function (_super) { | ||
__extends$5(Actions, _super); | ||
__extends(Actions, _super); | ||
function Actions(source) { | ||
@@ -647,3 +158,3 @@ var _this = _super.call(this) || this; | ||
} | ||
return ofType.apply(void 0, __spread$4(allowedTypes))(this); | ||
return ofType.apply(void 0, __spread$1(allowedTypes))(this); | ||
}; | ||
@@ -655,3 +166,3 @@ Actions.decorators = [ | ||
Actions.ctorParameters = function () { return [ | ||
{ type: rxjs.Observable, decorators: [{ type: core.Inject, args: [ScannedActionsSubject,] },] }, | ||
{ type: rxjs.Observable, decorators: [{ type: core.Inject, args: [store.ScannedActionsSubject,] },] }, | ||
]; }; | ||
@@ -697,3 +208,3 @@ return Actions; | ||
var __extends$6 = (undefined && undefined.__extends) || (function () { | ||
var __extends$1 = (undefined && undefined.__extends) || (function () { | ||
var extendStatics = Object.setPrototypeOf || | ||
@@ -709,3 +220,3 @@ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || | ||
var EffectSources = /** @class */ (function (_super) { | ||
__extends$6(EffectSources, _super); | ||
__extends$1(EffectSources, _super); | ||
function EffectSources(errorHandler) { | ||
@@ -754,5 +265,5 @@ var _this = _super.call(this) || this; | ||
var EffectsRunner = /** @class */ (function () { | ||
function EffectsRunner(effectSources, store) { | ||
function EffectsRunner(effectSources, store$$1) { | ||
this.effectSources = effectSources; | ||
this.store = store; | ||
this.store = store$$1; | ||
this.effectsSubscription = null; | ||
@@ -779,3 +290,3 @@ } | ||
{ type: EffectSources, }, | ||
{ type: Store, }, | ||
{ type: store.Store, }, | ||
]; }; | ||
@@ -787,3 +298,3 @@ return EffectsRunner; | ||
var EffectsRootModule = /** @class */ (function () { | ||
function EffectsRootModule(sources, runner, store, rootEffects, storeRootModule, storeFeatureModule) { | ||
function EffectsRootModule(sources, runner, store$$1, rootEffects, storeRootModule, storeFeatureModule) { | ||
this.sources = sources; | ||
@@ -794,3 +305,3 @@ runner.start(); | ||
}); | ||
store.dispatch({ type: ROOT_EFFECTS_INIT }); | ||
store$$1.dispatch({ type: ROOT_EFFECTS_INIT }); | ||
} | ||
@@ -807,6 +318,6 @@ EffectsRootModule.prototype.addEffects = function (effectSourceInstance) { | ||
{ type: EffectsRunner, }, | ||
{ type: Store, }, | ||
{ type: store.Store, }, | ||
{ type: Array, decorators: [{ type: core.Inject, args: [ROOT_EFFECTS,] },] }, | ||
{ type: StoreRootModule, decorators: [{ type: core.Optional },] }, | ||
{ type: StoreFeatureModule, decorators: [{ type: core.Optional },] }, | ||
{ type: store.StoreRootModule, decorators: [{ type: core.Optional },] }, | ||
{ type: store.StoreFeatureModule, decorators: [{ type: core.Optional },] }, | ||
]; }; | ||
@@ -832,4 +343,4 @@ return EffectsRootModule; | ||
{ type: Array, decorators: [{ type: core.Inject, args: [FEATURE_EFFECTS,] },] }, | ||
{ type: StoreRootModule, decorators: [{ type: core.Optional },] }, | ||
{ type: StoreFeatureModule, decorators: [{ type: core.Optional },] }, | ||
{ type: store.StoreRootModule, decorators: [{ type: core.Optional },] }, | ||
{ type: store.StoreFeatureModule, decorators: [{ type: core.Optional },] }, | ||
]; }; | ||
@@ -836,0 +347,0 @@ return EffectsFeatureModule; |
/** | ||
* @license NgRx v6.0.0-beta.0 | ||
* @license NgRx v6.0.0-beta.1 | ||
* (c) 2015-2018 Brandon Roberts, Mike Ryan, Rob Wormald, Victor Savkin | ||
* License: MIT | ||
*/ | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("@angular/core"),require("rxjs"),require("rxjs/operators")):"function"==typeof define&&define.amd?define(["exports","@angular/core","rxjs","rxjs/operators"],e):e(t.npm_package={},t.ng.core,t.rxjs,t.rxjs.operators)}(this,function(t,e,r,n){"use strict";var o,c=(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])},function(t,e){function r(){this.constructor=t}o(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),i="@ngrx/store/init",u=function(t){function r(){return t.call(this,{type:i})||this}return c(r,t),r.prototype.next=function(e){if(void 0===e)throw new TypeError("Actions must be objects");if(void 0===e.type)throw new TypeError("Actions must have a type property");t.prototype.next.call(this,e)},r.prototype.complete=function(){},r.prototype.ngOnDestroy=function(){t.prototype.complete.call(this)},r.decorators=[{type:e.Injectable}],r.ctorParameters=function(){return[]},r}(r.BehaviorSubject),a=(new e.InjectionToken("@ngrx/store Internal Initial State"),new e.InjectionToken("@ngrx/store Initial State")),s=new e.InjectionToken("@ngrx/store Reducer Factory"),f=(new e.InjectionToken("@ngrx/store Reducer Factory Provider"),new e.InjectionToken("@ngrx/store Initial Reducers")),p=(new e.InjectionToken("@ngrx/store Internal Initial Reducers"),new e.InjectionToken("@ngrx/store Meta Reducers"),new e.InjectionToken("@ngrx/store Store Features")),y=(new e.InjectionToken("@ngrx/store Internal Store Reducers"),new e.InjectionToken("@ngrx/store Internal Feature Reducers"),new e.InjectionToken("@ngrx/store Internal Feature Reducers Token"),new e.InjectionToken("@ngrx/store Feature Reducers")),l=function(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,o,c=r.call(t),i=[];try{for(;(void 0===e||e-- >0)&&!(n=c.next()).done;)i.push(n.value)}catch(t){o={error:t}}finally{try{n&&!n.done&&(r=c.return)&&r.call(c)}finally{if(o)throw o.error}}return i},d=function(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(l(arguments[e]));return t};function h(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return function(e){if(0===t.length)return e;var r=t[t.length-1];return t.slice(0,-1).reduceRight(function(t,e){return e(t)},r(e))}}var v,g,_,b=(v=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])},function(t,e){function r(){this.constructor=t}v(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),m=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var o in e=arguments[r])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},j=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return b(e,t),e}(r.Observable),O=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return b(e,t),e}(u),x=function(t){function r(e,r,n,o){var c=t.call(this,o(n,r))||this;return c.dispatcher=e,c.initialState=r,c.reducers=n,c.reducerFactory=o,c}return b(r,t),r.prototype.addFeature=function(t){var e=t.reducers,r=t.reducerFactory,n=t.metaReducers,o=t.initialState,c=t.key,i="function"==typeof e?function u(t){var e=Array.isArray(t)&&t.length>0?h.apply(void 0,d(t)):function(t){return t};return function(t,r){return t=e(t),function(e,n){return t(e=void 0===e?r:e,n)}}}(n)(e,o):function a(t,e){return Array.isArray(e)&&e.length>0?h.apply(null,d(e,[t])):t}(r,n)(e,o);this.addReducer(c,i)},r.prototype.removeFeature=function(t){this.removeReducer(t.key)},r.prototype.addReducer=function(t,e){var r;this.reducers=m({},this.reducers,((r={})[t]=e,r)),this.updateReducers(t)},r.prototype.removeReducer=function(t){this.reducers=function e(t,r){return Object.keys(t).filter(function(t){return t!==r}).reduce(function(e,r){return Object.assign(e,((n={})[r]=t[r],n));var n},{})}(this.reducers,t),this.updateReducers(t)},r.prototype.updateReducers=function(t){this.next(this.reducerFactory(this.reducers,this.initialState)),this.dispatcher.next({type:"@ngrx/store/update-reducers",feature:t})},r.prototype.ngOnDestroy=function(){this.complete()},r.decorators=[{type:e.Injectable}],r.ctorParameters=function(){return[{type:O},{type:void 0,decorators:[{type:e.Inject,args:[a]}]},{type:void 0,decorators:[{type:e.Inject,args:[f]}]},{type:void 0,decorators:[{type:e.Inject,args:[s]}]}]},r}(r.BehaviorSubject),I=(g=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])},function(t,e){function r(){this.constructor=t}g(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),w=function(t){function r(){return null!==t&&t.apply(this,arguments)||this}return I(r,t),r.prototype.ngOnDestroy=function(){this.complete()},r.decorators=[{type:e.Injectable}],r.ctorParameters=function(){return[]},r}(r.Subject),S=(_=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])},function(t,e){function r(){this.constructor=t}_(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),P=function(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,o,c=r.call(t),i=[];try{for(;(void 0===e||e-- >0)&&!(n=c.next()).done;)i.push(n.value)}catch(t){o={error:t}}finally{try{n&&!n.done&&(r=c.return)&&r.call(c)}finally{if(o)throw o.error}}return i},E=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return S(e,t),e}(r.Observable);function R(t,e){void 0===t&&(t={state:void 0});var r=P(e,2),n=r[0];return{state:(0,r[1])(t.state,n),action:n}}!function(t){function o(e,o,c,i){var u=t.call(this,i)||this,a=e.pipe(n.observeOn(r.queueScheduler)).pipe(n.withLatestFrom(o)).pipe(n.scan(R,{state:i}));return u.stateSubscription=a.subscribe(function(t){var e=t.action;u.next(t.state),c.next(e)}),u}S(o,t),o.prototype.ngOnDestroy=function(){this.stateSubscription.unsubscribe(),this.complete()},o.INIT=i,o.decorators=[{type:e.Injectable}],o.ctorParameters=function(){return[{type:u},{type:j},{type:w},{type:void 0,decorators:[{type:e.Inject,args:[a]}]}]}}(r.BehaviorSubject);var T,k=(T=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])},function(t,e){function r(){this.constructor=t}T(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),A=function(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,o,c=r.call(t),i=[];try{for(;(void 0===e||e-- >0)&&!(n=c.next()).done;)i.push(n.value)}catch(t){o={error:t}}finally{try{n&&!n.done&&(r=c.return)&&r.call(c)}finally{if(o)throw o.error}}return i},F=function(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(A(arguments[e]));return t},M=function(t){function r(e,r,n){var o=t.call(this)||this;return o.actionsObserver=r,o.reducerManager=n,o.source=e,o}return k(r,t),r.prototype.select=function(t){for(var e=[],r=1;r<arguments.length;r++)e[r-1]=arguments[r];return function o(t){for(var e=[],r=1;r<arguments.length;r++)e[r-1]=arguments[r];return function r(o){var c;if("string"==typeof t)c=o.pipe(n.pluck.apply(void 0,F([t],e)));else{if("function"!=typeof t)throw new TypeError("Unexpected type '"+typeof t+"' in select operator, expected 'string' or 'function'");c=o.pipe(n.map(t))}return c.pipe(n.distinctUntilChanged())}}.apply(void 0,F([t],e))(this)},r.prototype.lift=function(t){var e=new r(this,this.actionsObserver,this.reducerManager);return e.operator=t,e},r.prototype.dispatch=function(t){this.actionsObserver.next(t)},r.prototype.next=function(t){this.actionsObserver.next(t)},r.prototype.error=function(t){this.actionsObserver.error(t)},r.prototype.complete=function(){this.actionsObserver.complete()},r.prototype.addReducer=function(t,e){this.reducerManager.addReducer(t,e)},r.prototype.removeReducer=function(t){this.reducerManager.removeReducer(t)},r.decorators=[{type:e.Injectable}],r.ctorParameters=function(){return[{type:E},{type:u},{type:x}]},r}(r.Observable),N=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var o in e=arguments[r])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},D=function(){function t(t,e,r,n){}return t.decorators=[{type:e.NgModule,args:[{}]}],t.ctorParameters=function(){return[{type:u},{type:j},{type:w},{type:M}]},t}(),q=function(){function t(t,e,r,n){this.features=t,this.featureReducers=e,this.reducerManager=r,t.map(function(t,r){var n=e.shift();return N({},t,{reducers:n[r],initialState:function o(t){return"function"==typeof t?t():t}(t.initialState)})}).forEach(function(t){return r.addFeature(t)})}return t.prototype.ngOnDestroy=function(){var t=this;this.features.forEach(function(e){return t.reducerManager.removeFeature(e)})},t.decorators=[{type:e.NgModule,args:[{}]}],t.ctorParameters=function(){return[{type:Array,decorators:[{type:e.Inject,args:[p]}]},{type:Array,decorators:[{type:e.Inject,args:[y]}]},{type:x},{type:D}]},t}(),B="__@ngrx/effects__";function H(t){return Object.getPrototypeOf(t)}var z=h(function C(t){return t.constructor[B]||[]},H),U="ngrxOnRunEffects",L=function(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,o,c=r.call(t),i=[];try{for(;(void 0===e||e-- >0)&&!(n=c.next()).done;)i.push(n.value)}catch(t){o={error:t}}finally{try{n&&!n.done&&(r=c.return)&&r.call(c)}finally{if(o)throw o.error}}return i},G=function(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(L(arguments[e]));return t};function J(t){var e=H(t).constructor.name,o=z(t).map(function(r){var o=r.propertyName,c=r.dispatch,i="function"==typeof t[o]?t[o]():t[o];return!1===c?i.pipe(n.ignoreElements()):i.pipe(n.materialize()).pipe(n.map(function(r){return{effect:t[o],notification:r,propertyName:o,sourceName:e,sourceInstance:t}}))});return r.merge.apply(void 0,G(o))}function K(t){var e=J(t);return function r(t){var e=H(t);return U in e&&"function"==typeof e[U]}(t)?t.ngrxOnRunEffects(e):e}var Q,V=(Q=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])},function(t,e){function r(){this.constructor=t}Q(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),W=function(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,o,c=r.call(t),i=[];try{for(;(void 0===e||e-- >0)&&!(n=c.next()).done;)i.push(n.value)}catch(t){o={error:t}}finally{try{n&&!n.done&&(r=c.return)&&r.call(c)}finally{if(o)throw o.error}}return i},X=function(t){function n(e){var r=t.call(this)||this;return e&&(r.source=e),r}return V(n,t),n.prototype.lift=function(t){var e=new n;return e.source=this,e.operator=t,e},n.prototype.ofType=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return Y.apply(void 0,function(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(W(arguments[e]));return t}(t))(this)},n.decorators=[{type:e.Injectable}],n.ctorParameters=function(){return[{type:r.Observable,decorators:[{type:e.Inject,args:[w]}]}]},n}(r.Observable);function Y(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return n.filter(function(e){return t.some(function(t){return t===e.type})})}var Z,$=(Z=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])},function(t,e){function r(){this.constructor=t}Z(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),tt=function(t){function r(e){var r=t.call(this)||this;return r.errorHandler=e,r}return $(r,t),r.prototype.addEffects=function(t){this.next(t)},r.prototype.toActions=function(){var t=this;return this.pipe(n.groupBy(H),n.mergeMap(function(e){return e.pipe(n.exhaustMap(K),n.map(function(e){return function r(t,e){!function r(t,e){"E"===t.notification.kind&&e.handleError(t.notification.error)}(t,e),function n(t,e){if("N"===t.notification.kind){var r=t.notification.value;!function n(t){return t&&t.type&&"string"==typeof t.type}(r)&&e.handleError(new Error("Effect "+function o(t){var e=t.propertyName;return'"'+t.sourceName+"."+e+("function"==typeof t.sourceInstance[e]?"()":"")+'"'}(t)+" dispatched an invalid action: "+r))}}(t,e)}(e,t.errorHandler),e.notification}),n.filter(function(t){return"N"===t.kind}),n.dematerialize())}))},r.decorators=[{type:e.Injectable}],r.ctorParameters=function(){return[{type:e.ErrorHandler}]},r}(r.Subject),et=(new e.InjectionToken("ngrx/effects: Immediate Effects"),new e.InjectionToken("ngrx/effects: Root Effects")),rt=new e.InjectionToken("ngrx/effects: Feature Effects"),nt=function(){function t(t,e){this.effectSources=t,this.store=e,this.effectsSubscription=null}return t.prototype.start=function(){this.effectsSubscription||(this.effectsSubscription=this.effectSources.toActions().subscribe(this.store))},t.prototype.ngOnDestroy=function(){this.effectsSubscription&&(this.effectsSubscription.unsubscribe(),this.effectsSubscription=null)},t.decorators=[{type:e.Injectable}],t.ctorParameters=function(){return[{type:tt},{type:M}]},t}(),ot="@ngrx/effects/init",ct=function(){function t(t,e,r,n,o,c){this.sources=t,e.start(),n.forEach(function(e){return t.addEffects(e)}),r.dispatch({type:ot})}return t.prototype.addEffects=function(t){this.sources.addEffects(t)},t.decorators=[{type:e.NgModule,args:[{}]}],t.ctorParameters=function(){return[{type:tt},{type:nt},{type:M},{type:Array,decorators:[{type:e.Inject,args:[et]}]},{type:D,decorators:[{type:e.Optional}]},{type:q,decorators:[{type:e.Optional}]}]},t}(),it=function(){function t(t,e,r,n){this.root=t,e.forEach(function(e){return e.forEach(function(e){return t.addEffects(e)})})}return t.decorators=[{type:e.NgModule,args:[{}]}],t.ctorParameters=function(){return[{type:ct},{type:Array,decorators:[{type:e.Inject,args:[rt]}]},{type:D,decorators:[{type:e.Optional}]},{type:q,decorators:[{type:e.Optional}]}]},t}(),ut=function(){function t(){}return t.forFeature=function(t){return{ngModule:it,providers:[t,{provide:rt,multi:!0,deps:t,useFactory:at}]}},t.forRoot=function(t){return{ngModule:ct,providers:[nt,tt,X,t,{provide:et,deps:t,useFactory:at}]}},t.decorators=[{type:e.NgModule,args:[{}]}],t.ctorParameters=function(){return[]},t}();function at(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return t}t.ɵngrx_modules_effects_effects_c=it,t.ɵngrx_modules_effects_effects_a=at,t.ɵngrx_modules_effects_effects_b=ct,t.ɵngrx_modules_effects_effects_f=nt,t.ɵngrx_modules_effects_effects_e=rt,t.ɵngrx_modules_effects_effects_d=et,t.Effect=function st(t){var e=(void 0===t?{dispatch:!0}:t).dispatch;return function(t,r){!function n(t,e){var r=t.constructor,n=r.hasOwnProperty(B)?r[B]:Object.defineProperty(r,B,{value:[]})[B];Array.prototype.push.apply(n,e)}(t,[{propertyName:r,dispatch:e}])}},t.getEffectsMetadata=function ft(t){var e={};return z(t).forEach(function(t){e[t.propertyName]={dispatch:t.dispatch}}),e},t.mergeEffects=J,t.Actions=X,t.ofType=Y,t.EffectsModule=ut,t.EffectSources=tt,t.ROOT_EFFECTS_INIT=ot,Object.defineProperty(t,"__esModule",{value:!0})}); | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("@ngrx/store"),require("rxjs"),require("rxjs/operators"),require("@angular/core")):"function"==typeof define&&define.amd?define(["exports","@ngrx/store","rxjs","rxjs/operators","@angular/core"],e):e(t.npm_package={},t["@ngrx/store"],t.rxjs,t.rxjs.operators,t.ng.core)}(this,function(t,e,r,n,o){"use strict";var c="__@ngrx/effects__";function f(t){return Object.getPrototypeOf(t)}var i=e.compose(function u(t){return t.constructor[c]||[]},f),a="ngrxOnRunEffects",s=function(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,o,c=r.call(t),f=[];try{for(;(void 0===e||e-- >0)&&!(n=c.next()).done;)f.push(n.value)}catch(t){o={error:t}}finally{try{n&&!n.done&&(r=c.return)&&r.call(c)}finally{if(o)throw o.error}}return f},p=function(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(s(arguments[e]));return t};function y(t){var e=f(t).constructor.name,o=i(t).map(function(r){var o=r.propertyName,c=r.dispatch,f="function"==typeof t[o]?t[o]():t[o];return!1===c?f.pipe(n.ignoreElements()):f.pipe(n.materialize()).pipe(n.map(function(r){return{effect:t[o],notification:r,propertyName:o,sourceName:e,sourceInstance:t}}))});return r.merge.apply(void 0,p(o))}function d(t){var e=y(t);return function r(t){var e=f(t);return a in e&&"function"==typeof e[a]}(t)?t.ngrxOnRunEffects(e):e}var l,h=(l=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])},function(t,e){function r(){this.constructor=t}l(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),_=function(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,o,c=r.call(t),f=[];try{for(;(void 0===e||e-- >0)&&!(n=c.next()).done;)f.push(n.value)}catch(t){o={error:t}}finally{try{n&&!n.done&&(r=c.return)&&r.call(c)}finally{if(o)throw o.error}}return f},g=function(t){function n(e){var r=t.call(this)||this;return e&&(r.source=e),r}return h(n,t),n.prototype.lift=function(t){var e=new n;return e.source=this,e.operator=t,e},n.prototype.ofType=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return v.apply(void 0,function(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(_(arguments[e]));return t}(t))(this)},n.decorators=[{type:o.Injectable}],n.ctorParameters=function(){return[{type:r.Observable,decorators:[{type:o.Inject,args:[e.ScannedActionsSubject]}]}]},n}(r.Observable);function v(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return n.filter(function(e){return t.some(function(t){return t===e.type})})}var m,b=(m=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])},function(t,e){function r(){this.constructor=t}m(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),x=function(t){function e(e){var r=t.call(this)||this;return r.errorHandler=e,r}return b(e,t),e.prototype.addEffects=function(t){this.next(t)},e.prototype.toActions=function(){var t=this;return this.pipe(n.groupBy(f),n.mergeMap(function(e){return e.pipe(n.exhaustMap(d),n.map(function(e){return function r(t,e){!function r(t,e){"E"===t.notification.kind&&e.handleError(t.notification.error)}(t,e),function n(t,e){if("N"===t.notification.kind){var r=t.notification.value;!function n(t){return t&&t.type&&"string"==typeof t.type}(r)&&e.handleError(new Error("Effect "+function o(t){var e=t.propertyName;return'"'+t.sourceName+"."+e+("function"==typeof t.sourceInstance[e]?"()":"")+'"'}(t)+" dispatched an invalid action: "+r))}}(t,e)}(e,t.errorHandler),e.notification}),n.filter(function(t){return"N"===t.kind}),n.dematerialize())}))},e.decorators=[{type:o.Injectable}],e.ctorParameters=function(){return[{type:o.ErrorHandler}]},e}(r.Subject),E=(new o.InjectionToken("ngrx/effects: Immediate Effects"),new o.InjectionToken("ngrx/effects: Root Effects")),j=new o.InjectionToken("ngrx/effects: Feature Effects"),O=function(){function t(t,e){this.effectSources=t,this.store=e,this.effectsSubscription=null}return t.prototype.start=function(){this.effectsSubscription||(this.effectsSubscription=this.effectSources.toActions().subscribe(this.store))},t.prototype.ngOnDestroy=function(){this.effectsSubscription&&(this.effectsSubscription.unsubscribe(),this.effectsSubscription=null)},t.decorators=[{type:o.Injectable}],t.ctorParameters=function(){return[{type:x},{type:e.Store}]},t}(),S="@ngrx/effects/init",I=function(){function t(t,e,r,n,o,c){this.sources=t,e.start(),n.forEach(function(e){return t.addEffects(e)}),r.dispatch({type:S})}return t.prototype.addEffects=function(t){this.sources.addEffects(t)},t.decorators=[{type:o.NgModule,args:[{}]}],t.ctorParameters=function(){return[{type:x},{type:O},{type:e.Store},{type:Array,decorators:[{type:o.Inject,args:[E]}]},{type:e.StoreRootModule,decorators:[{type:o.Optional}]},{type:e.StoreFeatureModule,decorators:[{type:o.Optional}]}]},t}(),M=function(){function t(t,e,r,n){this.root=t,e.forEach(function(e){return e.forEach(function(e){return t.addEffects(e)})})}return t.decorators=[{type:o.NgModule,args:[{}]}],t.ctorParameters=function(){return[{type:I},{type:Array,decorators:[{type:o.Inject,args:[j]}]},{type:e.StoreRootModule,decorators:[{type:o.Optional}]},{type:e.StoreFeatureModule,decorators:[{type:o.Optional}]}]},t}(),P=function(){function t(){}return t.forFeature=function(t){return{ngModule:M,providers:[t,{provide:j,multi:!0,deps:t,useFactory:N}]}},t.forRoot=function(t){return{ngModule:I,providers:[O,x,g,t,{provide:E,deps:t,useFactory:N}]}},t.decorators=[{type:o.NgModule,args:[{}]}],t.ctorParameters=function(){return[]},t}();function N(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return t}t.ɵngrx_modules_effects_effects_c=M,t.ɵngrx_modules_effects_effects_a=N,t.ɵngrx_modules_effects_effects_b=I,t.ɵngrx_modules_effects_effects_f=O,t.ɵngrx_modules_effects_effects_e=j,t.ɵngrx_modules_effects_effects_d=E,t.Effect=function w(t){var e=(void 0===t?{dispatch:!0}:t).dispatch;return function(t,r){!function n(t,e){var r=t.constructor,n=r.hasOwnProperty(c)?r[c]:Object.defineProperty(r,c,{value:[]})[c];Array.prototype.push.apply(n,e)}(t,[{propertyName:r,dispatch:e}])}},t.getEffectsMetadata=function A(t){var e={};return i(t).forEach(function(t){e[t.propertyName]={dispatch:t.dispatch}}),e},t.mergeEffects=y,t.Actions=g,t.ofType=v,t.EffectsModule=P,t.EffectSources=x,t.ROOT_EFFECTS_INIT=S,Object.defineProperty(t,"__esModule",{value:!0})}); |
/** | ||
* @license NgRx v6.0.0-beta.0 | ||
* @license NgRx v6.0.0-beta.1 | ||
* (c) 2015-2018 Brandon Roberts, Mike Ryan, Rob Wormald, Victor Savkin | ||
@@ -4,0 +4,0 @@ * License: MIT |
/** | ||
* @license NgRx v6.0.0-beta.0 | ||
* @license NgRx v6.0.0-beta.1 | ||
* (c) 2015-2018 Brandon Roberts, Mike Ryan, Rob Wormald, Victor Savkin | ||
@@ -4,0 +4,0 @@ * License: MIT |
/** | ||
* @license NgRx v6.0.0-beta.0 | ||
* @license NgRx v6.0.0-beta.1 | ||
* (c) 2015-2018 Brandon Roberts, Mike Ryan, Rob Wormald, Victor Savkin | ||
* License: MIT | ||
*/ | ||
import { ScannedActionsSubject, Store, StoreFeatureModule, StoreRootModule, compose } from '@ngrx/store'; | ||
import { Observable, Subject, merge } from 'rxjs'; | ||
import { dematerialize, exhaustMap, filter, groupBy, ignoreElements, map, materialize, mergeMap } from 'rxjs/operators'; | ||
import { ErrorHandler, Inject, Injectable, InjectionToken, NgModule, Optional } from '@angular/core'; | ||
import { BehaviorSubject, Observable, Subject, merge, queueScheduler } from 'rxjs'; | ||
import { dematerialize, distinctUntilChanged, exhaustMap, filter, groupBy, ignoreElements, map, materialize, mergeMap, observeOn, pluck, scan, withLatestFrom } from 'rxjs/operators'; | ||
var __extends$1 = (undefined && undefined.__extends) || (function () { | ||
var extendStatics = Object.setPrototypeOf || | ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || | ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; | ||
return function (d, b) { | ||
extendStatics(d, b); | ||
function __() { this.constructor = d; } | ||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); | ||
}; | ||
})(); | ||
var INIT = '@ngrx/store/init'; | ||
var ActionsSubject = /** @class */ (function (_super) { | ||
__extends$1(ActionsSubject, _super); | ||
function ActionsSubject() { | ||
return _super.call(this, { type: INIT }) || this; | ||
} | ||
ActionsSubject.prototype.next = function (action) { | ||
if (typeof action === 'undefined') { | ||
throw new TypeError("Actions must be objects"); | ||
} | ||
else if (typeof action.type === 'undefined') { | ||
throw new TypeError("Actions must have a type property"); | ||
} | ||
_super.prototype.next.call(this, action); | ||
}; | ||
ActionsSubject.prototype.complete = function () { | ||
/* noop */ | ||
}; | ||
ActionsSubject.prototype.ngOnDestroy = function () { | ||
_super.prototype.complete.call(this); | ||
}; | ||
ActionsSubject.decorators = [ | ||
{ type: Injectable } | ||
]; | ||
/** @nocollapse */ | ||
ActionsSubject.ctorParameters = function () { return []; }; | ||
return ActionsSubject; | ||
}(BehaviorSubject)); | ||
var _INITIAL_STATE = new InjectionToken('@ngrx/store Internal Initial State'); | ||
var INITIAL_STATE = new InjectionToken('@ngrx/store Initial State'); | ||
var REDUCER_FACTORY = new InjectionToken('@ngrx/store Reducer Factory'); | ||
var _REDUCER_FACTORY = new InjectionToken('@ngrx/store Reducer Factory Provider'); | ||
var INITIAL_REDUCERS = new InjectionToken('@ngrx/store Initial Reducers'); | ||
var _INITIAL_REDUCERS = new InjectionToken('@ngrx/store Internal Initial Reducers'); | ||
var META_REDUCERS = new InjectionToken('@ngrx/store Meta Reducers'); | ||
var STORE_FEATURES = new InjectionToken('@ngrx/store Store Features'); | ||
var _STORE_REDUCERS = new InjectionToken('@ngrx/store Internal Store Reducers'); | ||
var _FEATURE_REDUCERS = new InjectionToken('@ngrx/store Internal Feature Reducers'); | ||
var _FEATURE_REDUCERS_TOKEN = new InjectionToken('@ngrx/store Internal Feature Reducers Token'); | ||
var FEATURE_REDUCERS = new InjectionToken('@ngrx/store Feature Reducers'); | ||
var __read$1 = (undefined && undefined.__read) || function (o, n) { | ||
var m = typeof Symbol === "function" && o[Symbol.iterator]; | ||
if (!m) return o; | ||
var i = m.call(o), r, ar = [], e; | ||
try { | ||
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); | ||
} | ||
catch (error) { e = { error: error }; } | ||
finally { | ||
try { | ||
if (r && !r.done && (m = i["return"])) m.call(i); | ||
} | ||
finally { if (e) throw e.error; } | ||
} | ||
return ar; | ||
}; | ||
var __spread$1 = (undefined && undefined.__spread) || function () { | ||
for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read$1(arguments[i])); | ||
return ar; | ||
}; | ||
function omit(object, keyToRemove) { | ||
return Object.keys(object) | ||
.filter(function (key) { return key !== keyToRemove; }) | ||
.reduce(function (result, key) { | ||
return Object.assign(result, (_a = {}, _a[key] = object[key], _a)); | ||
var _a; | ||
}, {}); | ||
} | ||
function compose() { | ||
var functions = []; | ||
for (var _i = 0; _i < arguments.length; _i++) { | ||
functions[_i] = arguments[_i]; | ||
} | ||
return function (arg) { | ||
if (functions.length === 0) { | ||
return arg; | ||
} | ||
var last = functions[functions.length - 1]; | ||
var rest = functions.slice(0, -1); | ||
return rest.reduceRight(function (composed, fn) { return fn(composed); }, last(arg)); | ||
}; | ||
} | ||
function createReducerFactory(reducerFactory, metaReducers) { | ||
if (Array.isArray(metaReducers) && metaReducers.length > 0) { | ||
return compose.apply(null, __spread$1(metaReducers, [reducerFactory])); | ||
} | ||
return reducerFactory; | ||
} | ||
function createFeatureReducerFactory(metaReducers) { | ||
var reducerFactory = Array.isArray(metaReducers) && metaReducers.length > 0 | ||
? compose.apply(void 0, __spread$1(metaReducers)) : function (r) { return r; }; | ||
return function (reducer, initialState) { | ||
reducer = reducerFactory(reducer); | ||
return function (state, action) { | ||
state = state === undefined ? initialState : state; | ||
return reducer(state, action); | ||
}; | ||
}; | ||
} | ||
var __extends$2 = (undefined && undefined.__extends) || (function () { | ||
var extendStatics = Object.setPrototypeOf || | ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || | ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; | ||
return function (d, b) { | ||
extendStatics(d, b); | ||
function __() { this.constructor = d; } | ||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); | ||
}; | ||
})(); | ||
var __assign = (undefined && undefined.__assign) || Object.assign || function(t) { | ||
for (var s, i = 1, n = arguments.length; i < n; i++) { | ||
s = arguments[i]; | ||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) | ||
t[p] = s[p]; | ||
} | ||
return t; | ||
}; | ||
var ReducerObservable = /** @class */ (function (_super) { | ||
__extends$2(ReducerObservable, _super); | ||
function ReducerObservable() { | ||
return _super !== null && _super.apply(this, arguments) || this; | ||
} | ||
return ReducerObservable; | ||
}(Observable)); | ||
var ReducerManagerDispatcher = /** @class */ (function (_super) { | ||
__extends$2(ReducerManagerDispatcher, _super); | ||
function ReducerManagerDispatcher() { | ||
return _super !== null && _super.apply(this, arguments) || this; | ||
} | ||
return ReducerManagerDispatcher; | ||
}(ActionsSubject)); | ||
var UPDATE = '@ngrx/store/update-reducers'; | ||
var ReducerManager = /** @class */ (function (_super) { | ||
__extends$2(ReducerManager, _super); | ||
function ReducerManager(dispatcher, initialState, reducers, reducerFactory) { | ||
var _this = _super.call(this, reducerFactory(reducers, initialState)) || this; | ||
_this.dispatcher = dispatcher; | ||
_this.initialState = initialState; | ||
_this.reducers = reducers; | ||
_this.reducerFactory = reducerFactory; | ||
return _this; | ||
} | ||
ReducerManager.prototype.addFeature = function (_a) { | ||
var reducers = _a.reducers, reducerFactory = _a.reducerFactory, metaReducers = _a.metaReducers, initialState = _a.initialState, key = _a.key; | ||
var reducer = typeof reducers === 'function' | ||
? createFeatureReducerFactory(metaReducers)(reducers, initialState) | ||
: createReducerFactory(reducerFactory, metaReducers)(reducers, initialState); | ||
this.addReducer(key, reducer); | ||
}; | ||
ReducerManager.prototype.removeFeature = function (_a) { | ||
var key = _a.key; | ||
this.removeReducer(key); | ||
}; | ||
ReducerManager.prototype.addReducer = function (key, reducer) { | ||
this.reducers = __assign({}, this.reducers, (_a = {}, _a[key] = reducer, _a)); | ||
this.updateReducers(key); | ||
var _a; | ||
}; | ||
ReducerManager.prototype.removeReducer = function (key) { | ||
this.reducers = omit(this.reducers, key) /*TODO(#823)*/; | ||
this.updateReducers(key); | ||
}; | ||
ReducerManager.prototype.updateReducers = function (key) { | ||
this.next(this.reducerFactory(this.reducers, this.initialState)); | ||
this.dispatcher.next({ | ||
type: UPDATE, | ||
feature: key, | ||
}); | ||
}; | ||
ReducerManager.prototype.ngOnDestroy = function () { | ||
this.complete(); | ||
}; | ||
ReducerManager.decorators = [ | ||
{ type: Injectable } | ||
]; | ||
/** @nocollapse */ | ||
ReducerManager.ctorParameters = function () { return [ | ||
{ type: ReducerManagerDispatcher, }, | ||
{ type: undefined, decorators: [{ type: Inject, args: [INITIAL_STATE,] },] }, | ||
{ type: undefined, decorators: [{ type: Inject, args: [INITIAL_REDUCERS,] },] }, | ||
{ type: undefined, decorators: [{ type: Inject, args: [REDUCER_FACTORY,] },] }, | ||
]; }; | ||
return ReducerManager; | ||
}(BehaviorSubject)); | ||
var __extends$4 = (undefined && undefined.__extends) || (function () { | ||
var extendStatics = Object.setPrototypeOf || | ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || | ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; | ||
return function (d, b) { | ||
extendStatics(d, b); | ||
function __() { this.constructor = d; } | ||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); | ||
}; | ||
})(); | ||
var ScannedActionsSubject = /** @class */ (function (_super) { | ||
__extends$4(ScannedActionsSubject, _super); | ||
function ScannedActionsSubject() { | ||
return _super !== null && _super.apply(this, arguments) || this; | ||
} | ||
ScannedActionsSubject.prototype.ngOnDestroy = function () { | ||
this.complete(); | ||
}; | ||
ScannedActionsSubject.decorators = [ | ||
{ type: Injectable } | ||
]; | ||
/** @nocollapse */ | ||
ScannedActionsSubject.ctorParameters = function () { return []; }; | ||
return ScannedActionsSubject; | ||
}(Subject)); | ||
var __extends$3 = (undefined && undefined.__extends) || (function () { | ||
var extendStatics = Object.setPrototypeOf || | ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || | ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; | ||
return function (d, b) { | ||
extendStatics(d, b); | ||
function __() { this.constructor = d; } | ||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); | ||
}; | ||
})(); | ||
var __read$2 = (undefined && undefined.__read) || function (o, n) { | ||
var m = typeof Symbol === "function" && o[Symbol.iterator]; | ||
if (!m) return o; | ||
var i = m.call(o), r, ar = [], e; | ||
try { | ||
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); | ||
} | ||
catch (error) { e = { error: error }; } | ||
finally { | ||
try { | ||
if (r && !r.done && (m = i["return"])) m.call(i); | ||
} | ||
finally { if (e) throw e.error; } | ||
} | ||
return ar; | ||
}; | ||
var StateObservable = /** @class */ (function (_super) { | ||
__extends$3(StateObservable, _super); | ||
function StateObservable() { | ||
return _super !== null && _super.apply(this, arguments) || this; | ||
} | ||
return StateObservable; | ||
}(Observable)); | ||
var State = /** @class */ (function (_super) { | ||
__extends$3(State, _super); | ||
function State(actions$, reducer$, scannedActions, initialState) { | ||
var _this = _super.call(this, initialState) || this; | ||
var actionsOnQueue$ = actions$.pipe(observeOn(queueScheduler)); | ||
var withLatestReducer$ = actionsOnQueue$.pipe(withLatestFrom(reducer$)); | ||
var seed = { state: initialState }; | ||
var stateAndAction$ = withLatestReducer$.pipe(scan(reduceState, seed)); | ||
_this.stateSubscription = stateAndAction$.subscribe(function (_a) { | ||
var state = _a.state, action = _a.action; | ||
_this.next(state); | ||
scannedActions.next(action); | ||
}); | ||
return _this; | ||
} | ||
State.prototype.ngOnDestroy = function () { | ||
this.stateSubscription.unsubscribe(); | ||
this.complete(); | ||
}; | ||
State.INIT = INIT; | ||
State.decorators = [ | ||
{ type: Injectable } | ||
]; | ||
/** @nocollapse */ | ||
State.ctorParameters = function () { return [ | ||
{ type: ActionsSubject, }, | ||
{ type: ReducerObservable, }, | ||
{ type: ScannedActionsSubject, }, | ||
{ type: undefined, decorators: [{ type: Inject, args: [INITIAL_STATE,] },] }, | ||
]; }; | ||
return State; | ||
}(BehaviorSubject)); | ||
function reduceState(stateActionPair, _a) { | ||
if (stateActionPair === void 0) { stateActionPair = { state: undefined }; } | ||
var _b = __read$2(_a, 2), action = _b[0], reducer = _b[1]; | ||
var state = stateActionPair.state; | ||
return { state: reducer(state, action), action: action }; | ||
} | ||
var __extends = (undefined && undefined.__extends) || (function () { | ||
var extendStatics = Object.setPrototypeOf || | ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || | ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; | ||
return function (d, b) { | ||
extendStatics(d, b); | ||
function __() { this.constructor = d; } | ||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); | ||
}; | ||
})(); | ||
var __read = (undefined && undefined.__read) || function (o, n) { | ||
var m = typeof Symbol === "function" && o[Symbol.iterator]; | ||
if (!m) return o; | ||
var i = m.call(o), r, ar = [], e; | ||
try { | ||
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); | ||
} | ||
catch (error) { e = { error: error }; } | ||
finally { | ||
try { | ||
if (r && !r.done && (m = i["return"])) m.call(i); | ||
} | ||
finally { if (e) throw e.error; } | ||
} | ||
return ar; | ||
}; | ||
var __spread = (undefined && undefined.__spread) || function () { | ||
for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read(arguments[i])); | ||
return ar; | ||
}; | ||
var Store = /** @class */ (function (_super) { | ||
__extends(Store, _super); | ||
function Store(state$, actionsObserver, reducerManager) { | ||
var _this = _super.call(this) || this; | ||
_this.actionsObserver = actionsObserver; | ||
_this.reducerManager = reducerManager; | ||
_this.source = state$; | ||
return _this; | ||
} | ||
Store.prototype.select = function (pathOrMapFn) { | ||
var paths = []; | ||
for (var _i = 1; _i < arguments.length; _i++) { | ||
paths[_i - 1] = arguments[_i]; | ||
} | ||
return select.apply(void 0, __spread([pathOrMapFn], paths))(this); | ||
}; | ||
Store.prototype.lift = function (operator) { | ||
var store = new Store(this, this.actionsObserver, this.reducerManager); | ||
store.operator = operator; | ||
return store; | ||
}; | ||
Store.prototype.dispatch = function (action) { | ||
this.actionsObserver.next(action); | ||
}; | ||
Store.prototype.next = function (action) { | ||
this.actionsObserver.next(action); | ||
}; | ||
Store.prototype.error = function (err) { | ||
this.actionsObserver.error(err); | ||
}; | ||
Store.prototype.complete = function () { | ||
this.actionsObserver.complete(); | ||
}; | ||
Store.prototype.addReducer = function (key, reducer) { | ||
this.reducerManager.addReducer(key, reducer); | ||
}; | ||
Store.prototype.removeReducer = function (key) { | ||
this.reducerManager.removeReducer(key); | ||
}; | ||
Store.decorators = [ | ||
{ type: Injectable } | ||
]; | ||
/** @nocollapse */ | ||
Store.ctorParameters = function () { return [ | ||
{ type: StateObservable, }, | ||
{ type: ActionsSubject, }, | ||
{ type: ReducerManager, }, | ||
]; }; | ||
return Store; | ||
}(Observable)); | ||
function select(pathOrMapFn) { | ||
var paths = []; | ||
for (var _i = 1; _i < arguments.length; _i++) { | ||
paths[_i - 1] = arguments[_i]; | ||
} | ||
return function selectOperator(source$) { | ||
var mapped$; | ||
if (typeof pathOrMapFn === 'string') { | ||
mapped$ = source$.pipe(pluck.apply(void 0, __spread([pathOrMapFn], paths))); | ||
} | ||
else if (typeof pathOrMapFn === 'function') { | ||
mapped$ = source$.pipe(map(pathOrMapFn)); | ||
} | ||
else { | ||
throw new TypeError("Unexpected type '" + typeof pathOrMapFn + "' in select operator," + | ||
" expected 'string' or 'function'"); | ||
} | ||
return mapped$.pipe(distinctUntilChanged()); | ||
}; | ||
} | ||
var __read$3 = (undefined && undefined.__read) || function (o, n) { | ||
var m = typeof Symbol === "function" && o[Symbol.iterator]; | ||
if (!m) return o; | ||
var i = m.call(o), r, ar = [], e; | ||
try { | ||
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); | ||
} | ||
catch (error) { e = { error: error }; } | ||
finally { | ||
try { | ||
if (r && !r.done && (m = i["return"])) m.call(i); | ||
} | ||
finally { if (e) throw e.error; } | ||
} | ||
return ar; | ||
}; | ||
var __spread$2 = (undefined && undefined.__spread) || function () { | ||
for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read$3(arguments[i])); | ||
return ar; | ||
}; | ||
var __assign$1 = (undefined && undefined.__assign) || Object.assign || function(t) { | ||
for (var s, i = 1, n = arguments.length; i < n; i++) { | ||
s = arguments[i]; | ||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) | ||
t[p] = s[p]; | ||
} | ||
return t; | ||
}; | ||
var StoreRootModule = /** @class */ (function () { | ||
function StoreRootModule(actions$, reducer$, scannedActions$, store) { | ||
} | ||
StoreRootModule.decorators = [ | ||
{ type: NgModule, args: [{},] } | ||
]; | ||
/** @nocollapse */ | ||
StoreRootModule.ctorParameters = function () { return [ | ||
{ type: ActionsSubject, }, | ||
{ type: ReducerObservable, }, | ||
{ type: ScannedActionsSubject, }, | ||
{ type: Store, }, | ||
]; }; | ||
return StoreRootModule; | ||
}()); | ||
var StoreFeatureModule = /** @class */ (function () { | ||
function StoreFeatureModule(features, featureReducers, reducerManager, root) { | ||
this.features = features; | ||
this.featureReducers = featureReducers; | ||
this.reducerManager = reducerManager; | ||
features | ||
.map(function (feature, index) { | ||
var featureReducerCollection = featureReducers.shift(); | ||
var reducers = featureReducerCollection[index]; | ||
return __assign$1({}, feature, { reducers: reducers, initialState: _initialStateFactory(feature.initialState) }); | ||
}) | ||
.forEach(function (feature) { return reducerManager.addFeature(feature); }); | ||
} | ||
StoreFeatureModule.prototype.ngOnDestroy = function () { | ||
var _this = this; | ||
this.features.forEach(function (feature) { | ||
return _this.reducerManager.removeFeature(feature); | ||
}); | ||
}; | ||
StoreFeatureModule.decorators = [ | ||
{ type: NgModule, args: [{},] } | ||
]; | ||
/** @nocollapse */ | ||
StoreFeatureModule.ctorParameters = function () { return [ | ||
{ type: Array, decorators: [{ type: Inject, args: [STORE_FEATURES,] },] }, | ||
{ type: Array, decorators: [{ type: Inject, args: [FEATURE_REDUCERS,] },] }, | ||
{ type: ReducerManager, }, | ||
{ type: StoreRootModule, }, | ||
]; }; | ||
return StoreFeatureModule; | ||
}()); | ||
function _initialStateFactory(initialState) { | ||
if (typeof initialState === 'function') { | ||
return initialState(); | ||
} | ||
return initialState; | ||
} | ||
/** | ||
* DO NOT EDIT | ||
* | ||
* This file is automatically generated at build | ||
*/ | ||
var METADATA_KEY = '__@ngrx/effects__'; | ||
@@ -536,3 +48,3 @@ function getEffectMetadataEntries(sourceProto) { | ||
var __read$4 = (undefined && undefined.__read) || function (o, n) { | ||
var __read = (undefined && undefined.__read) || function (o, n) { | ||
var m = typeof Symbol === "function" && o[Symbol.iterator]; | ||
@@ -553,4 +65,4 @@ if (!m) return o; | ||
}; | ||
var __spread$3 = (undefined && undefined.__spread) || function () { | ||
for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read$4(arguments[i])); | ||
var __spread = (undefined && undefined.__spread) || function () { | ||
for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read(arguments[i])); | ||
return ar; | ||
@@ -579,3 +91,3 @@ }; | ||
}); | ||
return merge.apply(void 0, __spread$3(observables)); | ||
return merge.apply(void 0, __spread(observables)); | ||
} | ||
@@ -590,3 +102,3 @@ function resolveEffectSource(sourceInstance) { | ||
var __extends$5 = (undefined && undefined.__extends) || (function () { | ||
var __extends = (undefined && undefined.__extends) || (function () { | ||
var extendStatics = Object.setPrototypeOf || | ||
@@ -601,3 +113,3 @@ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || | ||
})(); | ||
var __read$5 = (undefined && undefined.__read) || function (o, n) { | ||
var __read$1 = (undefined && undefined.__read) || function (o, n) { | ||
var m = typeof Symbol === "function" && o[Symbol.iterator]; | ||
@@ -618,8 +130,8 @@ if (!m) return o; | ||
}; | ||
var __spread$4 = (undefined && undefined.__spread) || function () { | ||
for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read$5(arguments[i])); | ||
var __spread$1 = (undefined && undefined.__spread) || function () { | ||
for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read$1(arguments[i])); | ||
return ar; | ||
}; | ||
var Actions = /** @class */ (function (_super) { | ||
__extends$5(Actions, _super); | ||
__extends(Actions, _super); | ||
function Actions(source) { | ||
@@ -643,3 +155,3 @@ var _this = _super.call(this) || this; | ||
} | ||
return ofType.apply(void 0, __spread$4(allowedTypes))(this); | ||
return ofType.apply(void 0, __spread$1(allowedTypes))(this); | ||
}; | ||
@@ -692,3 +204,3 @@ Actions.decorators = [ | ||
var __extends$6 = (undefined && undefined.__extends) || (function () { | ||
var __extends$1 = (undefined && undefined.__extends) || (function () { | ||
var extendStatics = Object.setPrototypeOf || | ||
@@ -704,3 +216,3 @@ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || | ||
var EffectSources = /** @class */ (function (_super) { | ||
__extends$6(EffectSources, _super); | ||
__extends$1(EffectSources, _super); | ||
function EffectSources(errorHandler) { | ||
@@ -749,5 +261,5 @@ var _this = _super.call(this) || this; | ||
var EffectsRunner = /** @class */ (function () { | ||
function EffectsRunner(effectSources, store) { | ||
function EffectsRunner(effectSources, store$$1) { | ||
this.effectSources = effectSources; | ||
this.store = store; | ||
this.store = store$$1; | ||
this.effectsSubscription = null; | ||
@@ -781,3 +293,3 @@ } | ||
var EffectsRootModule = /** @class */ (function () { | ||
function EffectsRootModule(sources, runner, store, rootEffects, storeRootModule, storeFeatureModule) { | ||
function EffectsRootModule(sources, runner, store$$1, rootEffects, storeRootModule, storeFeatureModule) { | ||
this.sources = sources; | ||
@@ -788,3 +300,3 @@ runner.start(); | ||
}); | ||
store.dispatch({ type: ROOT_EFFECTS_INIT }); | ||
store$$1.dispatch({ type: ROOT_EFFECTS_INIT }); | ||
} | ||
@@ -791,0 +303,0 @@ EffectsRootModule.prototype.addEffects = function (effectSourceInstance) { |
/** | ||
* @license NgRx v6.0.0-beta.0 | ||
* @license NgRx v6.0.0-beta.1 | ||
* (c) 2015-2018 Brandon Roberts, Mike Ryan, Rob Wormald, Victor Savkin | ||
* License: MIT | ||
*/ | ||
import { ErrorHandler, Inject, Injectable, InjectionToken } from '@angular/core'; | ||
import { BehaviorSubject, Observable, Subject, defer, merge, queueScheduler } from 'rxjs'; | ||
import { dematerialize, distinctUntilChanged, exhaustMap, filter, groupBy, ignoreElements, map, materialize, mergeMap, observeOn, pluck, scan, withLatestFrom } from 'rxjs/operators'; | ||
import { Actions } from '@ngrx/effects'; | ||
import { defer } from 'rxjs'; | ||
var __extends$1 = (undefined && undefined.__extends) || (function () { | ||
var extendStatics = Object.setPrototypeOf || | ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || | ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; | ||
return function (d, b) { | ||
extendStatics(d, b); | ||
function __() { this.constructor = d; } | ||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); | ||
}; | ||
})(); | ||
var INIT = '@ngrx/store/init'; | ||
var ActionsSubject = /** @class */ (function (_super) { | ||
__extends$1(ActionsSubject, _super); | ||
function ActionsSubject() { | ||
return _super.call(this, { type: INIT }) || this; | ||
} | ||
ActionsSubject.prototype.next = function (action) { | ||
if (typeof action === 'undefined') { | ||
throw new TypeError("Actions must be objects"); | ||
} | ||
else if (typeof action.type === 'undefined') { | ||
throw new TypeError("Actions must have a type property"); | ||
} | ||
_super.prototype.next.call(this, action); | ||
}; | ||
ActionsSubject.prototype.complete = function () { | ||
/* noop */ | ||
}; | ||
ActionsSubject.prototype.ngOnDestroy = function () { | ||
_super.prototype.complete.call(this); | ||
}; | ||
ActionsSubject.decorators = [ | ||
{ type: Injectable } | ||
]; | ||
/** @nocollapse */ | ||
ActionsSubject.ctorParameters = function () { return []; }; | ||
return ActionsSubject; | ||
}(BehaviorSubject)); | ||
var _INITIAL_STATE = new InjectionToken('@ngrx/store Internal Initial State'); | ||
var INITIAL_STATE = new InjectionToken('@ngrx/store Initial State'); | ||
var REDUCER_FACTORY = new InjectionToken('@ngrx/store Reducer Factory'); | ||
var _REDUCER_FACTORY = new InjectionToken('@ngrx/store Reducer Factory Provider'); | ||
var INITIAL_REDUCERS = new InjectionToken('@ngrx/store Initial Reducers'); | ||
var _INITIAL_REDUCERS = new InjectionToken('@ngrx/store Internal Initial Reducers'); | ||
var META_REDUCERS = new InjectionToken('@ngrx/store Meta Reducers'); | ||
var STORE_FEATURES = new InjectionToken('@ngrx/store Store Features'); | ||
var _STORE_REDUCERS = new InjectionToken('@ngrx/store Internal Store Reducers'); | ||
var _FEATURE_REDUCERS = new InjectionToken('@ngrx/store Internal Feature Reducers'); | ||
var _FEATURE_REDUCERS_TOKEN = new InjectionToken('@ngrx/store Internal Feature Reducers Token'); | ||
var FEATURE_REDUCERS = new InjectionToken('@ngrx/store Feature Reducers'); | ||
var __read$1 = (undefined && undefined.__read) || function (o, n) { | ||
var m = typeof Symbol === "function" && o[Symbol.iterator]; | ||
if (!m) return o; | ||
var i = m.call(o), r, ar = [], e; | ||
try { | ||
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); | ||
} | ||
catch (error) { e = { error: error }; } | ||
finally { | ||
try { | ||
if (r && !r.done && (m = i["return"])) m.call(i); | ||
} | ||
finally { if (e) throw e.error; } | ||
} | ||
return ar; | ||
}; | ||
var __spread$1 = (undefined && undefined.__spread) || function () { | ||
for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read$1(arguments[i])); | ||
return ar; | ||
}; | ||
function omit(object, keyToRemove) { | ||
return Object.keys(object) | ||
.filter(function (key) { return key !== keyToRemove; }) | ||
.reduce(function (result, key) { | ||
return Object.assign(result, (_a = {}, _a[key] = object[key], _a)); | ||
var _a; | ||
}, {}); | ||
} | ||
function compose() { | ||
var functions = []; | ||
for (var _i = 0; _i < arguments.length; _i++) { | ||
functions[_i] = arguments[_i]; | ||
} | ||
return function (arg) { | ||
if (functions.length === 0) { | ||
return arg; | ||
} | ||
var last = functions[functions.length - 1]; | ||
var rest = functions.slice(0, -1); | ||
return rest.reduceRight(function (composed, fn) { return fn(composed); }, last(arg)); | ||
}; | ||
} | ||
function createReducerFactory(reducerFactory, metaReducers) { | ||
if (Array.isArray(metaReducers) && metaReducers.length > 0) { | ||
return compose.apply(null, __spread$1(metaReducers, [reducerFactory])); | ||
} | ||
return reducerFactory; | ||
} | ||
function createFeatureReducerFactory(metaReducers) { | ||
var reducerFactory = Array.isArray(metaReducers) && metaReducers.length > 0 | ||
? compose.apply(void 0, __spread$1(metaReducers)) : function (r) { return r; }; | ||
return function (reducer, initialState) { | ||
reducer = reducerFactory(reducer); | ||
return function (state, action) { | ||
state = state === undefined ? initialState : state; | ||
return reducer(state, action); | ||
}; | ||
}; | ||
} | ||
var __extends$2 = (undefined && undefined.__extends) || (function () { | ||
var extendStatics = Object.setPrototypeOf || | ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || | ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; | ||
return function (d, b) { | ||
extendStatics(d, b); | ||
function __() { this.constructor = d; } | ||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); | ||
}; | ||
})(); | ||
var __assign = (undefined && undefined.__assign) || Object.assign || function(t) { | ||
for (var s, i = 1, n = arguments.length; i < n; i++) { | ||
s = arguments[i]; | ||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) | ||
t[p] = s[p]; | ||
} | ||
return t; | ||
}; | ||
var ReducerObservable = /** @class */ (function (_super) { | ||
__extends$2(ReducerObservable, _super); | ||
function ReducerObservable() { | ||
return _super !== null && _super.apply(this, arguments) || this; | ||
} | ||
return ReducerObservable; | ||
}(Observable)); | ||
var ReducerManagerDispatcher = /** @class */ (function (_super) { | ||
__extends$2(ReducerManagerDispatcher, _super); | ||
function ReducerManagerDispatcher() { | ||
return _super !== null && _super.apply(this, arguments) || this; | ||
} | ||
return ReducerManagerDispatcher; | ||
}(ActionsSubject)); | ||
var UPDATE = '@ngrx/store/update-reducers'; | ||
var ReducerManager = /** @class */ (function (_super) { | ||
__extends$2(ReducerManager, _super); | ||
function ReducerManager(dispatcher, initialState, reducers, reducerFactory) { | ||
var _this = _super.call(this, reducerFactory(reducers, initialState)) || this; | ||
_this.dispatcher = dispatcher; | ||
_this.initialState = initialState; | ||
_this.reducers = reducers; | ||
_this.reducerFactory = reducerFactory; | ||
return _this; | ||
} | ||
ReducerManager.prototype.addFeature = function (_a) { | ||
var reducers = _a.reducers, reducerFactory = _a.reducerFactory, metaReducers = _a.metaReducers, initialState = _a.initialState, key = _a.key; | ||
var reducer = typeof reducers === 'function' | ||
? createFeatureReducerFactory(metaReducers)(reducers, initialState) | ||
: createReducerFactory(reducerFactory, metaReducers)(reducers, initialState); | ||
this.addReducer(key, reducer); | ||
}; | ||
ReducerManager.prototype.removeFeature = function (_a) { | ||
var key = _a.key; | ||
this.removeReducer(key); | ||
}; | ||
ReducerManager.prototype.addReducer = function (key, reducer) { | ||
this.reducers = __assign({}, this.reducers, (_a = {}, _a[key] = reducer, _a)); | ||
this.updateReducers(key); | ||
var _a; | ||
}; | ||
ReducerManager.prototype.removeReducer = function (key) { | ||
this.reducers = omit(this.reducers, key) /*TODO(#823)*/; | ||
this.updateReducers(key); | ||
}; | ||
ReducerManager.prototype.updateReducers = function (key) { | ||
this.next(this.reducerFactory(this.reducers, this.initialState)); | ||
this.dispatcher.next({ | ||
type: UPDATE, | ||
feature: key, | ||
}); | ||
}; | ||
ReducerManager.prototype.ngOnDestroy = function () { | ||
this.complete(); | ||
}; | ||
ReducerManager.decorators = [ | ||
{ type: Injectable } | ||
]; | ||
/** @nocollapse */ | ||
ReducerManager.ctorParameters = function () { return [ | ||
{ type: ReducerManagerDispatcher, }, | ||
{ type: undefined, decorators: [{ type: Inject, args: [INITIAL_STATE,] },] }, | ||
{ type: undefined, decorators: [{ type: Inject, args: [INITIAL_REDUCERS,] },] }, | ||
{ type: undefined, decorators: [{ type: Inject, args: [REDUCER_FACTORY,] },] }, | ||
]; }; | ||
return ReducerManager; | ||
}(BehaviorSubject)); | ||
var __extends$4 = (undefined && undefined.__extends) || (function () { | ||
var extendStatics = Object.setPrototypeOf || | ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || | ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; | ||
return function (d, b) { | ||
extendStatics(d, b); | ||
function __() { this.constructor = d; } | ||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); | ||
}; | ||
})(); | ||
var ScannedActionsSubject = /** @class */ (function (_super) { | ||
__extends$4(ScannedActionsSubject, _super); | ||
function ScannedActionsSubject() { | ||
return _super !== null && _super.apply(this, arguments) || this; | ||
} | ||
ScannedActionsSubject.prototype.ngOnDestroy = function () { | ||
this.complete(); | ||
}; | ||
ScannedActionsSubject.decorators = [ | ||
{ type: Injectable } | ||
]; | ||
/** @nocollapse */ | ||
ScannedActionsSubject.ctorParameters = function () { return []; }; | ||
return ScannedActionsSubject; | ||
}(Subject)); | ||
var __extends$3 = (undefined && undefined.__extends) || (function () { | ||
var extendStatics = Object.setPrototypeOf || | ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || | ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; | ||
return function (d, b) { | ||
extendStatics(d, b); | ||
function __() { this.constructor = d; } | ||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); | ||
}; | ||
})(); | ||
var __read$2 = (undefined && undefined.__read) || function (o, n) { | ||
var m = typeof Symbol === "function" && o[Symbol.iterator]; | ||
if (!m) return o; | ||
var i = m.call(o), r, ar = [], e; | ||
try { | ||
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); | ||
} | ||
catch (error) { e = { error: error }; } | ||
finally { | ||
try { | ||
if (r && !r.done && (m = i["return"])) m.call(i); | ||
} | ||
finally { if (e) throw e.error; } | ||
} | ||
return ar; | ||
}; | ||
var StateObservable = /** @class */ (function (_super) { | ||
__extends$3(StateObservable, _super); | ||
function StateObservable() { | ||
return _super !== null && _super.apply(this, arguments) || this; | ||
} | ||
return StateObservable; | ||
}(Observable)); | ||
var State = /** @class */ (function (_super) { | ||
__extends$3(State, _super); | ||
function State(actions$, reducer$, scannedActions, initialState) { | ||
var _this = _super.call(this, initialState) || this; | ||
var actionsOnQueue$ = actions$.pipe(observeOn(queueScheduler)); | ||
var withLatestReducer$ = actionsOnQueue$.pipe(withLatestFrom(reducer$)); | ||
var seed = { state: initialState }; | ||
var stateAndAction$ = withLatestReducer$.pipe(scan(reduceState, seed)); | ||
_this.stateSubscription = stateAndAction$.subscribe(function (_a) { | ||
var state = _a.state, action = _a.action; | ||
_this.next(state); | ||
scannedActions.next(action); | ||
}); | ||
return _this; | ||
} | ||
State.prototype.ngOnDestroy = function () { | ||
this.stateSubscription.unsubscribe(); | ||
this.complete(); | ||
}; | ||
State.INIT = INIT; | ||
State.decorators = [ | ||
{ type: Injectable } | ||
]; | ||
/** @nocollapse */ | ||
State.ctorParameters = function () { return [ | ||
{ type: ActionsSubject, }, | ||
{ type: ReducerObservable, }, | ||
{ type: ScannedActionsSubject, }, | ||
{ type: undefined, decorators: [{ type: Inject, args: [INITIAL_STATE,] },] }, | ||
]; }; | ||
return State; | ||
}(BehaviorSubject)); | ||
function reduceState(stateActionPair, _a) { | ||
if (stateActionPair === void 0) { stateActionPair = { state: undefined }; } | ||
var _b = __read$2(_a, 2), action = _b[0], reducer = _b[1]; | ||
var state = stateActionPair.state; | ||
return { state: reducer(state, action), action: action }; | ||
} | ||
var __extends = (undefined && undefined.__extends) || (function () { | ||
var extendStatics = Object.setPrototypeOf || | ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || | ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; | ||
return function (d, b) { | ||
extendStatics(d, b); | ||
function __() { this.constructor = d; } | ||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); | ||
}; | ||
})(); | ||
var __read = (undefined && undefined.__read) || function (o, n) { | ||
var m = typeof Symbol === "function" && o[Symbol.iterator]; | ||
if (!m) return o; | ||
var i = m.call(o), r, ar = [], e; | ||
try { | ||
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); | ||
} | ||
catch (error) { e = { error: error }; } | ||
finally { | ||
try { | ||
if (r && !r.done && (m = i["return"])) m.call(i); | ||
} | ||
finally { if (e) throw e.error; } | ||
} | ||
return ar; | ||
}; | ||
var __spread = (undefined && undefined.__spread) || function () { | ||
for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read(arguments[i])); | ||
return ar; | ||
}; | ||
var Store = /** @class */ (function (_super) { | ||
__extends(Store, _super); | ||
function Store(state$, actionsObserver, reducerManager) { | ||
var _this = _super.call(this) || this; | ||
_this.actionsObserver = actionsObserver; | ||
_this.reducerManager = reducerManager; | ||
_this.source = state$; | ||
return _this; | ||
} | ||
Store.prototype.select = function (pathOrMapFn) { | ||
var paths = []; | ||
for (var _i = 1; _i < arguments.length; _i++) { | ||
paths[_i - 1] = arguments[_i]; | ||
} | ||
return select.apply(void 0, __spread([pathOrMapFn], paths))(this); | ||
}; | ||
Store.prototype.lift = function (operator) { | ||
var store = new Store(this, this.actionsObserver, this.reducerManager); | ||
store.operator = operator; | ||
return store; | ||
}; | ||
Store.prototype.dispatch = function (action) { | ||
this.actionsObserver.next(action); | ||
}; | ||
Store.prototype.next = function (action) { | ||
this.actionsObserver.next(action); | ||
}; | ||
Store.prototype.error = function (err) { | ||
this.actionsObserver.error(err); | ||
}; | ||
Store.prototype.complete = function () { | ||
this.actionsObserver.complete(); | ||
}; | ||
Store.prototype.addReducer = function (key, reducer) { | ||
this.reducerManager.addReducer(key, reducer); | ||
}; | ||
Store.prototype.removeReducer = function (key) { | ||
this.reducerManager.removeReducer(key); | ||
}; | ||
Store.decorators = [ | ||
{ type: Injectable } | ||
]; | ||
/** @nocollapse */ | ||
Store.ctorParameters = function () { return [ | ||
{ type: StateObservable, }, | ||
{ type: ActionsSubject, }, | ||
{ type: ReducerManager, }, | ||
]; }; | ||
return Store; | ||
}(Observable)); | ||
function select(pathOrMapFn) { | ||
var paths = []; | ||
for (var _i = 1; _i < arguments.length; _i++) { | ||
paths[_i - 1] = arguments[_i]; | ||
} | ||
return function selectOperator(source$) { | ||
var mapped$; | ||
if (typeof pathOrMapFn === 'string') { | ||
mapped$ = source$.pipe(pluck.apply(void 0, __spread([pathOrMapFn], paths))); | ||
} | ||
else if (typeof pathOrMapFn === 'function') { | ||
mapped$ = source$.pipe(map(pathOrMapFn)); | ||
} | ||
else { | ||
throw new TypeError("Unexpected type '" + typeof pathOrMapFn + "' in select operator," + | ||
" expected 'string' or 'function'"); | ||
} | ||
return mapped$.pipe(distinctUntilChanged()); | ||
}; | ||
} | ||
var __read$3 = (undefined && undefined.__read) || function (o, n) { | ||
var m = typeof Symbol === "function" && o[Symbol.iterator]; | ||
if (!m) return o; | ||
var i = m.call(o), r, ar = [], e; | ||
try { | ||
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); | ||
} | ||
catch (error) { e = { error: error }; } | ||
finally { | ||
try { | ||
if (r && !r.done && (m = i["return"])) m.call(i); | ||
} | ||
finally { if (e) throw e.error; } | ||
} | ||
return ar; | ||
}; | ||
var __spread$2 = (undefined && undefined.__spread) || function () { | ||
for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read$3(arguments[i])); | ||
return ar; | ||
}; | ||
var __assign$1 = (undefined && undefined.__assign) || Object.assign || function(t) { | ||
for (var s, i = 1, n = arguments.length; i < n; i++) { | ||
s = arguments[i]; | ||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) | ||
t[p] = s[p]; | ||
} | ||
return t; | ||
}; | ||
/** | ||
* DO NOT EDIT | ||
* | ||
* This file is automatically generated at build | ||
*/ | ||
var METADATA_KEY = '__@ngrx/effects__'; | ||
function getEffectMetadataEntries(sourceProto) { | ||
return sourceProto.constructor[METADATA_KEY] || []; | ||
} | ||
function getSourceForInstance(instance) { | ||
return Object.getPrototypeOf(instance); | ||
} | ||
var getSourceMetadata = compose(getEffectMetadataEntries, getSourceForInstance); | ||
var onRunEffectsKey = 'ngrxOnRunEffects'; | ||
function isOnRunEffects(sourceInstance) { | ||
var source = getSourceForInstance(sourceInstance); | ||
return (onRunEffectsKey in source && typeof source[onRunEffectsKey] === 'function'); | ||
} | ||
var __read$4 = (undefined && undefined.__read) || function (o, n) { | ||
var m = typeof Symbol === "function" && o[Symbol.iterator]; | ||
if (!m) return o; | ||
var i = m.call(o), r, ar = [], e; | ||
try { | ||
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); | ||
} | ||
catch (error) { e = { error: error }; } | ||
finally { | ||
try { | ||
if (r && !r.done && (m = i["return"])) m.call(i); | ||
} | ||
finally { if (e) throw e.error; } | ||
} | ||
return ar; | ||
}; | ||
var __spread$3 = (undefined && undefined.__spread) || function () { | ||
for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read$4(arguments[i])); | ||
return ar; | ||
}; | ||
function mergeEffects(sourceInstance) { | ||
var sourceName = getSourceForInstance(sourceInstance).constructor.name; | ||
var observables = getSourceMetadata(sourceInstance).map(function (_a) { | ||
var propertyName = _a.propertyName, dispatch = _a.dispatch; | ||
var observable = typeof sourceInstance[propertyName] === 'function' | ||
? sourceInstance[propertyName]() | ||
: sourceInstance[propertyName]; | ||
if (dispatch === false) { | ||
return observable.pipe(ignoreElements()); | ||
} | ||
var materialized$ = observable.pipe(materialize()); | ||
return materialized$.pipe(map(function (notification) { | ||
return ({ | ||
effect: sourceInstance[propertyName], | ||
notification: notification, | ||
propertyName: propertyName, | ||
sourceName: sourceName, | ||
sourceInstance: sourceInstance, | ||
}); | ||
})); | ||
}); | ||
return merge.apply(void 0, __spread$3(observables)); | ||
} | ||
function resolveEffectSource(sourceInstance) { | ||
var mergedEffects$ = mergeEffects(sourceInstance); | ||
if (isOnRunEffects(sourceInstance)) { | ||
return sourceInstance.ngrxOnRunEffects(mergedEffects$); | ||
} | ||
return mergedEffects$; | ||
} | ||
var __extends$5 = (undefined && undefined.__extends) || (function () { | ||
var extendStatics = Object.setPrototypeOf || | ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || | ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; | ||
return function (d, b) { | ||
extendStatics(d, b); | ||
function __() { this.constructor = d; } | ||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); | ||
}; | ||
})(); | ||
var __read$5 = (undefined && undefined.__read) || function (o, n) { | ||
var m = typeof Symbol === "function" && o[Symbol.iterator]; | ||
if (!m) return o; | ||
var i = m.call(o), r, ar = [], e; | ||
try { | ||
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); | ||
} | ||
catch (error) { e = { error: error }; } | ||
finally { | ||
try { | ||
if (r && !r.done && (m = i["return"])) m.call(i); | ||
} | ||
finally { if (e) throw e.error; } | ||
} | ||
return ar; | ||
}; | ||
var __spread$4 = (undefined && undefined.__spread) || function () { | ||
for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read$5(arguments[i])); | ||
return ar; | ||
}; | ||
var Actions = /** @class */ (function (_super) { | ||
__extends$5(Actions, _super); | ||
function Actions(source) { | ||
var _this = _super.call(this) || this; | ||
if (source) { | ||
_this.source = source; | ||
} | ||
return _this; | ||
} | ||
Actions.prototype.lift = function (operator) { | ||
var observable = new Actions(); | ||
observable.source = this; | ||
observable.operator = operator; | ||
return observable; | ||
}; | ||
Actions.prototype.ofType = function () { | ||
var allowedTypes = []; | ||
for (var _i = 0; _i < arguments.length; _i++) { | ||
allowedTypes[_i] = arguments[_i]; | ||
} | ||
return ofType.apply(void 0, __spread$4(allowedTypes))(this); | ||
}; | ||
Actions.decorators = [ | ||
{ type: Injectable } | ||
]; | ||
/** @nocollapse */ | ||
Actions.ctorParameters = function () { return [ | ||
{ type: Observable, decorators: [{ type: Inject, args: [ScannedActionsSubject,] },] }, | ||
]; }; | ||
return Actions; | ||
}(Observable)); | ||
function ofType() { | ||
var allowedTypes = []; | ||
for (var _i = 0; _i < arguments.length; _i++) { | ||
allowedTypes[_i] = arguments[_i]; | ||
} | ||
return filter(function (action) { | ||
return allowedTypes.some(function (type) { return type === action.type; }); | ||
}); | ||
} | ||
function verifyOutput(output, reporter) { | ||
reportErrorThrown(output, reporter); | ||
reportInvalidActions(output, reporter); | ||
} | ||
function reportErrorThrown(output, reporter) { | ||
if (output.notification.kind === 'E') { | ||
reporter.handleError(output.notification.error); | ||
} | ||
} | ||
function reportInvalidActions(output, reporter) { | ||
if (output.notification.kind === 'N') { | ||
var action = output.notification.value; | ||
var isInvalidAction = !isAction(action); | ||
if (isInvalidAction) { | ||
reporter.handleError(new Error("Effect " + getEffectName(output) + " dispatched an invalid action: " + action)); | ||
} | ||
} | ||
} | ||
function isAction(action) { | ||
return action && action.type && typeof action.type === 'string'; | ||
} | ||
function getEffectName(_a) { | ||
var propertyName = _a.propertyName, sourceInstance = _a.sourceInstance, sourceName = _a.sourceName; | ||
var isMethod = typeof sourceInstance[propertyName] === 'function'; | ||
return "\"" + sourceName + "." + propertyName + (isMethod ? '()' : '') + "\""; | ||
} | ||
var __extends$6 = (undefined && undefined.__extends) || (function () { | ||
var extendStatics = Object.setPrototypeOf || | ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || | ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; | ||
return function (d, b) { | ||
extendStatics(d, b); | ||
function __() { this.constructor = d; } | ||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); | ||
}; | ||
})(); | ||
var EffectSources = /** @class */ (function (_super) { | ||
__extends$6(EffectSources, _super); | ||
function EffectSources(errorHandler) { | ||
var _this = _super.call(this) || this; | ||
_this.errorHandler = errorHandler; | ||
return _this; | ||
} | ||
EffectSources.prototype.addEffects = function (effectSourceInstance) { | ||
this.next(effectSourceInstance); | ||
}; | ||
/** | ||
* @internal | ||
*/ | ||
/** | ||
* @internal | ||
*/ | ||
EffectSources.prototype.toActions = /** | ||
* @internal | ||
*/ | ||
function () { | ||
var _this = this; | ||
return this.pipe(groupBy(getSourceForInstance), mergeMap(function (source$) { | ||
return source$.pipe(exhaustMap(resolveEffectSource), map(function (output) { | ||
verifyOutput(output, _this.errorHandler); | ||
return output.notification; | ||
}), filter(function (notification) { | ||
return notification.kind === 'N'; | ||
}), dematerialize()); | ||
})); | ||
}; | ||
EffectSources.decorators = [ | ||
{ type: Injectable } | ||
]; | ||
/** @nocollapse */ | ||
EffectSources.ctorParameters = function () { return [ | ||
{ type: ErrorHandler, }, | ||
]; }; | ||
return EffectSources; | ||
}(Subject)); | ||
var IMMEDIATE_EFFECTS = new InjectionToken('ngrx/effects: Immediate Effects'); | ||
var ROOT_EFFECTS = new InjectionToken('ngrx/effects: Root Effects'); | ||
var FEATURE_EFFECTS = new InjectionToken('ngrx/effects: Feature Effects'); | ||
/** | ||
* DO NOT EDIT | ||
* | ||
* This file is automatically generated at build | ||
*/ | ||
function provideMockActions(factoryOrSource) { | ||
@@ -671,0 +10,0 @@ return { |
{ | ||
"name": "@ngrx/effects", | ||
"version": "v6.0.0-beta.0", | ||
"version": "v6.0.0-beta.1", | ||
"description": "Side effect model for @ngrx/store", | ||
@@ -17,3 +17,3 @@ "repository": { | ||
"@angular/core": "^6.0.0 || ^6.0.0-rc.0", | ||
"@ngrx/store": "v6.0.0-beta.0", | ||
"@ngrx/store": "v6.0.0-beta.1", | ||
"rxjs": "^5.6.0-forward-compat.0 || ^6.0.0-beta.0" | ||
@@ -20,0 +20,0 @@ }, |
/** | ||
* @license NgRx v6.0.0-beta.0 | ||
* @license NgRx v6.0.0-beta.1 | ||
* (c) 2015-2018 Brandon Roberts, Mike Ryan, Rob Wormald, Victor Savkin | ||
@@ -4,0 +4,0 @@ * License: MIT |
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
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
2
1
472769
3120