@ngxs/store 18.1.5-dev.master-14021c0 → 18.1.5-dev.master-a6757af

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.
@@ -120,18 +120,17 @@ function verifyZoneIsNotNooped(ngZone) {
120
120
  console.warn(getZoneWarningMessage());
121
121
  }
122
122
 
123
- const NG_DEV_MODE$9 = typeof ngDevMode !== 'undefined' && ngDevMode;
124
123
  /**
125
124
  * Consumers have the option to utilize the execution strategy provided by
126
125
  * `NgxsModule.forRoot({executionStrategy})` or `provideStore([], {executionStrategy})`.
127
126
  */
128
- const CUSTOM_NGXS_EXECUTION_STRATEGY = new InjectionToken(NG_DEV_MODE$9 ? 'CUSTOM_NGXS_EXECUTION_STRATEGY' : '');
127
+ const CUSTOM_NGXS_EXECUTION_STRATEGY = new InjectionToken(typeof ngDevMode !== 'undefined' && ngDevMode ? 'CUSTOM_NGXS_EXECUTION_STRATEGY' : '');
129
128
  /**
130
129
  * The injection token is used internally to resolve an instance of the execution
131
130
  * strategy. It checks whether consumers have provided their own `executionStrategy`
132
131
  * and also verifies if we are operating in a zone-aware environment.
133
132
  */
