@ngxs/store 3.8.1-dev.master-db96f65 → 3.8.1-dev.master-bb36826

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.
Files changed (36) hide show
  1. package/esm2020/internals/index.mjs +2 -1
  2. package/esm2020/internals/src/symbols.mjs +11 -2
  3. package/esm2020/internals/symbols.mjs +11 -2
  4. package/esm2020/internals/testing/symbol.mjs +1 -1
  5. package/esm2020/src/decorators/state.mjs +6 -6
  6. package/esm2020/src/internal/internals.mjs +11 -11
  7. package/esm2020/src/internal/state-factory.mjs +4 -4
  8. package/esm2020/src/module.mjs +1 -1
  9. package/esm2020/src/selectors/selector-types.util.mjs +1 -1
  10. package/esm2020/src/standalone-features/feature-providers.mjs +1 -1
  11. package/esm2020/src/standalone-features/provide-states.mjs +1 -1
  12. package/esm2020/src/standalone-features/provide-store.mjs +1 -1
  13. package/esm2020/src/standalone-features/root-providers.mjs +1 -1
  14. package/esm2020/src/symbols.mjs +1 -4
  15. package/fesm2015/ngxs-store-internals.mjs +12 -1
  16. package/fesm2015/ngxs-store-internals.mjs.map +1 -1
  17. package/fesm2015/ngxs-store.mjs +265 -268
  18. package/fesm2015/ngxs-store.mjs.map +1 -1
  19. package/fesm2020/ngxs-store-internals.mjs +12 -1
  20. package/fesm2020/ngxs-store-internals.mjs.map +1 -1
  21. package/fesm2020/ngxs-store.mjs +15 -18
  22. package/fesm2020/ngxs-store.mjs.map +1 -1
  23. package/internals/index.d.ts +1 -1
  24. package/internals/src/symbols.d.ts +4 -1
  25. package/internals/symbols.d.ts +4 -1
  26. package/internals/testing/symbol.d.ts +2 -2
  27. package/package.json +1 -1
  28. package/src/decorators/state.d.ts +2 -2
  29. package/src/internal/internals.d.ts +5 -5
  30. package/src/module.d.ts +3 -3
  31. package/src/selectors/selector-types.util.d.ts +3 -3
  32. package/src/standalone-features/feature-providers.d.ts +2 -2
  33. package/src/standalone-features/provide-states.d.ts +2 -2
  34. package/src/standalone-features/provide-store.d.ts +3 -3
  35. package/src/standalone-features/root-providers.d.ts +2 -2
  36. package/src/symbols.d.ts +4 -7
@@ -1,266 +1,19 @@
1
1
  import * as i0 from '@angular/core';
2
- import { NgZone, PLATFORM_ID, Injectable, Inject, InjectionToken, inject, ErrorHandler, INJECTOR, ɵglobal, Optional, SkipSelf, ENVIRONMENT_INITIALIZER, NgModule, APP_BOOTSTRAP_LISTENER, makeEnvironmentProviders } from '@angular/core';
2
+ import { Injectable, ErrorHandler, NgZone, PLATFORM_ID, Inject, InjectionToken, inject, INJECTOR, ɵglobal, Optional, SkipSelf, ENVIRONMENT_INITIALIZER, NgModule, APP_BOOTSTRAP_LISTENER, makeEnvironmentProviders } from '@angular/core';
3
3
  import { Observable, Subject, BehaviorSubject, of, forkJoin, throwError, EMPTY, from, isObservable, ReplaySubject } from 'rxjs';
4
4
  import { share, shareReplay, filter, take, exhaustMap, map, mergeMap, defaultIfEmpty, catchError, takeUntil, distinctUntilChanged, tap, startWith, pairwise } from 'rxjs/operators';
5
5
  import * as i5 from '@ngxs/store/internals';
6
- import { memoize, INITIAL_STATE_TOKEN, NgxsBootstrapper, ɵNGXS_STATE_CONTEXT_FACTORY, ɵNGXS_STATE_FACTORY } from '@ngxs/store/internals';
6
+ import { ɵMETA_KEY, ɵSELECTOR_META_KEY, memoize, INITIAL_STATE_TOKEN, NgxsBootstrapper, ɵNGXS_STATE_CONTEXT_FACTORY, ɵNGXS_STATE_FACTORY, ɵMETA_OPTIONS_KEY } from '@ngxs/store/internals';
7
7
  import { isPlatformServer } from '@angular/common';
8
8
  import { isStateOperator } from '@ngxs/store/operators';
