@ngxs/store 3.8.2-dev.master-25397f3 → 3.8.2-dev.master-1a7514e

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 (122) hide show
  1. package/index.d.ts +6 -757
  2. package/internals/custom-rxjs-subjects.d.ts +42 -0
  3. package/internals/index.d.ts +9 -204
  4. package/internals/initial-state.d.ts +8 -0
  5. package/internals/internal-tokens.d.ts +3 -0
  6. package/internals/memoize.d.ts +9 -0
  7. package/internals/metadata.d.ts +25 -0
  8. package/internals/ngxs-app-bootstrapped-state.d.ts +8 -0
  9. package/internals/state-stream.d.ts +15 -0
  10. package/internals/state-token.d.ts +7 -0
  11. package/internals/symbols.d.ts +88 -0
  12. package/internals/testing/fresh-platform.d.ts +1 -0
  13. package/internals/testing/helpers/ngxs-test.component.d.ts +8 -0
  14. package/internals/testing/helpers/ngxs-test.module.d.ts +10 -0
  15. package/internals/testing/index.d.ts +4 -28
  16. package/internals/testing/ngxs.setup.d.ts +7 -0
  17. package/internals/testing/skip-console-logging.d.ts +1 -0
  18. package/internals/testing/symbol.d.ts +14 -0
  19. package/operators/append.d.ts +5 -0
  20. package/operators/compose.d.ts +2 -0
  21. package/operators/iif.d.ts +10 -0
  22. package/operators/index.d.ts +13 -101
  23. package/operators/insert-item.d.ts +6 -0
  24. package/operators/patch.d.ts +7 -0
  25. package/operators/remove-item.d.ts +6 -0
  26. package/operators/types.d.ts +56 -0
  27. package/operators/update-item.d.ts +9 -0
  28. package/operators/utils.d.ts +8 -0
  29. package/package.json +2 -2
  30. package/plugins/actions.d.ts +15 -0
  31. package/plugins/index.d.ts +3 -62
  32. package/plugins/symbols.d.ts +13 -0
  33. package/plugins/utils.d.ts +29 -0
  34. package/schematics/src/actions/actions.factory.d.ts +3 -0
  35. package/schematics/src/ng-add/add-declaration.d.ts +4 -0
  36. package/schematics/src/ng-add/ng-add.factory.d.ts +9 -0
  37. package/schematics/src/starter-kit/starter-kit.factory.d.ts +3 -0
  38. package/schematics/src/state/state.factory.d.ts +3 -0
  39. package/schematics/src/store/store.factory.d.ts +3 -0
  40. package/schematics/src/utils/common/lib.config.d.ts +10 -0
  41. package/schematics/src/utils/common/project-files.config.d.ts +3 -0
  42. package/schematics/src/utils/common/properties.d.ts +1 -0
  43. package/schematics/src/utils/config.d.ts +119 -0
  44. package/schematics/src/utils/generate-utils.d.ts +4 -0
  45. package/schematics/src/utils/interfaces/package.interface.d.ts +7 -0
  46. package/schematics/src/utils/ng-utils/ast-utils.d.ts +99 -0
  47. package/schematics/src/utils/ng-utils/ng-ast-utils.d.ts +5 -0
  48. package/schematics/src/utils/ng-utils/project.d.ts +2 -0
  49. package/schematics/src/utils/ng-utils/standalone/app_config.d.ts +16 -0
  50. package/schematics/src/utils/ng-utils/standalone/code_block.d.ts +46 -0
  51. package/schematics/src/utils/ng-utils/standalone/index.d.ts +1 -0
  52. package/schematics/src/utils/ng-utils/standalone/rules.d.ts +38 -0
  53. package/schematics/src/utils/ng-utils/standalone/util.d.ts +28 -0
  54. package/schematics/src/utils/normalize-options.d.ts +11 -0
  55. package/schematics/src/utils/project.d.ts +19 -0
  56. package/src/actions/symbols.d.ts +7 -0
  57. package/src/actions-stream.d.ts +37 -0
  58. package/src/configs/messages.config.d.ts +13 -0
  59. package/src/decorators/action.d.ts +30 -0
  60. package/src/decorators/select/select-factory.d.ts +16 -0
  61. package/src/decorators/select/select.d.ts +7 -0
  62. package/src/decorators/select/symbols.d.ts +9 -0
  63. package/src/decorators/selector/selector.d.ts +9 -0
  64. package/src/decorators/selector/symbols.d.ts +73 -0
  65. package/src/decorators/selector-options.d.ts +5 -0
  66. package/src/decorators/state.d.ts +5 -0
  67. package/src/dev-features/ngxs-development.module.d.ts +10 -0
  68. package/src/dev-features/ngxs-unhandled-actions-logger.d.ts +17 -0
  69. package/src/dev-features/symbols.d.ts +8 -0
  70. package/src/execution/dispatch-outside-zone-ngxs-execution-strategy.d.ts +14 -0
  71. package/src/execution/internal-ngxs-execution-strategy.d.ts +10 -0
  72. package/src/execution/noop-ngxs-execution-strategy.d.ts +8 -0
  73. package/src/execution/symbols.d.ts +16 -0
  74. package/src/internal/dispatcher.d.ts +36 -0
  75. package/src/internal/fallback-subscriber.d.ts +3 -0
  76. package/src/internal/internals.d.ts +105 -0
  77. package/src/internal/lifecycle-state-manager.d.ts +24 -0
  78. package/src/internal/state-context-factory.d.ts +18 -0
  79. package/src/internal/state-factory.d.ts +61 -0
  80. package/src/internal/state-operations.d.ts +21 -0
  81. package/src/internal/state-operators.d.ts +2 -0
  82. package/src/internal/unhandled-rxjs-error-callback.d.ts +2 -0
  83. package/src/ivy/ivy-enabled-in-dev-mode.d.ts +6 -0
  84. package/src/module.d.ts +13 -0
  85. package/src/modules/ngxs-feature.module.d.ts +10 -0
  86. package/src/modules/ngxs-root.module.d.ts +10 -0
  87. package/src/ngxs-unhandled-error-handler.d.ts +16 -0
  88. package/src/operators/leave-ngxs.d.ts +7 -0
  89. package/src/operators/of-action.d.ts +56 -0
  90. package/src/plugin-manager.d.ts +13 -0
  91. package/src/plugin_api.d.ts +1 -0
  92. package/src/private_api.d.ts +3 -0
  93. package/src/public_api.d.ts +23 -0
  94. package/src/selectors/create-model-selector.d.ts +10 -0
  95. package/src/selectors/create-pick-selector.d.ts +6 -0
  96. package/src/selectors/create-property-selectors.d.ts +5 -0
  97. package/src/selectors/create-selector.d.ts +19 -0
  98. package/src/selectors/index.d.ts +5 -0
  99. package/src/selectors/private_api.d.ts +7 -0
  100. package/src/selectors/selector-checks.util.d.ts +9 -0
  101. package/src/selectors/selector-metadata.d.ts +7 -0
  102. package/src/selectors/selector-models.d.ts +10 -0
  103. package/src/selectors/selector-types.util.d.ts +6 -0
  104. package/src/selectors/selector-utils.d.ts +9 -0
  105. package/src/standalone-features/feature-providers.d.ts +7 -0
  106. package/src/standalone-features/index.d.ts +4 -0
  107. package/src/standalone-features/initializers.d.ts +29 -0
  108. package/src/standalone-features/plugin.d.ts +17 -0
  109. package/src/standalone-features/preboot.d.ts +26 -0
  110. package/src/standalone-features/provide-states.d.ts +18 -0
  111. package/src/standalone-features/provide-store.d.ts +22 -0
  112. package/src/standalone-features/root-providers.d.ts +8 -0
  113. package/src/store.d.ts +60 -0
  114. package/src/symbols.d.ts +102 -0
  115. package/src/utils/compose.d.ts +23 -0
  116. package/src/utils/create-dispatch-map.d.ts +4 -0
  117. package/src/utils/create-select-map.d.ts +4 -0
  118. package/src/utils/dispatch.d.ts +2 -0
  119. package/src/utils/freeze.d.ts +5 -0
  120. package/src/utils/public_api.d.ts +4 -0
  121. package/src/utils/select.d.ts +16 -0
  122. package/src/utils/store-validators.d.ts +5 -0
