@ngxs/store 3.7.3-dev.master-8ecbd7f → 3.7.3-dev.master-5abb12a

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.
@@ -2,45 +2,19 @@
2
2
  * @fileoverview added by tsickle
3
3
  * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
4
4
  */
5
- import { getPlatform, COMPILER_OPTIONS } from '@angular/core';
6
- import { memoize } from './memoize';
7
5
  /**
8
6
  * @return {?}
9
7
  */
10
- function _isAngularInTestMode() {
11
- /** @type {?} */
12
- const platformRef = getPlatform();
13
- if (!platformRef)
14
- return false;
15
- /** @type {?} */
16
- const compilerOptions = platformRef.injector.get(COMPILER_OPTIONS, null);
17
- if (!compilerOptions)
18
- return false;
19
- /** @type {?} */
20
- const isInTestMode = compilerOptions.some((/**
21
- * @param {?} item
22
- * @return {?}
23
- */
24
- (item) => {
25
- /** @type {?} */
26
- const providers = (item && item.providers) || [];
27
- return providers.some((/**
28
- * @param {?} provider
29
- * @return {?}
30
- */
31
- (provider) => {
32
- return ((provider && provider.provide && provider.provide.name === 'MockNgModuleResolver') ||
33
- false);
34
- }));
35
- }));
36
- return isInTestMode;
8
+ export function isAngularInTestMode() {
9
+ // This is safe to check for these properties in the following way since `typeof` does not
10
+ // throw an exception if the value does not exist in the scope.
11
+ // We should not try to read these values from the global scope (e.g. `ɵglobal` from the `@angular/core`).
12
+ // This is related to how these frameworks compile and execute modules. E.g. Jest wraps the module into
13
+ // its internal code where `jest` variable exists in the scope. It cannot be read from the global scope, e.g.
14
+ // this will return undefined `global.jest`, but `jest` will not equal undefined.
15
+ return (typeof __karma__ !== 'undefined' ||
16
+ typeof jasmine !== 'undefined' ||
17
+ typeof jest !== 'undefined' ||
18
+ typeof Mocha !== 'undefined');
37
19
  }
38
- /** @type {?} */
39
- export const isAngularInTestMode =
40
- // Caretaker note: we have still left the `typeof` condition in order to avoid
41
- // creating a breaking change for projects that still use the View Engine.
42
- typeof ngDevMode === 'undefined' || ngDevMode ? memoize(_isAngularInTestMode) : (/**
43
- * @return {?}
44
- */
45
- () => false);
46
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYW5ndWxhci5qcyIsInNvdXJjZVJvb3QiOiJuZzovL0BuZ3hzL3N0b3JlL2ludGVybmFscy8iLCJzb3VyY2VzIjpbImFuZ3VsYXIudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7OztBQUFBLE9BQU8sRUFBRSxXQUFXLEVBQUUsZ0JBQWdCLEVBQWdDLE1BQU0sZUFBZSxDQUFDO0FBQzVGLE9BQU8sRUFBRSxPQUFPLEVBQUUsTUFBTSxXQUFXLENBQUM7Ozs7QUFRcEMsU0FBUyxvQkFBb0I7O1VBQ3JCLFdBQVcsR0FBdUIsV0FBVyxFQUFFO0lBQ3JELElBQUksQ0FBQyxXQUFXO1FBQUUsT0FBTyxLQUFLLENBQUM7O1VBQ3pCLGVBQWUsR0FBRyxXQUFXLENBQUMsUUFBUSxDQUFDLEdBQUcsQ0FBQyxnQkFBZ0IsRUFBRSxJQUFJLENBQUM7SUFDeEUsSUFBSSxDQUFDLGVBQWU7UUFBRSxPQUFPLEtBQUssQ0FBQzs7VUFDN0IsWUFBWSxHQUFHLGVBQWUsQ0FBQyxJQUFJOzs7O0lBQUMsQ0FBQyxJQUFxQixFQUFFLEVBQUU7O2NBQzVELFNBQVMsR0FBRyxDQUFDLElBQUksSUFBSSxJQUFJLENBQUMsU0FBUyxDQUFDLElBQUksRUFBRTtRQUNoRCxPQUFPLFNBQVMsQ0FBQyxJQUFJOzs7O1FBQUMsQ0FBQyxRQUFhLEVBQUUsRUFBRTtZQUN0QyxPQUFPLENBQ0wsQ0FBQyxRQUFRLElBQUksUUFBUSxDQUFDLE9BQU8sSUFBSSxRQUFRLENBQUMsT0FBTyxDQUFDLElBQUksS0FBSyxzQkFBc0IsQ0FBQztnQkF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JhbWV3b3JrcyBjb21waWxlIGFuZCBleGVjdXRlIG1vZHVsZXMuIEUuZy4gSmVzdCB3cmFwcyB0aGUgbW9kdWxlIGludG9cbiAgLy8gaXRzIGludGVybmFsIGNvZGUgd2hlcmUgYGplc3RgIHZhcmlhYmxlIGV4aXN0cyBpbiB0aGUgc2NvcGUuIEl0IGNhbm5vdCBiZSByZWFkIGZyb20gdGhlIGdsb2JhbCBzY29wZSwgZS5nLlxuICAvLyB0aGlzIHdpbGwgcmV0dXJuIHVuZGVmaW5lZCBgZ2xvYmFsLmplc3RgLCBidXQgYGplc3RgIHdpbGwgbm90IGVxdWFsIHVuZGVmaW5lZC5cbiAgcmV0dXJuIChcbiAgICB0eXBlb2YgX19rYXJtYV9fICE9PSAndW5kZWZpbmVkJyB8fFxuICAgIHR5cGVvZiBqYXNtaW5lICE9PSAndW5kZWZpbmVkJyB8fFxuICAgIHR5cGVvZiBqZXN0ICE9PSAndW5kZWZpbmVkJyB8fFxuICAgIHR5cGVvZiBNb2NoYSAhPT0gJ3VuZGVmaW5lZCdcbiAgKTtcbn1cbiJdfQ==
@@ -12,10 +12,19 @@ export class StateStream extends BehaviorSubject {
12
12
  constructor() {
13
13
  super({});
14
14
  }
15
+ /**
16
+ * @return {?}
17
+ */
18
+ ngOnDestroy() {
19
+ // The `StateStream` should never emit values once the root view is removed, e.g. when the `NgModuleRef.destroy()` is called.
20
+ // This will eliminate memory leaks in server-side rendered apps where the `StateStream` is created per each HTTP request, users
21
+ // might forget to unsubscribe from `store.select` or `store.subscribe`, thus this will lead to huge memory leaks in SSR apps.
22
+ this.complete();
23
+ }
15
24
  }
16
25
  StateStream.decorators = [
17
26
  { type: Injectable }
18
27
  ];
19
28
  /** @nocollapse */
20
29
  StateStream.ctorParameters = () => [];
21
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic3RhdGUtc3RyZWFtLmpzIiwic291cmNlUm9vdCI6Im5nOi8vQG5neHMvc3RvcmU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lIG1lbW9yeSBsZWFrcyBpbiBzZXJ2ZXItc2lkZSByZW5kZXJlZCBhcHBzIHdoZXJlIHRoZSBgU3RhdGVTdHJlYW1gIGlzIGNyZWF0ZWQgcGVyIGVhY2ggSFRUUCByZXF1ZXN0LCB1c2Vyc1xuICAgIC8vIG1pZ2h0IGZvcmdldCB0byB1bnN1YnNjcmliZSBmcm9tIGBzdG9yZS5zZWxlY3RgIG9yIGBzdG9yZS5zdWJzY3JpYmVgLCB0aHVzIHRoaXMgd2lsbCBsZWFkIHRvIGh1Z2UgbWVtb3J5IGxlYWtzIGluIFNTUiBhcHBzLlxuICAgIHRoaXMuY29tcGxldGUoKTtcbiAgfVxufVxuIl19
@@ -2,45 +2,19 @@
2
2
  * @fileoverview added by tsickle
3
3
  * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
4
4
  */
5
- import { getPlatform, COMPILER_OPTIONS } from '@angular/core';
6
- import { memoize } from './memoize';
7
5
  /**
8
6
  * @return {?}
9
7
  */
10
- function _isAngularInTestMode() {
11
- /** @type {?} */
12
- var platformRef = getPlatform();
13
- if (!platformRef)
14
- return false;
15
- /** @type {?} */
16
- var compilerOptions = platformRef.injector.get(COMPILER_OPTIONS, null);
17
- if (!compilerOptions)
18
- return false;
19
- /** @type {?} */
20
- var isInTestMode = compilerOptions.some((/**
21
- * @param {?} item
22
- * @return {?}
23
- */
24
- function (item) {
25
- /** @type {?} */
26
- var providers = (item && item.providers) || [];
27
- return providers.some((/**
28
- * @param {?} provider
29
- * @return {?}
30
- */
31
- function (provider) {
32
- return ((provider && provider.provide && provider.provide.name === 'MockNgModuleResolver') ||
33
- false);
34
- }));
35
- }));
36
- return isInTestMode;
8
+ export function isAngularInTestMode() {
9
+ // This is safe to check for these properties in the following way since `typeof` does not
10
+ // throw an exception if the value does not exist in the scope.
11
+ // We should not try to read these values from the global scope (e.g. `ɵglobal` from the `@angular/core`).
12
+ // This is related to how these frameworks compile and execute modules. E.g. Jest wraps the module into
13
+ // its internal code where `jest` variable exists in the scope. It cannot be read from the global scope, e.g.
14
+ // this will return undefined `global.jest`, but `jest` will not equal undefined.
15
+ return (typeof __karma__ !== 'undefined' ||
16
+ typeof jasmine !== 'undefined' ||
17
+ typeof jest !== 'undefined' ||
18
+ typeof Mocha !== 'undefined');
37
19
  }
38
- /** @type {?} */
39
- export var isAngularInTestMode =
40
- // Caretaker note: we have still left the `typeof` condition in order to avoid
41
- // creating a breaking change for projects that still use the View Engine.
42
- typeof ngDevMode === 'undefined' || ngDevMode ? memoize(_isAngularInTestMode) : (/**
43
- * @return {?}
44
- */
45
- function () { return false; });
46
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYW5ndWxhci5qcyIsInNvdXJjZVJvb3QiOiJuZzovL0BuZ3hzL3N0b3JlL2ludGVybmFscy8iLCJzb3VyY2VzIjpbImFuZ3VsYXIudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7OztBQUFBLE9BQU8sRUFBRSxXQUFXLEVBQUUsZ0JBQWdCLEVBQWdDLE1BQU0sZUFBZSxDQUFDO0FBQzVGLE9BQU8sRUFBRSxPQUFPLEVBQUUsTUFBTSxXQUFXLENBQUM7Ozs7QUFRcEMsU0FBUyxvQkFBb0I7O1FBQ3JCLFdBQVcsR0FBdUIsV0FBVyxFQUFFO0lBQ3JELElBQUksQ0FBQyxXQUFXO1FBQUUsT0FBTyxLQUFLLENBQUM7O1FBQ3pCLGVBQWUsR0FBRyxXQUFXLENBQUMsUUFBUSxDQUFDLEdBQUcsQ0FBQyxnQkFBZ0IsRUFBRSxJQUFJLENBQUM7SUFDeEUsSUFBSSxDQUFDLGVBQWU7UUFBRSxPQUFPLEtBQUssQ0FBQzs7UUFDN0IsWUFBWSxHQUFHLGVBQWUsQ0FBQyxJQUFJOzs7O0lBQUMsVUFBQyxJQUFxQjs7WUFDeEQsU0FBUyxHQUFHLENBQUMsSUFBSSxJQUF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b2VzIG5vdCBleGlzdCBpbiB0aGUgc2NvcGUuXG4gIC8vIFdlIHNob3VsZCBub3QgdHJ5IHRvIHJlYWQgdGhlc2UgdmFsdWVzIGZyb20gdGhlIGdsb2JhbCBzY29wZSAoZS5nLiBgybVnbG9iYWxgIGZyb20gdGhlIGBAYW5ndWxhci9jb3JlYCkuXG4gIC8vIFRoaXMgaXMgcmVsYXRlZCB0byBob3cgdGhlc2UgZnJhbWV3b3JrcyBjb21waWxlIGFuZCBleGVjdXRlIG1vZHVsZXMuIEUuZy4gSmVzdCB3cmFwcyB0aGUgbW9kdWxlIGludG9cbiAgLy8gaXRzIGludGVybmFsIGNvZGUgd2hlcmUgYGplc3RgIHZhcmlhYmxlIGV4aXN0cyBpbiB0aGUgc2NvcGUuIEl0IGNhbm5vdCBiZSByZWFkIGZyb20gdGhlIGdsb2JhbCBzY29wZSwgZS5nLlxuICAvLyB0aGlzIHdpbGwgcmV0dXJuIHVuZGVmaW5lZCBgZ2xvYmFsLmplc3RgLCBidXQgYGplc3RgIHdpbGwgbm90IGVxdWFsIHVuZGVmaW5lZC5cbiAgcmV0dXJuIChcbiAgICB0eXBlb2YgX19rYXJtYV9fICE9PSAndW5kZWZpbmVkJyB8fFxuICAgIHR5cGVvZiBqYXNtaW5lICE9PSAndW5kZWZpbmVkJyB8fFxuICAgIHR5cGVvZiBqZXN0ICE9PSAndW5kZWZpbmVkJyB8fFxuICAgIHR5cGVvZiBNb2NoYSAhPT0gJ3VuZGVmaW5lZCdcbiAgKTtcbn1cbiJdfQ==
@@ -14,6 +14,18 @@ var StateStream = /** @class */ (function (_super) {
14
14
  function StateStream() {
15
15
  return _super.call(this, {}) || this;
16
16
  }
17
+ /**
18
+ * @return {?}
19
+ */
20
+ StateStream.prototype.ngOnDestroy = /**
21
+ * @return {?}
22
+ */
23
+ function () {
24
+ // The `StateStream` should never emit values once the root view is removed, e.g. when the `NgModuleRef.destroy()` is called.
25
+ // This will eliminate memory leaks in server-side rendered apps where the `StateStream` is created per each HTTP request, users
26
+ // might forget to unsubscribe from `store.select` or `store.subscribe`, thus this will lead to huge memory leaks in SSR apps.
27
+ this.complete();
28
+ };
17
29
  StateStream.decorators = [
18
30
  { type: Injectable }
19
31
  ];
@@ -22,4 +34,4 @@ var StateStream = /** @class */ (function (_super) {
22
34
  return StateStream;
23
35
  }(BehaviorSubject));
24
36
  export { StateStream };
25
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic3RhdGUtc3RyZWFtLmpzIiwic291cmNlUm9vdCI6Im5nOi8vQG5neHMvc3RvcmUvIiwic291cmNlcyI6WyJzcmMvaW50ZXJuYWwvc3RhdGUtc3RyZWFtLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7O0FBQUEsT0FBTyxFQUFFLFVBQVUsRUFBRSxNQUFNLGVBQWUsQ0FBQztBQUMzQyxPQUFPLEVBQUUsZUFBZSxFQUFFLE1BQU0sTUFBTSxDQUFDOzs7OztBQVF2QztJQUNpQyx1Q0FBNEI7SUFDM0Q7ZUFDRSxrQkFBTSxFQUFFLENBQUM7SUFDWCxDQUFDOztnQkFKRixVQUFVOzs7O0lBS1gsa0JBQUM7Q0FBQSxBQUxELENBQ2lDLGVBQWUsR0FJL0M7U0FKWSxXQUFXIiwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IHsgSW5qZWN0YWJsZSB9IGZyb20gJ0Bhbmd1bGFyL2NvcmUnO1xuaW1wb3J0IHsgQmVoYXZpb3JTdWJqZWN0IH0gZnJvbSAncnhqcyc7XG5cbmltcG9ydCB7IFBsYWluT2JqZWN0IH0gZnJvbSAnQG5neHMvc3RvcmUvaW50ZXJuYWxzJztcblxuLyoqXG4gKiBCZWhhdmlvclN1YmplY3Qgb2YgdGhlIGVudGlyZSBzdGF0ZS5cbiAqIEBpZ25vcmVcbiAqL1xuQEluamVjdGFibGUoKVxuZXhwb3J0IGNsYXNzIFN0YXRlU3RyZWFtIGV4dGV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plY3RhYmxlKClcbmV4cG9ydCBjbGFzcyBTdGF0ZVN0cmVhbSBleHRlbmRzIEJlaGF2aW9yU3ViamVjdDxQbGFpbk9iamVjdD4gaW1wbGVtZW50cyBPbkRlc3Ryb3kge1xuICBjb25zdHJ1Y3RvcigpIHtcbiAgICBzdXBlcih7fSk7XG4gIH1cblxuICBuZ09uRGVzdHJveSgpOiB2b2lkIHtcbiAgICAvLyBUaGUgYFN0YXRlU3RyZWFtYCBzaG91bGQgbmV2ZXIgZW1pdCB2YWx1ZXMgb25jZSB0aGUgcm9vdCB2aWV3IGlzIHJlbW92ZWQsIGUuZy4gd2hlbiB0aGUgYE5nTW9kdWxlUmVmLmRlc3Ryb3koKWAgaXMgY2FsbGVkLlxuICAgIC8vIFRoaXMgd2lsbCBlbGltaW5hdGUgbWVtb3J5IGxlYWtzIGluIHNlcnZlci1zaWRlIHJlbmRlcmVkIGFwcHMgd2hlcmUgdGhlIGBTdGF0ZVN0cmVhbWAgaXMgY3JlYXRlZCBwZXIgZWFjaCBIVFRQIHJlcXVlc3QsIHVzZXJzXG4gICAgLy8gbWlnaHQgZm9yZ2V0IHRvIHVuc3Vic2NyaWJlIGZyb20gYHN0b3JlLnNlbGVjdGAgb3IgYHN0b3JlLnN1YnNjcmliZWAsIHRodXMgdGhpcyB3aWxsIGxlYWQgdG8gaHVnZSBtZW1vcnkgbGVha3MgaW4gU1NSIGFwcHMuXG4gICAgdGhpcy5jb21wbGV0ZSgpO1xuICB9XG59XG4iXX0=
@@ -1,6 +1,65 @@
1
- import { getPlatform, COMPILER_OPTIONS, Injectable, InjectionToken, ɵɵdirectiveInject, INJECTOR, ɵglobal } from '@angular/core';
1
+ import { Injectable, InjectionToken, ɵɵdirectiveInject, INJECTOR, ɵglobal } from '@angular/core';
2
2
  import { ReplaySubject } from 'rxjs';
3
3
 
4
+ /**
5
+ * @fileoverview added by tsickle
6
+ * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
7
+ */
8
+ /**
9
+ * @return {?}
10
+ */
11
+ function isAngularInTestMode() {
12
+ // This is safe to check for these properties in the following way since `typeof` does not
13
+ // throw an exception if the value does not exist in the scope.
14
+ // We should not try to read these values from the global scope (e.g. `ɵglobal` from the `@angular/core`).
15
+ // This is related to how these frameworks compile and execute modules. E.g. Jest wraps the module into
16
+ // its internal code where `jest` variable exists in the scope. It cannot be read from the global scope, e.g.
17
+ // this will return undefined `global.jest`, but `jest` will not equal undefined.
18
+ return (typeof __karma__ !== 'undefined' ||
19
+ typeof jasmine !== 'undefined' ||
20
+ typeof jest !== 'undefined' ||
21
+ typeof Mocha !== 'undefined');
22
+ }
23
+
24
+ /**
25
+ * @fileoverview added by tsickle
26
+ * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
27
+ */
28
+ class NgxsBootstrapper {
29
+ constructor() {
30
+ /**
31
+ * Use `ReplaySubject`, thus we can get cached value even if the stream is completed
32
+ */
33
+ this.bootstrap$ = new ReplaySubject(1);
34
+ }
35
+ /**
36
+ * @return {?}
37
+ */
38
+ get appBootstrapped$() {
39
+ return this.bootstrap$.asObservable();
40
+ }
41
+ /**
42
+ * This event will be emitted after attaching `ComponentRef` of the root component
43
+ * to the tree of views, that's a signal that application has been fully rendered
44
+ * @return {?}
45
+ */
46
+ bootstrap() {
47
+ this.bootstrap$.next(true);
48
+ this.bootstrap$.complete();
49
+ }
50
+ }
51
+ NgxsBootstrapper.decorators = [
52
+ { type: Injectable }
53
+ ];
54
+ if (false) {
55
+ /**
56
+ * Use `ReplaySubject`, thus we can get cached value even if the stream is completed
57
+ * @type {?}
58
+ * @private
59
+ */
60
+ NgxsBootstrapper.prototype.bootstrap$;
61
+ }
62
+
4
63
  /**
5
64
  * @fileoverview added by tsickle
6
65
  * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
@@ -71,89 +130,6 @@ function memoize(func, equalityCheck = defaultEqualityCheck) {
71
130
  return (/** @type {?} */ (memoized));
72
131
  }
73
132
 
74
- /**
75
- * @fileoverview added by tsickle
76
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
77
- */
78
- /**
79
- * @return {?}
80
- */
81
- function _isAngularInTestMode() {
82
- /** @type {?} */
83
- const platformRef = getPlatform();
84
- if (!platformRef)
85
- return false;
86
- /** @type {?} */
87
- const compilerOptions = platformRef.injector.get(COMPILER_OPTIONS, null);
88
- if (!compilerOptions)
89
- return false;
90
- /** @type {?} */
91
- const isInTestMode = compilerOptions.some((/**
92
- * @param {?} item
93
- * @return {?}
94
- */
95
- (item) => {
96
- /** @type {?} */
97
- const providers = (item && item.providers) || [];
98
- return providers.some((/**
99
- * @param {?} provider
100
- * @return {?}
101
- */
102
- (provider) => {
103
- return ((provider && provider.provide && provider.provide.name === 'MockNgModuleResolver') ||
104
- false);
105
- }));
106
- }));
107
- return isInTestMode;
108
- }
109
- /** @type {?} */
110
- const isAngularInTestMode =
111
- // Caretaker note: we have still left the `typeof` condition in order to avoid
112
- // creating a breaking change for projects that still use the View Engine.
113
- typeof ngDevMode === 'undefined' || ngDevMode ? memoize(_isAngularInTestMode) : (/**
114
- * @return {?}
115
- */
116
- () => false);
117
-
118
- /**
119
- * @fileoverview added by tsickle
120
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
121
- */
122
- class NgxsBootstrapper {
123
- constructor() {
124
- /**
125
- * Use `ReplaySubject`, thus we can get cached value even if the stream is completed
126
- */
127
- this.bootstrap$ = new ReplaySubject(1);
128
- }
129
- /**
130
- * @return {?}
131
- */
132
- get appBootstrapped$() {
133
- return this.bootstrap$.asObservable();
134
- }
135
- /**
136
- * This event will be emitted after attaching `ComponentRef` of the root component
137
- * to the tree of views, that's a signal that application has been fully rendered
138
- * @return {?}
139
- */
140
- bootstrap() {
141
- this.bootstrap$.next(true);
142
- this.bootstrap$.complete();
143
- }
144
- }
145
- NgxsBootstrapper.decorators = [
146
- { type: Injectable }
147
- ];
148
- if (false) {
149
- /**
150
- * Use `ReplaySubject`, thus we can get cached value even if the stream is completed
151
- * @type {?}
152
- * @private
153
- */
154
- NgxsBootstrapper.prototype.bootstrap$;
155
- }
156
-
157
133
  /**
158
134
  * @fileoverview added by tsickle
159
135
  * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
@@ -1 +1 @@
1
- {"version":3,"file":"ngxs-store-internals.js","sources":["ng://@ngxs/store/internals/memoize.ts","ng://@ngxs/store/internals/angular.ts","ng://@ngxs/store/internals/ngxs-bootstrapper.ts","ng://@ngxs/store/internals/initial-state.ts","ng://@ngxs/store/internals/internal-tokens.ts","ng://@ngxs/store/internals/decorator-injector-adapter.ts"],"sourcesContent":["function defaultEqualityCheck(a: any, b: any) {\n return a === b;\n}\n\nfunction areArgumentsShallowlyEqual(\n equalityCheck: (a: any, b: any) => boolean,\n prev: IArguments | null,\n next: IArguments | null\n) {\n if (prev === null || next === null || prev.length !== next.length) {\n return false;\n }\n\n // Do this in a for loop (and not a `forEach` or an `every`) so we can determine equality as fast as possible.\n const length = prev.length;\n for (let i = 0; i < length; i++) {\n if (!equalityCheck(prev[i], next[i])) {\n return false;\n }\n }\n\n return true;\n}\n\n/**\n * Memoize a function on its last inputs only.\n * Originally from: https://github.com/reduxjs/reselect/blob/master/src/index.js\n *\n * @ignore\n */\nexport function memoize<T extends (...args: any[]) => any>(\n func: T,\n equalityCheck = defaultEqualityCheck\n): T {\n let lastArgs: IArguments | null = null;\n let lastResult: any = null;\n // we reference arguments instead of spreading them for performance reasons\n function memoized() {\n if (!areArgumentsShallowlyEqual(equalityCheck, lastArgs, arguments)) {\n // apply arguments instead of spreading for performance.\n lastResult = (<Function>func).apply(null, arguments);\n }\n\n lastArgs = arguments;\n return lastResult;\n }\n (<any>memoized).reset = function() {\n // The hidden (for now) ability to reset the memoization\n lastArgs = null;\n lastResult = null;\n };\n return memoized as T;\n}\n","import { getPlatform, COMPILER_OPTIONS, CompilerOptions, PlatformRef } from '@angular/core';\nimport { memoize } from './memoize';\n\n/**\n * @description Will be provided through Terser global definitions by Angular CLI\n * during the production build. This is how Angular does tree-shaking internally.\n */\ndeclare const ngDevMode: boolean;\n\nfunction _isAngularInTestMode(): boolean {\n const platformRef: PlatformRef | null = getPlatform();\n if (!platformRef) return false;\n const compilerOptions = platformRef.injector.get(COMPILER_OPTIONS, null);\n if (!compilerOptions) return false;\n const isInTestMode = compilerOptions.some((item: CompilerOptions) => {\n const providers = (item && item.providers) || [];\n return providers.some((provider: any) => {\n return (\n (provider && provider.provide && provider.provide.name === 'MockNgModuleResolver') ||\n false\n );\n });\n });\n return isInTestMode;\n}\n\nexport const isAngularInTestMode =\n // Caretaker note: we have still left the `typeof` condition in order to avoid\n // creating a breaking change for projects that still use the View Engine.\n typeof ngDevMode === 'undefined' || ngDevMode ? memoize(_isAngularInTestMode) : () => false;\n","import { Injectable } from '@angular/core';\nimport { Observable, ReplaySubject } from 'rxjs';\n\n@Injectable()\nexport class NgxsBootstrapper {\n /**\n * Use `ReplaySubject`, thus we can get cached value even if the stream is completed\n */\n private bootstrap$ = new ReplaySubject<boolean>(1);\n\n get appBootstrapped$(): Observable<boolean> {\n return this.bootstrap$.asObservable();\n }\n\n /**\n * This event will be emitted after attaching `ComponentRef` of the root component\n * to the tree of views, that's a signal that application has been fully rendered\n */\n bootstrap(): void {\n this.bootstrap$.next(true);\n this.bootstrap$.complete();\n }\n}\n","import { InjectionToken } from '@angular/core';\nimport { PlainObject } from './symbols';\n\nexport const INITIAL_STATE_TOKEN = new InjectionToken<any>('INITIAL_STATE_TOKEN');\n\nexport class InitialState {\n private static value: PlainObject = {};\n\n public static set(state: PlainObject) {\n this.value = state;\n }\n\n public static pop(): PlainObject {\n const state: PlainObject = this.value;\n this.value = {};\n return state;\n }\n}\n","import { InjectionToken } from '@angular/core';\n\n/**\n * @see StateContextFactory as it's referenced by this token to be accessed by plugins internally\n */\nexport const NGXS_STATE_CONTEXT_FACTORY: InjectionToken<any> = new InjectionToken(\n 'Internals.StateContextFactory'\n);\n\n/**\n * @see StateFactory as it's referenced by this token to be accessed by plugins internally\n */\nexport const NGXS_STATE_FACTORY: InjectionToken<any> = new InjectionToken(\n 'Internals.StateFactory'\n);\n","import {\n InjectionToken,\n Injector,\n INJECTOR,\n Type,\n ɵɵdirectiveInject,\n ɵglobal\n} from '@angular/core';\nimport { ReplaySubject } from 'rxjs';\n\n// Will be provided through Terser global definitions by Angular CLI\n// during the production build. This is how Angular does tree-shaking internally.\ndeclare const ngDevMode: boolean;\n\n// Angular doesn't export `NG_FACTORY_DEF`.\nconst NG_FACTORY_DEF = 'ɵfac';\n\n// A `Symbol` which is used to save the `Injector` onto the class instance.\nconst InjectorInstance: unique symbol = Symbol('InjectorInstance');\n\n// A `Symbol` which is used to determine if factory has been decorated previously or not.\nconst FactoryHasBeenDecorated: unique symbol = Symbol('FactoryHasBeenDecorated');\n\n// A `Symbol` which is used to save the notifier on the class instance. The `InjectorInstance` cannot\n// be retrieved within the `constructor` since it's set after the `factory()` is called.\nconst InjectorNotifier: unique symbol = Symbol('InjectorNotifier');\n\ninterface PrototypeWithInjectorNotifier extends Object {\n [InjectorNotifier]?: ReplaySubject<boolean>;\n}\n\nexport function ensureInjectorNotifierIsCaptured(\n target: PrototypeWithInjectorNotifier | PrivateInstance\n): ReplaySubject<boolean> {\n if (target[InjectorNotifier]) {\n return target[InjectorNotifier]!;\n } else {\n const injectorNotifier$ = new ReplaySubject<boolean>(1);\n Object.defineProperty(target, InjectorNotifier, {\n get: () => injectorNotifier$\n });\n return injectorNotifier$;\n }\n}\n\n// eslint-disable-next-line @typescript-eslint/ban-types\nexport function ensureLocalInjectorCaptured(target: Object): void {\n if (FactoryHasBeenDecorated in target.constructor.prototype) {\n return;\n }\n\n const constructor: ConstructorWithDefinitionAndFactory = target.constructor;\n // Means we're in AOT mode.\n if (typeof constructor[NG_FACTORY_DEF] === 'function') {\n decorateFactory(constructor);\n } else if (ngDevMode) {\n // We're running in JIT mode and that means we're not able to get the compiled definition\n // on the class inside the property decorator during the current message loop tick. We have\n // to wait for the next message loop tick. Note that this is safe since this Promise will be\n // resolved even before the `APP_INITIALIZER` is resolved.\n // The below code also will be executed only in development mode, since it's never recommended\n // to use the JIT compiler in production mode (by setting \"aot: false\").\n decorateFactoryLater(constructor);\n }\n\n target.constructor.prototype[FactoryHasBeenDecorated] = true;\n}\n\nexport function localInject<T>(\n instance: PrivateInstance,\n token: InjectionToken<T> | Type<T>\n): T | null {\n const injector: Injector | undefined = instance[InjectorInstance];\n return injector ? injector.get(token) : null;\n}\n\nfunction decorateFactory(constructor: ConstructorWithDefinitionAndFactory): void {\n const factory = constructor[NG_FACTORY_DEF];\n\n if (typeof factory !== 'function') {\n return;\n }\n\n // Let's try to get any definition.\n // Caretaker note: this will be compatible only with Angular 9+, since Angular 9 is the first\n // Ivy-stable version. Previously definition properties were named differently (e.g. `ngComponentDef`).\n const def = constructor.ɵprov || constructor.ɵpipe || constructor.ɵcmp || constructor.ɵdir;\n\n const decoratedFactory = () => {\n const instance = factory();\n // Caretaker note: `inject()` won't work here.\n // We can use the `directiveInject` only during the component\n // construction, since Angular captures the currently active injector.\n // We're not able to use this function inside the getter (when the `selectorId` property is\n // requested for the first time), since the currently active injector will be null.\n instance[InjectorInstance] = ɵɵdirectiveInject(\n // We're using `INJECTOR` token except of the `Injector` class since the compiler\n // throws: `Cannot assign an abstract constructor type to a non-abstract constructor type.`.\n // Caretaker note: that this is the same way of getting the injector.\n INJECTOR\n );\n\n // Caretaker note: the notifier will be available only if consumers call the `ensureInjectorNotifierIsCaptured()`.\n const injectorNotifier$ = instance[InjectorNotifier];\n if (injectorNotifier$) {\n injectorNotifier$.next(true);\n injectorNotifier$.complete();\n }\n\n return instance;\n };\n\n // If we've found any definition then it's enough to override the `def.factory` since Angular\n // code uses the `def.factory` and then fallbacks to `ɵfac`.\n if (def) {\n def.factory = decoratedFactory;\n }\n\n // `@NgModule()` doesn't doesn't have definition factory, also providers have definitions but Angular\n // still uses the `ɵfac`.\n Object.defineProperty(constructor, NG_FACTORY_DEF, {\n get: () => decoratedFactory\n });\n}\n\nfunction decorateFactoryLater(constructor: ConstructorWithDefinitionAndFactory): void {\n // This function actually will be tree-shaken away when building for production since it's guarded with `ngDevMode`.\n // We're having the `try-catch` here because of the `SyncTestZoneSpec`, which throws\n // an error when micro or macrotask is used within a synchronous test. E.g. `Cannot call\n // Promise.then from within a sync test`.\n try {\n Promise.resolve().then(() => {\n decorateFactory(constructor);\n });\n } catch {\n // This is kind of a \"hack\", but we try to be backwards-compatible,\n // tho this `catch` block will only be executed when tests are run with Jasmine or Jest.\n ɵglobal.process &&\n ɵglobal.process.nextTick &&\n ɵglobal.process.nextTick(() => {\n decorateFactory(constructor);\n });\n }\n}\n\n// We could've used `ɵɵFactoryDef` but we try to be backwards-compatible,\n// since it's not exported in older Angular versions.\ntype Factory = () => PrivateInstance;\n\n// We could've used `ɵɵInjectableDef`, `ɵɵPipeDef`, etc. We try to be backwards-compatible\n// since they're not exported in older Angular versions.\ninterface Definition {\n factory: Factory | null;\n}\n\ninterface ConstructorWithDefinitionAndFactory extends Function {\n // Provider definition for the `@Injectable()` class.\n ɵprov?: Definition;\n // Pipe definition for the `@Pipe()` class.\n ɵpipe?: Definition;\n // Component definition for the `@Component()` class.\n ɵcmp?: Definition;\n // Directive definition for the `@Directive()` class.\n ɵdir?: Definition;\n [NG_FACTORY_DEF]?: Factory;\n}\n\ninterface PrivateInstance {\n [InjectorInstance]?: Injector;\n [InjectorNotifier]?: ReplaySubject<boolean>;\n}\n"],"names":[],"mappings":";;;;;;;;;;;;AAAA,SAAS,oBAAoB,CAAC,CAAM,EAAE,CAAM;IAC1C,OAAO,CAAC,KAAK,CAAC,CAAC;CAChB;;;;;;;AAED,SAAS,0BAA0B,CACjC,aAA0C,EAC1C,IAAuB,EACvB,IAAuB;IAEvB,IAA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;;IAEnB,oDAAmB;;IAEnB,mDAAkB;;IAElB,mDAAkB;;;;;;;AAIpB,8BAGC;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"ngxs-store-internals.js","sources":["ng://@ngxs/store/internals/angular.ts","ng://@ngxs/store/internals/ngxs-bootstrapper.ts","ng://@ngxs/store/internals/memoize.ts","ng://@ngxs/store/internals/initial-state.ts","ng://@ngxs/store/internals/internal-tokens.ts","ng://@ngxs/store/internals/decorator-injector-adapter.ts"],"sourcesContent":["declare const __karma__: unknown;\ndeclare const jasmine: unknown;\ndeclare const jest: unknown;\ndeclare const Mocha: unknown;\n\nexport function isAngularInTestMode(): boolean {\n // This is safe to check for these properties in the following way since `typeof` does not\n // throw an exception if the value does not exist in the scope.\n // We should not try to read these values from the global scope (e.g. `ɵglobal` from the `@angular/core`).\n // This is related to how these frameworks compile and execute modules. E.g. Jest wraps the module into\n // its internal code where `jest` variable exists in the scope. It cannot be read from the global scope, e.g.\n // this will return undefined `global.jest`, but `jest` will not equal undefined.\n return (\n typeof __karma__ !== 'undefined' ||\n typeof jasmine !== 'undefined' ||\n typeof jest !== 'undefined' ||\n typeof Mocha !== 'undefined'\n );\n}\n","import { Injectable } from '@angular/core';\nimport { Observable, ReplaySubject } from 'rxjs';\n\n@Injectable()\nexport class NgxsBootstrapper {\n /**\n * Use `ReplaySubject`, thus we can get cached value even if the stream is completed\n */\n private bootstrap$ = new ReplaySubject<boolean>(1);\n\n get appBootstrapped$(): Observable<boolean> {\n return this.bootstrap$.asObservable();\n }\n\n /**\n * This event will be emitted after attaching `ComponentRef` of the root component\n * to the tree of views, that's a signal that application has been fully rendered\n */\n bootstrap(): void {\n this.bootstrap$.next(true);\n this.bootstrap$.complete();\n }\n}\n","function defaultEqualityCheck(a: any, b: any) {\n return a === b;\n}\n\nfunction areArgumentsShallowlyEqual(\n equalityCheck: (a: any, b: any) => boolean,\n prev: IArguments | null,\n next: IArguments | null\n) {\n if (prev === null || next === null || prev.length !== next.length) {\n return false;\n }\n\n // Do this in a for loop (and not a `forEach` or an `every`) so we can determine equality as fast as possible.\n const length = prev.length;\n for (let i = 0; i < length; i++) {\n if (!equalityCheck(prev[i], next[i])) {\n return false;\n }\n }\n\n return true;\n}\n\n/**\n * Memoize a function on its last inputs only.\n * Originally from: https://github.com/reduxjs/reselect/blob/master/src/index.js\n *\n * @ignore\n */\nexport function memoize<T extends (...args: any[]) => any>(\n func: T,\n equalityCheck = defaultEqualityCheck\n): T {\n let lastArgs: IArguments | null = null;\n let lastResult: any = null;\n // we reference arguments instead of spreading them for performance reasons\n function memoized() {\n if (!areArgumentsShallowlyEqual(equalityCheck, lastArgs, arguments)) {\n // apply arguments instead of spreading for performance.\n lastResult = (<Function>func).apply(null, arguments);\n }\n\n lastArgs = arguments;\n return lastResult;\n }\n (<any>memoized).reset = function() {\n // The hidden (for now) ability to reset the memoization\n lastArgs = null;\n lastResult = null;\n };\n return memoized as T;\n}\n","import { InjectionToken } from '@angular/core';\nimport { PlainObject } from './symbols';\n\nexport const INITIAL_STATE_TOKEN = new InjectionToken<any>('INITIAL_STATE_TOKEN');\n\nexport class InitialState {\n private static value: PlainObject = {};\n\n public static set(state: PlainObject) {\n this.value = state;\n }\n\n public static pop(): PlainObject {\n const state: PlainObject = this.value;\n this.value = {};\n return state;\n }\n}\n","import { InjectionToken } from '@angular/core';\n\n/**\n * @see StateContextFactory as it's referenced by this token to be accessed by plugins internally\n */\nexport const NGXS_STATE_CONTEXT_FACTORY: InjectionToken<any> = new InjectionToken(\n 'Internals.StateContextFactory'\n);\n\n/**\n * @see StateFactory as it's referenced by this token to be accessed by plugins internally\n */\nexport const NGXS_STATE_FACTORY: InjectionToken<any> = new InjectionToken(\n 'Internals.StateFactory'\n);\n","import {\n InjectionToken,\n Injector,\n INJECTOR,\n Type,\n ɵɵdirectiveInject,\n ɵglobal\n} from '@angular/core';\nimport { ReplaySubject } from 'rxjs';\n\n// Will be provided through Terser global definitions by Angular CLI\n// during the production build. This is how Angular does tree-shaking internally.\ndeclare const ngDevMode: boolean;\n\n// Angular doesn't export `NG_FACTORY_DEF`.\nconst NG_FACTORY_DEF = 'ɵfac';\n\n// A `Symbol` which is used to save the `Injector` onto the class instance.\nconst InjectorInstance: unique symbol = Symbol('InjectorInstance');\n\n// A `Symbol` which is used to determine if factory has been decorated previously or not.\nconst FactoryHasBeenDecorated: unique symbol = Symbol('FactoryHasBeenDecorated');\n\n// A `Symbol` which is used to save the notifier on the class instance. The `InjectorInstance` cannot\n// be retrieved within the `constructor` since it's set after the `factory()` is called.\nconst InjectorNotifier: unique symbol = Symbol('InjectorNotifier');\n\ninterface PrototypeWithInjectorNotifier extends Object {\n [InjectorNotifier]?: ReplaySubject<boolean>;\n}\n\nexport function ensureInjectorNotifierIsCaptured(\n target: PrototypeWithInjectorNotifier | PrivateInstance\n): ReplaySubject<boolean> {\n if (target[InjectorNotifier]) {\n return target[InjectorNotifier]!;\n } else {\n const injectorNotifier$ = new ReplaySubject<boolean>(1);\n Object.defineProperty(target, InjectorNotifier, {\n get: () => injectorNotifier$\n });\n return injectorNotifier$;\n }\n}\n\n// eslint-disable-next-line @typescript-eslint/ban-types\nexport function ensureLocalInjectorCaptured(target: Object): void {\n if (FactoryHasBeenDecorated in target.constructor.prototype) {\n return;\n }\n\n const constructor: ConstructorWithDefinitionAndFactory = target.constructor;\n // Means we're in AOT mode.\n if (typeof constructor[NG_FACTORY_DEF] === 'function') {\n decorateFactory(constructor);\n } else if (ngDevMode) {\n // We're running in JIT mode and that means we're not able to get the compiled definition\n // on the class inside the property decorator during the current message loop tick. We have\n // to wait for the next message loop tick. Note that this is safe since this Promise will be\n // resolved even before the `APP_INITIALIZER` is resolved.\n // The below code also will be executed only in development mode, since it's never recommended\n // to use the JIT compiler in production mode (by setting \"aot: false\").\n decorateFactoryLater(constructor);\n }\n\n target.constructor.prototype[FactoryHasBeenDecorated] = true;\n}\n\nexport function localInject<T>(\n instance: PrivateInstance,\n token: InjectionToken<T> | Type<T>\n): T | null {\n const injector: Injector | undefined = instance[InjectorInstance];\n return injector ? injector.get(token) : null;\n}\n\nfunction decorateFactory(constructor: ConstructorWithDefinitionAndFactory): void {\n const factory = constructor[NG_FACTORY_DEF];\n\n if (typeof factory !== 'function') {\n return;\n }\n\n // Let's try to get any definition.\n // Caretaker note: this will be compatible only with Angular 9+, since Angular 9 is the first\n // Ivy-stable version. Previously definition properties were named differently (e.g. `ngComponentDef`).\n const def = constructor.ɵprov || constructor.ɵpipe || constructor.ɵcmp || constructor.ɵdir;\n\n const decoratedFactory = () => {\n const instance = factory();\n // Caretaker note: `inject()` won't work here.\n // We can use the `directiveInject` only during the component\n // construction, since Angular captures the currently active injector.\n // We're not able to use this function inside the getter (when the `selectorId` property is\n // requested for the first time), since the currently active injector will be null.\n instance[InjectorInstance] = ɵɵdirectiveInject(\n // We're using `INJECTOR` token except of the `Injector` class since the compiler\n // throws: `Cannot assign an abstract constructor type to a non-abstract constructor type.`.\n // Caretaker note: that this is the same way of getting the injector.\n INJECTOR\n );\n\n // Caretaker note: the notifier will be available only if consumers call the `ensureInjectorNotifierIsCaptured()`.\n const injectorNotifier$ = instance[InjectorNotifier];\n if (injectorNotifier$) {\n injectorNotifier$.next(true);\n injectorNotifier$.complete();\n }\n\n return instance;\n };\n\n // If we've found any definition then it's enough to override the `def.factory` since Angular\n // code uses the `def.factory` and then fallbacks to `ɵfac`.\n if (def) {\n def.factory = decoratedFactory;\n }\n\n // `@NgModule()` doesn't doesn't have definition factory, also providers have definitions but Angular\n // still uses the `ɵfac`.\n Object.defineProperty(constructor, NG_FACTORY_DEF, {\n get: () => decoratedFactory\n });\n}\n\nfunction decorateFactoryLater(constructor: ConstructorWithDefinitionAndFactory): void {\n // This function actually will be tree-shaken away when building for production since it's guarded with `ngDevMode`.\n // We're having the `try-catch` here because of the `SyncTestZoneSpec`, which throws\n // an error when micro or macrotask is used within a synchronous test. E.g. `Cannot call\n // Promise.then from within a sync test`.\n try {\n Promise.resolve().then(() => {\n decorateFactory(constructor);\n });\n } catch {\n // This is kind of a \"hack\", but we try to be backwards-compatible,\n // tho this `catch` block will only be executed when tests are run with Jasmine or Jest.\n ɵglobal.process &&\n ɵglobal.process.nextTick &&\n ɵglobal.process.nextTick(() => {\n decorateFactory(constructor);\n });\n }\n}\n\n// We could've used `ɵɵFactoryDef` but we try to be backwards-compatible,\n// since it's not exported in older Angular versions.\ntype Factory = () => PrivateInstance;\n\n// We could've used `ɵɵInjectableDef`, `ɵɵPipeDef`, etc. We try to be backwards-compatible\n// since they're not exported in older Angular versions.\ninterface Definition {\n factory: Factory | null;\n}\n\ninterface ConstructorWithDefinitionAndFactory extends Function {\n // Provider definition for the `@Injectable()` class.\n ɵprov?: Definition;\n // Pipe definition for the `@Pipe()` class.\n ɵpipe?: Definition;\n // Component definition for the `@Component()` class.\n ɵcmp?: Definition;\n // Directive definition for the `@Directive()` class.\n ɵdir?: Definition;\n [NG_FACTORY_DEF]?: Factory;\n}\n\ninterface PrivateInstance {\n [InjectorInstance]?: Injector;\n [InjectorNotifier]?: ReplaySubject<boolean>;\n}\n"],"names":[],"mappings":";;;;;;;;;;AAKA,SAAgB,mBAAmB;;;;;;;IAOjC,QACE,OAAO,SAAS,KAAK,WAAW;QAChC,OAAO,OAAO,KAAK,WAAW;QAC9B,OAAO,IAAI,KAAK,WAAW;QAC3B,OAAO,KAAK,KAAK,WAAW,EAC5B;CACH;;;;;;AClBD,MAIa,gBAAgB;IAD7B;;;;QAKU,eAAU,GAAG,IAAI,aAAa,CAAU,CAAC,CAAC,CAAC;KAcpD;;;;IAZC,IAAI,gBAAgB;QAClB,OAAO,IAAI,CAAC,UAAU,CAAC,YAAY,EAAE,CAAC;KACvC;;;;;;IAMD,SAAS;QACP,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAC3B,IAAI,CAAC,UAAU,CAAC,QAAQ,EAAE,CAAC;KAC5B;;;YAlBF,UAAU;;;;;;;;IAKT,sCAAmD;;;;;;;;;;;;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,eAAe,CAAC,WAAW,CAAC,CAAC;SAC9B,EAAC,CAAC;KACJ;IAAC,WAAM;;;QAGN,OAAO,CAAC,OAAO;YACb,OAAO,CAAC,OAAO,CAAC,QAAQ;YACxB,OAAO,CAAC,OAAO,CAAC,QAAQ;;;YAAC;gBACvB,eAAe,CAAC,WAAW,CAAC,CAAC;aAC9B,EAAC,CAAC;KACN;CACF;;;;AAQD,yBAEC;;;IADC,6BAAwB;;;;;AAG1B,kDAUC;;;IARC,oDAAmB;;IAEnB,oDAAmB;;IAEnB,mDAAkB;;IAElB,mDAAkB;;;;;;;AAIpB,8BAGC;;;;;;;;;;;;;;;;;;;;"}
@@ -1588,6 +1588,15 @@ class StateStream extends BehaviorSubject {
1588
1588
  constructor() {
1589
1589
  super({});
1590
1590
  }
1591
+ /**
1592
+ * @return {?}
1593
+ */
1594
+ ngOnDestroy() {
1595
+ // The `StateStream` should never emit values once the root view is removed, e.g. when the `NgModuleRef.destroy()` is called.
1596
+ // This will eliminate memory leaks in server-side rendered apps where the `StateStream` is created per each HTTP request, users
1597
+ // might forget to unsubscribe from `store.select` or `store.subscribe`, thus this will lead to huge memory leaks in SSR apps.
1598
+ this.complete();
1599
+ }
1591
1600
  }
1592
1601
  StateStream.decorators = [
1593
1602
  { type: Injectable }