@ngxs/store 18.1.1 → 18.1.2

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 (33) hide show
  1. package/README.md +1 -0
  2. package/esm2022/internals/memoize.mjs +14 -3
  3. package/esm2022/internals/testing/index.mjs +2 -2
  4. package/esm2022/internals/testing/ngxs.setup.mjs +4 -3
  5. package/esm2022/internals/testing/skip-console-logging.mjs +17 -7
  6. package/esm2022/src/actions/action-registry.mjs +34 -0
  7. package/esm2022/src/actions-stream.mjs +13 -5
  8. package/esm2022/src/internal/lifecycle-state-manager.mjs +2 -2
  9. package/esm2022/src/internal/state-context-factory.mjs +6 -6
  10. package/esm2022/src/internal/state-factory.mjs +82 -85
  11. package/esm2022/src/plugin-manager.mjs +15 -19
  12. package/esm2022/src/selectors/selector-checks.util.mjs +29 -4
  13. package/esm2022/src/standalone-features/plugin.mjs +10 -3
  14. package/experimental/package.json +3 -0
  15. package/fesm2022/ngxs-store-internals-testing.mjs +40 -30
  16. package/fesm2022/ngxs-store-internals-testing.mjs.map +1 -1
  17. package/fesm2022/ngxs-store-internals.mjs +13 -2
  18. package/fesm2022/ngxs-store-internals.mjs.map +1 -1
  19. package/fesm2022/ngxs-store.mjs +353 -285
  20. package/fesm2022/ngxs-store.mjs.map +1 -1
  21. package/internals/package.json +3 -0
  22. package/internals/testing/index.d.ts +1 -1
  23. package/internals/testing/package.json +3 -0
  24. package/internals/testing/skip-console-logging.d.ts +4 -1
  25. package/operators/package.json +3 -0
  26. package/package.json +7 -7
  27. package/plugins/package.json +3 -0
  28. package/schematics/src/utils/versions.json +1 -1
  29. package/src/actions/action-registry.d.ts +12 -0
  30. package/src/actions-stream.d.ts +3 -1
  31. package/src/internal/state-context-factory.d.ts +1 -2
  32. package/src/internal/state-factory.d.ts +13 -17
  33. package/src/plugin-manager.d.ts +7 -7
@@ -0,0 +1,3 @@
1
+ {
2
+ "module": "../fesm2022/ngxs-store-internals.mjs"
3
+ }
@@ -1,4 +1,4 @@
1
1
  export { freshPlatform } from './fresh-platform';
2
2
  export { NgxsTestBed } from './ngxs.setup';
3
- export { skipConsoleLogging } from './skip-console-logging';
3
+ export { skipConsoleLogging, ConsoleRecord, ConsoleRecorder, loggedError } from './skip-console-logging';
4
4
  export { NgxsTesting } from './symbol';