9
9
 
10
- /**
11
- * Returns the type from an action instance/class.
12
- * @ignore
13
- */
14
- function getActionTypeFromInstance(action) {
15
- if (action.constructor && action.constructor.type) {
16
- return action.constructor.type;
17
- }
18
- else {
19
- return action.type;
20
- }
21
- }
22
- /**
23
- * Matches a action
24
- * @ignore
25
- */
26
- function actionMatcher(action1) {
27
- const type1 = getActionTypeFromInstance(action1);
28
- return function (action2) {
29
- return type1 === getActionTypeFromInstance(action2);
30
- };
31
- }
32
- /**
33
- * Set a deeply nested value. Example:
34
- *
35
- * setValue({ foo: { bar: { eat: false } } },
36
- * 'foo.bar.eat', true) //=> { foo: { bar: { eat: true } } }
37
- *
38
- * While it traverses it also creates new objects from top down.
39
- *
40
- * @ignore
41
- */
42
- const setValue = (obj, prop, val) => {
43
- obj = Object.assign({}, obj);
44
- const split = prop.split('.');
45
- const lastIndex = split.length - 1;
46
- split.reduce((acc, part, index) => {
47
- if (index === lastIndex) {
48
- acc[part] = val;
49
- }
50
- else {
51
- acc[part] = Array.isArray(acc[part]) ? acc[part].slice() : Object.assign({}, acc[part]);
52
- }
53
- return acc && acc[part];
54
- }, obj);
55
- return obj;
56
- };
57
- /**
58
- * Get a deeply nested value. Example:
59
- *
60
- * getValue({ foo: bar: [] }, 'foo.bar') //=> []
61
- *
62
- * @ignore
63
- */
64
- const getValue = (obj, prop) => prop.split('.').reduce((acc, part) => acc && acc[part], obj);
65
- /**
66
- * Simple object check.
67
- *
68
- * isObject({a:1}) //=> true
69
- * isObject(1) //=> false
70
- *
71
- * @ignore
72
- */
73
- const isObject$1 = (item) => {
74
- return item && typeof item === 'object' && !Array.isArray(item);
75
- };
76
- /**
77
- * Deep merge two objects.
78
- *
79
- * mergeDeep({a:1, b:{x: 1, y:2}}, {b:{x: 3}, c:4}) //=> {a:1, b:{x:3, y:2}, c:4}
80
- *
81
- * @param base base object onto which `sources` will be applied
82
- */
83
- const mergeDeep = (base, ...sources) => {
84
- if (!sources.length)
85
- return base;
86
- const source = sources.shift();
87
- if (isObject$1(base) && isObject$1(source)) {
88
- for (const key in source) {
89
- if (isObject$1(source[key])) {
90
- if (!base[key])
91
- Object.assign(base, { [key]: {} });
92
- mergeDeep(base[key], source[key]);
93
- }
94
- else {
95
- Object.assign(base, { [key]: source[key] });
96
- }
97
- }
98
- }
99
- return mergeDeep(base, ...sources);
100
- };
101
-
102
- function throwStateNameError(name) {
103
- throw new Error(`${name} is not a valid state name. It needs to be a valid object property name.`);
104
- }
105
- function throwStateNamePropertyError() {
106
- throw new Error(`States must register a 'name' property.`);
107
- }
108
- function throwStateUniqueError(current, newName, oldName) {
109
- throw new Error(`State name '${current}' from ${newName} already exists in ${oldName}.`);
110
- }
111
- function throwStateDecoratorError(name) {
112
- throw new Error(`States must be decorated with @State() decorator, but "${name}" isn't.`);
113
- }
114
- function throwActionDecoratorError() {
115
- throw new Error('@Action() decorator cannot be used with static methods.');
116
- }
117
- function throwSelectorDecoratorError() {
118
- throw new Error('Selectors only work on methods.');
119
- }
120
- function getZoneWarningMessage() {
121
- return ('Your application was bootstrapped with nooped zone and your execution strategy requires an actual NgZone!\n' +
122
- 'Please set the value of the executionStrategy property to NoopNgxsExecutionStrategy.\n' +
123
- 'NgxsModule.forRoot(states, { executionStrategy: NoopNgxsExecutionStrategy })');
124
- }
125
- function getUndecoratedStateInIvyWarningMessage(name) {
126
- return `'${name}' class should be decorated with @Injectable() right after the @State() decorator`;
127
- }
128
- function throwSelectFactoryNotConnectedError() {
129
- throw new Error('You have forgotten to import the NGXS module!');
130
- }
131
- function throwPatchingArrayError() {
132
- throw new Error('Patching arrays is not supported.');
133
- }
134
- function throwPatchingPrimitiveError() {
135
- throw new Error('Patching primitives is not supported.');
136
- }
137
-
138
- class DispatchOutsideZoneNgxsExecutionStrategy {
139
- constructor(_ngZone, _platformId) {
140
- this._ngZone = _ngZone;
141
- this._platformId = _platformId;
142
- // Caretaker note: we have still left the `typeof` condition in order to avoid
143
- // creating a breaking change for projects that still use the View Engine.
144
- if (typeof ngDevMode === 'undefined' || ngDevMode) {
145
- verifyZoneIsNotNooped(_ngZone);
146
- }
147
- }
148
- enter(func) {
149
- if (isPlatformServer(this._platformId)) {
150
- return this.runInsideAngular(func);
151
- }
152
- return this.runOutsideAngular(func);
153
- }
154
- leave(func) {
155
- return this.runInsideAngular(func);
156
- }
157
- runInsideAngular(func) {
158
- if (NgZone.isInAngularZone()) {
159
- return func();
160
- }
161
- return this._ngZone.run(func);
162
- }
163
- runOutsideAngular(func) {
164
- if (NgZone.isInAngularZone()) {
165
- return this._ngZone.runOutsideAngular(func);
166
- }
167
- return func();
168
- }
169
- }
170
- /** @nocollapse */ DispatchOutsideZoneNgxsExecutionStrategy.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.4", ngImport: i0, type: DispatchOutsideZoneNgxsExecutionStrategy, deps: [{ token: i0.NgZone }, { token: PLATFORM_ID }], target: i0.ɵɵFactoryTarget.Injectable });
171
- /** @nocollapse */ DispatchOutsideZoneNgxsExecutionStrategy.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.4", ngImport: i0, type: DispatchOutsideZoneNgxsExecutionStrategy, providedIn: 'root' });
172
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.4", ngImport: i0, type: DispatchOutsideZoneNgxsExecutionStrategy, decorators: [{
173
- type: Injectable,
174
- args: [{ providedIn: 'root' }]
175
- }], ctorParameters: function () {
176
- return [{ type: i0.NgZone }, { type: undefined, decorators: [{
177
- type: Inject,
178
- args: [PLATFORM_ID]
179
- }] }];
180
- } });
181
- // Caretaker note: this should exist as a separate function and not a class method,
182
- // since class methods are not tree-shakable.
183
- function verifyZoneIsNotNooped(ngZone) {
184
- // `NoopNgZone` is not exposed publicly as it doesn't expect
185
- // to be used outside of the core Angular code, thus we just have
186
- // to check if the zone doesn't extend or instanceof `NgZone`.
187
- if (ngZone instanceof NgZone) {
188
- return;
189
- }
190
- console.warn(getZoneWarningMessage());
191
- }
192
-
193
- const NG_DEV_MODE$3 = typeof ngDevMode === 'undefined' || ngDevMode;
194
- // The injection token is used to resolve a list of states provided at
195
- // the root level through either `NgxsModule.forRoot` or `provideStore`.
196
- const ROOT_STATE_TOKEN = new InjectionToken(NG_DEV_MODE$3 ? 'ROOT_STATE_TOKEN' : '');
197
- // The injection token is used to resolve a list of states provided at
198
- // the feature level through either `NgxsModule.forFeature` or `provideStates`.
199
- // The Array<Array> is used to overload the resolved value of the token because
200
- // it is a multi-provider token.
201
- const FEATURE_STATE_TOKEN = new InjectionToken(NG_DEV_MODE$3 ? 'FEATURE_STATE_TOKEN' : '');
202
- // The injection token is used to resolve to custom NGXS plugins provided
203
- // at the root level through either `{provide}` scheme or `withNgxsPlugin`.
204
- const NGXS_PLUGINS = new InjectionToken(NG_DEV_MODE$3 ? 'NGXS_PLUGINS' : '');
205
- // The injection token is used to resolve to options provided at the root
206
- // level through either `NgxsModule.forRoot` or `provideStore`.
207
- const NGXS_OPTIONS = new InjectionToken(NG_DEV_MODE$3 ? 'NGXS_OPTIONS' : '');
208
- const META_KEY = 'NGXS_META';
209
- const META_OPTIONS_KEY = 'NGXS_OPTIONS_META';
210
- const SELECTOR_META_KEY = 'NGXS_SELECTOR_META';
211
- /**
212
- * The NGXS config settings.
213
- */
214
- class NgxsConfig {
215
- constructor() {
216
- /**
217
- * Defining the default state before module initialization
218
- * This is convenient if we need to create a define our own set of states.
219
- * @deprecated will be removed after v4
220
- * (default: {})
221
- */
222
- this.defaultsState = {};
223
- /**
224
- * Defining shared selector options
225
- */
226
- this.selectorOptions = {
227
- injectContainerState: true,
228
- suppressErrors: true // TODO: default is true in v3, will change in v4
229
- };
230
- this.compatibility = {
231
- strictContentSecurityPolicy: false
232
- };
233
- this.executionStrategy = DispatchOutsideZoneNgxsExecutionStrategy;
234
- }
235
- }
236
- /** @nocollapse */ NgxsConfig.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.4", ngImport: i0, type: NgxsConfig, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
237
- /** @nocollapse */ NgxsConfig.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.4", ngImport: i0, type: NgxsConfig, providedIn: 'root', useFactory: () => mergeDeep(new NgxsConfig(), inject(NGXS_OPTIONS)) });
238
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.4", ngImport: i0, type: NgxsConfig, decorators: [{
239
- type: Injectable,
240
- args: [{
241
- providedIn: 'root',
242
- useFactory: () => mergeDeep(new NgxsConfig(), inject(NGXS_OPTIONS))
243
- }]
244
- }], ctorParameters: function () { return []; } });
245
- /**
246
- * Represents a basic change from a previous to a new value for a single state instance.
247
- * Passed as a value in a NgxsSimpleChanges object to the ngxsOnChanges hook.
248
- */
249
- class NgxsSimpleChange {
250
- constructor(previousValue, currentValue, firstChange) {
251
- this.previousValue = previousValue;
252
- this.currentValue = currentValue;
253
- this.firstChange = firstChange;
254
- }
255
- }
256
-
257
10
  /**
258
11
  * Ensures metadata is attached to the class and returns it.
259
12
  *
260
13
  * @ignore
261
14
  */