@@ -0,0 +1,42 @@
1
+ import { BehaviorSubject, Subject } from 'rxjs';
2
+ /**
3
+ * Custom Subject that ensures that subscribers are notified of values in the order that they arrived.
4
+ * A standard Subject does not have this guarantee.
5
+ * For example, given the following code:
6
+ * ```typescript
7
+ * const subject = new Subject<string>();
8
+ subject.subscribe(value => {
9
+ if (value === 'start') subject.next('end');
10
+ });
11
+ subject.subscribe(value => { });
12
+ subject.next('start');
13
+ * ```
14
+ * When `subject` is a standard `Subject<T>` the second subscriber would recieve `end` and then `start`.
15
+ * When `subject` is a `OrderedSubject<T>` the second subscriber would recieve `start` and then `end`.
16
+ */
17
+ export declare class ɵOrderedSubject<T> extends Subject<T> {
18
+ private _orderedNext;
19
+ next(value?: T): void;
20
+ }
21
+ /**
22
+ * Custom BehaviorSubject that ensures that subscribers are notified of values in the order that they arrived.
23
+ * A standard BehaviorSubject does not have this guarantee.
24
+ * For example, given the following code:
25
+ * ```typescript
26
+ * const subject = new BehaviorSubject<string>();
27
+ subject.subscribe(value => {
28
+ if (value === 'start') subject.next('end');
29
+ });
30
+ subject.subscribe(value => { });
31
+ subject.next('start');
32
+ * ```
33
+ * When `subject` is a standard `BehaviorSubject<T>` the second subscriber would recieve `end` and then `start`.
34
+ * When `subject` is a `OrderedBehaviorSubject<T>` the second subscriber would recieve `start` and then `end`.
35
+ */
36
+ export declare class ɵOrderedBehaviorSubject<T> extends BehaviorSubject<T> {
37
+ private _orderedNext;
38
+ private _currentValue;
39
+ constructor(value: T);
40
+ getValue(): T;
41
+ next(value: T): void;
42
+ }
@@ -1,204 +1,9 @@
1
- import * as i0 from '@angular/core';
2
- import { InjectionToken, OnDestroy, Signal } from '@angular/core';
3
- import { ReplaySubject, Subject, BehaviorSubject } from 'rxjs';
4
-
5
- declare class StateToken<T = void> {
6
- private readonly _name;
7
- constructor(_name: ɵTokenName<T>);
8
- getName(): string;
9
- toString(): string;
10
- }
11
-
12
- interface ɵPlainObject {
13
- [key: string]: any;
14
- }
15
- interface ɵPlainObjectOf<T> {
16
- [key: string]: T;
17
- }
18
- type ɵStateClass<T = any> = new (...args: any[]) => T;
19
- declare const ɵMETA_KEY = "NGXS_META";
20
- declare const ɵMETA_OPTIONS_KEY = "NGXS_OPTIONS_META";
21
- declare const ɵSELECTOR_META_KEY = "NGXS_SELECTOR_META";
22
- interface ɵStateToken<T, U> {
23
- new (name: ɵTokenName<T>): U;
24
- getName(): string;
25
- toString(): string;
26
- }
27
- type RequireGeneric<T, U> = T extends void ? 'You must provide a type parameter' : U;
28
- type ɵTokenName<T> = string & RequireGeneric<T, string>;
29
- type ɵExtractTokenType<P> = P extends StateToken<infer T> ? T : never;
30
- /**
31
- * Options that can be provided to the store.
32
- */
33
- interface ɵStoreOptions<T> {
34
- /**
35
- * Name of the state. Required.
36
- */
37
- name: string | StateToken<T>;
38
- /**
39
- * Default values for the state. If not provided, uses empty object.
40
- */
41
- defaults?: T;
42
- /**
43
- * Sub states for the given state.
44
- *
45
- * @deprecated
46
- * Read the deprecation notice at this link: https://ngxs.io/deprecations/sub-states-deprecation.
47
- */
48
- children?: ɵStateClass[];
49
- }
50
- interface ɵStateClassInternal<T = any, U = any> extends ɵStateClass<T> {
51
- [ɵMETA_KEY]?: ɵMetaDataModel;
52
- [ɵMETA_OPTIONS_KEY]?: ɵStoreOptions<U>;
53
- }
54
- interface ɵMetaDataModel {
55
- name: string | null;
56
- actions: ɵPlainObjectOf<ɵActionHandlerMetaData[]>;
57
- defaults: any;
58
- path: string | null;
59
- makeRootSelector: ɵSelectorFactory | null;
60
- /** @deprecated */
61
- children?: ɵStateClassInternal[];
62
- }
63
- interface ɵSelectorMetaDataModel {
64
- makeRootSelector: ɵSelectorFactory | null;
65
- originalFn: Function | null;
66
- containerClass: any;
67
- selectorName: string | null;
68
- getSelectorOptions: () => ɵSharedSelectorOptions;
69
- }
70
- interface ɵSharedSelectorOptions {
71
- /**
72
- * @deprecated
73
- * Read the deprecation notice at this link: https://ngxs.io/deprecations/inject-container-state-deprecation.md.
74
- */
75
- injectContainerState?: boolean;
76
- suppressErrors?: boolean;
77
- }
78
- interface ɵRuntimeSelectorContext {
79
- getStateGetter(key: any): (state: any) => any;
80
- getSelectorOptions(localOptions?: ɵSharedSelectorOptions): ɵSharedSelectorOptions;
81
- }
82
- type ɵSelectFromRootState = (rootState: any) => any;
83
- type ɵSelectorFactory = (runtimeContext: ɵRuntimeSelectorContext) => ɵSelectFromRootState;
84
- /**
85
- * Actions that can be provided in a action decorator.
86
- */
87
- interface ɵActionOptions {
88
- /**
89
- * Cancel the previous uncompleted observable(s).
90
- */
91
- cancelUncompleted?: boolean;
92
- }
93
- interface ɵActionHandlerMetaData {
94
- fn: string | symbol;
95
- options: ɵActionOptions;
96
- type: string;
97
- }
98
-
99
- /**
100
- * Ensures metadata is attached to the class and returns it.
101
- *
102
- * @ignore
103
- */
104
- declare function ɵensureStoreMetadata(target: ɵStateClassInternal): ɵMetaDataModel;
105
- /**
106
- * Get the metadata attached to the state class if it exists.
107
- *
108
- * @ignore
109
- */
110
- declare function ɵgetStoreMetadata(target: ɵStateClassInternal): ɵMetaDataModel;
111
- /**
112
- * Ensures metadata is attached to the selector and returns it.
113
- *
114
- * @ignore
115
- */
116
- declare function ɵensureSelectorMetadata(target: Function): ɵSelectorMetaDataModel;
117
- /**
118
- * Get the metadata attached to the selector if it exists.
119
- *
120
- * @ignore
121
- */
122
- declare function ɵgetSelectorMetadata(target: any): ɵSelectorMetaDataModel;
123
-
124
- declare function defaultEqualityCheck(a: any, b: any): boolean;
125
- /**
126
- * Memoize a function on its last inputs only.
127
- * Originally from: https://github.com/reduxjs/reselect/blob/master/src/index.js
128
- *
129
- * @ignore
130
- */
131
- declare function ɵmemoize<T extends (...args: any[]) => any>(func: T, equalityCheck?: typeof defaultEqualityCheck): T;
132
-
133
- declare class ɵInitialState {
134
- private static _value;
135
- static set(state: ɵPlainObject): void;
136
- static pop(): ɵPlainObject;
137
- }
138
- declare const ɵINITIAL_STATE_TOKEN: InjectionToken<ɵPlainObject>;
139
-
140
- declare class ɵNgxsAppBootstrappedState extends ReplaySubject<boolean> {
141
- constructor();
142
- bootstrap(): void;
143
- static ɵfac: i0.ɵɵFactoryDeclaration<ɵNgxsAppBootstrappedState, never>;
144
- static ɵprov: i0.ɵɵInjectableDeclaration<ɵNgxsAppBootstrappedState>;
145
- }
146
-
147
- declare const ɵNGXS_STATE_FACTORY: InjectionToken<any>;
148
- declare const ɵNGXS_STATE_CONTEXT_FACTORY: InjectionToken<any>;
149
-
150
- /**
151
- * Custom Subject that ensures that subscribers are notified of values in the order that they arrived.
152
- * A standard Subject does not have this guarantee.
153
- * For example, given the following code:
154
- * ```typescript
155
- * const subject = new Subject<string>();
156
- subject.subscribe(value => {
157
- if (value === 'start') subject.next('end');
158
- });
159
- subject.subscribe(value => { });
160
- subject.next('start');
161
- * ```
162
- * When `subject` is a standard `Subject<T>` the second subscriber would recieve `end` and then `start`.
163
- * When `subject` is a `OrderedSubject<T>` the second subscriber would recieve `start` and then `end`.
164
- */
165
- declare class ɵOrderedSubject<T> extends Subject<T> {
166
- private _orderedNext;
167
- next(value?: T): void;
168
- }
169
- /**
170
- * Custom BehaviorSubject that ensures that subscribers are notified of values in the order that they arrived.
171
- * A standard BehaviorSubject does not have this guarantee.
172
- * For example, given the following code:
173
- * ```typescript
174
- * const subject = new BehaviorSubject<string>();
175
- subject.subscribe(value => {
176
- if (value === 'start') subject.next('end');
177
- });
178
- subject.subscribe(value => { });
179
- subject.next('start');
180
- * ```
181
- * When `subject` is a standard `BehaviorSubject<T>` the second subscriber would recieve `end` and then `start`.
182
- * When `subject` is a `OrderedBehaviorSubject<T>` the second subscriber would recieve `start` and then `end`.
183
- */
184
- declare class ɵOrderedBehaviorSubject<T> extends BehaviorSubject<T> {
185
- private _orderedNext;
186
- private _currentValue;
187
- constructor(value: T);
188
- getValue(): T;
189
- next(value: T): void;
190
- }
191
-
192
- /**
193
- * BehaviorSubject of the entire state.
194
- * @ignore
195
- */
196
- declare class ɵStateStream extends ɵOrderedBehaviorSubject<ɵPlainObject> implements OnDestroy {
197
- readonly state: Signal<ɵPlainObject>;
198
- constructor();
199
- ngOnDestroy(): void;
200
- static ɵfac: i0.ɵɵFactoryDeclaration<ɵStateStream, never>;
201
- static ɵprov: i0.ɵɵInjectableDeclaration<ɵStateStream>;
202
- }
203
-
204
- export { StateToken, type ɵActionHandlerMetaData, type ɵActionOptions, type ɵExtractTokenType, ɵINITIAL_STATE_TOKEN, ɵInitialState, ɵMETA_KEY, ɵMETA_OPTIONS_KEY, type ɵMetaDataModel, ɵNGXS_STATE_CONTEXT_FACTORY, ɵNGXS_STATE_FACTORY, ɵNgxsAppBootstrappedState, ɵOrderedBehaviorSubject, ɵOrderedSubject, type ɵPlainObject, type ɵPlainObjectOf, type ɵRuntimeSelectorContext, ɵSELECTOR_META_KEY, type ɵSelectFromRootState, type ɵSelectorFactory, type ɵSelectorMetaDataModel, type ɵSharedSelectorOptions, type ɵStateClass, type ɵStateClassInternal, ɵStateStream, type ɵStateToken, type ɵStoreOptions, type ɵTokenName, ɵensureSelectorMetadata, ɵensureStoreMetadata, ɵgetSelectorMetadata, ɵgetStoreMetadata, ɵmemoize };
1
+ export * from './symbols';
2
+ export * from './metadata';
3
+ export { ɵmemoize } from './memoize';
4
+ export { StateToken } from './state-token';
5
+ export { ɵINITIAL_STATE_TOKEN, ɵInitialState } from './initial-state';
6
+ export { ɵNgxsAppBootstrappedState } from './ngxs-app-bootstrapped-state';
7
+ export { ɵNGXS_STATE_CONTEXT_FACTORY, ɵNGXS_STATE_FACTORY } from './internal-tokens';
8
+ export { ɵOrderedSubject, ɵOrderedBehaviorSubject } from './custom-rxjs-subjects';
9
+ export { ɵStateStream } from './state-stream';
@@ -0,0 +1,8 @@
1
+ import { InjectionToken } from '@angular/core';
2
+ import { ɵPlainObject } from './symbols';
3
+ export declare class ɵInitialState {
4
+ private static _value;
5
+ static set(state: ɵPlainObject): void;
6
+ static pop(): ɵPlainObject;
7
+ }
8
+ export declare const ɵINITIAL_STATE_TOKEN: InjectionToken<ɵPlainObject>;
@@ -0,0 +1,3 @@
1
+ import { InjectionToken } from '@angular/core';
2
+ export declare const ɵNGXS_STATE_FACTORY: InjectionToken<any>;
3
+ export declare const ɵNGXS_STATE_CONTEXT_FACTORY: InjectionToken<any>;
@@ -0,0 +1,9 @@
1
+ declare function defaultEqualityCheck(a: any, b: any): boolean;
2
+ /**
3
+ * Memoize a function on its last inputs only.
4
+ * Originally from: https://github.com/reduxjs/reselect/blob/master/src/index.js
5
+ *
6
+ * @ignore
7
+ */
8
+ export declare function ɵmemoize<T extends (...args: any[]) => any>(func: T, equalityCheck?: typeof defaultEqualityCheck): T;
9
+ export {};
@@ -0,0 +1,25 @@
1
+ import { ɵMetaDataModel, ɵStateClassInternal, ɵSelectorMetaDataModel } from './symbols';
2
+ /**
3
+ * Ensures metadata is attached to the class and returns it.
4
+ *
5
+ * @ignore
6
+ */
7
+ export declare function ɵensureStoreMetadata(target: ɵStateClassInternal): ɵMetaDataModel;
8
+ /**
9
+ * Get the metadata attached to the state class if it exists.
10
+ *
11
+ * @ignore
12
+ */
13
+ export declare function ɵgetStoreMetadata(target: ɵStateClassInternal): ɵMetaDataModel;
14
+ /**
15
+ * Ensures metadata is attached to the selector and returns it.
16
+ *
17
+ * @ignore
18
+ */
19
+ export declare function ɵensureSelectorMetadata(target: Function): ɵSelectorMetaDataModel;
20
+ /**
21
+ * Get the metadata attached to the selector if it exists.
22
+ *
23
+ * @ignore
24
+ */
25
+ export declare function ɵgetSelectorMetadata(target: any): ɵSelectorMetaDataModel;
@@ -0,0 +1,8 @@
1
+ import { ReplaySubject } from 'rxjs';
2
+ import * as i0 from "@angular/core";
3
+ export declare class ɵNgxsAppBootstrappedState extends ReplaySubject<boolean> {
4
+ constructor();
5
+ bootstrap(): void;
6
+ static ɵfac: i0.ɵɵFactoryDeclaration<ɵNgxsAppBootstrappedState, never>;
7
+ static ɵprov: i0.ɵɵInjectableDeclaration<ɵNgxsAppBootstrappedState>;
8
+ }
@@ -0,0 +1,15 @@
1
+ import { OnDestroy, Signal } from '@angular/core';
2
+ import { ɵPlainObject } from './symbols';
3
+ import { ɵOrderedBehaviorSubject } from './custom-rxjs-subjects';
4
+ import * as i0 from "@angular/core";
5
+ /**
6
+ * BehaviorSubject of the entire state.
7
+ * @ignore
8
+ */
9
+ export declare class ɵStateStream extends ɵOrderedBehaviorSubject<ɵPlainObject> implements OnDestroy {
10
+ readonly state: Signal<ɵPlainObject>;
11
+ constructor();
12
+ ngOnDestroy(): void;
13
+ static ɵfac: i0.ɵɵFactoryDeclaration<ɵStateStream, never>;
14
+ static ɵprov: i0.ɵɵInjectableDeclaration<ɵStateStream>;
15
+ }
@@ -0,0 +1,7 @@
1
+ import type { ɵTokenName } from './symbols';
2
+ export declare class StateToken<T = void> {
3
+ private readonly _name;
4
+ constructor(_name: ɵTokenName<T>);
5
+ getName(): string;
6
+ toString(): string;
7
+ }
@@ -0,0 +1,88 @@
1
+ import type { StateToken } from './state-token';
2
+ export interface ɵPlainObject {
3
+ [key: string]: any;
4
+ }
5
+ export interface ɵPlainObjectOf<T> {
6
+ [key: string]: T;
7
+ }
8
+ export type ɵStateClass<T = any> = new (...args: any[]) => T;
9
+ export declare const ɵMETA_KEY = "NGXS_META";
10
+ export declare const ɵMETA_OPTIONS_KEY = "NGXS_OPTIONS_META";
11
+ export declare const ɵSELECTOR_META_KEY = "NGXS_SELECTOR_META";
12
+ export interface ɵStateToken<T, U> {
13
+ new (name: ɵTokenName<T>): U;
14
+ getName(): string;
15
+ toString(): string;
16
+ }
17
+ type RequireGeneric<T, U> = T extends void ? 'You must provide a type parameter' : U;
18
+ export type ɵTokenName<T> = string & RequireGeneric<T, string>;
19
+ export type ɵExtractTokenType<P> = P extends StateToken<infer T> ? T : never;
20
+ /**
21
+ * Options that can be provided to the store.
22
+ */
23
+ export interface ɵStoreOptions<T> {
24
+ /**
25
+ * Name of the state. Required.
26
+ */
27
+ name: string | StateToken<T>;
28
+ /**
29
+ * Default values for the state. If not provided, uses empty object.
30
+ */
31
+ defaults?: T;
32
+ /**
33
+ * Sub states for the given state.
34
+ *
35
+ * @deprecated
36
+ * Read the deprecation notice at this link: https://ngxs.io/deprecations/sub-states-deprecation.
37
+ */
38
+ children?: ɵStateClass[];
39
+ }
40
+ export interface ɵStateClassInternal<T = any, U = any> extends ɵStateClass<T> {
41
+ [ɵMETA_KEY]?: ɵMetaDataModel;
42
+ [ɵMETA_OPTIONS_KEY]?: ɵStoreOptions<U>;
43
+ }
44
+ export interface ɵMetaDataModel {
45
+ name: string | null;
46
+ actions: ɵPlainObjectOf<ɵActionHandlerMetaData[]>;
47
+ defaults: any;
48
+ path: string | null;
49
+ makeRootSelector: ɵSelectorFactory | null;
50
+ /** @deprecated */
51
+ children?: ɵStateClassInternal[];
52
+ }
53
+ export interface ɵSelectorMetaDataModel {
54
+ makeRootSelector: ɵSelectorFactory | null;
55
+ originalFn: Function | null;
56
+ containerClass: any;
57
+ selectorName: string | null;
58
+ getSelectorOptions: () => ɵSharedSelectorOptions;
59
+ }
60
+ export interface ɵSharedSelectorOptions {
61
+ /**
62
+ * @deprecated
63
+ * Read the deprecation notice at this link: https://ngxs.io/deprecations/inject-container-state-deprecation.md.
64
+ */
65
+ injectContainerState?: boolean;
66
+ suppressErrors?: boolean;
67
+ }
68
+ export interface ɵRuntimeSelectorContext {
69
+ getStateGetter(key: any): (state: any) => any;
70
+ getSelectorOptions(localOptions?: ɵSharedSelectorOptions): ɵSharedSelectorOptions;
71
+ }
72
+ export type ɵSelectFromRootState = (rootState: any) => any;
73
+ export type ɵSelectorFactory = (runtimeContext: ɵRuntimeSelectorContext) => ɵSelectFromRootState;
74
+ /**
75
+ * Actions that can be provided in a action decorator.
76
+ */
77
+ export interface ɵActionOptions {
78
+ /**
79
+ * Cancel the previous uncompleted observable(s).
80
+ */
81
+ cancelUncompleted?: boolean;
82
+ }
83
+ export interface ɵActionHandlerMetaData {
84
+ fn: string | symbol;
85
+ options: ɵActionOptions;
86
+ type: string;
87
+ }
88
+ export {};
@@ -0,0 +1 @@
1
+ export declare function freshPlatform(fn: (done?: VoidFunction) => Promise<void>): () => Promise<void>;
@@ -0,0 +1,8 @@
1
+ import { AfterViewInit, OnInit } from '@angular/core';
2
+ import * as i0 from "@angular/core";
3
+ export declare class NgxsTestComponent implements OnInit, AfterViewInit {
4
+ ngOnInit(): void;
5
+ ngAfterViewInit(): void;
6
+ static ɵfac: i0.ɵɵFactoryDeclaration<NgxsTestComponent, never>;
7
+ static ɵcmp: i0.ɵɵComponentDeclaration<NgxsTestComponent, "app-root", never, {}, {}, never, never, false, never>;
8
+ }
@@ -0,0 +1,10 @@
1
+ import { ApplicationRef } from '@angular/core';
2
+ import * as i0 from "@angular/core";
3
+ import * as i1 from "./ngxs-test.component";
4
+ import * as i2 from "@angular/platform-browser";
5
+ export declare class NgxsTestModule {
6
+ static ngDoBootstrap(app: ApplicationRef): void;
7
+ static ɵfac: i0.ɵɵFactoryDeclaration<NgxsTestModule, never>;
8
+ static ɵmod: i0.ɵɵNgModuleDeclaration<NgxsTestModule, [typeof i1.NgxsTestComponent], [typeof i2.BrowserModule], never>;
9
+ static ɵinj: i0.ɵɵInjectorDeclaration<NgxsTestModule>;
10
+ }
@@ -1,28 +1,4 @@
1
- import { Store, NgxsModuleOptions } from '@ngxs/store';
2
- import { ModuleWithProviders } from '@angular/core';
3
- import { TestBedStatic } from '@angular/core/testing';
4
- import { ɵStateClass as _StateClass } from '@ngxs/store/internals';
5
-
6
- declare function freshPlatform(fn: (done?: VoidFunction) => Promise<void>): () => Promise<void>;
7
-
8
- interface NgxsOptionsTesting {
9
- states?: _StateClass[];
10
- ngxsOptions?: NgxsModuleOptions;
11
- imports?: ModuleWithProviders<any>[];
12
- before?: () => void;
13
- }
14
- interface NgxsTesting {
15
- store: Store;
16
- getTestBed: TestBedStatic;
17
- }
18
-
19
- declare class NgxsTestBed {
20
- static configureTestingStates(options: NgxsOptionsTesting): NgxsTesting;
21
- private static ngxsBootstrap;
22
- private static resetTestBed;
23
- private static createRootNode;
24
- }
25
-
26
- declare function skipConsoleLogging<T extends (...args: any[]) => any>(fn: T): ReturnType<T>;
27
-
28
- export { NgxsTestBed, type NgxsTesting, freshPlatform, skipConsoleLogging };
1
+ export { freshPlatform } from './fresh-platform';
2
+ export { NgxsTestBed } from './ngxs.setup';
3
+ export { skipConsoleLogging } from './skip-console-logging';
4
+ export { NgxsTesting } from './symbol';
@@ -0,0 +1,7 @@
1
+ import { NgxsOptionsTesting, NgxsTesting } from './symbol';
2
+ export declare class NgxsTestBed {
3
+ static configureTestingStates(options: NgxsOptionsTesting): NgxsTesting;
4
+ private static ngxsBootstrap;
5
+ private static resetTestBed;
6
+ private static createRootNode;
7
+ }
@@ -0,0 +1 @@
1
+ export declare function skipConsoleLogging<T extends (...args: any[]) => any>(fn: T): ReturnType<T>;
@@ -0,0 +1,14 @@
1
+ import { NgxsModuleOptions, Store } from '@ngxs/store';
2
+ import { ModuleWithProviders } from '@angular/core';
3
+ import { TestBedStatic } from '@angular/core/testing';
4
+ import { ɵStateClass } from '@ngxs/store/internals';
5
+ export interface NgxsOptionsTesting {
6
+ states?: ɵStateClass[];
7
+ ngxsOptions?: NgxsModuleOptions;
8
+ imports?: ModuleWithProviders<any>[];
9
+ before?: () => void;
10
+ }
11
+ export interface NgxsTesting {
12
+ store: Store;
13
+ getTestBed: TestBedStatic;
14
+ }
@@ -0,0 +1,5 @@
1
+ import { NoInfer, StateOperator } from './types';
2
+ /**
3
+ * @param items - Specific items to append to the end of an array
4
+ */
5
+ export declare function append<T>(items: NoInfer<T[]>): StateOperator<T[]>;
@@ -0,0 +1,2 @@
1
+ import { NoInfer, StateOperator } from './types';
2
+ export declare function compose<T>(...operators: NoInfer<StateOperator<T>[]>): StateOperator<T>;
@@ -0,0 +1,10 @@
1
+ import { NoInfer, StateOperator } from './types';
2
+ import { Predicate } from './utils';
3
+ /**
4
+ * @param condition - Condition can be a plain boolean value or a function,
5
+ * that returns boolean, also this function can take a value as an argument
6
+ * to which this state operator applies
7
+ * @param trueOperatorOrValue - Any value or a state operator
8
+ * @param elseOperatorOrValue - Any value or a state operator
9
+ */
10
+ export declare function iif<T>(condition: NoInfer<Predicate<T>> | boolean, trueOperatorOrValue: NoInfer<StateOperator<T> | T>, elseOperatorOrValue?: NoInfer<StateOperator<T> | T>): StateOperator<T>;
@@ -1,102 +1,14 @@
1
- type _NoInfer<T> = T extends infer S ? S : never;
2
1
  /**
3
- * Blocks the ability of the typescript inferrence engine to be able to use the provided type as part of
4
- * inferring any type parameters from this usage.
5
- * @example
6
- * Primarily used to wrap parameters of functions in order to prevent the TypeScript inferrence engine
7
- * from inferring a type parameter of the function from the value provided to this parameter.
8
- * This essentially blocks the Contravariance of the function (through its parameters) so that the
9
- * function type parameter is purely determined by the Covariant requirements of the function's return type.
10
- * This is key to creating `StateOperator`s that are typed based on their contextual usage and not on the arguments
11
- * provided to them. This is critical for type safety and intellisense for State Operators.
12
- * Here is an example of how this benefits a state operator:
13
- * ```ts
14
- * declare function append<T>(items: NoInfer<T[]>): StateOperator<T[]>;
15
- * declare function appendBad<T>(items: T[]): StateOperator<T[]>;
16
- *
17
- * interface AAA {
18
- * foo?: boolean;
19
- * bar?: boolean;
20
- * }
21
- *
22
- * // Works
23
- * // (T in append is correctly inferred as AAA)
24
- * patch<{ test: AAA[] }>({ test: append([{ foo: true }]) });
25
- *
26
- * // Incorrectly throws: Type 'AAA' is not assignable to type '{ foo: true; }'.ts(2322)
27
- * // (T in appendBad is incorrectly inferred as { foo: true; })
28
- * patch<{ test: AAA[] }>({ test: appendBad([{ foo: true }]) });
29
- * ```
30
- *
31
- */
32
- type NoInfer<T> = T extends (infer O)[] ? _NoInfer<O>[] : _NoInfer<T>;
33
- /**
34
- * IMPORTANT NOTE: This should not be used externally to the library, rather
35
- * the exported type `ExistingState<T>` should be used instead.
36
- *
37
- * Used to convert a type to its readonly form. This can be given any type, from
38
- * primitives to objects or arrays that could already be readonly or not.
39
- * This does not apply the readonly construct to nested objects, but only to the top level type.
40
- */
41
- type ɵAsReadonly<T> = T extends Readonly<infer O> ? (O extends T ? Readonly<T> : T) : T;
42
- /**
43
- * Represents the existing state that is passed into a `StateOperator` which should
44
- * not be modified but will be used to build the new state returned by the `StateOperator`.
45
- */
46
- type ExistingState<T> = T extends any ? ɵAsReadonly<T> : never;
47
- /**
48
- * This is a monotype unary function that is used to create a new state from an existing state.
49
- * A state operator is usually created by a function that is given some data
50
- * to integrate with the state and returns a state operator which integrates this data or instruction.
51
- *
52
- * In state management terminology this creator function is commonly referred to as a state operator
53
- * because it represents the operation to be performed. ie. `patch`, `append`, `insertItem`, `compose`, `iif`, etc.
54
- */
55
- type StateOperator<T> = (existing: ExistingState<T>) => T;
56
-
57
- /**
58
- * @param items - Specific items to append to the end of an array
59
- */
60
- declare function append<T>(items: NoInfer<T[]>): StateOperator<T[]>;
61
-
62
- declare function compose<T>(...operators: NoInfer<StateOperator<T>[]>): StateOperator<T>;
63
-
64
- type Predicate<T = any> = (value: T | Readonly<T>) => boolean;
65
- declare function isStateOperator<T>(value: T | StateOperator<T>): value is StateOperator<T>;
66
- declare function isPredicate<T>(value: Predicate<T> | boolean | number): value is Predicate<T>;
67
-
68
- /**
69
- * @param condition - Condition can be a plain boolean value or a function,
70
- * that returns boolean, also this function can take a value as an argument
71
- * to which this state operator applies
72
- * @param trueOperatorOrValue - Any value or a state operator
73
- * @param elseOperatorOrValue - Any value or a state operator
74
- */
75
- declare function iif<T>(condition: NoInfer<Predicate<T>> | boolean, trueOperatorOrValue: NoInfer<StateOperator<T> | T>, elseOperatorOrValue?: NoInfer<StateOperator<T> | T>): StateOperator<T>;
76
-
77
- /**
78
- * @param value - Value to insert
79
- * @param [beforePosition] - Specified index to insert value before, optional
80
- */
81
- declare function insertItem<T>(value: NoInfer<T>, beforePosition?: number): StateOperator<T[]>;
82
-
83
- type NotUndefined<T> = T extends undefined ? never : T;
84
- type ɵPatchSpec<T> = {
85
- [P in keyof T]?: T[P] | StateOperator<NotUndefined<T[P]>>;
86
- };
87
- declare function patch<T extends Record<string, any>>(patchObject: NoInfer<ɵPatchSpec<T>>): StateOperator<T>;
88
-
89
- /**
90
- * @param selector - Index of item in the array or a predicate function
91
- * that can be provided in `Array.prototype.findIndex`
92
- * @param operatorOrValue - New value under the `selector` index or a
93
- * function that can be applied to an existing value
94
- */
95
- declare function updateItem<T>(selector: number | NoInfer<Predicate<T>>, operatorOrValue: NoInfer<T> | NoInfer<StateOperator<T>>): StateOperator<T[]>;
96
-
97
- /**
98
- * @param selector - index or predicate to remove an item from an array by
99
- */
100
- declare function removeItem<T>(selector: number | NoInfer<Predicate<T>>): StateOperator<T[]>;
101
-
102
- export { type ExistingState, type NoInfer, type Predicate, type StateOperator, append, compose, iif, insertItem, isPredicate, isStateOperator, patch, removeItem, updateItem, type ɵPatchSpec };
2
+ * @module
3
+ * @description
4
+ * Entry point for all public APIs of this package.
5
+ */
6
+ export { append } from './append';
7
+ export { compose } from './compose';
8
+ export { iif } from './iif';
9
+ export { insertItem } from './insert-item';
10
+ export { patch, ɵPatchSpec } from './patch';
11
+ export { isStateOperator, isPredicate, Predicate } from './utils';
12
+ export { updateItem } from './update-item';
13
+ export { removeItem } from './remove-item';
14
+ export { ExistingState, NoInfer, StateOperator } from './types';
@@ -0,0 +1,6 @@
1
+ import { NoInfer, StateOperator } from './types';
2
+ /**
3
+ * @param value - Value to insert
4
+ * @param [beforePosition] - Specified index to insert value before, optional
5
+ */
6
+ export declare function insertItem<T>(value: NoInfer<T>, beforePosition?: number): StateOperator<T[]>;