@ngxs/store 3.7.6-dev.master-7c829a7 → 3.7.6-dev.master-fb318b1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bundles/ngxs-store.umd.js +237 -74
- package/bundles/ngxs-store.umd.js.map +1 -1
- package/bundles/ngxs-store.umd.min.js +1 -1
- package/bundles/ngxs-store.umd.min.js.map +1 -1
- package/esm2015/index.js +2 -2
- package/esm2015/ngxs-store.js +15 -14
- package/esm2015/src/dev-features/ngxs-development.module.js +26 -0
- package/esm2015/src/dev-features/ngxs-unhandled-actions-logger.js +71 -0
- package/esm2015/src/dev-features/symbols.js +22 -0
- package/esm2015/src/internal/state-factory.js +21 -5
- package/esm2015/src/public_api.js +3 -1
- package/esm5/index.js +2 -2
- package/esm5/ngxs-store.js +15 -14
- package/esm5/src/dev-features/ngxs-development.module.js +34 -0
- package/esm5/src/dev-features/ngxs-unhandled-actions-logger.js +100 -0
- package/esm5/src/dev-features/symbols.js +22 -0
- package/esm5/src/internal/state-factory.js +21 -5
- package/esm5/src/public_api.js +3 -1
- package/fesm2015/ngxs-store.js +170 -44
- package/fesm2015/ngxs-store.js.map +1 -1
- package/fesm5/ngxs-store.js +219 -59
- package/fesm5/ngxs-store.js.map +1 -1
- package/ngxs-store.d.ts +14 -13
- package/ngxs-store.metadata.json +1 -1
- package/package.json +1 -1
- package/src/dev-features/ngxs-development.module.d.ts +5 -0
- package/src/dev-features/ngxs-unhandled-actions-logger.d.ts +14 -0
- package/src/dev-features/symbols.d.ts +8 -0
- package/src/public_api.d.ts +3 -0
package/fesm5/ngxs-store.js
CHANGED
|
@@ -2563,6 +2563,175 @@ function ensureStateClassIsInjectable(stateClass) {
|
|
|
2563
2563
|
}
|
|
2564
2564
|
}
|
|
2565
2565
|
|
|
2566
|
+
/**
|
|
2567
|
+
* @fileoverview added by tsickle
|
|
2568
|
+
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
2569
|
+
*/
|
|
2570
|
+
/**
|
|
2571
|
+
* Init action
|
|
2572
|
+
*/
|
|
2573
|
+
var /**
|
|
2574
|
+
* Init action
|
|
2575
|
+
*/
|
|
2576
|
+
InitState = /** @class */ (function () {
|
|
2577
|
+
function InitState() {
|
|
2578
|
+
}
|
|
2579
|
+
Object.defineProperty(InitState, "type", {
|
|
2580
|
+
get: /**
|
|
2581
|
+
* @return {?}
|
|
2582
|
+
*/
|
|
2583
|
+
function () {
|
|
2584
|
+
// NOTE: Not necessary to declare the type in this way in your code. See https://github.com/ngxs/store/pull/644#issuecomment-436003138
|
|
2585
|
+
return '@@INIT';
|
|
2586
|
+
},
|
|
2587
|
+
enumerable: true,
|
|
2588
|
+
configurable: true
|
|
2589
|
+
});
|
|
2590
|
+
return InitState;
|
|
2591
|
+
}());
|
|
2592
|
+
/**
|
|
2593
|
+
* Update action
|
|
2594
|
+
*/
|
|
2595
|
+
var /**
|
|
2596
|
+
* Update action
|
|
2597
|
+
*/
|
|
2598
|
+
UpdateState = /** @class */ (function () {
|
|
2599
|
+
function UpdateState(addedStates) {
|
|
2600
|
+
this.addedStates = addedStates;
|
|
2601
|
+
}
|
|
2602
|
+
Object.defineProperty(UpdateState, "type", {
|
|
2603
|
+
get: /**
|
|
2604
|
+
* @return {?}
|
|
2605
|
+
*/
|
|
2606
|
+
function () {
|
|
2607
|
+
// NOTE: Not necessary to declare the type in this way in your code. See https://github.com/ngxs/store/pull/644#issuecomment-436003138
|
|
2608
|
+
return '@@UPDATE_STATE';
|
|
2609
|
+
},
|
|
2610
|
+
enumerable: true,
|
|
2611
|
+
configurable: true
|
|
2612
|
+
});
|
|
2613
|
+
return UpdateState;
|
|
2614
|
+
}());
|
|
2615
|
+
if (false) {
|
|
2616
|
+
/** @type {?} */
|
|
2617
|
+
UpdateState.prototype.addedStates;
|
|
2618
|
+
}
|
|
2619
|
+
|
|
2620
|
+
/**
|
|
2621
|
+
* @fileoverview added by tsickle
|
|
2622
|
+
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
2623
|
+
*/
|
|
2624
|
+
/**
|
|
2625
|
+
* @record
|
|
2626
|
+
*/
|
|
2627
|
+
function NgxsDevelopmentOptions() { }
|
|
2628
|
+
if (false) {
|
|
2629
|
+
/** @type {?} */
|
|
2630
|
+
NgxsDevelopmentOptions.prototype.warnOnUnhandledActions;
|
|
2631
|
+
}
|
|
2632
|
+
/** @type {?} */
|
|
2633
|
+
var NGXS_DEVELOPMENT_OPTIONS = new InjectionToken('NGXS_DEVELOPMENT_OPTIONS', {
|
|
2634
|
+
providedIn: 'root',
|
|
2635
|
+
factory: (/**
|
|
2636
|
+
* @return {?}
|
|
2637
|
+
*/
|
|
2638
|
+
function () { return ({ warnOnUnhandledActions: true }); })
|
|
2639
|
+
});
|
|
2640
|
+
|
|
2641
|
+
/**
|
|
2642
|
+
* @fileoverview added by tsickle
|
|
2643
|
+
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
2644
|
+
*/
|
|
2645
|
+
var NgxsUnhandledActionsLogger = /** @class */ (function () {
|
|
2646
|
+
function NgxsUnhandledActionsLogger(options) {
|
|
2647
|
+
/**
|
|
2648
|
+
* These actions should be ignored by default; the user can increase this
|
|
2649
|
+
* list in the future via the `ignoreActions` method.
|
|
2650
|
+
*/
|
|
2651
|
+
this._ignoredActions = new Set([InitState.type, UpdateState.type]);
|
|
2652
|
+
if (typeof options.warnOnUnhandledActions === 'object') {
|
|
2653
|
+
this.ignoreActions.apply(this, __spread(options.warnOnUnhandledActions.ignore));
|
|
2654
|
+
}
|
|
2655
|
+
}
|
|
2656
|
+
/**
|
|
2657
|
+
* Adds actions to the internal list of actions that should be ignored.
|
|
2658
|
+
*/
|
|
2659
|
+
/**
|
|
2660
|
+
* Adds actions to the internal list of actions that should be ignored.
|
|
2661
|
+
* @param {...?} actions
|
|
2662
|
+
* @return {?}
|
|
2663
|
+
*/
|
|
2664
|
+
NgxsUnhandledActionsLogger.prototype.ignoreActions = /**
|
|
2665
|
+
* Adds actions to the internal list of actions that should be ignored.
|
|
2666
|
+
* @param {...?} actions
|
|
2667
|
+
* @return {?}
|
|
2668
|
+
*/
|
|
2669
|
+
function () {
|
|
2670
|
+
var actions = [];
|
|
2671
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
2672
|
+
actions[_i] = arguments[_i];
|
|
2673
|
+
}
|
|
2674
|
+
var e_1, _a;
|
|
2675
|
+
try {
|
|
2676
|
+
for (var actions_1 = __values(actions), actions_1_1 = actions_1.next(); !actions_1_1.done; actions_1_1 = actions_1.next()) {
|
|
2677
|
+
var action = actions_1_1.value;
|
|
2678
|
+
this._ignoredActions.add(action.type);
|
|
2679
|
+
}
|
|
2680
|
+
}
|
|
2681
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
2682
|
+
finally {
|
|
2683
|
+
try {
|
|
2684
|
+
if (actions_1_1 && !actions_1_1.done && (_a = actions_1.return)) _a.call(actions_1);
|
|
2685
|
+
}
|
|
2686
|
+
finally { if (e_1) throw e_1.error; }
|
|
2687
|
+
}
|
|
2688
|
+
};
|
|
2689
|
+
/** @internal */
|
|
2690
|
+
/**
|
|
2691
|
+
* \@internal
|
|
2692
|
+
* @param {?} action
|
|
2693
|
+
* @return {?}
|
|
2694
|
+
*/
|
|
2695
|
+
NgxsUnhandledActionsLogger.prototype.warn = /**
|
|
2696
|
+
* \@internal
|
|
2697
|
+
* @param {?} action
|
|
2698
|
+
* @return {?}
|
|
2699
|
+
*/
|
|
2700
|
+
function (action) {
|
|
2701
|
+
/** @type {?} */
|
|
2702
|
+
var actionShouldBeIgnored = Array.from(this._ignoredActions).some((/**
|
|
2703
|
+
* @param {?} type
|
|
2704
|
+
* @return {?}
|
|
2705
|
+
*/
|
|
2706
|
+
function (type) { return type === getActionTypeFromInstance(action); }));
|
|
2707
|
+
if (actionShouldBeIgnored) {
|
|
2708
|
+
return;
|
|
2709
|
+
}
|
|
2710
|
+
action =
|
|
2711
|
+
action.constructor && action.constructor.name !== 'Object'
|
|
2712
|
+
? action.constructor.name
|
|
2713
|
+
: action.type;
|
|
2714
|
+
console.warn("The " + action + " action has been dispatched but hasn't been handled. This may happen if the state with an action handler for this action is not registered.");
|
|
2715
|
+
};
|
|
2716
|
+
NgxsUnhandledActionsLogger.decorators = [
|
|
2717
|
+
{ type: Injectable }
|
|
2718
|
+
];
|
|
2719
|
+
/** @nocollapse */
|
|
2720
|
+
NgxsUnhandledActionsLogger.ctorParameters = function () { return [
|
|
2721
|
+
{ type: undefined, decorators: [{ type: Inject, args: [NGXS_DEVELOPMENT_OPTIONS,] }] }
|
|
2722
|
+
]; };
|
|
2723
|
+
return NgxsUnhandledActionsLogger;
|
|
2724
|
+
}());
|
|
2725
|
+
if (false) {
|
|
2726
|
+
/**
|
|
2727
|
+
* These actions should be ignored by default; the user can increase this
|
|
2728
|
+
* list in the future via the `ignoreActions` method.
|
|
2729
|
+
* @type {?}
|
|
2730
|
+
* @private
|
|
2731
|
+
*/
|
|
2732
|
+
NgxsUnhandledActionsLogger.prototype._ignoredActions;
|
|
2733
|
+
}
|
|
2734
|
+
|
|
2566
2735
|
/**
|
|
2567
2736
|
* @fileoverview added by tsickle
|
|
2568
2737
|
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
@@ -2708,10 +2877,8 @@ var StateFactory = /** @class */ (function () {
|
|
|
2708
2877
|
* @return {?}
|
|
2709
2878
|
*/
|
|
2710
2879
|
function () {
|
|
2711
|
-
//
|
|
2712
|
-
//
|
|
2713
|
-
// on the `StateFactory` until its initialized :) An it's initialized
|
|
2714
|
-
// for the first time along with the `NgxsRootModule`.
|
|
2880
|
+
// This is being non-null asserted since `_actionsSubscrition` is
|
|
2881
|
+
// initialized within the constructor.
|
|
2715
2882
|
(/** @type {?} */ (this._actionsSubscription)).unsubscribe();
|
|
2716
2883
|
};
|
|
2717
2884
|
/**
|
|
@@ -2888,6 +3055,10 @@ var StateFactory = /** @class */ (function () {
|
|
|
2888
3055
|
var type = (/** @type {?} */ (getActionTypeFromInstance(action)));
|
|
2889
3056
|
/** @type {?} */
|
|
2890
3057
|
var results = [];
|
|
3058
|
+
// Determines whether the dispatched action has been handled, this is assigned
|
|
3059
|
+
// to `true` within the below `for` loop if any `actionMetas` has been found.
|
|
3060
|
+
/** @type {?} */
|
|
3061
|
+
var actionHasBeenHandled = false;
|
|
2891
3062
|
try {
|
|
2892
3063
|
for (var _c = __values(this.states), _d = _c.next(); !_d.done; _d = _c.next()) {
|
|
2893
3064
|
var metadata = _d.value;
|
|
@@ -2940,6 +3111,7 @@ var StateFactory = /** @class */ (function () {
|
|
|
2940
3111
|
catch (e) {
|
|
2941
3112
|
results.push(throwError(e));
|
|
2942
3113
|
}
|
|
3114
|
+
actionHasBeenHandled = true;
|
|
2943
3115
|
}
|
|
2944
3116
|
}
|
|
2945
3117
|
catch (e_3_1) { e_3 = { error: e_3_1 }; }
|
|
@@ -2959,6 +3131,18 @@ var StateFactory = /** @class */ (function () {
|
|
|
2959
3131
|
}
|
|
2960
3132
|
finally { if (e_2) throw e_2.error; }
|
|
2961
3133
|
}
|
|
3134
|
+
// The `NgxsUnhandledActionsLogger` is a tree-shakable class which functions
|
|
3135
|
+
// only during development.
|
|
3136
|
+
if ((typeof ngDevMode === 'undefined' || ngDevMode) && !actionHasBeenHandled) {
|
|
3137
|
+
/** @type {?} */
|
|
3138
|
+
var unhandledActionsLogger = this._injector.get(NgxsUnhandledActionsLogger, null);
|
|
3139
|
+
// The `NgxsUnhandledActionsLogger` will not be resolved by the injector if the
|
|
3140
|
+
// `NgxsDevelopmentModule` is not provided. It's enough to check whether the `injector.get`
|
|
3141
|
+
// didn't return `null` so we may ensure the module has been imported.
|
|
3142
|
+
if (unhandledActionsLogger) {
|
|
3143
|
+
unhandledActionsLogger.warn(action);
|
|
3144
|
+
}
|
|
3145
|
+
}
|
|
2962
3146
|
if (!results.length) {
|
|
2963
3147
|
results.push(of({}));
|
|
2964
3148
|
}
|
|
@@ -3839,60 +4023,6 @@ if (false) {
|
|
|
3839
4023
|
SelectFactory.config;
|
|
3840
4024
|
}
|
|
3841
4025
|
|
|
3842
|
-
/**
|
|
3843
|
-
* @fileoverview added by tsickle
|
|
3844
|
-
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
3845
|
-
*/
|
|
3846
|
-
/**
|
|
3847
|
-
* Init action
|
|
3848
|
-
*/
|
|
3849
|
-
var /**
|
|
3850
|
-
* Init action
|
|
3851
|
-
*/
|
|
3852
|
-
InitState = /** @class */ (function () {
|
|
3853
|
-
function InitState() {
|
|
3854
|
-
}
|
|
3855
|
-
Object.defineProperty(InitState, "type", {
|
|
3856
|
-
get: /**
|
|
3857
|
-
* @return {?}
|
|
3858
|
-
*/
|
|
3859
|
-
function () {
|
|
3860
|
-
// NOTE: Not necessary to declare the type in this way in your code. See https://github.com/ngxs/store/pull/644#issuecomment-436003138
|
|
3861
|
-
return '@@INIT';
|
|
3862
|
-
},
|
|
3863
|
-
enumerable: true,
|
|
3864
|
-
configurable: true
|
|
3865
|
-
});
|
|
3866
|
-
return InitState;
|
|
3867
|
-
}());
|
|
3868
|
-
/**
|
|
3869
|
-
* Update action
|
|
3870
|
-
*/
|
|
3871
|
-
var /**
|
|
3872
|
-
* Update action
|
|
3873
|
-
*/
|
|
3874
|
-
UpdateState = /** @class */ (function () {
|
|
3875
|
-
function UpdateState(addedStates) {
|
|
3876
|
-
this.addedStates = addedStates;
|
|
3877
|
-
}
|
|
3878
|
-
Object.defineProperty(UpdateState, "type", {
|
|
3879
|
-
get: /**
|
|
3880
|
-
* @return {?}
|
|
3881
|
-
*/
|
|
3882
|
-
function () {
|
|
3883
|
-
// NOTE: Not necessary to declare the type in this way in your code. See https://github.com/ngxs/store/pull/644#issuecomment-436003138
|
|
3884
|
-
return '@@UPDATE_STATE';
|
|
3885
|
-
},
|
|
3886
|
-
enumerable: true,
|
|
3887
|
-
configurable: true
|
|
3888
|
-
});
|
|
3889
|
-
return UpdateState;
|
|
3890
|
-
}());
|
|
3891
|
-
if (false) {
|
|
3892
|
-
/** @type {?} */
|
|
3893
|
-
UpdateState.prototype.addedStates;
|
|
3894
|
-
}
|
|
3895
|
-
|
|
3896
4026
|
/**
|
|
3897
4027
|
* @fileoverview added by tsickle
|
|
3898
4028
|
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
@@ -4599,6 +4729,36 @@ if (false) {
|
|
|
4599
4729
|
StateToken.prototype.name;
|
|
4600
4730
|
}
|
|
4601
4731
|
|
|
4732
|
+
/**
|
|
4733
|
+
* @fileoverview added by tsickle
|
|
4734
|
+
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
4735
|
+
*/
|
|
4736
|
+
var NgxsDevelopmentModule = /** @class */ (function () {
|
|
4737
|
+
function NgxsDevelopmentModule() {
|
|
4738
|
+
}
|
|
4739
|
+
/**
|
|
4740
|
+
* @param {?} options
|
|
4741
|
+
* @return {?}
|
|
4742
|
+
*/
|
|
4743
|
+
NgxsDevelopmentModule.forRoot = /**
|
|
4744
|
+
* @param {?} options
|
|
4745
|
+
* @return {?}
|
|
4746
|
+
*/
|
|
4747
|
+
function (options) {
|
|
4748
|
+
return {
|
|
4749
|
+
ngModule: NgxsDevelopmentModule,
|
|
4750
|
+
providers: [
|
|
4751
|
+
NgxsUnhandledActionsLogger,
|
|
4752
|
+
{ provide: NGXS_DEVELOPMENT_OPTIONS, useValue: options }
|
|
4753
|
+
]
|
|
4754
|
+
};
|
|
4755
|
+
};
|
|
4756
|
+
NgxsDevelopmentModule.decorators = [
|
|
4757
|
+
{ type: NgModule }
|
|
4758
|
+
];
|
|
4759
|
+
return NgxsDevelopmentModule;
|
|
4760
|
+
}());
|
|
4761
|
+
|
|
4602
4762
|
/**
|
|
4603
4763
|
* @fileoverview added by tsickle
|
|
4604
4764
|
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
@@ -4619,5 +4779,5 @@ if (false) {
|
|
|
4619
4779
|
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
4620
4780
|
*/
|
|
4621
4781
|
|
|
4622
|
-
export { Action, Actions, InitState, NGXS_PLUGINS, NgxsModule, NgxsSimpleChange, NoopNgxsExecutionStrategy, Select, Selector, SelectorOptions, State, StateStream, StateToken, Store, UpdateState, actionMatcher, createSelector, ensureSelectorMetadata$1 as ensureSelectorMetadata, ensureStoreMetadata$1 as ensureStoreMetadata, getActionTypeFromInstance, getSelectorMetadata$1 as getSelectorMetadata, getStoreMetadata$1 as getStoreMetadata, getValue, ofAction, ofActionCanceled, ofActionCompleted, ofActionDispatched, ofActionErrored, ofActionSuccessful, setValue, OrderedSubject as ɵa, InternalActions as ɵb, ROOT_STATE_TOKEN as ɵc, FEATURE_STATE_TOKEN as ɵd, SELECTOR_META_KEY as ɵe, NgxsConfig as ɵf, mergeDeep as ɵg, USER_PROVIDED_NGXS_EXECUTION_STRATEGY as ɵh, NGXS_EXECUTION_STRATEGY as ɵi,
|
|
4782
|
+
export { Action, Actions, InitState, NGXS_PLUGINS, NgxsDevelopmentModule, NgxsModule, NgxsSimpleChange, NgxsUnhandledActionsLogger, NoopNgxsExecutionStrategy, Select, Selector, SelectorOptions, State, StateStream, StateToken, Store, UpdateState, actionMatcher, createSelector, ensureSelectorMetadata$1 as ensureSelectorMetadata, ensureStoreMetadata$1 as ensureStoreMetadata, getActionTypeFromInstance, getSelectorMetadata$1 as getSelectorMetadata, getStoreMetadata$1 as getStoreMetadata, getValue, ofAction, ofActionCanceled, ofActionCompleted, ofActionDispatched, ofActionErrored, ofActionSuccessful, setValue, OrderedSubject as ɵa, InternalActions as ɵb, NgxsFeatureModule as ɵba, ROOT_STATE_TOKEN as ɵc, FEATURE_STATE_TOKEN as ɵd, SELECTOR_META_KEY as ɵe, NgxsConfig as ɵf, mergeDeep as ɵg, USER_PROVIDED_NGXS_EXECUTION_STRATEGY as ɵh, NGXS_EXECUTION_STRATEGY as ɵi, NGXS_DEVELOPMENT_OPTIONS as ɵj, NgxsRootModule as ɵk, StateFactory as ɵl, InternalDispatchedActionResults as ɵm, InternalDispatcher as ɵn, StateContextFactory as ɵo, InternalStateOperations as ɵp, PluginManager as ɵq, InternalNgxsExecutionStrategy as ɵr, InternalErrorReporter as ɵs, SelectFactory as ɵt, ensureStoreMetadata as ɵv, getStoreMetadata as ɵw, ensureSelectorMetadata as ɵx, getSelectorMetadata as ɵy, LifecycleStateManager as ɵz };
|
|
4623
4783
|
//# sourceMappingURL=ngxs-store.js.map
|