134
- const NGXS_EXECUTION_STRATEGY = new InjectionToken(NG_DEV_MODE$9 ? 'NGXS_EXECUTION_STRATEGY' : '', {
133
+ const NGXS_EXECUTION_STRATEGY = new InjectionToken(typeof ngDevMode !== 'undefined' && ngDevMode ? 'NGXS_EXECUTION_STRATEGY' : '', {
135
134
  providedIn: 'root',
136
135
  factory: () => {
137
136
  const ngZone = inject(NgZone);
@@ -436,18 +435,17 @@ const compose = (injector, funcs) => (...args) => {
436
435
  return runInInjectionContext(injector, () => curr(...args, (...nextArgs) => compose(injector, funcs)(...nextArgs)));
437
436
  };
438
437
 
439
- const NG_DEV_MODE$8 = typeof ngDevMode !== 'undefined' && ngDevMode;
440
438
  // The injection token is used to resolve a list of states provided at
441
439
  // the root level through either `NgxsModule.forRoot` or `provideStore`.
442
- const ROOT_STATE_TOKEN = new InjectionToken(NG_DEV_MODE$8 ? 'ROOT_STATE_TOKEN' : '');
440
+ const ROOT_STATE_TOKEN = new InjectionToken(typeof ngDevMode !== 'undefined' && ngDevMode ? 'ROOT_STATE_TOKEN' : '');
443
441
  // The injection token is used to resolve a list of states provided at
444
442
  // the feature level through either `NgxsModule.forFeature` or `provideStates`.
445
443
  // The Array<Array> is used to overload the resolved value of the token because
446
444
  // it is a multi-provider token.
447
- const FEATURE_STATE_TOKEN = new InjectionToken(NG_DEV_MODE$8 ? 'FEATURE_STATE_TOKEN' : '');
445
+ const FEATURE_STATE_TOKEN = new InjectionToken(typeof ngDevMode !== 'undefined' && ngDevMode ? 'FEATURE_STATE_TOKEN' : '');
448
446
  // The injection token is used to resolve to options provided at the root
449
447
  // level through either `NgxsModule.forRoot` or `provideStore`.
450
- const NGXS_OPTIONS = new InjectionToken(NG_DEV_MODE$8 ? 'NGXS_OPTIONS' : '');
448
+ const NGXS_OPTIONS = new InjectionToken(typeof ngDevMode !== 'undefined' && ngDevMode ? 'NGXS_OPTIONS' : '');
451
449
  /**
452
450
  * The NGXS config settings.
453
451
  */
@@ -594,7 +592,6 @@ function ensureStateAndActionsAreImmutable(root) {
594
592
  };
595
593
  }
596
594
 
597
- const NG_DEV_MODE$7 = typeof ngDevMode !== 'undefined' && ngDevMode;
598
595
  function createRootSelectorFactory(selectorMetaData, selectors, memoizedSelectorFn) {
599
596
  return (context) => {
600
597
  const { argumentSelectorFunctions, selectorOptions } = getRuntimeSelectorInfo(context, selectorMetaData, selectors);
@@ -615,7 +612,7 @@ function createRootSelectorFactory(selectorMetaData, selectors, memoizedSelector
615
612
  // We're logging an error in this function because it may be used by `select`,
616
613
  // `selectSignal`, and `selectSnapshot`. Therefore, there's no need to catch
617
614
  // exceptions there to log errors.
618
- if (NG_DEV_MODE$7) {
615
+ if (typeof ngDevMode !== 'undefined' && ngDevMode) {
619
616
  const message = 'The selector below has thrown an error upon invocation. ' +
620
617
  'Please check for any unsafe property access that may result in null ' +
621
618
  'or undefined values.';
@@ -689,7 +686,6 @@ function getRootSelectorFactory(selector) {
689
686
  return (metadata && metadata.makeRootSelector) || (() => selector);
690
687
  }
691
688
 
692
- const NG_DEV_MODE$6 = typeof ngDevMode !== 'undefined' && ngDevMode;
693
689
  /**
694
690
  * Get a deeply nested value. Example:
695
691
  *
@@ -754,7 +750,7 @@ function propGetter(paths, config) {
754
750
  // `createSelectorFn`, which, in turn, is solely used by the `Select` decorator.
755
751
  // We've been trying to deprecate the `Select` decorator because it's unstable with
756
752
  // server-side rendering and micro-frontend applications.
757
- const ɵPROP_GETTER = new InjectionToken(NG_DEV_MODE$6 ? 'PROP_GETTER' : '', {
753
+ const ɵPROP_GETTER = new InjectionToken(typeof ngDevMode !== 'undefined' && ngDevMode ? 'PROP_GETTER' : '', {
758
754
  providedIn: 'root',
759
755
  factory: () => inject(NgxsConfig).compatibility?.strictContentSecurityPolicy
760
756
  ? compliantPropGetter
@@ -781,7 +777,7 @@ const ɵPROP_GETTER = new InjectionToken(NG_DEV_MODE$6 ? 'PROP_GETTER' : '', {
781
777
  function buildGraph(stateClasses) {
782
778
  const findName = (stateClass) => {
783
779
  const meta = stateClasses.find(g => g === stateClass);
784
- if (NG_DEV_MODE$6 && !meta) {
780
+ if (typeof ngDevMode !== 'undefined' && ngDevMode && !meta) {
785
781
  throw new Error(`Child state not found: ${stateClass}. \r\nYou may have forgotten to add states to module`);
786
782
  }
787
783
  return meta[_META_KEY].name;
@@ -876,7 +872,7 @@ function topologicalSort(graph) {
876
872
  ancestors.push(name);
877
873
  visited[name] = true;
878
874
  graph[name].forEach((dep) => {
879
- if (NG_DEV_MODE$6 && ancestors.indexOf(dep) >= 0) {
875
+ if (typeof ngDevMode !== 'undefined' && ngDevMode && ancestors.indexOf(dep) >= 0) {
880
876
  throw new Error(`Circular dependency '${dep}' is required by '${name}': ${ancestors.join(' -> ')}`);
881
877
  }
882
878
  if (visited[dep]) {
@@ -971,8 +967,8 @@ function jit_hasInjectableAnnotation(stateClass) {
971
967
  return annotations.some((annotation) => annotation?.ngMetadataName === 'Injectable');
972
968
  }
973
969
 
974
- const NG_DEV_MODE$5 = typeof ngDevMode !== 'undefined' && ngDevMode;
975
- const NGXS_DEVELOPMENT_OPTIONS = new InjectionToken(NG_DEV_MODE$5 ? 'NGXS_DEVELOPMENT_OPTIONS' : '', {
970
+ const NGXS_DEVELOPMENT_OPTIONS =
971
+ /* @__PURE__ */ new InjectionToken(typeof ngDevMode !== 'undefined' && ngDevMode ? 'NGXS_DEVELOPMENT_OPTIONS' : '', {
976
972
  providedIn: 'root',
977
973
  factory: () => ({ warnOnUnhandledActions: true })
978
974
  });
@@ -1228,7 +1224,6 @@ function createAllowedStatusesMap(statuses) {
1228
1224
  }, {});
1229
1225
  }
1230
1226
 
1231
- const NG_DEV_MODE$4 = typeof ngDevMode !== 'undefined' && ngDevMode;
1232
1227
  function cloneDefaults(defaults) {
1233
1228
  let value = defaults === undefined ? {} : defaults;
1234
1229
  if (defaults) {
@@ -1323,7 +1318,7 @@ class StateFactory {
1323
1318
  * Add a new state to the global defs.
1324
1319
  */
1325
1320
  add(stateClasses) {
1326
- if (NG_DEV_MODE$4) {
1321
+ if (typeof ngDevMode !== 'undefined' && ngDevMode) {
1327
1322
  ensureStatesAreDecorated(stateClasses);
1328
1323
  }
1329
1324
  const { newStates } = this.addToStatesMap(stateClasses);
@@ -1343,7 +1338,7 @@ class StateFactory {
1343
1338
  // `State` decorator. This check is moved here because the `ɵprov` property
1344
1339
  // will not exist on the class in JIT mode (because it's set asynchronously
1345
1340
  // during JIT compilation through `Object.defineProperty`).
1346
- if (NG_DEV_MODE$4) {
1341
+ if (typeof ngDevMode !== 'undefined' && ngDevMode) {
1347
1342
  ensureStateClassIsInjectable(stateClass);
1348
1343
  }
1349
1344
  const stateMap = {
@@ -1422,7 +1417,7 @@ class StateFactory {
1422
1417
  }
1423
1418
  // The `NgxsUnhandledActionsLogger` is a tree-shakable class which functions
1424
1419
  // only during development.
1425
- if (NG_DEV_MODE$4 && !actionHasBeenHandled) {
1420
+ if (typeof ngDevMode !== 'undefined' && ngDevMode && !actionHasBeenHandled) {
1426
1421
  const unhandledActionsLogger = this._injector.get(NgxsUnhandledActionsLogger, null);
1427
1422
  // The `NgxsUnhandledActionsLogger` will not be resolved by the injector if the
1428
1423
  // `NgxsDevelopmentModule` is not provided. It's enough to check whether the `injector.get`
@@ -1439,7 +1434,7 @@ class StateFactory {
1439
1434
  const statesMap = this.statesByName;
1440
1435
  for (const stateClass of stateClasses) {
1441
1436
  const stateName = _getStoreMetadata(stateClass).name;
1442
- if (NG_DEV_MODE$4) {
1437
+ if (typeof ngDevMode !== 'undefined' && ngDevMode) {
1443
1438
  ensureStateNameIsUnique(stateName, stateClass, statesMap);
1444
1439
  }
1445
1440
  const unmountedState = !statesMap[stateName];
@@ -1542,7 +1537,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.6", ngImpor
1542
1537
  // to the state context.
1543
1538
  function noop() { }
1544
1539
 
1545
- const NG_DEV_MODE$3 = typeof ngDevMode !== 'undefined' && ngDevMode;
1546
1540
  class Store {
1547
1541
  constructor() {
1548
1542
  this._stateStream = inject(_StateStream);
@@ -1562,7 +1556,7 @@ class Store {
1562
1556
  * Dispatches action(s).
1563
1557
  */
1564
1558
  dispatch(actionOrActions) {
1565
- if (NG_DEV_MODE$3) {
1559
+ if (typeof ngDevMode !== 'undefined' && ngDevMode) {
1566
1560
  if (
1567
1561
  // If a single action is dispatched and it's nullable.
1568
1562
  actionOrActions == null ||
@@ -1650,11 +1644,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.6", ngImpor
1650
1644
  args: [{ providedIn: 'root' }]
1651
1645
  }], ctorParameters: () => [] });
1652
1646
 
1653
- const NG_DEV_MODE$2 = typeof ngDevMode !== 'undefined' && ngDevMode;
1654
1647
  /**
1655
1648
  * InjectionToken that registers preboot functions (called before the root initializer).
1656
1649
  */
1657
- const NGXS_PREBOOT_FNS = new InjectionToken(NG_DEV_MODE$2 ? 'NGXS_PREBOOT_FNS' : '');
1650
+ const NGXS_PREBOOT_FNS = new InjectionToken(typeof ngDevMode !== 'undefined' && ngDevMode ? 'NGXS_PREBOOT_FNS' : '');
1658
1651
  /**
1659
1652
  * This function registers a preboot function which will be called before the root
1660
1653
  * store initializer is run, but after all of the NGXS features are provided and
@@ -1704,7 +1697,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.6", ngImpor
1704
1697
  args: [{ providedIn: 'root' }]
1705
1698
  }], ctorParameters: () => [{ type: Store }, { type: NgxsConfig }] });
1706
1699
 
1707
- const NG_DEV_MODE$1 = typeof ngDevMode !== 'undefined' && ngDevMode;
1708
1700
  class LifecycleStateManager {
1709
1701
  constructor() {
1710
1702
  this._store = inject(Store);
@@ -1717,7 +1709,7 @@ class LifecycleStateManager {
1717
1709
  this._destroy$.next();
1718
1710
  }
1719
1711
  ngxsBootstrap(action, results) {
1720
- if (NG_DEV_MODE$1) {
1712
+ if (typeof ngDevMode !== 'undefined' && ngDevMode) {
1721
1713
  if (action instanceof InitState) {
1722
1714
  this._initStateHasBeenDispatched = true;
1723
1715
  }
@@ -1775,7 +1767,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.6", ngImpor
1775
1767
  args: [{ providedIn: 'root' }]
1776
1768
  }] });
1777
1769
 
1778
- const NG_DEV_MODE = typeof ngDevMode !== 'undefined' && ngDevMode;
1779
1770
  /**
1780
1771
  * This function is shared by both NgModule and standalone features.
1781
1772
  * When using `NgxsModule.forRoot` and `provideStore`, we can depend on the
@@ -1823,11 +1814,11 @@ function featureStatesInitializer() {
1823
1814
  /**
1824
1815
  * InjectionToken that registers the global Store.
1825
1816
  */
1826
- const NGXS_ROOT_STORE_INITIALIZER = new InjectionToken(NG_DEV_MODE ? 'NGXS_ROOT_STORE_INITIALIZER' : '');
1817
+ const NGXS_ROOT_STORE_INITIALIZER = new InjectionToken(typeof ngDevMode !== 'undefined' && ngDevMode ? 'NGXS_ROOT_STORE_INITIALIZER' : '');
1827
1818
  /**
1828
1819
  * InjectionToken that registers feature states.
1829
1820
  */
1830
- const NGXS_FEATURE_STORE_INITIALIZER = new InjectionToken(NG_DEV_MODE ? 'NGXS_FEATURE_STORE_INITIALIZER' : '');
1821
+ const NGXS_FEATURE_STORE_INITIALIZER = new InjectionToken(typeof ngDevMode !== 'undefined' && ngDevMode ? 'NGXS_FEATURE_STORE_INITIALIZER' : '');
1831
1822
  const NGXS_ROOT_ENVIRONMENT_INITIALIZER = [
1832
1823
  { provide: NGXS_ROOT_STORE_INITIALIZER, useFactory: rootStoreInitializer },
1833
1824
  {