@@ -0,0 +1,3 @@
1
+ {
2
+ "module": "../../fesm2022/ngxs-store-internals-testing.mjs"
3
+ }
@@ -1 +1,4 @@
1
- export declare function skipConsoleLogging<T extends (...args: any[]) => any>(fn: T): ReturnType<T>;
1
+ export type ConsoleRecord = [string, any[]];
2
+ export type ConsoleRecorder = ConsoleRecord[];
3
+ export declare function loggedError(message: string): ConsoleRecord;
4
+ export declare function skipConsoleLogging<T extends (...args: any[]) => any>(fn: T, consoleRecorder?: ConsoleRecorder): ReturnType<T>;
@@ -0,0 +1,3 @@
1
+ {
2
+ "module": "../fesm2022/ngxs-store-operators.mjs"
3
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ngxs/store",
3
- "version": "18.1.1",
3
+ "version": "18.1.2",
4
4
  "license": "MIT",
5
5
  "sideEffects": false,
6
6
  "peerDependencies": {
@@ -32,18 +32,18 @@
32
32
  "esm": "./esm2022/internals/ngxs-store-internals.mjs",
33
33
  "default": "./fesm2022/ngxs-store-internals.mjs"
34
34
  },
35
- "./plugins": {
36
- "types": "./plugins/index.d.ts",
37
- "esm2022": "./esm2022/plugins/ngxs-store-plugins.mjs",
38
- "esm": "./esm2022/plugins/ngxs-store-plugins.mjs",
39
- "default": "./fesm2022/ngxs-store-plugins.mjs"
40
- },
41
35
  "./operators": {
42
36
  "types": "./operators/index.d.ts",
43
37
  "esm2022": "./esm2022/operators/ngxs-store-operators.mjs",
44
38
  "esm": "./esm2022/operators/ngxs-store-operators.mjs",
45
39
  "default": "./fesm2022/ngxs-store-operators.mjs"
46
40
  },
41
+ "./plugins": {
42
+ "types": "./plugins/index.d.ts",
43
+ "esm2022": "./esm2022/plugins/ngxs-store-plugins.mjs",
44
+ "esm": "./esm2022/plugins/ngxs-store-plugins.mjs",
45
+ "default": "./fesm2022/ngxs-store-plugins.mjs"
46
+ },
47
47
  "./internals/testing": {
48
48
  "types": "./internals/testing/index.d.ts",
49
49
  "esm2022": "./esm2022/internals/testing/ngxs-store-internals-testing.mjs",
@@ -0,0 +1,3 @@
1
+ {
2
+ "module": "../fesm2022/ngxs-store-plugins.mjs"
3
+ }
@@ -1,3 +1,3 @@
1
1
  {
2
- "@ngxs/store": "18.1.1"
2
+ "@ngxs/store": "18.1.2"
3
3
  }
@@ -0,0 +1,12 @@
1
+ import { type OnDestroy } from '@angular/core';
2
+ import type { Observable } from 'rxjs';
3
+ import * as i0 from "@angular/core";
4
+ export type ActionHandlerFn = (action: any) => void | Promise<void> | Observable<unknown>;
5
+ export declare class NgxsActionRegistry implements OnDestroy {
6
+ private readonly _actionTypeToHandlersMap;
7
+ ngOnDestroy(): void;
8
+ get(type: string): Set<ActionHandlerFn> | undefined;
9
+ register(type: string, handler: ActionHandlerFn): () => void;
10
+ static ɵfac: i0.ɵɵFactoryDeclaration<NgxsActionRegistry, never>;
11
+ static ɵprov: i0.ɵɵInjectableDeclaration<NgxsActionRegistry>;
12
+ }
@@ -1,6 +1,6 @@
1
1
  import { OnDestroy } from '@angular/core';
2
2
  import { ɵOrderedSubject } from '@ngxs/store/internals';
3
- import { Observable } from 'rxjs';
3
+ import { Observable, Subject } from 'rxjs';
4
4
  import { InternalNgxsExecutionStrategy } from './execution/internal-ngxs-execution-strategy';
5
5
  import * as i0 from "@angular/core";
6
6
  /**
@@ -21,6 +21,8 @@ export interface ActionContext<T = any> {
21
21
  * Internal Action stream that is emitted anytime an action is dispatched.
22
22
  */
23
23
  export declare class InternalActions extends ɵOrderedSubject<ActionContext> implements OnDestroy {
24
+ readonly dispatched$: Subject<ActionContext<any>>;
25
+ constructor();
24
26
  ngOnDestroy(): void;
25
27
  static ɵfac: i0.ɵɵFactoryDeclaration<InternalActions, never>;
26
28
  static ɵprov: i0.ɵɵInjectableDeclaration<InternalActions>;
@@ -1,5 +1,4 @@
1
1
  import { StateContext } from '../symbols';
2
- import { MappedStore } from '../internal/internals';
3
2
  import { InternalStateOperations } from '../internal/state-operations';
4
3
  import * as i0 from "@angular/core";
5
4
  /**
@@ -12,7 +11,7 @@ export declare class StateContextFactory {
12
11
  /**
13
12
  * Create the state context
14
13
  */
15
- createStateContext<T>(mappedStore: MappedStore): StateContext<T>;
14
+ createStateContext<T>(path: string): StateContext<T>;
16
15
  static ɵfac: i0.ɵɵFactoryDeclaration<StateContextFactory, never>;
17
16
  static ɵprov: i0.ɵɵInjectableDeclaration<StateContextFactory>;
18
17
  }
@@ -1,11 +1,6 @@
1
- import { Injector, OnDestroy } from '@angular/core';
1
+ import { OnDestroy } from '@angular/core';
2
2
  import { ɵStateClassInternal, ɵRuntimeSelectorContext } from '@ngxs/store/internals';
3
- import { Observable } from 'rxjs';
4
- import { NgxsConfig } from '../symbols';
5
3
  import { MappedStore, StatesAndDefaults, StatesByName } from './internals';
6
- import { ActionContext, InternalActions } from '../actions-stream';
7
- import { InternalDispatchedActionResults } from '../internal/dispatcher';
8
- import { StateContextFactory } from '../internal/state-context-factory';
9
4
  import * as i0 from "@angular/core";
10
5
  /**
11
6
  * The `StateFactory` class adds root and feature states to the graph.
@@ -21,17 +16,17 @@ import * as i0 from "@angular/core";
21
16
  * @ignore
22
17
  */
23
18
  export declare class StateFactory implements OnDestroy {
24
- private _injector;
25
- private _config;
26
- private _parentFactory;
27
- private _actions;
28
- private _actionResults;
29
- private _stateContextFactory;
30
- private _initialState;
19
+ private readonly _injector;
20
+ private readonly _config;
21
+ private readonly _parentFactory;
22
+ private readonly _stateContextFactory;
23
+ private readonly _actions;
24
+ private readonly _actionResults;
25
+ private readonly _initialState;
26
+ private readonly _actionRegistry;
27
+ private readonly _propGetter;
31
28
  private _actionsSubscription;
32
- private _propGetter;
33
29
  private _ngxsUnhandledErrorHandler;
34
- constructor(_injector: Injector, _config: NgxsConfig, _parentFactory: StateFactory, _actions: InternalActions, _actionResults: InternalDispatchedActionResults, _stateContextFactory: StateContextFactory, _initialState: any);
35
30
  private _states;
36
31
  get states(): MappedStore[];
37
32
  private _statesByName;
@@ -52,10 +47,11 @@ export declare class StateFactory implements OnDestroy {
52
47
  /**
53
48
  * Invoke actions on the states.
54
49
  */
55
- invokeActions(dispatched$: Observable<ActionContext>, action: any): Observable<[any]>;
50
+ invokeActions(action: any): import("rxjs").Observable<[void | Promise<void> | import("rxjs").Observable<unknown>]>;
56
51
  private addToStatesMap;
57
52
  private addRuntimeInfoToMeta;
58
53
  private hasBeenMountedAndBootstrapped;
59
- static ɵfac: i0.ɵɵFactoryDeclaration<StateFactory, [null, null, { optional: true; skipSelf: true; }, null, null, null, { optional: true; }]>;
54
+ private hydrateActionMetasMap;
55
+ static ɵfac: i0.ɵɵFactoryDeclaration<StateFactory, never>;
60
56
  static ɵprov: i0.ɵɵInjectableDeclaration<StateFactory>;
61
57
  }
@@ -1,13 +1,13 @@
1
- import { NgxsPlugin, NgxsPluginFn } from '@ngxs/store/plugins';
1
+ import { NgxsPluginFn } from '@ngxs/store/plugins';
2
2
  import * as i0 from "@angular/core";
3
3
  export declare class PluginManager {
4
- private _parentManager;
5
- private _pluginHandlers;
6
- plugins: NgxsPluginFn[];
7
- constructor(_parentManager: PluginManager, _pluginHandlers: NgxsPlugin[]);
8
- private get rootPlugins();
4
+ readonly plugins: NgxsPluginFn[];
5
+ private readonly _parentManager;
6
+ private readonly _pluginHandlers;
7
+ constructor();
8
+ private get _rootPlugins();
9
9
  private registerHandlers;
10
10
  private getPluginHandlers;
11
- static ɵfac: i0.ɵɵFactoryDeclaration<PluginManager, [{ optional: true; skipSelf: true; }, { optional: true; }]>;
11
+ static ɵfac: i0.ɵɵFactoryDeclaration<PluginManager, never>;
12
12
  static ɵprov: i0.ɵɵInjectableDeclaration<PluginManager>;
13
13
  }