New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@ngxs/store

Package Overview
Dependencies
Maintainers
2
Versions
1361
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ngxs/store - npm Package Compare versions

Comparing version 2.0.0-build.b57cdf5 to 2.0.0-dev.0a1ca42

src/actions.d.ts

56

bundles/ngxs-store.umd.js
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('rxjs/BehaviorSubject'), require('rxjs/Observable'), require('rxjs/operators'), require('rxjs/observable/forkJoin'), require('rxjs/operators/map'), require('rxjs/observable/fromPromise'), require('rxjs/observable/of')) :
typeof define === 'function' && define.amd ? define('@ngxs/store', ['exports', '@angular/core', 'rxjs/BehaviorSubject', 'rxjs/Observable', 'rxjs/operators', 'rxjs/observable/forkJoin', 'rxjs/operators/map', 'rxjs/observable/fromPromise', 'rxjs/observable/of'], factory) :
(factory((global.ngxs = global.ngxs || {}, global.ngxs.store = {}),global.ng.core,global.Rx,global.Rx,global.Rx.Observable.prototype,global.Rx.Observable,global.Rx.Observable.prototype,global.Rx.Observable,global.Rx.Observable));
}(this, (function (exports,core,BehaviorSubject,Observable,operators,forkJoin,map,fromPromise,of) { 'use strict';
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('rxjs'), require('rxjs/operators')) :
typeof define === 'function' && define.amd ? define('@ngxs/store', ['exports', '@angular/core', 'rxjs', 'rxjs/operators'], factory) :
(factory((global.ngxs = global.ngxs || {}, global.ngxs.store = {}),global.ng.core,global.rxjs,global.Rx.Observable.prototype));
}(this, (function (exports,core,rxjs,operators) { 'use strict';

@@ -365,3 +365,3 @@ /*! *****************************************************************************

function Actions(parent) {
var _this = _super.call(this, {}) || this;
var _this = _super.call(this) || this;
if (parent) {

@@ -373,3 +373,3 @@ Object.assign(_this, parent);

return Actions;
}(BehaviorSubject.BehaviorSubject));
}(rxjs.Subject));
Actions.decorators = [

@@ -405,3 +405,3 @@ { type: core.Injectable },

return StateStream;
}(BehaviorSubject.BehaviorSubject));
}(rxjs.BehaviorSubject));
StateStream.decorators = [

@@ -458,3 +458,3 @@ { type: core.Injectable },

if (Array.isArray(event)) {
result = forkJoin.forkJoin(event.map(function (a) { return _this._dispatch(a); }));
result = rxjs.forkJoin(event.map(function (a) { return _this._dispatch(a); }));
}

@@ -466,3 +466,3 @@ else {

_this._errorHandler.handleError(err);
return of.of(err);
return rxjs.of(err);
}));

@@ -475,5 +475,10 @@ result.subscribe();

var getter = fastPropGetter(selector[META_KEY].path.split('.'));
return this._stateStream.pipe(map.map(getter), operators.distinctUntilChanged());
return this._stateStream.pipe(operators.map(getter), operators.distinctUntilChanged());
}
return this._stateStream.pipe(map.map(selector), operators.distinctUntilChanged());
return this._stateStream.pipe(operators.map(selector), operators.catchError(function (err) {
if (err instanceof TypeError) {
return rxjs.of(undefined);
}
throw err;
}), operators.distinctUntilChanged());
};

@@ -496,3 +501,3 @@ Store.prototype.selectOnce = function (selector) {

_this._actions.next(nextAction);
return _this._dispatchActions(nextAction).pipe(map.map(function () { return _this._stateStream.getValue(); }));
return _this._dispatchActions(nextAction).pipe(operators.map(function () { return _this._stateStream.getValue(); }));
}

@@ -504,3 +509,3 @@ ]))(prevState, action))).pipe(operators.shareReplay());

var results = this._storeFactory.invokeActions(function () { return _this._stateStream.getValue(); }, function (newState) { return _this._stateStream.next(newState); }, function (actions) { return _this.dispatch(actions); }, action);
return results.length ? forkJoin.forkJoin(this._handleNesting(results)) : of.of({});
return (results.length ? rxjs.forkJoin(this._handleNesting(results)) : rxjs.of({})).pipe(operators.shareReplay());
};

@@ -513,5 +518,5 @@ Store.prototype._handleNesting = function (eventResults) {

if (eventResult instanceof Promise) {
eventResult = fromPromise.fromPromise(eventResult);
eventResult = rxjs.from(eventResult);
}
if (eventResult instanceof Observable.Observable) {
if (eventResult instanceof rxjs.Observable) {
results.push(eventResult);

@@ -610,2 +615,8 @@ }

InitState.type = '@@INIT';
var UpdateState = /** @class */ (function () {
function UpdateState() {
}
return UpdateState;
}());
UpdateState.type = '@@UPDATE_STATE';
var NgxsRootModule = /** @class */ (function () {

@@ -643,2 +654,3 @@ function NgxsRootModule(_factory, _stateStream, store, select, states) {

this.initStates(flattenedStates);
store.dispatch(new UpdateState());
}

@@ -786,3 +798,3 @@ NgxsFeatureModule.prototype.initStates = function (stores) {

return function (target, key, descriptor) {
var metadata = target[META_KEY];
var metadata = ensureStoreMetadata(target);
if (descriptor.value !== null) {

@@ -792,3 +804,11 @@ var prev_1 = descriptor.value;

var local = getValue(state, metadata.path);
return prev_1(local);
try {
return prev_1(local);
}
catch (ex) {
if (ex instanceof TypeError) {
return undefined;
}
throw ex;
}
};

@@ -821,2 +841,4 @@ return {

exports.getValue = getValue;
exports.InitState = InitState;
exports.UpdateState = UpdateState;
exports.ɵb = NgxsFeatureModule;

@@ -823,0 +845,0 @@ exports.ɵa = NgxsRootModule;

@@ -1,2 +0,2 @@

!function(t,r){"object"==typeof exports&&"undefined"!=typeof module?r(exports,require("@angular/core"),require("rxjs/BehaviorSubject"),require("rxjs/Observable"),require("rxjs/operators"),require("rxjs/observable/forkJoin"),require("rxjs/operators/map"),require("rxjs/observable/fromPromise"),require("rxjs/observable/of")):"function"==typeof define&&define.amd?define("@ngxs/store",["exports","@angular/core","rxjs/BehaviorSubject","rxjs/Observable","rxjs/operators","rxjs/observable/forkJoin","rxjs/operators/map","rxjs/observable/fromPromise","rxjs/observable/of"],r):r((t.ngxs=t.ngxs||{},t.ngxs.store={}),t.ng.core,t.Rx,t.Rx,t.Rx.Observable.prototype,t.Rx.Observable,t.Rx.Observable.prototype,t.Rx.Observable,t.Rx.Observable)}(this,function(t,r,e,u,o,n,a,c,i){"use strict";var s=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,r){t.__proto__=r}||function(t,r){for(var e in r)r.hasOwnProperty(e)&&(t[e]=r[e])};function f(t,r){function e(){this.constructor=t}s(t,r),t.prototype=null===r?Object.create(r):(e.prototype=r.prototype,new e)}function m(t){var r="function"==typeof Symbol&&t[Symbol.iterator],e=0;return r?r.call(t):{next:function(){return t&&e>=t.length&&(t=void 0),{value:t&&t[e++],done:!t}}}}function p(t,r){var e="function"==typeof Symbol&&t[Symbol.iterator];if(!e)return t;var n,o,a=e.call(t),i=[];try{for(;(void 0===r||0<r--)&&!(n=a.next()).done;)i.push(n.value)}catch(s){o={error:s}}finally{try{n&&!n.done&&(e=a["return"])&&e.call(a)}finally{if(o)throw o.error}}return i}function S(){for(var t=[],r=0;r<arguments.length;r++)t=t.concat(p(arguments[r]));return t}var l=new r.InjectionToken("ROOT_STATE_TOKEN"),h=new r.InjectionToken("FEATURE_STATE_TOKEN"),j="NGXS_META",y=new r.InjectionToken("NGXS_PLUGINS");function d(t){if(!t.hasOwnProperty(j)){Object.defineProperty(t,j,{value:{name:null,actions:{},defaults:{},path:null,children:[]}})}return t[j]}function v(t){for(var r=t,e="store."+r[0],n=0,o=r.length,a=e;++n<o;)a=a+" && "+(e=e+"."+r[n]);return new Function("store","return "+a+";")}function b(t){return t.constructor.type?t.constructor.type:t.constructor.name?t.constructor.name:t.type?t.type:void 0}var g=function(t,r,e){t=Object.assign({},t);var n=r.split("."),o=n[n.length-1];return n.reduce(function(t,r){return t[r]=r===o?e:Object.assign({},t[r]),t&&t[r]},t),t},_=function(t,r){return r.split(".").reduce(function(t,r){return t&&t[r]},t)},x=function(){function t(t,r){this._injector=t,this._parentFactory=r,this._states=[]}return Object.defineProperty(t.prototype,"states",{get:function(){return this._parentFactory?this._parentFactory.states:this._states},enumerable:!0,configurable:!0}),t.prototype.add=function(t){Array.isArray(t)||(t=[t]);var e,a,n,o,i,s,r,u,c,f=(a=function(r){var t=e.find(function(t){return t===r});if(!t)throw new Error("Child state not found: "+r);if(!t[j])throw new Error("States must be decorated with @State() decorator");return t[j].name},(e=t).reduce(function(t,r){if(!r[j])throw new Error("States must be decorated with @State() decorator");var e=r[j],n=e.name,o=e.children;return t[n]=(o||[]).map(a),t},{})),p=(n=f,o=[],i={},s=function(r,e){void 0===e&&(e=[]),Array.isArray(e)||(e=[]),e.push(r),i[r]=!0,n[r].forEach(function(t){if(0<=e.indexOf(t))throw new Error("Circular dependency '"+t+"' is required by '"+r+"': "+e.join(" -> "));i[t]||s(t,e.slice(0))}),o.indexOf(r)<0&&o.push(r)},Object.keys(n).forEach(function(t){return s(t)}),o.reverse()),l=function(t,r){void 0===r&&(r={});var o=function(t,r){for(var e in t)if(t.hasOwnProperty(e)&&0<=t[e].indexOf(r)){var n=o(t,e);return null!==n?n+"."+e:e}return null};for(var e in t)if(t.hasOwnProperty(e)){var n=o(t,e);r[e]=n?n+"."+e:e}return r}(f),h=t.reduce(function(t,r){if(!r[j])throw new Error("States must be decorated with @State() decorator");return t[r[j].name]=r,t},{}),y=[],d=function(r){var t=h[r];if(!t[j])throw new Error("States must be decorated with @State() decorator");var e,n=l[r],o=t[j].actions,a=t[j].defaults;if(t[j].path=n,v.states.find(function(t){return t.name===r}))throw new Error("Store has already been added: "+r);Array.isArray(a)?a=S(a):"object"==typeof(e=a)&&null!==e||"function"==typeof e?a=Object.assign({},a):a===undefined&&(a={});var i=v._injector.get(t);y.push({actions:o,instance:i,defaults:a,name:r,depth:n})},v=this;try{for(var b=m(p),g=b.next();!g.done;g=b.next()){d(g.value)}}catch(_){r={error:_}}finally{try{g&&!g.done&&(u=b["return"])&&u.call(b)}finally{if(r)throw r.error}}return(c=this.states).push.apply(c,S(y)),y},t.prototype.addAndReturnDefaults=function(t){return this.add(t).reduce(function(t,r){return g(t,r.depth,r.defaults)},{})},t.prototype.invokeActions=function(p,l,h,y){var t,r,d=[],e=function(o){var t,r,e=b(y),n=o.actions[e];if(n)try{for(var a=m(n),i=a.next();!i.done;i=a.next()){var s=i.value,u={getState:function(){var t=p();return _(t,o.depth)},patchState:function(t){if(Array.isArray(t))throw new Error("Patching arrays is not supported.");var r=p(),e=_(r,o.depth);for(var n in t)e[n]=t[n];return r=g(r,o.depth,Object.assign({},e)),l(r),r},setState:function(t){var r=p();return r=g(r,o.depth,t),l(r),r},dispatch:function(t){return h(t)}},c=o.instance[s.fn](u,y);c&&d.push(c)}}catch(f){t={error:f}}finally{try{i&&!i.done&&(r=a["return"])&&r.call(a)}finally{if(t)throw t.error}}};try{for(var n=m(this.states),o=n.next();!o.done;o=n.next()){e(o.value)}}catch(a){t={error:a}}finally{try{o&&!o.done&&(r=n["return"])&&r.call(n)}finally{if(t)throw t.error}}return d},t}();x.decorators=[{type:r.Injectable}],x.ctorParameters=function(){return[{type:r.Injector},{type:x,decorators:[{type:r.Optional},{type:r.SkipSelf}]}]};var w=function(e){function t(t){var r=e.call(this,{})||this;return t&&Object.assign(r,t),r}return f(t,e),t}(e.BehaviorSubject);w.decorators=[{type:r.Injectable}],w.ctorParameters=function(){return[{type:w,decorators:[{type:r.Optional},{type:r.SkipSelf}]}]};var O=function(e){return function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return e.shift().apply(void 0,S(t,[function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return O(e).apply(void 0,S(t))}]))}},A=function(e){function t(t){var r=e.call(this,{})||this;return t&&Object.assign(r,t),r}return f(t,e),t}(e.BehaviorSubject);A.decorators=[{type:r.Injectable}],A.ctorParameters=function(){return[{type:A,decorators:[{type:r.Optional},{type:r.SkipSelf}]}]};var P=function(){function t(t,r){this._parentManager=t,this._plugins=r,this.plugins=[],this.register()}return t.prototype.register=function(){var t;this._plugins&&(this.plugins=this._plugins.map(function(t){return t.handle?t.handle.bind(t):t}),this._parentManager&&(t=this._parentManager.plugins).push.apply(t,S(this.plugins)))},t}();P.decorators=[{type:r.Injectable}],P.ctorParameters=function(){return[{type:P,decorators:[{type:r.Optional},{type:r.SkipSelf}]},{type:Array,decorators:[{type:r.Inject,args:[y]},{type:r.Optional}]}]};var E=function(){function t(t,r,e,n,o){this._errorHandler=t,this._actions=r,this._storeFactory=e,this._pluginManager=n,this._stateStream=o}return t.prototype.dispatch=function(t){var r,e=this;return(r=Array.isArray(t)?n.forkJoin(t.map(function(t){return e._dispatch(t)})):this._dispatch(t)).pipe(o.catchError(function(t){return e._errorHandler.handleError(t),i.of(t)})),r.subscribe(),r},t.prototype.select=function(t){if(t[j]&&t[j].path){var r=v(t[j].path.split("."));return this._stateStream.pipe(a.map(r),o.distinctUntilChanged())}return this._stateStream.pipe(a.map(t),o.distinctUntilChanged())},t.prototype.selectOnce=function(t){return this.select(t).pipe(o.take(1))},t.prototype.subscribe=function(t){return this._stateStream.subscribe(t)},t.prototype._dispatch=function(t){var e=this,n=this._stateStream.getValue(),r=this._pluginManager.plugins;return O(S(r,[function(t,r){return t!==n&&e._stateStream.next(t),e._actions.next(r),e._dispatchActions(r).pipe(a.map(function(){return e._stateStream.getValue()}))}]))(n,t).pipe(o.shareReplay())},t.prototype._dispatchActions=function(t){var r=this,e=this._storeFactory.invokeActions(function(){return r._stateStream.getValue()},function(t){return r._stateStream.next(t)},function(t){return r.dispatch(t)},t);return e.length?n.forkJoin(this._handleNesting(e)):i.of({})},t.prototype._handleNesting=function(t){var r,e,n=[];try{for(var o=m(t),a=o.next();!a.done;a=o.next()){var i=a.value;i instanceof Promise&&(i=c.fromPromise(i)),i instanceof u.Observable&&n.push(i)}}catch(s){r={error:s}}finally{try{a&&!a.done&&(e=o["return"])&&e.call(o)}finally{if(r)throw r.error}}return n},t}();E.decorators=[{type:r.Injectable}],E.ctorParameters=function(){return[{type:r.ErrorHandler},{type:w},{type:x},{type:P},{type:A}]};var I=function(t){};I.store=undefined,I.decorators=[{type:r.Injectable}],I.ctorParameters=function(){return[{type:E}]};var k=function(){};k.type="@@INIT";var M=function(){function t(t,r,e,n,o){this._factory=t,this._stateStream=r,this.initStates(o),e.dispatch(new k)}return t.prototype.initStates=function(t){if(t){var r=this._factory.addAndReturnDefaults(t),e=this._stateStream.getValue();this._stateStream.next(Object.assign({},e,r))}},t}();M.decorators=[{type:r.NgModule}],M.ctorParameters=function(){return[{type:x},{type:A},{type:E},{type:I},{type:Array,decorators:[{type:r.Optional},{type:r.Inject,args:[l]}]}]};var N=function(){function t(t,r,e,n,o){this._stateStream=e,this._factory=n;var a=[].concat.apply([],S(o));this.initStates(a)}return t.prototype.initStates=function(t){if(t){var r=this._factory.addAndReturnDefaults(t),e=this._stateStream.getValue();this._stateStream.next(Object.assign({},e,r))}},t}();N.decorators=[{type:r.NgModule,args:[{}]}],N.ctorParameters=function(){return[{type:M},{type:E},{type:A},{type:x},{type:Array,decorators:[{type:r.Optional},{type:r.Inject,args:[h]}]}]};var R=function(){function t(){}return t.forRoot=function(t){return void 0===t&&(t=[]),{ngModule:M,providers:S([x,w,E,A,I,P],t,[{provide:l,useValue:t}])}},t.forFeature=function(t){return{ngModule:N,providers:S([x,P],t,[{provide:h,multi:!0,useValue:t}])}},t}();R.decorators=[{type:r.NgModule,args:[{}]}],R.ctorParameters=function(){return[]},t.NgxsModule=R,t.Action=function(l){return function(t,r,e){var n,o,a,i=d(t.constructor);Array.isArray(l)||(l=[l]);try{for(var s=m(l),u=s.next();!u.done;u=s.next()){var c=u.value,f=(n=c).type?n.type:n.name?n.name:void 0;i.actions[f]||(i.actions[f]=[]),i.actions[f].push({fn:r,type:f})}}catch(p){o={error:p}}finally{try{u&&!u.done&&(a=s["return"])&&a.call(s)}finally{if(o)throw o.error}}}},t.Store=E,t.State=function(n){return function(t){var r=d(t);if(t.__proto__.hasOwnProperty(j)){var e=t.__proto__[j];r.actions=Object.assign({},r.actions,e.actions)}if(r.children=n.children,r.defaults=n.defaults,r.name=n.name,!n.name)throw new Error("States must register a 'name' property")}},t.Select=function(n){for(var o=[],t=1;t<arguments.length;t++)o[t-1]=arguments[t];return function(t,r){var e="__"+r+"__selector";if(n||(n=r.lastIndexOf("$")===r.length-1?r.substring(0,r.length-1):r),t[e])throw new Error("You cannot use @Select decorator and a "+e+" property.");delete t[r]&&(Object.defineProperty(t,e,{writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(t,r,{get:function(){return this[e]||(this[e]=function(t){var r=I.store;if(!r)throw new Error("SelectFactory not connected to store!");return r.select(t)}.apply(this,["string"==typeof n?v(o.length?S([n],o):n.split(".")):n[j]&&n[j].path?v(n[j].path.split(".")):n]))},enumerable:!0,configurable:!0}))}},t.Actions=w,t.ofAction=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];var e={};return t.forEach(function(t){return e[t.type||t.name]=!0}),o.filter(function(t){return e[t.constructor.type||t.constructor.name]})},t.Selector=function(){for(var i=[],t=0;t<arguments.length;t++)i[t]=arguments[t];return function(t,r,e){var n=t[j];if(null!==e.value){var o=e.value,a=function(t){var r=_(t,n.path);return o(r)};return{configurable:!0,get:function(){return function(a,i){var s=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];var e=i?i.apply(this,t):t[0],n=s.cache;if(n.has(e))return n.get(e);var o=a.apply(this,t);return s.cache=n.set(e,o)||n,o};return s.cache=new WeakMap,s}.apply(null,S([a],i))}}}throw new Error("Selectors only work on methods")}},t.getActionTypeFromInstance=b,t.NGXS_PLUGINS=y,t.StateStream=A,t.setValue=g,t.getValue=_,t.ɵb=N,t.ɵa=M,t.ɵg=P,t.ɵc=I,t.ɵf=x,t.ɵe=h,t.ɵd=l,Object.defineProperty(t,"__esModule",{value:!0})});
!function(t,r){"object"==typeof exports&&"undefined"!=typeof module?r(exports,require("@angular/core"),require("rxjs"),require("rxjs/operators")):"function"==typeof define&&define.amd?define("@ngxs/store",["exports","@angular/core","rxjs","rxjs/operators"],r):r((t.ngxs=t.ngxs||{},t.ngxs.store={}),t.ng.core,t.rxjs,t.Rx.Observable.prototype)}(this,function(t,r,u,o){"use strict";var n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,r){t.__proto__=r}||function(t,r){for(var e in r)r.hasOwnProperty(e)&&(t[e]=r[e])};function a(t,r){function e(){this.constructor=t}n(t,r),t.prototype=null===r?Object.create(r):(e.prototype=r.prototype,new e)}function S(t){var r="function"==typeof Symbol&&t[Symbol.iterator],e=0;return r?r.call(t):{next:function(){return t&&e>=t.length&&(t=void 0),{value:t&&t[e++],done:!t}}}}function e(t,r){var e="function"==typeof Symbol&&t[Symbol.iterator];if(!e)return t;var n,o,a=e.call(t),i=[];try{for(;(void 0===r||0<r--)&&!(n=a.next()).done;)i.push(n.value)}catch(c){o={error:c}}finally{try{n&&!n.done&&(e=a["return"])&&e.call(a)}finally{if(o)throw o.error}}return i}function b(){for(var t=[],r=0;r<arguments.length;r++)t=t.concat(e(arguments[r]));return t}var i=new r.InjectionToken("ROOT_STATE_TOKEN"),c=new r.InjectionToken("FEATURE_STATE_TOKEN"),w="NGXS_META",s=new r.InjectionToken("NGXS_PLUGINS");function h(t){if(!t.hasOwnProperty(w)){Object.defineProperty(t,w,{value:{name:null,actions:{},defaults:{},path:null,children:[]}})}return t[w]}function f(t){for(var r=t,e="store."+r[0],n=0,o=r.length,a=e;++n<o;)a=a+" && "+(e=e+"."+r[n]);return new Function("store","return "+a+";")}function v(t){return t.constructor.type?t.constructor.type:t.constructor.name?t.constructor.name:t.type?t.type:void 0}var g=function(t,r,e){t=Object.assign({},t);var n=r.split("."),o=n[n.length-1];return n.reduce(function(t,r){return t[r]=r===o?e:Object.assign({},t[r]),t&&t[r]},t),t},_=function(t,r){return r.split(".").reduce(function(t,r){return t&&t[r]},t)},p=function(){function t(t,r){this._injector=t,this._parentFactory=r,this._states=[]}return Object.defineProperty(t.prototype,"states",{get:function(){return this._parentFactory?this._parentFactory.states:this._states},enumerable:!0,configurable:!0}),t.prototype.add=function(t){Array.isArray(t)||(t=[t]);var e,a,n,o,i,c,r,u,s,f=(a=function(r){var t=e.find(function(t){return t===r});if(!t)throw new Error("Child state not found: "+r);if(!t[w])throw new Error("States must be decorated with @State() decorator");return t[w].name},(e=t).reduce(function(t,r){if(!r[w])throw new Error("States must be decorated with @State() decorator");var e=r[w],n=e.name,o=e.children;return t[n]=(o||[]).map(a),t},{})),p=(n=f,o=[],i={},c=function(r,e){void 0===e&&(e=[]),Array.isArray(e)||(e=[]),e.push(r),i[r]=!0,n[r].forEach(function(t){if(0<=e.indexOf(t))throw new Error("Circular dependency '"+t+"' is required by '"+r+"': "+e.join(" -> "));i[t]||c(t,e.slice(0))}),o.indexOf(r)<0&&o.push(r)},Object.keys(n).forEach(function(t){return c(t)}),o.reverse()),l=function(t,r){void 0===r&&(r={});var o=function(t,r){for(var e in t)if(t.hasOwnProperty(e)&&0<=t[e].indexOf(r)){var n=o(t,e);return null!==n?n+"."+e:e}return null};for(var e in t)if(t.hasOwnProperty(e)){var n=o(t,e);r[e]=n?n+"."+e:e}return r}(f),h=t.reduce(function(t,r){if(!r[w])throw new Error("States must be decorated with @State() decorator");return t[r[w].name]=r,t},{}),y=[],d=function(r){var t=h[r];if(!t[w])throw new Error("States must be decorated with @State() decorator");var e,n=l[r],o=t[w].actions,a=t[w].defaults;if(t[w].path=n,v.states.find(function(t){return t.name===r}))throw new Error("Store has already been added: "+r);Array.isArray(a)?a=b(a):"object"==typeof(e=a)&&null!==e||"function"==typeof e?a=Object.assign({},a):a===undefined&&(a={});var i=v._injector.get(t);y.push({actions:o,instance:i,defaults:a,name:r,depth:n})},v=this;try{for(var g=S(p),_=g.next();!_.done;_=g.next()){d(_.value)}}catch(m){r={error:m}}finally{try{_&&!_.done&&(u=g["return"])&&u.call(g)}finally{if(r)throw r.error}}return(s=this.states).push.apply(s,b(y)),y},t.prototype.addAndReturnDefaults=function(t){return this.add(t).reduce(function(t,r){return g(t,r.depth,r.defaults)},{})},t.prototype.invokeActions=function(p,l,h,y){var t,r,d=[],e=function(o){var t,r,e=v(y),n=o.actions[e];if(n)try{for(var a=S(n),i=a.next();!i.done;i=a.next()){var c=i.value,u={getState:function(){var t=p();return _(t,o.depth)},patchState:function(t){if(Array.isArray(t))throw new Error("Patching arrays is not supported.");var r=p(),e=_(r,o.depth);for(var n in t)e[n]=t[n];return r=g(r,o.depth,Object.assign({},e)),l(r),r},setState:function(t){var r=p();return r=g(r,o.depth,t),l(r),r},dispatch:function(t){return h(t)}},s=o.instance[c.fn](u,y);s&&d.push(s)}}catch(f){t={error:f}}finally{try{i&&!i.done&&(r=a["return"])&&r.call(a)}finally{if(t)throw t.error}}};try{for(var n=S(this.states),o=n.next();!o.done;o=n.next()){e(o.value)}}catch(a){t={error:a}}finally{try{o&&!o.done&&(r=n["return"])&&r.call(n)}finally{if(t)throw t.error}}return d},t}();p.decorators=[{type:r.Injectable}],p.ctorParameters=function(){return[{type:r.Injector},{type:p,decorators:[{type:r.Optional},{type:r.SkipSelf}]}]};var l=function(e){function t(t){var r=e.call(this)||this;return t&&Object.assign(r,t),r}return a(t,e),t}(u.Subject);l.decorators=[{type:r.Injectable}],l.ctorParameters=function(){return[{type:l,decorators:[{type:r.Optional},{type:r.SkipSelf}]}]};var y=function(e){return function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return e.shift().apply(void 0,b(t,[function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return y(e).apply(void 0,b(t))}]))}},d=function(e){function t(t){var r=e.call(this,{})||this;return t&&Object.assign(r,t),r}return a(t,e),t}(u.BehaviorSubject);d.decorators=[{type:r.Injectable}],d.ctorParameters=function(){return[{type:d,decorators:[{type:r.Optional},{type:r.SkipSelf}]}]};var m=function(){function t(t,r){this._parentManager=t,this._plugins=r,this.plugins=[],this.register()}return t.prototype.register=function(){var t;this._plugins&&(this.plugins=this._plugins.map(function(t){return t.handle?t.handle.bind(t):t}),this._parentManager&&(t=this._parentManager.plugins).push.apply(t,b(this.plugins)))},t}();m.decorators=[{type:r.Injectable}],m.ctorParameters=function(){return[{type:m,decorators:[{type:r.Optional},{type:r.SkipSelf}]},{type:Array,decorators:[{type:r.Inject,args:[s]},{type:r.Optional}]}]};var j=function(){function t(t,r,e,n,o){this._errorHandler=t,this._actions=r,this._storeFactory=e,this._pluginManager=n,this._stateStream=o}return t.prototype.dispatch=function(t){var r,e=this;return(r=Array.isArray(t)?u.forkJoin(t.map(function(t){return e._dispatch(t)})):this._dispatch(t)).pipe(o.catchError(function(t){return e._errorHandler.handleError(t),u.of(t)})),r.subscribe(),r},t.prototype.select=function(t){if(t[w]&&t[w].path){var r=f(t[w].path.split("."));return this._stateStream.pipe(o.map(r),o.distinctUntilChanged())}return this._stateStream.pipe(o.map(t),o.catchError(function(t){if(t instanceof TypeError)return u.of(undefined);throw t}),o.distinctUntilChanged())},t.prototype.selectOnce=function(t){return this.select(t).pipe(o.take(1))},t.prototype.subscribe=function(t){return this._stateStream.subscribe(t)},t.prototype._dispatch=function(t){var e=this,n=this._stateStream.getValue(),r=this._pluginManager.plugins;return y(b(r,[function(t,r){return t!==n&&e._stateStream.next(t),e._actions.next(r),e._dispatchActions(r).pipe(o.map(function(){return e._stateStream.getValue()}))}]))(n,t).pipe(o.shareReplay())},t.prototype._dispatchActions=function(t){var r=this,e=this._storeFactory.invokeActions(function(){return r._stateStream.getValue()},function(t){return r._stateStream.next(t)},function(t){return r.dispatch(t)},t);return(e.length?u.forkJoin(this._handleNesting(e)):u.of({})).pipe(o.shareReplay())},t.prototype._handleNesting=function(t){var r,e,n=[];try{for(var o=S(t),a=o.next();!a.done;a=o.next()){var i=a.value;i instanceof Promise&&(i=u.from(i)),i instanceof u.Observable&&n.push(i)}}catch(c){r={error:c}}finally{try{a&&!a.done&&(e=o["return"])&&e.call(o)}finally{if(r)throw r.error}}return n},t}();j.decorators=[{type:r.Injectable}],j.ctorParameters=function(){return[{type:r.ErrorHandler},{type:l},{type:p},{type:m},{type:d}]};var O=function(t){};O.store=undefined,O.decorators=[{type:r.Injectable}],O.ctorParameters=function(){return[{type:j}]};var x=function(){};x.type="@@INIT";var A=function(){};A.type="@@UPDATE_STATE";var E=function(){function t(t,r,e,n,o){this._factory=t,this._stateStream=r,this.initStates(o),e.dispatch(new x)}return t.prototype.initStates=function(t){if(t){var r=this._factory.addAndReturnDefaults(t),e=this._stateStream.getValue();this._stateStream.next(Object.assign({},e,r))}},t}();E.decorators=[{type:r.NgModule}],E.ctorParameters=function(){return[{type:p},{type:d},{type:j},{type:O},{type:Array,decorators:[{type:r.Optional},{type:r.Inject,args:[i]}]}]};var P=function(){function t(t,r,e,n,o){this._stateStream=e,this._factory=n;var a=[].concat.apply([],b(o));this.initStates(a),r.dispatch(new A)}return t.prototype.initStates=function(t){if(t){var r=this._factory.addAndReturnDefaults(t),e=this._stateStream.getValue();this._stateStream.next(Object.assign({},e,r))}},t}();P.decorators=[{type:r.NgModule,args:[{}]}],P.ctorParameters=function(){return[{type:E},{type:j},{type:d},{type:p},{type:Array,decorators:[{type:r.Optional},{type:r.Inject,args:[c]}]}]};var I=function(){function t(){}return t.forRoot=function(t){return void 0===t&&(t=[]),{ngModule:E,providers:b([p,l,j,d,O,m],t,[{provide:i,useValue:t}])}},t.forFeature=function(t){return{ngModule:P,providers:b([p,m],t,[{provide:c,multi:!0,useValue:t}])}},t}();I.decorators=[{type:r.NgModule,args:[{}]}],I.ctorParameters=function(){return[]},t.NgxsModule=I,t.Action=function(l){return function(t,r,e){var n,o,a,i=h(t.constructor);Array.isArray(l)||(l=[l]);try{for(var c=S(l),u=c.next();!u.done;u=c.next()){var s=u.value,f=(n=s).type?n.type:n.name?n.name:void 0;i.actions[f]||(i.actions[f]=[]),i.actions[f].push({fn:r,type:f})}}catch(p){o={error:p}}finally{try{u&&!u.done&&(a=c["return"])&&a.call(c)}finally{if(o)throw o.error}}}},t.Store=j,t.State=function(n){return function(t){var r=h(t);if(t.__proto__.hasOwnProperty(w)){var e=t.__proto__[w];r.actions=Object.assign({},r.actions,e.actions)}if(r.children=n.children,r.defaults=n.defaults,r.name=n.name,!n.name)throw new Error("States must register a 'name' property")}},t.Select=function(n){for(var o=[],t=1;t<arguments.length;t++)o[t-1]=arguments[t];return function(t,r){var e="__"+r+"__selector";if(n||(n=r.lastIndexOf("$")===r.length-1?r.substring(0,r.length-1):r),t[e])throw new Error("You cannot use @Select decorator and a "+e+" property.");delete t[r]&&(Object.defineProperty(t,e,{writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(t,r,{get:function(){return this[e]||(this[e]=function(t){var r=O.store;if(!r)throw new Error("SelectFactory not connected to store!");return r.select(t)}.apply(this,["string"==typeof n?f(o.length?b([n],o):n.split(".")):n[w]&&n[w].path?f(n[w].path.split(".")):n]))},enumerable:!0,configurable:!0}))}},t.Actions=l,t.ofAction=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];var e={};return t.forEach(function(t){return e[t.type||t.name]=!0}),o.filter(function(t){return e[t.constructor.type||t.constructor.name]})},t.Selector=function(){for(var i=[],t=0;t<arguments.length;t++)i[t]=arguments[t];return function(t,r,e){var n=h(t);if(null!==e.value){var o=e.value,a=function(t){var r=_(t,n.path);try{return o(r)}catch(e){if(e instanceof TypeError)return undefined;throw e}};return{configurable:!0,get:function(){return function(a,i){var c=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];var e=i?i.apply(this,t):t[0],n=c.cache;if(n.has(e))return n.get(e);var o=a.apply(this,t);return c.cache=n.set(e,o)||n,o};return c.cache=new WeakMap,c}.apply(null,b([a],i))}}}throw new Error("Selectors only work on methods")}},t.getActionTypeFromInstance=v,t.NGXS_PLUGINS=s,t.StateStream=d,t.setValue=g,t.getValue=_,t.InitState=x,t.UpdateState=A,t.ɵb=P,t.ɵa=E,t.ɵg=m,t.ɵc=O,t.ɵf=p,t.ɵe=c,t.ɵd=i,Object.defineProperty(t,"__esModule",{value:!0})});
//# sourceMappingURL=ngxs-store.umd.min.js.map
import { InjectionToken, Injector, Injectable, SkipSelf, Optional, Inject, ErrorHandler, NgModule } from '@angular/core';
import { BehaviorSubject } from 'rxjs/BehaviorSubject';
import { Observable } from 'rxjs/Observable';
import { distinctUntilChanged, catchError, take, shareReplay, filter } from 'rxjs/operators';
import { forkJoin } from 'rxjs/observable/forkJoin';
import { map } from 'rxjs/operators/map';
import { fromPromise } from 'rxjs/observable/fromPromise';
import { of } from 'rxjs/observable/of';
import { Subject, BehaviorSubject, Observable, forkJoin, of, from } from 'rxjs';
import { map, distinctUntilChanged, catchError, take, shareReplay, filter } from 'rxjs/operators';

