@ngxs/store 3.8.2-dev.master-25397f3 → 3.8.2-dev.master-397e451
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.
- package/index.d.ts +6 -757
- package/internals/custom-rxjs-subjects.d.ts +42 -0
- package/internals/index.d.ts +9 -204
- package/internals/initial-state.d.ts +8 -0
- package/internals/internal-tokens.d.ts +3 -0
- package/internals/memoize.d.ts +9 -0
- package/internals/metadata.d.ts +25 -0
- package/internals/ngxs-app-bootstrapped-state.d.ts +8 -0
- package/internals/state-stream.d.ts +15 -0
- package/internals/state-token.d.ts +7 -0
- package/internals/symbols.d.ts +88 -0
- package/internals/testing/fresh-platform.d.ts +1 -0
- package/internals/testing/helpers/ngxs-test.component.d.ts +8 -0
- package/internals/testing/helpers/ngxs-test.module.d.ts +10 -0
- package/internals/testing/index.d.ts +4 -28
- package/internals/testing/ngxs.setup.d.ts +7 -0
- package/internals/testing/skip-console-logging.d.ts +1 -0
- package/internals/testing/symbol.d.ts +14 -0
- package/operators/append.d.ts +5 -0
- package/operators/compose.d.ts +2 -0
- package/operators/iif.d.ts +10 -0
- package/operators/index.d.ts +13 -101
- package/operators/insert-item.d.ts +6 -0
- package/operators/patch.d.ts +7 -0
- package/operators/remove-item.d.ts +6 -0
- package/operators/types.d.ts +56 -0
- package/operators/update-item.d.ts +9 -0
- package/operators/utils.d.ts +8 -0
- package/package.json +2 -2
- package/plugins/actions.d.ts +15 -0
- package/plugins/index.d.ts +3 -62
- package/plugins/symbols.d.ts +13 -0
- package/plugins/utils.d.ts +29 -0
- package/schematics/src/actions/actions.factory.d.ts +3 -0
- package/schematics/src/ng-add/add-declaration.d.ts +4 -0
- package/schematics/src/ng-add/ng-add.factory.d.ts +9 -0
- package/schematics/src/starter-kit/starter-kit.factory.d.ts +3 -0
- package/schematics/src/state/state.factory.d.ts +3 -0
- package/schematics/src/store/store.factory.d.ts +3 -0
- package/schematics/src/utils/common/lib.config.d.ts +10 -0
- package/schematics/src/utils/common/project-files.config.d.ts +3 -0
- package/schematics/src/utils/common/properties.d.ts +1 -0
- package/schematics/src/utils/config.d.ts +119 -0
- package/schematics/src/utils/generate-utils.d.ts +4 -0
- package/schematics/src/utils/interfaces/package.interface.d.ts +7 -0
- package/schematics/src/utils/ng-utils/ast-utils.d.ts +99 -0
- package/schematics/src/utils/ng-utils/ng-ast-utils.d.ts +5 -0
- package/schematics/src/utils/ng-utils/project.d.ts +2 -0
- package/schematics/src/utils/ng-utils/standalone/app_config.d.ts +16 -0
- package/schematics/src/utils/ng-utils/standalone/code_block.d.ts +46 -0
- package/schematics/src/utils/ng-utils/standalone/index.d.ts +1 -0
- package/schematics/src/utils/ng-utils/standalone/rules.d.ts +38 -0
- package/schematics/src/utils/ng-utils/standalone/util.d.ts +28 -0
- package/schematics/src/utils/normalize-options.d.ts +11 -0
- package/schematics/src/utils/project.d.ts +19 -0
- package/src/actions/symbols.d.ts +7 -0
- package/src/actions-stream.d.ts +37 -0
- package/src/configs/messages.config.d.ts +13 -0
- package/src/decorators/action.d.ts +30 -0
- package/src/decorators/select/select-factory.d.ts +16 -0
- package/src/decorators/select/select.d.ts +7 -0
- package/src/decorators/select/symbols.d.ts +9 -0
- package/src/decorators/selector/selector.d.ts +9 -0
- package/src/decorators/selector/symbols.d.ts +73 -0
- package/src/decorators/selector-options.d.ts +5 -0
- package/src/decorators/state.d.ts +5 -0
- package/src/dev-features/ngxs-development.module.d.ts +10 -0
- package/src/dev-features/ngxs-unhandled-actions-logger.d.ts +17 -0
- package/src/dev-features/symbols.d.ts +8 -0
- package/src/execution/dispatch-outside-zone-ngxs-execution-strategy.d.ts +14 -0
- package/src/execution/internal-ngxs-execution-strategy.d.ts +10 -0
- package/src/execution/noop-ngxs-execution-strategy.d.ts +8 -0
- package/src/execution/symbols.d.ts +16 -0
- package/src/internal/dispatcher.d.ts +36 -0
- package/src/internal/fallback-subscriber.d.ts +3 -0
- package/src/internal/internals.d.ts +105 -0
- package/src/internal/lifecycle-state-manager.d.ts +24 -0
- package/src/internal/state-context-factory.d.ts +18 -0
- package/src/internal/state-factory.d.ts +61 -0
- package/src/internal/state-operations.d.ts +21 -0
- package/src/internal/state-operators.d.ts +2 -0
- package/src/internal/unhandled-rxjs-error-callback.d.ts +2 -0
- package/src/ivy/ivy-enabled-in-dev-mode.d.ts +6 -0
- package/src/module.d.ts +13 -0
- package/src/modules/ngxs-feature.module.d.ts +10 -0
- package/src/modules/ngxs-root.module.d.ts +10 -0
- package/src/ngxs-unhandled-error-handler.d.ts +16 -0
- package/src/operators/leave-ngxs.d.ts +7 -0
- package/src/operators/of-action.d.ts +56 -0
- package/src/plugin-manager.d.ts +13 -0
- package/src/plugin_api.d.ts +1 -0
- package/src/private_api.d.ts +3 -0
- package/src/public_api.d.ts +23 -0
- package/src/selectors/create-model-selector.d.ts +10 -0
- package/src/selectors/create-pick-selector.d.ts +6 -0
- package/src/selectors/create-property-selectors.d.ts +5 -0
- package/src/selectors/create-selector.d.ts +19 -0
- package/src/selectors/index.d.ts +5 -0
- package/src/selectors/private_api.d.ts +7 -0
- package/src/selectors/selector-checks.util.d.ts +9 -0
- package/src/selectors/selector-metadata.d.ts +7 -0
- package/src/selectors/selector-models.d.ts +10 -0
- package/src/selectors/selector-types.util.d.ts +6 -0
- package/src/selectors/selector-utils.d.ts +9 -0
- package/src/standalone-features/feature-providers.d.ts +7 -0
- package/src/standalone-features/index.d.ts +4 -0
- package/src/standalone-features/initializers.d.ts +29 -0
- package/src/standalone-features/plugin.d.ts +17 -0
- package/src/standalone-features/preboot.d.ts +26 -0
- package/src/standalone-features/provide-states.d.ts +18 -0
- package/src/standalone-features/provide-store.d.ts +22 -0
- package/src/standalone-features/root-providers.d.ts +8 -0
- package/src/store.d.ts +60 -0
- package/src/symbols.d.ts +102 -0
- package/src/utils/compose.d.ts +23 -0
- package/src/utils/create-dispatch-map.d.ts +4 -0
- package/src/utils/create-select-map.d.ts +4 -0
- package/src/utils/dispatch.d.ts +2 -0
- package/src/utils/freeze.d.ts +5 -0
- package/src/utils/public_api.d.ts +4 -0
- package/src/utils/select.d.ts +16 -0
- package/src/utils/store-validators.d.ts +5 -0
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { Tree } from '@angular-devkit/schematics';
|
|
2
|
+
import * as ts from '@schematics/angular/third_party/github.com/Microsoft/TypeScript/lib/typescript';
|
|
3
|
+
import { Change } from '@schematics/angular/utility/change';
|
|
4
|
+
/**
|
|
5
|
+
* Finds the main file of a project.
|
|
6
|
+
* @param tree File tree for the project.
|
|
7
|
+
* @param projectName Name of the project in which to search.
|
|
8
|
+
*/
|
|
9
|
+
export declare function getMainFilePath(tree: Tree, projectName: string): Promise<string>;
|
|
10
|
+
/**
|
|
11
|
+
* Gets a TypeScript source file at a specific path.
|
|
12
|
+
* @param tree File tree of a project.
|
|
13
|
+
* @param path Path to the file.
|
|
14
|
+
*/
|
|
15
|
+
export declare function getSourceFile(tree: Tree, path: string): ts.SourceFile;
|
|
16
|
+
/** Finds the call to `bootstrapApplication` within a file. */
|
|
17
|
+
export declare function findBootstrapApplicationCall(tree: Tree, mainFilePath: string): ts.CallExpression;
|
|
18
|
+
/**
|
|
19
|
+
* Applies a set of changes to a file.
|
|
20
|
+
* @param tree File tree of the project.
|
|
21
|
+
* @param path Path to the file that is being changed.
|
|
22
|
+
* @param changes Changes that should be applied to the file.
|
|
23
|
+
*/
|
|
24
|
+
export declare function applyChangesToFile(tree: Tree, path: string, changes: Change[]): void;
|
|
25
|
+
/** Checks whether a node is a call to `mergeApplicationConfig`. */
|
|
26
|
+
export declare function isMergeAppConfigCall(node: ts.Node): node is ts.CallExpression;
|
|
27
|
+
/** Finds the `providers` array literal within an application config. */
|
|
28
|
+
export declare function findProvidersLiteral(config: ts.ObjectLiteralExpression): ts.ArrayLiteralExpression | null;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Tree } from '@angular-devkit/schematics';
|
|
2
|
+
interface BaseOptions {
|
|
3
|
+
name: string;
|
|
4
|
+
path?: string;
|
|
5
|
+
project?: string;
|
|
6
|
+
}
|
|
7
|
+
export declare function normalizeBaseOptions<T extends BaseOptions>(host: Tree, options: T): T & Required<BaseOptions>;
|
|
8
|
+
export declare function normalizePath(path: string | undefined): string;
|
|
9
|
+
/** Returns `value` if it's "true" | "false" and default value otherwise */
|
|
10
|
+
export declare function normalizeOptionalBoolean(value: boolean | undefined, defaultValue: boolean): boolean;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { TargetDefinition } from '@schematics/angular/utility/workspace';
|
|
2
|
+
import { Tree } from '@angular-devkit/schematics';
|
|
3
|
+
export interface WorkspaceProject {
|
|
4
|
+
name: string;
|
|
5
|
+
root: string;
|
|
6
|
+
projectType: string;
|
|
7
|
+
architect: {
|
|
8
|
+
[key: string]: TargetDefinition;
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
export declare function getProject(host: Tree, project?: string): WorkspaceProject | null;
|
|
12
|
+
export declare function getProjectData(host: Tree, options: {
|
|
13
|
+
project?: string | undefined;
|
|
14
|
+
path?: string | undefined;
|
|
15
|
+
}): {
|
|
16
|
+
project: string;
|
|
17
|
+
path: string;
|
|
18
|
+
} | null;
|
|
19
|
+
export declare function isLib(host: Tree, project?: string): boolean;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { OnDestroy } from '@angular/core';
|
|
2
|
+
import { ɵOrderedSubject } from '@ngxs/store/internals';
|
|
3
|
+
import { Observable } from 'rxjs';
|
|
4
|
+
import { InternalNgxsExecutionStrategy } from './execution/internal-ngxs-execution-strategy';
|
|
5
|
+
import * as i0 from "@angular/core";
|
|
6
|
+
/**
|
|
7
|
+
* Status of a dispatched action
|
|
8
|
+
*/
|
|
9
|
+
export declare const enum ActionStatus {
|
|
10
|
+
Dispatched = "DISPATCHED",
|
|
11
|
+
Successful = "SUCCESSFUL",
|
|
12
|
+
Canceled = "CANCELED",
|
|
13
|
+
Errored = "ERRORED"
|
|
14
|
+
}
|
|
15
|
+
export interface ActionContext<T = any> {
|
|
16
|
+
status: ActionStatus;
|
|
17
|
+
action: T;
|
|
18
|
+
error?: Error;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Internal Action stream that is emitted anytime an action is dispatched.
|
|
22
|
+
*/
|
|
23
|
+
export declare class InternalActions extends ɵOrderedSubject<ActionContext> implements OnDestroy {
|
|
24
|
+
ngOnDestroy(): void;
|
|
25
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<InternalActions, never>;
|
|
26
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<InternalActions>;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Action stream that is emitted anytime an action is dispatched.
|
|
30
|
+
*
|
|
31
|
+
* You can listen to this in services to react without stores.
|
|
32
|
+
*/
|
|
33
|
+
export declare class Actions extends Observable<ActionContext> {
|
|
34
|
+
constructor(internalActions$: InternalActions, internalExecutionStrategy: InternalNgxsExecutionStrategy);
|
|
35
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<Actions, never>;
|
|
36
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<Actions>;
|
|
37
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ɵPlainObject } from '@ngxs/store/internals';
|
|
2
|
+
export declare function throwStateNameError(name: string): never;
|
|
3
|
+
export declare function throwStateNamePropertyError(): never;
|
|
4
|
+
export declare function throwStateUniqueError(current: string, newName: string, oldName: string): never;
|
|
5
|
+
export declare function throwStateDecoratorError(name: string): never;
|
|
6
|
+
export declare function throwActionDecoratorError(): never;
|
|
7
|
+
export declare function throwSelectorDecoratorError(): never;
|
|
8
|
+
export declare function getZoneWarningMessage(): string;
|
|
9
|
+
export declare function getUndecoratedStateWithInjectableWarningMessage(name: string): string;
|
|
10
|
+
export declare function getInvalidInitializationOrderMessage(addedStates?: ɵPlainObject): string;
|
|
11
|
+
export declare function throwSelectFactoryNotConnectedError(): never;
|
|
12
|
+
export declare function throwPatchingArrayError(): never;
|
|
13
|
+
export declare function throwPatchingPrimitiveError(): never;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { ɵActionOptions } from '@ngxs/store/internals';
|
|
2
|
+
import { ActionDef, ActionType } from '../actions/symbols';
|
|
3
|
+
import { StateContext } from '../symbols';
|
|
4
|
+
/**
|
|
5
|
+
* Given an action class, returns its payload.
|
|
6
|
+
*/
|
|
7
|
+
type ActionToPayload<Action extends ActionType> = Action extends ActionDef<any, infer ActionPayload> ? ActionPayload : never;
|
|
8
|
+
/**
|
|
9
|
+
* Given a list of action classes, returns the union of their payloads.
|
|
10
|
+
*/
|
|
11
|
+
type ActionsToPayload<Actions extends readonly ActionType[]> = {
|
|
12
|
+
[K in keyof Actions]: ActionToPayload<Actions[K]>;
|
|
13
|
+
}[number];
|
|
14
|
+
/**
|
|
15
|
+
* Given an action class or a list of action classes, returns the union of their payloads.
|
|
16
|
+
*/
|
|
17
|
+
type ActionOrActionsToPayload<ActionOrActions> = ActionOrActions extends ActionType ? ActionToPayload<ActionOrActions> : ActionOrActions extends ActionType[] ? ActionsToPayload<ActionOrActions> : never;
|
|
18
|
+
/**
|
|
19
|
+
* Describes what methods can be decorated with an `@Action` decorator that has been passed the given action(s).
|
|
20
|
+
*/
|
|
21
|
+
type HandlerTypedPropertyDescriptor<ActionOrActions> = TypedPropertyDescriptor<() => any> | TypedPropertyDescriptor<(stateContext: StateContext<any>) => any> | TypedPropertyDescriptor<(stateContext: StateContext<any>, action: ActionOrActionsToPayload<ActionOrActions>) => any>;
|
|
22
|
+
/**
|
|
23
|
+
* The result of a call to the `@Action()` decorator with the given action(s) as its first argument.
|
|
24
|
+
*/
|
|
25
|
+
type ActionDecorator<ActionOrActions extends ActionType | ActionType[]> = (target: any, name: string | symbol, _descriptor: HandlerTypedPropertyDescriptor<ActionOrActions>) => void;
|
|
26
|
+
/**
|
|
27
|
+
* Decorates a method with action information.
|
|
28
|
+
*/
|
|
29
|
+
export declare function Action<ActionOrActions extends ActionType | ActionType[]>(actions: ActionOrActions, options?: ɵActionOptions): ActionDecorator<ActionOrActions>;
|
|
30
|
+
export {};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { OnDestroy } from '@angular/core';
|
|
2
|
+
import { Store } from '../../store';
|
|
3
|
+
import { NgxsConfig } from '../../symbols';
|
|
4
|
+
import * as i0 from "@angular/core";
|
|
5
|
+
/**
|
|
6
|
+
* Allows the select decorator to get access to the DI store, this is used internally
|
|
7
|
+
* in `@Select` decorator.
|
|
8
|
+
*/
|
|
9
|
+
export declare class SelectFactory implements OnDestroy {
|
|
10
|
+
static store: Store | null;
|
|
11
|
+
static config: NgxsConfig | null;
|
|
12
|
+
constructor(store: Store, config: NgxsConfig);
|
|
13
|
+
ngOnDestroy(): void;
|
|
14
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<SelectFactory, never>;
|
|
15
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<SelectFactory>;
|
|
16
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Decorator for selecting a slice of state from the store.
|
|
3
|
+
*
|
|
4
|
+
* @deprecated
|
|
5
|
+
* Read the deprecation notice at this link: https://ngxs.io/deprecations/select-decorator-deprecation.
|
|
6
|
+
*/
|
|
7
|
+
export declare function Select<T>(rawSelector?: T, ...paths: string[]): PropertyDecorator;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Observable } from 'rxjs';
|
|
2
|
+
import { ɵExtractTokenType, StateToken } from '@ngxs/store/internals';
|
|
3
|
+
export declare function createSelectObservable<T = any>(selector: any): Observable<T>;
|
|
4
|
+
export declare function createSelectorFn(name: string, rawSelector?: any, paths?: string[]): any;
|
|
5
|
+
/**
|
|
6
|
+
* @example If `foo$` => make it just `foo`
|
|
7
|
+
*/
|
|
8
|
+
export declare function removeDollarAtTheEnd(name: string): string;
|
|
9
|
+
export type PropertyType<T> = T extends StateToken<any> ? Observable<ɵExtractTokenType<T>> : T extends (...args: any[]) => any ? Observable<ReturnType<T>> : any;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { SelectorDefTuple, SelectorType } from './symbols';
|
|
2
|
+
/**
|
|
3
|
+
* Decorator for creating a state selector for the current state.
|
|
4
|
+
*/
|
|
5
|
+
export declare function Selector(): SelectorType<unknown>;
|
|
6
|
+
/**
|
|
7
|
+
* Decorator for creating a state selector from the provided selectors (and optionally the container State, depending on the applicable Selector Options).
|
|
8
|
+
*/
|
|
9
|
+
export declare function Selector<T extends SelectorDefTuple>(selectors: T): SelectorType<T>;
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { ɵSelectorDef, ɵSelectorReturnType } from '../../selectors';
|
|
2
|
+
/**
|
|
3
|
+
* Defines a tuple of selector functions, state tokens, and state classes that a selector decorated
|
|
4
|
+
* by `@Selector()` can depend on.
|
|
5
|
+
*/
|
|
6
|
+
export type SelectorDefTuple = ɵSelectorDef<any>[] | [ɵSelectorDef<any>];
|
|
7
|
+
type UnknownToAny<T> = unknown extends T ? any : T;
|
|
8
|
+
type EnsureArray<T> = T extends any[] ? T : never;
|
|
9
|
+
/**
|
|
10
|
+
* Given a tuple of selector functions, state tokens, state classes, etc., returns a tuple of what
|
|
11
|
+
* a dependent selector would expect to receive for that parent as an argument when called.
|
|
12
|
+
*
|
|
13
|
+
* For example, if the first element in `ParentsTuple` is a selector function that returns a
|
|
14
|
+
* `number`, then the first element of the result tuple will be `number`. If the second element
|
|
15
|
+
* in `ParentsTuple` is a state class with model `{ name: string }`, then the second element of
|
|
16
|
+
* the result tuple will be `{ name: string }`.
|
|
17
|
+
*/
|
|
18
|
+
type SelectorReturnTypeList<ParentsTuple extends SelectorDefTuple> = EnsureArray<{
|
|
19
|
+
[ParentsTupleIndex in keyof ParentsTuple]: ParentsTuple[ParentsTupleIndex] extends ɵSelectorDef<any> ? UnknownToAny<ɵSelectorReturnType<ParentsTuple[ParentsTupleIndex]>> : never;
|
|
20
|
+
}>;
|
|
21
|
+
/**
|
|
22
|
+
* Defines a selector function matching a given argument list of parent selectors/states/tokens
|
|
23
|
+
* and a given return type.
|
|
24
|
+
*/
|
|
25
|
+
export type SelectorSpec<ParentsTuple, Return> = ParentsTuple extends [] ? () => any : ParentsTuple extends SelectorDefTuple ? (...states: SelectorReturnTypeList<ParentsTuple>) => Return : () => any;
|
|
26
|
+
/**
|
|
27
|
+
* Defines a selector function matching `SelectorSpec<ParentsTuple, Return>` but with the assumption that the
|
|
28
|
+
* container state has been injected as the first argument.
|
|
29
|
+
*/
|
|
30
|
+
type SelectorSpecWithInjectedState<ParentsTuple, Return> = SelectorSpec<ParentsTuple extends SelectorDefTuple ? [any, ...ParentsTuple] : [any], ParentsTuple extends SelectorDefTuple ? Return : any>;
|
|
31
|
+
/**
|
|
32
|
+
* Defines a property descriptor for the `@Selector` decorator that decorates a function with
|
|
33
|
+
* parent selectors/states/tokens `ParentsTuple` and return type `Return`.
|
|
34
|
+
*/
|
|
35
|
+
type DescriptorWithNoInjectedState<ParentsTuple, Return> = TypedPropertyDescriptor<SelectorSpec<ParentsTuple, Return>>;
|
|
36
|
+
/**
|
|
37
|
+
* Same as `DescriptorWithNoInjectedState` but with state injected as the first argument.
|
|
38
|
+
*/
|
|
39
|
+
type DescriptorWithInjectedState<ParentsTuple, Return> = TypedPropertyDescriptor<SelectorSpecWithInjectedState<ParentsTuple, Return>>;
|
|
40
|
+
type DecoratorArgs<Descriptor> = [target: any, key: string | symbol, descriptor?: Descriptor];
|
|
41
|
+
/**
|
|
42
|
+
* Defines the return type of a call to `@Selector` when there is no argument given
|
|
43
|
+
* (e.g. `@Selector()` counts, but `@Selector([])` does not)
|
|
44
|
+
*
|
|
45
|
+
* This result is a decorator that can only be used to decorate a function with no arguments or a
|
|
46
|
+
* single argument that is the container state.
|
|
47
|
+
*/
|
|
48
|
+
type SelectorTypeNoDecoratorArgs = {
|
|
49
|
+
<Return>(...args: DecoratorArgs<DescriptorWithNoInjectedState<unknown, Return>>): void | DescriptorWithNoInjectedState<unknown, Return>;
|
|
50
|
+
<Return>(...args: DecoratorArgs<DescriptorWithInjectedState<unknown, Return>>): void | DescriptorWithInjectedState<unknown, Return>;
|
|
51
|
+
};
|
|
52
|
+
/**
|
|
53
|
+
* Defines the return type of a call to `@Selector` when there is an argument given.
|
|
54
|
+
* (e.g. `@Selector([])` counts, but `@Selector()` does not)
|
|
55
|
+
*
|
|
56
|
+
* This result is a decorator that can only be used to decorate a function with an argument list
|
|
57
|
+
* matching the results of the tuple of parents `ParentsTuple`.
|
|
58
|
+
*/
|
|
59
|
+
type SelectorTypeWithDecoratorArgs<ParentsTuple> = {
|
|
60
|
+
<Return>(...args: DecoratorArgs<DescriptorWithNoInjectedState<ParentsTuple, Return>>): void | DescriptorWithNoInjectedState<ParentsTuple, Return>;
|
|
61
|
+
/**
|
|
62
|
+
* @deprecated
|
|
63
|
+
* Read the deprecation notice at this link: https://ngxs.io/deprecations/inject-container-state-deprecation.md.
|
|
64
|
+
*/
|
|
65
|
+
<Return>(...args: DecoratorArgs<DescriptorWithInjectedState<ParentsTuple, Return>>): void | DescriptorWithInjectedState<ParentsTuple, Return>;
|
|
66
|
+
};
|
|
67
|
+
/**
|
|
68
|
+
* Defines the return type of a call to `@Selector`. This result is a decorator that can only be
|
|
69
|
+
* used to decorate a function with an argument list matching `ParentsTuple`, the results of the
|
|
70
|
+
* tuple of parent selectors/state tokens/state classes.
|
|
71
|
+
*/
|
|
72
|
+
export type SelectorType<ParentsTuple> = unknown extends ParentsTuple ? SelectorTypeNoDecoratorArgs : SelectorTypeWithDecoratorArgs<ParentsTuple>;
|
|
73
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ModuleWithProviders } from '@angular/core';
|
|
2
|
+
import { NgxsDevelopmentOptions } from './symbols';
|
|
3
|
+
import * as i0 from "@angular/core";
|
|
4
|
+
export declare class NgxsDevelopmentModule {
|
|
5
|
+
static forRoot(options: NgxsDevelopmentOptions): ModuleWithProviders<NgxsDevelopmentModule>;
|
|
6
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<NgxsDevelopmentModule, never>;
|
|
7
|
+
static ɵmod: i0.ɵɵNgModuleDeclaration<NgxsDevelopmentModule, never, never, never>;
|
|
8
|
+
static ɵinj: i0.ɵɵInjectorDeclaration<NgxsDevelopmentModule>;
|
|
9
|
+
}
|
|
10
|
+
export declare function withNgxsDevelopmentOptions(options: NgxsDevelopmentOptions): import("@angular/core").EnvironmentProviders;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { ActionType } from '../actions/symbols';
|
|
2
|
+
import { NgxsDevelopmentOptions } from './symbols';
|
|
3
|
+
import * as i0 from "@angular/core";
|
|
4
|
+
export declare class NgxsUnhandledActionsLogger {
|
|
5
|
+
/**
|
|
6
|
+
* These actions should be ignored by default; the user can increase this
|
|
7
|
+
* list in the future via the `ignoreActions` method.
|
|
8
|
+
*/
|
|
9
|
+
private _ignoredActions;
|
|
10
|
+
constructor(options: NgxsDevelopmentOptions);
|
|
11
|
+
/**
|
|
12
|
+
* Adds actions to the internal list of actions that should be ignored.
|
|
13
|
+
*/
|
|
14
|
+
ignoreActions(...actions: ActionType[]): void;
|
|
15
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<NgxsUnhandledActionsLogger, never>;
|
|
16
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<NgxsUnhandledActionsLogger>;
|
|
17
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { InjectionToken } from '@angular/core';
|
|
2
|
+
import { ActionType } from '../actions/symbols';
|
|
3
|
+
export interface NgxsDevelopmentOptions {
|
|
4
|
+
warnOnUnhandledActions: true | {
|
|
5
|
+
ignore: ActionType[];
|
|
6
|
+
};
|
|
7
|
+
}
|
|
8
|
+
export declare const NGXS_DEVELOPMENT_OPTIONS: InjectionToken<NgxsDevelopmentOptions>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { NgZone } from '@angular/core';
|
|
2
|
+
import { NgxsExecutionStrategy } from './symbols';
|
|
3
|
+
import * as i0 from "@angular/core";
|
|
4
|
+
export declare class DispatchOutsideZoneNgxsExecutionStrategy implements NgxsExecutionStrategy {
|
|
5
|
+
private _ngZone;
|
|
6
|
+
private _platformId;
|
|
7
|
+
constructor(_ngZone: NgZone, _platformId: string);
|
|
8
|
+
enter<T>(func: () => T): T;
|
|
9
|
+
leave<T>(func: () => T): T;
|
|
10
|
+
private runInsideAngular;
|
|
11
|
+
private runOutsideAngular;
|
|
12
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<DispatchOutsideZoneNgxsExecutionStrategy, never>;
|
|
13
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<DispatchOutsideZoneNgxsExecutionStrategy>;
|
|
14
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { NgxsExecutionStrategy } from './symbols';
|
|
2
|
+
import * as i0 from "@angular/core";
|
|
3
|
+
export declare class InternalNgxsExecutionStrategy implements NgxsExecutionStrategy {
|
|
4
|
+
private _executionStrategy;
|
|
5
|
+
constructor(_executionStrategy: NgxsExecutionStrategy);
|
|
6
|
+
enter<T>(func: () => T): T;
|
|
7
|
+
leave<T>(func: () => T): T;
|
|
8
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<InternalNgxsExecutionStrategy, never>;
|
|
9
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<InternalNgxsExecutionStrategy>;
|
|
10
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { NgxsExecutionStrategy } from './symbols';
|
|
2
|
+
import * as i0 from "@angular/core";
|
|
3
|
+
export declare class NoopNgxsExecutionStrategy implements NgxsExecutionStrategy {
|
|
4
|
+
enter<T>(func: () => T): T;
|
|
5
|
+
leave<T>(func: () => T): T;
|
|
6
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<NoopNgxsExecutionStrategy, never>;
|
|
7
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<NoopNgxsExecutionStrategy>;
|
|
8
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { InjectionToken, Type } from '@angular/core';
|
|
2
|
+
/**
|
|
3
|
+
* Consumers have the option to utilize the execution strategy provided by
|
|
4
|
+
* `NgxsModule.forRoot({executionStrategy})` or `provideStore([], {executionStrategy})`.
|
|
5
|
+
*/
|
|
6
|
+
export declare const CUSTOM_NGXS_EXECUTION_STRATEGY: InjectionToken<Type<NgxsExecutionStrategy> | undefined>;
|
|
7
|
+
/**
|
|
8
|
+
* The injection token is used internally to resolve an instance of the execution
|
|
9
|
+
* strategy. It checks whether consumers have provided their own `executionStrategy`
|
|
10
|
+
* and also verifies if we are operating in a zone-aware environment.
|
|
11
|
+
*/
|
|
12
|
+
export declare const NGXS_EXECUTION_STRATEGY: InjectionToken<NgxsExecutionStrategy>;
|
|
13
|
+
export interface NgxsExecutionStrategy {
|
|
14
|
+
enter<T>(func: () => T): T;
|
|
15
|
+
leave<T>(func: () => T): T;
|
|
16
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { NgZone } from '@angular/core';
|
|
2
|
+
import { Observable, Subject } from 'rxjs';
|
|
3
|
+
import { ɵStateStream } from '@ngxs/store/internals';
|
|
4
|
+
import { ActionContext, InternalActions } from '../actions-stream';
|
|
5
|
+
import { PluginManager } from '../plugin-manager';
|
|
6
|
+
import { InternalNgxsExecutionStrategy } from '../execution/internal-ngxs-execution-strategy';
|
|
7
|
+
import * as i0 from "@angular/core";
|
|
8
|
+
/**
|
|
9
|
+
* Internal Action result stream that is emitted when an action is completed.
|
|
10
|
+
* This is used as a method of returning the action result to the dispatcher
|
|
11
|
+
* for the observable returned by the dispatch(...) call.
|
|
12
|
+
* The dispatcher then asynchronously pushes the result from this stream onto the main action stream as a result.
|
|
13
|
+
*/
|
|
14
|
+
export declare class InternalDispatchedActionResults extends Subject<ActionContext> {
|
|
15
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<InternalDispatchedActionResults, never>;
|
|
16
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<InternalDispatchedActionResults>;
|
|
17
|
+
}
|
|
18
|
+
export declare class InternalDispatcher {
|
|
19
|
+
private _ngZone;
|
|
20
|
+
private _actions;
|
|
21
|
+
private _actionResults;
|
|
22
|
+
private _pluginManager;
|
|
23
|
+
private _stateStream;
|
|
24
|
+
private _ngxsExecutionStrategy;
|
|
25
|
+
constructor(_ngZone: NgZone, _actions: InternalActions, _actionResults: InternalDispatchedActionResults, _pluginManager: PluginManager, _stateStream: ɵStateStream, _ngxsExecutionStrategy: InternalNgxsExecutionStrategy);
|
|
26
|
+
/**
|
|
27
|
+
* Dispatches event(s).
|
|
28
|
+
*/
|
|
29
|
+
dispatch(actionOrActions: any | any[]): Observable<void>;
|
|
30
|
+
private dispatchByEvents;
|
|
31
|
+
private dispatchSingle;
|
|
32
|
+
private getActionResultStream;
|
|
33
|
+
private createDispatchObservable;
|
|
34
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<InternalDispatcher, never>;
|
|
35
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<InternalDispatcher>;
|
|
36
|
+
}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import { InjectionToken } from '@angular/core';
|
|
2
|
+
import { Observable } from 'rxjs';
|
|
3
|
+
import { ɵPlainObjectOf, ɵStateClassInternal, ɵActionHandlerMetaData } from '@ngxs/store/internals';
|
|
4
|
+
import { NgxsConfig } from '../symbols';
|
|
5
|
+
export type StateKeyGraph = ɵPlainObjectOf<string[]>;
|
|
6
|
+
export type StatesByName = ɵPlainObjectOf<ɵStateClassInternal>;
|
|
7
|
+
export interface StateOperations<T> {
|
|
8
|
+
getState(): T;
|
|
9
|
+
setState(val: T): void;
|
|
10
|
+
dispatch(actionOrActions: any | any[]): Observable<void>;
|
|
11
|
+
}
|
|
12
|
+
export interface MappedStore {
|
|
13
|
+
name: string;
|
|
14
|
+
isInitialised: boolean;
|
|
15
|
+
actions: ɵPlainObjectOf<ɵActionHandlerMetaData[]>;
|
|
16
|
+
defaults: any;
|
|
17
|
+
instance: any;
|
|
18
|
+
path: string;
|
|
19
|
+
}
|
|
20
|
+
export interface StatesAndDefaults {
|
|
21
|
+
defaults: any;
|
|
22
|
+
states: MappedStore[];
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Get a deeply nested value. Example:
|
|
26
|
+
*
|
|
27
|
+
* getValue({ foo: bar: [] }, 'foo.bar') //=> []
|
|
28
|
+
*
|
|
29
|
+
* @ignore
|
|
30
|
+
*
|
|
31
|
+
* Marked for removal. It's only used within `createSelectorFn`.
|
|
32
|
+
*/
|
|
33
|
+
export declare function propGetter(paths: string[], config: NgxsConfig): (x: any) => any;
|
|
34
|
+
export declare const ɵPROP_GETTER: InjectionToken<(paths: string[]) => (x: any) => any>;
|
|
35
|
+
/**
|
|
36
|
+
* Given an array of states, it will return a object graph. Example:
|
|
37
|
+
* const states = [
|
|
38
|
+
* Cart,
|
|
39
|
+
* CartSaved,
|
|
40
|
+
* CartSavedItems
|
|
41
|
+
* ]
|
|
42
|
+
*
|
|
43
|
+
* would return:
|
|
44
|
+
*
|
|
45
|
+
* const graph = {
|
|
46
|
+
* cart: ['saved'],
|
|
47
|
+
* saved: ['items'],
|
|
48
|
+
* items: []
|
|
49
|
+
* };
|
|
50
|
+
*
|
|
51
|
+
* @ignore
|
|
52
|
+
*/
|
|
53
|
+
export declare function buildGraph(stateClasses: ɵStateClassInternal[]): StateKeyGraph;
|
|
54
|
+
/**
|
|
55
|
+
* Given a states array, returns object graph
|
|
56
|
+
* returning the name and state metadata. Example:
|
|
57
|
+
*
|
|
58
|
+
* const graph = {
|
|
59
|
+
* cart: { metadata }
|
|
60
|
+
* };
|
|
61
|
+
*
|
|
62
|
+
* @ignore
|
|
63
|
+
*/
|
|
64
|
+
export declare function nameToState(states: ɵStateClassInternal[]): ɵPlainObjectOf<ɵStateClassInternal>;
|
|
65
|
+
/**
|
|
66
|
+
* Given a object relationship graph will return the full path
|
|
67
|
+
* for the child items. Example:
|
|
68
|
+
*
|
|
69
|
+
* const graph = {
|
|
70
|
+
* cart: ['saved'],
|
|
71
|
+
* saved: ['items'],
|
|
72
|
+
* items: []
|
|
73
|
+
* };
|
|
74
|
+
*
|
|
75
|
+
* would return:
|
|
76
|
+
*
|
|
77
|
+
* const r = {
|
|
78
|
+
* cart: 'cart',
|
|
79
|
+
* saved: 'cart.saved',
|
|
80
|
+
* items: 'cart.saved.items'
|
|
81
|
+
* };
|
|
82
|
+
*
|
|
83
|
+
* @ignore
|
|
84
|
+
*/
|
|
85
|
+
export declare function findFullParentPath(obj: StateKeyGraph, newObj?: ɵPlainObjectOf<string>): ɵPlainObjectOf<string>;
|
|
86
|
+
/**
|
|
87
|
+
* Given a object graph, it will return the items topologically sorted Example:
|
|
88
|
+
*
|
|
89
|
+
* const graph = {
|
|
90
|
+
* cart: ['saved'],
|
|
91
|
+
* saved: ['items'],
|
|
92
|
+
* items: []
|
|
93
|
+
* };
|
|
94
|
+
*
|
|
95
|
+
* would return:
|
|
96
|
+
*
|
|
97
|
+
* const results = [
|
|
98
|
+
* 'items',
|
|
99
|
+
* 'saved',
|
|
100
|
+
* 'cart'
|
|
101
|
+
* ];
|
|
102
|
+
*
|
|
103
|
+
* @ignore
|
|
104
|
+
*/
|
|
105
|
+
export declare function topologicalSort(graph: StateKeyGraph): string[];
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { OnDestroy } from '@angular/core';
|
|
2
|
+
import { ɵNgxsAppBootstrappedState } from '@ngxs/store/internals';
|
|
3
|
+
import { InitState, UpdateState } from '@ngxs/store/plugins';
|
|
4
|
+
import { Store } from '../store';
|
|
5
|
+
import { StateContextFactory } from './state-context-factory';
|
|
6
|
+
import { InternalStateOperations } from './state-operations';
|
|
7
|
+
import { StatesAndDefaults } from './internals';
|
|
8
|
+
import * as i0 from "@angular/core";
|
|
9
|
+
export declare class LifecycleStateManager implements OnDestroy {
|
|
10
|
+
private _store;
|
|
11
|
+
private _internalStateOperations;
|
|
12
|
+
private _stateContextFactory;
|
|
13
|
+
private _appBootstrappedState;
|
|
14
|
+
private readonly _destroy$;
|
|
15
|
+
private _initStateHasBeenDispatched?;
|
|
16
|
+
constructor(_store: Store, _internalStateOperations: InternalStateOperations, _stateContextFactory: StateContextFactory, _appBootstrappedState: ɵNgxsAppBootstrappedState);
|
|
17
|
+
ngOnDestroy(): void;
|
|
18
|
+
ngxsBootstrap(action: InitState | UpdateState, results: StatesAndDefaults | undefined): void;
|
|
19
|
+
private _invokeInitOnStates;
|
|
20
|
+
private _invokeBootstrapOnStates;
|
|
21
|
+
private _getStateContext;
|
|
22
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<LifecycleStateManager, never>;
|
|
23
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<LifecycleStateManager>;
|
|
24
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { StateContext } from '../symbols';
|
|
2
|
+
import { MappedStore } from '../internal/internals';
|
|
3
|
+
import { InternalStateOperations } from '../internal/state-operations';
|
|
4
|
+
import * as i0 from "@angular/core";
|
|
5
|
+
/**
|
|
6
|
+
* State Context factory class
|
|
7
|
+
* @ignore
|
|
8
|
+
*/
|
|
9
|
+
export declare class StateContextFactory {
|
|
10
|
+
private _internalStateOperations;
|
|
11
|
+
constructor(_internalStateOperations: InternalStateOperations);
|
|
12
|
+
/**
|
|
13
|
+
* Create the state context
|
|
14
|
+
*/
|
|
15
|
+
createStateContext<T>(mappedStore: MappedStore): StateContext<T>;
|
|
16
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<StateContextFactory, never>;
|
|
17
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<StateContextFactory>;
|
|
18
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { Injector, OnDestroy } from '@angular/core';
|
|
2
|
+
import { ɵStateClassInternal, ɵRuntimeSelectorContext } from '@ngxs/store/internals';
|
|
3
|
+
import { Observable } from 'rxjs';
|
|
4
|
+
import { NgxsConfig } from '../symbols';
|
|
5
|
+
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
|
+
import * as i0 from "@angular/core";
|
|
10
|
+
/**
|
|
11
|
+
* The `StateFactory` class adds root and feature states to the graph.
|
|
12
|
+
* This extracts state names from state classes, checks if they already
|
|
13
|
+
* exist in the global graph, throws errors if their names are invalid, etc.
|
|
14
|
+
* See its constructor, state factories inject state factories that are
|
|
15
|
+
* parent-level providers. This is required to get feature states from the
|
|
16
|
+
* injector on the same level.
|
|
17
|
+
*
|
|
18
|
+
* The `NgxsModule.forFeature(...)` returns `providers: [StateFactory, ...states]`.
|
|
19
|
+
* The `StateFactory` is initialized on the feature level and goes through `...states`
|
|
20
|
+
* to get them from the injector through `injector.get(state)`.
|
|
21
|
+
* @ignore
|
|
22
|
+
*/
|
|
23
|
+
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;
|
|
31
|
+
private _actionsSubscription;
|
|
32
|
+
private _propGetter;
|
|
33
|
+
private _ngxsUnhandledErrorHandler;
|
|
34
|
+
constructor(_injector: Injector, _config: NgxsConfig, _parentFactory: StateFactory, _actions: InternalActions, _actionResults: InternalDispatchedActionResults, _stateContextFactory: StateContextFactory, _initialState: any);
|
|
35
|
+
private _states;
|
|
36
|
+
get states(): MappedStore[];
|
|
37
|
+
private _statesByName;
|
|
38
|
+
get statesByName(): StatesByName;
|
|
39
|
+
private _statePaths;
|
|
40
|
+
private get statePaths();
|
|
41
|
+
getRuntimeSelectorContext: () => ɵRuntimeSelectorContext;
|
|
42
|
+
ngOnDestroy(): void;
|
|
43
|
+
/**
|
|
44
|
+
* Add a new state to the global defs.
|
|
45
|
+
*/
|
|
46
|
+
add(stateClasses: ɵStateClassInternal[]): MappedStore[];
|
|
47
|
+
/**
|
|
48
|
+
* Add a set of states to the store and return the defaults
|
|
49
|
+
*/
|
|
50
|
+
addAndReturnDefaults(stateClasses: ɵStateClassInternal[]): StatesAndDefaults;
|
|
51
|
+
connectActionHandlers(): void;
|
|
52
|
+
/**
|
|
53
|
+
* Invoke actions on the states.
|
|
54
|
+
*/
|
|
55
|
+
invokeActions(dispatched$: Observable<ActionContext>, action: any): Observable<[any]>;
|
|
56
|
+
private addToStatesMap;
|
|
57
|
+
private addRuntimeInfoToMeta;
|
|
58
|
+
private hasBeenMountedAndBootstrapped;
|
|
59
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<StateFactory, [null, null, { optional: true; skipSelf: true; }, null, null, null, { optional: true; }]>;
|
|
60
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<StateFactory>;
|
|
61
|
+
}
|