@ngxs/store 3.7.3-dev.master-5b116c1 → 3.7.3-dev.master-cdd7ae3
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 +113 -63
- 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/ngxs-store.js +12 -13
- package/esm2015/src/execution/dispatch-outside-zone-ngxs-execution-strategy.js +4 -2
- package/esm2015/src/execution/noop-ngxs-execution-strategy.js +4 -2
- package/esm2015/src/execution/symbols.js +26 -3
- package/esm2015/src/internal/state-operations.js +18 -5
- package/esm2015/src/internal/state-stream.js +10 -1
- package/esm2015/src/module.js +4 -5
- package/esm2015/src/symbols.js +4 -1
- package/esm5/ngxs-store.js +12 -13
- package/esm5/src/execution/dispatch-outside-zone-ngxs-execution-strategy.js +4 -2
- package/esm5/src/execution/noop-ngxs-execution-strategy.js +4 -2
- package/esm5/src/execution/symbols.js +26 -3
- package/esm5/src/internal/state-operations.js +18 -5
- package/esm5/src/internal/state-stream.js +13 -1
- package/esm5/src/module.js +4 -5
- package/esm5/src/symbols.js +4 -1
- package/fesm2015/ngxs-store.js +84 -37
- package/fesm2015/ngxs-store.js.map +1 -1
- package/fesm5/ngxs-store.js +100 -50
- package/fesm5/ngxs-store.js.map +1 -1
- package/ngxs-store.d.ts +11 -12
- package/ngxs-store.metadata.json +1 -1
- package/package.json +1 -1
- package/src/execution/symbols.d.ts +5 -1
- package/src/internal/state-stream.d.ts +3 -1
- package/src/symbols.d.ts +3 -0
package/fesm5/ngxs-store.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { __assign, __spread, __extends, __values } from 'tslib';
|
|
2
|
-
import { NgZone, Injectable, Inject, PLATFORM_ID, InjectionToken, Optional, SkipSelf, ErrorHandler, Injector,
|
|
3
|
-
import { memoize, INITIAL_STATE_TOKEN, NgxsBootstrapper, NGXS_STATE_CONTEXT_FACTORY, NGXS_STATE_FACTORY, InitialState, ensureInjectorNotifierIsCaptured, localInject, ensureLocalInjectorCaptured } from '@ngxs/store/internals';
|
|
2
|
+
import { NgZone, Injectable, Inject, PLATFORM_ID, defineInjectable, inject, InjectionToken, INJECTOR, ɵglobal, Optional, SkipSelf, ErrorHandler, Injector, ɵivyEnabled, NgModule, APP_BOOTSTRAP_LISTENER } from '@angular/core';
|
|
3
|
+
import { isAngularInTestMode, memoize, INITIAL_STATE_TOKEN, NgxsBootstrapper, NGXS_STATE_CONTEXT_FACTORY, NGXS_STATE_FACTORY, InitialState, ensureInjectorNotifierIsCaptured, localInject, ensureLocalInjectorCaptured } from '@ngxs/store/internals';
|
|
4
4
|
import { isPlatformServer } from '@angular/common';
|
|
5
5
|
import { Observable, Subject, BehaviorSubject, of, forkJoin, throwError, EMPTY, from } from 'rxjs';
|
|
6
6
|
import { filter, map, shareReplay, take, exhaustMap, mergeMap, defaultIfEmpty, catchError, takeUntil, tap, distinctUntilChanged } from 'rxjs/operators';
|
|
@@ -164,13 +164,14 @@ var DispatchOutsideZoneNgxsExecutionStrategy = /** @class */ (function () {
|
|
|
164
164
|
return func();
|
|
165
165
|
};
|
|
166
166
|
DispatchOutsideZoneNgxsExecutionStrategy.decorators = [
|
|
167
|
-
{ type: Injectable }
|
|
167
|
+
{ type: Injectable, args: [{ providedIn: 'root' },] }
|
|
168
168
|
];
|
|
169
169
|
/** @nocollapse */
|
|
170
170
|
DispatchOutsideZoneNgxsExecutionStrategy.ctorParameters = function () { return [
|
|
171
171
|
{ type: NgZone },
|
|
172
172
|
{ type: String, decorators: [{ type: Inject, args: [PLATFORM_ID,] }] }
|
|
173
173
|
]; };
|
|
174
|
+
/** @nocollapse */ DispatchOutsideZoneNgxsExecutionStrategy.ngInjectableDef = defineInjectable({ factory: function DispatchOutsideZoneNgxsExecutionStrategy_Factory() { return new DispatchOutsideZoneNgxsExecutionStrategy(inject(NgZone), inject(PLATFORM_ID)); }, token: DispatchOutsideZoneNgxsExecutionStrategy, providedIn: "root" });
|
|
174
175
|
return DispatchOutsideZoneNgxsExecutionStrategy;
|
|
175
176
|
}());
|
|
176
177
|
if (false) {
|
|
@@ -254,6 +255,9 @@ if (false) {
|
|
|
254
255
|
* Run in development mode. This will add additional debugging features:
|
|
255
256
|
* - Object.freeze on the state and actions to guarantee immutability
|
|
256
257
|
* (default: false)
|
|
258
|
+
*
|
|
259
|
+
* @deprecated This property is no longer necessary when the Ivy compiler is used.
|
|
260
|
+
* We'll determine the development mode through the `ngDevMode`. It's still essential with View Engine.
|
|
257
261
|
* @type {?}
|
|
258
262
|
*/
|
|
259
263
|
NgxsConfig.prototype.developmentMode;
|
|
@@ -422,11 +426,72 @@ if (false) {
|
|
|
422
426
|
* @fileoverview added by tsickle
|
|
423
427
|
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
424
428
|
*/
|
|
429
|
+
var NoopNgxsExecutionStrategy = /** @class */ (function () {
|
|
430
|
+
function NoopNgxsExecutionStrategy() {
|
|
431
|
+
}
|
|
432
|
+
/**
|
|
433
|
+
* @template T
|
|
434
|
+
* @param {?} func
|
|
435
|
+
* @return {?}
|
|
436
|
+
*/
|
|
437
|
+
NoopNgxsExecutionStrategy.prototype.enter = /**
|
|
438
|
+
* @template T
|
|
439
|
+
* @param {?} func
|
|
440
|
+
* @return {?}
|
|
441
|
+
*/
|
|
442
|
+
function (func) {
|
|
443
|
+
return func();
|
|
444
|
+
};
|
|
445
|
+
/**
|
|
446
|
+
* @template T
|
|
447
|
+
* @param {?} func
|
|
448
|
+
* @return {?}
|
|
449
|
+
*/
|
|
450
|
+
NoopNgxsExecutionStrategy.prototype.leave = /**
|
|
451
|
+
* @template T
|
|
452
|
+
* @param {?} func
|
|
453
|
+
* @return {?}
|
|
454
|
+
*/
|
|
455
|
+
function (func) {
|
|
456
|
+
return func();
|
|
457
|
+
};
|
|
458
|
+
NoopNgxsExecutionStrategy.decorators = [
|
|
459
|
+
{ type: Injectable, args: [{ providedIn: 'root' },] }
|
|
460
|
+
];
|
|
461
|
+
/** @nocollapse */ NoopNgxsExecutionStrategy.ngInjectableDef = defineInjectable({ factory: function NoopNgxsExecutionStrategy_Factory() { return new NoopNgxsExecutionStrategy(); }, token: NoopNgxsExecutionStrategy, providedIn: "root" });
|
|
462
|
+
return NoopNgxsExecutionStrategy;
|
|
463
|
+
}());
|
|
464
|
+
|
|
465
|
+
/**
|
|
466
|
+
* @fileoverview added by tsickle
|
|
467
|
+
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
468
|
+
*/
|
|
469
|
+
/**
|
|
470
|
+
* The strategy that might be provided by users through `options.executionStrategy`.
|
|
471
|
+
* @type {?}
|
|
472
|
+
*/
|
|
473
|
+
var USER_PROVIDED_NGXS_EXECUTION_STRATEGY = new InjectionToken('USER_PROVIDED_NGXS_EXECUTION_STRATEGY');
|
|
425
474
|
/*
|
|
426
475
|
* Internal execution strategy injection token
|
|
427
476
|
*/
|
|
428
477
|
/** @type {?} */
|
|
429
|
-
var NGXS_EXECUTION_STRATEGY = new InjectionToken('NGXS_EXECUTION_STRATEGY'
|
|
478
|
+
var NGXS_EXECUTION_STRATEGY = new InjectionToken('NGXS_EXECUTION_STRATEGY', {
|
|
479
|
+
providedIn: 'root',
|
|
480
|
+
factory: (/**
|
|
481
|
+
* @return {?}
|
|
482
|
+
*/
|
|
483
|
+
function () {
|
|
484
|
+
/** @type {?} */
|
|
485
|
+
var injector = inject(INJECTOR);
|
|
486
|
+
/** @type {?} */
|
|
487
|
+
var executionStrategy = injector.get(USER_PROVIDED_NGXS_EXECUTION_STRATEGY);
|
|
488
|
+
return executionStrategy
|
|
489
|
+
? injector.get(executionStrategy)
|
|
490
|
+
: injector.get(typeof ɵglobal.Zone !== 'undefined'
|
|
491
|
+
? DispatchOutsideZoneNgxsExecutionStrategy
|
|
492
|
+
: NoopNgxsExecutionStrategy);
|
|
493
|
+
})
|
|
494
|
+
});
|
|
430
495
|
/**
|
|
431
496
|
* @record
|
|
432
497
|
*/
|
|
@@ -1638,6 +1703,18 @@ var StateStream = /** @class */ (function (_super) {
|
|
|
1638
1703
|
function StateStream() {
|
|
1639
1704
|
return _super.call(this, {}) || this;
|
|
1640
1705
|
}
|
|
1706
|
+
/**
|
|
1707
|
+
* @return {?}
|
|
1708
|
+
*/
|
|
1709
|
+
StateStream.prototype.ngOnDestroy = /**
|
|
1710
|
+
* @return {?}
|
|
1711
|
+
*/
|
|
1712
|
+
function () {
|
|
1713
|
+
// The `StateStream` should never emit values once the root view is removed, e.g. when the `NgModuleRef.destroy()` is called.
|
|
1714
|
+
// This will eliminate memory leaks in server-side rendered apps where the `StateStream` is created per each HTTP request, users
|
|
1715
|
+
// might forget to unsubscribe from `store.select` or `store.subscribe`, thus this will lead to huge memory leaks in SSR apps.
|
|
1716
|
+
this.complete();
|
|
1717
|
+
};
|
|
1641
1718
|
StateStream.decorators = [
|
|
1642
1719
|
{ type: Injectable }
|
|
1643
1720
|
];
|
|
@@ -2043,9 +2120,22 @@ var InternalStateOperations = /** @class */ (function () {
|
|
|
2043
2120
|
*/
|
|
2044
2121
|
function (actionOrActions) { return _this._dispatcher.dispatch(actionOrActions); })
|
|
2045
2122
|
};
|
|
2046
|
-
|
|
2047
|
-
|
|
2048
|
-
|
|
2123
|
+
// We have to have that duplication since this will allow us to tree-shake `ensureStateAndActionsAreImmutable`
|
|
2124
|
+
// and `deepFreeze` in Ivy production build.
|
|
2125
|
+
// The below `if` condition checks 2 things:
|
|
2126
|
+
// 1) if we're in View Engine (`ngDevMode` is `undefined`)
|
|
2127
|
+
// 2) if we're running tests, we should fallback to `config.developmentMode` to be backwards-compatible
|
|
2128
|
+
if (typeof ngDevMode === 'undefined' || (ngDevMode && isAngularInTestMode())) {
|
|
2129
|
+
return this._config.developmentMode
|
|
2130
|
+
? ensureStateAndActionsAreImmutable(rootStateOperations)
|
|
2131
|
+
: rootStateOperations;
|
|
2132
|
+
}
|
|
2133
|
+
else {
|
|
2134
|
+
// If we're in Ivy and not running tests, then tree-shake `ensureStateAndActionsAreImmutable` and `deepFreeze`.
|
|
2135
|
+
return ngDevMode
|
|
2136
|
+
? ensureStateAndActionsAreImmutable(rootStateOperations)
|
|
2137
|
+
: rootStateOperations;
|
|
2138
|
+
}
|
|
2049
2139
|
};
|
|
2050
2140
|
/**
|
|
2051
2141
|
* @param {?} results
|
|
@@ -2092,7 +2182,6 @@ if (false) {
|
|
|
2092
2182
|
*/
|
|
2093
2183
|
InternalStateOperations.prototype._config;
|
|
2094
2184
|
}
|
|
2095
|
-
// We make it as a separate function and not the class method to tree-shake it in the future.
|
|
2096
2185
|
/**
|
|
2097
2186
|
* @param {?} root
|
|
2098
2187
|
* @return {?}
|
|
@@ -3820,8 +3909,8 @@ var NgxsModule = /** @class */ (function () {
|
|
|
3820
3909
|
function (states, options) {
|
|
3821
3910
|
return [
|
|
3822
3911
|
{
|
|
3823
|
-
provide:
|
|
3824
|
-
|
|
3912
|
+
provide: USER_PROVIDED_NGXS_EXECUTION_STRATEGY,
|
|
3913
|
+
useValue: options.executionStrategy
|
|
3825
3914
|
},
|
|
3826
3915
|
{
|
|
3827
3916
|
provide: ROOT_STATE_TOKEN,
|
|
@@ -4396,45 +4485,6 @@ function Selector(selectors) {
|
|
|
4396
4485
|
});
|
|
4397
4486
|
}
|
|
4398
4487
|
|
|
4399
|
-
/**
|
|
4400
|
-
* @fileoverview added by tsickle
|
|
4401
|
-
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
4402
|
-
*/
|
|
4403
|
-
var NoopNgxsExecutionStrategy = /** @class */ (function () {
|
|
4404
|
-
function NoopNgxsExecutionStrategy() {
|
|
4405
|
-
}
|
|
4406
|
-
/**
|
|
4407
|
-
* @template T
|
|
4408
|
-
* @param {?} func
|
|
4409
|
-
* @return {?}
|
|
4410
|
-
*/
|
|
4411
|
-
NoopNgxsExecutionStrategy.prototype.enter = /**
|
|
4412
|
-
* @template T
|
|
4413
|
-
* @param {?} func
|
|
4414
|
-
* @return {?}
|
|
4415
|
-
*/
|
|
4416
|
-
function (func) {
|
|
4417
|
-
return func();
|
|
4418
|
-
};
|
|
4419
|
-
/**
|
|
4420
|
-
* @template T
|
|
4421
|
-
* @param {?} func
|
|
4422
|
-
* @return {?}
|
|
4423
|
-
*/
|
|
4424
|
-
NoopNgxsExecutionStrategy.prototype.leave = /**
|
|
4425
|
-
* @template T
|
|
4426
|
-
* @param {?} func
|
|
4427
|
-
* @return {?}
|
|
4428
|
-
*/
|
|
4429
|
-
function (func) {
|
|
4430
|
-
return func();
|
|
4431
|
-
};
|
|
4432
|
-
NoopNgxsExecutionStrategy.decorators = [
|
|
4433
|
-
{ type: Injectable }
|
|
4434
|
-
];
|
|
4435
|
-
return NoopNgxsExecutionStrategy;
|
|
4436
|
-
}());
|
|
4437
|
-
|
|
4438
4488
|
/**
|
|
4439
4489
|
* @fileoverview added by tsickle
|
|
4440
4490
|
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
@@ -4507,5 +4557,5 @@ if (false) {
|
|
|
4507
4557
|
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
4508
4558
|
*/
|
|
4509
4559
|
|
|
4510
|
-
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,
|
|
4560
|
+
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, NgxsRootModule as ɵj, StateFactory as ɵk, InternalDispatchedActionResults as ɵl, InternalDispatcher as ɵm, StateContextFactory as ɵn, InternalStateOperations as ɵo, PluginManager as ɵp, InternalNgxsExecutionStrategy as ɵq, ensureStoreMetadata as ɵs, getStoreMetadata as ɵt, ensureSelectorMetadata as ɵu, getSelectorMetadata as ɵv, LifecycleStateManager as ɵw, NgxsFeatureModule as ɵx };
|
|
4511
4561
|
//# sourceMappingURL=ngxs-store.js.map
|