@@ -458,5 +453,6 @@ /**

* Action stream that is emitted anytime an action is dispatched.
*
* You can listen to this in services to react without stores.
*/
class Actions extends BehaviorSubject {
class Actions extends Subject {
/**

@@ -466,3 +462,3 @@ * @param {?} parent

constructor(parent) {
super({});
super();
if (parent) {

@@ -628,3 +624,10 @@ Object.assign(this, parent);

}
return this._stateStream.pipe(map(selector), distinctUntilChanged());
return this._stateStream.pipe(map(selector), catchError(err => {
// if error is TypeError we swallow it to prevent usual errors with property access
if (err instanceof TypeError) {
return of(undefined);
}
// rethrow other errors
throw err;
}), distinctUntilChanged());
}

@@ -670,3 +673,3 @@ /**

const /** @type {?} */ results = this._storeFactory.invokeActions(() => this._stateStream.getValue(), newState => this._stateStream.next(newState), actions => this.dispatch(actions), action);
return results.length ? forkJoin(this._handleNesting(results)) : of({});
return (results.length ? forkJoin(this._handleNesting(results)) : of({})).pipe(shareReplay());
}

@@ -681,3 +684,3 @@ /**

if (eventResult instanceof Promise) {
eventResult = fromPromise(eventResult);
eventResult = from(eventResult);
}

@@ -782,2 +785,5 @@ if (eventResult instanceof Observable) {

InitState.type = '@@INIT';
class UpdateState {
}
UpdateState.type = '@@UPDATE_STATE';

@@ -839,5 +845,7 @@ /**

this._factory = _factory;
// since FEATURE_STATE_TOKEN is a multi token, we need to flatten it [[Feature1State, Feature2State], [Feature3State]]
// since FEATURE_STATE_TOKEN is a multi token, we need to
// flatten it [[Feature1State, Feature2State], [Feature3State]]
const /** @type {?} */ flattenedStates = (/** @type {?} */ ([])).concat(...states);
this.initStates(flattenedStates);
store.dispatch(new UpdateState());
}