262
15
  function ensureStoreMetadata$1(target) {
263
- if (!target.hasOwnProperty(META_KEY)) {
16
+ if (!target.hasOwnProperty(ɵMETA_KEY)) {
264
17
  const defaultMetadata = {
265
18
  name: null,
266
19
  actions: {},
@@ -271,7 +24,7 @@ function ensureStoreMetadata$1(target) {
271
24
  },
272
25
  children: []
273
26
  };
274
- Object.defineProperty(target, META_KEY, { value: defaultMetadata });
27
+ Object.defineProperty(target, ɵMETA_KEY, { value: defaultMetadata });
275
28
  }
276
29
  return getStoreMetadata$1(target);
277
30
  }
@@ -281,7 +34,7 @@ function ensureStoreMetadata$1(target) {
281
34
  * @ignore
282
35
  */
283
36
  function getStoreMetadata$1(target) {
284
- return target[META_KEY];
37
+ return target[ɵMETA_KEY];
285
38
  }
286
39
  /**
287
40
  * Ensures metadata is attached to the selector and returns it.
@@ -289,7 +42,7 @@ function getStoreMetadata$1(target) {
289
42
  * @ignore
290
43
  */
291
44
  function ensureSelectorMetadata$1(target) {
292
- if (!target.hasOwnProperty(SELECTOR_META_KEY)) {
45
+ if (!target.hasOwnProperty(ɵSELECTOR_META_KEY)) {
293
46
  const defaultMetadata = {
294
47
  makeRootSelector: null,
295
48
  originalFn: null,
@@ -297,7 +50,7 @@ function ensureSelectorMetadata$1(target) {
297
50
  selectorName: null,
298
51
  getSelectorOptions: () => ({})
299
52
  };
300
- Object.defineProperty(target, SELECTOR_META_KEY, { value: defaultMetadata });
53
+ Object.defineProperty(target, ɵSELECTOR_META_KEY, { value: defaultMetadata });
301
54
  }
302
55
  return getSelectorMetadata$1(target);
303
56
  }
@@ -307,7 +60,7 @@ function ensureSelectorMetadata$1(target) {
307
60
  * @ignore
308
61
  */
309
62
  function getSelectorMetadata$1(target) {
310
- return target[SELECTOR_META_KEY];
63
+ return target[ɵSELECTOR_META_KEY];
311
64
  }
312
65
  /**
313
66
  * Get a deeply nested value. Example:
@@ -383,10 +136,10 @@ function buildGraph(stateClasses) {
383
136
  if ((typeof ngDevMode === 'undefined' || ngDevMode) && !meta) {
384
137
  throw new Error(`Child state not found: ${stateClass}. \r\nYou may have forgotten to add states to module`);
385
138
  }
386
- return meta[META_KEY].name;
139
+ return meta[ɵMETA_KEY].name;
387
140
  };
388
141
  return stateClasses.reduce((result, stateClass) => {
389
- const { name, children } = stateClass[META_KEY];
142
+ const { name, children } = stateClass[ɵMETA_KEY];
390
143
  result[name] = (children || []).map(findName);
391
144
  return result;
392
145
  }, {});
@@ -403,7 +156,7 @@ function buildGraph(stateClasses) {
403
156
  */
404
157
  function nameToState(states) {
405
158
  return states.reduce((result, stateClass) => {
406
- const meta = stateClass[META_KEY];
159
+ const meta = stateClass[ɵMETA_KEY];
407
160
  result[meta.name] = stateClass;
408
161
  return result;
409
162
  }, {});
@@ -497,7 +250,7 @@ function topologicalSort(graph) {
497
250
  *
498
251
  * @ignore
499
252
  */
500
- function isObject(obj) {
253
+ function isObject$1(obj) {
501
254
  return (typeof obj === 'object' && obj !== null) || typeof obj === 'function';
502
255
  }
503
256
 
@@ -816,6 +569,98 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.4", ngImpor
816
569
  args: [{ providedIn: 'root' }]
817
570
  }], ctorParameters: function () { return [{ type: i0.Injector }]; } });
818
571
 
572
+ /**
573
+ * Returns the type from an action instance/class.
574
+ * @ignore
575
+ */
576
+ function getActionTypeFromInstance(action) {
577
+ if (action.constructor && action.constructor.type) {
578
+ return action.constructor.type;
579
+ }
580
+ else {
581
+ return action.type;
582
+ }
583
+ }
584
+ /**
585
+ * Matches a action
586
+ * @ignore
587
+ */
588
+ function actionMatcher(action1) {
589
+ const type1 = getActionTypeFromInstance(action1);
590
+ return function (action2) {
591
+ return type1 === getActionTypeFromInstance(action2);
592
+ };
593
+ }
594
+ /**
595
+ * Set a deeply nested value. Example:
596
+ *
597
+ * setValue({ foo: { bar: { eat: false } } },
598
+ * 'foo.bar.eat', true) //=> { foo: { bar: { eat: true } } }
599
+ *
600
+ * While it traverses it also creates new objects from top down.
601
+ *
602
+ * @ignore
603
+ */
604
+ const setValue = (obj, prop, val) => {
605
+ obj = Object.assign({}, obj);
606
+ const split = prop.split('.');
607
+ const lastIndex = split.length - 1;
608
+ split.reduce((acc, part, index) => {
609
+ if (index === lastIndex) {
610
+ acc[part] = val;
611
+ }
612
+ else {
613
+ acc[part] = Array.isArray(acc[part]) ? acc[part].slice() : Object.assign({}, acc[part]);
614
+ }
615
+ return acc && acc[part];
616
+ }, obj);
617
+ return obj;
618
+ };
619
+ /**
620
+ * Get a deeply nested value. Example:
621
+ *
622
+ * getValue({ foo: bar: [] }, 'foo.bar') //=> []
623
+ *
624
+ * @ignore
625
+ */
626
+ const getValue = (obj, prop) => prop.split('.').reduce((acc, part) => acc && acc[part], obj);
627
+ /**
628
+ * Simple object check.
629
+ *
630
+ * isObject({a:1}) //=> true
631
+ * isObject(1) //=> false
632
+ *
633
+ * @ignore
634
+ */
635
+ const isObject = (item) => {
636
+ return item && typeof item === 'object' && !Array.isArray(item);
637
+ };
638
+ /**
639
+ * Deep merge two objects.
640
+ *
641
+ * mergeDeep({a:1, b:{x: 1, y:2}}, {b:{x: 3}, c:4}) //=> {a:1, b:{x:3, y:2}, c:4}
642
+ *
643
+ * @param base base object onto which `sources` will be applied
644
+ */
645
+ const mergeDeep = (base, ...sources) => {
646
+ if (!sources.length)
647
+ return base;
648
+ const source = sources.shift();
649
+ if (isObject(base) && isObject(source)) {
650
+ for (const key in source) {
651
+ if (isObject(source[key])) {
652
+ if (!base[key])
653
+ Object.assign(base, { [key]: {} });
654
+ mergeDeep(base[key], source[key]);
655
+ }
656
+ else {
657
+ Object.assign(base, { [key]: source[key] });
658
+ }
659
+ }
660
+ }
661
+ return mergeDeep(base, ...sources);
662
+ };
663
+
819
664
  class NoopNgxsExecutionStrategy {
820
665
  enter(func) {
821
666
  return func();
@@ -831,18 +676,109 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.4", ngImpor
831
676
  args: [{ providedIn: 'root' }]
832
677
  }] });
833
678
 
834
- const NG_DEV_MODE$2 = typeof ngDevMode === 'undefined' || ngDevMode;
679
+ function throwStateNameError(name) {
680
+ throw new Error(`${name} is not a valid state name. It needs to be a valid object property name.`);
681
+ }
682
+ function throwStateNamePropertyError() {
683
+ throw new Error(`States must register a 'name' property.`);
684
+ }
685
+ function throwStateUniqueError(current, newName, oldName) {
686
+ throw new Error(`State name '${current}' from ${newName} already exists in ${oldName}.`);
687
+ }
688
+ function throwStateDecoratorError(name) {
689
+ throw new Error(`States must be decorated with @State() decorator, but "${name}" isn't.`);
690
+ }
691
+ function throwActionDecoratorError() {
692
+ throw new Error('@Action() decorator cannot be used with static methods.');
693
+ }
694
+ function throwSelectorDecoratorError() {
695
+ throw new Error('Selectors only work on methods.');
696
+ }
697
+ function getZoneWarningMessage() {
698
+ return ('Your application was bootstrapped with nooped zone and your execution strategy requires an actual NgZone!\n' +
699
+ 'Please set the value of the executionStrategy property to NoopNgxsExecutionStrategy.\n' +
700
+ 'NgxsModule.forRoot(states, { executionStrategy: NoopNgxsExecutionStrategy })');
701
+ }
702
+ function getUndecoratedStateInIvyWarningMessage(name) {
703
+ return `'${name}' class should be decorated with @Injectable() right after the @State() decorator`;
704
+ }
705
+ function throwSelectFactoryNotConnectedError() {
706
+ throw new Error('You have forgotten to import the NGXS module!');
707
+ }
708
+ function throwPatchingArrayError() {
709
+ throw new Error('Patching arrays is not supported.');
710
+ }
711
+ function throwPatchingPrimitiveError() {
712
+ throw new Error('Patching primitives is not supported.');
713
+ }
714
+
715
+ class DispatchOutsideZoneNgxsExecutionStrategy {
716
+ constructor(_ngZone, _platformId) {
717
+ this._ngZone = _ngZone;
718
+ this._platformId = _platformId;
719
+ // Caretaker note: we have still left the `typeof` condition in order to avoid
720
+ // creating a breaking change for projects that still use the View Engine.
721
+ if (typeof ngDevMode === 'undefined' || ngDevMode) {
722
+ verifyZoneIsNotNooped(_ngZone);
723
+ }
724
+ }
725
+ enter(func) {
726
+ if (isPlatformServer(this._platformId)) {
727
+ return this.runInsideAngular(func);
728
+ }
729
+ return this.runOutsideAngular(func);
730
+ }
731
+ leave(func) {
732
+ return this.runInsideAngular(func);
733
+ }
734
+ runInsideAngular(func) {
735
+ if (NgZone.isInAngularZone()) {
736
+ return func();
737
+ }
738
+ return this._ngZone.run(func);
739
+ }
740
+ runOutsideAngular(func) {
741
+ if (NgZone.isInAngularZone()) {
742
+ return this._ngZone.runOutsideAngular(func);
743
+ }
744
+ return func();
745
+ }
746
+ }
747
+ /** @nocollapse */ DispatchOutsideZoneNgxsExecutionStrategy.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.4", ngImport: i0, type: DispatchOutsideZoneNgxsExecutionStrategy, deps: [{ token: i0.NgZone }, { token: PLATFORM_ID }], target: i0.ɵɵFactoryTarget.Injectable });
748
+ /** @nocollapse */ DispatchOutsideZoneNgxsExecutionStrategy.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.4", ngImport: i0, type: DispatchOutsideZoneNgxsExecutionStrategy, providedIn: 'root' });
749
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.4", ngImport: i0, type: DispatchOutsideZoneNgxsExecutionStrategy, decorators: [{
750
+ type: Injectable,
751
+ args: [{ providedIn: 'root' }]
752
+ }], ctorParameters: function () {
753
+ return [{ type: i0.NgZone }, { type: undefined, decorators: [{
754
+ type: Inject,
755
+ args: [PLATFORM_ID]
756
+ }] }];
757
+ } });
758
+ // Caretaker note: this should exist as a separate function and not a class method,
759
+ // since class methods are not tree-shakable.
760
+ function verifyZoneIsNotNooped(ngZone) {
761
+ // `NoopNgZone` is not exposed publicly as it doesn't expect
762
+ // to be used outside of the core Angular code, thus we just have
763
+ // to check if the zone doesn't extend or instanceof `NgZone`.
764
+ if (ngZone instanceof NgZone) {
765
+ return;
766
+ }
767
+ console.warn(getZoneWarningMessage());
768
+ }
769
+
770
+ const NG_DEV_MODE$3 = typeof ngDevMode === 'undefined' || ngDevMode;
835
771
  /**
836
772
  * Consumers have the option to utilize the execution strategy provided by
837
773
  * `NgxsModule.forRoot({executionStrategy})` or `provideStore([], {executionStrategy})`.
838
774
  */