@@ -1028,3 +1036,3 @@ /**

return (target, key, descriptor) => {
const /** @type {?} */ metadata = target[META_KEY];
const /** @type {?} */ metadata = ensureStoreMetadata(target);
if (descriptor.value !== null) {

@@ -1034,3 +1042,13 @@ const /** @type {?} */ prev = descriptor.value;

const /** @type {?} */ local = getValue(state, metadata.path);
return prev(local);
// if the lambda tries to access a something on the state that doesn't exist, it will throw a TypeError.
// since this is quite usual behaviour, we simply return undefined if so.
try {
return prev(local);
}
catch (/** @type {?} */ ex) {
if (ex instanceof TypeError) {
return undefined;
}
throw ex;
}
};

@@ -1079,3 +1097,3 @@ return {

export { NgxsModule, Action, Store, State, Select, Actions, ofAction, Selector, getActionTypeFromInstance, NGXS_PLUGINS, StateStream, setValue, getValue, NgxsFeatureModule as ɵb, NgxsRootModule as ɵa, PluginManager as ɵg, SelectFactory as ɵc, StateFactory as ɵf, FEATURE_STATE_TOKEN as ɵe, ROOT_STATE_TOKEN as ɵd };
export { NgxsModule, Action, Store, State, Select, Actions, ofAction, Selector, getActionTypeFromInstance, NGXS_PLUGINS, StateStream, setValue, getValue, InitState, UpdateState, NgxsFeatureModule as ɵb, NgxsRootModule as ɵa, PluginManager as ɵg, SelectFactory as ɵc, StateFactory as ɵf, FEATURE_STATE_TOKEN as ɵe, ROOT_STATE_TOKEN as ɵd };
//# sourceMappingURL=ngxs-store.js.map
import { __spread, __values, __extends } from 'tslib';
import { InjectionToken, Injector, Injectable, SkipSelf, Optional, Inject, ErrorHandler, NgModule } from '@angular/core';
import { BehaviorSubject } from 'rxjs/BehaviorSubject';
import { Observable } from 'rxjs/Observable';
import { distinctUntilChanged, catchError, take, shareReplay, filter } from 'rxjs/operators';
import { forkJoin } from 'rxjs/observable/forkJoin';
import { map } from 'rxjs/operators/map';
import { fromPromise } from 'rxjs/observable/fromPromise';
import { of } from 'rxjs/observable/of';
import { Subject, BehaviorSubject, Observable, forkJoin, of, from } from 'rxjs';
import { map, distinctUntilChanged, catchError, take, shareReplay, filter } from 'rxjs/operators';

@@ -308,3 +303,3 @@ var ROOT_STATE_TOKEN = new InjectionToken('ROOT_STATE_TOKEN');

function Actions(parent) {
var _this = _super.call(this, {}) || this;
var _this = _super.call(this) || this;
if (parent) {

@@ -316,3 +311,3 @@ Object.assign(_this, parent);

return Actions;
}(BehaviorSubject));
}(Subject));
Actions.decorators = [

@@ -417,3 +412,8 @@ { type: Injectable },

}
return this._stateStream.pipe(map(selector), distinctUntilChanged());
return this._stateStream.pipe(map(selector), catchError(function (err) {
if (err instanceof TypeError) {
return of(undefined);
}
throw err;
}), distinctUntilChanged());
};