839
- const CUSTOM_NGXS_EXECUTION_STRATEGY = new InjectionToken(NG_DEV_MODE$2 ? 'CUSTOM_NGXS_EXECUTION_STRATEGY' : '');
775
+ const CUSTOM_NGXS_EXECUTION_STRATEGY = new InjectionToken(NG_DEV_MODE$3 ? 'CUSTOM_NGXS_EXECUTION_STRATEGY' : '');
840
776
  /**
841
777
  * The injection token is used internally to resolve an instance of the execution
842
778
  * strategy. It checks whether consumers have provided their own `executionStrategy`
843
779
  * and also verifies if we are operating in a zone-aware environment.
844
780
  */
845
- const NGXS_EXECUTION_STRATEGY = new InjectionToken(NG_DEV_MODE$2 ? 'NGXS_EXECUTION_STRATEGY' : '', {
781
+ const NGXS_EXECUTION_STRATEGY = new InjectionToken(NG_DEV_MODE$3 ? 'NGXS_EXECUTION_STRATEGY' : '', {
846
782
  providedIn: 'root',
847
783
  factory: () => {
848
784
  const injector = inject(INJECTOR);
@@ -922,6 +858,67 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.4", ngImpor
922
858
  args: [{ providedIn: 'root' }]
923
859
  }], ctorParameters: function () { return [{ type: InternalActions }, { type: InternalNgxsExecutionStrategy }]; } });
924
860
 
861
+ const NG_DEV_MODE$2 = typeof ngDevMode === 'undefined' || ngDevMode;
862
+ // The injection token is used to resolve a list of states provided at
863
+ // the root level through either `NgxsModule.forRoot` or `provideStore`.
864
+ const ROOT_STATE_TOKEN = new InjectionToken(NG_DEV_MODE$2 ? 'ROOT_STATE_TOKEN' : '');
865
+ // The injection token is used to resolve a list of states provided at
866
+ // the feature level through either `NgxsModule.forFeature` or `provideStates`.
867
+ // The Array<Array> is used to overload the resolved value of the token because
868
+ // it is a multi-provider token.
869
+ const FEATURE_STATE_TOKEN = new InjectionToken(NG_DEV_MODE$2 ? 'FEATURE_STATE_TOKEN' : '');
870
+ // The injection token is used to resolve to custom NGXS plugins provided
871
+ // at the root level through either `{provide}` scheme or `withNgxsPlugin`.
872
+ const NGXS_PLUGINS = new InjectionToken(NG_DEV_MODE$2 ? 'NGXS_PLUGINS' : '');
873
+ // The injection token is used to resolve to options provided at the root
874
+ // level through either `NgxsModule.forRoot` or `provideStore`.
875
+ const NGXS_OPTIONS = new InjectionToken(NG_DEV_MODE$2 ? 'NGXS_OPTIONS' : '');
876
+ /**
877
+ * The NGXS config settings.
878
+ */
879
+ class NgxsConfig {
880
+ constructor() {
881
+ /**
882
+ * Defining the default state before module initialization
883
+ * This is convenient if we need to create a define our own set of states.
884
+ * @deprecated will be removed after v4
885
+ * (default: {})
886
+ */
887
+ this.defaultsState = {};
888
+ /**
889
+ * Defining shared selector options
890
+ */
891
+ this.selectorOptions = {
892
+ injectContainerState: true,
893
+ suppressErrors: true // TODO: default is true in v3, will change in v4
894
+ };
895
+ this.compatibility = {
896
+ strictContentSecurityPolicy: false
897
+ };
898
+ this.executionStrategy = DispatchOutsideZoneNgxsExecutionStrategy;
899
+ }
900
+ }
901
+ /** @nocollapse */ NgxsConfig.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.4", ngImport: i0, type: NgxsConfig, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
902
+ /** @nocollapse */ NgxsConfig.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.4", ngImport: i0, type: NgxsConfig, providedIn: 'root', useFactory: () => mergeDeep(new NgxsConfig(), inject(NGXS_OPTIONS)) });
903
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.4", ngImport: i0, type: NgxsConfig, decorators: [{
904
+ type: Injectable,
905
+ args: [{
906
+ providedIn: 'root',
907
+ useFactory: () => mergeDeep(new NgxsConfig(), inject(NGXS_OPTIONS))
908
+ }]
909
+ }], ctorParameters: function () { return []; } });
910
+ /**
911
+ * Represents a basic change from a previous to a new value for a single state instance.
912
+ * Passed as a value in a NgxsSimpleChanges object to the ngxsOnChanges hook.
913
+ */
914
+ class NgxsSimpleChange {
915
+ constructor(previousValue, currentValue, firstChange) {
916
+ this.previousValue = previousValue;
917
+ this.currentValue = currentValue;
918
+ this.firstChange = firstChange;
919
+ }
920
+ }
921
+
925
922
  class PluginManager {
926
923
  constructor(_parentManager, _pluginHandlers) {
927
924
  this._parentManager = _parentManager;
@@ -1465,7 +1462,7 @@ class StateFactory {
1465
1462
  if (Array.isArray(defaults)) {
1466
1463
  value = defaults.slice();
1467
1464
  }
1468
- else if (isObject(defaults)) {
1465
+ else if (isObject$1(defaults)) {
1469
1466
  value = Object.assign({}, defaults);
1470
1467
  }
1471
1468
  else if (defaults === undefined) {
@@ -1495,7 +1492,7 @@ class StateFactory {
1495
1492
  for (const name of sortedStates) {
1496
1493
  const stateClass = nameGraph[name];
1497
1494
  const path = paths[name];
1498
- const meta = stateClass[META_KEY];
1495
+ const meta = stateClass[ɵMETA_KEY];
1499
1496
  this.addRuntimeInfoToMeta(meta, path);
1500
1497
  // Note: previously we called `ensureStateClassIsInjectable` within the
1501
1498
  // `State` decorator. This check is moved here because the `ɵprov` property
@@ -2069,11 +2066,11 @@ function State(options) {
2069
2066
  const inheritedStateClass = Object.getPrototypeOf(stateClass);
2070
2067
  const optionsWithInheritance = getStateOptions(inheritedStateClass, options);
2071
2068
  mutateMetaData({ meta, inheritedStateClass, optionsWithInheritance });
2072
- stateClass[META_OPTIONS_KEY] = optionsWithInheritance;
2069
+ stateClass[ɵMETA_OPTIONS_KEY] = optionsWithInheritance;
2073
2070
  };
2074
2071
  }
2075
2072
  function getStateOptions(inheritedStateClass, options) {
2076
- const inheritanceOptions = inheritedStateClass[META_OPTIONS_KEY] || {};
2073
+ const inheritanceOptions = inheritedStateClass[ɵMETA_OPTIONS_KEY] || {};
2077
2074
  return Object.assign(Object.assign({}, inheritanceOptions), options);
2078
2075
  }
2079
2076
  function mutateMetaData(params) {
@@ -2083,8 +2080,8 @@ function mutateMetaData(params) {
2083
2080
  if (typeof ngDevMode === 'undefined' || ngDevMode) {
2084
2081
  ensureStateNameIsValid(stateName);
2085
2082
  }
2086
- if (inheritedStateClass.hasOwnProperty(META_KEY)) {
2087
- const inheritedMeta = inheritedStateClass[META_KEY] || {};
2083
+ if (inheritedStateClass.hasOwnProperty(ɵMETA_KEY)) {
2084
+ const inheritedMeta = inheritedStateClass[ɵMETA_KEY] || {};
2088
2085
  meta.actions = Object.assign(Object.assign({}, meta.actions), inheritedMeta.actions);
2089
2086
  }
2090
2087
  meta.children = children;