@@ -443,3 +443,3 @@ Store.prototype.selectOnce = function (selector) {

var results = this._storeFactory.invokeActions(function () { return _this._stateStream.getValue(); }, function (newState) { return _this._stateStream.next(newState); }, function (actions) { return _this.dispatch(actions); }, action);
return results.length ? forkJoin(this._handleNesting(results)) : of({});
return (results.length ? forkJoin(this._handleNesting(results)) : of({})).pipe(shareReplay());
};

@@ -452,3 +452,3 @@ Store.prototype._handleNesting = function (eventResults) {

if (eventResult instanceof Promise) {
eventResult = fromPromise(eventResult);
eventResult = from(eventResult);
}

@@ -549,2 +549,8 @@ if (eventResult instanceof Observable) {

InitState.type = '@@INIT';
var UpdateState = /** @class */ (function () {
function UpdateState() {
}
return UpdateState;
}());
UpdateState.type = '@@UPDATE_STATE';
var NgxsRootModule = /** @class */ (function () {

@@ -582,2 +588,3 @@ function NgxsRootModule(_factory, _stateStream, store, select, states) {

this.initStates(flattenedStates);
store.dispatch(new UpdateState());
}

@@ -725,3 +732,3 @@ NgxsFeatureModule.prototype.initStates = function (stores) {

return function (target, key, descriptor) {
var metadata = target[META_KEY];
var metadata = ensureStoreMetadata(target);
if (descriptor.value !== null) {

@@ -731,3 +738,11 @@ var prev_1 = descriptor.value;

var local = getValue(state, metadata.path);
return prev_1(local);
try {
return prev_1(local);
}
catch (ex) {
if (ex instanceof TypeError) {
return undefined;
}
throw ex;
}
};

@@ -747,3 +762,3 @@ return {

export { NgxsModule, Action, Store, State, Select, Actions, ofAction, Selector, getActionTypeFromInstance, NGXS_PLUGINS, StateStream, setValue, getValue, NgxsFeatureModule as ɵb, NgxsRootModule as ɵa, PluginManager as ɵg, SelectFactory as ɵc, StateFactory as ɵf, FEATURE_STATE_TOKEN as ɵe, ROOT_STATE_TOKEN as ɵd };
export { NgxsModule, Action, Store, State, Select, Actions, ofAction, Selector, getActionTypeFromInstance, NGXS_PLUGINS, StateStream, setValue, getValue, InitState, UpdateState, NgxsFeatureModule as ɵb, NgxsRootModule as ɵa, PluginManager as ɵg, SelectFactory as ɵc, StateFactory as ɵf, FEATURE_STATE_TOKEN as ɵe, ROOT_STATE_TOKEN as ɵd };
//# sourceMappingURL=ngxs-store.js.map

@@ -1,1 +0,1 @@

{"__symbolic":"module","version":4,"metadata":{"ɵa":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"NgModule","line":11,"character":1}}],"members":{"__ctor__":[{"__symbolic":"constructor","parameterDecorators":[null,null,null,null,[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Optional","line":18,"character":5}},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject","line":19,"character":5},"arguments":[{"__symbolic":"reference","name":"ɵd"}]}]],"parameters":[{"__symbolic":"reference","name":"ɵf"},{"__symbolic":"reference","name":"StateStream"},{"__symbolic":"reference","name":"Store"},{"__symbolic":"reference","name":"ɵc"},{"__symbolic":"reference","name":"Array","arguments":[{"__symbolic":"reference","name":"any"}]}]}],"initStates":[{"__symbolic":"method"}]}},"ɵb":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"NgModule","line":40,"character":1},"arguments":[{}]}],"members":{"__ctor__":[{"__symbolic":"constructor","parameterDecorators":[null,null,null,null,[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Optional","line":47,"character":5}},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject","line":48,"character":5},"arguments":[{"__symbolic":"reference","name":"ɵe"}]}]],"parameters":[{"__symbolic":"reference","name":"ɵa"},{"__symbolic":"reference","name":"Store"},{"__symbolic":"reference","name":"StateStream"},{"__symbolic":"reference","name":"ɵf"},{"__symbolic":"reference","name":"Array","arguments":[{"__symbolic":"reference","name":"Array","arguments":[{"__symbolic":"reference","name":"any"}]}]}]}],"initStates":[{"__symbolic":"method"}]}},"ɵc":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Injectable","line":6,"character":1}}],"members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","name":"Store"}]}]},"statics":{"store":{"__symbolic":"reference","name":"undefined"}}},"ɵd":{"__symbolic":"new","expression":{"__symbolic":"reference","module":"@angular/core","name":"InjectionToken","line":3,"character":36},"arguments":["ROOT_STATE_TOKEN"]},"ɵe":{"__symbolic":"new","expression":{"__symbolic":"reference","module":"@angular/core","name":"InjectionToken","line":4,"character":39},"arguments":["FEATURE_STATE_TOKEN"]},"NgxsModule":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"NgModule","line":70,"character":1},"arguments":[{}]}],"members":{},"statics":{"forRoot":{"__symbolic":"function","parameters":["states"],"defaults":[[]],"value":{"ngModule":{"__symbolic":"reference","name":"ɵa"},"providers":[{"__symbolic":"reference","name":"ɵf"},{"__symbolic":"reference","name":"Actions"},{"__symbolic":"reference","name":"Store"},{"__symbolic":"reference","name":"StateStream"},{"__symbolic":"reference","name":"ɵc"},{"__symbolic":"reference","name":"ɵg"},{"__symbolic":"spread","expression":{"__symbolic":"reference","name":"states"}},{"provide":{"__symbolic":"reference","name":"ɵd"},"useValue":{"__symbolic":"reference","name":"states"}}]}},"forFeature":{"__symbolic":"function","parameters":["states"],"value":{"ngModule":{"__symbolic":"reference","name":"ɵb"},"providers":[{"__symbolic":"reference","name":"ɵf"},{"__symbolic":"reference","name":"ɵg"},{"__symbolic":"spread","expression":{"__symbolic":"reference","name":"states"}},{"provide":{"__symbolic":"reference","name":"ɵe"},"multi":true,"useValue":{"__symbolic":"reference","name":"states"}}]}}}},"Action":{"__symbolic":"function","parameters":["actions"],"value":{"__symbolic":"error","message":"Lambda not supported","line":6,"character":9,"module":"./src/action"}},"Store":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Injectable","line":17,"character":1}}],"members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","module":"@angular/core","name":"ErrorHandler","line":20,"character":27},{"__symbolic":"reference","name":"Actions"},{"__symbolic":"reference","name":"ɵf"},{"__symbolic":"reference","name":"ɵg"},{"__symbolic":"reference","name":"StateStream"}]}],"dispatch":[{"__symbolic":"method"}],"select":[{"__symbolic":"method"},{"__symbolic":"method"},{"__symbolic":"method"}],"selectOnce":[{"__symbolic":"method"},{"__symbolic":"method"},{"__symbolic":"method"}],"subscribe":[{"__symbolic":"method"}],"_dispatch":[{"__symbolic":"method"}],"_dispatchActions":[{"__symbolic":"method"}],"_handleNesting":[{"__symbolic":"method"}]}},"State":{"__symbolic":"function","parameters":["options"],"value":{"__symbolic":"error","message":"Lambda not supported","line":7,"character":9,"module":"./src/state"}},"Select":{"__symbolic":"function","parameters":["selectorOrFeature","paths"],"value":{"__symbolic":"error","message":"Lambda not supported","line":18,"character":9,"module":"./src/select"}},"Actions":{"__symbolic":"class","extends":{"__symbolic":"reference","module":"rxjs/BehaviorSubject","name":"BehaviorSubject","line":8,"character":29},"decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Injectable","line":7,"character":1}}],"members":{"__ctor__":[{"__symbolic":"constructor","parameterDecorators":[[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Optional","line":10,"character":5}},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"SkipSelf","line":11,"character":5}}]],"parameters":[{"__symbolic":"reference","name":"Actions"}]}]}},"ofAction":{"__symbolic":"function"},"NgxsPlugin":{"__symbolic":"interface"},"NgxsPluginFn":{"__symbolic":"interface"},"StateContext":{"__symbolic":"interface"},"Selector":{"__symbolic":"function","parameters":["args"],"value":{"__symbolic":"error","message":"Lambda not supported","line":8,"character":9,"module":"./src/selector"}},"getActionTypeFromInstance":{"__symbolic":"function"},"NGXS_PLUGINS":{"__symbolic":"new","expression":{"__symbolic":"reference","module":"@angular/core","name":"InjectionToken","line":44,"character":32},"arguments":["NGXS_PLUGINS"]},"StateStream":{"__symbolic":"class","extends":{"__symbolic":"reference","module":"rxjs/BehaviorSubject","name":"BehaviorSubject","line":7,"character":33},"decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Injectable","line":6,"character":1}}],"members":{"__ctor__":[{"__symbolic":"constructor","parameterDecorators":[[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Optional","line":9,"character":5}},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"SkipSelf","line":10,"character":5}}]],"parameters":[{"__symbolic":"reference","name":"StateStream"}]}]}},"setValue":{"__symbolic":"error","message":"Lambda not supported","line":22,"character":24,"module":"./src/utils"},"getValue":{"__symbolic":"error","message":"Lambda not supported","line":47,"character":24,"module":"./src/utils"},"ɵf":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Injectable","line":19,"character":1}}],"members":{"__ctor__":[{"__symbolic":"constructor","parameterDecorators":[null,[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Optional","line":28,"character":5}},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"SkipSelf","line":29,"character":5}}]],"parameters":[{"__symbolic":"reference","module":"@angular/core","name":"Injector","line":27,"character":23},{"__symbolic":"reference","name":"ɵf"}]}],"add":[{"__symbolic":"method"}],"addAndReturnDefaults":[{"__symbolic":"method"}],"invokeActions":[{"__symbolic":"method"}]}},"ɵg":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Injectable","line":3,"character":1}}],"members":{"__ctor__":[{"__symbolic":"constructor","parameterDecorators":[[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Optional","line":8,"character":5}},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"SkipSelf","line":9,"character":5}}],[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject","line":11,"character":5},"arguments":[{"__symbolic":"reference","name":"NGXS_PLUGINS"}]},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Optional","line":12,"character":5}}]],"parameters":[{"__symbolic":"reference","name":"ɵg"},{"__symbolic":"reference","name":"Array","arguments":[{"__symbolic":"reference","name":"NgxsPlugin"}]}]}],"register":[{"__symbolic":"method"}]}}},"origins":{"ɵa":"./src/module","ɵb":"./src/module","ɵc":"./src/select","ɵd":"./src/symbols","ɵe":"./src/symbols","NgxsModule":"./src/module","Action":"./src/action","Store":"./src/store","State":"./src/state","Select":"./src/select","Actions":"./src/actions-stream","ofAction":"./src/of-action","NgxsPlugin":"./src/symbols","NgxsPluginFn":"./src/symbols","StateContext":"./src/symbols","Selector":"./src/selector","getActionTypeFromInstance":"./src/utils","NGXS_PLUGINS":"./src/symbols","StateStream":"./src/state-stream","setValue":"./src/utils","getValue":"./src/utils","ɵf":"./src/state-factory","ɵg":"./src/plugin-manager"},"importAs":"@ngxs/store"}
{"__symbolic":"module","version":4,"metadata":{"ɵa":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"NgModule","line":11,"character":1}}],"members":{"__ctor__":[{"__symbolic":"constructor","parameterDecorators":[null,null,null,null,[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Optional","line":18,"character":5}},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject","line":19,"character":5},"arguments":[{"__symbolic":"reference","name":"ɵd"}]}]],"parameters":[{"__symbolic":"reference","name":"ɵf"},{"__symbolic":"reference","name":"StateStream"},{"__symbolic":"reference","name":"Store"},{"__symbolic":"reference","name":"ɵc"},{"__symbolic":"reference","name":"Array","arguments":[{"__symbolic":"reference","name":"any"}]}]}],"initStates":[{"__symbolic":"method"}]}},"ɵb":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"NgModule","line":40,"character":1},"arguments":[{}]}],"members":{"__ctor__":[{"__symbolic":"constructor","parameterDecorators":[null,null,null,null,[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Optional","line":47,"character":5}},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject","line":48,"character":5},"arguments":[{"__symbolic":"reference","name":"ɵe"}]}]],"parameters":[{"__symbolic":"reference","name":"ɵa"},{"__symbolic":"reference","name":"Store"},{"__symbolic":"reference","name":"StateStream"},{"__symbolic":"reference","name":"ɵf"},{"__symbolic":"reference","name":"Array","arguments":[{"__symbolic":"reference","name":"Array","arguments":[{"__symbolic":"reference","name":"any"}]}]}]}],"initStates":[{"__symbolic":"method"}]}},"ɵc":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Injectable","line":6,"character":1}}],"members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","name":"Store"}]}]},"statics":{"store":{"__symbolic":"reference","name":"undefined"}}},"ɵd":{"__symbolic":"new","expression":{"__symbolic":"reference","module":"@angular/core","name":"InjectionToken","line":3,"character":36},"arguments":["ROOT_STATE_TOKEN"]},"ɵe":{"__symbolic":"new","expression":{"__symbolic":"reference","module":"@angular/core","name":"InjectionToken","line":4,"character":39},"arguments":["FEATURE_STATE_TOKEN"]},"NgxsModule":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"NgModule","line":72,"character":1},"arguments":[{}]}],"members":{},"statics":{"forRoot":{"__symbolic":"function","parameters":["states"],"defaults":[[]],"value":{"ngModule":{"__symbolic":"reference","name":"ɵa"},"providers":[{"__symbolic":"reference","name":"ɵf"},{"__symbolic":"reference","name":"Actions"},{"__symbolic":"reference","name":"Store"},{"__symbolic":"reference","name":"StateStream"},{"__symbolic":"reference","name":"ɵc"},{"__symbolic":"reference","name":"ɵg"},{"__symbolic":"spread","expression":{"__symbolic":"reference","name":"states"}},{"provide":{"__symbolic":"reference","name":"ɵd"},"useValue":{"__symbolic":"reference","name":"states"}}]}},"forFeature":{"__symbolic":"function","parameters":["states"],"value":{"ngModule":{"__symbolic":"reference","name":"ɵb"},"providers":[{"__symbolic":"reference","name":"ɵf"},{"__symbolic":"reference","name":"ɵg"},{"__symbolic":"spread","expression":{"__symbolic":"reference","name":"states"}},{"provide":{"__symbolic":"reference","name":"ɵe"},"multi":true,"useValue":{"__symbolic":"reference","name":"states"}}]}}}},"Action":{"__symbolic":"function","parameters":["actions"],"value":{"__symbolic":"error","message":"Lambda not supported","line":6,"character":9,"module":"./src/action"}},"Store":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Injectable","line":12,"character":1}}],"members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","module":"@angular/core","name":"ErrorHandler","line":15,"character":27},{"__symbolic":"reference","name":"Actions"},{"__symbolic":"reference","name":"ɵf"},{"__symbolic":"reference","name":"ɵg"},{"__symbolic":"reference","name":"StateStream"}]}],"dispatch":[{"__symbolic":"method"}],"select":[{"__symbolic":"method"},{"__symbolic":"method"},{"__symbolic":"method"}],"selectOnce":[{"__symbolic":"method"},{"__symbolic":"method"},{"__symbolic":"method"}],"subscribe":[{"__symbolic":"method"}],"_dispatch":[{"__symbolic":"method"}],"_dispatchActions":[{"__symbolic":"method"}],"_handleNesting":[{"__symbolic":"method"}]}},"State":{"__symbolic":"function","parameters":["options"],"value":{"__symbolic":"error","message":"Lambda not supported","line":7,"character":9,"module":"./src/state"}},"Select":{"__symbolic":"function","parameters":["selectorOrFeature","paths"],"value":{"__symbolic":"error","message":"Lambda not supported","line":18,"character":9,"module":"./src/select"}},"Actions":{"__symbolic":"class","extends":{"__symbolic":"reference","module":"rxjs","name":"Subject","line":9,"character":29},"decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Injectable","line":8,"character":1}}],"members":{"__ctor__":[{"__symbolic":"constructor","parameterDecorators":[[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Optional","line":11,"character":5}},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"SkipSelf","line":12,"character":5}}]],"parameters":[{"__symbolic":"reference","name":"Actions"}]}]}},"ofAction":{"__symbolic":"function"},"NgxsPlugin":{"__symbolic":"interface"},"NgxsPluginFn":{"__symbolic":"interface"},"StateContext":{"__symbolic":"interface"},"Selector":{"__symbolic":"function","parameters":["args"],"value":{"__symbolic":"error","message":"Lambda not supported","line":8,"character":9,"module":"./src/selector"}},"getActionTypeFromInstance":{"__symbolic":"function"},"NGXS_PLUGINS":{"__symbolic":"new","expression":{"__symbolic":"reference","module":"@angular/core","name":"InjectionToken","line":44,"character":32},"arguments":["NGXS_PLUGINS"]},"StateStream":{"__symbolic":"class","extends":{"__symbolic":"reference","module":"rxjs","name":"BehaviorSubject","line":7,"character":33},"decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Injectable","line":6,"character":1}}],"members":{"__ctor__":[{"__symbolic":"constructor","parameterDecorators":[[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Optional","line":9,"character":5}},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"SkipSelf","line":10,"character":5}}]],"parameters":[{"__symbolic":"reference","name":"StateStream"}]}]}},"setValue":{"__symbolic":"error","message":"Lambda not supported","line":22,"character":24,"module":"./src/utils"},"getValue":{"__symbolic":"error","message":"Lambda not supported","line":47,"character":24,"module":"./src/utils"},"InitState":{"__symbolic":"class","members":{},"statics":{"type":"@@INIT"}},"UpdateState":{"__symbolic":"class","members":{},"statics":{"type":"@@UPDATE_STATE"}},"ɵf":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Injectable","line":19,"character":1}}],"members":{"__ctor__":[{"__symbolic":"constructor","parameterDecorators":[null,[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Optional","line":28,"character":5}},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"SkipSelf","line":29,"character":5}}]],"parameters":[{"__symbolic":"reference","module":"@angular/core","name":"Injector","line":27,"character":23},{"__symbolic":"reference","name":"ɵf"}]}],"add":[{"__symbolic":"method"}],"addAndReturnDefaults":[{"__symbolic":"method"}],"invokeActions":[{"__symbolic":"method"}]}},"ɵg":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Injectable","line":3,"character":1}}],"members":{"__ctor__":[{"__symbolic":"constructor","parameterDecorators":[[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Optional","line":8,"character":5}},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"SkipSelf","line":9,"character":5}}],[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject","line":11,"character":5},"arguments":[{"__symbolic":"reference","name":"NGXS_PLUGINS"}]},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Optional","line":12,"character":5}}]],"parameters":[{"__symbolic":"reference","name":"ɵg"},{"__symbolic":"reference","name":"Array","arguments":[{"__symbolic":"reference","name":"NgxsPlugin"}]}]}],"register":[{"__symbolic":"method"}]}}},"origins":{"ɵa":"./src/module","ɵb":"./src/module","ɵc":"./src/select","ɵd":"./src/symbols","ɵe":"./src/symbols","NgxsModule":"./src/module","Action":"./src/action","Store":"./src/store","State":"./src/state","Select":"./src/select","Actions":"./src/actions-stream","ofAction":"./src/of-action","NgxsPlugin":"./src/symbols","NgxsPluginFn":"./src/symbols","StateContext":"./src/symbols","Selector":"./src/selector","getActionTypeFromInstance":"./src/utils","NGXS_PLUGINS":"./src/symbols","StateStream":"./src/state-stream","setValue":"./src/utils","getValue":"./src/utils","InitState":"./src/actions","UpdateState":"./src/actions","ɵf":"./src/state-factory","ɵg":"./src/plugin-manager"},"importAs":"@ngxs/store"}
{
"name": "@ngxs/store",
"version": "2.0.0-build.b57cdf5",
"version": "2.0.0-dev.0a1ca42",
"license": "MIT",

@@ -5,0 +5,0 @@ "peerDependencies": {

@@ -1,15 +0,15 @@

# @ngxs/store
<p align="center">
<img src="../../docs/assets/logo.png">
<br />
NGXS is a state management pattern + library for Angular
<br />
<br />
<a href="https://gitter.im/ngxs-community/Lobby"><img src="https://badges.gitter.im/Join%20Chat.svg"></a> <a href="https://badge.fury.io/js/ngxs"><img src="https://badge.fury.io/js/ngxs.svg"></a> <a href="https://codeclimate.com/github/ngxs/store/maintainability"><img src="https://api.codeclimate.com/v1/badges/c53c013c16e87492cb1e/maintainability" /></a> <a href="https://codeclimate.com/github/ngxs/store/test_coverage"><img src="https://api.codeclimate.com/v1/badges/c53c013c16e87492cb1e/test_coverage" /></a> <a href="https://circleci.com/gh/ngxs/store"><img src="https://circleci.com/gh/ngxs/store/tree/master.svg?style=svg"></a> <a href="https://www.gitbook.io/book/ngxs/ngxs/activity"><img src="https://www.gitbook.io/button/status/book/ngxs/ngxs"></a>
</p>
---
```TS
// app.module.ts
import { NgxsModule } from '@ngxs/store';
@NgModule({
imports: [
NgxsModule.forRoot()
]
})
export class AppModule { }
```
* Learn about it on the [docs site](https://ngxs.gitbooks.io/ngxs/)
* See it in action on [Stackblitz](https://stackblitz.com/edit/ngxs-simple)
* Checkout the [sample application](https://github.com/ngxs/store/tree/master/integration)
* Learn about updates from the [changelog](CHANGELOG.md)

@@ -1,8 +0,9 @@

import { BehaviorSubject } from 'rxjs/BehaviorSubject';
import { Subject } from 'rxjs';
/**
* Action stream that is emitted anytime an action is dispatched.
*
* You can listen to this in services to react without stores.
*/
export declare class Actions extends BehaviorSubject<any> {
export declare class Actions extends Subject<any> {
constructor(parent: Actions);
}

@@ -1,3 +0,3 @@

import { OperatorFunction } from 'rxjs/interfaces';
import { OperatorFunction } from 'rxjs';
export declare function ofAction<T>(allowedType: any): OperatorFunction<any, T>;
export declare function ofAction<T>(...allowedTypes: any[]): OperatorFunction<any, T>;

@@ -5,1 +5,2 @@ export { NgxsModule } from './module';

export { getActionTypeFromInstance, setValue, getValue } from './utils';
export { InitState, UpdateState } from './actions';

@@ -1,2 +0,2 @@

import { BehaviorSubject } from 'rxjs/BehaviorSubject';
import { BehaviorSubject } from 'rxjs';
/**

@@ -3,0 +3,0 @@ * BehaviorSubject of the entire state.

import { ErrorHandler } from '@angular/core';
import { Observable } from 'rxjs/Observable';
import { Subscription } from 'rxjs/Subscription';
import { Observable, Subscription } from 'rxjs';
import { Actions } from './actions-stream';

@@ -5,0 +4,0 @@ import { StateFactory } from './state-factory';

import { InjectionToken } from '@angular/core';
import { Observable } from 'rxjs/Observable';
import { Observable } from 'rxjs';
export declare const ROOT_STATE_TOKEN: InjectionToken<any>;

@@ -4,0 +4,0 @@ export declare const FEATURE_STATE_TOKEN: InjectionToken<any>;

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc